[Piglit] [PATCH 6/7] stencil_texturing: Use piglit_depth_texture()

Topi Pohjolainen topi.pohjolainen at intel.com
Thu Apr 28 19:17:09 UTC 2016


Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 tests/spec/arb_stencil_texturing/draw.c | 40 +++++----------------------------
 1 file changed, 6 insertions(+), 34 deletions(-)

diff --git a/tests/spec/arb_stencil_texturing/draw.c b/tests/spec/arb_stencil_texturing/draw.c
index 9353240..c4152c9 100644
--- a/tests/spec/arb_stencil_texturing/draw.c
+++ b/tests/spec/arb_stencil_texturing/draw.c
@@ -143,17 +143,6 @@ piglit_display(void)
 /******************************************************************************/
 
 /**
- * Pack a floating point depth value and 8-bit stencil value into
- * GL_UNSIGNED_INT24_S8 data.
- */
-uint32_t
-pack_z24_s8(float z, uint8_t s)
-{
-	uint32_t z24 = z * (double) 0xffffff;
-	return (z24 << 8) | s;
-}
-
-/**
  * Generate two textures containing gradients:
  * - Depth ranges from 0.0 to 1.0.
  * - Stencil ranges from 0 to 255.
@@ -167,33 +156,16 @@ static void
 setup_textures(void)
 {
 	int i;
-	uint32_t horiz_data[256 * 256];
-	uint32_t vert_data[256 * 256];
-
-	for (i = 0; i < ARRAY_SIZE(horiz_data); i++) {
-		unsigned x = i % 256;
-		unsigned y = i / 256;
-		horiz_data[i] = pack_z24_s8(x / 255.0f, x);
-		vert_data[i] = pack_z24_s8(y / 255.0f, y);
-	}
 
-	glGenTextures(1, &horiz_tex);
-	glBindTexture(GL_TEXTURE_2D, horiz_tex);
-	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-	glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8,
-		     256, 256, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8,
-		     horiz_data);
+	horiz_tex = piglit_depth_texture(GL_TEXTURE_2D, GL_DEPTH24_STENCIL8,
+					 256, 256, 1, GL_FALSE,
+					 DEPTH_GRAD_X, DEPTH_GRAD_X);
 	if (!piglit_check_gl_error(GL_NO_ERROR))
 		piglit_report_result(PIGLIT_FAIL);
 
-	glGenTextures(1, &vert_tex);
-	glBindTexture(GL_TEXTURE_2D, vert_tex);
-	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-	glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8,
-		     256, 256, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8,
-		     vert_data);
+	vert_tex = piglit_depth_texture(GL_TEXTURE_2D, GL_DEPTH24_STENCIL8,
+					256, 256, 1, GL_FALSE,
+					DEPTH_GRAD_Y, DEPTH_GRAD_Y);
 	if (!piglit_check_gl_error(GL_NO_ERROR))
 		piglit_report_result(PIGLIT_FAIL);
 
-- 
2.5.5



More information about the Piglit mailing list