2 * Copyright © 2015 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
26 * Verify a handful of error conditions required by the spec.
28 * None of these subtests is large enough to warrant a separate test case.
30 * Equivalent to internalformat_query-api-errors, with testing
31 * GetInternalformati64v and in addition to test that a INVALID_ENUM
32 * is returned with an invalid combination, it also tests that a valid
33 * combination doesn't return an INVALID_ENUM.
35 * The rationale of this is that is really likely that the implementation
36 * of arb_internal_format_query2 would reuse a lot of bits of
37 * arb_internal_format_query, so we want to be sure that a combination
38 * that was invalid with arb_internal_format_query is not considered
39 * invalid by arb_internal_format_query2.
45 PIGLIT_GL_TEST_CONFIG_BEGIN
47 config
.supports_gl_compat_version
= 10;
48 config
.window_visual
= PIGLIT_GL_VISUAL_RGB
;
49 config
.khr_no_error_support
= PIGLIT_HAS_ERRORS
;
51 PIGLIT_GL_TEST_CONFIG_END
60 try(const GLenum
*targets
, unsigned num_targets
,
61 const GLenum
*pnames
, unsigned num_pnames
,
62 GLenum expected_error
)
70 for (i
= 0; i
< num_targets
; i
++) {
71 for (j
= 0; j
< num_pnames
; j
++) {
75 /* We can use any internalformat, as we are
76 * just checking that the pname/target
77 * combination is or not valid. Knowing if the
78 * internalformat is supported is done on
79 * query2 using INTERNALFORMAT_SUPPORTED
82 glGetInternalformativ(targets
[i
],
89 piglit_check_gl_error(expected_error
);
91 glGetInternalformati64v(targets
[i
],
98 piglit_check_gl_error(expected_error
);
100 if (this_test
&& this_test64
)
105 "target = %s, pname = %s\n",
106 piglit_get_gl_enum_name(targets
[i
]),
107 piglit_get_gl_enum_name(pnames
[j
]));
111 " Calling glGetInternalformativ\n");
114 " Calling glGetInternalformati64v\n");
123 piglit_init(int argc
, char **argv
)
127 piglit_require_extension("GL_ARB_framebuffer_object");
128 piglit_require_extension("GL_ARB_internalformat_query2");
130 /* The GL_ARB_internalformat_query2 spec says:
132 * The INVALID_ENUM error is generated if the <target> parameter to
133 * GetInternalformati*v is not one of the targets listed in Table 6.xx.
135 * The INVALID_ENUM error is generated if the <pname> parameter is
136 * not one of the listed possibilities.
138 * So we will test that with all the listed pname/targets, no
139 * error is returned, and that without those, INVALID_ENUM is
142 pass
= try(valid_targets
, ARRAY_SIZE(valid_targets
),
143 valid_pnames
, ARRAY_SIZE(valid_pnames
),
147 pass
= try(invalid_targets
, ARRAY_SIZE(invalid_targets
),
148 valid_pnames
, ARRAY_SIZE(valid_pnames
),
152 pass
= try(valid_targets
, ARRAY_SIZE(valid_targets
),
153 invalid_pnames
, ARRAY_SIZE(invalid_pnames
),
157 pass
= try(invalid_targets
, ARRAY_SIZE(invalid_targets
),
158 invalid_pnames
, ARRAY_SIZE(invalid_pnames
),
162 /* The GL_ARB_internalformat_query spec says:
164 * "If the <bufSize> parameter to GetInternalformativ is negative,
165 * then an INVALID_VALUE error is generated."
167 * Although not specified on query2 spec, we understand that
168 * it should be the case, and is a missing on the query2
169 * spec. It is properly checked on all the query2
170 * implementations we tested so far.
172 glGetInternalformativ(valid_targets
[0],
176 pass
= piglit_check_gl_error(GL_INVALID_VALUE
)
179 piglit_report_result(pass
? PIGLIT_PASS
: PIGLIT_FAIL
);