mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-02 21:50:34 +01:00
mesa: glsl: add check for exceeding max number of constants/uniforms
This commit is contained in:
parent
29bee15b1e
commit
e55093bf2f
1 changed files with 14 additions and 0 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue