src/third_party/angle/src/tests/gl_tests/BlitFramebufferANGLETest.cpp
// Test blitting to a texture with non-zero base.  The blit is non-stretching and between
// identical formats so that the path that uses vkCmdBlitImage is taken.
Test blitting to a texture with non-zero base.  The blit is non-stretching and between
identical formats so that the path that uses vkCmdBlitImage is taken.
Test blitting to a texture with non - zero base . The blit is non - stretching and between identical formats so that the path that uses vkCmdBlitImage is taken .
TEST_P(BlitFramebufferTest, NonZeroBaseDestination)
{
    ANGLE_GL_PROGRAM(drawRed, essl3_shaders::vs::Simple(), essl3_shaders::fs::Red());
    GLTexture srcColor;
    glBindTexture(GL_TEXTURE_2D, srcColor);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
    GLFramebuffer srcFramebuffer;
    glBindFramebuffer(GL_FRAMEBUFFER, srcFramebuffer);
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, srcColor, 0);
    ASSERT_GL_FRAMEBUFFER_COMPLETE(GL_FRAMEBUFFER);
    drawQuad(drawRed.get(), essl3_shaders::PositionAttrib(), 0.5f);
    GLTexture dstColor;
    glBindTexture(GL_TEXTURE_2D, dstColor);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
    glTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 1);
    GLFramebuffer dstFramebuffer;
    glBindFramebuffer(GL_FRAMEBUFFER, dstFramebuffer);
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, dstColor, 1);
    ASSERT_GL_FRAMEBUFFER_COMPLETE(GL_FRAMEBUFFER);
    glBindFramebuffer(GL_READ_FRAMEBUFFER, srcFramebuffer);
    glBlitFramebuffer(0, 0, 256, 256, 0, 0, 256, 256, GL_COLOR_BUFFER_BIT, GL_NEAREST);
    glBindFramebuffer(GL_FRAMEBUFFER, dstFramebuffer);
    ASSERT_GL_NO_ERROR();
    EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::red);
    ASSERT_GL_NO_ERROR();
}
TEST_P ( BlitFramebufferTest , NonZeroBaseDestination ) { ANGLE_GL_PROGRAM ( drawRed , essl3_shaders :: vs :: Simple ( ) , essl3_shaders :: fs :: Red ( ) ) ; GLTexture srcColor ; glBindTexture ( GL_TEXTURE_2D , srcColor ) ; glTexImage2D ( GL_TEXTURE_2D , 0 , GL_RGBA8 , 256 , 256 , 0 , GL_RGBA , GL_UNSIGNED_BYTE , nullptr ) ; GLFramebuffer srcFramebuffer ; glBindFramebuffer ( GL_FRAMEBUFFER , srcFramebuffer ) ; glFramebufferTexture2D ( GL_FRAMEBUFFER , GL_COLOR_ATTACHMENT0 , GL_TEXTURE_2D , srcColor , 0 ) ; ASSERT_GL_FRAMEBUFFER_COMPLETE ( GL_FRAMEBUFFER ) ; drawQuad ( drawRed . get ( ) , essl3_shaders :: PositionAttrib ( ) , 0.5f ) ; GLTexture dstColor ; glBindTexture ( GL_TEXTURE_2D , dstColor ) ; glTexImage2D ( GL_TEXTURE_2D , 0 , GL_RGBA8 , 256 , 256 , 0 , GL_RGBA , GL_UNSIGNED_BYTE , nullptr ) ; glTexImage2D ( GL_TEXTURE_2D , 1 , GL_RGBA8 , 256 , 256 , 0 , GL_RGBA , GL_UNSIGNED_BYTE , nullptr ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_BASE_LEVEL , 1 ) ; GLFramebuffer dstFramebuffer ; glBindFramebuffer ( GL_FRAMEBUFFER , dstFramebuffer ) ; glFramebufferTexture2D ( GL_FRAMEBUFFER , GL_COLOR_ATTACHMENT0 , GL_TEXTURE_2D , dstColor , 1 ) ; ASSERT_GL_FRAMEBUFFER_COMPLETE ( GL_FRAMEBUFFER ) ; glBindFramebuffer ( GL_READ_FRAMEBUFFER , srcFramebuffer ) ; glBlitFramebuffer ( 0 , 0 , 256 , 256 , 0 , 0 , 256 , 256 , GL_COLOR_BUFFER_BIT , GL_NEAREST ) ; glBindFramebuffer ( GL_FRAMEBUFFER , dstFramebuffer ) ; ASSERT_GL_NO_ERROR ( ) ; EXPECT_PIXEL_COLOR_EQ ( 0 , 0 , GLColor :: red ) ; ASSERT_GL_NO_ERROR ( ) ; }
Test blitting to a texture with non-zero base.
Test blitting to a texture with non - zero base .
// Create a framebuffer for source data.  It usea a non-zero base. // fill the color buffer with red. // Create a framebuffer for blit destination. // Blit.  Note: no stretching is done so that vkCmdBlitImage can be used. // Make sure the blit is done.