st/glsl_to_tgsi: fix block copies of arrays of structs
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Sun, 16 Oct 2016 15:34:33 +0000 (17:34 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 20 Oct 2016 08:37:01 +0000 (10:37 +0200)
Use a full writemask in this case. This is relevant e.g. when a function
has an inout argument which is an array of structs.

v2: use C-style comment (Timothy Arceri)

Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v1)
Cc: 13.0 <mesa-stable@lists.freedesktop.org>
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index 562587ee58cbadc0c2430184becb525c5901c499..854decc39ac5eb8977b816ada16639eeb788a711 100644 (file)
@@ -2941,10 +2941,12 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir)
       } else if (ir->write_mask == 0) {
          assert(!ir->lhs->type->is_scalar() && !ir->lhs->type->is_vector());
 
-         if (ir->lhs->type->is_array() || ir->lhs->type->is_matrix()) {
-            unsigned num_elements = ir->lhs->type->without_array()->vector_elements;
+         unsigned num_elements = ir->lhs->type->without_array()->vector_elements;
+
+         if (num_elements) {
             l.writemask = u_bit_consecutive(0, num_elements);
          } else {
+            /* The type is a struct or an array of (array of) structs. */
             l.writemask = WRITEMASK_XYZW;
          }
       } else {