cmake: move defaults into the per-platform section
[piglit.git] / tests / shaders / glsl-vs-statechange-1.c
blob9d5875beca71560a37126c676b47618f74aea993
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.
23 * Authors:
24 * Eric Anholt <eric@anholt.net>
28 /** @file glsl-vs-statechange-1.c
30 * Tests for a bug that appeared to exist in Mesa 7.11 where the
31 * constant attribute color from the previous fixed function setup
32 * would be used, but was hidden by multiple state updates occurring
33 * per draw call.
36 #include "piglit-util-gl.h"
38 PIGLIT_GL_TEST_CONFIG_BEGIN
40 config.supports_gl_compat_version = 10;
42 config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
44 PIGLIT_GL_TEST_CONFIG_END
46 const char *vs_source =
47 "void main()\n"
48 "{\n"
49 " gl_Position = gl_Vertex;\n"
50 " gl_FrontColor = vec4(0.0, 0.0, 1.0, 0.0);\n"
51 "}\n";
53 static GLint prog;
55 enum piglit_result
56 piglit_display(void)
58 bool pass = true;
59 float green[4] = {0, 1, 0, 0};
60 float blue[4] = {0, 0, 1, 0};
62 glColor4fv(green);
63 piglit_draw_rect(-1, -1, 1, 2);
65 glUseProgram(prog);
66 piglit_draw_rect(0, -1, 1, 2);
68 glUseProgram(0);
70 pass &= piglit_probe_rect_rgba(0, 0,
71 piglit_width / 2, piglit_height, green);
72 pass &= piglit_probe_rect_rgba(piglit_width / 2, 0,
73 piglit_width / 2, piglit_height, blue);
75 piglit_present_results();
77 return pass ? PIGLIT_PASS : PIGLIT_FAIL;
80 void
81 piglit_init(int argc, char **argv)
83 GLint vs;
85 piglit_require_gl_version(20);
87 vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
89 prog = piglit_link_simple_program(vs, 0);
91 glDeleteShader(vs);