From 2239f019876a7cbe4305255c0835b5b85518798e Mon Sep 17 00:00:00 2001 From: kuba Date: Sun, 4 Oct 2026 19:41:35 +0200 Subject: [PATCH] [Vk] Run async readbacks on a second general queue family when no dedicated one exists The async readback queue was only taken from a family without graphics, so drivers that expose several general families (each its own hardware queue) kept every guest readback on the main queue and the command worker. Any other family with transfer support now qualifies after the dedicated transfer and compute families. (cherry picked from commit 7b04d6185dfc1711f0fbdf5c75c842a065acd1fa) --- .../VideoOut/VulkanVideoPresenter.Device.Setup.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/SharpEmu.Libs/VideoOut/VulkanVideoPresenter.Device.Setup.cs b/src/SharpEmu.Libs/VideoOut/VulkanVideoPresenter.Device.Setup.cs index 7f5333f..da40015 100644 --- a/src/SharpEmu.Libs/VideoOut/VulkanVideoPresenter.Device.Setup.cs +++ b/src/SharpEmu.Libs/VideoOut/VulkanVideoPresenter.Device.Setup.cs @@ -684,6 +684,7 @@ internal static unsafe partial class VulkanVideoPresenter } uint? compute = null; + uint? general = null; for (uint index = 0; index < count; index++) { var flags = families[index].QueueFlags; @@ -701,9 +702,16 @@ internal static unsafe partial class VulkanVideoPresenter { compute ??= index; } + + // MoltenVK exposes only general families, one queue each, every one its own + // Metal command queue: a second one still runs readbacks beside the main queue. + if ((flags & (QueueFlags.TransferBit | QueueFlags.GraphicsBit | QueueFlags.ComputeBit)) != 0) + { + general ??= index; + } } - return compute; + return compute ?? general; } private bool _supportsFragmentShaderBarycentric;