Mesa (master): nir_lower_io: Add addr_format_is_offset helper

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jul 14 18:30:54 UTC 2020


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

Author: Jesse Natalie <jenatali at microsoft.com>
Date:   Tue Jul 14 10:38:32 2020 -0700

nir_lower_io: Add addr_format_is_offset helper

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5889>

---

 src/compiler/nir/nir_lower_io.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c
index 32fe2093b42..70474f18852 100644
--- a/src/compiler/nir/nir_lower_io.c
+++ b/src/compiler/nir/nir_lower_io.c
@@ -775,6 +775,12 @@ addr_format_is_global(nir_address_format addr_format)
           addr_format == nir_address_format_64bit_bounded_global;
 }
 
+static bool
+addr_format_is_offset(nir_address_format addr_format)
+{
+   return addr_format == nir_address_format_32bit_offset;
+}
+
 static nir_ssa_def *
 addr_to_global(nir_builder *b, nir_ssa_def *addr,
                nir_address_format addr_format)
@@ -843,7 +849,7 @@ build_explicit_io_load(nir_builder *b, nir_intrinsic_instr *intrin,
       op = nir_intrinsic_load_kernel_input;
       break;
    case nir_var_mem_shared:
-      assert(addr_format == nir_address_format_32bit_offset);
+      assert(addr_format_is_offset(addr_format));
       op = nir_intrinsic_load_shared;
       break;
    default:
@@ -938,7 +944,7 @@ build_explicit_io_store(nir_builder *b, nir_intrinsic_instr *intrin,
       op = nir_intrinsic_store_global;
       break;
    case nir_var_mem_shared:
-      assert(addr_format == nir_address_format_32bit_offset);
+      assert(addr_format_is_offset(addr_format));
       op = nir_intrinsic_store_shared;
       break;
    default:



More information about the mesa-commit mailing list