mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-01-31 01:15:24 +01:00
GS/DX11: Check if conservative depth is supported.
Fixes dx10 gpus being broken without conservative depth.
This commit is contained in:
@@ -139,8 +139,12 @@ struct PS_OUTPUT
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#if PS_ZCLAMP || PS_ZFLOOR
|
||||
#if (PS_ZFLOOR || PS_ZCLAMP)
|
||||
#if PS_HAS_CONSERVATIVE_DEPTH
|
||||
float depth : SV_DepthLessEqual;
|
||||
#else
|
||||
float depth : SV_Depth;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ layout(binding = 3) uniform sampler2D img_prim_min;
|
||||
//layout(pixel_center_integer) in vec4 gl_FragCoord;
|
||||
#endif
|
||||
|
||||
#if (PS_ZFLOOR || PS_ZCLAMP) && HAS_CONSERVATIVE_DEPTH
|
||||
#if (PS_ZFLOOR || PS_ZCLAMP) && PS_HAS_CONSERVATIVE_DEPTH
|
||||
layout(depth_less) out float gl_FragDepth;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -599,6 +599,8 @@ void GSDevice11::SetFeatures(IDXGIAdapter1* adapter)
|
||||
m_max_texture_size = (m_feature_level >= D3D_FEATURE_LEVEL_11_0) ?
|
||||
D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION :
|
||||
D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION;
|
||||
|
||||
m_conservative_depth = (m_feature_level >= D3D_FEATURE_LEVEL_11_0);
|
||||
}
|
||||
|
||||
bool GSDevice11::HasSurface() const
|
||||
@@ -1721,6 +1723,7 @@ void GSDevice11::SetupPS(const PSSelector& sel, const GSHWDrawConfig::PSConstant
|
||||
ShaderMacro sm;
|
||||
|
||||
sm.AddMacro("PIXEL_SHADER", 1);
|
||||
sm.AddMacro("PS_HAS_CONSERVATIVE_DEPTH", m_conservative_depth);
|
||||
sm.AddMacro("PS_FST", sel.fst);
|
||||
sm.AddMacro("PS_WMS", sel.wms);
|
||||
sm.AddMacro("PS_WMT", sel.wmt);
|
||||
|
||||
@@ -136,6 +136,7 @@ private:
|
||||
bool m_using_flip_model_swap_chain = true;
|
||||
bool m_using_allow_tearing = false;
|
||||
bool m_is_exclusive_fullscreen = false;
|
||||
bool m_conservative_depth = false;
|
||||
|
||||
struct
|
||||
{
|
||||
|
||||
@@ -3048,6 +3048,7 @@ const ID3DBlob* GSDevice12::GetTFXPixelShader(const GSHWDrawConfig::PSSelector&
|
||||
|
||||
ShaderMacro sm;
|
||||
sm.AddMacro("PIXEL_SHADER", 1);
|
||||
sm.AddMacro("PS_HAS_CONSERVATIVE_DEPTH", 1);
|
||||
sm.AddMacro("PS_FST", sel.fst);
|
||||
sm.AddMacro("PS_WMS", sel.wms);
|
||||
sm.AddMacro("PS_WMT", sel.wmt);
|
||||
|
||||
@@ -1301,11 +1301,11 @@ std::string GSDeviceOGL::GenGlslHeader(const std::string_view entry, GLenum type
|
||||
if (GLAD_GL_ARB_conservative_depth)
|
||||
{
|
||||
header += "#extension GL_ARB_conservative_depth : enable\n";
|
||||
header += "#define HAS_CONSERVATIVE_DEPTH 1\n";
|
||||
header += "#define PS_HAS_CONSERVATIVE_DEPTH 1\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
header += "#define HAS_CONSERVATIVE_DEPTH 0\n";
|
||||
header += "#define PS_HAS_CONSERVATIVE_DEPTH 0\n";
|
||||
}
|
||||
|
||||
// Allow to puts several shader in 1 files
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
/// Version number for GS and other shaders. Increment whenever any of the contents of the
|
||||
/// shaders change, to invalidate the cache.
|
||||
static constexpr u32 SHADER_CACHE_VERSION = 81;
|
||||
static constexpr u32 SHADER_CACHE_VERSION = 82;
|
||||
|
||||
Reference in New Issue
Block a user