2 * Copyright © 2013 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
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
25 * Test that Clear() clears no buffers when passed 0
27 * Section 4.2.3(Clearing the Buffers) of OpenGL 3.2 Core says:
28 * "The value to which each buffer is cleared depends on the setting of the
29 * clear value for that buffer. If buf is zero, no buffers are cleared."
33 #include "piglit-util-gl.h"
35 PIGLIT_GL_TEST_CONFIG_BEGIN
37 config
.supports_gl_compat_version
= 32;
38 config
.supports_gl_core_version
= 32;
40 config
.window_visual
= PIGLIT_GL_VISUAL_RGB
|
41 PIGLIT_GL_VISUAL_DOUBLE
|
42 PIGLIT_GL_VISUAL_DEPTH
|
43 PIGLIT_GL_VISUAL_STENCIL
;
44 config
.khr_no_error_support
= PIGLIT_NO_ERRORS
;
46 PIGLIT_GL_TEST_CONFIG_END
49 piglit_init(int argc
, char **argv
)
57 float green
[] = {0, 1, 0};
59 glEnable(GL_DEPTH_TEST
);
61 /* Set first base values to the buffers */
62 glClearColor(0.0, 1.0, 0.0, 1.0);
65 glClear(GL_COLOR_BUFFER_BIT
|
67 GL_STENCIL_BUFFER_BIT
);
69 /* Set a second value to the buffers */
70 glClearColor(1.0, 0.0, 0.0, 1.0);
75 pass
= piglit_check_gl_error(GL_NO_ERROR
) && pass
;
77 /* if probe returns the first value, glClear(0) didn't clear values */
78 pass
= piglit_probe_rect_rgb(0, 0, piglit_width
, piglit_height
, green
)
80 pass
= piglit_probe_rect_depth(0, 0, piglit_width
, piglit_height
, .8)
82 pass
= piglit_probe_rect_stencil(0, 0, piglit_width
, piglit_height
, 1)
85 piglit_present_results();
87 return pass
? PIGLIT_PASS
: PIGLIT_FAIL
;