nir/opt_uniform_subgroup: fix ballot_bit_count components

ballot_bit_count_reduce expects the ballot to have 4 components causing
validation failures on targets where 1 < ballot_components < 4. Fix this
by padding the ballot to 4 components.

Signed-off-by: Job Noorman <jnoorman@igalia.com>
Fixes: ae66bd1c00 ("nir/opt_uniform_subgroup: use ballot_bit_count")
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
(cherry picked from commit cc6eec79c2)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
This commit is contained in:
Job Noorman 2026-04-04 10:06:18 +02:00 committed by Eric Engestrom
parent fc45812f74
commit 28a32fe54b
2 changed files with 2 additions and 2 deletions

View file

@ -4364,7 +4364,7 @@
"description": "nir/opt_uniform_subgroup: fix ballot_bit_count components",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "ae66bd1c007af48f609147979cef550d04be05ed",
"notes": null

View file

@ -107,7 +107,7 @@ ballot_bit_count(nir_builder *b, nir_def *ballot)
{
return ballot->num_components == 1
? nir_bit_count(b, ballot)
: nir_ballot_bit_count_reduce(b, ballot);
: nir_ballot_bit_count_reduce(b, nir_pad_vec4(b, ballot));
}
static nir_def *