Remove origin from GrSurfaceProxy.

Bug: skia:9556
Change-Id: Ic95a3a6b11e1ff8a6f6b2f5c5aeb9037b72aae90
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270840
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Greg Daniel 2020-02-14 10:47:18 -05:00 committed by Skia Commit-Bot
parent 20228946c9
commit 3a36511f21
63 changed files with 552 additions and 687 deletions

View File

@ -163,7 +163,6 @@ bool SkDeferredDisplayListRecorder::init() {
fCharacterization.dimensions(),
readSwizzle,
fCharacterization.sampleCount(),
fCharacterization.origin(),
surfaceFlags,
optionalTextureInfo,
GrMipMapsStatus::kNotAllocated,

View File

@ -179,10 +179,9 @@ GrSurfaceProxyView GrAHardwareBufferImageGenerator::makeView(GrRecordingContext*
return tex;
},
backendFormat, {width, height}, readSwizzle, GrRenderable::kNo, 1, fSurfaceOrigin,
GrMipMapped::kNo, GrMipMapsStatus::kNotAllocated, GrInternalSurfaceFlags::kReadOnly,
SkBackingFit::kExact, SkBudgeted::kNo, GrProtected::kNo,
GrSurfaceProxy::UseAllocator::kYes);
backendFormat, {width, height}, readSwizzle, GrRenderable::kNo, 1, GrMipMapped::kNo,
GrMipMapsStatus::kNotAllocated, GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact,
SkBudgeted::kNo, GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
return GrSurfaceProxyView(std::move(texProxy), fSurfaceOrigin, readSwizzle);
}

View File

