zink: set nir_io_glsl_lower_derefs in compiler options

this runs all the io lowering in the frontend and allows for code--

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28580>
This commit is contained in:
Mike Blumenkrantz 2024-03-15 13:57:38 -04:00 committed by Marge Bot
parent 163bb2b9c1
commit e8c12c82ef

View file

@ -1214,6 +1214,7 @@ zink_screen_init_compiler(struct zink_screen *screen)
{
static const struct nir_shader_compiler_options
default_options = {
.io_options = nir_io_glsl_lower_derefs,
.lower_ffma16 = true,
.lower_ffma32 = true,
.lower_ffma64 = true,
@ -5707,25 +5708,6 @@ zink_shader_create(struct zink_screen *screen, struct nir_shader *nir)
ret->programs = _mesa_pointer_set_create(NULL);
simple_mtx_init(&ret->lock, mtx_plain);
nir_lower_io_options lower_io_flags = 0;
if (!screen->info.feats.features.shaderInt64 || !screen->info.feats.features.shaderFloat64)
lower_io_flags = nir_lower_io_lower_64bit_to_32;
else if (!screen->info.feats.features.shaderFloat64)
lower_io_flags = nir_lower_io_lower_64bit_float_to_32;
bool temp_inputs = nir->info.stage != MESA_SHADER_VERTEX && nir->info.inputs_read & BITFIELD_RANGE(VARYING_SLOT_CLIP_DIST0, 4);
bool temp_outputs = nir->info.stage != MESA_SHADER_FRAGMENT && (nir->info.outputs_read | nir->info.outputs_written) & BITFIELD_RANGE(VARYING_SLOT_CLIP_DIST0, 4);
if (temp_inputs || temp_outputs) {
NIR_PASS_V(nir, nir_lower_io_to_temporaries, nir_shader_get_entrypoint(nir), temp_outputs, temp_inputs);
NIR_PASS_V(nir, nir_lower_global_vars_to_local);
NIR_PASS_V(nir, nir_split_var_copies);
NIR_PASS_V(nir, nir_lower_var_copies);
}
NIR_PASS_V(nir, nir_lower_io, nir_var_shader_out, zink_type_size, lower_io_flags);
if (nir->info.stage == MESA_SHADER_VERTEX)
lower_io_flags |= nir_lower_io_lower_64bit_to_32;
NIR_PASS_V(nir, nir_lower_io, nir_var_shader_in, zink_type_size, lower_io_flags);
nir->info.io_lowered = true;
if (nir->info.stage == MESA_SHADER_KERNEL) {
nir_lower_mem_access_bit_sizes_options lower_mem_access_options = {
.modes = nir_var_all ^ nir_var_function_temp,