diff options
author | Brian <[email protected]> | 2007-01-28 12:49:47 -0700 |
---|---|---|
committer | Brian <[email protected]> | 2007-01-28 12:49:47 -0700 |
commit | 4de6fac4daecac25bb3f4339610312022b457b46 (patch) | |
tree | 5b05109132bca7c6a9ede0fe80da0d3ed70e8c06 /src/mesa/shader/slang/slang_compile.c | |
parent | 602dc1a63888af10b2ae491bdbb3afcb28004770 (diff) |
Lots of vartable clean-ups, fixes. Report an error message when we run out
of registers, rather than crash.
Diffstat (limited to 'src/mesa/shader/slang/slang_compile.c')
-rw-r--r-- | src/mesa/shader/slang/slang_compile.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index c459eb29e74..43f8a303698 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -1978,8 +1978,20 @@ static GLboolean parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit, struct gl_program *program) { + GET_CURRENT_CONTEXT(ctx); slang_output_ctx o; GLboolean success; + GLuint maxRegs; + + if (unit->type == slang_unit_fragment_builtin || + unit->type == slang_unit_fragment_shader) { + maxRegs = ctx->Const.FragmentProgram.MaxTemps; + } + else { + assert(unit->type == slang_unit_vertex_builtin || + unit->type == slang_unit_vertex_shader); + maxRegs = ctx->Const.VertexProgram.MaxTemps; + } /* setup output context */ o.funs = &unit->funs; @@ -1989,7 +2001,8 @@ parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit, o.global_pool = &unit->object->varpool; o.machine = &unit->object->machine; o.program = program; - o.vartable = _slang_push_var_table(NULL); + o.vartable = _slang_new_var_table(maxRegs); + _slang_push_var_table(o.vartable); /* parse individual functions and declarations */ while (*C->I != EXTERNAL_NULL) { |