From: Mike Blumenkrantz Date: Tue, 22 Feb 2022 20:25:06 +0000 (-0500) Subject: lavapipe: fix pipeline creation for blend and zs states X-Git-Tag: upstream/22.3.5~11948 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=204ea77b0674fb611155bd3ba2e6169cc8646b3f;p=platform%2Fupstream%2Fmesa.git lavapipe: fix pipeline creation for blend and zs states these values are read based on the specified subpass containing the required attachments, not on the overall renderpass cc: mesa-stable Reviewed-by: Dave Airlie Part-of: --- diff --git a/src/gallium/frontends/lavapipe/lvp_pass.c b/src/gallium/frontends/lavapipe/lvp_pass.c index 475a95e..97ddbd6 100644 --- a/src/gallium/frontends/lavapipe/lvp_pass.c +++ b/src/gallium/frontends/lavapipe/lvp_pass.c @@ -85,10 +85,6 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateRenderPass2( att->load_op = pCreateInfo->pAttachments[i].loadOp; att->stencil_load_op = pCreateInfo->pAttachments[i].stencilLoadOp; att->attachment = i; - - bool is_zs = util_format_is_depth_or_stencil(lvp_vk_format_to_pipe_format(att->format)); - pass->has_zs_attachment |= is_zs; - pass->has_color_attachment |= !is_zs; } uint32_t subpass_attachment_idx = 0; @@ -124,6 +120,7 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateRenderPass2( for (uint32_t j = 0; j < desc->colorAttachmentCount; j++) { CHECK_UNUSED_ATTACHMENT(pColorAttachments, color_attachments, j); + subpass->has_color_attachment |= !!subpass->color_attachments[j]; } } @@ -143,6 +140,7 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateRenderPass2( subpass_attachment_idx++; CHECK_UNUSED_ATTACHMENT(pDepthStencilAttachment, depth_stencil_attachment, 0); + subpass->has_zs_attachment = !!(*subpass->depth_stencil_attachment); } const VkSubpassDescriptionDepthStencilResolve *ds_resolve = diff --git a/src/gallium/frontends/lavapipe/lvp_pipeline.c b/src/gallium/frontends/lavapipe/lvp_pipeline.c index 680c87c..a742358 100644 --- a/src/gallium/frontends/lavapipe/lvp_pipeline.c +++ b/src/gallium/frontends/lavapipe/lvp_pipeline.c @@ -369,7 +369,7 @@ deep_copy_graphics_create_info(void *mem_ctx, /* pDepthStencilState */ if (src->pDepthStencilState && !rasterization_disabled && - (pass ? pass->has_zs_attachment : (rp_info->depthAttachmentFormat || rp_info->stencilAttachmentFormat))) { + (pass ? pass->subpasses[src->subpass].has_zs_attachment : (rp_info->depthAttachmentFormat || rp_info->stencilAttachmentFormat))) { LVP_PIPELINE_DUP(dst->pDepthStencilState, src->pDepthStencilState, VkPipelineDepthStencilStateCreateInfo, @@ -379,7 +379,7 @@ deep_copy_graphics_create_info(void *mem_ctx, /* pColorBlendState */ if (src->pColorBlendState && !rasterization_disabled && - (pass ? pass->has_color_attachment : rp_info->colorAttachmentCount)) { + (pass ? pass->subpasses[src->subpass].has_color_attachment : rp_info->colorAttachmentCount)) { VkPipelineColorBlendStateCreateInfo* cb_state; cb_state = ralloc(mem_ctx, VkPipelineColorBlendStateCreateInfo); diff --git a/src/gallium/frontends/lavapipe/lvp_private.h b/src/gallium/frontends/lavapipe/lvp_private.h index 45bc17d..c6750f8 100644 --- a/src/gallium/frontends/lavapipe/lvp_private.h +++ b/src/gallium/frontends/lavapipe/lvp_private.h @@ -284,6 +284,8 @@ struct lvp_subpass { /** Subpass has at least one color resolve attachment */ bool has_color_resolve; + bool has_color_attachment; + bool has_zs_attachment; uint32_t view_mask; }; @@ -294,8 +296,6 @@ struct lvp_render_pass { uint32_t subpass_count; struct lvp_subpass_attachment * subpass_attachments; struct lvp_render_pass_attachment * attachments; - bool has_color_attachment; - bool has_zs_attachment; struct lvp_subpass subpasses[0]; };