framework/replay: disable AA accounting when comparing with no tolerance
[piglit.git] / tests / spec / arb_viewport_array / minmax.c
blob3a1ee3957e750dc0436ba2f7987a0af4076032d9
1 /*
2 * Copyright © 2013 LunarG, Inc.
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 * Author: Jon Ashburn <jon@lunarg.com>
26 /** @file minmax.c
28 * Test for the minimum maximum values listed in section 23 "State Tables"
29 * (23.54) of the GL Core profile 4.3 spec relating to ARB_viewport_array.
30 * Tested GLenums are GL_MAX_VIEWPORT_DIMS, GL_MAX_VIEWPORTS,
31 * GL_VIEWPORT_SUBPIXEL_BITS, GL_VIEWPORT_BOUNDS_RANGE,
32 * GL_LAYER_PROVOKING_VERTEX, GL_VIEWPORT_INDEX_PROVOKING_VERTEX.
35 #include "piglit-util-gl.h"
36 #include "minmax-test.h"
38 PIGLIT_GL_TEST_CONFIG_BEGIN
40 config.supports_gl_core_version = 32;
41 config.supports_gl_compat_version = 32;
42 config.supports_gl_es_version = 31;
44 config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
45 config.khr_no_error_support = PIGLIT_NO_ERRORS;
47 PIGLIT_GL_TEST_CONFIG_END
49 enum piglit_result
50 piglit_display(void)
52 /* UNREACHED */
53 return PIGLIT_FAIL;
56 void
57 piglit_init(int argc, char **argv)
59 GLint layer, index;
61 #ifdef PIGLIT_USE_OPENGL
62 piglit_require_extension("GL_ARB_viewport_array");
63 #else
64 piglit_require_extension("GL_OES_viewport_array");
65 #endif
66 piglit_print_minmax_header();
68 piglit_test_min_viewport_dimensions(); /* GL_MAX_VIEWPORT_DIMS */
69 piglit_test_min_int(GL_MAX_VIEWPORTS, 16);
70 piglit_test_min_int(GL_VIEWPORT_SUBPIXEL_BITS, 0);
72 /* ARB_viewport_array extension spec says:
73 * "NOTE 2: range for viewport bounds:
74 * On GL3-capable hardware the VIEWPORT_BOUNDS_RANGE should be at
75 * least [-16384, 16383].
76 * On GL4-capable hardware the VIEWPORT_BOUNDS_RANGE should be at
77 * least [-32768, 32767]."
79 * OES_viewport_array requires the larger range.
81 /* Since no known way to determine GL3 versus GL4 capable hardware use
82 GL version instead */
83 #ifdef PIGLIT_USE_OPENGL
84 if (piglit_get_gl_version() < 40)
85 piglit_test_range_float(GL_VIEWPORT_BOUNDS_RANGE, -16384, 16383);
86 else
87 #endif
88 piglit_test_range_float(GL_VIEWPORT_BOUNDS_RANGE, -32768, 32767);
90 /**
91 * ARB_viewport_array extension spec says regarding PROVOKING_VERTEX:
92 * "NOTE 3: Valid values are: FIRST_VERTEX_CONVENTION,
93 * LAST_VERTEX_CONVENTION, PROVOKING_VERTEX, UNDEFINED_VERTEX."
95 glGetIntegerv(GL_LAYER_PROVOKING_VERTEX, &layer);
96 piglit_minmax_pass = piglit_check_gl_error(GL_NO_ERROR)
97 && piglit_minmax_pass;
99 switch (layer) {
100 case GL_FIRST_VERTEX_CONVENTION:
101 case GL_LAST_VERTEX_CONVENTION:
102 case GL_PROVOKING_VERTEX:
103 case GL_UNDEFINED_VERTEX:
104 printf("%s %s\n",
105 piglit_get_gl_enum_name(GL_LAYER_PROVOKING_VERTEX),
106 piglit_get_gl_enum_name(layer));
107 break;
108 default:
109 piglit_minmax_pass = false;
110 printf("Invalid value for GL_LAYER_PROVOKING_VERTEX\n");
111 break;
114 glGetIntegerv(GL_VIEWPORT_INDEX_PROVOKING_VERTEX, &index);
115 piglit_minmax_pass = piglit_check_gl_error(GL_NO_ERROR)
116 && piglit_minmax_pass;
118 switch (index) {
119 case GL_FIRST_VERTEX_CONVENTION:
120 case GL_LAST_VERTEX_CONVENTION:
121 case GL_PROVOKING_VERTEX:
122 case GL_UNDEFINED_VERTEX:
123 printf("%s %s\n",
124 piglit_get_gl_enum_name(GL_VIEWPORT_INDEX_PROVOKING_VERTEX),
125 piglit_get_gl_enum_name(index));
126 break;
127 default:
128 piglit_minmax_pass = false;
129 printf("Invalid value for GL_VIEWPORT_INDEX_PROVOKING_VERTEX\n");
130 break;
133 piglit_report_result(piglit_minmax_pass ? PIGLIT_PASS : PIGLIT_FAIL);