Commit 3799c301 by Régis Fénéon Committed by Jamie Madill

surfaceD3D::swapRect(): always call checkForOutOfDateSwapChain() even if

width or height is 0. BUG=angleproject:990 Change-Id: I9fbdd3d341d3f6fa42dfb39950e6b2d3204c4c9b Reviewed-on: https://chromium-review.googlesource.com/267415Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarRégis Fénéon <regis.feneon@gmail.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent fa55bf1e
...@@ -255,21 +255,19 @@ egl::Error SurfaceD3D::swapRect(EGLint x, EGLint y, EGLint width, EGLint height) ...@@ -255,21 +255,19 @@ egl::Error SurfaceD3D::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
height = mHeight - y; height = mHeight - y;
} }
if (width == 0 || height == 0) if (width != 0 && height != 0)
{ {
return egl::Error(EGL_SUCCESS); EGLint status = mSwapChain->swapRect(x, y, width, height);
}
EGLint status = mSwapChain->swapRect(x, y, width, height); if (status == EGL_CONTEXT_LOST)
{
if (status == EGL_CONTEXT_LOST) mRenderer->notifyDeviceLost();
{ return egl::Error(status);
mRenderer->notifyDeviceLost(); }
return egl::Error(status); else if (status != EGL_SUCCESS)
} {
else if (status != EGL_SUCCESS) return egl::Error(status);
{ }
return egl::Error(status);
} }
checkForOutOfDateSwapChain(); checkForOutOfDateSwapChain();
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
// Tests pertaining to egl::Surface. // Tests pertaining to egl::Surface.
// //
#include <gtest/gtest.h> #include <ANGLETest.h>
#include <EGL/egl.h> #include <EGL/egl.h>
#include <EGL/eglext.h> #include <EGL/eglext.h>
#include <GLES2/gl2.h> #include <GLES2/gl2.h>
...@@ -223,4 +223,45 @@ TEST_F(EGLSurfaceTest, MakeCurrentTwice) ...@@ -223,4 +223,45 @@ TEST_F(EGLSurfaceTest, MakeCurrentTwice)
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
} }
// Test that the D3D window surface is correctly resized after calling swapBuffers
TEST_F(EGLSurfaceTest, ResizeD3DWindow)
{
const char *extensionsString = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
if (strstr(extensionsString, "EGL_ANGLE_platform_angle_d3d") == nullptr)
{
std::cout << "D3D Platform not supported in ANGLE";
return;
}
initializeSurface(EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE);
eglSwapBuffers(mDisplay, mWindowSurface);
ASSERT_EGL_SUCCESS();
EGLint height;
eglQuerySurface(mDisplay, mWindowSurface, EGL_HEIGHT, &height);
ASSERT_EGL_SUCCESS();
ASSERT_EQ(64, height); // initial size
// set window's height to 0
mOSWindow->resize(64, 0);
eglSwapBuffers(mDisplay, mWindowSurface);
ASSERT_EGL_SUCCESS();
eglQuerySurface(mDisplay, mWindowSurface, EGL_HEIGHT, &height);
ASSERT_EGL_SUCCESS();
ASSERT_EQ(0, height);
// restore window's height
mOSWindow->resize(64, 64);
eglSwapBuffers(mDisplay, mWindowSurface);
ASSERT_EGL_SUCCESS();
eglQuerySurface(mDisplay, mWindowSurface, EGL_HEIGHT, &height);
ASSERT_EGL_SUCCESS();
ASSERT_EQ(64, height);
}
} }
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