Add Context factories to GrDirectContext
In order to stage the transition from GrContext to GrDirectContext, both of them will have to have the factories for a while. This CL also removes all internal uses of the old (GrContext) factories. Change-Id: Ibe1edd0818ea23a0d54257c55f35f12526047ef3 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302263 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Adlai Holler <adlai@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
73e76a39ec
commit
f4f8011aef
@ -69,7 +69,7 @@ protected:
|
||||
}
|
||||
|
||||
void onDraw(int loops, SkCanvas* canvas) override {
|
||||
sk_sp<GrContext> context(GrContext::MakeMock(nullptr));
|
||||
sk_sp<GrDirectContext> context(GrDirectContext::MakeMock(nullptr));
|
||||
if (nullptr == context) {
|
||||
return;
|
||||
}
|
||||
@ -115,7 +115,7 @@ protected:
|
||||
}
|
||||
|
||||
void onDelayedSetup() override {
|
||||
fContext = GrContext::MakeMock(nullptr);
|
||||
fContext = GrDirectContext::MakeMock(nullptr);
|
||||
if (!fContext) {
|
||||
return;
|
||||
}
|
||||
@ -150,7 +150,7 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
sk_sp<GrContext> fContext;
|
||||
sk_sp<GrDirectContext> fContext;
|
||||
SkString fFullName;
|
||||
int fKeyData32Count;
|
||||
typedef Benchmark INHERITED;
|
||||
|
@ -47,9 +47,7 @@ public:
|
||||
GrContextOptions ctxOptions;
|
||||
ctxOptions.fGpuPathRenderers = GpuPathRenderers::kTessellation;
|
||||
|
||||
// CONTEXT TODO: MakeMock should return an sk_sp<GrDirectContext>
|
||||
auto tmp = GrContext::MakeMock(&mockOptions, ctxOptions);
|
||||
fMockContext = sk_ref_sp<GrDirectContext>(tmp->asDirectContext());
|
||||
fMockContext = GrDirectContext::MakeMock(&mockOptions, ctxOptions);
|
||||
}
|
||||
const GrDirectContext* mockContext() const { return fMockContext.get(); }
|
||||
const GrCaps& caps() const override { return *fMockContext->priv().caps(); }
|
||||
|
@ -59,6 +59,7 @@ public:
|
||||
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.
|
||||
@ -68,6 +69,7 @@ public:
|
||||
*/
|
||||
static sk_sp<GrContext> MakeVulkan(const GrVkBackendContext&, const GrContextOptions&);
|
||||
static sk_sp<GrContext> MakeVulkan(const GrVkBackendContext&);
|
||||
#endif
|
||||
|
||||
#ifdef SK_METAL
|
||||
/**
|
||||
@ -734,6 +736,8 @@ protected:
|
||||
virtual GrAtlasManager* onGetAtlasManager() = 0;
|
||||
|
||||
private:
|
||||
friend class GrDirectContext; // for access to fGpu
|
||||
|
||||
// fTaskGroup must appear before anything that uses it (e.g. fGpu), so that it is destroyed
|
||||
// after all of its users. Clients of fTaskGroup will generally want to ensure that they call
|
||||
// wait() on it as they are being destroyed, to avoid the possibility of pending tasks being
|
||||
|
@ -14,7 +14,57 @@ class GrAtlasManager;
|
||||
|
||||
class GrDirectContext : public GrContext {
|
||||
public:
|
||||
GrDirectContext(GrBackendApi backend, const GrContextOptions& options);
|
||||
#ifdef SK_GL
|
||||
/**
|
||||
* Creates a GrDirectContext for a backend context. If no GrGLInterface is provided then the
|
||||
* result of GrGLMakeNativeInterface() is used if it succeeds.
|
||||
*/
|
||||
static sk_sp<GrDirectContext> MakeGL(sk_sp<const GrGLInterface>, const GrContextOptions&);
|
||||
static sk_sp<GrDirectContext> MakeGL(sk_sp<const GrGLInterface>);
|
||||
static sk_sp<GrDirectContext> MakeGL(const GrContextOptions&);
|
||||
static sk_sp<GrDirectContext> MakeGL();
|
||||
#endif
|
||||
|
||||
#ifdef SK_VULKAN
|
||||
/**
|
||||
* The Vulkan context (VkQueue, VkDevice, VkInstance) must be kept alive until the returned
|
||||
* GrDirectContext is destroyed. This also means that any objects created with this
|
||||
* GrDirectContext (e.g. SkSurfaces, SkImages, etc.) must also be released as they may hold
|
||||
* refs on the GrDirectContext. Once all these objects and the GrDirectContext are released,
|
||||
* then it is safe to delete the vulkan objects.
|
||||
*/
|
||||
static sk_sp<GrDirectContext> MakeVulkan(const GrVkBackendContext&, const GrContextOptions&);
|
||||
static sk_sp<GrDirectContext> MakeVulkan(const GrVkBackendContext&);
|
||||
#endif
|
||||
|
||||
#ifdef SK_METAL
|
||||
/**
|
||||
* Makes a GrDirectContext 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 GrDirectContext is destroyed.
|
||||
*/
|
||||
static sk_sp<GrDirectContext> MakeMetal(void* device, void* queue, const GrContextOptions&);
|
||||
static sk_sp<GrDirectContext> MakeMetal(void* device, void* queue);
|
||||
#endif
|
||||
|
||||
#ifdef SK_DIRECT3D
|
||||
/**
|
||||
* Makes a GrDirectContext which uses Direct3D as the backend. The Direct3D context
|
||||
* must be kept alive until the returned GrDirectContext is first destroyed or abandoned.
|
||||
*/
|
||||
static sk_sp<GrDirectContext> MakeDirect3D(const GrD3DBackendContext&, const GrContextOptions&);
|
||||
static sk_sp<GrDirectContext> MakeDirect3D(const GrD3DBackendContext&);
|
||||
#endif
|
||||
|
||||
#ifdef SK_DAWN
|
||||
static sk_sp<GrDirectContext> MakeDawn(const wgpu::Device&,
|
||||
const GrContextOptions&);
|
||||
static sk_sp<GrDirectContext> MakeDawn(const wgpu::Device&);
|
||||
#endif
|
||||
|
||||
static sk_sp<GrDirectContext> MakeMock(const GrMockOptions*, const GrContextOptions&);
|
||||
static sk_sp<GrDirectContext> MakeMock(const GrMockOptions*);
|
||||
|
||||
~GrDirectContext() override;
|
||||
|
||||
@ -25,6 +75,8 @@ public:
|
||||
void freeGpuResources() override;
|
||||
|
||||
protected:
|
||||
GrDirectContext(GrBackendApi backend, const GrContextOptions& options);
|
||||
|
||||
bool init() override;
|
||||
|
||||
GrAtlasManager* onGetAtlasManager() override { return fAtlasManager; }
|
||||
|
@ -117,16 +117,35 @@ bool GrDirectContext::init() {
|
||||
}
|
||||
|
||||
#ifdef SK_GL
|
||||
/*************************************************************************************************/
|
||||
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);
|
||||
}
|
||||
|
||||
/*************************************************************************************************/
|
||||
sk_sp<GrDirectContext> GrDirectContext::MakeGL(sk_sp<const GrGLInterface> glInterface) {
|
||||
GrContextOptions defaultOptions;
|
||||
return MakeGL(std::move(glInterface), defaultOptions);
|
||||
}
|
||||
|
||||
sk_sp<GrContext> GrContext::MakeGL(const GrContextOptions& options) {
|
||||
sk_sp<GrDirectContext> GrDirectContext::MakeGL(const GrContextOptions& options) {
|
||||
return MakeGL(nullptr, options);
|
||||
}
|
||||
|
||||
sk_sp<GrContext> GrContext::MakeGL() {
|
||||
sk_sp<GrDirectContext> GrDirectContext::MakeGL() {
|
||||
GrContextOptions defaultOptions;
|
||||
return MakeGL(nullptr, defaultOptions);
|
||||
}
|
||||
@ -160,10 +179,9 @@ GrGLFunction<GrGLGetErrorFn> make_get_error_with_random_oom(GrGLFunction<GrGLGet
|
||||
}
|
||||
#endif
|
||||
|
||||
// CONTEXT TODO: Make* functions should return an sk_sp<GrDirectContext>
|
||||
sk_sp<GrContext> GrContext::MakeGL(sk_sp<const GrGLInterface> glInterface,
|
||||
const GrContextOptions& options) {
|
||||
auto direct = new GrDirectContext(GrBackendApi::kOpenGL, options);
|
||||
sk_sp<GrDirectContext> GrDirectContext::MakeGL(sk_sp<const GrGLInterface> glInterface,
|
||||
const GrContextOptions& options) {
|
||||
sk_sp<GrDirectContext> direct(new GrDirectContext(GrBackendApi::kOpenGL, options));
|
||||
#if GR_TEST_UTILS
|
||||
if (options.fRandomGLOOM) {
|
||||
auto copy = sk_make_sp<GrGLInterface>(*glInterface);
|
||||
@ -176,113 +194,157 @@ sk_sp<GrContext> GrContext::MakeGL(sk_sp<const GrGLInterface> glInterface,
|
||||
glInterface = std::move(copy);
|
||||
}
|
||||
#endif
|
||||
direct->fGpu = GrGLGpu::Make(std::move(glInterface), options, direct);
|
||||
sk_sp<GrContext> context(direct);
|
||||
if (!context->init()) {
|
||||
direct->fGpu = GrGLGpu::Make(std::move(glInterface), options, direct.get());
|
||||
if (!direct->init()) {
|
||||
return nullptr;
|
||||
}
|
||||
return context;
|
||||
return direct;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*************************************************************************************************/
|
||||
sk_sp<GrContext> GrContext::MakeMock(const GrMockOptions* mockOptions) {
|
||||
GrContextOptions defaultOptions;
|
||||
return MakeMock(mockOptions, defaultOptions);
|
||||
return GrDirectContext::MakeMock(mockOptions);
|
||||
}
|
||||
|
||||
sk_sp<GrContext> GrContext::MakeMock(const GrMockOptions* mockOptions,
|
||||
const GrContextOptions& options) {
|
||||
auto direct = new GrDirectContext(GrBackendApi::kMock, options);
|
||||
return GrDirectContext::MakeMock(mockOptions, options);
|
||||
}
|
||||
|
||||
direct->fGpu = GrMockGpu::Make(mockOptions, options, direct);
|
||||
sk_sp<GrContext> context(direct);
|
||||
if (!context->init()) {
|
||||
/*************************************************************************************************/
|
||||
sk_sp<GrDirectContext> GrDirectContext::MakeMock(const GrMockOptions* mockOptions) {
|
||||
GrContextOptions defaultOptions;
|
||||
return MakeMock(mockOptions, defaultOptions);
|
||||
}
|
||||
|
||||
sk_sp<GrDirectContext> GrDirectContext::MakeMock(const GrMockOptions* mockOptions,
|
||||
const GrContextOptions& options) {
|
||||
sk_sp<GrDirectContext> direct(new GrDirectContext(GrBackendApi::kMock, options));
|
||||
|
||||
direct->fGpu = GrMockGpu::Make(mockOptions, options, direct.get());
|
||||
if (!direct->init()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return context;
|
||||
return direct;
|
||||
}
|
||||
|
||||
sk_sp<GrContext> GrContext::MakeVulkan(const GrVkBackendContext& backendContext) {
|
||||
#ifdef SK_VULKAN
|
||||
GrContextOptions defaultOptions;
|
||||
return MakeVulkan(backendContext, defaultOptions);
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
/*************************************************************************************************/
|
||||
sk_sp<GrContext> GrContext::MakeVulkan(const GrVkBackendContext& backendContext) {
|
||||
return GrDirectContext::MakeVulkan(backendContext);
|
||||
}
|
||||
|
||||
sk_sp<GrContext> GrContext::MakeVulkan(const GrVkBackendContext& backendContext,
|
||||
const GrContextOptions& options) {
|
||||
#ifdef SK_VULKAN
|
||||
auto direct = new GrDirectContext(GrBackendApi::kVulkan, options);
|
||||
return GrDirectContext::MakeVulkan(backendContext, options);
|
||||
}
|
||||
|
||||
direct->fGpu = GrVkGpu::Make(backendContext, options, direct);
|
||||
sk_sp<GrContext> context(direct);
|
||||
if (!context->init()) {
|
||||
/*************************************************************************************************/
|
||||
sk_sp<GrDirectContext> GrDirectContext::MakeVulkan(const GrVkBackendContext& backendContext) {
|
||||
GrContextOptions defaultOptions;
|
||||
return MakeVulkan(backendContext, defaultOptions);
|
||||
}
|
||||
|
||||
sk_sp<GrDirectContext> GrDirectContext::MakeVulkan(const GrVkBackendContext& backendContext,
|
||||
const GrContextOptions& options) {
|
||||
sk_sp<GrDirectContext> direct(new GrDirectContext(GrBackendApi::kVulkan, options));
|
||||
|
||||
direct->fGpu = GrVkGpu::Make(backendContext, options, direct.get());
|
||||
if (!direct->init()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return context;
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
return direct;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SK_METAL
|
||||
/*************************************************************************************************/
|
||||
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);
|
||||
}
|
||||
|
||||
/*************************************************************************************************/
|
||||
sk_sp<GrDirectContext> GrDirectContext::MakeMetal(void* device, void* queue) {
|
||||
GrContextOptions defaultOptions;
|
||||
return MakeMetal(device, queue, defaultOptions);
|
||||
}
|
||||
|
||||
sk_sp<GrContext> GrContext::MakeMetal(void* device, void* queue, const GrContextOptions& options) {
|
||||
auto direct = new GrDirectContext(GrBackendApi::kMetal, options);
|
||||
sk_sp<GrDirectContext> GrDirectContext::MakeMetal(void* device, void* queue,
|
||||
const GrContextOptions& options) {
|
||||
sk_sp<GrDirectContext> direct(new GrDirectContext(GrBackendApi::kMetal, options));
|
||||
|
||||
direct->fGpu = GrMtlTrampoline::MakeGpu(direct, options, device, queue);
|
||||
sk_sp<GrContext> context(direct);
|
||||
if (!context->init()) {
|
||||
direct->fGpu = GrMtlTrampoline::MakeGpu(direct.get(), options, device, queue);
|
||||
if (!direct->init()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return context;
|
||||
return direct;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SK_DIRECT3D
|
||||
/*************************************************************************************************/
|
||||
sk_sp<GrContext> GrContext::MakeDirect3D(const GrD3DBackendContext& backendContext) {
|
||||
GrContextOptions defaultOptions;
|
||||
return MakeDirect3D(backendContext, defaultOptions);
|
||||
return GrDirectContext::MakeDirect3D(backendContext);
|
||||
}
|
||||
|
||||
sk_sp<GrContext> GrContext::MakeDirect3D(const GrD3DBackendContext& backendContext,
|
||||
const GrContextOptions& options) {
|
||||
auto direct = new GrDirectContext(GrBackendApi::kDirect3D, options);
|
||||
return GrDirectContext::MakeDirect3D(backendContext, options);
|
||||
}
|
||||
|
||||
direct->fGpu = GrD3DGpu::Make(backendContext, options, direct);
|
||||
sk_sp<GrContext> context(direct);
|
||||
if (!context->init()) {
|
||||
/*************************************************************************************************/
|
||||
sk_sp<GrDirectContext> GrDirectContext::MakeDirect3D(const GrD3DBackendContext& backendContext) {
|
||||
GrContextOptions defaultOptions;
|
||||
return MakeDirect3D(backendContext, defaultOptions);
|
||||
}
|
||||
|
||||
sk_sp<GrDirectContext> GrDirectContext::MakeDirect3D(const GrD3DBackendContext& backendContext,
|
||||
const GrContextOptions& options) {
|
||||
sk_sp<GrDirectContext> direct(new GrDirectContext(GrBackendApi::kDirect3D, options));
|
||||
|
||||
direct->fGpu = GrD3DGpu::Make(backendContext, options, direct.get());
|
||||
if (!direct->init()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return context;
|
||||
return direct;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SK_DAWN
|
||||
/*************************************************************************************************/
|
||||
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);
|
||||
}
|
||||
|
||||
/*************************************************************************************************/
|
||||
sk_sp<GrDirectContext> GrDirectContext::MakeDawn(const wgpu::Device& device) {
|
||||
GrContextOptions defaultOptions;
|
||||
return MakeDawn(device, defaultOptions);
|
||||
}
|
||||
|
||||
sk_sp<GrContext> GrContext::MakeDawn(const wgpu::Device& device, const GrContextOptions& options) {
|
||||
auto direct = new GrDirectContext(GrBackendApi::kDawn, options);
|
||||
sk_sp<GrDirectContext> GrDirectContext::MakeDawn(const wgpu::Device& device,
|
||||
const GrContextOptions& options) {
|
||||
sk_sp<GrDirectContext> direct(new GrDirectContext(GrBackendApi::kDawn, options));
|
||||
|
||||
direct->fGpu = GrDawnGpu::Make(device, options, direct);
|
||||
sk_sp<GrContext> context(direct);
|
||||
if (!context->init()) {
|
||||
direct->fGpu = GrDawnGpu::Make(device, options, direct.get());
|
||||
if (!direct->init()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return context;
|
||||
return direct;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1064,7 +1064,7 @@ static void test_reduced_clip_stack(skiatest::Reporter* reporter, bool enableCli
|
||||
}
|
||||
}
|
||||
|
||||
auto context = GrContext::MakeMock(nullptr);
|
||||
sk_sp<GrDirectContext> context = GrDirectContext::MakeMock(nullptr);
|
||||
const GrCaps* caps = context->priv().caps();
|
||||
|
||||
// Zero the memory we will new the GrReducedClip into. This ensures the elements gen ID
|
||||
@ -1139,7 +1139,7 @@ static void test_reduced_clip_stack_genid(skiatest::Reporter* reporter) {
|
||||
kReplace_SkClipOp, true);
|
||||
SkRect bounds = SkRect::MakeXYWH(0, 0, 100, 100);
|
||||
|
||||
auto context = GrContext::MakeMock(nullptr);
|
||||
sk_sp<GrDirectContext> context = GrDirectContext::MakeMock(nullptr);
|
||||
const GrCaps* caps = context->priv().caps();
|
||||
|
||||
SkAlignedSTStorage<1, GrReducedClip> storage;
|
||||
@ -1228,7 +1228,7 @@ static void test_reduced_clip_stack_genid(skiatest::Reporter* reporter) {
|
||||
|
||||
#undef XYWH
|
||||
#undef IXYWH
|
||||
auto context = GrContext::MakeMock(nullptr);
|
||||
sk_sp<GrDirectContext> context = GrDirectContext::MakeMock(nullptr);
|
||||
const GrCaps* caps = context->priv().caps();
|
||||
|
||||
for (size_t i = 0; i < SK_ARRAY_COUNT(testCases); ++i) {
|
||||
@ -1255,7 +1255,7 @@ static void test_reduced_clip_stack_no_aa_crash(skiatest::Reporter* reporter) {
|
||||
stack.clipDevRect(SkIRect::MakeXYWH(0, 0, 50, 50), kReplace_SkClipOp);
|
||||
SkRect bounds = SkRect::MakeXYWH(0, 0, 100, 100);
|
||||
|
||||
auto context = GrContext::MakeMock(nullptr);
|
||||
sk_sp<GrDirectContext> context = GrDirectContext::MakeMock(nullptr);
|
||||
const GrCaps* caps = context->priv().caps();
|
||||
|
||||
// At the time, this would crash.
|
||||
@ -1274,7 +1274,7 @@ static void test_aa_query(skiatest::Reporter* reporter, const SkString& testName
|
||||
const SkClipStack& stack, const SkMatrix& queryXform,
|
||||
const SkRect& preXformQuery, ClipMethod expectedMethod,
|
||||
int numExpectedElems = 0) {
|
||||
auto context = GrContext::MakeMock(nullptr);
|
||||
sk_sp<GrDirectContext> context = GrDirectContext::MakeMock(nullptr);
|
||||
const GrCaps* caps = context->priv().caps();
|
||||
|
||||
SkRect queryBounds;
|
||||
@ -1436,7 +1436,7 @@ static void test_tiny_query_bounds_assertion_bug(skiatest::Reporter* reporter) {
|
||||
SkClipStack pathStack;
|
||||
pathStack.clipPath(clipPath, SkMatrix::I(), kIntersect_SkClipOp, true);
|
||||
|
||||
auto context = GrContext::MakeMock(nullptr);
|
||||
sk_sp<GrDirectContext> context = GrDirectContext::MakeMock(nullptr);
|
||||
const GrCaps* caps = context->priv().caps();
|
||||
|
||||
for (const SkClipStack& stack : {rectStack, pathStack}) {
|
||||
|
@ -65,7 +65,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(EGLImageTest, reporter, ctxInfo) {
|
||||
if (!glCtx1) {
|
||||
return;
|
||||
}
|
||||
sk_sp<GrContext> context1 = GrContext::MakeGL(sk_ref_sp(glCtx1->gl()));
|
||||
sk_sp<GrDirectContext> context1 = GrDirectContext::MakeGL(sk_ref_sp(glCtx1->gl()));
|
||||
GrBackendTexture backendTexture1;
|
||||
GrEGLImage image = GR_EGL_NO_IMAGE;
|
||||
GrGLTextureInfo externalTexture;
|
||||
|
@ -157,7 +157,7 @@ public:
|
||||
|
||||
this->customizeOptions(&mockOptions, &ctxOptions);
|
||||
|
||||
sk_sp<GrContext> mockContext = GrContext::MakeMock(&mockOptions, ctxOptions);
|
||||
sk_sp<GrDirectContext> mockContext = GrDirectContext::MakeMock(&mockOptions, ctxOptions);
|
||||
if (!mockContext) {
|
||||
ERRORF(reporter, "could not create mock context");
|
||||
return;
|
||||
|
@ -376,7 +376,7 @@ DEF_GPUTEST(GrManyDependentsMipMappedTest, reporter, /* options */) {
|
||||
mockOptions.fMipMapSupport = true;
|
||||
GrContextOptions ctxOptions;
|
||||
ctxOptions.fReduceOpsTaskSplitting = enableSortingAndReduction;
|
||||
sk_sp<GrContext> context = GrContext::MakeMock(&mockOptions, ctxOptions);
|
||||
sk_sp<GrDirectContext> context = GrDirectContext::MakeMock(&mockOptions, ctxOptions);
|
||||
GrDrawingManager* drawingManager = context->priv().drawingManager();
|
||||
if (!context) {
|
||||
ERRORF(reporter, "could not create mock context with fReduceOpsTaskSplitting %s.",
|
||||
|
@ -32,7 +32,7 @@ static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const
|
||||
DEF_GPUTEST(GrPorterDuff, reporter, /*ctxInfo*/) {
|
||||
GrMockOptions mockOptions;
|
||||
mockOptions.fDualSourceBlendingSupport = true;
|
||||
auto context = GrContext::MakeMock(&mockOptions, GrContextOptions());
|
||||
sk_sp<GrDirectContext> context = GrDirectContext::MakeMock(&mockOptions, GrContextOptions());
|
||||
const GrCaps& caps = *context->priv().getGpu()->caps();
|
||||
|
||||
if (!caps.shaderCaps()->dualSourceBlendingSupport()) {
|
||||
|
@ -201,7 +201,7 @@ DEF_GPUTEST(LazyProxyTest, reporter, /* options */) {
|
||||
mockOptions.fConfigOptions[(int)GrColorType::kAlpha_F16].fRenderability =
|
||||
GrMockOptions::ConfigOptions::Renderability::kNonMSAA;
|
||||
mockOptions.fConfigOptions[(int)GrColorType::kAlpha_F16].fTexturable = true;
|
||||
sk_sp<GrContext> ctx = GrContext::MakeMock(&mockOptions, GrContextOptions());
|
||||
sk_sp<GrDirectContext> ctx = GrDirectContext::MakeMock(&mockOptions, GrContextOptions());
|
||||
GrProxyProvider* proxyProvider = ctx->priv().proxyProvider();
|
||||
for (bool nullTexture : {false, true}) {
|
||||
LazyProxyTest test(reporter);
|
||||
@ -223,7 +223,7 @@ static const int kSize = 16;
|
||||
|
||||
DEF_GPUTEST(LazyProxyReleaseTest, reporter, /* options */) {
|
||||
GrMockOptions mockOptions;
|
||||
sk_sp<GrContext> ctx = GrContext::MakeMock(&mockOptions, GrContextOptions());
|
||||
sk_sp<GrDirectContext> ctx = GrDirectContext::MakeMock(&mockOptions, GrContextOptions());
|
||||
auto proxyProvider = ctx->priv().proxyProvider();
|
||||
const GrCaps* caps = ctx->priv().caps();
|
||||
|
||||
@ -377,7 +377,7 @@ private:
|
||||
// associated with.
|
||||
DEF_GPUTEST(LazyProxyFailedInstantiationTest, reporter, /* options */) {
|
||||
GrMockOptions mockOptions;
|
||||
sk_sp<GrContext> ctx = GrContext::MakeMock(&mockOptions, GrContextOptions());
|
||||
sk_sp<GrDirectContext> ctx = GrDirectContext::MakeMock(&mockOptions, GrContextOptions());
|
||||
GrProxyProvider* proxyProvider = ctx->priv().proxyProvider();
|
||||
for (bool failInstantiation : {false, true}) {
|
||||
auto rtc = GrRenderTargetContext::Make(
|
||||
|
@ -170,7 +170,7 @@ private:
|
||||
* painter's order.
|
||||
*/
|
||||
DEF_GPUTEST(OpChainTest, reporter, /*ctxInfo*/) {
|
||||
auto context = GrContext::MakeMock(nullptr);
|
||||
sk_sp<GrDirectContext> context = GrDirectContext::MakeMock(nullptr);
|
||||
SkASSERT(context);
|
||||
static constexpr SkISize kDims = {kNumOps + 1, 1};
|
||||
|
||||
|
@ -76,7 +76,7 @@ static void test_path(skiatest::Reporter* reporter,
|
||||
bool checkListeners,
|
||||
GrAAType aaType = GrAAType::kNone,
|
||||
GrStyle style = GrStyle(SkStrokeRec::kFill_InitStyle)) {
|
||||
sk_sp<GrContext> ctx = GrContext::MakeMock(nullptr);
|
||||
sk_sp<GrDirectContext> ctx = GrDirectContext::MakeMock(nullptr);
|
||||
// The cache needs to be big enough that nothing gets flushed, or our expectations can be wrong
|
||||
ctx->setResourceCacheLimit(8000000);
|
||||
GrResourceCache* cache = ctx->priv().getResourceCache();
|
||||
|
@ -337,7 +337,7 @@ int TestResource::fNumAlive = 0;
|
||||
class Mock {
|
||||
public:
|
||||
Mock(size_t maxBytes) {
|
||||
fContext = GrContext::MakeMock(nullptr);
|
||||
fContext = GrDirectContext::MakeMock(nullptr);
|
||||
SkASSERT(fContext);
|
||||
fContext->setResourceCacheLimit(maxBytes);
|
||||
GrResourceCache* cache = fContext->priv().getResourceCache();
|
||||
|
@ -576,11 +576,7 @@ bool VulkanTestHelper::init(skiatest::Reporter* reporter) {
|
||||
ACQUIRE_DEVICE_VK_PROC(ImportSemaphoreFdKHR);
|
||||
ACQUIRE_DEVICE_VK_PROC(DestroySemaphore);
|
||||
|
||||
// CONTEXT TODO: MakeVulkan should return an sk_sp<GrDirectContext>
|
||||
auto tmp = GrContext::MakeVulkan(fBackendContext);
|
||||
if (tmp) {
|
||||
fDirectContext = sk_ref_sp<GrDirectContext>(tmp->asDirectContext());
|
||||
}
|
||||
fDirectContext = GrDirectContext::MakeVulkan(fBackendContext);
|
||||
REPORTER_ASSERT(reporter, fDirectContext.get());
|
||||
if (!fDirectContext) {
|
||||
return false;
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "include/core/SkRefCnt.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "include/gpu/gl/GrGLFunctions.h"
|
||||
#include "include/gpu/gl/GrGLInterface.h"
|
||||
#include "tools/gpu/gl/GLTestContext.h"
|
||||
@ -16,16 +16,16 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
// create_grcontext implementation for EGL.
|
||||
sk_sp<GrContext> create_grcontext(std::ostringstream& driverinfo,
|
||||
std::unique_ptr<sk_gpu_test::GLTestContext>* glContext) {
|
||||
// We are leaking tc, but that's OK because fiddle is a short lived proces.
|
||||
// create_direct_context implementation for EGL.
|
||||
sk_sp<GrDirectContext> create_direct_context(
|
||||
std::ostringstream& driverinfo,
|
||||
std::unique_ptr<sk_gpu_test::GLTestContext>* glContext) {
|
||||
glContext->reset(sk_gpu_test::CreatePlatformGLTestContext(kGLES_GrGLStandard));
|
||||
if (!glContext) {
|
||||
return nullptr;
|
||||
}
|
||||
(*glContext)->makeCurrent();
|
||||
sk_sp<GrContext> result = (*glContext)->makeGrContext(GrContextOptions());
|
||||
sk_sp<GrDirectContext> result = (*glContext)->makeContext(GrContextOptions());
|
||||
if (!result) {
|
||||
glContext->reset();
|
||||
return nullptr;
|
||||
|
@ -46,7 +46,7 @@ double frame; // A value in [0, 1] of where we are in the animation.
|
||||
// Global used by the local impl of SkDebugf.
|
||||
std::ostringstream gTextOutput;
|
||||
|
||||
// Global to record the GL driver info via create_grcontext().
|
||||
// Global to record the GL driver info via create_direct_context().
|
||||
std::ostringstream gGLDriverInfo;
|
||||
|
||||
void SkDebugf(const char * fmt, ...) {
|
||||
@ -294,16 +294,16 @@ int main(int argc, char** argv) {
|
||||
#ifdef SK_GL
|
||||
if (options.gpu) {
|
||||
std::unique_ptr<sk_gpu_test::GLTestContext> glContext;
|
||||
sk_sp<GrContext> grContext = create_grcontext(gGLDriverInfo, &glContext);
|
||||
if (!grContext) {
|
||||
sk_sp<GrDirectContext> direct = create_direct_context(gGLDriverInfo, &glContext);
|
||||
if (!direct) {
|
||||
fputs("Unable to get GrContext.\n", stderr);
|
||||
} else {
|
||||
if (!setup_backend_objects(grContext.get(), source, options)) {
|
||||
if (!setup_backend_objects(direct.get(), source, options)) {
|
||||
fputs("Unable to create backend objects.\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
auto surface = SkSurface::MakeRenderTarget(grContext.get(), SkBudgeted::kNo, info);
|
||||
auto surface = SkSurface::MakeRenderTarget(direct.get(), SkBudgeted::kNo, info);
|
||||
if (!surface) {
|
||||
fputs("Unable to get render surface.\n", stderr);
|
||||
exit(1);
|
||||
|
@ -89,9 +89,9 @@ extern DrawOptions GetDrawOptions();
|
||||
extern void SkDebugf(const char * format, ...);
|
||||
extern void draw(SkCanvas*);
|
||||
|
||||
// There are different implementations of create_grcontext() for EGL, Mesa,
|
||||
// There are different implementations of create_direct_context() for EGL, Mesa,
|
||||
// and a fallback to a null context.
|
||||
extern sk_sp<GrContext> create_grcontext(std::ostringstream& driverinfo,
|
||||
std::unique_ptr<sk_gpu_test::GLTestContext>* glContext);
|
||||
extern sk_sp<GrDirectContext> create_direct_context(std::ostringstream& driverinfo,
|
||||
std::unique_ptr<sk_gpu_test::GLTestContext>*);
|
||||
|
||||
#endif // fiddle_main_DEFINED
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
#include "tools/fiddle/fiddle_main.h"
|
||||
|
||||
// create_grcontext for when neither Mesa nor EGL are available.
|
||||
sk_sp<GrContext> create_grcontext(std::ostringstream& driverinfo,
|
||||
std::unique_ptr<sk_gpu_test::GLTestContext>* glContext) {
|
||||
// create_direct_context for when neither Mesa nor EGL are available.
|
||||
sk_sp<GrDirectContext> create_direct_context(std::ostringstream& driverinfo,
|
||||
std::unique_ptr<sk_gpu_test::GLTestContext>*) {
|
||||
driverinfo << "(no GL driver available)";
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -307,9 +307,7 @@ ContextInfo GrContextFactory::getContextInfoInternal(ContextType type, ContextOv
|
||||
sk_sp<GrDirectContext> grCtx;
|
||||
{
|
||||
auto restore = testCtx->makeCurrentAndAutoRestore();
|
||||
// CONTEXT TODO: makeGrContext should return an sk_sp<GrDirectContext>
|
||||
auto tmp = testCtx->makeGrContext(grOptions);
|
||||
grCtx = sk_ref_sp(GrAsDirectContext(tmp.get()));
|
||||
grCtx = testCtx->makeContext(grOptions);
|
||||
}
|
||||
if (!grCtx.get()) {
|
||||
return ContextInfo();
|
||||
|
@ -21,7 +21,7 @@ TestContext::~TestContext() {
|
||||
SkASSERT(!fGpuTimer);
|
||||
}
|
||||
|
||||
sk_sp<GrContext> TestContext::makeGrContext(const GrContextOptions&) {
|
||||
sk_sp<GrDirectContext> TestContext::makeContext(const GrContextOptions&) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "src/core/SkScopeExit.h"
|
||||
#include "tools/gpu/FenceSync.h"
|
||||
|
||||
class GrContext;
|
||||
class GrDirectContext;
|
||||
struct GrContextOptions;
|
||||
|
||||
@ -63,7 +62,7 @@ public:
|
||||
|
||||
virtual GrBackendApi backend() = 0;
|
||||
|
||||
virtual sk_sp<GrContext> makeGrContext(const GrContextOptions&);
|
||||
virtual sk_sp<GrDirectContext> makeContext(const GrContextOptions&);
|
||||
|
||||
/**
|
||||
* This will flush work to the GPU. Additionally, if the platform supports fence syncs, we will
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#ifdef SK_DIRECT3D
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "tools/gpu/d3d/D3DTestUtils.h"
|
||||
|
||||
namespace {
|
||||
@ -40,8 +40,8 @@ public:
|
||||
|
||||
void finish() override {}
|
||||
|
||||
sk_sp<GrContext> makeGrContext(const GrContextOptions& options) override {
|
||||
return GrContext::MakeDirect3D(fD3D, options);
|
||||
sk_sp<GrDirectContext> makeContext(const GrContextOptions& options) override {
|
||||
return GrDirectContext::MakeDirect3D(fD3D, options);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -21,7 +21,7 @@
|
||||
#ifdef SK_DAWN
|
||||
#include "dawn/webgpu.h"
|
||||
#include "dawn/dawn_proc.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "tools/AutoreleasePool.h"
|
||||
#if USE_OPENGL_BACKEND
|
||||
#include "dawn_native/OpenGLBackend.h"
|
||||
@ -142,8 +142,8 @@ public:
|
||||
|
||||
void finish() override {}
|
||||
|
||||
sk_sp<GrContext> makeGrContext(const GrContextOptions& options) override {
|
||||
return GrContext::MakeDawn(fDevice, options);
|
||||
sk_sp<GrDirectContext> makeContext(const GrContextOptions& options) override {
|
||||
return GrDirectContext::MakeDawn(fDevice, options);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include "tools/gpu/gl/GLTestContext.h"
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/gpu/gl/GrGLUtil.h"
|
||||
#include "tools/gpu/GpuTimer.h"
|
||||
|
||||
@ -222,9 +222,9 @@ void GLTestContext::finish() {
|
||||
#endif
|
||||
}
|
||||
|
||||
sk_sp<GrContext> GLTestContext::makeGrContext(const GrContextOptions& options) {
|
||||
sk_sp<GrDirectContext> GLTestContext::makeContext(const GrContextOptions& options) {
|
||||
#ifdef SK_GL
|
||||
return GrContext::MakeGL(fGL, options);
|
||||
return GrDirectContext::MakeGL(fGL, options);
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
sk_sp<GrContext> makeGrContext(const GrContextOptions& options) override;
|
||||
sk_sp<GrDirectContext> makeContext(const GrContextOptions& options) override;
|
||||
|
||||
protected:
|
||||
GLTestContext();
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "tools/gpu/mock/MockTestContext.h"
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@ -24,8 +24,8 @@ public:
|
||||
void testAbandon() override {}
|
||||
void finish() override {}
|
||||
|
||||
sk_sp<GrContext> makeGrContext(const GrContextOptions& options) override {
|
||||
return GrContext::MakeMock(nullptr, options);
|
||||
sk_sp<GrDirectContext> makeContext(const GrContextOptions& options) override {
|
||||
return GrDirectContext::MakeMock(nullptr, options);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
#include "tools/gpu/mtl/MtlTestContext.h"
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrContextOptions.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
|
||||
#include "src/gpu/mtl/GrMtlUtil.h"
|
||||
|
||||
@ -58,10 +58,10 @@ public:
|
||||
|
||||
void finish() override {}
|
||||
|
||||
sk_sp<GrContext> makeGrContext(const GrContextOptions& options) override {
|
||||
return GrContext::MakeMetal((__bridge void*)fDevice,
|
||||
(__bridge void*)fQueue,
|
||||
options);
|
||||
sk_sp<GrDirectContext> makeContext(const GrContextOptions& options) override {
|
||||
return GrDirectContext::MakeMetal((__bridge void*)fDevice,
|
||||
(__bridge void*)fQueue,
|
||||
options);
|
||||
}
|
||||
|
||||
id<MTLDevice> device() { return fDevice; }
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#ifdef SK_VULKAN
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "include/gpu/vk/GrVkExtensions.h"
|
||||
#include "tools/gpu/vk/VkTestUtils.h"
|
||||
|
||||
@ -73,8 +73,8 @@ public:
|
||||
|
||||
void finish() override {}
|
||||
|
||||
sk_sp<GrContext> makeGrContext(const GrContextOptions& options) override {
|
||||
return GrContext::MakeVulkan(fVk, options);
|
||||
sk_sp<GrDirectContext> makeContext(const GrContextOptions& options) override {
|
||||
return GrDirectContext::MakeVulkan(fVk, options);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -77,11 +77,7 @@ bool VkTestHelper::init() {
|
||||
ACQUIRE_DEVICE_VK_PROC(FlushMappedMemoryRanges)
|
||||
ACQUIRE_DEVICE_VK_PROC(GetImageSubresourceLayout)
|
||||
|
||||
// CONTEXT TODO: MakeVulkan should return an sk_sp<GrDirectContext>
|
||||
auto tmp = GrContext::MakeVulkan(fBackendContext);
|
||||
if (tmp) {
|
||||
fDirectContext = sk_ref_sp<GrDirectContext>(tmp->asDirectContext());
|
||||
}
|
||||
fDirectContext = GrDirectContext::MakeVulkan(fBackendContext);
|
||||
if (!fDirectContext) {
|
||||
return false;
|
||||
}
|
||||
|
@ -37,9 +37,7 @@ void DawnWindowContext::initializeContext(int width, int height) {
|
||||
fHeight = height;
|
||||
fDevice = onInitializeContext();
|
||||
|
||||
// CONTEXT TODO: MakeDawn should return an sk_sp<GrDirectContext>
|
||||
auto tmp = GrContext::MakeDawn(fDevice, fDisplayParams.fGrContextOptions);
|
||||
fContext = sk_ref_sp<GrDirectContext>(tmp->asDirectContext());
|
||||
fContext = GrDirectContext::MakeDawn(fDevice, fDisplayParams.fGrContextOptions);
|
||||
if (!fContext) {
|
||||
return;
|
||||
}
|
||||
|
@ -32,9 +32,7 @@ void GLWindowContext::initializeContext() {
|
||||
|
||||
fBackendContext = this->onInitializeContext();
|
||||
|
||||
// CONTEXT TODO: MakeGL should return an sk_sp<GrDirectContext>
|
||||
auto tmp = GrContext::MakeGL(fBackendContext, fDisplayParams.fGrContextOptions);
|
||||
fContext = sk_ref_sp<GrDirectContext>(tmp->asDirectContext());
|
||||
fContext = GrDirectContext::MakeGL(fBackendContext, fDisplayParams.fGrContextOptions);
|
||||
if (!fContext && fDisplayParams.fMSAASampleCount > 1) {
|
||||
fDisplayParams.fMSAASampleCount /= 2;
|
||||
this->initializeContext();
|
||||
|
@ -48,10 +48,8 @@ void MetalWindowContext::initializeContext() {
|
||||
|
||||
fValid = this->onInitializeContext();
|
||||
|
||||
// CONTEXT TODO: MakeMetal should return an sk_sp<GrDirectContext>
|
||||
auto tmp = GrContext::MakeMetal((__bridge void*)fDevice, (__bridge void*)fQueue,
|
||||
fDisplayParams.fGrContextOptions);
|
||||
fContext = sk_ref_sp<GrDirectContext>(tmp->asDirectContext());
|
||||
fContext = GrDirectContext::MakeMetal((__bridge void*)fDevice, (__bridge void*)fQueue,
|
||||
fDisplayParams.fGrContextOptions);
|
||||
if (!fContext && fDisplayParams.fMSAASampleCount > 1) {
|
||||
fDisplayParams.fMSAASampleCount /= 2;
|
||||
this->initializeContext();
|
||||
|
@ -118,9 +118,7 @@ void VulkanWindowContext::initializeContext() {
|
||||
GET_DEV_PROC(QueuePresentKHR);
|
||||
GET_DEV_PROC(GetDeviceQueue);
|
||||
|
||||
// CONTEXT TODO: MakeVulkan should return an sk_sp<GrDirectContext>
|
||||
auto tmp = GrContext::MakeVulkan(backendContext, fDisplayParams.fGrContextOptions);
|
||||
fContext = sk_ref_sp<GrDirectContext>(tmp->asDirectContext());
|
||||
fContext = GrDirectContext::MakeVulkan(backendContext, fDisplayParams.fGrContextOptions);
|
||||
|
||||
fSurface = fCreateVkSurfaceFn(fInstance);
|
||||
if (VK_NULL_HANDLE == fSurface) {
|
||||
|
@ -82,9 +82,7 @@ void D3D12WindowContext::initializeContext() {
|
||||
fDevice = backendContext.fDevice;
|
||||
fQueue = backendContext.fQueue;
|
||||
|
||||
// CONTEXT TODO: MakeDirect3D should return an sk_sp<GrDirectContext>
|
||||
auto tmp = GrContext::MakeDirect3D(backendContext, fDisplayParams.fGrContextOptions);
|
||||
fContext = sk_ref_sp<GrDirectContext>(tmp->asDirectContext());
|
||||
fContext = GrDirectContext::MakeDirect3D(backendContext, fDisplayParams.fGrContextOptions);
|
||||
SkASSERT(fContext);
|
||||
|
||||
// Make the swapchain
|
||||
|
@ -13,8 +13,8 @@
|
||||
#include "include/core/SkStream.h"
|
||||
#include "include/core/SkSurface.h"
|
||||
#include "include/encode/SkPngEncoder.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrContextOptions.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "include/private/SkImageInfoPriv.h"
|
||||
#include "src/core/SkFontMgrPriv.h"
|
||||
#include "src/core/SkOSFile.h"
|
||||
@ -186,7 +186,7 @@ static std::vector<SkQP::SkiaBackend> get_backends() {
|
||||
std::unique_ptr<sk_gpu_test::TestContext> testCtx = make_test_context(backend);
|
||||
if (testCtx) {
|
||||
testCtx->makeCurrent();
|
||||
if (nullptr != testCtx->makeGrContext(context_options())) {
|
||||
if (nullptr != testCtx->makeContext(context_options())) {
|
||||
result.push_back(backend);
|
||||
}
|
||||
}
|
||||
@ -203,7 +203,7 @@ static void print_backend_info(const char* dstPath,
|
||||
for (SkQP::SkiaBackend backend : backends) {
|
||||
if (std::unique_ptr<sk_gpu_test::TestContext> testCtx = make_test_context(backend)) {
|
||||
testCtx->makeCurrent();
|
||||
if (sk_sp<GrContext> ctx = testCtx->makeGrContext(context_options())) {
|
||||
if (sk_sp<GrDirectContext> ctx = testCtx->makeContext(context_options())) {
|
||||
SkString info = ctx->dump();
|
||||
// remove null
|
||||
out.write(info.c_str(), info.size());
|
||||
@ -292,7 +292,7 @@ std::tuple<SkQP::RenderOutcome, std::string> SkQP::evaluateGM(SkQP::SkiaBackend
|
||||
const SkSurfaceProps props(0, SkSurfaceProps::kLegacyFontHost_InitType);
|
||||
|
||||
sk_sp<SkSurface> surf = SkSurface::MakeRenderTarget(
|
||||
testCtx->makeGrContext(context_options(gm.get())).get(),
|
||||
testCtx->makeContext(context_options(gm.get())).get(),
|
||||
SkBudgeted::kNo, info, 0, &props);
|
||||
if (!surf) {
|
||||
return std::make_tuple(kError, "Skia Failure: gr-context");
|
||||
|
Loading…
Reference in New Issue
Block a user