66 bool ensureSize(VkDeviceSize requiredSize, VkBufferUsageFlags usage);
89 [[nodiscard]] VkDeviceSize
getSize()
const;
91 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.
std::array< std::optional< Vulkan::Buffer >, STAGING_BUFFER_COUNT > stagingBuffers_
Vulkan::Buffer & getBufferRef()
Engine::Core::ApplicationContext * context_
StagedBufferSyncObjects upload(const Engine::Core::ApplicationContext *context, const void *data, VkDeviceSize size)
bool usePersistentMapping_
Vulkan::Buffer & getStagingBufferRef()
std::vector< PendingDeletion > pendingDeletions
static constexpr uint32_t STAGING_BUFFER_COUNT
Number of staging buffers for multi-buffering (matches frames in flight)
void advanceStagingBuffer()
Advance to next staging buffer for double-buffering. Call this at the start of each frame to ensure w...
VkDeviceSize getSize() const
Gets the current size of the device buffer.
bool hasPendingDeletions() const
Checks if there are buffers pending deletion.
void create(Engine::Core::ApplicationContext *context, VkDeviceSize size, VkBufferUsageFlags usage, bool persistentMapping=false)
Creates the staged buffer with device and staging buffers.
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...
const Vulkan::Buffer & getStagingBuffer() const
const Vulkan::Buffer & getBuffer() const
StagedBufferSyncObjects uploadPartial(const Engine::Core::ApplicationContext *context, const void *data, VkDeviceSize size, VkDeviceSize offset)
Upload data to a specific offset in the buffer (for incremental updates)
void setDebugName(const std::string &name, std::optional< uint32_t > index=std::nullopt)
std::optional< Buffer > buffer
void processPendingDeletions()
Destroys all buffers that were pending deletion. Call this after all frames that might reference old ...
uint32_t currentStagingIndex_
static constexpr uint32_t DELETION_DELAY_FRAMES
Core audio subsystem owning the miniaudio engine and managing playback.
VkBufferMemoryBarrier2 releaseBarrier
VkBufferMemoryBarrier2 acquireBarrier
BufferCopyObject copyObject
Old buffers waiting to be deleted after all frames complete.
uint32_t framesRemaining
Number of frames to wait before deletion.
std::array< Vulkan::Buffer, STAGING_BUFFER_COUNT > stagingBuffers
Vulkan::Buffer deviceBuffer