On Windows, always re-create window for GL or Vulkan
On at least one machine, I've seen SetPixelFormat fail after Vulkan was
used to render to a window, preventing us from creating a GL context.
This is ham-fisted, but solves the problem.
Bug: skia:
Change-Id: I76d0cb26e181304846aa06109c1af768f8363a18
Reviewed-on: https://skia-review.googlesource.com/22740
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index c0b8dd8..29e5b70 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -667,9 +667,10 @@
fWindow->detach();
#if defined(SK_BUILD_FOR_WIN) && defined(SK_VULKAN)
- // Switching from OpenGL to Vulkan in the same window is problematic at this point on
- // Windows, so we just delete the window and recreate it.
- if (sk_app::Window::kVulkan_BackendType == fBackendType) {
+ // Switching from OpenGL to Vulkan (or vice-versa on some systems) in the same window is
+ // problematic at this point on Windows, so we just delete the window and recreate it.
+ if (sk_app::Window::kVulkan_BackendType == fBackendType ||
+ sk_app::Window::kNativeGL_BackendType == fBackendType) {
DisplayParams params = fWindow->getRequestedDisplayParams();
delete fWindow;
fWindow = Window::CreateNativeWindow(nullptr);