From 1fad6ccb756ae33ca3115f59c99ca8abbeb0321e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 2 Jan 2009 12:26:15 -0700 Subject: mesa: fix another "out of samplers" problem Now only the samplers that are actually used by texture() functions are saved in the uniform variable list. Before, we could run out of samplers if too many were declared while only some of them were actually used. --- src/mesa/shader/slang/slang_emit.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/mesa/shader/slang/slang_emit.c') diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index 500112b6f6..b7a3cfb617 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -1290,6 +1290,7 @@ emit_tex(slang_emit_info *emitInfo, slang_ir_node *n) /* Child[0] is the sampler (a uniform which'll indicate the texture unit) */ assert(n->Children[0]->Store); + assert(n->Children[0]->Store->File == PROGRAM_SAMPLER); /* Store->Index is the sampler index */ assert(n->Children[0]->Store->Index >= 0); /* Store->Size is the texture target */ @@ -1299,6 +1300,10 @@ emit_tex(slang_emit_info *emitInfo, slang_ir_node *n) inst->TexSrcTarget = n->Children[0]->Store->Size; inst->TexSrcUnit = n->Children[0]->Store->Index; /* i.e. uniform's index */ + /* mark the sampler as being used */ + _mesa_use_uniform(emitInfo->prog->Parameters, + (char *) n->Children[0]->Var->a_name); + return inst; } @@ -2104,7 +2109,8 @@ emit_var_ref(slang_emit_info *emitInfo, slang_ir_node *n) n->Store->Index = index; } - else if (n->Store->File == PROGRAM_UNIFORM) { + else if (n->Store->File == PROGRAM_UNIFORM || + n->Store->File == PROGRAM_SAMPLER) { /* mark var as used */ _mesa_use_uniform(emitInfo->prog->Parameters, (char *) n->Var->a_name); } -- cgit v1.2.3