|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
GPU buffer for vertex data, static or dynamic; all GPU work goes through the device. More...
#include <Buffer.hpp>
Public Member Functions | |
| VertexBuffer ()=default | |
| ~VertexBuffer () | |
| VertexBuffer (const VertexBuffer &)=delete | |
| VertexBuffer & | operator= (const VertexBuffer &)=delete |
| VertexBuffer (VertexBuffer &&other) noexcept | |
| VertexBuffer & | operator= (VertexBuffer &&other) noexcept |
| template<typename T> | |
| void | setData (std::span< const T > data) |
| Updates buffer data from a span. | |
| template<typename T> | |
| void | setData (const std::vector< T > &data) |
| Updates buffer data from a vector. | |
| template<typename T, usize N> | |
| void | setData (const T(&data)[N]) |
| Updates buffer data from a C array. | |
| void | setLayout (const VertexLayout &layout) |
| Sets the vertex layout. | |
| const VertexLayout & | getLayout () const |
| Gets the vertex layout. | |
| BufferHandle | handle () const |
| Gets the device buffer handle. | |
| void | setDataRaw (const void *data, u32 sizeBytes) |
| Updates buffer data from raw pointer (internal use). | |
| void | setSubDataRaw (const void *data, u32 sizeBytes, u32 offsetBytes) |
| Updates a portion of buffer data with offset (internal use). | |
Static Public Member Functions | |
| template<typename T> | |
| static Unique< VertexBuffer > | create (GfxDevice &device, GfxContent content, std::span< const T > data) |
| Creates a static buffer from a span. | |
| template<typename T> | |
| static Unique< VertexBuffer > | create (GfxDevice &device, GfxContent content, const std::vector< T > &data) |
| Creates a static buffer from a vector. | |
| template<typename T, usize N> | |
| static Unique< VertexBuffer > | create (GfxDevice &device, GfxContent content, const T(&data)[N]) |
| Creates a static buffer from a C array. | |
| static Unique< VertexBuffer > | create (GfxDevice &device, GfxContent content, u32 sizeBytes) |
| Creates a dynamic buffer of specified size. | |
| static Unique< VertexBuffer > | createRaw (GfxDevice &device, GfxContent content, const void *data, u32 sizeBytes) |
| Creates a buffer from raw data pointer for internal use. | |
GPU buffer for vertex data, static or dynamic; all GPU work goes through the device.
Definition at line 188 of file Buffer.hpp.
|
default |
Referenced by VertexBuffer(), VertexBuffer(), operator=(), and operator=().
| esengine::VertexBuffer::~VertexBuffer | ( | ) |
Definition at line 59 of file Buffer.cpp.
References esengine::Invalid.
|
delete |
References VertexBuffer().
|
noexcept |
Definition at line 65 of file Buffer.cpp.
References VertexBuffer(), and esengine::Invalid.
|
inlinestatic |
Creates a static buffer from a vector.
Definition at line 219 of file Buffer.hpp.
References create().
|
inlinestatic |
Creates a static buffer from a C array.
Definition at line 227 of file Buffer.hpp.
References create().
|
inlinestatic |
Creates a static buffer from a span.
| T | Vertex type |
| device | Graphics device |
| data | Span of vertex data |
Definition at line 211 of file Buffer.hpp.
References createRaw().
Referenced by create(), create(), esengine::resource::ResourceManager::createVertexBuffer(), esengine::resource::ResourceManager::createVertexBuffer(), and esengine::CustomGeometry::init().
|
static |
Creates a dynamic buffer of specified size.
| device | Graphics device |
| sizeBytes | Buffer size in bytes |
Use setData() to upload data later.
Definition at line 90 of file Buffer.cpp.
References esengine::GfxDevice::createBuffer(), esengine::makeUnique(), and esengine::Vertex.
|
static |
Creates a buffer from raw data pointer for internal use.
| device | Graphics device |
| data | Pointer to vertex data |
| sizeBytes | Size of data in bytes |
Definition at line 83 of file Buffer.cpp.
References esengine::GfxDevice::createBuffer(), esengine::makeUnique(), and esengine::Vertex.
Referenced by create(), and esengine::CustomGeometry::init().
|
inline |
Gets the vertex layout.
Definition at line 283 of file Buffer.hpp.
|
inline |
Gets the device buffer handle.
Definition at line 286 of file Buffer.hpp.
|
delete |
References VertexBuffer().
|
noexcept |
Definition at line 70 of file Buffer.cpp.
References VertexBuffer(), and esengine::Invalid.
|
inline |
|
inline |
Updates buffer data from a C array.
Definition at line 265 of file Buffer.hpp.
References setData().
|
inline |
Updates buffer data from a span.
Definition at line 249 of file Buffer.hpp.
References setDataRaw().
| void esengine::VertexBuffer::setDataRaw | ( | const void * | data, |
| u32 | sizeBytes ) |
Updates buffer data from raw pointer (internal use).
| data | Pointer to new data |
| sizeBytes | Size of data in bytes |
Definition at line 97 of file Buffer.cpp.
Referenced by setData().
|
inline |
Sets the vertex layout.
| layout | The vertex attribute layout |
Definition at line 277 of file Buffer.hpp.
Updates a portion of buffer data with offset (internal use).
| data | Pointer to new data |
| sizeBytes | Size of data in bytes |
| offsetBytes | Offset in bytes from buffer start |
Definition at line 102 of file Buffer.cpp.