i965: don't drop const initializers in vector splitting
authorRob Clark <robclark@freedesktop.org>
Sat, 25 Jun 2016 00:03:37 +0000 (20:03 -0400)
committerRob Clark <robdclark@gmail.com>
Sat, 2 Jul 2016 13:00:19 +0000 (09:00 -0400)
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp

index 5fe24debeecfa135a355cf14f472a824bbcff212..5c05586f49ab7d43d896e43be2a3f21a1881d311 100644 (file)
@@ -372,6 +372,18 @@ brw_do_vector_splitting(exec_list *instructions)
 
          ralloc_free(name);
 
+         if (entry->var->constant_initializer) {
+            ir_constant_data data = {0};
+            assert(entry->var->data.has_initializer);
+            if (entry->var->type->is_double()) {
+               data.d[0] = entry->var->constant_initializer->value.d[i];
+            } else {
+               data.u[0] = entry->var->constant_initializer->value.u[i];
+            }
+            entry->components[i]->data.has_initializer = true;
+            entry->components[i]->constant_initializer = new(entry->components[i]) ir_constant(type, &data);
+         }
+
         entry->var->insert_before(entry->components[i]);
       }