nir: remove nir_intrinsic_discard

The semantics of discard differ between GLSL and HLSL and
their various implementations. Subsequently, numerous application
bugs occurred and SPV_EXT_demote_to_helper_invocation was written
in order to clarify the behavior. In NIR, we now have 3 different
intrinsics for 2 things, and while demote and terminate have clear
semantics, discard still doesn't and can mean either of the two.

This patch entirely removes nir_intrinsic_discard and
nir_intrinsic_discard_if and replaces all occurences either with
nir_intrinsic_terminate{_if} or nir_intrinsic_demote{_if} in the
case that the NIR option 'discard_is_demote' is being set.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27617>
This commit is contained in:
Daniel Schürmann
2024-02-14 15:32:31 +01:00
committed by Marge Bot
parent 4a84725ebb
commit 9b1a748b5e
42 changed files with 77 additions and 316 deletions

View File

@@ -2558,11 +2558,11 @@ ntt_emit_intrinsic(struct ntt_compile *c, nir_intrinsic_instr *instr)
ntt_DEMOTE(c);
break;
case nir_intrinsic_discard:
case nir_intrinsic_terminate:
ntt_KILL(c);
break;
case nir_intrinsic_discard_if: {
case nir_intrinsic_terminate_if: {
struct ureg_src cond = ureg_scalar(ntt_get_src(c, instr->src[0]), 0);
if (c->native_integers) {