tgsi/scan: add writes_memory to flag presence of stores or atomics
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 16 Mar 2016 01:54:30 +0000 (20:54 -0500)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 21 Mar 2016 20:34:25 +0000 (15:34 -0500)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/auxiliary/tgsi/tgsi_scan.c
src/gallium/auxiliary/tgsi/tgsi_scan.h

index 65bdab5b1cd51fa9ed19576c6ee71781bf81b6af..d32c3a143441f5b504bd1794299bd649df92e9a3 100644 (file)
@@ -196,10 +196,13 @@ scan_instruction(struct tgsi_shader_info *info,
       if (is_memory_file(src->Register.File)) {
          is_mem_inst = true;
 
-         if (src->Register.File == TGSI_FILE_IMAGE &&
-             !src->Register.Indirect &&
-             tgsi_get_opcode_info(fullinst->Instruction.Opcode)->is_store)
-            info->images_writemask |= 1 << src->Register.Index;
+         if (tgsi_get_opcode_info(fullinst->Instruction.Opcode)->is_store) {
+            info->writes_memory = TRUE;
+
+            if (src->Register.File == TGSI_FILE_IMAGE &&
+                !src->Register.Indirect)
+               info->images_writemask |= 1 << src->Register.Index;
+         }
       }
    }
 
@@ -215,6 +218,7 @@ scan_instruction(struct tgsi_shader_info *info,
          assert(fullinst->Instruction.Opcode == TGSI_OPCODE_STORE);
 
          is_mem_inst = true;
+         info->writes_memory = TRUE;
 
          if (dst->Register.File == TGSI_FILE_IMAGE &&
              !dst->Register.Indirect)
index d777f23749b46a594d16b9e39efe5d1cd71cf54b..76d8925119ee5307617da03b5dac78deeaa14cf2 100644 (file)
@@ -111,6 +111,7 @@ struct tgsi_shader_info
    boolean writes_clipvertex;
    boolean writes_viewport_index;
    boolean writes_layer;
+   boolean writes_memory; /**< contains stores or atomics to buffers or images */
    boolean is_msaa_sampler[PIPE_MAX_SAMPLERS];
    boolean uses_doubles; /**< uses any of the double instructions */
    unsigned clipdist_writemask;