From 6f2d6b9d4ff59c41601c7e251d240be7c43e85c5 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Wed, 7 Apr 2021 19:26:33 +0200 Subject: [PATCH] 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 Part-of: --- src/gallium/drivers/zink/zink_compiler.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c index d840fb001ae..03ba0b08e1a 100644 --- a/src/gallium/drivers/zink/zink_compiler.c +++ b/src/gallium/drivers/zink/zink_compiler.c @@ -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)