load("//bazel:skia_rules.bzl", "exports_files_legacy", "skia_cc_library", "skia_cc_test", "supports_platforms") load("//tools/testrunners/gm:android_gm_test.bzl", "android_gm_test") load(":png_codec.bzl", "png_codec_tests") package( default_applicable_licenses = ["//:license"], ) licenses(["notice"]) exports_files_legacy() filegroup( name = "gm_subset", srcs = [ "bitmaprect.cpp", "colrv1.cpp", "fontations.cpp", "palette.cpp", ], visibility = ["//tools/viewer:__pkg__"], ) skia_cc_library( name = "gm", testonly = True, srcs = [ "gm.cpp", ], hdrs = ["gm.h"], visibility = [ "//tools/testrunners/gm:__subpackages__", "//tools/viewer:__pkg__", ], deps = [ "//:core", "//tools:registry", "//tools:tool_utils", "//tools/fonts:font_tool_utils", ], ) CPU_GMS = [ # This is an incomplete list of GMs that only require a CPU. # TODO(lovisolo): Complete this list. "3d.cpp", "aaa.cpp", "aaclip.cpp", "aarectmodes.cpp", "aaxfermodes.cpp", "addarc.cpp", "all_bitmap_configs.cpp", "alphagradients.cpp", "alpha_image.cpp", "analytic_gradients.cpp", "androidblendmodes.cpp", # "animated_gif.cpp", # needs a dep on SkResources "animatedimageblurs.cpp", # "animated_image_orientation.cpp", # Requires //include/android/SkAnimatedImage.h # "annotated_text.cpp", # ./include/core/SkRefCnt.h:41: fatal error: "assert(this->getRefCnt() == 1)" "arcofzorro.cpp", "arcto.cpp", "arithmode.cpp", # TODO(lovisolo): Are these CPU-only, GPU-only or something else? Try them and add them to the # corresponding list. # "b_119394958.cpp", # "backdrop.cpp", # "backdrop_imagefilter_croprect.cpp", # "badpaint.cpp", # "batchedconvexpaths.cpp", # "bc1_transparency.cpp", # "beziereffects.cpp", # "beziers.cpp", # "bicubic.cpp", # "bigblurs.cpp", # "bigmatrix.cpp", # "bigrect.cpp", # "bigrrectaaeffect.cpp", # "bigtext.cpp", # "bigtileimagefilter.cpp", # "bitmapcopy.cpp", # "bitmapfilters.cpp", # "bitmapimage.cpp", # "bitmappremul.cpp", # "bitmaprect.cpp", # "bitmaprecttest.cpp", # "bitmapshader.cpp", # "bitmaptiled.cpp", # "bleed.cpp", # "blend.cpp", # "blurcircles2.cpp", # "blurcircles.cpp", # "blurignorexform.cpp", # "blurimagevmask.cpp", # "blurpositioning.cpp", # "blurquickreject.cpp", # "blurrect.cpp", # "blurredclippedcircle.cpp", # "blurroundrect.cpp", # "blurs.cpp", # "blurtextsmallradii.cpp", # "bmpfilterqualityrepeat.cpp", # "bug12866.cpp", # "bug5252.cpp", # "bug530095.cpp", # "bug615686.cpp", # "bug6643.cpp", # "bug6783.cpp", # "bug9331.cpp", # "circle_sizes.cpp", # "circulararcs.cpp", # "circularclips.cpp", # "clear_swizzle.cpp", # "clipdrawdraw.cpp", # "clip_error.cpp", # "clippedbitmapshaders.cpp", # "clipshader.cpp", # "clip_sierpinski_region.cpp", # "clip_strokerect.cpp", # "clockwise.cpp", # "collapsepaths.cpp", # "color4f.cpp", # "coloremoji_blendmodes.cpp", # "coloremoji.cpp", # "colorfilteralpha8.cpp", # "colorfilterimagefilter.cpp", # "colorfilters.cpp", # "colormatrix.cpp", # "colorspace.cpp", # "colorwheel.cpp", # "colrv1.cpp", # "complexclip2.cpp", # "complexclip3.cpp", # "complexclip4.cpp", # "complexclip_blur_tiled.cpp", # "complexclip.cpp", # "composecolorfilter.cpp", # "composeshader.cpp", # "compositor_quads.cpp", # "compressed_textures.cpp", # "concavepaths.cpp", # "conicpaths.cpp", # "constcolorprocessor.cpp", # "convex_all_line_paths.cpp", # "convexpaths.cpp", # "convexpolyclip.cpp", # "convexpolyeffect.cpp", # "coordclampshader.cpp", # "copy_to_4444.cpp", # "crbug_1041204.cpp", # "crbug_1073670.cpp", # "crbug_1086705.cpp", # "crbug_1113794.cpp", # "crbug_1139750.cpp", # "crbug_1156804.cpp", # "crbug_1162942.cpp", # "crbug_1167277.cpp", # "crbug_1174186.cpp", # "crbug_1174354.cpp", # "crbug_1177833.cpp", # "crbug_1257515.cpp", # "crbug_1313579.cpp", # "crbug_224618.cpp", # "crbug_691386.cpp", # "crbug_788500.cpp", # "crbug_847759.cpp", # "crbug_884166.cpp", # "crbug_887103.cpp", # "crbug_892988.cpp", # "crbug_899512.cpp", # "crbug_905548.cpp", # "crbug_908646.cpp", # "crbug_913349.cpp", # "crbug_918512.cpp", # "crbug_938592.cpp", # "crbug_946965.cpp", # "crbug_947055.cpp", # "crbug_996140.cpp", # "crop_imagefilter.cpp", # "croppedrects.cpp", # "crosscontextimage.cpp", # "cubicpaths.cpp", # "daa.cpp", # "dashcircle.cpp", # "dashcubics.cpp", # "dashing.cpp", # "degeneratesegments.cpp", # "destcolor.cpp", # "dftext_blob_persp.cpp", # "dftext.cpp", # "discard.cpp", # "displacement.cpp", # "distantclip.cpp", # "drawable.cpp", # "drawatlascolor.cpp", # "drawatlas.cpp", # "drawbitmaprect.cpp", # "draw_bitmap_rect_skbug4374.cpp", # "drawglyphs.cpp", # "drawimageset.cpp", # "drawlines_with_local_matrix.cpp", # "drawminibitmaprect.cpp", # "drawquadset.cpp", # "drawregion.cpp", # "drawregionmodes.cpp", # "dropshadowimagefilter.cpp", # "drrect.cpp", # "drrect_small_inner.cpp", # "dstreadshuffle.cpp", # "ducky_yuv_blend.cpp", # "emboss.cpp", # "emptypath.cpp", # "encode_alpha_jpeg.cpp", # "encode_color_types.cpp", # "encode.cpp", # "encode_platform.cpp", # "encode_srgb.cpp", # "exoticformats.cpp", # "fadefilter.cpp", # "fatpathfill.cpp", # "fiddle.cpp", # "fillrect_gradient.cpp", # "filltypes.cpp", # "filltypespersp.cpp", # "filterbug.cpp", # "filterfastbounds.cpp", # "filterindiabox.cpp", # "flippity.cpp", # "fontations.cpp", # "fontcache.cpp", # "fontmgr.cpp", # "fontregen.cpp", # "fontscaler.cpp", # "fontscalerdistortable.cpp", # "fpcoordinateoverride.cpp", # "fp_sample_chaining.cpp", # "fwidth_squircle.cpp", # "gammatext.cpp", # "getpostextpath.cpp", # "giantbitmap.cpp", # "glyph_pos.cpp", # "gpu_blur_utils.cpp", # "gradient_dirty_laundry.cpp", # "gradient_matrix.cpp", # "gradients_2pt_conical.cpp", # "gradients.cpp", # "gradients_degenerate.cpp", # "gradients_no_texture.cpp", # "gradtext.cpp", # "graphite_replay.cpp", # "graphitestart.cpp", # "grayscalejpg.cpp", # "hairlines.cpp", # "hairmodes.cpp", # "hardstop_gradients.cpp", # "hardstop_gradients_many.cpp", # "highcontrastfilter.cpp", # "hittestpath.cpp", # "hsl.cpp", # "hugepath.cpp", # "imageblur2.cpp", # "imageblurclampmode.cpp", # "imageblur.cpp", # "imageblurrepeatmode.cpp", # "imageblurtiled.cpp", # "image.cpp", # "imagefiltersbase.cpp", # "imagefiltersclipped.cpp", # "imagefilters.cpp", # "imagefilterscropexpand.cpp", # "imagefilterscropped.cpp", # "imagefiltersgraph.cpp", # "imagefiltersscaled.cpp", # "imagefiltersstroked.cpp", # "imagefilterstransformed.cpp", # "imagefiltersunpremul.cpp", # "imagefromyuvtextures.cpp", # "imagemagnifier.cpp", # "imagemakewithfilter.cpp", # "imagemasksubset.cpp", # "image_pict.cpp", # "imageresizetiled.cpp", # "image_shader.cpp", # "imagesource2.cpp", # "imagesource.cpp", # "internal_links.cpp", # "inverseclip.cpp", # "inversepaths.cpp", # "jpg_color_cube.cpp", # "kawase_blur_rt.cpp", # "labyrinth.cpp", # "largeclippedpath.cpp", # "largeglyphblur.cpp", # "lattice.cpp", # "lazytiling.cpp", # "lcdblendmodes.cpp", # "lcdoverlap.cpp", # "lcdtext.cpp", # "lighting.cpp", # "linepaths.cpp", # "localmatriximagefilter.cpp", # "localmatriximageshader.cpp", # "localmatrixshader.cpp", # "lumafilter.cpp", # "mac_aa_explorer.cpp", # "makecolorspace.cpp", # "make_raster_image.cpp", # "mandoline.cpp", # "manypathatlases.cpp", # "manypaths.cpp", # "matrixconvolution.cpp", # "matriximagefilter.cpp", # "mesh.cpp", # "mipmap.cpp", # "mirrortile.cpp", # "mixedtextblobs.cpp", # "mixercolorfilter.cpp", # "modecolorfilters.cpp", # "morphology.cpp", # "nearesthalfpixelimage.cpp", # "nested.cpp", # "ninepatchstretch.cpp", # "nonclosedpaths.cpp", # "offsetimagefilter.cpp", # "orientation.cpp", # "ovals.cpp", # "overdrawcanvas.cpp", # "overdrawcolorfilter.cpp", # "overstroke.cpp", # "p3.cpp", # "palette.cpp", # "patch.cpp", # "patharcto.cpp", # "pathcontourstart.cpp", # "patheffects.cpp", # "pathfill.cpp", # "pathinterior.cpp", # "pathmaskcache.cpp", # "pathmeasure.cpp", # "pathopsinverse.cpp", # "pathreverse.cpp", # "path_stroke_with_zero_length.cpp", # "pdf_never_embed.cpp", # "perlinnoise.cpp", # "perspimages.cpp", # "perspshaders.cpp", # "persptext.cpp", # "picture.cpp", # "pictureimagefilter.cpp", # "pictureimagegenerator.cpp", # "pictureshadercache.cpp", # "pictureshader.cpp", # "pictureshadertile.cpp", # "plus.cpp", # "points.cpp", # "poly2poly.cpp", # "polygonoffset.cpp", # "polygons.cpp", # "postercircle.cpp", # "preservefillrule.cpp", # "quadpaths.cpp", # "radial_gradient_precision.cpp", # "rasterhandleallocator.cpp", # "readpixels.cpp", # "recordopts.cpp", # "rectangletexture.cpp", # "repeated_bitmap.cpp", # "resizeimagefilter.cpp", # "rippleshadergm.cpp", # "roundrects.cpp", # "rrectclipdrawpaint.cpp", # "rrect.cpp", # "rrects.cpp", # "rsxtext.cpp", # "runtimecolorfilter.cpp", # "runtimefunctions.cpp", # "runtimeimagefilter.cpp", # "runtimeintrinsics.cpp", # "runtimeshader.cpp", # "samplerstress.cpp", # "savelayer.cpp", # "scaledemoji.cpp", # "scaledemoji_rendering.cpp", # "scaledrects.cpp", # "scaledstrokes.cpp", # "shadermaskfilter.cpp", # "shaderpath.cpp", # "shadertext3.cpp", # "shadowutils.cpp", # "shallowgradient.cpp", # "shapes.cpp", # "sharedcorners.cpp", # "showmiplevels.cpp", # "simpleaaclip.cpp", # "simplerect.cpp", # "skbug_12212.cpp", # "skbug1719.cpp", # "skbug_257.cpp", # "skbug_4868.cpp", # "skbug_5321.cpp", # "skbug_8664.cpp", # "skbug_8955.cpp", # "skbug_9319.cpp", # "skbug_9819.cpp", # "slug.cpp", # "smallarc.cpp", # "smallpaths.cpp", # "spritebitmap.cpp", # "srcmode.cpp", # "srgb.cpp", # "stlouisarch.cpp", # "stringart.cpp", # "strokedlines.cpp", # "strokefill.cpp", # "strokerect_anisotropic.cpp", # "strokerect.cpp", # "strokerects.cpp", # "stroke_rect_shader.cpp", # "strokes.cpp", # "stroketext.cpp", # "subsetshader.cpp", # "surface.cpp", # "swizzle.cpp", # "tablecolorfilter.cpp", # "tallstretchedbitmaps.cpp", # "testgradient.cpp", # "texelsubset.cpp", # "textblobblockreordering.cpp", # "textblobcolortrans.cpp", # "textblob.cpp", # "textblobgeometrychange.cpp", # "textblobmixedsizes.cpp", # "textblobrandomfont.cpp", # "textblobshader.cpp", # "textblobtransforms.cpp", # "textblobuseaftergpufree.cpp", # "texteffects.cpp", # "text_scale_skew.cpp", # "thinconcavepaths.cpp", # "thinrects.cpp", # "thinstrokedrects.cpp", # "tiledscaledbitmap.cpp", # "tileimagefilter.cpp", # "tilemodes_alpha.cpp", # "tilemodes.cpp", # "tilemodes_scaled.cpp", # "tinybitmap.cpp", # "transparency.cpp", # "trickycubicstrokes.cpp", # "typeface.cpp", # "unpremul.cpp", # "userfont.cpp", # "variedtext.cpp", # "verifiers", # "vertices.cpp", # "verylargebitmap.cpp", # "video_decoder.cpp", # "wacky_yuv_formats.cpp", # "widebuttcaps.cpp", # "windowrectangles.cpp", # "workingspace.cpp", # "xfermodeimagefilter.cpp", # "xfermodes2.cpp", # "xfermodes3.cpp", # "xfermodes.cpp", # "ycbcrimage.cpp", # "yuv420_odd_dim.cpp", # "yuvtorgbsubset.cpp", ] GPU_GMS = [ # TODO(lovisolo): Incomplete list. Some commented out files in CPU_GMS probably belong here. # "aarecteffect.cpp", # ./include/core/SkRefCnt.h:41: fatal error: "assert(this->getRefCnt() == 1)" "anisotropic.cpp", # "asyncrescaleandread.cpp", # ./include/core/SkRefCnt.h:41: fatal error: "assert(this->getRefCnt() == 1)" # "attributes.cpp", # ./include/core/SkRefCnt.h:41: fatal error: "assert(this->getRefCnt() == 1)" # "beziereffects.cpp", # ./include/core/SkRefCnt.h:41: fatal error: "assert(this->getRefCnt() == 1)" # "clockwise.cpp", # ./include/core/SkRefCnt.h:41: fatal error: "assert(this->getRefCnt() == 1)" ] COMMON_DEPS = [ "//:core", "//gm", "//src/core:core_priv", "//tools:codec_utils", "//tools:hash_and_encode", "//tools:tool_utils", "//tools/testrunners/common:testrunner", "//tools/testrunners/common/compilation_mode_keys", ] # Sample invocation: # # $ bazel run --config=linux_rbe //gm:cpu_8888_test # # Then inspect the PNG and JSON files produced by the GMs: # # $ unzip -l bazel-testlogs/gm/cpu_8888_test/test.outputs/outputs.zip skia_cc_test( name = "cpu_8888_test", srcs = CPU_GMS + [ "//tools/testrunners/gm:BazelGMTestRunner.cpp", ], args = [ "--surfaceConfig", "8888", ], data = ["//resources"], target_compatible_with = supports_platforms( "@platforms//os:linux", "@platforms//os:windows", "@platforms//os:macos", ), deps = COMMON_DEPS + [ "//tools/testrunners/common/surface_manager:raster", "//tools/testrunners/gm/vias:simple_vias", "//tools/timer", # Required by addarc.cpp and animatedimageblurs.cpp. ], ) skia_cc_test( name = "cpu_8888_via_picture_serialization_test", srcs = CPU_GMS + [ "//tools/testrunners/gm:BazelGMTestRunner.cpp", ], args = [ "--surfaceConfig", "8888", "--via", "picture_serialization", # These tests fail with "Recorded and reference bitmap pixels do not match." "--skip", "analytic_antialias_convex", "arithmode", "arithmode_blender", ], data = ["//resources"], target_compatible_with = supports_platforms( "@platforms//os:linux", "@platforms//os:windows", "@platforms//os:macos", ), deps = COMMON_DEPS + [ "//tools/testrunners/common/surface_manager:raster", "//tools/testrunners/gm/vias:simple_vias", "//tools/timer", # Required by addarc.cpp and animatedimageblurs.cpp. ], ) skia_cc_test( name = "cpu_8888_via_picture_test", srcs = CPU_GMS + [ "//tools/testrunners/gm:BazelGMTestRunner.cpp", ], args = [ "--surfaceConfig", "8888", "--via", "picture", ], data = ["//resources"], target_compatible_with = supports_platforms( "@platforms//os:linux", "@platforms//os:windows", "@platforms//os:macos", ), deps = COMMON_DEPS + [ "//tools/testrunners/common/surface_manager:raster", "//tools/testrunners/gm/vias:simple_vias", "//tools/timer", # Required by addarc.cpp and animatedimageblurs.cpp. ], ) png_codec_tests(name = "png_codec_tests") test_suite( name = "cpu_gm_tests", tests = [ "cpu_8888_test", "cpu_8888_via_picture_serialization_test", "cpu_8888_via_picture_test", ":png_codec_tests", ], ) skia_cc_test( name = "ganesh_gles_test", srcs = GPU_GMS + [ "//tools/testrunners/gm:BazelGMTestRunner.cpp", ], args = [ "--surfaceConfig", "gles", ], data = ["//resources"], target_compatible_with = supports_platforms( "@platforms//os:linux", "@platforms//os:windows", "@platforms//os:macos", ), deps = COMMON_DEPS + [ "//tools/testrunners/common/surface_manager:ganesh_gl", "//tools/testrunners/gm/vias:simple_vias", ], ) # Vulkan GMs. [ skia_cc_test( name = name, srcs = GPU_GMS + [ "//tools/testrunners/gm:BazelGMTestRunner.cpp", ], args = [ "--surfaceConfig", surfaceConfig, ], data = ["//resources"], target_compatible_with = supports_platforms( "@platforms//os:linux", "@platforms//os:windows", "@platforms//os:macos", ), deps = COMMON_DEPS + [ "//tools/testrunners/common/surface_manager:ganesh_vulkan", "//tools/testrunners/gm/vias:simple_vias", ], ) for name, surfaceConfig in [ [ "ganesh_vk_test", "vk", ], [ "ganesh_vk_1010102_test", "vk_1010102", ], [ "ganesh_vk_msaa4_test", "vk_msaa4", ], [ "ganesh_vk_msaa8_test", "vk_msaa8", ], [ "ganesh_vk_dmsaa_test", "vk_dmsaa", ], [ "ganesh_vk_betex_test", "vk_betex", ], [ "ganesh_vk_bert_test", "vk_bert", ], ] ] skia_cc_test( name = "hello_bazel_world_test", srcs = [ "hello_bazel_world.cpp", "//tools/testrunners/gm:BazelGMTestRunner.cpp", ], args = [ "--surfaceConfig", "8888", ], data = ["//resources"], target_compatible_with = supports_platforms( "@platforms//os:linux", "@platforms//os:windows", "@platforms//os:macos", ), deps = COMMON_DEPS + [ "//tools/testrunners/common/surface_manager:raster", "//tools/testrunners/gm/vias:simple_vias", ], ) android_gm_test( name = "hello_bazel_world_android_test", srcs = [ "hello_bazel_world.cpp", "//tools/testrunners/gm:BazelGMTestRunner.cpp", ], args = [ "--surfaceConfig", "8888", ], requires_resources_dir = True, deps = COMMON_DEPS + [ "//tools/testrunners/common/surface_manager:raster", "//tools/testrunners/gm/vias:simple_vias", ], ) [ # Sample invocation (assuming there's a Pixel 5 or similar device available via adb): # # $ bazel test --config=android_rbe --config=Pixel5 //gm:cpu_8888_android_test # # Then inspect the PNG and JSON files produced by the GMs: # # $ unzip -l bazel-testlogs/gm/cpu_8888_android_test/test.outputs/outputs.zip android_gm_test( name = "cpu_%s_android_test" % surface_config, srcs = CPU_GMS + [ "//tools/testrunners/gm:BazelGMTestRunner.cpp", ], args = [ "--surfaceConfig", "8888", ], requires_resources_dir = True, deps = COMMON_DEPS + [ "//tools/testrunners/common/surface_manager:raster", "//tools/testrunners/gm/vias:simple_vias", "//tools/timer", # Required by addarc.cpp and animatedimageblurs.cpp. ], ) for surface_config in [ "8888", "565", ] ] android_gm_test( name = "ganesh_gles_android_test", srcs = GPU_GMS + [ "//tools/testrunners/gm:BazelGMTestRunner.cpp", ], args = [ "--surfaceConfig", "gles", ], requires_resources_dir = True, deps = COMMON_DEPS + [ "//tools/testrunners/common/surface_manager:ganesh_gl", "//tools/testrunners/gm/vias:simple_vias", ], ) android_gm_test( name = "ganesh_gles_via_picture_serialization_android_test", srcs = GPU_GMS + [ "//tools/testrunners/gm:BazelGMTestRunner.cpp", ], args = [ "--surfaceConfig", "gles", "--via", "picture_serialization", "--skip", "anisomips", # Fails with "Recorded and reference bitmap pixels do not match". ], requires_resources_dir = True, deps = COMMON_DEPS + [ "//tools/testrunners/common/surface_manager:ganesh_gl", "//tools/testrunners/gm/vias:simple_vias", ], ) android_gm_test( name = "ganesh_gles_via_picture_android_test", srcs = GPU_GMS + [ "//tools/testrunners/gm:BazelGMTestRunner.cpp", ], args = [ "--surfaceConfig", "gles", "--via", "picture", "--skip", "anisomips", # Fails with "Recorded and reference bitmap pixels do not match". ], requires_resources_dir = True, deps = COMMON_DEPS + [ "//tools/testrunners/common/surface_manager:ganesh_gl", "//tools/testrunners/gm/vias:simple_vias", ], ) android_gm_test( name = "ganesh_vk_android_test", srcs = GPU_GMS + [ "//tools/testrunners/gm:BazelGMTestRunner.cpp", ], args = [ "--surfaceConfig", "vk", ], requires_resources_dir = True, deps = COMMON_DEPS + [ "//tools/testrunners/common/surface_manager:ganesh_vulkan", "//tools/testrunners/gm/vias:simple_vias", ], )