GLint
_mesa_add_parameter(struct gl_program_parameter_list *paramList,
enum register_file type, const char *name,
- GLuint size, const GLfloat *values,
+ GLuint size, GLenum datatype, const GLfloat *values,
const gl_state_index state[STATE_LENGTH])
{
const GLuint oldNum = paramList->NumParameters;
p->Name = name ? _mesa_strdup(name) : NULL;
p->Type = type;
p->Size = size;
+ p->DataType = datatype;
if (values) {
COPY_4V(paramList->ParameterValues[oldNum + i], values);
values += 4;
const char *name, const GLfloat values[4])
{
return _mesa_add_parameter(paramList, PROGRAM_NAMED_PARAM, name,
- 4, values, NULL);
+ 4, GL_NONE, values, NULL);
}
#endif
size = 4; /** XXX fix */
return _mesa_add_parameter(paramList, PROGRAM_CONSTANT, name,
- size, values, NULL);
+ size, GL_NONE, values, NULL);
}
/* add a new parameter to store this constant */
pos = _mesa_add_parameter(paramList, PROGRAM_CONSTANT, NULL,
- size, values, NULL);
+ size, GL_NONE, values, NULL);
if (pos >= 0 && swizzleOut) {
if (size == 1)
*swizzleOut = SWIZZLE_XXXX;
GLint
_mesa_add_uniform(struct gl_program_parameter_list *paramList,
- const char *name, GLuint size)
+ const char *name, GLuint size, GLenum datatype)
{
GLint i = _mesa_lookup_parameter_index(paramList, -1, name);
+ ASSERT(datatype != GL_NONE);
if (i >= 0 && paramList->Parameters[i].Type == PROGRAM_UNIFORM) {
+ ASSERT(paramList->Parameters[i].Size == size);
+ ASSERT(paramList->Parameters[i].DataType == datatype);
/* already in list */
return i;
}
else {
i = _mesa_add_parameter(paramList, PROGRAM_UNIFORM, name,
- size, NULL, NULL);
+ size, datatype, NULL, NULL);
return i;
}
GLint
_mesa_add_sampler(struct gl_program_parameter_list *paramList,
- const char *name)
+ const char *name, GLenum datatype)
{
GLint i = _mesa_lookup_parameter_index(paramList, -1, name);
if (i >= 0 && paramList->Parameters[i].Type == PROGRAM_SAMPLER) {
else {
const GLint size = 1;
i = _mesa_add_parameter(paramList, PROGRAM_SAMPLER, name,
- size, NULL, NULL);
+ size, datatype, NULL, NULL);
return i;
}
}
else {
assert(size == 4);
i = _mesa_add_parameter(paramList, PROGRAM_VARYING, name,
- size, NULL, NULL);
+ size, GL_NONE, NULL, NULL);
return i;
}
}
if (size < 0)
size = 4;
i = _mesa_add_parameter(paramList, PROGRAM_INPUT, name,
- size, NULL, state);
+ size, GL_NONE, NULL, state);
}
return i;
}
name = _mesa_program_state_string(stateTokens);
index = _mesa_add_parameter(paramList, PROGRAM_STATE_VAR, name,
- size, NULL, (gl_state_index *) stateTokens);
+ size, GL_NONE,
+ NULL, (gl_state_index *) stateTokens);
paramList->StateFlags |= _mesa_program_state_flags(stateTokens);
/* free name string here since we duplicated it in add_parameter() */
for (i = 0; i < list->NumParameters; i++) {
struct gl_program_parameter *p = list->Parameters + i;
GLuint size = MIN2(p->Size, 4);
- GLint j = _mesa_add_parameter(clone, p->Type, p->Name,
- size, list->ParameterValues[i], NULL);
+ GLint j = _mesa_add_parameter(clone, p->Type, p->Name, size, p->DataType,
+ list->ParameterValues[i], NULL);
ASSERT(j >= 0);
/* copy state indexes */
if (p->Type == PROGRAM_STATE_VAR) {
{
const char *Name; /**< Null-terminated string */
enum register_file Type; /**< PROGRAM_NAMED_PARAM, CONSTANT or STATE_VAR */
+ GLenum DataType; /**< GL_FLOAT, GL_FLOAT_VEC2, etc */
GLuint Size; /**< Number of components (1..4) */
/**
* A sequence of STATE_* tokens and integers to identify GL state.
extern GLint
_mesa_add_parameter(struct gl_program_parameter_list *paramList,
enum register_file type, const char *name,
- GLuint size, const GLfloat *values,
+ GLuint size, GLenum datatype, const GLfloat *values,
const gl_state_index state[STATE_LENGTH]);
extern GLint
extern GLint
_mesa_add_uniform(struct gl_program_parameter_list *paramList,
- const char *name, GLuint size);
+ const char *name, GLuint size, GLenum datatype);
extern GLint
_mesa_add_sampler(struct gl_program_parameter_list *paramList,
- const char *name);
+ const char *name, GLenum datatype);
extern GLint
_mesa_add_varying(struct gl_program_parameter_list *paramList,
* store->Index = sampler uniform location
* store->Size = texture type index (1D, 2D, 3D, cube, etc)
*/
- GLint samplerUniform = _mesa_add_sampler(prog->Parameters, varName);
+ GLenum datatype = GL_SAMPLER_2D;
+ GLint samplerUniform = _mesa_add_sampler(prog->Parameters, varName, datatype);
store = _slang_new_ir_storage(PROGRAM_SAMPLER, samplerUniform, texIndex);
if (dbg) printf("SAMPLER ");
}
* MAX2(var->array_len, 1);
if (prog) {
/* user-defined uniform */
- GLint uniformLoc = _mesa_add_uniform(prog->Parameters, varName, size);
+ GLenum datatype = GL_FLOAT_VEC4; /* XXX */
+ GLint uniformLoc = _mesa_add_uniform(prog->Parameters, varName,
+ size, datatype);
store = _slang_new_ir_storage(PROGRAM_UNIFORM, uniformLoc, size);
}
else {