glsl: teach opt_array_splitting about bindless images
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 25 May 2017 16:55:09 +0000 (18:55 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 1 Jun 2017 09:54:06 +0000 (11:54 +0200)
Memory/format layout qualifiers shouldn't be lost when arrays
of images are splitted by this pass.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/compiler/glsl/opt_array_splitting.cpp

index e3073b022ca6aadeab2a8c4b74c5b07dad921995..fb6d77bd942ccd43ec26e94710fed0f4344e95f3 100644 (file)
@@ -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]);
       }