ext_gpu_shader4: add compiler tests for everything
[piglit.git] / tests / spec / arb_copy_buffer / get.c
blobb9a2402b688ff3e954824cac9bbd8efb1cf386d9
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 DEALINGS
21 * IN THE SOFTWARE.
24 /** @file get.c
26 * Tests that the getters for the new binding points in GL_ARB_copy_buffer work.
29 #include "piglit-util-gl.h"
31 PIGLIT_GL_TEST_CONFIG_BEGIN
33 config.supports_gl_compat_version = 10;
35 config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
36 config.khr_no_error_support = PIGLIT_NO_ERRORS;
38 PIGLIT_GL_TEST_CONFIG_END
40 enum piglit_result
41 piglit_display(void)
43 /* uncreached */
44 return PIGLIT_FAIL;
47 void
48 piglit_init(int argc, char **argv)
50 GLuint bufs[2];
51 GLint get_bufs[2];
52 uint8_t data[8] = { 0 };
54 memset(get_bufs, 0xd0, sizeof(get_bufs));
56 piglit_require_extension("GL_ARB_copy_buffer");
58 glGetIntegerv(GL_COPY_READ_BUFFER, &get_bufs[0]);
59 glGetIntegerv(GL_COPY_WRITE_BUFFER, &get_bufs[1]);
61 if (get_bufs[0] != 0 || get_bufs[1] != 0) {
62 fprintf(stderr, "Initial copy read/write bindings %d/%d, "
63 "should be 0/0.\n",
64 get_bufs[0], get_bufs[1]);
65 piglit_report_result(PIGLIT_FAIL);
68 glGenBuffers(2, bufs);
69 glBindBuffer(GL_COPY_READ_BUFFER, bufs[0]);
70 glBufferData(GL_COPY_READ_BUFFER, sizeof(data), data, GL_DYNAMIC_DRAW);
71 glBindBuffer(GL_COPY_WRITE_BUFFER, bufs[1]);
72 glBufferData(GL_COPY_WRITE_BUFFER, sizeof(data), data, GL_DYNAMIC_DRAW);
74 glGetIntegerv(GL_COPY_READ_BUFFER, &get_bufs[0]);
75 glGetIntegerv(GL_COPY_WRITE_BUFFER, &get_bufs[1]);
77 if (bufs[0] != get_bufs[0]) {
78 fprintf(stderr, "GL_COPY_READ_BUFFER should return %d, returned %d\n",
79 bufs[0], get_bufs[0]);
80 piglit_report_result(PIGLIT_FAIL);
83 if (bufs[1] != get_bufs[1]) {
84 fprintf(stderr, "GL_COPY_WRITE_BUFFER should return %d, returned %d\n",
85 bufs[1], get_bufs[1]);
86 piglit_report_result(PIGLIT_FAIL);
89 piglit_report_result(PIGLIT_PASS);