13 #ifndef OGLPLUS_DSA_BUFFER_1309301821_HPP
14 #define OGLPLUS_DSA_BUFFER_1309301821_HPP
21 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_5 || GL_ARB_direct_state_access
26 typedef tag::Create Type;
35 :
public ObjZeroOps<tag::DirectState, tag::Buffer>
40 GLint GetIntParam(GLenum query)
const;
65 return GetIntParam(GL_BUFFER_MAPPED) == GL_TRUE;
83 OGLPLUS_GLFUNC(NamedBufferData)(
110 OGLPLUS_GLFUNC(NamedBufferData)(
112 GLsizei(data.Size()),
151 template <
typename GLtype>
172 OGLPLUS_GLFUNC(NamedBufferSubData)(
174 GLintptr(offset.
Get()),
175 GLsizei(data.Size()),
191 template <
typename GLtype>
201 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_1 || GL_ARB_copy_buffer
218 OGLPLUS_GLFUNC(CopyNamedBufferSubData)(
221 GLintptr(readoffset.
Get()),
222 GLintptr(writeoffset.
Get()),
223 GLsizeiptr(size.
Get())
226 CopyNamedBufferSubData,
232 #endif // copy buffer
245 template <
typename GLtype>
252 OGLPLUS_GLFUNC(ClearNamedBufferData)(
254 GLenum(internal_format),
256 GLenum(GetDataType<GLtype>()),
260 ClearNamedBufferData,
263 EnumParam(internal_format)
278 template <
typename GLtype>
287 OGLPLUS_GLFUNC(ClearNamedBufferSubData)(
289 GLenum(internal_format),
290 GLintptr(offset.
Get()),
291 GLsizeiptr(size.
Get()),
293 GLenum(GetDataType<GLtype>()),
297 ClearNamedBufferSubData,
300 EnumParam(internal_format)
309 OGLPLUS_GLFUNC(NamedBufferStorage)(
311 GLsizeiptr(data.Size()),
325 Bitfield<BufferStorageBit> flags
328 Storage(BufferData(size, data), flags);
341 return GLsizei(GetIntParam(GL_BUFFER_SIZE));
372 GLbitfield(GetIntParam(GL_BUFFER_ACCESS))
376 #if OGLPLUS_DOCUMENTATION_ONLY || GL_NV_shader_buffer_load
387 OGLPLUS_GLFUNC(MakeNamedBufferResidentNV)(
392 MakeNamedBufferResidentNV,
409 OGLPLUS_GLFUNC(MakeNamedBufferNonResidentNV)(_name);
411 MakeNamedBufferNonResidentNV,
428 GLuint64EXT value = 0;
429 OGLPLUS_GLFUNC(GetNamedBufferParameterui64vNV)(
431 GL_BUFFER_GPU_ADDRESS_NV,
435 GetNamedBufferParameterui64vNV,
439 return BufferGPUAddress(value);
445 typedef ObjectOps<tag::DirectState, tag::Buffer>
449 struct DSABufferOpsAndUsage
460 inline DSABufferOpsAndUsage operator << (
465 return DSABufferOpsAndUsage(buf, usage);
469 struct DSABufferOpsAndIdxTgt
480 inline DSABufferOpsAndIdxTgt operator << (
485 return DSABufferOpsAndIdxTgt(buf, target);
489 struct DSABufferOpsAndOffset
500 inline DSABufferOpsAndOffset operator + (
505 return DSABufferOpsAndOffset(buf, offset);
522 const DSABufferOpsAndIdxTgt& bat,
526 bat.buf.BindBase(bat.target, index);
531 template <
typename GLtype>
534 const std::vector<GLtype>& data
542 template <
typename GLtype>
544 DSABufferOpsAndUsage&& bau,
545 const std::vector<GLtype>& data
548 bau.buf.
Data(data, bau.usage);
553 template <
typename GLtype, std::
size_t Count>
556 const GLtype (&data)[Count]
564 template <
typename GLtype, std::
size_t Count>
566 DSABufferOpsAndUsage&& bau,
567 const GLtype (&data)[Count]
570 bau.buf.
Data(data, bau.usage);
575 template <
typename GLtype>
577 DSABufferOpsAndOffset&& bao,
578 const std::vector<GLtype>& data
581 bao.buf.
SubData(bao.offset, data);
586 template <
typename GLtype, std::
size_t Count>
588 DSABufferOpsAndOffset&& bao,
589 const GLtype (&data)[Count]
592 bao.buf.
SubData(bao.offset, data);
602 #endif // GL_ARB_direct_state_access
606 #if !OGLPLUS_LINK_LIBRARY || defined(OGLPLUS_IMPLEMENTING_LIBRARY)
607 #include <oglplus/dsa/buffer.ipp>
608 #endif // OGLPLUS_LINK_LIBRARY
610 #endif // include guard
void Data(GLsizei count, const GLtype *data, BufferUsage usage=BufferUsage::StaticDraw) const
Uploads (sets) the buffer data.
Definition: buffer.hpp:152
void MakeNonResident(void) const
Makes this buffer inaccessible to GLSL shaders.
Definition: buffer.hpp:407
void RawData(BufferSize size, const GLvoid *data, BufferUsage usage=BufferUsage::StaticDraw) const
Uploads (sets) the buffer data.
Definition: buffer.hpp:133
void ClearData(PixelDataInternalFormat internal_format, PixelDataFormat format, const GLtype *data) const
Clear the buffer data.
Definition: buffer.hpp:246
Untyped mapping of the buffer to the client address space.
Definition: buffer_map.hpp:219
PixelDataInternalFormat
OpenGL pixel data internal format enumeration.
Definition: pixel_data.hpp:79
void SubData(BufferSize offset, const BufferData &data) const
Uploads (sets) a subrange of the buffer data.
Definition: buffer.hpp:167
This class represents the size of a GPU buffer in bytes.
Definition: buffer_size.hpp:22
BufferUsage
Buffer usage enumeration.
Definition: buffer_usage.hpp:24
BufferMap wrappers with direct state access.
This template serves as a wrapper for OpenGL bitfields.
Definition: bitfield.hpp:56
Implements operations applicable to named (non-zero) objects.
Definition: wrap_tpl.hpp:45
GLuint GetGLName(ObjectName< ObjTag > named)
Returns the GLuint OpenGL name assigned to named object.
Definition: name.hpp:38
void Resize(BufferSize size, BufferUsage usage=BufferUsage::StaticDraw)
Allocates buffer storage to the specified size without any data.
Definition: buffer.hpp:78
AccessSpecifier
Enumeration of access type specifiers.
Definition: access_specifier.hpp:27
BufferUsage Usage
The Buffer usage mode.
Definition: buffer.hpp:46
void Data(const BufferData &data, BufferUsage usage=BufferUsage::StaticDraw) const
Uploads (sets) the buffer data.
Definition: buffer.hpp:105
BufferGPUAddress GPUAddress(void) const
Returns the GPU address of this buffer.
Definition: buffer.hpp:426
PixelDataFormat
OpenGL pixel data format enumeration.
Definition: pixel_data.hpp:50
BufferUsage Usage(void) const
Returns the buffer usage.
Definition: buffer.hpp:354
void ClearSubData(PixelDataInternalFormat internal_format, BufferSize offset, BufferSize size, PixelDataFormat format, const GLtype *data) const
Clear a subrange of the buffer data.
Definition: buffer.hpp:279
Bitfield< BufferMapAccess > Access(void) const
Returns the buffer usage.
Definition: buffer.hpp:369
Implements operations applicable to any object including object 0 (zero)
Definition: fwd.hpp:157
GLsizeiptr Get(void) const
Gets the size in bytes.
Definition: buffer_size.hpp:58
BufferMapAccess
Buffer map access enumeration.
Definition: buffer_map_access.hpp:25
void MakeResident(AccessSpecifier access) const
Makes this buffer accessible to GLSL shaders.
Definition: buffer.hpp:385
static void CopySubData(BufferName readbuffer, BufferName writebuffer, BufferSize readoffset, BufferSize writeoffset, BufferSize size)
Copy data between buffers.
Definition: buffer.hpp:210
Class used for passing the size of and pointer to data to be put in a Buffer.
Definition: buffer_data.hpp:21
BufferIndexedTarget
Buffer indexed bind target.
Definition: buffer_target.hpp:46
DSABufferTypedMap< GLubyte > Map
Mapping of the buffer to the client address space.
Definition: buffer.hpp:53
Exception class for GL object-related errors.
Definition: object.hpp:24
GLsizei Size(void) const
Returns the buffer size.
Definition: buffer.hpp:339
void SubData(BufferSize offset, GLsizei count, GLtype *data) const
Uploads (sets) a subrange of the buffer data.
Definition: buffer.hpp:192
Object< DSABufferOps > DSABuffer
An oglplus_object encapsulating the OpenGL buffer functionality.
Definition: buffer.hpp:600
bool Mapped(void) const
Returns true if the buffer is mapped.
Definition: buffer.hpp:63
BufferMapAccess MapAccess
The buffer map access mode.
Definition: buffer.hpp:49
void Bind(Target target) const
Binds this buffer to the specified target.
Definition: buffer.hpp:294
A common template for "named" objects like textures, buffers, etc.
Definition: fwd.hpp:136
Class wrapping buffer-related functionality with direct state access.
Definition: buffer.hpp:34
BufferTarget
Buffer bind target.
Definition: buffer_target.hpp:24
ObjectOps< tag::DirectState, tag::Buffer > DSABufferOps
Buffer operations with direct state access.
Definition: buffer.hpp:446