summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2012-11-01 11:26:18 -0700
committerEric Anholt <eric@anholt.net>2012-11-14 11:36:36 -0800
commit634e486ab2846c8f4d79126d4fea29240212a4db (patch)
tree0fc0b9d9adc29a404d9f998f756f8289f3b172be
parent1e5f8ac5d1392946bc8837f7bbe55481b8b728f9 (diff)
textureSize: Add support for running with core GL.
This lets the textureSize tests for TBOs run on i965. Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
-rw-r--r--tests/texturing/shaders/textureSize.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/texturing/shaders/textureSize.c b/tests/texturing/shaders/textureSize.c
index 98191b83..91684584 100644
--- a/tests/texturing/shaders/textureSize.c
+++ b/tests/texturing/shaders/textureSize.c
@@ -49,6 +49,7 @@
PIGLIT_GL_TEST_CONFIG_BEGIN
config.supports_gl_compat_version = 10;
+ config.supports_gl_core_version = 31;
config.window_width = 150;
config.window_height = 30;
@@ -98,11 +99,25 @@ piglit_display()
1, 1,
1, -1,
};
+ GLuint vbo;
glClearColor(0.5, 0.5, 0.5, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
- glVertexAttribPointer(vertex_location, 2, GL_FLOAT, GL_FALSE, 0, verts);
+ /* For GL core, we need to have a vertex array object bound.
+ * Otherwise, we don't particularly have to. Always use a
+ * vertex buffer object, though.
+ */
+ if (piglit_get_gl_version() >= 31) {
+ GLuint vao;
+ glGenVertexArrays(1, &vao);
+ glBindVertexArray(vao);
+ }
+ glGenBuffers(1, &vbo);
+ glBindBuffer(GL_ARRAY_BUFFER, vbo);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(verts), verts, GL_STREAM_DRAW);
+
+ glVertexAttribPointer(vertex_location, 2, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArray(vertex_location);
/* Draw consecutive squares for each mipmap level */
@@ -130,7 +145,6 @@ piglit_display()
}
glDisableVertexAttribArray(vertex_location);
-
piglit_present_results();
return pass ? PIGLIT_PASS : PIGLIT_FAIL;