summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Forbes <chrisf@ijw.co.nz>2014-10-16 22:26:51 +1300
committerChris Forbes <chrisf@ijw.co.nz>2014-10-18 18:10:42 +1300
commit1fc4cc5bb383700f09b1e43dc0d6f038fc3e35a8 (patch)
treefb5ab31982cccf0be7c3da381d7ab845a5134bd6
parent5463580b07a2eee319eaf2944fd891e5095af481 (diff)
arb_base_instance: Fix core profile problems in drawarrays test
- Must create and use a VAO. - Vertex attributes may not be sourced from client memory. Signed-off-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Brian Paul <brianp@vmware.com>
-rw-r--r--tests/spec/arb_base_instance/drawarrays.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/spec/arb_base_instance/drawarrays.c b/tests/spec/arb_base_instance/drawarrays.c
index 2386be4be..140e3f70a 100644
--- a/tests/spec/arb_base_instance/drawarrays.c
+++ b/tests/spec/arb_base_instance/drawarrays.c
@@ -126,16 +126,26 @@ objpos_to_winpos(const float obj[2], int win[2])
static bool
test_instancing(GLuint divisor, GLuint baseInstance)
{
+ GLuint verts_bo, colors_bo;
+
static const GLfloat verts[4][2] = {
{-1, -1}, {1, -1}, {1, 1}, {-1, 1}
};
const GLuint numPrims = PRIMS - baseInstance;
GLint i, pos[2];
- glVertexAttribPointer(VertexAttrib, 2, GL_FLOAT, GL_FALSE, 0, verts);
+ glGenBuffers(1, &verts_bo);
+ glBindBuffer(GL_ARRAY_BUFFER, verts_bo);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(verts), verts, GL_STATIC_DRAW);
+
+ glVertexAttribPointer(VertexAttrib, 2, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArray(VertexAttrib);
- glVertexAttribPointer(ColorAttrib, 4, GL_FLOAT, GL_FALSE, 0, Colors);
+ glGenBuffers(1, &colors_bo);
+ glBindBuffer(GL_ARRAY_BUFFER, colors_bo);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(Colors), Colors, GL_STATIC_DRAW);
+
+ glVertexAttribPointer(ColorAttrib, 4, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArray(ColorAttrib);
/* advance color once every 'n' instances */
glVertexAttribDivisorARB(ColorAttrib, divisor);
@@ -168,6 +178,9 @@ test_instancing(GLuint divisor, GLuint baseInstance)
glDisableVertexAttribArray(VertexAttrib);
glDisableVertexAttribArray(ColorAttrib);
+ glDeleteBuffers(1, &verts_bo);
+ glDeleteBuffers(1, &colors_bo);
+
piglit_present_results();
return true;
@@ -193,6 +206,8 @@ piglit_display(void)
void
piglit_init(int argc, char **argv)
{
+ GLuint vao;
+
piglit_require_extension("GL_ARB_draw_instanced");
piglit_require_extension("GL_ARB_instanced_arrays");
piglit_require_extension("GL_ARB_base_instance");
@@ -223,4 +238,7 @@ piglit_init(int argc, char **argv)
piglit_matrix_mul_matrix(modelviewproj, modelview, projection);
glUniformMatrix4fv(MVPUniform, 1, GL_FALSE, modelviewproj);
+
+ glGenVertexArrays(1, &vao);
+ glBindVertexArray(vao);
}