From 2b7615daaacc30750ef533a87a89ee8d7b266a1e Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 4 May 2026 10:09:45 +0200 Subject: [PATCH] radv: fix determining needed dynamic states when rasterization is disabled The vertex input state can be NULL if rasterization is disabled with dynamic vertex inputs. The input assembly state can be NULL if rasterization is disabled and both states are dynamic (primive topology and primitive restart enable). This fixes a segfault with gpu-ratemeter vk_dyn.prim Cc: mesa-stable Signed-off-by: Samuel Pitoiset (cherry picked from commit 87be392251ce04a7755dc05d2d186c2cbffc295f) Part-of: --- .pick_status.json | 2 +- src/amd/vulkan/radv_pipeline_graphics.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index a82e343efce..92d87b9cd16 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4054,7 +4054,7 @@ "description": "radv: fix determining needed dynamic states when rasterization is disabled", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/amd/vulkan/radv_pipeline_graphics.c b/src/amd/vulkan/radv_pipeline_graphics.c index 5dc6b3c7212..b3ff8748fa4 100644 --- a/src/amd/vulkan/radv_pipeline_graphics.c +++ b/src/amd/vulkan/radv_pipeline_graphics.c @@ -418,9 +418,13 @@ radv_pipeline_needed_dynamic_state(const struct radv_device *device, const struc /* Disable dynamic states that are useless when rasterization is disabled. */ if (!raster_enabled) { - states = RADV_DYNAMIC_PRIMITIVE_TOPOLOGY | RADV_DYNAMIC_VERTEX_INPUT_BINDING_STRIDE | - RADV_DYNAMIC_PRIMITIVE_RESTART_ENABLE | RADV_DYNAMIC_RASTERIZER_DISCARD_ENABLE | - RADV_DYNAMIC_VERTEX_INPUT; + states = RADV_DYNAMIC_RASTERIZER_DISCARD_ENABLE; + + if (state->ia) + states |= RADV_DYNAMIC_PRIMITIVE_TOPOLOGY | RADV_DYNAMIC_PRIMITIVE_RESTART_ENABLE; + + if (state->vi) + states |= RADV_DYNAMIC_VERTEX_INPUT | RADV_DYNAMIC_VERTEX_INPUT_BINDING_STRIDE; if (pipeline->active_stages & VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT) states |= RADV_DYNAMIC_PATCH_CONTROL_POINTS | RADV_DYNAMIC_TESS_DOMAIN_ORIGIN;