1Name 2 3 EXT_import_context 4 5Name Strings 6 7 GLX_EXT_import_context 8 9Version 10 11 Version 3, May 20, 2015 12 13Number 14 15 47 16 17Dependencies 18 19 This extension affects the definition of SGIX_FBConfig. 20 21Overview 22 23 This extension allows multiple X clients to share an indirect 24 rendering context. 25 26 Additional convenience procedures to get the current Display* 27 bound to a context as well as other context information are 28 also added. 29 30Issues 31 32 Does glXImportGLXContext also need to take an XVisualInfo*? 33 34 No. This information will be retrieved from the server. 35 36New Procedures and Functions 37 38 Display *glXGetCurrentDisplayEXT(); 39 40 int glXQueryContextInfoEXT(Display *dpy, GLXContext context, 41 int attribute,int *value); 42 43 GLXContextID glXGetContextIDEXT(const GLXContext context); 44 45 GLXContext glXImportContextEXT(Display *dpy, GLXContextID contextID); 46 47 void glXFreeContextEXT(Display *dpy, GLXContext context); 48 49New Tokens 50 51 Accepted by the <attribute> parameter of glXQueryContextInfoEXT: 52 53 GLX_SHARE_CONTEXT_EXT 0x800A 54 GLX_VISUAL_ID_EXT 0x800B 55 GLX_SCREEN_EXT 0x800C 56 57Additions to Chapter 2 of the 1.0 Specification (OpenGL Operation) 58 59 None 60 61Additions to Chapter 3 of the 1.0 Specification (Rasterization) 62 63 None 64 65Additions to Chapter 4 of the 1.0 Specification (Per-Fragment Operations 66and the Frame Buffer) 67 68 None 69 70Additions to Chapter 5 of the 1.0 Specification (Special Functions) 71 72 None 73 74Additions to Chapter 6 of the 1.0 Specification (State and State Requests) 75 76 None 77 78Additions to the GLX Specification 79 80 [Add the following to Section 3.2.4 of the GLX Specification 81 (Rendering Contexts)] 82 83 To get the display associated with the current context, use 84 85 Display *glXGetCurrentDisplayEXT(); 86 87 If there is no current context, NULL is returned. No round trip 88 is forced to the server; unlike most X calls that return a value, 89 glXGetCurrentDisplayEXT does not flush any pending events. 90 91 To obtain the value of a context's attribute, use 92 93 int glXQueryContextInfoEXT(Display *dpy, GLXContext context, 94 int attribute, int *value); 95 96 glxQueryContextInfoEXT returns through <value> the value of 97 <attribute> for <context>. It may cause a round trip to the 98 server. 99 100 The values and types corresponding to each GLX context attribute 101 are listed in the table below. 102 103 GLX context attribute type context information 104 --------------------- ---- ------------------- 105 GLX_SHARE_CONTEXT_EXT XID xid of the share list context 106 GLX_VISUAL_ID_EXT XID visual id 107 GLX_SCREEN_EXT int screen number 108 109 glxQueryContextInfoEXT returns GLX_BAD_ATTRIBUTE if <attribute> 110 is not a valid GLX context attribute or GLX_BAD_CONTEXT if <context> 111 is invalid, otherwise it returns Success. 112 113 To obtain the XID of a GLXContext, use 114 115 GLXContextID glXGetContextIDEXT(const GLXContext context); 116 117 No round trip is forced to the server; unlike most X calls that 118 return a value, glXGetContextIDEXT does not flush any pending 119 events. If <context> is NULL, None is returned. If <context> is not 120 NULL and is not a valid GLXContext name, behavior is undefined. 121 122 To create a GLXContext given the XID of an existing GLXContext, use 123 124 GLXContext glXImportContextEXT(Display *dpy, 125 GLXContextID contextID); 126 127 glXImportContextEXT may be used in place of glXCreateContext to 128 share another process's indirect rendering context. 129 130 Only the server-side context information can be shared between 131 X clients; client-side state, such as pixel storage modes, 132 cannot be shared. Thus, glXImportContextEXT, must allocate 133 memory to store client-side information. This memory is freed 134 by calling glXFreeContextEXT. 135 136 This call does not create a new XID. It merely makes an 137 existing object available to the importing client (Display *). 138 Like any XID, it goes away when the creating client drops its 139 connection or the ID is explicitly deleted. Note that this is 140 when the XID goes away. The object goes away when the XID 141 goes away AND the context is not current to any thread. 142 143 If <contextID> does not refer to a valid context, then 144 a BadContext error is generated; if <contextID> refers to 145 direct rendering context then no error is generated but 146 glXImportContextEXT returns NULL. 147 148 To free the client-side part of a GLXContext that was created 149 with glXImportContext, use 150 151 void glXFreeContextEXT(Display *dpy, GLXContext context); 152 153 glXFreeContext does not free the server-side context information 154 or the XID associated with the server-side context. 155 156 [Add the following clarification to glXMakeCurrent] 157 158 Change: 159 If <context> is current to some other thread, then glXMakeCurrent 160 will generate a BadAccess error. 161 162 To: 163 If <context> is current to some other thread or process, then 164 glXMakeCurrent will generate a BadAccess error. 165 166GLX Protocol 167 168 One new GLX protocol command is added. 169 170 QueryContextInfo 171 1 CARD8 opcode (X assigned) 172 1 17 GLX opcode (glXVendorPrivateWithReply) 173 2 4 request length 174 4 1024 vendor specific opcode 175 4 unused corresponds to context tag in header 176 4 GLX_CONTEXT context id 177 => 178 1 1 Reply 179 1 unused 180 2 CARD16 sequence number 181 4 2*n reply length 182 4 CARD32 n 183 20 unused 184 8*n LISTofCARD32 attribute, value pairs 185 186Errors 187 188 None 189 190New State 191 192 None 193 194New Implementation Dependent State 195 196 None 197 198Revision History 199 200 Version 3, 2015/05/20 - Specify behavior of glXGetContextIDEXT when an 201 invalid <context> is passed (Bug 8344). 202 203 Version 2, 2006/08/24 - Fixed opcode for QueryContextInfo per Ian 204 Romanick (opcode is 1024 per glx.spec, which is used to generate 205 glxproto.h - not 15 as has been in the extension spec since 1995). 206 207 Version 1.14, 1995/10/14 - Last update from SGI. 208 209