This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit b3a2179e309128337df69d88d59e19137eb1090f Author: Lynne <[email protected]> AuthorDate: Sun Sep 20 21:07:18 2026 +0900 Commit: Lynne <[email protected]> CommitDate: Sun Sep 20 21:17:21 2026 +0900 vulkan_filter: bind the output first in ff_vk_filter_process_Nin Lets one shader serve a variable number of inputs, as the output and the leading inputs keep their bindings when fewer are used. --- libavfilter/vf_blend_vulkan.c | 6 +++--- libavfilter/vf_bwdif_vulkan.c | 8 ++++---- libavfilter/vf_interlace_vulkan.c | 10 +++++----- libavfilter/vf_overlay_vulkan.c | 6 +++--- libavfilter/vf_xfade_vulkan.c | 8 ++++---- libavfilter/vulkan/blend.comp.glsl | 6 +++--- libavfilter/vulkan/bwdif.comp.glsl | 8 ++++---- libavfilter/vulkan/interlace.comp.glsl | 6 +++--- libavfilter/vulkan/overlay.comp.glsl | 6 +++--- libavfilter/vulkan/xfade.comp.glsl | 6 +++--- libavfilter/vulkan_filter.c | 4 ++-- libavfilter/vulkan_filter.h | 2 +- 12 files changed, 38 insertions(+), 38 deletions(-) diff --git a/libavfilter/vf_blend_vulkan.c b/libavfilter/vf_blend_vulkan.c index f5b54e50ce..4146988972 100644 --- a/libavfilter/vf_blend_vulkan.c +++ b/libavfilter/vf_blend_vulkan.c @@ -115,17 +115,17 @@ static av_cold int init_filter(AVFilterContext *avctx) VK_SHADER_STAGE_COMPUTE_BIT); desc = (FFVulkanDescriptorSetBinding []) { - { /* top_images */ + { /* output_images */ .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, .stages = VK_SHADER_STAGE_COMPUTE_BIT, .elems = planes, }, - { /* bottom_images */ + { /* top_images */ .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, .stages = VK_SHADER_STAGE_COMPUTE_BIT, .elems = planes, }, - { /* output_images */ + { /* bottom_images */ .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, .stages = VK_SHADER_STAGE_COMPUTE_BIT, .elems = planes, diff --git a/libavfilter/vf_bwdif_vulkan.c b/libavfilter/vf_bwdif_vulkan.c index 717b5a4ff7..2c1e4908ef 100644 --- a/libavfilter/vf_bwdif_vulkan.c +++ b/libavfilter/vf_bwdif_vulkan.c @@ -65,22 +65,22 @@ static av_cold int init_filter(AVFilterContext *ctx) (uint32_t [3]) { 1, 64, planes }, 0); const FFVulkanDescriptorSetBinding desc_set[] = { - { /* prev */ + { /* dst */ .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, .stages = VK_SHADER_STAGE_COMPUTE_BIT, .elems = planes, }, - { /* cur */ + { /* prev */ .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, .stages = VK_SHADER_STAGE_COMPUTE_BIT, .elems = planes, }, - { /* next */ + { /* cur */ .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, .stages = VK_SHADER_STAGE_COMPUTE_BIT, .elems = planes, }, - { /* dst */ + { /* next */ .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, .stages = VK_SHADER_STAGE_COMPUTE_BIT, .elems = planes, diff --git a/libavfilter/vf_interlace_vulkan.c b/libavfilter/vf_interlace_vulkan.c index 8955dd8a3b..7e40ea1b90 100644 --- a/libavfilter/vf_interlace_vulkan.c +++ b/libavfilter/vf_interlace_vulkan.c @@ -70,6 +70,11 @@ static av_cold int init_filter(AVFilterContext *ctx) sl, (uint32_t []) { 32, 1, planes }, 0); const FFVulkanDescriptorSetBinding desc[] = { + { /* output_img */ + .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, + .stages = VK_SHADER_STAGE_COMPUTE_BIT, + .elems = planes, + }, { /* top_field */ .type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, .stages = VK_SHADER_STAGE_COMPUTE_BIT, @@ -82,11 +87,6 @@ static av_cold int init_filter(AVFilterContext *ctx) .samplers = DUP_SAMPLER(s->sampler), .elems = planes, }, - { /* output_img */ - .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, - .stages = VK_SHADER_STAGE_COMPUTE_BIT, - .elems = planes, - }, }; ff_vk_shader_add_descriptor_set(vkctx, &s->shd, desc, 3, 0); diff --git a/libavfilter/vf_overlay_vulkan.c b/libavfilter/vf_overlay_vulkan.c index dee9d1c794..602a88e879 100644 --- a/libavfilter/vf_overlay_vulkan.c +++ b/libavfilter/vf_overlay_vulkan.c @@ -79,17 +79,17 @@ static av_cold int init_filter(AVFilterContext *ctx) VK_SHADER_STAGE_COMPUTE_BIT); const FFVulkanDescriptorSetBinding desc[] = { - { /* main_img */ + { /* output_img */ .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, .stages = VK_SHADER_STAGE_COMPUTE_BIT, .elems = planes, }, - { /* overlay_img */ + { /* main_img */ .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, .stages = VK_SHADER_STAGE_COMPUTE_BIT, .elems = planes, }, - { /* output_img */ + { /* overlay_img */ .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, .stages = VK_SHADER_STAGE_COMPUTE_BIT, .elems = planes, diff --git a/libavfilter/vf_xfade_vulkan.c b/libavfilter/vf_xfade_vulkan.c index c7e9051cc0..312aeacaef 100644 --- a/libavfilter/vf_xfade_vulkan.c +++ b/libavfilter/vf_xfade_vulkan.c @@ -113,6 +113,10 @@ static av_cold int init_vulkan(AVFilterContext *avctx) NULL, (int []) { 32, 32, 1 }, 0); const FFVulkanDescriptorSetBinding desc[] = { + { /* output_images */ + .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, + .stages = VK_SHADER_STAGE_COMPUTE_BIT, + }, { /* a_images */ .type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, .stages = VK_SHADER_STAGE_COMPUTE_BIT, @@ -123,10 +127,6 @@ static av_cold int init_vulkan(AVFilterContext *avctx) .stages = VK_SHADER_STAGE_COMPUTE_BIT, .samplers = DUP_SAMPLER(s->sampler), }, - { /* output_images */ - .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, - .stages = VK_SHADER_STAGE_COMPUTE_BIT, - }, }; ff_vk_shader_add_descriptor_set(vkctx, &s->shd, desc, 3, 0); diff --git a/libavfilter/vulkan/blend.comp.glsl b/libavfilter/vulkan/blend.comp.glsl index 55b95d77bc..5a8f657791 100644 --- a/libavfilter/vulkan/blend.comp.glsl +++ b/libavfilter/vulkan/blend.comp.glsl @@ -26,9 +26,9 @@ layout (constant_id = 0) const uint planes = 0; layout (local_size_x_id = 253, local_size_y_id = 254, local_size_z_id = 255) in; -layout (set = 0, binding = 0) uniform readonly image2D top_img[]; -layout (set = 0, binding = 1) uniform readonly image2D bottom_img[]; -layout (set = 0, binding = 2) uniform writeonly image2D output_img[]; +layout (set = 0, binding = 0) uniform writeonly image2D output_img[]; +layout (set = 0, binding = 1) uniform readonly image2D top_img[]; +layout (set = 0, binding = 2) uniform readonly image2D bottom_img[]; layout (push_constant, scalar) uniform pushConstants { vec4 opacity; diff --git a/libavfilter/vulkan/bwdif.comp.glsl b/libavfilter/vulkan/bwdif.comp.glsl index d38109a7fc..81eb93c8d7 100644 --- a/libavfilter/vulkan/bwdif.comp.glsl +++ b/libavfilter/vulkan/bwdif.comp.glsl @@ -26,10 +26,10 @@ layout (local_size_x_id = 253, local_size_y_id = 254, local_size_z_id = 255) in; -layout (set = 0, binding = 0) uniform readonly image2D prev[]; -layout (set = 0, binding = 1) uniform readonly image2D cur[]; -layout (set = 0, binding = 2) uniform readonly image2D next[]; -layout (set = 0, binding = 3) uniform writeonly image2D dst[]; +layout (set = 0, binding = 0) uniform writeonly image2D dst[]; +layout (set = 0, binding = 1) uniform readonly image2D prev[]; +layout (set = 0, binding = 2) uniform readonly image2D cur[]; +layout (set = 0, binding = 3) uniform readonly image2D next[]; layout (push_constant, scalar) uniform pushConstants { int parity; diff --git a/libavfilter/vulkan/interlace.comp.glsl b/libavfilter/vulkan/interlace.comp.glsl index 8fe04af4f8..8507ceed6e 100644 --- a/libavfilter/vulkan/interlace.comp.glsl +++ b/libavfilter/vulkan/interlace.comp.glsl @@ -32,9 +32,9 @@ layout (constant_id = 1) const int planes = 0; layout (local_size_x_id = 253, local_size_y_id = 254, local_size_z_id = 255) in; -layout (set = 0, binding = 0) uniform sampler2D top_field[]; -layout (set = 0, binding = 1) uniform sampler2D bot_field[]; -layout (set = 0, binding = 2) uniform writeonly image2D output_img[]; +layout (set = 0, binding = 0) uniform writeonly image2D output_img[]; +layout (set = 0, binding = 1) uniform sampler2D top_field[]; +layout (set = 0, binding = 2) uniform sampler2D bot_field[]; vec4 get_line(sampler2D tex, const vec2 pos) { diff --git a/libavfilter/vulkan/overlay.comp.glsl b/libavfilter/vulkan/overlay.comp.glsl index a7d55a8c01..820a383d69 100644 --- a/libavfilter/vulkan/overlay.comp.glsl +++ b/libavfilter/vulkan/overlay.comp.glsl @@ -29,9 +29,9 @@ layout (constant_id = 1) const bool has_alpha = false; layout (local_size_x_id = 253, local_size_y_id = 254, local_size_z_id = 255) in; -layout (set = 0, binding = 0) uniform readonly image2D main_img[]; -layout (set = 0, binding = 1) uniform readonly image2D overlay_img[]; -layout (set = 0, binding = 2) uniform writeonly image2D output_img[]; +layout (set = 0, binding = 0) uniform writeonly image2D output_img[]; +layout (set = 0, binding = 1) uniform readonly image2D main_img[]; +layout (set = 0, binding = 2) uniform readonly image2D overlay_img[]; layout (push_constant, scalar) uniform pushConstants { ivec2 o_offset[4]; diff --git a/libavfilter/vulkan/xfade.comp.glsl b/libavfilter/vulkan/xfade.comp.glsl index db9c801114..aef121a6b3 100644 --- a/libavfilter/vulkan/xfade.comp.glsl +++ b/libavfilter/vulkan/xfade.comp.glsl @@ -45,9 +45,9 @@ layout (constant_id = 1) const int planes = 0; layout (local_size_x_id = 253, local_size_y_id = 254, local_size_z_id = 255) in; -layout (set = 0, binding = 0) uniform sampler2D a_images[]; -layout (set = 0, binding = 1) uniform sampler2D b_images[]; -layout (set = 0, binding = 2) uniform writeonly image2D output_img[]; +layout (set = 0, binding = 0) uniform writeonly image2D output_img[]; +layout (set = 0, binding = 1) uniform sampler2D a_images[]; +layout (set = 0, binding = 2) uniform sampler2D b_images[]; layout (push_constant, scalar) uniform pushConstants { float progress; diff --git a/libavfilter/vulkan_filter.c b/libavfilter/vulkan_filter.c index 437b9d8c63..7b06a32c8d 100644 --- a/libavfilter/vulkan_filter.c +++ b/libavfilter/vulkan_filter.c @@ -445,11 +445,11 @@ int ff_vk_filter_process_Nin(FFVulkanContext *vkctx, FFVkExecPool *e, } /* Update descriptor sets */ - ff_vk_shader_update_img_array(vkctx, exec, shd, out, out_views, 0, nb_in, + ff_vk_shader_update_img_array(vkctx, exec, shd, out, out_views, 0, 0, VK_IMAGE_LAYOUT_GENERAL, VK_NULL_HANDLE); for (int i = 0; i < nb_in; i++) - ff_vk_shader_update_img_array(vkctx, exec, shd, in[i], in_views[i], 0, i, + ff_vk_shader_update_img_array(vkctx, exec, shd, in[i], in_views[i], 0, 1 + i, in_layout, sampler); diff --git a/libavfilter/vulkan_filter.h b/libavfilter/vulkan_filter.h index c54c8c56c4..ec3ce945ed 100644 --- a/libavfilter/vulkan_filter.h +++ b/libavfilter/vulkan_filter.h @@ -57,7 +57,7 @@ int ff_vk_filter_process_2pass(FFVulkanContext *vkctx, FFVkExecPool *e, void *push_src, size_t push_size); /** - * Up to 16 inputs, one output + * Up to 16 inputs, one output. Output at binding 0, inputs at 1 + i. */ int ff_vk_filter_process_Nin(FFVulkanContext *vkctx, FFVkExecPool *e, FFVulkanShader *shd, -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
