From 23f1294f425f1ae89d1769b4b48edb007dc77b2a Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Thu, 1 Dec 2022 22:17:42 +0100 Subject: [PATCH] zink: fix line-stipple varying allocation This was really derpy. There's two things wrong; first of all, we should pick at LEAST VARYING_SLOT_VAR0, second, util_last_bit64 returns one more than the index of the bit already, so we don't want to add twice here. Fixes: 4b17c099ca4 ("zink: add line-stippling lowering passes") Part-of: --- src/gallium/drivers/zink/zink_compiler.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c index fe058b0cc87..345cb762a7a 100644 --- a/src/gallium/drivers/zink/zink_compiler.c +++ b/src/gallium/drivers/zink/zink_compiler.c @@ -463,7 +463,7 @@ lower_line_stipple_gs(nir_shader *shader) "__stipple"); state.stipple_out->data.interpolation = INTERP_MODE_NOPERSPECTIVE; state.stipple_out->data.driver_location = shader->num_outputs++; - state.stipple_out->data.location = MIN2(util_last_bit64(shader->info.outputs_written) + 1, VARYING_SLOT_VAR0); + state.stipple_out->data.location = MAX2(util_last_bit64(shader->info.outputs_written), VARYING_SLOT_VAR0); shader->info.outputs_written |= BITFIELD64_BIT(state.stipple_out->data.location); // create temp variables @@ -501,7 +501,7 @@ lower_line_stipple_fs(nir_shader *shader) "__stipple"); stipple->data.interpolation = INTERP_MODE_NOPERSPECTIVE; stipple->data.driver_location = shader->num_inputs++; - stipple->data.location = MIN2(util_last_bit64(shader->info.inputs_read) + 1, VARYING_SLOT_VAR0); + stipple->data.location = MAX2(util_last_bit64(shader->info.inputs_read), VARYING_SLOT_VAR0); shader->info.inputs_read |= BITFIELD64_BIT(stipple->data.location); nir_variable *sample_mask_out =