feat(frame-pacing): submit command buffers from optional queue

This commit is contained in:
PancakeTAS 2025-12-31 11:09:18 +01:00
parent e1f89cc1da
commit dec803f98d
No known key found for this signature in database
2 changed files with 4 additions and 3 deletions

View file

@ -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<VkSemaphore> waitSemaphores,
VkSemaphore waitTimelineSemaphore, uint64_t waitValue,
std::vector<VkSemaphore> 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

View file

@ -204,7 +204,7 @@ void CommandBuffer::submit(const vk::Vulkan& vk,
VkSemaphore waitTimelineSemaphore, uint64_t waitValue,
std::vector<VkSemaphore> 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<uint32_t>(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");
}