1Name 2 3 ARB_ES3_2_compatibility 4 5Name Strings 6 7 GL_ARB_ES3_2_compatibility 8 9Contact 10 11 Piers Daniell, NVIDIA Corporation (pdaniell 'at' nvidia.com) 12 13Contributors 14 15 Daniel Koch, NVIDIA Corporation (dkoch 'at' nvidia.com) 16 17 and contributors to the OpenGL ES 3.2 specification 18 19Notice 20 21 Copyright (c) 2015 The Khronos Group Inc. Copyright terms at 22 http://www.khronos.org/registry/speccopyright.html 23 24Specification Update Policy 25 26 Khronos-approved extension specifications are updated in response to 27 issues and bugs prioritized by the Khronos OpenGL Working Group. For 28 extensions which have been promoted to a core Specification, fixes will 29 first appear in the latest version of that core Specification, and will 30 eventually be backported to the extension document. This policy is 31 described in more detail at 32 https://www.khronos.org/registry/OpenGL/docs/update_policy.php 33 34Status 35 36 Complete. Approved by the ARB on June 26, 2015. 37 Ratified by the Khronos Board of Promoters on August 7, 2015. 38 39Version 40 41 Last Modified Date: June 25, 2015 42 Revision: 8 43 44Number 45 46 ARB Extension #177 47 48Dependencies 49 50 OpenGL 4.5, ARB_ES2_compatibility, ARB_ES3_compatibility and 51 ARB_ES3_1_compatibility are required. 52 53 KHR_blend_equation_advanced and KHR_texture_compression_astc_ldr are 54 recommended to support the full OpenGL ES 3.2 feature set, but not 55 required for this extension. 56 57 This extension is written against The OpenGL 4.5 (Compatibility Profile) 58 specification. 59 60Overview 61 62 This extension adds support for features of OpenGL ES 3.2 that are 63 missing from OpenGL 4.5. Enabling these features will ease the process 64 of porting applications from OpenGL ES 3.2 to OpenGL. 65 66 In particular this adds the following features: 67 68 - Bounding box used to optimization tessellation processing 69 (OES_primitive_bounding_box) 70 - query for MULTISAMPLE_LINE_WIDTH_RANGE_ARB 71 - support for the OpenGL ES 3.20 shading language 72 73 For full OpenGL ES 3.2 compatibility the implementation must support 74 KHR_blend_equation_advanced and KHR_texture_compression_astc_ldr. Those 75 features are not defined in this extension spec since they are already 76 defined at the KHR level. 77 78New Procedures and Functions 79 80 void PrimitiveBoundingBoxARB(float minX, float minY, float minZ, float minW, 81 float maxX, float maxY, float maxZ, float maxW); 82 83New Tokens 84 85 Accepted by the <pname> parameter of GetBooleanv, GetFloatv, GetIntegerv, 86 and GetInteger64v: 87 88 PRIMITIVE_BOUNDING_BOX_ARB 0x92BE 89 MULTISAMPLE_LINE_WIDTH_RANGE_ARB 0x9381 90 MULTISAMPLE_LINE_WIDTH_GRANULARITY_ARB 0x9382 91 92Additions to Chapter 11 of the 4.5 Specification (Programmable Vertex 93Processing) 94 95-- OpenGL: Section 11.2, Tessellation 96 97 Modify section 11.2.1.2.3, "Tessellation Control Shader Outputs": 98 99 In the second paragraph, add gl_BoundingBox[] to the list of built-in 100 per-patch output arrays: 101 102 Tessellation shaders additionally have three built-in per-patch output 103 arrays, gl_TessLevelOuter[], gl_TessLevelInner[], and gl_BoundingBox[]. 104 These arrays ... as discussed in the following section. gl_BoundingBox[] 105 is an array of two vec4 values that should be used instead of the value of 106 PRIMITIVE_BOUNDING_BOX_ARB as the primitive bounding box (see Section 107 14.1pbb) for primitives generated from the output patch. 108 109 Modify the sixth paragraph of the section to state that gl_BoundingBox[] 110 counts against the per-patch limit: 111 112 ... The built-in outputs gl_TessLevelOuter[] and gl_TessLevelInner[] are not 113 counted against the per-patch limit. The built-in output 114 gl_BoundingBox[], if statically assigned by the shader, is counted 115 against the per-patch limit. The total number of components... 116 117 118 Modify section 11.2.3.3, "Tessellation Evaluation Shader Inputs": 119 120 Insert a new paragraph after the list of special input variables in 121 paragraph 2: 122 123 The special tessellation control shader output gl_BoundingBox[] is 124 consumed by the tessellation primitive generator, and is not available as an 125 input to the tessellation evaluation shader. 126 127 128 Add new section 14.1pbb following section 14.1, "Discarding Primitives 129 Before Rasterization" on p. 525: 130 131 14.1pbb, Primitive Bounding Box 132 133 Implementations may be able to optimize performance if the application 134 provides bounds of primitives that will be generated by the tessellation 135 primitive generator or the geometry shader prior to executing those stages. 136 If the provided bounds are incorrect and primitives extend beyond them, the 137 rasterizer may or may not generate fragments for the portions of primitives 138 outside the bounds. 139 140 The primitive bounding box is specified using 141 142 void PrimitiveBoundingBoxARB(float minX, float minY, float minZ, float minW, 143 float maxX, float maxY, float maxZ, float maxW); 144 145 where <minX>, <minY>, <minZ>, and <minW> specify the minimum clip space 146 coordinate of the bounding box and <maxX>, <maxY>, <maxZ>, and <maxW> 147 specify the maximum coordinate. 148 149 If tessellation is active, each invocation of the tessellation control 150 shader may re-specify the bounding box by writing to the built-in 151 gl_BoundingBox[] variable. If the shader statically assigns a value to 152 any part of this variable, then gl_BoundingBox[0] is used instead of 153 <minX>, <minY>, <minZ>, <minW>, and gl_BoundingBox[1] is used instead of 154 <maxX>, <maxY>, <maxZ>, <maxW>. If the shader contains a static assignment 155 to gl_BoundingBox[] and there is an execution path through the shader 156 that does not write all components of gl_BoundingBox[], the value of 157 unwritten components and corresponding bounding box coordinates is undefined 158 for executions of the shader that take that path. 159 160 If the tessellation control shader re-specifies the bounding box, the re- 161 specified value is used for primitives generated from the output patch by 162 the primitive generator, any primitives emitted by the geometry shader 163 invocations for those generated primitives, and any primitives further 164 introduced during clipping. 165 166 The bounding box in clip space is composed of 16 vertices formed by all 167 combinations of the minimum and maximum values for each dimension. This 168 bounding box is clipped against w_c > 0, and projected to three dimensions 169 by dividing x_c, y_c, and z_c by w_c for each vertex. The viewport transform 170 is then applied to each vertex to produce a three-dimensional bounding 171 volume in window coordinates. 172 173 The window space bounding volume is expanded in the X and Y dimensions to 174 accomodate the rasterization rules for the primitive type, and to fall on 175 fragment boundaries: 176 min_wc' = floor(min_wc - size/2.0) 177 max_wc' = ceil(max_wc + size/2.0) 178 where the min_wc rule is used for x and y window coordinates of bounding 179 volume vertices formed from minX and minY respectively, and the max_wc rule 180 is used for x and y window coordinates of bounding volume vertices formed 181 from maxX and maxY respectively. For point primitives, size is the per- 182 primitive point size after clamping to the implementation-defined maximum 183 point size as described in section 13.3. For line primitives, size is the 184 line width, after rounding and clamping as described in section 13.4.2.1. 185 For triangle primitives, size is zero. 186 187 During rasterization, the rasterizer will generate fragments with 188 window coordinates inside the windows space bounding volume, but may or may 189 not generate fragments with window coordinates outside the bounding volume. 190 191 192 Modify section 14.5.4, "Line Multisample Rasterization": 193 194 Replace the last paragraph with: 195 196 Line width range and number of gradations are equivalent to those supported 197 for antialiased lines. The supported [min, max] range of multisampled line 198 widths, and the width of evenly-space graduations within that range are 199 implementation-dependent and may be queried as 200 MULTISAMPLE_LINE_WIDTH_RANGE_ARB and MULTISAMPLE_LINE_WIDTH_GRANULARITY_ARB 201 respectively, as described in table 23.54. If, for instance the width range 202 is from 0.1 to 2.0 and the gradation width is 0.1 then the widths 0.1, 0.2, 203 ..., 1.9, 2.0 are supported. Additional line widths may also be supported; 204 there is no requirement that these widths be evenly space. If an 205 unsupported width is requested, the nearest supported width is used 206 instead. 207 208Additions to the OpenGL Shading Language 209 210 Including the following line in a shader can be used to control the 211 language features described in this extension: 212 213 #extension GL_ARB_ES3_2_compatibility : <behavior> 214 215 where <behavior> is as specified in section 3.3. 216 217 New preprocessor #defines are added to the OpenGL Shading Language: 218 219 #define GL_ARB_ES3_2_compatibility 1 220 221 222Additions to Chapter 3 of the OpenGL Shading Language 4.50.5 Specification 223(Basics) 224 225 Modify the paragraph at the bottom of page 16 in Section 3.3 226 (Preprocessor) as follows: 227 228 "... Shaders that specify #version 100 will be treated as targeting 229 version 1.00 of the OpenGL ES Shading Language. Shaders that specify 230 #version 300 will be treated as targeting version 3.00 of the OpenGL 231 ES Shading Language. Shaders that specify #version 310 will be treated 232 as targeting version 3.10 of the OpenGL ES Shading Language. Shaders 233 that specify #version 320 will be treated as targeting version 3.20 234 of the OpenGL ES Shading Language...." 235 236 Modify the 3rd paragraph at the top of p16 as follows: 237 238 A <profile> argument ... 239 If version 300, 310 or 320 is specified, the profile argument is not 240 optional and must be "es", or a compile-time error results. The Language 241 Specification ... 242 243 244Additions to Chapter 7 of the OpenGL Shading Language 4.50.5 Specification 245(Built-in Variables) 246 247 Add a new built-in variable intrinsic declaration after the 248 gl_TessLevelOuter and gl_TessLevelInner declarations: 249 250 patch out highp vec4 gl_BoundingBox[2]; 251 252 253Additions to the AGL/GLX/WGL Specifications 254 255 None 256 257Errors 258 259 TBD 260 261New State 262 263 Add to state values in Table 23.10, Transformation State: 264 265 Default 266 Get Value Type Get Command Value Description Sec. 267 -------------------------- ---- ----------- ------------ ----------------- -------- 268 PRIMITIVE_BOUNDING_BOX_ARB 8xR GetFloatv -1,-1,-1, 1, Default primitive 14.1pbb 269 1, 1, 1, 1 bounding box 270 271 Add to state values in Table 23.54, Implementation Dependent Values: 272 273 Minimum 274 Get Value Type Get Command Value Description Sec. 275 -------------------------------- ---- ----------- ------- ------------------- -------- 276 MULTISAMPLE_LINE_WIDTH_RANGE_ARB 2xR+ GetFloatv 1,1 Range (lo to hi) of 14.5.4 277 multisampled line widths 278 MULTISAMPLE_LINE_WIDTH_GRANULARITY_ARB R+ GetFloatv - Multisampled line 14.5.4 279 width granularity 280 281 282Issues 283 284 1) With this extension, is OpenGL 4.5 a complete superset of OpenGL ES 3.2? 285 286 RESOLVED: No. This extension does not include KHR_blend_equation_advanced or 287 KHR_texture_compression_astc_ldr even though these are part of OpenGL ES 3.2. 288 These continue to be optional extensions for OpenGL. Otherwise OpenGL 4.5 289 plus this extension is a superset of OpenGL ES 3.2. 290 291Revision History 292 293 Rev. Date Author Changes 294 ---- -------- -------- ----------------------------------------------- 295 296 1 04/19/15 pdaniell Initial draft with incomplete text. 297 298 2 04/29/15 pdaniell Remove EXT_texture_sRGB_decode which is no longer 299 in OpenGL ES 3.2. 300 301 3 05/07/15 dkoch Add MULTISAMPLED_LINE_WIDTH_RANGE_ARB query 302 (Bug 13828). 303 Remove ASTC interaction with SRGB_DECODE. 304 305 4 05/07/15 Jon Leech Assign enum for MULTISAMPLED_LINE_WIDTH_RANGE_ARB. 306 307 5 05/21/15 pdaniell Allow KHR_blend_equation_advanced and 308 KHR_texture_compression_astc_ldr to be optional 309 for this extension. 310 311 6 06/18/15 pdaniell Fix resolution of issue (1). 312 313 7 06/24/15 Jon Leech Correct MULTISAMPLE_LINE_WIDTH_RANGE_ARB 314 spelling (drop 'D') 315 316 8 06/25/15 dkoch Add MULTISAMPLE_LINE_WIDTH_GRANULARITY_ARB 317 query per bug 13828. 318 319