dzn: Disable depth/stencil for partial binding from dynamic rendering

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27224>
This commit is contained in:
Jesse Natalie
2024-01-23 14:28:27 -08:00
committed by Marge Bot
parent f4c6d9d9a9
commit 9b495ee8a9

View File

@@ -1511,6 +1511,7 @@ dzn_graphics_pipeline_translate_zsa(struct dzn_device *device,
in->pRasterizationState;
const VkPipelineDepthStencilStateCreateInfo *in_zsa =
in_rast->rasterizerDiscardEnable ? NULL : in->pDepthStencilState;
const VkPipelineRenderingCreateInfo *ri = vk_find_struct_const(in, PIPELINE_RENDERING_CREATE_INFO);
if (!in_zsa ||
in_rast->cullMode == VK_CULL_MODE_FRONT_AND_BACK) {
@@ -1530,8 +1531,12 @@ dzn_graphics_pipeline_translate_zsa(struct dzn_device *device,
D3D12_DEPTH_STENCIL_DESC2 desc;
memset(&desc, 0, sizeof(desc));
desc.DepthEnable =
in_zsa->depthTestEnable || in_zsa->depthBoundsTestEnable;
bool has_no_depth = ri && ri->depthAttachmentFormat == VK_FORMAT_UNDEFINED;
bool has_no_stencil = ri && ri->stencilAttachmentFormat == VK_FORMAT_UNDEFINED;
desc.DepthEnable = !has_no_depth &&
(in_zsa->depthTestEnable || in_zsa->depthBoundsTestEnable);
if (desc.DepthEnable) {
desc.DepthWriteMask =
in_zsa->depthWriteEnable ?
D3D12_DEPTH_WRITE_MASK_ALL : D3D12_DEPTH_WRITE_MASK_ZERO;
@@ -1539,12 +1544,13 @@ dzn_graphics_pipeline_translate_zsa(struct dzn_device *device,
in_zsa->depthTestEnable ?
dzn_translate_compare_op(in_zsa->depthCompareOp) :
D3D12_COMPARISON_FUNC_ALWAYS;
}
pipeline->zsa.depth_bounds.enable = in_zsa->depthBoundsTestEnable;
pipeline->zsa.depth_bounds.min = in_zsa->minDepthBounds;
pipeline->zsa.depth_bounds.max = in_zsa->maxDepthBounds;
desc.DepthBoundsTestEnable = in_zsa->depthBoundsTestEnable;
desc.StencilEnable = in_zsa->stencilTestEnable;
if (in_zsa->stencilTestEnable) {
desc.StencilEnable = in_zsa->stencilTestEnable && !has_no_stencil;
if (desc.StencilEnable) {
desc.FrontFace.StencilFailOp = translate_stencil_op(in_zsa->front.failOp);
desc.FrontFace.StencilDepthFailOp = translate_stencil_op(in_zsa->front.depthFailOp);
desc.FrontFace.StencilPassOp = translate_stencil_op(in_zsa->front.passOp);