| 445 | |
| 446 | |
| 447 | static void buildCfgAttribTable(Display *dpy, int screen) |
| 448 | { |
| 449 | int nConfigs = 0; |
| 450 | GLXFBConfig *glxConfigs = NULL; |
| 451 | EGLContext ctx = 0; |
| 452 | struct _VGLFBConfig *ca = NULL; |
| 453 | XEDataObject obj; |
| 454 | XExtData *extData; |
| 455 | obj.screen = XScreenOfDisplay(dpy, screen); |
| 456 | |
| 457 | if(!fconfig.egl && dpy == faker::dpy3D) |
| 458 | THROW("glxvisual::buildCfgAttribTable() called with 3D X server handle (this should never happen)"); |
| 459 | |
| 460 | try |
| 461 | { |
| 462 | CriticalSection::SafeLock l(faker::getDisplayCS(dpy)); |
| 463 | |
| 464 | int minExtensionNumber = |
| 465 | XFindOnExtensionList(XEHeadOfExtensionList(obj), 0) ? 0 : 1; |
| 466 | extData = XFindOnExtensionList(XEHeadOfExtensionList(obj), |
| 467 | minExtensionNumber + 3); |
| 468 | if(extData && extData->private_data) return; |
| 469 | |
| 470 | if(fconfig.egl) |
| 471 | { |
| 472 | int i = 0; |
| 473 | int defaultDepth = DefaultDepth(dpy, screen); |
| 474 | int nbpcs = defaultDepth == 30 ? 2 : 1; |
| 475 | int bpcs[] = { defaultDepth == 30 ? 10 : 8, defaultDepth == 30 ? 8 : 0 }; |
| 476 | int maxSamples = 0, maxPBWidth = 32768, maxPBHeight = 32768, nsamps = 1; |
| 477 | |
| 478 | if(!_eglBindAPI(EGL_OPENGL_API)) |
| 479 | THROW("Could not enable OpenGL API"); |
| 480 | if(!(ctx = _eglCreateContext(EDPY, (EGLConfig)0, NULL, NULL))) |
| 481 | THROW("Could not create temporary EGL context"); |
| 482 | { |
| 483 | backend::TempContextEGL tc(ctx); |
| 484 | |
| 485 | _glGetIntegerv(GL_MAX_SAMPLES, &maxSamples); |
| 486 | if(maxSamples > 0) |
| 487 | { |
| 488 | int temp = maxSamples; |
| 489 | while(temp >>= 1) nsamps++; |
| 490 | } |
| 491 | else maxSamples = 0; |
| 492 | |
| 493 | GLint dims[2] = { -1, -1 }; |
| 494 | _glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims); |
| 495 | if(dims[0] > 0) maxPBWidth = max(dims[0], maxPBWidth); |
| 496 | if(dims[1] > 0) maxPBHeight = max(dims[1], maxPBHeight); |
| 497 | } |
| 498 | _eglDestroyContext(EDPY, ctx); ctx = 0; |
| 499 | |
| 500 | nConfigs = |
| 501 | 2 * // visual classes |
| 502 | 2 * // stereo options |
| 503 | 2 * // alpha channel options |
| 504 | 2 * // double buffering options |
no test coverage detected