[Mesa-dev] [PATCH 2/7] tgsi/scan: get information about indirect 2D file access

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


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

---
 src/gallium/auxiliary/tgsi/tgsi_scan.c | 6 ++++++
 src/gallium/auxiliary/tgsi/tgsi_scan.h | 1 +
 2 files changed, 7 insertions(+)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index 0c81005..e5edea8 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -278,20 +278,23 @@ scan_instruction(struct tgsi_shader_info *info,
                if (src->Dimension.Indirect)
                   info->const_buffers_indirect = info->const_buffers_declared;
                else
                   info->const_buffers_indirect |= 1u << src->Dimension.Index;
             } else {
                info->const_buffers_indirect |= 1;
             }
          }
       }
 
+      if (src->Register.Dimension && src->Dimension.Indirect)
+         info->dim_indirect_files |= 1u << src->Register.File;
+
       /* Texture samplers */
       if (src->Register.File == TGSI_FILE_SAMPLER) {
          const unsigned index = src->Register.Index;
 
          assert(fullinst->Instruction.Texture);
          assert(index < ARRAY_SIZE(info->is_msaa_sampler));
          assert(index < PIPE_MAX_SAMPLERS);
 
          if (is_texture_inst(fullinst->Instruction.Opcode)) {
             const unsigned target = fullinst->Texture.Texture;
@@ -331,20 +334,23 @@ scan_instruction(struct tgsi_shader_info *info,
    }
 
    /* check for indirect register writes */
    for (i = 0; i < fullinst->Instruction.NumDstRegs; i++) {
       const struct tgsi_full_dst_register *dst = &fullinst->Dst[i];
       if (dst->Register.Indirect) {
          info->indirect_files |= (1 << dst->Register.File);
          info->indirect_files_written |= (1 << dst->Register.File);
       }
 
+      if (dst->Register.Dimension && dst->Dimension.Indirect)
+         info->dim_indirect_files |= 1u << dst->Register.File;
+
       if (is_memory_file(dst->Register.File)) {
          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)
             info->images_writemask |= 1 << dst->Register.Index;
       }
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h
index 2e61dc7..47528d5 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h
@@ -135,20 +135,21 @@ struct tgsi_shader_info
     * Bitmask indicating which register files are accessed with
     * indirect addressing.  The bits are (1 << TGSI_FILE_x), etc.
     */
    unsigned indirect_files;
    /**
     * Bitmask indicating which register files are read / written with
     * indirect addressing.  The bits are (1 << TGSI_FILE_x).
     */
    unsigned indirect_files_read;
    unsigned indirect_files_written;
+   unsigned dim_indirect_files; /**< shader resource indexing */
    unsigned const_buffers_indirect; /**< const buffers using indirect addressing */
 
    unsigned properties[TGSI_PROPERTY_COUNT]; /* index with TGSI_PROPERTY_ */
 
    /**
     * Max nesting limit of loops/if's
     */
    unsigned max_depth;
 };
 
-- 
2.7.4



More information about the mesa-dev mailing list