Set up to use new GrDirectContext factories in Chrome

Here is the Chrome-side CL waiting on this CL:
https://chromium-review.googlesource.com/c/chromium/src/+/2297920 Use new GrDirectContext factories instead of deprecated GrContext ones)

Change-Id: Ic607c8f4d3b87b38b5a56a2c44012b7402e074dd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302583
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2020-07-14 12:57:39 -04:00 committed by Skia Commit-Bot
parent 3d00a97bce
commit c7228c604e
3 changed files with 29 additions and 1 deletions

View File

@ -48,6 +48,8 @@ class SkTraceMemoryDump;
class SK_API GrContext : public GrRecordingContext {
public:
#ifndef SK_DISABLE_LEGACY_CONTEXT_FACTORIES
#ifdef SK_GL
/**
* Creates a GrContext for a backend context. If no GrGLInterface is provided then the result of
@ -100,6 +102,8 @@ public:
static sk_sp<GrContext> MakeMock(const GrMockOptions*, const GrContextOptions&);
static sk_sp<GrContext> MakeMock(const GrMockOptions*);
#endif // SK_DISABLE_LEGACY_CONTEXT_FACTORIES
~GrContext() override;
// TODO: Remove this from public after migrating Chrome.

View File

@ -12,7 +12,7 @@
class GrAtlasManager;
class GrDirectContext : public GrContext {
class SK_API GrDirectContext : public GrContext {
public:
#ifdef SK_GL
/**

View File

@ -118,6 +118,8 @@ bool GrDirectContext::init() {
#ifdef SK_GL
/*************************************************************************************************/
#ifndef SK_DISABLE_LEGACY_CONTEXT_FACTORIES
sk_sp<GrContext> GrContext::MakeGL(sk_sp<const GrGLInterface> glInterface) {
return GrDirectContext::MakeGL(std::move(glInterface));
}
@ -135,6 +137,8 @@ sk_sp<GrContext> GrContext::MakeGL(sk_sp<const GrGLInterface> glInterface,
return GrDirectContext::MakeGL(std::move(glInterface), options);
}
#endif
/*************************************************************************************************/
sk_sp<GrDirectContext> GrDirectContext::MakeGL(sk_sp<const GrGLInterface> glInterface) {
GrContextOptions defaultOptions;
@ -203,6 +207,8 @@ sk_sp<GrDirectContext> GrDirectContext::MakeGL(sk_sp<const GrGLInterface> glInte
#endif
/*************************************************************************************************/
#ifndef SK_DISABLE_LEGACY_CONTEXT_FACTORIES
sk_sp<GrContext> GrContext::MakeMock(const GrMockOptions* mockOptions) {
return GrDirectContext::MakeMock(mockOptions);
}
@ -212,6 +218,8 @@ sk_sp<GrContext> GrContext::MakeMock(const GrMockOptions* mockOptions,
return GrDirectContext::MakeMock(mockOptions, options);
}
#endif
/*************************************************************************************************/
sk_sp<GrDirectContext> GrDirectContext::MakeMock(const GrMockOptions* mockOptions) {
GrContextOptions defaultOptions;
@ -232,6 +240,8 @@ sk_sp<GrDirectContext> GrDirectContext::MakeMock(const GrMockOptions* mockOption
#ifdef SK_VULKAN
/*************************************************************************************************/
#ifndef SK_DISABLE_LEGACY_CONTEXT_FACTORIES
sk_sp<GrContext> GrContext::MakeVulkan(const GrVkBackendContext& backendContext) {
return GrDirectContext::MakeVulkan(backendContext);
}
@ -241,6 +251,8 @@ sk_sp<GrContext> GrContext::MakeVulkan(const GrVkBackendContext& backendContext,
return GrDirectContext::MakeVulkan(backendContext, options);
}
#endif
/*************************************************************************************************/
sk_sp<GrDirectContext> GrDirectContext::MakeVulkan(const GrVkBackendContext& backendContext) {
GrContextOptions defaultOptions;
@ -262,6 +274,8 @@ sk_sp<GrDirectContext> GrDirectContext::MakeVulkan(const GrVkBackendContext& bac
#ifdef SK_METAL
/*************************************************************************************************/
#ifndef SK_DISABLE_LEGACY_CONTEXT_FACTORIES
sk_sp<GrContext> GrContext::MakeMetal(void* device, void* queue) {
return GrDirectContext::MakeMetal(device, queue);
}
@ -270,6 +284,8 @@ sk_sp<GrContext> GrContext::MakeMetal(void* device, void* queue, const GrContext
return GrDirectContext::MakeMetal(device, queue, options);
}
#endif
/*************************************************************************************************/
sk_sp<GrDirectContext> GrDirectContext::MakeMetal(void* device, void* queue) {
GrContextOptions defaultOptions;
@ -291,6 +307,8 @@ sk_sp<GrDirectContext> GrDirectContext::MakeMetal(void* device, void* queue,
#ifdef SK_DIRECT3D
/*************************************************************************************************/
#ifndef SK_DISABLE_LEGACY_CONTEXT_FACTORIES
sk_sp<GrContext> GrContext::MakeDirect3D(const GrD3DBackendContext& backendContext) {
return GrDirectContext::MakeDirect3D(backendContext);
}
@ -300,6 +318,8 @@ sk_sp<GrContext> GrContext::MakeDirect3D(const GrD3DBackendContext& backendConte
return GrDirectContext::MakeDirect3D(backendContext, options);
}
#endif
/*************************************************************************************************/
sk_sp<GrDirectContext> GrDirectContext::MakeDirect3D(const GrD3DBackendContext& backendContext) {
GrContextOptions defaultOptions;
@ -321,6 +341,8 @@ sk_sp<GrDirectContext> GrDirectContext::MakeDirect3D(const GrD3DBackendContext&
#ifdef SK_DAWN
/*************************************************************************************************/
#ifndef SK_DISABLE_LEGACY_CONTEXT_FACTORIES
sk_sp<GrContext> GrContext::MakeDawn(const wgpu::Device& device) {
return GrDirectContext::MakeDawn(device);
}
@ -329,6 +351,8 @@ sk_sp<GrContext> GrContext::MakeDawn(const wgpu::Device& device, const GrContext
return GrDirectContext::MakeDawn(device, options);
}
#endif
/*************************************************************************************************/
sk_sp<GrDirectContext> GrDirectContext::MakeDawn(const wgpu::Device& device) {
GrContextOptions defaultOptions;