diff options
author | robertphillips <robertphillips@google.com> | 2016-08-31 14:04:06 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-31 14:04:06 -0700 |
commit | 8abb370aca280516f4861c6c942ec453aad018fa (patch) | |
tree | b7e1c12fab48df526ba92763add2aca80806d554 /tests/ProxyTest.cpp | |
parent | bde96c6263112de755a2573f6f5f02703386f328 (diff) |
Have GrSurfaceProxys and GrGpuResources draw from the same pool of unique ids
The idea here is that, for wrapped Proxy objects, we want the uniqueID to reflect that of the wrapped object. For this to work the IDs for the non-wrapped versions can't conflict with GrGpuResource's pool of IDs.
Split off of: https://codereview.chromium.org/2215323003/ (Start using RenderTargetProxy (omnibus))
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2301523003
Review-Url: https://codereview.chromium.org/2301523003
Diffstat (limited to 'tests/ProxyTest.cpp')
-rw-r--r-- | tests/ProxyTest.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp index 45d3945c7f..016ce5e763 100644 --- a/tests/ProxyTest.cpp +++ b/tests/ProxyTest.cpp @@ -15,15 +15,20 @@ #include "GrTextureProxy.h" #include "GrRenderTargetProxy.h" +// Check that the surface proxy's member vars are set as expected static void check_surface(skiatest::Reporter* reporter, GrSurfaceProxy* proxy, GrSurfaceOrigin origin, int width, int height, - GrPixelConfig config) { + GrPixelConfig config, + uint32_t uniqueID) { REPORTER_ASSERT(reporter, proxy->origin() == origin); REPORTER_ASSERT(reporter, proxy->width() == width); REPORTER_ASSERT(reporter, proxy->height() == height); REPORTER_ASSERT(reporter, proxy->config() == config); + if (SK_InvalidUniqueID != uniqueID) { + REPORTER_ASSERT(reporter, proxy->uniqueID() == uniqueID); + } } static void check_rendertarget(skiatest::Reporter* reporter, @@ -77,7 +82,7 @@ static void check_texture(skiatest::Reporter* reporter, } -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(AllocedProxyTest, reporter, ctxInfo) { +DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) { GrTextureProvider* provider = ctxInfo.grContext()->textureProvider(); for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin }) { @@ -104,7 +109,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(AllocedProxyTest, reporter, ctxInfo) { fit, budgeted)); check_surface(reporter, rtProxy.get(), origin, - widthHeight, widthHeight, config); + widthHeight, widthHeight, config, SK_InvalidUniqueID); check_rendertarget(reporter, provider, rtProxy.get(), fit); } @@ -114,7 +119,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(AllocedProxyTest, reporter, ctxInfo) { fit, budgeted)); check_surface(reporter, texProxy.get(), origin, - widthHeight, widthHeight, config); + widthHeight, widthHeight, config, SK_InvalidUniqueID); check_texture(reporter, provider, texProxy.get(), fit); } } @@ -162,7 +167,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { sk_sp<GrRenderTargetProxy> rtProxy( GrRenderTargetProxy::Make(caps, defaultFBO)); check_surface(reporter, rtProxy.get(), origin, - kWidthHeight, kWidthHeight, config); + kWidthHeight, kWidthHeight, config, defaultFBO->uniqueID()); check_rendertarget(reporter, provider, rtProxy.get(), SkBackingFit::kExact); } @@ -178,7 +183,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { sk_sp<GrRenderTargetProxy> rtProxy(GrRenderTargetProxy::Make(caps, rt)); check_surface(reporter, rtProxy.get(), origin, - kWidthHeight, kWidthHeight, config); + kWidthHeight, kWidthHeight, config, rt->uniqueID()); check_rendertarget(reporter, provider, rtProxy.get(), SkBackingFit::kExact); } @@ -190,7 +195,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); + kWidthHeight, kWidthHeight, config, tex->uniqueID()); check_texture(reporter, provider, texProxy.get(), SkBackingFit::kExact); } } |