Commit ea20d622 by Jamie Madill Committed by Commit Bot

Vulkan: Workaround NVIDIA not sharing with OpenGL window.

NVIDIA seems to have the limitation of not being able to work with a window handle on both OpenGL and Vulkan. Apparently this also happens with NVIDIA on Linux, but doesn't happen with any other vendor. Work around this by opening a new OS window when switching between Vulkan and non-Vulkan. BUG=angleproject:1810 Change-Id: Id6bfcc2229be5a0d97202dfc87944001b4ab7871 Reviewed-on: https://chromium-review.googlesource.com/430887Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 810026b4
......@@ -232,12 +232,6 @@ ANGLETest::ANGLETest()
{
mEGLWindow =
new EGLWindow(GetParam().majorVersion, GetParam().minorVersion, GetParam().eglParameters);
// Default vulkan layers to enabled.
if (GetParam().getRenderer() == EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE)
{
mEGLWindow->setVulkanLayersEnabled(true);
}
}
ANGLETest::~ANGLETest()
......@@ -254,6 +248,28 @@ void ANGLETest::SetUp()
angle::g_testPlatformInstance.enableMessages();
angle::g_testPlatformInstance.setCurrentTest(this);
// Default vulkan layers to enabled.
EGLint renderer = GetParam().getRenderer();
if (renderer == EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE)
{
mEGLWindow->setVulkanLayersEnabled(true);
}
// Workaround for NVIDIA not being able to share OpenGL and Vulkan contexts.
bool needsWindowSwap = mLastRendererType.valid() &&
((renderer != EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE) !=
(mLastRendererType.value() != EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE));
if (needsWindowSwap)
{
DestroyTestWindow();
if (!InitTestWindow())
{
FAIL() << "Failed to create ANGLE test window.";
}
}
mLastRendererType = renderer;
// Resize the window before creating the context so that the first make current
// sets the viewport and scissor box to the right size.
bool needSwap = false;
......@@ -909,7 +925,8 @@ void ANGLETest::ignoreD3D11SDKLayersWarnings()
mIgnoreD3D11SDKLayersWarnings = true;
}
OSWindow *ANGLETest::mOSWindow = NULL;
OSWindow *ANGLETest::mOSWindow = nullptr;
Optional<EGLint> ANGLETest::mLastRendererType;
void ANGLETestEnvironment::SetUp()
{
......
......@@ -256,6 +256,9 @@ class ANGLETest : public ::testing::TestWithParam<angle::PlatformParameters>
GLuint mQuadVertexBuffer;
static OSWindow *mOSWindow;
// Workaround for NVIDIA not being able to share a window with OpenGL and Vulkan.
static Optional<EGLint> mLastRendererType;
};
class ANGLETestEnvironment : public testing::Environment
......
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