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@itsqueeze.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10292>
This commit is contained in:
Matt Turner
2021-04-16 13:52:46 -04:00
committed by Marge Bot
parent 5ef4296cb6
commit d35f8604c7

View File

@@ -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.