src/third_party/angle/src/tests/gl_tests/BlitFramebufferANGLETest.cpp
// blit from system FBO to user-created framebuffer, with depth buffer.
blit from system FBO to user-created framebuffer, with depth buffer.
blit from system FBO to user - created framebuffer with depth buffer .
TEST_P(BlitFramebufferANGLETest, BlitWithDepthDefaultToUser)
{
    ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_framebuffer_blit"));
    glBindFramebuffer(GL_FRAMEBUFFER, mOriginalFBO);
    glDepthMask(GL_TRUE);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
    glEnable(GL_DEPTH_TEST);
    EXPECT_GL_NO_ERROR();
    glEnable(GL_SCISSOR_TEST);
    glScissor(0, 0, getWindowWidth(), getWindowHeight() / 2);
    glClearDepthf(0.1f);
    glClearColor(1.0, 0.0, 0.0, 1.0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glScissor(0, getWindowHeight() / 2, getWindowWidth(), getWindowHeight() / 2);
    glClearDepthf(0.9f);
    glClearColor(0.0, 1.0, 0.0, 1.0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glDisable(GL_SCISSOR_TEST);
    glBindFramebuffer(GL_DRAW_FRAMEBUFFER_ANGLE, mUserFBO);
    glBindFramebuffer(GL_READ_FRAMEBUFFER_ANGLE, mOriginalFBO);
    glBlitFramebufferANGLE(0, 0, getWindowWidth(), getWindowHeight(), 0, 0, getWindowWidth(),
                           getWindowHeight(), GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT,
                           GL_NEAREST);
    EXPECT_GL_NO_ERROR();
    glBindFramebuffer(GL_FRAMEBUFFER, mUserFBO);
    drawQuad(mBlueProgram, essl1_shaders::PositionAttrib(), 0.5f);
    glDisable(GL_DEPTH_TEST);
    EXPECT_PIXEL_COLOR_EQ(getWindowWidth() / 4, getWindowHeight() / 4, GLColor::red);
    EXPECT_PIXEL_COLOR_EQ(getWindowWidth() / 4, 3 * getWindowHeight() / 4, GLColor::blue);
    EXPECT_PIXEL_COLOR_EQ(3 * getWindowWidth() / 4, getWindowHeight() / 4, GLColor::red);
    EXPECT_PIXEL_COLOR_EQ(3 * getWindowWidth() / 4, 3 * getWindowHeight() / 4, GLColor::blue);
}
TEST_P ( BlitFramebufferANGLETest , BlitWithDepthDefaultToUser ) { ANGLE_SKIP_TEST_IF ( ! IsGLExtensionEnabled ( " " ) ) ; glBindFramebuffer ( GL_FRAMEBUFFER , mOriginalFBO ) ; glDepthMask ( GL_TRUE ) ; glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT ) ; glEnable ( GL_DEPTH_TEST ) ; EXPECT_GL_NO_ERROR ( ) ; glEnable ( GL_SCISSOR_TEST ) ; glScissor ( 0 , 0 , getWindowWidth ( ) , getWindowHeight ( ) / 2 ) ; glClearDepthf ( 0.1f ) ; glClearColor ( 1.0 , 0.0 , 0.0 , 1.0 ) ; glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ; glScissor ( 0 , getWindowHeight ( ) / 2 , getWindowWidth ( ) , getWindowHeight ( ) / 2 ) ; glClearDepthf ( 0.9f ) ; glClearColor ( 0.0 , 1.0 , 0.0 , 1.0 ) ; glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ; glDisable ( GL_SCISSOR_TEST ) ; glBindFramebuffer ( GL_DRAW_FRAMEBUFFER_ANGLE , mUserFBO ) ; glBindFramebuffer ( GL_READ_FRAMEBUFFER_ANGLE , mOriginalFBO ) ; glBlitFramebufferANGLE ( 0 , 0 , getWindowWidth ( ) , getWindowHeight ( ) , 0 , 0 , getWindowWidth ( ) , getWindowHeight ( ) , GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT , GL_NEAREST ) ; EXPECT_GL_NO_ERROR ( ) ; glBindFramebuffer ( GL_FRAMEBUFFER , mUserFBO ) ; drawQuad ( mBlueProgram , essl1_shaders :: PositionAttrib ( ) , 0.5f ) ; glDisable ( GL_DEPTH_TEST ) ; EXPECT_PIXEL_COLOR_EQ ( getWindowWidth ( ) / 4 , getWindowHeight ( ) / 4 , GLColor :: red ) ; EXPECT_PIXEL_COLOR_EQ ( getWindowWidth ( ) / 4 , 3 * getWindowHeight ( ) / 4 , GLColor :: blue ) ; EXPECT_PIXEL_COLOR_EQ ( 3 * getWindowWidth ( ) / 4 , getWindowHeight ( ) / 4 , GLColor :: red ) ; EXPECT_PIXEL_COLOR_EQ ( 3 * getWindowWidth ( ) / 4 , 3 * getWindowHeight ( ) / 4 , GLColor :: blue ) ; }
blit from system FBO to user-created framebuffer, with depth buffer.
blit from system FBO to user - created framebuffer with depth buffer .
// Clear the first half of the screen // Scissor the second half of the screen // if blit is happening correctly, this quad will draw only on the bottom half since it will be // behind on the first half and in front on the second half.