From df2bb5b01bfaf52029466b3cd02e6f40f90c952c Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Thu, 19 Mar 2020 10:45:12 +0100 Subject: [PATCH] v3dv: disable depth/stencil testing if we don't have a depth/stencil attachment Also, remove obsolete FIXME. Fixes: dEQP-VK.fragment_operations.early_fragment.early_fragment_tests_stencil_no_attachment Part-of: --- src/broadcom/vulkan/v3dv_pipeline.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/broadcom/vulkan/v3dv_pipeline.c b/src/broadcom/vulkan/v3dv_pipeline.c index e2860d4e247..eab55591208 100644 --- a/src/broadcom/vulkan/v3dv_pipeline.c +++ b/src/broadcom/vulkan/v3dv_pipeline.c @@ -1437,11 +1437,13 @@ pack_cfg_bits(struct v3dv_pipeline *pipeline, config.blend_enable = pipeline->blend.enables != 0; - /* Note: ez state may update based on the compiled FS, along with zsa - * (FIXME: not done) - */ + /* Disable depth/stencil if we don't have a D/S attachment */ + bool has_ds_attachment = + pipeline->subpass->ds_attachment.attachment != VK_ATTACHMENT_UNUSED; + + /* Note: ez state may update based on the compiled FS, along with zsa */ config.early_z_updates_enable = false; - if (ds_info && ds_info->depthTestEnable) { + if (ds_info && ds_info->depthTestEnable && has_ds_attachment) { config.z_updates_enable = true; config.early_z_enable = false; config.depth_test_function = ds_info->depthCompareOp; @@ -1449,7 +1451,8 @@ pack_cfg_bits(struct v3dv_pipeline *pipeline, config.depth_test_function = VK_COMPARE_OP_ALWAYS; } - config.stencil_enable = ds_info ? ds_info->stencilTestEnable : false; + config.stencil_enable = + ds_info ? ds_info->stencilTestEnable && has_ds_attachment: false; }; } @@ -1534,6 +1537,9 @@ pack_stencil_cfg(struct v3dv_pipeline *pipeline, if (!ds_info || !ds_info->stencilTestEnable) return; + if (pipeline->subpass->ds_attachment.attachment == VK_ATTACHMENT_UNUSED) + return; + const uint32_t dynamic_stencil_states = V3DV_DYNAMIC_STENCIL_COMPARE_MASK | V3DV_DYNAMIC_STENCIL_WRITE_MASK | V3DV_DYNAMIC_STENCIL_REFERENCE;