114 return lhs.getBuffer() == rhs.getBuffer() && lhs.getOffset() == rhs.getOffset() && lhs.getLength() == rhs.getLength();
120 return lhs.getBuffer() != rhs.getBuffer() && lhs.getOffset() != rhs.getOffset() && lhs.getLength() != rhs.getLength();
574 mData =
reinterpret_cast<T*
>(
reinterpret_cast<UInt8*
>(P::getBuffer()->map()) + P::getOffset());
581 template<
typename... Args>
584 mData =
reinterpret_cast<T*
>(
reinterpret_cast<UInt8*
>(P::getBuffer()->map()) + P::getOffset());
592 mData =
reinterpret_cast<T*
>(
reinterpret_cast<UInt8*
>(P::getBuffer()->map()) + P::getOffset());
654 static constexpr bool isStrided = byteStride ==
sizeof(
T);
680 if constexpr(isStrided) {
692 template<
typename... Args>
696 if constexpr(isStrided) {
713 void update(
const T* data,
const size_t length) {
update(data, 0, length); }
714 void update(
const T* data,
const size_t offset,
const size_t length) {
715 for(
const size_t index :
range(length)) {
716 mData[offset + index] = data[index];
726 [[
nodiscard]]
P slice(
const size_t index)
const {
return P{P::getBuffer(), P::getOffset() + align(index),
sizeof(
T)}; }
739 [[
nodiscard]]
size_t align(
const size_t index)
const noexcept {
return byteStride * index; }
745 static constexpr bool isStrided =
true;
770 const GPUBufferSize stride = ((
sizeof(
T) + baseAlignment - 1) / baseAlignment) * baseAlignment;
780 template<
typename... Args>
782 :
P(device, size * ((
sizeof(
T) + baseAlignment - 1) / baseAlignment) * baseAlignment, args...,
784 const GPUBufferSize stride = ((
sizeof(
T) + baseAlignment - 1) / baseAlignment) * baseAlignment;
799 void update(
const T* data,
const size_t length) {
update(data, 0, length); }
800 void update(
const T* data,
const size_t offset,
const size_t length) {
801 for(
const size_t index :
range(length)) {
802 mData[offset + index] = data[index];
812 [[
nodiscard]]
P slice(
const size_t index)
const {
return P{P::getBuffer(), P::getOffset() + align(index),
sizeof(
T)}; }
825 [[
nodiscard]]
size_t align(
const size_t index)
const noexcept {
return stride() * index; }
828 template<
typename P,
typename T,
size_t N, std::
size_t BaseAlignment>
845 template<
typename... Args>
873 template<
typename T, std::
size_t BaseAlignment = sizeof(T)>
883 template<
typename T, std::
size_t BaseAlignment = sizeof(T)>
893 template<
typename T, std::
size_t BaseAlignment = sizeof(T)>
903 template<
typename T, std::
size_t BaseAlignment = sizeof(T)>
1020 buffer.invalidate();
1060 static_assert(std::is_trivially_copyable_v<T>);
1076 static constexpr size_t alignment = ((
sizeof(
T) + 256 - 1) / 256) * 256;
1102 const size_t offset =
alignment * index;
1135 buffer.invalidate();
#define CE_ASSERT(...)
Definition Macros.hpp:323
A retain-release type of smart pointer.
Definition SmartPtr.hpp:132
A GPU bindless buffer.
Definition GPUBufferObject.hpp:516
GPUBindlessBuffer & operator=(GPUBindlessBuffer &&)=default
Assigns a BindlessBuffer by moving another.
GPUBindlessBuffer(GPUBufferPtr buffer, GPUBufferSize offset=0, GPUBufferSize length=GPUBuffer::whole)
Creates a new BindlessBuffer from an existing GPU buffer.
GPUBindlessBuffer()=default
Creates a new empty BindlessBuffer.
GPUBindlessBuffer & operator=(const GPUBindlessBuffer &)=default
Assigns the BindlessBuffer by copying another.
~GPUBindlessBuffer()
Destroys the BindlessBuffer.
GPUBindlessBuffer(const GPUBindlessBuffer &)=default
Creates a new BindlessBuffer by copying another.
GPUBindlessBuffer(GPUBuffer &buffer, const GPUBufferSize offset=0, const GPUBufferSize length=GPUBuffer::whole)
Definition GPUBufferObject.hpp:527
GPUBindlessBuffer(GPUDevice &device, GPUBufferSize size, const GPUMemoryProperties &memoryProperty=GPUMemoryProperty::DeviceLocal, String name="")
Creates a new BindlessBuffer.
GPUBindlessBuffer(std::nullptr_t)
Creates a new empty BindlessBuffer.
Definition GPUBufferObject.hpp:539
GPUBindlessBuffer(GPUBindlessBuffer &&)=default
Creates a new BindlessBuffer by moving another.
Definition GPUBuffer.hpp:124
static const constexpr GPUBufferSize whole
A constant the represents the whole buffer length.
Definition GPUBuffer.hpp:127
Definition GPUBufferObject.hpp:27
friend bool operator==(const GPUBufferObject &lhs, const GPUBufferObject &rhs) noexcept
Definition GPUBufferObject.hpp:113
GPUBufferSize getOffset() const noexcept
Definition GPUBufferObject.hpp:104
GPUBufferSize mOffset
The offset to the beginning of the buffer object data.
Definition GPUBufferObject.hpp:33
GPUBufferSize getLength() const noexcept
Definition GPUBufferObject.hpp:107
GPUBufferObject(GPUBuffer &buffer, const GPUBufferSize offset=0, const GPUBufferSize length=GPUBuffer::whole)
Definition GPUBufferObject.hpp:49
friend bool operator==(std::nullptr_t, const GPUBufferObject &rhs) noexcept
Definition GPUBufferObject.hpp:117
friend bool operator==(const GPUBufferObject &lhs, std::nullptr_t) noexcept
Definition GPUBufferObject.hpp:116
GPUBufferSize mLength
The length of the buffer data.
Definition GPUBufferObject.hpp:36
void invalidate(GPUBufferSize offset=0, GPUBufferSize size=GPUBuffer::whole)
Invalidates the cached memory data starting at offset with size bytes.
GPUBufferPtr getBuffer() const noexcept
Definition GPUBufferObject.hpp:101
friend bool operator!=(std::nullptr_t, const GPUBufferObject &rhs) noexcept
Definition GPUBufferObject.hpp:123
GPUBufferObject & operator=(const GPUBufferObject &)=default
Assigns the BufferObject by copying another.
GPUBufferObject(GPUBufferPtr buffer, GPUBufferSize offset=0, GPUBufferSize length=GPUBuffer::whole)
Creates a new BufferObject from an existing GPU buffer.
~GPUBufferObject()
Destroys the BufferObject.
GPUBufferObject()=default
Creates a new empty BufferObject.
friend bool operator!=(const GPUBufferObject &lhs, const GPUBufferObject &rhs) noexcept
Definition GPUBufferObject.hpp:119
GPUBufferObject & operator=(std::nullptr_t)
Assigns the BufferObject an empty value.
Definition GPUBufferObject.hpp:63
GPUBufferObject & operator=(GPUBufferObject &&)=default
Assigns a BufferObject by moving another.
GPUBufferPtr mBuffer
A pointer to the GPU allocated buffer.
Definition GPUBufferObject.hpp:30
GPUBufferObject(const GPUBufferObject &)=default
Creates a new BufferObject by copying another.
GPUBufferObject(GPUBufferObject &&)=default
Creates a new BufferObject by moving another.
friend bool operator!=(const GPUBufferObject &lhs, std::nullptr_t) noexcept
Definition GPUBufferObject.hpp:122
void flush(GPUBufferSize offset=0, GPUBufferSize size=GPUBuffer::whole)
Flushes the cached memory data starting at offset with size bytes.
GPUBufferObject(GPUDevice &device, const GPUBufferDescriptor &descriptor)
Creates a new BufferObject.
GPUBufferObject(std::nullptr_t)
Creates a new empty BufferObject.
Definition GPUBufferObject.hpp:59
A template class that automatically manages a buffer pool.
Definition GPUBufferObject.hpp:917
Vector< RawBuffer > buffers
A vector of allocated buffers.
Definition GPUBufferObject.hpp:928
B< T > allocate()
Allocates a new object from the pool.
Definition GPUBufferObject.hpp:961
GPUBufferPool(GPUDevice &device)
Creates a new BufferPool object.
Definition GPUBufferObject.hpp:946
void reset() noexcept
Resets the buffer pool.
Definition GPUBufferObject.hpp:988
void invalidate(const GPUBufferSize offset=0, const GPUBufferSize size=GPUBuffer::whole)
Invalidates the cached memory data starting at offset with size bytes.
Definition GPUBufferObject.hpp:1014
bool empty() const noexcept
Checks if the buffer pool is empty.
Definition GPUBufferObject.hpp:993
const GPUBufferSize baseAlignment
The base alignment to be used for each object in pool.
Definition GPUBufferObject.hpp:938
B< UInt8[]> RawBuffer
The buffer type.
Definition GPUBufferObject.hpp:920
GPUBufferPool(GPUDevice &device, const GPUBufferSize baseAllocationSize)
Creates a new BufferPool object.
Definition GPUBufferObject.hpp:952
const GPUBufferSize baseAllocationSize
The base allocation size used by the pool.
Definition GPUBufferObject.hpp:941
GPUBufferSize next
The offset of the next allocated object.
Definition GPUBufferObject.hpp:931
GPUBufferSize length
The maximum buffer length.
Definition GPUBufferObject.hpp:934
GPUDevicePtr device
The device to be used when allocating memory.
Definition GPUBufferObject.hpp:924
void allocateBuffers(const size_t newLength)
Definition GPUBufferObject.hpp:1025
void reserve(const GPUBufferSize length)
Reserves space in the pool.
Definition GPUBufferObject.hpp:957
void flush(const GPUBufferSize offset=0, const GPUBufferSize size=GPUBuffer::whole)
Flushes the cached memory data starting at offset with size bytes.
Definition GPUBufferObject.hpp:1000
Definition GPUCommandBuffer.hpp:77
Definition GPUDevice.hpp:357
GPUDynamicBuffer(GPUDevice &device, const size_t size, const size_t baseAlignment, String name, Args &&... args)
Creates a new DynamicBuffer.
Definition GPUBufferObject.hpp:781
T * data() noexcept
Definition GPUBufferObject.hpp:796
~GPUDynamicBuffer()
Definition GPUBufferObject.hpp:789
typename MemoryViewType::ConstIterator ConstIteratorType
The type that represents the iterator for each element in the dynamic buffer.
Definition GPUBufferObject.hpp:756
ConstIteratorType begin() const noexcept
Definition GPUBufferObject.hpp:816
size_t stride() const noexcept
Definition GPUBufferObject.hpp:810
GPUDynamicBuffer< P, T > get(const size_t index) const
Definition GPUBufferObject.hpp:806
MemoryViewType mData
A memory view to the buffer data mapped on host memory.
Definition GPUBufferObject.hpp:760
GPUDynamicBuffer()=default
Creates a new empty DynamicBuffer.
const T * data() const noexcept
Definition GPUBufferObject.hpp:797
IteratorType end() noexcept
Definition GPUBufferObject.hpp:818
void set(size_t i, const T &value) noexcept
Definition GPUBufferObject.hpp:807
std::size_t size() const noexcept
Definition GPUBufferObject.hpp:809
GPUDynamicBuffer< P, T > operator[](const size_t index) const noexcept
Definition GPUBufferObject.hpp:822
GPUDynamicBuffer(GPUBufferPtr buffer, const GPUBufferSize baseAlignment=sizeof(T), GPUBufferSize offset=0)
Creates a new DynamicBuffer from an existing GPU buffer.
Definition GPUBufferObject.hpp:769
P slice(const size_t index) const
Definition GPUBufferObject.hpp:812
ConstIteratorType end() const noexcept
Definition GPUBufferObject.hpp:819
void update(const T *data, const size_t length)
Definition GPUBufferObject.hpp:799
typename MemoryViewType::Iterator IteratorType
The type that represents the iterator for each element in the dynamic buffer.
Definition GPUBufferObject.hpp:752
size_t align(const size_t index) const noexcept
Definition GPUBufferObject.hpp:825
IteratorType begin() noexcept
Definition GPUBufferObject.hpp:815
void update(const T *data, const size_t offset, const size_t length)
Definition GPUBufferObject.hpp:800
Definition GPUBufferObject.hpp:648
P slice(const size_t index) const
Definition GPUBufferObject.hpp:726
IteratorType begin() noexcept
Definition GPUBufferObject.hpp:729
std::conditional_t< isStrided, StridedMemoryView< T >, MemoryView< T > > MemoryViewType
The type of memory view used to view the host-mapped buffer.
Definition GPUBufferObject.hpp:657
size_t stride() const noexcept
Definition GPUBufferObject.hpp:724
T * data() noexcept
Definition GPUBufferObject.hpp:710
~GPUDynamicBuffer()
Definition GPUBufferObject.hpp:703
void set(size_t i, const T &value) noexcept
Definition GPUBufferObject.hpp:721
typename MemoryViewType::Iterator IteratorType
The type that represents the iterator for each element in the dynamic buffer.
Definition GPUBufferObject.hpp:661
GPUDynamicBuffer()=default
Creates a new empty DynamicBuffer.
typename MemoryViewType::ConstIterator ConstIteratorType
The type that represents the iterator for each element in the dynamic buffer.
Definition GPUBufferObject.hpp:665
GPUDynamicBuffer(GPUDevice &device, const size_t size, String name, Args &&... args)
Creates a new DynamicBuffer.
Definition GPUBufferObject.hpp:693
std::size_t size() const noexcept
Definition GPUBufferObject.hpp:723
GPUDynamicBuffer< P, T > get(const size_t index) const
Definition GPUBufferObject.hpp:720
GPUDynamicBuffer< P, T > operator[](const size_t index) const noexcept
Definition GPUBufferObject.hpp:736
GPUDynamicBuffer(GPUBufferPtr buffer, GPUBufferSize offset=0)
Creates a new DynamicBuffer from an existing GPU buffer.
Definition GPUBufferObject.hpp:678
IteratorType end() noexcept
Definition GPUBufferObject.hpp:732
ConstIteratorType begin() const noexcept
Definition GPUBufferObject.hpp:730
void update(const T *data, const size_t offset, const size_t length)
Definition GPUBufferObject.hpp:714
size_t align(const size_t index) const noexcept
Definition GPUBufferObject.hpp:739
MemoryViewType mData
A memory view to the buffer data mapped on host memory.
Definition GPUBufferObject.hpp:669
void update(const T *data, const size_t length)
Definition GPUBufferObject.hpp:713
ConstIteratorType end() const noexcept
Definition GPUBufferObject.hpp:733
const T * data() const noexcept
Definition GPUBufferObject.hpp:711
GPUDynamicBuffer(GPUDevice &device, String name="", Args &&... args)
Creates a new DynamicBuffer.
Definition GPUBufferObject.hpp:846
~GPUDynamicBuffer()
Definition GPUBufferObject.hpp:850
GPUDynamicBuffer()=default
Creates a new empty DynamicBuffer.
GPUDynamicBuffer(GPUBufferPtr buffer, GPUBufferSize offset=0)
Creates a new DynamicBuffer from an existing GPU buffer.
Definition GPUBufferObject.hpp:839
Definition GPUBufferObject.hpp:562
GPUDynamicBuffer(P &&rawBuffer)
Creates a new DynamicBuffer.
Definition GPUBufferObject.hpp:591
GPUDynamicBuffer(GPUDynamicBuffer &&value) noexcept=default
GPUDynamicBuffer()=default
Creates a new empty DynamicBuffer.
T * get() noexcept
Gets a pointer to the buffer object.
Definition GPUBufferObject.hpp:617
T * operator->() noexcept
Arrow operator overload that will access the members of the GPU buffer data.
Definition GPUBufferObject.hpp:632
GPUDynamicBuffer & operator=(const T &value)
Assigns a new value to the dynamic buffer.
Definition GPUBufferObject.hpp:610
GPUDynamicBuffer(GPUDevice &device, String name="", Args &&... args)
Creates a new DynamicBuffer.
Definition GPUBufferObject.hpp:582
GPUDynamicBuffer & operator=(const GPUDynamicBuffer &value)=default
const T * operator->() const noexcept
Arrow operator overload that will access the members of the GPU buffer data.
Definition GPUBufferObject.hpp:637
GPUDynamicBuffer & operator=(GPUDynamicBuffer &&value) noexcept=default
const T & operator*() const noexcept
Dereferences the GPU buffer data.
Definition GPUBufferObject.hpp:645
T * mData
A pointer to the buffer data mapped on host memory.
Definition GPUBufferObject.hpp:564
T & operator*() noexcept
Dereferences the GPU buffer data.
Definition GPUBufferObject.hpp:641
~GPUDynamicBuffer()
Definition GPUBufferObject.hpp:598
void commit()
Commits changes made to the buffer.
Definition GPUBufferObject.hpp:626
GPUDynamicBuffer(GPUBufferPtr buffer, GPUBufferSize offset=0)
Creates a new DynamicBuffer from an existing GPU buffer.
Definition GPUBufferObject.hpp:573
void update(const T &data)
Updates the buffer data with a new value.
Definition GPUBufferObject.hpp:623
GPUDynamicBuffer(const GPUDynamicBuffer &value)=default
const T * get() const noexcept
Gets a pointer to the buffer object.
Definition GPUBufferObject.hpp:620
Definition GPUImage.hpp:331
Definition GPUBufferObject.hpp:169
GPUIndexBuffer(GPUDevice &device, GPUBufferSize size, IndexType indexType=IndexType::UInt32, const GPUMemoryProperties &memoryProperty=GPUMemoryProperty::DeviceLocal, String name="")
Creates a new IndexBuffer.
GPUIndexBuffer(GPUBufferPtr buffer, GPUBufferSize offset=0, IndexType indexType=IndexType::UInt32, GPUBufferSize length=GPUBuffer::whole)
Creates a new IndexBuffer from an existing GPU buffer.
GPUIndexBuffer(std::nullptr_t)
Creates a new empty IndexBuffer.
Definition GPUBufferObject.hpp:197
GPUIndexBuffer & operator=(const GPUIndexBuffer &)=default
Assigns the IndexBuffer by copying another.
~GPUIndexBuffer()
Destroys the IndexBuffer.
GPUIndexBuffer(const GPUIndexBuffer &)=default
Creates a new IndexBuffer by copying another.
IndexType getIndexType() const noexcept
Definition GPUBufferObject.hpp:218
GPUIndexBuffer()=default
Creates a new empty IndexBuffer.
GPUIndexBuffer(GPUBuffer &buffer, const GPUBufferSize offset=0, const IndexType indexType=IndexType::UInt32, const GPUBufferSize length=GPUBuffer::whole)
Definition GPUBufferObject.hpp:184
GPUIndexBuffer & operator=(GPUIndexBuffer &&)=default
Assigns a IndexBuffer by moving another.
GPUIndexBuffer(GPUIndexBuffer &&)=default
Creates a new IndexBuffer by moving another.
IndexType mIndexType
The index type to be used when rendering.
Definition GPUBufferObject.hpp:171
Definition GPUBufferObject.hpp:314
GPUIndirectBuffer(GPUIndirectBuffer &&)=default
Creates a new IndirectBuffer by moving another.
GPUIndirectBuffer(std::nullptr_t)
Creates a new empty IndirectBuffer.
Definition GPUBufferObject.hpp:337
GPUIndirectBuffer & operator=(const GPUIndirectBuffer &)=default
Assigns the IndirectBuffer by copying another.
GPUIndirectBuffer(GPUBuffer &buffer, const GPUBufferSize offset=0, const GPUBufferSize length=GPUBuffer::whole)
Definition GPUBufferObject.hpp:325
GPUIndirectBuffer & operator=(GPUIndirectBuffer &&)=default
Assigns a IndirectBuffer by moving another.
GPUIndirectBuffer(const GPUIndirectBuffer &)=default
Creates a new IndirectBuffer by copying another.
~GPUIndirectBuffer()
Destroys the IndirectBuffer.
GPUIndirectBuffer(GPUDevice &device, GPUBufferSize size, const GPUMemoryProperties &memoryProperty=GPUMemoryProperty::DeviceLocal, String name="")
Creates a new IndirectBuffer.
GPUIndirectBuffer(GPUBufferPtr buffer, GPUBufferSize offset=0, GPUBufferSize length=GPUBuffer::whole)
Creates a new IndirectBuffer from an existing GPU buffer.
GPUIndirectBuffer()=default
Creates a new empty IndirectBuffer.
A special buffer type that can be used a staging buffer to upload and download data to the GPU.
Definition GPUBufferObject.hpp:359
void download(GPUCommandBuffer &commandBuffer, GPUImage &srcImage, const GPUImageRegion &srcImageRegion={}, UInt64 dstOffset=0, UInt32 rowStride=0, UInt32 layerStride=0)
Starts a download operation from srcImage to the staging buffer.
GPUStagingBuffer(GPUDevice &device, const GPUImageDescriptor &imageDescriptor, const GPUMemoryProperties &memoryProperty=GPUMemoryProperty::HostVisible, String name="")
Creates a new StagingBuffer.
void download(GPUBuffer &srcBuffer, UInt64 srcOffset=0, UInt64 dstOffset=0, UInt64 size=~0u)
Similar to download(CommandBuffer&, Buffer&, UInt64, UInt64, UInt64) but creates a temporary command ...
void upload(GPUBuffer &dstBuffer, UInt64 dstOffset=0, UInt64 srcOffset=0, UInt64 size=~0u)
Similar to upload(CommandBuffer&, Buffer&, UInt64, UInt64, UInt64) but creates a temporary command bu...
GPUStagingBuffer(std::nullptr_t)
Creates a new empty StagingBuffer.
Definition GPUBufferObject.hpp:398
void fill(uint8_t byte=0)
Fills the GPU buffer with bytes.
void upload(GPUCommandBuffer &commandBuffer, GPUBuffer &dstBuffer, UInt64 dstOffset=0, UInt64 srcOffset=0, UInt64 size=~0u)
Starts a upload operation from the staging buffer to dstBuffer.
GPUStagingBuffer(GPUDevice &device, const void *data, GPUBufferSize size, const GPUMemoryProperties &memoryProperty=GPUMemoryProperty::HostVisible, String name="")
Creates a new StagingBuffer.
GPUStagingBuffer & operator=(const GPUStagingBuffer &)=default
Assigns the StagingBuffer by copying another.
GPUStagingBuffer(GPUBufferPtr buffer, GPUBufferSize offset=0, GPUBufferSize length=GPUBuffer::whole)
Creates a new StagingBuffer from an existing GPU buffer.
GPUStagingBuffer(const GPUStagingBuffer &)=default
Creates a new StagingBuffer by copying another.
GPUStagingBuffer(GPUBuffer &buffer, const GPUBufferSize offset=0, const GPUBufferSize length=GPUBuffer::whole)
Definition GPUBufferObject.hpp:370
GPUStagingBuffer(GPUStagingBuffer &&)=default
Creates a new StagingBuffer by moving another.
void download(GPUImage &srcImage, const GPUImageRegion &srcImageRegion={}, UInt64 dstOffset=0, UInt32 rowStride=0, UInt32 layerStride=0)
Similar to download(CommandBuffer&, Image&, const ImageRegion&, UInt64, bool, UInt32,...
GPUStagingBuffer()=default
Creates a new empty StagingBuffer.
void download(GPUCommandBuffer &commandBuffer, GPUBuffer &srcBuffer, UInt64 srcOffset=0, UInt64 dstOffset=0, UInt64 size=~0u)
Starts a download operation from srcBuffer to the staging buffer.
void upload(GPUImage &dstImage, const GPUImageRegion &dstRegion={}, UInt64 srcOffset=0, bool generateMips=true, UInt32 rowStride=0, UInt32 layerStride=0)
Similar to upload(CommandBuffer&, Image&, const ImageRegion&, UInt64, bool, UInt32,...
void upload(GPUCommandBuffer &commandBuffer, GPUImage &dstImage, const GPUImageRegion &dstRegion={}, UInt64 srcOffset=0, bool generateMips=true, UInt32 rowStride=0, UInt32 layerStride=0)
Starts a upload operation from the staging buffer to the given image.
GPUStagingBuffer & operator=(GPUStagingBuffer &&)=default
Assigns a StagingBuffer by moving another.
GPUStagingBuffer(GPUDevice &device, GPUBufferSize size, const GPUMemoryProperties &memoryProperty=GPUMemoryProperty::HostVisible, String name="")
Creates a new StagingBuffer.
void copy(const void *ptr, UInt64 size)
Copies a the raw bytes from ptr into the GPU staging buffer.
~GPUStagingBuffer()
Destroys the StagingBuffer.
void copy(InputStream stream)
Copies a the raw bytes from stream into the GPU staging buffer.
Definition GPUBufferObject.hpp:268
GPUStorageBuffer & operator=(GPUStorageBuffer &&)=default
Assigns a StorageBuffer by moving another.
GPUStorageBuffer & operator=(const GPUStorageBuffer &)=default
Assigns the StorageBuffer by copying another.
GPUStorageBuffer(GPUBufferPtr buffer, GPUBufferSize offset=0, GPUBufferSize length=GPUBuffer::whole)
Creates a new StorageBuffer from an existing GPU buffer.
~GPUStorageBuffer()
Destroys the StorageBuffer.
GPUStorageBuffer(GPUStorageBuffer &&)=default
Creates a new StorageBuffer by moving another.
GPUStorageBuffer()=default
Creates a new empty StorageBuffer.
GPUStorageBuffer(GPUDevice &device, GPUBufferSize size, const GPUMemoryProperties &memoryProperty=GPUMemoryProperty::DeviceLocal, String name="")
Creates a new StorageBuffer.
GPUStorageBuffer(std::nullptr_t)
Creates a new empty StorageBuffer.
Definition GPUBufferObject.hpp:294
GPUStorageBuffer(GPUBuffer &buffer, const GPUBufferSize offset=0, const GPUBufferSize length=GPUBuffer::whole)
Storage buffer resource.
Definition GPUBufferObject.hpp:279
GPUStorageBuffer(const GPUStorageBuffer &)=default
Creates a new StorageBuffer by copying another.
GPUStorageBuffer(const GPUUniformBuffer &uniformBuffer)
Creates a new GPUStorageBuffer by converting from a GPUUniformBuffer.
Definition GPUBufferObject.hpp:126
GPUVertexBuffer()=default
Creates a new empty VertexBuffer.
GPUVertexBuffer(const GPUVertexBuffer &)=default
Creates a new VertexBuffer by copying another.
GPUVertexBuffer(GPUBufferPtr buffer, GPUBufferSize offset=0, GPUBufferSize length=GPUBuffer::whole)
Creates a new VertexBuffer from an existing GPU buffer.
GPUVertexBuffer & operator=(GPUVertexBuffer &&)=default
Assigns a VertexBuffer by moving another.
GPUVertexBuffer(GPUVertexBuffer &&)=default
Creates a new VertexBuffer by moving another.
GPUVertexBuffer & operator=(const GPUVertexBuffer &)=default
Assigns the VertexBuffer by copying another.
GPUVertexBuffer(GPUBuffer &buffer, const GPUBufferSize offset=0, const GPUBufferSize length=GPUBuffer::whole)
Definition GPUBufferObject.hpp:137
~GPUVertexBuffer()
Destroys the VertexBuffer.
GPUVertexBuffer(std::nullptr_t)
Creates a new empty VertexBuffer.
Definition GPUBufferObject.hpp:149
GPUVertexBuffer(GPUDevice &device, GPUBufferSize size, const GPUMemoryProperties &memoryProperty=GPUMemoryProperty::DeviceLocal, String name="")
Creates a new VertexBuffer.
A memory view is a class which attaches to an chunk of memory and provides a view to it (optionally c...
Definition MemoryView.hpp:62
Definition MemoryView.hpp:669
A memory view is a class which attaches to an chunk of memory and provides a view to it (optionally c...
Definition MemoryView.hpp:439
A template class that automatically manages a uniform buffer pool.
Definition GPUBufferObject.hpp:1059
TGPUBufferPool(GPUDevice &device)
Creates a new TBufferPool object.
Definition GPUBufferObject.hpp:1087
void flush(const GPUBufferSize offset=0, const GPUBufferSize size=GPUBuffer::whole)
Flushes the cached memory data starting at offset with size bytes.
Definition GPUBufferObject.hpp:1115
void reserve(const size_t length)
Reserves space in the pool.
Definition GPUBufferObject.hpp:1092
const size_t baseAllocationSize
The base allocation size used by the pool.
Definition GPUBufferObject.hpp:1079
static constexpr size_t alignment
The alignment to be used for each object in pool.
Definition GPUBufferObject.hpp:1076
void allocateBuffers(const size_t length)
Definition GPUBufferObject.hpp:1140
void invalidate(const GPUBufferSize offset=0, const GPUBufferSize size=GPUBuffer::whole)
Invalidates the cached memory data starting at offset with size bytes.
Definition GPUBufferObject.hpp:1129
size_t mLength
Definition GPUBufferObject.hpp:1082
GPUDevicePtr device
The device to be used when allocating memory.
Definition GPUBufferObject.hpp:1068
T & operator[](const size_t index)
Gets a reference to the Uniform Buffer block stored at index.
Definition GPUBufferObject.hpp:1097
Vector< BufferType > buffers
A vector of allocated buffers.
Definition GPUBufferObject.hpp:1072
B< UInt8 > BufferType
The buffer type.
Definition GPUBufferObject.hpp:1064
Definition Application.hpp:19
std::uint64_t UInt64
Definition DataTypes.hpp:26
auto range()
Returns an iterator that increases it's value from 0 to end by 1 for each step.
Definition Iterator.hpp:350
GPUMemoryData GPUBufferData
A pointer type that represents the buffer raw data.
Definition GPUBuffer.hpp:89
std::vector< T, ScopedAllocatorAdaptor< StdAllocator< T, RawAllocator > > > Vector
Vector is a sequence container that encapsulates dynamic size arrays.
Definition Vector.hpp:17
GPUMemoryProperty
Flag specifying properties for a memory type.
Definition GPUMemory.hpp:18
@ HostCached
Specifies that memory allocated with this type is cached on the host.
@ HostVisible
Specifies that memory allocated with this type can be mapped for host access.
@ DeviceLocal
Specifies that memory allocated with this type is the most efficient for device access.
auto move(Vector3 position)
Moves a entity to the given position.
Definition Helpers.hpp:22
std::uint8_t UInt8
Definition DataTypes.hpp:17
GPUMemorySize GPUBufferSize
A type that represents a buffer size.
Definition GPUBuffer.hpp:86
MemoryView< T > make_memory_view(T *ptr, size_t size)
Makes a new memory from a raw pointer and length.
Definition MemoryView.hpp:359
StridedMemoryView< T > make_strided_memory_view(T *ptr, size_t size, size_t stride=StridedMemoryView< T >::defaultStride)
Makes a new strided memory from a raw pointer and length.
Definition MemoryView.hpp:768
std::uint32_t UInt32
Definition DataTypes.hpp:23
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Hardware buffer descriptor structure.
Definition GPUBuffer.hpp:92
Definition GPUImage.hpp:247
Image region structure: Subresource (MIP-map level and array layer range), offset,...
Definition GPUImage.hpp:156
Definition IndexType.hpp:20
@ UInt32
The index buffer is represented as a 32-bit unsigned integer.
Definition IndexType.hpp:26