core | glapi | vbo | math | shader | swrast | swrast_setup | tnl | tnl_dd

prog_statevars.h File Reference

#include "main/mtypes.h"

Defines

#define STATE_LENGTH   5
 Number of STATE_* values we need to address any GL state.

Typedefs

typedef enum gl_state_index_ gl_state_index

Enumerations

enum  gl_state_index_ {
  STATE_MATERIAL = 100, STATE_LIGHT, STATE_LIGHTMODEL_AMBIENT, STATE_LIGHTMODEL_SCENECOLOR,
  STATE_LIGHTPROD, STATE_TEXGEN, STATE_FOG_COLOR, STATE_FOG_PARAMS,
  STATE_CLIPPLANE, STATE_POINT_SIZE, STATE_POINT_ATTENUATION, STATE_MODELVIEW_MATRIX,
  STATE_PROJECTION_MATRIX, STATE_MVP_MATRIX, STATE_TEXTURE_MATRIX, STATE_PROGRAM_MATRIX,
  STATE_COLOR_MATRIX, STATE_MATRIX_INVERSE, STATE_MATRIX_TRANSPOSE, STATE_MATRIX_INVTRANS,
  STATE_AMBIENT, STATE_DIFFUSE, STATE_SPECULAR, STATE_EMISSION,
  STATE_SHININESS, STATE_HALF_VECTOR, STATE_POSITION, STATE_ATTENUATION,
  STATE_SPOT_DIRECTION, STATE_SPOT_CUTOFF, STATE_TEXGEN_EYE_S, STATE_TEXGEN_EYE_T,
  STATE_TEXGEN_EYE_R, STATE_TEXGEN_EYE_Q, STATE_TEXGEN_OBJECT_S, STATE_TEXGEN_OBJECT_T,
  STATE_TEXGEN_OBJECT_R, STATE_TEXGEN_OBJECT_Q, STATE_TEXENV_COLOR, STATE_DEPTH_RANGE,
  STATE_VERTEX_PROGRAM, STATE_FRAGMENT_PROGRAM, STATE_ENV, STATE_LOCAL,
  STATE_INTERNAL, STATE_CURRENT_ATTRIB, STATE_NORMAL_SCALE, STATE_TEXRECT_SCALE,
  STATE_FOG_PARAMS_OPTIMIZED, STATE_LIGHT_SPOT_DIR_NORMALIZED, STATE_LIGHT_POSITION, STATE_LIGHT_POSITION_NORMALIZED,
  STATE_LIGHT_HALF_VECTOR, STATE_PT_SCALE, STATE_PT_BIAS, STATE_PCM_SCALE,
  STATE_PCM_BIAS, STATE_SHADOW_AMBIENT, STATE_FB_SIZE, STATE_ROT_MATRIX_0,
  STATE_ROT_MATRIX_1, STATE_INTERNAL_DRIVER
}
 Used for describing GL state referenced from inside ARB vertex and fragment programs. More...

Functions

void _mesa_load_state_parameters (GLcontext *ctx, struct gl_program_parameter_list *paramList)
 Loop over all the parameters in a parameter list.
GLbitfield _mesa_program_state_flags (const gl_state_index state[STATE_LENGTH])
 Return a bitmask of the Mesa state flags (_NEW_* values) which would indicate that the given context state may have changed.
char * _mesa_program_state_string (const gl_state_index state[STATE_LENGTH])
 Make a string from the given state vector.
void _mesa_load_tracked_matrices (GLcontext *ctx)
 Load current vertex program's parameter registers with tracked matrices (if NV program).


Define Documentation

#define STATE_LENGTH   5

Number of STATE_* values we need to address any GL state.

Used to dimension arrays.


Typedef Documentation

typedef enum gl_state_index_ gl_state_index


Enumeration Type Documentation

enum gl_state_index_

Used for describing GL state referenced from inside ARB vertex and fragment programs.

A string such as "state.light[0].ambient" gets translated into a sequence of tokens such as [ STATE_LIGHT, 0, STATE_AMBIENT ].

For state that's an array, like STATE_CLIPPLANE, the 2nd token [1] should always be the array index.

