diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/skia/gdiimpl.hxx | 8 | ||||
-rw-r--r-- | vcl/skia/gdiimpl.cxx | 14 | ||||
-rw-r--r-- | vcl/skia/win/gdiimpl.cxx | 13 | ||||
-rw-r--r-- | vcl/skia/x11/gdiimpl.cxx | 12 |
4 files changed, 44 insertions, 3 deletions
diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx index af12c994d462..35106dba2ca7 100644 --- a/vcl/inc/skia/gdiimpl.hxx +++ b/vcl/inc/skia/gdiimpl.hxx @@ -219,6 +219,14 @@ protected: void drawMask(const SalTwoRect& rPosAry, const SkBitmap& rBitmap, Color nMaskColor); + // Which Skia backend to use. + enum RenderMethod + { + RenderRaster, + RenderVulkan + }; + static RenderMethod renderMethodToUse(); + SalGraphics& mParent; /// Pointer to the SalFrame or SalVirtualDevice SalGeometryProvider* mProvider; diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index f17800402818..07a59c9a7ef8 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -103,6 +103,20 @@ public: } }; +SkiaSalGraphicsImpl::RenderMethod SkiaSalGraphicsImpl::renderMethodToUse() +{ + static RenderMethod method = [] { + if (const char* env = getenv("SAL_SKIA")) + { // TODO switch the default later + if (strcmp(env, "vk") == 0 || strcmp(env, "vulkan") == 0) + return RenderVulkan; + } + return RenderRaster; + }(); + + return method; +} + SkiaSalGraphicsImpl::SkiaSalGraphicsImpl(SalGraphics& rParent, SalGeometryProvider* pProvider) : mParent(rParent) , mProvider(pProvider) diff --git a/vcl/skia/win/gdiimpl.cxx b/vcl/skia/win/gdiimpl.cxx index c597b89b657e..92af2fcad42f 100644 --- a/vcl/skia/win/gdiimpl.cxx +++ b/vcl/skia/win/gdiimpl.cxx @@ -54,8 +54,17 @@ void WinSkiaSalGraphicsImpl::createSurface() // valid here, but better check. assert(GetWidth() != 0 && GetHeight() != 0); sk_app::DisplayParams displayParams; - mWindowContext - = sk_app::window_context_factory::MakeRasterForWin(mWinParent.gethWnd(), displayParams); + switch (renderMethodToUse()) + { + case RenderRaster: + mWindowContext = sk_app::window_context_factory::MakeRasterForWin(mWinParent.gethWnd(), + displayParams); + break; + case RenderVulkan: + mWindowContext = sk_app::window_context_factory::MakeVulkanForWin(mWinParent.gethWnd(), + displayParams); + break; + } assert(SkToBool(mWindowContext)); // TODO mSurface = mWindowContext->getBackbufferSurface(); assert(mSurface.get()); diff --git a/vcl/skia/x11/gdiimpl.cxx b/vcl/skia/x11/gdiimpl.cxx index 8521a8fd01ad..36dc8d5ecf13 100644 --- a/vcl/skia/x11/gdiimpl.cxx +++ b/vcl/skia/x11/gdiimpl.cxx @@ -59,7 +59,17 @@ void X11SkiaSalGraphicsImpl::createSurface() winInfo.fVisualInfo = const_cast<SalVisual*>(&mParent.GetVisual()); winInfo.fWidth = GetWidth(); winInfo.fHeight = GetHeight(); - mWindowContext = sk_app::window_context_factory::MakeRasterForXlib(winInfo, displayParams); + switch (renderMethodToUse()) + { + case RenderRaster: + mWindowContext + = sk_app::window_context_factory::MakeRasterForXlib(winInfo, displayParams); + break; + case RenderVulkan: + mWindowContext + = sk_app::window_context_factory::MakeVulkanForXlib(winInfo, displayParams); + break; + } assert(SkToBool(mWindowContext)); // TODO mSurface = mWindowContext->getBackbufferSurface(); assert(mSurface.get()); |