61 device_->deleteBuffer(handle_);
66 : device_(other.device_), handle_(other.handle_), layout_(std::move(other.layout_)) {
73 device_->deleteBuffer(handle_);
75 device_ = other.device_;
76 handle_ = other.handle_;
77 layout_ = std::move(other.layout_);
85 buffer->device_ = &device;
92 buffer->device_ = &device;
99 device_->updateBuffer(handle_, 0, data, sizeBytes);
103 if (!device_)
return;
104 device_->updateBuffer(handle_, offsetBytes, data, sizeBytes);
113 device_->deleteBuffer(handle_);
118 : device_(other.device_), handle_(other.handle_), count_(other.count_), is16Bit_(other.is16Bit_) {
124 if (
this != &other) {
126 device_->deleteBuffer(handle_);
128 device_ = other.device_;
129 handle_ = other.handle_;
130 count_ = other.count_;
131 is16Bit_ = other.is16Bit_;
140 buffer->device_ = &device;
141 buffer->count_ = count;
142 buffer->is16Bit_ =
false;
150 buffer->device_ = &device;
151 buffer->count_ = count;
152 buffer->is16Bit_ =
true;
GPU buffer abstractions for vertex and index data.
Abstract graphics device interface.
Logging utilities for ESEngine.
A content policy. provider names who refills a Sourced object and key what it refills; both are the p...
Abstract graphics device interface.
BufferHandle createBuffer(const BufferDesc &desc, GfxContent content, const void *initialData)
Creates a buffer with fixed capacity and optional initial contents.
IndexBuffer & operator=(const IndexBuffer &)=delete
static Unique< IndexBuffer > create(GfxDevice &device, GfxContent content, std::span< const u32 > indices)
Creates an index buffer from a span of 32-bit indices.
void setSubDataRaw(const void *data, u32 sizeBytes, u32 offsetBytes)
Updates a portion of buffer data with offset (internal use).
static Unique< VertexBuffer > createRaw(GfxDevice &device, GfxContent content, const void *data, u32 sizeBytes)
Creates a buffer from raw data pointer for internal use.
void setDataRaw(const void *data, u32 sizeBytes)
Updates buffer data from raw pointer (internal use).
VertexBuffer & operator=(const VertexBuffer &)=delete
static Unique< VertexBuffer > create(GfxDevice &device, GfxContent content, std::span< const T > data)
Creates a static buffer from a span.
constexpr Unique< T > makeUnique(Args &&... args)
Creates a Unique pointer with the given arguments.
ShaderDataType
Vertex attribute data types.
@ UByte4N
4 unsigned bytes, normalized to [0,1] vec4
@ Int
Single 32-bit integer.
@ Float
Single 32-bit float.
u32 shaderDataTypeSize(ShaderDataType type)
Gets the size in bytes of a shader data type.
std::unique_ptr< T > Unique
Unique ownership smart pointer.
std::uint32_t u32
Unsigned 32-bit integer.
u32 shaderDataTypeComponentCount(ShaderDataType type)
Gets the component count of a shader data type.
std::uint16_t u16
Unsigned 16-bit integer.