mirror of
https://github.com/PancakeTAS/lsfg-vk.git
synced 2025-10-30 07:01:10 +00:00
fence support in commandbuffer
This commit is contained in:
parent
d3f5d87d61
commit
20fcab9a88
2 changed files with 5 additions and 3 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#define COMMANDBUFFER_HPP
|
||||
|
||||
#include "core/commandpool.hpp"
|
||||
#include "core/fence.hpp"
|
||||
#include "core/semaphore.hpp"
|
||||
#include "device.hpp"
|
||||
|
||||
|
|
@ -65,6 +66,7 @@ namespace Vulkan::Core {
|
|||
/// Submit the command buffer to a queue.
|
||||
///
|
||||
/// @param queue Vulkan queue to submit to
|
||||
/// @param fence Optional fence to signal when the command buffer has finished executing
|
||||
/// @param waitSemaphores Semaphores to wait on before executing the command buffer
|
||||
/// @param waitSemaphoreValues Values for the semaphores to wait on
|
||||
/// @param signalSemaphores Semaphores to signal after executing the command buffer
|
||||
|
|
@ -74,7 +76,7 @@ namespace Vulkan::Core {
|
|||
/// @throws std::logic_error if the command buffer is not in Full state.
|
||||
/// @throws ls::vulkan_error if submission fails.
|
||||
///
|
||||
void submit(VkQueue queue, // TODO: fence
|
||||
void submit(VkQueue queue, std::optional<Fence> fence,
|
||||
const std::vector<Semaphore>& waitSemaphores = {},
|
||||
std::optional<std::vector<uint64_t>> waitSemaphoreValues = std::nullopt,
|
||||
const std::vector<Semaphore>& signalSemaphores = {},
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ void CommandBuffer::end() {
|
|||
*this->state = CommandBufferState::Full;
|
||||
}
|
||||
|
||||
void CommandBuffer::submit(VkQueue queue,
|
||||
void CommandBuffer::submit(VkQueue queue, std::optional<Fence> fence,
|
||||
const std::vector<Semaphore>& waitSemaphores,
|
||||
std::optional<std::vector<uint64_t>> waitSemaphoreValues,
|
||||
const std::vector<Semaphore>& signalSemaphores,
|
||||
|
|
@ -106,7 +106,7 @@ void CommandBuffer::submit(VkQueue queue,
|
|||
.signalSemaphoreCount = static_cast<uint32_t>(signalSemaphores.size()),
|
||||
.pSignalSemaphores = signalSemaphoresHandles.data()
|
||||
};
|
||||
auto res = vkQueueSubmit(queue, 1, &submitInfo, VK_NULL_HANDLE);
|
||||
auto res = vkQueueSubmit(queue, 1, &submitInfo, fence ? fence->handle() : VK_NULL_HANDLE);
|
||||
if (res != VK_SUCCESS)
|
||||
throw ls::vulkan_error(res, "Unable to submit command buffer");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue