PrevUpHomeNext

DSA Buffers

#include <oglplus/dsa/buffer.hpp>

DSA Operations with explicit selector

#if GL_VERSION_4_5 || GL_ARB_direct_state_access

template <>
class ObjectOps<tag::DirectState, tag::Buffer>
 : public ObjZeroOps<tag::DirectState, tag::Buffer> 1
{
public:
	struct Property
	{
		typedef BufferUsage Usage;
		typedef BufferMapAccess MapAccess;
	};

	typedef DSABufferTypedMap<GLubyte> Map; 2

	Boolean Mapped(void) const; 3

	void Resize(
		BufferSize size,
		BufferUsage usage = BufferUsage::StaticDraw
	) const; 4

	void RawData(
		BufferSize size,
		const GLvoid* data,
		BufferUsage usage = BufferUsage::StaticDraw
	) const; 5

	void Data(
		const BufferData& data,
		BufferUsage usage = BufferUsage::StaticDraw
	) const; 6

	template <typename GLtype>
	void Data(
		SizeType count,
		const GLtype* data,
		BufferUsage usage = BufferUsage::StaticDraw
	) const;

	void SubData(
		BufferSize offset,
		const BufferData& data
	) const; 7

	template <typename GLtype>
	static void SubData(
		BufferSize offset,
		SizeType count,
		const GLtype* data
	);

	static void CopySubData(
		BufferName readbuffer,
		BufferName writebuffer,
		BufferSize readoffset,
		BufferSize writeoffset,
		BufferSize size
	); 8

	template <typename GLtype>
	void ClearData(
		PixelDataInternalFormat internal_format,
		PixelDataFormat format,
		const GLtype* value
	) const; 9

	template <typename GLtype>
	void ClearSubData(
		BufferTarget target,
		PixelDataInternalFormat internal_format,
		BufferSize offset,
		BufferSize size,
		PixelDataFormat format,
		const GLtype* value
	) const; 10

	void Storage(
		const BufferData& data,
		Bitfield<BufferStorageBit> flags
	) const; 11
	void Storage(
		BufferSize size,
		const void* data,
		Bitfield<BufferStorageBit> flags
	) const;

1

Indirectly inherits from ObjCommonOps<tag::Buffer>.

2

Mapping of the buffer to the client address space.

3

Returns true if this buffer is mapped. See glGetNamedBufferParameter, GL_BUFFER_MAPPED.

4

Allocates or reallocates storage of this buffer to the specified size without uploading any data, taking usage as a hint. See glNamedBufferData.

5

Uploads size bytes from the location pointed to by data to this buffer taking usage as a hint. See glNamedBufferData.

6

Uploads the specified data to this buffer taking usage as a hint. See glNamedBufferData.

7

Uploads the specified data to a sub-range (starting at offset) of this buffer. See glNamedBufferSubData.

8

Copies a block of data of the specified size from readbuffer starting at readoffset to writebuffer starting at writeoffset. See glCopyNamedBufferSubData.

9

Clears this with the specified fixed value, in the specified format. See glClearNamedBufferSubData.

10

Clears a sub-range (specified by offset and size) of this buffer with the specified fixed value, using the specified internal_format.

11

Creates a data store for this buffer and uploads the specified data. See glNamedBufferStorage.

	SizeType Size(void) const; 1
	BufferUsage Usage(void) const; 2
	Bitfield<BufferMapAccess> Access(void) const; 3

#if GL_NV_shader_buffer_load
	void MakeResident(AccessSpecifier access); 4
	void MakeNonResident(void); 5
	BufferGPUAddress GPUAddress(void) const; 6
#endif
};

1

Returns the size of this buffer. See glGet, GL_BUFFER_SIZE.

2

Returns the usage hint of this buffer. See glGet, GL_BUFFER_USAGE.

3

Returns the access bits of this buffer. See glGet, GL_BUFFER_ACCESS.

4

Makes this accessible to GLSL shaders. See glMakeBufferResidentNV

5

Makes this buffer inaccessible to GLSL shaders. See glMakeBufferNonResidentNV

6

Returns the GPU address of this buffer. See glGetBufferParameter, GL_BUFFER_GPU_ADDRESS_NV.

Definition

typedef ObjectOps<tag::DirectState, tag::Buffer>
	DSABufferOps;

typedef Object<DSABufferOps> DSABuffer;

Syntax sugar operators

struct DSABufferOpsAndUsage { }; 1

DSABufferOpsAndUsage operator << (
	DSABufferOps& buffer,
	BufferUsage usage
); 2


struct DSABufferOpsAndIdxTgt { }; 3

DSABufferOpsAndIdxTgt operator << (
	DSABufferOps& buffer,
	BufferIndexedTarget target
); 4

struct DSABufferOpsAndOffset { }; 5

DSABufferOpsAndOffset operator + (
	DSABufferOps& buffer,
	BufferSize offset
); 6

const DSABufferOps& operator << (
	DSABufferOps& buffer,
	BufferTarget target
); 7

DSABufferOps& operator << (
	const DSABufferOpsAndIdxTgt& bat,
	GLuint index
); 8

DSABufferOps& operator << (
	DSABufferOps& buffer,
	const BufferData& data
); 9

DSABufferOps& operator << (
	BufferTargetAndUsage&& tau,
	const BufferData& data
); 10

DSABufferOps& operator << (
	BufferTargetAndOffset&& tao,
	const BufferData& data
); 11

#endif // GL_VERSION_4_5 || GL_ARB_direct_state_access

1

Helper class for syntax sugar operators. Binds together the buffer name and usage hint.

2

Ties together a buffer and usage hint.

3

Helper class for syntax sugar operators. Binds together a reference to a buffer and an indexed target.

4

Ties together a reference to a buffer and an indexed target.

5

Helper class for syntax sugar operators. Binds together a buffer target and offset value.

6

Ties together a buffer and offset value.

7

Equivalent to buf.Bind(target).

8

Equivalent to buffer.BindBase(target, index).

9

Equivalent to buffer.Data(data).

10

Equivalent to buffer.Data(data, usage).

11

Equivalent to buffer.SubData(offset, data).


PrevUpHomeNext