ac/nir/cull: do not reuse variables if subgroup ops are used

Subgroup ops make divergence information useless for our purpose,
we would need workgroup divergence.

The game affected here has control flow dependent on vote_any,
so it's possible that a wave only executes the code after culling/reordering
invocations.
That means we can't reuse the maybe undefined value from before culling.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14459
Cc: mesa-stable
(cherry picked from commit cbedced5e8)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39117>
This commit is contained in:
Georg Lehmann 2025-12-19 19:17:01 +01:00 committed by Dylan Baker
parent bca2cddaf8
commit daa2b253f4
2 changed files with 7 additions and 1 deletions

View file

@ -244,7 +244,7 @@
"description": "ac/nir/cull: do not reuse variables if subgroup ops are used",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -752,6 +752,12 @@ save_reusable_variables(nir_builder *b, lower_ngg_nogs_state *s)
ASSERTED int vec_ok = u_vector_init(&s->reusable_nondeferred_variables, 4, sizeof(reusable_nondeferred_variable));
assert(vec_ok);
/* Subgroup ops make divergence information useless for our purpose,
* we would need workgroup divergence.
*/
if (b->shader->info.uses_wide_subgroup_intrinsics)
return;
/* Upper limit on reusable uniforms in order to reduce SGPR spilling. */
unsigned remaining_reusable_uniforms = 48;