xref: /aosp_15_r20/external/skia/gm/BUILD.bazel (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1load("//bazel:skia_rules.bzl", "skia_cc_library", "skia_cc_test", "supports_platforms")
2load("//tools/testrunners/gm:android_gm_test.bzl", "android_gm_test")
3load(":png_codec.bzl", "png_codec_tests")
4
5package(
6    default_applicable_licenses = ["//:license"],
7)
8
9licenses(["notice"])
10
11filegroup(
12    name = "gm_subset",
13    srcs = [
14        "bitmaprect.cpp",
15        "colrv1.cpp",
16        "fontations.cpp",
17        "palette.cpp",
18    ],
19    visibility = ["//tools/viewer:__pkg__"],
20)
21
22skia_cc_library(
23    name = "gm",
24    testonly = True,
25    srcs = [
26        "gm.cpp",
27    ],
28    hdrs = ["gm.h"],
29    visibility = [
30        "//dm:__pkg__",
31        "//tools/testrunners/gm:__subpackages__",
32        "//tools/viewer:__pkg__",
33    ],
34    deps = [
35        "//:core",
36        "//tools:registry",
37        "//tools:tool_utils",
38        "//tools/fonts:font_tool_utils",
39    ],
40)
41
42CPU_GMS = [
43    # This is an incomplete list of GMs that only require a CPU.
44    # TODO(lovisolo): Complete this list.
45    "3d.cpp",
46    "aaa.cpp",
47    "aaclip.cpp",
48    "aarectmodes.cpp",
49    "aaxfermodes.cpp",
50    "addarc.cpp",
51    "all_bitmap_configs.cpp",
52    "alphagradients.cpp",
53    "alpha_image.cpp",
54    "analytic_gradients.cpp",
55    "androidblendmodes.cpp",
56    # "animated_gif.cpp", # needs a dep on SkResources
57    "animatedimageblurs.cpp",
58    # "animated_image_orientation.cpp", # Requires //include/android/SkAnimatedImage.h
59    # "annotated_text.cpp",  # ./include/core/SkRefCnt.h:41: fatal error: "assert(this->getRefCnt() == 1)"
60    "arcofzorro.cpp",
61    "arcto.cpp",
62    "arithmode.cpp",
63
64    # TODO(lovisolo): Are these CPU-only, GPU-only or something else? Try them and add them to the
65    #                 corresponding list.
66    # "b_119394958.cpp",
67    # "backdrop.cpp",
68    # "backdrop_imagefilter_croprect.cpp",
69    # "badpaint.cpp",
70    # "batchedconvexpaths.cpp",
71    # "bc1_transparency.cpp",
72    # "beziereffects.cpp",
73    # "beziers.cpp",
74    # "bicubic.cpp",
75    # "bigblurs.cpp",
76    # "bigmatrix.cpp",
77    # "bigrect.cpp",
78    # "bigrrectaaeffect.cpp",
79    # "bigtext.cpp",
80    # "bigtileimagefilter.cpp",
81    # "bitmapcopy.cpp",
82    # "bitmapfilters.cpp",
83    # "bitmapimage.cpp",
84    # "bitmappremul.cpp",
85    # "bitmaprect.cpp",
86    # "bitmaprecttest.cpp",
87    # "bitmapshader.cpp",
88    # "bitmaptiled.cpp",
89    # "bleed.cpp",
90    # "blend.cpp",
91    # "blurcircles2.cpp",
92    # "blurcircles.cpp",
93    # "blurignorexform.cpp",
94    # "blurimagevmask.cpp",
95    # "blurpositioning.cpp",
96    # "blurquickreject.cpp",
97    # "blurrect.cpp",
98    # "blurredclippedcircle.cpp",
99    # "blurroundrect.cpp",
100    # "blurs.cpp",
101    # "blurtextsmallradii.cpp",
102    # "bmpfilterqualityrepeat.cpp",
103    # "bug12866.cpp",
104    # "bug5252.cpp",
105    # "bug530095.cpp",
106    # "bug615686.cpp",
107    # "bug6643.cpp",
108    # "bug6783.cpp",
109    # "bug9331.cpp",
110    # "circle_sizes.cpp",
111    # "circulararcs.cpp",
112    # "circularclips.cpp",
113    # "clear_swizzle.cpp",
114    # "clipdrawdraw.cpp",
115    # "clip_error.cpp",
116    # "clippedbitmapshaders.cpp",
117    # "clipshader.cpp",
118    # "clip_sierpinski_region.cpp",
119    # "clip_strokerect.cpp",
120    # "clockwise.cpp",
121    # "collapsepaths.cpp",
122    # "color4f.cpp",
123    # "coloremoji_blendmodes.cpp",
124    # "coloremoji.cpp",
125    # "colorfilteralpha8.cpp",
126    # "colorfilterimagefilter.cpp",
127    # "colorfilters.cpp",
128    # "colormatrix.cpp",
129    # "colorspace.cpp",
130    # "colorwheel.cpp",
131    # "colrv1.cpp",
132    # "complexclip2.cpp",
133    # "complexclip3.cpp",
134    # "complexclip4.cpp",
135    # "complexclip_blur_tiled.cpp",
136    # "complexclip.cpp",
137    # "composecolorfilter.cpp",
138    # "composeshader.cpp",
139    # "compositor_quads.cpp",
140    # "compressed_textures.cpp",
141    # "concavepaths.cpp",
142    # "conicpaths.cpp",
143    # "constcolorprocessor.cpp",
144    # "convex_all_line_paths.cpp",
145    # "convexpaths.cpp",
146    # "convexpolyclip.cpp",
147    # "convexpolyeffect.cpp",
148    # "coordclampshader.cpp",
149    # "copy_to_4444.cpp",
150    # "crbug_1041204.cpp",
151    # "crbug_1073670.cpp",
152    # "crbug_1086705.cpp",
153    # "crbug_1113794.cpp",
154    # "crbug_1139750.cpp",
155    # "crbug_1156804.cpp",
156    # "crbug_1162942.cpp",
157    # "crbug_1167277.cpp",
158    # "crbug_1174186.cpp",
159    # "crbug_1174354.cpp",
160    # "crbug_1177833.cpp",
161    # "crbug_1257515.cpp",
162    # "crbug_1313579.cpp",
163    # "crbug_224618.cpp",
164    # "crbug_691386.cpp",
165    # "crbug_788500.cpp",
166    # "crbug_847759.cpp",
167    # "crbug_884166.cpp",
168    # "crbug_887103.cpp",
169    # "crbug_892988.cpp",
170    # "crbug_899512.cpp",
171    # "crbug_905548.cpp",
172    # "crbug_908646.cpp",
173    # "crbug_913349.cpp",
174    # "crbug_918512.cpp",
175    # "crbug_938592.cpp",
176    # "crbug_946965.cpp",
177    # "crbug_947055.cpp",
178    # "crbug_996140.cpp",
179    # "crop_imagefilter.cpp",
180    # "croppedrects.cpp",
181    # "crosscontextimage.cpp",
182    # "cubicpaths.cpp",
183    # "daa.cpp",
184    # "dashcircle.cpp",
185    # "dashcubics.cpp",
186    # "dashing.cpp",
187    # "degeneratesegments.cpp",
188    # "destcolor.cpp",
189    # "dftext_blob_persp.cpp",
190    # "dftext.cpp",
191    # "discard.cpp",
192    # "displacement.cpp",
193    # "distantclip.cpp",
194    # "drawable.cpp",
195    # "drawatlascolor.cpp",
196    # "drawatlas.cpp",
197    # "drawbitmaprect.cpp",
198    # "draw_bitmap_rect_skbug4374.cpp",
199    # "drawglyphs.cpp",
200    # "drawimageset.cpp",
201    # "drawlines_with_local_matrix.cpp",
202    # "drawminibitmaprect.cpp",
203    # "drawquadset.cpp",
204    # "drawregion.cpp",
205    # "drawregionmodes.cpp",
206    # "dropshadowimagefilter.cpp",
207    # "drrect.cpp",
208    # "drrect_small_inner.cpp",
209    # "dstreadshuffle.cpp",
210    # "ducky_yuv_blend.cpp",
211    # "emboss.cpp",
212    # "emptypath.cpp",
213    # "encode_alpha_jpeg.cpp",
214    # "encode_color_types.cpp",
215    # "encode.cpp",
216    # "encode_platform.cpp",
217    # "encode_srgb.cpp",
218    # "exoticformats.cpp",
219    # "fadefilter.cpp",
220    # "fatpathfill.cpp",
221    # "fiddle.cpp",
222    # "fillrect_gradient.cpp",
223    # "filltypes.cpp",
224    # "filltypespersp.cpp",
225    # "filterbug.cpp",
226    # "filterfastbounds.cpp",
227    # "filterindiabox.cpp",
228    # "flippity.cpp",
229    # "fontations.cpp",
230    # "fontcache.cpp",
231    # "fontmgr.cpp",
232    # "fontregen.cpp",
233    # "fontscaler.cpp",
234    # "fontscalerdistortable.cpp",
235    # "fpcoordinateoverride.cpp",
236    # "fp_sample_chaining.cpp",
237    # "fwidth_squircle.cpp",
238    # "gammatext.cpp",
239    # "getpostextpath.cpp",
240    # "giantbitmap.cpp",
241    # "glyph_pos.cpp",
242    # "gpu_blur_utils.cpp",
243    # "gradient_dirty_laundry.cpp",
244    # "gradient_matrix.cpp",
245    # "gradients_2pt_conical.cpp",
246    # "gradients.cpp",
247    # "gradients_degenerate.cpp",
248    # "gradients_no_texture.cpp",
249    # "gradtext.cpp",
250    # "graphite_replay.cpp",
251    # "graphitestart.cpp",
252    # "grayscalejpg.cpp",
253    # "hairlines.cpp",
254    # "hairmodes.cpp",
255    # "hardstop_gradients.cpp",
256    # "hardstop_gradients_many.cpp",
257    # "highcontrastfilter.cpp",
258    # "hittestpath.cpp",
259    # "hsl.cpp",
260    # "hugepath.cpp",
261    # "imageblur2.cpp",
262    # "imageblurclampmode.cpp",
263    # "imageblur.cpp",
264    # "imageblurrepeatmode.cpp",
265    # "imageblurtiled.cpp",
266    # "image.cpp",
267    # "imagefiltersbase.cpp",
268    # "imagefiltersclipped.cpp",
269    # "imagefilters.cpp",
270    # "imagefilterscropexpand.cpp",
271    # "imagefilterscropped.cpp",
272    # "imagefiltersgraph.cpp",
273    # "imagefiltersscaled.cpp",
274    # "imagefiltersstroked.cpp",
275    # "imagefilterstransformed.cpp",
276    # "imagefiltersunpremul.cpp",
277    # "imagefromyuvtextures.cpp",
278    # "imagemagnifier.cpp",
279    # "imagemakewithfilter.cpp",
280    # "imagemasksubset.cpp",
281    # "image_pict.cpp",
282    # "imageresizetiled.cpp",
283    # "image_shader.cpp",
284    # "imagesource2.cpp",
285    # "imagesource.cpp",
286    # "internal_links.cpp",
287    # "inverseclip.cpp",
288    # "inversepaths.cpp",
289    # "jpg_color_cube.cpp",
290    # "kawase_blur_rt.cpp",
291    # "labyrinth.cpp",
292    # "largeclippedpath.cpp",
293    # "largeglyphblur.cpp",
294    # "lattice.cpp",
295    # "lazytiling.cpp",
296    # "lcdblendmodes.cpp",
297    # "lcdoverlap.cpp",
298    # "lcdtext.cpp",
299    # "lighting.cpp",
300    # "linepaths.cpp",
301    # "localmatriximagefilter.cpp",
302    # "localmatriximageshader.cpp",
303    # "localmatrixshader.cpp",
304    # "lumafilter.cpp",
305    # "mac_aa_explorer.cpp",
306    # "makecolorspace.cpp",
307    # "make_raster_image.cpp",
308    # "mandoline.cpp",
309    # "manypathatlases.cpp",
310    # "manypaths.cpp",
311    # "matrixconvolution.cpp",
312    # "matriximagefilter.cpp",
313    # "mesh.cpp",
314    # "mipmap.cpp",
315    # "mirrortile.cpp",
316    # "mixedtextblobs.cpp",
317    # "mixercolorfilter.cpp",
318    # "modecolorfilters.cpp",
319    # "morphology.cpp",
320    # "nearesthalfpixelimage.cpp",
321    # "nested.cpp",
322    # "ninepatchstretch.cpp",
323    # "nonclosedpaths.cpp",
324    # "offsetimagefilter.cpp",
325    # "orientation.cpp",
326    # "ovals.cpp",
327    # "overdrawcanvas.cpp",
328    # "overdrawcolorfilter.cpp",
329    # "overstroke.cpp",
330    # "p3.cpp",
331    # "palette.cpp",
332    # "patch.cpp",
333    # "patharcto.cpp",
334    # "pathcontourstart.cpp",
335    # "patheffects.cpp",
336    # "pathfill.cpp",
337    # "pathinterior.cpp",
338    # "pathmaskcache.cpp",
339    # "pathmeasure.cpp",
340    # "pathopsinverse.cpp",
341    # "pathreverse.cpp",
342    # "path_stroke_with_zero_length.cpp",
343    # "pdf_never_embed.cpp",
344    # "perlinnoise.cpp",
345    # "perspimages.cpp",
346    # "perspshaders.cpp",
347    # "persptext.cpp",
348    # "picture.cpp",
349    # "pictureimagefilter.cpp",
350    # "pictureimagegenerator.cpp",
351    # "pictureshadercache.cpp",
352    # "pictureshader.cpp",
353    # "pictureshadertile.cpp",
354    # "plus.cpp",
355    # "points.cpp",
356    # "poly2poly.cpp",
357    # "polygonoffset.cpp",
358    # "polygons.cpp",
359    # "postercircle.cpp",
360    # "preservefillrule.cpp",
361    # "quadpaths.cpp",
362    # "radial_gradient_precision.cpp",
363    # "rasterhandleallocator.cpp",
364    # "readpixels.cpp",
365    # "recordopts.cpp",
366    # "rectangletexture.cpp",
367    # "repeated_bitmap.cpp",
368    # "resizeimagefilter.cpp",
369    # "rippleshadergm.cpp",
370    # "roundrects.cpp",
371    # "rrectclipdrawpaint.cpp",
372    # "rrect.cpp",
373    # "rrects.cpp",
374    # "rsxtext.cpp",
375    # "runtimecolorfilter.cpp",
376    # "runtimefunctions.cpp",
377    # "runtimeimagefilter.cpp",
378    # "runtimeintrinsics.cpp",
379    # "runtimeshader.cpp",
380    # "samplerstress.cpp",
381    # "savelayer.cpp",
382    # "scaledemoji.cpp",
383    # "scaledemoji_rendering.cpp",
384    # "scaledrects.cpp",
385    # "scaledstrokes.cpp",
386    # "shadermaskfilter.cpp",
387    # "shaderpath.cpp",
388    # "shadertext3.cpp",
389    # "shadowutils.cpp",
390    # "shallowgradient.cpp",
391    # "shapes.cpp",
392    # "sharedcorners.cpp",
393    # "showmiplevels.cpp",
394    # "simpleaaclip.cpp",
395    # "simplerect.cpp",
396    # "skbug_12212.cpp",
397    # "skbug1719.cpp",
398    # "skbug_257.cpp",
399    # "skbug_4868.cpp",
400    # "skbug_5321.cpp",
401    # "skbug_8664.cpp",
402    # "skbug_8955.cpp",
403    # "skbug_9319.cpp",
404    # "skbug_9819.cpp",
405    # "slug.cpp",
406    # "smallarc.cpp",
407    # "smallpaths.cpp",
408    # "spritebitmap.cpp",
409    # "srcmode.cpp",
410    # "srgb.cpp",
411    # "stlouisarch.cpp",
412    # "stringart.cpp",
413    # "strokedlines.cpp",
414    # "strokefill.cpp",
415    # "strokerect_anisotropic.cpp",
416    # "strokerect.cpp",
417    # "strokerects.cpp",
418    # "stroke_rect_shader.cpp",
419    # "strokes.cpp",
420    # "stroketext.cpp",
421    # "subsetshader.cpp",
422    # "surface.cpp",
423    # "swizzle.cpp",
424    # "tablecolorfilter.cpp",
425    # "tallstretchedbitmaps.cpp",
426    # "testgradient.cpp",
427    # "texelsubset.cpp",
428    # "textblobblockreordering.cpp",
429    # "textblobcolortrans.cpp",
430    # "textblob.cpp",
431    # "textblobgeometrychange.cpp",
432    # "textblobmixedsizes.cpp",
433    # "textblobrandomfont.cpp",
434    # "textblobshader.cpp",
435    # "textblobtransforms.cpp",
436    # "textblobuseaftergpufree.cpp",
437    # "texteffects.cpp",
438    # "text_scale_skew.cpp",
439    # "thinconcavepaths.cpp",
440    # "thinrects.cpp",
441    # "thinstrokedrects.cpp",
442    # "tiledscaledbitmap.cpp",
443    # "tileimagefilter.cpp",
444    # "tilemodes_alpha.cpp",
445    # "tilemodes.cpp",
446    # "tilemodes_scaled.cpp",
447    # "tinybitmap.cpp",
448    # "transparency.cpp",
449    # "trickycubicstrokes.cpp",
450    # "typeface.cpp",
451    # "unpremul.cpp",
452    # "userfont.cpp",
453    # "variedtext.cpp",
454    # "verifiers",
455    # "vertices.cpp",
456    # "verylargebitmap.cpp",
457    # "video_decoder.cpp",
458    # "wacky_yuv_formats.cpp",
459    # "widebuttcaps.cpp",
460    # "windowrectangles.cpp",
461    # "workingspace.cpp",
462    # "xfermodeimagefilter.cpp",
463    # "xfermodes2.cpp",
464    # "xfermodes3.cpp",
465    # "xfermodes.cpp",
466    # "ycbcrimage.cpp",
467    # "yuv420_odd_dim.cpp",
468    # "yuvtorgbsubset.cpp",
469]
470
471GPU_GMS = [
472    # TODO(lovisolo): Incomplete list. Some commented out files in CPU_GMS probably belong here.
473    # "aarecteffect.cpp",  # ./include/core/SkRefCnt.h:41: fatal error: "assert(this->getRefCnt() == 1)"
474    "anisotropic.cpp",
475    # "asyncrescaleandread.cpp",  # ./include/core/SkRefCnt.h:41: fatal error: "assert(this->getRefCnt() == 1)"
476    # "attributes.cpp",  # ./include/core/SkRefCnt.h:41: fatal error: "assert(this->getRefCnt() == 1)"
477    # "beziereffects.cpp",  # ./include/core/SkRefCnt.h:41: fatal error: "assert(this->getRefCnt() == 1)"
478    # "clockwise.cpp",  # ./include/core/SkRefCnt.h:41: fatal error: "assert(this->getRefCnt() == 1)"
479]
480
481COMMON_DEPS = [
482    "//:core",
483    "//gm",
484    "//src/core:core_priv",
485    "//tools:codec_utils",
486    "//tools:hash_and_encode",
487    "//tools:tool_utils",
488    "//tools/testrunners/common:testrunner",
489    "//tools/testrunners/common/compilation_mode_keys",
490]
491
492# Sample invocation:
493#
494#     $ bazel run --config=linux_rbe //gm:cpu_8888_test
495#
496# Then inspect the PNG and JSON files produced by the GMs:
497#
498#     $ unzip -l bazel-testlogs/gm/cpu_8888_test/test.outputs/outputs.zip
499skia_cc_test(
500    name = "cpu_8888_test",
501    srcs = CPU_GMS + [
502        "//tools/testrunners/gm:BazelGMTestRunner.cpp",
503    ],
504    args = [
505        "--surfaceConfig",
506        "8888",
507    ],
508    data = ["//resources"],
509    target_compatible_with = supports_platforms(
510        "@platforms//os:linux",
511        "@platforms//os:windows",
512        "@platforms//os:macos",
513    ),
514    deps = COMMON_DEPS + [
515        "//tools/testrunners/common/surface_manager:raster",
516        "//tools/testrunners/gm/vias:simple_vias",
517        "//tools/timer",  # Required by addarc.cpp and animatedimageblurs.cpp.
518    ],
519)
520
521skia_cc_test(
522    name = "cpu_8888_via_picture_serialization_test",
523    srcs = CPU_GMS + [
524        "//tools/testrunners/gm:BazelGMTestRunner.cpp",
525    ],
526    args = [
527        "--surfaceConfig",
528        "8888",
529        "--via",
530        "picture_serialization",
531        # These tests fail with "Recorded and reference bitmap pixels do not match."
532        "--skip",
533        "analytic_antialias_convex",
534        "arithmode",
535        "arithmode_blender",
536    ],
537    data = ["//resources"],
538    target_compatible_with = supports_platforms(
539        "@platforms//os:linux",
540        "@platforms//os:windows",
541        "@platforms//os:macos",
542    ),
543    deps = COMMON_DEPS + [
544        "//tools/testrunners/common/surface_manager:raster",
545        "//tools/testrunners/gm/vias:simple_vias",
546        "//tools/timer",  # Required by addarc.cpp and animatedimageblurs.cpp.
547    ],
548)
549
550skia_cc_test(
551    name = "cpu_8888_via_picture_test",
552    srcs = CPU_GMS + [
553        "//tools/testrunners/gm:BazelGMTestRunner.cpp",
554    ],
555    args = [
556        "--surfaceConfig",
557        "8888",
558        "--via",
559        "picture",
560    ],
561    data = ["//resources"],
562    target_compatible_with = supports_platforms(
563        "@platforms//os:linux",
564        "@platforms//os:windows",
565        "@platforms//os:macos",
566    ),
567    deps = COMMON_DEPS + [
568        "//tools/testrunners/common/surface_manager:raster",
569        "//tools/testrunners/gm/vias:simple_vias",
570        "//tools/timer",  # Required by addarc.cpp and animatedimageblurs.cpp.
571    ],
572)
573
574png_codec_tests(name = "png_codec_tests")
575
576test_suite(
577    name = "cpu_gm_tests",
578    tests = [
579        "cpu_8888_test",
580        "cpu_8888_via_picture_serialization_test",
581        "cpu_8888_via_picture_test",
582        ":png_codec_tests",
583    ],
584)
585
586skia_cc_test(
587    name = "ganesh_gles_test",
588    srcs = GPU_GMS + [
589        "//tools/testrunners/gm:BazelGMTestRunner.cpp",
590    ],
591    args = [
592        "--surfaceConfig",
593        "gles",
594    ],
595    data = ["//resources"],
596    target_compatible_with = supports_platforms(
597        "@platforms//os:linux",
598        "@platforms//os:windows",
599        "@platforms//os:macos",
600    ),
601    deps = COMMON_DEPS + [
602        "//tools/testrunners/common/surface_manager:ganesh_gl",
603        "//tools/testrunners/gm/vias:simple_vias",
604    ],
605)
606
607# Vulkan GMs.
608[
609    skia_cc_test(
610        name = name,
611        srcs = GPU_GMS + [
612            "//tools/testrunners/gm:BazelGMTestRunner.cpp",
613        ],
614        args = [
615            "--surfaceConfig",
616            surfaceConfig,
617        ],
618        data = ["//resources"],
619        target_compatible_with = supports_platforms(
620            "@platforms//os:linux",
621            "@platforms//os:windows",
622            "@platforms//os:macos",
623        ),
624        deps = COMMON_DEPS + [
625            "//tools/testrunners/common/surface_manager:ganesh_vulkan",
626            "//tools/testrunners/gm/vias:simple_vias",
627        ],
628    )
629    for name, surfaceConfig in [
630        [
631            "ganesh_vk_test",
632            "vk",
633        ],
634        [
635            "ganesh_vk_1010102_test",
636            "vk_1010102",
637        ],
638        [
639            "ganesh_vk_msaa4_test",
640            "vk_msaa4",
641        ],
642        [
643            "ganesh_vk_msaa8_test",
644            "vk_msaa8",
645        ],
646        [
647            "ganesh_vk_dmsaa_test",
648            "vk_dmsaa",
649        ],
650        [
651            "ganesh_vk_betex_test",
652            "vk_betex",
653        ],
654        [
655            "ganesh_vk_bert_test",
656            "vk_bert",
657        ],
658    ]
659]
660
661skia_cc_test(
662    name = "hello_bazel_world_test",
663    srcs = [
664        "hello_bazel_world.cpp",
665        "//tools/testrunners/gm:BazelGMTestRunner.cpp",
666    ],
667    args = [
668        "--surfaceConfig",
669        "8888",
670    ],
671    data = ["//resources"],
672    target_compatible_with = supports_platforms(
673        "@platforms//os:linux",
674        "@platforms//os:windows",
675        "@platforms//os:macos",
676    ),
677    deps = COMMON_DEPS + [
678        "//tools/testrunners/common/surface_manager:raster",
679        "//tools/testrunners/gm/vias:simple_vias",
680    ],
681)
682
683android_gm_test(
684    name = "hello_bazel_world_android_test",
685    srcs = [
686        "hello_bazel_world.cpp",
687        "//tools/testrunners/gm:BazelGMTestRunner.cpp",
688    ],
689    args = [
690        "--surfaceConfig",
691        "8888",
692    ],
693    requires_resources_dir = True,
694    deps = COMMON_DEPS + [
695        "//tools/testrunners/common/surface_manager:raster",
696        "//tools/testrunners/gm/vias:simple_vias",
697    ],
698)
699
700[
701    # Sample invocation (assuming there's a Pixel 5 or similar device available via adb):
702    #
703    #     $ bazel test --config=android_rbe --config=Pixel5 //gm:cpu_8888_android_test
704    #
705    # Then inspect the PNG and JSON files produced by the GMs:
706    #
707    #     $ unzip -l bazel-testlogs/gm/cpu_8888_android_test/test.outputs/outputs.zip
708    android_gm_test(
709        name = "cpu_%s_android_test" % surface_config,
710        srcs = CPU_GMS + [
711            "//tools/testrunners/gm:BazelGMTestRunner.cpp",
712        ],
713        args = [
714            "--surfaceConfig",
715            "8888",
716        ],
717        requires_resources_dir = True,
718        deps = COMMON_DEPS + [
719            "//tools/testrunners/common/surface_manager:raster",
720            "//tools/testrunners/gm/vias:simple_vias",
721            "//tools/timer",  # Required by addarc.cpp and animatedimageblurs.cpp.
722        ],
723    )
724    for surface_config in [
725        "8888",
726        "565",
727    ]
728]
729
730android_gm_test(
731    name = "ganesh_gles_android_test",
732    srcs = GPU_GMS + [
733        "//tools/testrunners/gm:BazelGMTestRunner.cpp",
734    ],
735    args = [
736        "--surfaceConfig",
737        "gles",
738    ],
739    requires_resources_dir = True,
740    deps = COMMON_DEPS + [
741        "//tools/testrunners/common/surface_manager:ganesh_gl",
742        "//tools/testrunners/gm/vias:simple_vias",
743    ],
744)
745
746android_gm_test(
747    name = "ganesh_gles_via_picture_serialization_android_test",
748    srcs = GPU_GMS + [
749        "//tools/testrunners/gm:BazelGMTestRunner.cpp",
750    ],
751    args = [
752        "--surfaceConfig",
753        "gles",
754        "--via",
755        "picture_serialization",
756        "--skip",
757        "anisomips",  # Fails with "Recorded and reference bitmap pixels do not match".
758    ],
759    requires_resources_dir = True,
760    deps = COMMON_DEPS + [
761        "//tools/testrunners/common/surface_manager:ganesh_gl",
762        "//tools/testrunners/gm/vias:simple_vias",
763    ],
764)
765
766android_gm_test(
767    name = "ganesh_gles_via_picture_android_test",
768    srcs = GPU_GMS + [
769        "//tools/testrunners/gm:BazelGMTestRunner.cpp",
770    ],
771    args = [
772        "--surfaceConfig",
773        "gles",
774        "--via",
775        "picture",
776        "--skip",
777        "anisomips",  # Fails with "Recorded and reference bitmap pixels do not match".
778    ],
779    requires_resources_dir = True,
780    deps = COMMON_DEPS + [
781        "//tools/testrunners/common/surface_manager:ganesh_gl",
782        "//tools/testrunners/gm/vias:simple_vias",
783    ],
784)
785
786android_gm_test(
787    name = "ganesh_vk_android_test",
788    srcs = GPU_GMS + [
789        "//tools/testrunners/gm:BazelGMTestRunner.cpp",
790    ],
791    args = [
792        "--surfaceConfig",
793        "vk",
794    ],
795    requires_resources_dir = True,
796    deps = COMMON_DEPS + [
797        "//tools/testrunners/common/surface_manager:ganesh_vulkan",
798        "//tools/testrunners/gm/vias:simple_vias",
799    ],
800)
801