diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2019-11-22 15:12:57 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2019-11-27 09:55:19 +0100 |
commit | 4b56c32512305b3c9385981f72e6ce4b609ecff6 (patch) | |
tree | 0dc5eea97a217689e40f42f1bed07c766e6e2ee7 | |
parent | 19bac12d182eb8cb212c4993808348ccc43f6c73 (diff) |
don't fall back to raster if Skia is first asked for offscreen surface
This is rare, but it may happen. Since now the code shared just one
GrContext properly, this is not really a problem anymore (and the extra
WindowContext creation shouldn't be hopefully noticeable either).
Change-Id: I50887b7512e778b70870690a3f672b27cc7f2d21
-rw-r--r-- | vcl/skia/gdiimpl.cxx | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index dfa7eb7a7320..b109b698914b 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -245,26 +245,22 @@ void SkiaSalGraphicsImpl::createOffscreenSurface() { mOffscreenGrContext = sk_app::VulkanWindowContext::getSharedGrContext(); GrContext* grContext = mOffscreenGrContext.getGrContext(); - // We may not get a GrContext if called before any onscreen window is created, - // but that happens very early, so this should be rare and insignificant. - // Unittests are an exception, they usually do not create any windows, - // so in that case do create GrContext that has no window associated. + // We may not get a GrContext if called before any onscreen window is created. if (!grContext) { - static bool isUnitTest = (getenv("LO_TESTNAME") != nullptr); - if (isUnitTest) - { - // Create temporary WindowContext with no window. That will fail, - // but it will initialize the shared GrContext. - createWindowContext(); - // Keep a reference. - sk_app::VulkanWindowContext::SharedGrContext context - = sk_app::VulkanWindowContext::getSharedGrContext(); - // Destroy the temporary WindowContext. - destroySurface(); - mOffscreenGrContext = context; - grContext = mOffscreenGrContext.getGrContext(); - } + SAL_INFO("vcl.skia", + "creating Vulkan offscreen GPU surface before any window exists"); + // Create temporary WindowContext with no window. That will fail, + // but it will initialize the shared GrContext. + createWindowContext(); + // Keep a reference. + sk_app::VulkanWindowContext::SharedGrContext context + = sk_app::VulkanWindowContext::getSharedGrContext(); + // Destroy the temporary WindowContext. + destroySurface(); + // Keep a reference until the surface is destroyed. + mOffscreenGrContext = context; + grContext = mOffscreenGrContext.getGrContext(); } if (grContext) { |