[RADV] vkCmdClearAttachments does not clear depth when Hierarchical Z-Buffers is enabled
This bug was found in the OpenXR conformance tests and can be reproduced with this minimal Vulkan example. You can find a build system for this minimal example in it's repository.
System
linux 5.7.9
mesa 20.1.3
vulkan 1.2.147
Affected hardware and behavior on other drivers
The bug is reproducible on Radeon Vega integrated, Vega 64 and Navi 10. It also occurs on amdvlk, but not on mesa Intel and NVIDIA's Vulkan implementation.
Workarounds
Disabling HiZ with RADV_DEBUG=nohiz
fixes the issue.
Disabling the depth test on the pipeline with depthTestEnable = VK_FALSE
on VkPipelineDepthStencilStateCreateInfo
also avoids the issue.
Screenshots
Correct rendering:
Looking at the depth buffer in renderdoc shows corruption.
In the example the cubes are invisible when the bug occurs. Setting the depthCompareOp
to VK_COMPARE_OP_LESS_OR_EQUAL
will result in a dotted rendering.