summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/shader_api.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-11-05 09:17:55 -0700
committerBrian Paul <[email protected]>2008-11-05 09:17:55 -0700
commit949e7383b597563b5603ba9b63fcfa4b1f45cf42 (patch)
tree65aac238d8665137d7da1f9a61a9b56313f968d6 /src/mesa/shader/shader_api.c
parentaab429c8df228271786890691a43786baf091b37 (diff)
mesa: add Initialized field to gl_uniform struct, for debugging purposes only
Diffstat (limited to 'src/mesa/shader/shader_api.c')
-rw-r--r--src/mesa/shader/shader_api.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 504d7693234..4fc9f3daaa3 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -1505,10 +1505,12 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program,
GLenum type, GLsizei count, GLint elems,
const void *values)
{
+ struct gl_program_parameter *param =
+ &program->Parameters->Parameters[index];
+
assert(offset >= 0);
- if (!compatible_types(type,
- program->Parameters->Parameters[index].DataType)) {
+ if (!compatible_types(type, param->DataType)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(type mismatch)");
return;
}
@@ -1518,7 +1520,7 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program,
return;
}
- if (program->Parameters->Parameters[index].Type == PROGRAM_SAMPLER) {
+ if (param->Type == PROGRAM_SAMPLER) {
/* This controls which texture unit which is used by a sampler */
GLuint texUnit, sampler;
@@ -1549,9 +1551,9 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program,
else {
/* ordinary uniform variable */
GLsizei k, i;
- GLint slots = (program->Parameters->Parameters[index].Size + 3) / 4;
+ GLint slots = (param->Size + 3) / 4;
- if (count * elems > (GLint) program->Parameters->Parameters[index].Size) {
+ if (count * elems > (GLint) param->Size) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(count too large)");
return;
}
@@ -1560,7 +1562,8 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program,
count = slots;
for (k = 0; k < count; k++) {
- GLfloat *uniformVal = program->Parameters->ParameterValues[index + offset + k];
+ GLfloat *uniformVal =
+ program->Parameters->ParameterValues[index + offset + k];
if (is_integer_type(type)) {
const GLint *iValues = ((const GLint *) values) + k * elems;
for (i = 0; i < elems; i++) {
@@ -1575,7 +1578,7 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program,
}
/* if the uniform is bool-valued, convert to 1.0 or 0.0 */
- if (is_boolean_type(program->Parameters->Parameters[index].DataType)) {
+ if (is_boolean_type(param->DataType)) {
for (i = 0; i < elems; i++) {
uniformVal[i] = uniformVal[i] ? 1.0 : 0.0;
}
@@ -1659,6 +1662,8 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count,
index, offset, type, count, elems, values);
}
}
+
+ shProg->Uniforms->Uniforms[location].Initialized = GL_TRUE;
}
@@ -1769,6 +1774,8 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows,
count, rows, cols, transpose, values);
}
}
+
+ shProg->Uniforms->Uniforms[location].Initialized = GL_TRUE;
}