src/third_party/angle/src/tests/gl_tests/PixmapTest.cpp
// Bind the Pixmap to a texture and verify it renders correctly
Bind the Pixmap to a texture and verify it renders correctly
Bind the Pixmap to a texture and verify it renders correctly
TEST_P(PixmapTest, BindTexImage)
{
    ANGLE_SKIP_TEST_IF(!mSupportsPixmaps || !mSupportsBindTexImage);
    ANGLE_SKIP_TEST_IF(IsLinux() && IsIntel());
    EGLWindow *window = getEGLWindow();
    eglMakeCurrent(window->getDisplay(), mPixmap, mPixmap, window->getContext());
    ASSERT_EGL_SUCCESS();
    glViewport(0, 0, static_cast<GLsizei>(mPixmapSize), static_cast<GLsizei>(mPixmapSize));
    glClearColor(1.0f, 0.0f, 1.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT);
    ASSERT_GL_NO_ERROR();
    EXPECT_PIXEL_EQ(static_cast<GLint>(mPixmapSize) / 2, static_cast<GLint>(mPixmapSize) / 2, 255,
                    0, 255, 255);
    window->makeCurrent();
    GLuint texture = 0;
    glGenTextures(1, &texture);
    glBindTexture(GL_TEXTURE_2D, texture);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    EXPECT_GL_NO_ERROR();
    eglBindTexImage(window->getDisplay(), mPixmap, EGL_BACK_BUFFER);
    glViewport(0, 0, getWindowWidth(), getWindowHeight());
    ASSERT_EGL_SUCCESS();
    glUseProgram(mTextureProgram);
    glUniform1i(mTextureUniformLocation, 0);
    drawQuad(mTextureProgram, essl31_shaders::PositionAttrib(), 0.5f);
    EXPECT_GL_NO_ERROR();
    eglReleaseTexImage(window->getDisplay(), mPixmap, EGL_BACK_BUFFER);
    ASSERT_EGL_SUCCESS();
    EXPECT_PIXEL_EQ(getWindowWidth() / 2, getWindowHeight() / 2, 255, 0, 255, 255);
    glDeleteTextures(1, &texture);
}
TEST_P ( PixmapTest , BindTexImage ) { ANGLE_SKIP_TEST_IF ( ! mSupportsPixmaps || ! mSupportsBindTexImage ) ; ANGLE_SKIP_TEST_IF ( IsLinux ( ) && IsIntel ( ) ) ; EGLWindow * window = getEGLWindow ( ) ; eglMakeCurrent ( window -> getDisplay ( ) , mPixmap , mPixmap , window -> getContext ( ) ) ; ASSERT_EGL_SUCCESS ( ) ; glViewport ( 0 , 0 , static_cast < GLsizei > ( mPixmapSize ) , static_cast < GLsizei > ( mPixmapSize ) ) ; glClearColor ( 1.0f , 0.0f , 1.0f , 1.0f ) ; glClear ( GL_COLOR_BUFFER_BIT ) ; ASSERT_GL_NO_ERROR ( ) ; EXPECT_PIXEL_EQ ( static_cast < GLint > ( mPixmapSize ) / 2 , static_cast < GLint > ( mPixmapSize ) / 2 , 255 , 0 , 255 , 255 ) ; window -> makeCurrent ( ) ; GLuint texture = 0 ; glGenTextures ( 1 , & texture ) ; glBindTexture ( GL_TEXTURE_2D , texture ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MIN_FILTER , GL_NEAREST ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MAG_FILTER , GL_NEAREST ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_WRAP_S , GL_CLAMP_TO_EDGE ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_WRAP_T , GL_CLAMP_TO_EDGE ) ; EXPECT_GL_NO_ERROR ( ) ; eglBindTexImage ( window -> getDisplay ( ) , mPixmap , EGL_BACK_BUFFER ) ; glViewport ( 0 , 0 , getWindowWidth ( ) , getWindowHeight ( ) ) ; ASSERT_EGL_SUCCESS ( ) ; glUseProgram ( mTextureProgram ) ; glUniform1i ( mTextureUniformLocation , 0 ) ; drawQuad ( mTextureProgram , essl31_shaders :: PositionAttrib ( ) , 0.5f ) ; EXPECT_GL_NO_ERROR ( ) ; eglReleaseTexImage ( window -> getDisplay ( ) , mPixmap , EGL_BACK_BUFFER ) ; ASSERT_EGL_SUCCESS ( ) ; EXPECT_PIXEL_EQ ( getWindowWidth ( ) / 2 , getWindowHeight ( ) / 2 , 255 , 0 , 255 , 255 ) ; glDeleteTextures ( 1 , & texture ) ; }
Bind the Pixmap to a texture and verify it renders correctly
Bind the Pixmap to a texture and verify it renders correctly
// Test skipped because pixmaps are not supported or pixmaps do not support binding to RGBA // textures. // This test fails flakily on Linux intel when run with many other tests. // Apply the Pixmap and clear it to purple // Apply the window surface // Create a texture and bind the pixmap to it // Draw a quad and verify that it is purple // Unbind the texture // Verify that purple was drawn