zink, drirc: Add Borderlands 2 workaround to fix spir-v 1.6 translated discard

The game expects HLSL discard behavour

But it fails only on Zink because GLSL discard translates to
nir_intrinsic_discard (BRW_PREDICATE_ALIGN1_ANY4H in native Intel asm)
but Zink replaces it with OpTerminateInvocation SPIR-V and it translates to
nir_intrinsic_terminate (BRW_PREDICATE_NORMAL in native Intel asm)

Bisected commit in ZINK: bd816084

On AMD it works because they enabled the
glsl_correct_derivatives_after_discard by default: !10522 (17861aff)

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9205
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Illia Polishchuk <illia.a.polishchuk@globallogic.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23694>
This commit is contained in:
Illia Polishchuk 2023-06-16 15:53:36 +03:00 committed by Marge Bot
parent 1dade03b1f
commit a2d40c09b7

View file

@ -1006,6 +1006,11 @@ TODO: document the other workarounds.
<option name="mesa_glthread_app_profile" value="0"/>
</application>
<application name="Borderlands 2 (Native, OpenGL, 32bit)" executable="Borderlands2">
<!-- https://gitlab.freedesktop.org/mesa/mesa/-/issues/9205 -->
<option name="glsl_correct_derivatives_after_discard" value="true" />
</application>
<!-- GL_POINT_SMOOTH is used in Quake II to render particles -->
<application name="Quake II" executable="quake2-engine">
<option name="zink_emulate_point_smooth" value="true"/>