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
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
23 * Author: Jon Ashburn <jon@lunarg.com>
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
57 piglit_init(int argc
, char **argv
)
61 #ifdef PIGLIT_USE_OPENGL
62 piglit_require_extension("GL_ARB_viewport_array");
64 piglit_require_extension("GL_OES_viewport_array");
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
83 #ifdef PIGLIT_USE_OPENGL
84 if (piglit_get_gl_version() < 40)
85 piglit_test_range_float(GL_VIEWPORT_BOUNDS_RANGE
, -16384, 16383);
88 piglit_test_range_float(GL_VIEWPORT_BOUNDS_RANGE
, -32768, 32767);
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
;
100 case GL_FIRST_VERTEX_CONVENTION
:
101 case GL_LAST_VERTEX_CONVENTION
:
102 case GL_PROVOKING_VERTEX
:
103 case GL_UNDEFINED_VERTEX
:
105 piglit_get_gl_enum_name(GL_LAYER_PROVOKING_VERTEX
),
106 piglit_get_gl_enum_name(layer
));
109 piglit_minmax_pass
= false;
110 printf("Invalid value for GL_LAYER_PROVOKING_VERTEX\n");
114 glGetIntegerv(GL_VIEWPORT_INDEX_PROVOKING_VERTEX
, &index
);
115 piglit_minmax_pass
= piglit_check_gl_error(GL_NO_ERROR
)
116 && piglit_minmax_pass
;
119 case GL_FIRST_VERTEX_CONVENTION
:
120 case GL_LAST_VERTEX_CONVENTION
:
121 case GL_PROVOKING_VERTEX
:
122 case GL_UNDEFINED_VERTEX
:
124 piglit_get_gl_enum_name(GL_VIEWPORT_INDEX_PROVOKING_VERTEX
),
125 piglit_get_gl_enum_name(index
));
128 piglit_minmax_pass
= false;
129 printf("Invalid value for GL_VIEWPORT_INDEX_PROVOKING_VERTEX\n");
133 piglit_report_result(piglit_minmax_pass
? PIGLIT_PASS
: PIGLIT_FAIL
);