2 * Copyright 2020 Ilia Mirkin
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
21 * DEALINGS IN THE SOFTWARE.
23 #include "piglit-util-gl.h"
25 PIGLIT_GL_TEST_CONFIG_BEGIN
27 config
.supports_gl_compat_version
= 11;
28 config
.supports_gl_es_version
= 31;
30 config
.window_visual
= PIGLIT_GL_VISUAL_RGB
| PIGLIT_GL_VISUAL_DOUBLE
;
31 config
.khr_no_error_support
= PIGLIT_HAS_ERRORS
;
33 PIGLIT_GL_TEST_CONFIG_END
42 piglit_init(int argc
, char **argv
)
45 GLint swizzle_x
, swizzle_y
, swizzle_z
, swizzle_w
;
47 piglit_require_extension("GL_NV_viewport_swizzle");
49 glGetIntegerv(GL_MAX_VIEWPORTS
, &max_viewports
);
50 glGetIntegeri_v(GL_VIEWPORT_SWIZZLE_X_NV
, 0, &swizzle_x
);
51 glGetIntegeri_v(GL_VIEWPORT_SWIZZLE_Y_NV
, 0, &swizzle_y
);
52 glGetIntegeri_v(GL_VIEWPORT_SWIZZLE_Z_NV
, 0, &swizzle_z
);
53 glGetIntegeri_v(GL_VIEWPORT_SWIZZLE_W_NV
, 0, &swizzle_w
);
55 if (swizzle_x
!= GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV
||
56 swizzle_y
!= GL_VIEWPORT_SWIZZLE_POSITIVE_Y_NV
||
57 swizzle_z
!= GL_VIEWPORT_SWIZZLE_POSITIVE_Z_NV
||
58 swizzle_w
!= GL_VIEWPORT_SWIZZLE_POSITIVE_W_NV
) {
59 printf("Invalid initial state of viewport swizzles.\n");
60 piglit_report_result(PIGLIT_FAIL
);
63 glViewportSwizzleNV(max_viewports
,
64 swizzle_x
, swizzle_y
, swizzle_z
, swizzle_w
);
65 if (!piglit_check_gl_error(GL_INVALID_VALUE
)) {
66 printf("Out-of-bounds viewport index generates wrong error.\n");
67 piglit_report_result(PIGLIT_FAIL
);
70 glViewportSwizzleNV(0, GL_RGBA8
, swizzle_y
, swizzle_z
, swizzle_w
);
71 if (!piglit_check_gl_error(GL_INVALID_ENUM
)) {
72 printf("Wrong error for invalid swizzle_x enum.\n");
73 piglit_report_result(PIGLIT_FAIL
);
75 glViewportSwizzleNV(0, swizzle_x
, GL_RGBA8
, swizzle_z
, swizzle_w
);
76 if (!piglit_check_gl_error(GL_INVALID_ENUM
)) {
77 printf("Wrong error for invalid swizzle_y enum.\n");
78 piglit_report_result(PIGLIT_FAIL
);
80 glViewportSwizzleNV(0, swizzle_x
, swizzle_y
, GL_RGBA8
, swizzle_w
);
81 if (!piglit_check_gl_error(GL_INVALID_ENUM
)) {
82 printf("Wrong error for invalid swizzle_z enum.\n");
83 piglit_report_result(PIGLIT_FAIL
);
85 glViewportSwizzleNV(0, swizzle_x
, swizzle_y
, swizzle_z
, GL_RGBA8
);
86 if (!piglit_check_gl_error(GL_INVALID_ENUM
)) {
87 printf("Wrong error for invalid swizzle_w enum.\n");
88 piglit_report_result(PIGLIT_FAIL
);
91 piglit_report_result(PIGLIT_PASS
);