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

prog_statevars.c File Reference


Detailed Description

Program state variable management.

Author:
Brian Paul

#include "main/glheader.h"
#include "main/context.h"
#include "main/hash.h"
#include "main/imports.h"
#include "main/macros.h"
#include "main/mtypes.h"
#include "prog_statevars.h"
#include "prog_parameter.h"

Functions

static void _mesa_fetch_state (GLcontext *ctx, const gl_state_index state[], GLfloat *value)
 Use the list of tokens in the state[] array to find global GL state and return it in

.

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.
static void append (char *dst, const char *src)
static void append_token (char *dst, gl_state_index k)
 Convert token 'k' to a string, append it onto 'dst' string.
static void append_face (char *dst, GLint face)
static void append_index (char *dst, GLint index)
char * _mesa_program_state_string (const gl_state_index state[STATE_LENGTH])
 Make a string from the given state vector.
void _mesa_load_state_parameters (GLcontext *ctx, struct gl_program_parameter_list *paramList)
 Loop over all the parameters in a parameter list.
static void load_matrix (GLfloat registers[][4], GLuint pos, const GLfloat mat[16])
 Copy the 16 elements of a matrix into four consecutive program registers starting at 'pos'.
static void load_transpose_matrix (GLfloat registers[][4], GLuint pos, const GLfloat mat[16])
 As above, but transpose the matrix.
void _mesa_load_tracked_matrices (GLcontext *ctx)
 Load current vertex program's parameter registers with tracked matrices (if NV program).


Function Documentation

static void _mesa_fetch_state ( GLcontext ctx,
const gl_state_index  state[],
GLfloat *  value 
) [static]

Use the list of tokens in the state[] array to find global GL state and return it in

.

Usually, four values are returned in

but matrix queries may return as many as 16 values. This function is used for ARB vertex/fragment programs. The program parser will produce the state[] values.

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.

static void append ( char *  dst,
const char *  src 
) [static]

static void append_face ( char *  dst,
GLint  face 
) [static]

static void append_index ( char *  dst,
GLint  index 
) [static]

static void append_token ( char *  dst,
gl_state_index  k 
) [static]

Convert token 'k' to a string, append it onto 'dst' string.

static void load_matrix ( GLfloat  registers[][4],
GLuint  pos,
const GLfloat  mat[16] 
) [static]

Copy the 16 elements of a matrix into four consecutive program registers starting at 'pos'.

static void load_transpose_matrix ( GLfloat  registers[][4],
GLuint  pos,
const GLfloat  mat[16] 
) [static]

As above, but transpose the matrix.


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