zink: always lower function-temp derefs

We're about to need this in order to support 16-bit floats, because the
lowering code for that emits function-temp derefs, and we don't handle
it.

A better long-term solution would be to just support function-temp
variables and indirect derefs. But that's more work, and kinda
orthogonal to what this patchset tries to accomplish, so let's save that
for another day.

Fixes the following piglit:
- spec@arb_gl_spirv@execution@ubo@array-inside-ubo-copy

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10101>
This commit is contained in:
Erik Faye-Lund
2021-04-07 19:26:33 +02:00
committed by Marge Bot
parent 3f4eacb38a
commit 6f2d6b9d4f
+10 -4
View File
@@ -847,14 +847,20 @@ zink_shader_create(struct zink_screen *screen, struct nir_shader *nir,
ret->shader_id = p_atomic_inc_return(&screen->shader_id);
ret->programs = _mesa_pointer_set_create(NULL);
nir_variable_mode indirect_derefs_modes = nir_var_function_temp;
if (nir->info.stage == MESA_SHADER_TESS_CTRL ||
nir->info.stage == MESA_SHADER_TESS_EVAL)
indirect_derefs_modes |= nir_var_shader_in | nir_var_shader_out;
NIR_PASS_V(nir, nir_lower_indirect_derefs, indirect_derefs_modes,
UINT32_MAX);
if (nir->info.stage == MESA_SHADER_VERTEX)
create_vs_pushconst(nir);
else if (nir->info.stage == MESA_SHADER_TESS_CTRL ||
nir->info.stage == MESA_SHADER_TESS_EVAL) {
NIR_PASS_V(nir, nir_lower_indirect_derefs, nir_var_shader_in |
nir_var_shader_out, UINT32_MAX);
nir->info.stage == MESA_SHADER_TESS_EVAL)
NIR_PASS_V(nir, nir_lower_io_arrays_to_elements_no_indirects, false);
} else if (nir->info.stage == MESA_SHADER_KERNEL)
else if (nir->info.stage == MESA_SHADER_KERNEL)
create_cs_pushconst(nir);
if (nir->info.stage < MESA_SHADER_FRAGMENT)