Fix a bug for depth test on Vulkan backend

The default value for maxDepthBound should be 1.0.

BUG=dawn:81

Change-Id: I337aac884456c739222bc31f8003267aa6de96af
Reviewed-on: https://dawn-review.googlesource.com/c/3580
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
This commit is contained in:
Yunchao He 2019-01-03 09:00:34 +00:00 committed by Commit Bot service account
parent d238bb67a5
commit 2b9d702c09
1 changed files with 6 additions and 2 deletions

View File

@ -74,12 +74,16 @@ namespace dawn_native { namespace vulkan {
mCreateInfo.flags = 0;
const auto& depth = GetDepth();
mCreateInfo.depthTestEnable = VK_TRUE;
// Depth writes only occur if depth is enabled
mCreateInfo.depthTestEnable =
(depth.compareFunction == dawn::CompareFunction::Always && !depth.depthWriteEnabled)
? VK_FALSE
: VK_TRUE;
mCreateInfo.depthWriteEnable = depth.depthWriteEnabled ? VK_TRUE : VK_FALSE;
mCreateInfo.depthCompareOp = VulkanCompareOp(depth.compareFunction);
mCreateInfo.depthBoundsTestEnable = false;
mCreateInfo.minDepthBounds = 0.0f;
mCreateInfo.maxDepthBounds = 0.0f;
mCreateInfo.maxDepthBounds = 1.0f;
const auto& stencil = GetStencil();
mCreateInfo.stencilTestEnable = StencilTestEnabled() ? VK_TRUE : VK_FALSE;