This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit d42cd604d02c920c8c9bf2a8d8b9962a122044e2 Author: Lynne <[email protected]> AuthorDate: Sun Jul 26 19:10:08 2026 +0800 Commit: Lynne <[email protected]> CommitDate: Sun Aug 2 22:11:27 2026 +0900 vulkan_ffv1: always keep the decoder's fltmap descriptor valid The setup shader statically uses the fltmap binding, but the decoder only bound a buffer to it for float formats, leaving a dangling descriptor on everything else, with the write reachable by any bitstream signalling remap. Gate remap on a new push-constant flag, so that streams signalling it without a fltmap buffer error out, and point the descriptor at the slice feedback buffer when no fltmap exists; the gate guarantees it is never written through this binding. --- libavcodec/ffv1_vulkan.h | 3 +++ libavcodec/vulkan/ffv1_common.glsl | 3 +++ libavcodec/vulkan/ffv1_dec_setup.comp.glsl | 11 +++++++++-- libavcodec/vulkan_ffv1.c | 16 +++++++++------- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/libavcodec/ffv1_vulkan.h b/libavcodec/ffv1_vulkan.h index d6ae0f3fee..fd69acf0a1 100644 --- a/libavcodec/ffv1_vulkan.h +++ b/libavcodec/ffv1_vulkan.h @@ -49,6 +49,9 @@ typedef struct FFv1ShaderParams { int pic_mode; uint32_t slice_size_max; uint32_t max_pixels_per_slice; + + /* Decoder-only */ + uint32_t remap_allowed; } FFv1ShaderParams; #endif /* AVCODEC_FFV1_VULKAN_H */ diff --git a/libavcodec/vulkan/ffv1_common.glsl b/libavcodec/vulkan/ffv1_common.glsl index 36bce88a4a..57331c814b 100644 --- a/libavcodec/vulkan/ffv1_common.glsl +++ b/libavcodec/vulkan/ffv1_common.glsl @@ -76,6 +76,9 @@ layout (push_constant, scalar) uniform pushConstants { int pic_mode; uint slice_size_max; uint max_pixels_per_slice; + + /* Decoder-only */ + bool remap_allowed; }; #include "rangecoder.glsl" diff --git a/libavcodec/vulkan/ffv1_dec_setup.comp.glsl b/libavcodec/vulkan/ffv1_dec_setup.comp.glsl index ea84da6d4e..f7ccf461fa 100644 --- a/libavcodec/vulkan/ffv1_dec_setup.comp.glsl +++ b/libavcodec/vulkan/ffv1_dec_setup.comp.glsl @@ -202,8 +202,15 @@ bool decode_slice_header(uint slice_idx, inout SliceContext sc) if (micro_version >= 4) { sc.remap = get_usymbol(0); - if (sc.remap != 0 && decode_remap(slice_idx, sc)) - return true; + if (sc.remap != 0) { + /* No fltmap buffer is bound unless the format can remap */ + if (!remap_allowed) { + sc.remap = 0; + return true; + } + if (decode_remap(slice_idx, sc)) + return true; + } } } diff --git a/libavcodec/vulkan_ffv1.c b/libavcodec/vulkan_ffv1.c index d9a6aa1e3a..c331839e37 100644 --- a/libavcodec/vulkan_ffv1.c +++ b/libavcodec/vulkan_ffv1.c @@ -347,13 +347,14 @@ static int vk_ffv1_end_frame(AVCodecContext *avctx) 2*f->slice_count*sizeof(uint32_t), VK_WHOLE_SIZE, VK_FORMAT_UNDEFINED); - if (fltmap_buf) - ff_vk_shader_update_desc_buffer(&ctx->s, exec, &fv->setup, - 1, 3, 0, - fltmap_buf, - 0, - VK_WHOLE_SIZE, - VK_FORMAT_UNDEFINED); + /* The binding is statically used by the shader, so it must always hold + * a valid buffer. */ + ff_vk_shader_update_desc_buffer(&ctx->s, exec, &fv->setup, + 1, 3, 0, + fltmap_buf ? fltmap_buf : slice_feedback, + 0, + VK_WHOLE_SIZE, + VK_FORMAT_UNDEFINED); ff_vk_exec_bind_shader(&ctx->s, exec, &fv->setup); @@ -367,6 +368,7 @@ static int vk_ffv1_end_frame(AVCodecContext *avctx) .key_frame = f->picture.f->flags & AV_FRAME_FLAG_KEY, .crcref = f->crcref, .micro_version = f->micro_version, + .remap_allowed = !!fltmap_buf, }; for (int i = 0; i < f->quant_table_count; i++) { _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
