GPU/ShaderGen: Move discard to end of shader

Possible workaround for this PowerVR driver issue.
This commit is contained in:
Connor McLaughlin 2021-04-08 03:05:08 +10:00
parent 19ca102b40
commit 22d664b210
2 changed files with 9 additions and 9 deletions

View file

@ -931,10 +931,6 @@ float4 SampleFromVRAM(uint4 texpage, float2 coords)
// Apply semitransparency. If not a semitransparent texel, destination alpha is ignored.
if (semitransparent)
{
#if TRANSPARENCY_ONLY_OPAQUE
discard;
#endif
#if USE_DUAL_SOURCE
o_col0 = float4(color, oalpha);
o_col1 = float4(0.0, 0.0, 0.0, u_dst_alpha_factor / ialpha);
@ -945,13 +941,13 @@ float4 SampleFromVRAM(uint4 texpage, float2 coords)
#if !PGXP_DEPTH
o_depth = oalpha * v_pos.z;
#endif
#if TRANSPARENCY_ONLY_OPAQUE
discard;
#endif
}
else
{
#if TRANSPARENCY_ONLY_TRANSPARENT
discard;
#endif
#if USE_DUAL_SOURCE
o_col0 = float4(color, oalpha);
o_col1 = float4(0.0, 0.0, 0.0, 1.0 - ialpha);
@ -962,6 +958,10 @@ float4 SampleFromVRAM(uint4 texpage, float2 coords)
#if !PGXP_DEPTH
o_depth = oalpha * v_pos.z;
#endif
#if TRANSPARENCY_ONLY_TRANSPARENT
discard;
#endif
}
#else
// Non-transparency won't enable blending so we can write the mask here regardless.

View file

@ -1,4 +1,4 @@
#pragma once
#include "types.h"
static constexpr u32 SHADER_CACHE_VERSION = 3;
static constexpr u32 SHADER_CACHE_VERSION = 4;