1Name 2 3 EXT_render_snorm 4 5Name Strings 6 7 GL_EXT_render_snorm 8 9Contributors 10 11 Daniel Koch, NVIDIA 12 Jan-Harald Fredriksen, ARM 13 Mathias Heyer, NVIDIA 14 15Contact 16 17 Mathias Heyer, NVIDIA (mheyer [at] nvidia.com) 18 19Status 20 21 Complete 22 23Version 24 25 Last Modified Date: 2014-10-24 26 Revision: 4 27 28Number 29 30 OpenGL ES Extension #206 31 32Dependencies 33 34 OpenGL ES 3.1 is required. 35 36 This extension is written against the OpenGL ES 3.1 (June 4, 2014) 37 specification. 38 39 This extension interacts with EXT_texture_norm16. 40 41Overview 42 43 OpenGL ES 3.1 supports a variety of signed normalized texture and 44 renderbuffer formats which are not color-renderable. 45 46 This extension enables signed normalized texture and renderbuffer 47 formats to be color-renderable. 48 49New Procedures and Functions 50 51 None 52 53New Tokens 54 55 Accepted by the <type> parameter of ReadPixels 56 57 BYTE 0x1400 // core OpenGL ES 3.1 58 SHORT 0x1402 // core OpenGL ES 3.1 59 60 Accepted by the <internalFormat> parameter of RenderbufferStorage 61 and RenderbufferStorageMultisample: 62 63 R8_SNORM 0x8F94 // core OpenGL ES 3.1 64 RG8_SNORM 0x8F95 // core OpenGL ES 3.1 65 RGBA8_SNORM 0x8F97 // core OpenGL ES 3.1 66 R16_SNORM_EXT 0x8F98 // EXT_texture_norm16 67 RG16_SNORM_EXT 0x8F99 // EXT_texture_norm16 68 RGBA16_SNORM_EXT 0x8F9B // EXT_texture_norm16 69 70Additions to Chapter 8 of the OpenGL ES 3.1 Specification 71(Textures and Samplers) 72 73 Changes to Section 8.6 "Alternate Texture ImageSpecification Commands": 74 75 Modify INVALID_OPERATION errors section on CopyTexImage2D, 76 first bullet point from: 77 78 "if signed integer, unsigned integer, or fixed-point RGBA data is 79 required and the format of the current color buffer does not match 80 the required format." 81 82 to 83 84 "if FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE for the framebuffer 85 attachment corresponding to the read buffer does not match 86 the component type of the requested <internalformat>." 87 88 89 Change Table 8.13 "Correspondence of sized internal formats to base 90 internal formats,...": 91 92 Sized Base Bits/component CR TF Req. Req. 93 Internal Internal S are shared bits rend. tex. 94 Format Format R G B A S 95 ------------ ----------- ---- ---- ---- --- ---- --- --- ---- --- 96 R8_SNORM RED s8 X X X X 97 RG8_SNORM RG s8 s8 X X X X 98 RGBA8_SNORM RGBA s8 s8 s8 s8 X X X X 99 R16_SNORM_EXT RED s16 X X X X 100 RG16_SNORM_EXT RG s16 s16 X X X X 101 RGBA16_SNORM_EXT RGBA s16 s16 s16 s16 X X X X 102 103 Change Table 8.15: "ReadPixels format and type used during CopyTex*." 104 105 Replace the first row with the following: 106 107 Read Buffer Format format type 108 ------------------------------------ ------ ------------- 109 8bit Unsigned Normalized Fixed-point RGBA UNSIGNED_BYTE 110 8bit Signed Normalized Fixed-point RGBA BYTE 111 16bit Signed Normalized Fixed-point RGBA SHORT 112 113 114Additions to Chapter 15 of the OpenGL ES 3.1 Specification 115(Writing Fragments and Samples to the Framebuffer) 116 117 Changes to Section 15.1.7 "Blending": 118 119 Replace 120 121 "The components of the source and destination values and blend 122 factors are clamped to [0, 1] prior to evaluating the blend 123 equation." 124 125 with 126 127 "If the color buffer is fixed-point, the components of the 128 source and destination values and blend factors are each clamped 129 to [0, 1] or [-1, 1] respectively for an unsigned normalized or 130 signed normalized color buffer prior to evaluating the blend 131 equation." 132 133 Changes to Section 15.1.7.1 "Blend Equation": 134 135 Replace 136 137 "Unsigned normalized fixed-point destination (framebuffer) 138 components are represented as described in section 2.3.4." 139 140 with 141 142 "Normalized fixed-point destination (framebuffer) components are 143 represented as described in section 2.3.4." 144 145 Replace 146 147 "Prior to blending, unsigned normalized fixed-point color 148 components undergo an implied conversion to floating-point using 149 equation 2.1." 150 151 with 152 153 "Prior to blending, unsigned and signed normalized fixed-point 154 color components undergo an implied conversion to floating-point 155 using equation 2.1 and 2.2, respectively." 156 157 Changes to Section 15.1.7.3 "Blend Color" 158 159 Replace 160 161 "If destination framebuffer components use an unsigned 162 normalized fixed-point representation, the constant color 163 components are clamped to the range [0, 1] when computing blend 164 factors." 165 166 with 167 168 "If destination framebuffer components use an unsigned or 169 signed normalized fixed-point representation, the constant color 170 components are clamped to the range [0, 1] or [-1, 1], 171 respectively, when computing blend factors." 172 173 Changes to Section 15.2.3 "Clearing the Buffers": 174 175 Replace 176 177 "Unsigned normalized fixed-point RGBA color buffers are cleared 178 to color values derived by clamping each component of the clear 179 color to the range [0, 1], then converting the (possibly sRGB 180 converted and/or dithered) color to fixed-point using equations 181 2.3 or 2.4, respectively." 182 183 with 184 185 "Unsigned normalized fixed-point or signed normalized 186 fixed-point RGBA color buffers are cleared to color values 187 derived by clamping each component of the clear color to the 188 range [0, 1] or [-1, 1] respectively, then converting the 189 (possibly sRGB converted and/or dithered) color to fixed-point 190 using equations 2.3 or 2.4, respectively." 191 192 Add to the second paragraph of Section 16.1.2 "ReadPixels": 193 194 "For 8bit signed normalized fixed-point rendering surfaces, the 195 combination format RGBA and type BYTE is accepted. For a 16bit 196 signed normalized fixed point buffer, the combination RGBA and 197 SHORT is accepted." 198 199 Add to Section 16.1.4 "Conversion of RGBA values": 200 201 For signed normalized fixed-point color buffer, each element 202 is converted to floating-point using equation 2.2. 203 204 205Errors 206 207 No new errors. 208 209 210Interactions with EXT_texture_norm16 211 212 If EXT_texture_norm16 is not supported, remove references to R16_SNORM_EXT, 213 RG16_SNORM_EXT, RGB16_SNORM_EXT, RGBA16_SNORM_EXT. Remove language and 214 additions referring to 16bit (signed / unsigned) normalized fixed 215 point buffers. 216 217 218Issues 219 220 1. How does this extension differ from the functionality offered by GL4.4? 221 222 On GL, the affected formats are generally exposed as 'color 223 renderable' but not as 'required renderbuffer format', which 224 might be interpreted as 'optionally renderable'. EXT_render_snorm 225 tries to avoid this ambiguity by introducing formats as 'neither 226 color-renderable nor req. renderbuffer format' or as 227 'color-renderable plus required renderbuffer format', but not a 228 mixture of both. DX 10.1 level hardware is expected to supported 229 these formats as being renderable. 3-component snorm formats were 230 left out as they are not expected to map well to native hardware 231 formats. 232 233 2. Are format conversions between UNORM and SNORM formats allowed 234 for CopyTexImage2D? 235 236 The OpenGL ES specs describe the CopyTexImage2D operation in 237 terms of ReadPixels followed by TexImage2D. The ReadPixels 238 command will use the appropriate format/type combination from 239 Table 8.15. For an internal format of RGBA8_SNORM, this will be 240 GL_RGBA and GL_BYTE. (Special rules apply to framebuffer 241 attachments that have been created using unsized internalformats. 242 These rules don't apply to attachments of _SNORM formats as they 243 could only have been created using sized internalformats.) The 244 following 'virtual' TexImage2D call will use the same format/type 245 combination together with the provided internalformat. The 246 resulting combination of internalformat/format/type must be one 247 of those listed in Table 8.12. For signed fixed point formats it 248 is not possible to create them from unsigned fixed point data and 249 vice versa. Effectively this means, CopyTexImage2D cannot perform 250 any conversions that glTexImage could not do (except dropping 251 color components); in particular it cannot convert between 252 mismatching component types. 253 254 Source Effective | Requested | CopyTexImage Supported 255 Internalformat | Internalformat | 256 -----------------+------------------------+------------------------------------ 257 sized SNORM | sized SNORM | yes (provided component sizes match 258 | | and the same or more components 259 | | are present in the source buffer) 260 sized SNORM | sized or unsized UNORM | no (conversions not supported) 261 262 263Revision History: 264 265 Revision: 1 2014-07-18 (mheyer) 266 initial revision 267 Revision: 2 2014-08-08 (mheyer) 268 rename extension to EXT_render_snorm 269 Revision: 3 2014-08-20 (mheyer) 270 clarify CopyTexImage2D behavior 271 Revision: 4 2014-10-24 (dkoch) 272 mark complete, publishing cleanup 273