15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci ARB_clear_buffer_object 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_ARB_clear_buffer_object 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Graham Sellers (graham.sellers 'at' amd.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciContributors 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Jon Leech 165bd8deadSopenharmony_ci Piers Daniell, NVIDIA 175bd8deadSopenharmony_ci Mark Kilgard, NVIDIA 185bd8deadSopenharmony_ci 195bd8deadSopenharmony_ciNotice 205bd8deadSopenharmony_ci 215bd8deadSopenharmony_ci Copyright (c) 2012-2014 The Khronos Group Inc. Copyright terms at 225bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 235bd8deadSopenharmony_ci 245bd8deadSopenharmony_ciSpecification Update Policy 255bd8deadSopenharmony_ci 265bd8deadSopenharmony_ci Khronos-approved extension specifications are updated in response to 275bd8deadSopenharmony_ci issues and bugs prioritized by the Khronos OpenGL Working Group. For 285bd8deadSopenharmony_ci extensions which have been promoted to a core Specification, fixes will 295bd8deadSopenharmony_ci first appear in the latest version of that core Specification, and will 305bd8deadSopenharmony_ci eventually be backported to the extension document. This policy is 315bd8deadSopenharmony_ci described in more detail at 325bd8deadSopenharmony_ci https://www.khronos.org/registry/OpenGL/docs/update_policy.php 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ciStatus 355bd8deadSopenharmony_ci 365bd8deadSopenharmony_ci Complete. 375bd8deadSopenharmony_ci Approved by the ARB on 2012/06/12. 385bd8deadSopenharmony_ci 395bd8deadSopenharmony_ciVersion 405bd8deadSopenharmony_ci 415bd8deadSopenharmony_ci Last Modified Date: February 18, 2014 425bd8deadSopenharmony_ci Version: 13 435bd8deadSopenharmony_ci 445bd8deadSopenharmony_ciNumber 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ci ARB Extension #121 475bd8deadSopenharmony_ci 485bd8deadSopenharmony_ciDependencies 495bd8deadSopenharmony_ci 505bd8deadSopenharmony_ci OpenGL 1.5 is required. 515bd8deadSopenharmony_ci 525bd8deadSopenharmony_ci The definition of this extension is dependent on EXT_direct_state_access. 535bd8deadSopenharmony_ci 545bd8deadSopenharmony_ci This extension is written against the OpenGL 4.2 (Core) Specification. 555bd8deadSopenharmony_ci 565bd8deadSopenharmony_ciOverview 575bd8deadSopenharmony_ci 585bd8deadSopenharmony_ci Buffer objects are fundamental to the operation of OpenGL. Buffers are used 595bd8deadSopenharmony_ci as a source of data for vertices and indices, read through buffer textures 605bd8deadSopenharmony_ci in shaders, used to transfer texture and image data into and out of 615bd8deadSopenharmony_ci textures and framebuffers, and may be written to by operations such as 625bd8deadSopenharmony_ci transform feedback. OpenGL contains mechanisms to copy sections of buffers 635bd8deadSopenharmony_ci from one to another, but it has no mechanism to initialize the content 645bd8deadSopenharmony_ci of a buffer to a known value. In effect, it has memcpy, but not memset. 655bd8deadSopenharmony_ci 665bd8deadSopenharmony_ci This extension adds such a mechanism and has several use cases. Examples 675bd8deadSopenharmony_ci include clearing a pixel unpack buffer before transferring data to 685bd8deadSopenharmony_ci a texture or resetting buffer data to a known value before sparse updates 695bd8deadSopenharmony_ci through shader image stores or transform feedback. 705bd8deadSopenharmony_ci 715bd8deadSopenharmony_ciIP Status 725bd8deadSopenharmony_ci 735bd8deadSopenharmony_ci No known IP claims. 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ciNew Procedures and Functions 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ci void ClearBufferData(enum target, 785bd8deadSopenharmony_ci enum internalformat, 795bd8deadSopenharmony_ci enum format, 805bd8deadSopenharmony_ci enum type, 815bd8deadSopenharmony_ci const void * data); 825bd8deadSopenharmony_ci 835bd8deadSopenharmony_ci void ClearBufferSubData(enum target, 845bd8deadSopenharmony_ci enum internalformat, 855bd8deadSopenharmony_ci intptr offset, 865bd8deadSopenharmony_ci sizeiptr size, 875bd8deadSopenharmony_ci enum format, 885bd8deadSopenharmony_ci enum type, 895bd8deadSopenharmony_ci const void * data); 905bd8deadSopenharmony_ci 915bd8deadSopenharmony_ci When EXT_direct_state_access is present: 925bd8deadSopenharmony_ci 935bd8deadSopenharmony_ci void ClearNamedBufferDataEXT(uint buffer, 945bd8deadSopenharmony_ci enum internalformat, 955bd8deadSopenharmony_ci enum format, 965bd8deadSopenharmony_ci enum type, 975bd8deadSopenharmony_ci const void * data); 985bd8deadSopenharmony_ci 995bd8deadSopenharmony_ci void ClearNamedBufferSubDataEXT(uint buffer, 1005bd8deadSopenharmony_ci enum internalformat, 1015bd8deadSopenharmony_ci intptr offset, 1025bd8deadSopenharmony_ci sizeiptr size, 1035bd8deadSopenharmony_ci enum format, 1045bd8deadSopenharmony_ci enum type, 1055bd8deadSopenharmony_ci const void * data); 1065bd8deadSopenharmony_ci 1075bd8deadSopenharmony_ciNew Tokens 1085bd8deadSopenharmony_ci 1095bd8deadSopenharmony_ci None. 1105bd8deadSopenharmony_ci 1115bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 4.2 (Core Profile) Specification 1125bd8deadSopenharmony_ci(OpenGL Operation) 1135bd8deadSopenharmony_ci 1145bd8deadSopenharmony_ciAppend to the end of Section 2.9.2, "Creating Buffer Object Stores" 1155bd8deadSopenharmony_ci 1165bd8deadSopenharmony_ci To fill all or part of an existing buffer object's data store with a 1175bd8deadSopenharmony_ci constant value, call 1185bd8deadSopenharmony_ci 1195bd8deadSopenharmony_ci void ClearBufferSubData(enum target, 1205bd8deadSopenharmony_ci enum internalformat, 1215bd8deadSopenharmony_ci sizeiptr offset, 1225bd8deadSopenharmony_ci sizeiptr size, 1235bd8deadSopenharmony_ci enum format, 1245bd8deadSopenharmony_ci enum type, 1255bd8deadSopenharmony_ci const void * data); 1265bd8deadSopenharmony_ci 1275bd8deadSopenharmony_ci with <target> set to the target to which the destination buffer is bound. 1285bd8deadSopenharmony_ci <target> must be one of the targets listed in Table 2.8. 1295bd8deadSopenharmony_ci <internalformat> must be set to one of the format tokens listed in Table 1305bd8deadSopenharmony_ci 3.15, "Internal formats for buffer textures". <format> and <type> specify 1315bd8deadSopenharmony_ci the format and type of the source data and are interpreted as described in 1325bd8deadSopenharmony_ci Section 3.7.2. <offset> set to the offset, measured in basic 1335bd8deadSopenharmony_ci machine units, into the buffer object's data store from which to begin 1345bd8deadSopenharmony_ci filling, and <size> set to the size, also in basic machine units, of the 1355bd8deadSopenharmony_ci range to fill. Both <offset> and <range> must be multiples of the number 1365bd8deadSopenharmony_ci of basic machine units per-element for that internal format specified by 1375bd8deadSopenharmony_ci <internalformat>, otherwise the error INVALID_VALUE is generated. 1385bd8deadSopenharmony_ci <data> is a pointer to an array of between one and four components 1395bd8deadSopenharmony_ci containing the data to be used as the source of the constant fill value. 1405bd8deadSopenharmony_ci The elements of <data> are converted by the GL into the format specified by 1415bd8deadSopenharmony_ci <internalformat> in the manner described in section 2.3.1, and then used to 1425bd8deadSopenharmony_ci fill the specified range of the destination buffer. If <data> is NULL, then 1435bd8deadSopenharmony_ci the pointer is ignored and the sub-range of the buffer is filled with zeros. 1445bd8deadSopenharmony_ci 1455bd8deadSopenharmony_ci If <offset> or <size> is less than zero, or if <offset> + <size> is 1465bd8deadSopenharmony_ci greater than the value of BUFFER_SIZE for the buffer bound to <target> 1475bd8deadSopenharmony_ci then the error INVALID_VALUE is generated. The command 1485bd8deadSopenharmony_ci 1495bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if any part of the specified 1505bd8deadSopenharmony_ci range of the buffer bound to <target> is currently mapped. 1515bd8deadSopenharmony_ci 1525bd8deadSopenharmony_ci void ClearBufferData(enum target, 1535bd8deadSopenharmony_ci enum internalformat, 1545bd8deadSopenharmony_ci enum format, 1555bd8deadSopenharmony_ci enum type, 1565bd8deadSopenharmony_ci const void * data); 1575bd8deadSopenharmony_ci 1585bd8deadSopenharmony_ci is equivalent to calling ClearBufferSubData with <target>, 1595bd8deadSopenharmony_ci <internalformat> and <data> as specified, with <offset> set to zero, 1605bd8deadSopenharmony_ci and <size> set to the value of BUFFER_SIZE for the buffer bound to 1615bd8deadSopenharmony_ci <target>. 1625bd8deadSopenharmony_ci 1635bd8deadSopenharmony_ci The commands: 1645bd8deadSopenharmony_ci 1655bd8deadSopenharmony_ci void ClearNamedBufferDataEXT(uint buffer, 1665bd8deadSopenharmony_ci enum internalformat, 1675bd8deadSopenharmony_ci enum format, 1685bd8deadSopenharmony_ci enum type, 1695bd8deadSopenharmony_ci const void * data); 1705bd8deadSopenharmony_ci 1715bd8deadSopenharmony_ci and 1725bd8deadSopenharmony_ci 1735bd8deadSopenharmony_ci void ClearNamedBufferSubDataEXT(uint buffer, 1745bd8deadSopenharmony_ci enum internalformat, 1755bd8deadSopenharmony_ci sizeiptr offset, 1765bd8deadSopenharmony_ci sizeiptr size, 1775bd8deadSopenharmony_ci enum format, 1785bd8deadSopenharmony_ci enum type, 1795bd8deadSopenharmony_ci const void * data); 1805bd8deadSopenharmony_ci 1815bd8deadSopenharmony_ci are equivalent to calling ClearBufferData and ClearBufferSubData, 1825bd8deadSopenharmony_ci respectively, except that the buffer object to be accessed is specified 1835bd8deadSopenharmony_ci in the <buffer> parameter rather than being derived from the <target> 1845bd8deadSopenharmony_ci buffer binding point. 1855bd8deadSopenharmony_ci 1865bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 4.2 (Core Profile) Specification 1875bd8deadSopenharmony_ci(Rasterization) 1885bd8deadSopenharmony_ci 1895bd8deadSopenharmony_ci None. 1905bd8deadSopenharmony_ci 1915bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 4.2 (Core Profile) Specification 1925bd8deadSopenharmony_ci(Per-Fragment Operations and the Frame Buffer) 1935bd8deadSopenharmony_ci 1945bd8deadSopenharmony_ci None. 1955bd8deadSopenharmony_ci 1965bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 4.2 (Core Profile) Specification 1975bd8deadSopenharmony_ci(Special Functions) 1985bd8deadSopenharmony_ci 1995bd8deadSopenharmony_ci None. 2005bd8deadSopenharmony_ci 2015bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 4.2 (Core Profile) Specification 2025bd8deadSopenharmony_ci(State and State Requests) 2035bd8deadSopenharmony_ci 2045bd8deadSopenharmony_ci None. 2055bd8deadSopenharmony_ci 2065bd8deadSopenharmony_ciErrors 2075bd8deadSopenharmony_ci 2085bd8deadSopenharmony_ci INVALID_ENUM is generated by ClearBufferSubData if <internalformat> 2095bd8deadSopenharmony_ci is not one of the sized internal format identifiers listed in Table 3.15. 2105bd8deadSopenharmony_ci 2115bd8deadSopenharmony_ci INVAILD_ENUM is generated by ClearBufferSubData <target> is not a legal 2125bd8deadSopenharmony_ci buffer binding point. 2135bd8deadSopenharmony_ci 2145bd8deadSopenharmony_ci INVALID_ENUM is generated by ClearBufferSubData if <format> or <type> is 2155bd8deadSopenharmony_ci not one of the supported format or type tokens. 2165bd8deadSopenharmony_ci 2175bd8deadSopenharmony_ci INVALID_VALUE is generated by ClearBufferSubData if <offset> 2185bd8deadSopenharmony_ci or <size> is less than zero. 2195bd8deadSopenharmony_ci 2205bd8deadSopenharmony_ci INVALID_VALUE is generated by ClearBufferSubData if no buffer is bound 2215bd8deadSopenharmony_ci to the binding point indicated by <target>. 2225bd8deadSopenharmony_ci 2235bd8deadSopenharmony_ci INVALID_VALUE is generated by ClearBufferSubData if <offset> + 2245bd8deadSopenharmony_ci <size> is greater than the value of BUFFER_SIZE for the buffer bound to 2255bd8deadSopenharmony_ci <target>. 2265bd8deadSopenharmony_ci 2275bd8deadSopenharmony_ci INVALID_VALUE is generated by ClearBufferSubData if <offset> or <size> 2285bd8deadSopenharmony_ci is not an integer multiple of the element size indicated by 2295bd8deadSopenharmony_ci <internalformat>. The element size is the number of components for 2305bd8deadSopenharmony_ci <internalformat> from table 3.15 multiplied by the size of the base type 2315bd8deadSopenharmony_ci for <internalformat> in that table. 2325bd8deadSopenharmony_ci 2335bd8deadSopenharmony_ci INVALID_OPERATION is generated by ClearBufferSubData if any part of the 2345bd8deadSopenharmony_ci specified range of the buffer bound to <target> is currently mapped. 2355bd8deadSopenharmony_ci 2365bd8deadSopenharmony_ciNew State 2375bd8deadSopenharmony_ci 2385bd8deadSopenharmony_ci None. 2395bd8deadSopenharmony_ci 2405bd8deadSopenharmony_ciDependencies on EXT_direct_state_access 2415bd8deadSopenharmony_ci 2425bd8deadSopenharmony_ci If EXT_direct_state_access is not supported, then remove all references to 2435bd8deadSopenharmony_ci ClearNamedBufferDataEXT and ClearNamedBufferSubDataEXT. 2445bd8deadSopenharmony_ci 2455bd8deadSopenharmony_ciConformance Tests 2465bd8deadSopenharmony_ci 2475bd8deadSopenharmony_ci TBD 2485bd8deadSopenharmony_ci 2495bd8deadSopenharmony_ciIssues 2505bd8deadSopenharmony_ci 2515bd8deadSopenharmony_ci 1) Do we need to have restrictions on the alignment of <offset> and/or 2525bd8deadSopenharmony_ci <size> for ClearBufferSubData 2535bd8deadSopenharmony_ci 2545bd8deadSopenharmony_ci RESOLVED: Yes, we restrict both <offset> and <size> to be integer 2555bd8deadSopenharmony_ci multiples of the element size for the format indicated by 2565bd8deadSopenharmony_ci <internalformat>. 2575bd8deadSopenharmony_ci 2585bd8deadSopenharmony_ci 2) Should the ClearBufferObject take int/float/uint types, or take 2595bd8deadSopenharmony_ci format + type poarameters more like glTexImage2D etc.? 2605bd8deadSopenharmony_ci 2615bd8deadSopenharmony_ci RESOLVED: ClearBufferSubData takes an <internalformat> parameter 2625bd8deadSopenharmony_ci to indicate the internal storage format for the buffer, and 2635bd8deadSopenharmony_ci a <format> and <type> parameter for the application-supplied data. 2645bd8deadSopenharmony_ci This is consistent with APIs such as TexSubImagenD. 2655bd8deadSopenharmony_ci 2665bd8deadSopenharmony_ci 3) Currently, the legal tokens for <internalformat> are taken from the 2675bd8deadSopenharmony_ci texture internal format types in table 3.12. Is this sufficient? 2685bd8deadSopenharmony_ci Do we need to also allow other formats such as those in table 3.22 2695bd8deadSopenharmony_ci (image formats), or table 3.2 (packed pixel formats). 2705bd8deadSopenharmony_ci 2715bd8deadSopenharmony_ci RESOLVED: Updated in revision 4 to use table 3.15, which is actually 2725bd8deadSopenharmony_ci more concise than 3.12. However, it represents the complete list 2735bd8deadSopenharmony_ci of formats that are reasonably easily filled by existing hardware. 2745bd8deadSopenharmony_ci If the application bit-packs other formats, this should be sufficient 2755bd8deadSopenharmony_ci for the intended use-cases of this extension. 2765bd8deadSopenharmony_ci 2775bd8deadSopenharmony_ci 4) Do we want DSA-style ClearNamedBufferSubData, ClearNamedBufferData? 2785bd8deadSopenharmony_ci 2795bd8deadSopenharmony_ci RESOLVED: Yes. Documented dependency on EXT_dsa. 2805bd8deadSopenharmony_ci 2815bd8deadSopenharmony_ci 5) How do we specify data formats that are not supported for buffer 2825bd8deadSopenharmony_ci textures - for example, R3_G3_B2 or RGB10_A2? 2835bd8deadSopenharmony_ci 2845bd8deadSopenharmony_ci RESOLVED: It is the application's responsibility to bit-pack the 2855bd8deadSopenharmony_ci components of the source data into a number of native types (unsigned 2865bd8deadSopenharmony_ci bytes, shorts or ints), and then pass them using a supported internal 2875bd8deadSopenharmony_ci format. 2885bd8deadSopenharmony_ci 2895bd8deadSopenharmony_ciRevision History 2905bd8deadSopenharmony_ci 2915bd8deadSopenharmony_ci Rev. Date Author Changes 2925bd8deadSopenharmony_ci ---- ---------- -------- --------------------------------------------- 2935bd8deadSopenharmony_ci 13 02/18/2014 Jon Leech Change order of ClearBufferSubData arguments 2945bd8deadSopenharmony_ci in spec body to be consistent with New 2955bd8deadSopenharmony_ci Procedures declaration ((offset,size,format, 2965bd8deadSopenharmony_ci type) instead of the erroneous (format,type, 2975bd8deadSopenharmony_ci offset,size)) (Public Bug 1122). 2985bd8deadSopenharmony_ci 2995bd8deadSopenharmony_ci 12 12/12/2013 Jon Leech Change order of ClearNamedBufferSubDataEXT 3005bd8deadSopenharmony_ci arguments in spec body to be consistent with 3015bd8deadSopenharmony_ci New Procedures declaration ((offset, 3025bd8deadSopenharmony_ci size,format,type) instead of the erroneous 3035bd8deadSopenharmony_ci (format,type,offset,size)) (Bug 11378). 3045bd8deadSopenharmony_ci 3055bd8deadSopenharmony_ci 11 08/07/2013 mjk Better indicate DSA entrypoints 3065bd8deadSopenharmony_ci 3075bd8deadSopenharmony_ci 10 09/12/2012 Jon Leech Modify error condition when the target buffer 3085bd8deadSopenharmony_ci is mapped to only be generated when the 3095bd8deadSopenharmony_ci mapped region intersects the region being 3105bd8deadSopenharmony_ci cleared (bug 9343). 3115bd8deadSopenharmony_ci 3125bd8deadSopenharmony_ci 9 07/25/2012 Jon Leech Fix typos from bug 8935. 3135bd8deadSopenharmony_ci 3145bd8deadSopenharmony_ci 8 07/23/2012 Jon Leech Clarify offset/alignment constraints as 3155bd8deadSopenharmony_ci based on the total size of a texel in 3165bd8deadSopenharmony_ci <internalformat>. 3175bd8deadSopenharmony_ci 3185bd8deadSopenharmony_ci 7 06/28/2012 pdaniell Modify the parameter order of the *SubData 3195bd8deadSopenharmony_ci functions to match the ordering of 3205bd8deadSopenharmony_ci TexSubImage parameters. Also change the 3215bd8deadSopenharmony_ci <offset> parameter to intptr. 3225bd8deadSopenharmony_ci 3235bd8deadSopenharmony_ci 6 05/29/2012 Jon Leech Fix capitalization of <internalformat>. 3245bd8deadSopenharmony_ci 3255bd8deadSopenharmony_ci 5 05/15/2012 Jon Leech Fix typo in error condition. 3265bd8deadSopenharmony_ci 3275bd8deadSopenharmony_ci 4 04/26/2012 gsellers Add interaction with EXT_dsa, resolve issue 4. 3285bd8deadSopenharmony_ci Document <format> and <type> parameters. 3295bd8deadSopenharmony_ci Correct reference to Table 3.15 (Internal 3305bd8deadSopenharmony_ci formats for buffer textures). 3315bd8deadSopenharmony_ci Resolve issue 3. Add issue 5. 3325bd8deadSopenharmony_ci Change behavior of NULL for <data> to fill the 3335bd8deadSopenharmony_ci buffer subrange with zeros. 3345bd8deadSopenharmony_ci 3 04/02/2012 gsellers Delete 'either/or' approach. 3355bd8deadSopenharmony_ci Change API to texture-like ClearBufferSubData. 3365bd8deadSopenharmony_ci Resolve issues (1) + (2). 3375bd8deadSopenharmony_ci Address feedback from bug 8132. 3385bd8deadSopenharmony_ci Add issues (3) and (4). 3395bd8deadSopenharmony_ci 2 12/19/2011 gsellers Rename to ARB. Strip suffixes from APIs. 3405bd8deadSopenharmony_ci Add format + type versions of APIs for 3415bd8deadSopenharmony_ci consideration. Allow NULL for <data> in 3425bd8deadSopenharmony_ci ClearBufferRange. 3435bd8deadSopenharmony_ci 1 09/27/2011 gsellers Initial draft 344