[Bug 79373] Non-const initializers for matrix and vector constructors

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu May 29 08:38:27 PDT 2014


https://bugs.freedesktop.org/show_bug.cgi?id=79373

--- Comment #1 from Cody Northrop <cody at lunarg.com> ---
FWIW, I'm using the following patch locally and it works for the tests I've
tried it with.  No real piglit regressions (just glean noise that happens on
clean driver).


diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp
index 4b84470..4995af4 100644
--- a/src/glsl/ast_function.cpp
+++ b/src/glsl/ast_function.cpp
@@ -751,10 +751,20 @@ process_vec_mat_constructor(exec_list *instructions,
    int i = 0;
    foreach_list(node, &actual_parameters) {
       ir_rvalue *rhs = (ir_rvalue *) node;
-      ir_rvalue *lhs = new(ctx) ir_dereference_array(var,
-                                                     new(ctx) ir_constant(i));
+      ir_instruction *assignment = NULL;
+
+      if (var->type->is_array() || var->type->is_matrix()) {
+         ir_rvalue *lhs = new(ctx) ir_dereference_array(var,
+                                                     new(ctx) ir_constant(i));
+         assignment = new(ctx) ir_assignment(lhs, rhs, NULL);
+      } else {
+         /* use writemask rather than index for vector */
+         assert(var->type->is_vector());
+         assert(i < 4);
+         ir_dereference *lhs = new(ctx) ir_dereference_variable(var);
+         assignment = new(ctx) ir_assignment(lhs, rhs, NULL, (unsigned)(1 <<
i));
+      }

-      ir_instruction *assignment = new(ctx) ir_assignment(lhs, rhs, NULL);
       instructions->push_tail(assignment);

       i++;

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/intel-3d-bugs/attachments/20140529/a85d8a5c/attachment.html>


More information about the intel-3d-bugs mailing list