GPU: Split clip and cull caps.

GL_ARB_cull_distance is needed, sometimes available on older GL.
This commit is contained in:
Unknown W. Brackets 2021-09-19 07:14:54 -07:00
parent 1c7cd67f6d
commit 5e6f54033e
6 changed files with 10 additions and 6 deletions

View File

@ -246,7 +246,8 @@ D3D11DrawContext::D3D11DrawContext(ID3D11Device *device, ID3D11DeviceContext *de
caps_.dualSourceBlend = featureLevel_ >= D3D_FEATURE_LEVEL_10_0;
caps_.depthClampSupported = featureLevel_ >= D3D_FEATURE_LEVEL_10_0;
// SV_ClipDistance# seems to be 10+.
caps_.clipCullDistanceSupported = featureLevel_ >= D3D_FEATURE_LEVEL_10_0;
caps_.clipDistanceSupported = featureLevel_ >= D3D_FEATURE_LEVEL_10_0;
caps_.cullDistanceSupported = featureLevel_ >= D3D_FEATURE_LEVEL_10_0;
caps_.depthRangeMinusOneToOne = false;
caps_.framebufferBlitSupported = false;

View File

@ -534,7 +534,8 @@ OpenGLContext::OpenGLContext() {
caps_.framebufferBlitSupported = gl_extensions.NV_framebuffer_blit || gl_extensions.ARB_framebuffer_object;
caps_.framebufferDepthBlitSupported = caps_.framebufferBlitSupported;
caps_.depthClampSupported = gl_extensions.ARB_depth_clamp;
caps_.clipCullDistanceSupported = gl_extensions.EXT_clip_cull_distance || (!gl_extensions.IsGLES && gl_extensions.VersionGEThan(3, 0));
caps_.clipDistanceSupported = gl_extensions.EXT_clip_cull_distance || (!gl_extensions.IsGLES && gl_extensions.VersionGEThan(3, 0));
caps_.cullDistanceSupported = gl_extensions.EXT_clip_cull_distance || gl_extensions.ARB_cull_distance;
// Interesting potential hack for emulating GL_DEPTH_CLAMP (use a separate varying, force depth in fragment shader):
// This will induce a performance penalty on many architectures though so a blanket enable of this

View File

@ -780,7 +780,8 @@ VKContext::VKContext(VulkanContext *vulkan, bool splitSubmit)
caps_.multiViewport = vulkan->GetDeviceFeatures().enabled.multiViewport != 0;
caps_.dualSourceBlend = vulkan->GetDeviceFeatures().enabled.dualSrcBlend != 0;
caps_.depthClampSupported = vulkan->GetDeviceFeatures().enabled.depthClamp != 0;
caps_.clipCullDistanceSupported = vulkan->GetDeviceFeatures().enabled.shaderClipDistance != 0 && vulkan->GetDeviceFeatures().enabled.shaderCullDistance != 0;
caps_.clipDistanceSupported = vulkan->GetDeviceFeatures().enabled.shaderClipDistance != 0;
caps_.cullDistanceSupported = vulkan->GetDeviceFeatures().enabled.shaderCullDistance != 0;
caps_.framebufferBlitSupported = true;
caps_.framebufferCopySupported = true;
caps_.framebufferDepthBlitSupported = false; // Can be checked for.

View File

@ -520,7 +520,8 @@ struct DeviceCaps {
bool dualSourceBlend;
bool logicOpSupported;
bool depthClampSupported;
bool clipCullDistanceSupported;
bool clipDistanceSupported;
bool cullDistanceSupported;
bool framebufferCopySupported;
bool framebufferBlitSupported;
bool framebufferDepthCopySupported;

View File

@ -128,7 +128,7 @@ void GPU_D3D11::CheckGPUFeatures() {
features |= GPU_SUPPORTS_DUALSOURCE_BLEND;
if (draw_->GetDeviceCaps().depthClampSupported)
features |= GPU_SUPPORTS_DEPTH_CLAMP;
if (draw_->GetDeviceCaps().clipCullDistanceSupported)
if (draw_->GetDeviceCaps().clipDistanceSupported && draw_->GetDeviceCaps().cullDistanceSupported)
features |= GPU_SUPPORTS_CLIP_CULL_DISTANCE;
features |= GPU_SUPPORTS_COPY_IMAGE;
features |= GPU_SUPPORTS_TEXTURE_FLOAT;

View File

@ -228,7 +228,7 @@ void GPU_GLES::CheckGPUFeatures() {
if (gl_extensions.GLES3)
features |= GPU_SUPPORTS_DEPTH_TEXTURE;
}
if (draw_->GetDeviceCaps().clipCullDistanceSupported)
if (draw_->GetDeviceCaps().clipDistanceSupported && draw_->GetDeviceCaps().cullDistanceSupported)
features |= GPU_SUPPORTS_CLIP_CULL_DISTANCE;
// If we already have a 16-bit depth buffer, we don't need to round.