Revert "Reland "Take GrContext private, GrDDLContext inherit from GrRecordingContext""

This reverts commit ff13ffbeac.

Reason for revert: Blink in g3

Original change's description:
> Reland "Take GrContext private, GrDDLContext inherit from GrRecordingContext"
>
> This reverts commit 89bdc90ac8.
>
> Reason for revert: Fix metal
>
> Original change's description:
> > Revert "Take GrContext private, GrDDLContext inherit from GrRecordingContext"
> >
> > This reverts commit d2daa94ede.
> >
> > Reason for revert: Metaru
> >
> > Original change's description:
> > > Take GrContext private, GrDDLContext inherit from GrRecordingContext
> > >
> > > Woo!
> > >
> > > Change-Id: I8d201b709343dc18cad31ea740575285dd035f35
> > > Docs-Preview: https://skia.org/?cl=317436
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317436
> > > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > > Commit-Queue: Adlai Holler <adlai@google.com>
> >
> > TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
> >
> > Change-Id: I9b58dee285fbdc49ebc8e76df5da0fe224cf9787
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318758
> > Reviewed-by: Adlai Holler <adlai@google.com>
> > Commit-Queue: Adlai Holler <adlai@google.com>
>
> TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
>
>
> Change-Id: Id4b10795193a904cd4ed8c36e60e74abe3b6702a
> Docs-Preview: https://skia.org/?cl=318759
> Cq-Include-Trybots: luci.skia.skia.primary:Build-Mac10.15.5-Clang-arm64-Debug-iOS_Metal,Build-Mac-Clang-x86_64-Debug-Metal
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318759
> Commit-Queue: Adlai Holler <adlai@google.com>
> Reviewed-by: Adlai Holler <adlai@google.com>

TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com

Change-Id: Ib20fe933120d56b72efaec73a0bedec60bc28def
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319184
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
This commit is contained in:
Adlai Holler 2020-09-24 11:42:38 +00:00 committed by Skia Commit-Bot
parent 96d9b52bb9
commit cf43fc6768
11 changed files with 201 additions and 36 deletions

View File

@ -31,7 +31,7 @@
#ifdef SK_GL #ifdef SK_GL
#include "include/core/SkImageInfo.h" #include "include/core/SkImageInfo.h"
#include "include/gpu/GrBackendSurface.h" #include "include/gpu/GrBackendSurface.h"
#include "include/gpu/GrDirectContext.h" #include "include/gpu/GrContext.h"
#include "include/gpu/gl/GrGLInterface.h" #include "include/gpu/gl/GrGLInterface.h"
#include "include/gpu/gl/GrGLTypes.h" #include "include/gpu/gl/GrGLTypes.h"
@ -214,7 +214,6 @@ SkImageInfo toSkImageInfo(const SimpleImageInfo& sii) {
} }
#ifdef SK_GL #ifdef SK_GL
// TODO: Migrate this to GrDirectContext.
sk_sp<GrContext> MakeGrContext(EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context) sk_sp<GrContext> MakeGrContext(EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context)
{ {
EMSCRIPTEN_RESULT r = emscripten_webgl_make_context_current(context); EMSCRIPTEN_RESULT r = emscripten_webgl_make_context_current(context);
@ -222,10 +221,10 @@ sk_sp<GrContext> MakeGrContext(EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context)
printf("failed to make webgl context current %d\n", r); printf("failed to make webgl context current %d\n", r);
return nullptr; return nullptr;
} }
// setup GrDirectContext // setup GrContext
auto interface = GrGLMakeNativeInterface(); auto interface = GrGLMakeNativeInterface();
// setup contexts // setup contexts
sk_sp<GrContext> grContext(GrDirectContext::MakeGL(interface)); sk_sp<GrContext> grContext(GrContext::MakeGL(interface));
return grContext; return grContext;
} }

View File

