This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 32554fc1075abe8d0b9c1d058013146c5abb5287 Author: Niklas Haas <[email protected]> AuthorDate: Fri Mar 6 18:07:12 2026 +0100 Commit: Niklas Haas <[email protected]> CommitDate: Mon Mar 9 11:25:58 2026 +0100 swscale/vulkan/ops: move buffer desc setting to helper function And call it on the read/write ops directly, rather than this awkward loop. Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas <[email protected]> --- libswscale/vulkan/ops.c | 53 +++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/libswscale/vulkan/ops.c b/libswscale/vulkan/ops.c index 8d614232ac..7b7d51835a 100644 --- a/libswscale/vulkan/ops.c +++ b/libswscale/vulkan/ops.c @@ -157,6 +157,28 @@ static void free_fn(void *priv) av_free(priv); } +static void add_desc_read_write(FFVulkanDescriptorSetBinding *out_desc, + enum FFVkShaderRepFormat *out_rep, + const SwsOp *op) +{ + const char *img_type = op->type == SWS_PIXEL_F32 ? "rgba32f" : + op->type == SWS_PIXEL_U32 ? "rgba32ui" : + op->type == SWS_PIXEL_U16 ? "rgba16ui" : + "rgba8ui"; + + *out_desc = (FFVulkanDescriptorSetBinding) { + .name = op->op == SWS_OP_WRITE ? "dst_img" : "src_img", + .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, + .mem_layout = img_type, + .mem_quali = op->op == SWS_OP_WRITE ? "writeonly" : "readonly", + .dimensions = 2, + .elems = op->rw.packed ? 1 : op->rw.elems, + .stages = VK_SHADER_STAGE_COMPUTE_BIT, + }; + + *out_rep = op->type == SWS_PIXEL_F32 ? FF_VK_REP_FLOAT : FF_VK_REP_UINT; +} + #if CONFIG_LIBSHADERC || CONFIG_LIBGLSLANG static int add_ops_glsl(VulkanPriv *p, FFVulkanOpsCtx *s, SwsOpList *ops, FFVulkanShader *shd) @@ -179,32 +201,11 @@ static int add_ops_glsl(VulkanPriv *p, FFVulkanOpsCtx *s, int nb_desc = 0; FFVulkanDescriptorSetBinding buf_desc[8]; - for (int n = 0; n < ops->num_ops; n++) { - const SwsOp *op = &ops->ops[n]; - /* Set initial type */ - if (op->op == SWS_OP_READ || op->op == SWS_OP_WRITE) { - const char *img_type = op->type == SWS_PIXEL_F32 ? "rgba32f" : - op->type == SWS_PIXEL_U32 ? "rgba32ui" : - op->type == SWS_PIXEL_U16 ? "rgba16ui" : - "rgba8ui"; - buf_desc[nb_desc++] = (FFVulkanDescriptorSetBinding) { - .name = op->op == SWS_OP_WRITE ? "dst_img" : "src_img", - .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, - .mem_layout = img_type, - .mem_quali = op->op == SWS_OP_WRITE ? "writeonly" : "readonly", - .dimensions = 2, - .elems = (op->rw.packed ? 1 : op->rw.elems), - .stages = VK_SHADER_STAGE_COMPUTE_BIT, - }; - if (op->op == SWS_OP_READ) - p->src_rep = op->type == SWS_PIXEL_F32 ? FF_VK_REP_FLOAT : - FF_VK_REP_UINT; - else - p->dst_rep = op->type == SWS_PIXEL_F32 ? FF_VK_REP_FLOAT : - FF_VK_REP_UINT; - } - } - + const SwsOp *read = ff_sws_op_list_input(ops); + const SwsOp *write = ff_sws_op_list_output(ops); + if (read) + add_desc_read_write(&buf_desc[nb_desc++], &p->src_rep, read); + add_desc_read_write(&buf_desc[nb_desc++], &p->dst_rep, write); ff_vk_shader_add_descriptor_set(&s->vkctx, shd, buf_desc, nb_desc, 0, 0); GLSLC(0, void main() ); _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
