[Mesa-dev] [PATCH 081/133] nir: Add a concept of a wildcard array dereference

Jason Ekstrand jason at jlekstrand.net
Mon Dec 15 22:11:26 PST 2014


---
 src/glsl/nir/nir.h       | 9 +++++++++
 src/glsl/nir/nir_print.c | 3 +++
 2 files changed, 12 insertions(+)

diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
index f4db3f8..27e7e7a 100644
--- a/src/glsl/nir/nir.h
+++ b/src/glsl/nir/nir.h
@@ -625,9 +625,18 @@ typedef struct {
    nir_variable *var;
 } nir_deref_var;
 
+/* This enum describes how the array is referenced.  If the deref is
+ * direct then the base_offset is used.  If the deref is indirect then then
+ * offset is given by base_offset + indirect.  If the deref is a wildcard
+ * then the deref refers to all of the elements of the array at the same
+ * time.  Wildcard dereferences are only ever allowed in copy_var
+ * intrinsics and the source and destination derefs must have matching
+ * wildcards.
+ */
 typedef enum {
    nir_deref_array_type_direct,
    nir_deref_array_type_indirect,
+   nir_deref_array_type_wildcard,
 } nir_deref_array_type;
 
 typedef struct {
diff --git a/src/glsl/nir/nir_print.c b/src/glsl/nir/nir_print.c
index 15f6ae1..45b8623 100644
--- a/src/glsl/nir/nir_print.c
+++ b/src/glsl/nir/nir_print.c
@@ -275,6 +275,9 @@ print_deref_array(nir_deref_array *deref, print_var_state *state, FILE *fp)
          fprintf(fp, "%u + ", deref->base_offset);
       print_src(&deref->indirect, fp);
       break;
+   case nir_deref_array_type_wildcard:
+      fprintf(fp, "*");
+      break;
    }
    fprintf(fp, "]");
 }
-- 
2.2.0



More information about the mesa-dev mailing list