зеркало из https://github.com/AvaloniaUI/angle.git
DisplayWGL: Allow MakeCurrent(null).
Previously we would ignore unsetting calls to MakeCurrent. But this would prevent ANGLE from unsetting driver state on the current thread. Fix this by checking for 0/null explicitly in DisplayWGL::makeCurrent. This turned up when running test configs without recreating the Display. Bug: angleproject:3261 Change-Id: I7f747dc7649a06f019f1b89655cb71dd3b151aa0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1520992 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
This commit is contained in:
Родитель
96a387f8ff
Коммит
f06076396a
|
@ -641,13 +641,7 @@ egl::Error DisplayWGL::initializeD3DDevice()
|
|||
return egl::EglNotInitialized() << "Could not create D3D11 device, " << gl::FmtHR(result);
|
||||
}
|
||||
|
||||
egl::Error error = registerD3DDevice(mD3D11Device, &mD3D11DeviceHandle);
|
||||
if (error.isError())
|
||||
{
|
||||
return error;
|
||||
}
|
||||
|
||||
return egl::NoError();
|
||||
return registerD3DDevice(mD3D11Device, &mD3D11DeviceHandle);
|
||||
}
|
||||
|
||||
void DisplayWGL::generateExtensions(egl::DisplayExtensions *outExtensions) const
|
||||
|
@ -709,6 +703,10 @@ egl::Error DisplayWGL::makeCurrent(egl::Surface *drawSurface,
|
|||
SurfaceWGL *drawSurfaceWGL = GetImplAs<SurfaceWGL>(drawSurface);
|
||||
newDC = drawSurfaceWGL->getDC();
|
||||
}
|
||||
else
|
||||
{
|
||||
newDC = mDeviceContext;
|
||||
}
|
||||
|
||||
HGLRC newContext = currentContext.glrc;
|
||||
if (context)
|
||||
|
@ -716,9 +714,15 @@ egl::Error DisplayWGL::makeCurrent(egl::Surface *drawSurface,
|
|||
ContextWGL *contextWGL = GetImplAs<ContextWGL>(context);
|
||||
newContext = contextWGL->getContext();
|
||||
}
|
||||
else
|
||||
{
|
||||
newContext = 0;
|
||||
}
|
||||
|
||||
if (newDC != currentContext.dc || newContext != currentContext.glrc)
|
||||
{
|
||||
ASSERT(newDC != 0);
|
||||
|
||||
if (!mFunctionsWGL->makeCurrent(newDC, newContext))
|
||||
{
|
||||
// TODO(geofflang): What error type here?
|
||||
|
|
|
@ -51,10 +51,14 @@ class EGLQueryContextTest : public EGLTest, public testing::WithParamInterface<P
|
|||
|
||||
void TearDown() override
|
||||
{
|
||||
eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
eglDestroyContext(mDisplay, mContext);
|
||||
eglDestroySurface(mDisplay, mSurface);
|
||||
eglTerminate(mDisplay);
|
||||
if (mDisplay != EGL_NO_DISPLAY)
|
||||
{
|
||||
eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
eglDestroyContext(mDisplay, mContext);
|
||||
eglDestroySurface(mDisplay, mSurface);
|
||||
eglTerminate(mDisplay);
|
||||
}
|
||||
ASSERT_EGL_SUCCESS() << "Error during test TearDown";
|
||||
}
|
||||
|
||||
EGLDisplay mDisplay;
|
||||
|
@ -102,6 +106,7 @@ TEST_P(EGLQueryContextTest, GetRenderBufferBoundSurface)
|
|||
EXPECT_TRUE(eglQueryContext(mDisplay, mContext, EGL_RENDER_BUFFER, &contextRenderBuffer) !=
|
||||
EGL_FALSE);
|
||||
EXPECT_TRUE(renderBuffer == contextRenderBuffer);
|
||||
ASSERT_EGL_SUCCESS();
|
||||
}
|
||||
|
||||
TEST_P(EGLQueryContextTest, BadDisplay)
|
||||
|
|
Загрузка…
Ссылка в новой задаче