[Mesa-dev] [PATCH 45/47] i965/fs: Predicate byte scattered writes if needed

Alejandro PiƱeiro apinheiro at igalia.com
Thu Aug 24 13:55:00 UTC 2017


While on Untyped Surface messages the bits of the execution mask are
ANDed with the corresponding bits of the Pixel/Sample Mask, that is
not the case for byte scattered writes. That is needed to avoid ssbo
stores writing on helper invocations. So when that can affect, we load
the sample mask, and predicate the send message.

Note: the need for this patch was tested with a custom test. Right now
the 16 bit storage CTS tests doesnt need this path in order to get a
full pass.
---
 src/intel/compiler/brw_fs_nir.cpp | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp
index 55b2dfd0caf..03acc53c3d7 100644
--- a/src/intel/compiler/brw_fs_nir.cpp
+++ b/src/intel/compiler/brw_fs_nir.cpp
@@ -4305,12 +4305,23 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
          if (type_size == 2 && length == 1) {
             /* Untyped Surface messages have a fixed 32-bit size, so we need
              * to rely on byte scattered in order to write a single 16-bit
-             * element.
+             * element. Additionally, while on Untyped Surface messages the
+             * bits of the execution mask are ANDed with the corresponding
+             * bits of the Pixel/Sample Mask, that is not the case for byte
+             * scattered writes. That is needed to avoid ssbo stores writing
+             * on helper invocations. So when that can affect, we load the
+             * sample mask, and predicate the send message.
              */
+            brw_predicate pred = BRW_PREDICATE_NONE;
+
+            if (stage == MESA_SHADER_FRAGMENT) {
+               bld.emit(FS_OPCODE_MOV_DISPATCH_TO_FLAGS);
+               pred = BRW_PREDICATE_NORMAL;
+            }
             emit_byte_scattered_write(bld, surf_index, offset_reg,
                                       current_val_reg,
                                       1 /* dims */, length * type_slots,
-                                      BRW_PREDICATE_NONE);
+                                      pred);
          } else {
             unsigned write_size = length * type_slots;
 
-- 
2.11.0



More information about the mesa-dev mailing list