diff options
Diffstat (limited to 'src/mesa/shader')
-rw-r--r-- | src/mesa/shader/arbprogparse.c | 2 | ||||
-rw-r--r-- | src/mesa/shader/nvfragparse.c | 8 | ||||
-rw-r--r-- | src/mesa/shader/program.c | 7 | ||||
-rw-r--r-- | src/mesa/shader/program.h | 5 | ||||
-rw-r--r-- | src/mesa/shader/programopt.c | 2 |
5 files changed, 14 insertions, 10 deletions
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index a423e4ff138..5a61f30193b 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -1810,7 +1810,7 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst, parse_constant (inst, const_values, Program, use); idx = _mesa_add_named_constant(Program->Base.Parameters, (char *) param_var->name, - const_values); + const_values, 4); if (param_var->param_binding_begin == ~0U) param_var->param_binding_begin = idx; param_var->param_binding_length++; diff --git a/src/mesa/shader/nvfragparse.c b/src/mesa/shader/nvfragparse.c index 5f3a30b7416..79e6dbd87b7 100644 --- a/src/mesa/shader/nvfragparse.c +++ b/src/mesa/shader/nvfragparse.c @@ -1041,7 +1041,7 @@ Parse_VectorSrc(struct parse_state *parseState, GLuint paramIndex; if (!Parse_ScalarConstant(parseState, values)) RETURN_ERROR; - paramIndex = _mesa_add_unnamed_constant(parseState->parameters, values); + paramIndex = _mesa_add_unnamed_constant(parseState->parameters, values, 4); srcReg->File = PROGRAM_NAMED_PARAM; srcReg->Index = paramIndex; } @@ -1052,7 +1052,7 @@ Parse_VectorSrc(struct parse_state *parseState, (void) Parse_String(parseState, "{"); if (!Parse_VectorConstant(parseState, values)) RETURN_ERROR; - paramIndex = _mesa_add_unnamed_constant(parseState->parameters, values); + paramIndex = _mesa_add_unnamed_constant(parseState->parameters, values, 4); srcReg->File = PROGRAM_NAMED_PARAM; srcReg->Index = paramIndex; } @@ -1142,7 +1142,7 @@ Parse_ScalarSrcReg(struct parse_state *parseState, (void) Parse_String(parseState, "{"); if (!Parse_VectorConstant(parseState, values)) RETURN_ERROR; - paramIndex = _mesa_add_unnamed_constant(parseState->parameters, values); + paramIndex = _mesa_add_unnamed_constant(parseState->parameters, values, 4); srcReg->File = PROGRAM_NAMED_PARAM; srcReg->Index = paramIndex; } @@ -1166,7 +1166,7 @@ Parse_ScalarSrcReg(struct parse_state *parseState, GLuint paramIndex; if (!Parse_ScalarConstant(parseState, values)) RETURN_ERROR; - paramIndex = _mesa_add_unnamed_constant(parseState->parameters, values); + paramIndex = _mesa_add_unnamed_constant(parseState->parameters, values, 4); srcReg->Index = paramIndex; srcReg->File = PROGRAM_NAMED_PARAM; needSuffix = GL_FALSE; diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 5c03ad44c2e..e903fd03051 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -437,9 +437,11 @@ _mesa_add_named_parameter(struct gl_program_parameter_list *paramList, */ GLint _mesa_add_named_constant(struct gl_program_parameter_list *paramList, - const char *name, const GLfloat values[4]) + const char *name, const GLfloat values[4], + GLuint size) { GLuint pos, swizzle; + ASSERT(size == 4); /* XXX future feature */ /* check if we already have this constant */ if (_mesa_lookup_parameter_constant(paramList, values, 4, &pos, &swizzle)) { return pos; @@ -459,9 +461,10 @@ _mesa_add_named_constant(struct gl_program_parameter_list *paramList, */ GLint _mesa_add_unnamed_constant(struct gl_program_parameter_list *paramList, - const GLfloat values[4]) + const GLfloat values[4], GLuint size) { GLuint pos, swizzle; + ASSERT(size == 4); /* XXX future feature */ /* check if we already have this constant */ if (_mesa_lookup_parameter_constant(paramList, values, 4, &pos, &swizzle)) { return pos; diff --git a/src/mesa/shader/program.h b/src/mesa/shader/program.h index 3f84ea8a403..a38a1a63f9c 100644 --- a/src/mesa/shader/program.h +++ b/src/mesa/shader/program.h @@ -238,11 +238,12 @@ _mesa_add_named_parameter(struct gl_program_parameter_list *paramList, extern GLint _mesa_add_named_constant(struct gl_program_parameter_list *paramList, - const char *name, const GLfloat values[4]); + const char *name, const GLfloat values[4], + GLuint size); extern GLint _mesa_add_unnamed_constant(struct gl_program_parameter_list *paramList, - const GLfloat values[4]); + const GLfloat values[4], GLuint size); extern GLint _mesa_add_state_reference(struct gl_program_parameter_list *paramList, diff --git a/src/mesa/shader/programopt.c b/src/mesa/shader/programopt.c index 172d373b578..783177739d1 100644 --- a/src/mesa/shader/programopt.c +++ b/src/mesa/shader/programopt.c @@ -172,7 +172,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog) fogVals[1] = 1.0 / SQRTF(log(2.0)); fogVals[2] = 0.0; fogVals[3] = 0.0; - fogConsts = _mesa_add_unnamed_constant(fprog->Base.Parameters, fogVals); + fogConsts = _mesa_add_unnamed_constant(fprog->Base.Parameters, fogVals, 4); /* Scan program to find where result.color is written */ inst = newInst; |