cl: Don't use device_infos if num_device_infos == 0
[piglit.git] / tests / general / dlist-fdo3129-02.c
blobe905f68193739a79f2ea2339125c3c89a565f1b1
1 /*
2 * Copyright © 2009 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 dlist-fdo3129-02.c
26 * Test odd combinations of command in a display list.
28 * This test is based on a test case posted to fdo bug #3129 by Nicolai Hähnle.
29 * Once upon a time, this triggered an assertion failure in Mesa.
31 #include "piglit-util-gl.h"
33 PIGLIT_GL_TEST_CONFIG_BEGIN
35 config.supports_gl_compat_version = 10;
37 config.window_width = 256;
38 config.window_height = 256;
39 config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
41 PIGLIT_GL_TEST_CONFIG_END
43 static GLuint list;
45 enum piglit_result
46 piglit_display(void)
48 enum piglit_result result = PIGLIT_PASS;
49 static const GLfloat color[4] = { 1.0, 1.0, 1.0, 1.0 };
51 glClear (GL_COLOR_BUFFER_BIT);
53 /* Set some values outside the list.
55 glColor3fv(color);
58 /* Compile a list. Start with two-component vertices, then, after the
59 * first primitive is complete, use a three-component vertex.
60 * in the list.
62 glNewList(list, GL_COMPILE);
64 glBegin(GL_TRIANGLE_STRIP);
65 glVertex2f(piglit_width / 4, piglit_height / 4);
66 glVertex2f((piglit_width * 3) / 4, piglit_height / 4);
67 glVertex2f((piglit_width * 3) / 4, (piglit_height * 3) / 4);
68 glVertex3f(piglit_width / 4, (piglit_height * 3) / 4, 0.1);
69 glEnd();
71 glEndList();
73 glCallList(list);
75 if (!piglit_probe_pixel_rgb(piglit_width / 2,
76 piglit_height / 2,
77 color)) {
78 result = PIGLIT_FAIL;
81 piglit_present_results();
83 return result;
87 void
88 piglit_init(int argc, char **argv)
90 (void) argc;
91 (void) argv;
93 piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
94 list = glGenLists(1);