[Piglit] [PATCH 2/2] arb_shader_stencil_export: Compare all values

Ben Widawsky benjamin.widawsky at intel.com
Thu Oct 22 22:00:47 PDT 2015


For certain hardware, the underlying memory format of the buffer is weird.
Comparing all the data is essential for finding bugs on that hardware.

Cc: Dave Airlie <airlied at redhat.com>
Signed-off-by: Ben Widawsky <benjamin.widawsky at intel.com>
---
 .../glsl-fs-shader-stencil-export.c                        | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/tests/spec/arb_shader_stencil_export/glsl-fs-shader-stencil-export.c b/tests/spec/arb_shader_stencil_export/glsl-fs-shader-stencil-export.c
index e4db7ca..9de57fa 100644
--- a/tests/spec/arb_shader_stencil_export/glsl-fs-shader-stencil-export.c
+++ b/tests/spec/arb_shader_stencil_export/glsl-fs-shader-stencil-export.c
@@ -46,8 +46,8 @@ static GLint prog;
 enum piglit_result
 piglit_display(void)
 {
-	GLboolean pass = GL_TRUE;
-	float p[4];
+	uint8_t p[256 * 256];
+	int i;
 
 	glClearColor(0.5, 0.5, 0.5, 0.5);
 	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
@@ -57,13 +57,15 @@ piglit_display(void)
 
 	piglit_draw_rect(-1, -1, 2, 2);
 
-	glReadPixels(0, 0, 3, 1, GL_STENCIL_INDEX, GL_FLOAT, p);
+	glReadPixels(0, 0, 256, 256, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, p);
 	piglit_present_results();
 
 	/* we hardcode 129 in the shader */
-	if (p[0] != 129)
-		pass = GL_FALSE;
-	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+	for (i = 0; i < 256 * 256; i++)
+		if (p[i] != 129)
+			return PIGLIT_FAIL;
+
+	return PIGLIT_PASS;
 }
 
 void
-- 
2.6.1



More information about the Piglit mailing list