Skip to content

nir: remove nir_intrinsic_discard

After !27487 (closed) my second attempt on letting discard go for good.

    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.

I added nir_discard() builder functions so that it still works as before and emits whatever the drivers prefer.

Merge request reports