File: max-dimensions.c

package info (click to toggle)
piglit 0~git20200212-f4710c51b-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 106,972 kB
  • sloc: ansic: 263,763; xml: 48,941; python: 29,918; lisp: 19,789; cpp: 12,142; sh: 22; makefile: 20; pascal: 5
file content (697 lines) | stat: -rw-r--r-- 24,589 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
/*
 * Copyright © 2015 Intel Corporation
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */

/**
 * \file max dimensions.c
 *
 * Handle checks for several pnames involving max dimensions:
 *
 * MAX_WIDTH: From spec: If the resource is unsupported, zero is
 * returned."
 *
 * MAX_HEIGHT: From spec "If the resource does not have at least two
 *   dimensions, or if the resource is unsupported, zero is returned."
 *
 * MAX_DEPTH: From spec "If the resource does not have at least three
 *   dimensions, or if the resource is unsupported, zero is returned."
 *
 * MAX_LAYERS: From spec "For 1D array targets, the value returned is
 *   the same as the MAX_HEIGHT. For 2D and cube array targets, the
 *   value returned is the same as the MAX_DEPTH."
 *
 * MAX_COMBINED_DIMENSIONS: From spec "The maximum combined dimensions
 *   for the resource is returned in <params>. The combined dimensions
 *   is the product of the individual dimensions of the
 *   resource. <skip> If the resource is unsupported, zero is
 *   returned."
 *
 * Additionally it also checks that the returned values are the same
 * that the ones you receive calling GetIntegerv with equivalent
 * pnames like GL_MAX_TEXTURE_SIZE, GL_MAX_3D_TEXTURE_SIZE, etc.
 *
 * All those are internal format-independent, meanwhile
 * GetInternalformat allows to specify the internal format. So in
 * theory there is the possibility of being different for some
 * internal format. But in practice, this is not happening on any
 * driver at this moment. Query2 spec mentions this case:
 *
 *   "7) There some <pnames> which it makes no sense to be qualified
 *    by a per-format/target scope, how should we handle them?
 *    e.g. MAX_WIDTH and MAX_HEIGHT might be the same for all formats.
 *    e.g. properties like AUTO_GENERATE_MIPMAP and
 *    MANUAL_GENERATE_MIPMAP might depend only on the GL version.
 *
 *    <skip>
 *
 *    A) Just use this entry point as is, if there are no per-format
 *    or target differences, it is perfectly acceptable to have the
 *    implementation return the same information for all valid
 *    parameters. This does allow implementations to report caveats
 *    that may exist for some formats but not others, even though all
 *    formats/targets may be supported."
 *
 * So at this point, taking into account the current implementation,
 * it makes sense to check against those values.
 *
 * For MAX_COMBINED_DIMENSIONS it compares the returned value against
 * a combination of MAX_WIDH, MAX_HEIGHT, MAX_DEPTH, MAX_LAYERS and
 * SAMPLES if supported. Compares against 0 if unsupported.
 */

#include "common.h"
#include <inttypes.h>  /* for PRIu64 macro */
#include <limits.h> /* For INT_MAX */

PIGLIT_GL_TEST_CONFIG_BEGIN

	config.supports_gl_compat_version = 10;
	config.window_visual = PIGLIT_GL_VISUAL_RGB;
	config.khr_no_error_support = PIGLIT_NO_ERRORS;

PIGLIT_GL_TEST_CONFIG_END

enum piglit_result
piglit_display(void)
{
	return PIGLIT_FAIL;
}

/* Returns the equivalent GetInteger pname for a Getinternalformat
 * pname/target combination. Values 0 due number of dimensions should
 * be already filtered out */
