aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/shader/shader_api.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 1a931326afa..a1e73ef125c 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -377,7 +377,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) {
@@ -386,6 +386,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 */
@@ -547,7 +549,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) {
@@ -556,6 +558,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 */