[Mesa-dev] [RFC 1/2] nir: add intrinsics for load/store global

Rob Clark robdclark at gmail.com
Tue Apr 7 08:52:03 PDT 2015


From: Rob Clark <robclark at freedesktop.org>

Seemed like these were missing in action?  This is how it works for
other vars (uniform/shader_in/shader_out/etc), so seemed sensible.

Signed-off-by: Rob Clark <robclark at freedesktop.org>
---
 src/glsl/nir/nir_intrinsics.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/glsl/nir/nir_intrinsics.h b/src/glsl/nir/nir_intrinsics.h
index 8e28765..a047324 100644
--- a/src/glsl/nir/nir_intrinsics.h
+++ b/src/glsl/nir/nir_intrinsics.h
@@ -122,6 +122,10 @@ SYSTEM_VALUE(invocation_id, 1)
    INTRINSIC(load_##name##_indirect, extra_srcs + 1, ARR(1, 1), \
              true, 0, 0, 2, flags)
 
+/* NOTE: global can be re-ordered, just not wrt. stores.. not sure if
+ * is a way to express that?
+ */
+LOAD(global, 0, NIR_INTRINSIC_CAN_ELIMINATE)
 LOAD(uniform, 0, NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
 LOAD(ubo, 1, NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
 LOAD(input, 0, NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
@@ -136,8 +140,9 @@ LOAD(input, 0, NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
 #define STORE(name, num_indices, flags) \
    INTRINSIC(store_##name, 1, ARR(0), false, 0, 0, num_indices, flags) \
    INTRINSIC(store_##name##_indirect, 2, ARR(0, 1), false, 0, 0, \
-             num_indices, flags) \
+             num_indices, flags)
 
+STORE(global, 2, 0)    /* num_indices should be ?? */
 STORE(output, 2, 0)
 /* STORE(ssbo, 3, 0) */
 
-- 
2.1.0



More information about the mesa-dev mailing list