mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 21:50:12 +01:00
tu: Call nir_lower_sysvals_to_varyings once
Remove the early call to nir_lower_sysvals_to_varyings. This guarantees
that we only call it after lower_system_values has replaced the
variables with intrinsics. It turns out that a sequence like this
doesn't work:
1. shader declares Layer builtin as a signed integer
2. nir_lower_sysvals_to_varyings turns it into a varying (but keeps the
signed integer type)
3. nir_lower_input_attachments (or some other pass) creates a
nir_load_layer_id intrinsic.
4. nir_lower_sysvals_to_varyings is called again, and when creating the
varying variable it passes an unsigned type to
nir_get_variable_with_location(), which asserts because there is
already a signed integer variable.
By making lower_sysvals_to_varyings happen late for layer, we can avoid
this happening by lowering away the variable before (2).
Fixes: 5bbbf5cf9b ("tu: Set use_layer_id_sysval for nir_lower_input_attachments")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38793>
This commit is contained in:
parent
4cfa188db6
commit
63a38b945d
1 changed files with 1 additions and 6 deletions
|
|
@ -224,12 +224,6 @@ tu_spirv_to_nir(struct tu_device *dev,
|
|||
nir_print_shader(nir, stderr);
|
||||
}
|
||||
|
||||
const struct nir_lower_sysvals_to_varyings_options sysvals_to_varyings = {
|
||||
.point_coord = true,
|
||||
.layer_id = true,
|
||||
};
|
||||
NIR_PASS(_, nir, nir_lower_sysvals_to_varyings, &sysvals_to_varyings);
|
||||
|
||||
NIR_PASS(_, nir, nir_lower_global_vars_to_local);
|
||||
|
||||
/* Older glslang missing bf6efd0316d8 ("SPV: Fix #2293: keep relaxed
|
||||
|
|
@ -2791,6 +2785,7 @@ tu_shader_create(struct tu_device *dev,
|
|||
NIR_PASS(_, nir, nir_lower_input_attachments, &att_options);
|
||||
|
||||
const nir_lower_sysvals_to_varyings_options sysval_options = {
|
||||
.point_coord = true,
|
||||
.layer_id = true,
|
||||
.view_index = true,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue