From 78de212909a72a3ad74d652b39c941236f7047ad Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Wed, 26 Apr 2017 07:44:26 -0400 Subject: Prevent creation of zero-sized proxies This wasn't seen locally b.c. it is an assert and I only ran release locally and the CQ also only runs release. I have added linux_trusty_blink_dbg as a try job. TBR=bsalomon@google.com Bug: 715392 Change-Id: I010626cb97e886d2fbfd767f948bc640f0534338 Reviewed-on: https://skia-review.googlesource.com/14361 Reviewed-by: Robert Phillips Commit-Queue: Robert Phillips --- tests/ProxyTest.cpp | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'tests/ProxyTest.cpp') diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp index 7fd302951b..db407d791f 100644 --- a/tests/ProxyTest.cpp +++ b/tests/ProxyTest.cpp @@ -213,7 +213,10 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { for (auto config : { kAlpha_8_GrPixelConfig, kRGBA_8888_GrPixelConfig }) { for (auto budgeted : { SkBudgeted::kYes, SkBudgeted::kNo }) { for (auto numSamples: { 0, 4}) { - if (caps.maxSampleCount() < numSamples) continue; + if (caps.maxSampleCount() < numSamples) { + continue; + } + bool renderable = caps.isConfigRenderable(config, numSamples > 0); GrSurfaceDesc desc; @@ -279,4 +282,34 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { } } +DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ZeroSizedProxyTest, reporter, ctxInfo) { + GrResourceProvider* provider = ctxInfo.grContext()->resourceProvider(); + + for (auto flags : { kRenderTarget_GrSurfaceFlag, kNone_GrSurfaceFlags }) { + for (auto fit : { SkBackingFit::kExact, SkBackingFit::kApprox }) { + for (int width : { 0, 100 }) { + for (int height : { 0, 100}) { + if (width && height) { + continue; // not zero-sized + } + + GrSurfaceDesc desc; + desc.fFlags = flags; + desc.fOrigin = kBottomLeft_GrSurfaceOrigin; + desc.fWidth = width; + desc.fHeight = height; + desc.fConfig = kRGBA_8888_GrPixelConfig; + desc.fSampleCnt = 0; + + sk_sp proxy(GrSurfaceProxy::MakeDeferred(provider, + desc, + fit, + SkBudgeted::kNo)); + REPORTER_ASSERT(reporter, !proxy); + } + } + } + } +} + #endif -- cgit v1.2.3