1 /* Copyright © 2012 Intel Corporation
3 * Permission is hereby granted, free of charge, to any person obtaining a
4 * copy of this software and associated documentation files (the "Software"),
5 * to deal in the Software without restriction, including without limitation
6 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 * and/or sell copies of the Software, and to permit persons to whom the
8 * Software is furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice (including the next
11 * paragraph) shall be included in all copies or substantial portions of the
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25 * Test for the minimum maximum values in section 6.2 "State Tables"
29 #include "piglit-util-gl.h"
30 #include "minmax-test.h"
32 PIGLIT_GL_TEST_CONFIG_BEGIN
34 config
.supports_gl_compat_version
= 10;
36 config
.window_visual
= PIGLIT_GL_VISUAL_DOUBLE
| PIGLIT_GL_VISUAL_RGBA
;
37 config
.khr_no_error_support
= PIGLIT_NO_ERRORS
;
39 PIGLIT_GL_TEST_CONFIG_END
49 piglit_init(int argc
, char **argv
)
51 int vuniforms
= 0, vblocks
= 0;
52 int guniforms
= 0, gblocks
= 0;
53 int funiforms
= 0, fblocks
= 0;
55 bool gs
= (piglit_get_gl_version() >= 32) || piglit_is_extension_supported("GL_ARB_geometry_shader4");
57 piglit_require_extension("GL_ARB_uniform_buffer_object");
59 piglit_print_minmax_header();
61 piglit_test_min_int(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS
, 1024);
63 piglit_test_min_int(GL_MAX_VERTEX_UNIFORM_BLOCKS
, 12);
64 piglit_test_min_int(GL_MAX_FRAGMENT_UNIFORM_BLOCKS
, 12);
66 piglit_test_min_int(GL_MAX_GEOMETRY_UNIFORM_BLOCKS
, 12);
68 piglit_test_min_int(GL_MAX_COMBINED_UNIFORM_BLOCKS
, gs
? 36 : 24);
69 piglit_test_min_int(GL_MAX_UNIFORM_BUFFER_BINDINGS
, gs
? 36 : 24);
70 piglit_test_min_int(GL_MAX_UNIFORM_BLOCK_SIZE
, 16384);
72 /* Minimum value for OpenGL 3.1 is
73 * (MAX_<stage>_UNIFORM_BLOCKS * MAX_UNIFORM_BLOCK_SIZE) +
74 * MAX_<stage>_UNIFORM_COMPONENTS. Minimum value prior to
75 * OpenGL 3.1 is MAX_<stage>_UNIFORM_COMPONENTS.
77 if (piglit_get_gl_version() >= 31) {
78 glGetIntegerv(GL_MAX_VERTEX_UNIFORM_BLOCKS
, &vblocks
);
79 glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_BLOCKS
, &fblocks
);
81 glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS
, &vuniforms
);
82 glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS
, &funiforms
);
83 glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE
, &blocksize
);
84 piglit_test_min_int(GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS
,
85 vblocks
* blocksize
/ 4 + vuniforms
);
86 piglit_test_min_int(GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS
,
87 fblocks
* blocksize
/ 4 + funiforms
);
89 if (piglit_get_gl_version() >= 31) {
90 glGetIntegerv(GL_MAX_GEOMETRY_UNIFORM_BLOCKS
, &gblocks
);
92 glGetIntegerv(GL_MAX_GEOMETRY_UNIFORM_COMPONENTS
, &guniforms
);
94 piglit_test_min_int(GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS
,
95 gblocks
* blocksize
/ 4 + guniforms
);
98 piglit_test_min_int(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT
, 1);
100 if (!piglit_check_gl_error(GL_NO_ERROR
))
101 piglit_report_result(PIGLIT_FAIL
);
103 piglit_report_result(piglit_minmax_pass
? PIGLIT_PASS
: PIGLIT_FAIL
);