| 2396 | // of the context and the off-screen drawable |
| 2397 | |
| 2398 | int contextMismatchTest(void) |
| 2399 | { |
| 2400 | Display *dpy = NULL; Window win = 0; |
| 2401 | int dpyw, dpyh, retval = 1; |
| 2402 | int glxattribs1[] = { GLX_DOUBLEBUFFER, 1, GLX_RENDER_TYPE, GLX_RGBA_BIT, |
| 2403 | GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT | GLX_PBUFFER_BIT | GLX_WINDOW_BIT, |
| 2404 | GLX_RED_SIZE, 8, GLX_GREEN_SIZE, 8, GLX_BLUE_SIZE, 8, None }; |
| 2405 | int glxattribs2[] = { GLX_DOUBLEBUFFER, 0, GLX_RENDER_TYPE, GLX_RGBA_BIT, |
| 2406 | GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT | GLX_PBUFFER_BIT | GLX_WINDOW_BIT, |
| 2407 | GLX_RED_SIZE, 8, GLX_GREEN_SIZE, 8, GLX_BLUE_SIZE, 8, GLX_ALPHA_SIZE, 8, |
| 2408 | None }; |
| 2409 | XVisualInfo *vis = NULL; |
| 2410 | GLXFBConfig config1 = 0, config2 = 0, *configs = NULL; int n = 0; |
| 2411 | GLXContext ctx1 = 0, ctx2 = 0; |
| 2412 | XSetWindowAttributes swa; |
| 2413 | |
| 2414 | printf("Context FB config mismatch test:\n\n"); |
| 2415 | |
| 2416 | try |
| 2417 | { |
| 2418 | if(!(dpy = XOpenDisplay(0))) THROW("Could not open display"); |
| 2419 | dpyw = DisplayWidth(dpy, DefaultScreen(dpy)); |
| 2420 | dpyh = DisplayHeight(dpy, DefaultScreen(dpy)); |
| 2421 | if(DefaultDepth(dpy, DefaultScreen(dpy)) == 30) |
| 2422 | { |
| 2423 | glxattribs1[7] = glxattribs1[9] = glxattribs1[11] = 10; |
| 2424 | glxattribs2[7] = glxattribs2[9] = glxattribs2[11] = 10; |
| 2425 | glxattribs2[13] = 2; |
| 2426 | } |
| 2427 | |
| 2428 | if((configs = glXChooseFBConfig(dpy, DefaultScreen(dpy), glxattribs1, |
| 2429 | &n)) == NULL || n == 0) |
| 2430 | THROW("Could not find a suitable FB config"); |
| 2431 | config1 = configs[0]; |
| 2432 | if(!(vis = glXGetVisualFromFBConfig(dpy, config1))) |
| 2433 | THROW("glXGetVisualFromFBConfig()"); |
| 2434 | XFree(configs); configs = NULL; |
| 2435 | |
| 2436 | if((configs = glXChooseFBConfig(dpy, DefaultScreen(dpy), glxattribs2, |
| 2437 | &n)) == NULL || n == 0) |
| 2438 | THROW("Could not find a suitable FB config"); |
| 2439 | config2 = configs[0]; |
| 2440 | XFree(configs); configs = NULL; |
| 2441 | |
| 2442 | Window root = RootWindow(dpy, DefaultScreen(dpy)); |
| 2443 | swa.colormap = XCreateColormap(dpy, root, vis->visual, AllocNone); |
| 2444 | swa.border_pixel = 0; |
| 2445 | swa.background_pixel = 0; |
| 2446 | swa.event_mask = 0; |
| 2447 | if((win = XCreateWindow(dpy, root, 0, 0, dpyw / 2, dpyh / 2, 0, vis->depth, |
| 2448 | InputOutput, vis->visual, CWBorderPixel | CWColormap | CWEventMask, |
| 2449 | &swa)) == 0) |
| 2450 | THROW("Could not create window"); |
| 2451 | XMapWindow(dpy, win); |
| 2452 | |
| 2453 | try |
| 2454 | { |
| 2455 | int major, minor, mask, flags; |
no test coverage detected