summaryrefslogtreecommitdiff
path: root/src/mesa/shader/slang/slang_emit.c
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-02-21 09:15:39 -0700
committerBrian <brian@yutani.localnet.net>2007-02-21 09:15:39 -0700
commitc3301d038d404be7c8ecda9d1425617e650e6198 (patch)
tree046b2ac67d3bc3e599d5e1622208daf7ec2bc15d /src/mesa/shader/slang/slang_emit.c
parentaa7ddbd0ff97ad5233a766976bbbb31e7cb1cd51 (diff)
checkpoint overhaul of pre-defined uniform code
Diffstat (limited to 'src/mesa/shader/slang/slang_emit.c')
-rw-r--r--src/mesa/shader/slang/slang_emit.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c
index d993fbddc5..7584857493 100644
--- a/src/mesa/shader/slang/slang_emit.c
+++ b/src/mesa/shader/slang/slang_emit.c
@@ -1319,6 +1319,13 @@ emit_array_element(slang_var_table *vt, slang_ir_node *n,
assert(n->Store);
assert(n->Store->File != PROGRAM_UNDEFINED);
assert(n->Store->Size > 0);
+
+ if (n->Store->File == PROGRAM_STATE_VAR) {
+ n->Store->Index = _slang_alloc_statevar(n, prog->Parameters);
+ return NULL;
+ }
+
+
if (n->Children[1]->Opcode == IR_FLOAT) {
/* Constant index */
const GLint arrayAddr = n->Children[0]->Store->Index;
@@ -1343,6 +1350,11 @@ static struct prog_instruction *
emit_struct_field(slang_var_table *vt, slang_ir_node *n,
struct gl_program *prog)
{
+ if (n->Store->File == PROGRAM_STATE_VAR) {
+ n->Store->Index = _slang_alloc_statevar(n, prog->Parameters);
+ return NULL;
+ }
+
if (n->Children[0]->Store->File == PROGRAM_STATE_VAR) {
/* state variable sub-field */
GLint pos;
@@ -1421,6 +1433,12 @@ emit(slang_var_table *vt, slang_ir_node *n, struct gl_program *prog)
*/
assert(n->Store);
assert(n->Store->File != PROGRAM_UNDEFINED);
+
+ if (n->Store->File == PROGRAM_STATE_VAR &&
+ n->Store->Index < 0) {
+ n->Store->Index = _slang_alloc_statevar(n, prog->Parameters);
+ }
+
if (n->Store->Index < 0) {
printf("#### VAR %s not allocated!\n", (char*)n->Var->a_name);
}