PrevUpHomeNext

DSA buffer maps

#include <oglplus/dsa/buffer_map.hpp>

Raw

The DSABufferRawMap allows to map the contents of a GPU buffer into the client's address space.

#if GL_VERSION_4_5 || GL_ARB_direct_state_access

class DSABufferRawMap
{
public:
	DSABufferRawMap(
		BufferName buffer,
		BufferSize offset,
		BufferSize size,
		Bitfield<BufferMapAccess> access
	); 1

	DSABufferRawMap(
		BufferName buffer,
		Bitfield<BufferMapAccess> access
	); 2

	DSABufferRawMap(const DSABufferRawMap&) = delete; 3
	DSABufferRawMap(DSABufferRawMap&&); 4

	~DSABufferRawMap(void); 5
	void Unmap(void);

	bool Mapped(void) const; 6
	GLsizeiptr Size(void) const; 7

	const GLvoid* RawData(void) const; 8
	GLvoid* RawData(void);

	void FlushRange(BufferSize offset, BufferSize length); 9
};

1

Maps a range (specified by offset and size) of the specified buffer with the specified access to the client address space. See glMapNamedBufferRange.

2

Maps the whole specified buffer with the specified access to the client address space. See glMapNamedBuffer.

3

DSABuffer maps are not copyable.

4

DSABuffer maps are moveable.

5

Unmaps the buffer from client address space (if mapped). See glUnmapNamedBuffer.

6

Returns true if the buffer is mapped.

7

Returns the size (in bytes) of the mapped buffer.

8

Returns a raw pointer to the mapped data. Note that the buffer has to be mapped or the result is undefined.

9

Indicate modifications to a mapped buffer range. Note that the buffer has to be mapped or the result is undefined. See glFlushMappedNamedBufferRange.

Types

template <typename Type>
class DSABufferTypedMap
 : public DSABufferRawMap
{
public:
	DSABufferTypedMap(
		BufferName buffer,
		BufferTypedSize<Type> offset,
		BufferTypedSize<Type> size,
		Bitfield<BufferMapAccess> access
	) 1

	DSABufferTypedMap(
		BufferName buffer,
		Bitfield<BufferMapAccess> access
	); 2

	GLsizeiptr Count(void) const; 3

	const Type* Data(void) const; 4
	Type* Data(void);

	const Type& At(GLuint index) const; 5
	Type& At(GLuint index);

	void FlushElements(
		BufferTypedSize<Type> start,
		BufferTypedSize<Type> count
	); 6
};

#endif // GL_VERSION_4_5 || GL_ARB_direct_state_access

1

Maps a range (specified by offset and size) of the specified buffer with the specified access to the client address space. See glMapNamedBufferRange.

2

Maps the whole specified buffer with the specified access to the client address space. See glMapNamedBuffer.

3

Returns the count of elements of Type in the mapped buffer.

4

Returns a typed pointer to the mapped data. Note that the buffer has to be mapped or the result is undefined.

5

Returns a reference to the element at the specified index. Note that the buffer has to be mapped or the result is undefined.

6

Indicate modifications to a mapped range of elements of Type. Note that the buffer has to be mapped or the result is undefined. See glFlushMappedNamedBufferRange.


PrevUpHomeNext