fix the spelling in whole piglit
[piglit.git] / tests / general / dlist-clear.c
blob4fd45c33de1b223aae5cd7f577599c04915fff0b
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.
23 * Authors:
24 * Eric Anholt <eric@anholt.net>
28 /** @file dlist-clear.c
30 * Tests that clears and primitives get stored properly in a
31 * COMPILE_AND_EXECUTE display list. Caught a regression in the intel driver
32 * with the new metaops clear code.
35 #include "piglit-util-gl.h"
37 PIGLIT_GL_TEST_CONFIG_BEGIN
39 config.supports_gl_compat_version = 10;
41 config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
43 PIGLIT_GL_TEST_CONFIG_END
45 enum piglit_result
46 piglit_display(void)
48 GLboolean pass = GL_TRUE;
49 static float red[] = {1.0, 0.0, 0.0, 0.0};
50 static float green[] = {0.0, 1.0, 0.0, 0.0};
51 static float blue[] = {0.0, 0.0, 1.0, 0.0};
53 piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
55 glClearColor(0.5, 0.0, 0.0, 0.0);
56 glColor4fv(red);
58 /* Make a list containing a clear and a rectangle. It'll draw
59 * colors we don't expect to see, due to COMPILE_AND_EXECUTE.
61 glNewList(1, GL_COMPILE_AND_EXECUTE);
62 /* Even though we don't use depth, GL_DEPTH_BUFFER_BIT is what
63 * triggered the metaops clear path which messed up the display list.
65 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
66 glBegin(GL_QUADS);
67 glVertex2f(10, 10);
68 glVertex2f(20, 10);
69 glVertex2f(20, 20);
70 glVertex2f(10, 20);
71 glEnd();
72 glEndList();
74 /* Now, set up our expected colors, translate the dlist's rectangle
75 * over a little, and do the draw we actually expect to see.
77 glClearColor(0.0, 1.0, 0.0, 0.0);
78 glColor4fv(blue);
80 glMatrixMode(GL_MODELVIEW);
81 glLoadIdentity();
82 glTranslatef(20, 0, 0);
84 glCallList(1);
86 pass &= piglit_probe_rect_rgb(0, 0, piglit_width, 10, green);
88 pass &= piglit_probe_rect_rgb(0, 10, 30, 10, green);
89 pass &= piglit_probe_rect_rgb(30, 10, 10, 10, blue);
90 pass &= piglit_probe_rect_rgb(40, 10, piglit_width-40, 10, green);
92 pass &= piglit_probe_rect_rgb(0, 20, piglit_width, piglit_height - 20,
93 green);
95 piglit_present_results();
97 return pass ? PIGLIT_PASS : PIGLIT_FAIL;
101 void
102 piglit_init(int argc, char **argv)