summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-05-25 18:55:09 +0200
committerSamuel Pitoiset <[email protected]>2017-06-01 11:54:06 +0200
commite4e5562d8ad99ef39f430ce0546f4f8775d4824f (patch)
treeb3e4f3009dd4c2e0f505c41a144b2795ceafc8e9
parent678e05cc345b714919959cb2c93fb9f052315355 (diff)
glsl: teach opt_array_splitting about bindless images
Memory/format layout qualifiers shouldn't be lost when arrays of images are splitted by this pass. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
-rw-r--r--src/compiler/glsl/opt_array_splitting.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/compiler/glsl/opt_array_splitting.cpp b/src/compiler/glsl/opt_array_splitting.cpp
index e3073b022ca..fb6d77bd942 100644
--- a/src/compiler/glsl/opt_array_splitting.cpp
+++ b/src/compiler/glsl/opt_array_splitting.cpp
@@ -449,9 +449,20 @@ optimize_split_arrays(exec_list *instructions, bool linked)
for (unsigned int i = 0; i < entry->size; i++) {
const char *name = ralloc_asprintf(mem_ctx, "%s_%d",
entry->var->name, i);
-
- entry->components[i] =
+ ir_variable *new_var =
new(entry->mem_ctx) ir_variable(subtype, name, ir_var_temporary);
+
+ /* Do not lose memory/format qualifiers when arrays of images are
+ * split.
+ */
+ new_var->data.memory_read_only = entry->var->data.memory_read_only;
+ new_var->data.memory_write_only = entry->var->data.memory_write_only;
+ new_var->data.memory_coherent = entry->var->data.memory_coherent;
+ new_var->data.memory_volatile = entry->var->data.memory_volatile;
+ new_var->data.memory_restrict = entry->var->data.memory_restrict;
+ new_var->data.image_format = entry->var->data.image_format;
+
+ entry->components[i] = new_var;
entry->var->insert_before(entry->components[i]);
}