static GLenum
equivalentPname(GLenum target,
                GLenum pname)
{
	switch (target) {
	case GL_TEXTURE_1D:
	case GL_TEXTURE_2D:
        case GL_TEXTURE_2D_MULTISAMPLE:
		return GL_MAX_TEXTURE_SIZE;
	case GL_TEXTURE_3D:
		return GL_MAX_3D_TEXTURE_SIZE;
	case GL_TEXTURE_CUBE_MAP_ARB:
		return GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB;
	case GL_TEXTURE_RECTANGLE:
		return GL_MAX_RECTANGLE_TEXTURE_SIZE;
	case GL_RENDERBUFFER_EXT:
		return GL_MAX_RENDERBUFFER_SIZE_EXT;
        case GL_TEXTURE_1D_ARRAY:
                if (pname == GL_MAX_HEIGHT)
                        return GL_MAX_ARRAY_TEXTURE_LAYERS;
                else
                        return GL_MAX_TEXTURE_SIZE;
        case GL_TEXTURE_2D_ARRAY:
        case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
                if (pname == GL_MAX_DEPTH)
                        return GL_MAX_ARRAY_TEXTURE_LAYERS;
                else
                        return GL_MAX_TEXTURE_SIZE;
        case GL_TEXTURE_CUBE_MAP_ARRAY:
                if (pname == GL_MAX_DEPTH)
                        return GL_MAX_ARRAY_TEXTURE_LAYERS;
                else
                        return GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB;
        case GL_TEXTURE_BUFFER:
                return GL_MAX_TEXTURE_BUFFER_SIZE;
	default:
		fprintf(stderr, "Invalid texture target %s\n",
                        piglit_get_gl_enum_name(target));
		return 0;
	}
}

static bool
has_layers(GLenum target)
{
        switch(target) {

        case GL_TEXTURE_1D_ARRAY:
        case GL_TEXTURE_2D_ARRAY:
        case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
        case GL_TEXTURE_CUBE_MAP_ARRAY:
                return true;
	default:
                return false;
        }
}

static bool
check_params_against_get_integer(test_data *data,
                                 GLenum pname)
{
        GLint size;
        GLint size_at_params;

        glGetIntegerv(pname, &size);
        size_at_params = test_data_value_at_index(data, 0);

        if (size != size_at_params) {
                fprintf(stderr, "GetInternalformat returns %i while GetInteger returns %i\n",
                        size_at_params, size);
        }

        return size == size_at_params;
}

/*
 * Returns the number of dimensions of @target
 */
static int
num_dimensions(const GLenum target)
{
        switch(target) {
        case GL_TEXTURE_1D:
        case GL_TEXTURE_BUFFER:
                return 1;

        /* Although technically 1D_ARRAY holds a 1D dimension texture,
         * it uses the height as the number of layers, and it is
         * created using TexImage2D, additionally from MAX_LAYERS
         * description at spec:
         *
         * "For 1D array targets, the value returned is the same as the
         * MAX_HEIGHT."
         *
         * So here are considered as having 3 dimensions
         */
        case GL_TEXTURE_1D_ARRAY:
        case GL_TEXTURE_2D:
        case GL_TEXTURE_CUBE_MAP:
        case GL_TEXTURE_RECTANGLE:
        case GL_TEXTURE_2D_MULTISAMPLE:
        case GL_RENDERBUFFER:
                return 2;

        /* Although technically, CUBE_MAP_ARRAY and 2D_ARRAY holds 2D
         * dimension textures, they use the depth as the number of
         * layers, and it is created using TexImage3D, additionally
         * from MAX_LAYERS description at spec:
         *
         * "For 2D and cube array targets, the value returned is the
         * same as the MAX_DEPTH."
         *
         * So here are considered as having 3 dimensions
         */
        case GL_TEXTURE_CUBE_MAP_ARRAY:
        case GL_TEXTURE_2D_ARRAY:
        case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
        case GL_TEXTURE_3D:
                return 3;
        default:
                return 0;
        }
}

static bool
is_supported_renderbuffer(const GLenum target, const GLenum internalformat)
{
        GLuint rb;
        bool result = true;

        glGenRenderbuffers(1, &rb);
        glBindRenderbuffer(GL_RENDERBUFFER, rb);
        glRenderbufferStorage(GL_RENDERBUFFER, internalformat, 16, 16);

        if (!piglit_check_gl_error(GL_NO_ERROR))
                result = false;

        glDeleteRenderbuffers(1, &rb);
        return result;
}

