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 <marex@denx.de>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9214>
This commit is contained in:
Marek Vasut 2021-02-06 04:23:55 +01:00 committed by Marge Bot
parent 8027a7ba8a
commit b19f1dc7d6

View file

@ -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);