Enumerator:
STATE_MATERIAL 
STATE_LIGHT 
STATE_LIGHTMODEL_AMBIENT 
STATE_LIGHTMODEL_SCENECOLOR 
STATE_LIGHTPROD 
STATE_TEXGEN 
STATE_FOG_COLOR 
STATE_FOG_PARAMS 
STATE_CLIPPLANE 
STATE_POINT_SIZE 
STATE_POINT_ATTENUATION 
STATE_MODELVIEW_MATRIX 
STATE_PROJECTION_MATRIX 
STATE_MVP_MATRIX 
STATE_TEXTURE_MATRIX 
STATE_PROGRAM_MATRIX 
STATE_COLOR_MATRIX 
STATE_MATRIX_INVERSE 
STATE_MATRIX_TRANSPOSE 
STATE_MATRIX_INVTRANS 
STATE_AMBIENT 
STATE_DIFFUSE 
STATE_SPECULAR 
STATE_EMISSION 
STATE_SHININESS 
STATE_HALF_VECTOR 
STATE_POSITION  xyzw = position
STATE_ATTENUATION  xyz = attenuation, w = spot exponent
STATE_SPOT_DIRECTION  xyz = direction, w = cos(cutoff)
STATE_SPOT_CUTOFF  x = cutoff, yzw = undefined
STATE_TEXGEN_EYE_S 
STATE_TEXGEN_EYE_T 
STATE_TEXGEN_EYE_R 
STATE_TEXGEN_EYE_Q 
STATE_TEXGEN_OBJECT_S 
STATE_TEXGEN_OBJECT_T 
STATE_TEXGEN_OBJECT_R 
STATE_TEXGEN_OBJECT_Q 
STATE_TEXENV_COLOR 
STATE_DEPTH_RANGE 
STATE_VERTEX_PROGRAM 
STATE_FRAGMENT_PROGRAM 
STATE_ENV 
STATE_LOCAL 
STATE_INTERNAL 
STATE_CURRENT_ATTRIB 
STATE_NORMAL_SCALE 
STATE_TEXRECT_SCALE 
STATE_FOG_PARAMS_OPTIMIZED 
STATE_LIGHT_SPOT_DIR_NORMALIZED 
STATE_LIGHT_POSITION 
STATE_LIGHT_POSITION_NORMALIZED 
STATE_LIGHT_HALF_VECTOR 
STATE_PT_SCALE  Pixel transfer RGBA scale.
STATE_PT_BIAS  Pixel transfer RGBA bias.
STATE_PCM_SCALE  Post color matrix RGBA scale.
STATE_PCM_BIAS  Post color matrix RGBA bias.
STATE_SHADOW_AMBIENT  ARB_shadow_ambient fail value; token[2] is texture unit index.
STATE_FB_SIZE  (width-1, height-1, 0, 0)
STATE_ROT_MATRIX_0  ATI_envmap_bumpmap, rot matrix row 0.
STATE_ROT_MATRIX_1  ATI_envmap_bumpmap, rot matrix row 1.
STATE_INTERNAL_DRIVER 


Function Documentation

void _mesa_load_state_parameters ( GLcontext ctx,
struct gl_program_parameter_list paramList 
)

Loop over all the parameters in a parameter list.

If the parameter is a GL state reference, look up the current value of that state variable and put it into the parameter's Value[4] array. This would be called at glBegin time when using a fragment program.

void _mesa_load_tracked_matrices ( GLcontext ctx  ) 

Load current vertex program's parameter registers with tracked matrices (if NV program).

This only needs to be done per glBegin/glEnd, not per-vertex.

GLbitfield _mesa_program_state_flags ( const gl_state_index  state[STATE_LENGTH]  ) 

Return a bitmask of the Mesa state flags (_NEW_* values) which would indicate that the given context state may have changed.

The bitmask is used during validation to determine if we need to update vertex/fragment program parameters (like "state.material.color") when some GL state has changed.

char* _mesa_program_state_string ( const gl_state_index  state[STATE_LENGTH]  ) 

Make a string from the given state vector.

For example, return "state.matrix.texture[2].inverse". Use _mesa_free() to deallocate the string.


Generated on Sun Sep 27 06:48:02 2009 for Mesa Vertex and Fragment Program code by  doxygen 1.5.4