From bc0ff36885d6b773cb48ecf7eaf0630e70ed8763 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Wed, 28 Sep 2022 17:11:08 +0200 Subject: [PATCH] radv: fix initializing the blend state for NULL render pass with GPL If a library with only the vertex input interface is created, this would crash. This fixes segfault with vkoverhead. Signed-off-by: Samuel Pitoiset Reviewed-By: Mike Blumenkrantz Part-of: --- src/amd/vulkan/radv_pipeline.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index 47fee321926..19af0cf9903 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -876,7 +876,8 @@ radv_pipeline_init_blend_state(struct radv_graphics_pipeline *pipeline, else cb_color_control |= S_028808_MODE(V_028808_CB_DISABLE); - radv_pipeline_compute_spi_color_formats(pipeline, &blend, state, has_ps_epilog); + if (state->rp) + radv_pipeline_compute_spi_color_formats(pipeline, &blend, state, has_ps_epilog); pipeline->cb_color_control = cb_color_control; @@ -2745,7 +2746,7 @@ radv_generate_graphics_pipeline_key(const struct radv_graphics_pipeline *pipelin const struct radv_physical_device *pdevice = device->physical_device; struct radv_pipeline_key key = radv_generate_pipeline_key(&pipeline->base, pCreateInfo->flags); - key.has_multiview_view_index = !!state->rp->view_mask; + key.has_multiview_view_index = state->rp ? !!state->rp->view_mask : 0; if (pipeline->dynamic_states & RADV_DYNAMIC_VERTEX_INPUT) { key.vs.has_prolog = true;