Mesa (master): st/glsl_to_tgsi: setup writemask for double arrays and matricies.

Dave Airlie airlied at kemper.freedesktop.org
Fri Jan 1 00:22:38 UTC 2016


Module: Mesa
Branch: master
Commit: 7351c7684f75704dfef82a25177e6c5284d8bb0a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7351c7684f75704dfef82a25177e6c5284d8bb0a

Author: Dave Airlie <airlied at redhat.com>
Date:   Sat Dec 19 14:43:14 2015 +1000

st/glsl_to_tgsi: setup writemask for double arrays and matricies.

It's important for the double instruction emission code that
the writemasks are correct going in for double so it know
which channels to replicate.

This fixes it for the array and matrix cases.

Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |   21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 6eb31b3..133ba37 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -2754,7 +2754,26 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir)
     */
    if (ir->write_mask == 0) {
       assert(!ir->lhs->type->is_scalar() && !ir->lhs->type->is_vector());
-      l.writemask = WRITEMASK_XYZW;
+
+      if (ir->lhs->type->is_array() || ir->lhs->type->without_array()->is_matrix()) {
+         if (ir->lhs->type->without_array()->is_double()) {
+            switch (ir->lhs->type->without_array()->vector_elements) {
+            case 1:
+               l.writemask = WRITEMASK_X;
+               break;
+            case 2:
+               l.writemask = WRITEMASK_XY;
+               break;
+            case 3:
+               l.writemask = WRITEMASK_XYZ;
+               break;
+            case 4:
+               l.writemask = WRITEMASK_XYZW;
+               break;
+            }
+         } else
+            l.writemask = WRITEMASK_XYZW;
+      }
    } else if (ir->lhs->type->is_scalar() &&
               !ir->lhs->type->is_double() &&
               ir->lhs->variable_referenced()->data.mode == ir_var_shader_out) {




More information about the mesa-commit mailing list