10#include "evan/EvanPlatform.hpp"
12#include "evan/ADeviceBackend.hpp"
13#include "evan/DeviceContext.hpp"
15#include <utility/logging/loggable.hpp>
16#include <utility/logging/default_logger.hpp>
41 protected utility::logging::Loggable<Frame,
42 utility::logging::DefaultLogger>
110 Frame(std::shared_ptr<DeviceContext> deviceContext,
111 std::size_t perFrameSlotCount);
Abstract base class for Vulkan device backends.
Frame class representing a single frame of rendering in the Vulkan application.
VkBuffer _indirectBuffer
Vulkan buffer storing indirect draw commands.
void * getUniformBufferMapped(std::size_t viewSlot) const
Gets the mapped CPU pointer of a view's uniform slot.
VkCommandBuffer getCommandBuffer(std::size_t viewSlot) const
Gets the command buffer of the given view slot.
void cleanup()
Releases the synchronization objects, command buffer and uniform buffer owned by this frame.
bool hasTimestampQueries() const noexcept
Indicates whether this frame owns GPU timestamp queries.
VkDeviceSize getIndirectBufferAlignedSize() const
Gets the aligned byte size of one indirect buffer slot.
VkQueryPool _timestampQueryPool
void createTimestampQueryPool(VkDevice device)
Creates the timestamp query pool for this frame.
std::vector< VkCommandBuffer > _commandBuffers
VkDeviceSize _uniformBufferAlignedSize
Aligned byte size of one view's uniform buffer slot.
void createSyncObjects(VkDevice device)
Creates the synchronization objects for this frame.
void createInstanceBuffer(const ADeviceBackend &deviceBackend)
Creates the instance buffer for this frame.
VkBuffer getUniformBuffer() const
Gets the Vulkan uniform buffer associated with this frame.
VkDeviceSize getUniformBufferAlignedSize() const
Gets the aligned byte size of one uniform buffer slot.
void createIndirectBuffer(const ADeviceBackend &deviceBackend)
Creates the indirect draw buffer for this frame.
void createCommandBuffer(VkDevice device, VkCommandPool commandPool)
Creates the Vulkan command buffer for this frame.
VkBuffer _uniformBuffer
Vulkan buffer for the uniform buffer object (UBO) used in this frame.
void destroy(VkDevice device)
Destroys the Vulkan resources associated with this frame.
std::size_t getPerFrameSlotCount() const
Gets the number of view/swapchain slots this frame was allocated for.
std::shared_ptr< DeviceContext > _deviceContext
The device context used to create this frame, kept alive for the lifetime of the frame so that cleanu...
std::size_t _perFrameSlotCount
VkDeviceMemory _instanceBufferMemory
Vulkan device memory associated with the instance buffer.
void createUniformBuffer(const ADeviceBackend &deviceBackend)
Creates the uniform buffer for this frame.
std::size_t getInstanceCapacity() const
Gets the number of model matrices one instance slot holds.
void * _instanceBufferMapped
Pointer to the mapped memory of the instance buffer.
VkDeviceSize _instanceBufferAlignedSize
Aligned byte size of one view's instance buffer slot.
Frame(std::shared_ptr< DeviceContext > deviceContext, std::size_t perFrameSlotCount)
Constructs a Frame object.
std::vector< VkSemaphore > _renderFinished
void * _indirectBufferMapped
Pointer to the mapped memory of the indirect buffer.
void * getInstanceBufferMapped(std::size_t viewSlot) const
Gets the mapped CPU pointer of a view's instance slot.
void resetCommandBuffer(std::size_t viewSlot)
Resets the command buffer of the given view slot.
VkBuffer getIndirectBuffer() const
Gets the Vulkan indirect draw buffer associated with this frame.
bool ensureInstanceCapacity(std::size_t transforms)
Makes sure one instance slot can hold transforms matrices.
VkBuffer _instanceBuffer
Vulkan buffer storing per-instance model matrices.
VkBuffer getInstanceBuffer() const
Gets the Vulkan instance buffer associated with this frame.
VkDeviceMemory _indirectBufferMemory
Vulkan device memory associated with the indirect buffer.
void * _uniformBufferMapped
Pointer to the mapped memory of the uniform buffer.
VkDeviceSize _indirectBufferAlignedSize
Aligned byte size of one view's indirect buffer slot.
VkDeviceMemory _uniformBufferMemory
Vulkan device memory associated with the uniform buffer.
VkQueryPool getTimestampQueryPool() const noexcept
Gets the timestamp query pool of this frame.
std::size_t _instanceCapacity
Number of model matrices one instance buffer slot currently holds. Grown on demand by ensureInstanceC...
VkDeviceSize getInstanceBufferAlignedSize() const
Gets the aligned byte size of one instance buffer slot.
void * getIndirectBufferMapped(std::size_t viewSlot) const
Gets the mapped CPU pointer of a view's indirect slot.
std::vector< VkSemaphore > _imageAvailable