Commit 141fdf837e for ffmpeg

commit 141fdf837e00fa4622f42ab173b39dae09f3ab77
Author: Niklas Haas <git@haasn.dev>
Date:   Wed Oct 21 02:26:42 2026 +0200

    swscale/vulkan/ops: split shader emission from add_ops_spirv()

    Allows the caller to handle setup and cleanup of the SPIR-V context in
    one place, regardless of where emission fails.

    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
    Signed-off-by: Niklas Haas <git@haasn.dev>

diff --git a/libswscale/vulkan/ops.c b/libswscale/vulkan/ops.c
index 8a84f7f865..60378d028b 100644
--- a/libswscale/vulkan/ops.c
+++ b/libswscale/vulkan/ops.c
@@ -977,13 +977,10 @@ static int rw_op_img_count(const SwsOp *op, const uint8_t *planes)
     return count;
 }

-static int add_ops_spirv(SwsContext *sws, VulkanPriv *p, FFVulkanOpsCtx *s,
-                         const SwsOpList *ops, FFVulkanShader *shd)
+static int emit_shader(SwsContext *sws, VulkanPriv *p, FFVulkanOpsCtx *s,
+                       const SwsOpList *ops, FFVulkanShader *shd, SPICtx *spi)
 {
-    uint8_t spvbuf[1024*16];
-    SPICtx spi_context = { 0 }, *spi = &spi_context;
     SPIRVIDs spid_data = { 0 }, *id = &spid_data;
-    spi_init(spi, spvbuf, sizeof(spvbuf));

     if (ops->num_ops > MAX_OPS)
         return AVERROR(ENOTSUP);
@@ -1339,6 +1336,19 @@ static int add_ops_spirv(SwsContext *sws, VulkanPriv *p, FFVulkanOpsCtx *s,
     /* Return and finalize */
     spi_OpReturn(spi);
     spi_OpFunctionEnd(spi);
+    return 0;
+}
+
+static int add_ops_spirv(SwsContext *sws, VulkanPriv *p, FFVulkanOpsCtx *s,
+                         const SwsOpList *ops, FFVulkanShader *shd)
+{
+    uint8_t spvbuf[1024*16];
+    SPICtx spi_context = { 0 }, *spi = &spi_context;
+    spi_init(spi, spvbuf, sizeof(spvbuf));
+
+    int err = emit_shader(sws, p, s, ops, shd, spi);
+    if (err < 0)
+        return err;

     int len = spi_end(spi);
     if (len < 0)