we are developing some GPU algorithm which involves indexing an array with an index calculated from an uniform and gl_color/vertex information.
Have anybody tried to do something similar ?
Thank you in advance.
we are developing some GPU algorithm which involves indexing an array with an index calculated from an uniform and gl_color/vertex information.
Have anybody tried to do something similar ?
Thank you in advance.
i forgot to add some code snippet:
…
uniform vec2 weight;
int index = gl_Vertex.y * weight[0] + gl_Color.y * weight[1];
float res[4];
…
res[index] = 1; // “lvalue too complex”
float a = res[index]; //“exception during compilation”
the error messages come after linking, with no problem in compilation time.
easily:
float v[4];
v[int(gl_Vertex.x)] = 1.; // “lvalue too complex”
gl_Position.x = v[int(gl_Vertex.x)]; //“exception during compilation”
so strange message after compiling without error…
*Note1: we are using ShaderDesigner 1.5.9 to test -> Generic Compilation does not report any problem.
*Note2: 3dlabs GLSLValidate returns CORRECT!
As far as I am aware current hardware cannot do arbitary indexing, you can only index into uniform arrays.
If your arrays are small you can probably just use a “switch statement” to select.
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.