lower discard to demote to work around game bugs

This series implements a generic workaround for the driconf option "glsl_correct_derivatives_after_discard" by lowering discard() to demote() in a new NIR pass.

For RADV and radeonSI, demote_to_helper and is_helper_invocation are implemented by keeping track of demoted lanes in a temporary variable until LLVM provides an intrinsic for it.

This fixes corruption in No Man's Sky.

Merge request reports