Mesa (main): r600/sfn: Fix store_shared_r600 write masks

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Apr 17 13:28:09 UTC 2022


Module: Mesa
Branch: main
Commit: ef75752ef8639026e573ba7c97088c965551ef37
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ef75752ef8639026e573ba7c97088c965551ef37

Author: Gert Wollny <gert.wollny at collabora.com>
Date:   Sun Apr 17 09:47:28 2022 +0200

r600/sfn: Fix store_shared_r600 write masks

The error was caught by the new nir_validation code.

Fixes: 73ef225fc277cd7ccc996a0306cc3e9a30c46fa3
    nir: validate write_mask for all intrinsics that have it

Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15994>

---

 src/gallium/drivers/r600/sfn/sfn_nir_lower_tess_io.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r600/sfn/sfn_nir_lower_tess_io.cpp b/src/gallium/drivers/r600/sfn/sfn_nir_lower_tess_io.cpp
index a830d075382..892f0068b1d 100644
--- a/src/gallium/drivers/r600/sfn/sfn_nir_lower_tess_io.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_nir_lower_tess_io.cpp
@@ -244,10 +244,11 @@ emit_store_lds(nir_builder *b, nir_intrinsic_instr *op, nir_ssa_def *addr)
 
    for (int i = 0; i < 2; ++i) {
       unsigned test_mask = (0x3 << 2 * i);
-      if (!(orig_writemask & test_mask))
+      unsigned wmask = orig_writemask & test_mask;
+      if (!(wmask))
          continue;
 
-      uint32_t writemask =  test_mask >> nir_intrinsic_component(op);
+      uint32_t writemask =  wmask >> nir_intrinsic_component(op);
 
       auto store_tcs_out = nir_intrinsic_instr_create(b->shader, nir_intrinsic_store_local_shared_r600);
       nir_intrinsic_set_write_mask(store_tcs_out, writemask);



More information about the mesa-commit mailing list