From 2066c5526d27168144db059c344df58ed5942aa3 Mon Sep 17 00:00:00 2001 From: Lynne Date: Fri, 21 Feb 2025 03:14:31 +0100 Subject: [PATCH] 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. --- 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;