From 51ab0a4c25886729b607e57ec625ad27cf5dff82 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Wed, 27 Mar 2024 18:25:29 +0100 Subject: [PATCH] panvk: Don't assume VkGraphicsPipelineCreateInfo::pColorBlendState != NULL When the subpass being associated to a graphics pipeline has no color attachment, pColorBlendState can be NULL. Signed-off-by: Boris Brezillon Reviewed-by: Mary Guillemard Part-of: --- src/panfrost/vulkan/panvk_vX_pipeline.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/panfrost/vulkan/panvk_vX_pipeline.c b/src/panfrost/vulkan/panvk_vX_pipeline.c index 4ca05be723f..26c2bb76113 100644 --- a/src/panfrost/vulkan/panvk_vX_pipeline.c +++ b/src/panfrost/vulkan/panvk_vX_pipeline.c @@ -591,6 +591,9 @@ static void panvk_pipeline_builder_parse_color_blend(struct panvk_pipeline_builder *builder, struct panvk_pipeline *pipeline) { + if (!builder->create_info.gfx->pColorBlendState) + return; + pipeline->blend.state.logicop_enable = builder->create_info.gfx->pColorBlendState->logicOpEnable; pipeline->blend.state.logicop_func = @@ -1063,8 +1066,8 @@ panvk_pipeline_builder_init_graphics( subpass->depth_stencil_attachment && subpass->depth_stencil_attachment->attachment != VK_ATTACHMENT_UNUSED; - assert(subpass->color_count <= - create_info->pColorBlendState->attachmentCount); + assert(!subpass->color_count || + subpass->color_count <= create_info->pColorBlendState->attachmentCount); builder->active_color_attachments = 0; for (uint32_t i = 0; i < subpass->color_count; i++) { uint32_t idx = subpass->color_attachments[i].attachment;