<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Non-const initializers for matrix and vector constructors"
href="https://bugs.freedesktop.org/show_bug.cgi?id=79373#c1">Comment # 1</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Non-const initializers for matrix and vector constructors"
href="https://bugs.freedesktop.org/show_bug.cgi?id=79373">bug 79373</a>
from <span class="vcard"><a class="email" href="mailto:cody@lunarg.com" title="Cody Northrop <cody@lunarg.com>"> <span class="fn">Cody Northrop</span></a>
</span></b>
<pre>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++;</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
</ul>
</body>
</html>