src/third_party/angle/src/tests/gl_tests/DrawBuffersTest.cpp
// Test clear with gaps in draw buffers, originally show up as
// webgl_conformance_vulkan_passthrough_tests conformance/extensions/webgl-draw-buffers.html
// failure. This is added for ease of debugging.
Test clear with gaps in draw buffers, originally show up as
webgl_conformance_vulkan_passthrough_tests conformance/extensions/webgl-draw-buffers.html
failure. This is added for ease of debugging.
Test clear with gaps in draw buffers originally show up as webgl_conformance_vulkan_passthrough_tests conformance / extensions / webgl - draw - buffers . html failure . This is added for ease of debugging .
TEST_P(DrawBuffersWebGL2Test, Clear)
{
    ANGLE_SKIP_TEST_IF(!setupTest());
    constexpr GLint kMaxBuffers = 4;
    glGetIntegerv(GL_MAX_DRAW_BUFFERS, &mMaxDrawBuffers);
    ASSERT_GE(mMaxDrawBuffers, kMaxBuffers);
    GLenum drawBufs[kMaxBuffers] = {GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1,
                                    GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3};
    for (GLuint texIndex = 0; texIndex < kMaxBuffers; texIndex++)
    {
        glBindTexture(GL_TEXTURE_2D, mTextures[texIndex]);
        glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + texIndex, GL_TEXTURE_2D,
                               mTextures[texIndex], 0);
    }
    setDrawBuffers(kMaxBuffers, drawBufs);
    glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT);
    drawBufs[0] = GL_NONE;
    drawBufs[1] = GL_NONE;
    setDrawBuffers(kMaxBuffers, drawBufs);
    glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT);
    ASSERT_GL_NO_ERROR();
    verifyAttachment2DColor(0, mTextures[0], GL_TEXTURE_2D, 0, GLColor::red);
    verifyAttachment2DColor(1, mTextures[1], GL_TEXTURE_2D, 0, GLColor::red);
    verifyAttachment2DColor(2, mTextures[2], GL_TEXTURE_2D, 0, GLColor::green);
    verifyAttachment2DColor(3, mTextures[3], GL_TEXTURE_2D, 0, GLColor::green);
}
TEST_P ( DrawBuffersWebGL2Test , Clear ) { ANGLE_SKIP_TEST_IF ( ! setupTest ( ) ) ; constexpr GLint kMaxBuffers = 4 ; glGetIntegerv ( GL_MAX_DRAW_BUFFERS , & mMaxDrawBuffers ) ; ASSERT_GE ( mMaxDrawBuffers , kMaxBuffers ) ; GLenum drawBufs [ kMaxBuffers ] = { GL_COLOR_ATTACHMENT0 , GL_COLOR_ATTACHMENT1 , GL_COLOR_ATTACHMENT2 , GL_COLOR_ATTACHMENT3 } ; for ( GLuint texIndex = 0 ; texIndex < kMaxBuffers ; texIndex ++ ) { glBindTexture ( GL_TEXTURE_2D , mTextures [ texIndex ] ) ; glFramebufferTexture2D ( GL_FRAMEBUFFER , GL_COLOR_ATTACHMENT0 + texIndex , GL_TEXTURE_2D , mTextures [ texIndex ] , 0 ) ; } setDrawBuffers ( kMaxBuffers , drawBufs ) ; glClearColor ( 1.0f , 0.0f , 0.0f , 1.0f ) ; glClear ( GL_COLOR_BUFFER_BIT ) ; drawBufs [ 0 ] = GL_NONE ; drawBufs [ 1 ] = GL_NONE ; setDrawBuffers ( kMaxBuffers , drawBufs ) ; glClearColor ( 0.0f , 1.0f , 0.0f , 1.0f ) ; glClear ( GL_COLOR_BUFFER_BIT ) ; ASSERT_GL_NO_ERROR ( ) ; verifyAttachment2DColor ( 0 , mTextures [ 0 ] , GL_TEXTURE_2D , 0 , GLColor :: red ) ; verifyAttachment2DColor ( 1 , mTextures [ 1 ] , GL_TEXTURE_2D , 0 , GLColor :: red ) ; verifyAttachment2DColor ( 2 , mTextures [ 2 ] , GL_TEXTURE_2D , 0 , GLColor :: green ) ; verifyAttachment2DColor ( 3 , mTextures [ 3 ] , GL_TEXTURE_2D , 0 , GLColor :: green ) ; }
Test clear with gaps in draw buffers, originally show up as
webgl_conformance_vulkan_passthrough_tests conformance/extensions/webgl-draw-buffers.html
failure.
Test clear with gaps in draw buffers originally show up as webgl_conformance_vulkan_passthrough_tests conformance / extensions / webgl - draw - buffers . html failure .
// Enable all draw buffers. // Clear with all draw buffers. // Clear with first half none draw buffers. // Verify first is drawn red, second is untouched, and last two are cleared green.