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
25 #include <inttypes.h> /* for PRIu64 macro */
27 /* Generic callback type, doing a cast of params to void*, to avoid
28 * having two paths (32 and 64) for each check */
29 typedef void (APIENTRY
*GetInternalformat
)(GLenum target
, GLenum internalformat
,
30 GLenum pname
, GLsizei bufsize
,
33 GLenum
*valid_internalformats
;
34 unsigned num_valid_internalformats
;
36 /* This struct is intended to abstract the fact that there are two
37 * really similar methods, and two really similar params (just change
38 * the type). All the castings and decision about which method should
39 * be used would be done here, just to keep the code of the test
43 /* int instead of a bool to make easier iterate on the
48 GetInternalformat callback
;
51 /* Updates the callback and params based on current values of
52 * testing64 and params_size */
54 sync_test_data(test_data
*data
)
56 if (data
->params
!= NULL
)
59 if (data
->testing64
) {
60 data
->callback
= (GetInternalformat
) glGetInternalformati64v
;
61 data
->params
= malloc(sizeof(GLint64
) * data
->params_size
);
63 data
->callback
= (GetInternalformat
) glGetInternalformativ
;
64 data
->params
= malloc(sizeof(GLint
) * data
->params_size
);
69 test_data_new(int testing64
,
74 result
= (test_data
*) malloc(sizeof(test_data
));
75 result
->testing64
= testing64
;
76 result
->params_size
= params_size
;
77 result
->params
= NULL
;
79 sync_test_data(result
);
85 * Frees @data, and sets its value to NULL.
88 test_data_clear(test_data
**data
)
90 test_data
*_data
= *data
;
103 test_data_execute(test_data
*data
,
105 const GLenum internalformat
,
108 data
->callback(target
, internalformat
, pname
,
109 data
->params_size
, data
->params
);
112 /* Usually we want to call GetInternalformati*v with the size of the
113 * buffer, but there are some cases where we want to specify a
116 test_data_execute_with_size(test_data
*data
,
118 const GLenum internalformat
,
122 data
->callback(target
, internalformat
, pname
,
127 test_data_set_testing64(test_data
*data
,
130 if (data
->testing64
== testing64
)
133 data
->testing64
= testing64
;
134 sync_test_data(data
);
138 test_data_set_params_size(test_data
*data
,
139 const int params_size
)
141 if (data
->params_size
== params_size
)
144 data
->params_size
= params_size
;
145 sync_test_data(data
);
149 test_data_value_at_index(test_data
*data
,
152 if (index
> data
->params_size
|| index
< 0) {
153 fprintf(stderr
, "ERROR: invalid index while retrieving"
154 " data from auxiliary test data\n");
158 return data
->testing64
?
159 ((GLint64
*)data
->params
)[index
] :
160 ((GLint
*)data
->params
)[index
];
164 * Returns if @target/@internalformat is supported using
165 * INTERNALFORMAT_SUPPORTED for @target and @internalformat.
167 * @data is only used to known if we are testing the 32-bit or the
168 * 64-bit query, so the content of @data will not be modified due this
172 test_data_check_supported(const test_data
*data
,
174 const GLenum internalformat
)
177 test_data
*local_data
= test_data_new(data
->testing64
, 1);
179 test_data_execute(local_data
, target
, internalformat
,
180 GL_INTERNALFORMAT_SUPPORTED
);
182 if (!piglit_check_gl_error(GL_NO_ERROR
))
185 result
= test_data_value_at_index(local_data
, 0) == GL_TRUE
;
187 test_data_clear(&local_data
);
194 * Spec 4.6, Table 8.14
196 static const GLenum specific_compressed_internalformats
[] = {
197 GL_COMPRESSED_RED_RGTC1
,
198 GL_COMPRESSED_SIGNED_RED_RGTC1
,
199 GL_COMPRESSED_RG_RGTC2
,
200 GL_COMPRESSED_SIGNED_RG_RGTC2
,
201 GL_COMPRESSED_RGBA_BPTC_UNORM
,
202 GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM
,
203 GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT
,
204 GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT
,
205 GL_COMPRESSED_RGB8_ETC2
,
206 GL_COMPRESSED_SRGB8_ETC2
,
207 GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
,
208 GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
,
209 GL_COMPRESSED_RGBA8_ETC2_EAC
,
210 GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
,
211 GL_COMPRESSED_R11_EAC
,
212 GL_COMPRESSED_SIGNED_R11_EAC
,
213 GL_COMPRESSED_RG11_EAC
,
214 GL_COMPRESSED_SIGNED_RG11_EAC
,
218 * Returns if @internalformat is a specific compressed internalformat.
220 * This is needed because specific compressed internalformats that
221 * doesn't support online compression can't be used with glTexImage*D,
222 * and glCompressedTexImage*D should be used instead. In general, for
223 * specific compressed internalformats, it is better to use
224 * glCompressedTexImage*D
227 internalformat_is_specific_compressed(const GLenum internalformat
)
229 return value_on_set((const GLint
*) specific_compressed_internalformats
,
230 ARRAY_SIZE(specific_compressed_internalformats
),
231 (GLint
) internalformat
);
234 /* Returns if @value is one of the values among @set */
236 value_on_set(const GLint
*set
,
237 const unsigned set_size
,
242 for (i
= 0; i
< set_size
; i
++) {
251 test_data_check_possible_values(test_data
*data
,
252 const GLint
*possible_values
,
253 const unsigned num_possible_values
)
255 return value_on_set(possible_values
, num_possible_values
,
256 test_data_value_at_index(data
, 0));
260 * Prints the info of a failing case for a given pname.
262 * Note that it tries to get the name of the value at @data as if it
263 * were a enum, as it is useful on that case. But there are several
264 * pnames that returns a value. A possible improvement would be that
265 * for those just printing the value.
268 print_failing_case(const GLenum target
, const GLenum internalformat
,
269 const GLenum pname
, test_data
*data
)
271 print_failing_case_full(target
, internalformat
, pname
, -1, data
);
275 * Prints the info of a failing case. If expected_value is smaller
276 * that 0, it is not printed.
278 void print_failing_case_full(const GLenum target
, const GLenum internalformat
,
279 const GLenum pname
, GLint64 expected_value
,
282 /* Knowing if it is supported is interesting in order to know
283 * if the test is being too restrictive */
284 bool supported
= test_data_check_supported(data
, target
, internalformat
);
285 GLint64 current_value
= test_data_value_at_index(data
, 0);
287 if (data
->testing64
) {
288 fprintf(stderr
, " 64 bit failing case: ");
290 fprintf(stderr
, " 32 bit failing case: ");
293 fprintf(stderr
, "pname = %s, "
294 "target = %s, internalformat = %s, ",
295 piglit_get_gl_enum_name(pname
),
296 piglit_get_gl_enum_name(target
),
297 piglit_get_gl_enum_name(internalformat
));
299 if (expected_value
>= 0)
300 fprintf(stderr
, "expected value = (%" PRIi64
"), ",
303 fprintf(stderr
, "params[0] = (%" PRIi64
",%s), "
306 piglit_get_gl_enum_name(current_value
),
311 * The most basic condition. From spec, a lot of pnames has a
312 * condition like this:
314 * "Possible values returned are <set>. If the resource is not
315 * supported, or if the operation is not supported, NONE is
318 * So this method, calls the callback defined at @data (that should be
319 * GetInternalformativ or GetInternalformati64v) using @pname, for all
320 * @num_targets at @targets, and all @num_internalformats at
321 * @internalformats, and checks the following conditions:
323 * * If @pname is not supported (calling INTERNALFORMAT_SUPPORTED),
324 * checks that the value returned is always the same.
325 * * If @pname is supported, checks that the returned value is among
326 * one of the values defined at @possible_values
328 * @possible_values,@num_possible_values is allowed to be NULL,0, for
329 * the cases where the set of returned values is not specified in
330 * detail by the spec (like INTERNALFORMAT_PREFERRED). On that case,
331 * it is not tested the returned value, and just tested that if not
332 * supported, the returned value is the unsupported value defined by
337 try_basic(const GLenum
*targets
, unsigned num_targets
,
338 const GLenum
*internalformats
, unsigned num_internalformats
,
340 const GLint
*possible_values
, unsigned num_possible_values
,
347 for (i
= 0; i
< num_targets
; i
++) {
348 for (j
= 0; j
< num_internalformats
; j
++) {
353 supported
= check_query2_dependencies(pname
, targets
[i
])
354 && test_data_check_supported(data
, targets
[i
],
357 test_data_execute(data
, targets
[i
], internalformats
[j
], pname
);
359 if (supported
&& num_possible_values
== 0)
363 piglit_check_gl_error(GL_NO_ERROR
);
365 value_test
= supported
?
366 test_data_check_possible_values(data
, possible_values
,
367 num_possible_values
) :
368 test_data_is_unsupported_response(data
, pname
);
370 if (error_test
&& value_test
)
373 print_failing_case(targets
[i
], internalformats
[j
],
383 /* Returns a valid format for @internalformat, so it would be possible
384 * to create a texture using glTexImageXD/glCompressedTexImageXD with
385 * that format/internalformat combination */
387 format_for_internalformat(const GLenum internalformat
)
389 switch(internalformat
) {
390 case GL_DEPTH_COMPONENT
:
391 case GL_DEPTH_COMPONENT16
:
392 case GL_DEPTH_COMPONENT24
:
393 case GL_DEPTH_COMPONENT32
:
394 case GL_DEPTH_COMPONENT32F
:
395 return GL_DEPTH_COMPONENT
;
396 case GL_DEPTH_STENCIL
:
397 case GL_DEPTH24_STENCIL8
:
398 case GL_DEPTH32F_STENCIL8
:
399 return GL_DEPTH_STENCIL
;
424 return GL_RGBA_INTEGER
;
431 type_for_internalformat(const GLenum internalformat
)
433 switch(internalformat
) {
434 case GL_DEPTH_STENCIL
:
435 case GL_DEPTH24_STENCIL8
:
436 case GL_DEPTH32F_STENCIL8
:
437 return GL_UNSIGNED_INT_24_8
;
439 return GL_UNSIGNED_BYTE
;
444 * Some GetInternalformati*v pnames returns the same that
445 * GetTexParameter and GetTexLevelParameter. In order to use those, a
446 * texture is needed to be bound. This method creates and bind one
447 * texture based on @target and @internalformat. It returns the
448 * texture name on @tex_out. If target is GL_TEXTURE_BUFFER, a buffer
449 * is also needed, and returned on @buffer_out. Caller is responsible
450 * to free both if the call is successful.
452 * The type and format to be used to create the texture is any one
453 * valid for the given @internalformat.
455 * For texture targets, we also use this function to check if the /resource/
456 * (defined in the ARB_internalformat_query2 spec as an object of the
457 * appropriate type that has been created with <internalformat> and <target>)
458 * is supported by the implementation. If the texture creation fails, then the
459 * resource is unsupported.
461 * Returns true if it was possible to create the texture. False
462 * otherwise (unsupported /resource/).
466 create_texture(const GLenum target
,
467 const GLenum internalformat
,
473 GLenum type
= type_for_internalformat(internalformat
);
474 GLenum format
= format_for_internalformat(internalformat
);
480 bool is_specific_compressed
= internalformat_is_specific_compressed(internalformat
);
484 * From OpenGL 4.6 spec, Section 8.5, Texture Image
487 * "An INVALID_ENUM error is generated by
488 * CompressedTexImage1D if internalformat is one of the
489 * specific compressed formats. OpenGL defines no specific
490 * one-dimensional compressed formats, but such formats
491 * may be provided by extensions."
493 * From OpenGL 4.6 spec, Section 8.7, Compressed Texture
496 * "An INVALID_ENUM error is generated if the target
497 * parameter to any of the CompressedTexImagenD commands
498 * is TEXTURE_RECTANGLE or PROXY_TEXTURE_RECTANGLE ."
500 if (is_specific_compressed
&&
501 (target
== GL_TEXTURE_1D
|| target
== GL_TEXTURE_RECTANGLE
))
505 * From ARB_texture_multisample:
507 * "(2) What commands may be used on multisample textures?
509 * RESOLVED: Multisample textures can be bound for
510 * rendering and texturing, but they cannot be loaded/read
511 * with SubImage commands (TexSubImage, CopyTexSubImage,
512 * GetTexImage), they don't support compressed formats, and
513 * they don't need TexParameters since they can only be
514 * fetched with texelFetchMultisample."
516 if (is_specific_compressed
&&
517 (target
== GL_TEXTURE_2D_MULTISAMPLE
||
518 target
== GL_TEXTURE_2D_MULTISAMPLE_ARRAY
)) {
522 if (is_specific_compressed
) {
523 image_size
= piglit_compressed_image_size(internalformat
, width
, height
);
526 glGenTextures(1, &tex
);
527 glBindTexture(target
, tex
);
531 glTexImage1D(target
, 0, internalformat
, width
, 0,
534 case GL_TEXTURE_1D_ARRAY
:
536 case GL_TEXTURE_RECTANGLE
:
537 if (is_specific_compressed
) {
538 glCompressedTexImage2D(target
, 0, internalformat
,
542 glTexImage2D(target
, 0, internalformat
,
547 case GL_TEXTURE_CUBE_MAP
:
548 for (i
= 0; i
< 6; i
++) {
549 if (is_specific_compressed
) {
550 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X
+ i
, 0,
555 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X
+ i
, 0,
563 case GL_TEXTURE_CUBE_MAP_ARRAY
:
564 /* cube map arrays also use TexImage3D buth depth
565 * needs to be a multiple of six */
568 case GL_TEXTURE_2D_ARRAY
:
570 image_size
= image_size
* depth
;
571 if (is_specific_compressed
) {
572 glCompressedTexImage3D(target
, 0, internalformat
,
573 width
, height
, depth
, 0,
576 glTexImage3D(target
, 0, internalformat
, width
, height
, depth
, 0,
580 case GL_TEXTURE_2D_MULTISAMPLE
:
581 glTexImage2DMultisample(target
, 1, internalformat
, width
, height
,
584 case GL_TEXTURE_2D_MULTISAMPLE_ARRAY
:
585 glTexImage3DMultisample(target
, 1, internalformat
, width
, height
,
588 case GL_TEXTURE_BUFFER
:
589 glGenBuffers(1, &buffer
);
590 glBindBuffer(GL_TEXTURE_BUFFER
, buffer
);
591 glTexBuffer(GL_TEXTURE_BUFFER
, internalformat
, buffer
);
595 fprintf(stderr
, "\tError: %s is not a texture target\n",
596 piglit_get_gl_enum_name(target
));
599 if (!piglit_check_gl_error(GL_NO_ERROR
))
603 glDeleteTextures(1, &tex
);
604 glDeleteBuffers(1, &buffer
);
607 *buffer_out
= buffer
;
614 translate_pname(const GLenum pname
)
617 case GL_INTERNALFORMAT_RED_TYPE
:
618 case GL_INTERNALFORMAT_GREEN_TYPE
:
619 case GL_INTERNALFORMAT_BLUE_TYPE
:
620 case GL_INTERNALFORMAT_ALPHA_TYPE
:
621 return pname
- GL_INTERNALFORMAT_RED_TYPE
+ GL_TEXTURE_RED_TYPE
;
622 case GL_INTERNALFORMAT_DEPTH_TYPE
:
623 /* case GL_INTERNALFORMAT_STENCIL_TYPE, */
624 return GL_TEXTURE_DEPTH_TYPE
;
625 case GL_INTERNALFORMAT_RED_SIZE
:
626 case GL_INTERNALFORMAT_GREEN_SIZE
:
627 case GL_INTERNALFORMAT_BLUE_SIZE
:
628 case GL_INTERNALFORMAT_ALPHA_SIZE
:
629 return pname
- GL_INTERNALFORMAT_RED_SIZE
+ GL_TEXTURE_RED_SIZE
;
630 case GL_INTERNALFORMAT_DEPTH_SIZE
:
631 return GL_TEXTURE_DEPTH_SIZE
;
632 case GL_INTERNALFORMAT_STENCIL_SIZE
:
633 return GL_TEXTURE_STENCIL_SIZE
;
634 case GL_INTERNALFORMAT_SHARED_SIZE
:
635 return GL_TEXTURE_SHARED_SIZE
;
637 assert(!"incorrect pname");
643 * Builds a a texture using @target and @internalformat, and compares
644 * the result of calling GetTexLevelParameter using @pname with the
645 * result included at @data.params.
647 * At this point it is assumed that @target/@internalformat is a valid
648 * combination to create a texture unless it is not supported by the
649 * implementation. If the call to create_texture with those parameters
650 * fails, it is assumed that the resource is unsupported, so the check
651 * only compares against zero (the unsupported value).
653 * Returns true if the value is the same, false otherwise
656 test_data_check_against_get_tex_level_parameter(test_data
*data
,
659 const GLenum internalformat
)
665 GLenum real_target
= target
;
666 GLenum pname_equiv
= translate_pname(pname
);
669 * Special case for texture buffer - this is not valid as
670 * glGetTexLevelParameteriv target with just ARB_tbo, only with gl 3.1.
671 * However, I believe the query2 should still return the correct
672 * values, despite the spec saying
673 * "For textures this query will return the same information as
674 * querying GetTexLevelParameter{if}v for TEXTURE_*_SIZE would return."
676 if (target
== GL_TEXTURE_BUFFER
&& piglit_get_gl_version() < 31) {
680 result
= create_texture(target
, internalformat
, &tex
, &buffer
);
682 return test_data_is_unsupported_response(data
, pname
);
684 /* For cube maps GetTexLevelParameter receives one of the face
685 * targets, or proxy */
686 if (target
== GL_TEXTURE_CUBE_MAP
) {
687 real_target
= GL_TEXTURE_CUBE_MAP_POSITIVE_X
;
689 glGetTexLevelParameteriv(real_target
, 0, pname_equiv
, ¶m
);
690 if (!piglit_check_gl_error(GL_NO_ERROR
)) {
692 fprintf(stderr
, "\tError calling glGetTexLevelParameter\n");
696 result
= test_data_value_at_index(data
, 0) == param
;
699 fprintf(stderr
, "\tError comparing glGetInternalformat "
700 "and glGetTexLevelParameter, params value=%" PRIi64
", "
701 "expected value=%i\n",
702 test_data_value_at_index(data
, 0), param
);
706 glDeleteTextures(1, &tex
);
707 glDeleteBuffers(1, &buffer
);
713 * Returns if @pname query2 dependencies are fulfilled. So for
714 * example, FRAMEBUFFER_RENDERABLE needs
715 * ARB/EXT_framebuffer_object. With that pname, if
716 * ARB/EXT_framebuffer_object is not present, it returns false.
718 * It is assumed that @pname is a valid query2 pname, as would
719 * simplify the implementation of this method.
722 check_query2_pname_dependencies(const GLenum pname
)
725 case GL_FRAMEBUFFER_RENDERABLE
:
726 case GL_FRAMEBUFFER_BLEND
:
727 if (!piglit_is_extension_supported("GL_ARB_framebuffer_object") &&
728 !piglit_is_extension_supported("GL_EXT_framebuffer_object"))
732 case GL_FRAMEBUFFER_RENDERABLE_LAYERED
:
733 if (!piglit_is_extension_supported("GL_ARB_framebuffer_object") &&
734 !piglit_is_extension_supported("GL_EXT_framebuffer_object"))
736 if (!piglit_is_extension_supported("GL_EXT_texture_array"))
740 case GL_MANUAL_GENERATE_MIPMAP
:
741 if (!piglit_is_extension_supported("GL_ARB_framebuffer_object") &&
742 !piglit_is_extension_supported("GL_EXT_framebuffer_object"))
747 if (!piglit_is_extension_supported("GL_EXT_texture_array"))
752 if (!piglit_is_extension_supported("GL_EXT_texture_sRGB"))
757 if (!piglit_is_extension_supported("GL_ARB_framebuffer_sRGB"))
761 case GL_SRGB_DECODE_ARB
:
762 /* Note that if the extension is not supported, it
763 * should return INVALID_ENUM, not unsupported */
764 if (!piglit_is_extension_supported("GL_ARB_texture_sRGB_decode") &&
765 !piglit_is_extension_supported("GL_EXT_texture_sRGB_decode"))
769 case GL_TESS_CONTROL_TEXTURE
:
770 case GL_TESS_EVALUATION_TEXTURE
:
771 if (!piglit_is_extension_supported("GL_ARB_tessellation_shader"))
775 case GL_GEOMETRY_TEXTURE
:
776 if (!piglit_is_extension_supported("GL_ARB_geometry_shader4") &&
777 !(piglit_get_gl_version() >= 32))
781 case GL_COMPUTE_TEXTURE
:
782 if (!piglit_is_extension_supported("GL_ARB_compute_shader"))
786 case GL_TEXTURE_GATHER
:
787 if (!piglit_is_extension_supported("GL_ARB_texture_gather"))
791 case GL_SHADER_IMAGE_LOAD
:
792 case GL_SHADER_IMAGE_STORE
:
793 case GL_SHADER_IMAGE_ATOMIC
:
794 case GL_IMAGE_TEXEL_SIZE
:
795 case GL_IMAGE_COMPATIBILITY_CLASS
:
796 case GL_IMAGE_PIXEL_FORMAT
:
797 case GL_IMAGE_PIXEL_TYPE
:
798 case GL_IMAGE_FORMAT_COMPATIBILITY_TYPE
:
799 if (!piglit_is_extension_supported("GL_ARB_shader_image_load_store"))
803 case GL_CLEAR_BUFFER
:
804 if (!piglit_is_extension_supported("GL_ARB_clear_buffer_object"))
808 case GL_TEXTURE_VIEW
:
809 case GL_VIEW_COMPATIBILITY_CLASS
:
810 if (!piglit_is_extension_supported("GL_ARB_texture_view"))
825 * Returns if @target query2 dependencies are fulfilled. So for
826 * example, TEXTURE_1D_ARRAY needs
827 * EXT_texture_array. With that pname, if
828 * ARB/EXT_framebuffer_object is not present, it returns false.
830 * It is assumed that @target is a valid query2 target, as would
831 * simplify the implementation of this method.
834 check_query2_target_dependencies(const GLenum target
)
837 case GL_TEXTURE_1D_ARRAY
:
838 case GL_TEXTURE_2D_ARRAY
:
839 if (!piglit_is_extension_supported("GL_EXT_texture_array"))
843 case GL_TEXTURE_CUBE_MAP_ARRAY
:
844 if (!piglit_is_extension_supported("GL_ARB_texture_cube_map_array"))
848 case GL_TEXTURE_2D_MULTISAMPLE
:
849 case GL_TEXTURE_2D_MULTISAMPLE_ARRAY
:
850 if (!piglit_is_extension_supported("GL_ARB_texture_multisample"))
854 case GL_TEXTURE_RECTANGLE
:
855 if (!piglit_is_extension_supported("GL_ARB_texture_rectangle"))
859 case GL_RENDERBUFFER
:
860 if (!piglit_is_extension_supported("GL_ARB_framebuffer_object") &&
861 !piglit_is_extension_supported("GL_EXT_framebuffer_object"))
865 case GL_TEXTURE_BUFFER
:
866 if (!piglit_is_extension_supported("GL_ARB_texture_buffer_object") &&
867 piglit_get_gl_version() < 31)
878 /* Returns is @pname and @target dependencies are fulfilled */
880 check_query2_dependencies(const GLenum pname
,
883 return check_query2_target_dependencies(target
) &&
884 check_query2_pname_dependencies(pname
);
888 * Gets the unsupported response for any given @pname.
891 get_unsupported_response(GLenum pname
)
895 /* This one is special as if unsupported, the params
896 * parameter at GetInternalformativ should not be
897 * modified. We return 0 for this method, but should
898 * be took into account by the caller */
902 case GL_MAX_COMBINED_DIMENSIONS
:
903 case GL_NUM_SAMPLE_COUNTS
:
904 case GL_INTERNALFORMAT_RED_SIZE
:
905 case GL_INTERNALFORMAT_GREEN_SIZE
:
906 case GL_INTERNALFORMAT_BLUE_SIZE
:
907 case GL_INTERNALFORMAT_ALPHA_SIZE
:
908 case GL_INTERNALFORMAT_DEPTH_SIZE
:
909 case GL_INTERNALFORMAT_STENCIL_SIZE
:
910 case GL_INTERNALFORMAT_SHARED_SIZE
:
915 case GL_IMAGE_TEXEL_SIZE
:
916 case GL_TEXTURE_COMPRESSED_BLOCK_WIDTH
:
917 case GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT
:
918 case GL_TEXTURE_COMPRESSED_BLOCK_SIZE
:
922 case GL_INTERNALFORMAT_PREFERRED
:
923 case GL_INTERNALFORMAT_RED_TYPE
:
924 case GL_INTERNALFORMAT_GREEN_TYPE
:
925 case GL_INTERNALFORMAT_BLUE_TYPE
:
926 case GL_INTERNALFORMAT_ALPHA_TYPE
:
927 case GL_INTERNALFORMAT_DEPTH_TYPE
:
928 case GL_INTERNALFORMAT_STENCIL_TYPE
:
929 case GL_FRAMEBUFFER_RENDERABLE
:
930 case GL_FRAMEBUFFER_RENDERABLE_LAYERED
:
931 case GL_FRAMEBUFFER_BLEND
:
933 case GL_READ_PIXELS_FORMAT
:
934 case GL_READ_PIXELS_TYPE
:
935 case GL_TEXTURE_IMAGE_FORMAT
:
936 case GL_TEXTURE_IMAGE_TYPE
:
937 case GL_GET_TEXTURE_IMAGE_FORMAT
:
938 case GL_GET_TEXTURE_IMAGE_TYPE
:
939 case GL_MANUAL_GENERATE_MIPMAP
:
940 case GL_AUTO_GENERATE_MIPMAP
:
941 case GL_COLOR_ENCODING
:
944 case GL_SRGB_DECODE_ARB
:
946 case GL_VERTEX_TEXTURE
:
947 case GL_TESS_CONTROL_TEXTURE
:
948 case GL_TESS_EVALUATION_TEXTURE
:
949 case GL_GEOMETRY_TEXTURE
:
950 case GL_FRAGMENT_TEXTURE
:
951 case GL_COMPUTE_TEXTURE
:
952 case GL_TEXTURE_SHADOW
:
953 case GL_TEXTURE_GATHER
:
954 case GL_TEXTURE_GATHER_SHADOW
:
955 case GL_SHADER_IMAGE_LOAD
:
956 case GL_SHADER_IMAGE_STORE
:
957 case GL_SHADER_IMAGE_ATOMIC
:
958 case GL_IMAGE_COMPATIBILITY_CLASS
:
959 case GL_IMAGE_PIXEL_FORMAT
:
960 case GL_IMAGE_PIXEL_TYPE
:
961 case GL_IMAGE_FORMAT_COMPATIBILITY_TYPE
:
962 case GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST
:
963 case GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST
:
964 case GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE
:
965 case GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE
:
966 case GL_CLEAR_BUFFER
:
967 case GL_TEXTURE_VIEW
:
968 case GL_VIEW_COMPATIBILITY_CLASS
:
972 case GL_INTERNALFORMAT_SUPPORTED
:
973 case GL_COLOR_COMPONENTS
:
974 case GL_DEPTH_COMPONENTS
:
975 case GL_STENCIL_COMPONENTS
:
976 case GL_COLOR_RENDERABLE
:
977 case GL_DEPTH_RENDERABLE
:
978 case GL_STENCIL_RENDERABLE
:
980 case GL_TEXTURE_COMPRESSED
:
985 fprintf(stderr
, "Error: %i(%s) is not a valid GetInternalformativ pname",
986 pname
, piglit_get_gl_enum_name(pname
));
993 * Returns if the content of @data contains the unsupported value for
994 * @pname. It is assumed that the pname would return just one value.
997 test_data_is_unsupported_response(test_data
*data
,
1000 return test_data_value_at_index(data
, 0) == get_unsupported_response(pname
);
1004 * Sets the value of @data params at @index to @value.
1007 test_data_set_value_at_index(test_data
*data
,
1009 const GLint64 value
)
1011 if (index
> data
->params_size
|| index
< 0) {
1012 fprintf(stderr
, "ERROR: invalid index while setting"
1013 " auxiliary test data\n");
1017 if (data
->testing64
) {
1018 ((GLint64
*)data
->params
)[index
] = value
;
1020 ((GLint
*)data
->params
)[index
] = value
;
1025 test_data_equal_at_index(test_data
*data
,
1026 test_data
*data_copy
,
1029 if (data
->testing64
!= data_copy
->testing64
) {
1030 fprintf(stderr
, "ERROR: trying to compare incompatible"
1031 " auxiliary test data structures\n");
1034 if (data
->params_size
!= data_copy
->params_size
) {
1035 fprintf(stderr
, "ERROR: trying to compare incompatible"
1036 " auxiliary test data structures\n");
1039 if (index
> data
->params_size
) {
1040 fprintf(stderr
, "ERROR: invalid index while setting"
1041 " auxiliary test data\n");
1045 return (test_data_value_at_index(data
, index
) ==
1046 test_data_value_at_index(data_copy
, index
));
1050 test_data_clone(test_data
*data
)
1054 clone
= test_data_new(data
->testing64
, data
->params_size
);
1060 test_data_get_testing64(test_data
*data
)
1062 return data
->testing64
;
1066 test_data_get_params_size(test_data
*data
)
1068 return data
->params_size
;
1072 initialize_valid_internalformats()
1074 if (piglit_get_gl_version() == 43 ||
1075 piglit_is_extension_supported("GL_ARB_ES3_compatibility")) {
1078 num_valid_internalformats
= ARRAY_SIZE(base_valid_internalformats
) +
1079 ARRAY_SIZE(arb_es3_compatibility_valid_internalformats
);
1081 valid_internalformats
= malloc(sizeof(GLenum
) *
1082 num_valid_internalformats
);
1084 for (i
= 0; i
< ARRAY_SIZE(base_valid_internalformats
); i
++) {
1085 valid_internalformats
[i
] = base_valid_internalformats
[i
];
1088 for (i
= ARRAY_SIZE(base_valid_internalformats
), j
= 0;
1089 i
< num_valid_internalformats
; i
++, j
++) {
1090 valid_internalformats
[i
] =
1091 arb_es3_compatibility_valid_internalformats
[j
];
1095 num_valid_internalformats
= ARRAY_SIZE(base_valid_internalformats
);
1096 valid_internalformats
= (GLenum
*) base_valid_internalformats
;