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.
This commit is contained in:
Niklas Haas 2017-10-01 01:42:06 +02:00 committed by Martin Herkt
parent 2d1769a534
commit a6aab5dfd6
1 changed files with 7 additions and 2 deletions

View File

@ -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)