nir/nir_lower_is_helper_invocation: Lower helper invocation if required
authorDanylo Piliaiev <dpiliaiev@igalia.com>
Tue, 29 Nov 2022 11:41:08 +0000 (12:41 +0100)
committerMarge Bot <emma+marge@anholt.net>
Tue, 20 Dec 2022 11:06:52 +0000 (11:06 +0000)
commit8482ad01102a3c15d60549229109b1b97b1c34e4
tree5f9a3a7ced29452e80423007b71b164d8bdb7308
parentad9c0e8cd9a95862b555615159b8a261036a7324
nir/nir_lower_is_helper_invocation: Lower helper invocation if required

nir_lower_is_helper_invocation lowers intrinsic_is_helper_invocation
and uses load_helper_invocation (which is lowered by nir_lower_system_values).
While nir_lower_system_values may lower SYSTEM_VALUE_HELPER_INVOCATION
into intrinsic_is_helper_invocation.

So they depend on each other. Break the dependency by making
nir_lower_is_helper_invocation aware of lower_helper_invocation option
and emitting lowered load_helper_invocation when required.

Happens with SPIR-V 1.6 for which gl_HelperInvocation is translated into
"BuiltIn HelperInvocation" + "Volatile", which nir_lower_system_values
translates into is_helper_invocation.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19677>
src/compiler/nir/nir.h
src/compiler/nir/nir_lower_is_helper_invocation.c
src/compiler/nir/nir_lower_system_values.c