2012-08-22 56 views
0

在GLES2.0的VertexShader中可以使用struct array uniform嗎?是否可以在GLES2.0的VertexShader中使用結構數組uniform?

attribute highp vec4 vPosition; 

struct TestStruct{ 
    highp vec4 v; 
}; 
uniform TestStruct tmp[32]; 

void main() { 
    // test code 
    gl_Position = vPosition + tmp[31].v; 
} 

我收到着色器編譯錯誤。 「
」頂點着色器中的統一變量不適合512向量「

我的GPU是Qualcomm adreno220。

有沒有人有關於它的一些信息?
我很困擾。

謝謝。

+0

我檢查了我的設備上的着色器代碼(使用tegra2 GPU的Galaxy選項卡),它的工作原理...我認爲它與GPU相關.. – chrisendymion

+0

感謝您的檢查。我也調查了這個問題,並且我同意你與GPU有關。 – user1602722

+0

是的,它是! 檢查:http://stackoverflow.com/questions/16739993/passing-custom-type-struct-uniform-from-qt-to-glsl-using-qglshaderprogram/16740817#16740817 –

回答

0

這是可能的。有可能你的數組太大了。嘗試一個低於10而不是32的數字。

+0

謝謝您的建議,但我需要使用超過10個單位。 – user1602722

+0

只要嘗試看看是否少於10件作品。如果是這樣,那麼這是一個GPU限制,你必須忍受。 – dragostis

相關問題