blob: 8f5eb136397317b135e3aee1089b84941f4652fa [file] [log] [blame]
robertphillips76948d42016-05-04 12:47:41 -07001/*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8// This is a GPU-backend specific test.
9
10#include "Test.h"
11
12#if SK_SUPPORT_GPU
Robert Phillips8bf1f9f2017-05-31 15:01:20 -040013
Greg Danielbcf612b2017-05-01 13:50:58 +000014#include "GrBackendSurface.h"
Robert Phillips1afd4cd2018-01-08 13:40:32 -050015#include "GrContextPriv.h"
Robert Phillips0bd24dc2018-01-16 08:06:32 -050016#include "GrProxyProvider.h"
Robert Phillipsc7635fa2016-10-28 13:25:24 -040017#include "GrRenderTargetPriv.h"
robertphillips76948d42016-05-04 12:47:41 -070018#include "GrRenderTargetProxy.h"
Brian Osman32342f02017-03-04 08:12:46 -050019#include "GrResourceProvider.h"
Robert Phillipsf95b1752017-08-31 08:56:07 -040020#include "GrSurfaceProxyPriv.h"
Robert Phillips646e4292017-06-13 12:44:56 -040021#include "GrTexture.h"
Brian Osman32342f02017-03-04 08:12:46 -050022#include "GrTextureProxy.h"
Greg Daniel2a303902018-02-20 10:25:54 -050023#include "SkGr.h"
robertphillips76948d42016-05-04 12:47:41 -070024
robertphillips8abb3702016-08-31 14:04:06 -070025// Check that the surface proxy's member vars are set as expected
robertphillips76948d42016-05-04 12:47:41 -070026static void check_surface(skiatest::Reporter* reporter,
27 GrSurfaceProxy* proxy,
28 GrSurfaceOrigin origin,
Greg Danielbcf612b2017-05-01 13:50:58 +000029 int width, int height,
robertphillips8abb3702016-08-31 14:04:06 -070030 GrPixelConfig config,
Robert Phillipsabacf092016-11-02 10:23:32 -040031 SkBudgeted budgeted) {
robertphillips76948d42016-05-04 12:47:41 -070032 REPORTER_ASSERT(reporter, proxy->origin() == origin);
33 REPORTER_ASSERT(reporter, proxy->width() == width);
34 REPORTER_ASSERT(reporter, proxy->height() == height);
35 REPORTER_ASSERT(reporter, proxy->config() == config);
Robert Phillips0bd24dc2018-01-16 08:06:32 -050036 REPORTER_ASSERT(reporter, !proxy->uniqueID().isInvalid());
Robert Phillipsabacf092016-11-02 10:23:32 -040037 REPORTER_ASSERT(reporter, proxy->isBudgeted() == budgeted);
robertphillips76948d42016-05-04 12:47:41 -070038}
39
40static void check_rendertarget(skiatest::Reporter* reporter,
Robert Phillipsec2249f2016-11-09 08:54:35 -050041 const GrCaps& caps,
Brian Osman32342f02017-03-04 08:12:46 -050042 GrResourceProvider* provider,
robertphillips76948d42016-05-04 12:47:41 -070043 GrRenderTargetProxy* rtProxy,
Robert Phillipsabacf092016-11-02 10:23:32 -040044 int numSamples,
Robert Phillipsec2249f2016-11-09 08:54:35 -050045 SkBackingFit fit,
Greg Daniel2a303902018-02-20 10:25:54 -050046 int expectedMaxWindowRects) {
Robert Phillipsec2249f2016-11-09 08:54:35 -050047 REPORTER_ASSERT(reporter, rtProxy->maxWindowRectangles(caps) == expectedMaxWindowRects);
Robert Phillipsabacf092016-11-02 10:23:32 -040048 REPORTER_ASSERT(reporter, rtProxy->numStencilSamples() == numSamples);
49
Robert Phillips294870f2016-11-11 12:38:40 -050050 GrSurfaceProxy::UniqueID idBefore = rtProxy->uniqueID();
Brian Salomonf7778972018-03-08 10:13:17 -050051 bool preinstantiated = rtProxy->priv().isInstantiated();
Robert Phillipseee4d6e2017-06-05 09:26:07 -040052 REPORTER_ASSERT(reporter, rtProxy->instantiate(provider));
53 GrRenderTarget* rt = rtProxy->priv().peekRenderTarget();
robertphillips76948d42016-05-04 12:47:41 -070054
Robert Phillips294870f2016-11-11 12:38:40 -050055 REPORTER_ASSERT(reporter, rtProxy->uniqueID() == idBefore);
Greg Daniel2a303902018-02-20 10:25:54 -050056 // Deferred resources should always have a different ID from their instantiated rendertarget
Brian Salomonf7778972018-03-08 10:13:17 -050057 if (preinstantiated) {
58 REPORTER_ASSERT(reporter, rtProxy->uniqueID().asUInt() == rt->uniqueID().asUInt());
59 } else {
60 REPORTER_ASSERT(reporter, rtProxy->uniqueID().asUInt() != rt->uniqueID().asUInt());
61 }
Robert Phillips294870f2016-11-11 12:38:40 -050062
robertphillips76948d42016-05-04 12:47:41 -070063 if (SkBackingFit::kExact == fit) {
64 REPORTER_ASSERT(reporter, rt->width() == rtProxy->width());
65 REPORTER_ASSERT(reporter, rt->height() == rtProxy->height());
66 } else {
67 REPORTER_ASSERT(reporter, rt->width() >= rtProxy->width());
Robert Phillips294870f2016-11-11 12:38:40 -050068 REPORTER_ASSERT(reporter, rt->height() >= rtProxy->height());
robertphillips76948d42016-05-04 12:47:41 -070069 }
70 REPORTER_ASSERT(reporter, rt->config() == rtProxy->config());
71
Brian Salomon7c8460e2017-05-12 11:36:10 -040072 REPORTER_ASSERT(reporter, rt->fsaaType() == rtProxy->fsaaType());
robertphillips76948d42016-05-04 12:47:41 -070073 REPORTER_ASSERT(reporter, rt->numColorSamples() == rtProxy->numColorSamples());
74 REPORTER_ASSERT(reporter, rt->numStencilSamples() == rtProxy->numStencilSamples());
csmartdaltonf9635992016-08-10 11:09:07 -070075 REPORTER_ASSERT(reporter, rt->renderTargetPriv().flags() == rtProxy->testingOnly_getFlags());
robertphillips76948d42016-05-04 12:47:41 -070076}
77
78static void check_texture(skiatest::Reporter* reporter,
Brian Osman32342f02017-03-04 08:12:46 -050079 GrResourceProvider* provider,
robertphillips76948d42016-05-04 12:47:41 -070080 GrTextureProxy* texProxy,
Greg Daniel2a303902018-02-20 10:25:54 -050081 SkBackingFit fit) {
Robert Phillips294870f2016-11-11 12:38:40 -050082 GrSurfaceProxy::UniqueID idBefore = texProxy->uniqueID();
Robert Phillipseee4d6e2017-06-05 09:26:07 -040083
Brian Salomonf7778972018-03-08 10:13:17 -050084 bool preinstantiated = texProxy->priv().isInstantiated();
Robert Phillipseee4d6e2017-06-05 09:26:07 -040085 REPORTER_ASSERT(reporter, texProxy->instantiate(provider));
86 GrTexture* tex = texProxy->priv().peekTexture();
robertphillips76948d42016-05-04 12:47:41 -070087
Robert Phillips294870f2016-11-11 12:38:40 -050088 REPORTER_ASSERT(reporter, texProxy->uniqueID() == idBefore);
Greg Daniel2a303902018-02-20 10:25:54 -050089 // Deferred resources should always have a different ID from their instantiated texture
Brian Salomonf7778972018-03-08 10:13:17 -050090 if (preinstantiated) {
91 REPORTER_ASSERT(reporter, texProxy->uniqueID().asUInt() == tex->uniqueID().asUInt());
92 } else {
93 REPORTER_ASSERT(reporter, texProxy->uniqueID().asUInt() != tex->uniqueID().asUInt());
94 }
Robert Phillips294870f2016-11-11 12:38:40 -050095
robertphillips76948d42016-05-04 12:47:41 -070096 if (SkBackingFit::kExact == fit) {
97 REPORTER_ASSERT(reporter, tex->width() == texProxy->width());
98 REPORTER_ASSERT(reporter, tex->height() == texProxy->height());
99 } else {
100 REPORTER_ASSERT(reporter, tex->width() >= texProxy->width());
101 REPORTER_ASSERT(reporter, tex->height() >= texProxy->height());
102 }
103 REPORTER_ASSERT(reporter, tex->config() == texProxy->config());
104}
105
106
robertphillips8abb3702016-08-31 14:04:06 -0700107DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) {
Robert Phillips1afd4cd2018-01-08 13:40:32 -0500108 GrProxyProvider* proxyProvider = ctxInfo.grContext()->contextPriv().proxyProvider();
Robert Phillips6be756b2018-01-16 15:07:54 -0500109 GrResourceProvider* resourceProvider = ctxInfo.grContext()->contextPriv().resourceProvider();
Robert Phillipsabacf092016-11-02 10:23:32 -0400110 const GrCaps& caps = *ctxInfo.grContext()->caps();
robertphillips76948d42016-05-04 12:47:41 -0700111
Robert Phillips6520a692017-02-01 09:20:00 -0500112 int attempt = 0; // useful for debugging
113
robertphillips76948d42016-05-04 12:47:41 -0700114 for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin }) {
Robert Phillips40d94952017-01-30 14:15:59 -0500115 for (auto widthHeight : { 100, 128, 1048576 }) {
Robert Phillips6520a692017-02-01 09:20:00 -0500116 for (auto config : { kAlpha_8_GrPixelConfig, kRGB_565_GrPixelConfig,
Brian Osman10fc6fd2018-03-02 11:01:10 -0500117 kRGBA_8888_GrPixelConfig, kRGBA_1010102_GrPixelConfig }) {
robertphillips76948d42016-05-04 12:47:41 -0700118 for (auto fit : { SkBackingFit::kExact, SkBackingFit::kApprox }) {
119 for (auto budgeted : { SkBudgeted::kYes, SkBudgeted::kNo }) {
Brian Salomonbdecacf2018-02-02 20:32:49 -0500120 for (auto numSamples : {1, 4, 16, 128}) {
robertphillips76948d42016-05-04 12:47:41 -0700121 GrSurfaceDesc desc;
Robert Phillips84a81202016-11-04 11:59:10 -0400122 desc.fFlags = kRenderTarget_GrSurfaceFlag;
robertphillips76948d42016-05-04 12:47:41 -0700123 desc.fWidth = widthHeight;
124 desc.fHeight = widthHeight;
125 desc.fConfig = config;
126 desc.fSampleCnt = numSamples;
127
Robert Phillips6520a692017-02-01 09:20:00 -0500128 {
129 sk_sp<GrTexture> tex;
130 if (SkBackingFit::kApprox == fit) {
Robert Phillips1afd4cd2018-01-08 13:40:32 -0500131 tex = resourceProvider->createApproxTexture(desc, 0);
Robert Phillips6520a692017-02-01 09:20:00 -0500132 } else {
Robert Phillips1afd4cd2018-01-08 13:40:32 -0500133 tex = resourceProvider->createTexture(desc, budgeted);
Robert Phillips6520a692017-02-01 09:20:00 -0500134 }
135
Brian Salomon2a4f9832018-03-03 22:43:43 -0500136 sk_sp<GrTextureProxy> proxy =
137 proxyProvider->createProxy(desc, origin, fit, budgeted);
Robert Phillips2f493142017-03-02 18:18:38 -0500138 REPORTER_ASSERT(reporter, SkToBool(tex) == SkToBool(proxy));
139 if (proxy) {
140 REPORTER_ASSERT(reporter, proxy->asRenderTargetProxy());
Robert Phillips40d94952017-01-30 14:15:59 -0500141 // This forces the proxy to compute and cache its
142 // pre-instantiation size guess. Later, when it is actually
143 // instantiated, it checks that the instantiated size is <= to
144 // the pre-computation. If the proxy never computed its
145 // pre-instantiation size then the check is skipped.
Robert Phillips2f493142017-03-02 18:18:38 -0500146 proxy->gpuMemorySize();
Robert Phillipsb4460882016-11-17 14:43:51 -0500147
Robert Phillips2f493142017-03-02 18:18:38 -0500148 check_surface(reporter, proxy.get(), origin,
Robert Phillips0bd24dc2018-01-16 08:06:32 -0500149 widthHeight, widthHeight, config, budgeted);
Brian Salomonbdecacf2018-02-02 20:32:49 -0500150 int supportedSamples =
151 caps.getRenderTargetSampleCount(numSamples, config);
Robert Phillips1afd4cd2018-01-08 13:40:32 -0500152 check_rendertarget(reporter, caps, resourceProvider,
Robert Phillips2f493142017-03-02 18:18:38 -0500153 proxy->asRenderTargetProxy(),
Greg Daniel81e7bf82017-07-19 14:47:42 -0400154 supportedSamples,
Greg Daniel2a303902018-02-20 10:25:54 -0500155 fit, caps.maxWindowRectangles());
Robert Phillips40d94952017-01-30 14:15:59 -0500156 }
robertphillips76948d42016-05-04 12:47:41 -0700157 }
158
Robert Phillips84a81202016-11-04 11:59:10 -0400159 desc.fFlags = kNone_GrSurfaceFlags;
robertphillips76948d42016-05-04 12:47:41 -0700160
Robert Phillips6520a692017-02-01 09:20:00 -0500161 {
162 sk_sp<GrTexture> tex;
163 if (SkBackingFit::kApprox == fit) {
Robert Phillips1afd4cd2018-01-08 13:40:32 -0500164 tex = resourceProvider->createApproxTexture(desc, 0);
Robert Phillips6520a692017-02-01 09:20:00 -0500165 } else {
Robert Phillips1afd4cd2018-01-08 13:40:32 -0500166 tex = resourceProvider->createTexture(desc, budgeted);
Robert Phillips6520a692017-02-01 09:20:00 -0500167 }
Robert Phillipsb4460882016-11-17 14:43:51 -0500168
Brian Salomon2a4f9832018-03-03 22:43:43 -0500169 sk_sp<GrTextureProxy> proxy(
170 proxyProvider->createProxy(desc, origin, fit, budgeted));
Robert Phillips2f493142017-03-02 18:18:38 -0500171 REPORTER_ASSERT(reporter, SkToBool(tex) == SkToBool(proxy));
172 if (proxy) {
Robert Phillips1afd4cd2018-01-08 13:40:32 -0500173 // This forces the proxy to compute and cache its
174 // pre-instantiation size guess. Later, when it is actually
175 // instantiated, it checks that the instantiated size is <= to
176 // the pre-computation. If the proxy never computed its
177 // pre-instantiation size then the check is skipped.
Robert Phillips2f493142017-03-02 18:18:38 -0500178 proxy->gpuMemorySize();
Robert Phillips6520a692017-02-01 09:20:00 -0500179
Robert Phillips2f493142017-03-02 18:18:38 -0500180 check_surface(reporter, proxy.get(), origin,
Robert Phillips0bd24dc2018-01-16 08:06:32 -0500181 widthHeight, widthHeight, config, budgeted);
Robert Phillips1afd4cd2018-01-08 13:40:32 -0500182 check_texture(reporter, resourceProvider,
Greg Daniel2a303902018-02-20 10:25:54 -0500183 proxy->asTextureProxy(), fit);
Robert Phillips6520a692017-02-01 09:20:00 -0500184 }
Robert Phillips40d94952017-01-30 14:15:59 -0500185 }
Robert Phillips6520a692017-02-01 09:20:00 -0500186
187 attempt++;
robertphillips76948d42016-05-04 12:47:41 -0700188 }
189 }
190 }
191 }
192 }
193 }
194}
195
egdanielab527a52016-06-28 08:07:26 -0700196DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
Robert Phillips0bd24dc2018-01-16 08:06:32 -0500197 GrProxyProvider* proxyProvider = ctxInfo.grContext()->contextPriv().proxyProvider();
Robert Phillips6be756b2018-01-16 15:07:54 -0500198 GrResourceProvider* resourceProvider = ctxInfo.grContext()->contextPriv().resourceProvider();
Greg Daniel2a303902018-02-20 10:25:54 -0500199 GrGpu* gpu = ctxInfo.grContext()->contextPriv().getGpu();
csmartdaltonf9635992016-08-10 11:09:07 -0700200 const GrCaps& caps = *ctxInfo.grContext()->caps();
robertphillips76948d42016-05-04 12:47:41 -0700201
202 static const int kWidthHeight = 100;
203
Greg Daniel2a303902018-02-20 10:25:54 -0500204 if (kOpenGL_GrBackend != ctxInfo.backend()) {
205 return;
206 }
robertphillips76948d42016-05-04 12:47:41 -0700207 for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin }) {
Brian Osman10fc6fd2018-03-02 11:01:10 -0500208 for (auto colorType : { kAlpha_8_SkColorType, kRGBA_8888_SkColorType,
209 kRGBA_1010102_SkColorType }) {
Greg Daniel2a303902018-02-20 10:25:54 -0500210 for (auto numSamples : {1, 4}) {
211 GrPixelConfig config = SkImageInfo2GrPixelConfig(colorType, nullptr, caps);
Greg Daniel0a7aa142018-02-21 13:02:32 -0500212 SkASSERT(kUnknown_GrPixelConfig != config);
Greg Daniel2a303902018-02-20 10:25:54 -0500213 int supportedNumSamples = caps.getRenderTargetSampleCount(numSamples, config);
robertphillips76948d42016-05-04 12:47:41 -0700214
Greg Daniel2a303902018-02-20 10:25:54 -0500215 if (!supportedNumSamples) {
216 continue;
217 }
robertphillips76948d42016-05-04 12:47:41 -0700218
Greg Daniel2a303902018-02-20 10:25:54 -0500219 // External on-screen render target.
Brian Salomon7578f3e2018-03-07 14:39:54 -0500220 // Tests wrapBackendRenderTarget with a GrBackendRenderTarget
Greg Daniel2a303902018-02-20 10:25:54 -0500221 {
222 GrGLFramebufferInfo fboInfo;
223 fboInfo.fFBOID = 0;
224 GrBackendRenderTarget backendRT(kWidthHeight, kWidthHeight, numSamples, 8,
225 config, fboInfo);
csmartdaltonf9635992016-08-10 11:09:07 -0700226
Brian Salomon7578f3e2018-03-07 14:39:54 -0500227 sk_sp<GrSurfaceProxy> sProxy(
228 proxyProvider->wrapBackendRenderTarget(backendRT, origin));
Greg Daniel2a303902018-02-20 10:25:54 -0500229 check_surface(reporter, sProxy.get(), origin,
230 kWidthHeight, kWidthHeight,
231 backendRT.testingOnly_getPixelConfig(), SkBudgeted::kNo);
232 check_rendertarget(reporter, caps, resourceProvider,
233 sProxy->asRenderTargetProxy(),
234 supportedNumSamples, SkBackingFit::kExact, 0);
235 }
236
Brian Salomon7578f3e2018-03-07 14:39:54 -0500237 // Tests wrapBackendRenderTarget with a GrBackendTexture
Greg Daniel2a303902018-02-20 10:25:54 -0500238 {
239 GrBackendTexture backendTex =
240 gpu->createTestingOnlyBackendTexture(nullptr, kWidthHeight,
241 kWidthHeight, colorType, true,
242 GrMipMapped::kNo);
Brian Salomon7578f3e2018-03-07 14:39:54 -0500243 sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapBackendTextureAsRenderTarget(
244 backendTex, origin, supportedNumSamples);
Greg Daniel2a303902018-02-20 10:25:54 -0500245 if (!sProxy) {
Greg Danielf87651e2018-02-21 11:36:53 -0500246 gpu->deleteTestingOnlyBackendTexture(&backendTex);
Greg Daniel2a303902018-02-20 10:25:54 -0500247 continue; // This can fail on Mesa
csmartdaltonf9635992016-08-10 11:09:07 -0700248 }
249
Greg Daniel2a303902018-02-20 10:25:54 -0500250 check_surface(reporter, sProxy.get(), origin,
251 kWidthHeight, kWidthHeight,
252 backendTex.testingOnly_getPixelConfig(), SkBudgeted::kNo);
253 check_rendertarget(reporter, caps, resourceProvider,
254 sProxy->asRenderTargetProxy(),
255 supportedNumSamples, SkBackingFit::kExact,
256 caps.maxWindowRectangles());
robertphillips76948d42016-05-04 12:47:41 -0700257
Greg Daniel2a303902018-02-20 10:25:54 -0500258 gpu->deleteTestingOnlyBackendTexture(&backendTex);
259 }
Robert Phillips0bd24dc2018-01-16 08:06:32 -0500260
Brian Salomon7578f3e2018-03-07 14:39:54 -0500261 // Tests wrapBackendTexture that is only renderable
Greg Danielf87651e2018-02-21 11:36:53 -0500262 {
263 GrBackendTexture backendTex =
264 gpu->createTestingOnlyBackendTexture(nullptr, kWidthHeight,
265 kWidthHeight, colorType, true,
266 GrMipMapped::kNo);
267
Brian Salomon7578f3e2018-03-07 14:39:54 -0500268 sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapRenderableBackendTexture(
269 backendTex, origin, supportedNumSamples);
Greg Danielf87651e2018-02-21 11:36:53 -0500270 if (!sProxy) {
271 gpu->deleteTestingOnlyBackendTexture(&backendTex);
272 continue; // This can fail on Mesa
273 }
274
275 check_surface(reporter, sProxy.get(), origin,
276 kWidthHeight, kWidthHeight,
277 backendTex.testingOnly_getPixelConfig(), SkBudgeted::kNo);
278 check_rendertarget(reporter, caps, resourceProvider,
279 sProxy->asRenderTargetProxy(),
280 supportedNumSamples, SkBackingFit::kExact,
281 caps.maxWindowRectangles());
282
283 gpu->deleteTestingOnlyBackendTexture(&backendTex);
284 }
285
Brian Salomon7578f3e2018-03-07 14:39:54 -0500286 // Tests wrapBackendTexture that is only textureable
Greg Daniel2a303902018-02-20 10:25:54 -0500287 {
288 // Internal offscreen texture
289 GrBackendTexture backendTex =
290 gpu->createTestingOnlyBackendTexture(nullptr, kWidthHeight,
291 kWidthHeight, colorType, false,
292 GrMipMapped::kNo);
robertphillips76948d42016-05-04 12:47:41 -0700293
Brian Salomon7578f3e2018-03-07 14:39:54 -0500294 sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapBackendTexture(
295 backendTex, origin, kBorrow_GrWrapOwnership, nullptr, nullptr);
Greg Daniel2a303902018-02-20 10:25:54 -0500296 if (!sProxy) {
Greg Danielf87651e2018-02-21 11:36:53 -0500297 gpu->deleteTestingOnlyBackendTexture(&backendTex);
Greg Daniel2a303902018-02-20 10:25:54 -0500298 continue;
Robert Phillips0bd24dc2018-01-16 08:06:32 -0500299 }
Greg Daniel2a303902018-02-20 10:25:54 -0500300
301 check_surface(reporter, sProxy.get(), origin,
302 kWidthHeight, kWidthHeight,
303 backendTex.testingOnly_getPixelConfig(), SkBudgeted::kNo);
304 check_texture(reporter, resourceProvider, sProxy->asTextureProxy(),
305 SkBackingFit::kExact);
306
307 gpu->deleteTestingOnlyBackendTexture(&backendTex);
robertphillips76948d42016-05-04 12:47:41 -0700308 }
309 }
310 }
311 }
312}
313
Robert Phillips78de2122017-04-26 07:44:26 -0400314DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ZeroSizedProxyTest, reporter, ctxInfo) {
Robert Phillips1afd4cd2018-01-08 13:40:32 -0500315 GrProxyProvider* provider = ctxInfo.grContext()->contextPriv().proxyProvider();
Robert Phillips78de2122017-04-26 07:44:26 -0400316
317 for (auto flags : { kRenderTarget_GrSurfaceFlag, kNone_GrSurfaceFlags }) {
318 for (auto fit : { SkBackingFit::kExact, SkBackingFit::kApprox }) {
319 for (int width : { 0, 100 }) {
320 for (int height : { 0, 100}) {
321 if (width && height) {
322 continue; // not zero-sized
323 }
324
325 GrSurfaceDesc desc;
326 desc.fFlags = flags;
Robert Phillips78de2122017-04-26 07:44:26 -0400327 desc.fWidth = width;
328 desc.fHeight = height;
329 desc.fConfig = kRGBA_8888_GrPixelConfig;
Brian Salomonbdecacf2018-02-02 20:32:49 -0500330 desc.fSampleCnt = 1;
Robert Phillips78de2122017-04-26 07:44:26 -0400331
Brian Salomon2a4f9832018-03-03 22:43:43 -0500332 sk_sp<GrTextureProxy> proxy = provider->createProxy(
333 desc, kBottomLeft_GrSurfaceOrigin, fit, SkBudgeted::kNo);
Robert Phillips78de2122017-04-26 07:44:26 -0400334 REPORTER_ASSERT(reporter, !proxy);
335 }
336 }
337 }
338 }
339}
340
robertphillips76948d42016-05-04 12:47:41 -0700341#endif