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

Author: Matt Turner <matts...@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 <tarc...@itsqueeze.com>
Reviewed-by: Kenneth Graunke <kenn...@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.

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to