15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci NV_copy_buffer 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_NV_copy_buffer 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Mathias Heyer, NVIDIA Corporation (mheyer 'at' nvidia.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciContributors 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci From ARB_copy_buffer: 165bd8deadSopenharmony_ci Rob Barris, Blizzard Entertainment 175bd8deadSopenharmony_ci Bruce Merry, ARM 185bd8deadSopenharmony_ci Eric Werness, NVIDIA 195bd8deadSopenharmony_ci Greg Roth, NVIDIA 205bd8deadSopenharmony_ci Daniel Koch, NVIDIA 215bd8deadSopenharmony_ci 225bd8deadSopenharmony_ciStatus 235bd8deadSopenharmony_ci 245bd8deadSopenharmony_ci Shipping on Tegra 255bd8deadSopenharmony_ci 265bd8deadSopenharmony_ciVersion 275bd8deadSopenharmony_ci 285bd8deadSopenharmony_ci Last Modified Date: September 20, 2013 295bd8deadSopenharmony_ci Author Revision: 3 305bd8deadSopenharmony_ci 315bd8deadSopenharmony_ciNumber 325bd8deadSopenharmony_ci 335bd8deadSopenharmony_ci OpenGL ES Extension #158 345bd8deadSopenharmony_ci 355bd8deadSopenharmony_ciDependencies 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ci Written based on the wording of the OpenGL ES 2.0.25 (Nov, 2010) 385bd8deadSopenharmony_ci specification. 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ci OES_mapbuffer extension affects the definition of this extension. 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ciOverview 435bd8deadSopenharmony_ci 445bd8deadSopenharmony_ci This extension provides a mechanism to do an accelerated copy from one 455bd8deadSopenharmony_ci buffer object to another. This may be useful to load buffer objects 465bd8deadSopenharmony_ci in a "loading thread" while minimizing cost and synchronization effort 475bd8deadSopenharmony_ci in the "rendering thread." 485bd8deadSopenharmony_ci 495bd8deadSopenharmony_ciNew Tokens 505bd8deadSopenharmony_ci 515bd8deadSopenharmony_ci Accepted by the target parameters of BindBuffer, BufferData, 525bd8deadSopenharmony_ci BufferSubData, MapBufferOES, UnmapBufferOES, 535bd8deadSopenharmony_ci GetBufferPointervOES, GetBufferParameteriv and CopyBufferSubDataNV: 545bd8deadSopenharmony_ci 555bd8deadSopenharmony_ci COPY_READ_BUFFER_NV 0x8F36 565bd8deadSopenharmony_ci COPY_WRITE_BUFFER_NV 0x8F37 575bd8deadSopenharmony_ci 585bd8deadSopenharmony_ciNew Procedures and Functions 595bd8deadSopenharmony_ci 605bd8deadSopenharmony_ci void CopyBufferSubDataNV(enum readtarget, enum writetarget, 615bd8deadSopenharmony_ci intptr readoffset, intptr writeoffset, 625bd8deadSopenharmony_ci sizeiptr size); 635bd8deadSopenharmony_ci 645bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL ES 2.0 Specification (Rasterization) 655bd8deadSopenharmony_ci 665bd8deadSopenharmony_ci Add a new subsection "Copying Between Buffers" to section 2.9: 675bd8deadSopenharmony_ci 685bd8deadSopenharmony_ci All or part of one buffer object's data store may be copied to the 695bd8deadSopenharmony_ci data store of another buffer object by calling 705bd8deadSopenharmony_ci 715bd8deadSopenharmony_ci void CopyBufferSubDataNV(enum readtarget, enum writetarget, 725bd8deadSopenharmony_ci intptr readoffset, intptr writeoffset, 735bd8deadSopenharmony_ci sizeiptr size); 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ci with readtarget and writetarget each set to one of the targets 765bd8deadSopenharmony_ci ARRAY_BUFFER, COPY_READ_BUFFER_NV, COPY_WRITE_BUFFER_NV or 775bd8deadSopenharmony_ci ELEMENT_ARRAY_BUFFER. While any of these targets may be used, 785bd8deadSopenharmony_ci the COPY_READ_BUFFER_NV and COPY_WRITE_BUFFER_NV targets are 795bd8deadSopenharmony_ci provided specifically for copies, so that they can be done without 805bd8deadSopenharmony_ci affecting other buffer binding targets that may be in use. 815bd8deadSopenharmony_ci writeoffset and size specify the range of data in the buffer object 825bd8deadSopenharmony_ci bound to writetarget that is to be replaced, in terms of basic machine 835bd8deadSopenharmony_ci units. readoffset and size specify the range of data in the buffer 845bd8deadSopenharmony_ci object bound to readtarget that is to be copied to the corresponding 855bd8deadSopenharmony_ci region of writetarget. 865bd8deadSopenharmony_ci 875bd8deadSopenharmony_ci A buffer object is bound to COPY_READ_BUFFER_NV or COPY_WRITE_BUFFER_NV 885bd8deadSopenharmony_ci by calling BindBuffer with target set to COPY_READ_BUFFER_NV or 895bd8deadSopenharmony_ci COPY_WRITE_BUFFER_NV and buffer set to the name of the buffer object. 905bd8deadSopenharmony_ci If no corresponding buffer object exists, one is initialized as 915bd8deadSopenharmony_ci defined in section 2.9. 925bd8deadSopenharmony_ci 935bd8deadSopenharmony_ci The commands BufferData, BufferSubData, MapBufferOES, UnmapBufferOES, 945bd8deadSopenharmony_ci GetBufferPointervOES, GetBufferParameteriv (section 6.1.3) may be used 955bd8deadSopenharmony_ci with target set to COPY_READ_BUFFER_NV or COPY_WRITE_BUFFER_NV. In such 965bd8deadSopenharmony_ci event, these commands operate in the same fashion as described in section 975bd8deadSopenharmony_ci 2.9 and 6.3.1 but on the buffer currently bound to target 985bd8deadSopenharmony_ci COPY_READ_BUFFER_NV or COPY_WRITE_BUFFER_NV respectively. 995bd8deadSopenharmony_ci 1005bd8deadSopenharmony_ci An INVALID_VALUE error is generated if any of readoffset, 1015bd8deadSopenharmony_ci writeoffset, or size are negative, if readoffset+size exceeds the 1025bd8deadSopenharmony_ci size of the buffer object bound to readtarget, or if 1035bd8deadSopenharmony_ci writeoffset+size exceeds the size of the buffer object bound to 1045bd8deadSopenharmony_ci writetarget. 1055bd8deadSopenharmony_ci 1065bd8deadSopenharmony_ci An INVALID_VALUE error is generated if the same buffer object is 1075bd8deadSopenharmony_ci bound to both readtarget and writetarget, and the ranges 1085bd8deadSopenharmony_ci [readoffset, readoffset+size) and [writeoffset, writeoffset+size) 1095bd8deadSopenharmony_ci overlap. 1105bd8deadSopenharmony_ci 1115bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if zero is bound to 1125bd8deadSopenharmony_ci readtarget or writetarget. 1135bd8deadSopenharmony_ci 1145bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if the buffer objects 1155bd8deadSopenharmony_ci bound to either readtarget or writetarget are mapped. 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ciAdditions to the AGL/EGL/GLX/WGL Specifications 1185bd8deadSopenharmony_ci 1195bd8deadSopenharmony_ci None 1205bd8deadSopenharmony_ci 1215bd8deadSopenharmony_ciErrors 1225bd8deadSopenharmony_ci 1235bd8deadSopenharmony_ci The error INVALID_VALUE is generated by CopyBufferSubDataNV if 1245bd8deadSopenharmony_ci readoffset, writeoffset, or size are less than zero, or if 1255bd8deadSopenharmony_ci readoffset+size is greater than the value of BUFFER_SIZE of 1265bd8deadSopenharmony_ci readtarget/readBuffer, or if writeoffset+size is greater than the 1275bd8deadSopenharmony_ci value of BUFFER_SIZE of writetarget/writeBuffer. 1285bd8deadSopenharmony_ci 1295bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by CopyBufferSubDataNV if 1305bd8deadSopenharmony_ci either readtarget/readBuffer or writetarget/writeBuffer are mapped. 1315bd8deadSopenharmony_ci 1325bd8deadSopenharmony_ci The error INVALID_VALUE is generated by CopyBufferSubDataNV if 1335bd8deadSopenharmony_ci readtarget/readBuffer and writetarget/writeBuffer are the same 1345bd8deadSopenharmony_ci buffer object, and the ranges [readoffset, readoffset+size) and 1355bd8deadSopenharmony_ci [writeoffset, writeoffset+size) overlap. 1365bd8deadSopenharmony_ci 1375bd8deadSopenharmony_ciNew State 1385bd8deadSopenharmony_ci 1395bd8deadSopenharmony_ci (add to table 6.2, Vertex Array State) 1405bd8deadSopenharmony_ci 1415bd8deadSopenharmony_ci Initial 1425bd8deadSopenharmony_ci Get Value Type Get Command Value Description Sec. 1435bd8deadSopenharmony_ci ---------------- ---- ----------- ------- --------------------------- ------ 1445bd8deadSopenharmony_ci COPY_READ_BUFFER_NV Z+ GetIntegerv 0 Buffer object bound to the 2.9 1455bd8deadSopenharmony_ci copy buffer "read" binding 1465bd8deadSopenharmony_ci point 1475bd8deadSopenharmony_ci COPY_WRITE_BUFFER_NV Z+ GetIntegerv 0 Buffer object bound to the 2.9 1485bd8deadSopenharmony_ci copy buffer "write" 1495bd8deadSopenharmony_ci binding point 1505bd8deadSopenharmony_ci 1515bd8deadSopenharmony_ciIssues 1525bd8deadSopenharmony_ci 1535bd8deadSopenharmony_ci 1) How is this extension useful? 1545bd8deadSopenharmony_ci 1555bd8deadSopenharmony_ci This can be a desirable replacement to BufferSubData if there are 1565bd8deadSopenharmony_ci large updates that will pollute the CPU cache. If generating the data 1575bd8deadSopenharmony_ci can be offloaded to another thread, then the CPU cost of the update 1585bd8deadSopenharmony_ci in the rendering thread can be very small. 1595bd8deadSopenharmony_ci 1605bd8deadSopenharmony_ci Finally, if an implementation supports concurrent data transfers in 1615bd8deadSopenharmony_ci one context/thread while doing rendering in another context/thread, 1625bd8deadSopenharmony_ci this extension may be used to move data from system memory to video 1635bd8deadSopenharmony_ci memory in preparation for copying it into another buffer in the 1645bd8deadSopenharmony_ci rendering thread. 1655bd8deadSopenharmony_ci 1665bd8deadSopenharmony_ci 1675bd8deadSopenharmony_ciDependencies on OES_mapbuffer 1685bd8deadSopenharmony_ci 1695bd8deadSopenharmony_ci If OES_mapbuffer is not present, references to MapBufferOES and 1705bd8deadSopenharmony_ci UnmapBufferOES should be ignored and language referring to mapped 1715bd8deadSopenharmony_ci buffer objects should be removed. 1725bd8deadSopenharmony_ci 1735bd8deadSopenharmony_ciRevision History 1745bd8deadSopenharmony_ci 1755bd8deadSopenharmony_ci Revision 3, 2013/08/20 1765bd8deadSopenharmony_ci - minor edits for publishing 1775bd8deadSopenharmony_ci Revision 2, 2012/04/19 1785bd8deadSopenharmony_ci - Added explicit interaction with BufferData, BufferSubData, MapBufferOES, 1795bd8deadSopenharmony_ci UnmapBufferOES, GetBufferPointervOES and GetBufferParameteriv 1805bd8deadSopenharmony_ci Revision 1, 2012/04/18 1815bd8deadSopenharmony_ci - Initial draft by starting with a copy of ARB_copy_buffer and stripping 1825bd8deadSopenharmony_ci it to ES 1835bd8deadSopenharmony_ci 184