[FFmpeg-cvslog] gblur_vulkan: simplify buffer content writing

Lynne git at videolan.org
Fri Feb 21 04:20:10 EET 2025


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Fri Feb 21 03:14:31 2025 +0100| [2066c5526d27168144db059c344df58ed5942aa3] | committer: Lynne

gblur_vulkan: simplify buffer content writing

Before .buf_elems, users had to manually print to a string if they
wanted a non-fixed number of elements in an array.

Since we're printing everything to the shaders manually anyway, use
the new mechanism.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2066c5526d27168144db059c344df58ed5942aa3
---

 libavfilter/vf_gblur_vulkan.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/libavfilter/vf_gblur_vulkan.c b/libavfilter/vf_gblur_vulkan.c
index bc4c2217b5..80b66de735 100644
--- a/libavfilter/vf_gblur_vulkan.c
+++ b/libavfilter/vf_gblur_vulkan.c
@@ -139,15 +139,10 @@ static int init_gblur_pipeline(GBlurVulkanContext *s,
         .mem_quali   = "readonly",
         .mem_layout  = "std430",
         .stages      = VK_SHADER_STAGE_COMPUTE_BIT,
-        .buf_content = NULL,
+        .buf_content = "float kernel",
+        .buf_elems   = ksize,
     };
 
-    char *kernel_def = av_asprintf("float kernel[%i];", ksize);
-    if (!kernel_def)
-        return AVERROR(ENOMEM);
-
-    buf_desc.buf_content = kernel_def;
-
     RET(ff_vk_shader_add_descriptor_set(&s->vkctx, shd, &buf_desc, 1, 1, 0));
 
     GLSLD(   gblur_func                                               );
@@ -189,7 +184,6 @@ static int init_gblur_pipeline(GBlurVulkanContext *s,
                                         VK_FORMAT_UNDEFINED));
 
 fail:
-    av_free(kernel_def);
     if (spv_opaque)
         spv->free_shader(spv, &spv_opaque);
     return err;



More information about the ffmpeg-cvslog mailing list