blob: 39cfbc4679f5d6851c7a49c4095ac7e79b85346f [file] [log] [blame]
bsalomon@google.com686bcb82013-04-09 15:04:12 +00001/*
2 * Copyright 2013 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
bsalomon@google.com686bcb82013-04-09 15:04:12 +00008#include "GrContext.h"
Greg Daniel7ef28f32017-04-20 16:41:55 +00009#include "GrContextPriv.h"
bsalomon091f60c2015-11-10 11:54:56 -080010#include "GrGpu.h"
Robert Phillips0bd24dc2018-01-16 08:06:32 -050011#include "GrProxyProvider.h"
Robert Phillips2890fbf2017-07-26 15:48:41 -040012#include "GrRenderTarget.h"
Brian Osman32342f02017-03-04 08:12:46 -050013#include "GrResourceProvider.h"
bsalomon@google.com686bcb82013-04-09 15:04:12 +000014#include "GrTexture.h"
Brian Salomonc67c31c2018-12-06 10:00:03 -050015#include "GrTexturePriv.h"
16#include "SkAutoPixmapStorage.h"
Brian Osman48c99192017-06-02 08:45:06 -040017#include "SkMipMap.h"
Brian Salomonc67c31c2018-12-06 10:00:03 -050018#include "SkTypes.h"
tfarina@chromium.org4ee16bf2014-01-10 22:08:27 +000019#include "Test.h"
bsalomon@google.com686bcb82013-04-09 15:04:12 +000020
bsalomona2c23232014-11-25 07:41:12 -080021// Tests that GrSurface::asTexture(), GrSurface::asRenderTarget(), and static upcasting of texture
22// and render targets to GrSurface all work as expected.
bsalomon758586c2016-04-06 14:02:39 -070023DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrSurface, reporter, ctxInfo) {
bsalomon8b7451a2016-05-11 06:33:06 -070024 GrContext* context = ctxInfo.grContext();
Robert Phillips6be756b2018-01-16 15:07:54 -050025 auto resourceProvider = context->contextPriv().resourceProvider();
Robert Phillipsf35fd8d2018-01-22 10:48:15 -050026 GrGpu* gpu = context->contextPriv().getGpu();
Robert Phillips6be756b2018-01-16 15:07:54 -050027
kkinnunen15302832015-12-01 04:35:26 -080028 GrSurfaceDesc desc;
kkinnunen15302832015-12-01 04:35:26 -080029 desc.fFlags = kRenderTarget_GrSurfaceFlag;
30 desc.fWidth = 256;
31 desc.fHeight = 256;
Robert Phillips16d8ec62017-07-27 16:16:25 -040032 desc.fConfig = kRGBA_8888_GrPixelConfig;
Brian Salomonbdecacf2018-02-02 20:32:49 -050033 desc.fSampleCnt = 1;
Robert Phillips6be756b2018-01-16 15:07:54 -050034 sk_sp<GrSurface> texRT1 = resourceProvider->createTexture(desc, SkBudgeted::kNo);
bsalomona2c23232014-11-25 07:41:12 -080035
Robert Phillipse78b7252017-04-06 07:59:41 -040036 REPORTER_ASSERT(reporter, texRT1.get() == texRT1->asRenderTarget());
37 REPORTER_ASSERT(reporter, texRT1.get() == texRT1->asTexture());
kkinnunen15302832015-12-01 04:35:26 -080038 REPORTER_ASSERT(reporter, static_cast<GrSurface*>(texRT1->asRenderTarget()) ==
39 texRT1->asTexture());
40 REPORTER_ASSERT(reporter, texRT1->asRenderTarget() ==
41 static_cast<GrSurface*>(texRT1->asTexture()));
42 REPORTER_ASSERT(reporter, static_cast<GrSurface*>(texRT1->asRenderTarget()) ==
43 static_cast<GrSurface*>(texRT1->asTexture()));
bsalomona2c23232014-11-25 07:41:12 -080044
kkinnunen15302832015-12-01 04:35:26 -080045 desc.fFlags = kNone_GrSurfaceFlags;
Robert Phillips6be756b2018-01-16 15:07:54 -050046 sk_sp<GrTexture> tex1 = resourceProvider->createTexture(desc, SkBudgeted::kNo);
kkinnunen15302832015-12-01 04:35:26 -080047 REPORTER_ASSERT(reporter, nullptr == tex1->asRenderTarget());
Robert Phillipse78b7252017-04-06 07:59:41 -040048 REPORTER_ASSERT(reporter, tex1.get() == tex1->asTexture());
49 REPORTER_ASSERT(reporter, static_cast<GrSurface*>(tex1.get()) == tex1->asTexture());
bsalomon@google.com686bcb82013-04-09 15:04:12 +000050
Robert Phillipsf35fd8d2018-01-22 10:48:15 -050051 GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
Robert Phillips646f6372018-09-25 09:31:10 -040052 nullptr, 256, 256, GrColorType::kRGBA_8888, false, GrMipMapped::kNo);
bsalomon091f60c2015-11-10 11:54:56 -080053
Brian Salomonbdecacf2018-02-02 20:32:49 -050054 sk_sp<GrSurface> texRT2 =
55 resourceProvider->wrapRenderableBackendTexture(backendTex, 1, kBorrow_GrWrapOwnership);
Greg Daniel7ef28f32017-04-20 16:41:55 +000056
bungeman6bd52842016-10-27 09:30:08 -070057 REPORTER_ASSERT(reporter, texRT2.get() == texRT2->asRenderTarget());
58 REPORTER_ASSERT(reporter, texRT2.get() == texRT2->asTexture());
kkinnunen15302832015-12-01 04:35:26 -080059 REPORTER_ASSERT(reporter, static_cast<GrSurface*>(texRT2->asRenderTarget()) ==
60 texRT2->asTexture());
61 REPORTER_ASSERT(reporter, texRT2->asRenderTarget() ==
62 static_cast<GrSurface*>(texRT2->asTexture()));
63 REPORTER_ASSERT(reporter, static_cast<GrSurface*>(texRT2->asRenderTarget()) ==
64 static_cast<GrSurface*>(texRT2->asTexture()));
bsalomon@google.com686bcb82013-04-09 15:04:12 +000065
Brian Salomon26102cb2018-03-09 09:33:19 -050066 gpu->deleteTestingOnlyBackendTexture(backendTex);
bsalomon@google.com686bcb82013-04-09 15:04:12 +000067}
68
Robert Phillipsb7b7e5f2017-05-22 13:23:19 -040069// This test checks that the isConfigTexturable and isConfigRenderable are
70// consistent with createTexture's result.
71DEF_GPUTEST_FOR_ALL_CONTEXTS(GrSurfaceRenderability, reporter, ctxInfo) {
72 GrContext* context = ctxInfo.grContext();
Robert Phillips1afd4cd2018-01-08 13:40:32 -050073 GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
Robert Phillips6be756b2018-01-16 15:07:54 -050074 GrResourceProvider* resourceProvider = context->contextPriv().resourceProvider();
Brian Salomonc7fe0f72018-05-11 10:14:21 -040075 const GrCaps* caps = context->contextPriv().caps();
Robert Phillipsb7b7e5f2017-05-22 13:23:19 -040076
77 GrPixelConfig configs[] = {
78 kUnknown_GrPixelConfig,
79 kAlpha_8_GrPixelConfig,
Greg Danielef59d872017-11-17 16:47:21 -050080 kAlpha_8_as_Alpha_GrPixelConfig,
81 kAlpha_8_as_Red_GrPixelConfig,
Robert Phillipsb7b7e5f2017-05-22 13:23:19 -040082 kGray_8_GrPixelConfig,
Greg Daniel7af060a2017-12-05 16:27:11 -050083 kGray_8_as_Lum_GrPixelConfig,
84 kGray_8_as_Red_GrPixelConfig,
Robert Phillipsb7b7e5f2017-05-22 13:23:19 -040085 kRGB_565_GrPixelConfig,
86 kRGBA_4444_GrPixelConfig,
87 kRGBA_8888_GrPixelConfig,
Brian Salomon5fba7ad2018-03-22 10:01:16 -040088 kRGB_888_GrPixelConfig,
Jim Van Verth69e57852018-12-05 13:38:59 -050089 kRG_88_GrPixelConfig,
Robert Phillipsb7b7e5f2017-05-22 13:23:19 -040090 kBGRA_8888_GrPixelConfig,
91 kSRGBA_8888_GrPixelConfig,
92 kSBGRA_8888_GrPixelConfig,
Brian Osman10fc6fd2018-03-02 11:01:10 -050093 kRGBA_1010102_GrPixelConfig,
Robert Phillipsb7b7e5f2017-05-22 13:23:19 -040094 kRGBA_float_GrPixelConfig,
95 kRG_float_GrPixelConfig,
96 kAlpha_half_GrPixelConfig,
Greg Danielef59d872017-11-17 16:47:21 -050097 kAlpha_half_as_Red_GrPixelConfig,
Robert Phillipsb7b7e5f2017-05-22 13:23:19 -040098 kRGBA_half_GrPixelConfig,
99 };
Brian Salomon5fba7ad2018-03-22 10:01:16 -0400100 GR_STATIC_ASSERT(kGrPixelConfigCnt == SK_ARRAY_COUNT(configs));
Robert Phillipsb7b7e5f2017-05-22 13:23:19 -0400101
102 GrSurfaceDesc desc;
103 desc.fWidth = 64;
104 desc.fHeight = 64;
105
106 for (GrPixelConfig config : configs) {
107 for (GrSurfaceOrigin origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) {
108 desc.fFlags = kNone_GrSurfaceFlags;
Robert Phillipsb7b7e5f2017-05-22 13:23:19 -0400109 desc.fConfig = config;
Brian Salomonbdecacf2018-02-02 20:32:49 -0500110 desc.fSampleCnt = 1;
Robert Phillipsb7b7e5f2017-05-22 13:23:19 -0400111
Robert Phillips3b3307f2017-05-24 07:44:02 -0400112 sk_sp<GrSurface> tex = resourceProvider->createTexture(desc, SkBudgeted::kNo);
Brian Salomon1c80e992018-01-29 09:50:47 -0500113 bool ict = caps->isConfigTexturable(desc.fConfig);
114 REPORTER_ASSERT(reporter, SkToBool(tex) == ict,
115 "config:%d, tex:%d, isConfigTexturable:%d", config, SkToBool(tex), ict);
Robert Phillipsb7b7e5f2017-05-22 13:23:19 -0400116
Greg Daniel4065d452018-11-16 15:43:41 -0500117 GrSRGBEncoded srgbEncoded = GrSRGBEncoded::kNo;
118 GrColorType colorType = GrPixelConfigToColorTypeAndEncoding(config, &srgbEncoded);
119 const GrBackendFormat format =
120 caps->getBackendFormatFromGrColorType(colorType, srgbEncoded);
121
Brian Salomon2a4f9832018-03-03 22:43:43 -0500122 sk_sp<GrTextureProxy> proxy =
Greg Daniel4065d452018-11-16 15:43:41 -0500123 proxyProvider->createMipMapProxy(format, desc, origin, SkBudgeted::kNo);
Brian Osman48c99192017-06-02 08:45:06 -0400124 REPORTER_ASSERT(reporter, SkToBool(proxy.get()) ==
125 (caps->isConfigTexturable(desc.fConfig) &&
Brian Salomon57111332018-02-05 15:55:54 -0500126 caps->mipMapSupport()));
Brian Osman48c99192017-06-02 08:45:06 -0400127
Robert Phillipsb7b7e5f2017-05-22 13:23:19 -0400128 desc.fFlags = kRenderTarget_GrSurfaceFlag;
Robert Phillips3b3307f2017-05-24 07:44:02 -0400129 tex = resourceProvider->createTexture(desc, SkBudgeted::kNo);
Brian Salomonbdecacf2018-02-02 20:32:49 -0500130 bool isRenderable = caps->isConfigRenderable(config);
131 REPORTER_ASSERT(reporter, SkToBool(tex) == isRenderable,
132 "config:%d, tex:%d, isRenderable:%d", config, SkToBool(tex),
133 isRenderable);
Robert Phillipsb7b7e5f2017-05-22 13:23:19 -0400134
Brian Salomonbdecacf2018-02-02 20:32:49 -0500135 desc.fSampleCnt = 2;
Robert Phillips3b3307f2017-05-24 07:44:02 -0400136 tex = resourceProvider->createTexture(desc, SkBudgeted::kNo);
Brian Salomonbdecacf2018-02-02 20:32:49 -0500137 isRenderable = SkToBool(caps->getRenderTargetSampleCount(2, config));
138 REPORTER_ASSERT(reporter, SkToBool(tex) == isRenderable,
139 "config:%d, tex:%d, isRenderable:%d", config, SkToBool(tex),
140 isRenderable);
Robert Phillipsb7b7e5f2017-05-22 13:23:19 -0400141 }
142 }
143}
Robert Phillipsb7b7e5f2017-05-22 13:23:19 -0400144
Brian Salomond17b4a62017-05-23 16:53:47 -0400145#include "GrDrawingManager.h"
146#include "GrSurfaceProxy.h"
147#include "GrTextureContext.h"
148
149DEF_GPUTEST_FOR_RENDERING_CONTEXTS(InitialTextureClear, reporter, context_info) {
150 static constexpr int kSize = 100;
151 GrSurfaceDesc desc;
152 desc.fWidth = desc.fHeight = kSize;
153 std::unique_ptr<uint32_t[]> data(new uint32_t[kSize * kSize]);
Robert Phillips0bd24dc2018-01-16 08:06:32 -0500154
Brian Salomond17b4a62017-05-23 16:53:47 -0400155 GrContext* context = context_info.grContext();
Greg Daniel4065d452018-11-16 15:43:41 -0500156 const GrCaps* caps = context->contextPriv().caps();
Robert Phillips0bd24dc2018-01-16 08:06:32 -0500157 GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
158
Brian Salomond17b4a62017-05-23 16:53:47 -0400159 for (int c = 0; c <= kLast_GrPixelConfig; ++c) {
160 desc.fConfig = static_cast<GrPixelConfig>(c);
Greg Daniel4065d452018-11-16 15:43:41 -0500161 if (!caps->isConfigTexturable(desc.fConfig)) {
Brian Salomond17b4a62017-05-23 16:53:47 -0400162 continue;
163 }
164 desc.fFlags = kPerformInitialClear_GrSurfaceFlag;
165 for (bool rt : {false, true}) {
Greg Daniel4065d452018-11-16 15:43:41 -0500166 if (rt && !caps->isConfigRenderable(desc.fConfig)) {
Brian Salomond17b4a62017-05-23 16:53:47 -0400167 continue;
168 }
169 desc.fFlags |= rt ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags;
Greg Daniel90f28ec2017-09-25 12:26:58 -0400170 for (GrSurfaceOrigin origin :
171 {kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin}) {
Robert Phillips0bd24dc2018-01-16 08:06:32 -0500172 for (auto fit : { SkBackingFit::kApprox, SkBackingFit::kExact }) {
Greg Daniel90f28ec2017-09-25 12:26:58 -0400173 // Try directly creating the texture.
174 // Do this twice in an attempt to hit the cache on the second time through.
175 for (int i = 0; i < 2; ++i) {
Chris Daltond004e0b2018-09-27 09:28:03 -0600176 auto proxy = proxyProvider->testingOnly_createInstantiatedProxy(
Brian Salomon2a4f9832018-03-03 22:43:43 -0500177 desc, origin, fit, SkBudgeted::kYes);
Robert Phillips0bd24dc2018-01-16 08:06:32 -0500178 if (!proxy) {
Greg Daniel90f28ec2017-09-25 12:26:58 -0400179 continue;
180 }
Greg Daniel90f28ec2017-09-25 12:26:58 -0400181 auto texCtx = context->contextPriv().makeWrappedSurfaceContext(
Brian Osman9aa30c62018-07-02 15:21:46 -0400182 std::move(proxy));
Greg Daniel90f28ec2017-09-25 12:26:58 -0400183 SkImageInfo info = SkImageInfo::Make(
184 kSize, kSize, kRGBA_8888_SkColorType, kPremul_SkAlphaType);
185 memset(data.get(), 0xAB, kSize * kSize * sizeof(uint32_t));
186 if (texCtx->readPixels(info, data.get(), 0, 0, 0)) {
187 uint32_t cmp = GrPixelConfigIsOpaque(desc.fConfig) ? 0xFF000000 : 0;
188 for (int i = 0; i < kSize * kSize; ++i) {
189 if (cmp != data.get()[i]) {
190 ERRORF(reporter, "Failed on config %d", desc.fConfig);
191 break;
Brian Salomond17b4a62017-05-23 16:53:47 -0400192 }
193 }
Brian Salomond17b4a62017-05-23 16:53:47 -0400194 }
Greg Daniel90f28ec2017-09-25 12:26:58 -0400195 memset(data.get(), 0xBC, kSize * kSize * sizeof(uint32_t));
196 // Here we overwrite the texture so that the second time through we
197 // test against recycling without reclearing.
198 if (0 == i) {
199 texCtx->writePixels(info, data.get(), 0, 0, 0);
Greg Daniel52cb5fe2017-09-05 15:45:15 -0400200 }
Greg Daniel52cb5fe2017-09-05 15:45:15 -0400201 }
Robert Phillips0c4b7b12018-03-06 08:20:37 -0500202 context->contextPriv().purgeAllUnlockedResources_ForTesting();
Greg Daniel90f28ec2017-09-25 12:26:58 -0400203
Greg Daniel4065d452018-11-16 15:43:41 -0500204 GrSRGBEncoded srgbEncoded = GrSRGBEncoded::kNo;
205 GrColorType colorType = GrPixelConfigToColorTypeAndEncoding(desc.fConfig,
206 &srgbEncoded);
207 const GrBackendFormat format =
208 caps->getBackendFormatFromGrColorType(colorType, srgbEncoded);
209
Greg Daniel90f28ec2017-09-25 12:26:58 -0400210 // Try creating the texture as a deferred proxy.
211 for (int i = 0; i < 2; ++i) {
212 auto surfCtx = context->contextPriv().makeDeferredSurfaceContext(
Greg Daniel4065d452018-11-16 15:43:41 -0500213 format, desc, origin, GrMipMapped::kNo, fit, SkBudgeted::kYes);
Greg Daniel90f28ec2017-09-25 12:26:58 -0400214 if (!surfCtx) {
215 continue;
216 }
217 SkImageInfo info = SkImageInfo::Make(
218 kSize, kSize, kRGBA_8888_SkColorType, kPremul_SkAlphaType);
219 memset(data.get(), 0xAB, kSize * kSize * sizeof(uint32_t));
220 if (surfCtx->readPixels(info, data.get(), 0, 0, 0)) {
221 uint32_t cmp = GrPixelConfigIsOpaque(desc.fConfig) ? 0xFF000000 : 0;
222 for (int i = 0; i < kSize * kSize; ++i) {
223 if (cmp != data.get()[i]) {
224 ERRORF(reporter, "Failed on config %d", desc.fConfig);
225 break;
226 }
227 }
228 }
229 // Here we overwrite the texture so that the second time through we
230 // test against recycling without reclearing.
231 if (0 == i) {
232 surfCtx->writePixels(info, data.get(), 0, 0, 0);
233 }
234 }
Robert Phillips0c4b7b12018-03-06 08:20:37 -0500235 context->contextPriv().purgeAllUnlockedResources_ForTesting();
Brian Salomond17b4a62017-05-23 16:53:47 -0400236 }
237 }
238 }
239 }
240}
Brian Salomonc67c31c2018-12-06 10:00:03 -0500241
242DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadOnlyTexture, reporter, context_info) {
243 auto fillPixels = [](const SkPixmap* p, const std::function<uint32_t(int x, int y)>& f) {
244 for (int y = 0; y < p->height(); ++y) {
245 for (int x = 0; x < p->width(); ++x) {
246 *p->writable_addr32(x, y) = f(x, y);
247 }
248 }
249 };
250
251 auto comparePixels = [](const SkPixmap& p1, const SkPixmap& p2, skiatest::Reporter* reporter) {
252 SkASSERT(p1.info() == p2.info());
253 for (int y = 0; y < p1.height(); ++y) {
254 for (int x = 0; x < p1.width(); ++x) {
255 REPORTER_ASSERT(reporter, p1.getColor(x, y) == p2.getColor(x, y));
256 if (p1.getColor(x, y) != p2.getColor(x, y)) {
257 return;
258 }
259 }
260 }
261 };
262
263 static constexpr int kSize = 100;
264 SkAutoPixmapStorage pixels;
265 pixels.alloc(SkImageInfo::Make(kSize, kSize, kRGBA_8888_SkColorType, kPremul_SkAlphaType));
266 fillPixels(&pixels,
267 [](int x, int y) { return (0xFFU << 24) | (x << 16) | (y << 8) | uint8_t(x * y); });
268
269 GrContext* context = context_info.grContext();
270 GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
271
272 // We test both kRW in addition to kRead mostly to ensure that the calls are structured such
273 // that they'd succeed if the texture wasn't kRead. We want to be sure we're failing with
274 // kRead for the right reason.
275 for (auto ioType : {kRead_GrIOType, kRW_GrIOType}) {
276 auto backendTex = context->contextPriv().getGpu()->createTestingOnlyBackendTexture(
277 pixels.addr(), kSize, kSize, kRGBA_8888_SkColorType, true, GrMipMapped::kNo);
278 auto proxy = proxyProvider->wrapBackendTexture(backendTex, kTopLeft_GrSurfaceOrigin,
279 kBorrow_GrWrapOwnership, ioType);
280 auto surfContext = context->contextPriv().makeWrappedSurfaceContext(proxy);
281
282 // Read pixels should work with a read-only texture.
283 SkAutoPixmapStorage read;
284 read.alloc(pixels.info());
285 auto readResult = surfContext->readPixels(pixels.info(), read.writable_addr(), 0, 0, 0);
286 REPORTER_ASSERT(reporter, readResult);
287 if (readResult) {
288 comparePixels(pixels, read, reporter);
289 }
290
291 // Write pixels should not work with a read-only texture.
292 SkAutoPixmapStorage write;
293 write.alloc(pixels.info());
294 fillPixels(&write, [&pixels](int x, int y) { return ~*pixels.addr32(); });
295 auto writeResult = surfContext->writePixels(pixels.info(), pixels.addr(), 0, 0, 0);
296 REPORTER_ASSERT(reporter, writeResult == (ioType == kRW_GrIOType));
297 // Try the low level write.
298 context->flush();
299 auto gpuWriteResult = context->contextPriv().getGpu()->writePixels(
300 proxy->peekTexture(), 0, 0, kSize, kSize, GrColorType::kRGBA_8888, write.addr32(),
301 0);
302 REPORTER_ASSERT(reporter, gpuWriteResult == (ioType == kRW_GrIOType));
303
304 // Copies should not work with a read-only texture
305 auto copySrc = proxyProvider->createTextureProxy(
306 SkImage::MakeFromRaster(write, nullptr, nullptr), kNone_GrSurfaceFlags, 1,
307 SkBudgeted::kYes, SkBackingFit::kExact);
308 REPORTER_ASSERT(reporter, copySrc);
309 auto copyResult = surfContext->copy(copySrc.get());
310 REPORTER_ASSERT(reporter, copyResult == (ioType == kRW_GrIOType));
311 // Try the low level copy.
312 context->flush();
313 auto gpuCopyResult = context->contextPriv().getGpu()->copySurface(
314 proxy->peekTexture(), kTopLeft_GrSurfaceOrigin, copySrc->peekTexture(),
315 kTopLeft_GrSurfaceOrigin, SkIRect::MakeWH(kSize, kSize), {0, 0});
316 REPORTER_ASSERT(reporter, gpuCopyResult == (ioType == kRW_GrIOType));
317
318 // Mip regen should not work with a read only texture.
319 if (context->contextPriv().caps()->mipMapSupport()) {
320 backendTex = context->contextPriv().getGpu()->createTestingOnlyBackendTexture(
321 nullptr, kSize, kSize, kRGBA_8888_SkColorType, true, GrMipMapped::kYes);
322 proxy = proxyProvider->wrapBackendTexture(backendTex, kTopLeft_GrSurfaceOrigin,
323 kBorrow_GrWrapOwnership, ioType);
324 context->flush();
325 proxy->peekTexture()->texturePriv().markMipMapsDirty(); // avoids assert in GrGpu.
326 auto regenResult =
327 context->contextPriv().getGpu()->regenerateMipMapLevels(proxy->peekTexture());
328 REPORTER_ASSERT(reporter, regenResult == (ioType == kRW_GrIOType));
329 }
330 }
331}