diff options
author | Brian Paul <[email protected]> | 2008-12-16 15:50:14 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2008-12-16 15:50:14 -0700 |
commit | b0caa10a85b39f0e657dc0c4816884c9356b0b1a (patch) | |
tree | 812ec91f0cf375921533c2722de313461004aa20 /src/mesa/shader/slang/slang_link.c | |
parent | 3616fb08da8ef392db1d5ccab55b8eb9f6a6f32b (diff) | |
parent | 3be8d6db9e8bfbd1b3ebf9ac382857ad1e6ef753 (diff) |
Merge commit 'origin/master' into gallium-0.2
Diffstat (limited to 'src/mesa/shader/slang/slang_link.c')
-rw-r--r-- | src/mesa/shader/slang/slang_link.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 2cd02d72140..3e97c8672b6 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -207,7 +207,7 @@ link_varying_vars(struct gl_shader_program *shProg, struct gl_program *prog) * This is basically a list/index of all uniforms found in either/both of * the vertex and fragment shaders. */ -static void +static GLboolean link_uniform_vars(struct gl_shader_program *shProg, struct gl_program *prog, GLuint *numSamplers) @@ -239,7 +239,10 @@ link_uniform_vars(struct gl_shader_program *shProg, /* Allocate a new sampler index */ GLuint sampNum = *numSamplers; GLuint oldSampNum = (GLuint) prog->Parameters->ParameterValues[i][0]; - assert(oldSampNum < MAX_SAMPLERS); + if (oldSampNum >= MAX_SAMPLERS) { + link_error(shProg, "Too many texture samplers"); + return GL_FALSE; + } samplerMap[oldSampNum] = sampNum; (*numSamplers)++; } @@ -265,6 +268,7 @@ link_uniform_vars(struct gl_shader_program *shProg, } } + return GL_TRUE; } @@ -559,10 +563,18 @@ _slang_link(GLcontext *ctx, } /* link uniform vars */ - if (shProg->VertexProgram) - link_uniform_vars(shProg, &shProg->VertexProgram->Base, &numSamplers); - if (shProg->FragmentProgram) - link_uniform_vars(shProg, &shProg->FragmentProgram->Base, &numSamplers); + if (shProg->VertexProgram) { + if (!link_uniform_vars(shProg, &shProg->VertexProgram->Base, + &numSamplers)) { + return; + } + } + if (shProg->FragmentProgram) { + if (!link_uniform_vars(shProg, &shProg->FragmentProgram->Base, + &numSamplers)) { + return; + } + } /*_mesa_print_uniforms(shProg->Uniforms);*/ |