aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ProxyTest.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-04-26 07:44:26 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-26 12:19:31 +0000
commit78de212909a72a3ad74d652b39c941236f7047ad (patch)
tree85d75f6f7e123a483f889a3b6c778d6d38c0280f /tests/ProxyTest.cpp
parent2b6be207a1b4595646950324ab1ccf0e3b9f73ac (diff)
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 <robertphillips@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'tests/ProxyTest.cpp')
-rw-r--r--tests/ProxyTest.cpp35
1 files changed, 34 insertions, 1 deletions
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<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(provider,
+ desc,
+ fit,
+ SkBudgeted::kNo));
+ REPORTER_ASSERT(reporter, !proxy);
+ }
+ }
+ }
+ }
+}
+
#endif