diff options
author | Lynne <dev@lynne.ee> | 2024-10-16 12:06:12 +0200 |
---|---|---|
committer | Lynne <dev@lynne.ee> | 2024-10-16 12:48:16 +0200 |
commit | 931d45d4d6aa34629e38066154bdea395fd83035 (patch) | |
tree | 2c498e3d4eb2dc86b9780c3a556412b91dc987dd | |
parent | 4b128de44a8df2c7792b800d77024eafc5c16f08 (diff) | |
download | ffmpeg-931d45d4d6aa34629e38066154bdea395fd83035.tar.gz |
vulkan: do not create imageviews with video encode/decode usage
This function is only used for filtering and generic compute.
The issue is that a view inherits the usage flags from the image
by default, and the spec says the view format must be compatible
with the usage. VkImageViewUsageCreateInfo allows us to filter out
the indeded uses of the imageview.
Pffff.
-rw-r--r-- | libavutil/vulkan.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c index 11884fbd50..dd5e0f0e2b 100644 --- a/libavutil/vulkan.c +++ b/libavutil/vulkan.c @@ -1553,6 +1553,7 @@ int ff_vk_create_imageviews(FFVulkanContext *s, FFVkExecContext *e, AVBufferRef *buf; FFVulkanFunctions *vk = &s->vkfn; AVHWFramesContext *hwfc = (AVHWFramesContext *)f->hw_frames_ctx->data; + AVVulkanFramesContext *vkfc = hwfc->hwctx; const VkFormat *rep_fmts = av_vkfmt_from_pixfmt(hwfc->sw_format); AVVkFrame *vkf = (AVVkFrame *)f->data[0]; const int nb_images = ff_vk_count_images(vkf); @@ -1570,9 +1571,15 @@ int ff_vk_create_imageviews(FFVulkanContext *s, FFVkExecContext *e, VK_IMAGE_ASPECT_PLANE_1_BIT, VK_IMAGE_ASPECT_PLANE_2_BIT, }; + VkImageViewUsageCreateInfo view_usage_info = { + .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO, + .usage = vkfc->usage & + (~(VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR | + VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR)), + }; VkImageViewCreateInfo view_create_info = { .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, - .pNext = NULL, + .pNext = &view_usage_info, .image = vkf->img[FFMIN(i, nb_images - 1)], .viewType = VK_IMAGE_VIEW_TYPE_2D, .format = map_fmt_to_rep(rep_fmts[i], rep_fmt), |