ext_transform_feedback: document missing mode in usage
[piglit.git] / tests / glx / glx-close-display.c
blob54b73e319e8b0fce17486179b8b1f3e775dd1b34
1 /*
2 * Copyright 2011 VMware, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
23 * Authors:
24 * Jose Fonseca <jfonseca@vmware.com>
29 /** @file glx-closedisplay.c
31 * Test that calling XCloseDisplay after using GLX context works correctly.
34 #include "piglit-util-gl.h"
35 #include "piglit-glx-util.h"
37 /**
38 * Straightforward function to check whether GLX direct rendering is supported
39 * or not.
41 static Bool
42 isDirectRendering(void)
44 Display *dpy;
45 GLXContext ctx;
46 GLXFBConfig *configs;
47 GLXFBConfig config;
48 int attribList[] = {
49 GLX_DRAWABLE_TYPE, GLX_USE_GL,
50 GLX_RENDER_TYPE, GLX_USE_GL,
51 GLX_DOUBLEBUFFER, True,
54 int nitems = 0;
55 Bool result;
57 dpy = XOpenDisplay(NULL);
58 if (dpy == NULL) {
59 fprintf(stderr, "couldn't open display\n");
60 piglit_report_result(PIGLIT_FAIL);
63 configs = glXChooseFBConfig(dpy, 0, attribList, &nitems);
64 if (configs == NULL) {
65 fprintf(stderr, "couldn't find a matching framebuffer configuration\n");
66 piglit_report_result(PIGLIT_FAIL);
68 config = configs[0];
70 ctx = glXCreateNewContext(dpy, config, GLX_RGBA_TYPE, NULL, True);
71 result = glXIsDirect(dpy, ctx);
72 glXDestroyContext(dpy, ctx);
74 XFree(configs);
76 /* This call will cause *_dri.so to be dlclosed and unloaded. */
77 XCloseDisplay(dpy);
79 return result;
82 int
83 main(int argc, char **argv)
85 isDirectRendering();
87 /* Run a second to exercise reloading the *_dri.so driver. */
88 isDirectRendering();
90 piglit_report_result(PIGLIT_PASS);
92 return 0;