23#ifndef VCL_BGFX_BUFFERS_INDEX_BUFFER_H
24#define VCL_BGFX_BUFFERS_INDEX_BUFFER_H
26#include "generic_buffer.h"
46 bool mCompute =
false;
105 const uint bufferSize,
109 if (bufferSize != 0) {
143 const uint bufferSize,
145 bgfx::Access::Enum
access = bgfx::Access::Read,
148 if (bufferSize != 0) {
149 uint64_t flags = flagsForType(type);
150 flags |= flagsForAccess(
access);
175 const bgfx::Memory* indices,
179 mHandle = bgfx::createIndexBuffer(indices, flags);
195 bgfx::Access::Enum
access = bgfx::Access::Read)
const
197 if (bgfx::isValid(mHandle)) {
199 bgfx::setIndexBuffer(mHandle);
The GenericBuffer manages the lifetime of a bgfx BufferHandle.
Definition generic_buffer.h:44
void destroy()
Definition generic_buffer.h:59
The IndexBuffer manages the lifetime of a bgfx::IndexBufferHandle.
Definition index_buffer.h:43
bool isCompute() const
Check if the IndexBuffer is used for compute shaders.
Definition index_buffer.h:76
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.
Definition index_buffer.h:103
IndexBuffer()=default
Empty constructor.
void bind(uint stage=UINT_NULL, bgfx::Access::Enum access=bgfx::Access::Read) const
Bind the index buffer to the rendering pipeline.
Definition index_buffer.h:193
void swap(IndexBuffer &other)
Swap the content of this object with another IndexBuffer object.
Definition index_buffer.h:61
void setCompute(bool compute)
Set if the IndexBuffer is used for compute shaders.
Definition index_buffer.h:84
void create(const bgfx::Memory *indices, uint64_t flags=BGFX_BUFFER_NONE, bool compute=false)
Creates the index buffer and sets the data.
Definition index_buffer.h:174
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.
Definition index_buffer.h:141
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:43
PrimitiveType
A simple type that enumerates the main primitive types.
Definition base.h:58
constexpr uint UINT_NULL
The UINT_NULL value represent a null value of uint that is the maximum value that can be represented ...
Definition base.h:48