This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 82cecf4ef82fc6436f72e8b382ae98e8c95e28ae
Author:     Lynne <[email protected]>
AuthorDate: Thu Sep 24 16:21:56 2026 +0900
Commit:     Lynne <[email protected]>
CommitDate: Fri Sep 25 01:13:25 2026 +0900

    vulkan: remove shader object support
    
    Always create a compute pipeline instead.
    The issue is Mesa does not cache compute shader objects, which wastes 
upwards of a
    second on every single compute shader initialization, instead of just on 
the first.
---
 libavutil/vulkan.c | 100 +++++++++++------------------------------------------
 libavutil/vulkan.h |   2 --
 2 files changed, 21 insertions(+), 81 deletions(-)

diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c
index de7f836341..fd8f939c55 100644
--- a/libavutil/vulkan.c
+++ b/libavutil/vulkan.c
@@ -2380,47 +2380,6 @@ static int init_compute_pipeline(FFVulkanContext *s, 
FFVulkanShader *shd,
     return 0;
 }
 
-static int create_shader_object(FFVulkanContext *s, FFVulkanShader *shd,
-                                const uint8_t *spirv, size_t spirv_len,
-                                size_t *binary_size, const char *entrypoint)
-{
-    VkResult ret;
-    FFVulkanFunctions *vk = &s->vkfn;
-
-    VkShaderCreateInfoEXT shader_obj_create = {
-        .sType = VK_STRUCTURE_TYPE_SHADER_CREATE_INFO_EXT,
-        .pNext = shd->subgroup_info.requiredSubgroupSize ?
-                 &shd->subgroup_info : NULL,
-        .flags = shd->subgroup_info.requiredSubgroupSize ?
-                 VK_SHADER_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT : 0x0,
-        .stage = shd->stage,
-        .nextStage = 0,
-        .codeType = VK_SHADER_CODE_TYPE_SPIRV_EXT,
-        .pCode = spirv,
-        .codeSize = spirv_len,
-        .pName = entrypoint,
-        .pSetLayouts = shd->desc_layout,
-        .setLayoutCount = shd->nb_descriptor_sets,
-        .pushConstantRangeCount = shd->push_consts_num,
-        .pPushConstantRanges = shd->push_consts,
-        .pSpecializationInfo = shd->specialization_info,
-    };
-
-    ret = vk->CreateShadersEXT(s->hwctx->act_dev, 1, &shader_obj_create,
-                               s->hwctx->alloc, &shd->object);
-    if (ret != VK_SUCCESS) {
-        av_log(s, AV_LOG_ERROR, "Unable to create shader object: %s\n",
-               ff_vk_ret2str(ret));
-        return AVERROR_EXTERNAL;
-    }
-
-    if (vk->GetShaderBinaryDataEXT(s->hwctx->act_dev, shd->object,
-                                   binary_size, NULL) != VK_SUCCESS)
-        return AVERROR_EXTERNAL;
-
-    return 0;
-}
-
 static int init_descriptors(FFVulkanContext *s, FFVulkanShader *shd)
 {
     VkResult ret;
@@ -2471,7 +2430,8 @@ int ff_vk_shader_link(FFVulkanContext *s, FFVulkanShader 
*shd,
     FFVulkanFunctions *vk = &s->vkfn;
     VkSpecializationMapEntry spec_entries[3];
     VkSpecializationInfo spec_info;
-    size_t input_size = spirv_len, binary_size = 0;
+    VkShaderModule mod;
+    size_t input_size = spirv_len;
 
     if (shd->precompiled) {
         if (!shd->specialization_info) {
@@ -2517,33 +2477,25 @@ int ff_vk_shader_link(FFVulkanContext *s, 
FFVulkanShader *shd,
     if (err < 0)
         goto end;
 
-    if (s->extensions & FF_VK_EXT_SHADER_OBJECT) {
-        err = create_shader_object(s, shd, spirv, spirv_len,
-                                   &binary_size, entrypoint);
-        if (err < 0)
-            goto end;
-    } else {
-        VkShaderModule mod;
-        err = create_shader_module(s, shd, &mod, spirv, spirv_len);
-        if (err < 0)
-            goto end;
+    err = create_shader_module(s, shd, &mod, spirv, spirv_len);
+    if (err < 0)
+        goto end;
 
-        switch (shd->bind_point) {
-        case VK_PIPELINE_BIND_POINT_COMPUTE:
-            err = init_compute_pipeline(s, shd, mod, entrypoint);
-            break;
-        default:
-            av_log(s, AV_LOG_ERROR, "Unsupported shader type: %i\n",
-                   shd->bind_point);
-            err = AVERROR(EINVAL);
-            goto end;
-            break;
-        };
+    switch (shd->bind_point) {
+    case VK_PIPELINE_BIND_POINT_COMPUTE:
+        err = init_compute_pipeline(s, shd, mod, entrypoint);
+        break;
+    default:
+        av_log(s, AV_LOG_ERROR, "Unsupported shader type: %i\n",
+               shd->bind_point);
+        err = AVERROR(EINVAL);
+        goto end;
+        break;
+    };
 
-        vk->DestroyShaderModule(s->hwctx->act_dev, mod, s->hwctx->alloc);
-        if (err < 0)
-            goto end;
-    }
+    vk->DestroyShaderModule(s->hwctx->act_dev, mod, s->hwctx->alloc);
+    if (err < 0)
+        goto end;
 
     if (shd->name)
         av_log(s, AV_LOG_VERBOSE, "Shader %s linked, size:", shd->name);
@@ -2552,10 +2504,7 @@ int ff_vk_shader_link(FFVulkanContext *s, FFVulkanShader 
*shd,
 
     if (input_size != spirv_len)
         av_log(s, AV_LOG_VERBOSE, " %zu compressed,", input_size);
-    av_log(s, AV_LOG_VERBOSE, " %zu SPIR-V", spirv_len);
-    if (binary_size != spirv_len)
-        av_log(s, AV_LOG_VERBOSE, ", %zu binary", binary_size);
-    av_log(s, AV_LOG_VERBOSE, "\n");
+    av_log(s, AV_LOG_VERBOSE, " %zu SPIR-V\n", spirv_len);
 
 end:
     if (shd->precompiled) {
@@ -2793,12 +2742,7 @@ void ff_vk_exec_bind_shader(FFVulkanContext *s, 
FFVkExecContext *e,
     FFVulkanFunctions *vk = &s->vkfn;
     const FFVulkanShaderData *sd = get_shd_data(e, shd);
 
-    if (s->extensions & FF_VK_EXT_SHADER_OBJECT) {
-        VkShaderStageFlagBits stages = shd->stage;
-        vk->CmdBindShadersEXT(e->buf, 1, &stages, &shd->object);
-    } else {
-        vk->CmdBindPipeline(e->buf, shd->bind_point, shd->pipeline);
-    }
+    vk->CmdBindPipeline(e->buf, shd->bind_point, shd->pipeline);
 
     if (sd && sd->nb_descriptor_sets) {
         if (!shd->use_push) {
@@ -2820,8 +2764,6 @@ void ff_vk_shader_free(FFVulkanContext *s, FFVulkanShader 
*shd)
                                 s->hwctx->alloc);
 #endif
 
-    if (shd->object)
-        vk->DestroyShaderEXT(s->hwctx->act_dev, shd->object, s->hwctx->alloc);
     if (shd->pipeline)
         vk->DestroyPipeline(s->hwctx->act_dev, shd->pipeline, s->hwctx->alloc);
     if (shd->pipeline_layout)
diff --git a/libavutil/vulkan.h b/libavutil/vulkan.h
index 7d2e89c09d..30850c07d9 100644
--- a/libavutil/vulkan.h
+++ b/libavutil/vulkan.h
@@ -225,8 +225,6 @@ typedef struct FFVulkanShader {
     /* Creation info */
     VkPipelineShaderStageRequiredSubgroupSizeCreateInfo subgroup_info;
 
-    /* Base shader object */
-    VkShaderEXT object;
     VkPipeline pipeline;
 
     /* Pipeline layout */

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to