History

hwcontext_vulkan: properly support STORAGE usage for mutliplane images

Fixes multiplane support on Nvidia. Also, remove the ENCODE usage, even if the driver signals it as supported. Currently, it's not used, and when it is used, it'll be gated behind two extension checks.

Lynne committed 3 years ago

Commit 81cc0e11 parent 2a36e442 files · +39 −21Browse files

Showing the changes to libavfilter (1 of 2 files). Show all

Unified · Split

libavfilter/vulkan_filter.c+15−9
@@ -42,18 +42,23 @@ int ff_vk_filter_init_context(AVFilterContext *avctx, FFVulkanContext *s, · 41 unmodified lines
42 vk_frames = frames_ctx->hwctx;42 vk_frames = frames_ctx->hwctx;
43 vk_dev = device_ctx->hwctx;43 vk_dev = device_ctx->hwctx;
44 44
45 /* Basic format validation */45 /* Width and height mismatch */
46 if (width != frames_ctx->width ||46 if (width != frames_ctx->width ||
47 height != frames_ctx->height ||47 height != frames_ctx->height)
48 sw_format != frames_ctx->sw_format ||48 goto skip;
49 (vk_frames->tiling != VK_IMAGE_TILING_LINEAR &&49
50 vk_frames->tiling != VK_IMAGE_TILING_OPTIMAL) ||50 /* Format mismatch */
51 !(vk_frames->usage & VK_IMAGE_USAGE_SAMPLED_BIT)) {51 if (sw_format != frames_ctx->sw_format)
52 goto skip;52 goto skip;
53 }
54 53
55 if (vk_frames->usage & VK_IMAGE_USAGE_STORAGE_BIT)54 /* Unusual tiling mismatch. Don't let linear through either. */
56 goto accept;55 if (vk_frames->tiling != VK_IMAGE_TILING_OPTIMAL)
56 goto skip;
57
58 /* Usage mismatch */
59 if ((vk_frames->usage & (VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT)) !=
60 (VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT))
61 goto skip;
57 62
58 s->extensions = ff_vk_extensions_to_mask(vk_dev->enabled_dev_extensions,63 s->extensions = ff_vk_extensions_to_mask(vk_dev->enabled_dev_extensions,
59 vk_dev->nb_enabled_dev_extensions);64 vk_dev->nb_enabled_dev_extensions);
@@ -110,6 +115,7 @@ accept: · 50 unmodified lines
110 vk_frames = frames_ctx->hwctx;115 vk_frames = frames_ctx->hwctx;
111 vk_frames->tiling = VK_IMAGE_TILING_OPTIMAL;116 vk_frames->tiling = VK_IMAGE_TILING_OPTIMAL;
112 vk_frames->usage = VK_IMAGE_USAGE_SAMPLED_BIT |117 vk_frames->usage = VK_IMAGE_USAGE_SAMPLED_BIT |
118 VK_IMAGE_USAGE_STORAGE_BIT |
113 VK_IMAGE_USAGE_TRANSFER_SRC_BIT |119 VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
114 VK_IMAGE_USAGE_TRANSFER_DST_BIT;120 VK_IMAGE_USAGE_TRANSFER_DST_BIT;
115 121

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