diff --git a/src/compiler/nir/nir_lower_system_values.c b/src/compiler/nir/nir_lower_system_values.c index a78b5e6c954..5fdf0587d8e 100644 --- a/src/compiler/nir/nir_lower_system_values.c +++ b/src/compiler/nir/nir_lower_system_values.c @@ -197,6 +197,16 @@ lower_system_value_instr(nir_builder *b, nir_instr *instr, void *_state) return nir_load_barycentric(b, nir_intrinsic_load_barycentric_model, INTERP_MODE_NONE); + case SYSTEM_VALUE_HELPER_INVOCATION: { + /* When demote operation is used, reading the HelperInvocation + * needs to use Volatile memory access semantics to provide the + * correct (dynamic) value. See OpDemoteToHelperInvocation. + */ + if (nir_intrinsic_access(intrin) & ACCESS_VOLATILE) + return nir_is_helper_invocation(b, 1); + break; + } + default: break; }