You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
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.
This commit is contained in:
@@ -139,15 +139,10 @@ static int init_gblur_pipeline(GBlurVulkanContext *s,
|
|||||||
.mem_quali = "readonly",
|
.mem_quali = "readonly",
|
||||||
.mem_layout = "std430",
|
.mem_layout = "std430",
|
||||||
.stages = VK_SHADER_STAGE_COMPUTE_BIT,
|
.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));
|
RET(ff_vk_shader_add_descriptor_set(&s->vkctx, shd, &buf_desc, 1, 1, 0));
|
||||||
|
|
||||||
GLSLD( gblur_func );
|
GLSLD( gblur_func );
|
||||||
@@ -189,7 +184,6 @@ static int init_gblur_pipeline(GBlurVulkanContext *s,
|
|||||||
VK_FORMAT_UNDEFINED));
|
VK_FORMAT_UNDEFINED));
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
av_free(kernel_def);
|
|
||||||
if (spv_opaque)
|
if (spv_opaque)
|
||||||
spv->free_shader(spv, &spv_opaque);
|
spv->free_shader(spv, &spv_opaque);
|
||||||
return err;
|
return err;
|
||||||
|
Reference in New Issue
Block a user