diff --git a/src/graphics/host_gpu/renderer/pipeline/shaders.cpp b/src/graphics/host_gpu/renderer/pipeline/shaders.cpp index 1d1cd32f8..d21fc014b 100644 --- a/src/graphics/host_gpu/renderer/pipeline/shaders.cpp +++ b/src/graphics/host_gpu/renderer/pipeline/shaders.cpp @@ -368,6 +368,8 @@ void CreatePipelineInternal(GraphicContext& graphics, PipelineCache::Pipeline& p // MoltenVK lacks VK_EXT_depth_clip_enable; omit the depth-clip struct on macOS and accept // Vulkan's default depth clipping (enabled) instead of the PS5's clamp behavior. #if !defined(__APPLE__) + // The DB clamps depth to the viewport range after polygon offset is applied. + rasterizer.depthClampEnable = VK_TRUE; rasterizer.pNext = &clip_ext; #endif vk::PipelineRasterizationProvokingVertexStateCreateInfoEXT provoking_vertex {}; diff --git a/src/graphics/presentation/window/vulkanWindow.cpp b/src/graphics/presentation/window/vulkanWindow.cpp index 9cbcb09d4..386828090 100644 --- a/src/graphics/presentation/window/vulkanWindow.cpp +++ b/src/graphics/presentation/window/vulkanWindow.cpp @@ -238,6 +238,10 @@ static void VulkanFindPhysicalDevice(vk::Instance instance, vk::SurfaceKHR surfa #endif } #if !defined(__APPLE__) + if (device_features2.features.depthClamp != VK_TRUE) { + LOGF("depthClamp is not supported\n"); + skip_device = true; + } if (fragment_barycentric.fragmentShaderBarycentric != VK_TRUE) { LOGF("fragmentShaderBarycentric is not supported\n"); skip_device = true; @@ -607,6 +611,7 @@ static vk::Device VulkanCreateDevice(GraphicContext& graphics, device_features.robustBufferAccess = VK_TRUE; #if !defined(__APPLE__) device_features.depthBounds = VK_TRUE; // unsupported by MoltenVK + device_features.depthClamp = VK_TRUE; #endif device_features.shaderStorageImageWriteWithoutFormat = VK_TRUE; device_features.shaderImageGatherExtended = VK_TRUE;