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

prog_parameter.h File Reference

#include "main/mtypes.h"
#include "prog_statevars.h"

Data Structures

struct  gl_program_parameter
 Program parameter. More...
struct  gl_program_parameter_list
 List of gl_program_parameter instances. More...

Defines

#define PROG_PARAM_BIT_CENTROID   0x1
 Program parameter flags.
#define PROG_PARAM_BIT_INVARIANT   0x2
 for varying vars (GLSL 1.20)
#define PROG_PARAM_BIT_FLAT   0x4
 for varying vars (GLSL 1.30)
#define PROG_PARAM_BIT_LINEAR   0x8
 for varying vars (GLSL 1.30)

Functions

struct gl_program_parameter_list_mesa_new_parameter_list (void)
struct gl_program_parameter_list_mesa_new_parameter_list_sized (unsigned size)
void _mesa_free_parameter_list (struct gl_program_parameter_list *paramList)
 Free a parameter list and all its parameters.
struct gl_program_parameter_list_mesa_clone_parameter_list (const struct gl_program_parameter_list *list)
struct gl_program_parameter_list_mesa_combine_parameter_lists (const struct gl_program_parameter_list *a, const struct gl_program_parameter_list *b)
 Return a new parameter list which is listA + listB.
static INLINE GLuint _mesa_num_parameters (const struct gl_program_parameter_list *list)
GLint _mesa_add_parameter (struct gl_program_parameter_list *paramList, gl_register_file type, const char *name, GLuint size, GLenum datatype, const GLfloat *values, const gl_state_index state[STATE_LENGTH], GLbitfield flags)
 Add a new parameter to a parameter list.
GLint _mesa_add_named_parameter (struct gl_program_parameter_list *paramList, const char *name, const GLfloat values[4])
 Add a new named program parameter (Ex: NV_fragment_program DEFINE statement).
GLint _mesa_add_named_constant (struct gl_program_parameter_list *paramList, const char *name, const GLfloat values[4], GLuint size)
 Add a new named constant to the parameter list.
GLint _mesa_add_unnamed_constant (struct gl_program_parameter_list *paramList, const GLfloat values[4], GLuint size, GLuint *swizzleOut)
 Add a new unnamed constant to the parameter list.
GLint _mesa_add_uniform (struct gl_program_parameter_list *paramList, const char *name, GLuint size, GLenum datatype, const GLfloat *values)
 Add a uniform to the parameter list.
void _mesa_use_uniform (struct gl_program_parameter_list *paramList, const char *name)
 Mark the named uniform as 'used'.
GLint _mesa_add_sampler (struct gl_program_parameter_list *paramList, const char *name, GLenum datatype)
 Add a sampler to the parameter list.
GLint _mesa_add_varying (struct gl_program_parameter_list *paramList, const char *name, GLuint size, GLbitfield flags)
 Add parameter representing a varying variable.
GLint _mesa_add_attribute (struct gl_program_parameter_list *paramList, const char *name, GLint size, GLenum datatype, GLint attrib)
 Add parameter representing a vertex program attribute.
GLint _mesa_add_state_reference (struct gl_program_parameter_list *paramList, const gl_state_index stateTokens[STATE_LENGTH])
 Add a new state reference to the parameter list.
GLfloat * _mesa_lookup_parameter_value (const struct gl_program_parameter_list *paramList, GLsizei nameLen, const char *name)
 Lookup a parameter value by name in the given parameter list.
GLint _mesa_lookup_parameter_index (const struct gl_program_parameter_list *paramList, GLsizei nameLen, const char *name)
 Given a program parameter name, find its position in the list of parameters.
GLboolean _mesa_lookup_parameter_constant (const struct gl_program_parameter_list *list, const GLfloat v[], GLuint vSize, GLint *posOut, GLuint *swizzleOut)
 Look for a float vector in the given parameter list.
GLuint _mesa_longest_parameter_name (const struct gl_program_parameter_list *list, gl_register_file type)
 Find longest name of all uniform parameters in list.
GLuint _mesa_num_parameters_of_type (const struct gl_program_parameter_list *list, gl_register_file type)
 Count the number of parameters in the last that match the given type.


Define Documentation

#define PROG_PARAM_BIT_CENTROID   0x1

Program parameter flags.

for varying vars (GLSL 1.20)

#define PROG_PARAM_BIT_FLAT   0x4

for varying vars (GLSL 1.30)

#define PROG_PARAM_BIT_INVARIANT   0x2

for varying vars (GLSL 1.20)

#define PROG_PARAM_BIT_LINEAR   0x8

for varying vars (GLSL 1.30)


Function Documentation

GLint _mesa_add_attribute ( struct gl_program_parameter_list paramList,
const char *  name,
GLint  size,
GLenum  datatype,
GLint  attrib 
)

Add parameter representing a vertex program attribute.

Parameters:
size size of attribute (in floats), may be -1 if unknown
attrib the attribute index, or -1 if unknown

GLint _mesa_add_named_constant ( struct gl_program_parameter_list paramList,
const char *  name,
const GLfloat  values[4],
GLuint  size 
)

Add a new named constant to the parameter list.

This will be used when the program contains something like this: PARAM myVals = { 0, 1, 2, 3 };

Parameters:
paramList the parameter list
name the name for the constant
values four float values
Returns:
index/position of the new parameter in the parameter list

GLint _mesa_add_named_parameter ( struct gl_program_parameter_list paramList,
const char *  name,
const GLfloat  values[4] 
)

Add a new named program parameter (Ex: NV_fragment_program DEFINE statement).

