1Name 2 3 WGL_ATI_pixel_format_float 4 5Name Strings 6 7 WGL_ATI_pixel_format_float 8 9Contact 10 11 Rob Mace, AMD (rob.mace 'at' amd.com) 12 13Status 14 15 Complete. 16 17Version 18 19 Last Modified Date: November 4, 2006 20 Revision: 6 21 22Number 23 24 278 25 26Dependencies 27 28 WGL_ARB_pixel_format is required. 29 30 This extension is written against the OpenGL 1.3 Specification. 31 32 33Overview 34 35 This extension adds pixel formats with floating-point RGBA color 36 components. 37 38 The size of each float components is specified using the same 39 WGL_RED_BITS_ARB, WGL_GREEN_BITS_ARB, WGL_BLUE_BITS_ARB and 40 WGL_ALPHA_BITS_ARB pixel format attributes that are used for 41 defining the size of fixed-point components. 32 bit floating- 42 point components are in the standard IEEE float format. 16 bit 43 floating-point components have 1 sign bit, 5 exponent bits, 44 and 10 mantissa bits. 45 46 In standard OpenGL RGBA color components are normally clamped to 47 the range [0,1]. The color components of a float buffer are 48 clamped to the limits of the range representable by their format. 49 50 51Issues 52 53 1. Should we expose a GL_FLOAT16_ATI pixel type? 54 55 RESOLUTION: This will be exposed in a separate extension. 56 57 58New Procedures and Functions 59 60 None 61 62 63New Tokens 64 65 Accepted by the <pname> parameters of GetBooleanv, GetIntegerv, 66 GetFloatv, and GetDoublev: 67 68 RGBA_FLOAT_MODE_ATI 0x8820 69 COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 70 71 Accepted as a value in the <piAttribIList> and <pfAttribFList> 72 parameter arrays of wglChoosePixelFormatARB, and returned in the 73 <piValues> parameter array of wglGetPixelFormatAttribivARB, and the 74 <pfValues> parameter array of wglGetPixelFormatAttribfvARB: 75 76 WGL_TYPE_RGBA_FLOAT_ATI 0x21A0 77 78 79Additions to Chapter 2 of the OpenGL 1.3 Specification (OpenGL 80Operation) 81 82 Add a new Section 2.1.2, (p. 6): 83 84 2.1.2 16 Bit Floating-Point 85 86 A 16 bit floating-point number has 1 sign bit (s), 5 exponent 87 bits (e), and 10 mantissa bits (m). The value (v) of a 16 bit 88 floating-point number is determined by the following pseudo code: 89 90 if (e != 0) 91 v = (-1)^s * 2^(e-15) * 1.m # normalized 92 else if (f == 0) 93 v = (-1)^s * 0 # zero 94 else 95 v = (-1)^s * 2^(e-14) * 0.m # denormalized 96 97 It is acceptable for an implementation to treat denormalized 16 bit 98 floating-point numbers as zero. 99 100 There are no NAN or infinity values for 16 bit floating-point. 101 102 103 104 105Additions to Chapter 3 of the OpenGL 1.3 Specification (Rasterization) 106 107 Section 3.6.4, (p. 92), Add to figure 3.7 a block to "final 108 conversion" for "RGBA float pixel data out" that says "clamp 109 to float format range". 110 111 Section 3.6.4, (p. 102), change the first paragraph of the "Final 112 Conversion" to: 113 114 For a color index, final conversion consists of masking the bits 115 of the index to the left of the binary point by 2^n - 1, where n 116 is the number of bits in an index buffer. For RGBA components the 117 conversion is based on whether the components in the destination 118 color buffer are fixed-point or floating-point. For fixed-point 119 destination buffers components are clamped to [0,1]. The resulting 120 values are converted to fixed-point according to the rules given in 121 section 2.13.9 (Final Color Processing). For floating-point 122 destination buffers components are clamped to the limits of the 123 range representable by the destination format. 124 125 126Additions to Chapter 4 of the OpenGL 1.3 Specification (Per-Fragment 127Operations and the Frame Buffer) 128 129 Chapter 4 Introduction, (p. 156), change the first line of the third 130 paragraph to: 131 132 Color buffers consist of either unsigned integer color indices, 133 RGB and optionally A unsigned integer values, of RGBA floating- 134 point values. 135 136 Section 4.1.7, (p. 162), change the third paragraph of the page to: 137 138 Fixed-point destination (framebuffer) components and source 139 (fragment) components are taken to be values represented according 140 to the scheme given in section 2.13.9 (Final Color Processing). 141 Floating-point destination and source components are taken as is. 142 Constant color components are taken to be floating-point values. 143 144 Section 4.1.7, (p. 163), change the forth line of the second paragraph 145 of "Using BlendFunc" to: 146 147 If destination color components are fixed-point, each floating- 148 point value in this quadruplet is clamped to [0,1] and converted 149 back to a fixed-point value in the manner described in section 150 2.13.9. 151 152 Section 4.1.8, (p. 165), insert after the first sentence: 153 154 Dithering has no effect if the destination color buffer components 155 are floating-point. 156 157 Section 4.1.9, (p. 165), insert after the first sentence: 158 159 Logical operation has no effect if the destination color buffer 160 components are floating-point. 161 162 Section 4.2.3, (p. 170), change the third paragraph to: 163 164 void ClearColor(float r, float g, float b, float a); 165 166 sets the clear value for the color buffers in RGBA mode. When 167 clearing a fixed-point color buffer each of the specified 168 components is clamped to [0; 1] and converted to fixed-point 169 according to the rules of section 2.13.9. When clearing a 170 floating-point color buffer the specified components are not 171 clamped. 172 173 Section 4.3.2, (p. 176), change the "Conversion of RGBA values" to: 174 175 This step applies only if the GL is in RGBA mode, and then only 176 if format is neither STENCIL INDEX nor DEPTH COMPONENT. The R, 177 G, B, and A values form a group of elements. When reading from a 178 fixed-point color buffer each element is taken to be a fixed-point 179 value in [0; 1] with m bits, where m is the number of bits in the 180 corresponding color component of the selected buffer (see 181 section 2.13.9). 182 183 Section 4.3.2, (p. 177), change the second paragraph of the "Final 184 Conversion" to: 185 186 For a fixed-point RGBA color buffer, each component is first 187 clamped to [0,1]. For floating-point RGBA color buffer, components 188 are not clamped if the <type> is FLOAT, clamped to [0,1] if the 189 <type> is unsigned, and clamped to [-1,1] if the <type> is signed. 190 After clamping the appropriate conversion formula from table 4.7 191 is applied to the component. 192 193 194Additions to Chapter 5 of the OpenGL 1.3 Specification (Special 195Functions) 196 197 None 198 199 200Additions to Chapter 6 of the OpenGL 1.3 Specification (State and 201State Requests) 202 203 None 204 205 206Additions to the GLX Specification 207 208 This specification is written for WGL. 209 210GLX Protocol 211 212 This specification is written for WGL. 213 214Additions to the WGL Specification 215 216 217 Modify the values accepted by WGL_PIXEL_TYPE_ARB to: 218 219 WGL_PIXEL_TYPE_ARB 220 The type of pixel data. This can be set to WGL_TYPE_RGBA_ARB, 221 WGL_TYPE_RGBA_FLAOT_ARB, or WGL_TYPE_COLORINDEX_ARB. 222 223 224Dependencies on WGL_ARB_pixel_format 225 226 The WGL_ARB_pixel_format extension must be used to determine a 227 pixel format with float components. 228 229 230Dependencies on WGL_ARB_extensions_string 231 232 Because this extension is a WGL extension, it is not included in 233 the GL_EXTENSIONS string. Its existence can be determined with 234 the WGL_ARB_extensions_string extension. 235 236 237Errors 238 239 None 240 241 242New State 243 244 (table 6.19, p227) modify COLOR_CLEAR_VALUE and add 245 COLOR_CLEAR_UNCLAMPED_VALUE: 246 247 Get Value Type Get Command Initial Value Description Section Attribute 248 ------------------------------- ----- ----------- ------------- ------------------ ------- ------------ 249 COLOR_CLEAR_VALUE C GetFloatv 0,0,0,0 Color buffer clear 4.2.3 color-buffer 250 value (RGBA mode) 251 clamped to [0,1] 252 COLOR_CLEAR_UNCLAMPED_VALUE_ATI 4 x R GetFloatv 0,0,0,0 Color buffer clear 4.2.3 color-buffer 253 value (RGBA mode) 254 unclamped 255 256 257 (table 6.28, p236) add the following entry: 258 259 Get Value Type Get Command Minimum Value Description Section Attribute 260 -------------------- ----- ------------ ------------- --------------- -------- ---------- 261 RGBA_FLOAT_MODE_ATI B GetBooleanv - True if RGBA 2.7 - 262 components are 263 floats 264 265 266New Implementation Dependent State 267 268 None 269 270 271Revision History 272 273 Date: 11/4/2006 274 Revision: 6 275 - Updated contact info after ATI/AMD merger. 276 277 Date: 12/4/2002 278 Revision: 5 279 - Added Section 2.1.2 16 Bit Floating-Point. 280 281 Date: 9/12/2002 282 Revision: 4 283 - Fixed typo, CLEAR_COLOR_VALUE is really COLOR_CLEAR_VALUE. 284 285 Date: 9/11/2002 286 Revision: 3 287 - Added enum numbers to New Tokens. 288 - Added CLEAR_COLOR_UNCLAMPED_VALUE_ATI and defined behavior of 289 CLEAR_COLOR_VALUE. 290 - Added description of change to figure 3.7. 291 - Clarified float clamping in section 3.6.4. 292 293 Date: 9/9/2002 294 Revision: 2 295 - Changed wording of how float clamping is described in Overview. 296 297 Date: 9/6/2002 298 Revision: 1 299 - First draft for circulation. 300