UPSTREAM: compiler/glsl: Propagate invariant/precise when splitting arrays
This fixes the
dEQP-GLES3.functional.shaders.invariance.{low,medium,high}p.loop_4 tests when
run in a VM with virgl on a host with iris. virgl mangles the GLSL shaders and
emits shader code for the host driver that contains vec4 arrays. As such, the
test did not fail when running directly on the host.
The test also did not fail if the host was using i965. Disabling
PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY in iris was sufficient to work around it,
so I believe that i965 didn't show the problem because after arrays were split
by optimize_split_arrays(), even though the invariant/precise qualifiers were
lost, do_common_optimization() would be called again and thus
propagate_invariance() would propagate the qualifiers to the new variables
produced by optimize_split_arrays().
BUG=b:177028255
TEST=CtsDeqp on dedede
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10292>
(cherry picked from commit d35f8604c7a79d3829df7ab54e94cad0a1db0461)
Change-Id: Ibb8578af1f19ccb6916d1b31674c040a32055c0d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/mesa/+/2891950
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Robert Tarasov <tutankhamen@chromium.org>
Commit-Queue: Ilja H. Friedel <ihf@chromium.org>
Tested-by: Ilja H. Friedel <ihf@chromium.org>
diff --git a/src/compiler/glsl/opt_array_splitting.cpp b/src/compiler/glsl/opt_array_splitting.cpp
index 7d928b9..3e3bff7 100644
--- a/src/compiler/glsl/opt_array_splitting.cpp
+++ b/src/compiler/glsl/opt_array_splitting.cpp
@@ -474,6 +474,8 @@
entry->var->name, i);
ir_variable *new_var =
new(entry->mem_ctx) ir_variable(subtype, name, ir_var_temporary);
+ new_var->data.invariant = entry->var->data.invariant;
+ new_var->data.precise = entry->var->data.precise;
/* Do not lose memory/format qualifiers when arrays of images are
* split.