Mesa (main): panvk: Only write depth when depth test enabled

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 2 20:46:31 UTC 2022


Module: Mesa
Branch: main
Commit: 631f47e83a3575ede1cf7b15c0c6e252d072e2b6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=631f47e83a3575ede1cf7b15c0c6e252d072e2b6

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Wed Apr 27 19:14:37 2022 -0400

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 at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16283>

---

 src/panfrost/ci/deqp-panfrost-g52-vk.toml |  1 +
 src/panfrost/vulkan/panvk_vX_pipeline.c   | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/panfrost/ci/deqp-panfrost-g52-vk.toml b/src/panfrost/ci/deqp-panfrost-g52-vk.toml
index 317a2b402e5..80acaa133ea 100644
--- a/src/panfrost/ci/deqp-panfrost-g52-vk.toml
+++ b/src/panfrost/ci/deqp-panfrost-g52-vk.toml
@@ -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.*",
diff --git a/src/panfrost/vulkan/panvk_vX_pipeline.c b/src/panfrost/vulkan/panvk_vX_pipeline.c
index c7178d7a9da..ce737e6ebf9 100644
--- a/src/panfrost/vulkan/panvk_vX_pipeline.c
+++ b/src/panfrost/vulkan/panvk_vX_pipeline.c
@@ -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;



More information about the mesa-commit mailing list