1 /*
2  * Copyright 2017 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. It relies on static initializers to work
9 
10 #include "include/core/SkAlphaType.h"
11 #include "include/core/SkColorSpace.h"
12 #include "include/core/SkRect.h"
13 #include "include/core/SkRefCnt.h"
14 #include "include/core/SkSize.h"
15 #include "include/core/SkTypes.h"
16 #include "include/gpu/GpuTypes.h"
17 #include "include/gpu/GrBackendSurface.h"
18 #include "include/gpu/GrDirectContext.h"
19 #include "include/gpu/GrTypes.h"
20 #include "include/private/base/SkAlign.h"
21 #include "include/private/gpu/ganesh/GrTypesPriv.h"
22 #include "src/gpu/ganesh/GrCaps.h"
23 #include "src/gpu/ganesh/GrColor.h"
24 #include "src/gpu/ganesh/GrDataUtils.h"
25 #include "src/gpu/ganesh/GrDirectContextPriv.h"
26 #include "src/gpu/ganesh/GrGpu.h"
27 #include "src/gpu/ganesh/GrGpuBuffer.h"
28 #include "src/gpu/ganesh/GrImageInfo.h"
29 #include "src/gpu/ganesh/GrPixmap.h"
30 #include "src/gpu/ganesh/GrResourceProvider.h"
31 #include "src/gpu/ganesh/GrTexture.h"
32 #include "tests/CtsEnforcement.h"
33 #include "tests/Test.h"
34 #include "tests/TestUtils.h"
35 
36 #include <algorithm>
37 #include <cstdint>
38 #include <cstring>
39 #include <functional>
40 #include <initializer_list>
41 #include <memory>
42 
43 struct GrContextOptions;
44 
45 using sk_gpu_test::GrContextFactory;
46 
fill_transfer_data(int left,int top,int width,int height,int rowBytes,GrColorType dstType,char * dst)47 void fill_transfer_data(int left, int top, int width, int height, int rowBytes,
48                         GrColorType dstType, char* dst) {
49     size_t dstBpp = GrColorTypeBytesPerPixel(dstType);
50     auto dstLocation = [dst, dstBpp, rowBytes](int x, int y) {
51         return dst + y * rowBytes + x * dstBpp;
52     };
53     // build red-green gradient
54     for (int j = top; j < top + height; ++j) {
55         for (int i = left; i < left + width; ++i) {
56             auto r = (unsigned int)(256.f*((i - left) / (float)width));
57             auto g = (unsigned int)(256.f*((j - top) / (float)height));
58             r -= (r >> 8);
59             g -= (g >> 8);
60             // set b and a channels to be inverse of r and g just to have interesting values to
61             // test.
62             uint32_t srcPixel = GrColorPackRGBA(r, g, 0xff - r, 0xff - g);
63             GrImageInfo srcInfo(GrColorType::kRGBA_8888, kUnpremul_SkAlphaType, nullptr, 1, 1);
64             GrImageInfo dstInfo(dstType, kUnpremul_SkAlphaType, nullptr, 1, 1);
65             GrConvertPixels(GrPixmap(dstInfo, dstLocation(i, j), dstBpp),
66                             GrPixmap(srcInfo,         &srcPixel,      4));
67         }
68     }
69 }
70 
determine_tolerances(GrColorType a,GrColorType b,float tolerances[4])71 void determine_tolerances(GrColorType a, GrColorType b, float tolerances[4]) {
72     std::fill_n(tolerances, 4, 0);
73 
74     auto descA = GrGetColorTypeDesc(a);
75     auto descB = GrGetColorTypeDesc(b);
76     // For each channel x set the tolerance to 1 / (2^min(bits_in_a, bits_in_b) - 1) unless
77     // one color type is missing the channel. In that case leave it at 0. If the other color
78     // has the channel then it better be exactly 1 for alpha or 0 for rgb.
79     for (int i = 0; i < 4; ++i) {
80         if (descA[i] != descB[i]) {
81             auto m = std::min(descA[i], descB[i]);
82             if (m) {
83                 tolerances[i] = 1.f / (m - 1);
84             }
85         }
86     }
87 }
88 
read_pixels_from_texture(GrTexture * texture,GrColorType colorType,char * dst,float tolerances[4])89 bool read_pixels_from_texture(GrTexture* texture, GrColorType colorType, char* dst,
90                               float tolerances[4]) {
91     auto* context = texture->getContext();
92     auto* gpu = context->priv().getGpu();
93     auto* caps = context->priv().caps();
94 
95     int w = texture->width();
96     int h = texture->height();
97     size_t rowBytes = GrColorTypeBytesPerPixel(colorType) * w;
98 
99     GrCaps::SupportedRead supportedRead =
100             caps->supportedReadPixelsColorType(colorType, texture->backendFormat(), colorType);
101     std::fill_n(tolerances, 4, 0);
102     if (supportedRead.fColorType != colorType) {
103         size_t tmpRowBytes = GrColorTypeBytesPerPixel(supportedRead.fColorType) * w;
104         std::unique_ptr<char[]> tmpPixels(new char[tmpRowBytes * h]);
105         if (!gpu->readPixels(texture,
106                              SkIRect::MakeWH(w, h),
107                              colorType,
108                              supportedRead.fColorType,
109                              tmpPixels.get(),
110                              tmpRowBytes)) {
111             return false;
112         }
113         GrImageInfo tmpInfo(supportedRead.fColorType, kUnpremul_SkAlphaType, nullptr, w, h);
114         GrImageInfo dstInfo(colorType,                kUnpremul_SkAlphaType, nullptr, w, h);
115         determine_tolerances(tmpInfo.colorType(), dstInfo.colorType(), tolerances);
116         return GrConvertPixels(GrPixmap(dstInfo,             dst,    rowBytes),
117                                GrPixmap(tmpInfo, tmpPixels.get(), tmpRowBytes));
118     }
119     return gpu->readPixels(texture,
120                            SkIRect::MakeWH(w, h),
121                            colorType,
122                            supportedRead.fColorType,
123                            dst,
124                            rowBytes);
125 }
126 
basic_transfer_to_test(skiatest::Reporter * reporter,GrDirectContext * dContext,GrColorType colorType,GrRenderable renderable)127 void basic_transfer_to_test(skiatest::Reporter* reporter,
128                             GrDirectContext* dContext,
129                             GrColorType colorType,
130                             GrRenderable renderable) {
131     if (GrCaps::kNone_MapFlags == dContext->priv().caps()->mapBufferFlags()) {
132         return;
133     }
134 
135     auto* caps = dContext->priv().caps();
136 
137     auto backendFormat = caps->getDefaultBackendFormat(colorType, renderable);
138     if (!backendFormat.isValid()) {
139         return;
140     }
141 
142     auto resourceProvider = dContext->priv().resourceProvider();
143     GrGpu* gpu = dContext->priv().getGpu();
144 
145     static constexpr SkISize kTexDims = {16, 16};
146     int srcBufferWidth = caps->transferPixelsToRowBytesSupport() ? 20 : 16;
147     const int kBufferHeight = 16;
148 
149     sk_sp<GrTexture> tex = resourceProvider->createTexture(kTexDims,
150                                                            backendFormat,
151                                                            GrTextureType::k2D,
152                                                            renderable,
153                                                            1,
154                                                            GrMipmapped::kNo,
155                                                            skgpu::Budgeted::kNo,
156                                                            GrProtected::kNo,
157                                                            /*label=*/{});
158     if (!tex) {
159         ERRORF(reporter, "Could not create texture");
160         return;
161     }
162 
163     // We validate the results using GrGpu::readPixels, so exit if this is not supported.
164     // TODO: Do this through SurfaceContext once it works for all color types or support
165     // kCopyToTexture2D here.
166     if (GrCaps::SurfaceReadPixelsSupport::kSupported !=
167         caps->surfaceSupportsReadPixels(tex.get())) {
168         return;
169     }
170     // GL requires a texture to be framebuffer bindable to call glReadPixels. However, we have not
171     // incorporated that test into surfaceSupportsReadPixels(). TODO: Remove this once we handle
172     // drawing to a bindable format.
173     if (!caps->isFormatAsColorTypeRenderable(colorType, tex->backendFormat())) {
174         return;
175     }
176 
177     // The caps tell us what color type we are allowed to upload and read back from this texture,
178     // either of which may differ from 'colorType'.
179     GrCaps::SupportedWrite allowedSrc =
180             caps->supportedWritePixelsColorType(colorType, tex->backendFormat(), colorType);
181     if (!allowedSrc.fOffsetAlignmentForTransferBuffer) {
182         return;
183     }
184     size_t srcRowBytes = SkAlignTo(GrColorTypeBytesPerPixel(allowedSrc.fColorType) * srcBufferWidth,
185                                    caps->transferBufferRowBytesAlignment());
186 
187     std::unique_ptr<char[]> srcData(new char[kTexDims.fHeight * srcRowBytes]);
188 
189     fill_transfer_data(0, 0, kTexDims.fWidth, kTexDims.fHeight, srcRowBytes,
190                        allowedSrc.fColorType, srcData.get());
191 
192     // create and fill transfer buffer
193     size_t size = srcRowBytes * kBufferHeight;
194     sk_sp<GrGpuBuffer> buffer = resourceProvider->createBuffer(size,
195                                                                GrGpuBufferType::kXferCpuToGpu,
196                                                                kDynamic_GrAccessPattern,
197                                                                GrResourceProvider::ZeroInit::kNo);
198     if (!buffer) {
199         return;
200     }
201     void* data = buffer->map();
202     if (!buffer) {
203         ERRORF(reporter, "Could not map buffer");
204         return;
205     }
206     memcpy(data, srcData.get(), size);
207     buffer->unmap();
208 
209     //////////////////////////
210     // transfer full data
211 
212     bool result;
213     result = gpu->transferPixelsTo(tex.get(),
214                                    SkIRect::MakeSize(kTexDims),
215                                    colorType,
216                                    allowedSrc.fColorType,
217                                    buffer,
218                                    0,
219                                    srcRowBytes);
220     REPORTER_ASSERT(reporter, result);
221 
222     size_t dstRowBytes = GrColorTypeBytesPerPixel(colorType) * kTexDims.fWidth;
223     std::unique_ptr<char[]> dstBuffer(new char[dstRowBytes * kTexDims.fHeight]());
224 
225     float compareTolerances[4] = {};
226     result = read_pixels_from_texture(tex.get(), colorType, dstBuffer.get(), compareTolerances);
227     if (!result) {
228         ERRORF(reporter, "Could not read pixels from texture, color type: %d",
229                static_cast<int>(colorType));
230         return;
231     }
232 
233     auto error = std::function<ComparePixmapsErrorReporter>(
234             [reporter, colorType](int x, int y, const float diffs[4]) {
235                 ERRORF(reporter,
236                        "Error at (%d %d) in transfer, color type: %s, diffs: (%f, %f, %f, %f)",
237                        x, y, GrColorTypeToStr(colorType),
238                        diffs[0], diffs[1], diffs[2], diffs[3]);
239             });
240     GrImageInfo srcInfo(allowedSrc.fColorType, kUnpremul_SkAlphaType, nullptr, tex->dimensions());
241     GrImageInfo dstInfo(            colorType, kUnpremul_SkAlphaType, nullptr, tex->dimensions());
242     ComparePixels(GrCPixmap(srcInfo,   srcData.get(), srcRowBytes),
243                   GrCPixmap(dstInfo, dstBuffer.get(), dstRowBytes),
244                   compareTolerances,
245                   error);
246 
247     //////////////////////////
248     // transfer partial data
249 
250     // We're relying on this cap to write partial texture data
251     if (!caps->transferPixelsToRowBytesSupport()) {
252         return;
253     }
254     // We keep a 1 to 1 correspondence between pixels in the buffer and the entire texture. We
255     // update the contents of a sub-rect of the buffer and push that rect to the texture. We start
256     // with a left sub-rect inset of 2 but may adjust that so we can fulfill the transfer buffer
257     // offset alignment requirement.
258     int left = 2;
259     int top = 10;
260     const int width = 10;
261     const int height = 2;
262     size_t offset = top * srcRowBytes + left * GrColorTypeBytesPerPixel(allowedSrc.fColorType);
263     while (offset % allowedSrc.fOffsetAlignmentForTransferBuffer) {
264         offset += GrColorTypeBytesPerPixel(allowedSrc.fColorType);
265         ++left;
266         // In most cases we assume that the required alignment is 1 or a small multiple of the bpp,
267         // which it is for color types across all current backends except Direct3D. To correct for
268         // Direct3D's large alignment requirement we may adjust the top location as well.
269         if (left + width > tex->width()) {
270             left = 0;
271             ++top;
272             offset = top * srcRowBytes;
273         }
274         SkASSERT(left + width <= tex->width());
275         SkASSERT(top + height <= tex->height());
276     }
277 
278     // change color of subrectangle
279     fill_transfer_data(left, top, width, height, srcRowBytes, allowedSrc.fColorType,
280                        srcData.get());
281     data = buffer->map();
282     memcpy(data, srcData.get(), size);
283     buffer->unmap();
284 
285     result = gpu->transferPixelsTo(tex.get(),
286                                    SkIRect::MakeXYWH(left, top, width, height),
287                                    colorType,
288                                    allowedSrc.fColorType,
289                                    buffer,
290                                    offset,
291                                    srcRowBytes);
292     if (!result) {
293         ERRORF(reporter, "Could not transfer pixels to texture, color type: %d",
294                static_cast<int>(colorType));
295         return;
296     }
297 
298     result = read_pixels_from_texture(tex.get(), colorType, dstBuffer.get(), compareTolerances);
299     if (!result) {
300         ERRORF(reporter, "Could not read pixels from texture, color type: %d",
301                static_cast<int>(colorType));
302         return;
303     }
304     ComparePixels(GrCPixmap(srcInfo,   srcData.get(), srcRowBytes),
305                   GrCPixmap(dstInfo, dstBuffer.get(), dstRowBytes),
306                   compareTolerances,
307                   error);
308 }
309 
basic_transfer_from_test(skiatest::Reporter * reporter,const sk_gpu_test::ContextInfo & ctxInfo,GrColorType colorType,GrRenderable renderable)310 void basic_transfer_from_test(skiatest::Reporter* reporter, const sk_gpu_test::ContextInfo& ctxInfo,
311                               GrColorType colorType, GrRenderable renderable) {
312     auto context = ctxInfo.directContext();
313     auto caps = context->priv().caps();
314     if (GrCaps::kNone_MapFlags == caps->mapBufferFlags()) {
315         return;
316     }
317 
318     auto resourceProvider = context->priv().resourceProvider();
319     GrGpu* gpu = context->priv().getGpu();
320 
321     static constexpr SkISize kTexDims = {16, 16};
322 
323     // We'll do a full texture read into the buffer followed by a partial read. These values
324     // describe the partial read subrect.
325     const int kPartialLeft = 2;
326     const int kPartialTop = 10;
327     const int kPartialWidth = 10;
328     const int kPartialHeight = 2;
329 
330     // create texture
331     auto format = context->priv().caps()->getDefaultBackendFormat(colorType, renderable);
332     if (!format.isValid()) {
333         return;
334     }
335 
336     size_t textureDataBpp = GrColorTypeBytesPerPixel(colorType);
337     size_t textureDataRowBytes = kTexDims.fWidth * textureDataBpp;
338     std::unique_ptr<char[]> textureData(new char[kTexDims.fHeight * textureDataRowBytes]);
339     fill_transfer_data(0, 0, kTexDims.fWidth, kTexDims.fHeight, textureDataRowBytes, colorType,
340                        textureData.get());
341     GrMipLevel data;
342     data.fPixels = textureData.get();
343     data.fRowBytes = textureDataRowBytes;
344     sk_sp<GrTexture> tex = resourceProvider->createTexture(kTexDims,
345                                                            format,
346                                                            GrTextureType::k2D,
347                                                            colorType,
348                                                            renderable,
349                                                            1,
350                                                            skgpu::Budgeted::kNo,
351                                                            GrMipmapped::kNo,
352                                                            GrProtected::kNo,
353                                                            &data,
354                                                            /*label=*/{});
355     if (!tex) {
356         return;
357     }
358 
359     if (GrCaps::SurfaceReadPixelsSupport::kSupported !=
360         caps->surfaceSupportsReadPixels(tex.get())) {
361         return;
362     }
363     // GL requires a texture to be framebuffer bindable to call glReadPixels. However, we have not
364     // incorporated that test into surfaceSupportsReadPixels(). TODO: Remove this once we handle
365     // drawing to a bindable format.
366     if (!caps->isFormatAsColorTypeRenderable(colorType, tex->backendFormat())) {
367         return;
368     }
369 
370     // Create the transfer buffer.
371     auto allowedRead =
372             caps->supportedReadPixelsColorType(colorType, tex->backendFormat(), colorType);
373     if (!allowedRead.fOffsetAlignmentForTransferBuffer) {
374         return;
375     }
376     GrImageInfo readInfo(allowedRead.fColorType, kUnpremul_SkAlphaType, nullptr, kTexDims);
377 
378     size_t bpp = GrColorTypeBytesPerPixel(allowedRead.fColorType);
379     size_t fullBufferRowBytes = SkAlignTo(kTexDims.fWidth * bpp,
380                                           caps->transferBufferRowBytesAlignment());
381     size_t partialBufferRowBytes = SkAlignTo(kPartialWidth * bpp,
382                                              caps->transferBufferRowBytesAlignment());
383     size_t offsetAlignment = allowedRead.fOffsetAlignmentForTransferBuffer;
384     SkASSERT(offsetAlignment);
385 
386     size_t bufferSize = fullBufferRowBytes * kTexDims.fHeight;
387     // Arbitrary starting offset for the partial read.
388     static constexpr size_t kStartingOffset = 11;
389     size_t partialReadOffset = kStartingOffset +
390                                (offsetAlignment - kStartingOffset%offsetAlignment)%offsetAlignment;
391     bufferSize = std::max(bufferSize,
392                           partialReadOffset + partialBufferRowBytes * kPartialHeight);
393 
394     sk_sp<GrGpuBuffer> buffer = resourceProvider->createBuffer(bufferSize,
395                                                                GrGpuBufferType::kXferGpuToCpu,
396                                                                kDynamic_GrAccessPattern,
397                                                                GrResourceProvider::ZeroInit::kNo);
398     REPORTER_ASSERT(reporter, buffer);
399     if (!buffer) {
400         return;
401     }
402 
403     int expectedTransferCnt = 0;
404     gpu->stats()->reset();
405 
406     //////////////////////////
407     // transfer full data
408     bool result = gpu->transferPixelsFrom(tex.get(),
409                                           SkIRect::MakeSize(kTexDims),
410                                           colorType,
411                                           allowedRead.fColorType,
412                                           buffer,
413                                           0);
414     if (!result) {
415         ERRORF(reporter, "transferPixelsFrom failed.");
416         return;
417     }
418     ++expectedTransferCnt;
419 
420     if (context->priv().caps()->mapBufferFlags() & GrCaps::kAsyncRead_MapFlag) {
421         gpu->submitToGpu(true);
422     }
423 
424     // Copy the transfer buffer contents to a temporary so we can manipulate it.
425     const auto* map = reinterpret_cast<const char*>(buffer->map());
426     REPORTER_ASSERT(reporter, map);
427     if (!map) {
428         ERRORF(reporter, "Failed to map transfer buffer.");
429         return;
430     }
431     std::unique_ptr<char[]> transferData(new char[kTexDims.fHeight * fullBufferRowBytes]);
432     memcpy(transferData.get(), map, fullBufferRowBytes * kTexDims.fHeight);
433     buffer->unmap();
434 
435     GrImageInfo transferInfo(allowedRead.fColorType, kUnpremul_SkAlphaType, nullptr, kTexDims);
436 
437     float tol[4];
438     determine_tolerances(allowedRead.fColorType, colorType, tol);
439     auto error = std::function<ComparePixmapsErrorReporter>(
440             [reporter, colorType](int x, int y, const float diffs[4]) {
441                 ERRORF(reporter,
442                        "Error at (%d %d) in transfer, color type: %s, diffs: (%f, %f, %f, %f)",
443                        x, y, GrColorTypeToStr(colorType),
444                        diffs[0], diffs[1], diffs[2], diffs[3]);
445             });
446     GrImageInfo textureDataInfo(colorType, kUnpremul_SkAlphaType, nullptr, kTexDims);
447     ComparePixels(GrCPixmap(textureDataInfo,  textureData.get(), textureDataRowBytes),
448                   GrCPixmap(   transferInfo, transferData.get(),  fullBufferRowBytes),
449                   tol,
450                   error);
451 
452     ///////////////////////
453     // Now test a partial read at an offset into the buffer.
454     result = gpu->transferPixelsFrom(
455             tex.get(),
456             SkIRect::MakeXYWH(kPartialLeft, kPartialTop, kPartialWidth, kPartialHeight),
457             colorType,
458             allowedRead.fColorType,
459             buffer,
460             partialReadOffset);
461     if (!result) {
462         ERRORF(reporter, "transferPixelsFrom failed.");
463         return;
464     }
465     ++expectedTransferCnt;
466 
467     if (context->priv().caps()->mapBufferFlags() & GrCaps::kAsyncRead_MapFlag) {
468         gpu->submitToGpu(true);
469     }
470 
471     map = reinterpret_cast<const char*>(buffer->map());
472     REPORTER_ASSERT(reporter, map);
473     if (!map) {
474         ERRORF(reporter, "Failed to map transfer buffer.");
475         return;
476     }
477     const char* bufferStart = reinterpret_cast<const char*>(map) + partialReadOffset;
478     memcpy(transferData.get(), bufferStart, partialBufferRowBytes * kTexDims.fHeight);
479     buffer->unmap();
480 
481     transferInfo = transferInfo.makeWH(kPartialWidth, kPartialHeight);
482     const char* textureDataStart =
483             textureData.get() + textureDataRowBytes * kPartialTop + textureDataBpp * kPartialLeft;
484     textureDataInfo = textureDataInfo.makeWH(kPartialWidth, kPartialHeight);
485     ComparePixels(GrCPixmap(textureDataInfo,   textureDataStart,   textureDataRowBytes),
486                   GrCPixmap(transferInfo   , transferData.get(), partialBufferRowBytes),
487                   tol,
488                   error);
489 #if GR_GPU_STATS
490     REPORTER_ASSERT(reporter, gpu->stats()->transfersFromSurface() == expectedTransferCnt);
491 #else
492     (void)expectedTransferCnt;
493 #endif
494 }
495 
DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(TransferPixelsToTextureTest,reporter,ctxInfo,CtsEnforcement::kApiLevel_T)496 DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(TransferPixelsToTextureTest,
497                                        reporter,
498                                        ctxInfo,
499                                        CtsEnforcement::kApiLevel_T) {
500     if (!ctxInfo.directContext()->priv().caps()->transferFromBufferToTextureSupport()) {
501         return;
502     }
503     for (auto renderable : {GrRenderable::kNo, GrRenderable::kYes}) {
504         for (auto colorType : {
505                      GrColorType::kAlpha_8,
506                      GrColorType::kBGR_565,
507                      GrColorType::kABGR_4444,
508                      GrColorType::kRGBA_8888,
509                      GrColorType::kRGBA_8888_SRGB,
510                      GrColorType::kRGB_888x,
511                      GrColorType::kRG_88,
512                      GrColorType::kBGRA_8888,
513                      GrColorType::kRGBA_1010102,
514                      GrColorType::kBGRA_1010102,
515                      GrColorType::kGray_8,
516                      GrColorType::kAlpha_F16,
517                      GrColorType::kRGBA_F16,
518                      GrColorType::kRGBA_F16_Clamped,
519                      GrColorType::kRGBA_F32,
520                      GrColorType::kAlpha_16,
521                      GrColorType::kRG_1616,
522                      GrColorType::kRGBA_16161616,
523                      GrColorType::kRG_F16,
524              }) {
525             basic_transfer_to_test(reporter, ctxInfo.directContext(), colorType, renderable);
526         }
527     }
528 }
529 
530 // TODO(bsalomon): Metal
DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(TransferPixelsFromTextureTest,reporter,ctxInfo,CtsEnforcement::kApiLevel_T)531 DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(TransferPixelsFromTextureTest,
532                                        reporter,
533                                        ctxInfo,
534                                        CtsEnforcement::kApiLevel_T) {
535     if (!ctxInfo.directContext()->priv().caps()->transferFromSurfaceToBufferSupport()) {
536         return;
537     }
538     for (auto renderable : {GrRenderable::kNo, GrRenderable::kYes}) {
539         for (auto colorType : {
540                      GrColorType::kAlpha_8,
541                      GrColorType::kAlpha_16,
542                      GrColorType::kBGR_565,
543                      GrColorType::kABGR_4444,
544                      GrColorType::kRGBA_8888,
545                      GrColorType::kRGBA_8888_SRGB,
546                      GrColorType::kRGB_888x,
547                      GrColorType::kRG_88,
548                      GrColorType::kBGRA_8888,
549                      GrColorType::kRGBA_1010102,
550                      GrColorType::kBGRA_1010102,
551                      GrColorType::kGray_8,
552                      GrColorType::kAlpha_F16,
553                      GrColorType::kRGBA_F16,
554                      GrColorType::kRGBA_F16_Clamped,
555                      GrColorType::kRGBA_F32,
556                      GrColorType::kRG_1616,
557                      GrColorType::kRGBA_16161616,
558                      GrColorType::kRG_F16,
559              }) {
560             basic_transfer_from_test(reporter, ctxInfo, colorType, renderable);
561         }
562     }
563 }
564