[Mesa-dev] [PATCH] intel/compiler: Flag surface reads as having side-effects

Jason Ekstrand jason at jlekstrand.net
Mon Nov 26 20:01:53 UTC 2018


---
 src/intel/compiler/brw_shader.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/intel/compiler/brw_shader.cpp b/src/intel/compiler/brw_shader.cpp
index 34b8f3acf93..5cb91e0dce9 100644
--- a/src/intel/compiler/brw_shader.cpp
+++ b/src/intel/compiler/brw_shader.cpp
@@ -1007,6 +1007,18 @@ backend_instruction::has_side_effects() const
    case SHADER_OPCODE_SEND:
       return send_has_side_effects;
 
+   case SHADER_OPCODE_TYPED_SURFACE_READ:
+   case SHADER_OPCODE_TYPED_SURFACE_READ_LOGICAL:
+   case SHADER_OPCODE_UNTYPED_SURFACE_READ:
+   case SHADER_OPCODE_UNTYPED_SURFACE_READ_LOGICAL:
+   case SHADER_OPCODE_BYTE_SCATTERED_READ:
+   case SHADER_OPCODE_BYTE_SCATTERED_READ_LOGICAL:
+      /* The back-end compilers don't know how to properly re-order reads with
+       * respect to writes.  In order to prevent accidental re-ordering and
+       * CSE, flag them as having side-effects.
+       */
+      return true;
+
    case SHADER_OPCODE_UNTYPED_ATOMIC:
    case SHADER_OPCODE_UNTYPED_ATOMIC_LOGICAL:
    case SHADER_OPCODE_UNTYPED_ATOMIC_FLOAT:
-- 
2.19.1



More information about the mesa-dev mailing list