Skip to content

Commit

Permalink
Disable vertex range culling when the depthrange hack is enabled. Tem…
Browse files Browse the repository at this point in the history
…porary workaround for #11576.
  • Loading branch information
hrydgard committed Feb 26, 2019
1 parent 593c313 commit 8e7da3f
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

2 comments on commit 8e7da3f

@unknownbrackets
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the depth range hack might just be a hack around not having accurate depth... not sure but accurate depth + range cull might work better?

-[Unknown]

@hrydgard
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible. I'll put that on my list of things to investigate some day....

Please sign in to comment.