Rename wrap backend tex/rt methods on GrProxyProvider

This makes them more consistent with similar methods on GrResourceProvider.

Change-Id: Ice7e5dbe8100481781015b386445e9b7101bd75e
Reviewed-on: https://skia-review.googlesource.com/112821
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2018-03-07 14:39:54 -05:00 committed by Skia Commit-Bot
parent af4adefd8c
commit 7578f3ecdd
10 changed files with 51 additions and 66 deletions

View File

@ -1241,7 +1241,7 @@ sk_sp<GrTextureContext> GrContextPriv::makeBackendTextureContext(const GrBackend
sk_sp<SkColorSpace> colorSpace) {
ASSERT_SINGLE_OWNER_PRIV
sk_sp<GrSurfaceProxy> proxy = this->proxyProvider()->createWrappedTextureProxy(tex, origin);
sk_sp<GrSurfaceProxy> proxy = this->proxyProvider()->wrapBackendTexture(tex, origin);
if (!proxy) {
return nullptr;
}
@ -1258,8 +1258,8 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureRenderTargetContex
ASSERT_SINGLE_OWNER_PRIV
SkASSERT(sampleCnt > 0);
sk_sp<GrTextureProxy> proxy(this->proxyProvider()->createWrappedTextureProxy(tex, origin,
sampleCnt));
sk_sp<GrTextureProxy> proxy(
this->proxyProvider()->wrapRenderableBackendTexture(tex, origin, sampleCnt));
if (!proxy) {
return nullptr;
}
@ -1275,8 +1275,7 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendRenderTargetRenderTargetC
const SkSurfaceProps* surfaceProps) {
ASSERT_SINGLE_OWNER_PRIV
sk_sp<GrSurfaceProxy> proxy = this->proxyProvider()->createWrappedRenderTargetProxy(backendRT,
origin);
sk_sp<GrSurfaceProxy> proxy = this->proxyProvider()->wrapBackendRenderTarget(backendRT, origin);
if (!proxy) {
return nullptr;
}
@ -1294,8 +1293,8 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureAsRenderTargetRend
const SkSurfaceProps* props) {
ASSERT_SINGLE_OWNER_PRIV
SkASSERT(sampleCnt > 0);
sk_sp<GrSurfaceProxy> proxy(this->proxyProvider()->createWrappedRenderTargetProxy(tex, origin,
sampleCnt));
sk_sp<GrSurfaceProxy> proxy(
this->proxyProvider()->wrapBackendTextureAsRenderTarget(tex, origin, sampleCnt));
if (!proxy) {
return nullptr;
}

View File

@ -399,12 +399,11 @@ sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrSurfaceDesc& desc,
new GrTextureProxy(copyDesc, origin, mipMapped, fit, budgeted, flags));
}
sk_sp<GrTextureProxy> GrProxyProvider::createWrappedTextureProxy(
const GrBackendTexture& backendTex,
GrSurfaceOrigin origin,
GrWrapOwnership ownership,
ReleaseProc releaseProc,
ReleaseContext releaseCtx) {
sk_sp<GrTextureProxy> GrProxyProvider::wrapBackendTexture(const GrBackendTexture& backendTex,
GrSurfaceOrigin origin,
GrWrapOwnership ownership,
ReleaseProc releaseProc,
ReleaseContext releaseCtx) {
if (this->isAbandoned()) {
return nullptr;
}
@ -456,9 +455,8 @@ sk_sp<GrTextureProxy> GrProxyProvider::createWrappedTextureProxy(
return proxy;
}
sk_sp<GrTextureProxy> GrProxyProvider::createWrappedTextureProxy(const GrBackendTexture& backendTex,
GrSurfaceOrigin origin,
int sampleCnt) {
sk_sp<GrTextureProxy> GrProxyProvider::wrapRenderableBackendTexture(
const GrBackendTexture& backendTex, GrSurfaceOrigin origin, int sampleCnt) {
if (this->isAbandoned()) {
return nullptr;
}
@ -513,9 +511,8 @@ sk_sp<GrTextureProxy> GrProxyProvider::createWrappedTextureProxy(const GrBackend
return proxy;
}
sk_sp<GrSurfaceProxy> GrProxyProvider::createWrappedRenderTargetProxy(
const GrBackendRenderTarget& backendRT,
GrSurfaceOrigin origin) {
sk_sp<GrSurfaceProxy> GrProxyProvider::wrapBackendRenderTarget(
const GrBackendRenderTarget& backendRT, GrSurfaceOrigin origin) {
if (this->isAbandoned()) {
return nullptr;
}
@ -565,10 +562,8 @@ sk_sp<GrSurfaceProxy> GrProxyProvider::createWrappedRenderTargetProxy(
return proxy;
}
sk_sp<GrSurfaceProxy> GrProxyProvider::createWrappedRenderTargetProxy(
const GrBackendTexture& backendTex,
GrSurfaceOrigin origin,
int sampleCnt) {
sk_sp<GrSurfaceProxy> GrProxyProvider::wrapBackendTextureAsRenderTarget(
const GrBackendTexture& backendTex, GrSurfaceOrigin origin, int sampleCnt) {
if (this->isAbandoned()) {
return nullptr;
}

View File

@ -120,30 +120,28 @@ public:
/*
* Create a texture proxy that wraps a (non-renderable) backend texture.
*/
sk_sp<GrTextureProxy> createWrappedTextureProxy(const GrBackendTexture&, GrSurfaceOrigin,
GrWrapOwnership = kBorrow_GrWrapOwnership,
ReleaseProc = nullptr,
ReleaseContext = nullptr);
sk_sp<GrTextureProxy> wrapBackendTexture(const GrBackendTexture&, GrSurfaceOrigin,
GrWrapOwnership = kBorrow_GrWrapOwnership,
ReleaseProc = nullptr, ReleaseContext = nullptr);
/*
* Create a texture proxy that wraps a backend texture and is both texture-able and renderable
*/
sk_sp<GrTextureProxy> createWrappedTextureProxy(const GrBackendTexture&,
GrSurfaceOrigin,
int sampleCnt);
sk_sp<GrTextureProxy> wrapRenderableBackendTexture(const GrBackendTexture&,
GrSurfaceOrigin,
int sampleCnt);
/*
* Create a render target proxy that wraps a backend rendertarget
*/
sk_sp<GrSurfaceProxy> createWrappedRenderTargetProxy(const GrBackendRenderTarget&,
GrSurfaceOrigin);
sk_sp<GrSurfaceProxy> wrapBackendRenderTarget(const GrBackendRenderTarget&, GrSurfaceOrigin);
/*
* Create a render target proxy that wraps a backend texture?
* Create a render target proxy that wraps a backend texture
*/
sk_sp<GrSurfaceProxy> createWrappedRenderTargetProxy(const GrBackendTexture& tex,
GrSurfaceOrigin origin,
int sampleCnt);
sk_sp<GrSurfaceProxy> wrapBackendTextureAsRenderTarget(const GrBackendTexture& tex,
GrSurfaceOrigin origin,
int sampleCnt);
using LazyInstantiateCallback = std::function<sk_sp<GrSurface>(GrResourceProvider*)>;
enum class Textureable : bool {

View File

@ -305,8 +305,8 @@ static sk_sp<SkImage> new_wrapped_texture_common(GrContext* ctx,
}
GrProxyProvider* proxyProvider = ctx->contextPriv().proxyProvider();
sk_sp<GrTextureProxy> proxy = proxyProvider->createWrappedTextureProxy(
backendTex, origin, ownership, releaseProc, releaseCtx);
sk_sp<GrTextureProxy> proxy = proxyProvider->wrapBackendTexture(backendTex, origin, ownership,
releaseProc, releaseCtx);
if (!proxy) {
return nullptr;
}
@ -422,16 +422,14 @@ static sk_sp<SkImage> make_from_yuv_textures_copy(GrContext* ctx, SkYUVColorSpac
return nullptr;
}
sk_sp<GrTextureProxy> yProxy = proxyProvider->createWrappedTextureProxy(yuvBackendTextures[0],
origin);
sk_sp<GrTextureProxy> uProxy = proxyProvider->createWrappedTextureProxy(yuvBackendTextures[1],
origin);
sk_sp<GrTextureProxy> yProxy = proxyProvider->wrapBackendTexture(yuvBackendTextures[0], origin);
sk_sp<GrTextureProxy> uProxy = proxyProvider->wrapBackendTexture(yuvBackendTextures[1], origin);
sk_sp<GrTextureProxy> vProxy;
if (nv12) {
vProxy = uProxy;
} else {
vProxy = proxyProvider->createWrappedTextureProxy(yuvBackendTextures[2], origin);
vProxy = proxyProvider->wrapBackendTexture(yuvBackendTextures[2], origin);
}
if (!yProxy || !uProxy || !vProxy) {
return nullptr;

View File

@ -1075,8 +1075,8 @@ DEF_GPUTEST(PorterDuffNoDualSourceBlending, reporter, options) {
GrXferProcessor::DstProxy fakeDstProxy;
{
sk_sp<GrTextureProxy> proxy = proxyProvider->createWrappedTextureProxy(
backendTex, kTopLeft_GrSurfaceOrigin);
sk_sp<GrTextureProxy> proxy =
proxyProvider->wrapBackendTexture(backendTex, kTopLeft_GrSurfaceOrigin);
fakeDstProxy.setProxy(std::move(proxy));
}

View File

@ -28,7 +28,7 @@ static sk_sp<GrSurfaceProxy> make_wrapped_FBO0(GrProxyProvider* provider,
GrBackendRenderTarget backendRT(desc.fWidth, desc.fHeight, desc.fSampleCnt, 8,
desc.fConfig, fboInfo);
return provider->createWrappedRenderTargetProxy(backendRT, origin);
return provider->wrapBackendRenderTarget(backendRT, origin);
}
static sk_sp<GrSurfaceProxy> make_wrapped_offscreen_rt(GrProxyProvider* provider,

View File

@ -207,15 +207,15 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
}
// External on-screen render target.
// Tests createWrappedRenderTargetProxy with a GrBackendRenderTarget
// Tests wrapBackendRenderTarget with a GrBackendRenderTarget
{
GrGLFramebufferInfo fboInfo;
fboInfo.fFBOID = 0;
GrBackendRenderTarget backendRT(kWidthHeight, kWidthHeight, numSamples, 8,
config, fboInfo);
sk_sp<GrSurfaceProxy> sProxy(proxyProvider->createWrappedRenderTargetProxy(
backendRT, origin));
sk_sp<GrSurfaceProxy> sProxy(
proxyProvider->wrapBackendRenderTarget(backendRT, origin));
check_surface(reporter, sProxy.get(), origin,
kWidthHeight, kWidthHeight,
backendRT.testingOnly_getPixelConfig(), SkBudgeted::kNo);
@ -224,15 +224,14 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
supportedNumSamples, SkBackingFit::kExact, 0);
}
// Tests createWrappedRenderTargetProxy with a GrBackendTexture
// Tests wrapBackendRenderTarget with a GrBackendTexture
{
GrBackendTexture backendTex =
gpu->createTestingOnlyBackendTexture(nullptr, kWidthHeight,
kWidthHeight, colorType, true,
GrMipMapped::kNo);
sk_sp<GrSurfaceProxy> sProxy =
proxyProvider->createWrappedRenderTargetProxy(backendTex, origin,
supportedNumSamples);
sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapBackendTextureAsRenderTarget(
backendTex, origin, supportedNumSamples);
if (!sProxy) {
gpu->deleteTestingOnlyBackendTexture(&backendTex);
continue; // This can fail on Mesa
@ -249,16 +248,15 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
gpu->deleteTestingOnlyBackendTexture(&backendTex);
}
// Tests createWrappedTextureProxy that is only renderable
// Tests wrapBackendTexture that is only renderable
{
GrBackendTexture backendTex =
gpu->createTestingOnlyBackendTexture(nullptr, kWidthHeight,
kWidthHeight, colorType, true,
GrMipMapped::kNo);
sk_sp<GrSurfaceProxy> sProxy =
proxyProvider->createWrappedTextureProxy(backendTex, origin,
supportedNumSamples);
sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapRenderableBackendTexture(
backendTex, origin, supportedNumSamples);
if (!sProxy) {
gpu->deleteTestingOnlyBackendTexture(&backendTex);
continue; // This can fail on Mesa
@ -275,7 +273,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
gpu->deleteTestingOnlyBackendTexture(&backendTex);
}
// Tests createWrappedTextureProxy that is only textureable
// Tests wrapBackendTexture that is only textureable
{
// Internal offscreen texture
GrBackendTexture backendTex =
@ -283,10 +281,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
kWidthHeight, colorType, false,
GrMipMapped::kNo);
sk_sp<GrSurfaceProxy> sProxy =
proxyProvider->createWrappedTextureProxy(backendTex, origin,
kBorrow_GrWrapOwnership,
nullptr, nullptr);
sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapBackendTexture(
backendTex, origin, kBorrow_GrWrapOwnership, nullptr, nullptr);
if (!sProxy) {
gpu->deleteTestingOnlyBackendTexture(&backendTex);
continue;

View File

@ -127,8 +127,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(RectangleTexture, reporter, ctxInfo) {
}
}
sk_sp<GrTextureProxy> rectProxy = proxyProvider->createWrappedTextureProxy(
rectangleTex, origin);
sk_sp<GrTextureProxy> rectProxy = proxyProvider->wrapBackendTexture(rectangleTex, origin);
if (!rectProxy) {
ERRORF(reporter, "Error creating proxy for rectangle texture.");

View File

@ -51,7 +51,7 @@ static sk_sp<GrSurfaceProxy> make_backend(GrContext* context, const ProxyParams&
p.fConfig, false,
GrMipMapped::kNo);
return proxyProvider->createWrappedTextureProxy(*backendTex, p.fOrigin);
return proxyProvider->wrapBackendTexture(*backendTex, p.fOrigin);
}
static void cleanup_backend(GrContext* context, GrBackendTexture* backendTex) {

View File

@ -109,7 +109,7 @@ static sk_sp<GrTextureProxy> create_wrapped_backend(GrContext* context, SkBackin
GrBackendTexture backendTex = (*backingSurface)->getBackendTexture();
return proxyProvider->createWrappedTextureProxy(backendTex, kBottomLeft_GrSurfaceOrigin);
return proxyProvider->wrapBackendTexture(backendTex, kBottomLeft_GrSurfaceOrigin);
}