[Mesa-dev] [PATCH 2/2] i965: don't drop const initializers in vector splitting

Rob Clark robdclark at gmail.com
Sat Jun 25 12:37:48 UTC 2016


From: Rob Clark <robclark at freedesktop.org>

Not entirely sure how we didn't hit this before, but dropping the const
initializer on the floor is obviously not correct.

Signed-off-by: Rob Clark <robclark at freedesktop.org>
---
No idea why i965 even still uses this pass, vs nir scalarizing pass.
So might want to drop this.  But I figured fixing it first gives
something that can be cherry-picked to release branches, so this
patch should land before deleting the ir pass.

 src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp
index 5fe24de..7c58089 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp
@@ -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[i] = entry->var->constant_initializer->value.d[i];
+            } else {
+               data.u[i] = 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]);
       }
 
-- 
2.7.4



More information about the mesa-dev mailing list