Returns:
index of the new entry in the parameter list

GLint _mesa_add_parameter ( struct gl_program_parameter_list paramList,
gl_register_file  type,
const char *  name,
GLuint  size,
GLenum  datatype,
const GLfloat *  values,
const gl_state_index  state[STATE_LENGTH],
GLbitfield  flags 
)

Add a new parameter to a parameter list.

Note that parameter values are usually 4-element GLfloat vectors. When size > 4 we'll allocate a sequential block of parameters to store all the values (in blocks of 4).

Parameters:
paramList the list to add the parameter to
type type of parameter, such as
name the parameter name, will be duplicated/copied!
size number of elements in 'values' vector (1..4, or more)
datatype GL_FLOAT, GL_FLOAT_VECx, GL_INT, GL_INT_VECx or GL_NONE.
values initial parameter value, up to 4 GLfloats, or NULL
state state indexes, or NULL
Returns:
index of new parameter in the list, or -1 if error (out of mem)

GLint _mesa_add_sampler ( struct gl_program_parameter_list paramList,
const char *  name,
GLenum  datatype 
)

Add a sampler to the parameter list.

Parameters:
name uniform's name
datatype GL_SAMPLER_2D, GL_SAMPLER_2D_RECT_ARB, etc.
index the sampler number (as seen in TEX instructions)
Returns:
sampler index (starting at zero) or -1 if error

GLint _mesa_add_state_reference ( struct gl_program_parameter_list paramList,
const gl_state_index  stateTokens[STATE_LENGTH] 
)

Add a new state reference to the parameter list.

This will be used when the program contains something like this: PARAM ambient = state.material.front.ambient;

Parameters:
paramList the parameter list
stateTokens an array of 5 (STATE_LENGTH) state tokens
Returns:
index of the new parameter.

GLint _mesa_add_uniform ( struct gl_program_parameter_list paramList,
const char *  name,
GLuint  size,
GLenum  datatype,
const GLfloat *  values 
)

Add a uniform to the parameter list.

Note that if the uniform is an array, size may be greater than what's implied by the datatype.

Parameters:
name uniform's name
size number of floats to allocate
datatype GL_FLOAT_VEC3, GL_FLOAT_MAT4, etc.

GLint _mesa_add_unnamed_constant ( struct gl_program_parameter_list paramList,
const GLfloat  values[4],
GLuint  size,
GLuint *  swizzleOut 
)

Add a new unnamed constant to the parameter list.

This will be used when a fragment/vertex program contains something like this: MOV r, { 0, 1, 2, 3 }; We'll search the parameter list for an existing instance of the constant. If swizzleOut is non-null, we'll try swizzling when looking for a match.

Parameters:
paramList the parameter list
values four float values
swizzleOut returns swizzle mask for accessing the constant
Returns:
index/position of the new parameter in the parameter list.

GLint _mesa_add_varying ( struct gl_program_parameter_list paramList,
const char *  name,
GLuint  size,
GLbitfield  flags 
)

Add parameter representing a varying variable.

struct gl_program_parameter_list* _mesa_clone_parameter_list ( const struct gl_program_parameter_list list  )  [read]

Not too efficient, but correct

struct gl_program_parameter_list* _mesa_combine_parameter_lists ( const struct gl_program_parameter_list a,
const struct gl_program_parameter_list b 
) [read]

Return a new parameter list which is listA + listB.

void _mesa_free_parameter_list ( struct gl_program_parameter_list paramList  ) 

Free a parameter list and all its parameters.

GLuint _mesa_longest_parameter_name ( const struct gl_program_parameter_list list,
gl_register_file  type 
)

Find longest name of all uniform parameters in list.

GLboolean _mesa_lookup_parameter_constant ( const struct gl_program_parameter_list list,
const GLfloat  v[],
GLuint  vSize,
GLint *  posOut,
GLuint *  swizzleOut 
)

Look for a float vector in the given parameter list.

The float vector may be of length 1, 2, 3 or 4. If swizzleOut is non-null, we'll try swizzling to find a match.

Parameters:
list the parameter list to search
v the float vector to search for
vSize number of element in v
posOut returns the position of the constant, if found
swizzleOut returns a swizzle mask describing location of the vector elements if found.
Returns:
GL_TRUE if found, GL_FALSE if not found

GLint _mesa_lookup_parameter_index ( const struct gl_program_parameter_list paramList,
GLsizei  nameLen,
const char *  name 
)

Given a program parameter name, find its position in the list of parameters.

Parameters:
paramList the parameter list to search
nameLen length of name (in chars). If length is negative, assume that name is null-terminated.
name the name to search for
Returns:
index of parameter in the list.

GLfloat* _mesa_lookup_parameter_value ( const struct gl_program_parameter_list paramList,
GLsizei  nameLen,
const char *  name 
)

Lookup a parameter value by name in the given parameter list.

Returns:
pointer to the float[4] values.

struct gl_program_parameter_list* _mesa_new_parameter_list ( void   )  [read]

struct gl_program_parameter_list* _mesa_new_parameter_list_sized ( unsigned  size  )  [read]

static INLINE GLuint _mesa_num_parameters ( const struct gl_program_parameter_list list  )  [static]

GLuint _mesa_num_parameters_of_type ( const struct gl_program_parameter_list list,
gl_register_file  type 
)

Count the number of parameters in the last that match the given type.

void _mesa_use_uniform ( struct gl_program_parameter_list paramList,
const char *  name 
)

Mark the named uniform as 'used'.


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