Implement depth-clip-control without VK_EXT_depth_clip_enable
In Vulkan, unclippedDepth is currently implemented as depthClamp=true,
depthClipEnable=false. However, depthClamp=true will implicitly
disable depth clipping if no
VkPipelineRasterizationDepthClipStateCreateInfoEXT is specified. This
allows us to support depth-clip-control on devices without
VK_EXT_depth_clip_enable.
Change-Id: I27c81da34dc3c72e31118cd858f92d9fdfae83e9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132620
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/src/dawn/native/vulkan/DeviceVk.cpp b/src/dawn/native/vulkan/DeviceVk.cpp
index 8ecf450..dfd59c3 100644
--- a/src/dawn/native/vulkan/DeviceVk.cpp
+++ b/src/dawn/native/vulkan/DeviceVk.cpp
@@ -503,14 +503,7 @@
}
if (HasFeature(Feature::DepthClipControl)) {
- const VulkanDeviceInfo& deviceInfo = ToBackend(GetPhysicalDevice())->GetDeviceInfo();
- ASSERT(deviceInfo.HasExt(DeviceExt::DepthClipEnable) &&
- deviceInfo.depthClipEnableFeatures.depthClipEnable == VK_TRUE);
-
usedKnobs.features.depthClamp = VK_TRUE;
- usedKnobs.depthClipEnableFeatures.depthClipEnable = VK_TRUE;
- featuresChain.Add(&usedKnobs.depthClipEnableFeatures,
- VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT);
}
// TODO(dawn:1510, tint:1473): After implementing a transform to handle the pipeline input /
diff --git a/src/dawn/native/vulkan/PhysicalDeviceVk.cpp b/src/dawn/native/vulkan/PhysicalDeviceVk.cpp
index b72ffbf..e4a2307 100644
--- a/src/dawn/native/vulkan/PhysicalDeviceVk.cpp
+++ b/src/dawn/native/vulkan/PhysicalDeviceVk.cpp
@@ -233,10 +233,8 @@
EnableFeature(Feature::ChromiumExperimentalDp4a);
}
- // unclippedDepth=true translates to depthClipEnable=false, depthClamp=true
- if (mDeviceInfo.features.depthClamp == VK_TRUE &&
- mDeviceInfo.HasExt(DeviceExt::DepthClipEnable) &&
- mDeviceInfo.depthClipEnableFeatures.depthClipEnable == VK_TRUE) {
+ // unclippedDepth=true translates to depthClamp=true, which implicitly disables clipping.
+ if (mDeviceInfo.features.depthClamp == VK_TRUE) {
EnableFeature(Feature::DepthClipControl);
}
diff --git a/src/dawn/native/vulkan/RenderPipelineVk.cpp b/src/dawn/native/vulkan/RenderPipelineVk.cpp
index 5595bf0..181123c 100644
--- a/src/dawn/native/vulkan/RenderPipelineVk.cpp
+++ b/src/dawn/native/vulkan/RenderPipelineVk.cpp
@@ -426,18 +426,6 @@
rasterization.depthBiasSlopeFactor = GetDepthBiasSlopeScale();
rasterization.lineWidth = 1.0f;
- PNextChainBuilder rasterizationChain(&rasterization);
- VkPipelineRasterizationDepthClipStateCreateInfoEXT depthClipState;
- if (HasUnclippedDepth()) {
- ASSERT(device->HasFeature(Feature::DepthClipControl));
- depthClipState.pNext = nullptr;
- depthClipState.depthClipEnable = VK_FALSE;
- depthClipState.flags = 0;
- rasterizationChain.Add(
- &depthClipState,
- VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_DEPTH_CLIP_STATE_CREATE_INFO_EXT);
- }
-
VkPipelineMultisampleStateCreateInfo multisample;
multisample.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
multisample.pNext = nullptr;