From b19f1dc7d66d1e7eb02d2ac6ce7f0579bab51d84 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 6 Feb 2021 04:23:55 +0100 Subject: [PATCH] compiler/nir: Increment shader input count and mark as used when adding new gl_PointCoord In case a new gl_PointCoord shader input is created, increment shader input count and set valid driver_location to the new input variable, otherwise the input gets aliased to input 0 and shows up in NIR_PRINT output as whatever shader input 0 is instead of gl_PointCoord. Also set the input as used, otherwise it might get removed. Signed-off-by: Marek Vasut Reviewed-by: Eric Anholt Part-of: --- src/compiler/nir/nir_lower_texcoord_replace.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/compiler/nir/nir_lower_texcoord_replace.c b/src/compiler/nir/nir_lower_texcoord_replace.c index 2a1a8295b65..fd3a0859a46 100644 --- a/src/compiler/nir/nir_lower_texcoord_replace.c +++ b/src/compiler/nir/nir_lower_texcoord_replace.c @@ -81,6 +81,8 @@ nir_lower_texcoord_replace_impl(nir_function_impl *impl, pntc = nir_variable_create(b.shader, nir_var_shader_in, glsl_vec_type(2), "gl_PointCoord"); pntc->data.location = VARYING_SLOT_PNTC; + pntc->data.driver_location = b.shader->num_inputs++; + b.shader->info.inputs_read |= BITFIELD64_BIT(VARYING_SLOT_PNTC); } new_coord = nir_load_var(&b, pntc);