summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTopi Pohjolainen <topi.pohjolainen@intel.com>2014-02-24 12:36:33 +0200
committerTopi Pohjolainen <topi.pohjolainen@intel.com>2016-05-19 23:35:59 +0300
commitc9abe96a2fc236e67e0201a461e2f12d2ab43073 (patch)
tree6b13a0cdfe0311051aae0ef6e61c81c60641ac67
parentca6be3d3cf91e9b150df4c4cfa73a18074615204 (diff)
stencil_texturing: Use piglit_depth_texture()
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
-rw-r--r--tests/spec/arb_stencil_texturing/draw.c40
1 files changed, 6 insertions, 34 deletions
diff --git a/tests/spec/arb_stencil_texturing/draw.c b/tests/spec/arb_stencil_texturing/draw.c
index 9353240c8..c4152c99d 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);