The IndexBuffer manages the lifetime of a bgfx::IndexBufferHandle.
More...
#include <vclib/bgfx/buffers/index_buffer.h>
|
| IndexBuffer ()=default |
| Empty constructor.
|
|
void | swap (IndexBuffer &other) |
| Swap the content of this object with another IndexBuffer object.
|
|
bool | isCompute () const |
| Check if the IndexBuffer is used for compute shaders.
|
|
void | setCompute (bool compute) |
| Set if the IndexBuffer is used for compute shaders.
|
|
void | create (const void *bufferIndices, const uint bufferSize, bool is32Bit=true, bgfx::ReleaseFn releaseFn=nullptr) |
| Creates the index buffer and sets the data for rendering.
|
|
void | createForCompute (const void *bufferIndices, const uint bufferSize, PrimitiveType type, bgfx::Access::Enum access=bgfx::Access::Read, bgfx::ReleaseFn releaseFn=nullptr) |
| Creates the index buffer and sets the data for compute shaders.
|
|
void | create (const bgfx::Memory *indices, uint64_t flags=BGFX_BUFFER_NONE, bool compute=false) |
| Creates the index buffer and sets the data.
|
|
void | bind (uint stage=UINT_NULL, bgfx::Access::Enum access=bgfx::Access::Read) const |
| Bind the index buffer to the rendering pipeline.
|
|
The IndexBuffer manages the lifetime of a bgfx::IndexBufferHandle.
It provides an interface to set the index buffer data and bind it to the rendering pipeline. The index buffer can be used for rendering or for compute shaders.
- Note
- An IndexBuffer can be moved but not copied (a copy would require to create a new bgfx::IndexBufferHandle, that can be done only having access to the data). Any class that contains an IndexBuffer should implement the copy constructor and the copy assignment operator.
◆ IndexBuffer()
vcl::IndexBuffer::IndexBuffer |
( |
| ) |
|
|
default |
Empty constructor.
It creates an invalid IndexBuffer object.
◆ bind()
void vcl::IndexBuffer::bind |
( |
uint |
stage = UINT_NULL , |
|
|
bgfx::Access::Enum |
access = bgfx::Access::Read |
|
) |
| const |
|
inline |
Bind the index buffer to the rendering pipeline.
If the stage is not specified, the index buffer is bound to the rendering pipeline. Otherwise, it is bound to the compute shader with the specified stage and the given access type (Read, Write, ReadWrite).
- Parameters
-
[in] | stage | the stage to which the buffer is bound. |
[in] | access | the access type for the buffer. |
◆ create() [1/2]
Creates the index buffer and sets the data.
If the buffer is already created (isValid() returns true
), it is destroyed and a new one is created.
- Parameters
-
[in] | indices | the memory containing the data. |
[in] | flags | the flags for the buffer. |
[in] | compute | if true, the buffer is used for compute shaders. |
◆ create() [2/2]
Creates the index buffer and sets the data for rendering.
If the buffer is already created (isValid() returns true
), it is destroyed and a new one is created.
- Note
- The data must be available for two bgfx::frame calls, then it is safe to release the data. If you cannot guarantee this, you must provide a release function that will be called automatically when the data is no longer needed.
- Parameters
-
[in] | bufferIndices | the data to be copied in the index buffer. |
[in] | bufferSize | the size of the bufferIndices. |
[in] | is32Bit | if true, the bufferIndices are 32-bit integers. |
[in] | releaseFn | the release function to be called when the data is no longer needed. |
◆ createForCompute()
Creates the index buffer and sets the data for compute shaders.
If the buffer is already created (isValid() returns true
), it is destroyed and a new one is created.
- Note
- The data must be available for two bgfx::frame calls, then it is safe to release the data. If you cannot guarantee this, you must provide a release function that will be called automatically when the data is no longer needed.
- Parameters
-
[in] | bufferIndices | the data to be copied in the index buffer. |
[in] | bufferSize | the size of the bufferIndices. |
[in] | type | the type of the elements. |
[in] | access | the access type for the buffer. |
[in] | releaseFn | the release function to be called when the data is no longer needed. |
◆ isCompute()
bool vcl::IndexBuffer::isCompute |
( |
| ) |
const |
|
inline |
Check if the IndexBuffer is used for compute shaders.
- Returns
- true if the IndexBuffer is used for compute shaders, false otherwise.
◆ setCompute()
void vcl::IndexBuffer::setCompute |
( |
bool |
compute | ) |
|
|
inline |
Set if the IndexBuffer is used for compute shaders.
- Parameters
-
[in] | compute | if true, the IndexBuffer is used for compute shaders. |
◆ swap()
Swap the content of this object with another IndexBuffer object.
- Parameters
-
The documentation for this class was generated from the following file: