From 5f83571f9232a82315d800db7e5ea3ded23ce54c Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 11 May 2022 13:06:11 -0400 Subject: [PATCH] lavapipe: fix pipeline handling for dynamic render zs state with pipeline library this is slightly more nuanced: if this is ONLY a fragment state, pDepthStencilState must exist, but if it's BOTH fragment and output, then pDepthStencilState must only exist if zs attachment is used Fixes: d4d5a7abba7 ("lavapipe: implement EXT_graphics_pipeline_library") Acked-by: Lionel Landwerlin Reviewed-by: Dave Airlie Part-of: --- src/gallium/frontends/lavapipe/lvp_pipeline.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/gallium/frontends/lavapipe/lvp_pipeline.c b/src/gallium/frontends/lavapipe/lvp_pipeline.c index 41122a30891..edf3e59a27e 100644 --- a/src/gallium/frontends/lavapipe/lvp_pipeline.c +++ b/src/gallium/frontends/lavapipe/lvp_pipeline.c @@ -449,9 +449,25 @@ deep_copy_graphics_create_info(void *mem_ctx, if (shaders & VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_SHADER_BIT_EXT) { assert(rp_info); + bool have_output = (shaders & VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_OUTPUT_INTERFACE_BIT_EXT) > 0; /* pDepthStencilState */ if (src->pDepthStencilState && !rasterization_disabled && - (has_depth || has_stencil)) { + /* + VUID-VkGraphicsPipelineCreateInfo-renderPass-06053 + * If renderPass is VK_NULL_HANDLE, the pipeline is being created with fragment shader + state and fragment output interface state, and either of + VkPipelineRenderingCreateInfo::depthAttachmentFormat + or + VkPipelineRenderingCreateInfo::stencilAttachmentFormat + are not VK_FORMAT_UNDEFINED, pDepthStencilState must be a valid pointer to a valid + VkPipelineDepthStencilStateCreateInfo structure + + VUID-VkGraphicsPipelineCreateInfo-renderPass-06590 + * If renderPass is VK_NULL_HANDLE and the pipeline is being created with fragment shader + state but not fragment output interface state, pDepthStencilState must be a valid pointer + to a valid VkPipelineDepthStencilStateCreateInfo structure + */ + (!have_output || has_depth || has_stencil)) { LVP_PIPELINE_DUP(dst->pDepthStencilState, src->pDepthStencilState, VkPipelineDepthStencilStateCreateInfo,