summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2015-05-18 11:36:39 -0700
committerIan Romanick <ian.d.romanick@intel.com>2015-09-16 10:29:13 -0400
commit9dd554a4107b91b3cada6ed9126f87761950b623 (patch)
tree4cd121a9a22c9eab6a772981c99f1b6e9419872a /tests
parent3e040af49be51a09e5fea68cfbfe8e89782822f8 (diff)
arb_direct_state_access: Don't leak resources in texture-buffer
Every pass through piglit_display leaked a big pile of stuff. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Diffstat (limited to 'tests')
-rw-r--r--tests/spec/arb_direct_state_access/texture-buffer.c59
1 files changed, 32 insertions, 27 deletions
diff --git a/tests/spec/arb_direct_state_access/texture-buffer.c b/tests/spec/arb_direct_state_access/texture-buffer.c
index 58015b418..a82f27958 100644
--- a/tests/spec/arb_direct_state_access/texture-buffer.c
+++ b/tests/spec/arb_direct_state_access/texture-buffer.c
@@ -40,45 +40,40 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
PIGLIT_GL_VISUAL_RGBA;
PIGLIT_GL_TEST_CONFIG_END
+static const char vs_source[] =
+ "#version 140\n"
+ "in vec4 piglit_vertex;\n"
+ "void main()\n"
+ "{\n"
+ " gl_Position = piglit_vertex;\n"
+ "}\n"
+ ;
+
+static const char fs_source[] =
+ "#version 140\n"
+ "uniform samplerBuffer s;\n"
+ "void main()\n"
+ "{\n"
+ " gl_FragColor = texelFetch(s, 0);\n"
+ "}\n"
+ ;
+
+static GLuint prog;
+static GLuint tex;
+static GLuint bo;
+
enum piglit_result
piglit_display(void)
{
- static const char *vs_source =
- "#version 140\n"
- "in vec4 piglit_vertex;\n"
- "void main()\n"
- "{\n"
- " gl_Position = piglit_vertex;\n"
- "}\n";
-
- static const char *fs_source =
- "#version 140\n"
- "uniform samplerBuffer s;\n"
- "void main()\n"
- "{\n"
- " gl_FragColor = texelFetch(s, 0);\n"
- "}\n";
bool pass = true;
- GLuint tex, bo;
- GLuint prog;
static const float green[] = {0, 1, 0, 0};
static const float blue[] = {0, 0, 1, 0};
static const uint8_t g_rgba8[] = {0x00, 0xff, 0x00, 0x00};
static const uint8_t b_rgba8[] = {0x00, 0x00, 0xff, 0x00};
- prog = piglit_build_simple_program(vs_source, fs_source);
- glUseProgram(prog);
-
- glGenBuffers(1, &bo);
- glBindBuffer(GL_TEXTURE_BUFFER, bo);
glBufferData(GL_TEXTURE_BUFFER, sizeof(g_rgba8), g_rgba8,
GL_STREAM_DRAW);
-
- glCreateTextures(GL_TEXTURE_BUFFER, 1, &tex);
- glTextureBuffer(tex, GL_RGBA8, bo);
- glBindTextureUnit(0, tex);
-
piglit_draw_rect(-1, -1, 1, 2);
glBufferData(GL_TEXTURE_BUFFER, sizeof(b_rgba8), b_rgba8,
GL_STREAM_DRAW);
@@ -105,4 +100,14 @@ piglit_init(int argc, char **argv)
piglit_require_GLSL_version(140);
if (piglit_get_gl_version() < 31)
piglit_require_extension("GL_ARB_texture_buffer_object");
+
+ prog = piglit_build_simple_program(vs_source, fs_source);
+ glUseProgram(prog);
+
+ glGenBuffers(1, &bo);
+ glBindBuffer(GL_TEXTURE_BUFFER, bo);
+
+ glCreateTextures(GL_TEXTURE_BUFFER, 1, &tex);
+ glTextureBuffer(tex, GL_RGBA8, bo);
+ glBindTextureUnit(0, tex);
}