[2/2] arb_shader_stencil_export: Compare all values

Submitted by Ben Widawsky on Oct. 23, 2015, 5 a.m.

Details

Message ID 1445576447-27038-2-git-send-email-benjamin.widawsky@intel.com
State New
Headers show
Series "Series without cover letter" ( rev: 2 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Ben Widawsky Oct. 23, 2015, 5 a.m.
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@redhat.com>
Signed-off-by: Ben Widawsky <benjamin.widawsky@intel.com>
---
 .../glsl-fs-shader-stencil-export.c                        | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

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

Comments

Ben Widawsky <benjamin.widawsky@intel.com> writes:

> -	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;

I think you could use piglit_probe_rect_stencil here if you wanted to
make this a bit simpler. That way it would also report the position if
it finds a difference.

Regards,
- Neil
Hi Ben,

On 23 October 2015 at 06:00, Ben Widawsky <benjamin.widawsky@intel.com> wrote:

> @@ -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];
If you're reworking either of these two patches, can you throw in a
define or two for these 'magic' numbers.

Thanks
Emil
On Fri, Nov 06, 2015 at 04:47:02PM +0000, Emil Velikov wrote:
> Hi Ben,
> 
> On 23 October 2015 at 06:00, Ben Widawsky <benjamin.widawsky@intel.com> wrote:
> 
> > @@ -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];
> If you're reworking either of these two patches, can you throw in a
> define or two for these 'magic' numbers.
> 
> Thanks
> Emil

Sure. I'll address the things from Neil, and this. Either of you care to put an
acked-by on it?
On 23 October 2015 at 06:00, Ben Widawsky <benjamin.widawsky@intel.com> wrote:

> @@ -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);
As you use the same coordinates (the full window) here you should also
update the above rect ?

-Emil