glCopyBufferSubData and glCopyNamedBufferSubData copy part of the data store attached to a source buffer object to the data store attached to a destination buffer object. The number of basic machine units indicated by size is copied from the source at offset readOffset to the destination at writeOffset. readOffset, writeOffset and size are in terms of basic machine units.
For glCopyBufferSubData, readTarget and writeTarget specify the targets to which the source and destination buffer objects are bound, and must each be one of the buffer binding targets in the following table:
|Buffer Binding Target||
Atomic counter storage
Buffer copy source
Buffer copy destination
Indirect compute dispatch commands
Indirect command arguments
Vertex array indices
Pixel read target
Texture data source
Query result buffer
Read-write storage for shaders
Texture data buffer
Transform feedback buffer
Uniform block storage
Any of these targets may be used, but the targets GL_COPY_READ_BUFFER and GL_COPY_WRITE_BUFFER are provided specifically to allow copies between buffers without disturbing other GL state.
readOffset, writeOffset and size must all be greater than or equal to zero. Furthermore, $readOffset+size$ must not exceeed the size of the source buffer object, and $writeOffset+size$ must not exceeed the size of the buffer bound to writeTarget. If the source and destination are the same buffer object, then the source and destination ranges must not overlap.
The GL_DISPATCH_INDIRECT_BUFFER and GL_SHADER_STORAGE_BUFFER targets are available only if the GL version is 4.3 or greater.
GL_INVALID_ENUM is generated by glCopyBufferSubData if readTarget or writeTarget is not one of the buffer binding targets listed above.
GL_INVALID_OPERATION is generated by glCopyBufferSubData if zero is bound to readTarget or writeTarget.
GL_INVALID_OPERATION is generated by glCopyNamedBufferSubData if readBuffer or writeBuffer is not the name of an existing buffer object.
GL_INVALID_VALUE is generated if any of readOffset, writeOffset or size is negative, if $readOffset + size$ is greater than the size of the source buffer object (its value of GL_BUFFER_SIZE), or if $writeOffset + size$ is greater than the size of the destination buffer object.
GL_INVALID_VALUE is generated if the source and destination are the same buffer object, and the ranges $[readOffset,readOffset+size)$ and $[writeOffset,writeOffset+size)$ overlap.
GL_INVALID_OPERATION is generated if either the source or destination buffer object is mapped with glMapBufferRange() or glMapBuffer(), unless they were mapped with the GL_MAP_PERSISTENT bit set in the glMapBufferRange access flags.
|Function / Feature Name||2.0||2.1||3.0||3.1||3.2||3.3||4.0||4.1||4.2||4.3||4.4||
Copyright © 2010-2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. m[blue]http://opencontent.org/openpub/m.