@ -155,49 +155,54 @@ GrSurfaceProxyView GrBackendTextureImageGenerator::onGenerateTexture(
// Must make copies of member variables to capture in the lambda since this image generator may
// be deleted before we actually execute the lambda.
sk_sp<GrTextureProxy> proxy = proxyProvider->createLazyProxy(
[refHelper = fRefHelper, releaseProcHelper, backendTexture = fBackendTexture,
grColorType](
GrResourceProvider* resourceProvider) -> GrSurfaceProxy::LazyCallbackResult {
if (refHelper->fSemaphore) {
resourceProvider->priv().gpu()->waitSemaphore(refHelper->fSemaphore.get());
}
[
refHelper = fRefHelper, releaseProcHelper, backendTexture = fBackendTexture,
grColorType
](GrResourceProvider * resourceProvider)
->GrSurfaceProxy::LazyCallbackResult {
if (refHelper->fSemaphore) {
resourceProvider->priv().gpu()->waitSemaphore(
refHelper->fSemaphore.get());
}
// If a client re-draws the same image multiple times, the texture we return
// will be cached and re-used. If they draw a subset, though, we may be
// re-called. In that case, we want to re-use the borrowed texture we've
// previously created.
sk_sp<GrTexture> tex;
SkASSERT(refHelper->fBorrowedTextureKey.isValid());
auto surf = resourceProvider->findByUniqueKey<GrSurface>(
refHelper->fBorrowedTextureKey);
if (surf) {
SkASSERT(surf->asTexture());
tex = sk_ref_sp(surf->asTexture());
} else {
// We just gained access to the texture. If we're on the original context, we
// could use the original texture, but we'd have no way of detecting that it's
// no longer in-use. So we always make a wrapped copy, where the release proc
// informs us that the context is done with it. This is unfortunate - we'll have
// two texture objects referencing the same GPU object. However, no client can
// ever see the original texture, so this should be safe.
// We make the texture uncacheable so that the release proc is called ASAP.
tex = resourceProvider->wrapBackendTexture(
backendTexture, grColorType, kBorrow_GrWrapOwnership,
GrWrapCacheable::kNo, kRead_GrIOType);
if (!tex) {
return {};
}
tex->setRelease(releaseProcHelper);
tex->resourcePriv().setUniqueKey(refHelper->fBorrowedTextureKey);
}
// We use keys to avoid re-wrapping the GrBackendTexture in a GrTexture. This is
// unrelated to the whatever SkImage key may be assigned to the proxy.
return {std::move(tex), true, GrSurfaceProxy::LazyInstantiationKeyMode::kUnsynced};
},
// If a client re-draws the same image multiple times, the texture we return
// will be cached and re-used. If they draw a subset, though, we may be
// re-called. In that case, we want to re-use the borrowed texture we've
// previously created.
sk_sp<GrTexture> tex;
SkASSERT(refHelper->fBorrowedTextureKey.isValid());
auto surf = resourceProvider->findByUniqueKey<GrSurface>(
refHelper->fBorrowedTextureKey);
if (surf) {
SkASSERT(surf->asTexture());
tex = sk_ref_sp(surf->asTexture());
} else {
// We just gained access to the texture. If we're on the original
// context, we could use the original texture, but we'd have no way of
// detecting that it's no longer in-use. So we always make a wrapped
// copy, where the release proc informs us that the context is done with
// it. This is unfortunate - we'll have two texture objects referencing
// the same GPU object. However, no client can ever see the original
// texture, so this should be safe. We make the texture uncacheable so
// that the release proc is called ASAP.
tex = resourceProvider->wrapBackendTexture(
backendTexture, grColorType, kBorrow_GrWrapOwnership,
GrWrapCacheable::kNo, kRead_GrIOType);
if (!tex) {
return {};
}
tex->setRelease(releaseProcHelper);
tex->resourcePriv().setUniqueKey(refHelper->fBorrowedTextureKey);
}
// We use keys to avoid re-wrapping the GrBackendTexture in a GrTexture.
// This is unrelated to the whatever SkImage key may be assigned to the
// proxy.
return {std::move(tex), true,
GrSurfaceProxy::LazyInstantiationKeyMode::kUnsynced};
},
backendFormat, fBackendTexture.dimensions(), readSwizzle, GrRenderable::kNo, 1,
fSurfaceOrigin, mipMapped, mipMapsStatus, GrInternalSurfaceFlags::kReadOnly,
SkBackingFit::kExact, SkBudgeted::kNo, GrProtected::kNo,
GrSurfaceProxy::UseAllocator::kYes);
mipMapped, mipMapsStatus, GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact,
SkBudgeted::kNo, GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
if (!proxy) {
return {};
}

View File

@ -51,8 +51,7 @@ GrSurfaceProxyView GrBitmapTextureMaker::refOriginalTextureProxyView(bool willBe
if (fOriginalKey.isValid()) {
auto colorType = SkColorTypeToGrColorType(fBitmap.colorType());
proxy = proxyProvider->findOrCreateProxyByUniqueKey(fOriginalKey, colorType,
kTopLeft_GrSurfaceOrigin);
proxy = proxyProvider->findOrCreateProxyByUniqueKey(fOriginalKey, colorType);
if (proxy) {
swizzle = this->context()->priv().caps()->getReadSwizzle(proxy->backendFormat(),
this->colorType());

View File

@ -83,8 +83,7 @@ static bool sw_draw_with_mask_filter(GrRecordingContext* context,
if (key.isValid()) {
// TODO: this cache look up is duplicated in draw_shape_with_mask_filter for gpu
static const GrSurfaceOrigin kCacheOrigin = kTopLeft_GrSurfaceOrigin;
auto filteredMask = proxyProvider->findOrCreateProxyByUniqueKey(key, GrColorType::kAlpha_8,
kCacheOrigin);
auto filteredMask = proxyProvider->findOrCreateProxyByUniqueKey(key, GrColorType::kAlpha_8);
if (filteredMask) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(
filteredMask->backendFormat(), GrColorType::kAlpha_8);
@ -402,8 +401,8 @@ static void draw_shape_with_mask_filter(GrRecordingContext* context,
if (maskKey.isValid()) {
// TODO: this cache look up is duplicated in sw_draw_with_mask_filter for raster
static const GrSurfaceOrigin kCacheOrigin = kTopLeft_GrSurfaceOrigin;
auto filteredMask = proxyProvider->findOrCreateProxyByUniqueKey(
maskKey, GrColorType::kAlpha_8, kCacheOrigin);
auto filteredMask =
proxyProvider->findOrCreateProxyByUniqueKey(maskKey, GrColorType::kAlpha_8);
if (filteredMask) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(
filteredMask->backendFormat(), GrColorType::kAlpha_8);

View File

@ -349,8 +349,8 @@ GrSurfaceProxyView GrClipStackClip::createAlphaClipMask(GrRecordingContext* cont
create_clip_mask_key(reducedClip.maskGenID(), reducedClip.scissor(),
reducedClip.numAnalyticFPs(), &key);
if (sk_sp<GrTextureProxy> proxy = proxyProvider->findOrCreateProxyByUniqueKey(
key, GrColorType::kAlpha_8, kTopLeft_GrSurfaceOrigin)) {
if (sk_sp<GrTextureProxy> proxy =
proxyProvider->findOrCreateProxyByUniqueKey(key, GrColorType::kAlpha_8)) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(proxy->backendFormat(),
GrColorType::kAlpha_8);
return {std::move(proxy), kTopLeft_GrSurfaceOrigin, swizzle};
@ -464,8 +464,8 @@ GrSurfaceProxyView GrClipStackClip::createSoftwareClipMask(
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
const GrCaps* caps = context->priv().caps();
if (sk_sp<GrTextureProxy> proxy = proxyProvider->findOrCreateProxyByUniqueKey(
key, GrColorType::kAlpha_8, kTopLeft_GrSurfaceOrigin)) {
if (sk_sp<GrTextureProxy> proxy =
proxyProvider->findOrCreateProxyByUniqueKey(key, GrColorType::kAlpha_8)) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(proxy->backendFormat(),
GrColorType::kAlpha_8);
return {std::move(proxy), kTopLeft_GrSurfaceOrigin, swizzle};
@ -495,7 +495,6 @@ GrSurfaceProxyView GrClipStackClip::createSoftwareClipMask(
swizzle,
GrRenderable::kNo,
1,
kTopLeft_GrSurfaceOrigin,
GrMipMapped::kNo,
SkBackingFit::kApprox,
SkBudgeted::kYes,

View File

@ -562,8 +562,8 @@ bool GrDrawOpAtlas::createPages(
for (uint32_t i = 0; i < this->maxPages(); ++i) {
GrSwizzle swizzle = proxyProvider->caps()->getReadSwizzle(fFormat, fColorType);
sk_sp<GrSurfaceProxy> proxy = proxyProvider->createProxy(
fFormat, dims, swizzle, GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin,
GrMipMapped::kNo, SkBackingFit::kExact, SkBudgeted::kYes, GrProtected::kNo,
fFormat, dims, swizzle, GrRenderable::kNo, 1, GrMipMapped::kNo,
SkBackingFit::kExact, SkBudgeted::kYes, GrProtected::kNo,
GrInternalSurfaceFlags::kNone, GrSurfaceProxy::UseAllocator::kNo);
if (!proxy) {
return false;

View File

@ -64,7 +64,7 @@ sk_sp<GrTextureProxy> GrDynamicAtlas::MakeLazyAtlasProxy(
sk_sp<GrTextureProxy> proxy = GrProxyProvider::MakeFullyLazyProxy(
std::move(instantiate), format, readSwizzle, GrRenderable::kYes, sampleCount,
GrProtected::kNo, kTextureOrigin, caps, useAllocator);
GrProtected::kNo, caps, useAllocator);
return proxy;
}

View File

@ -81,10 +81,9 @@ void GrOnFlushResourceProvider::processInvalidUniqueKey(const GrUniqueKey& key)
sk_sp<GrTextureProxy> GrOnFlushResourceProvider::findOrCreateProxyByUniqueKey(
const GrUniqueKey& key,
GrColorType colorType,
GrSurfaceOrigin origin,
UseAllocator useAllocator) {
auto proxyProvider = fDrawingMgr->getContext()->priv().proxyProvider();
return proxyProvider->findOrCreateProxyByUniqueKey(key, colorType, origin, useAllocator);
return proxyProvider->findOrCreateProxyByUniqueKey(key, colorType, useAllocator);
}
bool GrOnFlushResourceProvider::instatiateProxy(GrSurfaceProxy* proxy) {

View File

@ -79,7 +79,6 @@ public:
// GrColorType is necessary to set the proxy's texture swizzle.
sk_sp<GrTextureProxy> findOrCreateProxyByUniqueKey(const GrUniqueKey&,
GrColorType,
GrSurfaceOrigin,
UseAllocator);
bool instatiateProxy(GrSurfaceProxy*);

View File

@ -95,8 +95,7 @@ void GrProxyProvider::removeUniqueKeyFromProxy(GrTextureProxy* proxy) {
this->processInvalidUniqueKey(proxy->getUniqueKey(), proxy, InvalidateGPUResource::kYes);
}
sk_sp<GrTextureProxy> GrProxyProvider::findProxyByUniqueKey(const GrUniqueKey& key,
GrSurfaceOrigin origin) {
sk_sp<GrTextureProxy> GrProxyProvider::findProxyByUniqueKey(const GrUniqueKey& key) {
ASSERT_SINGLE_OWNER
if (this->isAbandoned()) {
@ -119,7 +118,6 @@ sk_sp<GrTextureProxy> GrProxyProvider::testingOnly_createInstantiatedProxy(
const GrBackendFormat& format,
GrRenderable renderable,
int renderTargetSampleCnt,
GrSurfaceOrigin origin,
SkBackingFit fit,
SkBudgeted budgeted,
GrProtected isProtected) {
@ -152,7 +150,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::testingOnly_createInstantiatedProxy(
return nullptr;
}
return this->createWrapped(std::move(tex), colorType, origin, UseAllocator::kYes);
return this->createWrapped(std::move(tex), colorType, UseAllocator::kYes);
}
sk_sp<GrTextureProxy> GrProxyProvider::testingOnly_createInstantiatedProxy(
@ -160,7 +158,6 @@ sk_sp<GrTextureProxy> GrProxyProvider::testingOnly_createInstantiatedProxy(
GrColorType colorType,
GrRenderable renderable,
int renderTargetSampleCnt,
GrSurfaceOrigin origin,
SkBackingFit fit,
SkBudgeted budgeted,
GrProtected isProtected) {
@ -174,42 +171,37 @@ sk_sp<GrTextureProxy> GrProxyProvider::testingOnly_createInstantiatedProxy(
format,
renderable,
renderTargetSampleCnt,
origin,
fit,
budgeted,
isProtected);
}
sk_sp<GrTextureProxy> GrProxyProvider::testingOnly_createWrapped(sk_sp<GrTexture> tex,
GrColorType colorType,
GrSurfaceOrigin origin) {
return this->createWrapped(std::move(tex), colorType, origin, UseAllocator::kYes);
GrColorType colorType) {
return this->createWrapped(std::move(tex), colorType, UseAllocator::kYes);
}
#endif
sk_sp<GrTextureProxy> GrProxyProvider::createWrapped(sk_sp<GrTexture> tex,
GrColorType colorType,
GrSurfaceOrigin origin,
UseAllocator useAllocator) {
#ifdef SK_DEBUG
if (tex->getUniqueKey().isValid()) {
SkASSERT(!this->findProxyByUniqueKey(tex->getUniqueKey(), origin));
SkASSERT(!this->findProxyByUniqueKey(tex->getUniqueKey()));
}
#endif
GrSwizzle readSwizzle = this->caps()->getReadSwizzle(tex->backendFormat(), colorType);
if (tex->asRenderTarget()) {
return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(
std::move(tex), origin, readSwizzle, useAllocator));
} else {
return sk_sp<GrTextureProxy>(
new GrTextureProxy(std::move(tex), origin, readSwizzle, useAllocator));
new GrTextureRenderTargetProxy(std::move(tex), readSwizzle, useAllocator));
} else {
return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(tex), readSwizzle, useAllocator));
}
}
sk_sp<GrTextureProxy> GrProxyProvider::findOrCreateProxyByUniqueKey(const GrUniqueKey& key,
GrColorType colorType,
GrSurfaceOrigin origin,
UseAllocator useAllocator) {
ASSERT_SINGLE_OWNER
@ -217,7 +209,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::findOrCreateProxyByUniqueKey(const GrUniq
return nullptr;
}
sk_sp<GrTextureProxy> result = this->findProxyByUniqueKey(key, origin);
sk_sp<GrTextureProxy> result = this->findProxyByUniqueKey(key);
if (result) {
return result;
}
@ -237,7 +229,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::findOrCreateProxyByUniqueKey(const GrUniq
sk_sp<GrTexture> texture(static_cast<GrSurface*>(resource)->asTexture());
SkASSERT(texture);
result = this->createWrapped(std::move(texture), colorType, origin, useAllocator);
result = this->createWrapped(std::move(texture), colorType, useAllocator);
SkASSERT(result->getUniqueKey() == key);
// createWrapped should've added this for us
SkASSERT(fUniquelyKeyedProxies.find(key));
@ -322,7 +314,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::createNonMippedProxyFromBitmap(const SkBi
dims, format, colorType, GrRenderable::kNo, 1, SkBudgeted::kYes, fit,
GrProtected::kNo, mipLevel));
},
format, dims, swizzle, GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo,
format, dims, swizzle, GrRenderable::kNo, 1, GrMipMapped::kNo,
GrMipMapsStatus::kNotAllocated, GrInternalSurfaceFlags::kNone, fit, SkBudgeted::kYes,
GrProtected::kNo, UseAllocator::kYes);
@ -368,9 +360,9 @@ sk_sp<GrTextureProxy> GrProxyProvider::createMippedProxyFromBitmap(const SkBitma
dims, format, colorType, GrRenderable::kNo, 1, SkBudgeted::kYes,
GrProtected::kNo, texels.get(), mipLevelCount));
},
format, dims, readSwizzle, GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin,
GrMipMapped::kYes, GrMipMapsStatus::kValid, GrInternalSurfaceFlags::kNone,
SkBackingFit::kExact, SkBudgeted::kYes, GrProtected::kNo, UseAllocator::kYes);
format, dims, readSwizzle, GrRenderable::kNo, 1, GrMipMapped::kYes,
GrMipMapsStatus::kValid, GrInternalSurfaceFlags::kNone, SkBackingFit::kExact,
SkBudgeted::kYes, GrProtected::kNo, UseAllocator::kYes);
if (!proxy) {
return nullptr;
@ -386,7 +378,6 @@ sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrBackendFormat& format
GrSwizzle readSwizzle,
GrRenderable renderable,
int renderTargetSampleCnt,
GrSurfaceOrigin origin,
GrMipMapped mipMapped,
SkBackingFit fit,
SkBudgeted budgeted,
@ -427,13 +418,13 @@ sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrBackendFormat& format
// We know anything we instantiate later from this deferred path will be
// both texturable and renderable
return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(
*caps, format, dimensions, renderTargetSampleCnt, origin, mipMapped, mipMapsStatus,
*caps, format, dimensions, renderTargetSampleCnt, mipMapped, mipMapsStatus,
readSwizzle, fit, budgeted, isProtected, surfaceFlags, useAllocator));
}
return sk_sp<GrTextureProxy>(new GrTextureProxy(format, dimensions, origin, mipMapped,
mipMapsStatus, readSwizzle, fit, budgeted,
isProtected, surfaceFlags, useAllocator));
return sk_sp<GrTextureProxy>(new GrTextureProxy(format, dimensions, mipMapped, mipMapsStatus,
readSwizzle, fit, budgeted, isProtected,
surfaceFlags, useAllocator));
}
sk_sp<GrTextureProxy> GrProxyProvider::createCompressedTextureProxy(
@ -460,9 +451,9 @@ sk_sp<GrTextureProxy> GrProxyProvider::createCompressedTextureProxy(
return LazyCallbackResult(resourceProvider->createCompressedTexture(
dimensions, format, budgeted, mipMapped, isProtected, data.get()));
},
format, dimensions, GrSwizzle(), GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin,
mipMapped, mipMapsStatus, GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact,
SkBudgeted::kYes, GrProtected::kNo, UseAllocator::kYes);
format, dimensions, GrSwizzle(), GrRenderable::kNo, 1, mipMapped, mipMapsStatus,
GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kYes,
GrProtected::kNo, UseAllocator::kYes);
if (!proxy) {
return nullptr;
@ -482,7 +473,6 @@ sk_sp<GrTextureProxy> GrProxyProvider::createCompressedTextureProxy(
sk_sp<GrTextureProxy> GrProxyProvider::wrapBackendTexture(const GrBackendTexture& backendTex,
GrColorType grColorType,
GrSurfaceOrigin origin,
GrWrapOwnership ownership,
GrWrapCacheable cacheable,
GrIOType ioType,
@ -521,11 +511,10 @@ sk_sp<GrTextureProxy> GrProxyProvider::wrapBackendTexture(const GrBackendTexture
GrSwizzle readSwizzle = caps->getReadSwizzle(tex->backendFormat(), grColorType);
return sk_sp<GrTextureProxy>(
new GrTextureProxy(std::move(tex), origin, readSwizzle, UseAllocator::kNo));
new GrTextureProxy(std::move(tex), readSwizzle, UseAllocator::kNo));
}
sk_sp<GrTextureProxy> GrProxyProvider::wrapCompressedBackendTexture(const GrBackendTexture& beTex,
GrSurfaceOrigin origin,
GrWrapOwnership ownership,
GrWrapCacheable cacheable,
ReleaseProc releaseProc,
@ -563,14 +552,13 @@ sk_sp<GrTextureProxy> GrProxyProvider::wrapCompressedBackendTexture(const GrBack
GrSwizzle texSwizzle = SkCompressionTypeIsOpaque(compressionType) ? GrSwizzle::RGB1()
: GrSwizzle::RGBA();
return sk_sp<GrTextureProxy>(
new GrTextureProxy(std::move(tex), origin, texSwizzle, UseAllocator::kNo));
return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(tex), texSwizzle, UseAllocator::kNo));
}
sk_sp<GrTextureProxy> GrProxyProvider::wrapRenderableBackendTexture(
const GrBackendTexture& backendTex, GrSurfaceOrigin origin, int sampleCnt,
GrColorType colorType, GrWrapOwnership ownership, GrWrapCacheable cacheable,
ReleaseProc releaseProc, ReleaseContext releaseCtx) {
const GrBackendTexture& backendTex, int sampleCnt, GrColorType colorType,
GrWrapOwnership ownership, GrWrapCacheable cacheable, ReleaseProc releaseProc,
ReleaseContext releaseCtx) {
if (this->isAbandoned()) {
return nullptr;
}
@ -610,13 +598,13 @@ sk_sp<GrTextureProxy> GrProxyProvider::wrapRenderableBackendTexture(
GrSwizzle readSwizzle = caps->getReadSwizzle(tex->backendFormat(), colorType);
return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(std::move(tex), origin, readSwizzle,
UseAllocator::kNo));
return sk_sp<GrTextureProxy>(
new GrTextureRenderTargetProxy(std::move(tex), readSwizzle, UseAllocator::kNo));
}
sk_sp<GrSurfaceProxy> GrProxyProvider::wrapBackendRenderTarget(
const GrBackendRenderTarget& backendRT, GrColorType grColorType,
GrSurfaceOrigin origin, ReleaseProc releaseProc, ReleaseContext releaseCtx) {
const GrBackendRenderTarget& backendRT, GrColorType grColorType, ReleaseProc releaseProc,
ReleaseContext releaseCtx) {
if (this->isAbandoned()) {
return nullptr;
}
@ -647,13 +635,12 @@ sk_sp<GrSurfaceProxy> GrProxyProvider::wrapBackendRenderTarget(
GrSwizzle readSwizzle = caps->getReadSwizzle(rt->backendFormat(), grColorType);
return sk_sp<GrRenderTargetProxy>(new GrRenderTargetProxy(std::move(rt), origin, readSwizzle,
UseAllocator::kNo));
return sk_sp<GrRenderTargetProxy>(
new GrRenderTargetProxy(std::move(rt), readSwizzle, UseAllocator::kNo));
}
sk_sp<GrSurfaceProxy> GrProxyProvider::wrapBackendTextureAsRenderTarget(
const GrBackendTexture& backendTex, GrColorType grColorType,
GrSurfaceOrigin origin, int sampleCnt) {
const GrBackendTexture& backendTex, GrColorType grColorType, int sampleCnt) {
if (this->isAbandoned()) {
return nullptr;
}
@ -680,8 +667,8 @@ sk_sp<GrSurfaceProxy> GrProxyProvider::wrapBackendTextureAsRenderTarget(
GrSwizzle readSwizzle = caps->getReadSwizzle(rt->backendFormat(), grColorType);
return sk_sp<GrSurfaceProxy>(new GrRenderTargetProxy(std::move(rt), origin, readSwizzle,
UseAllocator::kNo));
return sk_sp<GrSurfaceProxy>(
new GrRenderTargetProxy(std::move(rt), readSwizzle, UseAllocator::kNo));
}
sk_sp<GrRenderTargetProxy> GrProxyProvider::wrapVulkanSecondaryCBAsRenderTarget(
@ -717,10 +704,9 @@ sk_sp<GrRenderTargetProxy> GrProxyProvider::wrapVulkanSecondaryCBAsRenderTarget(
return nullptr;
}
// All Vulkan surfaces uses top left origins.
return sk_sp<GrRenderTargetProxy>(new GrRenderTargetProxy(
std::move(rt), kTopLeft_GrSurfaceOrigin, readSwizzle, UseAllocator::kNo,
GrRenderTargetProxy::WrapsVkSecondaryCB::kYes));
return sk_sp<GrRenderTargetProxy>(
new GrRenderTargetProxy(std::move(rt), readSwizzle, UseAllocator::kNo,
GrRenderTargetProxy::WrapsVkSecondaryCB::kYes));
}
sk_sp<GrTextureProxy> GrProxyProvider::createLazyProxy(LazyInstantiateCallback&& callback,
@ -729,7 +715,6 @@ sk_sp<GrTextureProxy> GrProxyProvider::createLazyProxy(LazyInstantiateCallback&&
GrSwizzle readSwizzle,
GrRenderable renderable,
int renderTargetSampleCnt,
GrSurfaceOrigin origin,
GrMipMapped mipMapped,
GrMipMapsStatus mipMapsStatus,
GrInternalSurfaceFlags surfaceFlags,
@ -759,7 +744,6 @@ sk_sp<GrTextureProxy> GrProxyProvider::createLazyProxy(LazyInstantiateCallback&&
format,
dimensions,
renderTargetSampleCnt,
origin,
mipMapped,
mipMapsStatus,
readSwizzle,
@ -772,7 +756,6 @@ sk_sp<GrTextureProxy> GrProxyProvider::createLazyProxy(LazyInstantiateCallback&&
return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(callback),
format,
dimensions,
origin,
mipMapped,
mipMapsStatus,
readSwizzle,
@ -790,7 +773,6 @@ sk_sp<GrRenderTargetProxy> GrProxyProvider::createLazyRenderTargetProxy(
SkISize dimensions,
GrSwizzle readSwizzle,
int sampleCnt,
GrSurfaceOrigin origin,
GrInternalSurfaceFlags surfaceFlags,
const TextureInfo* textureInfo,
GrMipMapsStatus mipMapsStatus,
@ -816,7 +798,7 @@ sk_sp<GrRenderTargetProxy> GrProxyProvider::createLazyRenderTargetProxy(
// actual VkImage to texture from.
SkASSERT(!wrapsVkSecondaryCB);
return sk_sp<GrRenderTargetProxy>(new GrTextureRenderTargetProxy(
*this->caps(), std::move(callback), format, dimensions, sampleCnt, origin,
*this->caps(), std::move(callback), format, dimensions, sampleCnt,
textureInfo->fMipMapped, mipMapsStatus, readSwizzle, fit, budgeted, isProtected,
surfaceFlags, useAllocator));
}
@ -825,9 +807,9 @@ sk_sp<GrRenderTargetProxy> GrProxyProvider::createLazyRenderTargetProxy(
wrapsVkSecondaryCB ? GrRenderTargetProxy::WrapsVkSecondaryCB::kYes
: GrRenderTargetProxy::WrapsVkSecondaryCB::kNo;
return sk_sp<GrRenderTargetProxy>(new GrRenderTargetProxy(
std::move(callback), format, dimensions, sampleCnt, origin, readSwizzle, fit, budgeted,
isProtected, surfaceFlags, useAllocator, vkSCB));
return sk_sp<GrRenderTargetProxy>(
new GrRenderTargetProxy(std::move(callback), format, dimensions, sampleCnt, readSwizzle,
fit, budgeted, isProtected, surfaceFlags, useAllocator, vkSCB));
}
sk_sp<GrTextureProxy> GrProxyProvider::MakeFullyLazyProxy(LazyInstantiateCallback&& callback,
@ -836,7 +818,6 @@ sk_sp<GrTextureProxy> GrProxyProvider::MakeFullyLazyProxy(LazyInstantiateCallbac
GrRenderable renderable,
int renderTargetSampleCnt,
GrProtected isProtected,
GrSurfaceOrigin origin,
const GrCaps& caps,
UseAllocator useAllocator) {
if (!format.isValid()) {
@ -849,12 +830,12 @@ sk_sp<GrTextureProxy> GrProxyProvider::MakeFullyLazyProxy(LazyInstantiateCallbac
static constexpr SkISize kLazyDims = {-1, -1};
if (GrRenderable::kYes == renderable) {
return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(
caps, std::move(callback), format, kLazyDims, renderTargetSampleCnt, origin,
caps, std::move(callback), format, kLazyDims, renderTargetSampleCnt,
GrMipMapped::kNo, GrMipMapsStatus::kNotAllocated, readSwizzle,
SkBackingFit::kApprox, SkBudgeted::kYes, isProtected, surfaceFlags, useAllocator));
} else {
return sk_sp<GrTextureProxy>(new GrTextureProxy(
std::move(callback), format, kLazyDims, origin, GrMipMapped::kNo,
std::move(callback), format, kLazyDims, GrMipMapped::kNo,
GrMipMapsStatus::kNotAllocated, readSwizzle, SkBackingFit::kApprox,
SkBudgeted::kYes, isProtected, surfaceFlags, useAllocator));
}

View File

@ -50,7 +50,7 @@ public:
/*
* Finds a proxy by unique key.
*/
sk_sp<GrTextureProxy> findProxyByUniqueKey(const GrUniqueKey&, GrSurfaceOrigin);
sk_sp<GrTextureProxy> findProxyByUniqueKey(const GrUniqueKey&);
/*
* Finds a proxy by unique key or creates a new one that wraps a resource matching the unique
@ -60,7 +60,6 @@ public:
*/
sk_sp<GrTextureProxy> findOrCreateProxyByUniqueKey(const GrUniqueKey&,
GrColorType colorType,
GrSurfaceOrigin,
UseAllocator = UseAllocator::kYes);
/*
@ -78,7 +77,6 @@ public:
GrSwizzle readSwizzle,
GrRenderable,
int renderTargetSampleCnt,
GrSurfaceOrigin,
GrMipMapped,
SkBackingFit,
SkBudgeted,
@ -104,29 +102,26 @@ public:
* Create a texture proxy that wraps a (non-renderable) backend texture. GrIOType must be
* kRead or kRW.
*/
sk_sp<GrTextureProxy> wrapBackendTexture(const GrBackendTexture&, GrColorType, GrSurfaceOrigin,
GrWrapOwnership, GrWrapCacheable, GrIOType,
ReleaseProc = nullptr, ReleaseContext = nullptr);
sk_sp<GrTextureProxy> wrapBackendTexture(const GrBackendTexture&, GrColorType, GrWrapOwnership,
GrWrapCacheable, GrIOType, ReleaseProc = nullptr,
ReleaseContext = nullptr);
sk_sp<GrTextureProxy> wrapCompressedBackendTexture(const GrBackendTexture&, GrSurfaceOrigin,
GrWrapOwnership, GrWrapCacheable,
ReleaseProc = nullptr,
sk_sp<GrTextureProxy> wrapCompressedBackendTexture(const GrBackendTexture&, GrWrapOwnership,
GrWrapCacheable, ReleaseProc = nullptr,
ReleaseContext = nullptr);
/*
* Create a texture proxy that wraps a backend texture and is both texture-able and renderable
*/
sk_sp<GrTextureProxy> wrapRenderableBackendTexture(const GrBackendTexture&, GrSurfaceOrigin,
int sampleCnt, GrColorType,
GrWrapOwnership, GrWrapCacheable,
ReleaseProc = nullptr,
sk_sp<GrTextureProxy> wrapRenderableBackendTexture(const GrBackendTexture&, int sampleCnt,
GrColorType, GrWrapOwnership,
GrWrapCacheable, ReleaseProc = nullptr,
ReleaseContext = nullptr);
/*
* Create a render target proxy that wraps a backend render target
*/
sk_sp<GrSurfaceProxy> wrapBackendRenderTarget(const GrBackendRenderTarget&, GrColorType,
GrSurfaceOrigin,
ReleaseProc = nullptr, ReleaseContext = nullptr);
/*
@ -134,7 +129,6 @@ public:
*/
sk_sp<GrSurfaceProxy> wrapBackendTextureAsRenderTarget(const GrBackendTexture&,
GrColorType,
GrSurfaceOrigin,
int sampleCnt);
sk_sp<GrRenderTargetProxy> wrapVulkanSecondaryCBAsRenderTarget(const SkImageInfo&,
@ -165,7 +159,6 @@ public:
GrSwizzle readSwizzle,
GrRenderable,
int renderTargetSampleCnt,
GrSurfaceOrigin,
GrMipMapped,
GrMipMapsStatus,
GrInternalSurfaceFlags,
@ -180,7 +173,6 @@ public:
SkISize dimensions,
GrSwizzle readSwizzle,
int renderTargetSampleCnt,
GrSurfaceOrigin origin,
GrInternalSurfaceFlags,
const TextureInfo*,
GrMipMapsStatus,
@ -200,7 +192,6 @@ public:
GrRenderable,
int renderTargetSampleCnt,
GrProtected,
GrSurfaceOrigin,
const GrCaps&,
UseAllocator);
@ -251,7 +242,6 @@ public:
const GrBackendFormat& format,
GrRenderable renderable,
int renderTargetSampleCnt,
GrSurfaceOrigin origin,
SkBackingFit fit,
SkBudgeted budgeted,
GrProtected isProtected);
@ -261,12 +251,11 @@ public:
GrColorType colorType,
GrRenderable renderable,
int renderTargetSampleCnt,
GrSurfaceOrigin origin,
SkBackingFit fit,
SkBudgeted budgeted,
GrProtected isProtected);
sk_sp<GrTextureProxy> testingOnly_createWrapped(sk_sp<GrTexture>, GrColorType, GrSurfaceOrigin);
sk_sp<GrTextureProxy> testingOnly_createWrapped(sk_sp<GrTexture>, GrColorType);
#endif
private:
@ -290,7 +279,7 @@ private:
GrColorType colorType);
// GrColorType is used to determine the proxy's texture swizzle.
sk_sp<GrTextureProxy> createWrapped(sk_sp<GrTexture> tex, GrColorType, GrSurfaceOrigin origin,
sk_sp<GrTextureProxy> createWrapped(sk_sp<GrTexture> tex, GrColorType,
UseAllocator useAllocator);
struct UniquelyKeyedProxyHashTraits {

View File

@ -184,8 +184,8 @@ std::unique_ptr<GrRenderTargetContext> GrRenderTargetContext::Make(
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(format, colorType);
sk_sp<GrTextureProxy> proxy = context->priv().proxyProvider()->createProxy(
format, dimensions, swizzle, GrRenderable::kYes, sampleCnt, origin, mipMapped, fit,
budgeted, isProtected);
format, dimensions, swizzle, GrRenderable::kYes, sampleCnt, mipMapped, fit, budgeted,
isProtected);
if (!proxy) {
return nullptr;
}
@ -276,8 +276,8 @@ std::unique_ptr<GrRenderTargetContext> GrRenderTargetContext::MakeFromBackendTex
ReleaseContext releaseCtx) {
SkASSERT(sampleCnt > 0);
sk_sp<GrTextureProxy> proxy(context->priv().proxyProvider()->wrapRenderableBackendTexture(
tex, origin, sampleCnt, colorType, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo,
releaseProc, releaseCtx));
tex, sampleCnt, colorType, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo, releaseProc,
releaseCtx));
if (!proxy) {
return nullptr;
}
@ -296,7 +296,7 @@ std::unique_ptr<GrRenderTargetContext> GrRenderTargetContext::MakeFromBackendTex
const SkSurfaceProps* surfaceProps) {
SkASSERT(sampleCnt > 0);
sk_sp<GrSurfaceProxy> proxy(context->priv().proxyProvider()->wrapBackendTextureAsRenderTarget(
tex, colorType, origin, sampleCnt));
tex, colorType, sampleCnt));
if (!proxy) {
return nullptr;
}
@ -315,7 +315,7 @@ std::unique_ptr<GrRenderTargetContext> GrRenderTargetContext::MakeFromBackendRen
ReleaseProc releaseProc,
ReleaseContext releaseCtx) {
sk_sp<GrSurfaceProxy> proxy(context->priv().proxyProvider()->wrapBackendRenderTarget(
rt, colorType, origin, releaseProc, releaseCtx));
rt, colorType, releaseProc, releaseCtx));
if (!proxy) {
return nullptr;
}

View File

@ -25,14 +25,13 @@ GrRenderTargetProxy::GrRenderTargetProxy(const GrCaps& caps,
const GrBackendFormat& format,
SkISize dimensions,
int sampleCount,
GrSurfaceOrigin origin,
const GrSwizzle& textureSwizzle,
SkBackingFit fit,
SkBudgeted budgeted,
GrProtected isProtected,
GrInternalSurfaceFlags surfaceFlags,
UseAllocator useAllocator)
: INHERITED(format, dimensions, GrRenderable::kYes, origin, textureSwizzle, fit, budgeted,
: INHERITED(format, dimensions, GrRenderable::kYes, textureSwizzle, fit, budgeted,
isProtected, surfaceFlags, useAllocator)
, fSampleCnt(sampleCount)
, fWrapsVkSecondaryCB(WrapsVkSecondaryCB::kNo) {}
@ -42,7 +41,6 @@ GrRenderTargetProxy::GrRenderTargetProxy(LazyInstantiateCallback&& callback,
const GrBackendFormat& format,
SkISize dimensions,
int sampleCount,
GrSurfaceOrigin origin,
const GrSwizzle& textureSwizzle,
SkBackingFit fit,
SkBudgeted budgeted,
@ -50,18 +48,17 @@ GrRenderTargetProxy::GrRenderTargetProxy(LazyInstantiateCallback&& callback,
GrInternalSurfaceFlags surfaceFlags,
UseAllocator useAllocator,
WrapsVkSecondaryCB wrapsVkSecondaryCB)
: INHERITED(std::move(callback), format, dimensions, GrRenderable::kYes, origin,
textureSwizzle, fit, budgeted, isProtected, surfaceFlags, useAllocator)
: INHERITED(std::move(callback), format, dimensions, GrRenderable::kYes, textureSwizzle,
fit, budgeted, isProtected, surfaceFlags, useAllocator)
, fSampleCnt(sampleCount)
, fWrapsVkSecondaryCB(wrapsVkSecondaryCB) {}
// Wrapped version
GrRenderTargetProxy::GrRenderTargetProxy(sk_sp<GrSurface> surf,
GrSurfaceOrigin origin,
const GrSwizzle& textureSwizzle,
UseAllocator useAllocator,
WrapsVkSecondaryCB wrapsVkSecondaryCB)
: INHERITED(std::move(surf), origin, textureSwizzle, SkBackingFit::kExact, useAllocator)
: INHERITED(std::move(surf), textureSwizzle, SkBackingFit::kExact, useAllocator)
, fSampleCnt(fTarget->asRenderTarget()->numSamples())
, fWrapsVkSecondaryCB(wrapsVkSecondaryCB) {
// The kRequiresManualMSAAResolve flag better not be set if we are not multisampled or if

View File

@ -95,7 +95,6 @@ protected:
const GrBackendFormat&,
SkISize,
int sampleCount,
GrSurfaceOrigin,
const GrSwizzle& textureSwizzle,
SkBackingFit,
SkBudgeted,
@ -119,7 +118,6 @@ protected:
const GrBackendFormat&,
SkISize,
int sampleCount,
GrSurfaceOrigin,
const GrSwizzle& textureSwizzle,
SkBackingFit,
SkBudgeted,
@ -130,7 +128,6 @@ protected:
// Wrapped version
GrRenderTargetProxy(sk_sp<GrSurface>,
GrSurfaceOrigin,
const GrSwizzle& textureSwizzle,
UseAllocator,
WrapsVkSecondaryCB = WrapsVkSecondaryCB::kNo);

View File

@ -181,9 +181,9 @@ static GrSurfaceProxyView make_deferred_mask_texture_view(GrRecordingContext* co
GrSwizzle swizzle = caps->getReadSwizzle(format, GrColorType::kAlpha_8);
auto proxy = proxyProvider->createProxy(format, dimensions, swizzle, GrRenderable::kNo, 1,
kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo, fit,
SkBudgeted::kYes, GrProtected::kNo);
auto proxy =
proxyProvider->createProxy(format, dimensions, swizzle, GrRenderable::kNo, 1,
GrMipMapped::kNo, fit, SkBudgeted::kYes, GrProtected::kNo);
return {std::move(proxy), kTopLeft_GrSurfaceOrigin, swizzle};
}
@ -323,8 +323,7 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
sk_sp<GrTextureProxy> proxy;
GrSurfaceProxyView view;
if (useCache) {
auto proxy = fProxyProvider->findOrCreateProxyByUniqueKey(maskKey, GrColorType::kAlpha_8,
kTopLeft_GrSurfaceOrigin);
auto proxy = fProxyProvider->findOrCreateProxyByUniqueKey(maskKey, GrColorType::kAlpha_8);
if (proxy) {
GrSwizzle swizzle = args.fRenderTargetContext->caps()->getReadSwizzle(
proxy->backendFormat(), GrColorType::kAlpha_8);

View File

@ -77,7 +77,7 @@ std::unique_ptr<GrSurfaceContext> GrSurfaceContext::Make(GrRecordingContext* con
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(format, colorType);
sk_sp<GrTextureProxy> proxy = context->priv().proxyProvider()->createProxy(
format, dimensions, swizzle, renderable, renderTargetSampleCnt, origin, mipMapped, fit,
format, dimensions, swizzle, renderable, renderTargetSampleCnt, mipMapped, fit,
budgeted, isProtected);
if (!proxy) {
return nullptr;
@ -380,7 +380,7 @@ bool GrSurfaceContext::writePixels(const GrImageInfo& origSrcInfo, const void* s
GrSurfaceOrigin tempOrigin =
this->asRenderTargetContext() ? kTopLeft_GrSurfaceOrigin : this->origin();
auto tempProxy = direct->priv().proxyProvider()->createProxy(
format, srcInfo.dimensions(), tempReadSwizzle, GrRenderable::kNo, 1, tempOrigin,
format, srcInfo.dimensions(), tempReadSwizzle, GrRenderable::kNo, 1,
GrMipMapped::kNo, SkBackingFit::kApprox, SkBudgeted::kYes, GrProtected::kNo);
if (!tempProxy) {
return false;

View File

@ -47,7 +47,6 @@ static bool is_valid_non_lazy(SkISize dimensions) {
GrSurfaceProxy::GrSurfaceProxy(const GrBackendFormat& format,
SkISize dimensions,
GrRenderable renderable,
GrSurfaceOrigin origin,
const GrSwizzle& textureSwizzle,
SkBackingFit fit,
SkBudgeted budgeted,
@ -57,7 +56,6 @@ GrSurfaceProxy::GrSurfaceProxy(const GrBackendFormat& format,
: fSurfaceFlags(surfaceFlags)
, fFormat(format)
, fDimensions(dimensions)
, fOrigin(origin)
, fTextureSwizzle(textureSwizzle)
, fFit(fit)
, fBudgeted(budgeted)
@ -73,7 +71,6 @@ GrSurfaceProxy::GrSurfaceProxy(LazyInstantiateCallback&& callback,
const GrBackendFormat& format,
SkISize dimensions,
GrRenderable renderable,
GrSurfaceOrigin origin,
const GrSwizzle& textureSwizzle,
SkBackingFit fit,
SkBudgeted budgeted,
@ -83,7 +80,6 @@ GrSurfaceProxy::GrSurfaceProxy(LazyInstantiateCallback&& callback,
: fSurfaceFlags(surfaceFlags)
, fFormat(format)
, fDimensions(dimensions)
, fOrigin(origin)
, fTextureSwizzle(textureSwizzle)
, fFit(fit)
, fBudgeted(budgeted)
@ -98,7 +94,6 @@ GrSurfaceProxy::GrSurfaceProxy(LazyInstantiateCallback&& callback,
// Wrapped version
GrSurfaceProxy::GrSurfaceProxy(sk_sp<GrSurface> surface,
GrSurfaceOrigin origin,
const GrSwizzle& textureSwizzle,
SkBackingFit fit,
UseAllocator useAllocator)
@ -106,7 +101,6 @@ GrSurfaceProxy::GrSurfaceProxy(sk_sp<GrSurface> surface,
, fSurfaceFlags(fTarget->surfacePriv().flags())
, fFormat(fTarget->backendFormat())
, fDimensions(fTarget->dimensions())
, fOrigin(origin)
, fTextureSwizzle(textureSwizzle)
, fFit(fit)
, fBudgeted(fTarget->resourcePriv().budgetedType() == GrBudgetedType::kBudgeted

View File

@ -326,7 +326,6 @@ protected:
GrSurfaceProxy(const GrBackendFormat&,
SkISize,
GrRenderable,
GrSurfaceOrigin,
const GrSwizzle& textureSwizzle,
SkBackingFit,
SkBudgeted,
@ -338,7 +337,6 @@ protected:
const GrBackendFormat&,
SkISize,
GrRenderable,
GrSurfaceOrigin,
const GrSwizzle& textureSwizzle,
SkBackingFit,
SkBudgeted,
@ -351,7 +349,6 @@ protected:
// in allocation by having its backing resource recycled to other uninstantiated proxies or
// not depending on UseAllocator.
GrSurfaceProxy(sk_sp<GrSurface>,
GrSurfaceOrigin,
const GrSwizzle& textureSwizzle,
SkBackingFit,
UseAllocator);
@ -396,11 +393,10 @@ protected:
GrInternalSurfaceFlags fSurfaceFlags;
private:
// For wrapped resources, 'fFormat', 'fWidth', 'fHeight', and 'fOrigin; will always
// be filled in from the wrapped resource.
// For wrapped resources, 'fFormat', 'fWidth', and 'fHeight'; will always be filled in from the
// wrapped resource.
const GrBackendFormat fFormat;
SkISize fDimensions;
const GrSurfaceOrigin fOrigin;
const GrSwizzle fTextureSwizzle;
SkBackingFit fFit; // always kApprox for lazy-callback resources

View File

@ -42,8 +42,7 @@ GrSurfaceProxyView GrTextureAdjuster::copy(const CopyParams& copyParams, bool wi
sk_sp<GrTextureProxy> cachedCopy;
const GrSurfaceProxyView& originalView = this->originalProxyView();
if (key.isValid()) {
cachedCopy = proxyProvider->findOrCreateProxyByUniqueKey(key, this->colorType(),
originalView.origin());
cachedCopy = proxyProvider->findOrCreateProxyByUniqueKey(key, this->colorType());
if (cachedCopy && (!willBeMipped || GrMipMapped::kYes == cachedCopy->mipMapped())) {
// TODO: Once we no longer use CopyOnGpu which can fallback to arbitrary formats and
// colorTypes, we can use the swizzle of the originalView.

View File

@ -56,8 +56,7 @@ GrSurfaceProxyView GrTextureMaker::onRefTextureProxyViewForParams(GrSamplerState
this->makeCopyKey(copyParams, &copyKey);
GrSurfaceProxyView cachedView;
if (copyKey.isValid()) {
auto cachedProxy =
proxyProvider->findOrCreateProxyByUniqueKey(copyKey, this->colorType(), origOrigin);
auto cachedProxy = proxyProvider->findOrCreateProxyByUniqueKey(copyKey, this->colorType());
if (cachedProxy) {
GrMipMapped mipped = cachedProxy->mipMapped();
// TODO: Once we no longer use CopyOnGpu which can fallback to arbitrary formats and

View File

@ -18,7 +18,6 @@
// Deferred version - no data
GrTextureProxy::GrTextureProxy(const GrBackendFormat& format,
SkISize dimensions,
GrSurfaceOrigin origin,
GrMipMapped mipMapped,
GrMipMapsStatus mipMapsStatus,
const GrSwizzle& textureSwizzle,
@ -27,7 +26,7 @@ GrTextureProxy::GrTextureProxy(const GrBackendFormat& format,
GrProtected isProtected,
GrInternalSurfaceFlags surfaceFlags,
UseAllocator useAllocator)
: INHERITED(format, dimensions, GrRenderable::kNo, origin, textureSwizzle, fit, budgeted,
: INHERITED(format, dimensions, GrRenderable::kNo, textureSwizzle, fit, budgeted,
isProtected, surfaceFlags, useAllocator)
, fMipMapped(mipMapped)
, fMipMapsStatus(mipMapsStatus) SkDEBUGCODE(, fInitialMipMapsStatus(fMipMapsStatus))
@ -40,7 +39,6 @@ GrTextureProxy::GrTextureProxy(const GrBackendFormat& format,
GrTextureProxy::GrTextureProxy(LazyInstantiateCallback&& callback,
const GrBackendFormat& format,
SkISize dimensions,
GrSurfaceOrigin origin,
GrMipMapped mipMapped,
GrMipMapsStatus mipMapsStatus,
const GrSwizzle& texSwizzle,
@ -49,8 +47,8 @@ GrTextureProxy::GrTextureProxy(LazyInstantiateCallback&& callback,
GrProtected isProtected,
GrInternalSurfaceFlags surfaceFlags,
UseAllocator useAllocator)
: INHERITED(std::move(callback), format, dimensions, GrRenderable::kNo, origin, texSwizzle,
fit, budgeted, isProtected, surfaceFlags, useAllocator)
: INHERITED(std::move(callback), format, dimensions, GrRenderable::kNo, texSwizzle, fit,
budgeted, isProtected, surfaceFlags, useAllocator)
, fMipMapped(mipMapped)
, fMipMapsStatus(mipMapsStatus) SkDEBUGCODE(, fInitialMipMapsStatus(fMipMapsStatus))
, fProxyProvider(nullptr)
@ -60,10 +58,9 @@ GrTextureProxy::GrTextureProxy(LazyInstantiateCallback&& callback,
// Wrapped version
GrTextureProxy::GrTextureProxy(sk_sp<GrSurface> surf,
GrSurfaceOrigin origin,
const GrSwizzle& textureSwizzle,
UseAllocator useAllocator)
: INHERITED(std::move(surf), origin, textureSwizzle, SkBackingFit::kExact, useAllocator)
: INHERITED(std::move(surf), textureSwizzle, SkBackingFit::kExact, useAllocator)
, fMipMapped(fTarget->asTexture()->texturePriv().mipMapped())
, fMipMapsStatus(fTarget->asTexture()->texturePriv().mipMapsStatus())
SkDEBUGCODE(, fInitialMipMapsStatus(fMipMapsStatus))

View File

@ -110,7 +110,6 @@ protected:
// Deferred version - no data.
GrTextureProxy(const GrBackendFormat&,
SkISize,
GrSurfaceOrigin,
GrMipMapped,
GrMipMapsStatus,
const GrSwizzle& textureSwizzle,
@ -133,7 +132,6 @@ protected:
GrTextureProxy(LazyInstantiateCallback&&,
const GrBackendFormat&,
SkISize,
GrSurfaceOrigin,
GrMipMapped,
GrMipMapsStatus,
const GrSwizzle& textureSwizzle,
@ -144,7 +142,7 @@ protected:
UseAllocator);
// Wrapped version
GrTextureProxy(sk_sp<GrSurface>, GrSurfaceOrigin, const GrSwizzle&, UseAllocator);
GrTextureProxy(sk_sp<GrSurface>, const GrSwizzle&, UseAllocator);
~GrTextureProxy() override;

View File

@ -24,7 +24,6 @@ GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(const GrCaps& caps,
const GrBackendFormat& format,
SkISize dimensions,
int sampleCnt,
GrSurfaceOrigin origin,
GrMipMapped mipMapped,
GrMipMapsStatus mipMapsStatus,
const GrSwizzle& texSwizzle,
@ -33,13 +32,13 @@ GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(const GrCaps& caps,
GrProtected isProtected,
GrInternalSurfaceFlags surfaceFlags,
UseAllocator useAllocator)
: GrSurfaceProxy(format, dimensions, GrRenderable::kYes, origin, texSwizzle, fit, budgeted,
: GrSurfaceProxy(format, dimensions, GrRenderable::kYes, texSwizzle, fit, budgeted,
isProtected, surfaceFlags, useAllocator)
// for now textures w/ data are always wrapped
, GrRenderTargetProxy(caps, format, dimensions, sampleCnt, origin, texSwizzle, fit,
budgeted, isProtected, surfaceFlags, useAllocator)
, GrTextureProxy(format, dimensions, origin, mipMapped, mipMapsStatus, texSwizzle, fit,
budgeted, isProtected, surfaceFlags, useAllocator) {
, GrRenderTargetProxy(caps, format, dimensions, sampleCnt, texSwizzle, fit, budgeted,
isProtected, surfaceFlags, useAllocator)
, GrTextureProxy(format, dimensions, mipMapped, mipMapsStatus, texSwizzle, fit, budgeted,
isProtected, surfaceFlags, useAllocator) {
this->initSurfaceFlags(caps);
}
@ -49,7 +48,6 @@ GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(const GrCaps& caps,
const GrBackendFormat& format,
SkISize dimensions,
int sampleCnt,
GrSurfaceOrigin origin,
GrMipMapped mipMapped,
GrMipMapsStatus mipMapsStatus,
const GrSwizzle& texSwizzle,
@ -58,16 +56,15 @@ GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(const GrCaps& caps,
GrProtected isProtected,
GrInternalSurfaceFlags surfaceFlags,
UseAllocator useAllocator)
: GrSurfaceProxy(std::move(callback), format, dimensions, GrRenderable::kYes, origin,
texSwizzle, fit, budgeted, isProtected, surfaceFlags, useAllocator)
: GrSurfaceProxy(std::move(callback), format, dimensions, GrRenderable::kYes, texSwizzle,
fit, budgeted, isProtected, surfaceFlags, useAllocator)
// Since we have virtual inheritance, we initialize GrSurfaceProxy directly. Send null
// callbacks to the texture and RT proxies simply to route to the appropriate constructors.
, GrRenderTargetProxy(LazyInstantiateCallback(), format, dimensions, sampleCnt, origin,
texSwizzle, fit, budgeted, isProtected, surfaceFlags, useAllocator,
, GrRenderTargetProxy(LazyInstantiateCallback(), format, dimensions, sampleCnt, texSwizzle,
fit, budgeted, isProtected, surfaceFlags, useAllocator,
WrapsVkSecondaryCB::kNo)
, GrTextureProxy(LazyInstantiateCallback(), format, dimensions, origin, mipMapped,
mipMapsStatus, texSwizzle, fit, budgeted, isProtected, surfaceFlags,
useAllocator) {
, GrTextureProxy(LazyInstantiateCallback(), format, dimensions, mipMapped, mipMapsStatus,
texSwizzle, fit, budgeted, isProtected, surfaceFlags, useAllocator) {
this->initSurfaceFlags(caps);
}
@ -75,12 +72,11 @@ GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(const GrCaps& caps,
// This class is virtually derived from GrSurfaceProxy (via both GrTextureProxy and
// GrRenderTargetProxy) so its constructor must be explicitly called.
GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(sk_sp<GrSurface> surf,
GrSurfaceOrigin origin,
const GrSwizzle& texSwizzle,
UseAllocator useAllocator)
: GrSurfaceProxy(surf, origin, texSwizzle, SkBackingFit::kExact, useAllocator)
, GrRenderTargetProxy(surf, origin, texSwizzle, useAllocator)
, GrTextureProxy(surf, origin, texSwizzle, useAllocator) {
: GrSurfaceProxy(surf, texSwizzle, SkBackingFit::kExact, useAllocator)
, GrRenderTargetProxy(surf, texSwizzle, useAllocator)
, GrTextureProxy(surf, texSwizzle, useAllocator) {
SkASSERT(surf->asTexture());
SkASSERT(surf->asRenderTarget());
SkASSERT(fSurfaceFlags == fTarget->surfacePriv().flags());

View File

@ -32,7 +32,6 @@ private:
const GrBackendFormat&,
SkISize,
int sampleCnt,
GrSurfaceOrigin,
GrMipMapped,
GrMipMapsStatus,
const GrSwizzle& textureSwizzle,
@ -48,7 +47,6 @@ private:
const GrBackendFormat&,
SkISize,
int sampleCnt,
GrSurfaceOrigin,
GrMipMapped,
GrMipMapsStatus,
const GrSwizzle& textureSwizzle,
@ -60,7 +58,6 @@ private:
// Wrapped version
GrTextureRenderTargetProxy(sk_sp<GrSurface>,
GrSurfaceOrigin,
const GrSwizzle& textureSwizzle,
UseAllocator);

View File

@ -233,7 +233,7 @@ GrCCPathCache::OnFlushEntryRef GrCCPathCache::find(
if (!entry->fCachedAtlas->getOnFlushProxy()) {
auto ct = GrCCAtlas::CoverageTypeToColorType(entry->fCachedAtlas->coverageType());
if (sk_sp<GrTextureProxy> onFlushProxy = onFlushRP->findOrCreateProxyByUniqueKey(
entry->fCachedAtlas->textureKey(), ct, GrCCAtlas::kTextureOrigin,
entry->fCachedAtlas->textureKey(), ct,
GrSurfaceProxy::UseAllocator::kNo)) {
entry->fCachedAtlas->setOnFlushProxy(std::move(onFlushProxy));
}

View File

@ -232,7 +232,7 @@ uniform half4 circleData;
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
if (sk_sp<GrTextureProxy> blurProfile = proxyProvider->findOrCreateProxyByUniqueKey(
key, GrColorType::kAlpha_8, kTopLeft_GrSurfaceOrigin)) {
key, GrColorType::kAlpha_8)) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(blurProfile->backendFormat(),
GrColorType::kAlpha_8);
return {std::move(blurProfile), kTopLeft_GrSurfaceOrigin, swizzle};

View File

@ -50,7 +50,7 @@ uniform half blurRadius;
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
if (sk_sp<GrTextureProxy> mask = proxyProvider->findOrCreateProxyByUniqueKey(
key, GrColorType::kAlpha_8, kBottomLeft_GrSurfaceOrigin)) {
key, GrColorType::kAlpha_8)) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(mask->backendFormat(),
GrColorType::kAlpha_8);
return {std::move(mask), kBottomLeft_GrSurfaceOrigin, swizzle};

View File

@ -63,7 +63,7 @@ static GrSurfaceProxyView CreateIntegralTexture(GrRecordingContext* context, flo
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
if (sk_sp<GrTextureProxy> proxy = proxyProvider->findOrCreateProxyByUniqueKey(
key, GrColorType::kAlpha_8, kTopLeft_GrSurfaceOrigin)) {
key, GrColorType::kAlpha_8)) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(proxy->backendFormat(),
GrColorType::kAlpha_8);
return {std::move(proxy), kTopLeft_GrSurfaceOrigin, swizzle};

View File

@ -208,8 +208,8 @@ static GrSurfaceProxyView create_profile_texture(GrRecordingContext* context, co
builder.finish();
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
if (sk_sp<GrTextureProxy> blurProfile = proxyProvider->findOrCreateProxyByUniqueKey(
key, GrColorType::kAlpha_8, kTopLeft_GrSurfaceOrigin)) {
if (sk_sp<GrTextureProxy> blurProfile =
proxyProvider->findOrCreateProxyByUniqueKey(key, GrColorType::kAlpha_8)) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(blurProfile->backendFormat(),
GrColorType::kAlpha_8);
return {std::move(blurProfile), kTopLeft_GrSurfaceOrigin, swizzle};

View File

@ -51,8 +51,8 @@ public:
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
if (sk_sp<GrTextureProxy> mask = proxyProvider->findOrCreateProxyByUniqueKey(
key, GrColorType::kAlpha_8, kBottomLeft_GrSurfaceOrigin)) {
if (sk_sp<GrTextureProxy> mask =
proxyProvider->findOrCreateProxyByUniqueKey(key, GrColorType::kAlpha_8)) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(mask->backendFormat(),
GrColorType::kAlpha_8);
return {std::move(mask), kBottomLeft_GrSurfaceOrigin, swizzle};

View File

@ -45,8 +45,8 @@ public:
builder.finish();
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
if (sk_sp<GrTextureProxy> proxy = proxyProvider->findOrCreateProxyByUniqueKey(
key, GrColorType::kAlpha_8, kTopLeft_GrSurfaceOrigin)) {
if (sk_sp<GrTextureProxy> proxy =
proxyProvider->findOrCreateProxyByUniqueKey(key, GrColorType::kAlpha_8)) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(proxy->backendFormat(),
GrColorType::kAlpha_8);
return {std::move(proxy), kTopLeft_GrSurfaceOrigin, swizzle};

View File

@ -417,7 +417,6 @@ GR_DRAW_OP_TEST_DEFINE(NonAALatticeOp) {
swizzle,
GrRenderable::kNo,
1,
origin,
GrMipMapped::kNo,
SkBackingFit::kExact,
SkBudgeted::kYes,

View File

@ -646,8 +646,8 @@ static GrSurfaceProxyView create_falloff_texture(GrRecordingContext* context) {
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
if (sk_sp<GrTextureProxy> falloffTexture = proxyProvider->findOrCreateProxyByUniqueKey(
key, GrColorType::kAlpha_8, kTopLeft_GrSurfaceOrigin)) {
if (sk_sp<GrTextureProxy> falloffTexture =
proxyProvider->findOrCreateProxyByUniqueKey(key, GrColorType::kAlpha_8)) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(falloffTexture->backendFormat(),
GrColorType::kAlpha_8);
return {std::move(falloffTexture), kTopLeft_GrSurfaceOrigin, swizzle};

View File

@ -1294,7 +1294,7 @@ GR_DRAW_OP_TEST_DEFINE(TextureOp) {
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
format, dims, swizzle, GrRenderable::kNo, 1, origin, mipMapped, fit, SkBudgeted::kNo,
format, dims, swizzle, GrRenderable::kNo, 1, mipMapped, fit, SkBudgeted::kNo,
GrProtected::kNo, GrInternalSurfaceFlags::kNone);
SkRect rect = GrTest::TestRect(random);

View File

@ -131,10 +131,9 @@ static sk_sp<SkImage> new_wrapped_texture_common(GrContext* ctx,
}
GrProxyProvider* proxyProvider = ctx->priv().proxyProvider();
sk_sp<GrTextureProxy> proxy =
proxyProvider->wrapBackendTexture(backendTex, colorType, origin, ownership,
GrWrapCacheable::kNo, kRead_GrIOType,
releaseProc, releaseCtx);
sk_sp<GrTextureProxy> proxy = proxyProvider->wrapBackendTexture(
backendTex, colorType, ownership, GrWrapCacheable::kNo, kRead_GrIOType, releaseProc,
releaseCtx);
if (!proxy) {
return nullptr;
}
@ -163,9 +162,8 @@ sk_sp<SkImage> SkImage::MakeFromCompressedTexture(GrContext* ctx,
}
GrProxyProvider* proxyProvider = ctx->priv().proxyProvider();
sk_sp<GrTextureProxy> proxy =
proxyProvider->wrapCompressedBackendTexture(tex, origin, kBorrow_GrWrapOwnership,
GrWrapCacheable::kNo, releaseP, releaseC);
sk_sp<GrTextureProxy> proxy = proxyProvider->wrapCompressedBackendTexture(
tex, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo, releaseP, releaseC);
if (!proxy) {
return nullptr;
}
@ -496,8 +494,7 @@ sk_sp<SkImage> SkImage_Gpu::MakePromiseTexture(GrContext* context,
}
callDone.clear();
auto proxy = MakePromiseImageLazyProxy(context, width, height, origin,
grColorType, backendFormat,
auto proxy = MakePromiseImageLazyProxy(context, width, height, grColorType, backendFormat,
mipMapped, textureFulfillProc, textureReleaseProc,
textureDoneProc, textureContext, version);
if (!proxy) {
@ -625,9 +622,9 @@ sk_sp<SkImage> SkImage::MakeFromAHardwareBufferWithData(GrContext* context,
}
sk_sp<GrTextureProxy> proxy =
proxyProvider->wrapBackendTexture(backendTexture, grColorType, surfaceOrigin,
kBorrow_GrWrapOwnership, GrWrapCacheable::kNo,
kRW_GrIOType, deleteImageProc, deleteImageCtx);
proxyProvider->wrapBackendTexture(backendTexture, grColorType, kBorrow_GrWrapOwnership,
GrWrapCacheable::kNo, kRW_GrIOType, deleteImageProc,
deleteImageCtx);
if (!proxy) {
deleteImageProc(deleteImageCtx);
return nullptr;

View File

@ -288,7 +288,7 @@ bool SkImage_GpuBase::MakeTempTextureProxies(GrContext* ctx, const GrBackendText
SkASSERT(yuvaTextures[textureIndex].isValid());
auto proxy = proxyProvider->wrapBackendTexture(yuvaTextures[textureIndex], grColorType,
imageOrigin, kBorrow_GrWrapOwnership,
kBorrow_GrWrapOwnership,
GrWrapCacheable::kNo, kRead_GrIOType);
if (!proxy) {
return false;
@ -357,7 +357,7 @@ bool SkImage_GpuBase::RenderYUVAToRGBA(GrContext* ctx, GrRenderTargetContext* re
}
sk_sp<GrTextureProxy> SkImage_GpuBase::MakePromiseImageLazyProxy(
GrContext* context, int width, int height, GrSurfaceOrigin origin, GrColorType colorType,
GrContext* context, int width, int height, GrColorType colorType,
GrBackendFormat backendFormat, GrMipMapped mipMapped,
PromiseImageTextureFulfillProc fulfillProc, PromiseImageTextureReleaseProc releaseProc,
PromiseImageTextureDoneProc doneProc, PromiseImageTextureContext textureContext,
@ -531,9 +531,8 @@ sk_sp<GrTextureProxy> SkImage_GpuBase::MakePromiseImageLazyProxy(
// We pass kReadOnly here since we should treat content of the client's texture as immutable.
// The promise API provides no way for the client to indicated that the texture is protected.
return proxyProvider->createLazyProxy(std::move(callback), backendFormat, {width, height},
readSwizzle, GrRenderable::kNo, 1, origin, mipMapped,
mipMapsStatus, GrInternalSurfaceFlags::kReadOnly,
SkBackingFit::kExact, SkBudgeted::kNo, GrProtected::kNo,
GrSurfaceProxy::UseAllocator::kYes);
return proxyProvider->createLazyProxy(
std::move(callback), backendFormat, {width, height}, readSwizzle, GrRenderable::kNo, 1,
mipMapped, mipMapsStatus, GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact,
SkBudgeted::kNo, GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
}

View File

@ -80,8 +80,8 @@ protected:
// proxy along with the TextureFulfillProc and TextureReleaseProc. PromiseDoneProc must not
// be null.
static sk_sp<GrTextureProxy> MakePromiseImageLazyProxy(
GrContext*, int width, int height, GrSurfaceOrigin, GrColorType, GrBackendFormat,
GrMipMapped, PromiseImageTextureFulfillProc, PromiseImageTextureReleaseProc,
GrContext*, int width, int height, GrColorType, GrBackendFormat, GrMipMapped,
PromiseImageTextureFulfillProc, PromiseImageTextureReleaseProc,
PromiseImageTextureDoneProc, PromiseImageTextureContext, PromiseImageApiVersion);
static bool RenderYUVAToRGBA(GrContext* ctx, GrRenderTargetContext* renderTargetContext,

View File

@ -382,9 +382,9 @@ sk_sp<SkImage> SkImage_GpuYUVA::MakePromiseYUVATexture(
}
auto proxy = MakePromiseImageLazyProxy(
context, yuvaSizes[texIdx].width(), yuvaSizes[texIdx].height(), imageOrigin,
colorType, yuvaFormats[texIdx], GrMipMapped::kNo, textureFulfillProc,
textureReleaseProc, promiseDoneProc, textureContexts[texIdx], version);
context, yuvaSizes[texIdx].width(), yuvaSizes[texIdx].height(), colorType,
yuvaFormats[texIdx], GrMipMapped::kNo, textureFulfillProc, textureReleaseProc,
promiseDoneProc, textureContexts[texIdx], version);
++proxiesCreated;
if (!proxy) {
return nullptr;

View File

@ -455,7 +455,7 @@ GrSurfaceProxyView SkImage_Lazy::lockTextureProxyView(
// 1. Check the cache for a pre-existing one
if (key.isValid()) {
auto proxy = proxyProvider->findOrCreateProxyByUniqueKey(key, ct, kTopLeft_GrSurfaceOrigin);
auto proxy = proxyProvider->findOrCreateProxyByUniqueKey(key, ct);
if (proxy) {
SK_HISTOGRAM_ENUMERATION("LockTexturePath", kPreExisting_LockTexturePath,
kLockTexturePathCount);

View File

@ -79,7 +79,6 @@ sk_sp<SkSurface> SkSurface::MakeFromCAMetalLayer(GrContext* context,
dims,
readSwizzle,
sampleCnt,
origin,
sampleCnt > 1 ? GrInternalSurfaceFlags::kRequiresManualMSAAResolve
: GrInternalSurfaceFlags::kNone,
metalLayer.framebufferOnly ? nullptr : &texInfo,
@ -152,7 +151,6 @@ sk_sp<SkSurface> SkSurface::MakeFromMTKView(GrContext* context,
dims,
readSwizzle,
sampleCnt,
origin,
sampleCnt > 1 ? GrInternalSurfaceFlags::kRequiresManualMSAAResolve
: GrInternalSurfaceFlags::kNone,
mtkView.framebufferOnly ? nullptr : &texInfo,

View File

@ -26,9 +26,8 @@ sk_sp<GrSurfaceProxy> create_proxy(GrContext* context) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(format, GrColorType::kRGBA_8888);
return context->priv().proxyProvider()->createProxy(
format, kDimensions, swizzle, GrRenderable::kYes, 1, kTopLeft_GrSurfaceOrigin,
GrMipMapped::kNo, SkBackingFit::kExact, SkBudgeted::kNo, GrProtected::kNo,
GrInternalSurfaceFlags::kNone);
format, kDimensions, swizzle, GrRenderable::kYes, 1, GrMipMapped::kNo,
SkBackingFit::kExact, SkBudgeted::kNo, GrProtected::kNo, GrInternalSurfaceFlags::kNone);
}
typedef GrQuadAAFlags (*PerQuadAAFunc)(int i);

View File

@ -146,8 +146,7 @@ static sk_sp<GrTextureProxy> create_proxy(GrContext* ctx,
GrSwizzle swizzle = caps->getReadSwizzle(format, GrColorType::kRGBA_8888);
return proxyProvider->createProxy(format, {size, size}, swizzle, GrRenderable::kNo, 1,
kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo, fit,
SkBudgeted::kYes, GrProtected::kNo);
GrMipMapped::kNo, fit, SkBudgeted::kYes, GrProtected::kNo);
}
static RectInfo::EdgeType compute_inset_edgetype(RectInfo::EdgeType previous,

View File

@ -161,8 +161,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(EGLImageTest, reporter, ctxInfo) {
// fails on the Nexus5. Why?
GrSurfaceOrigin origin = kBottomLeft_GrSurfaceOrigin;
sk_sp<GrSurfaceProxy> texProxy = context0->priv().proxyProvider()->wrapBackendTexture(
backendTex, colorType, origin, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo,
kRW_GrIOType);
backendTex, colorType, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo, kRW_GrIOType);
if (!texProxy) {
ERRORF(reporter, "Error wrapping external texture in GrTextureProxy.");
cleanup(glCtx0, externalTexture.fID, glCtx1.get(), context1, &backendTexture1, image);

View File

@ -351,8 +351,7 @@ static std::unique_ptr<GrRenderTargetContext> draw_mipmap_into_new_render_target
SkAlphaType alphaType, GrSurfaceProxyView mipmapView, GrSamplerState::Filter filter) {
sk_sp<GrSurfaceProxy> renderTarget = proxyProvider->createProxy(
mipmapView.proxy()->backendFormat(), {1, 1}, mipmapView.swizzle(), GrRenderable::kYes,
1, mipmapView.origin(), GrMipMapped::kNo, SkBackingFit::kApprox, SkBudgeted::kYes,
GrProtected::kNo);
1, GrMipMapped::kNo, SkBackingFit::kApprox, SkBudgeted::kYes, GrProtected::kNo);
auto rtc = GrRenderTargetContext::Make(
context, colorType, nullptr, std::move(renderTarget), kTopLeft_GrSurfaceOrigin,
@ -397,8 +396,8 @@ DEF_GPUTEST(GrManyDependentsMipMappedTest, reporter, /* options */) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(format, colorType);
sk_sp<GrTextureProxy> mipmapProxy = proxyProvider->createProxy(
format, {4, 4}, swizzle, GrRenderable::kYes, 1, kTopLeft_GrSurfaceOrigin,
GrMipMapped::kYes, SkBackingFit::kExact, SkBudgeted::kYes, GrProtected::kNo);
format, {4, 4}, swizzle, GrRenderable::kYes, 1, GrMipMapped::kYes,
SkBackingFit::kExact, SkBudgeted::kYes, GrProtected::kNo);
// Mark the mipmaps clean to ensure things still work properly when they won't be marked
// dirty again until GrRenderTask::makeClosed().

View File

@ -1004,8 +1004,8 @@ DEF_GPUTEST(PorterDuffNoDualSourceBlending, reporter, options) {
GrXferProcessor::DstProxyView fakeDstProxyView;
{
sk_sp<GrTextureProxy> proxy = proxyProvider->wrapBackendTexture(
backendTex, GrColorType::kRGBA_8888, kTopLeft_GrSurfaceOrigin,
kBorrow_GrWrapOwnership, GrWrapCacheable::kNo, kRead_GrIOType);
backendTex, GrColorType::kRGBA_8888, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo,
kRead_GrIOType);
GrSwizzle swizzle = caps.getReadSwizzle(backendTex.getBackendFormat(),
GrColorType::kRGBA_8888);
fakeDstProxyView.setProxyView({std::move(proxy), kTopLeft_GrSurfaceOrigin, swizzle});

View File

@ -119,73 +119,64 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(GrSurfaceRenderability, reporter, ctxInfo) {
continue;
}
for (GrSurfaceOrigin origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) {
// Check if 'isFormatTexturable' agrees with 'createTexture' and that the mipmap
// support check is working
{
bool isCompressed = caps->isFormatCompressed(combo.fFormat);
bool isTexturable;
if (isCompressed) {
isTexturable = caps->isFormatTexturable(combo.fFormat);
} else {
isTexturable = caps->isFormatTexturableAndUploadable(combo.fColorType,
combo.fFormat);
}
sk_sp<GrSurface> tex = createTexture(kDims, combo.fColorType, combo.fFormat,
GrRenderable::kNo, resourceProvider);
REPORTER_ASSERT(reporter, SkToBool(tex) == isTexturable,
"ct:%s format:%s, tex:%d, isTexturable:%d",
GrColorTypeToStr(combo.fColorType),
combo.fFormat.toStr().c_str(),
SkToBool(tex), isTexturable);
// Check that the lack of mipmap support blocks the creation of mipmapped
// proxies
bool expectedMipMapability = isTexturable && caps->mipMapSupport() &&
!isCompressed;
GrSwizzle swizzle = caps->getReadSwizzle(combo.fFormat, combo.fColorType);
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
combo.fFormat, kDims, swizzle, GrRenderable::kNo, 1, origin,
GrMipMapped::kYes, SkBackingFit::kExact, SkBudgeted::kNo, GrProtected::kNo);
REPORTER_ASSERT(reporter, SkToBool(proxy.get()) == expectedMipMapability,
"ct:%s format:%s, tex:%d, expectedMipMapability:%d",
GrColorTypeToStr(combo.fColorType),
combo.fFormat.toStr().c_str(),
SkToBool(proxy.get()), expectedMipMapability);
// Check if 'isFormatTexturable' agrees with 'createTexture' and that the mipmap
// support check is working
{
bool isCompressed = caps->isFormatCompressed(combo.fFormat);
bool isTexturable;
if (isCompressed) {
isTexturable = caps->isFormatTexturable(combo.fFormat);
} else {
isTexturable =
caps->isFormatTexturableAndUploadable(combo.fColorType, combo.fFormat);
}
// Check if 'isFormatAsColorTypeRenderable' agrees with 'createTexture' (w/o MSAA)
{
bool isRenderable = caps->isFormatRenderable(combo.fFormat, 1);
sk_sp<GrSurface> tex = createTexture(kDims, combo.fColorType, combo.fFormat,
GrRenderable::kNo, resourceProvider);
REPORTER_ASSERT(reporter, SkToBool(tex) == isTexturable,
"ct:%s format:%s, tex:%d, isTexturable:%d",
GrColorTypeToStr(combo.fColorType), combo.fFormat.toStr().c_str(),
SkToBool(tex), isTexturable);
sk_sp<GrSurface> tex = resourceProvider->createTexture(
kDims, combo.fFormat, GrRenderable::kYes, 1, GrMipMapped::kNo,
SkBudgeted::kNo, GrProtected::kNo);
REPORTER_ASSERT(reporter, SkToBool(tex) == isRenderable,
"ct:%s format:%s, tex:%d, isRenderable:%d",
GrColorTypeToStr(combo.fColorType),
combo.fFormat.toStr().c_str(),
SkToBool(tex), isRenderable);
}
// Check that the lack of mipmap support blocks the creation of mipmapped
// proxies
bool expectedMipMapability = isTexturable && caps->mipMapSupport() && !isCompressed;
// Check if 'isFormatAsColorTypeRenderable' agrees with 'createTexture' w/ MSAA
{
bool isRenderable = caps->isFormatRenderable(combo.fFormat, 2);
GrSwizzle swizzle = caps->getReadSwizzle(combo.fFormat, combo.fColorType);
sk_sp<GrSurface> tex = resourceProvider->createTexture(
kDims, combo.fFormat, GrRenderable::kYes, 2, GrMipMapped::kNo,
SkBudgeted::kNo, GrProtected::kNo);
REPORTER_ASSERT(reporter, SkToBool(tex) == isRenderable,
"ct:%s format:%s, tex:%d, isRenderable:%d",
GrColorTypeToStr(combo.fColorType),
combo.fFormat.toStr().c_str(),
SkToBool(tex), isRenderable);
}
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
combo.fFormat, kDims, swizzle, GrRenderable::kNo, 1, GrMipMapped::kYes,
SkBackingFit::kExact, SkBudgeted::kNo, GrProtected::kNo);
REPORTER_ASSERT(reporter, SkToBool(proxy.get()) == expectedMipMapability,
"ct:%s format:%s, tex:%d, expectedMipMapability:%d",
GrColorTypeToStr(combo.fColorType), combo.fFormat.toStr().c_str(),
SkToBool(proxy.get()), expectedMipMapability);
}
// Check if 'isFormatAsColorTypeRenderable' agrees with 'createTexture' (w/o MSAA)
{
bool isRenderable = caps->isFormatRenderable(combo.fFormat, 1);
sk_sp<GrSurface> tex = resourceProvider->createTexture(
kDims, combo.fFormat, GrRenderable::kYes, 1, GrMipMapped::kNo, SkBudgeted::kNo,
GrProtected::kNo);
REPORTER_ASSERT(reporter, SkToBool(tex) == isRenderable,
"ct:%s format:%s, tex:%d, isRenderable:%d",
GrColorTypeToStr(combo.fColorType), combo.fFormat.toStr().c_str(),
SkToBool(tex), isRenderable);
}
// Check if 'isFormatAsColorTypeRenderable' agrees with 'createTexture' w/ MSAA
{
bool isRenderable = caps->isFormatRenderable(combo.fFormat, 2);
sk_sp<GrSurface> tex = resourceProvider->createTexture(
kDims, combo.fFormat, GrRenderable::kYes, 2, GrMipMapped::kNo, SkBudgeted::kNo,
GrProtected::kNo);
REPORTER_ASSERT(reporter, SkToBool(tex) == isRenderable,
"ct:%s format:%s, tex:%d, isRenderable:%d",
GrColorTypeToStr(combo.fColorType), combo.fFormat.toStr().c_str(),
SkToBool(tex), isRenderable);
}
}
}
@ -275,8 +266,8 @@ DEF_GPUTEST(InitialTextureClear, reporter, baseOptions) {
// Does directly allocating a texture clear it?
{
auto proxy = proxyProvider->testingOnly_createInstantiatedProxy(
{kSize, kSize}, combo.fColorType, combo.fFormat, renderable, 1,
kTopLeft_GrSurfaceOrigin, fit, SkBudgeted::kYes, GrProtected::kNo);
{kSize, kSize}, combo.fColorType, combo.fFormat, renderable, 1, fit,
SkBudgeted::kYes, GrProtected::kNo);
if (proxy) {
GrSwizzle swizzle = caps->getReadSwizzle(combo.fFormat,
combo.fColorType);
@ -377,7 +368,6 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadOnlyTexture, reporter, context_info) {
GrRenderable::kYes, GrProtected::kNo);
auto proxy = proxyProvider->wrapBackendTexture(backendTex, GrColorType::kRGBA_8888,
kTopLeft_GrSurfaceOrigin,
kBorrow_GrWrapOwnership,
GrWrapCacheable::kNo, ioType);
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(proxy->backendFormat(),
@ -437,7 +427,6 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadOnlyTexture, reporter, context_info) {
SkColors::kTransparent, GrMipMapped::kYes, GrRenderable::kYes,
GrProtected::kNo);
proxy = proxyProvider->wrapBackendTexture(backendTex, GrColorType::kRGBA_8888,
kTopLeft_GrSurfaceOrigin,
kBorrow_GrWrapOwnership, GrWrapCacheable::kNo,
ioType);
context->flush();
@ -586,10 +575,9 @@ DEF_GPUTEST(TextureIdleProcTest, reporter, options) {
backendFormat, GrColorType::kRGBA_8888);
auto proxy = context->priv().proxyProvider()->createLazyProxy(
singleUseLazyCB, backendFormat, desc, readSwizzle, renderable, 1,
kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo,
GrMipMapsStatus::kNotAllocated, GrInternalSurfaceFlags ::kNone,
SkBackingFit::kExact, budgeted, GrProtected::kNo,
GrSurfaceProxy::UseAllocator::kYes);
GrMipMapped::kNo, GrMipMapsStatus::kNotAllocated,
GrInternalSurfaceFlags ::kNone, SkBackingFit::kExact, budgeted,
GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
GrSurfaceProxyView view(std::move(proxy), kTopLeft_GrSurfaceOrigin, readSwizzle);
rtc->drawTexture(GrNoClip(), view, kPremul_SkAlphaType,
GrSamplerState::Filter::kNearest, SkBlendMode::kSrcOver,
@ -650,7 +638,7 @@ DEF_GPUTEST(TextureIdleProcTest, reporter, options) {
auto rtc = rt->getCanvas()
->internal_private_accessTopLayerRenderTargetContext();
auto proxy = context->priv().proxyProvider()->testingOnly_createWrapped(
texture, GrColorType::kRGBA_8888, kTopLeft_GrSurfaceOrigin);
texture, GrColorType::kRGBA_8888);
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(
proxy->backendFormat(), GrColorType::kRGBA_8888);
GrSurfaceProxyView view(std::move(proxy), kTopLeft_GrSurfaceOrigin,
@ -813,7 +801,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(TextureIdleStateTest, reporter, contextInfo) {
auto rt = SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info, 0, nullptr);
auto rtc = rt->getCanvas()->internal_private_accessTopLayerRenderTargetContext();
auto proxy = context->priv().proxyProvider()->testingOnly_createWrapped(
std::move(idleTexture), GrColorType::kRGBA_8888, rtc->origin());
std::move(idleTexture), GrColorType::kRGBA_8888);
context->flush();
SkAssertResult(rtc->testCopy(proxy.get(), rtc->origin()));
proxy.reset();

View File

@ -63,12 +63,11 @@ void testing_only_texture_test(skiatest::Reporter* reporter, GrContext* context,
sk_sp<GrTextureProxy> wrappedProxy;
if (GrRenderable::kYes == renderable) {
wrappedProxy = context->priv().proxyProvider()->wrapRenderableBackendTexture(
backendTex, kTopLeft_GrSurfaceOrigin, 1, grCT, kAdopt_GrWrapOwnership,
GrWrapCacheable::kNo);
backendTex, 1, grCT, kAdopt_GrWrapOwnership, GrWrapCacheable::kNo);
} else {
wrappedProxy = context->priv().proxyProvider()->wrapBackendTexture(
backendTex, grCT, kTopLeft_GrSurfaceOrigin, kAdopt_GrWrapOwnership,
GrWrapCacheable::kNo, GrIOType::kRW_GrIOType);
backendTex, grCT, kAdopt_GrWrapOwnership, GrWrapCacheable::kNo,
GrIOType::kRW_GrIOType);
}
REPORTER_ASSERT(reporter, wrappedProxy);

View File

@ -101,8 +101,7 @@ public:
}
},
format, readSwizzle, GrRenderable::kNo, 1, GrProtected::kNo,
kTopLeft_GrSurfaceOrigin, *proxyProvider->caps(),
GrSurfaceProxy::UseAllocator::kYes);
*proxyProvider->caps(), GrSurfaceProxy::UseAllocator::kYes);
this->setBounds(SkRectPriv::MakeLargest(), GrOp::HasAABloat::kNo,
GrOp::IsHairline::kNo);
@ -141,7 +140,7 @@ public:
fAtlas->instantiate(rp);
return sk_ref_sp(fAtlas->peekTexture());
},
format, readSwizzle, GrRenderable::kYes, 1, GrProtected::kNo, kOrigin,
format, readSwizzle, GrRenderable::kYes, 1, GrProtected::kNo,
*proxyProvider->caps(), GrSurfaceProxy::UseAllocator::kYes);
fAccess.set(GrSurfaceProxyView(fLazyProxy, kOrigin, readSwizzle),
GrSamplerState::Filter::kNearest);
@ -275,7 +274,7 @@ DEF_GPUTEST(LazyProxyReleaseTest, reporter, /* options */) {
GrSwizzle readSwizzle = caps->getReadSwizzle(format, GrColorType::kRGBA_8888);
sk_sp<GrTextureProxy> proxy = proxyProvider->createLazyProxy(
TestCallback(&testCount, releaseCallback, tex), format, {kSize, kSize},
readSwizzle, GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo,
readSwizzle, GrRenderable::kNo, 1, GrMipMapped::kNo,
GrMipMapsStatus::kNotAllocated, GrInternalSurfaceFlags::kNone,
SkBackingFit::kExact, SkBudgeted::kNo, GrProtected::kNo,
GrSurfaceProxy::UseAllocator::kYes);
@ -348,10 +347,9 @@ private:
SkBudgeted::kNo, GrProtected::kNo),
true, GrSurfaceProxy::LazyInstantiationKeyMode::kUnsynced};
},
format, desc, readSwizzle, GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin,
GrMipMapped::kNo, GrMipMapsStatus::kNotAllocated, GrInternalSurfaceFlags::kNone,
SkBackingFit::kExact, SkBudgeted::kNo, GrProtected::kNo,
GrSurfaceProxy::UseAllocator::kYes);
format, desc, readSwizzle, GrRenderable::kNo, 1, GrMipMapped::kNo,
GrMipMapsStatus::kNotAllocated, GrInternalSurfaceFlags::kNone, SkBackingFit::kExact,
SkBudgeted::kNo, GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
SkASSERT(fLazyProxy.get());

View File

@ -42,8 +42,7 @@ DEF_GPUTEST_FOR_METAL_CONTEXT(MtlCopySurfaceTest, reporter, ctxInfo) {
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
sk_sp<GrSurfaceProxy> srcProxy = proxyProvider->wrapBackendRenderTarget(
backendRT, GrColorType::kBGRA_8888,
kTopLeft_GrSurfaceOrigin);
backendRT, GrColorType::kBGRA_8888);
GrSurfaceProxyView dstView = GrSurfaceProxy::Copy(context, srcProxy.get(),
kTopLeft_GrSurfaceOrigin,

View File

@ -330,7 +330,6 @@ public:
GrRenderable::kYes,
1,
GrProtected::kNo,
kBottomLeft_GrSurfaceOrigin,
*proxyProvider->caps(),
GrSurfaceProxy::UseAllocator::kNo);

View File

@ -175,8 +175,8 @@ DEF_GPUTEST(OpChainTest, reporter, /*ctxInfo*/) {
static const GrSurfaceOrigin kOrigin = kTopLeft_GrSurfaceOrigin;
auto proxy = context->priv().proxyProvider()->createProxy(
format, kDims, swizzle, GrRenderable::kYes, 1, kOrigin, GrMipMapped::kNo,
SkBackingFit::kExact, SkBudgeted::kNo, GrProtected::kNo, GrInternalSurfaceFlags::kNone);
format, kDims, swizzle, GrRenderable::kYes, 1, GrMipMapped::kNo, SkBackingFit::kExact,
SkBudgeted::kNo, GrProtected::kNo, GrInternalSurfaceFlags::kNone);
SkASSERT(proxy);
proxy->instantiate(context->priv().resourceProvider());

View File

@ -162,8 +162,8 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) {
context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kApprox, {1, 1});
{
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
format, kDims, swizzle, GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin,
GrMipMapped::kNo, SkBackingFit::kExact, SkBudgeted::kYes, GrProtected::kNo);
format, kDims, swizzle, GrRenderable::kNo, 1, GrMipMapped::kNo,
SkBackingFit::kExact, SkBudgeted::kYes, GrProtected::kNo);
{
SkTArray<GrSurfaceProxyView> views;

View File

@ -268,8 +268,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages, int ma
GrRenderable::kYes);
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(format, GrColorType::kRGBA_8888);
auto proxy = proxyProvider->createProxy(format, kDummyDims, swizzle, GrRenderable::kYes, 1,
kBottomLeft_GrSurfaceOrigin, mipMapped,
SkBackingFit::kExact, SkBudgeted::kNo,
mipMapped, SkBackingFit::kExact, SkBudgeted::kNo,
GrProtected::kNo, GrInternalSurfaceFlags::kNone);
views[0] = {{std::move(proxy), kBottomLeft_GrSurfaceOrigin, swizzle},
GrColorType::kRGBA_8888, kPremul_SkAlphaType};
@ -281,8 +280,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages, int ma
GrRenderable::kNo);
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(format, GrColorType::kAlpha_8);
auto proxy = proxyProvider->createProxy(format, kDummyDims, swizzle, GrRenderable::kNo, 1,
kTopLeft_GrSurfaceOrigin, mipMapped,
SkBackingFit::kExact, SkBudgeted::kNo,
mipMapped, SkBackingFit::kExact, SkBudgeted::kNo,
GrProtected::kNo, GrInternalSurfaceFlags::kNone);
views[1] = {{std::move(proxy), kTopLeft_GrSurfaceOrigin, swizzle},
GrColorType::kAlpha_8, kPremul_SkAlphaType};

View File

@ -23,11 +23,10 @@ static sk_sp<GrSurfaceProxy> make_wrapped_rt(GrProxyProvider* provider,
GrGpu* gpu,
skiatest::Reporter* reporter,
const SkISize& size,
GrColorType colorType,
GrSurfaceOrigin origin) {
GrColorType colorType) {
auto backendRT =
gpu->createTestingOnlyBackendRenderTarget(size.width(), size.height(), colorType);
return provider->wrapBackendRenderTarget(backendRT, colorType, origin, nullptr, nullptr);
return provider->wrapBackendRenderTarget(backendRT, colorType, nullptr, nullptr);
}
void clean_up_wrapped_rt(GrGpu* gpu, sk_sp<GrSurfaceProxy> proxy) {
@ -40,21 +39,19 @@ void clean_up_wrapped_rt(GrGpu* gpu, sk_sp<GrSurfaceProxy> proxy) {
static sk_sp<GrSurfaceProxy> make_offscreen_rt(GrProxyProvider* provider,
SkISize dimensions,
GrColorType colorType,
GrSurfaceOrigin origin) {
GrColorType colorType) {
return provider->testingOnly_createInstantiatedProxy(dimensions, colorType, GrRenderable::kYes,
1, origin, SkBackingFit::kExact,
SkBudgeted::kYes, GrProtected::kNo);
1, SkBackingFit::kExact, SkBudgeted::kYes,
GrProtected::kNo);
}
static sk_sp<GrSurfaceProxy> make_texture(GrProxyProvider* provider,
SkISize dimensions,
GrColorType colorType,
GrRenderable renderable,
GrSurfaceOrigin origin) {
GrRenderable renderable) {
return provider->testingOnly_createInstantiatedProxy(dimensions, colorType, renderable, 1,
origin, SkBackingFit::kExact,
SkBudgeted::kYes, GrProtected::kNo);
SkBackingFit::kExact, SkBudgeted::kYes,
GrProtected::kNo);
}
// Test converting between RenderTargetProxies and TextureProxies for preinstantiated Proxies
@ -67,8 +64,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PreinstantiatedProxyConversionTest, reporter,
{
// External on-screen render target.
sk_sp<GrSurfaceProxy> sProxy(make_wrapped_rt(proxyProvider, gpu, reporter, kSize,
kColorType, kBottomLeft_GrSurfaceOrigin));
sk_sp<GrSurfaceProxy> sProxy(
make_wrapped_rt(proxyProvider, gpu, reporter, kSize, kColorType));
if (sProxy) {
// RenderTarget-only
GrRenderTargetProxy* rtProxy = sProxy->asRenderTargetProxy();
@ -81,8 +78,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PreinstantiatedProxyConversionTest, reporter,
{
// Internal offscreen render target.
sk_sp<GrSurfaceProxy> sProxy(
make_offscreen_rt(proxyProvider, kSize, kColorType, kBottomLeft_GrSurfaceOrigin));
sk_sp<GrSurfaceProxy> sProxy(make_offscreen_rt(proxyProvider, kSize, kColorType));
if (sProxy) {
// Both RenderTarget and Texture
GrRenderTargetProxy* rtProxy = sProxy->asRenderTargetProxy();
@ -96,8 +92,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PreinstantiatedProxyConversionTest, reporter,
{
// Internal offscreen render target - but through GrTextureProxy
sk_sp<GrSurfaceProxy> sProxy(make_texture(proxyProvider, kSize, kColorType,
GrRenderable::kYes, kBottomLeft_GrSurfaceOrigin));
sk_sp<GrSurfaceProxy> sProxy(
make_texture(proxyProvider, kSize, kColorType, GrRenderable::kYes));
if (sProxy) {
// Both RenderTarget and Texture
GrTextureProxy* tProxy = sProxy->asTextureProxy();
@ -111,8 +107,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PreinstantiatedProxyConversionTest, reporter,
{
// force no-RT
sk_sp<GrSurfaceProxy> sProxy(make_texture(proxyProvider, kSize, kColorType,
GrRenderable::kNo, kBottomLeft_GrSurfaceOrigin));
sk_sp<GrSurfaceProxy> sProxy(
make_texture(proxyProvider, kSize, kColorType, GrRenderable::kNo));
if (sProxy) {
// Texture-only
GrTextureProxy* tProxy = sProxy->asTextureProxy();
@ -138,8 +134,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxIn
{
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
format, kDims, swizzle, GrRenderable::kYes, 1, kBottomLeft_GrSurfaceOrigin,
GrMipMapped::kNo, SkBackingFit::kApprox, SkBudgeted::kYes, GrProtected::kNo);
format, kDims, swizzle, GrRenderable::kYes, 1, GrMipMapped::kNo,
SkBackingFit::kApprox, SkBudgeted::kYes, GrProtected::kNo);
// Both RenderTarget and Texture
GrRenderTargetProxy* rtProxy = proxy->asRenderTargetProxy();
@ -152,8 +148,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxIn
{
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
format, kDims, swizzle, GrRenderable::kYes, 1, kBottomLeft_GrSurfaceOrigin,
GrMipMapped::kNo, SkBackingFit::kApprox, SkBudgeted::kYes, GrProtected::kNo);
format, kDims, swizzle, GrRenderable::kYes, 1, GrMipMapped::kNo,
SkBackingFit::kApprox, SkBudgeted::kYes, GrProtected::kNo);
// Both RenderTarget and Texture - but via GrTextureProxy
GrTextureProxy* tProxy = proxy->asTextureProxy();
@ -166,8 +162,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxIn
{
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
format, kDims, swizzle, GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin,
GrMipMapped::kNo, SkBackingFit::kApprox, SkBudgeted::kYes, GrProtected::kNo);
format, kDims, swizzle, GrRenderable::kNo, 1, GrMipMapped::kNo,
SkBackingFit::kApprox, SkBudgeted::kYes, GrProtected::kNo);
// Texture-only
GrTextureProxy* tProxy = proxy->asTextureProxy();
REPORTER_ASSERT(reporter, tProxy);

View File

@ -28,9 +28,8 @@ static sk_sp<GrTextureProxy> make_deferred(GrContext* context) {
GrRenderable::kYes);
GrSwizzle swizzle = caps->getReadSwizzle(format, GrColorType::kRGBA_8888);
return proxyProvider->createProxy(format, {kWidthHeight, kWidthHeight}, swizzle,
GrRenderable::kYes, 1, kBottomLeft_GrSurfaceOrigin,
GrMipMapped::kNo, SkBackingFit::kApprox, SkBudgeted::kYes,
GrProtected::kNo);
GrRenderable::kYes, 1, GrMipMapped::kNo,
SkBackingFit::kApprox, SkBudgeted::kYes, GrProtected::kNo);
}
static sk_sp<GrTextureProxy> make_wrapped(GrContext* context) {
@ -38,7 +37,7 @@ static sk_sp<GrTextureProxy> make_wrapped(GrContext* context) {
return proxyProvider->testingOnly_createInstantiatedProxy(
{kWidthHeight, kWidthHeight}, GrColorType::kRGBA_8888, GrRenderable::kYes, 1,
kBottomLeft_GrSurfaceOrigin, SkBackingFit::kExact, SkBudgeted::kNo, GrProtected::kNo);
SkBackingFit::kExact, SkBudgeted::kNo, GrProtected::kNo);
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {

View File

@ -113,92 +113,89 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) {
int attempt = 0; // useful for debugging
for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin }) {
for (auto widthHeight : { 100, 128, 1048576 }) {
for (auto ct : { GrColorType::kAlpha_8, GrColorType::kBGR_565,
GrColorType::kRGBA_8888, GrColorType::kRGBA_1010102 } ) {
for (auto fit : { SkBackingFit::kExact, SkBackingFit::kApprox }) {
for (auto budgeted : { SkBudgeted::kYes, SkBudgeted::kNo }) {
for (auto numSamples : {1, 4, 16, 128}) {
SkISize dims = {widthHeight, widthHeight};
for (auto widthHeight : {100, 128, 1048576}) {
for (auto ct : {GrColorType::kAlpha_8, GrColorType::kBGR_565, GrColorType::kRGBA_8888,
GrColorType::kRGBA_1010102}) {
for (auto fit : {SkBackingFit::kExact, SkBackingFit::kApprox}) {
for (auto budgeted : {SkBudgeted::kYes, SkBudgeted::kNo}) {
for (auto numSamples : {1, 4, 16, 128}) {
SkISize dims = {widthHeight, widthHeight};
auto format = caps.getDefaultBackendFormat(ct, GrRenderable::kYes);
if (!format.isValid()) {
continue;
}
GrSwizzle swizzle = caps.getReadSwizzle(format, ct);
// Renderable
{
sk_sp<GrTexture> tex;
if (SkBackingFit::kApprox == fit) {
tex = resourceProvider->createApproxTexture(
dims, format, GrRenderable::kYes, numSamples,
GrProtected::kNo);
} else {
tex = resourceProvider->createTexture(
dims, format, GrRenderable::kYes, numSamples,
GrMipMapped::kNo, budgeted, GrProtected::kNo);
}
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
format, dims, swizzle, GrRenderable::kYes, numSamples,
origin, GrMipMapped::kNo, fit, budgeted, GrProtected::kNo);
REPORTER_ASSERT(reporter, SkToBool(tex) == SkToBool(proxy));
if (proxy) {
REPORTER_ASSERT(reporter, proxy->asRenderTargetProxy());
// This forces the proxy to compute and cache its
// pre-instantiation size guess. Later, when it is actually
// instantiated, it checks that the instantiated size is <= to
// the pre-computation. If the proxy never computed its
// pre-instantiation size then the check is skipped.
proxy->gpuMemorySize(caps);
check_surface(reporter, proxy.get(), widthHeight, widthHeight,
budgeted);
int supportedSamples =
caps.getRenderTargetSampleCount(numSamples, format);
check_rendertarget(reporter, caps, resourceProvider,
proxy->asRenderTargetProxy(),
supportedSamples,
fit, caps.maxWindowRectangles());
}
}
// Not renderable
{
sk_sp<GrTexture> tex;
if (SkBackingFit::kApprox == fit) {
tex = resourceProvider->createApproxTexture(
dims, format, GrRenderable::kNo, numSamples,
GrProtected::kNo);
} else {
tex = resourceProvider->createTexture(
dims, format, GrRenderable::kNo, numSamples,
GrMipMapped::kNo, budgeted, GrProtected::kNo);
}
sk_sp<GrTextureProxy> proxy(proxyProvider->createProxy(
format, dims, swizzle, GrRenderable::kNo, numSamples,
origin, GrMipMapped::kNo, fit, budgeted, GrProtected::kNo));
REPORTER_ASSERT(reporter, SkToBool(tex) == SkToBool(proxy));
if (proxy) {
// This forces the proxy to compute and cache its
// pre-instantiation size guess. Later, when it is actually
// instantiated, it checks that the instantiated size is <= to
// the pre-computation. If the proxy never computed its
// pre-instantiation size then the check is skipped.
proxy->gpuMemorySize(caps);
check_surface(reporter, proxy.get(), widthHeight, widthHeight,
budgeted);
check_texture(reporter, resourceProvider,
proxy->asTextureProxy(), fit);
}
}
attempt++;
auto format = caps.getDefaultBackendFormat(ct, GrRenderable::kYes);
if (!format.isValid()) {
continue;
}
GrSwizzle swizzle = caps.getReadSwizzle(format, ct);
// Renderable
{
sk_sp<GrTexture> tex;
if (SkBackingFit::kApprox == fit) {
tex = resourceProvider->createApproxTexture(
dims, format, GrRenderable::kYes, numSamples,
GrProtected::kNo);
} else {
tex = resourceProvider->createTexture(
dims, format, GrRenderable::kYes, numSamples,
GrMipMapped::kNo, budgeted, GrProtected::kNo);
}
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
format, dims, swizzle, GrRenderable::kYes, numSamples,
GrMipMapped::kNo, fit, budgeted, GrProtected::kNo);
REPORTER_ASSERT(reporter, SkToBool(tex) == SkToBool(proxy));
if (proxy) {
REPORTER_ASSERT(reporter, proxy->asRenderTargetProxy());
// This forces the proxy to compute and cache its
// pre-instantiation size guess. Later, when it is actually
// instantiated, it checks that the instantiated size is <= to
// the pre-computation. If the proxy never computed its
// pre-instantiation size then the check is skipped.
proxy->gpuMemorySize(caps);
check_surface(reporter, proxy.get(), widthHeight, widthHeight,
budgeted);
int supportedSamples =
caps.getRenderTargetSampleCount(numSamples, format);
check_rendertarget(reporter, caps, resourceProvider,
proxy->asRenderTargetProxy(), supportedSamples,
fit, caps.maxWindowRectangles());
}
}
// Not renderable
{
sk_sp<GrTexture> tex;
if (SkBackingFit::kApprox == fit) {
tex = resourceProvider->createApproxTexture(
dims, format, GrRenderable::kNo, numSamples,
GrProtected::kNo);
} else {
tex = resourceProvider->createTexture(
dims, format, GrRenderable::kNo, numSamples,
GrMipMapped::kNo, budgeted, GrProtected::kNo);
}
sk_sp<GrTextureProxy> proxy(proxyProvider->createProxy(
format, dims, swizzle, GrRenderable::kNo, numSamples,
GrMipMapped::kNo, fit, budgeted, GrProtected::kNo));
REPORTER_ASSERT(reporter, SkToBool(tex) == SkToBool(proxy));
if (proxy) {
// This forces the proxy to compute and cache its
// pre-instantiation size guess. Later, when it is actually
// instantiated, it checks that the instantiated size is <= to
// the pre-computation. If the proxy never computed its
// pre-instantiation size then the check is skipped.
proxy->gpuMemorySize(caps);
check_surface(reporter, proxy.get(), widthHeight, widthHeight,
budgeted);
check_texture(reporter, resourceProvider, proxy->asTextureProxy(),
fit);
}
}
attempt++;
}
}
}
@ -215,139 +212,115 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
static const int kWidthHeight = 100;
for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin }) {
for (auto colorType : { kAlpha_8_SkColorType, kRGBA_8888_SkColorType,
kRGBA_1010102_SkColorType }) {
GrColorType grColorType = SkColorTypeToGrColorType(colorType);
for (auto colorType :
{kAlpha_8_SkColorType, kRGBA_8888_SkColorType, kRGBA_1010102_SkColorType}) {
GrColorType grColorType = SkColorTypeToGrColorType(colorType);
// External on-screen render target.
// Tests wrapBackendRenderTarget with a GrBackendRenderTarget
// Our test-only function that creates a backend render target doesn't currently support
// sample counts :(.
if (ctxInfo.grContext()->colorTypeSupportedAsSurface(colorType)) {
GrBackendRenderTarget backendRT = gpu->createTestingOnlyBackendRenderTarget(
kWidthHeight, kWidthHeight, grColorType);
sk_sp<GrSurfaceProxy> sProxy(
proxyProvider->wrapBackendRenderTarget(backendRT, grColorType,
origin, nullptr, nullptr));
check_surface(reporter, sProxy.get(), kWidthHeight, kWidthHeight, SkBudgeted::kNo);
static constexpr int kExpectedNumSamples = 1;
check_rendertarget(reporter, caps, resourceProvider, sProxy->asRenderTargetProxy(),
kExpectedNumSamples, SkBackingFit::kExact,
caps.maxWindowRectangles());
gpu->deleteTestingOnlyBackendRenderTarget(backendRT);
// External on-screen render target.
// Tests wrapBackendRenderTarget with a GrBackendRenderTarget
// Our test-only function that creates a backend render target doesn't currently support
// sample counts :(.
if (ctxInfo.grContext()->colorTypeSupportedAsSurface(colorType)) {
GrBackendRenderTarget backendRT = gpu->createTestingOnlyBackendRenderTarget(
kWidthHeight, kWidthHeight, grColorType);
sk_sp<GrSurfaceProxy> sProxy(proxyProvider->wrapBackendRenderTarget(
backendRT, grColorType, nullptr, nullptr));
check_surface(reporter, sProxy.get(), kWidthHeight, kWidthHeight, SkBudgeted::kNo);
static constexpr int kExpectedNumSamples = 1;
check_rendertarget(reporter, caps, resourceProvider, sProxy->asRenderTargetProxy(),
kExpectedNumSamples, SkBackingFit::kExact,
caps.maxWindowRectangles());
gpu->deleteTestingOnlyBackendRenderTarget(backendRT);
}
for (auto numSamples : {1, 4}) {
auto beFormat = caps.getDefaultBackendFormat(grColorType, GrRenderable::kYes);
int supportedNumSamples = caps.getRenderTargetSampleCount(numSamples, beFormat);
if (!supportedNumSamples) {
continue;
}
for (auto numSamples : {1, 4}) {
auto beFormat = caps.getDefaultBackendFormat(grColorType, GrRenderable::kYes);
int supportedNumSamples = caps.getRenderTargetSampleCount(numSamples, beFormat);
if (!supportedNumSamples) {
#ifdef SK_GL
// Test wrapping FBO 0 (with made up properties). This tests sample count and the
// special case where FBO 0 doesn't support window rectangles.
if (GrBackendApi::kOpenGL == ctxInfo.backend()) {
GrGLFramebufferInfo fboInfo;
fboInfo.fFBOID = 0;
fboInfo.fFormat = GrGLFormatToEnum(beFormat.asGLFormat());
SkASSERT(fboInfo.fFormat);
static constexpr int kStencilBits = 8;
GrBackendRenderTarget backendRT(kWidthHeight, kWidthHeight, numSamples,
kStencilBits, fboInfo);
sk_sp<GrSurfaceProxy> sProxy(proxyProvider->wrapBackendRenderTarget(
backendRT, grColorType, nullptr, nullptr));
check_surface(reporter, sProxy.get(), kWidthHeight, kWidthHeight, SkBudgeted::kNo);
check_rendertarget(reporter, caps, resourceProvider, sProxy->asRenderTargetProxy(),
supportedNumSamples, SkBackingFit::kExact, 0);
}
#endif
// Tests wrapBackendRenderTarget with a GrBackendTexture
{
GrBackendTexture backendTex = context->createBackendTexture(
kWidthHeight, kWidthHeight, colorType, SkColors::kTransparent,
GrMipMapped::kNo, GrRenderable::kYes, GrProtected::kNo);
sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapBackendTextureAsRenderTarget(
backendTex, grColorType, supportedNumSamples);
if (!sProxy) {
context->deleteBackendTexture(backendTex);
continue; // This can fail on Mesa
}
check_surface(reporter, sProxy.get(), kWidthHeight, kWidthHeight, SkBudgeted::kNo);
check_rendertarget(reporter, caps, resourceProvider, sProxy->asRenderTargetProxy(),
supportedNumSamples, SkBackingFit::kExact,
caps.maxWindowRectangles());
context->deleteBackendTexture(backendTex);
}
// Tests wrapBackendTexture that is only renderable
{
GrBackendTexture backendTex = context->createBackendTexture(
kWidthHeight, kWidthHeight, colorType, SkColors::kTransparent,
GrMipMapped::kNo, GrRenderable::kYes, GrProtected::kNo);
sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapRenderableBackendTexture(
backendTex, supportedNumSamples, grColorType, kBorrow_GrWrapOwnership,
GrWrapCacheable::kNo, nullptr, nullptr);
if (!sProxy) {
context->deleteBackendTexture(backendTex);
continue; // This can fail on Mesa
}
check_surface(reporter, sProxy.get(), kWidthHeight, kWidthHeight, SkBudgeted::kNo);
check_rendertarget(reporter, caps, resourceProvider, sProxy->asRenderTargetProxy(),
supportedNumSamples, SkBackingFit::kExact,
caps.maxWindowRectangles());
context->deleteBackendTexture(backendTex);
}
// Tests wrapBackendTexture that is only textureable
{
// Internal offscreen texture
GrBackendTexture backendTex = context->createBackendTexture(
kWidthHeight, kWidthHeight, colorType, SkColors::kTransparent,
GrMipMapped::kNo, GrRenderable::kNo, GrProtected::kNo);
sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapBackendTexture(
backendTex, grColorType, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo,
kRead_GrIOType);
if (!sProxy) {
context->deleteBackendTexture(backendTex);
continue;
}
#ifdef SK_GL
// Test wrapping FBO 0 (with made up properties). This tests sample count and the
// special case where FBO 0 doesn't support window rectangles.
if (GrBackendApi::kOpenGL == ctxInfo.backend()) {
GrGLFramebufferInfo fboInfo;
fboInfo.fFBOID = 0;
fboInfo.fFormat = GrGLFormatToEnum(beFormat.asGLFormat());
SkASSERT(fboInfo.fFormat);
static constexpr int kStencilBits = 8;
GrBackendRenderTarget backendRT(kWidthHeight, kWidthHeight, numSamples,
kStencilBits, fboInfo);
sk_sp<GrSurfaceProxy> sProxy(
proxyProvider->wrapBackendRenderTarget(backendRT, grColorType,
origin, nullptr, nullptr));
check_surface(reporter, sProxy.get(), kWidthHeight, kWidthHeight,
SkBudgeted::kNo);
check_rendertarget(reporter, caps, resourceProvider,
sProxy->asRenderTargetProxy(),
supportedNumSamples, SkBackingFit::kExact, 0);
}
#endif
check_surface(reporter, sProxy.get(), kWidthHeight, kWidthHeight, SkBudgeted::kNo);
check_texture(reporter, resourceProvider, sProxy->asTextureProxy(),
SkBackingFit::kExact);
// Tests wrapBackendRenderTarget with a GrBackendTexture
{
GrBackendTexture backendTex =
context->createBackendTexture(kWidthHeight, kWidthHeight,
colorType,
SkColors::kTransparent,
GrMipMapped::kNo,
GrRenderable::kYes,
GrProtected::kNo);
sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapBackendTextureAsRenderTarget(
backendTex, grColorType, origin, supportedNumSamples);
if (!sProxy) {
context->deleteBackendTexture(backendTex);
continue; // This can fail on Mesa
}
check_surface(reporter, sProxy.get(), kWidthHeight, kWidthHeight,
SkBudgeted::kNo);
check_rendertarget(reporter, caps, resourceProvider,
sProxy->asRenderTargetProxy(),
supportedNumSamples, SkBackingFit::kExact,
caps.maxWindowRectangles());
context->deleteBackendTexture(backendTex);
}
// Tests wrapBackendTexture that is only renderable
{
GrBackendTexture backendTex =
context->createBackendTexture(kWidthHeight, kWidthHeight,
colorType,
SkColors::kTransparent,
GrMipMapped::kNo,
GrRenderable::kYes,
GrProtected::kNo);
sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapRenderableBackendTexture(
backendTex, origin, supportedNumSamples,
grColorType, kBorrow_GrWrapOwnership,
GrWrapCacheable::kNo, nullptr, nullptr);
if (!sProxy) {
context->deleteBackendTexture(backendTex);
continue; // This can fail on Mesa
}
check_surface(reporter, sProxy.get(), kWidthHeight, kWidthHeight,
SkBudgeted::kNo);
check_rendertarget(reporter, caps, resourceProvider,
sProxy->asRenderTargetProxy(),
supportedNumSamples, SkBackingFit::kExact,
caps.maxWindowRectangles());
context->deleteBackendTexture(backendTex);
}
// Tests wrapBackendTexture that is only textureable
{
// Internal offscreen texture
GrBackendTexture backendTex =
context->createBackendTexture(kWidthHeight, kWidthHeight,
colorType,
SkColors::kTransparent,
GrMipMapped::kNo,
GrRenderable::kNo,
GrProtected::kNo);
sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapBackendTexture(
backendTex, grColorType, origin, kBorrow_GrWrapOwnership,
GrWrapCacheable::kNo, kRead_GrIOType);
if (!sProxy) {
context->deleteBackendTexture(backendTex);
continue;
}
check_surface(reporter, sProxy.get(), kWidthHeight, kWidthHeight,
SkBudgeted::kNo);
check_texture(reporter, resourceProvider, sProxy->asTextureProxy(),
SkBackingFit::kExact);
context->deleteBackendTexture(backendTex);
}
context->deleteBackendTexture(backendTex);
}
}
}
@ -372,10 +345,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ZeroSizedProxyTest, reporter, ctxInfo) {
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(
format, GrColorType::kRGBA_8888);
sk_sp<GrTextureProxy> proxy =
provider->createProxy(format, {width, height}, swizzle, renderable, 1,
kBottomLeft_GrSurfaceOrigin, GrMipMapped::kNo,
fit, SkBudgeted::kNo, GrProtected::kNo);
sk_sp<GrTextureProxy> proxy = provider->createProxy(
format, {width, height}, swizzle, renderable, 1, GrMipMapped::kNo, fit,
SkBudgeted::kNo, GrProtected::kNo);
REPORTER_ASSERT(reporter, !proxy);
}
}

View File

@ -167,8 +167,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(RectangleTexture, reporter, ctxInfo) {
}
sk_sp<GrTextureProxy> rectProxy = proxyProvider->wrapBackendTexture(
rectangleTex, GrColorType::kRGBA_8888, origin,
kBorrow_GrWrapOwnership, GrWrapCacheable::kNo, kRW_GrIOType);
rectangleTex, GrColorType::kRGBA_8888, kBorrow_GrWrapOwnership,
GrWrapCacheable::kNo, kRW_GrIOType);
if (!rectProxy) {
ERRORF(reporter, "Error creating proxy for rectangle texture.");

View File

@ -26,7 +26,6 @@ struct ProxyParams {
GrColorType fColorType;
SkBackingFit fFit;
int fSampleCnt;
GrSurfaceOrigin fOrigin;
SkBudgeted fBudgeted;
// TODO: do we care about mipmapping
};
@ -37,8 +36,8 @@ static sk_sp<GrSurfaceProxy> make_deferred(GrProxyProvider* proxyProvider, const
GrSwizzle swizzle = caps->getReadSwizzle(format, p.fColorType);
return proxyProvider->createProxy(format, {p.fSize, p.fSize}, swizzle, p.fRenderable,
p.fSampleCnt, p.fOrigin, GrMipMapped::kNo, p.fFit,
p.fBudgeted, GrProtected::kNo);
p.fSampleCnt, GrMipMapped::kNo, p.fFit, p.fBudgeted,
GrProtected::kNo);
}
static sk_sp<GrSurfaceProxy> make_backend(GrContext* context, const ProxyParams& p,
@ -56,9 +55,8 @@ static sk_sp<GrSurfaceProxy> make_backend(GrContext* context, const ProxyParams&
return nullptr;
}
return proxyProvider->wrapBackendTexture(*backendTex, p.fColorType, p.fOrigin,
kBorrow_GrWrapOwnership, GrWrapCacheable::kNo,
kRead_GrIOType);
return proxyProvider->wrapBackendTexture(*backendTex, p.fColorType, kBorrow_GrWrapOwnership,
GrWrapCacheable::kNo, kRead_GrIOType);
}
static void cleanup_backend(GrContext* context, const GrBackendTexture& backendTex) {
@ -147,19 +145,16 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceAllocatorTest, reporter, ctxInfo) {
const SkBackingFit kE = SkBackingFit::kExact;
const SkBackingFit kA = SkBackingFit::kApprox;
const GrSurfaceOrigin kTL = kTopLeft_GrSurfaceOrigin;
const GrSurfaceOrigin kBL = kBottomLeft_GrSurfaceOrigin;
const SkBudgeted kNotB = SkBudgeted::kNo;
//--------------------------------------------------------------------------------------------
TestCase gOverlappingTests[] = {
//----------------------------------------------------------------------------------------
// Two proxies with overlapping intervals and compatible descriptors should never share
// RT version
{ { 64, kRT, kRGBA, kA, 1, kTL, kNotB }, { 64, kRT, kRGBA, kA, 1, kTL, kNotB }, kDontShare },
// non-RT version
{ { 64, kNotRT, kRGBA, kA, 1, kTL, kNotB }, { 64, kNotRT, kRGBA, kA, 1, kTL, kNotB }, kDontShare },
//----------------------------------------------------------------------------------------
// Two proxies with overlapping intervals and compatible descriptors should never share
// RT version
{{64, kRT, kRGBA, kA, 1, kNotB}, {64, kRT, kRGBA, kA, 1, kNotB}, kDontShare},
// non-RT version
{{64, kNotRT, kRGBA, kA, 1, kNotB}, {64, kNotRT, kRGBA, kA, 1, kNotB}, kDontShare},
};
for (auto test : gOverlappingTests) {
@ -174,31 +169,37 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceAllocatorTest, reporter, ctxInfo) {
//--------------------------------------------------------------------------------------------
TestCase gNonOverlappingTests[] = {
//----------------------------------------------------------------------------------------
// Two non-overlapping intervals w/ compatible proxies should share
// both same size & approx
{ { 64, kRT, kRGBA, kA, 1, kTL, kNotB }, { 64, kRT, kRGBA, kA, 1, kTL, kNotB }, kShare },
{ { 64, kNotRT, kRGBA, kA, 1, kTL, kNotB }, { 64, kNotRT, kRGBA, kA, 1, kTL, kNotB }, kConditionallyShare },
// diffs sizes but still approx
{ { 64, kRT, kRGBA, kA, 1, kTL, kNotB }, { 50, kRT, kRGBA, kA, 1, kTL, kNotB }, kShare },
{ { 64, kNotRT, kRGBA, kA, 1, kTL, kNotB }, { 50, kNotRT, kRGBA, kA, 1, kTL, kNotB }, kConditionallyShare },
// sames sizes but exact
{ { 64, kRT, kRGBA, kE, 1, kTL, kNotB }, { 64, kRT, kRGBA, kE, 1, kTL, kNotB }, kShare },
{ { 64, kNotRT, kRGBA, kE, 1, kTL, kNotB }, { 64, kNotRT, kRGBA, kE, 1, kTL, kNotB }, kConditionallyShare },
//----------------------------------------------------------------------------------------
// Two non-overlapping intervals w/ different exact sizes should not share
{ { 56, kRT, kRGBA, kE, 1, kTL, kNotB }, { 54, kRT, kRGBA, kE, 1, kTL, kNotB }, kDontShare },
// Two non-overlapping intervals w/ _very different_ approx sizes should not share
{ { 255, kRT, kRGBA, kA, 1, kTL, kNotB }, { 127, kRT, kRGBA, kA, 1, kTL, kNotB }, kDontShare },
// Two non-overlapping intervals w/ different MSAA sample counts should not share
{ { 64, kRT, kRGBA, kA, k2, kTL, kNotB },{ 64, kRT, kRGBA, kA, k4,kTL, kNotB}, k2 == k4 },
// Two non-overlapping intervals w/ different configs should not share
{ { 64, kRT, kRGBA, kA, 1, kTL, kNotB }, { 64, kRT, kAlpha, kA, 1, kTL, kNotB }, kDontShare },
// Two non-overlapping intervals w/ different RT classifications should never share
{ { 64, kRT, kRGBA, kA, 1, kTL, kNotB }, { 64, kNotRT, kRGBA, kA, 1, kTL, kNotB }, kDontShare },
{ { 64, kNotRT, kRGBA, kA, 1, kTL, kNotB }, { 64, kRT, kRGBA, kA, 1, kTL, kNotB }, kDontShare },
// Two non-overlapping intervals w/ different origins should share
{ { 64, kRT, kRGBA, kA, 1, kTL, kNotB }, { 64, kRT, kRGBA, kA, 1, kBL, kNotB }, kShare },
//----------------------------------------------------------------------------------------
// Two non-overlapping intervals w/ compatible proxies should share
// both same size & approx
{{64, kRT, kRGBA, kA, 1, kNotB}, {64, kRT, kRGBA, kA, 1, kNotB}, kShare},
{{64, kNotRT, kRGBA, kA, 1, kNotB},
{64, kNotRT, kRGBA, kA, 1, kNotB},
kConditionallyShare},
// diffs sizes but still approx
{{64, kRT, kRGBA, kA, 1, kNotB}, {50, kRT, kRGBA, kA, 1, kNotB}, kShare},
{{64, kNotRT, kRGBA, kA, 1, kNotB},
{50, kNotRT, kRGBA, kA, 1, kNotB},
kConditionallyShare},
// sames sizes but exact
{{64, kRT, kRGBA, kE, 1, kNotB}, {64, kRT, kRGBA, kE, 1, kNotB}, kShare},
{{64, kNotRT, kRGBA, kE, 1, kNotB},
{64, kNotRT, kRGBA, kE, 1, kNotB},
kConditionallyShare},
//----------------------------------------------------------------------------------------
// Two non-overlapping intervals w/ different exact sizes should not share
{{56, kRT, kRGBA, kE, 1, kNotB}, {54, kRT, kRGBA, kE, 1, kNotB}, kDontShare},
// Two non-overlapping intervals w/ _very different_ approx sizes should not share
{{255, kRT, kRGBA, kA, 1, kNotB}, {127, kRT, kRGBA, kA, 1, kNotB}, kDontShare},
// Two non-overlapping intervals w/ different MSAA sample counts should not share
{{64, kRT, kRGBA, kA, k2, kNotB}, {64, kRT, kRGBA, kA, k4, kNotB}, k2 == k4},
// Two non-overlapping intervals w/ different configs should not share
{{64, kRT, kRGBA, kA, 1, kNotB}, {64, kRT, kAlpha, kA, 1, kNotB}, kDontShare},
// Two non-overlapping intervals w/ different RT classifications should never share
{{64, kRT, kRGBA, kA, 1, kNotB}, {64, kNotRT, kRGBA, kA, 1, kNotB}, kDontShare},
{{64, kNotRT, kRGBA, kA, 1, kNotB}, {64, kRT, kRGBA, kA, 1, kNotB}, kDontShare},
// Two non-overlapping intervals w/ different origins should share
{{64, kRT, kRGBA, kA, 1, kNotB}, {64, kRT, kRGBA, kA, 1, kNotB}, kShare},
};
for (auto test : gNonOverlappingTests) {
@ -216,8 +217,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceAllocatorTest, reporter, ctxInfo) {
{
// Wrapped backend textures should never be reused
TestCase t[1] = {
{ { 64, kNotRT, kRGBA, kE, 1, kTL, kNotB }, { 64, kNotRT, kRGBA, kE, 1, kTL, kNotB }, kDontShare }
};
{{64, kNotRT, kRGBA, kE, 1, kNotB}, {64, kNotRT, kRGBA, kE, 1, kNotB}, kDontShare}};
GrBackendTexture backEndTex;
sk_sp<GrSurfaceProxy> p1 = make_backend(ctxInfo.grContext(), t[0].fP1, &backEndTex);
@ -279,9 +279,9 @@ sk_sp<GrSurfaceProxy> make_lazy(GrProxyProvider* proxyProvider, const GrCaps* ca
GrInternalSurfaceFlags flags = GrInternalSurfaceFlags::kNone;
GrSwizzle readSwizzle = caps->getReadSwizzle(format, p.fColorType);
return proxyProvider->createLazyProxy(
callback, format, dims, readSwizzle, p.fRenderable, p.fSampleCnt, p.fOrigin,
GrMipMapped::kNo, GrMipMapsStatus::kNotAllocated, flags, p.fFit, p.fBudgeted,
GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
callback, format, dims, readSwizzle, p.fRenderable, p.fSampleCnt, GrMipMapped::kNo,
GrMipMapsStatus::kNotAllocated, flags, p.fFit, p.fBudgeted, GrProtected::kNo,
GrSurfaceProxy::UseAllocator::kYes);
}
// Set up so there are two opsTasks that need to be flushed but the resource allocator thinks
@ -298,9 +298,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceAllocatorOverBudgetTest, reporter, ct
// Force the resource allocator to always believe it is over budget
context->setResourceCacheLimit(0);
const ProxyParams params = { 64, GrRenderable::kNo, GrColorType::kRGBA_8888,
SkBackingFit::kExact, 1, kTopLeft_GrSurfaceOrigin,
SkBudgeted::kYes };
const ProxyParams params = {
64, GrRenderable::kNo, GrColorType::kRGBA_8888, SkBackingFit::kExact,
1, SkBudgeted::kYes};
{
sk_sp<GrSurfaceProxy> p1 = make_deferred(proxyProvider, caps, params);
@ -358,7 +358,6 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceAllocatorCurOpsTaskIndexTest,
ProxyParams params;
params.fFit = SkBackingFit::kExact;
params.fOrigin = kTopLeft_GrSurfaceOrigin;
params.fColorType = GrColorType::kRGBA_8888;
params.fRenderable = GrRenderable::kYes;
params.fSampleCnt = 1;

View File

@ -1624,11 +1624,9 @@ static sk_sp<GrTextureProxy> make_mipmap_proxy(GrContext* context,
const GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kRGBA_8888,
GrRenderable::kNo);
auto origin = renderable == GrRenderable::kYes ? kBottomLeft_GrSurfaceOrigin
: kTopLeft_GrSurfaceOrigin;
GrSwizzle swizzle = caps->getReadSwizzle(format, GrColorType::kRGBA_8888);
return proxyProvider->createProxy(format, dims, swizzle, renderable, sampleCnt, origin,
return proxyProvider->createProxy(format, dims, swizzle, renderable, sampleCnt,
GrMipMapped::kYes, SkBackingFit::kExact, SkBudgeted::kYes,
GrProtected::kNo);
}

View File

@ -37,9 +37,9 @@ static sk_sp<GrTextureProxy> deferred_tex(skiatest::Reporter* reporter, GrContex
GrBackendFormat format = caps->getDefaultBackendFormat(kColorType, GrRenderable::kNo);
GrSwizzle swizzle = caps->getReadSwizzle(format, kColorType);
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
format, kSize, swizzle, GrRenderable::kNo, 1, kBottomLeft_GrSurfaceOrigin,
GrMipMapped::kNo, fit, SkBudgeted::kYes, GrProtected::kNo);
sk_sp<GrTextureProxy> proxy =
proxyProvider->createProxy(format, kSize, swizzle, GrRenderable::kNo, 1,
GrMipMapped::kNo, fit, SkBudgeted::kYes, GrProtected::kNo);
// Only budgeted & wrapped external proxies get to carry uniqueKeys
REPORTER_ASSERT(reporter, !proxy->getUniqueKey().isValid());
return proxy;
@ -52,9 +52,9 @@ static sk_sp<GrTextureProxy> deferred_texRT(skiatest::Reporter* reporter, GrCont
GrBackendFormat format = caps->getDefaultBackendFormat(kColorType, GrRenderable::kYes);
GrSwizzle swizzle = caps->getReadSwizzle(format, kColorType);
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
format, kSize, swizzle, GrRenderable::kYes, 1, kBottomLeft_GrSurfaceOrigin,
GrMipMapped::kNo, fit, SkBudgeted::kYes, GrProtected::kNo);
sk_sp<GrTextureProxy> proxy =
proxyProvider->createProxy(format, kSize, swizzle, GrRenderable::kYes, 1,
GrMipMapped::kNo, fit, SkBudgeted::kYes, GrProtected::kNo);
// Only budgeted & wrapped external proxies get to carry uniqueKeys
REPORTER_ASSERT(reporter, !proxy->getUniqueKey().isValid());
return proxy;
@ -63,8 +63,7 @@ static sk_sp<GrTextureProxy> deferred_texRT(skiatest::Reporter* reporter, GrCont
static sk_sp<GrTextureProxy> wrapped(skiatest::Reporter* reporter, GrContext* ctx,
GrProxyProvider* proxyProvider, SkBackingFit fit) {
sk_sp<GrTextureProxy> proxy = proxyProvider->testingOnly_createInstantiatedProxy(
kSize, kColorType, GrRenderable::kNo, 1, kBottomLeft_GrSurfaceOrigin, fit,
SkBudgeted::kYes, GrProtected::kNo);
kSize, kColorType, GrRenderable::kNo, 1, fit, SkBudgeted::kYes, GrProtected::kNo);
// Only budgeted & wrapped external proxies get to carry uniqueKeys
REPORTER_ASSERT(reporter, !proxy->getUniqueKey().isValid());
return proxy;
@ -83,8 +82,7 @@ static sk_sp<GrTextureProxy> wrapped_with_key(skiatest::Reporter* reporter, GrCo
// Only budgeted & wrapped external proxies get to carry uniqueKeys
sk_sp<GrTextureProxy> proxy = proxyProvider->testingOnly_createInstantiatedProxy(
kSize, kColorType, GrRenderable::kNo, 1, kBottomLeft_GrSurfaceOrigin, fit,
SkBudgeted::kYes, GrProtected::kNo);
kSize, kColorType, GrRenderable::kNo, 1, fit, SkBudgeted::kYes, GrProtected::kNo);
SkAssertResult(proxyProvider->assignUniqueKeyToProxy(key, proxy.get()));
REPORTER_ASSERT(reporter, proxy->getUniqueKey().isValid());
return proxy;
@ -108,8 +106,8 @@ static sk_sp<GrTextureProxy> create_wrapped_backend(GrContext* context, SkBackin
GrBackendTexture backendTex = (*backingSurface)->getBackendTexture();
return proxyProvider->wrapBackendTexture(backendTex, GrColorType::kRGBA_8888,
kBottomLeft_GrSurfaceOrigin, kBorrow_GrWrapOwnership,
GrWrapCacheable::kYes, kRead_GrIOType);
kBorrow_GrWrapOwnership, GrWrapCacheable::kYes,
kRead_GrIOType);
}
@ -145,8 +143,7 @@ static void basic_test(GrContext* context,
REPORTER_ASSERT(reporter, key == proxy->getUniqueKey());
// We just added it, surely we can find it
REPORTER_ASSERT(reporter, proxyProvider->findOrCreateProxyByUniqueKey(
key, kColorType, kBottomLeft_GrSurfaceOrigin));
REPORTER_ASSERT(reporter, proxyProvider->findOrCreateProxyByUniqueKey(key, kColorType));
REPORTER_ASSERT(reporter, 1 == proxyProvider->numUniqueKeyProxies_TestOnly());
int expectedCacheCount = startCacheCount + (proxy->isInstantiated() ? 0 : 1);
@ -177,8 +174,7 @@ static void basic_test(GrContext* context,
REPORTER_ASSERT(reporter, expectedCacheCount == cache->getResourceCount());
// If the proxy was cached refinding it should bring it back to life
proxy = proxyProvider->findOrCreateProxyByUniqueKey(key, kColorType,
kBottomLeft_GrSurfaceOrigin);
proxy = proxyProvider->findOrCreateProxyByUniqueKey(key, kColorType);
REPORTER_ASSERT(reporter, proxy);
REPORTER_ASSERT(reporter, 1 == proxyProvider->numUniqueKeyProxies_TestOnly());
REPORTER_ASSERT(reporter, expectedCacheCount == cache->getResourceCount());
@ -193,8 +189,7 @@ static void basic_test(GrContext* context,
// If the texture was deleted then the proxy should no longer be findable. Otherwise, it should
// be.
proxy = proxyProvider->findOrCreateProxyByUniqueKey(key, kColorType,
kBottomLeft_GrSurfaceOrigin);
proxy = proxyProvider->findOrCreateProxyByUniqueKey(key, kColorType);
REPORTER_ASSERT(reporter, expectResourceToOutliveProxy ? (bool)proxy : !proxy);
REPORTER_ASSERT(reporter, expectedCacheCount == cache->getResourceCount());
@ -204,8 +199,7 @@ static void basic_test(GrContext* context,
SkMessageBus<GrUniqueKeyInvalidatedMessage>::Post(msg);
cache->purgeAsNeeded();
expectedCacheCount--;
proxy = proxyProvider->findOrCreateProxyByUniqueKey(key, kColorType,
kBottomLeft_GrSurfaceOrigin);
proxy = proxyProvider->findOrCreateProxyByUniqueKey(key, kColorType);
REPORTER_ASSERT(reporter, !proxy);
REPORTER_ASSERT(reporter, expectedCacheCount == cache->getResourceCount());
}

View File

@ -531,8 +531,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixelsPendingIO, reporter, ctxInfo) {
GrSwizzle swizzle = caps->getReadSwizzle(format, GrColorType::kRGBA_8888);
sk_sp<GrTextureProxy> temp = proxyProvider->createProxy(
format, kDims, swizzle, GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin,
GrMipMapped::kNo, SkBackingFit::kApprox, SkBudgeted::kYes, GrProtected::kNo);
format, kDims, swizzle, GrRenderable::kNo, 1, GrMipMapped::kNo,
SkBackingFit::kApprox, SkBudgeted::kYes, GrProtected::kNo);
temp->instantiate(context->priv().resourceProvider());
}

View File

@ -38,7 +38,7 @@ sk_sp<GrTextureProxy> MakeTextureProxyFromData(GrContext* context,
sk_sp<GrTextureProxy> proxy;
proxy = context->priv().proxyProvider()->createProxy(
format, imageInfo.dimensions(), swizzle, renderable, 1, origin, GrMipMapped::kNo,
format, imageInfo.dimensions(), swizzle, renderable, 1, GrMipMapped::kNo,
SkBackingFit::kExact, SkBudgeted::kYes, GrProtected::kNo);
if (!proxy) {
return nullptr;