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>
This commit is contained in:
parent
9ae8ed2f62
commit
e5d1a8494d
|
@ -503,14 +503,7 @@ ResultOrError<VulkanDeviceKnobs> Device::CreateDevice(VkPhysicalDevice vkPhysica
|
|||
}
|
||||
|
||||
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 /
|
||||
|
|
|
@ -233,10 +233,8 @@ void PhysicalDevice::InitializeSupportedFeaturesImpl() {
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -426,18 +426,6 @@ MaybeError RenderPipeline::Initialize() {
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue