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 <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2019-05-20 08:38:07 -04:00 committed by Skia Commit-Bot
parent 729a23f50f
commit 5c7a25bd2f
29 changed files with 221 additions and 227 deletions

View File

@ -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);

View File

@ -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();

View File

@ -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();
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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

View File

@ -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,

View File

@ -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<SkSurface> 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);

View File

@ -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");

View File

@ -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<GrTextureProxy> 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<SkImage> 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<GrTexture> 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<SkSurface> 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<SkImage> 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);
}
}
}

View File

@ -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);
}

View File

@ -52,7 +52,7 @@ DEF_GPUTEST_FOR_MOCK_CONTEXT(GrSurface, reporter, ctxInfo) {
REPORTER_ASSERT(reporter, tex1.get() == tex1->asTexture());
REPORTER_ASSERT(reporter, static_cast<GrSurface*>(tex1.get()) == tex1->asTexture());
GrBackendTexture backendTex = context->priv().createBackendTexture(
GrBackendTexture backendTex = context->createBackendTexture(
256, 256, kRGBA_8888_SkColorType, GrMipMapped::kNo, GrRenderable::kNo);
sk_sp<GrSurface> texRT2 = resourceProvider->wrapRenderableBackendTexture(
@ -67,7 +67,7 @@ DEF_GPUTEST_FOR_MOCK_CONTEXT(GrSurface, reporter, ctxInfo) {
REPORTER_ASSERT(reporter, static_cast<GrSurface*>(texRT2->asRenderTarget()) ==
static_cast<GrSurface*>(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<GrTexture> 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<GrTexture> texture;
if (GrRenderable::kYes == renderable) {
@ -362,7 +362,7 @@ static sk_sp<GrTexture> make_wrapped_texture(GrContext* context, GrRenderable re
auto release = [](void* rc) {
auto releaseContext = static_cast<ReleaseContext*>(rc);
auto context = releaseContext->fContext;
context->priv().deleteBackendTexture(releaseContext->fBackendTexture);
context->deleteBackendTexture(releaseContext->fBackendTexture);
delete releaseContext;
};
texture->setRelease(release, new ReleaseContext{context, backendTexture});

View File

@ -490,7 +490,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_colorTypeSupportedAsImage, reporter
SkColorType colorType = static_cast<SkColorType>(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);
}
}

View File

@ -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<GrTextureProxy> lazyProxy = proxyProvider->createLazyProxy(
@ -525,6 +525,6 @@ DEF_GPUTEST(LazyProxyDeinstantiateTest, reporter, /* options */) {
REPORTER_ASSERT(reporter, 1 == releaseTestValue);
}
ctx->priv().deleteBackendTexture(backendTex);
ctx->deleteBackendTexture(backendTex);
}
}

View File

@ -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,

View File

@ -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;

View File

@ -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<GrSurfaceProxy> 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<GrSurfaceProxy> 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<GrSurfaceProxy> 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);
}
}
}

View File

@ -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

View File

@ -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();

View File

@ -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);
}
}
}

View File

@ -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,

View File

@ -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();
}

View File

@ -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<SkImage> 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<SkImage> 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

View File

@ -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));

View File

@ -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);
}
}

View File

@ -24,7 +24,7 @@ DDLPromiseImageHelper::PromiseImageCallbackContext::~PromiseImageCallbackContext
SkASSERT(!fTotalFulfills || fDoneCnt);
if (fPromiseImageTexture) {
fContext->priv().deleteBackendTexture(fPromiseImageTexture->backendTexture());
fContext->deleteBackendTexture(fPromiseImageTexture->backendTexture());
}
}

View File

@ -280,11 +280,11 @@ static sk_sp<SkImage> draw_with_gpu(std::function<bool(SkCanvas*)> 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<SkImage> draw_with_gpu(std::function<bool(SkCanvas*)> draw,
if (!context->abandoned()) {
surface.reset();
if (backendTexture.isValid()) {
context->priv().deleteBackendTexture(backendTexture);
context->deleteBackendTexture(backendTexture);
}
if (backendRT.isValid()) {
context->priv().getGpu()->deleteTestingOnlyBackendRenderTarget(backendRT);

View File

@ -34,7 +34,7 @@ sk_sp<GrTextureProxy> MakeTextureProxyFromData(GrContext* context, GrRenderable
sk_sp<GrTextureProxy> 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<GrTextureProxy> MakeTextureProxyFromData(GrContext* context, GrRenderable
}
if (!proxy) {
context->priv().deleteBackendTexture(backendTex);
context->deleteBackendTexture(backendTex);
return nullptr;
}