1Name 2 3 ARB_texture_buffer_range 4 5Name Strings 6 7 GL_ARB_texture_buffer_range 8 9Contact 10 11 Graham Sellers (graham.sellers 'at' amd.com) 12 13Contributors 14 15 Jon Leech 16 Mark Kilgard, NVIDIA 17 18Notice 19 20 Copyright (c) 2012-2013 The Khronos Group Inc. Copyright terms at 21 http://www.khronos.org/registry/speccopyright.html 22 23Specification Update Policy 24 25 Khronos-approved extension specifications are updated in response to 26 issues and bugs prioritized by the Khronos OpenGL Working Group. For 27 extensions which have been promoted to a core Specification, fixes will 28 first appear in the latest version of that core Specification, and will 29 eventually be backported to the extension document. This policy is 30 described in more detail at 31 https://www.khronos.org/registry/OpenGL/docs/update_policy.php 32 33Status 34 35 Complete. 36 Approved by the ARB on 2012/06/12. 37 38Version 39 40 Last Modified Date: August 7, 2013 41 Version: 8 42 43Number 44 45 ARB Extension #139 46 47Dependencies 48 49 ARB_texture_buffer_object or OpenGL 3.1 is required. 50 51 The definition of this extension is dependent on EXT_direct_state_access. 52 53 This extension is written against the OpenGL 4.2 (Core) Specification. 54 55Overview 56 57 ARB_texture_buffer_object (which was promoted to core in OpenGL 3.1) 58 introduced the ability to attach the data store of a buffer object 59 to a buffer texture and access it from shaders. The extension only allows 60 the entire store of the buffer object to the texture. This extension 61 expands on this and allows a sub-range of the buffer's data store to 62 be attached to a texture. This can be used, for example, to allow multiple 63 buffer textures to be backed by independent sub-ranges of the same buffer 64 object, or for different sub-ranges of a single buffer object to be used 65 for different purposes. 66 67IP Status 68 69 No known IP claims. 70 71New Procedures and Functions 72 73 void TexBufferRange(enum target, 74 enum internalformat, 75 uint buffer, 76 intptr offset, 77 sizeiptr size); 78 79 When EXT_direct_state_access is present: 80 81 void TextureBufferRangeEXT(uint texture, 82 enum target, 83 enum internalformat, 84 uint buffer, 85 intptr offset, 86 sizeiptr size); 87 88New Tokens 89 90 Accepted by the <pname> parameter of GetTexLevelParameter: 91 92 TEXTURE_BUFFER_OFFSET 0x919D 93 TEXTURE_BUFFER_SIZE 0x919E 94 95 Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, 96 and GetDoublev: 97 98 TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F 99 100Additions to Chapter 2 of the OpenGL 4.2 (Core Profile) Specification 101(OpenGL Operation) 102 103 None. 104 105Additions to Chapter 3 of the OpenGL 4.2 (Core Profile) Specification 106(Rasterization) 107 108Modifications to Section 3.8.7 "Buffer Textures" 109 110 Change the description of TexBuffer as follows: 111 112 The command 113 114 void TexBufferRange(enum target, 115 enum internalformat, 116 uint buffer, 117 intptr offset, 118 sizeiptr size); 119 120 attaches the range of the storage for the buffer object named <buffer> 121 for <size> basic machine units, starting at <offset> (also in basic machine 122 units) to the active buffer texture, and specifies an internal format 123 for the texel array found in the range of the attached buffer object. If 124 <buffer> is zero, then any buffer object attached to the buffer texture 125 is detached, the values <offset> and <size> are ignored and the state for 126 <offset> and <size> for the buffer texture are reset to zero. If <buffer> 127 is non-zero, but is not the name of a buffer object, the error 128 INVALID_OPERATION is generated. If <offset> is negative or if <size> is 129 less than or equal to zero or if <offset> + <size> is greater than the 130 value of BUFFER_SIZE for the buffer bound to <target>, of if <offset> is 131 not an integer multiple of TEXTURE_BUFFER_OFFSET_ALIGNMENT, then the error 132 INVALID_VALUE is generated. <internalformat> specifies the storage format 133 and must be one of the sized internal formats found in Table 3.15. 134 135 The command 136 137 void TextureBufferRangeEXT(uint texture, 138 enum target, 139 enum internalformat, 140 uint buffer, 141 intptr offset, 142 sizeiptr size); 143 144 behaves identically to TexBufferRange, except rather than updating the 145 currently bound texture object for the texture unit indicated by the current 146 active texture state, the texture object named <texture> is updated 147 directly. <texture> must be a name returned from a previous call to 148 GenTextures or be that of an existing texture matching <target>. If <texture> 149 is not the name of an existing texture, one is created with the name 150 <texture> for <target>. 151 152 The command 153 154 void TexBuffer(enum target, 155 enum internalformat, 156 uint buffer); 157 158 is equivalent to calling TexBufferRange with the <target>, <internalformat> 159 and <buffer> parameters as specified, with <offset> set to zero, and 160 <size> set to the value of BUFFER_SIZE for <buffer>. 161 162 When a range of the storage of a buffer object is attached to a buffer 163 texture, the range of the buffer's data store is taken as the texture's 164 texel array. The number of texels in the buffer texture's texel array is 165 given by 166 167 | <size> | 168 | ------------------------------------ | 169 |_ <components> x sizeof(<base_type>) _| 170 171 where <components> and <base_type> are the element count and base type for 172 elements, as specified in Table 3.15. 173 174Modifications to Section 3.9.15 "Texture and Proxy State" 175 176 Add to the state required for buffer textures: 177 178 ... The buffer texture target has associated an integer containing the name 179 of the buffer object that provided the data store for the texture, 180 initially zero, and two pointer sized integers containing the offset and 181 range of the buffer object's data store, also initially zero. 182 183Additions to Chapter 4 of the OpenGL 4.2 (Core Profile) Specification 184(Per-Fragment Operations and the Frame Buffer) 185 186 None. 187 188Additions to Chapter 5 of the OpenGL 4.2 (Core Profile) Specification 189(Special Functions) 190 191 None. 192 193Additions to Chapter 6 of the OpenGL 4.2 (Core Profile) Specification 194(State and State Requests) 195 196 None. 197 198Errors 199 200 INVALID_ENUM is generated by TexBufferRange if <target> is not 201 TEXTURE_BUFFER. 202 203 INVALID_VALUE is generated by TexBufferRange if <offset> is less than zero. 204 205 INVALID_VALUE is generated by TexBufferRange if <size> is less than zero. 206 207 INVALID_VALUE is generated by TexBufferRange if <offset> + <size> is 208 greater than the value of BUFFER_SIZE for <buffer>. 209 210 INVALID_VALUE is generated by TexBufferRange if <offset> is not 211 an integer multiple of the value of TEXTURE_BUFFER_OFFSET_ALIGNMENT. 212 213New State 214 215 Append to Table 6.17. Textures (state per texture image) 216 217 +-------------------------+---------+----------------------+---------------+------------------------------------------+ 218 | Get Value | Type | Get Command | Initial Value | Description | 219 +-------------------------+---------+----------------------+---------------+------------------------------------------+ 220 | TEXTURE_BUFFER_OFFSET | n x Z | GetTexLevelParameter | 0 | Offset into buffer's data store used for | 221 | | | | | the active image unit's buffer texture | 222 | TEXTURE_BUFFER_SIZE | n x Z | GetTexLevelParameter | 0 | Size of the buffer's data store used for | 223 | | | | | the active image unit's buffer texture | 224 +-------------------------+---------+----------------------+---------------+------------------------------------------+ 225 226New Implementation Dependent State 227 228 +---------------------------------+------+-------------+------------+----------------------------+---------+-----------+ 229 | | | | Minimum | | | | 230 | Get Value | Type | Get Command | Value | Description | Sec | Attribute | 231 +---------------------------------+------+-------------+------------+----------------------------+---------+-----------+ 232 | TEXTURE_BUFFER_OFFSET_ALIGNMENT | Z+ | GetIntegerv | 1 | Minimum required alignment | 3.8.7 | - | 233 | | | | | for texture buffer offsets | | | 234 +---------------------------------+------+-------------+------------+----------------------------+---------+-----------+ 235 236Conformance Tests 237 238 TBD 239 240Issues 241 242 1) Do we need to have restrictions on the alignment of <offset> and/or 243 <size> for TexBufferRange? 244 245 RESOLVED: Yes for offset, no for range. The minimum value here is 1, 246 essentially making it optional for offsets. 247 248Dependencies on EXT_direct_state_access 249 250 If EXT_direct_state_access is not supported, remove all references to 251 TextureBufferRangeEXT. 252 253Revision History 254 255 Rev. Date Author Changes 256 ---- ---------- -------- ----------------------------------------- 257 8 08/07/2013 mjk Better indicate DSA entrypoints 258 7 05/29/2012 Jon Leech Fix capitalization of <internalformat>. 259 6 05/02/2012 drakos Add EXT suffix to TextureBufferRange. 260 5 04/30/2012 gsellers Assign token values. 261 Add more error behavior. 262 Minor fixes. 263 4 04/26/2012 gsellers Clarify that <offset> and <size> are reset for 264 TexBOs when a buffer is unbound. 265 3 04/02/2012 gsellers Update token names. Correct typos. (bug 8131). 266 Add TEXTURE_BUFFER_OFFSET_ALIGNMENT. 267 Resolve issue (1). 268 2 12/19/2011 gsellers Document interaction with EXT_dsa. Rename to 269 ARB. Remove ARB suffixes from APIs and tokens. 270 1 09/26/2011 gsellers Initial draft 271