#include "main/glheader.h"
#include "main/imports.h"
#include "main/macros.h"
#include "prog_instruction.h"
#include "prog_parameter.h"
#include "prog_statevars.h"
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. | |
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. | |
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 *listA, const struct gl_program_parameter_list *listB) |
Return a new parameter list which is listA + listB. | |
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. |
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.
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 };
paramList | the parameter list | |
name | the name for the constant | |
values | four float values |
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_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).
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 |
GLint _mesa_add_sampler | ( | struct gl_program_parameter_list * | paramList, | |
const char * | name, | |||
GLenum | datatype | |||
) |
Add a sampler to the parameter list.
name | uniform's name | |
datatype | GL_SAMPLER_2D, GL_SAMPLER_2D_RECT_ARB, etc. | |
index | the sampler number (as seen in TEX instructions) |
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;
paramList | the parameter list | |
stateTokens | an array of 5 (STATE_LENGTH) state tokens |
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.
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.
paramList | the parameter list | |
values | four float values | |
swizzleOut | returns swizzle mask for accessing the constant |
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 * | listA, | |
const struct gl_program_parameter_list * | listB | |||
) | [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.
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. |
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.
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 |
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.
struct gl_program_parameter_list* _mesa_new_parameter_list | ( | void | ) | [read] |
struct gl_program_parameter_list* _mesa_new_parameter_list_sized | ( | unsigned | size | ) | [read] |
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'.