blob: 9dec7a1b2b8af4664407c467e6bc19b795ff3643 [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
Mike Kleinc0bd9f92019-04-23 12:05:21 -050010#include "include/gpu/GrBackendSurface.h"
Robert Phillips6d344c32020-07-06 10:56:46 -040011#include "include/gpu/GrDirectContext.h"
Adlai Hollera0693042020-10-14 11:23:11 -040012#include "src/gpu/GrDirectContextPriv.h"
Brian Salomonf7f54332020-07-28 09:23:35 -040013#include "src/gpu/GrGpu.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050014#include "src/gpu/GrProxyProvider.h"
Brian Salomonf7f54332020-07-28 09:23:35 -040015#include "src/gpu/GrRenderTarget.h"
Greg Danielf91aeb22019-06-18 09:58:02 -040016#include "src/gpu/GrRenderTargetProxy.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050017#include "src/gpu/GrResourceProvider.h"
Brian Salomonf7f54332020-07-28 09:23:35 -040018#include "src/gpu/GrSurface.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050019#include "src/gpu/GrSurfaceProxyPriv.h"
Greg Daniel456f9b52020-03-05 19:14:18 +000020#include "src/gpu/GrTexture.h"
Greg Danielf91aeb22019-06-18 09:58:02 -040021#include "src/gpu/GrTextureProxy.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050022#include "src/gpu/SkGr.h"
Brian Salomon72050802020-10-12 20:45:06 -040023#include "tests/Test.h"
24#include "tools/gpu/ManagedBackendTexture.h"
John Rosascoa9b348f2019-11-08 13:18:15 -080025#ifdef SK_GL
Mike Kleinc0bd9f92019-04-23 12:05:21 -050026#include "src/gpu/gl/GrGLDefines.h"
Brian Salomond4764a12019-08-08 12:08:24 -040027#include "src/gpu/gl/GrGLUtil.h"
John Rosascoa9b348f2019-11-08 13:18:15 -080028#endif
robertphillips76948d42016-05-04 12:47:41 -070029
Greg Danielc1ad77c2020-05-06 11:40:03 -040030#include "tests/TestUtils.h"
31
robertphillips8abb3702016-08-31 14:04:06 -070032// Check that the surface proxy's member vars are set as expected
robertphillips76948d42016-05-04 12:47:41 -070033static void check_surface(skiatest::Reporter* reporter,
34 GrSurfaceProxy* proxy,
Greg Danielbcf612b2017-05-01 13:50:58 +000035 int width, int height,
Robert Phillipsabacf092016-11-02 10:23:32 -040036 SkBudgeted budgeted) {
robertphillips76948d42016-05-04 12:47:41 -070037 REPORTER_ASSERT(reporter, proxy->width() == width);
38 REPORTER_ASSERT(reporter, proxy->height() == height);
Robert Phillips0bd24dc2018-01-16 08:06:32 -050039 REPORTER_ASSERT(reporter, !proxy->uniqueID().isInvalid());
Robert Phillipsabacf092016-11-02 10:23:32 -040040 REPORTER_ASSERT(reporter, proxy->isBudgeted() == budgeted);
robertphillips76948d42016-05-04 12:47:41 -070041}
42
43static void check_rendertarget(skiatest::Reporter* reporter,
Robert Phillipsec2249f2016-11-09 08:54:35 -050044 const GrCaps& caps,
Brian Osman32342f02017-03-04 08:12:46 -050045 GrResourceProvider* provider,
robertphillips76948d42016-05-04 12:47:41 -070046 GrRenderTargetProxy* rtProxy,
Robert Phillipsabacf092016-11-02 10:23:32 -040047 int numSamples,
Robert Phillipsec2249f2016-11-09 08:54:35 -050048 SkBackingFit fit,
Greg Daniel2a303902018-02-20 10:25:54 -050049 int expectedMaxWindowRects) {
Robert Phillipsec2249f2016-11-09 08:54:35 -050050 REPORTER_ASSERT(reporter, rtProxy->maxWindowRectangles(caps) == expectedMaxWindowRects);
Chris Dalton6ce447a2019-06-23 18:07:38 -060051 REPORTER_ASSERT(reporter, rtProxy->numSamples() == numSamples);
Robert Phillipsabacf092016-11-02 10:23:32 -040052
Robert Phillips294870f2016-11-11 12:38:40 -050053 GrSurfaceProxy::UniqueID idBefore = rtProxy->uniqueID();
Brian Salomonfd98c2c2018-07-31 17:25:29 -040054 bool preinstantiated = rtProxy->isInstantiated();
Robert Phillipseee4d6e2017-06-05 09:26:07 -040055 REPORTER_ASSERT(reporter, rtProxy->instantiate(provider));
Brian Salomonfd98c2c2018-07-31 17:25:29 -040056 GrRenderTarget* rt = rtProxy->peekRenderTarget();
robertphillips76948d42016-05-04 12:47:41 -070057
Robert Phillips294870f2016-11-11 12:38:40 -050058 REPORTER_ASSERT(reporter, rtProxy->uniqueID() == idBefore);
Greg Daniel2a303902018-02-20 10:25:54 -050059 // Deferred resources should always have a different ID from their instantiated rendertarget
Brian Salomonf7778972018-03-08 10:13:17 -050060 if (preinstantiated) {
61 REPORTER_ASSERT(reporter, rtProxy->uniqueID().asUInt() == rt->uniqueID().asUInt());
62 } else {
63 REPORTER_ASSERT(reporter, rtProxy->uniqueID().asUInt() != rt->uniqueID().asUInt());
64 }
Robert Phillips294870f2016-11-11 12:38:40 -050065
robertphillips76948d42016-05-04 12:47:41 -070066 if (SkBackingFit::kExact == fit) {
Brian Salomon9f2b86c2019-10-22 10:37:46 -040067 REPORTER_ASSERT(reporter, rt->dimensions() == rtProxy->dimensions());
robertphillips76948d42016-05-04 12:47:41 -070068 } else {
69 REPORTER_ASSERT(reporter, rt->width() >= rtProxy->width());
Robert Phillips294870f2016-11-11 12:38:40 -050070 REPORTER_ASSERT(reporter, rt->height() >= rtProxy->height());
robertphillips76948d42016-05-04 12:47:41 -070071 }
Greg Danield51fa2f2020-01-22 16:53:38 -050072 REPORTER_ASSERT(reporter, rt->backendFormat() == rtProxy->backendFormat());
robertphillips76948d42016-05-04 12:47:41 -070073
Chris Dalton6ce447a2019-06-23 18:07:38 -060074 REPORTER_ASSERT(reporter, rt->numSamples() == rtProxy->numSamples());
Brian Salomonf7f54332020-07-28 09:23:35 -040075 REPORTER_ASSERT(reporter, rt->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 Salomonfd98c2c2018-07-31 17:25:29 -040084 bool preinstantiated = texProxy->isInstantiated();
Michael Ludwigbd2f0702019-09-13 15:29:41 -040085 // The instantiated texture should have these dimensions. If the fit is kExact, then
Robert Phillipse9462dd2019-10-23 12:41:29 -040086 // 'backingStoreDimensions' reports the original WxH. If it is kApprox, make sure that
87 // the texture is that size and didn't reuse one of the kExact surfaces in the provider.
88 // This is important because upstream usage (e.g. SkImage) reports size based on the
89 // backingStoreDimensions and client code may rely on that if they are creating backend
90 // resources.
91 // NOTE: we store these before instantiating, since after instantiation backingStoreDimensions
92 // just returns the target's dimensions. In this instance, we want to ensure the target's
Brian Salomon9f2b86c2019-10-22 10:37:46 -040093 // dimensions are no different from the original approximate (or exact) dimensions.
Robert Phillipse9462dd2019-10-23 12:41:29 -040094 SkISize expectedSize = texProxy->backingStoreDimensions();
Michael Ludwigbd2f0702019-09-13 15:29:41 -040095
Robert Phillipseee4d6e2017-06-05 09:26:07 -040096 REPORTER_ASSERT(reporter, texProxy->instantiate(provider));
Brian Salomonfd98c2c2018-07-31 17:25:29 -040097 GrTexture* tex = texProxy->peekTexture();
robertphillips76948d42016-05-04 12:47:41 -070098
Robert Phillips294870f2016-11-11 12:38:40 -050099 REPORTER_ASSERT(reporter, texProxy->uniqueID() == idBefore);
Greg Daniel2a303902018-02-20 10:25:54 -0500100 // Deferred resources should always have a different ID from their instantiated texture
Brian Salomonf7778972018-03-08 10:13:17 -0500101 if (preinstantiated) {
102 REPORTER_ASSERT(reporter, texProxy->uniqueID().asUInt() == tex->uniqueID().asUInt());
103 } else {
104 REPORTER_ASSERT(reporter, texProxy->uniqueID().asUInt() != tex->uniqueID().asUInt());
105 }
Robert Phillips294870f2016-11-11 12:38:40 -0500106
Brian Salomon9f2b86c2019-10-22 10:37:46 -0400107 REPORTER_ASSERT(reporter, tex->dimensions() == expectedSize);
Michael Ludwigbd2f0702019-09-13 15:29:41 -0400108
Greg Danield51fa2f2020-01-22 16:53:38 -0500109 REPORTER_ASSERT(reporter, tex->backendFormat() == texProxy->backendFormat());
robertphillips76948d42016-05-04 12:47:41 -0700110}
111
112
robertphillips8abb3702016-08-31 14:04:06 -0700113DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) {
Robert Phillips6d344c32020-07-06 10:56:46 -0400114 auto direct = ctxInfo.directContext();
115 GrProxyProvider* proxyProvider = direct->priv().proxyProvider();
116 GrResourceProvider* resourceProvider = direct->priv().resourceProvider();
117 const GrCaps& caps = *direct->priv().caps();
robertphillips76948d42016-05-04 12:47:41 -0700118
Robert Phillips6520a692017-02-01 09:20:00 -0500119 int attempt = 0; // useful for debugging
120
Greg Daniel3a365112020-02-14 10:47:18 -0500121 for (auto widthHeight : {100, 128, 1048576}) {
122 for (auto ct : {GrColorType::kAlpha_8, GrColorType::kBGR_565, GrColorType::kRGBA_8888,
123 GrColorType::kRGBA_1010102}) {
124 for (auto fit : {SkBackingFit::kExact, SkBackingFit::kApprox}) {
125 for (auto budgeted : {SkBudgeted::kYes, SkBudgeted::kNo}) {
126 for (auto numSamples : {1, 4, 16, 128}) {
127 SkISize dims = {widthHeight, widthHeight};
robertphillips76948d42016-05-04 12:47:41 -0700128
Greg Daniel3a365112020-02-14 10:47:18 -0500129 auto format = caps.getDefaultBackendFormat(ct, GrRenderable::kYes);
130 if (!format.isValid()) {
131 continue;
robertphillips76948d42016-05-04 12:47:41 -0700132 }
Greg Daniel3a365112020-02-14 10:47:18 -0500133
134 // Renderable
135 {
136 sk_sp<GrTexture> tex;
137 if (SkBackingFit::kApprox == fit) {
138 tex = resourceProvider->createApproxTexture(
Greg Daniel0e9d34d2021-08-13 16:20:18 -0400139 dims, format, GrTextureType::k2D, GrRenderable::kYes,
140 numSamples, GrProtected::kNo);
Greg Daniel3a365112020-02-14 10:47:18 -0500141 } else {
142 tex = resourceProvider->createTexture(
Greg Daniel0e9d34d2021-08-13 16:20:18 -0400143 dims, format, GrTextureType::k2D, GrRenderable::kYes,
144 numSamples, GrMipmapped::kNo, budgeted, GrProtected::kNo);
Greg Daniel3a365112020-02-14 10:47:18 -0500145 }
146
147 sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
Brian Salomon7e67dca2020-07-21 09:27:25 -0400148 format, dims, GrRenderable::kYes, numSamples, GrMipmapped::kNo,
Brian Salomondf1bd6d2020-03-26 20:37:01 -0400149 fit, budgeted, GrProtected::kNo);
Greg Daniel3a365112020-02-14 10:47:18 -0500150 REPORTER_ASSERT(reporter, SkToBool(tex) == SkToBool(proxy));
151 if (proxy) {
152 REPORTER_ASSERT(reporter, proxy->asRenderTargetProxy());
153 // This forces the proxy to compute and cache its
154 // pre-instantiation size guess. Later, when it is actually
155 // instantiated, it checks that the instantiated size is <= to
156 // the pre-computation. If the proxy never computed its
157 // pre-instantiation size then the check is skipped.
Greg Daniel0eca74c2020-10-01 13:46:00 -0400158 proxy->gpuMemorySize();
Greg Daniel3a365112020-02-14 10:47:18 -0500159
160 check_surface(reporter, proxy.get(), widthHeight, widthHeight,
161 budgeted);
162 int supportedSamples =
163 caps.getRenderTargetSampleCount(numSamples, format);
164 check_rendertarget(reporter, caps, resourceProvider,
165 proxy->asRenderTargetProxy(), supportedSamples,
166 fit, caps.maxWindowRectangles());
167 }
168 }
169
170 // Not renderable
171 {
172 sk_sp<GrTexture> tex;
173 if (SkBackingFit::kApprox == fit) {
174 tex = resourceProvider->createApproxTexture(
Greg Daniel0e9d34d2021-08-13 16:20:18 -0400175 dims, format, GrTextureType::k2D, GrRenderable::kNo,
176 numSamples, GrProtected::kNo);
Greg Daniel3a365112020-02-14 10:47:18 -0500177 } else {
178 tex = resourceProvider->createTexture(
Greg Daniel0e9d34d2021-08-13 16:20:18 -0400179 dims, format, GrTextureType::k2D, GrRenderable::kNo,
180 numSamples, GrMipmapped::kNo, budgeted, GrProtected::kNo);
Greg Daniel3a365112020-02-14 10:47:18 -0500181 }
182
183 sk_sp<GrTextureProxy> proxy(proxyProvider->createProxy(
Brian Salomon7e67dca2020-07-21 09:27:25 -0400184 format, dims, GrRenderable::kNo, numSamples, GrMipmapped::kNo,
Brian Salomondf1bd6d2020-03-26 20:37:01 -0400185 fit, budgeted, GrProtected::kNo));
Greg Daniel3a365112020-02-14 10:47:18 -0500186 REPORTER_ASSERT(reporter, SkToBool(tex) == SkToBool(proxy));
187 if (proxy) {
188 // This forces the proxy to compute and cache its
189 // pre-instantiation size guess. Later, when it is actually
190 // instantiated, it checks that the instantiated size is <= to
191 // the pre-computation. If the proxy never computed its
192 // pre-instantiation size then the check is skipped.
Greg Daniel0eca74c2020-10-01 13:46:00 -0400193 proxy->gpuMemorySize();
Greg Daniel3a365112020-02-14 10:47:18 -0500194
195 check_surface(reporter, proxy.get(), widthHeight, widthHeight,
196 budgeted);
197 check_texture(reporter, resourceProvider, proxy->asTextureProxy(),
198 fit);
199 }
200 }
201
202 attempt++;
robertphillips76948d42016-05-04 12:47:41 -0700203 }
204 }
205 }
206 }
207 }
208}
209
egdanielab527a52016-06-28 08:07:26 -0700210DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
Robert Phillips6d344c32020-07-06 10:56:46 -0400211 auto direct = ctxInfo.directContext();
212 GrProxyProvider* proxyProvider = direct->priv().proxyProvider();
213 GrResourceProvider* resourceProvider = direct->priv().resourceProvider();
214 GrGpu* gpu = direct->priv().getGpu();
215 const GrCaps& caps = *direct->priv().caps();
robertphillips76948d42016-05-04 12:47:41 -0700216
217 static const int kWidthHeight = 100;
218
Greg Daniel3a365112020-02-14 10:47:18 -0500219 for (auto colorType :
220 {kAlpha_8_SkColorType, kRGBA_8888_SkColorType, kRGBA_1010102_SkColorType}) {
221 GrColorType grColorType = SkColorTypeToGrColorType(colorType);
Robert Phillipsc80b0e92019-07-23 10:27:09 -0400222
Greg Daniel3a365112020-02-14 10:47:18 -0500223 // External on-screen render target.
224 // Tests wrapBackendRenderTarget with a GrBackendRenderTarget
225 // Our test-only function that creates a backend render target doesn't currently support
226 // sample counts :(.
Robert Phillips6d344c32020-07-06 10:56:46 -0400227 if (direct->colorTypeSupportedAsSurface(colorType)) {
Greg Daniel3a365112020-02-14 10:47:18 -0500228 GrBackendRenderTarget backendRT = gpu->createTestingOnlyBackendRenderTarget(
Brian Salomon72c7b982020-10-06 10:07:38 -0400229 {kWidthHeight, kWidthHeight}, grColorType);
Brian Salomon8a78e9c2020-03-27 10:42:15 -0400230 sk_sp<GrSurfaceProxy> sProxy(
Robert Phillipsa1121332020-06-29 13:05:29 -0400231 proxyProvider->wrapBackendRenderTarget(backendRT, nullptr));
Greg Daniel3a365112020-02-14 10:47:18 -0500232 check_surface(reporter, sProxy.get(), kWidthHeight, kWidthHeight, SkBudgeted::kNo);
233 static constexpr int kExpectedNumSamples = 1;
234 check_rendertarget(reporter, caps, resourceProvider, sProxy->asRenderTargetProxy(),
235 kExpectedNumSamples, SkBackingFit::kExact,
236 caps.maxWindowRectangles());
237 gpu->deleteTestingOnlyBackendRenderTarget(backendRT);
238 }
239
240 for (auto numSamples : {1, 4}) {
241 auto beFormat = caps.getDefaultBackendFormat(grColorType, GrRenderable::kYes);
242 int supportedNumSamples = caps.getRenderTargetSampleCount(numSamples, beFormat);
243 if (!supportedNumSamples) {
244 continue;
Brian Salomon52e943a2018-03-13 09:32:39 -0400245 }
246
Greg Daniel3a365112020-02-14 10:47:18 -0500247#ifdef SK_GL
248 // Test wrapping FBO 0 (with made up properties). This tests sample count and the
249 // special case where FBO 0 doesn't support window rectangles.
250 if (GrBackendApi::kOpenGL == ctxInfo.backend()) {
251 GrGLFramebufferInfo fboInfo;
252 fboInfo.fFBOID = 0;
253 fboInfo.fFormat = GrGLFormatToEnum(beFormat.asGLFormat());
254 SkASSERT(fboInfo.fFormat);
255 static constexpr int kStencilBits = 8;
256 GrBackendRenderTarget backendRT(kWidthHeight, kWidthHeight, numSamples,
257 kStencilBits, fboInfo);
Brian Salomon8a78e9c2020-03-27 10:42:15 -0400258 sk_sp<GrSurfaceProxy> sProxy(
Robert Phillipsa1121332020-06-29 13:05:29 -0400259 proxyProvider->wrapBackendRenderTarget(backendRT, nullptr));
Greg Daniel3a365112020-02-14 10:47:18 -0500260 check_surface(reporter, sProxy.get(), kWidthHeight, kWidthHeight, SkBudgeted::kNo);
261 check_rendertarget(reporter, caps, resourceProvider, sProxy->asRenderTargetProxy(),
262 supportedNumSamples, SkBackingFit::kExact, 0);
263 }
264#endif
265
Greg Daniel3a365112020-02-14 10:47:18 -0500266 // Tests wrapBackendTexture that is only renderable
267 {
Brian Salomon72050802020-10-12 20:45:06 -0400268 auto mbet = sk_gpu_test::ManagedBackendTexture::MakeWithoutData(direct,
269 kWidthHeight,
270 kWidthHeight,
271 colorType,
272 GrMipmapped::kNo,
273 GrRenderable::kYes);
274 if (!mbet) {
275 ERRORF(reporter,
276 "Could not create renderable backend texture of color type %d",
277 colorType);
278 continue;
279 }
Greg Daniel3a365112020-02-14 10:47:18 -0500280 sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapRenderableBackendTexture(
Brian Salomon72050802020-10-12 20:45:06 -0400281 mbet->texture(), supportedNumSamples, kBorrow_GrWrapOwnership,
Robert Phillipsa1121332020-06-29 13:05:29 -0400282 GrWrapCacheable::kNo, nullptr);
Greg Daniel3a365112020-02-14 10:47:18 -0500283 if (!sProxy) {
Brian Salomon72050802020-10-12 20:45:06 -0400284 ERRORF(reporter, "wrapRenderableBackendTexture failed");
285 continue;
Greg Daniel3a365112020-02-14 10:47:18 -0500286 }
287
288 check_surface(reporter, sProxy.get(), kWidthHeight, kWidthHeight, SkBudgeted::kNo);
289 check_rendertarget(reporter, caps, resourceProvider, sProxy->asRenderTargetProxy(),
290 supportedNumSamples, SkBackingFit::kExact,
291 caps.maxWindowRectangles());
Greg Daniel3a365112020-02-14 10:47:18 -0500292 }
293
Greg Daniel3a365112020-02-14 10:47:18 -0500294 {
Brian Salomon72050802020-10-12 20:45:06 -0400295 // Tests wrapBackendTexture that is only textureable
296 auto mbet = sk_gpu_test::ManagedBackendTexture::MakeWithoutData(direct,
297 kWidthHeight,
298 kWidthHeight,
299 colorType,
300 GrMipmapped::kNo,
301 GrRenderable::kNo);
302 if (!mbet) {
303 ERRORF(reporter,
304 "Could not create non-renderable backend texture of color type %d",
305 colorType);
306 continue;
307 }
Greg Daniel3a365112020-02-14 10:47:18 -0500308 sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapBackendTexture(
Brian Salomon72050802020-10-12 20:45:06 -0400309 mbet->texture(), kBorrow_GrWrapOwnership, GrWrapCacheable::kNo,
310 kRead_GrIOType, mbet->refCountedCallback());
Greg Daniel3a365112020-02-14 10:47:18 -0500311 if (!sProxy) {
Brian Salomon72050802020-10-12 20:45:06 -0400312 ERRORF(reporter, "wrapBackendTexture failed");
Greg Daniel2a303902018-02-20 10:25:54 -0500313 continue;
314 }
robertphillips76948d42016-05-04 12:47:41 -0700315
Greg Daniel3a365112020-02-14 10:47:18 -0500316 check_surface(reporter, sProxy.get(), kWidthHeight, kWidthHeight, SkBudgeted::kNo);
317 check_texture(reporter, resourceProvider, sProxy->asTextureProxy(),
318 SkBackingFit::kExact);
robertphillips76948d42016-05-04 12:47:41 -0700319 }
320 }
321 }
322}
323
Robert Phillips78de2122017-04-26 07:44:26 -0400324DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ZeroSizedProxyTest, reporter, ctxInfo) {
Robert Phillips6d344c32020-07-06 10:56:46 -0400325 auto direct = ctxInfo.directContext();
326 GrProxyProvider* provider = direct->priv().proxyProvider();
Robert Phillips78de2122017-04-26 07:44:26 -0400327
Brian Salomonf2c2ba92019-07-17 09:59:59 -0400328 for (auto renderable : {GrRenderable::kNo, GrRenderable::kYes}) {
Robert Phillips78de2122017-04-26 07:44:26 -0400329 for (auto fit : { SkBackingFit::kExact, SkBackingFit::kApprox }) {
330 for (int width : { 0, 100 }) {
331 for (int height : { 0, 100}) {
332 if (width && height) {
333 continue; // not zero-sized
334 }
335
Greg Daniel4065d452018-11-16 15:43:41 -0500336 const GrBackendFormat format =
Robert Phillips6d344c32020-07-06 10:56:46 -0400337 direct->priv().caps()->getDefaultBackendFormat(
Robert Phillips0a15cc62019-07-30 12:49:10 -0400338 GrColorType::kRGBA_8888,
339 renderable);
Greg Daniel4065d452018-11-16 15:43:41 -0500340
Greg Daniel3a365112020-02-14 10:47:18 -0500341 sk_sp<GrTextureProxy> proxy = provider->createProxy(
Brian Salomon7e67dca2020-07-21 09:27:25 -0400342 format, {width, height}, renderable, 1, GrMipmapped::kNo, fit,
Greg Daniel3a365112020-02-14 10:47:18 -0500343 SkBudgeted::kNo, GrProtected::kNo);
Robert Phillips78de2122017-04-26 07:44:26 -0400344 REPORTER_ASSERT(reporter, !proxy);
345 }
346 }
347 }
348 }
349}