Commit 14154827 by Jamie Madill Committed by Commit Bot

Fix D3DTextureTest.

This test was not releasing resource in the correct order. BUG=chromium:691136 Change-Id: Ie95c4d595eac49da2707afde033eff744131fcbe Reviewed-on: https://chromium-review.googlesource.com/442684 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org>
parent 40dc8c10
...@@ -253,6 +253,8 @@ TEST_P(D3DTextureTest, Clear) ...@@ -253,6 +253,8 @@ TEST_P(D3DTextureTest, Clear)
EXPECT_PIXEL_EQ(static_cast<GLint>(bufferSize) / 2, static_cast<GLint>(bufferSize) / 2, 255, 0, EXPECT_PIXEL_EQ(static_cast<GLint>(bufferSize) / 2, static_cast<GLint>(bufferSize) / 2, 255, 0,
255, 255); 255, 255);
// Make current with null to ensure the Surface can be released immediately.
eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglDestroySurface(display, pbuffer); eglDestroySurface(display, pbuffer);
} }
...@@ -265,6 +267,7 @@ TEST_P(D3DTextureTest, BindTexImage) ...@@ -265,6 +267,7 @@ TEST_P(D3DTextureTest, BindTexImage)
} }
EGLWindow *window = getEGLWindow(); EGLWindow *window = getEGLWindow();
EGLDisplay display = window->getDisplay();
const size_t bufferSize = 32; const size_t bufferSize = 32;
...@@ -273,7 +276,7 @@ TEST_P(D3DTextureTest, BindTexImage) ...@@ -273,7 +276,7 @@ TEST_P(D3DTextureTest, BindTexImage)
ASSERT_NE(pbuffer, EGL_NO_SURFACE); ASSERT_NE(pbuffer, EGL_NO_SURFACE);
// Apply the Pbuffer and clear it to purple // Apply the Pbuffer and clear it to purple
eglMakeCurrent(window->getDisplay(), pbuffer, pbuffer, window->getContext()); eglMakeCurrent(display, pbuffer, pbuffer, window->getContext());
ASSERT_EGL_SUCCESS(); ASSERT_EGL_SUCCESS();
glViewport(0, 0, static_cast<GLsizei>(bufferSize), static_cast<GLsizei>(bufferSize)); glViewport(0, 0, static_cast<GLsizei>(bufferSize), static_cast<GLsizei>(bufferSize));
...@@ -285,8 +288,7 @@ TEST_P(D3DTextureTest, BindTexImage) ...@@ -285,8 +288,7 @@ TEST_P(D3DTextureTest, BindTexImage)
255, 255); 255, 255);
// Apply the window surface // Apply the window surface
eglMakeCurrent(window->getDisplay(), window->getSurface(), window->getSurface(), eglMakeCurrent(display, window->getSurface(), window->getSurface(), window->getContext());
window->getContext());
// Create a texture and bind the Pbuffer to it // Create a texture and bind the Pbuffer to it
GLuint texture = 0; GLuint texture = 0;
...@@ -298,7 +300,7 @@ TEST_P(D3DTextureTest, BindTexImage) ...@@ -298,7 +300,7 @@ TEST_P(D3DTextureTest, BindTexImage)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
eglBindTexImage(window->getDisplay(), pbuffer, EGL_BACK_BUFFER); eglBindTexImage(display, pbuffer, EGL_BACK_BUFFER);
glViewport(0, 0, getWindowWidth(), getWindowHeight()); glViewport(0, 0, getWindowWidth(), getWindowHeight());
ASSERT_EGL_SUCCESS(); ASSERT_EGL_SUCCESS();
...@@ -310,13 +312,17 @@ TEST_P(D3DTextureTest, BindTexImage) ...@@ -310,13 +312,17 @@ TEST_P(D3DTextureTest, BindTexImage)
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
// Unbind the texture // Unbind the texture
eglReleaseTexImage(window->getDisplay(), pbuffer, EGL_BACK_BUFFER); eglReleaseTexImage(display, pbuffer, EGL_BACK_BUFFER);
ASSERT_EGL_SUCCESS(); ASSERT_EGL_SUCCESS();
// Verify that purple was drawn // Verify that purple was drawn
EXPECT_PIXEL_EQ(getWindowWidth() / 2, getWindowHeight() / 2, 255, 0, 255, 255); EXPECT_PIXEL_EQ(getWindowWidth() / 2, getWindowHeight() / 2, 255, 0, 255, 255);
glDeleteTextures(1, &texture); glDeleteTextures(1, &texture);
// Make current with null to ensure the Surface can be released immediately.
eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglDestroySurface(display, pbuffer);
} }
// Use this to select which configurations (e.g. which renderer, which GLES major version) these // Use this to select which configurations (e.g. which renderer, which GLES major version) these
......
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