1Name 2 3 ARB_texture_float 4 5Name Strings 6 7 GL_ARB_texture_float 8 9Contributors 10 11 Pat Brown 12 Jon Leech 13 Rob Mace 14 Brian Paul 15 16Contact 17 18 Dale Kirkland, NVIDIA (dkirkland 'at' nvidia.com) 19 20Notice 21 22 Copyright (c) 2004-2013 The Khronos Group Inc. Copyright terms at 23 http://www.khronos.org/registry/speccopyright.html 24 25Specification Update Policy 26 27 Khronos-approved extension specifications are updated in response to 28 issues and bugs prioritized by the Khronos OpenGL Working Group. For 29 extensions which have been promoted to a core Specification, fixes will 30 first appear in the latest version of that core Specification, and will 31 eventually be backported to the extension document. This policy is 32 described in more detail at 33 https://www.khronos.org/registry/OpenGL/docs/update_policy.php 34 35Status 36 37 Complete. Approved by the ARB on October 22, 2004. 38 39Version 40 41 Based on the ATI_texture_float extension, verion 4 42 43 Last Modified Date: February 19, 2008 44 Version: 7 45 46Number 47 48 ARB Extension #41 49 50Dependencies 51 52 This extension is written against the OpenGL 2.0 Specification 53 but will work with the OpenGL 1.5 Specification. 54 55 OpenGL 1.1 or EXT_texture is required. 56 57 This extension interacts with ARB_color_buffer_float. 58 59Overview 60 61 This extension adds texture internal formats with 16- and 32-bit 62 floating-point components. The 32-bit floating-point components 63 are in the standard IEEE float format. The 16-bit floating-point 64 components have 1 sign bit, 5 exponent bits, and 10 mantissa bits. 65 Floating-point components are clamped to the limits of the range 66 representable by their format. 67 68 69IP Status 70 71 SGI owns US Patent #6,650,327, issued November 18, 2003. SGI 72 believes this patent contains necessary IP for graphics systems 73 implementing floating point (FP) rasterization and FP framebuffer 74 capabilities. 75 76 SGI will not grant the ARB royalty-free use of this IP for use in 77 OpenGL, but will discuss licensing on RAND terms, on an individual 78 basis with companies wishing to use this IP in the context of 79 conformant OpenGL implementations. SGI does not plan to make any 80 special exemption for open source implementations. 81 82 Contact Doug Crisman at SGI Legal for the complete IP disclosure. 83 84Issues 85 86 1. How is this extension different from the ATI_texture_float 87 extension? 88 89 This extension expands on the definition of float16 values 90 and adds a query to determine if the components of a texture 91 are stored as floats. 92 93 2. Should the new names of the internal formats be changed to a 94 different spelling? 95 96 RESOLVED: Internal format names have been updated to the 97 same convention as the EXT_framebuffer_object extension. 98 99 3. Is it allowable for an implementation to fall back to a non 100 floating-point internal format if it does not support the 101 requested format? 102 103 RESOLVED: No. An application that requests floating-point 104 formats should expect to get them. Only the precision of the 105 internal format can be changed. When this extension is 106 promoted to the core, this issue may need to be readdressed. 107 108 4. Do the new internal formats apply to any other commands? 109 110 RESOLVED: Since color tables support the same <internalFormat> 111 values as textures, they are also extended with this extension, 112 except the individual component types cannot be queried. 113 114 5. Are the floating-point values clamped before they are stored 115 into the texture memory or color tables? 116 117 RESOLVED: The values are clamped to the representatable 118 range of the storage format. Overflows could produce 119 +/-INF and underflows could produce denorms or zero. This 120 matches the behavior of the ATI extension. 121 122 6. Should this extension modify the clamping of the texture border 123 color components? 124 125 RESOLVED: Yes. The border color components are unclamped. 126 When used, the border color components are interpreted in a 127 manner consistent with the texture's internal format. For 128 fixed-point textures, this means that the border color is 129 clamped to [0, 1] when used. 130 131 7. Are floating-point values clamped for the fixed-function GL? 132 133 RESOLVED: This extension introduces texel values that can be 134 outside [0, 1]. No clamping occurs to these values during 135 texture filtering. For the fixed-function pipeline, the 136 filtered texel is now clamped before it is used for texture 137 environment blending. The ARB_color_buffer_float extension 138 can be used to control this clamping. For the programmable 139 pipelines, no clamping occurs. 140 141 8. Should the query for the border color return the unclamped 142 values? 143 144 RESOLVED: There is language in the ARB_color_buffer_float 145 extension that handles this. Since there is no clamp control 146 in this specification, it would be hard to do anything other 147 than return the clamped values. 148 149New Procedures and Functions 150 151 None 152 153New Tokens 154 155 Accepted by the <value> parameter of GetTexLevelParameter: 156 157 TEXTURE_RED_TYPE_ARB 0x8C10 158 TEXTURE_GREEN_TYPE_ARB 0x8C11 159 TEXTURE_BLUE_TYPE_ARB 0x8C12 160 TEXTURE_ALPHA_TYPE_ARB 0x8C13 161 TEXTURE_LUMINANCE_TYPE_ARB 0x8C14 162 TEXTURE_INTENSITY_TYPE_ARB 0x8C15 163 TEXTURE_DEPTH_TYPE_ARB 0x8C16 164 165 Returned by the <params> parameter of GetTexLevelParameter: 166 167 UNSIGNED_NORMALIZED_ARB 0x8C17 168 169 Accepted by the <internalFormat> parameter of TexImage1D, 170 TexImage2D, and TexImage3D: 171 172 RGBA32F_ARB 0x8814 173 RGB32F_ARB 0x8815 174 ALPHA32F_ARB 0x8816 175 INTENSITY32F_ARB 0x8817 176 LUMINANCE32F_ARB 0x8818 177 LUMINANCE_ALPHA32F_ARB 0x8819 178 RGBA16F_ARB 0x881A 179 RGB16F_ARB 0x881B 180 ALPHA16F_ARB 0x881C 181 INTENSITY16F_ARB 0x881D 182 LUMINANCE16F_ARB 0x881E 183 LUMINANCE_ALPHA16F_ARB 0x881F 184 185Additions to Chapter 2 of the OpenGL 2.0 Specification (OpenGL Operation) 186 187 Add a new Section 2.1.2, (p. 6): 188 189 2.1.2 16-Bit Floating-Point Numbers 190 191 A 16-bit floating-point number has a 1-bit sign (S), a 5-bit 192 exponent (E), and a 10-bit mantissa (M). The value of a 16-bit 193 floating-point number is determined by the following: 194 195 (-1)^S * 0.0, if E == 0 and M == 0, 196 (-1)^S * 2^-14 * (M / 2^10), if E == 0 and M != 0, 197 (-1)^S * 2^(E-15) * (1 + M/2^10), if 0 < E < 31, 198 (-1)^S * INF, if E == 31 and M == 0, or 199 NaN, if E == 31 and M != 0, 200 201 where 202 203 S = floor((N mod 65536) / 32768), 204 E = floor((N mod 32768) / 1024), and 205 M = N mod 1024. 206 207 Implementations are also allowed to use any of the following 208 alternative encodings: 209 210 (-1)^S * 0.0, if E == 0 and M != 0, 211 (-1)^S * 2^(E-15) * (1 + M/2^10), if E == 31 and M == 0, or 212 (-1)^S * 2^(E-15) * (1 + M/2^10), if E == 31 and M != 0, 213 214 Any representable 16-bit floating-point value is legal as input 215 to a GL command that accepts 16-bit floating-point data. The 216 result of providing a value that is not a floating-point number 217 (such as infinity or NaN) to such a command is unspecified, but 218 must not lead to GL interruption or termination. Providing a 219 denormalized number or negative zero to GL must yield predictable 220 results. 221 222Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization) 223 224 Modify Section 3.6.3 (Pixel Transfer Modes), p. 116 225 226 (modify first paragraph, p. 118) The specified image is taken from 227 memory and processed just as if DrawPixels were called, stopping 228 after the final expansion to RGBA. The R, G, B, and A components of 229 each pixel are then scaled by the four COLOR TABLE SCALE parameters 230 and biased by the four COLOR TABLE BIAS parameters. These 231 parameters are set by calling ColorTableParameterfv as described 232 below. If fragment color clamping is enable or the 233 <internalformat> is fixed-point, the components are clamped to 234 [0, 1]. Otherwise, the components are not modified. 235 236 Modify Section 3.8.1 (Texture Image Specification), p. 150 237 238 (modify second paragraph, p. 151) The selected groups are processed 239 exactly as for DrawPixels, stopping just before final conversion. 240 For R, G, B, and A, if the <internalformat> of the texture is 241 fixed-point, the components are clamped to [0, 1]. Otherwise, the 242 components are not modified. The depth value so generated is 243 clamped to [0, 1]. 244 245 (modify the second paragraph, p. 152) The internal component resolution 246 is the number of bits allocated to each value in a texture image. If 247 <internalformat> is specified as a base internal format, the GL stores 248 the resulting texture with internal component resolutions of its own 249 choosing. If a sized internal format is specified, the mapping of the 250 R, G, B, A, and depth values to texture components is equivalent to the 251 mapping of the corresponding base internal format's components, as 252 specified in table 3.15, the type (unsigned int, float, etc.) is 253 assigned the same type specified by <internalFormat>, and the memory 254 allocation per texture component is assigned by the GL to match the 255 allocations listed in table 3.16 as closely as possible. (The definition 256 of closely is left up to the implementation. Implementations are not 257 required to support more than one resolution of each type (unsigned int, 258 float, etc.) for each base internal format.) If a compressed internal 259 format is specified, the mapping of the R, G, B, A, and depth values to 260 texture components is equivalent to the mapping of the corresponding 261 base internal format's components, as specified in table 3.15. The 262 specified image is compressed using a (possibly lossy) compression 263 algorithm chosen by the GL. 264 265 (add the following to table 3.16, p. 154) 266 267 Sized Base R G B A L I 268 Internal Format Internal Format bits bits bits bits bits bits 269 --------------------------- --------------- ---- ---- ---- ---- ---- ---- 270 RGBA32F_ARB RGBA f32 f32 f32 f32 271 RGB32F_ARB RGB f32 f32 f32 272 ALPHA32F_ARB ALPHA f32 273 INTENSITY32F_ARB INTENSITY f32 274 LUMINANCE32F_ARB LUMINANCE f32 275 LUMINANCE_ALPHA32F_ARB LUMINANCE_ALPHA f32 f32 276 RGBA16F_ARB RGBA f16 f16 f16 f16 277 RGB16F_ARB RGB f16 f16 f16 278 ALPHA16F_ARB ALPHA f16 279 INTENSITY16F_ARB INTENSITY f16 280 LUMINANCE16F_ARB LUMINANCE f16 281 LUMINANCE_ALPHA16F_ARB LUMINANCE_ALPHA f16 f16 282 283 Table 3.16: Correspondence of sized internal formats to base 284 internal formats, and desired component resolutions for each 285 sized internal format. The notation <f16> and <f32> imply 286 16- and 32-bit floating-point, respectively. 287 288 Modify Section 3.8.4 (Texture Parameters), p. 166 289 290 (remove TEXTURE_BORDER_COLOR from end of first paragraph, p. 166) 291 292 ... If the values for TEXTURE_BORDER_COLOR or the value for 293 TEXTURE_PRIORITY are specified as integers, the conversion for signed 294 integers from table 2.9 is applied to convert this value to 295 floating-point. Regardless of the original data type, the value for 296 TEXTURE_PRIORITY is clamped to lie in [0, 1]. 297 298 ... If the value for TEXTURE_PRIORITY is specified as an integer, 299 the conversion for signed integers from table 2.9 is applied to 300 convert this value to floating-point, followed by clamping the 301 value to lie in [0, 1]. 302 303 Modify Section 3.8.8 (Texture Minification), p. 170 304 305 (modify last paragraph, p. 174) ... If the texture contains color 306 components, the values of TEXTURE BORDER COLOR are interpreted as 307 an RGBA color to match the texture's internal format in a manner 308 consistent with table 3.15. The border values for texture 309 components stored as fixed-point values are clamped to [0, 1] 310 before they are used. If the texture contains depth ... 311 312 Modify Section 3.8.11 (Texture State and Proxy State) p. 178 313 314 (modify the first section, p. 178) ...Each array has associated with 315 it a width, height (two- and three-dimensional and cubemap only), and 316 depth (three-dimensional only), a border width, an integer describing 317 the internal format of the image, six integer values describing the 318 resolutions of each of the red, green, blue, alpha, luminance, and 319 intensity components of the image, six values that describe the type 320 (unsigned int, floats, etc.) of each of the red, green, blue, alpha, 321 luminance, and intensity components of the image, a boolean describing 322 whether the image is compressed or not, and an integer size of a 323 compressed image. Each initial... 324 325 (modify the first paragraph, p. 179) ...Each proxy array includes width, 326 height (two- and three- dimensional arrays only), depth 327 (three-dimensional arrays only), border width, and internal format state 328 values, as well as state for the red, green, blue, alpha, luminance, and 329 intensity component resolutions and types (unsigned int, floats, etc.). 330 Proxy arrays do not include image data, nor do they include texture 331 properties. When TexImage3D is executed with target specified as PROXY 332 TEXTURE 3D, the three-dimensional proxy state values of the specified 333 level-of-detail are recomputed and updated. If the image array would not 334 be supported by TexImage3D called with target set to TEXTURE 3D, no 335 error is generated, but the proxy width, height, depth, border width, 336 and component resolutions are set to zero, and the component types are 337 set to NONE. If the image... 338 339 Modify Section 3.8.13 (Texture Environments and Functions), p.182 340 341 (replace the sixth paragraph of p. 183) All of these color values 342 are clamped to the range [0, 1]. The texture functions are 343 specified in tables 3.22, 3.23, and 3.24. 344 345Additions to Chapter 4 of the OpenGL 2.0 Specification (Per-Fragment 346Operations and the Frame Buffer) 347 348 None 349 350Additions to Chapter 5 of the OpenGL 2.0 Specification (Special 351Functions) 352 353 None 354 355Additions to Chapter 6 of the OpenGL 2.0 Specification (State and 356State Requests) 357 358 Modify Section 6.1.3 (Enumerated Queries), p. 246 359 360 (modify second paragraph, p. 247) For texture images with uncompressed 361 internal formats, queries of <value> of TEXTURE_RED_TYPE_ARB, 362 TEXTURE_GREEN_TYPE_ARB, TEXTURE_BLUE_TYPE_ARB, TEXTURE_ALPHA_TYPE_ARB, 363 TEXTURE_LUMINANCE_TYPE_ARB, TEXTURE_INTENSITY_TYPE_ARB, and 364 TEXTURE_DEPTH_TYPE_ARB, return either NONE, UNSIGNED_NORMALIZED_ARB, or 365 FLOAT indicating how the components are stored, and the queries of 366 <value> of TEXTURE_RED_SIZE, TEXTURE_GREEN_SIZE, TEXTURE_BLUE_SIZE, 367 TEXTURE_ALPHA_SIZE, TEXTURE_LUMINANCE_SIZE, TEXTURE_DEPTH_SIZE, and 368 TEXTURE_INTENSITY_SIZE return the actual resolutions of the stored image 369 array components, not the resolutions specified when the image array was 370 defined. 371 372Additions to the AGL/GLX/WGL Specifications 373 374 None 375 376Dependencies on ARB_color_buffer_float extension 377 378 The ARB_color_buffer_float extension allows clamping to be 379 controlled in various parts of the GL. Specifically, clamping 380 of filtered texel values used for texture environment blending 381 can be disable. 382 383Errors 384 385 None 386 387New State 388 389 (Table 6.17, p. 278) add the following entries: 390 391 Get Value Type Get Command Minimum Value Description Section Attribute 392 ------------------------------- ----- -------------------- ------------- --------------- -------- ---------- 393 TEXTURE_RED_TYPE_ARB Z3 GetTexLevelParameter - storage type 6.1.3 - 394 TEXTURE_GREEN_TYPE_ARB Z3 GetTexLevelParameter - storage type 6.1.3 - 395 TEXTURE_BLUE_TYPE_ARB Z3 GetTexLevelParameter - storage type 6.1.3 - 396 TEXTURE_ALPHA_TYPE_ARB Z3 GetTexLevelParameter - storage type 6.1.3 - 397 TEXTURE_LUMINANCE_TYPE_ARB Z3 GetTexLevelParameter - storage type 6.1.3 - 398 TEXTURE_INTENSITY_TYPE_ARB Z3 GetTexLevelParameter - storage type 6.1.3 - 399 TEXTURE_DEPTH_TYPE_ARB Z3 GetTexLevelParameter - storage type 6.1.3 - 400 401New Implementation Dependent State 402 403 None 404 405Revision History 406 407 Rev. Date Author Changes 408 ---- -------- --------- ---------------------------------------- 409 1 2/26/04 kirkland Initial version based on the ATI 410 extension. 411 412 2 3/11/04 kirkland Updated language for float16 number 413 handling. 414 Added bit encodings for half values. 415 Added an issue for color tables. 416 Added separate queries for component 417 types. 418 Changed the internal format names to 419 match the uber buffer extension. 420 Added language to not allow textures to 421 change the type of the internal formats, 422 only the precision. 423 424 3 7/23/04 kirkland Added alternative encodings options for 425 float16 format. 426 427 4 9/17/04 kirkland Updated to reference the OpenGL 2.0 spec. 428 Added interaction with clamp control. 429 Removed the clamping of color table data. 430 431 5 10/1/04 Kirkland Updated IP section. 432 Reviewed by the ARB and closed all 433 UNRESOLVED issues. 434 435 6 7/6/06 pbrown Fixed broken language for border color 436 handling. TexParameteriv border colors 437 should still be converted to integer; we 438 only intended to remove the [0,1] clamping. 439 440 7 2/8/07 Jon Leech Move 3.8.13 changes to appropriate section. 441