From 47caf527e398102ef73ce4cd3baed92fa77d7049 Mon Sep 17 00:00:00 2001 From: Olivia Lee Date: Wed, 28 Jan 2026 23:52:35 -0800 Subject: [PATCH] hk: fix passthrough GS key invalidation Just seeing that a passthrough GS was already bound is not sufficient to know that it is a *matching* passthrough GS. If the application binds a new VS that requires a different passthrough GS key than the previous VS, then we need to bind a different passthrough GS. Fixes: 5bc82848163 ("hk: add Vulkan driver for Apple GPUs") Signed-off-by: Olivia Lee Reviewed-by: Mary Guillemard (cherry picked from commit e10f29399fb4c973b574df0d3649dfe3b2b7e4cf) Part-of: --- .pick_status.json | 2 +- src/asahi/vulkan/hk_cmd_draw.c | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 18faa314612..91211e9c2a1 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2874,7 +2874,7 @@ "description": "hk: fix passthrough GS key invalidation", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "5bc828481630147575348b66677edaade9e891e6", "notes": null diff --git a/src/asahi/vulkan/hk_cmd_draw.c b/src/asahi/vulkan/hk_cmd_draw.c index 89fda790078..e12deeda867 100644 --- a/src/asahi/vulkan/hk_cmd_draw.c +++ b/src/asahi/vulkan/hk_cmd_draw.c @@ -3212,6 +3212,9 @@ hk_handle_passthrough_gs(struct hk_cmd_buffer *cmd, struct agx_draw draw) struct hk_graphics_state *gfx = &cmd->state.gfx; struct hk_api_shader *gs = gfx->shaders[MESA_SHADER_GEOMETRY]; + if (!IS_SHADER_DIRTY(VERTEX) && !IS_SHADER_DIRTY(GEOMETRY)) + return; + /* If there's an application geometry shader, there's nothing to un/bind */ if (gs && !gs->is_passthrough) return; @@ -3221,12 +3224,8 @@ hk_handle_passthrough_gs(struct hk_cmd_buffer *cmd, struct agx_draw draw) uint32_t xfb_outputs = last_sw->info.xfb_info.output_count; bool needs_gs = xfb_outputs; - /* If we already have a matching GS configuration, we're done */ - if ((gs != NULL) == needs_gs) - return; - /* If we don't need a GS but we do have a passthrough, unbind it */ - if (gs) { + if (!needs_gs && gs != NULL) { assert(!needs_gs && gs->is_passthrough); hk_cmd_bind_graphics_shader(cmd, MESA_SHADER_GEOMETRY, NULL); return;