[Mesa-dev] [PATCH 4/6] tgsi/scan: add more information about bindless usage

Marek Olšák maraeo at gmail.com
Tue Nov 20 04:09:40 UTC 2018


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

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

diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index e13500a7f7b..4ca84902dd4 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -361,37 +361,61 @@ scan_instruction(struct tgsi_shader_info *info,
    case TGSI_OPCODE_TEX2:
    case TGSI_OPCODE_TXB2:
    case TGSI_OPCODE_TXL2:
    case TGSI_OPCODE_TG4:
    case TGSI_OPCODE_LODQ:
       sampler_src = fullinst->Instruction.NumSrcRegs - 1;
       if (fullinst->Src[sampler_src].Register.File != TGSI_FILE_SAMPLER)
          info->uses_bindless_samplers = true;
       break;
    case TGSI_OPCODE_RESQ:
+      if (tgsi_is_bindless_image_file(fullinst->Src[0].Register.File))
+         info->uses_bindless_images = true;
+      break;
    case TGSI_OPCODE_LOAD:
+      if (tgsi_is_bindless_image_file(fullinst->Src[0].Register.File)) {
+         info->uses_bindless_images = true;
+
+         if (fullinst->Memory.Texture == TGSI_TEXTURE_BUFFER)
+            info->uses_bindless_buffer_load = true;
+         else
+            info->uses_bindless_image_load = true;
+      }
+      break;
    case TGSI_OPCODE_ATOMUADD:
    case TGSI_OPCODE_ATOMXCHG:
    case TGSI_OPCODE_ATOMCAS:
    case TGSI_OPCODE_ATOMAND:
    case TGSI_OPCODE_ATOMOR:
    case TGSI_OPCODE_ATOMXOR:
    case TGSI_OPCODE_ATOMUMIN:
    case TGSI_OPCODE_ATOMUMAX:
    case TGSI_OPCODE_ATOMIMIN:
    case TGSI_OPCODE_ATOMIMAX:
-      if (tgsi_is_bindless_image_file(fullinst->Src[0].Register.File))
+      if (tgsi_is_bindless_image_file(fullinst->Src[0].Register.File)) {
          info->uses_bindless_images = true;
+
+         if (fullinst->Memory.Texture == TGSI_TEXTURE_BUFFER)
+            info->uses_bindless_buffer_atomic = true;
+         else
+            info->uses_bindless_image_atomic = true;
+      }
       break;
    case TGSI_OPCODE_STORE:
-      if (tgsi_is_bindless_image_file(fullinst->Dst[0].Register.File))
+      if (tgsi_is_bindless_image_file(fullinst->Dst[0].Register.File)) {
          info->uses_bindless_images = true;
+
+         if (fullinst->Memory.Texture == TGSI_TEXTURE_BUFFER)
+            info->uses_bindless_buffer_store = true;
+         else
+            info->uses_bindless_image_store = true;
+      }
       break;
    default:
       break;
    }
 
    if (fullinst->Instruction.Opcode == TGSI_OPCODE_INTERP_CENTROID ||
        fullinst->Instruction.Opcode == TGSI_OPCODE_INTERP_OFFSET ||
        fullinst->Instruction.Opcode == TGSI_OPCODE_INTERP_SAMPLE) {
       const struct tgsi_full_src_register *src0 = &fullinst->Src[0];
       unsigned input;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h
index 1887ff342de..64f2598a259 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h
@@ -146,20 +146,27 @@ struct tgsi_shader_info
     * Bitmask indicating which declared image is a buffer.
     */
    unsigned images_buffers;
    unsigned images_load; /**< bitmask of images using loads */
    unsigned images_store; /**< bitmask of images using stores */
    unsigned images_atomic; /**< bitmask of images using atomics */
    unsigned shader_buffers_declared; /**< bitmask of declared shader buffers */
    unsigned shader_buffers_load; /**< bitmask of shader buffers using loads */
    unsigned shader_buffers_store; /**< bitmask of shader buffers using stores */
    unsigned shader_buffers_atomic; /**< bitmask of shader buffers using atomics */
+   bool uses_bindless_buffer_load;
+   bool uses_bindless_buffer_store;
+   bool uses_bindless_buffer_atomic;
+   bool uses_bindless_image_load;
+   bool uses_bindless_image_store;
+   bool uses_bindless_image_atomic;
+
    /**
     * 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;
-- 
2.17.1



More information about the mesa-dev mailing list