2 * Copyright © 2010 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
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
24 * Eric Anholt <eric@anholt.net>
29 * @file quad-invariance.c
31 * Test whether quad rasterization changes when drawing one or more
34 * This is not strictly required by conformance, but seems to be in
35 * the spirit of the invariance rules. As a result, failure of this
36 * test is only a warning.
39 #include "piglit-util-gl.h"
41 PIGLIT_GL_TEST_CONFIG_BEGIN
43 config
.supports_gl_compat_version
= 10;
45 config
.window_visual
= PIGLIT_GL_VISUAL_RGB
| PIGLIT_GL_VISUAL_DOUBLE
;
46 config
.khr_no_error_support
= PIGLIT_NO_ERRORS
;
48 PIGLIT_GL_TEST_CONFIG_END
53 GLboolean pass
= GL_TRUE
;
54 float verts
[12][2] = {
55 /* prim 1: left half of screen. */
60 /* prim 2: right half of screen. */
65 /* prim 3: somewhere off the screen. */
71 float colors
[12][4] = {
87 static GLboolean once
= GL_TRUE
;
89 glClearColor(0.0, 0.0, 0.0, 0.0);
90 glClear(GL_COLOR_BUFFER_BIT
);
92 glColorPointer(4, GL_FLOAT
, 0, colors
);
93 glEnableClientState(GL_COLOR_ARRAY
);
94 glVertexPointer(2, GL_FLOAT
, 0, verts
);
95 glEnableClientState(GL_VERTEX_ARRAY
);
98 glDrawArrays(GL_QUADS
, 0, 4);
101 glDrawArrays(GL_QUADS
, 4, 8);
104 printf("Left and right half should match.\n");
108 pass
= piglit_probe_rect_halves_equal_rgba(0, 0, piglit_width
,
111 piglit_present_results();
113 return pass
? PIGLIT_PASS
: PIGLIT_WARN
;
117 piglit_init(int argc
, char *argv
[])