glsl-1.10: move algebraic tests to glsl-1.10 dir
[piglit.git] / tests / glx / glx-pixmap-multi.c
blob88a2184e2b8f1b829f08e6c787f85504bdfac7f9
1 /*
2 * Copyright 2011 Red Hat, 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 * Adam Jackson <ajax@redhat.com>
28 /** @file glx-pixmap-multi.c
30 * Nothing in the protocol prohibits you from creating multiple GLXPixmaps
31 * attached to the same X pixmap, so one must assume it's allowed.
34 #include "piglit-util-gl.h"
35 #include "piglit-glx-util.h"
37 int piglit_width = 50, piglit_height = 50;
38 static Display *dpy;
39 static XVisualInfo *visinfo;
41 int pass = 1;
43 static int
44 handler(Display *dpy, XErrorEvent *err)
46 pass = 0;
48 #if 0
49 printf("Error serial %x error %x request %x minor %x xid %x\n",
50 err->serial, err->error_code, err->request_code, err->minor_code,
51 err->resourceid);
52 #endif
54 return 0;
57 int
58 main(int argc, char **argv)
60 Pixmap p;
61 GLXPixmap g1, g2;
62 GLXFBConfig fbc;
64 dpy = XOpenDisplay(NULL);
65 if (dpy == NULL) {
66 fprintf(stderr, "couldn't open display\n");
67 piglit_report_result(PIGLIT_FAIL);
70 visinfo = piglit_get_glx_visual(dpy);
72 XSetErrorHandler(handler);
74 p = XCreatePixmap(dpy, DefaultRootWindow(dpy), piglit_width,
75 piglit_height, visinfo->depth);
76 g1 = glXCreateGLXPixmap(dpy, visinfo, p);
77 g2 = glXCreateGLXPixmap(dpy, visinfo, p);
79 glXDestroyGLXPixmap(dpy, g1);
80 glXDestroyGLXPixmap(dpy, g2);
82 fbc = piglit_glx_get_fbconfig_for_visinfo(dpy, visinfo);
83 g1 = glXCreatePixmap(dpy, fbc, p, NULL);
84 g2 = glXCreatePixmap(dpy, fbc, p, NULL);
85 glXDestroyPixmap(dpy, g1);
86 glXDestroyPixmap(dpy, g2);
88 XFreePixmap(dpy, p);
90 XSync(dpy, 0);
92 piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
94 return 0;