Vulkan: Support extension "depth_clamp"

This patch implements the extension "depth_clamp" on Vulkan, which
we need to test if we can correctly record "PrimitiveDepthClampingState"
in FlatRenderPipelineDescriptor - Currently FlatRenderPipelineDescriptor
fails to record this because we incorrectly ignore all the members in
"nextInChain".

BUG=dawn:529, dawn:716
TEST=dawn_end2end_tests

Change-Id: Iec407245a3f37d10a3d1428b0612f0e18e80c616
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63820
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
Jiawei Shao 2021-09-10 01:33:41 +00:00 committed by Dawn LUCI CQ
parent 6e1f01f32b
commit 6fa50b5e6c
3 changed files with 10 additions and 1 deletions

View File

@ -278,6 +278,10 @@ namespace dawn_native { namespace vulkan {
mSupportedExtensions.EnableExtension(Extension::PipelineStatisticsQuery); mSupportedExtensions.EnableExtension(Extension::PipelineStatisticsQuery);
} }
if (mDeviceInfo.features.depthClamp == VK_TRUE) {
mSupportedExtensions.EnableExtension(Extension::DepthClamping);
}
if (mDeviceInfo.properties.limits.timestampComputeAndGraphics == VK_TRUE) { if (mDeviceInfo.properties.limits.timestampComputeAndGraphics == VK_TRUE) {
mSupportedExtensions.EnableExtension(Extension::TimestampQuery); mSupportedExtensions.EnableExtension(Extension::TimestampQuery);
} }

View File

@ -387,6 +387,11 @@ namespace dawn_native { namespace vulkan {
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES); VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES);
} }
if (IsExtensionEnabled(Extension::DepthClamping)) {
ASSERT(ToBackend(GetAdapter())->GetDeviceInfo().features.depthClamp == VK_TRUE);
usedKnobs.features.depthClamp = VK_TRUE;
}
// Find a universal queue family // Find a universal queue family
{ {
// Note that GRAPHICS and COMPUTE imply TRANSFER so we don't need to check for it. // Note that GRAPHICS and COMPUTE imply TRANSFER so we don't need to check for it.

View File

@ -395,7 +395,7 @@ namespace dawn_native { namespace vulkan {
rasterization.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; rasterization.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
rasterization.pNext = nullptr; rasterization.pNext = nullptr;
rasterization.flags = 0; rasterization.flags = 0;
rasterization.depthClampEnable = VK_FALSE; rasterization.depthClampEnable = ShouldClampDepth() ? VK_TRUE : VK_FALSE;
rasterization.rasterizerDiscardEnable = VK_FALSE; rasterization.rasterizerDiscardEnable = VK_FALSE;
rasterization.polygonMode = VK_POLYGON_MODE_FILL; rasterization.polygonMode = VK_POLYGON_MODE_FILL;
rasterization.cullMode = VulkanCullMode(GetCullMode()); rasterization.cullMode = VulkanCullMode(GetCullMode());