conversion-explicit: use a different value for normalized +/- min
[piglit.git] / tests / spec / gl-2.0 / edgeflag-immediate.c
blob649dbc476a84d5cb69f277c2982461a0b0f66b92
1 /* Copyright © 2012, 2014 Intel Corporation
3 * Permission is hereby granted, free of charge, to any person obtaining a
4 * copy of this software and associated documentation files (the "Software"),
5 * to deal in the Software without restriction, including without limitation
6 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 * and/or sell copies of the Software, and to permit persons to whom the
8 * Software is furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice (including the next
11 * paragraph) shall be included in all copies or substantial portions of the
12 * Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 * IN THE SOFTWARE.
23 /** @file edgeflag-immediate.c
25 * Test for glEdgeFlag() API working with a GLSL program enabled.
28 #include "piglit-util-gl.h"
30 PIGLIT_GL_TEST_CONFIG_BEGIN
32 config.supports_gl_compat_version = 10;
34 config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
36 config.khr_no_error_support = PIGLIT_NO_ERRORS;
38 PIGLIT_GL_TEST_CONFIG_END
40 static GLuint color_index;
42 enum piglit_result
43 piglit_display(void)
45 bool pass = true;
46 float green[] = {0, 1, 0, 0};
47 float clear[] = {0.5, 0.5, 0.5, 0.5};
49 piglit_ortho_projection(piglit_width, piglit_height, false);
51 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
53 glClearColor(0.5, 0.5, 0.5, 0.5);
54 glClear(GL_COLOR_BUFFER_BIT);
56 glVertexAttrib4f(color_index, 0, 1, 0, 0);
58 glBegin(GL_POLYGON);
59 glEdgeFlag(GL_TRUE);
60 glVertex2f(1.5, 1.5);
61 glEdgeFlag(GL_FALSE);
62 glVertex2f(5.5, 1.5);
63 glEdgeFlag(GL_TRUE);
64 glVertex2f(5.5, 5.5);
65 glEdgeFlag(GL_FALSE);
66 glVertex2f(1.5, 5.5);
67 glEnd();
69 pass = piglit_probe_pixel_rgba(3, 1, green) && pass;
70 pass = piglit_probe_pixel_rgba(3, 5, green) && pass;
71 pass = piglit_probe_pixel_rgba(1, 3, clear) && pass;
72 pass = piglit_probe_pixel_rgba(5, 3, clear) && pass;
74 piglit_present_results();
76 return pass ? PIGLIT_PASS : PIGLIT_FAIL;
79 const char *vs_source =
80 "attribute vec4 in_color;\n"
81 "varying vec4 color;\n"
82 "\n"
83 "void main()\n"
84 "{\n"
85 " gl_Position = ftransform();\n"
86 " color = in_color;\n"
87 "}\n";
89 const char *fs_source =
90 "varying vec4 color;\n"
91 "\n"
92 "void main()\n"
93 "{\n"
94 " gl_FragColor = color;\n"
95 "}\n";
97 void
98 piglit_init(int argc, char **argv)
100 GLuint prog;
102 prog = piglit_build_simple_program(vs_source, fs_source);
103 glUseProgram(prog);
104 color_index = glGetAttribLocation(prog, "in_color");