aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ProxyConversionTest.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2018-03-03 22:43:43 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-05 18:50:25 +0000
commit2a4f983c94e4f749fe24b08bc8b5ae7cc8550d1d (patch)
treee89d794eeffacf09124be0cee8bfc70001be2856 /tests/ProxyConversionTest.cpp
parent1a8d762a18d6f6494408a3a5e06a80097f8b85f7 (diff)
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>
Diffstat (limited to 'tests/ProxyConversionTest.cpp')
-rw-r--r--tests/ProxyConversionTest.cpp42
1 files changed, 23 insertions, 19 deletions
diff --git a/tests/ProxyConversionTest.cpp b/tests/ProxyConversionTest.cpp
index c8b690528f..a4c4a60449 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 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyConversionTest, reporter, ctxInfo
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 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyConversionTest, reporter, ctxInfo
{
// 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 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyConversionTest, reporter, ctxInfo
{
// 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 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyConversionTest, reporter, ctxInfo
{
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 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxIn
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 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxIn
}
{
- 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 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxIn
{
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);