This caused images to be created without a storage usage, which broke at least lavapipe.
Unified · Split
| @@ -68,7 +68,8 @@ int ff_vk_filter_init_context(AVFilterContext *avctx, FFVulkanContext *s, · 67 unmodified lines | ||
| 68 | 68 | vk = &s->vkfn; |
| 69 | 69 | |
| 70 | 70 | /* Usage mismatch */ |
| 71 | − usage_req = VK_IMAGE_USAGE_SAMPLED_BIT; | |
| 71 | + usage_req = VK_IMAGE_USAGE_SAMPLED_BIT | | |
| 72 | + VK_IMAGE_USAGE_STORAGE_BIT; | |
| 72 | 73 | |
| 73 | 74 | /* If format supports hardware encoding, make sure |
| 74 | 75 | * the context includes it. */ |
| @@ -106,9 +107,11 @@ int ff_vk_filter_init_context(AVFilterContext *avctx, FFVulkanContext *s, · 31 unmodified lines | ||
| 106 | 107 | /* Check if it's usable */ |
| 107 | 108 | if (no_storage) { |
| 108 | 109 | skip: |
| 110 | + av_log(avctx, AV_LOG_VERBOSE, "Cannot reuse context, creating a new one\n"); | |
| 109 | 111 | device_ref = frames_ctx->device_ref; |
| 110 | 112 | frames_ref = NULL; |
| 111 | 113 | } else { |
| 114 | + av_log(avctx, AV_LOG_VERBOSE, "Reusing existing frames context\n"); | |
| 112 | 115 | frames_ref = av_buffer_ref(frames_ref); |
| 113 | 116 | if (!frames_ref) |
| 114 | 117 | return AVERROR(ENOMEM); |
| @@ -130,6 +133,12 @@ skip: · 15 unmodified lines | ||
| 130 | 133 | frames_ctx->width = width; |
| 131 | 134 | frames_ctx->height = height; |
| 132 | 135 | |
| 136 | + vk_frames = frames_ctx->hwctx; | |
| 137 | + vk_frames->tiling = VK_IMAGE_TILING_OPTIMAL; | |
| 138 | + vk_frames->usage = VK_IMAGE_USAGE_SAMPLED_BIT | | |
| 139 | + VK_IMAGE_USAGE_STORAGE_BIT | | |
| 140 | + VK_IMAGE_USAGE_TRANSFER_SRC_BIT; | |
| 141 | + | |
| 133 | 142 | err = av_hwframe_ctx_init(frames_ref); |
| 134 | 143 | if (err < 0) { |
| 135 | 144 | av_buffer_unref(&frames_ref); |