| 295 | // Create a GLX context on the 3D X server suitable for off-screen rendering. |
| 296 | |
| 297 | GLXContext glXCreateContext(Display *dpy, XVisualInfo *vis, |
| 298 | GLXContext share_list, Bool direct) |
| 299 | { |
| 300 | GLXContext ctx = 0; VGLFBConfig config = 0; |
| 301 | |
| 302 | TRY(); |
| 303 | |
| 304 | if(IS_EXCLUDED(dpy)) |
| 305 | return _glXCreateContext(dpy, vis, share_list, direct); |
| 306 | |
| 307 | if(!fconfig.allowindirect) direct = True; |
| 308 | |
| 309 | ///////////////////////////////////////////////////////////////////////////// |
| 310 | OPENTRACE(glXCreateContext); PRARGD(dpy); PRARGV(vis); PRARGX(share_list); |
| 311 | PRARGI(direct); STARTTRACE(); |
| 312 | ///////////////////////////////////////////////////////////////////////////// |
| 313 | |
| 314 | if(!(config = matchConfig(dpy, vis))) |
| 315 | { |
| 316 | faker::sendGLXError(dpy, X_GLXCreateContext, BadValue, true); |
| 317 | goto done; |
| 318 | } |
| 319 | ctx = backend::createContext(dpy, config, share_list, direct, NULL); |
| 320 | if(ctx) |
| 321 | { |
| 322 | int newctxIsDirect = backend::isDirect(ctx); |
| 323 | if(!fconfig.egl && !newctxIsDirect && direct) |
| 324 | { |
| 325 | vglout.println("[VGL] WARNING: The OpenGL rendering context obtained on X display"); |
| 326 | vglout.println("[VGL] %s is indirect, which may cause performance to suffer.", |
| 327 | DisplayString(DPY3D)); |
| 328 | vglout.println("[VGL] If %s is a local X display, then the framebuffer device", |
| 329 | DisplayString(DPY3D)); |
| 330 | vglout.println("[VGL] permissions may be set incorrectly."); |
| 331 | } |
| 332 | // Hash the FB config to the context so we can use it in subsequent calls |
| 333 | // to glXMake[Context]Current(). |
| 334 | CTXHASH.add(ctx, config, newctxIsDirect); |
| 335 | } |
| 336 | |
| 337 | done: |
| 338 | ///////////////////////////////////////////////////////////////////////////// |
| 339 | STOPTRACE(); PRARGC(config); PRARGX(ctx); CLOSETRACE(); |
| 340 | ///////////////////////////////////////////////////////////////////////////// |
| 341 | |
| 342 | CATCH(); |
| 343 | return ctx; |
| 344 | } |
| 345 | |
| 346 | |
| 347 | GLXContext glXCreateContextAttribsARB(Display *dpy, GLXFBConfig config_, |