Module: Mesa
Branch: master
Commit: 2a936f8afaba6ce4fdd44bb24cb016413a611b4e
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2a936f8afaba6ce4fdd44bb24cb016413a611b4e

Author: Marek Olšák <[email protected]>
Date:   Mon Nov 19 22:27:15 2018 -0500

tgsi/scan: add more information about bindless usage

radeonsi will use this.

---

 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 e13500a7f7..4ca84902dd 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -368,7 +368,19 @@ scan_instruction(struct tgsi_shader_info *info,
          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:
@@ -379,12 +391,24 @@ scan_instruction(struct tgsi_shader_info *info,
    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;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h 
b/src/gallium/auxiliary/tgsi/tgsi_scan.h
index 1887ff342d..64f2598a25 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h
@@ -153,6 +153,13 @@ struct tgsi_shader_info
    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.

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to