If there are no helper invocations required during the
execution of the shader, we can assume that there also
are no helper invocations active.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9058>
intrin->intrinsic = nir_intrinsic_discard_if;
return true;
case nir_intrinsic_is_helper_invocation:
- intrin->intrinsic = nir_intrinsic_load_helper_invocation;
+ case nir_intrinsic_load_helper_invocation: {
+ /* If the shader doesn't need helper invocations,
+ * we can assume there are none */
+ b->cursor = nir_before_instr(instr);
+ nir_ssa_def *zero = nir_imm_false(b);
+ nir_ssa_def_rewrite_uses_ssa(&intrin->dest.ssa, zero);
+ nir_instr_remove_v(instr);
return true;
+ }
default:
return false;
}