glx: don't fail test if the X server is inconsistent
[piglit.git] / tests / general / triangle-guardband-viewport.c
blob9e99254f9d0c55e6a68d99ddcb7b1ab73589e04c
1 /* Copyright 2012 Google Inc.
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
17 * Authors:
18 * Stuart Abercrombie <sabercrombie@google.com>
21 /** @file triangle-guardband-vewport.c
23 * Tests whether clipping of triangles to the clip volume
24 * is reflected in what is rasterized. Specifically,
25 * triangles (unlike some other primitives) should not be
26 * rasterized outside the viewport extents because they should
27 * have been clipped to the clip volume mapping to the viewport.
29 * Faulty guard-band clipping optimizations have been known to
30 * not honor this requirement.
33 #include "piglit-util-gl.h"
35 PIGLIT_GL_TEST_CONFIG_BEGIN
37 config.supports_gl_compat_version = 10;
39 config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB;
41 PIGLIT_GL_TEST_CONFIG_END
43 enum piglit_result
44 piglit_display(void)
46 bool pass = true;
47 static float green[] = {0.0, 1.0, 0.0, 0.0};
48 static float blue[] = {0.0, 0.0, 1.0, 0.0};
50 /* make the whole window green. */
51 glClearColor(0.0, 1.0, 0.0, 0.0);
52 glClear(GL_COLOR_BUFFER_BIT);
54 /* set viewport to the left half of the window */
55 glViewport(0, 0, piglit_width / 2, piglit_height);
57 /* draw blue rect extending beyond the right edge of the
58 * frustrum, notionally across the whole window
60 glColor4fv(blue);
61 piglit_draw_rect(-1.0, -1.0, 4.0, 2.0);
63 /* check that the right half of the window, outside
64 * the viewport, still has the clear color
66 pass = piglit_probe_rect_rgb(piglit_width/2, 0,
67 piglit_width/2, piglit_height,
68 green);
70 piglit_present_results();
72 return pass ? PIGLIT_PASS : PIGLIT_FAIL;
75 void
76 piglit_init(int argc, char **argv)