static bool
is_resource_supported(const test_data *data,
                      const GLenum pname,
                      const GLenum target,
                      const GLenum internalformat)
{
        GLuint tex;
        GLuint buffer;

        if (!check_query2_dependencies(pname, target))
                return false;

        if (!test_data_check_supported(data, target, internalformat))
                return false;

        if (target == GL_RENDERBUFFER)
                return is_supported_renderbuffer(target, internalformat);

        if (!create_texture(target, internalformat, &tex, &buffer))
                return false;

        glDeleteTextures(1, &tex);
        glDeleteBuffers(1, &buffer);

        return true;
}

static bool
try(const GLenum *targets, unsigned num_targets,
    const GLenum *internalformats, unsigned num_internalformats,
    const GLenum pname,
    const unsigned min_dimensions,
    test_data *data)
{
        bool pass = true;
        unsigned i;
        unsigned j;

	for (i = 0; i < num_targets; i++) {
		for (j = 0; j < num_internalformats; j++) {
                        bool error_test;
                        bool value_test = true;
                        bool supported;

                        supported = is_resource_supported(data, pname,
                                                          targets[i], internalformats[j]);

                        test_data_execute(data, targets[i], internalformats[j],
                                          pname);

                        error_test =
                                piglit_check_gl_error(GL_NO_ERROR);

                        /* From the spec:
                         *
                         * MAX_WIDTH
                         * "If the resource is unsupported, zero is
                         *  returned."
                         *
                         * MAX_HEIGHT
                         * "If the resource does not have at least two
                         *  dimensions, or if the resource is
                         *  unsupported, zero is returned."
                         *
                         * MAX_DEPTH:
                         * "If the resource does not have at least
                         * three dimensions, or if the resource is
                         * unsupported, zero is returned."
                         *
                         * For all those cases, we test that is zero.
                         */

                        if (!supported || num_dimensions(targets[i]) < min_dimensions) {
                                value_test = test_data_is_unsupported_response(data, pname);
                        } else {
                                /*
                                 * If suppported and enough dimensions, we compare against the values
                                 * returned by GetInteger
                                 */
                                value_test = check_params_against_get_integer(data,
                                                                              equivalentPname(targets[i], pname));
                        }

                        if (error_test && value_test)
                                continue;

                        print_failing_case(targets[i], internalformats[j], pname, data);

                        pass = false;
                }
        }

	return pass;
}

static bool
check_max_dimension(const GLenum pname,
                    const unsigned min_dimensions)
{
        bool pass = true;
        test_data *data = test_data_new(0, 1);
        int testing64;

        for (testing64 = 0; testing64 <= 1; testing64++) {
                test_data_set_testing64(data, testing64);

                pass = try(valid_targets, ARRAY_SIZE(valid_targets),
                           valid_internalformats, num_valid_internalformats,
                           pname, min_dimensions, data)
                        && pass;
        }

        piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
                                     "%s", piglit_get_gl_enum_name(pname));
        test_data_clear(&data);
        return pass;
}

static bool
is_array(const GLenum target)
{
        switch(target) {
        case GL_TEXTURE_1D_ARRAY:
        case GL_TEXTURE_CUBE_MAP_ARRAY:
        case GL_TEXTURE_2D_ARRAY:
        case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
                return true;
        default:
                return false;
        }
}

static bool
is_1d_array(const GLenum target)
{
        switch(target) {
        case GL_TEXTURE_1D_ARRAY:
                return true;
        default:
                return false;
        }
}

/*
 * From the spec:
 *
 * "MAX_LAYERS: The maximum supported number of layers for the
 *  resource is returned in <params>. For 1D array targets, the value
 *  returned is the same as the MAX_HEIGHT. For 2D and cube array
 *  targets, the value returned is the same as the MAX_DEPTH. If the
 *  resource does not support layers, or if the resource is
 *  unsupported, zero is returned."
 *
 * This function is a check to ensure that the value is the same that
 * the other pnames. So this function calls GetInternalformat with the
 * pname MAX_HEIGHT or MAX_DEPTH (depends on @target), and compare it
 * against the value stored at @data, that is a test_data that have
 * just called GetInternalformat with MAX_LAYERS.
 */
