summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.xyz>2017-10-01 01:42:06 +0200
committerMartin Herkt <652892+lachs0r@users.noreply.github.com>2017-12-25 00:47:53 +0100
commita6aab5dfd6d94be4e2a07c2bf6044f621b28e631 (patch)
tree0f3be5b8eb5a83e5cd508ccb7ee3648470003e39 /video/out
parent2d1769a5348ee320b07779177526754f92e624a1 (diff)
downloadmpv-a6aab5dfd6d94be4e2a07c2bf6044f621b28e631.tar.bz2
mpv-a6aab5dfd6d94be4e2a07c2bf6044f621b28e631.tar.xz
vo_gpu: vulkan: refine queue family selection algorithm
This gets confused by e.g. SPARSE_BIT on the TRANSFER_BIT, leading to situations where "more specialized" is ambiguous and the logic breaks down. So to fix it, only compare the subset we care about.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/vulkan/utils.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/video/out/vulkan/utils.c b/video/out/vulkan/utils.c
index cb73e7d8ac..3dfb825032 100644
--- a/video/out/vulkan/utils.c
+++ b/video/out/vulkan/utils.c
@@ -395,8 +395,13 @@ static int find_qf(VkQueueFamilyProperties *qfs, int qfnum, VkQueueFlags flags)
if (!(qfs[i].queueFlags & flags))
continue;
- // QF is more specialized
- if (idx < 0 || qfs[i].queueFlags < qfs[idx].queueFlags)
+ // QF is more specialized. Since we don't care about other bits like
+ // SPARSE_BIT, mask the ones we're interestew in
+ const VkQueueFlags mask = VK_QUEUE_GRAPHICS_BIT |
+ VK_QUEUE_TRANSFER_BIT |
+ VK_QUEUE_COMPUTE_BIT;
+
+ if (idx < 0 || (qfs[i].queueFlags & mask) < (qfs[idx].queueFlags & mask))
idx = i;
// QF has more queues (at the same specialization level)