src/third_party/angle/src/tests/gl_tests/MultisampleTest.cpp
// Test line rendering on a multisampled surface.  GLES2 section 3.4.4.
Test line rendering on a multisampled surface.
Test line rendering on a multisampled surface .
TEST_P(MultisampleTest, Line)
{
    ANGLE_SKIP_TEST_IF(!mMultisampledConfigExists);
    ANGLE_SKIP_TEST_IF(IsARM64() && IsWindows() && IsD3D());
    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[2] = {{-1.0f, -0.3f, 0.0f}, {1.0f, 0.3f, 0.0f}};
    prepareVertexBuffer(vertexBuffer, vertices, 2, positionLocation);
    glClear(GL_COLOR_BUFFER_BIT);
    glDrawArrays(GL_LINES, 0, 2);
    ASSERT_GL_NO_ERROR();
     D                    D = Dark Red (0.25) or (0.5)
      BRA                 R = Red (1.0)
         ARB              M = Middle Red (0.75)
            D             B = Bright Red (1.0 or 0.75)
                          A = Any red (0.5, 0.75 or 1.0)
     Verify that rendering is done as above.
    const GLColor kDarkRed     = {128, 0, 0, 128};
    const GLColor kMidRed      = {192, 0, 0, 192};
    constexpr int kErrorMargin = 16;
    constexpr int kLargeMargin = 80;
    static_assert(kWindowSize == 8, "Verification code written for 8x8 window");
    EXPECT_PIXEL_COLOR_NEAR(0, 2, kDarkRed, kLargeMargin);
    EXPECT_PIXEL_COLOR_NEAR(1, 3, GLColor::red, kLargeMargin);
    EXPECT_PIXEL_COLOR_NEAR(2, 3, GLColor::red, kErrorMargin);
    EXPECT_PIXEL_COLOR_NEAR(3, 3, kMidRed, kLargeMargin);
    EXPECT_PIXEL_COLOR_NEAR(4, 4, kMidRed, kLargeMargin);
    EXPECT_PIXEL_COLOR_NEAR(5, 4, GLColor::red, kErrorMargin);
    EXPECT_PIXEL_COLOR_NEAR(6, 4, GLColor::red, kLargeMargin);
    EXPECT_PIXEL_COLOR_NEAR(7, 5, kDarkRed, kLargeMargin);
}
TEST_P ( MultisampleTest , Line ) { ANGLE_SKIP_TEST_IF ( ! mMultisampledConfigExists ) ; ANGLE_SKIP_TEST_IF ( IsARM64 ( ) && IsWindows ( ) && IsD3D ( ) ) ; 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 [ 2 ] = { { -1.0f , -0.3f , 0.0f } , { 1.0f , 0.3f , 0.0f } } ; prepareVertexBuffer ( vertexBuffer , vertices , 2 , positionLocation ) ; glClear ( GL_COLOR_BUFFER_BIT ) ; glDrawArrays ( GL_LINES , 0 , 2 ) ; ASSERT_GL_NO_ERROR ( ) ; const GLColor kDarkRed = { 128 , 0 , 0 , 128 } ; const GLColor kMidRed = { 192 , 0 , 0 , 192 } ; constexpr int kErrorMargin = 16 ; constexpr int kLargeMargin = 80 ; static_assert ( kWindowSize == 8 , " " ) ; EXPECT_PIXEL_COLOR_NEAR ( 0 , 2 , kDarkRed , kLargeMargin ) ; EXPECT_PIXEL_COLOR_NEAR ( 1 , 3 , GLColor :: red , kLargeMargin ) ; EXPECT_PIXEL_COLOR_NEAR ( 2 , 3 , GLColor :: red , kErrorMargin ) ; EXPECT_PIXEL_COLOR_NEAR ( 3 , 3 , kMidRed , kLargeMargin ) ; EXPECT_PIXEL_COLOR_NEAR ( 4 , 4 , kMidRed , kLargeMargin ) ; EXPECT_PIXEL_COLOR_NEAR ( 5 , 4 , GLColor :: red , kErrorMargin ) ; EXPECT_PIXEL_COLOR_NEAR ( 6 , 4 , GLColor :: red , kLargeMargin ) ; EXPECT_PIXEL_COLOR_NEAR ( 7 , 5 , kDarkRed , kLargeMargin ) ; }
Test line rendering on a multisampled surface.
Test line rendering on a multisampled surface .
// The line goes from left to right at about -17 degrees slope.  It renders as such (captured // with renderdoc): // // D                    D = Dark Red (0.25) or (0.5) //  BRA                 R = Red (1.0) //     ARB              M = Middle Red (0.75) //        D             B = Bright Red (1.0 or 0.75) //                      A = Any red (0.5, 0.75 or 1.0) // // Verify that rendering is done as above.