2#include "../core/foray_managedbuffer.hpp"
3#include "../foray_basics.hpp"
28 virtual void StageSection(uint32_t frameIndex,
const void* data,
size_t destOffset,
size_t size);
35 virtual void CmdPrepareForRead(VkCommandBuffer cmdBuffer, VkPipelineStageFlags2 dstStageMask, VkAccessFlags2 dstAccessMask)
const;
45 inline VkDescriptorBufferInfo
GetVkDescriptorInfo()
const {
return VkDescriptorBufferInfo{.buffer =
mDeviceBuffer.GetBuffer(), .offset = 0U, .range = VK_WHOLE_SIZE}; }
Simple types for supressing automatic definition of duplicating move constructors & operator.
Definition foray_basics.hpp:19
Wraps allocation and lifetime functionality of a VkBuffer.
Definition foray_managedbuffer.hpp:12
virtual bool Exists() const override
Return true, if the managed resource is allocated.
Definition foray_managedbuffer.hpp:47
std::string_view GetName() const
Return a custom name for the object.
Definition foray_managedresource.hpp:40
Helper class for organizing CPU -> GPU data synchronisation. In flight data is stored on host side,...
Definition foray_dualbuffer.hpp:18
VkBuffer GetDeviceVkBuffer() const
Definition foray_dualbuffer.hpp:46
virtual void StageFullBuffer(uint32_t frameIndex, const void *data)
Updates the entire staging buffer.
std::vector< std::unique_ptr< core::ManagedBuffer > > mStagingBuffers
Permanently mapped host-local staging buffers (one per frame in flight)
Definition foray_dualbuffer.hpp:58
virtual void CmdPrepareForRead(VkCommandBuffer cmdBuffer, VkPipelineStageFlags2 dstStageMask, VkAccessFlags2 dstAccessMask) const
Prepares the device buffer for read access with a pipeline barrier (must be called before read access...
std::vector< void * > mStagingBufferMaps
Memory locations the permanently mapped staging buffers are mapped to.
Definition foray_dualbuffer.hpp:56
DualBuffer & SetName(std::string_view name)
core::ManagedBuffer mDeviceBuffer
The buffer used by the device.
Definition foray_dualbuffer.hpp:62
virtual void StageSection(uint32_t frameIndex, const void *data, size_t destOffset, size_t size)
Updates a section of a staging buffer.
VkDescriptorBufferInfo GetVkDescriptorInfo() const
Definition foray_dualbuffer.hpp:45
virtual VkBufferMemoryBarrier2 MakeBarrierPrepareForRead(VkPipelineStageFlags2 dstStageMask, VkAccessFlags2 dstAccessMask) const
Returns a barrier which prepares the device buffer for read access.
virtual ~DualBuffer()
Definition foray_dualbuffer.hpp:50
bool Exists() const
Definition foray_dualbuffer.hpp:40
std::string GetName() const
Definition foray_dualbuffer.hpp:42
std::vector< std::vector< VkBufferCopy > > mBufferCopies
Record of all buffer copies submitted. Added to when writing to staging buffers, cleared when buildin...
Definition foray_dualbuffer.hpp:60
void Create(core::Context *context, const core::ManagedBuffer::CreateInfo &devicebufferCreateInfo, uint32_t stageBufferCount=INFLIGHT_FRAME_COUNT)
Creates the dualbuffer setup.
virtual void CmdCopyToDevice(uint32_t frameIndex, VkCommandBuffer cmdBuffer)
Writes commands required to copy the changes recorded in the indexed staging buffer to the device buf...
#define FORAY_GETTER_CR(member)
Return constant reference.
Definition foray_basics.hpp:60
Definition foray_dualbuffer.hpp:5
constexpr uint32_t INFLIGHT_FRAME_COUNT
Inflight frame count is the amount of frames 'in flight' aka frames recorded on the host before waiti...
Definition foray_basics.hpp:35
Non owning context object.
Definition foray_context.hpp:16
Combines all structs used for initialization.
Definition foray_managedbuffer.hpp:16