From: Robert Phillips Date: Mon, 30 Jan 2017 19:15:59 +0000 (-0500) Subject: Add test for outre GrSurfaceProxy requests X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~55^2~583 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=40d9495a1f50707bf3696b9a573aa7bc29edf87a;p=platform%2Fupstream%2FlibSkiaSharp.git Add test for outre GrSurfaceProxy requests This would've caught the N7 failure in https://skia-review.googlesource.com/c/7738/ (Make blur utils take GrTextureProxies) Change-Id: I67b56c9d38c14829b2812253c2e3f3e54eb585a5 Reviewed-on: https://skia-review.googlesource.com/7751 Reviewed-by: Brian Salomon Commit-Queue: Robert Phillips --- diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp index a228e16..894c37e 100644 --- a/tests/ProxyTest.cpp +++ b/tests/ProxyTest.cpp @@ -115,14 +115,14 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) { const GrGpuResource::UniqueID kInvalidResourceID = GrGpuResource::UniqueID::InvalidID(); for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin }) { - for (auto widthHeight : { 100, 128 }) { + for (auto widthHeight : { 100, 128, 1048576 }) { for (auto config : { kAlpha_8_GrPixelConfig, kRGBA_8888_GrPixelConfig }) { for (auto fit : { SkBackingFit::kExact, SkBackingFit::kApprox }) { for (auto budgeted : { SkBudgeted::kYes, SkBudgeted::kNo }) { for (auto numSamples : { 0, 4}) { - bool renderable = ctxInfo.grContext()->caps()->isConfigRenderable( - config, numSamples > 0) && - numSamples <= ctxInfo.grContext()->caps()->maxColorSampleCount(); + bool renderable = caps.isConfigRenderable(config, numSamples > 0) && + numSamples <= caps.maxColorSampleCount(); + bool allocable = widthHeight <= caps.maxTextureSize(); GrSurfaceDesc desc; desc.fFlags = kRenderTarget_GrSurfaceFlag; @@ -134,21 +134,25 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) { if (renderable) { sk_sp sProxy(GrSurfaceProxy::MakeDeferred( - caps, desc, + caps, desc, fit, budgeted)); - // 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. - sProxy->gpuMemorySize(); - - check_surface(reporter, sProxy.get(), origin, - widthHeight, widthHeight, config, - kInvalidResourceID, budgeted); - check_rendertarget(reporter, caps, provider, - sProxy->asRenderTargetProxy(), numSamples, - fit, caps.maxWindowRectangles(), false); + REPORTER_ASSERT(reporter, allocable == SkToBool(sProxy)); + if (sProxy) { + REPORTER_ASSERT(reporter, sProxy->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. + sProxy->gpuMemorySize(); + + check_surface(reporter, sProxy.get(), origin, + widthHeight, widthHeight, config, + kInvalidResourceID, budgeted); + check_rendertarget(reporter, caps, provider, + sProxy->asRenderTargetProxy(), numSamples, + fit, caps.maxWindowRectangles(), false); + } } desc.fFlags = kNone_GrSurfaceFlags; @@ -158,17 +162,21 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) { desc, fit, budgeted)); - // 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. - sProxy->gpuMemorySize(); - - check_surface(reporter, sProxy.get(), origin, - widthHeight, widthHeight, config, - kInvalidResourceID, budgeted); - check_texture(reporter, provider, sProxy->asTextureProxy(), fit, false); + REPORTER_ASSERT(reporter, allocable == SkToBool(sProxy)); + if (sProxy) { + // 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. + sProxy->gpuMemorySize(); + + check_surface(reporter, sProxy.get(), origin, + widthHeight, widthHeight, config, + kInvalidResourceID, budgeted); + check_texture(reporter, provider, sProxy->asTextureProxy(), + fit, false); + } } } }