ext_gpu_shader4: add compiler tests for everything
[piglit.git] / tests / spec / arb_vertex_buffer_object / ib-subdata-sync.c
blob09079a49070324d57fbebc4aef4e5d6994d42946
1 /*
2 * Copyright © 2013 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 #include "piglit-util-gl.h"
26 PIGLIT_GL_TEST_CONFIG_BEGIN
28 config.supports_gl_compat_version = 10;
30 config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
31 config.khr_no_error_support = PIGLIT_NO_ERRORS;
33 PIGLIT_GL_TEST_CONFIG_END
35 enum piglit_result
36 piglit_display(void)
38 float verts[] = {
39 -1, -1,
40 0, -1,
41 0, 1,
42 -1, 1,
44 0, -1,
45 1, -1,
46 1, 1,
47 0, 1,
49 uint32_t ib_1[] = {0, 1, 2, 3};
50 uint32_t ib_2[] = {4, 5, 6, 7};
52 bool pass = true;
53 size_t size = sizeof(ib_1);
54 GLuint vbo, ibo;
55 float green[] = {0, 1, 0, 0};
57 glColor4fv(green);
59 glGenBuffersARB(1, &vbo);
60 glBindBufferARB(GL_ARRAY_BUFFER, vbo);
61 glBufferData(GL_ARRAY_BUFFER, sizeof(verts), verts, GL_STREAM_DRAW);
62 glEnableClientState(GL_VERTEX_ARRAY);
63 glVertexPointer(2, GL_FLOAT, 0, NULL);
65 glGenBuffersARB(1, &ibo);
66 glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER, ibo);
67 glBufferData(GL_ELEMENT_ARRAY_BUFFER, 4096, NULL, GL_STREAM_DRAW);
69 glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, size, ib_1);
70 glDrawElements(GL_TRIANGLE_FAN, 4, GL_UNSIGNED_INT, NULL);
71 glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, size, ib_2);
72 glDrawElements(GL_TRIANGLE_FAN, 4, GL_UNSIGNED_INT, NULL);
74 pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green);
76 piglit_present_results();
78 return pass ? PIGLIT_PASS : PIGLIT_FAIL;
81 void
82 piglit_init(int argc, char *argv[])
84 piglit_require_extension("GL_ARB_vertex_buffer_object");