1Name 2 3 EXT_no_config_context 4 5Name Strings 6 7 GLX_EXT_no_config_context 8 9Contributors 10 11 Adam Jackson 12 Kyle Brenneman 13 James Jones 14 Alex Goins 15 16 This extension is derived from EGL_KHR_no_config_context, whose 17 contributors include: 18 19 Etay Meiri 20 Alon Or-bach 21 Jeff Vigil 22 Ray Smith 23 Michael Gold 24 James Jones 25 Daniel Kartch 26 Adam Jackson 27 Jon Leech 28 29Contact 30 31 Adam Jackson <ajax@redhat.com> 32 33IP Status 34 35 No known IP claims. 36 37Status 38 39 Complete. 40 41Version 42 43 Version 8, 2020/10/05 44 45Number 46 47 OpenGL Extension #553 48 49Dependencies 50 51 GLX_ARB_create_context is required. 52 53 Interacts with GLX_ARB_fbconfig_float. 54 55 Interacts with GLX_EXT_fbconfig_packed_float. 56 57 This extension is written against the GLX 1.4 Specification. 58 59 Some of the capabilities of these extensions are only available when 60 creating OpenGL or OpenGL ES contexts supporting specific versions or 61 capabilities. All such restrictions are documented in the body of this 62 extension specification. 63 64Overview 65 66 Modern GPUs allow contexts to render to almost any combination of 67 supported color and auxiliary buffer formats. Traditionally GLX context 68 creation is done with respect to a GLXFBConfig specifying buffer formats, 69 and constrains contexts to only work with drawables created with a 70 "compatible" config. 71 72 This extension allows creation of GL & ES contexts without specifying a 73 GLXFBConfig. 74 75New Procedures and Functions 76 77 None. 78 79New Tokens 80 81 None. 82 83Additions to the GLX_ARB_create_context Specification 84 85 To the paragraph beginning "If glXCreateContextAttribsARB succeeds", 86 append: 87 88 "If <config> is NULL, the context will be created without reference to a 89 config. In this case, the attribute list must include GLX_SCREEN, naming 90 the screen for the context; if GLX_SCREEN is not specified, or 91 GLX_RENDER_TYPE is specified, BadValue is generated." 92 93Additions to the GLX 1.4 Specification 94 95 In section 2.1 "Rendering Contexts and Drawing Surfaces", modify the 96 5th paragraph: 97 98 "A rendering context can be used with any GLXDrawable that it is 99 compatible with (subject to the restrictions discussed in the section on 100 address space and the restrictions discussed under glXCreatePixmap). A 101 drawable and context are compatible if either of the following sets of 102 conditions are true: 103 104 * The context was created with NULL GLXFBConfig 105 106 * The drawable and context are on the same screen 107 108 or: 109 110 [...]" 111 112 Append a new paragraph to the end of section 2.1 "Rendering Contexts 113 and Drawing Surfaces": 114 115 "If NULL was specified as the GLXFBConfig at creation, the resulting 116 context is said to be created <without reference to a config>. In this 117 case, the context must pass the required conformance tests for the version 118 of OpenGL/OpenGL ES it supports, and must support being made current 119 without a drawable. Such support is guaranteed for OpenGL ES 2.0 120 implementations supporting the GL_OES_surfaceless_context extension, 121 OpenGL ES 3.0 and later versions of OpenGL ES, and OpenGL 3.0 and later 122 versions of OpenGL. Such contexts are compatible with any drawable on the 123 same screen, though the version of OpenGL or OpenGL ES in use may impose 124 further restrictions. For example, forward-compatible OpenGL 3.0 contexts 125 can not render to color index drawables, even if color index GLXFBConfigs 126 are available." 127 128 In section 3.3.7 "Rendering Contexts" in the discussion of glXQueryContext, 129 to the paragraph beginning "The values and types", append: 130 131 "If the context was created without reference to a config, the value 132 of GLX_RENDER_TYPE will be GLX_DONT_CARE, and the values of 133 GLX_FBCONFIG_ID and GLX_VISUAL_ID_EXT will be None." 134 135Interactions with GLX_ARB_fbconfig_float 136 137 A context created without reference to a config may be used to render to 138 drawables whose config has GLX_RGBA_FLOAT_BIT_ARB set. 139 140Interactions with GLX_EXT_fbconfig_packed_float 141 142 A context created without reference to a config may be used to render to 143 drawables whose config has GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT set. 144 145Errors 146 147 No new error types are added. 148 149GLX Protocol 150 151 No new requests are added. 152 153 For GLXCreateContextAttribsARB, normally the client library derives the 154 <screen> field in the request from the specified fbconfig. When the 155 fbconfig is NULL, the GLX_SCREEN attribute and the <screen> field must 156 match, or BadValue is generated. This implies that the client library is 157 responsible for pulling the screen number out of the attribute list, since 158 glXCreateContextAttribsARB does not have an explicit screen parameter. 159 160Issues 161 162 1) Should non-conformant no-config contexts be allowed to be created? 163 164 RESOLVED: No. We are not encouraging non-conformant contexts. This is 165 not a change, in the sense that CreateContextAttribs already does not 166 accept GLX_NON_CONFORMANT_CONFIG as an attribute. 167 168 What is required is: a no-context config bound to a drawable whose 169 config is conformant, or to no drawable, must be conformant. 170 171 2) Are no-config contexts constrained to those GL & ES implementations 172 which can support them? 173 174 RESOLVED: Yes. ES2 + OES_surfaceless_context, ES 3.0, and GL 3.0 all 175 support binding a context without a drawable. This implies that they 176 don't need to know drawable attributes at context creation time. 177 178 In principle, equivalent functionality could be possible with ES 1.x + 179 OES_surfaceless_context. This extension makes no promises about that. An 180 implementation wishing to reliably support this combination, or a similarly 181 permissive combination for GL < 3.0, should indicate so with an additional 182 GLX extension. 183 184 3) For an OpenGL or OpenGL ES context created with no config, what is the 185 initial state of GL_DRAW_BUFFER and GL_READ_BUFFER for the default 186 framebuffer? 187 188 RESOLVED: This is an implementation detail rather than a spec issue. 189 glReadBuffer/glDrawBuffer have undefined results if called without a 190 current context. The GL_DRAW_BUFFER and GL_READ_BUFFER are set on the 191 first glXMakeCurrent call and can be updated in glReadBuffer and 192 glDrawBuffers calls after that. Therefore, the attribute value with 193 which the context is created is irrelevant from the point of view of the 194 spec and is left up to the implementation. 195 196 4) Can glXMakeCurrent alter the GL_DRAW_BUFFER and GL_READ_BUFFER state of 197 the default framebuffer? 198 199 RESOLVED: Yes, but only on the first call to glXMakeCurrent. The two 200 relevant excerpts from the OpenGL 3.2 Core Profile Specification. 201 From Section 4.2.1 Selecting a Buffer for Writing: 202 203 For the default framebuffer, in the initial state the draw buffer 204 for fragment color zero is BACK if there is a back buffer; FRONT if 205 there is no back buffer; and NONE if no default framebuffer is 206 associated with the context. 207 208 From 4.3.3 Pixel Draw/Read State: 209 210 For the default framebuffer, in the initial state the read buffer is 211 BACK if there is a back buffer; FRONT if there is no back buffer; 212 and NONE if no default framebuffer is associated with the context. 213 214 Based on the above excerpts on the first call to glXMakeCurrent the 215 GL_DRAW_BUFFER and GL_READ_BUFFER are set to: GL_NONE if the drawable is 216 NULL, GL_BACK if the drawable is double buffered, GL_FRONT if the drawable 217 is single buffered. Following calls to glReadBuffer and glDrawBuffers 218 change the GL_DRAW_BUFFER and GL_READ_BUFFER attributes and these values 219 persist even when the application change the current context. 220 221 5) Should we add a glXCreateGenericContext which is the same as 222 glXCreateContext but without the config parameter? 223 224 RESOLVED: No. 225 226 6) Can no-config contexts share state with contexts that have a config? 227 228 RESOLVED: Yes, to the extent that the implementation would allow such 229 sharing if the contexts had the same config and compatible attributes. 230 231 GLX_ARB_create_context has this to say about the <share_context> parameter: 232 233 "* If the server context state for <share_context> exists in an address 234 space that cannot be shared with the newly created context, if 235 <share_context> was created on a different screen than the one 236 referenced by <config>, or if the contexts are otherwise incompatible 237 (for example, one context being associated with a hardware device 238 driver and the other with a software renderer), BadMatch is generated." 239 240 For this extension, "otherwise incompatible" might include mismatched GL 241 or ES versions, or versions that do not support making a context current 242 without a drawable. (This list is not intended to be exhaustive.) 243 244 Other extensions like GLX_ARB_create_context_no_error and 245 GLX_ARB_create_context_robustness place additional restrictions on 246 share context compatibility; this extension does not relax them. 247 248 7) What drawable types can be made current with a no-config context? 249 250 RESOLVED: Any drawable created relative to a supported config can be made 251 current with a no-config context. 252 253 8) Can you create a no-config context with glXCreate{,New}Context? 254 255 RESOLVED: No. GLX contexts are per-screen. Although the corresponding 256 requests include the screen number, there is no way to specify it from 257 the function signature, the client library derives it from the visual 258 or the fbconfig. Only glXCreateContextAttribsARB is expressive enough. 259 260 9) Can you specify a no-config context with a specific GLX_RENDER_TYPE? 261 262 RESOLVED: No. It might be possible to implement, but there seems to be 263 little point. 264 265Revision History 266 267 Version 8, 2020/10/05 (Adam Jackson) 268 - Add extension number 269 270 Version 7, 2017/12/05 (Adam Jackson) 271 - Mark complete. 272 273 Version 6, 2017/10/04 (Adam Jackson) 274 - Clarify the float fbconfig extension interaction language 275 276 Version 5, 2017/10/03 (Adam Jackson) 277 - s/GLX_NO_CONFIG_EXT/NULL/ 278 - s/surface/drawable/ 279 - Plain GL 3.0 doesn't fully drop color index, forward-compatible 3.0 does 280 - Clarify the interaction with non-conformant configs 281 - Reword references to "client API", which is an EGLism 282 - Add disclaimers about creating or sharing state with ES1 or GL<3 contexts 283 - Miscellaneous typo fixes 284 285 Version 4, 2017/09/26 (Adam Jackson) 286 - Tighten the GLX protocol to require the two screen numbers to match 287 288 Version 3, 2017/09/21 (Adam Jackson) 289 - Restrict no-config contexts to glXCreateContextAttribsARB 290 - Add the GLX_VISUAL_ID_EXT case to glXQueryContext 291 - Forbid no-config contexts with a specific render type 292 - Get the screen from the attribute list not the <screen> request field 293 294 Version 2, 2017/09/21 (Adam Jackson) 295 - Add the GLX_FBCONFIG_ID case to glXQueryContext 296 - Document the GLX protocol encoding 297 298 Version 1, 2017/09/20 (Adam Jackson) 299 - Clone from version 9 of EGL_KHR_no_config_context 300