From 5c7a25bd2fa651eda3616dbea84656549bf73cc5 Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Mon, 20 May 2019 08:38:07 -0400 Subject: [PATCH] Move explicit backend object allocation API to GrContext This initial portion of the API should be ready to go. Follow on CLs will add the other entry points. Change-Id: Ia9c708046ba08b16f9a71558e2bf2c38279abe5d Reviewed-on: https://skia-review.googlesource.com/c/skia/+/214680 Reviewed-by: Brian Salomon Commit-Queue: Robert Phillips --- dm/DMSrcSink.cpp | 4 +-- gm/imagefromyuvtextures.cpp | 4 +-- gm/wacky_yuv_formats.cpp | 4 +-- include/gpu/GrContext.h | 30 ++++++++++++++++ src/gpu/GrContext.cpp | 50 +++++++++++++++++++++++++++ src/gpu/GrContextPriv.cpp | 55 ------------------------------ src/gpu/GrContextPriv.h | 28 --------------- tests/BackendAllocationTest.cpp | 11 +++--- tests/DeferredDisplayListTest.cpp | 16 ++++----- tests/EGLImageTest.cpp | 6 ++-- tests/GrMipMappedTest.cpp | 32 ++++++++--------- tests/GrPorterDuffTest.cpp | 6 ++-- tests/GrSurfaceTest.cpp | 10 +++--- tests/ImageTest.cpp | 4 +-- tests/LazyProxyTest.cpp | 4 +-- tests/MtlBackendAllocationTest.mm | 4 +-- tests/PromiseImageTest.cpp | 24 ++++++------- tests/ProxyTest.cpp | 36 +++++++++---------- tests/ResourceAllocatorTest.cpp | 6 ++-- tests/ResourceCacheTest.cpp | 12 +++---- tests/SurfaceTest.cpp | 20 +++++------ tests/TestUtils.cpp | 2 +- tests/TextureBindingsResetTest.cpp | 4 +-- tests/VkBackendSurfaceTest.cpp | 28 +++++++-------- tests/VkWrapTests.cpp | 26 +++++++------- tests/WritePixelsTest.cpp | 4 +-- tools/DDLPromiseImageHelper.cpp | 2 +- tools/fm/fm.cpp | 12 +++---- tools/gpu/ProxyUtils.cpp | 4 +-- 29 files changed, 221 insertions(+), 227 deletions(-) diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index e9a2b8138e..26373a1afd 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -1388,7 +1388,7 @@ Error GPUSink::onDraw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log, &props); break; case SkCommandLineConfigGpu::SurfType::kBackendTexture: - backendTexture = context->priv().createBackendTexture( + backendTexture = context->createBackendTexture( info.width(), info.height(), info.colorType(), GrMipMapped::kNo, GrRenderable::kYes); surface = SkSurface::MakeFromBackendTexture(context, backendTexture, @@ -1440,7 +1440,7 @@ Error GPUSink::onDraw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log, if (!context->abandoned()) { surface.reset(); if (backendTexture.isValid()) { - context->priv().deleteBackendTexture(backendTexture); + context->deleteBackendTexture(backendTexture); } if (backendRT.isValid()) { context->priv().getGpu()->deleteTestingOnlyBackendRenderTarget(backendRT); diff --git a/gm/imagefromyuvtextures.cpp b/gm/imagefromyuvtextures.cpp index 65423dad2e..53a828ab27 100644 --- a/gm/imagefromyuvtextures.cpp +++ b/gm/imagefromyuvtextures.cpp @@ -142,7 +142,7 @@ protected: void createResultTexture(GrContext* context, int width, int height, GrBackendTexture* resultTexture) { - *resultTexture = context->priv().createBackendTexture( + *resultTexture = context->createBackendTexture( width, height, kRGBA_8888_SkColorType, GrMipMapped::kNo, GrRenderable::kYes); context->resetContext(); @@ -161,7 +161,7 @@ protected: context->flush(); gpu->testingOnly_flushGpuAndSync(); for (int i = 0; i < n; ++i) { - context->priv().deleteBackendTexture(textures[i]); + context->deleteBackendTexture(textures[i]); } context->resetContext(); diff --git a/gm/wacky_yuv_formats.cpp b/gm/wacky_yuv_formats.cpp index 88a86ff63b..42f5cc7485 100644 --- a/gm/wacky_yuv_formats.cpp +++ b/gm/wacky_yuv_formats.cpp @@ -1089,7 +1089,7 @@ protected: SkASSERT(gpu); gpu->testingOnly_flushGpuAndSync(); for (const auto& tex : fBackendTextures) { - context->priv().deleteBackendTexture(tex); + context->deleteBackendTexture(tex); } fBackendTextures.reset(); } @@ -1241,7 +1241,7 @@ protected: SkASSERT(gpu); gpu->testingOnly_flushGpuAndSync(); for (const auto& tex : fBackendTextures) { - context->priv().deleteBackendTexture(tex); + context->deleteBackendTexture(tex); } fBackendTextures.reset(); } diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index 10231350cc..850e157264 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -338,6 +338,36 @@ public: static size_t ComputeTextureSize(SkColorType type, int width, int height, GrMipMapped, bool useNextPow2 = false); + /* + * The explicitly allocated backend texture API allows clients to use Skia to create backend + * objects outside of Skia proper (i.e., Skia's caching system will not know about them.) + * + * It is the client's responsibility to delete all these objects (using deleteBackendTexture) + * before deleting the GrContext used to create them. Additionally, clients should only + * delete these objects on the thread for which that GrContext is active. + * + * Additionally, the client is responsible for ensuring synchronization between different uses + * of the backend object. + */ + + // If possible, create an uninitialized backend texture. The client should ensure that the + // returned backend texture is valid. + GrBackendTexture createBackendTexture(int width, int height, + GrBackendFormat, + GrMipMapped, + GrRenderable); + + // If possible, create an uninitialized backend texture. The client should ensure that the + // returned backend texture is valid. + // If successful, the created backend texture will be compatible with the provided + // SkColorType. + GrBackendTexture createBackendTexture(int width, int height, + SkColorType, + GrMipMapped, + GrRenderable); + + void deleteBackendTexture(GrBackendTexture); + protected: GrContext(GrBackendApi, const GrContextOptions&, int32_t contextID = SK_InvalidGenID); diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index e2374e737a..ca3a9d5fd5 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -350,3 +350,53 @@ void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { this->getTextBlobCache()->usedBytes()); } +////////////////////////////////////////////////////////////////////////////// +GrBackendTexture GrContext::createBackendTexture(int width, int height, + GrBackendFormat backendFormat, + GrMipMapped mipMapped, + GrRenderable renderable) { + if (!this->asDirectContext()) { + return GrBackendTexture(); + } + + if (this->abandoned()) { + return GrBackendTexture(); + } + + if (!backendFormat.isValid()) { + return GrBackendTexture(); + } + + return fGpu->createTestingOnlyBackendTexture(width, height, backendFormat, + mipMapped, renderable, + nullptr, 0); +} + +GrBackendTexture GrContext::createBackendTexture(int width, int height, + SkColorType colorType, + GrMipMapped mipMapped, + GrRenderable renderable) { + if (!this->asDirectContext()) { + return GrBackendTexture(); + } + + if (this->abandoned()) { + return GrBackendTexture(); + } + + GrBackendFormat format = this->caps()->getBackendFormatFromColorType(colorType); + if (!format.isValid()) { + return GrBackendTexture(); + } + + return this->createBackendTexture(width, height, format, mipMapped, renderable); +} + +void GrContext::deleteBackendTexture(GrBackendTexture backendTex) { + if (this->abandoned() || !backendTex.isValid()) { + return; + } + + fGpu->deleteTestingOnlyBackendTexture(backendTex); +} + diff --git a/src/gpu/GrContextPriv.cpp b/src/gpu/GrContextPriv.cpp index 816a7dc87c..09b5327fdf 100644 --- a/src/gpu/GrContextPriv.cpp +++ b/src/gpu/GrContextPriv.cpp @@ -764,58 +764,3 @@ void GrContextPriv::testingOnly_flushAndRemoveOnFlushCallbackObject(GrOnFlushCal fContext->drawingManager()->testingOnly_removeOnFlushCallbackObject(cb); } #endif - -////////////////////////////////////////////////////////////////////////////// -GrBackendTexture GrContextPriv::createBackendTexture(int width, int height, - GrBackendFormat backendFormat, - GrMipMapped mipMapped, - GrRenderable renderable) { - if (!fContext->asDirectContext()) { - return GrBackendTexture(); - } - - if (this->abandoned()) { - return GrBackendTexture(); - } - - if (!backendFormat.isValid()) { - return GrBackendTexture(); - } - - GrGpu* gpu = fContext->fGpu.get(); - - return gpu->createTestingOnlyBackendTexture(width, height, backendFormat, - mipMapped, renderable, - nullptr, 0); -} - -GrBackendTexture GrContextPriv::createBackendTexture(int width, int height, - SkColorType colorType, - GrMipMapped mipMapped, - GrRenderable renderable) { - if (!fContext->asDirectContext()) { - return GrBackendTexture(); - } - - if (this->abandoned()) { - return GrBackendTexture(); - } - - GrBackendFormat format = fContext->caps()->getBackendFormatFromColorType(colorType); - if (!format.isValid()) { - return GrBackendTexture(); - } - - return this->createBackendTexture(width, height, format, mipMapped, renderable); -} - -void GrContextPriv::deleteBackendTexture(GrBackendTexture backendTex) { - if (this->abandoned() || !backendTex.isValid()) { - return; - } - - GrGpu* gpu = fContext->fGpu.get(); - - gpu->deleteTestingOnlyBackendTexture(backendTex); -} - diff --git a/src/gpu/GrContextPriv.h b/src/gpu/GrContextPriv.h index 9543ffc7c9..86af1f363a 100644 --- a/src/gpu/GrContextPriv.h +++ b/src/gpu/GrContextPriv.h @@ -292,34 +292,6 @@ public: void testingOnly_flushAndRemoveOnFlushCallbackObject(GrOnFlushCallbackObject*); #endif - /* - * The explicitly allocated backend texture API allows clients to use Skia to create backend - * objects outside of Skia proper (i.e., Skia's caching system will not know about them.) - * - * It is the client's responsibility to delete all these objects (using deleteBackendTexture) - * before deleting the GrContext used to create them. Additionally, clients should only - * delete these objects on the thread for which that GrContext is active. - * - * Additionally, the client is responsible for ensuring synchronization between different uses - * of the backend object. - */ - - // If possible, create an uninitialized backend texture. The client should ensure that the - // returned backend texture is valid. - GrBackendTexture createBackendTexture(int width, int height, - GrBackendFormat, - GrMipMapped, GrRenderable); - - // If possible, create an uninitialized backend texture. The client should ensure that the - // returned backend texture is valid. - // If successful, the created backend texture will be compatible with the provided - // SkColorType. - GrBackendTexture createBackendTexture(int width, int height, - SkColorType, - GrMipMapped, GrRenderable); - - void deleteBackendTexture(GrBackendTexture); - private: explicit GrContextPriv(GrContext* context) : fContext(context) {} GrContextPriv(const GrContextPriv&); // unimpl diff --git a/tests/BackendAllocationTest.cpp b/tests/BackendAllocationTest.cpp index 218c1542c4..0046a4c5ff 100644 --- a/tests/BackendAllocationTest.cpp +++ b/tests/BackendAllocationTest.cpp @@ -72,7 +72,7 @@ void test_wrapping(GrContext* context, skiatest::Reporter* reporter, REPORTER_ASSERT(reporter, initialCount == cache->getResourceCount()); - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); } /////////////////////////////////////////////////////////////////////////////// @@ -133,8 +133,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ColorTypeBackendAllocationTest, reporter, ctx auto createMtd = [colorType](GrContext* context, GrMipMapped mipMapped, GrRenderable renderable) { - return context->priv().createBackendTexture(32, 32, colorType, - mipMapped, renderable); + return context->createBackendTexture(32, 32, colorType, mipMapped, renderable); }; test_wrapping(context, reporter, createMtd, @@ -235,8 +234,7 @@ DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(GLBackendAllocationTest, reporter, ctxInfo) { auto createMtd = [format](GrContext* context, GrMipMapped mipMapped, GrRenderable renderable) { - return context->priv().createBackendTexture(32, 32, format, - mipMapped, renderable); + return context->createBackendTexture(32, 32, format, mipMapped, renderable); }; test_wrapping(context, reporter, createMtd, @@ -318,8 +316,7 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkBackendAllocationTest, reporter, ctxInfo) { auto createMtd = [format](GrContext* context, GrMipMapped mipMapped, GrRenderable renderable) { - return context->priv().createBackendTexture(32, 32, format, - mipMapped, renderable); + return context->createBackendTexture(32, 32, format, mipMapped, renderable); }; test_wrapping(context, reporter, createMtd, diff --git a/tests/DeferredDisplayListTest.cpp b/tests/DeferredDisplayListTest.cpp index f31ebdd2e8..687f9e20ec 100644 --- a/tests/DeferredDisplayListTest.cpp +++ b/tests/DeferredDisplayListTest.cpp @@ -185,8 +185,8 @@ public: fColorType, fColorSpace, &fSurfaceProps); } - *backend = context->priv().createBackendTexture(fWidth, fHeight, fColorType, - mipmapped, GrRenderable::kYes); + *backend = context->createBackendTexture(fWidth, fHeight, fColorType, + mipmapped, GrRenderable::kYes); if (!backend->isValid() || !gpu->isTestingOnlyBackendTexture(*backend)) { return nullptr; } @@ -212,7 +212,7 @@ public: } void cleanUpBackEnd(GrContext* context, const GrBackendTexture& backend) const { - context->priv().deleteBackendTexture(backend); + context->deleteBackendTexture(backend); } private: @@ -577,7 +577,7 @@ enum class DDLStage { kMakeImage, kDrawImage, kDetach, kDrawDDL }; DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLWrapBackendTest, reporter, ctxInfo) { GrContext* context = ctxInfo.grContext(); - GrBackendTexture backendTex = context->priv().createBackendTexture( + GrBackendTexture backendTex = context->createBackendTexture( kSize, kSize, kRGBA_8888_SkColorType, GrMipMapped::kNo, GrRenderable::kNo); if (!backendTex.isValid()) { return; @@ -588,7 +588,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLWrapBackendTest, reporter, ctxInfo) { sk_sp s = params.make(context, &backend); if (!s) { - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); return; } @@ -601,7 +601,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLWrapBackendTest, reporter, ctxInfo) { if (!canvas) { s = nullptr; params.cleanUpBackEnd(context, backend); - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); return; } @@ -609,7 +609,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLWrapBackendTest, reporter, ctxInfo) { if (!deferredContext) { s = nullptr; params.cleanUpBackEnd(context, backend); - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); return; } @@ -625,7 +625,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLWrapBackendTest, reporter, ctxInfo) { TextureReleaseChecker::Release, &releaseChecker); REPORTER_ASSERT(reporter, !image); - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); s = nullptr; params.cleanUpBackEnd(context, backend); diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp index 42f46df021..808dd10522 100644 --- a/tests/EGLImageTest.cpp +++ b/tests/EGLImageTest.cpp @@ -30,7 +30,7 @@ static void cleanup(GLTestContext* glctx0, GrGLuint texID0, GLTestContext* glctx glctx1->makeCurrent(); if (grctx1) { if (backendTex1 && backendTex1->isValid()) { - grctx1->priv().deleteBackendTexture(*backendTex1); + grctx1->deleteBackendTexture(*backendTex1); } } if (GR_EGL_NO_IMAGE != image1) { @@ -87,8 +87,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(EGLImageTest, reporter, ctxInfo) { GrGpu* gpu1 = context1->priv().getGpu(); static const int kSize = 100; backendTexture1 = - context1->priv().createBackendTexture(kSize, kSize, kRGBA_8888_SkColorType, - GrMipMapped::kNo, GrRenderable::kNo); + context1->createBackendTexture(kSize, kSize, kRGBA_8888_SkColorType, + GrMipMapped::kNo, GrRenderable::kNo); if (!backendTexture1.isValid() || !gpu1->isTestingOnlyBackendTexture(backendTexture1)) { ERRORF(reporter, "Error creating texture for EGL Image"); diff --git a/tests/GrMipMappedTest.cpp b/tests/GrMipMappedTest.cpp index d6d12491e6..15718c7042 100644 --- a/tests/GrMipMappedTest.cpp +++ b/tests/GrMipMappedTest.cpp @@ -40,7 +40,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrWrappedMipMappedTest, reporter, ctxInfo) { // createBackendTexture currently doesn't support uploading data to mip maps // so we don't send any. However, we pretend there is data for the checks below which is // fine since we are never actually using these textures for any work on the gpu. - GrBackendTexture backendTex = context->priv().createBackendTexture( + GrBackendTexture backendTex = context->createBackendTexture( kSize, kSize, kRGBA_8888_SkColorType, mipMapped, renderable); sk_sp proxy; @@ -67,7 +67,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrWrappedMipMappedTest, reporter, ctxInfo) { } REPORTER_ASSERT(reporter, proxy); if (!proxy) { - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); return; } @@ -76,7 +76,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrWrappedMipMappedTest, reporter, ctxInfo) { GrTexture* texture = proxy->peekTexture(); REPORTER_ASSERT(reporter, texture); if (!texture) { - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); return; } @@ -90,7 +90,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrWrappedMipMappedTest, reporter, ctxInfo) { } else { REPORTER_ASSERT(reporter, GrMipMapped::kNo == texture->texturePriv().mipMapped()); } - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); } } } @@ -105,7 +105,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter, for (auto mipMapped : {GrMipMapped::kNo, GrMipMapped::kYes}) { for (auto willUseMips : {false, true}) { - GrBackendTexture backendTex = context->priv().createBackendTexture( + GrBackendTexture backendTex = context->createBackendTexture( kSize, kSize, kRGBA_8888_SkColorType, mipMapped, GrRenderable::kNo); sk_sp image = SkImage::MakeFromTexture(context, backendTex, @@ -117,7 +117,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter, GrTextureProxy* proxy = as_IB(image)->peekProxy(); REPORTER_ASSERT(reporter, proxy); if (!proxy) { - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); return; } @@ -126,7 +126,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter, sk_sp texture = sk_ref_sp(proxy->peekTexture()); REPORTER_ASSERT(reporter, texture); if (!texture) { - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); return; } @@ -135,7 +135,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter, kPremul_SkAlphaType, nullptr); REPORTER_ASSERT(reporter, imageGen); if (!imageGen) { - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); return; } @@ -147,7 +147,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter, REPORTER_ASSERT(reporter, genProxy); if (!genProxy) { - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); return; } @@ -159,14 +159,14 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter, REPORTER_ASSERT(reporter, genProxy->isInstantiated()); if (!genProxy->isInstantiated()) { - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); return; } GrTexture* genTexture = genProxy->peekTexture(); REPORTER_ASSERT(reporter, genTexture); if (!genTexture) { - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); return; } @@ -228,7 +228,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter, context->priv().getGpu()->testingOnly_flushGpuAndSync(); - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); } } } @@ -247,7 +247,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrImageSnapshotMipMappedTest, reporter, ctxIn for (auto isWrapped : {false, true}) { GrMipMapped mipMapped = willUseMips ? GrMipMapped::kYes : GrMipMapped::kNo; sk_sp surface; - GrBackendTexture backendTex = context->priv().createBackendTexture( + GrBackendTexture backendTex = context->createBackendTexture( kSize, kSize, kRGBA_8888_SkColorType, mipMapped, GrRenderable::kYes); if (isWrapped) { surface = SkSurface::MakeFromBackendTexture(context, @@ -266,7 +266,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrImageSnapshotMipMappedTest, reporter, ctxIn } REPORTER_ASSERT(reporter, surface); if (!surface) { - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); } SkGpuDevice* device = ((SkSurface_Gpu*)surface.get())->getDevice(); GrTextureProxy* texProxy = device->accessRenderTargetContext()->asTextureProxy(); @@ -279,7 +279,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrImageSnapshotMipMappedTest, reporter, ctxIn sk_sp image = surface->makeImageSnapshot(); REPORTER_ASSERT(reporter, image); if (!image) { - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); } texProxy = as_IB(image)->peekProxy(); REPORTER_ASSERT(reporter, mipMapped == texProxy->mipMapped()); @@ -292,7 +292,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrImageSnapshotMipMappedTest, reporter, ctxIn // to the gpu before we delete the backendHandle. context->flush(); context->priv().getGpu()->testingOnly_flushGpuAndSync(); - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); } } } diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp index 0e91eb6682..2d124a8827 100644 --- a/tests/GrPorterDuffTest.cpp +++ b/tests/GrPorterDuffTest.cpp @@ -997,8 +997,8 @@ DEF_GPUTEST(PorterDuffNoDualSourceBlending, reporter, options) { } GrBackendTexture backendTex = - ctx->priv().createBackendTexture(100, 100, kRGBA_8888_SkColorType, - GrMipMapped::kNo, GrRenderable::kNo); + ctx->createBackendTexture(100, 100, kRGBA_8888_SkColorType, + GrMipMapped::kNo, GrRenderable::kNo); GrXferProcessor::DstProxy fakeDstProxy; { @@ -1030,5 +1030,5 @@ DEF_GPUTEST(PorterDuffNoDualSourceBlending, reporter, options) { } } } - ctx->priv().deleteBackendTexture(backendTex); + ctx->deleteBackendTexture(backendTex); } diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp index fadcaf184e..79d43d972e 100644 --- a/tests/GrSurfaceTest.cpp +++ b/tests/GrSurfaceTest.cpp @@ -52,7 +52,7 @@ DEF_GPUTEST_FOR_MOCK_CONTEXT(GrSurface, reporter, ctxInfo) { REPORTER_ASSERT(reporter, tex1.get() == tex1->asTexture()); REPORTER_ASSERT(reporter, static_cast(tex1.get()) == tex1->asTexture()); - GrBackendTexture backendTex = context->priv().createBackendTexture( + GrBackendTexture backendTex = context->createBackendTexture( 256, 256, kRGBA_8888_SkColorType, GrMipMapped::kNo, GrRenderable::kNo); sk_sp texRT2 = resourceProvider->wrapRenderableBackendTexture( @@ -67,7 +67,7 @@ DEF_GPUTEST_FOR_MOCK_CONTEXT(GrSurface, reporter, ctxInfo) { REPORTER_ASSERT(reporter, static_cast(texRT2->asRenderTarget()) == static_cast(texRT2->asTexture())); - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); } // This test checks that the isConfigTexturable and isConfigRenderable are @@ -329,7 +329,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadOnlyTexture, reporter, context_info) { // Mip regen should not work with a read only texture. if (context->priv().caps()->mipMapSupport()) { - backendTex = context->priv().createBackendTexture( + backendTex = context->createBackendTexture( kSize, kSize, kRGBA_8888_SkColorType, GrMipMapped::kYes, GrRenderable::kYes); proxy = proxyProvider->wrapBackendTexture(backendTex, kTopLeft_GrSurfaceOrigin, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo, @@ -344,7 +344,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadOnlyTexture, reporter, context_info) { } static sk_sp make_wrapped_texture(GrContext* context, GrRenderable renderable) { - auto backendTexture = context->priv().createBackendTexture( + auto backendTexture = context->createBackendTexture( 10, 10, kRGBA_8888_SkColorType, GrMipMapped::kNo, renderable); sk_sp texture; if (GrRenderable::kYes == renderable) { @@ -362,7 +362,7 @@ static sk_sp make_wrapped_texture(GrContext* context, GrRenderable re auto release = [](void* rc) { auto releaseContext = static_cast(rc); auto context = releaseContext->fContext; - context->priv().deleteBackendTexture(releaseContext->fBackendTexture); + context->deleteBackendTexture(releaseContext->fBackendTexture); delete releaseContext; }; texture->setRelease(release, new ReleaseContext{context, backendTexture}); diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp index 66aa2f614c..6a4df50d35 100644 --- a/tests/ImageTest.cpp +++ b/tests/ImageTest.cpp @@ -490,7 +490,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_colorTypeSupportedAsImage, reporter SkColorType colorType = static_cast(ct); bool can = context->colorTypeSupportedAsImage(colorType); - GrBackendTexture backendTex = context->priv().createBackendTexture( + GrBackendTexture backendTex = context->createBackendTexture( kSize, kSize, colorType, GrMipMapped::kNo, GrRenderable::kNo); auto img = SkImage::MakeFromTexture(context, backendTex, kTopLeft_GrSurfaceOrigin, @@ -501,7 +501,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_colorTypeSupportedAsImage, reporter img.reset(); context->flush(); - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); } } diff --git a/tests/LazyProxyTest.cpp b/tests/LazyProxyTest.cpp index 0117f0010a..4e7b231731 100644 --- a/tests/LazyProxyTest.cpp +++ b/tests/LazyProxyTest.cpp @@ -471,7 +471,7 @@ DEF_GPUTEST(LazyProxyDeinstantiateTest, reporter, /* options */) { desc.fHeight = kSize; desc.fConfig = kRGBA_8888_GrPixelConfig; - GrBackendTexture backendTex = ctx->priv().createBackendTexture( + GrBackendTexture backendTex = ctx->createBackendTexture( kSize, kSize, kRGBA_8888_SkColorType, GrMipMapped::kNo, GrRenderable::kNo); sk_sp lazyProxy = proxyProvider->createLazyProxy( @@ -525,6 +525,6 @@ DEF_GPUTEST(LazyProxyDeinstantiateTest, reporter, /* options */) { REPORTER_ASSERT(reporter, 1 == releaseTestValue); } - ctx->priv().deleteBackendTexture(backendTex); + ctx->deleteBackendTexture(backendTex); } } diff --git a/tests/MtlBackendAllocationTest.mm b/tests/MtlBackendAllocationTest.mm index 2f0c7dd662..39fdef8dd9 100644 --- a/tests/MtlBackendAllocationTest.mm +++ b/tests/MtlBackendAllocationTest.mm @@ -92,8 +92,8 @@ DEF_GPUTEST_FOR_METAL_CONTEXT(MtlBackendAllocationTest, reporter, ctxInfo) { auto createMtd = [format](GrContext* context, GrMipMapped mipMapped, GrRenderable renderable) { - return context->priv().createBackendTexture(32, 32, format, - mipMapped, renderable); + return context->createBackendTexture(32, 32, format, + mipMapped, renderable); }; test_wrapping(context, reporter, createMtd, diff --git a/tests/PromiseImageTest.cpp b/tests/PromiseImageTest.cpp index 5b8ddd4364..6a609707de 100644 --- a/tests/PromiseImageTest.cpp +++ b/tests/PromiseImageTest.cpp @@ -167,7 +167,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PromiseImageTest, reporter, ctxInfo) { GrContext* ctx = ctxInfo.grContext(); GrGpu* gpu = ctx->priv().getGpu(); - GrBackendTexture backendTex = ctx->priv().createBackendTexture( + GrBackendTexture backendTex = ctx->createBackendTexture( kWidth, kHeight, kRGBA_8888_SkColorType, GrMipMapped::kNo, GrRenderable::kYes); REPORTER_ASSERT(reporter, backendTex.isValid()); @@ -228,7 +228,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PromiseImageTest, reporter, ctxInfo) { // Now Done should definitely have been called. check_all_done(reporter, promiseChecker); - ctx->priv().deleteBackendTexture(backendTex); + ctx->deleteBackendTexture(backendTex); } DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PromiseImageTextureReuseDifferentConfig, reporter, ctxInfo) { @@ -242,19 +242,19 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PromiseImageTextureReuseDifferentConfig, repo GrContext* ctx = ctxInfo.grContext(); GrGpu* gpu = ctx->priv().getGpu(); - GrBackendTexture backendTex1 = ctx->priv().createBackendTexture( + GrBackendTexture backendTex1 = ctx->createBackendTexture( kWidth, kHeight, kGray_8_SkColorType, GrMipMapped::kNo, GrRenderable::kNo); REPORTER_ASSERT(reporter, backendTex1.isValid()); - GrBackendTexture backendTex2 = ctx->priv().createBackendTexture( + GrBackendTexture backendTex2 = ctx->createBackendTexture( kWidth, kHeight, kAlpha_8_SkColorType, GrMipMapped::kNo, GrRenderable::kNo); REPORTER_ASSERT(reporter, backendTex2.isValid()); if (backendTex1.getBackendFormat() != backendTex2.getBackendFormat()) { - ctx->priv().deleteBackendTexture(backendTex1); + ctx->deleteBackendTexture(backendTex1); return; } // We only needed this texture to check that alpha and gray color types use the same format. - ctx->priv().deleteBackendTexture(backendTex2); + ctx->deleteBackendTexture(backendTex2); SkImageInfo info = SkImageInfo::Make(kWidth, kHeight, kRGBA_8888_SkColorType, kPremul_SkAlphaType); @@ -316,7 +316,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PromiseImageTextureReuseDifferentConfig, repo grayImg.reset(); ctx->flush(); // We do this to pick up any unref messages that are sent by unref'ing the image. check_all_done(reporter, promiseChecker, 2); - ctx->priv().deleteBackendTexture(backendTex1); + ctx->deleteBackendTexture(backendTex1); } DEF_GPUTEST(PromiseImageTextureShutdown, reporter, ctxInfo) { @@ -352,7 +352,7 @@ DEF_GPUTEST(PromiseImageTextureShutdown, reporter, ctxInfo) { continue; } - GrBackendTexture backendTex = ctx->priv().createBackendTexture( + GrBackendTexture backendTex = ctx->createBackendTexture( kWidth, kHeight, kAlpha_8_SkColorType, GrMipMapped::kNo, GrRenderable::kNo); REPORTER_ASSERT(reporter, backendTex.isValid()); @@ -390,7 +390,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PromiseImageTextureFullCache, reporter, ctxIn GrContext* ctx = ctxInfo.grContext(); - GrBackendTexture backendTex = ctx->priv().createBackendTexture( + GrBackendTexture backendTex = ctx->createBackendTexture( kWidth, kHeight, kAlpha_8_SkColorType, GrMipMapped::kNo, GrRenderable::kNo); REPORTER_ASSERT(reporter, backendTex.isValid()); @@ -442,7 +442,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PromiseImageTextureFullCache, reporter, ctxIn ctx->flush(); ctx->priv().getGpu()->testingOnly_flushGpuAndSync(); - ctx->priv().deleteBackendTexture(backendTex); + ctx->deleteBackendTexture(backendTex); } // Test case where promise image fulfill returns nullptr. @@ -453,12 +453,12 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PromiseImageNullFulfill, reporter, ctxInfo) { GrContext* ctx = ctxInfo.grContext(); // Do all this just to get a valid backend format for the image. - GrBackendTexture backendTex = ctx->priv().createBackendTexture( + GrBackendTexture backendTex = ctx->createBackendTexture( kWidth, kHeight, kRGBA_8888_SkColorType, GrMipMapped::kNo, GrRenderable::kYes); REPORTER_ASSERT(reporter, backendTex.isValid()); GrBackendFormat backendFormat = backendTex.getBackendFormat(); REPORTER_ASSERT(reporter, backendFormat.isValid()); - ctx->priv().deleteBackendTexture(backendTex); + ctx->deleteBackendTexture(backendTex); struct Counts { int fFulfillCount = 0; diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp index 6df1dbb25e..ffd2106889 100644 --- a/tests/ProxyTest.cpp +++ b/tests/ProxyTest.cpp @@ -275,14 +275,14 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { // Tests wrapBackendRenderTarget with a GrBackendTexture { GrBackendTexture backendTex = - context->priv().createBackendTexture(kWidthHeight, kWidthHeight, - colorType, - GrMipMapped::kNo, - GrRenderable::kYes); + context->createBackendTexture(kWidthHeight, kWidthHeight, + colorType, + GrMipMapped::kNo, + GrRenderable::kYes); sk_sp sProxy = proxyProvider->wrapBackendTextureAsRenderTarget( backendTex, origin, supportedNumSamples); if (!sProxy) { - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); continue; // This can fail on Mesa } @@ -294,22 +294,22 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { supportedNumSamples, SkBackingFit::kExact, caps.maxWindowRectangles()); - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); } // Tests wrapBackendTexture that is only renderable { GrBackendTexture backendTex = - context->priv().createBackendTexture(kWidthHeight, kWidthHeight, - colorType, - GrMipMapped::kNo, - GrRenderable::kYes); + context->createBackendTexture(kWidthHeight, kWidthHeight, + colorType, + GrMipMapped::kNo, + GrRenderable::kYes); sk_sp sProxy = proxyProvider->wrapRenderableBackendTexture( backendTex, origin, supportedNumSamples, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo, nullptr, nullptr); if (!sProxy) { - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); continue; // This can fail on Mesa } @@ -321,23 +321,23 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { supportedNumSamples, SkBackingFit::kExact, caps.maxWindowRectangles()); - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); } // Tests wrapBackendTexture that is only textureable { // Internal offscreen texture GrBackendTexture backendTex = - context->priv().createBackendTexture(kWidthHeight, kWidthHeight, - colorType, - GrMipMapped::kNo, - GrRenderable::kNo); + context->createBackendTexture(kWidthHeight, kWidthHeight, + colorType, + GrMipMapped::kNo, + GrRenderable::kNo); sk_sp sProxy = proxyProvider->wrapBackendTexture( backendTex, origin, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo, kRead_GrIOType); if (!sProxy) { - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); continue; } @@ -347,7 +347,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { check_texture(reporter, resourceProvider, sProxy->asTextureProxy(), SkBackingFit::kExact); - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); } } } diff --git a/tests/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp index ce3e0b3828..f0cba29463 100644 --- a/tests/ResourceAllocatorTest.cpp +++ b/tests/ResourceAllocatorTest.cpp @@ -62,8 +62,8 @@ static GrSurfaceProxy* make_backend(GrContext* context, const ProxyParams& p, GrBackendTexture* backendTex) { GrProxyProvider* proxyProvider = context->priv().proxyProvider(); - *backendTex = context->priv().createBackendTexture(p.fSize, p.fSize, p.fColorType, - GrMipMapped::kNo, GrRenderable::kNo); + *backendTex = context->createBackendTexture(p.fSize, p.fSize, p.fColorType, + GrMipMapped::kNo, GrRenderable::kNo); if (!backendTex->isValid()) { return nullptr; } @@ -82,7 +82,7 @@ static GrSurfaceProxy* make_backend(GrContext* context, const ProxyParams& p, } static void cleanup_backend(GrContext* context, const GrBackendTexture& backendTex) { - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); } // Basic test that two proxies with overlapping intervals and compatible descriptors are diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp index 6e578a96be..17b21bd720 100644 --- a/tests/ResourceCacheTest.cpp +++ b/tests/ResourceCacheTest.cpp @@ -209,10 +209,10 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxI static const int kW = 100; static const int kH = 100; - backendTextures[0] = context->priv().createBackendTexture(kW, kH, kRGBA_8888_SkColorType, - GrMipMapped::kNo, GrRenderable::kNo); - backendTextures[1] = context->priv().createBackendTexture(kW, kH, kRGBA_8888_SkColorType, - GrMipMapped::kNo, GrRenderable::kNo); + backendTextures[0] = context->createBackendTexture(kW, kH, kRGBA_8888_SkColorType, + GrMipMapped::kNo, GrRenderable::kNo); + backendTextures[1] = context->createBackendTexture(kW, kH, kRGBA_8888_SkColorType, + GrMipMapped::kNo, GrRenderable::kNo); REPORTER_ASSERT(reporter, backendTextures[0].isValid()); REPORTER_ASSERT(reporter, backendTextures[1].isValid()); if (!backendTextures[0].isValid() || !backendTextures[1].isValid()) { @@ -244,10 +244,10 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxI REPORTER_ASSERT(reporter, !adoptedIsAlive); if (borrowedIsAlive) { - context->priv().deleteBackendTexture(backendTextures[0]); + context->deleteBackendTexture(backendTextures[0]); } if (adoptedIsAlive) { - context->priv().deleteBackendTexture(backendTextures[1]); + context->deleteBackendTexture(backendTextures[1]); } context->resetContext(); diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp index c4c9ccb59e..0ae248e2e2 100644 --- a/tests/SurfaceTest.cpp +++ b/tests/SurfaceTest.cpp @@ -101,7 +101,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_colorTypeSupportedAsSurface, report REPORTER_ASSERT(reporter, can == SkToBool(surf), "ct: %d, can: %d, surf: %d", colorType, can, SkToBool(surf)); - GrBackendTexture backendTex = context->priv().createBackendTexture( + GrBackendTexture backendTex = context->createBackendTexture( kSize, kSize, colorType, GrMipMapped::kNo, GrRenderable::kYes); surf = SkSurface::MakeFromBackendTexture(context, backendTex, kTopLeft_GrSurfaceOrigin, 0, colorType, nullptr, @@ -117,7 +117,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_colorTypeSupportedAsSurface, report surf.reset(); context->flush(); - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); static constexpr int kSampleCnt = 2; @@ -126,8 +126,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_colorTypeSupportedAsSurface, report REPORTER_ASSERT(reporter, can == SkToBool(surf), "ct: %d, can: %d, surf: %d", colorType, can, SkToBool(surf)); - backendTex = context->priv().createBackendTexture(kSize, kSize, colorType, - GrMipMapped::kNo, GrRenderable::kYes); + backendTex = context->createBackendTexture(kSize, kSize, colorType, + GrMipMapped::kNo, GrRenderable::kYes); surf = SkSurface::MakeFromBackendTexture(context, backendTex, kTopLeft_GrSurfaceOrigin, kSampleCnt, colorType, nullptr, nullptr); @@ -163,7 +163,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_colorTypeSupportedAsSurface, report surf.reset(); context->flush(); - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); auto* gpu = context->priv().getGpu(); @@ -195,13 +195,13 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_maxSurfaceSamplesForColorType, repo if (!max) { continue; } - GrBackendTexture backendTex = context->priv().createBackendTexture( + GrBackendTexture backendTex = context->createBackendTexture( kSize, kSize, colorType, GrMipMapped::kNo, GrRenderable::kYes); if (!backendTex.isValid()) { continue; } SkScopeExit freeTex([&backendTex, context] { - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); }); auto info = SkImageInfo::Make(kSize, kSize, colorType, kOpaque_SkAlphaType, nullptr); auto surf = SkSurface::MakeFromBackendTexture(context, backendTex, @@ -794,7 +794,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceClear_Gpu, reporter, ctxInfo) { auto surface = surfaceFunc(context, 1, kOrigColor, &backendTex); test_surface_clear(reporter, surface, grSurfaceGetter, kOrigColor); surface.reset(); - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); } } } @@ -856,7 +856,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfacePartialDraw_Gpu, reporter, ctxInfo) { if (surface) { test_surface_draw_partially(reporter, surface, kOrigColor); surface.reset(); - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); } } } @@ -960,7 +960,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceAttachStencil_Gpu, reporter, ctxInf GrRenderTarget* rt = surface->getCanvas() ->internal_private_accessTopLayerRenderTargetContext()->accessRenderTarget(); REPORTER_ASSERT(reporter, resourceProvider->attachStencilAttachment(rt)); - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); } } } diff --git a/tests/TestUtils.cpp b/tests/TestUtils.cpp index 20d5ebbb11..84cfae81d8 100644 --- a/tests/TestUtils.cpp +++ b/tests/TestUtils.cpp @@ -156,7 +156,7 @@ bool create_backend_texture(GrContext* context, GrBackendTexture* backendTex, } void delete_backend_texture(GrContext* context, const GrBackendTexture& backendTex) { - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); } bool does_full_buffer_contain_correct_color(GrColor* srcBuffer, diff --git a/tests/TextureBindingsResetTest.cpp b/tests/TextureBindingsResetTest.cpp index 8cfb034e11..3daa712d28 100644 --- a/tests/TextureBindingsResetTest.cpp +++ b/tests/TextureBindingsResetTest.cpp @@ -101,7 +101,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(TextureBindingsResetTest, reporter, ctxInf context->resetContext(); if (supportExternal) { - GrBackendTexture texture2D = context->priv().createBackendTexture( + GrBackendTexture texture2D = context->createBackendTexture( 10, 10, kRGBA_8888_SkColorType, GrMipMapped::kNo, GrRenderable::kNo); GrGLTextureInfo info2D; REPORTER_ASSERT(reporter, texture2D.getGLTextureInfo(&info2D)); @@ -127,7 +127,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(TextureBindingsResetTest, reporter, ctxInf resetBindings(); GL(DeleteTextures(1, &infoExternal.fID)); ctxInfo.glContext()->destroyEGLImage(eglImage); - context->priv().deleteBackendTexture(texture2D); + context->deleteBackendTexture(texture2D); context->resetContext(); } diff --git a/tests/VkBackendSurfaceTest.cpp b/tests/VkBackendSurfaceTest.cpp index 2540ed0a00..adc40d972c 100644 --- a/tests/VkBackendSurfaceTest.cpp +++ b/tests/VkBackendSurfaceTest.cpp @@ -32,10 +32,10 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkImageLayoutTest, reporter, ctxInfo) { GrContext* context = ctxInfo.grContext(); - GrBackendTexture backendTex = context->priv().createBackendTexture(1, 1, - kRGBA_8888_SkColorType, - GrMipMapped::kNo, - GrRenderable::kNo); + GrBackendTexture backendTex = context->createBackendTexture(1, 1, + kRGBA_8888_SkColorType, + GrMipMapped::kNo, + GrRenderable::kNo); REPORTER_ASSERT(reporter, backendTex.isValid()); GrVkImageInfo info; @@ -119,7 +119,7 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkImageLayoutTest, reporter, ctxInfo) { REPORTER_ASSERT(reporter, invalidTexture.isValid()); REPORTER_ASSERT(reporter, GrBackendTexture::TestingOnly_Equals(invalidTexture, invalidTexture)); - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); } static void testing_release_proc(void* ctx) { @@ -138,10 +138,10 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkReleaseExternalQueueTest, reporter, ctxInfo) { } for (bool useExternal : {false, true}) { - GrBackendTexture backendTex = context->priv().createBackendTexture(1, 1, - kRGBA_8888_SkColorType, - GrMipMapped::kNo, - GrRenderable::kNo); + GrBackendTexture backendTex = context->createBackendTexture(1, 1, + kRGBA_8888_SkColorType, + GrMipMapped::kNo, + GrRenderable::kNo); sk_sp image; int count = 0; if (useExternal) { @@ -202,7 +202,7 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkReleaseExternalQueueTest, reporter, ctxInfo) { // Now that we flushed and waited the release proc should have be triggered. REPORTER_ASSERT(reporter, count == 1); - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); } } @@ -222,7 +222,7 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkPrepareForExternalIOQueueTransitionTest, report // We don't set textures to present continue; } - GrBackendTexture backendTex = context->priv().createBackendTexture( + GrBackendTexture backendTex = context->createBackendTexture( 4, 4, kRGBA_8888_SkColorType, GrMipMapped::kNo, useSurface ? GrRenderable::kYes : GrRenderable::kNo); @@ -323,7 +323,7 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkPrepareForExternalIOQueueTransitionTest, report GrFlushInfo flushInfo; flushInfo.fFlags = kSyncCpu_GrFlushFlag; context->flush(flushInfo); - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); } } } @@ -338,7 +338,7 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkTransitionExternalQueueTest, reporter, ctxInfo) return; } - GrBackendTexture backendTex = context->priv().createBackendTexture( + GrBackendTexture backendTex = context->createBackendTexture( 1, 1, kRGBA_8888_SkColorType, GrMipMapped::kNo, GrRenderable::kNo); sk_sp image; // Make a backend texture with an external queue family and general layout. @@ -377,7 +377,7 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkTransitionExternalQueueTest, reporter, ctxInfo) image.reset(); gpu->testingOnly_flushGpuAndSync(); - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); } #endif diff --git a/tests/VkWrapTests.cpp b/tests/VkWrapTests.cpp index ffecd02761..2dcf5de08e 100644 --- a/tests/VkWrapTests.cpp +++ b/tests/VkWrapTests.cpp @@ -36,10 +36,10 @@ void wrap_tex_test(skiatest::Reporter* reporter, GrContext* context) { GrGpu* gpu = context->priv().getGpu(); - GrBackendTexture origBackendTex = context->priv().createBackendTexture(kW, kH, - kColorType, - GrMipMapped::kNo, - GrRenderable::kNo); + GrBackendTexture origBackendTex = context->createBackendTexture(kW, kH, + kColorType, + GrMipMapped::kNo, + GrRenderable::kNo); GrVkImageInfo imageInfo; SkAssertResult(origBackendTex.getVkImageInfo(&imageInfo)); @@ -90,10 +90,10 @@ void wrap_tex_test(skiatest::Reporter* reporter, GrContext* context) { void wrap_rt_test(skiatest::Reporter* reporter, GrContext* context) { GrGpu* gpu = context->priv().getGpu(); - GrBackendTexture origBackendTex = context->priv().createBackendTexture(kW, kH, - kColorType, - GrMipMapped::kNo, - GrRenderable::kYes); + GrBackendTexture origBackendTex = context->createBackendTexture(kW, kH, + kColorType, + GrMipMapped::kNo, + GrRenderable::kYes); GrVkImageInfo imageInfo; SkAssertResult(origBackendTex.getVkImageInfo(&imageInfo)); @@ -127,16 +127,16 @@ void wrap_rt_test(skiatest::Reporter* reporter, GrContext* context) { // When we wrapBackendRenderTarget it is always borrowed, so we must make sure to free the // resource when we're done. - context->priv().deleteBackendTexture(origBackendTex); + context->deleteBackendTexture(origBackendTex); } void wrap_trt_test(skiatest::Reporter* reporter, GrContext* context) { GrGpu* gpu = context->priv().getGpu(); - GrBackendTexture origBackendTex = context->priv().createBackendTexture(kW, kH, - kColorType, - GrMipMapped::kNo, - GrRenderable::kYes); + GrBackendTexture origBackendTex = context->createBackendTexture(kW, kH, + kColorType, + GrMipMapped::kNo, + GrRenderable::kYes); GrVkImageInfo imageInfo; SkAssertResult(origBackendTex.getVkImageInfo(&imageInfo)); diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp index 305630ee9e..12d5f1bf36 100644 --- a/tests/WritePixelsTest.cpp +++ b/tests/WritePixelsTest.cpp @@ -455,7 +455,7 @@ static void test_write_pixels_non_texture(skiatest::Reporter* reporter, int sampleCnt) { for (auto& origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) { - GrBackendTexture backendTex = context->priv().createBackendTexture( + GrBackendTexture backendTex = context->createBackendTexture( DEV_W, DEV_H, kRGBA_8888_SkColorType, GrMipMapped::kNo, GrRenderable::kYes); if (!backendTex.isValid()) { continue; @@ -467,7 +467,7 @@ static void test_write_pixels_non_texture(skiatest::Reporter* reporter, auto ii = SkImageInfo::MakeN32Premul(DEV_W, DEV_H); test_write_pixels(reporter, surface.get(), ii); } - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); } } diff --git a/tools/DDLPromiseImageHelper.cpp b/tools/DDLPromiseImageHelper.cpp index 80cf64c38e..799efc0403 100644 --- a/tools/DDLPromiseImageHelper.cpp +++ b/tools/DDLPromiseImageHelper.cpp @@ -24,7 +24,7 @@ DDLPromiseImageHelper::PromiseImageCallbackContext::~PromiseImageCallbackContext SkASSERT(!fTotalFulfills || fDoneCnt); if (fPromiseImageTexture) { - fContext->priv().deleteBackendTexture(fPromiseImageTexture->backendTexture()); + fContext->deleteBackendTexture(fPromiseImageTexture->backendTexture()); } } diff --git a/tools/fm/fm.cpp b/tools/fm/fm.cpp index d5d15d1cc2..7f30a26d44 100644 --- a/tools/fm/fm.cpp +++ b/tools/fm/fm.cpp @@ -280,11 +280,11 @@ static sk_sp draw_with_gpu(std::function draw, break; case SurfaceType::kBackendTexture: - backendTexture = context->priv().createBackendTexture(info.width(), - info.height(), - info.colorType(), - GrMipMapped::kNo, - GrRenderable::kYes); + backendTexture = context->createBackendTexture(info.width(), + info.height(), + info.colorType(), + GrMipMapped::kNo, + GrRenderable::kYes); surface = SkSurface::MakeFromBackendTexture(context, backendTexture, kTopLeft_GrSurfaceOrigin, @@ -331,7 +331,7 @@ static sk_sp draw_with_gpu(std::function draw, if (!context->abandoned()) { surface.reset(); if (backendTexture.isValid()) { - context->priv().deleteBackendTexture(backendTexture); + context->deleteBackendTexture(backendTexture); } if (backendRT.isValid()) { context->priv().getGpu()->deleteTestingOnlyBackendRenderTarget(backendRT); diff --git a/tools/gpu/ProxyUtils.cpp b/tools/gpu/ProxyUtils.cpp index 9e01b1768c..d3cc1f1de4 100644 --- a/tools/gpu/ProxyUtils.cpp +++ b/tools/gpu/ProxyUtils.cpp @@ -34,7 +34,7 @@ sk_sp MakeTextureProxyFromData(GrContext* context, GrRenderable sk_sp proxy; if (kBottomLeft_GrSurfaceOrigin == origin) { // We (soon will) only support using kBottomLeft with wrapped textures. - auto backendTex = context->priv().createBackendTexture( + auto backendTex = context->createBackendTexture( width, height, format, GrMipMapped::kNo, renderable); if (!backendTex.isValid()) { return nullptr; @@ -51,7 +51,7 @@ sk_sp MakeTextureProxyFromData(GrContext* context, GrRenderable } if (!proxy) { - context->priv().deleteBackendTexture(backendTex); + context->deleteBackendTexture(backendTex); return nullptr; }