Permalink
Browse files

Workarounds for issue with "accurate depth". See #9545, #10087

  • Loading branch information...
hrydgard committed Nov 21, 2017
1 parent 090d1d1 commit 6a3d41892ab9fbb65e4f13a56cbd5436247160c7
@@ -55,6 +55,7 @@ void Compatibility::CheckSettings(IniFile &iniFile, const std::string &gameID) {
CheckSetting(iniFile, gameID, "RequireBufferedRendering", &flags_.RequireBufferedRendering);
CheckSetting(iniFile, gameID, "RequireBlockTransfer", &flags_.RequireBlockTransfer);
CheckSetting(iniFile, gameID, "DisableReadbacks", &flags_.DisableReadbacks);
CheckSetting(iniFile, gameID, "DisableAccurateDepth", &flags_.DisableAccurateDepth);
}
void Compatibility::CheckSetting(IniFile &iniFile, const std::string &gameID, const char *option, bool *flag) {
@@ -55,6 +55,7 @@ struct CompatFlags {
bool RequireBufferedRendering;
bool RequireBlockTransfer;
bool DisableReadbacks;
bool DisableAccurateDepth;
};
class IniFile;
@@ -696,7 +696,6 @@ void ConvertViewportAndScissor(bool useBufferedRendering, float renderWidth, flo
maxz += fullDepthRange;
}
}
// Okay. So, in our shader, -1 will map to minz, and +1 will map to maxz.
float halfActualZRange = (maxz - minz) * (1.0f / 2.0f);
float zScale = halfActualZRange < std::numeric_limits<float>::epsilon() ? 1.0f : vpZScale / halfActualZRange;
@@ -206,7 +206,9 @@ void GPU_D3D11::CheckGPUFeatures() {
features |= GPU_SUPPORTS_BLEND_MINMAX;
features |= GPU_PREFER_CPU_DOWNLOAD;
features |= GPU_SUPPORTS_ACCURATE_DEPTH; // Breaks text in PaRappa for some reason.
if (!PSP_CoreParameter().compat.flags().DisableAccurateDepth) {
features |= GPU_SUPPORTS_ACCURATE_DEPTH; // Breaks text in PaRappa for some reason.
}
#ifndef _M_ARM
// TODO: Do proper feature detection
@@ -187,7 +187,9 @@ void GPU_DX9::CheckGPUFeatures() {
features |= GPU_SUPPORTS_BLEND_MINMAX;
features |= GPU_SUPPORTS_TEXTURE_LOD_CONTROL;
features |= GPU_PREFER_CPU_DOWNLOAD;
features |= GPU_SUPPORTS_ACCURATE_DEPTH;
if (!PSP_CoreParameter().compat.flags().DisableAccurateDepth) {
features |= GPU_SUPPORTS_ACCURATE_DEPTH;
}
D3DCAPS9 caps;
ZeroMemory(&caps, sizeof(caps));
@@ -176,6 +176,22 @@ GPU_Vulkan::~GPU_Vulkan() {
void GPU_Vulkan::CheckGPUFeatures() {
uint32_t features = 0;
// Mandatory features on Vulkan, which may be checked in "centralized" code
if (!PSP_CoreParameter().compat.flags().DisableAccurateDepth) {
features |= GPU_SUPPORTS_ACCURATE_DEPTH;
}
features |= GPU_SUPPORTS_TEXTURE_LOD_CONTROL;
features |= GPU_SUPPORTS_FBO;
features |= GPU_SUPPORTS_BLEND_MINMAX;
features |= GPU_SUPPORTS_ANY_COPY_IMAGE;
features |= GPU_SUPPORTS_OES_TEXTURE_NPOT;
features |= GPU_SUPPORTS_LARGE_VIEWPORTS;
features |= GPU_SUPPORTS_16BIT_FORMATS;
features |= GPU_SUPPORTS_INSTANCE_RENDERING;
features |= GPU_SUPPORTS_VERTEX_TEXTURE_FETCH;
features |= GPU_SUPPORTS_TEXTURE_FLOAT;
if (vulkan_->GetFeaturesEnabled().wideLines) {
features |= GPU_SUPPORTS_WIDE_LINES;
}
@@ -220,19 +236,6 @@ void GPU_Vulkan::CheckGPUFeatures() {
else if (PSP_CoreParameter().compat.flags().VertexDepthRounding) {
features |= GPU_ROUND_DEPTH_TO_16BIT;
}
// Mandatory features on Vulkan, which may be checked in "centralized" code
features |= GPU_SUPPORTS_ACCURATE_DEPTH;
features |= GPU_SUPPORTS_TEXTURE_LOD_CONTROL;
features |= GPU_SUPPORTS_FBO;
features |= GPU_SUPPORTS_BLEND_MINMAX;
features |= GPU_SUPPORTS_ANY_COPY_IMAGE;
features |= GPU_SUPPORTS_OES_TEXTURE_NPOT;
features |= GPU_SUPPORTS_LARGE_VIEWPORTS;
features |= GPU_SUPPORTS_16BIT_FORMATS;
features |= GPU_SUPPORTS_INSTANCE_RENDERING;
features |= GPU_SUPPORTS_VERTEX_TEXTURE_FETCH;
features |= GPU_SUPPORTS_TEXTURE_FLOAT;
gstate_c.featureFlags = features;
}
@@ -285,3 +285,19 @@ ULJS00394 = true
ULJS19068 = true
NPJH50518 = true
# TODO: Will add some games in the future
[DisableAccurateDepth]
# Midnight Club: LA Remix
ULUS10383 = true
ULES01144 = true
ULJS00180 = true
ULJS00267 = true
ULJM05904 = true
NPJH50440 = true
# Midnight Club 3 : DUB edition
ULUS10021 = true
ULES00108 = true
# Shadow of Destiny (#9545)
ULUS10459 = true
NPJH50036 = true

0 comments on commit 6a3d418

Please sign in to comment.