summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Berry <[email protected]>2014-01-08 10:17:01 -0800
committerPaul Berry <[email protected]>2014-01-09 09:31:16 -0800
commitb539385789a95074cc53c9e16988d2384ec5c7de (patch)
treebdbbb29e6c9d547cfea1c06929db6601d6256e95 /src
parent84732a982c3eeaca2e2809532c8422dc5f7045c1 (diff)
mesa: Index into ctx->Const.Program[] rather than using ad-hoc code.
Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/program/program.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c
index df4d75fddbd..3c19e8c60f0 100644
--- a/src/mesa/program/program.c
+++ b/src/mesa/program/program.c
@@ -896,21 +896,8 @@ _mesa_valid_register_index(const struct gl_context *ctx,
{
const struct gl_program_constants *c;
- switch (shaderType) {
- case MESA_SHADER_VERTEX:
- c = &ctx->Const.Program[MESA_SHADER_VERTEX];
- break;
- case MESA_SHADER_FRAGMENT:
- c = &ctx->Const.Program[MESA_SHADER_FRAGMENT];
- break;
- case MESA_SHADER_GEOMETRY:
- c = &ctx->Const.Program[MESA_SHADER_GEOMETRY];
- break;
- default:
- _mesa_problem(ctx,
- "unexpected shader type in _mesa_valid_register_index()");
- return GL_FALSE;
- }
+ assert(0 <= shaderType && shaderType < MESA_SHADER_STAGES);
+ c = &ctx->Const.Program[shaderType];
switch (file) {
case PROGRAM_UNDEFINED: