nir: fix gathering color interp modes in nir_lower_color_inputs
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Fixes: 709ebd82 ("amd: expose nir_io_mix_convergent_flat_with_interpolated")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12800

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34942>
This commit is contained in:
Marek Olšák 2025-05-12 22:26:07 -04:00
parent ef63e3e4d2
commit a1ee6d6730

View file

@ -3236,6 +3236,14 @@ nir_lower_color_inputs(nir_shader *nir)
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
bool progress = false;
/* Both flat and non-flat can occur with nir_io_mix_convergent_flat_with_interpolated,
* but we want to save only the non-flat interp mode in that case.
*
* Start with flat and set to non-flat only if it's present.
*/
nir->info.fs.color0_interp = INTERP_MODE_FLAT;
nir->info.fs.color1_interp = INTERP_MODE_FLAT;
nir_builder b = nir_builder_create(impl);
nir_foreach_block(block, impl) {
@ -3279,13 +3287,15 @@ nir_lower_color_inputs(nir_shader *nir)
if (sem.location == VARYING_SLOT_COL0) {
load = nir_load_color0(&b);
nir->info.fs.color0_interp = interp;
if (interp != INTERP_MODE_FLAT)
nir->info.fs.color0_interp = interp;
nir->info.fs.color0_sample = sample;
nir->info.fs.color0_centroid = centroid;
} else {
assert(sem.location == VARYING_SLOT_COL1);
load = nir_load_color1(&b);
nir->info.fs.color1_interp = interp;
if (interp != INTERP_MODE_FLAT)
nir->info.fs.color1_interp = interp;
nir->info.fs.color1_sample = sample;
nir->info.fs.color1_centroid = centroid;
}