Mesa (master): compiler/glsl: Propagate invariant/precise when splitting arrays

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 20 19:17:40 UTC 2021


Module: Mesa
Branch: master
Commit: d35f8604c7a79d3829df7ab54e94cad0a1db0461
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d35f8604c7a79d3829df7ab54e94cad0a1db0461

Author: Matt Turner <mattst88 at gmail.com>
Date:   Fri Apr 16 13:52:46 2021 -0400

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().

Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10292>

---

 src/compiler/glsl/opt_array_splitting.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/compiler/glsl/opt_array_splitting.cpp b/src/compiler/glsl/opt_array_splitting.cpp
index 7d928b9356b..3e3bff701da 100644
--- a/src/compiler/glsl/opt_array_splitting.cpp
+++ b/src/compiler/glsl/opt_array_splitting.cpp
@@ -474,6 +474,8 @@ optimize_split_arrays(exec_list *instructions, bool linked)
                                             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.



More information about the mesa-commit mailing list