From e82ce1852a40d2648c98317da2c0f2cf656d15c7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 21 Apr 2020 16:18:42 -0700 Subject: [PATCH] gallium: Fix setup of pstipple frag coord var. If the last input was a struct or matrix, we would have overlapped driver locations for our new position var. Reviewed-by: Connor Abbott Reviewed-by: Jose Maria Casanova Crespo Part-of: --- src/gallium/auxiliary/nir/nir_draw_helpers.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/gallium/auxiliary/nir/nir_draw_helpers.c b/src/gallium/auxiliary/nir/nir_draw_helpers.c index 7a6936d63d7..33fdf4aee69 100644 --- a/src/gallium/auxiliary/nir/nir_draw_helpers.c +++ b/src/gallium/auxiliary/nir/nir_draw_helpers.c @@ -49,20 +49,16 @@ typedef struct { static nir_ssa_def * load_frag_coord(nir_builder *b) { - int max_driver_loc = -1; nir_foreach_variable(var, &b->shader->inputs) { if (var->data.location == VARYING_SLOT_POS) return nir_load_var(b, var); - if (max_driver_loc < (int)var->data.driver_location) - max_driver_loc = var->data.driver_location; } nir_variable *pos = nir_variable_create(b->shader, nir_var_shader_in, glsl_vec4_type(), NULL); pos->data.location = VARYING_SLOT_POS; pos->data.interpolation = INTERP_MODE_NOPERSPECTIVE; - pos->data.driver_location = max_driver_loc + 1; - b->shader->num_inputs++; + pos->data.driver_location = b->shader->num_inputs++; return nir_load_var(b, pos); } -- 2.30.2