summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2014-11-19 12:59:57 -0800
committerJason Ekstrand <[email protected]>2015-01-15 07:19:02 -0800
commit4f8230e247a222314ab124e348482628adb5af32 (patch)
tree2a4b28ad3bae5f44eb9586fe0811acd8ebc69bf9 /src/glsl/nir
parentb5143edaeeb6f57558f5bb6fbd7f7cc39ad7489d (diff)
nir: Add a concept of a wildcard array dereference
Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/glsl/nir')
-rw-r--r--src/glsl/nir/nir.h9
-rw-r--r--src/glsl/nir/nir_print.c3
2 files changed, 12 insertions, 0 deletions
diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
index 021d4c91323..a9a77f395f3 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 0156582c20c..ec60981b548 100644
--- a/src/glsl/nir/nir_print.c
+++ b/src/glsl/nir/nir_print.c
@@ -274,6 +274,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, "]");
}