[Mesa-dev] [PATCH 3/7] tgsi/scan: don't treat RESQ etc. as memory instructions

Marek Olšák maraeo at gmail.com
Thu Oct 20 18:08:50 UTC 2016


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/auxiliary/tgsi/tgsi_scan.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index e5edea8..66f1fdf 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -47,31 +47,38 @@
 static bool
 is_memory_file(unsigned file)
 {
    return file == TGSI_FILE_SAMPLER ||
           file == TGSI_FILE_SAMPLER_VIEW ||
           file == TGSI_FILE_IMAGE ||
           file == TGSI_FILE_BUFFER;
 }
 
 
+static bool
+is_mem_query_inst(unsigned opcode)
+{
+   return opcode == TGSI_OPCODE_RESQ ||
+          opcode == TGSI_OPCODE_TXQ ||
+          opcode == TGSI_OPCODE_TXQS ||
+          opcode == TGSI_OPCODE_TXQ_LZ ||
+          opcode == TGSI_OPCODE_LODQ;
+}
+
 /**
  * Is the opcode a "true" texture instruction which samples from a
  * texture map?
  */
 static bool
 is_texture_inst(unsigned opcode)
 {
-   return (opcode != TGSI_OPCODE_TXQ &&
-           opcode != TGSI_OPCODE_TXQS &&
-           opcode != TGSI_OPCODE_TXQ_LZ &&
-           opcode != TGSI_OPCODE_LODQ &&
+   return (!is_mem_query_inst(opcode) &&
            tgsi_get_opcode_info(opcode)->is_tex);
 }
 
 
 /**
  * Is the opcode an instruction which computes a derivative explicitly or
  * implicitly?
  */
 static bool
 computes_derivative(unsigned opcode)
@@ -313,21 +320,22 @@ scan_instruction(struct tgsi_shader_info *info,
                assert(info->sampler_targets[index] == target);
             }
             /* MSAA samplers */
             if (target == TGSI_TEXTURE_2D_MSAA ||
                 target == TGSI_TEXTURE_2D_ARRAY_MSAA) {
                info->is_msaa_sampler[src->Register.Index] = TRUE;
             }
          }
       }
 
-      if (is_memory_file(src->Register.File)) {
+      if (is_memory_file(src->Register.File) &&
+          !is_mem_query_inst(fullinst->Instruction.Opcode)) {
          is_mem_inst = true;
 
          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;
          }
       }
-- 
2.7.4



More information about the mesa-dev mailing list