Skip to content

Commit

Permalink
Merge pull request #11848 from hrydgard/disable-range-culling-depthra…
Browse files Browse the repository at this point in the history
…nge-hack

Disable vertex range culling when the depthrange hack is enabled.
  • Loading branch information
hrydgard authored Feb 26, 2019
2 parents 593c313 + 8e7da3f commit b689c68
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 16 deletions.
4 changes: 3 additions & 1 deletion GPU/D3D11/GPU_D3D11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
28 changes: 15 additions & 13 deletions GPU/Directx9/GPU_DX9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion GPU/GLES/GPU_GLES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion GPU/Vulkan/GPU_Vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit b689c68

Please sign in to comment.