ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

static GLint alloc_state_var_array ( const slang_variable var,
struct gl_program_parameter_list paramList 
) [static]

Unroll the named built-in uniform variable into a sequence of state vars in the given parameter list.

Definition at line 584 of file slang_builtin.c.

Referenced by _slang_alloc_statevar().

{
   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 doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.