src/third_party/angle/src/tests/gl_tests/MultisampleTest.cpp
// Test polygon rendering on a multisampled surface.  GLES2 section 3.5.3.
Test polygon rendering on a multisampled surface.
Test polygon rendering on a multisampled surface .
TEST_P(MultisampleTest, Triangle)
{
    ANGLE_SKIP_TEST_IF(!mMultisampledConfigExists);
    ANGLE_SKIP_TEST_IF(IsAndroid() && IsNVIDIAShield() && IsOpenGLES());
    ANGLE_GL_PROGRAM(program, essl1_shaders::vs::Simple(), essl1_shaders::fs::Red());
    glUseProgram(program);
    const GLint positionLocation = glGetAttribLocation(program, essl1_shaders::PositionAttrib());
    GLBuffer vertexBuffer;
    const Vector3 vertices[3] = {{-1.0f, -1.0f, 0.0f}, {-1.0f, 1.0f, 0.0f}, {1.0f, -1.0f, 0.0f}};
    prepareVertexBuffer(vertexBuffer, vertices, 3, positionLocation);
    glClear(GL_COLOR_BUFFER_BIT);
    glDrawArrays(GL_TRIANGLES, 0, 3);
    ASSERT_GL_NO_ERROR();
    EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::red);
    EXPECT_PIXEL_COLOR_EQ(kWindowSize / 4, kWindowSize / 4, GLColor::red);
    const GLColor kMidRed      = {128, 0, 0, 128};
    constexpr int kErrorMargin = 16;
    for (int i = 1; i + 1 < kWindowSize; ++i)
    {
        int j = kWindowSize - 1 - i;
        EXPECT_PIXEL_COLOR_NEAR(i, j, kMidRed, kErrorMargin);
        EXPECT_PIXEL_COLOR_EQ(i, j - 1, GLColor::red);
        EXPECT_PIXEL_COLOR_EQ(i, j + 1, GLColor::transparentBlack);
    }
}
TEST_P ( MultisampleTest , Triangle ) { ANGLE_SKIP_TEST_IF ( ! mMultisampledConfigExists ) ; ANGLE_SKIP_TEST_IF ( IsAndroid ( ) && IsNVIDIAShield ( ) && IsOpenGLES ( ) ) ; ANGLE_GL_PROGRAM ( program , essl1_shaders :: vs :: Simple ( ) , essl1_shaders :: fs :: Red ( ) ) ; glUseProgram ( program ) ; const GLint positionLocation = glGetAttribLocation ( program , essl1_shaders :: PositionAttrib ( ) ) ; GLBuffer vertexBuffer ; const Vector3 vertices [ 3 ] = { { -1.0f , -1.0f , 0.0f } , { -1.0f , 1.0f , 0.0f } , { 1.0f , -1.0f , 0.0f } } ; prepareVertexBuffer ( vertexBuffer , vertices , 3 , positionLocation ) ; glClear ( GL_COLOR_BUFFER_BIT ) ; glDrawArrays ( GL_TRIANGLES , 0 , 3 ) ; ASSERT_GL_NO_ERROR ( ) ; EXPECT_PIXEL_COLOR_EQ ( 0 , 0 , GLColor :: red ) ; EXPECT_PIXEL_COLOR_EQ ( kWindowSize / 4 , kWindowSize / 4 , GLColor :: red ) ; const GLColor kMidRed = { 128 , 0 , 0 , 128 } ; constexpr int kErrorMargin = 16 ; for ( int i = 1 ; i + 1 < kWindowSize ; ++ i ) { int j = kWindowSize - 1 - i ; EXPECT_PIXEL_COLOR_NEAR ( i , j , kMidRed , kErrorMargin ) ; EXPECT_PIXEL_COLOR_EQ ( i , j - 1 , GLColor :: red ) ; EXPECT_PIXEL_COLOR_EQ ( i , j + 1 , GLColor :: transparentBlack ) ; } }
Test polygon rendering on a multisampled surface.
Test polygon rendering on a multisampled surface .
// http://anglebug.com/3470 // Top-left pixels should be all red. // Diagonal pixels from bottom-left to top-right are between red and black.  Pixels above the // diagonal are red and pixels below it are black.