summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/slang
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-08-19 10:27:06 -0600
committerBrian Paul <[email protected]>2008-08-19 10:27:06 -0600
commit3e1706f720b211f27a4aa88af2141db0c793adbb (patch)
treeed60e31df217ec796fa024c3327e4b40982f1c09 /src/mesa/shader/slang
parentdf9bd01ea0c8a4d5b5ffecad4482ca6b4f2db33d (diff)
mesa: glsl: add usage tracking for uniform vars
Unused uniforms are no longer included in the active uniforms list.
Diffstat (limited to 'src/mesa/shader/slang')
-rw-r--r--src/mesa/shader/slang/slang_emit.c4
-rw-r--r--src/mesa/shader/slang/slang_link.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c
index cad983443a7..c5a0fcb6c77 100644
--- a/src/mesa/shader/slang/slang_emit.c
+++ b/src/mesa/shader/slang/slang_emit.c
@@ -1703,6 +1703,10 @@ emit_var_ref(slang_emit_info *emitInfo, slang_ir_node *n)
if (n->Store->File == PROGRAM_STATE_VAR && n->Store->Index < 0) {
n->Store->Index = _slang_alloc_statevar(n, emitInfo->prog->Parameters);
}
+ else if (n->Store->File == PROGRAM_UNIFORM) {
+ /* mark var as used */
+ _mesa_use_uniform(emitInfo->prog->Parameters, (char *) n->Var->a_name);
+ }
if (n->Store->Index < 0) {
/* probably ran out of registers */
diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c
index e33272eff2a..57dbfc23885 100644
--- a/src/mesa/shader/slang/slang_link.c
+++ b/src/mesa/shader/slang/slang_link.c
@@ -173,7 +173,7 @@ link_uniform_vars(struct gl_shader_program *shProg,
* Furthermore, we'll need to fix the state-var's size/datatype info.
*/
- if (p->Type == PROGRAM_UNIFORM ||
+ if ((p->Type == PROGRAM_UNIFORM && p->Used) ||
p->Type == PROGRAM_SAMPLER) {
_mesa_append_uniform(shProg->Uniforms, p->Name, prog->Target, i);
}