alloc IR_FIELD's Storage in codegen, like IR_ELEMENT
authorBrian <brian@yutani.localnet.net>
Tue, 20 Feb 2007 23:56:49 +0000 (16:56 -0700)
committerBrian <brian@yutani.localnet.net>
Tue, 20 Feb 2007 23:56:49 +0000 (16:56 -0700)
src/mesa/shader/slang/slang_codegen.c
src/mesa/shader/slang/slang_emit.c

index a23d4e16d001bda0dcbff8e80da36d8b05950d81..789ab8a50b5c770cc82d937dfb14ae62256f288f 100644 (file)
@@ -2184,12 +2184,16 @@ _slang_gen_field(slang_assemble_ctx * A, slang_operation *oper)
       /* oper->children[0] is the base */
       /* oper->a_id is the field name */
       slang_ir_node *base, *n;
+      GLint size = 4; /* XXX fix? */
 
       base = _slang_gen_operation(A, &oper->children[0]);
 
       n = new_node1(IR_FIELD, base);
       if (n) {
          n->Target = (char *) oper->a_id;
+         n->Store = _slang_new_ir_storage(base->Store->File,
+                                          base->Store->Index,
+                                          size);
       }
       return n;
 
index 67cf9c32d4aa45478729a238c7c92bb0ccf555d2..c174f7b6b4f8d9aba7ec4898d88f3da6344f6095 100644 (file)
@@ -1319,16 +1319,17 @@ emit_field(slang_var_table *vt, slang_ir_node *n, struct gl_program *prog)
       /* state variable sub-field */
       GLint pos;
       GLuint swizzle;
+      assert(n->Children[0]->Opcode == IR_VAR);
       pos = _slang_lookup_statevar_field((char *) n->Children[0]->Var->a_name,
                                          n->Target,
                                          prog->Parameters, &swizzle);
       if (pos < 0) {
          RETURN_ERROR2("Undefined structure member", n->Target, 0);
       }
-
-      n->Store = _slang_new_ir_storage(PROGRAM_STATE_VAR, pos, 4);/*XXX size*/
-      if (n->Store)
-         n->Store->Swizzle = swizzle;
+      assert(n->Store);
+      assert(n->Store->File == PROGRAM_STATE_VAR);
+      n->Store->Index = pos;
+      n->Store->Swizzle = swizzle;
    }
 
    /*