diff options
author | Brian Paul <[email protected]> | 2008-08-20 14:39:10 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2008-08-20 14:39:10 -0600 |
commit | e55093bf2f4ff32a691f63409b9fea321cf8eb0f (patch) | |
tree | 6ebf8bef2c8373cb17fa17ad76343ff1b59b9e89 /src/mesa | |
parent | 29bee15b1e8bea9162d9b9343c98b22b766694b1 (diff) |
mesa: glsl: add check for exceeding max number of constants/uniforms
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/shader/slang/slang_emit.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index c5a0fcb6c77..f5f41eb116d 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -1971,6 +1971,7 @@ _slang_emit_code(slang_ir_node *n, slang_var_table *vt, GET_CURRENT_CONTEXT(ctx); GLboolean success; slang_emit_info emitInfo; + GLuint maxUniforms; emitInfo.log = log; emitInfo.vt = vt; @@ -1987,6 +1988,19 @@ _slang_emit_code(slang_ir_node *n, slang_var_table *vt, emitInfo.EmitHighLevelInstructions = GL_TRUE; } + /* Check uniform/constant limits */ + if (prog->Target == GL_FRAGMENT_PROGRAM_ARB) { + maxUniforms = ctx->Const.FragmentProgram.MaxUniformComponents / 4; + } + else { + assert(prog->Target == GL_VERTEX_PROGRAM_ARB); + maxUniforms = ctx->Const.VertexProgram.MaxUniformComponents / 4; + } + if (prog->Parameters->NumParameters > maxUniforms) { + slang_info_log_error(log, "Constant/uniform register limit exceeded"); + return GL_FALSE; + } + (void) emit(&emitInfo, n); /* finish up by adding the END opcode to program */ |