14template <
typename STORAGE>
44template<
typename STORAGE>
inline
63template<
typename STORAGE>
inline
66 this->hostBuffers = std::move(rhs.hostBuffers);
67 if (this->deviceBuffer != InvalidBufferId)
69 this->deviceBuffer = std::move(rhs.deviceBuffer);
70 this->iterator = rhs.iterator;
77template<
typename STORAGE>
inline void
80 this->hostBuffers = std::move(rhs.hostBuffers);
81 if (this->deviceBuffer != InvalidBufferId)
83 this->deviceBuffer = std::move(rhs.deviceBuffer);
84 this->iterator = rhs.iterator;
91template<
typename STORAGE>
inline void
94 this->fromCopies.Append(
BufferCopy{ .offset = this->iterator });
95 this->toCopies.Append(
BufferCopy{ .offset = offset });
96 this->sizes.Append(
sizeof(STORAGE));
98 this->iterator +=
sizeof(STORAGE);
104template<
typename STORAGE>
inline void
107 this->fromCopies.Append(
BufferCopy{ .offset = this->iterator });
108 this->toCopies.Append(
BufferCopy{ .offset = offset });
109 uint byteSize =
sizeof(STORAGE) * num;
110 this->sizes.Append(byteSize);
112 this->iterator += byteSize;
118template<
typename STORAGE>
inline void
122 for (
auto size : this->sizes)
124 CoreGraphics::CmdCopy(buf, this->hostBuffers.Buffer(), this->fromCopies, this->deviceBuffer, this->toCopies, size);
126 this->fromCopies.Clear();
127 this->toCopies.Clear();
Nebula's dynamic array class.
Definition array.h:60
#define N_CMD_SCOPE(x, y, z)
Definition commandbuffer.h:441
#define n_assert(exp)
Definition debug.h:50
Acceleration structures are used to enable ray tracing on the GPU by dividing the scene into a BVH.
Definition accelerationstructure.h:24
void BufferUpdate(const BufferId id, const void *data, const uint size, const uint offset=0)
update buffer data
Definition vkbuffer.cc:361
@ DeviceLocal
Definition buffer.h:28
@ HostLocal
Definition buffer.h:29
void CmdCopy(const CmdBufferId id, const CoreGraphics::TextureId fromTexture, const Util::Array< CoreGraphics::TextureCopy, 4 > &from, const CoreGraphics::TextureId toTexture, const Util::Array< CoreGraphics::TextureCopy, 4 > &to)
Copy between textures.
Definition vkcommandbuffer.cc:1224
const BufferId CreateBuffer(const BufferCreateInfo &info)
create buffer
Definition vkbuffer.cc:52
@ TransferBufferSource
Definition buffer.h:37
@ TransferBufferDestination
Definition buffer.h:38
void DestroyBuffer(const BufferId id)
destroy buffer
Definition vkbuffer.cc:281
@ Write
Definition filewatcher.h:47
#define NEBULA_MARKER_TRANSFER
Definition config.h:338
Definition commandbuffer.h:78
BufferAccessMode mode
Definition buffer.h:83
bool sparse
Definition buffer.h:86
BufferUsageFlags usageFlags
Definition buffer.h:84
Set of buffers which creates a buffer per each buffered frame.
Definition buffer.h:225
Definition commandbuffer.h:155
Definition pinnedbuffer.h:16
void Flush(const CoreGraphics::CmdBufferId buf)
Copy from storage unto device buffer.
Definition pinnedbuffer.h:119
CoreGraphics::BufferId deviceBuffer
Definition pinnedbuffer.h:38
Util::Array< uint > sizes
Definition pinnedbuffer.h:36
void operator=(PinnedBuffer &&rhs)
Move assignment.
Definition pinnedbuffer.h:78
Util::Array< CoreGraphics::BufferCopy > fromCopies
Definition pinnedbuffer.h:35
BufferSet hostBuffers
Definition pinnedbuffer.h:37
PinnedBuffer()
Default constructor.
Definition pinnedbuffer.h:18
uint iterator
Definition pinnedbuffer.h:34
void Write(const STORAGE &item, IndexT offset)
Append a copy of an element to a region.
Definition pinnedbuffer.h:92
Util::Array< CoreGraphics::BufferCopy > toCopies
Definition pinnedbuffer.h:35
int SizeT
Definition types.h:49
unsigned int uint
Definition types.h:31
int IndexT
Definition types.h:48