[FFmpeg-devel] [PATCH 2/7] avutil/vulkan: automatically enable shader device address usage bit

Niklas Haas ffmpeg at haasn.xyz
Fri May 23 15:14:15 EEST 2025


On Thu, 22 May 2025 06:32:18 +0900 Lynne <dev at lynne.ee> wrote:
> On 18/05/2025 21:11, Niklas Haas wrote:
> > From: Niklas Haas <git at haasn.dev>
> >
> > We require this internally when using descriptor buffers, so it makes sense
> > to enable it internally, also.
> > ---
> >   libavutil/vulkan.c | 3 +++
> >   1 file changed, 3 insertions(+)
> >
> > diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c
> > index 5f2ac6267d..97c008c809 100644
> > --- a/libavutil/vulkan.c
> > +++ b/libavutil/vulkan.c
> > @@ -989,6 +989,9 @@ int ff_vk_create_buf(FFVulkanContext *s, FFVkBuffer *buf, size_t size,
> >       int use_ded_mem;
> >       FFVulkanFunctions *vk = &s->vkfn;
> >
> > +    if (s->extensions & FF_VK_EXT_DESCRIPTOR_BUFFER)
> > +        usage |= VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT;
>
> You should omit the flag if the usage contains
> VK_BUFFER_USAGE_VIDEO_DECODE_SRC_BIT_KHR or
> VK_BUFFER_USAGE_VIDEO_ENCODE_DST_BIT_KHR, since its not used there.

I think a more robust logic would be to emit the flag only if the usage
contains any type that implies a descriptor (e.g. storage buffer, uniform
buffer, etc).

>
> > +
> >       VkBufferCreateInfo buf_spawn = {
> >           .sType       = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
> >           .pNext       = pNext,
>
> Apart from that, okay.

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list