From dec803f98d7a2bcfebe5f326ff5f97654a8df440 Mon Sep 17 00:00:00 2001 From: PancakeTAS Date: Wed, 31 Dec 2025 11:09:18 +0100 Subject: [PATCH] feat(frame-pacing): submit command buffers from optional queue --- .../include/lsfg-vk-common/vulkan/command_buffer.hpp | 3 ++- lsfg-vk-common/src/vulkan/command_buffer.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lsfg-vk-common/include/lsfg-vk-common/vulkan/command_buffer.hpp b/lsfg-vk-common/include/lsfg-vk-common/vulkan/command_buffer.hpp index 0129238..2456172 100644 --- a/lsfg-vk-common/include/lsfg-vk-common/vulkan/command_buffer.hpp +++ b/lsfg-vk-common/include/lsfg-vk-common/vulkan/command_buffer.hpp @@ -84,13 +84,14 @@ namespace vk { /// @param signalTimelineSemaphore the timeline semaphore to signal /// @param signalValue the value to signal /// @param fence optional fence to signal on completion + /// @param queue optional queue to submit to /// @throws ls::vulkan_error on failure void submit(const vk::Vulkan& vk, std::vector waitSemaphores, VkSemaphore waitTimelineSemaphore, uint64_t waitValue, std::vector signalSemaphores, VkSemaphore signalTimelineSemaphore, uint64_t signalValue, - VkFence fence = VK_NULL_HANDLE) const; + VkFence fence = VK_NULL_HANDLE, VkQueue queue = VK_NULL_HANDLE) const; /// submit the command buffer instantly /// @param vk the vulkan instance diff --git a/lsfg-vk-common/src/vulkan/command_buffer.cpp b/lsfg-vk-common/src/vulkan/command_buffer.cpp index cac4732..a3baee5 100644 --- a/lsfg-vk-common/src/vulkan/command_buffer.cpp +++ b/lsfg-vk-common/src/vulkan/command_buffer.cpp @@ -204,7 +204,7 @@ void CommandBuffer::submit(const vk::Vulkan& vk, VkSemaphore waitTimelineSemaphore, uint64_t waitValue, std::vector signalSemaphores, VkSemaphore signalTimelineSemaphore, uint64_t signalValue, - VkFence fence) const { + VkFence fence, VkQueue queue) const { // create arrays of semaphores and values if (waitTimelineSemaphore) waitSemaphores.push_back(waitTimelineSemaphore); @@ -239,7 +239,7 @@ void CommandBuffer::submit(const vk::Vulkan& vk, .signalSemaphoreCount = static_cast(signalSemaphores.size()), .pSignalSemaphores = signalSemaphores.data() }; - auto res = vk.df().QueueSubmit(vk.queue(), 1, &submitInfo, fence); + auto res = vk.df().QueueSubmit(queue ? queue : vk.queue(), 1, &submitInfo, fence); if (res != VK_SUCCESS) throw ls::vulkan_error(res, "vkQueueSubmit() failed"); }