[Piglit] [PATCH 4/4] readpixels-24_8: replace teximage use with renderbuffer

Ilia Mirkin imirkin at alum.mit.edu
Thu Mar 13 09:07:04 PDT 2014


This removes an implicit dependency on ARB_depth_texture (and is more
efficient).

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
 .../ext_packed_depth_stencil/readpixels-24_8.c     | 36 ++++++++++------------
 1 file changed, 16 insertions(+), 20 deletions(-)

diff --git a/tests/spec/ext_packed_depth_stencil/readpixels-24_8.c b/tests/spec/ext_packed_depth_stencil/readpixels-24_8.c
index 378be4f..656cf2e 100644
--- a/tests/spec/ext_packed_depth_stencil/readpixels-24_8.c
+++ b/tests/spec/ext_packed_depth_stencil/readpixels-24_8.c
@@ -75,7 +75,7 @@ test_pixel(int x, int y, uint32_t value)
 static bool
 test()
 {
-	GLuint tex, fb;
+	GLuint rb, fb;
 	GLenum status;
 	bool pass = true;
 	uint32_t values[BUF_WIDTH * BUF_HEIGHT];
@@ -85,24 +85,20 @@ test()
 	glBindFramebufferEXT(GL_FRAMEBUFFER, fb);
 	assert(glGetError() == 0);
 
-	glGenTextures(1, &tex);
-	glBindTexture(GL_TEXTURE_2D, tex);
-	glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8,
-		     BUF_WIDTH, BUF_HEIGHT, 0,
-		     GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, NULL);
-	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-
-	glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
-				  GL_DEPTH_ATTACHMENT_EXT,
-				  GL_TEXTURE_2D,
-				  tex,
-				  0);
-	glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
-				  GL_STENCIL_ATTACHMENT_EXT,
-				  GL_TEXTURE_2D,
-				  tex,
-				  0);
+	glGenRenderbuffersEXT(1, &rb);
+	glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb);
+	glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,
+				 GL_DEPTH24_STENCIL8,
+				 BUF_WIDTH, BUF_HEIGHT);
+
+	glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
+				     GL_DEPTH_ATTACHMENT_EXT,
+				     GL_RENDERBUFFER_EXT,
+				     rb);
+	glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
+				     GL_STENCIL_ATTACHMENT_EXT,
+				     GL_RENDERBUFFER_EXT,
+				     rb);
 
 	glDrawBuffer(GL_NONE);
 	glReadBuffer(GL_NONE);
@@ -147,7 +143,7 @@ test()
 
 done:
 	glDeleteFramebuffersEXT(1, &fb);
-	glDeleteTextures(1, &tex);
+	glDeleteRenderbuffersEXT(1, &rb);
 	return pass;
 }
 
-- 
1.8.3.2



More information about the Piglit mailing list