summaryrefslogtreecommitdiffstats
path: root/video/out/vulkan/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/vulkan/utils.c')
-rw-r--r--video/out/vulkan/utils.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/video/out/vulkan/utils.c b/video/out/vulkan/utils.c
index 3dfb825032..5b9be3216f 100644
--- a/video/out/vulkan/utils.c
+++ b/video/out/vulkan/utils.c
@@ -455,9 +455,12 @@ bool mpvk_device_init(struct mpvk_ctx *vk, struct mpvk_device_opts opts)
(unsigned)qfs[i].queueFlags, (int)qfs[i].queueCount);
}
- int idx_gfx = find_qf(qfs, qfnum, VK_QUEUE_GRAPHICS_BIT),
- idx_comp = find_qf(qfs, qfnum, VK_QUEUE_COMPUTE_BIT),
- idx_tf = find_qf(qfs, qfnum, VK_QUEUE_TRANSFER_BIT);
+ int idx_gfx = -1, idx_comp = -1, idx_tf = -1;
+ idx_gfx = find_qf(qfs, qfnum, VK_QUEUE_GRAPHICS_BIT);
+ if (opts.async_compute)
+ idx_comp = find_qf(qfs, qfnum, VK_QUEUE_COMPUTE_BIT);
+ if (opts.async_transfer)
+ idx_tf = find_qf(qfs, qfnum, VK_QUEUE_TRANSFER_BIT);
// Vulkan requires at least one GRAPHICS queue, so if this fails something
// is horribly wrong.
@@ -477,6 +480,11 @@ bool mpvk_device_init(struct mpvk_ctx *vk, struct mpvk_device_opts opts)
if (idx_comp >= 0 && idx_comp != idx_gfx)
MP_VERBOSE(vk, "Using async compute (QF %d)\n", idx_comp);
+ // Fall back to supporting compute shaders via the graphics pool for
+ // devices which support compute shaders but not async compute.
+ if (idx_comp < 0 && qfs[idx_gfx].queueFlags & VK_QUEUE_COMPUTE_BIT)
+ idx_comp = idx_gfx;
+
// Now that we know which QFs we want, we can create the logical device
VkDeviceQueueCreateInfo *qinfos = NULL;
int num_qinfos = 0;