swscale/vulkan/ops: use opaque run function

Avoids some unnecessary round-trips through the execution harness, as well
as removing one unnecessary layer of abstraction (SwsOpExec).

It's a bit unfortunate that we have to cast away the const on the AVFrame,
since the Vulkan functions take non-const everywhere, even though all they're
doing is modifying frame internal metadata, but alas.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
This commit is contained in:
Niklas Haas 2026-03-07 01:40:27 +01:00
parent 911176c880
commit 143cb56501

View file

@ -92,16 +92,16 @@ typedef struct VulkanPriv {
enum FFVkShaderRepFormat dst_rep;
} VulkanPriv;
static void process(const SwsOpExec *exec, const void *priv,
int x_start, int y_start, int x_end, int y_end)
static void process(const SwsFrame *dst, const SwsFrame *src, int y, int h,
const SwsPass *pass)
{
VulkanPriv *p = (VulkanPriv *)priv;
VulkanPriv *p = (VulkanPriv *) pass->priv;
FFVkExecContext *ec = ff_vk_exec_get(&p->s->vkctx, &p->s->e);
FFVulkanFunctions *vk = &p->s->vkctx.vkfn;
ff_vk_exec_start(&p->s->vkctx, ec);
AVFrame *src_f = (AVFrame *) exec->in_frame->avframe;
AVFrame *dst_f = (AVFrame *) exec->out_frame->avframe;
AVFrame *src_f = (AVFrame *) src->avframe;
AVFrame *dst_f = (AVFrame *) dst->avframe;
ff_vk_exec_add_dep_frame(&p->s->vkctx, ec, src_f,
VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT);
@ -350,9 +350,8 @@ static int compile(SwsContext *sws, SwsOpList *ops, SwsCompiledOp *out)
return err;
*out = (SwsCompiledOp) {
.slice_align = 0,
.block_size = 1,
.func = process,
.opaque = true,
.func_opaque = process,
.priv = av_memdup(&p, sizeof(p)),
.free = free_fn,
};