aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/shader/slang
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-03-07 13:28:57 +0000
committermarha <marha@users.sourceforge.net>2010-03-07 13:28:57 +0000
commit14b1cb8d5a27ec9716d3f790fce95f0469e35605 (patch)
tree6c94dc9f37b19b995bec603141442b1b93e8c9d2 /mesalib/src/mesa/shader/slang
parent93c85587c691f9b91e7c2d8bda50f453e0f6674d (diff)
downloadvcxsrv-14b1cb8d5a27ec9716d3f790fce95f0469e35605.tar.gz
vcxsrv-14b1cb8d5a27ec9716d3f790fce95f0469e35605.tar.bz2
vcxsrv-14b1cb8d5a27ec9716d3f790fce95f0469e35605.zip
Updated to Mesa 7.7
Diffstat (limited to 'mesalib/src/mesa/shader/slang')
-rw-r--r--mesalib/src/mesa/shader/slang/slang_codegen.c2
-rw-r--r--mesalib/src/mesa/shader/slang/slang_compile.c34
-rw-r--r--mesalib/src/mesa/shader/slang/slang_compile_operation.c1
-rw-r--r--mesalib/src/mesa/shader/slang/slang_compile_operation.h1
-rw-r--r--mesalib/src/mesa/shader/slang/slang_emit.c124
-rw-r--r--mesalib/src/mesa/shader/slang/slang_link.c25
-rw-r--r--mesalib/src/mesa/shader/slang/slang_simplify.c9
-rw-r--r--mesalib/src/mesa/shader/slang/slang_vartable.c4
8 files changed, 146 insertions, 54 deletions
diff --git a/mesalib/src/mesa/shader/slang/slang_codegen.c b/mesalib/src/mesa/shader/slang/slang_codegen.c
index 344dfdc68..ee5a50ca8 100644
--- a/mesalib/src/mesa/shader/slang/slang_codegen.c
+++ b/mesalib/src/mesa/shader/slang/slang_codegen.c
@@ -925,7 +925,7 @@ gen_return_with_expression(slang_assemble_ctx *A, slang_operation *oper)
slang_operation_copy(rhs, &oper->children[0]);
}
- ///blockOper->locals->outer_scope = oper->locals->outer_scope;
+ /*blockOper->locals->outer_scope = oper->locals->outer_scope;*/
/*slang_print_tree(blockOper, 0);*/
diff --git a/mesalib/src/mesa/shader/slang/slang_compile.c b/mesalib/src/mesa/shader/slang/slang_compile.c
index c1b97c7cb..499e16e2d 100644
--- a/mesalib/src/mesa/shader/slang/slang_compile.c
+++ b/mesalib/src/mesa/shader/slang/slang_compile.c
@@ -2738,6 +2738,7 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader)
slang_info_log info_log;
slang_code_object obj;
slang_unit_type type;
+ GLenum progTarget;
if (shader->Type == GL_VERTEX_SHADER) {
type = SLANG_UNIT_VERTEX_SHADER;
@@ -2754,17 +2755,18 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader)
shader->Main = GL_FALSE;
- if (!shader->Program) {
- GLenum progTarget;
- if (shader->Type == GL_VERTEX_SHADER)
- progTarget = GL_VERTEX_PROGRAM_ARB;
- else
- progTarget = GL_FRAGMENT_PROGRAM_ARB;
- shader->Program = ctx->Driver.NewProgram(ctx, progTarget, 1);
- shader->Program->Parameters = _mesa_new_parameter_list();
- shader->Program->Varying = _mesa_new_parameter_list();
- shader->Program->Attributes = _mesa_new_parameter_list();
- }
+ /* free the shader's old instructions, etc */
+ _mesa_reference_program(ctx, &shader->Program, NULL);
+
+ /* allocate new GPU program, parameter lists, etc. */
+ if (shader->Type == GL_VERTEX_SHADER)
+ progTarget = GL_VERTEX_PROGRAM_ARB;
+ else
+ progTarget = GL_FRAGMENT_PROGRAM_ARB;
+ shader->Program = ctx->Driver.NewProgram(ctx, progTarget, 1);
+ shader->Program->Parameters = _mesa_new_parameter_list();
+ shader->Program->Varying = _mesa_new_parameter_list();
+ shader->Program->Attributes = _mesa_new_parameter_list();
slang_info_log_construct(&info_log);
_slang_code_object_ctr(&obj);
@@ -2814,6 +2816,16 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader)
(ctx->Shader.Flags & GLSL_NO_OPT) == 0) {
_mesa_optimize_program(ctx, shader->Program);
}
+ if ((ctx->Shader.Flags & GLSL_NOP_VERT) &&
+ shader->Program->Target == GL_VERTEX_PROGRAM_ARB) {
+ _mesa_nop_vertex_program(ctx,
+ (struct gl_vertex_program *) shader->Program);
+ }
+ if ((ctx->Shader.Flags & GLSL_NOP_FRAG) &&
+ shader->Program->Target == GL_FRAGMENT_PROGRAM_ARB) {
+ _mesa_nop_fragment_program(ctx,
+ (struct gl_fragment_program *) shader->Program);
+ }
}
if (ctx->Shader.Flags & GLSL_LOG) {
diff --git a/mesalib/src/mesa/shader/slang/slang_compile_operation.c b/mesalib/src/mesa/shader/slang/slang_compile_operation.c
index 3e2bdbc91..be73094ca 100644
--- a/mesalib/src/mesa/shader/slang/slang_compile_operation.c
+++ b/mesalib/src/mesa/shader/slang/slang_compile_operation.c
@@ -52,6 +52,7 @@ slang_operation_construct(slang_operation * oper)
_slang_variable_scope_ctr(oper->locals);
oper->fun = NULL;
oper->var = NULL;
+ oper->label = NULL;
return GL_TRUE;
}
diff --git a/mesalib/src/mesa/shader/slang/slang_compile_operation.h b/mesalib/src/mesa/shader/slang/slang_compile_operation.h
index 58f1edeed..1f15c1989 100644
--- a/mesalib/src/mesa/shader/slang/slang_compile_operation.h
+++ b/mesalib/src/mesa/shader/slang/slang_compile_operation.h
@@ -127,7 +127,6 @@ typedef struct slang_operation_
* indicate such. num_children indicates number of elements.
*/
GLboolean array_constructor;
- double x;
} slang_operation;
diff --git a/mesalib/src/mesa/shader/slang/slang_emit.c b/mesalib/src/mesa/shader/slang/slang_emit.c
index 3af301eac..c0e4b27aa 100644
--- a/mesalib/src/mesa/shader/slang/slang_emit.c
+++ b/mesalib/src/mesa/shader/slang/slang_emit.c
@@ -195,6 +195,9 @@ alloc_node_storage(slang_emit_info *emitInfo, slang_ir_node *n,
if (!n->Store) {
assert(defaultSize > 0);
n->Store = _slang_new_ir_storage(PROGRAM_TEMPORARY, -1, defaultSize);
+ if (!n->Store) {
+ return GL_FALSE;
+ }
}
/* now allocate actual register(s). I.e. set n->Store->Index >= 0 */
@@ -431,6 +434,9 @@ new_instruction(slang_emit_info *emitInfo, gl_inst_opcode opcode)
_mesa_realloc_instructions(prog->Instructions,
prog->NumInstructions,
emitInfo->MaxInstructions);
+ if (!prog->Instructions) {
+ return NULL;
+ }
}
inst = prog->Instructions + prog->NumInstructions;
@@ -451,12 +457,14 @@ emit_arl_load(slang_emit_info *emitInfo,
gl_register_file file, GLint index, GLuint swizzle)
{
struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_ARL);
- inst->SrcReg[0].File = file;
- inst->SrcReg[0].Index = index;
- inst->SrcReg[0].Swizzle = fix_swizzle(swizzle);
- inst->DstReg.File = PROGRAM_ADDRESS;
- inst->DstReg.Index = 0;
- inst->DstReg.WriteMask = WRITEMASK_X;
+ if (inst) {
+ inst->SrcReg[0].File = file;
+ inst->SrcReg[0].Index = index;
+ inst->SrcReg[0].Swizzle = fix_swizzle(swizzle);
+ inst->DstReg.File = PROGRAM_ADDRESS;
+ inst->DstReg.Index = 0;
+ inst->DstReg.WriteMask = WRITEMASK_X;
+ }
return inst;
}
@@ -765,7 +773,9 @@ static struct prog_instruction *
emit_comment(slang_emit_info *emitInfo, const char *comment)
{
struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_NOP);
- inst_comment(inst, comment);
+ if (inst) {
+ inst_comment(inst, comment);
+ }
return inst;
}
@@ -792,7 +802,9 @@ emit_arith(slang_emit_info *emitInfo, slang_ir_node *n)
emit(emitInfo, n->Children[0]->Children[0]); /* A */
emit(emitInfo, n->Children[0]->Children[1]); /* B */
emit(emitInfo, n->Children[1]); /* C */
- alloc_node_storage(emitInfo, n, -1); /* dest */
+ if (!alloc_node_storage(emitInfo, n, -1)) { /* dest */
+ return NULL;
+ }
inst = emit_instruction(emitInfo,
OPCODE_MAD,
@@ -813,7 +825,9 @@ emit_arith(slang_emit_info *emitInfo, slang_ir_node *n)
emit(emitInfo, n->Children[0]); /* A */
emit(emitInfo, n->Children[1]->Children[0]); /* B */
emit(emitInfo, n->Children[1]->Children[1]); /* C */
- alloc_node_storage(emitInfo, n, -1); /* dest */
+ if (!alloc_node_storage(emitInfo, n, -1)) { /* dest */
+ return NULL;
+ }
inst = emit_instruction(emitInfo,
OPCODE_MAD,
@@ -839,7 +853,9 @@ emit_arith(slang_emit_info *emitInfo, slang_ir_node *n)
}
/* result storage */
- alloc_node_storage(emitInfo, n, -1);
+ if (!alloc_node_storage(emitInfo, n, -1)) {
+ return NULL;
+ }
inst = emit_instruction(emitInfo,
info->InstOpcode,
@@ -1093,7 +1109,9 @@ emit_clamp(slang_emit_info *emitInfo, slang_ir_node *n)
* the intermediate result. Use a temp register instead.
*/
_mesa_bzero(&tmpNode, sizeof(tmpNode));
- alloc_node_storage(emitInfo, &tmpNode, n->Store->Size);
+ if (!alloc_node_storage(emitInfo, &tmpNode, n->Store->Size)) {
+ return NULL;
+ }
/* tmp = max(ch[0], ch[1]) */
inst = emit_instruction(emitInfo, OPCODE_MAX,
@@ -1191,6 +1209,9 @@ emit_fcall(slang_emit_info *emitInfo, slang_ir_node *n)
* really just a NOP to attach the label to.
*/
inst = new_instruction(emitInfo, OPCODE_BGNSUB);
+ if (!inst) {
+ return NULL;
+ }
inst_comment(inst, n->Label->Name);
}
@@ -1202,10 +1223,16 @@ emit_fcall(slang_emit_info *emitInfo, slang_ir_node *n)
inst = prev_instruction(emitInfo);
if (inst && inst->Opcode != OPCODE_RET) {
inst = new_instruction(emitInfo, OPCODE_RET);
+ if (!inst) {
+ return NULL;
+ }
}
if (emitInfo->EmitBeginEndSub) {
inst = new_instruction(emitInfo, OPCODE_ENDSUB);
+ if (!inst) {
+ return NULL;
+ }
inst_comment(inst, n->Label->Name);
}
@@ -1215,6 +1242,9 @@ emit_fcall(slang_emit_info *emitInfo, slang_ir_node *n)
/* emit the function call */
inst = new_instruction(emitInfo, OPCODE_CAL);
+ if (!inst) {
+ return NULL;
+ }
/* The branch target is just the subroutine number (changed later) */
inst->BranchTarget = subroutineId;
inst_comment(inst, n->Label->Name);
@@ -1235,7 +1265,9 @@ emit_return(slang_emit_info *emitInfo, slang_ir_node *n)
assert(n->Opcode == IR_RETURN);
assert(n->Label);
inst = new_instruction(emitInfo, OPCODE_RET);
- inst->DstReg.CondMask = COND_TR; /* always return */
+ if (inst) {
+ inst->DstReg.CondMask = COND_TR; /* always return */
+ }
return inst;
}
@@ -1249,6 +1281,9 @@ emit_kill(slang_emit_info *emitInfo)
* Note that ARB-KILL depends on sign of vector operand.
*/
inst = new_instruction(emitInfo, OPCODE_KIL_NV);
+ if (!inst) {
+ return NULL;
+ }
inst->DstReg.CondMask = COND_TR; /* always kill */
assert(emitInfo->prog->Target == GL_FRAGMENT_PROGRAM_ARB);
@@ -1600,8 +1635,10 @@ emit_if(slang_emit_info *emitInfo, slang_ir_node *n)
if (emitInfo->EmitHighLevelInstructions) {
if (emitInfo->EmitCondCodes) {
/* IF condcode THEN ... */
- struct prog_instruction *ifInst;
- ifInst = new_instruction(emitInfo, OPCODE_IF);
+ struct prog_instruction *ifInst = new_instruction(emitInfo, OPCODE_IF);
+ if (!ifInst) {
+ return NULL;
+ }
ifInst->DstReg.CondMask = COND_NE; /* if cond is non-zero */
/* only test the cond code (1 of 4) that was updated by the
* previous instruction.
@@ -1620,6 +1657,9 @@ emit_if(slang_emit_info *emitInfo, slang_ir_node *n)
else {
/* conditional jump to else, or endif */
struct prog_instruction *ifInst = new_instruction(emitInfo, OPCODE_BRA);
+ if (!ifInst) {
+ return NULL;
+ }
ifInst->DstReg.CondMask = COND_EQ; /* BRA if cond is zero */
inst_comment(ifInst, "if zero");
ifInst->DstReg.CondSwizzle = writemask_to_swizzle(condWritemask);
@@ -1632,12 +1672,17 @@ emit_if(slang_emit_info *emitInfo, slang_ir_node *n)
/* have else body */
elseInstLoc = prog->NumInstructions;
if (emitInfo->EmitHighLevelInstructions) {
- (void) new_instruction(emitInfo, OPCODE_ELSE);
+ struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_ELSE);
+ if (!inst) {
+ return NULL;
+ }
}
else {
/* jump to endif instruction */
- struct prog_instruction *inst;
- inst = new_instruction(emitInfo, OPCODE_BRA);
+ struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_BRA);
+ if (!inst) {
+ return NULL;
+ }
inst_comment(inst, "else");
inst->DstReg.CondMask = COND_TR; /* always branch */
}
@@ -1650,7 +1695,10 @@ emit_if(slang_emit_info *emitInfo, slang_ir_node *n)
}
if (emitInfo->EmitHighLevelInstructions) {
- (void) new_instruction(emitInfo, OPCODE_ENDIF);
+ struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_ENDIF);
+ if (!inst) {
+ return NULL;
+ }
}
if (n->Children[2]) {
@@ -1671,7 +1719,10 @@ emit_loop(slang_emit_info *emitInfo, slang_ir_node *n)
/* emit OPCODE_BGNLOOP */
beginInstLoc = prog->NumInstructions;
if (emitInfo->EmitHighLevelInstructions) {
- (void) new_instruction(emitInfo, OPCODE_BGNLOOP);
+ struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_BGNLOOP);
+ if (!inst) {
+ return NULL;
+ }
}
/* body */
@@ -1689,10 +1740,16 @@ emit_loop(slang_emit_info *emitInfo, slang_ir_node *n)
if (emitInfo->EmitHighLevelInstructions) {
/* emit OPCODE_ENDLOOP */
endInst = new_instruction(emitInfo, OPCODE_ENDLOOP);
+ if (!endInst) {
+ return NULL;
+ }
}
else {
/* emit unconditional BRA-nch */
endInst = new_instruction(emitInfo, OPCODE_BRA);
+ if (!endInst) {
+ return NULL;
+ }
endInst->DstReg.CondMask = COND_TR; /* always true */
}
/* ENDLOOP's BranchTarget points to the BGNLOOP inst */
@@ -1762,7 +1819,9 @@ emit_cont_break(slang_emit_info *emitInfo, slang_ir_node *n)
}
n->InstLocation = emitInfo->prog->NumInstructions;
inst = new_instruction(emitInfo, opcode);
- inst->DstReg.CondMask = COND_TR; /* always true */
+ if (inst) {
+ inst->DstReg.CondMask = COND_TR; /* always true */
+ }
return inst;
}
@@ -1798,8 +1857,10 @@ emit_cont_break_if_true(slang_emit_info *emitInfo, slang_ir_node *n)
*/
const GLuint condWritemask = inst->DstReg.WriteMask;
inst = new_instruction(emitInfo, opcode);
- inst->DstReg.CondMask = COND_NE;
- inst->DstReg.CondSwizzle = writemask_to_swizzle(condWritemask);
+ if (inst) {
+ inst->DstReg.CondMask = COND_NE;
+ inst->DstReg.CondSwizzle = writemask_to_swizzle(condWritemask);
+ }
return inst;
}
else {
@@ -1817,7 +1878,13 @@ emit_cont_break_if_true(slang_emit_info *emitInfo, slang_ir_node *n)
n->InstLocation = emitInfo->prog->NumInstructions;
inst = new_instruction(emitInfo, opcode);
+ if (!inst) {
+ return NULL;
+ }
inst = new_instruction(emitInfo, OPCODE_ENDIF);
+ if (!inst) {
+ return NULL;
+ }
emitInfo->prog->Instructions[ifInstLoc].BranchTarget
= emitInfo->prog->NumInstructions;
@@ -1828,8 +1895,10 @@ emit_cont_break_if_true(slang_emit_info *emitInfo, slang_ir_node *n)
const GLuint condWritemask = inst->DstReg.WriteMask;
assert(emitInfo->EmitCondCodes);
inst = new_instruction(emitInfo, OPCODE_BRA);
- inst->DstReg.CondMask = COND_NE;
- inst->DstReg.CondSwizzle = writemask_to_swizzle(condWritemask);
+ if (inst) {
+ inst->DstReg.CondMask = COND_NE;
+ inst->DstReg.CondSwizzle = writemask_to_swizzle(condWritemask);
+ }
return inst;
}
}
@@ -2201,7 +2270,9 @@ emit(slang_emit_info *emitInfo, slang_ir_node *n)
if (n->Comment) {
inst = new_instruction(emitInfo, OPCODE_NOP);
- inst->Comment = _mesa_strdup(n->Comment);
+ if (inst) {
+ inst->Comment = _mesa_strdup(n->Comment);
+ }
inst = NULL;
}
@@ -2503,6 +2574,9 @@ _slang_emit_code(slang_ir_node *n, slang_var_table *vt,
if (withEnd) {
struct prog_instruction *inst;
inst = new_instruction(&emitInfo, OPCODE_END);
+ if (!inst) {
+ return GL_FALSE;
+ }
}
_slang_resolve_subroutines(&emitInfo);
diff --git a/mesalib/src/mesa/shader/slang/slang_link.c b/mesalib/src/mesa/shader/slang/slang_link.c
index 144c12652..0a2bc4978 100644
--- a/mesalib/src/mesa/shader/slang/slang_link.c
+++ b/mesalib/src/mesa/shader/slang/slang_link.c
@@ -515,7 +515,7 @@ _slang_update_inputs_outputs(struct gl_program *prog)
}
if (inst->DstReg.File == PROGRAM_OUTPUT) {
- prog->OutputsWritten |= 1 << inst->DstReg.Index;
+ prog->OutputsWritten |= BITFIELD64_BIT(inst->DstReg.Index);
if (inst->DstReg.RelAddr) {
/* If the output attribute is indexed with relative addressing
* we know that it must be a varying or texcoord such as
@@ -528,14 +528,17 @@ _slang_update_inputs_outputs(struct gl_program *prog)
if (prog->Target == GL_VERTEX_PROGRAM_ARB) {
if (inst->DstReg.Index == VERT_RESULT_TEX0) {
/* mark all texcoord outputs as written */
- const GLbitfield mask =
- ((1 << MAX_TEXTURE_COORD_UNITS) - 1) << VERT_RESULT_TEX0;
+ const GLbitfield64 mask =
+ BITFIELD64_RANGE(VERT_RESULT_TEX0,
+ (VERT_RESULT_TEX0
+ + MAX_TEXTURE_COORD_UNITS - 1));
prog->OutputsWritten |= mask;
}
else if (inst->DstReg.Index == VERT_RESULT_VAR0) {
/* mark all generic varying outputs as written */
- const GLbitfield mask =
- ((1 << MAX_VARYING) - 1) << VERT_RESULT_VAR0;
+ const GLbitfield64 mask =
+ BITFIELD64_RANGE(VERT_RESULT_VAR0,
+ (VERT_RESULT_VAR0 + MAX_VARYING - 1));
prog->OutputsWritten |= mask;
}
}
@@ -807,7 +810,8 @@ _slang_link(GLcontext *ctx,
if (shProg->VertexProgram) {
_slang_update_inputs_outputs(&shProg->VertexProgram->Base);
_slang_count_temporaries(&shProg->VertexProgram->Base);
- if (!(shProg->VertexProgram->Base.OutputsWritten & (1 << VERT_RESULT_HPOS))) {
+ if (!(shProg->VertexProgram->Base.OutputsWritten
+ & BITFIELD64_BIT(VERT_RESULT_HPOS))) {
/* the vertex program did not compute a vertex position */
link_error(shProg,
"gl_Position was not written by vertex shader\n");
@@ -825,7 +829,7 @@ _slang_link(GLcontext *ctx,
if (shProg->FragmentProgram) {
const GLbitfield varyingRead
= shProg->FragmentProgram->Base.InputsRead >> FRAG_ATTRIB_VAR0;
- const GLbitfield varyingWritten = shProg->VertexProgram ?
+ const GLbitfield64 varyingWritten = shProg->VertexProgram ?
shProg->VertexProgram->Base.OutputsWritten >> VERT_RESULT_VAR0 : 0x0;
if ((varyingRead & varyingWritten) != varyingRead) {
link_error(shProg,
@@ -836,9 +840,10 @@ _slang_link(GLcontext *ctx,
/* check that gl_FragColor and gl_FragData are not both written to */
if (shProg->FragmentProgram) {
- GLbitfield outputsWritten = shProg->FragmentProgram->Base.OutputsWritten;
- if ((outputsWritten & ((1 << FRAG_RESULT_COLOR))) &&
- (outputsWritten >= (1 << FRAG_RESULT_DATA0))) {
+ const GLbitfield64 outputsWritten =
+ shProg->FragmentProgram->Base.OutputsWritten;
+ if ((outputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) &&
+ (outputsWritten >= BITFIELD64_BIT(FRAG_RESULT_DATA0))) {
link_error(shProg, "Fragment program cannot write both gl_FragColor"
" and gl_FragData[].\n");
return;
diff --git a/mesalib/src/mesa/shader/slang/slang_simplify.c b/mesalib/src/mesa/shader/slang/slang_simplify.c
index b8a21f642..13b9ca3c8 100644
--- a/mesalib/src/mesa/shader/slang/slang_simplify.c
+++ b/mesalib/src/mesa/shader/slang/slang_simplify.c
@@ -84,10 +84,11 @@ _slang_lookup_constant(const char *name)
for (i = 0; info[i].Name; i++) {
if (strcmp(info[i].Name, name) == 0) {
/* found */
- GLint value = -1;
- _mesa_GetIntegerv(info[i].Token, &value);
- ASSERT(value >= 0); /* sanity check that glGetFloatv worked */
- return value;
+ GLint values[16];
+ values[0] = -1;
+ _mesa_GetIntegerv(info[i].Token, values);
+ ASSERT(values[0] >= 0); /* sanity check that glGetFloatv worked */
+ return values[0];
}
}
return -1;
diff --git a/mesalib/src/mesa/shader/slang/slang_vartable.c b/mesalib/src/mesa/shader/slang/slang_vartable.c
index a4ebacc09..e07e3a226 100644
--- a/mesalib/src/mesa/shader/slang/slang_vartable.c
+++ b/mesalib/src/mesa/shader/slang/slang_vartable.c
@@ -311,10 +311,10 @@ _slang_free_temp(slang_var_table *vt, slang_ir_storage *store)
{
struct table *t = vt->Top;
GLuint i;
- GLuint r = store->Index;
+ GLint r = store->Index;
assert(store->Size > 0);
assert(r >= 0);
- assert(r + store->Size <= vt->MaxRegisters * 4);
+ assert((GLuint)r + store->Size <= vt->MaxRegisters * 4);
if (dbg) printf("Free temp sz %d at %d.%s (level %d) store %p\n",
store->Size, r,
_mesa_swizzle_string(store->Swizzle, 0, 0),