GPU/HW: Don't generate always/never-discarding discard shaders

Might fix the PowerVR driver...
This commit is contained in:
Connor McLaughlin 2021-05-25 13:38:31 +10:00
parent 0979149236
commit 08876d132f
3 changed files with 17 additions and 5 deletions

View File

@ -253,9 +253,9 @@ protected:
/// on a per-pixel basis, and the opaque pixels shouldn't be blended at all.
bool NeedsTwoPassRendering() const
{
return (m_batch.transparency_mode == GPUTransparencyMode::BackgroundMinusForeground &&
m_batch.texture_mode != GPUTextureMode::Disabled) ||
(m_batch.transparency_mode != GPUTransparencyMode::Disabled && !m_supports_dual_source_blend);
return (m_batch.texture_mode != GPUTextureMode::Disabled &&
(m_batch.transparency_mode == GPUTransparencyMode::BackgroundMinusForeground ||
(!m_supports_dual_source_blend && m_batch.transparency_mode != GPUTransparencyMode::Disabled)));
}
ALWAYS_INLINE bool IsUsingSoftwareRendererForReadbacks() { return static_cast<bool>(m_sw_renderer); }

View File

@ -927,7 +927,7 @@ float4 SampleFromVRAM(uint4 texpage, float2 coords)
color = (float3(icolor) * premultiply_alpha) / float3(255.0, 255.0, 255.0);
#endif
#if TRANSPARENCY
#if TRANSPARENCY && TEXTURED
// Apply semitransparency. If not a semitransparent texel, destination alpha is ignored.
if (semitransparent)
{
@ -963,6 +963,18 @@ float4 SampleFromVRAM(uint4 texpage, float2 coords)
discard;
#endif
}
#elif TRANSPARENCY
// We shouldn't be rendering opaque geometry only when untextured, so no need to test/discard here.
#if USE_DUAL_SOURCE
o_col0 = float4(color, oalpha);
o_col1 = float4(0.0, 0.0, 0.0, u_dst_alpha_factor / ialpha);
#else
o_col0 = float4(color, oalpha);
#endif
#if !PGXP_DEPTH
o_depth = oalpha * v_pos.z;
#endif
#else
// Non-transparency won't enable blending so we can write the mask here regardless.
o_col0 = float4(color, oalpha);

View File

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