@ -33,7 +33,7 @@
#ifdef SK_GL #ifdef SK_GL
#include "include/gpu/GrBackendSurface.h" #include "include/gpu/GrBackendSurface.h"
#include "include/gpu/GrDirectContext.h" #include "include/gpu/GrContext.h"
#include "include/gpu/gl/GrGLInterface.h" #include "include/gpu/gl/GrGLInterface.h"
#include "include/gpu/gl/GrGLTypes.h" #include "include/gpu/gl/GrGLTypes.h"
@ -436,7 +436,7 @@ sk_sp<GrContext> MakeGrContext(EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context)
return nullptr; return nullptr;
} }
// setup contexts // setup contexts
sk_sp<GrContext> grContext(GrDirectContext::MakeGL(interface)); sk_sp<GrContext> grContext(GrContext::MakeGL(interface));
return grContext; return grContext;
} }

View File

@ -13,6 +13,7 @@ skia_gpu_sources = [
"$_include/gpu/GrBackendSurface.h", "$_include/gpu/GrBackendSurface.h",
"$_include/gpu/GrBackendSurfaceMutableState.h", "$_include/gpu/GrBackendSurfaceMutableState.h",
"$_include/gpu/GrConfig.h", "$_include/gpu/GrConfig.h",
"$_include/gpu/GrContext.h",
"$_include/gpu/GrContextOptions.h", "$_include/gpu/GrContextOptions.h",
"$_include/gpu/GrContextThreadSafeProxy.h", "$_include/gpu/GrContextThreadSafeProxy.h",
"$_include/gpu/GrDirectContext.h", "$_include/gpu/GrDirectContext.h",
@ -21,7 +22,6 @@ skia_gpu_sources = [
"$_include/gpu/GrTypes.h", "$_include/gpu/GrTypes.h",
# Private includes # Private includes
"$_include/private/GrContext.h",
"$_include/private/GrContext_Base.h", "$_include/private/GrContext_Base.h",
"$_include/private/GrGLTypesPriv.h", "$_include/private/GrGLTypesPriv.h",
"$_include/private/GrImageContext.h", "$_include/private/GrImageContext.h",

View File

@ -49,6 +49,62 @@ class SkTraceMemoryDump;
class SK_API GrContext : public GrRecordingContext { class SK_API GrContext : public GrRecordingContext {
public: 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
* GrGLMakeNativeInterface() is used if it succeeds.
*/
static sk_sp<GrContext> MakeGL(sk_sp<const GrGLInterface>, const GrContextOptions&);
static sk_sp<GrContext> MakeGL(sk_sp<const GrGLInterface>);
static sk_sp<GrContext> MakeGL(const GrContextOptions&);
static sk_sp<GrContext> MakeGL();
#endif
#ifdef SK_VULKAN
/**
* The Vulkan context (VkQueue, VkDevice, VkInstance) must be kept alive until the returned
* GrContext is destroyed. This also means that any objects created with this GrContext (e.g.
* SkSurfaces, SkImages, etc.) must also be released as they may hold refs on the GrContext.
* Once all these objects and the GrContext are released, then it is safe to delete the vulkan
* objects.
*/
static sk_sp<GrContext> MakeVulkan(const GrVkBackendContext&, const GrContextOptions&);
static sk_sp<GrContext> MakeVulkan(const GrVkBackendContext&);
#endif
#ifdef SK_METAL
/**
* Makes a GrContext which uses Metal as the backend. The device parameter is an MTLDevice
* and queue is an MTLCommandQueue which should be used by the backend. These objects must
* have a ref on them which can be transferred to Ganesh which will release the ref when the
* GrContext is destroyed.
*/
static sk_sp<GrContext> MakeMetal(void* device, void* queue, const GrContextOptions& options);
static sk_sp<GrContext> MakeMetal(void* device, void* queue);
#endif
#ifdef SK_DIRECT3D
/**
* Makes a GrContext which uses Direct3D as the backend. The Direct3D context
* must be kept alive until the returned GrContext is first destroyed or abandoned.
*/
static sk_sp<GrContext> MakeDirect3D(const GrD3DBackendContext&,
const GrContextOptions& options);
static sk_sp<GrContext> MakeDirect3D(const GrD3DBackendContext&);
#endif
#ifdef SK_DAWN
static sk_sp<GrContext> MakeDawn(const wgpu::Device& device, const GrContextOptions& options);
static sk_sp<GrContext> MakeDawn(const wgpu::Device& device);
#endif
static sk_sp<GrContext> MakeMock(const GrMockOptions*, const GrContextOptions&);
static sk_sp<GrContext> MakeMock(const GrMockOptions*);
#endif // SK_DISABLE_LEGACY_CONTEXT_FACTORIES
~GrContext() override; ~GrContext() override;
// TODO: Remove this from public after migrating Chrome. // TODO: Remove this from public after migrating Chrome.

View File

@ -8,7 +8,7 @@
#ifndef GrDirectContext_DEFINED #ifndef GrDirectContext_DEFINED
#define GrDirectContext_DEFINED #define GrDirectContext_DEFINED
#include "include/private/GrContext.h" #include "include/gpu/GrContext.h"
class GrAtlasManager; class GrAtlasManager;
class GrSmallPathAtlasMgr; class GrSmallPathAtlasMgr;

View File

@ -150,21 +150,21 @@ struct ColorSettings {
GrGLenum pixFormat; GrGLenum pixFormat;
}; };
sk_sp<GrDirectContext> MakeGrContext(EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context) sk_sp<GrContext> MakeGrContext(EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context)
{ {
EMSCRIPTEN_RESULT r = emscripten_webgl_make_context_current(context); EMSCRIPTEN_RESULT r = emscripten_webgl_make_context_current(context);
if (r < 0) { if (r < 0) {
printf("failed to make webgl context current %d\n", r); printf("failed to make webgl context current %d\n", r);
return nullptr; return nullptr;
} }
// setup GrDirectContext // setup GrContext
auto interface = GrGLMakeNativeInterface(); auto interface = GrGLMakeNativeInterface();
// setup contexts // setup contexts
sk_sp<GrDirectContext> dContext(GrDirectContext::MakeGL(interface)); sk_sp<GrContext> grContext(GrContext::MakeGL(interface));
return dContext; return grContext;
} }
sk_sp<SkSurface> MakeOnScreenGLSurface(sk_sp<GrDirectContext> dContext, int width, int height, sk_sp<SkSurface> MakeOnScreenGLSurface(sk_sp<GrContext> grContext, int width, int height,
sk_sp<SkColorSpace> colorSpace) { sk_sp<SkColorSpace> colorSpace) {
// WebGL should already be clearing the color and stencil buffers, but do it again here to // WebGL should already be clearing the color and stencil buffers, but do it again here to
// ensure Skia receives them in the expected state. // ensure Skia receives them in the expected state.
@ -172,7 +172,7 @@ sk_sp<SkSurface> MakeOnScreenGLSurface(sk_sp<GrDirectContext> dContext, int widt
glClearColor(0, 0, 0, 0); glClearColor(0, 0, 0, 0);
glClearStencil(0); glClearStencil(0);
glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
dContext->resetContext(kRenderTarget_GrGLBackendState | kMisc_GrGLBackendState); grContext->resetContext(kRenderTarget_GrGLBackendState | kMisc_GrGLBackendState);
// The on-screen canvas is FBO 0. Wrap it in a Skia render target so Skia can render to it. // The on-screen canvas is FBO 0. Wrap it in a Skia render target so Skia can render to it.
GrGLFramebufferInfo info; GrGLFramebufferInfo info;
@ -187,15 +187,15 @@ sk_sp<SkSurface> MakeOnScreenGLSurface(sk_sp<GrDirectContext> dContext, int widt
const auto colorSettings = ColorSettings(colorSpace); const auto colorSettings = ColorSettings(colorSpace);
info.fFormat = colorSettings.pixFormat; info.fFormat = colorSettings.pixFormat;
GrBackendRenderTarget target(width, height, sampleCnt, stencil, info); GrBackendRenderTarget target(width, height, sampleCnt, stencil, info);
sk_sp<SkSurface> surface(SkSurface::MakeFromBackendRenderTarget(dContext.get(), target, sk_sp<SkSurface> surface(SkSurface::MakeFromBackendRenderTarget(grContext.get(), target,
kBottomLeft_GrSurfaceOrigin, colorSettings.colorType, colorSpace, nullptr)); kBottomLeft_GrSurfaceOrigin, colorSettings.colorType, colorSpace, nullptr));
return surface; return surface;
} }
sk_sp<SkSurface> MakeRenderTarget(sk_sp<GrDirectContext> dContext, int width, int height) { sk_sp<SkSurface> MakeRenderTarget(sk_sp<GrContext> grContext, int width, int height) {
SkImageInfo info = SkImageInfo::MakeN32(width, height, SkAlphaType::kPremul_SkAlphaType); SkImageInfo info = SkImageInfo::MakeN32(width, height, SkAlphaType::kPremul_SkAlphaType);
sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(dContext.get(), sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(grContext.get(),
SkBudgeted::kYes, SkBudgeted::kYes,
info, 0, info, 0,
kBottomLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin,
@ -203,8 +203,8 @@ sk_sp<SkSurface> MakeRenderTarget(sk_sp<GrDirectContext> dContext, int width, in
return surface; return surface;
} }
sk_sp<SkSurface> MakeRenderTarget(sk_sp<GrDirectContext> dContext, SimpleImageInfo sii) { sk_sp<SkSurface> MakeRenderTarget(sk_sp<GrContext> grContext, SimpleImageInfo sii) {
sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(dContext.get(), sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(grContext.get(),
SkBudgeted::kYes, SkBudgeted::kYes,
toSkImageInfo(sii), 0, toSkImageInfo(sii), 0,
kBottomLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin,
@ -736,8 +736,8 @@ EMSCRIPTEN_BINDINGS(Skia) {
function("setCurrentContext", &emscripten_webgl_make_context_current); function("setCurrentContext", &emscripten_webgl_make_context_current);
function("MakeGrContext", &MakeGrContext); function("MakeGrContext", &MakeGrContext);
function("MakeOnScreenGLSurface", &MakeOnScreenGLSurface); function("MakeOnScreenGLSurface", &MakeOnScreenGLSurface);
function("MakeRenderTarget", select_overload<sk_sp<SkSurface>(sk_sp<GrDirectContext>, int, int)>(&MakeRenderTarget)); function("MakeRenderTarget", select_overload<sk_sp<SkSurface>(sk_sp<GrContext>, int, int)>(&MakeRenderTarget));
function("MakeRenderTarget", select_overload<sk_sp<SkSurface>(sk_sp<GrDirectContext>, SimpleImageInfo)>(&MakeRenderTarget)); function("MakeRenderTarget", select_overload<sk_sp<SkSurface>(sk_sp<GrContext>, SimpleImageInfo)>(&MakeRenderTarget));
constant("gpu", true); constant("gpu", true);
#endif #endif
@ -908,26 +908,22 @@ EMSCRIPTEN_BINDINGS(Skia) {
}), allow_raw_pointers()); }), allow_raw_pointers());
#ifdef SK_GL #ifdef SK_GL
class_<GrDirectContext>("GrDirectContext") class_<GrContext>("GrContext")
.smart_ptr<sk_sp<GrDirectContext>>("sk_sp<GrDirectContext>") .smart_ptr<sk_sp<GrContext>>("sk_sp<GrContext>")
.function("getResourceCacheLimitBytes", .function("getResourceCacheLimitBytes", optional_override([](GrContext& self)->size_t {
optional_override([](GrDirectContext& self)->size_t {
int maxResources = 0;// ignored int maxResources = 0;// ignored
size_t currMax = 0; size_t currMax = 0;
self.getResourceCacheLimits(&maxResources, &currMax); self.getResourceCacheLimits(&maxResources, &currMax);
return currMax; return currMax;
})) }))
.function("getResourceCacheUsageBytes", .function("getResourceCacheUsageBytes", optional_override([](GrContext& self)->size_t {
optional_override([](GrDirectContext& self)->size_t {
int usedResources = 0;// ignored int usedResources = 0;// ignored
size_t currUsage = 0; size_t currUsage = 0;
self.getResourceCacheUsage(&usedResources, &currUsage); self.getResourceCacheUsage(&usedResources, &currUsage);
return currUsage; return currUsage;
})) }))
.function("releaseResourcesAndAbandonContext", .function("releaseResourcesAndAbandonContext", &GrContext::releaseResourcesAndAbandonContext)
&GrDirectContext::releaseResourcesAndAbandonContext) .function("setResourceCacheLimitBytes", optional_override([](GrContext& self, size_t maxResourceBytes)->void {
.function("setResourceCacheLimitBytes",
optional_override([](GrDirectContext& self, size_t maxResourceBytes)->void {
int maxResources = 0; int maxResources = 0;
size_t currMax = 0; // ignored size_t currMax = 0; // ignored
self.getResourceCacheLimits(&maxResources, &currMax); self.getResourceCacheLimits(&maxResources, &currMax);

View File

@ -9,6 +9,7 @@
#include <emscripten/bind.h> #include <emscripten/bind.h>
#include "include/core/SkCanvas.h" #include "include/core/SkCanvas.h"
#include "include/core/SkSurface.h" #include "include/core/SkSurface.h"
#include "include/gpu/GrContext.h"
#include "tools/skui/InputState.h" #include "tools/skui/InputState.h"
#include "tools/skui/ModifierKey.h" #include "tools/skui/ModifierKey.h"
#include "tools/viewer/SKPSlide.h" #include "tools/viewer/SKPSlide.h"

View File

@ -84,7 +84,7 @@ has been made current to the current thread when Skia calls are made.
<!--?prettify lang=cc?--> <!--?prettify lang=cc?-->
#include "GrDirectContext.h" #include "GrContext.h"
#include "gl/GrGLInterface.h" #include "gl/GrGLInterface.h"
#include "SkData.h" #include "SkData.h"
#include "SkImage.h" #include "SkImage.h"

View File

@ -5,7 +5,7 @@
* found in the LICENSE file. * found in the LICENSE file.
*/ */
#include "include/gpu/GrRecordingContext.h" #include "include/gpu/GrContext.h"
#include "src/core/SkLRUCache.h" #include "src/core/SkLRUCache.h"
#include "src/gpu/GrCaps.h" #include "src/gpu/GrCaps.h"
#include "src/gpu/GrContextThreadSafeProxyPriv.h" #include "src/gpu/GrContextThreadSafeProxyPriv.h"
@ -18,7 +18,7 @@
* The DDL Context is the one in effect during DDL Recording. It isn't backed by a GrGPU and * The DDL Context is the one in effect during DDL Recording. It isn't backed by a GrGPU and
* cannot allocate any GPU resources. * cannot allocate any GPU resources.
*/ */
class GrDDLContext final : public GrRecordingContext { class GrDDLContext final : public GrContext {
public: public:
GrDDLContext(sk_sp<GrContextThreadSafeProxy> proxy) GrDDLContext(sk_sp<GrContextThreadSafeProxy> proxy)
: INHERITED(std::move(proxy)) { : INHERITED(std::move(proxy)) {
@ -31,7 +31,21 @@ public:
INHERITED::abandonContext(); INHERITED::abandonContext();
} }
void releaseResourcesAndAbandonContext() override {
SkASSERT(0); // abandoning in a DDL Recorder doesn't make a whole lot of sense
INHERITED::releaseResourcesAndAbandonContext();
}
void freeGpuResources() override {
// freeing resources in a DDL Recorder doesn't make a whole lot of sense but some of
// our tests do it anyways
}
private: private:
// TODO: Here we're pretending this isn't derived from GrContext. Switch this to be derived from
// GrRecordingContext!
GrDirectContext* asDirectContext() override { return nullptr; }
bool init() override { bool init() override {
if (!INHERITED::init()) { if (!INHERITED::init()) {
return false; return false;
@ -44,6 +58,16 @@ private:
return true; return true;
} }
GrAtlasManager* onGetAtlasManager() override {
SkASSERT(0); // the DDL Recorders should never invoke this
return nullptr;
}
GrSmallPathAtlasMgr* onGetSmallPathAtlasMgr() override {
SkASSERT(0); // DDL recorders should never invoke this
return nullptr;
}
// Add to the set of unique program infos required by this DDL // Add to the set of unique program infos required by this DDL
void recordProgramInfo(const GrProgramInfo* programInfo) final { void recordProgramInfo(const GrProgramInfo* programInfo) final {
if (!programInfo) { if (!programInfo) {
@ -125,7 +149,7 @@ private:
ProgramInfoMap fProgramInfoMap; ProgramInfoMap fProgramInfoMap;
using INHERITED = GrRecordingContext; using INHERITED = GrContext;
}; };
sk_sp<GrRecordingContext> GrRecordingContextPriv::MakeDDL(sk_sp<GrContextThreadSafeProxy> proxy) { sk_sp<GrRecordingContext> GrRecordingContextPriv::MakeDDL(sk_sp<GrContextThreadSafeProxy> proxy) {

View File

@ -138,6 +138,27 @@ GrSmallPathAtlasMgr* GrDirectContext::onGetSmallPathAtlasMgr() {
} }
#ifdef SK_GL #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));
}
sk_sp<GrContext> GrContext::MakeGL(const GrContextOptions& options) {
return GrDirectContext::MakeGL(options);
}
sk_sp<GrContext> GrContext::MakeGL() {
return GrDirectContext::MakeGL();
}
sk_sp<GrContext> GrContext::MakeGL(sk_sp<const GrGLInterface> glInterface,
const GrContextOptions& options) {
return GrDirectContext::MakeGL(std::move(glInterface), options);
}
#endif
/*************************************************************************************************/ /*************************************************************************************************/
sk_sp<GrDirectContext> GrDirectContext::MakeGL(sk_sp<const GrGLInterface> glInterface) { sk_sp<GrDirectContext> GrDirectContext::MakeGL(sk_sp<const GrGLInterface> glInterface) {
@ -206,6 +227,20 @@ sk_sp<GrDirectContext> GrDirectContext::MakeGL(sk_sp<const GrGLInterface> glInte
} }
#endif #endif
/*************************************************************************************************/
#ifndef SK_DISABLE_LEGACY_CONTEXT_FACTORIES
sk_sp<GrContext> GrContext::MakeMock(const GrMockOptions* mockOptions) {
return GrDirectContext::MakeMock(mockOptions);
}
sk_sp<GrContext> GrContext::MakeMock(const GrMockOptions* mockOptions,
const GrContextOptions& options) {
return GrDirectContext::MakeMock(mockOptions, options);
}
#endif
/*************************************************************************************************/ /*************************************************************************************************/
sk_sp<GrDirectContext> GrDirectContext::MakeMock(const GrMockOptions* mockOptions) { sk_sp<GrDirectContext> GrDirectContext::MakeMock(const GrMockOptions* mockOptions) {
GrContextOptions defaultOptions; GrContextOptions defaultOptions;
@ -225,6 +260,20 @@ sk_sp<GrDirectContext> GrDirectContext::MakeMock(const GrMockOptions* mockOption
} }
#ifdef SK_VULKAN #ifdef SK_VULKAN
/*************************************************************************************************/
#ifndef SK_DISABLE_LEGACY_CONTEXT_FACTORIES
sk_sp<GrContext> GrContext::MakeVulkan(const GrVkBackendContext& backendContext) {
return GrDirectContext::MakeVulkan(backendContext);
}
sk_sp<GrContext> GrContext::MakeVulkan(const GrVkBackendContext& backendContext,
const GrContextOptions& options) {
return GrDirectContext::MakeVulkan(backendContext, options);
}
#endif
/*************************************************************************************************/ /*************************************************************************************************/
sk_sp<GrDirectContext> GrDirectContext::MakeVulkan(const GrVkBackendContext& backendContext) { sk_sp<GrDirectContext> GrDirectContext::MakeVulkan(const GrVkBackendContext& backendContext) {
GrContextOptions defaultOptions; GrContextOptions defaultOptions;
@ -245,6 +294,19 @@ sk_sp<GrDirectContext> GrDirectContext::MakeVulkan(const GrVkBackendContext& bac
#endif #endif
#ifdef SK_METAL #ifdef SK_METAL
/*************************************************************************************************/
#ifndef SK_DISABLE_LEGACY_CONTEXT_FACTORIES
sk_sp<GrContext> GrContext::MakeMetal(void* device, void* queue) {
return GrDirectContext::MakeMetal(device, queue);
}
sk_sp<GrContext> GrContext::MakeMetal(void* device, void* queue, const GrContextOptions& options) {
return GrDirectContext::MakeMetal(device, queue, options);
}
#endif
/*************************************************************************************************/ /*************************************************************************************************/
sk_sp<GrDirectContext> GrDirectContext::MakeMetal(void* device, void* queue) { sk_sp<GrDirectContext> GrDirectContext::MakeMetal(void* device, void* queue) {
GrContextOptions defaultOptions; GrContextOptions defaultOptions;
@ -265,6 +327,20 @@ sk_sp<GrDirectContext> GrDirectContext::MakeMetal(void* device, void* queue,
#endif #endif
#ifdef SK_DIRECT3D #ifdef SK_DIRECT3D
/*************************************************************************************************/
#ifndef SK_DISABLE_LEGACY_CONTEXT_FACTORIES
sk_sp<GrContext> GrContext::MakeDirect3D(const GrD3DBackendContext& backendContext) {
return GrDirectContext::MakeDirect3D(backendContext);
}
sk_sp<GrContext> GrContext::MakeDirect3D(const GrD3DBackendContext& backendContext,
const GrContextOptions& options) {
return GrDirectContext::MakeDirect3D(backendContext, options);
}
#endif
/*************************************************************************************************/ /*************************************************************************************************/
sk_sp<GrDirectContext> GrDirectContext::MakeDirect3D(const GrD3DBackendContext& backendContext) { sk_sp<GrDirectContext> GrDirectContext::MakeDirect3D(const GrD3DBackendContext& backendContext) {
GrContextOptions defaultOptions; GrContextOptions defaultOptions;
@ -285,6 +361,19 @@ sk_sp<GrDirectContext> GrDirectContext::MakeDirect3D(const GrD3DBackendContext&
#endif #endif
#ifdef SK_DAWN #ifdef SK_DAWN
/*************************************************************************************************/
#ifndef SK_DISABLE_LEGACY_CONTEXT_FACTORIES
sk_sp<GrContext> GrContext::MakeDawn(const wgpu::Device& device) {
return GrDirectContext::MakeDawn(device);
}
sk_sp<GrContext> GrContext::MakeDawn(const wgpu::Device& device, const GrContextOptions& options) {
return GrDirectContext::MakeDawn(device, options);
}
#endif
/*************************************************************************************************/ /*************************************************************************************************/
sk_sp<GrDirectContext> GrDirectContext::MakeDawn(const wgpu::Device& device) { sk_sp<GrDirectContext> GrDirectContext::MakeDawn(const wgpu::Device& device) {
GrContextOptions defaultOptions; GrContextOptions defaultOptions;

View File

@ -13,7 +13,7 @@
#include "include/core/SkPictureRecorder.h" #include "include/core/SkPictureRecorder.h"
#include "include/core/SkStream.h" #include "include/core/SkStream.h"
#include "include/core/SkSurface.h" #include "include/core/SkSurface.h"
#include "include/gpu/GrDirectContext.h" #include "include/gpu/GrContext.h"
#include "include/gpu/gl/GrGLAssembleInterface.h" #include "include/gpu/gl/GrGLAssembleInterface.h"
#include "include/gpu/gl/GrGLInterface.h" #include "include/gpu/gl/GrGLInterface.h"
#else #else