From 8e7da3fef44aee60e790850f275efb4e4e2b7505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 26 Feb 2019 16:07:11 +0100 Subject: [PATCH] Disable vertex range culling when the depthrange hack is enabled. Temporary workaround for #11576. --- GPU/D3D11/GPU_D3D11.cpp | 4 +++- GPU/Directx9/GPU_DX9.cpp | 28 +++++++++++++++------------- GPU/GLES/GPU_GLES.cpp | 4 +++- GPU/Vulkan/GPU_Vulkan.cpp | 4 +++- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/GPU/D3D11/GPU_D3D11.cpp b/GPU/D3D11/GPU_D3D11.cpp index e0ee48ef05..9f2c4474e9 100644 --- a/GPU/D3D11/GPU_D3D11.cpp +++ b/GPU/D3D11/GPU_D3D11.cpp @@ -127,7 +127,9 @@ GPU_D3D11::~GPU_D3D11() { void GPU_D3D11::CheckGPUFeatures() { u32 features = 0; - features |= GPU_SUPPORTS_VS_RANGE_CULLING; + if (!PSP_CoreParameter().compat.flags().DepthRangeHack) { + features |= GPU_SUPPORTS_VS_RANGE_CULLING; + } features |= GPU_SUPPORTS_BLEND_MINMAX; features |= GPU_PREFER_CPU_DOWNLOAD; diff --git a/GPU/Directx9/GPU_DX9.cpp b/GPU/Directx9/GPU_DX9.cpp index 62b3caf1c2..2a2d3ecda0 100644 --- a/GPU/Directx9/GPU_DX9.cpp +++ b/GPU/Directx9/GPU_DX9.cpp @@ -176,21 +176,23 @@ void GPU_DX9::CheckGPUFeatures() { features |= GPU_SUPPORTS_ACCURATE_DEPTH; } - // VS range culling (killing triangles in the vertex shader using NaN) causes problems on Intel. - // Also causes problems on old NVIDIA. - switch (vendor) { - case Draw::GPUVendor::VENDOR_INTEL: - break; - case Draw::GPUVendor::VENDOR_NVIDIA: - // Older NVIDIAs don't seem to like NaNs in their DX9 vertex shaders. - // No idea if KEPLER is the right cutoff, but let's go with it. - if (NVIDIAGetDeviceGeneration(draw_->GetDeviceCaps().deviceID) >= NV_KEPLER) { + if (!PSP_CoreParameter().compat.flags().DepthRangeHack) { + // VS range culling (killing triangles in the vertex shader using NaN) causes problems on Intel. + // Also causes problems on old NVIDIA. + switch (vendor) { + case Draw::GPUVendor::VENDOR_INTEL: + break; + case Draw::GPUVendor::VENDOR_NVIDIA: + // Older NVIDIAs don't seem to like NaNs in their DX9 vertex shaders. + // No idea if KEPLER is the right cutoff, but let's go with it. + if (NVIDIAGetDeviceGeneration(draw_->GetDeviceCaps().deviceID) >= NV_KEPLER) { + features |= GPU_SUPPORTS_VS_RANGE_CULLING; + } + break; + default: features |= GPU_SUPPORTS_VS_RANGE_CULLING; + break; } - break; - default: - features |= GPU_SUPPORTS_VS_RANGE_CULLING; - break; } D3DCAPS9 caps; diff --git a/GPU/GLES/GPU_GLES.cpp b/GPU/GLES/GPU_GLES.cpp index bb54322f7f..967aaf6709 100644 --- a/GPU/GLES/GPU_GLES.cpp +++ b/GPU/GLES/GPU_GLES.cpp @@ -149,7 +149,9 @@ void GPU_GLES::CheckGPUFeatures() { features |= GPU_SUPPORTS_16BIT_FORMATS; if (!draw_->GetBugs().Has(Draw::Bugs::BROKEN_NAN_IN_CONDITIONAL)) { - features |= GPU_SUPPORTS_VS_RANGE_CULLING; + if (!PSP_CoreParameter().compat.flags().DepthRangeHack) { + features |= GPU_SUPPORTS_VS_RANGE_CULLING; + } } if (gl_extensions.ARB_blend_func_extended || gl_extensions.EXT_blend_func_extended) { diff --git a/GPU/Vulkan/GPU_Vulkan.cpp b/GPU/Vulkan/GPU_Vulkan.cpp index 954bfb2bde..ca9f0d273b 100644 --- a/GPU/Vulkan/GPU_Vulkan.cpp +++ b/GPU/Vulkan/GPU_Vulkan.cpp @@ -181,7 +181,9 @@ GPU_Vulkan::~GPU_Vulkan() { void GPU_Vulkan::CheckGPUFeatures() { uint32_t features = 0; - features |= GPU_SUPPORTS_VS_RANGE_CULLING; + if (!PSP_CoreParameter().compat.flags().DepthRangeHack) { + features |= GPU_SUPPORTS_VS_RANGE_CULLING; + } switch (vulkan_->GetPhysicalDeviceProperties().properties.vendorID) { case VULKAN_VENDOR_AMD: