<p dir="ltr">This one is missing all.py, no?</p>
<div class="gmail_quote">On Oct 30, 2015 12:23, "Ryan Houdek" <<a href="mailto:sonicadvance1@gmail.com">sonicadvance1@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
tests/spec/CMakeLists.txt | 1 +<br>
.../CMakeLists.gles2.txt | 14 ++<br>
.../oes_draw_elements_base_vertex/CMakeLists.txt | 1 +<br>
.../drawelements-instanced.c | 190 +++++++++++++++++++++<br>
.../oes_draw_elements_base_vertex/drawelements.c | 181 ++++++++++++++++++++<br>
.../drawrangeelements.c | 143 ++++++++++++++++<br>
.../multidrawelements.c | 175 +++++++++++++++++++<br>
7 files changed, 705 insertions(+)<br>
create mode 100644 tests/spec/oes_draw_elements_base_vertex/CMakeLists.gles2.txt<br>
create mode 100644 tests/spec/oes_draw_elements_base_vertex/CMakeLists.txt<br>
create mode 100644 tests/spec/oes_draw_elements_base_vertex/drawelements-instanced.c<br>
create mode 100644 tests/spec/oes_draw_elements_base_vertex/drawelements.c<br>
create mode 100644 tests/spec/oes_draw_elements_base_vertex/drawrangeelements.c<br>
create mode 100644 tests/spec/oes_draw_elements_base_vertex/multidrawelements.c<br>
<br>
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt<br>
index 61f013a..eeedc4c 100644<br>
--- a/tests/spec/CMakeLists.txt<br>
+++ b/tests/spec/CMakeLists.txt<br>
@@ -135,3 +135,4 @@ add_subdirectory (arb_vertex_attrib_64bit)<br>
add_subdirectory (ext_framebuffer_blit)<br>
add_subdirectory (mesa_pack_invert)<br>
add_subdirectory (ext_texture_format_bgra8888)<br>
+add_subdirectory (oes_draw_elements_base_vertex)<br>
diff --git a/tests/spec/oes_draw_elements_base_vertex/CMakeLists.gles2.txt b/tests/spec/oes_draw_elements_base_vertex/CMakeLists.gles2.txt<br>
new file mode 100644<br>
index 0000000..bd50394<br>
--- /dev/null<br>
+++ b/tests/spec/oes_draw_elements_base_vertex/CMakeLists.gles2.txt<br>
@@ -0,0 +1,14 @@<br>
+include_directories(<br>
+ ${GLEXT_INCLUDE_DIR}<br>
+ ${OPENGL_INCLUDE_PATH}<br>
+)<br>
+<br>
+link_libraries (<br>
+ piglitutil_${piglit_target_api}<br>
+ ${OPENGL_gl_LIBRARY}<br>
+)<br>
+<br>
+piglit_add_executable (oes_draw_elements_base_vertex-drawelements drawelements.c)<br>
+piglit_add_executable (oes_draw_elements_base_vertex-drawrangeelements drawrangeelements.c)<br>
+piglit_add_executable (oes_draw_elements_base_vertex-drawelements-instanced drawelements-instanced.c)<br>
+piglit_add_executable (oes_draw_elements_base_vertex-multidrawelements multidrawelements.c)<br>
diff --git a/tests/spec/oes_draw_elements_base_vertex/CMakeLists.txt b/tests/spec/oes_draw_elements_base_vertex/CMakeLists.txt<br>
new file mode 100644<br>
index 0000000..144a306<br>
--- /dev/null<br>
+++ b/tests/spec/oes_draw_elements_base_vertex/CMakeLists.txt<br>
@@ -0,0 +1 @@<br>
+piglit_include_target_api()<br>
diff --git a/tests/spec/oes_draw_elements_base_vertex/drawelements-instanced.c b/tests/spec/oes_draw_elements_base_vertex/drawelements-instanced.c<br>
new file mode 100644<br>
index 0000000..71cfc29<br>
--- /dev/null<br>
+++ b/tests/spec/oes_draw_elements_base_vertex/drawelements-instanced.c<br>
@@ -0,0 +1,190 @@<br>
+/*<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the "Software"),<br>
+ * to deal in the Software without restriction, including without limitation<br>
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
+ * and/or sell copies of the Software, and to permit persons to whom the<br>
+ * Software is furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice (including the next<br>
+ * paragraph) shall be included in all copies or substantial portions of the<br>
+ * Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL<br>
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS<br>
+ * IN THE SOFTWARE.<br>
+ *<br>
+ */<br>
+<br>
+/* Tests OES_draw_elements_base_vertex functionality by drawing a checkerboard<br>
+ * of quads using different base vertices using the same vertex and<br>
+ * index buffers and instancing<br>
+ */<br>
+<br>
+#include "piglit-util-gl.h"<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_BEGIN<br>
+<br>
+ config.supports_gl_es_version = 30;<br>
+<br>
+ config.window_width = 300;<br>
+ config.window_height = 300;<br>
+ config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_END<br>
+<br>
+#define NUM_QUADS 10<br>
+const GLfloat inc_amount = 2.0 / NUM_QUADS;<br>
+const int window_width = 300;<br>
+const int window_height = 300;<br>
+<br>
+const char *vs_source = {<br>
+ "#version 300 es\n"<br>
+ "in vec2 vertex;\n"<br>
+ "in float xOffsetPerInstance;\n"<br>
+ "void main() {\n"<br>
+ " vec2 p = vertex;\n"<br>
+ " p.y -= 1.0 * float(gl_InstanceID);\n"<br>
+ " p.x += xOffsetPerInstance * float(gl_InstanceID);\n"<br>
+ " gl_Position = vec4(p, 0, 1);\n"<br>
+ "}\n"<br>
+};<br>
+<br>
+const char *fs_source = {<br>
+ "#version 300 es\n"<br>
+ "out highp vec4 ocol;\n"<br>
+ "void main() {\n"<br>
+ " ocol = vec4(1, 1, 1, 1);\n"<br>
+ "}\n"<br>
+};<br>
+<br>
+static GLushort indices[] = {<br>
+ 0, 1, 2, 1, 2, 3<br>
+};<br>
+static GLsizei indices_size = sizeof(indices);<br>
+<br>
+static GLuint vao;<br>
+static GLuint vertexBuffer;<br>
+static GLuint indexBuffer;<br>
+<br>
+void<br>
+piglit_init(int argc, char **argv)<br>
+{<br>
+ piglit_require_extension("GL_OES_draw_elements_base_vertex");<br>
+<br>
+ GLuint program;<br>
+ GLuint vertex_index;<br>
+ GLuint xoffset_index;<br>
+<br>
+ GLfloat* vertices = malloc(4 * 2 * NUM_QUADS * sizeof(GLfloat));<br>
+ GLsizei vertices_size = 4 * 2 * NUM_QUADS * sizeof(GLfloat);<br>
+<br>
+ // Generate a checkerboard pattern<br>
+ // |x x x x x |<br>
+ // | x x x x x|<br>
+ int i;<br>
+ for (i = 0; i < NUM_QUADS; ++i)<br>
+ {<br>
+ GLfloat xoffset, yoffset;<br>
+ GLfloat x[4], y[4];<br>
+<br>
+ xoffset = inc_amount * i - 1.0;<br>
+ yoffset = 1.0;<br>
+<br>
+ // Top-left<br>
+ x[0] = xoffset;<br>
+ y[0] = yoffset;<br>
+<br>
+ // Top-right<br>
+ x[1] = xoffset + inc_amount / 2.0;<br>
+ y[1] = yoffset;<br>
+<br>
+ // Bottom-left<br>
+ x[2] = xoffset;<br>
+ y[2] = yoffset - 1.0;<br>
+<br>
+ // Bottom-right<br>
+ x[3] = xoffset + inc_amount / 2.0;<br>
+ y[3] = yoffset - 1.0;<br>
+<br>
+ vertices[i * 8 + 0] = x[0];<br>
+ vertices[i * 8 + 1] = y[0];<br>
+<br>
+ vertices[i * 8 + 2] = x[1];<br>
+ vertices[i * 8 + 3] = y[1];<br>
+<br>
+ vertices[i * 8 + 4] = x[2];<br>
+ vertices[i * 8 + 5] = y[2];<br>
+<br>
+ vertices[i * 8 + 6] = x[3];<br>
+ vertices[i * 8 + 7] = y[3];<br>
+ }<br>
+<br>
+ /* Create program */<br>
+ program = piglit_build_simple_program(vs_source, fs_source);<br>
+ glUseProgram(program);<br>
+<br>
+ /* Gen vertex array buffer */<br>
+ glGenBuffers(1, &vertexBuffer);<br>
+ glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);<br>
+ glBufferData(GL_ARRAY_BUFFER, vertices_size, vertices, GL_STATIC_DRAW);<br>
+<br>
+ /* Gen indices array buffer */<br>
+ glGenBuffers(1, &indexBuffer);<br>
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);<br>
+ glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices_size,<br>
+ indices, GL_STATIC_DRAW);<br>
+<br>
+ /* Gen VAO */<br>
+ glGenVertexArrays(1, &vao);<br>
+ glBindVertexArray(vao);<br>
+<br>
+ xoffset_index = glGetAttribLocation(program, "xOffsetPerInstance");<br>
+ glVertexAttrib1f(xoffset_index, inc_amount / 2.0);<br>
+<br>
+ /* Retrieve indices from vs */<br>
+ vertex_index = glGetAttribLocation(program, "vertex");<br>
+<br>
+ /* Enable vertex attrib array */<br>
+ glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);<br>
+ glEnableVertexAttribArray(vertex_index);<br>
+ glVertexAttribPointer(vertex_index, 2, GL_FLOAT, GL_FALSE, 0, 0);<br>
+}<br>
+<br>
+enum piglit_result<br>
+piglit_display(void)<br>
+{<br>
+ GLboolean pass = GL_TRUE;<br>
+ float white[] = {1.0, 1.0, 1.0, 1.0};<br>
+ int i;<br>
+<br>
+ glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+ glBindVertexArray(vao);<br>
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);<br>
+<br>
+ for (i = 0; i < NUM_QUADS; ++i)<br>
+ glDrawElementsInstancedBaseVertexOES(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, NULL, 2, i * 4);<br>
+<br>
+ for (i = 0; i < (NUM_QUADS * 2); ++i)<br>
+ {<br>
+ GLfloat xoffset[2], yoffset[2];<br>
+<br>
+ xoffset[0] = inc_amount * i / 4.0 * window_width;<br>
+ xoffset[1] = inc_amount * (i + 1) / 4.0 * window_width;<br>
+ yoffset[0] = (i % 2 ? 0.0 : 0.5) * window_height;<br>
+ yoffset[1] = yoffset[0] + window_height / 2;<br>
+<br>
+ pass = piglit_probe_rect_rgba(xoffset[0], yoffset[0],<br>
+ xoffset[1] - xoffset[0], yoffset[1] - yoffset[0], white) && pass;<br>
+ }<br>
+<br>
+ piglit_present_results();<br>
+<br>
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
+}<br>
diff --git a/tests/spec/oes_draw_elements_base_vertex/drawelements.c b/tests/spec/oes_draw_elements_base_vertex/drawelements.c<br>
new file mode 100644<br>
index 0000000..0333d8e<br>
--- /dev/null<br>
+++ b/tests/spec/oes_draw_elements_base_vertex/drawelements.c<br>
@@ -0,0 +1,181 @@<br>
+/*<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the "Software"),<br>
+ * to deal in the Software without restriction, including without limitation<br>
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
+ * and/or sell copies of the Software, and to permit persons to whom the<br>
+ * Software is furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice (including the next<br>
+ * paragraph) shall be included in all copies or substantial portions of the<br>
+ * Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL<br>
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS<br>
+ * IN THE SOFTWARE.<br>
+ *<br>
+ */<br>
+<br>
+/* Tests OES_draw_elements_base_vertex functionality by drawing a checkerboard<br>
+ * of quads using different base vertices using the same vertex and<br>
+ * index buffers<br>
+ */<br>
+<br>
+#include "piglit-util-gl.h"<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_BEGIN<br>
+<br>
+ config.supports_gl_es_version = 20;<br>
+<br>
+ config.window_width = 300;<br>
+ config.window_height = 300;<br>
+ config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_END<br>
+<br>
+#define NUM_QUADS 10<br>
+const GLfloat inc_amount = 2.0 / NUM_QUADS;<br>
+const int window_width = 300;<br>
+const int window_height = 300;<br>
+<br>
+const char *vs_source = {<br>
+ "#version 100\n"<br>
+ "attribute vec2 vertex;\n"<br>
+ "void main() {\n"<br>
+ " gl_Position = vec4(vertex.xy, 0, 1);\n"<br>
+ "}\n"<br>
+};<br>
+<br>
+const char *fs_source = {<br>
+ "#version 100\n"<br>
+ "void main() {\n"<br>
+ " gl_FragColor = vec4(1, 1, 1, 1);\n"<br>
+ "}\n"<br>
+};<br>
+<br>
+static GLushort indices[] = {<br>
+ 0, 1, 2, 1, 2, 3<br>
+};<br>
+static GLsizei indices_size = sizeof(indices);<br>
+<br>
+static GLuint vao;<br>
+static GLuint vertexBuffer;<br>
+static GLuint indexBuffer;<br>
+<br>
+void<br>
+piglit_init(int argc, char **argv)<br>
+{<br>
+ piglit_require_extension("GL_OES_draw_elements_base_vertex");<br>
+<br>
+ GLuint program;<br>
+ GLuint vertex_index;<br>
+<br>
+ GLfloat* vertices = malloc(4 * 2 * NUM_QUADS * sizeof(GLfloat));<br>
+ GLsizei vertices_size = 4 * 2 * NUM_QUADS * sizeof(GLfloat);<br>
+<br>
+ // Generate a checkerboard pattern<br>
+ // |x x x x x |<br>
+ // | x x x x x|<br>
+ int i;<br>
+ for (i = 0; i < NUM_QUADS; ++i)<br>
+ {<br>
+ GLfloat xoffset, yoffset;<br>
+ GLfloat x[4], y[4];<br>
+<br>
+ xoffset = inc_amount * i - 1.0;<br>
+ yoffset = i % 2 ? 0.0 : 1.0;<br>
+<br>
+ // Top-left<br>
+ x[0] = xoffset;<br>
+ y[0] = yoffset;<br>
+<br>
+ // Top-right<br>
+ x[1] = xoffset + inc_amount;<br>
+ y[1] = yoffset;<br>
+<br>
+ // Bottom-left<br>
+ x[2] = xoffset;<br>
+ y[2] = yoffset - 1.0;<br>
+<br>
+ // Bottom-right<br>
+ x[3] = xoffset + inc_amount;<br>
+ y[3] = yoffset - 1.0;<br>
+<br>
+ vertices[i * 8 + 0] = x[0];<br>
+ vertices[i * 8 + 1] = y[0];<br>
+<br>
+ vertices[i * 8 + 2] = x[1];<br>
+ vertices[i * 8 + 3] = y[1];<br>
+<br>
+ vertices[i * 8 + 4] = x[2];<br>
+ vertices[i * 8 + 5] = y[2];<br>
+<br>
+ vertices[i * 8 + 6] = x[3];<br>
+ vertices[i * 8 + 7] = y[3];<br>
+ }<br>
+<br>
+ /* Create program */<br>
+ program = piglit_build_simple_program(vs_source, fs_source);<br>
+ glUseProgram(program);<br>
+<br>
+ /* Gen vertex array buffer */<br>
+ glGenBuffers(1, &vertexBuffer);<br>
+ glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);<br>
+ glBufferData(GL_ARRAY_BUFFER, vertices_size, vertices, GL_STATIC_DRAW);<br>
+<br>
+ /* Gen indices array buffer */<br>
+ glGenBuffers(1, &indexBuffer);<br>
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);<br>
+ glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices_size,<br>
+ indices, GL_STATIC_DRAW);<br>
+<br>
+ /* Gen VAO */<br>
+ glGenVertexArrays(1, &vao);<br>
+ glBindVertexArray(vao);<br>
+<br>
+ /* Retrieve indices from vs */<br>
+ vertex_index = glGetAttribLocation(program, "vertex");<br>
+<br>
+ /* Enable vertex attrib array */<br>
+ glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);<br>
+ glEnableVertexAttribArray(vertex_index);<br>
+ glVertexAttribPointer(vertex_index, 2, GL_FLOAT, GL_FALSE, 0, 0);<br>
+}<br>
+<br>
+enum piglit_result<br>
+piglit_display(void)<br>
+{<br>
+ GLboolean pass = GL_TRUE;<br>
+ float white[] = {1.0, 1.0, 1.0, 1.0};<br>
+ int i;<br>
+<br>
+ glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+ glBindVertexArray(vao);<br>
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);<br>
+<br>
+ for (i = 0; i < NUM_QUADS; ++i)<br>
+ glDrawElementsBaseVertexOES(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, NULL, i * 4);<br>
+<br>
+ for (i = 0; i < NUM_QUADS; ++i)<br>
+ {<br>
+ GLfloat xoffset[2], yoffset[2];<br>
+<br>
+ xoffset[0] = inc_amount * i / 2.0 * window_width;<br>
+ xoffset[1] = inc_amount * (i + 1) / 2.0 * window_width;<br>
+ yoffset[0] = (i % 2 ? 0.0 : 0.5) * window_height;<br>
+ yoffset[1] = yoffset[0] + window_height / 2;<br>
+<br>
+ pass = piglit_probe_rect_rgba(xoffset[0], yoffset[0],<br>
+ xoffset[1] - xoffset[0], yoffset[1] - yoffset[0], white) && pass;<br>
+ }<br>
+<br>
+ piglit_present_results();<br>
+<br>
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
+}<br>
diff --git a/tests/spec/oes_draw_elements_base_vertex/drawrangeelements.c b/tests/spec/oes_draw_elements_base_vertex/drawrangeelements.c<br>
new file mode 100644<br>
index 0000000..6042c72<br>
--- /dev/null<br>
+++ b/tests/spec/oes_draw_elements_base_vertex/drawrangeelements.c<br>
@@ -0,0 +1,143 @@<br>
+/*<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the "Software"),<br>
+ * to deal in the Software without restriction, including without limitation<br>
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
+ * and/or sell copies of the Software, and to permit persons to whom the<br>
+ * Software is furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice (including the next<br>
+ * paragraph) shall be included in all copies or substantial portions of the<br>
+ * Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL<br>
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS<br>
+ * IN THE SOFTWARE.<br>
+ */<br>
+<br>
+#include "piglit-util-gl.h"<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_BEGIN<br>
+<br>
+ config.supports_gl_es_version = 30;<br>
+<br>
+ config.window_width = 200;<br>
+ config.window_height = 200;<br>
+ config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_END<br>
+<br>
+const char *vs_source = {<br>
+ "#version 300 es\n"<br>
+ "in vec2 vertex;\n"<br>
+ "void main() {\n"<br>
+ " gl_Position = vec4(vertex.xy, 0, 1);\n"<br>
+ "}\n"<br>
+};<br>
+<br>
+const char *fs_source = {<br>
+ "#version 300 es\n"<br>
+ "out highp vec4 ocol;\n"<br>
+ "void main() {\n"<br>
+ " ocol = vec4(0, 1, 0, 1);\n"<br>
+ "}\n"<br>
+};<br>
+<br>
+static GLuint vao;<br>
+static GLuint vertexBuffer;<br>
+static GLuint indexBuffer;<br>
+<br>
+/* sets of two (x,y) */<br>
+static GLfloat vertices[] = {<br>
+ -1.0, 1.0,<br>
+ 1.0, 1.0,<br>
+ -1.0, 0.5,<br>
+ 1.0, 0.5,<br>
+ -1.0, 0.0,<br>
+ 1.0, 0.0,<br>
+ -1.0,-0.5,<br>
+ 1.0,-0.5,<br>
+ -1.0,-1.0,<br>
+ 1.0,-1.0<br>
+};<br>
+static GLsizei vertices_size = sizeof(vertices);<br>
+<br>
+static GLushort indices[] = {<br>
+ 0, 1, 2, 1, 2, 3, /* Top Quad */<br>
+ 4, 5, 6, 5, 6, 7, /* Bot Quad */<br>
+};<br>
+static GLsizei indices_size = sizeof(indices);<br>
+<br>
+void<br>
+piglit_init(int argc, char **argv)<br>
+{<br>
+ GLuint program;<br>
+ GLuint vertex_index;<br>
+<br>
+ piglit_require_extension("GL_OES_draw_elements_base_vertex");<br>
+<br>
+ /* Create program */<br>
+ program = piglit_build_simple_program(vs_source, fs_source);<br>
+ glUseProgram(program);<br>
+<br>
+ /* Gen vertex array buffer */<br>
+ glGenBuffers(1, &vertexBuffer);<br>
+ glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);<br>
+ glBufferData(GL_ARRAY_BUFFER, vertices_size, vertices, GL_STATIC_DRAW);<br>
+<br>
+ /* Gen indices array buffer */<br>
+ glGenBuffers(1, &indexBuffer);<br>
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);<br>
+ glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices_size,<br>
+ indices, GL_STATIC_DRAW);<br>
+<br>
+ /* Gen VAO */<br>
+ glGenVertexArrays(1, &vao);<br>
+ glBindVertexArray(vao);<br>
+<br>
+ /* Retrieve indices from vs */<br>
+ vertex_index = glGetAttribLocation(program, "vertex");<br>
+<br>
+ /* Enable vertex attrib array */<br>
+ glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);<br>
+ glEnableVertexAttribArray(vertex_index);<br>
+ glVertexAttribPointer(vertex_index, 2, GL_FLOAT, GL_FALSE, 0, 0);<br>
+}<br>
+<br>
+enum piglit_result<br>
+piglit_display(void)<br>
+{<br>
+ bool pass = true;<br>
+<br>
+ float green[] = {0, 1, 0, 1};<br>
+ float blue[] = {0, 0, 1, 1};<br>
+<br>
+ glClearColor(blue[0], blue[1], blue[2], 1.0);<br>
+ glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+ glBindVertexArray(vao);<br>
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);<br>
+<br>
+ /* Top Quad */<br>
+ glDrawRangeElementsBaseVertexOES(GL_TRIANGLES, 0, 3, 6, GL_UNSIGNED_SHORT,<br>
+ NULL, 0);<br>
+<br>
+ /* Bot Quad */<br>
+ glDrawRangeElementsBaseVertexOES(GL_TRIANGLES, 4, 7, 6, GL_UNSIGNED_SHORT,<br>
+ (GLvoid *)(sizeof(GLushort)*6), 2);<br>
+<br>
+ /* Check for test pass */<br>
+ pass = piglit_probe_pixel_rgba(100, 175, green) && pass;<br>
+ pass = piglit_probe_pixel_rgba(100, 125, blue) && pass;<br>
+ pass = piglit_probe_pixel_rgba(100, 75, blue) && pass;<br>
+ pass = piglit_probe_pixel_rgba(100, 25, green) && pass;<br>
+<br>
+ piglit_present_results();<br>
+<br>
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
+}<br>
diff --git a/tests/spec/oes_draw_elements_base_vertex/multidrawelements.c b/tests/spec/oes_draw_elements_base_vertex/multidrawelements.c<br>
new file mode 100644<br>
index 0000000..8b6d5c0<br>
--- /dev/null<br>
+++ b/tests/spec/oes_draw_elements_base_vertex/multidrawelements.c<br>
@@ -0,0 +1,175 @@<br>
+/*<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the "Software"),<br>
+ * to deal in the Software without restriction, including without limitation<br>
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
+ * and/or sell copies of the Software, and to permit persons to whom the<br>
+ * Software is furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice (including the next<br>
+ * paragraph) shall be included in all copies or substantial portions of the<br>
+ * Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL<br>
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS<br>
+ * IN THE SOFTWARE.<br>
+ *<br>
+ */<br>
+<br>
+/**<br>
+ *<br>
+ * (0)-------(1) Set up indices for quad 1 and 3.<br>
+ * | 1 |<br>
+ * (2)-------(3) Use a basevertex of 2 to shift<br>
+ * | 2 | indices from quad 1 to 2 and<br>
+ * (4)-------(5) from quad 3 to 4<br>
+ * | 3 |<br>
+ * (6)-------(7) End result 1 and 3 should be<br>
+ * | 4 | blue while 2 and 4 are green.<br>
+ * (8)-------(9)<br>
+ *<br>
+ *<br>
+ * MultiDrawElementsBaseVertex behaves identically to<br>
+ * DrawElementsBaseVertex, except that primcount separate<br>
+ * lists of elements are specified instead. It has the<br>
+ * same effect as:<br>
+ *<br>
+ * for (int i = 0; i < primcount ; i++)<br>
+ * if (count[i] > 0)<br>
+ * DrawElementsBaseVertex(mode, count[i], type,<br>
+ * indices[i], basevertex[i]);<br>
+ *<br>
+ */<br>
+<br>
+#include "piglit-util-gl.h"<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_BEGIN<br>
+<br>
+ config.supports_gl_es_version = 20;<br>
+<br>
+ config.window_width = 200;<br>
+ config.window_height = 200;<br>
+ config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_END<br>
+<br>
+const char *vs_source = {<br>
+ "#version 100\n"<br>
+ "attribute vec2 vertex;\n"<br>
+ "void main() {\n"<br>
+ " gl_Position = vec4(vertex.xy, 0, 1);\n"<br>
+ "}\n"<br>
+};<br>
+<br>
+const char *fs_source = {<br>
+ "#version 100\n"<br>
+ "void main() {\n"<br>
+ " gl_FragColor = vec4(0, 1, 0, 1);\n"<br>
+ "}\n"<br>
+};<br>
+static GLuint vao;<br>
+static GLuint vertexBuffer;<br>
+static GLuint indexBuffer;<br>
+<br>
+/*<br>
+ * sets of two (x,y)<br>
+ */<br>
+static GLfloat vertices[] = {<br>
+ -1.0, 1.0,<br>
+ 1.0, 1.0,<br>
+ -1.0, 0.5,<br>
+ 1.0, 0.5,<br>
+ -1.0, 0.0,<br>
+ 1.0, 0.0,<br>
+ -1.0,-0.5,<br>
+ 1.0,-0.5,<br>
+ -1.0,-1.0,<br>
+ 1.0,-1.0<br>
+};<br>
+static GLsizei vertices_size = sizeof(vertices);<br>
+<br>
+static GLushort indices[] = {<br>
+ 0, 1, 2, 1, 2, 3, /* top square */<br>
+ 4, 5, 6, 5, 6, 7, /* bot square */<br>
+};<br>
+static GLsizei indices_size = sizeof(indices);<br>
+<br>
+static const GLvoid * const indices_offset[] = {<br>
+ (GLvoid*) 0, (GLvoid*)(6 * sizeof(GLushort))<br>
+};<br>
+static GLsizei indices_count[] = {<br>
+ 6, 6<br>
+};<br>
+<br>
+static GLint basevertex[] = { 2, 2 };<br>
+<br>
+void<br>
+piglit_init(int argc, char **argv)<br>
+{<br>
+ GLuint program;<br>
+ GLuint vertex_index;<br>
+<br>
+ piglit_require_extension("GL_OES_draw_elements_base_vertex");<br>
+ piglit_require_extension("GL_EXT_multi_draw_arrays");<br>
+<br>
+ /* Create program */<br>
+ program = piglit_build_simple_program(vs_source, fs_source);<br>
+ glUseProgram(program);<br>
+<br>
+ /* Gen vertex array buffer */<br>
+ glGenBuffers(1, &vertexBuffer);<br>
+ glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);<br>
+ glBufferData(GL_ARRAY_BUFFER, vertices_size, vertices, GL_STATIC_DRAW);<br>
+<br>
+ /* Gen indices array buffer */<br>
+ glGenBuffers(1, &indexBuffer);<br>
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);<br>
+ glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices_size,<br>
+ indices, GL_STATIC_DRAW);<br>
+<br>
+ /* Gen VAO */<br>
+ glGenVertexArrays(1, &vao);<br>
+ glBindVertexArray(vao);<br>
+<br>
+ /* Retrieve indices from vs */<br>
+ vertex_index = glGetAttribLocation(program, "vertex");<br>
+<br>
+ /* Enable vertex attrib array */<br>
+ glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);<br>
+ glEnableVertexAttribArray(vertex_index);<br>
+ glVertexAttribPointer(vertex_index, 2, GL_FLOAT, GL_FALSE, 0, 0);<br>
+}<br>
+<br>
+enum piglit_result<br>
+piglit_display(void)<br>
+{<br>
+ bool pass = true;<br>
+<br>
+ float green[] = {0, 1, 0, 1};<br>
+ float blue[] = {0, 0, 1, 1};<br>
+<br>
+ glClearColor(blue[0], blue[1], blue[2], 1.0);<br>
+ glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+ glBindVertexArray(vao);<br>
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);<br>
+<br>
+ glMultiDrawElementsBaseVertexEXT(GL_TRIANGLES, indices_count,<br>
+ GL_UNSIGNED_SHORT, (GLvoid*)indices_offset,<br>
+ 2, basevertex);<br>
+<br>
+ /* Check for test pass */<br>
+ pass = piglit_probe_pixel_rgba(100, 175, blue) && pass;<br>
+ pass = piglit_probe_pixel_rgba(100, 125, green) && pass;<br>
+ pass = piglit_probe_pixel_rgba(100, 75, blue) && pass;<br>
+ pass = piglit_probe_pixel_rgba(100, 25, green) && pass;<br>
+<br>
+ piglit_present_results();<br>
+<br>
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
+}<br>
--<br>
1.9.1<br>
<br>
_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org">Piglit@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/piglit" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
</blockquote></div>