i965: Set the variable type when dereferencing an array.
authorEric Anholt <eric@anholt.net>
Tue, 28 Sep 2010 05:19:51 +0000 (22:19 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 28 Sep 2010 16:33:31 +0000 (09:33 -0700)
We don't set the type on the array virtual reg as a whole, so here's
the right place.

Fixes:
glsl1-GLSL 1.20 arrays
glsl1-temp array with constant indexing, fragment shader
glsl1-temp array with swizzled variable indexing

src/mesa/drivers/dri/i965/brw_fs.cpp

index 78c1bc6ea6b83f18bbbf2ecdd26d626755cd9f4c..3b56340343f260ced076ffb3891fde0572d296f3 100644 (file)
@@ -613,6 +613,21 @@ fs_visitor::visit(ir_dereference_array *ir)
       element_size = ir->type->vector_elements;
    } else {
       element_size = type_size(ir->type);
+      switch (ir->type->base_type) {
+      case GLSL_TYPE_UINT:
+        this->result.type = BRW_REGISTER_TYPE_UD;
+        break;
+      case GLSL_TYPE_INT:
+      case GLSL_TYPE_BOOL:
+        this->result.type = BRW_REGISTER_TYPE_D;
+        break;
+      case GLSL_TYPE_FLOAT:
+        this->result.type = BRW_REGISTER_TYPE_F;
+        break;
+      default:
+        /* deref producing struct, no need to tweak type yet. */
+        break;
+      }
    }
 
    if (index) {