Commit 1c906c2e by Geoff Lang

Skip Pbuffer tests depending on Pbuffer support.

BUG=angleproject:890 Change-Id: Ie10276453c35c65ffa0e26f8039db3ec3e65064e Reviewed-on: https://chromium-review.googlesource.com/265187Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent b4a058bb
...@@ -55,20 +55,37 @@ class PbufferTest : public ANGLETest ...@@ -55,20 +55,37 @@ class PbufferTest : public ANGLETest
mTextureUniformLocation = glGetUniformLocation(mTextureProgram, "tex"); mTextureUniformLocation = glGetUniformLocation(mTextureProgram, "tex");
EGLWindow *window = getEGLWindow();
EGLint surfaceType = 0;
eglGetConfigAttrib(window->getDisplay(), window->getConfig(), EGL_SURFACE_TYPE, &surfaceType);
mSupportsPbuffers = (surfaceType & EGL_PBUFFER_BIT) != 0;
EGLint bindToTextureRGBA = 0;
eglGetConfigAttrib(window->getDisplay(), window->getConfig(), EGL_BIND_TO_TEXTURE_RGBA, &bindToTextureRGBA);
mSupportsBindTexImage = (bindToTextureRGBA == EGL_TRUE);
const EGLint pBufferAttributes[] = const EGLint pBufferAttributes[] =
{ {
EGL_WIDTH, mPbufferSize, EGL_WIDTH, mPbufferSize,
EGL_HEIGHT, mPbufferSize, EGL_HEIGHT, mPbufferSize,
EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGBA, EGL_TEXTURE_FORMAT, mSupportsBindTexImage ? EGL_TEXTURE_RGBA : EGL_NO_TEXTURE,
EGL_TEXTURE_TARGET, EGL_TEXTURE_2D, EGL_TEXTURE_TARGET, mSupportsBindTexImage ? EGL_TEXTURE_2D : EGL_NO_TEXTURE,
EGL_NONE, EGL_NONE, EGL_NONE, EGL_NONE,
}; };
EGLWindow *window = getEGLWindow();
mPbuffer = eglCreatePbufferSurface(window->getDisplay(), window->getConfig(), pBufferAttributes); mPbuffer = eglCreatePbufferSurface(window->getDisplay(), window->getConfig(), pBufferAttributes);
ASSERT_NE(mPbuffer, EGL_NO_SURFACE); if (mSupportsPbuffers)
{
ASSERT_NE(mPbuffer, EGL_NO_SURFACE);
ASSERT_EGL_SUCCESS();
}
else
{
ASSERT_EQ(mPbuffer, EGL_NO_SURFACE);
ASSERT_EGL_ERROR(EGL_BAD_MATCH);
}
ASSERT_EGL_SUCCESS();
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
} }
...@@ -87,11 +104,19 @@ class PbufferTest : public ANGLETest ...@@ -87,11 +104,19 @@ class PbufferTest : public ANGLETest
const size_t mPbufferSize = 32; const size_t mPbufferSize = 32;
EGLSurface mPbuffer; EGLSurface mPbuffer;
bool mSupportsPbuffers;
bool mSupportsBindTexImage;
}; };
// Test clearing a Pbuffer and checking the color is correct // Test clearing a Pbuffer and checking the color is correct
TYPED_TEST(PbufferTest, Clearing) TYPED_TEST(PbufferTest, Clearing)
{ {
if (!mSupportsPbuffers)
{
std::cout << "Test skipped because Pbuffers are not supported." << std::endl;
return;
}
EGLWindow *window = getEGLWindow(); EGLWindow *window = getEGLWindow();
// Clear the window surface to blue and verify // Clear the window surface to blue and verify
...@@ -122,6 +147,18 @@ TYPED_TEST(PbufferTest, Clearing) ...@@ -122,6 +147,18 @@ TYPED_TEST(PbufferTest, Clearing)
// Bind the Pbuffer to a texture and verify it renders correctly // Bind the Pbuffer to a texture and verify it renders correctly
TYPED_TEST(PbufferTest, BindTexImage) TYPED_TEST(PbufferTest, BindTexImage)
{ {
if (!mSupportsPbuffers)
{
std::cout << "Test skipped because Pbuffers are not supported." << std::endl;
return;
}
if (!mSupportsBindTexImage)
{
std::cout << "Test skipped because Pbuffer does not support binding to RGBA textures." << std::endl;
return;
}
EGLWindow *window = getEGLWindow(); EGLWindow *window = getEGLWindow();
// Apply the Pbuffer and clear it to purple // Apply the Pbuffer and clear it to purple
...@@ -173,6 +210,18 @@ TYPED_TEST(PbufferTest, BindTexImage) ...@@ -173,6 +210,18 @@ TYPED_TEST(PbufferTest, BindTexImage)
// size information is correctly updated. // size information is correctly updated.
TYPED_TEST(PbufferTest, TextureSizeReset) TYPED_TEST(PbufferTest, TextureSizeReset)
{ {
if (!mSupportsPbuffers)
{
std::cout << "Test skipped because Pbuffers are not supported." << std::endl;
return;
}
if (!mSupportsBindTexImage)
{
std::cout << "Test skipped because Pbuffer does not support binding to RGBA textures." << std::endl;
return;
}
GLuint texture = 0; GLuint texture = 0;
glGenTextures(1, &texture); glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture); glBindTexture(GL_TEXTURE_2D, texture);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment