History

vulkan_filter: require storage images properly, set usage flags explicitly

This caused images to be created without a storage usage, which broke at least lavapipe.

Lynne committed 2 years ago

Commit eb5088d1 parent c41ef7f1 file · +10 −1Browse files

Unified · Split

libavfilter/vulkan_filter.c+10−1
@@ -68,7 +68,8 @@ int ff_vk_filter_init_context(AVFilterContext *avctx, FFVulkanContext *s, · 67 unmodified lines
68 vk = &s->vkfn;68 vk = &s->vkfn;
69 69
70 /* Usage mismatch */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 /* If format supports hardware encoding, make sure74 /* If format supports hardware encoding, make sure
74 * the context includes it. */75 * the context includes it. */
@@ -106,9 +107,11 @@ int ff_vk_filter_init_context(AVFilterContext *avctx, FFVulkanContext *s, · 31 unmodified lines
106 /* Check if it's usable */107 /* Check if it's usable */
107 if (no_storage) {108 if (no_storage) {
108skip:109skip:
110 av_log(avctx, AV_LOG_VERBOSE, "Cannot reuse context, creating a new one\n");
109 device_ref = frames_ctx->device_ref;111 device_ref = frames_ctx->device_ref;
110 frames_ref = NULL;112 frames_ref = NULL;
111 } else {113 } else {
114 av_log(avctx, AV_LOG_VERBOSE, "Reusing existing frames context\n");
112 frames_ref = av_buffer_ref(frames_ref);115 frames_ref = av_buffer_ref(frames_ref);
113 if (!frames_ref)116 if (!frames_ref)
114 return AVERROR(ENOMEM);117 return AVERROR(ENOMEM);
@@ -130,6 +133,12 @@ skip: · 15 unmodified lines
130 frames_ctx->width = width;133 frames_ctx->width = width;
131 frames_ctx->height = height;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 err = av_hwframe_ctx_init(frames_ref);142 err = av_hwframe_ctx_init(frames_ref);
134 if (err < 0) {143 if (err < 0) {
135 av_buffer_unref(&frames_ref);144 av_buffer_unref(&frames_ref);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t