26 void create(
ApplicationContext *context, VkDeviceSize size, VkBufferUsageFlags usage,
bool persistentMapping =
false);
48 bool ensureSize(VkDeviceSize requiredSize, VkBufferUsageFlags usage);
71 [[nodiscard]] VkDeviceSize
getSize()
const;
73 void setDebugName(
const std::string &name, std::optional<uint32_t> index = std::nullopt);
The application context is the core class which stores the basic openxr and vulkan objects.
RAII wrapper for Vulkan buffer and device memory.
VulkanStagedBufferSyncObjects uploadPartial(const ApplicationContext *context, const void *data, VkDeviceSize size, VkDeviceSize offset)
Upload data to a specific offset in the buffer (for incremental updates)
const VulkanBuffer & getStagingBuffer() const
bool usePersistentMapping_
VkDeviceSize getSize() const
Gets the current size of the device buffer.
std::vector< PendingDeletion > pendingDeletions
bool ensureSize(VkDeviceSize requiredSize, VkBufferUsageFlags usage)
Ensures the buffer is at least the required size. If resizing is needed, the old buffers are moved to...
VulkanBuffer & getBufferRef()
static constexpr uint32_t DELETION_DELAY_FRAMES
std::optional< VulkanBuffer > stagingBuffer
std::optional< VulkanBuffer > buffer
void setDebugName(const std::string &name, std::optional< uint32_t > index=std::nullopt)
VulkanStagedBufferSyncObjects upload(const ApplicationContext *context, const void *data, VkDeviceSize size)
VulkanBuffer & getStagingBufferRef()
void processPendingDeletions()
Destroys all buffers that were pending deletion. Call this after all frames that might reference old ...
ApplicationContext * context_
bool hasPendingDeletions() const
Checks if there are buffers pending deletion.
void create(ApplicationContext *context, VkDeviceSize size, VkBufferUsageFlags usage, bool persistentMapping=false)
Creates the staged buffer with device and staging buffers.
const VulkanBuffer & getBuffer() const
Log category system implementation.
BufferCopyObject copyObject
VkBufferMemoryBarrier2 acquireBarrier
VkBufferMemoryBarrier2 releaseBarrier
Old buffers waiting to be deleted after all frames complete.
uint32_t framesRemaining
Number of frames to wait before deletion.
VulkanBuffer stagingBuffer
VulkanBuffer deviceBuffer