[Piglit] [PATCH] fbo-blit-d24s8: don't try to blit betweendifferent Z/stencil depths
Brian Paul
brianp at vmware.com
Mon Jan 2 14:09:36 PST 2012
The docs for glBlitFramebuffer say GL_INVALID_OPERATION is generated
if the source/dest depth/stencil buffer formats do no match. The spec
is a bit vague on what's meant by formats (do just the component depths
need to match, or must the hw formats match?) but clearly if the depths
don't match, the formats can't match.
This fixes a bogus error that's generated when testing swrast which
usually uses a 16-bit depth buffer for the window and a 24-bit Z
renderbuffer for the FBO.
v2: just report PIGLIT_SKIP if the bit depths don't match (per Eric)
---
tests/fbo/fbo-blit-d24s8.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/tests/fbo/fbo-blit-d24s8.c b/tests/fbo/fbo-blit-d24s8.c
index 15b9def..91d75dd 100644
--- a/tests/fbo/fbo-blit-d24s8.c
+++ b/tests/fbo/fbo-blit-d24s8.c
@@ -154,6 +154,7 @@ run_test(void)
int y1 = PAD * 2 + SIZE;
int y2 = PAD * 3 + SIZE * 2;
GLenum err;
+ GLint win_depth_bits, fbo_depth_bits, win_stencil_bits, fbo_stencil_bits;
glViewport(0, 0, piglit_width, piglit_height);
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
@@ -171,6 +172,23 @@ run_test(void)
fbo = make_fbo(fbo_width, fbo_height);
+ /* query depth/stencil sizes */
+ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+ glGetIntegerv(GL_DEPTH_BITS, &win_depth_bits);
+ glGetIntegerv(GL_STENCIL_BITS, &win_stencil_bits);
+
+ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
+ glGetIntegerv(GL_DEPTH_BITS, &fbo_depth_bits);
+ glGetIntegerv(GL_STENCIL_BITS, &fbo_stencil_bits);
+
+ if (win_depth_bits != fbo_depth_bits ||
+ win_stencil_bits != fbo_stencil_bits) {
+ /* The spec doesn't allow blitting between depth/blitting surfaces
+ * of different formats.
+ */
+ piglit_report_result(PIGLIT_SKIP);
+ }
+
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fbo);
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);
glViewport(0, 0, fbo_width, fbo_height);
--
1.7.3.4
More information about the Piglit
mailing list