Summary: | Non-const initializers for matrix and vector constructors | ||
---|---|---|---|
Product: | Mesa | Reporter: | Cody Northrop <cody> |
Component: | glsl-compiler | Assignee: | Cody Northrop <cody> |
Status: | RESOLVED FIXED | QA Contact: | Intel 3D Bugs Mailing List <intel-3d-bugs> |
Severity: | normal | ||
Priority: | medium | CC: | kenneth, mattst88 |
Version: | git | ||
Hardware: | x86-64 (AMD64) | ||
OS: | Linux (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Bug Depends on: | |||
Bug Blocks: | 77449 |
Description
Cody Northrop
2014-05-28 14:57:47 UTC
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++; I sent the proposed fix to mesa-dev: http://www.mail-archive.com/mesa-dev@lists.freedesktop.org/msg61738.html And some additional piglit tests that start passing with the patch: http://lists.freedesktop.org/archives/piglit/2014-July/011559.html author Cody Northrop <cody@lunarg.com> 2014-07-10 15:55:31 (GMT) committer Kenneth Graunke <kenneth@whitecape.org> 2014-07-14 15:36:36 (GMT) commit 0f679f0ab5afc8c1469453b922d37ae7216136a4 (patch) (side-by-side diff) glsl: Fix aggregates with dynamic initializers. Vectors are falling in to the ir_dereference_array() path. Without this change, the following glsl aborts the debug driver, or gets the wrong answer in release: mat2x2 a = mat2( vec2( 1.0, vertex.x ), vec2( 0.0, 1.0 ) ); Also submitting piglit tests, will reference in bug. v2: Rebase on Mesa master. v3: Remove unneeded check for arrays, which are covered by process_array_constructor(), recommended by Timothy Arceri. Signed-off-by: Cody Northrop <cody@lunarg.com> Reviewed-by: Courtney Goeltzenleuchter <courtney@lunarg.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.