If the MSAA resolve happens into the default framebuffer, we don't get the colors we expect.
Adjusts the test to resolve into an FBO first, and then blit the result to either the test FBO or the default framebuffer. Signed-off-by: Chris Forbes <[email protected]> --- .../sample-mask-execution.c | 27 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/tests/spec/arb_texture_multisample/sample-mask-execution.c b/tests/spec/arb_texture_multisample/sample-mask-execution.c index 2a6c2f8..58ec11f 100644 --- a/tests/spec/arb_texture_multisample/sample-mask-execution.c +++ b/tests/spec/arb_texture_multisample/sample-mask-execution.c @@ -36,11 +36,16 @@ PIGLIT_GL_TEST_CONFIG_END * - set mask to the other half of the samples * - render a blue thing * - * - blit from the MSAA buffer to the winsys buffer + * - blit from the MSAA buffer to the single-sampled FBO + * - blit from the single-sampled FBO to the winsys buffer * - ensure that the pixels are yellow + * + * note the intermediate single-sampled FBO is only necessary so that + * the resolve is always happening FBO->FBO; if we resolve into a winsys + * buffer, there are sRGB interactions. */ -GLuint fbo, tex; +GLuint fbo, ss_fbo, tex, ss_tex; enum piglit_result piglit_display(void) @@ -67,10 +72,16 @@ piglit_display(void) if (!piglit_check_gl_error(GL_NO_ERROR)) piglit_report_result(PIGLIT_FAIL); - glFinish(); + /* resolve */ + glBindFramebuffer(GL_FRAMEBUFFER, ss_fbo); + glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo); + glBlitFramebuffer(0, 0, 64, 64, 0, 0, 64, 64, + GL_COLOR_BUFFER_BIT, GL_NEAREST); + + /* single-sampled blit */ glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo); - glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo); + glBindFramebuffer(GL_READ_FRAMEBUFFER, ss_fbo); glBlitFramebuffer(0, 0, 64, 64, 0, 0, 64, 64, GL_COLOR_BUFFER_BIT, GL_NEAREST); @@ -125,4 +136,12 @@ piglit_init(int argc, char **argv) glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, tex); } + + glGenFramebuffers(1, &ss_fbo); + glBindFramebuffer(GL_FRAMEBUFFER, ss_fbo); + glGenRenderbuffers(1, &ss_tex); + glBindRenderbuffer(GL_RENDERBUFFER, ss_tex); + glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA, 64, 64); + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_RENDERBUFFER, ss_tex); } -- 1.8.4.2 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
