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>
diff --git a/tests/BulkRectTest.cpp b/tests/BulkRectTest.cpp
index fb8ae62..fd3fb02 100644
--- a/tests/BulkRectTest.cpp
+++ b/tests/BulkRectTest.cpp
@@ -26,9 +26,8 @@
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);
diff --git a/tests/DetermineDomainModeTest.cpp b/tests/DetermineDomainModeTest.cpp
index d59258d..62fc973 100644
--- a/tests/DetermineDomainModeTest.cpp
+++ b/tests/DetermineDomainModeTest.cpp
@@ -146,8 +146,7 @@
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,
diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp
index 6d7901c..b61a08b 100644
--- a/tests/EGLImageTest.cpp
+++ b/tests/EGLImageTest.cpp
@@ -161,8 +161,7 @@
// 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);
diff --git a/tests/GrMipMappedTest.cpp b/tests/GrMipMappedTest.cpp
index 3ba8ba0..1005d7b 100644
--- a/tests/GrMipMappedTest.cpp
+++ b/tests/GrMipMappedTest.cpp
@@ -351,8 +351,7 @@
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 @@
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().
diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp
index 1219e6b..6f70933 100644
--- a/tests/GrPorterDuffTest.cpp
+++ b/tests/GrPorterDuffTest.cpp
@@ -1004,8 +1004,8 @@
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});
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp
index 29b7c29..65288c4 100644
--- a/tests/GrSurfaceTest.cpp
+++ b/tests/GrSurfaceTest.cpp
@@ -119,73 +119,64 @@
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 @@
// 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 @@
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 @@
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 @@
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 @@
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 @@
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();
diff --git a/tests/GrTestingBackendTextureUploadTest.cpp b/tests/GrTestingBackendTextureUploadTest.cpp
index 884ed88..126f72d 100644
--- a/tests/GrTestingBackendTextureUploadTest.cpp
+++ b/tests/GrTestingBackendTextureUploadTest.cpp
@@ -63,12 +63,11 @@
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);
diff --git a/tests/LazyProxyTest.cpp b/tests/LazyProxyTest.cpp
index 341286e..819e2b9 100644
--- a/tests/LazyProxyTest.cpp
+++ b/tests/LazyProxyTest.cpp
@@ -101,8 +101,7 @@
}
},
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 @@
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 @@
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 @@
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());
diff --git a/tests/MtlCopySurfaceTest.mm b/tests/MtlCopySurfaceTest.mm
index 9a716f1..a151593 100644
--- a/tests/MtlCopySurfaceTest.mm
+++ b/tests/MtlCopySurfaceTest.mm
@@ -42,8 +42,7 @@
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,
diff --git a/tests/OnFlushCallbackTest.cpp b/tests/OnFlushCallbackTest.cpp
index bc0e8a1..96cfa6b 100644
--- a/tests/OnFlushCallbackTest.cpp
+++ b/tests/OnFlushCallbackTest.cpp
@@ -330,7 +330,6 @@
GrRenderable::kYes,
1,
GrProtected::kNo,
- kBottomLeft_GrSurfaceOrigin,
*proxyProvider->caps(),
GrSurfaceProxy::UseAllocator::kNo);
diff --git a/tests/OpChainTest.cpp b/tests/OpChainTest.cpp
index dcce574..366894b 100644
--- a/tests/OpChainTest.cpp
+++ b/tests/OpChainTest.cpp
@@ -175,8 +175,8 @@
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());
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index 7ed9fe9..c89a750 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -162,8 +162,8 @@
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;
diff --git a/tests/ProgramsTest.cpp b/tests/ProgramsTest.cpp
index b12ec52..dd69a0c 100644
--- a/tests/ProgramsTest.cpp
+++ b/tests/ProgramsTest.cpp
@@ -268,8 +268,7 @@
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 @@
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};
diff --git a/tests/ProxyConversionTest.cpp b/tests/ProxyConversionTest.cpp
index fb0fdfa..169bb09 100644
--- a/tests/ProxyConversionTest.cpp
+++ b/tests/ProxyConversionTest.cpp
@@ -23,11 +23,10 @@
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 @@
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 @@
{
// 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 @@
{
// 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 @@
{
// 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 @@
{
// 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 @@
{
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 @@
{
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 @@
{
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);
diff --git a/tests/ProxyRefTest.cpp b/tests/ProxyRefTest.cpp
index 4354378..9e1dd4d 100644
--- a/tests/ProxyRefTest.cpp
+++ b/tests/ProxyRefTest.cpp
@@ -28,9 +28,8 @@
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 @@
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) {
diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp
index 368961c..27a0db0 100644
--- a/tests/ProxyTest.cpp
+++ b/tests/ProxyTest.cpp
@@ -113,92 +113,89 @@
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 @@
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 @@
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);
}
}
diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp
index 2070d53..d30cf89 100644
--- a/tests/RectangleTextureTest.cpp
+++ b/tests/RectangleTextureTest.cpp
@@ -167,8 +167,8 @@
}
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.");
diff --git a/tests/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp
index ef9039a..af24b24 100644
--- a/tests/ResourceAllocatorTest.cpp
+++ b/tests/ResourceAllocatorTest.cpp
@@ -26,7 +26,6 @@
GrColorType fColorType;
SkBackingFit fFit;
int fSampleCnt;
- GrSurfaceOrigin fOrigin;
SkBudgeted fBudgeted;
// TODO: do we care about mipmapping
};
@@ -37,8 +36,8 @@
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 @@
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 @@
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 @@
//--------------------------------------------------------------------------------------------
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 @@
{
// 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 @@
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 @@
// 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 @@
ProxyParams params;
params.fFit = SkBackingFit::kExact;
- params.fOrigin = kTopLeft_GrSurfaceOrigin;
params.fColorType = GrColorType::kRGBA_8888;
params.fRenderable = GrRenderable::kYes;
params.fSampleCnt = 1;
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index 3eb5308..bc9bb18 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -1624,11 +1624,9 @@
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);
}
diff --git a/tests/TextureProxyTest.cpp b/tests/TextureProxyTest.cpp
index 1a503eb..8f70e68 100644
--- a/tests/TextureProxyTest.cpp
+++ b/tests/TextureProxyTest.cpp
@@ -37,9 +37,9 @@
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 @@
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> 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 @@
// 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 @@
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 @@
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 @@
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 @@
// 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 @@
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());
}
diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp
index c11bd69..92cb71c 100644
--- a/tests/WritePixelsTest.cpp
+++ b/tests/WritePixelsTest.cpp
@@ -531,8 +531,8 @@
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());
}