static bool
check_params_against_dimension(test_data *data,
                               const GLenum target,
                               const GLenum internalformat)
{
        test_data *local_data;
        GLenum dimension_pname;
        bool result = true;

        if (!is_array(target))
                return true;

        if (is_1d_array(target)) {
                dimension_pname = GL_MAX_HEIGHT;
        } else {
                dimension_pname = GL_MAX_DEPTH;
        }

        local_data = test_data_clone(data);

        test_data_execute(local_data, target, internalformat,
                          dimension_pname);

        result = test_data_equal_at_index(data, local_data, 0);

        if (!result)
                fprintf(stderr, "%s value different to %s value (%" PRIi64 " != %" PRIi64 ")\n",
                        piglit_get_gl_enum_name(GL_MAX_LAYERS),
                        piglit_get_gl_enum_name(dimension_pname),
                        test_data_value_at_index(data, 0),
                        test_data_value_at_index(local_data, 0));

        test_data_clear(&local_data);

        return result;
}
/*
 * From the spec:
 *
 * "MAX_LAYERS: The maximum supported number of layers for the
 *  resource is returned in <params>. For 1D array targets, the value
 *  returned is the same as the MAX_HEIGHT. For 2D and cube array
 *  targets, the value returned is the same as the MAX_DEPTH. If the
 *  resource does not support layers, or if the resource is
 *  unsupported, zero is returned."
 */
static bool
try_max_layers(const GLenum *targets, unsigned num_targets,
               const GLenum *internalformats, unsigned num_internalformats,
               test_data *data)
{
        bool pass = true;
        unsigned i;
        unsigned j;

	for (i = 0; i < num_targets; i++) {
		for (j = 0; j < num_internalformats; j++) {
                        bool error_test;
                        bool value_test = true;
                        bool supported;

                        supported = is_resource_supported(data, GL_MAX_LAYERS,
                                                          targets[i], internalformats[j]);

                        test_data_execute(data, targets[i], internalformats[j],
                                          GL_MAX_LAYERS);

                        error_test =
                                piglit_check_gl_error(GL_NO_ERROR);

                        if (!supported || !has_layers(targets[i])) {
                                value_test = test_data_is_unsupported_response(data, GL_MAX_LAYERS);
                        } else {
                                /* We check that MAX_LAYERS is the
                                 * equal to the equivalent
                                 * MAX_HEIGHT/WIDTH */
                                value_test =
                                        check_params_against_dimension(data,
                                                                       targets[i],
                                                                       internalformats[i]);
                                /* We check that is the returned value by GetInteger */
                                value_test = value_test &&
                                        check_params_against_get_integer(data,
                                                                         GL_MAX_ARRAY_TEXTURE_LAYERS);
                        }

                        if (error_test && value_test)
                                continue;

                        print_failing_case(targets[i], internalformats[j],
                                           GL_MAX_LAYERS, data);

                        pass = false;
                }
        }

	return pass;
}

static bool
check_max_layers()
{
        bool pass = true;
        test_data *data = test_data_new(0, 1);
        int testing64;

        for (testing64 = 0; testing64 <= 1; testing64++) {
                test_data_set_testing64(data, testing64);

                pass = try_max_layers(valid_targets, ARRAY_SIZE(valid_targets),
                                      valid_internalformats, num_valid_internalformats,
                                      data)
                        && pass;
        }

        piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
                                     "%s", piglit_get_gl_enum_name(GL_MAX_LAYERS));
        test_data_clear(&data);
        return pass;
}

static bool
is_cubemap(GLenum target)
{
        switch(target) {
        case GL_TEXTURE_CUBE_MAP:
        case GL_TEXTURE_CUBE_MAP_ARRAY:
                return true;
        default:
                return false;
        }
}

static bool
is_multisample(GLenum target)
{
        switch(target) {
        case GL_TEXTURE_2D_MULTISAMPLE:
        case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
                return true;
        default:
                return false;
        }
}

/* It computes the max dimension for @target and @internalformat, and
 * compares it against the content of @data */
