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
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-target.c
26 * Tests for errors when binding with a bad target.
29 #include "piglit-util-gl.h"
31 PIGLIT_GL_TEST_CONFIG_BEGIN
33 config
.supports_gl_compat_version
= 10;
34 config
.window_visual
= PIGLIT_GL_VISUAL_RGBA
| PIGLIT_GL_VISUAL_DOUBLE
;
35 config
.khr_no_error_support
= PIGLIT_HAS_ERRORS
;
37 PIGLIT_GL_TEST_CONFIG_END
40 piglit_init(int argc
, char **argv
)
42 /* We don't need to check extensions for these targets, since
43 * we're expecting INVALID_ENUM anyway.
48 GL_ELEMENT_ARRAY_BUFFER
,
52 GL_PIXEL_UNPACK_BUFFER
,
59 piglit_require_extension("GL_ARB_uniform_buffer_object");
62 glBindBuffer(GL_UNIFORM_BUFFER
, bo
);
63 glBufferData(GL_UNIFORM_BUFFER
, 1, NULL
, GL_STATIC_READ
);
65 /* From the GL_ARB_uniform_buffer_object spec:
67 * "The error INVALID_ENUM is generated by
68 * BindBufferRange and BindBufferBase if <target> is not
69 * an accepted indexable buffer object target."
71 for (i
= 0; i
< ARRAY_SIZE(targets
); i
++) {
72 glBindBufferBase(targets
[i
], 0, bo
);
73 if (!piglit_check_gl_error(GL_INVALID_ENUM
)) {
74 printf("Fail on target 0x%08x (%s)\n",
76 piglit_get_gl_enum_name(targets
[i
]));
80 glBindBufferRange(targets
[i
], 0, bo
, 0, 1);
81 if (!piglit_check_gl_error(GL_INVALID_ENUM
)) {
82 printf("Fail on target 0x%08x (%s)\n",
84 piglit_get_gl_enum_name(targets
[i
]));
89 piglit_report_result(pass
? PIGLIT_PASS
: PIGLIT_FAIL
);
92 enum piglit_result
piglit_display(void)