While debugging a problem on gen8, I added this code to verify the contents of
the 2d texture array in order to narrow down the failure. It seemed useful and
worth keeping to me.

Cc: Glenn Kennard <[email protected]>
Signed-off-by: Ben Widawsky <[email protected]>
---
 .../sampling-2d-array-as-2d-layer.c                | 29 +++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/tests/spec/arb_texture_view/sampling-2d-array-as-2d-layer.c 
b/tests/spec/arb_texture_view/sampling-2d-array-as-2d-layer.c
index 8189044..7a741e5 100644
--- a/tests/spec/arb_texture_view/sampling-2d-array-as-2d-layer.c
+++ b/tests/spec/arb_texture_view/sampling-2d-array-as-2d-layer.c
@@ -122,7 +122,34 @@ test_single_layer(const Params* p, int layer)
 
        pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green);
        if (!pass) {
-               printf("layer %d failed\n", layer);
+               GLenum status;
+               GLuint temp_fbo;
+
+               glClearColor(0, 0, 1, 1);
+               glClear(GL_COLOR_BUFFER_BIT);
+
+               glGenFramebuffers(1, &temp_fbo);
+               glBindFramebuffer(GL_FRAMEBUFFER, temp_fbo);
+               glFramebufferTextureLayer(GL_FRAMEBUFFER,
+                                         GL_COLOR_ATTACHMENT0,
+                                         tex_src, 0, layer);
+               status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
+               if (status != GL_FRAMEBUFFER_COMPLETE) {
+                       printf("Framebuffer Status: %s\n",
+                               piglit_get_gl_enum_name(status));
+               }
+
+               glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
+               glBindFramebuffer(GL_READ_FRAMEBUFFER, temp_fbo);
+               glBlitFramebuffer(0, 0, p->width, p->height,
+                                 0, 0, piglit_width, piglit_height,
+                                 GL_COLOR_BUFFER_BIT, GL_NEAREST);
+
+               printf("layer %d failed. Source image was %s\n",
+                       layer, piglit_probe_pixel_rgba(0, 0, green) ?
+                              "correct" : "incorrect");
+
+               glDeleteFramebuffers(1, &temp_fbo);
        }
 
        glDeleteTextures(1, &tex_view);
-- 
2.6.1

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to