]> git.sesse.net Git - ffmpeg/commitdiff
hwcontext_vulkan: do not OR the user-specified usage with our default flags
authorLynne <dev@lynne.ee>
Thu, 14 May 2020 23:16:58 +0000 (00:16 +0100)
committerLynne <dev@lynne.ee>
Sat, 23 May 2020 18:07:41 +0000 (19:07 +0100)
Some users may need special formats that aren't available when the STORAGE
flag bit is set, which would result in allocations failing.

libavutil/hwcontext_vulkan.c
libavutil/hwcontext_vulkan.h

index 47feff43dc1443b3e840ae50b7b56aadbedb48cf..9374b8663286a844f763c8f30cd4fb4fd7db0890 100644 (file)
@@ -1703,7 +1703,8 @@ static int vulkan_frames_init(AVHWFramesContext *hwfc)
     hwctx->tiling = hwctx->tiling ? hwctx->tiling : p->use_linear_images ?
                     VK_IMAGE_TILING_LINEAR : VK_IMAGE_TILING_OPTIMAL;
 
-    hwctx->usage |= DEFAULT_USAGE_FLAGS;
+    if (!hwctx->usage)
+        hwctx->usage = DEFAULT_USAGE_FLAGS;
 
     err = create_exec_ctx(hwfc->device_ctx, &fp->conv_ctx,
                           dev_hwctx->queue_family_comp_index,
index 656411e0a8275bbcc23f1219492cbe6e01376263..0ac34658b2a19ab1c43f4ad55289821f08c3d914 100644 (file)
@@ -112,8 +112,8 @@ typedef struct AVVulkanFramesContext {
      */
     VkImageTiling tiling;
     /**
-     * Defines extra usage of output frames. This is bitwise OR'd with the
-     * standard usage flags (SAMPLED, STORAGE, TRANSFER_SRC and TRANSFER_DST).
+     * Defines extra usage of output frames. If left as 0, the following bits
+     * are set: TRANSFER_SRC, TRANSFER_DST. SAMPLED and STORAGE.
      */
     VkImageUsageFlagBits usage;
     /**