src/third_party/angle/src/tests/gl_tests/MultisampleTest.cpp
// Test that resolve from multisample default framebuffer works.
Test that resolve from multisample default framebuffer works.
Test that resolve from multisample default framebuffer works .
TEST_P(MultisampleTestES3, ResolveToFBO)
{
    ANGLE_SKIP_TEST_IF(!mMultisampledConfigExists);
    GLTexture resolveTexture;
    glBindTexture(GL_TEXTURE_2D, resolveTexture);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, kWindowSize, kWindowSize, 0, GL_RGBA, GL_UNSIGNED_BYTE,
                 nullptr);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    GLFramebuffer resolveFBO;
    glBindFramebuffer(GL_FRAMEBUFFER, resolveFBO);
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, resolveTexture, 0);
    glBindFramebuffer(GL_FRAMEBUFFER, 0);
    glClearColor(0.25, 0.5, 0.75, 0.25);
    glClear(GL_COLOR_BUFFER_BIT);
    glBindFramebuffer(GL_DRAW_FRAMEBUFFER, resolveFBO);
    glClearColor(1, 0, 0, 1);
    glClear(GL_COLOR_BUFFER_BIT);
    glBlitFramebuffer(0, 0, kWindowSize, kWindowSize, 0, 0, kWindowSize, kWindowSize,
                      GL_COLOR_BUFFER_BIT, GL_NEAREST);
    ASSERT_GL_NO_ERROR();
    const GLColor kResult = GLColor(63, 127, 191, 63);
    glBindFramebuffer(GL_READ_FRAMEBUFFER, resolveFBO);
    EXPECT_PIXEL_COLOR_NEAR(0, 0, kResult, 1);
    EXPECT_PIXEL_COLOR_NEAR(kWindowSize - 1, 0, kResult, 1);
    EXPECT_PIXEL_COLOR_NEAR(0, kWindowSize - 1, kResult, 1);
    EXPECT_PIXEL_COLOR_NEAR(kWindowSize - 1, kWindowSize - 1, kResult, 1);
    EXPECT_PIXEL_COLOR_NEAR(kWindowSize / 2, kWindowSize / 2, kResult, 1);
}
TEST_P ( MultisampleTestES3 , ResolveToFBO ) { ANGLE_SKIP_TEST_IF ( ! mMultisampledConfigExists ) ; GLTexture resolveTexture ; glBindTexture ( GL_TEXTURE_2D , resolveTexture ) ; glTexImage2D ( GL_TEXTURE_2D , 0 , GL_RGBA , kWindowSize , kWindowSize , 0 , GL_RGBA , GL_UNSIGNED_BYTE , nullptr ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MIN_FILTER , GL_LINEAR ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MAG_FILTER , GL_LINEAR ) ; GLFramebuffer resolveFBO ; glBindFramebuffer ( GL_FRAMEBUFFER , resolveFBO ) ; glFramebufferTexture2D ( GL_FRAMEBUFFER , GL_COLOR_ATTACHMENT0 , GL_TEXTURE_2D , resolveTexture , 0 ) ; glBindFramebuffer ( GL_FRAMEBUFFER , 0 ) ; glClearColor ( 0.25 , 0.5 , 0.75 , 0.25 ) ; glClear ( GL_COLOR_BUFFER_BIT ) ; glBindFramebuffer ( GL_DRAW_FRAMEBUFFER , resolveFBO ) ; glClearColor ( 1 , 0 , 0 , 1 ) ; glClear ( GL_COLOR_BUFFER_BIT ) ; glBlitFramebuffer ( 0 , 0 , kWindowSize , kWindowSize , 0 , 0 , kWindowSize , kWindowSize , GL_COLOR_BUFFER_BIT , GL_NEAREST ) ; ASSERT_GL_NO_ERROR ( ) ; const GLColor kResult = GLColor ( 63 , 127 , 191 , 63 ) ; glBindFramebuffer ( GL_READ_FRAMEBUFFER , resolveFBO ) ; EXPECT_PIXEL_COLOR_NEAR ( 0 , 0 , kResult , 1 ) ; EXPECT_PIXEL_COLOR_NEAR ( kWindowSize - 1 , 0 , kResult , 1 ) ; EXPECT_PIXEL_COLOR_NEAR ( 0 , kWindowSize - 1 , kResult , 1 ) ; EXPECT_PIXEL_COLOR_NEAR ( kWindowSize - 1 , kWindowSize - 1 , kResult , 1 ) ; EXPECT_PIXEL_COLOR_NEAR ( kWindowSize / 2 , kWindowSize / 2 , kResult , 1 ) ; }
Test that resolve from multisample default framebuffer works.
Test that resolve from multisample default framebuffer works .
// Clear the default framebuffer // Resolve into FBO