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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
diff --git a/src/broadcom/vulkan/v3dv_pipeline.c b/src/broadcom/vulkan/v3dv_pipeline.c
index e2860d4..eab5559 100644
--- a/src/broadcom/vulkan/v3dv_pipeline.c
+++ b/src/broadcom/vulkan/v3dv_pipeline.c
@@ -1437,11 +1437,13 @@
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 @@
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 @@
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;