glsl: initialize PSIZ variable to NULL when adding pointsize

The gl_nir_add_point_size() function now handles either shaders with
io_lowered set (no output variable will be created and store_output
intrinsic will be used) or with io_lowered cleared (an output variable
will be created for PSIZ).

However the nir_variable pointer for PSIZ variable is currently not
initialized at all, and a -Wmaybe-uninitialized warning may appear
complaining this.

As it shouldn't be used when it's allocated within the io_lowered
cleared situation, initialize it to NULL to satisfy the compiler.

Acked-by: Simon Perretta <simon.perretta@imgtec.com>
Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40560>
This commit is contained in:
Icenowy Zheng 2026-03-22 19:53:41 +08:00
parent dfbadedc02
commit daeb00df14

View file

@ -1192,7 +1192,7 @@ remove_dead_varyings_pre_linking(nir_shader *nir)
bool
gl_nir_add_point_size(nir_shader *nir)
{
nir_variable *psiz;
nir_variable *psiz = NULL;
if (!nir->info.io_lowered) {
psiz = nir_create_variable_with_location(nir, nir_var_shader_out,
VARYING_SLOT_PSIZ, glsl_float_type());