third_party/skia_m79/third_party/externals/angle2/src/tests/gl_tests/MultisampleTest.cpp
// Test point rendering on a multisampled surface.  GLES2 section 3.3.1.
Test point rendering on a multisampled surface.
Test point rendering on a multisampled surface .
TEST_P(MultisampleTest, Point)
{
    ANGLE_SKIP_TEST_IF(!mMultisampledConfigExists);
    ANGLE_SKIP_TEST_IF(IsAndroid() && IsNVIDIAShield() && IsOpenGLES());
    constexpr char kPointsVS[] = R"(precision highp float;
attribute vec4 a_position;
void main()
{
    gl_PointSize = 3.0;
    gl_Position = a_position;
})";
    ANGLE_GL_PROGRAM(program, kPointsVS, essl1_shaders::fs::Red());
    glUseProgram(program);
    const GLint positionLocation = glGetAttribLocation(program, "a_position");
    GLBuffer vertexBuffer;
    const Vector3 vertices[1] = {{0.0f, 0.0f, 0.0f}};
    prepareVertexBuffer(vertexBuffer, vertices, 1, positionLocation);
    glClear(GL_COLOR_BUFFER_BIT);
    glDrawArrays(GL_POINTS, 0, 1);
    ASSERT_GL_NO_ERROR();
    EXPECT_PIXEL_COLOR_EQ(kWindowSize / 2, kWindowSize / 2, GLColor::red);
    EXPECT_PIXEL_COLOR_EQ(kWindowSize / 2 - 1, kWindowSize / 2, GLColor::red);
    EXPECT_PIXEL_COLOR_EQ(kWindowSize / 2, kWindowSize / 2 - 1, GLColor::red);
    EXPECT_PIXEL_COLOR_EQ(kWindowSize / 2 - 1, kWindowSize / 2 - 1, GLColor::red);
    const GLColor kSideColor   = {128, 0, 0, 128};
    const GLColor kCornerColor = {64, 0, 0, 64};
    constexpr int kErrorMargin = 16;
    EXPECT_PIXEL_COLOR_NEAR(kWindowSize / 2 - 2, kWindowSize / 2 - 2, kCornerColor, kErrorMargin);
    EXPECT_PIXEL_COLOR_NEAR(kWindowSize / 2 - 2, kWindowSize / 2 + 1, kCornerColor, kErrorMargin);
    EXPECT_PIXEL_COLOR_NEAR(kWindowSize / 2 + 1, kWindowSize / 2 - 2, kCornerColor, kErrorMargin);
    EXPECT_PIXEL_COLOR_NEAR(kWindowSize / 2 + 1, kWindowSize / 2 + 1, kCornerColor, kErrorMargin);
    EXPECT_PIXEL_COLOR_NEAR(kWindowSize / 2 - 2, kWindowSize / 2 - 1, kSideColor, kErrorMargin);
    EXPECT_PIXEL_COLOR_NEAR(kWindowSize / 2 - 2, kWindowSize / 2, kSideColor, kErrorMargin);
    EXPECT_PIXEL_COLOR_NEAR(kWindowSize / 2 - 1, kWindowSize / 2 - 2, kSideColor, kErrorMargin);
    EXPECT_PIXEL_COLOR_NEAR(kWindowSize / 2 - 1, kWindowSize / 2 + 1, kSideColor, kErrorMargin);
    EXPECT_PIXEL_COLOR_NEAR(kWindowSize / 2, kWindowSize / 2 - 2, kSideColor, kErrorMargin);
    EXPECT_PIXEL_COLOR_NEAR(kWindowSize / 2, kWindowSize / 2 + 1, kSideColor, kErrorMargin);
    EXPECT_PIXEL_COLOR_NEAR(kWindowSize / 2 + 1, kWindowSize / 2 - 1, kSideColor, kErrorMargin);
    EXPECT_PIXEL_COLOR_NEAR(kWindowSize / 2 + 1, kWindowSize / 2, kSideColor, kErrorMargin);
}
TEST_P ( MultisampleTest , Point ) { ANGLE_SKIP_TEST_IF ( ! mMultisampledConfigExists ) ; ANGLE_SKIP_TEST_IF ( IsAndroid ( ) && IsNVIDIAShield ( ) && IsOpenGLES ( ) ) ; constexpr char kPointsVS [ ] = R" ( precision highp float;
attribute vec4 a_position;

void main()
{
    gl_PointSize = 3.0;
    gl_Position = a_position;
} ) " ; ANGLE_GL_PROGRAM ( program , kPointsVS , essl1_shaders :: fs :: Red ( ) ) ; glUseProgram ( program ) ; const GLint positionLocation = glGetAttribLocation ( program , " " ) ; GLBuffer vertexBuffer ; const Vector3 vertices [ 1 ] = { { 0.0f , 0.0f , 0.0f } } ; prepareVertexBuffer ( vertexBuffer , vertices , 1 , positionLocation ) ; glClear ( GL_COLOR_BUFFER_BIT ) ; glDrawArrays ( GL_POINTS , 0 , 1 ) ; ASSERT_GL_NO_ERROR ( ) ; EXPECT_PIXEL_COLOR_EQ ( kWindowSize / 2 , kWindowSize / 2 , GLColor :: red ) ; EXPECT_PIXEL_COLOR_EQ ( kWindowSize / 2 - 1 , kWindowSize / 2 , GLColor :: red ) ; EXPECT_PIXEL_COLOR_EQ ( kWindowSize / 2 , kWindowSize / 2 - 1 , GLColor :: red ) ; EXPECT_PIXEL_COLOR_EQ ( kWindowSize / 2 - 1 , kWindowSize / 2 - 1 , GLColor :: red ) ; const GLColor kSideColor = { 128 , 0 , 0 , 128 } ; const GLColor kCornerColor = { 64 , 0 , 0 , 64 } ; constexpr int kErrorMargin = 16 ; EXPECT_PIXEL_COLOR_NEAR ( kWindowSize / 2 - 2 , kWindowSize / 2 - 2 , kCornerColor , kErrorMargin ) ; EXPECT_PIXEL_COLOR_NEAR ( kWindowSize / 2 - 2 , kWindowSize / 2 + 1 , kCornerColor , kErrorMargin ) ; EXPECT_PIXEL_COLOR_NEAR ( kWindowSize / 2 + 1 , kWindowSize / 2 - 2 , kCornerColor , kErrorMargin ) ; EXPECT_PIXEL_COLOR_NEAR ( kWindowSize / 2 + 1 , kWindowSize / 2 + 1 , kCornerColor , kErrorMargin ) ; EXPECT_PIXEL_COLOR_NEAR ( kWindowSize / 2 - 2 , kWindowSize / 2 - 1 , kSideColor , kErrorMargin ) ; EXPECT_PIXEL_COLOR_NEAR ( kWindowSize / 2 - 2 , kWindowSize / 2 , kSideColor , kErrorMargin ) ; EXPECT_PIXEL_COLOR_NEAR ( kWindowSize / 2 - 1 , kWindowSize / 2 - 2 , kSideColor , kErrorMargin ) ; EXPECT_PIXEL_COLOR_NEAR ( kWindowSize / 2 - 1 , kWindowSize / 2 + 1 , kSideColor , kErrorMargin ) ; EXPECT_PIXEL_COLOR_NEAR ( kWindowSize / 2 , kWindowSize / 2 - 2 , kSideColor , kErrorMargin ) ; EXPECT_PIXEL_COLOR_NEAR ( kWindowSize / 2 , kWindowSize / 2 + 1 , kSideColor , kErrorMargin ) ; EXPECT_PIXEL_COLOR_NEAR ( kWindowSize / 2 + 1 , kWindowSize / 2 - 1 , kSideColor , kErrorMargin ) ; EXPECT_PIXEL_COLOR_NEAR ( kWindowSize / 2 + 1 , kWindowSize / 2 , kSideColor , kErrorMargin ) ; }
Test point rendering on a multisampled surface.
Test point rendering on a multisampled surface .
// http://anglebug.com/3470 // The center pixels should be all red. // Border pixels should be between red and black, and not exactly either; corners are darker and // sides are brighter.