static bool
check_against_combined_dimensions(test_data *data,
                                  GLenum target,
                                  GLenum internalformat,
                                  GLint64 *_combined_value)
{
        GLint current_value;
        GLint64 combined_value = 1;
        /* We don't include MAX_LAYERS, because his value is returned
           as HEIGHT (on 1d arrays) or DEPTH (on 2d arrays) */
        GLenum max_dimensions_pnames[] = {
                GL_MAX_WIDTH,
                GL_MAX_HEIGHT,
                GL_MAX_DEPTH,
                GL_SAMPLES
        };
        unsigned i;
        test_data *local_data = test_data_clone(data);

        for (i = 0; i < ARRAY_SIZE(max_dimensions_pnames); i++) {
                if (max_dimensions_pnames[i] == GL_SAMPLES &&
                    !is_multisample(target))
                        continue;

                test_data_execute(local_data, target, internalformat,
                                  max_dimensions_pnames[i]);

                current_value = test_data_value_at_index(local_data, 0);
                if (current_value != 0)
                        combined_value *= current_value;
        }

        test_data_clear(&local_data);

        /* From query2 spec: "For cube map targets this is the maximum
         * combined width, height and faces. "*/
        if (is_cubemap(target))
                combined_value *= 6;

        *_combined_value = combined_value;
        /* query2 spec doesn't specify what the 32-bit query would
         * return on cases where a 64-bit integer is needed. NVIDIA
         * drivers returns a 0, but nothing would prevent to just
         * return INT_MAX. We assume that in this case, any value
         * would be correct.
         */
        if (!test_data_get_testing64(data) && combined_value > INT_MAX)
          return true;

        return combined_value == test_data_value_at_index(data, 0);
}
/*
 * From the spec:
 *
 * "MAX_COMBINED_DIMENSIONS: The maximum combined dimensions for the
 *  resource is returned in <params>. The combined dimensions is the
 *  product of the individual dimensions of the resource. <skip> If
 *  the resource is unsupported, zero is returned"
 *
 * This method compares against zero if unsupported. If supported it
 * computes the value using MAX_WIDTH, MAX_HEIGHT, MAX_DEPTH,
 * MAX_LAYERS and SAMPLES, and compare it agains the returned value.
 */
static bool
try_max_combined_dimensions(const GLenum *targets, unsigned num_targets,
                            const GLenum *internalformats, unsigned num_internalformats,
                            test_data *data)
{
        bool pass = true;
        unsigned i;
        unsigned j;

	for (i = 0; i < num_targets; i++) {
		for (j = 0; j < num_internalformats; j++) {
                        bool error_test;
                        bool value_test = true;
                        bool supported;
                        GLint64 combined_value = -1;

                        supported = is_resource_supported(data, GL_MAX_COMBINED_DIMENSIONS,
                                                          targets[i],
                                                          internalformats[j]);

                        test_data_execute(data, targets[i], internalformats[j],
                                          GL_MAX_COMBINED_DIMENSIONS);

                        error_test =
                                piglit_check_gl_error(GL_NO_ERROR);

                        value_test = supported ?
                                check_against_combined_dimensions(data,
                                                                  targets[i],
                                                                  internalformats[j],
                                                                  &combined_value) :
                                test_data_is_unsupported_response(data,
                                                                  GL_MAX_COMBINED_DIMENSIONS);

                        if (error_test && value_test)
                                continue;

                        print_failing_case_full(targets[i], internalformats[j],
                                                GL_MAX_COMBINED_DIMENSIONS,
                                                combined_value, data);

                        pass = false;
                }
        }

	return pass;
}

static bool
check_max_combined_dimensions()
{
        bool pass = true;
        test_data *data = test_data_new(0, 1);
        int testing64;

        for (testing64 = 0; testing64 <= 1; testing64++) {
                test_data_set_testing64(data, testing64);

                pass = try_max_combined_dimensions(valid_targets, ARRAY_SIZE(valid_targets),
                                                   valid_internalformats, num_valid_internalformats,
                                                   data)
                        && pass;
        }

        piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
                                     "%s", piglit_get_gl_enum_name(GL_MAX_COMBINED_DIMENSIONS));
        test_data_clear(&data);
        return pass;
}

void
piglit_init(int argc, char **argv)
{
        bool pass = true;

        piglit_require_extension("GL_ARB_internalformat_query2");
        initialize_valid_internalformats();

        pass = check_max_dimension(GL_MAX_WIDTH, 1) && pass;
        pass = check_max_dimension(GL_MAX_HEIGHT, 2) && pass;
        pass = check_max_dimension(GL_MAX_DEPTH, 3) && pass;
        pass = check_max_layers() && pass;
        pass = check_max_combined_dimensions() && pass;

        piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}