diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index 248ab6d036..473be2b241 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(), SkColors::kTransparent, GrMipMapped::kNo, GrRenderable::kYes); surface = SkSurface::MakeFromBackendTexture(context, backendTexture, diff --git a/gm/imagefromyuvtextures.cpp b/gm/imagefromyuvtextures.cpp index 6667d2f7cb..9db63e4a04 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, SkColors::kTransparent, GrMipMapped::kNo, GrRenderable::kYes); diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index 850e157264..f5914d9214 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -346,8 +346,10 @@ public: * 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. + * The client is responsible for ensuring synchronization between different uses + * of the backend object (i.e., wrapping it in a surface, rendering to it, deleting the + * surface, rewrapping it in a image and drawing the image will require explicit + * sychronization on the client's part). */ // If possible, create an uninitialized backend texture. The client should ensure that the @@ -366,6 +368,20 @@ public: GrMipMapped, GrRenderable); + // If possible, create a backend texture initialized to a particular color. The client should + // ensure that the returned backend texture is valid. + GrBackendTexture createBackendTexture(int width, int height, + GrBackendFormat, const SkColor4f& color, + GrMipMapped, GrRenderable); + + // If possible, create a backend texture initialized to a particular color. 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, const SkColor4f& color, + GrMipMapped, GrRenderable); + void deleteBackendTexture(GrBackendTexture); protected: diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index d6bc93c2c8..054456fb7b 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -392,6 +392,49 @@ GrBackendTexture GrContext::createBackendTexture(int width, int height, return this->createBackendTexture(width, height, format, mipMapped, renderable); } +GrBackendTexture GrContext::createBackendTexture(int width, int height, + GrBackendFormat backendFormat, + const SkColor4f& color, + GrMipMapped mipMapped, + GrRenderable renderable) { + if (!this->asDirectContext()) { + return GrBackendTexture(); + } + + if (this->abandoned()) { + return GrBackendTexture(); + } + + if (!backendFormat.isValid()) { + return GrBackendTexture(); + } + + return fGpu->createBackendTexture(width, height, backendFormat, + mipMapped, renderable, + nullptr, 0, color); +} + +GrBackendTexture GrContext::createBackendTexture(int width, int height, + SkColorType colorType, + const SkColor4f& color, + 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, color, mipMapped, renderable); +} + void GrContext::deleteBackendTexture(GrBackendTexture backendTex) { if (this->abandoned() || !backendTex.isValid()) { return; diff --git a/src/gpu/GrContextPriv.cpp b/src/gpu/GrContextPriv.cpp index 2ab6822151..6a482d18b5 100644 --- a/src/gpu/GrContextPriv.cpp +++ b/src/gpu/GrContextPriv.cpp @@ -760,48 +760,3 @@ void GrContextPriv::testingOnly_flushAndRemoveOnFlushCallbackObject(GrOnFlushCal fContext->drawingManager()->testingOnly_removeOnFlushCallbackObject(cb); } #endif - -////////////////////////////////////////////////////////////////////////////// -GrBackendTexture GrContextPriv::createBackendTexture(int width, int height, - GrBackendFormat backendFormat, - const SkColor4f& color, - 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->createBackendTexture(width, height, backendFormat, - mipMapped, renderable, nullptr, 0, color); -} - -GrBackendTexture GrContextPriv::createBackendTexture(int width, int height, - SkColorType colorType, - const SkColor4f& color, - 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, color, mipMapped, renderable); -} diff --git a/src/gpu/GrContextPriv.h b/src/gpu/GrContextPriv.h index 5dbb038b27..86af1f363a 100644 --- a/src/gpu/GrContextPriv.h +++ b/src/gpu/GrContextPriv.h @@ -292,20 +292,6 @@ public: void testingOnly_flushAndRemoveOnFlushCallbackObject(GrOnFlushCallbackObject*); #endif - // If possible, create a backend texture initialized to a particular color. The client should - // ensure that the returned backend texture is valid. - GrBackendTexture createBackendTexture(int width, int height, - GrBackendFormat, const SkColor4f& color, - GrMipMapped, GrRenderable); - - // If possible, create a backend texture initialized to a particular color. 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, const SkColor4f& color, - GrMipMapped, GrRenderable); - private: explicit GrContextPriv(GrContext* context) : fContext(context) {} GrContextPriv(const GrContextPriv&); // unimpl diff --git a/tests/BackendAllocationTest.cpp b/tests/BackendAllocationTest.cpp index 701eae4931..e76d21083d 100644 --- a/tests/BackendAllocationTest.cpp +++ b/tests/BackendAllocationTest.cpp @@ -365,8 +365,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ColorTypeBackendAllocationTest, reporter, ctx const SkColor4f& color, GrMipMapped mipMapped, GrRenderable renderable) { - return context->priv().createBackendTexture(32, 32, colorType, color, - mipMapped, renderable); + return context->createBackendTexture(32, 32, colorType, color, + mipMapped, renderable); }; test_color_init(context, reporter, createWithColorMtd, @@ -527,8 +527,8 @@ DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(GLBackendAllocationTest, reporter, ctxInfo) { const SkColor4f& color, GrMipMapped mipMapped, GrRenderable renderable) { - return context->priv().createBackendTexture(32, 32, format, color, - mipMapped, renderable); + return context->createBackendTexture(32, 32, format, color, + mipMapped, renderable); }; test_color_init(context, reporter, createWithColorMtd, @@ -637,8 +637,8 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkBackendAllocationTest, reporter, ctxInfo) { const SkColor4f& color, GrMipMapped mipMapped, GrRenderable renderable) { - return context->priv().createBackendTexture(32, 32, format, color, - mipMapped, renderable); + return context->createBackendTexture(32, 32, format, color, + mipMapped, renderable); }; test_color_init(context, reporter, createWithColorMtd, diff --git a/tests/DeferredDisplayListTest.cpp b/tests/DeferredDisplayListTest.cpp index 5ab80bf52d..f128f6c6cf 100644 --- a/tests/DeferredDisplayListTest.cpp +++ b/tests/DeferredDisplayListTest.cpp @@ -185,9 +185,9 @@ public: fColorType, fColorSpace, &fSurfaceProps); } - *backend = context->priv().createBackendTexture(fWidth, fHeight, fColorType, - SkColors::kTransparent, - mipmapped, GrRenderable::kYes); + *backend = context->createBackendTexture(fWidth, fHeight, fColorType, + SkColors::kTransparent, + mipmapped, GrRenderable::kYes); if (!backend->isValid() || !gpu->isTestingOnlyBackendTexture(*backend)) { return nullptr; } @@ -578,7 +578,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, SkColors::kTransparent, GrMipMapped::kNo, GrRenderable::kNo); if (!backendTex.isValid()) { diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp index 7818edec2c..96483a5d72 100644 --- a/tests/EGLImageTest.cpp +++ b/tests/EGLImageTest.cpp @@ -87,9 +87,9 @@ 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, - SkColors::kTransparent, - GrMipMapped::kNo, GrRenderable::kNo); + context1->createBackendTexture(kSize, kSize, kRGBA_8888_SkColorType, + SkColors::kTransparent, + 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 d0a9903a80..ef0ef66db4 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, SkColors::kTransparent, mipMapped, renderable); @@ -106,7 +106,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, SkColors::kTransparent, mipMapped, GrRenderable::kNo); @@ -249,7 +249,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, SkColors::kTransparent, mipMapped, GrRenderable::kYes); if (isWrapped) { diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp index ae14978e12..79b36e626a 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, SkColors::kTransparent, - GrMipMapped::kNo, GrRenderable::kNo); + ctx->createBackendTexture(100, 100, kRGBA_8888_SkColorType, SkColors::kTransparent, + GrMipMapped::kNo, GrRenderable::kNo); GrXferProcessor::DstProxy fakeDstProxy; { diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp index 6d4e70e7f9..178d6d66e2 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, SkColors::kTransparent, GrMipMapped::kNo, GrRenderable::kNo); @@ -331,7 +331,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()) { delete_backend_texture(context, backendTex); - backendTex = context->priv().createBackendTexture( + backendTex = context->createBackendTexture( kSize, kSize, kRGBA_8888_SkColorType, SkColors::kTransparent, GrMipMapped::kYes, GrRenderable::kYes); proxy = proxyProvider->wrapBackendTexture(backendTex, kTopLeft_GrSurfaceOrigin, @@ -348,7 +348,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, SkColors::kTransparent, GrMipMapped::kNo, renderable); sk_sp texture; if (GrRenderable::kYes == renderable) { diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp index 8e443dbc6e..c8fbacfbd8 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, SkColors::kTransparent, GrMipMapped::kNo, GrRenderable::kNo); diff --git a/tests/LazyProxyTest.cpp b/tests/LazyProxyTest.cpp index ed91e08d55..da92b6ba0a 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, SkColors::kTransparent, GrMipMapped::kNo, GrRenderable::kNo); diff --git a/tests/PromiseImageTest.cpp b/tests/PromiseImageTest.cpp index 30ced463d4..38c513e099 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, SkColors::kTransparent, GrMipMapped::kNo, GrRenderable::kYes); REPORTER_ASSERT(reporter, backendTex.isValid()); @@ -243,12 +243,12 @@ 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, SkColors::kTransparent, GrMipMapped::kNo, GrRenderable::kNo); REPORTER_ASSERT(reporter, backendTex1.isValid()); - GrBackendTexture backendTex2 = ctx->priv().createBackendTexture( + GrBackendTexture backendTex2 = ctx->createBackendTexture( kWidth, kHeight, kAlpha_8_SkColorType, SkColors::kTransparent, GrMipMapped::kNo, GrRenderable::kNo); REPORTER_ASSERT(reporter, backendTex2.isValid()); @@ -355,7 +355,7 @@ DEF_GPUTEST(PromiseImageTextureShutdown, reporter, ctxInfo) { continue; } - GrBackendTexture backendTex = ctx->priv().createBackendTexture( + GrBackendTexture backendTex = ctx->createBackendTexture( kWidth, kHeight, kAlpha_8_SkColorType, SkColors::kTransparent, GrMipMapped::kNo, GrRenderable::kNo); REPORTER_ASSERT(reporter, backendTex.isValid()); @@ -394,7 +394,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, SkColors::kTransparent, GrMipMapped::kNo, GrRenderable::kNo); REPORTER_ASSERT(reporter, backendTex.isValid()); @@ -458,7 +458,7 @@ 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, SkColors::kTransparent, GrMipMapped::kNo, GrRenderable::kYes); REPORTER_ASSERT(reporter, backendTex.isValid()); diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp index 43bad46dd6..8b5e1309b1 100644 --- a/tests/ProxyTest.cpp +++ b/tests/ProxyTest.cpp @@ -275,11 +275,11 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { // Tests wrapBackendRenderTarget with a GrBackendTexture { GrBackendTexture backendTex = - context->priv().createBackendTexture(kWidthHeight, kWidthHeight, - colorType, - SkColors::kTransparent, - GrMipMapped::kNo, - GrRenderable::kYes); + context->createBackendTexture(kWidthHeight, kWidthHeight, + colorType, + SkColors::kTransparent, + GrMipMapped::kNo, + GrRenderable::kYes); sk_sp sProxy = proxyProvider->wrapBackendTextureAsRenderTarget( backendTex, origin, supportedNumSamples); if (!sProxy) { @@ -301,11 +301,11 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { // Tests wrapBackendTexture that is only renderable { GrBackendTexture backendTex = - context->priv().createBackendTexture(kWidthHeight, kWidthHeight, - colorType, - SkColors::kTransparent, - GrMipMapped::kNo, - GrRenderable::kYes); + context->createBackendTexture(kWidthHeight, kWidthHeight, + colorType, + SkColors::kTransparent, + GrMipMapped::kNo, + GrRenderable::kYes); sk_sp sProxy = proxyProvider->wrapRenderableBackendTexture( backendTex, origin, supportedNumSamples, kBorrow_GrWrapOwnership, @@ -330,11 +330,11 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { { // Internal offscreen texture GrBackendTexture backendTex = - context->priv().createBackendTexture(kWidthHeight, kWidthHeight, - colorType, - SkColors::kTransparent, - GrMipMapped::kNo, - GrRenderable::kNo); + context->createBackendTexture(kWidthHeight, kWidthHeight, + colorType, + SkColors::kTransparent, + GrMipMapped::kNo, + GrRenderable::kNo); sk_sp sProxy = proxyProvider->wrapBackendTexture( backendTex, origin, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo, diff --git a/tests/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp index 3433329de9..c23c85e588 100644 --- a/tests/ResourceAllocatorTest.cpp +++ b/tests/ResourceAllocatorTest.cpp @@ -62,9 +62,9 @@ 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, - SkColors::kTransparent, - GrMipMapped::kNo, GrRenderable::kNo); + *backendTex = context->createBackendTexture(p.fSize, p.fSize, p.fColorType, + SkColors::kTransparent, + GrMipMapped::kNo, GrRenderable::kNo); if (!backendTex->isValid()) { return nullptr; } diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp index c6611ddee4..caed56ba5d 100644 --- a/tests/ResourceCacheTest.cpp +++ b/tests/ResourceCacheTest.cpp @@ -209,12 +209,12 @@ 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, - SkColors::kTransparent, - GrMipMapped::kNo, GrRenderable::kNo); - backendTextures[1] = context->priv().createBackendTexture(kW, kH, kRGBA_8888_SkColorType, - SkColors::kTransparent, - GrMipMapped::kNo, GrRenderable::kNo); + backendTextures[0] = context->createBackendTexture(kW, kH, kRGBA_8888_SkColorType, + SkColors::kTransparent, + GrMipMapped::kNo, GrRenderable::kNo); + backendTextures[1] = context->createBackendTexture(kW, kH, kRGBA_8888_SkColorType, + SkColors::kTransparent, + GrMipMapped::kNo, GrRenderable::kNo); REPORTER_ASSERT(reporter, backendTextures[0].isValid()); REPORTER_ASSERT(reporter, backendTextures[1].isValid()); if (!backendTextures[0].isValid() || !backendTextures[1].isValid()) { diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp index 76ea9579e4..fa9fe79d40 100644 --- a/tests/SurfaceTest.cpp +++ b/tests/SurfaceTest.cpp @@ -102,7 +102,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, SkColors::kTransparent, GrMipMapped::kNo, GrRenderable::kYes); surf = SkSurface::MakeFromBackendTexture(context, backendTex, @@ -128,9 +128,9 @@ 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, - SkColors::kTransparent, - GrMipMapped::kNo, GrRenderable::kYes); + backendTex = context->createBackendTexture(kSize, kSize, colorType, + SkColors::kTransparent, + GrMipMapped::kNo, GrRenderable::kYes); surf = SkSurface::MakeFromBackendTexture(context, backendTex, kTopLeft_GrSurfaceOrigin, kSampleCnt, colorType, nullptr, nullptr); @@ -198,7 +198,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_maxSurfaceSamplesForColorType, repo if (!max) { continue; } - GrBackendTexture backendTex = context->priv().createBackendTexture( + GrBackendTexture backendTex = context->createBackendTexture( kSize, kSize, colorType, SkColors::kTransparent, GrMipMapped::kNo, GrRenderable::kYes); if (!backendTex.isValid()) { diff --git a/tests/TextureBindingsResetTest.cpp b/tests/TextureBindingsResetTest.cpp index 9cdecd75ac..67c0994033 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, SkColors::kTransparent, GrMipMapped::kNo, GrRenderable::kNo); GrGLTextureInfo info2D; diff --git a/tests/VkBackendSurfaceTest.cpp b/tests/VkBackendSurfaceTest.cpp index 65a4f3d652..ced9f8834e 100644 --- a/tests/VkBackendSurfaceTest.cpp +++ b/tests/VkBackendSurfaceTest.cpp @@ -32,11 +32,11 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkImageLayoutTest, reporter, ctxInfo) { GrContext* context = ctxInfo.grContext(); - GrBackendTexture backendTex = context->priv().createBackendTexture(1, 1, - kRGBA_8888_SkColorType, - SkColors::kTransparent, - GrMipMapped::kNo, - GrRenderable::kNo); + GrBackendTexture backendTex = context->createBackendTexture(1, 1, + kRGBA_8888_SkColorType, + SkColors::kTransparent, + GrMipMapped::kNo, + GrRenderable::kNo); REPORTER_ASSERT(reporter, backendTex.isValid()); GrVkImageInfo info; @@ -139,11 +139,11 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkReleaseExternalQueueTest, reporter, ctxInfo) { } for (bool useExternal : {false, true}) { - GrBackendTexture backendTex = context->priv().createBackendTexture(1, 1, - kRGBA_8888_SkColorType, - SkColors::kTransparent, - GrMipMapped::kNo, - GrRenderable::kNo); + GrBackendTexture backendTex = context->createBackendTexture(1, 1, + kRGBA_8888_SkColorType, + SkColors::kTransparent, + GrMipMapped::kNo, + GrRenderable::kNo); sk_sp image; int count = 0; if (useExternal) { @@ -224,7 +224,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, SkColors::kTransparent, GrMipMapped::kNo, useSurface ? GrRenderable::kYes : GrRenderable::kNo); @@ -341,7 +341,7 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkTransitionExternalQueueTest, reporter, ctxInfo) return; } - GrBackendTexture backendTex = context->priv().createBackendTexture( + GrBackendTexture backendTex = context->createBackendTexture( 1, 1, kRGBA_8888_SkColorType, SkColors::kTransparent, GrMipMapped::kNo, GrRenderable::kNo); sk_sp image; diff --git a/tests/VkWrapTests.cpp b/tests/VkWrapTests.cpp index 6aefedb788..081cfe4549 100644 --- a/tests/VkWrapTests.cpp +++ b/tests/VkWrapTests.cpp @@ -36,11 +36,11 @@ void wrap_tex_test(skiatest::Reporter* reporter, GrContext* context) { GrGpu* gpu = context->priv().getGpu(); - GrBackendTexture origBackendTex = context->priv().createBackendTexture(kW, kH, - kColorType, - SkColors::kTransparent, - GrMipMapped::kNo, - GrRenderable::kNo); + GrBackendTexture origBackendTex = context->createBackendTexture(kW, kH, + kColorType, + SkColors::kTransparent, + GrMipMapped::kNo, + GrRenderable::kNo); GrVkImageInfo imageInfo; SkAssertResult(origBackendTex.getVkImageInfo(&imageInfo)); @@ -91,11 +91,11 @@ 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, - SkColors::kTransparent, - GrMipMapped::kNo, - GrRenderable::kYes); + GrBackendTexture origBackendTex = context->createBackendTexture(kW, kH, + kColorType, + SkColors::kTransparent, + GrMipMapped::kNo, + GrRenderable::kYes); GrVkImageInfo imageInfo; SkAssertResult(origBackendTex.getVkImageInfo(&imageInfo)); @@ -135,11 +135,11 @@ void wrap_rt_test(skiatest::Reporter* reporter, GrContext* context) { void wrap_trt_test(skiatest::Reporter* reporter, GrContext* context) { GrGpu* gpu = context->priv().getGpu(); - GrBackendTexture origBackendTex = context->priv().createBackendTexture(kW, kH, - kColorType, - SkColors::kTransparent, - GrMipMapped::kNo, - GrRenderable::kYes); + GrBackendTexture origBackendTex = context->createBackendTexture(kW, kH, + kColorType, + SkColors::kTransparent, + GrMipMapped::kNo, + GrRenderable::kYes); GrVkImageInfo imageInfo; SkAssertResult(origBackendTex.getVkImageInfo(&imageInfo)); diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp index 3e303d288e..0badd6b8fa 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, SkColors::kTransparent, GrMipMapped::kNo, GrRenderable::kYes); if (!backendTex.isValid()) { diff --git a/tools/gpu/ProxyUtils.cpp b/tools/gpu/ProxyUtils.cpp index d89bba2616..948308823d 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, SkColors::kTransparent, GrMipMapped::kNo, renderable); if (!backendTex.isValid()) { return nullptr;