#include
<oglplus/buffer.hpp>
template <> class ObjCommonOps<tag::Buffer> : public BufferName { public: typedef BufferTarget Target; typedef BufferIndexedTarget IndexedTarget; static BufferName Binding(BufferTarget target); static void Bind(BufferTarget target, BufferName buffer); static BufferName Binding(BufferIndexedTarget target, GLuint index); static void BindBase( BufferIndexedTarget target, GLuint index, BufferName buffer ); static void BindRange( BufferIndexedTarget target, GLuint index, BufferName buffer, BufferSize offset, BufferSize size ); #if GL_VERSION_4_4 || GL_ARB_multi_bind static void BindBase( BufferIndexedTarget target, GLuint first, const Sequence<BufferName>& buffers ); static void BindRange( BufferIndexedTarget target, GLuint first, const Sequence<BufferName>& buffers, const GLintptr* offsets, const GLsizeiptr* sizes ); #endif
Buffer bind targets. |
|
Returns the buffer currently bound to the specified |
|
Binds the specified |
|
Returns the current buffer bound to the specified |
|
Binds the specified |
|
Bind a range starting at |
|
Sequentially binds all |
|
Sequentially binds ranges (specified by |
void Bind(BufferTarget target) const; void Bind(BufferIndexedTarget target, GLuint index) const; void BindBase(BufferIndexedTarget target, GLuint index) const; #if GL_VERSION_4_0 || GL_ARB_transform_feedback3 void BindBaseUniform(UniformBufferBindingPoint index) const; #endif #if GL_VERSION_4_0 || GL_ARB_transform_feedback3 void BindBaseTransformFeedback(TransformFeedbackBufferBindingPoint index) const #endif #if GL_VERSION_4_2 || GL_ARB_shader_atomic_counters void BindBaseAtomicCounter(AtomicCounterBufferBindingPoint index) const; #endif #if GL_VERSION_4_3 || GL_ARB_shader_storage_buffer_object void BindBaseShaderStorage(ShaderStorageBufferBindingPoint index) const; #endif void BindRange( BufferIndexedTarget target, GLuint index, BufferSize offset, BufferSize size ) const;
Binds |
|
Binds |
|
Binds |
|
Binds |
|
Binds |
|
Binds |
|
Binds a range (specified by |
#if GL_VERSION_4_3 || GL_ARB_invalidate_subdata void InvalidateData(void); void InvalidateSubData(BufferSize offset, BufferSize size); #endif };
Invalidate all of |
|
Invalidate a subrange (specified by |
template <> class ObjectOps<tag::ExplicitSel, tag::Buffer> : public ObjZeroOps<tag::ExplicitSel, tag::Buffer> { public: struct Property { typedef BufferUsage Usage; typedef BufferMapAccess MapAccess; }; typedef BufferTypedMap<GLubyte> Map; static Boolean Mapped(BufferTarget target); static void Resize( BufferTarget target, BufferSize size, BufferUsage usage = BufferUsage::StaticDraw ); static void RawData( BufferTarget target, BufferSize size, const GLvoid* data, BufferUsage usage = BufferUsage::StaticDraw ); static void Data( BufferTarget target, const BufferData& data, BufferUsage usage = BufferUsage::StaticDraw ); template <typename GLtype> static void Data( BufferTarget target, SizeType count, const GLtype* data, BufferUsage usage = BufferUsage::StaticDraw ); static void SubData( BufferTarget target, BufferSize offset, const BufferData& data ); template <typename GLtype> static void SubData( BufferTarget target, BufferSize offset, SizeType count, const GLtype* data ); #if GL_VERSION_3_1 || GL_ARB_copy_buffer static void CopySubData( BufferTarget readtarget, BufferTarget writetarget, BufferSize readoffset, BufferSize writeoffset, BufferSize size ); #endif #if GL_VERSION_4_3 template <typename GLtype> static void ClearData( BufferTarget target, PixelDataInternalFormat internal_format, PixelDataFormat format, const GLtype* value ); template <typename GLtype> static void ClearSubData( BufferTarget target, PixelDataInternalFormat internal_format, BufferSize offset, BufferSize size, PixelDataFormat format, const GLtype* value ); #endif #if GL_VERSION_4_4 || GL_ARB_buffer_storage static void Storage( BufferTarget target, const BufferData& data, Bitfield<BufferStorageBit> flags ); static void Storage( BufferTarget target, BufferSize size, const void* data, Bitfield<BufferStorageBit> flags ); static Boolean ImmutableStorage(BufferTarget target); static Bitfield<BufferStorageBit> StorageFlags(BufferTarget target); #endif
Indirectly inherits from ObjCommonOps<tag::Buffer>. |
|
Mapping of the buffer to the client address space. |
|
Returns true if the buffer currently bound to the specified |
|
Allocates or reallocates storage of a buffer currently bound to |
|
Uploads |
|
Uploads the specified |
|
Uploads the specified |
|
Copies a block of data of the specified |
|
Clears the whole buffer bound to |
|
Clears a sub-range (specified by |
|
Creates a data store for buffer currently bound to |
|
Returns true if the storage of the buffer currently bound to |
|
Returns the storage flags of a buffer currently bound to |
static SizeType Size(BufferTarget target); static BufferUsage Usage(BufferTarget target); static Bitfield<BufferMapAccess> Access(BufferTarget target); #if GL_ARB_sparse_buffer static void PageCommitment( BufferTarget target, BufferSize offset, BufferSize size, Boolean commit ); static SizeType PageSize(void); #endif #if GL_NV_shader_buffer_load static void MakeResident(BufferTarget target, AccessSpecifier access); static void MakeNonResident(BufferTarget target); static BufferGPUAddress GPUAddress(BufferTarget target); #endif };
Returns the size of a buffer currently bound to the specified |
|
Returns the usage hint of a buffer currently bound to the specified
|
|
Returns the access bits of a buffer currently bound to the specified
|
|
Commits and de-commits regions (specified by |
|
Returns the implementation-dependent sparse buffer storage page size.
See |
|
Makes buffer currently bound to |
|
Makes buffer currently bound to |
|
Returns the GPU address of the buffer currently bound to |
typedef ObjectOps<tag::ExplicitSel, tag::Buffer> BufferOps; typedef Object<BufferOps> Buffer; typedef ObjectZero<ObjZeroOps<tag::ExplicitSel, tag::Buffer>> NoBuffer;
struct BufferTargetAndUsage { }; BufferTargetAndUsage operator << ( BufferTarget target, BufferUsage usage ); struct BufferOpsAndIdxTgt { }; BufferOpsAndIdxTgt operator << ( const BufferOps& buffer, BufferIndexedTarget target ); struct BufferTargetAndOffset { }; BufferTargetAndOffset operator + ( BufferTarget target, BufferSize offset ); // Bind BufferTarget operator << ( const BufferOps& buf, BufferTarget target ); const BufferOps& operator << ( const BufferOpsAndIdxTgt& bat, GLuint index ); BufferTarget operator << ( BufferTarget target, const BufferData& data ); BufferTarget operator << ( BufferTargetAndUsage&& tau, const BufferData& data ); BufferTarget operator << ( BufferTargetAndOffset&& tao, const BufferData& data );
Helper class for syntax sugar operators. Binds together the buffer target and usage hint. |
|
Ties together a buffer |
|
Helper class for syntax sugar operators. Binds together a reference to a buffer and an indexed target. |
|
Ties together a reference to a |
|
Helper class for syntax sugar operators. Binds together a buffer target and offset value. |
|
Ties together a buffer target and offset value. |
|
Equivalent to |
|
Equivalent to |
|
Equivalent to |
|
Equivalent to |
|
Equivalent to |
#include
<oglplus/buffer_target.hpp>
enum class BufferTarget : GLenum { Array = GL_ARRAY_BUFFER, AtomicCounter = GL_ATOMIC_COUNTER_BUFFER, CopyRead = GL_COPY_READ_BUFFER, CopyWrite = GL_COPY_WRITE_BUFFER, DispatchIndirect = GL_DISPATCH_INDIRECT_BUFFER, DrawIndirect = GL_DRAW_INDIRECT_BUFFER, ElementArray = GL_ELEMENT_ARRAY_BUFFER, PixelPack = GL_PIXEL_PACK_BUFFER, PixelUnpack = GL_PIXEL_UNPACK_BUFFER, ShaderStorage = GL_SHADER_STORAGE_BUFFER, Texture = GL_TEXTURE_BUFFER, TransformFeedback = GL_TRANSFORM_FEEDBACK_BUFFER, Uniform = GL_UNIFORM_BUFFER, Query = GL_QUERY_BUFFER, Parameter = GL_PARAMETER_BUFFER_ARB, ExternalVirtualMemory = GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD }; template <> Range<BufferTarget> EnumValueRange<BufferTarget>(void); StrCRef EnumValueName(BufferTarget);
#if !OGLPLUS_NO_ENUM_VALUE_CLASSES
namespace enums {
template <typename Base, template<BufferTarget> class Transform>
class EnumToClass<Base, BufferTarget, Transform>
: public Base
{
public:
EnumToClass(void);
EnumToClass(Base&& base);
Transform<BufferTarget::Array>
Array;
Transform<BufferTarget::AtomicCounter>
AtomicCounter;
Transform<BufferTarget::CopyRead>
CopyRead;
Transform<BufferTarget::CopyWrite>
CopyWrite;
Transform<BufferTarget::DispatchIndirect>
DispatchIndirect;
Transform<BufferTarget::DrawIndirect>
DrawIndirect;
Transform<BufferTarget::ElementArray>
ElementArray;
Transform<BufferTarget::PixelPack>
PixelPack;
Transform<BufferTarget::PixelUnpack>
PixelUnpack;
Transform<BufferTarget::ShaderStorage>
ShaderStorage;
Transform<BufferTarget::Texture>
Texture;
Transform<BufferTarget::TransformFeedback>
TransformFeedback;
Transform<BufferTarget::Uniform>
Uniform;
Transform<BufferTarget::Query>
Query;
Transform<BufferTarget::Parameter>
Parameter;
Transform<BufferTarget::ExternalVirtualMemory>
ExternalVirtualMemory;
};
} // namespace enums
#endif
Specialization of EnumToClass for the BufferTarget enumeration. |
#include
<oglplus/buffer_target.hpp>
enum class BufferIndexedTarget : GLenum { AtomicCounter = GL_ATOMIC_COUNTER_BUFFER, ShaderStorage = GL_SHADER_STORAGE_BUFFER, TransformFeedback = GL_TRANSFORM_FEEDBACK_BUFFER, Uniform = GL_UNIFORM_BUFFER }; template <> Range<BufferIndexedTarget> EnumValueRange<BufferIndexedTarget>(void); StrCRef EnumValueName(BufferIndexedTarget);
#if !OGLPLUS_NO_ENUM_VALUE_CLASSES
namespace enums {
template <typename Base, template<BufferIndexedTarget> class Transform>
class EnumToClass<Base, BufferIndexedTarget, Transform>
: public Base
{
public:
EnumToClass(void);
EnumToClass(Base&& base);
Transform<BufferIndexedTarget::AtomicCounter>
AtomicCounter;
Transform<BufferIndexedTarget::ShaderStorage>
ShaderStorage;
Transform<BufferIndexedTarget::TransformFeedback>
TransformFeedback;
Transform<BufferIndexedTarget::Uniform>
Uniform;
};
} // namespace enums
#endif
Specialization of EnumToClass for the BufferIndexedTarget enumeration. |
#include
<oglplus/buffer_binding.hpp>
#if GL_VERSION_4_0 || GL_ARB_transform_feedback3 class UniformBufferBindingPoint : public LimitedCount<GL_MAX_UNIFORM_BUFFER_BINDINGS> { public: UniformBufferBindingPoint(GLuint number); }; #endif #if GL_VERSION_4_0 || GL_ARB_transform_feedback3 class TransformFeedbackBufferBindingPoint : public LimitedCount<GL_MAX_TRANSFORM_FEEDBACK_BUFFERS> { public: TransformFeedbackBufferBindingPoint(GLuint number); }; #endif #if GL_VERSION_4_2 || GL_ARB_shader_atomic_counters class AtomicCounterBufferBindingPoint : public LimitedCount<GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS> { public: AtomicCounterBufferBindingPoint(GLuint number); }; #endif #if GL_VERSION_4_3 || GL_ARB_shader_storage_buffer_object class ShaderStorageBufferBindingPoint : public LimitedCount<GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS> { public: ShaderStorageBufferBindingPoint(GLuint number); }; #endif
Throws LimitError
if |
|
Throws LimitError
if |
|
Throws LimitError
if |
|
Throws LimitError
if |
#include
<oglplus/buffer_usage.hpp>
enum class BufferUsage : GLenum { StreamDraw = GL_STREAM_DRAW, StreamRead = GL_STREAM_READ, StreamCopy = GL_STREAM_COPY, StaticDraw = GL_STATIC_DRAW, StaticRead = GL_STATIC_READ, StaticCopy = GL_STATIC_COPY, DynamicDraw = GL_DYNAMIC_DRAW, DynamicRead = GL_DYNAMIC_READ, DynamicCopy = GL_DYNAMIC_COPY }; template <> Range<BufferUsage> EnumValueRange<BufferUsage>(void); StrCRef EnumValueName(BufferUsage);
#include
<oglplus/buffer_storage_bit.hpp>
enum class BufferStorageBit : GLbitfield { MapRead = GL_MAP_READ_BIT, MapWrite = GL_MAP_WRITE_BIT, MapPersistent = GL_MAP_PERSISTENT_BIT, MapCoherent = GL_MAP_COHERENT_BIT, DynamicStorage = GL_DYNAMIC_STORAGE_BIT, ClientStorage = GL_CLIENT_STORAGE_BIT, SparseStorage = GL_SPARSE_STORAGE_BIT_ARB }; template <> Range<BufferStorageBit> EnumValueRange<BufferStorageBit>(void); StrCRef EnumValueName(BufferStorageBit); Bitfield<BufferStorageBit> operator | (BufferStorageBit b1, BufferStorageBit b2);
The BufferSize
class is used to store GPU buffer sizes
in units of machine byte. Instances of this class are mostly used as parameters
to buffer-related functions specifying buffer data offset and size.
#include
<oglplus/buffer_size.hpp>
class BufferSize { public: BufferSize(void); BufferSize(BigSizeType size); template <typename T> BufferSize(unsigned count, const T*); template <typename T, std::size_t N> BufferSize(const T (&)[N]); template <typename T, std::size_t N> BufferSize(const std::array<T, N>& array); template <typename T> BufferSize(const std::vector<T>& vector); operator BigSizeType (void) const noexcept; template <typename T> static BufferSize Of(unsigned count, const T* data =nullptr
); template <typename T> BufferSize Add(unsigned count, const T* =nullptr
) const; BufferSize Add(const BufferSize& buffer_size); const GLsizeiptr Get(void) const; };
Constructs a zero size. |
|
Constructs a |
|
Constructs a |
|
Constructs a |
|
Constructs a |
|
Constructs a |
|
Implicit conversion to the underlying BigSizeType. |
|
Makes a new instance of |
|
Returns a new |
|
Returns a new |
|
Returns the stored size in bytes. |
The BufferTypedSize
template class is a helper ancestor
of BufferSize
that is used to construct instances of
BufferSize
with fixed data type.
template <typename T> class BufferTypedSize : public BufferSize { public: BufferTypedSize(void); BufferTypedSize(GLsizeiptr count); };
The BufferData
class is used to store a pointer to and
the size of a block of memory containing data to be uploaded to a GPU buffer.
Instances of this class are mostly used as parameters to buffer-related
functions specifying buffer data to be uploaded to the GPU's memory.
Note | |
---|---|
This class does not do an internal deep copy of the data passed to the
constructors. The original memory block must not be free'd while any
instances of |
#include
<oglplus/buffer_data.hpp>
class BufferData { public: BufferData(BufferSize size, const GLvoid* data); /// Construction from @p count of instances of type @c T at @p data template <typename T> BufferData(SizeType count, const T* data); template <typename T, std::size_t N> BufferData(const T (&data)[N]); template <typename T, std::size_t N> BufferData(const std::array<T, N>& array); template <typename T> BufferData(const std::vector<T>& vector); };
Constructs |
|
Constructs |
|
Constructs |
|
Constructs |
|
Constructs |
The BufferGPUAddress
class encapsulates buffers GPU
address value.
#include
<oglplus/buffer_gpu_addr.hpp>
#if GL_NV_shader_buffer_load class BufferGPUAddress { public: BufferGPUAddress(GLuint64EXT addr); }; GLuint64EXT GetGLAddress(BufferGPUAddress bga); #endif