diff options
author | Robert Phillips <robertphillips@google.com> | 2016-11-02 10:23:32 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-11-02 16:06:25 +0000 |
commit | abacf0978fc06f88278d073655dff6ff8503a612 (patch) | |
tree | 2e6129c1daf6ca58e4719d955c284820f084e2a9 | |
parent | 8bc06d07f57ede17ccabfa38f1d7e31bbf311ab5 (diff) |
Update ProxyTests
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4306
Change-Id: I0753047eeda71a22b6126f932fc14dd242c5a2e7
Reviewed-on: https://skia-review.googlesource.com/4306
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
-rw-r--r-- | include/private/GrRenderTargetProxy.h | 4 | ||||
-rw-r--r-- | src/gpu/GrContext.cpp | 9 | ||||
-rw-r--r-- | src/gpu/GrRenderTargetProxy.cpp | 6 | ||||
-rw-r--r-- | tests/ProxyTest.cpp | 46 |
4 files changed, 36 insertions, 29 deletions
diff --git a/include/private/GrRenderTargetProxy.h b/include/private/GrRenderTargetProxy.h index 27e0492d9e..c124dddd79 100644 --- a/include/private/GrRenderTargetProxy.h +++ b/include/private/GrRenderTargetProxy.h @@ -25,7 +25,7 @@ public: */ static sk_sp<GrRenderTargetProxy> Make(const GrCaps&, const GrSurfaceDesc&, SkBackingFit, SkBudgeted); - static sk_sp<GrRenderTargetProxy> Make(const GrCaps&, sk_sp<GrRenderTarget>); + static sk_sp<GrRenderTargetProxy> Make(sk_sp<GrRenderTarget>); // TODO: add asTextureProxy variants GrRenderTargetProxy* asRenderTargetProxy() override { return this; } @@ -70,7 +70,7 @@ private: GrRenderTargetProxy(const GrCaps&, const GrSurfaceDesc&, SkBackingFit, SkBudgeted); // Wrapped version - GrRenderTargetProxy(const GrCaps&, sk_sp<GrRenderTarget> rt); + GrRenderTargetProxy(sk_sp<GrRenderTarget> rt); size_t onGpuMemorySize() const override; diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index 53ec06c251..aabe8fb329 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -609,7 +609,7 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeWrappedRenderTargetContext( const SkSurfaceProps* surfaceProps) { ASSERT_SINGLE_OWNER_PRIV - sk_sp<GrRenderTargetProxy> rtp(GrRenderTargetProxy::Make(*fContext->caps(), std::move(rt))); + sk_sp<GrRenderTargetProxy> rtp(GrRenderTargetProxy::Make(std::move(rt))); return this->drawingManager()->makeRenderTargetContext(std::move(rtp), std::move(colorSpace), @@ -629,7 +629,7 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureRenderTargetContex return nullptr; } - sk_sp<GrRenderTargetProxy> rtp(GrRenderTargetProxy::Make(*fContext->caps(), + sk_sp<GrRenderTargetProxy> rtp(GrRenderTargetProxy::Make( sk_ref_sp(surface->asRenderTarget()))); return this->drawingManager()->makeRenderTargetContext(std::move(rtp), @@ -647,7 +647,7 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendRenderTargetRenderTargetC return nullptr; } - sk_sp<GrRenderTargetProxy> rtp(GrRenderTargetProxy::Make(*fContext->caps(), std::move(rt))); + sk_sp<GrRenderTargetProxy> rtp(GrRenderTargetProxy::Make(std::move(rt))); return this->drawingManager()->makeRenderTargetContext(std::move(rtp), std::move(colorSpace), @@ -666,8 +666,7 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureAsRenderTargetRend return nullptr; } - sk_sp<GrRenderTargetProxy> rtp(GrRenderTargetProxy::Make(*fContext->caps(), - sk_ref_sp(surface->asRenderTarget()))); + sk_sp<GrRenderTargetProxy> rtp(GrRenderTargetProxy::Make(sk_ref_sp(surface->asRenderTarget()))); return this->drawingManager()->makeRenderTargetContext(std::move(rtp), std::move(colorSpace), diff --git a/src/gpu/GrRenderTargetProxy.cpp b/src/gpu/GrRenderTargetProxy.cpp index 380984871e..d965e6b629 100644 --- a/src/gpu/GrRenderTargetProxy.cpp +++ b/src/gpu/GrRenderTargetProxy.cpp @@ -30,7 +30,7 @@ GrRenderTargetProxy::GrRenderTargetProxy(const GrCaps& caps, const GrSurfaceDesc } // Wrapped version -GrRenderTargetProxy::GrRenderTargetProxy(const GrCaps& caps, sk_sp<GrRenderTarget> rt) +GrRenderTargetProxy::GrRenderTargetProxy(sk_sp<GrRenderTarget> rt) : INHERITED(std::move(rt), SkBackingFit::kExact) , fFlags(fTarget->asRenderTarget()->renderTargetPriv().flags()) { } @@ -97,7 +97,7 @@ sk_sp<GrRenderTargetProxy> GrRenderTargetProxy::Make(const GrCaps& caps, return sk_sp<GrRenderTargetProxy>(new GrRenderTargetProxy(caps, desc, fit, budgeted)); } -sk_sp<GrRenderTargetProxy> GrRenderTargetProxy::Make(const GrCaps& caps, sk_sp<GrRenderTarget> rt) { - return sk_sp<GrRenderTargetProxy>(new GrRenderTargetProxy(caps, rt)); +sk_sp<GrRenderTargetProxy> GrRenderTargetProxy::Make(sk_sp<GrRenderTarget> rt) { + return sk_sp<GrRenderTargetProxy>(new GrRenderTargetProxy(rt)); } diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp index b69e410103..6b7ab25a3f 100644 --- a/tests/ProxyTest.cpp +++ b/tests/ProxyTest.cpp @@ -10,7 +10,6 @@ #include "Test.h" #if SK_SUPPORT_GPU -#include "GrGpu.h" #include "GrSurfaceProxy.h" #include "GrTextureProxy.h" #include "GrRenderTargetPriv.h" @@ -22,7 +21,8 @@ static void check_surface(skiatest::Reporter* reporter, GrSurfaceOrigin origin, int width, int height, GrPixelConfig config, - uint32_t uniqueID) { + uint32_t uniqueID, + SkBudgeted budgeted) { REPORTER_ASSERT(reporter, proxy->origin() == origin); REPORTER_ASSERT(reporter, proxy->width() == width); REPORTER_ASSERT(reporter, proxy->height() == height); @@ -30,12 +30,16 @@ static void check_surface(skiatest::Reporter* reporter, if (SK_InvalidUniqueID != uniqueID) { REPORTER_ASSERT(reporter, proxy->uniqueID() == uniqueID); } + REPORTER_ASSERT(reporter, proxy->isBudgeted() == budgeted); } static void check_rendertarget(skiatest::Reporter* reporter, GrTextureProvider* provider, GrRenderTargetProxy* rtProxy, + int numSamples, SkBackingFit fit) { + REPORTER_ASSERT(reporter, rtProxy->numStencilSamples() == numSamples); + REPORTER_ASSERT(reporter, rtProxy->asTextureProxy() == nullptr); // for now REPORTER_ASSERT(reporter, rtProxy->asRenderTargetProxy() == rtProxy); @@ -85,6 +89,7 @@ static void check_texture(skiatest::Reporter* reporter, DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) { GrTextureProvider* provider = ctxInfo.grContext()->textureProvider(); + const GrCaps& caps = *ctxInfo.grContext()->caps(); for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin }) { for (auto widthHeight : { 100, 128 }) { @@ -105,13 +110,13 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) { if (renderable) { sk_sp<GrRenderTargetProxy> rtProxy(GrRenderTargetProxy::Make( - *ctxInfo.grContext()->caps(), - desc, - fit, - budgeted)); + caps, desc, + fit, budgeted)); check_surface(reporter, rtProxy.get(), origin, - widthHeight, widthHeight, config, SK_InvalidUniqueID); - check_rendertarget(reporter, provider, rtProxy.get(), fit); + widthHeight, widthHeight, config, + SK_InvalidUniqueID, budgeted); + check_rendertarget(reporter, provider, rtProxy.get(), + numSamples, fit); } desc.fSampleCnt = 0; @@ -121,7 +126,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) { fit, budgeted)); check_surface(reporter, texProxy.get(), origin, - widthHeight, widthHeight, config, SK_InvalidUniqueID); + widthHeight, widthHeight, config, + SK_InvalidUniqueID, budgeted); check_texture(reporter, provider, texProxy.get(), fit); } } @@ -161,17 +167,17 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { backendDesc.fStencilBits = 8; backendDesc.fRenderTargetHandle = 0; - GrGpu* gpu = ctxInfo.grContext()->getGpu(); sk_sp<GrRenderTarget> defaultFBO( - gpu->wrapBackendRenderTarget(backendDesc, kBorrow_GrWrapOwnership)); + provider->wrapBackendRenderTarget(backendDesc)); REPORTER_ASSERT(reporter, !defaultFBO->renderTargetPriv().maxWindowRectangles()); - sk_sp<GrRenderTargetProxy> rtProxy( - GrRenderTargetProxy::Make(caps, defaultFBO)); + sk_sp<GrRenderTargetProxy> rtProxy(GrRenderTargetProxy::Make(defaultFBO)); check_surface(reporter, rtProxy.get(), origin, - kWidthHeight, kWidthHeight, config, defaultFBO->uniqueID()); - check_rendertarget(reporter, provider, rtProxy.get(), SkBackingFit::kExact); + kWidthHeight, kWidthHeight, config, + defaultFBO->uniqueID(), SkBudgeted::kNo); + check_rendertarget(reporter, provider, rtProxy.get(), + numSamples, SkBackingFit::kExact); } sk_sp<GrTexture> tex; @@ -185,10 +191,12 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { caps.maxWindowRectangles() == rt->renderTargetPriv().maxWindowRectangles()); - sk_sp<GrRenderTargetProxy> rtProxy(GrRenderTargetProxy::Make(caps, rt)); + sk_sp<GrRenderTargetProxy> rtProxy(GrRenderTargetProxy::Make(rt)); check_surface(reporter, rtProxy.get(), origin, - kWidthHeight, kWidthHeight, config, rt->uniqueID()); - check_rendertarget(reporter, provider, rtProxy.get(), SkBackingFit::kExact); + kWidthHeight, kWidthHeight, config, + rt->uniqueID(), budgeted); + check_rendertarget(reporter, provider, rtProxy.get(), + numSamples, SkBackingFit::kExact); } if (!tex) { @@ -199,7 +207,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { sk_sp<GrTextureProxy> texProxy(GrTextureProxy::Make(tex)); check_surface(reporter, texProxy.get(), origin, - kWidthHeight, kWidthHeight, config, tex->uniqueID()); + kWidthHeight, kWidthHeight, config, tex->uniqueID(), budgeted); check_texture(reporter, provider, texProxy.get(), SkBackingFit::kExact); } } |