diff options
Diffstat (limited to 'src/mesa/shader/shader_api.c')
-rw-r--r-- | src/mesa/shader/shader_api.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index fbaaf8ddea..24ab7568d6 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -369,7 +369,7 @@ _mesa_attach_shader(GLcontext *ctx, GLuint program, GLuint shader) struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, program); struct gl_shader *sh = _mesa_lookup_shader(ctx, shader); - const GLuint n = shProg->NumShaders; + GLuint n; GLuint i; if (!shProg || !sh) { @@ -378,6 +378,8 @@ _mesa_attach_shader(GLcontext *ctx, GLuint program, GLuint shader) return; } + n = shProg->NumShaders; + for (i = 0; i < n; i++) { if (shProg->Shaders[i] == sh) { /* already attached */ @@ -570,7 +572,7 @@ _mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader) { struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, program); - const GLuint n = shProg->NumShaders; + GLuint n; GLuint i, j; if (!shProg) { @@ -579,6 +581,8 @@ _mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader) return; } + n = shProg->NumShaders; + for (i = 0; i < n; i++) { if (shProg->Shaders[i]->Name == shader) { /* found it */ @@ -890,7 +894,7 @@ _mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location, if (shProg) { if (location < shProg->Uniforms->NumUniforms) { GLint progPos, i; - const struct gl_program *prog; + const struct gl_program *prog = NULL; progPos = shProg->Uniforms->Uniforms[location].VertPos; if (progPos >= 0) { @@ -903,8 +907,11 @@ _mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location, } } - for (i = 0; i < prog->Parameters->Parameters[progPos].Size; i++) { - params[i] = prog->Parameters->ParameterValues[progPos][i]; + ASSERT(prog); + if (prog) { + for (i = 0; i < prog->Parameters->Parameters[progPos].Size; i++) { + params[i] = prog->Parameters->ParameterValues[progPos][i]; + } } } else { @@ -1001,6 +1008,8 @@ _mesa_link_program(GLcontext *ctx, GLuint program) return; } + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + _slang_link(ctx, program, shProg); } |