diff options
author | Brian Paul <[email protected]> | 2009-06-26 16:53:46 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-06-26 16:53:46 -0600 |
commit | 21320b24c5350943da9ed4cb0f1e8b05a09d4ef2 (patch) | |
tree | aabc354b3ce4db34bd136b19d7e7d34ba1788adb | |
parent | 4181a107cba1dfcb362084fc98be0c5e7e2aedde (diff) |
glsl: check number of varying variables against the limit
Link fails if too many varying vars.
(cherry picked from master, commit cc58fbcf2c5c88f406818db60910f537e03610d6)
-rw-r--r-- | src/mesa/shader/slang/slang_link.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 8c9fe1ea1f9..387659ff300 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -97,7 +97,8 @@ bits_agree(GLbitfield flags1, GLbitfield flags2, GLbitfield bit) * which inputs are centroid-sampled, invariant, etc. */ static GLboolean -link_varying_vars(struct gl_shader_program *shProg, struct gl_program *prog) +link_varying_vars(GLcontext *ctx, + struct gl_shader_program *shProg, struct gl_program *prog) { GLuint *map, i, firstVarying, newFile; GLbitfield *inOutFlags; @@ -156,8 +157,12 @@ link_varying_vars(struct gl_shader_program *shProg, struct gl_program *prog) var->Flags); } + if (shProg->Varying->NumParameters > ctx->Const.MaxVarying) { + link_error(shProg, "Too many varying variables"); + return GL_FALSE; + } + /* Map varying[i] to varying[j]. - * Plus, set prog->Input/OutputFlags[] as described above. * Note: the loop here takes care of arrays or large (sz>4) vars. */ { @@ -725,11 +730,11 @@ _slang_link(GLcontext *ctx, /* link varying vars */ if (shProg->VertexProgram) { - if (!link_varying_vars(shProg, &shProg->VertexProgram->Base)) + if (!link_varying_vars(ctx, shProg, &shProg->VertexProgram->Base)) return; } if (shProg->FragmentProgram) { - if (!link_varying_vars(shProg, &shProg->FragmentProgram->Base)) + if (!link_varying_vars(ctx, shProg, &shProg->FragmentProgram->Base)) return; } |