PrevUpHomeNext

Buffer maps

#include <oglplus/buffer_map.hpp>

Raw

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

class BufferRawMap
{
public:
	BufferRawMap(
		BufferTarget target,
		BufferSize offset,
		BufferSize size,
		Bitfield<BufferMapAccess> access
	); 1

	BufferRawMap(
		BufferTarget target,
		Bitfield<BufferMapAccess> access
	); 2

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

	~BufferRawMap(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 a buffer currently bound to target with the specified access to the client address space. See glMapBufferRange.

2

Maps the whole buffer currently bound to the specified target with the specified access to the client address space. See glMapBuffer.

3

Buffer maps are not copyable.

4

Buffer maps are moveable.

5

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

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 glFlushMappedBufferRange.

Types

template <typename Type>
class BufferTypedMap
 : public BufferRawMap
{
public:
	BufferTypedMap(
		BufferTarget target,
		BufferTypedSize<Type> offset,
		BufferTypedSize<Type> size,
		Bitfield<BufferMapAccess> access
	) 1

	BufferTypedMap(
		BufferTarget target,
		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
};

1

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

2

Maps the whole buffer currently bound to the specified target with the specified access to the client address space. See glMapBuffer.

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 glFlushMappedBufferRange.

Access

#include <oglplus/buffer_map_access.hpp>

enum class BufferMapAccess : GLbitfield
{
	Read             = GL_MAP_READ_BIT,
	Write            = GL_MAP_WRITE_BIT,
	Persistent       = GL_MAP_PERSISTENT_BIT,
	Coherent         = GL_MAP_COHERENT_BIT,
	InvalidateRange  = GL_MAP_INVALIDATE_RANGE_BIT,
	InvalidateBuffer = GL_MAP_INVALIDATE_BUFFER_BIT,
	FlushExplicit    = GL_MAP_FLUSH_EXPLICIT_BIT,
	Unsynchronized   = GL_MAP_UNSYNCHRONIZED_BIT
};

template <>
Range<BufferMapAccess> EnumValueRange<BufferMapAccess>(void);

StrCRef EnumValueName(BufferMapAccess);

Bitfield<BufferMapAccess> operator | (BufferMapAccess b1, BufferMapAccess b2);

PrevUpHomeNext