panvk: Only write depth when depth test enabled

Fixes dEQP-VK.pipeline.depth.format.*_test_disabled.depth_write_enabled

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16283>
This commit is contained in:
Alyssa Rosenzweig 2022-04-27 19:14:37 -04:00 committed by Marge Bot
parent 46778f2b2a
commit 631f47e83a
2 changed files with 14 additions and 1 deletions

View file

@ -26,6 +26,7 @@ include = [
"dEQP-VK.glsl.derivate.*.uniform_*",
"dEQP-VK.glsl.operator.*",
"dEQP-VK.image.load_store.with_format.*",
"dEQP-VK.pipeline.depth.format.d24_unorm_s8_uint.depth_test_disabled.depth_write_enabled",
"dEQP-VK.pipeline.input_assembly.*",
"dEQP-VK.pipeline.sampler.view_type.*.format.r*.address_modes.all_mode_clamp_to_border*",
"dEQP-VK.pipeline.stencil.*",

View file

@ -717,7 +717,19 @@ panvk_pipeline_builder_parse_zs(struct panvk_pipeline_builder *builder,
return;
pipeline->zs.z_test = builder->create_info.gfx->pDepthStencilState->depthTestEnable;
pipeline->zs.z_write = builder->create_info.gfx->pDepthStencilState->depthWriteEnable;
/* The Vulkan spec says:
*
* depthWriteEnable controls whether depth writes are enabled when
* depthTestEnable is VK_TRUE. Depth writes are always disabled when
* depthTestEnable is VK_FALSE.
*
* The hardware does not make this distinction, though, so we AND in the
* condition ourselves.
*/
pipeline->zs.z_write = pipeline->zs.z_test &&
builder->create_info.gfx->pDepthStencilState->depthWriteEnable;
pipeline->zs.z_compare_func =
panvk_per_arch(translate_compare_func)(builder->create_info.gfx->pDepthStencilState->depthCompareOp);
pipeline->zs.s_test = builder->create_info.gfx->pDepthStencilState->stencilTestEnable;