Commit 68b0f40d authored by Brian Paul's avatar Brian Paul
Browse files

fbo-blit-d24s8: don't try to blit betweendifferent Z/stencil depths



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)
Reviewed-by: Emma Anholt's avatarEric Anholt <eric@anholt.net>
parent 8646f41f
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment