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
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
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
;
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);
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"
85 " gl_Position = ftransform();\n"
86 " color = in_color;\n"
89 const char *fs_source
=
90 "varying vec4 color;\n"
94 " gl_FragColor = color;\n"
98 piglit_init(int argc
, char **argv
)
102 prog
= piglit_build_simple_program(vs_source
, fs_source
);
104 color_index
= glGetAttribLocation(prog
, "in_color");