From 977f0409b2c5aca7446001cd9d66aec5d1931431 Mon Sep 17 00:00:00 2001 From: Mary Guillemard Date: Tue, 24 Feb 2026 21:21:15 +0100 Subject: [PATCH] hk: Fix crash in hk_handle_passthrough_gs We should be returning if no GS is needed and no GS shader is bound. This fix various segfaults introduced by the original fix. Signed-off-by: Mary Guillemard Fixes: e10f29399fb4 ("hk: fix passthrough GS key invalidation") Reviewed-by: Eric Engestrom Reviewed-by: Janne Grunau (cherry picked from commit 6d040df750fbf76b2d7cb22c95ec16e70ea04d0a) Part-of: --- .pick_status.json | 2 +- src/asahi/vulkan/hk_cmd_draw.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index bf162312420..598e076603c 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -44,7 +44,7 @@ "description": "hk: Fix crash in hk_handle_passthrough_gs", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "e10f29399fb4c973b574df0d3649dfe3b2b7e4cf", "notes": null diff --git a/src/asahi/vulkan/hk_cmd_draw.c b/src/asahi/vulkan/hk_cmd_draw.c index e12deeda867..a0b1eb897a3 100644 --- a/src/asahi/vulkan/hk_cmd_draw.c +++ b/src/asahi/vulkan/hk_cmd_draw.c @@ -3225,9 +3225,11 @@ hk_handle_passthrough_gs(struct hk_cmd_buffer *cmd, struct agx_draw draw) bool needs_gs = xfb_outputs; /* If we don't need a GS but we do have a passthrough, unbind it */ - if (!needs_gs && gs != NULL) { - assert(!needs_gs && gs->is_passthrough); - hk_cmd_bind_graphics_shader(cmd, MESA_SHADER_GEOMETRY, NULL); + if (!needs_gs) { + if (gs != NULL) { + assert(gs->is_passthrough); + hk_cmd_bind_graphics_shader(cmd, MESA_SHADER_GEOMETRY, NULL); + } return; }