glsl-1.10: test mesa bug with forward declaration
[piglit.git] / tests / glx / glx-dont-care-mask.c
blob642dc9cbc3febc675d57899f745f0e22114f949e
1 /*
2 * Copyright © 2012 Intel Corporation
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.
24 /**
25 * \file glx-dont-care-mask.c
26 * Verify that GLX_DONT_CARE can be used with bitmask attributes
28 * Page 17 (page 23 of the PDF) of the GLX 1.4 spec says:
30 * "If GLX_DONT_CARE is specified as an attribute value, then the
31 * attribute will not be checked. GLX_DONT_CARE may be specified
32 * for all attributes except GLX_LEVEL."
34 * This test verifies that \c GLX_DONT_CARE can be supplied for
35 * \c GLX_RENDER_TYPE and \c GLX_DRAWABLE_TYPE.
37 * \sa https://bugs.freedesktop.org/show_bug.cgi?id=47478
40 #include "piglit-util-gl.h"
41 #include "piglit-glx-util.h"
43 int piglit_width = 10;
44 int piglit_height = 10;
46 static PFNGLXCHOOSEFBCONFIGPROC ChooseFBConfig = NULL;
48 int
49 main(int argc, char **argv)
51 Display *dpy;
52 int result = PIGLIT_PASS;
53 GLXFBConfig *configs;
54 int num_configs;
55 static const int attrib_list[] = {
56 GLX_DRAWABLE_TYPE, GLX_DONT_CARE,
57 GLX_RENDER_TYPE, GLX_DONT_CARE,
58 None
61 dpy = XOpenDisplay(NULL);
62 if (dpy == NULL) {
63 fprintf(stderr, "couldn't open display\n");
64 piglit_report_result(PIGLIT_FAIL);
67 /* Test requires at least GLX version 1.3. Otherwise there is no
68 * glXChooseFBConfig function.
70 piglit_require_glx_version(dpy, 1, 3);
71 piglit_require_glx_extension(dpy, "GLX_ARB_get_proc_address");
73 ChooseFBConfig = (PFNGLXCHOOSEFBCONFIGPROC)
74 glXGetProcAddressARB((GLubyte *) "glXChooseFBConfig");
76 configs = ChooseFBConfig(dpy, DefaultScreen(dpy), attrib_list,
77 &num_configs);
79 result = (num_configs > 0 && configs != NULL)
80 ? PIGLIT_PASS : PIGLIT_FAIL;
82 XFree(configs);
84 piglit_report_result(result);
85 return 0;