summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/slang/slang_emit.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-01-02 12:26:15 -0700
committerBrian Paul <[email protected]>2009-01-02 12:28:37 -0700
commit1fad6ccb756ae33ca3115f59c99ca8abbeb0321e (patch)
tree766bda6b2a968d18d01d3eaf3ac2f138eed24621 /src/mesa/shader/slang/slang_emit.c
parent4a6ad999ea312f0af85de621c8b6a15a3d3b7ffd (diff)
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.
Diffstat (limited to 'src/mesa/shader/slang/slang_emit.c')
-rw-r--r--src/mesa/shader/slang/slang_emit.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c
index 500112b6f67..b7a3cfb6177 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);
}