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>
This commit is contained in:
Iago Toral Quiroga
2020-03-19 10:45:12 +01:00
committed by Marge Bot
parent e86f381ea1
commit df2bb5b01b
+11 -5
View File
@@ -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;