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
24 #include "piglit-util-gl.h"
26 static const GLenum valid_targets
[] = {
33 GL_TEXTURE_CUBE_MAP_ARRAY
,
37 GL_TEXTURE_2D_MULTISAMPLE
,
38 GL_TEXTURE_2D_MULTISAMPLE_ARRAY
,
41 static const GLenum invalid_targets
[] = {
53 GL_COLOR_ATTACHMENT10
,
54 GL_COLOR_ATTACHMENT11
,
55 GL_COLOR_ATTACHMENT12
,
56 GL_COLOR_ATTACHMENT13
,
57 GL_COLOR_ATTACHMENT14
,
58 GL_COLOR_ATTACHMENT15
,
60 GL_STENCIL_ATTACHMENT
,
62 GL_TEXTURE_RENDERBUFFER_NV
,
65 static const GLenum texture_targets
[] = {
72 GL_TEXTURE_CUBE_MAP_ARRAY
,
75 GL_TEXTURE_2D_MULTISAMPLE
,
76 GL_TEXTURE_2D_MULTISAMPLE_ARRAY
,
79 static const GLenum valid_pnames
[] = {
82 GL_INTERNALFORMAT_SUPPORTED
,
83 GL_INTERNALFORMAT_PREFERRED
,
84 GL_INTERNALFORMAT_RED_SIZE
,
85 GL_INTERNALFORMAT_GREEN_SIZE
,
86 GL_INTERNALFORMAT_BLUE_SIZE
,
87 GL_INTERNALFORMAT_ALPHA_SIZE
,
88 GL_INTERNALFORMAT_DEPTH_SIZE
,
89 GL_INTERNALFORMAT_STENCIL_SIZE
,
90 GL_INTERNALFORMAT_SHARED_SIZE
,
91 GL_INTERNALFORMAT_RED_TYPE
,
92 GL_INTERNALFORMAT_GREEN_TYPE
,
93 GL_INTERNALFORMAT_BLUE_TYPE
,
94 GL_INTERNALFORMAT_ALPHA_TYPE
,
95 GL_INTERNALFORMAT_DEPTH_TYPE
,
96 GL_INTERNALFORMAT_STENCIL_TYPE
,
101 GL_MAX_COMBINED_DIMENSIONS
,
104 GL_STENCIL_COMPONENTS
,
107 GL_STENCIL_RENDERABLE
,
108 GL_FRAMEBUFFER_RENDERABLE
,
109 GL_FRAMEBUFFER_RENDERABLE_LAYERED
,
110 GL_FRAMEBUFFER_BLEND
,
112 GL_READ_PIXELS_FORMAT
,
114 GL_TEXTURE_IMAGE_FORMAT
,
115 GL_TEXTURE_IMAGE_TYPE
,
116 GL_GET_TEXTURE_IMAGE_FORMAT
,
117 GL_GET_TEXTURE_IMAGE_TYPE
,
119 GL_MANUAL_GENERATE_MIPMAP
,
120 GL_AUTO_GENERATE_MIPMAP
,
127 GL_TESS_CONTROL_TEXTURE
,
128 GL_TESS_EVALUATION_TEXTURE
,
134 GL_TEXTURE_GATHER_SHADOW
,
135 GL_SHADER_IMAGE_LOAD
,
136 GL_SHADER_IMAGE_STORE
,
137 GL_SHADER_IMAGE_ATOMIC
,
139 GL_IMAGE_COMPATIBILITY_CLASS
,
140 GL_IMAGE_PIXEL_FORMAT
,
142 GL_IMAGE_FORMAT_COMPATIBILITY_TYPE
,
143 GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST
,
144 GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST
,
145 GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE
,
146 GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE
,
147 GL_TEXTURE_COMPRESSED
,
148 GL_TEXTURE_COMPRESSED_BLOCK_WIDTH
,
149 GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT
,
150 GL_TEXTURE_COMPRESSED_BLOCK_SIZE
,
153 GL_VIEW_COMPATIBILITY_CLASS
156 static const GLenum invalid_pnames
[] = {
163 GL_MAX_3D_TEXTURE_SIZE
,
164 GL_MAX_CUBE_MAP_TEXTURE_SIZE
,
165 GL_TEXTURE_INTERNAL_FORMAT
,
168 GL_TEXTURE_COMPONENTS
,
172 * The following are the valid internalformats defined when the spec
173 * was written (at 4.2).
177 * "INTERNALFORMAT_SUPPORTED:
180 * <internalformats> that must be supported (in GL 4.2 or later)
181 * include the following:
182 * - "sized internal formats" from Table 3.12, 3.13, and 3.15,
183 * - any specific "compressed internal format" from Table 3.14,
184 * - any "image unit format" from Table 3.21.
185 * - any generic "compressed internal format" from Table 3.14, if
186 * the implementation accepts it for any texture specification
188 * - unsized or base internal format, if the implementation accepts
189 * it for texture or image specification."
191 static const GLenum base_valid_internalformats
[] = {
192 /* Base/unsized internal format (from Table 3.11) */
199 /* Table 3.12 (Table 3.15 and 3.21 included here) */
263 GL_DEPTH_COMPONENT16
,
264 GL_DEPTH_COMPONENT24
,
265 GL_DEPTH_COMPONENT32
,
266 GL_DEPTH_COMPONENT32F
,
268 GL_DEPTH32F_STENCIL8
,
269 /* Table 3.14 (both specific and generic) */
275 GL_COMPRESSED_SRGB_ALPHA
,
276 GL_COMPRESSED_RED_RGTC1
,
277 GL_COMPRESSED_SIGNED_RED_RGTC1
,
278 GL_COMPRESSED_RG_RGTC2
,
279 GL_COMPRESSED_SIGNED_RG_RGTC2
,
280 GL_COMPRESSED_RGBA_BPTC_UNORM
,
281 GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM
,
282 GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT
,
283 GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT
,
287 * Below the new internalformats added by ARB_ES3_compatibility, core
288 * since 4.3. You can find those internalformats at Spec 4.3 Table
291 static const GLenum arb_es3_compatibility_valid_internalformats
[] = {
292 GL_COMPRESSED_RGB8_ETC2
,
293 GL_COMPRESSED_SRGB8_ETC2
,
294 GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
,
295 GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
,
296 GL_COMPRESSED_RGBA8_ETC2_EAC
,
297 GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
,
298 GL_COMPRESSED_R11_EAC
,
299 GL_COMPRESSED_SIGNED_R11_EAC
,
300 GL_COMPRESSED_RG11_EAC
,
301 GL_COMPRESSED_SIGNED_RG11_EAC
,
304 extern GLenum
*valid_internalformats
;
305 extern unsigned num_valid_internalformats
;
307 typedef struct _test_data test_data
;
309 test_data
* test_data_new(int testing64
,
312 void test_data_clear(test_data
**data
);
314 void test_data_execute(test_data
*data
,
316 const GLenum internalformat
,
320 test_data_execute_with_size(test_data
*data
,
322 const GLenum internalformat
,
326 void test_data_set_testing64(test_data
*data
,
327 const int testing64
);
329 void test_data_set_params_size(test_data
*data
,
330 const int params_size
);
332 bool test_data_equal_at_index(test_data
*data
,
333 test_data
*data_copy
,
334 const unsigned index
);
336 bool test_data_check_supported(const test_data
*data
,
338 const GLenum internalformat
);
340 bool test_data_check_possible_values(test_data
*data
,
341 const GLint
*possible_values
,
342 const unsigned num_possible_values
);
344 GLint64
test_data_value_at_index(test_data
*data
,
347 void test_data_set_value_at_index(test_data
*data
,
349 const GLint64 value
);
351 test_data
* test_data_clone(test_data
*data
);
353 int test_data_get_testing64(test_data
*data
);
355 int test_data_get_params_size(test_data
*data
);
357 bool try_basic(const GLenum
*targets
, unsigned num_targets
,
358 const GLenum
*internalformats
, unsigned num_internalformats
,
360 const GLint
*possible_values
, unsigned num_possible_values
,
363 void print_failing_case(const GLenum target
, const GLenum internalformat
,
364 const GLenum pname
, test_data
*data
);
366 void print_failing_case_full(const GLenum target
, const GLenum internalformat
,
367 const GLenum pname
, GLint64 expected_value
,
370 bool value_on_set(const GLint
*set
,
371 const unsigned set_size
,
374 bool check_query2_dependencies(const GLenum pname
,
375 const GLenum target
);
377 bool test_data_is_unsupported_response(test_data
*data
,
380 bool test_data_check_against_get_tex_level_parameter(test_data
*data
,
383 const GLenum internalformat
);
384 bool create_texture(const GLenum target
,
385 const GLenum internalformat
,
389 void initialize_valid_internalformats();