View Full Version : dynamic indexing in arrays ?¿ is it possible?
03-21-2006, 07:40 AM
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.
03-21-2006, 07:49 AM
i forgot to add some code snippet:
uniform vec2 weight;
int index = gl_Vertex.y * weight + gl_Color.y * weight;
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.
03-21-2006, 07:54 AM
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!
03-22-2006, 02:27 AM
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.