{
gl_state_index tokens[STATE_LENGTH];
GLuint i;
GLint pos;
/* Initialize the state tokens array. This is very important. * When we call _mesa_add_state_reference() it'll searches the parameter * list to see if the given statevar token sequence is already present. * This is normally a good thing since it prevents redundant values in the * constant buffer. * * But when we're building arrays of state this can be bad. For example, * consider this fragment of GLSL code: * foo = gl_LightSource[3].diffuse; * ... * bar = gl_LightSource[i].diffuse; * * When we unroll the gl_LightSource array (for "bar") we want to re-emit * gl_LightSource[3].diffuse and not re-use the first instance (from "foo") * since that would upset the array layout. We handle this situation by * setting the last token in the state var token array to the special * value STATE_ARRAY. * This token will only be set for array state. We can hijack the last * element in the array for this since it's never used for light, clipplane * or texture env array state. */for (i = 0; i < STATE_LENGTH; i++)
tokens[i] = 0;
tokens[STATE_LENGTH - 1] = STATE_ARRAY;
pos = emit_statevars(var->a_name, var->array_len, &var->type.specifier,
tokens, paramList);
return pos;
}
Generated on Sat May 26 2012 04:58:03 for ReactOS by
1.7.6.1
ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.