fix the spelling in whole piglit
[piglit.git] / tests / spec / ext_transform_feedback / discard-drawarrays.c
blobf32807b7206134c7d800d3a232416306a27b30c7
1 /*
2 * Copyright © 2011 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 #include "piglit-util-gl.h"
26 /**
27 * @file discard-drawarrays.c
29 * Tests that GL_RASTERIZER_DISCARD appropriately affects a basic
30 * glDrawArrays().
32 * From the EXT_transform_feedback spec:
34 * "Primitives can be optionally discarded before rasterization by
35 * calling Enable and Disable with RASTERIZER_DISCARD_EXT. When
36 * enabled, primitives are discarded right before the
37 * rasterization stage, but after the optional transform feedback
38 * stage. When disabled, primitives are passed through to the
39 * rasterization stage to be processed
40 * normally. RASTERIZER_DISCARD_EXT applies to the DrawPixels,
41 * CopyPixels, Bitmap, Clear and Accum commands as well."
44 PIGLIT_GL_TEST_CONFIG_BEGIN
46 config.supports_gl_compat_version = 10;
48 config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
49 config.khr_no_error_support = PIGLIT_NO_ERRORS;
51 PIGLIT_GL_TEST_CONFIG_END
53 enum piglit_result
54 piglit_display(void)
56 bool pass = true;
57 float green[4] = {0.0, 1.0, 0.0, 0.0};
58 float vertex_data[] = {
59 -0.5, -0.5,
60 0.5, -0.5,
61 0.0, 0.5,
62 0.0, 0.0
65 glDisable(GL_RASTERIZER_DISCARD);
66 glColor4f(0.0, 1.0, 0.0, 0.0);
67 piglit_draw_rect(-1, -1, 2, 2);
69 glEnable(GL_RASTERIZER_DISCARD);
70 glColor4f(1.0, 0.0, 0.0, 0.0);
71 piglit_draw_rect(-1, -1, 2, 2);
72 glVertexPointer(2, GL_FLOAT, 0, vertex_data);
73 glEnableClientState(GL_VERTEX_ARRAY);
74 glDrawArrays(GL_LINE_LOOP, 0, 3);
75 glDrawArrays(GL_POINTS, 3, 1);
77 pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green);
79 piglit_present_results();
81 return pass ? PIGLIT_PASS : PIGLIT_FAIL;
84 void
85 piglit_init(int argc, char **argv)
87 piglit_require_transform_feedback();