ext_gpu_shader4: add compiler tests for everything
[piglit.git] / tests / spec / arb_uniform_buffer_object / negative-bindbuffer-index.c
blob2c31df8e446cb36f6aee99b57fd7860f48927397
1 /*
2 * Copyright © 2012 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
13 * Software.
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
21 * DEALINGS IN THE SOFTWARE.
24 /** @file negative-bindbuffer-index.c
26 * Tests for errors when binding higher than the maximum uniform
27 * buffer binding point.
30 #include "piglit-util-gl.h"
32 PIGLIT_GL_TEST_CONFIG_BEGIN
34 config.supports_gl_compat_version = 10;
35 config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
36 config.khr_no_error_support = PIGLIT_HAS_ERRORS;
38 PIGLIT_GL_TEST_CONFIG_END
40 void
41 piglit_init(int argc, char **argv)
43 bool pass = true;
44 GLint max_bindings;
45 GLuint bo;
47 piglit_require_extension("GL_ARB_uniform_buffer_object");
49 glGenBuffers(1, &bo);
50 glBindBuffer(GL_UNIFORM_BUFFER, bo);
51 glBufferData(GL_UNIFORM_BUFFER, 1, NULL, GL_STATIC_READ);
53 glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &max_bindings);
55 /* From the GL_ARB_uniform_buffer_object spec:
57 * "The error INVALID_VALUE is generated if <index> is
58 * greater than or equal to the value of
59 * MAX_UNIFORM_BUFFER_BINDINGS.
62 glBindBufferBase(GL_UNIFORM_BUFFER, max_bindings, bo);
63 if (!piglit_check_gl_error(GL_INVALID_VALUE))
64 pass = false;
66 glBindBufferRange(GL_UNIFORM_BUFFER, max_bindings, bo, 0, 1);
67 if (!piglit_check_gl_error(GL_INVALID_VALUE))
68 pass = false;
70 piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
73 enum piglit_result piglit_display(void)
75 /* UNREACHED */
76 return PIGLIT_FAIL;