mesa: rework ParameterList to allow packing
[mesa.git] / src / mesa / program / prog_opt_constant_fold.c
index d17e206c9fc28bc144e612f4c8bcb4a0a6d949e7..638bdbd1507636ab5c6b2f3448dac4ff89571a18 100644 (file)
@@ -90,8 +90,9 @@ src_regs_are_same(const struct prog_src_register *a,
 static void
 get_value(struct gl_program *prog, struct prog_src_register *r, float *data)
 {
+   unsigned pvo = prog->Parameters->ParameterValueOffset[r->Index];
    const gl_constant_value *const value =
-      prog->Parameters->ParameterValues[r->Index];
+      prog->Parameters->ParameterValues + pvo;
 
    data[0] = value[GET_SWZ(r->Swizzle, 0)].f;
    data[1] = value[GET_SWZ(r->Swizzle, 1)].f;
@@ -127,8 +128,8 @@ _mesa_constant_fold(struct gl_program *prog)
    bool progress = false;
    unsigned i;
 
-   for (i = 0; i < prog->NumInstructions; i++) {
-      struct prog_instruction *const inst = &prog->Instructions[i];
+   for (i = 0; i < prog->arb.NumInstructions; i++) {
+      struct prog_instruction *const inst = &prog->arb.Instructions[i];
 
       switch (inst->Opcode) {
       case OPCODE_ADD: