ext_gpu_shader4: add compiler tests for everything
[piglit.git] / tests / spec / arb_depth_clamp / depth-clamp-status.c
blob6a0d7d46a827adea6c3c69b47b99c1ce95d32ba1
1 /**
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
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 /**
25 * Test that GL_DEPTH_CLAMP is a valid state
27 * Table 6.8 (Transformation state) of OpenGL 3.2 Core added DEPTH_CLAMP
31 #include "piglit-util-gl.h"
33 PIGLIT_GL_TEST_CONFIG_BEGIN
35 config.supports_gl_compat_version = 32;
36 config.supports_gl_core_version = 32;
38 PIGLIT_GL_TEST_CONFIG_END
40 void
41 piglit_init(int argc, char **argv)
43 bool pass = true;
44 GLint i;
45 GLfloat f;
46 GLboolean b;
47 GLdouble d;
49 /* Check that GL_DEPTH_CLAMP was initialized to TRUE */
50 if (glIsEnabled(GL_DEPTH_CLAMP)) {
51 printf("GL_DEPTH_CLAMP was not initialized to FALSE\n");
52 pass = false;
54 pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
56 /* Test that GL_DEPTH_CLAMP is enable/disabled correctly */
57 glEnable(GL_DEPTH_CLAMP);
58 if (!glIsEnabled(GL_DEPTH_CLAMP)) {
59 printf("GL_DEPTH_CLAMP was not enabled properly\n");
60 pass = false;
62 pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
64 glDisable(GL_DEPTH_CLAMP);
65 if (glIsEnabled(GL_DEPTH_CLAMP)) {
66 printf("GL_DEPTH_CLAMP was not disabled properly\n");
67 pass = false;
69 pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
71 /* Test that GL_DEPTH_CLAMP disabled is returned from glGet calls */
72 glGetIntegerv(GL_DEPTH_CLAMP, &i);
73 if(i != 0) {
74 printf("i expected to be 0, but returned %d\n", i);
75 pass = false;
77 pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
78 glGetFloatv(GL_DEPTH_CLAMP, &f);
79 if(f != 0.0f) {
80 printf("f expected to be 0.0, but returned %f\n", f);
81 pass = false;
83 pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
84 glGetBooleanv(GL_DEPTH_CLAMP, &b);
85 if(b != GL_FALSE) {
86 printf("b expected to be 0, but returned %d\n", (int)b);
87 pass = false;
89 pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
90 glGetDoublev(GL_DEPTH_CLAMP, &d);
91 if(d != 0.0) {
92 printf("d expected to be 0.0, but returned %f\n", d);
93 pass = false;
95 pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
97 /* Test that GL_DEPTH_CLAMP enabled is returned from glGet calls */
98 glEnable(GL_DEPTH_CLAMP);
100 glGetIntegerv(GL_DEPTH_CLAMP, &i);
101 if(i != 1) {
102 printf("i expected to be 1, but returned %d\n", i);
103 pass = false;
105 pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
106 glGetFloatv(GL_DEPTH_CLAMP, &f);
107 if(f != 1.0f) {
108 printf("f expected to be 1.0, but returned %f\n", f);
109 pass = false;
111 pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
112 glGetBooleanv(GL_DEPTH_CLAMP, &b);
113 if(b != GL_TRUE) {
114 printf("b expected to be 1, but returned %d\n", (int)b);
115 pass = false;
117 pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
118 glGetDoublev(GL_DEPTH_CLAMP, &d);
119 if(d != 1.0) {
120 printf("d expected to be 1.0, but returned %f\n", d);
121 pass = false;
123 pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
125 piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
128 enum piglit_result
129 piglit_display(void)
131 return PIGLIT_FAIL;