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
4242 vk_frames = frames_ctx->hwctx;
4343 vk_dev = device_ctx->hwctx;
4444
45− /* Basic format validation */
45+ /* Width and height mismatch */
4646 if (width != frames_ctx->width ||
47− height != frames_ctx->height ||
48− sw_format != frames_ctx->sw_format ||
49− (vk_frames->tiling != VK_IMAGE_TILING_LINEAR &&
50− vk_frames->tiling != VK_IMAGE_TILING_OPTIMAL) ||
51− !(vk_frames->usage & VK_IMAGE_USAGE_SAMPLED_BIT)) {
47+ height != frames_ctx->height)
48+ goto skip;
49+
50+ /* Format mismatch */
51+ if (sw_format != frames_ctx->sw_format)
5252 goto skip;
53− }
5453
55− if (vk_frames->usage & VK_IMAGE_USAGE_STORAGE_BIT)
56− goto accept;
54+ /* Unusual tiling mismatch. Don't let linear through either. */
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;
5762
5863 s->extensions = ff_vk_extensions_to_mask(vk_dev->enabled_dev_extensions,
5964 vk_dev->nb_enabled_dev_extensions);
@@ -110,6 +115,7 @@ accept: · 50 unmodified lines
110115 vk_frames = frames_ctx->hwctx;
111116 vk_frames->tiling = VK_IMAGE_TILING_OPTIMAL;
112117 vk_frames->usage = VK_IMAGE_USAGE_SAMPLED_BIT |
118+ VK_IMAGE_USAGE_STORAGE_BIT |
113119 VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
114120 VK_IMAGE_USAGE_TRANSFER_DST_BIT;
115121

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