Remove GrSurfaceOrigin from GrSurfaceDesc.
This field has no interpretation at the GrTexture/GrGpu as the orientation is
handled at the GrSurfaceProxy level.
This change requires GrGpu to accept a GrSurfaceOrigin when creating a texture with initial data. The origin refers to the texel data to be uploaded. Longer term the plan is to remove this and require the data to be kTopLeft. Additionally, kBottomLeft will only be allowed for wrapped texture/RTs as this evolves.
Change-Id: I7d25b0199aafd9bf3b74c39b2cae451acadcd772
Reviewed-on: https://skia-review.googlesource.com/111806
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/tests/BlendTest.cpp b/tests/BlendTest.cpp
index 3ac7e3c..5332b10 100644
--- a/tests/BlendTest.cpp
+++ b/tests/BlendTest.cpp
@@ -89,7 +89,6 @@
sk_sp<GrTexture>* backingSurface) {
GrSurfaceDesc backingDesc;
backingDesc.fFlags = kRenderTarget_GrSurfaceFlag;
- backingDesc.fOrigin = origin;
backingDesc.fWidth = width;
backingDesc.fHeight = height;
backingDesc.fConfig = config;
diff --git a/tests/CopySurfaceTest.cpp b/tests/CopySurfaceTest.cpp
index b8ccb1f..b373258 100644
--- a/tests/CopySurfaceTest.cpp
+++ b/tests/CopySurfaceTest.cpp
@@ -1,3 +1,4 @@
+
/*
* Copyright 2016 Google Inc.
*
@@ -69,16 +70,14 @@
for (auto srcRect : kSrcRects) {
for (auto dstPoint : kDstPoints) {
GrSurfaceDesc srcDesc = baseDesc;
- srcDesc.fOrigin = sOrigin;
srcDesc.fFlags = sFlags;
GrSurfaceDesc dstDesc = baseDesc;
- dstDesc.fOrigin = dOrigin;
dstDesc.fFlags = dFlags;
sk_sp<GrTextureProxy> src = proxyProvider->createTextureProxy(
- srcDesc, SkBudgeted::kNo, srcPixels.get(), kRowBytes);
+ srcDesc, sOrigin, SkBudgeted::kNo, srcPixels.get(), kRowBytes);
sk_sp<GrTextureProxy> dst = proxyProvider->createTextureProxy(
- dstDesc, SkBudgeted::kNo, dstPixels.get(), kRowBytes);
+ dstDesc, dOrigin, SkBudgeted::kNo, dstPixels.get(), kRowBytes);
if (!src || !dst) {
ERRORF(reporter,
"Could not create surfaces for copy surface test.");
diff --git a/tests/DetermineDomainModeTest.cpp b/tests/DetermineDomainModeTest.cpp
index 7833da4..9c9e198 100644
--- a/tests/DetermineDomainModeTest.cpp
+++ b/tests/DetermineDomainModeTest.cpp
@@ -119,7 +119,6 @@
SkBackingFit fit = isExact ? SkBackingFit::kExact : SkBackingFit::kApprox;
GrSurfaceDesc desc;
- desc.fOrigin = kTopLeft_GrSurfaceOrigin;
desc.fWidth = size;
desc.fHeight = size;
desc.fConfig = kRGBA_8888_GrPixelConfig;
@@ -134,7 +133,7 @@
(isPowerOfTwo || isExact) ? RectInfo::kHard : RectInfo::kBad,
name);
- return proxyProvider->createProxy(desc, fit, SkBudgeted::kYes);
+ return proxyProvider->createProxy(desc, kTopLeft_GrSurfaceOrigin, fit, SkBudgeted::kYes);
}
static RectInfo::EdgeType compute_inset_edgetype(RectInfo::EdgeType previous,
diff --git a/tests/FloatingPointTextureTest.cpp b/tests/FloatingPointTextureTest.cpp
index 9a06d2d..6d2beb3 100644
--- a/tests/FloatingPointTextureTest.cpp
+++ b/tests/FloatingPointTextureTest.cpp
@@ -45,16 +45,15 @@
controlPixelData[i + 3] = maxInt;
}
- for (int origin = 0; origin < 2; ++origin) {
+ for (auto origin : {kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin}) {
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fOrigin = 0 == origin ? kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin;
desc.fWidth = DEV_W;
desc.fHeight = DEV_H;
desc.fConfig = GrColorTypeToPixelConfig(colorType, GrSRGBEncoded::kNo);
sk_sp<GrTextureProxy> fpProxy = proxyProvider->createTextureProxy(
- desc, SkBudgeted::kNo, controlPixelData.begin(), 0);
+ desc, origin, SkBudgeted::kNo, controlPixelData.begin(), 0);
// Floating point textures are NOT supported everywhere
if (!fpProxy) {
continue;
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index f625a77..1384e38 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -272,20 +272,20 @@
{
GrSurfaceDesc dummyDesc;
dummyDesc.fFlags = kRenderTarget_GrSurfaceFlag;
- dummyDesc.fOrigin = kBottomLeft_GrSurfaceOrigin;
dummyDesc.fWidth = 34;
dummyDesc.fHeight = 18;
dummyDesc.fConfig = kRGBA_8888_GrPixelConfig;
- proxies[0] = proxyProvider->createProxy(dummyDesc, SkBackingFit::kExact, SkBudgeted::kNo);
+ proxies[0] = proxyProvider->createProxy(dummyDesc, kBottomLeft_GrSurfaceOrigin,
+ SkBackingFit::kExact, SkBudgeted::kNo);
}
{
GrSurfaceDesc dummyDesc;
dummyDesc.fFlags = kNone_GrSurfaceFlags;
- dummyDesc.fOrigin = kTopLeft_GrSurfaceOrigin;
dummyDesc.fWidth = 16;
dummyDesc.fHeight = 22;
dummyDesc.fConfig = kAlpha_8_GrPixelConfig;
- proxies[1] = proxyProvider->createProxy(dummyDesc, SkBackingFit::kExact, SkBudgeted::kNo);
+ proxies[1] = proxyProvider->createProxy(dummyDesc, kTopLeft_GrSurfaceOrigin,
+ SkBackingFit::kExact, SkBudgeted::kNo);
}
if (!proxies[0] || !proxies[1]) {
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp
index a645f99..daef511 100644
--- a/tests/GrSurfaceTest.cpp
+++ b/tests/GrSurfaceTest.cpp
@@ -29,7 +29,6 @@
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
desc.fWidth = 256;
desc.fHeight = 256;
desc.fConfig = kRGBA_8888_GrPixelConfig;
@@ -46,7 +45,6 @@
static_cast<GrSurface*>(texRT1->asTexture()));
desc.fFlags = kNone_GrSurfaceFlags;
- desc.fOrigin = kTopLeft_GrSurfaceOrigin;
sk_sp<GrTexture> tex1 = resourceProvider->createTexture(desc, SkBudgeted::kNo);
REPORTER_ASSERT(reporter, nullptr == tex1->asRenderTarget());
REPORTER_ASSERT(reporter, tex1.get() == tex1->asTexture());
@@ -108,7 +106,6 @@
for (GrPixelConfig config : configs) {
for (GrSurfaceOrigin origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) {
desc.fFlags = kNone_GrSurfaceFlags;
- desc.fOrigin = origin;
desc.fConfig = config;
desc.fSampleCnt = 1;
@@ -117,8 +114,8 @@
REPORTER_ASSERT(reporter, SkToBool(tex) == ict,
"config:%d, tex:%d, isConfigTexturable:%d", config, SkToBool(tex), ict);
- sk_sp<GrTextureProxy> proxy = proxyProvider->createMipMapProxy(
- desc, SkBudgeted::kNo);
+ sk_sp<GrTextureProxy> proxy =
+ proxyProvider->createMipMapProxy(desc, origin, SkBudgeted::kNo);
REPORTER_ASSERT(reporter, SkToBool(proxy.get()) ==
(caps->isConfigTexturable(desc.fConfig) &&
caps->mipMapSupport()));
@@ -170,13 +167,12 @@
desc.fFlags |= rt ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags;
for (GrSurfaceOrigin origin :
{kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin}) {
- desc.fOrigin = origin;
for (auto fit : { SkBackingFit::kApprox, SkBackingFit::kExact }) {
// Try directly creating the texture.
// Do this twice in an attempt to hit the cache on the second time through.
for (int i = 0; i < 2; ++i) {
sk_sp<GrTextureProxy> proxy = proxyProvider->createInstantiatedProxy(
- desc, fit, SkBudgeted::kYes);
+ desc, origin, fit, SkBudgeted::kYes);
if (!proxy) {
continue;
}
@@ -206,7 +202,7 @@
// Try creating the texture as a deferred proxy.
for (int i = 0; i < 2; ++i) {
auto surfCtx = context->contextPriv().makeDeferredSurfaceContext(
- desc, GrMipMapped::kNo, fit, SkBudgeted::kYes, colorSpace);
+ desc, origin, GrMipMapped::kNo, fit, SkBudgeted::kYes, colorSpace);
if (!surfCtx) {
continue;
}
diff --git a/tests/ImageFilterCacheTest.cpp b/tests/ImageFilterCacheTest.cpp
index 3105e9b..a2409dc 100644
--- a/tests/ImageFilterCacheTest.cpp
+++ b/tests/ImageFilterCacheTest.cpp
@@ -192,12 +192,11 @@
GrSurfaceDesc desc;
desc.fFlags = kNone_GrSurfaceFlags;
- desc.fOrigin = kTopLeft_GrSurfaceOrigin;
desc.fWidth = kFullSize;
desc.fHeight = kFullSize;
desc.fConfig = kRGBA_8888_GrPixelConfig;
- return proxyProvider->createTextureProxy(desc, SkBudgeted::kYes,
+ return proxyProvider->createTextureProxy(desc, kTopLeft_GrSurfaceOrigin, SkBudgeted::kYes,
srcBM.getPixels(), srcBM.rowBytes());
}
diff --git a/tests/LazyProxyTest.cpp b/tests/LazyProxyTest.cpp
index aca9b56..da83dcb 100644
--- a/tests/LazyProxyTest.cpp
+++ b/tests/LazyProxyTest.cpp
@@ -70,7 +70,6 @@
GrSurfaceDesc desc;
desc.fWidth = 1234;
desc.fHeight = 567;
- desc.fOrigin = kTopLeft_GrSurfaceOrigin;
desc.fConfig = kRGB_565_GrPixelConfig;
sk_sp<GrTexture> texture = rp->createTexture(desc, SkBudgeted::kYes);
REPORTER_ASSERT(fTest->fReporter, texture);
@@ -228,7 +227,9 @@
}
*testCountPtr = 1;
return sk_sp<GrTexture>();
- }, desc, GrMipMapped::kNo, SkBackingFit::kExact, SkBudgeted::kNo);
+ },
+ desc, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo, SkBackingFit::kExact,
+ SkBudgeted::kNo);
proxy->priv().testingOnly_setLazyInstantiationType(lazyType);
@@ -267,7 +268,7 @@
desc.fConfig = kRGBA_8888_GrPixelConfig;
fLazyProxy = proxyProvider->createLazyProxy(
- [testExecuteValue, shouldFailInstantiation, desc] (GrResourceProvider* rp) {
+ [testExecuteValue, shouldFailInstantiation, desc](GrResourceProvider* rp) {
if (!rp) {
return sk_sp<GrTexture>();
}
@@ -276,7 +277,9 @@
return sk_sp<GrTexture>();
}
return rp->createTexture(desc, SkBudgeted::kNo);
- }, desc, GrMipMapped::kNo, SkBackingFit::kExact, SkBudgeted::kNo);
+ },
+ desc, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo, SkBackingFit::kExact,
+ SkBudgeted::kNo);
this->setBounds(SkRect::MakeIWH(kSize, kSize),
HasAABloat::kNo, IsZeroArea::kNo);
diff --git a/tests/OnFlushCallbackTest.cpp b/tests/OnFlushCallbackTest.cpp
index 62f6c0f..5cd3bcd 100644
--- a/tests/OnFlushCallbackTest.cpp
+++ b/tests/OnFlushCallbackTest.cpp
@@ -302,7 +302,6 @@
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
// TODO: until partial flushes in MDB lands we're stuck having
// all 9 atlas draws occur
desc.fWidth = 9 /*this->numOps()*/ * kAtlasTileSize;
diff --git a/tests/PackedConfigsTextureTest.cpp b/tests/PackedConfigsTextureTest.cpp
index 0555fc4..0ac322d 100644
--- a/tests/PackedConfigsTextureTest.cpp
+++ b/tests/PackedConfigsTextureTest.cpp
@@ -118,10 +118,9 @@
desc.fWidth = DEV_W;
desc.fHeight = DEV_H;
desc.fConfig = config;
- desc.fOrigin = origin;
sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy(
- desc, SkBudgeted::kNo, controlPixelData.begin(), 0);
+ desc, origin, SkBudgeted::kNo, controlPixelData.begin(), 0);
SkASSERT(proxy);
sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeWrappedSurfaceContext(
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index 2325a9a..aea5208 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -161,7 +161,6 @@
GrResourceProvider* resourceProvider = context->contextPriv().resourceProvider();
GrSurfaceDesc desc;
- desc.fOrigin = kTopLeft_GrSurfaceOrigin;
desc.fWidth = 10;
desc.fHeight = 10;
desc.fConfig = kRGBA_8888_GrPixelConfig;
@@ -169,18 +168,18 @@
for (bool makeClone : {false, true}) {
for (int parentCnt = 0; parentCnt < 2; parentCnt++) {
sk_sp<GrRenderTargetContext> renderTargetContext(
- context->makeDeferredRenderTargetContext( SkBackingFit::kApprox, 1, 1,
- kRGBA_8888_GrPixelConfig, nullptr));
+ context->makeDeferredRenderTargetContext(SkBackingFit::kApprox, 1, 1,
+ kRGBA_8888_GrPixelConfig, nullptr));
{
bool texelBufferSupport = context->caps()->shaderCaps()->texelBufferSupport();
- sk_sp<GrTextureProxy> proxy1 =
- proxyProvider->createProxy(desc, SkBackingFit::kExact, SkBudgeted::kYes);
- sk_sp<GrTextureProxy> proxy2 =
- proxyProvider->createProxy(desc, SkBackingFit::kExact, SkBudgeted::kYes);
- sk_sp<GrTextureProxy> proxy3 =
- proxyProvider->createProxy(desc, SkBackingFit::kExact, SkBudgeted::kYes);
- sk_sp<GrTextureProxy> proxy4 =
- proxyProvider->createProxy(desc, SkBackingFit::kExact, SkBudgeted::kYes);
+ sk_sp<GrTextureProxy> proxy1 = proxyProvider->createProxy(
+ desc, kTopLeft_GrSurfaceOrigin, SkBackingFit::kExact, SkBudgeted::kYes);
+ sk_sp<GrTextureProxy> proxy2 = proxyProvider->createProxy(
+ desc, kTopLeft_GrSurfaceOrigin, SkBackingFit::kExact, SkBudgeted::kYes);
+ sk_sp<GrTextureProxy> proxy3 = proxyProvider->createProxy(
+ desc, kTopLeft_GrSurfaceOrigin, SkBackingFit::kExact, SkBudgeted::kYes);
+ sk_sp<GrTextureProxy> proxy4 = proxyProvider->createProxy(
+ desc, kTopLeft_GrSurfaceOrigin, SkBackingFit::kExact, SkBudgeted::kYes);
sk_sp<GrBuffer> buffer(texelBufferSupport
? resourceProvider->createBuffer(
1024, GrBufferType::kTexel_GrBufferType,
@@ -294,7 +293,6 @@
sk_sp<GrTextureProxy> proxies[2]) {
static const int kTestTextureSize = 256;
GrSurfaceDesc desc;
- desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
desc.fWidth = kTestTextureSize;
desc.fHeight = kTestTextureSize;
desc.fConfig = kRGBA_8888_GrPixelConfig;
@@ -309,8 +307,8 @@
}
}
- proxies[0] = proxyProvider->createTextureProxy(desc, SkBudgeted::kYes,
- rgbaData.get(),
+ proxies[0] = proxyProvider->createTextureProxy(desc, kBottomLeft_GrSurfaceOrigin,
+ SkBudgeted::kYes, rgbaData.get(),
kTestTextureSize * sizeof(GrColor));
}
@@ -324,8 +322,9 @@
}
}
- proxies[1] = proxyProvider->createTextureProxy(desc, SkBudgeted::kYes,
- alphaData.get(), kTestTextureSize);
+ proxies[1] = proxyProvider->createTextureProxy(desc, kBottomLeft_GrSurfaceOrigin,
+ SkBudgeted::kYes, alphaData.get(),
+ kTestTextureSize);
}
return proxies[0] && proxies[1];
@@ -341,12 +340,11 @@
}
}
GrSurfaceDesc desc;
- desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
desc.fWidth = width;
desc.fHeight = height;
desc.fConfig = kRGBA_8888_GrPixelConfig;
- return proxyProvider->createTextureProxy(desc, SkBudgeted::kYes,
+ return proxyProvider->createTextureProxy(desc, kBottomLeft_GrSurfaceOrigin, SkBudgeted::kYes,
data.get(), width * sizeof(GrColor));
}
diff --git a/tests/ProxyConversionTest.cpp b/tests/ProxyConversionTest.cpp
index c8b6905..a4c4a60 100644
--- a/tests/ProxyConversionTest.cpp
+++ b/tests/ProxyConversionTest.cpp
@@ -21,25 +21,28 @@
static sk_sp<GrSurfaceProxy> make_wrapped_FBO0(GrProxyProvider* provider,
skiatest::Reporter* reporter,
- const GrSurfaceDesc& desc) {
+ const GrSurfaceDesc& desc,
+ GrSurfaceOrigin origin) {
GrGLFramebufferInfo fboInfo;
fboInfo.fFBOID = 0;
GrBackendRenderTarget backendRT(desc.fWidth, desc.fHeight, desc.fSampleCnt, 8,
desc.fConfig, fboInfo);
- return provider->createWrappedRenderTargetProxy(backendRT, desc.fOrigin);
+ return provider->createWrappedRenderTargetProxy(backendRT, origin);
}
static sk_sp<GrSurfaceProxy> make_wrapped_offscreen_rt(GrProxyProvider* provider,
- const GrSurfaceDesc& desc) {
+ const GrSurfaceDesc& desc,
+ GrSurfaceOrigin origin) {
SkASSERT(kRenderTarget_GrSurfaceFlag == desc.fFlags);
- return provider->createInstantiatedProxy(desc, SkBackingFit::kExact, SkBudgeted::kYes);
+ return provider->createInstantiatedProxy(desc, origin, SkBackingFit::kExact, SkBudgeted::kYes);
}
static sk_sp<GrSurfaceProxy> make_wrapped_texture(GrProxyProvider* provider,
- const GrSurfaceDesc& desc) {
- return provider->createInstantiatedProxy(desc, SkBackingFit::kExact, SkBudgeted::kYes);
+ const GrSurfaceDesc& desc,
+ GrSurfaceOrigin origin) {
+ return provider->createInstantiatedProxy(desc, origin, SkBackingFit::kExact, SkBudgeted::kYes);
}
// Test converting between RenderTargetProxies and TextureProxies for wrapped
@@ -52,11 +55,11 @@
desc.fWidth = 64;
desc.fHeight = 64;
desc.fConfig = kRGBA_8888_GrPixelConfig;
- desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
if (kOpenGL_GrBackend == ctxInfo.backend()) {
// External on-screen render target.
- sk_sp<GrSurfaceProxy> sProxy(make_wrapped_FBO0(proxyProvider, reporter, desc));
+ sk_sp<GrSurfaceProxy> sProxy(
+ make_wrapped_FBO0(proxyProvider, reporter, desc, kBottomLeft_GrSurfaceOrigin));
if (sProxy) {
// RenderTarget-only
GrRenderTargetProxy* rtProxy = sProxy->asRenderTargetProxy();
@@ -68,7 +71,8 @@
{
// Internal offscreen render target.
- sk_sp<GrSurfaceProxy> sProxy(make_wrapped_offscreen_rt(proxyProvider, desc));
+ sk_sp<GrSurfaceProxy> sProxy(
+ make_wrapped_offscreen_rt(proxyProvider, desc, kBottomLeft_GrSurfaceOrigin));
if (sProxy) {
// Both RenderTarget and Texture
GrRenderTargetProxy* rtProxy = sProxy->asRenderTargetProxy();
@@ -82,7 +86,8 @@
{
// Internal offscreen render target - but through GrTextureProxy
- sk_sp<GrSurfaceProxy> sProxy(make_wrapped_texture(proxyProvider, desc));
+ sk_sp<GrSurfaceProxy> sProxy(
+ make_wrapped_texture(proxyProvider, desc, kBottomLeft_GrSurfaceOrigin));
if (sProxy) {
// Both RenderTarget and Texture
GrTextureProxy* tProxy = sProxy->asTextureProxy();
@@ -97,7 +102,8 @@
{
desc.fFlags = kNone_GrSurfaceFlags; // force no-RT
- sk_sp<GrSurfaceProxy> sProxy(make_wrapped_texture(proxyProvider, desc));
+ sk_sp<GrSurfaceProxy> sProxy(
+ make_wrapped_texture(proxyProvider, desc, kBottomLeft_GrSurfaceOrigin));
if (sProxy) {
// Texture-only
GrTextureProxy* tProxy = sProxy->asTextureProxy();
@@ -115,14 +121,13 @@
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
desc.fWidth = 64;
desc.fHeight = 64;
desc.fConfig = kRGBA_8888_GrPixelConfig;
{
- sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(desc, SkBackingFit::kApprox,
- SkBudgeted::kYes);
+ sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
+ desc, kBottomLeft_GrSurfaceOrigin, SkBackingFit::kApprox, SkBudgeted::kYes);
// Both RenderTarget and Texture
GrRenderTargetProxy* rtProxy = proxy->asRenderTargetProxy();
@@ -134,8 +139,8 @@
}
{
- sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(desc, SkBackingFit::kApprox,
- SkBudgeted::kYes);
+ sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
+ desc, kBottomLeft_GrSurfaceOrigin, SkBackingFit::kApprox, SkBudgeted::kYes);
// Both RenderTarget and Texture - but via GrTextureProxy
GrTextureProxy* tProxy = proxy->asTextureProxy();
@@ -148,10 +153,9 @@
{
desc.fFlags = kNone_GrSurfaceFlags; // force no-RT
- desc.fOrigin = kTopLeft_GrSurfaceOrigin;
- sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(desc, SkBackingFit::kApprox,
- SkBudgeted::kYes);
+ sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
+ desc, kTopLeft_GrSurfaceOrigin, SkBackingFit::kApprox, SkBudgeted::kYes);
// Texture-only
GrTextureProxy* tProxy = proxy->asTextureProxy();
REPORTER_ASSERT(reporter, tProxy);
diff --git a/tests/ProxyRefTest.cpp b/tests/ProxyRefTest.cpp
index e84e6e7..e564397c 100644
--- a/tests/ProxyRefTest.cpp
+++ b/tests/ProxyRefTest.cpp
@@ -69,24 +69,23 @@
static sk_sp<GrTextureProxy> make_deferred(GrProxyProvider* proxyProvider) {
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
desc.fWidth = kWidthHeight;
desc.fHeight = kWidthHeight;
desc.fConfig = kRGBA_8888_GrPixelConfig;
- return proxyProvider->createProxy(desc, SkBackingFit::kApprox, SkBudgeted::kYes,
- GrResourceProvider::kNoPendingIO_Flag);
+ return proxyProvider->createProxy(desc, kBottomLeft_GrSurfaceOrigin, SkBackingFit::kApprox,
+ SkBudgeted::kYes, GrResourceProvider::kNoPendingIO_Flag);
}
static sk_sp<GrTextureProxy> make_wrapped(GrProxyProvider* proxyProvider) {
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
desc.fWidth = kWidthHeight;
desc.fHeight = kWidthHeight;
desc.fConfig = kRGBA_8888_GrPixelConfig;
- return proxyProvider->createInstantiatedProxy(desc, SkBackingFit::kExact, SkBudgeted::kNo);
+ return proxyProvider->createInstantiatedProxy(desc, kBottomLeft_GrSurfaceOrigin,
+ SkBackingFit::kExact, SkBudgeted::kNo);
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp
index 6ad8199..f346f87 100644
--- a/tests/ProxyTest.cpp
+++ b/tests/ProxyTest.cpp
@@ -110,7 +110,6 @@
for (auto numSamples : {1, 4, 16, 128}) {
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fOrigin = origin;
desc.fWidth = widthHeight;
desc.fHeight = widthHeight;
desc.fConfig = config;
@@ -124,8 +123,8 @@
tex = resourceProvider->createTexture(desc, budgeted);
}
- sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
- desc, fit, budgeted);
+ sk_sp<GrTextureProxy> proxy =
+ proxyProvider->createProxy(desc, origin, fit, budgeted);
REPORTER_ASSERT(reporter, SkToBool(tex) == SkToBool(proxy));
if (proxy) {
REPORTER_ASSERT(reporter, proxy->asRenderTargetProxy());
@@ -157,8 +156,8 @@
tex = resourceProvider->createTexture(desc, budgeted);
}
- sk_sp<GrTextureProxy> proxy(proxyProvider->createProxy(
- desc, fit, budgeted));
+ sk_sp<GrTextureProxy> proxy(
+ proxyProvider->createProxy(desc, origin, fit, budgeted));
REPORTER_ASSERT(reporter, SkToBool(tex) == SkToBool(proxy));
if (proxy) {
// This forces the proxy to compute and cache its
@@ -319,13 +318,13 @@
GrSurfaceDesc desc;
desc.fFlags = flags;
- desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
desc.fWidth = width;
desc.fHeight = height;
desc.fConfig = kRGBA_8888_GrPixelConfig;
desc.fSampleCnt = 1;
- sk_sp<GrTextureProxy> proxy = provider->createProxy(desc, fit, SkBudgeted::kNo);
+ sk_sp<GrTextureProxy> proxy = provider->createProxy(
+ desc, kBottomLeft_GrSurfaceOrigin, fit, SkBudgeted::kNo);
REPORTER_ASSERT(reporter, !proxy);
}
}
diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp
index 2198e67..34cf5bc 100644
--- a/tests/ReadPixelsTest.cpp
+++ b/tests/ReadPixelsTest.cpp
@@ -461,11 +461,9 @@
desc.fWidth = DEV_W;
desc.fHeight = DEV_H;
desc.fConfig = kSkia8888_GrPixelConfig;
- desc.fOrigin = origin;
- sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy(desc, SkBudgeted::kNo,
- bmp.getPixels(),
- bmp.rowBytes());
+ sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy(
+ desc, origin, SkBudgeted::kNo, bmp.getPixels(), bmp.rowBytes());
sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeWrappedSurfaceContext(
std::move(proxy));
diff --git a/tests/ReadWriteAlphaTest.cpp b/tests/ReadWriteAlphaTest.cpp
index de9422d..f495fc2 100644
--- a/tests/ReadWriteAlphaTest.cpp
+++ b/tests/ReadWriteAlphaTest.cpp
@@ -59,7 +59,6 @@
{
GrSurfaceDesc desc;
desc.fFlags = kNone_GrSurfaceFlags;
- desc.fOrigin = kTopLeft_GrSurfaceOrigin;
desc.fConfig = kAlpha_8_GrPixelConfig; // it is a single channel texture
desc.fWidth = X_SIZE;
desc.fHeight = Y_SIZE;
@@ -67,8 +66,8 @@
// We are initializing the texture with zeros here
memset(alphaData, 0, X_SIZE * Y_SIZE);
- sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy(desc, SkBudgeted::kNo,
- alphaData, 0);
+ sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy(
+ desc, kTopLeft_GrSurfaceOrigin, SkBudgeted::kNo, alphaData, 0);
if (!proxy) {
ERRORF(reporter, "Could not create alpha texture.");
return;
@@ -170,7 +169,6 @@
for (int rt = 0; rt < 2; ++rt) {
GrSurfaceDesc desc;
desc.fFlags = rt ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags;
- desc.fOrigin = rt ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOrigin;
desc.fConfig = config;
desc.fWidth = X_SIZE;
desc.fHeight = Y_SIZE;
@@ -183,8 +181,9 @@
}
}
- sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy(desc, SkBudgeted::kNo,
- rgbaData, 0);
+ auto origin = rt ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOrigin;
+ sk_sp<GrTextureProxy> proxy =
+ proxyProvider->createTextureProxy(desc, origin, SkBudgeted::kNo, rgbaData, 0);
if (!proxy) {
// We always expect to be able to create a RGBA texture
if (!rt && kRGBA_8888_GrPixelConfig == desc.fConfig) {
diff --git a/tests/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp
index 29ad5b3..f424463 100644
--- a/tests/ResourceAllocatorTest.cpp
+++ b/tests/ResourceAllocatorTest.cpp
@@ -34,13 +34,12 @@
static sk_sp<GrSurfaceProxy> make_deferred(GrProxyProvider* proxyProvider, const ProxyParams& p) {
GrSurfaceDesc desc;
desc.fFlags = p.fIsRT ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags;
- desc.fOrigin = p.fOrigin;
desc.fWidth = p.fSize;
desc.fHeight = p.fSize;
desc.fConfig = p.fConfig;
desc.fSampleCnt = p.fSampleCnt;
- return proxyProvider->createProxy(desc, p.fFit, SkBudgeted::kNo);
+ return proxyProvider->createProxy(desc, p.fOrigin, p.fFit, SkBudgeted::kNo);
}
static sk_sp<GrSurfaceProxy> make_backend(GrContext* context, const ProxyParams& p,
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index f6ff218..55f4f85 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -100,7 +100,6 @@
int size, int sampleCount, SkBudgeted budgeted) {
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
desc.fWidth = size;
desc.fHeight = size;
desc.fConfig = kRGBA_8888_GrPixelConfig;
@@ -1646,7 +1645,6 @@
int sampleCnt) {
GrSurfaceDesc desc;
desc.fFlags = flags;
- desc.fOrigin = kTopLeft_GrSurfaceOrigin;
desc.fWidth = width;
desc.fHeight = height;
desc.fConfig = kRGBA_8888_GrPixelConfig;
@@ -1661,14 +1659,15 @@
int sampleCnt) {
GrSurfaceDesc desc;
desc.fFlags = flags;
- desc.fOrigin = (flags & kRenderTarget_GrSurfaceFlag) ? kBottomLeft_GrSurfaceOrigin
- : kTopLeft_GrSurfaceOrigin;
desc.fWidth = width;
desc.fHeight = height;
desc.fConfig = kRGBA_8888_GrPixelConfig;
desc.fSampleCnt = sampleCnt;
- return proxyProvider->createMipMapProxy(desc, SkBudgeted::kYes);
+ auto origin = (flags & kRenderTarget_GrSurfaceFlag) ? kBottomLeft_GrSurfaceOrigin
+ : kTopLeft_GrSurfaceOrigin;
+
+ return proxyProvider->createMipMapProxy(desc, origin, SkBudgeted::kYes);
}
// Exercise GrSurface::gpuMemorySize for different combos of MSAA, RT-only,
diff --git a/tests/SRGBMipMapTest.cpp b/tests/SRGBMipMapTest.cpp
index b24b7f7..466aad2 100644
--- a/tests/SRGBMipMapTest.cpp
+++ b/tests/SRGBMipMapTest.cpp
@@ -126,14 +126,13 @@
// Create our test texture
GrSurfaceDesc desc;
desc.fFlags = kNone_GrSurfaceFlags;
- desc.fOrigin = kTopLeft_GrSurfaceOrigin;
desc.fWidth = texS;
desc.fHeight = texS;
desc.fConfig = kSRGBA_8888_GrPixelConfig;
GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
- sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy(
- desc, SkBudgeted::kNo, texData, 0);
+ sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy(desc, kTopLeft_GrSurfaceOrigin,
+ SkBudgeted::kNo, texData, 0);
// Create two render target contexts (L32 and S32)
sk_sp<SkColorSpace> srgbColorSpace = SkColorSpace::MakeSRGB();
diff --git a/tests/SRGBReadWritePixelsTest.cpp b/tests/SRGBReadWritePixelsTest.cpp
index 8b7dd07..18ed738 100644
--- a/tests/SRGBReadWritePixelsTest.cpp
+++ b/tests/SRGBReadWritePixelsTest.cpp
@@ -199,14 +199,13 @@
skiatest::Reporter* reporter) {
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
desc.fWidth = kW;
desc.fHeight = kH;
desc.fConfig = encoding_as_pixel_config(contextEncoding);
auto surfaceContext = context->contextPriv().makeDeferredSurfaceContext(
- desc, GrMipMapped::kNo, SkBackingFit::kExact, SkBudgeted::kNo,
- encoding_as_color_space(contextEncoding));
+ desc, kBottomLeft_GrSurfaceOrigin, GrMipMapped::kNo, SkBackingFit::kExact,
+ SkBudgeted::kNo, encoding_as_color_space(contextEncoding));
if (!surfaceContext) {
ERRORF(reporter, "Could not create %s surface context.", encoding_as_str(contextEncoding));
}
diff --git a/tests/SpecialImageTest.cpp b/tests/SpecialImageTest.cpp
index 4b86697..f201fb0 100644
--- a/tests/SpecialImageTest.cpp
+++ b/tests/SpecialImageTest.cpp
@@ -238,7 +238,7 @@
const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bm.info(), *context->caps());
sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy(
- desc, SkBudgeted::kNo, bm.getPixels(), bm.rowBytes());
+ desc, kTopLeft_GrSurfaceOrigin, SkBudgeted::kNo, bm.getPixels(), bm.rowBytes());
if (!proxy) {
return;
}
@@ -271,7 +271,7 @@
const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bm.info(), *context->caps());
sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy(
- desc, SkBudgeted::kNo, bm.getPixels(), bm.rowBytes());
+ desc, kTopLeft_GrSurfaceOrigin, SkBudgeted::kNo, bm.getPixels(), bm.rowBytes());
if (!proxy) {
return;
}
@@ -305,13 +305,12 @@
GrSurfaceDesc desc;
desc.fFlags = kNone_GrSurfaceFlags;
- desc.fOrigin = kTopLeft_GrSurfaceOrigin;
desc.fWidth = kFullSize;
desc.fHeight = kFullSize;
desc.fConfig = kSkia8888_GrPixelConfig;
sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy(
- desc, SkBudgeted::kNo, bm.getPixels(), bm.rowBytes());
+ desc, kTopLeft_GrSurfaceOrigin, SkBudgeted::kNo, bm.getPixels(), bm.rowBytes());
if (!proxy) {
return;
}
diff --git a/tests/TestUtils.cpp b/tests/TestUtils.cpp
index 463a8e9..7878233 100644
--- a/tests/TestUtils.cpp
+++ b/tests/TestUtils.cpp
@@ -81,10 +81,11 @@
}
copyDstDesc.fFlags = flags;
- copyDstDesc.fOrigin = (kNone_GrSurfaceFlags == flags) ? kTopLeft_GrSurfaceOrigin
- : kBottomLeft_GrSurfaceOrigin;
+ auto origin = (kNone_GrSurfaceFlags == flags) ? kTopLeft_GrSurfaceOrigin
+ : kBottomLeft_GrSurfaceOrigin;
- sk_sp<GrSurfaceContext> dstContext(GrSurfaceProxy::TestCopy(context, copyDstDesc, proxy));
+ sk_sp<GrSurfaceContext> dstContext(
+ GrSurfaceProxy::TestCopy(context, copyDstDesc, origin, proxy));
test_read_pixels(reporter, dstContext.get(), expectedPixelValues, testName);
}
@@ -109,11 +110,11 @@
for (auto flags : { kNone_GrSurfaceFlags, kRenderTarget_GrSurfaceFlag }) {
copySrcDesc.fFlags = flags;
- copySrcDesc.fOrigin = (kNone_GrSurfaceFlags == flags) ? kTopLeft_GrSurfaceOrigin
- : kBottomLeft_GrSurfaceOrigin;
+ auto origin = (kNone_GrSurfaceFlags == flags) ? kTopLeft_GrSurfaceOrigin
+ : kBottomLeft_GrSurfaceOrigin;
- sk_sp<GrTextureProxy> src = proxyProvider->createTextureProxy(copySrcDesc, SkBudgeted::kYes,
- pixels.get(), 0);
+ sk_sp<GrTextureProxy> src = proxyProvider->createTextureProxy(
+ copySrcDesc, origin, SkBudgeted::kYes, pixels.get(), 0);
dstContext->copy(src.get());
diff --git a/tests/TextureProxyTest.cpp b/tests/TextureProxyTest.cpp
index f81df8e..8d0df6f 100644
--- a/tests/TextureProxyTest.cpp
+++ b/tests/TextureProxyTest.cpp
@@ -30,7 +30,6 @@
static GrSurfaceDesc make_desc(GrSurfaceFlags flags) {
GrSurfaceDesc desc;
desc.fFlags = flags;
- desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
desc.fWidth = 64;
desc.fHeight = 64;
desc.fConfig = kRGBA_8888_GrPixelConfig;
@@ -46,7 +45,8 @@
GrProxyProvider* proxyProvider, SkBackingFit fit) {
const GrSurfaceDesc desc = make_desc(kNone_GrSurfaceFlags);
- sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(desc, fit, SkBudgeted::kYes);
+ sk_sp<GrTextureProxy> proxy =
+ proxyProvider->createProxy(desc, kBottomLeft_GrSurfaceOrigin, fit, SkBudgeted::kYes);
// Only budgeted & wrapped external proxies get to carry uniqueKeys
REPORTER_ASSERT(reporter, !proxy->getUniqueKey().isValid());
return proxy;
@@ -56,7 +56,8 @@
GrProxyProvider* proxyProvider, SkBackingFit fit) {
const GrSurfaceDesc desc = make_desc(kRenderTarget_GrSurfaceFlag);
- sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(desc, fit, SkBudgeted::kYes);
+ sk_sp<GrTextureProxy> proxy =
+ proxyProvider->createProxy(desc, kBottomLeft_GrSurfaceOrigin, fit, SkBudgeted::kYes);
// Only budgeted & wrapped external proxies get to carry uniqueKeys
REPORTER_ASSERT(reporter, !proxy->getUniqueKey().isValid());
return proxy;
@@ -66,8 +67,8 @@
GrProxyProvider* proxyProvider, SkBackingFit fit) {
const GrSurfaceDesc desc = make_desc(kNone_GrSurfaceFlags);
- sk_sp<GrTextureProxy> proxy = proxyProvider->createInstantiatedProxy(desc, fit,
- SkBudgeted::kYes);
+ sk_sp<GrTextureProxy> proxy = proxyProvider->createInstantiatedProxy(
+ desc, kBottomLeft_GrSurfaceOrigin, fit, SkBudgeted::kYes);
// Only budgeted & wrapped external proxies get to carry uniqueKeys
REPORTER_ASSERT(reporter, !proxy->getUniqueKey().isValid());
return proxy;
@@ -87,8 +88,8 @@
const GrSurfaceDesc desc = make_desc(kNone_GrSurfaceFlags);
// Only budgeted & wrapped external proxies get to carry uniqueKeys
- sk_sp<GrTextureProxy> proxy = proxyProvider->createInstantiatedProxy(desc, fit,
- SkBudgeted::kYes, 0);
+ sk_sp<GrTextureProxy> proxy = proxyProvider->createInstantiatedProxy(
+ desc, kBottomLeft_GrSurfaceOrigin, fit, SkBudgeted::kYes, 0);
SkAssertResult(proxyProvider->assignUniqueKeyToProxy(key, proxy.get()));
REPORTER_ASSERT(reporter, proxy->getUniqueKey().isValid());
return proxy;
diff --git a/tests/TransferPixelsTest.cpp b/tests/TransferPixelsTest.cpp
index 1c82ede..e17dfac 100755
--- a/tests/TransferPixelsTest.cpp
+++ b/tests/TransferPixelsTest.cpp
@@ -101,7 +101,6 @@
// create texture
GrSurfaceDesc desc;
desc.fFlags = renderTarget ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags;
- desc.fOrigin = origin;
desc.fWidth = kTextureWidth;
desc.fHeight = kTextureHeight;
desc.fConfig = GrColorTypeToPixelConfig(colorType, srgbEncoding);
diff --git a/tests/VkMakeCopyPipelineTest.cpp b/tests/VkMakeCopyPipelineTest.cpp
index f9a0ec6..77359cd 100644
--- a/tests/VkMakeCopyPipelineTest.cpp
+++ b/tests/VkMakeCopyPipelineTest.cpp
@@ -116,7 +116,6 @@
GrSurfaceDesc surfDesc;
surfDesc.fFlags = kRenderTarget_GrSurfaceFlag;
- surfDesc.fOrigin = kTopLeft_GrSurfaceOrigin;
surfDesc.fWidth = 16;
surfDesc.fHeight = 16;
surfDesc.fConfig = kRGBA_8888_GrPixelConfig;
diff --git a/tests/VkUploadPixelsTests.cpp b/tests/VkUploadPixelsTests.cpp
index f35480a..f2d6af3 100644
--- a/tests/VkUploadPixelsTests.cpp
+++ b/tests/VkUploadPixelsTests.cpp
@@ -65,7 +65,6 @@
GrSurfaceDesc surfDesc;
surfDesc.fFlags = renderTarget ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags;
- surfDesc.fOrigin = kTopLeft_GrSurfaceOrigin;
surfDesc.fWidth = kWidth;
surfDesc.fHeight = kHeight;
surfDesc.fConfig = config;
@@ -74,8 +73,8 @@
SkColorType ct;
SkAssertResult(GrPixelConfigToColorType(config, &ct));
- sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy(surfDesc, SkBudgeted::kNo,
- srcBuffer, 0);
+ sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy(
+ surfDesc, kTopLeft_GrSurfaceOrigin, SkBudgeted::kNo, srcBuffer, 0);
REPORTER_ASSERT(reporter, proxy);
if (proxy) {
sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeWrappedSurfaceContext(proxy);
@@ -104,9 +103,8 @@
2));
}
- surfDesc.fOrigin = kBottomLeft_GrSurfaceOrigin;
-
- proxy = proxyProvider->createTextureProxy(surfDesc, SkBudgeted::kNo, srcBuffer, 0);
+ proxy = proxyProvider->createTextureProxy(surfDesc, kBottomLeft_GrSurfaceOrigin,
+ SkBudgeted::kNo, srcBuffer, 0);
REPORTER_ASSERT(reporter, proxy);
if (proxy) {
sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeWrappedSurfaceContext(proxy);
diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp
index cb12dcf..1f9c9c6 100644
--- a/tests/WritePixelsTest.cpp
+++ b/tests/WritePixelsTest.cpp
@@ -493,8 +493,8 @@
desc.fHeight = 64;
desc.fConfig = kRGBA_8888_GrPixelConfig;
- sk_sp<GrTextureProxy> temp = proxyProvider->createProxy(desc, SkBackingFit::kApprox,
- SkBudgeted::kYes);
+ sk_sp<GrTextureProxy> temp = proxyProvider->createProxy(
+ desc, kTopLeft_GrSurfaceOrigin, SkBackingFit::kApprox, SkBudgeted::kYes);
temp->instantiate(context->contextPriv().resourceProvider());
}