From 6152bf1cfbaecf54e07c0e04574c592d24fa1bb4 Mon Sep 17 00:00:00 2001 From: Aitor Camacho Date: Mon, 19 Jan 2026 12:06:44 +0900 Subject: [PATCH] kk: Fix compute pipeline cache When deserializing the compute shader from a blob, we need to recreate the pipeline because the blob may have been loaded from file and therefore the reference to the Metal resource will be invalid. Signed-off-by: Aitor Camacho (cherry picked from commit 75f6f46c0f834ca1883ffe58a33c33f5e00e9833) Part-of: --- .pick_status.json | 2 +- src/kosmickrisp/vulkan/kk_shader.c | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 40b5bfadf7a..371d31244b6 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -15974,7 +15974,7 @@ "description": "kk: Fix compute pipeline cache", "nominated": false, "nomination_type": 0, - "resolution": 4, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/kosmickrisp/vulkan/kk_shader.c b/src/kosmickrisp/vulkan/kk_shader.c index feebae532e4..70228629a1f 100644 --- a/src/kosmickrisp/vulkan/kk_shader.c +++ b/src/kosmickrisp/vulkan/kk_shader.c @@ -1129,9 +1129,7 @@ kk_shader_serialize(struct vk_device *vk_dev, const struct vk_shader *vk_shader, /* We are building a new shader into the cache so we need to retain resources */ - if (shader->info.stage == MESA_SHADER_COMPUTE) - mtl_retain(shader->pipeline.cs); - else if (shader->info.stage == MESA_SHADER_VERTEX) { + if (shader->info.stage == MESA_SHADER_VERTEX) { mtl_retain(shader->pipeline.gfx.handle); if (shader->pipeline.gfx.mtl_depth_stencil_state_handle) mtl_retain(shader->pipeline.gfx.mtl_depth_stencil_state_handle); @@ -1185,8 +1183,9 @@ kk_deserialize_shader(struct vk_device *vk_dev, struct blob_reader *blob, } /* We are building a new shader so we need to retain resources */ + VkResult result = VK_SUCCESS; if (info.stage == MESA_SHADER_COMPUTE) - mtl_retain(shader->pipeline.cs); + result = kk_compile_compute_pipeline(dev, shader); else if (info.stage == MESA_SHADER_VERTEX) { mtl_retain(shader->pipeline.gfx.handle); if (shader->pipeline.gfx.mtl_depth_stencil_state_handle) @@ -1195,7 +1194,7 @@ kk_deserialize_shader(struct vk_device *vk_dev, struct blob_reader *blob, *shader_out = &shader->vk; - return VK_SUCCESS; + return result; } static void