Switch over to using new direct allocation API in our tests (as much as possible at least)
To fully switch over we need the entry point that uploads data but most of the old call sites can be switched over now. Change-Id: I362b1dfde7d88bf8d3f8f90155f53d9ac442a329 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/214300 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
4f71cccb9d
commit
9b16f81858
@ -1388,7 +1388,7 @@ Error GPUSink::onDraw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log,
|
||||
&props);
|
||||
break;
|
||||
case SkCommandLineConfigGpu::SurfType::kBackendTexture:
|
||||
backendTexture = context->priv().getGpu()->createTestingOnlyBackendTexture(
|
||||
backendTexture = context->priv().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().getGpu()->deleteTestingOnlyBackendTexture(backendTexture);
|
||||
context->priv().deleteBackendTexture(backendTexture);
|
||||
}
|
||||
if (backendRT.isValid()) {
|
||||
context->priv().getGpu()->deleteTestingOnlyBackendRenderTarget(backendRT);
|
||||
|
@ -142,12 +142,7 @@ protected:
|
||||
|
||||
void createResultTexture(GrContext* context, int width, int height,
|
||||
GrBackendTexture* resultTexture) {
|
||||
GrGpu* gpu = context->priv().getGpu();
|
||||
if (!gpu) {
|
||||
return;
|
||||
}
|
||||
|
||||
*resultTexture = gpu->createTestingOnlyBackendTexture(
|
||||
*resultTexture = context->priv().createBackendTexture(
|
||||
width, height, kRGBA_8888_SkColorType, GrMipMapped::kNo, GrRenderable::kYes);
|
||||
|
||||
context->resetContext();
|
||||
@ -166,9 +161,7 @@ protected:
|
||||
context->flush();
|
||||
gpu->testingOnly_flushGpuAndSync();
|
||||
for (int i = 0; i < n; ++i) {
|
||||
if (textures[i].isValid()) {
|
||||
gpu->deleteTestingOnlyBackendTexture(textures[i]);
|
||||
}
|
||||
context->priv().deleteBackendTexture(textures[i]);
|
||||
}
|
||||
|
||||
context->resetContext();
|
||||
|
@ -1089,7 +1089,7 @@ protected:
|
||||
SkASSERT(gpu);
|
||||
gpu->testingOnly_flushGpuAndSync();
|
||||
for (const auto& tex : fBackendTextures) {
|
||||
gpu->deleteTestingOnlyBackendTexture(tex);
|
||||
context->priv().deleteBackendTexture(tex);
|
||||
}
|
||||
fBackendTextures.reset();
|
||||
}
|
||||
@ -1241,7 +1241,7 @@ protected:
|
||||
SkASSERT(gpu);
|
||||
gpu->testingOnly_flushGpuAndSync();
|
||||
for (const auto& tex : fBackendTextures) {
|
||||
gpu->deleteTestingOnlyBackendTexture(tex);
|
||||
context->priv().deleteBackendTexture(tex);
|
||||
}
|
||||
fBackendTextures.reset();
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ public:
|
||||
fColorType, fColorSpace, &fSurfaceProps);
|
||||
}
|
||||
|
||||
*backend = gpu->createTestingOnlyBackendTexture(fWidth, fHeight, fColorType,
|
||||
*backend = context->priv().createBackendTexture(fWidth, fHeight, fColorType,
|
||||
mipmapped, GrRenderable::kYes);
|
||||
if (!backend->isValid() || !gpu->isTestingOnlyBackendTexture(*backend)) {
|
||||
return nullptr;
|
||||
@ -204,7 +204,7 @@ public:
|
||||
}
|
||||
|
||||
if (!surface) {
|
||||
gpu->deleteTestingOnlyBackendTexture(*backend);
|
||||
this->cleanUpBackEnd(context, *backend);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -212,13 +212,7 @@ public:
|
||||
}
|
||||
|
||||
void cleanUpBackEnd(GrContext* context, const GrBackendTexture& backend) const {
|
||||
if (!backend.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
GrGpu* gpu = context->priv().getGpu();
|
||||
|
||||
gpu->deleteTestingOnlyBackendTexture(backend);
|
||||
context->priv().deleteBackendTexture(backend);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -582,8 +576,8 @@ enum class DDLStage { kMakeImage, kDrawImage, kDetach, kDrawDDL };
|
||||
// This tests the ability to create and use wrapped textures in a DDL world
|
||||
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLWrapBackendTest, reporter, ctxInfo) {
|
||||
GrContext* context = ctxInfo.grContext();
|
||||
GrGpu* gpu = context->priv().getGpu();
|
||||
GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
|
||||
|
||||
GrBackendTexture backendTex = context->priv().createBackendTexture(
|
||||
kSize, kSize, kRGBA_8888_SkColorType, GrMipMapped::kNo, GrRenderable::kNo);
|
||||
if (!backendTex.isValid()) {
|
||||
return;
|
||||
@ -594,7 +588,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLWrapBackendTest, reporter, ctxInfo) {
|
||||
|
||||
sk_sp<SkSurface> s = params.make(context, &backend);
|
||||
if (!s) {
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -607,7 +601,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLWrapBackendTest, reporter, ctxInfo) {
|
||||
if (!canvas) {
|
||||
s = nullptr;
|
||||
params.cleanUpBackEnd(context, backend);
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -615,7 +609,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLWrapBackendTest, reporter, ctxInfo) {
|
||||
if (!deferredContext) {
|
||||
s = nullptr;
|
||||
params.cleanUpBackEnd(context, backend);
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -631,7 +625,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLWrapBackendTest, reporter, ctxInfo) {
|
||||
TextureReleaseChecker::Release, &releaseChecker);
|
||||
REPORTER_ASSERT(reporter, !image);
|
||||
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
|
||||
s = nullptr;
|
||||
params.cleanUpBackEnd(context, backend);
|
||||
|
@ -30,8 +30,7 @@ static void cleanup(GLTestContext* glctx0, GrGLuint texID0, GLTestContext* glctx
|
||||
glctx1->makeCurrent();
|
||||
if (grctx1) {
|
||||
if (backendTex1 && backendTex1->isValid()) {
|
||||
GrGLGpu* gpu1 = static_cast<GrGLGpu*>(grctx1->priv().getGpu());
|
||||
gpu1->deleteTestingOnlyBackendTexture(*backendTex1);
|
||||
grctx1->priv().deleteBackendTexture(*backendTex1);
|
||||
}
|
||||
}
|
||||
if (GR_EGL_NO_IMAGE != image1) {
|
||||
@ -88,7 +87,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(EGLImageTest, reporter, ctxInfo) {
|
||||
GrGpu* gpu1 = context1->priv().getGpu();
|
||||
static const int kSize = 100;
|
||||
backendTexture1 =
|
||||
gpu1->createTestingOnlyBackendTexture(kSize, kSize, kRGBA_8888_SkColorType,
|
||||
context1->priv().createBackendTexture(kSize, kSize, kRGBA_8888_SkColorType,
|
||||
GrMipMapped::kNo, GrRenderable::kNo);
|
||||
|
||||
if (!backendTexture1.isValid() || !gpu1->isTestingOnlyBackendTexture(backendTexture1)) {
|
||||
|
@ -34,14 +34,13 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrWrappedMipMappedTest, reporter, ctxInfo) {
|
||||
if (!context->priv().caps()->mipMapSupport()) {
|
||||
return;
|
||||
}
|
||||
GrGpu* gpu = context->priv().getGpu();
|
||||
|
||||
for (auto mipMapped : {GrMipMapped::kNo, GrMipMapped::kYes}) {
|
||||
for (auto renderable : {GrRenderable::kNo, GrRenderable::kYes}) {
|
||||
// CreateTestingOnlyBackendTexture currently doesn't support uploading data to mip maps
|
||||
// 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 = gpu->createTestingOnlyBackendTexture(
|
||||
GrBackendTexture backendTex = context->priv().createBackendTexture(
|
||||
kSize, kSize, kRGBA_8888_SkColorType, mipMapped, renderable);
|
||||
|
||||
sk_sp<GrTextureProxy> proxy;
|
||||
@ -68,7 +67,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrWrappedMipMappedTest, reporter, ctxInfo) {
|
||||
}
|
||||
REPORTER_ASSERT(reporter, proxy);
|
||||
if (!proxy) {
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -77,7 +76,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrWrappedMipMappedTest, reporter, ctxInfo) {
|
||||
GrTexture* texture = proxy->peekTexture();
|
||||
REPORTER_ASSERT(reporter, texture);
|
||||
if (!texture) {
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -91,7 +90,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrWrappedMipMappedTest, reporter, ctxInfo) {
|
||||
} else {
|
||||
REPORTER_ASSERT(reporter, GrMipMapped::kNo == texture->texturePriv().mipMapped());
|
||||
}
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -103,11 +102,10 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter,
|
||||
if (!context->priv().caps()->mipMapSupport()) {
|
||||
return;
|
||||
}
|
||||
GrGpu* gpu = context->priv().getGpu();
|
||||
|
||||
for (auto mipMapped : {GrMipMapped::kNo, GrMipMapped::kYes}) {
|
||||
for (auto willUseMips : {false, true}) {
|
||||
GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
|
||||
GrBackendTexture backendTex = context->priv().createBackendTexture(
|
||||
kSize, kSize, kRGBA_8888_SkColorType, mipMapped, GrRenderable::kNo);
|
||||
|
||||
sk_sp<SkImage> image = SkImage::MakeFromTexture(context, backendTex,
|
||||
@ -119,7 +117,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter,
|
||||
GrTextureProxy* proxy = as_IB(image)->peekProxy();
|
||||
REPORTER_ASSERT(reporter, proxy);
|
||||
if (!proxy) {
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -128,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) {
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -137,7 +135,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter,
|
||||
kPremul_SkAlphaType, nullptr);
|
||||
REPORTER_ASSERT(reporter, imageGen);
|
||||
if (!imageGen) {
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -149,7 +147,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter,
|
||||
|
||||
REPORTER_ASSERT(reporter, genProxy);
|
||||
if (!genProxy) {
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -161,14 +159,14 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter,
|
||||
|
||||
REPORTER_ASSERT(reporter, genProxy->isInstantiated());
|
||||
if (!genProxy->isInstantiated()) {
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
return;
|
||||
}
|
||||
|
||||
GrTexture* genTexture = genProxy->peekTexture();
|
||||
REPORTER_ASSERT(reporter, genTexture);
|
||||
if (!genTexture) {
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -227,9 +225,10 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter,
|
||||
// Must make sure the uses of the backend texture have finished (we possibly have a
|
||||
// queued up copy) before we delete the backend texture.
|
||||
context->flush();
|
||||
gpu->testingOnly_flushGpuAndSync();
|
||||
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().getGpu()->testingOnly_flushGpuAndSync();
|
||||
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -243,13 +242,12 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrImageSnapshotMipMappedTest, reporter, ctxIn
|
||||
}
|
||||
|
||||
auto resourceProvider = context->priv().resourceProvider();
|
||||
GrGpu* gpu = context->priv().getGpu();
|
||||
|
||||
for (auto willUseMips : {false, true}) {
|
||||
for (auto isWrapped : {false, true}) {
|
||||
GrMipMapped mipMapped = willUseMips ? GrMipMapped::kYes : GrMipMapped::kNo;
|
||||
sk_sp<SkSurface> surface;
|
||||
GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
|
||||
GrBackendTexture backendTex = context->priv().createBackendTexture(
|
||||
kSize, kSize, kRGBA_8888_SkColorType, mipMapped, GrRenderable::kYes);
|
||||
if (isWrapped) {
|
||||
surface = SkSurface::MakeFromBackendTexture(context,
|
||||
@ -268,7 +266,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrImageSnapshotMipMappedTest, reporter, ctxIn
|
||||
}
|
||||
REPORTER_ASSERT(reporter, surface);
|
||||
if (!surface) {
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
}
|
||||
SkGpuDevice* device = ((SkSurface_Gpu*)surface.get())->getDevice();
|
||||
GrTextureProxy* texProxy = device->accessRenderTargetContext()->asTextureProxy();
|
||||
@ -281,7 +279,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrImageSnapshotMipMappedTest, reporter, ctxIn
|
||||
sk_sp<SkImage> image = surface->makeImageSnapshot();
|
||||
REPORTER_ASSERT(reporter, image);
|
||||
if (!image) {
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
}
|
||||
texProxy = as_IB(image)->peekProxy();
|
||||
REPORTER_ASSERT(reporter, mipMapped == texProxy->mipMapped());
|
||||
@ -293,8 +291,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrImageSnapshotMipMappedTest, reporter, ctxIn
|
||||
// Must flush the context to make sure all the cmds (copies, etc.) from above are sent
|
||||
// to the gpu before we delete the backendHandle.
|
||||
context->flush();
|
||||
gpu->testingOnly_flushGpuAndSync();
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().getGpu()->testingOnly_flushGpuAndSync();
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -989,7 +989,6 @@ DEF_GPUTEST(PorterDuffNoDualSourceBlending, reporter, options) {
|
||||
return;
|
||||
}
|
||||
|
||||
GrGpu* gpu = ctx->priv().getGpu();
|
||||
GrProxyProvider* proxyProvider = ctx->priv().proxyProvider();
|
||||
const GrCaps& caps = *ctx->priv().caps();
|
||||
if (caps.shaderCaps()->dualSourceBlendingSupport()) {
|
||||
@ -998,8 +997,8 @@ DEF_GPUTEST(PorterDuffNoDualSourceBlending, reporter, options) {
|
||||
}
|
||||
|
||||
GrBackendTexture backendTex =
|
||||
gpu->createTestingOnlyBackendTexture(100, 100, kRGBA_8888_SkColorType,
|
||||
GrMipMapped::kNo, GrRenderable::kNo);
|
||||
ctx->priv().createBackendTexture(100, 100, kRGBA_8888_SkColorType,
|
||||
GrMipMapped::kNo, GrRenderable::kNo);
|
||||
|
||||
GrXferProcessor::DstProxy fakeDstProxy;
|
||||
{
|
||||
@ -1031,5 +1030,5 @@ DEF_GPUTEST(PorterDuffNoDualSourceBlending, reporter, options) {
|
||||
}
|
||||
}
|
||||
}
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
ctx->priv().deleteBackendTexture(backendTex);
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
DEF_GPUTEST_FOR_MOCK_CONTEXT(GrSurface, reporter, ctxInfo) {
|
||||
GrContext* context = ctxInfo.grContext();
|
||||
auto resourceProvider = context->priv().resourceProvider();
|
||||
GrGpu* gpu = context->priv().getGpu();
|
||||
|
||||
GrSurfaceDesc desc;
|
||||
desc.fFlags = kRenderTarget_GrSurfaceFlag;
|
||||
@ -53,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 = gpu->createTestingOnlyBackendTexture(
|
||||
GrBackendTexture backendTex = context->priv().createBackendTexture(
|
||||
256, 256, kRGBA_8888_SkColorType, GrMipMapped::kNo, GrRenderable::kNo);
|
||||
|
||||
sk_sp<GrSurface> texRT2 = resourceProvider->wrapRenderableBackendTexture(
|
||||
@ -68,7 +67,7 @@ DEF_GPUTEST_FOR_MOCK_CONTEXT(GrSurface, reporter, ctxInfo) {
|
||||
REPORTER_ASSERT(reporter, static_cast<GrSurface*>(texRT2->asRenderTarget()) ==
|
||||
static_cast<GrSurface*>(texRT2->asTexture()));
|
||||
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
}
|
||||
|
||||
// This test checks that the isConfigTexturable and isConfigRenderable are
|
||||
@ -330,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().getGpu()->createTestingOnlyBackendTexture(
|
||||
backendTex = context->priv().createBackendTexture(
|
||||
kSize, kSize, kRGBA_8888_SkColorType, GrMipMapped::kYes, GrRenderable::kYes);
|
||||
proxy = proxyProvider->wrapBackendTexture(backendTex, kTopLeft_GrSurfaceOrigin,
|
||||
kBorrow_GrWrapOwnership, GrWrapCacheable::kNo,
|
||||
@ -345,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().getGpu()->createTestingOnlyBackendTexture(
|
||||
auto backendTexture = context->priv().createBackendTexture(
|
||||
10, 10, kRGBA_8888_SkColorType, GrMipMapped::kNo, renderable);
|
||||
sk_sp<GrTexture> texture;
|
||||
if (GrRenderable::kYes == renderable) {
|
||||
@ -362,11 +361,8 @@ static sk_sp<GrTexture> make_wrapped_texture(GrContext* context, GrRenderable re
|
||||
};
|
||||
auto release = [](void* rc) {
|
||||
auto releaseContext = static_cast<ReleaseContext*>(rc);
|
||||
if (!releaseContext->fContext->abandoned()) {
|
||||
if (auto gpu = releaseContext->fContext->priv().getGpu()) {
|
||||
gpu->deleteTestingOnlyBackendTexture(releaseContext->fBackendTexture);
|
||||
}
|
||||
}
|
||||
auto context = releaseContext->fContext;
|
||||
context->priv().deleteBackendTexture(releaseContext->fBackendTexture);
|
||||
delete releaseContext;
|
||||
};
|
||||
texture->setRelease(release, new ReleaseContext{context, backendTexture});
|
||||
|
@ -27,10 +27,11 @@ void testing_only_texture_test(skiatest::Reporter* reporter, GrContext* context,
|
||||
}
|
||||
SkAutoTMalloc<GrColor> dstBuffer(kWidth * kHeight);
|
||||
|
||||
const GrCaps* caps = context->priv().caps();
|
||||
GrGpu* gpu = context->priv().getGpu();
|
||||
|
||||
GrPixelConfig config = SkColorType2GrPixelConfig(ct);
|
||||
if (!gpu->caps()->isConfigTexturable(config)) {
|
||||
if (!caps->isConfigTexturable(config)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -39,7 +40,7 @@ void testing_only_texture_test(skiatest::Reporter* reporter, GrContext* context,
|
||||
return;
|
||||
}
|
||||
|
||||
if (gpu->caps()->supportedReadPixelsColorType(config, grCT) != grCT) {
|
||||
if (caps->supportedReadPixelsColorType(config, grCT) != grCT) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -482,25 +482,26 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkImage_makeNonTextureImage, reporter, contex
|
||||
}
|
||||
|
||||
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_colorTypeSupportedAsImage, reporter, ctxInfo) {
|
||||
GrContext* context = ctxInfo.grContext();
|
||||
|
||||
static constexpr int kSize = 10;
|
||||
|
||||
for (int ct = 0; ct < kLastEnum_SkColorType; ++ct) {
|
||||
static constexpr int kSize = 10;
|
||||
SkColorType colorType = static_cast<SkColorType>(ct);
|
||||
bool can = ctxInfo.grContext()->colorTypeSupportedAsImage(colorType);
|
||||
auto* gpu = ctxInfo.grContext()->priv().getGpu();
|
||||
GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
|
||||
bool can = context->colorTypeSupportedAsImage(colorType);
|
||||
|
||||
GrBackendTexture backendTex = context->priv().createBackendTexture(
|
||||
kSize, kSize, colorType, GrMipMapped::kNo, GrRenderable::kNo);
|
||||
auto img =
|
||||
SkImage::MakeFromTexture(ctxInfo.grContext(), backendTex, kTopLeft_GrSurfaceOrigin,
|
||||
colorType, kOpaque_SkAlphaType, nullptr);
|
||||
|
||||
auto img = SkImage::MakeFromTexture(context, backendTex, kTopLeft_GrSurfaceOrigin,
|
||||
colorType, kOpaque_SkAlphaType, nullptr);
|
||||
REPORTER_ASSERT(reporter, can == SkToBool(img),
|
||||
"colorTypeSupportedAsImage:%d, actual:%d, ct:%d", can, SkToBool(img),
|
||||
colorType);
|
||||
|
||||
img.reset();
|
||||
ctxInfo.grContext()->flush();
|
||||
if (backendTex.isValid()) {
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
}
|
||||
context->flush();
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -448,7 +448,6 @@ DEF_GPUTEST(LazyProxyDeinstantiateTest, reporter, /* options */) {
|
||||
GrMockOptions mockOptions;
|
||||
sk_sp<GrContext> ctx = GrContext::MakeMock(&mockOptions, GrContextOptions());
|
||||
GrProxyProvider* proxyProvider = ctx->priv().proxyProvider();
|
||||
GrGpu* gpu = ctx->priv().getGpu();
|
||||
|
||||
GrBackendFormat format =
|
||||
ctx->priv().caps()->getBackendFormatFromColorType(kRGBA_8888_SkColorType);
|
||||
@ -472,7 +471,7 @@ DEF_GPUTEST(LazyProxyDeinstantiateTest, reporter, /* options */) {
|
||||
desc.fHeight = kSize;
|
||||
desc.fConfig = kRGBA_8888_GrPixelConfig;
|
||||
|
||||
GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
|
||||
GrBackendTexture backendTex = ctx->priv().createBackendTexture(
|
||||
kSize, kSize, kRGBA_8888_SkColorType, GrMipMapped::kNo, GrRenderable::kNo);
|
||||
|
||||
sk_sp<GrTextureProxy> lazyProxy = proxyProvider->createLazyProxy(
|
||||
@ -526,6 +525,6 @@ DEF_GPUTEST(LazyProxyDeinstantiateTest, reporter, /* options */) {
|
||||
REPORTER_ASSERT(reporter, 1 == releaseTestValue);
|
||||
}
|
||||
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
ctx->priv().deleteBackendTexture(backendTex);
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PromiseImageTest, reporter, ctxInfo) {
|
||||
GrContext* ctx = ctxInfo.grContext();
|
||||
GrGpu* gpu = ctx->priv().getGpu();
|
||||
|
||||
GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
|
||||
GrBackendTexture backendTex = ctx->priv().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);
|
||||
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
ctx->priv().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 = gpu->createTestingOnlyBackendTexture(
|
||||
GrBackendTexture backendTex1 = ctx->priv().createBackendTexture(
|
||||
kWidth, kHeight, kGray_8_SkColorType, GrMipMapped::kNo, GrRenderable::kNo);
|
||||
REPORTER_ASSERT(reporter, backendTex1.isValid());
|
||||
|
||||
GrBackendTexture backendTex2 = gpu->createTestingOnlyBackendTexture(
|
||||
GrBackendTexture backendTex2 = ctx->priv().createBackendTexture(
|
||||
kWidth, kHeight, kAlpha_8_SkColorType, GrMipMapped::kNo, GrRenderable::kNo);
|
||||
REPORTER_ASSERT(reporter, backendTex2.isValid());
|
||||
if (backendTex1.getBackendFormat() != backendTex2.getBackendFormat()) {
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex1);
|
||||
ctx->priv().deleteBackendTexture(backendTex1);
|
||||
return;
|
||||
}
|
||||
// We only needed this texture to check that alpha and gray color types use the same format.
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex2);
|
||||
ctx->priv().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);
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex1);
|
||||
ctx->priv().deleteBackendTexture(backendTex1);
|
||||
}
|
||||
|
||||
DEF_GPUTEST(PromiseImageTextureShutdown, reporter, ctxInfo) {
|
||||
@ -351,9 +351,8 @@ DEF_GPUTEST(PromiseImageTextureShutdown, reporter, ctxInfo) {
|
||||
if (!ctx) {
|
||||
continue;
|
||||
}
|
||||
GrGpu* gpu = ctx->priv().getGpu();
|
||||
|
||||
GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
|
||||
GrBackendTexture backendTex = ctx->priv().createBackendTexture(
|
||||
kWidth, kHeight, kAlpha_8_SkColorType, GrMipMapped::kNo, GrRenderable::kNo);
|
||||
REPORTER_ASSERT(reporter, backendTex.isValid());
|
||||
|
||||
@ -390,9 +389,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PromiseImageTextureFullCache, reporter, ctxIn
|
||||
const int kHeight = 10;
|
||||
|
||||
GrContext* ctx = ctxInfo.grContext();
|
||||
GrGpu* gpu = ctx->priv().getGpu();
|
||||
|
||||
GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
|
||||
GrBackendTexture backendTex = ctx->priv().createBackendTexture(
|
||||
kWidth, kHeight, kAlpha_8_SkColorType, GrMipMapped::kNo, GrRenderable::kNo);
|
||||
REPORTER_ASSERT(reporter, backendTex.isValid());
|
||||
|
||||
@ -442,9 +440,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PromiseImageTextureFullCache, reporter, ctxIn
|
||||
// Must call these to ensure that all callbacks are performed before the checker is destroyed.
|
||||
image.reset();
|
||||
ctx->flush();
|
||||
gpu->testingOnly_flushGpuAndSync();
|
||||
ctx->priv().getGpu()->testingOnly_flushGpuAndSync();
|
||||
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
ctx->priv().deleteBackendTexture(backendTex);
|
||||
}
|
||||
|
||||
// Test case where promise image fulfill returns nullptr.
|
||||
@ -453,15 +451,14 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PromiseImageNullFulfill, reporter, ctxInfo) {
|
||||
const int kHeight = 10;
|
||||
|
||||
GrContext* ctx = ctxInfo.grContext();
|
||||
GrGpu* gpu = ctx->priv().getGpu();
|
||||
|
||||
// Do all this just to get a valid backend format for the image.
|
||||
GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
|
||||
GrBackendTexture backendTex = ctx->priv().createBackendTexture(
|
||||
kWidth, kHeight, kRGBA_8888_SkColorType, GrMipMapped::kNo, GrRenderable::kYes);
|
||||
REPORTER_ASSERT(reporter, backendTex.isValid());
|
||||
GrBackendFormat backendFormat = backendTex.getBackendFormat();
|
||||
REPORTER_ASSERT(reporter, backendFormat.isValid());
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
ctx->priv().deleteBackendTexture(backendTex);
|
||||
|
||||
struct Counts {
|
||||
int fFulfillCount = 0;
|
||||
|
@ -213,9 +213,10 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) {
|
||||
|
||||
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
|
||||
GrProxyProvider* proxyProvider = ctxInfo.grContext()->priv().proxyProvider();
|
||||
GrResourceProvider* resourceProvider = ctxInfo.grContext()->priv().resourceProvider();
|
||||
GrGpu* gpu = ctxInfo.grContext()->priv().getGpu();
|
||||
const GrCaps& caps = *ctxInfo.grContext()->priv().caps();
|
||||
GrContext* context = ctxInfo.grContext();
|
||||
GrResourceProvider* resourceProvider = context->priv().resourceProvider();
|
||||
GrGpu* gpu = context->priv().getGpu();
|
||||
const GrCaps& caps = *context->priv().caps();
|
||||
|
||||
static const int kWidthHeight = 100;
|
||||
|
||||
@ -274,14 +275,14 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
|
||||
// Tests wrapBackendRenderTarget with a GrBackendTexture
|
||||
{
|
||||
GrBackendTexture backendTex =
|
||||
gpu->createTestingOnlyBackendTexture(kWidthHeight, kWidthHeight,
|
||||
context->priv().createBackendTexture(kWidthHeight, kWidthHeight,
|
||||
colorType,
|
||||
GrMipMapped::kNo,
|
||||
GrRenderable::kYes);
|
||||
sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapBackendTextureAsRenderTarget(
|
||||
backendTex, origin, supportedNumSamples);
|
||||
if (!sProxy) {
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
continue; // This can fail on Mesa
|
||||
}
|
||||
|
||||
@ -293,13 +294,13 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
|
||||
supportedNumSamples, SkBackingFit::kExact,
|
||||
caps.maxWindowRectangles());
|
||||
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
}
|
||||
|
||||
// Tests wrapBackendTexture that is only renderable
|
||||
{
|
||||
GrBackendTexture backendTex =
|
||||
gpu->createTestingOnlyBackendTexture(kWidthHeight, kWidthHeight,
|
||||
context->priv().createBackendTexture(kWidthHeight, kWidthHeight,
|
||||
colorType,
|
||||
GrMipMapped::kNo,
|
||||
GrRenderable::kYes);
|
||||
@ -308,7 +309,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
|
||||
backendTex, origin, supportedNumSamples, kBorrow_GrWrapOwnership,
|
||||
GrWrapCacheable::kNo, nullptr, nullptr);
|
||||
if (!sProxy) {
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
continue; // This can fail on Mesa
|
||||
}
|
||||
|
||||
@ -320,14 +321,14 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
|
||||
supportedNumSamples, SkBackingFit::kExact,
|
||||
caps.maxWindowRectangles());
|
||||
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
}
|
||||
|
||||
// Tests wrapBackendTexture that is only textureable
|
||||
{
|
||||
// Internal offscreen texture
|
||||
GrBackendTexture backendTex =
|
||||
gpu->createTestingOnlyBackendTexture(kWidthHeight, kWidthHeight,
|
||||
context->priv().createBackendTexture(kWidthHeight, kWidthHeight,
|
||||
colorType,
|
||||
GrMipMapped::kNo,
|
||||
GrRenderable::kNo);
|
||||
@ -336,7 +337,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
|
||||
backendTex, origin, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo,
|
||||
kRead_GrIOType);
|
||||
if (!sProxy) {
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -346,7 +347,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
|
||||
check_texture(reporter, resourceProvider, sProxy->asTextureProxy(),
|
||||
SkBackingFit::kExact);
|
||||
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,9 +61,8 @@ static GrSurfaceProxy* make_deferred(GrProxyProvider* proxyProvider, const GrCap
|
||||
static GrSurfaceProxy* make_backend(GrContext* context, const ProxyParams& p,
|
||||
GrBackendTexture* backendTex) {
|
||||
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
|
||||
GrGpu* gpu = context->priv().getGpu();
|
||||
|
||||
*backendTex = gpu->createTestingOnlyBackendTexture(p.fSize, p.fSize, p.fColorType,
|
||||
*backendTex = context->priv().createBackendTexture(p.fSize, p.fSize, p.fColorType,
|
||||
GrMipMapped::kNo, GrRenderable::kNo);
|
||||
if (!backendTex->isValid()) {
|
||||
return nullptr;
|
||||
@ -83,7 +82,7 @@ static GrSurfaceProxy* make_backend(GrContext* context, const ProxyParams& p,
|
||||
}
|
||||
|
||||
static void cleanup_backend(GrContext* context, const GrBackendTexture& backendTex) {
|
||||
context->priv().getGpu()->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
}
|
||||
|
||||
// Basic test that two proxies with overlapping intervals and compatible descriptors are
|
||||
|
@ -209,9 +209,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxI
|
||||
static const int kW = 100;
|
||||
static const int kH = 100;
|
||||
|
||||
backendTextures[0] = gpu->createTestingOnlyBackendTexture(kW, kH, kRGBA_8888_SkColorType,
|
||||
backendTextures[0] = context->priv().createBackendTexture(kW, kH, kRGBA_8888_SkColorType,
|
||||
GrMipMapped::kNo, GrRenderable::kNo);
|
||||
backendTextures[1] = gpu->createTestingOnlyBackendTexture(kW, kH, kRGBA_8888_SkColorType,
|
||||
backendTextures[1] = context->priv().createBackendTexture(kW, kH, kRGBA_8888_SkColorType,
|
||||
GrMipMapped::kNo, GrRenderable::kNo);
|
||||
REPORTER_ASSERT(reporter, backendTextures[0].isValid());
|
||||
REPORTER_ASSERT(reporter, backendTextures[1].isValid());
|
||||
@ -244,10 +244,10 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxI
|
||||
REPORTER_ASSERT(reporter, !adoptedIsAlive);
|
||||
|
||||
if (borrowedIsAlive) {
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTextures[0]);
|
||||
context->priv().deleteBackendTexture(backendTextures[0]);
|
||||
}
|
||||
if (adoptedIsAlive) {
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTextures[1]);
|
||||
context->priv().deleteBackendTexture(backendTextures[1]);
|
||||
}
|
||||
|
||||
context->resetContext();
|
||||
|
@ -89,49 +89,46 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceEmpty_Gpu, reporter, ctxInfo) {
|
||||
}
|
||||
|
||||
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_colorTypeSupportedAsSurface, reporter, ctxInfo) {
|
||||
GrContext* context = ctxInfo.grContext();
|
||||
|
||||
for (int ct = 0; ct < kLastEnum_SkColorType; ++ct) {
|
||||
static constexpr int kSize = 10;
|
||||
|
||||
SkColorType colorType = static_cast<SkColorType>(ct);
|
||||
auto info = SkImageInfo::Make(kSize, kSize, colorType, kOpaque_SkAlphaType, nullptr);
|
||||
bool can = ctxInfo.grContext()->colorTypeSupportedAsSurface(colorType);
|
||||
auto surf = SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kYes, info, 1,
|
||||
nullptr);
|
||||
bool can = context->colorTypeSupportedAsSurface(colorType);
|
||||
auto surf = SkSurface::MakeRenderTarget(context, SkBudgeted::kYes, info, 1, nullptr);
|
||||
REPORTER_ASSERT(reporter, can == SkToBool(surf), "ct: %d, can: %d, surf: %d",
|
||||
colorType, can, SkToBool(surf));
|
||||
|
||||
auto* gpu = ctxInfo.grContext()->priv().getGpu();
|
||||
GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
|
||||
GrBackendTexture backendTex = context->priv().createBackendTexture(
|
||||
kSize, kSize, colorType, GrMipMapped::kNo, GrRenderable::kYes);
|
||||
surf = SkSurface::MakeFromBackendTexture(ctxInfo.grContext(), backendTex,
|
||||
surf = SkSurface::MakeFromBackendTexture(context, backendTex,
|
||||
kTopLeft_GrSurfaceOrigin, 0, colorType, nullptr,
|
||||
nullptr);
|
||||
REPORTER_ASSERT(reporter, can == SkToBool(surf), "ct: %d, can: %d, surf: %d",
|
||||
colorType, can, SkToBool(surf));
|
||||
|
||||
surf = SkSurface::MakeFromBackendTextureAsRenderTarget(ctxInfo.grContext(), backendTex,
|
||||
surf = SkSurface::MakeFromBackendTextureAsRenderTarget(context, backendTex,
|
||||
kTopLeft_GrSurfaceOrigin, 1,
|
||||
colorType, nullptr, nullptr);
|
||||
REPORTER_ASSERT(reporter, can == SkToBool(surf), "ct: %d, can: %d, surf: %d",
|
||||
colorType, can, SkToBool(surf));
|
||||
|
||||
surf.reset();
|
||||
ctxInfo.grContext()->flush();
|
||||
if (backendTex.isValid()) {
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
}
|
||||
context->flush();
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
|
||||
static constexpr int kSampleCnt = 2;
|
||||
|
||||
can = ctxInfo.grContext()->maxSurfaceSampleCountForColorType(colorType) >= kSampleCnt;
|
||||
surf = SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kYes, info, kSampleCnt,
|
||||
nullptr);
|
||||
can = context->maxSurfaceSampleCountForColorType(colorType) >= kSampleCnt;
|
||||
surf = SkSurface::MakeRenderTarget(context, SkBudgeted::kYes, info, kSampleCnt, nullptr);
|
||||
REPORTER_ASSERT(reporter, can == SkToBool(surf), "ct: %d, can: %d, surf: %d",
|
||||
colorType, can, SkToBool(surf));
|
||||
|
||||
backendTex = gpu->createTestingOnlyBackendTexture(kSize, kSize, colorType,
|
||||
backendTex = context->priv().createBackendTexture(kSize, kSize, colorType,
|
||||
GrMipMapped::kNo, GrRenderable::kYes);
|
||||
surf = SkSurface::MakeFromBackendTexture(ctxInfo.grContext(), backendTex,
|
||||
surf = SkSurface::MakeFromBackendTexture(context, backendTex,
|
||||
kTopLeft_GrSurfaceOrigin, kSampleCnt, colorType,
|
||||
nullptr, nullptr);
|
||||
REPORTER_ASSERT(reporter, can == SkToBool(surf),
|
||||
@ -141,14 +138,14 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_colorTypeSupportedAsSurface, report
|
||||
if (surf) {
|
||||
auto* rtc = ((SkSurface_Gpu*)(surf.get()))->getDevice()->accessRenderTargetContext();
|
||||
int storedCnt = rtc->numStencilSamples();
|
||||
int allowedCnt = ctxInfo.grContext()->priv().caps()->getSampleCount(
|
||||
int allowedCnt = context->priv().caps()->getSampleCount(
|
||||
storedCnt, rtc->asSurfaceProxy()->config());
|
||||
REPORTER_ASSERT(reporter, storedCnt == allowedCnt,
|
||||
"Should store an allowed sample count (%d vs %d)", allowedCnt,
|
||||
storedCnt);
|
||||
}
|
||||
|
||||
surf = SkSurface::MakeFromBackendTextureAsRenderTarget(ctxInfo.grContext(), backendTex,
|
||||
surf = SkSurface::MakeFromBackendTextureAsRenderTarget(context, backendTex,
|
||||
kTopLeft_GrSurfaceOrigin, kSampleCnt,
|
||||
colorType, nullptr, nullptr);
|
||||
REPORTER_ASSERT(reporter, can == SkToBool(surf),
|
||||
@ -157,7 +154,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_colorTypeSupportedAsSurface, report
|
||||
if (surf) {
|
||||
auto* rtc = ((SkSurface_Gpu*)(surf.get()))->getDevice()->accessRenderTargetContext();
|
||||
int storedCnt = rtc->numStencilSamples();
|
||||
int allowedCnt = ctxInfo.grContext()->priv().caps()->getSampleCount(
|
||||
int allowedCnt = context->priv().caps()->getSampleCount(
|
||||
storedCnt, rtc->asSurfaceProxy()->config());
|
||||
REPORTER_ASSERT(reporter, storedCnt == allowedCnt,
|
||||
"Should store an allowed sample count (%d vs %d)", allowedCnt,
|
||||
@ -165,21 +162,21 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_colorTypeSupportedAsSurface, report
|
||||
}
|
||||
|
||||
surf.reset();
|
||||
ctxInfo.grContext()->flush();
|
||||
if (backendTex.isValid()) {
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
}
|
||||
context->flush();
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
|
||||
auto* gpu = context->priv().getGpu();
|
||||
|
||||
GrBackendRenderTarget backendRenderTarget = gpu->createTestingOnlyBackendRenderTarget(
|
||||
16, 16, SkColorTypeToGrColorType(colorType));
|
||||
can = ctxInfo.grContext()->colorTypeSupportedAsSurface(colorType);
|
||||
surf = SkSurface::MakeFromBackendRenderTarget(ctxInfo.grContext(), backendRenderTarget,
|
||||
can = context->colorTypeSupportedAsSurface(colorType);
|
||||
surf = SkSurface::MakeFromBackendRenderTarget(context, backendRenderTarget,
|
||||
kTopLeft_GrSurfaceOrigin, colorType, nullptr,
|
||||
nullptr);
|
||||
REPORTER_ASSERT(reporter, can == SkToBool(surf), "ct: %d, can: %d, surf: %d", colorType,
|
||||
can, SkToBool(surf));
|
||||
surf.reset();
|
||||
ctxInfo.grContext()->flush();
|
||||
context->flush();
|
||||
if (backendRenderTarget.isValid()) {
|
||||
gpu->deleteTestingOnlyBackendRenderTarget(backendRenderTarget);
|
||||
}
|
||||
@ -187,23 +184,27 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_colorTypeSupportedAsSurface, report
|
||||
}
|
||||
|
||||
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_maxSurfaceSamplesForColorType, reporter, ctxInfo) {
|
||||
GrContext* context = ctxInfo.grContext();
|
||||
|
||||
static constexpr int kSize = 10;
|
||||
|
||||
for (int ct = 0; ct < kLastEnum_SkColorType; ++ct) {
|
||||
static constexpr int kSize = 10;
|
||||
|
||||
SkColorType colorType = static_cast<SkColorType>(ct);
|
||||
int max = ctxInfo.grContext()->maxSurfaceSampleCountForColorType(colorType);
|
||||
int max = context->maxSurfaceSampleCountForColorType(colorType);
|
||||
if (!max) {
|
||||
continue;
|
||||
}
|
||||
auto* gpu = ctxInfo.grContext()->priv().getGpu();
|
||||
GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
|
||||
GrBackendTexture backendTex = context->priv().createBackendTexture(
|
||||
kSize, kSize, colorType, GrMipMapped::kNo, GrRenderable::kYes);
|
||||
if (!backendTex.isValid()) {
|
||||
continue;
|
||||
}
|
||||
SkScopeExit freeTex([&backendTex, gpu] {gpu->deleteTestingOnlyBackendTexture(backendTex);});
|
||||
SkScopeExit freeTex([&backendTex, context] {
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
});
|
||||
auto info = SkImageInfo::Make(kSize, kSize, colorType, kOpaque_SkAlphaType, nullptr);
|
||||
auto surf = SkSurface::MakeFromBackendTexture(ctxInfo.grContext(), backendTex,
|
||||
auto surf = SkSurface::MakeFromBackendTexture(context, backendTex,
|
||||
kTopLeft_GrSurfaceOrigin, max,
|
||||
colorType, nullptr, nullptr);
|
||||
REPORTER_ASSERT(reporter, surf);
|
||||
@ -765,7 +766,6 @@ static void test_surface_clear(skiatest::Reporter* reporter, sk_sp<SkSurface> su
|
||||
|
||||
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceClear_Gpu, reporter, ctxInfo) {
|
||||
GrContext* context = ctxInfo.grContext();
|
||||
GrGpu* gpu = context->priv().getGpu();
|
||||
|
||||
std::function<sk_sp<GrSurfaceContext>(SkSurface*)> grSurfaceContextGetters[] = {
|
||||
[] (SkSurface* s){
|
||||
@ -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();
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -842,10 +842,8 @@ static void test_surface_draw_partially(
|
||||
}
|
||||
|
||||
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfacePartialDraw_Gpu, reporter, ctxInfo) {
|
||||
GrGpu* gpu = ctxInfo.grContext()->priv().getGpu();
|
||||
if (!gpu) {
|
||||
return;
|
||||
}
|
||||
GrContext* context = ctxInfo.grContext();
|
||||
|
||||
static const SkColor kOrigColor = 0xFFAABBCC;
|
||||
|
||||
for (auto& surfaceFunc : {&create_gpu_surface_backend_texture,
|
||||
@ -854,11 +852,11 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfacePartialDraw_Gpu, reporter, ctxInfo) {
|
||||
// preserved in pixels that aren't rendered to via the surface.
|
||||
// This works only for non-multisampled case.
|
||||
GrBackendTexture backendTex;
|
||||
auto surface = surfaceFunc(ctxInfo.grContext(), 1, kOrigColor, &backendTex);
|
||||
auto surface = surfaceFunc(context, 1, kOrigColor, &backendTex);
|
||||
if (surface) {
|
||||
test_surface_draw_partially(reporter, surface, kOrigColor);
|
||||
surface.reset();
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -935,22 +933,22 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceWrappedWithRelease_Gpu, reporter, ctxI
|
||||
}
|
||||
|
||||
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceAttachStencil_Gpu, reporter, ctxInfo) {
|
||||
GrGpu* gpu = ctxInfo.grContext()->priv().getGpu();
|
||||
if (!gpu) {
|
||||
return;
|
||||
}
|
||||
if (gpu->caps()->avoidStencilBuffers()) {
|
||||
GrContext* context = ctxInfo.grContext();
|
||||
const GrCaps* caps = context->priv().caps();
|
||||
|
||||
if (caps->avoidStencilBuffers()) {
|
||||
return;
|
||||
}
|
||||
|
||||
static const SkColor kOrigColor = 0xFFAABBCC;
|
||||
|
||||
auto resourceProvider = ctxInfo.grContext()->priv().resourceProvider();
|
||||
auto resourceProvider = context->priv().resourceProvider();
|
||||
|
||||
for (auto& surfaceFunc : {&create_gpu_surface_backend_texture,
|
||||
&create_gpu_surface_backend_texture_as_render_target}) {
|
||||
for (int sampleCnt : {1, 4, 8}) {
|
||||
GrBackendTexture backendTex;
|
||||
auto surface = surfaceFunc(ctxInfo.grContext(), sampleCnt, kOrigColor, &backendTex);
|
||||
auto surface = surfaceFunc(context, sampleCnt, kOrigColor, &backendTex);
|
||||
|
||||
if (!surface && sampleCnt > 1) {
|
||||
// Certain platforms don't support MSAA, skip these.
|
||||
@ -962,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));
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -156,14 +156,7 @@ bool create_backend_texture(GrContext* context, GrBackendTexture* backendTex,
|
||||
}
|
||||
|
||||
void delete_backend_texture(GrContext* context, const GrBackendTexture& backendTex) {
|
||||
auto* gpu = context->priv().getGpu();
|
||||
if (!gpu) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (backendTex.isValid()) {
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
}
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
}
|
||||
|
||||
bool does_full_buffer_contain_correct_color(GrColor* srcBuffer,
|
||||
|
@ -101,7 +101,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(TextureBindingsResetTest, reporter, ctxInf
|
||||
context->resetContext();
|
||||
|
||||
if (supportExternal) {
|
||||
GrBackendTexture texture2D = gpu->createTestingOnlyBackendTexture(
|
||||
GrBackendTexture texture2D = context->priv().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);
|
||||
gpu->deleteTestingOnlyBackendTexture(texture2D);
|
||||
context->priv().deleteBackendTexture(texture2D);
|
||||
context->resetContext();
|
||||
}
|
||||
|
||||
|
@ -31,9 +31,8 @@
|
||||
|
||||
DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkImageLayoutTest, reporter, ctxInfo) {
|
||||
GrContext* context = ctxInfo.grContext();
|
||||
GrGpu* gpu = context->priv().getGpu();
|
||||
|
||||
GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(1, 1,
|
||||
GrBackendTexture backendTex = context->priv().createBackendTexture(1, 1,
|
||||
kRGBA_8888_SkColorType,
|
||||
GrMipMapped::kNo,
|
||||
GrRenderable::kNo);
|
||||
@ -120,7 +119,7 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkImageLayoutTest, reporter, ctxInfo) {
|
||||
REPORTER_ASSERT(reporter, invalidTexture.isValid());
|
||||
REPORTER_ASSERT(reporter, GrBackendTexture::TestingOnly_Equals(invalidTexture, invalidTexture));
|
||||
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
}
|
||||
|
||||
static void testing_release_proc(void* ctx) {
|
||||
@ -139,7 +138,7 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkReleaseExternalQueueTest, reporter, ctxInfo) {
|
||||
}
|
||||
|
||||
for (bool useExternal : {false, true}) {
|
||||
GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(1, 1,
|
||||
GrBackendTexture backendTex = context->priv().createBackendTexture(1, 1,
|
||||
kRGBA_8888_SkColorType,
|
||||
GrMipMapped::kNo,
|
||||
GrRenderable::kNo);
|
||||
@ -203,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);
|
||||
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,8 +210,8 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkReleaseExternalQueueTest, reporter, ctxInfo) {
|
||||
// in flush calls
|
||||
DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkPrepareForExternalIOQueueTransitionTest, reporter, ctxInfo) {
|
||||
GrContext* context = ctxInfo.grContext();
|
||||
GrGpu* gpu = context->priv().getGpu();
|
||||
GrVkGpu* vkGpu = static_cast<GrVkGpu*>(gpu);
|
||||
|
||||
GrVkGpu* vkGpu = static_cast<GrVkGpu*>(context->priv().getGpu());
|
||||
if (!vkGpu->vkCaps().supportsExternalMemory()) {
|
||||
return;
|
||||
}
|
||||
@ -223,7 +222,7 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkPrepareForExternalIOQueueTransitionTest, report
|
||||
// We don't set textures to present
|
||||
continue;
|
||||
}
|
||||
GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
|
||||
GrBackendTexture backendTex = context->priv().createBackendTexture(
|
||||
4, 4, kRGBA_8888_SkColorType, GrMipMapped::kNo,
|
||||
useSurface ? GrRenderable::kYes : GrRenderable::kNo);
|
||||
|
||||
@ -324,7 +323,7 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkPrepareForExternalIOQueueTransitionTest, report
|
||||
GrFlushInfo flushInfo;
|
||||
flushInfo.fFlags = kSyncCpu_GrFlushFlag;
|
||||
context->flush(flushInfo);
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -339,7 +338,7 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkTransitionExternalQueueTest, reporter, ctxInfo)
|
||||
return;
|
||||
}
|
||||
|
||||
GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
|
||||
GrBackendTexture backendTex = context->priv().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.
|
||||
@ -378,7 +377,7 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkTransitionExternalQueueTest, reporter, ctxInfo)
|
||||
|
||||
image.reset();
|
||||
gpu->testingOnly_flushGpuAndSync();
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ void wrap_tex_test(skiatest::Reporter* reporter, GrContext* context) {
|
||||
|
||||
GrGpu* gpu = context->priv().getGpu();
|
||||
|
||||
GrBackendTexture origBackendTex = gpu->createTestingOnlyBackendTexture(kW, kH,
|
||||
GrBackendTexture origBackendTex = context->priv().createBackendTexture(kW, kH,
|
||||
kColorType,
|
||||
GrMipMapped::kNo,
|
||||
GrRenderable::kNo);
|
||||
@ -90,7 +90,7 @@ 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 = gpu->createTestingOnlyBackendTexture(kW, kH,
|
||||
GrBackendTexture origBackendTex = context->priv().createBackendTexture(kW, kH,
|
||||
kColorType,
|
||||
GrMipMapped::kNo,
|
||||
GrRenderable::kYes);
|
||||
@ -127,13 +127,13 @@ 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.
|
||||
gpu->deleteTestingOnlyBackendTexture(origBackendTex);
|
||||
context->priv().deleteBackendTexture(origBackendTex);
|
||||
}
|
||||
|
||||
void wrap_trt_test(skiatest::Reporter* reporter, GrContext* context) {
|
||||
GrGpu* gpu = context->priv().getGpu();
|
||||
|
||||
GrBackendTexture origBackendTex = gpu->createTestingOnlyBackendTexture(kW, kH,
|
||||
GrBackendTexture origBackendTex = context->priv().createBackendTexture(kW, kH,
|
||||
kColorType,
|
||||
GrMipMapped::kNo,
|
||||
GrRenderable::kYes);
|
||||
|
@ -450,12 +450,12 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixelsMSAA_Gpu, reporter, ctxInfo) {
|
||||
test_write_pixels(reporter, ctxInfo.grContext(), 1);
|
||||
}
|
||||
|
||||
static void test_write_pixels_non_texture(skiatest::Reporter* reporter, GrContext* context,
|
||||
static void test_write_pixels_non_texture(skiatest::Reporter* reporter,
|
||||
GrContext* context,
|
||||
int sampleCnt) {
|
||||
GrGpu* gpu = context->priv().getGpu();
|
||||
|
||||
for (auto& origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) {
|
||||
GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
|
||||
GrBackendTexture backendTex = context->priv().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, GrContex
|
||||
auto ii = SkImageInfo::MakeN32Premul(DEV_W, DEV_H);
|
||||
test_write_pixels(reporter, surface.get(), ii);
|
||||
}
|
||||
gpu->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,7 @@ DDLPromiseImageHelper::PromiseImageCallbackContext::~PromiseImageCallbackContext
|
||||
SkASSERT(!fTotalFulfills || fDoneCnt);
|
||||
|
||||
if (fPromiseImageTexture) {
|
||||
GrGpu* gpu = fContext->priv().getGpu();
|
||||
gpu->deleteTestingOnlyBackendTexture(fPromiseImageTexture->backendTexture());
|
||||
fContext->priv().deleteBackendTexture(fPromiseImageTexture->backendTexture());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -280,12 +280,11 @@ static sk_sp<SkImage> draw_with_gpu(std::function<bool(SkCanvas*)> draw,
|
||||
break;
|
||||
|
||||
case SurfaceType::kBackendTexture:
|
||||
backendTexture = context->priv().getGpu()
|
||||
->createTestingOnlyBackendTexture(info.width(),
|
||||
info.height(),
|
||||
info.colorType(),
|
||||
GrMipMapped::kNo,
|
||||
GrRenderable::kYes);
|
||||
backendTexture = context->priv().createBackendTexture(info.width(),
|
||||
info.height(),
|
||||
info.colorType(),
|
||||
GrMipMapped::kNo,
|
||||
GrRenderable::kYes);
|
||||
surface = SkSurface::MakeFromBackendTexture(context,
|
||||
backendTexture,
|
||||
kTopLeft_GrSurfaceOrigin,
|
||||
@ -332,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().getGpu()->deleteTestingOnlyBackendTexture(backendTexture);
|
||||
context->priv().deleteBackendTexture(backendTexture);
|
||||
}
|
||||
if (backendRT.isValid()) {
|
||||
context->priv().getGpu()->deleteTestingOnlyBackendRenderTarget(backendRT);
|
||||
|
@ -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().getGpu()->createTestingOnlyBackendTexture(
|
||||
auto backendTex = context->priv().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().getGpu()->deleteTestingOnlyBackendTexture(backendTex);
|
||||
context->priv().deleteBackendTexture(backendTex);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user