summaryrefslogtreecommitdiff
path: root/chromium/third_party/skia
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/skia')
-rw-r--r--chromium/third_party/skia/.bazelrc110
-rw-r--r--chromium/third_party/skia/.bazelversion2
-rw-r--r--chromium/third_party/skia/.clang-format3
-rw-r--r--chromium/third_party/skia/.gn1
-rw-r--r--chromium/third_party/skia/BUILD.bazel17
-rw-r--r--chromium/third_party/skia/BUILD.gn116
-rw-r--r--chromium/third_party/skia/DEPS34
-rw-r--r--chromium/third_party/skia/PRESUBMIT.py33
-rw-r--r--chromium/third_party/skia/RELEASE_NOTES.txt28
-rw-r--r--chromium/third_party/skia/WORKSPACE.bazel102
-rw-r--r--chromium/third_party/skia/bazel/BUILD.bazel82
-rw-r--r--chromium/third_party/skia/bazel/Makefile84
-rw-r--r--chromium/third_party/skia/bazel/buildrc73
-rw-r--r--chromium/third_party/skia/bazel/cc_binary_with_flags.bzl37
-rw-r--r--chromium/third_party/skia/bazel/common_config_settings/BUILD.bazel132
-rw-r--r--chromium/third_party/skia/bazel/common_config_settings/defs.bzl1
-rw-r--r--chromium/third_party/skia/bazel/copts.bzl149
-rw-r--r--chromium/third_party/skia/bazel/defines.bzl9
-rw-r--r--chromium/third_party/skia/bazel/exporter/BUILD.bazel49
-rw-r--r--chromium/third_party/skia/bazel/exporter/bazel_query_command.go107
-rw-r--r--chromium/third_party/skia/bazel/exporter/bazel_util.go169
-rw-r--r--chromium/third_party/skia/bazel/exporter/bazel_util_test.go158
-rw-r--r--chromium/third_party/skia/bazel/exporter/build_proto/README.md28
-rw-r--r--chromium/third_party/skia/bazel/exporter/build_proto/analysis_v2/BUILD.bazel18
-rw-r--r--chromium/third_party/skia/bazel/exporter/build_proto/analysis_v2/analysis_v2.pb.go1488
-rw-r--r--chromium/third_party/skia/bazel/exporter/build_proto/build/BUILD.bazel17
-rw-r--r--chromium/third_party/skia/bazel/exporter/build_proto/build/build.pb.go3493
-rw-r--r--chromium/third_party/skia/bazel/exporter/cmake_exporter.go454
-rw-r--r--chromium/third_party/skia/bazel/exporter/cmake_exporter_test.go263
-rw-r--r--chromium/third_party/skia/bazel/exporter/cmake_rule.go73
-rw-r--r--chromium/third_party/skia/bazel/exporter/cmake_rule_test.go224
-rw-r--r--chromium/third_party/skia/bazel/exporter/cmake_workspace.go110
-rw-r--r--chromium/third_party/skia/bazel/exporter/cmake_workspace_test.go231
-rw-r--r--chromium/third_party/skia/bazel/exporter/interfaces/BUILD.bazel16
-rw-r--r--chromium/third_party/skia/bazel/exporter/interfaces/exporter.go23
-rw-r--r--chromium/third_party/skia/bazel/exporter/interfaces/mocks/BUILD.bazel17
-rw-r--r--chromium/third_party/skia/bazel/exporter/interfaces/mocks/QueryCommand.go46
-rw-r--r--chromium/third_party/skia/bazel/exporter/interfaces/mocks/generate.go8
-rw-r--r--chromium/third_party/skia/bazel/exporter/interfaces/query_command.go13
-rw-r--r--chromium/third_party/skia/bazel/exporter_tool/BUILD.bazel24
-rw-r--r--chromium/third_party/skia/bazel/exporter_tool/README.md25
-rw-r--r--chromium/third_party/skia/bazel/exporter_tool/main.go47
-rw-r--r--chromium/third_party/skia/bazel/external/README.md28
-rw-r--r--chromium/third_party/skia/bazel/external/dawn/BUILD.bazel100
-rw-r--r--chromium/third_party/skia/bazel/external/dng_sdk/BUILD.bazel2
-rw-r--r--chromium/third_party/skia/bazel/external/expat/BUILD.bazel67
-rw-r--r--chromium/third_party/skia/bazel/external/fontconfig/BUILD.bazel10
-rw-r--r--chromium/third_party/skia/bazel/external/freetype/BUILD.bazel446
-rw-r--r--chromium/third_party/skia/bazel/external/freetype/config/BUILD.bazel9
-rw-r--r--chromium/third_party/skia/bazel/external/freetype/config/README.md3
-rw-r--r--chromium/third_party/skia/bazel/external/freetype/config/WORKSPACE.bazel3
-rw-r--r--chromium/third_party/skia/bazel/external/harfbuzz/BUILD.bazel338
-rw-r--r--chromium/third_party/skia/bazel/external/harfbuzz/config/BUILD.bazel6
-rw-r--r--chromium/third_party/skia/bazel/external/harfbuzz/config/README.md3
-rw-r--r--chromium/third_party/skia/bazel/external/harfbuzz/config/WORKSPACE.bazel3
l---------chromium/third_party/skia/bazel/external/harfbuzz/config/config-override.h1
-rw-r--r--chromium/third_party/skia/bazel/external/icu/BUILD.bazel1052
-rw-r--r--chromium/third_party/skia/bazel/external/icu/utils/BUILD.bazel8
-rw-r--r--chromium/third_party/skia/bazel/external/icu/utils/WORKSPACE (renamed from chromium/third_party/skia/src/sksl/generated/fake.output)0
-rw-r--r--chromium/third_party/skia/bazel/external/libavif/BUILD.bazel37
-rw-r--r--chromium/third_party/skia/bazel/external/libgav1/BUILD.bazel282
-rw-r--r--chromium/third_party/skia/bazel/external/libjpeg_turbo/BUILD.bazel70
-rw-r--r--chromium/third_party/skia/bazel/external/libpng/BUILD.bazel2
-rw-r--r--chromium/third_party/skia/bazel/external/libwebp/BUILD.bazel14
-rw-r--r--chromium/third_party/skia/bazel/external/libyuv/BUILD.bazel96
-rw-r--r--chromium/third_party/skia/bazel/external/perfetto/BUILD.bazel13
-rw-r--r--chromium/third_party/skia/bazel/external/spirv_cross/BUILD.bazel39
-rw-r--r--chromium/third_party/skia/bazel/external/wuffs/BUILD.bazel2
-rw-r--r--chromium/third_party/skia/bazel/external/zlib/BUILD.bazel27
-rw-r--r--chromium/third_party/skia/bazel/karma_test.bzl42
-rw-r--r--chromium/third_party/skia/bazel/linkopts.bzl25
-rw-r--r--chromium/third_party/skia/bazel/macros.bzl121
-rw-r--r--chromium/third_party/skia/bazel/platform/BUILD.bazel48
-rw-r--r--chromium/third_party/skia/bazel/rbe/BUILD.bazel12
-rw-r--r--chromium/third_party/skia/bench/AlternatingColorPatternBench.cpp4
-rw-r--r--chromium/third_party/skia/bench/BulkRectBench.cpp5
-rw-r--r--chromium/third_party/skia/bench/ClearBench.cpp2
-rw-r--r--chromium/third_party/skia/bench/ColorPrivBench.cpp2
-rw-r--r--chromium/third_party/skia/bench/ControlBench.cpp2
-rw-r--r--chromium/third_party/skia/bench/DashBench.cpp6
-rw-r--r--chromium/third_party/skia/bench/FontCacheBench.cpp8
-rw-r--r--chromium/third_party/skia/bench/GeometryBench.cpp10
-rw-r--r--chromium/third_party/skia/bench/GlyphQuadFillBench.cpp2
-rw-r--r--chromium/third_party/skia/bench/GradientBench.cpp2
-rw-r--r--chromium/third_party/skia/bench/HairlinePathBench.cpp8
-rw-r--r--chromium/third_party/skia/bench/ImageFilterCollapse.cpp6
-rw-r--r--chromium/third_party/skia/bench/MatrixBench.cpp4
-rw-r--r--chromium/third_party/skia/bench/PDFBench.cpp4
-rw-r--r--chromium/third_party/skia/bench/PatchBench.cpp2
-rw-r--r--chromium/third_party/skia/bench/RectBench.cpp4
-rw-r--r--chromium/third_party/skia/bench/ScalarBench.cpp4
-rw-r--r--chromium/third_party/skia/bench/Sk4fBench.cpp2
-rw-r--r--chromium/third_party/skia/bench/SkSLBench.cpp3
-rw-r--r--chromium/third_party/skia/bench/TessellateBench.cpp4
-rw-r--r--chromium/third_party/skia/bench/TopoSortBench.cpp4
-rw-r--r--chromium/third_party/skia/bench/TriangulatorBench.cpp2
-rw-r--r--chromium/third_party/skia/bench/TypefaceBench.cpp12
-rw-r--r--chromium/third_party/skia/bench/VertexColorSpaceBench.cpp5
-rw-r--r--chromium/third_party/skia/bench/graphite/BoundsManagerBench.cpp181
-rw-r--r--chromium/third_party/skia/bench/nanobench.cpp28
-rwxr-xr-xchromium/third_party/skia/bin/activate-emsdk10
-rw-r--r--chromium/third_party/skia/build/fuchsia/skqp/BUILD.gn131
-rw-r--r--chromium/third_party/skia/build/fuchsia/skqp/README.md35
-rwxr-xr-xchromium/third_party/skia/build/fuchsia/skqp/append_assets_to_manifest73
-rw-r--r--chromium/third_party/skia/build/fuchsia/skqp/cipd_arm64.yaml7
-rw-r--r--chromium/third_party/skia/build/fuchsia/skqp/skqp.cmx21
-rw-r--r--chromium/third_party/skia/build/fuchsia/skqp/test_manifest.json6
-rw-r--r--chromium/third_party/skia/build_overrides/angle.gni1
-rw-r--r--chromium/third_party/skia/build_overrides/tint.gni2
-rw-r--r--chromium/third_party/skia/demos.skia.org/demos/image_sampling/index.html4
-rw-r--r--chromium/third_party/skia/demos.skia.org/demos/sampling_types/index.html8
-rw-r--r--chromium/third_party/skia/demos.skia.org/demos/textedit/index.html4
-rw-r--r--chromium/third_party/skia/demos.skia.org/demos/textures/index.html6
-rw-r--r--chromium/third_party/skia/demos.skia.org/demos/up_scaling/index.html4
-rw-r--r--chromium/third_party/skia/dm/DM.cpp5
-rw-r--r--chromium/third_party/skia/dm/DMJsonWriter.cpp26
-rw-r--r--chromium/third_party/skia/dm/DMSrcSink.cpp12
-rw-r--r--chromium/third_party/skia/docker/skia-release/Dockerfile3
-rw-r--r--chromium/third_party/skia/example/BUILD.bazel7
-rw-r--r--chromium/third_party/skia/experimental/bazel_test/BUILD.bazel26
-rw-r--r--chromium/third_party/skia/experimental/bazel_test/bazel_test.cpp7
-rw-r--r--chromium/third_party/skia/experimental/bazel_test/print_os.py23
-rw-r--r--chromium/third_party/skia/experimental/c-api-example/c.md133
-rw-r--r--chromium/third_party/skia/experimental/c-api-example/skia-c-example.c84
-rw-r--r--chromium/third_party/skia/experimental/sktext/include/Text.h12
-rw-r--r--chromium/third_party/skia/experimental/sktext/include/Types.h10
-rw-r--r--chromium/third_party/skia/experimental/sktext/samples/Text.cpp1
-rw-r--r--chromium/third_party/skia/experimental/sktext/src/Text.cpp45
-rw-r--r--chromium/third_party/skia/gm/aaclip.cpp2
-rw-r--r--chromium/third_party/skia/gm/aarecteffect.cpp2
-rw-r--r--chromium/third_party/skia/gm/aarectmodes.cpp2
-rw-r--r--chromium/third_party/skia/gm/aaxfermodes.cpp2
-rw-r--r--chromium/third_party/skia/gm/addarc.cpp14
-rw-r--r--chromium/third_party/skia/gm/alpha_image.cpp39
-rw-r--r--chromium/third_party/skia/gm/alphagradients.cpp2
-rw-r--r--chromium/third_party/skia/gm/analytic_gradients.cpp2
-rw-r--r--chromium/third_party/skia/gm/anisotropic.cpp16
-rw-r--r--chromium/third_party/skia/gm/arcto.cpp2
-rw-r--r--chromium/third_party/skia/gm/arithmode.cpp6
-rw-r--r--chromium/third_party/skia/gm/asyncrescaleandread.cpp2
-rw-r--r--chromium/third_party/skia/gm/attributes.cpp2
-rw-r--r--chromium/third_party/skia/gm/backdrop.cpp2
-rw-r--r--chromium/third_party/skia/gm/beziereffects.cpp2
-rw-r--r--chromium/third_party/skia/gm/bigblurs.cpp2
-rw-r--r--chromium/third_party/skia/gm/bigrrectaaeffect.cpp4
-rw-r--r--chromium/third_party/skia/gm/bitmapcopy.cpp2
-rw-r--r--chromium/third_party/skia/gm/bitmapfilters.cpp2
-rw-r--r--chromium/third_party/skia/gm/bitmaprect.cpp2
-rw-r--r--chromium/third_party/skia/gm/bleed.cpp2
-rw-r--r--chromium/third_party/skia/gm/blurcircles.cpp2
-rw-r--r--chromium/third_party/skia/gm/blurquickreject.cpp4
-rw-r--r--chromium/third_party/skia/gm/blurrect.cpp28
-rw-r--r--chromium/third_party/skia/gm/blurroundrect.cpp6
-rw-r--r--chromium/third_party/skia/gm/blurs.cpp2
-rw-r--r--chromium/third_party/skia/gm/bug530095.cpp6
-rw-r--r--chromium/third_party/skia/gm/bug6643.cpp2
-rw-r--r--chromium/third_party/skia/gm/bug9331.cpp2
-rw-r--r--chromium/third_party/skia/gm/cgm.c82
-rw-r--r--chromium/third_party/skia/gm/cgms.cpp17
-rw-r--r--chromium/third_party/skia/gm/circulararcs.cpp2
-rw-r--r--chromium/third_party/skia/gm/circularclips.cpp2
-rw-r--r--chromium/third_party/skia/gm/clockwise.cpp6
-rw-r--r--chromium/third_party/skia/gm/color4f.cpp37
-rw-r--r--chromium/third_party/skia/gm/coloremoji.cpp2
-rw-r--r--chromium/third_party/skia/gm/coloremoji_blendmodes.cpp4
-rw-r--r--chromium/third_party/skia/gm/colorfilters.cpp6
-rw-r--r--chromium/third_party/skia/gm/colormatrix.cpp2
-rw-r--r--chromium/third_party/skia/gm/colorspace.cpp4
-rw-r--r--chromium/third_party/skia/gm/colrv1.cpp349
-rw-r--r--chromium/third_party/skia/gm/complexclip.cpp4
-rw-r--r--chromium/third_party/skia/gm/complexclip2.cpp2
-rw-r--r--chromium/third_party/skia/gm/complexclip3.cpp2
-rw-r--r--chromium/third_party/skia/gm/composecolorfilter.cpp6
-rw-r--r--chromium/third_party/skia/gm/composeshader.cpp6
-rw-r--r--chromium/third_party/skia/gm/concavepaths.cpp4
-rw-r--r--chromium/third_party/skia/gm/conicpaths.cpp2
-rw-r--r--chromium/third_party/skia/gm/constcolorprocessor.cpp15
-rw-r--r--chromium/third_party/skia/gm/convex_all_line_paths.cpp30
-rw-r--r--chromium/third_party/skia/gm/convexpolyclip.cpp10
-rw-r--r--chromium/third_party/skia/gm/convexpolyeffect.cpp2
-rw-r--r--chromium/third_party/skia/gm/crosscontextimage.cpp2
-rw-r--r--chromium/third_party/skia/gm/cubicpaths.cpp16
-rw-r--r--chromium/third_party/skia/gm/daa.cpp4
-rw-r--r--chromium/third_party/skia/gm/dashcircle.cpp16
-rw-r--r--chromium/third_party/skia/gm/dashing.cpp18
-rw-r--r--chromium/third_party/skia/gm/degeneratesegments.cpp8
-rw-r--r--chromium/third_party/skia/gm/destcolor.cpp2
-rw-r--r--chromium/third_party/skia/gm/dftext.cpp12
-rw-r--r--chromium/third_party/skia/gm/drawatlas.cpp4
-rw-r--r--chromium/third_party/skia/gm/drawatlascolor.cpp4
-rw-r--r--chromium/third_party/skia/gm/drawbitmaprect.cpp2
-rw-r--r--chromium/third_party/skia/gm/drawglyphs.cpp2
-rw-r--r--chromium/third_party/skia/gm/drawimageset.cpp6
-rw-r--r--chromium/third_party/skia/gm/drawminibitmaprect.cpp4
-rw-r--r--chromium/third_party/skia/gm/drawquadset.cpp16
-rw-r--r--chromium/third_party/skia/gm/dropshadowimagefilter.cpp4
-rw-r--r--chromium/third_party/skia/gm/drrect.cpp4
-rw-r--r--chromium/third_party/skia/gm/emptypath.cpp4
-rw-r--r--chromium/third_party/skia/gm/encode_platform.cpp2
-rw-r--r--chromium/third_party/skia/gm/filltypespersp.cpp4
-rw-r--r--chromium/third_party/skia/gm/filterfastbounds.cpp8
-rw-r--r--chromium/third_party/skia/gm/filterindiabox.cpp2
-rw-r--r--chromium/third_party/skia/gm/fontmgr.cpp2
-rw-r--r--chromium/third_party/skia/gm/fontscalerdistortable.cpp59
-rw-r--r--chromium/third_party/skia/gm/fp_sample_chaining.cpp5
-rw-r--r--chromium/third_party/skia/gm/fpcoordinateoverride.cpp3
-rw-r--r--chromium/third_party/skia/gm/fwidth_squircle.cpp2
-rw-r--r--chromium/third_party/skia/gm/gammatext.cpp12
-rw-r--r--chromium/third_party/skia/gm/gpu_blur_utils.cpp2
-rw-r--r--chromium/third_party/skia/gm/gradient_dirty_laundry.cpp4
-rw-r--r--chromium/third_party/skia/gm/gradient_matrix.cpp8
-rw-r--r--chromium/third_party/skia/gm/gradients.cpp66
-rw-r--r--chromium/third_party/skia/gm/gradients_2pt_conical.cpp8
-rw-r--r--chromium/third_party/skia/gm/gradients_degenerate.cpp4
-rw-r--r--chromium/third_party/skia/gm/gradients_no_texture.cpp16
-rw-r--r--chromium/third_party/skia/gm/gradtext.cpp4
-rw-r--r--chromium/third_party/skia/gm/graphitestart.cpp145
-rw-r--r--chromium/third_party/skia/gm/hairlines.cpp4
-rw-r--r--chromium/third_party/skia/gm/hairmodes.cpp2
-rw-r--r--chromium/third_party/skia/gm/highcontrastfilter.cpp10
-rw-r--r--chromium/third_party/skia/gm/hittestpath.cpp2
-rw-r--r--chromium/third_party/skia/gm/hsl.cpp2
-rw-r--r--chromium/third_party/skia/gm/image_pict.cpp8
-rw-r--r--chromium/third_party/skia/gm/image_shader.cpp2
-rw-r--r--chromium/third_party/skia/gm/imageblur2.cpp4
-rw-r--r--chromium/third_party/skia/gm/imageblurtiled.cpp2
-rw-r--r--chromium/third_party/skia/gm/imagefilters.cpp4
-rw-r--r--chromium/third_party/skia/gm/imagefiltersbase.cpp4
-rw-r--r--chromium/third_party/skia/gm/imagefiltersclipped.cpp4
-rw-r--r--chromium/third_party/skia/gm/imagefilterscropped.cpp4
-rw-r--r--chromium/third_party/skia/gm/imagefiltersscaled.cpp4
-rw-r--r--chromium/third_party/skia/gm/imagefiltersstroked.cpp4
-rw-r--r--chromium/third_party/skia/gm/imagefilterstransformed.cpp2
-rw-r--r--chromium/third_party/skia/gm/imagemakewithfilter.cpp8
-rw-r--r--chromium/third_party/skia/gm/imagemasksubset.cpp2
-rw-r--r--chromium/third_party/skia/gm/imageresizetiled.cpp2
-rw-r--r--chromium/third_party/skia/gm/imagescalealigned.cpp10
-rw-r--r--chromium/third_party/skia/gm/imagesource2.cpp2
-rw-r--r--chromium/third_party/skia/gm/inversepaths.cpp10
-rw-r--r--chromium/third_party/skia/gm/labyrinth.cpp8
-rw-r--r--chromium/third_party/skia/gm/lazytiling.cpp2
-rw-r--r--chromium/third_party/skia/gm/lcdblendmodes.cpp4
-rw-r--r--chromium/third_party/skia/gm/lcdoverlap.cpp4
-rw-r--r--chromium/third_party/skia/gm/lcdtext.cpp2
-rw-r--r--chromium/third_party/skia/gm/linepaths.cpp8
-rw-r--r--chromium/third_party/skia/gm/localmatrixshader.cpp2
-rw-r--r--chromium/third_party/skia/gm/lumafilter.cpp10
-rw-r--r--chromium/third_party/skia/gm/mac_aa_explorer.cpp2
-rw-r--r--chromium/third_party/skia/gm/mesh.cpp275
-rw-r--r--chromium/third_party/skia/gm/mipmap.cpp2
-rw-r--r--chromium/third_party/skia/gm/mixercolorfilter.cpp4
-rw-r--r--chromium/third_party/skia/gm/modecolorfilters.cpp8
-rw-r--r--chromium/third_party/skia/gm/morphology.cpp2
-rw-r--r--chromium/third_party/skia/gm/nested.cpp2
-rw-r--r--chromium/third_party/skia/gm/nonclosedpaths.cpp8
-rw-r--r--chromium/third_party/skia/gm/ovals.cpp2
-rw-r--r--chromium/third_party/skia/gm/p3.cpp10
-rw-r--r--chromium/third_party/skia/gm/palette.cpp43
-rw-r--r--chromium/third_party/skia/gm/patch.cpp2
-rw-r--r--chromium/third_party/skia/gm/path_stroke_with_zero_length.cpp6
-rw-r--r--chromium/third_party/skia/gm/patharcto.cpp4
-rw-r--r--chromium/third_party/skia/gm/patheffects.cpp12
-rw-r--r--chromium/third_party/skia/gm/pathfill.cpp2
-rw-r--r--chromium/third_party/skia/gm/pathmeasure.cpp2
-rw-r--r--chromium/third_party/skia/gm/perspshaders.cpp4
-rw-r--r--chromium/third_party/skia/gm/pictureimagegenerator.cpp10
-rw-r--r--chromium/third_party/skia/gm/pictureshader.cpp2
-rw-r--r--chromium/third_party/skia/gm/pictureshadercache.cpp2
-rw-r--r--chromium/third_party/skia/gm/pictureshadertile.cpp6
-rw-r--r--chromium/third_party/skia/gm/pixelsnap.cpp4
-rw-r--r--chromium/third_party/skia/gm/polygonoffset.cpp72
-rw-r--r--chromium/third_party/skia/gm/polygons.cpp30
-rw-r--r--chromium/third_party/skia/gm/preservefillrule.cpp2
-rw-r--r--chromium/third_party/skia/gm/quadpaths.cpp16
-rw-r--r--chromium/third_party/skia/gm/radial_gradient_precision.cpp2
-rw-r--r--chromium/third_party/skia/gm/rasterhandleallocator.cpp2
-rw-r--r--chromium/third_party/skia/gm/readpixels.cpp2
-rw-r--r--chromium/third_party/skia/gm/recordopts.cpp8
-rw-r--r--chromium/third_party/skia/gm/roundrects.cpp2
-rw-r--r--chromium/third_party/skia/gm/rrect.cpp4
-rw-r--r--chromium/third_party/skia/gm/rrects.cpp4
-rw-r--r--chromium/third_party/skia/gm/rsxtext.cpp2
-rw-r--r--chromium/third_party/skia/gm/runtimecolorfilter.cpp2
-rw-r--r--chromium/third_party/skia/gm/runtimeimagefilter.cpp6
-rw-r--r--chromium/third_party/skia/gm/runtimeshader.cpp51
-rw-r--r--chromium/third_party/skia/gm/savelayer.cpp2
-rw-r--r--chromium/third_party/skia/gm/scaledemoji_rendering.cpp4
-rw-r--r--chromium/third_party/skia/gm/shadertext3.cpp8
-rw-r--r--chromium/third_party/skia/gm/shadowutils.cpp2
-rw-r--r--chromium/third_party/skia/gm/shallowgradient.cpp2
-rw-r--r--chromium/third_party/skia/gm/sharedcorners.cpp2
-rw-r--r--chromium/third_party/skia/gm/showmiplevels.cpp2
-rw-r--r--chromium/third_party/skia/gm/simpleaaclip.cpp2
-rw-r--r--chromium/third_party/skia/gm/smallpaths.cpp8
-rw-r--r--chromium/third_party/skia/gm/srcmode.cpp10
-rw-r--r--chromium/third_party/skia/gm/strokedlines.cpp2
-rw-r--r--chromium/third_party/skia/gm/strokefill.cpp2
-rw-r--r--chromium/third_party/skia/gm/strokerect.cpp4
-rw-r--r--chromium/third_party/skia/gm/strokes.cpp4
-rw-r--r--chromium/third_party/skia/gm/stroketext.cpp4
-rw-r--r--chromium/third_party/skia/gm/swizzle.cpp3
-rw-r--r--chromium/third_party/skia/gm/tablecolorfilter.cpp12
-rw-r--r--chromium/third_party/skia/gm/tallstretchedbitmaps.cpp4
-rw-r--r--chromium/third_party/skia/gm/texelsubset.cpp8
-rw-r--r--chromium/third_party/skia/gm/textblob.cpp6
-rw-r--r--chromium/third_party/skia/gm/textblobcolortrans.cpp2
-rw-r--r--chromium/third_party/skia/gm/textblobshader.cpp8
-rw-r--r--chromium/third_party/skia/gm/texteffects.cpp2
-rw-r--r--chromium/third_party/skia/gm/thinrects.cpp6
-rw-r--r--chromium/third_party/skia/gm/thinstrokedrects.cpp4
-rw-r--r--chromium/third_party/skia/gm/tilemodes.cpp34
-rw-r--r--chromium/third_party/skia/gm/tilemodes_scaled.cpp30
-rw-r--r--chromium/third_party/skia/gm/transparency.cpp4
-rw-r--r--chromium/third_party/skia/gm/trickycubicstrokes.cpp2
-rw-r--r--chromium/third_party/skia/gm/typeface.cpp2
-rw-r--r--chromium/third_party/skia/gm/userfont.cpp23
-rw-r--r--chromium/third_party/skia/gm/variedtext.cpp4
-rw-r--r--chromium/third_party/skia/gm/vertices.cpp4
-rw-r--r--chromium/third_party/skia/gm/wacky_yuv_formats.cpp6
-rw-r--r--chromium/third_party/skia/gm/xfermodeimagefilter.cpp2
-rw-r--r--chromium/third_party/skia/gm/xfermodes.cpp2
-rw-r--r--chromium/third_party/skia/gm/xfermodes2.cpp12
-rw-r--r--chromium/third_party/skia/gm/xfermodes3.cpp8
-rw-r--r--chromium/third_party/skia/gm/yuvtorgbsubset.cpp8
-rw-r--r--chromium/third_party/skia/gn/bench.gni5
-rw-r--r--chromium/third_party/skia/gn/core.gni47
-rwxr-xr-x[-rw-r--r--]chromium/third_party/skia/gn/dehydrate_sksl.py22
-rw-r--r--chromium/third_party/skia/gn/effects.gni7
-rw-r--r--chromium/third_party/skia/gn/flutter_defines.gni5
-rw-r--r--chromium/third_party/skia/gn/gm.gni2
-rwxr-xr-xchromium/third_party/skia/gn/gn_to_bp.py23
-rw-r--r--chromium/third_party/skia/gn/gpu.gni49
-rw-r--r--chromium/third_party/skia/gn/graphite.gni41
-rw-r--r--chromium/third_party/skia/gn/skia.gni6
-rw-r--r--chromium/third_party/skia/gn/skia/BUILD.gn2
-rw-r--r--chromium/third_party/skia/gn/sksl.gni64
-rw-r--r--chromium/third_party/skia/gn/sksl_tests.gni81
-rw-r--r--chromium/third_party/skia/gn/tests.gni17
-rw-r--r--chromium/third_party/skia/gn/utils.gni5
-rw-r--r--chromium/third_party/skia/gn/xps.gni4
-rw-r--r--chromium/third_party/skia/go.mod1
-rw-r--r--chromium/third_party/skia/go_repositories.bzl6
-rw-r--r--chromium/third_party/skia/include/BUILD.bazel9
-rw-r--r--chromium/third_party/skia/include/c/BUILD.bazel5
-rw-r--r--chromium/third_party/skia/include/c/sk_canvas.h159
-rw-r--r--chromium/third_party/skia/include/c/sk_colorspace.h25
-rw-r--r--chromium/third_party/skia/include/c/sk_data.h65
-rw-r--r--chromium/third_party/skia/include/c/sk_image.h71
-rw-r--r--chromium/third_party/skia/include/c/sk_imageinfo.h62
-rw-r--r--chromium/third_party/skia/include/c/sk_maskfilter.h47
-rw-r--r--chromium/third_party/skia/include/c/sk_matrix.h49
-rw-r--r--chromium/third_party/skia/include/c/sk_paint.h145
-rw-r--r--chromium/third_party/skia/include/c/sk_path.h102
-rw-r--r--chromium/third_party/skia/include/c/sk_picture.h70
-rw-r--r--chromium/third_party/skia/include/c/sk_shader.h143
-rw-r--r--chromium/third_party/skia/include/c/sk_surface.h73
-rw-r--r--chromium/third_party/skia/include/c/sk_types.h278
-rw-r--r--chromium/third_party/skia/include/codec/SkAndroidCodec.h18
-rw-r--r--chromium/third_party/skia/include/codec/SkCodec.h13
-rw-r--r--chromium/third_party/skia/include/core/BUILD.bazel24
-rw-r--r--chromium/third_party/skia/include/core/SkBitmap.h17
-rw-r--r--chromium/third_party/skia/include/core/SkCanvas.h39
-rw-r--r--chromium/third_party/skia/include/core/SkCapabilities.h8
-rw-r--r--chromium/third_party/skia/include/core/SkColorFilter.h5
-rw-r--r--chromium/third_party/skia/include/core/SkColorSpace.h2
-rw-r--r--chromium/third_party/skia/include/core/SkCombinationBuilder.h14
-rw-r--r--chromium/third_party/skia/include/core/SkGraphics.h9
-rw-r--r--chromium/third_party/skia/include/core/SkImage.h36
-rw-r--r--chromium/third_party/skia/include/core/SkImageEncoder.h8
-rw-r--r--chromium/third_party/skia/include/core/SkM44.h1
-rw-r--r--chromium/third_party/skia/include/core/SkMesh.h83
-rw-r--r--chromium/third_party/skia/include/core/SkMilestone.h2
-rw-r--r--chromium/third_party/skia/include/core/SkOverdrawCanvas.h3
-rw-r--r--chromium/third_party/skia/include/core/SkPaint.h4
-rw-r--r--chromium/third_party/skia/include/core/SkPicture.h3
-rw-r--r--chromium/third_party/skia/include/core/SkPictureRecorder.h2
-rw-r--r--chromium/third_party/skia/include/core/SkPixmap.h19
-rw-r--r--chromium/third_party/skia/include/core/SkRefCnt.h11
-rw-r--r--chromium/third_party/skia/include/core/SkScalar.h6
-rw-r--r--chromium/third_party/skia/include/core/SkSpan.h70
-rw-r--r--chromium/third_party/skia/include/core/SkTextBlob.h7
-rw-r--r--chromium/third_party/skia/include/core/SkTypes.h19
-rw-r--r--chromium/third_party/skia/include/docs/BUILD.bazel8
-rw-r--r--chromium/third_party/skia/include/effects/SkGradientShader.h16
-rw-r--r--chromium/third_party/skia/include/effects/SkImageFilters.h9
-rw-r--r--chromium/third_party/skia/include/effects/SkRuntimeEffect.h58
-rw-r--r--chromium/third_party/skia/include/gpu/BUILD.bazel5
-rw-r--r--chromium/third_party/skia/include/gpu/GrBackendSurface.h31
-rw-r--r--chromium/third_party/skia/include/gpu/GrTypes.h22
-rw-r--r--chromium/third_party/skia/include/gpu/gl/GrGLFunctions.h1
-rw-r--r--chromium/third_party/skia/include/gpu/gl/GrGLInterface.h1
-rw-r--r--chromium/third_party/skia/include/gpu/graphite/Context.h51
-rw-r--r--chromium/third_party/skia/include/gpu/graphite/ContextOptions.h78
-rw-r--r--chromium/third_party/skia/include/gpu/graphite/GraphiteTypes.h2
-rw-r--r--chromium/third_party/skia/include/gpu/graphite/ImageProvider.h54
-rw-r--r--chromium/third_party/skia/include/gpu/graphite/Recorder.h68
-rw-r--r--chromium/third_party/skia/include/gpu/graphite/Recording.h28
-rw-r--r--chromium/third_party/skia/include/private/BUILD.bazel30
-rw-r--r--chromium/third_party/skia/include/private/SkColorData.h4
-rw-r--r--chromium/third_party/skia/include/private/SkEncodedInfo.h12
-rw-r--r--chromium/third_party/skia/include/private/SkMacros.h2
-rw-r--r--chromium/third_party/skia/include/private/SkMalloc.h4
-rw-r--r--chromium/third_party/skia/include/private/SkSLModifiers.h33
-rw-r--r--chromium/third_party/skia/include/private/SkSLProgramKind.h1
-rw-r--r--chromium/third_party/skia/include/private/SkSLSymbol.h1
-rw-r--r--chromium/third_party/skia/include/private/SkTDArray.h2
-rw-r--r--chromium/third_party/skia/include/private/SkVx.h164
-rw-r--r--chromium/third_party/skia/include/private/chromium/SkChromeRemoteGlyphCache.h2
-rw-r--r--chromium/third_party/skia/include/private/gpu/ganesh/BUILD.bazel7
-rw-r--r--chromium/third_party/skia/include/private/gpu/ganesh/GrTypesPriv.h2
-rw-r--r--chromium/third_party/skia/include/sksl/DSLSymbols.h10
-rw-r--r--chromium/third_party/skia/include/sksl/DSLType.h7
-rw-r--r--chromium/third_party/skia/include/sksl/DSLVar.h2
-rw-r--r--chromium/third_party/skia/include/sksl/SkSLPosition.h2
-rw-r--r--chromium/third_party/skia/include/svg/SkSVGCanvas.h1
-rw-r--r--chromium/third_party/skia/include/third_party/skcms/BUILD.bazel10
-rw-r--r--chromium/third_party/skia/include/third_party/skcms/skcms.h387
-rw-r--r--chromium/third_party/skia/include/third_party/vulkan/BUILD.bazel4
-rw-r--r--chromium/third_party/skia/include/utils/SkAnimCodecPlayer.h2
-rw-r--r--chromium/third_party/skia/include/utils/SkBase64.h2
-rw-r--r--chromium/third_party/skia/include/utils/SkCustomTypeface.h35
-rw-r--r--chromium/third_party/skia/include/utils/SkEventTracer.h5
-rw-r--r--chromium/third_party/skia/include/utils/SkNWayCanvas.h9
-rw-r--r--chromium/third_party/skia/include/utils/SkPaintFilterCanvas.h11
-rw-r--r--chromium/third_party/skia/include/utils/SkParse.h3
-rw-r--r--chromium/third_party/skia/include/utils/SkShadowUtils.h2
-rw-r--r--chromium/third_party/skia/include/utils/SkTextUtils.h3
-rw-r--r--chromium/third_party/skia/modules/androidkit/src/Canvas.cpp2
-rw-r--r--chromium/third_party/skia/modules/androidkit/src/ColorFilters.cpp8
-rw-r--r--chromium/third_party/skia/modules/androidkit/src/Font.cpp2
-rw-r--r--chromium/third_party/skia/modules/androidkit/src/FontChainAdapter.cpp2
-rw-r--r--chromium/third_party/skia/modules/androidkit/src/Gradients.cpp8
-rw-r--r--chromium/third_party/skia/modules/androidkit/src/Image.cpp2
-rw-r--r--chromium/third_party/skia/modules/androidkit/src/ImageFilter.cpp2
-rw-r--r--chromium/third_party/skia/modules/androidkit/src/Matrix.cpp2
-rw-r--r--chromium/third_party/skia/modules/androidkit/src/Paint.cpp2
-rw-r--r--chromium/third_party/skia/modules/androidkit/src/Path.cpp2
-rw-r--r--chromium/third_party/skia/modules/androidkit/src/PathBuilder.cpp2
-rw-r--r--chromium/third_party/skia/modules/androidkit/src/RuntimeShaderBuilder.cpp8
-rw-r--r--chromium/third_party/skia/modules/androidkit/src/Shader.cpp2
-rw-r--r--chromium/third_party/skia/modules/androidkit/src/SkottieAnimation.cpp2
-rw-r--r--chromium/third_party/skia/modules/androidkit/src/Surface.cpp2
-rw-r--r--chromium/third_party/skia/modules/androidkit/src/Text.cpp2
-rw-r--r--chromium/third_party/skia/modules/androidkit/src/Utils.h2
-rw-r--r--chromium/third_party/skia/modules/canvaskit/BUILD.bazel98
-rw-r--r--chromium/third_party/skia/modules/canvaskit/BUILD.gn35
-rw-r--r--chromium/third_party/skia/modules/canvaskit/CHANGELOG.md41
-rw-r--r--chromium/third_party/skia/modules/canvaskit/Makefile34
-rw-r--r--chromium/third_party/skia/modules/canvaskit/canvaskit.gni2
-rw-r--r--chromium/third_party/skia/modules/canvaskit/canvaskit_bindings.cpp296
-rwxr-xr-xchromium/third_party/skia/modules/canvaskit/compile.sh15
-rwxr-xr-xchromium/third_party/skia/modules/canvaskit/compile_gm.sh7
-rw-r--r--chromium/third_party/skia/modules/canvaskit/cpu.js7
-rw-r--r--chromium/third_party/skia/modules/canvaskit/debugger_bindings.cpp2
-rw-r--r--chromium/third_party/skia/modules/canvaskit/externs.js23
-rw-r--r--chromium/third_party/skia/modules/canvaskit/gm_bindings.cpp3
-rw-r--r--chromium/third_party/skia/modules/canvaskit/go/gold_test_env/gold_test_env.go16
-rw-r--r--chromium/third_party/skia/modules/canvaskit/interface.js61
-rw-r--r--chromium/third_party/skia/modules/canvaskit/memory.js3
-rw-r--r--chromium/third_party/skia/modules/canvaskit/npm_build/example.html174
-rw-r--r--chromium/third_party/skia/modules/canvaskit/npm_build/package-lock.json3197
-rw-r--r--chromium/third_party/skia/modules/canvaskit/npm_build/package.json8
-rw-r--r--chromium/third_party/skia/modules/canvaskit/npm_build/types/canvaskit-wasm-tests.ts85
-rw-r--r--chromium/third_party/skia/modules/canvaskit/npm_build/types/index.d.ts305
-rw-r--r--chromium/third_party/skia/modules/canvaskit/npm_build/types/tsconfig.json5
-rw-r--r--chromium/third_party/skia/modules/canvaskit/package-lock.json24
-rw-r--r--chromium/third_party/skia/modules/canvaskit/paragraph.js13
-rw-r--r--chromium/third_party/skia/modules/canvaskit/paragraph_bindings.cpp37
-rw-r--r--chromium/third_party/skia/modules/canvaskit/webgl.js (renamed from chromium/third_party/skia/modules/canvaskit/gpu.js)65
-rw-r--r--chromium/third_party/skia/modules/canvaskit/webgpu.js142
-rw-r--r--chromium/third_party/skia/modules/particles/BUILD.bazel6
-rw-r--r--chromium/third_party/skia/modules/particles/include/SkParticleSerialization.h6
-rw-r--r--chromium/third_party/skia/modules/particles/src/SkParticleEffect.cpp5
-rw-r--r--chromium/third_party/skia/modules/skcms/BUILD.bazel23
-rw-r--r--chromium/third_party/skia/modules/skcms/BUILD.gn16
-rw-r--r--chromium/third_party/skia/modules/skcms/OWNERS2
-rw-r--r--chromium/third_party/skia/modules/skcms/README.chromium5
-rw-r--r--chromium/third_party/skia/modules/skcms/skcms.cc3005
-rw-r--r--chromium/third_party/skia/modules/skcms/skcms.gni14
-rw-r--r--chromium/third_party/skia/modules/skcms/skcms.h394
-rw-r--r--chromium/third_party/skia/modules/skcms/skcms_internal.h56
-rw-r--r--chromium/third_party/skia/modules/skcms/src/Transform_inl.h1609
-rwxr-xr-xchromium/third_party/skia/modules/skcms/version.sha11
-rw-r--r--chromium/third_party/skia/modules/skottie/BUILD.bazel61
-rw-r--r--chromium/third_party/skia/modules/skottie/BUILD.gn44
-rw-r--r--chromium/third_party/skia/modules/skottie/gm/ExternalProperties.cpp3
-rw-r--r--chromium/third_party/skia/modules/skottie/gm/SkottieGM.cpp3
-rw-r--r--chromium/third_party/skia/modules/skottie/skottie.gni1
-rw-r--r--chromium/third_party/skia/modules/skottie/src/BUILD.bazel9
-rw-r--r--chromium/third_party/skia/modules/skottie/src/BlendModes.cpp99
-rw-r--r--chromium/third_party/skia/modules/skottie/src/Layer.cpp13
-rw-r--r--chromium/third_party/skia/modules/skottie/src/Skottie.cpp42
-rw-r--r--chromium/third_party/skia/modules/skottie/src/SkottieTest.cpp52
-rw-r--r--chromium/third_party/skia/modules/skottie/src/SkottieTool.cpp492
-rw-r--r--chromium/third_party/skia/modules/skottie/src/effects/CornerPinEffect.cpp4
-rw-r--r--chromium/third_party/skia/modules/skottie/src/effects/DisplacementMapEffect.cpp2
-rw-r--r--chromium/third_party/skia/modules/skottie/src/effects/Effects.cpp4
-rw-r--r--chromium/third_party/skia/modules/skottie/src/effects/FractalNoiseEffect.cpp4
-rw-r--r--chromium/third_party/skia/modules/skottie/src/effects/GaussianBlurEffect.cpp4
-rw-r--r--chromium/third_party/skia/modules/skottie/src/effects/MotionBlurEffect.cpp4
-rw-r--r--chromium/third_party/skia/modules/skottie/src/effects/MotionTileEffect.cpp2
-rw-r--r--chromium/third_party/skia/modules/skottie/src/effects/RadialWipeEffect.cpp2
-rw-r--r--chromium/third_party/skia/modules/skottie/src/effects/ShiftChannelsEffect.cpp2
-rw-r--r--chromium/third_party/skia/modules/skottie/src/effects/VenetianBlindsEffect.cpp4
-rw-r--r--chromium/third_party/skia/modules/skottie/src/layers/shapelayer/FillStroke.cpp4
-rw-r--r--chromium/third_party/skia/modules/skottie/src/layers/shapelayer/MergePaths.cpp2
-rw-r--r--chromium/third_party/skia/modules/skottie/src/layers/shapelayer/OffsetPaths.cpp2
-rw-r--r--chromium/third_party/skia/modules/skottie/src/layers/shapelayer/Polystar.cpp2
-rw-r--r--chromium/third_party/skia/modules/skottie/src/layers/shapelayer/ShapeLayer.cpp16
-rw-r--r--chromium/third_party/skia/modules/skottie/src/layers/shapelayer/TrimPaths.cpp2
-rw-r--r--chromium/third_party/skia/modules/skottie/src/text/RangeSelector.cpp6
-rw-r--r--chromium/third_party/skia/modules/skottie/src/text/SkottieShaper.cpp194
-rw-r--r--chromium/third_party/skia/modules/skottie/src/text/SkottieShaper.h36
-rw-r--r--chromium/third_party/skia/modules/skottie/src/text/TextAdapter.cpp72
-rw-r--r--chromium/third_party/skia/modules/skottie/src/text/TextAdapter.h2
-rw-r--r--chromium/third_party/skia/modules/skottie/src/text/TextValue.cpp10
-rw-r--r--chromium/third_party/skia/modules/skparagraph/BUILD.bazel10
-rw-r--r--chromium/third_party/skia/modules/skparagraph/BUILD.gn4
-rw-r--r--chromium/third_party/skia/modules/skparagraph/include/ParagraphStyle.h7
-rw-r--r--chromium/third_party/skia/modules/skparagraph/include/TextStyle.h4
-rw-r--r--chromium/third_party/skia/modules/skparagraph/samples/SampleParagraph.cpp32
-rw-r--r--chromium/third_party/skia/modules/skparagraph/skparagraph.gni8
-rw-r--r--chromium/third_party/skia/modules/skparagraph/src/OneLineShaper.cpp142
-rw-r--r--chromium/third_party/skia/modules/skparagraph/src/ParagraphCache.cpp7
-rw-r--r--chromium/third_party/skia/modules/skparagraph/src/ParagraphImpl.cpp122
-rw-r--r--chromium/third_party/skia/modules/skparagraph/src/ParagraphImpl.h26
-rw-r--r--chromium/third_party/skia/modules/skparagraph/src/ParagraphStyle.cpp1
-rw-r--r--chromium/third_party/skia/modules/skparagraph/src/Run.cpp5
-rw-r--r--chromium/third_party/skia/modules/skparagraph/src/Run.h9
-rw-r--r--chromium/third_party/skia/modules/skparagraph/src/TextLine.cpp7
-rw-r--r--chromium/third_party/skia/modules/skparagraph/src/TextStyle.cpp3
-rw-r--r--chromium/third_party/skia/modules/skparagraph/src/TextWrapper.cpp2
-rw-r--r--chromium/third_party/skia/modules/skplaintexteditor/app/editor_application.cpp2
-rw-r--r--chromium/third_party/skia/modules/skresources/BUILD.bazel6
-rw-r--r--chromium/third_party/skia/modules/skresources/src/SkResources.cpp3
-rw-r--r--chromium/third_party/skia/modules/sksg/BUILD.bazel4
-rw-r--r--chromium/third_party/skia/modules/sksg/include/SkSGRenderEffect.h16
-rw-r--r--chromium/third_party/skia/modules/sksg/include/SkSGRenderNode.h6
-rw-r--r--chromium/third_party/skia/modules/sksg/include/SkSGText.h27
-rw-r--r--chromium/third_party/skia/modules/sksg/src/SkSGRenderEffect.cpp17
-rw-r--r--chromium/third_party/skia/modules/sksg/src/SkSGRenderNode.cpp12
-rw-r--r--chromium/third_party/skia/modules/sksg/src/SkSGText.cpp31
-rw-r--r--chromium/third_party/skia/modules/skshaper/BUILD.bazel24
-rw-r--r--chromium/third_party/skia/modules/skshaper/include/SkShaper.h5
-rw-r--r--chromium/third_party/skia/modules/skshaper/src/BUILD.bazel2
-rw-r--r--chromium/third_party/skia/modules/skshaper/src/SkShaper.cpp2
-rw-r--r--chromium/third_party/skia/modules/skshaper/src/SkShaper_harfbuzz.cpp50
-rw-r--r--chromium/third_party/skia/modules/skunicode/BUILD.bazel9
-rw-r--r--chromium/third_party/skia/modules/skunicode/include/SkUnicode.h142
-rw-r--r--chromium/third_party/skia/modules/skunicode/skunicode.gni1
-rw-r--r--chromium/third_party/skia/modules/skunicode/src/BUILD.bazel1
-rw-r--r--chromium/third_party/skia/modules/skunicode/src/SkUnicode.cpp61
-rw-r--r--chromium/third_party/skia/modules/skunicode/src/SkUnicode_icu.cpp215
-rw-r--r--chromium/third_party/skia/modules/skunicode/src/SkUnicode_icu.h6
-rw-r--r--chromium/third_party/skia/modules/skunicode/src/SkUnicode_icu_builtin.cpp5
-rw-r--r--chromium/third_party/skia/modules/svg/include/SkSVGAttributeParser.h2
-rw-r--r--chromium/third_party/skia/modules/svg/include/SkSVGTypes.h6
-rw-r--r--chromium/third_party/skia/modules/svg/src/SkSVGAttributeParser.cpp8
-rw-r--r--chromium/third_party/skia/modules/svg/src/SkSVGDOM.cpp8
-rw-r--r--chromium/third_party/skia/modules/svg/src/SkSVGGradient.cpp2
-rw-r--r--chromium/third_party/skia/modules/svg/src/SkSVGNode.cpp4
-rw-r--r--chromium/third_party/skia/modules/svg/src/SkSVGOpenTypeSVGDecoder.cpp2
-rw-r--r--chromium/third_party/skia/platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp5
-rw-r--r--chromium/third_party/skia/platform_tools/android/apps/skqp/src/main/assets/skqp/rendertests.txt1
-rw-r--r--chromium/third_party/skia/platform_tools/android/apps/skqp/src/main/assets/skqp/unittests.txt102
-rw-r--r--chromium/third_party/skia/public.bzl377
-rw-r--r--chromium/third_party/skia/resources/fonts/SampleSVG.ttfbin6960 -> 7288 bytes
-rw-r--r--chromium/third_party/skia/resources/fonts/colrv1_samples.ttfbin3156 -> 0 bytes
-rw-r--r--chromium/third_party/skia/resources/fonts/more_samples-glyf_colr_1.ttfbin9992 -> 0 bytes
-rw-r--r--chromium/third_party/skia/resources/fonts/test_glyphs-glyf_colr_1.ttfbin0 -> 16704 bytes
-rw-r--r--chromium/third_party/skia/resources/fonts/test_glyphs-glyf_colr_1_variable.ttfbin0 -> 70336 bytes
-rw-r--r--chromium/third_party/skia/resources/images/alphabetAnim.avifbin0 -> 2987 bytes
-rw-r--r--chromium/third_party/skia/resources/images/baby_tux.avifbin0 -> 8261 bytes
-rw-r--r--chromium/third_party/skia/resources/images/dog.avifbin0 -> 6135 bytes
-rw-r--r--chromium/third_party/skia/resources/images/ducky.avifbin0 -> 6943 bytes
-rw-r--r--chromium/third_party/skia/resources/images/example_1_animated.avifbin0 -> 9397 bytes
-rw-r--r--chromium/third_party/skia/resources/images/example_3_10bit.avifbin0 -> 67877 bytes
-rw-r--r--chromium/third_party/skia/resources/images/example_3_12bit.avifbin0 -> 68151 bytes
-rw-r--r--chromium/third_party/skia/resources/rivs/glow.rivbin0 -> 283 bytes
-rw-r--r--chromium/third_party/skia/resources/rivs/knight_square.rivbin0 -> 50123 bytes
-rw-r--r--chromium/third_party/skia/resources/skottie/skottie-blendmode-hardmix.json1
-rw-r--r--chromium/third_party/skia/resources/sksl/compute/ArrayAdd.compute7
-rw-r--r--chromium/third_party/skia/resources/sksl/compute/Desaturate.compute13
-rw-r--r--chromium/third_party/skia/resources/sksl/compute/DesaturateFunction.compute14
-rw-r--r--chromium/third_party/skia/resources/sksl/compute/DesaturateReadWrite.compute12
-rw-r--r--chromium/third_party/skia/resources/sksl/compute/MatrixMultiply.compute19
-rw-r--r--chromium/third_party/skia/resources/sksl/compute/Raytrace.compute26
-rw-r--r--chromium/third_party/skia/resources/sksl/compute/Threadgroup.compute44
-rw-r--r--chromium/third_party/skia/resources/sksl/errors/BadModifiers.sksl33
-rw-r--r--chromium/third_party/skia/resources/sksl/errors/CallMain.rts9
-rw-r--r--chromium/third_party/skia/resources/sksl/errors/ComputeUniform.compute8
-rw-r--r--chromium/third_party/skia/resources/sksl/errors/DuplicateBinding.compute9
-rw-r--r--chromium/third_party/skia/resources/sksl/errors/InvalidExtensionDirective.sksl5
-rw-r--r--chromium/third_party/skia/resources/sksl/errors/InvalidInOutType.compute11
-rw-r--r--chromium/third_party/skia/resources/sksl/errors/InvalidMainParameters.compute7
-rw-r--r--chromium/third_party/skia/resources/sksl/errors/InvalidMainReturn.compute7
-rw-r--r--chromium/third_party/skia/resources/sksl/errors/InvalidThreadgroupCompute.compute18
-rw-r--r--chromium/third_party/skia/resources/sksl/errors/InvalidThreadgroupRTS.rts5
-rw-r--r--chromium/third_party/skia/resources/sksl/errors/InvalidVersionDirective.sksl5
-rw-r--r--chromium/third_party/skia/resources/sksl/errors/ModifiersInStruct.rts6
-rw-r--r--chromium/third_party/skia/resources/sksl/errors/OpaqueTypeOutParam.sksl8
-rw-r--r--chromium/third_party/skia/resources/sksl/errors/Ossfuzz38140.sksl5
-rw-r--r--chromium/third_party/skia/resources/sksl/errors/Ossfuzz47935.sksl6
-rw-r--r--chromium/third_party/skia/resources/sksl/errors/Ossfuzz48592.sksl1
-rw-r--r--chromium/third_party/skia/resources/sksl/errors/Ossfuzz49558.sksl5
-rw-r--r--chromium/third_party/skia/resources/sksl/errors/OverflowFloatIntrinsic.sksl13
-rw-r--r--chromium/third_party/skia/resources/sksl/errors/OverloadedBuiltin.sksl26
-rw-r--r--chromium/third_party/skia/resources/sksl/errors/UnspecifiedBinding.compute8
-rw-r--r--chromium/third_party/skia/resources/sksl/folding/MatrixNoOpFolding.sksl103
-rw-r--r--chromium/third_party/skia/resources/sksl/folding/MatrixScalarNoOpFolding.sksl194
-rw-r--r--chromium/third_party/skia/resources/sksl/folding/MatrixVectorNoOpFolding.sksl162
-rw-r--r--chromium/third_party/skia/resources/sksl/glsl/TextureSharpenVersion110.sksl11
-rw-r--r--chromium/third_party/skia/resources/sksl/glsl/TextureVersion110.sksl11
-rw-r--r--chromium/third_party/skia/resources/sksl/inliner/InlinerCanBeDisabled.sksl4
-rw-r--r--chromium/third_party/skia/resources/sksl/inliner/InlinerManglesNames.sksl8
-rw-r--r--chromium/third_party/skia/resources/sksl/inliner/NoInline.sksl4
-rw-r--r--chromium/third_party/skia/resources/sksl/metal/Ossfuzz48371.sksl1
-rw-r--r--chromium/third_party/skia/resources/sksl/runtime_errors/IllegalLayoutFlags.rts30
-rw-r--r--chromium/third_party/skia/resources/sksl/runtime_errors/IllegalModifiers.rts50
-rw-r--r--chromium/third_party/skia/resources/sksl/runtime_errors/IllegalShaderUse.rts2
-rw-r--r--chromium/third_party/skia/resources/sksl/runtime_errors/InvalidUniformTypesES3.rts52
-rw-r--r--chromium/third_party/skia/resources/sksl/runtime_errors/ReservedNameISampler2D.rts5
-rw-r--r--chromium/third_party/skia/resources/sksl/runtime_errors/ReservedNameSampler1D.rts2
-rw-r--r--chromium/third_party/skia/resources/sksl/runtime_errors/ReservedNameSampler3D.rts2
-rw-r--r--chromium/third_party/skia/resources/sksl/shared/FunctionPrototype.sksl1
-rw-r--r--chromium/third_party/skia/resources/sksl/shared/IntegerDivisionES3.sksl25
-rw-r--r--chromium/third_party/skia/resources/sksl/shared/InterfaceBlockBuffer.sksl7
-rw-r--r--chromium/third_party/skia/resources/sksl/shared/SwitchWithEarlyReturn.sksl208
-rw-r--r--chromium/third_party/skia/resources/sksl/shared/SwitchWithLoopsES3.sksl81
-rw-r--r--chromium/third_party/skia/resources/sksl/shared/Texture1D.sksl7
-rw-r--r--chromium/third_party/skia/resources/sksl/shared/TextureSharpen.sksl11
-rw-r--r--chromium/third_party/skia/resources/sksl/shared/VectorScalarMath.sksl28
-rw-r--r--chromium/third_party/skia/resources/sksl/shared/VectorToMatrixCast.sksl3
-rw-r--r--chromium/third_party/skia/samplecode/Sample3D.cpp2
-rw-r--r--chromium/third_party/skia/samplecode/SampleAARectModes.cpp2
-rw-r--r--chromium/third_party/skia/samplecode/SampleAARects.cpp2
-rw-r--r--chromium/third_party/skia/samplecode/SampleAnimBlur.cpp2
-rw-r--r--chromium/third_party/skia/samplecode/SampleArc.cpp2
-rw-r--r--chromium/third_party/skia/samplecode/SampleClip.cpp2
-rw-r--r--chromium/third_party/skia/samplecode/SampleComplexClip.cpp4
-rw-r--r--chromium/third_party/skia/samplecode/SampleCusp.cpp2
-rw-r--r--chromium/third_party/skia/samplecode/SampleDegenerateTwoPtRadials.cpp2
-rw-r--r--chromium/third_party/skia/samplecode/SampleEffects.cpp10
-rw-r--r--chromium/third_party/skia/samplecode/SampleFilterBounds.cpp2
-rw-r--r--chromium/third_party/skia/samplecode/SampleGradients.cpp6
-rw-r--r--chromium/third_party/skia/samplecode/SampleHairModes.cpp2
-rw-r--r--chromium/third_party/skia/samplecode/SampleImageFilterDAG.cpp2
-rw-r--r--chromium/third_party/skia/samplecode/SampleMaterialShadows.cpp12
-rw-r--r--chromium/third_party/skia/samplecode/SamplePatch.cpp6
-rw-r--r--chromium/third_party/skia/samplecode/SamplePath.cpp4
-rw-r--r--chromium/third_party/skia/samplecode/SamplePathClip.cpp2
-rw-r--r--chromium/third_party/skia/samplecode/SamplePathEffects.cpp4
-rw-r--r--chromium/third_party/skia/samplecode/SamplePathTessellators.cpp2
-rw-r--r--chromium/third_party/skia/samplecode/SampleQuadStroker.cpp34
-rw-r--r--chromium/third_party/skia/samplecode/SampleSBIX.cpp4
-rw-r--r--chromium/third_party/skia/samplecode/SampleSlides.cpp20
-rw-r--r--chromium/third_party/skia/samplecode/SampleStrokePath.cpp2
-rw-r--r--chromium/third_party/skia/samplecode/SampleStrokeRect.cpp4
-rw-r--r--chromium/third_party/skia/samplecode/SampleTextBox.cpp1
-rw-r--r--chromium/third_party/skia/samplecode/SampleVertices.cpp4
-rw-r--r--chromium/third_party/skia/samplecode/SampleXfer.cpp2
-rw-r--r--chromium/third_party/skia/samplecode/SampleXfermodesBlur.cpp2
-rw-r--r--chromium/third_party/skia/site/about/_index.html2
-rw-r--r--chromium/third_party/skia/site/docs/dev/contrib/bazel.md30
-rw-r--r--chromium/third_party/skia/site/docs/dev/contrib/style.md16
-rw-r--r--chromium/third_party/skia/site/docs/dev/contrib/submit.md4
-rw-r--r--chromium/third_party/skia/site/docs/dev/gardening/_index.md7
-rw-r--r--chromium/third_party/skia/site/docs/dev/tools/tracing.md38
-rw-r--r--chromium/third_party/skia/site/docs/user/api/skcanvas_creation.md10
-rw-r--r--chromium/third_party/skia/site/docs/user/build.md10
-rw-r--r--chromium/third_party/skia/src/BUILD.bazel52
-rw-r--r--chromium/third_party/skia/src/c/BUILD.bazel5
-rw-r--r--chromium/third_party/skia/src/c/sk_c_from_to.h34
-rw-r--r--chromium/third_party/skia/src/c/sk_effects.cpp186
-rw-r--r--chromium/third_party/skia/src/c/sk_imageinfo.cpp143
-rw-r--r--chromium/third_party/skia/src/c/sk_paint.cpp173
-rw-r--r--chromium/third_party/skia/src/c/sk_surface.cpp474
-rw-r--r--chromium/third_party/skia/src/c/sk_types_priv.h41
-rw-r--r--chromium/third_party/skia/src/codec/BUILD.bazel67
-rw-r--r--chromium/third_party/skia/src/codec/SkAndroidCodec.cpp21
-rw-r--r--chromium/third_party/skia/src/codec/SkAndroidCodecAdapter.cpp3
-rw-r--r--chromium/third_party/skia/src/codec/SkAndroidCodecAdapter.h7
-rw-r--r--chromium/third_party/skia/src/codec/SkAvifCodec.cpp232
-rw-r--r--chromium/third_party/skia/src/codec/SkAvifCodec.h102
-rw-r--r--chromium/third_party/skia/src/codec/SkBmpBaseCodec.cpp7
-rw-r--r--chromium/third_party/skia/src/codec/SkBmpBaseCodec.h7
-rw-r--r--chromium/third_party/skia/src/codec/SkBmpCodec.cpp12
-rw-r--r--chromium/third_party/skia/src/codec/SkBmpCodec.h16
-rw-r--r--chromium/third_party/skia/src/codec/SkBmpMaskCodec.cpp11
-rw-r--r--chromium/third_party/skia/src/codec/SkBmpMaskCodec.h12
-rw-r--r--chromium/third_party/skia/src/codec/SkBmpRLECodec.cpp15
-rw-r--r--chromium/third_party/skia/src/codec/SkBmpRLECodec.h12
-rw-r--r--chromium/third_party/skia/src/codec/SkBmpStandardCodec.cpp13
-rw-r--r--chromium/third_party/skia/src/codec/SkBmpStandardCodec.h14
-rw-r--r--chromium/third_party/skia/src/codec/SkCodec.cpp19
-rw-r--r--chromium/third_party/skia/src/codec/SkCodecImageGenerator.cpp7
-rw-r--r--chromium/third_party/skia/src/codec/SkCodecImageGenerator.h8
-rw-r--r--chromium/third_party/skia/src/codec/SkColorTable.cpp4
-rw-r--r--chromium/third_party/skia/src/codec/SkColorTable.h1
-rw-r--r--chromium/third_party/skia/src/codec/SkEncodedInfo.cpp2
-rw-r--r--chromium/third_party/skia/src/codec/SkHeifCodec.cpp1
-rw-r--r--chromium/third_party/skia/src/codec/SkIcoCodec.cpp17
-rw-r--r--chromium/third_party/skia/src/codec/SkIcoCodec.h12
-rw-r--r--chromium/third_party/skia/src/codec/SkJpegCodec.cpp25
-rw-r--r--chromium/third_party/skia/src/codec/SkJpegCodec.h20
-rw-r--r--chromium/third_party/skia/src/codec/SkJpegDecoderMgr.cpp4
-rw-r--r--chromium/third_party/skia/src/codec/SkJpegDecoderMgr.h7
-rw-r--r--chromium/third_party/skia/src/codec/SkJpegUtility.cpp12
-rw-r--r--chromium/third_party/skia/src/codec/SkJpegUtility.h13
-rw-r--r--chromium/third_party/skia/src/codec/SkMaskSwizzler.cpp9
-rw-r--r--chromium/third_party/skia/src/codec/SkMaskSwizzler.h8
-rw-r--r--chromium/third_party/skia/src/codec/SkMasks.cpp3
-rw-r--r--chromium/third_party/skia/src/codec/SkMasks.h2
-rw-r--r--chromium/third_party/skia/src/codec/SkParseEncodedOrigin.cpp7
-rw-r--r--chromium/third_party/skia/src/codec/SkPngCodec.cpp31
-rw-r--r--chromium/third_party/skia/src/codec/SkPngCodec.h15
-rw-r--r--chromium/third_party/skia/src/codec/SkRawCodec.cpp36
-rw-r--r--chromium/third_party/skia/src/codec/SkRawCodec.h8
-rw-r--r--chromium/third_party/skia/src/codec/SkSampledCodec.cpp8
-rw-r--r--chromium/third_party/skia/src/codec/SkSampledCodec.h6
-rw-r--r--chromium/third_party/skia/src/codec/SkSampler.cpp9
-rw-r--r--chromium/third_party/skia/src/codec/SkSampler.h5
-rw-r--r--chromium/third_party/skia/src/codec/SkSwizzler.cpp12
-rw-r--r--chromium/third_party/skia/src/codec/SkSwizzler.h10
-rw-r--r--chromium/third_party/skia/src/codec/SkWbmpCodec.cpp10
-rw-r--r--chromium/third_party/skia/src/codec/SkWbmpCodec.h13
-rw-r--r--chromium/third_party/skia/src/codec/SkWebpCodec.cpp18
-rw-r--r--chromium/third_party/skia/src/codec/SkWebpCodec.h11
-rw-r--r--chromium/third_party/skia/src/codec/SkWuffsCodec.cpp24
-rw-r--r--chromium/third_party/skia/src/codec/SkWuffsCodec.h6
-rw-r--r--chromium/third_party/skia/src/core/BUILD.bazel84
-rw-r--r--chromium/third_party/skia/src/core/SkATrace.h3
-rw-r--r--chromium/third_party/skia/src/core/SkAdvancedTypefaceMetrics.h7
-rw-r--r--chromium/third_party/skia/src/core/SkAnalyticEdge.cpp3
-rw-r--r--chromium/third_party/skia/src/core/SkAnalyticEdge.h2
-rw-r--r--chromium/third_party/skia/src/core/SkArenaAlloc.cpp22
-rw-r--r--chromium/third_party/skia/src/core/SkArenaAlloc.h7
-rw-r--r--chromium/third_party/skia/src/core/SkAutoBlitterChoose.h4
-rw-r--r--chromium/third_party/skia/src/core/SkBigPicture.cpp1
-rw-r--r--chromium/third_party/skia/src/core/SkBigPicture.h2
-rw-r--r--chromium/third_party/skia/src/core/SkBitmap.cpp4
-rw-r--r--chromium/third_party/skia/src/core/SkBitmapDevice.cpp6
-rw-r--r--chromium/third_party/skia/src/core/SkBitmapDevice.h2
-rw-r--r--chromium/third_party/skia/src/core/SkBlitRow_D32.cpp4
-rw-r--r--chromium/third_party/skia/src/core/SkBlitter.cpp23
-rw-r--r--chromium/third_party/skia/src/core/SkBlitter.h7
-rw-r--r--chromium/third_party/skia/src/core/SkBlockAllocator.h6
-rw-r--r--chromium/third_party/skia/src/core/SkBlurMF.cpp8
-rw-r--r--chromium/third_party/skia/src/core/SkBuiltInCodeSnippetID.h11
-rw-r--r--chromium/third_party/skia/src/core/SkCanvas.cpp60
-rw-r--r--chromium/third_party/skia/src/core/SkCanvasPriv.cpp22
-rw-r--r--chromium/third_party/skia/src/core/SkCanvasPriv.h15
-rw-r--r--chromium/third_party/skia/src/core/SkChromeRemoteGlyphCache.cpp342
-rw-r--r--chromium/third_party/skia/src/core/SkClipStack.cpp2
-rw-r--r--chromium/third_party/skia/src/core/SkColorFilter.cpp75
-rw-r--r--chromium/third_party/skia/src/core/SkColorFilterBase.h25
-rw-r--r--chromium/third_party/skia/src/core/SkColorFilter_Matrix.cpp140
-rw-r--r--chromium/third_party/skia/src/core/SkColorFilter_Matrix.h46
-rw-r--r--chromium/third_party/skia/src/core/SkColorSpace.cpp2
-rw-r--r--chromium/third_party/skia/src/core/SkColorSpaceXformSteps.cpp2
-rw-r--r--chromium/third_party/skia/src/core/SkColorSpaceXformSteps.h2
-rw-r--r--chromium/third_party/skia/src/core/SkCombinationBuilder.cpp113
-rw-r--r--chromium/third_party/skia/src/core/SkCoreBlitters.h4
-rw-r--r--chromium/third_party/skia/src/core/SkCpu.cpp6
-rw-r--r--chromium/third_party/skia/src/core/SkDeferredDisplayListRecorder.cpp2
-rw-r--r--chromium/third_party/skia/src/core/SkDevice.cpp15
-rw-r--r--chromium/third_party/skia/src/core/SkDevice.h22
-rw-r--r--chromium/third_party/skia/src/core/SkDraw.cpp131
-rw-r--r--chromium/third_party/skia/src/core/SkDraw.h11
-rw-r--r--chromium/third_party/skia/src/core/SkDraw_atlas.cpp20
-rw-r--r--chromium/third_party/skia/src/core/SkDraw_text.cpp8
-rw-r--r--chromium/third_party/skia/src/core/SkDraw_vertices.cpp55
-rw-r--r--chromium/third_party/skia/src/core/SkEdge.cpp25
-rw-r--r--chromium/third_party/skia/src/core/SkEdge.h9
-rw-r--r--chromium/third_party/skia/src/core/SkEdgeBuilder.cpp14
-rw-r--r--chromium/third_party/skia/src/core/SkEffectPriv.h2
-rw-r--r--chromium/third_party/skia/src/core/SkEnumBitMask.h8
-rw-r--r--chromium/third_party/skia/src/core/SkFactoryFunctions.cpp232
-rw-r--r--chromium/third_party/skia/src/core/SkFactoryFunctions.h137
-rw-r--r--chromium/third_party/skia/src/core/SkFlattenable.cpp2
-rw-r--r--chromium/third_party/skia/src/core/SkFont.cpp10
-rw-r--r--chromium/third_party/skia/src/core/SkGeometry.cpp10
-rw-r--r--chromium/third_party/skia/src/core/SkGeometry.h2
-rw-r--r--chromium/third_party/skia/src/core/SkGlyph.cpp23
-rw-r--r--chromium/third_party/skia/src/core/SkGlyph.h63
-rw-r--r--chromium/third_party/skia/src/core/SkGlyphBuffer.cpp4
-rw-r--r--chromium/third_party/skia/src/core/SkGlyphBuffer.h46
-rw-r--r--chromium/third_party/skia/src/core/SkGlyphRunPainter.cpp83
-rw-r--r--chromium/third_party/skia/src/core/SkGlyphRunPainter.h25
-rw-r--r--chromium/third_party/skia/src/core/SkGpuBlurUtils.cpp359
-rw-r--r--chromium/third_party/skia/src/core/SkGraphics.cpp17
-rw-r--r--chromium/third_party/skia/src/core/SkKeyHelpers.cpp424
-rw-r--r--chromium/third_party/skia/src/core/SkKeyHelpers.h132
-rw-r--r--chromium/third_party/skia/src/core/SkLineClipper.cpp2
-rw-r--r--chromium/third_party/skia/src/core/SkMalloc.cpp8
-rw-r--r--chromium/third_party/skia/src/core/SkMask.cpp28
-rw-r--r--chromium/third_party/skia/src/core/SkMaskBlurFilter.cpp6
-rw-r--r--chromium/third_party/skia/src/core/SkMathPriv.h10
-rw-r--r--chromium/third_party/skia/src/core/SkMatrix.cpp4
-rw-r--r--chromium/third_party/skia/src/core/SkMesh.cpp113
-rw-r--r--chromium/third_party/skia/src/core/SkMeshPriv.h84
-rw-r--r--chromium/third_party/skia/src/core/SkMiniRecorder.cpp141
-rw-r--r--chromium/third_party/skia/src/core/SkMiniRecorder.h58
-rw-r--r--chromium/third_party/skia/src/core/SkModeColorFilter.cpp158
-rw-r--r--chromium/third_party/skia/src/core/SkModeColorFilter.h47
-rw-r--r--chromium/third_party/skia/src/core/SkOverdrawCanvas.cpp8
-rw-r--r--chromium/third_party/skia/src/core/SkPaintParamsKey.cpp215
-rw-r--r--chromium/third_party/skia/src/core/SkPaintParamsKey.h64
-rw-r--r--chromium/third_party/skia/src/core/SkPath.cpp6
-rw-r--r--chromium/third_party/skia/src/core/SkPathBuilder.cpp4
-rw-r--r--chromium/third_party/skia/src/core/SkPathPriv.h4
-rw-r--r--chromium/third_party/skia/src/core/SkPicture.cpp1
-rw-r--r--chromium/third_party/skia/src/core/SkPictureCommon.h92
-rw-r--r--chromium/third_party/skia/src/core/SkPicturePriv.h7
-rw-r--r--chromium/third_party/skia/src/core/SkPictureRecord.h1
-rw-r--r--chromium/third_party/skia/src/core/SkPictureRecorder.cpp26
-rw-r--r--chromium/third_party/skia/src/core/SkPipelineData.h2
-rw-r--r--chromium/third_party/skia/src/core/SkPixmap.cpp174
-rw-r--r--chromium/third_party/skia/src/core/SkPrecompile.h112
-rw-r--r--chromium/third_party/skia/src/core/SkRRect.cpp2
-rw-r--r--chromium/third_party/skia/src/core/SkRasterPipeline.cpp33
-rw-r--r--chromium/third_party/skia/src/core/SkRasterPipeline.h2
-rw-r--r--chromium/third_party/skia/src/core/SkRasterPipelineBlitter.cpp15
-rw-r--r--chromium/third_party/skia/src/core/SkRecordedDrawable.cpp5
-rw-r--r--chromium/third_party/skia/src/core/SkRecorder.cpp35
-rw-r--r--chromium/third_party/skia/src/core/SkRecorder.h14
-rw-r--r--chromium/third_party/skia/src/core/SkRegion_path.cpp4
-rw-r--r--chromium/third_party/skia/src/core/SkRuntimeEffect.cpp181
-rw-r--r--chromium/third_party/skia/src/core/SkRuntimeEffectDictionary.h41
-rw-r--r--chromium/third_party/skia/src/core/SkRuntimeEffectPriv.h59
-rw-r--r--chromium/third_party/skia/src/core/SkSLTypeShared.cpp213
-rw-r--r--chromium/third_party/skia/src/core/SkSLTypeShared.h76
-rw-r--r--chromium/third_party/skia/src/core/SkScalerCache.cpp181
-rw-r--r--chromium/third_party/skia/src/core/SkScalerCache.h27
-rw-r--r--chromium/third_party/skia/src/core/SkScalerContext.h1
-rw-r--r--chromium/third_party/skia/src/core/SkScan_Hairline.cpp4
-rw-r--r--chromium/third_party/skia/src/core/SkShaderCodeDictionary.cpp1243
-rw-r--r--chromium/third_party/skia/src/core/SkShaderCodeDictionary.h177
-rw-r--r--chromium/third_party/skia/src/core/SkSpecialImage.cpp12
-rw-r--r--chromium/third_party/skia/src/core/SkSpecialSurface.cpp4
-rw-r--r--chromium/third_party/skia/src/core/SkSpinlock.cpp2
-rw-r--r--chromium/third_party/skia/src/core/SkStrikeCache.cpp4
-rw-r--r--chromium/third_party/skia/src/core/SkStrikeCache.h51
-rw-r--r--chromium/third_party/skia/src/core/SkStrikeForGPU.cpp30
-rw-r--r--chromium/third_party/skia/src/core/SkStrikeForGPU.h76
-rw-r--r--chromium/third_party/skia/src/core/SkStrikeSpec.cpp45
-rw-r--r--chromium/third_party/skia/src/core/SkStrikeSpec.h22
-rw-r--r--chromium/third_party/skia/src/core/SkStroke.cpp4
-rw-r--r--chromium/third_party/skia/src/core/SkTLazy.h2
-rw-r--r--chromium/third_party/skia/src/core/SkTextBlob.cpp13
-rw-r--r--chromium/third_party/skia/src/core/SkTextBlobTrace.cpp3
-rw-r--r--chromium/third_party/skia/src/core/SkTextBlobTrace.h4
-rw-r--r--chromium/third_party/skia/src/core/SkTextFormatParams.h4
-rw-r--r--chromium/third_party/skia/src/core/SkTraceEvent.h6
-rw-r--r--chromium/third_party/skia/src/core/SkVM.cpp526
-rw-r--r--chromium/third_party/skia/src/core/SkVM.h10
-rw-r--r--chromium/third_party/skia/src/core/SkVMBlitter.cpp8
-rw-r--r--chromium/third_party/skia/src/core/SkVertices.cpp11
-rw-r--r--chromium/third_party/skia/src/core/SkWriteBuffer.cpp4
-rw-r--r--chromium/third_party/skia/src/core/SkWriteBuffer.h6
-rw-r--r--chromium/third_party/skia/src/core/SkZip.h2
-rw-r--r--chromium/third_party/skia/src/effects/Sk1DPathEffect.cpp3
-rw-r--r--chromium/third_party/skia/src/effects/SkHighContrastFilter.cpp67
-rw-r--r--chromium/third_party/skia/src/effects/SkLumaColorFilter.cpp10
-rw-r--r--chromium/third_party/skia/src/effects/SkOverdrawColorFilter.cpp37
-rw-r--r--chromium/third_party/skia/src/effects/SkTableColorFilter.cpp57
-rw-r--r--chromium/third_party/skia/src/effects/imagefilters/SkAlphaThresholdImageFilter.cpp4
-rw-r--r--chromium/third_party/skia/src/effects/imagefilters/SkArithmeticImageFilter.cpp2
-rw-r--r--chromium/third_party/skia/src/effects/imagefilters/SkBlendImageFilter.cpp3
-rw-r--r--chromium/third_party/skia/src/effects/imagefilters/SkBlurImageFilter.cpp2
-rw-r--r--chromium/third_party/skia/src/effects/imagefilters/SkColorFilterImageFilter.cpp12
-rw-r--r--chromium/third_party/skia/src/effects/imagefilters/SkLightingImageFilter.cpp16
-rw-r--r--chromium/third_party/skia/src/effects/imagefilters/SkMagnifierImageFilter.cpp2
-rw-r--r--chromium/third_party/skia/src/effects/imagefilters/SkMorphologyImageFilter.cpp6
-rw-r--r--chromium/third_party/skia/src/effects/imagefilters/SkRuntimeImageFilter.cpp43
-rw-r--r--chromium/third_party/skia/src/gpu/AtlasTypes.h5
-rw-r--r--chromium/third_party/skia/src/gpu/BUILD.bazel55
-rw-r--r--chromium/third_party/skia/src/gpu/Blend.cpp42
-rw-r--r--chromium/third_party/skia/src/gpu/BufferWriter.h4
-rw-r--r--chromium/third_party/skia/src/gpu/KeyBuilder.h12
-rw-r--r--chromium/third_party/skia/src/gpu/Swizzle.h19
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/BUILD.bazel45
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/BaseDevice.cpp101
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/BaseDevice.h107
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ClipStack.cpp (renamed from chromium/third_party/skia/src/gpu/ganesh/v1/ClipStack.cpp)8
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ClipStack.h (renamed from chromium/third_party/skia/src/gpu/ganesh/v1/ClipStack.h)0
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/Device.cpp (renamed from chromium/third_party/skia/src/gpu/ganesh/v1/Device.cpp)206
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/Device_drawTexture.cpp (renamed from chromium/third_party/skia/src/gpu/ganesh/v1/Device_drawTexture.cpp)11
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/Device_v1.h (renamed from chromium/third_party/skia/src/gpu/ganesh/v1/Device_v1.h)146
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrAHardwareBufferImageGenerator.cpp9
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrAHardwareBufferUtils.cpp31
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrAttachment.cpp11
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrAuditTrail.cpp4
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrBackendSurface.cpp61
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrBackendTextureImageGenerator.cpp3
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrBlurUtils.cpp5
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrBufferAllocPool.cpp10
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrBufferTransferRenderTask.cpp47
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrBufferTransferRenderTask.h54
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrCaps.cpp9
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrCaps.h22
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrColorSpaceXform.cpp2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrDataUtils.cpp2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrDirectContext.cpp7
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrDirectContextPriv.cpp6
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrDirectContextPriv.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrDrawOpAtlas.cpp47
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrDrawOpAtlas.h49
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrDrawOpTest.cpp2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrDrawingManager.cpp132
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrDrawingManager.h16
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrFPArgs.h11
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrFinishCallbacks.cpp10
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrFragmentProcessor.cpp43
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrFragmentProcessor.h12
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrGpu.cpp107
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrGpu.h31
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrGpuBuffer.cpp35
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrGpuBuffer.h40
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrMemoryPool.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrOpFlushState.cpp2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrPersistentCacheUtils.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrProcessorUnitTest.h26
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrProxyProvider.cpp104
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrRecordingContextPriv.cpp157
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrRecordingContextPriv.h66
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrRenderTargetContext.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrRenderTask.h28
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrRenderTaskCluster.cpp3
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrRenderTaskCluster.h3
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrResourceProvider.cpp23
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrResourceProvider.h6
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrShaderCaps.cpp6
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrShaderCaps.h3
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrShaderVar.cpp6
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrSurfaceProxy.cpp3
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrSurfaceProxy.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrSurfaceProxyView.h12
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrTTopoSort.h75
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrTestUtils.cpp35
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/GrTestUtils.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/PathRenderer.cpp (renamed from chromium/third_party/skia/src/gpu/ganesh/v1/PathRenderer.cpp)4
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/PathRenderer.h (renamed from chromium/third_party/skia/src/gpu/ganesh/v1/PathRenderer.h)0
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/PathRendererChain.cpp (renamed from chromium/third_party/skia/src/gpu/ganesh/v1/PathRendererChain.cpp)2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/PathRendererChain.h (renamed from chromium/third_party/skia/src/gpu/ganesh/v1/PathRendererChain.h)2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/SkGr.cpp48
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/SkGr.h6
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/StencilClip.h (renamed from chromium/third_party/skia/src/gpu/ganesh/v1/StencilClip.h)0
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/StencilMaskHelper.cpp (renamed from chromium/third_party/skia/src/gpu/ganesh/v1/StencilMaskHelper.cpp)4
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/StencilMaskHelper.h (renamed from chromium/third_party/skia/src/gpu/ganesh/v1/StencilMaskHelper.h)2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/SurfaceContext.cpp41
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/SurfaceContext.h28
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/SurfaceDrawContext.cpp (renamed from chromium/third_party/skia/src/gpu/ganesh/v1/SurfaceDrawContext.cpp)39
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/SurfaceDrawContext.h (renamed from chromium/third_party/skia/src/gpu/ganesh/v1/SurfaceDrawContext_v1.h)15
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/SurfaceFillContext.cpp251
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/SurfaceFillContext.h84
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DAttachment.cpp8
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DAttachment.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DBuffer.cpp90
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DBuffer.h14
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DCaps.cpp9
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DGpu.cpp24
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DGpu.h6
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DPipelineStateBuilder.cpp4
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DPipelineStateBuilder.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DRenderTarget.cpp16
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DRenderTarget.h4
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DTexture.cpp8
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DTexture.h4
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DTextureRenderTarget.cpp5
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DTextureRenderTarget.h4
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/dawn/BUILD.bazel13
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnBuffer.cpp136
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnBuffer.h16
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnCaps.cpp6
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnGpu.cpp22
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnGpu.h6
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnProgramBuilder.cpp1
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnProgramBuilder.h4
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnRenderTarget.cpp6
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnRenderTarget.h3
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnTexture.cpp7
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnTexture.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/effects/GrBezierEffect.cpp4
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/effects/GrBlendFragmentProcessor.cpp34
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/effects/GrDistanceFieldGeoProc.cpp62
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/effects/GrDistanceFieldGeoProc.h41
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/effects/GrGaussianConvolutionFragmentProcessor.cpp4
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/effects/GrGaussianConvolutionFragmentProcessor.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/effects/GrSkSLFP.cpp13
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/effects/GrSkSLFP.h27
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/BUILD.bazel4
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/GrGLAssembleGLESInterfaceAutogen.cpp6
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/GrGLAssembleGLInterfaceAutogen.cpp6
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/GrGLAssembleWebGLInterfaceAutogen.cpp4
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/GrGLBuffer.cpp198
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/GrGLBuffer.h16
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/GrGLCaps.cpp187
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/GrGLCaps.h36
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/GrGLContext.h3
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/GrGLExtensions.cpp2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/GrGLGLSL.cpp5
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/GrGLGLSL.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/GrGLGpu.cpp82
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/GrGLGpu.h8
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/GrGLInterfaceAutogen.cpp13
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/GrGLRenderTarget.cpp6
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/GrGLRenderTarget.h3
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/GrGLTexture.cpp6
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/GrGLTexture.h3
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/GrGLTextureRenderTarget.cpp5
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/GrGLTextureRenderTarget.h3
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/GrGLUtil.cpp33
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/GrGLUtil.h6
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/builders/GrGLProgramBuilder.cpp7
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/builders/GrGLProgramBuilder.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/builders/GrGLShaderStringBuilder.cpp2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/builders/GrGLShaderStringBuilder.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/egl/BUILD.bazel4
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/iOS/BUILD.bazel4
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/mac/BUILD.bazel8
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gl/win/BUILD.bazel4
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/glsl/BUILD.bazel2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/glsl/GrGLSL.cpp55
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/glsl/GrGLSL.h16
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/glsl/GrGLSLProgramBuilder.cpp4
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/glsl/GrGLSLShaderBuilder.cpp11
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/glsl/GrGLSLUniformHandler.cpp1
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gradients/GrGradientShader.cpp246
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/gradients/GrGradientShader.h19
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/mock/GrMockBuffer.h8
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/mock/GrMockGpu.h8
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlAttachment.h5
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlAttachment.mm13
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlBuffer.h18
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlBuffer.mm115
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlCaps.mm20
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlCommandBuffer.mm30
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlGpu.h6
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlGpu.mm62
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlPipelineStateBuilder.h6
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlPipelineStateBuilder.mm8
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlRenderTarget.h4
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlRenderTarget.mm26
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlTexture.h4
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlTexture.mm11
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlTextureRenderTarget.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlTextureRenderTarget.mm8
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlUtil.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlUtil.mm2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/AAConvexPathRenderer.cpp2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/AAConvexPathRenderer.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/AAHairLinePathRenderer.cpp7
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/AAHairLinePathRenderer.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/AALinearizingConvexPathRenderer.cpp2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/AALinearizingConvexPathRenderer.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/AtlasPathRenderer.cpp15
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/AtlasPathRenderer.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/AtlasTextOp.cpp6
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/AtlasTextOp.h10
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/DashLinePathRenderer.cpp2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/DashLinePathRenderer.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/DefaultPathRenderer.cpp2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/DefaultPathRenderer.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/DrawAtlasPathOp.cpp2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/DrawMeshOp.cpp36
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/FillRRectOp.cpp6
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/FillRectOp.cpp2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/GrOvalOpFactory.cpp8
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/PathStencilCoverOp.cpp6
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/ShadowRRectOp.cpp6
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/SmallPathRenderer.cpp77
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/SmallPathRenderer.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/SoftwarePathRenderer.cpp2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/SoftwarePathRenderer.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/StrokeRectOp.cpp4
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/StrokeTessellateOp.cpp7
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/TessellationPathRenderer.cpp2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/TessellationPathRenderer.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/TextureOp.cpp2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/TriangulatingPathRenderer.cpp9
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/ops/TriangulatingPathRenderer.h2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/tessellate/GrPathTessellationShader.cpp3
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/tessellate/GrStrokeTessellationShader.cpp3
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/text/GrAtlasManager.cpp15
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/v1/BUILD.bazel41
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/v1/SurfaceFillContext_v1.cpp264
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/v1/SurfaceFillContext_v1.h104
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/vk/BUILD.bazel6
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/vk/GrVkBuffer.cpp107
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/vk/GrVkBuffer.h29
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/vk/GrVkCaps.cpp63
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/vk/GrVkCaps.h51
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/vk/GrVkGpu.cpp70
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/vk/GrVkGpu.h8
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/vk/GrVkImage.cpp3
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/vk/GrVkImage.h1
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/vk/GrVkMSAALoadManager.cpp2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/vk/GrVkPipeline.cpp6
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/vk/GrVkPipelineStateBuilder.cpp8
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/vk/GrVkPipelineStateBuilder.h3
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/vk/GrVkRenderTarget.cpp4
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/vk/GrVkSecondaryCBDrawContext.cpp4
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/vk/GrVkSecondaryCBDrawContext_impl.h6
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/vk/GrVkTexture.cpp3
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/vk/GrVkTextureRenderTarget.cpp3
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/vk/GrVkUtil.cpp2
-rw-r--r--chromium/third_party/skia/src/gpu/ganesh/vk/GrVkUtil.h2
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/AttachmentTypes.h63
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/Buffer.h7
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/Caps.cpp29
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/Caps.h55
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/ClipStack.cpp136
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/ClipStack_graphite.h3
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/CommandBuffer.cpp79
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/CommandBuffer.h121
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/ComputePassTask.cpp40
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/ComputePassTask.h59
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/ComputePipeline.cpp15
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/ComputePipeline.h38
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/ComputePipelineDesc.h66
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/ComputeTypes.h77
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/Context.cpp98
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/ContextPriv.cpp12
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/ContextPriv.h7
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/ContextUtils.cpp253
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/ContextUtils.h33
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/Device.cpp373
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/Device.h76
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/DrawAtlas.cpp502
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/DrawAtlas.h263
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/DrawBufferManager.cpp52
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/DrawBufferManager.h15
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/DrawCommands.h227
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/DrawContext.cpp23
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/DrawContext.h13
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/DrawList.cpp7
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/DrawList.h12
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/DrawOrder.h2
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/DrawParams.h (renamed from chromium/third_party/skia/src/gpu/graphite/DrawGeometry.h)26
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/DrawPass.cpp312
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/DrawPass.h138
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/DrawTypes.h44
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/DrawWriter.cpp34
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/DrawWriter.h34
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/GlobalCache.cpp48
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/GlobalCache.h55
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/Gpu.h89
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/GpuWorkSubmission.h4
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/GraphicsPipeline.cpp5
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/GraphicsPipeline.h2
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/GraphicsPipelineDesc.h2
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/ImageUtils.cpp78
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/ImageUtils.h26
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/Image_Graphite.cpp10
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/PaintParams.cpp46
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/PaintParams.h36
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/QueueManager.cpp (renamed from chromium/third_party/skia/src/gpu/graphite/Gpu.cpp)95
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/QueueManager.h55
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/Recorder.cpp130
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/RecorderPriv.cpp33
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/RecorderPriv.h15
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/Recording.cpp26
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/RecordingPriv.h40
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/RenderPassTask.cpp22
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/Renderer.h130
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/Resource.cpp8
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/Resource.h8
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/ResourceProvider.cpp159
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/ResourceProvider.h70
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/ResourceTypes.h3
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/Sampler.cpp3
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/Sampler.h2
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/SharedContext.cpp34
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/SharedContext.h54
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/SkStuff.cpp2
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/Surface_Graphite.cpp2
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/Texture.cpp4
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/Texture.h5
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/TextureUtils.cpp3
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/UniformManager.cpp190
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/UniformManager.h49
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/UploadBufferManager.cpp9
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/UploadBufferManager.h6
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/UploadTask.cpp1
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/geom/BoundsManager.h260
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/geom/Geometry.h142
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/geom/Shape.cpp11
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/geom/Shape.h4
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/geom/SubRunData.h70
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/geom/Transform.cpp55
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/geom/Transform_graphite.h18
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlBlitCommandEncoder.h9
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlBuffer.h12
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlBuffer.mm20
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlCaps.h6
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlCaps.mm57
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlCommandBuffer.h102
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlCommandBuffer.mm273
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlComputeCommandEncoder.h98
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlComputePipeline.h44
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlComputePipeline.mm79
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlGpu.h54
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlGpu.mm135
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlGraphicsPipeline.h8
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlGraphicsPipeline.mm279
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlQueueManager.h42
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlQueueManager.mm89
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlRenderCommandEncoder.h10
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlResourceProvider.h20
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlResourceProvider.mm55
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlSampler.h6
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlSampler.mm58
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlSharedContext.h43
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlSharedContext.mm60
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlTexture.h10
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlTexture.mm22
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlTrampoline.h20
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlTrampoline.mm27
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlUtils.h12
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/mtl/MtlUtils.mm22
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/render/BitmapTextRenderStep.cpp160
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/render/BitmapTextRenderStep.h34
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/render/CoverBoundsRenderStep.cpp72
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/render/CoverBoundsRenderStep.h4
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/render/MiddleOutFanRenderStep.cpp25
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/render/MiddleOutFanRenderStep.h4
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/render/SDFTextRenderStep.cpp186
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/render/SDFTextRenderStep.h33
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/render/StencilAndFillPathRenderer.cpp73
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/render/TessellateCurvesRenderStep.cpp23
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/render/TessellateCurvesRenderStep.h4
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/render/TessellateStrokesRenderStep.cpp56
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/render/TessellateStrokesRenderStep.h4
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/render/TessellateWedgesRenderStep.cpp21
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/render/TessellateWedgesRenderStep.h4
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/render/TextRenderer.cpp48
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/render/VerticesRenderStep.cpp157
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/render/VerticesRenderStep.h35
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/text/AtlasManager.cpp362
-rw-r--r--chromium/third_party/skia/src/gpu/graphite/text/AtlasManager.h117
-rw-r--r--chromium/third_party/skia/src/gpu/tessellate/PatchWriter.h21
-rw-r--r--chromium/third_party/skia/src/gpu/tessellate/Tessellation.h11
-rw-r--r--chromium/third_party/skia/src/gpu/tessellate/WangsFormula.h58
-rw-r--r--chromium/third_party/skia/src/image/BUILD.bazel4
-rw-r--r--chromium/third_party/skia/src/image/SkImage_Base.h9
-rw-r--r--chromium/third_party/skia/src/image/SkImage_Gpu.cpp11
-rw-r--r--chromium/third_party/skia/src/image/SkImage_Gpu.h2
-rw-r--r--chromium/third_party/skia/src/image/SkImage_GpuBase.cpp3
-rw-r--r--chromium/third_party/skia/src/image/SkImage_GpuYUVA.h2
-rw-r--r--chromium/third_party/skia/src/image/SkImage_Lazy.cpp49
-rw-r--r--chromium/third_party/skia/src/image/SkImage_Lazy.h3
-rw-r--r--chromium/third_party/skia/src/image/SkImage_Raster.cpp20
-rw-r--r--chromium/third_party/skia/src/image/SkSurface_Gpu.cpp22
-rw-r--r--chromium/third_party/skia/src/image/SkSurface_Gpu.h8
-rw-r--r--chromium/third_party/skia/src/image/SkSurface_GpuMtl.mm6
-rw-r--r--chromium/third_party/skia/src/images/BUILD.bazel30
-rw-r--r--chromium/third_party/skia/src/images/SkImageEncoder.cpp11
-rw-r--r--chromium/third_party/skia/src/images/SkImageEncoderFns.h2
-rw-r--r--chromium/third_party/skia/src/images/SkImageEncoderPriv.h5
-rw-r--r--chromium/third_party/skia/src/images/SkJPEGWriteUtility.cpp12
-rw-r--r--chromium/third_party/skia/src/images/SkJPEGWriteUtility.h11
-rw-r--r--chromium/third_party/skia/src/images/SkJpegEncoder.cpp25
-rw-r--r--chromium/third_party/skia/src/images/SkPngEncoder.cpp24
-rw-r--r--chromium/third_party/skia/src/images/SkWebpEncoder.cpp17
-rw-r--r--chromium/third_party/skia/src/lazy/BUILD.bazel12
-rw-r--r--chromium/third_party/skia/src/opts/SkRasterPipeline_opts.h50
-rw-r--r--chromium/third_party/skia/src/opts/SkVM_opts.h4
-rw-r--r--chromium/third_party/skia/src/pathops/SkIntersections.cpp2
-rw-r--r--chromium/third_party/skia/src/pathops/SkIntersections.h2
-rw-r--r--chromium/third_party/skia/src/pathops/SkOpEdgeBuilder.cpp10
-rw-r--r--chromium/third_party/skia/src/pathops/SkPathOpsCubic.cpp2
-rw-r--r--chromium/third_party/skia/src/pathops/SkPathOpsDebug.cpp6
-rw-r--r--chromium/third_party/skia/src/pathops/SkPathOpsTSect.cpp4
-rw-r--r--chromium/third_party/skia/src/pathops/SkPathOpsTypes.cpp5
-rw-r--r--chromium/third_party/skia/src/pdf/BUILD.bazel115
-rw-r--r--chromium/third_party/skia/src/pdf/SkClusterator.cpp4
-rw-r--r--chromium/third_party/skia/src/pdf/SkClusterator.h10
-rw-r--r--chromium/third_party/skia/src/pdf/SkPDFBitmap.cpp6
-rw-r--r--chromium/third_party/skia/src/pdf/SkPDFDevice.cpp12
-rw-r--r--chromium/third_party/skia/src/pdf/SkPDFDevice.h14
-rw-r--r--chromium/third_party/skia/src/pdf/SkPDFFont.cpp6
-rw-r--r--chromium/third_party/skia/src/pdf/SkPDFGradientShader.cpp2
-rw-r--r--chromium/third_party/skia/src/pdf/SkPDFMakeCIDGlyphWidthsArray.cpp4
-rw-r--r--chromium/third_party/skia/src/pdf/SkPDFResourceDict.cpp6
-rw-r--r--chromium/third_party/skia/src/pdf/SkPDFType1Font.cpp2
-rw-r--r--chromium/third_party/skia/src/ports/BUILD.bazel46
-rw-r--r--chromium/third_party/skia/src/ports/SkFontConfigInterface_direct.cpp8
-rw-r--r--chromium/third_party/skia/src/ports/SkFontHost_FreeType.cpp41
-rw-r--r--chromium/third_party/skia/src/ports/SkFontHost_FreeType_common.cpp183
-rw-r--r--chromium/third_party/skia/src/ports/SkFontHost_FreeType_common.h1
-rw-r--r--chromium/third_party/skia/src/ports/SkFontHost_win.cpp8
-rw-r--r--chromium/third_party/skia/src/ports/SkFontMgr_android.cpp2
-rw-r--r--chromium/third_party/skia/src/ports/SkFontMgr_custom.cpp2
-rw-r--r--chromium/third_party/skia/src/ports/SkFontMgr_fontconfig.cpp16
-rw-r--r--chromium/third_party/skia/src/ports/SkFontMgr_mac_ct.cpp2
-rw-r--r--chromium/third_party/skia/src/ports/SkGlobalInitialization_default.cpp14
-rw-r--r--chromium/third_party/skia/src/ports/SkImageEncoder_NDK.cpp2
-rw-r--r--chromium/third_party/skia/src/ports/SkScalerContext_win_dw.cpp253
-rw-r--r--chromium/third_party/skia/src/ports/SkScalerContext_win_dw.h20
-rw-r--r--chromium/third_party/skia/src/ports/SkTypeface_mac_ct.cpp10
-rw-r--r--chromium/third_party/skia/src/sfnt/SkOTTable_name.cpp2
-rw-r--r--chromium/third_party/skia/src/sfnt/SkOTUtils.cpp2
-rw-r--r--chromium/third_party/skia/src/shaders/BUILD.bazel27
-rw-r--r--chromium/third_party/skia/src/shaders/SkColorFilterShader.cpp2
-rw-r--r--chromium/third_party/skia/src/shaders/SkColorShader.cpp111
-rw-r--r--chromium/third_party/skia/src/shaders/SkColorShader.h92
-rw-r--r--chromium/third_party/skia/src/shaders/SkComposeShader.cpp94
-rw-r--r--chromium/third_party/skia/src/shaders/SkComposeShader.h58
-rw-r--r--chromium/third_party/skia/src/shaders/SkEmptyShader.cpp (renamed from chromium/third_party/skia/src/shaders/SkEmptyShader.h)31
-rwxr-xr-xchromium/third_party/skia/src/shaders/SkImageShader.cpp24
-rw-r--r--chromium/third_party/skia/src/shaders/SkLocalMatrixShader.cpp5
-rw-r--r--chromium/third_party/skia/src/shaders/SkPerlinNoiseShader.cpp12
-rw-r--r--chromium/third_party/skia/src/shaders/SkPictureShader.cpp113
-rw-r--r--chromium/third_party/skia/src/shaders/SkPictureShader.h19
-rw-r--r--chromium/third_party/skia/src/shaders/SkShader.cpp22
-rw-r--r--chromium/third_party/skia/src/shaders/SkShaderBase.h12
-rw-r--r--chromium/third_party/skia/src/shaders/gradients/BUILD.bazel6
-rw-r--r--chromium/third_party/skia/src/shaders/gradients/Sk4fGradientBase.h2
-rw-r--r--chromium/third_party/skia/src/shaders/gradients/SkGradientShader.cpp999
-rw-r--r--chromium/third_party/skia/src/shaders/gradients/SkGradientShaderBase.cpp807
-rw-r--r--chromium/third_party/skia/src/shaders/gradients/SkGradientShaderBase.h (renamed from chromium/third_party/skia/src/shaders/gradients/SkGradientShaderPriv.h)28
-rw-r--r--chromium/third_party/skia/src/shaders/gradients/SkLinearGradient.h4
-rw-r--r--chromium/third_party/skia/src/shaders/gradients/SkRadialGradient.cpp88
-rw-r--r--chromium/third_party/skia/src/shaders/gradients/SkRadialGradient.h48
-rw-r--r--chromium/third_party/skia/src/shaders/gradients/SkSweepGradient.cpp132
-rw-r--r--chromium/third_party/skia/src/shaders/gradients/SkSweepGradient.h53
-rw-r--r--chromium/third_party/skia/src/shaders/gradients/SkTwoPointConicalGradient.cpp320
-rw-r--r--chromium/third_party/skia/src/shaders/gradients/SkTwoPointConicalGradient.h101
-rw-r--r--chromium/third_party/skia/src/sksl/BUILD.bazel37
-rw-r--r--chromium/third_party/skia/src/sksl/SkSLAnalysis.cpp1
-rw-r--r--chromium/third_party/skia/src/sksl/SkSLAnalysis.h11
-rw-r--r--chromium/third_party/skia/src/sksl/SkSLBuiltinTypes.cpp22
-rw-r--r--chromium/third_party/skia/src/sksl/SkSLBuiltinTypes.h6
-rw-r--r--chromium/third_party/skia/src/sksl/SkSLCompiler.cpp163
-rw-r--r--chromium/third_party/skia/src/sksl/SkSLCompiler.h53
-rw-r--r--chromium/third_party/skia/src/sksl/SkSLConstantFolder.cpp159
-rw-r--r--chromium/third_party/skia/src/sksl/SkSLDSLParser.cpp82
-rw-r--r--chromium/third_party/skia/src/sksl/SkSLDSLParser.h8
-rw-r--r--chromium/third_party/skia/src/sksl/SkSLDehydrator.cpp84
-rw-r--r--chromium/third_party/skia/src/sksl/SkSLInliner.cpp26
-rw-r--r--chromium/third_party/skia/src/sksl/SkSLInliner.h5
-rw-r--r--chromium/third_party/skia/src/sksl/SkSLIntrinsicList.h196
-rw-r--r--chromium/third_party/skia/src/sksl/SkSLLexer.cpp7468
-rw-r--r--chromium/third_party/skia/src/sksl/SkSLLexer.h8
-rw-r--r--chromium/third_party/skia/src/sksl/SkSLMangler.cpp2
-rw-r--r--chromium/third_party/skia/src/sksl/SkSLOutputStream.h4
-rw-r--r--chromium/third_party/skia/src/sksl/SkSLPool.h2
-rw-r--r--chromium/third_party/skia/src/sksl/SkSLProgramSettings.h13
-rw-r--r--chromium/third_party/skia/src/sksl/SkSLRehydrator.cpp88
-rw-r--r--chromium/third_party/skia/src/sksl/SkSLRehydrator.h17
-rw-r--r--chromium/third_party/skia/src/sksl/SkSLString.cpp6
-rw-r--r--chromium/third_party/skia/src/sksl/SkSLThreadContext.cpp6
-rw-r--r--chromium/third_party/skia/src/sksl/SkSLUtil.h2
-rw-r--r--chromium/third_party/skia/src/sksl/analysis/BUILD.bazel2
-rw-r--r--chromium/third_party/skia/src/sksl/analysis/SkSLFinalizationChecks.cpp34
-rw-r--r--chromium/third_party/skia/src/sksl/analysis/SkSLGetComputeShaderMainParams.cpp51
-rw-r--r--chromium/third_party/skia/src/sksl/analysis/SkSLIsSameExpressionTree.cpp1
-rw-r--r--chromium/third_party/skia/src/sksl/analysis/SkSLProgramUsage.cpp5
-rw-r--r--chromium/third_party/skia/src/sksl/analysis/SkSLProgramUsage.h50
-rw-r--r--chromium/third_party/skia/src/sksl/binary_format.md16
-rw-r--r--chromium/third_party/skia/src/sksl/codegen/BUILD.bazel7
-rw-r--r--chromium/third_party/skia/src/sksl/codegen/SkSLGLSLCodeGenerator.cpp58
-rw-r--r--chromium/third_party/skia/src/sksl/codegen/SkSLGLSLCodeGenerator.h3
-rw-r--r--chromium/third_party/skia/src/sksl/codegen/SkSLMetalCodeGenerator.cpp509
-rw-r--r--chromium/third_party/skia/src/sksl/codegen/SkSLMetalCodeGenerator.h46
-rw-r--r--chromium/third_party/skia/src/sksl/codegen/SkSLPipelineStageCodeGenerator.cpp7
-rw-r--r--chromium/third_party/skia/src/sksl/codegen/SkSLSPIRVCodeGenerator.cpp18
-rw-r--r--chromium/third_party/skia/src/sksl/codegen/SkSLSPIRVCodeGenerator.h4
-rw-r--r--chromium/third_party/skia/src/sksl/codegen/SkSLSPIRVtoHLSL.cpp2
-rw-r--r--chromium/third_party/skia/src/sksl/codegen/SkSLVMCodeGenerator.cpp22
-rw-r--r--chromium/third_party/skia/src/sksl/codegen/SkSLVMCodeGenerator.h1
-rw-r--r--chromium/third_party/skia/src/sksl/codegen/SkSLWGSLCodeGenerator.cpp14
-rw-r--r--chromium/third_party/skia/src/sksl/codegen/SkSLWGSLCodeGenerator.h10
-rw-r--r--chromium/third_party/skia/src/sksl/dsl/DSLCore.cpp8
-rw-r--r--chromium/third_party/skia/src/sksl/dsl/DSLFunction.cpp1
-rw-r--r--chromium/third_party/skia/src/sksl/dsl/DSLSymbols.cpp15
-rw-r--r--chromium/third_party/skia/src/sksl/generated/sksl_compute.dehydrated.sksl80
-rw-r--r--chromium/third_party/skia/src/sksl/generated/sksl_frag.dehydrated.sksl32
-rw-r--r--chromium/third_party/skia/src/sksl/generated/sksl_gpu.dehydrated.sksl5981
-rw-r--r--chromium/third_party/skia/src/sksl/generated/sksl_graphite_frag.dehydrated.sksl3612
-rw-r--r--chromium/third_party/skia/src/sksl/generated/sksl_graphite_vert.dehydrated.sksl1798
-rw-r--r--chromium/third_party/skia/src/sksl/generated/sksl_interp.dehydrated.sksl152
-rw-r--r--chromium/third_party/skia/src/sksl/generated/sksl_public.dehydrated.sksl2559
-rw-r--r--chromium/third_party/skia/src/sksl/generated/sksl_rt_shader.dehydrated.sksl8
-rw-r--r--chromium/third_party/skia/src/sksl/generated/sksl_runtime.dehydrated.sksl54
-rw-r--r--chromium/third_party/skia/src/sksl/generated/sksl_shared.dehydrated.sksl2588
-rw-r--r--chromium/third_party/skia/src/sksl/generated/sksl_vert.dehydrated.sksl16
-rw-r--r--chromium/third_party/skia/src/sksl/ir/BUILD.bazel1
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLChildCall.cpp2
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLConstructorArrayCast.cpp12
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLConstructorCompoundCast.cpp1
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLFieldAccess.cpp26
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLFunctionCall.cpp102
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLFunctionCall.h14
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLFunctionDeclaration.cpp142
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLFunctionDeclaration.h11
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLFunctionDefinition.cpp73
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLFunctionDefinition.h18
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLFunctionReference.h19
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLIndexExpression.cpp1
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLMethodReference.h16
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLModifiers.cpp10
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLProgram.h43
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLSwizzle.cpp2
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLSymbolTable.cpp127
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLSymbolTable.h75
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLType.cpp32
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLType.h15
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLUnresolvedFunction.h49
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLVarDeclarations.cpp89
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLVarDeclarations.h2
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLVariable.cpp37
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLVariable.h15
-rw-r--r--chromium/third_party/skia/src/sksl/ir/SkSLVariableReference.h1
-rw-r--r--chromium/third_party/skia/src/sksl/lex/TransitionTable.cpp73
-rw-r--r--chromium/third_party/skia/src/sksl/lex/sksl.lex6
-rw-r--r--chromium/third_party/skia/src/sksl/sksl_compute.sksl10
-rw-r--r--chromium/third_party/skia/src/sksl/sksl_gpu.sksl216
-rw-r--r--chromium/third_party/skia/src/sksl/sksl_graphite_frag.sksl119
-rw-r--r--chromium/third_party/skia/src/sksl/sksl_public.sksl236
-rw-r--r--chromium/third_party/skia/src/sksl/sksl_shared.sksl297
-rw-r--r--chromium/third_party/skia/src/sksl/tracing/BUILD.bazel8
-rw-r--r--chromium/third_party/skia/src/sksl/tracing/SkVMDebugTrace.cpp17
-rw-r--r--chromium/third_party/skia/src/sksl/tracing/SkVMDebugTrace.h2
-rw-r--r--chromium/third_party/skia/src/sksl/tracing/SkVMDebugTracePlayer.h2
-rw-r--r--chromium/third_party/skia/src/sksl/transform/BUILD.bazel4
-rw-r--r--chromium/third_party/skia/src/sksl/transform/SkSLAddConstToVarModifiers.cpp42
-rw-r--r--chromium/third_party/skia/src/sksl/transform/SkSLBuiltinVariableScanner.cpp118
-rw-r--r--chromium/third_party/skia/src/sksl/transform/SkSLEliminateDeadFunctions.cpp4
-rw-r--r--chromium/third_party/skia/src/sksl/transform/SkSLEliminateDeadGlobalVariables.cpp4
-rw-r--r--chromium/third_party/skia/src/sksl/transform/SkSLEliminateDeadLocalVariables.cpp11
-rw-r--r--chromium/third_party/skia/src/sksl/transform/SkSLEliminateEmptyStatements.cpp2
-rw-r--r--chromium/third_party/skia/src/sksl/transform/SkSLEliminateUnreachableCode.cpp110
-rw-r--r--chromium/third_party/skia/src/sksl/transform/SkSLFindAndDeclareBuiltinFunctions.cpp92
-rw-r--r--chromium/third_party/skia/src/sksl/transform/SkSLFindAndDeclareBuiltinVariables.cpp160
-rw-r--r--chromium/third_party/skia/src/sksl/transform/SkSLTransform.h30
-rw-r--r--chromium/third_party/skia/src/svg/BUILD.bazel27
-rw-r--r--chromium/third_party/skia/src/svg/SkSVGDevice.cpp18
-rw-r--r--chromium/third_party/skia/src/svg/SkSVGDevice.h9
-rw-r--r--chromium/third_party/skia/src/text/BUILD.bazel29
-rw-r--r--chromium/third_party/skia/src/text/GlyphRun.cpp (renamed from chromium/third_party/skia/src/core/SkGlyphRun.cpp)119
-rw-r--r--chromium/third_party/skia/src/text/GlyphRun.h (renamed from chromium/third_party/skia/src/core/SkGlyphRun.h)87
-rw-r--r--chromium/third_party/skia/src/text/StrikeForGPU.cpp78
-rw-r--r--chromium/third_party/skia/src/text/StrikeForGPU.h144
-rw-r--r--chromium/third_party/skia/src/text/gpu/GlyphVector.cpp82
-rw-r--r--chromium/third_party/skia/src/text/gpu/GlyphVector.h28
-rw-r--r--chromium/third_party/skia/src/text/gpu/SDFTControl.cpp13
-rw-r--r--chromium/third_party/skia/src/text/gpu/SDFTControl.h5
-rw-r--r--chromium/third_party/skia/src/text/gpu/SubRunAllocator.h24
-rw-r--r--chromium/third_party/skia/src/text/gpu/SubRunContainer.cpp1326
-rw-r--r--chromium/third_party/skia/src/text/gpu/SubRunContainer.h76
-rw-r--r--chromium/third_party/skia/src/text/gpu/TextBlob.cpp77
-rw-r--r--chromium/third_party/skia/src/text/gpu/TextBlob.h28
-rw-r--r--chromium/third_party/skia/src/text/gpu/TextBlobRedrawCoordinator.cpp24
-rw-r--r--chromium/third_party/skia/src/text/gpu/TextBlobRedrawCoordinator.h15
-rw-r--r--chromium/third_party/skia/src/utils/BUILD.bazel36
-rw-r--r--chromium/third_party/skia/src/utils/SkAnimCodecPlayer.cpp1
-rw-r--r--chromium/third_party/skia/src/utils/SkBase64.cpp2
-rw-r--r--chromium/third_party/skia/src/utils/SkCanvasStateUtils.cpp2
-rw-r--r--chromium/third_party/skia/src/utils/SkCharToGlyphCache.h2
-rw-r--r--chromium/third_party/skia/src/utils/SkCustomTypeface.cpp340
-rw-r--r--chromium/third_party/skia/src/utils/SkDashPath.cpp4
-rw-r--r--chromium/third_party/skia/src/utils/SkEventTracer.cpp3
-rw-r--r--chromium/third_party/skia/src/utils/SkGaussianColorFilter.cpp129
-rw-r--r--chromium/third_party/skia/src/utils/SkJSON.cpp5
-rw-r--r--chromium/third_party/skia/src/utils/SkJSON.h1
-rw-r--r--chromium/third_party/skia/src/utils/SkJSONWriter.h72
-rw-r--r--chromium/third_party/skia/src/utils/SkMultiPictureDocument.cpp6
-rw-r--r--chromium/third_party/skia/src/utils/SkNWayCanvas.cpp7
-rw-r--r--chromium/third_party/skia/src/utils/SkPaintFilterCanvas.cpp17
-rw-r--r--chromium/third_party/skia/src/utils/SkParse.cpp8
-rw-r--r--chromium/third_party/skia/src/utils/SkParseColor.cpp5
-rw-r--r--chromium/third_party/skia/src/utils/SkParsePath.cpp2
-rw-r--r--chromium/third_party/skia/src/utils/SkPatchUtils.cpp3
-rw-r--r--chromium/third_party/skia/src/utils/SkPolyUtils.cpp112
-rw-r--r--chromium/third_party/skia/src/utils/SkPolyUtils.h5
-rw-r--r--chromium/third_party/skia/src/utils/SkShaderUtils.cpp2
-rw-r--r--chromium/third_party/skia/src/utils/SkShadowTessellator.cpp2
-rw-r--r--chromium/third_party/skia/src/utils/SkShadowUtils.cpp88
-rw-r--r--chromium/third_party/skia/src/utils/SkShaperJSONWriter.cpp243
-rw-r--r--chromium/third_party/skia/src/utils/SkShaperJSONWriter.h69
-rw-r--r--chromium/third_party/skia/src/utils/SkTestCanvas.h5
-rw-r--r--chromium/third_party/skia/src/utils/SkUTF.h3
-rw-r--r--chromium/third_party/skia/src/utils/SkVMVisualizer.cpp126
-rw-r--r--chromium/third_party/skia/src/utils/SkVMVisualizer.h19
-rw-r--r--chromium/third_party/skia/src/utils/mac/SkCTFont.cpp6
-rw-r--r--chromium/third_party/skia/src/utils/win/SkWGL_win.cpp4
-rw-r--r--chromium/third_party/skia/src/xml/BUILD.bazel34
-rw-r--r--chromium/third_party/skia/src/xml/SkXMLParser.cpp2
-rw-r--r--chromium/third_party/skia/src/xml/SkXMLWriter.cpp2
-rw-r--r--chromium/third_party/skia/src/xps/SkXPSDevice.cpp18
-rw-r--r--chromium/third_party/skia/src/xps/SkXPSDevice.h7
-rw-r--r--chromium/third_party/skia/third_party/BUILD.bazel1723
-rw-r--r--chromium/third_party/skia/third_party/README6
-rw-r--r--chromium/third_party/skia/third_party/etc1/BUILD.bazel11
-rw-r--r--chromium/third_party/skia/third_party/freetype2/BUILD.gn6
-rw-r--r--chromium/third_party/skia/third_party/freetype2/include/README.md1
-rw-r--r--chromium/third_party/skia/third_party/harfbuzz/BUILD.gn154
-rwxr-xr-xchromium/third_party/skia/third_party/harfbuzz/roll-harfbuzz.sh4
-rw-r--r--chromium/third_party/skia/third_party/libavif/BUILD.gn42
-rw-r--r--chromium/third_party/skia/third_party/libgav1/BUILD.gn266
-rw-r--r--chromium/third_party/skia/third_party/libwebp/BUILD.gn6
-rw-r--r--chromium/third_party/skia/third_party/libyuv/BUILD.gn71
-rw-r--r--chromium/third_party/skia/third_party/perfetto/BUILD.gn17
-rw-r--r--chromium/third_party/skia/third_party/rive/BUILD.gn12
-rw-r--r--chromium/third_party/skia/third_party/skcms/BUILD.bazel22
-rwxr-xr-xchromium/third_party/skia/third_party/skcms/version.sha12
-rw-r--r--chromium/third_party/skia/third_party/third_party.gni11
-rw-r--r--chromium/third_party/skia/third_party/vulkanmemoryallocator/BUILD.bazel4
-rw-r--r--chromium/third_party/skia/toolchain/BUILD.bazel117
-rw-r--r--chromium/third_party/skia/toolchain/download_linux_amd64_toolchain.bzl65
-rw-r--r--chromium/third_party/skia/toolchain/download_mac_m1_toolchain.bzl79
-rw-r--r--chromium/third_party/skia/toolchain/download_mac_toolchain.bzl140
-rw-r--r--chromium/third_party/skia/toolchain/download_toolchains.bzl6
-rw-r--r--chromium/third_party/skia/toolchain/linux_amd64_toolchain_config.bzl32
-rw-r--r--chromium/third_party/skia/toolchain/linux_trampolines/IWYU_mapping.imp108
-rwxr-xr-xchromium/third_party/skia/toolchain/linux_trampolines/clang_trampoline_linux.sh7
-rw-r--r--chromium/third_party/skia/toolchain/mac_m1_toolchain_config.bzl331
-rw-r--r--chromium/third_party/skia/toolchain/mac_toolchain_config.bzl482
-rwxr-xr-xchromium/third_party/skia/toolchain/mac_trampolines/ar_trampoline_mac.sh3
-rwxr-xr-xchromium/third_party/skia/toolchain/mac_trampolines/clang_trampoline_mac.sh2
-rwxr-xr-xchromium/third_party/skia/toolchain/mac_trampolines/lld_trampoline_mac.sh3
-rw-r--r--chromium/third_party/skia/toolchain/utils.bzl40
-rw-r--r--chromium/third_party/skia/tools/BUILD.bazel8
-rw-r--r--chromium/third_party/skia/tools/CrashHandler.cpp7
-rw-r--r--chromium/third_party/skia/tools/HashAndEncode.cpp4
-rw-r--r--chromium/third_party/skia/tools/Stats.h4
-rw-r--r--chromium/third_party/skia/tools/ToolUtils.cpp149
-rw-r--r--chromium/third_party/skia/tools/ToolUtils.h48
-rwxr-xr-xchromium/third_party/skia/tools/android/measure_fps.py52
-rw-r--r--chromium/third_party/skia/tools/debugger/DrawCommand.cpp123
-rw-r--r--chromium/third_party/skia/tools/debugger/JsonWriteBuffer.cpp8
-rw-r--r--chromium/third_party/skia/tools/debugger/JsonWriteBuffer.h4
-rw-r--r--chromium/third_party/skia/tools/flags/BUILD.bazel7
-rw-r--r--chromium/third_party/skia/tools/flags/CommandLineFlags.cpp4
-rw-r--r--chromium/third_party/skia/tools/flags/CommonFlagsConfig.cpp28
-rw-r--r--chromium/third_party/skia/tools/fm/fm.cpp2
-rw-r--r--chromium/third_party/skia/tools/fonts/TestSVGTypeface.cpp4
-rw-r--r--chromium/third_party/skia/tools/fonts/create_test_font.cpp10
-rw-r--r--chromium/third_party/skia/tools/fonts/create_test_font_color.cpp4
-rw-r--r--chromium/third_party/skia/tools/fonts/test_font_monospace.inc8
-rw-r--r--chromium/third_party/skia/tools/fonts/test_font_sans_serif.inc8
-rw-r--r--chromium/third_party/skia/tools/fonts/test_font_serif.inc9
-rwxr-xr-xchromium/third_party/skia/tools/git-sync-deps3
-rw-r--r--chromium/third_party/skia/tools/gpu/BUILD.bazel51
-rw-r--r--chromium/third_party/skia/tools/gpu/GrTest.cpp4
-rw-r--r--chromium/third_party/skia/tools/gpu/TestContext.cpp2
-rw-r--r--chromium/third_party/skia/tools/gpu/YUVUtils.cpp4
-rw-r--r--chromium/third_party/skia/tools/gpu/gl/BUILD.bazel42
-rw-r--r--chromium/third_party/skia/tools/gpu/gl/egl/BUILD.bazel21
-rw-r--r--chromium/third_party/skia/tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp2
-rw-r--r--chromium/third_party/skia/tools/gpu/gl/glx/BUILD.bazel26
-rw-r--r--chromium/third_party/skia/tools/gpu/gl/iOS/BUILD.bazel13
-rw-r--r--chromium/third_party/skia/tools/gpu/gl/interface/interface.json510
-rw-r--r--chromium/third_party/skia/tools/gpu/gl/mac/BUILD.bazel22
-rw-r--r--chromium/third_party/skia/tools/gpu/gl/none/BUILD.bazel13
-rw-r--r--chromium/third_party/skia/tools/gpu/gl/win/BUILD.bazel22
-rw-r--r--chromium/third_party/skia/tools/gpu/mock/BUILD.bazel21
-rw-r--r--chromium/third_party/skia/tools/gpu/vk/BUILD.bazel4
-rw-r--r--chromium/third_party/skia/tools/gpu/vk/VkTestUtils.cpp10
-rw-r--r--chromium/third_party/skia/tools/graphite/GraphiteTestContext.cpp2
-rw-r--r--chromium/third_party/skia/tools/graphite/mtl/MtlTestContext.mm3
-rw-r--r--chromium/third_party/skia/tools/imgcvt.cpp2
-rw-r--r--chromium/third_party/skia/tools/random_parse_path.cpp4
-rwxr-xr-xchromium/third_party/skia/tools/rewrite_includes.py2
-rw-r--r--chromium/third_party/skia/tools/run-wasm-gm-tests/run-wasm-gm-tests.html1
-rw-r--r--chromium/third_party/skia/tools/sk_app/BUILD.bazel80
-rw-r--r--chromium/third_party/skia/tools/sk_app/GraphiteMetalWindowContext.mm9
-rw-r--r--chromium/third_party/skia/tools/sk_app/WindowContext.h2
-rw-r--r--chromium/third_party/skia/tools/sk_app/android/main_android.cpp2
-rw-r--r--chromium/third_party/skia/tools/sk_app/android/surface_glue_android.cpp2
-rw-r--r--chromium/third_party/skia/tools/sk_app/mac/BUILD.bazel30
-rw-r--r--chromium/third_party/skia/tools/sk_app/mac/Window_mac.mm2
-rw-r--r--chromium/third_party/skia/tools/sk_app/unix/BUILD.bazel14
-rw-r--r--chromium/third_party/skia/tools/sk_app/unix/Window_unix.cpp8
-rw-r--r--chromium/third_party/skia/tools/sk_app/win/Window_win.cpp2
-rw-r--r--chromium/third_party/skia/tools/sk_app/win/main_win.cpp2
-rw-r--r--chromium/third_party/skia/tools/skiaserve/Request.cpp2
-rw-r--r--chromium/third_party/skia/tools/skpbench/README.md1
-rw-r--r--chromium/third_party/skia/tools/skpbench/skpbench.cpp2
-rw-r--r--chromium/third_party/skia/tools/skpinfo.cpp2
-rwxr-xr-xchromium/third_party/skia/tools/skqp/run_skqp_exe3
-rw-r--r--chromium/third_party/skia/tools/skqp/src/skqp.cpp239
-rw-r--r--chromium/third_party/skia/tools/skqp/src/skqp.h11
-rw-r--r--chromium/third_party/skia/tools/skqp/src/skqp_GpuTestProcs.cpp179
-rw-r--r--chromium/third_party/skia/tools/sksl-precompile/SkSLPrecompile.cpp22
-rw-r--r--chromium/third_party/skia/tools/skslc/Main.cpp23
-rw-r--r--chromium/third_party/skia/tools/skui/BUILD.bazel4
-rw-r--r--chromium/third_party/skia/tools/timer/BUILD.bazel4
-rw-r--r--chromium/third_party/skia/tools/trace/ChromeTracingTracer.cpp13
-rw-r--r--chromium/third_party/skia/tools/trace/ChromeTracingTracer.h3
-rw-r--r--chromium/third_party/skia/tools/trace/EventTracingPriv.cpp16
-rw-r--r--chromium/third_party/skia/tools/trace/SkDebugfTracer.cpp4
-rw-r--r--chromium/third_party/skia/tools/trace/SkDebugfTracer.h2
-rw-r--r--chromium/third_party/skia/tools/trace/SkPerfettoTrace.cpp354
-rw-r--r--chromium/third_party/skia/tools/trace/SkPerfettoTrace.h76
-rw-r--r--chromium/third_party/skia/tools/viewer/SkSLDebuggerSlide.cpp2
-rw-r--r--chromium/third_party/skia/tools/viewer/SkSLSlide.cpp32
-rw-r--r--chromium/third_party/skia/tools/viewer/Viewer.cpp48
1600 files changed, 64476 insertions, 34000 deletions
diff --git a/chromium/third_party/skia/.bazelrc b/chromium/third_party/skia/.bazelrc
index 6492fc3b681..583e2ab4534 100644
--- a/chromium/third_party/skia/.bazelrc
+++ b/chromium/third_party/skia/.bazelrc
@@ -1,40 +1,82 @@
-# We don't have a great way to test the host system in order to use the right
-# version of the toolchain. So we need to have the user specify what their host is.
-build:clang_linux --crosstool_top=//toolchain:clang_suite_linux
-build:clang_linux --compiler=host_is_linux_amd64
+# https://bazel.build/concepts/platforms-intro#cxx
+# This forces Bazel's C++ rules use platforms to select toolchains instead of the default
+# --crosstool_top, --compiler, etc.
+build --incompatible_enable_cc_toolchain_resolution
-build:clang_mac --crosstool_top=//toolchain:clang_suite_mac
-build:clang_mac --compiler=host_is_mac_m1
+# We do not want Bazel to detect any C++ toolchains on the local machine
+# https://github.com/bazelbuild/bazel/blob/4ccc21f2f089971e5f4032397764a4be3549c40a/tools/cpp/cc_configure.bzl#L47
+build --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
+
+# We would like developers to not upload to the remote build cache, only the RBE workers themselves.
+build --remote_upload_local_results=false
+
+# This tells Bazel that the host platform can use the hermetic toolchain. This is a small lie until
+# Windows support is added.
+build --host_platform=//bazel/platform:host_with_hermetic_toolchain
+
+# Register our toolchains. We do this here, and not in WORKSPACE.bazel because
+# --extra_toolchains has priority over register_toolchains and we conditionally add some toolchains
+# for RBE.
+build --extra_toolchains=//toolchain:clang_linux_x64_toolchain
+build --extra_toolchains=//toolchain:clang_mac_x64_toolchain
+build --extra_toolchains=//toolchain:clang_mac_arm64_toolchain
# =============================================================================
# Alias to build configurations below. This makes configuring things from
# the command line easier.
+#
+# NOTE: Add new enable flags which build new source files, and need to be
+# included when exporting to other projects (CMake, GNI), to
+# //bazel/exporter/bazel_query_command.go.
build --flag_alias=fontmgr_factory=//bazel/common_config_settings:fontmgr_factory
-build --flag_alias=gpu_backend=//bazel/common_config_settings:gpu_backend
-build --flag_alias=include_decoder=//bazel/common_config_settings:include_decoder
-build --flag_alias=include_encoder=//bazel/common_config_settings:include_encoder
+build --flag_alias=gpu_backend=//src/gpu:gpu_backend
+build --flag_alias=include_decoder=//src/codec:include_decoder
+build --flag_alias=include_encoder=//src/images:include_encoder
build --flag_alias=include_fontmgr=//bazel/common_config_settings:include_fontmgr
-build --flag_alias=shaper_backend=//bazel/common_config_settings:shaper_backend
-build --flag_alias=with_gl_standard=//bazel/common_config_settings:with_gl_standard
+build --flag_alias=with_gl_standard=//src/gpu:with_gl_standard
build --flag_alias=disable_effect_serialization=no//bazel/common_config_settings:enable_effect_serialization
build --flag_alias=enable_effect_serialization=//bazel/common_config_settings:enable_effect_serialization
-build --flag_alias=disable_sksl=no//bazel/common_config_settings:enable_sksl
-build --flag_alias=enable_sksl=//bazel/common_config_settings:enable_sksl
-build --flag_alias=disable_skslc=no//bazel/common_config_settings:enable_skslc
-build --flag_alias=enable_skslc=//bazel/common_config_settings:enable_skslc
-build --flag_alias=disable_sksl_tracing=no//bazel/common_config_settings:enable_sksl_tracing
-build --flag_alias=enable_sksl_tracing=//bazel/common_config_settings:enable_sksl_tracing
+build --flag_alias=disable_gpu_test_utils=no//src/gpu:enable_gpu_test_utils
+build --flag_alias=enable_gpu_test_utils=//src/gpu:enable_gpu_test_utils
+build --flag_alias=disable_legacy_shader_context=no//src/shaders:legacy_shader_context
+build --flag_alias=enable_legacy_shader_context=//src/shaders:legacy_shader_context
+build --flag_alias=disable_pdf_backend=no//src/pdf:enable_pdf_backend
+build --flag_alias=enable_pdf_backend=//src/pdf:enable_pdf_backend
+build --flag_alias=disable_sksl=no//src/sksl:enable_sksl
+build --flag_alias=enable_sksl=//src/sksl:enable_sksl
+build --flag_alias=disable_skslc=no//src/sksl:enable_skslc
+build --flag_alias=enable_skslc=//src/sksl:enable_skslc
+build --flag_alias=disable_sksl_tracing=no//src/sksl:enable_sksl_tracing
+build --flag_alias=enable_sksl_tracing=//src/sksl:enable_sksl_tracing
+build --flag_alias=disable_svg_canvas=no//src/svg:enable_svg_canvas
+build --flag_alias=enable_svg_canvas=//src/svg:enable_svg_canvas
build --flag_alias=disable_tracing=no//bazel/common_config_settings:enable_tracing
build --flag_alias=enable_tracing=//bazel/common_config_settings:enable_tracing
-build --flag_alias=disable_vma=no//bazel/common_config_settings:use_vulkan_memory_allocator
-build --flag_alias=enable_vma=//bazel/common_config_settings:use_vulkan_memory_allocator
+build --flag_alias=disable_vma=no//src/gpu:use_vulkan_memory_allocator
+build --flag_alias=enable_vma=//src/gpu:use_vulkan_memory_allocator
+build --flag_alias=with_harfbuzz=//bazel/common_config_settings:use_harfbuzz
+build --flag_alias=with_no_harfbuzz=no//bazel/common_config_settings:use_harfbuzz
build --flag_alias=with_icu=//bazel/common_config_settings:use_icu
build --flag_alias=with_no_icu=no//bazel/common_config_settings:use_icu
# CanvasKit flags
build --flag_alias=ck_enable_fonts=//modules/canvaskit:enable_fonts
build --flag_alias=ck_disable_fonts=no//modules/canvaskit:enable_fonts
+build --flag_alias=ck_enable_canvas_polyfill=//modules/canvaskit:enable_canvas_polyfill
+build --flag_alias=ck_disable_canvas_polyfill=no//modules/canvaskit:enable_canvas_polyfill
+build --flag_alias=ck_enable_embedded_font=//modules/canvaskit:include_embedded_font
+build --flag_alias=ck_disable_embedded_font=no//modules/canvaskit:include_embedded_font
+build --flag_alias=ck_enable_matrix_js=//modules/canvaskit:include_matrix_js
+build --flag_alias=ck_disable_matrix_js=no//modules/canvaskit:include_matrix_js
+build --flag_alias=ck_enable_skottie=//modules/canvaskit:enable_skottie
+build --flag_alias=ck_disable_skottie=no//modules/canvaskit:enable_skottie
+build --flag_alias=ck_enable_skp_serialization=//modules/canvaskit:enable_skp_serialization
+build --flag_alias=ck_disable_skp_serialization=no//modules/canvaskit:enable_skp_serialization
+build --flag_alias=ck_enable_particles=//modules/canvaskit:enable_particles
+build --flag_alias=ck_disable_particles=no//modules/canvaskit:enable_particles
+build --flag_alias=ck_enable_runtime_effect=//modules/canvaskit:enable_runtime_effect
+build --flag_alias=ck_disable_runtime_effect=no//modules/canvaskit:enable_runtime_effect
# =============================================================================
# REMOTE BUILD EXECUTION
@@ -55,15 +97,8 @@ build:remote --jobs=50
build:remote --java_runtime_version=rbe_jdk
build:remote --tool_java_runtime_version=rbe_jdk
-build:remote --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
-# Platform flags:
-# The toolchain container used for execution is defined in the target indicated
-# by "extra_execution_platforms", "host_platform" and "platforms".
-# More about platforms: https://docs.bazel.build/versions/master/platforms.html
-
-# Starting with Bazel 0.27.0 strategies do not need to be explicitly
-# defined. See https://github.com/bazelbuild/bazel/issues/7480
-build:remote --define=EXECUTOR=remote
+# When a remote configuration is chosen, add "remote" to the list of spawn_strategies.
+build:remote --spawn_strategy=remote,sandboxed
# Enable remote execution so actions are performed on the remote systems.
build:remote --remote_executor=grpcs://remotebuildexecution.googleapis.com
@@ -81,6 +116,7 @@ build:remote --remote_timeout=180
# default. You can use --google_credentials=some_file.json to use a service
# account credential instead.
# See https://developers.google.com/remote-build-execution/docs/authentication
+# To authenticate, you should run gcloud auth application-default login
build:remote --google_default_credentials=true
# End of the copied RBE settings
@@ -89,17 +125,17 @@ build:remote --google_default_credentials=true
# Use the RBE instance on the skia-rbe GCP project.
build:remote --remote_instance_name projects/skia-rbe/instances/default_instance
-# These settings are specific to compiling on our Linux RBE workers. For example,
-# Use the worker pool as specified by the gce_linux_platform platform in
-# //bazel/rbe/BUILD.bazel.
+# The linxu_rbe config will build on RBE and default to compiling for linux_x64 using
+# the hermetic toolchain.
build:linux_rbe --config=remote
-# Use our hermetic toolchain instead of the clang in the toolchain.
-build:linux_rbe --crosstool_top=//toolchain:clang_suite_linux
-# We want to run on this RBE platform
-build:linux_rbe --extra_execution_platforms=//bazel/rbe:gce_linux_platform
-# On the RBE instances, this Java and C++ toolchain are available
+# On the RBE instances, we also have the Java and C++ toolchain from the Docker image available.
+# These need to come after the --extra_toolchains flags (above) that register our hermetic
+# toolchains, because we only want these backup toolchains to be used by Bazel internals,
+# if at all.
build:linux_rbe --extra_toolchains=//bazel/rbe/gce_linux/java:all
build:linux_rbe --extra_toolchains=//bazel/rbe/gce_linux/config:cc-toolchain
+# Make the RBE platform available for selection as an Execution platform.
+build:linux_rbe --extra_execution_platforms=//bazel/rbe:gce_linux_platform
# Import our specified build configurations
# https://docs.bazel.build/versions/main/best-practices.html#using-the-bazelrc-file
@@ -107,4 +143,4 @@ build:linux_rbe --extra_toolchains=//bazel/rbe/gce_linux/config:cc-toolchain
# because we anticipate that file growing large.
import %workspace%/bazel/buildrc
# Import User's custom builds if they have defined any
-try-import %workspace%/bazel/user/buildrc \ No newline at end of file
+try-import %workspace%/bazel/user/buildrc
diff --git a/chromium/third_party/skia/.bazelversion b/chromium/third_party/skia/.bazelversion
index 28cbf7c0aae..91ff57278e3 100644
--- a/chromium/third_party/skia/.bazelversion
+++ b/chromium/third_party/skia/.bazelversion
@@ -1 +1 @@
-5.0.0 \ No newline at end of file
+5.2.0
diff --git a/chromium/third_party/skia/.clang-format b/chromium/third_party/skia/.clang-format
index 27bc1a970d9..56adb9171b3 100644
--- a/chromium/third_party/skia/.clang-format
+++ b/chromium/third_party/skia/.clang-format
@@ -20,6 +20,7 @@ AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
+AllowAllConstructorInitializersOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
@@ -46,7 +47,7 @@ BraceWrapping:
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
-BreakConstructorInitializersBeforeComma: true
+BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 100
diff --git a/chromium/third_party/skia/.gn b/chromium/third_party/skia/.gn
index e64e93558e2..1d734b302b7 100644
--- a/chromium/third_party/skia/.gn
+++ b/chromium/third_party/skia/.gn
@@ -4,4 +4,5 @@ script_executable = "python3"
default_args = {
angle_standalone = false
angle_enable_msl_through_spirv = false
+ angle_use_wayland = false
}
diff --git a/chromium/third_party/skia/BUILD.bazel b/chromium/third_party/skia/BUILD.bazel
index 92c3215ffdb..1dab669a6bf 100644
--- a/chromium/third_party/skia/BUILD.bazel
+++ b/chromium/third_party/skia/BUILD.bazel
@@ -1,11 +1,11 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy", "gazelle")
+load("//bazel:macros.bzl", "exports_files_legacy", "gazelle", "skia_cc_library")
licenses(["notice"])
exports_files_legacy()
# This target exposes the Skia public API. It is what external clients should use.
-cc_library(
+skia_cc_library(
name = "skia_public",
srcs = [
"//include:private_hdrs",
@@ -22,7 +22,7 @@ cc_library(
# This target exposes headers beyond the public, supported API. It is intended to be
# used by Skia's tests and tooling.
-cc_library(
+skia_cc_library(
name = "skia_internal",
srcs = [
"//src:srcs",
@@ -34,6 +34,7 @@ cc_library(
],
visibility = [
"//dm:__subpackages__",
+ "//modules:__subpackages__",
"//tests:__subpackages__",
"//tools:__subpackages__",
],
@@ -45,3 +46,13 @@ cc_library(
# gazelle:prefix go.skia.org/skia
gazelle(name = "gazelle")
+
+###########
+# Mockery #
+###########
+
+alias(
+ name = "mockery",
+ actual = "@com_github_vektra_mockery_v2//:v2",
+ visibility = ["//visibility:public"],
+)
diff --git a/chromium/third_party/skia/BUILD.gn b/chromium/third_party/skia/BUILD.gn
index 535ddeccc4e..71d19dd958a 100644
--- a/chromium/third_party/skia/BUILD.gn
+++ b/chromium/third_party/skia/BUILD.gn
@@ -45,6 +45,9 @@ config("skia_public") {
if (skia_enable_sksl) {
defines += [ "SK_ENABLE_SKSL" ]
}
+ if (skia_enable_precompile) {
+ defines += [ "SK_ENABLE_PRECOMPILE" ]
+ }
if (is_fuchsia) {
defines += fuchsia_defines
}
@@ -64,6 +67,9 @@ config("skia_public") {
if (!skia_enable_skgpu_v1) {
defines += [ "SK_GPU_V1=0" ]
}
+ if (skia_use_perfetto) {
+ defines += [ "SK_USE_PERFETTO" ]
+ }
# Some older versions of the Clang toolchain change the visibility of
# symbols decorated with API_AVAILABLE macro to be visible. Users of such
@@ -632,12 +638,14 @@ if (skia_compile_modules || skia_compile_sksl_tests) {
# Copy the module source files into the out directory.
copy("sksl_pre_includes") {
sources = [
+ "src/sksl/sksl_compute.sksl",
"src/sksl/sksl_frag.sksl",
"src/sksl/sksl_gpu.sksl",
"src/sksl/sksl_graphite_frag.sksl",
"src/sksl/sksl_graphite_vert.sksl",
"src/sksl/sksl_public.sksl",
"src/sksl/sksl_rt_shader.sksl",
+ "src/sksl/sksl_shared.sksl",
"src/sksl/sksl_vert.sksl",
]
outputs = [ "$root_out_dir/{{source_file_part}}" ]
@@ -975,23 +983,29 @@ optional("gpu") {
if (skia_use_dawn) {
public_defines += [ "SK_DAWN" ]
sources += skia_dawn_sources
- public_deps += [ "//third_party/externals/dawn/include/dawn:cpp_headers" ]
- deps += [
- "//third_party/externals/dawn/src/dawn:cpp",
- "//third_party/externals/dawn/src/dawn:proc",
- ]
- if (dawn_enable_d3d12 || dawn_enable_desktop_gl || dawn_enable_metal ||
- dawn_enable_opengles || dawn_enable_vulkan) {
- deps += [ "//third_party/externals/dawn/src/dawn/native" ]
- }
- if (dawn_enable_d3d12) {
- libs += [
- "d3d12.lib",
- "dxgi.lib",
- "d3dcompiler.lib",
+
+ # When building for WASM, the WebGPU headers are provided by Emscripten. For native builds we
+ # have to depend on Dawn directly.
+ if (!skia_use_webgpu) {
+ public_deps += [ "//third_party/externals/dawn/include/dawn:cpp_headers" ]
+ deps += [
+ "//third_party/externals/dawn/src/dawn:cpp",
+ "//third_party/externals/dawn/src/dawn:proc",
]
- } else if (dawn_enable_metal) {
- frameworks += [ "Metal.framework" ]
+
+ if (dawn_enable_d3d12 || dawn_enable_desktop_gl || dawn_enable_metal ||
+ dawn_enable_opengles || dawn_enable_vulkan) {
+ deps += [ "//third_party/externals/dawn/src/dawn/native" ]
+ }
+ if (dawn_enable_d3d12) {
+ libs += [
+ "d3d12.lib",
+ "dxgi.lib",
+ "d3dcompiler.lib",
+ ]
+ } else if (dawn_enable_metal) {
+ frameworks += [ "Metal.framework" ]
+ }
}
}
@@ -1064,6 +1078,15 @@ optional("heif") {
sources = [ "src/codec/SkHeifCodec.cpp" ]
}
+optional("avif") {
+ enabled = skia_use_libavif
+ public_defines = [ "SK_CODEC_DECODES_AVIF" ]
+
+ deps = [ "//third_party/libavif" ]
+
+ sources = [ "src/codec/SkAvifCodec.cpp" ]
+}
+
optional("jpeg_decode") {
enabled = skia_use_libjpeg_turbo_decode
public_defines = [ "SK_CODEC_DECODES_JPEG" ]
@@ -1196,21 +1219,6 @@ optional("raw") {
sources = [ "src/codec/SkRawCodec.cpp" ]
}
-import("third_party/skcms/skcms.gni")
-skia_source_set("skcms") {
- cflags = []
- if (!is_win || is_clang) {
- cflags += [
- "-w",
- "-std=c11",
- ]
- }
-
- public = [ "include/third_party/skcms/skcms.h" ]
- include_dirs = [ "include/third_party/skcms" ]
- sources = rebase_path(skcms_sources, ".", "third_party/skcms")
-}
-
optional("typeface_freetype") {
enabled = skia_use_freetype
@@ -1263,11 +1271,6 @@ optional("xml") {
optional("skvm_jit") {
enabled = skia_enable_skvm_jit_when_possible
public_defines = [ "SKVM_JIT_WHEN_POSSIBLE" ]
- if (skia_vtune_path != "") {
- public_defines += [ "SKVM_JIT_VTUNE" ]
- public_include_dirs = [ "$skia_vtune_path/include" ]
- libs = [ "$skia_vtune_path/lib64/jitprofiling.lib" ]
- }
}
if (skia_enable_gpu && skia_generate_workarounds) {
@@ -1311,7 +1314,6 @@ skia_component("skia") {
":gpu",
":graphite",
":pdf",
- ":skcms",
":xps",
]
@@ -1319,6 +1321,7 @@ skia_component("skia") {
":android_utils",
":arm64",
":armv7",
+ ":avif",
":avx",
":crc32",
":fontmgr_factory",
@@ -1343,6 +1346,7 @@ skia_component("skia") {
":webp_encode",
":wuffs",
":xml",
+ "modules/skcms",
]
public = skia_core_public
@@ -1400,6 +1404,11 @@ skia_component("skia") {
}
}
+ if (skia_enable_precompile) {
+ public += skia_precompile_public
+ sources += skia_precompile_sources
+ }
+
if (skia_build_for_debugger) {
defines += [ "SK_BUILD_FOR_DEBUGGER" ]
}
@@ -1604,7 +1613,6 @@ if (skia_enable_tools) {
skia_public_includes = [
"client_utils/android",
"include/android",
- "include/c",
"include/codec",
"include/config",
"include/core",
@@ -1699,7 +1707,7 @@ if (skia_enable_tools) {
]
if (skia_use_dawn) {
- deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
+ deps += [ "//third_party/externals/dawn/include/dawn:headers" ]
}
}
@@ -1886,7 +1894,7 @@ if (skia_enable_tools) {
sources += [ "tools/gpu/d3d/D3DTestUtils.cpp" ]
}
if (skia_use_dawn) {
- public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
+ public_deps += [ "//third_party/externals/dawn/include/dawn:headers" ]
sources += [ "tools/gpu/dawn/DawnTestContext.cpp" ]
if (is_clang) {
cflags_cc = [ "-Wno-microsoft-cast" ]
@@ -1951,6 +1959,14 @@ if (skia_enable_tools) {
"tools/trace/SkDebugfTracer.cpp",
"tools/trace/SkDebugfTracer.h",
]
+ if (skia_use_perfetto) {
+ deps += [ "//third_party/perfetto" ]
+ sources += [
+ "tools/trace/SkPerfettoTrace.cpp",
+ "tools/trace/SkPerfettoTrace.h",
+ ]
+ defines = [ "SK_USE_PERFETTO" ]
+ }
}
test_lib("tool_utils") {
@@ -2074,6 +2090,7 @@ if (skia_enable_tools) {
test_lib("test") {
sources = [
+ "tests/CtsEnforcement.cpp",
"tests/Test.cpp",
"tests/Test.h",
"tests/TestHarness.cpp",
@@ -2112,6 +2129,9 @@ if (skia_enable_tools) {
if (!skia_enable_skgpu_v1) {
sources -= skgpu_v1_tests_sources
}
+ if (skia_enable_precompile) {
+ sources += precompile_tests_sources
+ }
deps = [
":flags",
":fontmgr_android_tests",
@@ -2157,6 +2177,12 @@ if (skia_enable_tools) {
test_app("skottie_tool") {
deps = [ "modules/skottie:tool" ]
}
+ test_app("skottie_tool_cpu") {
+ deps = [ "modules/skottie:tool_cpu" ]
+ }
+ test_app("skottie_tool_gpu") {
+ deps = [ "modules/skottie:tool_gpu" ]
+ }
}
test_app("svg_tool") {
deps = [ "modules/svg:tool" ]
@@ -2201,8 +2227,8 @@ if (skia_enable_tools) {
test_app("imgcvt") {
sources = [ "tools/imgcvt.cpp" ]
deps = [
- ":skcms",
":skia",
+ "modules/skcms",
]
}
test_app("fm") {
@@ -2511,9 +2537,9 @@ if (skia_enable_tools) {
testonly = true
public_configs = [ ":skia_private" ]
sources = [
- "dm/DMGpuTestProcs.cpp",
"tools/skqp/src/skqp.cpp",
"tools/skqp/src/skqp.h",
+ "tools/skqp/src/skqp_GpuTestProcs.cpp",
]
deps = [
":gm",
@@ -3356,9 +3382,3 @@ if (is_ios && skia_enable_skottie && !skia_enable_flutter_defines) {
deps = [ "tools/skottie_ios_app" ]
}
}
-
-skia_executable("skia_c_api_example") {
- sources = [ "experimental/c-api-example/skia-c-example.c" ]
- include_dirs = [ "." ]
- deps = [ ":skia" ]
-}
diff --git a/chromium/third_party/skia/DEPS b/chromium/third_party/skia/DEPS
index 43a33bfe7d9..ccb6a256295 100644
--- a/chromium/third_party/skia/DEPS
+++ b/chromium/third_party/skia/DEPS
@@ -4,50 +4,54 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling different
# dependencies without interference from each other.
- 'sk_tool_revision': 'git_revision:1b7947e28c99aacd0ff1208d5c61e0650b5a7aef',
+ 'sk_tool_revision': 'git_revision:bff0baff15ff421160129c70d8af2a91d0e28d4c',
}
deps = {
"buildtools" : "https://chromium.googlesource.com/chromium/src/buildtools.git@b138e6ce86ae843c42a1a08f37903207bebcca75",
- "third_party/externals/angle2" : "https://chromium.googlesource.com/angle/angle.git@48b928d98fc888b9887de814ad49fb9dc11910a6",
+ "third_party/externals/angle2" : "https://chromium.googlesource.com/angle/angle.git@c6c7ff3c45bb4cc529bcbb03f1a217310e872ad1",
"third_party/externals/brotli" : "https://skia.googlesource.com/external/github.com/google/brotli.git@e61745a6b7add50d380cfd7d3883dd6c62fc2c71",
"third_party/externals/d3d12allocator" : "https://skia.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator.git@169895d529dfce00390a20e69c2f516066fe7a3b",
# Dawn requires jinja2 and markupsafe for the code generator, tint for SPIRV compilation, and abseil for string formatting.
# When the Dawn revision is updated these should be updated from the Dawn DEPS as well.
- "third_party/externals/dawn" : "https://dawn.googlesource.com/dawn.git@5fb759f6e76a827f19ed6665b77aaeaa4cc4bbf2",
+ "third_party/externals/dawn" : "https://dawn.googlesource.com/dawn.git@e0bf254f720e3c921afbd5fcd1df3f2497256332",
"third_party/externals/jinja2" : "https://chromium.googlesource.com/chromium/src/third_party/jinja2@ee69aa00ee8536f61db6a451f3858745cf587de6",
"third_party/externals/markupsafe" : "https://chromium.googlesource.com/chromium/src/third_party/markupsafe@0944e71f4b2cb9a871bcbe353f95e889b64a611a",
"third_party/externals/abseil-cpp" : "https://skia.googlesource.com/external/github.com/abseil/abseil-cpp.git@c5a424a2a21005660b182516eb7a079cd8021699",
"third_party/externals/dng_sdk" : "https://android.googlesource.com/platform/external/dng_sdk.git@c8d0c9b1d16bfda56f15165d39e0ffa360a11123",
"third_party/externals/egl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/EGL-Registry@a0bca08de07c7d7651047bedc0b653cfaaa4f2ae",
- "third_party/externals/emsdk" : "https://skia.googlesource.com/external/github.com/emscripten-core/emsdk.git@e34773a0d1a2f32dd3ba90d408a30fae89aa3c5a",
+ "third_party/externals/emsdk" : "https://skia.googlesource.com/external/github.com/emscripten-core/emsdk.git@4a48a752e6a8bef6f222622f2b4926d5eb3bdeb3",
"third_party/externals/expat" : "https://chromium.googlesource.com/external/github.com/libexpat/libexpat.git@a28238bdeebc087071777001245df1876a11f5ee",
- "third_party/externals/freetype" : "https://chromium.googlesource.com/chromium/src/third_party/freetype2.git@c26872ed59cba3af2f407b5eefc92fcec92aa52b",
- "third_party/externals/harfbuzz" : "https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git@858570b1d9912a1b746ab39fbe62a646c4f7a5b1",
+ "third_party/externals/freetype" : "https://chromium.googlesource.com/chromium/src/third_party/freetype2.git@7cd3f19f21cc9d600e3b765ef2058474d20233e2",
+ "third_party/externals/harfbuzz" : "https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git@f1f2be776bcd994fa9262622e1a7098a066e5cf7",
"third_party/externals/highway" : "https://chromium.googlesource.com/external/github.com/google/highway.git@424360251cdcfc314cfc528f53c872ecd63af0f0",
"third_party/externals/icu" : "https://chromium.googlesource.com/chromium/deps/icu.git@a0718d4f121727e30b8d52c7a189ebf5ab52421f",
"third_party/externals/imgui" : "https://skia.googlesource.com/external/github.com/ocornut/imgui.git@55d35d8387c15bf0cfd71861df67af8cfbda7456",
+ "third_party/externals/libavif" : "https://github.com/AOMediaCodec/libavif.git@f49462dc93784bf34148715eee36ab6697ca0b35",
+ "third_party/externals/libgav1" : "https://chromium.googlesource.com/codecs/libgav1.git@0fb779c1e169fe6c229cd1fa9cc6ea6feeb441da",
"third_party/externals/libgifcodec" : "https://skia.googlesource.com/libgifcodec@fd59fa92a0c86788dcdd84d091e1ce81eda06a77",
"third_party/externals/libjpeg-turbo" : "https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@22f1a22c99e9dde8cd3c72ead333f425c5a7aa77",
"third_party/externals/libjxl" : "https://chromium.googlesource.com/external/gitlab.com/wg1/jpeg-xl.git@a205468bc5d3a353fb15dae2398a101dff52f2d3",
"third_party/externals/libpng" : "https://skia.googlesource.com/third_party/libpng.git@386707c6d19b974ca2e3db7f5c61873813c6fe44",
- "third_party/externals/libwebp" : "https://chromium.googlesource.com/webm/libwebp.git@20ef03ee351d4ff03fc5ff3ec4804a879d1b9d5c",
+ "third_party/externals/libwebp" : "https://chromium.googlesource.com/webm/libwebp.git@a8e366166ab57bb1b4aaf6739fc775515bc71b51",
+ "third_party/externals/libyuv" : "https://chromium.googlesource.com/libyuv/libyuv.git@d248929c059ff7629a85333699717d7a677d8d96",
"third_party/externals/microhttpd" : "https://android.googlesource.com/platform/external/libmicrohttpd@748945ec6f1c67b7efc934ab0808e1d32f2fb98d",
"third_party/externals/oboe" : "https://chromium.googlesource.com/external/github.com/google/oboe.git@b02a12d1dd821118763debec6b83d00a8a0ee419",
"third_party/externals/opengl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/OpenGL-Registry@14b80ebeab022b2c78f84a573f01028c96075553",
+ "third_party/externals/perfetto" : "https://android.googlesource.com/platform/external/perfetto@93885509be1c9240bc55fa515ceb34811e54a394",
"third_party/externals/piex" : "https://android.googlesource.com/platform/external/piex.git@bb217acdca1cc0c16b704669dd6f91a1b509c406",
- "third_party/externals/rive" : "https://skia.googlesource.com/external/github.com/rive-app/rive-cpp.git@d9a4b488a4b3d622fe8721a3126b248bdc100e37",
+ "third_party/externals/rive" : "https://skia.googlesource.com/external/github.com/rive-app/rive-cpp.git@c9ff7391efb75e81c3670ddca77a5893538a26fa",
"third_party/externals/sfntly" : "https://chromium.googlesource.com/external/github.com/googlei18n/sfntly.git@b55ff303ea2f9e26702b514cf6a3196a2e3e2974",
- "third_party/externals/swiftshader" : "https://swiftshader.googlesource.com/SwiftShader@f1a62bb45663f127bc75348a6e3d90508469cef3",
+ "third_party/externals/swiftshader" : "https://swiftshader.googlesource.com/SwiftShader@1c3dfde53353d5e13ca25eb52aa208d450b5e980",
"third_party/externals/vulkanmemoryallocator" : "https://chromium.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator@7de5cc00de50e71a3aab22dea52fbb7ff4efceb6",
# vulkan-deps is a meta-repo containing several interdependent Khronos Vulkan repositories.
# When the vulkan-deps revision is updated, those repos (spirv-*, vulkan-*) should be updated as well.
- "third_party/externals/vulkan-deps" : "https://chromium.googlesource.com/vulkan-deps@22255d13ec181a9ffed3cc3152f54b53c77a9ab8",
- "third_party/externals/spirv-cross" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/SPIRV-Cross@a97bbc24c5bae15d3d2eaa2865c122e8d3be1b67",
- "third_party/externals/spirv-headers" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Headers.git@36c0c1596225e728bd49abb7ef56a3953e7ed468",
- "third_party/externals/spirv-tools" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Tools.git@fad68a75519fe8c2dddbb9b3b845fd1bb0e07d4c",
- "third_party/externals/vulkan-headers" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Headers@ec9b96aae53e152f6812e66fa43757c1256369a0",
- "third_party/externals/vulkan-tools" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Tools@ef9db7a8ec52f6c56158d83f5d57ef388c1abec1",
+ "third_party/externals/vulkan-deps" : "https://chromium.googlesource.com/vulkan-deps@a1ba8ef3ad46339e5f413facc1b84dfbaf088dc4",
+ "third_party/externals/spirv-cross" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/SPIRV-Cross@61c603f3baa5270e04bcfb6acf83c654e3c57679",
+ "third_party/externals/spirv-headers" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Headers.git@0bcc624926a25a2a273d07877fd25a6ff5ba1cfb",
+ "third_party/externals/spirv-tools" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Tools.git@0073a1fa36f7c52ad3d58059cb5d5de8efa825ad",
+ "third_party/externals/vulkan-headers" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Headers@715673702f5b18ffb8e5832e67cf731468d32ac6",
+ "third_party/externals/vulkan-tools" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Tools@d55c7aaf041af331bee8c22fb448a6ff4c797f73",
#"third_party/externals/v8" : "https://chromium.googlesource.com/v8/v8.git@5f1ae66d5634e43563b2d25ea652dfb94c31a3b4",
"third_party/externals/wuffs" : "https://skia.googlesource.com/external/github.com/google/wuffs-mirror-release-c.git@600cd96cf47788ee3a74b40a6028b035c9fd6a61",
"third_party/externals/zlib" : "https://chromium.googlesource.com/chromium/src/third_party/zlib@c876c8f87101c5a75f6014b0f832499afeb65b73",
diff --git a/chromium/third_party/skia/PRESUBMIT.py b/chromium/third_party/skia/PRESUBMIT.py
index 68450505f43..734de99a33d 100644
--- a/chromium/third_party/skia/PRESUBMIT.py
+++ b/chromium/third_party/skia/PRESUBMIT.py
@@ -121,7 +121,9 @@ def _CopyrightChecks(input_api, output_api, source_file_filter=None):
for affected_file in input_api.AffectedSourceFiles(source_file_filter):
if ('third_party/' in affected_file.LocalPath() or
'tests/sksl/' in affected_file.LocalPath() or
- 'bazel/rbe/' in affected_file.LocalPath()):
+ 'bazel/rbe/' in affected_file.LocalPath() or
+ 'bazel/external/' in affected_file.LocalPath() or
+ 'bazel/exporter/interfaces/mocks/' in affected_file.LocalPath()):
continue
contents = input_api.ReadFile(affected_file, 'rb')
if not re.search(copyright_pattern, contents):
@@ -217,24 +219,6 @@ class _WarningsAsErrors():
self.output_api.PresubmitPromptWarning = self.old_warning
-def _CheckDEPSValid(input_api, output_api):
- """Ensure that DEPS contains valid entries."""
- results = []
- script = os.path.join('infra', 'bots', 'check_deps.py')
- relevant_files = ('DEPS', script)
- for f in input_api.AffectedFiles():
- if f.LocalPath() in relevant_files:
- break
- else:
- return results
- cmd = ['python3', script]
- try:
- subprocess.check_output(cmd, stderr=subprocess.STDOUT)
- except subprocess.CalledProcessError as e:
- results.append(output_api.PresubmitError(e.output))
- return results
-
-
def _RegenerateAllExamplesCPP(input_api, output_api):
"""Regenerates all_examples.cpp if an example was added or deleted."""
if not any(f.LocalPath().startswith('docs/examples/')
@@ -266,7 +250,7 @@ def _CheckBazelBUILDFiles(input_api, output_api):
is_bazel = affected_file_path.endswith('BUILD.bazel')
# This list lines up with the one in autoroller_lib.py (see G3).
excluded_paths = ["infra/", "bazel/rbe/", "bazel/external/", "bazel/common_config_settings/",
- "modules/canvaskit/go/", "experimental/"]
+ "modules/canvaskit/go/", "experimental/", "bazel/platform", "third_party/"]
is_excluded = any(affected_file_path.startswith(n) for n in excluded_paths)
if is_bazel and not is_excluded:
with open(affected_file_path, 'r') as file:
@@ -282,11 +266,11 @@ def _CheckBazelBUILDFiles(input_api, output_api):
('%s needs to have\nlicenses(["notice"])\nimmediately after ' +
'the load() calls to comply with G3 policies.') % affected_file_path
))
- if 'cc_library(' in contents and '"cc_library"' not in contents:
+ if 'cc_library(' in contents and '"skia_cc_library"' not in contents:
results.append(output_api.PresubmitError(
- ('%s needs load cc_library from macros.bzl instead of using the ' +
+ ('%s needs to load skia_cc_library from macros.bzl instead of using the ' +
'native one. This allows us to build differently for G3.\n' +
- 'Add "cc_library" to load("//bazel:macros.bzl", ...)')
+ 'Add "skia_cc_library" to load("//bazel:macros.bzl", ...)')
% affected_file_path
))
return results
@@ -356,7 +340,7 @@ def _CheckBuildifier(input_api, output_api):
for affected_file in input_api.AffectedFiles(include_deletes=False):
affected_file_path = affected_file.LocalPath()
if affected_file_path.endswith('BUILD.bazel') or affected_file_path.endswith('.bzl'):
- if not affected_file_path.endswith('public.bzl'):
+ if not affected_file_path.endswith('public.bzl') and not affected_file_path.endswith('go_repositories.bzl'):
files.append(affected_file_path)
if not files:
return []
@@ -399,7 +383,6 @@ def _CommonChecks(input_api, output_api):
results.extend(_IfDefChecks(input_api, output_api))
results.extend(_CopyrightChecks(input_api, output_api,
source_file_filter=sources))
- results.extend(_CheckDEPSValid(input_api, output_api))
results.extend(_CheckIncludesFormatted(input_api, output_api))
results.extend(_CheckGNFormatted(input_api, output_api))
results.extend(_CheckGitConflictMarkers(input_api, output_api))
diff --git a/chromium/third_party/skia/RELEASE_NOTES.txt b/chromium/third_party/skia/RELEASE_NOTES.txt
index b9c448c5c2b..f6972a365bc 100644
--- a/chromium/third_party/skia/RELEASE_NOTES.txt
+++ b/chromium/third_party/skia/RELEASE_NOTES.txt
@@ -2,12 +2,40 @@ Skia Graphics Release Notes
This file includes a list of high level updates for each milestone release.
+Milestone 106
+-------------
+ * sk_sp is marked with the [[clang::trivial_abi]] attribute where supported.
+ * SkMesh API: Allows a user to draw a vertex mesh with custom attributes and
+ varyings using SkSL. Mesh data (vertex and index) can be created on a
+ GrDirectContext to avoid re-uploading data per draw. Currently does not
+ work with SkPicture or any backend but GPU.
+ * Added SkColorFilters::Blend(const SkColor4f&, sk_sp<SkColorSpace>, SkBlendMode) to
+ complement the existing SkColorFilters::Blend(SkColor, SkBlendMode) factory.
+ * The experimental C API was removed.
+ * Added support for AVIF decoding using libavif.
+
+* * *
+
Milestone 104
-------------
+ * New functions SkBitmap::getColor4f and SkPixmap::getColor4f return float colors.
* SkRuntimeEffect takes and returns a const SkData.
* SkRasterHandleAllocator::MakeCanvas now takes optional SkSurfaceProps.
* SkImage::MakeFromPicture and SkImageGenerator::MakeFromPicture now take an optional
SkSurfaceProps to use when rasterizing the picture.
+ * SkRuntimeEffect::Uniform now stores the uniform name as a string_view, rather than a
+ SkString. Related methods SkRuntimeEffect::findUniform and SkRuntimeEffectBuilder::uniform
+ also take std::string_view instead of const char*.
+ * SkRuntimeEffect::Child now stores the child name as a string_view, rather than a SkString.
+ Related methods SkRuntimeEffect::findChild and SkRuntimeEffectBuilder::child also take
+ std::string_view instead of const char*. Also, SkImageFilters::RuntimeShader now takes the
+ child name(s) as std::string_view instead of const char*.
+ * skcms.h has been relocated to //modules/skcms/skcms.h (was //include/third_party/skcms/skcms.h)
+ * New functions SkCanvas::getBaseProps and SkCanvas::getTopProps; SkCanvas::getBaseProps is a
+ direct replacement for the (now deprecated) SkCanvas::getProps function, while getTopProps is
+ a variant that returns the SkSurfaceProps that are active in the current layer.
+ * New function SkEventTracer::newTracingSection(const char* name) enables splitting traces up
+ into different sections for a selection of backend tracing frameworks (Perfetto, SkDebugf).
* * *
diff --git a/chromium/third_party/skia/WORKSPACE.bazel b/chromium/third_party/skia/WORKSPACE.bazel
index 8985f50d120..ad94e2199e6 100644
--- a/chromium/third_party/skia/WORKSPACE.bazel
+++ b/chromium/third_party/skia/WORKSPACE.bazel
@@ -2,18 +2,18 @@ workspace(name = "skia")
load("//toolchain:download_toolchains.bzl", "download_toolchains_for_skia")
-download_toolchains_for_skia("clang_linux_amd64", "clang_mac_m1")
+download_toolchains_for_skia("clang_linux_amd64", "clang_mac")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# See https://github.com/emscripten-core/emsdk/tree/85d27a4a2a60d591613a305b14ae438c2bb3ce11/bazel#setup-instructions
http_archive(
name = "emsdk",
- sha256 = "99de90a1827044c5430b926db947bcb266c8bdab1a0f20fe34a62431d9174376",
- strip_prefix = "emsdk-3.1.9/bazel",
+ sha256 = "74c7c54b3544555ec38d1e9dcc7e90b9f49ed0e04f2cc3fd44663c598af24124",
+ strip_prefix = "emsdk-3.1.15/bazel",
urls = [
- "https://github.com/emscripten-core/emsdk/archive/refs/tags/3.1.9.tar.gz",
- "https://storage.googleapis.com/skia-world-readable/bazel/99de90a1827044c5430b926db947bcb266c8bdab1a0f20fe34a62431d9174376.tar.gz",
+ "https://github.com/emscripten-core/emsdk/archive/refs/tags/3.1.15.tar.gz",
+ "https://storage.googleapis.com/skia-world-readable/bazel/74c7c54b3544555ec38d1e9dcc7e90b9f49ed0e04f2cc3fd44663c598af24124.tar.gz",
],
)
@@ -61,11 +61,11 @@ bazel_toolchains_repositories()
# https://github.com/bazelbuild/rules_python
http_archive(
name = "rules_python",
- sha256 = "9fcf91dbcc31fde6d1edb15f117246d912c33c36f44cf681976bd886538deba6",
- strip_prefix = "rules_python-0.8.0",
+ sha256 = "5fa3c738d33acca3b97622a13a741129f67ef43f5fdfcec63b29374cc0574c29",
+ strip_prefix = "rules_python-0.9.0",
urls = [
- "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.8.0.tar.gz",
- "https://storage.googleapis.com/skia-world-readable/bazel/9fcf91dbcc31fde6d1edb15f117246d912c33c36f44cf681976bd886538deba6.tar.gz",
+ "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.9.0.tar.gz",
+ "https://storage.googleapis.com/skia-world-readable/bazel/5fa3c738d33acca3b97622a13a741129f67ef43f5fdfcec63b29374cc0574c29.tar.gz",
],
)
@@ -117,7 +117,7 @@ go_repositories()
go_rules_dependencies()
-go_register_toolchains(version = "1.17.2")
+go_register_toolchains(version = "1.18")
gazelle_dependencies(go_repository_default_config = "//:WORKSPACE.bazel")
@@ -218,6 +218,67 @@ new_local_repository(
)
new_local_repository(
+ name = "expat",
+ build_file = "bazel/external/expat/BUILD.bazel",
+ path = "third_party/externals/expat",
+ workspace_file_content = "",
+)
+
+new_local_repository(
+ name = "freetype",
+ build_file = "bazel/external/freetype/BUILD.bazel",
+ path = "third_party/externals/freetype",
+ workspace_file_content = "",
+)
+
+# In order to copy the Freetype configurations into the checked out Freetype folder,
+# it is easiest to treat them as a third-party dependency from the perspective of Freetype.
+# To do that, we put them in their own Bazel workspace and then have our injected BUILD.bazel
+# for Freetype reference this workspace.
+local_repository(
+ name = "freetype_config",
+ path = "bazel/external/freetype/config",
+)
+
+new_local_repository(
+ name = "harfbuzz",
+ build_file = "bazel/external/harfbuzz/BUILD.bazel",
+ path = "third_party/externals/harfbuzz",
+ workspace_file_content = "",
+)
+
+local_repository(
+ name = "harfbuzz_config",
+ path = "bazel/external/harfbuzz/config",
+)
+
+new_local_repository(
+ name = "icu",
+ build_file = "bazel/external/icu/BUILD.bazel",
+ path = "third_party/externals/icu",
+ workspace_file_content = "",
+)
+
+local_repository(
+ name = "icu_utils",
+ path = "bazel/external/icu/utils",
+)
+
+new_local_repository(
+ name = "libavif",
+ build_file = "bazel/external/libavif/BUILD.bazel",
+ path = "third_party/externals/libavif",
+ workspace_file_content = "",
+)
+
+new_local_repository(
+ name = "libgav1",
+ build_file = "bazel/external/libgav1/BUILD.bazel",
+ path = "third_party/externals/libgav1",
+ workspace_file_content = "",
+)
+
+new_local_repository(
name = "libjpeg_turbo",
build_file = "bazel/external/libjpeg_turbo/BUILD.bazel",
path = "third_party/externals/libjpeg-turbo",
@@ -239,6 +300,27 @@ new_local_repository(
)
new_local_repository(
+ name = "libyuv",
+ build_file = "bazel/external/libyuv/BUILD.bazel",
+ path = "third_party/externals/libyuv",
+ workspace_file_content = "",
+)
+
+new_local_repository(
+ name = "spirv_cross",
+ build_file = "bazel/external/spirv_cross/BUILD.bazel",
+ path = "third_party/externals/spirv-cross",
+ workspace_file_content = "",
+)
+
+new_local_repository(
+ name = "perfetto",
+ build_file = "bazel/external/perfetto/BUILD.bazel",
+ path = "third_party/externals/perfetto",
+ workspace_file_content = "",
+)
+
+new_local_repository(
name = "piex",
build_file = "bazel/external/piex/BUILD.bazel",
path = "third_party/externals/piex",
diff --git a/chromium/third_party/skia/bazel/BUILD.bazel b/chromium/third_party/skia/bazel/BUILD.bazel
index 8d18b12957a..c40625de8fe 100644
--- a/chromium/third_party/skia/bazel/BUILD.bazel
+++ b/chromium/third_party/skia/bazel/BUILD.bazel
@@ -1,24 +1,24 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy", "select_multi")
+load("//bazel:macros.bzl", "exports_files_legacy", "select_multi", "skia_defines")
+load("//bazel:defines.bzl", "EXTRA_DEFINES")
licenses(["notice"])
exports_files_legacy()
GENERAL_DEFINES = [
- # The following comment is load-bearing. It will be replace via regex when we build for Google3
- # Do not remove it or we won't be able to properly define SK_BUILD_FOR_GOOGLE3
- # REPLACE_WHEN_BUILDING_IN_GOOGLE3
"SK_HAS_ANDROID_CODEC",
"SKIA_IMPLEMENTATION=1",
+ "SK_GAMMA_APPLY_TO_A8",
] + select({
"//bazel/common_config_settings:debug_build": [
"SK_DEBUG",
],
"//bazel/common_config_settings:release_build": [
"SK_RELEASE",
+ "NDEBUG",
],
- "//conditions:default": [
- "SK_RELEASE",
+ "//bazel/common_config_settings:fast_build": [
+ "SK_DEBUG",
],
}) + select({
"//bazel/common_config_settings:enable_tracing_false": ["SK_DISABLE_TRACING"],
@@ -27,13 +27,13 @@ GENERAL_DEFINES = [
"//bazel/common_config_settings:enable_effect_serialization_false": ["SK_DISABLE_EFFECT_DESERIALIZATION"],
"//conditions:default": [],
}) + select({
- "//bazel/common_config_settings:is_skia_dev_build_true": [
+ "//src/gpu:enable_gpu_test_utils_true": [
"GR_TEST_UTILS=1",
"SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
],
"//conditions:default": [],
}) + select({
- "//bazel/common_config_settings:enable_skslc_true": [
+ "//src/sksl:enable_skslc_true": [
"SKSL_STANDALONE",
"SK_DISABLE_TRACING",
"SK_ENABLE_SPIRV_CROSS",
@@ -42,43 +42,52 @@ GENERAL_DEFINES = [
],
"//conditions:default": [],
}) + select({
- "//bazel/common_config_settings:enable_sksl_tracing_true": [
- "SKSL_ENABLE_TRACING",
- ],
+ "//src/sksl:enable_sksl_tracing_true": ["SKSL_ENABLE_TRACING"],
"//conditions:default": [],
+}) + select({
+ "//src/sksl:needs_sksl": ["SK_ENABLE_SKSL"],
+ "//conditions:default": [],
+}) + select({
+ "//src/pdf:enable_pdf_backend_true": ["SK_SUPPORT_PDF"],
+ "//conditions:default": [],
+}) + select({
+ "//src/shaders:legacy_shader_context_true": [], # This is the default in SkTypes.h
+ "//src/shaders:legacy_shader_context_false": ["SK_DISABLE_LEGACY_SHADERCONTEXT"],
})
-GPU_DEFINES = select({
- "//bazel/common_config_settings:gl_backend": [
+GPU_DEFINES = select_multi({
+ "//src/gpu:gl_backend": [
"SK_GL",
"SK_SUPPORT_GPU=1",
],
- "//bazel/common_config_settings:vulkan_backend": [
+ "//src/gpu:vulkan_backend": [
"SK_VULKAN",
"SK_SUPPORT_GPU=1",
],
- "//bazel/common_config_settings:dawn_backend": [
+ "//src/gpu:dawn_backend": [
"SK_DAWN",
"SK_SUPPORT_GPU=1",
"VK_USE_PLATFORM_XCB_KHR", # TODO(kjlubick) support dawn's dawn_enable_vulkan etc
],
+}) + select({
+ "//src/gpu:has_gpu_backend": [],
"//conditions:default": [
"SK_SUPPORT_GPU=0",
],
}) + select({
- "//bazel/common_config_settings:gl_standard": [
+ "//src/gpu:gl_standard": [
"SK_ASSUME_GL=1",
],
- "//bazel/common_config_settings:gles_standard": [
+ "//src/gpu:gles_standard": [
"SK_ASSUME_GL_ES=1",
],
- "//bazel/common_config_settings:webgl_standard": [
+ "//src/gpu:webgl_standard": [
"SK_ASSUME_WEBGL=1",
"SK_USE_WEBGL",
],
"//conditions:default": [],
}) + select({
- "//bazel/common_config_settings:vulkan_with_vma": [
+ "//src/gpu:vulkan_with_vma": [
"SK_USE_VMA",
],
"//conditions:default": [],
@@ -86,47 +95,32 @@ GPU_DEFINES = select({
CODEC_DEFINES = select_multi(
{
- "//bazel/common_config_settings:gif_decode_codec": ["SK_HAS_WUFFS_LIBRARY"],
- "//bazel/common_config_settings:jpeg_decode_codec": ["SK_CODEC_DECODES_JPEG"],
- "//bazel/common_config_settings:jpeg_encode_codec": ["SK_ENCODE_JPEG"],
- "//bazel/common_config_settings:png_decode_codec": ["SK_CODEC_DECODES_PNG"],
- "//bazel/common_config_settings:png_encode_codec": ["SK_ENCODE_PNG"],
- "//bazel/common_config_settings:raw_decode_codec": [
+ "//src/codec:gif_decode_codec": ["SK_HAS_WUFFS_LIBRARY"],
+ "//src/codec:jpeg_decode_codec": ["SK_CODEC_DECODES_JPEG"],
+ "//src/images:jpeg_encode_codec": ["SK_ENCODE_JPEG"],
+ "//src/codec:png_decode_codec": ["SK_CODEC_DECODES_PNG"],
+ "//src/images:png_encode_codec": ["SK_ENCODE_PNG"],
+ "//src/codec:raw_decode_codec": [
"SK_CODEC_DECODES_RAW",
"SK_CODEC_DECODES_JPEG",
],
- "//bazel/common_config_settings:webp_decode_codec": ["SK_CODEC_DECODES_WEBP"],
- "//bazel/common_config_settings:webp_encode_codec": ["SK_ENCODE_WEBP"],
+ "//src/codec:webp_decode_codec": ["SK_CODEC_DECODES_WEBP"],
+ "//src/images:webp_encode_codec": ["SK_ENCODE_WEBP"],
},
- default = [],
)
PLATFORM_DEFINES = select({
"//bazel/common_config_settings:cpu_wasm": [
# working around https://github.com/emscripten-core/emscripten/issues/10072
"SK_FORCE_8_BYTE_ALIGNMENT",
- "SK_DISABLE_LEGACY_SHADERCONTEXT",
"SK_DISABLE_AAA", # This saves about 57KB of code size, uncompressed
],
"//conditions:default": [],
})
-SHAPER_DEFINES = select_multi(
- {
- "//bazel/common_config_settings:coretext_shaper": ["SK_SHAPER_CORETEXT_AVAILABLE"],
- "//bazel/common_config_settings:harfbuzz_shaper": ["SK_SHAPER_HARFBUZZ_AVAILABLE"],
- },
- default = [],
-)
-
-UNICODE_DEFINES = select({
- "//bazel/common_config_settings:use_icu_true": ["SK_UNICODE_AVAILABLE"],
- "//conditions:default": [],
-})
-
-cc_library(
+skia_defines(
name = "defines_from_flags",
defines = GENERAL_DEFINES + GPU_DEFINES + CODEC_DEFINES + PLATFORM_DEFINES +
- SHAPER_DEFINES + UNICODE_DEFINES,
+ EXTRA_DEFINES,
visibility = ["//:__subpackages__"],
)
diff --git a/chromium/third_party/skia/bazel/Makefile b/chromium/third_party/skia/bazel/Makefile
index 61ed3cb9a47..b8c0668db5e 100644
--- a/chromium/third_party/skia/bazel/Makefile
+++ b/chromium/third_party/skia/bazel/Makefile
@@ -2,7 +2,15 @@ generate:
echo "You do not need to run this any more for C++ code, only if you modify go code"
generate_go:
- cd .. && bazelisk run //:gazelle -- update infra/bots/task_drivers modules/canvaskit/go
+ cd .. && bazelisk run //:gazelle -- update infra/bots/task_drivers modules/canvaskit/go bazel/exporter
+
+.PHONY: generate_cmake
+generate_cmake:
+ cd .. && bazel build //bazel/exporter_tool && bazel-bin/bazel/exporter_tool/exporter_tool_/exporter_tool -proj_name=Skia -rule='//:skia_public'
+
+.PHONY: mocks
+mocks:
+ go generate ./...
# This target should be run after the go.mod file is updated (e.g. version rolls or new updates)
gazelle_update_repo:
@@ -10,56 +18,42 @@ gazelle_update_repo:
# Run this target to test all known working Bazel builds
known_good_builds:
- bazelisk build //:skia_public --config=clang_linux
- bazelisk build //:skia_internal --config=clang_linux
- bazelisk build //experimental/bazel_test/... --config=clang_linux
- bazelisk run //experimental/bazel_test:bazel_test_exe --config=clang_linux
- bazelisk build //example:hello_world_gl --config=clang_linux
- bazelisk build //example:hello_world_vulkan --config=clang_linux
- bazelisk build //example:hello_world_dawn --config=clang_linux
- bazelisk build //example:vulkan_basic --config=clang_linux
- bazelisk build //src/sksl/lex:sksllex --config=clang_linux
- bazelisk build //tools/skdiff --config=clang_linux
- bazelisk build //tools/skslc --config=clang_linux
- bazelisk build //modules/canvaskit:canvaskit_wasm --config=ck_release
+ bazelisk build //:skia_public
+ bazelisk build //:skia_internal
+ bazelisk build //experimental/bazel_test/...
+ bazelisk run //experimental/bazel_test:bazel_test_exe
+ bazelisk build //example:hello_world_gl
+ bazelisk build //example:hello_world_vulkan
+ bazelisk build //example:hello_world_dawn
+ bazelisk build //example:vulkan_basic
+ bazelisk build //src/sksl/lex:sksllex
+ bazelisk build //tools/skdiff
+ bazelisk build //tools/skslc
+ bazelisk build //modules/skottie:skottie_tool_cpu
+ bazelisk build //modules/skottie:skottie_tool_gpu
+ bazelisk build //modules/canvaskit:canvaskit_webgl --config=webgl2_release
rbe_known_good_builds:
- bazelisk build //:skia_public --config=linux_rbe --remote_download_minimal
- bazelisk build //:skia_internal --config=linux_rbe --remote_download_minimal
- bazelisk build //experimental/bazel_test/... --config=linux_rbe --remote_download_minimal
- bazelisk run //experimental/bazel_test:bazel_test_exe --config=linux_rbe --remote_download_toplevel
- bazelisk build //example:hello_world_gl --config=linux_rbe --remote_download_minimal
- bazelisk build //example:hello_world_vulkan --config=linux_rbe --remote_download_minimal
- bazelisk build //example:hello_world_dawn --config=linux_rbe --remote_download_minimal
- bazelisk build //example:vulkan_basic --config=linux_rbe --remote_download_minimal
- bazelisk build //src/sksl/lex:sksllex --config=linux_rbe --remote_download_minimal
- bazelisk build //tools/skdiff --config=linux_rbe --remote_download_minimal
- bazelisk build //tools/skslc --config=linux_rbe --remote_download_minimal
+ bazelisk build //:skia_public --config=for_linux_x64_with_rbe --remote_download_minimal
+ bazelisk build //:skia_internal --config=for_linux_x64_with_rbe --remote_download_minimal
+ bazelisk build //experimental/bazel_test:bazel_test_exe --config=for_linux_x64_with_rbe --remote_download_minimal
+ bazelisk build //example:hello_world_gl --config=for_linux_x64_with_rbe --remote_download_minimal
+ bazelisk build //example:hello_world_vulkan --config=for_linux_x64_with_rbe --remote_download_minimal
+ bazelisk build //example:hello_world_dawn --config=for_linux_x64_with_rbe --remote_download_minimal
+ bazelisk build //example:vulkan_basic --config=for_linux_x64_with_rbe --remote_download_minimal
+ bazelisk build //src/sksl/lex:sksllex --config=for_linux_x64_with_rbe --remote_download_minimal
+ bazelisk build //tools/skdiff --config=for_linux_x64_with_rbe --remote_download_minimal
+ bazelisk build //tools/skslc --config=for_linux_x64_with_rbe --remote_download_minimal
+ bazelisk build //modules/skottie:skottie_tool_cpu --config=for_linux_x64_with_rbe --remote_download_minimal
+ bazelisk build //modules/skottie:skottie_tool_gpu --config=for_linux_x64_with_rbe --remote_download_minimal
## TODO(kjlubick) CanvasKit in release mode (i.e. with Closure) requires
## https://github.com/emscripten-core/emscripten/pull/16640 to land
- bazelisk build //modules/canvaskit:canvaskit_wasm --compilation_mode dbg --config=linux_rbe \
+ bazelisk build //modules/canvaskit:canvaskit_webgl --config=linux_rbe --config=webgl2_debug \
--remote_download_minimal
iwyu_rbe:
- bazelisk build //:skia_public --config=linux_rbe --config=enforce_iwyu \
- --keep_going --remote_download_minimal
- bazelisk build //example:hello_world_gl --config=linux_rbe --config=enforce_iwyu \
- --keep_going --remote_download_minimal
- bazelisk build //example:hello_world_vulkan --config=linux_rbe --config=enforce_iwyu \
- --keep_going --remote_download_minimal
- bazelisk build //example:hello_world_dawn --config=linux_rbe --config=enforce_iwyu \
- --keep_going --remote_download_minimal
- bazelisk build //example:vulkan_basic --config=linux_rbe --config=enforce_iwyu \
- --keep_going --remote_download_minimal
+ bazelisk build //:skia_public --config=for_linux_x64_with_rbe --config=enforce_iwyu \
+ --remote_download_minimal --nobuild_runfile_manifests
iwyu:
- bazelisk build //:skia_public --config=clang_linux --config=enforce_iwyu \
- --keep_going
- bazelisk build //example:hello_world_gl --config=clang_linux --config=enforce_iwyu \
- --keep_going
- bazelisk build //example:hello_world_vulkan --config=clang_linux --config=enforce_iwyu \
- --keep_going
- bazelisk build //example:hello_world_dawn --config=clang_linux --config=enforce_iwyu \
- --keep_going
- bazelisk build //example:vulkan_basic --config=clang_linux --config=enforce_iwyu \
- --keep_going
+ bazelisk build //:skia_public --config=enforce_iwyu --nobuild_runfile_manifests
diff --git a/chromium/third_party/skia/bazel/buildrc b/chromium/third_party/skia/bazel/buildrc
index 967c3ce24aa..ed8ddf88a69 100644
--- a/chromium/third_party/skia/bazel/buildrc
+++ b/chromium/third_party/skia/bazel/buildrc
@@ -22,23 +22,76 @@
# [4] https://github.com/bazelbuild/bazel/blob/e0e589658463beb9605030b4820dcc97e6a36f48/src/main/java/com/google/devtools/build/lib/analysis/config/OutputDirectories.java#L198-L236
# [5] https://clang.llvm.org/docs/ClangCommandLineReference.html#dependency-file-generation
+# =============================================================================
+# Targets (what to build for)
+# =============================================================================
+
+# --platforms refers to the target for which we are compiling. By setting the target to be a
+# platform which has our own custom constraint_setting and constraint_value
+# (skia_hermetic_toolchain=use_hermetic_toolchain), this causes Bazel to resolve the toolchain
+# to be our hermetic one because our hermetic toolchains have that same constraint set in their
+# target_compatible_with list.
+build:for_linux_x64 --platforms=//bazel/platform:linux_x64_hermetic --cc_output_directory_tag=linux_x64
+build:for_linux_x64_with_rbe --config=for_linux_x64 --config=linux_rbe
+
+build:for_mac_arm64 --platforms=//bazel/platform:mac_arm64_hermetic --cc_output_directory_tag=mac_arm64
+build:for_mac_x64 --platforms=//bazel/platform:mac_x64_hermetic --cc_output_directory_tag=mac_x64
+# some aliases using more common lingo
+build:for_mac_m1 --config=for_mac_arm64
+build:for_mac_intel --config=for_mac_x64
+
+
+# =============================================================================
+# Configurations (what features we want on)
+# =============================================================================
# These are examples of the syntax to create build configurations. As of May 2022, our
# Bazel configurations are still being made.
build:release --compilation_mode=opt
build:debug --compilation_mode=dbg
-# We use spawn_strategy=local for CanvasKit builds because emscripten assumes there
-# is a cache in the home directory that it needs to fill with compiled versions of libc etc.
-# https://emscripten.org/docs/tools_reference/emcc.html
-# By setting spawn_strategy=local, we can avoid recompiling all of this for every compilation
-# unit, by letting the cache be used (and not dropped from the sandbox), which gets expensive.
-# Local testing showed using the local strategy sped up a clean build from 9.5 minutes
-# to 1 minute. https://bazel.build/docs/user-manual#execution-strategy
-build:ck_release --config=release --spawn_strategy=local
-build:ck_debug --config=debug --spawn_strategy=local
+# See also https://github.com/emscripten-core/emsdk/issues/984 for disabling cc_toolchain_resolution
+build:canvaskit_full --noincompatible_enable_cc_toolchain_resolution \
+ --include_decoder=gif_decode_codec --include_decoder=jpeg_decode_codec \
+ --include_decoder=png_decode_codec --include_decoder=webp_decode_codec \
+ \
+ --include_encoder=jpeg_encode_codec --include_encoder=png_encode_codec \
+ --include_encoder=webp_encode_codec \
+ \
+ --with_harfbuzz --with_icu --fontmgr_factory=custom_embedded_fontmgr_factory \
+ --ck_enable_fonts --ck_enable_embedded_font \
+ \
+ --disable_tracing --enable_sksl_tracing \
+ \
+ --ck_enable_canvas_polyfill --ck_enable_skp_serialization --ck_enable_skottie \
+ --ck_enable_particles --ck_enable_runtime_effect --ck_enable_matrix_js
+
+build:ck_webgl2 --with_gl_standard=webgl_standard --gpu_backend=gl_backend \
+ --disable_legacy_shader_context
+# CPU build needs legacy shader context otherwise SkPerlinNoiseShader does not render
+build:ck_cpu --enable_sksl --enable_legacy_shader_context
+
+build:ck_full_webgl2_release --config=canvaskit_full --config=ck_webgl2 --config=release
+build:ck_full_webgl2_debug --config=canvaskit_full --config=ck_webgl2 --config=debug
+build:ck_full_cpu_release --config=canvaskit_full --config=ck_cpu --config=release
+build:ck_full_cpu_debug --config=canvaskit_full --config=ck_cpu --config=debug
+# TODO(kjlubick) We should be able to configure testing on Chrome or Firefox with this.
+build:ck_full_webgl2_release_chrome --config=ck_full_webgl2_release
+build:ck_full_cpu_release_chrome --config=ck_full_cpu_release
# We only want to enforce IWYU on debug builds because we have some things that are only
# necessary to include in debug mode (e.g. SkDEBUGCODE), but very rarely something that is
# only needed in release mode. Thus our C++ debug includes should be a superset of the
# release includes.
-build:enforce_iwyu --features=skia_enforce_iwyu --cc_output_directory_tag=iwyu --compilation_mode=dbg \ No newline at end of file
+build:enforce_iwyu --features=skia_enforce_iwyu --cc_output_directory_tag=iwyu \
+ --compilation_mode=dbg --keep_going \
+ --with_gl_standard=gl_standard --gpu_backend=gl_backend \
+ --gpu_backend=vulkan_backend --gpu_backend=dawn_backend \
+ --include_fontmgr=custom_directory_fontmgr --include_fontmgr=custom_embedded_fontmgr \
+ --include_fontmgr=custom_empty_fontmgr --fontmgr_factory=custom_directory_fontmgr_factory \
+ --include_decoder=gif_decode_codec --include_decoder=jpeg_decode_codec \
+ --include_decoder=png_decode_codec --include_decoder=raw_decode_codec \
+ --include_decoder=webp_decode_codec --include_encoder=jpeg_encode_codec \
+ --include_encoder=png_encode_codec --include_encoder=webp_encode_codec \
+ --with_harfbuzz --with_icu \
+ --enable_sksl_tracing \
+ --enable_svg_canvas --enable_pdf_backend
diff --git a/chromium/third_party/skia/bazel/cc_binary_with_flags.bzl b/chromium/third_party/skia/bazel/cc_binary_with_flags.bzl
index a7be129ac3e..b2238fa49e0 100644
--- a/chromium/third_party/skia/bazel/cc_binary_with_flags.bzl
+++ b/chromium/third_party/skia/bazel/cc_binary_with_flags.bzl
@@ -1,4 +1,6 @@
"""
+THIS IS THE EXTERNAL-ONLY VERSION OF THIS FILE. G3 HAS ITS OWN.
+
This file contains a way to set flags from BUILD.bazel instead of requiring users to set them from
the CLI.
@@ -6,25 +8,29 @@ It is based off of https://github.com/bazelbuild/examples/tree/main/rules/starla
"""
+load("//bazel:copts.bzl", "DEFAULT_COPTS")
+
_bool_flags = [
- "//bazel/common_config_settings:enable_sksl",
- "//bazel/common_config_settings:enable_sksl_tracing",
- "//bazel/common_config_settings:enable_skslc",
- "//bazel/common_config_settings:is_skia_dev_build",
+ "//bazel/common_config_settings:use_harfbuzz",
"//bazel/common_config_settings:use_icu",
+ "//src/gpu:enable_gpu_test_utils",
+ "//src/pdf:enable_pdf_backend",
+ "//src/sksl:enable_sksl",
+ "//src/sksl:enable_sksl_tracing",
+ "//src/sksl:enable_skslc",
+ "//src/svg:enable_svg_canvas",
]
_string_flags = [
"//bazel/common_config_settings:fontmgr_factory",
- "//bazel/common_config_settings:with_gl_standard",
+ "//src/gpu:with_gl_standard",
]
_string_list_flags = [
- "//bazel/common_config_settings:gpu_backend",
- "//bazel/common_config_settings:include_decoder",
- "//bazel/common_config_settings:include_encoder",
+ "//src/gpu:gpu_backend",
+ "//src/codec:include_decoder",
+ "//src/images:include_encoder",
"//bazel/common_config_settings:include_fontmgr",
- "//bazel/common_config_settings:shaper_backend",
]
# These are the flags that we support setting via set_flags
@@ -58,7 +64,7 @@ def _flag_transition_impl(settings, attr):
return rv
# This defines a Starlark transition and which flags it reads and writes.
-_flag_transition = transition(
+with_flags_transition = transition(
implementation = _flag_transition_impl,
inputs = _flags,
outputs = _flags,
@@ -94,13 +100,13 @@ transition_rule = rule(
# set_flags is a dictionary with the keys being the short-form of a flag name
# (e.g. the part that comes after the colon) and the value being a list of values
# that the flag should be set to, regardless of the relevant CLI flags.
- # https://docs.bazel.build/versions/main/skylark/lib/attr.html#string_list_dict
+ # https://bazel.build/rules/lib/attr#string_list_dict
"set_flags": attr.string_list_dict(),
# This is the cc_binary whose deps will select() on that feature.
# Note specifically how it is modified with _flag_transition, which
# ensures that the flags propagates down the graph.
- # https://docs.bazel.build/versions/main/skylark/lib/attr.html#label
- "actual_binary": attr.label(cfg = _flag_transition),
+ # https://bazel.build/rules/lib/attr#label
+ "actual_binary": attr.label(cfg = with_flags_transition),
# This is a stock Bazel requirement for any rule that uses Starlark
# transitions. It's okay to copy the below verbatim for all such rules.
#
@@ -117,7 +123,7 @@ transition_rule = rule(
executable = True,
)
-def cc_binary_with_flags(name, set_flags = {}, **kwargs):
+def cc_binary_with_flags(name, set_flags = {}, copts = DEFAULT_COPTS, **kwargs):
"""Builds a cc_binary as if set_flags were set on the CLI.
Args:
@@ -125,6 +131,8 @@ def cc_binary_with_flags(name, set_flags = {}, **kwargs):
a transition. Any dependents should use this name.
set_flags: dictionary of string to list of strings. The keys should be the name of the
flag, and the values should be the desired valid settings for that flag.
+ copts: a list of strings or select statements that control the compiler flags.
+ It has a sensible list of defaults.
**kwargs: Any flags that a cc_binary normally takes.
"""
cc_binary_name = name + "_native_binary"
@@ -139,5 +147,6 @@ def cc_binary_with_flags(name, set_flags = {}, **kwargs):
kwargs["tags"] = tags
native.cc_binary(
name = cc_binary_name,
+ copts = copts,
**kwargs
)
diff --git a/chromium/third_party/skia/bazel/common_config_settings/BUILD.bazel b/chromium/third_party/skia/bazel/common_config_settings/BUILD.bazel
index b92e38dd7d1..bf4d90a996a 100644
--- a/chromium/third_party/skia/bazel/common_config_settings/BUILD.bazel
+++ b/chromium/third_party/skia/bazel/common_config_settings/BUILD.bazel
@@ -1,5 +1,4 @@
-load("//bazel:macros.bzl", "selects")
-load(":defs.bzl", "bool_flag", "string_flag_with_values")
+load("//bazel:macros.bzl", "bool_flag", "string_flag_with_values")
licenses(["notice"])
@@ -26,6 +25,14 @@ config_setting(
)
config_setting(
+ name = "mac_arm64",
+ constraint_values = [
+ "@platforms//cpu:arm64",
+ "@platforms//os:macos",
+ ],
+)
+
+config_setting(
name = "windows_x64",
constraint_values = [
"@platforms//cpu:x86_64",
@@ -47,6 +54,11 @@ config_setting(
)
config_setting(
+ name = "fast_build",
+ values = {"compilation_mode": "fastbuild"},
+)
+
+config_setting(
name = "release_build",
values = {"compilation_mode": "opt"},
)
@@ -73,65 +85,25 @@ config_setting(
},
)
-selects.config_setting_group(
- name = "has_gpu_backend",
- match_any = [
- ":gl_backend",
- ":dawn_backend",
- ":vulkan_backend",
- ],
-)
-
-selects.config_setting_group(
- name = "needs_sksl",
- match_any = [
- ":has_gpu_backend",
- ":enable_sksl_true",
- ],
-)
-
-selects.config_setting_group(
- name = "vulkan_with_vma",
- match_all = [
- ":vulkan_backend",
- ":use_vulkan_memory_allocator_true",
- ],
-)
-
# =============================================================================
# Configurable Skia Features
# =============================================================================
# These are flags that we can specify when invoking bazel build to turn on and
# off certain features, such as GPU backend, or codec support.
-# https://docs.bazel.build/versions/4.2.1/skylark/config.html#using-build-settings-on-the-command-line
-# For example, to use the GL backend with the WebGL flavor, one would run
-# bazel build //:skia-core --//bazel/common_config_settings:gpu_backend=gl_backend \
-# --//bazel/common_config_settings:with_gl_standard=webgl_standard
+# https://bazel.build/rules/config#defining-build-settings
+# For example, to enable harfbuzz and icu, one would run
+# bazel build //:skia-core --//bazel/common_config_settings:use_harfbuzz \
+# --//bazel/common_config_settings:use_icu
# This is a bit wordy, so we define aliases in the //.bazelrc file that condense this to
-# bazel build //:skia-core --gpu_backend=gl_backend --with_gl_standard=webgl_standard
+# bazel build //:skia-core --with_harfbuzz --with_icu
#
# Developers can specify their own short-hands by making a .bazelrc file in their home
-# directory. https://docs.bazel.build/versions/main/guide.html#where-are-the-bazelrc-files
+# directory. https://bazel.build/docs/bazelrc#bazelrc-file-locations
#
-
-string_flag_with_values(
- flag_name = "gpu_backend",
- multiple = True,
- values = [
- "gl_backend",
- "vulkan_backend",
- "dawn_backend",
- ],
-)
-
-string_flag_with_values(
- flag_name = "with_gl_standard",
- values = [
- "gles_standard",
- "gl_standard",
- "webgl_standard",
- ],
-)
+# We check in some Bazel configs for "blessed builds" in //bazel/buildrc.
+#
+# We can also define flags closer to where they have the most impact. For example
+# //src/pdf:enable_pdf_backend.
string_flag_with_values(
default = "empty_fontmgr_factory",
@@ -148,6 +120,7 @@ string_flag_with_values(
"custom_empty_fontmgr_factory",
# Makes the default SkFontMgr return null. Typically used when font support is not desired.
"empty_fontmgr_factory",
+ "fontconfig_fontmgr_factory",
],
)
@@ -167,37 +140,7 @@ string_flag_with_values(
"custom_embedded_fontmgr",
# Allows the construction of an SkFontMgr which returns empty fonts.
"custom_empty_fontmgr",
- ],
-)
-
-string_flag_with_values(
- flag_name = "include_decoder",
- multiple = True,
- values = [
- "gif_decode_codec",
- "jpeg_decode_codec",
- "png_decode_codec",
- "raw_decode_codec",
- "webp_decode_codec",
- ],
-)
-
-string_flag_with_values(
- flag_name = "include_encoder",
- multiple = True,
- values = [
- "jpeg_encode_codec",
- "png_encode_codec",
- "webp_encode_codec",
- ],
-)
-
-string_flag_with_values(
- flag_name = "shaper_backend",
- multiple = True,
- values = [
- "harfbuzz_shaper",
- "coretext_shaper",
+ "fontconfig_fontmgr",
],
)
@@ -207,21 +150,6 @@ bool_flag(
)
bool_flag(
- default = False,
- flag_name = "enable_sksl",
-)
-
-bool_flag(
- default = False,
- flag_name = "enable_skslc",
-)
-
-bool_flag(
- default = False,
- flag_name = "enable_sksl_tracing",
-)
-
-bool_flag(
# See SkTraceEventCommon.h for more on this type of tracing.
default = True,
flag_name = "enable_tracing",
@@ -229,16 +157,10 @@ bool_flag(
bool_flag(
default = False,
- flag_name = "is_skia_dev_build",
+ flag_name = "use_harfbuzz",
)
bool_flag(
default = False,
flag_name = "use_icu",
)
-
-bool_flag(
- default = True,
- flag_name = "use_vulkan_memory_allocator",
- public = False, # Users should use :vulkan_with_vma
-)
diff --git a/chromium/third_party/skia/bazel/common_config_settings/defs.bzl b/chromium/third_party/skia/bazel/common_config_settings/defs.bzl
index 16bbcdfd1c0..07a10bc0bd9 100644
--- a/chromium/third_party/skia/bazel/common_config_settings/defs.bzl
+++ b/chromium/third_party/skia/bazel/common_config_settings/defs.bzl
@@ -85,6 +85,7 @@ def string_flag_with_values(flag_name, values, default = "", multiple = False):
flag_values = {
":" + flag_name: v,
},
+ visibility = ["//:__subpackages__"],
)
# buildifier: disable=unnamed-macro
diff --git a/chromium/third_party/skia/bazel/copts.bzl b/chromium/third_party/skia/bazel/copts.bzl
new file mode 100644
index 00000000000..c858dccaae4
--- /dev/null
+++ b/chromium/third_party/skia/bazel/copts.bzl
@@ -0,0 +1,149 @@
+"""
+THIS IS THE EXTERNAL-ONLY VERSION OF THIS FILE. G3 HAS ITS OWN.
+
+This file contains flags for the C++ compiler, referred to by Bazel as copts.
+
+The copts in a cc_library to not flow to the children (dependencies) nor the parents
+(dependents), so we cannot define them alongside the defines in //bazel/BUILD.bazel.
+
+We cannot (easily) define them in the C++ toolchain configuration
+(e.g. //toolchain/linux_amd64_toolchain_config.bzl), because that does not support listening
+to arbitrary Bazel flags (e.g. those defined in //bazel/common_config_settings). If we wanted
+to implement these flags in the toolchain, we would need to group them into features [1],
+but we don't control the features implemented by the G3 toolchain. Because we want to
+automatically roll into G3 with minimal changes, the copts cannot go in the toolchain,
+
+Thus, they go here, so we can use select statements to conditionally control them and
+override what they do (if necessary) in G3.
+
+They are divided into several lists/selects and were initially created to be identical to the
+ GN ones [2][3].
+
+The flags here are *not* used when compiling our third_party libraries (although the flags will
+impact the included public headers of those third_party libraries). If we need a flag to impact
+both Skia and a third party dep, it should probably go in the toolchain_config. If that is not
+possible (e.g. the setting depends on a custom flag), we can define a subworkspace and have both
+Skia and the third party dep depend on that.
+
+[1] https://bazel.build/docs/cc-toolchain-config-reference#features
+[2] https://github.com/google/skia/blob/2b07cdb07e88f2870260eabac708f31bc7977d08/gn/BUILDCONFIG.gn#L177-L181
+[3] https://github.com/google/skia/blob/2b07cdb07e88f2870260eabac708f31bc7977d08/gn/skia/BUILD.gn#L593-L630
+"""
+
+CORE_COPTS = [
+ "-fstrict-aliasing",
+ "-fPIC",
+ "-fvisibility=hidden",
+ "-fno-rtti", # Reduces code size
+] + select({
+ # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of Skia.
+ "//src/codec:raw_decode_codec": [],
+ "//conditions:default": ["-fno-exceptions"],
+})
+
+OPT_LEVEL = select({
+ "//bazel/common_config_settings:debug_build": [
+ "--optimize=0",
+ "--debug",
+ ],
+ "//bazel/common_config_settings:release_build": [
+ "--optimize=3",
+ # Strip dead code (in conjunction with linkopts)
+ "-fdata-sections",
+ "-ffunction-sections",
+ ],
+ "//bazel/common_config_settings:fast_build": [
+ "--optimize=0",
+ "-gline-tables-only",
+ ],
+})
+
+WARNINGS = [
+ "-fcolor-diagnostics",
+ "-Wall",
+ "-Werror",
+ "-Weverything",
+ "-Wextra",
+ "-Wpointer-arith",
+ "-Wsign-compare",
+ "-Wvla",
+ #### Warnings we are unlikely to fix ####
+ "-Wno-c++98-compat",
+ "-Wno-c++98-compat-pedantic",
+ "-Wno-covered-switch-default",
+ "-Wno-declaration-after-statement",
+ "-Wno-deprecated",
+ "-Wno-missing-noreturn",
+ "-Wno-newline-eof",
+ "-Wno-old-style-cast",
+ "-Wno-padded",
+ "-Wno-psabi", # noisy
+ "-Wno-shadow-field-in-constructor",
+ "-Wno-shadow-uncaptured-local",
+ "-Wno-undefined-func-template",
+ "-Wno-unused-parameter", # It is common to have unused parameters in src/
+ "-Wno-zero-as-null-pointer-constant", # VK_NULL_HANDLE is defined as 0
+ #### Warnings we would like to fix ####
+ "-Wno-abstract-vbase-init",
+ "-Wno-cast-align",
+ "-Wno-cast-qual",
+ "-Wno-class-varargs",
+ "-Wno-conversion", # -Wsign-conversion re-enabled for header sources
+ "-Wno-disabled-macro-expansion",
+ "-Wno-documentation",
+ "-Wno-documentation-unknown-command",
+ "-Wno-double-promotion",
+ "-Wno-exit-time-destructors", # TODO: OK outside libskia
+ "-Wno-float-equal",
+ "-Wno-global-constructors", # TODO: OK outside libskia
+ "-Wno-missing-prototypes",
+ "-Wno-missing-variable-declarations",
+ "-Wno-pedantic",
+ "-Wno-reserved-id-macro",
+ "-Wno-reserved-identifier",
+ "-Wno-shift-sign-overflow",
+ "-Wno-signed-enum-bitfield",
+ "-Wno-switch-enum",
+ "-Wno-thread-safety-negative",
+ "-Wno-undef",
+ "-Wno-unreachable-code-break",
+ "-Wno-unreachable-code-return",
+ "-Wno-unused-macros",
+ "-Wno-unused-member-function",
+ "-Wno-weak-template-vtables", # This was deprecated in Clang 14 and removed in Clang 15.
+ "-Wno-weak-vtables",
+ # Wno-range-loop-analysis turns off the whole group, but this warning was later split into
+ # range-loop-construct and range-loop-bind-reference. We want the former but not the latter.
+ # Created from
+ # https://github.com/llvm/llvm-project/blob/bd08f413c089da5a56438cc8902f60df91a08a66/clang/include/clang/Basic/DiagnosticGroups.td
+ "-Wrange-loop-construct",
+ # Wno-deprecated turns off the whole group, but also has its own warnings like
+ # out-of-line definition of constexpr static data member is redundant in C++17 and is deprecated [-Werror,-Wdeprecated]
+ # but we would like others. Created from
+ # https://github.com/llvm/llvm-project/blob/bd08f413c089da5a56438cc8902f60df91a08a66/clang/include/clang/Basic/DiagnosticGroups.td
+ "-Wdeprecated-anon-enum-enum-conversion",
+ "-Wdeprecated-array-compare",
+ "-Wdeprecated-attributes",
+ "-Wdeprecated-comma-subscript",
+ "-Wdeprecated-copy",
+ "-Wdeprecated-copy-dtor",
+ "-Wdeprecated-dynamic-exception-spec",
+ "-Wdeprecated-enum-compare",
+ "-Wdeprecated-enum-compare-conditional",
+ "-Wdeprecated-enum-enum-conversion",
+ "-Wdeprecated-enum-float-conversion",
+ "-Wdeprecated-increment-bool",
+ "-Wdeprecated-register",
+ "-Wdeprecated-this-capture",
+ "-Wdeprecated-volatile",
+ "-Wdeprecated-writable-strings",
+]
+
+DEFAULT_COPTS = CORE_COPTS + OPT_LEVEL + WARNINGS
+
+OBJC_COPTS = [
+ "-Wno-direct-ivar-access",
+ "-Wno-objc-interface-ivars",
+]
+
+DEFAULT_OBJC_COPTS = DEFAULT_COPTS + OBJC_COPTS
diff --git a/chromium/third_party/skia/bazel/defines.bzl b/chromium/third_party/skia/bazel/defines.bzl
new file mode 100644
index 00000000000..d7d17e863c9
--- /dev/null
+++ b/chromium/third_party/skia/bazel/defines.bzl
@@ -0,0 +1,9 @@
+"""
+THIS IS THE EXTERNAL-ONLY VERSION OF THIS FILE. G3 HAS ITS OWN.
+
+This file contains customizable C++ defines.
+
+The primary use case for this file is to have defines we can control when rolling into G3.
+"""
+
+EXTRA_DEFINES = [] # This should always be empty externally. Add new defines in //bazel/BUILD.bazel
diff --git a/chromium/third_party/skia/bazel/exporter/BUILD.bazel b/chromium/third_party/skia/bazel/exporter/BUILD.bazel
new file mode 100644
index 00000000000..f0c039732fe
--- /dev/null
+++ b/chromium/third_party/skia/bazel/exporter/BUILD.bazel
@@ -0,0 +1,49 @@
+load("//bazel:macros.bzl", "exports_files_legacy")
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+licenses(["notice"])
+
+exports_files_legacy()
+
+go_library(
+ name = "exporter",
+ srcs = [
+ "bazel_query_command.go",
+ "bazel_util.go",
+ "cmake_exporter.go",
+ "cmake_rule.go",
+ "cmake_workspace.go",
+ ],
+ importpath = "go.skia.org/skia/bazel/exporter",
+ visibility = ["//visibility:public"],
+ deps = [
+ "//bazel/exporter/build_proto/analysis_v2",
+ "//bazel/exporter/build_proto/build",
+ "//bazel/exporter/interfaces",
+ "@org_golang_google_protobuf//proto",
+ "@org_skia_go_infra//go/skerr",
+ "@org_skia_go_infra//go/util",
+ ],
+)
+
+go_test(
+ name = "exporter_test",
+ srcs = [
+ "bazel_util_test.go",
+ "cmake_exporter_test.go",
+ "cmake_rule_test.go",
+ "cmake_workspace_test.go",
+ ],
+ embed = [":exporter"],
+ deps = [
+ "//bazel/exporter/build_proto/analysis_v2",
+ "//bazel/exporter/build_proto/build",
+ "//bazel/exporter/interfaces/mocks",
+ "@com_github_stretchr_testify//assert",
+ "@com_github_stretchr_testify//mock",
+ "@com_github_stretchr_testify//require",
+ "@org_golang_google_protobuf//encoding/prototext",
+ "@org_golang_google_protobuf//proto",
+ "@org_skia_go_infra//go/skerr",
+ ],
+)
diff --git a/chromium/third_party/skia/bazel/exporter/bazel_query_command.go b/chromium/third_party/skia/bazel/exporter/bazel_query_command.go
new file mode 100644
index 00000000000..c59780ab498
--- /dev/null
+++ b/chromium/third_party/skia/bazel/exporter/bazel_query_command.go
@@ -0,0 +1,107 @@
+// Copyright 2022 Google LLC
+//
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package exporter
+
+import (
+ "fmt"
+ "os"
+ "os/exec"
+
+ "go.skia.org/infra/go/skerr"
+ "go.skia.org/skia/bazel/exporter/interfaces"
+)
+
+// BazelQueryCommand implements the QueryCommand interface. It will
+// execute the bazel executable to return all rules defined in
+// a protocol buffer.
+type BazelQueryCommand struct {
+ ruleNames []string
+ workspace string
+}
+
+// A list of all Skia Bazel build flags which enable the building and/or
+// exposure of all source files.
+var allSkiaFlags = []string{
+ "--ck_enable_canvas_polyfill",
+ "--ck_enable_embedded_font",
+ "--ck_enable_fonts",
+ "--ck_enable_matrix_js",
+ "--ck_enable_particles",
+ "--ck_enable_runtime_effect",
+ "--ck_enable_skottie",
+ "--ck_enable_skp_serialization",
+ "--enable_effect_serialization",
+ "--enable_gpu_test_utils",
+ "--enable_pdf_backend",
+ "--enable_sksl_tracing",
+ "--enable_sksl",
+ // "--enable_skslc", // external dependency on spirv-tools/libspirv.hpp
+ "--enable_svg_canvas",
+ "--enable_tracing",
+ "--enable_vma",
+ // "--fontmgr_factory=custom_embedded_fontmgr_factory", // external dependency on ft2build.h
+ "--gpu_backend=gl_backend",
+ // "--include_decoder=*", // All decoders have external dependencies.
+ // "--include_encoder", // All encoders have external dependencies.
+ // "--include_fontmgr=custom_embedded_fontmgr", // external dependency on ft2build.h
+}
+
+// NewBazelQueryCommand will create a new BazelQueryCommand instance which will,
+// when Read() is called, invoke the bazel executable to execute a cquery
+// command in the provided workspace for the supplied rules.
+func NewBazelQueryCommand(ruleNames []string, workspace string) *BazelQueryCommand {
+ return &BazelQueryCommand{ruleNames: ruleNames, workspace: workspace}
+}
+
+// Stop the Bazel server if running.
+func shutdownBazelServer() error {
+ cmd := exec.Command("bazel", "shutdown")
+ _, err := cmd.Output()
+ return err
+}
+
+// Read will execute the Bazel cquery command, supplied to NewBazelQueryCommand(),
+// and return the results.
+func (c *BazelQueryCommand) Read() ([]byte, error) {
+ if len(c.ruleNames) == 0 {
+ return nil, skerr.Fmt("no query rules")
+ }
+
+ pwd, err := os.Getwd()
+ if err != nil {
+ return nil, skerr.Wrapf(err, `can't get working directory`)
+ }
+ err = os.Chdir(c.workspace)
+ if err != nil {
+ return nil, skerr.Wrapf(err, `can't set working directory to %q`, c.workspace)
+ }
+ // Shutdown the Bazel server to workaround a known issue with cquery:
+ // See "Non-deterministic output" in https://bazel.build/docs/cquery#known-issues
+ err = shutdownBazelServer()
+ if err != nil {
+ return nil, skerr.Wrap(err)
+ }
+ ruleArg := `kind("rule", `
+ for i, r := range c.ruleNames {
+ if i > 0 {
+ ruleArg = ruleArg + " + "
+ }
+ ruleArg = ruleArg + fmt.Sprintf("deps(%s)", r)
+ }
+ ruleArg = ruleArg + ")"
+ args := []string{"cquery", "--noimplicit_deps", ruleArg, "--output", "proto"}
+ args = append(args, allSkiaFlags...)
+ cmd := exec.Command("bazel", args...)
+ _ = os.Chdir(pwd)
+ data, err := cmd.Output()
+ if err != nil {
+ return nil, skerr.Wrapf(err, `error running %v`, cmd)
+ }
+ return data, nil
+}
+
+// Make sure BazelQueryCommand fulfills the QueryCommand interface.
+var _ interfaces.QueryCommand = (*BazelQueryCommand)(nil)
diff --git a/chromium/third_party/skia/bazel/exporter/bazel_util.go b/chromium/third_party/skia/bazel/exporter/bazel_util.go
new file mode 100644
index 00000000000..3090ba790b8
--- /dev/null
+++ b/chromium/third_party/skia/bazel/exporter/bazel_util.go
@@ -0,0 +1,169 @@
+// Copyright 2022 Google LLC
+//
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package exporter
+
+import (
+ "fmt"
+ "path/filepath"
+ "regexp"
+ "strconv"
+ "strings"
+
+ "go.skia.org/infra/go/skerr"
+ "go.skia.org/infra/go/util"
+ "go.skia.org/skia/bazel/exporter/build_proto/analysis_v2"
+ "go.skia.org/skia/bazel/exporter/build_proto/build"
+)
+
+const (
+ ruleOnlyRepoPattern = `^(@\w+)$`
+ rulePattern = `^(?P<repo>@[^/]+)?/(?P<path>[^:]+)(?P<target>:[^:]+)?$`
+ locationPattern = `^(?P<path>[^:]+):(?P<line>[^:]+):(?P<pos>[^:]+)$`
+)
+
+var (
+ ruleOnlyRepoRegex = regexp.MustCompile(ruleOnlyRepoPattern)
+ ruleRegex = regexp.MustCompile(rulePattern)
+ locRegex = regexp.MustCompile(locationPattern)
+)
+
+// Return true if the given rule name represents an external repository.
+func isExternalRule(name string) bool {
+ return name[0] == '@'
+}
+
+// Given a Bazel rule name find that rule from within the
+// query results. Returns nil if the given rule is not present.
+func findRule(qr *analysis_v2.CqueryResult, name string) *build.Rule {
+ for _, result := range qr.GetResults() {
+ r := result.GetTarget().GetRule()
+ if r.GetName() == name {
+ return r
+ }
+ }
+ return nil
+}
+
+// Parse a rule into its constituent parts.
+// https://docs.bazel.build/versions/main/guide.html#specifying-targets-to-build
+func parseRule(rule string) (repo string, path string, target string, err error) {
+ match := ruleOnlyRepoRegex.FindStringSubmatch(rule)
+ if match != nil {
+ return match[1], "/", strings.TrimPrefix(match[1], "@"), nil
+ }
+
+ match = ruleRegex.FindStringSubmatch(rule)
+ if match == nil {
+ return "", "", "", skerr.Fmt(`Unable to match rule %q`, rule)
+ }
+
+ if len(match[3]) > 0 {
+ target = strings.TrimPrefix(match[3], ":")
+ } else {
+ // No explicit target, so use directory name as default target.
+ target = filepath.Base(match[2])
+ }
+
+ return match[1], match[2], target, nil
+}
+
+// Parse a file location into its three constituent parts.
+//
+// A location is of the form:
+//
+// /full/path/to/BUILD.bazel:33:20
+func parseLocation(location string) (path string, line int, pos int, err error) {
+ match := locRegex.FindStringSubmatch(location)
+ if match == nil {
+ return "", 0, 0, skerr.Fmt(`unable to match file location %q`, location)
+ }
+ path = match[1]
+ line, err = strconv.Atoi(match[2])
+ if err != nil {
+ return "", 0, 0, skerr.Fmt(`unable to parse line no. %q`, match[2])
+ }
+ pos, err = strconv.Atoi(match[3])
+ if err != nil {
+ return "", 0, 0, skerr.Fmt(`unable to parse pos. %q`, match[3])
+ }
+ return path, line, pos, nil
+}
+
+// Return the directory containing the file in the location string.
+func getLocationDir(location string) (string, error) {
+ filePath, _, _, err := parseLocation(location)
+ if err != nil {
+ return "", skerr.Wrap(err)
+ }
+ return filepath.Dir(filePath), nil
+}
+
+func makeCanonicalRuleName(bazelRuleName string) (string, error) {
+ repo, path, target, err := parseRule(bazelRuleName)
+ if err != nil {
+ return "", skerr.Wrap(err)
+ }
+ return fmt.Sprintf("%s/%s:%s", repo, path, target), nil
+}
+
+// Determine if a target refers to a file, or a rule. target is of
+// the form:
+//
+// file: //include/private:SingleOwner.h
+// rule: //bazel/common_config_settings:has_gpu_backend
+func isFileTarget(target string) bool {
+ _, _, target, err := parseRule(target)
+ if err != nil {
+ return false
+ }
+ return strings.Contains(target, ".")
+}
+
+// Create a string that uniquely identifies the rule and can be used
+// in the exported project file as a valid name.
+func getRuleSimpleName(bazelRuleName string) (string, error) {
+ s, err := makeCanonicalRuleName(bazelRuleName)
+ if err != nil {
+ return "", skerr.Wrap(err)
+ }
+ s = strings.TrimPrefix(s, "//:")
+ s = strings.TrimPrefix(s, "//")
+ s = strings.ReplaceAll(s, "//", "_")
+ s = strings.ReplaceAll(s, "@", "at_")
+ s = strings.ReplaceAll(s, "/", "_")
+ s = strings.ReplaceAll(s, ":", "_")
+ s = strings.ReplaceAll(s, "__", "_")
+ return s, nil
+}
+
+// Append all elements to the slice if not already present in the slice.
+func appendUnique(slice []string, elems ...string) []string {
+ for _, elem := range elems {
+ if !util.In(elem, slice) {
+ slice = append(slice, elem)
+ }
+ }
+ return slice
+}
+
+// Retrieve (if present) a slice of string attribute values from the given
+// rule and attribute name. A nil slice will be returned if the attribute
+// does not exist in the rule. A slice of strings (possibly empty) will be
+// returned if the attribute is empty. An error will be returned if the
+// attribute is not a list type.
+func getRuleStringArrayAttribute(r *build.Rule, name string) ([]string, error) {
+ for _, attrib := range r.Attribute {
+ if attrib.GetName() != name {
+ continue
+ }
+ if attrib.GetType() != build.Attribute_LABEL_LIST &&
+ attrib.GetType() != build.Attribute_STRING_LIST {
+ return nil, skerr.Fmt(`%s in rule %q is not a list`, name, r.GetName())
+ }
+ return attrib.GetStringListValue(), nil
+ }
+ return nil, nil
+}
diff --git a/chromium/third_party/skia/bazel/exporter/bazel_util_test.go b/chromium/third_party/skia/bazel/exporter/bazel_util_test.go
new file mode 100644
index 00000000000..384a2864585
--- /dev/null
+++ b/chromium/third_party/skia/bazel/exporter/bazel_util_test.go
@@ -0,0 +1,158 @@
+// Copyright 2022 Google LLC
+//
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package exporter
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+ "go.skia.org/skia/bazel/exporter/build_proto/analysis_v2"
+ "go.skia.org/skia/bazel/exporter/build_proto/build"
+ "google.golang.org/protobuf/encoding/prototext"
+)
+
+func TestMakeCanonicalRuleName_ValidInput_Success(t *testing.T) {
+ test := func(name, input, expected string) {
+ t.Run(name, func(t *testing.T) {
+ actual, err := makeCanonicalRuleName(input)
+ require.NoError(t, err)
+ assert.Equal(t, expected, actual)
+ })
+ }
+
+ test("AlreadyCanonicalNoPath", "//:skia_public", "//:skia_public")
+ test("AlreadyCanonicalWithPath", "//foo/bar:wiz", "//foo/bar:wiz")
+ test("NoRepoDefaultTarget", "//tools/flags", "//tools/flags:flags")
+ test("RepoWithDefaultTarget", "@libpng", "@libpng//:libpng")
+}
+
+func TestMakeCanonicalRuleName_InvalidInput_ReturnError(t *testing.T) {
+ test := func(name, input string) {
+ t.Run(name, func(t *testing.T) {
+ _, err := makeCanonicalRuleName(input)
+ assert.Error(t, err)
+ })
+ }
+
+ test("EmptyString", "")
+ test("InvalidRepoName", "@@repo")
+ test("InvalidTargetName", "//:::target_name")
+}
+
+func TestParseRule_ValidRules_Success(t *testing.T) {
+
+ test := func(name, rule, expectedRepo, expectedPath, expectedTarget string) {
+ t.Run(name, func(t *testing.T) {
+ repo, path, target, err := parseRule(rule)
+ require.NoError(t, err)
+ assert.Equal(t, expectedRepo, repo)
+ assert.Equal(t, expectedPath, path)
+ assert.Equal(t, expectedTarget, target)
+ })
+ }
+
+ test("TargetAtRoot", "//:skia_public", "", "/", "skia_public")
+ test("PathWithTarget", "//foo/bar:wiz", "", "/foo/bar", "wiz")
+ test("PathWithFile", "@abseil_cpp//absl/algorithm:algorithm.h", "@abseil_cpp", "/absl/algorithm", "algorithm.h")
+ test("DirDefaultTarget", "//tools/flags", "", "/tools/flags", "flags")
+ test("RepoDefaultTarget", "@libpng", "@libpng", "/", "libpng")
+ test("TargetWithPath", "//src/sksl:generated/sksl_compute.dehydrated.sksl", "", "/src/sksl", "generated/sksl_compute.dehydrated.sksl")
+}
+
+func TestParseLocation_ValidInput_Success(t *testing.T) {
+ path, line, pos, err := parseLocation("/path/to/file.txt:12:875")
+ require.NoError(t, err)
+ assert.Equal(t, "/path/to/file.txt", path)
+ assert.Equal(t, 12, line)
+ assert.Equal(t, 875, pos)
+}
+
+func TestGetLocationDir_ValidInput_Success(t *testing.T) {
+ path, err := getLocationDir("/path/to/file.txt:12:875")
+ require.NoError(t, err)
+ assert.Equal(t, "/path/to", path)
+}
+
+func TestGetRuleSimpleName_ValidInput_Success(t *testing.T) {
+ test := func(name, rule, expectedName string) {
+ t.Run(name, func(t *testing.T) {
+ cmakeName, err := getRuleSimpleName(rule)
+ require.NoError(t, err)
+ assert.Equal(t, expectedName, cmakeName)
+ })
+ }
+
+ test("PathWithTarget", "//include/private/chromium:private_hdrs", "include_private_chromium_private_hdrs")
+ test("PathWithHost", "@repo//path/to/dir:file.txt", "at_repo_path_to_dir_file.txt")
+ test("RootTarget", "//:skia_public", "skia_public")
+ test("HostTarget", "@repo//:deps", "at_repo_deps")
+ test("DirDefaultTarget", "//tools/flags", "tools_flags_flags") // Input rule shorthand for "//tools/flags:flags".
+ test("RepoDefaultTarget", "@libpng", "at_libpng_libpng") // Input rule shorthand for "@libpng//:libpng".
+}
+
+func TestGetRuleStringArrayAttribute_NoAttrib_ReturnsNilSlice(t *testing.T) {
+ var rule build.Rule
+ slice, err := getRuleStringArrayAttribute(&rule, "missing-attrib")
+ assert.NoError(t, err)
+ assert.Empty(t, slice)
+}
+
+func TestAppendUnique_NotPresent_Appended(t *testing.T) {
+ slice := appendUnique([]string{"one"}, "two")
+ assert.Equal(t, []string{"one", "two"}, slice)
+}
+
+func TestAppendUnique_Present_NotAppended(t *testing.T) {
+ slice := appendUnique([]string{"one", "two"}, "two")
+ assert.Equal(t, []string{"one", "two"}, slice)
+}
+
+func TestIsExternalRule_IsExternal_ExpectTrue(t *testing.T) {
+ assert.True(t, isExternalRule("@abseil_cpp//absl/algorithm:algorithm.h"))
+}
+
+func TestIsExternalRule_IsInternal_ExpectFalse(t *testing.T) {
+ assert.False(t, isExternalRule("//:skia_public"))
+}
+
+func TestIsFileRule_InvalidRule_ReturnsFalse(t *testing.T) {
+ assert.False(t, isFileTarget(""))
+}
+
+func TestIsFileRule_ValidFileRule_ReturnsTrue(t *testing.T) {
+ assert.True(t, isFileTarget("//dir/path:hello.c"))
+}
+
+func TestIsFileRule_ValidNonFileRule_ReturnsFalse(t *testing.T) {
+ assert.False(t, isFileTarget("//dir/path:hello"))
+}
+
+func TestFindRule_RuleExists_Success(t *testing.T) {
+ qr := analysis_v2.CqueryResult{}
+ err := prototext.Unmarshal([]byte(textProto), &qr)
+ require.NoError(t, err)
+
+ r := findRule(&qr, "//src/apps:hello")
+ require.NotNil(t, r)
+ assert.Equal(t, "//src/apps:hello", r.GetName())
+}
+
+func TestFindRule_RuleDoesntExists_ReturnsNil(t *testing.T) {
+ qr := analysis_v2.CqueryResult{}
+ err := prototext.Unmarshal([]byte(textProto), &qr)
+ require.NoError(t, err)
+
+ assert.Nil(t, findRule(&qr, "//path/to:nonexistent_rule"))
+}
+
+func TestFindRule_InvalidRule_ReturnsNil(t *testing.T) {
+ qr := analysis_v2.CqueryResult{}
+ err := prototext.Unmarshal([]byte(textProto), &qr)
+ require.NoError(t, err)
+
+ assert.Nil(t, findRule(&qr, ""))
+}
diff --git a/chromium/third_party/skia/bazel/exporter/build_proto/README.md b/chromium/third_party/skia/bazel/exporter/build_proto/README.md
new file mode 100644
index 00000000000..e01946ffcc3
--- /dev/null
+++ b/chromium/third_party/skia/bazel/exporter/build_proto/README.md
@@ -0,0 +1,28 @@
+This directory contains generated Go wrappers for Bazel cquery result
+protocol buffers defined in https://github.com/bazelbuild/bazel/tree/master/src/main/protobuf.
+
+An attempt was made to use [go_proto_library](https://github.com/bazelbuild/rules_go/blob/master/proto/core.rst#go-proto-library)
+to generate this code at build time, sourcing the embedded_tools dependency, but that
+was never successful. The cause appears to be that the protobufs in Bazel's source
+defined messages of the same name (specifically "Target") which creates a build
+conflict. The command below generates the two Go classes with different package names
+to avoid this conflict - which is what the Bazel generated Java wrapper does.
+
+They were generated as so:
+
+```bash
+BAZEL_DIR=/path/to/bazel/source
+DST_DIR=${PWD}/bazel/exporter/build_proto
+GO_PACKAGE=go.skia.org/skia/bazel/exporter/build_proto
+GO_GEN_CODE_ROOT=${DST_DIR}/go.skia.org/skia/bazel/exporter/build_proto
+
+protoc \
+ --proto_path=${BAZEL_DIR} \
+ --go_out=${DST_DIR} \
+ --go_opt=Msrc/main/protobuf/build.proto=${GO_PACKAGE}/build \
+ --go_opt=Msrc/main/protobuf/analysis_v2.proto=${GO_PACKAGE}/analysis_v2 \
+ ${SRC_DIR}/analysis_v2.proto ${SRC_DIR}/build.proto
+```
+
+The call above writes the generated code to `${DST_DIR}/go.skia.org/skia/bazel/exporter/build_proto`
+which is then moved into `${DST_DIR}/build` and `${DST_DIR}/build`. \ No newline at end of file
diff --git a/chromium/third_party/skia/bazel/exporter/build_proto/analysis_v2/BUILD.bazel b/chromium/third_party/skia/bazel/exporter/build_proto/analysis_v2/BUILD.bazel
new file mode 100644
index 00000000000..b67dff71941
--- /dev/null
+++ b/chromium/third_party/skia/bazel/exporter/build_proto/analysis_v2/BUILD.bazel
@@ -0,0 +1,18 @@
+load("//bazel:macros.bzl", "exports_files_legacy")
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+
+licenses(["notice"])
+
+exports_files_legacy()
+
+go_library(
+ name = "analysis_v2",
+ srcs = ["analysis_v2.pb.go"],
+ importpath = "go.skia.org/skia/bazel/exporter/build_proto/analysis_v2",
+ visibility = ["//visibility:public"],
+ deps = [
+ "//bazel/exporter/build_proto/build",
+ "@org_golang_google_protobuf//reflect/protoreflect",
+ "@org_golang_google_protobuf//runtime/protoimpl",
+ ],
+)
diff --git a/chromium/third_party/skia/bazel/exporter/build_proto/analysis_v2/analysis_v2.pb.go b/chromium/third_party/skia/bazel/exporter/build_proto/analysis_v2/analysis_v2.pb.go
new file mode 100644
index 00000000000..25092a06ed6
--- /dev/null
+++ b/chromium/third_party/skia/bazel/exporter/build_proto/analysis_v2/analysis_v2.pb.go
@@ -0,0 +1,1488 @@
+// Copyright 2018 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.28.0
+// protoc v3.21.3
+// source: src/main/protobuf/analysis_v2.proto
+
+package analysis_v2
+
+import (
+ build "go.skia.org/skia/bazel/exporter/build_proto/build"
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+// Container for the action graph properties.
+type ActionGraphContainer struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Artifacts []*Artifact `protobuf:"bytes,1,rep,name=artifacts,proto3" json:"artifacts,omitempty"`
+ Actions []*Action `protobuf:"bytes,2,rep,name=actions,proto3" json:"actions,omitempty"`
+ Targets []*Target `protobuf:"bytes,3,rep,name=targets,proto3" json:"targets,omitempty"`
+ DepSetOfFiles []*DepSetOfFiles `protobuf:"bytes,4,rep,name=dep_set_of_files,json=depSetOfFiles,proto3" json:"dep_set_of_files,omitempty"`
+ Configuration []*Configuration `protobuf:"bytes,5,rep,name=configuration,proto3" json:"configuration,omitempty"`
+ AspectDescriptors []*AspectDescriptor `protobuf:"bytes,6,rep,name=aspect_descriptors,json=aspectDescriptors,proto3" json:"aspect_descriptors,omitempty"`
+ RuleClasses []*RuleClass `protobuf:"bytes,7,rep,name=rule_classes,json=ruleClasses,proto3" json:"rule_classes,omitempty"`
+ PathFragments []*PathFragment `protobuf:"bytes,8,rep,name=path_fragments,json=pathFragments,proto3" json:"path_fragments,omitempty"`
+}
+
+func (x *ActionGraphContainer) Reset() {
+ *x = ActionGraphContainer{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ActionGraphContainer) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ActionGraphContainer) ProtoMessage() {}
+
+func (x *ActionGraphContainer) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ActionGraphContainer.ProtoReflect.Descriptor instead.
+func (*ActionGraphContainer) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_analysis_v2_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *ActionGraphContainer) GetArtifacts() []*Artifact {
+ if x != nil {
+ return x.Artifacts
+ }
+ return nil
+}
+
+func (x *ActionGraphContainer) GetActions() []*Action {
+ if x != nil {
+ return x.Actions
+ }
+ return nil
+}
+
+func (x *ActionGraphContainer) GetTargets() []*Target {
+ if x != nil {
+ return x.Targets
+ }
+ return nil
+}
+
+func (x *ActionGraphContainer) GetDepSetOfFiles() []*DepSetOfFiles {
+ if x != nil {
+ return x.DepSetOfFiles
+ }
+ return nil
+}
+
+func (x *ActionGraphContainer) GetConfiguration() []*Configuration {
+ if x != nil {
+ return x.Configuration
+ }
+ return nil
+}
+
+func (x *ActionGraphContainer) GetAspectDescriptors() []*AspectDescriptor {
+ if x != nil {
+ return x.AspectDescriptors
+ }
+ return nil
+}
+
+func (x *ActionGraphContainer) GetRuleClasses() []*RuleClass {
+ if x != nil {
+ return x.RuleClasses
+ }
+ return nil
+}
+
+func (x *ActionGraphContainer) GetPathFragments() []*PathFragment {
+ if x != nil {
+ return x.PathFragments
+ }
+ return nil
+}
+
+// Represents a single artifact, whether it's a source file or a derived output
+// file.
+type Artifact struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Identifier for this artifact; this is a uint32, only valid for this
+ // particular dump of the analysis.
+ Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+ // The id of the PathFragment that represents the relative path of the file
+ // within the execution root.
+ PathFragmentId uint32 `protobuf:"varint,2,opt,name=path_fragment_id,json=pathFragmentId,proto3" json:"path_fragment_id,omitempty"`
+ // True iff the artifact is a tree artifact, i.e. the above exec_path refers
+ // a directory.
+ IsTreeArtifact bool `protobuf:"varint,3,opt,name=is_tree_artifact,json=isTreeArtifact,proto3" json:"is_tree_artifact,omitempty"`
+}
+
+func (x *Artifact) Reset() {
+ *x = Artifact{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Artifact) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Artifact) ProtoMessage() {}
+
+func (x *Artifact) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Artifact.ProtoReflect.Descriptor instead.
+func (*Artifact) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_analysis_v2_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *Artifact) GetId() uint32 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+func (x *Artifact) GetPathFragmentId() uint32 {
+ if x != nil {
+ return x.PathFragmentId
+ }
+ return 0
+}
+
+func (x *Artifact) GetIsTreeArtifact() bool {
+ if x != nil {
+ return x.IsTreeArtifact
+ }
+ return false
+}
+
+// Represents a single action, which is a function from Artifact(s) to
+// Artifact(s).
+type Action struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The target that was responsible for the creation of the action.
+ TargetId uint32 `protobuf:"varint,1,opt,name=target_id,json=targetId,proto3" json:"target_id,omitempty"`
+ // The aspects that were responsible for the creation of the action (if any).
+ // In the case of aspect-on-aspect, AspectDescriptors are listed in
+ // topological order of the dependency graph.
+ // e.g. [A, B] would imply that aspect A is applied on top of aspect B.
+ AspectDescriptorIds []uint32 `protobuf:"varint,2,rep,packed,name=aspect_descriptor_ids,json=aspectDescriptorIds,proto3" json:"aspect_descriptor_ids,omitempty"`
+ // Encodes all significant behavior that might affect the output. The key
+ // must change if the work performed by the execution of this action changes.
+ // Note that the key doesn't include checksums of the input files.
+ ActionKey string `protobuf:"bytes,3,opt,name=action_key,json=actionKey,proto3" json:"action_key,omitempty"`
+ // The mnemonic for this kind of action.
+ Mnemonic string `protobuf:"bytes,4,opt,name=mnemonic,proto3" json:"mnemonic,omitempty"`
+ // The configuration under which this action is executed.
+ ConfigurationId uint32 `protobuf:"varint,5,opt,name=configuration_id,json=configurationId,proto3" json:"configuration_id,omitempty"`
+ // The command line arguments of the action. This will be only set if
+ // explicitly requested.
+ Arguments []string `protobuf:"bytes,6,rep,name=arguments,proto3" json:"arguments,omitempty"`
+ // The list of environment variables to be set before executing the command.
+ EnvironmentVariables []*KeyValuePair `protobuf:"bytes,7,rep,name=environment_variables,json=environmentVariables,proto3" json:"environment_variables,omitempty"`
+ // The set of input dep sets that the action depends upon. If the action does
+ // input discovery, the contents of this set might change during execution.
+ InputDepSetIds []uint32 `protobuf:"varint,8,rep,packed,name=input_dep_set_ids,json=inputDepSetIds,proto3" json:"input_dep_set_ids,omitempty"`
+ // The list of Artifact IDs that represent the output files that this action
+ // will generate.
+ OutputIds []uint32 `protobuf:"varint,9,rep,packed,name=output_ids,json=outputIds,proto3" json:"output_ids,omitempty"`
+ // True iff the action does input discovery during execution.
+ DiscoversInputs bool `protobuf:"varint,10,opt,name=discovers_inputs,json=discoversInputs,proto3" json:"discovers_inputs,omitempty"`
+ // Execution info for the action. Remote execution services may use this
+ // information to modify the execution environment, but actions will
+ // generally not be aware of it.
+ ExecutionInfo []*KeyValuePair `protobuf:"bytes,11,rep,name=execution_info,json=executionInfo,proto3" json:"execution_info,omitempty"`
+ // The list of param files. This will be only set if explicitly requested.
+ ParamFiles []*ParamFile `protobuf:"bytes,12,rep,name=param_files,json=paramFiles,proto3" json:"param_files,omitempty"`
+ // The id to an Artifact that is the primary output of this action.
+ PrimaryOutputId uint32 `protobuf:"varint,13,opt,name=primary_output_id,json=primaryOutputId,proto3" json:"primary_output_id,omitempty"`
+ // The execution platform for this action. Empty if the action has no
+ // execution platform.
+ ExecutionPlatform string `protobuf:"bytes,14,opt,name=execution_platform,json=executionPlatform,proto3" json:"execution_platform,omitempty"`
+ // The template content of the action, if it is TemplateExpand action.
+ TemplateContent string `protobuf:"bytes,15,opt,name=template_content,json=templateContent,proto3" json:"template_content,omitempty"`
+ // The list of substitution should be performed on the template. The key is
+ // the string to be substituted and the value is the string to be substituted
+ // to.
+ Substitutions []*KeyValuePair `protobuf:"bytes,16,rep,name=substitutions,proto3" json:"substitutions,omitempty"`
+ // The contents of the file for the actions.write() action
+ // (guarded by the --include_file_write_contents flag).
+ FileContents string `protobuf:"bytes,17,opt,name=file_contents,json=fileContents,proto3" json:"file_contents,omitempty"`
+}
+
+func (x *Action) Reset() {
+ *x = Action{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Action) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Action) ProtoMessage() {}
+
+func (x *Action) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Action.ProtoReflect.Descriptor instead.
+func (*Action) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_analysis_v2_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *Action) GetTargetId() uint32 {
+ if x != nil {
+ return x.TargetId
+ }
+ return 0
+}
+
+func (x *Action) GetAspectDescriptorIds() []uint32 {
+ if x != nil {
+ return x.AspectDescriptorIds
+ }
+ return nil
+}
+
+func (x *Action) GetActionKey() string {
+ if x != nil {
+ return x.ActionKey
+ }
+ return ""
+}
+
+func (x *Action) GetMnemonic() string {
+ if x != nil {
+ return x.Mnemonic
+ }
+ return ""
+}
+
+func (x *Action) GetConfigurationId() uint32 {
+ if x != nil {
+ return x.ConfigurationId
+ }
+ return 0
+}
+
+func (x *Action) GetArguments() []string {
+ if x != nil {
+ return x.Arguments
+ }
+ return nil
+}
+
+func (x *Action) GetEnvironmentVariables() []*KeyValuePair {
+ if x != nil {
+ return x.EnvironmentVariables
+ }
+ return nil
+}
+
+func (x *Action) GetInputDepSetIds() []uint32 {
+ if x != nil {
+ return x.InputDepSetIds
+ }
+ return nil
+}
+
+func (x *Action) GetOutputIds() []uint32 {
+ if x != nil {
+ return x.OutputIds
+ }
+ return nil
+}
+
+func (x *Action) GetDiscoversInputs() bool {
+ if x != nil {
+ return x.DiscoversInputs
+ }
+ return false
+}
+
+func (x *Action) GetExecutionInfo() []*KeyValuePair {
+ if x != nil {
+ return x.ExecutionInfo
+ }
+ return nil
+}
+
+func (x *Action) GetParamFiles() []*ParamFile {
+ if x != nil {
+ return x.ParamFiles
+ }
+ return nil
+}
+
+func (x *Action) GetPrimaryOutputId() uint32 {
+ if x != nil {
+ return x.PrimaryOutputId
+ }
+ return 0
+}
+
+func (x *Action) GetExecutionPlatform() string {
+ if x != nil {
+ return x.ExecutionPlatform
+ }
+ return ""
+}
+
+func (x *Action) GetTemplateContent() string {
+ if x != nil {
+ return x.TemplateContent
+ }
+ return ""
+}
+
+func (x *Action) GetSubstitutions() []*KeyValuePair {
+ if x != nil {
+ return x.Substitutions
+ }
+ return nil
+}
+
+func (x *Action) GetFileContents() string {
+ if x != nil {
+ return x.FileContents
+ }
+ return ""
+}
+
+// Represents a single target (without configuration information) that is
+// associated with an action.
+type Target struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Identifier for this target; this is a uint32, only valid for this
+ // particular dump of the analysis.
+ Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+ // Label of the target, e.g. //foo:bar.
+ Label string `protobuf:"bytes,2,opt,name=label,proto3" json:"label,omitempty"`
+ // Class of the rule.
+ RuleClassId uint32 `protobuf:"varint,3,opt,name=rule_class_id,json=ruleClassId,proto3" json:"rule_class_id,omitempty"`
+}
+
+func (x *Target) Reset() {
+ *x = Target{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Target) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Target) ProtoMessage() {}
+
+func (x *Target) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Target.ProtoReflect.Descriptor instead.
+func (*Target) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_analysis_v2_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *Target) GetId() uint32 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+func (x *Target) GetLabel() string {
+ if x != nil {
+ return x.Label
+ }
+ return ""
+}
+
+func (x *Target) GetRuleClassId() uint32 {
+ if x != nil {
+ return x.RuleClassId
+ }
+ return 0
+}
+
+type RuleClass struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Identifier for this rule class; this is a uint32, only valid for
+ // this particular dump of the analysis.
+ Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+ // Name of the rule class, e.g. cc_library.
+ Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
+}
+
+func (x *RuleClass) Reset() {
+ *x = RuleClass{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *RuleClass) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*RuleClass) ProtoMessage() {}
+
+func (x *RuleClass) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[4]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use RuleClass.ProtoReflect.Descriptor instead.
+func (*RuleClass) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_analysis_v2_proto_rawDescGZIP(), []int{4}
+}
+
+func (x *RuleClass) GetId() uint32 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+func (x *RuleClass) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+// Represents an invocation specific descriptor of an aspect.
+type AspectDescriptor struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Identifier for this aspect descriptor; this is a uint32, only valid
+ // for the particular dump of the analysis.
+ Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+ // The name of the corresponding aspect. For native aspects, it's the Java
+ // class name, for Starlark aspects it's the bzl file followed by a % sign
+ // followed by the name of the aspect.
+ Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
+ // The list of parameters bound to a particular invocation of that aspect on
+ // a target. Note that aspects can be executed multiple times on the same
+ // target in different order.
+ Parameters []*KeyValuePair `protobuf:"bytes,3,rep,name=parameters,proto3" json:"parameters,omitempty"`
+}
+
+func (x *AspectDescriptor) Reset() {
+ *x = AspectDescriptor{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[5]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *AspectDescriptor) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*AspectDescriptor) ProtoMessage() {}
+
+func (x *AspectDescriptor) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[5]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use AspectDescriptor.ProtoReflect.Descriptor instead.
+func (*AspectDescriptor) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_analysis_v2_proto_rawDescGZIP(), []int{5}
+}
+
+func (x *AspectDescriptor) GetId() uint32 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+func (x *AspectDescriptor) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *AspectDescriptor) GetParameters() []*KeyValuePair {
+ if x != nil {
+ return x.Parameters
+ }
+ return nil
+}
+
+type DepSetOfFiles struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Identifier for this named set of files; this is a uint32, only
+ // valid for the particular dump of the analysis.
+ Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+ // Other transitively included named set of files.
+ TransitiveDepSetIds []uint32 `protobuf:"varint,2,rep,packed,name=transitive_dep_set_ids,json=transitiveDepSetIds,proto3" json:"transitive_dep_set_ids,omitempty"`
+ // The list of input artifact IDs that are immediately contained in this set.
+ DirectArtifactIds []uint32 `protobuf:"varint,3,rep,packed,name=direct_artifact_ids,json=directArtifactIds,proto3" json:"direct_artifact_ids,omitempty"`
+}
+
+func (x *DepSetOfFiles) Reset() {
+ *x = DepSetOfFiles{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[6]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *DepSetOfFiles) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DepSetOfFiles) ProtoMessage() {}
+
+func (x *DepSetOfFiles) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[6]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use DepSetOfFiles.ProtoReflect.Descriptor instead.
+func (*DepSetOfFiles) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_analysis_v2_proto_rawDescGZIP(), []int{6}
+}
+
+func (x *DepSetOfFiles) GetId() uint32 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+func (x *DepSetOfFiles) GetTransitiveDepSetIds() []uint32 {
+ if x != nil {
+ return x.TransitiveDepSetIds
+ }
+ return nil
+}
+
+func (x *DepSetOfFiles) GetDirectArtifactIds() []uint32 {
+ if x != nil {
+ return x.DirectArtifactIds
+ }
+ return nil
+}
+
+type Configuration struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Identifier for this configuration; this is a uint32, only valid for
+ // the particular dump of the analysis.
+ Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+ // The mnemonic representing the build configuration.
+ Mnemonic string `protobuf:"bytes,2,opt,name=mnemonic,proto3" json:"mnemonic,omitempty"`
+ // The platform string.
+ PlatformName string `protobuf:"bytes,3,opt,name=platform_name,json=platformName,proto3" json:"platform_name,omitempty"`
+ // The checksum representation of the configuration options;
+ Checksum string `protobuf:"bytes,4,opt,name=checksum,proto3" json:"checksum,omitempty"`
+ // Whether this configuration is used for building tools.
+ IsTool bool `protobuf:"varint,5,opt,name=is_tool,json=isTool,proto3" json:"is_tool,omitempty"`
+}
+
+func (x *Configuration) Reset() {
+ *x = Configuration{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Configuration) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Configuration) ProtoMessage() {}
+
+func (x *Configuration) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[7]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Configuration.ProtoReflect.Descriptor instead.
+func (*Configuration) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_analysis_v2_proto_rawDescGZIP(), []int{7}
+}
+
+func (x *Configuration) GetId() uint32 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+func (x *Configuration) GetMnemonic() string {
+ if x != nil {
+ return x.Mnemonic
+ }
+ return ""
+}
+
+func (x *Configuration) GetPlatformName() string {
+ if x != nil {
+ return x.PlatformName
+ }
+ return ""
+}
+
+func (x *Configuration) GetChecksum() string {
+ if x != nil {
+ return x.Checksum
+ }
+ return ""
+}
+
+func (x *Configuration) GetIsTool() bool {
+ if x != nil {
+ return x.IsTool
+ }
+ return false
+}
+
+type KeyValuePair struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The variable name.
+ Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
+ // The variable value.
+ Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *KeyValuePair) Reset() {
+ *x = KeyValuePair{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[8]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *KeyValuePair) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*KeyValuePair) ProtoMessage() {}
+
+func (x *KeyValuePair) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[8]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use KeyValuePair.ProtoReflect.Descriptor instead.
+func (*KeyValuePair) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_analysis_v2_proto_rawDescGZIP(), []int{8}
+}
+
+func (x *KeyValuePair) GetKey() string {
+ if x != nil {
+ return x.Key
+ }
+ return ""
+}
+
+func (x *KeyValuePair) GetValue() string {
+ if x != nil {
+ return x.Value
+ }
+ return ""
+}
+
+type ConfiguredTarget struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The target. We use blaze_query.Target defined in build.proto instead of
+ // the Target defined in this file because blaze_query.Target is much heavier
+ // and will output proto results similar to what users are familiar with from
+ // regular blaze query.
+ Target *build.Target `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`
+ // DEPRECATED. Use configuration_id instead.
+ //
+ // Deprecated: Do not use.
+ Configuration *Configuration `protobuf:"bytes,2,opt,name=configuration,proto3" json:"configuration,omitempty"`
+ // The id of the configuration this target is configured for. The actual
+ // Configuration message can be found in CqueryResults. If the target doesn't
+ // have a configuration, the value will be 0.
+ ConfigurationId uint32 `protobuf:"varint,3,opt,name=configuration_id,json=configurationId,proto3" json:"configuration_id,omitempty"`
+}
+
+func (x *ConfiguredTarget) Reset() {
+ *x = ConfiguredTarget{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[9]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ConfiguredTarget) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ConfiguredTarget) ProtoMessage() {}
+
+func (x *ConfiguredTarget) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[9]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ConfiguredTarget.ProtoReflect.Descriptor instead.
+func (*ConfiguredTarget) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_analysis_v2_proto_rawDescGZIP(), []int{9}
+}
+
+func (x *ConfiguredTarget) GetTarget() *build.Target {
+ if x != nil {
+ return x.Target
+ }
+ return nil
+}
+
+// Deprecated: Do not use.
+func (x *ConfiguredTarget) GetConfiguration() *Configuration {
+ if x != nil {
+ return x.Configuration
+ }
+ return nil
+}
+
+func (x *ConfiguredTarget) GetConfigurationId() uint32 {
+ if x != nil {
+ return x.ConfigurationId
+ }
+ return 0
+}
+
+// Container for cquery results
+type CqueryResult struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // All the configuredtargets returns by cquery
+ Results []*ConfiguredTarget `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"`
+ // All the Configurations referenced by results.
+ Configurations []*Configuration `protobuf:"bytes,2,rep,name=configurations,proto3" json:"configurations,omitempty"`
+}
+
+func (x *CqueryResult) Reset() {
+ *x = CqueryResult{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[10]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CqueryResult) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CqueryResult) ProtoMessage() {}
+
+func (x *CqueryResult) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[10]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CqueryResult.ProtoReflect.Descriptor instead.
+func (*CqueryResult) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_analysis_v2_proto_rawDescGZIP(), []int{10}
+}
+
+func (x *CqueryResult) GetResults() []*ConfiguredTarget {
+ if x != nil {
+ return x.Results
+ }
+ return nil
+}
+
+func (x *CqueryResult) GetConfigurations() []*Configuration {
+ if x != nil {
+ return x.Configurations
+ }
+ return nil
+}
+
+// Content of a param file.
+type ParamFile struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The exec path of the param file artifact.
+ ExecPath string `protobuf:"bytes,1,opt,name=exec_path,json=execPath,proto3" json:"exec_path,omitempty"`
+ // The arguments in the param file.
+ // Each argument corresponds to a line in the param file.
+ Arguments []string `protobuf:"bytes,2,rep,name=arguments,proto3" json:"arguments,omitempty"`
+}
+
+func (x *ParamFile) Reset() {
+ *x = ParamFile{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[11]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ParamFile) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ParamFile) ProtoMessage() {}
+
+func (x *ParamFile) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[11]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ParamFile.ProtoReflect.Descriptor instead.
+func (*ParamFile) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_analysis_v2_proto_rawDescGZIP(), []int{11}
+}
+
+func (x *ParamFile) GetExecPath() string {
+ if x != nil {
+ return x.ExecPath
+ }
+ return ""
+}
+
+func (x *ParamFile) GetArguments() []string {
+ if x != nil {
+ return x.Arguments
+ }
+ return nil
+}
+
+// The path fragment that makes up a full path.
+type PathFragment struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Identifier for this path fragment.
+ Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+ // The label of the section in the path.
+ Label string `protobuf:"bytes,2,opt,name=label,proto3" json:"label,omitempty"`
+ // The id of the parent path fragment.
+ ParentId uint32 `protobuf:"varint,3,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"`
+}
+
+func (x *PathFragment) Reset() {
+ *x = PathFragment{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[12]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *PathFragment) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PathFragment) ProtoMessage() {}
+
+func (x *PathFragment) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_analysis_v2_proto_msgTypes[12]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use PathFragment.ProtoReflect.Descriptor instead.
+func (*PathFragment) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_analysis_v2_proto_rawDescGZIP(), []int{12}
+}
+
+func (x *PathFragment) GetId() uint32 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+func (x *PathFragment) GetLabel() string {
+ if x != nil {
+ return x.Label
+ }
+ return ""
+}
+
+func (x *PathFragment) GetParentId() uint32 {
+ if x != nil {
+ return x.ParentId
+ }
+ return 0
+}
+
+var File_src_main_protobuf_analysis_v2_proto protoreflect.FileDescriptor
+
+var file_src_main_protobuf_analysis_v2_proto_rawDesc = []byte{
+ 0x0a, 0x23, 0x73, 0x72, 0x63, 0x2f, 0x6d, 0x61, 0x69, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+ 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x5f, 0x76, 0x32, 0x2e,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x1a,
+ 0x1d, 0x73, 0x72, 0x63, 0x2f, 0x6d, 0x61, 0x69, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
+ 0x75, 0x66, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe3,
+ 0x03, 0x0a, 0x14, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x72, 0x61, 0x70, 0x68, 0x43, 0x6f,
+ 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x30, 0x0a, 0x09, 0x61, 0x72, 0x74, 0x69, 0x66,
+ 0x61, 0x63, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x61, 0x6e, 0x61,
+ 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x52, 0x09,
+ 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x73, 0x12, 0x2a, 0x0a, 0x07, 0x61, 0x63, 0x74,
+ 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x61, 0x6e, 0x61,
+ 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x61, 0x63,
+ 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2a, 0x0a, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73,
+ 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69,
+ 0x73, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74,
+ 0x73, 0x12, 0x40, 0x0a, 0x10, 0x64, 0x65, 0x70, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x6f, 0x66, 0x5f,
+ 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x61, 0x6e,
+ 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, 0x44, 0x65, 0x70, 0x53, 0x65, 0x74, 0x4f, 0x66, 0x46,
+ 0x69, 0x6c, 0x65, 0x73, 0x52, 0x0d, 0x64, 0x65, 0x70, 0x53, 0x65, 0x74, 0x4f, 0x66, 0x46, 0x69,
+ 0x6c, 0x65, 0x73, 0x12, 0x3d, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x61, 0x6e, 0x61,
+ 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74,
+ 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69,
+ 0x6f, 0x6e, 0x12, 0x49, 0x0a, 0x12, 0x61, 0x73, 0x70, 0x65, 0x63, 0x74, 0x5f, 0x64, 0x65, 0x73,
+ 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a,
+ 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, 0x41, 0x73, 0x70, 0x65, 0x63, 0x74,
+ 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x52, 0x11, 0x61, 0x73, 0x70, 0x65,
+ 0x63, 0x74, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x36, 0x0a,
+ 0x0c, 0x72, 0x75, 0x6c, 0x65, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x18, 0x07, 0x20,
+ 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, 0x52,
+ 0x75, 0x6c, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x52, 0x0b, 0x72, 0x75, 0x6c, 0x65, 0x43, 0x6c,
+ 0x61, 0x73, 0x73, 0x65, 0x73, 0x12, 0x3d, 0x0a, 0x0e, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x66, 0x72,
+ 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e,
+ 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x46, 0x72, 0x61,
+ 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x0d, 0x70, 0x61, 0x74, 0x68, 0x46, 0x72, 0x61, 0x67, 0x6d,
+ 0x65, 0x6e, 0x74, 0x73, 0x22, 0x6e, 0x0a, 0x08, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74,
+ 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64,
+ 0x12, 0x28, 0x0a, 0x10, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e,
+ 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x70, 0x61, 0x74, 0x68,
+ 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x10, 0x69, 0x73,
+ 0x5f, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x18, 0x03,
+ 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x69, 0x73, 0x54, 0x72, 0x65, 0x65, 0x41, 0x72, 0x74, 0x69,
+ 0x66, 0x61, 0x63, 0x74, 0x22, 0xfd, 0x05, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12,
+ 0x1b, 0x0a, 0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x0d, 0x52, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x49, 0x64, 0x12, 0x32, 0x0a, 0x15,
+ 0x61, 0x73, 0x70, 0x65, 0x63, 0x74, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f,
+ 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x13, 0x61, 0x73, 0x70,
+ 0x65, 0x63, 0x74, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x73,
+ 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12,
+ 0x1a, 0x0a, 0x08, 0x6d, 0x6e, 0x65, 0x6d, 0x6f, 0x6e, 0x69, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x08, 0x6d, 0x6e, 0x65, 0x6d, 0x6f, 0x6e, 0x69, 0x63, 0x12, 0x29, 0x0a, 0x10, 0x63,
+ 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18,
+ 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65,
+ 0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x61, 0x72, 0x67, 0x75, 0x6d,
+ 0x65, 0x6e, 0x74, 0x73, 0x12, 0x4b, 0x0a, 0x15, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d,
+ 0x65, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x18, 0x07, 0x20,
+ 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, 0x4b,
+ 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x50, 0x61, 0x69, 0x72, 0x52, 0x14, 0x65, 0x6e, 0x76,
+ 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65,
+ 0x73, 0x12, 0x29, 0x0a, 0x11, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x64, 0x65, 0x70, 0x5f, 0x73,
+ 0x65, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x0e, 0x69, 0x6e,
+ 0x70, 0x75, 0x74, 0x44, 0x65, 0x70, 0x53, 0x65, 0x74, 0x49, 0x64, 0x73, 0x12, 0x1d, 0x0a, 0x0a,
+ 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0d,
+ 0x52, 0x09, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x49, 0x64, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x64,
+ 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x73, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x73, 0x18,
+ 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x73,
+ 0x49, 0x6e, 0x70, 0x75, 0x74, 0x73, 0x12, 0x3d, 0x0a, 0x0e, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74,
+ 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16,
+ 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c,
+ 0x75, 0x65, 0x50, 0x61, 0x69, 0x72, 0x52, 0x0d, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f,
+ 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x34, 0x0a, 0x0b, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x5f, 0x66,
+ 0x69, 0x6c, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x6e, 0x61,
+ 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x46, 0x69, 0x6c, 0x65, 0x52,
+ 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x70,
+ 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x69, 0x64,
+ 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x4f,
+ 0x75, 0x74, 0x70, 0x75, 0x74, 0x49, 0x64, 0x12, 0x2d, 0x0a, 0x12, 0x65, 0x78, 0x65, 0x63, 0x75,
+ 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x0e, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x11, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6c,
+ 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x29, 0x0a, 0x10, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61,
+ 0x74, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x0f, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e,
+ 0x74, 0x12, 0x3c, 0x0a, 0x0d, 0x73, 0x75, 0x62, 0x73, 0x74, 0x69, 0x74, 0x75, 0x74, 0x69, 0x6f,
+ 0x6e, 0x73, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79,
+ 0x73, 0x69, 0x73, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x50, 0x61, 0x69, 0x72,
+ 0x52, 0x0d, 0x73, 0x75, 0x62, 0x73, 0x74, 0x69, 0x74, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12,
+ 0x23, 0x0a, 0x0d, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73,
+ 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x69, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x74,
+ 0x65, 0x6e, 0x74, 0x73, 0x22, 0x52, 0x0a, 0x06, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x0e,
+ 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14,
+ 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c,
+ 0x61, 0x62, 0x65, 0x6c, 0x12, 0x22, 0x0a, 0x0d, 0x72, 0x75, 0x6c, 0x65, 0x5f, 0x63, 0x6c, 0x61,
+ 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x72, 0x75, 0x6c,
+ 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x22, 0x2f, 0x0a, 0x09, 0x52, 0x75, 0x6c, 0x65,
+ 0x43, 0x6c, 0x61, 0x73, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x6e, 0x0a, 0x10, 0x41, 0x73, 0x70,
+ 0x65, 0x63, 0x74, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x12, 0x0e, 0x0a,
+ 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,
+ 0x65, 0x12, 0x36, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18,
+ 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73,
+ 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x50, 0x61, 0x69, 0x72, 0x52, 0x0a, 0x70,
+ 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x22, 0x84, 0x01, 0x0a, 0x0d, 0x44, 0x65,
+ 0x70, 0x53, 0x65, 0x74, 0x4f, 0x66, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69,
+ 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x33, 0x0a, 0x16, 0x74,
+ 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x64, 0x65, 0x70, 0x5f, 0x73, 0x65,
+ 0x74, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x13, 0x74, 0x72, 0x61,
+ 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x44, 0x65, 0x70, 0x53, 0x65, 0x74, 0x49, 0x64, 0x73,
+ 0x12, 0x2e, 0x0a, 0x13, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x5f, 0x61, 0x72, 0x74, 0x69, 0x66,
+ 0x61, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x11, 0x64,
+ 0x69, 0x72, 0x65, 0x63, 0x74, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x49, 0x64, 0x73,
+ 0x22, 0x95, 0x01, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69,
+ 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02,
+ 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x6e, 0x65, 0x6d, 0x6f, 0x6e, 0x69, 0x63, 0x18, 0x02,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x6e, 0x65, 0x6d, 0x6f, 0x6e, 0x69, 0x63, 0x12, 0x23,
+ 0x0a, 0x0d, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18,
+ 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x4e,
+ 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x18,
+ 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12,
+ 0x17, 0x0a, 0x07, 0x69, 0x73, 0x5f, 0x74, 0x6f, 0x6f, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08,
+ 0x52, 0x06, 0x69, 0x73, 0x54, 0x6f, 0x6f, 0x6c, 0x22, 0x36, 0x0a, 0x0c, 0x4b, 0x65, 0x79, 0x56,
+ 0x61, 0x6c, 0x75, 0x65, 0x50, 0x61, 0x69, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61,
+ 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
+ 0x22, 0xad, 0x01, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x64, 0x54,
+ 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x2b, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75,
+ 0x65, 0x72, 0x79, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67,
+ 0x65, 0x74, 0x12, 0x41, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74,
+ 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x61, 0x6e, 0x61, 0x6c,
+ 0x79, 0x73, 0x69, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69,
+ 0x6f, 0x6e, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72,
+ 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75,
+ 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52,
+ 0x0f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64,
+ 0x22, 0x85, 0x01, 0x0a, 0x0c, 0x43, 0x71, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c,
+ 0x74, 0x12, 0x34, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03,
+ 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, 0x43, 0x6f,
+ 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x07,
+ 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x3f, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x66, 0x69,
+ 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32,
+ 0x17, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69,
+ 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67,
+ 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x46, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61,
+ 0x6d, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x78, 0x65, 0x63, 0x5f, 0x70, 0x61,
+ 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x78, 0x65, 0x63, 0x50, 0x61,
+ 0x74, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18,
+ 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73,
+ 0x22, 0x51, 0x0a, 0x0c, 0x50, 0x61, 0x74, 0x68, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74,
+ 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64,
+ 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74,
+ 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e,
+ 0x74, 0x49, 0x64, 0x42, 0x3a, 0x0a, 0x26, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
+ 0x65, 0x2e, 0x64, 0x65, 0x76, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64,
+ 0x2e, 0x6c, 0x69, 0x62, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x42, 0x10, 0x41,
+ 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x56, 0x32, 0x62,
+ 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_src_main_protobuf_analysis_v2_proto_rawDescOnce sync.Once
+ file_src_main_protobuf_analysis_v2_proto_rawDescData = file_src_main_protobuf_analysis_v2_proto_rawDesc
+)
+
+func file_src_main_protobuf_analysis_v2_proto_rawDescGZIP() []byte {
+ file_src_main_protobuf_analysis_v2_proto_rawDescOnce.Do(func() {
+ file_src_main_protobuf_analysis_v2_proto_rawDescData = protoimpl.X.CompressGZIP(file_src_main_protobuf_analysis_v2_proto_rawDescData)
+ })
+ return file_src_main_protobuf_analysis_v2_proto_rawDescData
+}
+
+var file_src_main_protobuf_analysis_v2_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
+var file_src_main_protobuf_analysis_v2_proto_goTypes = []interface{}{
+ (*ActionGraphContainer)(nil), // 0: analysis.ActionGraphContainer
+ (*Artifact)(nil), // 1: analysis.Artifact
+ (*Action)(nil), // 2: analysis.Action
+ (*Target)(nil), // 3: analysis.Target
+ (*RuleClass)(nil), // 4: analysis.RuleClass
+ (*AspectDescriptor)(nil), // 5: analysis.AspectDescriptor
+ (*DepSetOfFiles)(nil), // 6: analysis.DepSetOfFiles
+ (*Configuration)(nil), // 7: analysis.Configuration
+ (*KeyValuePair)(nil), // 8: analysis.KeyValuePair
+ (*ConfiguredTarget)(nil), // 9: analysis.ConfiguredTarget
+ (*CqueryResult)(nil), // 10: analysis.CqueryResult
+ (*ParamFile)(nil), // 11: analysis.ParamFile
+ (*PathFragment)(nil), // 12: analysis.PathFragment
+ (*build.Target)(nil), // 13: blaze_query.Target
+}
+var file_src_main_protobuf_analysis_v2_proto_depIdxs = []int32{
+ 1, // 0: analysis.ActionGraphContainer.artifacts:type_name -> analysis.Artifact
+ 2, // 1: analysis.ActionGraphContainer.actions:type_name -> analysis.Action
+ 3, // 2: analysis.ActionGraphContainer.targets:type_name -> analysis.Target
+ 6, // 3: analysis.ActionGraphContainer.dep_set_of_files:type_name -> analysis.DepSetOfFiles
+ 7, // 4: analysis.ActionGraphContainer.configuration:type_name -> analysis.Configuration
+ 5, // 5: analysis.ActionGraphContainer.aspect_descriptors:type_name -> analysis.AspectDescriptor
+ 4, // 6: analysis.ActionGraphContainer.rule_classes:type_name -> analysis.RuleClass
+ 12, // 7: analysis.ActionGraphContainer.path_fragments:type_name -> analysis.PathFragment
+ 8, // 8: analysis.Action.environment_variables:type_name -> analysis.KeyValuePair
+ 8, // 9: analysis.Action.execution_info:type_name -> analysis.KeyValuePair
+ 11, // 10: analysis.Action.param_files:type_name -> analysis.ParamFile
+ 8, // 11: analysis.Action.substitutions:type_name -> analysis.KeyValuePair
+ 8, // 12: analysis.AspectDescriptor.parameters:type_name -> analysis.KeyValuePair
+ 13, // 13: analysis.ConfiguredTarget.target:type_name -> blaze_query.Target
+ 7, // 14: analysis.ConfiguredTarget.configuration:type_name -> analysis.Configuration
+ 9, // 15: analysis.CqueryResult.results:type_name -> analysis.ConfiguredTarget
+ 7, // 16: analysis.CqueryResult.configurations:type_name -> analysis.Configuration
+ 17, // [17:17] is the sub-list for method output_type
+ 17, // [17:17] is the sub-list for method input_type
+ 17, // [17:17] is the sub-list for extension type_name
+ 17, // [17:17] is the sub-list for extension extendee
+ 0, // [0:17] is the sub-list for field type_name
+}
+
+func init() { file_src_main_protobuf_analysis_v2_proto_init() }
+func file_src_main_protobuf_analysis_v2_proto_init() {
+ if File_src_main_protobuf_analysis_v2_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_src_main_protobuf_analysis_v2_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ActionGraphContainer); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_analysis_v2_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Artifact); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_analysis_v2_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Action); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_analysis_v2_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Target); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_analysis_v2_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*RuleClass); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_analysis_v2_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*AspectDescriptor); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_analysis_v2_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*DepSetOfFiles); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_analysis_v2_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Configuration); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_analysis_v2_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*KeyValuePair); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_analysis_v2_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ConfiguredTarget); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_analysis_v2_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CqueryResult); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_analysis_v2_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ParamFile); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_analysis_v2_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*PathFragment); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_src_main_protobuf_analysis_v2_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 13,
+ NumExtensions: 0,
+ NumServices: 0,
+ },
+ GoTypes: file_src_main_protobuf_analysis_v2_proto_goTypes,
+ DependencyIndexes: file_src_main_protobuf_analysis_v2_proto_depIdxs,
+ MessageInfos: file_src_main_protobuf_analysis_v2_proto_msgTypes,
+ }.Build()
+ File_src_main_protobuf_analysis_v2_proto = out.File
+ file_src_main_protobuf_analysis_v2_proto_rawDesc = nil
+ file_src_main_protobuf_analysis_v2_proto_goTypes = nil
+ file_src_main_protobuf_analysis_v2_proto_depIdxs = nil
+}
diff --git a/chromium/third_party/skia/bazel/exporter/build_proto/build/BUILD.bazel b/chromium/third_party/skia/bazel/exporter/build_proto/build/BUILD.bazel
new file mode 100644
index 00000000000..130f695316d
--- /dev/null
+++ b/chromium/third_party/skia/bazel/exporter/build_proto/build/BUILD.bazel
@@ -0,0 +1,17 @@
+load("//bazel:macros.bzl", "exports_files_legacy")
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+
+licenses(["notice"])
+
+exports_files_legacy()
+
+go_library(
+ name = "build",
+ srcs = ["build.pb.go"],
+ importpath = "go.skia.org/skia/bazel/exporter/build_proto/build",
+ visibility = ["//visibility:public"],
+ deps = [
+ "@org_golang_google_protobuf//reflect/protoreflect",
+ "@org_golang_google_protobuf//runtime/protoimpl",
+ ],
+)
diff --git a/chromium/third_party/skia/bazel/exporter/build_proto/build/build.pb.go b/chromium/third_party/skia/bazel/exporter/build_proto/build/build.pb.go
new file mode 100644
index 00000000000..b9a3f73ab7c
--- /dev/null
+++ b/chromium/third_party/skia/bazel/exporter/build_proto/build/build.pb.go
@@ -0,0 +1,3493 @@
+// Copyright 2014 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// This file contains the protocol buffer representation of a build
+// file or 'blaze query --output=proto' call.
+
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.28.0
+// protoc v3.21.3
+// source: src/main/protobuf/build.proto
+
+package build
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+// Indicates what to do when a source file is actually a symlink.
+type FilesetEntry_SymlinkBehavior int32
+
+const (
+ FilesetEntry_COPY FilesetEntry_SymlinkBehavior = 1
+ FilesetEntry_DEREFERENCE FilesetEntry_SymlinkBehavior = 2
+)
+
+// Enum value maps for FilesetEntry_SymlinkBehavior.
+var (
+ FilesetEntry_SymlinkBehavior_name = map[int32]string{
+ 1: "COPY",
+ 2: "DEREFERENCE",
+ }
+ FilesetEntry_SymlinkBehavior_value = map[string]int32{
+ "COPY": 1,
+ "DEREFERENCE": 2,
+ }
+)
+
+func (x FilesetEntry_SymlinkBehavior) Enum() *FilesetEntry_SymlinkBehavior {
+ p := new(FilesetEntry_SymlinkBehavior)
+ *p = x
+ return p
+}
+
+func (x FilesetEntry_SymlinkBehavior) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (FilesetEntry_SymlinkBehavior) Descriptor() protoreflect.EnumDescriptor {
+ return file_src_main_protobuf_build_proto_enumTypes[0].Descriptor()
+}
+
+func (FilesetEntry_SymlinkBehavior) Type() protoreflect.EnumType {
+ return &file_src_main_protobuf_build_proto_enumTypes[0]
+}
+
+func (x FilesetEntry_SymlinkBehavior) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Do not use.
+func (x *FilesetEntry_SymlinkBehavior) UnmarshalJSON(b []byte) error {
+ num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)
+ if err != nil {
+ return err
+ }
+ *x = FilesetEntry_SymlinkBehavior(num)
+ return nil
+}
+
+// Deprecated: Use FilesetEntry_SymlinkBehavior.Descriptor instead.
+func (FilesetEntry_SymlinkBehavior) EnumDescriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{6, 0}
+}
+
+// Indicates the type of attribute.
+type Attribute_Discriminator int32
+
+const (
+ Attribute_INTEGER Attribute_Discriminator = 1 // int_value
+ Attribute_STRING Attribute_Discriminator = 2 // string_value
+ Attribute_LABEL Attribute_Discriminator = 3 // string_value
+ Attribute_OUTPUT Attribute_Discriminator = 4 // string_value
+ Attribute_STRING_LIST Attribute_Discriminator = 5 // string_list_value
+ Attribute_LABEL_LIST Attribute_Discriminator = 6 // string_list_value
+ Attribute_OUTPUT_LIST Attribute_Discriminator = 7 // string_list_value
+ Attribute_DISTRIBUTION_SET Attribute_Discriminator = 8 // string_list_value - order is unimportant
+ Attribute_LICENSE Attribute_Discriminator = 9 // license
+ Attribute_STRING_DICT Attribute_Discriminator = 10 // string_dict_value
+ Attribute_FILESET_ENTRY_LIST Attribute_Discriminator = 11 // fileset_list_value
+ Attribute_LABEL_LIST_DICT Attribute_Discriminator = 12 // label_list_dict_value
+ Attribute_STRING_LIST_DICT Attribute_Discriminator = 13 // string_list_dict_value
+ Attribute_BOOLEAN Attribute_Discriminator = 14 // int, bool and string value
+ Attribute_TRISTATE Attribute_Discriminator = 15 // tristate, int and string value
+ Attribute_INTEGER_LIST Attribute_Discriminator = 16 // int_list_value
+ Attribute_UNKNOWN Attribute_Discriminator = 18 // unknown type, use only for build extensions
+ Attribute_LABEL_DICT_UNARY Attribute_Discriminator = 19 // label_dict_unary_value
+ Attribute_SELECTOR_LIST Attribute_Discriminator = 20 // selector_list
+ Attribute_LABEL_KEYED_STRING_DICT Attribute_Discriminator = 21 // label_keyed_string_dict
+ Attribute_DEPRECATED_STRING_DICT_UNARY Attribute_Discriminator = 17
+)
+
+// Enum value maps for Attribute_Discriminator.
+var (
+ Attribute_Discriminator_name = map[int32]string{
+ 1: "INTEGER",
+ 2: "STRING",
+ 3: "LABEL",
+ 4: "OUTPUT",
+ 5: "STRING_LIST",
+ 6: "LABEL_LIST",
+ 7: "OUTPUT_LIST",
+ 8: "DISTRIBUTION_SET",
+ 9: "LICENSE",
+ 10: "STRING_DICT",
+ 11: "FILESET_ENTRY_LIST",
+ 12: "LABEL_LIST_DICT",
+ 13: "STRING_LIST_DICT",
+ 14: "BOOLEAN",
+ 15: "TRISTATE",
+ 16: "INTEGER_LIST",
+ 18: "UNKNOWN",
+ 19: "LABEL_DICT_UNARY",
+ 20: "SELECTOR_LIST",
+ 21: "LABEL_KEYED_STRING_DICT",
+ 17: "DEPRECATED_STRING_DICT_UNARY",
+ }
+ Attribute_Discriminator_value = map[string]int32{
+ "INTEGER": 1,
+ "STRING": 2,
+ "LABEL": 3,
+ "OUTPUT": 4,
+ "STRING_LIST": 5,
+ "LABEL_LIST": 6,
+ "OUTPUT_LIST": 7,
+ "DISTRIBUTION_SET": 8,
+ "LICENSE": 9,
+ "STRING_DICT": 10,
+ "FILESET_ENTRY_LIST": 11,
+ "LABEL_LIST_DICT": 12,
+ "STRING_LIST_DICT": 13,
+ "BOOLEAN": 14,
+ "TRISTATE": 15,
+ "INTEGER_LIST": 16,
+ "UNKNOWN": 18,
+ "LABEL_DICT_UNARY": 19,
+ "SELECTOR_LIST": 20,
+ "LABEL_KEYED_STRING_DICT": 21,
+ "DEPRECATED_STRING_DICT_UNARY": 17,
+ }
+)
+
+func (x Attribute_Discriminator) Enum() *Attribute_Discriminator {
+ p := new(Attribute_Discriminator)
+ *p = x
+ return p
+}
+
+func (x Attribute_Discriminator) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (Attribute_Discriminator) Descriptor() protoreflect.EnumDescriptor {
+ return file_src_main_protobuf_build_proto_enumTypes[1].Descriptor()
+}
+
+func (Attribute_Discriminator) Type() protoreflect.EnumType {
+ return &file_src_main_protobuf_build_proto_enumTypes[1]
+}
+
+func (x Attribute_Discriminator) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Do not use.
+func (x *Attribute_Discriminator) UnmarshalJSON(b []byte) error {
+ num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)
+ if err != nil {
+ return err
+ }
+ *x = Attribute_Discriminator(num)
+ return nil
+}
+
+// Deprecated: Use Attribute_Discriminator.Descriptor instead.
+func (Attribute_Discriminator) EnumDescriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{7, 0}
+}
+
+// Values for the TriState field type.
+type Attribute_Tristate int32
+
+const (
+ Attribute_NO Attribute_Tristate = 0
+ Attribute_YES Attribute_Tristate = 1
+ Attribute_AUTO Attribute_Tristate = 2
+)
+
+// Enum value maps for Attribute_Tristate.
+var (
+ Attribute_Tristate_name = map[int32]string{
+ 0: "NO",
+ 1: "YES",
+ 2: "AUTO",
+ }
+ Attribute_Tristate_value = map[string]int32{
+ "NO": 0,
+ "YES": 1,
+ "AUTO": 2,
+ }
+)
+
+func (x Attribute_Tristate) Enum() *Attribute_Tristate {
+ p := new(Attribute_Tristate)
+ *p = x
+ return p
+}
+
+func (x Attribute_Tristate) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (Attribute_Tristate) Descriptor() protoreflect.EnumDescriptor {
+ return file_src_main_protobuf_build_proto_enumTypes[2].Descriptor()
+}
+
+func (Attribute_Tristate) Type() protoreflect.EnumType {
+ return &file_src_main_protobuf_build_proto_enumTypes[2]
+}
+
+func (x Attribute_Tristate) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Do not use.
+func (x *Attribute_Tristate) UnmarshalJSON(b []byte) error {
+ num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)
+ if err != nil {
+ return err
+ }
+ *x = Attribute_Tristate(num)
+ return nil
+}
+
+// Deprecated: Use Attribute_Tristate.Descriptor instead.
+func (Attribute_Tristate) EnumDescriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{7, 1}
+}
+
+type Target_Discriminator int32
+
+const (
+ Target_RULE Target_Discriminator = 1
+ Target_SOURCE_FILE Target_Discriminator = 2
+ Target_GENERATED_FILE Target_Discriminator = 3
+ Target_PACKAGE_GROUP Target_Discriminator = 4
+ Target_ENVIRONMENT_GROUP Target_Discriminator = 5
+)
+
+// Enum value maps for Target_Discriminator.
+var (
+ Target_Discriminator_name = map[int32]string{
+ 1: "RULE",
+ 2: "SOURCE_FILE",
+ 3: "GENERATED_FILE",
+ 4: "PACKAGE_GROUP",
+ 5: "ENVIRONMENT_GROUP",
+ }
+ Target_Discriminator_value = map[string]int32{
+ "RULE": 1,
+ "SOURCE_FILE": 2,
+ "GENERATED_FILE": 3,
+ "PACKAGE_GROUP": 4,
+ "ENVIRONMENT_GROUP": 5,
+ }
+)
+
+func (x Target_Discriminator) Enum() *Target_Discriminator {
+ p := new(Target_Discriminator)
+ *p = x
+ return p
+}
+
+func (x Target_Discriminator) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (Target_Discriminator) Descriptor() protoreflect.EnumDescriptor {
+ return file_src_main_protobuf_build_proto_enumTypes[3].Descriptor()
+}
+
+func (Target_Discriminator) Type() protoreflect.EnumType {
+ return &file_src_main_protobuf_build_proto_enumTypes[3]
+}
+
+func (x Target_Discriminator) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Do not use.
+func (x *Target_Discriminator) UnmarshalJSON(b []byte) error {
+ num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)
+ if err != nil {
+ return err
+ }
+ *x = Target_Discriminator(num)
+ return nil
+}
+
+// Deprecated: Use Target_Discriminator.Descriptor instead.
+func (Target_Discriminator) EnumDescriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{15, 0}
+}
+
+type AllowedRuleClassInfo_AllowedRuleClasses int32
+
+const (
+ AllowedRuleClassInfo_ANY AllowedRuleClassInfo_AllowedRuleClasses = 1 // Any rule is allowed to be in this attribute
+ AllowedRuleClassInfo_SPECIFIED AllowedRuleClassInfo_AllowedRuleClasses = 2 // Only the explicitly listed rules are allowed
+)
+
+// Enum value maps for AllowedRuleClassInfo_AllowedRuleClasses.
+var (
+ AllowedRuleClassInfo_AllowedRuleClasses_name = map[int32]string{
+ 1: "ANY",
+ 2: "SPECIFIED",
+ }
+ AllowedRuleClassInfo_AllowedRuleClasses_value = map[string]int32{
+ "ANY": 1,
+ "SPECIFIED": 2,
+ }
+)
+
+func (x AllowedRuleClassInfo_AllowedRuleClasses) Enum() *AllowedRuleClassInfo_AllowedRuleClasses {
+ p := new(AllowedRuleClassInfo_AllowedRuleClasses)
+ *p = x
+ return p
+}
+
+func (x AllowedRuleClassInfo_AllowedRuleClasses) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (AllowedRuleClassInfo_AllowedRuleClasses) Descriptor() protoreflect.EnumDescriptor {
+ return file_src_main_protobuf_build_proto_enumTypes[4].Descriptor()
+}
+
+func (AllowedRuleClassInfo_AllowedRuleClasses) Type() protoreflect.EnumType {
+ return &file_src_main_protobuf_build_proto_enumTypes[4]
+}
+
+func (x AllowedRuleClassInfo_AllowedRuleClasses) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Do not use.
+func (x *AllowedRuleClassInfo_AllowedRuleClasses) UnmarshalJSON(b []byte) error {
+ num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)
+ if err != nil {
+ return err
+ }
+ *x = AllowedRuleClassInfo_AllowedRuleClasses(num)
+ return nil
+}
+
+// Deprecated: Use AllowedRuleClassInfo_AllowedRuleClasses.Descriptor instead.
+func (AllowedRuleClassInfo_AllowedRuleClasses) EnumDescriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{17, 0}
+}
+
+type License struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ LicenseType []string `protobuf:"bytes,1,rep,name=license_type,json=licenseType" json:"license_type,omitempty"`
+ Exception []string `protobuf:"bytes,2,rep,name=exception" json:"exception,omitempty"`
+}
+
+func (x *License) Reset() {
+ *x = License{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *License) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*License) ProtoMessage() {}
+
+func (x *License) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use License.ProtoReflect.Descriptor instead.
+func (*License) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *License) GetLicenseType() []string {
+ if x != nil {
+ return x.LicenseType
+ }
+ return nil
+}
+
+func (x *License) GetException() []string {
+ if x != nil {
+ return x.Exception
+ }
+ return nil
+}
+
+type StringDictEntry struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"`
+ Value *string `protobuf:"bytes,2,req,name=value" json:"value,omitempty"`
+}
+
+func (x *StringDictEntry) Reset() {
+ *x = StringDictEntry{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *StringDictEntry) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*StringDictEntry) ProtoMessage() {}
+
+func (x *StringDictEntry) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use StringDictEntry.ProtoReflect.Descriptor instead.
+func (*StringDictEntry) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *StringDictEntry) GetKey() string {
+ if x != nil && x.Key != nil {
+ return *x.Key
+ }
+ return ""
+}
+
+func (x *StringDictEntry) GetValue() string {
+ if x != nil && x.Value != nil {
+ return *x.Value
+ }
+ return ""
+}
+
+type LabelDictUnaryEntry struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"`
+ Value *string `protobuf:"bytes,2,req,name=value" json:"value,omitempty"`
+}
+
+func (x *LabelDictUnaryEntry) Reset() {
+ *x = LabelDictUnaryEntry{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *LabelDictUnaryEntry) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*LabelDictUnaryEntry) ProtoMessage() {}
+
+func (x *LabelDictUnaryEntry) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use LabelDictUnaryEntry.ProtoReflect.Descriptor instead.
+func (*LabelDictUnaryEntry) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *LabelDictUnaryEntry) GetKey() string {
+ if x != nil && x.Key != nil {
+ return *x.Key
+ }
+ return ""
+}
+
+func (x *LabelDictUnaryEntry) GetValue() string {
+ if x != nil && x.Value != nil {
+ return *x.Value
+ }
+ return ""
+}
+
+type LabelListDictEntry struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"`
+ Value []string `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"`
+}
+
+func (x *LabelListDictEntry) Reset() {
+ *x = LabelListDictEntry{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *LabelListDictEntry) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*LabelListDictEntry) ProtoMessage() {}
+
+func (x *LabelListDictEntry) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use LabelListDictEntry.ProtoReflect.Descriptor instead.
+func (*LabelListDictEntry) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *LabelListDictEntry) GetKey() string {
+ if x != nil && x.Key != nil {
+ return *x.Key
+ }
+ return ""
+}
+
+func (x *LabelListDictEntry) GetValue() []string {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+type LabelKeyedStringDictEntry struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"`
+ Value *string `protobuf:"bytes,2,req,name=value" json:"value,omitempty"`
+}
+
+func (x *LabelKeyedStringDictEntry) Reset() {
+ *x = LabelKeyedStringDictEntry{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *LabelKeyedStringDictEntry) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*LabelKeyedStringDictEntry) ProtoMessage() {}
+
+func (x *LabelKeyedStringDictEntry) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[4]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use LabelKeyedStringDictEntry.ProtoReflect.Descriptor instead.
+func (*LabelKeyedStringDictEntry) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{4}
+}
+
+func (x *LabelKeyedStringDictEntry) GetKey() string {
+ if x != nil && x.Key != nil {
+ return *x.Key
+ }
+ return ""
+}
+
+func (x *LabelKeyedStringDictEntry) GetValue() string {
+ if x != nil && x.Value != nil {
+ return *x.Value
+ }
+ return ""
+}
+
+type StringListDictEntry struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"`
+ Value []string `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"`
+}
+
+func (x *StringListDictEntry) Reset() {
+ *x = StringListDictEntry{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[5]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *StringListDictEntry) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*StringListDictEntry) ProtoMessage() {}
+
+func (x *StringListDictEntry) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[5]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use StringListDictEntry.ProtoReflect.Descriptor instead.
+func (*StringListDictEntry) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{5}
+}
+
+func (x *StringListDictEntry) GetKey() string {
+ if x != nil && x.Key != nil {
+ return *x.Key
+ }
+ return ""
+}
+
+func (x *StringListDictEntry) GetValue() []string {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Represents an entry attribute of a Fileset rule in a build file.
+type FilesetEntry struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The label pointing to the source target where files are copied from.
+ Source *string `protobuf:"bytes,1,req,name=source" json:"source,omitempty"`
+ // The relative path within the fileset rule where files will be mapped.
+ DestinationDirectory *string `protobuf:"bytes,2,req,name=destination_directory,json=destinationDirectory" json:"destination_directory,omitempty"`
+ // Whether the files= attribute was specified. This is necessary because
+ // no files= attribute and files=[] mean different things.
+ FilesPresent *bool `protobuf:"varint,7,opt,name=files_present,json=filesPresent" json:"files_present,omitempty"`
+ // A list of file labels to include from the source directory.
+ File []string `protobuf:"bytes,3,rep,name=file" json:"file,omitempty"`
+ // If this is a fileset entry representing files within the rule
+ // package, this lists relative paths to files that should be excluded from
+ // the set. This cannot contain values if 'file' also has values.
+ Exclude []string `protobuf:"bytes,4,rep,name=exclude" json:"exclude,omitempty"`
+ // This field is optional because there will be some time when the new
+ // PB is used by tools depending on blaze query, but the new blaze version
+ // is not yet released.
+ // TODO(bazel-team): Make this field required once a version of Blaze is
+ // released that outputs this field.
+ SymlinkBehavior *FilesetEntry_SymlinkBehavior `protobuf:"varint,5,opt,name=symlink_behavior,json=symlinkBehavior,enum=blaze_query.FilesetEntry_SymlinkBehavior,def=1" json:"symlink_behavior,omitempty"`
+ // The prefix to strip from the path of the files in this FilesetEntry. Note
+ // that no value and the empty string as the value mean different things here.
+ StripPrefix *string `protobuf:"bytes,6,opt,name=strip_prefix,json=stripPrefix" json:"strip_prefix,omitempty"`
+}
+
+// Default values for FilesetEntry fields.
+const (
+ Default_FilesetEntry_SymlinkBehavior = FilesetEntry_COPY
+)
+
+func (x *FilesetEntry) Reset() {
+ *x = FilesetEntry{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[6]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *FilesetEntry) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*FilesetEntry) ProtoMessage() {}
+
+func (x *FilesetEntry) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[6]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use FilesetEntry.ProtoReflect.Descriptor instead.
+func (*FilesetEntry) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{6}
+}
+
+func (x *FilesetEntry) GetSource() string {
+ if x != nil && x.Source != nil {
+ return *x.Source
+ }
+ return ""
+}
+
+func (x *FilesetEntry) GetDestinationDirectory() string {
+ if x != nil && x.DestinationDirectory != nil {
+ return *x.DestinationDirectory
+ }
+ return ""
+}
+
+func (x *FilesetEntry) GetFilesPresent() bool {
+ if x != nil && x.FilesPresent != nil {
+ return *x.FilesPresent
+ }
+ return false
+}
+
+func (x *FilesetEntry) GetFile() []string {
+ if x != nil {
+ return x.File
+ }
+ return nil
+}
+
+func (x *FilesetEntry) GetExclude() []string {
+ if x != nil {
+ return x.Exclude
+ }
+ return nil
+}
+
+func (x *FilesetEntry) GetSymlinkBehavior() FilesetEntry_SymlinkBehavior {
+ if x != nil && x.SymlinkBehavior != nil {
+ return *x.SymlinkBehavior
+ }
+ return Default_FilesetEntry_SymlinkBehavior
+}
+
+func (x *FilesetEntry) GetStripPrefix() string {
+ if x != nil && x.StripPrefix != nil {
+ return *x.StripPrefix
+ }
+ return ""
+}
+
+// A rule attribute. Each attribute must have a type and one of the various
+// value fields populated - for the most part.
+//
+// Attributes of BOOLEAN and TRISTATE type may set all of the int, bool, and
+// string values for backwards compatibility with clients that expect them to
+// be set.
+//
+// Attributes of INTEGER, STRING, LABEL, LICENSE, BOOLEAN, and TRISTATE type
+// may set *none* of the values. This can happen if the Attribute message is
+// prepared for a client that doesn't support SELECTOR_LIST, but the rule has
+// a selector list value for the attribute. (Selector lists for attributes of
+// other types--the collection types--are handled differently when prepared
+// for such a client. The possible collection values are gathered together
+// and flattened.)
+//
+// By checking the type, the appropriate value can be extracted - see the
+// comments on each type for the associated value. The order of lists comes
+// from the blaze parsing. If an attribute is of a list type, the associated
+// list should never be empty.
+type Attribute struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The name of the attribute
+ Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"`
+ // Whether the attribute was explicitly specified
+ ExplicitlySpecified *bool `protobuf:"varint,13,opt,name=explicitly_specified,json=explicitlySpecified" json:"explicitly_specified,omitempty"`
+ // If this attribute has a string value or a string list value, then this
+ // may be set to indicate that the value may be treated as a label that
+ // isn't a dependency of this attribute's rule.
+ Nodep *bool `protobuf:"varint,20,opt,name=nodep" json:"nodep,omitempty"`
+ // The type of attribute. This message is used for all of the different
+ // attribute types so the discriminator helps for figuring out what is
+ // stored in the message.
+ Type *Attribute_Discriminator `protobuf:"varint,2,req,name=type,enum=blaze_query.Attribute_Discriminator" json:"type,omitempty"`
+ // If this attribute has an integer value this will be populated.
+ // Boolean and TriState also use this field as [0,1] and [-1,0,1]
+ // for [false, true] and [auto, no, yes] respectively.
+ IntValue *int32 `protobuf:"varint,3,opt,name=int_value,json=intValue" json:"int_value,omitempty"`
+ // If the attribute has a string value this will be populated. Label and
+ // path attributes use this field as the value even though the type may
+ // be LABEL or something else other than STRING.
+ StringValue *string `protobuf:"bytes,5,opt,name=string_value,json=stringValue" json:"string_value,omitempty"`
+ // If the attribute has a boolean value this will be populated.
+ BooleanValue *bool `protobuf:"varint,14,opt,name=boolean_value,json=booleanValue" json:"boolean_value,omitempty"`
+ // If the attribute is a Tristate value, this will be populated.
+ TristateValue *Attribute_Tristate `protobuf:"varint,15,opt,name=tristate_value,json=tristateValue,enum=blaze_query.Attribute_Tristate" json:"tristate_value,omitempty"`
+ // The value of the attribute has a list of string values (label and path
+ // note from STRING applies here as well).
+ StringListValue []string `protobuf:"bytes,6,rep,name=string_list_value,json=stringListValue" json:"string_list_value,omitempty"`
+ // If this is a license attribute, the license information is stored here.
+ License *License `protobuf:"bytes,7,opt,name=license" json:"license,omitempty"`
+ // If this is a string dict, each entry will be stored here.
+ StringDictValue []*StringDictEntry `protobuf:"bytes,8,rep,name=string_dict_value,json=stringDictValue" json:"string_dict_value,omitempty"`
+ // If the attribute is part of a Fileset, the fileset entries are stored in
+ // this field.
+ FilesetListValue []*FilesetEntry `protobuf:"bytes,9,rep,name=fileset_list_value,json=filesetListValue" json:"fileset_list_value,omitempty"`
+ // If this is a label list dict, each entry will be stored here.
+ LabelListDictValue []*LabelListDictEntry `protobuf:"bytes,10,rep,name=label_list_dict_value,json=labelListDictValue" json:"label_list_dict_value,omitempty"`
+ // If this is a string list dict, each entry will be stored here.
+ StringListDictValue []*StringListDictEntry `protobuf:"bytes,11,rep,name=string_list_dict_value,json=stringListDictValue" json:"string_list_dict_value,omitempty"`
+ // The value of the attribute has a list of int32 values
+ IntListValue []int32 `protobuf:"varint,17,rep,name=int_list_value,json=intListValue" json:"int_list_value,omitempty"`
+ // If this is a label dict unary, each entry will be stored here.
+ LabelDictUnaryValue []*LabelDictUnaryEntry `protobuf:"bytes,19,rep,name=label_dict_unary_value,json=labelDictUnaryValue" json:"label_dict_unary_value,omitempty"`
+ // If this is a label-keyed string dict, each entry will be stored here.
+ LabelKeyedStringDictValue []*LabelKeyedStringDictEntry `protobuf:"bytes,22,rep,name=label_keyed_string_dict_value,json=labelKeyedStringDictValue" json:"label_keyed_string_dict_value,omitempty"`
+ // If this attribute's value is an expression containing one or more select
+ // expressions, then its type is SELECTOR_LIST and a SelectorList will be
+ // stored here.
+ SelectorList *Attribute_SelectorList `protobuf:"bytes,21,opt,name=selector_list,json=selectorList" json:"selector_list,omitempty"`
+ DEPRECATEDStringDictUnaryValue [][]byte `protobuf:"bytes,18,rep,name=DEPRECATED_string_dict_unary_value,json=DEPRECATEDStringDictUnaryValue" json:"DEPRECATED_string_dict_unary_value,omitempty"`
+}
+
+func (x *Attribute) Reset() {
+ *x = Attribute{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Attribute) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Attribute) ProtoMessage() {}
+
+func (x *Attribute) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[7]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Attribute.ProtoReflect.Descriptor instead.
+func (*Attribute) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{7}
+}
+
+func (x *Attribute) GetName() string {
+ if x != nil && x.Name != nil {
+ return *x.Name
+ }
+ return ""
+}
+
+func (x *Attribute) GetExplicitlySpecified() bool {
+ if x != nil && x.ExplicitlySpecified != nil {
+ return *x.ExplicitlySpecified
+ }
+ return false
+}
+
+func (x *Attribute) GetNodep() bool {
+ if x != nil && x.Nodep != nil {
+ return *x.Nodep
+ }
+ return false
+}
+
+func (x *Attribute) GetType() Attribute_Discriminator {
+ if x != nil && x.Type != nil {
+ return *x.Type
+ }
+ return Attribute_INTEGER
+}
+
+func (x *Attribute) GetIntValue() int32 {
+ if x != nil && x.IntValue != nil {
+ return *x.IntValue
+ }
+ return 0
+}
+
+func (x *Attribute) GetStringValue() string {
+ if x != nil && x.StringValue != nil {
+ return *x.StringValue
+ }
+ return ""
+}
+
+func (x *Attribute) GetBooleanValue() bool {
+ if x != nil && x.BooleanValue != nil {
+ return *x.BooleanValue
+ }
+ return false
+}
+
+func (x *Attribute) GetTristateValue() Attribute_Tristate {
+ if x != nil && x.TristateValue != nil {
+ return *x.TristateValue
+ }
+ return Attribute_NO
+}
+
+func (x *Attribute) GetStringListValue() []string {
+ if x != nil {
+ return x.StringListValue
+ }
+ return nil
+}
+
+func (x *Attribute) GetLicense() *License {
+ if x != nil {
+ return x.License
+ }
+ return nil
+}
+
+func (x *Attribute) GetStringDictValue() []*StringDictEntry {
+ if x != nil {
+ return x.StringDictValue
+ }
+ return nil
+}
+
+func (x *Attribute) GetFilesetListValue() []*FilesetEntry {
+ if x != nil {
+ return x.FilesetListValue
+ }
+ return nil
+}
+
+func (x *Attribute) GetLabelListDictValue() []*LabelListDictEntry {
+ if x != nil {
+ return x.LabelListDictValue
+ }
+ return nil
+}
+
+func (x *Attribute) GetStringListDictValue() []*StringListDictEntry {
+ if x != nil {
+ return x.StringListDictValue
+ }
+ return nil
+}
+
+func (x *Attribute) GetIntListValue() []int32 {
+ if x != nil {
+ return x.IntListValue
+ }
+ return nil
+}
+
+func (x *Attribute) GetLabelDictUnaryValue() []*LabelDictUnaryEntry {
+ if x != nil {
+ return x.LabelDictUnaryValue
+ }
+ return nil
+}
+
+func (x *Attribute) GetLabelKeyedStringDictValue() []*LabelKeyedStringDictEntry {
+ if x != nil {
+ return x.LabelKeyedStringDictValue
+ }
+ return nil
+}
+
+func (x *Attribute) GetSelectorList() *Attribute_SelectorList {
+ if x != nil {
+ return x.SelectorList
+ }
+ return nil
+}
+
+func (x *Attribute) GetDEPRECATEDStringDictUnaryValue() [][]byte {
+ if x != nil {
+ return x.DEPRECATEDStringDictUnaryValue
+ }
+ return nil
+}
+
+// A rule instance (e.g., cc_library foo, java_binary bar).
+type Rule struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The name of the rule (formatted as an absolute label, e.g. //foo/bar:baz).
+ Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"`
+ // The rule class (e.g., java_library)
+ RuleClass *string `protobuf:"bytes,2,req,name=rule_class,json=ruleClass" json:"rule_class,omitempty"`
+ // The BUILD file and line number of the location (formatted as
+ // <absolute_path>:<line_number>:<column_number>) in the rule's package's
+ // BUILD file where the rule instance was instantiated. The line number will
+ // be that of a rule invocation or macro call (that in turn invoked a
+ // rule). See
+ // https://bazel.build/rules/macros#macro-creation
+ Location *string `protobuf:"bytes,3,opt,name=location" json:"location,omitempty"`
+ // All of the attributes that describe the rule.
+ Attribute []*Attribute `protobuf:"bytes,4,rep,name=attribute" json:"attribute,omitempty"`
+ // All of the inputs to the rule (formatted as absolute labels). These are
+ // predecessors in the dependency graph.
+ RuleInput []string `protobuf:"bytes,5,rep,name=rule_input,json=ruleInput" json:"rule_input,omitempty"`
+ ConfiguredRuleInput []*ConfiguredRuleInput `protobuf:"bytes,15,rep,name=configured_rule_input,json=configuredRuleInput" json:"configured_rule_input,omitempty"`
+ // All of the outputs of the rule (formatted as absolute labels). These are
+ // successors in the dependency graph.
+ RuleOutput []string `protobuf:"bytes,6,rep,name=rule_output,json=ruleOutput" json:"rule_output,omitempty"`
+ // The set of all "features" inherited from the rule's package declaration.
+ DefaultSetting []string `protobuf:"bytes,7,rep,name=default_setting,json=defaultSetting" json:"default_setting,omitempty"`
+ // The rule's class's public by default value.
+ DEPRECATEDPublicByDefault *bool `protobuf:"varint,9,opt,name=DEPRECATED_public_by_default,json=DEPRECATEDPublicByDefault" json:"DEPRECATED_public_by_default,omitempty"`
+ DEPRECATEDIsSkylark *bool `protobuf:"varint,10,opt,name=DEPRECATED_is_skylark,json=DEPRECATEDIsSkylark" json:"DEPRECATED_is_skylark,omitempty"`
+ // Hash encapsulating the behavior of this Starlark rule. Any change to this
+ // rule's definition that could change its behavior will be reflected here.
+ SkylarkEnvironmentHashCode *string `protobuf:"bytes,12,opt,name=skylark_environment_hash_code,json=skylarkEnvironmentHashCode" json:"skylark_environment_hash_code,omitempty"`
+ // The Starlark call stack at the moment the rule was instantiated.
+ // Each entry has the form "file:line:col: function".
+ // The outermost stack frame ("<toplevel>", the BUILD file) appears first;
+ // the frame for the rule function itself is omitted.
+ // The file name may be relative to package's source root directory.
+ //
+ // Requires --proto:instantiation_stack=true.
+ InstantiationStack []string `protobuf:"bytes,13,rep,name=instantiation_stack,json=instantiationStack" json:"instantiation_stack,omitempty"`
+ // The Starlark call stack for the definition of the rule class of this
+ // particular rule instance. If empty, either populating the field was not
+ // enabled on the command line with the --proto:definition_stack flag or the
+ // rule is a native one.
+ DefinitionStack []string `protobuf:"bytes,14,rep,name=definition_stack,json=definitionStack" json:"definition_stack,omitempty"`
+}
+
+func (x *Rule) Reset() {
+ *x = Rule{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[8]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Rule) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Rule) ProtoMessage() {}
+
+func (x *Rule) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[8]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Rule.ProtoReflect.Descriptor instead.
+func (*Rule) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{8}
+}
+
+func (x *Rule) GetName() string {
+ if x != nil && x.Name != nil {
+ return *x.Name
+ }
+ return ""
+}
+
+func (x *Rule) GetRuleClass() string {
+ if x != nil && x.RuleClass != nil {
+ return *x.RuleClass
+ }
+ return ""
+}
+
+func (x *Rule) GetLocation() string {
+ if x != nil && x.Location != nil {
+ return *x.Location
+ }
+ return ""
+}
+
+func (x *Rule) GetAttribute() []*Attribute {
+ if x != nil {
+ return x.Attribute
+ }
+ return nil
+}
+
+func (x *Rule) GetRuleInput() []string {
+ if x != nil {
+ return x.RuleInput
+ }
+ return nil
+}
+
+func (x *Rule) GetConfiguredRuleInput() []*ConfiguredRuleInput {
+ if x != nil {
+ return x.ConfiguredRuleInput
+ }
+ return nil
+}
+
+func (x *Rule) GetRuleOutput() []string {
+ if x != nil {
+ return x.RuleOutput
+ }
+ return nil
+}
+
+func (x *Rule) GetDefaultSetting() []string {
+ if x != nil {
+ return x.DefaultSetting
+ }
+ return nil
+}
+
+func (x *Rule) GetDEPRECATEDPublicByDefault() bool {
+ if x != nil && x.DEPRECATEDPublicByDefault != nil {
+ return *x.DEPRECATEDPublicByDefault
+ }
+ return false
+}
+
+func (x *Rule) GetDEPRECATEDIsSkylark() bool {
+ if x != nil && x.DEPRECATEDIsSkylark != nil {
+ return *x.DEPRECATEDIsSkylark
+ }
+ return false
+}
+
+func (x *Rule) GetSkylarkEnvironmentHashCode() string {
+ if x != nil && x.SkylarkEnvironmentHashCode != nil {
+ return *x.SkylarkEnvironmentHashCode
+ }
+ return ""
+}
+
+func (x *Rule) GetInstantiationStack() []string {
+ if x != nil {
+ return x.InstantiationStack
+ }
+ return nil
+}
+
+func (x *Rule) GetDefinitionStack() []string {
+ if x != nil {
+ return x.DefinitionStack
+ }
+ return nil
+}
+
+type ConfiguredRuleInput struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Label *string `protobuf:"bytes,1,opt,name=label" json:"label,omitempty"`
+ ConfigurationChecksum *string `protobuf:"bytes,2,opt,name=configuration_checksum,json=configurationChecksum" json:"configuration_checksum,omitempty"`
+ ConfigurationId *uint32 `protobuf:"varint,3,opt,name=configuration_id,json=configurationId" json:"configuration_id,omitempty"`
+}
+
+func (x *ConfiguredRuleInput) Reset() {
+ *x = ConfiguredRuleInput{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[9]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ConfiguredRuleInput) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ConfiguredRuleInput) ProtoMessage() {}
+
+func (x *ConfiguredRuleInput) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[9]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ConfiguredRuleInput.ProtoReflect.Descriptor instead.
+func (*ConfiguredRuleInput) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{9}
+}
+
+func (x *ConfiguredRuleInput) GetLabel() string {
+ if x != nil && x.Label != nil {
+ return *x.Label
+ }
+ return ""
+}
+
+func (x *ConfiguredRuleInput) GetConfigurationChecksum() string {
+ if x != nil && x.ConfigurationChecksum != nil {
+ return *x.ConfigurationChecksum
+ }
+ return ""
+}
+
+func (x *ConfiguredRuleInput) GetConfigurationId() uint32 {
+ if x != nil && x.ConfigurationId != nil {
+ return *x.ConfigurationId
+ }
+ return 0
+}
+
+// Summary of all transitive dependencies of 'rule,' where each dependent
+// rule is included only once in the 'dependency' field. Gives complete
+// information to analyze the single build target labeled rule.name,
+// including optional location of target in BUILD file.
+type RuleSummary struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Rule *Rule `protobuf:"bytes,1,req,name=rule" json:"rule,omitempty"`
+ Dependency []*Rule `protobuf:"bytes,2,rep,name=dependency" json:"dependency,omitempty"`
+ Location *string `protobuf:"bytes,3,opt,name=location" json:"location,omitempty"`
+}
+
+func (x *RuleSummary) Reset() {
+ *x = RuleSummary{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[10]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *RuleSummary) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*RuleSummary) ProtoMessage() {}
+
+func (x *RuleSummary) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[10]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use RuleSummary.ProtoReflect.Descriptor instead.
+func (*RuleSummary) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{10}
+}
+
+func (x *RuleSummary) GetRule() *Rule {
+ if x != nil {
+ return x.Rule
+ }
+ return nil
+}
+
+func (x *RuleSummary) GetDependency() []*Rule {
+ if x != nil {
+ return x.Dependency
+ }
+ return nil
+}
+
+func (x *RuleSummary) GetLocation() string {
+ if x != nil && x.Location != nil {
+ return *x.Location
+ }
+ return ""
+}
+
+// A package group. Aside from the name, it contains the list of packages
+// present in the group (as specified in the BUILD file).
+type PackageGroup struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The name of the package group
+ Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"`
+ // The list of packages as specified in the BUILD file. Currently this is
+ // only a list of packages, but some time in the future, there might be
+ // some type of wildcard mechanism.
+ ContainedPackage []string `protobuf:"bytes,2,rep,name=contained_package,json=containedPackage" json:"contained_package,omitempty"`
+ // The list of sub package groups included in this one.
+ IncludedPackageGroup []string `protobuf:"bytes,3,rep,name=included_package_group,json=includedPackageGroup" json:"included_package_group,omitempty"`
+}
+
+func (x *PackageGroup) Reset() {
+ *x = PackageGroup{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[11]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *PackageGroup) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PackageGroup) ProtoMessage() {}
+
+func (x *PackageGroup) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[11]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use PackageGroup.ProtoReflect.Descriptor instead.
+func (*PackageGroup) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{11}
+}
+
+func (x *PackageGroup) GetName() string {
+ if x != nil && x.Name != nil {
+ return *x.Name
+ }
+ return ""
+}
+
+func (x *PackageGroup) GetContainedPackage() []string {
+ if x != nil {
+ return x.ContainedPackage
+ }
+ return nil
+}
+
+func (x *PackageGroup) GetIncludedPackageGroup() []string {
+ if x != nil {
+ return x.IncludedPackageGroup
+ }
+ return nil
+}
+
+// An environment group.
+type EnvironmentGroup struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The name of the environment group.
+ Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"`
+ // The environments that belong to this group (as labels).
+ Environment []string `protobuf:"bytes,2,rep,name=environment" json:"environment,omitempty"`
+ // The member environments that rules implicitly support if not otherwise
+ // specified.
+ Default []string `protobuf:"bytes,3,rep,name=default" json:"default,omitempty"`
+}
+
+func (x *EnvironmentGroup) Reset() {
+ *x = EnvironmentGroup{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[12]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *EnvironmentGroup) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*EnvironmentGroup) ProtoMessage() {}
+
+func (x *EnvironmentGroup) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[12]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use EnvironmentGroup.ProtoReflect.Descriptor instead.
+func (*EnvironmentGroup) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{12}
+}
+
+func (x *EnvironmentGroup) GetName() string {
+ if x != nil && x.Name != nil {
+ return *x.Name
+ }
+ return ""
+}
+
+func (x *EnvironmentGroup) GetEnvironment() []string {
+ if x != nil {
+ return x.Environment
+ }
+ return nil
+}
+
+func (x *EnvironmentGroup) GetDefault() []string {
+ if x != nil {
+ return x.Default
+ }
+ return nil
+}
+
+// A file that is an input into the build system.
+// Next-Id: 10
+type SourceFile struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The name of the source file (a label).
+ Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"`
+ // The location of the source file. This is a path with a line number and a
+ // column number not a label in the build system.
+ Location *string `protobuf:"bytes,2,opt,name=location" json:"location,omitempty"`
+ // Labels of .bzl (Starlark) files that are transitively loaded in this BUILD
+ // file. This is present only when the SourceFile represents a BUILD file that
+ // loaded .bzl files.
+ // TODO(bazel-team): Rename this field.
+ Subinclude []string `protobuf:"bytes,3,rep,name=subinclude" json:"subinclude,omitempty"`
+ // Labels of package groups that are mentioned in the visibility declaration
+ // for this source file.
+ PackageGroup []string `protobuf:"bytes,4,rep,name=package_group,json=packageGroup" json:"package_group,omitempty"`
+ // Labels mentioned in the visibility declaration (including :__pkg__ and
+ // //visibility: ones)
+ VisibilityLabel []string `protobuf:"bytes,5,rep,name=visibility_label,json=visibilityLabel" json:"visibility_label,omitempty"`
+ // The package-level features enabled for this package. Only present if the
+ // SourceFile represents a BUILD file.
+ Feature []string `protobuf:"bytes,6,rep,name=feature" json:"feature,omitempty"`
+ // License attribute for the file.
+ License *License `protobuf:"bytes,8,opt,name=license" json:"license,omitempty"`
+ // True if the package contains an error. Only present if the SourceFile
+ // represents a BUILD file.
+ PackageContainsErrors *bool `protobuf:"varint,9,opt,name=package_contains_errors,json=packageContainsErrors" json:"package_contains_errors,omitempty"`
+}
+
+func (x *SourceFile) Reset() {
+ *x = SourceFile{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[13]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SourceFile) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SourceFile) ProtoMessage() {}
+
+func (x *SourceFile) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[13]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SourceFile.ProtoReflect.Descriptor instead.
+func (*SourceFile) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{13}
+}
+
+func (x *SourceFile) GetName() string {
+ if x != nil && x.Name != nil {
+ return *x.Name
+ }
+ return ""
+}
+
+func (x *SourceFile) GetLocation() string {
+ if x != nil && x.Location != nil {
+ return *x.Location
+ }
+ return ""
+}
+
+func (x *SourceFile) GetSubinclude() []string {
+ if x != nil {
+ return x.Subinclude
+ }
+ return nil
+}
+
+func (x *SourceFile) GetPackageGroup() []string {
+ if x != nil {
+ return x.PackageGroup
+ }
+ return nil
+}
+
+func (x *SourceFile) GetVisibilityLabel() []string {
+ if x != nil {
+ return x.VisibilityLabel
+ }
+ return nil
+}
+
+func (x *SourceFile) GetFeature() []string {
+ if x != nil {
+ return x.Feature
+ }
+ return nil
+}
+
+func (x *SourceFile) GetLicense() *License {
+ if x != nil {
+ return x.License
+ }
+ return nil
+}
+
+func (x *SourceFile) GetPackageContainsErrors() bool {
+ if x != nil && x.PackageContainsErrors != nil {
+ return *x.PackageContainsErrors
+ }
+ return false
+}
+
+// A file that is the output of a build rule.
+type GeneratedFile struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The name of the generated file (a label).
+ Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"`
+ // The label of the target that generates the file.
+ GeneratingRule *string `protobuf:"bytes,2,req,name=generating_rule,json=generatingRule" json:"generating_rule,omitempty"`
+ // The path, line number, and column number of the output file (not a label).
+ Location *string `protobuf:"bytes,3,opt,name=location" json:"location,omitempty"`
+}
+
+func (x *GeneratedFile) Reset() {
+ *x = GeneratedFile{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[14]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GeneratedFile) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GeneratedFile) ProtoMessage() {}
+
+func (x *GeneratedFile) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[14]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GeneratedFile.ProtoReflect.Descriptor instead.
+func (*GeneratedFile) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{14}
+}
+
+func (x *GeneratedFile) GetName() string {
+ if x != nil && x.Name != nil {
+ return *x.Name
+ }
+ return ""
+}
+
+func (x *GeneratedFile) GetGeneratingRule() string {
+ if x != nil && x.GeneratingRule != nil {
+ return *x.GeneratingRule
+ }
+ return ""
+}
+
+func (x *GeneratedFile) GetLocation() string {
+ if x != nil && x.Location != nil {
+ return *x.Location
+ }
+ return ""
+}
+
+// A target from a blaze query execution. Similar to the Attribute message,
+// the Discriminator is used to determine which field contains information.
+// For any given type, only one of these can be populated in a single Target.
+type Target struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The type of target contained in the message.
+ Type *Target_Discriminator `protobuf:"varint,1,req,name=type,enum=blaze_query.Target_Discriminator" json:"type,omitempty"`
+ // If this target represents a rule, the rule is stored here.
+ Rule *Rule `protobuf:"bytes,2,opt,name=rule" json:"rule,omitempty"`
+ // A file that is not generated by the build system (version controlled
+ // or created by the test harness).
+ SourceFile *SourceFile `protobuf:"bytes,3,opt,name=source_file,json=sourceFile" json:"source_file,omitempty"`
+ // A generated file that is the output of a rule.
+ GeneratedFile *GeneratedFile `protobuf:"bytes,4,opt,name=generated_file,json=generatedFile" json:"generated_file,omitempty"`
+ // A package group.
+ PackageGroup *PackageGroup `protobuf:"bytes,5,opt,name=package_group,json=packageGroup" json:"package_group,omitempty"`
+ // An environment group.
+ EnvironmentGroup *EnvironmentGroup `protobuf:"bytes,6,opt,name=environment_group,json=environmentGroup" json:"environment_group,omitempty"`
+}
+
+func (x *Target) Reset() {
+ *x = Target{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[15]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Target) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Target) ProtoMessage() {}
+
+func (x *Target) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[15]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Target.ProtoReflect.Descriptor instead.
+func (*Target) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{15}
+}
+
+func (x *Target) GetType() Target_Discriminator {
+ if x != nil && x.Type != nil {
+ return *x.Type
+ }
+ return Target_RULE
+}
+
+func (x *Target) GetRule() *Rule {
+ if x != nil {
+ return x.Rule
+ }
+ return nil
+}
+
+func (x *Target) GetSourceFile() *SourceFile {
+ if x != nil {
+ return x.SourceFile
+ }
+ return nil
+}
+
+func (x *Target) GetGeneratedFile() *GeneratedFile {
+ if x != nil {
+ return x.GeneratedFile
+ }
+ return nil
+}
+
+func (x *Target) GetPackageGroup() *PackageGroup {
+ if x != nil {
+ return x.PackageGroup
+ }
+ return nil
+}
+
+func (x *Target) GetEnvironmentGroup() *EnvironmentGroup {
+ if x != nil {
+ return x.EnvironmentGroup
+ }
+ return nil
+}
+
+// Container for all of the blaze query results.
+type QueryResult struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // All of the targets returned by the blaze query.
+ Target []*Target `protobuf:"bytes,1,rep,name=target" json:"target,omitempty"`
+}
+
+func (x *QueryResult) Reset() {
+ *x = QueryResult{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[16]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *QueryResult) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*QueryResult) ProtoMessage() {}
+
+func (x *QueryResult) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[16]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use QueryResult.ProtoReflect.Descriptor instead.
+func (*QueryResult) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{16}
+}
+
+func (x *QueryResult) GetTarget() []*Target {
+ if x != nil {
+ return x.Target
+ }
+ return nil
+}
+
+// Information about allowed rule classes for a specific attribute of a rule.
+type AllowedRuleClassInfo struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Policy *AllowedRuleClassInfo_AllowedRuleClasses `protobuf:"varint,1,req,name=policy,enum=blaze_query.AllowedRuleClassInfo_AllowedRuleClasses" json:"policy,omitempty"`
+ // Rule class names of rules allowed in this attribute, e.g "cc_library",
+ // "py_binary". Only present if the allowed_rule_classes field is set to
+ // SPECIFIED.
+ AllowedRuleClass []string `protobuf:"bytes,2,rep,name=allowed_rule_class,json=allowedRuleClass" json:"allowed_rule_class,omitempty"`
+}
+
+func (x *AllowedRuleClassInfo) Reset() {
+ *x = AllowedRuleClassInfo{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[17]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *AllowedRuleClassInfo) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*AllowedRuleClassInfo) ProtoMessage() {}
+
+func (x *AllowedRuleClassInfo) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[17]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use AllowedRuleClassInfo.ProtoReflect.Descriptor instead.
+func (*AllowedRuleClassInfo) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{17}
+}
+
+func (x *AllowedRuleClassInfo) GetPolicy() AllowedRuleClassInfo_AllowedRuleClasses {
+ if x != nil && x.Policy != nil {
+ return *x.Policy
+ }
+ return AllowedRuleClassInfo_ANY
+}
+
+func (x *AllowedRuleClassInfo) GetAllowedRuleClass() []string {
+ if x != nil {
+ return x.AllowedRuleClass
+ }
+ return nil
+}
+
+// This message represents a single attribute of a single rule.
+// See https://bazel.build/rules/lib/attr.
+type AttributeDefinition struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` // e.g. "name", "srcs"
+ Type *Attribute_Discriminator `protobuf:"varint,2,req,name=type,enum=blaze_query.Attribute_Discriminator" json:"type,omitempty"`
+ Mandatory *bool `protobuf:"varint,3,opt,name=mandatory" json:"mandatory,omitempty"`
+ AllowedRuleClasses *AllowedRuleClassInfo `protobuf:"bytes,4,opt,name=allowed_rule_classes,json=allowedRuleClasses" json:"allowed_rule_classes,omitempty"` // type=label*
+ Documentation *string `protobuf:"bytes,5,opt,name=documentation" json:"documentation,omitempty"`
+ AllowEmpty *bool `protobuf:"varint,6,opt,name=allow_empty,json=allowEmpty" json:"allow_empty,omitempty"` // type=*_list|*_dict
+ AllowSingleFile *bool `protobuf:"varint,7,opt,name=allow_single_file,json=allowSingleFile" json:"allow_single_file,omitempty"` // type=label
+ Default *AttributeValue `protobuf:"bytes,9,opt,name=default" json:"default,omitempty"` // simple (not computed/late-bound) values only
+ Executable *bool `protobuf:"varint,10,opt,name=executable" json:"executable,omitempty"` // type=label
+ Configurable *bool `protobuf:"varint,11,opt,name=configurable" json:"configurable,omitempty"`
+ Nodep *bool `protobuf:"varint,12,opt,name=nodep" json:"nodep,omitempty"` // label-valued edge does not establish a dependency
+ CfgIsHost *bool `protobuf:"varint,13,opt,name=cfg_is_host,json=cfgIsHost" json:"cfg_is_host,omitempty"` // edge entails a transition to "host" configuration
+}
+
+func (x *AttributeDefinition) Reset() {
+ *x = AttributeDefinition{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[18]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *AttributeDefinition) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*AttributeDefinition) ProtoMessage() {}
+
+func (x *AttributeDefinition) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[18]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use AttributeDefinition.ProtoReflect.Descriptor instead.
+func (*AttributeDefinition) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{18}
+}
+
+func (x *AttributeDefinition) GetName() string {
+ if x != nil && x.Name != nil {
+ return *x.Name
+ }
+ return ""
+}
+
+func (x *AttributeDefinition) GetType() Attribute_Discriminator {
+ if x != nil && x.Type != nil {
+ return *x.Type
+ }
+ return Attribute_INTEGER
+}
+
+func (x *AttributeDefinition) GetMandatory() bool {
+ if x != nil && x.Mandatory != nil {
+ return *x.Mandatory
+ }
+ return false
+}
+
+func (x *AttributeDefinition) GetAllowedRuleClasses() *AllowedRuleClassInfo {
+ if x != nil {
+ return x.AllowedRuleClasses
+ }
+ return nil
+}
+
+func (x *AttributeDefinition) GetDocumentation() string {
+ if x != nil && x.Documentation != nil {
+ return *x.Documentation
+ }
+ return ""
+}
+
+func (x *AttributeDefinition) GetAllowEmpty() bool {
+ if x != nil && x.AllowEmpty != nil {
+ return *x.AllowEmpty
+ }
+ return false
+}
+
+func (x *AttributeDefinition) GetAllowSingleFile() bool {
+ if x != nil && x.AllowSingleFile != nil {
+ return *x.AllowSingleFile
+ }
+ return false
+}
+
+func (x *AttributeDefinition) GetDefault() *AttributeValue {
+ if x != nil {
+ return x.Default
+ }
+ return nil
+}
+
+func (x *AttributeDefinition) GetExecutable() bool {
+ if x != nil && x.Executable != nil {
+ return *x.Executable
+ }
+ return false
+}
+
+func (x *AttributeDefinition) GetConfigurable() bool {
+ if x != nil && x.Configurable != nil {
+ return *x.Configurable
+ }
+ return false
+}
+
+func (x *AttributeDefinition) GetNodep() bool {
+ if x != nil && x.Nodep != nil {
+ return *x.Nodep
+ }
+ return false
+}
+
+func (x *AttributeDefinition) GetCfgIsHost() bool {
+ if x != nil && x.CfgIsHost != nil {
+ return *x.CfgIsHost
+ }
+ return false
+}
+
+// An AttributeValue represents the value of an attribute.
+// A single field, determined by the attribute type, is populated.
+//
+// It is used only for AttributeDefinition.default. Attribute and
+// SelectorEntry do their own thing for unfortunate historical reasons.
+type AttributeValue struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Int *int32 `protobuf:"varint,1,opt,name=int" json:"int,omitempty"` // type=int|tristate
+ String_ *string `protobuf:"bytes,2,opt,name=string" json:"string,omitempty"` // type=string|label|output
+ Bool *bool `protobuf:"varint,3,opt,name=bool" json:"bool,omitempty"` // type=bool
+ List []*AttributeValue `protobuf:"bytes,4,rep,name=list" json:"list,omitempty"` // type=*_list|distrib
+ Dict []*AttributeValue_DictEntry `protobuf:"bytes,5,rep,name=dict" json:"dict,omitempty"` // type=*_dict
+}
+
+func (x *AttributeValue) Reset() {
+ *x = AttributeValue{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[19]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *AttributeValue) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*AttributeValue) ProtoMessage() {}
+
+func (x *AttributeValue) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[19]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use AttributeValue.ProtoReflect.Descriptor instead.
+func (*AttributeValue) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{19}
+}
+
+func (x *AttributeValue) GetInt() int32 {
+ if x != nil && x.Int != nil {
+ return *x.Int
+ }
+ return 0
+}
+
+func (x *AttributeValue) GetString_() string {
+ if x != nil && x.String_ != nil {
+ return *x.String_
+ }
+ return ""
+}
+
+func (x *AttributeValue) GetBool() bool {
+ if x != nil && x.Bool != nil {
+ return *x.Bool
+ }
+ return false
+}
+
+func (x *AttributeValue) GetList() []*AttributeValue {
+ if x != nil {
+ return x.List
+ }
+ return nil
+}
+
+func (x *AttributeValue) GetDict() []*AttributeValue_DictEntry {
+ if x != nil {
+ return x.Dict
+ }
+ return nil
+}
+
+type RuleDefinition struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"`
+ // Only contains documented attributes
+ Attribute []*AttributeDefinition `protobuf:"bytes,2,rep,name=attribute" json:"attribute,omitempty"`
+ Documentation *string `protobuf:"bytes,3,opt,name=documentation" json:"documentation,omitempty"`
+ // Only for build extensions: label to file that defines the extension
+ Label *string `protobuf:"bytes,4,opt,name=label" json:"label,omitempty"`
+}
+
+func (x *RuleDefinition) Reset() {
+ *x = RuleDefinition{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[20]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *RuleDefinition) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*RuleDefinition) ProtoMessage() {}
+
+func (x *RuleDefinition) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[20]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use RuleDefinition.ProtoReflect.Descriptor instead.
+func (*RuleDefinition) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{20}
+}
+
+func (x *RuleDefinition) GetName() string {
+ if x != nil && x.Name != nil {
+ return *x.Name
+ }
+ return ""
+}
+
+func (x *RuleDefinition) GetAttribute() []*AttributeDefinition {
+ if x != nil {
+ return x.Attribute
+ }
+ return nil
+}
+
+func (x *RuleDefinition) GetDocumentation() string {
+ if x != nil && x.Documentation != nil {
+ return *x.Documentation
+ }
+ return ""
+}
+
+func (x *RuleDefinition) GetLabel() string {
+ if x != nil && x.Label != nil {
+ return *x.Label
+ }
+ return ""
+}
+
+type BuildLanguage struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Only contains documented rule definitions
+ Rule []*RuleDefinition `protobuf:"bytes,1,rep,name=rule" json:"rule,omitempty"`
+}
+
+func (x *BuildLanguage) Reset() {
+ *x = BuildLanguage{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[21]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *BuildLanguage) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*BuildLanguage) ProtoMessage() {}
+
+func (x *BuildLanguage) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[21]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use BuildLanguage.ProtoReflect.Descriptor instead.
+func (*BuildLanguage) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{21}
+}
+
+func (x *BuildLanguage) GetRule() []*RuleDefinition {
+ if x != nil {
+ return x.Rule
+ }
+ return nil
+}
+
+type Attribute_SelectorEntry struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The key of the selector entry. At this time, this is the label of a
+ // config_setting rule, or the pseudo-label "//conditions:default".
+ Label *string `protobuf:"bytes,1,opt,name=label" json:"label,omitempty"`
+ // True if the entry's value is the default value for the type as a
+ // result of the condition value being specified as None (ie:
+ // {"//condition": None}).
+ IsDefaultValue *bool `protobuf:"varint,16,opt,name=is_default_value,json=isDefaultValue" json:"is_default_value,omitempty"`
+ // Exactly one of the following fields (except for glob_criteria) must be
+ // populated - note that the BOOLEAN and TRISTATE caveat in Attribute's
+ // comment does not apply here. The type field in the SelectorList
+ // containing this entry indicates which of these fields is populated,
+ // in accordance with the comments on Discriminator enum values above.
+ // (To be explicit: BOOLEAN populates the boolean_value field and TRISTATE
+ // populates the tristate_value field.)
+ IntValue *int32 `protobuf:"varint,2,opt,name=int_value,json=intValue" json:"int_value,omitempty"`
+ StringValue *string `protobuf:"bytes,3,opt,name=string_value,json=stringValue" json:"string_value,omitempty"`
+ BooleanValue *bool `protobuf:"varint,4,opt,name=boolean_value,json=booleanValue" json:"boolean_value,omitempty"`
+ TristateValue *Attribute_Tristate `protobuf:"varint,5,opt,name=tristate_value,json=tristateValue,enum=blaze_query.Attribute_Tristate" json:"tristate_value,omitempty"`
+ StringListValue []string `protobuf:"bytes,6,rep,name=string_list_value,json=stringListValue" json:"string_list_value,omitempty"`
+ License *License `protobuf:"bytes,7,opt,name=license" json:"license,omitempty"`
+ StringDictValue []*StringDictEntry `protobuf:"bytes,8,rep,name=string_dict_value,json=stringDictValue" json:"string_dict_value,omitempty"`
+ FilesetListValue []*FilesetEntry `protobuf:"bytes,9,rep,name=fileset_list_value,json=filesetListValue" json:"fileset_list_value,omitempty"`
+ LabelListDictValue []*LabelListDictEntry `protobuf:"bytes,10,rep,name=label_list_dict_value,json=labelListDictValue" json:"label_list_dict_value,omitempty"`
+ StringListDictValue []*StringListDictEntry `protobuf:"bytes,11,rep,name=string_list_dict_value,json=stringListDictValue" json:"string_list_dict_value,omitempty"`
+ IntListValue []int32 `protobuf:"varint,13,rep,name=int_list_value,json=intListValue" json:"int_list_value,omitempty"`
+ LabelDictUnaryValue []*LabelDictUnaryEntry `protobuf:"bytes,15,rep,name=label_dict_unary_value,json=labelDictUnaryValue" json:"label_dict_unary_value,omitempty"`
+ LabelKeyedStringDictValue []*LabelKeyedStringDictEntry `protobuf:"bytes,17,rep,name=label_keyed_string_dict_value,json=labelKeyedStringDictValue" json:"label_keyed_string_dict_value,omitempty"`
+ DEPRECATEDStringDictUnaryValue [][]byte `protobuf:"bytes,14,rep,name=DEPRECATED_string_dict_unary_value,json=DEPRECATEDStringDictUnaryValue" json:"DEPRECATED_string_dict_unary_value,omitempty"`
+}
+
+func (x *Attribute_SelectorEntry) Reset() {
+ *x = Attribute_SelectorEntry{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[22]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Attribute_SelectorEntry) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Attribute_SelectorEntry) ProtoMessage() {}
+
+func (x *Attribute_SelectorEntry) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[22]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Attribute_SelectorEntry.ProtoReflect.Descriptor instead.
+func (*Attribute_SelectorEntry) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{7, 0}
+}
+
+func (x *Attribute_SelectorEntry) GetLabel() string {
+ if x != nil && x.Label != nil {
+ return *x.Label
+ }
+ return ""
+}
+
+func (x *Attribute_SelectorEntry) GetIsDefaultValue() bool {
+ if x != nil && x.IsDefaultValue != nil {
+ return *x.IsDefaultValue
+ }
+ return false
+}
+
+func (x *Attribute_SelectorEntry) GetIntValue() int32 {
+ if x != nil && x.IntValue != nil {
+ return *x.IntValue
+ }
+ return 0
+}
+
+func (x *Attribute_SelectorEntry) GetStringValue() string {
+ if x != nil && x.StringValue != nil {
+ return *x.StringValue
+ }
+ return ""
+}
+
+func (x *Attribute_SelectorEntry) GetBooleanValue() bool {
+ if x != nil && x.BooleanValue != nil {
+ return *x.BooleanValue
+ }
+ return false
+}
+
+func (x *Attribute_SelectorEntry) GetTristateValue() Attribute_Tristate {
+ if x != nil && x.TristateValue != nil {
+ return *x.TristateValue
+ }
+ return Attribute_NO
+}
+
+func (x *Attribute_SelectorEntry) GetStringListValue() []string {
+ if x != nil {
+ return x.StringListValue
+ }
+ return nil
+}
+
+func (x *Attribute_SelectorEntry) GetLicense() *License {
+ if x != nil {
+ return x.License
+ }
+ return nil
+}
+
+func (x *Attribute_SelectorEntry) GetStringDictValue() []*StringDictEntry {
+ if x != nil {
+ return x.StringDictValue
+ }
+ return nil
+}
+
+func (x *Attribute_SelectorEntry) GetFilesetListValue() []*FilesetEntry {
+ if x != nil {
+ return x.FilesetListValue
+ }
+ return nil
+}
+
+func (x *Attribute_SelectorEntry) GetLabelListDictValue() []*LabelListDictEntry {
+ if x != nil {
+ return x.LabelListDictValue
+ }
+ return nil
+}
+
+func (x *Attribute_SelectorEntry) GetStringListDictValue() []*StringListDictEntry {
+ if x != nil {
+ return x.StringListDictValue
+ }
+ return nil
+}
+
+func (x *Attribute_SelectorEntry) GetIntListValue() []int32 {
+ if x != nil {
+ return x.IntListValue
+ }
+ return nil
+}
+
+func (x *Attribute_SelectorEntry) GetLabelDictUnaryValue() []*LabelDictUnaryEntry {
+ if x != nil {
+ return x.LabelDictUnaryValue
+ }
+ return nil
+}
+
+func (x *Attribute_SelectorEntry) GetLabelKeyedStringDictValue() []*LabelKeyedStringDictEntry {
+ if x != nil {
+ return x.LabelKeyedStringDictValue
+ }
+ return nil
+}
+
+func (x *Attribute_SelectorEntry) GetDEPRECATEDStringDictUnaryValue() [][]byte {
+ if x != nil {
+ return x.DEPRECATEDStringDictUnaryValue
+ }
+ return nil
+}
+
+type Attribute_Selector struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The list of (label, value) pairs in the map that defines the selector.
+ // At this time, this cannot be empty, i.e. a selector has at least one
+ // entry.
+ Entries []*Attribute_SelectorEntry `protobuf:"bytes,1,rep,name=entries" json:"entries,omitempty"`
+ // Whether or not this has any default values.
+ HasDefaultValue *bool `protobuf:"varint,2,opt,name=has_default_value,json=hasDefaultValue" json:"has_default_value,omitempty"`
+ // The error message when no condition matches.
+ NoMatchError *string `protobuf:"bytes,3,opt,name=no_match_error,json=noMatchError" json:"no_match_error,omitempty"`
+}
+
+func (x *Attribute_Selector) Reset() {
+ *x = Attribute_Selector{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[23]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Attribute_Selector) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Attribute_Selector) ProtoMessage() {}
+
+func (x *Attribute_Selector) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[23]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Attribute_Selector.ProtoReflect.Descriptor instead.
+func (*Attribute_Selector) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{7, 1}
+}
+
+func (x *Attribute_Selector) GetEntries() []*Attribute_SelectorEntry {
+ if x != nil {
+ return x.Entries
+ }
+ return nil
+}
+
+func (x *Attribute_Selector) GetHasDefaultValue() bool {
+ if x != nil && x.HasDefaultValue != nil {
+ return *x.HasDefaultValue
+ }
+ return false
+}
+
+func (x *Attribute_Selector) GetNoMatchError() string {
+ if x != nil && x.NoMatchError != nil {
+ return *x.NoMatchError
+ }
+ return ""
+}
+
+type Attribute_SelectorList struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The type that this selector list evaluates to, and the type that each
+ // selector in the list evaluates to. At this time, this cannot be
+ // SELECTOR_LIST, i.e. selector lists do not nest.
+ Type *Attribute_Discriminator `protobuf:"varint,1,opt,name=type,enum=blaze_query.Attribute_Discriminator" json:"type,omitempty"`
+ // The list of selector elements in this selector list. At this time, this
+ // cannot be empty, i.e. a selector list is never empty.
+ Elements []*Attribute_Selector `protobuf:"bytes,2,rep,name=elements" json:"elements,omitempty"`
+}
+
+func (x *Attribute_SelectorList) Reset() {
+ *x = Attribute_SelectorList{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[24]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Attribute_SelectorList) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Attribute_SelectorList) ProtoMessage() {}
+
+func (x *Attribute_SelectorList) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[24]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Attribute_SelectorList.ProtoReflect.Descriptor instead.
+func (*Attribute_SelectorList) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{7, 2}
+}
+
+func (x *Attribute_SelectorList) GetType() Attribute_Discriminator {
+ if x != nil && x.Type != nil {
+ return *x.Type
+ }
+ return Attribute_INTEGER
+}
+
+func (x *Attribute_SelectorList) GetElements() []*Attribute_Selector {
+ if x != nil {
+ return x.Elements
+ }
+ return nil
+}
+
+type AttributeValue_DictEntry struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"`
+ Value *AttributeValue `protobuf:"bytes,2,req,name=value" json:"value,omitempty"`
+}
+
+func (x *AttributeValue_DictEntry) Reset() {
+ *x = AttributeValue_DictEntry{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[25]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *AttributeValue_DictEntry) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*AttributeValue_DictEntry) ProtoMessage() {}
+
+func (x *AttributeValue_DictEntry) ProtoReflect() protoreflect.Message {
+ mi := &file_src_main_protobuf_build_proto_msgTypes[25]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use AttributeValue_DictEntry.ProtoReflect.Descriptor instead.
+func (*AttributeValue_DictEntry) Descriptor() ([]byte, []int) {
+ return file_src_main_protobuf_build_proto_rawDescGZIP(), []int{19, 0}
+}
+
+func (x *AttributeValue_DictEntry) GetKey() string {
+ if x != nil && x.Key != nil {
+ return *x.Key
+ }
+ return ""
+}
+
+func (x *AttributeValue_DictEntry) GetValue() *AttributeValue {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+var File_src_main_protobuf_build_proto protoreflect.FileDescriptor
+
+var file_src_main_protobuf_build_proto_rawDesc = []byte{
+ 0x0a, 0x1d, 0x73, 0x72, 0x63, 0x2f, 0x6d, 0x61, 0x69, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+ 0x62, 0x75, 0x66, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
+ 0x0b, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x22, 0x4a, 0x0a, 0x07,
+ 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x6c, 0x69, 0x63, 0x65, 0x6e,
+ 0x73, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x6c,
+ 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x78,
+ 0x63, 0x65, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x65,
+ 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x39, 0x0a, 0x0f, 0x53, 0x74, 0x72, 0x69,
+ 0x6e, 0x67, 0x44, 0x69, 0x63, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b,
+ 0x65, 0x79, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a,
+ 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x02, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61,
+ 0x6c, 0x75, 0x65, 0x22, 0x3d, 0x0a, 0x13, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x44, 0x69, 0x63, 0x74,
+ 0x55, 0x6e, 0x61, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65,
+ 0x79, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05,
+ 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x02, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c,
+ 0x75, 0x65, 0x22, 0x3c, 0x0a, 0x12, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x4c, 0x69, 0x73, 0x74, 0x44,
+ 0x69, 0x63, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18,
+ 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61,
+ 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
+ 0x22, 0x43, 0x0a, 0x19, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x4b, 0x65, 0x79, 0x65, 0x64, 0x53, 0x74,
+ 0x72, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x63, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
+ 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
+ 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x02, 0x28, 0x09, 0x52, 0x05,
+ 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3d, 0x0a, 0x13, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4c,
+ 0x69, 0x73, 0x74, 0x44, 0x69, 0x63, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03,
+ 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14,
+ 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76,
+ 0x61, 0x6c, 0x75, 0x65, 0x22, 0xdb, 0x02, 0x0a, 0x0c, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x65, 0x74,
+ 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18,
+ 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x33, 0x0a,
+ 0x15, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x69, 0x72,
+ 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x02, 0x28, 0x09, 0x52, 0x14, 0x64, 0x65,
+ 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f,
+ 0x72, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x73,
+ 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x66, 0x69, 0x6c, 0x65, 0x73,
+ 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18,
+ 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x65,
+ 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x65, 0x78,
+ 0x63, 0x6c, 0x75, 0x64, 0x65, 0x12, 0x5a, 0x0a, 0x10, 0x73, 0x79, 0x6d, 0x6c, 0x69, 0x6e, 0x6b,
+ 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32,
+ 0x29, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x46, 0x69,
+ 0x6c, 0x65, 0x73, 0x65, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x2e, 0x53, 0x79, 0x6d, 0x6c, 0x69,
+ 0x6e, 0x6b, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x3a, 0x04, 0x43, 0x4f, 0x50, 0x59,
+ 0x52, 0x0f, 0x73, 0x79, 0x6d, 0x6c, 0x69, 0x6e, 0x6b, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f,
+ 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x70, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69,
+ 0x78, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x70, 0x50, 0x72,
+ 0x65, 0x66, 0x69, 0x78, 0x22, 0x2c, 0x0a, 0x0f, 0x53, 0x79, 0x6d, 0x6c, 0x69, 0x6e, 0x6b, 0x42,
+ 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x4f, 0x50, 0x59, 0x10,
+ 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x44, 0x45, 0x52, 0x45, 0x46, 0x45, 0x52, 0x45, 0x4e, 0x43, 0x45,
+ 0x10, 0x02, 0x22, 0x9f, 0x16, 0x0a, 0x09, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65,
+ 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x04,
+ 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x31, 0x0a, 0x14, 0x65, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74,
+ 0x6c, 0x79, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x18, 0x0d, 0x20, 0x01,
+ 0x28, 0x08, 0x52, 0x13, 0x65, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x6c, 0x79, 0x53, 0x70,
+ 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x70,
+ 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x70, 0x12, 0x38, 0x0a,
+ 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x62, 0x6c,
+ 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62,
+ 0x75, 0x74, 0x65, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f,
+ 0x72, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x5f, 0x76,
+ 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x56,
+ 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76,
+ 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69,
+ 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x62, 0x6f, 0x6f, 0x6c, 0x65,
+ 0x61, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c,
+ 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x46, 0x0a, 0x0e,
+ 0x74, 0x72, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0f,
+ 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65,
+ 0x72, 0x79, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x54, 0x72, 0x69,
+ 0x73, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0d, 0x74, 0x72, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x56,
+ 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6c,
+ 0x69, 0x73, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52,
+ 0x0f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65,
+ 0x12, 0x2e, 0x0a, 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x14, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e,
+ 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x52, 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65,
+ 0x12, 0x48, 0x0a, 0x11, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x69, 0x63, 0x74, 0x5f,
+ 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x62, 0x6c,
+ 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67,
+ 0x44, 0x69, 0x63, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0f, 0x73, 0x74, 0x72, 0x69, 0x6e,
+ 0x67, 0x44, 0x69, 0x63, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x47, 0x0a, 0x12, 0x66, 0x69,
+ 0x6c, 0x65, 0x73, 0x65, 0x74, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65,
+ 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71,
+ 0x75, 0x65, 0x72, 0x79, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x65, 0x74, 0x45, 0x6e, 0x74, 0x72,
+ 0x79, 0x52, 0x10, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61,
+ 0x6c, 0x75, 0x65, 0x12, 0x52, 0x0a, 0x15, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x5f, 0x6c, 0x69, 0x73,
+ 0x74, 0x5f, 0x64, 0x69, 0x63, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0a, 0x20, 0x03,
+ 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79,
+ 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x69, 0x63, 0x74, 0x45, 0x6e,
+ 0x74, 0x72, 0x79, 0x52, 0x12, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x69,
+ 0x63, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x55, 0x0a, 0x16, 0x73, 0x74, 0x72, 0x69, 0x6e,
+ 0x67, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x64, 0x69, 0x63, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75,
+ 0x65, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f,
+ 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4c, 0x69, 0x73, 0x74,
+ 0x44, 0x69, 0x63, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x13, 0x73, 0x74, 0x72, 0x69, 0x6e,
+ 0x67, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x69, 0x63, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x24,
+ 0x0a, 0x0e, 0x69, 0x6e, 0x74, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65,
+ 0x18, 0x11, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0c, 0x69, 0x6e, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x56,
+ 0x61, 0x6c, 0x75, 0x65, 0x12, 0x55, 0x0a, 0x16, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x5f, 0x64, 0x69,
+ 0x63, 0x74, 0x5f, 0x75, 0x6e, 0x61, 0x72, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x13,
+ 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65,
+ 0x72, 0x79, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x44, 0x69, 0x63, 0x74, 0x55, 0x6e, 0x61, 0x72,
+ 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x13, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x44, 0x69, 0x63,
+ 0x74, 0x55, 0x6e, 0x61, 0x72, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x68, 0x0a, 0x1d, 0x6c,
+ 0x61, 0x62, 0x65, 0x6c, 0x5f, 0x6b, 0x65, 0x79, 0x65, 0x64, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e,
+ 0x67, 0x5f, 0x64, 0x69, 0x63, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x16, 0x20, 0x03,
+ 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79,
+ 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x4b, 0x65, 0x79, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e,
+ 0x67, 0x44, 0x69, 0x63, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x19, 0x6c, 0x61, 0x62, 0x65,
+ 0x6c, 0x4b, 0x65, 0x79, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x63, 0x74,
+ 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x48, 0x0a, 0x0d, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f,
+ 0x72, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x62,
+ 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69,
+ 0x62, 0x75, 0x74, 0x65, 0x2e, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x4c, 0x69, 0x73,
+ 0x74, 0x52, 0x0c, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12,
+ 0x4a, 0x0a, 0x22, 0x44, 0x45, 0x50, 0x52, 0x45, 0x43, 0x41, 0x54, 0x45, 0x44, 0x5f, 0x73, 0x74,
+ 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x69, 0x63, 0x74, 0x5f, 0x75, 0x6e, 0x61, 0x72, 0x79, 0x5f,
+ 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x12, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x1e, 0x44, 0x45, 0x50,
+ 0x52, 0x45, 0x43, 0x41, 0x54, 0x45, 0x44, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x63,
+ 0x74, 0x55, 0x6e, 0x61, 0x72, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0xcf, 0x07, 0x0a, 0x0d,
+ 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x14, 0x0a,
+ 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x61,
+ 0x62, 0x65, 0x6c, 0x12, 0x28, 0x0a, 0x10, 0x69, 0x73, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c,
+ 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x69,
+ 0x73, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1b, 0x0a,
+ 0x09, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,
+ 0x52, 0x08, 0x69, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74,
+ 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a,
+ 0x0d, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04,
+ 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x56, 0x61, 0x6c,
+ 0x75, 0x65, 0x12, 0x46, 0x0a, 0x0e, 0x74, 0x72, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x76,
+ 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x62, 0x6c, 0x61,
+ 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75,
+ 0x74, 0x65, 0x2e, 0x54, 0x72, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0d, 0x74, 0x72, 0x69,
+ 0x73, 0x74, 0x61, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x73, 0x74,
+ 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
+ 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4c, 0x69, 0x73,
+ 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2e, 0x0a, 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73,
+ 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f,
+ 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x52, 0x07, 0x6c,
+ 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x11, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67,
+ 0x5f, 0x64, 0x69, 0x63, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x03, 0x28,
+ 0x0b, 0x32, 0x1c, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e,
+ 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x63, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52,
+ 0x0f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x63, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65,
+ 0x12, 0x47, 0x0a, 0x12, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x65, 0x74, 0x5f, 0x6c, 0x69, 0x73, 0x74,
+ 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x62,
+ 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x73,
+ 0x65, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x10, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x65, 0x74,
+ 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x52, 0x0a, 0x15, 0x6c, 0x61, 0x62,
+ 0x65, 0x6c, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x64, 0x69, 0x63, 0x74, 0x5f, 0x76, 0x61, 0x6c,
+ 0x75, 0x65, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65,
+ 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x4c, 0x69, 0x73, 0x74,
+ 0x44, 0x69, 0x63, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x12, 0x6c, 0x61, 0x62, 0x65, 0x6c,
+ 0x4c, 0x69, 0x73, 0x74, 0x44, 0x69, 0x63, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x55, 0x0a,
+ 0x16, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x64, 0x69, 0x63,
+ 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e,
+ 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x53, 0x74, 0x72, 0x69,
+ 0x6e, 0x67, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x69, 0x63, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52,
+ 0x13, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x69, 0x63, 0x74, 0x56,
+ 0x61, 0x6c, 0x75, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x69, 0x6e, 0x74, 0x5f, 0x6c, 0x69, 0x73, 0x74,
+ 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0c, 0x69, 0x6e,
+ 0x74, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x55, 0x0a, 0x16, 0x6c, 0x61,
+ 0x62, 0x65, 0x6c, 0x5f, 0x64, 0x69, 0x63, 0x74, 0x5f, 0x75, 0x6e, 0x61, 0x72, 0x79, 0x5f, 0x76,
+ 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x6c, 0x61,
+ 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x44, 0x69,
+ 0x63, 0x74, 0x55, 0x6e, 0x61, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x13, 0x6c, 0x61,
+ 0x62, 0x65, 0x6c, 0x44, 0x69, 0x63, 0x74, 0x55, 0x6e, 0x61, 0x72, 0x79, 0x56, 0x61, 0x6c, 0x75,
+ 0x65, 0x12, 0x68, 0x0a, 0x1d, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x5f, 0x6b, 0x65, 0x79, 0x65, 0x64,
+ 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x69, 0x63, 0x74, 0x5f, 0x76, 0x61, 0x6c,
+ 0x75, 0x65, 0x18, 0x11, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65,
+ 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x4b, 0x65, 0x79, 0x65,
+ 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x63, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79,
+ 0x52, 0x19, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x4b, 0x65, 0x79, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69,
+ 0x6e, 0x67, 0x44, 0x69, 0x63, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x4a, 0x0a, 0x22, 0x44,
+ 0x45, 0x50, 0x52, 0x45, 0x43, 0x41, 0x54, 0x45, 0x44, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67,
+ 0x5f, 0x64, 0x69, 0x63, 0x74, 0x5f, 0x75, 0x6e, 0x61, 0x72, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75,
+ 0x65, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x1e, 0x44, 0x45, 0x50, 0x52, 0x45, 0x43, 0x41,
+ 0x54, 0x45, 0x44, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x63, 0x74, 0x55, 0x6e, 0x61,
+ 0x72, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4a, 0x04, 0x08, 0x0c, 0x10, 0x0d, 0x1a, 0x9c, 0x01,
+ 0x0a, 0x08, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x3e, 0x0a, 0x07, 0x65, 0x6e,
+ 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x62, 0x6c,
+ 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62,
+ 0x75, 0x74, 0x65, 0x2e, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x45, 0x6e, 0x74, 0x72,
+ 0x79, 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x68, 0x61,
+ 0x73, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x68, 0x61, 0x73, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c,
+ 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x6e, 0x6f, 0x5f, 0x6d, 0x61, 0x74,
+ 0x63, 0x68, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c,
+ 0x6e, 0x6f, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x1a, 0x85, 0x01, 0x0a,
+ 0x0c, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x38, 0x0a,
+ 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x62, 0x6c,
+ 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62,
+ 0x75, 0x74, 0x65, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f,
+ 0x72, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x3b, 0x0a, 0x08, 0x65, 0x6c, 0x65, 0x6d, 0x65,
+ 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x62, 0x6c, 0x61, 0x7a,
+ 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74,
+ 0x65, 0x2e, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x08, 0x65, 0x6c, 0x65, 0x6d,
+ 0x65, 0x6e, 0x74, 0x73, 0x22, 0x8a, 0x03, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d,
+ 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x54, 0x45, 0x47, 0x45,
+ 0x52, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12,
+ 0x09, 0x0a, 0x05, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x55,
+ 0x54, 0x50, 0x55, 0x54, 0x10, 0x04, 0x12, 0x0f, 0x0a, 0x0b, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47,
+ 0x5f, 0x4c, 0x49, 0x53, 0x54, 0x10, 0x05, 0x12, 0x0e, 0x0a, 0x0a, 0x4c, 0x41, 0x42, 0x45, 0x4c,
+ 0x5f, 0x4c, 0x49, 0x53, 0x54, 0x10, 0x06, 0x12, 0x0f, 0x0a, 0x0b, 0x4f, 0x55, 0x54, 0x50, 0x55,
+ 0x54, 0x5f, 0x4c, 0x49, 0x53, 0x54, 0x10, 0x07, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x49, 0x53, 0x54,
+ 0x52, 0x49, 0x42, 0x55, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x45, 0x54, 0x10, 0x08, 0x12, 0x0b,
+ 0x0a, 0x07, 0x4c, 0x49, 0x43, 0x45, 0x4e, 0x53, 0x45, 0x10, 0x09, 0x12, 0x0f, 0x0a, 0x0b, 0x53,
+ 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x44, 0x49, 0x43, 0x54, 0x10, 0x0a, 0x12, 0x16, 0x0a, 0x12,
+ 0x46, 0x49, 0x4c, 0x45, 0x53, 0x45, 0x54, 0x5f, 0x45, 0x4e, 0x54, 0x52, 0x59, 0x5f, 0x4c, 0x49,
+ 0x53, 0x54, 0x10, 0x0b, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x4c, 0x49,
+ 0x53, 0x54, 0x5f, 0x44, 0x49, 0x43, 0x54, 0x10, 0x0c, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x52,
+ 0x49, 0x4e, 0x47, 0x5f, 0x4c, 0x49, 0x53, 0x54, 0x5f, 0x44, 0x49, 0x43, 0x54, 0x10, 0x0d, 0x12,
+ 0x0b, 0x0a, 0x07, 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, 0x4e, 0x10, 0x0e, 0x12, 0x0c, 0x0a, 0x08,
+ 0x54, 0x52, 0x49, 0x53, 0x54, 0x41, 0x54, 0x45, 0x10, 0x0f, 0x12, 0x10, 0x0a, 0x0c, 0x49, 0x4e,
+ 0x54, 0x45, 0x47, 0x45, 0x52, 0x5f, 0x4c, 0x49, 0x53, 0x54, 0x10, 0x10, 0x12, 0x0b, 0x0a, 0x07,
+ 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x12, 0x12, 0x14, 0x0a, 0x10, 0x4c, 0x41, 0x42,
+ 0x45, 0x4c, 0x5f, 0x44, 0x49, 0x43, 0x54, 0x5f, 0x55, 0x4e, 0x41, 0x52, 0x59, 0x10, 0x13, 0x12,
+ 0x11, 0x0a, 0x0d, 0x53, 0x45, 0x4c, 0x45, 0x43, 0x54, 0x4f, 0x52, 0x5f, 0x4c, 0x49, 0x53, 0x54,
+ 0x10, 0x14, 0x12, 0x1b, 0x0a, 0x17, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x4b, 0x45, 0x59, 0x45,
+ 0x44, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x44, 0x49, 0x43, 0x54, 0x10, 0x15, 0x12,
+ 0x20, 0x0a, 0x1c, 0x44, 0x45, 0x50, 0x52, 0x45, 0x43, 0x41, 0x54, 0x45, 0x44, 0x5f, 0x53, 0x54,
+ 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x44, 0x49, 0x43, 0x54, 0x5f, 0x55, 0x4e, 0x41, 0x52, 0x59, 0x10,
+ 0x11, 0x22, 0x25, 0x0a, 0x08, 0x54, 0x72, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x06, 0x0a,
+ 0x02, 0x4e, 0x4f, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x59, 0x45, 0x53, 0x10, 0x01, 0x12, 0x08,
+ 0x0a, 0x04, 0x41, 0x55, 0x54, 0x4f, 0x10, 0x02, 0x4a, 0x04, 0x08, 0x0c, 0x10, 0x0d, 0x4a, 0x04,
+ 0x08, 0x10, 0x10, 0x11, 0x22, 0xea, 0x04, 0x0a, 0x04, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x12, 0x0a,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,
+ 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x75, 0x6c, 0x65, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x18,
+ 0x02, 0x20, 0x02, 0x28, 0x09, 0x52, 0x09, 0x72, 0x75, 0x6c, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73,
+ 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x34, 0x0a, 0x09,
+ 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32,
+ 0x16, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x41, 0x74,
+ 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75,
+ 0x74, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x75, 0x6c, 0x65, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74,
+ 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x72, 0x75, 0x6c, 0x65, 0x49, 0x6e, 0x70, 0x75,
+ 0x74, 0x12, 0x54, 0x0a, 0x15, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x64, 0x5f,
+ 0x72, 0x75, 0x6c, 0x65, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b,
+ 0x32, 0x20, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x43,
+ 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x64, 0x52, 0x75, 0x6c, 0x65, 0x49, 0x6e, 0x70,
+ 0x75, 0x74, 0x52, 0x13, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x64, 0x52, 0x75,
+ 0x6c, 0x65, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x75, 0x6c, 0x65, 0x5f,
+ 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x75,
+ 0x6c, 0x65, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x64, 0x65, 0x66, 0x61,
+ 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x07, 0x20, 0x03, 0x28,
+ 0x09, 0x52, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e,
+ 0x67, 0x12, 0x3f, 0x0a, 0x1c, 0x44, 0x45, 0x50, 0x52, 0x45, 0x43, 0x41, 0x54, 0x45, 0x44, 0x5f,
+ 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x62, 0x79, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c,
+ 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x19, 0x44, 0x45, 0x50, 0x52, 0x45, 0x43, 0x41,
+ 0x54, 0x45, 0x44, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x42, 0x79, 0x44, 0x65, 0x66, 0x61, 0x75,
+ 0x6c, 0x74, 0x12, 0x32, 0x0a, 0x15, 0x44, 0x45, 0x50, 0x52, 0x45, 0x43, 0x41, 0x54, 0x45, 0x44,
+ 0x5f, 0x69, 0x73, 0x5f, 0x73, 0x6b, 0x79, 0x6c, 0x61, 0x72, 0x6b, 0x18, 0x0a, 0x20, 0x01, 0x28,
+ 0x08, 0x52, 0x13, 0x44, 0x45, 0x50, 0x52, 0x45, 0x43, 0x41, 0x54, 0x45, 0x44, 0x49, 0x73, 0x53,
+ 0x6b, 0x79, 0x6c, 0x61, 0x72, 0x6b, 0x12, 0x41, 0x0a, 0x1d, 0x73, 0x6b, 0x79, 0x6c, 0x61, 0x72,
+ 0x6b, 0x5f, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x61,
+ 0x73, 0x68, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x1a, 0x73,
+ 0x6b, 0x79, 0x6c, 0x61, 0x72, 0x6b, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e,
+ 0x74, 0x48, 0x61, 0x73, 0x68, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x2f, 0x0a, 0x13, 0x69, 0x6e, 0x73,
+ 0x74, 0x61, 0x6e, 0x74, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x63, 0x6b,
+ 0x18, 0x0d, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x69,
+ 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x12, 0x29, 0x0a, 0x10, 0x64, 0x65,
+ 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x18, 0x0e,
+ 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e,
+ 0x53, 0x74, 0x61, 0x63, 0x6b, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x4a, 0x04, 0x08, 0x0b, 0x10,
+ 0x0c, 0x22, 0x8d, 0x01, 0x0a, 0x13, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x64,
+ 0x52, 0x75, 0x6c, 0x65, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x61, 0x62,
+ 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12,
+ 0x35, 0x0a, 0x16, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
+ 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x15, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x68,
+ 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67,
+ 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d,
+ 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49,
+ 0x64, 0x22, 0x83, 0x01, 0x0a, 0x0b, 0x52, 0x75, 0x6c, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72,
+ 0x79, 0x12, 0x25, 0x0a, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0b, 0x32,
+ 0x11, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x52, 0x75,
+ 0x6c, 0x65, 0x52, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x65,
+ 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x62,
+ 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x52, 0x75, 0x6c, 0x65, 0x52,
+ 0x0a, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x6c,
+ 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c,
+ 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x8b, 0x01, 0x0a, 0x0c, 0x50, 0x61, 0x63, 0x6b,
+ 0x61, 0x67, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
+ 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2b, 0x0a, 0x11,
+ 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67,
+ 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e,
+ 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x34, 0x0a, 0x16, 0x69, 0x6e, 0x63,
+ 0x6c, 0x75, 0x64, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x67, 0x72,
+ 0x6f, 0x75, 0x70, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x14, 0x69, 0x6e, 0x63, 0x6c, 0x75,
+ 0x64, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4a,
+ 0x04, 0x08, 0x04, 0x10, 0x05, 0x22, 0x62, 0x0a, 0x10, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e,
+ 0x6d, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
+ 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a,
+ 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x03,
+ 0x28, 0x09, 0x52, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12,
+ 0x18, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09,
+ 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x22, 0xb4, 0x02, 0x0a, 0x0a, 0x53, 0x6f,
+ 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
+ 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08,
+ 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
+ 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x75, 0x62, 0x69,
+ 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x75,
+ 0x62, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x61, 0x63, 0x6b,
+ 0x61, 0x67, 0x65, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52,
+ 0x0c, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x29, 0x0a,
+ 0x10, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x6c, 0x61, 0x62, 0x65,
+ 0x6c, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c,
+ 0x69, 0x74, 0x79, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x65, 0x61, 0x74,
+ 0x75, 0x72, 0x65, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x66, 0x65, 0x61, 0x74, 0x75,
+ 0x72, 0x65, 0x12, 0x2e, 0x0a, 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x18, 0x08, 0x20,
+ 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72,
+ 0x79, 0x2e, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x52, 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e,
+ 0x73, 0x65, 0x12, 0x36, 0x0a, 0x17, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f,
+ 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x09, 0x20,
+ 0x01, 0x28, 0x08, 0x52, 0x15, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74,
+ 0x61, 0x69, 0x6e, 0x73, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x4a, 0x04, 0x08, 0x07, 0x10, 0x08,
+ 0x22, 0x68, 0x0a, 0x0d, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x6c,
+ 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74,
+ 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x02, 0x28, 0x09, 0x52, 0x0e,
+ 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x1a,
+ 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xd9, 0x03, 0x0a, 0x06, 0x54,
+ 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x35, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20,
+ 0x02, 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72,
+ 0x79, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d,
+ 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x25, 0x0a, 0x04,
+ 0x72, 0x75, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x62, 0x6c, 0x61,
+ 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x04, 0x72,
+ 0x75, 0x6c, 0x65, 0x12, 0x38, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x66, 0x69,
+ 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65,
+ 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c,
+ 0x65, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x41, 0x0a,
+ 0x0e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18,
+ 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75,
+ 0x65, 0x72, 0x79, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x6c,
+ 0x65, 0x52, 0x0d, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x6c, 0x65,
+ 0x12, 0x3e, 0x0a, 0x0d, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x67, 0x72, 0x6f, 0x75,
+ 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f,
+ 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x47, 0x72, 0x6f,
+ 0x75, 0x70, 0x52, 0x0c, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70,
+ 0x12, 0x4a, 0x0a, 0x11, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x5f,
+ 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x6c,
+ 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f,
+ 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x10, 0x65, 0x6e, 0x76, 0x69,
+ 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x68, 0x0a, 0x0d,
+ 0x44, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x08, 0x0a,
+ 0x04, 0x52, 0x55, 0x4c, 0x45, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x53, 0x4f, 0x55, 0x52, 0x43,
+ 0x45, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x47, 0x45, 0x4e, 0x45,
+ 0x52, 0x41, 0x54, 0x45, 0x44, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d,
+ 0x50, 0x41, 0x43, 0x4b, 0x41, 0x47, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x04, 0x12,
+ 0x15, 0x0a, 0x11, 0x45, 0x4e, 0x56, 0x49, 0x52, 0x4f, 0x4e, 0x4d, 0x45, 0x4e, 0x54, 0x5f, 0x47,
+ 0x52, 0x4f, 0x55, 0x50, 0x10, 0x05, 0x22, 0x3a, 0x0a, 0x0b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52,
+ 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x2b, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18,
+ 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75,
+ 0x65, 0x72, 0x79, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67,
+ 0x65, 0x74, 0x22, 0xc0, 0x01, 0x0a, 0x14, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x52, 0x75,
+ 0x6c, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x4c, 0x0a, 0x06, 0x70,
+ 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0e, 0x32, 0x34, 0x2e, 0x62, 0x6c,
+ 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65,
+ 0x64, 0x52, 0x75, 0x6c, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41,
+ 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x52, 0x75, 0x6c, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x65,
+ 0x73, 0x52, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x2c, 0x0a, 0x12, 0x61, 0x6c, 0x6c,
+ 0x6f, 0x77, 0x65, 0x64, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x18,
+ 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x52, 0x75,
+ 0x6c, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x22, 0x2c, 0x0a, 0x12, 0x41, 0x6c, 0x6c, 0x6f, 0x77,
+ 0x65, 0x64, 0x52, 0x75, 0x6c, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x12, 0x07, 0x0a,
+ 0x03, 0x41, 0x4e, 0x59, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46,
+ 0x49, 0x45, 0x44, 0x10, 0x02, 0x22, 0xfa, 0x03, 0x0a, 0x13, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62,
+ 0x75, 0x74, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,
+ 0x65, 0x12, 0x38, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0e, 0x32,
+ 0x24, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x41, 0x74,
+ 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d, 0x69,
+ 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6d,
+ 0x61, 0x6e, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09,
+ 0x6d, 0x61, 0x6e, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x53, 0x0a, 0x14, 0x61, 0x6c, 0x6c,
+ 0x6f, 0x77, 0x65, 0x64, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x65,
+ 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f,
+ 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x52, 0x75, 0x6c,
+ 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x12, 0x61, 0x6c, 0x6c, 0x6f,
+ 0x77, 0x65, 0x64, 0x52, 0x75, 0x6c, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x12, 0x24,
+ 0x0a, 0x0d, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18,
+ 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x65, 0x6d,
+ 0x70, 0x74, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x77,
+ 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x2a, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x73,
+ 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08,
+ 0x52, 0x0f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x46, 0x69, 0x6c,
+ 0x65, 0x12, 0x35, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x09, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79,
+ 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52,
+ 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x78, 0x65, 0x63,
+ 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x65, 0x78,
+ 0x65, 0x63, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x66,
+ 0x69, 0x67, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c,
+ 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05,
+ 0x6e, 0x6f, 0x64, 0x65, 0x70, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x6e, 0x6f, 0x64,
+ 0x65, 0x70, 0x12, 0x1e, 0x0a, 0x0b, 0x63, 0x66, 0x67, 0x5f, 0x69, 0x73, 0x5f, 0x68, 0x6f, 0x73,
+ 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x63, 0x66, 0x67, 0x49, 0x73, 0x48, 0x6f,
+ 0x73, 0x74, 0x22, 0x8c, 0x02, 0x0a, 0x0e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65,
+ 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x05, 0x52, 0x03, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e,
+ 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12,
+ 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x62,
+ 0x6f, 0x6f, 0x6c, 0x12, 0x2f, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x04, 0x20, 0x03, 0x28,
+ 0x0b, 0x32, 0x1b, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e,
+ 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x04,
+ 0x6c, 0x69, 0x73, 0x74, 0x12, 0x39, 0x0a, 0x04, 0x64, 0x69, 0x63, 0x74, 0x18, 0x05, 0x20, 0x03,
+ 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79,
+ 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e,
+ 0x44, 0x69, 0x63, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x64, 0x69, 0x63, 0x74, 0x1a,
+ 0x50, 0x0a, 0x09, 0x44, 0x69, 0x63, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03,
+ 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x31,
+ 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x1b, 0x2e,
+ 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x41, 0x74, 0x74, 0x72,
+ 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
+ 0x65, 0x22, 0xa0, 0x01, 0x0a, 0x0e, 0x52, 0x75, 0x6c, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69,
+ 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x02,
+ 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x09, 0x61, 0x74, 0x74, 0x72,
+ 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x6c,
+ 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62,
+ 0x75, 0x74, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x61,
+ 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x64, 0x6f, 0x63, 0x75,
+ 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x0d, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14,
+ 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c,
+ 0x61, 0x62, 0x65, 0x6c, 0x22, 0x40, 0x0a, 0x0d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x4c, 0x61, 0x6e,
+ 0x67, 0x75, 0x61, 0x67, 0x65, 0x12, 0x2f, 0x0a, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20,
+ 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72,
+ 0x79, 0x2e, 0x52, 0x75, 0x6c, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e,
+ 0x52, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x42, 0x36, 0x0a, 0x34, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f,
+ 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x64, 0x65, 0x76, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2e, 0x62, 0x75,
+ 0x69, 0x6c, 0x64, 0x2e, 0x6c, 0x69, 0x62, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x32, 0x2e, 0x70,
+ 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x61, 0x70, 0x69,
+}
+
+var (
+ file_src_main_protobuf_build_proto_rawDescOnce sync.Once
+ file_src_main_protobuf_build_proto_rawDescData = file_src_main_protobuf_build_proto_rawDesc
+)
+
+func file_src_main_protobuf_build_proto_rawDescGZIP() []byte {
+ file_src_main_protobuf_build_proto_rawDescOnce.Do(func() {
+ file_src_main_protobuf_build_proto_rawDescData = protoimpl.X.CompressGZIP(file_src_main_protobuf_build_proto_rawDescData)
+ })
+ return file_src_main_protobuf_build_proto_rawDescData
+}
+
+var file_src_main_protobuf_build_proto_enumTypes = make([]protoimpl.EnumInfo, 5)
+var file_src_main_protobuf_build_proto_msgTypes = make([]protoimpl.MessageInfo, 26)
+var file_src_main_protobuf_build_proto_goTypes = []interface{}{
+ (FilesetEntry_SymlinkBehavior)(0), // 0: blaze_query.FilesetEntry.SymlinkBehavior
+ (Attribute_Discriminator)(0), // 1: blaze_query.Attribute.Discriminator
+ (Attribute_Tristate)(0), // 2: blaze_query.Attribute.Tristate
+ (Target_Discriminator)(0), // 3: blaze_query.Target.Discriminator
+ (AllowedRuleClassInfo_AllowedRuleClasses)(0), // 4: blaze_query.AllowedRuleClassInfo.AllowedRuleClasses
+ (*License)(nil), // 5: blaze_query.License
+ (*StringDictEntry)(nil), // 6: blaze_query.StringDictEntry
+ (*LabelDictUnaryEntry)(nil), // 7: blaze_query.LabelDictUnaryEntry
+ (*LabelListDictEntry)(nil), // 8: blaze_query.LabelListDictEntry
+ (*LabelKeyedStringDictEntry)(nil), // 9: blaze_query.LabelKeyedStringDictEntry
+ (*StringListDictEntry)(nil), // 10: blaze_query.StringListDictEntry
+ (*FilesetEntry)(nil), // 11: blaze_query.FilesetEntry
+ (*Attribute)(nil), // 12: blaze_query.Attribute
+ (*Rule)(nil), // 13: blaze_query.Rule
+ (*ConfiguredRuleInput)(nil), // 14: blaze_query.ConfiguredRuleInput
+ (*RuleSummary)(nil), // 15: blaze_query.RuleSummary
+ (*PackageGroup)(nil), // 16: blaze_query.PackageGroup
+ (*EnvironmentGroup)(nil), // 17: blaze_query.EnvironmentGroup
+ (*SourceFile)(nil), // 18: blaze_query.SourceFile
+ (*GeneratedFile)(nil), // 19: blaze_query.GeneratedFile
+ (*Target)(nil), // 20: blaze_query.Target
+ (*QueryResult)(nil), // 21: blaze_query.QueryResult
+ (*AllowedRuleClassInfo)(nil), // 22: blaze_query.AllowedRuleClassInfo
+ (*AttributeDefinition)(nil), // 23: blaze_query.AttributeDefinition
+ (*AttributeValue)(nil), // 24: blaze_query.AttributeValue
+ (*RuleDefinition)(nil), // 25: blaze_query.RuleDefinition
+ (*BuildLanguage)(nil), // 26: blaze_query.BuildLanguage
+ (*Attribute_SelectorEntry)(nil), // 27: blaze_query.Attribute.SelectorEntry
+ (*Attribute_Selector)(nil), // 28: blaze_query.Attribute.Selector
+ (*Attribute_SelectorList)(nil), // 29: blaze_query.Attribute.SelectorList
+ (*AttributeValue_DictEntry)(nil), // 30: blaze_query.AttributeValue.DictEntry
+}
+var file_src_main_protobuf_build_proto_depIdxs = []int32{
+ 0, // 0: blaze_query.FilesetEntry.symlink_behavior:type_name -> blaze_query.FilesetEntry.SymlinkBehavior
+ 1, // 1: blaze_query.Attribute.type:type_name -> blaze_query.Attribute.Discriminator
+ 2, // 2: blaze_query.Attribute.tristate_value:type_name -> blaze_query.Attribute.Tristate
+ 5, // 3: blaze_query.Attribute.license:type_name -> blaze_query.License
+ 6, // 4: blaze_query.Attribute.string_dict_value:type_name -> blaze_query.StringDictEntry
+ 11, // 5: blaze_query.Attribute.fileset_list_value:type_name -> blaze_query.FilesetEntry
+ 8, // 6: blaze_query.Attribute.label_list_dict_value:type_name -> blaze_query.LabelListDictEntry
+ 10, // 7: blaze_query.Attribute.string_list_dict_value:type_name -> blaze_query.StringListDictEntry
+ 7, // 8: blaze_query.Attribute.label_dict_unary_value:type_name -> blaze_query.LabelDictUnaryEntry
+ 9, // 9: blaze_query.Attribute.label_keyed_string_dict_value:type_name -> blaze_query.LabelKeyedStringDictEntry
+ 29, // 10: blaze_query.Attribute.selector_list:type_name -> blaze_query.Attribute.SelectorList
+ 12, // 11: blaze_query.Rule.attribute:type_name -> blaze_query.Attribute
+ 14, // 12: blaze_query.Rule.configured_rule_input:type_name -> blaze_query.ConfiguredRuleInput
+ 13, // 13: blaze_query.RuleSummary.rule:type_name -> blaze_query.Rule
+ 13, // 14: blaze_query.RuleSummary.dependency:type_name -> blaze_query.Rule
+ 5, // 15: blaze_query.SourceFile.license:type_name -> blaze_query.License
+ 3, // 16: blaze_query.Target.type:type_name -> blaze_query.Target.Discriminator
+ 13, // 17: blaze_query.Target.rule:type_name -> blaze_query.Rule
+ 18, // 18: blaze_query.Target.source_file:type_name -> blaze_query.SourceFile
+ 19, // 19: blaze_query.Target.generated_file:type_name -> blaze_query.GeneratedFile
+ 16, // 20: blaze_query.Target.package_group:type_name -> blaze_query.PackageGroup
+ 17, // 21: blaze_query.Target.environment_group:type_name -> blaze_query.EnvironmentGroup
+ 20, // 22: blaze_query.QueryResult.target:type_name -> blaze_query.Target
+ 4, // 23: blaze_query.AllowedRuleClassInfo.policy:type_name -> blaze_query.AllowedRuleClassInfo.AllowedRuleClasses
+ 1, // 24: blaze_query.AttributeDefinition.type:type_name -> blaze_query.Attribute.Discriminator
+ 22, // 25: blaze_query.AttributeDefinition.allowed_rule_classes:type_name -> blaze_query.AllowedRuleClassInfo
+ 24, // 26: blaze_query.AttributeDefinition.default:type_name -> blaze_query.AttributeValue
+ 24, // 27: blaze_query.AttributeValue.list:type_name -> blaze_query.AttributeValue
+ 30, // 28: blaze_query.AttributeValue.dict:type_name -> blaze_query.AttributeValue.DictEntry
+ 23, // 29: blaze_query.RuleDefinition.attribute:type_name -> blaze_query.AttributeDefinition
+ 25, // 30: blaze_query.BuildLanguage.rule:type_name -> blaze_query.RuleDefinition
+ 2, // 31: blaze_query.Attribute.SelectorEntry.tristate_value:type_name -> blaze_query.Attribute.Tristate
+ 5, // 32: blaze_query.Attribute.SelectorEntry.license:type_name -> blaze_query.License
+ 6, // 33: blaze_query.Attribute.SelectorEntry.string_dict_value:type_name -> blaze_query.StringDictEntry
+ 11, // 34: blaze_query.Attribute.SelectorEntry.fileset_list_value:type_name -> blaze_query.FilesetEntry
+ 8, // 35: blaze_query.Attribute.SelectorEntry.label_list_dict_value:type_name -> blaze_query.LabelListDictEntry
+ 10, // 36: blaze_query.Attribute.SelectorEntry.string_list_dict_value:type_name -> blaze_query.StringListDictEntry
+ 7, // 37: blaze_query.Attribute.SelectorEntry.label_dict_unary_value:type_name -> blaze_query.LabelDictUnaryEntry
+ 9, // 38: blaze_query.Attribute.SelectorEntry.label_keyed_string_dict_value:type_name -> blaze_query.LabelKeyedStringDictEntry
+ 27, // 39: blaze_query.Attribute.Selector.entries:type_name -> blaze_query.Attribute.SelectorEntry
+ 1, // 40: blaze_query.Attribute.SelectorList.type:type_name -> blaze_query.Attribute.Discriminator
+ 28, // 41: blaze_query.Attribute.SelectorList.elements:type_name -> blaze_query.Attribute.Selector
+ 24, // 42: blaze_query.AttributeValue.DictEntry.value:type_name -> blaze_query.AttributeValue
+ 43, // [43:43] is the sub-list for method output_type
+ 43, // [43:43] is the sub-list for method input_type
+ 43, // [43:43] is the sub-list for extension type_name
+ 43, // [43:43] is the sub-list for extension extendee
+ 0, // [0:43] is the sub-list for field type_name
+}
+
+func init() { file_src_main_protobuf_build_proto_init() }
+func file_src_main_protobuf_build_proto_init() {
+ if File_src_main_protobuf_build_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_src_main_protobuf_build_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*License); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*StringDictEntry); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*LabelDictUnaryEntry); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*LabelListDictEntry); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*LabelKeyedStringDictEntry); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*StringListDictEntry); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*FilesetEntry); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Attribute); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Rule); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ConfiguredRuleInput); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*RuleSummary); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*PackageGroup); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*EnvironmentGroup); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SourceFile); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GeneratedFile); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Target); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*QueryResult); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*AllowedRuleClassInfo); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*AttributeDefinition); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*AttributeValue); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*RuleDefinition); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*BuildLanguage); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Attribute_SelectorEntry); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Attribute_Selector); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Attribute_SelectorList); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_src_main_protobuf_build_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*AttributeValue_DictEntry); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_src_main_protobuf_build_proto_rawDesc,
+ NumEnums: 5,
+ NumMessages: 26,
+ NumExtensions: 0,
+ NumServices: 0,
+ },
+ GoTypes: file_src_main_protobuf_build_proto_goTypes,
+ DependencyIndexes: file_src_main_protobuf_build_proto_depIdxs,
+ EnumInfos: file_src_main_protobuf_build_proto_enumTypes,
+ MessageInfos: file_src_main_protobuf_build_proto_msgTypes,
+ }.Build()
+ File_src_main_protobuf_build_proto = out.File
+ file_src_main_protobuf_build_proto_rawDesc = nil
+ file_src_main_protobuf_build_proto_goTypes = nil
+ file_src_main_protobuf_build_proto_depIdxs = nil
+}
diff --git a/chromium/third_party/skia/bazel/exporter/cmake_exporter.go b/chromium/third_party/skia/bazel/exporter/cmake_exporter.go
new file mode 100644
index 00000000000..dd24212393c
--- /dev/null
+++ b/chromium/third_party/skia/bazel/exporter/cmake_exporter.go
@@ -0,0 +1,454 @@
+// Copyright 2022 Google LLC
+//
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package exporter
+
+import (
+ "bytes"
+ "fmt"
+ "path/filepath"
+ "strings"
+
+ "go.skia.org/infra/go/skerr"
+ "go.skia.org/skia/bazel/exporter/build_proto/analysis_v2"
+ "go.skia.org/skia/bazel/exporter/build_proto/build"
+ "go.skia.org/skia/bazel/exporter/interfaces"
+ "google.golang.org/protobuf/proto"
+)
+
+type CMakeExporter struct {
+ workspace cmakeWorkspace
+ workspaceDir string
+}
+
+// NewCMakeExporter creates an exporter that will export to the
+// CMake project file format.
+func NewCMakeExporter(workspaceDir string) *CMakeExporter {
+ return &CMakeExporter{
+ workspace: *newCMakeWorkspace(),
+ workspaceDir: workspaceDir,
+ }
+}
+
+// Return the default copts (COMPILE_FLAGS in CMake) for the macOS toolchain.
+func getMacPlatformRuleCopts() []string {
+ // TODO(crbug.com/skia/13586): Retrieve these values from Bazel.
+ // These values must match those values defined in mac_toolchain_config.bzl
+ return []string{
+ // These items are from _make_default_flags().
+ "-std=c++17",
+ "-Wno-psabi",
+
+ // From _make_target_specific_flags.
+ "--target=arm64-apple-macos11",
+ }
+}
+
+// Return the default copts (COMPILE_FLAGS in CMake) for the Linux toolchain.
+func getLinuxPlatformRuleCopts() []string {
+ // TODO(crbug.com/skia/13586): Retrieve these values from Bazel.
+ return []string{
+ // These items are from _make_default_flags().
+ "-std=c++17",
+ "-Wno-psabi",
+
+ // Added to avoid compile warning.
+ "-Wno-attributes",
+ }
+}
+
+// Write the CMake project config to set the COMPILE_FLAGS
+// variables for all platforms.
+func writePlatformCompileFlags(writer interfaces.Writer) {
+ val := strings.Join(getMacPlatformRuleCopts(), " ")
+ fmt.Fprintf(writer, "set(DEFAULT_COMPILE_FLAGS_MACOS %q)\n", val)
+
+ val = strings.Join(getLinuxPlatformRuleCopts(), " ")
+ fmt.Fprintf(writer, "set(DEFAULT_COMPILE_FLAGS_LINUX %q)\n", val)
+ writer.WriteString("\n")
+ fmt.Fprintln(writer, `if (APPLE)`)
+ fmt.Fprintln(writer, ` set(DEFAULT_COMPILE_FLAGS "${DEFAULT_COMPILE_FLAGS_MACOS}")`)
+ fmt.Fprintln(writer, `else()`)
+ fmt.Fprintln(writer, ` set(DEFAULT_COMPILE_FLAGS "${DEFAULT_COMPILE_FLAGS_LINUX}")`)
+ fmt.Fprintln(writer, `endif()`)
+}
+
+// Return the copts rule attribute for the given rule.
+func getRuleCopts(r *build.Rule) ([]string, error) {
+ ruleOpts, err := getRuleStringArrayAttribute(r, "copts")
+ if err != nil {
+ return nil, skerr.Wrap(err)
+ }
+ copts := []string{"${DEFAULT_COMPILE_FLAGS}"}
+ return appendUnique(copts, ruleOpts...), nil
+}
+
+// Return the include paths for the supplied rule and all rules on which
+// this rule depends.
+//
+// Note: All rules are absolute paths.
+func getRuleIncludes(r *build.Rule, qr *analysis_v2.CqueryResult) ([]string, error) {
+ deps, err := getRuleStringArrayAttribute(r, "deps")
+ if err != nil {
+ return nil, skerr.Wrap(err)
+ }
+ includes, err := getRuleStringArrayAttribute(r, "includes")
+ if err != nil {
+ return nil, skerr.Wrap(err)
+ }
+ ruleDir, err := getLocationDir(r.GetLocation())
+ if err != nil {
+ return nil, skerr.Wrap(err)
+ }
+ for idx, inc := range includes {
+ if inc == "." {
+ includes[idx] = ruleDir
+ }
+ }
+ for _, d := range deps {
+ dr := findRule(qr, d)
+ if dr == nil {
+ return nil, skerr.Fmt("cannot find rule %s", d)
+ }
+ if isExternalRule(dr.GetName()) {
+ continue
+ }
+ incs, err := getRuleIncludes(dr, qr)
+ if err != nil {
+ return nil, skerr.Wrap(err)
+ }
+ includes = appendUnique(includes, incs...)
+ }
+ return includes, nil
+}
+
+// Return the deps for the supplied rule and all rules on which
+// this rule depends.
+func getRuleDefines(r *build.Rule, qr *analysis_v2.CqueryResult) ([]string, error) {
+ deps, err := getRuleStringArrayAttribute(r, "deps")
+ if err != nil {
+ return nil, skerr.Wrap(err)
+ }
+ defines, err := getRuleStringArrayAttribute(r, "defines")
+ if err != nil {
+ return nil, skerr.Wrap(err)
+ }
+ for _, d := range deps {
+ dr := findRule(qr, d)
+ if dr == nil {
+ return nil, skerr.Fmt("cannot find rule %s", d)
+ }
+ defs, err := getRuleDefines(dr, qr)
+ if err != nil {
+ return nil, skerr.Wrap(err)
+ }
+ defines = appendUnique(defines, defs...)
+ }
+ return defines, nil
+}
+
+// Convert an absolute path to a file *within the workspace* to a
+// workspace relative path. All paths start with ${CMAKE_SOURCE_DIR}.
+func (e *CMakeExporter) absToWorkspaceRelativePath(absPath string) string {
+ if absPath == e.workspaceDir {
+ return "${CMAKE_SOURCE_DIR}"
+ }
+ return fmt.Sprintf("${CMAKE_SOURCE_DIR}/%s", absPath[len(e.workspaceDir)+1:])
+}
+
+// Write the list of items (which may be rules or files) to the supplied buffer.
+func (e *CMakeExporter) writeItems(r *cmakeRule, projectDir string, items []string, buffer *bytes.Buffer) error {
+ for _, item := range items {
+ if isFileTarget(item) {
+ _, _, target, err := parseRule(item)
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+ absPath := filepath.Join(projectDir, target)
+ fmt.Fprintf(buffer, " %q\n", e.absToWorkspaceRelativePath(absPath))
+ } else {
+ cmakeName, err := getRuleSimpleName(item)
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+ fmt.Fprintf(buffer, " ${%s}\n", cmakeName)
+ err = r.addDependency(item)
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+ }
+ }
+ return nil
+}
+
+// Write the "srcs" and "hdrs" rule attributes to the supplied buffer.
+func (e *CMakeExporter) writeSrcsAndHdrs(rule *cmakeRule, buffer *bytes.Buffer, r *build.Rule) error {
+ ruleDir, err := getLocationDir(r.GetLocation())
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+ for _, attrib := range r.Attribute {
+ if attrib.GetName() == "srcs" {
+ if attrib.GetType() != build.Attribute_LABEL_LIST {
+ return skerr.Fmt(`srcs in rule %q is not a list`, r.GetName())
+ }
+ fmt.Fprintln(buffer, " # Sources:")
+ err := e.writeItems(rule, ruleDir, attrib.GetStringListValue(), buffer)
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+ }
+ if attrib.GetName() == "hdrs" {
+ if attrib.GetType() != build.Attribute_LABEL_LIST {
+ return skerr.Fmt(`hdrs in rule %q is not a list`, r.GetName())
+ }
+ fmt.Fprintln(buffer, " # Headers:")
+ err := e.writeItems(rule, ruleDir, attrib.GetStringListValue(), buffer)
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+ }
+ }
+ return nil
+}
+
+// Write the target COMPILE_FLAGS property to the supplied buffer (if there are any copts).
+func (e *CMakeExporter) writeCompileFlags(r *build.Rule, buffer *bytes.Buffer) error {
+ copts, err := getRuleCopts(r)
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+ if len(copts) == 0 {
+ // No error, just nothing to write.
+ return nil
+ }
+ str := strings.Join(copts, " ")
+ cmakeName, err := getRuleSimpleName(r.GetName())
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+ _, err = fmt.Fprintf(buffer, "set_target_properties(%s PROPERTIES COMPILE_FLAGS\n %q\n)\n",
+ cmakeName, str)
+ return err
+}
+
+// Write the target COMPILE_DEFINITIONS property to the supplied buffer (if there are any defines).
+func (e *CMakeExporter) writeCompileDefinitions(r *build.Rule, qr *analysis_v2.CqueryResult, buffer *bytes.Buffer) error {
+ defines, err := getRuleDefines(r, qr)
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+ if len(defines) == 0 {
+ // No error, just nothing to write.
+ return nil
+ }
+ str := strings.Join(defines, ";")
+ cmakeName, err := getRuleSimpleName(r.GetName())
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+ _, err = fmt.Fprintf(buffer, "set_target_properties(%s PROPERTIES COMPILE_DEFINITIONS\n %q\n)\n", cmakeName, str)
+ return err
+}
+
+// Write the target INCLUDE_DIRECTORIES property to the supplied buffer (if there are any).
+func (e *CMakeExporter) writeIncludeDirectories(r *build.Rule, qr *analysis_v2.CqueryResult, buffer *bytes.Buffer) error {
+ includes, err := getRuleIncludes(r, qr)
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+ includes = appendUnique(includes, e.workspaceDir)
+ for i, path := range includes {
+ includes[i] = e.absToWorkspaceRelativePath(path)
+ }
+ str := strings.Join(includes, ";")
+ cmakeName, err := getRuleSimpleName(r.GetName())
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+ _, err = fmt.Fprintf(buffer, "set_target_properties(%s PROPERTIES INCLUDE_DIRECTORIES\n %q\n)\n", cmakeName, str)
+ return err
+}
+
+// Write the target LINK_FLAGS property to the supplied buffer (if there are any linkopts).
+func (e *CMakeExporter) writeLinkFlags(r *build.Rule, buffer *bytes.Buffer) error {
+ defines, err := getRuleStringArrayAttribute(r, "linkopts")
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+ if len(defines) == 0 {
+ // No error, just nothing to write.
+ return nil
+ }
+ str := strings.Join(defines, " ")
+ cmakeName, err := getRuleSimpleName(r.GetName())
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+ _, err = fmt.Fprintf(buffer, "set_target_properties(%s PROPERTIES LINK_FLAGS\n %q\n)\n", cmakeName, str)
+ return err
+}
+
+// Write all target properties to the supplied buffer.
+func (e *CMakeExporter) writeProperties(r *build.Rule, qr *analysis_v2.CqueryResult, buffer *bytes.Buffer) error {
+ err := e.writeCompileFlags(r, buffer)
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+ err = e.writeLinkFlags(r, buffer)
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+ err = e.writeCompileDefinitions(r, qr, buffer)
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+ err = e.writeIncludeDirectories(r, qr, buffer)
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+ return nil
+}
+
+// Convert the filegroup rule to the CMake equivalent.
+func (e *CMakeExporter) convertFilegroupRule(r *build.Rule) error {
+
+ rule := e.workspace.createRule(r)
+
+ var contents bytes.Buffer
+
+ targetName := r.GetName()
+ variableName, err := getRuleSimpleName(r.GetName())
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+ fmt.Fprintf(&contents, "# %s\n", targetName)
+ fmt.Fprintf(&contents, "list(APPEND %s\n", variableName)
+
+ err = e.writeSrcsAndHdrs(rule, &contents, r)
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+ fmt.Fprintln(&contents, ")")
+ rule.setContents(contents.Bytes())
+
+ return nil
+}
+
+// Convert the cc_binary rule to the CMake equivalent.
+func (e *CMakeExporter) convertCCBinaryRule(r *build.Rule, qr *analysis_v2.CqueryResult) error {
+
+ rule := e.workspace.createRule(r)
+
+ targetName := r.GetName()
+ var contents bytes.Buffer
+ fmt.Fprintf(&contents, "# %s\n", targetName)
+ cmakeName, err := getRuleSimpleName(r.GetName())
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+ fmt.Fprintf(&contents, "add_executable(%s \"\")\n", cmakeName)
+ fmt.Fprintf(&contents, "target_sources(%s\n", cmakeName)
+ fmt.Fprintln(&contents, " PRIVATE")
+
+ err = e.writeSrcsAndHdrs(rule, &contents, r)
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+
+ fmt.Fprintln(&contents, ")")
+ err = e.writeProperties(r, qr, &contents)
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+ rule.setContents(contents.Bytes())
+
+ return nil
+}
+
+// Convert the cc_library rule to the CMake equivalent.
+func (e *CMakeExporter) convertCCLibraryRule(r *build.Rule, qr *analysis_v2.CqueryResult) error {
+
+ rule := e.workspace.createRule(r)
+
+ targetName := r.GetName()
+ cmakeName, err := getRuleSimpleName(r.GetName())
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+ var contents bytes.Buffer
+ fmt.Fprintf(&contents, "# %s\n", targetName)
+ fmt.Fprintf(&contents, "add_library(%s \"\")\n", cmakeName)
+ fmt.Fprintf(&contents, "target_sources(%s\n", cmakeName)
+ fmt.Fprintln(&contents, " PRIVATE")
+
+ err = e.writeSrcsAndHdrs(rule, &contents, r)
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+ fmt.Fprintln(&contents, ")")
+ err = e.writeProperties(r, qr, &contents)
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+
+ rule.setContents(contents.Bytes())
+
+ return nil
+}
+
+// Export will convert the input Bazel cquery output, provided by the
+// supplied QueryCommand parameter, to CMake. The equivalent
+// CMake project definition will be written using the supplied writer.
+func (e *CMakeExporter) Export(qcmd interfaces.QueryCommand, writer interfaces.Writer, projName string) error {
+
+ in, err := qcmd.Read()
+ if err != nil {
+ return skerr.Wrapf(err, "error reading Bazel cquery data")
+ }
+ qr := analysis_v2.CqueryResult{}
+ if err := proto.Unmarshal(in, &qr); err != nil {
+ return skerr.Wrapf(err, "failed to unmarshal Bazel cquery result")
+ }
+
+ fmt.Fprintln(writer, "# DO NOT EDIT: This file is auto-generated.")
+ fmt.Fprintln(writer, "cmake_minimum_required(VERSION 3.13)")
+ writer.WriteString("\n")
+ fmt.Fprintf(writer, "project(%s LANGUAGES C CXX)\n", projName)
+ writer.WriteString("\n")
+
+ writePlatformCompileFlags(writer)
+ writer.WriteString("\n")
+
+ for _, result := range qr.GetResults() {
+ t := result.GetTarget()
+ r := t.GetRule()
+ if isExternalRule(r.GetName()) {
+ continue
+ }
+ var err error = nil
+ switch {
+ case r.GetRuleClass() == "cc_binary":
+ err = e.convertCCBinaryRule(r, &qr)
+ case r.GetRuleClass() == "cc_library":
+ err = e.convertCCLibraryRule(r, &qr)
+ case r.GetRuleClass() == "filegroup":
+ err = e.convertFilegroupRule(r)
+ }
+ if err != nil {
+ return skerr.Wrapf(err, "failed to convert %s", r.GetRuleClass())
+ }
+ }
+
+ _, err = e.workspace.write(writer)
+ if err != nil {
+ return skerr.Wrap(err)
+ }
+
+ return nil
+}
+
+// Make sure CMakeExporter fulfills the Exporter interface.
+var _ interfaces.Exporter = (*CMakeExporter)(nil)
diff --git a/chromium/third_party/skia/bazel/exporter/cmake_exporter_test.go b/chromium/third_party/skia/bazel/exporter/cmake_exporter_test.go
new file mode 100644
index 00000000000..9f375cad50a
--- /dev/null
+++ b/chromium/third_party/skia/bazel/exporter/cmake_exporter_test.go
@@ -0,0 +1,263 @@
+// Copyright 2022 Google LLC
+//
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package exporter
+
+import (
+ "bytes"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/mock"
+ "github.com/stretchr/testify/require"
+ "go.skia.org/infra/go/skerr"
+ "go.skia.org/skia/bazel/exporter/build_proto/analysis_v2"
+ "go.skia.org/skia/bazel/exporter/interfaces/mocks"
+ "google.golang.org/protobuf/encoding/prototext"
+ "google.golang.org/protobuf/proto"
+)
+
+const testWorkspaceDir = "/path/to/workspace"
+
+// This input test data (in textproto format) started as output of
+// a bazel cquery call - like:
+//
+// bazel cquery --noimplicit_deps 'kind("rule", deps(//:skia_public))' --output textproto > out.txt
+//
+// and then hand edited to create a small valid query result with specific
+// files, copts, and other cc_library/cc_binary rule attributes.
+const textProto = `results {
+ target {
+ type: RULE
+ rule {
+ name: "//src/libs:sum"
+ rule_class: "cc_library"
+ location: "/path/to/workspace/src/libs/BUILD.bazel:8:11"
+ attribute {
+ name: "copts"
+ type: STRING_LIST
+ string_list_value: "-O2"
+ explicitly_specified: true
+ nodep: false
+ }
+ attribute {
+ name: "defines"
+ type: STRING_LIST
+ string_list_value: "SUMDEF"
+ explicitly_specified: false
+ nodep: false
+ }
+ attribute {
+ name: "includes"
+ type: STRING_LIST
+ string_list_value: "."
+ explicitly_specified: false
+ nodep: false
+ }
+ attribute {
+ name: "linkopts"
+ type: STRING_LIST
+ string_list_value: "-L/library/dir"
+ explicitly_specified: false
+ nodep: false
+ }
+ attribute {
+ name: "name"
+ type: STRING
+ string_value: "sum"
+ explicitly_specified: true
+ nodep: false
+ }
+ attribute {
+ name: "srcs"
+ type: LABEL_LIST
+ string_list_value: "//src/libs:sum.cpp"
+ explicitly_specified: true
+ nodep: false
+ }
+ attribute {
+ name: "hdrs"
+ type: LABEL_LIST
+ string_list_value: "//src/libs:sum.h"
+ explicitly_specified: true
+ nodep: false
+ }
+ attribute {
+ name: "visibility"
+ type: STRING_LIST
+ string_list_value: "//visibility:public"
+ explicitly_specified: true
+ nodep: true
+ }
+ }
+ },
+ }
+ results {
+ target {
+ type: RULE
+ rule {
+ name: "//src/apps:hello"
+ rule_class: "cc_binary"
+ location: "/path/to/workspace/src/apps/BUILD.bazel:8:11"
+ attribute {
+ name: "copts"
+ type: STRING_LIST
+ string_list_value: "-O1"
+ explicitly_specified: true
+ nodep: false
+ }
+ attribute {
+ name: "defines"
+ type: STRING_LIST
+ string_list_value: "APPDEF"
+ explicitly_specified: false
+ nodep: false
+ }
+ attribute {
+ name: "linkopts"
+ type: STRING_LIST
+ string_list_value: "-L/app/dir"
+ explicitly_specified: false
+ nodep: false
+ }
+ attribute {
+ name: "name"
+ type: STRING
+ string_value: "hello"
+ explicitly_specified: true
+ nodep: false
+ }
+ attribute {
+ name: "srcs"
+ type: LABEL_LIST
+ string_list_value: "//src/apps:hello-world.cpp"
+ explicitly_specified: true
+ nodep: false
+ }
+ attribute {
+ name: "deps"
+ type: LABEL_LIST
+ string_list_value: "//src/libs:sum"
+ explicitly_specified: false
+ nodep: false
+ }
+ attribute {
+ name: "visibility"
+ type: STRING_LIST
+ string_list_value: "//visibility:public"
+ explicitly_specified: true
+ nodep: true
+ }
+ }
+ }
+ }`
+
+func TestExport_QueryReadError_ReturnsError(t *testing.T) {
+ e := NewCMakeExporter(testWorkspaceDir)
+ var contents bytes.Buffer
+ qcmd := mocks.NewQueryCommand(t)
+ qcmd.On("Read", mock.Anything).Return([]byte{}, skerr.Fmt("expected error"))
+ err := e.Export(qcmd, &contents, "projName")
+ assert.Error(t, err)
+ assert.Equal(t, 0, contents.Len())
+}
+
+func TestExport_InvalidProtobuf_ReturnsError(t *testing.T) {
+ e := NewCMakeExporter(testWorkspaceDir)
+ var contents bytes.Buffer
+ qcmd := mocks.NewQueryCommand(t)
+ qcmd.On("Read", mock.Anything).Return(make([]byte, 50), skerr.Fmt("empty data"))
+ err := e.Export(qcmd, &contents, "projName")
+ assert.Error(t, err)
+ assert.Equal(t, 0, contents.Len())
+}
+
+func TestExport_ValidProtobuf_Success(t *testing.T) {
+ qr := analysis_v2.CqueryResult{}
+ err := prototext.Unmarshal([]byte(textProto), &qr)
+ require.NoError(t, err)
+ protoData, err := proto.Marshal(&qr)
+ require.NoError(t, err)
+
+ e := NewCMakeExporter(testWorkspaceDir)
+ var contents bytes.Buffer
+ qcmd := mocks.NewQueryCommand(t)
+ qcmd.On("Read", mock.Anything).Return(protoData, nil)
+ err = e.Export(qcmd, &contents, "projName")
+ require.NoError(t, err)
+
+ // This expected CMake output text is created by hand.
+ const expected = `# DO NOT EDIT: This file is auto-generated.
+cmake_minimum_required(VERSION 3.13)
+
+project(projName LANGUAGES C CXX)
+
+set(DEFAULT_COMPILE_FLAGS_MACOS "-std=c++17 -Wno-psabi --target=arm64-apple-macos11")
+set(DEFAULT_COMPILE_FLAGS_LINUX "-std=c++17 -Wno-psabi -Wno-attributes")
+
+if (APPLE)
+ set(DEFAULT_COMPILE_FLAGS "${DEFAULT_COMPILE_FLAGS_MACOS}")
+else()
+ set(DEFAULT_COMPILE_FLAGS "${DEFAULT_COMPILE_FLAGS_LINUX}")
+endif()
+
+
+# //src/libs:sum
+add_library(src_libs_sum "")
+target_sources(src_libs_sum
+ PRIVATE
+ # Sources:
+ "${CMAKE_SOURCE_DIR}/src/libs/sum.cpp"
+ # Headers:
+ "${CMAKE_SOURCE_DIR}/src/libs/sum.h"
+)
+set_target_properties(src_libs_sum PROPERTIES COMPILE_FLAGS
+ "${DEFAULT_COMPILE_FLAGS} -O2"
+)
+set_target_properties(src_libs_sum PROPERTIES LINK_FLAGS
+ "-L/library/dir"
+)
+set_target_properties(src_libs_sum PROPERTIES COMPILE_DEFINITIONS
+ "SUMDEF"
+)
+set_target_properties(src_libs_sum PROPERTIES INCLUDE_DIRECTORIES
+ "${CMAKE_SOURCE_DIR}/src/libs;${CMAKE_SOURCE_DIR}"
+)
+
+# //src/apps:hello
+add_executable(src_apps_hello "")
+target_sources(src_apps_hello
+ PRIVATE
+ # Sources:
+ "${CMAKE_SOURCE_DIR}/src/apps/hello-world.cpp"
+)
+set_target_properties(src_apps_hello PROPERTIES COMPILE_FLAGS
+ "${DEFAULT_COMPILE_FLAGS} -O1"
+)
+set_target_properties(src_apps_hello PROPERTIES LINK_FLAGS
+ "-L/app/dir"
+)
+set_target_properties(src_apps_hello PROPERTIES COMPILE_DEFINITIONS
+ "APPDEF;SUMDEF"
+)
+set_target_properties(src_apps_hello PROPERTIES INCLUDE_DIRECTORIES
+ "${CMAKE_SOURCE_DIR}/src/libs;${CMAKE_SOURCE_DIR}"
+)
+`
+ assert.Equal(t, expected, contents.String())
+}
+
+func TestGetRuleCopts_CoptsExists_Success(t *testing.T) {
+ qr := analysis_v2.CqueryResult{}
+ err := prototext.Unmarshal([]byte(textProto), &qr)
+ require.NoError(t, err)
+
+ r := findRule(&qr, "//src/apps:hello")
+ require.NotNil(t, r)
+
+ copts, err := getRuleCopts(r)
+ require.NoError(t, err)
+ assert.Equal(t, []string{"${DEFAULT_COMPILE_FLAGS}", "-O1"}, copts)
+}
diff --git a/chromium/third_party/skia/bazel/exporter/cmake_rule.go b/chromium/third_party/skia/bazel/exporter/cmake_rule.go
new file mode 100644
index 00000000000..c843a0fee15
--- /dev/null
+++ b/chromium/third_party/skia/bazel/exporter/cmake_rule.go
@@ -0,0 +1,73 @@
+// Copyright 2022 Google LLC
+//
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package exporter
+
+import (
+ "io"
+
+ "go.skia.org/infra/go/skerr"
+ "go.skia.org/infra/go/util"
+ "go.skia.org/skia/bazel/exporter/build_proto/build"
+)
+
+// cmakeRule represents the CMake equivalent to a Bazel rule.
+type cmakeRule struct {
+ contents []byte // Data to be written to CMake file.
+ deps []string // Names of Bazel targets (not files) on which this rule directly depends.
+ rule *build.Rule // Holding pointer because struct contains a Mutex.
+}
+
+// newCMakeRule will create a new CMake rule object.
+func newCMakeRule(r *build.Rule) *cmakeRule {
+ return &cmakeRule{rule: r}
+}
+
+// Return the rule name.
+func (r *cmakeRule) getName() string {
+ return r.rule.GetName()
+}
+
+// Does this rule contain source dependencies?
+func (r *cmakeRule) hasSrcs() bool {
+ srcs, _ := getRuleStringArrayAttribute(r.rule, "srcs")
+ return len(srcs) > 0
+}
+
+// Does this rule depend directly on a rule.
+func (r *cmakeRule) hasDependency(ruleName string) bool {
+ return util.In(ruleName, r.deps)
+}
+
+// Add a rule dependency.
+func (r *cmakeRule) addDependency(ruleName string) error {
+ if ruleName == "" {
+ return skerr.Fmt("empty rule name")
+ }
+ if ruleName == r.getName() {
+ return skerr.Fmt("rule cannot depend on self: %s", ruleName)
+ }
+ if r.hasDependency(ruleName) {
+ return nil
+ }
+ // Trusting that circular dependencies are already fixed by Bazel.
+ r.deps = append(r.deps, ruleName)
+ return nil
+}
+
+// setContents will set the supplied chunk of a CMake project file to this
+// rules contents.
+func (r *cmakeRule) setContents(contents []byte) {
+ r.contents = contents
+}
+
+// Write the contents for this rule using the supplied writer.
+// Returns the number of bytes written and error.
+func (r *cmakeRule) write(writer io.Writer) (int, error) {
+ if len(r.contents) == 0 {
+ return 0, skerr.Fmt("rule %s has no contents", r.getName())
+ }
+ return writer.Write(r.contents)
+}
diff --git a/chromium/third_party/skia/bazel/exporter/cmake_rule_test.go b/chromium/third_party/skia/bazel/exporter/cmake_rule_test.go
new file mode 100644
index 00000000000..085b89aa474
--- /dev/null
+++ b/chromium/third_party/skia/bazel/exporter/cmake_rule_test.go
@@ -0,0 +1,224 @@
+// Copyright 2022 Google LLC
+//
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package exporter
+
+import (
+ "bytes"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+ "go.skia.org/skia/bazel/exporter/build_proto/analysis_v2"
+ "google.golang.org/protobuf/encoding/prototext"
+)
+
+// This input test data (in textproto format) started as output of
+// a bazel cquery call - like:
+//
+// bazel cquery --noimplicit_deps 'kind("rule", deps(//:skia_public))' --output textproto > out.txt
+//
+// and then hand edited to create a small valid query result with specific
+// files, copts, and other cc_library/cc_binary rule attributes.
+const ruleTestTextProto = `results {
+ target {
+ type: RULE
+ rule {
+ name: "//src/libs:sum"
+ rule_class: "cc_library"
+ location: "/path/to/workspace/src/libs/BUILD.bazel:8:11"
+ attribute {
+ name: "copts"
+ type: STRING_LIST
+ string_list_value: "-O2"
+ explicitly_specified: true
+ nodep: false
+ }
+ attribute {
+ name: "defines"
+ type: STRING_LIST
+ string_list_value: "SUMDEF"
+ explicitly_specified: false
+ nodep: false
+ }
+ attribute {
+ name: "includes"
+ type: STRING_LIST
+ string_list_value: "."
+ explicitly_specified: false
+ nodep: false
+ }
+ attribute {
+ name: "linkopts"
+ type: STRING_LIST
+ string_list_value: "-L/library/dir"
+ explicitly_specified: false
+ nodep: false
+ }
+ attribute {
+ name: "name"
+ type: STRING
+ string_value: "sum"
+ explicitly_specified: true
+ nodep: false
+ }
+ attribute {
+ name: "srcs"
+ type: LABEL_LIST
+ string_list_value: "//src/libs:sum.cpp"
+ explicitly_specified: true
+ nodep: false
+ }
+ attribute {
+ name: "hdrs"
+ type: LABEL_LIST
+ string_list_value: "//src/libs:sum.h"
+ explicitly_specified: true
+ nodep: false
+ }
+ attribute {
+ name: "visibility"
+ type: STRING_LIST
+ string_list_value: "//visibility:public"
+ explicitly_specified: true
+ nodep: true
+ }
+ }
+ },
+ }
+ results {
+ target {
+ type: RULE
+ rule {
+ name: "//src/apps:hello"
+ rule_class: "cc_binary"
+ location: "/path/to/workspace/src/apps/BUILD.bazel:8:11"
+ attribute {
+ name: "copts"
+ type: STRING_LIST
+ string_list_value: "-O1"
+ explicitly_specified: true
+ nodep: false
+ }
+ attribute {
+ name: "defines"
+ type: STRING_LIST
+ string_list_value: "APPDEF"
+ explicitly_specified: false
+ nodep: false
+ }
+ attribute {
+ name: "linkopts"
+ type: STRING_LIST
+ string_list_value: "-L/app/dir"
+ explicitly_specified: false
+ nodep: false
+ }
+ attribute {
+ name: "name"
+ type: STRING
+ string_value: "hello"
+ explicitly_specified: true
+ nodep: false
+ }
+ attribute {
+ name: "srcs"
+ type: LABEL_LIST
+ explicitly_specified: true
+ nodep: false
+ }
+ attribute {
+ name: "deps"
+ type: LABEL_LIST
+ string_list_value: "//src/libs:sum"
+ explicitly_specified: false
+ nodep: false
+ }
+ attribute {
+ name: "visibility"
+ type: STRING_LIST
+ string_list_value: "//visibility:public"
+ explicitly_specified: true
+ nodep: true
+ }
+ }
+ }
+ }`
+
+func TestGetName_MatchingValue(t *testing.T) {
+ qr := analysis_v2.CqueryResult{}
+ err := prototext.Unmarshal([]byte(ruleTestTextProto), &qr)
+ require.NoError(t, err)
+
+ r := findRule(&qr, "//src/apps:hello")
+ require.NotNil(t, r)
+ assert.Equal(t, "//src/apps:hello", r.GetName())
+
+ cr := newCMakeRule(r)
+ assert.Equal(t, r.GetName(), cr.getName())
+}
+
+func TestHasSrcs_SourcesExist_ReturnsTrue(t *testing.T) {
+ qr := analysis_v2.CqueryResult{}
+ err := prototext.Unmarshal([]byte(ruleTestTextProto), &qr)
+ require.NoError(t, err)
+
+ r := findRule(&qr, "//src/libs:sum")
+ require.NotNil(t, r)
+ assert.Equal(t, "//src/libs:sum", r.GetName())
+
+ cr := newCMakeRule(r)
+ assert.True(t, cr.hasSrcs())
+}
+
+func TestHasSrcs_NoSources_ReturnsFalse(t *testing.T) {
+ qr := analysis_v2.CqueryResult{}
+ err := prototext.Unmarshal([]byte(ruleTestTextProto), &qr)
+ require.NoError(t, err)
+
+ r := findRule(&qr, "//src/apps:hello")
+ require.NotNil(t, r)
+ assert.Equal(t, "//src/apps:hello", r.GetName())
+
+ cr := newCMakeRule(r)
+ assert.False(t, cr.hasSrcs())
+}
+
+func TestHasDependency_DependencyExist_ReturnsTrue(t *testing.T) {
+ qr := analysis_v2.CqueryResult{}
+ err := prototext.Unmarshal([]byte(ruleTestTextProto), &qr)
+ require.NoError(t, err)
+
+ r := findRule(&qr, "//src/apps:hello")
+ require.NotNil(t, r)
+ assert.Equal(t, "//src/apps:hello", r.GetName())
+
+ cr := newCMakeRule(r)
+ require.NoError(t, cr.addDependency("//dependency/name"))
+ assert.True(t, cr.hasDependency("//dependency/name"))
+}
+
+func TestHasDependency_NoDependency_ReturnsFalse(t *testing.T) {
+ qr := analysis_v2.CqueryResult{}
+ err := prototext.Unmarshal([]byte(ruleTestTextProto), &qr)
+ require.NoError(t, err)
+
+ r := findRule(&qr, "//src/apps:hello")
+ require.NotNil(t, r)
+ assert.Equal(t, "//src/apps:hello", r.GetName())
+
+ cr := newCMakeRule(r)
+ assert.False(t, cr.hasDependency("//dependency/name"))
+}
+
+func TestSetContents_SetContents_WriteSucceeds(t *testing.T) {
+ cr := newCMakeRule(nil)
+ cr.setContents([]byte("Contents Value\n"))
+ var writeBuff bytes.Buffer
+ nb, err := cr.write(&writeBuff)
+ require.NoError(t, err)
+ assert.Equal(t, 15, nb)
+ assert.Equal(t, []byte("Contents Value\n"), writeBuff.Bytes())
+}
diff --git a/chromium/third_party/skia/bazel/exporter/cmake_workspace.go b/chromium/third_party/skia/bazel/exporter/cmake_workspace.go
new file mode 100644
index 00000000000..5e9229ac5d9
--- /dev/null
+++ b/chromium/third_party/skia/bazel/exporter/cmake_workspace.go
@@ -0,0 +1,110 @@
+// Copyright 2022 Google LLC
+//
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package exporter
+
+import (
+ "fmt"
+ "io"
+
+ "go.skia.org/infra/go/skerr"
+ "go.skia.org/infra/go/util"
+ "go.skia.org/skia/bazel/exporter/build_proto/build"
+)
+
+// cmakeWorkspace represents the entire state of a CMake project.
+type cmakeWorkspace struct {
+ // Map Bazel rule names to cmakeRule instances. Holding pointer
+ // values as the rules are mutable.
+ rules map[string]*cmakeRule
+}
+
+// writeState tracks the state of an in-progress write of the workspace.
+type writeState struct {
+ writtenRules []string // All cmakeRule's written during write.
+}
+
+// newCMakeWorkspace will create a new CMake workspace object.
+func newCMakeWorkspace() *cmakeWorkspace {
+ return &cmakeWorkspace{rules: map[string]*cmakeRule{}}
+}
+
+// Determine if a rule has been written.
+func (s *writeState) isRuleWritten(ruleName string) bool {
+ return util.In(ruleName, s.writtenRules)
+}
+
+// setRuleWritten will mark the rule as having been written.
+func (s *writeState) setRuleWritten(ruleName string) {
+ s.writtenRules = append(s.writtenRules, ruleName)
+}
+
+// getRule will return the CMake wrapper for a Bazel rule given the
+// rule name. Will return nil if there is no corresponding rule.
+func (w *cmakeWorkspace) getRule(name string) *cmakeRule {
+ return w.rules[name]
+}
+
+// createRule will create (if necessary) a new CMake rule object
+// for the given rule name.
+func (w *cmakeWorkspace) createRule(rule *build.Rule) *cmakeRule {
+ if r := w.getRule(rule.GetName()); r != nil {
+ return r
+ }
+ r := newCMakeRule(rule)
+ w.rules[rule.GetName()] = r
+ return r
+}
+
+// writeRule will write the given rule to the writer.
+// It will first write all dependent rules so that they appear
+// in the CMake project file before the rule that depends on them.
+func (w *cmakeWorkspace) writeRule(writer io.Writer, r *cmakeRule, state *writeState) (int, error) {
+ nb := 0
+ if !r.hasSrcs() {
+ return 0, nil
+ }
+ // First write all dependencies because CMake does not support forward references.
+ for _, name := range r.deps {
+ dep := w.getRule(name)
+ if dep == nil {
+ return 0, skerr.Fmt(`cannot find rule %q`, name)
+ }
+ n, err := w.writeRule(writer, dep, state)
+ if err != nil {
+ return nb, skerr.Wrap(err)
+ }
+ nb += n
+ }
+ if state.isRuleWritten(r.getName()) {
+ return nb, nil
+ }
+ num, err := fmt.Fprintln(writer)
+ if err != nil {
+ return nb, skerr.Wrap(err)
+ }
+ nb += num
+ num, err = r.write(writer)
+ if err != nil {
+ return nb, skerr.Wrap(err)
+ }
+ state.setRuleWritten(r.getName())
+ nb += num
+ return nb, nil
+}
+
+// Write this workspace using the given writer.
+func (w *cmakeWorkspace) write(writer io.Writer) (int, error) {
+ var state writeState
+ nb := 0
+ for _, r := range w.rules {
+ num, err := w.writeRule(writer, r, &state)
+ if err != nil {
+ return nb, skerr.Wrap(err)
+ }
+ nb += num
+ }
+ return nb, nil
+}
diff --git a/chromium/third_party/skia/bazel/exporter/cmake_workspace_test.go b/chromium/third_party/skia/bazel/exporter/cmake_workspace_test.go
new file mode 100644
index 00000000000..087651855b4
--- /dev/null
+++ b/chromium/third_party/skia/bazel/exporter/cmake_workspace_test.go
@@ -0,0 +1,231 @@
+// Copyright 2022 Google LLC
+//
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package exporter
+
+import (
+ "bytes"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/mock"
+ "github.com/stretchr/testify/require"
+ "go.skia.org/infra/go/skerr"
+ "go.skia.org/skia/bazel/exporter/build_proto/analysis_v2"
+ "go.skia.org/skia/bazel/exporter/interfaces/mocks"
+ "google.golang.org/protobuf/encoding/prototext"
+ "google.golang.org/protobuf/proto"
+)
+
+const workspaceTestWorkspaceDir = "/path/to/workspace"
+
+// This input test data (in textproto format) started as output of
+// a bazel cquery call - like:
+//
+// bazel cquery --noimplicit_deps 'kind("rule", deps(//:skia_public))' --output textproto > out.txt
+//
+// and then hand edited to create a small valid query result with specific
+// files, copts, and other cc_library/cc_binary rule attributes.
+const workspaceTestTextProto = `results {
+ target {
+ type: RULE
+ rule {
+ name: "//src/libs:sum"
+ rule_class: "cc_library"
+ location: "/path/to/workspace/src/libs/BUILD.bazel:8:11"
+ attribute {
+ name: "copts"
+ type: STRING_LIST
+ string_list_value: "-O2"
+ explicitly_specified: true
+ nodep: false
+ }
+ attribute {
+ name: "defines"
+ type: STRING_LIST
+ string_list_value: "SUMDEF"
+ explicitly_specified: false
+ nodep: false
+ }
+ attribute {
+ name: "includes"
+ type: STRING_LIST
+ string_list_value: "."
+ explicitly_specified: false
+ nodep: false
+ }
+ attribute {
+ name: "linkopts"
+ type: STRING_LIST
+ string_list_value: "-L/library/dir"
+ explicitly_specified: false
+ nodep: false
+ }
+ attribute {
+ name: "name"
+ type: STRING
+ string_value: "sum"
+ explicitly_specified: true
+ nodep: false
+ }
+ attribute {
+ name: "srcs"
+ type: LABEL_LIST
+ string_list_value: "//src/libs:sum.cpp"
+ explicitly_specified: true
+ nodep: false
+ }
+ attribute {
+ name: "hdrs"
+ type: LABEL_LIST
+ string_list_value: "//src/libs:sum.h"
+ explicitly_specified: true
+ nodep: false
+ }
+ attribute {
+ name: "visibility"
+ type: STRING_LIST
+ string_list_value: "//visibility:public"
+ explicitly_specified: true
+ nodep: true
+ }
+ }
+ },
+ }
+ results {
+ target {
+ type: RULE
+ rule {
+ name: "//src/apps:hello"
+ rule_class: "cc_binary"
+ location: "/path/to/workspace/src/apps/BUILD.bazel:8:11"
+ attribute {
+ name: "copts"
+ type: STRING_LIST
+ string_list_value: "-O1"
+ explicitly_specified: true
+ nodep: false
+ }
+ attribute {
+ name: "defines"
+ type: STRING_LIST
+ string_list_value: "APPDEF"
+ explicitly_specified: false
+ nodep: false
+ }
+ attribute {
+ name: "linkopts"
+ type: STRING_LIST
+ string_list_value: "-L/app/dir"
+ explicitly_specified: false
+ nodep: false
+ }
+ attribute {
+ name: "name"
+ type: STRING
+ string_value: "hello"
+ explicitly_specified: true
+ nodep: false
+ }
+ attribute {
+ name: "srcs"
+ type: LABEL_LIST
+ string_list_value: "//src/apps:hello-world.cpp"
+ explicitly_specified: true
+ nodep: false
+ }
+ attribute {
+ name: "deps"
+ type: LABEL_LIST
+ string_list_value: "//src/libs:sum"
+ explicitly_specified: false
+ nodep: false
+ }
+ attribute {
+ name: "visibility"
+ type: STRING_LIST
+ string_list_value: "//visibility:public"
+ explicitly_specified: true
+ nodep: true
+ }
+ }
+ }
+ }`
+
+func getTestDataProtoBuf() {
+
+}
+
+// Return the workspace (cmakeWorkspace) for the test data.
+//
+// Note: this helper function makes no test assertions as the
+// Export function is already tested.
+func getTestWorkspace(t *testing.T) (cmakeWorkspace, error) {
+ // Unmarshal the textproto into equivalent Go objects.
+ qr := analysis_v2.CqueryResult{}
+ err := prototext.Unmarshal([]byte(workspaceTestTextProto), &qr)
+ if err != nil {
+ return cmakeWorkspace{}, skerr.Wrap(err)
+ }
+ // Marshal into protobuf.
+ protoData, err := proto.Marshal(&qr)
+ if err != nil {
+ return cmakeWorkspace{}, skerr.Wrap(err)
+ }
+
+ // Export to CMake buffer.
+ e := NewCMakeExporter(workspaceTestWorkspaceDir)
+ var contents bytes.Buffer
+ qcmd := mocks.NewQueryCommand(t)
+ qcmd.On("Read", mock.Anything).Return(protoData, nil)
+ err = e.Export(qcmd, &contents, "projName")
+ if err != nil {
+ return cmakeWorkspace{}, skerr.Wrap(err)
+ }
+
+ return e.workspace, nil
+}
+
+func TestIsGetRule_ValidName_ReturnsRule(t *testing.T) {
+ workspace, err := getTestWorkspace(t)
+ require.NoError(t, err)
+
+ r := workspace.getRule("//src/libs:sum")
+ require.NotNil(t, r)
+ assert.Equal(t, "//src/libs:sum", r.getName())
+}
+
+func TestIsGetRule_InvalidName_ReturnsNil(t *testing.T) {
+ workspace, err := getTestWorkspace(t)
+ require.NoError(t, err)
+
+ r := workspace.getRule("//non/existent:rule")
+ assert.Nil(t, r)
+}
+
+func TestCreateRule_ValidBazelRule_NotNil(t *testing.T) {
+ workspace, err := getTestWorkspace(t)
+ require.NoError(t, err)
+
+ // Get the rule from the existing workspace (since we can't make one)
+ cmakeRule := workspace.getRule("//src/libs:sum")
+ require.NotNil(t, cmakeRule)
+
+ otherWorkspace := newCMakeWorkspace()
+ require.NotNil(t, otherWorkspace)
+ otherCMakeRule := otherWorkspace.createRule(cmakeRule.rule)
+ require.NotNil(t, otherCMakeRule)
+}
+
+func TestIsRuleWritten_NotWritten_ReturnsFalse(t *testing.T) {
+ var state writeState
+ assert.False(t, state.isRuleWritten("//unwritten:rule"))
+}
+
+func TestIsRuleWritten_Written_ReturnsTrue(t *testing.T) {
+ var state writeState
+ state.setRuleWritten("//written:rule")
+ assert.True(t, state.isRuleWritten("//written:rule"))
+}
diff --git a/chromium/third_party/skia/bazel/exporter/interfaces/BUILD.bazel b/chromium/third_party/skia/bazel/exporter/interfaces/BUILD.bazel
new file mode 100644
index 00000000000..c077f033c5b
--- /dev/null
+++ b/chromium/third_party/skia/bazel/exporter/interfaces/BUILD.bazel
@@ -0,0 +1,16 @@
+load("//bazel:macros.bzl", "exports_files_legacy")
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+
+licenses(["notice"])
+
+exports_files_legacy()
+
+go_library(
+ name = "interfaces",
+ srcs = [
+ "exporter.go",
+ "query_command.go",
+ ],
+ importpath = "go.skia.org/skia/bazel/exporter/interfaces",
+ visibility = ["//visibility:public"],
+)
diff --git a/chromium/third_party/skia/bazel/exporter/interfaces/exporter.go b/chromium/third_party/skia/bazel/exporter/interfaces/exporter.go
new file mode 100644
index 00000000000..adca2e6937e
--- /dev/null
+++ b/chromium/third_party/skia/bazel/exporter/interfaces/exporter.go
@@ -0,0 +1,23 @@
+// Copyright 2022 Google LLC
+//
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package interfaces
+
+import "io"
+
+// Writer is an interface that groups io.StringWriter and io.Writer to
+// enable simpler writing of the exported Bazel output text.
+type Writer interface {
+ io.StringWriter
+ io.Writer
+}
+
+// Exporter defines an interface for exporting the Bazel workspace
+// rules to a different project format.
+type Exporter interface {
+ // Export will write the converted Bazel cquery response data to
+ // the supplied writer with the given project name.
+ Export(qcmd QueryCommand, writer Writer, projName string) error
+}
diff --git a/chromium/third_party/skia/bazel/exporter/interfaces/mocks/BUILD.bazel b/chromium/third_party/skia/bazel/exporter/interfaces/mocks/BUILD.bazel
new file mode 100644
index 00000000000..654947c225f
--- /dev/null
+++ b/chromium/third_party/skia/bazel/exporter/interfaces/mocks/BUILD.bazel
@@ -0,0 +1,17 @@
+load("//bazel:macros.bzl", "exports_files_legacy")
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+
+licenses(["notice"])
+
+exports_files_legacy()
+
+go_library(
+ name = "mocks",
+ srcs = [
+ "QueryCommand.go",
+ "generate.go",
+ ],
+ importpath = "go.skia.org/skia/bazel/exporter/interfaces/mocks",
+ visibility = ["//visibility:public"],
+ deps = ["@com_github_stretchr_testify//mock"],
+)
diff --git a/chromium/third_party/skia/bazel/exporter/interfaces/mocks/QueryCommand.go b/chromium/third_party/skia/bazel/exporter/interfaces/mocks/QueryCommand.go
new file mode 100644
index 00000000000..91f3521e814
--- /dev/null
+++ b/chromium/third_party/skia/bazel/exporter/interfaces/mocks/QueryCommand.go
@@ -0,0 +1,46 @@
+// Code generated by mockery v0.0.0-dev. DO NOT EDIT.
+
+package mocks
+
+import (
+ testing "testing"
+
+ mock "github.com/stretchr/testify/mock"
+)
+
+// QueryCommand is an autogenerated mock type for the QueryCommand type
+type QueryCommand struct {
+ mock.Mock
+}
+
+// Read provides a mock function with given fields:
+func (_m *QueryCommand) Read() ([]byte, error) {
+ ret := _m.Called()
+
+ var r0 []byte
+ if rf, ok := ret.Get(0).(func() []byte); ok {
+ r0 = rf()
+ } else {
+ if ret.Get(0) != nil {
+ r0 = ret.Get(0).([]byte)
+ }
+ }
+
+ var r1 error
+ if rf, ok := ret.Get(1).(func() error); ok {
+ r1 = rf()
+ } else {
+ r1 = ret.Error(1)
+ }
+
+ return r0, r1
+}
+
+// NewQueryCommand creates a new instance of QueryCommand. It also registers a cleanup function to assert the mocks expectations.
+func NewQueryCommand(t testing.TB) *QueryCommand {
+ mock := &QueryCommand{}
+
+ t.Cleanup(func() { mock.AssertExpectations(t) })
+
+ return mock
+}
diff --git a/chromium/third_party/skia/bazel/exporter/interfaces/mocks/generate.go b/chromium/third_party/skia/bazel/exporter/interfaces/mocks/generate.go
new file mode 100644
index 00000000000..68764909f35
--- /dev/null
+++ b/chromium/third_party/skia/bazel/exporter/interfaces/mocks/generate.go
@@ -0,0 +1,8 @@
+// Copyright 2022 Google LLC
+//
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package mocks
+
+//go:generate bazelisk run //:mockery -- --name QueryCommand --srcpkg=go.skia.org/skia/bazel/exporter/interfaces --output ${PWD}
diff --git a/chromium/third_party/skia/bazel/exporter/interfaces/query_command.go b/chromium/third_party/skia/bazel/exporter/interfaces/query_command.go
new file mode 100644
index 00000000000..fb79f0e194e
--- /dev/null
+++ b/chromium/third_party/skia/bazel/exporter/interfaces/query_command.go
@@ -0,0 +1,13 @@
+// Copyright 2022 Google LLC
+//
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+package interfaces
+
+// QueryCommand defines an interface for returning the response of a
+// Bazel cquery call.
+type QueryCommand interface {
+ // Read will return the response data for a `bazel cquery ...`
+ // invocation.
+ Read() ([]byte, error)
+}
diff --git a/chromium/third_party/skia/bazel/exporter_tool/BUILD.bazel b/chromium/third_party/skia/bazel/exporter_tool/BUILD.bazel
new file mode 100644
index 00000000000..8f63be23557
--- /dev/null
+++ b/chromium/third_party/skia/bazel/exporter_tool/BUILD.bazel
@@ -0,0 +1,24 @@
+load("//bazel:macros.bzl", "exports_files_legacy")
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
+
+licenses(["notice"])
+
+exports_files_legacy()
+
+go_library(
+ name = "exporter_tool_lib",
+ srcs = ["main.go"],
+ importpath = "go.skia.org/bazel/exporter_tool",
+ visibility = ["//visibility:private"],
+ deps = [
+ "//bazel/exporter",
+ "@org_skia_go_infra//go/common",
+ "@org_skia_go_infra//go/skerr",
+ ],
+)
+
+go_binary(
+ name = "exporter_tool",
+ embed = [":exporter_tool_lib"],
+ visibility = ["//visibility:public"],
+)
diff --git a/chromium/third_party/skia/bazel/exporter_tool/README.md b/chromium/third_party/skia/bazel/exporter_tool/README.md
new file mode 100644
index 00000000000..1b1bbaef726
--- /dev/null
+++ b/chromium/third_party/skia/bazel/exporter_tool/README.md
@@ -0,0 +1,25 @@
+# Bazel Project Exporter
+
+Skia's authoritative build system is moving to Bazel. For users needing to
+use other build system, this tool will export a subset of the Bazel build
+targets to other build systems.
+
+This is not meant for any purpose beyond development.
+
+# Bazel to CMake
+
+At the root level of the Skia workspace:
+
+```sh
+bazel build //bazel/exporter_tool
+bazel-bin/bazel/exporter_tool/exporter_tool_/exporter_tool -proj_name=Skia -rule='//:skia_public'
+```
+
+This will write to a single `CMakeLists.txt` file a valid CMake project with
+targets to build the artifacts covered by the Bazel //:skia_public target
+and all dependent targets.
+
+## Current limitations
+
+* External dependencies are not supported.
+* Only the `//:skia_public` rule is supported. Other rules *may* work. \ No newline at end of file
diff --git a/chromium/third_party/skia/bazel/exporter_tool/main.go b/chromium/third_party/skia/bazel/exporter_tool/main.go
new file mode 100644
index 00000000000..f8ed152809b
--- /dev/null
+++ b/chromium/third_party/skia/bazel/exporter_tool/main.go
@@ -0,0 +1,47 @@
+// Copyright 2022 Google LLC
+//
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package main
+
+import (
+ "flag"
+ "fmt"
+ "os"
+
+ "go.skia.org/infra/go/common"
+ "go.skia.org/skia/bazel/exporter"
+)
+
+func main() {
+ var (
+ myFlags = common.NewMultiStringFlag("rule", nil, "Bazel rule (may be repeated).")
+ cmakeFileName = flag.String("out", "CMakeLists.txt", "CMake output file")
+ projName = flag.String("proj_name", "", "CMake project name")
+ )
+ flag.Parse()
+ if *cmakeFileName == "" || *projName == "" {
+ fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])
+ flag.PrintDefaults()
+ os.Exit(1)
+ }
+ workspaceDir, err := os.Getwd()
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "Error getting pwd: %v", err)
+ os.Exit(2)
+ }
+ qr := exporter.NewBazelQueryCommand(*myFlags, workspaceDir)
+ exporter := exporter.NewCMakeExporter(workspaceDir)
+ cmakeFile, err := os.Create(*cmakeFileName)
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "Error opening %s: %v", *cmakeFileName, err)
+ os.Exit(3)
+ }
+ defer cmakeFile.Close()
+ err = exporter.Export(qr, cmakeFile, *projName)
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "Error exporting to CMake: %v\n", err)
+ os.Exit(4)
+ }
+}
diff --git a/chromium/third_party/skia/bazel/external/README.md b/chromium/third_party/skia/bazel/external/README.md
index 6190c32a8c7..6e2d194d6e0 100644
--- a/chromium/third_party/skia/bazel/external/README.md
+++ b/chromium/third_party/skia/bazel/external/README.md
@@ -1,7 +1,29 @@
-This folder is where we put BUILD.bazel files for external (e.g. third party) dependencies.
+This folder is where we put `BUILD.bazel` files for external (e.g. third party) dependencies.
If a dependency supports Bazel, we should use those rules, but if the dependency does not, we
need to create our own rules in a subdirectory.
-These BUILD.bazel files are used in WORKSPACE.bazel (e.g. new_local_repository or
-new_git_repository). \ No newline at end of file
+We generally compile third_party deps from source. If we do, we clone the repository and use
+the given BUILD.bazel file to build it. This is specified in the `WORKSPACE.bazel` (e.g.
+`new_local_repository` or `new_git_repository`) and we refer to those targets using labels like
+`@freetype`, or `@libpng`.
+
+Some third_party deps we only link against prebuilt versions. For those, we do not involve
+WORKSPACE.bazel and link to them directly, e.g. `//bazel/external/fontconfig`.
+
+Notes
+-----
+
+Avoid strip_include_prefix
+==========================
+[strip_include_prefix](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.strip_include_prefix)
+causes the header path for the library to be added to the compiler include search path with `-I`,
+which means Clang will treat it like a file in Skia proper. This means if those headers have
+issues that Clang's diagnostic warnings catch (e.g. missing `override`), we will see those warnings
+and the build will fail.
+
+Generally, we do not want to have to fix third_party code's warnings, so instead of
+using `strip_include_prefix`, use `includes` instead. This is more ergonomic, as it can let us
+expose header files from multiple locations (e.g. `freetype` has its API in `includes` and the
+customization headers in `builds`) and adds these to the search path with `-isystem`. Clang ignores
+warnings in these "system" headers, which means our warnings will be focused to the Skia code base. \ No newline at end of file
diff --git a/chromium/third_party/skia/bazel/external/dawn/BUILD.bazel b/chromium/third_party/skia/bazel/external/dawn/BUILD.bazel
index 018b4f947f8..d36e4f94c60 100644
--- a/chromium/third_party/skia/bazel/external/dawn/BUILD.bazel
+++ b/chromium/third_party/skia/bazel/external/dawn/BUILD.bazel
@@ -46,7 +46,7 @@ genrule(
"--template-dir $$(dirname $(location generator/templates/api_cpp.h)) " +
"--targets cpp_headers " +
"--output-dir $(RULEDIR)",
- tools = [":dawn_json_generator"],
+ exec_tools = [":dawn_json_generator"],
)
genrule(
@@ -68,7 +68,7 @@ genrule(
"--template-dir $$(dirname $(location generator/templates/api.h)) " +
"--targets headers " +
"--output-dir $(RULEDIR)",
- tools = [":dawn_json_generator"],
+ exec_tools = [":dawn_json_generator"],
)
genrule(
@@ -90,7 +90,7 @@ genrule(
"--template-dir $$(dirname $(location generator/templates/BSD_LICENSE)) " +
"--targets proc " +
"--output-dir $(RULEDIR)",
- tools = [":dawn_json_generator"],
+ exec_tools = [":dawn_json_generator"],
)
genrule(
@@ -110,7 +110,7 @@ genrule(
"--template-dir $$(dirname $(location generator/templates/BSD_LICENSE)) " +
"--targets cpp " +
"--output-dir $(RULEDIR)",
- tools = [":dawn_json_generator"],
+ exec_tools = [":dawn_json_generator"],
)
genrule(
@@ -119,7 +119,6 @@ genrule(
"dawn.json",
"dawn_wire.json",
"generator/templates/BSD_LICENSE",
- "generator/templates/dawn/native/CacheKey.cpp",
"generator/templates/dawn/native/ChainUtils.cpp",
"generator/templates/dawn/native/ChainUtils.h",
"generator/templates/dawn/native/ObjectType.cpp",
@@ -127,6 +126,7 @@ genrule(
"generator/templates/dawn/native/ProcTable.cpp",
"generator/templates/dawn/native/ValidationUtils.cpp",
"generator/templates/dawn/native/ValidationUtils.h",
+ "generator/templates/dawn/native/api_StreamImpl.cpp",
"generator/templates/dawn/native/api_absl_format.cpp",
"generator/templates/dawn/native/api_absl_format.h",
"generator/templates/dawn/native/api_structs.cpp",
@@ -134,7 +134,6 @@ genrule(
"generator/templates/dawn/native/dawn_platform.h",
],
outs = [
- "src/dawn/native/CacheKey_autogen.cpp",
"src/dawn/native/ChainUtils_autogen.cpp",
"src/dawn/native/ChainUtils_autogen.h",
"src/dawn/native/ObjectType_autogen.cpp",
@@ -143,6 +142,7 @@ genrule(
"src/dawn/native/ValidationUtils_autogen.cpp",
"src/dawn/native/ValidationUtils_autogen.h",
"src/dawn/native/dawn_platform_autogen.h",
+ "src/dawn/native/webgpu_StreamImpl_autogen.cpp",
"src/dawn/native/webgpu_absl_format_autogen.cpp",
"src/dawn/native/webgpu_absl_format_autogen.h",
"src/dawn/native/wgpu_structs_autogen.cpp",
@@ -154,7 +154,7 @@ genrule(
"--template-dir $$(dirname $(location generator/templates/BSD_LICENSE)) " +
"--targets native_utils " +
"--output-dir $(RULEDIR)",
- tools = [":dawn_json_generator"],
+ exec_tools = [":dawn_json_generator"],
)
py_binary(
@@ -174,7 +174,7 @@ py_binary(
genrule(
name = "generate_gpuinfo",
srcs = [
- "gpu_info.json",
+ "src/dawn/gpu_info.json",
"generator/templates/BSD_LICENSE",
"generator/templates/dawn/common/GPUInfo.h",
"generator/templates/dawn/common/GPUInfo.cpp",
@@ -184,10 +184,10 @@ genrule(
"src/dawn/common/GPUInfo_autogen.cpp",
],
cmd = "$(location :dawn_gpu_info_generator) " +
- "--gpu-info-json $(location gpu_info.json) " +
+ "--gpu-info-json $(location src/dawn/gpu_info.json) " +
"--template-dir $$(dirname $(location generator/templates/BSD_LICENSE)) " +
"--output-dir $(RULEDIR)",
- tools = [":dawn_gpu_info_generator"],
+ exec_tools = [":dawn_gpu_info_generator"],
)
py_binary(
@@ -221,8 +221,8 @@ genrule(
cmd = "$(location :dawn_version_generator) " +
"--template-dir $$(dirname $(location generator/templates/BSD_LICENSE)) " +
"--dawn-dir $$(dirname $(location generator/templates/BSD_LICENSE)) " +
- "--output-dir $(RULEDIR)",
- tools = [":dawn_version_generator"],
+ "--output-dir $(RULEDIR) 2> /dev/null",
+ exec_tools = [":dawn_version_generator"],
)
DAWN_HDRS = [
@@ -256,6 +256,8 @@ DAWN_SRCS = [
"src/dawn/native/DawnNative.cpp",
"src/dawn/native/Adapter.cpp",
"src/dawn/native/Adapter.h",
+ "src/dawn/native/ApplyClearColorValueWithDrawHelper.cpp",
+ "src/dawn/native/ApplyClearColorValueWithDrawHelper.h",
"src/dawn/native/AsyncTask.cpp",
"src/dawn/native/AsyncTask.h",
"src/dawn/native/AttachmentState.cpp",
@@ -279,6 +281,11 @@ DAWN_SRCS = [
"src/dawn/native/BuddyMemoryAllocator.h",
"src/dawn/native/Buffer.cpp",
"src/dawn/native/Buffer.h",
+ "src/dawn/native/CacheKey.cpp",
+ "src/dawn/native/CacheKey.h",
+ "src/dawn/native/CacheRequest.cpp",
+ "src/dawn/native/CacheRequest.h",
+ "src/dawn/native/CacheResult.h",
"src/dawn/native/CachedObject.cpp",
"src/dawn/native/CachedObject.h",
"src/dawn/native/CallbackTaskManager.cpp",
@@ -295,8 +302,6 @@ DAWN_SRCS = [
"src/dawn/native/CommandValidation.h",
"src/dawn/native/Commands.cpp",
"src/dawn/native/Commands.h",
- "src/dawn/native/CacheKey.cpp",
- "src/dawn/native/CacheKey.h",
"src/dawn/native/CompilationMessages.cpp",
"src/dawn/native/CompilationMessages.h",
"src/dawn/native/ComputePassEncoder.cpp",
@@ -345,8 +350,8 @@ DAWN_SRCS = [
"src/dawn/native/ObjectBase.h",
"src/dawn/native/ObjectContentHasher.cpp",
"src/dawn/native/ObjectContentHasher.h",
- "src/dawn/native/PassResourceUsage.h",
"src/dawn/native/PassResourceUsage.cpp",
+ "src/dawn/native/PassResourceUsage.h",
"src/dawn/native/PassResourceUsageTracker.cpp",
"src/dawn/native/PassResourceUsageTracker.h",
"src/dawn/native/PerStage.cpp",
@@ -393,6 +398,7 @@ DAWN_SRCS = [
"src/dawn/native/ShaderModule.h",
"src/dawn/native/StagingBuffer.cpp",
"src/dawn/native/StagingBuffer.h",
+ "src/dawn/native/StreamImplTint.cpp",
"src/dawn/native/Subresource.cpp",
"src/dawn/native/Subresource.h",
"src/dawn/native/SubresourceStorage.h",
@@ -407,15 +413,24 @@ DAWN_SRCS = [
"src/dawn/native/ToBackend.h",
"src/dawn/native/Toggles.cpp",
"src/dawn/native/Toggles.h",
+ "src/dawn/native/UsageValidationMode.h",
"src/dawn/native/VertexFormat.cpp",
"src/dawn/native/VertexFormat.h",
+ "src/dawn/native/VisitableMembers.h",
"src/dawn/native/dawn_platform.h",
+ "src/dawn/native/stream/BlobSource.cpp",
+ "src/dawn/native/stream/BlobSource.h",
+ "src/dawn/native/stream/ByteVectorSink.cpp",
+ "src/dawn/native/stream/ByteVectorSink.h",
+ "src/dawn/native/stream/Sink.h",
+ "src/dawn/native/stream/Source.h",
+ "src/dawn/native/stream/Stream.cpp",
+ "src/dawn/native/stream/Stream.h",
"src/dawn/native/utils/WGPUHelpers.cpp",
"src/dawn/native/utils/WGPUHelpers.h",
"src/dawn/native/webgpu_absl_format.cpp",
"src/dawn/native/webgpu_absl_format.h",
# From dawn/src/dawn/native/BUILD.gn:utils_gen
- "src/dawn/native/CacheKey_autogen.cpp",
"src/dawn/native/ChainUtils_autogen.cpp",
"src/dawn/native/ChainUtils_autogen.h",
"src/dawn/native/ObjectType_autogen.cpp",
@@ -423,9 +438,10 @@ DAWN_SRCS = [
"src/dawn/native/ProcTable.cpp",
"src/dawn/native/ValidationUtils_autogen.cpp",
"src/dawn/native/ValidationUtils_autogen.h",
+ "src/dawn/native/dawn_platform_autogen.h",
+ "src/dawn/native/webgpu_StreamImpl_autogen.cpp",
"src/dawn/native/webgpu_absl_format_autogen.cpp",
"src/dawn/native/webgpu_absl_format_autogen.h",
- "src/dawn/native/dawn_platform_autogen.h",
"src/dawn/native/wgpu_structs_autogen.cpp",
"src/dawn/native/wgpu_structs_autogen.h",
# From dawn/src/dawn/common/BUILD.gn:common
@@ -506,8 +522,7 @@ DAWN_VULKAN_SRCS = [
"src/dawn/native/vulkan/BindGroupVk.h",
"src/dawn/native/vulkan/BufferVk.cpp",
"src/dawn/native/vulkan/BufferVk.h",
- "src/dawn/native/vulkan/CacheKeyVk.cpp",
- "src/dawn/native/vulkan/CacheKeyVk.h",
+ "src/dawn/native/vulkan/StreamImplVk.cpp",
"src/dawn/native/vulkan/CommandBufferVk.cpp",
"src/dawn/native/vulkan/CommandBufferVk.h",
"src/dawn/native/vulkan/CommandRecordingContext.h",
@@ -584,7 +599,7 @@ cc_library(
# List this as a copt, so as not to propagate it to dependents
# Skia has its own vulkan headers and we do not want these to
# interfere/override those.
- "-isystem external/vulkan_headers/include",
+ "-Iexternal/vulkan_headers/include",
],
defines = DAWN_VULKAN_DEFINES,
includes = [
@@ -648,6 +663,7 @@ TINT_HDRS = [
]
TINT_SRCS = [
+ "include/tint/override_id.h",
# From dawn/src/tint/BUILD.gn:libtint_core_all_src
"src/tint/ast/access.cc",
"src/tint/ast/access.h",
@@ -676,16 +692,18 @@ TINT_SRCS = [
"src/tint/ast/bool_literal_expression.h",
"src/tint/ast/break_statement.cc",
"src/tint/ast/break_statement.h",
- "src/tint/ast/builtin.cc",
- "src/tint/ast/builtin.h",
"src/tint/ast/builtin_attribute.cc",
"src/tint/ast/builtin_attribute.h",
+ "src/tint/ast/builtin_value.cc",
+ "src/tint/ast/builtin_value.h",
"src/tint/ast/call_expression.cc",
"src/tint/ast/call_expression.h",
"src/tint/ast/call_statement.cc",
"src/tint/ast/call_statement.h",
"src/tint/ast/case_statement.cc",
"src/tint/ast/case_statement.h",
+ "src/tint/ast/const.cc",
+ "src/tint/ast/const.h",
"src/tint/ast/compound_assignment_statement.cc",
"src/tint/ast/compound_assignment_statement.h",
"src/tint/ast/continue_statement.cc",
@@ -740,6 +758,8 @@ TINT_SRCS = [
"src/tint/ast/interpolate_attribute.h",
"src/tint/ast/invariant_attribute.cc",
"src/tint/ast/invariant_attribute.h",
+ "src/tint/ast/let.cc",
+ "src/tint/ast/let.h",
"src/tint/ast/literal_expression.cc",
"src/tint/ast/literal_expression.h",
"src/tint/ast/location_attribute.cc",
@@ -756,6 +776,11 @@ TINT_SRCS = [
"src/tint/ast/multisampled_texture.h",
"src/tint/ast/node.cc",
"src/tint/ast/node.h",
+ "src/tint/ast/node_id.h",
+ "src/tint/ast/override.cc",
+ "src/tint/ast/override.h",
+ "src/tint/ast/parameter.cc",
+ "src/tint/ast/parameter.h",
"src/tint/ast/phony_expression.cc",
"src/tint/ast/phony_expression.h",
"src/tint/ast/pipeline_stage.cc",
@@ -772,6 +797,8 @@ TINT_SRCS = [
"src/tint/ast/stage_attribute.h",
"src/tint/ast/statement.cc",
"src/tint/ast/statement.h",
+ "src/tint/ast/static_assert.cc",
+ "src/tint/ast/static_assert.h",
"src/tint/ast/storage_class.cc",
"src/tint/ast/storage_class.h",
"src/tint/ast/storage_texture.cc",
@@ -790,6 +817,8 @@ TINT_SRCS = [
"src/tint/ast/struct_member_size_attribute.h",
"src/tint/ast/switch_statement.cc",
"src/tint/ast/switch_statement.h",
+ "src/tint/ast/texel_format.cc",
+ "src/tint/ast/texel_format.h",
"src/tint/ast/texture.cc",
"src/tint/ast/texture.h",
"src/tint/ast/traverse_expressions.h",
@@ -806,12 +835,16 @@ TINT_SRCS = [
"src/tint/ast/unary_op_expression.h",
"src/tint/ast/variable.cc",
"src/tint/ast/variable.h",
+ "src/tint/ast/var.cc",
+ "src/tint/ast/var.h",
"src/tint/ast/variable_decl_statement.cc",
"src/tint/ast/variable_decl_statement.h",
"src/tint/ast/vector.cc",
"src/tint/ast/vector.h",
"src/tint/ast/void.cc",
"src/tint/ast/void.h",
+ "src/tint/ast/while_statement.cc",
+ "src/tint/ast/while_statement.h",
"src/tint/ast/workgroup_attribute.cc",
"src/tint/ast/workgroup_attribute.h",
"src/tint/castable.cc",
@@ -857,7 +890,6 @@ TINT_SRCS = [
"src/tint/resolver/intrinsic_table.inl",
"src/tint/resolver/resolver.cc",
"src/tint/resolver/resolver.h",
- "src/tint/resolver/resolver_constants.cc",
"src/tint/resolver/sem_helper.cc",
"src/tint/resolver/sem_helper.h",
"src/tint/resolver/uniformity.cc",
@@ -918,8 +950,8 @@ TINT_SRCS = [
"src/tint/transform/multiplanar_external_texture.h",
"src/tint/transform/num_workgroups_from_uniform.cc",
"src/tint/transform/num_workgroups_from_uniform.h",
- "src/tint/transform/promote_initializers_to_const_var.cc",
- "src/tint/transform/promote_initializers_to_const_var.h",
+ "src/tint/transform/promote_initializers_to_let.cc",
+ "src/tint/transform/promote_initializers_to_let.h",
"src/tint/transform/promote_side_effects_to_decl.cc",
"src/tint/transform/promote_side_effects_to_decl.h",
"src/tint/transform/remove_phonies.cc",
@@ -934,6 +966,10 @@ TINT_SRCS = [
"src/tint/transform/simplify_pointers.h",
"src/tint/transform/single_entry_point.cc",
"src/tint/transform/single_entry_point.h",
+ "src/tint/transform/substitute_override.cc",
+ "src/tint/transform/substitute_override.h",
+ "src/tint/transform/spirv_atomic.cc",
+ "src/tint/transform/spirv_atomic.h",
"src/tint/transform/transform.cc",
"src/tint/transform/transform.h",
"src/tint/transform/unshadow.cc",
@@ -950,11 +986,12 @@ TINT_SRCS = [
"src/tint/transform/vectorize_scalar_matrix_constructors.h",
"src/tint/transform/vertex_pulling.cc",
"src/tint/transform/vertex_pulling.h",
- "src/tint/transform/wrap_arrays_in_structs.cc",
- "src/tint/transform/wrap_arrays_in_structs.h",
+ "src/tint/transform/while_to_loop.cc",
+ "src/tint/transform/while_to_loop.h",
"src/tint/transform/zero_init_workgroup_memory.cc",
"src/tint/transform/zero_init_workgroup_memory.h",
"src/tint/utils/bitcast.h",
+ "src/tint/utils/bitset.h",
"src/tint/utils/block_allocator.h",
"src/tint/utils/concat.h",
"src/tint/utils/compiler_macros.h",
@@ -964,16 +1001,18 @@ TINT_SRCS = [
"src/tint/utils/defer.h",
"src/tint/utils/enum_set.h",
"src/tint/utils/hash.h",
+ "src/tint/utils/hashmap.h",
+ "src/tint/utils/hashset.h",
"src/tint/utils/map.h",
"src/tint/utils/math.h",
"src/tint/utils/reverse.h",
"src/tint/utils/result.h",
"src/tint/utils/scoped_assignment.h",
"src/tint/utils/string.h",
- "src/tint/utils/to_const_ptr_vec.h",
"src/tint/utils/transform.h",
"src/tint/utils/unique_allocator.h",
"src/tint/utils/unique_vector.h",
+ "src/tint/utils/vector.h",
"src/tint/writer/append_vector.cc",
"src/tint/writer/append_vector.h",
"src/tint/writer/array_length_from_uniform_options.cc",
@@ -1022,6 +1061,7 @@ TINT_SRCS = [
"src/tint/sem/depth_multisampled_texture.h",
"src/tint/sem/depth_texture.cc",
"src/tint/sem/depth_texture.h",
+ "src/tint/sem/evaluation_stage.h",
"src/tint/sem/expression.cc",
"src/tint/sem/expression.h",
"src/tint/sem/external_texture.cc",
@@ -1038,6 +1078,8 @@ TINT_SRCS = [
"src/tint/sem/i32.h",
"src/tint/sem/if_statement.cc",
"src/tint/sem/if_statement.h",
+ "src/tint/sem/index_accessor_expression.cc",
+ "src/tint/sem/index_accessor_expression.h",
"src/tint/sem/info.cc",
"src/tint/sem/info.h",
"src/tint/sem/loop_statement.cc",
@@ -1093,6 +1135,8 @@ TINT_SRCS = [
"src/tint/sem/vector.h",
"src/tint/sem/void.cc",
"src/tint/sem/void.h",
+ "src/tint/sem/while_statement.cc",
+ "src/tint/sem/while_statement.h",
# Dawn sets the following tint GN variables
# tint_build_spv_reader = true
# tint_build_spv_writer = true
diff --git a/chromium/third_party/skia/bazel/external/dng_sdk/BUILD.bazel b/chromium/third_party/skia/bazel/external/dng_sdk/BUILD.bazel
index 614a2555142..3c160062141 100644
--- a/chromium/third_party/skia/bazel/external/dng_sdk/BUILD.bazel
+++ b/chromium/third_party/skia/bazel/external/dng_sdk/BUILD.bazel
@@ -164,6 +164,7 @@ cc_library(
],
"//conditions:default": [],
}),
+ includes = ["source"],
local_defines = [
"qDNGReportErrors=0",
"qDNGThreadSafe=1",
@@ -173,7 +174,6 @@ cc_library(
"qDNGValidateTarget=1",
"UNIX_ENV=1",
],
- strip_include_prefix = "source/",
visibility = ["//visibility:public"],
deps = [
"@libjpeg_turbo",
diff --git a/chromium/third_party/skia/bazel/external/expat/BUILD.bazel b/chromium/third_party/skia/bazel/external/expat/BUILD.bazel
new file mode 100644
index 00000000000..8fb32ea128f
--- /dev/null
+++ b/chromium/third_party/skia/bazel/external/expat/BUILD.bazel
@@ -0,0 +1,67 @@
+# This file will be copied into //third_party/externals/libjpeg-turbo via the new_local_repository
+# rule in WORKSPACE.bazel, so all files should be relative to that path.
+
+genrule(
+ name = "create_expat_config_file",
+ srcs = [],
+ outs = ["include/expat_config.h"],
+ cmd = """cat > $@ << 'EOF'
+#define HAVE_INTTYPES_H 1
+#define HAVE_MEMORY_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRING_H 1
+#define STDC_HEADERS 1
+#define XML_CONTEXT_BYTES 1024
+#define XML_DTD 1
+#define XML_NS 1
+EOF""",
+)
+
+EXPAT_HDRS = [
+ "expat/lib/expat.h",
+]
+
+EXPAT_SRCS = [
+ "expat/lib/ascii.h",
+ "expat/lib/asciitab.h",
+ "expat/lib/expat.h",
+ "expat/lib/expat_external.h",
+ "expat/lib/iasciitab.h",
+ "expat/lib/internal.h",
+ "expat/lib/latin1tab.h",
+ "expat/lib/nametab.h",
+ "expat/lib/siphash.h",
+ "expat/lib/utf8tab.h",
+ "expat/lib/winconfig.h",
+ "expat/lib/xmlparse.c",
+ "expat/lib/xmlrole.c",
+ "expat/lib/xmlrole.h",
+ "expat/lib/xmltok.c",
+ "expat/lib/xmltok.h",
+ "expat/lib/xmltok_impl.h",
+ # Our generated configuration file
+ "include/expat_config.h",
+]
+
+TEXTUAL_HDRS = [
+ "expat/lib/xmltok_impl.c",
+ "expat/lib/xmltok_ns.c",
+]
+
+cc_library(
+ name = "expat",
+ srcs = EXPAT_SRCS,
+ hdrs = EXPAT_HDRS,
+ defines = [
+ "HAVE_MEMMOVE",
+ "XML_DEV_URANDOM",
+ "XML_STATIC",
+ ],
+ includes = [
+ "expat/lib",
+ "include",
+ ],
+ textual_hdrs = TEXTUAL_HDRS,
+ visibility = ["//visibility:public"],
+)
diff --git a/chromium/third_party/skia/bazel/external/fontconfig/BUILD.bazel b/chromium/third_party/skia/bazel/external/fontconfig/BUILD.bazel
new file mode 100644
index 00000000000..d9fa336b9d1
--- /dev/null
+++ b/chromium/third_party/skia/bazel/external/fontconfig/BUILD.bazel
@@ -0,0 +1,10 @@
+# We currently do not build fontconfig from source, but dynamically link against a precompiled
+# version. This precompiled version is downloaded as part of the hermetic toolchain.
+#
+# Instead of inlining this linkopts setting, we have this as its own rule so we can link
+# against a different target when rolling into G3.
+cc_library(
+ name = "fontconfig",
+ linkopts = ["-lfontconfig"],
+ visibility = ["//:__subpackages__"],
+)
diff --git a/chromium/third_party/skia/bazel/external/freetype/BUILD.bazel b/chromium/third_party/skia/bazel/external/freetype/BUILD.bazel
new file mode 100644
index 00000000000..8fcc46e4264
--- /dev/null
+++ b/chromium/third_party/skia/bazel/external/freetype/BUILD.bazel
@@ -0,0 +1,446 @@
+# This file will be copied into //third_party/externals/freetype via the new_local_repository
+# rule in WORKSPACE.bazel, so all files should be relative to that path.
+
+# We define this here because the emscripten toolchain calls the cpu wasm, whereas the
+# bazelbuild/platforms call it wasm32. https://github.com/emscripten-core/emsdk/issues/919
+config_setting(
+ name = "cpu_wasm",
+ values = {
+ "cpu": "wasm",
+ },
+)
+
+FREETYPE_PUBLIC_DEFINES = [
+ "FT_CONFIG_OPTION_SVG",
+ # FT_CONFIG_OPTION_USE_BROTLI TODO(kjlubick)
+ "SK_FREETYPE_MINIMUM_RUNTIME_VERSION=(((FREETYPE_MAJOR)<<24)|((FREETYPE_MINOR)<<16)|((FREETYPE_PATCH)<<8))",
+] + select(
+ {
+ ":cpu_wasm": [
+ # Use a trimmed down set of options to reduce code size.
+ "FT_CONFIG_MODULES_H=<skia/no-type1/ftmodule.h>",
+ "FT_CONFIG_OPTIONS_H=<skia/no-type1/ftoption.h>",
+ ],
+ "//conditions:default": [
+ "FT_CONFIG_MODULES_H=<skia/android/ftmodule.h>",
+ "FT_CONFIG_OPTIONS_H=<skia/android/ftoption.h>",
+ ],
+ },
+)
+
+FREETYPE_LOCAL_DEFINES = ["FT2_BUILD_LIBRARY"]
+
+# Copy our freetype include files from the config subfolder so they can be more
+# easily accessed by how we set FT_CONFIG_MODULES_H. Because these files don't exist in
+# the original Freetype checkout, we have to put them in a separate workspace (we cannot
+# refer to them from the Skia workspace or that would be a circular dependency).
+genrule(
+ name = "copy_android_freetype_config",
+ srcs = [
+ "@freetype_config//:android/ftmodule.h",
+ "@freetype_config//:android/ftoption.h",
+ ],
+ outs = [
+ "builds/skia/android/ftmodule.h",
+ "builds/skia/android/ftoption.h",
+ ],
+ # SRCS is a space seperated list of files.
+ # RULEDIR is the directory containing this BUILD.bazel file (the root of the freetype directory)
+ # but only in the "genfiles tree", which does not persist after compilation.
+ cmd = "cp $(SRCS) $(RULEDIR)/builds/skia/android/",
+)
+
+# It is easiest to have multiple copy rules, one per output directory.
+genrule(
+ name = "copy_no_type1_freetype_config",
+ srcs = [
+ "@freetype_config//:no-type1/ftmodule.h",
+ "@freetype_config//:no-type1/ftoption.h",
+ ],
+ outs = [
+ "builds/skia/no-type1/ftmodule.h",
+ "builds/skia/no-type1/ftoption.h",
+ ],
+ # SRCS is a space seperated list of files.
+ # RULEDIR is the directory containing this BUILD.bazel file (the root of the freetype directory)
+ # but only in the "genfiles tree", which does not persist after compilation.
+ cmd = "cp $(SRCS) $(RULEDIR)/builds/skia/no-type1/",
+)
+
+cc_library(
+ name = "freetype",
+ srcs = [
+ "include/freetype/internal/autohint.h",
+ "include/freetype/internal/cffotypes.h",
+ "include/freetype/internal/cfftypes.h",
+ "include/freetype/internal/compiler-macros.h",
+ "include/freetype/internal/ftcalc.h",
+ "include/freetype/internal/ftdebug.h",
+ "include/freetype/internal/ftdrv.h",
+ "include/freetype/internal/ftgloadr.h",
+ "include/freetype/internal/fthash.h",
+ "include/freetype/internal/ftmemory.h",
+ "include/freetype/internal/ftmmtypes.h",
+ "include/freetype/internal/ftobjs.h",
+ "include/freetype/internal/ftpsprop.h",
+ "include/freetype/internal/ftrfork.h",
+ "include/freetype/internal/ftserv.h",
+ "include/freetype/internal/ftstream.h",
+ "include/freetype/internal/fttrace.h",
+ "include/freetype/internal/ftvalid.h",
+ "include/freetype/internal/psaux.h",
+ "include/freetype/internal/pshints.h",
+ "include/freetype/internal/services/svbdf.h",
+ "include/freetype/internal/services/svcfftl.h",
+ "include/freetype/internal/services/svcid.h",
+ "include/freetype/internal/services/svfntfmt.h",
+ "include/freetype/internal/services/svgldict.h",
+ "include/freetype/internal/services/svgxval.h",
+ "include/freetype/internal/services/svkern.h",
+ "include/freetype/internal/services/svmetric.h",
+ "include/freetype/internal/services/svmm.h",
+ "include/freetype/internal/services/svotval.h",
+ "include/freetype/internal/services/svpfr.h",
+ "include/freetype/internal/services/svpostnm.h",
+ "include/freetype/internal/services/svprop.h",
+ "include/freetype/internal/services/svpscmap.h",
+ "include/freetype/internal/services/svpsinfo.h",
+ "include/freetype/internal/services/svsfnt.h",
+ "include/freetype/internal/services/svttcmap.h",
+ "include/freetype/internal/services/svtteng.h",
+ "include/freetype/internal/services/svttglyf.h",
+ "include/freetype/internal/services/svwinfnt.h",
+ "include/freetype/internal/sfnt.h",
+ "include/freetype/internal/svginterface.h",
+ "include/freetype/internal/t1types.h",
+ "include/freetype/internal/tttypes.h",
+ "include/freetype/internal/wofftypes.h",
+ "include/freetype/otsvg.h",
+ "include/freetype/t1tables.h",
+ "include/freetype/ttnameid.h",
+ "include/freetype/tttables.h",
+ "include/freetype/tttags.h",
+ "src/autofit/afblue.h",
+ "src/autofit/afcjk.h",
+ "src/autofit/afcover.h",
+ "src/autofit/afdummy.h",
+ "src/autofit/aferrors.h",
+ "src/autofit/afglobal.h",
+ "src/autofit/afhints.h",
+ "src/autofit/afindic.h",
+ "src/autofit/aflatin.h",
+ "src/autofit/afloader.h",
+ "src/autofit/afmodule.h",
+ "src/autofit/afranges.h",
+ "src/autofit/afscript.h",
+ "src/autofit/afshaper.h",
+ "src/autofit/afstyles.h",
+ "src/autofit/aftypes.h",
+ "src/autofit/afws-decl.h",
+ "src/autofit/afws-iter.h",
+ "src/autofit/autofit.c",
+ "src/base/ftbase.c",
+ "src/base/ftbase.h",
+ "src/base/ftbbox.c",
+ "src/base/ftbitmap.c",
+ "src/base/ftdebug.c",
+ "src/base/ftfstype.c",
+ "src/base/ftgasp.c",
+ "src/base/ftglyph.c",
+ "src/base/ftinit.c",
+ "src/base/ftmm.c",
+ "src/base/ftpatent.c",
+ "src/base/ftstroke.c",
+ "src/base/ftsynth.c",
+ "src/base/ftsystem.c",
+ "src/base/fttype1.c",
+ "src/base/ftwinfnt.c",
+ "src/base/md5.h",
+ "src/cff/cff.c",
+ "src/cff/cffcmap.h",
+ "src/cff/cffdrivr.h",
+ "src/cff/cfferrs.h",
+ "src/cff/cffgload.h",
+ "src/cff/cffload.h",
+ "src/cff/cffobjs.h",
+ "src/cff/cffparse.h",
+ "src/cff/cfftoken.h",
+ "src/cid/ciderrs.h",
+ "src/cid/cidgload.h",
+ "src/cid/cidload.h",
+ "src/cid/cidobjs.h",
+ "src/cid/cidparse.h",
+ "src/cid/cidriver.h",
+ "src/cid/cidtoken.h",
+ "src/cid/type1cid.c",
+ "src/gzip/crc32.h",
+ "src/gzip/ftgzip.c",
+ "src/gzip/ftzconf.h",
+ "src/gzip/inffast.h",
+ "src/gzip/inffixed.h",
+ "src/gzip/inflate.h",
+ "src/gzip/inftrees.h",
+ "src/gzip/zlib.h",
+ "src/gzip/zutil.h",
+ "src/psaux/afmparse.h",
+ "src/psaux/cffdecode.h",
+ "src/psaux/psarrst.h",
+ "src/psaux/psaux.c",
+ "src/psaux/psauxerr.h",
+ "src/psaux/psauxmod.h",
+ "src/psaux/psblues.h",
+ "src/psaux/psconv.h",
+ "src/psaux/pserror.h",
+ "src/psaux/psfixed.h",
+ "src/psaux/psfont.h",
+ "src/psaux/psft.h",
+ "src/psaux/psglue.h",
+ "src/psaux/pshints.h",
+ "src/psaux/psintrp.h",
+ "src/psaux/psobjs.h",
+ "src/psaux/psread.h",
+ "src/psaux/psstack.h",
+ "src/psaux/pstypes.h",
+ "src/psaux/t1cmap.h",
+ "src/psaux/t1decode.h",
+ "src/pshinter/pshalgo.h",
+ "src/pshinter/pshglob.h",
+ "src/pshinter/pshinter.c",
+ "src/pshinter/pshmod.h",
+ "src/pshinter/pshnterr.h",
+ "src/pshinter/pshrec.h",
+ "src/psnames/psmodule.h",
+ "src/psnames/psnamerr.h",
+ "src/psnames/psnames.c",
+ "src/psnames/pstables.h",
+ "src/raster/ftmisc.h",
+ "src/raster/ftraster.h",
+ "src/raster/ftrend1.h",
+ "src/raster/raster.c",
+ "src/raster/rasterrs.h",
+ "src/sfnt/pngshim.h",
+ "src/sfnt/sfdriver.h",
+ "src/sfnt/sferrors.h",
+ "src/sfnt/sfnt.c",
+ "src/sfnt/sfobjs.h",
+ "src/sfnt/sfwoff.h",
+ "src/sfnt/sfwoff2.h",
+ "src/sfnt/ttbdf.h",
+ "src/sfnt/ttcmap.h",
+ "src/sfnt/ttcmapc.h",
+ "src/sfnt/ttcolr.h",
+ "src/sfnt/ttcpal.h",
+ "src/sfnt/ttkern.h",
+ "src/sfnt/ttload.h",
+ "src/sfnt/ttmtx.h",
+ "src/sfnt/ttpost.h",
+ "src/sfnt/ttsbit.h",
+ "src/sfnt/woff2tags.h",
+ "src/smooth/ftgrays.h",
+ "src/smooth/ftsmerrs.h",
+ "src/smooth/ftsmooth.h",
+ "src/smooth/smooth.c",
+ "src/svg/ftsvg.h",
+ "src/svg/svg.c",
+ "src/svg/svgtypes.h",
+ "src/truetype/truetype.c",
+ "src/truetype/ttdriver.h",
+ "src/truetype/tterrors.h",
+ "src/truetype/ttgload.h",
+ "src/truetype/ttgxvar.h",
+ "src/truetype/ttinterp.h",
+ "src/truetype/ttobjs.h",
+ "src/truetype/ttpload.h",
+ "src/truetype/ttsubpix.h",
+ "src/type1/t1afm.h",
+ "src/type1/t1driver.h",
+ "src/type1/t1errors.h",
+ "src/type1/t1gload.h",
+ "src/type1/t1load.h",
+ "src/type1/t1objs.h",
+ "src/type1/t1parse.h",
+ "src/type1/t1tokens.h",
+ "src/type1/type1.c",
+ ],
+ hdrs = [
+ "include/freetype/config/ftconfig.h",
+ "include/freetype/config/ftheader.h",
+ "include/freetype/config/ftmodule.h",
+ "include/freetype/config/ftoption.h",
+ "include/freetype/config/ftstdlib.h",
+ "include/freetype/config/integer-types.h",
+ "include/freetype/config/mac-support.h",
+ "include/freetype/config/public-macros.h",
+ "include/freetype/freetype.h",
+ "include/freetype/ftadvanc.h",
+ "include/freetype/ftbbox.h",
+ "include/freetype/ftbdf.h",
+ "include/freetype/ftbitmap.h",
+ "include/freetype/ftbzip2.h",
+ "include/freetype/ftcache.h",
+ "include/freetype/ftchapters.h",
+ "include/freetype/ftcid.h",
+ "include/freetype/ftcolor.h",
+ "include/freetype/ftdriver.h",
+ "include/freetype/fterrdef.h",
+ "include/freetype/fterrors.h",
+ "include/freetype/ftfntfmt.h",
+ "include/freetype/ftgasp.h",
+ "include/freetype/ftglyph.h",
+ "include/freetype/ftgxval.h",
+ "include/freetype/ftgzip.h",
+ "include/freetype/ftimage.h",
+ "include/freetype/ftincrem.h",
+ "include/freetype/ftlcdfil.h",
+ "include/freetype/ftlist.h",
+ "include/freetype/ftlogging.h",
+ "include/freetype/ftlzw.h",
+ "include/freetype/ftmac.h",
+ "include/freetype/ftmm.h",
+ "include/freetype/ftmodapi.h",
+ "include/freetype/ftmoderr.h",
+ "include/freetype/ftotval.h",
+ "include/freetype/ftoutln.h",
+ "include/freetype/ftparams.h",
+ "include/freetype/ftpfr.h",
+ "include/freetype/ftrender.h",
+ "include/freetype/ftsizes.h",
+ "include/freetype/ftsnames.h",
+ "include/freetype/ftstroke.h",
+ "include/freetype/ftsynth.h",
+ "include/freetype/ftsystem.h",
+ "include/freetype/fttrigon.h",
+ "include/freetype/fttypes.h",
+ "include/freetype/ftwinfnt.h",
+ "include/freetype/otsvg.h",
+ "include/freetype/t1tables.h",
+ "include/freetype/ttnameid.h",
+ "include/freetype/tttables.h",
+ "include/freetype/tttags.h",
+ "include/ft2build.h",
+ # These are copied in by some genrules
+ "builds/skia/android/ftmodule.h",
+ "builds/skia/android/ftoption.h",
+ "builds/skia/no-type1/ftmodule.h",
+ "builds/skia/no-type1/ftoption.h",
+ ],
+ copts = [
+ "-Wno-unused-function",
+ ],
+ defines = FREETYPE_PUBLIC_DEFINES,
+ includes = [
+ "builds",
+ "include",
+ ],
+ local_defines = FREETYPE_LOCAL_DEFINES,
+ # Freetype includes a lot of .c files. We need to make those available for inclusion explicitly.
+ textual_hdrs = [
+ "src/autofit/afblue.c",
+ "src/autofit/afcjk.c",
+ "src/autofit/afdummy.c",
+ "src/autofit/afglobal.c",
+ "src/autofit/afhints.c",
+ "src/autofit/afindic.c",
+ "src/autofit/aflatin.c",
+ "src/autofit/afloader.c",
+ "src/autofit/afmodule.c",
+ "src/autofit/afranges.c",
+ "src/autofit/afshaper.c",
+ "src/base/ftadvanc.c",
+ "src/base/ftbase.c",
+ "src/base/ftcalc.c",
+ "src/base/ftcolor.c",
+ "src/base/ftdbgmem.c",
+ "src/base/fterrors.c",
+ "src/base/ftfntfmt.c",
+ "src/base/ftgloadr.c",
+ "src/base/fthash.c",
+ "src/base/ftlcdfil.c",
+ "src/base/ftmac.c",
+ "src/base/ftobjs.c",
+ "src/base/ftoutln.c",
+ "src/base/ftpsprop.c",
+ "src/base/ftrfork.c",
+ "src/base/ftsnames.c",
+ "src/base/ftstream.c",
+ "src/base/fttrigon.c",
+ "src/base/ftutil.c",
+ "src/cff/cffcmap.c",
+ "src/cff/cffdrivr.c",
+ "src/cff/cffgload.c",
+ "src/cff/cffload.c",
+ "src/cff/cffobjs.c",
+ "src/cff/cffparse.c",
+ "src/cid/cidgload.c",
+ "src/cid/cidload.c",
+ "src/cid/cidobjs.c",
+ "src/cid/cidparse.c",
+ "src/cid/cidriver.c",
+ "src/gzip/adler32.c",
+ "src/gzip/crc32.c",
+ "src/gzip/inffast.c",
+ "src/gzip/inflate.c",
+ "src/gzip/inftrees.c",
+ "src/gzip/zutil.c",
+ "src/psaux/afmparse.c",
+ "src/psaux/cffdecode.c",
+ "src/psaux/psarrst.c",
+ "src/psaux/psauxmod.c",
+ "src/psaux/psblues.c",
+ "src/psaux/psconv.c",
+ "src/psaux/pserror.c",
+ "src/psaux/psfont.c",
+ "src/psaux/psft.c",
+ "src/psaux/pshints.c",
+ "src/psaux/psintrp.c",
+ "src/psaux/psobjs.c",
+ "src/psaux/psread.c",
+ "src/psaux/psstack.c",
+ "src/psaux/t1cmap.c",
+ "src/psaux/t1decode.c",
+ "src/pshinter/pshalgo.c",
+ "src/pshinter/pshglob.c",
+ "src/pshinter/pshmod.c",
+ "src/pshinter/pshrec.c",
+ "src/psnames/psmodule.c",
+ "src/raster/ftraster.c",
+ "src/raster/ftrend1.c",
+ "src/sfnt/pngshim.c",
+ "src/sfnt/sfdriver.c",
+ "src/sfnt/sfobjs.c",
+ "src/sfnt/sfwoff.c",
+ "src/sfnt/sfwoff2.c",
+ "src/sfnt/ttbdf.c",
+ "src/sfnt/ttcmap.c",
+ "src/sfnt/ttcolr.c",
+ "src/sfnt/ttcpal.c",
+ "src/sfnt/ttkern.c",
+ "src/sfnt/ttload.c",
+ "src/sfnt/ttmtx.c",
+ "src/sfnt/ttpost.c",
+ "src/sfnt/ttsbit.c",
+ "src/sfnt/ttsvg.c",
+ "src/sfnt/ttsvg.h",
+ "src/sfnt/woff2tags.c",
+ "src/smooth/ftgrays.c",
+ "src/smooth/ftsmooth.c",
+ "src/svg/ftsvg.c",
+ "src/truetype/ttdriver.c",
+ "src/truetype/ttgload.c",
+ "src/truetype/ttgxvar.c",
+ "src/truetype/ttinterp.c",
+ "src/truetype/ttobjs.c",
+ "src/truetype/ttpload.c",
+ "src/truetype/ttsubpix.c",
+ "src/type1/t1afm.c",
+ "src/type1/t1driver.c",
+ "src/type1/t1gload.c",
+ "src/type1/t1load.c",
+ "src/type1/t1objs.c",
+ "src/type1/t1parse.c",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [
+ "@libpng", # TODO(kjlubick) add brotli option
+ ],
+)
diff --git a/chromium/third_party/skia/bazel/external/freetype/config/BUILD.bazel b/chromium/third_party/skia/bazel/external/freetype/config/BUILD.bazel
new file mode 100644
index 00000000000..74445df45ea
--- /dev/null
+++ b/chromium/third_party/skia/bazel/external/freetype/config/BUILD.bazel
@@ -0,0 +1,9 @@
+exports_files(
+ [
+ "android/ftmodule.h",
+ "android/ftoption.h",
+ "no-type1/ftmodule.h",
+ "no-type1/ftoption.h",
+ ],
+ visibility = ["//visibility:public"],
+)
diff --git a/chromium/third_party/skia/bazel/external/freetype/config/README.md b/chromium/third_party/skia/bazel/external/freetype/config/README.md
new file mode 100644
index 00000000000..7e6310826a4
--- /dev/null
+++ b/chromium/third_party/skia/bazel/external/freetype/config/README.md
@@ -0,0 +1,3 @@
+These files represent configurations of how we build Freetype.
+
+The folders here are symlinked from //third_party/freetype2/include
diff --git a/chromium/third_party/skia/bazel/external/freetype/config/WORKSPACE.bazel b/chromium/third_party/skia/bazel/external/freetype/config/WORKSPACE.bazel
new file mode 100644
index 00000000000..dc95d9b5bcd
--- /dev/null
+++ b/chromium/third_party/skia/bazel/external/freetype/config/WORKSPACE.bazel
@@ -0,0 +1,3 @@
+# This blank WORKSPACE.bazel simply indicates that this folder is a distinct Bazel workspace
+# from the main Skia one. This avoids a circular dependency by having Skia depend on freetype
+# and freetype trying to use configuration files from Skia.
diff --git a/chromium/third_party/skia/bazel/external/harfbuzz/BUILD.bazel b/chromium/third_party/skia/bazel/external/harfbuzz/BUILD.bazel
new file mode 100644
index 00000000000..fb0ff6c5515
--- /dev/null
+++ b/chromium/third_party/skia/bazel/external/harfbuzz/BUILD.bazel
@@ -0,0 +1,338 @@
+# This file will be copied into //third_party/externals/harfbuzz via the new_local_repository
+# rule in WORKSPACE.bazel, so all files should be relative to that path.
+
+genrule(
+ name = "copy_config_override",
+ srcs = [
+ "@harfbuzz_config//:config-override.h",
+ ],
+ outs = [
+ # Putting this in the root of the harfbuzz directory makes it easiest to include.
+ "config-override.h",
+ ],
+ # $< is the one and only input file.
+ # $@ is the one and only output location.
+ cmd = "cp $< $@",
+)
+
+HARFBUZZ_HDRS = [
+ "src/hb-aat-layout.h",
+ "src/hb-blob.h",
+ "src/hb-buffer.h",
+ "src/hb-common.h",
+ "src/hb-deprecated.h",
+ "src/hb-face.h",
+ "src/hb-font.h",
+ "src/hb-map.h",
+ "src/hb-ot-font.h",
+ "src/hb-ot-layout.h",
+ "src/hb-ot-math.h",
+ "src/hb-ot-metrics.h",
+ "src/hb-ot-shape.h",
+ "src/hb-ot-var.h",
+ "src/hb-ot.h",
+ "src/hb-set.h",
+ "src/hb-shape-plan.h",
+ "src/hb-shape.h",
+ "src/hb-style.h",
+ "src/hb-subset.h",
+ "src/hb-unicode.h",
+ "src/hb-version.h",
+ "src/hb.h",
+]
+
+HARFBUZZ_SRCS = [
+ "config-override.h",
+ "src/OT/Layout/Common/Coverage.hh",
+ "src/OT/Layout/Common/CoverageFormat1.hh",
+ "src/OT/Layout/Common/CoverageFormat2.hh",
+ "src/OT/Layout/Common/RangeRecord.hh",
+ "src/OT/Layout/GPOS/Anchor.hh",
+ "src/OT/Layout/GPOS/AnchorFormat1.hh",
+ "src/OT/Layout/GPOS/AnchorFormat2.hh",
+ "src/OT/Layout/GPOS/AnchorFormat3.hh",
+ "src/OT/Layout/GPOS/AnchorMatrix.hh",
+ "src/OT/Layout/GPOS/ChainContextPos.hh",
+ "src/OT/Layout/GPOS/Common.hh",
+ "src/OT/Layout/GPOS/ContextPos.hh",
+ "src/OT/Layout/GPOS/CursivePos.hh",
+ "src/OT/Layout/GPOS/CursivePosFormat1.hh",
+ "src/OT/Layout/GPOS/ExtensionPos.hh",
+ "src/OT/Layout/GPOS/GPOS.hh",
+ "src/OT/Layout/GPOS/LigatureArray.hh",
+ "src/OT/Layout/GPOS/MarkArray.hh",
+ "src/OT/Layout/GPOS/MarkBasePos.hh",
+ "src/OT/Layout/GPOS/MarkBasePosFormat1.hh",
+ "src/OT/Layout/GPOS/MarkLigPos.hh",
+ "src/OT/Layout/GPOS/MarkLigPosFormat1.hh",
+ "src/OT/Layout/GPOS/MarkMarkPos.hh",
+ "src/OT/Layout/GPOS/MarkMarkPosFormat1.hh",
+ "src/OT/Layout/GPOS/MarkRecord.hh",
+ "src/OT/Layout/GPOS/PairPos.hh",
+ "src/OT/Layout/GPOS/PairPosFormat1.hh",
+ "src/OT/Layout/GPOS/PairPosFormat2.hh",
+ "src/OT/Layout/GPOS/PairSet.hh",
+ "src/OT/Layout/GPOS/PairValueRecord.hh",
+ "src/OT/Layout/GPOS/PosLookup.hh",
+ "src/OT/Layout/GPOS/PosLookupSubTable.hh",
+ "src/OT/Layout/GPOS/SinglePos.hh",
+ "src/OT/Layout/GPOS/SinglePosFormat1.hh",
+ "src/OT/Layout/GPOS/SinglePosFormat2.hh",
+ "src/OT/Layout/GPOS/ValueFormat.hh",
+ "src/OT/Layout/GSUB/AlternateSet.hh",
+ "src/OT/Layout/GSUB/AlternateSubst.hh",
+ "src/OT/Layout/GSUB/AlternateSubstFormat1.hh",
+ "src/OT/Layout/GSUB/ChainContextSubst.hh",
+ "src/OT/Layout/GSUB/Common.hh",
+ "src/OT/Layout/GSUB/ContextSubst.hh",
+ "src/OT/Layout/GSUB/ExtensionSubst.hh",
+ "src/OT/Layout/GSUB/GSUB.hh",
+ "src/OT/Layout/GSUB/Ligature.hh",
+ "src/OT/Layout/GSUB/LigatureSet.hh",
+ "src/OT/Layout/GSUB/LigatureSubst.hh",
+ "src/OT/Layout/GSUB/LigatureSubstFormat1.hh",
+ "src/OT/Layout/GSUB/MultipleSubst.hh",
+ "src/OT/Layout/GSUB/MultipleSubstFormat1.hh",
+ "src/OT/Layout/GSUB/ReverseChainSingleSubst.hh",
+ "src/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh",
+ "src/OT/Layout/GSUB/Sequence.hh",
+ "src/OT/Layout/GSUB/SingleSubst.hh",
+ "src/OT/Layout/GSUB/SingleSubstFormat1.hh",
+ "src/OT/Layout/GSUB/SingleSubstFormat2.hh",
+ "src/OT/Layout/GSUB/SubstLookup.hh",
+ "src/OT/Layout/GSUB/SubstLookupSubTable.hh",
+ "src/OT/Layout/types.hh",
+ "src/OT/glyf/CompositeGlyph.hh",
+ "src/OT/glyf/Glyph.hh",
+ "src/OT/glyf/GlyphHeader.hh",
+ "src/OT/glyf/SimpleGlyph.hh",
+ "src/OT/glyf/SubsetGlyph.hh",
+ "src/OT/glyf/glyf-helpers.hh",
+ "src/OT/glyf/glyf.hh",
+ "src/OT/glyf/loca.hh",
+ "src/OT/glyf/path-builder.hh",
+ "src/graph/coverage-graph.hh",
+ "src/graph/graph.hh",
+ "src/graph/gsubgpos-context.cc",
+ "src/graph/gsubgpos-context.hh",
+ "src/graph/gsubgpos-graph.hh",
+ "src/graph/pairpos-graph.hh",
+ "src/graph/serialize.hh",
+ "src/hb-aat-layout-ankr-table.hh",
+ "src/hb-aat-layout-bsln-table.hh",
+ "src/hb-aat-layout-common.hh",
+ "src/hb-aat-layout-feat-table.hh",
+ "src/hb-aat-layout-just-table.hh",
+ "src/hb-aat-layout-kerx-table.hh",
+ "src/hb-aat-layout-morx-table.hh",
+ "src/hb-aat-layout-opbd-table.hh",
+ "src/hb-aat-layout-trak-table.hh",
+ "src/hb-aat-layout.cc",
+ "src/hb-aat-layout.hh",
+ "src/hb-aat-ltag-table.hh",
+ "src/hb-aat-map.cc",
+ "src/hb-aat-map.hh",
+ "src/hb-aat.h",
+ "src/hb-algs.hh",
+ "src/hb-array.hh",
+ "src/hb-atomic.hh",
+ "src/hb-bimap.hh",
+ "src/hb-bit-page.hh",
+ "src/hb-bit-set-invertible.hh",
+ "src/hb-bit-set.hh",
+ "src/hb-blob.cc",
+ "src/hb-blob.hh",
+ "src/hb-buffer-deserialize-json.hh",
+ "src/hb-buffer-deserialize-text.hh",
+ "src/hb-buffer-serialize.cc",
+ "src/hb-buffer-verify.cc",
+ "src/hb-buffer.cc",
+ "src/hb-buffer.hh",
+ "src/hb-cache.hh",
+ "src/hb-cff-interp-common.hh",
+ "src/hb-cff-interp-cs-common.hh",
+ "src/hb-cff-interp-dict-common.hh",
+ "src/hb-cff1-interp-cs.hh",
+ "src/hb-cff2-interp-cs.hh",
+ "src/hb-common.cc",
+ "src/hb-config.hh",
+ "src/hb-cplusplus.hh",
+ "src/hb-debug.hh",
+ "src/hb-dispatch.hh",
+ "src/hb-draw.cc",
+ "src/hb-draw.h",
+ "src/hb-draw.hh",
+ "src/hb-face.cc",
+ "src/hb-face.hh",
+ "src/hb-font.cc",
+ "src/hb-font.hh",
+ "src/hb-iter.hh",
+ "src/hb-kern.hh",
+ "src/hb-machinery.hh",
+ "src/hb-map.cc",
+ "src/hb-map.hh",
+ "src/hb-meta.hh",
+ "src/hb-ms-feature-ranges.hh",
+ "src/hb-mutex.hh",
+ "src/hb-null.hh",
+ "src/hb-number-parser.hh",
+ "src/hb-number.cc",
+ "src/hb-number.hh",
+ "src/hb-object.hh",
+ "src/hb-open-file.hh",
+ "src/hb-open-type.hh",
+ "src/hb-ot-cff-common.hh",
+ "src/hb-ot-cff1-std-str.hh",
+ "src/hb-ot-cff1-table.cc",
+ "src/hb-ot-cff1-table.hh",
+ "src/hb-ot-cff2-table.cc",
+ "src/hb-ot-cff2-table.hh",
+ "src/hb-ot-cmap-table.hh",
+ "src/hb-ot-color-cbdt-table.hh",
+ "src/hb-ot-color-colr-table.hh",
+ "src/hb-ot-color-colrv1-closure.hh",
+ "src/hb-ot-color-cpal-table.hh",
+ "src/hb-ot-color-sbix-table.hh",
+ "src/hb-ot-color-svg-table.hh",
+ "src/hb-ot-color.cc",
+ "src/hb-ot-color.h",
+ "src/hb-ot-deprecated.h",
+ "src/hb-ot-face-table-list.hh",
+ "src/hb-ot-face.cc",
+ "src/hb-ot-face.hh",
+ "src/hb-ot-font.cc",
+ "src/hb-ot-gasp-table.hh",
+ "src/hb-ot-glyf-table.hh",
+ "src/hb-ot-hdmx-table.hh",
+ "src/hb-ot-head-table.hh",
+ "src/hb-ot-hhea-table.hh",
+ "src/hb-ot-hmtx-table.hh",
+ "src/hb-ot-kern-table.hh",
+ "src/hb-ot-layout-base-table.hh",
+ "src/hb-ot-layout-common.hh",
+ "src/hb-ot-layout-gdef-table.hh",
+ "src/hb-ot-layout-gpos-table.hh",
+ "src/hb-ot-layout-gsub-table.hh",
+ "src/hb-ot-layout-gsubgpos.hh",
+ "src/hb-ot-layout-jstf-table.hh",
+ "src/hb-ot-layout.cc",
+ "src/hb-ot-layout.hh",
+ "src/hb-ot-map.cc",
+ "src/hb-ot-map.hh",
+ "src/hb-ot-math-table.hh",
+ "src/hb-ot-math.cc",
+ "src/hb-ot-maxp-table.hh",
+ "src/hb-ot-meta-table.hh",
+ "src/hb-ot-meta.cc",
+ "src/hb-ot-meta.h",
+ "src/hb-ot-metrics.cc",
+ "src/hb-ot-metrics.hh",
+ "src/hb-ot-name-language-static.hh",
+ "src/hb-ot-name-language.hh",
+ "src/hb-ot-name-table.hh",
+ "src/hb-ot-name.cc",
+ "src/hb-ot-name.h",
+ "src/hb-ot-os2-table.hh",
+ "src/hb-ot-os2-unicode-ranges.hh",
+ "src/hb-ot-post-macroman.hh",
+ "src/hb-ot-post-table-v2subset.hh",
+ "src/hb-ot-post-table.hh",
+ "src/hb-ot-shape-fallback.cc",
+ "src/hb-ot-shape-fallback.hh",
+ "src/hb-ot-shape-normalize.cc",
+ "src/hb-ot-shape-normalize.hh",
+ "src/hb-ot-shape.cc",
+ "src/hb-ot-shape.hh",
+ "src/hb-ot-shaper-arabic-fallback.hh",
+ "src/hb-ot-shaper-arabic-joining-list.hh",
+ "src/hb-ot-shaper-arabic-pua.hh",
+ "src/hb-ot-shaper-arabic-table.hh",
+ "src/hb-ot-shaper-arabic.cc",
+ "src/hb-ot-shaper-arabic.hh",
+ "src/hb-ot-shaper-default.cc",
+ "src/hb-ot-shaper-hangul.cc",
+ "src/hb-ot-shaper-hebrew.cc",
+ "src/hb-ot-shaper-indic-machine.hh",
+ "src/hb-ot-shaper-indic-table.cc",
+ "src/hb-ot-shaper-indic.cc",
+ "src/hb-ot-shaper-indic.hh",
+ "src/hb-ot-shaper-khmer-machine.hh",
+ "src/hb-ot-shaper-khmer.cc",
+ "src/hb-ot-shaper-myanmar-machine.hh",
+ "src/hb-ot-shaper-myanmar.cc",
+ "src/hb-ot-shaper-syllabic.cc",
+ "src/hb-ot-shaper-syllabic.hh",
+ "src/hb-ot-shaper-thai.cc",
+ "src/hb-ot-shaper-use-machine.hh",
+ "src/hb-ot-shaper-use-table.hh",
+ "src/hb-ot-shaper-use.cc",
+ "src/hb-ot-shaper-vowel-constraints.cc",
+ "src/hb-ot-shaper-vowel-constraints.hh",
+ "src/hb-ot-shaper.hh",
+ "src/hb-ot-stat-table.hh",
+ "src/hb-ot-tag-table.hh",
+ "src/hb-ot-tag.cc",
+ "src/hb-ot-var-avar-table.hh",
+ "src/hb-ot-var-common.hh",
+ "src/hb-ot-var-fvar-table.hh",
+ "src/hb-ot-var-gvar-table.hh",
+ "src/hb-ot-var-hvar-table.hh",
+ "src/hb-ot-var-mvar-table.hh",
+ "src/hb-ot-var.cc",
+ "src/hb-ot-vorg-table.hh",
+ "src/hb-pool.hh",
+ "src/hb-priority-queue.hh",
+ "src/hb-repacker.hh",
+ "src/hb-sanitize.hh",
+ "src/hb-serialize.hh",
+ "src/hb-set-digest.hh",
+ "src/hb-set.cc",
+ "src/hb-set.hh",
+ "src/hb-shape-plan.cc",
+ "src/hb-shape-plan.hh",
+ "src/hb-shape.cc",
+ "src/hb-shaper-impl.hh",
+ "src/hb-shaper-list.hh",
+ "src/hb-shaper.cc",
+ "src/hb-shaper.hh",
+ "src/hb-static.cc",
+ "src/hb-string-array.hh",
+ "src/hb-subset-cff-common.cc",
+ "src/hb-subset-cff-common.hh",
+ "src/hb-subset-cff1.cc",
+ "src/hb-subset-cff1.hh",
+ "src/hb-subset-cff2.cc",
+ "src/hb-subset-cff2.hh",
+ "src/hb-subset-input.cc",
+ "src/hb-subset-input.hh",
+ "src/hb-subset-plan.cc",
+ "src/hb-subset-plan.hh",
+ "src/hb-subset-repacker.cc",
+ "src/hb-subset-repacker.h",
+ "src/hb-subset.cc",
+ "src/hb-subset.hh",
+ "src/hb-ucd-table.hh",
+ "src/hb-ucd.cc",
+ "src/hb-unicode-emoji-table.hh",
+ "src/hb-unicode.cc",
+ "src/hb-unicode.hh",
+ "src/hb-utf.hh",
+ "src/hb-vector.hh",
+ "src/hb.hh",
+]
+
+cc_library(
+ name = "harfbuzz",
+ srcs = HARFBUZZ_SRCS,
+ hdrs = HARFBUZZ_HDRS,
+ defines = [
+ "HAVE_OT",
+ "HAVE_CONFIG_OVERRIDE_H",
+ "HB_NO_FALLBACK_SHAPE",
+ "HB_NO_WIN1256",
+ ],
+ includes = [
+ "src",
+ ],
+ visibility = ["//visibility:public"],
+)
diff --git a/chromium/third_party/skia/bazel/external/harfbuzz/config/BUILD.bazel b/chromium/third_party/skia/bazel/external/harfbuzz/config/BUILD.bazel
new file mode 100644
index 00000000000..0e31feb9754
--- /dev/null
+++ b/chromium/third_party/skia/bazel/external/harfbuzz/config/BUILD.bazel
@@ -0,0 +1,6 @@
+exports_files(
+ [
+ "config-override.h",
+ ],
+ visibility = ["//visibility:public"],
+)
diff --git a/chromium/third_party/skia/bazel/external/harfbuzz/config/README.md b/chromium/third_party/skia/bazel/external/harfbuzz/config/README.md
new file mode 100644
index 00000000000..20510370985
--- /dev/null
+++ b/chromium/third_party/skia/bazel/external/harfbuzz/config/README.md
@@ -0,0 +1,3 @@
+This file represents the custom configuration of how we build Harfbuzz.
+
+The files here are symlinked from //third_party/harfbuzz
diff --git a/chromium/third_party/skia/bazel/external/harfbuzz/config/WORKSPACE.bazel b/chromium/third_party/skia/bazel/external/harfbuzz/config/WORKSPACE.bazel
new file mode 100644
index 00000000000..90e47f8c2af
--- /dev/null
+++ b/chromium/third_party/skia/bazel/external/harfbuzz/config/WORKSPACE.bazel
@@ -0,0 +1,3 @@
+# This blank WORKSPACE.bazel simply indicates that this folder is a distinct Bazel workspace
+# from the main Skia one. This avoids a circular dependency by having Skia depend on harfbuzz
+# and harfbuzz trying to use configuration files from Skia.
diff --git a/chromium/third_party/skia/bazel/external/harfbuzz/config/config-override.h b/chromium/third_party/skia/bazel/external/harfbuzz/config/config-override.h
new file mode 120000
index 00000000000..a4e8334c030
--- /dev/null
+++ b/chromium/third_party/skia/bazel/external/harfbuzz/config/config-override.h
@@ -0,0 +1 @@
+../../../../third_party/harfbuzz/config-override.h \ No newline at end of file
diff --git a/chromium/third_party/skia/bazel/external/icu/BUILD.bazel b/chromium/third_party/skia/bazel/external/icu/BUILD.bazel
new file mode 100644
index 00000000000..d8c24fee92b
--- /dev/null
+++ b/chromium/third_party/skia/bazel/external/icu/BUILD.bazel
@@ -0,0 +1,1052 @@
+# This file will be copied into //third_party/externals/icu via the new_local_repository
+# rule in WORKSPACE.bazel, so all files should be relative to that path.
+
+# We define this here because the emscripten toolchain calls the cpu wasm, whereas the
+# bazelbuild/platforms call it wasm32. https://github.com/emscripten-core/emsdk/issues/919
+config_setting(
+ name = "cpu_wasm",
+ values = {
+ "cpu": "wasm",
+ },
+)
+
+py_binary(
+ name = "make_data_assembly",
+ srcs = ["scripts/make_data_assembly.py"],
+)
+
+py_binary(
+ name = "make_data_cpp",
+ srcs = ["@icu_utils//:icu/make_data_cpp.py"],
+)
+
+_icu_version_major_num = "69" # defined in source/common/unicode/uvernum.h
+
+genrule(
+ name = "create_icu_wasm_data_cpp",
+ # For WASM, we use a super stripped down version, the same as what flutter uses.
+ srcs = ["flutter/icudtl.dat"],
+ outs = ["generated_icu_wasm_dat.cpp"],
+ cmd = "$(location :make_data_cpp) " +
+ "icudt" + _icu_version_major_num + "_dat " +
+ # We need to specify the absolute path from the root
+ "$(location flutter/icudtl.dat) " +
+ # $@ is replaced with the one and only out location, located in //bazel-out.
+ "$@",
+ exec_tools = [":make_data_cpp"],
+)
+
+# We need to make a separate genrule per input because cmd cannot be based on a select()
+genrule(
+ name = "create_icu_common_data_asm",
+ srcs = ["common/icudtl.dat"],
+ outs = ["generated_icu_common_dat.S"],
+ cmd = "$(location :make_data_assembly) " +
+ # We need to specify the absolute path from the root
+ "$(location common/icudtl.dat) " +
+ # $@ is replaced with the one and only out location, located in //bazel-out.
+ "$@",
+ exec_tools = [":make_data_assembly"],
+)
+
+genrule(
+ name = "create_icu_android_data_asm",
+ srcs = ["android/icudtl.dat"],
+ outs = ["generated_icu_android_dat.S"],
+ cmd = "$(location :make_data_assembly) " +
+ # We need to specify the absolute path from the root
+ "$(location common/icudtl.dat) " +
+ # $@ is replaced with the one and only out location, located in //bazel-out.
+ "$@",
+ exec_tools = [":make_data_assembly"],
+)
+
+genrule(
+ name = "create_icu_ios_data_asm",
+ srcs = ["ios/icudtl.dat"],
+ outs = ["generated_icu_ios_dat.S"],
+ cmd = "$(location :make_data_assembly) " +
+ # We need to specify the absolute path from the root
+ "$(location common/icudtl.dat) " +
+ # $@ is replaced with the one and only out location, located in //bazel-out.
+ "$@ --mac",
+ exec_tools = [":make_data_assembly"],
+)
+
+genrule(
+ name = "create_icu_mac_data_asm",
+ srcs = ["common/icudtl.dat"],
+ outs = ["generated_icu_mac_dat.S"],
+ cmd = "$(location :make_data_assembly) " +
+ # We need to specify the absolute path from the root
+ "$(location common/icudtl.dat) " +
+ # $@ is replaced with the one and only out location, located in //bazel-out.
+ "$@ --mac",
+ exec_tools = [":make_data_assembly"],
+)
+
+# For convenience, we add in a Skia-specific loader to help out on Windows.
+# It is not easy to directly expose headers defined elsewhere (e.g. a different Bazel package)
+# because the include paths will be based on that different path. The simplest solution is
+# to copy the files we need into this package - then they will be include able via
+# #include "SkLoadICU.h".
+genrule(
+ name = "copy_skloadicu_h",
+ srcs = [
+ "@icu_utils//:icu/SkLoadICU.cpp",
+ "@icu_utils//:icu/SkLoadICU.h",
+ ],
+ outs = [
+ "SkLoadICU.cpp",
+ "SkLoadICU.h",
+ ],
+ # SRCS is a space seperated list of files.
+ # RULEDIR is the directory containing this BUILD.bazel file (the root of the ICU directory)
+ cmd = "cp $(SRCS) $(RULEDIR)",
+)
+
+ICU_HDRS = [
+ "source/common/bmpset.h",
+ "source/common/brkeng.h",
+ "source/common/bytesinkutil.h",
+ "source/common/capi_helper.h",
+ "source/common/charstr.h",
+ "source/common/charstrmap.h",
+ "source/common/cmemory.h",
+ "source/common/cpputils.h",
+ "source/common/cstr.h",
+ "source/common/cstring.h",
+ "source/common/cwchar.h",
+ "source/common/dictbe.h",
+ "source/common/dictionarydata.h",
+ "source/common/hash.h",
+ "source/common/icuplugimp.h",
+ "source/common/localeprioritylist.h",
+ "source/common/localsvc.h",
+ "source/common/locbased.h",
+ "source/common/locdistance.h",
+ "source/common/loclikelysubtags.h",
+ "source/common/locmap.h",
+ "source/common/locutil.h",
+ "source/common/lsr.h",
+ "source/common/messageimpl.h",
+ "source/common/msvcres.h",
+ "source/common/mutex.h",
+ "source/common/norm2_nfc_data.h",
+ "source/common/norm2allmodes.h",
+ "source/common/normalizer2impl.h",
+ "source/common/patternprops.h",
+ "source/common/pluralmap.h",
+ "source/common/propname.h",
+ "source/common/propname_data.h",
+ "source/common/propsvec.h",
+ "source/common/punycode.h",
+ "source/common/putilimp.h",
+ "source/common/rbbi_cache.h",
+ "source/common/rbbidata.h",
+ "source/common/rbbinode.h",
+ "source/common/rbbirb.h",
+ "source/common/rbbirpt.h",
+ "source/common/rbbiscan.h",
+ "source/common/rbbisetb.h",
+ "source/common/rbbitblb.h",
+ "source/common/resource.h",
+ "source/common/restrace.h",
+ "source/common/ruleiter.h",
+ "source/common/serv.h",
+ "source/common/servloc.h",
+ "source/common/servnotf.h",
+ "source/common/sharedobject.h",
+ "source/common/sprpimpl.h",
+ "source/common/static_unicode_sets.h",
+ "source/common/uarrsort.h",
+ "source/common/uassert.h",
+ "source/common/ubidi_props.h",
+ "source/common/ubidi_props_data.h",
+ "source/common/ubidiimp.h",
+ "source/common/ubrkimpl.h",
+ "source/common/ucase.h",
+ "source/common/ucase_props_data.h",
+ "source/common/ucasemap_imp.h",
+ "source/common/uchar_props_data.h",
+ "source/common/ucln.h",
+ "source/common/ucln_cmn.h",
+ "source/common/ucln_imp.h",
+ "source/common/ucmndata.h",
+ "source/common/ucnv_bld.h",
+ "source/common/ucnv_cnv.h",
+ "source/common/ucnv_ext.h",
+ "source/common/ucnv_imp.h",
+ "source/common/ucnv_io.h",
+ "source/common/ucnvmbcs.h",
+ "source/common/ucol_data.h",
+ "source/common/ucol_swp.h",
+ "source/common/ucptrie_impl.h",
+ "source/common/ucurrimp.h",
+ "source/common/udatamem.h",
+ "source/common/udataswp.h",
+ "source/common/uelement.h",
+ "source/common/uenumimp.h",
+ "source/common/uhash.h",
+ "source/common/uinvchar.h",
+ "source/common/ulayout_props.h",
+ "source/common/ulist.h",
+ "source/common/ulocimp.h",
+ "source/common/umapfile.h",
+ "source/common/umutex.h",
+ "source/common/unicode/appendable.h",
+ "source/common/unicode/brkiter.h",
+ "source/common/unicode/bytestream.h",
+ "source/common/unicode/bytestrie.h",
+ "source/common/unicode/bytestriebuilder.h",
+ "source/common/unicode/caniter.h",
+ "source/common/unicode/casemap.h",
+ "source/common/unicode/char16ptr.h",
+ "source/common/unicode/chariter.h",
+ "source/common/unicode/dbbi.h",
+ "source/common/unicode/docmain.h",
+ "source/common/unicode/dtintrv.h",
+ "source/common/unicode/edits.h",
+ "source/common/unicode/enumset.h",
+ "source/common/unicode/errorcode.h",
+ "source/common/unicode/filteredbrk.h",
+ "source/common/unicode/icudataver.h",
+ "source/common/unicode/icuplug.h",
+ "source/common/unicode/idna.h",
+ "source/common/unicode/localebuilder.h",
+ "source/common/unicode/localematcher.h",
+ "source/common/unicode/localpointer.h",
+ "source/common/unicode/locdspnm.h",
+ "source/common/unicode/locid.h",
+ "source/common/unicode/messagepattern.h",
+ "source/common/unicode/normalizer2.h",
+ "source/common/unicode/normlzr.h",
+ "source/common/unicode/parseerr.h",
+ "source/common/unicode/parsepos.h",
+ "source/common/unicode/platform.h",
+ "source/common/unicode/ptypes.h",
+ "source/common/unicode/putil.h",
+ "source/common/unicode/rbbi.h",
+ "source/common/unicode/rep.h",
+ "source/common/unicode/resbund.h",
+ "source/common/unicode/schriter.h",
+ "source/common/unicode/simpleformatter.h",
+ "source/common/unicode/std_string.h",
+ "source/common/unicode/strenum.h",
+ "source/common/unicode/stringoptions.h",
+ "source/common/unicode/stringpiece.h",
+ "source/common/unicode/stringtriebuilder.h",
+ "source/common/unicode/symtable.h",
+ "source/common/unicode/ubidi.h",
+ "source/common/unicode/ubiditransform.h",
+ "source/common/unicode/ubrk.h",
+ "source/common/unicode/ucasemap.h",
+ "source/common/unicode/ucat.h",
+ "source/common/unicode/uchar.h",
+ "source/common/unicode/ucharstrie.h",
+ "source/common/unicode/ucharstriebuilder.h",
+ "source/common/unicode/uchriter.h",
+ "source/common/unicode/uclean.h",
+ "source/common/unicode/ucnv.h",
+ "source/common/unicode/ucnv_cb.h",
+ "source/common/unicode/ucnv_err.h",
+ "source/common/unicode/ucnvsel.h",
+ "source/common/unicode/uconfig.h",
+ "source/common/unicode/ucpmap.h",
+ "source/common/unicode/ucptrie.h",
+ "source/common/unicode/ucurr.h",
+ "source/common/unicode/udata.h",
+ "source/common/unicode/udisplaycontext.h",
+ "source/common/unicode/uenum.h",
+ "source/common/unicode/uidna.h",
+ "source/common/unicode/uiter.h",
+ "source/common/unicode/uldnames.h",
+ "source/common/unicode/uloc.h",
+ "source/common/unicode/umachine.h",
+ "source/common/unicode/umisc.h",
+ "source/common/unicode/umutablecptrie.h",
+ "source/common/unicode/unifilt.h",
+ "source/common/unicode/unifunct.h",
+ "source/common/unicode/unimatch.h",
+ "source/common/unicode/uniset.h",
+ "source/common/unicode/unistr.h",
+ "source/common/unicode/unorm.h",
+ "source/common/unicode/unorm2.h",
+ "source/common/unicode/uobject.h",
+ "source/common/unicode/urename.h",
+ "source/common/unicode/urep.h",
+ "source/common/unicode/ures.h",
+ "source/common/unicode/uscript.h",
+ "source/common/unicode/uset.h",
+ "source/common/unicode/usetiter.h",
+ "source/common/unicode/ushape.h",
+ "source/common/unicode/usprep.h",
+ "source/common/unicode/ustring.h",
+ "source/common/unicode/ustringtrie.h",
+ "source/common/unicode/utext.h",
+ "source/common/unicode/utf.h",
+ "source/common/unicode/utf16.h",
+ "source/common/unicode/utf32.h",
+ "source/common/unicode/utf8.h",
+ "source/common/unicode/utf_old.h",
+ "source/common/unicode/utrace.h",
+ "source/common/unicode/utypes.h",
+ "source/common/unicode/uvernum.h",
+ "source/common/unicode/uversion.h",
+ "source/common/unifiedcache.h",
+ "source/common/uniquecharstr.h",
+ "source/common/unisetspan.h",
+ "source/common/unistrappender.h",
+ "source/common/unormimp.h",
+ "source/common/uposixdefs.h",
+ "source/common/uprops.h",
+ "source/common/uresdata.h",
+ "source/common/uresimp.h",
+ "source/common/ureslocs.h",
+ "source/common/usc_impl.h",
+ "source/common/uset_imp.h",
+ "source/common/ustr_cnv.h",
+ "source/common/ustr_imp.h",
+ "source/common/ustrenum.h",
+ "source/common/ustrfmt.h",
+ "source/common/util.h",
+ "source/common/utracimp.h",
+ "source/common/utrie.h",
+ "source/common/utrie2.h",
+ "source/common/utrie2_impl.h",
+ "source/common/utypeinfo.h",
+ "source/common/uvector.h",
+ "source/common/uvectr32.h",
+ "source/common/uvectr64.h",
+ "source/common/wintz.h",
+ "source/i18n/anytrans.h",
+ "source/i18n/astro.h",
+ "source/i18n/bocsu.h",
+ "source/i18n/brktrans.h",
+ "source/i18n/buddhcal.h",
+ "source/i18n/casetrn.h",
+ "source/i18n/cecal.h",
+ "source/i18n/chnsecal.h",
+ "source/i18n/collation.h",
+ "source/i18n/collationbuilder.h",
+ "source/i18n/collationcompare.h",
+ "source/i18n/collationdata.h",
+ "source/i18n/collationdatabuilder.h",
+ "source/i18n/collationdatareader.h",
+ "source/i18n/collationdatawriter.h",
+ "source/i18n/collationfastlatin.h",
+ "source/i18n/collationfastlatinbuilder.h",
+ "source/i18n/collationfcd.h",
+ "source/i18n/collationiterator.h",
+ "source/i18n/collationkeys.h",
+ "source/i18n/collationroot.h",
+ "source/i18n/collationrootelements.h",
+ "source/i18n/collationruleparser.h",
+ "source/i18n/collationsets.h",
+ "source/i18n/collationsettings.h",
+ "source/i18n/collationtailoring.h",
+ "source/i18n/collationweights.h",
+ "source/i18n/collunsafe.h",
+ "source/i18n/coptccal.h",
+ "source/i18n/cpdtrans.h",
+ "source/i18n/csdetect.h",
+ "source/i18n/csmatch.h",
+ "source/i18n/csr2022.h",
+ "source/i18n/csrecog.h",
+ "source/i18n/csrmbcs.h",
+ "source/i18n/csrsbcs.h",
+ "source/i18n/csrucode.h",
+ "source/i18n/csrutf8.h",
+ "source/i18n/currfmt.h",
+ "source/i18n/dangical.h",
+ "source/i18n/dayperiodrules.h",
+ "source/i18n/decContext.h",
+ "source/i18n/decNumber.h",
+ "source/i18n/decNumberLocal.h",
+ "source/i18n/double-conversion-bignum-dtoa.h",
+ "source/i18n/double-conversion-bignum.h",
+ "source/i18n/double-conversion-cached-powers.h",
+ "source/i18n/double-conversion-diy-fp.h",
+ "source/i18n/double-conversion-double-to-string.h",
+ "source/i18n/double-conversion-fast-dtoa.h",
+ "source/i18n/double-conversion-ieee.h",
+ "source/i18n/double-conversion-string-to-double.h",
+ "source/i18n/double-conversion-strtod.h",
+ "source/i18n/double-conversion-utils.h",
+ "source/i18n/double-conversion.h",
+ "source/i18n/dt_impl.h",
+ "source/i18n/dtitv_impl.h",
+ "source/i18n/dtptngen_impl.h",
+ "source/i18n/erarules.h",
+ "source/i18n/esctrn.h",
+ "source/i18n/ethpccal.h",
+ "source/i18n/fmtableimp.h",
+ "source/i18n/formatted_string_builder.h",
+ "source/i18n/formattedval_impl.h",
+ "source/i18n/fphdlimp.h",
+ "source/i18n/funcrepl.h",
+ "source/i18n/gregoimp.h",
+ "source/i18n/hebrwcal.h",
+ "source/i18n/indiancal.h",
+ "source/i18n/inputext.h",
+ "source/i18n/islamcal.h",
+ "source/i18n/japancal.h",
+ "source/i18n/measunit_impl.h",
+ "source/i18n/msgfmt_impl.h",
+ "source/i18n/name2uni.h",
+ "source/i18n/nfrlist.h",
+ "source/i18n/nfrs.h",
+ "source/i18n/nfrule.h",
+ "source/i18n/nfsubs.h",
+ "source/i18n/nortrans.h",
+ "source/i18n/nultrans.h",
+ "source/i18n/number_affixutils.h",
+ "source/i18n/number_asformat.h",
+ "source/i18n/number_compact.h",
+ "source/i18n/number_currencysymbols.h",
+ "source/i18n/number_decimalquantity.h",
+ "source/i18n/number_decimfmtprops.h",
+ "source/i18n/number_decnum.h",
+ "source/i18n/number_formatimpl.h",
+ "source/i18n/number_longnames.h",
+ "source/i18n/number_mapper.h",
+ "source/i18n/number_microprops.h",
+ "source/i18n/number_modifiers.h",
+ "source/i18n/number_multiplier.h",
+ "source/i18n/number_patternmodifier.h",
+ "source/i18n/number_patternstring.h",
+ "source/i18n/number_roundingutils.h",
+ "source/i18n/number_scientific.h",
+ "source/i18n/number_skeletons.h",
+ "source/i18n/number_types.h",
+ "source/i18n/number_usageprefs.h",
+ "source/i18n/number_utils.h",
+ "source/i18n/number_utypes.h",
+ "source/i18n/numparse_affixes.h",
+ "source/i18n/numparse_compositions.h",
+ "source/i18n/numparse_currency.h",
+ "source/i18n/numparse_decimal.h",
+ "source/i18n/numparse_impl.h",
+ "source/i18n/numparse_scientific.h",
+ "source/i18n/numparse_symbols.h",
+ "source/i18n/numparse_types.h",
+ "source/i18n/numparse_utils.h",
+ "source/i18n/numparse_validators.h",
+ "source/i18n/numrange_impl.h",
+ "source/i18n/numsys_impl.h",
+ "source/i18n/olsontz.h",
+ "source/i18n/persncal.h",
+ "source/i18n/pluralranges.h",
+ "source/i18n/plurrule_impl.h",
+ "source/i18n/quant.h",
+ "source/i18n/quantityformatter.h",
+ "source/i18n/rbt.h",
+ "source/i18n/rbt_data.h",
+ "source/i18n/rbt_pars.h",
+ "source/i18n/rbt_rule.h",
+ "source/i18n/rbt_set.h",
+ "source/i18n/regexcmp.h",
+ "source/i18n/regexcst.h",
+ "source/i18n/regeximp.h",
+ "source/i18n/regexst.h",
+ "source/i18n/regextxt.h",
+ "source/i18n/region_impl.h",
+ "source/i18n/reldtfmt.h",
+ "source/i18n/remtrans.h",
+ "source/i18n/scriptset.h",
+ "source/i18n/selfmtimpl.h",
+ "source/i18n/sharedbreakiterator.h",
+ "source/i18n/sharedcalendar.h",
+ "source/i18n/shareddateformatsymbols.h",
+ "source/i18n/sharednumberformat.h",
+ "source/i18n/sharedpluralrules.h",
+ "source/i18n/smpdtfst.h",
+ "source/i18n/standardplural.h",
+ "source/i18n/string_segment.h",
+ "source/i18n/strmatch.h",
+ "source/i18n/strrepl.h",
+ "source/i18n/taiwncal.h",
+ "source/i18n/titletrn.h",
+ "source/i18n/tolowtrn.h",
+ "source/i18n/toupptrn.h",
+ "source/i18n/transreg.h",
+ "source/i18n/tridpars.h",
+ "source/i18n/tzgnames.h",
+ "source/i18n/tznames_impl.h",
+ "source/i18n/ucln_in.h",
+ "source/i18n/ucol_imp.h",
+ "source/i18n/uitercollationiterator.h",
+ "source/i18n/umsg_imp.h",
+ "source/i18n/unesctrn.h",
+ "source/i18n/uni2name.h",
+ "source/i18n/unicode/alphaindex.h",
+ "source/i18n/unicode/basictz.h",
+ "source/i18n/unicode/calendar.h",
+ "source/i18n/unicode/choicfmt.h",
+ "source/i18n/unicode/coleitr.h",
+ "source/i18n/unicode/coll.h",
+ "source/i18n/unicode/compactdecimalformat.h",
+ "source/i18n/unicode/curramt.h",
+ "source/i18n/unicode/currpinf.h",
+ "source/i18n/unicode/currunit.h",
+ "source/i18n/unicode/datefmt.h",
+ "source/i18n/unicode/dcfmtsym.h",
+ "source/i18n/unicode/decimfmt.h",
+ "source/i18n/unicode/dtfmtsym.h",
+ "source/i18n/unicode/dtitvfmt.h",
+ "source/i18n/unicode/dtitvinf.h",
+ "source/i18n/unicode/dtptngen.h",
+ "source/i18n/unicode/dtrule.h",
+ "source/i18n/unicode/fieldpos.h",
+ "source/i18n/unicode/fmtable.h",
+ "source/i18n/unicode/format.h",
+ "source/i18n/unicode/formattedvalue.h",
+ "source/i18n/unicode/fpositer.h",
+ "source/i18n/unicode/gender.h",
+ "source/i18n/unicode/gregocal.h",
+ "source/i18n/unicode/listformatter.h",
+ "source/i18n/unicode/measfmt.h",
+ "source/i18n/unicode/measunit.h",
+ "source/i18n/unicode/measure.h",
+ "source/i18n/unicode/msgfmt.h",
+ "source/i18n/unicode/nounit.h",
+ "source/i18n/unicode/numberformatter.h",
+ "source/i18n/unicode/numberrangeformatter.h",
+ "source/i18n/unicode/numfmt.h",
+ "source/i18n/unicode/numsys.h",
+ "source/i18n/unicode/plurfmt.h",
+ "source/i18n/unicode/plurrule.h",
+ "source/i18n/unicode/rbnf.h",
+ "source/i18n/unicode/rbtz.h",
+ "source/i18n/unicode/regex.h",
+ "source/i18n/unicode/region.h",
+ "source/i18n/unicode/reldatefmt.h",
+ "source/i18n/unicode/scientificnumberformatter.h",
+ "source/i18n/unicode/search.h",
+ "source/i18n/unicode/selfmt.h",
+ "source/i18n/unicode/simpletz.h",
+ "source/i18n/unicode/smpdtfmt.h",
+ "source/i18n/unicode/sortkey.h",
+ "source/i18n/unicode/stsearch.h",
+ "source/i18n/unicode/tblcoll.h",
+ "source/i18n/unicode/timezone.h",
+ "source/i18n/unicode/tmunit.h",
+ "source/i18n/unicode/tmutamt.h",
+ "source/i18n/unicode/tmutfmt.h",
+ "source/i18n/unicode/translit.h",
+ "source/i18n/unicode/tzfmt.h",
+ "source/i18n/unicode/tznames.h",
+ "source/i18n/unicode/tzrule.h",
+ "source/i18n/unicode/tztrans.h",
+ "source/i18n/unicode/ucal.h",
+ "source/i18n/unicode/ucol.h",
+ "source/i18n/unicode/ucoleitr.h",
+ "source/i18n/unicode/ucsdet.h",
+ "source/i18n/unicode/udat.h",
+ "source/i18n/unicode/udateintervalformat.h",
+ "source/i18n/unicode/udatpg.h",
+ "source/i18n/unicode/ufieldpositer.h",
+ "source/i18n/unicode/uformattable.h",
+ "source/i18n/unicode/uformattedvalue.h",
+ "source/i18n/unicode/ugender.h",
+ "source/i18n/unicode/ulistformatter.h",
+ "source/i18n/unicode/ulocdata.h",
+ "source/i18n/unicode/umsg.h",
+ "source/i18n/unicode/unirepl.h",
+ "source/i18n/unicode/unum.h",
+ "source/i18n/unicode/unumberformatter.h",
+ "source/i18n/unicode/unumberrangeformatter.h",
+ "source/i18n/unicode/unumsys.h",
+ "source/i18n/unicode/upluralrules.h",
+ "source/i18n/unicode/uregex.h",
+ "source/i18n/unicode/uregion.h",
+ "source/i18n/unicode/ureldatefmt.h",
+ "source/i18n/unicode/usearch.h",
+ "source/i18n/unicode/uspoof.h",
+ "source/i18n/unicode/utmscale.h",
+ "source/i18n/unicode/utrans.h",
+ "source/i18n/unicode/vtzone.h",
+ "source/i18n/units_complexconverter.h",
+ "source/i18n/units_converter.h",
+ "source/i18n/units_data.h",
+ "source/i18n/units_router.h",
+ "source/i18n/uspoof_conf.h",
+ "source/i18n/uspoof_impl.h",
+ "source/i18n/usrchimp.h",
+ "source/i18n/utf16collationiterator.h",
+ "source/i18n/utf8collationiterator.h",
+ "source/i18n/vzone.h",
+ "source/i18n/windtfmt.h",
+ "source/i18n/winnmfmt.h",
+ "source/i18n/wintzimpl.h",
+ "source/i18n/zonemeta.h",
+ "source/i18n/zrule.h",
+ "source/i18n/ztrans.h",
+ "SkLoadICU.h",
+]
+
+ICU_SRCS = [
+ "source/common/bmpset.cpp",
+ "source/common/brkeng.cpp",
+ "source/common/brkiter.cpp",
+ "source/common/bytesinkutil.cpp",
+ "source/common/bytestream.cpp",
+ "source/common/bytestrie.cpp",
+ "source/common/bytestriebuilder.cpp",
+ "source/common/bytestrieiterator.cpp",
+ "source/common/caniter.cpp",
+ "source/common/characterproperties.cpp",
+ "source/common/chariter.cpp",
+ "source/common/charstr.cpp",
+ "source/common/cmemory.cpp",
+ "source/common/cstr.cpp",
+ "source/common/cstring.cpp",
+ "source/common/cwchar.cpp",
+ "source/common/dictbe.cpp",
+ "source/common/dictionarydata.cpp",
+ "source/common/dtintrv.cpp",
+ "source/common/edits.cpp",
+ "source/common/errorcode.cpp",
+ "source/common/filteredbrk.cpp",
+ "source/common/filterednormalizer2.cpp",
+ "source/common/icudataver.cpp",
+ "source/common/icuplug.cpp",
+ "source/common/loadednormalizer2impl.cpp",
+ "source/common/localebuilder.cpp",
+ "source/common/locavailable.cpp",
+ "source/common/locbased.cpp",
+ "source/common/locdispnames.cpp",
+ "source/common/locdspnm.cpp",
+ "source/common/locid.cpp",
+ "source/common/loclikely.cpp",
+ "source/common/locmap.cpp",
+ "source/common/locresdata.cpp",
+ "source/common/locutil.cpp",
+ "source/common/messagepattern.cpp",
+ "source/common/normalizer2.cpp",
+ "source/common/normalizer2impl.cpp",
+ "source/common/normlzr.cpp",
+ "source/common/parsepos.cpp",
+ "source/common/patternprops.cpp",
+ "source/common/pluralmap.cpp",
+ "source/common/propname.cpp",
+ "source/common/propsvec.cpp",
+ "source/common/punycode.cpp",
+ "source/common/putil.cpp",
+ "source/common/rbbi.cpp",
+ "source/common/rbbi_cache.cpp",
+ "source/common/rbbidata.cpp",
+ "source/common/rbbinode.cpp",
+ "source/common/rbbirb.cpp",
+ "source/common/rbbiscan.cpp",
+ "source/common/rbbisetb.cpp",
+ "source/common/rbbistbl.cpp",
+ "source/common/rbbitblb.cpp",
+ "source/common/resbund.cpp",
+ "source/common/resbund_cnv.cpp",
+ "source/common/resource.cpp",
+ "source/common/ruleiter.cpp",
+ "source/common/schriter.cpp",
+ "source/common/serv.cpp",
+ "source/common/servlk.cpp",
+ "source/common/servlkf.cpp",
+ "source/common/servls.cpp",
+ "source/common/servnotf.cpp",
+ "source/common/servrbf.cpp",
+ "source/common/servslkf.cpp",
+ "source/common/sharedobject.cpp",
+ "source/common/simpleformatter.cpp",
+ "source/common/static_unicode_sets.cpp",
+ "source/common/stringpiece.cpp",
+ "source/common/stringtriebuilder.cpp",
+ "source/common/uarrsort.cpp",
+ "source/common/ubidi.cpp",
+ "source/common/ubidi_props.cpp",
+ "source/common/ubidiln.cpp",
+ "source/common/ubiditransform.cpp",
+ "source/common/ubidiwrt.cpp",
+ "source/common/ubrk.cpp",
+ "source/common/ucase.cpp",
+ "source/common/ucasemap.cpp",
+ "source/common/ucasemap_titlecase_brkiter.cpp",
+ "source/common/ucat.cpp",
+ "source/common/uchar.cpp",
+ "source/common/ucharstrie.cpp",
+ "source/common/ucharstriebuilder.cpp",
+ "source/common/ucharstrieiterator.cpp",
+ "source/common/uchriter.cpp",
+ "source/common/ucln_cmn.cpp",
+ "source/common/ucmndata.cpp",
+ "source/common/ucnv.cpp",
+ "source/common/ucnv2022.cpp",
+ "source/common/ucnv_bld.cpp",
+ "source/common/ucnv_cb.cpp",
+ "source/common/ucnv_cnv.cpp",
+ "source/common/ucnv_ct.cpp",
+ "source/common/ucnv_err.cpp",
+ "source/common/ucnv_ext.cpp",
+ "source/common/ucnv_io.cpp",
+ "source/common/ucnv_lmb.cpp",
+ "source/common/ucnv_set.cpp",
+ "source/common/ucnv_u16.cpp",
+ "source/common/ucnv_u32.cpp",
+ "source/common/ucnv_u7.cpp",
+ "source/common/ucnv_u8.cpp",
+ "source/common/ucnvbocu.cpp",
+ "source/common/ucnvdisp.cpp",
+ "source/common/ucnvhz.cpp",
+ "source/common/ucnvisci.cpp",
+ "source/common/ucnvlat1.cpp",
+ "source/common/ucnvmbcs.cpp",
+ "source/common/ucnvscsu.cpp",
+ "source/common/ucnvsel.cpp",
+ "source/common/ucol_swp.cpp",
+ "source/common/ucptrie.cpp",
+ "source/common/ucurr.cpp",
+ "source/common/udata.cpp",
+ "source/common/udatamem.cpp",
+ "source/common/udataswp.cpp",
+ "source/common/uenum.cpp",
+ "source/common/uhash.cpp",
+ "source/common/uhash_us.cpp",
+ "source/common/uidna.cpp",
+ "source/common/uinit.cpp",
+ "source/common/uinvchar.cpp",
+ "source/common/uiter.cpp",
+ "source/common/ulist.cpp",
+ "source/common/uloc.cpp",
+ "source/common/uloc_keytype.cpp",
+ "source/common/uloc_tag.cpp",
+ "source/common/umapfile.cpp",
+ "source/common/umath.cpp",
+ "source/common/umutablecptrie.cpp",
+ "source/common/umutex.cpp",
+ "source/common/unames.cpp",
+ "source/common/unifiedcache.cpp",
+ "source/common/unifilt.cpp",
+ "source/common/unifunct.cpp",
+ "source/common/uniset.cpp",
+ "source/common/uniset_closure.cpp",
+ "source/common/uniset_props.cpp",
+ "source/common/unisetspan.cpp",
+ "source/common/unistr.cpp",
+ "source/common/unistr_case.cpp",
+ "source/common/unistr_case_locale.cpp",
+ "source/common/unistr_cnv.cpp",
+ "source/common/unistr_props.cpp",
+ "source/common/unistr_titlecase_brkiter.cpp",
+ "source/common/unorm.cpp",
+ "source/common/unormcmp.cpp",
+ "source/common/uobject.cpp",
+ "source/common/uprops.cpp",
+ "source/common/ures_cnv.cpp",
+ "source/common/uresbund.cpp",
+ "source/common/uresdata.cpp",
+ "source/common/usc_impl.cpp",
+ "source/common/uscript.cpp",
+ "source/common/uscript_props.cpp",
+ "source/common/uset.cpp",
+ "source/common/uset_props.cpp",
+ "source/common/usetiter.cpp",
+ "source/common/ushape.cpp",
+ "source/common/usprep.cpp",
+ "source/common/ustack.cpp",
+ "source/common/ustr_cnv.cpp",
+ "source/common/ustr_titlecase_brkiter.cpp",
+ "source/common/ustr_wcs.cpp",
+ "source/common/ustrcase.cpp",
+ "source/common/ustrcase_locale.cpp",
+ "source/common/ustrenum.cpp",
+ "source/common/ustrfmt.cpp",
+ "source/common/ustring.cpp",
+ "source/common/ustrtrns.cpp",
+ "source/common/utext.cpp",
+ "source/common/utf_impl.cpp",
+ "source/common/util.cpp",
+ "source/common/util_props.cpp",
+ "source/common/utrace.cpp",
+ "source/common/utrie.cpp",
+ "source/common/utrie2.cpp",
+ "source/common/utrie2_builder.cpp",
+ "source/common/utrie_swap.cpp",
+ "source/common/uts46.cpp",
+ "source/common/utypes.cpp",
+ "source/common/uvector.cpp",
+ "source/common/uvectr32.cpp",
+ "source/common/uvectr64.cpp",
+ "source/common/wintz.cpp",
+ "source/i18n/alphaindex.cpp",
+ "source/i18n/anytrans.cpp",
+ "source/i18n/astro.cpp",
+ "source/i18n/basictz.cpp",
+ "source/i18n/bocsu.cpp",
+ "source/i18n/brktrans.cpp",
+ "source/i18n/buddhcal.cpp",
+ "source/i18n/calendar.cpp",
+ "source/i18n/casetrn.cpp",
+ "source/i18n/cecal.cpp",
+ "source/i18n/chnsecal.cpp",
+ "source/i18n/choicfmt.cpp",
+ "source/i18n/coleitr.cpp",
+ "source/i18n/coll.cpp",
+ "source/i18n/collation.cpp",
+ "source/i18n/collationbuilder.cpp",
+ "source/i18n/collationcompare.cpp",
+ "source/i18n/collationdata.cpp",
+ "source/i18n/collationdatabuilder.cpp",
+ "source/i18n/collationdatareader.cpp",
+ "source/i18n/collationdatawriter.cpp",
+ "source/i18n/collationfastlatin.cpp",
+ "source/i18n/collationfastlatinbuilder.cpp",
+ "source/i18n/collationfcd.cpp",
+ "source/i18n/collationiterator.cpp",
+ "source/i18n/collationkeys.cpp",
+ "source/i18n/collationroot.cpp",
+ "source/i18n/collationrootelements.cpp",
+ "source/i18n/collationruleparser.cpp",
+ "source/i18n/collationsets.cpp",
+ "source/i18n/collationsettings.cpp",
+ "source/i18n/collationtailoring.cpp",
+ "source/i18n/collationweights.cpp",
+ "source/i18n/compactdecimalformat.cpp",
+ "source/i18n/coptccal.cpp",
+ "source/i18n/cpdtrans.cpp",
+ "source/i18n/csdetect.cpp",
+ "source/i18n/csmatch.cpp",
+ "source/i18n/csr2022.cpp",
+ "source/i18n/csrecog.cpp",
+ "source/i18n/csrmbcs.cpp",
+ "source/i18n/csrsbcs.cpp",
+ "source/i18n/csrucode.cpp",
+ "source/i18n/csrutf8.cpp",
+ "source/i18n/curramt.cpp",
+ "source/i18n/currfmt.cpp",
+ "source/i18n/currpinf.cpp",
+ "source/i18n/currunit.cpp",
+ "source/i18n/dangical.cpp",
+ "source/i18n/datefmt.cpp",
+ "source/i18n/dayperiodrules.cpp",
+ "source/i18n/dcfmtsym.cpp",
+ "source/i18n/decContext.cpp",
+ "source/i18n/decimfmt.cpp",
+ "source/i18n/decNumber.cpp",
+ "source/i18n/double-conversion-bignum-dtoa.cpp",
+ "source/i18n/double-conversion-bignum.cpp",
+ "source/i18n/double-conversion-cached-powers.cpp",
+ "source/i18n/double-conversion-fast-dtoa.cpp",
+ "source/i18n/double-conversion-strtod.cpp",
+ "source/i18n/dtfmtsym.cpp",
+ "source/i18n/dtitvfmt.cpp",
+ "source/i18n/dtitvinf.cpp",
+ "source/i18n/dtptngen.cpp",
+ "source/i18n/dtrule.cpp",
+ "source/i18n/erarules.cpp",
+ "source/i18n/esctrn.cpp",
+ "source/i18n/ethpccal.cpp",
+ "source/i18n/fmtable.cpp",
+ "source/i18n/fmtable_cnv.cpp",
+ "source/i18n/format.cpp",
+ "source/i18n/fphdlimp.cpp",
+ "source/i18n/fpositer.cpp",
+ "source/i18n/funcrepl.cpp",
+ "source/i18n/gender.cpp",
+ "source/i18n/gregocal.cpp",
+ "source/i18n/gregoimp.cpp",
+ "source/i18n/hebrwcal.cpp",
+ "source/i18n/indiancal.cpp",
+ "source/i18n/inputext.cpp",
+ "source/i18n/islamcal.cpp",
+ "source/i18n/japancal.cpp",
+ "source/i18n/listformatter.cpp",
+ "source/i18n/measfmt.cpp",
+ "source/i18n/measunit.cpp",
+ "source/i18n/measure.cpp",
+ "source/i18n/msgfmt.cpp",
+ "source/i18n/name2uni.cpp",
+ "source/i18n/nfrs.cpp",
+ "source/i18n/nfrule.cpp",
+ "source/i18n/nfsubs.cpp",
+ "source/i18n/nortrans.cpp",
+ "source/i18n/nultrans.cpp",
+ "source/i18n/number_affixutils.cpp",
+ "source/i18n/number_asformat.cpp",
+ "source/i18n/number_capi.cpp",
+ "source/i18n/number_compact.cpp",
+ "source/i18n/number_currencysymbols.cpp",
+ "source/i18n/number_decimalquantity.cpp",
+ "source/i18n/number_decimfmtprops.cpp",
+ "source/i18n/number_fluent.cpp",
+ "source/i18n/number_formatimpl.cpp",
+ "source/i18n/number_grouping.cpp",
+ "source/i18n/number_integerwidth.cpp",
+ "source/i18n/number_longnames.cpp",
+ "source/i18n/number_mapper.cpp",
+ "source/i18n/number_modifiers.cpp",
+ "source/i18n/number_multiplier.cpp",
+ "source/i18n/number_notation.cpp",
+ "source/i18n/number_padding.cpp",
+ "source/i18n/number_patternmodifier.cpp",
+ "source/i18n/number_patternstring.cpp",
+ "source/i18n/number_rounding.cpp",
+ "source/i18n/number_scientific.cpp",
+ "source/i18n/number_skeletons.cpp",
+ "source/i18n/number_utils.cpp",
+ "source/i18n/numfmt.cpp",
+ "source/i18n/numparse_affixes.cpp",
+ "source/i18n/numparse_compositions.cpp",
+ "source/i18n/numparse_currency.cpp",
+ "source/i18n/numparse_decimal.cpp",
+ "source/i18n/numparse_impl.cpp",
+ "source/i18n/numparse_parsednumber.cpp",
+ "source/i18n/numparse_scientific.cpp",
+ "source/i18n/numparse_symbols.cpp",
+ "source/i18n/numparse_validators.cpp",
+ "source/i18n/numrange_fluent.cpp",
+ "source/i18n/numrange_impl.cpp",
+ "source/i18n/numsys.cpp",
+ "source/i18n/olsontz.cpp",
+ "source/i18n/persncal.cpp",
+ "source/i18n/plurfmt.cpp",
+ "source/i18n/plurrule.cpp",
+ "source/i18n/quant.cpp",
+ "source/i18n/quantityformatter.cpp",
+ "source/i18n/rbnf.cpp",
+ "source/i18n/rbt.cpp",
+ "source/i18n/rbt_data.cpp",
+ "source/i18n/rbt_pars.cpp",
+ "source/i18n/rbt_rule.cpp",
+ "source/i18n/rbt_set.cpp",
+ "source/i18n/rbtz.cpp",
+ "source/i18n/regexcmp.cpp",
+ "source/i18n/regeximp.cpp",
+ "source/i18n/regexst.cpp",
+ "source/i18n/regextxt.cpp",
+ "source/i18n/region.cpp",
+ "source/i18n/reldatefmt.cpp",
+ "source/i18n/reldtfmt.cpp",
+ "source/i18n/rematch.cpp",
+ "source/i18n/remtrans.cpp",
+ "source/i18n/repattrn.cpp",
+ "source/i18n/rulebasedcollator.cpp",
+ "source/i18n/scientificnumberformatter.cpp",
+ "source/i18n/scriptset.cpp",
+ "source/i18n/search.cpp",
+ "source/i18n/selfmt.cpp",
+ "source/i18n/sharedbreakiterator.cpp",
+ "source/i18n/simpletz.cpp",
+ "source/i18n/smpdtfmt.cpp",
+ "source/i18n/smpdtfst.cpp",
+ "source/i18n/sortkey.cpp",
+ "source/i18n/standardplural.cpp",
+ "source/i18n/strmatch.cpp",
+ "source/i18n/strrepl.cpp",
+ "source/i18n/stsearch.cpp",
+ "source/i18n/taiwncal.cpp",
+ "source/i18n/timezone.cpp",
+ "source/i18n/titletrn.cpp",
+ "source/i18n/tmunit.cpp",
+ "source/i18n/tmutamt.cpp",
+ "source/i18n/tmutfmt.cpp",
+ "source/i18n/tolowtrn.cpp",
+ "source/i18n/toupptrn.cpp",
+ "source/i18n/translit.cpp",
+ "source/i18n/transreg.cpp",
+ "source/i18n/tridpars.cpp",
+ "source/i18n/tzfmt.cpp",
+ "source/i18n/tzgnames.cpp",
+ "source/i18n/tznames.cpp",
+ "source/i18n/tznames_impl.cpp",
+ "source/i18n/tzrule.cpp",
+ "source/i18n/tztrans.cpp",
+ "source/i18n/ucal.cpp",
+ "source/i18n/ucln_in.cpp",
+ "source/i18n/ucol.cpp",
+ "source/i18n/ucol_res.cpp",
+ "source/i18n/ucol_sit.cpp",
+ "source/i18n/ucoleitr.cpp",
+ "source/i18n/ucsdet.cpp",
+ "source/i18n/udat.cpp",
+ "source/i18n/udateintervalformat.cpp",
+ "source/i18n/udatpg.cpp",
+ "source/i18n/ufieldpositer.cpp",
+ "source/i18n/uitercollationiterator.cpp",
+ "source/i18n/ulistformatter.cpp",
+ "source/i18n/ulocdata.cpp",
+ "source/i18n/umsg.cpp",
+ "source/i18n/unesctrn.cpp",
+ "source/i18n/uni2name.cpp",
+ "source/i18n/unum.cpp",
+ "source/i18n/unumsys.cpp",
+ "source/i18n/upluralrules.cpp",
+ "source/i18n/uregex.cpp",
+ "source/i18n/uregexc.cpp",
+ "source/i18n/uregion.cpp",
+ "source/i18n/usearch.cpp",
+ "source/i18n/uspoof.cpp",
+ "source/i18n/uspoof_build.cpp",
+ "source/i18n/uspoof_conf.cpp",
+ "source/i18n/uspoof_impl.cpp",
+ "source/i18n/utf16collationiterator.cpp",
+ "source/i18n/utf8collationiterator.cpp",
+ "source/i18n/utmscale.cpp",
+ "source/i18n/utrans.cpp",
+ "source/i18n/vtzone.cpp",
+ "source/i18n/vzone.cpp",
+ "source/i18n/windtfmt.cpp",
+ "source/i18n/winnmfmt.cpp",
+ "source/i18n/wintzimpl.cpp",
+ "source/i18n/zonemeta.cpp",
+ "source/i18n/zrule.cpp",
+ "source/i18n/ztrans.cpp",
+ "source/common/appendable.cpp",
+] + select({
+ "@platforms//os:windows": [
+ "source/stubdata/stubdata.cpp",
+ "SkLoadICU.cpp",
+ ],
+ ":cpu_wasm": ["generated_icu_wasm_dat.cpp"],
+ "@platforms//os:android": ["generated_icu_android_dat.S"],
+ "@platforms//os:ios": ["generated_icu_ios_dat.S"],
+ "@platforms//os:macos": ["generated_icu_mac_dat.S"],
+ "//conditions:default": ["generated_icu_common_dat.S"],
+})
+
+cc_library(
+ name = "icu",
+ srcs = ICU_SRCS,
+ hdrs = ICU_HDRS,
+ copts = [
+ "-Wno-deprecated-declarations",
+ "-Wno-unused-but-set-variable",
+ "-Wno-unused-function",
+ ],
+ defines = [
+ "U_USING_ICU_NAMESPACE=0",
+ "U_DISABLE_RENAMING",
+ "SK_USING_THIRD_PARTY_ICU",
+ ],
+ includes = [
+ "source/common",
+ "source/i18n",
+ ],
+ local_defines = [
+ # http://userguide.icu-project.org/howtouseicu
+ "U_COMMON_IMPLEMENTATION",
+ "U_STATIC_IMPLEMENTATION",
+ "U_ENABLE_DYLOAD=0",
+ "U_I18N_IMPLEMENTATION",
+
+ # If we don't set this to zero, ICU will set it to 600,
+ # which makes Macs set _POSIX_C_SOURCE=200112L,
+ # which makes Macs set __DARWIN_C_LEVEL=_POSIX_C_SOURCE instead of =__DARWIN_C_FULL,
+ # which makes <time.h> not expose timespec_get,
+ # which makes recent libc++ <ctime> not #include-able with -std=c++17.
+ "_XOPEN_SOURCE=0",
+ ] + select({
+ # Tell ICU that we are a 32 bit platform, otherwise,
+ # double-conversion-utils.h doesn't know how to operate.
+ ":cpu_wasm": ["__i386__"],
+ "//conditions:default": [],
+ }),
+ visibility = ["//visibility:public"],
+)
diff --git a/chromium/third_party/skia/bazel/external/icu/utils/BUILD.bazel b/chromium/third_party/skia/bazel/external/icu/utils/BUILD.bazel
new file mode 100644
index 00000000000..8e059fb1981
--- /dev/null
+++ b/chromium/third_party/skia/bazel/external/icu/utils/BUILD.bazel
@@ -0,0 +1,8 @@
+exports_files(
+ [
+ "icu/SkLoadICU.cpp",
+ "icu/SkLoadICU.h",
+ "icu/make_data_cpp.py",
+ ],
+ visibility = ["//visibility:public"],
+)
diff --git a/chromium/third_party/skia/src/sksl/generated/fake.output b/chromium/third_party/skia/bazel/external/icu/utils/WORKSPACE
index e69de29bb2d..e69de29bb2d 100644
--- a/chromium/third_party/skia/src/sksl/generated/fake.output
+++ b/chromium/third_party/skia/bazel/external/icu/utils/WORKSPACE
diff --git a/chromium/third_party/skia/bazel/external/libavif/BUILD.bazel b/chromium/third_party/skia/bazel/external/libavif/BUILD.bazel
new file mode 100644
index 00000000000..2468c71b4cf
--- /dev/null
+++ b/chromium/third_party/skia/bazel/external/libavif/BUILD.bazel
@@ -0,0 +1,37 @@
+# This file will be copied into //third_party/externals/libavif via the new_local_repository
+# rule in WORKSPACE.bazel, so all files should be relative to that path.
+
+cc_library(
+ name = "libavif",
+ srcs = [
+ "include/avif/internal.h",
+ "src/alpha.c",
+ "src/avif.c",
+ "src/codec_libgav1.c",
+ "src/colr.c",
+ "src/diag.c",
+ "src/io.c",
+ "src/mem.c",
+ "src/obu.c",
+ "src/rawdata.c",
+ "src/read.c",
+ "src/reformat.c",
+ "src/reformat_libyuv.c",
+ "src/scale.c",
+ "src/stream.c",
+ "src/utils.c",
+ ],
+ hdrs = [
+ "include/avif/avif.h",
+ ],
+ includes = ["include"],
+ local_defines = [
+ "AVIF_CODEC_LIBGAV1=1",
+ "AVIF_LIBYUV_ENABLED=1",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [
+ "@libgav1",
+ "@libyuv",
+ ],
+)
diff --git a/chromium/third_party/skia/bazel/external/libgav1/BUILD.bazel b/chromium/third_party/skia/bazel/external/libgav1/BUILD.bazel
new file mode 100644
index 00000000000..c9d4851b468
--- /dev/null
+++ b/chromium/third_party/skia/bazel/external/libgav1/BUILD.bazel
@@ -0,0 +1,282 @@
+# This file will be copied into //third_party/externals/libgav1 via the new_local_repository
+# rule in WORKSPACE.bazel, so all files should be relative to that path.
+
+cc_library(
+ name = "libgav1",
+ srcs = [
+ "src/buffer_pool.cc",
+ "src/buffer_pool.h",
+ "src/decoder.cc",
+ "src/decoder_impl.cc",
+ "src/decoder_impl.h",
+ "src/decoder_settings.cc",
+ "src/decoder_state.h",
+ "src/dsp/arm/average_blend_neon.cc",
+ "src/dsp/arm/average_blend_neon.h",
+ "src/dsp/arm/cdef_neon.cc",
+ "src/dsp/arm/cdef_neon.h",
+ "src/dsp/arm/common_neon.h",
+ "src/dsp/arm/convolve_10bit_neon.cc",
+ "src/dsp/arm/convolve_neon.cc",
+ "src/dsp/arm/convolve_neon.h",
+ "src/dsp/arm/distance_weighted_blend_neon.cc",
+ "src/dsp/arm/distance_weighted_blend_neon.h",
+ "src/dsp/arm/film_grain_neon.cc",
+ "src/dsp/arm/film_grain_neon.h",
+ "src/dsp/arm/intra_edge_neon.cc",
+ "src/dsp/arm/intra_edge_neon.h",
+ "src/dsp/arm/intrapred_cfl_neon.cc",
+ "src/dsp/arm/intrapred_cfl_neon.h",
+ "src/dsp/arm/intrapred_directional_neon.cc",
+ "src/dsp/arm/intrapred_directional_neon.h",
+ "src/dsp/arm/intrapred_filter_neon.cc",
+ "src/dsp/arm/intrapred_filter_neon.h",
+ "src/dsp/arm/intrapred_neon.cc",
+ "src/dsp/arm/intrapred_neon.h",
+ "src/dsp/arm/intrapred_smooth_neon.cc",
+ "src/dsp/arm/intrapred_smooth_neon.h",
+ "src/dsp/arm/inverse_transform_10bit_neon.cc",
+ "src/dsp/arm/inverse_transform_neon.cc",
+ "src/dsp/arm/inverse_transform_neon.h",
+ "src/dsp/arm/loop_filter_10bit_neon.cc",
+ "src/dsp/arm/loop_filter_neon.cc",
+ "src/dsp/arm/loop_filter_neon.h",
+ "src/dsp/arm/loop_restoration_10bit_neon.cc",
+ "src/dsp/arm/loop_restoration_neon.cc",
+ "src/dsp/arm/loop_restoration_neon.h",
+ "src/dsp/arm/mask_blend_neon.cc",
+ "src/dsp/arm/mask_blend_neon.h",
+ "src/dsp/arm/motion_field_projection_neon.cc",
+ "src/dsp/arm/motion_field_projection_neon.h",
+ "src/dsp/arm/motion_vector_search_neon.cc",
+ "src/dsp/arm/motion_vector_search_neon.h",
+ "src/dsp/arm/obmc_neon.cc",
+ "src/dsp/arm/obmc_neon.h",
+ "src/dsp/arm/super_res_neon.cc",
+ "src/dsp/arm/super_res_neon.h",
+ "src/dsp/arm/warp_neon.cc",
+ "src/dsp/arm/warp_neon.h",
+ "src/dsp/arm/weight_mask_neon.cc",
+ "src/dsp/arm/weight_mask_neon.h",
+ "src/dsp/average_blend.cc",
+ "src/dsp/average_blend.h",
+ "src/dsp/cdef.cc",
+ "src/dsp/cdef.h",
+ "src/dsp/cdef.inc",
+ "src/dsp/common.h",
+ "src/dsp/constants.cc",
+ "src/dsp/constants.h",
+ "src/dsp/convolve.cc",
+ "src/dsp/convolve.h",
+ "src/dsp/convolve.inc",
+ "src/dsp/distance_weighted_blend.cc",
+ "src/dsp/distance_weighted_blend.h",
+ "src/dsp/dsp.cc",
+ "src/dsp/dsp.h",
+ "src/dsp/film_grain.cc",
+ "src/dsp/film_grain.h",
+ "src/dsp/film_grain_common.h",
+ "src/dsp/intra_edge.cc",
+ "src/dsp/intra_edge.h",
+ "src/dsp/intrapred.cc",
+ "src/dsp/intrapred.h",
+ "src/dsp/intrapred_cfl.cc",
+ "src/dsp/intrapred_cfl.h",
+ "src/dsp/intrapred_directional.cc",
+ "src/dsp/intrapred_directional.h",
+ "src/dsp/intrapred_filter.cc",
+ "src/dsp/intrapred_filter.h",
+ "src/dsp/intrapred_smooth.cc",
+ "src/dsp/intrapred_smooth.h",
+ "src/dsp/inverse_transform.cc",
+ "src/dsp/inverse_transform.h",
+ "src/dsp/inverse_transform.inc",
+ "src/dsp/loop_filter.cc",
+ "src/dsp/loop_filter.h",
+ "src/dsp/loop_restoration.cc",
+ "src/dsp/loop_restoration.h",
+ "src/dsp/mask_blend.cc",
+ "src/dsp/mask_blend.h",
+ "src/dsp/motion_field_projection.cc",
+ "src/dsp/motion_field_projection.h",
+ "src/dsp/motion_vector_search.cc",
+ "src/dsp/motion_vector_search.h",
+ "src/dsp/obmc.cc",
+ "src/dsp/obmc.h",
+ "src/dsp/obmc.inc",
+ "src/dsp/smooth_weights.inc",
+ "src/dsp/super_res.cc",
+ "src/dsp/super_res.h",
+ "src/dsp/warp.cc",
+ "src/dsp/warp.h",
+ "src/dsp/weight_mask.cc",
+ "src/dsp/weight_mask.h",
+ "src/dsp/x86/average_blend_sse4.cc",
+ "src/dsp/x86/average_blend_sse4.h",
+ "src/dsp/x86/cdef_avx2.cc",
+ "src/dsp/x86/cdef_avx2.h",
+ "src/dsp/x86/cdef_sse4.cc",
+ "src/dsp/x86/cdef_sse4.h",
+ "src/dsp/x86/common_avx2.h",
+ "src/dsp/x86/common_avx2.inc",
+ "src/dsp/x86/common_sse4.h",
+ "src/dsp/x86/common_sse4.inc",
+ "src/dsp/x86/convolve_avx2.cc",
+ "src/dsp/x86/convolve_avx2.h",
+ "src/dsp/x86/convolve_sse4.cc",
+ "src/dsp/x86/convolve_sse4.h",
+ "src/dsp/x86/convolve_sse4.inc",
+ "src/dsp/x86/distance_weighted_blend_sse4.cc",
+ "src/dsp/x86/distance_weighted_blend_sse4.h",
+ "src/dsp/x86/film_grain_sse4.cc",
+ "src/dsp/x86/film_grain_sse4.h",
+ "src/dsp/x86/intra_edge_sse4.cc",
+ "src/dsp/x86/intra_edge_sse4.h",
+ "src/dsp/x86/intrapred_cfl_sse4.cc",
+ "src/dsp/x86/intrapred_cfl_sse4.h",
+ "src/dsp/x86/intrapred_directional_sse4.cc",
+ "src/dsp/x86/intrapred_directional_sse4.h",
+ "src/dsp/x86/intrapred_filter_sse4.cc",
+ "src/dsp/x86/intrapred_filter_sse4.h",
+ "src/dsp/x86/intrapred_smooth_sse4.cc",
+ "src/dsp/x86/intrapred_smooth_sse4.h",
+ "src/dsp/x86/intrapred_sse4.cc",
+ "src/dsp/x86/intrapred_sse4.h",
+ "src/dsp/x86/inverse_transform_sse4.cc",
+ "src/dsp/x86/inverse_transform_sse4.h",
+ "src/dsp/x86/loop_filter_sse4.cc",
+ "src/dsp/x86/loop_filter_sse4.h",
+ "src/dsp/x86/loop_restoration_10bit_avx2.cc",
+ "src/dsp/x86/loop_restoration_10bit_sse4.cc",
+ "src/dsp/x86/loop_restoration_avx2.cc",
+ "src/dsp/x86/loop_restoration_avx2.h",
+ "src/dsp/x86/loop_restoration_sse4.cc",
+ "src/dsp/x86/loop_restoration_sse4.h",
+ "src/dsp/x86/mask_blend_sse4.cc",
+ "src/dsp/x86/mask_blend_sse4.h",
+ "src/dsp/x86/motion_field_projection_sse4.cc",
+ "src/dsp/x86/motion_field_projection_sse4.h",
+ "src/dsp/x86/motion_vector_search_sse4.cc",
+ "src/dsp/x86/motion_vector_search_sse4.h",
+ "src/dsp/x86/obmc_sse4.cc",
+ "src/dsp/x86/obmc_sse4.h",
+ "src/dsp/x86/super_res_sse4.cc",
+ "src/dsp/x86/super_res_sse4.h",
+ "src/dsp/x86/transpose_sse4.h",
+ "src/dsp/x86/warp_sse4.cc",
+ "src/dsp/x86/warp_sse4.h",
+ "src/dsp/x86/weight_mask_sse4.cc",
+ "src/dsp/x86/weight_mask_sse4.h",
+ "src/film_grain.cc",
+ "src/film_grain.h",
+ "src/frame_buffer.cc",
+ "src/frame_buffer_utils.h",
+ "src/frame_scratch_buffer.h",
+ "src/gav1/decoder.h",
+ "src/gav1/decoder_buffer.h",
+ "src/gav1/decoder_settings.h",
+ "src/gav1/frame_buffer.h",
+ "src/gav1/status_code.h",
+ "src/gav1/symbol_visibility.h",
+ "src/gav1/version.h",
+ "src/inter_intra_masks.inc",
+ "src/internal_frame_buffer_list.cc",
+ "src/internal_frame_buffer_list.h",
+ "src/loop_restoration_info.cc",
+ "src/loop_restoration_info.h",
+ "src/motion_vector.cc",
+ "src/motion_vector.h",
+ "src/obu_parser.cc",
+ "src/obu_parser.h",
+ "src/post_filter.h",
+ "src/post_filter/cdef.cc",
+ "src/post_filter/deblock.cc",
+ "src/post_filter/deblock_thresholds.inc",
+ "src/post_filter/loop_restoration.cc",
+ "src/post_filter/post_filter.cc",
+ "src/post_filter/super_res.cc",
+ "src/prediction_mask.cc",
+ "src/prediction_mask.h",
+ "src/quantizer.cc",
+ "src/quantizer.h",
+ "src/quantizer_tables.inc",
+ "src/reconstruction.cc",
+ "src/reconstruction.h",
+ "src/residual_buffer_pool.cc",
+ "src/residual_buffer_pool.h",
+ "src/scan_tables.inc",
+ "src/status_code.cc",
+ "src/symbol_decoder_context.cc",
+ "src/symbol_decoder_context.h",
+ "src/symbol_decoder_context_cdfs.inc",
+ "src/threading_strategy.cc",
+ "src/threading_strategy.h",
+ "src/tile.h",
+ "src/tile/bitstream/mode_info.cc",
+ "src/tile/bitstream/palette.cc",
+ "src/tile/bitstream/partition.cc",
+ "src/tile/bitstream/transform_size.cc",
+ "src/tile/prediction.cc",
+ "src/tile/tile.cc",
+ "src/tile_scratch_buffer.cc",
+ "src/tile_scratch_buffer.h",
+ "src/utils/array_2d.h",
+ "src/utils/bit_mask_set.h",
+ "src/utils/bit_reader.cc",
+ "src/utils/bit_reader.h",
+ "src/utils/block_parameters_holder.cc",
+ "src/utils/block_parameters_holder.h",
+ "src/utils/blocking_counter.h",
+ "src/utils/common.h",
+ "src/utils/compiler_attributes.h",
+ "src/utils/constants.cc",
+ "src/utils/constants.h",
+ "src/utils/cpu.cc",
+ "src/utils/cpu.h",
+ "src/utils/dynamic_buffer.h",
+ "src/utils/entropy_decoder.cc",
+ "src/utils/entropy_decoder.h",
+ "src/utils/entropy_decoder_test_data.inc",
+ "src/utils/executor.cc",
+ "src/utils/executor.h",
+ "src/utils/logging.cc",
+ "src/utils/logging.h",
+ "src/utils/memory.h",
+ "src/utils/queue.h",
+ "src/utils/raw_bit_reader.cc",
+ "src/utils/raw_bit_reader.h",
+ "src/utils/reference_info.h",
+ "src/utils/segmentation.cc",
+ "src/utils/segmentation.h",
+ "src/utils/segmentation_map.cc",
+ "src/utils/segmentation_map.h",
+ "src/utils/stack.h",
+ "src/utils/threadpool.cc",
+ "src/utils/threadpool.h",
+ "src/utils/types.h",
+ "src/utils/unbounded_queue.h",
+ "src/utils/vector.h",
+ "src/version.cc",
+ "src/warp_prediction.cc",
+ "src/warp_prediction.h",
+ "src/yuv_buffer.cc",
+ "src/yuv_buffer.h",
+ ],
+ hdrs = [
+ "src/gav1/decoder.h",
+ "src/gav1/decoder_buffer.h",
+ "src/gav1/decoder_settings.h",
+ "src/gav1/frame_buffer.h",
+ "src/gav1/status_code.h",
+ "src/gav1/symbol_visibility.h",
+ "src/gav1/version.h",
+ ],
+ includes = ["src"],
+ local_defines = [
+ "LIBGAV1_MAX_BITDEPTH=12",
+ "LIBGAV1_THREADPOOL_USE_STD_MUTEX",
+ "LIBGAV1_ENABLE_LOGGING=0",
+ ],
+ visibility = ["//visibility:public"],
+ #copts = WEBP_COPTS,
+)
diff --git a/chromium/third_party/skia/bazel/external/libjpeg_turbo/BUILD.bazel b/chromium/third_party/skia/bazel/external/libjpeg_turbo/BUILD.bazel
index 11ce1dd791e..c7abc01f911 100644
--- a/chromium/third_party/skia/bazel/external/libjpeg_turbo/BUILD.bazel
+++ b/chromium/third_party/skia/bazel/external/libjpeg_turbo/BUILD.bazel
@@ -2,6 +2,22 @@
# rule in WORKSPACE.bazel, so all files should be relative to that path.
load("@bazel_skylib//lib:selects.bzl", "selects")
+config_setting(
+ name = "mac_arm64",
+ constraint_values = [
+ "@platforms//cpu:arm64",
+ "@platforms//os:macos",
+ ],
+)
+
+selects.config_setting_group(
+ name = "arm_or_arm64",
+ match_any = [
+ "@platforms//cpu:arm",
+ "@platforms//cpu:arm64",
+ ],
+)
+
JPEGTURBO_SRCS = [
"jaricom.c",
"jcapimin.c",
@@ -66,10 +82,11 @@ JPEGTURBO_SRCS = [
"jsimddct.h",
"jutils.c",
"jversion.h",
-] + selects.with_or({
- ("@platforms//cpu:arm", "@platforms//cpu:arm64"): [
+] + select({
+ ":arm_or_arm64": [
"simd/arm/jccolor-neon.c",
"simd/arm/jcgray-neon.c",
+ "simd/arm/jchuff.h",
"simd/arm/jcphuff-neon.c",
"simd/arm/jcsample-neon.c",
"simd/arm/jdcolor-neon.c",
@@ -81,6 +98,8 @@ JPEGTURBO_SRCS = [
"simd/arm/jidctint-neon.c",
"simd/arm/jidctred-neon.c",
"simd/arm/jquanti-neon.c",
+ "simd/arm/neon-compat.h",
+ "simd/jsimd.h",
],
"//conditions:default": ["jsimd_none.c"],
}) + select({
@@ -91,6 +110,31 @@ JPEGTURBO_SRCS = [
"@platforms//cpu:arm64": [
"simd/arm/aarch64/jchuff-neon.c",
"simd/arm/aarch64/jsimd.c",
+ "simd/arm/align.h",
+ ],
+ "//conditions:default": [],
+})
+
+JPEGTURBO_TEXT_HDRS = [
+ "jccolext.c",
+ "jdmrgext.c",
+ "jdcolext.c",
+ "jdcol565.c",
+ "jdmrg565.c",
+ "jstdhuff.c",
+] + select({
+ ":arm_or_arm64": [
+ "simd/arm/jdmrgext-neon.c",
+ "simd/arm/jcgryext-neon.c",
+ "simd/arm/jdcolext-neon.c",
+ ],
+ "//conditions:default": [],
+}) + select({
+ "@platforms//cpu:arm": [
+ "simd/arm/aarch32/jccolext-neon.c",
+ ],
+ "@platforms//cpu:arm64": [
+ "simd/arm/aarch64/jccolext-neon.c",
],
"//conditions:default": [],
})
@@ -101,12 +145,14 @@ JPEGTURBO_DEFINES = [
# support by major browsers.
"C_ARITH_CODING_SUPPORTED=1",
"D_ARITH_CODING_SUPPORTED=1",
-] + selects.with_or({
- ("@platforms//cpu:arm", "@platforms//cpu:arm64"): ["NEON_INTRINSICS"],
+] + select({
+ ":arm_or_arm64": ["NEON_INTRINSICS"],
"//conditions:default": [],
}) + select({
+ # Cuts a 64K table.
+ "//conditions:default": ["USE_CLZ_INTRINSIC"],
+ ":mac_arm64": [], # disabled on M1 macs already
"@platforms//os:windows": [],
- "//conditions:default": ["USE_CLZ_INTRINSIC"], # Cuts a 64K table.
})
cc_library(
@@ -119,15 +165,11 @@ cc_library(
"jpeglib.h",
"jpeglibmangler.h",
],
- local_defines = JPEGTURBO_DEFINES,
- strip_include_prefix = "",
- textual_hdrs = [
- "jccolext.c",
- "jdmrgext.c",
- "jdcolext.c",
- "jdcol565.c",
- "jdmrg565.c",
- "jstdhuff.c",
+ copts = [
+ # There are some #include "neon-compat.h" etc that need this search path
+ "-Iexternal/libjpeg_turbo/simd/arm/",
],
+ local_defines = JPEGTURBO_DEFINES,
+ textual_hdrs = JPEGTURBO_TEXT_HDRS,
visibility = ["//visibility:public"],
)
diff --git a/chromium/third_party/skia/bazel/external/libpng/BUILD.bazel b/chromium/third_party/skia/bazel/external/libpng/BUILD.bazel
index 49efbf71561..bf205bc2f84 100644
--- a/chromium/third_party/skia/bazel/external/libpng/BUILD.bazel
+++ b/chromium/third_party/skia/bazel/external/libpng/BUILD.bazel
@@ -37,7 +37,7 @@ LIBPNG_SRCS = [
"intel/filter_sse2_intrinsics.c",
"intel/intel_init.c",
],
- "@platforms//cpu:arm": [
+ "@platforms//cpu:arm64": [
"arm/arm_init.c",
"arm/filter_neon_intrinsics.c",
"arm/palette_neon_intrinsics.c",
diff --git a/chromium/third_party/skia/bazel/external/libwebp/BUILD.bazel b/chromium/third_party/skia/bazel/external/libwebp/BUILD.bazel
index 01d1dd6297b..423c8198f8c 100644
--- a/chromium/third_party/skia/bazel/external/libwebp/BUILD.bazel
+++ b/chromium/third_party/skia/bazel/external/libwebp/BUILD.bazel
@@ -11,6 +11,16 @@ config_setting(
)
WEBP_SRCS = [
+ "sharpyuv/sharpyuv.c",
+ "sharpyuv/sharpyuv.h",
+ "sharpyuv/sharpyuv_csp.c",
+ "sharpyuv/sharpyuv_csp.h",
+ "sharpyuv/sharpyuv_dsp.c",
+ "sharpyuv/sharpyuv_dsp.h",
+ "sharpyuv/sharpyuv_gamma.c",
+ "sharpyuv/sharpyuv_gamma.h",
+ "sharpyuv/sharpyuv_neon.c",
+ "sharpyuv/sharpyuv_sse2.c",
"src/dec/alpha_dec.c",
"src/dec/alphai_dec.h",
"src/dec/buffer_dec.c",
@@ -41,6 +51,7 @@ WEBP_SRCS = [
"src/dsp/cost_neon.c",
"src/dsp/cost_sse2.c",
"src/dsp/cpu.c",
+ "src/dsp/cpu.h",
"src/dsp/dec.c",
"src/dsp/dec_clip_tables.c",
"src/dsp/dec_mips32.c",
@@ -172,7 +183,6 @@ WEBP_SRCS = [
WEBP_COPTS = [
"-Wno-unused-but-set-variable",
- "-isystem third_party/",
] + select({
"@platforms//cpu:x86_64": ["-msse4.1"],
":cpu_wasm": [], # not sure why wasm doesn't use default
@@ -197,7 +207,7 @@ cc_library(
"src/webp/types.h",
],
copts = WEBP_COPTS,
+ includes = ["src"],
local_defines = WEBP_DEFINES,
- strip_include_prefix = "src/",
visibility = ["//visibility:public"],
)
diff --git a/chromium/third_party/skia/bazel/external/libyuv/BUILD.bazel b/chromium/third_party/skia/bazel/external/libyuv/BUILD.bazel
new file mode 100644
index 00000000000..9c90ba9797a
--- /dev/null
+++ b/chromium/third_party/skia/bazel/external/libyuv/BUILD.bazel
@@ -0,0 +1,96 @@
+# This file will be copied into //third_party/externals/libyuv via the new_local_repository
+# rule in WORKSPACE.bazel, so all files should be relative to that path.
+
+cc_library(
+ name = "libyuv",
+ srcs = [
+ "include/libyuv/basic_types.h",
+ "include/libyuv/compare.h",
+ "include/libyuv/compare_row.h",
+ "include/libyuv/convert.h",
+ "include/libyuv/convert_argb.h",
+ "include/libyuv/convert_from.h",
+ "include/libyuv/convert_from_argb.h",
+ "include/libyuv/cpu_id.h",
+ "include/libyuv/loongson_intrinsics.h",
+ "include/libyuv/macros_msa.h",
+ "include/libyuv/mjpeg_decoder.h",
+ "include/libyuv/planar_functions.h",
+ "include/libyuv/rotate.h",
+ "include/libyuv/rotate_argb.h",
+ "include/libyuv/rotate_row.h",
+ "include/libyuv/row.h",
+ "include/libyuv/scale.h",
+ "include/libyuv/scale_argb.h",
+ "include/libyuv/scale_rgb.h",
+ "include/libyuv/scale_row.h",
+ "include/libyuv/scale_uv.h",
+ "include/libyuv/version.h",
+ "include/libyuv/video_common.h",
+ "source/compare.cc",
+ "source/compare_common.cc",
+ "source/compare_gcc.cc",
+ "source/compare_mmi.cc",
+ "source/compare_msa.cc",
+ "source/compare_neon.cc",
+ "source/compare_neon64.cc",
+ "source/compare_win.cc",
+ "source/convert.cc",
+ "source/convert_argb.cc",
+ "source/convert_from.cc",
+ "source/convert_from_argb.cc",
+ "source/convert_jpeg.cc",
+ "source/convert_to_argb.cc",
+ "source/convert_to_i420.cc",
+ "source/cpu_id.cc",
+ "source/mjpeg_decoder.cc",
+ "source/mjpeg_validate.cc",
+ "source/planar_functions.cc",
+ "source/rotate.cc",
+ "source/rotate_any.cc",
+ "source/rotate_argb.cc",
+ "source/rotate_common.cc",
+ "source/rotate_gcc.cc",
+ "source/rotate_lsx.cc",
+ "source/rotate_mmi.cc",
+ "source/rotate_msa.cc",
+ "source/rotate_neon.cc",
+ "source/rotate_neon64.cc",
+ "source/rotate_win.cc",
+ "source/row_any.cc",
+ "source/row_common.cc",
+ "source/row_gcc.cc",
+ "source/row_lasx.cc",
+ "source/row_lsx.cc",
+ "source/row_mmi.cc",
+ "source/row_msa.cc",
+ "source/row_neon.cc",
+ "source/row_neon64.cc",
+ "source/row_win.cc",
+ "source/scale.cc",
+ "source/scale_any.cc",
+ "source/scale_argb.cc",
+ "source/scale_common.cc",
+ "source/scale_gcc.cc",
+ "source/scale_lsx.cc",
+ "source/scale_mmi.cc",
+ "source/scale_msa.cc",
+ "source/scale_neon.cc",
+ "source/scale_neon64.cc",
+ "source/scale_rgb.cc",
+ "source/scale_uv.cc",
+ "source/scale_win.cc",
+ "source/video_common.cc",
+ ],
+ hdrs = [
+ "include/libyuv.h",
+ ],
+ includes = [
+ "include",
+ ],
+ local_defines = [
+ "AVIF_CODEC_LIBGAV1=1",
+ "AVIF_LIBYUV_ENABLED=1",
+ ],
+ visibility = ["//visibility:public"],
+)
diff --git a/chromium/third_party/skia/bazel/external/perfetto/BUILD.bazel b/chromium/third_party/skia/bazel/external/perfetto/BUILD.bazel
new file mode 100644
index 00000000000..42dde85249a
--- /dev/null
+++ b/chromium/third_party/skia/bazel/external/perfetto/BUILD.bazel
@@ -0,0 +1,13 @@
+# This file will be copied into //third_party/externals/perfetto via the
+# new_local_repository rule in WORKSPACE.bazel, so all files should be relative to that path.
+
+cc_library(
+ name = "perfetto",
+ srcs = ["sdk/perfetto.cc"],
+ hdrs = [
+ "sdk/perfetto.h",
+ ],
+ defines = ["SK_USE_PERFETTO"],
+ includes = ["sdk"],
+ visibility = ["//visibility:public"],
+)
diff --git a/chromium/third_party/skia/bazel/external/spirv_cross/BUILD.bazel b/chromium/third_party/skia/bazel/external/spirv_cross/BUILD.bazel
new file mode 100644
index 00000000000..0b3b4f9ff7f
--- /dev/null
+++ b/chromium/third_party/skia/bazel/external/spirv_cross/BUILD.bazel
@@ -0,0 +1,39 @@
+# This file will be copied into //third_party/externals/spirv-cross via the new_local_repository
+# rule in WORKSPACE.bazel, so all files should be relative to that path.
+
+cc_library(
+ name = "spirv_cross",
+ srcs = [
+ "GLSL.std.450.h",
+ "spirv.hpp",
+ "spirv_cfg.cpp",
+ "spirv_cfg.hpp",
+ "spirv_common.hpp",
+ "spirv_cpp.cpp",
+ "spirv_cpp.hpp",
+ "spirv_cross.cpp",
+ "spirv_cross.hpp",
+ "spirv_cross_containers.hpp",
+ "spirv_cross_error_handling.hpp",
+ "spirv_cross_parsed_ir.cpp",
+ "spirv_cross_parsed_ir.hpp",
+ "spirv_glsl.cpp",
+ "spirv_glsl.hpp",
+ "spirv_hlsl.cpp",
+ "spirv_msl.cpp",
+ "spirv_msl.hpp",
+ "spirv_parser.cpp",
+ "spirv_parser.hpp",
+ "spirv_reflect.cpp",
+ "spirv_reflect.hpp",
+ ],
+ hdrs = [
+ "spirv_hlsl.hpp",
+ ],
+ defines = ["SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS"],
+ includes = [
+ # This allows #include <spirv_hlsl.hpp> to work
+ ".",
+ ],
+ visibility = ["//visibility:public"],
+)
diff --git a/chromium/third_party/skia/bazel/external/wuffs/BUILD.bazel b/chromium/third_party/skia/bazel/external/wuffs/BUILD.bazel
index aecfab99d12..4491b2ad44a 100644
--- a/chromium/third_party/skia/bazel/external/wuffs/BUILD.bazel
+++ b/chromium/third_party/skia/bazel/external/wuffs/BUILD.bazel
@@ -8,6 +8,7 @@ cc_library(
srcs = ["release/c/wuffs-v0.3.c"],
# Thankfully, Bazel doesn't mind a .c file being declared as a public "header".
hdrs = ["release/c/wuffs-v0.3.c"],
+ includes = ["release/c"],
local_defines = [
# Copy/pasting from "release/c/wuffs-*.c":
#
@@ -44,6 +45,5 @@ cc_library(
"WUFFS_CONFIG__MODULE__GIF",
"WUFFS_CONFIG__MODULE__LZW",
],
- strip_include_prefix = "release/c/",
visibility = ["//visibility:public"],
)
diff --git a/chromium/third_party/skia/bazel/external/zlib/BUILD.bazel b/chromium/third_party/skia/bazel/external/zlib/BUILD.bazel
index 47a595a8e3b..a6bf949dbe5 100644
--- a/chromium/third_party/skia/bazel/external/zlib/BUILD.bazel
+++ b/chromium/third_party/skia/bazel/external/zlib/BUILD.bazel
@@ -48,6 +48,14 @@ config_setting(
)
config_setting(
+ name = "mac_arm64",
+ constraint_values = [
+ "@platforms//cpu:arm64",
+ "@platforms//os:macos",
+ ],
+)
+
+config_setting(
name = "windows_x64",
constraint_values = [
"@platforms//cpu:x86_64",
@@ -95,12 +103,13 @@ ZLIB_SRCS = [
"crc_folding.c",
"fill_window_sse.c",
],
- "@platforms//cpu:arm": [
+ "@platforms//cpu:arm64": [
"adler32_simd.h",
"adler32_simd.c",
"contrib/optimizations/chunkcopy.h",
"contrib/optimizations/inffast_chunk.h",
"contrib/optimizations/inffast_chunk.c",
+ "contrib/optimizations/slide_hash_neon.h",
"contrib/optimizations/inflate.c",
"crc32_simd.h",
"crc32_simd.c",
@@ -119,19 +128,25 @@ ZLIB_DEFINES = ["ZLIB_IMPLEMENTATION"] + select({
"INFLATE_CHUNK_SIMD_SSE2",
"DEFLATE_FILL_WINDOW_SSE2",
],
- "@platforms//cpu:arm": [
+ "@platforms//cpu:arm64": [
"ADLER32_SIMD_NEON",
"INFLATE_CHUNK_SIMD_NEON",
+ "INFLATE_CHUNK_READ_64LE",
],
":cpu_wasm": ["CPU_NO_SIMD"],
"//conditions:default": ["CPU_NO_SIMD"],
}) + select({
- ":windows_x64": ["X86_WINDOWS"],
- ":linux_x64": ["X86_NOT_WINDOWS"],
":fuchsia_arm64": [
"X86_NOT_WINDOWS",
"ARMV8_OS_FUCHSIA",
],
+ ":linux_x64": ["X86_NOT_WINDOWS"],
+ ":mac_x64": ["X86_NOT_WINDOWS"],
+ ":mac_arm64": [
+ "ARMV8_OS_MACOS",
+ "CRC32_ARMV8_CRC32",
+ ],
+ ":windows_x64": ["X86_WINDOWS"],
# TODO(kjlubick) other arm flavors
"//conditions:default": ["X86_NOT_WINDOWS"],
})
@@ -142,8 +157,6 @@ ZLIB_COPTS = [
# no-deprecated-non-prototype was added in Clang 14+, used in emscripten for CanvasKit, but
# it is not in Clang 13, currently used for Skia.
"-Wno-unknown-warning-option",
- # Make the headers in contrib available, without exposing them in hdrs.
- "-isystem third_party/",
] + select({
":linux_x64": [
"-mssse3",
@@ -169,7 +182,5 @@ cc_library(
],
copts = ZLIB_COPTS,
local_defines = ZLIB_DEFINES,
- # This allows users of zlib to just do #include "zlib.h"
- strip_include_prefix = "",
visibility = ["//visibility:public"],
)
diff --git a/chromium/third_party/skia/bazel/karma_test.bzl b/chromium/third_party/skia/bazel/karma_test.bzl
index fb79d737d8a..278db82d1a7 100644
--- a/chromium/third_party/skia/bazel/karma_test.bzl
+++ b/chromium/third_party/skia/bazel/karma_test.bzl
@@ -1,4 +1,9 @@
-"""This module defines rules for running JS tests in a browser."""
+"""
+THIS IS THE EXTERNAL-ONLY VERSION OF THIS FILE. G3 DOES NOT HAVE ONE AT ALL.
+
+This module defines rules for running JS tests in a browser.
+
+"""
load("@build_bazel_rules_nodejs//:providers.bzl", "ExternalNpmPackageInfo", "node_modules_aspect")
@@ -62,7 +67,7 @@ def karma_test(name, config_file, srcs, static_files = None, env = None, **kwarg
config_file = config_file,
static_files = static_files,
visibility = ["//visibility:private"],
- tags = ["manual"],
+ tags = ["manual", "no-remote"],
)
# See the following link for the options.
@@ -74,6 +79,13 @@ def karma_test(name, config_file, srcs, static_files = None, env = None, **kwarg
launcher = ":" + karma_test_name,
browser = "@io_bazel_rules_webtesting//browsers:chromium-local",
test = karma_test_name,
+ tags = [
+ # https://bazel.build/reference/be/common-definitions#common.tags
+ "no-remote",
+ # native is required to be set by web_test for reasons that are not
+ # abundantly clear.
+ "native",
+ ],
**kwargs
)
else:
@@ -84,6 +96,14 @@ def karma_test(name, config_file, srcs, static_files = None, env = None, **kwarg
browser = "@io_bazel_rules_webtesting//browsers:chromium-local",
test = karma_test_name,
visibility = ["//visibility:private"],
+ tags = [
+ # https://bazel.build/reference/be/common-definitions#common.tags
+ "no-remote",
+ "manual",
+ # native is required to be set by web_test for reasons that are not
+ # abundantly clear.
+ "native",
+ ],
**kwargs
)
test_on_env(
@@ -91,6 +111,7 @@ def karma_test(name, config_file, srcs, static_files = None, env = None, **kwarg
env = env,
test = ":" + web_test_name,
test_on_env_binary = "@org_skia_go_infra//bazel/test_on_env:test_on_env",
+ tags = ["no-remote"],
)
# This JS code is injected into the the provided karma configuration file. It contains
@@ -145,7 +166,22 @@ function applyChromiumSettings(cfg, chromiumPath) {
cfg.singleRun = false;
} else {
// Invoked via bazel test, so run the tests once in a headless browser and be done
- cfg.browsers = ['ChromeHeadless'];
+ // When running on the CI, we saw errors like "No usable sandbox! Update your kernel or ..
+ // --no-sandbox". concatjs's version https://github.com/bazelbuild/rules_nodejs/blob/700b7a3c5f97f2877320e6e699892ee706f85269/packages/concatjs/web_test/karma.conf.js#L69
+ // detects if sandboxing is supported, but to avoid that complexity, we just always disable
+ // the sandbox. https://docs.travis-ci.com/user/chrome#karma-chrome-launcher
+ cfg.browsers = ['ChromeHeadlessNoSandbox'];
+ cfg.customLaunchers = {
+ 'ChromeHeadlessNoSandbox': {
+ 'base': 'ChromeHeadless',
+ 'flags': [
+ '--no-sandbox',
+ // may help tests be less flaky
+ // https://peter.sh/experiments/chromium-command-line-switches/#browser-test
+ '--browser-test',
+ ],
+ },
+ }
cfg.singleRun = true;
}
diff --git a/chromium/third_party/skia/bazel/linkopts.bzl b/chromium/third_party/skia/bazel/linkopts.bzl
new file mode 100644
index 00000000000..d18a7c6810e
--- /dev/null
+++ b/chromium/third_party/skia/bazel/linkopts.bzl
@@ -0,0 +1,25 @@
+"""
+THIS IS THE EXTERNAL-ONLY VERSION OF THIS FILE. G3 HAS ITS OWN.
+
+This file contains flags for the C++ linker, referred to by Bazel as linkopts.
+
+For similar reasons as //bazel/copts.bzl, we define "global" flags we want to pass to the linker
+here. We do allow subpackages to conditionally set linkopts because that is likely to be more
+readable than trying to express with select statements whether a library should be linked against
+because the relevant Skia source file was compiled in.
+
+"""
+
+OPT_LEVEL = select({
+ "//bazel/common_config_settings:debug_build": [],
+ "//bazel/common_config_settings:release_build": [
+ "-dead_strip",
+ "-Wl,--gc-sections",
+ "-Wl,--strip-all",
+ ],
+ "//bazel/common_config_settings:fast_build": [
+ "-Wl,--strip-debug",
+ ],
+})
+
+DEFAULT_LINKOPTS = OPT_LEVEL
diff --git a/chromium/third_party/skia/bazel/macros.bzl b/chromium/third_party/skia/bazel/macros.bzl
index aec42bf1e53..4cf9d344280 100644
--- a/chromium/third_party/skia/bazel/macros.bzl
+++ b/chromium/third_party/skia/bazel/macros.bzl
@@ -1,4 +1,6 @@
"""
+THIS IS THE EXTERNAL-ONLY VERSION OF THIS FILE. G3 HAS ITS OWN.
+
This file contains general helper macros that make our BUILD.bazel files easier to read.
"""
@@ -8,16 +10,24 @@ load("@rules_python//python:defs.bzl", _py_binary = "py_binary")
load("@py_deps//:requirements.bzl", _requirement = "requirement")
load("@bazel_gazelle//:def.bzl", _gazelle = "gazelle")
load("@emsdk//emscripten_toolchain:wasm_rules.bzl", _wasm_cc_binary = "wasm_cc_binary")
+load("@io_bazel_rules_go//go:def.bzl", _go_binary = "go_binary", _go_library = "go_library")
+load("//bazel/common_config_settings:defs.bzl", _bool_flag = "bool_flag", _string_flag_with_values = "string_flag_with_values")
+load("//bazel:copts.bzl", "DEFAULT_COPTS", "DEFAULT_OBJC_COPTS")
+load("//bazel:linkopts.bzl", "DEFAULT_LINKOPTS")
# re-export symbols that are commonly used or that are not supported in G3
# (and thus we need to stub out)
-selects = _selects
+bool_flag = _bool_flag
+gazelle = _gazelle
+go_binary = _go_binary
+go_library = _go_library
py_binary = _py_binary
requirement = _requirement
-gazelle = _gazelle
+selects = _selects
+string_flag_with_values = _string_flag_with_values
wasm_cc_binary = _wasm_cc_binary
-def select_multi(values_map, default):
+def select_multi(values_map):
"""select() but allowing multiple matches of the keys.
select_multi works around a restriction in native select() that prevents multiple
@@ -27,13 +37,12 @@ def select_multi(values_map, default):
select_multi takes a given map and turns it into several distinct select statements
that have the effect of using any values associated with any active keys.
- For example, if the following parameters are passed in:
+ For example, if the following parameter is passed in:
values_map = {
":alpha": ["apple", "apricot"],
":beta": ["banana"],
":gamma": ["grapefruit"],
- },
- default = []
+ }
it will be unrolled into the following select statements
[] + select({
":apple": ["apple", "apricot"],
@@ -48,26 +57,110 @@ def select_multi(values_map, default):
Args:
values_map: dictionary of labels to a list of labels, just like select()
- default: list of labels, the value that should be used if any of the options do not match.
- This is typically an empty list
Returns:
A list of values that is filled in by the generated select statements.
"""
if len(values_map) == 0:
- return default
+ return []
rv = []
for key, value in values_map.items():
rv += select({
key: value,
- "//conditions:default": default,
+ "//conditions:default": [],
})
return rv
-# buildifier: disable=unnamed-macro
-def cc_library(**kwargs):
- """A shim around cc_library that lets us tweak settings for G3 if necessary."""
- native.cc_library(**kwargs)
+def skia_cc_binary(name, copts = DEFAULT_COPTS, linkopts = DEFAULT_LINKOPTS, **kwargs):
+ """A wrapper around cc_library for Skia C++ executables (e.g. tests).
+
+ This lets us provide compiler flags (copts) and global linker flags (linkopts) consistently
+ to Skia built executables. These executables are almost always things like unit tests and
+ dev tools.
+
+ Args:
+ name: the name of the underlying executable.
+ copts: Flags which should be passed to the C++ compiler. By default, we use DEFAULT_COPTS
+ from //bazel/copts.bzl.
+ linkopts: Global flags which should be passed to the C++ linker. By default, we use
+ DEFAULT_LINKOPTS from //bazel/linkopts.bzl. Other linker flags will be passed in
+ via deps (see deps_and_linkopts below).
+ **kwargs: All the normal arguments that cc_binary takes.
+ """
+ native.cc_binary(name = name, copts = copts, linkopts = linkopts, **kwargs)
+
+def skia_cc_library(name, copts = DEFAULT_COPTS, **kwargs):
+ """A wrapper around cc_library for Skia C++ libraries.
+
+ This lets us provide compiler flags (copts) consistently to the Skia build (e.g. //:skia_public)
+ and builds which depend on those targets (e.g. things in //tools or //modules).
+
+ It also lets us easily tweak these settings when being built in G3.
+
+ Third party libraries should *not* use this directly, as there are likely some flags used
+ by Skia (e.g. warnings) that we do not want to have to fix for third party code.
+
+ Args:
+ name: the name of the underlying library.
+ copts: Flags which should be passed to the C++ compiler. By default, we use DEFAULT_COPTS
+ from //bazel/copts.bzl.
+ **kwargs: All the normal arguments that cc_library takes.
+ """
+ native.cc_library(name = name, copts = copts, **kwargs)
+
+def skia_cc_deps(name, visibility, deps = [], linkopts = [], textual_hdrs = [], testonly = False):
+ """A self-documenting wrapper around cc_library for things to pass to the top skia_cc_library.
+
+ It lets us have third_party deps, linkopts, etc be set close to where they impact,
+ and trickle up the file hierarchy to //:skia_public and //:skia_internal
+
+ Args:
+ name: the name of the underlying target. By convention, this is usually called "deps".
+ visibility: To prevent this rule from being used where it should not, we have the
+ convention of setting the visibility to just the parent package.
+ deps: A list of labels or select statements to collect third_party dependencies.
+ linkopts: A list of strings or select statements to collect linker flags.
+ textual_hdrs: A list of labels or select statements to collect files which are included, but
+ do not have a suffix of .h, like a typical C++ header does.
+ testonly: A boolean that, if true, will enforce all targets who depend on this are also
+ marked as testonly.
+ """
+ native.cc_library(
+ name = name,
+ visibility = visibility,
+ deps = deps,
+ linkopts = linkopts,
+ textual_hdrs = textual_hdrs,
+ testonly = testonly,
+ )
+
+def skia_defines(name, visibility, defines):
+ """A self-documenting wrapper around cc_library for defines"""
+ native.cc_library(name = name, visibility = visibility, defines = defines)
+
+def skia_objc_library(name, copts = DEFAULT_OBJC_COPTS, **kwargs):
+ """A wrapper around cc_library for Skia Objective C libraries.
+
+ This lets us provide compiler flags (copts) consistently to the Skia build (e.g. //:skia_public)
+ and builds which depend on those targets (e.g. things in //tools or //modules).
+
+ It also lets us easily tweak these settings when being built in G3.
+ Args:
+ name: the name of the underlying target.
+ copts: Flags which should be passed to the C++ compiler. By default, we use
+ DEFAULT_OBJC_COPTS from //bazel/copts.bzl.
+ **kwargs: Normal arguments to objc_library
+ """
+
+ # Internally, we need to combine sdk_frameworks and deps, but we can only
+ # do that if both are lists
+ # https://github.com/bazelbuild/bazel/issues/14157
+ sdks = kwargs.get("sdk_frameworks", None)
+ deps = kwargs.get("deps", [])
+ if type(sdks) != "NoneType":
+ if type(sdks) != "list" or type(deps) != "list":
+ fail("skd_frameworks and deps must both be normal lists, not selects")
+ native.objc_library(name = name, copts = copts, **kwargs)
# buildifier: disable=unnamed-macro
def exports_files_legacy(label_list = None, visibility = None):
diff --git a/chromium/third_party/skia/bazel/platform/BUILD.bazel b/chromium/third_party/skia/bazel/platform/BUILD.bazel
new file mode 100644
index 00000000000..9c296f5ac85
--- /dev/null
+++ b/chromium/third_party/skia/bazel/platform/BUILD.bazel
@@ -0,0 +1,48 @@
+# https://bazel.build/concepts/platforms-intro
+# https://bazel.build/docs/platforms
+platform(
+ name = "linux_x64_hermetic",
+ constraint_values = [
+ "@platforms//os:linux", # https://github.com/bazelbuild/platforms/blob/main/os/BUILD
+ "@platforms//cpu:x86_64", # https://github.com/bazelbuild/platforms/blob/main/cpu/BUILD
+ ":use_hermetic_toolchain",
+ ],
+)
+
+platform(
+ name = "mac_x64_hermetic",
+ constraint_values = [
+ "@platforms//os:macos",
+ "@platforms//cpu:x86_64",
+ ":use_hermetic_toolchain",
+ ],
+)
+
+platform(
+ name = "mac_arm64_hermetic",
+ constraint_values = [
+ "@platforms//os:macos",
+ "@platforms//cpu:arm64",
+ ":use_hermetic_toolchain",
+ ],
+)
+
+platform(
+ name = "host_with_hermetic_toolchain",
+ constraint_values = [
+ ":use_hermetic_toolchain",
+ ],
+ parents = ["@local_config_platform//:host"],
+)
+
+# This constraint allows us to force Bazel to resolve our hermetic toolchain to build
+# the target and not a default one (e.g. on the Linux RBE instance). We do this by
+# adding the constraint to our platforms that describe the target we want Bazel to build for.
+# https://bazel.build/reference/be/platform#constraint_setting
+constraint_setting(name = "skia_hermetic_toolchain")
+
+constraint_value(
+ name = "use_hermetic_toolchain",
+ constraint_setting = ":skia_hermetic_toolchain",
+ visibility = ["//visibility:public"],
+)
diff --git a/chromium/third_party/skia/bazel/rbe/BUILD.bazel b/chromium/third_party/skia/bazel/rbe/BUILD.bazel
index 79c2312fb07..dfa5b4de238 100644
--- a/chromium/third_party/skia/bazel/rbe/BUILD.bazel
+++ b/chromium/third_party/skia/bazel/rbe/BUILD.bazel
@@ -3,12 +3,19 @@ load("@bazel_toolchains//rules/exec_properties:exec_properties.bzl", "create_rbe
licenses(["notice"])
+# This platform describes our Linux RBE environment. The machines (aka workers) have x64 cpus
+# and will use the specified Docker container, which is (Debian) Linux and has Clang in it.
+#
+# exec_properties specify some information that is passed along the Remote Execution API (REAPI)
+# to the dispatcher which will use it to direct the request to the appropriate machine/worker,
+# using the Remote Worker API (RWAPI).
# https://bazel.build/docs/platforms
+# http://go/skolo-rbe
platform(
name = "gce_linux_platform",
constraint_values = [
- "@bazel_tools//platforms:linux",
- "@bazel_tools//platforms:x86_64",
+ "@platforms//os:linux",
+ "@platforms//cpu:x86_64",
"@bazel_tools//tools/cpp:clang",
],
exec_properties = create_rbe_exec_properties_dict(
@@ -16,5 +23,4 @@ platform(
os_family = "Linux",
pool = "gce_linux",
),
- parents = ["@local_config_platform//:host"],
)
diff --git a/chromium/third_party/skia/bench/AlternatingColorPatternBench.cpp b/chromium/third_party/skia/bench/AlternatingColorPatternBench.cpp
index 6e82d44f823..fb2b8cd0d98 100644
--- a/chromium/third_party/skia/bench/AlternatingColorPatternBench.cpp
+++ b/chromium/third_party/skia/bench/AlternatingColorPatternBench.cpp
@@ -52,10 +52,10 @@ static void makebm(SkBitmap* bm, int w, int h) {
SkPaint paint;
- paint.setShader(SkGradientShader::MakeLinear(kPts0, kColors0, kPos, SK_ARRAY_COUNT(kColors0),
+ paint.setShader(SkGradientShader::MakeLinear(kPts0, kColors0, kPos, std::size(kColors0),
SkTileMode::kClamp));
canvas.drawPaint(paint);
- paint.setShader(SkGradientShader::MakeLinear(kPts1, kColors1, kPos, SK_ARRAY_COUNT(kColors1),
+ paint.setShader(SkGradientShader::MakeLinear(kPts1, kColors1, kPos, std::size(kColors1),
SkTileMode::kClamp));
canvas.drawPaint(paint);
}
diff --git a/chromium/third_party/skia/bench/BulkRectBench.cpp b/chromium/third_party/skia/bench/BulkRectBench.cpp
index 88918281a41..425f7f0e58c 100644
--- a/chromium/third_party/skia/bench/BulkRectBench.cpp
+++ b/chromium/third_party/skia/bench/BulkRectBench.cpp
@@ -15,7 +15,7 @@
#include "src/core/SkCanvasPriv.h"
#include "src/gpu/ganesh/GrOpsTypes.h"
#include "src/gpu/ganesh/SkGr.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
// Benchmarks that exercise the bulk image and solid color quad APIs, under a variety of patterns:
enum class ImageMode {
@@ -149,8 +149,9 @@ protected:
auto sdc = SkCanvasPriv::TopDeviceSurfaceDrawContext(canvas);
SkMatrix view = canvas->getLocalToDeviceAs3x3();
SkMatrixProvider matrixProvider(view);
+ SkSurfaceProps props;
GrPaint grPaint;
- SkPaintToGrPaint(context, sdc->colorInfo(), paint, matrixProvider, &grPaint);
+ SkPaintToGrPaint(context, sdc->colorInfo(), paint, matrixProvider, props, &grPaint);
sdc->drawQuadSet(nullptr, std::move(grPaint), view, batch, kRectCount);
}
diff --git a/chromium/third_party/skia/bench/ClearBench.cpp b/chromium/third_party/skia/bench/ClearBench.cpp
index 37c5aa36ac1..2a2f4a44708 100644
--- a/chromium/third_party/skia/bench/ClearBench.cpp
+++ b/chromium/third_party/skia/bench/ClearBench.cpp
@@ -18,7 +18,7 @@
#include "include/core/SkRect.h"
#include "include/effects/SkGradientShader.h"
#include "src/core/SkCanvasPriv.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
static sk_sp<SkShader> make_shader() {
static const SkPoint kPts[] = {{0, 0}, {10, 10}};
diff --git a/chromium/third_party/skia/bench/ColorPrivBench.cpp b/chromium/third_party/skia/bench/ColorPrivBench.cpp
index 23cc48f3cc2..a19dc5e2a36 100644
--- a/chromium/third_party/skia/bench/ColorPrivBench.cpp
+++ b/chromium/third_party/skia/bench/ColorPrivBench.cpp
@@ -41,7 +41,7 @@ public:
void onDraw(int loops, SkCanvas*) override {
// We xor results of FourByteInterp into junk to make sure the function runs.
- SK_MAYBE_UNUSED volatile SkPMColor junk = 0;
+ [[maybe_unused]] volatile SkPMColor junk = 0;
for (int loop = 0; loop < loops; loop++) {
for (int i = 0; i < kInputs; i++) {
diff --git a/chromium/third_party/skia/bench/ControlBench.cpp b/chromium/third_party/skia/bench/ControlBench.cpp
index 19696934ab1..5794bfe3e3a 100644
--- a/chromium/third_party/skia/bench/ControlBench.cpp
+++ b/chromium/third_party/skia/bench/ControlBench.cpp
@@ -16,7 +16,7 @@ struct ControlBench : public Benchmark {
void onDraw(int loops, SkCanvas*) override {
// Nothing terribly useful: force a memory read, a memory write, and some math.
- SK_MAYBE_UNUSED volatile uint32_t rand = 0;
+ [[maybe_unused]] volatile uint32_t rand = 0;
for (int i = 0; i < 1000*loops; i++) {
rand *= 1664525;
rand += 1013904223;
diff --git a/chromium/third_party/skia/bench/DashBench.cpp b/chromium/third_party/skia/bench/DashBench.cpp
index 91323b153c8..1cac87ea300 100644
--- a/chromium/third_party/skia/bench/DashBench.cpp
+++ b/chromium/third_party/skia/bench/DashBench.cpp
@@ -308,7 +308,7 @@ public:
static const char* LineTypeName(LineType lt) {
static const char* gNames[] = { "hori", "vert", "diag" };
- static_assert(kLineTypeCount == SK_ARRAY_COUNT(gNames), "names_wrong_size");
+ static_assert(kLineTypeCount == std::size(gNames), "names_wrong_size");
return gNames[lt];
}
@@ -319,7 +319,7 @@ public:
// deliberately pick intervals that won't be caught by asPoints(), so
// we can test the filterPath code-path.
const SkScalar intervals[] = { 20, 10, 10, 10 };
- fPathEffect = SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 0);
+ fPathEffect = SkDashPathEffect::Make(intervals, std::size(intervals), 0);
SkScalar cx = 640 / 2; // center X
SkScalar cy = 480 / 2; // center Y
@@ -439,7 +439,7 @@ private:
static const SkScalar gDots[] = { SK_Scalar1, SK_Scalar1 };
-#define PARAM(array) array, SK_ARRAY_COUNT(array)
+#define PARAM(array) array, std::size(array)
DEF_BENCH( return new DashBench(PARAM(gDots), 0); )
DEF_BENCH( return new DashBench(PARAM(gDots), 1); )
diff --git a/chromium/third_party/skia/bench/FontCacheBench.cpp b/chromium/third_party/skia/bench/FontCacheBench.cpp
index b38eee18d68..4e52ee2b5f1 100644
--- a/chromium/third_party/skia/bench/FontCacheBench.cpp
+++ b/chromium/third_party/skia/bench/FontCacheBench.cpp
@@ -120,7 +120,7 @@ protected:
for (int hashBits = 6; hashBits <= 12; hashBits += 1) {
int hashMask = ((1 << hashBits) - 1);
for (int limit = 32; limit <= 1024; limit <<= 1) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) {
+ for (size_t i = 0; i < std::size(gRec); ++i) {
int collisions = 0;
int glyphs = 0;
const uint16_t* array = gUniqueGlyphIDs;
@@ -169,7 +169,7 @@ protected:
void onDelayedSetup() override {
fFont.setSize(32);
- for (size_t i = 0; i < SK_ARRAY_COUNT(fGlyphs); ++i) {
+ for (size_t i = 0; i < std::size(fGlyphs); ++i) {
fGlyphs[i] = i;
}
}
@@ -178,11 +178,11 @@ protected:
SkPath path;
for (int loop = 0; loop < loops; ++loop) {
if (fOneAtATime) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(fGlyphs); ++i) {
+ for (size_t i = 0; i < std::size(fGlyphs); ++i) {
fFont.getPath(fGlyphs[i], &path);
}
} else {
- fFont.getPaths(fGlyphs, SK_ARRAY_COUNT(fGlyphs),
+ fFont.getPaths(fGlyphs, std::size(fGlyphs),
[](const SkPath* src, const SkMatrix& mx, void* ctx) {
if (src) {
src->transform(mx, static_cast<SkPath*>(ctx));
diff --git a/chromium/third_party/skia/bench/GeometryBench.cpp b/chromium/third_party/skia/bench/GeometryBench.cpp
index 75b867d33b8..43654d6d0f5 100644
--- a/chromium/third_party/skia/bench/GeometryBench.cpp
+++ b/chromium/third_party/skia/bench/GeometryBench.cpp
@@ -52,7 +52,7 @@ protected:
const SkScalar min = -100;
const SkScalar max = 100;
SkRandom rand;
- for (size_t i = 0; i < SK_ARRAY_COUNT(fRects); ++i) {
+ for (size_t i = 0; i < std::size(fRects); ++i) {
SkScalar x = rand.nextRangeScalar(min, max);
SkScalar y = rand.nextRangeScalar(min, max);
SkScalar w = rand.nextRangeScalar(min, max);
@@ -70,7 +70,7 @@ protected:
void onDraw(int loops, SkCanvas* canvas) override {
for (int outer = 0; outer < loops; ++outer) {
int count = 0;
- for (size_t i = 0; i < SK_ARRAY_COUNT(fRects); ++i) {
+ for (size_t i = 0; i < std::size(fRects); ++i) {
SkRect r = fRects[0];
count += r.intersect(fRects[i]);
}
@@ -88,7 +88,7 @@ protected:
for (int outer = 0; outer < loops; ++outer) {
int count = 0;
SkRect r;
- for (size_t i = 0; i < SK_ARRAY_COUNT(fRects); ++i) {
+ for (size_t i = 0; i < std::size(fRects); ++i) {
count += r.intersect(fRects[0], fRects[i]);
}
this->virtualCallToFoilOptimizers(count);
@@ -104,7 +104,7 @@ protected:
void onDraw(int loops, SkCanvas* canvas) override {
for (int outer = 0; outer < loops; ++outer) {
int count = 0;
- for (size_t i = 0; i < SK_ARRAY_COUNT(fRects); ++i) {
+ for (size_t i = 0; i < std::size(fRects); ++i) {
count += SkRect::Intersects(fRects[0], fRects[i]);
}
this->virtualCallToFoilOptimizers(count);
@@ -119,7 +119,7 @@ public:
protected:
void onDraw(int loops, SkCanvas* canvas) override {
for (int outer = 0; outer < loops; ++outer) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(fRects); ++i) {
+ for (size_t i = 0; i < std::size(fRects); ++i) {
fRects[i].sort();
}
}
diff --git a/chromium/third_party/skia/bench/GlyphQuadFillBench.cpp b/chromium/third_party/skia/bench/GlyphQuadFillBench.cpp
index c28eb04e650..b901afdc629 100644
--- a/chromium/third_party/skia/bench/GlyphQuadFillBench.cpp
+++ b/chromium/third_party/skia/bench/GlyphQuadFillBench.cpp
@@ -48,7 +48,7 @@ class DirectMaskGlyphVertexFillBenchmark : public Benchmark {
SkMatrix view = SkMatrix::I();
size_t len = strlen(gText);
- SkGlyphRunBuilder builder;
+ sktext::GlyphRunBuilder builder;
SkPaint paint;
auto glyphRunList = builder.textToGlyphRunList(font, paint, gText, len, {100, 100});
SkASSERT(!glyphRunList.empty());
diff --git a/chromium/third_party/skia/bench/GradientBench.cpp b/chromium/third_party/skia/bench/GradientBench.cpp
index b8eb86ab79c..b453dbf3b1b 100644
--- a/chromium/third_party/skia/bench/GradientBench.cpp
+++ b/chromium/third_party/skia/bench/GradientBench.cpp
@@ -341,7 +341,7 @@ protected:
SkColorSetARGB(alpha, gray, gray, gray),
SK_ColorWHITE };
paint.setShader(SkGradientShader::MakeLinear(pts, colors, nullptr,
- SK_ARRAY_COUNT(colors),
+ std::size(colors),
SkTileMode::kClamp));
canvas->drawRect(r, paint);
}
diff --git a/chromium/third_party/skia/bench/HairlinePathBench.cpp b/chromium/third_party/skia/bench/HairlinePathBench.cpp
index dfafeeb3f36..a88ac65574c 100644
--- a/chromium/third_party/skia/bench/HairlinePathBench.cpp
+++ b/chromium/third_party/skia/bench/HairlinePathBench.cpp
@@ -87,7 +87,7 @@ public:
}
void makePath(SkPath* path) override {
SkRandom rand;
- int size = SK_ARRAY_COUNT(points);
+ int size = std::size(points);
int hSize = size / 2;
for (int i = 0; i < kMaxPathSize; ++i) {
int xTrans = 10 + 40 * (i%(kMaxPathSize/2));
@@ -119,7 +119,7 @@ public:
}
void makePath(SkPath* path) override {
SkRandom rand;
- int size = SK_ARRAY_COUNT(points);
+ int size = std::size(points);
int hSize = size / 2;
for (int i = 0; i < kMaxPathSize; ++i) {
int xTrans = 10 + 40 * (i%(kMaxPathSize/2));
@@ -152,7 +152,7 @@ public:
void makePath(SkPath* path) override {
SkRandom rand;
SkRandom randWeight;
- int size = SK_ARRAY_COUNT(points);
+ int size = std::size(points);
int hSize = size / 2;
for (int i = 0; i < kMaxPathSize; ++i) {
int xTrans = 10 + 40 * (i%(kMaxPathSize/2));
@@ -187,7 +187,7 @@ public:
}
void makePath(SkPath* path) override {
SkRandom rand;
- int size = SK_ARRAY_COUNT(points);
+ int size = std::size(points);
int hSize = size / 2;
for (int i = 0; i < kMaxPathSize; ++i) {
int xTrans = 10 + 40 * (i%(kMaxPathSize/2));
diff --git a/chromium/third_party/skia/bench/ImageFilterCollapse.cpp b/chromium/third_party/skia/bench/ImageFilterCollapse.cpp
index 698af08ab1e..c23367d544a 100644
--- a/chromium/third_party/skia/bench/ImageFilterCollapse.cpp
+++ b/chromium/third_party/skia/bench/ImageFilterCollapse.cpp
@@ -60,7 +60,7 @@ private:
SK_ColorBLACK, SK_ColorGREEN, SK_ColorCYAN,
SK_ColorRED, 0, SK_ColorBLUE, SK_ColorWHITE
};
- paint.setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
+ paint.setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, std::size(colors),
SkTileMode::kClamp));
surf->getCanvas()->drawPaint(paint);
fImage = surf->makeImageSnapshot(); // shader->makeImage()
@@ -90,7 +90,7 @@ protected:
SkTableColorFilter::Make(table3),
};
- this->doPreDraw(colorFilters, SK_ARRAY_COUNT(colorFilters));
+ this->doPreDraw(colorFilters, std::size(colorFilters));
}
private:
@@ -128,7 +128,7 @@ protected:
make_brightness(-0.1f),
};
- this->doPreDraw(colorFilters, SK_ARRAY_COUNT(colorFilters));
+ this->doPreDraw(colorFilters, std::size(colorFilters));
}
};
diff --git a/chromium/third_party/skia/bench/MatrixBench.cpp b/chromium/third_party/skia/bench/MatrixBench.cpp
index 07683ead7e5..b19daa4a8a2 100644
--- a/chromium/third_party/skia/bench/MatrixBench.cpp
+++ b/chromium/third_party/skia/bench/MatrixBench.cpp
@@ -53,7 +53,7 @@ protected:
m2.reset();
// xor into a volatile prevents these comparisons from being optimized away.
- SK_MAYBE_UNUSED volatile bool junk = false;
+ [[maybe_unused]] volatile bool junk = false;
junk ^= (m0 == m1);
junk ^= (m1 == m2);
junk ^= (m2 == m0);
@@ -116,7 +116,7 @@ protected:
fArray[3], fArray[4], fArray[5],
fArray[6], fArray[7], fArray[8]);
// xoring into a volatile prevents the compiler from optimizing these away
- SK_MAYBE_UNUSED volatile int junk = 0;
+ [[maybe_unused]] volatile int junk = 0;
junk ^= (fMatrix.getType());
fMatrix.dirtyMatrixTypeCache();
junk ^= (fMatrix.getType());
diff --git a/chromium/third_party/skia/bench/PDFBench.cpp b/chromium/third_party/skia/bench/PDFBench.cpp
index 668ac4bdaf3..8895bb58ff5 100644
--- a/chromium/third_party/skia/bench/PDFBench.cpp
+++ b/chromium/third_party/skia/bench/PDFBench.cpp
@@ -210,7 +210,7 @@ struct PDFShaderBench : public Benchmark {
SK_ColorWHITE, SK_ColorBLACK,
};
fShader = SkGradientShader::MakeLinear(
- pts, colors, nullptr, SK_ARRAY_COUNT(colors),
+ pts, colors, nullptr, std::size(colors),
SkTileMode::kClamp);
}
void onDraw(int loops, SkCanvas*) final {
@@ -372,7 +372,7 @@ void big_pdf_test(SkDocument* doc, const SkBitmap& background) {
SkCanvas* canvas = nullptr;
float x = 36;
float y = 36;
- constexpr size_t kLineCount = SK_ARRAY_COUNT(kText);
+ constexpr size_t kLineCount = std::size(kText);
constexpr int kLoopCount = 200;
SkFont font;
SkPaint paint;
diff --git a/chromium/third_party/skia/bench/PatchBench.cpp b/chromium/third_party/skia/bench/PatchBench.cpp
index 1228dc1e49a..9eedf3b56ee 100644
--- a/chromium/third_party/skia/bench/PatchBench.cpp
+++ b/chromium/third_party/skia/bench/PatchBench.cpp
@@ -78,7 +78,7 @@ public:
};
const SkPoint pts[] = { { 200.f / 4.f, 0.f }, { 3.f * 200.f / 4, 200.f } };
- return SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
+ return SkGradientShader::MakeLinear(pts, colors, nullptr, std::size(colors),
SkTileMode::kMirror);
}
diff --git a/chromium/third_party/skia/bench/RectBench.cpp b/chromium/third_party/skia/bench/RectBench.cpp
index d73d0406ad3..a3a3099cf90 100644
--- a/chromium/third_party/skia/bench/RectBench.cpp
+++ b/chromium/third_party/skia/bench/RectBench.cpp
@@ -228,7 +228,7 @@ protected:
SkScalar gSizes[] = {
SkIntToScalar(7), 0
};
- size_t sizes = SK_ARRAY_COUNT(gSizes);
+ size_t sizes = std::size(gSizes);
if (FLAGS_strokeWidth >= 0) {
gSizes[0] = (SkScalar)FLAGS_strokeWidth;
@@ -279,7 +279,7 @@ protected:
SkScalar gSizes[] = {
SkIntToScalar(13), SkIntToScalar(24)
};
- size_t sizes = SK_ARRAY_COUNT(gSizes);
+ size_t sizes = std::size(gSizes);
if (FLAGS_strokeWidth >= 0) {
gSizes[0] = (SkScalar)FLAGS_strokeWidth;
diff --git a/chromium/third_party/skia/bench/ScalarBench.cpp b/chromium/third_party/skia/bench/ScalarBench.cpp
index e47fc63aeef..80e96afb2d0 100644
--- a/chromium/third_party/skia/bench/ScalarBench.cpp
+++ b/chromium/third_party/skia/bench/ScalarBench.cpp
@@ -59,7 +59,7 @@ protected:
int mulLoopCount() const override { return 4; }
void performTest() override {
// xoring into a volatile prevents the compiler from optimizing these checks away.
- SK_MAYBE_UNUSED volatile bool junk = false;
+ [[maybe_unused]] volatile bool junk = false;
junk ^= (fArray[6] != 0.0f || fArray[7] != 0.0f || fArray[8] != 1.0f);
junk ^= (fArray[2] != 0.0f || fArray[5] != 0.0f);
}
@@ -78,7 +78,7 @@ protected:
int mulLoopCount() const override { return 4; }
void performTest() override {
// xoring into a volatile prevents the compiler from optimizing these checks away.
- SK_MAYBE_UNUSED volatile int32_t junk = 0;
+ [[maybe_unused]] volatile int32_t junk = 0;
junk ^= (SkScalarAs2sCompliment(fArray[6]) |
SkScalarAs2sCompliment(fArray[7]) |
(SkScalarAs2sCompliment(fArray[8]) - kPersp1Int));
diff --git a/chromium/third_party/skia/bench/Sk4fBench.cpp b/chromium/third_party/skia/bench/Sk4fBench.cpp
index 29b6647eddb..3144caa73b1 100644
--- a/chromium/third_party/skia/bench/Sk4fBench.cpp
+++ b/chromium/third_party/skia/bench/Sk4fBench.cpp
@@ -75,7 +75,7 @@ struct Sk4fGradientBench : public Benchmark {
b = a + dcdx,
c = b + dcdx,
d = c + dcdx;
- for (size_t i = 0; i < SK_ARRAY_COUNT(fDevice); i += 4) {
+ for (size_t i = 0; i < std::size(fDevice); i += 4) {
skvx::cast<uint8_t>(a).store(fDevice + i + 0);
skvx::cast<uint8_t>(b).store(fDevice + i + 1);
skvx::cast<uint8_t>(c).store(fDevice + i + 2);
diff --git a/chromium/third_party/skia/bench/SkSLBench.cpp b/chromium/third_party/skia/bench/SkSLBench.cpp
index cfc2eb8e02e..42589cb5e81 100644
--- a/chromium/third_party/skia/bench/SkSLBench.cpp
+++ b/chromium/third_party/skia/bench/SkSLBench.cpp
@@ -14,6 +14,7 @@
#include "src/sksl/SkSLCompiler.h"
#include "src/sksl/SkSLDSLParser.h"
#include "src/sksl/codegen/SkSLVMCodeGenerator.h"
+#include "src/sksl/ir/SkSLProgram.h"
#include <regex>
@@ -150,7 +151,7 @@ private:
std::string fSrc;
GrMockCaps fCaps;
SkSL::Compiler fCompiler;
- SkSL::Program::Settings fSettings;
+ SkSL::ProgramSettings fSettings;
Output fOutput;
using INHERITED = Benchmark;
diff --git a/chromium/third_party/skia/bench/TessellateBench.cpp b/chromium/third_party/skia/bench/TessellateBench.cpp
index 21cd6fec9b4..9dd25245916 100644
--- a/chromium/third_party/skia/bench/TessellateBench.cpp
+++ b/chromium/third_party/skia/bench/TessellateBench.cpp
@@ -63,7 +63,7 @@ static SkPath make_conic_path() {
return path;
}
-SK_MAYBE_UNUSED static SkPath make_quad_path(int maxPow2) {
+[[maybe_unused]] static SkPath make_quad_path(int maxPow2) {
SkRandom rand;
SkPath path;
for (int i = 0; i < kNumCubicsInChalkboard; ++i) {
@@ -73,7 +73,7 @@ SK_MAYBE_UNUSED static SkPath make_quad_path(int maxPow2) {
return path;
}
-SK_MAYBE_UNUSED static SkPath make_line_path(int maxPow2) {
+[[maybe_unused]] static SkPath make_line_path(int maxPow2) {
SkRandom rand;
SkPath path;
for (int i = 0; i < kNumCubicsInChalkboard; ++i) {
diff --git a/chromium/third_party/skia/bench/TopoSortBench.cpp b/chromium/third_party/skia/bench/TopoSortBench.cpp
index 42abce5d2d7..7ab713c16cd 100644
--- a/chromium/third_party/skia/bench/TopoSortBench.cpp
+++ b/chromium/third_party/skia/bench/TopoSortBench.cpp
@@ -49,9 +49,9 @@ protected:
fGraph[j]->reset();
}
- ToolUtils::TopoTestNode::Shuffle(&fGraph, &fRand);
+ ToolUtils::TopoTestNode::Shuffle(fGraph, &fRand);
- SkDEBUGCODE(bool actualResult =) GrTTopoSort<ToolUtils::TopoTestNode>(&fGraph);
+ SkDEBUGCODE(bool actualResult =) GrTTopoSort<ToolUtils::TopoTestNode>(fGraph);
SkASSERT(actualResult);
#ifdef SK_DEBUG
diff --git a/chromium/third_party/skia/bench/TriangulatorBench.cpp b/chromium/third_party/skia/bench/TriangulatorBench.cpp
index f67071d571b..80938788f9c 100644
--- a/chromium/third_party/skia/bench/TriangulatorBench.cpp
+++ b/chromium/third_party/skia/bench/TriangulatorBench.cpp
@@ -580,4 +580,4 @@ TigerPath kTigerPaths[] = {
{36.856f,98.898f}}},
};
-int kNumTigerPaths = (int)SK_ARRAY_COUNT(kTigerPaths);
+int kNumTigerPaths = (int)std::size(kTigerPaths);
diff --git a/chromium/third_party/skia/bench/TypefaceBench.cpp b/chromium/third_party/skia/bench/TypefaceBench.cpp
index 6c1c5de65a9..725f85b9973 100644
--- a/chromium/third_party/skia/bench/TypefaceBench.cpp
+++ b/chromium/third_party/skia/bench/TypefaceBench.cpp
@@ -298,19 +298,19 @@ private:
const char* fName;
};
-DEF_BENCH(return new UtfToGlyph(SkTextEncoding::kUTF32, ctext, SK_ARRAY_COUNT(ctext),
+DEF_BENCH(return new UtfToGlyph(SkTextEncoding::kUTF32, ctext, std::size(ctext),
"SkTypefaceUTF32ToGlyphCN");)
-DEF_BENCH(return new UtfToGlyph(SkTextEncoding::kUTF16, ctext, SK_ARRAY_COUNT(ctext),
+DEF_BENCH(return new UtfToGlyph(SkTextEncoding::kUTF16, ctext, std::size(ctext),
"SkTypefaceUTF16ToGlyphCN");)
-DEF_BENCH(return new UtfToGlyph(SkTextEncoding::kUTF8, ctext, SK_ARRAY_COUNT(ctext),
+DEF_BENCH(return new UtfToGlyph(SkTextEncoding::kUTF8, ctext, std::size(ctext),
"SkTypefaceUTF8ToGlyphCN");)
-DEF_BENCH(return new UtfToGlyph(SkTextEncoding::kUTF32, atext, SK_ARRAY_COUNT(atext),
+DEF_BENCH(return new UtfToGlyph(SkTextEncoding::kUTF32, atext, std::size(atext),
"SkTypefaceUTF32ToGlyphAscii");)
-DEF_BENCH(return new UtfToGlyph(SkTextEncoding::kUTF16, atext, SK_ARRAY_COUNT(atext),
+DEF_BENCH(return new UtfToGlyph(SkTextEncoding::kUTF16, atext, std::size(atext),
"SkTypefaceUTF16ToGlyphAscii");)
-DEF_BENCH(return new UtfToGlyph(SkTextEncoding::kUTF8, atext, SK_ARRAY_COUNT(atext),
+DEF_BENCH(return new UtfToGlyph(SkTextEncoding::kUTF8, atext, std::size(atext),
"SkTypefaceUTF8ToGlyphAscii");)
diff --git a/chromium/third_party/skia/bench/VertexColorSpaceBench.cpp b/chromium/third_party/skia/bench/VertexColorSpaceBench.cpp
index 3487d5604c4..4af6340a430 100644
--- a/chromium/third_party/skia/bench/VertexColorSpaceBench.cpp
+++ b/chromium/third_party/skia/bench/VertexColorSpaceBench.cpp
@@ -17,13 +17,13 @@
#include "src/gpu/ganesh/GrMemoryPool.h"
#include "src/gpu/ganesh/GrProgramInfo.h"
#include "src/gpu/ganesh/SkGr.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/glsl/GrGLSLColorSpaceXformHelper.h"
#include "src/gpu/ganesh/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/ganesh/glsl/GrGLSLVarying.h"
#include "src/gpu/ganesh/glsl/GrGLSLVertexGeoBuilder.h"
#include "src/gpu/ganesh/ops/GrMeshDrawOp.h"
#include "src/gpu/ganesh/ops/GrSimpleMeshDrawOpHelper.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
namespace {
@@ -311,7 +311,8 @@ public:
for (int i = 0; i < loops; ++i) {
auto sdc = skgpu::v1::SurfaceDrawContext::Make(context, GrColorType::kRGBA_8888, p3,
SkBackingFit::kApprox, {100, 100},
- SkSurfaceProps());
+ SkSurfaceProps(),
+ /*label=*/"DrawVertexColorSpaceBench");
SkASSERT(sdc);
for (int j = 0; j < kDrawsPerLoop; ++j) {
diff --git a/chromium/third_party/skia/bench/graphite/BoundsManagerBench.cpp b/chromium/third_party/skia/bench/graphite/BoundsManagerBench.cpp
new file mode 100644
index 00000000000..d5d9ed79353
--- /dev/null
+++ b/chromium/third_party/skia/bench/graphite/BoundsManagerBench.cpp
@@ -0,0 +1,181 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#include "bench/Benchmark.h"
+#include "include/core/SkPaint.h"
+#include "include/core/SkPath.h"
+#include "include/utils/SkRandom.h"
+#include "src/core/SkArenaAlloc.h"
+#include "src/gpu/graphite/geom/BoundsManager.h"
+#include "tools/ToolUtils.h"
+#include "tools/flags/CommandLineFlags.h"
+
+static DEFINE_string(boundsManagerFile, "",
+ "svg or skp for the BoundsManager bench to sniff paths from.");
+
+#define PRINT_DRAWSET_COUNT 0 // set to 1 to display number of CompressedPaintersOrder groups
+
+namespace skgpu::graphite {
+
+class BoundsManagerBench : public Benchmark {
+public:
+ BoundsManagerBench(std::unique_ptr<BoundsManager> manager) : fManager(std::move(manager)) {}
+
+protected:
+ virtual void gatherRects(SkTArray<SkRect>* rects) = 0;
+
+ bool isSuitableFor(Backend backend) override {
+ return backend == kNonRendering_Backend;
+ }
+
+ const char* onGetName() final { return fName.c_str(); }
+
+ void onDelayedSetup() final {
+ SkTArray<SkRect> rects;
+ this->gatherRects(&rects);
+
+ fRectCount = rects.count();
+ fRects = fAlignedAllocator.makeArray<Rect>(fRectCount);
+ for (int i = 0; i < fRectCount; ++i) {
+ fRects[i] = rects[i];
+ }
+ }
+
+ void onDraw(int loops, SkCanvas*) final {
+ for (int i = 0; i < loops; ++i) {
+ this->doBench();
+ }
+ }
+
+ void onPerCanvasPostDraw(SkCanvas*) override {
+#if PRINT_DRAWSET_COUNT
+ SkDebugf("%s >> grouped %d draws into %d sets <<\n",
+ fName.c_str(), fRectCount, fMaxRead.bits());
+#endif
+ }
+
+ void doBench() {
+ CompressedPaintersOrder maxRead = CompressedPaintersOrder::First();
+ for (int i = 0; i < fRectCount; ++i) {
+ const Rect& drawBounds = fRects[i];
+ CompressedPaintersOrder order = fManager->getMostRecentDraw(drawBounds).next();
+ fManager->recordDraw(drawBounds, order);
+ if (order > maxRead) {
+ maxRead = order;
+ }
+ }
+
+ fMaxRead = maxRead;
+ fManager->reset();
+ }
+
+ std::unique_ptr<BoundsManager> fManager;
+ SkString fName;
+ SkArenaAlloc fAlignedAllocator{0};
+ int fRectCount;
+ Rect* fRects;
+
+ CompressedPaintersOrder fMaxRead;
+};
+
+class RandomBoundsManagerBench : public BoundsManagerBench {
+public:
+ RandomBoundsManagerBench(std::unique_ptr<BoundsManager> manager,
+ const char* managerName,
+ int numRandomRects)
+ : BoundsManagerBench(std::move(manager))
+ , fNumRandomRects(numRandomRects) {
+ fName.printf("BoundsManager_rand_%i_%s", numRandomRects, managerName);
+ }
+
+private:
+ void gatherRects(SkTArray<SkRect>* rects) override {
+ SkRandom rand;
+ for (int i = 0; i < fNumRandomRects; ++i) {
+ rects->push_back(SkRect::MakeXYWH(rand.nextRangeF(0, 2000),
+ rand.nextRangeF(0, 2000),
+ rand.nextRangeF(0, 70),
+ rand.nextRangeF(0, 70)));
+ }
+ }
+
+ int fNumRandomRects;
+};
+
+class FileBoundsManagerBench : public BoundsManagerBench {
+public:
+ FileBoundsManagerBench(std::unique_ptr<BoundsManager> manager,
+ const char* managerName)
+ : BoundsManagerBench(std::move(manager)) {
+ if (!FLAGS_boundsManagerFile.isEmpty()) {
+ const char* filename = strrchr(FLAGS_boundsManagerFile[0], '/');
+ if (filename) {
+ ++filename;
+ } else {
+ filename = FLAGS_boundsManagerFile[0];
+ }
+ fName.printf("BoundsManager_file_%s_%s", filename, managerName);
+ }
+ }
+
+private:
+ bool isSuitableFor(Backend backend) final {
+ if (FLAGS_boundsManagerFile.isEmpty()) {
+ return false;
+ }
+ return BoundsManagerBench::isSuitableFor(backend);
+ }
+
+ void gatherRects(SkTArray<SkRect>* rects) override {
+ if (FLAGS_boundsManagerFile.isEmpty()) {
+ return;
+ }
+ SkRect fileBounds = SkRect::MakeEmpty();
+ ToolUtils::sniff_paths(FLAGS_boundsManagerFile[0], [&](const SkMatrix& matrix,
+ const SkPath& path,
+ const SkPaint& paint) {
+ if (!paint.canComputeFastBounds() || path.isInverseFillType()) {
+ // These would pessimistically cover the entire canvas, but we don't have enough
+ // info in the benchmark to handle that, so just skip these draws.
+ return;
+ }
+
+ SkRect bounds = path.getBounds();
+ SkRect drawBounds = matrix.mapRect(paint.computeFastBounds(bounds, &bounds));
+ rects->push_back(drawBounds);
+
+ fileBounds.join(drawBounds);
+ });
+
+#if PRINT_DRAWSET_COUNT
+ SkDebugf("%s bounds are [%f %f %f %f]\n",
+ FLAGS_boundsManagerFile[0],
+ fileBounds.fLeft, fileBounds.fTop, fileBounds.fRight, fileBounds.fBottom);
+#endif
+ }
+
+};
+
+} // namespace skgpu::graphite
+
+#define DEF_BOUNDS_MANAGER_BENCH_SET(manager, name) \
+ DEF_BENCH( return new skgpu::graphite::RandomBoundsManagerBench(manager, name, 100); ) \
+ DEF_BENCH( return new skgpu::graphite::RandomBoundsManagerBench(manager, name, 500); ) \
+ DEF_BENCH( return new skgpu::graphite::RandomBoundsManagerBench(manager, name, 1000); ) \
+ DEF_BENCH( return new skgpu::graphite::RandomBoundsManagerBench(manager, name, 10000); ) \
+ DEF_BENCH( return new skgpu::graphite::FileBoundsManagerBench(manager, name); )
+
+
+DEF_BOUNDS_MANAGER_BENCH_SET(std::make_unique<skgpu::graphite::NaiveBoundsManager>(), "naive")
+DEF_BOUNDS_MANAGER_BENCH_SET(std::make_unique<skgpu::graphite::BruteForceBoundsManager>(), "brute")
+DEF_BOUNDS_MANAGER_BENCH_SET(skgpu::graphite::GridBoundsManager::Make({1800, 1800}, 128), "grid128")
+DEF_BOUNDS_MANAGER_BENCH_SET(skgpu::graphite::GridBoundsManager::Make({1800, 1800}, 512), "grid512")
+DEF_BOUNDS_MANAGER_BENCH_SET(std::make_unique<skgpu::graphite::HybridBoundsManager>(SkISize{1800, 1800}, 16, 64), "hybrid16x16n128")
+DEF_BOUNDS_MANAGER_BENCH_SET(std::make_unique<skgpu::graphite::HybridBoundsManager>(SkISize{1800, 1800}, 16, 128), "hybrid16x16n256")
+// Uncomment and adjust device size to match reported bounds from --boundsManagerFile
+// DEF_BOUNDS_MANAGER_BENCH_SET(skgpu::graphite::GridBoundsManager::MakeRes({w, h}, 8), "gridRes8")
+
+#undef DEF_BOUNDS_MANAGER_BENCH_SET
diff --git a/chromium/third_party/skia/bench/nanobench.cpp b/chromium/third_party/skia/bench/nanobench.cpp
index be2acbc5e0a..05990f78a69 100644
--- a/chromium/third_party/skia/bench/nanobench.cpp
+++ b/chromium/third_party/skia/bench/nanobench.cpp
@@ -45,6 +45,7 @@
#include "tools/MSKPPlayer.h"
#include "tools/ProcStats.h"
#include "tools/Stats.h"
+#include "tools/ToolUtils.h"
#include "tools/flags/CommonFlags.h"
#include "tools/flags/CommonFlagsConfig.h"
#include "tools/ios_utils.h"
@@ -204,6 +205,10 @@ static DEFINE_string(properties, "",
static DEFINE_bool(purgeBetweenBenches, false,
"Call SkGraphics::PurgeAllCaches() between each benchmark?");
+static DEFINE_bool(splitPerfettoTracesByBenchmark, true,
+ "Create separate perfetto trace files for each benchmark?\n"
+ "Will only take effect if perfetto tracing is enabled. See --trace.");
+
static double now_ms() { return SkTime::GetNSecs() * 1e-6; }
static SkString humanize(double ms) {
@@ -351,7 +356,7 @@ struct GraphiteTarget : public Target {
this->testContext = testCtx;
this->context = ctx;
- this->recorder = this->context->makeRecorder();
+ this->recorder = this->context->makeRecorder(ToolUtils::CreateTestingRecorderOptions());
if (!this->recorder) {
return false;
}
@@ -1125,7 +1130,7 @@ public:
continue;
}
- while (fCurrentSampleSize < (int) SK_ARRAY_COUNT(sampleSizes)) {
+ while (fCurrentSampleSize < (int) std::size(sampleSizes)) {
int sampleSize = sampleSizes[fCurrentSampleSize];
fCurrentSampleSize++;
if (10 * sampleSize > std::min(codec->getInfo().width(), codec->getInfo().height())) {
@@ -1165,7 +1170,7 @@ public:
}
while (fCurrentColorType < fColorTypes.count()) {
- while (fCurrentSampleSize < (int) SK_ARRAY_COUNT(brdSampleSizes)) {
+ while (fCurrentSampleSize < (int) std::size(brdSampleSizes)) {
while (fCurrentSubsetType <= kLastSingle_SubsetType) {
sk_sp<SkData> encoded(SkData::MakeFromFileName(path.c_str()));
@@ -1229,14 +1234,14 @@ public:
}
void fillCurrentOptions(NanoJSONResultsWriter& log) const {
- log.appendString("source_type", fSourceType);
- log.appendString("bench_type", fBenchType);
+ log.appendCString("source_type", fSourceType);
+ log.appendCString("bench_type", fBenchType);
if (0 == strcmp(fSourceType, "skp")) {
log.appendString("clip",
SkStringPrintf("%d %d %d %d", fClip.fLeft, fClip.fTop,
- fClip.fRight, fClip.fBottom).c_str());
+ fClip.fRight, fClip.fBottom));
SkASSERT_RELEASE(fCurrentScale < fScales.count()); // debugging paranoia
- log.appendString("scale", SkStringPrintf("%.2g", fScales[fCurrentScale]).c_str());
+ log.appendString("scale", SkStringPrintf("%.2g", fScales[fCurrentScale]));
}
}
@@ -1371,7 +1376,7 @@ int main(int argc, char** argv) {
return 1;
}
for (int i = 1; i < FLAGS_properties.count(); i += 2) {
- log.appendString(FLAGS_properties[i-1], FLAGS_properties[i]);
+ log.appendCString(FLAGS_properties[i-1], FLAGS_properties[i]);
}
if (1 == FLAGS_key.count() % 2) {
@@ -1381,7 +1386,7 @@ int main(int argc, char** argv) {
if (FLAGS_key.count()) {
log.beginObject("key");
for (int i = 1; i < FLAGS_key.count(); i += 2) {
- log.appendString(FLAGS_key[i - 1], FLAGS_key[i]);
+ log.appendCString(FLAGS_key[i - 1], FLAGS_key[i]);
}
log.endObject(); // key
}
@@ -1461,6 +1466,9 @@ int main(int argc, char** argv) {
SkGraphics::PurgeAllCaches();
}
+ if (FLAGS_splitPerfettoTracesByBenchmark) {
+ TRACE_EVENT_API_NEW_TRACE_SECTION(TRACE_STR_COPY(bench->getUniqueName()));
+ }
TRACE_EVENT2("skia", "Benchmark", "name", TRACE_STR_COPY(bench->getUniqueName()),
"config", TRACE_STR_COPY(config));
@@ -1541,7 +1549,7 @@ int main(int argc, char** argv) {
log.beginObject(config);
log.beginObject("options");
- log.appendString("name", bench->getName());
+ log.appendCString("name", bench->getName());
benchStream.fillCurrentOptions(log);
log.endObject(); // options
diff --git a/chromium/third_party/skia/bin/activate-emsdk b/chromium/third_party/skia/bin/activate-emsdk
index 514f331a24f..85badfdf0f4 100755
--- a/chromium/third_party/skia/bin/activate-emsdk
+++ b/chromium/third_party/skia/bin/activate-emsdk
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Copyright 2022 Google LLC
#
@@ -8,14 +8,20 @@
import os
import subprocess
import sys
+import sysconfig
EMSDK_ROOT = os.path.join('third_party', 'externals', 'emsdk')
EMSDK_PATH = os.path.join(EMSDK_ROOT, 'emsdk.py')
-EMSDK_VERSION = '3.1.9'
+EMSDK_VERSION = '3.1.15'
def main():
+ if sysconfig.get_platform() in ['linux-aarch64', 'linux-arm64']:
+ # This platform cannot install emsdk at the provided version. See
+ # https://github.com/emscripten-core/emsdk/blob/main/emscripten-releases-tags.json#L5
+ # for the latest version
+ return
try:
subprocess.check_call([sys.executable, EMSDK_PATH, 'install', EMSDK_VERSION])
except subprocess.CalledProcessError:
diff --git a/chromium/third_party/skia/build/fuchsia/skqp/BUILD.gn b/chromium/third_party/skia/build/fuchsia/skqp/BUILD.gn
deleted file mode 100644
index f905abd3267..00000000000
--- a/chromium/third_party/skia/build/fuchsia/skqp/BUILD.gn
+++ /dev/null
@@ -1,131 +0,0 @@
-# Copyright 2019 Google LLC. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-assert(is_fuchsia)
-
-import("//build/fuchsia/sdk.gni")
-
-pkg_dir = target_gen_dir
-pkg_name = "skqp_pkg"
-
-fuchsia_package(pkg_name) {
- testonly = true
- name = pkg_name
- version = 0
- deps = [
- "//:skqp",
- "//build/fuchsia",
- ]
- pkg_manifest = "${pkg_dir}/${target_name}.manifest"
-}
-
-fuchsia_repo("skqp_repo") {
- testonly = true
- deps = [
- ":append_assets_to_manifest",
- ":base_manifest",
- ":skqp_pkg",
- ]
-
- # Put repo directory in out dir (not gen dir).
- repo = "$target_out_dir/skqp_repo"
- archives = [ "$root_out_dir/far/skqp_pkg.far" ]
-}
-
-#
-# Base manifest entries (w/o assets) for SKQP.
-#
-# TODO(rosasco): Convert this group() to generated_file() when a
-# sufficiently modern version of gn rolls in.
-group("base_manifest") {
- base_pkg_manifest = "${pkg_dir}/base_${pkg_name}.manifest"
-
- skqp_exec = rebase_path("${root_out_dir}/skqp")
- skqp_path = rebase_path("${target_gen_dir}")
-
- sdk_dist_path = rebase_path("${fuchsia_sdk_path}/arch/${target_cpu}/dist")
- sdk_sysroot_dist_path =
- rebase_path("${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/dist/lib")
- layer_path = rebase_path("${fuchsia_sdk_path}/pkg/vulkan_layers")
-
- skqp_component_manifest = rebase_path("//build/fuchsia/skqp/skqp.cmx")
-
- if (target_cpu == "x64" || target_cpu == "x86_64") {
- clang_path =
- rebase_path("${fuchsia_toolchain_path}/lib/x86_64-unknown-fuchsia/c++")
- } else if (target_cpu == "arm64") {
- clang_path =
- rebase_path("${fuchsia_toolchain_path}/lib/aarch64-unknown-fuchsia/c++")
- } else {
- assert(false, "Unknown target cpu for Fuchsia target.")
- }
-
- manifest_entries = [
- # Binary
- "bin/skqp=${skqp_exec}",
-
- # Meta Data
- "meta/package=${skqp_path}/meta/package",
- "meta/skqp.cmx=${skqp_component_manifest}",
-
- # Shared Libs (clang c++)
- "lib/libc++.so.2=${clang_path}/libc++.so.2",
- "lib/libc++abi.so.1=${clang_path}/libc++abi.so.1",
- "lib/libunwind.so.1=${clang_path}/libunwind.so.1",
-
- # Shared Libs (sdk dist)
- "lib/libasync-default.so=${sdk_dist_path}/libasync-default.so",
- "lib/libfdio.so=${sdk_dist_path}/libfdio.so",
- "lib/libtrace-engine.so=${sdk_dist_path}/libtrace-engine.so",
-
- # Loader
- "lib/ld.so.1=${sdk_sysroot_dist_path}/ld.so.1",
-
- # Vulkan ICD / Validation / Loader
- "lib/libvulkan.so=${sdk_dist_path}/libvulkan.so",
- "lib/VkLayer_khronos_validation.so=${sdk_dist_path}/VkLayer_khronos_validation.so",
-
- "data/vulkan/explicit_layer.d/VkLayer_khronos_validation.json=${layer_path}/data/vulkan/explicit_layer.d/VkLayer_khronos_validation.json",
- ]
-
- # TODO(rosasco): Add 2 lines when generated_file() switch is implemented
- # and remove the 'write_file' below.
- # contents = manifest_entries
- # outputs = [ base_pkg_manifest ]
-
- write_file(base_pkg_manifest, manifest_entries)
-}
-
-#
-# Asset manifest entries for SKQP.
-#
-action("append_assets_to_manifest") {
- script = "append_assets_to_manifest"
-
- base_pkg_manifest = "${pkg_dir}/base_${pkg_name}.manifest"
- pkg_manifest = "${pkg_dir}/${pkg_name}.manifest"
- assets_path = "//platform_tools/android/apps/skqp/src/main/assets"
-
- inputs = [ assets_path ]
-
- outputs = [ pkg_manifest ]
-
- manifest_deps = "$target_out_dir/skqp_manifest.d"
-
- args = [
- "--root_dir",
- rebase_path(assets_path),
- "--base_manifest",
- rebase_path(base_pkg_manifest),
- "--manifest",
- rebase_path(pkg_manifest),
- "--deps",
- rebase_path(manifest_deps),
- "--root_build_dir",
- rebase_path(root_out_dir),
- ]
-
- deps = [ ":base_manifest" ]
- depfile = manifest_deps
-}
diff --git a/chromium/third_party/skia/build/fuchsia/skqp/README.md b/chromium/third_party/skia/build/fuchsia/skqp/README.md
deleted file mode 100644
index bd641ad0e58..00000000000
--- a/chromium/third_party/skia/build/fuchsia/skqp/README.md
+++ /dev/null
@@ -1,35 +0,0 @@
-# Building SKQP for Fuchsia
-Using an arm64 device as an example, to build skqp for Fuchsia:
-```
-gn gen out/fuchsia-arm64 --args="is_official_build=false is_debug=false skia_update_fuchsia_sdk=true target_cpu=\"arm64\" target_os=\"fuchsia\" using_fuchsia_sdk=true skia_tools_require_resources=true skia_skqp_global_error_tolerance=8"
-```
-
-The effect of `skia_update_fuchsia_sdk=true` is that it will download both the Fuchsia SDK and a compatible clang for building SKQP as part of the `gn gen ...` step above.
-
-Next step, compile skqp for Fuchsia:
-```
-autoninja -C out/fuchsia-arm64 ":skqp_repo"
-```
-
-The effect of this build will be to produce a Fuchsia package repository named `skqp_repo` in the `out` directory of the build. `skqp_repo` can then be served to a Fuchsia device using `//fuchsia/sdk/tools/pm serve -repo skqp_repo` (where // is the skia build root).
-
-See [install fuchsia packages](https://fuchsia.dev/fuchsia-src/development/sdk/documentation/packages#install-package) for more on serving packages to Fuchsia devices.
-
-# Fuchsia CIPD Package Creation and Upload Procedure
-These steps assume the creation of the arm64 CIPD package as an example. Because the package requires a path from the output directory of the build, the `gn gen` arguments must match the prescribed path declared in `cipd_arm64.yaml` in order for this CIPD package creation and upload to succeed.
-
-## Create CIPD Package
-```
-cipd create -pkg-def=cipd_arm64.yaml
-```
-
-## Set CIPD Ref of `latest`
-If applicable, set `latest` ref to new CIPD package.
-```
-cipd set-ref skia/fuchsia/skqp/arch/arm64 -ref latest -version mdhS7sryb2zxQuXT803Dv_XZ0r7B5j8jSbZmIi0JvOcC
-```
-
-## Set the git-commit Tag
-```
-cipd set-tag skia/fuchsia/skqp/arch/arm64 -tag=git-commit:9c2b7cfe9080c6c4692234667a671db216a2e229 -version mdhS7sryb2zxQuXT803Dv_XZ0r7B5j8jSbZmIi0JvOcC
-```
diff --git a/chromium/third_party/skia/build/fuchsia/skqp/append_assets_to_manifest b/chromium/third_party/skia/build/fuchsia/skqp/append_assets_to_manifest
deleted file mode 100755
index f1a0d892522..00000000000
--- a/chromium/third_party/skia/build/fuchsia/skqp/append_assets_to_manifest
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2019 Google LLC. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""
- Opens |base_manifest| and copies the contents to |manifest| then traverses
- |root_dir| and appends every file as a Fuchsia package manifest entry to
- |manifest|.
-"""
-
-import argparse
-import os
-import subprocess
-
-parser = argparse.ArgumentParser()
-parser.add_argument('--root_dir', dest='root_dir', action='store', required=True)
-parser.add_argument('--base_manifest', dest='base_manifest', action='store', required=True)
-parser.add_argument('--manifest', dest='manifest', action='store', required=True)
-parser.add_argument('--deps', dest='deps', action='store', required=True)
-parser.add_argument('--root_build_dir', dest='root_build_dir', action='store', required=True)
-args = parser.parse_args()
-
-root_dir = args.root_dir
-if not os.path.exists(root_dir):
- print "--root_dir path specified: " + root_dir + " doesn't exist.\n"
- exit(1)
-
-base_manifest = args.base_manifest
-if not os.path.exists(base_manifest):
- print "--base_manifest specified: " + base_manifest + " doesn't exist.\n"
- exit(1)
-
-manifest = args.manifest
-root_build_dir = args.root_build_dir
-
-# Prepend |base_manifest| contents to |manifest|.
-deps_file = open(args.deps, 'w')
-relative_path = os.path.relpath(args.manifest, root_build_dir)
-deps_file.write('%s: ' % relative_path)
-
-out_file = open(manifest, 'w')
-with open(base_manifest, 'r') as in_file:
- base_content = in_file.readlines()
-
-for base_line in base_content:
- out_file.write(base_line)
- base_line_list = base_line.split("=")
- if len(base_line_list) != 2:
- print "Error: Base manifest line format error. Expected \"lhs=rhs\" but got: " + base_line
- exit(1)
- base_line_rhs = base_line_list[1].strip()
- relative_path = os.path.relpath(base_line_rhs, root_build_dir)
- deps_file.write(relative_path + " ")
-
-# Append all files discovered under |root_dir| to |manifest|.
-files = subprocess.check_output(["find", root_dir, "-type", "f"])
-file_lines = files.splitlines()
-
-for file in file_lines:
- source = file
- if not source.startswith(root_dir):
- print "Error: source path " + source + " is not under |root_dir|\n"
- exit(1)
- dest = source[len(root_dir):]
- out_file.write('data%s=' % dest)
- out_file.write('%s\n' % source)
- relative_path = os.path.relpath(source, root_build_dir)
- deps_file.write(relative_path + " ")
-
-out_file.close()
-deps_file.close()
diff --git a/chromium/third_party/skia/build/fuchsia/skqp/cipd_arm64.yaml b/chromium/third_party/skia/build/fuchsia/skqp/cipd_arm64.yaml
deleted file mode 100644
index e6a459df398..00000000000
--- a/chromium/third_party/skia/build/fuchsia/skqp/cipd_arm64.yaml
+++ /dev/null
@@ -1,7 +0,0 @@
-package: skia/fuchsia/skqp/arch/arm64
-description: ARM64 build of Skia's skqp test suite for Fuchsia
-install_mode: copy
-root: ../../..
-data:
- - file: build/fuchsia/skqp/test_manifest.json
- - file: out/fuchsia-arm64/far/skqp_pkg.far
diff --git a/chromium/third_party/skia/build/fuchsia/skqp/skqp.cmx b/chromium/third_party/skia/build/fuchsia/skqp/skqp.cmx
deleted file mode 100644
index 4661c3db505..00000000000
--- a/chromium/third_party/skia/build/fuchsia/skqp/skqp.cmx
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "program": {
- "binary": "bin/skqp",
- "args" : [ "/pkg/data", "skqp/rendertests_fuchsia.txt", "/tmp/logs" ]
- },
- "sandbox": {
- "dev": [
- "class/display-controller"
- ],
- "features": [
- "vulkan",
- "isolated-temp"
- ],
- "services": [
- "fuchsia.logger.LogSink",
- "fuchsia.sysmem.Allocator",
- "fuchsia.tracing.provider.Registry",
- "fuchsia.vulkan.loader.Loader"
- ]
- }
-}
diff --git a/chromium/third_party/skia/build/fuchsia/skqp/test_manifest.json b/chromium/third_party/skia/build/fuchsia/skqp/test_manifest.json
deleted file mode 100644
index 4e67279fcbb..00000000000
--- a/chromium/third_party/skia/build/fuchsia/skqp/test_manifest.json
+++ /dev/null
@@ -1,6 +0,0 @@
-[
- {
- "package": "skqp_pkg",
- "component_name": "skqp"
- }
-]
diff --git a/chromium/third_party/skia/build_overrides/angle.gni b/chromium/third_party/skia/build_overrides/angle.gni
index 22f0153897e..e30e4e19de8 100644
--- a/chromium/third_party/skia/build_overrides/angle.gni
+++ b/chromium/third_party/skia/build_overrides/angle.gni
@@ -8,5 +8,4 @@ angle_has_build = false
# Bunch of features ANGLE's build files test for that we never set.
is_cfi = false
-is_chromecast = false
is_chromeos = false
diff --git a/chromium/third_party/skia/build_overrides/tint.gni b/chromium/third_party/skia/build_overrides/tint.gni
index 2529bbbfcd3..c2fdcbebfcc 100644
--- a/chromium/third_party/skia/build_overrides/tint.gni
+++ b/chromium/third_party/skia/build_overrides/tint.gni
@@ -13,3 +13,5 @@ tint_build_spv_reader = true
tint_build_spv_writer = true
tint_build_wgsl_reader = true
tint_build_wgsl_writer = true
+
+tint_build_unittests = false
diff --git a/chromium/third_party/skia/demos.skia.org/demos/image_sampling/index.html b/chromium/third_party/skia/demos.skia.org/demos/image_sampling/index.html
index 6626630a369..d6d4a013323 100644
--- a/chromium/third_party/skia/demos.skia.org/demos/image_sampling/index.html
+++ b/chromium/third_party/skia/demos.skia.org/demos/image_sampling/index.html
@@ -3,7 +3,7 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
-<script type="text/javascript" src="https://unpkg.com/canvaskit-wasm@0.25.0/bin/full/canvaskit.js"></script>
+<script type="text/javascript" src="https://unpkg.com/canvaskit-wasm@0.34.1/bin/full/canvaskit.js"></script>
<style>
figcaption {
@@ -41,7 +41,7 @@
</body>
<script type="text/javascript" charset="utf-8">
- const ckLoaded = CanvasKitInit({ locateFile: (file) => 'https://unpkg.com/canvaskit-wasm@0.25.0/bin/full/' + file });
+ const ckLoaded = CanvasKitInit({ locateFile: (file) => 'https://unpkg.com/canvaskit-wasm@0.34.1/bin/full/' + file });
ckLoaded.then((CanvasKit) => {
if (!CanvasKit.RuntimeEffect) {
diff --git a/chromium/third_party/skia/demos.skia.org/demos/sampling_types/index.html b/chromium/third_party/skia/demos.skia.org/demos/sampling_types/index.html
index c9f35c76ef8..6c94f3ee87f 100644
--- a/chromium/third_party/skia/demos.skia.org/demos/sampling_types/index.html
+++ b/chromium/third_party/skia/demos.skia.org/demos/sampling_types/index.html
@@ -6,6 +6,9 @@
<script type="text/javascript" src="https://unpkg.com/canvaskit-wasm@0.25.0/bin/full/canvaskit.js"></script>
<style>
+ #draw {
+ border: 1px dashed grey;
+ }
figcaption {
max-width: 800px;
}
@@ -20,11 +23,12 @@
</div>
<figure>
+ <!-- width/height hard-coded for grid of 256px images. -->
<div ondrop="dropHandler(event);" ondragover="dragOverHandler(event);">
- <canvas id="draw" width=2048 height=1600></canvas>
+ <canvas id="draw" width=868 height=592></canvas>
</div>
<figcaption>
- Drop an Image onto the page (above)
+ Drop an Image onto the rectangle above
</figcaption>
</figure>
diff --git a/chromium/third_party/skia/demos.skia.org/demos/textedit/index.html b/chromium/third_party/skia/demos.skia.org/demos/textedit/index.html
index d6852c8bb9d..4e186bb1b9d 100644
--- a/chromium/third_party/skia/demos.skia.org/demos/textedit/index.html
+++ b/chromium/third_party/skia/demos.skia.org/demos/textedit/index.html
@@ -3,7 +3,7 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
-<script type="text/javascript" src="https://particles.skia.org/dist/canvaskit.js"></script>
+<script type="text/javascript" src="https://unpkg.com/canvaskit-wasm@0.34.1/bin/full/canvaskit.js"></script>
<script type="text/javascript" src="textapi_utils.js"></script>
<script type="text/javascript" src="spiralshader.js"></script>
@@ -22,7 +22,7 @@ canvas {
<script type="text/javascript" charset="utf-8">
let CanvasKit;
onload = async () => {
- CanvasKit = await CanvasKitInit({ locateFile: (file) => 'https://particles.skia.org/dist/'+file });
+ CanvasKit = await CanvasKitInit({ locateFile: (file) => 'https://unpkg.com/canvaskit-wasm@0.34.1/bin/full/'+file });
ParagraphAPI2();
};
diff --git a/chromium/third_party/skia/demos.skia.org/demos/textures/index.html b/chromium/third_party/skia/demos.skia.org/demos/textures/index.html
index 0a1f9b6e0c2..ef54e90cd9e 100644
--- a/chromium/third_party/skia/demos.skia.org/demos/textures/index.html
+++ b/chromium/third_party/skia/demos.skia.org/demos/textures/index.html
@@ -3,7 +3,7 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
-<script type="text/javascript" src="https://particles.skia.org/dist/canvaskit.js"></script>
+<script type="text/javascript" src="https://unpkg.com/canvaskit-wasm@0.34.1/bin/full/canvaskit.js"></script>
<style>
canvas {
@@ -24,12 +24,12 @@
<canvas id=draw width=500 height=500></canvas>
- <img id="sourceImage" src="/demos/textures/testimg.png">
+ <img id="sourceImage" src="testimg.png">
<video id="sourceVideo" autoplay muted></video>
</body>
<script type="text/javascript" charset="utf-8">
- const ckLoaded = CanvasKitInit({ locateFile: (file) => 'https://particles.skia.org/dist/' + file });
+ const ckLoaded = CanvasKitInit({ locateFile: (file) => 'https://unpkg.com/canvaskit-wasm@0.34.1/bin/full/' + file });
const canvasEle = document.getElementById('draw');
const imgEle = document.getElementById('sourceImage');
const videoEle = document.getElementById('sourceVideo');
diff --git a/chromium/third_party/skia/demos.skia.org/demos/up_scaling/index.html b/chromium/third_party/skia/demos.skia.org/demos/up_scaling/index.html
index c2f3f7fa552..4cae99c23a4 100644
--- a/chromium/third_party/skia/demos.skia.org/demos/up_scaling/index.html
+++ b/chromium/third_party/skia/demos.skia.org/demos/up_scaling/index.html
@@ -5,7 +5,7 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
-<script type="text/javascript" src="https://unpkg.com/canvaskit-wasm@0.25.0/bin/full/canvaskit.js"></script>
+<script type="text/javascript" src="https://unpkg.com/canvaskit-wasm@0.34.1/bin/full/canvaskit.js"></script>
<style>
canvas {
@@ -27,7 +27,7 @@ canvas {
<script type="text/javascript" charset="utf-8">
let CanvasKit;
onload = async () => {
- CanvasKit = await CanvasKitInit({ locateFile: (file) => "https://unpkg.com/canvaskit-wasm@0.25.0/bin/full/" + file });
+ CanvasKit = await CanvasKitInit({ locateFile: (file) => "https://unpkg.com/canvaskit-wasm@0.34.1/bin/full/" + file });
init();
};
diff --git a/chromium/third_party/skia/dm/DM.cpp b/chromium/third_party/skia/dm/DM.cpp
index 71181a39a5e..f492acf822a 100644
--- a/chromium/third_party/skia/dm/DM.cpp
+++ b/chromium/third_party/skia/dm/DM.cpp
@@ -371,7 +371,7 @@ static void find_culprit() {
#if !defined(SK_BUILD_FOR_ANDROID)
void* stack[128];
- int count = backtrace(stack, SK_ARRAY_COUNT(stack));
+ int count = backtrace(stack, std::size(stack));
char** symbols = backtrace_symbols(stack, count);
info("\nStack trace:\n");
for (int i = 0; i < count; i++) {
@@ -1512,6 +1512,8 @@ TestHarness CurrentTestHarness() {
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+static bool ColrV1VariationsEnabledForTest() { return true; }
+
int main(int argc, char** argv) {
#if defined(__MSVC_RUNTIME_CHECKS)
_RTC_SetErrorFunc(RuntimeCheckErrorFunc);
@@ -1556,6 +1558,7 @@ int main(int argc, char** argv) {
#if defined(SK_ENABLE_SVG)
SkGraphics::SetOpenTypeSVGDecoderFactory(SkSVGOpenTypeSVGDecoder::Make);
#endif
+ SkGraphics::SetVariableColrV1EnabledFunc(ColrV1VariationsEnabledForTest);
SkTaskGroup::Enabler enabled(FLAGS_threads);
if (nullptr == GetResourceAsData("images/color_wheel.png")) {
diff --git a/chromium/third_party/skia/dm/DMJsonWriter.cpp b/chromium/third_party/skia/dm/DMJsonWriter.cpp
index f0d6a8d1cc4..8fdd3c8385a 100644
--- a/chromium/third_party/skia/dm/DMJsonWriter.cpp
+++ b/chromium/third_party/skia/dm/DMJsonWriter.cpp
@@ -46,12 +46,12 @@ void JsonWriter::DumpJson(const char* dir,
writer.beginObject(); // root
for (int i = 1; i < properties.count(); i += 2) {
- writer.appendString(properties[i-1], properties[i]);
+ writer.appendCString(properties[i-1], properties[i]);
}
writer.beginObject("key");
for (int i = 1; i < key.count(); i += 2) {
- writer.appendString(key[i-1], key[i]);
+ writer.appendCString(key[i-1], key[i]);
}
writer.endObject();
@@ -67,27 +67,27 @@ void JsonWriter::DumpJson(const char* dir,
writer.beginObject();
writer.beginObject("key");
- writer.appendString("name" , gBitmapResults[i].name.c_str());
- writer.appendString("config" , gBitmapResults[i].config.c_str());
- writer.appendString("source_type", gBitmapResults[i].sourceType.c_str());
+ writer.appendString("name" , gBitmapResults[i].name);
+ writer.appendString("config" , gBitmapResults[i].config);
+ writer.appendString("source_type", gBitmapResults[i].sourceType);
// Source options only need to be part of the key if they exist.
// Source type by source type, we either always set options or never set options.
if (!gBitmapResults[i].sourceOptions.isEmpty()) {
- writer.appendString("source_options", gBitmapResults[i].sourceOptions.c_str());
+ writer.appendString("source_options", gBitmapResults[i].sourceOptions);
}
writer.endObject(); // key
writer.beginObject("options");
- writer.appendString("ext" , gBitmapResults[i].ext.c_str());
- writer.appendString("gamut", gBitmapResults[i].gamut.c_str());
- writer.appendString("transfer_fn", gBitmapResults[i].transferFn.c_str());
- writer.appendString("color_type", gBitmapResults[i].colorType.c_str());
- writer.appendString("alpha_type", gBitmapResults[i].alphaType.c_str());
- writer.appendString("color_depth", gBitmapResults[i].colorDepth.c_str());
+ writer.appendString("ext" , gBitmapResults[i].ext);
+ writer.appendString("gamut", gBitmapResults[i].gamut);
+ writer.appendString("transfer_fn", gBitmapResults[i].transferFn);
+ writer.appendString("color_type", gBitmapResults[i].colorType);
+ writer.appendString("alpha_type", gBitmapResults[i].alphaType);
+ writer.appendString("color_depth", gBitmapResults[i].colorDepth);
writer.endObject(); // options
- writer.appendString("md5", gBitmapResults[i].md5.c_str());
+ writer.appendString("md5", gBitmapResults[i].md5);
writer.endObject(); // 1 result
}
diff --git a/chromium/third_party/skia/dm/DMSrcSink.cpp b/chromium/third_party/skia/dm/DMSrcSink.cpp
index 4d04ab60e9e..dd1243c72b9 100644
--- a/chromium/third_party/skia/dm/DMSrcSink.cpp
+++ b/chromium/third_party/skia/dm/DMSrcSink.cpp
@@ -30,10 +30,10 @@
#include "include/ports/SkImageGeneratorWIC.h"
#include "include/private/SkImageInfoPriv.h"
#include "include/private/SkTLogic.h"
-#include "include/third_party/skcms/skcms.h"
#include "include/utils/SkNullCanvas.h"
#include "include/utils/SkPaintFilterCanvas.h"
#include "include/utils/SkRandom.h"
+#include "modules/skcms/skcms.h"
#include "modules/skottie/utils/SkottieUtils.h"
#include "src/codec/SkCodecImageGenerator.h"
#include "src/codec/SkSwizzler.h"
@@ -41,8 +41,8 @@
#include "src/core/SkAutoPixmapStorage.h"
#include "src/core/SkOSFile.h"
#include "src/core/SkOpts.h"
-#include "src/core/SkPictureCommon.h"
#include "src/core/SkPictureData.h"
+#include "src/core/SkPicturePriv.h"
#include "src/core/SkRecordDraw.h"
#include "src/core/SkRecorder.h"
#include "src/core/SkTLazy.h"
@@ -57,6 +57,7 @@
#include "tools/DDLTileHelper.h"
#include "tools/Resources.h"
#include "tools/RuntimeBlendUtils.h"
+#include "tools/ToolUtils.h"
#include "tools/UrlDataManager.h"
#include "tools/debugger/DebugCanvas.h"
#include "tools/gpu/BackendSurfaceFactory.h"
@@ -1261,7 +1262,7 @@ Result SkottieSrc::draw(GrDirectContext*, SkCanvas* canvas) const {
// frame progression. The film strip will still be in order left-to-right,
// top-down, just not drawn in that order.
static constexpr int frameOrder[] = { 4, 0, 3, 1, 2 };
- static_assert(SK_ARRAY_COUNT(frameOrder) == kTileCount, "");
+ static_assert(std::size(frameOrder) == kTileCount, "");
for (int i = 0; i < kTileCount; ++i) {
const SkScalar y = frameOrder[i] * kTileSize;
@@ -2150,7 +2151,8 @@ Result GraphiteSink::draw(const Src& src,
return Result::Fatal("Could not create a context.");
}
- std::unique_ptr<skgpu::graphite::Recorder> recorder = context->makeRecorder();
+ std::unique_ptr<skgpu::graphite::Recorder> recorder =
+ context->makeRecorder(ToolUtils::CreateTestingRecorderOptions());
if (!recorder) {
return Result::Fatal("Could not create a recorder.");
}
@@ -2167,7 +2169,7 @@ Result GraphiteSink::draw(const Src& src,
return result;
}
- // For now we cast and call directly into Surface. Once we have a been idea of
+ // For now we cast and call directly into Surface. Once we have a better idea of
// what the public API for synchronous graphite readPixels we can update this call to use
// that instead.
SkPixmap pm;
diff --git a/chromium/third_party/skia/docker/skia-release/Dockerfile b/chromium/third_party/skia/docker/skia-release/Dockerfile
index 6ddcec84ebd..173fd391bcc 100644
--- a/chromium/third_party/skia/docker/skia-release/Dockerfile
+++ b/chromium/third_party/skia/docker/skia-release/Dockerfile
@@ -53,9 +53,6 @@ extra_ldflags = [ \n\
"-Wl,/usr/local/lib" \n\
] ' > /tmp/skia/skia/out/Static/args.gn
-# TODO(nicolettep) Delete this manual removal of a broken symlink that comes with the Perfetto
-# checkout once the issue is addressed within the Perfetto respository itself.
-RUN rm -f /tmp/skia/skia/third_party/externals/perfetto/ui/src/gen
# Build Skia.
RUN cd /tmp/skia/skia \
&& ./bin/gn gen out/Static \
diff --git a/chromium/third_party/skia/example/BUILD.bazel b/chromium/third_party/skia/example/BUILD.bazel
index b99ca902458..0711a15305e 100644
--- a/chromium/third_party/skia/example/BUILD.bazel
+++ b/chromium/third_party/skia/example/BUILD.bazel
@@ -29,8 +29,11 @@ cc_binary_with_flags(
},
deps = [
"//:skia_public",
- "//tools/sk_app",
- ],
+ ] + select({
+ "@platforms//os:macos": ["//tools/sk_app:sk_app_objc"],
+ "@platforms//os:linux": ["//tools/sk_app:sk_app"],
+ "//conditions:default": [],
+ }),
)
cc_binary_with_flags(
diff --git a/chromium/third_party/skia/experimental/bazel_test/BUILD.bazel b/chromium/third_party/skia/experimental/bazel_test/BUILD.bazel
index 903d51d4930..31a5b3cf9e6 100644
--- a/chromium/third_party/skia/experimental/bazel_test/BUILD.bazel
+++ b/chromium/third_party/skia/experimental/bazel_test/BUILD.bazel
@@ -1,16 +1,19 @@
-load("//bazel:macros.bzl", "exports_files_legacy")
-load("@rules_cc//cc:defs.bzl", "cc_binary")
-load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
+load("//bazel:cc_binary_with_flags.bzl", "cc_binary_with_flags")
+load("//bazel:macros.bzl", "exports_files_legacy", "go_binary", "go_library")
+load("@rules_python//python:defs.bzl", "py_binary")
licenses(["notice"])
exports_files_legacy()
-cc_binary(
+cc_binary_with_flags(
name = "bazel_test_exe",
srcs = [
"bazel_test.cpp",
],
+ set_flags = {
+ "enable_svg_canvas": ["True"],
+ },
deps = [
"//:skia_public",
"@libpng",
@@ -29,3 +32,18 @@ go_library(
importpath = "go.skia.org/skia/experimental/bazel_test",
visibility = ["//visibility:private"],
)
+
+py_binary(
+ name = "print_os",
+ srcs = ["print_os.py"],
+)
+
+genrule(
+ name = "generate_file",
+ srcs = [],
+ outs = [
+ "some_file.txt",
+ ],
+ cmd = "$(location :print_os) $@",
+ exec_tools = [":print_os"],
+)
diff --git a/chromium/third_party/skia/experimental/bazel_test/bazel_test.cpp b/chromium/third_party/skia/experimental/bazel_test/bazel_test.cpp
index 984b261e636..fe24e9ffbbe 100644
--- a/chromium/third_party/skia/experimental/bazel_test/bazel_test.cpp
+++ b/chromium/third_party/skia/experimental/bazel_test/bazel_test.cpp
@@ -1,7 +1,10 @@
// Copyright 2020 Google LLC.
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
+#include "include/core/SkCanvas.h"
+#include "include/core/SkRect.h"
#include "include/core/SkTypes.h"
+#include "include/svg/SkSVGCanvas.h"
#include "png.h"
@@ -22,6 +25,10 @@ int main(int argc, char** argv) {
printf("PASS\n"); // This tells the human the test passed.
return 0; // This tells Bazel the test passed.
}
+ if (argc < -10) {
+ std::unique_ptr<SkCanvas> not_used = SkSVGCanvas::Make({}, nullptr, 0);
+ not_used->save();
+ }
printf("FAIL\n"); // This tells the human the test failed.
return 1; // This tells Bazel the test failed.
}
diff --git a/chromium/third_party/skia/experimental/bazel_test/print_os.py b/chromium/third_party/skia/experimental/bazel_test/print_os.py
new file mode 100644
index 00000000000..cd89f47e518
--- /dev/null
+++ b/chromium/third_party/skia/experimental/bazel_test/print_os.py
@@ -0,0 +1,23 @@
+#!/usr/bin/python3
+
+'''
+Copyright 2022 Google LLC
+
+Use of this source code is governed by a BSD-style license that can be
+found in the LICENSE file.
+'''
+
+import os
+import platform
+import sys
+
+def main():
+ print("hello", sys.argv)
+ print(os.name, platform.system(), platform.release())
+ if len(sys.argv) > 1:
+ with open(sys.argv[1], "w") as f:
+ f.write("created")
+
+
+if __name__ == "__main__":
+ main() \ No newline at end of file
diff --git a/chromium/third_party/skia/experimental/c-api-example/c.md b/chromium/third_party/skia/experimental/c-api-example/c.md
deleted file mode 100644
index 533841abe9f..00000000000
--- a/chromium/third_party/skia/experimental/c-api-example/c.md
+++ /dev/null
@@ -1,133 +0,0 @@
-Skia's Stable C API
-===================
-
-<div style="text-align:center">
-<strong>EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL<br>
-DO NOT USE &mdash; FOR INTERNAL TESTING ONLY</strong>
-</div>
-
-Several issues hinder the development of a stable ABI (application
-binary interface) for Skia:
-
-1. Skia's C++ API changes a lot from version to version. Skia's two
- largest clients, Android and Chrome, are kept up to date by the
- Skia team, but that can not happen for every client.
-2. Skia's headers will only match the compiled skia libraries if
- configured identically.
-
-To mitigate these two issues, Skia is experimenting with the
-introduction of a C API. This will change more slowly than the C++
-interface and, once API version 1.0.0 is announced,
-backwards-incompatable changes will be avoided whenever possible.
-
-Here is an example program that uses the C api. To try it out, get the file
-[`skia-c-example.c`](./skia-c-example.c).
-
-<!--?prettify lang=c?-->
-
- #include <stdio.h>
-
- #include "sk_data.h"
- #include "sk_image.h"
- #include "sk_canvas.h"
- #include "sk_surface.h"
- #include "sk_paint.h"
- #include "sk_path.h"
-
- static sk_surface_t* make_surface(int32_t w, int32_t h) {
- sk_imageinfo_t info;
- info.width = w;
- info.height = h;
- info.colorType = sk_colortype_get_default_8888();
- info.alphaType = PREMUL_SK_ALPHATYPE;
- return sk_surface_new_raster(&info, NULL);
- }
-
- static void emit_png(const char* path, sk_surface_t* surface) {
- sk_image_t* image = sk_surface_new_image_snapshot(surface);
- sk_data_t* data = sk_image_encode(image);
- sk_image_unref(image);
- FILE* f = fopen(path, "wb");
- fwrite(sk_data_get_data(data), sk_data_get_size(data), 1, f);
- fclose(f);
- sk_data_unref(data);
- }
-
- void draw(sk_canvas_t* canvas) {
- sk_paint_t* fill = sk_paint_new();
- sk_paint_set_color(fill, sk_color_set_argb(0xFF, 0x00, 0x00, 0xFF));
- sk_canvas_draw_paint(canvas, fill);
-
- sk_paint_set_color(fill, sk_color_set_argb(0xFF, 0x00, 0xFF, 0xFF));
- sk_rect_t rect;
- rect.left = 100.0f;
- rect.top = 100.0f;
- rect.right = 540.0f;
- rect.bottom = 380.0f;
- sk_canvas_draw_rect(canvas, &rect, fill);
-
- sk_paint_t* stroke = sk_paint_new();
- sk_paint_set_color(stroke, sk_color_set_argb(0xFF, 0xFF, 0x00, 0x00));
- sk_paint_set_antialias(stroke, true);
- sk_paint_set_stroke(stroke, true);
- sk_paint_set_stroke_width(stroke, 5.0f);
-
- sk_pathbuilder_t* path_builder = sk_pathbuilder_new();
- sk_pathbuilder_move_to(path_builder, 50.0f, 50.0f);
- sk_pathbuilder_line_to(path_builder, 590.0f, 50.0f);
- sk_pathbuilder_cubic_to(path_builder, -490.0f, 50.0f, 1130.0f, 430.0f, 50.0f, 430.0f);
- sk_pathbuilder_line_to(path_builder, 590.0f, 430.0f);
-
- sk_path_t* path = sk_pathbuilder_detach_path(path_builder);
- sk_canvas_draw_path(canvas, path, stroke);
-
- sk_paint_set_color(fill, sk_color_set_argb(0x80, 0x00, 0xFF, 0x00));
- sk_rect_t rect2;
- rect2.left = 120.0f;
- rect2.top = 120.0f;
- rect2.right = 520.0f;
- rect2.bottom = 360.0f;
- sk_canvas_draw_oval(canvas, &rect2, fill);
-
- sk_pathbuilder_delete(path_builder);
- sk_path_delete(path);
- sk_paint_delete(stroke);
- sk_paint_delete(fill);
- }
-
- int main() {
- sk_surface_t* surface = make_surface(640, 480);
- sk_canvas_t* canvas = sk_surface_get_canvas(surface);
- draw(canvas);
- emit_png("skia-c-example.png", surface);
- sk_surface_unref(surface);
- return 0;
- }
-
-<a href="https://fiddle.skia.org/c/6c6c01438d9c3d80e9c22e606359432e"><img src="https://fiddle.skia.org/i/6c6c01438d9c3d80e9c22e606359432e_raster.png" alt=""></a>
-
-Example
--------
-
-The following proof-of-concept workflow currently works on MacOS and
-Ubuntu.
-
-1. Compile Skia as a shared library:
-
- <!--?prettify lang=sh?-->
-
- cd ...../skia
- bin/sync
- gn gen out/Shared --args='is_official_build=true is_component_build=true'
- ninja -C out/Shared
- SKIA_LIB_DIR="${PWD}/out/Shared"
-
-2. Compile, link, and run the example program:
-
- <!--?prettify lang=sh?-->
-
- cc -o skia-c-example -I include/c \
- experimental/c-api-example/skia-c-example.c \
- "$SKIA_LIB_DIR"/libskia.* -Wl,-rpath -Wl,"$SKIA_LIB_DIR"
- ./skia-c-example
- bin/sysopen skia-c-example.png
diff --git a/chromium/third_party/skia/experimental/c-api-example/skia-c-example.c b/chromium/third_party/skia/experimental/c-api-example/skia-c-example.c
deleted file mode 100644
index b6a2f347b04..00000000000
--- a/chromium/third_party/skia/experimental/c-api-example/skia-c-example.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-#include <stdio.h>
-
-#include "include/c/sk_canvas.h"
-#include "include/c/sk_data.h"
-#include "include/c/sk_image.h"
-#include "include/c/sk_imageinfo.h"
-#include "include/c/sk_paint.h"
-#include "include/c/sk_path.h"
-#include "include/c/sk_surface.h"
-
-static sk_surface_t* make_surface(int32_t w, int32_t h) {
- sk_imageinfo_t* info = sk_imageinfo_new(w, h, RGBA_8888_SK_COLORTYPE,
- PREMUL_SK_ALPHATYPE, NULL);
- sk_surface_t* result = sk_surface_new_raster(info, NULL);
- sk_imageinfo_delete(info);
- return result;
-}
-
-static void emit_png(const char* path, sk_surface_t* surface) {
- sk_image_t* image = sk_surface_new_image_snapshot(surface);
- sk_data_t* data = sk_image_encode(image);
- sk_image_unref(image);
- FILE* f = fopen(path, "wb");
- fwrite(sk_data_get_data(data), sk_data_get_size(data), 1, f);
- fclose(f);
- sk_data_unref(data);
-}
-
-void draw(sk_canvas_t* canvas) {
- sk_paint_t* fill = sk_paint_new();
- sk_paint_set_color(fill, sk_color_set_argb(0xFF, 0x00, 0x00, 0xFF));
- sk_canvas_draw_paint(canvas, fill);
-
- sk_paint_set_color(fill, sk_color_set_argb(0xFF, 0x00, 0xFF, 0xFF));
- sk_rect_t rect;
- rect.left = 100.0f;
- rect.top = 100.0f;
- rect.right = 540.0f;
- rect.bottom = 380.0f;
- sk_canvas_draw_rect(canvas, &rect, fill);
-
- sk_paint_t* stroke = sk_paint_new();
- sk_paint_set_color(stroke, sk_color_set_argb(0xFF, 0xFF, 0x00, 0x00));
- sk_paint_set_antialias(stroke, true);
- sk_paint_set_stroke(stroke, true);
- sk_paint_set_stroke_width(stroke, 5.0f);
-
- sk_pathbuilder_t* path_builder = sk_pathbuilder_new();
- sk_pathbuilder_move_to(path_builder, 50.0f, 50.0f);
- sk_pathbuilder_line_to(path_builder, 590.0f, 50.0f);
- sk_pathbuilder_cubic_to(path_builder, -490.0f, 50.0f, 1130.0f, 430.0f, 50.0f, 430.0f);
- sk_pathbuilder_line_to(path_builder, 590.0f, 430.0f);
-
- sk_path_t* path = sk_pathbuilder_detach_path(path_builder);
- sk_canvas_draw_path(canvas, path, stroke);
-
- sk_paint_set_color(fill, sk_color_set_argb(0x80, 0x00, 0xFF, 0x00));
- sk_rect_t rect2;
- rect2.left = 120.0f;
- rect2.top = 120.0f;
- rect2.right = 520.0f;
- rect2.bottom = 360.0f;
- sk_canvas_draw_oval(canvas, &rect2, fill);
-
- sk_pathbuilder_delete(path_builder);
- sk_path_delete(path);
- sk_paint_delete(stroke);
- sk_paint_delete(fill);
-}
-
-int main() {
- sk_surface_t* surface = make_surface(640, 480);
- sk_canvas_t* canvas = sk_surface_get_canvas(surface);
- draw(canvas);
- emit_png("skia-c-example.png", surface);
- sk_surface_unref(surface);
- return 0;
-}
diff --git a/chromium/third_party/skia/experimental/sktext/include/Text.h b/chromium/third_party/skia/experimental/sktext/include/Text.h
index 16c01b53acd..2933cb8161d 100644
--- a/chromium/third_party/skia/experimental/sktext/include/Text.h
+++ b/chromium/third_party/skia/experimental/sktext/include/Text.h
@@ -40,14 +40,14 @@ public:
UnicodeText(std::unique_ptr<SkUnicode> unicode, const SkString& utf8);
~UnicodeText() = default;
- bool hasProperty(TextIndex index, CodeUnitFlags flag) const {
+ bool hasProperty(TextIndex index, SkUnicode::CodeUnitFlags flag) const {
return (fCodeUnitProperties[index] & flag) == flag;
}
bool isHardLineBreak(TextIndex index) const {
- return this->hasProperty(index, CodeUnitFlags::kHardLineBreakBefore);
+ return this->hasProperty(index, SkUnicode::CodeUnitFlags::kHardLineBreakBefore);
}
bool isSoftLineBreak(TextIndex index) const {
- return index != 0 && this->hasProperty(index, CodeUnitFlags::kSoftLineBreakBefore);
+ return index != 0 && this->hasProperty(index, SkUnicode::CodeUnitFlags::kSoftLineBreakBefore);
}
bool isWhitespaces(TextRange range) const;
@@ -58,13 +58,13 @@ public:
void forEachGrapheme(TextRange textRange, Callback&& callback) {
TextRange grapheme(textRange.fStart, textRange.fStart);
for (size_t i = textRange.fStart; i < textRange.fEnd; ++i) {
- if (this->hasProperty(i, CodeUnitFlags::kGraphemeStart)) {
+ if (this->hasProperty(i, SkUnicode::CodeUnitFlags::kGraphemeStart)) {
grapheme.fEnd = i;
if (grapheme.width() > 0) {
callback(grapheme);
}
grapheme.fStart = grapheme.fEnd;
- } else if (this->hasProperty(i, CodeUnitFlags::kHardLineBreakBefore)) {
+ } else if (this->hasProperty(i, SkUnicode::CodeUnitFlags::kHardLineBreakBefore)) {
grapheme.fEnd = i;
callback(grapheme);
// TODO: We assume here that the line break takes only one codepoint
@@ -81,7 +81,7 @@ public:
private:
void initialize(SkSpan<uint16_t> utf16);
- SkTArray<CodeUnitFlags, true> fCodeUnitProperties;
+ SkTArray<SkUnicode::CodeUnitFlags, true> fCodeUnitProperties;
std::u16string fText16;
std::unique_ptr<SkUnicode> fUnicode;
};
diff --git a/chromium/third_party/skia/experimental/sktext/include/Types.h b/chromium/third_party/skia/experimental/sktext/include/Types.h
index 09e22fcc503..c7d85c6573f 100644
--- a/chromium/third_party/skia/experimental/sktext/include/Types.h
+++ b/chromium/third_party/skia/experimental/sktext/include/Types.h
@@ -46,15 +46,6 @@ enum class LogicalRunType {
kLineBreak
};
-enum class CodeUnitFlags : uint8_t {
- kNoCodeUnitFlag = (1 << 0),
- kPartOfWhiteSpace = (1 << 1),
- kGraphemeStart = (1 << 2),
- kSoftLineBreakBefore = (1 << 3),
- kHardLineBreakBefore = (1 << 4),
- kAllCodeUnitFlags = ((1 << 5) - 1),
-};
-
enum class GlyphUnitFlags : uint8_t {
kNoGlyphUnitFlag = (1 << 0),
//kPartOfWhiteSpace = (1 << 1),
@@ -223,7 +214,6 @@ struct ResolvedFontBlock {
} // namespace skia
namespace sknonstd {
-template <> struct is_bitmask_enum<skia::text::CodeUnitFlags> : std::true_type {};
template <> struct is_bitmask_enum<skia::text::GlyphUnitFlags> : std::true_type {};
}
diff --git a/chromium/third_party/skia/experimental/sktext/samples/Text.cpp b/chromium/third_party/skia/experimental/sktext/samples/Text.cpp
index 7175c4c9159..a38ec683be0 100644
--- a/chromium/third_party/skia/experimental/sktext/samples/Text.cpp
+++ b/chromium/third_party/skia/experimental/sktext/samples/Text.cpp
@@ -13,7 +13,6 @@
#include "include/core/SkTime.h"
#include "samplecode/Sample.h"
#include "src/core/SkOSFile.h"
-#include "src/shaders/SkColorShader.h"
#include "src/utils/SkOSPath.h"
#include "src/utils/SkUTF.h"
#include "tools/Resources.h"
diff --git a/chromium/third_party/skia/experimental/sktext/src/Text.cpp b/chromium/third_party/skia/experimental/sktext/src/Text.cpp
index c635350ac0a..5a2dfba6e9e 100644
--- a/chromium/third_party/skia/experimental/sktext/src/Text.cpp
+++ b/chromium/third_party/skia/experimental/sktext/src/Text.cpp
@@ -20,7 +20,7 @@ UnicodeText::UnicodeText(std::unique_ptr<SkUnicode> unicode, const SkString& utf
bool UnicodeText::isWhitespaces(TextRange range) const {
for (auto i = range.fStart; i < range.fEnd; ++i) {
- if (!this->hasProperty(i, CodeUnitFlags::kPartOfWhiteSpace)) {
+ if (!this->hasProperty(i, SkUnicode::CodeUnitFlags::kPartOfWhiteSpaceBreak)) {
return false;
}
}
@@ -32,32 +32,11 @@ void UnicodeText::initialize(SkSpan<uint16_t> utf16) {
SkASSERT(fUnicode);
return;
}
- // Get white spaces
- fCodeUnitProperties.push_back_n(utf16.size() + 1, CodeUnitFlags::kNoCodeUnitFlag);
- this->fUnicode->forEachCodepoint((char16_t*)utf16.data(), utf16.size(),
- [this](SkUnichar unichar, int32_t start, int32_t end) {
- if (this->fUnicode->isWhitespace(unichar)) {
- for (auto i = start; i < end; ++i) {
- fCodeUnitProperties[i] |= CodeUnitFlags::kPartOfWhiteSpace;
- }
- }
- });
- // Get graphemes
- this->fUnicode->forEachBreak((char16_t*)utf16.data(), utf16.size(), SkUnicode::BreakType::kGraphemes,
- [this](SkBreakIterator::Position pos, SkBreakIterator::Status) {
- fCodeUnitProperties[pos]|= CodeUnitFlags::kGraphemeStart;
- });
- // Get line breaks
- this->fUnicode->forEachBreak((char16_t*)utf16.data(), utf16.size(), SkUnicode::BreakType::kLines,
- [this](SkBreakIterator::Position pos, SkBreakIterator::Status status) {
- if (status == (SkBreakIterator::Status)SkUnicode::LineBreakType::kHardLineBreak) {
- // Hard line breaks clears off all the other flags
- // TODO: Treat \n as a formatting mark and do not pass it to SkShaper
- fCodeUnitProperties[pos - 1] = CodeUnitFlags::kHardLineBreakBefore;
- } else {
- fCodeUnitProperties[pos] |= CodeUnitFlags::kSoftLineBreakBefore;
- }
- });
+
+ if (!fUnicode->computeCodeUnitFlags(
+ (char16_t*)utf16.data(), utf16.size(), false, &fCodeUnitProperties)) {
+ return;
+ }
}
std::unique_ptr<FontResolvedText> UnicodeText::resolveFonts(SkSpan<FontBlock> blocks) {
@@ -77,7 +56,8 @@ std::unique_ptr<FontResolvedText> UnicodeText::resolveFonts(SkSpan<FontBlock> bl
}
// Move the end of the block to the right until it's on the grapheme edge
- while (adjustedBlock.fEnd < this->fText16.size() && !this->hasProperty(adjustedBlock.fEnd, CodeUnitFlags::kGraphemeStart)) {
+ while (adjustedBlock.fEnd < this->fText16.size() &&
+ !this->hasProperty(adjustedBlock.fEnd, SkUnicode::CodeUnitFlags::kGraphemeStart)) {
++adjustedBlock.fEnd;
}
SkASSERT(block.type == BlockType::kFontChain);
@@ -273,7 +253,7 @@ std::unique_ptr<ShapedText> FontResolvedText::shape(UnicodeText* unicodeText,
SkShaper::MakeSkUnicodeBidiRunIterator(
unicodeText->getUnicode(), text8.c_str(), text8.size(), textDirection == TextDirection::kLtr ? 0 : 1));
std::unique_ptr<SkShaper::ScriptRunIterator> scriptIter(
- SkShaper::MakeSkUnicodeHbScriptRunIterator(unicodeText->getUnicode(), text8.c_str(), text8.size()));
+ SkShaper::MakeSkUnicodeHbScriptRunIterator(text8.c_str(), text8.size()));
auto shaper = SkShaper::MakeShapeDontWrapOrReorder();
if (shaper == nullptr) {
// For instance, loadICU does not work. We have to stop the process
@@ -614,7 +594,8 @@ GlyphRange WrappedText::textToGlyphs(UnicodeText* unicodeText, PositionType posi
GlyphRange glyphRange(0, run.size());
for (GlyphIndex glyph = 0; glyph < run.size(); ++glyph) {
auto textIndex = run.fClusters[glyph];
- if (positionType == PositionType::kGraphemeCluster && unicodeText->hasProperty(textIndex, CodeUnitFlags::kGraphemeStart)) {
+ if (positionType == PositionType::kGraphemeCluster &&
+ unicodeText->hasProperty(textIndex, SkUnicode::CodeUnitFlags::kGraphemeStart)) {
if (dirTextRange.after(textIndex)) {
glyphRange.fStart = glyph;
} else if (dirTextRange.before(textIndex)) {
@@ -633,13 +614,13 @@ std::unique_ptr<SelectableText> WrappedText::prepareToEdit(UnicodeText* unicodeT
this->visit(selectableText.get());
selectableText->fGlyphUnitProperties.push_back_n(unicodeText->getText16().size() + 1, GlyphUnitFlags::kNoGlyphUnitFlag);
for (auto index = 0; index < unicodeText->getText16().size(); ++index) {
- if (unicodeText->hasProperty(index, CodeUnitFlags::kHardLineBreakBefore)) {
+ if (unicodeText->hasProperty(index, SkUnicode::CodeUnitFlags::kHardLineBreakBefore)) {
selectableText->fGlyphUnitProperties[index] = GlyphUnitFlags::kGraphemeClusterStart;
}
}
for (const auto& run : fVisualRuns) {
for (auto& cluster : run.fClusters) {
- if (unicodeText->hasProperty(cluster, CodeUnitFlags::kGraphemeStart)) {
+ if (unicodeText->hasProperty(cluster, SkUnicode::CodeUnitFlags::kGraphemeStart)) {
selectableText->fGlyphUnitProperties[cluster] = GlyphUnitFlags::kGraphemeClusterStart;
}
}
diff --git a/chromium/third_party/skia/gm/aaclip.cpp b/chromium/third_party/skia/gm/aaclip.cpp
index 6fb081a32bc..f55ae91a599 100644
--- a/chromium/third_party/skia/gm/aaclip.cpp
+++ b/chromium/third_party/skia/gm/aaclip.cpp
@@ -148,7 +148,7 @@ DEF_SIMPLE_GM(cgimage, canvas, 800, 250) {
{ kBGRA_8888_SkColorType, kOpaque_SkAlphaType },
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(rec); ++i) {
+ for (size_t i = 0; i < std::size(rec); ++i) {
SkImageInfo info = SkImageInfo::Make(100, 100, rec[i].fCT, rec[i].fAT);
test_image(canvas, info);
canvas->translate(info.width() + 10, 0);
diff --git a/chromium/third_party/skia/gm/aarecteffect.cpp b/chromium/third_party/skia/gm/aarecteffect.cpp
index 8f4c446fd17..1b1e74c7391 100644
--- a/chromium/third_party/skia/gm/aarecteffect.cpp
+++ b/chromium/third_party/skia/gm/aarecteffect.cpp
@@ -20,8 +20,8 @@
#include "src/core/SkCanvasPriv.h"
#include "src/gpu/ganesh/GrFragmentProcessor.h"
#include "src/gpu/ganesh/GrPaint.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/effects/GrPorterDuffXferProcessor.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
#include "tools/gpu/TestOps.h"
#include <memory>
diff --git a/chromium/third_party/skia/gm/aarectmodes.cpp b/chromium/third_party/skia/gm/aarectmodes.cpp
index ca1215881c0..6940cf0992a 100644
--- a/chromium/third_party/skia/gm/aarectmodes.cpp
+++ b/chromium/third_party/skia/gm/aarectmodes.cpp
@@ -140,7 +140,7 @@ DEF_SIMPLE_GM(aarectmodes, canvas, 640, 480) {
for (int alpha = 0; alpha < 4; ++alpha) {
canvas->save();
canvas->save();
- for (size_t i = 0; i < SK_ARRAY_COUNT(gModes); ++i) {
+ for (size_t i = 0; i < std::size(gModes); ++i) {
if (6 == i) {
canvas->restore();
canvas->translate(W * 5, 0);
diff --git a/chromium/third_party/skia/gm/aaxfermodes.cpp b/chromium/third_party/skia/gm/aaxfermodes.cpp
index c373841df27..e93735c80fa 100644
--- a/chromium/third_party/skia/gm/aaxfermodes.cpp
+++ b/chromium/third_party/skia/gm/aaxfermodes.cpp
@@ -142,7 +142,7 @@ protected:
}
canvas->translate(kLabelSpacing + kShapeSpacing/2, 0);
- for (size_t colorIdx = 0; colorIdx < SK_ARRAY_COUNT(kShapeColors); colorIdx++) {
+ for (size_t colorIdx = 0; colorIdx < std::size(kShapeColors); colorIdx++) {
SkPaint paint;
this->setupShapePaint(canvas, kShapeColors[colorIdx], mode, &paint);
SkASSERT(colorIdx == 0 || 255 == paint.getAlpha());
diff --git a/chromium/third_party/skia/gm/addarc.cpp b/chromium/third_party/skia/gm/addarc.cpp
index 1d44be9a65c..53cb58d610f 100644
--- a/chromium/third_party/skia/gm/addarc.cpp
+++ b/chromium/third_party/skia/gm/addarc.cpp
@@ -236,25 +236,25 @@ DEF_SIMPLE_GM(manyarcs, canvas, 620, 330) {
-123.7f, -2.3f, -2, -1, -0.3f, -0.000001f, 0, 0.000001f, 0.3f, 0.7f,
1, 1.3f, 1.5f, 1.7f, 1.99999f, 2, 2.00001f, 2.3f, 4.3f, 3934723942837.3f
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(sweepAngles); ++i) {
+ for (size_t i = 0; i < std::size(sweepAngles); ++i) {
sweepAngles[i] *= 180;
}
SkScalar startAngles[] = { -1, -0.5f, 0, 0.5f };
- for (size_t i = 0; i < SK_ARRAY_COUNT(startAngles); ++i) {
+ for (size_t i = 0; i < std::size(startAngles); ++i) {
startAngles[i] *= 180;
}
bool anticlockwise = false;
SkScalar sign = 1;
- for (size_t i = 0; i < SK_ARRAY_COUNT(startAngles) * 2; ++i) {
- if (i == SK_ARRAY_COUNT(startAngles)) {
+ for (size_t i = 0; i < std::size(startAngles) * 2; ++i) {
+ if (i == std::size(startAngles)) {
anticlockwise = true;
sign = -1;
}
- SkScalar startAngle = startAngles[i % SK_ARRAY_COUNT(startAngles)] * sign;
+ SkScalar startAngle = startAngles[i % std::size(startAngles)] * sign;
canvas->save();
- for (size_t j = 0; j < SK_ARRAY_COUNT(sweepAngles); ++j) {
+ for (size_t j = 0; j < std::size(sweepAngles); ++j) {
SkPathBuilder path;
path.moveTo(0, 2);
html_canvas_arc(&path, 18, 15, 10, startAngle, startAngle + (sweepAngles[j] * sign),
@@ -283,7 +283,7 @@ DEF_SIMPLE_GM(tinyanglearcs, canvas, 620, 330) {
SkScalar startAngles[] = { 1.5f * SK_ScalarPI , 1.501f * SK_ScalarPI };
SkScalar sweepAngle = 10.0f / outerRadius;
- for (size_t i = 0; i < SK_ARRAY_COUNT(startAngles); ++i) {
+ for (size_t i = 0; i < std::size(startAngles); ++i) {
SkPathBuilder path;
SkScalar endAngle = startAngles[i] + sweepAngle;
path.moveTo(centerX + innerRadius * sk_float_cos(startAngles[i]),
diff --git a/chromium/third_party/skia/gm/alpha_image.cpp b/chromium/third_party/skia/gm/alpha_image.cpp
index 95e23f8971a..6edafe13f28 100644
--- a/chromium/third_party/skia/gm/alpha_image.cpp
+++ b/chromium/third_party/skia/gm/alpha_image.cpp
@@ -17,6 +17,7 @@
#include "include/core/SkPaint.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkShader.h"
+#include "tools/Resources.h"
static SkBitmap make_alpha_image(int w, int h) {
SkBitmap bm;
@@ -84,3 +85,41 @@ DEF_SIMPLE_GM(alpha_image_alpha_tint, canvas, 152, 80) {
paint.setShader(image->makeShader(SkSamplingOptions()));
canvas->drawRect({ 0, 0, 64, 64 }, paint);
}
+
+#if defined(SK_SUPPORT_LEGACY_ALPHA_BITMAP_AS_COVERAGE)
+// For a long time, the CPU backend treated A8 bitmaps as coverage, rather than alpha. This was
+// inconsistent with the GPU backend (skbug.com/9692). When this was fixed, it altered behavior
+// for some Android apps (b/231400686). This GM verifies that our Android framework workaround
+// produces the old result (mandrill with a round-rect border).
+DEF_SIMPLE_GM(alpha_bitmap_is_coverage_ANDROID, canvas, 128, 128) {
+ SkBitmap maskBitmap;
+ maskBitmap.allocPixels(SkImageInfo::MakeA8(128, 128));
+ {
+ SkCanvas maskCanvas(maskBitmap);
+ maskCanvas.clear(SK_ColorWHITE);
+
+ SkPaint maskPaint;
+ maskPaint.setAntiAlias(true);
+ maskPaint.setColor(SK_ColorWHITE);
+ maskPaint.setBlendMode(SkBlendMode::kClear);
+ maskCanvas.drawRoundRect({0, 0, 128, 128}, 16, 16, maskPaint);
+ }
+
+ SkBitmap offscreenBitmap;
+ offscreenBitmap.allocN32Pixels(128, 128);
+ {
+ SkCanvas offscreenCanvas(offscreenBitmap);
+ offscreenCanvas.drawImage(GetResourceAsImage("images/mandrill_128.png"), 0, 0);
+
+ SkPaint clearPaint;
+ clearPaint.setAntiAlias(true);
+ clearPaint.setBlendMode(SkBlendMode::kClear);
+ // At tip-of-tree (or at any time on the GPU backend), this draw produces full coverage,
+ // completely erasing the mandrill. With the workaround enabled, the alpha border is treated
+ // as coverage, so we only apply kClear to those pixels, just erasing the outer border.
+ offscreenCanvas.drawImage(maskBitmap.asImage(), 0, 0, SkSamplingOptions{}, &clearPaint);
+ }
+
+ canvas->drawImage(offscreenBitmap.asImage(), 0, 0);
+}
+#endif
diff --git a/chromium/third_party/skia/gm/alphagradients.cpp b/chromium/third_party/skia/gm/alphagradients.cpp
index 52056f29fe9..5122637566f 100644
--- a/chromium/third_party/skia/gm/alphagradients.cpp
+++ b/chromium/third_party/skia/gm/alphagradients.cpp
@@ -71,7 +71,7 @@ protected:
for (int doPreMul = 0; doPreMul <= 1; ++doPreMul) {
canvas->save();
- for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) {
+ for (size_t i = 0; i < std::size(gRec); ++i) {
draw_grad(canvas, r, gRec[i].fColor0, gRec[i].fColor1, SkToBool(doPreMul));
canvas->translate(0, r.height() + 8);
}
diff --git a/chromium/third_party/skia/gm/analytic_gradients.cpp b/chromium/third_party/skia/gm/analytic_gradients.cpp
index ebfd1e14c27..c41689f5f1e 100644
--- a/chromium/third_party/skia/gm/analytic_gradients.cpp
+++ b/chromium/third_party/skia/gm/analytic_gradients.cpp
@@ -91,7 +91,7 @@ const int* INTERVAL_COLOR_COUNTS[] = {
INT7_COLOR_COUNTS,
INT8_COLOR_COUNTS
};
-const int COLOR_COUNT = SK_ARRAY_COUNT(COLORS);
+const int COLOR_COUNT = std::size(COLORS);
const int* M_POSITIONS[] = {
M1_POSITIONS,
diff --git a/chromium/third_party/skia/gm/anisotropic.cpp b/chromium/third_party/skia/gm/anisotropic.cpp
index 874e19ae335..493e58714c5 100644
--- a/chromium/third_party/skia/gm/anisotropic.cpp
+++ b/chromium/third_party/skia/gm/anisotropic.cpp
@@ -97,35 +97,35 @@ protected:
void onDraw(SkCanvas* canvas) override {
SkScalar gScales[] = { 0.9f, 0.8f, 0.75f, 0.6f, 0.5f, 0.4f, 0.25f, 0.2f, 0.1f };
- SkASSERT(kNumVertImages-1 == (int)SK_ARRAY_COUNT(gScales)/2);
+ SkASSERT(kNumVertImages-1 == (int)std::size(gScales)/2);
// Minimize vertically
- for (int i = 0; i < (int)SK_ARRAY_COUNT(gScales); ++i) {
+ for (int i = 0; i < (int)std::size(gScales); ++i) {
int height = SkScalarFloorToInt(fImage->height() * gScales[i]);
int yOff;
- if (i <= (int)SK_ARRAY_COUNT(gScales)/2) {
+ if (i <= (int)std::size(gScales)/2) {
yOff = kSpacer + i * (fImage->height() + kSpacer);
} else {
// Position the more highly squashed images with their less squashed counterparts
- yOff = (SK_ARRAY_COUNT(gScales) - i) * (fImage->height() + kSpacer) - height;
+ yOff = (std::size(gScales) - i) * (fImage->height() + kSpacer) - height;
}
this->draw(canvas, kSpacer, yOff, fImage->width(), height);
}
// Minimize horizontally
- for (int i = 0; i < (int)SK_ARRAY_COUNT(gScales); ++i) {
+ for (int i = 0; i < (int)std::size(gScales); ++i) {
int width = SkScalarFloorToInt(fImage->width() * gScales[i]);
int xOff, yOff;
- if (i <= (int)SK_ARRAY_COUNT(gScales)/2) {
+ if (i <= (int)std::size(gScales)/2) {
xOff = fImage->width() + 2*kSpacer;
yOff = kSpacer + i * (fImage->height() + kSpacer);
} else {
// Position the more highly squashed images with their less squashed counterparts
xOff = fImage->width() + 2*kSpacer + fImage->width() - width;
- yOff = kSpacer + (SK_ARRAY_COUNT(gScales) - i - 1) * (fImage->height() + kSpacer);
+ yOff = kSpacer + (std::size(gScales) - i - 1) * (fImage->height() + kSpacer);
}
this->draw(canvas, xOff, yOff, width, fImage->height());
@@ -228,7 +228,7 @@ protected:
}
canvas->restore();
canvas->translate(ii.width() * sx + kPad, 0);
- c = (c + 1) % SK_ARRAY_COUNT(kColors);
+ c = (c + 1) % std::size(kColors);
}
canvas->restore();
canvas->translate(0, ii.width() * sy + kPad);
diff --git a/chromium/third_party/skia/gm/arcto.cpp b/chromium/third_party/skia/gm/arcto.cpp
index 46964b604d5..198a2405e70 100644
--- a/chromium/third_party/skia/gm/arcto.cpp
+++ b/chromium/third_party/skia/gm/arcto.cpp
@@ -225,7 +225,7 @@ DEF_SIMPLE_GM(bug583299, canvas, 300, 300) {
SkPathMeasure meas(path, false);
SkScalar length = meas.getLength();
SkScalar intervals[] = {0, length };
- int intervalCount = (int) SK_ARRAY_COUNT(intervals);
+ int intervalCount = (int) std::size(intervals);
p.setPathEffect(SkDashPathEffect::Make(intervals, intervalCount, 0));
canvas->drawPath(path, p);
}
diff --git a/chromium/third_party/skia/gm/arithmode.cpp b/chromium/third_party/skia/gm/arithmode.cpp
index 3e8a8a8b852..2f560df46f6 100644
--- a/chromium/third_party/skia/gm/arithmode.cpp
+++ b/chromium/third_party/skia/gm/arithmode.cpp
@@ -40,7 +40,7 @@ static sk_sp<SkImage> make_src(int w, int h) {
SK_ColorTRANSPARENT, SK_ColorGREEN, SK_ColorCYAN,
SK_ColorRED, SK_ColorMAGENTA, SK_ColorWHITE,
};
- paint.setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
+ paint.setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, std::size(colors),
SkTileMode::kClamp));
canvas->drawPaint(paint);
return surface->makeImageSnapshot();
@@ -56,7 +56,7 @@ static sk_sp<SkImage> make_dst(int w, int h) {
SK_ColorBLUE, SK_ColorYELLOW, SK_ColorBLACK, SK_ColorGREEN,
SK_ColorGRAY,
};
- paint.setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
+ paint.setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, std::size(colors),
SkTileMode::kClamp));
canvas->drawPaint(paint);
return surface->makeImageSnapshot();
@@ -106,7 +106,7 @@ class ArithmodeGM : public skiagm::GM {
};
const SkScalar* k = K;
- const SkScalar* stop = k + SK_ARRAY_COUNT(K);
+ const SkScalar* stop = k + std::size(K);
const SkRect rect = SkRect::MakeWH(WW, HH);
SkScalar gap = SkIntToScalar(WW + 20);
while (k < stop) {
diff --git a/chromium/third_party/skia/gm/asyncrescaleandread.cpp b/chromium/third_party/skia/gm/asyncrescaleandread.cpp
index 89bfb575b6a..365a9c0c660 100644
--- a/chromium/third_party/skia/gm/asyncrescaleandread.cpp
+++ b/chromium/third_party/skia/gm/asyncrescaleandread.cpp
@@ -388,7 +388,7 @@ DEF_SIMPLE_GM_CAN_FAIL(async_rescale_and_read_alpha_type, canvas, errorMsg, 512,
colors,
nullptr,
nullptr,
- SK_ARRAY_COUNT(colors),
+ std::size(colors),
SkTileMode::kRepeat);
SkPaint paint;
paint.setShader(std::move(shader));
diff --git a/chromium/third_party/skia/gm/attributes.cpp b/chromium/third_party/skia/gm/attributes.cpp
index f6d7088395f..ac487233717 100644
--- a/chromium/third_party/skia/gm/attributes.cpp
+++ b/chromium/third_party/skia/gm/attributes.cpp
@@ -20,11 +20,11 @@
#include "src/gpu/ganesh/GrProgramInfo.h"
#include "src/gpu/ganesh/GrResourceProvider.h"
#include "src/gpu/ganesh/GrShaderVar.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/ganesh/glsl/GrGLSLVertexGeoBuilder.h"
#include "src/gpu/ganesh/ops/GrDrawOp.h"
#include "src/gpu/ganesh/ops/GrOp.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
#include "tools/gpu/ProxyUtils.h"
#include <memory>
diff --git a/chromium/third_party/skia/gm/backdrop.cpp b/chromium/third_party/skia/gm/backdrop.cpp
index c7f2558c4c2..cf946781dfc 100644
--- a/chromium/third_party/skia/gm/backdrop.cpp
+++ b/chromium/third_party/skia/gm/backdrop.cpp
@@ -29,7 +29,7 @@ static sk_sp<SkShader> make_shader(SkScalar cx, SkScalar cy, SkScalar rad) {
SK_ColorRED, SK_ColorRED, SK_ColorBLUE, SK_ColorBLUE, SK_ColorGREEN, SK_ColorGREEN,
SK_ColorRED, SK_ColorRED, SK_ColorBLUE, SK_ColorBLUE, SK_ColorGREEN, SK_ColorGREEN,
};
- constexpr int count = SK_ARRAY_COUNT(colors);
+ constexpr int count = std::size(colors);
SkScalar pos[count] = { 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6 };
for (int i = 0; i < count; ++i) {
pos[i] *= 1.0f/6;
diff --git a/chromium/third_party/skia/gm/beziereffects.cpp b/chromium/third_party/skia/gm/beziereffects.cpp
index 85a8aab693d..edefd074faa 100644
--- a/chromium/third_party/skia/gm/beziereffects.cpp
+++ b/chromium/third_party/skia/gm/beziereffects.cpp
@@ -39,6 +39,7 @@
#include "src/gpu/ganesh/GrProgramInfo.h"
#include "src/gpu/ganesh/GrRecordingContextPriv.h"
#include "src/gpu/ganesh/GrUserStencilSettings.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/effects/GrBezierEffect.h"
#include "src/gpu/ganesh/effects/GrPorterDuffXferProcessor.h"
#include "src/gpu/ganesh/geometry/GrPathUtils.h"
@@ -46,7 +47,6 @@
#include "src/gpu/ganesh/ops/GrMeshDrawOp.h"
#include "src/gpu/ganesh/ops/GrOp.h"
#include "src/gpu/ganesh/ops/GrSimpleMeshDrawOpHelper.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
#include <memory>
#include <utility>
diff --git a/chromium/third_party/skia/gm/bigblurs.cpp b/chromium/third_party/skia/gm/bigblurs.cpp
index 143d82b2b52..7e1ef2e8c1e 100644
--- a/chromium/third_party/skia/gm/bigblurs.cpp
+++ b/chromium/third_party/skia/gm/bigblurs.cpp
@@ -81,7 +81,7 @@ protected:
for (int j = 0; j <= kLastEnum_SkBlurStyle; ++j) {
blurPaint.setMaskFilter(SkMaskFilter::MakeBlur((SkBlurStyle)j, kSigma));
- for (int k = 0; k < (int)SK_ARRAY_COUNT(origins); ++k) {
+ for (int k = 0; k < (int)std::size(origins); ++k) {
canvas->save();
SkRect clipRect = SkRect::MakeXYWH(SkIntToScalar(desiredX),
diff --git a/chromium/third_party/skia/gm/bigrrectaaeffect.cpp b/chromium/third_party/skia/gm/bigrrectaaeffect.cpp
index 844ed1ef6b8..ceeae9074e0 100644
--- a/chromium/third_party/skia/gm/bigrrectaaeffect.cpp
+++ b/chromium/third_party/skia/gm/bigrrectaaeffect.cpp
@@ -22,11 +22,11 @@
#include "src/gpu/ganesh/GrCaps.h"
#include "src/gpu/ganesh/GrFragmentProcessor.h"
#include "src/gpu/ganesh/GrPaint.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/effects/GrPorterDuffXferProcessor.h"
#include "src/gpu/ganesh/effects/GrRRectEffect.h"
#include "src/gpu/ganesh/ops/FillRectOp.h"
#include "src/gpu/ganesh/ops/GrDrawOp.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
#include "tools/ToolUtils.h"
#include <memory>
@@ -79,7 +79,7 @@ protected:
GrClipEdgeType::kInverseFillAA,
};
SkRect testBounds = SkRect::MakeIWH(fTestWidth, fTestHeight);
- for (size_t et = 0; et < SK_ARRAY_COUNT(kEdgeTypes); ++et) {
+ for (size_t et = 0; et < std::size(kEdgeTypes); ++et) {
GrClipEdgeType edgeType = kEdgeTypes[et];
canvas->save();
canvas->translate(SkIntToScalar(x), SkIntToScalar(y));
diff --git a/chromium/third_party/skia/gm/bitmapcopy.cpp b/chromium/third_party/skia/gm/bitmapcopy.cpp
index 8e3368dae02..3ca81356f42 100644
--- a/chromium/third_party/skia/gm/bitmapcopy.cpp
+++ b/chromium/third_party/skia/gm/bitmapcopy.cpp
@@ -60,7 +60,7 @@ constexpr SkColorType gColorTypes[] = {
kN32_SkColorType,
};
-#define NUM_CONFIGS SK_ARRAY_COUNT(gColorTypes)
+#define NUM_CONFIGS std::size(gColorTypes)
static void draw_checks(SkCanvas* canvas, int width, int height) {
SkPaint paint;
diff --git a/chromium/third_party/skia/gm/bitmapfilters.cpp b/chromium/third_party/skia/gm/bitmapfilters.cpp
index c5e6d416bf3..9e8fc630355 100644
--- a/chromium/third_party/skia/gm/bitmapfilters.cpp
+++ b/chromium/third_party/skia/gm/bitmapfilters.cpp
@@ -25,7 +25,7 @@ static void make_bm(SkBitmap* bm) {
SK_ColorBLUE, SK_ColorWHITE
};
SkPMColor colorsPM[4];
- for (size_t i = 0; i < SK_ARRAY_COUNT(colors); ++i) {
+ for (size_t i = 0; i < std::size(colors); ++i) {
colorsPM[i] = SkPreMultiplyColor(colors[i]);
}
bm->allocN32Pixels(2, 2, true);
diff --git a/chromium/third_party/skia/gm/bitmaprect.cpp b/chromium/third_party/skia/gm/bitmaprect.cpp
index 3d2f936d763..bec2630a483 100644
--- a/chromium/third_party/skia/gm/bitmaprect.cpp
+++ b/chromium/third_party/skia/gm/bitmaprect.cpp
@@ -73,7 +73,7 @@ protected:
SkRect dstR = { 0, 200, 128, 380 };
canvas->translate(16, 40);
- for (size_t i = 0; i < SK_ARRAY_COUNT(src); i++) {
+ for (size_t i = 0; i < std::size(src); i++) {
SkRect srcR;
srcR.set(src[i]);
diff --git a/chromium/third_party/skia/gm/bleed.cpp b/chromium/third_party/skia/gm/bleed.cpp
index 2666d0a9708..a9825bde361 100644
--- a/chromium/third_party/skia/gm/bleed.cpp
+++ b/chromium/third_party/skia/gm/bleed.cpp
@@ -138,7 +138,7 @@ protected:
imageSetEntry[0].fDstRect = dstRect;
imageSetEntry[0].fAAFlags = paint->isAntiAlias() ? SkCanvas::kAll_QuadAAFlags
: SkCanvas::kNone_QuadAAFlags;
- canvas->experimental_DrawEdgeAAImageSet(imageSetEntry, SK_ARRAY_COUNT(imageSetEntry),
+ canvas->experimental_DrawEdgeAAImageSet(imageSetEntry, std::size(imageSetEntry),
/*dstClips=*/nullptr,
/*preViewMatrices=*/nullptr,
sampling, paint, fConstraint);
diff --git a/chromium/third_party/skia/gm/blurcircles.cpp b/chromium/third_party/skia/gm/blurcircles.cpp
index 6dcf439c111..f369eb41d92 100644
--- a/chromium/third_party/skia/gm/blurcircles.cpp
+++ b/chromium/third_party/skia/gm/blurcircles.cpp
@@ -52,7 +52,7 @@ protected:
for (size_t i = 0; i < kNumBlurs; ++i) {
SkAutoCanvasRestore autoRestore(canvas, true);
canvas->translate(0, 150.f*i);
- for (size_t j = 0; j < SK_ARRAY_COUNT(circleRadii); ++j) {
+ for (size_t j = 0; j < std::size(circleRadii); ++j) {
SkPaint paint;
paint.setColor(SK_ColorBLACK);
paint.setMaskFilter(fBlurFilters[i]);
diff --git a/chromium/third_party/skia/gm/blurquickreject.cpp b/chromium/third_party/skia/gm/blurquickreject.cpp
index 42e6ff49290..851a183cb76 100644
--- a/chromium/third_party/skia/gm/blurquickreject.cpp
+++ b/chromium/third_party/skia/gm/blurquickreject.cpp
@@ -55,7 +55,7 @@ protected:
SK_ColorBLUE,
SK_ColorYELLOW,
};
- SkASSERT(SK_ARRAY_COUNT(colors) == SK_ARRAY_COUNT(blurRects));
+ SkASSERT(std::size(colors) == std::size(blurRects));
SkPaint hairlinePaint;
hairlinePaint.setStyle(SkPaint::kStroke_Style);
@@ -71,7 +71,7 @@ protected:
canvas->translate(kBoxSize, kBoxSize);
canvas->drawRect(clipRect, hairlinePaint);
canvas->clipRect(clipRect);
- for (size_t i = 0; i < SK_ARRAY_COUNT(blurRects); ++i) {
+ for (size_t i = 0; i < std::size(blurRects); ++i) {
blurPaint.setColor(colors[i]);
canvas->drawRect(blurRects[i], blurPaint);
canvas->drawRect(blurRects[i], hairlinePaint);
diff --git a/chromium/third_party/skia/gm/blurrect.cpp b/chromium/third_party/skia/gm/blurrect.cpp
index 07f734d87ed..3b01c412bcc 100644
--- a/chromium/third_party/skia/gm/blurrect.cpp
+++ b/chromium/third_party/skia/gm/blurrect.cpp
@@ -100,7 +100,7 @@ static sk_sp<SkShader> make_radial() {
SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4));
return SkGradientShader::MakeTwoPointConical(center1, (pts[1].fX - pts[0].fX) / 7,
center0, (pts[1].fX - pts[0].fX) / 2,
- colors, pos, SK_ARRAY_COUNT(colors), tm,
+ colors, pos, std::size(colors), tm,
0, &scale);
}
@@ -132,9 +132,9 @@ private:
SkRect r = { 0, 0, 100, 50 };
SkScalar scales[] = { SK_Scalar1, 0.6f };
- for (size_t s = 0; s < SK_ARRAY_COUNT(scales); ++s) {
+ for (size_t s = 0; s < std::size(scales); ++s) {
canvas->save();
- for (size_t f = 0; f < SK_ARRAY_COUNT(fMaskFilters); ++f) {
+ for (size_t f = 0; f < std::size(fMaskFilters); ++f) {
SkPaint paint;
paint.setMaskFilter(fMaskFilters[f]);
paint.setAlpha(fAlpha);
@@ -148,16 +148,16 @@ private:
canvas->save();
canvas->scale(scales[s], scales[s]);
- this->drawProcs(canvas, r, paint, false, procs, SK_ARRAY_COUNT(procs));
+ this->drawProcs(canvas, r, paint, false, procs, std::size(procs));
canvas->translate(r.width() * 4/3, 0);
- this->drawProcs(canvas, r, paintWithRadial, false, procs, SK_ARRAY_COUNT(procs));
+ this->drawProcs(canvas, r, paintWithRadial, false, procs, std::size(procs));
canvas->translate(r.width() * 4/3, 0);
- this->drawProcs(canvas, r, paint, true, procs, SK_ARRAY_COUNT(procs));
+ this->drawProcs(canvas, r, paint, true, procs, std::size(procs));
canvas->translate(r.width() * 4/3, 0);
- this->drawProcs(canvas, r, paintWithRadial, true, procs, SK_ARRAY_COUNT(procs));
+ this->drawProcs(canvas, r, paintWithRadial, true, procs, std::size(procs));
canvas->restore();
- canvas->translate(0, SK_ARRAY_COUNT(procs) * r.height() * 4/3 * scales[s]);
+ canvas->translate(0, std::size(procs) * r.height() * 4/3 * scales[s]);
}
canvas->restore();
canvas->translate(4 * r.width() * 4/3 * scales[s], 0);
@@ -200,16 +200,16 @@ DEF_SIMPLE_GM(blurrect_gallery, canvas, 1200, 1024) {
int max_height = 0;
- for (size_t i = 0 ; i < SK_ARRAY_COUNT(widths) ; i++) {
+ for (size_t i = 0 ; i < std::size(widths) ; i++) {
int width = widths[i];
int height = heights[i];
SkRect r;
r.setWH(SkIntToScalar(width), SkIntToScalar(height));
SkAutoCanvasRestore autoRestore(canvas, true);
- for (size_t j = 0 ; j < SK_ARRAY_COUNT(radii) ; j++) {
+ for (size_t j = 0 ; j < std::size(radii) ; j++) {
float radius = radii[j];
- for (size_t k = 0 ; k < SK_ARRAY_COUNT(styles) ; k++) {
+ for (size_t k = 0 ; k < std::size(styles) ; k++) {
SkBlurStyle style = styles[k];
SkMask mask;
@@ -485,8 +485,8 @@ private:
inline static constexpr int kSizes[] = {1, 2, 4, 8, 16, 32};
inline static constexpr float kSigmas[] = {0.5f, 1.2f, 2.3f, 3.9f, 7.4f};
- inline static constexpr size_t kNumSizes = SK_ARRAY_COUNT(kSizes);
- inline static constexpr size_t kNumSigmas = SK_ARRAY_COUNT(kSigmas);
+ inline static constexpr size_t kNumSizes = std::size(kSizes);
+ inline static constexpr size_t kNumSigmas = std::size(kSigmas);
sk_sp<SkImage> fReferenceMasks[kNumSigmas][kNumSizes][kNumSizes];
sk_sp<SkImage> fActualMasks[kNumSigmas][kNumSizes][kNumSizes];
@@ -509,7 +509,7 @@ DEF_GM(return new skiagm::BlurRectCompareGM();)
DEF_SIMPLE_GM(blur_matrix_rect, canvas, 650, 685) {
static constexpr auto kRect = SkRect::MakeWH(14, 60);
static constexpr float kSigmas[] = {0.5f, 1.2f, 2.3f, 3.9f, 7.4f};
- static constexpr size_t kNumSigmas = SK_ARRAY_COUNT(kSigmas);
+ static constexpr size_t kNumSigmas = std::size(kSigmas);
const SkPoint c = {kRect.centerX(), kRect.centerY()};
diff --git a/chromium/third_party/skia/gm/blurroundrect.cpp b/chromium/third_party/skia/gm/blurroundrect.cpp
index 48e394c8576..5875a9a0617 100644
--- a/chromium/third_party/skia/gm/blurroundrect.cpp
+++ b/chromium/third_party/skia/gm/blurroundrect.cpp
@@ -48,7 +48,7 @@ static sk_sp<SkShader> MakeRadial() {
SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4));
return SkGradientShader::MakeTwoPointConical(center1, (pts[1].fX - pts[0].fX) / 7,
center0, (pts[1].fX - pts[0].fX) / 2,
- colors, pos, SK_ARRAY_COUNT(colors), tm,
+ colors, pos, std::size(colors), tm,
0, &scale);
}
@@ -67,10 +67,10 @@ class SimpleBlurRoundRectGM : public skiagm::GM {
const float blurRadii[] = { 1,5,10,20 };
const int cornerRadii[] = { 1,5,10,20 };
const SkRect r = SkRect::MakeWH(SkIntToScalar(25), SkIntToScalar(25));
- for (size_t i = 0; i < SK_ARRAY_COUNT(blurRadii); ++i) {
+ for (size_t i = 0; i < std::size(blurRadii); ++i) {
SkAutoCanvasRestore autoRestore(canvas, true);
canvas->translate(0, (r.height() + SkIntToScalar(50)) * i);
- for (size_t j = 0; j < SK_ARRAY_COUNT(cornerRadii); ++j) {
+ for (size_t j = 0; j < std::size(cornerRadii); ++j) {
for (int k = 0; k <= 1; k++) {
SkPaint paint;
paint.setColor(SK_ColorBLACK);
diff --git a/chromium/third_party/skia/gm/blurs.cpp b/chromium/third_party/skia/gm/blurs.cpp
index 32757a5f5d9..a3a02fe1990 100644
--- a/chromium/third_party/skia/gm/blurs.cpp
+++ b/chromium/third_party/skia/gm/blurs.cpp
@@ -42,7 +42,7 @@ DEF_SIMPLE_GM_BG(blurs, canvas, 700, 500, 0xFFDDDDDD) {
canvas->translate(SkIntToScalar(-40), SkIntToScalar(0));
- for (size_t i = 0; i < SK_ARRAY_COUNT(gRecs); i++) {
+ for (size_t i = 0; i < std::size(gRecs); i++) {
if (gRecs[i].fStyle != NONE) {
paint.setMaskFilter(SkMaskFilter::MakeBlur(gRecs[i].fStyle,
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(20))));
diff --git a/chromium/third_party/skia/gm/bug530095.cpp b/chromium/third_party/skia/gm/bug530095.cpp
index 1a2a7dc15f1..00e6ea8739a 100644
--- a/chromium/third_party/skia/gm/bug530095.cpp
+++ b/chromium/third_party/skia/gm/bug530095.cpp
@@ -24,13 +24,13 @@ DEF_SIMPLE_GM(bug530095, canvas, 900, 1200) {
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(26);
SkScalar intervals[] = {700, 700 };
- int intervalCount = (int) SK_ARRAY_COUNT(intervals);
+ int intervalCount = (int) std::size(intervals);
paint.setPathEffect(SkDashPathEffect::Make(intervals, intervalCount, -40));
canvas->drawPath(path1, paint);
paint.setStrokeWidth(0.26f);
SkScalar smIntervals[] = {7, 7 };
- int smIntervalCount = (int) SK_ARRAY_COUNT(smIntervals);
+ int smIntervalCount = (int) std::size(smIntervals);
paint.setPathEffect(SkDashPathEffect::Make(smIntervals, smIntervalCount, -0.40f));
canvas->save();
canvas->scale(100, 100);
@@ -60,6 +60,6 @@ DEF_SIMPLE_GM(bug591993, canvas, 40, 140) {
p.setStrokeCap(SkPaint::kRound_Cap);
p.setStrokeWidth(10);
const SkScalar intervals[] = { 100, 100 };
- p.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 100));
+ p.setPathEffect(SkDashPathEffect::Make(intervals, std::size(intervals), 100));
canvas->drawLine(20, 20, 120, 20, p);
}
diff --git a/chromium/third_party/skia/gm/bug6643.cpp b/chromium/third_party/skia/gm/bug6643.cpp
index ceebdc1ef14..accc5c991be 100644
--- a/chromium/third_party/skia/gm/bug6643.cpp
+++ b/chromium/third_party/skia/gm/bug6643.cpp
@@ -22,7 +22,7 @@ DEF_SIMPLE_GM(bug6643, canvas, 200, 200) {
SkPaint p;
p.setAntiAlias(true);
- p.setShader(SkGradientShader::MakeSweep(100, 100, colors, nullptr, SK_ARRAY_COUNT(colors),
+ p.setShader(SkGradientShader::MakeSweep(100, 100, colors, nullptr, std::size(colors),
SkGradientShader::kInterpolateColorsInPremul_Flag,
nullptr));
diff --git a/chromium/third_party/skia/gm/bug9331.cpp b/chromium/third_party/skia/gm/bug9331.cpp
index fc6dc8a2bb0..0125a46b670 100644
--- a/chromium/third_party/skia/gm/bug9331.cpp
+++ b/chromium/third_party/skia/gm/bug9331.cpp
@@ -26,7 +26,7 @@ DEF_SIMPLE_GM(bug9331, canvas, 256, 256) {
paint.setColor(color);
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(10);
- paint.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), phase));
+ paint.setPathEffect(SkDashPathEffect::Make(intervals, std::size(intervals), phase));
canvas->save();
canvas->clipRect(clip);
diff --git a/chromium/third_party/skia/gm/cgm.c b/chromium/third_party/skia/gm/cgm.c
deleted file mode 100644
index cc03d89233a..00000000000
--- a/chromium/third_party/skia/gm/cgm.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#include "include/c/sk_canvas.h"
-#include "include/c/sk_data.h"
-#include "include/c/sk_image.h"
-#include "include/c/sk_imageinfo.h"
-#include "include/c/sk_paint.h"
-#include "include/c/sk_shader.h"
-#include "include/c/sk_surface.h"
-#include "include/c/sk_types.h"
-
-#include <stdbool.h>
-#include <stddef.h>
-
-extern void sk_test_c_api(sk_canvas_t*);
-
-#define W 256
-#define H 256
-
-static sk_shader_t* make_shader() {
- sk_point_t pts[] = { { 0, 0 }, { W, H } };
- sk_color_t colors[] = { 0xFF00FF00, 0xFF0000FF };
- return sk_shader_new_linear_gradient(pts, colors, NULL, 2, CLAMP_SK_SHADER_TILEMODE, NULL);
-}
-
-static void do_draw(sk_canvas_t* canvas) {
- sk_paint_t* paint = sk_paint_new();
- sk_paint_set_antialias(paint, true);
-
- sk_paint_set_color(paint, 0xFFFFFFFF);
- sk_canvas_draw_paint(canvas, paint);
-
- sk_rect_t r = { 10, 10, W - 10, H - 10 };
-
- sk_paint_set_color(paint, 0xFFFF0000);
- sk_canvas_draw_rect(canvas, &r, paint);
-
- sk_shader_t* shader = make_shader();
- sk_paint_set_shader(paint, shader);
- sk_shader_unref(shader);
-
- sk_canvas_draw_oval(canvas, &r, paint);
-
- sk_paint_delete(paint);
-}
-
-void sk_test_c_api(sk_canvas_t* canvas) {
- do_draw(canvas);
-
- sk_imageinfo_t* info = sk_imageinfo_new(W, H, RGBA_8888_SK_COLORTYPE, OPAQUE_SK_ALPHATYPE,
- NULL);
- sk_surfaceprops_t surfaceProps = { UNKNOWN_SK_PIXELGEOMETRY };
- sk_surface_t* surf = sk_surface_new_raster(info, &surfaceProps);
- sk_imageinfo_delete(info);
- do_draw(sk_surface_get_canvas(surf));
-
- sk_image_t* img0 = sk_surface_new_image_snapshot(surf);
- sk_surface_unref(surf);
-
- sk_canvas_draw_image(canvas, img0, W + 10, 10, NULL, NULL);
-
- sk_data_t* data = sk_image_encode(img0);
- sk_image_unref(img0);
-
- sk_image_t* img1 = sk_image_new_from_encoded(data);
- sk_data_unref(data);
-
- if (img1) {
- sk_canvas_draw_image(canvas, img1, W/2, H/2, NULL, NULL);
- sk_image_unref(img1);
- }
-}
-
-
diff --git a/chromium/third_party/skia/gm/cgms.cpp b/chromium/third_party/skia/gm/cgms.cpp
deleted file mode 100644
index e45f3709a15..00000000000
--- a/chromium/third_party/skia/gm/cgms.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "gm/gm.h"
-#include "include/c/sk_types.h"
-
-class SkCanvas;
-
-extern "C" void sk_test_c_api(sk_canvas_t*);
-
-DEF_SIMPLE_GM(c_gms, canvas, 640, 480) {
- sk_test_c_api((sk_canvas_t*)canvas);
-}
diff --git a/chromium/third_party/skia/gm/circulararcs.cpp b/chromium/third_party/skia/gm/circulararcs.cpp
index 448473eae54..bc8fba66231 100644
--- a/chromium/third_party/skia/gm/circulararcs.cpp
+++ b/chromium/third_party/skia/gm/circulararcs.cpp
@@ -208,7 +208,7 @@ DEF_SIMPLE_GM(circular_arcs_weird, canvas, 1000, 400) {
SkPaint linePaint;
linePaint.setAntiAlias(true);
linePaint.setColor(SK_ColorRED);
- SkScalar midX = SK_ARRAY_COUNT(arcs) * (kS + kPad) - kPad/2.f;
+ SkScalar midX = std::size(arcs) * (kS + kPad) - kPad/2.f;
SkScalar height = paints.count() * (kS + kPad);
canvas->drawLine(midX, -kPad, midX, height, linePaint);
diff --git a/chromium/third_party/skia/gm/circularclips.cpp b/chromium/third_party/skia/gm/circularclips.cpp
index 77021cf78c7..697e7b8ebad 100644
--- a/chromium/third_party/skia/gm/circularclips.cpp
+++ b/chromium/third_party/skia/gm/circularclips.cpp
@@ -73,7 +73,7 @@ protected:
}
canvas->save();
- for (size_t op = 0; op < SK_ARRAY_COUNT(ops); op++) {
+ for (size_t op = 0; op < std::size(ops); op++) {
canvas->save();
canvas->clipPath(fCircle1);
diff --git a/chromium/third_party/skia/gm/clockwise.cpp b/chromium/third_party/skia/gm/clockwise.cpp
index df50f6346b0..ea7c826cb9e 100644
--- a/chromium/third_party/skia/gm/clockwise.cpp
+++ b/chromium/third_party/skia/gm/clockwise.cpp
@@ -42,11 +42,11 @@
#include "src/gpu/ganesh/GrShaderVar.h"
#include "src/gpu/ganesh/GrSurfaceProxy.h"
#include "src/gpu/ganesh/GrTextureProxy.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/ganesh/glsl/GrGLSLVarying.h"
#include "src/gpu/ganesh/ops/GrDrawOp.h"
#include "src/gpu/ganesh/ops/GrOp.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
#include "tools/gpu/ProxyUtils.h"
#include <memory>
@@ -275,7 +275,7 @@ DrawResult ClockwiseGM::onDraw(GrRecordingContext* rContext, SkCanvas* canvas, S
GrColorType sdcColorType = sdc->colorInfo().colorType();
if (auto topLeftSDC = skgpu::v1::SurfaceDrawContext::Make(
rContext, sdcColorType, nullptr, SkBackingFit::kExact, {100, 200}, SkSurfaceProps(),
- 1, GrMipmapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin,
+ /*label=*/{}, 1, GrMipmapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin,
SkBudgeted::kYes)) {
topLeftSDC->clear(SK_PMColor4fTRANSPARENT);
topLeftSDC->addDrawOp(ClockwiseTestOp::Make(rContext, false, 0));
@@ -298,7 +298,7 @@ DrawResult ClockwiseGM::onDraw(GrRecordingContext* rContext, SkCanvas* canvas, S
// Draw the test to an off-screen, bottom-up render target.
if (auto topLeftSDC = skgpu::v1::SurfaceDrawContext::Make(
rContext, sdcColorType, nullptr, SkBackingFit::kExact, {100, 200}, SkSurfaceProps(),
- 1, GrMipmapped::kNo, GrProtected::kNo, kBottomLeft_GrSurfaceOrigin,
+ /*label=*/{}, 1, GrMipmapped::kNo, GrProtected::kNo, kBottomLeft_GrSurfaceOrigin,
SkBudgeted::kYes)) {
topLeftSDC->clear(SK_PMColor4fTRANSPARENT);
topLeftSDC->addDrawOp(ClockwiseTestOp::Make(rContext, false, 0));
diff --git a/chromium/third_party/skia/gm/color4f.cpp b/chromium/third_party/skia/gm/color4f.cpp
index 92ffcbec7dd..d12415e1e76 100644
--- a/chromium/third_party/skia/gm/color4f.cpp
+++ b/chromium/third_party/skia/gm/color4f.cpp
@@ -127,3 +127,40 @@ DEF_SIMPLE_GM(color4shader, canvas, 360, 480) {
canvas->translate(0, r.height() * 6 / 5);
}
}
+
+DEF_SIMPLE_GM(color4blendcf, canvas, 360, 480) {
+ canvas->translate(10, 10);
+
+ auto srgb = SkColorSpace::MakeSRGB();
+ auto spin = srgb->makeColorSpin(); // RGB -> GBR
+
+ const SkColor4f colors[] {
+ { 1, 0, 0, 1 },
+ { 0, 1, 0, 1 },
+ { 0, 0, 1, 1 },
+ { 0.5, 0.5, 0.5, 1 },
+ };
+
+ SkPaint paint;
+ paint.setColor(SK_ColorWHITE);
+ SkRect r = SkRect::MakeWH(100, 100);
+
+ for (const auto& c4 : colors) {
+ sk_sp<SkColorFilter> filters[] {
+ // Use kModulate and a paint color of white so the final drawn color is color-space
+ // managed 'c4'.
+ SkColorFilters::Blend(c4, nullptr, SkBlendMode::kModulate),
+ SkColorFilters::Blend(c4, srgb, SkBlendMode::kModulate),
+ SkColorFilters::Blend(c4, spin, SkBlendMode::kModulate),
+ };
+
+ canvas->save();
+ for (const auto& f : filters) {
+ paint.setColorFilter(f);
+ canvas->drawRect(r, paint);
+ canvas->translate(r.width() * 6 / 5, 0);
+ }
+ canvas->restore();
+ canvas->translate(0, r.height() * 6 / 5);
+ }
+}
diff --git a/chromium/third_party/skia/gm/coloremoji.cpp b/chromium/third_party/skia/gm/coloremoji.cpp
index 14b51aee104..65008cba4f2 100644
--- a/chromium/third_party/skia/gm/coloremoji.cpp
+++ b/chromium/third_party/skia/gm/coloremoji.cpp
@@ -40,7 +40,7 @@ static sk_sp<SkShader> MakeLinear() {
constexpr SkPoint kPts[] = { { 0, 0 }, { 32, 32 } };
constexpr SkScalar kPos[] = { 0, SK_Scalar1/2, SK_Scalar1 };
constexpr SkColor kColors[] = {0x80F00080, 0xF0F08000, 0x800080F0 };
- return SkGradientShader::MakeLinear(kPts, kColors, kPos, SK_ARRAY_COUNT(kColors),
+ return SkGradientShader::MakeLinear(kPts, kColors, kPos, std::size(kColors),
SkTileMode::kClamp);
}
diff --git a/chromium/third_party/skia/gm/coloremoji_blendmodes.cpp b/chromium/third_party/skia/gm/coloremoji_blendmodes.cpp
index a2da3c90462..6add32e87ae 100644
--- a/chromium/third_party/skia/gm/coloremoji_blendmodes.cpp
+++ b/chromium/third_party/skia/gm/coloremoji_blendmodes.cpp
@@ -52,7 +52,7 @@ protected:
local.setRotate(180);
SkPaint paint;
paint.setAntiAlias(true);
- paint.setShader(SkGradientShader::MakeSweep(0, 0, colors, nullptr, SK_ARRAY_COUNT(colors),
+ paint.setShader(SkGradientShader::MakeSweep(0, 0, colors, nullptr, std::size(colors),
0, &local));
sk_sp<SkTypeface> orig(ToolUtils::create_portable_typeface("serif", SkFontStyle::Bold()));
@@ -126,7 +126,7 @@ protected:
SkScalar x0 = 0;
SkScalar y0 = 0;
SkScalar x = x0, y = y0;
- for (size_t i = 0; i < SK_ARRAY_COUNT(gModes); i++) {
+ for (size_t i = 0; i < std::size(gModes); i++) {
SkRect r;
r.setLTRB(x, y, x+w, y+h);
diff --git a/chromium/third_party/skia/gm/colorfilters.cpp b/chromium/third_party/skia/gm/colorfilters.cpp
index 1e4dfd6c1f4..0f0ad557b54 100644
--- a/chromium/third_party/skia/gm/colorfilters.cpp
+++ b/chromium/third_party/skia/gm/colorfilters.cpp
@@ -34,7 +34,7 @@ static sk_sp<SkShader> make_shader(const SkRect& bounds) {
SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorBLACK,
SK_ColorCYAN, SK_ColorMAGENTA, SK_ColorYELLOW,
};
- return SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
+ return SkGradientShader::MakeLinear(pts, colors, nullptr, std::size(colors),
SkTileMode::kClamp);
}
@@ -73,7 +73,7 @@ class ColorFiltersGM : public skiagm::GM {
};
canvas->translate(10, 10);
- for (size_t i = 0; i < SK_ARRAY_COUNT(rec); ++i) {
+ for (size_t i = 0; i < std::size(rec); ++i) {
rec[i].fProc(&paint, rec[i].fData0, rec[i].fData1);
canvas->drawRect(r, paint);
canvas->translate(0, r.height() + 10);
@@ -102,7 +102,7 @@ protected:
for (const auto& cols : gGrads) {
fShaders.push_back(SkGradientShader::MakeSweep(kWheelSize / 2, kWheelSize / 2,
- cols, nullptr, SK_ARRAY_COUNT(cols),
+ cols, nullptr, std::size(cols),
SkTileMode::kRepeat, -90, 270, 0,
nullptr));
}
diff --git a/chromium/third_party/skia/gm/colormatrix.cpp b/chromium/third_party/skia/gm/colormatrix.cpp
index 1d39805154f..c49c6be1654 100644
--- a/chromium/third_party/skia/gm/colormatrix.cpp
+++ b/chromium/third_party/skia/gm/colormatrix.cpp
@@ -95,7 +95,7 @@ protected:
paint.setBlendMode(SkBlendMode::kSrc);
const SkImage* bmps[] = { fSolidImg.get(), fTransparentImg.get() };
- for (size_t i = 0; i < SK_ARRAY_COUNT(bmps); ++i) {
+ for (size_t i = 0; i < std::size(bmps); ++i) {
matrix.setIdentity();
set_color_matrix(&paint, matrix);
canvas->drawImage(bmps[i], 0, 0, SkSamplingOptions(), &paint);
diff --git a/chromium/third_party/skia/gm/colorspace.cpp b/chromium/third_party/skia/gm/colorspace.cpp
index 9b5cc92ffd3..942e28a20c6 100644
--- a/chromium/third_party/skia/gm/colorspace.cpp
+++ b/chromium/third_party/skia/gm/colorspace.cpp
@@ -112,10 +112,10 @@ static void draw_colorspace_gm(Strategy strategy, SkCanvas* canvas) {
}
}
-DEF_SIMPLE_GM(colorspace, canvas, W*SK_ARRAY_COUNT(gTFs), H*SK_ARRAY_COUNT(gGamuts)) {
+DEF_SIMPLE_GM(colorspace, canvas, W*std::size(gTFs), H*std::size(gGamuts)) {
draw_colorspace_gm(SkImage_makeColorSpace, canvas);
}
-DEF_SIMPLE_GM(colorspace2, canvas, W*SK_ARRAY_COUNT(gTFs), H*SK_ARRAY_COUNT(gGamuts)) {
+DEF_SIMPLE_GM(colorspace2, canvas, W*std::size(gTFs), H*std::size(gGamuts)) {
draw_colorspace_gm(SkCanvas_makeSurface, canvas);
}
diff --git a/chromium/third_party/skia/gm/colrv1.cpp b/chromium/third_party/skia/gm/colrv1.cpp
index ea133e42ff2..01f31ac629d 100644
--- a/chromium/third_party/skia/gm/colrv1.cpp
+++ b/chromium/third_party/skia/gm/colrv1.cpp
@@ -10,6 +10,7 @@
#include "include/core/SkColor.h"
#include "include/core/SkFont.h"
#include "include/core/SkFontMetrics.h"
+#include "include/core/SkGraphics.h"
#include "include/core/SkPaint.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkScalar.h"
@@ -24,143 +25,104 @@
namespace skiagm {
+namespace {
+const SkScalar kTextSizes[] = {12, 18, 30, 120};
+const char kTestFontName[] = "fonts/test_glyphs-glyf_colr_1.ttf";
+const char kTestFontNameVariable[] = "fonts/test_glyphs-glyf_colr_1_variable.ttf";
+const SkScalar xWidth = 1200;
+const SkScalar xTranslate = 200;
+}
+
class ColrV1GM : public GM {
public:
-
- // TODO(drott): Consolidate test fonts.
- enum ColrV1TestType {
- kSkiaSampleFont,
- kColorFontsRepoGradients,
- kColorFontsRepoScaling,
- kColorFontsRepoExtendMode,
- kColorFontsRepoRotate,
- kColorFontsRepoSkew,
- kColorFontsRepoTransform,
- kColorFontsRepoClipBox,
- kColorFontsRepoComposite,
- kColorFontsRepoForeground,
- kColorFontsRepoSweepPad,
- kColorFontsRepoSweepReflect,
- kColorFontsRepoSweepRepeat,
- };
-
- ColrV1GM(ColrV1TestType testType, SkScalar skewX, SkScalar rotateDeg)
- : fSkewX(skewX), fRotateDeg(rotateDeg), fTestType(testType) {}
-
-protected:
- static SkString testTypeToString(ColrV1TestType testType) {
- switch (testType) {
- case kSkiaSampleFont:
- return SkString("skia");
- case kColorFontsRepoGradients:
- return SkString("gradients");
- case kColorFontsRepoScaling:
- return SkString("scaling");
- case kColorFontsRepoExtendMode:
- return SkString("extend_mode");
- case kColorFontsRepoRotate:
- return SkString("rotate");
- case kColorFontsRepoSkew:
- return SkString("skew");
- case kColorFontsRepoTransform:
- return SkString("transform");
- case kColorFontsRepoClipBox:
- return SkString("clipbox");
- case kColorFontsRepoComposite:
- return SkString("composite");
- case kColorFontsRepoForeground:
- return SkString("foreground");
- case kColorFontsRepoSweepPad:
- return SkString("sweep_pad");
- case kColorFontsRepoSweepReflect:
- return SkString("sweep_reflect");
- case kColorFontsRepoSweepRepeat:
- return SkString("sweep_repeat");
+ ColrV1GM(const char* testName,
+ SkSpan<const uint32_t> codepoints,
+ SkScalar skewX,
+ SkScalar rotateDeg,
+ std::initializer_list<SkFontArguments::VariationPosition::Coordinate>
+ specifiedVariations)
+ : fTestName(testName)
+ , fCodepoints(codepoints)
+ , fSkewX(skewX)
+ , fRotateDeg(rotateDeg) {
+ fVariationPosition.coordinateCount = specifiedVariations.size();
+ fCoordinates = std::make_unique<SkFontArguments::VariationPosition::Coordinate[]>(
+ specifiedVariations.size());
+ for (size_t i = 0; i < specifiedVariations.size(); ++i) {
+ fCoordinates[i] = std::data(specifiedVariations)[i];
}
- SkASSERT(false); /* not reached */
- return SkString();
- }
- struct EmojiFont {
- sk_sp<SkTypeface> fTypeface;
- std::vector<uint16_t> fGlyphs;
- size_t bytesize() { return fGlyphs.size() * sizeof(uint16_t); }
- } fEmojiFont;
+ fVariationPosition.coordinates = fCoordinates.get();
+ }
+protected:
void onOnceBeforeDraw() override {
- if (fTestType == kSkiaSampleFont) {
- fEmojiFont.fTypeface = MakeResourceAsTypeface("fonts/colrv1_samples.ttf");
- fEmojiFont.fGlyphs = {19, 33, 34, 35, 20, 21, 22, 23, 24, 25};
- return;
- }
-
- fEmojiFont.fTypeface = MakeResourceAsTypeface("fonts/more_samples-glyf_colr_1.ttf");
-
- switch (fTestType) {
- case kSkiaSampleFont:
- SkASSERT(false);
- break;
- case kColorFontsRepoGradients:
- fEmojiFont.fGlyphs = {2, 5, 6, 7, 8, 55};
- break;
- case kColorFontsRepoScaling:
- fEmojiFont.fGlyphs = {9, 10, 11, 12, 13, 14};
- break;
- case kColorFontsRepoExtendMode:
- fEmojiFont.fGlyphs = {15, 16, 17, 18, 19, 20};
- break;
- case kColorFontsRepoRotate:
- fEmojiFont.fGlyphs = {21, 22, 23, 24};
- break;
- case kColorFontsRepoSkew:
- fEmojiFont.fGlyphs = {25, 26, 27, 28, 29, 30};
- break;
- case kColorFontsRepoTransform:
- fEmojiFont.fGlyphs = {31, 32, 33, 34};
- break;
- case kColorFontsRepoClipBox:
- fEmojiFont.fGlyphs = {35, 36, 37, 38, 39};
- break;
- case kColorFontsRepoComposite:
- fEmojiFont.fGlyphs = {40, 41, 42, 43, 44, 45, 46};
- break;
- case kColorFontsRepoForeground:
- fEmojiFont.fGlyphs = {47, 48, 49, 50, 51, 52, 53, 54};
- break;
- case kColorFontsRepoSweepPad:
- fEmojiFont.fGlyphs = {2, 58, 59, 60, 61, 62, 63, 64};
- break;
- case kColorFontsRepoSweepReflect:
- fEmojiFont.fGlyphs = {65, 66, 67, 68, 69, 70, 71, 72};
- break;
- case kColorFontsRepoSweepRepeat:
- fEmojiFont.fGlyphs = {73, 74, 75, 76, 77, 78, 79, 80};
- break;
+ if (fVariationPosition.coordinateCount) {
+ fTypeface = MakeResourceAsTypeface(kTestFontNameVariable);
+ } else {
+ fTypeface = MakeResourceAsTypeface(kTestFontName);
}
+ fVariationSliders = ToolUtils::VariationSliders(fTypeface.get(), fVariationPosition);
}
SkString onShortName() override {
- SkString gm_name = SkStringPrintf("colrv1_%s_samples",
- testTypeToString(fTestType).c_str());
+ SkASSERT(!fTestName.isEmpty());
+ SkString gm_name = SkStringPrintf("colrv1_%s", fTestName.c_str());
+
if (fSkewX) {
- gm_name.append("_skew");
+ gm_name.append(SkStringPrintf("_skew_%.2f", fSkewX));
}
if (fRotateDeg) {
- gm_name.append("_rotate");
+ gm_name.append(SkStringPrintf("_rotate_%.2f", fRotateDeg));
}
+
+ for (int i = 0; i < fVariationPosition.coordinateCount; ++i) {
+ SkString tagName = ToolUtils::VariationSliders::tagToString(
+ fVariationPosition.coordinates[i].axis);
+ gm_name.append(SkStringPrintf(
+ "_%s_%.2f", tagName.c_str(), fVariationPosition.coordinates[i].value));
+ }
+
return gm_name;
}
- SkISize onISize() override { return SkISize::Make(1400, 600); }
+ bool onGetControls(SkMetaData* controls) override {
+ return fVariationSliders.writeControls(controls);
+ }
+
+ void onSetControls(const SkMetaData& controls) override {
+ return fVariationSliders.readControls(controls);
+ }
+
+ SkISize onISize() override {
+ // Sweep tests get a slightly wider canvas so that glyphs from one group fit in one row.
+ if (fTestName.equals("sweep_varsweep")) {
+ return SkISize::Make(xWidth + 500, xWidth);
+ }
+ return SkISize::Make(xWidth, xWidth);
+ }
+
+ sk_sp<SkTypeface> makeVariedTypeface() {
+ if (!fTypeface) {
+ return nullptr;
+ }
+ SkSpan<const SkFontArguments::VariationPosition::Coordinate> coords =
+ fVariationSliders.getCoordinates();
+ SkFontArguments::VariationPosition varPos = {coords.data(),
+ static_cast<int>(coords.size())};
+ SkFontArguments args;
+ args.setVariationDesignPosition(varPos);
+ return fTypeface->makeClone(args);
+ }
DrawResult onDraw(SkCanvas* canvas, SkString* errorMsg) override {
canvas->drawColor(SK_ColorWHITE);
SkPaint paint;
- canvas->translate(200, 20);
+ canvas->translate(xTranslate, 20);
- if (!fEmojiFont.fTypeface) {
+ if (!fTypeface) {
*errorMsg = "Did not recognize COLR v1 font format.";
return DrawResult::kSkip;
}
@@ -168,23 +130,38 @@ protected:
canvas->rotate(fRotateDeg);
canvas->skew(fSkewX, 0);
- SkFont font(fEmojiFont.fTypeface);
+ SkFont font(makeVariedTypeface());
SkFontMetrics metrics;
SkScalar y = 0;
std::vector<SkColor> paint_colors = {
SK_ColorBLACK, SK_ColorGREEN, SK_ColorRED, SK_ColorBLUE};
auto paint_color_iterator = paint_colors.begin();
- for (SkScalar textSize : { 12, 18, 30, 120 }) {
+ for (SkScalar textSize : kTextSizes) {
font.setSize(textSize);
font.getMetrics(&metrics);
- y += -metrics.fAscent;
+ SkScalar y_shift = -(metrics.fAscent + metrics.fDescent + metrics.fLeading) * 1.2;
+ y += y_shift;
paint.setColor(*paint_color_iterator);
- canvas->drawSimpleText(fEmojiFont.fGlyphs.data(),
- fEmojiFont.bytesize(),
- SkTextEncoding::kGlyphID,
- 10, y, font, paint);
- y += metrics.fDescent + metrics.fLeading;
+ int x = 0;
+ // Perform simple line breaking to fit more glyphs into the GM canvas.
+ for (size_t i = 0; i < fCodepoints.size(); ++i) {
+ canvas->drawSimpleText(&fCodepoints[i],
+ sizeof(uint32_t),
+ SkTextEncoding::kUTF32,
+ x,
+ y,
+ font,
+ paint);
+ SkScalar glyphAdvance = font.measureText(
+ &fCodepoints[i], sizeof(uint32_t), SkTextEncoding::kUTF32, nullptr);
+ if (x + glyphAdvance < onISize().width() - xTranslate) {
+ x += glyphAdvance + glyphAdvance * 0.05f;
+ } else {
+ y += y_shift;
+ x = 0;
+ }
+ }
paint_color_iterator++;
}
return DrawResult::kOk;
@@ -192,27 +169,121 @@ protected:
private:
using INHERITED = GM;
+
+ SkString fTestName;
+ sk_sp<SkTypeface> fTypeface;
+ SkSpan<const uint32_t> fCodepoints;
SkScalar fSkewX;
SkScalar fRotateDeg;
- ColrV1TestType fTestType;
+ std::unique_ptr<SkFontArguments::VariationPosition::Coordinate[]> fCoordinates;
+ SkFontArguments::VariationPosition fVariationPosition;
+ ToolUtils::VariationSliders fVariationSliders;
};
-DEF_GM(return new ColrV1GM(ColrV1GM::kSkiaSampleFont, 0.f, 0.f);)
-DEF_GM(return new ColrV1GM(ColrV1GM::kSkiaSampleFont, -0.5f, 0.f);)
-DEF_GM(return new ColrV1GM(ColrV1GM::kSkiaSampleFont, 0.f, 20.f);)
-DEF_GM(return new ColrV1GM(ColrV1GM::kSkiaSampleFont, -0.5f, 20.f);)
-DEF_GM(return new ColrV1GM(ColrV1GM::kColorFontsRepoGradients, 0.f, 0.f);)
-DEF_GM(return new ColrV1GM(ColrV1GM::kColorFontsRepoScaling, 0.f, 0.f);)
-DEF_GM(return new ColrV1GM(ColrV1GM::kColorFontsRepoExtendMode, 0.f, 0.f);)
-DEF_GM(return new ColrV1GM(ColrV1GM::kColorFontsRepoRotate, 0.f, 0.f);)
-DEF_GM(return new ColrV1GM(ColrV1GM::kColorFontsRepoSkew, 0.f, 0.f);)
-DEF_GM(return new ColrV1GM(ColrV1GM::kColorFontsRepoTransform, 0.f, 0.f);)
-DEF_GM(return new ColrV1GM(ColrV1GM::kColorFontsRepoClipBox, 0.f, 0.f);)
-DEF_GM(return new ColrV1GM(ColrV1GM::kColorFontsRepoClipBox, -0.5f, 20.f);)
-DEF_GM(return new ColrV1GM(ColrV1GM::kColorFontsRepoComposite, 0.f, 0.f);)
-DEF_GM(return new ColrV1GM(ColrV1GM::kColorFontsRepoForeground, 0.f, 0.f);)
-DEF_GM(return new ColrV1GM(ColrV1GM::kColorFontsRepoSweepPad, 0.f, 0.f);)
-DEF_GM(return new ColrV1GM(ColrV1GM::kColorFontsRepoSweepReflect, 0.f, 0.f);)
-DEF_GM(return new ColrV1GM(ColrV1GM::kColorFontsRepoSweepRepeat, 0.f, 0.f);)
+// Generated using test glyphs generator script from https://github.com/googlefonts/color-fonts:
+// $ python3 config/test_glyphs-glyf_colr_1.py -vvv --generate-descriptions fonts/
+// Regenerate descriptions and paste the generated arrays here when updating the test font.
+namespace ColrV1TestDefinitions {
+const uint32_t gradient_stops_repeat[] = {0xf0100, 0xf0101, 0xf0102, 0xf0103};
+const uint32_t sweep_varsweep[] = {
+ 0xf0200, 0xf0201, 0xf0202, 0xf0203, 0xf0204, 0xf0205, 0xf0206, 0xf0207, 0xf0208,
+ 0xf0209, 0xf020a, 0xf020b, 0xf020c, 0xf020d, 0xf020e, 0xf020f, 0xf0210, 0xf0211,
+ 0xf0212, 0xf0213, 0xf0214, 0xf0215, 0xf0216, 0xf0217, 0xf0218, 0xf0219, 0xf021a,
+ 0xf021b, 0xf021c, 0xf021d, 0xf021e, 0xf021f, 0xf0220, 0xf0221, 0xf0222, 0xf0223,
+ 0xf0224, 0xf0225, 0xf0226, 0xf0227, 0xf0228, 0xf0229, 0xf022a, 0xf022b, 0xf022c,
+ 0xf022d, 0xf022e, 0xf022f, 0xf0230, 0xf0231, 0xf0232, 0xf0233, 0xf0234, 0xf0235,
+ 0xf0236, 0xf0237, 0xf0238, 0xf0239, 0xf023a, 0xf023b, 0xf023c, 0xf023d, 0xf023e,
+ 0xf023f, 0xf0240, 0xf0241, 0xf0242, 0xf0243, 0xf0244, 0xf0245, 0xf0246, 0xf0247};
+const uint32_t paint_scale[] = {0xf0300, 0xf0301, 0xf0302, 0xf0303, 0xf0304, 0xf0305};
+const uint32_t extend_mode[] = {
+ 0xf0500, 0xf0501, 0xf0502, 0xf0503, 0xf0504, 0xf0505, 0xf0506, 0xf0507, 0xf0508};
+const uint32_t paint_rotate[] = {0xf0600, 0xf0601, 0xf0602, 0xf0603};
+const uint32_t paint_skew[] = {0xf0700, 0xf0701, 0xf0702, 0xf0703, 0xf0704, 0xf0705};
+const uint32_t paint_transform[] = {0xf0800, 0xf0801, 0xf0802, 0xf0803};
+const uint32_t paint_translate[] = {0xf0900, 0xf0901, 0xf0902, 0xf0903, 0xf0904, 0xf0905, 0xf0906};
+const uint32_t composite_mode[] = {0xf0a00, 0xf0a01, 0xf0a02, 0xf0a03, 0xf0a04, 0xf0a05, 0xf0a06,
+ 0xf0a07, 0xf0a08, 0xf0a09, 0xf0a0a, 0xf0a0b, 0xf0a0c, 0xf0a0d,
+ 0xf0a0e, 0xf0a0f, 0xf0a10, 0xf0a11, 0xf0a12, 0xf0a13, 0xf0a14,
+ 0xf0a15, 0xf0a16, 0xf0a17, 0xf0a18, 0xf0a19, 0xf0a1a, 0xf0a1b};
+const uint32_t foreground_color[] = {
+ 0xf0b00, 0xf0b01, 0xf0b02, 0xf0b03, 0xf0b04, 0xf0b05, 0xf0b06, 0xf0b07};
+const uint32_t clipbox[] = {0xf0c00, 0xf0c01, 0xf0c02, 0xf0c03, 0xf0c04};
+const uint32_t gradient_p2_skewed[] = {0xf0d00};
+const uint32_t variable_alpha[] = {0xf1000};
+}; // namespace ColrV1TestDefinitions
+
+namespace {
+std::unique_ptr<ColrV1GM> F(
+ const char* name,
+ SkSpan<const uint32_t> codepoints,
+ SkScalar skewX,
+ SkScalar rotateDeg,
+ std::initializer_list<SkFontArguments::VariationPosition::Coordinate> variations)
+{
+ return std::make_unique<ColrV1GM>(name, codepoints, skewX, rotateDeg, variations);
+}
+
+SkFourByteTag constexpr operator "" _t(const char* tagName, size_t size) {
+ SkASSERT(size == 4);
+ return SkSetFourByteTag(tagName[0], tagName[1], tagName[2], tagName[3]);
+}
+}
+#define C(TEST_CATEGORY) #TEST_CATEGORY, ColrV1TestDefinitions::TEST_CATEGORY
+DEF_GM(return F(C(clipbox), 0.0f, 0.0f, {}))
+DEF_GM(return F(C(clipbox), 0.0f, 0.0f, {{"CLIO"_t, 200.f}}))
+DEF_GM(return F(C(composite_mode), 0.0f, 0.0f, {}))
+DEF_GM(return F(C(composite_mode), -0.5f, 0.0f, {}))
+DEF_GM(return F(C(composite_mode), -0.5f, 20.0f, {}))
+DEF_GM(return F(C(composite_mode), 0.0f, 20.0f, {}))
+DEF_GM(return F(C(extend_mode), 0.0f, 0.0f, {}))
+DEF_GM(return F(C(extend_mode), 0.0f, 0.0f, {{"COL1"_t, -0.25f}, {"COL3"_t, +0.25f}}))
+DEF_GM(return F(C(extend_mode), 0.0f, 0.0f, {{"COL3"_t, 0.5f}}))
+DEF_GM(return F(C(extend_mode), 0.0f, 0.0f, {{"COL3"_t, 1.f}}))
+DEF_GM(return F(C(extend_mode), -0.5f, 0.0f, {}))
+DEF_GM(return F(C(extend_mode), -0.5f, 20.0f, {}))
+DEF_GM(return F(C(extend_mode), 0.0f, 20.0f, {}))
+DEF_GM(return F(C(extend_mode), 0.0f, 0.0f, {{"COL2"_t, -0.3f}}))
+DEF_GM(return F(C(extend_mode), 0.0f, 0.0f, {{"GRR0"_t, 430.f}, {"GRR1"_t, 40.f}}))
+DEF_GM(return F(C(foreground_color), 0.0f, 0.0f, {}))
+DEF_GM(return F(C(gradient_p2_skewed), 0.0f, 0.0f, {}))
+DEF_GM(return F(C(gradient_stops_repeat), 0.0f, 0.0f, {}))
+DEF_GM(return F(C(gradient_stops_repeat), -0.5f, 0.0f, {}))
+DEF_GM(return F(C(gradient_stops_repeat), -0.5f, 20.0f, {}))
+DEF_GM(return F(C(gradient_stops_repeat), 0.0f, 20.0f, {}))
+DEF_GM(return F(C(paint_rotate), 0.0f, 0.0f, {}))
+DEF_GM(return F(C(paint_rotate), 0.0f, 0.0f, {{"ROTA"_t, 40.f}}))
+DEF_GM(return F(C(paint_rotate), 0.0f, 0.0f, {{"ROTX"_t, -250.f}, {"ROTY"_t, -250.f}}))
+DEF_GM(return F(C(paint_scale), 0.0f, 0.0f, {}))
+DEF_GM(return F(C(paint_scale), 0.0f, 0.0f, {{"SCOX"_t, 200.f}, {"SCOY"_t, 200.f}}))
+DEF_GM(return F(C(paint_scale), 0.0f, 0.0f, {{"SCSX"_t, 0.25f}, {"SCOY"_t, 0.25f}}))
+DEF_GM(return F(C(paint_scale), 0.0f, 0.0f, {{"SCSX"_t, -1.f}, {"SCOY"_t, -1.f}}))
+DEF_GM(return F(C(paint_scale), 0.0f, 0.0f, {}))
+DEF_GM(return F(C(paint_scale), 0.0f, 0.0f, {}))
+DEF_GM(return F(C(paint_skew), 0.0f, 0.0f, {}))
+DEF_GM(return F(C(paint_skew), 0.0f, 0.0f, {{"SKXA"_t, 20.f}}))
+DEF_GM(return F(C(paint_skew), 0.0f, 0.0f, {{"SKYA"_t, 20.f}}))
+DEF_GM(return F(C(paint_skew), 0.0f, 0.0f, {{"SKCX"_t, 200.f},{"SKCY"_t, 200.f}}))
+DEF_GM(return F(C(paint_transform), 0.0f, 0.0f, {}))
+DEF_GM(return F(C(paint_translate), 0.0f, 0.0f, {}))
+DEF_GM(return F(C(paint_translate), 0.0f, 0.0f, {{"TLDX"_t, 100.f}, {"TLDY"_t, 100.f}}))
+DEF_GM(return F(C(sweep_varsweep), 0.0f, 0.0f, {}))
+DEF_GM(return F(C(sweep_varsweep), -0.5f, 0.0f, {}))
+DEF_GM(return F(C(sweep_varsweep), -0.5f, 20.0f, {}))
+DEF_GM(return F(C(sweep_varsweep), 0.0f, 20.0f, {}))
+DEF_GM(return F(C(sweep_varsweep), 0.0f, 0.0f, {{"SWPS"_t, 0.f}}))
+DEF_GM(return F(C(sweep_varsweep), 0.0f, 0.0f, {{"SWPS"_t, 90.f}}))
+DEF_GM(return F(C(sweep_varsweep), 0.0f, 0.0f, {{"SWPE"_t, -90.f}}))
+DEF_GM(return F(C(sweep_varsweep), 0.0f, 0.0f, {{"SWPE"_t, -45.f}}))
+DEF_GM(return F(C(sweep_varsweep), 0.0f, 0.0f, {{"SWPS"_t, -45.f},{"SWPE"_t, 45.f}}))
+DEF_GM(return F(C(sweep_varsweep),
+ 0.0f,
+ 0.0f,
+ {{"SWC1"_t, -0.25f},
+ {"SWC2"_t, 0.083333333f},
+ {"SWC3"_t, 0.083333333f},
+ {"SWC4"_t, +0.25f}}))
+DEF_GM(return F(C(variable_alpha), 0.0f, 0.0f, {}))
+DEF_GM(return F(C(variable_alpha), 0.0f, 0.0f, {{"APH1"_t, -0.7f}}))
+DEF_GM(return F(C(variable_alpha), 0.0f, 0.0f, {{"APH2"_t, -0.7f}, {"APH3"_t, -0.2f}}))
} // namespace skiagm
diff --git a/chromium/third_party/skia/gm/complexclip.cpp b/chromium/third_party/skia/gm/complexclip.cpp
index 806ae1ea4ef..5668119faae 100644
--- a/chromium/third_party/skia/gm/complexclip.cpp
+++ b/chromium/third_party/skia/gm/complexclip.cpp
@@ -118,7 +118,7 @@ protected:
for (int invBits = 0; invBits < 4; ++invBits) {
canvas->save();
- for (size_t op = 0; op < SK_ARRAY_COUNT(gOps); ++op) {
+ for (size_t op = 0; op < std::size(gOps); ++op) {
this->drawHairlines(canvas, path, clipA, clipB);
bool doInvA = SkToBool(invBits & 1);
@@ -430,7 +430,7 @@ DEF_SIMPLE_GM(clip_shader_persp, canvas, 1370, 1030) {
canvas->translate(10.f, 10.f);
- for (size_t i = 0; i < SK_ARRAY_COUNT(matches); ++i) {
+ for (size_t i = 0; i < std::size(matches); ++i) {
canvas->save();
canvas->translate(-grid.fLeft, -grid.fTop);
drawConfig(matches[i][0]);
diff --git a/chromium/third_party/skia/gm/complexclip2.cpp b/chromium/third_party/skia/gm/complexclip2.cpp
index 3bb4947d6c9..29d77827dac 100644
--- a/chromium/third_party/skia/gm/complexclip2.cpp
+++ b/chromium/third_party/skia/gm/complexclip2.cpp
@@ -98,7 +98,7 @@ protected:
for (int i = 0; i < kRows; ++i) {
for (int j = 0; j < kCols; ++j) {
for (int k = 0; k < 5; ++k) {
- fOps[j*kRows+i][k] = ops[r.nextU() % SK_ARRAY_COUNT(ops)];
+ fOps[j*kRows+i][k] = ops[r.nextU() % std::size(ops)];
}
}
}
diff --git a/chromium/third_party/skia/gm/complexclip3.cpp b/chromium/third_party/skia/gm/complexclip3.cpp
index f551b29e4aa..fd59c744876 100644
--- a/chromium/third_party/skia/gm/complexclip3.cpp
+++ b/chromium/third_party/skia/gm/complexclip3.cpp
@@ -81,7 +81,7 @@ protected:
for (int invA = 0; invA < 2; ++invA) {
for (int aaBits = 0; aaBits < 4; ++aaBits) {
canvas->save();
- for (size_t op = 0; op < SK_ARRAY_COUNT(gOps); ++op) {
+ for (size_t op = 0; op < std::size(gOps); ++op) {
for (int invB = 0; invB < 2; ++invB) {
bool doAAA = SkToBool(aaBits & 1);
bool doAAB = SkToBool(aaBits & 2);
diff --git a/chromium/third_party/skia/gm/composecolorfilter.cpp b/chromium/third_party/skia/gm/composecolorfilter.cpp
index b1e41def849..935145c25d3 100644
--- a/chromium/third_party/skia/gm/composecolorfilter.cpp
+++ b/chromium/third_party/skia/gm/composecolorfilter.cpp
@@ -69,9 +69,9 @@ static sk_sp<SkColorFilter> MakeTintColorFilter(SkColor lo, SkColor hi, bool use
half4 main(half4 c) { return outer.eval(inner.eval(c)); }
)"));
SkASSERT(effect);
- SkASSERT(SkRuntimeEffectPriv::SupportsConstantOutputForConstantInput(effect));
+ SkASSERT(SkRuntimeEffectPriv::SupportsConstantOutputForConstantInput(effect.get()));
sk_sp<SkColorFilter> children[] = { inner, outer };
- return effect->makeColorFilter(nullptr, children, SK_ARRAY_COUNT(children));
+ return effect->makeColorFilter(nullptr, children, std::size(children));
} else {
return outer->makeComposed(inner);
}
@@ -83,7 +83,7 @@ DEF_SIMPLE_GM(composeCF, canvas, 200, 200) {
SkPaint paint;
const SkColor gradient_colors[] = {SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorRED};
paint.setShader(SkGradientShader::MakeSweep(
- 50, 50, gradient_colors, nullptr, SK_ARRAY_COUNT(gradient_colors)));
+ 50, 50, gradient_colors, nullptr, std::size(gradient_colors)));
canvas->save();
for (bool useSkSL : {false, true}) {
diff --git a/chromium/third_party/skia/gm/composeshader.cpp b/chromium/third_party/skia/gm/composeshader.cpp
index 36a54200002..0c521b1ff12 100644
--- a/chromium/third_party/skia/gm/composeshader.cpp
+++ b/chromium/third_party/skia/gm/composeshader.cpp
@@ -104,7 +104,7 @@ protected:
const SkRect r = SkRect::MakeXYWH(5, 5, 100, 100);
- for (size_t y = 0; y < SK_ARRAY_COUNT(shaders); ++y) {
+ for (size_t y = 0; y < std::size(shaders); ++y) {
canvas->save();
for (int alpha = 0xFF; alpha > 0; alpha -= 0x28) {
paint.setAlphaf(1.0f);
@@ -207,7 +207,7 @@ protected:
SkShaders::Blend(mode, fLinearGradientShader, fAlpha8BitmapShader),
};
if (fUseLocalMatrix) {
- for (unsigned i = 0; i < SK_ARRAY_COUNT(shaders); ++i) {
+ for (unsigned i = 0; i < std::size(shaders); ++i) {
shaders[i] = shaders[i]->makeWithLocalMatrix(lm);
}
}
@@ -217,7 +217,7 @@ protected:
const SkRect r = SkRect::MakeIWH(squareLength, squareLength);
- for (size_t y = 0; y < SK_ARRAY_COUNT(shaders); ++y) {
+ for (size_t y = 0; y < std::size(shaders); ++y) {
canvas->save();
for (int alpha = 0xFF; alpha > 0; alpha -= 0x28) {
paint.setAlpha(alpha);
diff --git a/chromium/third_party/skia/gm/concavepaths.cpp b/chromium/third_party/skia/gm/concavepaths.cpp
index f36e13aae0d..20b12f3f4c6 100644
--- a/chromium/third_party/skia/gm/concavepaths.cpp
+++ b/chromium/third_party/skia/gm/concavepaths.cpp
@@ -61,7 +61,7 @@ void test_inversion_repeat_vertex(SkCanvas* canvas, const SkPaint& paint) {
const SkPoint pts[] = {
{80,50}, {40,80}, {60,20}, {20,20}, {39.99f,80}, {80,50},
};
- canvas->drawPath(SkPath::Polygon(pts, SK_ARRAY_COUNT(pts), false,
+ canvas->drawPath(SkPath::Polygon(pts, std::size(pts), false,
SkPathFillType::kWinding, true), paint);
canvas->restore();
}
@@ -118,7 +118,7 @@ void test_twist(SkCanvas* canvas, const SkPaint& paint) {
{-2.9186885356903076172f, 2.811046600341796875f},
{0.49999994039535522461f, -1.4124038219451904297f},
};
- canvas->drawPath(SkPath::Polygon(pts, SK_ARRAY_COUNT(pts), false), paint);
+ canvas->drawPath(SkPath::Polygon(pts, std::size(pts), false), paint);
canvas->restore();
}
diff --git a/chromium/third_party/skia/gm/conicpaths.cpp b/chromium/third_party/skia/gm/conicpaths.cpp
index 49be3fcd870..81e356f7bc6 100644
--- a/chromium/third_party/skia/gm/conicpaths.cpp
+++ b/chromium/third_party/skia/gm/conicpaths.cpp
@@ -113,7 +113,7 @@ protected:
SkPaint paint;
for (int p = 0; p < fPaths.count(); ++p) {
canvas->save();
- for (size_t a = 0; a < SK_ARRAY_COUNT(kAlphaValue); ++a) {
+ for (size_t a = 0; a < std::size(kAlphaValue); ++a) {
paint.setARGB(kAlphaValue[a], 0, 0, 0);
for (int aa = 0; aa < 2; ++aa) {
paint.setAntiAlias(SkToBool(aa));
diff --git a/chromium/third_party/skia/gm/constcolorprocessor.cpp b/chromium/third_party/skia/gm/constcolorprocessor.cpp
index 3216e71ce38..4632db3ce8f 100644
--- a/chromium/third_party/skia/gm/constcolorprocessor.cpp
+++ b/chromium/third_party/skia/gm/constcolorprocessor.cpp
@@ -34,8 +34,8 @@
#include "src/gpu/ganesh/GrFragmentProcessor.h"
#include "src/gpu/ganesh/GrPaint.h"
#include "src/gpu/ganesh/SkGr.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/ops/GrOp.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
#include "tools/ToolUtils.h"
#include "tools/gpu/TestOps.h"
@@ -72,7 +72,7 @@ protected:
void onOnceBeforeDraw() override {
SkColor colors[] = { 0xFFFF0000, 0x2000FF00, 0xFF0000FF};
SkPoint pts[] = { SkPoint::Make(0, 0), SkPoint::Make(kRectSize, kRectSize) };
- fShader = SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
+ fShader = SkGradientShader::MakeLinear(pts, colors, nullptr, std::size(colors),
SkTileMode::kClamp);
}
@@ -100,8 +100,8 @@ protected:
SkScalar y = kPad;
SkScalar x = kPad;
SkScalar maxW = 0;
- for (size_t paintType = 0; paintType < SK_ARRAY_COUNT(kPaintColors) + 1; ++paintType) {
- for (size_t procColor = 0; procColor < SK_ARRAY_COUNT(kColors); ++procColor) {
+ for (size_t paintType = 0; paintType < std::size(kPaintColors) + 1; ++paintType) {
+ for (size_t procColor = 0; procColor < std::size(kColors); ++procColor) {
// translate by x,y for the canvas draws and the test target draws.
canvas->save();
canvas->translate(x, y);
@@ -111,9 +111,10 @@ protected:
// Create a base-layer FP for the const color processor to draw on top of.
std::unique_ptr<GrFragmentProcessor> baseFP;
- if (paintType >= SK_ARRAY_COUNT(kPaintColors)) {
+ if (paintType >= std::size(kPaintColors)) {
GrColorInfo colorInfo;
- GrFPArgs args(rContext, SkMatrixProvider(SkMatrix::I()), &colorInfo);
+ SkSurfaceProps props;
+ GrFPArgs args(rContext, SkMatrixProvider(SkMatrix::I()), &colorInfo, props);
baseFP = as_SB(fShader)->asFragmentProcessor(args);
} else {
baseFP = GrFragmentProcessor::MakeColor(
@@ -152,7 +153,7 @@ protected:
SkPaint labelPaint;
labelPaint.setAntiAlias(true);
SkString inputLabel("Input: ");
- if (paintType >= SK_ARRAY_COUNT(kPaintColors)) {
+ if (paintType >= std::size(kPaintColors)) {
inputLabel.append("gradient");
} else {
inputLabel.appendf("0x%08x", kPaintColors[paintType]);
diff --git a/chromium/third_party/skia/gm/convex_all_line_paths.cpp b/chromium/third_party/skia/gm/convex_all_line_paths.cpp
index f56c09e84ee..cafa77f3781 100644
--- a/chromium/third_party/skia/gm/convex_all_line_paths.cpp
+++ b/chromium/third_party/skia/gm/convex_all_line_paths.cpp
@@ -148,19 +148,19 @@ const SkPoint* gPoints[] = {
};
const size_t gSizes[] = {
- SK_ARRAY_COUNT(gPoints0),
- SK_ARRAY_COUNT(gPoints1),
- SK_ARRAY_COUNT(gPoints2),
- SK_ARRAY_COUNT(gPoints3),
- SK_ARRAY_COUNT(gPoints4),
- SK_ARRAY_COUNT(gPoints5),
- SK_ARRAY_COUNT(gPoints6),
- SK_ARRAY_COUNT(gPoints7),
- SK_ARRAY_COUNT(gPoints8),
- SK_ARRAY_COUNT(gPoints9),
- SK_ARRAY_COUNT(gPoints10),
+ std::size(gPoints0),
+ std::size(gPoints1),
+ std::size(gPoints2),
+ std::size(gPoints3),
+ std::size(gPoints4),
+ std::size(gPoints5),
+ std::size(gPoints6),
+ std::size(gPoints7),
+ std::size(gPoints8),
+ std::size(gPoints9),
+ std::size(gPoints10),
};
-static_assert(SK_ARRAY_COUNT(gSizes) == SK_ARRAY_COUNT(gPoints), "array_mismatch");
+static_assert(std::size(gSizes) == std::size(gPoints), "array_mismatch");
} // namespace ConvexLineOnlyData
namespace skiagm {
@@ -187,7 +187,7 @@ protected:
std::unique_ptr<SkPoint[]> data(nullptr);
const SkPoint* points;
int numPts;
- if (index < (int) SK_ARRAY_COUNT(ConvexLineOnlyData::gPoints)) {
+ if (index < (int) std::size(ConvexLineOnlyData::gPoints)) {
// manually specified
points = ConvexLineOnlyData::gPoints[index];
numPts = (int)ConvexLineOnlyData::gSizes[index];
@@ -195,7 +195,7 @@ protected:
// procedurally generated
SkScalar width = kMaxPathHeight/2;
SkScalar height = kMaxPathHeight/2;
- switch (index-SK_ARRAY_COUNT(ConvexLineOnlyData::gPoints)) {
+ switch (index-std::size(ConvexLineOnlyData::gPoints)) {
case 0:
numPts = 3;
break;
@@ -299,7 +299,7 @@ protected:
SkPaint paint;
paint.setAntiAlias(true);
- for (size_t i = 0; i < SK_ARRAY_COUNT(scales); ++i) {
+ for (size_t i = 0; i < std::size(scales); ++i) {
SkPath path = GetPath(index, dirs[i%2]);
if (fDoStrokeAndFill) {
paint.setStyle(SkPaint::kStrokeAndFill_Style);
diff --git a/chromium/third_party/skia/gm/convexpolyclip.cpp b/chromium/third_party/skia/gm/convexpolyclip.cpp
index 90249ddf849..d63208a8a1f 100644
--- a/chromium/third_party/skia/gm/convexpolyclip.cpp
+++ b/chromium/third_party/skia/gm/convexpolyclip.cpp
@@ -61,7 +61,7 @@ static sk_sp<SkImage> make_img(int w, int h) {
paint.setShader(SkGradientShader::MakeRadial(
pt, radius,
colors, pos,
- SK_ARRAY_COUNT(colors),
+ std::size(colors),
SkTileMode::kRepeat,
0, &mat));
canvas->drawRect(rect, paint);
@@ -76,12 +76,12 @@ static sk_sp<SkImage> make_img(int w, int h) {
paint.setColor(SK_ColorLTGRAY);
constexpr char kTxt[] = "Skia";
SkPoint texPos = { wScalar / 17, hScalar / 2 + font.getSize() / 2.5f };
- canvas->drawSimpleText(kTxt, SK_ARRAY_COUNT(kTxt)-1, SkTextEncoding::kUTF8,
+ canvas->drawSimpleText(kTxt, std::size(kTxt)-1, SkTextEncoding::kUTF8,
texPos.fX, texPos.fY, font, paint);
paint.setColor(SK_ColorBLACK);
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(SK_Scalar1);
- canvas->drawSimpleText(kTxt, SK_ARRAY_COUNT(kTxt)-1, SkTextEncoding::kUTF8,
+ canvas->drawSimpleText(kTxt, std::size(kTxt)-1, SkTextEncoding::kUTF8,
texPos.fX, texPos.fY, font, paint);
return surf->makeImageSnapshot();
}
@@ -165,7 +165,7 @@ protected:
constexpr char kTxt[] = "Clip Me!";
SkFont font(ToolUtils::create_portable_typeface(), 23);
- SkScalar textW = font.measureText(kTxt, SK_ARRAY_COUNT(kTxt)-1, SkTextEncoding::kUTF8);
+ SkScalar textW = font.measureText(kTxt, std::size(kTxt)-1, SkTextEncoding::kUTF8);
SkPaint txtPaint;
txtPaint.setColor(SK_ColorDKGRAY);
@@ -212,7 +212,7 @@ protected:
canvas->drawPath(closedClipPath, clipOutlinePaint);
clip.setOnCanvas(canvas, SkClipOp::kIntersect, SkToBool(aa));
canvas->scale(1.f, 1.8f);
- canvas->drawSimpleText(kTxt, SK_ARRAY_COUNT(kTxt)-1, SkTextEncoding::kUTF8,
+ canvas->drawSimpleText(kTxt, std::size(kTxt)-1, SkTextEncoding::kUTF8,
0, 1.5f * font.getSize(), font, txtPaint);
canvas->restore();
x += textW + 2 * kMargin;
diff --git a/chromium/third_party/skia/gm/convexpolyeffect.cpp b/chromium/third_party/skia/gm/convexpolyeffect.cpp
index 182c3cc9085..b15db5403b3 100644
--- a/chromium/third_party/skia/gm/convexpolyeffect.cpp
+++ b/chromium/third_party/skia/gm/convexpolyeffect.cpp
@@ -22,9 +22,9 @@
#include "src/core/SkCanvasPriv.h"
#include "src/gpu/ganesh/GrFragmentProcessor.h"
#include "src/gpu/ganesh/GrPaint.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/effects/GrConvexPolyEffect.h"
#include "src/gpu/ganesh/effects/GrPorterDuffXferProcessor.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
#include "tools/gpu/TestOps.h"
#include <memory>
diff --git a/chromium/third_party/skia/gm/crosscontextimage.cpp b/chromium/third_party/skia/gm/crosscontextimage.cpp
index 3e187b9823f..65f9a9acb90 100644
--- a/chromium/third_party/skia/gm/crosscontextimage.cpp
+++ b/chromium/third_party/skia/gm/crosscontextimage.cpp
@@ -47,7 +47,7 @@ DEF_SIMPLE_GPU_GM_CAN_FAIL(cross_context_image, rContext, canvas, errorMsg,
canvas->translate(10, 10);
- for (size_t i = 0; i < SK_ARRAY_COUNT(images); ++i) {
+ for (size_t i = 0; i < std::size(images); ++i) {
canvas->save();
canvas->drawImage(images[i], 0, 0);
diff --git a/chromium/third_party/skia/gm/cubicpaths.cpp b/chromium/third_party/skia/gm/cubicpaths.cpp
index 1490a672c74..46061cbcc85 100644
--- a/chromium/third_party/skia/gm/cubicpaths.cpp
+++ b/chromium/third_party/skia/gm/cubicpaths.cpp
@@ -194,17 +194,17 @@ class CubicPathGM : public skiagm::GM {
canvas->save();
canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1);
canvas->save();
- for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) {
+ for (size_t cap = 0; cap < std::size(gCaps); ++cap) {
if (0 < cap) {
- canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_COUNT(gStyles), 0);
+ canvas->translate((rect.width() + 40 * SK_Scalar1) * std::size(gStyles), 0);
}
canvas->save();
- for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) {
+ for (size_t fill = 0; fill < std::size(gFills); ++fill) {
if (0 < fill) {
canvas->translate(0, rect.height() + 40 * SK_Scalar1);
}
canvas->save();
- for (size_t style = 0; style < SK_ARRAY_COUNT(gStyles); ++style) {
+ for (size_t style = 0; style < std::size(gStyles); ++style) {
if (0 < style) {
canvas->translate(rect.width() + 40 * SK_Scalar1, 0);
}
@@ -314,17 +314,17 @@ class CubicClosePathGM : public skiagm::GM {
canvas->save();
canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1);
canvas->save();
- for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) {
+ for (size_t cap = 0; cap < std::size(gCaps); ++cap) {
if (0 < cap) {
- canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_COUNT(gStyles), 0);
+ canvas->translate((rect.width() + 40 * SK_Scalar1) * std::size(gStyles), 0);
}
canvas->save();
- for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) {
+ for (size_t fill = 0; fill < std::size(gFills); ++fill) {
if (0 < fill) {
canvas->translate(0, rect.height() + 40 * SK_Scalar1);
}
canvas->save();
- for (size_t style = 0; style < SK_ARRAY_COUNT(gStyles); ++style) {
+ for (size_t style = 0; style < std::size(gStyles); ++style) {
if (0 < style) {
canvas->translate(rect.width() + 40 * SK_Scalar1, 0);
}
diff --git a/chromium/third_party/skia/gm/daa.cpp b/chromium/third_party/skia/gm/daa.cpp
index c9148892795..6e4e5476f9d 100644
--- a/chromium/third_party/skia/gm/daa.cpp
+++ b/chromium/third_party/skia/gm/daa.cpp
@@ -33,8 +33,8 @@ DEF_SIMPLE_GM(daa, canvas, K+350, 5*K) {
SkPoint tri1[] = {{0,0},{K,K},{0,K},{0,0}};
SkPoint tri2[] = {{0,0},{K,K},{K,0},{0,0}};
- SkPath path = SkPathBuilder().addPolygon(tri1, SK_ARRAY_COUNT(tri1), false)
- .addPolygon(tri2, SK_ARRAY_COUNT(tri2), false)
+ SkPath path = SkPathBuilder().addPolygon(tri1, std::size(tri1), false)
+ .addPolygon(tri2, std::size(tri2), false)
.detach();
paint.setColor(SK_ColorGREEN);
diff --git a/chromium/third_party/skia/gm/dashcircle.cpp b/chromium/third_party/skia/gm/dashcircle.cpp
index 3bebcbda560..fd514018b9f 100644
--- a/chromium/third_party/skia/gm/dashcircle.cpp
+++ b/chromium/third_party/skia/gm/dashcircle.cpp
@@ -30,10 +30,10 @@ struct DashExample {
int* pattern;
int length;
} dashExamples[] = {
- { dash1, SK_ARRAY_COUNT(dash1) },
- { dash2, SK_ARRAY_COUNT(dash2) },
- { dash3, SK_ARRAY_COUNT(dash3) },
- { dash4, SK_ARRAY_COUNT(dash4) }
+ { dash1, std::size(dash1) },
+ { dash2, std::size(dash2) },
+ { dash3, std::size(dash3) },
+ { dash4, std::size(dash4) }
};
@@ -143,7 +143,7 @@ protected:
{0.1f , 1.1f }, // off is > 1*/
};
- static constexpr int kN = SK_ARRAY_COUNT(kIntervals);
+ static constexpr int kN = std::size(kIntervals);
static constexpr SkScalar kRadius = 20.f;
static constexpr SkScalar kStrokeWidth = 15.f;
static constexpr SkScalar kPad = 5.f;
@@ -154,8 +154,8 @@ protected:
kThinRadius, kThinRadius};
static constexpr SkScalar kThinStrokeWidth = 0.4f;
- sk_sp<SkPathEffect> deffects[SK_ARRAY_COUNT(kIntervals)];
- sk_sp<SkPathEffect> thinDEffects[SK_ARRAY_COUNT(kIntervals)];
+ sk_sp<SkPathEffect> deffects[std::size(kIntervals)];
+ sk_sp<SkPathEffect> thinDEffects[std::size(kIntervals)];
for (int i = 0; i < kN; ++i) {
static constexpr SkScalar kTau = 2 * SK_ScalarPI;
static constexpr SkScalar kCircumference = kRadius * kTau;
@@ -201,7 +201,7 @@ protected:
canvas->save();
canvas->translate(-bounds.fLeft + kPad, -bounds.fTop + kPad);
- for (size_t i = 0; i < SK_ARRAY_COUNT(deffects); ++i) {
+ for (size_t i = 0; i < std::size(deffects); ++i) {
canvas->save();
for (const auto& m : kMatrices) {
canvas->save();
diff --git a/chromium/third_party/skia/gm/dashing.cpp b/chromium/third_party/skia/gm/dashing.cpp
index 3f03843f38c..d63f6ac3dd3 100644
--- a/chromium/third_party/skia/gm/dashing.cpp
+++ b/chromium/third_party/skia/gm/dashing.cpp
@@ -167,7 +167,7 @@ class Dashing2GM : public skiagm::GM {
const int* intervals = &gIntervals[1];
for (int y = 0; y < gIntervals[0]; ++y) {
- SkScalar vals[SK_ARRAY_COUNT(gIntervals)]; // more than enough
+ SkScalar vals[std::size(gIntervals)]; // more than enough
int count = *intervals++;
for (int i = 0; i < count; ++i) {
vals[i] = SkIntToScalar(*intervals++);
@@ -175,7 +175,7 @@ class Dashing2GM : public skiagm::GM {
SkScalar phase = vals[0] / 2;
paint.setPathEffect(SkDashPathEffect::Make(vals, count, phase));
- for (size_t x = 0; x < SK_ARRAY_COUNT(gProc); ++x) {
+ for (size_t x = 0; x < std::size(gProc); ++x) {
SkPath path;
SkRect r = bounds;
r.offset(x * dx, y * dy);
@@ -493,7 +493,7 @@ DEF_SIMPLE_GM(longpathdash, canvas, 612, 612) {
p.setStroke(true);
p.setStrokeWidth(1);
const SkScalar intervals[] = { 1, 1 };
- p.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 0));
+ p.setPathEffect(SkDashPathEffect::Make(intervals, std::size(intervals), 0));
canvas->translate(50, 50);
canvas->drawPath(lines, p);
@@ -506,7 +506,7 @@ DEF_SIMPLE_GM(longlinedash, canvas, 512, 512) {
p.setStrokeWidth(80);
const SkScalar intervals[] = { 2, 2 };
- p.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 0));
+ p.setPathEffect(SkDashPathEffect::Make(intervals, std::size(intervals), 0));
canvas->drawRect(SkRect::MakeXYWH(-10000, 100, 20000, 20), p);
}
@@ -525,7 +525,7 @@ DEF_SIMPLE_GM(dashbigrects, canvas, 256, 256) {
p.setStrokeCap(SkPaint::kButt_Cap);
constexpr SkScalar intervals[] = { kOnOffInterval, kOnOffInterval };
- p.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 0));
+ p.setPathEffect(SkDashPathEffect::Make(intervals, std::size(intervals), 0));
constexpr float gWidthHeights[] = {
1000000000.0f * kOnOffInterval + kOnOffInterval/2.0f,
@@ -541,7 +541,7 @@ DEF_SIMPLE_GM(dashbigrects, canvas, 256, 256) {
4.0f * kOnOffInterval + kOnOffInterval/2.0f,
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gWidthHeights); ++i) {
+ for (size_t i = 0; i < std::size(gWidthHeights); ++i) {
p.setColor(ToolUtils::color_to_565(rand.nextU() | (0xFF << 24)));
int offset = 2 * i * kHalfStrokeWidth + kHalfStrokeWidth;
@@ -576,7 +576,7 @@ DEF_SIMPLE_GM(dashtextcaps, canvas, 512, 512) {
SkFont font(ToolUtils::create_portable_typeface(), 100);
const SkScalar intervals[] = { 12, 12 };
- p.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 0));
+ p.setPathEffect(SkDashPathEffect::Make(intervals, std::size(intervals), 0));
canvas->drawString("Sausages", 10, 90, font, p);
canvas->drawLine(8, 120, 456, 120, p);
}
@@ -584,7 +584,7 @@ DEF_SIMPLE_GM(dashtextcaps, canvas, 512, 512) {
DEF_SIMPLE_GM(dash_line_zero_off_interval, canvas, 160, 330) {
static constexpr SkScalar kIntervals[] = {5.f, 0.f, 2.f, 0.f};
SkPaint dashPaint;
- dashPaint.setPathEffect(SkDashPathEffect::Make(kIntervals, SK_ARRAY_COUNT(kIntervals), 0.f));
+ dashPaint.setPathEffect(SkDashPathEffect::Make(kIntervals, std::size(kIntervals), 0.f));
SkASSERT(dashPaint.getPathEffect());
dashPaint.setStroke(true);
dashPaint.setStrokeWidth(20.f);
@@ -621,7 +621,7 @@ DEF_SIMPLE_GM(thin_aa_dash_lines, canvas, 330, 110) {
SkPaint paint;
static constexpr SkScalar kScale = 100.f;
static constexpr SkScalar kIntervals[] = {10/kScale, 5/kScale};
- paint.setPathEffect(SkDashPathEffect::Make(kIntervals, SK_ARRAY_COUNT(kIntervals), 0.f));
+ paint.setPathEffect(SkDashPathEffect::Make(kIntervals, std::size(kIntervals), 0.f));
paint.setAntiAlias(true);
paint.setStrokeWidth(0.25f/kScale);
// substep moves the subpixel offset every iteration.
diff --git a/chromium/third_party/skia/gm/degeneratesegments.cpp b/chromium/third_party/skia/gm/degeneratesegments.cpp
index 029ac242a7a..8a6187822bd 100644
--- a/chromium/third_party/skia/gm/degeneratesegments.cpp
+++ b/chromium/third_party/skia/gm/degeneratesegments.cpp
@@ -304,10 +304,10 @@ class DegenerateSegmentsGM : public GM {
canvas->save();
canvas->translate(2*SK_Scalar1, 30 * SK_Scalar1); // The title
canvas->save();
- unsigned numSegments = SK_ARRAY_COUNT(gSegmentFunctions);
- unsigned numCaps = SK_ARRAY_COUNT(gCaps);
- unsigned numStyles = SK_ARRAY_COUNT(gStyles);
- unsigned numFills = SK_ARRAY_COUNT(gFills);
+ unsigned numSegments = std::size(gSegmentFunctions);
+ unsigned numCaps = std::size(gCaps);
+ unsigned numStyles = std::size(gStyles);
+ unsigned numFills = std::size(gFills);
for (size_t row = 0; row < 6; ++row) {
if (0 < row) {
canvas->translate(0, rect.height() + 100*SK_Scalar1);
diff --git a/chromium/third_party/skia/gm/destcolor.cpp b/chromium/third_party/skia/gm/destcolor.cpp
index 627bbe2e11d..96dce5d8185 100644
--- a/chromium/third_party/skia/gm/destcolor.cpp
+++ b/chromium/third_party/skia/gm/destcolor.cpp
@@ -17,8 +17,8 @@
#include "src/gpu/ganesh/GrFragmentProcessor.h"
#include "src/gpu/ganesh/GrStyle.h"
#include "src/gpu/ganesh/SkGr.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/glsl/GrGLSLFragmentShaderBuilder.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
#include "tools/Resources.h"
#include "tools/ToolUtils.h"
diff --git a/chromium/third_party/skia/gm/dftext.cpp b/chromium/third_party/skia/gm/dftext.cpp
index d8a54c836d0..00945ccba54 100644
--- a/chromium/third_party/skia/gm/dftext.cpp
+++ b/chromium/third_party/skia/gm/dftext.cpp
@@ -85,7 +85,7 @@ protected:
// check scaling up
SkScalar x = SkIntToScalar(0);
SkScalar y = SkIntToScalar(78);
- for (size_t i = 0; i < SK_ARRAY_COUNT(textSizes); ++i) {
+ for (size_t i = 0; i < std::size(textSizes); ++i) {
SkAutoCanvasRestore acr(canvas, true);
canvas->translate(x, y);
canvas->scale(scales[i], scales[i]);
@@ -113,7 +113,7 @@ protected:
font.setEdging(SkFont::Edging::kSubpixelAntiAlias);
x = SkIntToScalar(680);
y = SkIntToScalar(20);
- size_t arraySize = SK_ARRAY_COUNT(textSizes);
+ size_t arraySize = std::size(textSizes);
for (size_t i = 0; i < arraySize; ++i) {
SkAutoCanvasRestore acr(canvas, true);
canvas->translate(x, y);
@@ -157,7 +157,7 @@ protected:
x = SkIntToScalar(680);
y = SkIntToScalar(235);
font.setSize(SkIntToScalar(19));
- for (size_t i = 0; i < SK_ARRAY_COUNT(fg); ++i) {
+ for (size_t i = 0; i < std::size(fg); ++i) {
paint.setColor(fg[i]);
canvas->drawSimpleText(text, textLen, SkTextEncoding::kUTF8, x, y, font, paint);
@@ -171,7 +171,7 @@ protected:
x = SkIntToScalar(830);
y = SkIntToScalar(235);
font.setSize(SkIntToScalar(19));
- for (size_t i = 0; i < SK_ARRAY_COUNT(fg); ++i) {
+ for (size_t i = 0; i < std::size(fg); ++i) {
paint.setColor(fg[i]);
canvas->drawSimpleText(text, textLen, SkTextEncoding::kUTF8, x, y, font, paint);
@@ -228,7 +228,9 @@ protected:
emoiFont.setSubpixel(true);
emoiFont.setTypeface(fEmojiTypeface);
emoiFont.setSize(SkIntToScalar(19));
- canvas->drawSimpleText(fEmojiText, strlen(fEmojiText), SkTextEncoding::kUTF8, 670, 90, emoiFont, paint);
+ paint.setColor(SK_ColorWHITE);
+ canvas->drawSimpleText(fEmojiText, strlen(fEmojiText), SkTextEncoding::kUTF8, 670, 90,
+ emoiFont, paint);
}
// render offscreen buffer
diff --git a/chromium/third_party/skia/gm/drawatlas.cpp b/chromium/third_party/skia/gm/drawatlas.cpp
index e4b4f0bea2b..e7155015616 100644
--- a/chromium/third_party/skia/gm/drawatlas.cpp
+++ b/chromium/third_party/skia/gm/drawatlas.cpp
@@ -100,7 +100,7 @@ protected:
{ 2, -30, 310, 30 }, // scale + rotate + translate
};
- const int N = SK_ARRAY_COUNT(rec);
+ const int N = std::size(rec);
SkRSXform xform[N];
SkRect tex[N];
SkColor colors[N];
@@ -271,7 +271,7 @@ DEF_SIMPLE_GM(blob_rsxform_distortable, canvas, 500, 100) {
{ SkSetFourByteTag('w','g','h','t'), 1.618033988749895f }
};
SkFontArguments params;
- params.setVariationDesignPosition({position, SK_ARRAY_COUNT(position)});
+ params.setVariationDesignPosition({position, std::size(position)});
typeface = fm->makeFromStream(std::move(distortable), params);
}
diff --git a/chromium/third_party/skia/gm/drawatlascolor.cpp b/chromium/third_party/skia/gm/drawatlascolor.cpp
index bc4bcdbe9e8..6775529c29b 100644
--- a/chromium/third_party/skia/gm/drawatlascolor.cpp
+++ b/chromium/third_party/skia/gm/drawatlascolor.cpp
@@ -124,9 +124,9 @@ protected:
0x88000088 // transparent blue
};
- const int numModes = SK_ARRAY_COUNT(gModes);
+ const int numModes = std::size(gModes);
SkASSERT(numModes == kNumXferModes);
- const int numColors = SK_ARRAY_COUNT(gColors);
+ const int numColors = std::size(gColors);
SkASSERT(numColors == kNumColors);
SkRSXform xforms[numColors];
SkRect rects[numColors];
diff --git a/chromium/third_party/skia/gm/drawbitmaprect.cpp b/chromium/third_party/skia/gm/drawbitmaprect.cpp
index e3e39b7083b..3fa01311216 100644
--- a/chromium/third_party/skia/gm/drawbitmaprect.cpp
+++ b/chromium/third_party/skia/gm/drawbitmaprect.cpp
@@ -83,7 +83,7 @@ static sk_sp<SkImage> makebm(SkCanvas* origCanvas, SkBitmap* resultBM, int w, in
paint.setShader(SkGradientShader::MakeRadial(
pt, radius,
colors, pos,
- SK_ARRAY_COUNT(colors),
+ std::size(colors),
SkTileMode::kRepeat,
0, &mat));
canvas->drawRect(rect, paint);
diff --git a/chromium/third_party/skia/gm/drawglyphs.cpp b/chromium/third_party/skia/gm/drawglyphs.cpp
index 92dfb26f6d5..364ef60b4f4 100644
--- a/chromium/third_party/skia/gm/drawglyphs.cpp
+++ b/chromium/third_party/skia/gm/drawglyphs.cpp
@@ -32,7 +32,7 @@ public:
fPositions.append(fGlyphCount);
fFont.getPos(fGlyphs.begin(), fGlyphCount, fPositions.begin());
- auto positions = SkMakeSpan(fPositions.begin(), fGlyphCount);
+ auto positions = SkSpan(fPositions.begin(), fGlyphCount);
fLength = positions.back().x() - positions.front().x();
fRadius = fLength / SK_FloatPI;
diff --git a/chromium/third_party/skia/gm/drawimageset.cpp b/chromium/third_party/skia/gm/drawimageset.cpp
index 7b8fe281d66..7343ea62cf2 100644
--- a/chromium/third_party/skia/gm/drawimageset.cpp
+++ b/chromium/third_party/skia/gm/drawimageset.cpp
@@ -145,7 +145,7 @@ private:
setPaint.setBlendMode(SkBlendMode::kSrcOver);
SkSamplingOptions sampling(fm);
- for (size_t m = 0; m < SK_ARRAY_COUNT(matrices); ++m) {
+ for (size_t m = 0; m < std::size(matrices); ++m) {
// Draw grid of red lines at interior tile boundaries.
static constexpr SkScalar kLineOutset = 10.f;
SkPaint paint;
@@ -245,7 +245,7 @@ private:
for (SkScalar frac : {0.f, 0.5f}) {
canvas->save();
canvas->translate(frac, frac);
- for (size_t m = 0; m < SK_ARRAY_COUNT(matrices); ++m) {
+ for (size_t m = 0; m < std::size(matrices); ++m) {
canvas->save();
canvas->concat(matrices[m]);
canvas->experimental_DrawEdgeAAImageSet(fSet, kM * kN, nullptr, nullptr,
@@ -269,7 +269,7 @@ private:
scaledSet[i].fDstRect.fBottom *= scale.fY;
scaledSet[i].fAlpha = 0 == (i % 3) ? 0.4f : 1.f;
}
- for (size_t m = 0; m < SK_ARRAY_COUNT(matrices); ++m) {
+ for (size_t m = 0; m < std::size(matrices); ++m) {
canvas->save();
canvas->concat(matrices[m]);
canvas->experimental_DrawEdgeAAImageSet(scaledSet, kM * kN, nullptr, nullptr,
diff --git a/chromium/third_party/skia/gm/drawminibitmaprect.cpp b/chromium/third_party/skia/gm/drawminibitmaprect.cpp
index 58cbf9e0533..4fa4fb06570 100644
--- a/chromium/third_party/skia/gm/drawminibitmaprect.cpp
+++ b/chromium/third_party/skia/gm/drawminibitmaprect.cpp
@@ -52,7 +52,7 @@ static sk_sp<SkImage> makebm(int w, int h) {
5 * SK_Scalar1 / 6,
SK_Scalar1};
- SkASSERT(SK_ARRAY_COUNT(colors) == SK_ARRAY_COUNT(pos));
+ SkASSERT(std::size(colors) == std::size(pos));
SkPaint paint;
SkRect rect = SkRect::MakeWH(wScalar, hScalar);
SkMatrix mat = SkMatrix::I();
@@ -60,7 +60,7 @@ static sk_sp<SkImage> makebm(int w, int h) {
paint.setShader(SkGradientShader::MakeRadial(
pt, radius,
colors, pos,
- SK_ARRAY_COUNT(colors),
+ std::size(colors),
SkTileMode::kRepeat,
0, &mat));
canvas->drawRect(rect, paint);
diff --git a/chromium/third_party/skia/gm/drawquadset.cpp b/chromium/third_party/skia/gm/drawquadset.cpp
index 72e9c2aead9..89a4d487f86 100644
--- a/chromium/third_party/skia/gm/drawquadset.cpp
+++ b/chromium/third_party/skia/gm/drawquadset.cpp
@@ -28,7 +28,7 @@
#include "src/core/SkMatrixProvider.h"
#include "src/gpu/ganesh/GrPaint.h"
#include "src/gpu/ganesh/SkGr.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "tools/ToolUtils.h"
#include <utility>
@@ -85,8 +85,10 @@ static void draw_gradient_tiles(SkCanvas* canvas, bool alignGradients) {
// Use non-public API to leverage general GrPaint capabilities
SkMatrix view = canvas->getTotalMatrix();
SkMatrixProvider matrixProvider(view);
+ SkSurfaceProps props;
GrPaint grPaint;
- SkPaintToGrPaint(rContext, sdc->colorInfo(), paint, matrixProvider, &grPaint);
+ SkPaintToGrPaint(rContext, sdc->colorInfo(), paint, matrixProvider, props,
+ &grPaint);
sdc->fillRectWithEdgeAA(nullptr, std::move(grPaint),
static_cast<GrQuadAAFlags>(aa), view, tile);
} else {
@@ -173,7 +175,7 @@ static TileRenderer kTileSets[] = {
[](SkCanvas* canvas) { draw_color_tiles(canvas, /* multicolor */true); },
};
static const char* kTileSetNames[] = { "Local", "Aligned", "Green", "Multicolor" };
-static_assert(SK_ARRAY_COUNT(kTileSets) == SK_ARRAY_COUNT(kTileSetNames), "Count mismatch");
+static_assert(std::size(kTileSets) == std::size(kTileSetNames), "Count mismatch");
namespace skiagm {
@@ -205,12 +207,12 @@ private:
SkAssertResult(rowMatrices[4].setPolyToPoly(src, dst, 4));
rowMatrices[4].preTranslate(0.f, +10.f);
static const char* matrixNames[] = { "Identity", "T+S", "Rotate", "Skew", "Perspective" };
- static_assert(SK_ARRAY_COUNT(matrixNames) == SK_ARRAY_COUNT(rowMatrices), "Count mismatch");
+ static_assert(std::size(matrixNames) == std::size(rowMatrices), "Count mismatch");
// Print a column header
canvas->save();
canvas->translate(110.f, 20.f);
- for (size_t j = 0; j < SK_ARRAY_COUNT(kTileSetNames); ++j) {
+ for (size_t j = 0; j < std::size(kTileSetNames); ++j) {
draw_text(canvas, kTileSetNames[j]);
canvas->translate(kColCount * kTileWidth + 30.f, 0.f);
}
@@ -218,13 +220,13 @@ private:
canvas->translate(0.f, 40.f);
// Render all tile variations
- for (size_t i = 0; i < SK_ARRAY_COUNT(rowMatrices); ++i) {
+ for (size_t i = 0; i < std::size(rowMatrices); ++i) {
canvas->save();
canvas->translate(10.f, 0.5f * kRowCount * kTileHeight);
draw_text(canvas, matrixNames[i]);
canvas->translate(100.f, -0.5f * kRowCount * kTileHeight);
- for (size_t j = 0; j < SK_ARRAY_COUNT(kTileSets); ++j) {
+ for (size_t j = 0; j < std::size(kTileSets); ++j) {
canvas->save();
draw_tile_boundaries(canvas, rowMatrices[i]);
diff --git a/chromium/third_party/skia/gm/dropshadowimagefilter.cpp b/chromium/third_party/skia/gm/dropshadowimagefilter.cpp
index 9b9ccde9a2e..5d90645e09f 100644
--- a/chromium/third_party/skia/gm/dropshadowimagefilter.cpp
+++ b/chromium/third_party/skia/gm/dropshadowimagefilter.cpp
@@ -106,9 +106,9 @@ DEF_SIMPLE_GM(dropshadowimagefilter, canvas, 400, 656) {
SkScalar DY = r.height() + MARGIN;
canvas->translate(MARGIN, MARGIN);
- for (size_t j = 0; j < SK_ARRAY_COUNT(drawProc); ++j) {
+ for (size_t j = 0; j < std::size(drawProc); ++j) {
canvas->save();
- for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) {
+ for (size_t i = 0; i < std::size(filters); ++i) {
drawProc[j](canvas, r, filters[i]);
canvas->translate(0, DY);
}
diff --git a/chromium/third_party/skia/gm/drrect.cpp b/chromium/third_party/skia/gm/drrect.cpp
index b863ce578f9..f71687084ac 100644
--- a/chromium/third_party/skia/gm/drrect.cpp
+++ b/chromium/third_party/skia/gm/drrect.cpp
@@ -59,8 +59,8 @@ protected:
inners[4].setRectRadii(r, radii);
canvas->translate(16, 16);
- for (size_t j = 0; j < SK_ARRAY_COUNT(inners); ++j) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(outers); ++i) {
+ for (size_t j = 0; j < std::size(inners); ++j) {
+ for (size_t i = 0; i < std::size(outers); ++i) {
canvas->save();
canvas->translate(dx * j, dy * i);
canvas->drawDRRect(outers[i], inners[j], paint);
diff --git a/chromium/third_party/skia/gm/emptypath.cpp b/chromium/third_party/skia/gm/emptypath.cpp
index e13e6180c3c..f81785ef109 100644
--- a/chromium/third_party/skia/gm/emptypath.cpp
+++ b/chromium/third_party/skia/gm/emptypath.cpp
@@ -76,8 +76,8 @@ class EmptyPathGM : public GM {
canvas->save();
canvas->translate(10 * SK_Scalar1, 0);
canvas->save();
- for (size_t style = 0; style < SK_ARRAY_COUNT(gStyles); ++style) {
- for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) {
+ for (size_t style = 0; style < std::size(gStyles); ++style) {
+ for (size_t fill = 0; fill < std::size(gFills); ++fill) {
if (0 == i % 4) {
canvas->restore();
canvas->translate(0, rect.height() + 40 * SK_Scalar1);
diff --git a/chromium/third_party/skia/gm/encode_platform.cpp b/chromium/third_party/skia/gm/encode_platform.cpp
index 591af940f27..b724de7e0cf 100644
--- a/chromium/third_party/skia/gm/encode_platform.cpp
+++ b/chromium/third_party/skia/gm/encode_platform.cpp
@@ -104,7 +104,7 @@ protected:
}
SkISize onISize() override {
- return SkISize::Make(256 * SK_ARRAY_COUNT(gRecs), 256 * 3);
+ return SkISize::Make(256 * std::size(gRecs), 256 * 3);
}
DrawResult onDraw(SkCanvas* canvas, SkString* errorMsg) override {
diff --git a/chromium/third_party/skia/gm/filltypespersp.cpp b/chromium/third_party/skia/gm/filltypespersp.cpp
index fbad1730380..bb25b3711bd 100644
--- a/chromium/third_party/skia/gm/filltypespersp.cpp
+++ b/chromium/third_party/skia/gm/filltypespersp.cpp
@@ -72,7 +72,7 @@ protected:
SkIntToScalar(100),
colors,
pos,
- SK_ARRAY_COUNT(colors),
+ std::size(colors),
SkTileMode::kClamp));
paint.setAntiAlias(aa);
@@ -101,7 +101,7 @@ protected:
SkIntToScalar(1000),
colors,
pos,
- SK_ARRAY_COUNT(colors),
+ std::size(colors),
SkTileMode::kClamp));
canvas->save();
canvas->translate(SkIntToScalar(100), SkIntToScalar(100));
diff --git a/chromium/third_party/skia/gm/filterfastbounds.cpp b/chromium/third_party/skia/gm/filterfastbounds.cpp
index 89c39fe15ff..7da0c713578 100644
--- a/chromium/third_party/skia/gm/filterfastbounds.cpp
+++ b/chromium/third_party/skia/gm/filterfastbounds.cpp
@@ -165,7 +165,7 @@ protected:
SkString onShortName() override { return SkString("filterfastbounds"); }
SkISize onISize() override {
- return SkISize::Make((SK_ARRAY_COUNT(gDrawMthds) + kNumXtraCols) * kTileWidth,
+ return SkISize::Make((std::size(gDrawMthds) + kNumXtraCols) * kTileWidth,
kNumVertTiles * kTileHeight);
}
@@ -279,12 +279,12 @@ protected:
for (int i = 1; i < paints.count(); ++i) {
canvas->drawLine(0,
i*SkIntToScalar(kTileHeight),
- SkIntToScalar((SK_ARRAY_COUNT(gDrawMthds) + kNumXtraCols)*kTileWidth),
+ SkIntToScalar((std::size(gDrawMthds) + kNumXtraCols)*kTileWidth),
i*SkIntToScalar(kTileHeight),
blackFill);
}
// vertical separators
- for (int i = 0; i < (int)SK_ARRAY_COUNT(gDrawMthds) + kNumXtraCols; ++i) {
+ for (int i = 0; i < (int)std::size(gDrawMthds) + kNumXtraCols; ++i) {
canvas->drawLine(SkIntToScalar(i * kTileWidth),
0,
SkIntToScalar(i * kTileWidth),
@@ -305,7 +305,7 @@ protected:
}
// Multiple columns with different geometry
- for (int i = 0; i < (int)SK_ARRAY_COUNT(gDrawMthds); ++i) {
+ for (int i = 0; i < (int)std::size(gDrawMthds); ++i) {
for (int j = 0; j < paints.count(); ++j) {
draw_geom_with_paint(*gDrawMthds[i],
SkIPoint::Make((i+kNumXtraCols) * kTileWidth, j*kTileHeight),
diff --git a/chromium/third_party/skia/gm/filterindiabox.cpp b/chromium/third_party/skia/gm/filterindiabox.cpp
index adcdb909dd5..cd5690ff7ae 100644
--- a/chromium/third_party/skia/gm/filterindiabox.cpp
+++ b/chromium/third_party/skia/gm/filterindiabox.cpp
@@ -71,7 +71,7 @@ class FilterIndiaBoxGM : public skiagm::GM {
void onDraw(SkCanvas* canvas) override {
canvas->translate(10, 10);
- for (size_t i = 0; i < SK_ARRAY_COUNT(fMatrix); ++i) {
+ for (size_t i = 0; i < std::size(fMatrix); ++i) {
SkSize size = computeSize(fBM, fMatrix[i]);
size.fWidth += 20;
size.fHeight += 20;
diff --git a/chromium/third_party/skia/gm/fontmgr.cpp b/chromium/third_party/skia/gm/fontmgr.cpp
index 694e6a5701e..c80c605a56d 100644
--- a/chromium/third_party/skia/gm/fontmgr.cpp
+++ b/chromium/third_party/skia/gm/fontmgr.cpp
@@ -179,7 +179,7 @@ class FontMgrMatchGM : public skiagm::GM {
};
sk_sp<SkFontStyleSet> fset;
- for (size_t i = 0; i < SK_ARRAY_COUNT(gNames); ++i) {
+ for (size_t i = 0; i < std::size(gNames); ++i) {
fset.reset(fFM->matchFamily(gNames[i]));
if (fset->count() > 0) {
break;
diff --git a/chromium/third_party/skia/gm/fontscalerdistortable.cpp b/chromium/third_party/skia/gm/fontscalerdistortable.cpp
index a45dd2f8b16..d6a8001f4ca 100644
--- a/chromium/third_party/skia/gm/fontscalerdistortable.cpp
+++ b/chromium/third_party/skia/gm/fontscalerdistortable.cpp
@@ -22,6 +22,7 @@
#include "include/core/SkTypes.h"
#include "tools/Resources.h"
#include "tools/SkMetaData.h"
+#include "tools/ToolUtils.h"
#include <string.h>
#include <memory>
@@ -48,20 +49,11 @@ private:
bool fDirty = true;
bool fOverride = false;
- size_t fAxisSliderCount = 0;
- struct AxisSlider {
- SkFourByteTag axis;
- SkScalar control[3];
- SkString name;
- };
- std::unique_ptr<AxisSlider[]> fAxisSliders;
+ ToolUtils::VariationSliders fVariationSliders;
bool onGetControls(SkMetaData* controls) override {
controls->setBool("Override", fOverride);
- for (size_t i = 0; i < fAxisSliderCount; ++i) {
- controls->setScalars(fAxisSliders[i].name.c_str(), 3, fAxisSliders[i].control);
- }
- return true;
+ return fVariationSliders.writeControls(controls);
}
void onSetControls(const SkMetaData& controls) override {
@@ -71,13 +63,7 @@ private:
fDirty = true;
}
- for (size_t i = 0; i < fAxisSliderCount; ++i) {
- SkScalar oldValue = fAxisSliders[i].control[0];
- controls.findScalars(fAxisSliders[i].name.c_str(), nullptr, fAxisSliders[i].control);
- if (oldValue != fAxisSliders[i].control[0]) {
- fDirty = true;
- }
- }
+ return fVariationSliders.readControls(controls, &fDirty);
}
struct Info {
@@ -99,23 +85,7 @@ private:
};
if (fInfo.distortable) {
- int axisCount = fInfo.distortable->getVariationDesignParameters(nullptr, 0);
- if (axisCount > 0) {
- auto axes = std::make_unique<SkFontParameters::Variation::Axis[]>(axisCount);
- axisCount = fInfo.distortable->getVariationDesignParameters(axes.get(), axisCount);
- if (axisCount > 0) {
- fAxisSliders = std::make_unique<AxisSlider[]>(axisCount);
- for (int i = 0; i < axisCount; ++i) {
- fAxisSliders[i].axis = axes[i].tag;
- fAxisSliders[i].control[0] = axes[i].def;
- fAxisSliders[i].control[1] = axes[i].min;
- fAxisSliders[i].control[2] = axes[i].max;
- fAxisSliders[i].name.append((const char *)&axes[i].tag, 4);
- fAxisSliders[i].name.appendS32(i);
- }
- fAxisSliderCount = axisCount;
- }
- }
+ fVariationSliders = ToolUtils::VariationSliders(fInfo.distortable.get());
}
}
@@ -132,24 +102,21 @@ private:
for (int row = 0; row < rows; ++row) {
for (int col = 0; col < cols; ++col) {
using Coordinate = SkFontArguments::VariationPosition::Coordinate;
- int coordinateCount;
- std::unique_ptr<Coordinate[]> coordinates;
+ SkFontArguments::VariationPosition position;
+ Coordinate coordinates[2];
+
if (fOverride) {
- coordinateCount = fAxisSliderCount;
- coordinates = std::make_unique<Coordinate[]>(coordinateCount);
- for (size_t i = 0; i < fAxisSliderCount; ++i) {
- coordinates[i].axis = fAxisSliders[i].axis;
- coordinates[i].value = fAxisSliders[i].control[0];
- }
+ SkSpan<const Coordinate> user_coordinates = fVariationSliders.getCoordinates();
+ position = {user_coordinates.data(), static_cast<int>(user_coordinates.size())};
+
} else {
- coordinateCount = 2;
- coordinates = std::make_unique<Coordinate[]>(coordinateCount);
+ const int coordinateCount = 2;
SkScalar styleValue = SkScalarInterp(fInfo.axisMin, fInfo.axisMax,
SkScalar(row*cols + col) / (rows*cols));
coordinates[0] = {fInfo.axisTag, styleValue};
coordinates[1] = {fInfo.axisTag, styleValue};
+ position = {coordinates, static_cast<int>(coordinateCount)};
}
- SkFontArguments::VariationPosition position = {coordinates.get(), coordinateCount};
typeface[row][col] = [&]() -> sk_sp<SkTypeface> {
if (row == 0 && fInfo.distortable) {
diff --git a/chromium/third_party/skia/gm/fp_sample_chaining.cpp b/chromium/third_party/skia/gm/fp_sample_chaining.cpp
index f21da69fba2..5553510a4cc 100644
--- a/chromium/third_party/skia/gm/fp_sample_chaining.cpp
+++ b/chromium/third_party/skia/gm/fp_sample_chaining.cpp
@@ -13,10 +13,10 @@
#include "src/gpu/ganesh/GrDirectContextPriv.h"
#include "src/gpu/ganesh/GrPaint.h"
#include "src/gpu/ganesh/SkGr.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/effects/GrMatrixEffect.h"
#include "src/gpu/ganesh/effects/GrTextureEffect.h"
#include "src/gpu/ganesh/glsl/GrGLSLFragmentShaderBuilder.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
#include "tools/ToolUtils.h"
namespace {
@@ -193,7 +193,8 @@ DEF_SIMPLE_GPU_GM_CAN_FAIL(fp_sample_chaining, rContext, canvas, errorMsg, 232,
#if 0
auto fp = std::unique_ptr<GrFragmentProcessor>(new TestPatternEffect());
#else
- auto view = std::get<0>(GrMakeCachedBitmapProxyView(rContext, bmp, GrMipmapped::kNo));
+ auto view = std::get<0>(GrMakeCachedBitmapProxyView(
+ rContext, bmp, /*label=*/"FpSampleChaining", GrMipmapped::kNo));
auto fp = GrTextureEffect::Make(std::move(view), bmp.alphaType());
#endif
for (EffectType effectType : effects) {
diff --git a/chromium/third_party/skia/gm/fpcoordinateoverride.cpp b/chromium/third_party/skia/gm/fpcoordinateoverride.cpp
index c31ea708fb3..b2fd678d44a 100644
--- a/chromium/third_party/skia/gm/fpcoordinateoverride.cpp
+++ b/chromium/third_party/skia/gm/fpcoordinateoverride.cpp
@@ -83,7 +83,8 @@ DEF_SIMPLE_GPU_GM_BG(fpcoordinateoverride, rContext, canvas, 512, 512,
SkBitmap bmp;
GetResourceAsBitmap("images/mandrill_512_q075.jpg", &bmp);
- auto view = std::get<0>(GrMakeCachedBitmapProxyView(rContext, bmp, GrMipmapped::kNo));
+ auto view = std::get<0>(GrMakeCachedBitmapProxyView(
+ rContext, bmp, /*label=*/"FpCoordinateOverride", GrMipmapped::kNo));
if (!view) {
return;
}
diff --git a/chromium/third_party/skia/gm/fwidth_squircle.cpp b/chromium/third_party/skia/gm/fwidth_squircle.cpp
index 85970360b6d..28854f92a71 100644
--- a/chromium/third_party/skia/gm/fwidth_squircle.cpp
+++ b/chromium/third_party/skia/gm/fwidth_squircle.cpp
@@ -33,6 +33,7 @@
#include "src/gpu/ganesh/GrResourceProvider.h"
#include "src/gpu/ganesh/GrShaderCaps.h"
#include "src/gpu/ganesh/GrShaderVar.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/ganesh/glsl/GrGLSLProgramDataManager.h"
#include "src/gpu/ganesh/glsl/GrGLSLUniformHandler.h"
@@ -40,7 +41,6 @@
#include "src/gpu/ganesh/glsl/GrGLSLVertexGeoBuilder.h"
#include "src/gpu/ganesh/ops/GrDrawOp.h"
#include "src/gpu/ganesh/ops/GrOp.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
#include "tools/gpu/ProxyUtils.h"
#include <memory>
diff --git a/chromium/third_party/skia/gm/gammatext.cpp b/chromium/third_party/skia/gm/gammatext.cpp
index 494949474e0..3f8576a3702 100644
--- a/chromium/third_party/skia/gm/gammatext.cpp
+++ b/chromium/third_party/skia/gm/gammatext.cpp
@@ -26,7 +26,7 @@
static sk_sp<SkShader> make_heatGradient(const SkPoint pts[2]) {
const SkColor bw[] = { SK_ColorBLACK, SK_ColorWHITE };
- return SkGradientShader::MakeLinear(pts, bw, nullptr, SK_ARRAY_COUNT(bw), SkTileMode::kClamp);
+ return SkGradientShader::MakeLinear(pts, bw, nullptr, std::size(bw), SkTileMode::kClamp);
}
/**
@@ -75,7 +75,7 @@ protected:
font.setEdging(SkFont::Edging::kSubpixelAntiAlias);
SkScalar x = SkIntToScalar(10);
- for (size_t i = 0; i < SK_ARRAY_COUNT(fg); ++i) {
+ for (size_t i = 0; i < std::size(fg); ++i) {
paint.setColor(fg[i]);
SkScalar y = SkIntToScalar(40);
@@ -84,7 +84,7 @@ protected:
canvas->drawString(text, x, y, font, paint);
y += font.getSize() * 2;
}
- x += SkIntToScalar(1024) / SK_ARRAY_COUNT(fg);
+ x += SkIntToScalar(1024) / std::size(fg);
}
}
@@ -123,7 +123,7 @@ class GammaShaderTextGM : public skiagm::GM {
public:
GammaShaderTextGM() {
const SkColor colors[] = { SK_ColorBLACK, SK_ColorRED, SK_ColorBLUE };
- for (size_t i = 0; i < SK_ARRAY_COUNT(fShaders); ++i) {
+ for (size_t i = 0; i < std::size(fShaders); ++i) {
fColors[i] = colors[i];
}
}
@@ -138,7 +138,7 @@ protected:
}
void onOnceBeforeDraw() override {
- for (size_t i = 0; i < SK_ARRAY_COUNT(fShaders); ++i) {
+ for (size_t i = 0; i < std::size(fShaders); ++i) {
fShaders[i] = make_gradient(fColors[i]);
}
}
@@ -149,7 +149,7 @@ protected:
SkFont font(SkTypeface::MakeFromName("serif", SkFontStyle::Italic()), 18);
font.setEdging(SkFont::Edging::kSubpixelAntiAlias);
- for (size_t i = 0; i < SK_ARRAY_COUNT(fShaders); ++i) {
+ for (size_t i = 0; i < std::size(fShaders); ++i) {
draw_pair(canvas, font, fColors[i], fShaders[i]);
canvas->translate(0, 80);
}
diff --git a/chromium/third_party/skia/gm/gpu_blur_utils.cpp b/chromium/third_party/skia/gm/gpu_blur_utils.cpp
index 5d87e61f5d5..1f152c721ac 100644
--- a/chromium/third_party/skia/gm/gpu_blur_utils.cpp
+++ b/chromium/third_party/skia/gm/gpu_blur_utils.cpp
@@ -15,9 +15,9 @@
#include "src/gpu/ganesh/GrRecordingContextPriv.h"
#include "src/gpu/ganesh/GrStyle.h"
#include "src/gpu/ganesh/SkGr.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/effects/GrBlendFragmentProcessor.h"
#include "src/gpu/ganesh/effects/GrTextureEffect.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
#include "src/image/SkImage_Base.h"
namespace {
diff --git a/chromium/third_party/skia/gm/gradient_dirty_laundry.cpp b/chromium/third_party/skia/gm/gradient_dirty_laundry.cpp
index cbf5e9678a3..f7efdfb5fd2 100644
--- a/chromium/third_party/skia/gm/gradient_dirty_laundry.cpp
+++ b/chromium/third_party/skia/gm/gradient_dirty_laundry.cpp
@@ -90,9 +90,9 @@ protected:
paint.setAntiAlias(true);
canvas->translate(SkIntToScalar(20), SkIntToScalar(20));
- for (size_t i = 0; i < SK_ARRAY_COUNT(gGradData); i++) {
+ for (size_t i = 0; i < std::size(gGradData); i++) {
canvas->save();
- for (size_t j = 0; j < SK_ARRAY_COUNT(gGradMakers); j++) {
+ for (size_t j = 0; j < std::size(gGradMakers); j++) {
paint.setShader(gGradMakers[j](pts, gGradData[i], tm));
canvas->drawRect(r, paint);
canvas->translate(0, SkIntToScalar(120));
diff --git a/chromium/third_party/skia/gm/gradient_matrix.cpp b/chromium/third_party/skia/gm/gradient_matrix.cpp
index 3c4f8879f85..4306d594bee 100644
--- a/chromium/third_party/skia/gm/gradient_matrix.cpp
+++ b/chromium/third_party/skia/gm/gradient_matrix.cpp
@@ -62,7 +62,7 @@ constexpr SkScalar TESTGRID_Y = SkIntToScalar(200);
constexpr int IMAGES_X = 4; // number of images per row
static sk_sp<SkShader> make_linear_gradient(const SkPoint pts[2], const SkMatrix& localMatrix) {
- return SkGradientShader::MakeLinear(pts, gColors, nullptr, SK_ARRAY_COUNT(gColors),
+ return SkGradientShader::MakeLinear(pts, gColors, nullptr, std::size(gColors),
SkTileMode::kClamp, 0, &localMatrix);
}
@@ -71,7 +71,7 @@ static sk_sp<SkShader> make_radial_gradient(const SkPoint pts[2], const SkMatrix
center.set(SkScalarAve(pts[0].fX, pts[1].fX),
SkScalarAve(pts[0].fY, pts[1].fY));
float radius = (center - pts[0]).length();
- return SkGradientShader::MakeRadial(center, radius, gColors, nullptr, SK_ARRAY_COUNT(gColors),
+ return SkGradientShader::MakeRadial(center, radius, gColors, nullptr, std::size(gColors),
SkTileMode::kClamp, 0, &localMatrix);
}
@@ -110,10 +110,10 @@ static void draw_gradients(SkCanvas* canvas,
DEF_SIMPLE_GM_BG(gradient_matrix, canvas, 800, 800, 0xFFDDDDDD) {
draw_gradients(canvas, &make_linear_gradient,
- linearPts, SK_ARRAY_COUNT(linearPts));
+ linearPts, std::size(linearPts));
canvas->translate(0, TESTGRID_Y);
draw_gradients(canvas, &make_radial_gradient,
- radialPts, SK_ARRAY_COUNT(radialPts));
+ radialPts, std::size(radialPts));
}
diff --git a/chromium/third_party/skia/gm/gradients.cpp b/chromium/third_party/skia/gm/gradients.cpp
index 9a41368e853..6806beb3a60 100644
--- a/chromium/third_party/skia/gm/gradients.cpp
+++ b/chromium/third_party/skia/gm/gradients.cpp
@@ -204,9 +204,9 @@ protected:
paint.setDither(fDither);
canvas->translate(SkIntToScalar(20), SkIntToScalar(20));
- for (size_t i = 0; i < SK_ARRAY_COUNT(gGradData); i++) {
+ for (size_t i = 0; i < std::size(gGradData); i++) {
canvas->save();
- for (size_t j = 0; j < SK_ARRAY_COUNT(gGradMakers); j++) {
+ for (size_t j = 0; j < std::size(gGradMakers); j++) {
SkMatrix scale = SkMatrix::I();
if (i == 5) { // if the clamp case
@@ -261,9 +261,9 @@ private:
paint.setDither(fDither);
canvas->translate(SkIntToScalar(20), SkIntToScalar(20));
- for (size_t i = 0; i < SK_ARRAY_COUNT(gGradData); i++) {
+ for (size_t i = 0; i < std::size(gGradData); i++) {
canvas->save();
- for (size_t j = 0; j < SK_ARRAY_COUNT(gGradMakers4f); j++) {
+ for (size_t j = 0; j < std::size(gGradMakers4f); j++) {
SkMatrix scale = SkMatrix::I();
if (i == 5) { // if the clamp case
@@ -313,9 +313,9 @@ private:
paint.setDither(fDither);
canvas->translate(SkIntToScalar(20), SkIntToScalar(20));
- for (size_t i = 0; i < SK_ARRAY_COUNT(gGradData); i++) {
+ for (size_t i = 0; i < std::size(gGradData); i++) {
canvas->save();
- for (size_t j = 0; j < SK_ARRAY_COUNT(gGradMakers); j++) {
+ for (size_t j = 0; j < std::size(gGradMakers); j++) {
// apply an increasing y perspective as we move to the right
SkMatrix perspective;
perspective.setIdentity();
@@ -405,7 +405,7 @@ private:
SkScalar r1 = SkIntToScalar(150);
SkPaint paint;
paint.setShader(SkGradientShader::MakeTwoPointConical(c0, r0, c1, r1, colors,
- pos, SK_ARRAY_COUNT(pos),
+ pos, std::size(pos),
SkTileMode::kClamp));
paint.setDither(fDither);
canvas->drawPaint(paint);
@@ -446,7 +446,7 @@ DEF_SIMPLE_GM(small_color_stop, canvas, 100, 150) {
paint.setColor(SK_ColorYELLOW);
canvas->drawRect(SkRect::MakeWH(100, 150), paint);
paint.setShader(SkGradientShader::MakeTwoPointConical(c0, r0, c1, r1, colors, pos,
- SK_ARRAY_COUNT(pos),
+ std::size(pos),
SkTileMode::kClamp));
canvas->drawRect(SkRect::MakeWH(100, 150), paint);
}
@@ -511,7 +511,7 @@ class RadialGradientGM : public skiagm::GM {
0.35f,
1.0f };
paint.setShader(SkGradientShader::MakeRadial(center, radius, colors, pos,
- SK_ARRAY_COUNT(pos),
+ std::size(pos),
SkTileMode::kClamp));
SkRect r = {
0, 0, SkIntToScalar(dim.width()), SkIntToScalar(dim.height())
@@ -552,16 +552,16 @@ private:
// or premultiply the endpoints first, avoiding the need to premultiply each point (cheap).
const uint32_t flags[] = { 0, SkGradientShader::kInterpolateColorsInPremul_Flag };
- for (size_t i = 0; i < SK_ARRAY_COUNT(flags); i++) {
+ for (size_t i = 0; i < std::size(flags); i++) {
paint1.setShader(SkGradientShader::MakeSweep(cx, cy, sweep_colors,
- nullptr, SK_ARRAY_COUNT(sweep_colors),
+ nullptr, std::size(sweep_colors),
flags[i], nullptr));
paint2.setShader(SkGradientShader::MakeRadial(center, radius, colors1,
- nullptr, SK_ARRAY_COUNT(colors1),
+ nullptr, std::size(colors1),
SkTileMode::kClamp,
flags[i], nullptr));
paint3.setShader(SkGradientShader::MakeRadial(center, radius, colors2,
- nullptr, SK_ARRAY_COUNT(colors2),
+ nullptr, std::size(colors2),
SkTileMode::kClamp,
flags[i], nullptr));
paint1.setDither(fDither);
@@ -640,7 +640,7 @@ private:
SK_ColorRED };
const SkScalar pos[] = { 0, .4f, .4f, .8f, .8f, 1 };
fShader = SkGradientShader::MakeRadial(center, kRadius, colors, pos,
- SK_ARRAY_COUNT(gColors), SkTileMode::kClamp);
+ std::size(gColors), SkTileMode::kClamp);
}
void onDraw(SkCanvas* canvas) override {
@@ -682,13 +682,13 @@ private:
const SkScalar unitPos[] = { 0, 50, 70, 500, 540 };
SkScalar pos[6];
pos[5] = 1;
- for (int index = 0; index < (int) SK_ARRAY_COUNT(fShader); ++index) {
+ for (int index = 0; index < (int) std::size(fShader); ++index) {
pts[1].fX = 500.f + index * kWidthBump;
- for (int inner = 0; inner < (int) SK_ARRAY_COUNT(unitPos); ++inner) {
+ for (int inner = 0; inner < (int) std::size(unitPos); ++inner) {
pos[inner] = unitPos[inner] / (kMinWidth + index * kWidthBump);
}
fShader[index] = SkGradientShader::MakeLinear(pts, colors, pos,
- SK_ARRAY_COUNT(gColors), SkTileMode::kClamp);
+ std::size(gColors), SkTileMode::kClamp);
}
}
@@ -696,7 +696,7 @@ private:
SkPaint paint;
paint.setAntiAlias(true);
paint.setDither(fDither);
- for (int index = 0; index < (int) SK_ARRAY_COUNT(fShader); ++index) {
+ for (int index = 0; index < (int) std::size(fShader); ++index) {
paint.setShader(fShader[index]);
canvas->drawRect(SkRect::MakeLTRB(0, index * kHeight, kMinWidth + index * kWidthBump,
(index + 1) * kHeight), paint);
@@ -744,7 +744,7 @@ class LinearGradientTinyGM : public skiagm::GM {
};
SkPaint paint;
- for (unsigned i = 0; i < SK_ARRAY_COUNT(configs); ++i) {
+ for (unsigned i = 0; i < std::size(configs); ++i) {
SkAutoCanvasRestore acr(canvas, true);
paint.setShader(SkGradientShader::MakeLinear(configs[i].pts, colors, configs[i].pos,
kStopCount, SkTileMode::kClamp,
@@ -867,7 +867,7 @@ static void draw_many_stops(SkCanvas* canvas) {
SkPaint p;
p.setShader(SkGradientShader::MakeLinear(
- pts, colors, nullptr, SK_ARRAY_COUNT(colors), SkTileMode::kClamp));
+ pts, colors, nullptr, std::size(colors), SkTileMode::kClamp));
canvas->drawRect(SkRect::MakeXYWH(0, 0, 500, 500), p);
}
@@ -901,8 +901,8 @@ DEF_SIMPLE_GM(fancy_gradients, canvas, 800, 300) {
0x00000000, 0x00000000,
0xff000000, 0xff000000 };
SkScalar pos[] = { 0, .25f, .25f, .75f, .75f, 1 };
- static_assert(SK_ARRAY_COUNT(colors1) == SK_ARRAY_COUNT(pos), "color/pos size mismatch");
- static_assert(SK_ARRAY_COUNT(colors2) == SK_ARRAY_COUNT(pos), "color/pos size mismatch");
+ static_assert(std::size(colors1) == std::size(pos), "color/pos size mismatch");
+ static_assert(std::size(colors2) == std::size(pos), "color/pos size mismatch");
SkPictureRecorder recorder;
recorder.beginRecording(SkRect::MakeWH(kTileSize, kTileSize));
@@ -910,12 +910,12 @@ DEF_SIMPLE_GM(fancy_gradients, canvas, 800, 300) {
SkPaint p;
SkPoint pts1[] = { { 0, 0 }, { kTileSize, kTileSize }};
- p.setShader(SkGradientShader::MakeLinear(pts1, colors1, pos, SK_ARRAY_COUNT(colors1),
+ p.setShader(SkGradientShader::MakeLinear(pts1, colors1, pos, std::size(colors1),
SkTileMode::kClamp, 0, nullptr));
recorder.getRecordingCanvas()->drawPaint(p);
SkPoint pts2[] = { { 0, kTileSize }, { kTileSize, 0 }};
- p.setShader(SkGradientShader::MakeLinear(pts2, colors2, pos, SK_ARRAY_COUNT(colors2),
+ p.setShader(SkGradientShader::MakeLinear(pts2, colors2, pos, std::size(colors2),
SkTileMode::kClamp, 0, nullptr));
recorder.getRecordingCanvas()->drawPaint(p);
@@ -934,11 +934,11 @@ DEF_SIMPLE_GM(fancy_gradients, canvas, 800, 300) {
0xff000000, 0xff000000,
0xffffffff, 0xffffffff };
SkScalar pos[] = { 0, .25f, .25f, .5f, .5f, .75f, .75f, 1 };
- static_assert(SK_ARRAY_COUNT(colors) == SK_ARRAY_COUNT(pos), "color/pos size mismatch");
+ static_assert(std::size(colors) == std::size(pos), "color/pos size mismatch");
SkPaint p;
p.setShader(SkGradientShader::MakeSweep(kTileSize / 2, kTileSize / 2,
- colors, pos, SK_ARRAY_COUNT(colors), 0, nullptr));
+ colors, pos, std::size(colors), 0, nullptr));
SkPictureRecorder recorder;
recorder.beginRecording(SkRect::MakeWH(kTileSize, kTileSize))->drawPaint(p);
@@ -954,27 +954,27 @@ DEF_SIMPLE_GM(fancy_gradients, canvas, 800, 300) {
SkColor colors[] = { a, a, b, b, a, a, b, b, a, a, b, b, a, a, b, b};
SkScalar pos[] = { 0, .125f, .125f, .25f, .25f, .375f, .375f, .5f, .5f,
.625f, .625f, .75f, .75f, .875f, .875f, 1};
- static_assert(SK_ARRAY_COUNT(colors) == SK_ARRAY_COUNT(pos), "color/pos size mismatch");
+ static_assert(std::size(colors) == std::size(pos), "color/pos size mismatch");
SkPoint center = { 650, 150 };
sk_sp<SkShader> sweep1 = SkGradientShader::MakeSweep(center.x(), center.y(), colors, pos,
- SK_ARRAY_COUNT(colors), 0, nullptr);
+ std::size(colors), 0, nullptr);
SkMatrix m = SkMatrix::I();
m.preRotate(22.5f, center.x(), center.y());
sk_sp<SkShader> sweep2 = SkGradientShader::MakeSweep(center.x(), center.y(), colors, pos,
- SK_ARRAY_COUNT(colors), 0, &m);
+ std::size(colors), 0, &m);
sk_sp<SkShader> sweep(SkShaders::Blend(SkBlendMode::kExclusion, sweep1, sweep2));
SkScalar radialPos[] = { 0, .02f, .02f, .04f, .04f, .08f, .08f, .16f, .16f, .31f, .31f,
.62f, .62f, 1, 1, 1 };
- static_assert(SK_ARRAY_COUNT(colors) == SK_ARRAY_COUNT(radialPos),
+ static_assert(std::size(colors) == std::size(radialPos),
"color/pos size mismatch");
return SkShaders::Blend(SkBlendMode::kExclusion, sweep,
SkGradientShader::MakeRadial(center, 100, colors,
radialPos,
- SK_ARRAY_COUNT(radialPos),
+ std::size(radialPos),
SkTileMode::kClamp));
});
}
@@ -983,7 +983,7 @@ DEF_SIMPLE_GM(sweep_tiling, canvas, 690, 512) {
static constexpr SkScalar size = 160;
static constexpr SkColor colors[] = { SK_ColorBLUE, SK_ColorYELLOW, SK_ColorGREEN };
static constexpr SkScalar pos[] = { 0, .25f, .50f };
- static_assert(SK_ARRAY_COUNT(colors) == SK_ARRAY_COUNT(pos), "size mismatch");
+ static_assert(std::size(colors) == std::size(pos), "size mismatch");
static constexpr SkTileMode modes[] = { SkTileMode::kClamp,
SkTileMode::kRepeat,
@@ -1007,7 +1007,7 @@ DEF_SIMPLE_GM(sweep_tiling, canvas, 690, 512) {
for (auto angle : angles) {
p.setShader(SkGradientShader::MakeSweep(size / 2, size / 2, colors, pos,
- SK_ARRAY_COUNT(colors), mode,
+ std::size(colors), mode,
angle.start, angle.end, 0, nullptr));
canvas->drawRect(r, p);
diff --git a/chromium/third_party/skia/gm/gradients_2pt_conical.cpp b/chromium/third_party/skia/gm/gradients_2pt_conical.cpp
index dfb7418b828..e2c342fc56f 100644
--- a/chromium/third_party/skia/gm/gradients_2pt_conical.cpp
+++ b/chromium/third_party/skia/gm/gradients_2pt_conical.cpp
@@ -307,9 +307,9 @@ constexpr struct {
const int fCount;
const char* fName;
} gGradCases[] = {
- { gGradMakersOutside, SK_ARRAY_COUNT(gGradMakersOutside), "outside" },
- { gGradMakersInside, SK_ARRAY_COUNT(gGradMakersInside), "inside" },
- { gGradMakersEdgeCases, SK_ARRAY_COUNT(gGradMakersEdgeCases), "edge" },
+ { gGradMakersOutside, std::size(gGradMakersOutside), "outside" },
+ { gGradMakersInside, std::size(gGradMakersInside), "inside" },
+ { gGradMakersEdgeCases, std::size(gGradMakersEdgeCases), "edge" },
};
enum GradCaseType { // these must match the order in gGradCases
@@ -364,7 +364,7 @@ private:
const GradMaker* gradMaker = gGradCases[fGradCaseType].fMaker;
const int count = gGradCases[fGradCaseType].fCount;
- for (size_t i = 0; i < SK_ARRAY_COUNT(gGradData); i++) {
+ for (size_t i = 0; i < std::size(gGradData); i++) {
canvas->save();
for (int j = 0; j < count; j++) {
SkMatrix scale = SkMatrix::I();
diff --git a/chromium/third_party/skia/gm/gradients_degenerate.cpp b/chromium/third_party/skia/gm/gradients_degenerate.cpp
index 2b8306c5fbf..93d53a2d90d 100644
--- a/chromium/third_party/skia/gm/gradients_degenerate.cpp
+++ b/chromium/third_party/skia/gm/gradients_degenerate.cpp
@@ -28,14 +28,14 @@
static const SkColor COLORS[] = { SK_ColorRED, SK_ColorWHITE, SK_ColorBLUE,
SK_ColorBLACK, SK_ColorGREEN };
static const SkScalar POS[] = { 0.0, 0.0, 0.5, 1.0, 1.0 };
-static const int COLOR_CT = SK_ARRAY_COUNT(COLORS);
+static const int COLOR_CT = std::size(COLORS);
static const SkTileMode TILE_MODES[] = { SkTileMode::kDecal,
SkTileMode::kRepeat,
SkTileMode::kMirror,
SkTileMode::kClamp };
static const char* TILE_NAMES[] = { "decal", "repeat", "mirror", "clamp" };
-static const int TILE_MODE_CT = SK_ARRAY_COUNT(TILE_MODES);
+static const int TILE_MODE_CT = std::size(TILE_MODES);
static constexpr int TILE_SIZE = 100;
static constexpr int TILE_GAP = 10;
diff --git a/chromium/third_party/skia/gm/gradients_no_texture.cpp b/chromium/third_party/skia/gm/gradients_no_texture.cpp
index 93987c83834..8ec01f4ddde 100644
--- a/chromium/third_party/skia/gm/gradients_no_texture.cpp
+++ b/chromium/third_party/skia/gm/gradients_no_texture.cpp
@@ -117,10 +117,10 @@ protected:
canvas->translate(SkIntToScalar(20), SkIntToScalar(20));
constexpr uint8_t kAlphas[] = { 0xff, 0x40 };
- for (size_t a = 0; a < SK_ARRAY_COUNT(kAlphas); ++a) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(gGradData); ++i) {
+ for (size_t a = 0; a < std::size(kAlphas); ++a) {
+ for (size_t i = 0; i < std::size(gGradData); ++i) {
canvas->save();
- for (size_t j = 0; j < SK_ARRAY_COUNT(gGradMakers); ++j) {
+ for (size_t j = 0; j < std::size(gGradMakers); ++j) {
paint.setShader(gGradMakers[j](kPts, gGradData[i], kTM));
paint.setAlpha(kAlphas[a]);
canvas->drawRect(kRect, paint);
@@ -185,7 +185,7 @@ height: 30px;
71.89166004442, 74.45795382765857, 76.45795382765857, 82.78364610713776,
84.78364610713776, 94.52743647737229, 96.52743647737229, 96.03934633331295,
};
- const int N = SK_ARRAY_COUNT(percent);
+ const int N = std::size(percent);
SkScalar pos[N];
for (int i = 0; i < N; ++i) {
pos[i] = SkDoubleToScalar(percent[i] / 100);
@@ -199,7 +199,7 @@ static void make1(ColorPos* rec) {
SK_ColorBLACK, SK_ColorWHITE, SK_ColorBLACK, SK_ColorWHITE,
SK_ColorBLACK,
};
- rec->construct(colors, nullptr, SK_ARRAY_COUNT(colors));
+ rec->construct(colors, nullptr, std::size(colors));
}
static void make2(ColorPos* rec) {
@@ -208,7 +208,7 @@ static void make2(ColorPos* rec) {
SK_ColorBLACK, SK_ColorWHITE, SK_ColorBLACK, SK_ColorWHITE,
SK_ColorBLACK,
};
- const int N = SK_ARRAY_COUNT(colors);
+ const int N = std::size(colors);
SkScalar pos[N];
for (int i = 0; i < N; ++i) {
pos[i] = SK_Scalar1 * i / (N - 1);
@@ -223,7 +223,7 @@ static void make3(ColorPos* rec) {
const SkScalar pos[] = {
0, 0, 0.5f, 0.5, 1, 1,
};
- rec->construct(colors, pos, SK_ARRAY_COUNT(colors));
+ rec->construct(colors, pos, std::size(colors));
}
class GradientsManyColorsGM : public GM {
@@ -266,7 +266,7 @@ protected:
// expand the drawing rect so we exercise clampping in the gradients
const SkRect drawR = r.makeOutset(20, 0);
- for (size_t i = 0; i < SK_ARRAY_COUNT(procs); ++i) {
+ for (size_t i = 0; i < std::size(procs); ++i) {
ColorPos rec;
procs[i](&rec);
paint.setShader(SkGradientShader::MakeLinear(pts, rec.fColors, rec.fPos, rec.fCount,
diff --git a/chromium/third_party/skia/gm/gradtext.cpp b/chromium/third_party/skia/gm/gradtext.cpp
index db4116f4d00..6d3164883fb 100644
--- a/chromium/third_party/skia/gm/gradtext.cpp
+++ b/chromium/third_party/skia/gm/gradtext.cpp
@@ -29,7 +29,7 @@ namespace {
static sk_sp<SkShader> make_grad(SkScalar width) {
SkColor colors[] = { SK_ColorRED, 0x0000FF00, SK_ColorBLUE };
SkPoint pts[] = { { 0, 0 }, { width, 0 } };
- return SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
+ return SkGradientShader::MakeLinear(pts, colors, nullptr, std::size(colors),
SkTileMode::kMirror);
}
@@ -37,7 +37,7 @@ static sk_sp<SkShader> make_grad(SkScalar width) {
static sk_sp<SkShader> make_grad2(SkScalar width) {
SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE };
SkPoint pts[] = { { 0, 0 }, { width, 0 } };
- return SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
+ return SkGradientShader::MakeLinear(pts, colors, nullptr, std::size(colors),
SkTileMode::kMirror);
}
diff --git a/chromium/third_party/skia/gm/graphitestart.cpp b/chromium/third_party/skia/gm/graphitestart.cpp
index 26feeca6923..faa9491b7ae 100644
--- a/chromium/third_party/skia/gm/graphitestart.cpp
+++ b/chromium/third_party/skia/gm/graphitestart.cpp
@@ -8,23 +8,27 @@
#include "gm/gm.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
+#include "include/core/SkColorFilter.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkImage.h"
#include "include/core/SkPaint.h"
#include "include/core/SkRRect.h"
+#include "include/effects/SkColorMatrixFilter.h"
#include "include/effects/SkGradientShader.h"
+#include "include/effects/SkTableColorFilter.h"
#include "include/gpu/GrRecordingContext.h"
+#include "src/core/SkColorFilterPriv.h"
#include "tools/Resources.h"
#include "tools/ToolUtils.h"
namespace {
-sk_sp<SkShader> create_gradient_shader(SkRect r) {
+sk_sp<SkShader> create_gradient_shader(SkRect r,
+ const std::array<SkColor, 3>& colors,
+ const std::array<float, 3>& offsets) {
SkPoint pts[2] = { {r.fLeft, r.fTop}, {r.fRight, r.fTop} };
- SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE };
- float offsets[] = { 0.0f, 0.75f, 1.0f };
- return SkGradientShader::MakeLinear(pts, colors, offsets, SK_ARRAY_COUNT(colors),
+ return SkGradientShader::MakeLinear(pts, colors.data(), offsets.data(), std::size(colors),
SkTileMode::kClamp);
}
@@ -72,7 +76,7 @@ sk_sp<SkShader> create_blend_shader(SkCanvas* destCanvas, SkBlendMode bm) {
SkTileMode::kRepeat, SkTileMode::kRepeat));
}
-void draw_image_shader_tile(SkCanvas* canvas) {
+void draw_image_shader_tile(SkCanvas* canvas, SkRect clipRect) {
SkPaint p;
p.setShader(create_image_shader(canvas, SkTileMode::kClamp, SkTileMode::kRepeat));
@@ -85,6 +89,7 @@ void draw_image_shader_tile(SkCanvas* canvas) {
path.close();
canvas->save();
+ canvas->clipRect(clipRect);
canvas->scale(0.5f, 0.5f);
canvas->drawPath(path, p);
@@ -96,12 +101,15 @@ void draw_image_shader_tile(SkCanvas* canvas) {
canvas->restore();
}
-void draw_gradient_tile(SkCanvas* canvas) {
+void draw_gradient_tile(SkCanvas* canvas, SkRect clipRect) {
SkRect r{1, 1, 127, 127};
SkPaint p;
- p.setShader(create_gradient_shader(r));
+ p.setShader(create_gradient_shader(r,
+ { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE },
+ { 0.0f, 0.75f, 1.0f }));
canvas->save();
+ canvas->clipRect(clipRect);
canvas->translate(128, 0);
canvas->scale(0.5f, 0.5f);
canvas->drawRect(r, p);
@@ -114,6 +122,77 @@ void draw_gradient_tile(SkCanvas* canvas) {
canvas->restore();
}
+void draw_colorfilter_swatches(SkCanvas* canvas, SkRect clipRect) {
+ static constexpr int kNumTilesPerSide = 3;
+
+ SkSize tileSize = { clipRect.width() / kNumTilesPerSide, clipRect.height() / kNumTilesPerSide };
+
+ // Quantize to four colors
+ uint8_t table1[256];
+ for (int i = 0; i < 256; ++i) {
+ table1[i] = (i/64) * 85;
+ }
+
+ // table2 is a band-pass filter for 85-170.
+ // table3 re-expands that range to 0..255
+ uint8_t table2[256], table3[256];
+ for (int i = 0; i < 256; ++i) {
+ if (i >= 85 && i <= 170) {
+ table2[i] = i;
+ table3[i] = ((i - 85) / 85.0f) * 255.0f;
+ } else {
+ table2[i] = 0;
+ table3[i] = 0;
+ }
+ }
+
+ constexpr SkColor SK_ColorGREY = SkColorSetARGB(0xFF, 0x80, 0x80, 0x80);
+
+ sk_sp<SkColorFilter> colorFilters[kNumTilesPerSide*kNumTilesPerSide];
+ static const std::array<SkColor, 3> kGradientColors[kNumTilesPerSide*kNumTilesPerSide] = {
+ { SK_ColorBLACK, SK_ColorGREY, SK_ColorWHITE },
+ { SK_ColorBLACK, SK_ColorGREY, SK_ColorWHITE },
+ { SK_ColorBLACK, SK_ColorGREY, SK_ColorWHITE },
+ { SK_ColorBLACK, SK_ColorGREY, SK_ColorWHITE },
+ { 0x00000000, 0x80000000, 0xFF000000 }, // the Gaussian CF uses alpha only
+ { SK_ColorBLACK, SK_ColorGREY, SK_ColorWHITE },
+ { SK_ColorBLACK, SK_ColorGREY, SK_ColorWHITE },
+ { SK_ColorBLACK, SK_ColorGREY, SK_ColorWHITE },
+ { SK_ColorBLACK, SK_ColorGREY, SK_ColorWHITE },
+ };
+
+ colorFilters[0] = SkColorMatrixFilter::MakeLightingFilter(SK_ColorLTGRAY, 0xFF440000);
+ colorFilters[1] = SkTableColorFilter::Make(table1);
+ colorFilters[2] = SkColorFilters::Compose(SkTableColorFilter::MakeARGB(nullptr, table3,
+ table3, table3),
+ SkTableColorFilter::MakeARGB(nullptr, table2,
+ table2, table2));
+ colorFilters[3] = SkColorFilters::Blend(SK_ColorGREEN, SkBlendMode::kMultiply);
+ colorFilters[4] = SkColorFilterPriv::MakeGaussian();
+
+ SkPaint p;
+
+ canvas->save();
+ canvas->clipRect(clipRect);
+ canvas->translate(clipRect.fLeft, clipRect.fTop);
+
+ for (int y = 0; y < kNumTilesPerSide; ++y) {
+ for (int x = 0; x < kNumTilesPerSide; ++x) {
+ SkRect r = SkRect::MakeXYWH(x * tileSize.width(), y * tileSize.height(),
+ tileSize.width(), tileSize.height()).makeInset(1.0f,
+ 1.0f);
+ int colorFilterIndex = x*kNumTilesPerSide+y;
+ p.setShader(create_gradient_shader(r,
+ kGradientColors[colorFilterIndex],
+ { 0.0f, 0.5f, 1.0f }));
+ p.setColorFilter(colorFilters[colorFilterIndex]);
+ canvas->drawRect(r, p);
+ }
+ }
+
+ canvas->restore();
+}
+
void draw_blend_mode_swatches(SkCanvas* canvas, SkRect clipRect) {
static const int kTileHeight = 16;
static const int kTileWidth = 16;
@@ -166,8 +245,11 @@ public:
}
protected:
- static const int kWidth = 256;
- static const int kHeight = 384;
+ static constexpr int kTileWidth = 128;
+ static constexpr int kTileHeight = 128;
+ static constexpr int kWidth = 3 * kTileWidth;
+ static constexpr int kHeight = 3 * kTileHeight;
+ static constexpr int kClipInset = 16;
SkString onShortName() override {
return SkString("graphitestart");
@@ -179,37 +261,60 @@ protected:
void onDraw(SkCanvas* canvas) override {
+ const SkRect clipRect = SkRect::MakeWH(kWidth, kHeight).makeInset(kClipInset, kClipInset);
+
canvas->save();
- canvas->clipRRect(SkRRect::MakeRectXY({16.f, 16.f, 240.f, 366.f}, 32.f, 32.f), true);
+ canvas->clipRRect(SkRRect::MakeRectXY(clipRect, 32.f, 32.f), true);
- // UL corner
- draw_image_shader_tile(canvas);
+ // Upper-left corner
+ draw_image_shader_tile(canvas, SkRect::MakeXYWH(0, 0, kTileWidth, kTileHeight));
- // UR corner
- draw_gradient_tile(canvas);
+ // Upper-middle tile
+ draw_gradient_tile(canvas, SkRect::MakeXYWH(kTileWidth, 0, kTileWidth, kTileHeight));
- // LL corner
+ // Upper-right corner
+ draw_colorfilter_swatches(canvas, SkRect::MakeXYWH(2*kTileWidth, 0,
+ kTileWidth, kTileWidth));
+
+ // Middle-left tile
{
SkPaint p;
p.setColor(SK_ColorRED);
- canvas->drawRect({2, 129, 127, 255}, p);
+
+ SkRect r = SkRect::MakeXYWH(0, kTileHeight, kTileWidth, kTileHeight);
+ canvas->drawRect(r.makeInset(1.0f, 1.0f), p);
}
- // LR corner
+ // Middle-middle tile
{
SkPaint p;
p.setShader(create_blend_shader(canvas, SkBlendMode::kModulate));
- canvas->drawRect({129, 129, 255, 255}, p);
+
+ SkRect r = SkRect::MakeXYWH(kTileWidth, kTileHeight, kTileWidth, kTileHeight);
+ canvas->drawRect(r.makeInset(1.0f, 1.0f), p);
+ }
+
+ // Middle-right tile
+ {
+ // <add tile here>
}
canvas->restore();
+ // Bottom-left corner
#ifdef SK_GRAPHITE_ENABLED
// TODO: failing serialize test on Linux, not sure what's going on
- canvas->writePixels(fBitmap, 0, 256);
+ canvas->writePixels(fBitmap, 0, 2*kTileHeight);
#endif
- draw_blend_mode_swatches(canvas, SkRect::MakeXYWH(128, 256, 128, 128));
+ // Bottom-middle tile
+ draw_blend_mode_swatches(canvas, SkRect::MakeXYWH(kTileWidth, 2*kTileHeight,
+ kTileWidth, kTileHeight));
+
+ // Bottom-right corner
+ {
+ // <add tile here>
+ }
}
private:
diff --git a/chromium/third_party/skia/gm/hairlines.cpp b/chromium/third_party/skia/gm/hairlines.cpp
index f91482e0cc9..ca59c678bee 100644
--- a/chromium/third_party/skia/gm/hairlines.cpp
+++ b/chromium/third_party/skia/gm/hairlines.cpp
@@ -154,9 +154,9 @@ protected:
SkScalar x = SkIntToScalar(kMargin);
for (int p = 0; p < fPaths.count(); ++p) {
- for (size_t a = 0; a < SK_ARRAY_COUNT(kAlphaValue); ++a) {
+ for (size_t a = 0; a < std::size(kAlphaValue); ++a) {
for (int aa = 0; aa < 2; ++aa) {
- for (size_t w = 0; w < SK_ARRAY_COUNT(kWidths); w++) {
+ for (size_t w = 0; w < std::size(kWidths); w++) {
const SkRect& bounds = fPaths[p].getBounds();
if (x + bounds.width() > wrapX) {
diff --git a/chromium/third_party/skia/gm/hairmodes.cpp b/chromium/third_party/skia/gm/hairmodes.cpp
index 3aac8a9328d..35d972e583f 100644
--- a/chromium/third_party/skia/gm/hairmodes.cpp
+++ b/chromium/third_party/skia/gm/hairmodes.cpp
@@ -103,7 +103,7 @@ namespace skiagm {
for (int alpha = 0; alpha < 4; ++alpha) {
canvas->save();
canvas->save();
- for (size_t i = 0; i < SK_ARRAY_COUNT(gModes); ++i) {
+ for (size_t i = 0; i < std::size(gModes); ++i) {
if (6 == i) {
canvas->restore();
canvas->translate(W * 5, 0);
diff --git a/chromium/third_party/skia/gm/highcontrastfilter.cpp b/chromium/third_party/skia/gm/highcontrastfilter.cpp
index a9c237d7b35..74c2a6a0924 100644
--- a/chromium/third_party/skia/gm/highcontrastfilter.cpp
+++ b/chromium/third_party/skia/gm/highcontrastfilter.cpp
@@ -90,14 +90,14 @@ static void draw_scene(SkCanvas* canvas, const SkHighContrastConfig& config) {
SkScalar pos[] = { 0.2f, 0.8f };
paint.setShader(SkGradientShader::MakeLinear(
pts, colors, pos,
- SK_ARRAY_COUNT(colors), SkTileMode::kClamp));
+ std::size(colors), SkTileMode::kClamp));
canvas->drawRect(bounds, paint);
bounds = SkRect::MakeLTRB(0.1f, 0.6f, 0.9f, 0.8f);
SkColor colors2[] = { SK_ColorGREEN, SK_ColorWHITE };
paint.setShader(SkGradientShader::MakeLinear(
pts, colors2, pos,
- SK_ARRAY_COUNT(colors2), SkTileMode::kClamp));
+ std::size(colors2), SkTileMode::kClamp));
canvas->drawRect(bounds, paint);
canvas->restore();
@@ -115,10 +115,10 @@ protected:
SkHighContrastConfig fConfig;
fFilter = SkHighContrastFilter::Make(fConfig);
fGr1 = SkGradientShader::MakeLinear(
- g1Points, g1Colors, pos, SK_ARRAY_COUNT(g1Colors),
+ g1Points, g1Colors, pos, std::size(g1Colors),
SkTileMode::kClamp);
fGr2 = SkGradientShader::MakeLinear(
- g2Points, g2Colors, pos, SK_ARRAY_COUNT(g2Colors),
+ g2Points, g2Colors, pos, std::size(g2Colors),
SkTileMode::kClamp);
}
@@ -142,7 +142,7 @@ protected:
{ true, InvertStyle::kInvertLightness, 0.2f },
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(configs); ++i) {
+ for (size_t i = 0; i < std::size(configs); ++i) {
SkScalar x = kSize * (i % 4);
SkScalar y = kSize * (i / 4);
canvas->save();
diff --git a/chromium/third_party/skia/gm/hittestpath.cpp b/chromium/third_party/skia/gm/hittestpath.cpp
index 34d45eb725a..87f5a09b393 100644
--- a/chromium/third_party/skia/gm/hittestpath.cpp
+++ b/chromium/third_party/skia/gm/hittestpath.cpp
@@ -49,7 +49,7 @@ DEF_SIMPLE_GM_CAN_FAIL(hittestpath, canvas, errorMsg, 700, 460) {
for (int i = 0; i < 4; ++i) {
// get the random values deterministically
SkScalar randoms[12];
- for (int index = 0; index < (int) SK_ARRAY_COUNT(randoms); ++index) {
+ for (int index = 0; index < (int) std::size(randoms); ++index) {
randoms[index] = rand.nextUScalar1();
}
b.lineTo(randoms[0] * scale, randoms[1] * scale)
diff --git a/chromium/third_party/skia/gm/hsl.cpp b/chromium/third_party/skia/gm/hsl.cpp
index 7bd52ca8049..71681389a58 100644
--- a/chromium/third_party/skia/gm/hsl.cpp
+++ b/chromium/third_party/skia/gm/hsl.cpp
@@ -203,7 +203,7 @@ static sk_sp<SkShader> make_grad(SkScalar width) {
};
SkPoint pts[] = {{0, 0}, {width, 0}};
- return SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
+ return SkGradientShader::MakeLinear(pts, colors, nullptr, std::size(colors),
SkTileMode::kClamp);
}
diff --git a/chromium/third_party/skia/gm/image_pict.cpp b/chromium/third_party/skia/gm/image_pict.cpp
index 603d34b2461..34f006fcf9f 100644
--- a/chromium/third_party/skia/gm/image_pict.cpp
+++ b/chromium/third_party/skia/gm/image_pict.cpp
@@ -197,9 +197,13 @@ protected:
auto budgeted = policy == GrImageTexGenPolicy::kNew_Uncached_Unbudgeted ? SkBudgeted::kNo
: SkBudgeted::kYes;
return GrSurfaceProxyView::Copy(
- fRContext.get(), fView, mipmapped,
+ fRContext.get(),
+ fView,
+ mipmapped,
SkIRect::MakeXYWH(origin.x(), origin.y(), info.width(), info.height()),
- SkBackingFit::kExact, budgeted);
+ SkBackingFit::kExact,
+ budgeted,
+ /*label=*/"SurfaceProxyView_GenerateTexture");
}
private:
diff --git a/chromium/third_party/skia/gm/image_shader.cpp b/chromium/third_party/skia/gm/image_shader.cpp
index e614bf21bd4..294fbc2b1b9 100644
--- a/chromium/third_party/skia/gm/image_shader.cpp
+++ b/chromium/third_party/skia/gm/image_shader.cpp
@@ -141,7 +141,7 @@ protected:
const SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100);
- for (size_t i = 0; i < SK_ARRAY_COUNT(gProcs); ++i) {
+ for (size_t i = 0; i < std::size(gProcs); ++i) {
sk_sp<SkImage> image(gProcs[i](canvas->recordingContext(), fPicture.get(), info));
if (image) {
this->testImage(canvas, image.get());
diff --git a/chromium/third_party/skia/gm/imageblur2.cpp b/chromium/third_party/skia/gm/imageblur2.cpp
index eba756c9e0a..a9f05789f10 100644
--- a/chromium/third_party/skia/gm/imageblur2.cpp
+++ b/chromium/third_party/skia/gm/imageblur2.cpp
@@ -32,8 +32,8 @@ DEF_SIMPLE_GM(imageblur2, canvas, kWidth, kHeight) {
"dog.{}!%^&",
"*()+=-\\'\"/",
};
- constexpr int sigmaCount = SK_ARRAY_COUNT(kBlurSigmas);
- constexpr int testStringCount = SK_ARRAY_COUNT(kTestStrings);
+ constexpr int sigmaCount = std::size(kBlurSigmas);
+ constexpr int testStringCount = std::size(kTestStrings);
constexpr SkScalar dx = kWidth / sigmaCount;
constexpr SkScalar dy = kHeight / sigmaCount;
constexpr SkScalar textSize = 12;
diff --git a/chromium/third_party/skia/gm/imageblurtiled.cpp b/chromium/third_party/skia/gm/imageblurtiled.cpp
index 3b4252a4247..e7bd15a9c21 100644
--- a/chromium/third_party/skia/gm/imageblurtiled.cpp
+++ b/chromium/third_party/skia/gm/imageblurtiled.cpp
@@ -57,7 +57,7 @@ protected:
};
SkFont font(ToolUtils::create_portable_typeface(), 100);
int posY = 0;
- for (unsigned i = 0; i < SK_ARRAY_COUNT(str); i++) {
+ for (unsigned i = 0; i < std::size(str); i++) {
posY += 100;
canvas->drawString(str[i], 0, SkIntToScalar(posY), font, SkPaint());
}
diff --git a/chromium/third_party/skia/gm/imagefilters.cpp b/chromium/third_party/skia/gm/imagefilters.cpp
index 82e7fd1754f..ae25b1188b5 100644
--- a/chromium/third_party/skia/gm/imagefilters.cpp
+++ b/chromium/third_party/skia/gm/imagefilters.cpp
@@ -77,7 +77,7 @@ DEF_SIMPLE_GM(imagefilters_xfermodes, canvas, 480, 480) {
SkBlendMode::kSrcATop, SkBlendMode::kDstIn
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(modes); ++i) {
+ for (size_t i = 0; i < std::size(modes); ++i) {
canvas->save();
do_draw(canvas, modes[i], nullptr);
canvas->translate(240, 0);
@@ -186,7 +186,7 @@ protected:
canvas->translate(xform.fTx, xform.fTy);
canvas->scale(xform.fSx, xform.fSy);
canvas->drawImage(image, 0, 0, sampling, nullptr);
- draw_set(canvas, filters, SK_ARRAY_COUNT(filters));
+ draw_set(canvas, filters, std::size(filters));
canvas->restore();
}
}
diff --git a/chromium/third_party/skia/gm/imagefiltersbase.cpp b/chromium/third_party/skia/gm/imagefiltersbase.cpp
index ab75a2594e4..dd60eb6255f 100644
--- a/chromium/third_party/skia/gm/imagefiltersbase.cpp
+++ b/chromium/third_party/skia/gm/imagefiltersbase.cpp
@@ -245,9 +245,9 @@ protected:
SkScalar DY = r.height() + MARGIN;
canvas->translate(MARGIN, MARGIN);
- for (size_t i = 0; i < SK_ARRAY_COUNT(drawProc); ++i) {
+ for (size_t i = 0; i < std::size(drawProc); ++i) {
canvas->save();
- for (size_t j = 0; j < SK_ARRAY_COUNT(filters); ++j) {
+ for (size_t j = 0; j < std::size(filters); ++j) {
drawProc[i](canvas, fAtlas.get(), r, filters[j]);
draw_frame(canvas, r);
diff --git a/chromium/third_party/skia/gm/imagefiltersclipped.cpp b/chromium/third_party/skia/gm/imagefiltersclipped.cpp
index ea0b95d1c6d..08ed6964e3f 100644
--- a/chromium/third_party/skia/gm/imagefiltersclipped.cpp
+++ b/chromium/third_party/skia/gm/imagefiltersclipped.cpp
@@ -125,7 +125,7 @@ protected:
for (int xOffset = 0; xOffset < 80; xOffset += 16) {
canvas->save();
bounds.fLeft = SkIntToScalar(xOffset);
- for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) {
+ for (size_t i = 0; i < std::size(filters); ++i) {
draw_clipped_filter(canvas, filters[i], i, r, bounds);
canvas->translate(r.width() + margin, 0);
}
@@ -136,7 +136,7 @@ protected:
sk_sp<SkImageFilter> rectFilter(SkImageFilters::Shader(
SkPerlinNoiseShader::MakeFractalNoise(0.1f, 0.05f, 1, 0)));
- canvas->translate(SK_ARRAY_COUNT(filters)*(r.width() + margin), 0);
+ canvas->translate(std::size(filters)*(r.width() + margin), 0);
for (int xOffset = 0; xOffset < 80; xOffset += 16) {
bounds.fLeft = SkIntToScalar(xOffset);
draw_clipped_filter(canvas, rectFilter, 0, r, bounds);
diff --git a/chromium/third_party/skia/gm/imagefilterscropped.cpp b/chromium/third_party/skia/gm/imagefilterscropped.cpp
index 99f83a316c5..b9eb7ff0277 100644
--- a/chromium/third_party/skia/gm/imagefilterscropped.cpp
+++ b/chromium/third_party/skia/gm/imagefilterscropped.cpp
@@ -154,9 +154,9 @@ protected:
SkScalar DY = r.height() + MARGIN;
canvas->translate(MARGIN, MARGIN);
- for (size_t j = 0; j < SK_ARRAY_COUNT(drawProc); ++j) {
+ for (size_t j = 0; j < std::size(drawProc); ++j) {
canvas->save();
- for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) {
+ for (size_t i = 0; i < std::size(filters); ++i) {
SkPaint paint;
canvas->drawImage(fCheckerboard, 0, 0);
drawProc[j](canvas, r, filters[i]);
diff --git a/chromium/third_party/skia/gm/imagefiltersscaled.cpp b/chromium/third_party/skia/gm/imagefiltersscaled.cpp
index d4c2a3a2005..e2df5065de6 100644
--- a/chromium/third_party/skia/gm/imagefiltersscaled.cpp
+++ b/chromium/third_party/skia/gm/imagefiltersscaled.cpp
@@ -123,9 +123,9 @@ protected:
SkRect bounds = r;
bounds.outset(margin, margin);
- for (size_t j = 0; j < SK_ARRAY_COUNT(scales); ++j) {
+ for (size_t j = 0; j < std::size(scales); ++j) {
canvas->save();
- for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) {
+ for (size_t i = 0; i < std::size(filters); ++i) {
SkPaint paint;
paint.setColor(SK_ColorBLUE);
paint.setImageFilter(filters[i]);
diff --git a/chromium/third_party/skia/gm/imagefiltersstroked.cpp b/chromium/third_party/skia/gm/imagefiltersstroked.cpp
index 44c8ef907e7..07c77afc24f 100644
--- a/chromium/third_party/skia/gm/imagefiltersstroked.cpp
+++ b/chromium/third_party/skia/gm/imagefiltersstroked.cpp
@@ -78,10 +78,10 @@ protected:
paint.setStrokeWidth(10);
paint.setStyle(SkPaint::kStroke_Style);
- for (size_t i = 0; i < SK_ARRAY_COUNT(drawProc); ++i) {
+ for (size_t i = 0; i < std::size(drawProc); ++i) {
canvas->translate(0, margin);
canvas->save();
- for (size_t j = 0; j < SK_ARRAY_COUNT(filters); ++j) {
+ for (size_t j = 0; j < std::size(filters); ++j) {
canvas->translate(margin, 0);
canvas->save();
if (2 == j) {
diff --git a/chromium/third_party/skia/gm/imagefilterstransformed.cpp b/chromium/third_party/skia/gm/imagefilterstransformed.cpp
index 951e1b753c9..ed1f86a3cfb 100644
--- a/chromium/third_party/skia/gm/imagefilterstransformed.cpp
+++ b/chromium/third_party/skia/gm/imagefilterstransformed.cpp
@@ -93,7 +93,7 @@ protected:
for (size_t j = 0; j < 3; j++) {
canvas->save();
canvas->translate(margin, 0);
- for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) {
+ for (size_t i = 0; i < std::size(filters); ++i) {
SkPaint paint;
paint.setColor(SK_ColorWHITE);
paint.setImageFilter(filters[i]);
diff --git a/chromium/third_party/skia/gm/imagemakewithfilter.cpp b/chromium/third_party/skia/gm/imagemakewithfilter.cpp
index 25891a97a07..9c8cd0281af 100644
--- a/chromium/third_party/skia/gm/imagemakewithfilter.cpp
+++ b/chromium/third_party/skia/gm/imagemakewithfilter.cpp
@@ -45,7 +45,7 @@ static void show_bounds(SkCanvas* canvas, const SkIRect* clip, const SkIRect* in
SkPaint paint;
paint.setStyle(SkPaint::kStroke_Style);
- for (size_t i = 0; i < SK_ARRAY_COUNT(rects); ++i) {
+ for (size_t i = 0; i < std::size(rects); ++i) {
// Skip null bounds rects, since not all methods have subsets
if (rects[i]) {
paint.setColor(colors[i]);
@@ -257,7 +257,7 @@ protected:
"Lighting",
"Tile"
};
- static_assert(SK_ARRAY_COUNT(filters) == SK_ARRAY_COUNT(filterNames), "filter name length");
+ static_assert(std::size(filters) == std::size(filterNames), "filter name length");
SkIRect clipBounds[] {
{ -20, -20, 100, 100 },
@@ -300,7 +300,7 @@ protected:
SkPaint textPaint;
textPaint.setAntiAlias(true);
SkFont font(nullptr, 12);
- for (size_t i = 0; i < SK_ARRAY_COUNT(filterNames); ++i) {
+ for (size_t i = 0; i < std::size(filterNames); ++i) {
canvas->drawString(filterNames[i], DX * i + MARGIN, 15, font, textPaint);
}
@@ -308,7 +308,7 @@ protected:
for (auto clipBound : clipBounds) {
canvas->save();
- for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) {
+ for (size_t i = 0; i < std::size(filters); ++i) {
SkIRect subset = SkIRect::MakeXYWH(25, 25, 50, 50);
SkIRect outSubset;
diff --git a/chromium/third_party/skia/gm/imagemasksubset.cpp b/chromium/third_party/skia/gm/imagemasksubset.cpp
index c93b9bc1770..7de26400cb8 100644
--- a/chromium/third_party/skia/gm/imagemasksubset.cpp
+++ b/chromium/third_party/skia/gm/imagemasksubset.cpp
@@ -79,7 +79,7 @@ DEF_SIMPLE_GM(imagemasksubset, canvas, 480, 480) {
const SkImageInfo info = SkImageInfo::MakeA8(kSize.width(), kSize.height());
- for (size_t i = 0; i < SK_ARRAY_COUNT(makers); ++i) {
+ for (size_t i = 0; i < std::size(makers); ++i) {
sk_sp<SkImage> image = ToolUtils::MakeTextureImage(canvas, makers[i](canvas, info));
if (image) {
canvas->drawImageRect(image, SkRect::Make(kSubset), kDest, SkSamplingOptions(),
diff --git a/chromium/third_party/skia/gm/imageresizetiled.cpp b/chromium/third_party/skia/gm/imageresizetiled.cpp
index 94ad4dfe42e..f41ea531154 100644
--- a/chromium/third_party/skia/gm/imageresizetiled.cpp
+++ b/chromium/third_party/skia/gm/imageresizetiled.cpp
@@ -47,7 +47,7 @@ DEF_SIMPLE_GM(imageresizetiled, canvas, WIDTH, HEIGHT) {
"the lazy dog.",
};
float posY = 0;
- for (unsigned i = 0; i < SK_ARRAY_COUNT(str); i++) {
+ for (unsigned i = 0; i < std::size(str); i++) {
posY += 100.0f;
canvas->drawString(str[i], 0.0f, posY, font, SkPaint());
}
diff --git a/chromium/third_party/skia/gm/imagescalealigned.cpp b/chromium/third_party/skia/gm/imagescalealigned.cpp
index 12020deef80..d48dd7a84dc 100644
--- a/chromium/third_party/skia/gm/imagescalealigned.cpp
+++ b/chromium/third_party/skia/gm/imagescalealigned.cpp
@@ -25,7 +25,7 @@ protected:
void onOnceBeforeDraw() override {
const SkVector vectors[] = { { 1, 0 }, { 0, 1 } };
- for (size_t i = 0; i < SK_ARRAY_COUNT(vectors); ++i) {
+ for (size_t i = 0; i < std::size(vectors); ++i) {
auto& set = fSets.push_back();
set.fVector = vectors[i];
@@ -62,7 +62,7 @@ protected:
{{ 550.5f, 750.5f }, { -1, -1 }},
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(cfgs); ++i) {
+ for (size_t i = 0; i < std::size(cfgs); ++i) {
SkAutoCanvasRestore acr(canvas, true);
canvas->translate(cfgs[i].offset.x(), cfgs[i].offset.y());
canvas->scale(cfgs[i].scale.x(), cfgs[i].scale.y());
@@ -118,16 +118,16 @@ private:
for (int i = 0; i < fSets.count(); ++i) {
auto& set = fSets[i];
SkPoint lastPt;
- for (size_t j = 0; j < SK_ARRAY_COUNT(AAs); ++j) {
+ for (size_t j = 0; j < std::size(AAs); ++j) {
paint.setAntiAlias(AAs[j]);
- for (size_t k = 0; k < SK_ARRAY_COUNT(samplings); ++k) {
+ for (size_t k = 0; k < std::size(samplings); ++k) {
lastPt = drawSet(canvas, set, samplings[k], paint);
canvas->translate((kSegLen + 4) * set.fVector.y(),
(kSegLen + 4) * set.fVector.x());
}
}
canvas->translate(lastPt.x() + kSegLen,
- - SkIntToScalar(kSegLen + 4) * SK_ARRAY_COUNT(samplings) * SK_ARRAY_COUNT(AAs));
+ - SkIntToScalar(kSegLen + 4) * std::size(samplings) * std::size(AAs));
}
}
diff --git a/chromium/third_party/skia/gm/imagesource2.cpp b/chromium/third_party/skia/gm/imagesource2.cpp
index 6f033da675f..550a0fbc084 100644
--- a/chromium/third_party/skia/gm/imagesource2.cpp
+++ b/chromium/third_party/skia/gm/imagesource2.cpp
@@ -64,7 +64,7 @@ protected:
p.setColor(gColors[curColor]);
canvas->drawRect(r, p);
- curColor = (curColor+1) % SK_ARRAY_COUNT(gColors);
+ curColor = (curColor+1) % std::size(gColors);
}
fImage = surface->makeImageSnapshot();
diff --git a/chromium/third_party/skia/gm/inversepaths.cpp b/chromium/third_party/skia/gm/inversepaths.cpp
index b87b612f9b6..6252db08c94 100644
--- a/chromium/third_party/skia/gm/inversepaths.cpp
+++ b/chromium/third_party/skia/gm/inversepaths.cpp
@@ -47,7 +47,7 @@ struct Style {
sk_sp<SkPathEffect> make_dash() {
constexpr SkScalar kIntervals[] = { 4.f, 3.f };
- return SkDashPathEffect::Make(kIntervals, SK_ARRAY_COUNT(kIntervals), 0);
+ return SkDashPathEffect::Make(kIntervals, std::size(kIntervals), 0);
}
Style styles[] {
@@ -96,16 +96,16 @@ DEF_SIMPLE_GM(inverse_paths, canvas, 800, 1200) {
outlinePaint.setStyle(SkPaint::kStroke_Style);
outlinePaint.setStrokeWidth(SkIntToScalar(0));
- for (size_t styleIndex = 0; styleIndex < SK_ARRAY_COUNT(styles);
+ for (size_t styleIndex = 0; styleIndex < std::size(styles);
styleIndex++) {
- for (size_t sizeIndex = 0; sizeIndex < SK_ARRAY_COUNT(pathSizes);
+ for (size_t sizeIndex = 0; sizeIndex < std::size(pathSizes);
sizeIndex++) {
SkScalar size = pathSizes[sizeIndex];
canvas->save();
for (size_t widthIndex = 0;
- widthIndex < SK_ARRAY_COUNT(strokeWidths);
+ widthIndex < std::size(strokeWidths);
widthIndex++) {
SkPaint paint;
paint.setColor(0xff007000);
@@ -114,7 +114,7 @@ DEF_SIMPLE_GM(inverse_paths, canvas, 800, 1200) {
paint.setPathEffect(styles[styleIndex].fPathEffect);
for (size_t pathIndex = 0;
- pathIndex < SK_ARRAY_COUNT(paths);
+ pathIndex < std::size(paths);
pathIndex++) {
canvas->drawRect(clipRect, clipPaint);
diff --git a/chromium/third_party/skia/gm/labyrinth.cpp b/chromium/third_party/skia/gm/labyrinth.cpp
index 9364ed73b67..3bfa43f2a83 100644
--- a/chromium/third_party/skia/gm/labyrinth.cpp
+++ b/chromium/third_party/skia/gm/labyrinth.cpp
@@ -53,16 +53,16 @@ static void draw_labyrinth(SkCanvas* canvas, SkPaint::Cap cap) {
};
SkPathBuilder maze;
- for (size_t y = 0; y < SK_ARRAY_COUNT(kRows); ++y) {
- for (size_t x = 0; x < SK_ARRAY_COUNT(kRows[0]); ++x) {
+ for (size_t y = 0; y < std::size(kRows); ++y) {
+ for (size_t x = 0; x < std::size(kRows[0]); ++x) {
if (kRows[y][x]) {
maze.moveTo(x, y);
maze.lineTo(x+1, y);
}
}
}
- for (size_t x = 0; x < SK_ARRAY_COUNT(kCols); ++x) {
- for (size_t y = 0; y < SK_ARRAY_COUNT(kCols[0]); ++y) {
+ for (size_t x = 0; x < std::size(kCols); ++x) {
+ for (size_t y = 0; y < std::size(kCols[0]); ++y) {
if (kCols[x][y]) {
maze.moveTo(x, y);
maze.lineTo(x, y+1);
diff --git a/chromium/third_party/skia/gm/lazytiling.cpp b/chromium/third_party/skia/gm/lazytiling.cpp
index c32d2d15562..422d665d97e 100644
--- a/chromium/third_party/skia/gm/lazytiling.cpp
+++ b/chromium/third_party/skia/gm/lazytiling.cpp
@@ -20,8 +20,8 @@
#include "src/gpu/ganesh/GrProxyProvider.h"
#include "src/gpu/ganesh/GrResourceProvider.h"
#include "src/gpu/ganesh/SkGr.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/effects/GrTextureEffect.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
#include "tools/gpu/ProxyUtils.h"
static GrSurfaceProxyView create_view(GrDirectContext* dContext,
diff --git a/chromium/third_party/skia/gm/lcdblendmodes.cpp b/chromium/third_party/skia/gm/lcdblendmodes.cpp
index a054e2b2ef2..67d4a60242d 100644
--- a/chromium/third_party/skia/gm/lcdblendmodes.cpp
+++ b/chromium/third_party/skia/gm/lcdblendmodes.cpp
@@ -41,7 +41,7 @@ static sk_sp<SkShader> make_shader(const SkRect& bounds) {
const SkColor colors[] = {
SK_ColorRED, SK_ColorGREEN,
};
- return SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
+ return SkGradientShader::MakeLinear(pts, colors, nullptr, std::size(colors),
SkTileMode::kRepeat);
}
@@ -126,7 +126,7 @@ protected:
backgroundPaint.setColor(backgroundColor);
canvas->drawRect(SkRect::MakeIWH(kColWidth, kHeight), backgroundPaint);
SkScalar y = fTextHeight;
- for (size_t m = 0; m < SK_ARRAY_COUNT(gModes); m++) {
+ for (size_t m = 0; m < std::size(gModes); m++) {
SkPaint paint;
paint.setColor(textColor);
paint.setBlendMode(gModes[m]);
diff --git a/chromium/third_party/skia/gm/lcdoverlap.cpp b/chromium/third_party/skia/gm/lcdoverlap.cpp
index 9cfcbb10312..bcaccfb6fe0 100644
--- a/chromium/third_party/skia/gm/lcdoverlap.cpp
+++ b/chromium/third_party/skia/gm/lcdoverlap.cpp
@@ -63,10 +63,10 @@ protected:
SK_ColorMAGENTA,
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(colors); i++) {
+ for (size_t i = 0; i < std::size(colors); i++) {
canvas->save();
canvas->translate(x, y);
- canvas->rotate(360.0f / SK_ARRAY_COUNT(colors) * i);
+ canvas->rotate(360.0f / std::size(colors) * i);
canvas->translate(-fBlob->bounds().width() / 2.0f - fBlob->bounds().left() + 0.5f, 0);
SkPaint textPaint;
diff --git a/chromium/third_party/skia/gm/lcdtext.cpp b/chromium/third_party/skia/gm/lcdtext.cpp
index 17799422b64..8264a29b781 100644
--- a/chromium/third_party/skia/gm/lcdtext.cpp
+++ b/chromium/third_party/skia/gm/lcdtext.cpp
@@ -91,7 +91,7 @@ class LcdTextSizeGM : public skiagm::GM {
{ { 160, 100 }, kLCDTextSizeLimit / 2, 2.01f, gray_text },
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(rec); ++i) {
+ for (size_t i = 0; i < std::size(rec); ++i) {
const SkPoint loc = rec[i].fLoc;
SkAutoCanvasRestore acr(canvas, true);
diff --git a/chromium/third_party/skia/gm/linepaths.cpp b/chromium/third_party/skia/gm/linepaths.cpp
index c4e6ffd9469..d2f6a40426a 100644
--- a/chromium/third_party/skia/gm/linepaths.cpp
+++ b/chromium/third_party/skia/gm/linepaths.cpp
@@ -97,17 +97,17 @@ static void draw(SkCanvas* canvas, bool doClose) {
canvas->save();
canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1);
canvas->save();
- for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) {
+ for (size_t cap = 0; cap < std::size(gCaps); ++cap) {
if (0 < cap) {
- canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_COUNT(gStyles), 0);
+ canvas->translate((rect.width() + 40 * SK_Scalar1) * std::size(gStyles), 0);
}
canvas->save();
- for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) {
+ for (size_t fill = 0; fill < std::size(gFills); ++fill) {
if (0 < fill) {
canvas->translate(0, rect.height() + 40 * SK_Scalar1);
}
canvas->save();
- for (size_t style = 0; style < SK_ARRAY_COUNT(gStyles); ++style) {
+ for (size_t style = 0; style < std::size(gStyles); ++style) {
if (0 < style) {
canvas->translate(rect.width() + 40 * SK_Scalar1, 0);
}
diff --git a/chromium/third_party/skia/gm/localmatrixshader.cpp b/chromium/third_party/skia/gm/localmatrixshader.cpp
index d3a29e4d48c..3fdc1213e60 100644
--- a/chromium/third_party/skia/gm/localmatrixshader.cpp
+++ b/chromium/third_party/skia/gm/localmatrixshader.cpp
@@ -108,7 +108,7 @@ DEF_SIMPLE_GM(localmatrixshader_nested, canvas, 450, 1200) {
{
SkAutoCanvasRestore acr(canvas, true);
- canvas->translate(0, rect.height() * SK_ARRAY_COUNT(gFactories) * 1.5f);
+ canvas->translate(0, rect.height() * std::size(gFactories) * 1.5f);
drawColumn();
}
diff --git a/chromium/third_party/skia/gm/lumafilter.cpp b/chromium/third_party/skia/gm/lumafilter.cpp
index a409644e3f7..9339311b388 100644
--- a/chromium/third_party/skia/gm/lumafilter.cpp
+++ b/chromium/third_party/skia/gm/lumafilter.cpp
@@ -108,9 +108,9 @@ protected:
SkScalar pos[] = { 0.2f, 1.0f };
fFilter = SkLumaColorFilter::Make();
- fGr1 = SkGradientShader::MakeLinear(g1Points, g1Colors, pos, SK_ARRAY_COUNT(g1Colors),
+ fGr1 = SkGradientShader::MakeLinear(g1Points, g1Colors, pos, std::size(g1Colors),
SkTileMode::kClamp);
- fGr2 = SkGradientShader::MakeLinear(g2Points, g2Colors, pos, SK_ARRAY_COUNT(g2Colors),
+ fGr2 = SkGradientShader::MakeLinear(g2Points, g2Colors, pos, std::size(g2Colors),
SkTileMode::kClamp);
}
@@ -142,15 +142,15 @@ protected:
};
SkScalar gridStep = kSize + 2 * kInset;
- for (size_t i = 0; i < SK_ARRAY_COUNT(modes); ++i) {
+ for (size_t i = 0; i < std::size(modes); ++i) {
draw_label(canvas, SkBlendMode_Name(modes[i]),
SkPoint::Make(gridStep * (0.5f + i), 20));
}
- for (size_t i = 0; i < SK_ARRAY_COUNT(shaders); ++i) {
+ for (size_t i = 0; i < std::size(shaders); ++i) {
canvas->save();
canvas->translate(kInset, gridStep * i + 30);
- for (size_t m = 0; m < SK_ARRAY_COUNT(modes); ++m) {
+ for (size_t m = 0; m < std::size(modes); ++m) {
draw_scene(canvas, fFilter, modes[m], shaders[i].fShader1,
shaders[i].fShader2);
canvas->translate(gridStep, 0);
diff --git a/chromium/third_party/skia/gm/mac_aa_explorer.cpp b/chromium/third_party/skia/gm/mac_aa_explorer.cpp
index d78beb5931d..6071ff868c9 100644
--- a/chromium/third_party/skia/gm/mac_aa_explorer.cpp
+++ b/chromium/third_party/skia/gm/mac_aa_explorer.cpp
@@ -150,7 +150,7 @@ DEF_SIMPLE_GM(macaa_colors, canvas, 800, 500) {
SkFont font;
font.setTypeface(SkTypeface::MakeFromName("Times", SkFontStyle()));
- for (size_t i = 0; i < SK_ARRAY_COUNT(colors); i += 2) {
+ for (size_t i = 0; i < std::size(colors); i += 2) {
canvas->save();
SkPaint paint;
diff --git a/chromium/third_party/skia/gm/mesh.cpp b/chromium/third_party/skia/gm/mesh.cpp
index e23c1f34e4b..f1e184442ae 100644
--- a/chromium/third_party/skia/gm/mesh.cpp
+++ b/chromium/third_party/skia/gm/mesh.cpp
@@ -57,9 +57,9 @@ protected:
}
)";
auto[spec, error] =
- SkMeshSpecification::Make(SkMakeSpan(kAttributes, SK_ARRAY_COUNT(kAttributes)),
+ SkMeshSpecification::Make(kAttributes,
sizeof(ColorVertex),
- SkMakeSpan(kVaryings, SK_ARRAY_COUNT(kVaryings)),
+ kVaryings,
SkString(kVS),
SkString(kFS));
if (!spec) {
@@ -87,9 +87,9 @@ protected:
}
)";
auto[spec, error] =
- SkMeshSpecification::Make(SkMakeSpan(kAttributes, SK_ARRAY_COUNT(kAttributes)),
+ SkMeshSpecification::Make(kAttributes,
sizeof(NoColorVertex),
- SkMakeSpan(kVaryings, SK_ARRAY_COUNT(kVaryings)),
+ kVaryings,
SkString(kVS),
SkString(kFS));
if (!spec) {
@@ -107,15 +107,17 @@ protected:
SkTileMode::kMirror);
}
- DrawResult onGpuSetup(GrDirectContext* context, SkString* string) override {
+ DrawResult onGpuSetup(GrDirectContext* dc, SkString* string) override {
this->ensureBuffers();
- if (!context || context->abandoned()) {
+ if (!dc || dc->abandoned()) {
return DrawResult::kOk;
}
- fColorVB = SkMesh::MakeVertexBuffer(context, CpuVBAsData(fColorVB));
- fColorIndexedVB = SkMesh::MakeVertexBuffer(context, CpuVBAsData(fColorIndexedVB));
- fIB[1] = SkMesh::MakeIndexBuffer (context, CpuIBAsData(fIB[0]));
+ fColorVB = SkMesh::MakeVertexBuffer(dc, CpuVBPeek(fColorVB), fColorVB->size());
+ fColorIndexedVB = SkMesh::MakeVertexBuffer(dc,
+ CpuVBPeek(fColorIndexedVB),
+ fColorIndexedVB->size());
+ fIB[1] = SkMesh::MakeIndexBuffer (dc, CpuIBPeek(fIB[0]), fIB[0]->size());
if (!fColorVB || !fColorIndexedVB || !fIB[1]) {
return DrawResult::kFail;
}
@@ -193,7 +195,7 @@ protected:
paint.setShader(shader ? fShader : nullptr);
paint.setAlpha(alpha);
- SkCanvasPriv::DrawMesh(canvas, mesh, blender, paint);
+ canvas->drawMesh(mesh, blender, paint);
canvas->translate(0, 150);
++i;
@@ -205,23 +207,23 @@ protected:
}
private:
- static sk_sp<const SkData> CpuVBAsData(sk_sp<SkMesh::VertexBuffer> buffer) {
+ static const void* CpuVBPeek(sk_sp<SkMesh::VertexBuffer> buffer) {
auto vb = static_cast<SkMeshPriv::VB*>(buffer.get());
- SkASSERT(vb->asData());
- return vb->asData();
+ SkASSERT(vb->peek());
+ return vb->peek();
}
- static sk_sp<const SkData> CpuIBAsData(sk_sp<SkMesh::IndexBuffer> buffer) {
+ static const void* CpuIBPeek(sk_sp<SkMesh::IndexBuffer> buffer) {
auto ib = static_cast<SkMeshPriv::IB*>(buffer.get());
- SkASSERT(ib->asData());
- return ib->asData();
+ SkASSERT(ib->peek());
+ return ib->peek();
}
void ensureBuffers() {
if (!fColorVB) {
- fColorVB = SkMesh::MakeVertexBuffer(
- /*GrDirectContext*=*/nullptr,
- SkData::MakeWithoutCopy(kColorQuad, sizeof(kColorQuad)));
+ fColorVB = SkMesh::MakeVertexBuffer(/*GrDirectContext*=*/nullptr,
+ kColorQuad,
+ sizeof(kColorQuad));
}
if (!fNoColorVB) {
@@ -230,7 +232,9 @@ private:
std::memcpy(SkTAddOffset<void>(data->writable_data(), kNoColorOffset),
kNoColorQuad,
sizeof(kNoColorQuad));
- fNoColorVB = SkMesh::MakeVertexBuffer(/*GrDirectContext*=*/nullptr, std::move(data));
+ fNoColorVB = SkMesh::MakeVertexBuffer(/*GrDirectContext*=*/nullptr,
+ data->data(),
+ data->size());
}
if (!fColorIndexedVB) {
@@ -240,13 +244,14 @@ private:
kColorIndexedQuad,
sizeof(kColorIndexedQuad));
fColorIndexedVB = SkMesh::MakeVertexBuffer(/*GrDirectContext*=*/nullptr,
- std::move(data));
+ data->data(),
+ data->size());
}
if (!fNoColorIndexedVB) {
- fNoColorIndexedVB = SkMesh::MakeVertexBuffer(
- /*GrDirectContext*=*/nullptr,
- SkData::MakeWithoutCopy(kNoColorIndexedQuad, sizeof(kNoColorIndexedQuad)));
+ fNoColorIndexedVB = SkMesh::MakeVertexBuffer(/*GrDirectContext*=*/nullptr,
+ kNoColorIndexedQuad,
+ sizeof(kNoColorIndexedQuad));
}
if (!fIB[0]) {
@@ -255,7 +260,9 @@ private:
std::memcpy(SkTAddOffset<void>(data->writable_data(), kIndexOffset),
kIndices,
sizeof(kIndices));
- fIB[0] = SkMesh::MakeIndexBuffer(/*GrDirectContext*=*/nullptr, std::move(data));
+ fIB[0] = SkMesh::MakeIndexBuffer(/*GrDirectContext*=*/nullptr,
+ data->data(),
+ data->size());
}
if (!fIB[1]) {
@@ -380,9 +387,9 @@ protected:
}
auto [spec, error] = SkMeshSpecification::Make(
- SkMakeSpan(kAttributes, SK_ARRAY_COUNT(kAttributes)),
+ kAttributes,
sizeof(Vertex),
- SkMakeSpan(kVaryings, SK_ARRAY_COUNT(kVaryings)),
+ kVaryings,
SkString(vs),
SkString(kFS),
std::move(cs),
@@ -397,7 +404,7 @@ protected:
SkColor colors[] = {SK_ColorWHITE, SK_ColorTRANSPARENT};
fShader = SkGradientShader::MakeLinear(pts, colors, nullptr, 2, SkTileMode::kMirror);
- fVB = SkMesh::MakeVertexBuffer(nullptr, SkData::MakeWithoutCopy(kQuad, sizeof(kQuad)));
+ fVB = SkMesh::MakeVertexBuffer(nullptr, kQuad, sizeof(kQuad));
}
SkString onShortName() override { return SkString("custommesh_cs"); }
@@ -431,7 +438,7 @@ protected:
SkPaint paint;
paint.setShader(useShader ? fShader : nullptr);
SkBlendMode mode = useShader ? SkBlendMode::kModulate : SkBlendMode::kDst;
- SkCanvasPriv::DrawMesh(c, mesh, SkBlender::Mode(mode), paint);
+ canvas->drawMesh(mesh, SkBlender::Mode(mode), paint);
c->translate(0, kRect.height() + 10);
}
@@ -510,9 +517,9 @@ protected:
}
)";
auto [spec, error] =
- SkMeshSpecification::Make(SkMakeSpan(kAttributes, SK_ARRAY_COUNT(kAttributes)),
+ SkMeshSpecification::Make(kAttributes,
sizeof(Vertex),
- SkMakeSpan(kVaryings, SK_ARRAY_COUNT(kVaryings)),
+ kVaryings,
SkString(kVS),
SkString(kFS),
SkColorSpace::MakeSRGB(),
@@ -530,7 +537,7 @@ protected:
2,
SkTileMode::kMirror);
- fVB = SkMesh::MakeVertexBuffer(nullptr, SkData::MakeWithoutCopy(kQuad, sizeof(kQuad)));
+ fVB = SkMesh::MakeVertexBuffer(nullptr, kQuad, sizeof(kQuad));
}
SkString onShortName() override { return SkString("custommesh_uniforms"); }
@@ -578,7 +585,7 @@ protected:
SkPaint paint;
paint.setShader(fShader);
- SkCanvasPriv::DrawMesh(canvas, mesh, SkBlender::Mode(SkBlendMode::kModulate), paint);
+ canvas->drawMesh(mesh, SkBlender::Mode(SkBlendMode::kModulate), paint);
canvas->translate(0, kRect.height() + 10);
}
@@ -630,4 +637,206 @@ private:
DEF_GM(return new MeshUniformsGM())
+class MeshUpdateGM : public skiagm::GM {
+public:
+ MeshUpdateGM() = default;
+
+protected:
+ using Attribute = SkMeshSpecification::Attribute;
+ using Varying = SkMeshSpecification::Varying;
+
+ SkISize onISize() override { return {270, 490}; }
+
+ void onOnceBeforeDraw() override {
+ static const Attribute kAttributes[]{
+ {Attribute::Type::kFloat2, 0, SkString{"pos"}},
+ {Attribute::Type::kFloat2, 8, SkString{"coords"}},
+ };
+ static const Varying kVaryings[]{
+ {Varying::Type::kFloat2, SkString{"coords"}},
+ };
+ static constexpr char kVS[] = R"(
+ float2 main(in Attributes attributes, out Varyings varyings) {
+ varyings.coords = attributes.coords;
+ return attributes.pos;
+ }
+ )";
+ static constexpr char kFS[] = R"(
+ float2 main(Varyings varyings) { return varyings.coords; }
+ )";
+ auto [spec, error] = SkMeshSpecification::Make(kAttributes,
+ sizeof(Vertex),
+ kVaryings,
+ SkString(kVS),
+ SkString(kFS),
+ SkColorSpace::MakeSRGB(),
+ kPremul_SkAlphaType);
+ if (!spec) {
+ SkDebugf("%s\n", error.c_str());
+ }
+ fSpec = std::move(spec);
+
+ uint32_t colors[] = {SK_ColorYELLOW, SK_ColorMAGENTA, SK_ColorCYAN, SK_ColorWHITE};
+ SkPixmap pixmap(SkImageInfo::Make({2, 2}, kBGRA_8888_SkColorType, kPremul_SkAlphaType),
+ colors,
+ /*rowBytes=*/8);
+ fShader = SkImage::MakeRasterCopy(pixmap)->makeShader(
+ SkTileMode::kClamp, SkTileMode::kClamp, SkSamplingOptions{SkFilterMode::kLinear});
+ }
+
+ SkString onShortName() override { return SkString("mesh_updates"); }
+
+ DrawResult onDraw(SkCanvas* canvas, SkString* error) override {
+ canvas->clear(SK_ColorBLACK);
+
+ GrRecordingContext* rc = canvas->recordingContext();
+ GrDirectContext* dc = GrAsDirectContext(rc);
+ if (rc && !dc) {
+ // On GPU this relies on using the DC to update the GPU backed vertex/index buffers.
+ return DrawResult::kSkip;
+ }
+
+ if (dc && dc->abandoned()) {
+ return DrawResult::kSkip;
+ }
+
+ // TODO: Remove this once we implement support for APIs without transfer buffers.
+ if (dc && !dc->priv().caps()->transferFromBufferToBufferSupport()) {
+ return DrawResult::kSkip;
+ }
+
+ SkPaint paint;
+ paint.setShader(fShader);
+
+ SkRect r = SkRect::MakeXYWH(10.f, 10.f, 50.f, 50.f);
+
+ // We test updating CPU and GPU buffers.
+ for (bool gpuBuffer : {false, true}) {
+ auto ctx = gpuBuffer ? dc : nullptr;
+
+ // How many rects worth of storage is in the vertex buffer?
+ static constexpr int kVBRects = 2;
+
+ // How many times do we update the vertex buffer? Wraps to start of buffer if
+ // > kVBRects.
+ static constexpr int kUpdatesRects = 3;
+
+ auto vb =
+ SkMesh::MakeVertexBuffer(ctx, /*data=*/nullptr, kVBRects*6*sizeof(Vertex));
+
+ SkRect bounds;
+ for (int i = 0; i < kUpdatesRects; ++i) {
+ auto p = r.makeOffset(100.f*i, 0.f);
+ if (i) {
+ bounds.join(p);
+ } else {
+ bounds = p;
+ }
+
+ SkPoint t[4];
+ SkRect::MakeWH(2.f, 2.f).toQuad(t);
+ SkMatrix::RotateDeg(90.f*i, {1.f, 1.f}).mapPoints(t, std::size(t));
+
+ Vertex vertices[6];
+ vertices[0] = {{p.left(), p.top()}, t[0]};
+ vertices[1] = {{p.left(), p.bottom()}, t[3]};
+ vertices[2] = {{p.right(), p.top()}, t[1]};
+ vertices[3] = vertices[2];
+ vertices[4] = vertices[1];
+ vertices[5] = {{p.right(), p.bottom()}, t[2]};
+
+ size_t offset = 6*(i % kVBRects)*sizeof(Vertex);
+ SkAssertResult(vb->update(ctx, vertices, offset, 6*sizeof(Vertex)));
+ // Make there aren't accidentally deferred reads of the client data.
+ std::memset(vertices, 0, sizeof(vertices));
+
+ int rectCount = std::min(i + 1, kVBRects);
+ auto mesh = SkMesh::Make(fSpec,
+ SkMesh::Mode::kTriangles,
+ vb,
+ /*vertexCount=*/6*rectCount,
+ /*vertexOffset=*/0,
+ nullptr,
+ bounds);
+
+ canvas->drawMesh(mesh, SkBlender::Mode(SkBlendMode::kDst), paint);
+
+ canvas->translate(0, r.height() + 10);
+ }
+
+ // Now test updating an IB.
+
+ // How many rects worth of storage is in the index buffer?
+ static constexpr int kIBRects = 2;
+
+ // How many times do we update the index buffer? Wraps to start of buffer if > kIBRects.
+ static constexpr int kNumIBUpdates = 3;
+
+ // Make the vertex buffer large enough to hold all the rects and populate.
+ vb = SkMesh::MakeVertexBuffer(
+ ctx, /*data=*/nullptr, kNumIBUpdates*4*sizeof(Vertex));
+ for (int i = 0; i < kNumIBUpdates; ++i) {
+ SkPoint p[4];
+ auto rect = r.makeOffset(100*i, 0);
+ rect.toQuad(p);
+ if (i) {
+ bounds.join(rect);
+ } else {
+ bounds = rect;
+ }
+
+ SkPoint t[4];
+ SkRect::MakeWH(2.f, 2.f).toQuad(t);
+ SkMatrix::RotateDeg(90.f*i, {1.f, 1.f}).mapPoints(t, std::size(t));
+ Vertex vertices[4]{{p[0], t[0]}, {p[1], t[1]}, {p[2], t[2]}, {p[3], t[3]}};
+ SkAssertResult(
+ vb->update(ctx, vertices, i*4*sizeof(Vertex), 4*sizeof(Vertex)));
+ }
+
+ auto ib =
+ SkMesh::MakeIndexBuffer(ctx, /*data=*/nullptr, kIBRects*6*sizeof(uint16_t));
+
+ for (int i = 0; i < kNumIBUpdates; ++i) {
+ uint16_t indices[6] = {SkToU16(0 + 4*i),
+ SkToU16(3 + 4*i),
+ SkToU16(1 + 4*i),
+ SkToU16(1 + 4*i),
+ SkToU16(3 + 4*i),
+ SkToU16(2 + 4*i)};
+ size_t offset = 6*(i % kIBRects)*sizeof(uint16_t);
+ SkAssertResult(ib->update(ctx, indices, offset, 6*sizeof(uint16_t)));
+ std::memset(indices, 0, 6*sizeof(uint16_t));
+
+ auto mesh = SkMesh::MakeIndexed(fSpec,
+ SkMesh::Mode::kTriangles,
+ vb,
+ /*vertexCount= */ 4*kNumIBUpdates,
+ /*vertexOffset=*/0,
+ ib,
+ /*indexCount= */ 6,
+ /*indexOffset=*/offset,
+ /*uniforms= */ nullptr,
+ bounds);
+
+ canvas->drawMesh(mesh, SkBlender::Mode(SkBlendMode::kDst), paint);
+ }
+ canvas->translate(0, r.height() + 10);
+ }
+
+ return DrawResult::kOk;
+ }
+
+private:
+ struct Vertex {
+ SkPoint pos;
+ SkPoint tex;
+ };
+
+ sk_sp<SkMeshSpecification> fSpec;
+
+ sk_sp<SkShader> fShader;
+};
+
+DEF_GM(return new MeshUpdateGM())
+
} // namespace skiagm
diff --git a/chromium/third_party/skia/gm/mipmap.cpp b/chromium/third_party/skia/gm/mipmap.cpp
index 7091ec444c2..60aa8187320 100644
--- a/chromium/third_party/skia/gm/mipmap.cpp
+++ b/chromium/third_party/skia/gm/mipmap.cpp
@@ -52,7 +52,7 @@ DEF_SIMPLE_GM(mipmap, canvas, 400, 200) {
};
canvas->translate(20, 20);
- for (size_t i = 0; i < SK_ARRAY_COUNT(samplings); ++i) {
+ for (size_t i = 0; i < std::size(samplings); ++i) {
canvas->drawImageRect(img.get(), dst, samplings[i], nullptr);
canvas->translate(0, 20);
}
diff --git a/chromium/third_party/skia/gm/mixercolorfilter.cpp b/chromium/third_party/skia/gm/mixercolorfilter.cpp
index 4ddfd6ed42c..045136938dd 100644
--- a/chromium/third_party/skia/gm/mixercolorfilter.cpp
+++ b/chromium/third_party/skia/gm/mixercolorfilter.cpp
@@ -87,7 +87,7 @@ protected:
paint.setShader(SkGradientShader::MakeSweep(fTileSize.width() / 2,
fTileSize.height() / 2,
gradient_colors, nullptr,
- SK_ARRAY_COUNT(gradient_colors)));
+ std::size(gradient_colors)));
auto cf0 = MakeTintColorFilter(0xff300000, 0xffa00000); // red tint
auto cf1 = MakeTintColorFilter(0xff003000, 0xff00a000); // green tint
@@ -116,7 +116,7 @@ private:
{
SkAutoCanvasRestore arc(canvas, true);
for (size_t i = 0; i < fTileCount; ++i) {
- paint.setColor4f(paintColors[i % SK_ARRAY_COUNT(paintColors)]);
+ paint.setColor4f(paintColors[i % std::size(paintColors)]);
float t = static_cast<float>(i) / (fTileCount - 1);
paint.setColorFilter(SkColorFilters::Lerp(t, cf0, cf1));
canvas->translate(fTileSize.width() * 0.1f, 0);
diff --git a/chromium/third_party/skia/gm/modecolorfilters.cpp b/chromium/third_party/skia/gm/modecolorfilters.cpp
index b95488d98c8..9c17ed29e1b 100644
--- a/chromium/third_party/skia/gm/modecolorfilters.cpp
+++ b/chromium/third_party/skia/gm/modecolorfilters.cpp
@@ -134,13 +134,13 @@ protected:
SkPaint paint;
int idx = 0;
const int kRectsPerRow = std::max(this->getISize().fWidth / kRectWidth, 1);
- for (size_t cfm = 0; cfm < SK_ARRAY_COUNT(modes); ++cfm) {
- for (size_t cfc = 0; cfc < SK_ARRAY_COUNT(colors); ++cfc) {
+ for (size_t cfm = 0; cfm < std::size(modes); ++cfm) {
+ for (size_t cfc = 0; cfc < std::size(colors); ++cfc) {
paint.setColorFilter(SkColorFilters::Blend(colors[cfc], modes[cfm]));
- for (size_t s = 0; s < SK_ARRAY_COUNT(shaders); ++s) {
+ for (size_t s = 0; s < std::size(shaders); ++s) {
paint.setShader(shaders[s]);
bool hasShader = nullptr == paint.getShader();
- int paintColorCnt = hasShader ? SK_ARRAY_COUNT(alphas) : SK_ARRAY_COUNT(colors);
+ int paintColorCnt = hasShader ? std::size(alphas) : std::size(colors);
SkColor* paintColors = hasShader ? alphas : colors;
for (int pc = 0; pc < paintColorCnt; ++pc) {
paint.setColor(paintColors[pc]);
diff --git a/chromium/third_party/skia/gm/morphology.cpp b/chromium/third_party/skia/gm/morphology.cpp
index 9c60e92215c..ee1afae64e8 100644
--- a/chromium/third_party/skia/gm/morphology.cpp
+++ b/chromium/third_party/skia/gm/morphology.cpp
@@ -75,7 +75,7 @@ protected:
SkIRect cropRect = SkIRect::MakeXYWH(25, 20, 100, 80);
for (unsigned j = 0; j < 4; ++j) {
- for (unsigned i = 0; i < SK_ARRAY_COUNT(samples); ++i) {
+ for (unsigned i = 0; i < std::size(samples); ++i) {
const SkIRect* cr = j & 0x02 ? &cropRect : nullptr;
if (j & 0x01) {
paint.setImageFilter(SkImageFilters::Erode(
diff --git a/chromium/third_party/skia/gm/nested.cpp b/chromium/third_party/skia/gm/nested.cpp
index 039f32c6068..bf430ff9e37 100644
--- a/chromium/third_party/skia/gm/nested.cpp
+++ b/chromium/third_party/skia/gm/nested.cpp
@@ -102,7 +102,7 @@ protected:
SkScalar xOff = 2, yOff = 2;
for (int outerShape = 0; outerShape < kShapeCount; ++outerShape) {
for (int innerShape = 0; innerShape < kShapeCount; ++innerShape) {
- for (size_t innerRect = 0; innerRect < SK_ARRAY_COUNT(innerRects); ++innerRect) {
+ for (size_t innerRect = 0; innerRect < std::size(innerRects); ++innerRect) {
SkPathBuilder builder;
AddShape(&builder, outerRect, (Shapes) outerShape, SkPathDirection::kCW);
diff --git a/chromium/third_party/skia/gm/nonclosedpaths.cpp b/chromium/third_party/skia/gm/nonclosedpaths.cpp
index dccce389d0e..05519641b42 100644
--- a/chromium/third_party/skia/gm/nonclosedpaths.cpp
+++ b/chromium/third_party/skia/gm/nonclosedpaths.cpp
@@ -79,7 +79,7 @@ protected:
// 0(may use hairline rendering), 10(common case for stroke-style)
// 40 and 50(>= geometry width/height, make the contour filled in fact)
constexpr int kStrokeWidth[] = {0, 10, 40, 50};
- int numWidths = SK_ARRAY_COUNT(kStrokeWidth);
+ int numWidths = std::size(kStrokeWidth);
constexpr SkPaint::Style kStyle[] = {
SkPaint::kStroke_Style, SkPaint::kStrokeAndFill_Style
@@ -103,9 +103,9 @@ protected:
// For stroke style painter and fill-and-stroke style painter
for (size_t type = 0; type < kClosureTypeCount; ++type) {
- for (size_t style = 0; style < SK_ARRAY_COUNT(kStyle); ++style) {
- for (size_t cap = 0; cap < SK_ARRAY_COUNT(kCap); ++cap) {
- for (size_t join = 0; join < SK_ARRAY_COUNT(kJoin); ++join) {
+ for (size_t style = 0; style < std::size(kStyle); ++style) {
+ for (size_t cap = 0; cap < std::size(kCap); ++cap) {
+ for (size_t join = 0; join < std::size(kJoin); ++join) {
for (int width = 0; width < numWidths; ++width) {
canvas->save();
SetLocation(canvas, counter, SkPaint::kJoinCount * numWidths);
diff --git a/chromium/third_party/skia/gm/ovals.cpp b/chromium/third_party/skia/gm/ovals.cpp
index cae0cecbb46..3351d43d1c2 100644
--- a/chromium/third_party/skia/gm/ovals.cpp
+++ b/chromium/third_party/skia/gm/ovals.cpp
@@ -254,7 +254,7 @@ protected:
SkPoint center = SkPoint::Make(SkIntToScalar(0), SkIntToScalar(0));
SkColor colors[] = { SK_ColorBLUE, SK_ColorRED, SK_ColorGREEN };
SkScalar pos[] = { 0, SK_ScalarHalf, SK_Scalar1 };
- auto shader = SkGradientShader::MakeRadial(center, 20, colors, pos, SK_ARRAY_COUNT(colors),
+ auto shader = SkGradientShader::MakeRadial(center, 20, colors, pos, std::size(colors),
SkTileMode::kClamp);
for (int i = 0; i < fPaints.count(); ++i) {
diff --git a/chromium/third_party/skia/gm/p3.cpp b/chromium/third_party/skia/gm/p3.cpp
index 9b78a970cdd..e14ceea5eaf 100644
--- a/chromium/third_party/skia/gm/p3.cpp
+++ b/chromium/third_party/skia/gm/p3.cpp
@@ -202,7 +202,7 @@ DEF_SIMPLE_GM(p3, canvas, 450, 1300) {
SkPaint paint;
paint.setShader(SkGradientShader::MakeLinear(points, colors, p3,
- nullptr, SK_ARRAY_COUNT(colors),
+ nullptr, std::size(colors),
SkTileMode::kClamp));
canvas->drawRect({10,10,70,70}, paint);
canvas->save();
@@ -229,7 +229,7 @@ DEF_SIMPLE_GM(p3, canvas, 450, 1300) {
SkPaint paint;
paint.setShader(
SkGradientShader::MakeLinear(points, colors, p3,
- nullptr, SK_ARRAY_COUNT(colors),
+ nullptr, std::size(colors),
SkTileMode::kClamp,
SkGradientShader::kInterpolateColorsInPremul_Flag,
nullptr/*local matrix*/));
@@ -257,7 +257,7 @@ DEF_SIMPLE_GM(p3, canvas, 450, 1300) {
SkPaint paint;
paint.setShader(SkGradientShader::MakeLinear(points, colors, srgb,
- nullptr, SK_ARRAY_COUNT(colors),
+ nullptr, std::size(colors),
SkTileMode::kClamp));
canvas->drawRect({10,10,70,70}, paint);
canvas->save();
@@ -284,7 +284,7 @@ DEF_SIMPLE_GM(p3, canvas, 450, 1300) {
SkPaint paint;
paint.setShader(
SkGradientShader::MakeLinear(points, colors, srgb,
- nullptr, SK_ARRAY_COUNT(colors),
+ nullptr, std::size(colors),
SkTileMode::kClamp,
SkGradientShader::kInterpolateColorsInPremul_Flag,
nullptr/*local matrix*/));
@@ -312,7 +312,7 @@ DEF_SIMPLE_GM(p3, canvas, 450, 1300) {
SkPaint paint;
paint.setShader(
SkGradientShader::MakeLinear(points, colors, p3,
- nullptr, SK_ARRAY_COUNT(colors),
+ nullptr, std::size(colors),
SkTileMode::kClamp,
SkGradientShader::kInterpolateColorsInPremul_Flag,
nullptr/*local matrix*/));
diff --git a/chromium/third_party/skia/gm/palette.cpp b/chromium/third_party/skia/gm/palette.cpp
index 7d74d892a20..ae7dc548664 100644
--- a/chromium/third_party/skia/gm/palette.cpp
+++ b/chromium/third_party/skia/gm/palette.cpp
@@ -25,8 +25,13 @@
namespace skiagm {
+// Copied from https://github.com/googlefonts/color-fonts#colrv1-test-font glyph descriptions markdown file.
+namespace ColrV1TestDefinitions {
+const uint32_t color_circles_palette[] = {0xf0e00, 0xf0e01};
+};
+
namespace {
-const char kColrCpalTestFontPath[] = "fonts/more_samples-glyf_colr_1.ttf";
+const char kColrCpalTestFontPath[] = "fonts/test_glyphs-glyf_colr_1.ttf";
constexpr SkFontArguments::Palette::Override kColorOverridesAll[] = {
// A gradient of dark to light purple for the circle palette test glyph.
@@ -58,11 +63,9 @@ constexpr SkFontArguments::Palette::Override kColorOverridesOne[] = {
constexpr SkFontArguments::Palette kLightPaletteOverride{2, nullptr, 0};
constexpr SkFontArguments::Palette kDarkPaletteOverride{1, nullptr, 0};
constexpr SkFontArguments::Palette kOnePaletteOverride{
- 0, kColorOverridesOne, SK_ARRAY_COUNT(kColorOverridesOne)};
+ 0, kColorOverridesOne, std::size(kColorOverridesOne)};
constexpr SkFontArguments::Palette kAllPaletteOverride{
- 0, kColorOverridesAll, SK_ARRAY_COUNT(kColorOverridesAll)};
-
-constexpr uint16_t kTestGlyphs[] = {56, 57};
+ 0, kColorOverridesAll, std::size(kColorOverridesAll)};
} // namespace
@@ -121,21 +124,23 @@ protected:
// Set a recognizable foreground color which is not to be overriden.
paint.setColor(SK_ColorGRAY);
// Draw the default palette on the left, for COLRv0 and COLRv1.
- canvas->drawSimpleText(kTestGlyphs,
- SK_ARRAY_COUNT(kTestGlyphs) * sizeof(uint16_t),
- SkTextEncoding::kGlyphID,
- 0,
- y,
- defaultFont,
- paint);
+ canvas->drawSimpleText(
+ ColrV1TestDefinitions::color_circles_palette,
+ std::size(ColrV1TestDefinitions::color_circles_palette) * sizeof(uint32_t),
+ SkTextEncoding::kUTF32,
+ 0,
+ y,
+ defaultFont,
+ paint);
// Draw the overriden palette on the right.
- canvas->drawSimpleText(kTestGlyphs,
- SK_ARRAY_COUNT(kTestGlyphs) * sizeof(uint16_t),
- SkTextEncoding::kGlyphID,
- 440,
- y,
- paletteFont,
- paint);
+ canvas->drawSimpleText(
+ ColrV1TestDefinitions::color_circles_palette,
+ std::size(ColrV1TestDefinitions::color_circles_palette) * sizeof(uint32_t),
+ SkTextEncoding::kUTF32,
+ 440,
+ y,
+ paletteFont,
+ paint);
y += metrics.fDescent + metrics.fLeading;
}
return DrawResult::kOk;
diff --git a/chromium/third_party/skia/gm/patch.cpp b/chromium/third_party/skia/gm/patch.cpp
index 97b05e86bd9..0b1465d593d 100644
--- a/chromium/third_party/skia/gm/patch.cpp
+++ b/chromium/third_party/skia/gm/patch.cpp
@@ -29,7 +29,7 @@ static sk_sp<SkShader> make_shader() {
};
const SkPoint pts[] = { { 100.f / 4.f, 0.f }, { 3.f * 100.f / 4.f, 100.f } };
- return SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
+ return SkGradientShader::MakeLinear(pts, colors, nullptr, std::size(colors),
SkTileMode::kMirror);
}
diff --git a/chromium/third_party/skia/gm/path_stroke_with_zero_length.cpp b/chromium/third_party/skia/gm/path_stroke_with_zero_length.cpp
index 7550ef5bd14..ef527a198ee 100644
--- a/chromium/third_party/skia/gm/path_stroke_with_zero_length.cpp
+++ b/chromium/third_party/skia/gm/path_stroke_with_zero_length.cpp
@@ -117,12 +117,12 @@ static const int kCellWidth = 50;
static const int kCellHeight = 20;
static const int kCellPad = 2;
-static const int kNumRows = SK_ARRAY_COUNT(kCaps) * SK_ARRAY_COUNT(kWidths);
-static const int kNumColumns = SK_ARRAY_COUNT(kAllVerbs);
+static const int kNumRows = std::size(kCaps) * std::size(kWidths);
+static const int kNumColumns = std::size(kAllVerbs);
static const int kTotalWidth = kNumColumns * (kCellWidth + kCellPad) + kCellPad;
static const int kTotalHeight = kNumRows * (kCellHeight + kCellPad) + kCellPad;
-static const int kDblContourNumColums = SK_ARRAY_COUNT(kSomeVerbs) * SK_ARRAY_COUNT(kSomeVerbs);
+static const int kDblContourNumColums = std::size(kSomeVerbs) * std::size(kSomeVerbs);
static const int kDblContourTotalWidth = kDblContourNumColums * (kCellWidth + kCellPad) + kCellPad;
// 50% transparent versions of the colors used for positive/negative triage icons on gold.skia.org
diff --git a/chromium/third_party/skia/gm/patharcto.cpp b/chromium/third_party/skia/gm/patharcto.cpp
index 8a7415bdccb..20d12369bbc 100644
--- a/chromium/third_party/skia/gm/patharcto.cpp
+++ b/chromium/third_party/skia/gm/patharcto.cpp
@@ -75,7 +75,7 @@ DEF_SIMPLE_GM(path_append_extend, canvas, 400, 400) {
{ 10, 50 }, {30, 70}, {50, 50},
};
- const SkPath path1 = SkPath::Polygon(p1, SK_ARRAY_COUNT(p1), false);
+ const SkPath path1 = SkPath::Polygon(p1, std::size(p1), false);
SkPaint paint;
paint.setStroke(true);
@@ -92,7 +92,7 @@ DEF_SIMPLE_GM(path_append_extend, canvas, 400, 400) {
for (auto proc : {old_school_polygon, new_school_polygon}) {
canvas->save();
- SkPath path0 = proc(p0, SK_ARRAY_COUNT(p0), isClosed);
+ SkPath path0 = proc(p0, std::size(p0), isClosed);
canvas->drawPath(path0, paint);
canvas->drawPath(path1, paint);
diff --git a/chromium/third_party/skia/gm/patheffects.cpp b/chromium/third_party/skia/gm/patheffects.cpp
index 801ef71c9ab..3a32df5a51c 100644
--- a/chromium/third_party/skia/gm/patheffects.cpp
+++ b/chromium/third_party/skia/gm/patheffects.cpp
@@ -58,7 +58,7 @@ static void stroke_pe(SkPaint* paint) {
static void dash_pe(SkPaint* paint) {
SkScalar inter[] = { 20, 10, 10, 10 };
paint->setStrokeWidth(12);
- paint->setPathEffect(SkDashPathEffect::Make(inter, SK_ARRAY_COUNT(inter), 0));
+ paint->setPathEffect(SkDashPathEffect::Make(inter, std::size(inter), 0));
compose_pe(paint);
}
@@ -75,7 +75,7 @@ static SkPath scale(const SkPath& path, SkScalar scale) {
static void one_d_pe(SkPaint* paint) {
SkPathBuilder b;
b.moveTo(SkIntToScalar(gXY[0]), SkIntToScalar(gXY[1]));
- for (unsigned i = 2; i < SK_ARRAY_COUNT(gXY); i += 2) {
+ for (unsigned i = 2; i < std::size(gXY); i += 2) {
b.lineTo(SkIntToScalar(gXY[i]), SkIntToScalar(gXY[i+1]));
}
b.close().offset(SkIntToScalar(-6), 0);
@@ -137,7 +137,7 @@ protected:
}, false);
canvas->save();
- for (size_t i = 0; i < SK_ARRAY_COUNT(gPE); i++) {
+ for (size_t i = 0; i < std::size(gPE); i++) {
gPE[i](&paint);
canvas->drawPath(path, paint);
canvas->translate(0, 75);
@@ -151,14 +151,14 @@ protected:
.detach();
canvas->translate(320, 20);
- for (size_t i = 0; i < SK_ARRAY_COUNT(gPE2); i++) {
+ for (size_t i = 0; i < std::size(gPE2); i++) {
gPE2[i](&paint);
canvas->drawPath(path, paint);
canvas->translate(0, 160);
}
const SkIRect rect = SkIRect::MakeXYWH(20, 20, 60, 60);
- for (size_t i = 0; i < SK_ARRAY_COUNT(gPE); i++) {
+ for (size_t i = 0; i < std::size(gPE); i++) {
SkPaint p;
p.setAntiAlias(true);
p.setStyle(SkPaint::kFill_Style);
@@ -251,7 +251,7 @@ DEF_SIMPLE_GM(stroke_and_fill_patheffect, canvas, 900, 450) {
const SkPoint pts[] = {
{0, 0}, {100, 100}, {0, 100}, {100, 0},
};
- return SkPath::Polygon(pts, SK_ARRAY_COUNT(pts), true);
+ return SkPath::Polygon(pts, std::size(pts), true);
},
};
diff --git a/chromium/third_party/skia/gm/pathfill.cpp b/chromium/third_party/skia/gm/pathfill.cpp
index 66042236a95..0e4e5f021af 100644
--- a/chromium/third_party/skia/gm/pathfill.cpp
+++ b/chromium/third_party/skia/gm/pathfill.cpp
@@ -295,7 +295,7 @@ constexpr MakePathProc gProcs[] = {
make_sawtooth_3,
};
-#define N SK_ARRAY_COUNT(gProcs)
+#define N std::size(gProcs)
class PathFillGM : public skiagm::GM {
SkPath fPath[N];
diff --git a/chromium/third_party/skia/gm/pathmeasure.cpp b/chromium/third_party/skia/gm/pathmeasure.cpp
index 13f69c186b2..27610e10fd0 100644
--- a/chromium/third_party/skia/gm/pathmeasure.cpp
+++ b/chromium/third_party/skia/gm/pathmeasure.cpp
@@ -21,7 +21,7 @@ static SK_UNUSED void path_measure_explosion(SkCanvas* canvas) {
p.setAntiAlias(false);
float intervals[] = { 0, 10e9f };
p.setStyle(SkPaint::kStroke_Style);
- p.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 0));
+ p.setPathEffect(SkDashPathEffect::Make(intervals, std::size(intervals), 0));
int quadratic_at[] = {
13, 68, 258, 1053, 1323, 2608, 10018, 15668, 59838, 557493, 696873, 871098, 4153813,
diff --git a/chromium/third_party/skia/gm/perspshaders.cpp b/chromium/third_party/skia/gm/perspshaders.cpp
index 471e6e26938..7fd0dad1b28 100644
--- a/chromium/third_party/skia/gm/perspshaders.cpp
+++ b/chromium/third_party/skia/gm/perspshaders.cpp
@@ -71,9 +71,9 @@ protected:
};
constexpr SkScalar pos[] = { 0, 0.25f, 0.5f, 0.75f, SK_Scalar1 };
- fLinearGrad1 = SkGradientShader::MakeLinear(pts1, colors, pos, SK_ARRAY_COUNT(colors),
+ fLinearGrad1 = SkGradientShader::MakeLinear(pts1, colors, pos, std::size(colors),
SkTileMode::kClamp);
- fLinearGrad2 = SkGradientShader::MakeLinear(pts2, colors, pos, SK_ARRAY_COUNT(colors),
+ fLinearGrad2 = SkGradientShader::MakeLinear(pts2, colors, pos, std::size(colors),
SkTileMode::kClamp);
fPerspMatrix.reset();
diff --git a/chromium/third_party/skia/gm/pictureimagegenerator.cpp b/chromium/third_party/skia/gm/pictureimagegenerator.cpp
index ed10848de2e..845a60c81cf 100644
--- a/chromium/third_party/skia/gm/pictureimagegenerator.cpp
+++ b/chromium/third_party/skia/gm/pictureimagegenerator.cpp
@@ -89,8 +89,8 @@ static void draw_vector_logo(SkCanvas* canvas, const SkRect& viewBox) {
SkPoint::Make(iBox.centerX(), 0) };
const SkScalar pos1[] = { 0, 0.75f };
const SkColor colors1[] = { SK_ColorTRANSPARENT, SK_ColorBLACK };
- SkASSERT(SK_ARRAY_COUNT(pos1) == SK_ARRAY_COUNT(colors1));
- paint.setShader(SkGradientShader::MakeLinear(pts1, colors1, pos1, SK_ARRAY_COUNT(pos1),
+ SkASSERT(std::size(pos1) == std::size(colors1));
+ paint.setShader(SkGradientShader::MakeLinear(pts1, colors1, pos1, std::size(pos1),
SkTileMode::kClamp));
canvas->drawRect(underlineRect, paint);
@@ -107,8 +107,8 @@ static void draw_vector_logo(SkCanvas* canvas, const SkRect& viewBox) {
0xff5460a5,
SK_ColorBLACK
};
- SkASSERT(SK_ARRAY_COUNT(pos2) == SK_ARRAY_COUNT(colors2));
- paint.setShader(SkGradientShader::MakeLinear(pts2, colors2, pos2, SK_ARRAY_COUNT(pos2),
+ SkASSERT(std::size(pos2) == std::size(colors2));
+ paint.setShader(SkGradientShader::MakeLinear(pts2, colors2, pos2, std::size(pos2),
SkTileMode::kClamp));
canvas->drawSimpleText(kSkiaStr, textLen, SkTextEncoding::kUTF8, 0, 0, font, paint);
}
@@ -164,7 +164,7 @@ protected:
const unsigned kDrawsPerRow = 4;
const SkScalar kDrawSize = 250;
- for (size_t i = 0; i < SK_ARRAY_COUNT(configs); ++i) {
+ for (size_t i = 0; i < std::size(configs); ++i) {
SkPaint p;
p.setAlphaf(configs[i].opacity);
diff --git a/chromium/third_party/skia/gm/pictureshader.cpp b/chromium/third_party/skia/gm/pictureshader.cpp
index 13b598b1db4..2aca7365a5e 100644
--- a/chromium/third_party/skia/gm/pictureshader.cpp
+++ b/chromium/third_party/skia/gm/pictureshader.cpp
@@ -156,7 +156,7 @@ private:
void drawScene(SkCanvas* canvas, const SkMatrix& matrix, const SkMatrix& localMatrix,
unsigned tileMode) {
- SkASSERT(tileMode < SK_ARRAY_COUNT(kTileConfigs));
+ SkASSERT(tileMode < std::size(kTileConfigs));
SkPaint paint;
paint.setStyle(SkPaint::kFill_Style);
diff --git a/chromium/third_party/skia/gm/pictureshadercache.cpp b/chromium/third_party/skia/gm/pictureshadercache.cpp
index b560a0c6d90..3cfd396bb6b 100644
--- a/chromium/third_party/skia/gm/pictureshadercache.cpp
+++ b/chromium/third_party/skia/gm/pictureshadercache.cpp
@@ -22,7 +22,7 @@
#include "include/core/SkString.h"
#include "include/core/SkSurface.h"
#include "include/core/SkTileMode.h"
-#include "include/third_party/skcms/skcms.h"
+#include "modules/skcms/skcms.h"
#include <utility>
diff --git a/chromium/third_party/skia/gm/pictureshadertile.cpp b/chromium/third_party/skia/gm/pictureshadertile.cpp
index f878c2afbce..95548ad361f 100644
--- a/chromium/third_party/skia/gm/pictureshadertile.cpp
+++ b/chromium/third_party/skia/gm/pictureshadertile.cpp
@@ -114,7 +114,7 @@ protected:
draw_scene(pictureCanvas, kPictureSize);
sk_sp<SkPicture> offsetPicture(recorder.finishRecordingAsPicture());
- for (unsigned i = 0; i < SK_ARRAY_COUNT(tiles); ++i) {
+ for (unsigned i = 0; i < std::size(tiles); ++i) {
SkRect tile = SkRect::MakeXYWH(tiles[i].x * kPictureSize,
tiles[i].y * kPictureSize,
tiles[i].w * kPictureSize,
@@ -145,7 +145,7 @@ protected:
SkPaint paint;
paint.setStyle(SkPaint::kFill_Style);
- for (unsigned i = 0; i < SK_ARRAY_COUNT(fShaders); ++i) {
+ for (unsigned i = 0; i < std::size(fShaders); ++i) {
paint.setShader(fShaders[i]);
canvas->save();
@@ -157,7 +157,7 @@ protected:
}
private:
- sk_sp<SkShader> fShaders[SK_ARRAY_COUNT(tiles)];
+ sk_sp<SkShader> fShaders[std::size(tiles)];
using INHERITED = GM;
};
diff --git a/chromium/third_party/skia/gm/pixelsnap.cpp b/chromium/third_party/skia/gm/pixelsnap.cpp
index 31136e697ed..6c02600bc80 100644
--- a/chromium/third_party/skia/gm/pixelsnap.cpp
+++ b/chromium/third_party/skia/gm/pixelsnap.cpp
@@ -173,13 +173,13 @@ protected:
{ 4, 4 }, { 7, 4 },
{ 4, 4 }, { 4, 7 },
};
- canvas->drawPoints(SkCanvas::kLines_PointMode, SK_ARRAY_COUNT(lines), lines, paint);
+ canvas->drawPoints(SkCanvas::kLines_PointMode, std::size(lines), lines, paint);
const SkPoint pts[] = {
{ 4, 3 }, { 4, 4, }, { 3, 3 }, { 3, 4 },
};
paint.setColor(SK_ColorBLUE);
- canvas->drawPoints(SkCanvas::kPoints_PointMode, SK_ARRAY_COUNT(pts), pts, paint);
+ canvas->drawPoints(SkCanvas::kPoints_PointMode, std::size(pts), pts, paint);
paint.setColor(SK_ColorRED);
canvas->drawRect(rect, paint);
diff --git a/chromium/third_party/skia/gm/polygonoffset.cpp b/chromium/third_party/skia/gm/polygonoffset.cpp
index a7b1d3d50ce..8cc8eb51197 100644
--- a/chromium/third_party/skia/gm/polygonoffset.cpp
+++ b/chromium/third_party/skia/gm/polygonoffset.cpp
@@ -374,19 +374,19 @@ const SkPoint* gConvexPoints[] = {
};
const size_t gConvexSizes[] = {
- SK_ARRAY_COUNT(gPoints0),
- SK_ARRAY_COUNT(gPoints1),
- SK_ARRAY_COUNT(gPoints2),
- SK_ARRAY_COUNT(gPoints3),
- SK_ARRAY_COUNT(gPoints4),
- SK_ARRAY_COUNT(gPoints5),
- SK_ARRAY_COUNT(gPoints6),
- SK_ARRAY_COUNT(gPoints7),
- SK_ARRAY_COUNT(gPoints8),
- SK_ARRAY_COUNT(gPoints9),
- SK_ARRAY_COUNT(gPoints10),
+ std::size(gPoints0),
+ std::size(gPoints1),
+ std::size(gPoints2),
+ std::size(gPoints3),
+ std::size(gPoints4),
+ std::size(gPoints5),
+ std::size(gPoints6),
+ std::size(gPoints7),
+ std::size(gPoints8),
+ std::size(gPoints9),
+ std::size(gPoints10),
};
-static_assert(SK_ARRAY_COUNT(gConvexSizes) == SK_ARRAY_COUNT(gConvexPoints), "array_mismatch");
+static_assert(std::size(gConvexSizes) == std::size(gConvexPoints), "array_mismatch");
const SkPoint* gSimplePoints[] = {
gPoints0, gPoints1, gPoints2, gPoints4, gPoints5, gPoints7,
@@ -395,23 +395,23 @@ const SkPoint* gSimplePoints[] = {
};
const size_t gSimpleSizes[] = {
- SK_ARRAY_COUNT(gPoints0),
- SK_ARRAY_COUNT(gPoints1),
- SK_ARRAY_COUNT(gPoints2),
- SK_ARRAY_COUNT(gPoints4),
- SK_ARRAY_COUNT(gPoints5),
- SK_ARRAY_COUNT(gPoints7),
- SK_ARRAY_COUNT(gPoints8),
- SK_ARRAY_COUNT(gPoints11),
- SK_ARRAY_COUNT(gPoints12),
- SK_ARRAY_COUNT(gPoints13),
- SK_ARRAY_COUNT(gPoints14),
- SK_ARRAY_COUNT(gPoints15),
- SK_ARRAY_COUNT(gPoints16),
- SK_ARRAY_COUNT(gPoints17),
- SK_ARRAY_COUNT(gPoints18),
+ std::size(gPoints0),
+ std::size(gPoints1),
+ std::size(gPoints2),
+ std::size(gPoints4),
+ std::size(gPoints5),
+ std::size(gPoints7),
+ std::size(gPoints8),
+ std::size(gPoints11),
+ std::size(gPoints12),
+ std::size(gPoints13),
+ std::size(gPoints14),
+ std::size(gPoints15),
+ std::size(gPoints16),
+ std::size(gPoints17),
+ std::size(gPoints18),
};
-static_assert(SK_ARRAY_COUNT(gSimpleSizes) == SK_ARRAY_COUNT(gSimplePoints), "array_mismatch");
+static_assert(std::size(gSimpleSizes) == std::size(gSimplePoints), "array_mismatch");
} // namespace PolygonOffsetData
@@ -440,7 +440,7 @@ protected:
static void GetConvexPolygon(int index, SkPathDirection dir,
std::unique_ptr<SkPoint[]>* data, int* numPts) {
- if (index < (int)SK_ARRAY_COUNT(PolygonOffsetData::gConvexPoints)) {
+ if (index < (int)std::size(PolygonOffsetData::gConvexPoints)) {
// manually specified
*numPts = (int)PolygonOffsetData::gConvexSizes[index];
*data = std::make_unique<SkPoint[]>(*numPts);
@@ -459,8 +459,8 @@ protected:
SkScalar height = kMaxPathHeight / 2;
int numPtsArray[] = { 3, 4, 5, 5, 6, 8, 8, 20, 100 };
- size_t arrayIndex = index - SK_ARRAY_COUNT(PolygonOffsetData::gConvexPoints);
- SkASSERT(arrayIndex < SK_ARRAY_COUNT(numPtsArray));
+ size_t arrayIndex = index - std::size(PolygonOffsetData::gConvexPoints);
+ SkASSERT(arrayIndex < std::size(numPtsArray));
*numPts = numPtsArray[arrayIndex];
if (arrayIndex == 3 || arrayIndex == 6) {
// squashed pentagon and octagon
@@ -475,7 +475,7 @@ protected:
static void GetSimplePolygon(int index, SkPathDirection dir,
std::unique_ptr<SkPoint[]>* data, int* numPts) {
- if (index < (int)SK_ARRAY_COUNT(PolygonOffsetData::gSimplePoints)) {
+ if (index < (int)std::size(PolygonOffsetData::gSimplePoints)) {
// manually specified
*numPts = (int)PolygonOffsetData::gSimpleSizes[index];
*data = std::make_unique<SkPoint[]>(*numPts);
@@ -494,9 +494,9 @@ protected:
SkScalar height = kMaxPathHeight / 2;
int numPtsArray[] = { 5, 7, 8, 20, 100 };
- size_t arrayIndex = index - SK_ARRAY_COUNT(PolygonOffsetData::gSimplePoints);
- arrayIndex = std::min(arrayIndex, SK_ARRAY_COUNT(numPtsArray) - 1);
- SkASSERT(arrayIndex < SK_ARRAY_COUNT(numPtsArray));
+ size_t arrayIndex = index - std::size(PolygonOffsetData::gSimplePoints);
+ arrayIndex = std::min(arrayIndex, std::size(numPtsArray) - 1);
+ SkASSERT(arrayIndex < std::size(numPtsArray));
*numPts = numPtsArray[arrayIndex];
// squash horizontally
width = kMaxPathHeight / 5;
@@ -565,7 +565,7 @@ protected:
}
SkTDArray<SkPoint> offsetPoly;
- size_t count = fConvexOnly ? SK_ARRAY_COUNT(insets) : SK_ARRAY_COUNT(offsets);
+ size_t count = fConvexOnly ? std::size(insets) : std::size(offsets);
for (size_t i = 0; i < count; ++i) {
SkScalar offset = fConvexOnly ? insets[i] : offsets[i];
std::function<SkScalar(const SkPoint&)> offsetFunc;
diff --git a/chromium/third_party/skia/gm/polygons.cpp b/chromium/third_party/skia/gm/polygons.cpp
index da515ce979d..d5065a6d746 100644
--- a/chromium/third_party/skia/gm/polygons.cpp
+++ b/chromium/third_party/skia/gm/polygons.cpp
@@ -53,8 +53,8 @@ protected:
SkPoint p7[] = {{0, 20}, {20, 20}, {30, 0}, {40, 20}, {60, 20},
{45, 30}, {55, 50}, {30, 40}, {5, 50}, {15, 30}}; // five-point stars
- for (size_t i = 0; i < SK_ARRAY_COUNT(p4); ++i) {
- SkScalar angle = 2 * SK_ScalarPI * i / SK_ARRAY_COUNT(p4);
+ for (size_t i = 0; i < std::size(p4); ++i) {
+ SkScalar angle = 2 * SK_ScalarPI * i / std::size(p4);
p4[i].set(20 * SkScalarCos(angle) + 20, 20 * SkScalarSin(angle) + 20);
}
@@ -62,18 +62,18 @@ protected:
SkPoint* fPoints;
size_t fPointNum;
} pgs[] = {
- { p0, SK_ARRAY_COUNT(p0) },
- { p1, SK_ARRAY_COUNT(p1) },
- { p2, SK_ARRAY_COUNT(p2) },
- { p3, SK_ARRAY_COUNT(p3) },
- { p4, SK_ARRAY_COUNT(p4) },
- { p5, SK_ARRAY_COUNT(p5) },
- { p6, SK_ARRAY_COUNT(p6) },
- { p7, SK_ARRAY_COUNT(p7) }
+ { p0, std::size(p0) },
+ { p1, std::size(p1) },
+ { p2, std::size(p2) },
+ { p3, std::size(p3) },
+ { p4, std::size(p4) },
+ { p5, std::size(p5) },
+ { p6, std::size(p6) },
+ { p7, std::size(p7) }
};
- SkASSERT(SK_ARRAY_COUNT(pgs) == kNumPolygons);
- for (size_t pgIndex = 0; pgIndex < SK_ARRAY_COUNT(pgs); ++pgIndex) {
+ SkASSERT(std::size(pgs) == kNumPolygons);
+ for (size_t pgIndex = 0; pgIndex < std::size(pgs); ++pgIndex) {
SkPathBuilder b;
b.moveTo(pgs[pgIndex].fPoints[0].fX,
pgs[pgIndex].fPoints[0].fY);
@@ -107,12 +107,12 @@ protected:
// 0(may use hairline rendering), 10(common case for stroke-style)
// 40(>= geometry width/height, make the contour filled in fact)
constexpr int kStrokeWidths[] = {0, 10, 40};
- SkASSERT(kNumStrokeWidths == SK_ARRAY_COUNT(kStrokeWidths));
+ SkASSERT(kNumStrokeWidths == std::size(kStrokeWidths));
constexpr SkPaint::Join kJoins[] = {
SkPaint::kMiter_Join, SkPaint::kRound_Join, SkPaint::kBevel_Join
};
- SkASSERT(kNumJoins == SK_ARRAY_COUNT(kJoins));
+ SkASSERT(kNumJoins == std::size(kJoins));
int counter = 0;
SkPaint paint;
@@ -142,7 +142,7 @@ protected:
constexpr SkPaint::Style kStyles[] = {
SkPaint::kStrokeAndFill_Style, SkPaint::kFill_Style
};
- SkASSERT(kNumExtraStyles == SK_ARRAY_COUNT(kStyles));
+ SkASSERT(kNumExtraStyles == std::size(kStyles));
paint.setStrokeJoin(SkPaint::kMiter_Join);
paint.setStrokeWidth(SkIntToScalar(20));
diff --git a/chromium/third_party/skia/gm/preservefillrule.cpp b/chromium/third_party/skia/gm/preservefillrule.cpp
index 73b5fa9a9bf..cb335395a6b 100644
--- a/chromium/third_party/skia/gm/preservefillrule.cpp
+++ b/chromium/third_party/skia/gm/preservefillrule.cpp
@@ -14,7 +14,7 @@
#include "src/gpu/ganesh/GrDirectContextPriv.h"
#include "src/gpu/ganesh/GrDrawingManager.h"
#include "src/gpu/ganesh/GrRecordingContextPriv.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "tools/ToolUtils.h"
namespace skiagm {
diff --git a/chromium/third_party/skia/gm/quadpaths.cpp b/chromium/third_party/skia/gm/quadpaths.cpp
index 5dbb73ad6e3..389006ad749 100644
--- a/chromium/third_party/skia/gm/quadpaths.cpp
+++ b/chromium/third_party/skia/gm/quadpaths.cpp
@@ -104,17 +104,17 @@ protected:
canvas->save();
canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1);
canvas->save();
- for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) {
+ for (size_t cap = 0; cap < std::size(gCaps); ++cap) {
if (0 < cap) {
- canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_COUNT(gStyles), 0);
+ canvas->translate((rect.width() + 40 * SK_Scalar1) * std::size(gStyles), 0);
}
canvas->save();
- for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) {
+ for (size_t fill = 0; fill < std::size(gFills); ++fill) {
if (0 < fill) {
canvas->translate(0, rect.height() + 40 * SK_Scalar1);
}
canvas->save();
- for (size_t style = 0; style < SK_ARRAY_COUNT(gStyles); ++style) {
+ for (size_t style = 0; style < std::size(gStyles); ++style) {
if (0 < style) {
canvas->translate(rect.width() + 40 * SK_Scalar1, 0);
}
@@ -234,17 +234,17 @@ protected:
canvas->save();
canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1);
canvas->save();
- for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) {
+ for (size_t cap = 0; cap < std::size(gCaps); ++cap) {
if (0 < cap) {
- canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_COUNT(gStyles), 0);
+ canvas->translate((rect.width() + 40 * SK_Scalar1) * std::size(gStyles), 0);
}
canvas->save();
- for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) {
+ for (size_t fill = 0; fill < std::size(gFills); ++fill) {
if (0 < fill) {
canvas->translate(0, rect.height() + 40 * SK_Scalar1);
}
canvas->save();
- for (size_t style = 0; style < SK_ARRAY_COUNT(gStyles); ++style) {
+ for (size_t style = 0; style < std::size(gStyles); ++style) {
if (0 < style) {
canvas->translate(rect.width() + 40 * SK_Scalar1, 0);
}
diff --git a/chromium/third_party/skia/gm/radial_gradient_precision.cpp b/chromium/third_party/skia/gm/radial_gradient_precision.cpp
index 8835fa59c4e..b38f32d4dc0 100644
--- a/chromium/third_party/skia/gm/radial_gradient_precision.cpp
+++ b/chromium/third_party/skia/gm/radial_gradient_precision.cpp
@@ -24,7 +24,7 @@ DEF_SIMPLE_GM(radial_gradient_precision, canvas, 200, 200) {
SkPaint p;
p.setShader(SkGradientShader::MakeRadial(center, radius,
- colors, nullptr, SK_ARRAY_COUNT(colors),
+ colors, nullptr, std::size(colors),
SkTileMode::kRepeat));
canvas->drawPaint(p);
}
diff --git a/chromium/third_party/skia/gm/rasterhandleallocator.cpp b/chromium/third_party/skia/gm/rasterhandleallocator.cpp
index fa4488bb3ae..e2e889a486e 100644
--- a/chromium/third_party/skia/gm/rasterhandleallocator.cpp
+++ b/chromium/third_party/skia/gm/rasterhandleallocator.cpp
@@ -255,7 +255,7 @@ public:
RECT clip_bounds_RECT = toRECT(clip_bounds);
HRGN hrgn = CreateRectRgnIndirect(&clip_bounds_RECT);
- SK_MAYBE_UNUSED int result = SelectClipRgn(hdc, hrgn);
+ [[maybe_unused]] int result = SelectClipRgn(hdc, hrgn);
SkASSERT(result != ERROR);
result = DeleteObject(hrgn);
SkASSERT(result != 0);
diff --git a/chromium/third_party/skia/gm/readpixels.cpp b/chromium/third_party/skia/gm/readpixels.cpp
index f12d45f2842..f5d9528bc39 100644
--- a/chromium/third_party/skia/gm/readpixels.cpp
+++ b/chromium/third_party/skia/gm/readpixels.cpp
@@ -23,7 +23,7 @@
#include "include/core/SkString.h"
#include "include/core/SkTypes.h"
#include "include/gpu/GrDirectContext.h"
-#include "include/third_party/skcms/skcms.h"
+#include "modules/skcms/skcms.h"
#include "tools/Resources.h"
#include <string.h>
diff --git a/chromium/third_party/skia/gm/recordopts.cpp b/chromium/third_party/skia/gm/recordopts.cpp
index bfee2ee74cf..59c0e891af9 100644
--- a/chromium/third_party/skia/gm/recordopts.cpp
+++ b/chromium/third_party/skia/gm/recordopts.cpp
@@ -156,7 +156,7 @@ DEF_SIMPLE_GM(recordopts, canvas, (kTestRectSize+1)*2, (kTestRectSize+1)*15) {
// the optimization applied.
SkColor shapeColor = SkColorSetARGB(255, 0, 255, 0);
- for (size_t k = 0; k < SK_ARRAY_COUNT(funcs); ++k) {
+ for (size_t k = 0; k < std::size(funcs); ++k) {
canvas->save();
TestVariantSequence drawTestSequence = funcs[k];
@@ -198,11 +198,11 @@ DEF_SIMPLE_GM(recordopts, canvas, (kTestRectSize+1)*2, (kTestRectSize+1)*15) {
install_detector_color_filter
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(shapeColors); ++i) {
+ for (size_t i = 0; i < std::size(shapeColors); ++i) {
shapeColor = shapeColors[i];
- for (size_t j = 0; j < SK_ARRAY_COUNT(detectorInstallFuncs); ++j) {
+ for (size_t j = 0; j < std::size(detectorInstallFuncs); ++j) {
InstallDetectorFunc detectorInstallFunc = detectorInstallFuncs[j];
- for (size_t k = 0; k < SK_ARRAY_COUNT(funcs); ++k) {
+ for (size_t k = 0; k < std::size(funcs); ++k) {
TestVariantSequence drawTestSequence = funcs[k];
canvas->save();
drawTestSequence(canvas, shapeColor, detectorInstallFunc);
diff --git a/chromium/third_party/skia/gm/roundrects.cpp b/chromium/third_party/skia/gm/roundrects.cpp
index e216bc4b04a..5a83172bd5f 100644
--- a/chromium/third_party/skia/gm/roundrects.cpp
+++ b/chromium/third_party/skia/gm/roundrects.cpp
@@ -269,7 +269,7 @@ protected:
SkPoint center = SkPoint::Make(SkIntToScalar(0), SkIntToScalar(0));
SkColor colors[] = { SK_ColorBLUE, SK_ColorRED, SK_ColorGREEN };
SkScalar pos[] = { 0, SK_ScalarHalf, SK_Scalar1 };
- auto shader = SkGradientShader::MakeRadial(center, 20, colors, pos, SK_ARRAY_COUNT(colors),
+ auto shader = SkGradientShader::MakeRadial(center, 20, colors, pos, std::size(colors),
SkTileMode::kClamp);
for (int i = 0; i < fPaints.count(); ++i) {
diff --git a/chromium/third_party/skia/gm/rrect.cpp b/chromium/third_party/skia/gm/rrect.cpp
index c9a536da7e3..b8c664c7ffc 100644
--- a/chromium/third_party/skia/gm/rrect.cpp
+++ b/chromium/third_party/skia/gm/rrect.cpp
@@ -160,9 +160,9 @@ protected:
rrect[3].setRectRadii(r, radii);
canvas->translate(50.5f, 50.5f);
- for (size_t j = 0; j < SK_ARRAY_COUNT(insetProcs); ++j) {
+ for (size_t j = 0; j < std::size(insetProcs); ++j) {
canvas->save();
- for (size_t i = 0; i < SK_ARRAY_COUNT(rrect); ++i) {
+ for (size_t i = 0; i < std::size(rrect); ++i) {
drawrr(canvas, rrect[i], insetProcs[j]);
canvas->translate(200, 0);
}
diff --git a/chromium/third_party/skia/gm/rrects.cpp b/chromium/third_party/skia/gm/rrects.cpp
index 12725ff1b2d..c7fedb18cb9 100644
--- a/chromium/third_party/skia/gm/rrects.cpp
+++ b/chromium/third_party/skia/gm/rrects.cpp
@@ -23,11 +23,11 @@
#include "src/gpu/ganesh/GrCaps.h"
#include "src/gpu/ganesh/GrFragmentProcessor.h"
#include "src/gpu/ganesh/GrPaint.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/effects/GrPorterDuffXferProcessor.h"
#include "src/gpu/ganesh/effects/GrRRectEffect.h"
#include "src/gpu/ganesh/ops/FillRectOp.h"
#include "src/gpu/ganesh/ops/GrDrawOp.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
#include <memory>
#include <utility>
@@ -193,7 +193,7 @@ protected:
// The first complex case needs special handling since it is a square
fRRects[kNumSimpleCases].setRectRadii(SkRect::MakeWH(kTileY-2, kTileY-2), gRadii[0]);
- for (size_t i = 1; i < SK_ARRAY_COUNT(gRadii); ++i) {
+ for (size_t i = 1; i < std::size(gRadii); ++i) {
fRRects[kNumSimpleCases+i].setRectRadii(SkRect::MakeWH(kTileX-2, kTileY-2), gRadii[i]);
}
// The last case is larger than kTileX-2 x kTileY-2 but will be drawn at an offset
diff --git a/chromium/third_party/skia/gm/rsxtext.cpp b/chromium/third_party/skia/gm/rsxtext.cpp
index 9df73f1a0d3..c4d184c1160 100644
--- a/chromium/third_party/skia/gm/rsxtext.cpp
+++ b/chromium/third_party/skia/gm/rsxtext.cpp
@@ -37,7 +37,7 @@ private:
SkGlyphID glyphs[16];
float widths[16];
const auto glyph_count = font.textToGlyphs(txt, strlen(txt), SkTextEncoding::kUTF8,
- glyphs, SK_ARRAY_COUNT(glyphs));
+ glyphs, std::size(glyphs));
font.getWidths(glyphs, glyph_count, widths);
SkTextBlobBuilder builder;
diff --git a/chromium/third_party/skia/gm/runtimecolorfilter.cpp b/chromium/third_party/skia/gm/runtimecolorfilter.cpp
index 8ff59267d21..65cd670342d 100644
--- a/chromium/third_party/skia/gm/runtimecolorfilter.cpp
+++ b/chromium/third_party/skia/gm/runtimecolorfilter.cpp
@@ -111,7 +111,7 @@ DEF_SIMPLE_GM(runtimecolorfilter, canvas, 256 * 3, 256 * 2) {
}
DEF_SIMPLE_GM(runtimecolorfilter_vertices_atlas_and_patch, canvas, 404, 404) {
- constexpr SkRect r = SkRect::MakeWH(128, 128);
+ const SkRect r = SkRect::MakeWH(128, 128);
// Make a vertices that draws the same as SkRect 'r'.
SkPoint pos[4];
diff --git a/chromium/third_party/skia/gm/runtimeimagefilter.cpp b/chromium/third_party/skia/gm/runtimeimagefilter.cpp
index e0166ae4584..f1b5bc0f12f 100644
--- a/chromium/third_party/skia/gm/runtimeimagefilter.cpp
+++ b/chromium/third_party/skia/gm/runtimeimagefilter.cpp
@@ -23,6 +23,8 @@
#include "tools/Resources.h"
#include "tools/ToolUtils.h"
+#include <string_view>
+
static sk_sp<SkImageFilter> make_filter() {
sk_sp<SkRuntimeEffect> effect = SkRuntimeEffect::MakeForShader(SkString(R"(
uniform shader child;
@@ -32,7 +34,7 @@ static sk_sp<SkImageFilter> make_filter() {
}
)")).effect;
SkRuntimeShaderBuilder builder(std::move(effect));
- return SkImageFilters::RuntimeShader(builder, /*childShaderName=*/nullptr, /*input=*/nullptr);
+ return SkImageFilters::RuntimeShader(builder, /*childShaderName=*/"", /*input=*/nullptr);
}
DEF_SIMPLE_GM_BG(rtif_distort, canvas, 500, 750, SK_ColorBLACK) {
@@ -89,7 +91,7 @@ DEF_SIMPLE_GM(rtif_unsharp, canvas, 512, 256) {
auto image = GetResourceAsImage("images/mandrill_256.png");
auto blurredSrc = SkImageFilters::Blur(1, 1, /*input=*/nullptr);
- const char* childNames[] = { "content", "blurred" };
+ std::string_view childNames[] = { "content", "blurred" };
sk_sp<SkImageFilter> childNodes[] = { nullptr, blurredSrc };
auto sharpened = SkImageFilters::RuntimeShader(builder, childNames, childNodes, 2);
diff --git a/chromium/third_party/skia/gm/runtimeshader.cpp b/chromium/third_party/skia/gm/runtimeshader.cpp
index 5d8f13779df..0843f63da61 100644
--- a/chromium/third_party/skia/gm/runtimeshader.cpp
+++ b/chromium/third_party/skia/gm/runtimeshader.cpp
@@ -414,13 +414,13 @@ public:
// Now draw the image with an identity color cube - it should look like the original
SkRuntimeEffect::ChildPtr children[] = {fIdentityCube->makeShader(sampling, normalize)};
paint.setColorFilter(fEffect->makeColorFilter(
- SkData::MakeWithCopy(uniforms, sizeof(uniforms)), SkMakeSpan(children)));
+ SkData::MakeWithCopy(uniforms, sizeof(uniforms)), SkSpan(children)));
canvas->drawImage(fMandrill, 256, 0, sampling, &paint);
// ... and with a sepia-tone color cube. This should match the sepia-toned image.
children[0] = fSepiaCube->makeShader(sampling, normalize);
paint.setColorFilter(fEffect->makeColorFilter(
- SkData::MakeWithCopy(uniforms, sizeof(uniforms)), SkMakeSpan(children)));
+ SkData::MakeWithCopy(uniforms, sizeof(uniforms)), SkSpan(children)));
canvas->drawImage(fMandrill, 256, 256, sampling, &paint);
}
};
@@ -890,3 +890,50 @@ DEF_SIMPLE_GM(lit_shader_linear_rt, canvas, 512, 256) {
// Now draw the offscreen surface back to our original canvas:
canvas->drawImage(surface->makeImageSnapshot(), 0, 0);
}
+
+// skbug.com/13598 GPU was double applying the local matrix.
+DEF_SIMPLE_GM(local_matrix_shader_rt, canvas, 256, 256) {
+ SkString passthrough(R"(
+ uniform shader s;
+ half4 main(float2 p) { return s.eval(p); }
+ )");
+ auto [rte, error] = SkRuntimeEffect::MakeForShader(passthrough, {});
+ if (!rte) {
+ SkDebugf("%s\n", error.c_str());
+ return;
+ }
+
+ auto image = GetResourceAsImage("images/mandrill_128.png");
+ auto imgShader = image->makeShader(SkSamplingOptions{});
+
+ auto r = SkRect::MakeWH(image->width(), image->height());
+
+ auto lm = SkMatrix::RotateDeg(90.f, {image->width()/2.f, image->height()/2.f});
+
+ SkPaint paint;
+
+ // image
+ paint.setShader(imgShader);
+ canvas->drawRect(r, paint);
+
+ // passthrough(image)
+ canvas->save();
+ canvas->translate(image->width(), 0);
+ paint.setShader(rte->makeShader(nullptr, &imgShader, 1));
+ canvas->drawRect(r, paint);
+ canvas->restore();
+
+ // localmatrix(image)
+ canvas->save();
+ canvas->translate(0, image->height());
+ paint.setShader(imgShader->makeWithLocalMatrix(lm));
+ canvas->drawRect(r, paint);
+ canvas->restore();
+
+ // localmatrix(passthrough(image)) This was the bug.
+ canvas->save();
+ canvas->translate(image->width(), image->height());
+ paint.setShader(rte->makeShader(nullptr, &imgShader, 1)->makeWithLocalMatrix(lm));
+ canvas->drawRect(r, paint);
+ canvas->restore();
+}
diff --git a/chromium/third_party/skia/gm/savelayer.cpp b/chromium/third_party/skia/gm/savelayer.cpp
index 57ae0527d6a..015c0b89e33 100644
--- a/chromium/third_party/skia/gm/savelayer.cpp
+++ b/chromium/third_party/skia/gm/savelayer.cpp
@@ -152,7 +152,7 @@ DEF_SIMPLE_GM(savelayer_f16, canvas, 900, 300) {
const SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorRED };
paint.setShader(SkGradientShader::MakeSweep(r.centerX(), r.centerY(),
- colors, nullptr, SK_ARRAY_COUNT(colors)));
+ colors, nullptr, std::size(colors)));
canvas->drawOval(r, paint);
diff --git a/chromium/third_party/skia/gm/scaledemoji_rendering.cpp b/chromium/third_party/skia/gm/scaledemoji_rendering.cpp
index 73bd71b2a85..c854ccfc509 100644
--- a/chromium/third_party/skia/gm/scaledemoji_rendering.cpp
+++ b/chromium/third_party/skia/gm/scaledemoji_rendering.cpp
@@ -43,9 +43,9 @@ protected:
{ Test::Source::Resource, "fonts/sbix.ttf" , sampleText },
{ Test::Source::Resource, "fonts/cbdt.ttf" , sampleText },
{ Test::Source::Portable, "Emoji" , sampleText },
- { Test::Source::Resource, "fonts/SampleSVG.ttf", "abcdefghi" },
+ { Test::Source::Resource, "fonts/SampleSVG.ttf", "abcdefghij" },
};
- sk_sp<SkTypeface> typefaces[SK_ARRAY_COUNT(tests)];
+ sk_sp<SkTypeface> typefaces[std::size(tests)];
void onOnceBeforeDraw() override {
for (auto&& [i, test] : SkMakeEnumerate(tests)) {
if (test.fontSource == Test::Source::Resource) {
diff --git a/chromium/third_party/skia/gm/shadertext3.cpp b/chromium/third_party/skia/gm/shadertext3.cpp
index 661d684168c..0e4450dfb27 100644
--- a/chromium/third_party/skia/gm/shadertext3.cpp
+++ b/chromium/third_party/skia/gm/shadertext3.cpp
@@ -44,10 +44,10 @@ static void makebm(SkBitmap* bm, int w, int h) {
SkPaint paint;
paint.setShader(SkGradientShader::MakeLinear(kPts0, kColors0, kPos,
- SK_ARRAY_COUNT(kColors0), SkTileMode::kClamp));
+ std::size(kColors0), SkTileMode::kClamp));
canvas.drawPaint(paint);
paint.setShader(SkGradientShader::MakeLinear(kPts1, kColors1, kPos,
- SK_ARRAY_COUNT(kColors1), SkTileMode::kClamp));
+ std::size(kColors1), SkTileMode::kClamp));
canvas.drawPaint(paint);
}
@@ -107,8 +107,8 @@ protected:
canvas->save();
int i = 0;
- for (size_t tm0 = 0; tm0 < SK_ARRAY_COUNT(kTileModes); ++tm0) {
- for (size_t tm1 = 0; tm1 < SK_ARRAY_COUNT(kTileModes); ++tm1) {
+ for (size_t tm0 = 0; tm0 < std::size(kTileModes); ++tm0) {
+ for (size_t tm1 = 0; tm1 < std::size(kTileModes); ++tm1) {
SkMatrix localM;
localM.setTranslate(5.f, 5.f);
localM.postRotate(20);
diff --git a/chromium/third_party/skia/gm/shadowutils.cpp b/chromium/third_party/skia/gm/shadowutils.cpp
index 5364c08782c..353a6d99aa1 100644
--- a/chromium/third_party/skia/gm/shadowutils.cpp
+++ b/chromium/third_party/skia/gm/shadowutils.cpp
@@ -242,7 +242,7 @@ DEF_SIMPLE_GM(shadow_utils_gaussian_colorfilter, canvas, 512, 256) {
const SkColor colors[] = { 0, 0xFF000000 };
auto sh = SkGradientShader::MakeRadial({r.centerX(), r.centerY()}, r.width(),
- colors, nullptr, SK_ARRAY_COUNT(colors),
+ colors, nullptr, std::size(colors),
SkTileMode::kClamp);
SkPaint redPaint;
diff --git a/chromium/third_party/skia/gm/shallowgradient.cpp b/chromium/third_party/skia/gm/shallowgradient.cpp
index fc959f36deb..bfe8c64e477 100644
--- a/chromium/third_party/skia/gm/shallowgradient.cpp
+++ b/chromium/third_party/skia/gm/shallowgradient.cpp
@@ -60,7 +60,7 @@ private:
void onDraw(SkCanvas* canvas) override {
const SkColor colors[] = { 0xFF555555, 0xFF444444 };
- const int colorCount = SK_ARRAY_COUNT(colors);
+ const int colorCount = std::size(colors);
SkRect r = { 0, 0, this->width(), this->height() };
SkSize size = SkSize::Make(r.width(), r.height());
diff --git a/chromium/third_party/skia/gm/sharedcorners.cpp b/chromium/third_party/skia/gm/sharedcorners.cpp
index cc00432afad..ae2ffb5566e 100644
--- a/chromium/third_party/skia/gm/sharedcorners.cpp
+++ b/chromium/third_party/skia/gm/sharedcorners.cpp
@@ -42,7 +42,7 @@ protected:
SkISize onISize() override {
constexpr int numRows = 3 * 2;
- constexpr int numCols = (1 + SK_ARRAY_COUNT(kJitters)) * 2;
+ constexpr int numCols = (1 + std::size(kJitters)) * 2;
return SkISize::Make(numCols * (kBoxSize + kPadSize) + kPadSize,
numRows * (kBoxSize + kPadSize) + kPadSize);
}
diff --git a/chromium/third_party/skia/gm/showmiplevels.cpp b/chromium/third_party/skia/gm/showmiplevels.cpp
index 65cccbef31d..473645a2588 100644
--- a/chromium/third_party/skia/gm/showmiplevels.cpp
+++ b/chromium/third_party/skia/gm/showmiplevels.cpp
@@ -41,7 +41,7 @@ class ShowMipLevels3 : public skiagm::GM {
SkMipmapBuilder builder(fImg->imageInfo());
for (int i = 0; i < builder.countLevels(); ++i) {
auto surf = SkSurface::MakeRasterDirect(builder.level(i));
- surf->getCanvas()->drawColor(colors[i % SK_ARRAY_COUNT(colors)]);
+ surf->getCanvas()->drawColor(colors[i % std::size(colors)]);
}
fImg = builder.attachTo(fImg.get());
}
diff --git a/chromium/third_party/skia/gm/simpleaaclip.cpp b/chromium/third_party/skia/gm/simpleaaclip.cpp
index ff7762bbb2e..c1490836134 100644
--- a/chromium/third_party/skia/gm/simpleaaclip.cpp
+++ b/chromium/third_party/skia/gm/simpleaaclip.cpp
@@ -169,7 +169,7 @@ protected:
SkFont font(ToolUtils::create_portable_typeface(), 24);
int xOff = 0;
- for (size_t op = 0; op < SK_ARRAY_COUNT(gOps); op++) {
+ for (size_t op = 0; op < std::size(gOps); op++) {
canvas->drawString(gOps[op].fName, 75.0f, 50.0f, font, textPaint);
if (kAAClip_GeomType == fGeomType) {
diff --git a/chromium/third_party/skia/gm/smallpaths.cpp b/chromium/third_party/skia/gm/smallpaths.cpp
index c121cc49f84..2c94c5d17ba 100644
--- a/chromium/third_party/skia/gm/smallpaths.cpp
+++ b/chromium/third_party/skia/gm/smallpaths.cpp
@@ -283,7 +283,7 @@ constexpr SkScalar gWidths[] = {
0.0f,
0.0f
};
-static_assert(SK_ARRAY_COUNT(gWidths) == SK_ARRAY_COUNT(gProcs));
+static_assert(std::size(gWidths) == std::size(gProcs));
constexpr SkScalar gMiters[] = {
2.0f,
@@ -298,7 +298,7 @@ constexpr SkScalar gMiters[] = {
4.0f,
4.0f,
};
-static_assert(SK_ARRAY_COUNT(gMiters) == SK_ARRAY_COUNT(gProcs));
+static_assert(std::size(gMiters) == std::size(gProcs));
constexpr SkScalar gXTranslate[] = {
0.0f,
@@ -313,9 +313,9 @@ constexpr SkScalar gXTranslate[] = {
0.0f,
0.0f,
};
-static_assert(SK_ARRAY_COUNT(gXTranslate) == SK_ARRAY_COUNT(gProcs));
+static_assert(std::size(gXTranslate) == std::size(gProcs));
-#define N SK_ARRAY_COUNT(gProcs)
+#define N std::size(gProcs)
// This GM tests out drawing small paths (i.e., for Ganesh, using the Distance
// Field path renderer) which are filled, stroked and filledAndStroked. In
diff --git a/chromium/third_party/skia/gm/srcmode.cpp b/chromium/third_party/skia/gm/srcmode.cpp
index fad75a88ad6..f2b9eeea6bb 100644
--- a/chromium/third_party/skia/gm/srcmode.cpp
+++ b/chromium/third_party/skia/gm/srcmode.cpp
@@ -39,7 +39,7 @@ static void identity_paintproc(SkPaint* paint) {
static void gradient_paintproc(SkPaint* paint) {
const SkColor colors[] = { SK_ColorGREEN, SK_ColorBLUE };
const SkPoint pts[] = { { 0, 0 }, { W, H } };
- paint->setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
+ paint->setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, std::size(colors),
SkTileMode::kClamp));
}
@@ -101,12 +101,12 @@ class SrcModeGM : public skiagm::GM {
paint.setAntiAlias(SkToBool(aa));
font.setEdging(SkToBool(aa) ? SkFont::Edging::kAntiAlias : SkFont::Edging::kAlias);
canvas->save();
- for (size_t i = 0; i < SK_ARRAY_COUNT(paintProcs); ++i) {
+ for (size_t i = 0; i < std::size(paintProcs); ++i) {
paintProcs[i](&paint);
- for (size_t x = 0; x < SK_ARRAY_COUNT(modes); ++x) {
+ for (size_t x = 0; x < std::size(modes); ++x) {
paint.setBlendMode(modes[x]);
canvas->save();
- for (size_t y = 0; y < SK_ARRAY_COUNT(procs); ++y) {
+ for (size_t y = 0; y < std::size(procs); ++y) {
procs[y](canvas, paint, font);
canvas->translate(0, H * 5 / 4);
}
@@ -115,7 +115,7 @@ class SrcModeGM : public skiagm::GM {
}
}
canvas->restore();
- canvas->translate(0, (H * 5 / 4) * SK_ARRAY_COUNT(procs));
+ canvas->translate(0, (H * 5 / 4) * std::size(procs));
}
}
diff --git a/chromium/third_party/skia/gm/strokedlines.cpp b/chromium/third_party/skia/gm/strokedlines.cpp
index 8c502955a2f..405b43de69e 100644
--- a/chromium/third_party/skia/gm/strokedlines.cpp
+++ b/chromium/third_party/skia/gm/strokedlines.cpp
@@ -150,7 +150,7 @@ protected:
{
// dashing
SkScalar intervals[] = { kStrokeWidth, kStrokeWidth };
- int intervalCount = (int) SK_ARRAY_COUNT(intervals);
+ int intervalCount = (int) std::size(intervals);
SkPaint p;
p.setColor(SK_ColorWHITE);
p.setPathEffect(SkDashPathEffect::Make(intervals, intervalCount, kStrokeWidth));
diff --git a/chromium/third_party/skia/gm/strokefill.cpp b/chromium/third_party/skia/gm/strokefill.cpp
index d990017d22c..3113fb96595 100644
--- a/chromium/third_party/skia/gm/strokefill.cpp
+++ b/chromium/third_party/skia/gm/strokefill.cpp
@@ -228,7 +228,7 @@ static SkPath papyrus_hello() {
/* Generated on a Mac with:
* paint.setTypeface(SkTypeface::CreateByName("Hiragino Maru Gothic Pro"));
* const unsigned char hyphen[] = { 0xE3, 0x83, 0xBC };
- * paint.getTextPath(hyphen, SK_ARRAY_COUNT(hyphen), 400, 80, &textPath);
+ * paint.getTextPath(hyphen, std::size(hyphen), 400, 80, &textPath);
*/
static SkPath hiragino_maru_gothic_pro_dash() {
SkPath path;
diff --git a/chromium/third_party/skia/gm/strokerect.cpp b/chromium/third_party/skia/gm/strokerect.cpp
index 364f5886e49..e5a8ea19cdd 100644
--- a/chromium/third_party/skia/gm/strokerect.cpp
+++ b/chromium/third_party/skia/gm/strokerect.cpp
@@ -96,12 +96,12 @@ protected:
};
for (int doFill = 0; doFill <= 1; ++doFill) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(gJoins); ++i) {
+ for (size_t i = 0; i < std::size(gJoins); ++i) {
SkPaint::Join join = gJoins[i];
paint.setStrokeJoin(join);
SkAutoCanvasRestore acr(canvas, true);
- for (size_t j = 0; j < SK_ARRAY_COUNT(gRects); ++j) {
+ for (size_t j = 0; j < std::size(gRects); ++j) {
const SkRect& r = gRects[j];
SkPath path, fillPath;
diff --git a/chromium/third_party/skia/gm/strokes.cpp b/chromium/third_party/skia/gm/strokes.cpp
index 455e30a247d..285f4d328e9 100644
--- a/chromium/third_party/skia/gm/strokes.cpp
+++ b/chromium/third_party/skia/gm/strokes.cpp
@@ -415,7 +415,7 @@ protected:
SkScalar dx = bounds.width() * 4/3;
SkScalar dy = bounds.height() * 5;
- for (size_t i = 0; i < SK_ARRAY_COUNT(procs); ++i) {
+ for (size_t i = 0; i < std::size(procs); ++i) {
SkPath orig;
SkString str;
procs[i](&orig, bounds, &str);
@@ -604,7 +604,7 @@ DEF_SIMPLE_GM(inner_join_geometry, canvas, 1000, 700) {
skeletonPaint.setColor(SK_ColorRED);
canvas->translate(0, 50);
- for (size_t i = 0; i < SK_ARRAY_COUNT(pathPoints) / 3; i++) {
+ for (size_t i = 0; i < std::size(pathPoints) / 3; i++) {
auto path = SkPath::Polygon(pathPoints + i * 3, 3, false);
canvas->drawPath(path, pathPaint);
diff --git a/chromium/third_party/skia/gm/stroketext.cpp b/chromium/third_party/skia/gm/stroketext.cpp
index 98e670a9ff6..f80e15c90c8 100644
--- a/chromium/third_party/skia/gm/stroketext.cpp
+++ b/chromium/third_party/skia/gm/stroketext.cpp
@@ -72,7 +72,7 @@ static void draw_text_set(SkCanvas* canvas, const SkPaint& paint, const SkFont&
canvas->translate(200, 0);
SkPaint p(paint);
- p.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), phase));
+ p.setPathEffect(SkDashPathEffect::Make(intervals, std::size(intervals), phase));
draw_text_stroked(canvas, p, font, 10);
}
@@ -110,7 +110,7 @@ DEF_SIMPLE_GM_CAN_FAIL(stroketext_native, canvas, msg, 650, 420) {
{ SkSetFourByteTag('w','g','h','t'), 721.0f },
};
SkFontArguments params;
- params.setVariationDesignPosition({position, SK_ARRAY_COUNT(position)});
+ params.setVariationDesignPosition({position, std::size(position)});
return SkFontMgr::RefDefault()->makeFromStream(std::move(variableStream), params);
}();
diff --git a/chromium/third_party/skia/gm/swizzle.cpp b/chromium/third_party/skia/gm/swizzle.cpp
index da9b838e3c6..1ddfa6a9316 100644
--- a/chromium/third_party/skia/gm/swizzle.cpp
+++ b/chromium/third_party/skia/gm/swizzle.cpp
@@ -27,7 +27,8 @@ DEF_SIMPLE_GPU_GM(swizzle, rContext, canvas, 512, 512) {
SkBitmap bmp;
GetResourceAsBitmap("images/mandrill_512_q075.jpg", &bmp);
- auto view = std::get<0>(GrMakeCachedBitmapProxyView(rContext, bmp, GrMipmapped::kNo));
+ auto view = std::get<0>(
+ GrMakeCachedBitmapProxyView(rContext, bmp, /*label=*/"Gm_Swizzle", GrMipmapped::kNo));
if (!view) {
return;
}
diff --git a/chromium/third_party/skia/gm/tablecolorfilter.cpp b/chromium/third_party/skia/gm/tablecolorfilter.cpp
index 101905dc1c1..c7f6746126f 100644
--- a/chromium/third_party/skia/gm/tablecolorfilter.cpp
+++ b/chromium/third_party/skia/gm/tablecolorfilter.cpp
@@ -35,7 +35,7 @@ static sk_sp<SkShader> make_shader0(int w, int h) {
SK_ColorBLACK, SK_ColorGREEN, SK_ColorCYAN,
SK_ColorRED, 0, SK_ColorBLUE, SK_ColorWHITE
};
- return SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
+ return SkGradientShader::MakeLinear(pts, colors, nullptr, std::size(colors),
SkTileMode::kClamp);
}
static void make_bm0(SkBitmap* bm) {
@@ -56,7 +56,7 @@ static sk_sp<SkShader> make_shader1(int w, int h) {
SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE,
};
return SkGradientShader::MakeRadial(SkPoint::Make(cx, cy), cx, colors, nullptr,
- SK_ARRAY_COUNT(colors), SkTileMode::kClamp);
+ std::size(colors), SkTileMode::kClamp);
}
static void make_bm1(SkBitmap* bm) {
int W = 120;
@@ -157,7 +157,7 @@ protected:
// 22
SkScalar x = 0, y = 0;
- for (size_t bitmapMaker = 0; bitmapMaker < SK_ARRAY_COUNT(gBitmapMakers); ++bitmapMaker) {
+ for (size_t bitmapMaker = 0; bitmapMaker < std::size(gBitmapMakers); ++bitmapMaker) {
SkBitmap bm;
gBitmapMakers[bitmapMaker](&bm);
@@ -173,7 +173,7 @@ protected:
// Draws the rest of the first line for this bitmap
// each draw being at xOffset of the previous one
- for (unsigned i = 1; i < SK_ARRAY_COUNT(gColorFilterMakers); ++i) {
+ for (unsigned i = 1; i < std::size(gColorFilterMakers); ++i) {
x += xOffset;
paint.setColorFilter(gColorFilterMakers[i]());
canvas->drawImage(bm.asImage(), x, y, sampling, &paint);
@@ -181,7 +181,7 @@ protected:
paint.setColorFilter(nullptr);
- for (unsigned i = 0; i < SK_ARRAY_COUNT(gColorFilterMakers); ++i) {
+ for (unsigned i = 0; i < std::size(gColorFilterMakers); ++i) {
sk_sp<SkColorFilter> colorFilter1(gColorFilterMakers[i]());
sk_sp<SkImageFilter> imageFilter1(SkImageFilters::ColorFilter(
std::move(colorFilter1), nullptr));
@@ -190,7 +190,7 @@ protected:
// each draw being at xOffset of the previous one
y += yOffset;
x = 0;
- for (unsigned j = 1; j < SK_ARRAY_COUNT(gColorFilterMakers); ++j) {
+ for (unsigned j = 1; j < std::size(gColorFilterMakers); ++j) {
sk_sp<SkColorFilter> colorFilter2(gColorFilterMakers[j]());
sk_sp<SkImageFilter> imageFilter2(SkImageFilters::ColorFilter(
std::move(colorFilter2), imageFilter1, nullptr));
diff --git a/chromium/third_party/skia/gm/tallstretchedbitmaps.cpp b/chromium/third_party/skia/gm/tallstretchedbitmaps.cpp
index 7d2b3b251c1..4023c64ad35 100644
--- a/chromium/third_party/skia/gm/tallstretchedbitmaps.cpp
+++ b/chromium/third_party/skia/gm/tallstretchedbitmaps.cpp
@@ -76,7 +76,7 @@ protected:
}
void onOnceBeforeDraw() override {
- for (size_t i = 0; i < SK_ARRAY_COUNT(fTallBmps); ++i) {
+ for (size_t i = 0; i < std::size(fTallBmps); ++i) {
int h = SkToInt((4 + i) * 1024);
fTallBmps[i].fItemCnt = make_bm(&fTallBmps[i].fBmp, h);
@@ -85,7 +85,7 @@ protected:
void onDraw(SkCanvas* canvas) override {
canvas->scale(1.3f, 1.3f);
- for (size_t i = 0; i < SK_ARRAY_COUNT(fTallBmps); ++i) {
+ for (size_t i = 0; i < std::size(fTallBmps); ++i) {
SkASSERT(fTallBmps[i].fItemCnt > 10);
SkBitmap bmp = fTallBmps[i].fBmp;
// Draw the last 10 elements of the bitmap.
diff --git a/chromium/third_party/skia/gm/texelsubset.cpp b/chromium/third_party/skia/gm/texelsubset.cpp
index cdad2e9970c..72b1f2b2a4b 100644
--- a/chromium/third_party/skia/gm/texelsubset.cpp
+++ b/chromium/third_party/skia/gm/texelsubset.cpp
@@ -22,8 +22,8 @@
#include "src/gpu/ganesh/GrProxyProvider.h"
#include "src/gpu/ganesh/GrSamplerState.h"
#include "src/gpu/ganesh/SkGr.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/effects/GrTextureEffect.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
#include "tools/Resources.h"
#include "tools/gpu/TestOps.h"
@@ -96,7 +96,8 @@ protected:
if (mipmapped == GrMipmapped::kYes && !rContext->priv().caps()->mipmapSupport()) {
return DrawResult::kSkip;
}
- auto view = std::get<0>(GrMakeCachedBitmapProxyView(rContext, fBitmap, mipmapped));
+ auto view = std::get<0>(GrMakeCachedBitmapProxyView(
+ rContext, fBitmap, /*label=*/"DrawResult_Draw_BitMap", mipmapped));
if (!view) {
*errorMsg = "Failed to create proxy.";
return DrawResult::kFail;
@@ -129,7 +130,8 @@ protected:
SkBitmap subsetBmp;
fBitmap.extractSubset(&subsetBmp, texelSubset);
subsetBmp.setImmutable();
- auto subsetView = std::get<0>(GrMakeCachedBitmapProxyView(rContext, subsetBmp, mipmapped));
+ auto subsetView = std::get<0>(GrMakeCachedBitmapProxyView(
+ rContext, subsetBmp, /*label=*/"DrawResult_Draw_SubsetBitMap", mipmapped));
SkRect localRect = SkRect::Make(fBitmap.bounds()).makeOutset(kDrawPad, kDrawPad);
diff --git a/chromium/third_party/skia/gm/textblob.cpp b/chromium/third_party/skia/gm/textblob.cpp
index 60cec2acde0..ce3d187ec86 100644
--- a/chromium/third_party/skia/gm/textblob.cpp
+++ b/chromium/third_party/skia/gm/textblob.cpp
@@ -104,7 +104,7 @@ protected:
}
void onDraw(SkCanvas* canvas) override {
- for (unsigned b = 0; b < SK_ARRAY_COUNT(blobConfigs); ++b) {
+ for (unsigned b = 0; b < std::size(blobConfigs); ++b) {
sk_sp<SkTextBlob> blob(this->makeBlob(b));
SkPaint p;
@@ -133,10 +133,10 @@ private:
font.setEdging(SkFont::Edging::kAntiAlias);
font.setTypeface(fTypeface);
- for (unsigned l = 0; l < SK_ARRAY_COUNT(blobConfigs[blobIndex]); ++l) {
+ for (unsigned l = 0; l < std::size(blobConfigs[blobIndex]); ++l) {
unsigned currentGlyph = 0;
- for (unsigned c = 0; c < SK_ARRAY_COUNT(blobConfigs[blobIndex][l]); ++c) {
+ for (unsigned c = 0; c < std::size(blobConfigs[blobIndex][l]); ++c) {
const BlobCfg* cfg = &blobConfigs[blobIndex][l][c];
unsigned count = cfg->count;
diff --git a/chromium/third_party/skia/gm/textblobcolortrans.cpp b/chromium/third_party/skia/gm/textblobcolortrans.cpp
index 1a189d23068..a9a013c7fd3 100644
--- a/chromium/third_party/skia/gm/textblobcolortrans.cpp
+++ b/chromium/third_party/skia/gm/textblobcolortrans.cpp
@@ -79,7 +79,7 @@ protected:
// create masks. For A8 there are 8 of them.
SkColor colors[] = {SK_ColorCYAN, SK_ColorLTGRAY, SK_ColorYELLOW, SK_ColorWHITE};
- size_t count = SK_ARRAY_COUNT(colors);
+ size_t count = std::size(colors);
size_t colorIndex = 0;
for (int y = 0; y + SkScalarFloorToInt(bounds.height()) < kHeight;
y += SkScalarFloorToInt(bounds.height())) {
diff --git a/chromium/third_party/skia/gm/textblobshader.cpp b/chromium/third_party/skia/gm/textblobshader.cpp
index 455667a126c..14ff32a3d25 100644
--- a/chromium/third_party/skia/gm/textblobshader.cpp
+++ b/chromium/third_party/skia/gm/textblobshader.cpp
@@ -75,16 +75,16 @@ private:
colors[0] = SK_ColorRED;
colors[1] = SK_ColorGREEN;
- SkScalar pos[SK_ARRAY_COUNT(colors)];
- for (unsigned i = 0; i < SK_ARRAY_COUNT(pos); ++i) {
- pos[i] = (float)i / (SK_ARRAY_COUNT(pos) - 1);
+ SkScalar pos[std::size(colors)];
+ for (unsigned i = 0; i < std::size(pos); ++i) {
+ pos[i] = (float)i / (std::size(pos) - 1);
}
SkISize sz = this->onISize();
fShader = SkGradientShader::MakeRadial(SkPoint::Make(SkIntToScalar(sz.width() / 2),
SkIntToScalar(sz.height() / 2)),
sz.width() * .66f, colors, pos,
- SK_ARRAY_COUNT(colors),
+ std::size(colors),
SkTileMode::kRepeat);
}
diff --git a/chromium/third_party/skia/gm/texteffects.cpp b/chromium/third_party/skia/gm/texteffects.cpp
index 75ca5f3604f..49a1b29bd63 100644
--- a/chromium/third_party/skia/gm/texteffects.cpp
+++ b/chromium/third_party/skia/gm/texteffects.cpp
@@ -113,7 +113,7 @@ DEF_SIMPLE_GM(fancyblobunderline, canvas, 1480, 1380) {
const char test[] = "aAjJgGyY_|{-(~[,]qQ}pP}zZ";
const SkPoint blobOffset = { 10, 80 };
- for (size_t font = 0; font < SK_ARRAY_COUNT(fam); ++font) {
+ for (size_t font = 0; font < std::size(fam); ++font) {
for (SkScalar textSize = 100; textSize > 10; textSize -= 20) {
SkFont skFont(ToolUtils::create_portable_typeface(fam[font], SkFontStyle()), textSize);
const SkScalar uWidth = textSize / 15;
diff --git a/chromium/third_party/skia/gm/thinrects.cpp b/chromium/third_party/skia/gm/thinrects.cpp
index faf2be0eb3a..8f627192de5 100644
--- a/chromium/third_party/skia/gm/thinrects.cpp
+++ b/chromium/third_party/skia/gm/thinrects.cpp
@@ -88,7 +88,7 @@ private:
static constexpr SkVector radii[4] = {{1/32.f, 2/32.f}, {3/32.f, 1/32.f}, {2/32.f, 3/32.f},
{1/32.f, 3/32.f}};
SkRRect rrect;
- for (size_t j = 0; j < SK_ARRAY_COUNT(vertRects); ++j) {
+ for (size_t j = 0; j < std::size(vertRects); ++j) {
if (fRound) {
rrect.setRectRadii(vertRects[j], radii);
canvas->drawRRect(rrect, p);
@@ -110,7 +110,7 @@ private:
};
SkRRect rrect;
- for (size_t j = 0; j < SK_ARRAY_COUNT(horizRects); ++j) {
+ for (size_t j = 0; j < std::size(horizRects); ++j) {
if (fRound) {
rrect.setNinePatch(horizRects[j], 1/32.f, 2/32.f, 3/32.f, 4/32.f);
canvas->drawRRect(rrect, p);
@@ -132,7 +132,7 @@ private:
};
SkRRect rrect;
- for (size_t j = 0; j < SK_ARRAY_COUNT(squares); ++j) {
+ for (size_t j = 0; j < std::size(squares); ++j) {
if (fRound) {
rrect.setRectXY(squares[j], 1/32.f, 2/32.f);
canvas->drawRRect(rrect, p);
diff --git a/chromium/third_party/skia/gm/thinstrokedrects.cpp b/chromium/third_party/skia/gm/thinstrokedrects.cpp
index ba91499a727..f6d765eaccf 100644
--- a/chromium/third_party/skia/gm/thinstrokedrects.cpp
+++ b/chromium/third_party/skia/gm/thinstrokedrects.cpp
@@ -51,7 +51,7 @@ protected:
for (int i = 0; i < 8; ++i) {
canvas->save();
canvas->translate(i*0.125f, i*30.0f);
- for (size_t j = 0; j < SK_ARRAY_COUNT(gStrokeWidths); ++j) {
+ for (size_t j = 0; j < std::size(gStrokeWidths); ++j) {
paint.setStrokeWidth(gStrokeWidths[j]);
canvas->drawRect(rect, paint);
canvas->translate(15, 0);
@@ -66,7 +66,7 @@ protected:
canvas->save();
canvas->translate(i*0.125f, i*30.0f);
canvas->scale(0.5f, 0.5f);
- for (size_t j = 0; j < SK_ARRAY_COUNT(gStrokeWidths); ++j) {
+ for (size_t j = 0; j < std::size(gStrokeWidths); ++j) {
paint.setStrokeWidth(2.0f * gStrokeWidths[j]);
canvas->drawRect(rect2, paint);
canvas->translate(30, 0);
diff --git a/chromium/third_party/skia/gm/tilemodes.cpp b/chromium/third_party/skia/gm/tilemodes.cpp
index eb464e66a3d..963a9070627 100644
--- a/chromium/third_party/skia/gm/tilemodes.cpp
+++ b/chromium/third_party/skia/gm/tilemodes.cpp
@@ -41,7 +41,7 @@ static void makebm(SkBitmap* bm, SkColorType ct, int w, int h) {
SkPaint paint;
paint.setDither(true);
- paint.setShader(SkGradientShader::MakeLinear(pts, colors, pos, SK_ARRAY_COUNT(colors),
+ paint.setShader(SkGradientShader::MakeLinear(pts, colors, pos, std::size(colors),
SkTileMode::kClamp));
canvas.drawPaint(paint);
}
@@ -64,7 +64,7 @@ public:
: fPowerOfTwoSize(powerOfTwoSize) {
}
- SkBitmap fTexture[SK_ARRAY_COUNT(gColorTypes)];
+ SkBitmap fTexture[std::size(gColorTypes)];
protected:
@@ -85,7 +85,7 @@ protected:
void onOnceBeforeDraw() override {
int size = fPowerOfTwoSize ? kPOTSize : kNPOTSize;
- for (size_t i = 0; i < SK_ARRAY_COUNT(gColorTypes); i++) {
+ for (size_t i = 0; i < std::size(gColorTypes); i++) {
makebm(&fTexture[i], gColorTypes[i], size, size);
}
}
@@ -110,8 +110,8 @@ protected:
SkScalar y = SkIntToScalar(24);
SkScalar x = SkIntToScalar(10);
- for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) {
- for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) {
+ for (size_t kx = 0; kx < std::size(gModes); kx++) {
+ for (size_t ky = 0; ky < std::size(gModes); ky++) {
SkPaint p;
p.setDither(true);
SkString str;
@@ -126,11 +126,11 @@ protected:
y += SkIntToScalar(16);
- for (size_t i = 0; i < SK_ARRAY_COUNT(gColorTypes); i++) {
- for (size_t j = 0; j < SK_ARRAY_COUNT(gFilters); j++) {
+ for (size_t i = 0; i < std::size(gColorTypes); i++) {
+ for (size_t j = 0; j < std::size(gFilters); j++) {
x = SkIntToScalar(10);
- for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) {
- for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) {
+ for (size_t kx = 0; kx < std::size(gModes); kx++) {
+ for (size_t ky = 0; ky < std::size(gModes); ky++) {
SkPaint paint;
#if 1 // Temporary change to regen bitmap before each draw. This may help tracking down an issue
// on SGX where resizing NPOT textures to POT textures exhibits a driver bug.
@@ -182,12 +182,12 @@ static sk_sp<SkShader> make_grad(SkTileMode tx, SkTileMode ty) {
int index = (int)ty;
switch (index % 3) {
case 0:
- return SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors), tx);
+ return SkGradientShader::MakeLinear(pts, colors, nullptr, std::size(colors), tx);
case 1:
- return SkGradientShader::MakeRadial(center, rad, colors, nullptr, SK_ARRAY_COUNT(colors), tx);
+ return SkGradientShader::MakeRadial(center, rad, colors, nullptr, std::size(colors), tx);
case 2:
return SkGradientShader::MakeSweep(center.fX, center.fY, colors, nullptr,
- SK_ARRAY_COUNT(colors), tx, 135, 225, 0, nullptr);
+ std::size(colors), tx, 135, 225, 0, nullptr);
}
return nullptr;
}
@@ -225,7 +225,7 @@ private:
SkFont font(ToolUtils::create_portable_typeface());
- for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) {
+ for (size_t kx = 0; kx < std::size(gModes); kx++) {
SkString str(gModeNames[kx]);
SkTextUtils::DrawString(canvas, str.c_str(), x + r.width()/2, y, font, SkPaint(),
SkTextUtils::kCenter_Align);
@@ -234,7 +234,7 @@ private:
y += SkIntToScalar(16) + h;
- for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) {
+ for (size_t ky = 0; ky < std::size(gModes); ky++) {
x = SkIntToScalar(16) + w;
SkString str(gModeNames[ky]);
@@ -242,7 +242,7 @@ private:
SkTextUtils::kRight_Align);
x += SkIntToScalar(50);
- for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) {
+ for (size_t kx = 0; kx < std::size(gModes); kx++) {
SkPaint paint;
paint.setShader(fProc(gModes[kx], gModes[ky]));
@@ -288,13 +288,13 @@ DEF_SIMPLE_GM(tilemode_decal, canvas, 720, 1100) {
SkColor colors[] = { SK_ColorRED, SK_ColorBLUE };
const SkPoint pts[] = {{ 0, 0 }, {img->width()*1.0f, img->height()*1.0f }};
const SkScalar* pos = nullptr;
- const int count = SK_ARRAY_COUNT(colors);
+ const int count = std::size(colors);
paint->setShader(SkGradientShader::MakeLinear(pts, colors, pos, count, tx));
},
[img](SkPaint* paint, SkTileMode tx, SkTileMode ty) {
SkColor colors[] = { SK_ColorRED, SK_ColorBLUE };
const SkScalar* pos = nullptr;
- const int count = SK_ARRAY_COUNT(colors);
+ const int count = std::size(colors);
paint->setShader(SkGradientShader::MakeRadial({ img->width()*0.5f, img->width()*0.5f },
img->width()*0.5f, colors, pos, count, tx));
},
diff --git a/chromium/third_party/skia/gm/tilemodes_scaled.cpp b/chromium/third_party/skia/gm/tilemodes_scaled.cpp
index 168a439d107..6291f2cf0a8 100644
--- a/chromium/third_party/skia/gm/tilemodes_scaled.cpp
+++ b/chromium/third_party/skia/gm/tilemodes_scaled.cpp
@@ -46,7 +46,7 @@ static void makebm(SkBitmap* bm, SkColorType ct, int w, int h) {
paint.setDither(true);
paint.setShader(SkGradientShader::MakeLinear(pts, colors, pos,
- SK_ARRAY_COUNT(colors), SkTileMode::kClamp));
+ std::size(colors), SkTileMode::kClamp));
canvas.drawPaint(paint);
}
@@ -66,7 +66,7 @@ public:
: fPowerOfTwoSize(powerOfTwoSize) {
}
- SkBitmap fTexture[SK_ARRAY_COUNT(gColorTypes)];
+ SkBitmap fTexture[std::size(gColorTypes)];
protected:
enum {
@@ -86,7 +86,7 @@ protected:
void onOnceBeforeDraw() override {
int size = fPowerOfTwoSize ? kPOTSize : kNPOTSize;
- for (size_t i = 0; i < SK_ARRAY_COUNT(gColorTypes); i++) {
+ for (size_t i = 0; i < std::size(gColorTypes); i++) {
makebm(&fTexture[i], gColorTypes[i], size, size);
}
}
@@ -112,8 +112,8 @@ protected:
SkScalar y = SkIntToScalar(24);
SkScalar x = SkIntToScalar(10)/scale;
- for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) {
- for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) {
+ for (size_t kx = 0; kx < std::size(gModes); kx++) {
+ for (size_t ky = 0; ky < std::size(gModes); ky++) {
SkString str;
str.printf("[%s,%s]", gModeNames[kx], gModeNames[ky]);
@@ -126,11 +126,11 @@ protected:
y = SkIntToScalar(40) / scale;
- for (size_t i = 0; i < SK_ARRAY_COUNT(gColorTypes); i++) {
- for (size_t j = 0; j < SK_ARRAY_COUNT(gSamplings); j++) {
+ for (size_t i = 0; i < std::size(gColorTypes); i++) {
+ for (size_t j = 0; j < std::size(gSamplings); j++) {
x = SkIntToScalar(10)/scale;
- for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) {
- for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) {
+ for (size_t kx = 0; kx < std::size(gModes); kx++) {
+ for (size_t ky = 0; ky < std::size(gModes); ky++) {
SkPaint paint;
#if 1 // Temporary change to regen bitmap before each draw. This may help tracking down an issue
// on SGX where resizing NPOT textures to POT textures exhibits a driver bug.
@@ -181,11 +181,11 @@ static sk_sp<SkShader> make_grad(SkTileMode tx, SkTileMode ty) {
int index = (int)ty;
switch (index % 3) {
case 0:
- return SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors), tx);
+ return SkGradientShader::MakeLinear(pts, colors, nullptr, std::size(colors), tx);
case 1:
- return SkGradientShader::MakeRadial(center, rad, colors, nullptr, SK_ARRAY_COUNT(colors), tx);
+ return SkGradientShader::MakeRadial(center, rad, colors, nullptr, std::size(colors), tx);
case 2:
- return SkGradientShader::MakeSweep(center.fX, center.fY, colors, nullptr, SK_ARRAY_COUNT(colors));
+ return SkGradientShader::MakeSweep(center.fX, center.fY, colors, nullptr, std::size(colors));
}
return nullptr;
@@ -223,7 +223,7 @@ private:
SkFont font(ToolUtils::create_portable_typeface());
- for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) {
+ for (size_t kx = 0; kx < std::size(gModes); kx++) {
SkString str(gModeNames[kx]);
SkTextUtils::DrawString(canvas, str.c_str(), x + r.width()/2, y, font, SkPaint(),
SkTextUtils::kCenter_Align);
@@ -232,14 +232,14 @@ private:
y += SkIntToScalar(16) + h;
- for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) {
+ for (size_t ky = 0; ky < std::size(gModes); ky++) {
x = SkIntToScalar(16) + w;
SkString str(gModeNames[ky]);
SkTextUtils::DrawString(canvas, str.c_str(), x, y + h/2, font, SkPaint(), SkTextUtils::kRight_Align);
x += SkIntToScalar(50);
- for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) {
+ for (size_t kx = 0; kx < std::size(gModes); kx++) {
SkPaint paint;
paint.setShader(fProc(gModes[kx], gModes[ky]));
diff --git a/chromium/third_party/skia/gm/transparency.cpp b/chromium/third_party/skia/gm/transparency.cpp
index 1c3f61a675d..e8721928fa3 100644
--- a/chromium/third_party/skia/gm/transparency.cpp
+++ b/chromium/third_party/skia/gm/transparency.cpp
@@ -35,8 +35,8 @@ static void make_transparency(SkCanvas* canvas, SkScalar width, SkScalar height)
SK_ColorBLUE,
SK_ColorMAGENTA,
};
- const SkScalar kRowHeight = height / SK_ARRAY_COUNT(kColors);
- for (size_t i = 0; i < SK_ARRAY_COUNT(kColors); ++i) {
+ const SkScalar kRowHeight = height / std::size(kColors);
+ for (size_t i = 0; i < std::size(kColors); ++i) {
SkColor shaderColors[2];
shaderColors[0] = SK_AlphaTRANSPARENT;
shaderColors[1] = kColors[i];
diff --git a/chromium/third_party/skia/gm/trickycubicstrokes.cpp b/chromium/third_party/skia/gm/trickycubicstrokes.cpp
index 512b481669d..ae4597d8125 100644
--- a/chromium/third_party/skia/gm/trickycubicstrokes.cpp
+++ b/chromium/third_party/skia/gm/trickycubicstrokes.cpp
@@ -113,7 +113,7 @@ static void draw_test(SkCanvas* canvas, SkPaint::Cap cap, SkPaint::Join join) {
strokePaint.setStrokeCap(cap);
strokePaint.setStrokeJoin(join);
- for (size_t i = 0; i < SK_ARRAY_COUNT(kTrickyCubics); ++i) {
+ for (size_t i = 0; i < std::size(kTrickyCubics); ++i) {
auto [originalPts, numPts, fillMode, scale] = kTrickyCubics[i];
SkASSERT(numPts <= 4);
diff --git a/chromium/third_party/skia/gm/typeface.cpp b/chromium/third_party/skia/gm/typeface.cpp
index 752f938e060..937bb2f40c4 100644
--- a/chromium/third_party/skia/gm/typeface.cpp
+++ b/chromium/third_party/skia/gm/typeface.cpp
@@ -89,7 +89,7 @@ static constexpr SkFontStyle gStyles[] = {
SkFontStyle::BoldItalic(),
};
-constexpr int gStylesCount = SK_ARRAY_COUNT(gStyles);
+constexpr int gStylesCount = std::size(gStyles);
class TypefaceStylesGM : public skiagm::GM {
sk_sp<SkTypeface> fFaces[gStylesCount];
diff --git a/chromium/third_party/skia/gm/userfont.cpp b/chromium/third_party/skia/gm/userfont.cpp
index 9e9942594e8..8e9b93d15ce 100644
--- a/chromium/third_party/skia/gm/userfont.cpp
+++ b/chromium/third_party/skia/gm/userfont.cpp
@@ -10,12 +10,28 @@
#include "include/core/SkFont.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPath.h"
+#include "include/core/SkPictureRecorder.h"
#include "include/core/SkSize.h"
#include "include/core/SkStream.h"
#include "include/core/SkString.h"
#include "include/utils/SkCustomTypeface.h"
#include "tools/Resources.h"
+static sk_sp<SkDrawable> make_drawable(const SkPath& path) {
+ const auto bounds = path.computeTightBounds();
+
+ SkPictureRecorder recorder;
+ auto* canvas = recorder.beginRecording(bounds);
+
+ SkPaint paint;
+ paint.setColor(0xff008000);
+ paint.setAntiAlias(true);
+
+ canvas->drawPath(path, paint);
+
+ return recorder.finishRecordingAsDrawable();
+}
+
static sk_sp<SkTypeface> make_tf() {
SkCustomTypefaceBuilder builder;
SkFont font;
@@ -43,9 +59,14 @@ static sk_sp<SkTypeface> make_tf() {
font.getWidths(&glyph, 1, &width);
SkPath path;
font.getPath(glyph, &path);
+ path.transform(scale);
// we use the charcode to be our glyph index, since we have no cmap table
- builder.setGlyph(index, width/upem, path.makeTransform(scale));
+ if (index % 2) {
+ builder.setGlyph(index, width/upem, make_drawable(path), path.computeTightBounds());
+ } else {
+ builder.setGlyph(index, width/upem, path);
+ }
}
return builder.detach();
diff --git a/chromium/third_party/skia/gm/variedtext.cpp b/chromium/third_party/skia/gm/variedtext.cpp
index 47b680da7ed..c5b05de1769 100644
--- a/chromium/third_party/skia/gm/variedtext.cpp
+++ b/chromium/third_party/skia/gm/variedtext.cpp
@@ -63,7 +63,7 @@ protected:
SkScalar w = SkIntToScalar(size.fWidth);
SkScalar h = SkIntToScalar(size.fHeight);
- static_assert(4 == SK_ARRAY_COUNT(fTypefaces), "typeface_cnt");
+ SkASSERTF(4 == std::size(fTypefaces), "typeface_cnt");
fTypefaces[0] = ToolUtils::create_portable_typeface("sans-serif", SkFontStyle());
fTypefaces[1] = ToolUtils::create_portable_typeface("sans-serif", SkFontStyle::Bold());
fTypefaces[2] = ToolUtils::create_portable_typeface("serif", SkFontStyle());
@@ -87,7 +87,7 @@ protected:
fPtSizes[i] = random.nextRangeScalar(kMinPtSize, kMaxPtSize);
- fTypefaceIndices[i] = random.nextULessThan(SK_ARRAY_COUNT(fTypefaces));
+ fTypefaceIndices[i] = random.nextULessThan(std::size(fTypefaces));
SkRect r;
fPaint.setColor(fColors[i]);
diff --git a/chromium/third_party/skia/gm/vertices.cpp b/chromium/third_party/skia/gm/vertices.cpp
index b0bb76183ec..bf112875f68 100644
--- a/chromium/third_party/skia/gm/vertices.cpp
+++ b/chromium/third_party/skia/gm/vertices.cpp
@@ -44,7 +44,7 @@ static sk_sp<SkShader> make_shader1(SkScalar shaderScale) {
const SkMatrix localMatrix = SkMatrix::Scale(shaderScale, shaderScale);
sk_sp<SkShader> grad = SkGradientShader::MakeLinear(pts, colors, nullptr,
- SK_ARRAY_COUNT(colors),
+ std::size(colors),
SkTileMode::kMirror, 0,
&localMatrix);
// Throw in a couple of local matrix wrappers for good measure.
@@ -71,7 +71,7 @@ static constexpr uint16_t kMeshFan[] = {
0, 1, 2, 5, 8, 7, 6, 3, 0
};
-static const int kMeshIndexCnt = (int)SK_ARRAY_COUNT(kMeshFan);
+static const int kMeshIndexCnt = (int)std::size(kMeshFan);
static const int kMeshVertexCnt = 9;
static void fill_mesh(SkPoint pts[kMeshVertexCnt], SkPoint texs[kMeshVertexCnt],
diff --git a/chromium/third_party/skia/gm/wacky_yuv_formats.cpp b/chromium/third_party/skia/gm/wacky_yuv_formats.cpp
index a00d445a6c1..78b8273aa31 100644
--- a/chromium/third_party/skia/gm/wacky_yuv_formats.cpp
+++ b/chromium/third_party/skia/gm/wacky_yuv_formats.cpp
@@ -687,7 +687,7 @@ static void draw_col_label(SkCanvas* canvas, int x, int yuvColorSpace, bool opaq
static const char* kYUVColorSpaceNames[] = {"JPEG", "601", "709F", "709L",
"2020_8F", "2020_8L", "2020_10F", "2020_10L",
"2020_12F", "2020_12L", "Identity"};
- static_assert(SK_ARRAY_COUNT(kYUVColorSpaceNames) == kLastEnum_SkYUVColorSpace + 1);
+ static_assert(std::size(kYUVColorSpaceNames) == kLastEnum_SkYUVColorSpace + 1);
SkPaint paint;
SkFont font(ToolUtils::create_portable_typeface(nullptr, SkFontStyle::Bold()), 16);
@@ -714,7 +714,7 @@ static void draw_row_label(SkCanvas* canvas, int y, int yuvFormat) {
static const char* kYUVFormatNames[] = {
"P016", "P010", "P016F", "Y416", "AYUV", "Y410", "NV12", "NV21", "I420", "YV12"
};
- static_assert(SK_ARRAY_COUNT(kYUVFormatNames) == kLast_YUVFormat + 1);
+ static_assert(std::size(kYUVFormatNames) == kLast_YUVFormat + 1);
SkPaint paint;
SkFont font(ToolUtils::create_portable_typeface(nullptr, SkFontStyle::Bold()), 16);
@@ -1044,7 +1044,7 @@ protected:
auto yuvaPixmaps = planarConfig.makeYUVAPixmaps(fOriginalBMs[opaque].dimensions(),
kJPEG_Full_SkYUVColorSpace,
resultBMs,
- SK_ARRAY_COUNT(resultBMs));
+ std::size(resultBMs));
int i = 0;
for (sk_sp<SkColorSpace> cs : {sk_sp<SkColorSpace>(nullptr),
diff --git a/chromium/third_party/skia/gm/xfermodeimagefilter.cpp b/chromium/third_party/skia/gm/xfermodeimagefilter.cpp
index 61f8cc421d4..2cee9fbdca2 100644
--- a/chromium/third_party/skia/gm/xfermodeimagefilter.cpp
+++ b/chromium/third_party/skia/gm/xfermodeimagefilter.cpp
@@ -90,7 +90,7 @@ protected:
int x = 0, y = 0;
sk_sp<SkImageFilter> background(SkImageFilters::Image(fCheckerboard));
- for (size_t i = 0; i < SK_ARRAY_COUNT(gModes); i++) {
+ for (size_t i = 0; i < std::size(gModes); i++) {
paint.setImageFilter(SkImageFilters::Blend(gModes[i], background));
DrawClippedBitmap(canvas, fBitmap, paint, x, y);
x += fBitmap.width() + MARGIN;
diff --git a/chromium/third_party/skia/gm/xfermodes.cpp b/chromium/third_party/skia/gm/xfermodes.cpp
index 64af4d556ea..54a228374f9 100644
--- a/chromium/third_party/skia/gm/xfermodes.cpp
+++ b/chromium/third_party/skia/gm/xfermodes.cpp
@@ -251,7 +251,7 @@ protected:
SkScalar y0 = 0;
for (int sourceType = 1; sourceType & kAll_SrcType; sourceType <<= 1) {
SkScalar x = x0, y = y0;
- for (size_t i = 0; i < SK_ARRAY_COUNT(gModes); i++) {
+ for (size_t i = 0; i < std::size(gModes); i++) {
if ((gModes[i].fSourceTypeMask & sourceType) == 0) {
continue;
}
diff --git a/chromium/third_party/skia/gm/xfermodes2.cpp b/chromium/third_party/skia/gm/xfermodes2.cpp
index 9dcb68abfb4..9d334c949c9 100644
--- a/chromium/third_party/skia/gm/xfermodes2.cpp
+++ b/chromium/third_party/skia/gm/xfermodes2.cpp
@@ -31,11 +31,11 @@ namespace skiagm {
class Xfermodes2GM : public GM {
public:
- Xfermodes2GM() {}
+ Xfermodes2GM(bool grayscale) : fGrayscale(grayscale) {}
protected:
SkString onShortName() override {
- return SkString("xfermodes2");
+ return fGrayscale ? SkString("xfermodes2_gray") : SkString("xfermodes2");
}
SkISize onISize() override {
@@ -118,7 +118,7 @@ private:
for (int y = 0; y < kSize; ++y) {
int c = y * (1 << kShift);
- SkPMColor rowColor = SkPackARGB32(c, c, 0, c/2);
+ SkPMColor rowColor = fGrayscale ? SkPackARGB32(c, c, c, c) : SkPackARGB32(c, c, 0, c/2);
for (int x = 0; x < kSize; ++x) {
pixels[kSize * y + x] = rowColor;
}
@@ -130,7 +130,7 @@ private:
for (int x = 0; x < kSize; ++x) {
int c = x * (1 << kShift);
- SkPMColor colColor = SkPackARGB32(c, 0, c, c/2);
+ SkPMColor colColor = fGrayscale ? SkPackARGB32(c, c, c, c) : SkPackARGB32(c, 0, c, c/2);
for (int y = 0; y < kSize; ++y) {
pixels[kSize * y + x] = colColor;
}
@@ -143,6 +143,7 @@ private:
kSize = 256 >> kShift,
};
+ bool fGrayscale;
sk_sp<SkShader> fBG;
sk_sp<SkShader> fSrc;
sk_sp<SkShader> fDst;
@@ -152,6 +153,7 @@ private:
//////////////////////////////////////////////////////////////////////////////
-DEF_GM( return new Xfermodes2GM; )
+DEF_GM( return new Xfermodes2GM(false); )
+DEF_GM( return new Xfermodes2GM(true); )
} // namespace skiagm
diff --git a/chromium/third_party/skia/gm/xfermodes3.cpp b/chromium/third_party/skia/gm/xfermodes3.cpp
index 087541da96d..58ba19ad949 100644
--- a/chromium/third_party/skia/gm/xfermodes3.cpp
+++ b/chromium/third_party/skia/gm/xfermodes3.cpp
@@ -76,14 +76,14 @@ protected:
{SkPaint::kFill_Style, 0},
{SkPaint::kStroke_Style, SkIntToScalar(kSize) / 2},
};
- for (size_t s = 0; s < SK_ARRAY_COUNT(kStrokes); ++s) {
+ for (size_t s = 0; s < std::size(kStrokes); ++s) {
for (size_t m = 0; m < kSkBlendModeCount; ++m) {
SkBlendMode mode = static_cast<SkBlendMode>(m);
canvas->drawString(SkBlendMode_Name(mode),
SkIntToScalar(x),
SkIntToScalar(y + kSize + 3) + font.getSize(),
font, labelP);
- for (size_t c = 0; c < SK_ARRAY_COUNT(kSolidColors); ++c) {
+ for (size_t c = 0; c < std::size(kSolidColors); ++c) {
SkPaint modePaint;
modePaint.setBlendMode(mode);
modePaint.setColor(kSolidColors[c]);
@@ -99,7 +99,7 @@ protected:
y += kSize + 30;
}
}
- for (size_t a = 0; a < SK_ARRAY_COUNT(kBmpAlphas); ++a) {
+ for (size_t a = 0; a < std::size(kBmpAlphas); ++a) {
SkPaint modePaint;
modePaint.setBlendMode(mode);
modePaint.setAlpha(kBmpAlphas[a]);
@@ -195,7 +195,7 @@ private:
SK_ColorTRANSPARENT, 0x80800000, 0xF020F060, SK_ColorWHITE
};
bmpPaint.setShader(SkGradientShader::MakeRadial(kCenter, 3 * SkIntToScalar(kSize) / 4,
- kColors, nullptr, SK_ARRAY_COUNT(kColors),
+ kColors, nullptr, std::size(kColors),
SkTileMode::kRepeat));
SkBitmap bmp;
diff --git a/chromium/third_party/skia/gm/yuvtorgbsubset.cpp b/chromium/third_party/skia/gm/yuvtorgbsubset.cpp
index 1dc6153c6e5..4f35ca3f29f 100644
--- a/chromium/third_party/skia/gm/yuvtorgbsubset.cpp
+++ b/chromium/third_party/skia/gm/yuvtorgbsubset.cpp
@@ -23,8 +23,8 @@
#include "src/gpu/ganesh/GrTextureProxy.h"
#include "src/gpu/ganesh/GrYUVATextureProxies.h"
#include "src/gpu/ganesh/SkGr.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/effects/GrYUVtoRGBEffect.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
#include <memory>
#include <utility>
@@ -95,7 +95,9 @@ protected:
SkBitmap bitmap;
bitmap.installPixels(fPixmaps.plane(i));
bitmap.setImmutable();
- views[i] = std::get<0>(GrMakeCachedBitmapProxyView(context, bitmap, GrMipmapped::kNo));
+ views[i] = std::get<0>(
+ GrMakeCachedBitmapProxyView(context, bitmap, /*label=*/"DrawResult_GpuSetup",
+ GrMipmapped::kNo));
if (!views[i]) {
*errorMsg = "Failed to create proxy";
return context->abandoned() ? DrawResult::kSkip : DrawResult::kFail;
@@ -131,7 +133,7 @@ protected:
SkScalar y = kTestPad;
// Rows are filter modes.
- for (uint32_t i = 0; i < SK_ARRAY_COUNT(kFilters); ++i) {
+ for (uint32_t i = 0; i < std::size(kFilters); ++i) {
SkScalar x = kTestPad;
// Columns are non-subsetted followed by subsetted with each WrapMode in a row
for (uint32_t j = 0; j < GrSamplerState::kWrapModeCount + 1; ++j) {
diff --git a/chromium/third_party/skia/gn/bench.gni b/chromium/third_party/skia/gn/bench.gni
index 637252185d6..2014da461ba 100644
--- a/chromium/third_party/skia/gn/bench.gni
+++ b/chromium/third_party/skia/gn/bench.gni
@@ -129,7 +129,10 @@ bench_sources = [
"$_bench/WriterBench.cpp",
]
-graphite_bench_sources = [ "$_bench/graphite/IntersectionTreeBench.cpp" ]
+graphite_bench_sources = [
+ "$_bench/graphite/BoundsManagerBench.cpp",
+ "$_bench/graphite/IntersectionTreeBench.cpp",
+]
skgpu_v1_bench_sources = [
"$_bench/BulkRectBench.cpp",
diff --git a/chromium/third_party/skia/gn/core.gni b/chromium/third_party/skia/gn/core.gni
index e76d4216d08..4f74d9ee5b8 100644
--- a/chromium/third_party/skia/gn/core.gni
+++ b/chromium/third_party/skia/gn/core.gni
@@ -14,19 +14,17 @@ skia_core_public = [
"$_include/core/SkBlender.h",
"$_include/core/SkBlendMode.h",
"$_include/core/SkBlurTypes.h",
- "$_include/core/SkCapabilities.h",
"$_include/core/SkCanvas.h",
"$_include/core/SkCanvasVirtualEnforcer.h",
+ "$_include/core/SkCapabilities.h",
"$_include/core/SkClipOp.h",
"$_include/core/SkColor.h",
"$_include/core/SkColorFilter.h",
"$_include/core/SkColorPriv.h",
"$_include/core/SkColorSpace.h",
- "$_include/core/SkCombinationBuilder.h",
"$_include/core/SkContourMeasure.h",
"$_include/core/SkCoverageMode.h",
"$_include/core/SkCubicMap.h",
- "$_include/core/SkMesh.h",
"$_include/core/SkData.h",
"$_include/core/SkDataTable.h",
"$_include/core/SkDeferredDisplayList.h",
@@ -55,6 +53,7 @@ skia_core_public = [
"$_include/core/SkMaskFilter.h",
"$_include/core/SkMath.h",
"$_include/core/SkMatrix.h",
+ "$_include/core/SkMesh.h",
"$_include/core/SkMilestone.h",
"$_include/core/SkOpenTypeSVGDecoder.h",
"$_include/core/SkOverdrawCanvas.h",
@@ -69,12 +68,12 @@ skia_core_public = [
"$_include/core/SkPoint.h",
"$_include/core/SkPoint3.h",
"$_include/core/SkPromiseImageTexture.h",
- "$_include/core/SkRRect.h",
- "$_include/core/SkRSXform.h",
"$_include/core/SkRasterHandleAllocator.h",
"$_include/core/SkRect.h",
"$_include/core/SkRefCnt.h",
"$_include/core/SkRegion.h",
+ "$_include/core/SkRRect.h",
+ "$_include/core/SkRSXform.h",
"$_include/core/SkScalar.h",
"$_include/core/SkSerialProcs.h",
"$_include/core/SkShader.h",
@@ -99,10 +98,6 @@ skia_core_public = [
]
skia_core_sources = [
- "$_src/c/sk_imageinfo.cpp",
- "$_src/c/sk_paint.cpp",
- "$_src/c/sk_surface.cpp",
- "$_src/c/sk_types_priv.h",
"$_src/core/Sk4px.h",
"$_src/core/SkAAClip.cpp",
"$_src/core/SkASAN.h",
@@ -158,11 +153,10 @@ skia_core_sources = [
"$_src/core/SkClipStackDevice.h",
"$_src/core/SkColor.cpp",
"$_src/core/SkColorFilter.cpp",
+ "$_src/core/SkColorFilterBase.h",
"$_src/core/SkColorFilter_Matrix.cpp",
- "$_src/core/SkColorFilter_Matrix.h",
"$_src/core/SkColorSpace.cpp",
"$_src/core/SkColorSpaceXformSteps.cpp",
- "$_src/core/SkCombinationBuilder.cpp",
"$_src/core/SkCompressedDataUtils.cpp",
"$_src/core/SkCompressedDataUtils.h",
"$_src/core/SkContourMeasure.cpp",
@@ -232,8 +226,6 @@ skia_core_sources = [
"$_src/core/SkGlyph.h",
"$_src/core/SkGlyphBuffer.cpp",
"$_src/core/SkGlyphBuffer.h",
- "$_src/core/SkGlyphRun.cpp",
- "$_src/core/SkGlyphRun.h",
"$_src/core/SkGlyphRunPainter.cpp",
"$_src/core/SkGlyphRunPainter.h",
"$_src/core/SkGpuBlurUtils.cpp",
@@ -286,13 +278,10 @@ skia_core_sources = [
"$_src/core/SkMesh.cpp",
"$_src/core/SkMeshPriv.h",
"$_src/core/SkMessageBus.h",
- "$_src/core/SkMiniRecorder.cpp",
- "$_src/core/SkMiniRecorder.h",
"$_src/core/SkMipmap.cpp",
"$_src/core/SkMipmap.h",
"$_src/core/SkMipmapAccessor.cpp",
"$_src/core/SkModeColorFilter.cpp",
- "$_src/core/SkModeColorFilter.h",
"$_src/core/SkNextID.h",
"$_src/core/SkOSFile.h",
"$_src/core/SkOpts.cpp",
@@ -346,6 +335,9 @@ skia_core_sources = [
"$_src/core/SkRegion_path.cpp",
"$_src/core/SkResourceCache.cpp",
"$_src/core/SkRuntimeEffect.cpp",
+ "$_src/core/SkRuntimeEffectDictionary.h",
+ "$_src/core/SkRuntimeEffectPriv.h",
+ "$_src/core/SkSLTypeShared.cpp",
"$_src/core/SkSLTypeShared.h",
"$_src/core/SkSafeMath.h",
"$_src/core/SkScalar.cpp",
@@ -380,8 +372,6 @@ skia_core_sources = [
"$_src/core/SkStreamPriv.h",
"$_src/core/SkStrikeCache.cpp",
"$_src/core/SkStrikeCache.h",
- "$_src/core/SkStrikeForGPU.cpp",
- "$_src/core/SkStrikeForGPU.h",
"$_src/core/SkStrikeSpec.cpp",
"$_src/core/SkStrikeSpec.h",
"$_src/core/SkString.cpp",
@@ -433,6 +423,7 @@ skia_core_sources = [
"$_src/core/SkVertState.cpp",
"$_src/core/SkVertices.cpp",
"$_src/core/SkWriteBuffer.cpp",
+ "$_src/core/SkWriteBuffer.h",
"$_src/core/SkWriter32.cpp",
"$_src/core/SkWriter32.h",
"$_src/core/SkXfermode.cpp",
@@ -470,10 +461,8 @@ skia_core_sources = [
"$_src/shaders/SkColorFilterShader.cpp",
"$_src/shaders/SkColorFilterShader.h",
"$_src/shaders/SkColorShader.cpp",
- "$_src/shaders/SkColorShader.h",
"$_src/shaders/SkComposeShader.cpp",
- "$_src/shaders/SkComposeShader.h",
- "$_src/shaders/SkEmptyShader.h",
+ "$_src/shaders/SkEmptyShader.cpp",
"$_src/shaders/SkImageShader.cpp",
"$_src/shaders/SkImageShader.h",
"$_src/shaders/SkLocalMatrixShader.cpp",
@@ -482,6 +471,10 @@ skia_core_sources = [
"$_src/shaders/SkShaderBase.h",
"$_src/shaders/SkTransformShader.cpp",
"$_src/shaders/SkTransformShader.h",
+ "$_src/text/GlyphRun.cpp",
+ "$_src/text/GlyphRun.h",
+ "$_src/text/StrikeForGPU.cpp",
+ "$_src/text/StrikeForGPU.h",
# private
"$_include/private/SkChecksum.h",
@@ -577,6 +570,15 @@ skia_pathops_sources = [
"$_src/pathops/SkReduceOrder.h",
]
+skia_precompile_public = [ "$_include/core/SkCombinationBuilder.h" ]
+
+skia_precompile_sources = [
+ "$_src/core/SkCombinationBuilder.cpp",
+ "$_src/core/SkFactoryFunctions.cpp",
+ "$_src/core/SkFactoryFunctions.h",
+ "$_src/core/SkPrecompile.h",
+]
+
skia_skpicture_public = [
"$_include/core/SkPicture.h",
"$_include/core/SkPictureRecorder.h",
@@ -587,7 +589,6 @@ skia_skpicture_sources = [
"$_include/core/SkPictureRecorder.h",
"$_src/core/SkBigPicture.cpp",
"$_src/core/SkPicture.cpp",
- "$_src/core/SkPictureCommon.h",
"$_src/core/SkPictureData.cpp",
"$_src/core/SkPictureData.h",
"$_src/core/SkPictureFlat.cpp",
@@ -609,5 +610,3 @@ skia_core_sources += skia_skpicture_sources
skia_core_public += skia_pathops_public
skia_core_public += skia_skpicture_public
-
-skia_core_defines = [] # Used to be used by Chromium, but no longer.
diff --git a/chromium/third_party/skia/gn/dehydrate_sksl.py b/chromium/third_party/skia/gn/dehydrate_sksl.py
index 45f64621132..6c32f462ce8 100644..100755
--- a/chromium/third_party/skia/gn/dehydrate_sksl.py
+++ b/chromium/third_party/skia/gn/dehydrate_sksl.py
@@ -14,11 +14,15 @@ targetDir = sys.argv[2]
modules = sys.argv[3:]
dependencies = {
- 'sksl_frag': ['sksl_gpu'],
- 'sksl_vert': ['sksl_gpu'],
- 'sksl_graphite_frag': ['sksl_frag', 'sksl_gpu'],
- 'sksl_graphite_vert': ['sksl_vert', 'sksl_gpu'],
- 'sksl_rt_shader': ['sksl_public'],
+ 'sksl_compute': ['sksl_gpu', 'sksl_shared'],
+ 'sksl_gpu': ['sksl_shared'],
+ 'sksl_frag': ['sksl_gpu', 'sksl_shared'],
+ 'sksl_vert': ['sksl_gpu', 'sksl_shared'],
+ 'sksl_graphite_frag': ['sksl_frag', 'sksl_gpu', 'sksl_shared'],
+ 'sksl_graphite_vert': ['sksl_vert', 'sksl_gpu', 'sksl_shared'],
+ 'sksl_public': ['sksl_shared'],
+ 'sksl_rt_shader': ['sksl_public', 'sksl_shared'],
+ 'sksl_shared': [],
}
for module in modules:
@@ -28,9 +32,11 @@ for module in modules:
os.mkdir(targetDir)
target = os.path.join(targetDir, moduleName)
args = [sksl_precompile, target + ".dehydrated.sksl", module]
- if moduleName in dependencies:
- for dependent in dependencies[moduleName]:
- args.append(os.path.join(moduleDir, dependent) + ".sksl")
+ if moduleName not in dependencies:
+ print("### Error compiling " + moduleName + ": dependency list must be specified")
+ exit(1)
+ for dependent in dependencies[moduleName]:
+ args.append(os.path.join(moduleDir, dependent) + ".sksl")
subprocess.check_output(args).decode('utf-8')
except subprocess.CalledProcessError as err:
print("### Error compiling " + module + ":")
diff --git a/chromium/third_party/skia/gn/effects.gni b/chromium/third_party/skia/gn/effects.gni
index e179f42c933..fcbad6cfae4 100644
--- a/chromium/third_party/skia/gn/effects.gni
+++ b/chromium/third_party/skia/gn/effects.gni
@@ -30,7 +30,6 @@ skia_effects_public = [
]
skia_effects_sources = [
- "$_src/c/sk_effects.cpp",
"$_src/effects/Sk1DPathEffect.cpp",
"$_src/effects/Sk2DPathEffect.cpp",
"$_src/effects/SkBlenders.cpp",
@@ -58,13 +57,11 @@ skia_effects_sources = [
"$_src/shaders/gradients/Sk4fLinearGradient.cpp",
"$_src/shaders/gradients/Sk4fLinearGradient.h",
"$_src/shaders/gradients/SkGradientShader.cpp",
- "$_src/shaders/gradients/SkGradientShaderPriv.h",
+ "$_src/shaders/gradients/SkGradientShaderBase.cpp",
+ "$_src/shaders/gradients/SkGradientShaderBase.h",
"$_src/shaders/gradients/SkLinearGradient.cpp",
"$_src/shaders/gradients/SkLinearGradient.h",
"$_src/shaders/gradients/SkRadialGradient.cpp",
- "$_src/shaders/gradients/SkRadialGradient.h",
"$_src/shaders/gradients/SkSweepGradient.cpp",
- "$_src/shaders/gradients/SkSweepGradient.h",
"$_src/shaders/gradients/SkTwoPointConicalGradient.cpp",
- "$_src/shaders/gradients/SkTwoPointConicalGradient.h",
]
diff --git a/chromium/third_party/skia/gn/flutter_defines.gni b/chromium/third_party/skia/gn/flutter_defines.gni
index 43c2d588e84..e99fd15226d 100644
--- a/chromium/third_party/skia/gn/flutter_defines.gni
+++ b/chromium/third_party/skia/gn/flutter_defines.gni
@@ -23,8 +23,5 @@ flutter_defines = [
]
if (!is_fuchsia) {
- flutter_defines += [
- "SK_GL",
- "SK_DISABLE_EFFECT_DESERIALIZATION",
- ]
+ flutter_defines += [ "SK_DISABLE_EFFECT_DESERIALIZATION" ]
}
diff --git a/chromium/third_party/skia/gn/gm.gni b/chromium/third_party/skia/gn/gm.gni
index 3eb3d80d4a6..17a6e54f593 100644
--- a/chromium/third_party/skia/gn/gm.gni
+++ b/chromium/third_party/skia/gn/gm.gni
@@ -70,8 +70,6 @@ gm_sources = [
"$_gm/bug6643.cpp",
"$_gm/bug6783.cpp",
"$_gm/bug9331.cpp",
- "$_gm/cgm.c",
- "$_gm/cgms.cpp",
"$_gm/circle_sizes.cpp",
"$_gm/circulararcs.cpp",
"$_gm/circularclips.cpp",
diff --git a/chromium/third_party/skia/gn/gn_to_bp.py b/chromium/third_party/skia/gn/gn_to_bp.py
index 652e68d19d8..c98d22f27ae 100755
--- a/chromium/third_party/skia/gn/gn_to_bp.py
+++ b/chromium/third_party/skia/gn/gn_to_bp.py
@@ -267,6 +267,14 @@ cc_defaults {
"libpiex",
"libexpat",
"libft2",
+ // Required by Skottie
+ "libicu",
+ "libharfbuzz_ng",
+ ],
+ // Required by Skottie
+ cflags: [
+ "-DSK_SHAPER_HARFBUZZ_AVAILABLE",
+ "-DSK_UNICODE_AVAILABLE",
],
static_libs: [
"libwebp-decode",
@@ -492,6 +500,8 @@ def generate_args(target_os, enable_gpu, renderengine = False):
'skia_enable_fontmgr_win_gdi': 'false',
'skia_use_fonthost_mac': 'false',
+ 'skia_use_system_harfbuzz': 'false',
+
# enable features used in skia_nanobench
'skia_tools_require_resources': 'true',
@@ -499,6 +509,7 @@ def generate_args(target_os, enable_gpu, renderengine = False):
'skia_include_multiframe_procs': 'false',
# Required for some SKSL tests
'skia_enable_sksl_tracing': 'true',
+ 'skia_use_perfetto': 'false'
}
d['target_os'] = target_os
if target_os == '"android"':
@@ -545,6 +556,7 @@ def generate_args(target_os, enable_gpu, renderengine = False):
d['skia_use_fixed_gamma_text'] = 'true'
d['skia_enable_fontmgr_custom_empty'] = 'true'
d['skia_use_wuffs'] = 'true'
+ d['skia_enable_skottie'] = 'true'
return d
@@ -565,6 +577,17 @@ cflags_cc = strip_slashes(js['targets']['//:skia']['cflags_cc'])
local_includes = strip_slashes(js['targets']['//:skia']['include_dirs'])
export_includes = strip_slashes(js['targets']['//:public']['include_dirs'])
+if (gn_args['skia_enable_skottie']):
+ # Skottie sits on top of skia, so we need to specify these sources to be built
+ # Python sets handle duplicate flags, source files, and includes for us
+ android_srcs.update(strip_slashes(js['targets']['//modules/skottie:skottie']['sources']))
+ gn_to_bp_utils.GrabDependentValues(js, '//modules/skottie:skottie', 'sources',
+ android_srcs, '//:skia')
+
+ local_includes.update(strip_slashes(js['targets']['//modules/skottie:skottie']['include_dirs']))
+ gn_to_bp_utils.GrabDependentValues(js, '//modules/skottie:skottie', 'include_dirs',
+ local_includes, '//:skia')
+
gm_srcs = strip_slashes(js['targets']['//:gm']['sources'])
gm_includes = strip_slashes(js['targets']['//:gm']['include_dirs'])
diff --git a/chromium/third_party/skia/gn/gpu.gni b/chromium/third_party/skia/gn/gpu.gni
index 810ecbda3cc..ee47a84f51b 100644
--- a/chromium/third_party/skia/gn/gpu.gni
+++ b/chromium/third_party/skia/gn/gpu.gni
@@ -30,6 +30,11 @@ skia_gpu_sources = [
"$_include/private/gpu/ganesh/GrTypesPriv.h",
"$_src/gpu/GrAHardwareBufferUtils.h",
"$_src/gpu/GrRectanizer.h",
+ "$_src/gpu/ganesh/ClipStack.cpp",
+ "$_src/gpu/ganesh/ClipStack.h",
+ "$_src/gpu/ganesh/Device.cpp",
+ "$_src/gpu/ganesh/Device_drawTexture.cpp",
+ "$_src/gpu/ganesh/Device_v1.h",
"$_src/gpu/ganesh/GrAHardwareBufferImageGenerator.cpp",
"$_src/gpu/ganesh/GrAHardwareBufferImageGenerator.h",
"$_src/gpu/ganesh/GrAHardwareBufferUtils.cpp",
@@ -37,6 +42,7 @@ skia_gpu_sources = [
"$_src/gpu/ganesh/GrAppliedClip.h",
"$_src/gpu/ganesh/GrAttachment.cpp",
"$_src/gpu/ganesh/GrAttachment.h",
+ "$_src/gpu/ganesh/GrAuditTrail.cpp",
"$_src/gpu/ganesh/GrAuditTrail.h",
"$_src/gpu/ganesh/GrAutoLocaleSetter.h",
"$_src/gpu/ganesh/GrBackendSemaphore.cpp",
@@ -48,9 +54,13 @@ skia_gpu_sources = [
"$_src/gpu/ganesh/GrBackendUtils.cpp",
"$_src/gpu/ganesh/GrBackendUtils.h",
"$_src/gpu/ganesh/GrBaseContextPriv.h",
+ "$_src/gpu/ganesh/GrBlurUtils.cpp",
+ "$_src/gpu/ganesh/GrBlurUtils.h",
"$_src/gpu/ganesh/GrBuffer.h",
"$_src/gpu/ganesh/GrBufferAllocPool.cpp",
"$_src/gpu/ganesh/GrBufferAllocPool.h",
+ "$_src/gpu/ganesh/GrBufferTransferRenderTask.cpp",
+ "$_src/gpu/ganesh/GrBufferTransferRenderTask.h",
"$_src/gpu/ganesh/GrCaps.cpp",
"$_src/gpu/ganesh/GrCaps.h",
"$_src/gpu/ganesh/GrClientMappedBufferManager.cpp",
@@ -84,6 +94,8 @@ skia_gpu_sources = [
"$_src/gpu/ganesh/GrDrawIndirectCommand.h",
"$_src/gpu/ganesh/GrDrawOpAtlas.cpp",
"$_src/gpu/ganesh/GrDrawOpAtlas.h",
+ "$_src/gpu/ganesh/GrDrawOpTest.cpp",
+ "$_src/gpu/ganesh/GrDrawOpTest.h",
"$_src/gpu/ganesh/GrDrawingManager.cpp",
"$_src/gpu/ganesh/GrDrawingManager.h",
"$_src/gpu/ganesh/GrDriverBugWorkarounds.cpp",
@@ -237,8 +249,17 @@ skia_gpu_sources = [
"$_src/gpu/ganesh/GrYUVABackendTextures.cpp",
"$_src/gpu/ganesh/GrYUVATextureProxies.cpp",
"$_src/gpu/ganesh/GrYUVATextureProxies.h",
+ "$_src/gpu/ganesh/PathRenderer.cpp",
+ "$_src/gpu/ganesh/PathRenderer.h",
+ "$_src/gpu/ganesh/PathRendererChain.cpp",
+ "$_src/gpu/ganesh/PathRendererChain.h",
+ "$_src/gpu/ganesh/StencilClip.h",
+ "$_src/gpu/ganesh/StencilMaskHelper.cpp",
+ "$_src/gpu/ganesh/StencilMaskHelper.h",
"$_src/gpu/ganesh/SurfaceContext.cpp",
"$_src/gpu/ganesh/SurfaceContext.h",
+ "$_src/gpu/ganesh/SurfaceDrawContext.cpp",
+ "$_src/gpu/ganesh/SurfaceDrawContext.h",
"$_src/gpu/ganesh/SurfaceFillContext.cpp",
"$_src/gpu/ganesh/SurfaceFillContext.h",
@@ -327,8 +348,6 @@ skia_gpu_sources = [
"$_src/gpu/ganesh/text/GrAtlasManager.h",
# GLSL
- "$_src/gpu/ganesh/glsl/GrGLSL.cpp",
- "$_src/gpu/ganesh/glsl/GrGLSL.h",
"$_src/gpu/ganesh/glsl/GrGLSLBlend.cpp",
"$_src/gpu/ganesh/glsl/GrGLSLBlend.h",
"$_src/gpu/ganesh/glsl/GrGLSLColorSpaceXformHelper.h",
@@ -363,8 +382,6 @@ skia_gpu_sources = [
"$_src/gpu/ganesh/mock/GrMockTypes.cpp",
# Sk files
- "$_src/gpu/ganesh/BaseDevice.cpp",
- "$_src/gpu/ganesh/BaseDevice.h",
"$_src/gpu/ganesh/SkGr.cpp",
"$_src/gpu/ganesh/SkGr.h",
"$_src/image/SkImage_Gpu.cpp",
@@ -440,12 +457,6 @@ skia_null_gpu_sources =
[ "$_src/gpu/ganesh/gl/GrGLMakeNativeInterface_none.cpp" ]
skia_skgpu_v1_sources = [
- "$_src/gpu/ganesh/GrAuditTrail.cpp",
- "$_src/gpu/ganesh/GrBlurUtils.cpp",
- "$_src/gpu/ganesh/GrBlurUtils.h",
- "$_src/gpu/ganesh/GrDrawOpTest.cpp",
- "$_src/gpu/ganesh/GrDrawOpTest.h",
-
# Ops
"$_src/gpu/ganesh/ops/AAConvexPathRenderer.cpp",
"$_src/gpu/ganesh/ops/AAConvexPathRenderer.h",
@@ -527,24 +538,6 @@ skia_skgpu_v1_sources = [
"$_src/gpu/ganesh/ops/TextureOp.h",
"$_src/gpu/ganesh/ops/TriangulatingPathRenderer.cpp",
"$_src/gpu/ganesh/ops/TriangulatingPathRenderer.h",
-
- # v1
- "$_src/gpu/ganesh/v1/ClipStack.cpp",
- "$_src/gpu/ganesh/v1/ClipStack.h",
- "$_src/gpu/ganesh/v1/Device.cpp",
- "$_src/gpu/ganesh/v1/Device_drawTexture.cpp",
- "$_src/gpu/ganesh/v1/Device_v1.h",
- "$_src/gpu/ganesh/v1/PathRenderer.cpp",
- "$_src/gpu/ganesh/v1/PathRenderer.h",
- "$_src/gpu/ganesh/v1/PathRendererChain.cpp",
- "$_src/gpu/ganesh/v1/PathRendererChain.h",
- "$_src/gpu/ganesh/v1/StencilClip.h",
- "$_src/gpu/ganesh/v1/StencilMaskHelper.cpp",
- "$_src/gpu/ganesh/v1/StencilMaskHelper.h",
- "$_src/gpu/ganesh/v1/SurfaceDrawContext.cpp",
- "$_src/gpu/ganesh/v1/SurfaceDrawContext_v1.h",
- "$_src/gpu/ganesh/v1/SurfaceFillContext_v1.cpp",
- "$_src/gpu/ganesh/v1/SurfaceFillContext_v1.h",
]
skia_gpu_sources += skia_skgpu_v1_sources
diff --git a/chromium/third_party/skia/gn/graphite.gni b/chromium/third_party/skia/gn/graphite.gni
index 084b4757b70..6a1f068af4b 100644
--- a/chromium/third_party/skia/gn/graphite.gni
+++ b/chromium/third_party/skia/gn/graphite.gni
@@ -11,7 +11,9 @@ _include_private = get_path_info("../include/private/gpu/graphite", "abspath")
skia_graphite_public = [
"$_include/BackendTexture.h",
"$_include/Context.h",
+ "$_include/ContextOptions.h",
"$_include/GraphiteTypes.h",
+ "$_include/ImageProvider.h",
"$_include/Recorder.h",
"$_include/Recording.h",
"$_include/SkStuff.h",
@@ -19,6 +21,7 @@ skia_graphite_public = [
]
skia_graphite_sources = [
+ "$_src/AttachmentTypes.h",
"$_src/Attribute.h",
"$_src/BackendTexture.cpp",
"$_src/Buffer.cpp",
@@ -30,6 +33,11 @@ skia_graphite_sources = [
"$_src/CommandBuffer.cpp",
"$_src/CommandBuffer.h",
"$_src/CommandTypes.h",
+ "$_src/ComputePassTask.cpp",
+ "$_src/ComputePassTask.h",
+ "$_src/ComputePipeline.cpp",
+ "$_src/ComputePipeline.h",
+ "$_src/ComputeTypes.h",
"$_src/Context.cpp",
"$_src/ContextPriv.cpp",
"$_src/ContextPriv.h",
@@ -39,13 +47,17 @@ skia_graphite_sources = [
"$_src/CopyTask.h",
"$_src/Device.cpp",
"$_src/Device.h",
+ "$_src/DrawAtlas.cpp",
+ "$_src/DrawAtlas.h",
"$_src/DrawBufferManager.cpp",
"$_src/DrawBufferManager.h",
+ "$_src/DrawCommands.h",
"$_src/DrawContext.cpp",
"$_src/DrawContext.h",
"$_src/DrawList.cpp",
"$_src/DrawList.h",
"$_src/DrawOrder.h",
+ "$_src/DrawParams.h",
"$_src/DrawPass.cpp",
"$_src/DrawPass.h",
"$_src/DrawTypes.h",
@@ -53,8 +65,6 @@ skia_graphite_sources = [
"$_src/DrawWriter.h",
"$_src/GlobalCache.cpp",
"$_src/GlobalCache.h",
- "$_src/Gpu.cpp",
- "$_src/Gpu.h",
"$_src/GpuWorkSubmission.cpp",
"$_src/GpuWorkSubmission.h",
"$_src/GraphicsPipeline.cpp",
@@ -63,16 +73,21 @@ skia_graphite_sources = [
"$_src/GraphicsPipelineDesc.h",
"$_src/GraphiteResourceKey.cpp",
"$_src/GraphiteResourceKey.h",
+ "$_src/ImageUtils.cpp",
+ "$_src/ImageUtils.h",
"$_src/Image_Graphite.cpp",
"$_src/Image_Graphite.h",
"$_src/Log.h",
"$_src/PaintParams.cpp",
"$_src/PaintParams.h",
"$_src/PipelineDataCache.h",
+ "$_src/QueueManager.cpp",
+ "$_src/QueueManager.h",
"$_src/Recorder.cpp",
"$_src/RecorderPriv.cpp",
"$_src/RecorderPriv.h",
"$_src/Recording.cpp",
+ "$_src/RecordingPriv.h",
"$_src/RenderPassTask.cpp",
"$_src/RenderPassTask.h",
"$_src/Renderer.h",
@@ -85,6 +100,8 @@ skia_graphite_sources = [
"$_src/ResourceTypes.h",
"$_src/Sampler.cpp",
"$_src/Sampler.h",
+ "$_src/SharedContext.cpp",
+ "$_src/SharedContext.h",
"$_src/SkStuff.cpp",
"$_src/Surface_Graphite.cpp",
"$_src/Surface_Graphite.h",
@@ -107,18 +124,24 @@ skia_graphite_sources = [
"$_src/UploadTask.cpp",
"$_src/UploadTask.h",
"$_src/geom/BoundsManager.h",
+ "$_src/geom/Geometry.h",
"$_src/geom/IntersectionTree.cpp",
"$_src/geom/IntersectionTree.h",
"$_src/geom/Rect.h",
"$_src/geom/Shape.cpp",
"$_src/geom/Shape.h",
+ "$_src/geom/SubRunData.h",
"$_src/geom/Transform.cpp",
"$_src/geom/Transform_graphite.h",
+ "$_src/render/BitmapTextRenderStep.cpp",
+ "$_src/render/BitmapTextRenderStep.h",
"$_src/render/CoverBoundsRenderStep.cpp",
"$_src/render/CoverBoundsRenderStep.h",
"$_src/render/DynamicInstancesPatchAllocator.h",
"$_src/render/MiddleOutFanRenderStep.cpp",
"$_src/render/MiddleOutFanRenderStep.h",
+ "$_src/render/SDFTextRenderStep.cpp",
+ "$_src/render/SDFTextRenderStep.h",
"$_src/render/StencilAndCoverDSS.h",
"$_src/render/StencilAndFillPathRenderer.cpp",
"$_src/render/TessellateCurvesRenderStep.cpp",
@@ -127,6 +150,11 @@ skia_graphite_sources = [
"$_src/render/TessellateStrokesRenderStep.h",
"$_src/render/TessellateWedgesRenderStep.cpp",
"$_src/render/TessellateWedgesRenderStep.h",
+ "$_src/render/TextRenderer.cpp",
+ "$_src/render/VerticesRenderStep.cpp",
+ "$_src/render/VerticesRenderStep.h",
+ "$_src/text/AtlasManager.cpp",
+ "$_src/text/AtlasManager.h",
]
skia_graphite_mtl_sources = [
@@ -140,15 +168,20 @@ skia_graphite_mtl_sources = [
"$_src/mtl/MtlCaps.mm",
"$_src/mtl/MtlCommandBuffer.h",
"$_src/mtl/MtlCommandBuffer.mm",
- "$_src/mtl/MtlGpu.h",
- "$_src/mtl/MtlGpu.mm",
+ "$_src/mtl/MtlComputeCommandEncoder.h",
+ "$_src/mtl/MtlComputePipeline.h",
+ "$_src/mtl/MtlComputePipeline.mm",
"$_src/mtl/MtlGraphicsPipeline.h",
"$_src/mtl/MtlGraphicsPipeline.mm",
+ "$_src/mtl/MtlQueueManager.h",
+ "$_src/mtl/MtlQueueManager.mm",
"$_src/mtl/MtlRenderCommandEncoder.h",
"$_src/mtl/MtlResourceProvider.h",
"$_src/mtl/MtlResourceProvider.mm",
"$_src/mtl/MtlSampler.h",
"$_src/mtl/MtlSampler.mm",
+ "$_src/mtl/MtlSharedContext.h",
+ "$_src/mtl/MtlSharedContext.mm",
"$_src/mtl/MtlTexture.h",
"$_src/mtl/MtlTexture.mm",
"$_src/mtl/MtlTrampoline.h",
diff --git a/chromium/third_party/skia/gn/skia.gni b/chromium/third_party/skia/gn/skia.gni
index 2f42ffec97d..2551deefd06 100644
--- a/chromium/third_party/skia/gn/skia.gni
+++ b/chromium/third_party/skia/gn/skia.gni
@@ -24,6 +24,7 @@ declare_args() {
skia_enable_pdf = !is_wasm
skia_enable_skottie = !(is_win && is_component_build) ||
(is_wasm && skia_canvaskit_enable_skottie)
+ skia_enable_precompile = true
skia_enable_sksl = true
skia_enable_sksl_tracing = is_skia_dev_build
skia_enable_skvm_jit_when_possible = is_skia_dev_build
@@ -51,6 +52,7 @@ declare_args() {
skia_use_harfbuzz = true
skia_use_gl = !is_fuchsia
skia_use_icu = !is_fuchsia
+ skia_use_libavif = false
skia_use_libheif = is_skia_dev_build
skia_use_libjpeg_turbo_decode = true
skia_use_libjpeg_turbo_encode = true
@@ -62,17 +64,17 @@ declare_args() {
skia_use_lua = is_skia_dev_build && !is_ios
skia_use_metal = false
skia_use_ndk_images = is_android && defined(ndk_api) && ndk_api >= 30
+ skia_use_perfetto = is_linux || is_mac || is_android
skia_use_piex = !is_win && !is_wasm
skia_use_sfml = false
skia_use_webgl = is_wasm
+ skia_use_webgpu = is_wasm
skia_use_wuffs = is_wasm
skia_use_x11 = is_linux
skia_use_xps = true
skia_enable_graphite = false
skia_use_zlib = true
- skia_vtune_path = ""
-
if (is_ios) {
skia_ios_identity = ".*Google.*"
skia_ios_profile = "Google Development"
diff --git a/chromium/third_party/skia/gn/skia/BUILD.gn b/chromium/third_party/skia/gn/skia/BUILD.gn
index 3eaec3aec2e..e0f573c356e 100644
--- a/chromium/third_party/skia/gn/skia/BUILD.gn
+++ b/chromium/third_party/skia/gn/skia/BUILD.gn
@@ -286,7 +286,7 @@ config("default") {
if (sanitize == "ASAN") {
# ASAN implicitly runs all UBSAN checks also.
- sanitizers = "undefined,address"
+ sanitizers = "undefined,address,float-divide-by-zero"
if (is_android) {
# TODO(skia:13344): work out UBSAN link errors
diff --git a/chromium/third_party/skia/gn/sksl.gni b/chromium/third_party/skia/gn/sksl.gni
index 53fe1151f40..95b0d81a2dd 100644
--- a/chromium/third_party/skia/gn/sksl.gni
+++ b/chromium/third_party/skia/gn/sksl.gni
@@ -8,33 +8,6 @@ _src = get_path_info("../src", "abspath")
_include = get_path_info("../include", "abspath")
skia_sksl_sources = [
- "$_include/private/SkSLDefines.h",
- "$_include/private/SkSLIRNode.h",
- "$_include/private/SkSLLayout.h",
- "$_include/private/SkSLModifiers.h",
- "$_include/private/SkSLProgramElement.h",
- "$_include/private/SkSLProgramKind.h",
- "$_include/private/SkSLSampleUsage.h",
- "$_include/private/SkSLStatement.h",
- "$_include/private/SkSLString.h",
- "$_include/private/SkSLSymbol.h",
- "$_include/sksl/DSL.h",
- "$_include/sksl/DSLBlock.h",
- "$_include/sksl/DSLCase.h",
- "$_include/sksl/DSLCore.h",
- "$_include/sksl/DSLExpression.h",
- "$_include/sksl/DSLFunction.h",
- "$_include/sksl/DSLLayout.h",
- "$_include/sksl/DSLModifiers.h",
- "$_include/sksl/DSLStatement.h",
- "$_include/sksl/DSLSymbols.h",
- "$_include/sksl/DSLType.h",
- "$_include/sksl/DSLVar.h",
- "$_include/sksl/SkSLDebugTrace.h",
- "$_include/sksl/SkSLErrorReporter.h",
- "$_include/sksl/SkSLOperator.h",
- "$_include/sksl/SkSLPosition.h",
- "$_include/sksl/SkSLVersion.h",
"$_src/sksl/SkSLAnalysis.cpp",
"$_src/sksl/SkSLAnalysis.h",
"$_src/sksl/SkSLBuiltinMap.cpp",
@@ -86,12 +59,14 @@ skia_sksl_sources = [
"$_src/sksl/analysis/SkSLCanExitWithoutReturningValue.cpp",
"$_src/sksl/analysis/SkSLCheckProgramStructure.cpp",
"$_src/sksl/analysis/SkSLFinalizationChecks.cpp",
+ "$_src/sksl/analysis/SkSLGetComputeShaderMainParams.cpp",
"$_src/sksl/analysis/SkSLGetLoopUnrollInfo.cpp",
"$_src/sksl/analysis/SkSLIsConstantExpression.cpp",
"$_src/sksl/analysis/SkSLIsSameExpressionTree.cpp",
"$_src/sksl/analysis/SkSLIsTrivialExpression.cpp",
"$_src/sksl/analysis/SkSLNoOpErrorReporter.h",
"$_src/sksl/analysis/SkSLProgramUsage.cpp",
+ "$_src/sksl/analysis/SkSLProgramUsage.h",
"$_src/sksl/analysis/SkSLProgramVisitor.h",
"$_src/sksl/analysis/SkSLSwitchCaseContainsExit.cpp",
"$_src/sksl/codegen/SkSLVMCodeGenerator.cpp",
@@ -193,7 +168,6 @@ skia_sksl_sources = [
"$_src/sksl/ir/SkSLType.h",
"$_src/sksl/ir/SkSLTypeReference.cpp",
"$_src/sksl/ir/SkSLTypeReference.h",
- "$_src/sksl/ir/SkSLUnresolvedFunction.h",
"$_src/sksl/ir/SkSLVarDeclarations.cpp",
"$_src/sksl/ir/SkSLVarDeclarations.h",
"$_src/sksl/ir/SkSLVariable.cpp",
@@ -203,13 +177,44 @@ skia_sksl_sources = [
"$_src/sksl/spirv.h",
"$_src/sksl/tracing/SkVMDebugTrace.cpp",
"$_src/sksl/tracing/SkVMDebugTrace.h",
- "$_src/sksl/transform/SkSLBuiltinVariableScanner.cpp",
+ "$_src/sksl/transform/SkSLAddConstToVarModifiers.cpp",
"$_src/sksl/transform/SkSLEliminateDeadFunctions.cpp",
"$_src/sksl/transform/SkSLEliminateDeadGlobalVariables.cpp",
"$_src/sksl/transform/SkSLEliminateDeadLocalVariables.cpp",
"$_src/sksl/transform/SkSLEliminateEmptyStatements.cpp",
"$_src/sksl/transform/SkSLEliminateUnreachableCode.cpp",
+ "$_src/sksl/transform/SkSLFindAndDeclareBuiltinFunctions.cpp",
+ "$_src/sksl/transform/SkSLFindAndDeclareBuiltinVariables.cpp",
"$_src/sksl/transform/SkSLTransform.h",
+
+ # headers
+ "$_include/private/SkSLDefines.h",
+ "$_include/private/SkSLIRNode.h",
+ "$_include/private/SkSLLayout.h",
+ "$_include/private/SkSLModifiers.h",
+ "$_include/private/SkSLProgramElement.h",
+ "$_include/private/SkSLProgramKind.h",
+ "$_include/private/SkSLSampleUsage.h",
+ "$_include/private/SkSLStatement.h",
+ "$_include/private/SkSLString.h",
+ "$_include/private/SkSLSymbol.h",
+ "$_include/sksl/DSL.h",
+ "$_include/sksl/DSLBlock.h",
+ "$_include/sksl/DSLCase.h",
+ "$_include/sksl/DSLCore.h",
+ "$_include/sksl/DSLExpression.h",
+ "$_include/sksl/DSLFunction.h",
+ "$_include/sksl/DSLLayout.h",
+ "$_include/sksl/DSLModifiers.h",
+ "$_include/sksl/DSLStatement.h",
+ "$_include/sksl/DSLSymbols.h",
+ "$_include/sksl/DSLType.h",
+ "$_include/sksl/DSLVar.h",
+ "$_include/sksl/SkSLDebugTrace.h",
+ "$_include/sksl/SkSLErrorReporter.h",
+ "$_include/sksl/SkSLOperator.h",
+ "$_include/sksl/SkSLPosition.h",
+ "$_include/sksl/SkSLVersion.h",
]
skia_sksl_tracing_sources = [
@@ -254,7 +259,6 @@ skslc_deps = [
"$_src/ports/SkOSFile_stdio.cpp",
"$_src/utils/SkJSON.cpp",
"$_src/utils/SkJSONWriter.cpp",
- "$_src/utils/SkOSPath.cpp",
"$_src/utils/SkParse.cpp",
"$_src/utils/SkShaderUtils.cpp",
"$_src/utils/SkUTF.cpp",
diff --git a/chromium/third_party/skia/gn/sksl_tests.gni b/chromium/third_party/skia/gn/sksl_tests.gni
index 8c39dd07480..14c612d16a0 100644
--- a/chromium/third_party/skia/gn/sksl_tests.gni
+++ b/chromium/third_party/skia/gn/sksl_tests.gni
@@ -20,8 +20,6 @@ sksl_error_tests = [
"/sksl/errors/ArraySplitDimensionsInFuncDecl.rts",
"/sksl/errors/ArraySplitDimensionsInStruct.rts",
"/sksl/errors/ArrayTooManyDimensions.rts",
- "/sksl/errors/ArrayTooManyDimensionsUnsized1.rts",
- "/sksl/errors/ArrayTooManyDimensionsUnsized2.rts",
"/sksl/errors/ArrayTooManyDimensionsInFuncBody.rts",
"/sksl/errors/ArrayTooManyDimensionsInFuncBodyUnsized1.rts",
"/sksl/errors/ArrayTooManyDimensionsInFuncBodyUnsized2.rts",
@@ -31,9 +29,9 @@ sksl_error_tests = [
"/sksl/errors/ArrayTooManyDimensionsInStruct.rts",
"/sksl/errors/ArrayTooManyDimensionsInStructUnsized1.rts",
"/sksl/errors/ArrayTooManyDimensionsInStructUnsized2.rts",
+ "/sksl/errors/ArrayTooManyDimensionsUnsized1.rts",
+ "/sksl/errors/ArrayTooManyDimensionsUnsized2.rts",
"/sksl/errors/ArrayTypeTooManyDimensions.rts",
- "/sksl/errors/ArrayTypeTooManyDimensionsUnsized1.rts",
- "/sksl/errors/ArrayTypeTooManyDimensionsUnsized2.rts",
"/sksl/errors/ArrayTypeTooManyDimensionsInFuncBody.rts",
"/sksl/errors/ArrayTypeTooManyDimensionsInFuncBodyUnsized1.rts",
"/sksl/errors/ArrayTypeTooManyDimensionsInFuncBodyUnsized2.rts",
@@ -43,6 +41,8 @@ sksl_error_tests = [
"/sksl/errors/ArrayTypeTooManyDimensionsInStruct.rts",
"/sksl/errors/ArrayTypeTooManyDimensionsInStructUnsized1.rts",
"/sksl/errors/ArrayTypeTooManyDimensionsInStructUnsized2.rts",
+ "/sksl/errors/ArrayTypeTooManyDimensionsUnsized1.rts",
+ "/sksl/errors/ArrayTypeTooManyDimensionsUnsized2.rts",
"/sksl/errors/ArrayUnspecifiedDimensions.rts",
"/sksl/errors/AssignmentTypeMismatch.rts",
"/sksl/errors/BadCaps.sksl",
@@ -59,6 +59,7 @@ sksl_error_tests = [
"/sksl/errors/BitShiftFloatVector.rts",
"/sksl/errors/BooleanArithmetic.sksl",
"/sksl/errors/BreakOutsideLoop.rts",
+ "/sksl/errors/CallMain.rts",
"/sksl/errors/CallNonFunction.rts",
"/sksl/errors/CanExitWithoutReturningValue.sksl",
"/sksl/errors/CommasAsConstantExpressions.rts",
@@ -93,10 +94,14 @@ sksl_error_tests = [
"/sksl/errors/InterfaceBlockWithNoMembers.sksl",
"/sksl/errors/IntrinsicInGlobalVariable.sksl",
"/sksl/errors/InvalidAssignment.rts",
+ "/sksl/errors/InvalidExtensionDirective.sksl",
"/sksl/errors/InvalidOutParams.rts",
+ "/sksl/errors/InvalidThreadgroupCompute.compute",
+ "/sksl/errors/InvalidThreadgroupRTS.rts",
"/sksl/errors/InvalidToken.rts",
"/sksl/errors/InvalidUnary.rts",
"/sksl/errors/InvalidUniformTypes.sksl",
+ "/sksl/errors/InvalidVersionDirective.sksl",
"/sksl/errors/InVarWithInitializerExpression.sksl",
"/sksl/errors/LayoutInFunctions.sksl",
"/sksl/errors/LayoutInInterfaceBlock.sksl",
@@ -120,6 +125,7 @@ sksl_error_tests = [
"/sksl/errors/OpaqueTypeInArray.sksl",
"/sksl/errors/OpaqueTypeInInterfaceBlock.sksl",
"/sksl/errors/OpaqueTypeInStruct.sksl",
+ "/sksl/errors/OpaqueTypeOutParam.sksl",
"/sksl/errors/OpenArray.rts",
"/sksl/errors/Ossfuzz26700.sksl",
"/sksl/errors/Ossfuzz27614.sksl",
@@ -156,6 +162,10 @@ sksl_error_tests = [
"/sksl/errors/Ossfuzz44559.sksl",
"/sksl/errors/Ossfuzz44561.sksl",
"/sksl/errors/Ossfuzz44565.sksl",
+ "/sksl/errors/Ossfuzz47935.sksl",
+ "/sksl/errors/Ossfuzz48592.sksl",
+ "/sksl/errors/Ossfuzz49558.sksl",
+ "/sksl/errors/OverflowFloatIntrinsic.sksl",
"/sksl/errors/OverflowFloatLiteral.rts",
"/sksl/errors/OverflowInlinedLiteral.sksl",
"/sksl/errors/OverflowInt64Literal.rts",
@@ -163,6 +173,7 @@ sksl_error_tests = [
"/sksl/errors/OverflowParamArraySize.rts",
"/sksl/errors/OverflowShortLiteral.sksl",
"/sksl/errors/OverflowUintLiteral.sksl",
+ "/sksl/errors/OverloadedBuiltin.sksl",
"/sksl/errors/PrecisionQualifiersDisallowed.sksl",
"/sksl/errors/PrivateTypes.rts",
"/sksl/errors/PrivateVariables.rts",
@@ -284,6 +295,19 @@ sksl_glsl_tests = [
]
sksl_metal_tests = [
+ "/sksl/compute/ArrayAdd.compute",
+ "/sksl/compute/Desaturate.compute",
+ "/sksl/compute/DesaturateFunction.compute",
+ "/sksl/compute/DesaturateReadWrite.compute",
+ "/sksl/compute/MatrixMultiply.compute",
+ "/sksl/compute/Raytrace.compute",
+ "/sksl/compute/Threadgroup.compute",
+ "/sksl/errors/ComputeUniform.compute",
+ "/sksl/errors/DuplicateBinding.compute",
+ "/sksl/errors/InvalidInOutType.compute",
+ "/sksl/errors/InvalidMainParameters.compute",
+ "/sksl/errors/InvalidMainReturn.compute",
+ "/sksl/errors/UnspecifiedBinding.compute",
"/sksl/metal/CastHalf4ToMat2x2.sksl",
"/sksl/metal/CastMat2x2ToMat3x3.sksl",
"/sksl/metal/CastMat2x3ToMat4x4.sksl",
@@ -292,6 +316,7 @@ sksl_metal_tests = [
"/sksl/metal/NumericGlobals.sksl",
"/sksl/metal/OpaqueTypeInInterfaceBlock.sksl",
"/sksl/metal/OpaqueTypeInStruct.sksl",
+ "/sksl/metal/Ossfuzz48371.sksl",
"/sksl/metal/OutParams.sksl",
"/sksl/metal/OutVarsRequireLocation.sksl",
"/sksl/metal/SamplerGlobals.sksl",
@@ -299,6 +324,11 @@ sksl_metal_tests = [
]
sksl_spirv_tests = [
+ "/sksl/errors/LayoutInInterfaceBlock.sksl",
+ "/sksl/errors/LayoutInStruct.sksl",
+ "/sksl/errors/Ossfuzz36850.sksl",
+ "/sksl/errors/Ossfuzz37469.sksl",
+ "/sksl/errors/UndefinedFunction.rts",
"/sksl/shared/Switch.sksl",
"/sksl/shared/SwitchDefaultOnly.sksl",
"/sksl/shared/SwitchWithFallthrough.sksl",
@@ -314,19 +344,14 @@ sksl_spirv_tests = [
"/sksl/spirv/Ossfuzz44096.sksl",
"/sksl/spirv/UnusedInterfaceBlock.sksl",
"/sksl/workarounds/RewriteMatrixVectorMultiply.sksl",
- "/sksl/errors/LayoutInInterfaceBlock.sksl",
- "/sksl/errors/LayoutInStruct.sksl",
- "/sksl/errors/Ossfuzz36850.sksl",
- "/sksl/errors/Ossfuzz37469.sksl",
- "/sksl/errors/UndefinedFunction.rts",
]
sksl_wgsl_tests = [
"/sksl/wgsl/BuiltinFragmentStageIO.sksl",
"/sksl/wgsl/BuiltinVertexStageIO.vert",
+ "/sksl/wgsl/MainDoesNotHaveFragCoordParameter.sksl",
"/sksl/wgsl/MainHasFragCoordParameter.sksl",
"/sksl/wgsl/MainHasVoidReturn.sksl",
- "/sksl/wgsl/MainDoesNotHaveFragCoordParameter.sksl",
"/sksl/wgsl/UserDefinedPipelineIO.sksl",
"/sksl/wgsl/VertexPositionOutputIsAlwaysDeclared.vert",
@@ -395,8 +420,8 @@ sksl_shared_tests = [
"/sksl/intrinsics/MaxInt.sksl",
"/sksl/intrinsics/MinFloat.sksl",
"/sksl/intrinsics/MinInt.sksl",
- "/sksl/intrinsics/MixFloat.sksl",
"/sksl/intrinsics/MixBool.sksl",
+ "/sksl/intrinsics/MixFloat.sksl",
"/sksl/intrinsics/Mod.sksl",
"/sksl/intrinsics/Modf.sksl",
"/sksl/intrinsics/Normalize.sksl",
@@ -440,9 +465,9 @@ sksl_shared_tests = [
"/sksl/shared/CommaMixedTypes.sksl",
"/sksl/shared/CommaSideEffects.sksl",
"/sksl/shared/ComplexDelete.sksl",
+ "/sksl/shared/ConstantIf.sksl",
"/sksl/shared/ConstArray.sksl",
"/sksl/shared/ConstVariableComparison.sksl",
- "/sksl/shared/ConstantIf.sksl",
"/sksl/shared/Control.sksl",
"/sksl/shared/DeadDoWhileLoop.sksl",
"/sksl/shared/DeadIfStatement.sksl",
@@ -463,8 +488,8 @@ sksl_shared_tests = [
"/sksl/shared/FragCoordsNoRTFlip.sksl",
"/sksl/shared/FunctionAnonymousParameters.sksl",
"/sksl/shared/FunctionArgTypeMatch.sksl",
- "/sksl/shared/FunctionReturnTypeMatch.sksl",
"/sksl/shared/FunctionPrototype.sksl",
+ "/sksl/shared/FunctionReturnTypeMatch.sksl",
"/sksl/shared/Functions.sksl",
"/sksl/shared/GaussianBlur.sksl",
"/sksl/shared/GeometricIntrinsics.sksl",
@@ -474,6 +499,8 @@ sksl_shared_tests = [
"/sksl/shared/InoutParameters.sksl",
"/sksl/shared/InoutParamsAreDistinct.sksl",
"/sksl/shared/InstanceID.vert",
+ "/sksl/shared/IntegerDivisionES3.sksl",
+ "/sksl/shared/InterfaceBlockBuffer.sksl",
"/sksl/shared/InterfaceBlockNamed.sksl",
"/sksl/shared/InterfaceBlockNamedArray.sksl",
"/sksl/shared/Matrices.sksl",
@@ -534,9 +561,10 @@ sksl_shared_tests = [
"/sksl/shared/StaticSwitchWithStaticConditionalBreak.sksl",
"/sksl/shared/StaticSwitchWithStaticConditionalBreakInsideBlock.sksl",
"/sksl/shared/StructArrayFollowedByScalar.sksl",
+ "/sksl/shared/StructMaxDepth.sksl",
"/sksl/shared/Structs.sksl",
"/sksl/shared/StructsInFunctions.sksl",
- "/sksl/shared/StructMaxDepth.sksl",
+ "/sksl/shared/SwitchWithEarlyReturn.sksl",
"/sksl/shared/SwizzleBoolConstants.sksl",
"/sksl/shared/SwizzleByConstantIndex.sksl",
"/sksl/shared/SwizzleByIndex.sksl",
@@ -549,7 +577,6 @@ sksl_shared_tests = [
"/sksl/shared/TernaryAsLValueEntirelyFoldable.sksl",
"/sksl/shared/TernaryAsLValueFoldableTest.sksl",
"/sksl/shared/TernaryExpression.sksl",
- "/sksl/shared/Texture1D.sksl",
"/sksl/shared/Texture2D.sksl",
"/sksl/shared/TextureSharpen.sksl",
"/sksl/shared/UnaryPositiveNegative.sksl",
@@ -575,14 +602,17 @@ sksl_folding_tests = [
"/sksl/folding/IntFoldingES3.sksl",
"/sksl/folding/MatrixFoldingES2.sksl",
"/sksl/folding/MatrixFoldingES3.sksl",
+ "/sksl/folding/MatrixNoOpFolding.sksl",
+ "/sksl/folding/MatrixScalarNoOpFolding.sksl",
+ "/sksl/folding/MatrixVectorNoOpFolding.sksl",
"/sksl/folding/Negation.sksl",
"/sksl/folding/PreserveSideEffects.sksl",
"/sksl/folding/SelfAssignment.sksl",
"/sksl/folding/ShortCircuitBoolFolding.sksl",
"/sksl/folding/StructFieldFolding.sksl",
"/sksl/folding/StructFieldNoFolding.sksl",
- "/sksl/folding/SwizzleFolding.sksl",
"/sksl/folding/SwitchCaseFolding.sksl",
+ "/sksl/folding/SwizzleFolding.sksl",
"/sksl/folding/TernaryFolding.sksl",
"/sksl/folding/VectorScalarFolding.sksl",
"/sksl/folding/VectorVectorFolding.sksl",
@@ -593,25 +623,25 @@ sksl_inliner_tests = [
"/sksl/inliner/DoWhileTestCannotBeInlined.sksl",
"/sksl/inliner/ForBodyMustBeInlinedIntoAScope.sksl",
"/sksl/inliner/ForInitializerExpressionsCanBeInlined.sksl",
- "/sksl/inliner/ForWithReturnInsideCannotBeInlined.sksl",
"/sksl/inliner/ForWithoutReturnInsideCanBeInlined.sksl",
+ "/sksl/inliner/ForWithReturnInsideCannotBeInlined.sksl",
"/sksl/inliner/IfBodyMustBeInlinedIntoAScope.sksl",
"/sksl/inliner/IfElseBodyMustBeInlinedIntoAScope.sksl",
"/sksl/inliner/IfElseChainWithReturnsCanBeInlined.sksl",
"/sksl/inliner/IfTestCanBeInlined.sksl",
"/sksl/inliner/IfWithReturnsCanBeInlined.sksl",
"/sksl/inliner/InlineKeywordOverridesThreshold.sksl",
- "/sksl/inliner/InlineThreshold.sksl",
+ "/sksl/inliner/InlinerAvoidsVariableNameOverlap.sksl",
"/sksl/inliner/InlinerElidesTempVarForReturnsInsideBlock.sksl",
+ "/sksl/inliner/InlinerManglesNames.sksl",
"/sksl/inliner/InlinerUsesTempVarForMultipleReturns.sksl",
"/sksl/inliner/InlinerUsesTempVarForReturnsInsideBlockWithVar.sksl",
+ "/sksl/inliner/InlineThreshold.sksl",
"/sksl/inliner/InlineWithModifiedArgument.sksl",
"/sksl/inliner/InlineWithNestedBigCalls.sksl",
"/sksl/inliner/InlineWithNestedCalls.sksl",
"/sksl/inliner/InlineWithUnmodifiedArgument.sksl",
"/sksl/inliner/InlineWithUnnecessaryBlocks.sksl",
- "/sksl/inliner/InlinerAvoidsVariableNameOverlap.sksl",
- "/sksl/inliner/InlinerManglesNames.sksl",
"/sksl/inliner/NoInline.sksl",
"/sksl/inliner/Ossfuzz37994.sksl",
"/sksl/inliner/ShortCircuitEvaluationsCannotInlineRightHandSide.sksl",
@@ -670,6 +700,7 @@ sksl_settings_tests = [
"/sksl/shared/SwitchDefaultOnly.sksl",
"/sksl/shared/SwitchWithFallthrough.sksl",
"/sksl/shared/SwitchWithLoops.sksl",
+ "/sksl/shared/SwitchWithLoopsES3.sksl",
"/sksl/workarounds/AbsInt.sksl",
"/sksl/workarounds/BlendGuardedDivide.sksl",
"/sksl/workarounds/FractNegative.sksl",
@@ -694,8 +725,8 @@ sksl_rte_tests = [
"/sksl/runtime/Commutative.rts",
"/sksl/runtime/ConstPreservation.rts",
"/sksl/runtime/ConversionConstructors.rts",
- "/sksl/runtime/GLSLTypeNames.rts",
"/sksl/runtime/GlobalVariables.rts",
+ "/sksl/runtime/GLSLTypeNames.rts",
"/sksl/runtime/LargeProgram_BlocklessLoops.rts",
"/sksl/runtime/LargeProgram_FlatLoop.rts",
"/sksl/runtime/LargeProgram_Functions.rts",
@@ -703,13 +734,13 @@ sksl_rte_tests = [
"/sksl/runtime/LargeProgram_SplitLoops.rts",
"/sksl/runtime/LargeProgram_StackDepth.rts",
"/sksl/runtime/LargeProgram_ZeroIterFor.rts",
- "/sksl/runtime/LoopInt.rts",
"/sksl/runtime/LoopFloat.rts",
+ "/sksl/runtime/LoopInt.rts",
"/sksl/runtime/MultipleCallsInOneStatement.rts",
"/sksl/runtime/PrecisionQualifiers.rts",
"/sksl/runtime/QualifierOrder.rts",
- "/sksl/runtime/RecursiveComparison_Structs.rts",
"/sksl/runtime/RecursiveComparison_Arrays.rts",
+ "/sksl/runtime/RecursiveComparison_Structs.rts",
"/sksl/runtime/RecursiveComparison_Types.rts",
"/sksl/runtime/RecursiveComparison_Vectors.rts",
"/sksl/runtime/SampleWithExplicitCoord.rts",
@@ -726,6 +757,8 @@ sksl_rte_error_tests = [
"/sksl/runtime_errors/FirstClassArrays.rts",
"/sksl/runtime_errors/IllegalArrayOps.rts",
"/sksl/runtime_errors/IllegalIndexing.rts",
+ "/sksl/runtime_errors/IllegalLayoutFlags.rts",
+ "/sksl/runtime_errors/IllegalModifiers.rts",
"/sksl/runtime_errors/IllegalOperators.rts",
"/sksl/runtime_errors/IllegalPrecisionQualifiers.rts",
"/sksl/runtime_errors/IllegalShaderSampling.rts",
@@ -736,6 +769,7 @@ sksl_rte_error_tests = [
"/sksl/runtime_errors/InvalidColorFilterMain.rtcf",
"/sksl/runtime_errors/InvalidShaderMain.rts",
"/sksl/runtime_errors/InvalidUniformTypes.rts",
+ "/sksl/runtime_errors/InvalidUniformTypesES3.rts",
"/sksl/runtime_errors/LoopConditionErrors.rts",
"/sksl/runtime_errors/LoopExpressionErrors.rts",
"/sksl/runtime_errors/LoopInitializerErrors.rts",
@@ -751,7 +785,6 @@ sksl_rte_error_tests = [
"/sksl/runtime_errors/ProgramTooLarge_NestedLoops.rts",
"/sksl/runtime_errors/ProgramTooLarge_SplitLoops.rts",
"/sksl/runtime_errors/ProgramTooLarge_StackDepth.rts",
- "/sksl/runtime_errors/ReservedNameISampler2D.rts",
"/sksl/runtime_errors/ReservedNameSampler.rts",
"/sksl/runtime_errors/ReservedNameSampler1D.rts",
"/sksl/runtime_errors/ReservedNameSampler2D.rts",
diff --git a/chromium/third_party/skia/gn/tests.gni b/chromium/third_party/skia/gn/tests.gni
index 2f29b00fb88..9d3d7d21842 100644
--- a/chromium/third_party/skia/gn/tests.gni
+++ b/chromium/third_party/skia/gn/tests.gni
@@ -15,6 +15,7 @@ tests_sources = [
"$_tests/ApplyGammaTest.cpp",
"$_tests/ArenaAllocTest.cpp",
"$_tests/AsADashTest.cpp",
+ "$_tests/AvifTest.cpp",
"$_tests/BRDTest.cpp",
"$_tests/BackendAllocationTest.cpp",
"$_tests/BackendSurfaceMutableStateTest.cpp",
@@ -26,7 +27,6 @@ tests_sources = [
"$_tests/BlendTest.cpp",
"$_tests/BlitMaskClip.cpp",
"$_tests/BlurTest.cpp",
- "$_tests/CTest.cpp",
"$_tests/CachedDataTest.cpp",
"$_tests/CachedDecodingPixelRefTest.cpp",
"$_tests/CanvasStateHelpers.cpp",
@@ -98,6 +98,7 @@ tests_sources = [
"$_tests/GrDDLImageTest.cpp",
"$_tests/GrFinishedFlushTest.cpp",
"$_tests/GrGlyphVectorTest.cpp",
+ "$_tests/GrGpuBufferTest.cpp",
"$_tests/GrMemoryPoolTest.cpp",
"$_tests/GrOpListFlushTest.cpp",
"$_tests/GrPorterDuffTest.cpp",
@@ -254,8 +255,8 @@ tests_sources = [
"$_tests/SkSLTest.cpp",
"$_tests/SkSLTypeTest.cpp",
"$_tests/SkScalerCacheTest.cpp",
- "$_tests/SkShaperJSONWriterTest.cpp",
"$_tests/SkSharedMutexTest.cpp",
+ "$_tests/SkSpanTest.cpp",
"$_tests/SkStrikeCacheTest.cpp",
"$_tests/SkStringViewTest.cpp",
"$_tests/SkTBlockListTest.cpp",
@@ -275,6 +276,7 @@ tests_sources = [
"$_tests/SrcSrcOverBatchTest.cpp",
"$_tests/StreamBufferTest.cpp",
"$_tests/StreamTest.cpp",
+ "$_tests/StrikeForGPUTest.cpp",
"$_tests/StringTest.cpp",
"$_tests/StrokeTest.cpp",
"$_tests/StrokerTest.cpp",
@@ -332,21 +334,26 @@ metal_tests_sources = [
graphite_tests_sources = [
"$_tests/graphite/BackendTextureTest.cpp",
- "$_tests/graphite/CombinationBuilderTest.cpp",
- "$_tests/graphite/CommandBufferTest.cpp",
+ "$_tests/graphite/BoundsManagerTest.cpp",
"$_tests/graphite/GraphiteResourceCacheTest.cpp",
"$_tests/graphite/IntersectionTreeTest.cpp",
"$_tests/graphite/KeyTest.cpp",
- "$_tests/graphite/PaintParamsKeyTest.cpp",
"$_tests/graphite/PipelineDataCacheTest.cpp",
"$_tests/graphite/RTEffectTest.cpp",
"$_tests/graphite/RecorderTest.cpp",
"$_tests/graphite/RectTest.cpp",
"$_tests/graphite/ShapeTest.cpp",
"$_tests/graphite/TransformTest.cpp",
+ "$_tests/graphite/UniformManagerTest.cpp",
"$_tests/graphite/UploadBufferManagerTest.cpp",
]
+precompile_tests_sources = [
+ "$_tests/graphite/CombinationBuilderTest.cpp",
+ "$_tests/graphite/CombinationBuilderTestAccess.h",
+ "$_tests/graphite/PaintParamsKeyTest.cpp",
+]
+
graphite_metal_tests_sources = [ "$_tests/graphite/MtlBackendTextureTest.mm" ]
pathops_tests_sources = [
diff --git a/chromium/third_party/skia/gn/utils.gni b/chromium/third_party/skia/gn/utils.gni
index 97f5ed66295..202cf81de79 100644
--- a/chromium/third_party/skia/gn/utils.gni
+++ b/chromium/third_party/skia/gn/utils.gni
@@ -14,9 +14,9 @@ skia_utils_public = [
"$_include/utils/SkCanvasStateUtils.h",
"$_include/utils/SkCustomTypeface.h",
"$_include/utils/SkEventTracer.h",
- "$_include/utils/SkNWayCanvas.h",
"$_include/utils/SkNoDrawCanvas.h",
"$_include/utils/SkNullCanvas.h",
+ "$_include/utils/SkNWayCanvas.h",
"$_include/utils/SkOrderedFontMgr.h",
"$_include/utils/SkPaintFilterCanvas.h",
"$_include/utils/SkParse.h",
@@ -51,6 +51,7 @@ skia_utils_sources = [
"$_src/utils/SkFloatToDecimal.cpp",
"$_src/utils/SkFloatToDecimal.h",
"$_src/utils/SkFloatUtils.h",
+ "$_src/utils/SkGaussianColorFilter.cpp",
"$_src/utils/SkJSON.cpp",
"$_src/utils/SkJSON.h",
"$_src/utils/SkJSONWriter.cpp",
@@ -76,8 +77,6 @@ skia_utils_sources = [
"$_src/utils/SkShadowTessellator.cpp",
"$_src/utils/SkShadowTessellator.h",
"$_src/utils/SkShadowUtils.cpp",
- "$_src/utils/SkShaperJSONWriter.cpp",
- "$_src/utils/SkShaperJSONWriter.h",
"$_src/utils/SkTestCanvas.h",
"$_src/utils/SkTextUtils.cpp",
"$_src/utils/SkThreadUtils_pthread.cpp",
diff --git a/chromium/third_party/skia/gn/xps.gni b/chromium/third_party/skia/gn/xps.gni
index d18e550456f..eb4a94315fa 100644
--- a/chromium/third_party/skia/gn/xps.gni
+++ b/chromium/third_party/skia/gn/xps.gni
@@ -10,8 +10,10 @@ _include = get_path_info("../include", "abspath")
skia_xps_public = [ "$_include/docs/SkXPSDocument.h" ]
skia_xps_sources = [
- "$_include/docs/SkXPSDocument.h",
"$_src/xps/SkXPSDevice.cpp",
"$_src/xps/SkXPSDevice.h",
"$_src/xps/SkXPSDocument.cpp",
+
+ # headers
+ "$_include/docs/SkXPSDocument.h",
]
diff --git a/chromium/third_party/skia/go.mod b/chromium/third_party/skia/go.mod
index 3c8faf15527..e75f1d5c753 100644
--- a/chromium/third_party/skia/go.mod
+++ b/chromium/third_party/skia/go.mod
@@ -18,5 +18,6 @@ require (
golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce
golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a
google.golang.org/api v0.74.0
+ google.golang.org/protobuf v1.28.0 // indirect
nhooyr.io/websocket v1.8.7 // indirect
)
diff --git a/chromium/third_party/skia/go_repositories.bzl b/chromium/third_party/skia/go_repositories.bzl
index 82d73892f80..6acbe1475b1 100644
--- a/chromium/third_party/skia/go_repositories.bzl
+++ b/chromium/third_party/skia/go_repositories.bzl
@@ -2923,6 +2923,12 @@ def go_repositories():
version = "v1.1.2",
)
go_repository(
+ name = "com_github_vektra_mockery_v2",
+ importpath = "github.com/vektra/mockery/v2",
+ sum = "h1:9NkC3urGvJS9B0ve5aTbFjksbO9f/u5cZFgCTVJ30jg=",
+ version = "v2.11.0",
+ )
+ go_repository(
name = "com_github_vividcortex_godaemon",
importpath = "github.com/VividCortex/godaemon",
sum = "h1:CGNNnJTXn6efEPOEHlxqRrvg9AP0Hsumy9vbXk8aU/k=",
diff --git a/chromium/third_party/skia/include/BUILD.bazel b/chromium/third_party/skia/include/BUILD.bazel
index 8c6eb0a0378..faf8d121d1f 100644
--- a/chromium/third_party/skia/include/BUILD.bazel
+++ b/chromium/third_party/skia/include/BUILD.bazel
@@ -16,14 +16,15 @@ filegroup(
"//include/encode:public_hdrs",
"//include/pathops:public_hdrs",
"//include/ports:public_hdrs",
- "//include/svg:public_hdrs",
- "//include/third_party/skcms:public_hdrs",
"//include/utils:public_hdrs",
] + select({
- "//bazel/common_config_settings:needs_sksl": ["//include/sksl:public_hdrs"],
+ "//src/sksl:needs_sksl": ["//include/sksl:public_hdrs"],
"//conditions:default": [],
}) + select({
- "//bazel/common_config_settings:has_gpu_backend": ["//include/gpu:public_hdrs"],
+ "//src/gpu:has_gpu_backend": ["//include/gpu:public_hdrs"],
+ "//conditions:default": [],
+ }) + select({
+ "//src/svg:enable_svg_canvas_true": ["//include/svg:public_hdrs"],
"//conditions:default": [],
}),
visibility = ["//:__pkg__"],
diff --git a/chromium/third_party/skia/include/c/BUILD.bazel b/chromium/third_party/skia/include/c/BUILD.bazel
deleted file mode 100644
index 69666adff23..00000000000
--- a/chromium/third_party/skia/include/c/BUILD.bazel
+++ /dev/null
@@ -1,5 +0,0 @@
-load("//bazel:macros.bzl", "exports_files_legacy")
-
-licenses(["notice"])
-
-exports_files_legacy()
diff --git a/chromium/third_party/skia/include/c/sk_canvas.h b/chromium/third_party/skia/include/c/sk_canvas.h
deleted file mode 100644
index 751c07ba3b3..00000000000
--- a/chromium/third_party/skia/include/c/sk_canvas.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_canvas_DEFINED
-#define sk_canvas_DEFINED
-
-#include "include/c/sk_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-/**
- Save the current matrix and clip on the canvas. When the
- balancing call to sk_canvas_restore() is made, the previous matrix
- and clip are restored.
-*/
-SK_API void sk_canvas_save(sk_canvas_t*);
-/**
- This behaves the same as sk_canvas_save(), but in addition it
- allocates an offscreen surface. All drawing calls are directed
- there, and only when the balancing call to sk_canvas_restore() is
- made is that offscreen transfered to the canvas (or the previous
- layer).
-
- @param sk_rect_t* (may be null) This rect, if non-null, is used as
- a hint to limit the size of the offscreen, and
- thus drawing may be clipped to it, though that
- clipping is not guaranteed to happen. If exact
- clipping is desired, use sk_canvas_clip_rect().
- @param sk_paint_t* (may be null) The paint is copied, and is applied
- to the offscreen when sk_canvas_restore() is
- called.
-*/
-SK_API void sk_canvas_save_layer(sk_canvas_t*, const sk_rect_t*, const sk_paint_t*);
-/**
- This call balances a previous call to sk_canvas_save() or
- sk_canvas_save_layer(), and is used to remove all modifications to
- the matrix and clip state since the last save call. It is an
- error to call sk_canvas_restore() more times than save and
- save_layer were called.
-*/
-SK_API void sk_canvas_restore(sk_canvas_t*);
-
-/**
- Preconcat the current coordinate transformation matrix with the
- specified translation.
-*/
-SK_API void sk_canvas_translate(sk_canvas_t*, float dx, float dy);
-/**
- Preconcat the current coordinate transformation matrix with the
- specified scale.
-*/
-SK_API void sk_canvas_scale(sk_canvas_t*, float sx, float sy);
-/**
- Preconcat the current coordinate transformation matrix with the
- specified rotation in degrees.
-*/
-SK_API void sk_canvas_rotate_degrees(sk_canvas_t*, float degrees);
-/**
- Preconcat the current coordinate transformation matrix with the
- specified rotation in radians.
-*/
-SK_API void sk_canvas_rotate_radians(sk_canvas_t*, float radians);
-/**
- Preconcat the current coordinate transformation matrix with the
- specified skew.
-*/
-SK_API void sk_canvas_skew(sk_canvas_t*, float sx, float sy);
-/**
- Preconcat the current coordinate transformation matrix with the
- specified matrix.
-*/
-SK_API void sk_canvas_concat(sk_canvas_t*, const sk_matrix_t*);
-
-/**
- Modify the current clip with the specified rectangle. The new
- current clip will be the intersection of the old clip and the
- rectange.
-*/
-SK_API void sk_canvas_clip_rect(sk_canvas_t*, const sk_rect_t*);
-/**
- Modify the current clip with the specified path. The new
- current clip will be the intersection of the old clip and the
- path.
-*/
-SK_API void sk_canvas_clip_path(sk_canvas_t*, const sk_path_t*);
-
-/**
- Fill the entire canvas (restricted to the current clip) with the
- specified paint.
-*/
-SK_API void sk_canvas_draw_paint(sk_canvas_t*, const sk_paint_t*);
-/**
- Draw the specified rectangle using the specified paint. The
- rectangle will be filled or stroked based on the style in the
- paint.
-*/
-SK_API void sk_canvas_draw_rect(sk_canvas_t*, const sk_rect_t*, const sk_paint_t*);
-/**
- * Draw the circle centered at (cx, cy) with radius rad using the specified paint.
- * The circle will be filled or framed based on the style in the paint
- */
-SK_API void sk_canvas_draw_circle(sk_canvas_t*, float cx, float cy, float rad, const sk_paint_t*);
-/**
- Draw the specified oval using the specified paint. The oval will be
- filled or framed based on the style in the paint
-*/
-SK_API void sk_canvas_draw_oval(sk_canvas_t*, const sk_rect_t*, const sk_paint_t*);
-/**
- Draw the specified path using the specified paint. The path will be
- filled or framed based on the style in the paint
-*/
-SK_API void sk_canvas_draw_path(sk_canvas_t*, const sk_path_t*, const sk_paint_t*);
-/**
- Draw the specified image, with its top/left corner at (x,y), using
- the specified paint, transformed by the current matrix.
-
- @param sk_paint_t* (may be NULL) the paint used to draw the image.
-*/
-SK_API void sk_canvas_draw_image(sk_canvas_t*, const sk_image_t*, float x, float y,
- const sk_sampling_options_t*, const sk_paint_t*);
-/**
- Draw the specified image, scaling and translating so that it fills
- the specified dst rect. If the src rect is non-null, only that
- subset of the image is transformed and drawn.
-
- @param sk_paint_t* (may be NULL) The paint used to draw the image.
-*/
-SK_API void sk_canvas_draw_image_rect(sk_canvas_t*, const sk_image_t*,
- const sk_rect_t* src, const sk_rect_t* dst,
- const sk_sampling_options_t*, const sk_paint_t*);
-
-/**
- Draw the picture into this canvas (replay the pciture's drawing commands).
-
- @param sk_matrix_t* If non-null, apply that matrix to the CTM when
- drawing this picture. This is logically
- equivalent to: save, concat, draw_picture,
- restore.
-
- @param sk_paint_t* If non-null, draw the picture into a temporary
- buffer, and then apply the paint's alpha,
- colorfilter, imagefilter, and xfermode to that
- buffer as it is drawn to the canvas. This is
- logically equivalent to save_layer(paint),
- draw_picture, restore.
-*/
-SK_API void sk_canvas_draw_picture(sk_canvas_t*, const sk_picture_t*,
- const sk_matrix_t*, const sk_paint_t*);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
diff --git a/chromium/third_party/skia/include/c/sk_colorspace.h b/chromium/third_party/skia/include/c/sk_colorspace.h
deleted file mode 100644
index 31839840d0d..00000000000
--- a/chromium/third_party/skia/include/c/sk_colorspace.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 2018 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_colorspace_DEFINED
-#define sk_colorspace_DEFINED
-
-#include "include/c/sk_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-SK_API sk_colorspace_t* sk_colorspace_new_srgb();
-
-SK_API void sk_colorspace_ref(sk_colorspace_t*);
-SK_API void sk_colorspace_unref(sk_colorspace_t*);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
diff --git a/chromium/third_party/skia/include/c/sk_data.h b/chromium/third_party/skia/include/c/sk_data.h
deleted file mode 100644
index a330b92f2a3..00000000000
--- a/chromium/third_party/skia/include/c/sk_data.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_data_DEFINED
-#define sk_data_DEFINED
-
-#include "include/c/sk_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-/**
- Returns a new sk_data_t by copying the specified source data.
- This call must be balanced with a call to sk_data_unref().
-*/
-SK_API sk_data_t* sk_data_new_with_copy(const void* src, size_t length);
-/**
- Pass ownership of the given memory to a new sk_data_t, which will
- call free() when the refernce count of the data goes to zero. For
- example:
- size_t length = 1024;
- void* buffer = malloc(length);
- memset(buffer, 'X', length);
- sk_data_t* data = sk_data_new_from_malloc(buffer, length);
- This call must be balanced with a call to sk_data_unref().
-*/
-SK_API sk_data_t* sk_data_new_from_malloc(const void* memory, size_t length);
-/**
- Returns a new sk_data_t using a subset of the data in the
- specified source sk_data_t. This call must be balanced with a
- call to sk_data_unref().
-*/
-SK_API sk_data_t* sk_data_new_subset(const sk_data_t* src, size_t offset, size_t length);
-
-/**
- Increment the reference count on the given sk_data_t. Must be
- balanced by a call to sk_data_unref().
-*/
-SK_API void sk_data_ref(const sk_data_t*);
-/**
- Decrement the reference count. If the reference count is 1 before
- the decrement, then release both the memory holding the sk_data_t
- and the memory it is managing. New sk_data_t are created with a
- reference count of 1.
-*/
-SK_API void sk_data_unref(const sk_data_t*);
-
-/**
- Returns the number of bytes stored.
-*/
-SK_API size_t sk_data_get_size(const sk_data_t*);
-/**
- Returns the pointer to the data.
- */
-SK_API const void* sk_data_get_data(const sk_data_t*);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
diff --git a/chromium/third_party/skia/include/c/sk_image.h b/chromium/third_party/skia/include/c/sk_image.h
deleted file mode 100644
index d8ddc145db7..00000000000
--- a/chromium/third_party/skia/include/c/sk_image.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_image_DEFINED
-#define sk_image_DEFINED
-
-#include "include/c/sk_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-/**
- * Return a new image that has made a copy of the provided pixels, or NULL on failure.
- * Balance with a call to sk_image_unref().
- */
-SK_API sk_image_t* sk_image_new_raster_copy(const sk_imageinfo_t*, const void* pixels, size_t rowBytes);
-
-/**
- * If the specified data can be interpreted as a compressed image (e.g. PNG or JPEG) then this
- * returns an image. If the encoded data is not supported, returns NULL.
- *
- * On success, the encoded data may be processed immediately, or it may be ref()'d for later
- * use.
- */
-SK_API sk_image_t* sk_image_new_from_encoded(const sk_data_t* encoded);
-
-/**
- * Encode the image's pixels and return the result as a new PNG in a
- * sk_data_t, which the caller must manage: call sk_data_unref() when
- * they are done.
- *
- * If the image type cannot be encoded, this will return NULL.
- */
-SK_API sk_data_t* sk_image_encode(const sk_image_t*);
-
-/**
- * Increment the reference count on the given sk_image_t. Must be
- * balanced by a call to sk_image_unref().
-*/
-SK_API void sk_image_ref(const sk_image_t*);
-/**
- * Decrement the reference count. If the reference count is 1 before
- * the decrement, then release both the memory holding the sk_image_t
- * and the memory it is managing. New sk_image_t are created with a
- reference count of 1.
-*/
-SK_API void sk_image_unref(const sk_image_t*);
-
-/**
- * Return the width of the sk_image_t/
- */
-SK_API int sk_image_get_width(const sk_image_t*);
-/**
- * Return the height of the sk_image_t/
- */
-SK_API int sk_image_get_height(const sk_image_t*);
-
-/**
- * Returns a non-zero value unique among all images.
- */
-SK_API uint32_t sk_image_get_unique_id(const sk_image_t*);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
diff --git a/chromium/third_party/skia/include/c/sk_imageinfo.h b/chromium/third_party/skia/include/c/sk_imageinfo.h
deleted file mode 100644
index 6c8e9fff249..00000000000
--- a/chromium/third_party/skia/include/c/sk_imageinfo.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2018 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_imageinfo_DEFINED
-#define sk_imageinfo_DEFINED
-
-#include "include/c/sk_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-typedef enum {
- UNKNOWN_SK_COLORTYPE,
- RGBA_8888_SK_COLORTYPE,
- BGRA_8888_SK_COLORTYPE,
- ALPHA_8_SK_COLORTYPE,
- GRAY_8_SK_COLORTYPE,
- RGBA_F16_SK_COLORTYPE,
- RGBA_F32_SK_COLORTYPE,
-} sk_colortype_t;
-
-typedef enum {
- OPAQUE_SK_ALPHATYPE,
- PREMUL_SK_ALPHATYPE,
- UNPREMUL_SK_ALPHATYPE,
-} sk_alphatype_t;
-
-/**
- * Allocate a new imageinfo object. If colorspace is not null, it's owner-count will be
- * incremented automatically.
- */
-SK_API sk_imageinfo_t* sk_imageinfo_new(int width, int height, sk_colortype_t ct, sk_alphatype_t at,
- sk_colorspace_t* cs);
-
-/**
- * Free the imageinfo object. If it contains a reference to a colorspace, its owner-count will
- * be decremented automatically.
- */
-SK_API void sk_imageinfo_delete(sk_imageinfo_t*);
-
-SK_API int32_t sk_imageinfo_get_width(const sk_imageinfo_t*);
-SK_API int32_t sk_imageinfo_get_height(const sk_imageinfo_t*);
-SK_API sk_colortype_t sk_imageinfo_get_colortype(const sk_imageinfo_t*);
-SK_API sk_alphatype_t sk_imageinfo_get_alphatype(const sk_imageinfo_t*);
-
-/**
- * Return the colorspace object reference contained in the imageinfo, or null if there is none.
- * Note: this does not modify the owner-count on the colorspace object. If the caller needs to
- * use the colorspace beyond the lifetime of the imageinfo, it should manually call
- * sk_colorspace_ref() (and then call unref() when it is done).
- */
-SK_API sk_colorspace_t* sk_imageinfo_get_colorspace(const sk_imageinfo_t*);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
diff --git a/chromium/third_party/skia/include/c/sk_maskfilter.h b/chromium/third_party/skia/include/c/sk_maskfilter.h
deleted file mode 100644
index c8aa7ed4454..00000000000
--- a/chromium/third_party/skia/include/c/sk_maskfilter.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_maskfilter_DEFINED
-#define sk_maskfilter_DEFINED
-
-#include "include/c/sk_types.h"
-
-typedef enum {
- NORMAL_SK_BLUR_STYLE, //!< fuzzy inside and outside
- SOLID_SK_BLUR_STYLE, //!< solid inside, fuzzy outside
- OUTER_SK_BLUR_STYLE, //!< nothing inside, fuzzy outside
- INNER_SK_BLUR_STYLE, //!< fuzzy inside, nothing outside
-} sk_blurstyle_t;
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-/**
- Increment the reference count on the given sk_maskfilter_t. Must be
- balanced by a call to sk_maskfilter_unref().
-*/
-SK_API void sk_maskfilter_ref(sk_maskfilter_t*);
-/**
- Decrement the reference count. If the reference count is 1 before
- the decrement, then release both the memory holding the
- sk_maskfilter_t and any other associated resources. New
- sk_maskfilter_t are created with a reference count of 1.
-*/
-SK_API void sk_maskfilter_unref(sk_maskfilter_t*);
-
-/**
- Create a blur maskfilter.
- @param sk_blurstyle_t The SkBlurStyle to use
- @param sigma Standard deviation of the Gaussian blur to apply. Must be > 0.
-*/
-SK_API sk_maskfilter_t* sk_maskfilter_new_blur(sk_blurstyle_t, float sigma);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
diff --git a/chromium/third_party/skia/include/c/sk_matrix.h b/chromium/third_party/skia/include/c/sk_matrix.h
deleted file mode 100644
index 244863c4f26..00000000000
--- a/chromium/third_party/skia/include/c/sk_matrix.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_matrix_DEFINED
-#define sk_matrix_DEFINED
-
-#include "include/c/sk_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-/** Set the matrix to identity */
-void sk_matrix_set_identity(sk_matrix_t*);
-
-/** Set the matrix to translate by (tx, ty). */
-void sk_matrix_set_translate(sk_matrix_t*, float tx, float ty);
-/**
- Preconcats the matrix with the specified translation.
- M' = M * T(dx, dy)
-*/
-void sk_matrix_pre_translate(sk_matrix_t*, float tx, float ty);
-/**
- Postconcats the matrix with the specified translation.
- M' = T(dx, dy) * M
-*/
-void sk_matrix_post_translate(sk_matrix_t*, float tx, float ty);
-
-/** Set the matrix to scale by sx and sy. */
-void sk_matrix_set_scale(sk_matrix_t*, float sx, float sy);
-/**
- Preconcats the matrix with the specified scale.
- M' = M * S(sx, sy)
-*/
-void sk_matrix_pre_scale(sk_matrix_t*, float sx, float sy);
-/**
- Postconcats the matrix with the specified scale.
- M' = S(sx, sy) * M
-*/
-void sk_matrix_post_scale(sk_matrix_t*, float sx, float sy);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
diff --git a/chromium/third_party/skia/include/c/sk_paint.h b/chromium/third_party/skia/include/c/sk_paint.h
deleted file mode 100644
index 98ba4954c18..00000000000
--- a/chromium/third_party/skia/include/c/sk_paint.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_paint_DEFINED
-#define sk_paint_DEFINED
-
-#include "include/c/sk_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-/**
- Create a new paint with default settings:
- antialias : false
- stroke : false
- stroke width : 0.0f (hairline)
- stroke miter : 4.0f
- stroke cap : BUTT_SK_STROKE_CAP
- stroke join : MITER_SK_STROKE_JOIN
- color : opaque black
- shader : NULL
- maskfilter : NULL
- xfermode_mode : SRCOVER_SK_XFERMODE_MODE
-*/
-SK_API sk_paint_t* sk_paint_new(void);
-/**
- Release the memory storing the sk_paint_t and unref() all
- associated objects.
-*/
-SK_API void sk_paint_delete(sk_paint_t*);
-
-/**
- Return true iff the paint has antialiasing enabled.
-*/
-SK_API bool sk_paint_is_antialias(const sk_paint_t*);
-/**
- Set to true to enable antialiasing, false to disable it on this
- sk_paint_t.
-*/
-SK_API void sk_paint_set_antialias(sk_paint_t*, bool);
-
-/**
- Return the paint's curent drawing color.
-*/
-SK_API sk_color_t sk_paint_get_color(const sk_paint_t*);
-/**
- Set the paint's curent drawing color.
-*/
-SK_API void sk_paint_set_color(sk_paint_t*, sk_color_t);
-
-/* stroke settings */
-
-/**
- Return true iff stroking is enabled rather than filling on this
- sk_paint_t.
-*/
-SK_API bool sk_paint_is_stroke(const sk_paint_t*);
-/**
- Set to true to enable stroking rather than filling with this
- sk_paint_t.
-*/
-SK_API void sk_paint_set_stroke(sk_paint_t*, bool);
-
-/**
- Return the width for stroking. A value of 0 strokes in hairline mode.
- */
-SK_API float sk_paint_get_stroke_width(const sk_paint_t*);
-/**
- Set the width for stroking. A value of 0 strokes in hairline mode
- (always draw 1-pixel wide, regardless of the matrix).
- */
-SK_API void sk_paint_set_stroke_width(sk_paint_t*, float width);
-
-/**
- Return the paint's stroke miter value. This is used to control the
- behavior of miter joins when the joins angle is sharp.
-*/
-SK_API float sk_paint_get_stroke_miter(const sk_paint_t*);
-/**
- Set the paint's stroke miter value. This is used to control the
- behavior of miter joins when the joins angle is sharp. This value
- must be >= 0.
-*/
-SK_API void sk_paint_set_stroke_miter(sk_paint_t*, float miter);
-
-typedef enum {
- BUTT_SK_STROKE_CAP,
- ROUND_SK_STROKE_CAP,
- SQUARE_SK_STROKE_CAP
-} sk_stroke_cap_t;
-
-/**
- Return the paint's stroke cap type, controlling how the start and
- end of stroked lines and paths are treated.
-*/
-SK_API sk_stroke_cap_t sk_paint_get_stroke_cap(const sk_paint_t*);
-/**
- Set the paint's stroke cap type, controlling how the start and
- end of stroked lines and paths are treated.
-*/
-SK_API void sk_paint_set_stroke_cap(sk_paint_t*, sk_stroke_cap_t);
-
-typedef enum {
- MITER_SK_STROKE_JOIN,
- ROUND_SK_STROKE_JOIN,
- BEVEL_SK_STROKE_JOIN
-} sk_stroke_join_t;
-
-/**
- Return the paint's stroke join type, specifies the treatment that
- is applied to corners in paths and rectangles
- */
-SK_API sk_stroke_join_t sk_paint_get_stroke_join(const sk_paint_t*);
-/**
- Set the paint's stroke join type, specifies the treatment that
- is applied to corners in paths and rectangles
- */
-SK_API void sk_paint_set_stroke_join(sk_paint_t*, sk_stroke_join_t);
-
-/**
- * Set the paint's shader to the specified parameter. This will automatically call unref() on
- * any previous value, and call ref() on the new value.
- */
-SK_API void sk_paint_set_shader(sk_paint_t*, sk_shader_t*);
-
-/**
- * Set the paint's maskfilter to the specified parameter. This will automatically call unref() on
- * any previous value, and call ref() on the new value.
- */
-SK_API void sk_paint_set_maskfilter(sk_paint_t*, sk_maskfilter_t*);
-
-/**
- * Set the paint's xfermode to the specified parameter.
- */
-SK_API void sk_paint_set_xfermode_mode(sk_paint_t*, sk_xfermode_mode_t);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
diff --git a/chromium/third_party/skia/include/c/sk_path.h b/chromium/third_party/skia/include/c/sk_path.h
deleted file mode 100644
index ed8cbb94fea..00000000000
--- a/chromium/third_party/skia/include/c/sk_path.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_path_DEFINED
-#define sk_path_DEFINED
-
-#include "include/c/sk_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-typedef enum {
- CW_SK_PATH_DIRECTION,
- CCW_SK_PATH_DIRECTION,
-} sk_path_direction_t;
-
-typedef struct sk_pathbuilder_t sk_pathbuilder_t;
-
-/** Create a new, empty path. */
-SK_API sk_pathbuilder_t* sk_pathbuilder_new(void);
-
-/** Release the memory used by a sk_pathbuilder_t. */
-SK_API void sk_pathbuilder_delete(sk_pathbuilder_t*);
-
-/** Set the beginning of the next contour to the point (x,y). */
-SK_API void sk_pathbuilder_move_to(sk_pathbuilder_t*, float x, float y);
-/**
- Add a line from the last point to the specified point (x,y). If no
- sk_pathbuilder_move_to() call has been made for this contour, the first
- point is automatically set to (0,0).
-*/
-SK_API void sk_pathbuilder_line_to(sk_pathbuilder_t*, float x, float y);
-/**
- Add a quadratic bezier from the last point, approaching control
- point (x0,y0), and ending at (x1,y1). If no sk_pathbuilder_move_to() call
- has been made for this contour, the first point is automatically
- set to (0,0).
-*/
-SK_API void sk_pathbuilder_quad_to(sk_pathbuilder_t*, float x0, float y0, float x1, float y1);
-/**
- Add a conic curve from the last point, approaching control point
- (x0,y01), and ending at (x1,y1) with weight w. If no
- sk_pathbuilder_move_to() call has been made for this contour, the first
- point is automatically set to (0,0).
-*/
-SK_API void sk_pathbuilder_conic_to(sk_pathbuilder_t*, float x0, float y0, float x1, float y1, float w);
-/**
- Add a cubic bezier from the last point, approaching control points
- (x0,y0) and (x1,y1), and ending at (x2,y2). If no
- sk_pathbuilder_move_to() call has been made for this contour, the first
- point is automatically set to (0,0).
-*/
-SK_API void sk_pathbuilder_cubic_to(sk_pathbuilder_t*,
- float x0, float y0,
- float x1, float y1,
- float x2, float y2);
-/**
- Close the current contour. If the current point is not equal to the
- first point of the contour, a line segment is automatically added.
-*/
-SK_API void sk_pathbuilder_close(sk_pathbuilder_t*);
-
-/**
- Add a closed rectangle contour to the path.
-*/
-SK_API void sk_pathbuilder_add_rect(sk_pathbuilder_t*, const sk_rect_t*, sk_path_direction_t);
-/**
- Add a closed oval contour to the path
-*/
-SK_API void sk_pathbuilder_add_oval(sk_pathbuilder_t*, const sk_rect_t*, sk_path_direction_t);
-
-/**** path *****/
-
-/**
-* Return a Path from the builder, resetting the builder to its original empty state.
-*/
-SK_API sk_path_t* sk_pathbuilder_detach_path(sk_pathbuilder_t*);
-
-/**
- * Return a Path from the builder. The builder reamins in its current state.
- */
-SK_API sk_path_t* sk_pathbuilder_snapshot_path(sk_pathbuilder_t*);
-
-/** Release the memory used by a sk_path_t. */
-SK_API void sk_path_delete(sk_path_t*);
-
-/**
- * If the path is empty, return false and set the rect parameter to [0, 0, 0, 0].
- * else return true and set the rect parameter to the bounds of the control-points
- * of the path.
- */
-SK_API bool sk_path_get_bounds(const sk_path_t*, sk_rect_t*);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
diff --git a/chromium/third_party/skia/include/c/sk_picture.h b/chromium/third_party/skia/include/c/sk_picture.h
deleted file mode 100644
index e569104074f..00000000000
--- a/chromium/third_party/skia/include/c/sk_picture.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_picture_DEFINED
-#define sk_picture_DEFINED
-
-#include "include/c/sk_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-/**
- Create a new sk_picture_recorder_t. Its resources should be
- released with a call to sk_picture_recorder_delete().
-*/
-SK_API sk_picture_recorder_t* sk_picture_recorder_new(void);
-/**
- Release the memory and other resources used by this
- sk_picture_recorder_t.
-*/
-SK_API void sk_picture_recorder_delete(sk_picture_recorder_t*);
-
-/**
- Returns the canvas that records the drawing commands
-
- @param sk_rect_t* the cull rect used when recording this
- picture. Any drawing the falls outside of this
- rect is undefined, and may be drawn or it may not.
-*/
-SK_API sk_canvas_t* sk_picture_recorder_begin_recording(sk_picture_recorder_t*, const sk_rect_t*);
-/**
- Signal that the caller is done recording. This invalidates the
- canvas returned by begin_recording. Ownership of the sk_picture_t
- is passed to the caller, who must call sk_picture_unref() when
- they are done using it. The returned picture is immutable.
-*/
-SK_API sk_picture_t* sk_picture_recorder_end_recording(sk_picture_recorder_t*);
-
-/**
- Increment the reference count on the given sk_picture_t. Must be
- balanced by a call to sk_picture_unref().
-*/
-SK_API void sk_picture_ref(sk_picture_t*);
-/**
- Decrement the reference count. If the reference count is 1 before
- the decrement, then release both the memory holding the
- sk_picture_t and any resouces it may be managing. New
- sk_picture_t are created with a reference count of 1.
-*/
-SK_API void sk_picture_unref(sk_picture_t*);
-
-/**
- Returns a non-zero value unique among all pictures.
- */
-SK_API uint32_t sk_picture_get_unique_id(sk_picture_t*);
-
-/**
- Return the cull rect specified when this picture was recorded.
-*/
-SK_API sk_rect_t sk_picture_get_bounds(sk_picture_t*);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
diff --git a/chromium/third_party/skia/include/c/sk_shader.h b/chromium/third_party/skia/include/c/sk_shader.h
deleted file mode 100644
index 023ccbaeac0..00000000000
--- a/chromium/third_party/skia/include/c/sk_shader.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_shader_DEFINED
-#define sk_shader_DEFINED
-
-#include "include/c/sk_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-SK_API void sk_shader_ref(sk_shader_t*);
-SK_API void sk_shader_unref(sk_shader_t*);
-
-typedef enum {
- CLAMP_SK_SHADER_TILEMODE,
- REPEAT_SK_SHADER_TILEMODE,
- MIRROR_SK_SHADER_TILEMODE,
-} sk_shader_tilemode_t;
-
-/**
- Returns a shader that generates a linear gradient between the two
- specified points.
-
- @param points The start and end points for the gradient.
- @param colors The array[count] of colors, to be distributed between
- the two points
- @param colorPos May be NULL. array[count] of SkScalars, or NULL, of
- the relative position of each corresponding color
- in the colors array. If this is NULL, the the
- colors are distributed evenly between the start
- and end point. If this is not null, the values
- must begin with 0, end with 1.0, and intermediate
- values must be strictly increasing.
- @param colorCount Must be >=2. The number of colors (and pos if not
- NULL) entries.
- @param mode The tiling mode
-*/
-SK_API sk_shader_t* sk_shader_new_linear_gradient(const sk_point_t points[2],
- const sk_color_t colors[],
- const float colorPos[],
- int colorCount,
- sk_shader_tilemode_t tileMode,
- const sk_matrix_t* localMatrix);
-
-
-/**
- Returns a shader that generates a radial gradient given the center
- and radius.
-
- @param center The center of the circle for this gradient
- @param radius Must be positive. The radius of the circle for this
- gradient
- @param colors The array[count] of colors, to be distributed
- between the center and edge of the circle
- @param colorPos May be NULL. The array[count] of the relative
- position of each corresponding color in the colors
- array. If this is NULL, the the colors are
- distributed evenly between the center and edge of
- the circle. If this is not null, the values must
- begin with 0, end with 1.0, and intermediate
- values must be strictly increasing.
- @param count Must be >= 2. The number of colors (and pos if not
- NULL) entries
- @param tileMode The tiling mode
- @param localMatrix May be NULL
-*/
-SK_API sk_shader_t* sk_shader_new_radial_gradient(const sk_point_t* center,
- float radius,
- const sk_color_t colors[],
- const float colorPos[],
- int colorCount,
- sk_shader_tilemode_t tileMode,
- const sk_matrix_t* localMatrix);
-
-/**
- Returns a shader that generates a sweep gradient given a center.
-
- @param center The coordinates of the center of the sweep
- @param colors The array[count] of colors, to be distributed around
- the center.
- @param colorPos May be NULL. The array[count] of the relative
- position of each corresponding color in the colors
- array. If this is NULL, the the colors are
- distributed evenly between the center and edge of
- the circle. If this is not null, the values must
- begin with 0, end with 1.0, and intermediate
- values must be strictly increasing.
- @param colorCount Must be >= 2. The number of colors (and pos if
- not NULL) entries
- @param localMatrix May be NULL
-*/
-SK_API sk_shader_t* sk_shader_new_sweep_gradient(const sk_point_t* center,
- const sk_color_t colors[],
- const float colorPos[],
- int colorCount,
- const sk_matrix_t* localMatrix);
-
-/**
- Returns a shader that generates a conical gradient given two circles, or
- returns NULL if the inputs are invalid. The gradient interprets the
- two circles according to the following HTML spec.
- http://dev.w3.org/html5/2dcontext/#dom-context-2d-createradialgradient
-
- Returns a shader that generates a sweep gradient given a center.
-
- @param start, startRadius Defines the first circle.
- @param end, endRadius Defines the first circle.
- @param colors The array[count] of colors, to be distributed between
- the two circles.
- @param colorPos May be NULL. The array[count] of the relative
- position of each corresponding color in the colors
- array. If this is NULL, the the colors are
- distributed evenly between the two circles. If
- this is not null, the values must begin with 0,
- end with 1.0, and intermediate values must be
- strictly increasing.
- @param colorCount Must be >= 2. The number of colors (and pos if
- not NULL) entries
- @param tileMode The tiling mode
- @param localMatrix May be NULL
-
-*/
-SK_API sk_shader_t* sk_shader_new_two_point_conical_gradient(
- const sk_point_t* start,
- float startRadius,
- const sk_point_t* end,
- float endRadius,
- const sk_color_t colors[],
- const float colorPos[],
- int colorCount,
- sk_shader_tilemode_t tileMode,
- const sk_matrix_t* localMatrix);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
diff --git a/chromium/third_party/skia/include/c/sk_surface.h b/chromium/third_party/skia/include/c/sk_surface.h
deleted file mode 100644
index 88c8c87b326..00000000000
--- a/chromium/third_party/skia/include/c/sk_surface.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_surface_DEFINED
-#define sk_surface_DEFINED
-
-#include "include/c/sk_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-/**
- Return a new surface, with the memory for the pixels automatically
- allocated. If the requested surface cannot be created, or the
- request is not a supported configuration, NULL will be returned.
-
- @param sk_imageinfo_t* Specify the width, height, color type, and
- alpha type for the surface.
-
- @param sk_surfaceprops_t* If not NULL, specify additional non-default
- properties of the surface.
-*/
-SK_API sk_surface_t* sk_surface_new_raster(const sk_imageinfo_t*, const sk_surfaceprops_t*);
-
-/**
- Create a new surface which will draw into the specified pixels
- with the specified rowbytes. If the requested surface cannot be
- created, or the request is not a supported configuration, NULL
- will be returned.
-
- @param sk_imageinfo_t* Specify the width, height, color type, and
- alpha type for the surface.
- @param void* pixels Specify the location in memory where the
- destination pixels are. This memory must
- outlast this surface.
- @param size_t rowBytes Specify the difference, in bytes, between
- each adjacent row. Should be at least
- (width * sizeof(one pixel)).
- @param sk_surfaceprops_t* If not NULL, specify additional non-default
- properties of the surface.
-*/
-SK_API sk_surface_t* sk_surface_new_raster_direct(const sk_imageinfo_t*,
- void* pixels, size_t rowBytes,
- const sk_surfaceprops_t* props);
-
-/**
- Decrement the reference count. If the reference count is 1 before
- the decrement, then release both the memory holding the
- sk_surface_t and any pixel memory it may be managing. New
- sk_surface_t are created with a reference count of 1.
-*/
-SK_API void sk_surface_unref(sk_surface_t*);
-
-/**
- * Return the canvas associated with this surface. Note: the canvas is owned by the surface,
- * so the returned object is only valid while the owning surface is valid.
- */
-SK_API sk_canvas_t* sk_surface_get_canvas(sk_surface_t*);
-
-/**
- * Call sk_image_unref() when the returned image is no longer used.
- */
-SK_API sk_image_t* sk_surface_new_image_snapshot(sk_surface_t*);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
diff --git a/chromium/third_party/skia/include/c/sk_types.h b/chromium/third_party/skia/include/c/sk_types.h
deleted file mode 100644
index 5a484af42bb..00000000000
--- a/chromium/third_party/skia/include/c/sk_types.h
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_types_DEFINED
-#define sk_types_DEFINED
-
-#include <stdint.h>
-#include <stddef.h>
-
-#ifdef __cplusplus
- #define SK_C_PLUS_PLUS_BEGIN_GUARD extern "C" {
- #define SK_C_PLUS_PLUS_END_GUARD }
-#else
- #include <stdbool.h>
- #define SK_C_PLUS_PLUS_BEGIN_GUARD
- #define SK_C_PLUS_PLUS_END_GUARD
-#endif
-
-#if !defined(SK_API)
- #if defined(SKIA_DLL)
- #if defined(_MSC_VER)
- #if SKIA_IMPLEMENTATION
- #define SK_API __declspec(dllexport)
- #else
- #define SK_API __declspec(dllimport)
- #endif
- #else
- #define SK_API __attribute__((visibility("default")))
- #endif
- #else
- #define SK_API
- #endif
-#endif
-
-///////////////////////////////////////////////////////////////////////////////////////
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-typedef uint32_t sk_color_t;
-
-/* This macro assumes all arguments are >=0 and <=255. */
-#define sk_color_set_argb(a, r, g, b) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
-#define sk_color_get_a(c) (((c) >> 24) & 0xFF)
-#define sk_color_get_r(c) (((c) >> 16) & 0xFF)
-#define sk_color_get_g(c) (((c) >> 8) & 0xFF)
-#define sk_color_get_b(c) (((c) >> 0) & 0xFF)
-
-typedef enum {
- INTERSECT_SK_CLIPTYPE,
- DIFFERENCE_SK_CLIPTYPE,
-} sk_cliptype_t;
-
-typedef enum {
- UNKNOWN_SK_PIXELGEOMETRY,
- RGB_H_SK_PIXELGEOMETRY,
- BGR_H_SK_PIXELGEOMETRY,
- RGB_V_SK_PIXELGEOMETRY,
- BGR_V_SK_PIXELGEOMETRY,
-} sk_pixelgeometry_t;
-
-typedef struct {
- sk_pixelgeometry_t pixelGeometry;
-} sk_surfaceprops_t;
-
-typedef struct {
- float x;
- float y;
-} sk_point_t;
-
-typedef struct {
- int32_t left;
- int32_t top;
- int32_t right;
- int32_t bottom;
-} sk_irect_t;
-
-typedef struct {
- float left;
- float top;
- float right;
- float bottom;
-} sk_rect_t;
-
-/**
- The sk_matrix_t struct holds a 3x3 perspective matrix for
- transforming coordinates:
-
- (X,Y) = T[M]((x,y))
- X = (M[0] * x + M[1] * y + M[2]) / (M[6] * x + M[7] * y + M[8]);
- Y = (M[3] * x + M[4] * y + M[5]) / (M[6] * x + M[7] * y + M[8]);
-
- Therefore, the identity matrix is
-
- sk_matrix_t identity = {{1, 0, 0,
- 0, 1, 0,
- 0, 0, 1}};
-
- A matrix that scales by sx and sy is:
-
- sk_matrix_t scale = {{sx, 0, 0,
- 0, sy, 0,
- 0, 0, 1}};
-
- A matrix that translates by tx and ty is:
-
- sk_matrix_t translate = {{1, 0, tx,
- 0, 1, ty,
- 0, 0, 1}};
-
- A matrix that rotates around the origin by A radians:
-
- sk_matrix_t rotate = {{cos(A), -sin(A), 0,
- sin(A), cos(A), 0,
- 0, 0, 1}};
-
- Two matrixes can be concatinated by:
-
- void concat_matrices(sk_matrix_t* dst,
- const sk_matrix_t* matrixU,
- const sk_matrix_t* matrixV) {
- const float* u = matrixU->mat;
- const float* v = matrixV->mat;
- sk_matrix_t result = {{
- u[0] * v[0] + u[1] * v[3] + u[2] * v[6],
- u[0] * v[1] + u[1] * v[4] + u[2] * v[7],
- u[0] * v[2] + u[1] * v[5] + u[2] * v[8],
- u[3] * v[0] + u[4] * v[3] + u[5] * v[6],
- u[3] * v[1] + u[4] * v[4] + u[5] * v[7],
- u[3] * v[2] + u[4] * v[5] + u[5] * v[8],
- u[6] * v[0] + u[7] * v[3] + u[8] * v[6],
- u[6] * v[1] + u[7] * v[4] + u[8] * v[7],
- u[6] * v[2] + u[7] * v[5] + u[8] * v[8]
- }};
- *dst = result;
- }
-*/
-typedef struct {
- float mat[9];
-} sk_matrix_t;
-
-/**
- A sk_canvas_t encapsulates all of the state about drawing into a
- destination This includes a reference to the destination itself,
- and a stack of matrix/clip values.
-*/
-typedef struct sk_canvas_t sk_canvas_t;
-/**
- A sk_data_ holds an immutable data buffer.
-*/
-typedef struct sk_data_t sk_data_t;
-/**
- A sk_image_t is an abstraction for drawing a rectagle of pixels.
- The content of the image is always immutable, though the actual
- storage may change, if for example that image can be re-created via
- encoded data or other means.
-*/
-typedef struct sk_image_t sk_image_t;
-
-/**
- * Describes the color components. See ICC Profiles.
- */
-typedef struct sk_colorspace_t sk_colorspace_t;
-
-/**
- * Describes an image buffer : width, height, pixel type, colorspace, etc.
- */
-typedef struct sk_imageinfo_t sk_imageinfo_t;
-
-/**
- A sk_maskfilter_t is an object that perform transformations on an
- alpha-channel mask before drawing it; it may be installed into a
- sk_paint_t. Each time a primitive is drawn, it is first
- scan-converted into a alpha mask, which os handed to the
- maskfilter, which may create a new mask is to render into the
- destination.
- */
-typedef struct sk_maskfilter_t sk_maskfilter_t;
-/**
- A sk_paint_t holds the style and color information about how to
- draw geometries, text and bitmaps.
-*/
-typedef struct sk_paint_t sk_paint_t;
-/**
- A sk_path_t encapsulates compound (multiple contour) geometric
- paths consisting of straight line segments, quadratic curves, and
- cubic curves.
-*/
-typedef struct sk_path_t sk_path_t;
-/**
- A sk_picture_t holds recorded canvas drawing commands to be played
- back at a later time.
-*/
-typedef struct sk_picture_t sk_picture_t;
-/**
- A sk_picture_recorder_t holds a sk_canvas_t that records commands
- to create a sk_picture_t.
-*/
-typedef struct sk_picture_recorder_t sk_picture_recorder_t;
-/**
- A sk_shader_t specifies the source color(s) for what is being drawn. If a
- paint has no shader, then the paint's color is used. If the paint
- has a shader, then the shader's color(s) are use instead, but they
- are modulated by the paint's alpha.
-*/
-typedef struct sk_shader_t sk_shader_t;
-/**
- A sk_surface_t holds the destination for drawing to a canvas. For
- raster drawing, the destination is an array of pixels in memory.
- For GPU drawing, the destination is a texture or a framebuffer.
-*/
-typedef struct sk_surface_t sk_surface_t;
-
-typedef enum {
- NEAREST_SK_FILTER_MODE,
- LINEAR_SK_FILTER_MODE,
-} sk_filter_mode_t;
-
-typedef enum {
- NONE_SK_MIPMAP_MODE,
- NEAREST_SK_MIPMAP_MODE,
- LINEAR_SK_MIPMAP_MODE,
-} sk_mipmap_mode_t;
-
-typedef struct {
- float B, C;
-} sk_cubic_resampler_t;
-
-typedef struct {
- bool useCubic;
- sk_cubic_resampler_t cubic;
- sk_filter_mode_t filter;
- sk_mipmap_mode_t mipmap;
-} sk_sampling_options_t;
-
-typedef enum {
- CLEAR_SK_XFERMODE_MODE,
- SRC_SK_XFERMODE_MODE,
- DST_SK_XFERMODE_MODE,
- SRCOVER_SK_XFERMODE_MODE,
- DSTOVER_SK_XFERMODE_MODE,
- SRCIN_SK_XFERMODE_MODE,
- DSTIN_SK_XFERMODE_MODE,
- SRCOUT_SK_XFERMODE_MODE,
- DSTOUT_SK_XFERMODE_MODE,
- SRCATOP_SK_XFERMODE_MODE,
- DSTATOP_SK_XFERMODE_MODE,
- XOR_SK_XFERMODE_MODE,
- PLUS_SK_XFERMODE_MODE,
- MODULATE_SK_XFERMODE_MODE,
- SCREEN_SK_XFERMODE_MODE,
- OVERLAY_SK_XFERMODE_MODE,
- DARKEN_SK_XFERMODE_MODE,
- LIGHTEN_SK_XFERMODE_MODE,
- COLORDODGE_SK_XFERMODE_MODE,
- COLORBURN_SK_XFERMODE_MODE,
- HARDLIGHT_SK_XFERMODE_MODE,
- SOFTLIGHT_SK_XFERMODE_MODE,
- DIFFERENCE_SK_XFERMODE_MODE,
- EXCLUSION_SK_XFERMODE_MODE,
- MULTIPLY_SK_XFERMODE_MODE,
- HUE_SK_XFERMODE_MODE,
- SATURATION_SK_XFERMODE_MODE,
- COLOR_SK_XFERMODE_MODE,
- LUMINOSITY_SK_XFERMODE_MODE,
-} sk_xfermode_mode_t;
-
-//////////////////////////////////////////////////////////////////////////////////////////
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
diff --git a/chromium/third_party/skia/include/codec/SkAndroidCodec.h b/chromium/third_party/skia/include/codec/SkAndroidCodec.h
index 11157429fda..02625838308 100644
--- a/chromium/third_party/skia/include/codec/SkAndroidCodec.h
+++ b/chromium/third_party/skia/include/codec/SkAndroidCodec.h
@@ -9,9 +9,25 @@
#define SkAndroidCodec_DEFINED
#include "include/codec/SkCodec.h"
+#include "include/core/SkAlphaType.h"
+#include "include/core/SkColorSpace.h"
+#include "include/core/SkColorType.h"
#include "include/core/SkEncodedImageFormat.h"
-#include "include/core/SkStream.h"
+#include "include/core/SkImageInfo.h"
+#include "include/core/SkRefCnt.h"
+#include "include/core/SkSize.h"
#include "include/core/SkTypes.h"
+#include "include/private/SkEncodedInfo.h"
+#include "include/private/SkNoncopyable.h"
+#include "modules/skcms/skcms.h"
+
+#include <cstddef>
+#include <memory>
+
+class SkData;
+class SkPngChunkReader;
+class SkStream;
+struct SkIRect;
/**
* Abstract interface defining image codec functionality that is necessary for
diff --git a/chromium/third_party/skia/include/codec/SkCodec.h b/chromium/third_party/skia/include/codec/SkCodec.h
index d2715d9a419..5af847afcfe 100644
--- a/chromium/third_party/skia/include/codec/SkCodec.h
+++ b/chromium/third_party/skia/include/codec/SkCodec.h
@@ -10,31 +10,34 @@
#include "include/codec/SkCodecAnimation.h"
#include "include/codec/SkEncodedOrigin.h"
-#include "include/core/SkColor.h"
+#include "include/core/SkAlphaType.h"
#include "include/core/SkEncodedImageFormat.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkPixmap.h"
+#include "include/core/SkRect.h"
+#include "include/core/SkRefCnt.h"
#include "include/core/SkSize.h"
-#include "include/core/SkStream.h"
#include "include/core/SkTypes.h"
#include "include/core/SkYUVAPixmaps.h"
#include "include/private/SkEncodedInfo.h"
#include "include/private/SkNoncopyable.h"
-#include "include/private/SkTemplates.h"
+#include "modules/skcms/skcms.h"
+#include <cstddef>
+#include <memory>
+#include <tuple>
#include <vector>
class SkAndroidCodec;
-class SkColorSpace;
class SkData;
class SkFrameHolder;
class SkImage;
class SkPngChunkReader;
class SkSampler;
+class SkStream;
namespace DM {
class CodecSrc;
-class ColorCodecSrc;
} // namespace DM
/**
diff --git a/chromium/third_party/skia/include/core/BUILD.bazel b/chromium/third_party/skia/include/core/BUILD.bazel
index 1c1d9cc17c4..6a9bda263b2 100644
--- a/chromium/third_party/skia/include/core/BUILD.bazel
+++ b/chromium/third_party/skia/include/core/BUILD.bazel
@@ -4,6 +4,26 @@ licenses(["notice"])
exports_files_legacy()
+# Mapped to skia_precompile_public variable in //gn/core.gni.
+filegroup(
+ name = "precompile_public_hdrs",
+ srcs = [
+ "SkCombinationBuilder.h",
+ ],
+ visibility = ["//include:__pkg__"],
+)
+
+# Maintain SkPicture files in separate filegroup so that the legacy
+# skia_skpicture_public GNI file list can be created.
+filegroup(
+ name = "skpicture_public_hdrs",
+ srcs = [
+ "SkPicture.h",
+ "SkPictureRecorder.h",
+ ],
+ visibility = ["//include:__pkg__"],
+)
+
filegroup(
name = "public_hdrs",
srcs = [
@@ -23,7 +43,6 @@ filegroup(
"SkColorPriv.h",
"SkColorSpace.h",
"SkColorType.h",
- "SkCombinationBuilder.h",
"SkContourMeasure.h",
"SkCoverageMode.h",
"SkCubicMap.h",
@@ -66,8 +85,6 @@ filegroup(
"SkPathEffect.h",
"SkPathMeasure.h",
"SkPathTypes.h",
- "SkPicture.h",
- "SkPictureRecorder.h",
"SkPixelRef.h",
"SkPixmap.h",
"SkPngChunkReader.h",
@@ -103,6 +120,7 @@ filegroup(
"SkVertices.h",
"SkYUVAInfo.h",
"SkYUVAPixmaps.h",
+ ":skpicture_public_hdrs",
],
visibility = ["//include:__pkg__"],
)
diff --git a/chromium/third_party/skia/include/core/SkBitmap.h b/chromium/third_party/skia/include/core/SkBitmap.h
index 6e33f523551..658f20716e7 100644
--- a/chromium/third_party/skia/include/core/SkBitmap.h
+++ b/chromium/third_party/skia/include/core/SkBitmap.h
@@ -860,6 +860,23 @@ public:
return this->pixmap().getColor(x, y);
}
+ /** Returns pixel at (x, y) as unpremultiplied float color.
+ Returns black with alpha if SkColorType is kAlpha_8_SkColorType.
+
+ Input is not validated: out of bounds values of x or y trigger an assert() if
+ built with SK_DEBUG defined; and returns undefined values or may crash if
+ SK_RELEASE is defined. Fails if SkColorType is kUnknown_SkColorType or
+ pixel address is nullptr.
+
+ SkColorSpace in SkImageInfo is ignored. Some color precision may be lost in the
+ conversion to unpremultiplied color.
+
+ @param x column index, zero or greater, and less than width()
+ @param y row index, zero or greater, and less than height()
+ @return pixel converted to unpremultiplied color
+ */
+ SkColor4f getColor4f(int x, int y) const { return this->pixmap().getColor4f(x, y); }
+
/** Look up the pixel at (x,y) and return its alpha component, normalized to [0..1].
This is roughly equivalent to SkGetColorA(getColor()), but can be more efficent
(and more precise if the pixels store more than 8 bits per component).
diff --git a/chromium/third_party/skia/include/core/SkCanvas.h b/chromium/third_party/skia/include/core/SkCanvas.h
index 72b2d17b7bc..834b25770f9 100644
--- a/chromium/third_party/skia/include/core/SkCanvas.h
+++ b/chromium/third_party/skia/include/core/SkCanvas.h
@@ -38,6 +38,11 @@
#define SK_SUPPORT_LEGACY_GETTOTALMATRIX
#endif
+namespace sktext {
+class GlyphRunBuilder;
+class GlyphRunList;
+}
+
class AutoLayerForImageFilter;
class GrBackendRenderTarget;
class GrRecordingContext;
@@ -47,8 +52,6 @@ class SkData;
class SkDrawable;
struct SkDrawShadowRec;
class SkFont;
-class SkGlyphRunBuilder;
-class SkGlyphRunList;
class SkImage;
class SkImageFilter;
class SkPaintFilterCanvas;
@@ -260,10 +263,27 @@ public:
@param props storage for writable SkSurfaceProps
@return true if SkSurfaceProps was copied
+ DEPRECATED: Replace usage with getBaseProps() or getTopProps()
+
example: https://fiddle.skia.org/c/@Canvas_getProps
*/
bool getProps(SkSurfaceProps* props) const;
+ /** Returns the SkSurfaceProps associated with the canvas (i.e., at the base of the layer
+ stack).
+
+ @return base SkSurfaceProps
+ */
+ SkSurfaceProps getBaseProps() const;
+
+ /** Returns the SkSurfaceProps associated with the canvas that are currently active (i.e., at
+ the top of the layer stack). This can differ from getBaseProps depending on the flags
+ passed to saveLayer (see SaveLayerFlagsSet).
+
+ @return SkSurfaceProps active in the current/top layer
+ */
+ SkSurfaceProps getTopProps() const;
+
/** Triggers the immediate execution of all pending draw operations.
If SkCanvas is associated with GPU surface, resolves all pending GPU operations.
If SkCanvas is associated with raster surface, has no effect; raster draw
@@ -1961,7 +1981,7 @@ public:
*/
void drawVertices(const sk_sp<SkVertices>& vertices, SkBlendMode mode, const SkPaint& paint);
-#if defined(SK_ENABLE_EXPERIMENTAL_CUSTOM_MESH) && defined(SK_ENABLE_SKSL)
+#if defined(SK_ENABLE_SKSL)
/**
Experimental, under active development, and subject to change without notice.
@@ -2176,7 +2196,7 @@ protected:
virtual bool onPeekPixels(SkPixmap* pixmap);
virtual bool onAccessTopLayerPixels(SkPixmap* pixmap);
virtual SkImageInfo onImageInfo() const;
- virtual bool onGetProps(SkSurfaceProps* props) const;
+ virtual bool onGetProps(SkSurfaceProps* props, bool top) const;
virtual void onFlush();
// Subclass save/restore notifiers.
@@ -2203,11 +2223,6 @@ protected:
virtual void didTranslate(SkScalar, SkScalar) {}
virtual void didScale(SkScalar, SkScalar) {}
-#ifndef SK_ENABLE_EXPERIMENTAL_CUSTOM_MESH
- // Define this in protected so we can still access internally for testing.
- void drawMesh(const SkMesh& mesh, sk_sp<SkBlender> blender, const SkPaint& paint);
-#endif
-
// NOTE: If you are adding a new onDraw virtual to SkCanvas, PLEASE add an override to
// SkCanvasVirtualEnforcer (in SkCanvasVirtualEnforcer.h). This ensures that subclasses using
// that mechanism will be required to implement the new function.
@@ -2225,7 +2240,7 @@ protected:
virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
const SkPaint& paint);
- virtual void onDrawGlyphRunList(const SkGlyphRunList& glyphRunList, const SkPaint& paint);
+ virtual void onDrawGlyphRunList(const sktext::GlyphRunList& glyphRunList, const SkPaint& paint);
virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
const SkPoint texCoords[4], SkBlendMode mode, const SkPaint& paint);
@@ -2279,7 +2294,7 @@ protected:
/** Experimental
*/
virtual sk_sp<sktext::gpu::Slug> onConvertGlyphRunListToSlug(
- const SkGlyphRunList& glyphRunList, const SkPaint& paint);
+ const sktext::GlyphRunList& glyphRunList, const SkPaint& paint);
/** Experimental
*/
@@ -2540,7 +2555,7 @@ private:
class AutoUpdateQRBounds;
void validateClip() const;
- std::unique_ptr<SkGlyphRunBuilder> fScratchGlyphRunBuilder;
+ std::unique_ptr<sktext::GlyphRunBuilder> fScratchGlyphRunBuilder;
using INHERITED = SkRefCnt;
};
diff --git a/chromium/third_party/skia/include/core/SkCapabilities.h b/chromium/third_party/skia/include/core/SkCapabilities.h
index da15f58250f..ef15c167082 100644
--- a/chromium/third_party/skia/include/core/SkCapabilities.h
+++ b/chromium/third_party/skia/include/core/SkCapabilities.h
@@ -15,6 +15,10 @@
namespace SkSL { struct ShaderCaps; }
#endif
+#if defined(SK_GRAPHITE_ENABLED)
+namespace skgpu::graphite { class Caps; }
+#endif
+
class SK_API SkCapabilities : public SkRefCnt {
public:
static sk_sp<const SkCapabilities> RasterBackend();
@@ -24,6 +28,10 @@ public:
#endif
protected:
+#if defined(SK_GRAPHITE_ENABLED)
+ friend class skgpu::graphite::Caps; // for ctor
+#endif
+
SkCapabilities() = default;
#ifdef SK_ENABLE_SKSL
diff --git a/chromium/third_party/skia/include/core/SkColorFilter.h b/chromium/third_party/skia/include/core/SkColorFilter.h
index ca428cf5b80..695ec979308 100644
--- a/chromium/third_party/skia/include/core/SkColorFilter.h
+++ b/chromium/third_party/skia/include/core/SkColorFilter.h
@@ -71,7 +71,12 @@ public:
static sk_sp<SkColorFilter> Compose(sk_sp<SkColorFilter> outer, sk_sp<SkColorFilter> inner) {
return outer ? outer->makeComposed(inner) : inner;
}
+
+ // Blends between the constant color (src) and input color (dst) based on the SkBlendMode.
+ // If the color space is null, the constant color is assumed to be defined in sRGB.
+ static sk_sp<SkColorFilter> Blend(const SkColor4f& c, sk_sp<SkColorSpace>, SkBlendMode mode);
static sk_sp<SkColorFilter> Blend(SkColor c, SkBlendMode mode);
+
static sk_sp<SkColorFilter> Matrix(const SkColorMatrix&);
static sk_sp<SkColorFilter> Matrix(const float rowMajor[20]);
diff --git a/chromium/third_party/skia/include/core/SkColorSpace.h b/chromium/third_party/skia/include/core/SkColorSpace.h
index 9efd140e2d6..a09758645b1 100644
--- a/chromium/third_party/skia/include/core/SkColorSpace.h
+++ b/chromium/third_party/skia/include/core/SkColorSpace.h
@@ -11,7 +11,7 @@
#include "include/core/SkRefCnt.h"
#include "include/private/SkFixed.h"
#include "include/private/SkOnce.h"
-#include "include/third_party/skcms/skcms.h"
+#include "modules/skcms/skcms.h"
#include <memory>
class SkData;
diff --git a/chromium/third_party/skia/include/core/SkCombinationBuilder.h b/chromium/third_party/skia/include/core/SkCombinationBuilder.h
index c5e820424e5..7b6e0a6d6be 100644
--- a/chromium/third_party/skia/include/core/SkCombinationBuilder.h
+++ b/chromium/third_party/skia/include/core/SkCombinationBuilder.h
@@ -8,6 +8,10 @@
#ifndef SkCombinationBuilder_DEFINED
#define SkCombinationBuilder_DEFINED
+#include "include/core/SkTypes.h"
+
+#ifdef SK_ENABLE_PRECOMPILE
+
#include <functional>
#include <memory>
#include <vector>
@@ -19,6 +23,7 @@
class SkArenaAllocWithReset;
class SkCombinationBuilder;
+class SkKeyContext;
class SkOption;
class SkPaintParamsKeyBuilder;
class SkShaderCodeDictionary;
@@ -121,11 +126,7 @@ public:
kAll
};
-#ifdef SK_GRAPHITE_ENABLED
- SkCombinationBuilder(skgpu::graphite::Context*);
-#else
SkCombinationBuilder(SkShaderCodeDictionary*);
-#endif
~SkCombinationBuilder();
// Blend Modes
@@ -154,6 +155,9 @@ private:
return this->numShaderCombinations() * this->numBlendModeCombinations();
}
+ // 'desiredCombination' must be less than numCombinations
+ void createKey(const SkKeyContext&, int desiredCombination, SkPaintParamsKeyBuilder*);
+
#ifdef SK_DEBUG
void dump() const;
int epoch() const { return fEpoch; }
@@ -182,4 +186,6 @@ private:
SkDEBUGCODE(int fEpoch = 0;)
};
+#endif // SK_ENABLE_PRECOMPILE
+
#endif // SkCombinationBuilder_DEFINED
diff --git a/chromium/third_party/skia/include/core/SkGraphics.h b/chromium/third_party/skia/include/core/SkGraphics.h
index 28dd428a401..c24bb742e71 100644
--- a/chromium/third_party/skia/include/core/SkGraphics.h
+++ b/chromium/third_party/skia/include/core/SkGraphics.h
@@ -151,6 +151,15 @@ public:
static OpenTypeSVGDecoderFactory GetOpenTypeSVGDecoderFactory();
/**
+ * Temporarily (until variable COLRv1 is released) pass a feature switch function for whether
+ * variable COLRv1 is enabled. Needed for initializing FreeType with a property setting so that
+ * variable COLRv1 can be enabled in Chrome Canaries during development.
+ */
+ using VariableColrV1EnabledFunc = bool (*)();
+ static VariableColrV1EnabledFunc SetVariableColrV1EnabledFunc(VariableColrV1EnabledFunc);
+ static bool GetVariableColrV1Enabled();
+
+ /**
* Call early in main() to allow Skia to use a JIT to accelerate CPU-bound operations.
*/
static void AllowJIT();
diff --git a/chromium/third_party/skia/include/core/SkImage.h b/chromium/third_party/skia/include/core/SkImage.h
index 63d455ca138..e58333bbf3f 100644
--- a/chromium/third_party/skia/include/core/SkImage.h
+++ b/chromium/third_party/skia/include/core/SkImage.h
@@ -18,7 +18,7 @@
#if SK_SUPPORT_GPU
#include "include/gpu/GrTypes.h"
#endif
-#if SK_GRAPHITE_ENABLED
+#if defined(SK_GRAPHITE_ENABLED)
#include "include/gpu/graphite/GraphiteTypes.h"
#endif
#include <functional> // std::function
@@ -50,7 +50,7 @@ class SkYUVAPixmaps;
enum class SkEncodedImageFormat;
-#if SK_GRAPHITE_ENABLED
+#if defined(SK_GRAPHITE_ENABLED)
namespace skgpu::graphite {
class Recorder;
};
@@ -1145,29 +1145,35 @@ public:
GrMipmapped = GrMipmapped::kNo,
SkBudgeted = SkBudgeted::kYes) const;
#endif
+
#ifdef SK_GRAPHITE_ENABLED
+ struct RequiredImageProperties {
+ skgpu::graphite::Mipmapped fMipmapped;
+ };
+
/** Graphite version of makeTextureImage.
- Returns SkImage backed by GPU texture, using Recorder for creation and uploads if necessary.
- The returned SkImage respects mipmapped setting for non-GPU SkImages; if mipmapped
- equals GrMipmapped::kYes, the backing texture allocates mip map levels.
+ Returns an SkImage backed by a Graphite texture, using the provided Recorder for creation
+ and uploads if necessary. The returned SkImage respects the required image properties'
+ mipmap setting for non-Graphite SkImages; i.e., if mipmapping is required, the backing
+ Graphite texture will have allocated mip map levels.
It is assumed that MIP maps are always supported by the GPU.
- Returns original SkImage if the image is already texture-backed, the recorder matches, and
- mipmapped is compatible with the backing GPU texture. If mipmapped is not compatible,
- it will return nullptr.
+ Returns original SkImage if the image is already Graphite-backed and the required mipmapping
+ is compatible with the backing Graphite texture. If the required mipmapping is not
+ compatible, nullptr will be returned.
- Returns nullptr if recorder is nullptr, or if SkImage was created with another
+ Returns nullptr if no Recorder is provided, or if SkImage was created with another
Recorder and work on that Recorder has not been submitted.
- @param Recorder the Recorder to use for storing commands
- @param Mipmapped whether created SkImage texture must allocate mip map levels
- @return created SkImage, or nullptr
+ @param Recorder the Recorder to use for storing commands
+ @param RequiredImageProperties properties the returned SkImage must possess (e.g.,
+ mipmaps)
+ @return created SkImage, or nullptr
*/
- sk_sp<SkImage> makeTextureImage(
- skgpu::graphite::Recorder*,
- skgpu::graphite::Mipmapped = skgpu::graphite::Mipmapped::kNo) const;
+ sk_sp<SkImage> makeTextureImage(skgpu::graphite::Recorder*,
+ RequiredImageProperties = {}) const;
#endif
/** Returns raster image or lazy image. Copies SkImage backed by GPU texture into
diff --git a/chromium/third_party/skia/include/core/SkImageEncoder.h b/chromium/third_party/skia/include/core/SkImageEncoder.h
index 15796220a5b..be0183c094c 100644
--- a/chromium/third_party/skia/include/core/SkImageEncoder.h
+++ b/chromium/third_party/skia/include/core/SkImageEncoder.h
@@ -8,12 +8,14 @@
#ifndef SkImageEncoder_DEFINED
#define SkImageEncoder_DEFINED
-#include "include/core/SkData.h"
#include "include/core/SkEncodedImageFormat.h"
-#include "include/core/SkPixmap.h"
-#include "include/core/SkStream.h"
+#include "include/core/SkRefCnt.h"
+#include "include/core/SkTypes.h"
class SkBitmap;
+class SkData;
+class SkPixmap;
+class SkWStream;
/**
* Encode SkPixmap in the given binary image format.
diff --git a/chromium/third_party/skia/include/core/SkM44.h b/chromium/third_party/skia/include/core/SkM44.h
index ae08b4400c9..7fdbcb8e820 100644
--- a/chromium/third_party/skia/include/core/SkM44.h
+++ b/chromium/third_party/skia/include/core/SkM44.h
@@ -30,6 +30,7 @@ struct SK_API SkV2 {
friend SkV2 operator*(SkV2 v, SkScalar s) { return {v.x*s, v.y*s}; }
friend SkV2 operator*(SkScalar s, SkV2 v) { return {v.x*s, v.y*s}; }
friend SkV2 operator/(SkV2 v, SkScalar s) { return {v.x/s, v.y/s}; }
+ friend SkV2 operator/(SkScalar s, SkV2 v) { return {s/v.x, s/v.y}; }
void operator+=(SkV2 v) { *this = *this + v; }
void operator-=(SkV2 v) { *this = *this - v; }
diff --git a/chromium/third_party/skia/include/core/SkMesh.h b/chromium/third_party/skia/include/core/SkMesh.h
index 24d9efcc3eb..dac7d904f66 100644
--- a/chromium/third_party/skia/include/core/SkMesh.h
+++ b/chromium/third_party/skia/include/core/SkMesh.h
@@ -141,7 +141,7 @@ public:
sk_sp<SkColorSpace> cs,
SkAlphaType at);
- SkSpan<const Attribute> attributes() const { return SkMakeSpan(fAttributes); }
+ SkSpan<const Attribute> attributes() const { return SkSpan(fAttributes); }
/**
* Combined size of all 'uniform' variables. When creating a SkMesh with this specification
@@ -154,10 +154,10 @@ public:
* Provides info about individual uniforms including the offset into an SkData where each
* uniform value should be placed.
*/
- SkSpan<const Uniform> uniforms() const { return SkMakeSpan(fUniforms); }
+ SkSpan<const Uniform> uniforms() const { return SkSpan(fUniforms); }
/** Returns pointer to the named uniform variable's description, or nullptr if not found. */
- const Uniform* findUniform(const char* name) const;
+ const Uniform* findUniform(std::string_view name) const;
size_t stride() const { return fStride; }
@@ -231,8 +231,39 @@ private:
*/
class SkMesh {
public:
- class IndexBuffer : public SkRefCnt {};
- class VertexBuffer : public SkRefCnt {};
+ class IndexBuffer : public SkRefCnt {
+ public:
+ virtual size_t size() const = 0;
+
+ /**
+ * Modifies the data in the IndexBuffer by copying size bytes from data into the buffer
+ * at offset. Fails if offset + size > this->size() or if either offset or size is not
+ * aligned to 4 bytes. The GrDirectContext* must match that used to create the buffer. We
+ * take it as a parameter to emphasize that the context must be used to update the data and
+ * thus the context must be valid for the current thread.
+ */
+ bool update(GrDirectContext*, const void* data, size_t offset, size_t size);
+
+ private:
+ virtual bool onUpdate(GrDirectContext*, const void* data, size_t offset, size_t size) = 0;
+ };
+
+ class VertexBuffer : public SkRefCnt {
+ public:
+ virtual size_t size() const = 0;
+
+ /**
+ * Modifies the data in the IndexBuffer by copying size bytes from data into the buffer
+ * at offset. Fails if offset + size > this->size() or if either offset or size is not
+ * aligned to 4 bytes. The GrDirectContext* must match that used to create the buffer. We
+ * take it as a parameter to emphasize that the context must be used to update the data and
+ * thus the context must be valid for the current thread.
+ */
+ bool update(GrDirectContext*, const void* data, size_t offset, size_t size);
+
+ private:
+ virtual bool onUpdate(GrDirectContext*, const void* data, size_t offset, size_t size) = 0;
+ };
SkMesh();
~SkMesh();
@@ -244,29 +275,39 @@ public:
SkMesh& operator=(SkMesh&&);
/**
- * Makes an index buffer to be used with SkMeshes. The SkData is used to determine the
- * size and contents of the buffer. The buffer may be CPU- or GPU-backed depending on whether
- * GrDirectContext* is nullptr.
+ * Makes an index buffer to be used with SkMeshes. The buffer may be CPU- or GPU-backed
+ * depending on whether GrDirectContext* is nullptr.
*
- * @param GrDirectContext* If nullptr a CPU-backed object is returned that owns the SkData.
- * Otherwise, the data is uploaded to the GPU and a GPU-backed buffer
- * is returned. It may only be used to draw into SkSurfaces that
- * are backed by the passed GrDirectContext.
- * @param sk_sp<SkData> required. The data used to populate the buffer.
+ * @param GrDirectContext* If nullptr a CPU-backed object is returned. Otherwise, the data is
+ * uploaded to the GPU and a GPU-backed buffer is returned. It may
+ * only be used to draw into SkSurfaces that are backed by the passed
+ * GrDirectContext.
+ * @param data The data used to populate the buffer, or nullptr to create an
+ * uninitialized buffer.
+ * @param size Both the size of the data in 'data' and the size of the resulting
+ * buffer.
*/
+ static sk_sp<IndexBuffer> MakeIndexBuffer(GrDirectContext*, const void* data, size_t size);
+
+ /** Deprecated in favor of const void* and size_t version above. */
static sk_sp<IndexBuffer> MakeIndexBuffer(GrDirectContext*, sk_sp<const SkData>);
/**
- * Makes a vertex buffer to be used with SkMeshes. The SkData is used to determine the
- * size and contents of the buffer.The buffer may be CPU- or GPU-backed depending on whether
- * GrDirectContext* is nullptr.
+ * Makes a vertex buffer to be used with SkMeshes. The buffer may be CPU- or GPU-backed
+ * depending on whether GrDirectContext* is nullptr.
*
- * @param GrDirectContext* If nullptr a CPU-backed object is returned that owns the SkData.
- * Otherwise, the data is uploaded to the GPU and a GPU-backed buffer
- * is returned. It may only be used to draw into SkSurfaces that
- * are backed by the passed GrDirectContext.
- * @param sk_sp<SkData> required. The data used to populate the buffer.
+ * @param GrDirectContext* If nullptr a CPU-backed object is returned. Otherwise, the data is
+ * uploaded to the GPU and a GPU-backed buffer is returned. It may
+ * only be used to draw into SkSurfaces that are backed by the passed
+ * GrDirectContext.
+ * @param data The data used to populate the buffer, or nullptr to create an
+ * uninitialized buffer.
+ * @param size Both the size of the data in 'data' and the size of the resulting
+ * buffer.
*/
+ static sk_sp<VertexBuffer> MakeVertexBuffer(GrDirectContext*, const void*, size_t size);
+
+ /** Deprecated in favor of const void* and size_t version above. */
static sk_sp<VertexBuffer> MakeVertexBuffer(GrDirectContext*, sk_sp<const SkData>);
enum class Mode { kTriangles, kTriangleStrip };
diff --git a/chromium/third_party/skia/include/core/SkMilestone.h b/chromium/third_party/skia/include/core/SkMilestone.h
index daae543d29c..d90c9bb260d 100644
--- a/chromium/third_party/skia/include/core/SkMilestone.h
+++ b/chromium/third_party/skia/include/core/SkMilestone.h
@@ -5,5 +5,5 @@
* found in the LICENSE file.
*/
#ifndef SK_MILESTONE
-#define SK_MILESTONE 104
+#define SK_MILESTONE 106
#endif
diff --git a/chromium/third_party/skia/include/core/SkOverdrawCanvas.h b/chromium/third_party/skia/include/core/SkOverdrawCanvas.h
index 1be26c6fa59..f3ffc065566 100644
--- a/chromium/third_party/skia/include/core/SkOverdrawCanvas.h
+++ b/chromium/third_party/skia/include/core/SkOverdrawCanvas.h
@@ -22,7 +22,8 @@ public:
SkOverdrawCanvas(SkCanvas*);
void onDrawTextBlob(const SkTextBlob*, SkScalar, SkScalar, const SkPaint&) override;
- void onDrawGlyphRunList(const SkGlyphRunList& glyphRunList, const SkPaint& paint) override;
+ void onDrawGlyphRunList(
+ const sktext::GlyphRunList& glyphRunList, const SkPaint& paint) override;
void onDrawPatch(const SkPoint[12], const SkColor[4], const SkPoint[4], SkBlendMode,
const SkPaint&) override;
void onDrawPaint(const SkPaint&) override;
diff --git a/chromium/third_party/skia/include/core/SkPaint.h b/chromium/third_party/skia/include/core/SkPaint.h
index 0a6064dcbd5..04cd423e157 100644
--- a/chromium/third_party/skia/include/core/SkPaint.h
+++ b/chromium/third_party/skia/include/core/SkPaint.h
@@ -256,7 +256,9 @@ public:
float getAlphaf() const { return fColor4f.fA; }
// Helper that scales the alpha by 255.
- uint8_t getAlpha() const { return sk_float_round2int(this->getAlphaf() * 255); }
+ uint8_t getAlpha() const {
+ return static_cast<uint8_t>(sk_float_round2int(this->getAlphaf() * 255));
+ }
/** Replaces alpha, leaving RGB
unchanged. An out of range value triggers an assert in the debug
diff --git a/chromium/third_party/skia/include/core/SkPicture.h b/chromium/third_party/skia/include/core/SkPicture.h
index d05f13fc26c..b6422dd56e3 100644
--- a/chromium/third_party/skia/include/core/SkPicture.h
+++ b/chromium/third_party/skia/include/core/SkPicture.h
@@ -240,7 +240,6 @@ private:
friend class SkBigPicture;
friend class SkEmptyPicture;
friend class SkPicturePriv;
- template <typename> friend class SkMiniPicture;
void serialize(SkWStream*, const SkSerialProcs*, class SkRefCntSet* typefaces,
bool textBlobsOnly=false) const;
@@ -263,8 +262,6 @@ private:
// Returns NULL if this is not an SkBigPicture.
virtual const class SkBigPicture* asSkBigPicture() const { return nullptr; }
- friend struct SkPathCounter;
-
static bool IsValidPictInfo(const struct SkPictInfo& info);
static sk_sp<SkPicture> Forwardport(const struct SkPictInfo&,
const class SkPictureData*,
diff --git a/chromium/third_party/skia/include/core/SkPictureRecorder.h b/chromium/third_party/skia/include/core/SkPictureRecorder.h
index 9bc5d1aa1c0..af3926dd25f 100644
--- a/chromium/third_party/skia/include/core/SkPictureRecorder.h
+++ b/chromium/third_party/skia/include/core/SkPictureRecorder.h
@@ -20,7 +20,6 @@ namespace android {
class SkCanvas;
class SkDrawable;
-class SkMiniRecorder;
class SkPictureRecord;
class SkRecord;
class SkRecorder;
@@ -106,7 +105,6 @@ private:
sk_sp<SkBBoxHierarchy> fBBH;
std::unique_ptr<SkRecorder> fRecorder;
sk_sp<SkRecord> fRecord;
- std::unique_ptr<SkMiniRecorder> fMiniRecorder;
SkPictureRecorder(SkPictureRecorder&&) = delete;
SkPictureRecorder& operator=(SkPictureRecorder&&) = delete;
diff --git a/chromium/third_party/skia/include/core/SkPixmap.h b/chromium/third_party/skia/include/core/SkPixmap.h
index af7e86b18be..7bc2aa05ac7 100644
--- a/chromium/third_party/skia/include/core/SkPixmap.h
+++ b/chromium/third_party/skia/include/core/SkPixmap.h
@@ -261,6 +261,25 @@ public:
*/
SkColor getColor(int x, int y) const;
+ /** Returns pixel at (x, y) as unpremultiplied color as an SkColor4f.
+ Returns black with alpha if SkColorType is kAlpha_8_SkColorType.
+
+ Input is not validated: out of bounds values of x or y trigger an assert() if
+ built with SK_DEBUG defined; and returns undefined values or may crash if
+ SK_RELEASE is defined. Fails if SkColorType is kUnknown_SkColorType or
+ pixel address is nullptr.
+
+ SkColorSpace in SkImageInfo is ignored. Some color precision may be lost in the
+ conversion to unpremultiplied color; original pixel data may have additional
+ precision, though this is less likely than for getColor(). Rounding errors may
+ occur if the underlying type has lower precision.
+
+ @param x column index, zero or greater, and less than width()
+ @param y row index, zero or greater, and less than height()
+ @return pixel converted to unpremultiplied float color
+ */
+ SkColor4f getColor4f(int x, int y) const;
+
/** Look up the pixel at (x,y) and return its alpha component, normalized to [0..1].
This is roughly equivalent to SkGetColorA(getColor()), but can be more efficent
(and more precise if the pixels store more than 8 bits per component).
diff --git a/chromium/third_party/skia/include/core/SkRefCnt.h b/chromium/third_party/skia/include/core/SkRefCnt.h
index bcb75d7696d..2a4c5f1e8c5 100644
--- a/chromium/third_party/skia/include/core/SkRefCnt.h
+++ b/chromium/third_party/skia/include/core/SkRefCnt.h
@@ -211,8 +211,17 @@ private:
* This can be used for classes inheriting from SkRefCnt, but it also works for other
* classes that match the interface, but have different internal choices: e.g. the hosted class
* may have its ref/unref be thread-safe, but that is not assumed/imposed by sk_sp.
+ *
+ * Declared with the trivial_abi attribute where supported so that sk_sp and types containing it
+ * may be considered as trivially relocatable by the compiler so that destroying-move operations
+ * i.e. move constructor followed by destructor can be optimized to memcpy.
*/
-template <typename T> class sk_sp {
+#if defined(__clang__) && defined(__has_cpp_attribute) && __has_cpp_attribute(clang::trivial_abi)
+#define SK_SP_TRIVIAL_ABI [[clang::trivial_abi]]
+#else
+#define SK_SP_TRIVIAL_ABI
+#endif
+template <typename T> class SK_SP_TRIVIAL_ABI sk_sp {
public:
using element_type = T;
diff --git a/chromium/third_party/skia/include/core/SkScalar.h b/chromium/third_party/skia/include/core/SkScalar.h
index 07d4ec73d73..e1203ef0e74 100644
--- a/chromium/third_party/skia/include/core/SkScalar.h
+++ b/chromium/third_party/skia/include/core/SkScalar.h
@@ -145,14 +145,16 @@ static inline bool SkScalarNearlyEqual(SkScalar x, SkScalar y,
return SkScalarAbs(x-y) <= tolerance;
}
+#define SK_ScalarSinCosNearlyZero (SK_Scalar1 / (1 << 16))
+
static inline float SkScalarSinSnapToZero(SkScalar radians) {
float v = SkScalarSin(radians);
- return SkScalarNearlyZero(v) ? 0.0f : v;
+ return SkScalarNearlyZero(v, SK_ScalarSinCosNearlyZero) ? 0.0f : v;
}
static inline float SkScalarCosSnapToZero(SkScalar radians) {
float v = SkScalarCos(radians);
- return SkScalarNearlyZero(v) ? 0.0f : v;
+ return SkScalarNearlyZero(v, SK_ScalarSinCosNearlyZero) ? 0.0f : v;
}
/** Linearly interpolate between A and B, based on t.
diff --git a/chromium/third_party/skia/include/core/SkSpan.h b/chromium/third_party/skia/include/core/SkSpan.h
index a5a30f5364b..03eb3b5b0fb 100644
--- a/chromium/third_party/skia/include/core/SkSpan.h
+++ b/chromium/third_party/skia/include/core/SkSpan.h
@@ -9,29 +9,67 @@
#define SkSpan_DEFINED
#include <cstddef>
+#include <initializer_list>
#include <iterator>
#include <type_traits>
#include <utility>
#include "include/private/SkTLogic.h"
+// Add macro to check the lifetime of initializer_list arguments. initializer_list has a very
+// short life span, and can only be used as a parameter, and not as a variable.
+#if defined(__clang__) && defined(__has_cpp_attribute) && __has_cpp_attribute(clang::lifetimebound)
+#define SK_CHECK_IL_LIFETIME [[clang::lifetimebound]]
+#else
+#define SK_CHECK_IL_LIFETIME
+#endif
+
/**
- * An SkSpan is a view of a contiguous collection of elements of type T. It can be directly
- * constructed from a pointer and size. SkMakeSpan can be used to construct one from an array,
- * or a container (like std::vector).
+ * SkSpan holds a reference to contiguous data of type T along with a count. SkSpan does not own
+ * the data itself but is merely a reference, therefore you must take care with the lifetime of
+ * the underlying data.
+ *
+ * SkSpan is a count and a pointer into existing array or data type that stores its data in
+ * contiguous memory like std::vector. Any container that works with std::size() and std::data()
+ * can be used.
+ *
+ * SkSpan makes a convenient parameter for a routine to accept array like things. This allows you to
+ * write the routine without overloads for all different container types.
+ *
+ * Example:
+ * void routine(SkSpan<const int> a) { ... }
+ *
+ * std::vector v = {1, 2, 3, 4, 5};
+ *
+ * routine(a);
+ *
+ * A word of caution when working with initializer_list, initializer_lists have a lifetime that is
+ * limited to the current statement. The following is correct and safe:
*
- * With C++17, we could add template deduction guides that eliminate the need for SkMakeSpan:
- * https://skia-review.googlesource.com/c/skia/+/320264
+ * Example:
+ * routine({1,2,3,4,5});
+ *
+ * The following is undefined, and will result in erratic execution:
+ *
+ * Bad Example:
+ * initializer_list l = {1, 2, 3, 4, 5}; // The data behind l dies at the ;.
+ * routine(l);
*/
template <typename T>
class SkSpan {
public:
constexpr SkSpan() : fPtr{nullptr}, fSize{0} {}
constexpr SkSpan(T* ptr, size_t size) : fPtr{ptr}, fSize{size} {
+ SkASSERT(ptr || size == 0); // disallow nullptr + a nonzero size
SkASSERT(size < kMaxSize);
}
template <typename U, typename = typename std::enable_if<std::is_same<const U, T>::value>::type>
- constexpr SkSpan(const SkSpan<U>& that) : fPtr(that.data()), fSize{that.size()} {}
+ constexpr SkSpan(const SkSpan<U>& that) : fPtr(std::data(that)), fSize{std::size(that)} {}
constexpr SkSpan(const SkSpan& o) = default;
+ template<size_t N> constexpr SkSpan(T(&a)[N]) : SkSpan(a, N) { }
+ template<typename Container>
+ constexpr SkSpan(Container& c) : SkSpan{std::data(c), std::size(c)} { }
+ SkSpan(std::initializer_list<T> il SK_CHECK_IL_LIFETIME)
+ : SkSpan(std::data(il), std::size(il)) {}
constexpr SkSpan& operator=(const SkSpan& that) = default;
@@ -67,23 +105,17 @@ public:
}
private:
- static constexpr size_t kMaxSize = std::numeric_limits<size_t>::max() / sizeof(T);
+ static const constexpr size_t kMaxSize = std::numeric_limits<size_t>::max() / sizeof(T);
T* fPtr;
size_t fSize;
};
-template <typename T, typename S> inline constexpr SkSpan<T> SkMakeSpan(T* p, S s) {
- return SkSpan<T>{p, SkTo<size_t>(s)};
-}
-
-template <size_t N, typename T> inline constexpr SkSpan<T> SkMakeSpan(T (&a)[N]) {
- return SkSpan<T>{a, N};
-}
-
template <typename Container>
-inline auto SkMakeSpan(Container& c)
- -> SkSpan<typename std::remove_reference<decltype(*(c.data()))>::type> {
- return {c.data(), c.size()};
-}
+SkSpan(Container&) ->
+ SkSpan<std::remove_pointer_t<decltype(std::data(std::declval<Container&>()))>>;
+
+template <typename T>
+SkSpan(std::initializer_list<T>) ->
+ SkSpan<std::remove_pointer_t<decltype(std::data(std::declval<std::initializer_list<T>>()))>>;
#endif // SkSpan_DEFINED
diff --git a/chromium/third_party/skia/include/core/SkTextBlob.h b/chromium/third_party/skia/include/core/SkTextBlob.h
index d6cda3b2700..e010ea9cc78 100644
--- a/chromium/third_party/skia/include/core/SkTextBlob.h
+++ b/chromium/third_party/skia/include/core/SkTextBlob.h
@@ -20,6 +20,10 @@ struct SkRSXform;
struct SkSerialProcs;
struct SkDeserialProcs;
+namespace sktext {
+class GlyphRunList;
+}
+
/** \class SkTextBlob
SkTextBlob combines multiple text runs into an immutable container. Each text
run consists of glyphs, SkPaint, and position. Only parts of SkPaint related to
@@ -250,8 +254,7 @@ private:
fCacheID.store(cacheID);
}
- friend class SkGlyphRunList;
- friend class GrTextBlobCache;
+ friend class sktext::GlyphRunList;
friend class SkTextBlobBuilder;
friend class SkTextBlobPriv;
friend class SkTextBlobRunIterator;
diff --git a/chromium/third_party/skia/include/core/SkTypes.h b/chromium/third_party/skia/include/core/SkTypes.h
index 8adaf3ac090..8f7a2c0982b 100644
--- a/chromium/third_party/skia/include/core/SkTypes.h
+++ b/chromium/third_party/skia/include/core/SkTypes.h
@@ -193,9 +193,9 @@
#else
#include "include/config/SkUserConfig.h"
#endif
+// IWYU pragma: end_exports
#include <stddef.h>
#include <stdint.h>
-// IWYU pragma: end_exports
// Post SkUserConfig.h checks and such.
#if !defined(SK_DEBUG) && !defined(SK_RELEASE)
@@ -340,14 +340,6 @@
# endif
#endif
-#if !defined(SK_MAYBE_UNUSED)
-# if defined(__clang__) || defined(__GNUC__)
-# define SK_MAYBE_UNUSED [[maybe_unused]]
-# else
-# define SK_MAYBE_UNUSED
-# endif
-#endif
-
/**
* If your judgment is better than the compiler's (i.e. you've profiled it),
* you can use SK_ALWAYS_INLINE to force inlining. E.g.
@@ -529,6 +521,15 @@ static inline constexpr int64_t SkLeftShift(int64_t value, int32_t shift) {
/** @return the number of entries in an array (not a pointer)
*/
+// The SkArrayCountHelper template returns a type 'char (&)[N]', a reference to an array of
+// char with N elements, where N is deduced using function parameter type deduction. This is then
+// used in the sizeof operator in SK_ARRAY_COUNT. The sizeof operator ignores the reference, and
+// just evaluates the size of the array type.
+//
+// DEPRECATED: use std::size() instead.
+// Note: Rarely, std::size(z) can't deduce the type of z during compile time for static_assert
+// while SK_ARRAY_COUNT can. It can't be deduced because z is part of class, and the class' this
+// pointer is not a valid constexpr expression. Use SkASSERT instead.
template <typename T, size_t N> char (&SkArrayCountHelper(T (&array)[N]))[N];
#define SK_ARRAY_COUNT(array) (sizeof(SkArrayCountHelper(array)))
diff --git a/chromium/third_party/skia/include/docs/BUILD.bazel b/chromium/third_party/skia/include/docs/BUILD.bazel
index 79f8b7bc889..9bf068c71c6 100644
--- a/chromium/third_party/skia/include/docs/BUILD.bazel
+++ b/chromium/third_party/skia/include/docs/BUILD.bazel
@@ -6,9 +6,9 @@ exports_files_legacy()
filegroup(
name = "public_hdrs",
- srcs = [
- "SkPDFDocument.h",
- "SkXPSDocument.h",
- ],
+ srcs = select({
+ "//src/pdf:enable_pdf_backend_true": ["SkPDFDocument.h"],
+ "//conditions:default": [],
+ }), # TODO(kjlubick) XPSDocument
visibility = ["//include:__pkg__"],
)
diff --git a/chromium/third_party/skia/include/effects/SkGradientShader.h b/chromium/third_party/skia/include/effects/SkGradientShader.h
index 13a3e234d00..2655a2b62d1 100644
--- a/chromium/third_party/skia/include/effects/SkGradientShader.h
+++ b/chromium/third_party/skia/include/effects/SkGradientShader.h
@@ -188,6 +188,14 @@ public:
int count, SkTileMode mode);
/** Returns a shader that generates a sweep gradient given a center.
+
+ The shader accepts negative angles and angles larger than 360, draws
+ between 0 and 360 degrees, similar to the CSS conic-gradient
+ semantics. 0 degrees means horizontal positive x axis. The start angle
+ must be less than the end angle, otherwise a null pointer is
+ returned. If color stops do not contain 0 and 1 but are within this
+ range, the respective outer color stop is repeated for 0 and 1. Color
+ stops less than 0 are clamped to 0, and greater than 1 are clamped to 1.
<p />
@param cx The X coordinate of the center of the sweep
@param cx The Y coordinate of the center of the sweep
@@ -220,6 +228,14 @@ public:
}
/** Returns a shader that generates a sweep gradient given a center.
+
+ The shader accepts negative angles and angles larger than 360, draws
+ between 0 and 360 degrees, similar to the CSS conic-gradient
+ semantics. 0 degrees means horizontal positive x axis. The start angle
+ must be less than the end angle, otherwise a null pointer is
+ returned. If color stops do not contain 0 and 1 but are within this
+ range, the respective outer color stop is repeated for 0 and 1. Color
+ stops less than 0 are clamped to 0, and greater than 1 are clamped to 1.
<p />
@param cx The X coordinate of the center of the sweep
@param cx The Y coordinate of the center of the sweep
diff --git a/chromium/third_party/skia/include/effects/SkImageFilters.h b/chromium/third_party/skia/include/effects/SkImageFilters.h
index 144bfb8a64c..5665c607015 100644
--- a/chromium/third_party/skia/include/effects/SkImageFilters.h
+++ b/chromium/third_party/skia/include/effects/SkImageFilters.h
@@ -154,7 +154,8 @@ public:
* @param yChannelSelector RGBA channel that encodes the y displacement per pixel.
* @param scale Scale applied to displacement extracted from image.
* @param displacement The filter defining the displacement image, or null to use source.
- * @param color The filter providing the color pixels to be displaced.
+ * @param color The filter providing the color pixels to be displaced. If null,
+ * it will use the source.
* @param cropRect Optional rectangle that crops the color input and output.
*/
static sk_sp<SkImageFilter> DisplacementMap(SkColorChannel xChannelSelector,
@@ -344,13 +345,13 @@ public:
* fill the result image
* @param childShaderName The name of the child shader defined in the builder that will be
* bound to the input param (or the source image if the input param
- * is null). If null the builder can have exactly one child shader,
+ * is null). If empty, the builder can have exactly one child shader,
* which automatically binds the input param.
* @param input The image filter that will be provided as input to the runtime
* shader. If null the implicit source image is used instead
*/
static sk_sp<SkImageFilter> RuntimeShader(const SkRuntimeShaderBuilder& builder,
- const char* childShaderName,
+ std::string_view childShaderName,
sk_sp<SkImageFilter> input);
/**
@@ -369,7 +370,7 @@ public:
* @param inputCount How many entries are present in 'childShaderNames' and 'inputs'.
*/
static sk_sp<SkImageFilter> RuntimeShader(const SkRuntimeShaderBuilder& builder,
- const char* childShaderNames[],
+ std::string_view childShaderNames[],
const sk_sp<SkImageFilter> inputs[],
int inputCount);
#endif // SK_ENABLE_SKSL
diff --git a/chromium/third_party/skia/include/effects/SkRuntimeEffect.h b/chromium/third_party/skia/include/effects/SkRuntimeEffect.h
index 2f9b98928e3..24a2fc37256 100644
--- a/chromium/third_party/skia/include/effects/SkRuntimeEffect.h
+++ b/chromium/third_party/skia/include/effects/SkRuntimeEffect.h
@@ -25,6 +25,8 @@
#ifdef SK_ENABLE_SKSL
+#include "include/sksl/SkSLVersion.h"
+
class GrRecordingContext;
class SkFilterColorProgram;
class SkImage;
@@ -83,13 +85,17 @@ public:
// When used with SkMeshSpecification, indicates that the uniform is present in the
// fragment shader. Not used with SkRuntimeEffect.
kFragment_Flag = 0x8,
+
+ // This flag indicates that the SkSL uniform uses a medium-precision type
+ // (i.e., `half` instead of `float`).
+ kHalfPrecision_Flag = 0x10,
};
- SkString name;
- size_t offset;
- Type type;
- int count;
- uint32_t flags;
+ std::string_view name;
+ size_t offset;
+ Type type;
+ int count;
+ uint32_t flags;
bool isArray() const { return SkToBool(this->flags & kArray_Flag); }
bool isColor() const { return SkToBool(this->flags & kColor_Flag); }
@@ -104,9 +110,9 @@ public:
};
struct Child {
- SkString name;
- ChildType type;
- int index;
+ std::string_view name;
+ ChildType type;
+ int index;
};
class Options {
@@ -120,17 +126,16 @@ public:
friend class SkRuntimeEffect;
friend class SkRuntimeEffectPriv;
+ // Public SkSL does not allow access to sk_FragCoord. The semantics of that variable are
+ // confusing, and expose clients to implementation details of saveLayer and image filters.
+ bool usePrivateRTShaderModule = false;
+
// TODO(skia:11209) - Replace this with a promised SkCapabilities?
// This flag lifts the ES2 restrictions on Runtime Effects that are gated by the
// `strictES2Mode` check. Be aware that the software renderer and pipeline-stage effect are
// still largely ES3-unaware and can still fail or crash if post-ES2 features are used.
// This is only intended for use by tests and certain internally created effects.
- bool enforceES2Restrictions = true;
-
- // Similarly: Public SkSL does not allow access to sk_FragCoord. The semantics of that
- // variable are confusing, and expose clients to implementation details of saveLayer and
- // image filters.
- bool usePrivateRTShaderModule = false;
+ SkSL::Version maxVersionAllowed = SkSL::Version::k100;
};
// If the effect is compiled successfully, `effect` will be non-null.
@@ -245,14 +250,19 @@ public:
// provide an SkData of this size, containing values for all of those variables.
size_t uniformSize() const;
- SkSpan<const Uniform> uniforms() const { return SkMakeSpan(fUniforms); }
- SkSpan<const Child> children() const { return SkMakeSpan(fChildren); }
+ SkSpan<const Uniform> uniforms() const { return SkSpan(fUniforms); }
+ SkSpan<const Child> children() const { return SkSpan(fChildren); }
// Returns pointer to the named uniform variable's description, or nullptr if not found
- const Uniform* findUniform(const char* name) const;
+ const Uniform* findUniform(std::string_view name) const;
// Returns pointer to the named child's description, or nullptr if not found
- const Child* findChild(const char* name) const;
+ const Child* findChild(std::string_view name) const;
+
+ // Allows the runtime effect type to be identified.
+ bool allowShader() const { return (fFlags & kAllowShader_Flag); }
+ bool allowColorFilter() const { return (fFlags & kAllowColorFilter_Flag); }
+ bool allowBlender() const { return (fFlags & kAllowBlender_Flag); }
static void RegisterFlattenables();
~SkRuntimeEffect() override;
@@ -288,14 +298,11 @@ private:
uint32_t hash() const { return fHash; }
bool usesSampleCoords() const { return (fFlags & kUsesSampleCoords_Flag); }
- bool allowShader() const { return (fFlags & kAllowShader_Flag); }
- bool allowColorFilter() const { return (fFlags & kAllowColorFilter_Flag); }
- bool allowBlender() const { return (fFlags & kAllowBlender_Flag); }
bool samplesOutsideMain() const { return (fFlags & kSamplesOutsideMain_Flag); }
bool usesColorTransform() const { return (fFlags & kUsesColorTransform_Flag); }
bool alwaysOpaque() const { return (fFlags & kAlwaysOpaque_Flag); }
- const SkFilterColorProgram* getFilterColorProgram();
+ const SkFilterColorProgram* getFilterColorProgram() const;
#if SK_SUPPORT_GPU
friend class GrSkSLFP; // fBaseProgram, fSampleUsages
@@ -405,11 +412,8 @@ public:
const SkRuntimeEffect* effect() const { return fEffect.get(); }
- BuilderUniform uniform(const char* name) { return { this, fEffect->findUniform(name) }; }
- BuilderChild child(const char* name) {
- const SkRuntimeEffect::Child* child = fEffect->findChild(name);
- return { this, child };
- }
+ BuilderUniform uniform(std::string_view name) { return { this, fEffect->findUniform(name) }; }
+ BuilderChild child(std::string_view name) { return { this, fEffect->findChild(name) }; }
protected:
SkRuntimeEffectBuilder() = delete;
diff --git a/chromium/third_party/skia/include/gpu/BUILD.bazel b/chromium/third_party/skia/include/gpu/BUILD.bazel
index c70b7cf46be..2520e775faa 100644
--- a/chromium/third_party/skia/include/gpu/BUILD.bazel
+++ b/chromium/third_party/skia/include/gpu/BUILD.bazel
@@ -28,11 +28,10 @@ filegroup(
"//include/gpu/gl:public_hdrs",
] + select_multi(
{
- "//bazel/common_config_settings:dawn_backend": ["//include/gpu/dawn:public_hdrs"],
- "//bazel/common_config_settings:vulkan_backend": ["//include/gpu/vk:public_hdrs"],
+ "//src/gpu:dawn_backend": ["//include/gpu/dawn:public_hdrs"],
+ "//src/gpu:vulkan_backend": ["//include/gpu/vk:public_hdrs"],
# TODO(kjlubick) mtl and d3d backend
},
- default = [],
),
visibility = ["//include:__pkg__"],
)
diff --git a/chromium/third_party/skia/include/gpu/GrBackendSurface.h b/chromium/third_party/skia/include/gpu/GrBackendSurface.h
index 8f21ceba38f..9e133c5db35 100644
--- a/chromium/third_party/skia/include/gpu/GrBackendSurface.h
+++ b/chromium/third_party/skia/include/gpu/GrBackendSurface.h
@@ -25,6 +25,8 @@
#include "include/gpu/dawn/GrDawnTypes.h"
#endif
+#include <string>
+
class GrBackendSurfaceMutableStateImpl;
class GrVkImageLayout;
class GrGLTextureParameters;
@@ -267,38 +269,44 @@ public:
GrBackendTexture(int width,
int height,
GrMipmapped,
- const GrGLTextureInfo& glInfo);
+ const GrGLTextureInfo& glInfo,
+ std::string_view label = {});
#endif
#ifdef SK_VULKAN
GrBackendTexture(int width,
int height,
- const GrVkImageInfo& vkInfo);
+ const GrVkImageInfo& vkInfo,
+ std::string_view label = {});
#endif
#ifdef SK_METAL
GrBackendTexture(int width,
int height,
GrMipmapped,
- const GrMtlTextureInfo& mtlInfo);
+ const GrMtlTextureInfo& mtlInfo,
+ std::string_view label = {});
#endif
#ifdef SK_DIRECT3D
GrBackendTexture(int width,
int height,
- const GrD3DTextureResourceInfo& d3dInfo);
+ const GrD3DTextureResourceInfo& d3dInfo,
+ std::string_view label = {});
#endif
#ifdef SK_DAWN
GrBackendTexture(int width,
int height,
- const GrDawnTextureInfo& dawnInfo);
+ const GrDawnTextureInfo& dawnInfo,
+ std::string_view label = {});
#endif
GrBackendTexture(int width,
int height,
GrMipmapped,
- const GrMockTextureInfo& mockInfo);
+ const GrMockTextureInfo& mockInfo,
+ std::string_view label = {});
GrBackendTexture(const GrBackendTexture& that);
@@ -309,6 +317,7 @@ public:
SkISize dimensions() const { return {fWidth, fHeight}; }
int width() const { return fWidth; }
int height() const { return fHeight; }
+ std::string_view getLabel() const { return fLabel; }
GrMipmapped mipmapped() const { return fMipmapped; }
bool hasMipmaps() const { return fMipmapped == GrMipmapped::kYes; }
/** deprecated alias of hasMipmaps(). */
@@ -398,7 +407,8 @@ private:
int height,
GrMipmapped,
const GrGLTextureInfo,
- sk_sp<GrGLTextureParameters>);
+ sk_sp<GrGLTextureParameters>,
+ std::string_view label = {});
sk_sp<GrGLTextureParameters> getGLTextureParams() const;
#endif
@@ -407,7 +417,8 @@ private:
GrBackendTexture(int width,
int height,
const GrVkImageInfo& vkInfo,
- sk_sp<GrBackendSurfaceMutableStateImpl> mutableState);
+ sk_sp<GrBackendSurfaceMutableStateImpl> mutableState,
+ std::string_view label = {});
#endif
#ifdef SK_DIRECT3D
@@ -416,7 +427,8 @@ private:
GrBackendTexture(int width,
int height,
const GrD3DTextureResourceInfo& vkInfo,
- sk_sp<GrD3DResourceState> state);
+ sk_sp<GrD3DResourceState> state,
+ std::string_view label = {});
sk_sp<GrD3DResourceState> getGrD3DResourceState() const;
#endif
@@ -426,6 +438,7 @@ private:
bool fIsValid;
int fWidth; //<! width in pixels
int fHeight; //<! height in pixels
+ const std::string fLabel;
GrMipmapped fMipmapped;
GrBackendApi fBackend;
GrTextureType fTextureType;
diff --git a/chromium/third_party/skia/include/gpu/GrTypes.h b/chromium/third_party/skia/include/gpu/GrTypes.h
index 20fc62f699e..f8895345d65 100644
--- a/chromium/third_party/skia/include/gpu/GrTypes.h
+++ b/chromium/third_party/skia/include/gpu/GrTypes.h
@@ -36,37 +36,37 @@ private:
* basic bitfield.
*/
#define GR_MAKE_BITFIELD_CLASS_OPS(X) \
- SK_MAYBE_UNUSED constexpr GrTFlagsMask<X> operator~(X a) { \
+ [[maybe_unused]] constexpr GrTFlagsMask<X> operator~(X a) { \
return GrTFlagsMask<X>(~static_cast<int>(a)); \
} \
- SK_MAYBE_UNUSED constexpr X operator|(X a, X b) { \
+ [[maybe_unused]] constexpr X operator|(X a, X b) { \
return static_cast<X>(static_cast<int>(a) | static_cast<int>(b)); \
} \
- SK_MAYBE_UNUSED inline X& operator|=(X& a, X b) { \
+ [[maybe_unused]] inline X& operator|=(X& a, X b) { \
return (a = a | b); \
} \
- SK_MAYBE_UNUSED constexpr bool operator&(X a, X b) { \
+ [[maybe_unused]] constexpr bool operator&(X a, X b) { \
return SkToBool(static_cast<int>(a) & static_cast<int>(b)); \
} \
- SK_MAYBE_UNUSED constexpr GrTFlagsMask<X> operator|(GrTFlagsMask<X> a, GrTFlagsMask<X> b) { \
+ [[maybe_unused]] constexpr GrTFlagsMask<X> operator|(GrTFlagsMask<X> a, GrTFlagsMask<X> b) { \
return GrTFlagsMask<X>(a.value() | b.value()); \
} \
- SK_MAYBE_UNUSED constexpr GrTFlagsMask<X> operator|(GrTFlagsMask<X> a, X b) { \
+ [[maybe_unused]] constexpr GrTFlagsMask<X> operator|(GrTFlagsMask<X> a, X b) { \
return GrTFlagsMask<X>(a.value() | static_cast<int>(b)); \
} \
- SK_MAYBE_UNUSED constexpr GrTFlagsMask<X> operator|(X a, GrTFlagsMask<X> b) { \
+ [[maybe_unused]] constexpr GrTFlagsMask<X> operator|(X a, GrTFlagsMask<X> b) { \
return GrTFlagsMask<X>(static_cast<int>(a) | b.value()); \
} \
- SK_MAYBE_UNUSED constexpr X operator&(GrTFlagsMask<X> a, GrTFlagsMask<X> b) { \
+ [[maybe_unused]] constexpr X operator&(GrTFlagsMask<X> a, GrTFlagsMask<X> b) { \
return static_cast<X>(a.value() & b.value()); \
} \
- SK_MAYBE_UNUSED constexpr X operator&(GrTFlagsMask<X> a, X b) { \
+ [[maybe_unused]] constexpr X operator&(GrTFlagsMask<X> a, X b) { \
return static_cast<X>(a.value() & static_cast<int>(b)); \
} \
- SK_MAYBE_UNUSED constexpr X operator&(X a, GrTFlagsMask<X> b) { \
+ [[maybe_unused]] constexpr X operator&(X a, GrTFlagsMask<X> b) { \
return static_cast<X>(static_cast<int>(a) & b.value()); \
} \
- SK_MAYBE_UNUSED inline X& operator&=(X& a, GrTFlagsMask<X> b) { \
+ [[maybe_unused]] inline X& operator&=(X& a, GrTFlagsMask<X> b) { \
return (a = a & b); \
} \
diff --git a/chromium/third_party/skia/include/gpu/gl/GrGLFunctions.h b/chromium/third_party/skia/include/gpu/gl/GrGLFunctions.h
index 84724403a91..59b9cd9e18d 100644
--- a/chromium/third_party/skia/include/gpu/gl/GrGLFunctions.h
+++ b/chromium/third_party/skia/include/gpu/gl/GrGLFunctions.h
@@ -47,6 +47,7 @@ using GrGLColorMaskFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLboolean red, GrGLboolea
using GrGLCompileShaderFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint shader);
using GrGLCompressedTexImage2DFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLint level, GrGLenum internalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLsizei imageSize, const GrGLvoid* data);
using GrGLCompressedTexSubImage2DFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLsizei imageSize, const GrGLvoid* data);
+using GrGLCopyBufferSubDataFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum readTargt, GrGLenum writeTarget, GrGLintptr readOffset, GrGLintptr writeOffset, GrGLsizeiptr size);
using GrGLCopyTexSubImage2DFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height);
using GrGLCreateProgramFn = GrGLuint GR_GL_FUNCTION_TYPE();
using GrGLCreateShaderFn = GrGLuint GR_GL_FUNCTION_TYPE(GrGLenum type);
diff --git a/chromium/third_party/skia/include/gpu/gl/GrGLInterface.h b/chromium/third_party/skia/include/gpu/gl/GrGLInterface.h
index e10242b3b72..5d6e3bb2d5f 100644
--- a/chromium/third_party/skia/include/gpu/gl/GrGLInterface.h
+++ b/chromium/third_party/skia/include/gpu/gl/GrGLInterface.h
@@ -119,6 +119,7 @@ public:
GrGLFunction<GrGLCompileShaderFn> fCompileShader;
GrGLFunction<GrGLCompressedTexImage2DFn> fCompressedTexImage2D;
GrGLFunction<GrGLCompressedTexSubImage2DFn> fCompressedTexSubImage2D;
+ GrGLFunction<GrGLCopyBufferSubDataFn> fCopyBufferSubData;
GrGLFunction<GrGLCopyTexSubImage2DFn> fCopyTexSubImage2D;
GrGLFunction<GrGLCreateProgramFn> fCreateProgram;
GrGLFunction<GrGLCreateShaderFn> fCreateShader;
diff --git a/chromium/third_party/skia/include/gpu/graphite/Context.h b/chromium/third_party/skia/include/gpu/graphite/Context.h
index 6d53b5d45a9..78d9dfd5bca 100644
--- a/chromium/third_party/skia/include/gpu/graphite/Context.h
+++ b/chromium/third_party/skia/include/gpu/graphite/Context.h
@@ -10,7 +10,12 @@
#include "include/core/SkRefCnt.h"
#include "include/core/SkShader.h"
+#include "include/gpu/graphite/ContextOptions.h"
#include "include/gpu/graphite/GraphiteTypes.h"
+#include "include/gpu/graphite/Recorder.h"
+#include "include/private/SingleOwner.h"
+
+#include <memory>
class SkBlenderID;
class SkCombinationBuilder;
@@ -19,17 +24,16 @@ class SkRuntimeEffect;
namespace skgpu::graphite {
class BackendTexture;
-class CommandBuffer;
class Context;
class ContextPriv;
class GlobalCache;
-class Gpu;
struct MtlBackendContext;
-class Recorder;
+class QueueManager;
class Recording;
-class TextureInfo;
+class ResourceProvider;
+class SharedContext;
-class Context final {
+class SK_API Context final {
public:
Context(const Context&) = delete;
Context(Context&&) = delete;
@@ -39,12 +43,12 @@ public:
~Context();
#ifdef SK_METAL
- static std::unique_ptr<Context> MakeMetal(const skgpu::graphite::MtlBackendContext&);
+ static std::unique_ptr<Context> MakeMetal(const MtlBackendContext&, const ContextOptions&);
#endif
- BackendApi backend() const { return fBackend; }
+ BackendApi backend() const;
- std::unique_ptr<Recorder> makeRecorder();
+ std::unique_ptr<Recorder> makeRecorder(const RecorderOptions& = {});
void insertRecording(const InsertRecordingInfo&);
void submit(SyncToCpu = SyncToCpu::kNo);
@@ -54,27 +58,19 @@ public:
*/
void checkAsyncWorkCompletion();
+#ifdef SK_ENABLE_PRECOMPILE
// TODO: add "SkShaderID addUserDefinedShader(sk_sp<SkRuntimeEffect>)" here
// TODO: add "SkColorFilterID addUserDefinedColorFilter(sk_sp<SkRuntimeEffect>)" here
SkBlenderID addUserDefinedBlender(sk_sp<SkRuntimeEffect>);
void precompile(SkCombinationBuilder*);
-
- /**
- * Creates a new backend gpu texture matching the dimensinos and TextureInfo. If an invalid
- * TextureInfo or a TextureInfo Skia can't support is passed in, this will return an invalid
- * BackendTexture. Thus the client should check isValid on the returned BackendTexture to know
- * if it succeeded or not.
- *
- * If this does return a valid BackendTexture, the caller is required to use
- * Context::deleteBackendTexture to delete that texture.
- */
- BackendTexture createBackendTexture(SkISize dimensions, const TextureInfo&);
+#endif
/**
* Called to delete the passed in BackendTexture. This should only be called if the
- * BackendTexture was created by calling Context::createBackendTexture. If the BackendTexture is
- * not valid or does not match the BackendApi of the Context then nothing happens.
+ * BackendTexture was created by calling Recorder::createBackendTexture on a Recorder created
+ * from this Context. If the BackendTexture is not valid or does not match the BackendApi of the
+ * Context then nothing happens.
*
* Otherwise this will delete/release the backend object that is wrapped in the BackendTexture.
* The BackendTexture will be reset to an invalid state and should not be used again.
@@ -86,16 +82,21 @@ public:
const ContextPriv priv() const; // NOLINT(readability-const-return-type)
protected:
- Context(sk_sp<Gpu>, BackendApi);
+ Context(sk_sp<SharedContext>, std::unique_ptr<QueueManager>);
private:
friend class ContextPriv;
- sk_sp<CommandBuffer> fCurrentCommandBuffer;
+ SingleOwner* singleOwner() const { return &fSingleOwner; }
- sk_sp<Gpu> fGpu;
+ sk_sp<SharedContext> fSharedContext;
+ std::unique_ptr<ResourceProvider> fResourceProvider;
+ std::unique_ptr<QueueManager> fQueueManager;
sk_sp<GlobalCache> fGlobalCache;
- BackendApi fBackend;
+
+ // In debug builds we guard against improper thread handling. This guard is passed to the
+ // ResourceCache for the Context.
+ mutable SingleOwner fSingleOwner;
};
} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/include/gpu/graphite/ContextOptions.h b/chromium/third_party/skia/include/gpu/graphite/ContextOptions.h
new file mode 100644
index 00000000000..05eeed6e9ab
--- /dev/null
+++ b/chromium/third_party/skia/include/gpu/graphite/ContextOptions.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef skgpu_graphite_ContextOptions_DEFINED
+#define skgpu_graphite_ContextOptions_DEFINED
+
+namespace skgpu { class ShaderErrorHandler; }
+
+namespace skgpu::graphite {
+
+struct SK_API ContextOptions {
+ ContextOptions() {}
+
+ /**
+ * If present, use this object to report shader compilation failures. If not, report failures
+ * via SkDebugf and assert.
+ */
+ skgpu::ShaderErrorHandler* fShaderErrorHandler = nullptr;
+
+ /**
+ * The maximum size of cache textures used for Skia's Glyph cache.
+ */
+ size_t fGlyphCacheTextureMaximumBytes = 2048 * 1024 * 4;
+
+ /**
+ * Below this threshold size in device space distance field fonts won't be used. Distance field
+ * fonts don't support hinting which is more important at smaller sizes.
+ */
+ float fMinDistanceFieldFontSize = 18;
+
+ /**
+ * Above this threshold size in device space glyphs are drawn as individual paths.
+ */
+#if defined(SK_BUILD_FOR_ANDROID)
+ float fGlyphsAsPathsFontSize = 384;
+#elif defined(SK_BUILD_FOR_MAC)
+ float fGlyphsAsPathsFontSize = 256;
+#else
+ float fGlyphsAsPathsFontSize = 324;
+#endif
+
+ /**
+ * Can the glyph atlas use multiple textures. If allowed, the each texture's size is bound by
+ * fGlypheCacheTextureMaximumBytes.
+ */
+ bool fAllowMultipleGlyphCacheTextures = true;
+
+ /**
+ * If true, then add 1 pixel padding to all glyph masks in the atlas to support bi-lerp
+ * rendering of all glyphs. This must be set to true to use Slugs.
+ */
+ #if defined(SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG) || \
+ defined(SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG_SERIALIZE) || \
+ defined(SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG_STRIKE_SERIALIZE)
+ bool fSupportBilerpFromGlyphAtlas = true;
+ #else
+ bool fSupportBilerpFromGlyphAtlas = false;
+ #endif
+
+#if GRAPHITE_TEST_UTILS
+ /**
+ * Private options that are only meant for testing within Skia's tools.
+ */
+
+ /**
+ * Maximum width and height of internal texture atlases.
+ */
+ int fMaxTextureAtlasSize = 2048;
+#endif
+};
+
+} // namespace skgpu::graphite
+
+#endif // skgpu_graphite_ContextOptions
diff --git a/chromium/third_party/skia/include/gpu/graphite/GraphiteTypes.h b/chromium/third_party/skia/include/gpu/graphite/GraphiteTypes.h
index e0b7a6fe1a6..2bec5e27010 100644
--- a/chromium/third_party/skia/include/gpu/graphite/GraphiteTypes.h
+++ b/chromium/third_party/skia/include/gpu/graphite/GraphiteTypes.h
@@ -53,7 +53,7 @@ enum class BackendApi : unsigned {
/**
* Is the texture mipmapped or not
*/
-enum class Mipmapped: bool {
+enum class Mipmapped : bool {
kNo = false,
kYes = true,
};
diff --git a/chromium/third_party/skia/include/gpu/graphite/ImageProvider.h b/chromium/third_party/skia/include/gpu/graphite/ImageProvider.h
new file mode 100644
index 00000000000..eb9394d3832
--- /dev/null
+++ b/chromium/third_party/skia/include/gpu/graphite/ImageProvider.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef skgpu_graphite_ImageProvider_DEFINED
+#define skgpu_graphite_ImageProvider_DEFINED
+
+#include "include/core/SkImage.h"
+#include "include/core/SkRefCnt.h"
+
+namespace skgpu::graphite {
+
+enum class Mipmapped : bool;
+class Recorder;
+
+/*
+ * This class provides a centralized location for clients to perform any caching of images
+ * they desire. Whenever Graphite encounters an SkImage which is not Graphite-backed
+ * it will call ImageProvider::findOrCreate. The client's derived version of this class should
+ * return a Graphite-backed version of the provided SkImage that meets the specified
+ * requirements. If the requirements are not met by the returned image, Graphite
+ * will draw opaque red.
+ *
+ * Note: by default, Graphite will not perform any caching of images
+ *
+ * Threading concerns:
+ * If the same ImageProvider is given to multiple Recorders it is up to the
+ * client to handle any required thread synchronization. This is not limited to just
+ * restricting access to whatever map a derived class may have but extends to ensuring
+ * that an image created on one Recorder has had its creation work submitted before it
+ * is used by any work submitted by another Recorder. Please note, this requirement
+ * (re the submission of creation work and image usage on different threads) is common to all
+ * graphite SkImages and isn't unique to SkImages returned by the ImageProvider.
+ *
+ * TODO(b/240996632): add documentation re shutdown order.
+ * TODO(b/240997067): add unit tests
+ */
+class SK_API ImageProvider : public SkRefCnt {
+public:
+ // If the client's derived class already has a Graphite-backed image that has the same
+ // contents as 'image' and meets the requirements, then it can be returned.
+ // makeTextureImage can always be called to create an acceptable Graphite-backed image
+ // which could then be cached.
+ virtual sk_sp<SkImage> findOrCreate(Recorder* recorder,
+ const SkImage* image,
+ SkImage::RequiredImageProperties) = 0;
+};
+
+} // namespace skgpu::graphite
+
+#endif // skgpu_graphite_ImageProvider_DEFINED
diff --git a/chromium/third_party/skia/include/gpu/graphite/Recorder.h b/chromium/third_party/skia/include/gpu/graphite/Recorder.h
index bf7ada1bd5b..3673075c6ab 100644
--- a/chromium/third_party/skia/include/gpu/graphite/Recorder.h
+++ b/chromium/third_party/skia/include/gpu/graphite/Recorder.h
@@ -9,33 +9,56 @@
#define skgpu_graphite_Recorder_DEFINED
#include "include/core/SkRefCnt.h"
+#include "include/core/SkSize.h"
+#include "include/gpu/graphite/GraphiteTypes.h"
#include "include/private/SingleOwner.h"
+#include "include/private/SkTHash.h"
#include <vector>
+class SkRuntimeEffect;
class SkTextureDataBlock;
class SkUniformDataBlock;
class SkUniformDataBlockPassThrough; // TODO: remove
+namespace skgpu { class TokenTracker; }
+
+namespace sktext::gpu {
+class StrikeCache;
+class TextBlobRedrawCoordinator;
+}
+
namespace skgpu::graphite {
+class AtlasManager;
+class BackendTexture;
class Caps;
class Device;
class DrawBufferManager;
class GlobalCache;
-class Gpu;
+class ImageProvider;
class RecorderPriv;
class Recording;
class ResourceProvider;
+class SharedContext;
class Task;
class TaskGraph;
+class TextureInfo;
class UploadBufferManager;
template<typename StorageT, typename BaseT> class PipelineDataCache;
using UniformDataCache = PipelineDataCache<SkUniformDataBlockPassThrough, SkUniformDataBlock>;
using TextureDataCache = PipelineDataCache<std::unique_ptr<SkTextureDataBlock>, SkTextureDataBlock>;
-class Recorder final {
+struct SK_API RecorderOptions final {
+ RecorderOptions() = default;
+ RecorderOptions(const RecorderOptions&) = default;
+ ~RecorderOptions();
+
+ sk_sp<ImageProvider> fImageProvider;
+};
+
+class SK_API Recorder final {
public:
Recorder(const Recorder&) = delete;
Recorder(Recorder&&) = delete;
@@ -46,6 +69,34 @@ public:
std::unique_ptr<Recording> snap();
+ ImageProvider* clientImageProvider() const {
+ return fClientImageProvider.get();
+ }
+
+ /**
+ * Creates a new backend gpu texture matching the dimensions and TextureInfo. If an invalid
+ * TextureInfo or a TextureInfo Skia can't support is passed in, this will return an invalid
+ * BackendTexture. Thus the client should check isValid on the returned BackendTexture to know
+ * if it succeeded or not.
+ *
+ * If this does return a valid BackendTexture, the caller is required to use
+ * Recorder::deleteBackendTexture or Context::deleteBAckendTexture to delete the texture. It is
+ * safe to use the Context that created this Recorder or any other Recorder created from the
+ * same Context to call deleteBackendTexture.
+ */
+ BackendTexture createBackendTexture(SkISize dimensions, const TextureInfo&);
+
+ /**
+ * Called to delete the passed in BackendTexture. This should only be called if the
+ * BackendTexture was created by calling Recorder::createBackendTexture on a Recorder that is
+ * associated with the same Context. If the BackendTexture is not valid or does not match the
+ * BackendApi of the Recorder then nothing happens.
+ *
+ * Otherwise this will delete/release the backend object that is wrapped in the BackendTexture.
+ * The BackendTexture will be reset to an invalid state and should not be used again.
+ */
+ void deleteBackendTexture(BackendTexture&);
+
// Provides access to functions that aren't part of the public API.
RecorderPriv priv();
const RecorderPriv priv() const; // NOLINT(readability-const-return-type)
@@ -59,10 +110,12 @@ private:
friend class Device; // For registering and deregistering Devices;
friend class RecorderPriv; // for ctor and hidden methods
- Recorder(sk_sp<Gpu>, sk_sp<GlobalCache>);
+ Recorder(sk_sp<SharedContext>, sk_sp<GlobalCache>, const RecorderOptions&);
SingleOwner* singleOwner() const { return &fSingleOwner; }
+ BackendApi backend() const;
+
// We keep track of all Devices that are connected to a Recorder. This allows the client to
// safely delete an SkSurface or a Recorder in any order. If the client deletes the Recorder
// we need to notify all Devices that the Recorder is no longer valid. If we delete the
@@ -83,7 +136,7 @@ private:
void registerDevice(Device*);
void deregisterDevice(const Device*);
- sk_sp<Gpu> fGpu;
+ sk_sp<SharedContext> fSharedContext;
std::unique_ptr<ResourceProvider> fResourceProvider;
std::unique_ptr<TaskGraph> fGraph;
@@ -93,6 +146,13 @@ private:
std::unique_ptr<UploadBufferManager> fUploadBufferManager;
std::vector<Device*> fTrackedDevices;
+ uint32_t fRecorderID; // Needed for MessageBox handling for text
+ std::unique_ptr<AtlasManager> fAtlasManager;
+ std::unique_ptr<TokenTracker> fTokenTracker;
+ std::unique_ptr<sktext::gpu::StrikeCache> fStrikeCache;
+ std::unique_ptr<sktext::gpu::TextBlobRedrawCoordinator> fTextBlobCache;
+ sk_sp<ImageProvider> fClientImageProvider;
+
// In debug builds we guard against improper thread handling
// This guard is passed to the ResourceCache.
// TODO: Should we also pass this to Device, DrawContext, and similar classes?
diff --git a/chromium/third_party/skia/include/gpu/graphite/Recording.h b/chromium/third_party/skia/include/gpu/graphite/Recording.h
index 1a073907f2e..b1cb770bf06 100644
--- a/chromium/third_party/skia/include/gpu/graphite/Recording.h
+++ b/chromium/third_party/skia/include/gpu/graphite/Recording.h
@@ -10,28 +10,38 @@
#include "include/core/SkRefCnt.h"
-class SkTextureDataBlock;
+#include <memory>
+#include <vector>
namespace skgpu::graphite {
class CommandBuffer;
-template<typename StorageT, typename BaseT> class PipelineDataCache;
-using TextureDataCache = PipelineDataCache<std::unique_ptr<SkTextureDataBlock>, SkTextureDataBlock>;
+class RecordingPriv;
+class Resource;
+class ResourceProvider;
+class TaskGraph;
class Recording final {
public:
~Recording();
-protected:
+ RecordingPriv priv();
+
private:
- friend class Context; // for access fCommandBuffer
friend class Recorder; // for ctor
- Recording(sk_sp<CommandBuffer>, std::unique_ptr<TextureDataCache>);
+ friend class RecordingPriv;
+
+ Recording(std::unique_ptr<TaskGraph>);
- sk_sp<CommandBuffer> fCommandBuffer;
+ bool addCommands(CommandBuffer*, ResourceProvider*);
+ void addResourceRef(sk_sp<Resource>);
- // The TextureDataCache holds all the Textures and Samplers used in this Recording.
- std::unique_ptr<TextureDataCache> fTextureDataCache;
+ std::unique_ptr<TaskGraph> fGraph;
+ // We don't always take refs to all resources used by specific Tasks (e.g. a common buffer used
+ // for uploads). Instead we'll just hold onto one ref for those Resources outside the Tasks.
+ // Those refs are stored in the array here and will eventually be passed onto a CommandBuffer
+ // when the Recording adds its commands.
+ std::vector<sk_sp<Resource>> fExtraResourceRefs;
};
} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/include/private/BUILD.bazel b/chromium/third_party/skia/include/private/BUILD.bazel
index aba93fcefd4..1c301bfca25 100644
--- a/chromium/third_party/skia/include/private/BUILD.bazel
+++ b/chromium/third_party/skia/include/private/BUILD.bazel
@@ -7,6 +7,23 @@ exports_files_legacy(
visibility = ["//tools/skui:__pkg__"],
)
+# In own filegroup for mapping to the //gn/sksl.gni file.
+filegroup(
+ name = "sksl_private_hdrs",
+ srcs = [
+ "SkSLDefines.h",
+ "SkSLIRNode.h",
+ "SkSLLayout.h",
+ "SkSLModifiers.h",
+ "SkSLProgramElement.h",
+ "SkSLProgramKind.h",
+ "SkSLSampleUsage.h",
+ "SkSLStatement.h",
+ "SkSLString.h",
+ "SkSLSymbol.h",
+ ],
+)
+
filegroup(
name = "private_hdrs",
srcs = [
@@ -29,16 +46,6 @@ filegroup(
"SkOnce.h",
"SkOpts_spi.h",
"SkPathRef.h",
- "SkSLDefines.h",
- "SkSLIRNode.h",
- "SkSLLayout.h",
- "SkSLModifiers.h",
- "SkSLProgramElement.h",
- "SkSLProgramKind.h",
- "SkSLSampleUsage.h",
- "SkSLStatement.h",
- "SkSLString.h",
- "SkSLSymbol.h",
"SkSafe32.h",
"SkSafe_math.h",
"SkSemaphore.h",
@@ -58,9 +65,10 @@ filegroup(
"SkUniquePaintParamsID.h",
"SkVx.h",
"SkWeakRefCnt.h",
+ ":sksl_private_hdrs",
"//include/private/chromium:private_hdrs",
] + select({
- "//bazel/common_config_settings:has_gpu_backend": [
+ "//src/gpu:has_gpu_backend": [
"//include/private/gpu:private_hdrs",
],
"//conditions:default": [],
diff --git a/chromium/third_party/skia/include/private/SkColorData.h b/chromium/third_party/skia/include/private/SkColorData.h
index 1df1fbd0957..2b27785fb64 100644
--- a/chromium/third_party/skia/include/private/SkColorData.h
+++ b/chromium/third_party/skia/include/private/SkColorData.h
@@ -413,7 +413,9 @@ static inline skvx::float4 Sk4f_fromL32(uint32_t px) {
static inline uint32_t Sk4f_toL32(const skvx::float4& px) {
uint32_t l32;
- skvx::cast<uint8_t>(pin(lrint(px * 255.f), skvx::int4(0), skvx::int4(255))).store(&l32);
+ // For the expected positive color values, the +0.5 before the pin and cast effectively rounds
+ // to the nearest int without having to call round() or lrint().
+ skvx::cast<uint8_t>(pin(px * 255.f + 0.5f, skvx::float4(0.f), skvx::float4(255.f))).store(&l32);
return l32;
}
diff --git a/chromium/third_party/skia/include/private/SkEncodedInfo.h b/chromium/third_party/skia/include/private/SkEncodedInfo.h
index e4806d3b384..74e2ad1480c 100644
--- a/chromium/third_party/skia/include/private/SkEncodedInfo.h
+++ b/chromium/third_party/skia/include/private/SkEncodedInfo.h
@@ -8,12 +8,18 @@
#ifndef SkEncodedInfo_DEFINED
#define SkEncodedInfo_DEFINED
-#include <memory>
-
+#include "include/core/SkAlphaType.h"
#include "include/core/SkColorSpace.h"
+#include "include/core/SkColorType.h"
#include "include/core/SkData.h"
#include "include/core/SkImageInfo.h"
-#include "include/third_party/skcms/skcms.h"
+#include "include/core/SkRefCnt.h"
+#include "include/core/SkTypes.h"
+#include "modules/skcms/skcms.h"
+
+#include <cstdint>
+#include <memory>
+#include <utility>
struct SkEncodedInfo {
public:
diff --git a/chromium/third_party/skia/include/private/SkMacros.h b/chromium/third_party/skia/include/private/SkMacros.h
index 02503792056..308c5d05fd4 100644
--- a/chromium/third_party/skia/include/private/SkMacros.h
+++ b/chromium/third_party/skia/include/private/SkMacros.h
@@ -30,7 +30,7 @@
////////////////////////////////////////////////////////////////////////////////
-// Can be used to bracket data types that must be dense, e.g. hash keys.
+// Can be used to bracket data types that must be dense/packed, e.g. hash keys.
#if defined(__clang__) // This should work on GCC too, but GCC diagnostic pop didn't seem to work!
#define SK_BEGIN_REQUIRE_DENSE _Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic error \"-Wpadded\"")
diff --git a/chromium/third_party/skia/include/private/SkMalloc.h b/chromium/third_party/skia/include/private/SkMalloc.h
index 033294cf81e..206bf14e2f8 100644
--- a/chromium/third_party/skia/include/private/SkMalloc.h
+++ b/chromium/third_party/skia/include/private/SkMalloc.h
@@ -78,6 +78,10 @@ SK_API extern void* sk_calloc_throw(size_t count, size_t elemSize);
SK_API extern void* sk_malloc_throw(size_t count, size_t elemSize);
SK_API extern void* sk_realloc_throw(void* buffer, size_t count, size_t elemSize);
+// Returns the true usable size provided by the underlying allocator, or 0 if
+// querying the allocation size is not supported.
+SK_API extern size_t sk_malloc_usable_size(void* buffer);
+
/**
* These variants return nullptr on failure
*/
diff --git a/chromium/third_party/skia/include/private/SkSLModifiers.h b/chromium/third_party/skia/include/private/SkSLModifiers.h
index a3734a44ee1..9d970e79ac8 100644
--- a/chromium/third_party/skia/include/private/SkSLModifiers.h
+++ b/chromium/third_party/skia/include/private/SkSLModifiers.h
@@ -46,11 +46,16 @@ struct Modifiers {
kHighp_Flag = 1 << 6,
kMediump_Flag = 1 << 7,
kLowp_Flag = 1 << 8,
+ kReadOnly_Flag = 1 << 9,
+ kWriteOnly_Flag = 1 << 10,
+ kBuffer_Flag = 1 << 11,
+ // We use the Metal name for this one (corresponds to the GLSL 'shared' modifier)
+ kThreadgroup_Flag = 1 << 12,
// SkSL extensions, not present in GLSL
- kES3_Flag = 1 << 9,
- kHasSideEffects_Flag = 1 << 10,
- kInline_Flag = 1 << 11,
- kNoInline_Flag = 1 << 12,
+ kES3_Flag = 1 << 13,
+ kHasSideEffects_Flag = 1 << 14,
+ kInline_Flag = 1 << 15,
+ kNoInline_Flag = 1 << 16,
};
Modifiers()
@@ -104,6 +109,20 @@ struct Modifiers {
if (fFlags & kLowp_Flag) {
result += "lowp ";
}
+ if (fFlags & kReadOnly_Flag) {
+ result += "readonly ";
+ }
+ if (fFlags & kWriteOnly_Flag) {
+ result += "writeonly ";
+ }
+ if (fFlags & kBuffer_Flag) {
+ result += "buffer ";
+ }
+
+ // We're using a non-GLSL name for this one; the GLSL equivalent is "shared"
+ if (fFlags & kThreadgroup_Flag) {
+ result += "threadgroup ";
+ }
return result;
}
@@ -120,8 +139,10 @@ struct Modifiers {
* Verifies that only permitted modifiers and layout flags are included. Reports errors and
* returns false in the event of a violation.
*/
- bool checkPermitted(const Context& context, Position pos, int permittedModifierFlags,
- int permittedLayoutFlags) const;
+ bool checkPermitted(const Context& context,
+ Position pos,
+ int permittedModifierFlags,
+ int permittedLayoutFlags) const;
Layout fLayout;
int fFlags;
diff --git a/chromium/third_party/skia/include/private/SkSLProgramKind.h b/chromium/third_party/skia/include/private/SkSLProgramKind.h
index 56f522947fb..c240cb7376e 100644
--- a/chromium/third_party/skia/include/private/SkSLProgramKind.h
+++ b/chromium/third_party/skia/include/private/SkSLProgramKind.h
@@ -18,6 +18,7 @@ namespace SkSL {
enum class ProgramKind : int8_t {
kFragment,
kVertex,
+ kCompute,
kGraphiteFragment,
kGraphiteVertex,
kRuntimeColorFilter, // Runtime effect only suitable as SkColorFilter
diff --git a/chromium/third_party/skia/include/private/SkSLSymbol.h b/chromium/third_party/skia/include/private/SkSLSymbol.h
index ecabf2b5c43..b85fe3938fb 100644
--- a/chromium/third_party/skia/include/private/SkSLSymbol.h
+++ b/chromium/third_party/skia/include/private/SkSLSymbol.h
@@ -23,7 +23,6 @@ public:
kField,
kFunctionDeclaration,
kType,
- kUnresolvedFunction,
kVariable,
kFirst = kExternal,
diff --git a/chromium/third_party/skia/include/private/SkTDArray.h b/chromium/third_party/skia/include/private/SkTDArray.h
index d06b46f72d7..f2e249b6baf 100644
--- a/chromium/third_party/skia/include/private/SkTDArray.h
+++ b/chromium/third_party/skia/include/private/SkTDArray.h
@@ -107,6 +107,8 @@ public:
*/
size_t bytes() const { return fCount * sizeof(T); }
+ T* data() { return fArray; }
+ const T* data() const { return fArray; }
T* begin() { return fArray; }
const T* begin() const { return fArray; }
T* end() { return fArray ? fArray + fCount : nullptr; }
diff --git a/chromium/third_party/skia/include/private/SkVx.h b/chromium/third_party/skia/include/private/SkVx.h
index 1241dd4c593..74cdabffe2d 100644
--- a/chromium/third_party/skia/include/private/SkVx.h
+++ b/chromium/third_party/skia/include/private/SkVx.h
@@ -195,21 +195,14 @@ struct Vec<1,T> {
}
};
-// Ideally we'd only use bit_pun(), but until this file is always built as C++17 with constexpr if,
-// we'll sometimes find need to use unchecked_bit_pun(). Please do check the call sites yourself!
template <typename D, typename S>
-SI D unchecked_bit_pun(const S& s) {
+SI D bit_pun(const S& s) {
+ static_assert(sizeof(D) == sizeof(S));
D d;
memcpy(&d, &s, sizeof(D));
return d;
}
-template <typename D, typename S>
-SI D bit_pun(const S& s) {
- static_assert(sizeof(D) == sizeof(S), "");
- return unchecked_bit_pun<D>(s);
-}
-
// Translate from a value type T to its corresponding Mask, the result of a comparison.
template <typename T> struct Mask { using type = T; };
template <> struct Mask<float > { using type = int32_t; };
@@ -463,23 +456,23 @@ SINT Vec<N,T> if_then_else(const Vec<N,M<T>>& cond, const Vec<N,T>& t, const Vec
// Specializations inline here so they can generalize what types the apply to.
#if SKVX_USE_SIMD && defined(__AVX2__)
if constexpr (N*sizeof(T) == 32) {
- return unchecked_bit_pun<Vec<N,T>>(_mm256_blendv_epi8(unchecked_bit_pun<__m256i>(e),
- unchecked_bit_pun<__m256i>(t),
- unchecked_bit_pun<__m256i>(cond)));
+ return bit_pun<Vec<N,T>>(_mm256_blendv_epi8(bit_pun<__m256i>(e),
+ bit_pun<__m256i>(t),
+ bit_pun<__m256i>(cond)));
}
#endif
#if SKVX_USE_SIMD && defined(__SSE4_1__)
if constexpr (N*sizeof(T) == 16) {
- return unchecked_bit_pun<Vec<N,T>>(_mm_blendv_epi8(unchecked_bit_pun<__m128i>(e),
- unchecked_bit_pun<__m128i>(t),
- unchecked_bit_pun<__m128i>(cond)));
+ return bit_pun<Vec<N,T>>(_mm_blendv_epi8(bit_pun<__m128i>(e),
+ bit_pun<__m128i>(t),
+ bit_pun<__m128i>(cond)));
}
#endif
#if SKVX_USE_SIMD && defined(__ARM_NEON)
if constexpr (N*sizeof(T) == 16) {
- return unchecked_bit_pun<Vec<N,T>>(vbslq_u8(unchecked_bit_pun<uint8x16_t>(cond),
- unchecked_bit_pun<uint8x16_t>(t),
- unchecked_bit_pun<uint8x16_t>(e)));
+ return bit_pun<Vec<N,T>>(vbslq_u8(bit_pun<uint8x16_t>(cond),
+ bit_pun<uint8x16_t>(t),
+ bit_pun<uint8x16_t>(e)));
}
#endif
// Recurse for large vectors to try to hit the specializations above.
@@ -497,12 +490,12 @@ SINT bool any(const Vec<N,T>& x) {
// lower latency compared to _mm_movemask + _mm_compneq on plain SSE.
#if SKVX_USE_SIMD && defined(__AVX2__)
if constexpr (N*sizeof(T) == 32) {
- return !_mm256_testz_si256(unchecked_bit_pun<__m256i>(x), _mm256_set1_epi32(-1));
+ return !_mm256_testz_si256(bit_pun<__m256i>(x), _mm256_set1_epi32(-1));
}
#endif
#if SKVX_USE_SIMD && defined(__SSE_4_1__)
if constexpr (N*sizeof(T) == 16) {
- return !_mm_testz_si128(unchecked_bit_pun<__m128i>(x), _mm_set1_epi32(-1));
+ return !_mm_testz_si128(bit_pun<__m128i>(x), _mm_set1_epi32(-1));
}
#endif
#if SKVX_USE_SIMD && defined(__SSE__)
@@ -510,20 +503,19 @@ SINT bool any(const Vec<N,T>& x) {
// On SSE, movemask checks only the MSB in each lane, which is fine if the lanes were set
// directly from a comparison op (which sets all bits to 1 when true), but skvx::Vec<>
// treats any non-zero value as true, so we have to compare 'x' to 0 before calling movemask
- return _mm_movemask_ps(_mm_cmpneq_ps(unchecked_bit_pun<__m128>(x),
- _mm_set1_ps(0))) != 0b0000;
+ return _mm_movemask_ps(_mm_cmpneq_ps(bit_pun<__m128>(x), _mm_set1_ps(0))) != 0b0000;
}
#endif
#if SKVX_USE_SIMD && defined(__aarch64__)
// On 64-bit NEON, take the max across lanes, which will be non-zero if any lane was true.
// The specific lane-size doesn't really matter in this case since it's really any set bit
// that we're looking for.
- if constexpr (N*sizeof(T) == 8 ) { return vmaxv_u8 (unchecked_bit_pun<uint8x8_t> (x)) > 0; }
- if constexpr (N*sizeof(T) == 16) { return vmaxvq_u8(unchecked_bit_pun<uint8x16_t>(x)) > 0; }
+ if constexpr (N*sizeof(T) == 8 ) { return vmaxv_u8 (bit_pun<uint8x8_t> (x)) > 0; }
+ if constexpr (N*sizeof(T) == 16) { return vmaxvq_u8(bit_pun<uint8x16_t>(x)) > 0; }
#endif
#if SKVX_USE_SIMD && defined(__wasm_simd128__)
if constexpr (N == 4 && sizeof(T) == 4) {
- return wasm_i32x4_any_true(unchecked_bit_pun<VExt<4,int>>(x));
+ return wasm_i32x4_any_true(bit_pun<VExt<4,int>>(x));
}
#endif
return any(x.lo)
@@ -538,22 +530,21 @@ SINT bool all(const Vec<N,T>& x) {
// Unfortunately, the _mm_testc intrinsics don't let us avoid the comparison to 0 for all()'s
// correctness, so always just use the plain SSE version.
if constexpr (N == 4 && sizeof(T) == 4) {
- return _mm_movemask_ps(_mm_cmpneq_ps(unchecked_bit_pun<__m128>(x),
- _mm_set1_ps(0))) == 0b1111;
+ return _mm_movemask_ps(_mm_cmpneq_ps(bit_pun<__m128>(x), _mm_set1_ps(0))) == 0b1111;
}
#endif
#if SKVX_USE_SIMD && defined(__aarch64__)
// On 64-bit NEON, take the min across the lanes, which will be non-zero if all lanes are != 0.
- if constexpr (sizeof(T)==1 && N==8) {return vminv_u8 (unchecked_bit_pun<uint8x8_t> (x)) > 0;}
- if constexpr (sizeof(T)==1 && N==16) {return vminvq_u8 (unchecked_bit_pun<uint8x16_t>(x)) > 0;}
- if constexpr (sizeof(T)==2 && N==4) {return vminv_u16 (unchecked_bit_pun<uint16x4_t>(x)) > 0;}
- if constexpr (sizeof(T)==2 && N==8) {return vminvq_u16(unchecked_bit_pun<uint16x8_t>(x)) > 0;}
- if constexpr (sizeof(T)==4 && N==2) {return vminv_u32 (unchecked_bit_pun<uint32x2_t>(x)) > 0;}
- if constexpr (sizeof(T)==4 && N==4) {return vminvq_u32(unchecked_bit_pun<uint32x4_t>(x)) > 0;}
+ if constexpr (sizeof(T)==1 && N==8) {return vminv_u8 (bit_pun<uint8x8_t> (x)) > 0;}
+ if constexpr (sizeof(T)==1 && N==16) {return vminvq_u8 (bit_pun<uint8x16_t>(x)) > 0;}
+ if constexpr (sizeof(T)==2 && N==4) {return vminv_u16 (bit_pun<uint16x4_t>(x)) > 0;}
+ if constexpr (sizeof(T)==2 && N==8) {return vminvq_u16(bit_pun<uint16x8_t>(x)) > 0;}
+ if constexpr (sizeof(T)==4 && N==2) {return vminv_u32 (bit_pun<uint32x2_t>(x)) > 0;}
+ if constexpr (sizeof(T)==4 && N==4) {return vminvq_u32(bit_pun<uint32x4_t>(x)) > 0;}
#endif
#if SKVX_USE_SIMD && defined(__wasm_simd128__)
if constexpr (N == 4 && sizeof(T) == 4) {
- return wasm_i32x4_all_true(unchecked_bit_pun<VExt<4,int>>(x));
+ return wasm_i32x4_all_true(bit_pun<VExt<4,int>>(x));
}
#endif
return all(x.lo)
@@ -657,12 +648,12 @@ SI Vec<1,int> lrint(const Vec<1,float>& x) {
SIN Vec<N,int> lrint(const Vec<N,float>& x) {
#if SKVX_USE_SIMD && defined(__AVX__)
if constexpr (N == 8) {
- return unchecked_bit_pun<Vec<N,int>>(_mm256_cvtps_epi32(unchecked_bit_pun<__m256>(x)));
+ return bit_pun<Vec<N,int>>(_mm256_cvtps_epi32(bit_pun<__m256>(x)));
}
#endif
#if SKVX_USE_SIMD && defined(__SSE__)
if constexpr (N == 4) {
- return unchecked_bit_pun<Vec<N,int>>(_mm_cvtps_epi32(unchecked_bit_pun<__m128>(x)));
+ return bit_pun<Vec<N,int>>(_mm_cvtps_epi32(bit_pun<__m128>(x)));
}
#endif
return join(lrint(x.lo),
@@ -699,13 +690,13 @@ SI Vec<1,float> from_half(const Vec<1,uint16_t>& x) { return from_half_finite_f
SIN Vec<N,uint16_t> to_half(const Vec<N,float>& x) {
#if SKVX_USE_SIMD && defined(__F16C__)
if constexpr (N == 8) {
- return unchecked_bit_pun<Vec<N,uint16_t>>(_mm256_cvtps_ph(unchecked_bit_pun<__m256>(x),
- _MM_FROUND_CUR_DIRECTION));
+ return bit_pun<Vec<N,uint16_t>>(_mm256_cvtps_ph(bit_pun<__m256>(x),
+ _MM_FROUND_TO_NEAREST_INT));
}
#endif
#if SKVX_USE_SIMD && defined(__aarch64__)
if constexpr (N == 4) {
- return unchecked_bit_pun<Vec<N,uint16_t>>(vcvt_f16_f32(unchecked_bit_pun<float32x4_t>(x)));
+ return bit_pun<Vec<N,uint16_t>>(vcvt_f16_f32(bit_pun<float32x4_t>(x)));
}
#endif
@@ -719,12 +710,12 @@ SIN Vec<N,uint16_t> to_half(const Vec<N,float>& x) {
SIN Vec<N,float> from_half(const Vec<N,uint16_t>& x) {
#if SKVX_USE_SIMD && defined(__F16C__)
if constexpr (N == 8) {
- return unchecked_bit_pun<Vec<N,float>>(_mm256_cvtph_ps(unchecked_bit_pun<__m128i>(x)));
+ return bit_pun<Vec<N,float>>(_mm256_cvtph_ps(bit_pun<__m128i>(x)));
}
#endif
#if SKVX_USE_SIMD && defined(__aarch64__)
if constexpr (N == 4) {
- return unchecked_bit_pun<Vec<N,float>>(vcvt_f32_f16(unchecked_bit_pun<float16x4_t>(x)));
+ return bit_pun<Vec<N,float>>(vcvt_f32_f16(bit_pun<float16x4_t>(x)));
}
#endif
if constexpr (N > 4) {
@@ -757,11 +748,9 @@ SINT std::enable_if_t<std::is_unsigned_v<T>, Vec<N,T>> saturated_add(const Vec<N
// or join up to take advantage.
if constexpr (N == 16 && sizeof(T) == 1) {
#if defined(__SSE__)
- return unchecked_bit_pun<Vec<N,T>>(_mm_adds_epu8(unchecked_bit_pun<__m128i>(x),
- unchecked_bit_pun<__m128i>(y)));
- #else // __ARM_NEON
- return unchecked_bit_pun<Vec<N,T>>(vqaddq_u8(unchecked_bit_pun<uint8x16_t>(x),
- unchecked_bit_pun<uint8x16_t>(y)));
+ return bit_pun<Vec<N,T>>(_mm_adds_epu8(bit_pun<__m128i>(x), bit_pun<__m128i>(y)));
+ #else // __ARM_NEON
+ return bit_pun<Vec<N,T>>(vqaddq_u8(bit_pun<uint8x16_t>(x), bit_pun<uint8x16_t>(y)));
#endif
} else if constexpr (N < 16 && sizeof(T) == 1) {
return saturated_add(join(x,x), join(y,y)).lo;
@@ -818,61 +807,54 @@ private:
const uint32_t fHalf;
};
-#if SKVX_USE_SIMD && defined(__ARM_NEON)
-// With NEON we can do eight u8*u8 -> u16 in one instruction, vmull_u8 (read, mul-long).
-SI Vec<8,uint16_t> mull(const Vec<8,uint8_t>& x,
- const Vec<8,uint8_t>& y) {
- return to_vec<8,uint16_t>(vmull_u8(to_vext(x),
- to_vext(y)));
-}
-
-SIN std::enable_if_t<(N < 8), Vec<N,uint16_t>> mull(const Vec<N,uint8_t>& x,
- const Vec<N,uint8_t>& y) {
- // N < 8 --> double up data until N == 8, returning the part we need.
- return mull(join(x,x),
- join(y,y)).lo;
-}
-
-SIN std::enable_if_t<(N > 8), Vec<N,uint16_t>> mull(const Vec<N,uint8_t>& x,
- const Vec<N,uint8_t>& y) {
- // N > 8 --> usual join(lo,hi) strategy to recurse down to N == 8.
- return join(mull(x.lo, y.lo),
- mull(x.hi, y.hi));
-}
-
-// Or do four u16*u16 -> u32 in one instruction, vmull_u16
-SI Vec<4,uint32_t> mull(const Vec<4,uint16_t>& x,
- const Vec<4,uint16_t>& y) {
- return to_vec<4,uint32_t>(vmull_u16(to_vext(x),
- to_vext(y)));
-}
-
-SIN std::enable_if_t<(N < 4), Vec<N,uint32_t>> mull(const Vec<N,uint16_t>& x,
- const Vec<N,uint16_t>& y) {
- // N < 4 --> double up data until N == 4, returning the part we need.
- return mull(join(x,x),
- join(y,y)).lo;
-}
-
-SIN std::enable_if_t<(N > 4), Vec<N,uint32_t>> mull(const Vec<N,uint16_t>& x,
- const Vec<N,uint16_t>& y) {
- // N > 4 --> usual join(lo,hi) strategy to recurse down to N == 4.
- return join(mull(x.lo, y.lo),
- mull(x.hi, y.hi));
-}
-
-#else
-// Nothing special when we don't have NEON... just cast up and multiply.
SIN Vec<N,uint16_t> mull(const Vec<N,uint8_t>& x,
const Vec<N,uint8_t>& y) {
+#if SKVX_USE_SIMD && defined(__ARM_NEON)
+ // With NEON we can do eight u8*u8 -> u16 in one instruction, vmull_u8 (read, mul-long).
+ if constexpr (N == 8) {
+ return to_vec<8,uint16_t>(vmull_u8(to_vext(x), to_vext(y)));
+ } else if constexpr (N < 8) {
+ return mull(join(x,x), join(y,y)).lo;
+ } else { // N > 8
+ return join(mull(x.lo, y.lo), mull(x.hi, y.hi));
+ }
+#else
return cast<uint16_t>(x) * cast<uint16_t>(y);
+#endif
}
+
SIN Vec<N,uint32_t> mull(const Vec<N,uint16_t>& x,
const Vec<N,uint16_t>& y) {
+#if SKVX_USE_SIMD && defined(__ARM_NEON)
+ // NEON can do four u16*u16 -> u32 in one instruction, vmull_u16
+ if constexpr (N == 4) {
+ return to_vec<4,uint32_t>(vmull_u16(to_vext(x), to_vext(y)));
+ } else if constexpr (N < 4) {
+ return mull(join(x,x), join(y,y)).lo;
+ } else { // N > 4
+ return join(mull(x.lo, y.lo), mull(x.hi, y.hi));
+ }
+#else
return cast<uint32_t>(x) * cast<uint32_t>(y);
+#endif
}
+
+SIN Vec<N,uint16_t> mulhi(const Vec<N,uint16_t>& x,
+ const Vec<N,uint16_t>& y) {
+#if SKVX_USE_SIMD && defined(__SSE__)
+ // Use _mm_mulhi_epu16 for 8xuint16_t and join or split to get there.
+ if constexpr (N == 8) {
+ return bit_pun<Vec<8,uint16_t>>(_mm_mulhi_epu16(bit_pun<__m128i>(x), bit_pun<__m128i>(y)));
+ } else if constexpr (N < 8) {
+ return mulhi(join(x,x), join(y,y)).lo;
+ } else { // N > 8
+ return join(mulhi(x.lo, y.lo), mulhi(x.hi, y.hi));
+ }
+#else
+ return skvx::cast<uint16_t>(mull(x, y) >> 16);
#endif
+}
SINT T dot(const Vec<N, T>& a, const Vec<N, T>& b) {
auto ab = a*b;
diff --git a/chromium/third_party/skia/include/private/chromium/SkChromeRemoteGlyphCache.h b/chromium/third_party/skia/include/private/chromium/SkChromeRemoteGlyphCache.h
index a80ca81c762..9f08656d195 100644
--- a/chromium/third_party/skia/include/private/chromium/SkChromeRemoteGlyphCache.h
+++ b/chromium/third_party/skia/include/private/chromium/SkChromeRemoteGlyphCache.h
@@ -107,6 +107,8 @@ public:
// successful, subsequent attempts to delete the same handle are invalid.
virtual bool deleteHandle(SkDiscardableHandleId) = 0;
+ virtual void assertHandleValid(SkDiscardableHandleId) {}
+
virtual void notifyCacheMiss(CacheMissType type, int fontSize) = 0;
struct ReadFailureData {
diff --git a/chromium/third_party/skia/include/private/gpu/ganesh/BUILD.bazel b/chromium/third_party/skia/include/private/gpu/ganesh/BUILD.bazel
index 7093b6ca805..73a93743687 100644
--- a/chromium/third_party/skia/include/private/gpu/ganesh/BUILD.bazel
+++ b/chromium/third_party/skia/include/private/gpu/ganesh/BUILD.bazel
@@ -13,12 +13,11 @@ filegroup(
"GrTypesPriv.h",
] + select_multi(
{
- "//bazel/common_config_settings:dawn_backend": ["GrDawnTypesPriv.h"],
- "//bazel/common_config_settings:gl_backend": ["GrGLTypesPriv.h"],
- "//bazel/common_config_settings:vulkan_backend": ["GrVkTypesPriv.h"],
+ "//src/gpu:dawn_backend": ["GrDawnTypesPriv.h"],
+ "//src/gpu:gl_backend": ["GrGLTypesPriv.h"],
+ "//src/gpu:vulkan_backend": ["GrVkTypesPriv.h"],
# TODO(kjlubick) Direct3D and Metal Backends
},
- default = [],
),
visibility = ["//include/private/gpu:__pkg__"],
)
diff --git a/chromium/third_party/skia/include/private/gpu/ganesh/GrTypesPriv.h b/chromium/third_party/skia/include/private/gpu/ganesh/GrTypesPriv.h
index 6f0669e5570..ac506ae5fd0 100644
--- a/chromium/third_party/skia/include/private/gpu/ganesh/GrTypesPriv.h
+++ b/chromium/third_party/skia/include/private/gpu/ganesh/GrTypesPriv.h
@@ -410,7 +410,7 @@ enum class GrGpuBufferType {
kXferGpuToCpu,
kUniform,
};
-static const int kGrGpuBufferTypeCount = static_cast<int>(GrGpuBufferType::kUniform) + 1;
+static const constexpr int kGrGpuBufferTypeCount = static_cast<int>(GrGpuBufferType::kUniform) + 1;
/**
* Provides a performance hint regarding the frequency at which a data store will be accessed.
diff --git a/chromium/third_party/skia/include/sksl/DSLSymbols.h b/chromium/third_party/skia/include/sksl/DSLSymbols.h
index 34117b5bca4..fc9009110d1 100644
--- a/chromium/third_party/skia/include/sksl/DSLSymbols.h
+++ b/chromium/third_party/skia/include/sksl/DSLSymbols.h
@@ -50,16 +50,6 @@ std::shared_ptr<SymbolTable> CurrentSymbolTable();
DSLExpression Symbol(std::string_view name, Position pos = {});
/**
- * Returns true if the name refers to a type (user or built-in) in the current symbol table.
- */
-bool IsType(std::string_view name);
-
-/**
- * Returns true if the name refers to a builtin type.
- */
-bool IsBuiltinType(std::string_view name);
-
-/**
* Adds a variable to the current symbol table.
*/
void AddToSymbolTable(DSLVarBase& var, Position pos = {});
diff --git a/chromium/third_party/skia/include/sksl/DSLType.h b/chromium/third_party/skia/include/sksl/DSLType.h
index 972997522b6..d15e01b3a3e 100644
--- a/chromium/third_party/skia/include/sksl/DSLType.h
+++ b/chromium/third_party/skia/include/sksl/DSLType.h
@@ -14,6 +14,7 @@
#include "include/sksl/DSLModifiers.h"
#include "include/sksl/SkSLPosition.h"
+#include <cstdint>
#include <string_view>
#include <utility>
@@ -160,13 +161,13 @@ public:
template<typename... Args>
static DSLExpression Construct(DSLType type, DSLVarBase& var, Args&&... args) {
DSLExpression argArray[] = {var, args...};
- return Construct(type, SkMakeSpan(argArray));
+ return Construct(type, SkSpan(argArray));
}
template<typename... Args>
static DSLExpression Construct(DSLType type, DSLExpression expr, Args&&... args) {
DSLExpression argArray[] = {std::move(expr), std::move(args)...};
- return Construct(type, SkMakeSpan(argArray));
+ return Construct(type, SkSpan(argArray));
}
static DSLExpression Construct(DSLType type, SkSpan<DSLExpression> argArray);
@@ -260,7 +261,7 @@ DSLType Struct(std::string_view name, SkSpan<DSLField> fields,
template<typename... Field>
DSLType Struct(std::string_view name, Field... fields) {
DSLField fieldTypes[] = {std::move(fields)...};
- return Struct(name, SkMakeSpan(fieldTypes), Position());
+ return Struct(name, SkSpan(fieldTypes), Position());
}
} // namespace dsl
diff --git a/chromium/third_party/skia/include/sksl/DSLVar.h b/chromium/third_party/skia/include/sksl/DSLVar.h
index 98d6ef7c661..20f957133b6 100644
--- a/chromium/third_party/skia/include/sksl/DSLVar.h
+++ b/chromium/third_party/skia/include/sksl/DSLVar.h
@@ -14,7 +14,7 @@
#include "include/sksl/DSLType.h"
#include "include/sksl/SkSLPosition.h"
-#include <stdint.h>
+#include <cstdint>
#include <memory>
#include <string_view>
#include <utility>
diff --git a/chromium/third_party/skia/include/sksl/SkSLPosition.h b/chromium/third_party/skia/include/sksl/SkSLPosition.h
index 0ef0332229d..5f8e80a607b 100644
--- a/chromium/third_party/skia/include/sksl/SkSLPosition.h
+++ b/chromium/third_party/skia/include/sksl/SkSLPosition.h
@@ -9,6 +9,8 @@
#define SKSL_POSITION
#include "include/core/SkTypes.h"
+
+#include <cstdint>
#include <string_view>
namespace SkSL {
diff --git a/chromium/third_party/skia/include/svg/SkSVGCanvas.h b/chromium/third_party/skia/include/svg/SkSVGCanvas.h
index cb36cd9113e..d4c38ea0177 100644
--- a/chromium/third_party/skia/include/svg/SkSVGCanvas.h
+++ b/chromium/third_party/skia/include/svg/SkSVGCanvas.h
@@ -10,6 +10,7 @@
#include "include/core/SkTypes.h"
+#include <cstdint>
#include <memory>
class SkCanvas;
diff --git a/chromium/third_party/skia/include/third_party/skcms/BUILD.bazel b/chromium/third_party/skia/include/third_party/skcms/BUILD.bazel
index 8ce408d224e..f85944fa5e4 100644
--- a/chromium/third_party/skia/include/third_party/skcms/BUILD.bazel
+++ b/chromium/third_party/skia/include/third_party/skcms/BUILD.bazel
@@ -4,13 +4,5 @@ licenses(["notice"])
exports_files_legacy(
label_list = ["skcms.h"],
- visibility = ["//third_party/skcms:__pkg__"],
-)
-
-filegroup(
- name = "public_hdrs",
- srcs = [
- "skcms.h",
- ],
- visibility = ["//include:__pkg__"],
+ visibility = ["//modules/skcms:__pkg__"],
)
diff --git a/chromium/third_party/skia/include/third_party/skcms/skcms.h b/chromium/third_party/skia/include/third_party/skcms/skcms.h
index 3e02d954888..6e1310e975c 100644
--- a/chromium/third_party/skia/include/third_party/skcms/skcms.h
+++ b/chromium/third_party/skia/include/third_party/skcms/skcms.h
@@ -7,388 +7,5 @@
#pragma once
-// skcms.h contains the entire public API for skcms.
-
-#ifndef SKCMS_API
- #define SKCMS_API
-#endif
-
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <string.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// A row-major 3x3 matrix (ie vals[row][col])
-typedef struct skcms_Matrix3x3 {
- float vals[3][3];
-} skcms_Matrix3x3;
-
-// It is _not_ safe to alias the pointers to invert in-place.
-SKCMS_API bool skcms_Matrix3x3_invert(const skcms_Matrix3x3*, skcms_Matrix3x3*);
-SKCMS_API skcms_Matrix3x3 skcms_Matrix3x3_concat(const skcms_Matrix3x3*, const skcms_Matrix3x3*);
-
-// A row-major 3x4 matrix (ie vals[row][col])
-typedef struct skcms_Matrix3x4 {
- float vals[3][4];
-} skcms_Matrix3x4;
-
-// A transfer function mapping encoded values to linear values,
-// represented by this 7-parameter piecewise function:
-//
-// linear = sign(encoded) * (c*|encoded| + f) , 0 <= |encoded| < d
-// = sign(encoded) * ((a*|encoded| + b)^g + e), d <= |encoded|
-//
-// (A simple gamma transfer function sets g to gamma and a to 1.)
-typedef struct skcms_TransferFunction {
- float g, a,b,c,d,e,f;
-} skcms_TransferFunction;
-
-SKCMS_API float skcms_TransferFunction_eval (const skcms_TransferFunction*, float);
-SKCMS_API bool skcms_TransferFunction_invert(const skcms_TransferFunction*,
- skcms_TransferFunction*);
-
-// We can jam a couple alternate transfer function forms into skcms_TransferFunction,
-// including those matching the general forms of the SMPTE ST 2084 PQ function or HLG.
-//
-// PQish:
-// max(A + B|encoded|^C, 0)
-// linear = sign(encoded) * (------------------------) ^ F
-// D + E|encoded|^C
-SKCMS_API bool skcms_TransferFunction_makePQish(skcms_TransferFunction*,
- float A, float B, float C,
- float D, float E, float F);
-// HLGish:
-// { K * sign(encoded) * ( (R|encoded|)^G ) when 0 <= |encoded| <= 1/R
-// linear = { K * sign(encoded) * ( e^(a(|encoded|-c)) + b ) when 1/R < |encoded|
-SKCMS_API bool skcms_TransferFunction_makeScaledHLGish(skcms_TransferFunction*,
- float K, float R, float G,
- float a, float b, float c);
-
-// Compatibility shim with K=1 for old callers.
-static inline bool skcms_TransferFunction_makeHLGish(skcms_TransferFunction* fn,
- float R, float G,
- float a, float b, float c) {
- return skcms_TransferFunction_makeScaledHLGish(fn, 1.0f, R,G, a,b,c);
-}
-
-// PQ mapping encoded [0,1] to linear [0,1].
-static inline bool skcms_TransferFunction_makePQ(skcms_TransferFunction* tf) {
- return skcms_TransferFunction_makePQish(tf, -107/128.0f, 1.0f, 32/2523.0f
- , 2413/128.0f, -2392/128.0f, 8192/1305.0f);
-}
-// HLG mapping encoded [0,1] to linear [0,12].
-static inline bool skcms_TransferFunction_makeHLG(skcms_TransferFunction* tf) {
- return skcms_TransferFunction_makeHLGish(tf, 2.0f, 2.0f
- , 1/0.17883277f, 0.28466892f, 0.55991073f);
-}
-
-// Is this an ordinary sRGB-ish transfer function, or one of the HDR forms we support?
-SKCMS_API bool skcms_TransferFunction_isSRGBish(const skcms_TransferFunction*);
-SKCMS_API bool skcms_TransferFunction_isPQish (const skcms_TransferFunction*);
-SKCMS_API bool skcms_TransferFunction_isHLGish (const skcms_TransferFunction*);
-
-// Unified representation of 'curv' or 'para' tag data, or a 1D table from 'mft1' or 'mft2'
-typedef union skcms_Curve {
- struct {
- uint32_t alias_of_table_entries;
- skcms_TransferFunction parametric;
- };
- struct {
- uint32_t table_entries;
- const uint8_t* table_8;
- const uint8_t* table_16;
- };
-} skcms_Curve;
-
-// Complex transforms between device space (A) and profile connection space (B):
-// A2B: device -> [ "A" curves -> CLUT ] -> [ "M" curves -> matrix ] -> "B" curves -> PCS
-// B2A: device <- [ "A" curves <- CLUT ] <- [ "M" curves <- matrix ] <- "B" curves <- PCS
-
-typedef struct skcms_A2B {
- // Optional: N 1D "A" curves, followed by an N-dimensional CLUT.
- // If input_channels == 0, these curves and CLUT are skipped,
- // Otherwise, input_channels must be in [1, 4].
- uint32_t input_channels;
- skcms_Curve input_curves[4];
- uint8_t grid_points[4];
- const uint8_t* grid_8;
- const uint8_t* grid_16;
-
- // Optional: 3 1D "M" curves, followed by a color matrix.
- // If matrix_channels == 0, these curves and matrix are skipped,
- // Otherwise, matrix_channels must be 3.
- uint32_t matrix_channels;
- skcms_Curve matrix_curves[3];
- skcms_Matrix3x4 matrix;
-
- // Required: 3 1D "B" curves. Always present, and output_channels must be 3.
- uint32_t output_channels;
- skcms_Curve output_curves[3];
-} skcms_A2B;
-
-typedef struct skcms_B2A {
- // Required: 3 1D "B" curves. Always present, and input_channels must be 3.
- uint32_t input_channels;
- skcms_Curve input_curves[3];
-
- // Optional: a color matrix, followed by 3 1D "M" curves.
- // If matrix_channels == 0, this matrix and these curves are skipped,
- // Otherwise, matrix_channels must be 3.
- uint32_t matrix_channels;
- skcms_Matrix3x4 matrix;
- skcms_Curve matrix_curves[3];
-
- // Optional: an N-dimensional CLUT, followed by N 1D "A" curves.
- // If output_channels == 0, this CLUT and these curves are skipped,
- // Otherwise, output_channels must be in [1, 4].
- uint32_t output_channels;
- uint8_t grid_points[4];
- const uint8_t* grid_8;
- const uint8_t* grid_16;
- skcms_Curve output_curves[4];
-} skcms_B2A;
-
-
-typedef struct skcms_ICCProfile {
- const uint8_t* buffer;
-
- uint32_t size;
- uint32_t data_color_space;
- uint32_t pcs;
- uint32_t tag_count;
-
- // skcms_Parse() will set commonly-used fields for you when possible:
-
- // If we can parse red, green and blue transfer curves from the profile,
- // trc will be set to those three curves, and has_trc will be true.
- bool has_trc;
- skcms_Curve trc[3];
-
- // If this profile's gamut can be represented by a 3x3 transform to XYZD50,
- // skcms_Parse() sets toXYZD50 to that transform and has_toXYZD50 to true.
- bool has_toXYZD50;
- skcms_Matrix3x3 toXYZD50;
-
- // If the profile has a valid A2B0 or A2B1 tag, skcms_Parse() sets A2B to
- // that data, and has_A2B to true. skcms_ParseWithA2BPriority() does the
- // same following any user-provided prioritization of A2B0, A2B1, or A2B2.
- bool has_A2B;
- skcms_A2B A2B;
-
- // If the profile has a valid B2A0 or B2A1 tag, skcms_Parse() sets B2A to
- // that data, and has_B2A to true. skcms_ParseWithA2BPriority() does the
- // same following any user-provided prioritization of B2A0, B2A1, or B2A2.
- bool has_B2A;
- skcms_B2A B2A;
-
-} skcms_ICCProfile;
-
-// The sRGB color profile is so commonly used that we offer a canonical skcms_ICCProfile for it.
-SKCMS_API const skcms_ICCProfile* skcms_sRGB_profile(void);
-// Ditto for XYZD50, the most common profile connection space.
-SKCMS_API const skcms_ICCProfile* skcms_XYZD50_profile(void);
-
-SKCMS_API const skcms_TransferFunction* skcms_sRGB_TransferFunction(void);
-SKCMS_API const skcms_TransferFunction* skcms_sRGB_Inverse_TransferFunction(void);
-SKCMS_API const skcms_TransferFunction* skcms_Identity_TransferFunction(void);
-
-// Practical equality test for two skcms_ICCProfiles.
-// The implementation is subject to change, but it will always try to answer
-// "can I substitute A for B?" and "can I skip transforming from A to B?".
-SKCMS_API bool skcms_ApproximatelyEqualProfiles(const skcms_ICCProfile* A,
- const skcms_ICCProfile* B);
-
-// Practical test that answers: Is curve roughly the inverse of inv_tf? Typically used by passing
-// the inverse of a known parametric transfer function (like sRGB), to determine if a particular
-// curve is very close to sRGB.
-SKCMS_API bool skcms_AreApproximateInverses(const skcms_Curve* curve,
- const skcms_TransferFunction* inv_tf);
-
-// Similar to above, answering the question for all three TRC curves of the given profile. Again,
-// passing skcms_sRGB_InverseTransferFunction as inv_tf will answer the question:
-// "Does this profile have a transfer function that is very close to sRGB?"
-SKCMS_API bool skcms_TRCs_AreApproximateInverse(const skcms_ICCProfile* profile,
- const skcms_TransferFunction* inv_tf);
-
-// Parse an ICC profile and return true if possible, otherwise return false.
-// Selects an A2B profile (if present) according to priority list (each entry 0-2).
-// The buffer is not copied; it must remain valid as long as the skcms_ICCProfile will be used.
-SKCMS_API bool skcms_ParseWithA2BPriority(const void*, size_t,
- const int priority[], int priorities,
- skcms_ICCProfile*);
-
-static inline bool skcms_Parse(const void* buf, size_t len, skcms_ICCProfile* profile) {
- // For continuity of existing user expectations,
- // prefer A2B0 (perceptual) over A2B1 (relative colormetric), and ignore A2B2 (saturation).
- const int priority[] = {0,1};
- return skcms_ParseWithA2BPriority(buf, len,
- priority, sizeof(priority)/sizeof(*priority),
- profile);
-}
-
-SKCMS_API bool skcms_ApproximateCurve(const skcms_Curve* curve,
- skcms_TransferFunction* approx,
- float* max_error);
-
-SKCMS_API bool skcms_GetCHAD(const skcms_ICCProfile*, skcms_Matrix3x3*);
-SKCMS_API bool skcms_GetWTPT(const skcms_ICCProfile*, float xyz[3]);
-
-// These are common ICC signature values
-enum {
- // data_color_space
- skcms_Signature_CMYK = 0x434D594B,
- skcms_Signature_Gray = 0x47524159,
- skcms_Signature_RGB = 0x52474220,
-
- // pcs
- skcms_Signature_Lab = 0x4C616220,
- skcms_Signature_XYZ = 0x58595A20,
-};
-
-typedef enum skcms_PixelFormat {
- skcms_PixelFormat_A_8,
- skcms_PixelFormat_A_8_,
- skcms_PixelFormat_G_8,
- skcms_PixelFormat_G_8_,
- skcms_PixelFormat_RGBA_8888_Palette8,
- skcms_PixelFormat_BGRA_8888_Palette8,
-
- skcms_PixelFormat_RGB_565,
- skcms_PixelFormat_BGR_565,
-
- skcms_PixelFormat_ABGR_4444,
- skcms_PixelFormat_ARGB_4444,
-
- skcms_PixelFormat_RGB_888,
- skcms_PixelFormat_BGR_888,
- skcms_PixelFormat_RGBA_8888,
- skcms_PixelFormat_BGRA_8888,
- skcms_PixelFormat_RGBA_8888_sRGB, // Automatic sRGB encoding / decoding.
- skcms_PixelFormat_BGRA_8888_sRGB, // (Generally used with linear transfer functions.)
-
- skcms_PixelFormat_RGBA_1010102,
- skcms_PixelFormat_BGRA_1010102,
-
- skcms_PixelFormat_RGB_161616LE, // Little-endian. Pointers must be 16-bit aligned.
- skcms_PixelFormat_BGR_161616LE,
- skcms_PixelFormat_RGBA_16161616LE,
- skcms_PixelFormat_BGRA_16161616LE,
-
- skcms_PixelFormat_RGB_161616BE, // Big-endian. Pointers must be 16-bit aligned.
- skcms_PixelFormat_BGR_161616BE,
- skcms_PixelFormat_RGBA_16161616BE,
- skcms_PixelFormat_BGRA_16161616BE,
-
- skcms_PixelFormat_RGB_hhh_Norm, // 1-5-10 half-precision float in [0,1]
- skcms_PixelFormat_BGR_hhh_Norm, // Pointers must be 16-bit aligned.
- skcms_PixelFormat_RGBA_hhhh_Norm,
- skcms_PixelFormat_BGRA_hhhh_Norm,
-
- skcms_PixelFormat_RGB_hhh, // 1-5-10 half-precision float.
- skcms_PixelFormat_BGR_hhh, // Pointers must be 16-bit aligned.
- skcms_PixelFormat_RGBA_hhhh,
- skcms_PixelFormat_BGRA_hhhh,
-
- skcms_PixelFormat_RGB_fff, // 1-8-23 single-precision float (the normal kind).
- skcms_PixelFormat_BGR_fff, // Pointers must be 32-bit aligned.
- skcms_PixelFormat_RGBA_ffff,
- skcms_PixelFormat_BGRA_ffff,
-} skcms_PixelFormat;
-
-// We always store any alpha channel linearly. In the chart below, tf-1() is the inverse
-// transfer function for the given color profile (applying the transfer function linearizes).
-
-// We treat opaque as a strong requirement, not just a performance hint: we will ignore
-// any source alpha and treat it as 1.0, and will make sure that any destination alpha
-// channel is filled with the equivalent of 1.0.
-
-// We used to offer multiple types of premultiplication, but now just one, PremulAsEncoded.
-// This is the premul you're probably used to working with.
-
-typedef enum skcms_AlphaFormat {
- skcms_AlphaFormat_Opaque, // alpha is always opaque
- // tf-1(r), tf-1(g), tf-1(b), 1.0
- skcms_AlphaFormat_Unpremul, // alpha and color are unassociated
- // tf-1(r), tf-1(g), tf-1(b), a
- skcms_AlphaFormat_PremulAsEncoded, // premultiplied while encoded
- // tf-1(r)*a, tf-1(g)*a, tf-1(b)*a, a
-} skcms_AlphaFormat;
-
-// Convert npixels pixels from src format and color profile to dst format and color profile
-// and return true, otherwise return false. It is safe to alias dst == src if dstFmt == srcFmt.
-SKCMS_API bool skcms_Transform(const void* src,
- skcms_PixelFormat srcFmt,
- skcms_AlphaFormat srcAlpha,
- const skcms_ICCProfile* srcProfile,
- void* dst,
- skcms_PixelFormat dstFmt,
- skcms_AlphaFormat dstAlpha,
- const skcms_ICCProfile* dstProfile,
- size_t npixels);
-
-// As skcms_Transform(), supporting srcFmts with a palette.
-SKCMS_API bool skcms_TransformWithPalette(const void* src,
- skcms_PixelFormat srcFmt,
- skcms_AlphaFormat srcAlpha,
- const skcms_ICCProfile* srcProfile,
- void* dst,
- skcms_PixelFormat dstFmt,
- skcms_AlphaFormat dstAlpha,
- const skcms_ICCProfile* dstProfile,
- size_t npixels,
- const void* palette);
-
-// If profile can be used as a destination in skcms_Transform, return true. Otherwise, attempt to
-// rewrite it with approximations where reasonable. If successful, return true. If no reasonable
-// approximation exists, leave the profile unchanged and return false.
-SKCMS_API bool skcms_MakeUsableAsDestination(skcms_ICCProfile* profile);
-
-// If profile can be used as a destination with a single parametric transfer function (ie for
-// rasterization), return true. Otherwise, attempt to rewrite it with approximations where
-// reasonable. If successful, return true. If no reasonable approximation exists, leave the
-// profile unchanged and return false.
-SKCMS_API bool skcms_MakeUsableAsDestinationWithSingleCurve(skcms_ICCProfile* profile);
-
-// Returns a matrix to adapt XYZ color from given the whitepoint to D50.
-SKCMS_API bool skcms_AdaptToXYZD50(float wx, float wy,
- skcms_Matrix3x3* toXYZD50);
-
-// Returns a matrix to convert RGB color into XYZ adapted to D50, given the
-// primaries and whitepoint of the RGB model.
-SKCMS_API bool skcms_PrimariesToXYZD50(float rx, float ry,
- float gx, float gy,
- float bx, float by,
- float wx, float wy,
- skcms_Matrix3x3* toXYZD50);
-
-// Call before your first call to skcms_Transform() to skip runtime CPU detection.
-SKCMS_API void skcms_DisableRuntimeCPUDetection(void);
-
-// Utilities for programmatically constructing profiles
-static inline void skcms_Init(skcms_ICCProfile* p) {
- memset(p, 0, sizeof(*p));
- p->data_color_space = skcms_Signature_RGB;
- p->pcs = skcms_Signature_XYZ;
-}
-
-static inline void skcms_SetTransferFunction(skcms_ICCProfile* p,
- const skcms_TransferFunction* tf) {
- p->has_trc = true;
- for (int i = 0; i < 3; ++i) {
- p->trc[i].table_entries = 0;
- p->trc[i].parametric = *tf;
- }
-}
-
-static inline void skcms_SetXYZD50(skcms_ICCProfile* p, const skcms_Matrix3x3* m) {
- p->has_toXYZD50 = true;
- p->toXYZD50 = *m;
-}
-
-#ifdef __cplusplus
-}
-#endif
+// TODO(kjlubick, brianosman): remove this bridge when clients are using the new skcms location.
+#include "../../../modules/skcms/skcms.h"
diff --git a/chromium/third_party/skia/include/third_party/vulkan/BUILD.bazel b/chromium/third_party/skia/include/third_party/vulkan/BUILD.bazel
index 42ae993a475..ef28d4d2ded 100644
--- a/chromium/third_party/skia/include/third_party/vulkan/BUILD.bazel
+++ b/chromium/third_party/skia/include/third_party/vulkan/BUILD.bazel
@@ -1,10 +1,10 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy")
+load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_library")
licenses(["notice"])
exports_files_legacy()
-cc_library(
+skia_cc_library(
name = "vulkan",
srcs = [
"vulkan/vk_platform.h",
diff --git a/chromium/third_party/skia/include/utils/SkAnimCodecPlayer.h b/chromium/third_party/skia/include/utils/SkAnimCodecPlayer.h
index 58428e07c01..f4729aa37d6 100644
--- a/chromium/third_party/skia/include/utils/SkAnimCodecPlayer.h
+++ b/chromium/third_party/skia/include/utils/SkAnimCodecPlayer.h
@@ -13,7 +13,7 @@
#include "include/core/SkRefCnt.h"
#include "include/core/SkSize.h"
-#include <stdint.h>
+#include <cstdint>
#include <memory>
#include <vector>
diff --git a/chromium/third_party/skia/include/utils/SkBase64.h b/chromium/third_party/skia/include/utils/SkBase64.h
index ed76638b6de..e01028543a4 100644
--- a/chromium/third_party/skia/include/utils/SkBase64.h
+++ b/chromium/third_party/skia/include/utils/SkBase64.h
@@ -10,6 +10,8 @@
#include "include/core/SkTypes.h"
+#include <cstddef>
+
struct SkBase64 {
public:
enum Error {
diff --git a/chromium/third_party/skia/include/utils/SkCustomTypeface.h b/chromium/third_party/skia/include/utils/SkCustomTypeface.h
index ff63782d99e..afdf91e5ebc 100644
--- a/chromium/third_party/skia/include/utils/SkCustomTypeface.h
+++ b/chromium/third_party/skia/include/utils/SkCustomTypeface.h
@@ -8,28 +8,25 @@
#ifndef SkCustomTypeface_DEFINED
#define SkCustomTypeface_DEFINED
+#include "include/core/SkDrawable.h"
#include "include/core/SkFontMetrics.h"
#include "include/core/SkFontStyle.h"
#include "include/core/SkPath.h"
+#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkTypes.h"
#include <vector>
-class SkImage;
-class SkPaint;
-class SkPicture;
class SkStream;
class SkTypeface;
-class SkCustomTypefaceBuilder {
+class SK_API SkCustomTypefaceBuilder {
public:
SkCustomTypefaceBuilder();
void setGlyph(SkGlyphID, float advance, const SkPath&);
- void setGlyph(SkGlyphID, float advance, const SkPath&, const SkPaint&);
- void setGlyph(SkGlyphID, float advance, sk_sp<SkImage>, float scale);
- void setGlyph(SkGlyphID, float advance, sk_sp<SkPicture>);
+ void setGlyph(SkGlyphID, float advance, sk_sp<SkDrawable>, const SkRect& bounds);
void setMetrics(const SkFontMetrics& fm, float scale = 1);
void setFontStyle(SkFontStyle);
@@ -37,14 +34,30 @@ public:
sk_sp<SkTypeface> detach();
private:
- std::vector<SkPath> fPaths;
- std::vector<float> fAdvances;
- SkFontMetrics fMetrics;
- SkFontStyle fStyle;
+ struct GlyphRec {
+ // logical union
+ SkPath fPath;
+ sk_sp<SkDrawable> fDrawable;
+
+ SkRect fBounds = {0,0,0,0}; // only used for drawable glyphs atm
+ float fAdvance = 0;
+
+ bool isDrawable() const {
+ SkASSERT(!fDrawable || fPath.isEmpty());
+ return fDrawable != nullptr;
+ }
+ };
+
+ std::vector<GlyphRec> fGlyphRecs;
+ SkFontMetrics fMetrics;
+ SkFontStyle fStyle;
+
+ GlyphRec& ensureStorage(SkGlyphID);
static sk_sp<SkTypeface> Deserialize(SkStream*);
friend class SkTypeface;
+ friend class SkUserTypeface;
};
#endif
diff --git a/chromium/third_party/skia/include/utils/SkEventTracer.h b/chromium/third_party/skia/include/utils/SkEventTracer.h
index 96bc43cbbfd..2ec0a3b3554 100644
--- a/chromium/third_party/skia/include/utils/SkEventTracer.h
+++ b/chromium/third_party/skia/include/utils/SkEventTracer.h
@@ -18,6 +18,8 @@
#include "include/core/SkTypes.h"
+#include <cstdint>
+
class SK_API SkEventTracer {
public:
@@ -76,6 +78,9 @@ public:
const char* name,
SkEventTracer::Handle handle) = 0;
+ // Optional method that can be implemented to allow splitting up traces into different sections.
+ virtual void newTracingSection(const char*) {}
+
protected:
SkEventTracer() = default;
SkEventTracer(const SkEventTracer&) = delete;
diff --git a/chromium/third_party/skia/include/utils/SkNWayCanvas.h b/chromium/third_party/skia/include/utils/SkNWayCanvas.h
index eae115c18a3..5ef7a103a98 100644
--- a/chromium/third_party/skia/include/utils/SkNWayCanvas.h
+++ b/chromium/third_party/skia/include/utils/SkNWayCanvas.h
@@ -22,9 +22,14 @@
#include "include/private/SkTDArray.h"
#include "include/utils/SkNoDrawCanvas.h"
+#include <cstddef>
+
+namespace sktext {
+class GlyphRunList;
+}
+
class SkData;
class SkDrawable;
-class SkGlyphRunList;
class SkImage;
class SkMatrix;
class SkPaint;
@@ -69,7 +74,7 @@ protected:
void didTranslate(SkScalar, SkScalar) override;
void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override;
- void onDrawGlyphRunList(const SkGlyphRunList&, const SkPaint&) override;
+ void onDrawGlyphRunList(const sktext::GlyphRunList&, const SkPaint&) override;
void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
const SkPaint& paint) override;
#if SK_SUPPORT_GPU
diff --git a/chromium/third_party/skia/include/utils/SkPaintFilterCanvas.h b/chromium/third_party/skia/include/utils/SkPaintFilterCanvas.h
index 85f7aea64b2..4e79a5bb9a9 100644
--- a/chromium/third_party/skia/include/utils/SkPaintFilterCanvas.h
+++ b/chromium/third_party/skia/include/utils/SkPaintFilterCanvas.h
@@ -21,10 +21,15 @@
#include "include/private/SkTDArray.h"
#include "include/utils/SkNWayCanvas.h"
+#include <cstddef>
+
+namespace sktext {
+class GlyphRunList;
+}
+
class GrRecordingContext;
class SkData;
class SkDrawable;
-class SkGlyphRunList;
class SkImage;
class SkMatrix;
class SkPaint;
@@ -103,7 +108,7 @@ protected:
void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override;
void onDrawDrawable(SkDrawable*, const SkMatrix*) override;
- void onDrawGlyphRunList(const SkGlyphRunList&, const SkPaint&) override;
+ void onDrawGlyphRunList(const sktext::GlyphRunList&, const SkPaint&) override;
void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
const SkPaint& paint) override;
void onDrawAnnotation(const SkRect& rect, const char key[], SkData* value) override;
@@ -119,7 +124,7 @@ protected:
bool onPeekPixels(SkPixmap* pixmap) override;
bool onAccessTopLayerPixels(SkPixmap* pixmap) override;
SkImageInfo onImageInfo() const override;
- bool onGetProps(SkSurfaceProps* props) const override;
+ bool onGetProps(SkSurfaceProps* props, bool top) const override;
private:
class AutoPaintFilter;
diff --git a/chromium/third_party/skia/include/utils/SkParse.h b/chromium/third_party/skia/include/utils/SkParse.h
index e141e4e2d4a..bcabc3c793a 100644
--- a/chromium/third_party/skia/include/utils/SkParse.h
+++ b/chromium/third_party/skia/include/utils/SkParse.h
@@ -14,6 +14,9 @@
#include "include/core/SkScalar.h"
#include "include/core/SkTypes.h"
+#include <cstddef>
+#include <cstdint>
+
class SK_API SkParse {
public:
static int Count(const char str[]); // number of scalars or int values
diff --git a/chromium/third_party/skia/include/utils/SkShadowUtils.h b/chromium/third_party/skia/include/utils/SkShadowUtils.h
index 68a02ba7274..b7c43d569f8 100644
--- a/chromium/third_party/skia/include/utils/SkShadowUtils.h
+++ b/chromium/third_party/skia/include/utils/SkShadowUtils.h
@@ -13,6 +13,8 @@
#include "include/core/SkTypes.h"
#include "include/private/SkShadowFlags.h"
+#include <cstdint>
+
class SkCanvas;
class SkMatrix;
class SkPath;
diff --git a/chromium/third_party/skia/include/utils/SkTextUtils.h b/chromium/third_party/skia/include/utils/SkTextUtils.h
index b3902ba7450..b73ab771e83 100644
--- a/chromium/third_party/skia/include/utils/SkTextUtils.h
+++ b/chromium/third_party/skia/include/utils/SkTextUtils.h
@@ -12,7 +12,8 @@
#include "include/core/SkScalar.h"
#include "include/core/SkTypes.h"
-#include <string.h>
+#include <cstddef>
+#include <string>
class SkCanvas;
class SkFont;
diff --git a/chromium/third_party/skia/modules/androidkit/src/Canvas.cpp b/chromium/third_party/skia/modules/androidkit/src/Canvas.cpp
index 8f36fb7884f..7a74dcc1a5a 100644
--- a/chromium/third_party/skia/modules/androidkit/src/Canvas.cpp
+++ b/chromium/third_party/skia/modules/androidkit/src/Canvas.cpp
@@ -214,6 +214,6 @@ int register_androidkit_Canvas(JNIEnv* env) {
const auto clazz = env->FindClass("org/skia/androidkit/Canvas");
return clazz
- ? env->RegisterNatives(clazz, methods, SK_ARRAY_COUNT(methods))
+ ? env->RegisterNatives(clazz, methods, std::size(methods))
: JNI_ERR;
}
diff --git a/chromium/third_party/skia/modules/androidkit/src/ColorFilters.cpp b/chromium/third_party/skia/modules/androidkit/src/ColorFilters.cpp
index 347de516fe5..e48e43f6c7a 100644
--- a/chromium/third_party/skia/modules/androidkit/src/ColorFilters.cpp
+++ b/chromium/third_party/skia/modules/androidkit/src/ColorFilters.cpp
@@ -48,7 +48,7 @@ int register_androidkit_ColorFilter(JNIEnv* env) {
const auto clazz = env->FindClass("org/skia/androidkit/ColorFilter");
return clazz
- ? env->RegisterNatives(clazz, methods, SK_ARRAY_COUNT(methods))
+ ? env->RegisterNatives(clazz, methods, std::size(methods))
: JNI_ERR;
}
@@ -59,7 +59,7 @@ int register_androidkit_MatrixColorFilter(JNIEnv* env) {
const auto clazz = env->FindClass("org/skia/androidkit/MatrixColorFilter");
return clazz
- ? env->RegisterNatives(clazz, methods, SK_ARRAY_COUNT(methods))
+ ? env->RegisterNatives(clazz, methods, std::size(methods))
: JNI_ERR;
}
@@ -70,7 +70,7 @@ int register_androidkit_HSLAMatrixColorFilter(JNIEnv* env) {
const auto clazz = env->FindClass("org/skia/androidkit/HSLAMatrixColorFilter");
return clazz
- ? env->RegisterNatives(clazz, methods, SK_ARRAY_COUNT(methods))
+ ? env->RegisterNatives(clazz, methods, std::size(methods))
: JNI_ERR;
}
@@ -81,6 +81,6 @@ int register_androidkit_ComposeColorFilter(JNIEnv* env) {
const auto clazz = env->FindClass("org/skia/androidkit/ComposeColorFilter");
return clazz
- ? env->RegisterNatives(clazz, methods, SK_ARRAY_COUNT(methods))
+ ? env->RegisterNatives(clazz, methods, std::size(methods))
: JNI_ERR;
}
diff --git a/chromium/third_party/skia/modules/androidkit/src/Font.cpp b/chromium/third_party/skia/modules/androidkit/src/Font.cpp
index 346bf49c11e..9111b044a37 100644
--- a/chromium/third_party/skia/modules/androidkit/src/Font.cpp
+++ b/chromium/third_party/skia/modules/androidkit/src/Font.cpp
@@ -35,6 +35,6 @@ int register_androidkit_Font(JNIEnv* env) {
const auto clazz = env->FindClass("org/skia/androidkit/Font");
return clazz
- ? env->RegisterNatives(clazz, methods, SK_ARRAY_COUNT(methods))
+ ? env->RegisterNatives(clazz, methods, std::size(methods))
: JNI_ERR;
}
diff --git a/chromium/third_party/skia/modules/androidkit/src/FontChainAdapter.cpp b/chromium/third_party/skia/modules/androidkit/src/FontChainAdapter.cpp
index 4c160404279..6604fdc2146 100644
--- a/chromium/third_party/skia/modules/androidkit/src/FontChainAdapter.cpp
+++ b/chromium/third_party/skia/modules/androidkit/src/FontChainAdapter.cpp
@@ -85,6 +85,6 @@ int register_androidkit_FontChain(JNIEnv* env) {
};
return clazz
- ? env->RegisterNatives(clazz, methods, SK_ARRAY_COUNT(methods))
+ ? env->RegisterNatives(clazz, methods, std::size(methods))
: JNI_ERR;
}
diff --git a/chromium/third_party/skia/modules/androidkit/src/Gradients.cpp b/chromium/third_party/skia/modules/androidkit/src/Gradients.cpp
index a81b5864a8c..4f21fbb161d 100644
--- a/chromium/third_party/skia/modules/androidkit/src/Gradients.cpp
+++ b/chromium/third_party/skia/modules/androidkit/src/Gradients.cpp
@@ -132,7 +132,7 @@ int register_androidkit_LinearGradient(JNIEnv* env) {
const auto clazz = env->FindClass("org/skia/androidkit/LinearGradient");
return clazz
- ? env->RegisterNatives(clazz, methods, SK_ARRAY_COUNT(methods))
+ ? env->RegisterNatives(clazz, methods, std::size(methods))
: JNI_ERR;
}
@@ -143,7 +143,7 @@ int register_androidkit_RadialGradient(JNIEnv* env) {
const auto clazz = env->FindClass("org/skia/androidkit/RadialGradient");
return clazz
- ? env->RegisterNatives(clazz, methods, SK_ARRAY_COUNT(methods))
+ ? env->RegisterNatives(clazz, methods, std::size(methods))
: JNI_ERR;
}
@@ -154,7 +154,7 @@ int register_androidkit_TwoPointConicalGradient(JNIEnv* env) {
const auto clazz = env->FindClass("org/skia/androidkit/TwoPointConicalGradient");
return clazz
- ? env->RegisterNatives(clazz, methods, SK_ARRAY_COUNT(methods))
+ ? env->RegisterNatives(clazz, methods, std::size(methods))
: JNI_ERR;
}
@@ -165,6 +165,6 @@ int register_androidkit_SweepGradient(JNIEnv* env) {
const auto clazz = env->FindClass("org/skia/androidkit/SweepGradient");
return clazz
- ? env->RegisterNatives(clazz, methods, SK_ARRAY_COUNT(methods))
+ ? env->RegisterNatives(clazz, methods, std::size(methods))
: JNI_ERR;
}
diff --git a/chromium/third_party/skia/modules/androidkit/src/Image.cpp b/chromium/third_party/skia/modules/androidkit/src/Image.cpp
index 597f7e428c4..9bc16bec5b7 100644
--- a/chromium/third_party/skia/modules/androidkit/src/Image.cpp
+++ b/chromium/third_party/skia/modules/androidkit/src/Image.cpp
@@ -75,6 +75,6 @@ int register_androidkit_Image(JNIEnv* env) {
const auto clazz = env->FindClass("org/skia/androidkit/Image");
return clazz
- ? env->RegisterNatives(clazz, methods, SK_ARRAY_COUNT(methods))
+ ? env->RegisterNatives(clazz, methods, std::size(methods))
: JNI_ERR;
}
diff --git a/chromium/third_party/skia/modules/androidkit/src/ImageFilter.cpp b/chromium/third_party/skia/modules/androidkit/src/ImageFilter.cpp
index 86e7b18ec7d..80dcda1ee24 100644
--- a/chromium/third_party/skia/modules/androidkit/src/ImageFilter.cpp
+++ b/chromium/third_party/skia/modules/androidkit/src/ImageFilter.cpp
@@ -75,6 +75,6 @@ int register_androidkit_ImageFilter(JNIEnv* env) {
const auto clazz = env->FindClass("org/skia/androidkit/ImageFilter");
return clazz
- ? env->RegisterNatives(clazz, methods, SK_ARRAY_COUNT(methods))
+ ? env->RegisterNatives(clazz, methods, std::size(methods))
: JNI_ERR;
}
diff --git a/chromium/third_party/skia/modules/androidkit/src/Matrix.cpp b/chromium/third_party/skia/modules/androidkit/src/Matrix.cpp
index 41b017ffbf3..0a41dc81bd1 100644
--- a/chromium/third_party/skia/modules/androidkit/src/Matrix.cpp
+++ b/chromium/third_party/skia/modules/androidkit/src/Matrix.cpp
@@ -123,6 +123,6 @@ int register_androidkit_Matrix(JNIEnv* env) {
const auto clazz = env->FindClass("org/skia/androidkit/Matrix");
return clazz
- ? env->RegisterNatives(clazz, methods, SK_ARRAY_COUNT(methods))
+ ? env->RegisterNatives(clazz, methods, std::size(methods))
: JNI_ERR;
}
diff --git a/chromium/third_party/skia/modules/androidkit/src/Paint.cpp b/chromium/third_party/skia/modules/androidkit/src/Paint.cpp
index 35e9156936d..7268f2d6dba 100644
--- a/chromium/third_party/skia/modules/androidkit/src/Paint.cpp
+++ b/chromium/third_party/skia/modules/androidkit/src/Paint.cpp
@@ -122,6 +122,6 @@ int register_androidkit_Paint(JNIEnv* env) {
const auto clazz = env->FindClass("org/skia/androidkit/Paint");
return clazz
- ? env->RegisterNatives(clazz, methods, SK_ARRAY_COUNT(methods))
+ ? env->RegisterNatives(clazz, methods, std::size(methods))
: JNI_ERR;
}
diff --git a/chromium/third_party/skia/modules/androidkit/src/Path.cpp b/chromium/third_party/skia/modules/androidkit/src/Path.cpp
index 8ea4bc627e0..89ef87922b1 100644
--- a/chromium/third_party/skia/modules/androidkit/src/Path.cpp
+++ b/chromium/third_party/skia/modules/androidkit/src/Path.cpp
@@ -23,6 +23,6 @@ int register_androidkit_Path(JNIEnv* env) {
const auto clazz = env->FindClass("org/skia/androidkit/Path");
return clazz
- ? env->RegisterNatives(clazz, methods, SK_ARRAY_COUNT(methods))
+ ? env->RegisterNatives(clazz, methods, std::size(methods))
: JNI_ERR;
}
diff --git a/chromium/third_party/skia/modules/androidkit/src/PathBuilder.cpp b/chromium/third_party/skia/modules/androidkit/src/PathBuilder.cpp
index a0a850450c2..a091d520b99 100644
--- a/chromium/third_party/skia/modules/androidkit/src/PathBuilder.cpp
+++ b/chromium/third_party/skia/modules/androidkit/src/PathBuilder.cpp
@@ -103,6 +103,6 @@ int register_androidkit_PathBuilder(JNIEnv* env) {
const auto clazz = env->FindClass("org/skia/androidkit/PathBuilder");
return clazz
- ? env->RegisterNatives(clazz, methods, SK_ARRAY_COUNT(methods))
+ ? env->RegisterNatives(clazz, methods, std::size(methods))
: JNI_ERR;
}
diff --git a/chromium/third_party/skia/modules/androidkit/src/RuntimeShaderBuilder.cpp b/chromium/third_party/skia/modules/androidkit/src/RuntimeShaderBuilder.cpp
index df86a983418..e4aa0578567 100644
--- a/chromium/third_party/skia/modules/androidkit/src/RuntimeShaderBuilder.cpp
+++ b/chromium/third_party/skia/modules/androidkit/src/RuntimeShaderBuilder.cpp
@@ -36,20 +36,20 @@ static void ShaderBuilder_Release(JNIEnv* env, jobject, jlong native_instance) {
static void ShaderBuilder_SetUniformFloat(JNIEnv* env, jobject, jlong native_instance, jstring jname, float val) {
if (auto* builder = reinterpret_cast<SkRuntimeShaderBuilder*>(native_instance)) {
- builder->uniform(androidkit::utils::CString(env, jname)) = val;
+ builder->uniform(androidkit::utils::CString(env, jname).str()) = val;
}
}
static void ShaderBuilder_SetUniformFloat3(JNIEnv* env, jobject, jlong native_instance, jstring jname, float valX, float valY, float valZ) {
if (auto* builder = reinterpret_cast<SkRuntimeShaderBuilder*>(native_instance)) {
- builder->uniform(androidkit::utils::CString(env, jname)) = SkV3{valX, valY, valZ};
+ builder->uniform(androidkit::utils::CString(env, jname).str()) = SkV3{valX, valY, valZ};
}
}
static void ShaderBuilder_SetUniformMatrix(JNIEnv* env, jobject, jlong native_instance, jstring jname, jlong native_matrix) {
if (auto* builder = reinterpret_cast<SkRuntimeShaderBuilder*>(native_instance)) {
if (auto* matrix = reinterpret_cast<SkM44*>(native_matrix)) {
- builder->uniform(androidkit::utils::CString(env, jname)) = *matrix;
+ builder->uniform(androidkit::utils::CString(env, jname).str()) = *matrix;
}
}
}
@@ -78,6 +78,6 @@ int register_androidkit_RuntimeShaderBuilder(JNIEnv* env) {
const auto clazz = env->FindClass("org/skia/androidkit/RuntimeShaderBuilder");
return clazz
- ? env->RegisterNatives(clazz, methods, SK_ARRAY_COUNT(methods))
+ ? env->RegisterNatives(clazz, methods, std::size(methods))
: JNI_ERR;
}
diff --git a/chromium/third_party/skia/modules/androidkit/src/Shader.cpp b/chromium/third_party/skia/modules/androidkit/src/Shader.cpp
index 81cd257204b..9d9980ad56d 100644
--- a/chromium/third_party/skia/modules/androidkit/src/Shader.cpp
+++ b/chromium/third_party/skia/modules/androidkit/src/Shader.cpp
@@ -23,6 +23,6 @@ int register_androidkit_Shader(JNIEnv* env) {
const auto clazz = env->FindClass("org/skia/androidkit/Shader");
return clazz
- ? env->RegisterNatives(clazz, methods, SK_ARRAY_COUNT(methods))
+ ? env->RegisterNatives(clazz, methods, std::size(methods))
: JNI_ERR;
}
diff --git a/chromium/third_party/skia/modules/androidkit/src/SkottieAnimation.cpp b/chromium/third_party/skia/modules/androidkit/src/SkottieAnimation.cpp
index 14c2de164e1..3a67a3e324d 100644
--- a/chromium/third_party/skia/modules/androidkit/src/SkottieAnimation.cpp
+++ b/chromium/third_party/skia/modules/androidkit/src/SkottieAnimation.cpp
@@ -86,6 +86,6 @@ int register_androidkit_SkottieAnimation(JNIEnv* env) {
const auto clazz = env->FindClass("org/skia/androidkit/SkottieAnimation");
return clazz
- ? env->RegisterNatives(clazz, methods, SK_ARRAY_COUNT(methods))
+ ? env->RegisterNatives(clazz, methods, std::size(methods))
: JNI_ERR;
}
diff --git a/chromium/third_party/skia/modules/androidkit/src/Surface.cpp b/chromium/third_party/skia/modules/androidkit/src/Surface.cpp
index 8732f9fccbf..f1136259462 100644
--- a/chromium/third_party/skia/modules/androidkit/src/Surface.cpp
+++ b/chromium/third_party/skia/modules/androidkit/src/Surface.cpp
@@ -268,6 +268,6 @@ int register_androidkit_Surface(JNIEnv* env) {
const auto clazz = env->FindClass("org/skia/androidkit/Surface");
return clazz
- ? env->RegisterNatives(clazz, methods, SK_ARRAY_COUNT(methods))
+ ? env->RegisterNatives(clazz, methods, std::size(methods))
: JNI_ERR;
}
diff --git a/chromium/third_party/skia/modules/androidkit/src/Text.cpp b/chromium/third_party/skia/modules/androidkit/src/Text.cpp
index e87e53c5aae..f3a329379cd 100644
--- a/chromium/third_party/skia/modules/androidkit/src/Text.cpp
+++ b/chromium/third_party/skia/modules/androidkit/src/Text.cpp
@@ -46,6 +46,6 @@ int register_androidkit_Text(JNIEnv* env) {
const auto clazz = env->FindClass("org/skia/androidkit/Text");
return clazz
- ? env->RegisterNatives(clazz, methods, SK_ARRAY_COUNT(methods))
+ ? env->RegisterNatives(clazz, methods, std::size(methods))
: JNI_ERR;
}
diff --git a/chromium/third_party/skia/modules/androidkit/src/Utils.h b/chromium/third_party/skia/modules/androidkit/src/Utils.h
index c645205dcd2..decdd670218 100644
--- a/chromium/third_party/skia/modules/androidkit/src/Utils.h
+++ b/chromium/third_party/skia/modules/androidkit/src/Utils.h
@@ -28,6 +28,7 @@ public:
fEnv->ReleaseStringUTFChars(fJString, fCString);
}
+ const char* str() const { return fCString; }
operator const char*() const { return fCString; }
private:
@@ -35,7 +36,6 @@ private:
const jstring& fJString;
const char* fCString;
-
CString(CString&&) = delete;
CString(const CString&) = delete;
CString& operator=(CString&&) = delete;
diff --git a/chromium/third_party/skia/modules/canvaskit/BUILD.bazel b/chromium/third_party/skia/modules/canvaskit/BUILD.bazel
index 7a46341b8e5..16a210fa843 100644
--- a/chromium/third_party/skia/modules/canvaskit/BUILD.bazel
+++ b/chromium/third_party/skia/modules/canvaskit/BUILD.bazel
@@ -1,7 +1,7 @@
load("//bazel:macros.bzl", "exports_files_legacy", "wasm_cc_binary")
load("//bazel/common_config_settings:defs.bzl", "bool_flag")
-load("//bazel:cc_binary_with_flags.bzl", "cc_binary_with_flags")
load("//bazel:karma_test.bzl", "karma_test")
+load("//bazel:copts.bzl", "DEFAULT_COPTS")
licenses(["notice"])
@@ -10,6 +10,7 @@ exports_files_legacy()
BASE_LINKOPTS = [
#"-flto", # https://github.com/emscripten-core/emsdk/issues/807
"--bind", # Compiles the source code using the Embind bindings to connect C/C++ and JavaScript
+ "-fno-rtti",
"--no-entry",
"-sALLOW_MEMORY_GROWTH",
"-sUSE_PTHREADS=0", # Disable pthreads
@@ -58,13 +59,14 @@ genrule(
# in the fonts/ subdirectory as if it had been there all along.
"--output=$@ " +
"--align=4",
- tools = ["//tools:embed_resources"],
+ exec_tools = ["//tools:embed_resources"],
)
# Note: These are defines that only impact the _bindings.cpp files in this folder.
# Any defines that need to effect the entire Skia build should go in //bazel/BUILD.bazel
CK_DEFINES = [
"CK_INCLUDE_PATHOPS",
+ "EMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0", # Allows us to compile with -fno-rtti
] + select({
":enable_fonts_true": ["CK_INCLUDE_PARAGRAPH"],
":enable_fonts_false": ["CK_NO_FONTS"],
@@ -74,6 +76,9 @@ CK_DEFINES = [
}) + select({
":enable_runtime_effect_true": ["CK_INCLUDE_RUNTIME_EFFECT=1"],
":enable_runtime_effect_false": [],
+}) + select({
+ "//src/gpu:gl_backend": ["CK_ENABLE_WEBGL"],
+ "//conditions:default": [],
})
CK_RELEASE_OPTS = [
@@ -82,7 +87,7 @@ CK_RELEASE_OPTS = [
"--closure-args=--externs=$(location externs.js)",
]
-CK_OPTS = BASE_LINKOPTS + [
+CK_LINKOPTS = BASE_LINKOPTS + [
"-sEXPORT_NAME=CanvasKitInit",
"-sINITIAL_MEMORY=128MB",
# The order of these --pre-js flags matters! The preamble is a partially open scope and the
@@ -100,11 +105,11 @@ CK_OPTS = BASE_LINKOPTS + [
"--pre-js",
"modules/canvaskit/pathops.js",
] + select({
- "//bazel/common_config_settings:gl_backend": [
+ "//src/gpu:gl_backend": [
"--pre-js",
"modules/canvaskit/cpu.js",
"--pre-js",
- "modules/canvaskit/gpu.js",
+ "modules/canvaskit/webgl.js",
],
"//conditions:default": [
"--pre-js",
@@ -194,13 +199,12 @@ CK_OPTS = BASE_LINKOPTS + [
})
# All JS files that could possibly be included via --pre-js or --post-js.
-# Whether they actually will be or not will be controlled above in the construction of CK_OPTS.
+# Whether they actually will be or not will be controlled above in the construction of CK_LINKOPTS.
JS_INTERFACE_FILES = [
"color.js",
"cpu.js",
"debug.js",
"font.js",
- "gpu.js",
"interface.js",
"matrix.js",
"memory.js",
@@ -214,6 +218,8 @@ JS_INTERFACE_FILES = [
"skottie.js",
"skp.js",
"util.js",
+ "webgl.js",
+ "webgpu.js",
] + [
"htmlcanvas/canvas2dcontext.js",
"htmlcanvas/color.js",
@@ -250,47 +256,17 @@ CK_SRCS = [
":enable_particles_false": [],
})
-cc_binary_with_flags(
- name = "canvaskit.with_flags",
+CK_COPTS = [
+ "-Wno-header-hygiene",
+]
+
+cc_binary(
+ name = "canvaskit.build",
srcs = CK_SRCS,
additional_linker_inputs = JS_INTERFACE_FILES + ["externs.js"],
- # wasm_cc_binary makes the canvaskit.js/canvaskit.wasm based on the actual name
- # of the executable.
- linkopts = CK_OPTS,
+ copts = DEFAULT_COPTS + CK_COPTS,
+ linkopts = CK_LINKOPTS,
local_defines = CK_DEFINES,
- set_flags = {
- "disable_tracing": ["True"],
- "include_decoder": [
- "jpeg_decode_codec",
- "png_decode_codec",
- "webp_decode_codec",
- "gif_decode_codec",
- ],
- "include_encoder": [
- "jpeg_encode_codec",
- "png_encode_codec",
- "webp_encode_codec",
- ],
- # TODO(kjlubick) make this optional, depending on enable_fonts
- "fontmgr_factory": [
- "custom_embedded_fontmgr_factory",
- ],
- "gpu_backend": [
- "gl_backend",
- ],
- "with_gl_standard": [
- "webgl_standard",
- ],
- "use_icu": [
- "True",
- ],
- "enable_sksl_tracing": [
- "True",
- ],
- "shaper_backend": [
- "harfbuzz_shaper",
- ],
- },
# This target won't build successfully on its own because of missing emscripten
# headers etc. Therefore, we hide it from wildcards.
tags = ["manual"],
@@ -316,56 +292,56 @@ cc_binary_with_flags(
)
wasm_cc_binary(
- name = "canvaskit_wasm",
+ name = "canvaskit",
# Whatever is before the dot will be the name of the output js and wasm, aka "the stem".
# https://github.com/emscripten-core/emsdk/blob/82ad00499a42abde16b363239d2bc83bf5d863ab/bazel/emscripten_toolchain/wasm_cc_binary.bzl#L91
- cc_target = ":canvaskit.with_flags",
+ cc_target = ":canvaskit.build",
)
bool_flag(
- default = True,
+ default = False,
flag_name = "enable_canvas_polyfill",
)
bool_flag(
- default = True,
+ default = False,
flag_name = "enable_fonts",
)
bool_flag(
- default = True,
+ default = False,
flag_name = "include_embedded_font",
)
bool_flag(
- default = True,
+ default = False,
+ flag_name = "include_matrix_js",
+)
+
+bool_flag(
+ default = False,
flag_name = "enable_skottie",
)
bool_flag(
- default = True,
+ default = False,
flag_name = "enable_skp_serialization",
)
bool_flag(
- default = True,
+ default = False,
flag_name = "enable_particles",
)
bool_flag(
- default = True,
+ default = False,
flag_name = "enable_runtime_effect",
)
-bool_flag(
- default = True,
- flag_name = "include_matrix_js",
-)
-
karma_test(
name = "canvaskit_js_tests",
srcs = [
- ":canvaskit_wasm/canvaskit.js",
+ ":canvaskit/canvaskit.js",
# We want to make sure the CanvasKit JS is loaded before the loader script
"tests/bazel/canvaskitinit.js",
"tests/bazel/util.js",
@@ -387,7 +363,7 @@ karma_test(
# exfiltrate the PNGs they create.
env = "//modules/canvaskit/go/gold_test_env:gold_test_env",
static_files = [
- ":canvaskit_wasm/canvaskit.wasm",
+ ":canvaskit/canvaskit.wasm",
"//modules/canvaskit/tests/assets:test_assets",
],
)
diff --git a/chromium/third_party/skia/modules/canvaskit/BUILD.gn b/chromium/third_party/skia/modules/canvaskit/BUILD.gn
index 4ee3fb664a6..a6a33223a91 100644
--- a/chromium/third_party/skia/modules/canvaskit/BUILD.gn
+++ b/chromium/third_party/skia/modules/canvaskit/BUILD.gn
@@ -184,13 +184,29 @@ skia_wasm_lib("canvaskit") {
}
ldflags += [ "-fno-rtti" ]
- if (skia_enable_gpu) {
+ if (skia_canvaskit_enable_webgpu) {
+ ldflags += [
+ "--pre-js",
+ rebase_path("cpu.js"),
+ "--pre-js",
+ rebase_path("webgpu.js"),
+ "-sUSE_WEBGL2=0",
+ "-sUSE_WEBGPU=1",
+ "-sASYNCIFY",
+
+ # Modules from html5_webgpu for JS<->WASM interop
+ "-sEXPORTED_RUNTIME_METHODS=WebGPU,JsValStore",
+
+ # TODO(skia:13429): The closure compiler doesn't play well with optimized builds and ASYNCIFY.
+ "--closure=0",
+ ]
+ } else if (skia_canvaskit_enable_webgl) {
ldflags += [
"-lGL",
"--pre-js",
rebase_path("cpu.js"),
"--pre-js",
- rebase_path("gpu.js"),
+ rebase_path("webgl.js"),
"-sUSE_WEBGL2=1",
"-sMAX_WEBGL_VERSION=2",
]
@@ -355,9 +371,20 @@ skia_wasm_lib("canvaskit") {
if (skia_enable_gpu) {
defines += [
"SK_SUPPORT_GPU=1",
- "SK_GL",
"SK_DISABLE_LEGACY_SHADERCONTEXT",
]
+ if (skia_canvaskit_enable_webgl) {
+ defines += [
+ "SK_GL",
+ "CK_ENABLE_WEBGL",
+ ]
+ }
+ if (skia_canvaskit_enable_webgpu) {
+ defines += [
+ "SK_DAWN",
+ "CK_ENABLE_WEBGPU",
+ ]
+ }
} else {
defines += [
"SK_SUPPORT_GPU=0",
@@ -372,7 +399,7 @@ skia_wasm_lib("canvaskit") {
defines += [ "CK_INCLUDE_RUNTIME_EFFECT" ]
}
if (!skia_canvaskit_enable_alias_font) {
- defines += [ "CANVASKIT_NO_ALIAS_FONT" ]
+ defines += [ "CK_NO_ALIAS_FONT" ]
}
if (skia_canvaskit_legacy_draw_vertices_blend_mode) {
# https://github.com/flutter/flutter/issues/98531
diff --git a/chromium/third_party/skia/modules/canvaskit/CHANGELOG.md b/chromium/third_party/skia/modules/canvaskit/CHANGELOG.md
index fee938cda75..03fd5c74cde 100644
--- a/chromium/third_party/skia/modules/canvaskit/CHANGELOG.md
+++ b/chromium/third_party/skia/modules/canvaskit/CHANGELOG.md
@@ -6,6 +6,47 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+## [0.36.0] - 2022-08-16
+
+### Added
+ - The following path methods: `addCircle`, `CanInterpolate`, and `MakeFromPathInterpolation`.
+ - The following ImageFilter factory methods: `MakeBlend`, `MakeDilate`, `MakeDisplacementMap`,
+ `MakeDropShadow`, `MakeDropShadowOnly`, `MakeErode`, `MakeImage`, `MakeOffset`, and `MakeShader`.
+ - The `MakeLuma` ColorFilter factory method.
+ - The `fontVariations` TextStyle property.
+ - `ColorFilter.MakeBlend` supports float colors under the hood and takes an optional colorspace.
+
+### Changed
+ - Updated `dtslint`, `typescript`, and `@webgpu/types` versions, used for testing index.d.ts types.
+
+### Fixed
+ - `Image.readPixels` should work on `Image`s created with `MakeLazyImageFromTextureSource`
+ (https://github.com/flutter/flutter/issues/103803)
+
+### Known Issues
+ - `ImageFilter.MakeDisplacementMap` is not behaving as expected in certain circumstances.
+
+## [0.35.0] - 2022-06-30
+
+### Fixed
+ - Minor bug fixes in the TypeScript type declaration.
+ - Creating a Premul Image from a TextureSource should upload the texture to WebGL correctly.
+
+### Added
+ - `Surface.makeImageFromTextureSource`, `Surface.updateTextureFromSource`, and
+ `MakeLazyImageFromTextureSource` all take an optional `srcIsPremul` to specify if their source
+ data has Premultiplied alpha. This avoids double multiplying alpha in certain cases.
+ - WebGPU support. Introduced `CanvasKit.MakeGPUDeviceContext`, `CanvasKit.MakeGPUCanvasContext`,
+ `CanvasKit.MakeGPUCanvasSurface`, and `CanvasKit.MakeGPUTextureSurface` which are compatible with
+ WebGPU `GPUDevice` and `GPUTexture` objects.
+ - Typescript definitions for WebGPU API functions that are compatible with `@webgpu/types`
+ (https://www.npmjs.com/package/@webgpu/types).
+ - `CanvasKit.MakeCanvasSurface` is now deprecated. Clients should specify a backend target
+ explicitly using `CanvasKit.MakeSWCanvasSurface`, `CanvasKit.MakeOnScreenGLSurface`,
+ `CanvasKit.MakeGPUCanvasSurface`, and `CanvasKit.MakeGPUTextureSurface`.
+ - `CanvasKit.MakeGrContext` is now deprecated. Clients should use `CanvasKit.MakeWebGLContext` and
+ `CanvasKit.MakeGPUDeviceContext` instead.
+
## [0.34.1] - 2022-06-02
### Added
diff --git a/chromium/third_party/skia/modules/canvaskit/Makefile b/chromium/third_party/skia/modules/canvaskit/Makefile
index 3c7c19e044c..26ccbb5f26a 100644
--- a/chromium/third_party/skia/modules/canvaskit/Makefile
+++ b/chromium/third_party/skia/modules/canvaskit/Makefile
@@ -20,6 +20,14 @@ release_cpu:
cp ../../out/canvaskit_wasm/canvaskit.js ./build/
cp ../../out/canvaskit_wasm/canvaskit.wasm ./build/
+release_webgpu:
+ # Does an incremental build where possible.
+ ./compile.sh use_webgpu
+ - rm -rf build/
+ mkdir build
+ cp ../../out/canvaskit_wasm/canvaskit.js ./build/
+ cp ../../out/canvaskit_wasm/canvaskit.wasm ./build/
+
release_viewer:
# Does an incremental build where possible.
./compile.sh viewer
@@ -44,6 +52,14 @@ debug_cpu:
cp ../../out/canvaskit_wasm_debug/canvaskit.js ./build/
cp ../../out/canvaskit_wasm_debug/canvaskit.wasm ./build/
+debug_webgpu:
+ # Does an incremental build where possible.
+ ./compile.sh debug_build use_webgpu
+ - rm -rf build/
+ mkdir build
+ cp ../../out/canvaskit_wasm_debug/canvaskit.js ./build/
+ cp ../../out/canvaskit_wasm_debug/canvaskit.wasm ./build/
+
debug_viewer:
# Does an incremental build where possible.
./compile.sh debug_build viewer
@@ -120,24 +136,24 @@ typecheck:
cd npm_build && npm run dtslint
bazel_canvaskit_debug:
- bazelisk build :canvaskit_wasm --config=ck_debug
+ bazelisk build :canvaskit --config=ck_full_webgl2_debug
- rm -rf build/
mkdir build
- cp ../../bazel-bin/modules/canvaskit/canvaskit_wasm/canvaskit.js build/canvaskit.js
- cp ../../bazel-bin/modules/canvaskit/canvaskit_wasm/canvaskit.wasm build/canvaskit.wasm
+ cp ../../bazel-bin/modules/canvaskit/canvaskit_webgl/canvaskit.js build/canvaskit.js
+ cp ../../bazel-bin/modules/canvaskit/canvaskit_webgl/canvaskit.wasm build/canvaskit.wasm
bazel_canvaskit_release:
- bazelisk build :canvaskit_wasm --config=ck_release
+ bazelisk build :canvaskit --config=ck_full_webgl2_release
- rm -rf build/
mkdir build
- cp ../../bazel-bin/modules/canvaskit/canvaskit_wasm/canvaskit.js build/canvaskit.js
- cp ../../bazel-bin/modules/canvaskit/canvaskit_wasm/canvaskit.wasm build/canvaskit.wasm
+ cp ../../bazel-bin/modules/canvaskit/canvaskit_webgl/canvaskit.js build/canvaskit.js
+ cp ../../bazel-bin/modules/canvaskit/canvaskit_webgl/canvaskit.wasm build/canvaskit.wasm
ls -l build
bazel_test_canvaskit:
- bazelisk test :canvaskit_js_tests --config=ck_release --test_output=streamed
- echo "test output in //bazel-testlogs/modules/canvaskit/canvaskit_js_wasms/test.outputs/"
- ls ../../bazel-testlogs/modules/canvaskit/canvaskit_js_wasms/test.outputs/
+ bazelisk test :canvaskit_js_tests --config=ck_full_webgl2_release_chrome --test_output=streamed
+ echo "test output in //bazel-testlogs/modules/canvaskit/canvaskit_js_tests/test.outputs/"
+ cd ../../bazel-testlogs/modules/canvaskit/canvaskit_js_tests/test.outputs/ && unzip -qo outputs.zip && ls
with_debugger:
# Does an incremental build where possible.
diff --git a/chromium/third_party/skia/modules/canvaskit/canvaskit.gni b/chromium/third_party/skia/modules/canvaskit/canvaskit.gni
index b04501f56be..6f95a191e73 100644
--- a/chromium/third_party/skia/modules/canvaskit/canvaskit.gni
+++ b/chromium/third_party/skia/modules/canvaskit/canvaskit.gni
@@ -21,6 +21,8 @@ declare_args() {
skia_canvaskit_force_tracing = false
skia_canvaskit_profile_build = false
skia_canvaskit_legacy_draw_vertices_blend_mode = false
+ skia_canvaskit_enable_webgpu = false
+ skia_canvaskit_enable_webgl = false
}
# Assert that skia_canvaskit_profile_build implies release mode.
diff --git a/chromium/third_party/skia/modules/canvaskit/canvaskit_bindings.cpp b/chromium/third_party/skia/modules/canvaskit/canvaskit_bindings.cpp
index f5fb07f193f..d9bc8fb930f 100644
--- a/chromium/third_party/skia/modules/canvaskit/canvaskit_bindings.cpp
+++ b/chromium/third_party/skia/modules/canvaskit/canvaskit_bindings.cpp
@@ -33,6 +33,7 @@
#include "include/core/SkScalar.h"
#include "include/core/SkSerialProcs.h"
#include "include/core/SkShader.h"
+#include "include/core/SkStream.h"
#include "include/core/SkString.h"
#include "include/core/SkStrokeRec.h"
#include "include/core/SkSurface.h"
@@ -47,6 +48,7 @@
#include "include/effects/SkDiscretePathEffect.h"
#include "include/effects/SkGradientShader.h"
#include "include/effects/SkImageFilters.h"
+#include "include/effects/SkLumaColorFilter.h"
#include "include/effects/SkPerlinNoiseShader.h"
#include "include/effects/SkRuntimeEffect.h"
#include "include/effects/SkTrimPathEffect.h"
@@ -63,9 +65,16 @@
#include <emscripten/bind.h>
#include <emscripten/html5.h>
-#ifdef SK_GL
-#include "include/gpu/GrBackendSurface.h"
+#if defined(CK_ENABLE_WEBGL) || defined(CK_ENABLE_WEBGPU)
+#define ENABLE_GPU
+#endif
+
+#ifdef ENABLE_GPU
#include "include/gpu/GrDirectContext.h"
+#endif // ENABLE_GPU
+
+#ifdef CK_ENABLE_WEBGL
+#include "include/gpu/GrBackendSurface.h"
#include "include/gpu/gl/GrGLInterface.h"
#include "include/gpu/gl/GrGLTypes.h"
#include "src/gpu/RefCntedCallback.h"
@@ -74,7 +83,13 @@
#include "src/gpu/ganesh/gl/GrGLDefines_impl.h"
#include <webgl/webgl1.h>
-#endif
+#endif // CK_ENABLE_WEBGL
+
+#ifdef CK_ENABLE_WEBGPU
+#include <emscripten/html5_webgpu.h>
+#include <webgpu/webgpu.h>
+#include <webgpu/webgpu_cpp.h>
+#endif // CK_ENABLE_WEBGPU
#ifndef CK_NO_FONTS
#include "include/core/SkFont.h"
@@ -141,7 +156,7 @@ SkImageInfo toSkImageInfo(const SimpleImageInfo& sii) {
sii.colorSpace ? sii.colorSpace : SkColorSpace::MakeSRGB());
}
-#ifdef SK_GL
+#ifdef CK_ENABLE_WEBGL
// Set the pixel format based on the colortype.
// These degrees of freedom are removed from canvaskit only to keep the interface simpler.
@@ -154,7 +169,7 @@ struct ColorSettings {
colorType = kRGBA_F16_SkColorType;
pixFormat = GR_GL_RGBA16F;
}
- };
+ }
SkColorType colorType;
GrGLenum pixFormat;
};
@@ -221,8 +236,71 @@ sk_sp<SkSurface> MakeRenderTarget(sk_sp<GrDirectContext> dContext, SimpleImageIn
nullptr, true));
return surface;
}
-#endif
+#endif // CK_ENABLE_WEBGL
+
+#ifdef CK_ENABLE_WEBGPU
+
+sk_sp<GrDirectContext> MakeGrContext() {
+ GrContextOptions options;
+ wgpu::Device device = wgpu::Device::Acquire(emscripten_webgpu_get_device());
+ return GrDirectContext::MakeDawn(device, options);
+}
+
+sk_sp<SkSurface> MakeGPUTextureSurface(sk_sp<GrDirectContext> dContext,
+ uint32_t textureHandle, uint32_t textureFormat,
+ int width, int height, sk_sp<SkColorSpace> colorSpace) {
+ if (!colorSpace) {
+ colorSpace = SkColorSpace::MakeSRGB();
+ }
+ wgpu::TextureFormat format = static_cast<wgpu::TextureFormat>(textureFormat);
+ wgpu::Texture texture(emscripten_webgpu_import_texture(textureHandle));
+ emscripten_webgpu_release_js_handle(textureHandle);
+
+ // GrDawnRenderTargetInfo currently only supports a 1-mip TextureView.
+ constexpr uint32_t mipLevelCount = 1;
+ constexpr uint32_t sampleCount = 1;
+
+ GrDawnTextureInfo info;
+ info.fTexture = texture;
+ info.fFormat = format;
+ info.fLevelCount = mipLevelCount;
+
+ GrBackendTexture target(width, height, info);
+ return SkSurface::MakeFromBackendTexture(
+ dContext.get(), target, kTopLeft_GrSurfaceOrigin, sampleCount,
+ colorSpace->isSRGB() ? kRGBA_8888_SkColorType : kRGBA_F16_SkColorType,
+ colorSpace, nullptr);
+}
+
+bool ReplaceBackendTexture(SkSurface& surface, uint32_t textureHandle, uint32_t textureFormat,
+ int width, int height) {
+ wgpu::TextureFormat format = static_cast<wgpu::TextureFormat>(textureFormat);
+ wgpu::Texture texture(emscripten_webgpu_import_texture(textureHandle));
+ emscripten_webgpu_release_js_handle(textureHandle);
+
+ GrDawnTextureInfo info;
+ info.fTexture = texture;
+ info.fFormat = format;
+ info.fLevelCount = 1;
+
+ // Use kDiscard_ContentChangeMode to discard the contents of the old backing texture. This not
+ // only avoids an unnecessary blit, we also don't support copying the contents of a swapchain
+ // texture due to the default GPUCanvasConfiguration usage bits we used when configuring the
+ // GPUCanvasContext in JS.
+ //
+ // The default usage bits only contain GPUTextureUsage.RENDER_ATTACHMENT. To support a copy we
+ // would need to also set GPUTextureUsage.TEXTURE_BINDING (to sample it in a shader) or
+ // GPUTextureUsage.COPY_SRC (for a copy command).
+ //
+ // See https://www.w3.org/TR/webgpu/#namespacedef-gputextureusage and
+ // https://www.w3.org/TR/webgpu/#dictdef-gpucanvasconfiguration.
+ GrBackendTexture target(width, height, info);
+ return surface.replaceBackendTexture(target, kTopLeft_GrSurfaceOrigin,
+ SkSurface::kDiscard_ContentChangeMode);
+}
+
+#endif // CK_ENABLE_WEBGPU
//========================================================================================
// Path things
@@ -370,6 +448,19 @@ SkPathOrNull MakePathFromSVGString(std::string str) {
return emscripten::val::null();
}
+bool CanInterpolate(const SkPath& path1, const SkPath& path2) {
+ return path1.isInterpolatable(path2);
+}
+
+SkPathOrNull MakePathFromInterpolation(const SkPath& path1, const SkPath& path2, SkScalar weight) {
+ SkPath out;
+ bool succeed = path1.interpolate(path2, weight, &out);
+ if (succeed) {
+ return emscripten::val(out);
+ }
+ return emscripten::val::null();
+}
+
SkPath CopyPath(const SkPath& a) {
SkPath copy(a);
return copy;
@@ -437,33 +528,33 @@ SkPathOrNull MakePathFromCmds(WASMPointerF32 cptr, int numCmds) {
for(int i = 0; i < numCmds;){
switch (sk_float_floor2int(cmds[i++])) {
case MOVE:
- CHECK_NUM_ARGS(2);
- x1 = cmds[i++], y1 = cmds[i++];
+ CHECK_NUM_ARGS(2)
+ x1 = cmds[i++]; y1 = cmds[i++];
path.moveTo(x1, y1);
break;
case LINE:
- CHECK_NUM_ARGS(2);
- x1 = cmds[i++], y1 = cmds[i++];
+ CHECK_NUM_ARGS(2)
+ x1 = cmds[i++]; y1 = cmds[i++];
path.lineTo(x1, y1);
break;
case QUAD:
- CHECK_NUM_ARGS(4);
- x1 = cmds[i++], y1 = cmds[i++];
- x2 = cmds[i++], y2 = cmds[i++];
+ CHECK_NUM_ARGS(4)
+ x1 = cmds[i++]; y1 = cmds[i++];
+ x2 = cmds[i++]; y2 = cmds[i++];
path.quadTo(x1, y1, x2, y2);
break;
case CONIC:
- CHECK_NUM_ARGS(5);
- x1 = cmds[i++], y1 = cmds[i++];
- x2 = cmds[i++], y2 = cmds[i++];
+ CHECK_NUM_ARGS(5)
+ x1 = cmds[i++]; y1 = cmds[i++];
+ x2 = cmds[i++]; y2 = cmds[i++];
x3 = cmds[i++]; // weight
path.conicTo(x1, y1, x2, y2, x3);
break;
case CUBIC:
- CHECK_NUM_ARGS(6);
- x1 = cmds[i++], y1 = cmds[i++];
- x2 = cmds[i++], y2 = cmds[i++];
- x3 = cmds[i++], y3 = cmds[i++];
+ CHECK_NUM_ARGS(6)
+ x1 = cmds[i++]; y1 = cmds[i++];
+ x2 = cmds[i++]; y2 = cmds[i++];
+ x3 = cmds[i++]; y3 = cmds[i++];
path.cubicTo(x1, y1, x2, y2, x3, y3);
break;
case CLOSE:
@@ -504,30 +595,30 @@ void PathAddVerbsPointsWeights(SkPath& path, WASMPointerU8 verbsPtr, int numVerb
for (int v = 0; v < numVerbs; ++v) {
switch (verbs[v]) {
case MOVE:
- CHECK_NUM_POINTS(2);
+ CHECK_NUM_POINTS(2)
path.moveTo(pts[ptIdx], pts[ptIdx+1]);
ptIdx += 2;
break;
case LINE:
- CHECK_NUM_POINTS(2);
+ CHECK_NUM_POINTS(2)
path.lineTo(pts[ptIdx], pts[ptIdx+1]);
ptIdx += 2;
break;
case QUAD:
- CHECK_NUM_POINTS(4);
+ CHECK_NUM_POINTS(4)
path.quadTo(pts[ptIdx], pts[ptIdx+1], pts[ptIdx+2], pts[ptIdx+3]);
ptIdx += 4;
break;
case CONIC:
- CHECK_NUM_POINTS(4);
- CHECK_NUM_WEIGHTS(1);
+ CHECK_NUM_POINTS(4)
+ CHECK_NUM_WEIGHTS(1)
path.conicTo(pts[ptIdx], pts[ptIdx+1], pts[ptIdx+2], pts[ptIdx+3],
weights[wtIdx]);
ptIdx += 4;
wtIdx++;
break;
case CUBIC:
- CHECK_NUM_POINTS(6);
+ CHECK_NUM_POINTS(6)
path.cubicTo(pts[ptIdx ], pts[ptIdx+1],
pts[ptIdx+2], pts[ptIdx+3],
pts[ptIdx+4], pts[ptIdx+5]);
@@ -722,7 +813,7 @@ Uint8Array toBytes(sk_sp<SkData> data) {
).call<Uint8Array>("slice"); // slice with no args makes a copy of the memory view.
}
-#ifdef SK_GL
+#ifdef CK_ENABLE_WEBGL
// We need to call into the JS side of things to free webGL contexts. This object will be called
// with _setTextureCleanup after CanvasKit loads. The object will have one attribute,
// a function called deleteTexture that takes two ints.
@@ -748,7 +839,7 @@ public:
SkImageGenerator(ii),
fCallback(callbackObj) {}
- ~WebGLTextureImageGenerator() {
+ ~WebGLTextureImageGenerator() override {
// This cleans up the associated TextureSource that is used to make the texture
// (i.e. "makeTexture" below). We expect this destructor to be called when the
// SkImage that this Generator belongs to is destroyed.
@@ -760,13 +851,13 @@ protected:
const SkImageInfo& info,
const SkIPoint& origin,
GrMipmapped mipmapped,
- GrImageTexGenPolicy texGenPolicy) {
+ GrImageTexGenPolicy texGenPolicy) override {
if (ctx->backend() != GrBackendApi::kOpenGL) {
return {};
}
GrGLTextureInfo glInfo;
- // This callback is defined in gpu.js
+ // This callback is defined in webgl.js
glInfo.fID = fCallback.call<uint32_t>("makeTexture");
// The format and target should match how we make the texture on the JS side
// See the implementation of the makeTexture function.
@@ -815,17 +906,25 @@ sk_sp<SkImage> MakeImageFromGenerator(SimpleImageInfo ii, JSObject callbackObj)
auto gen = std::make_unique<WebGLTextureImageGenerator>(toSkImageInfo(ii), callbackObj);
return SkImage::MakeFromGenerator(std::move(gen));
}
-#endif // SK_GL
+#endif // CK_ENABLE_WEBGL
EMSCRIPTEN_BINDINGS(Skia) {
-#ifdef SK_GL
+#ifdef ENABLE_GPU
+ constant("gpu", true);
function("_MakeGrContext", &MakeGrContext);
+#endif // ENABLE_GPU
+
+#ifdef CK_ENABLE_WEBGL
function("_MakeOnScreenGLSurface", &MakeOnScreenGLSurface);
function("_MakeRenderTargetWH", select_overload<sk_sp<SkSurface>(sk_sp<GrDirectContext>, int, int)>(&MakeRenderTarget));
function("_MakeRenderTargetII", select_overload<sk_sp<SkSurface>(sk_sp<GrDirectContext>, SimpleImageInfo)>(&MakeRenderTarget));
+#endif // CK_ENABLE_WEBGL
+
+#ifdef CK_ENABLE_WEBGPU
+ constant("webgpu", true);
+ function("_MakeGPUTextureSurface", &MakeGPUTextureSurface);
+#endif // CK_ENABLE_WEBGPU
- constant("gpu", true);
-#endif
function("getDecodeCacheLimitBytes", &SkResourceCache::GetTotalByteLimit);
function("setDecodeCacheLimitBytes", &SkResourceCache::SetTotalByteLimit);
function("getDecodeCacheUsedBytes" , &SkResourceCache::GetTotalBytesUsed);
@@ -884,7 +983,7 @@ EMSCRIPTEN_BINDINGS(Skia) {
}), allow_raw_pointers());
#endif
-#ifdef SK_GL
+#ifdef ENABLE_GPU
class_<GrDirectContext>("GrDirectContext")
.smart_ptr<sk_sp<GrDirectContext>>("sk_sp<GrDirectContext>")
.function("getResourceCacheLimitBytes",
@@ -910,7 +1009,8 @@ EMSCRIPTEN_BINDINGS(Skia) {
self.getResourceCacheLimits(&maxResources, &currMax);
self.setResourceCacheLimits(maxResources, maxResourceBytes);
}));
-
+#endif // ENABLE_GPU
+#ifdef CK_ENABLE_WEBGL
// This allows us to give the C++ code a JS callback to delete textures that
// have been passed in via makeImageFromTexture and makeImageFromTextureSource.
function("_setTextureCleanup", optional_override([](JSObject callbackObj)->void {
@@ -1185,7 +1285,7 @@ EMSCRIPTEN_BINDINGS(Skia) {
SkImageInfo dstInfo = toSkImageInfo(di);
return self.readPixels(dstInfo, pixels, dstRowBytes, srcX, srcY);
- }))
+ }), allow_raw_pointers())
.function("restore", &SkCanvas::restore)
.function("restoreToCount", &SkCanvas::restoreToCount)
.function("rotate", select_overload<void (SkScalar, SkScalar, SkScalar)>(&SkCanvas::rotate))
@@ -1212,8 +1312,9 @@ EMSCRIPTEN_BINDINGS(Skia) {
class_<SkColorFilter>("ColorFilter")
.smart_ptr<sk_sp<SkColorFilter>>("sk_sp<ColorFilter>>")
- .class_function("_MakeBlend", optional_override([](WASMPointerF32 cPtr, SkBlendMode mode)->sk_sp<SkColorFilter> {
- return SkColorFilters::Blend(ptrToSkColor4f(cPtr).toSkColor(), mode);
+ .class_function("_MakeBlend", optional_override([](WASMPointerF32 cPtr, SkBlendMode mode,
+ sk_sp<SkColorSpace> colorSpace)->sk_sp<SkColorFilter> {
+ return SkColorFilters::Blend(ptrToSkColor4f(cPtr), colorSpace, mode);
}))
.class_function("MakeCompose", &SkColorFilters::Compose)
.class_function("MakeLerp", &SkColorFilters::Lerp)
@@ -1222,7 +1323,8 @@ EMSCRIPTEN_BINDINGS(Skia) {
float* twentyFloats = reinterpret_cast<float*>(fPtr);
return SkColorFilters::Matrix(twentyFloats);
}))
- .class_function("MakeSRGBToLinearGamma", &SkColorFilters::SRGBToLinearGamma);
+ .class_function("MakeSRGBToLinearGamma", &SkColorFilters::SRGBToLinearGamma)
+ .class_function("MakeLuma", &SkLumaColorFilter::Make);
class_<SkContourMeasureIter>("ContourMeasureIter")
.constructor<const SkPath&, bool, SkScalar>()
@@ -1368,7 +1470,7 @@ EMSCRIPTEN_BINDINGS(Skia) {
class_<SkImage>("Image")
.smart_ptr<sk_sp<SkImage>>("sk_sp<Image>")
-#ifdef SK_GL
+#ifdef CK_ENABLE_WEBGL
.class_function("_makeFromGenerator", &MakeImageFromGenerator)
#endif
// Note that this needs to be cleaned up with delete().
@@ -1416,22 +1518,31 @@ EMSCRIPTEN_BINDINGS(Skia) {
WASMPointerF32 mPtr)->sk_sp<SkShader> {
return self->makeShader(tx, ty, {filter, mipmap}, OptionalMatrix(mPtr));
}), allow_raw_pointers())
+#if defined(ENABLE_GPU)
.function("_readPixels", optional_override([](sk_sp<SkImage> self,
SimpleImageInfo sii, WASMPointerU8 pPtr,
- size_t dstRowBytes, int srcX, int srcY)->bool {
+ size_t dstRowBytes, int srcX, int srcY,
+ GrDirectContext* dContext)->bool {
uint8_t* pixels = reinterpret_cast<uint8_t*>(pPtr);
SkImageInfo ii = toSkImageInfo(sii);
- // TODO(adlai) Migrate CanvasKit API to require DirectContext arg here.
- GrDirectContext* dContext = nullptr;
-#ifdef SK_GL
- dContext = GrAsDirectContext(as_IB(self.get())->context());
-#endif
return self->readPixels(dContext, ii, pixels, dstRowBytes, srcX, srcY);
}), allow_raw_pointers())
+#endif
+ .function("_readPixels", optional_override([](sk_sp<SkImage> self,
+ SimpleImageInfo sii, WASMPointerU8 pPtr,
+ size_t dstRowBytes, int srcX, int srcY)->bool {
+ uint8_t* pixels = reinterpret_cast<uint8_t*>(pPtr);
+ SkImageInfo ii = toSkImageInfo(sii);
+ return self->readPixels(nullptr, ii, pixels, dstRowBytes, srcX, srcY);
+ }), allow_raw_pointers())
.function("width", &SkImage::width);
class_<SkImageFilter>("ImageFilter")
.smart_ptr<sk_sp<SkImageFilter>>("sk_sp<ImageFilter>")
+ .class_function("MakeBlend", optional_override([](SkBlendMode mode, sk_sp<SkImageFilter> background,
+ sk_sp<SkImageFilter> foreground)->sk_sp<SkImageFilter> {
+ return SkImageFilters::Blend(mode, background, foreground);
+ }))
.class_function("MakeBlur", optional_override([](SkScalar sigmaX, SkScalar sigmaY,
SkTileMode tileMode, sk_sp<SkImageFilter> input)->sk_sp<SkImageFilter> {
return SkImageFilters::Blur(sigmaX, sigmaY, tileMode, input);
@@ -1441,6 +1552,61 @@ EMSCRIPTEN_BINDINGS(Skia) {
return SkImageFilters::ColorFilter(cf, input);
}))
.class_function("MakeCompose", &SkImageFilters::Compose)
+ .class_function("MakeDilate", optional_override([](SkScalar radiusX, SkScalar radiusY,
+ sk_sp<SkImageFilter> input)->sk_sp<SkImageFilter> {
+ return SkImageFilters::Dilate(radiusX, radiusY, input);
+ }))
+ .class_function("MakeDisplacementMap", optional_override([](SkColorChannel xChannelSelector,
+ SkColorChannel yChannelSelector,
+ SkScalar scale, sk_sp<SkImageFilter> displacement,
+ sk_sp<SkImageFilter> color)->sk_sp<SkImageFilter> {
+ return SkImageFilters::DisplacementMap(xChannelSelector, yChannelSelector,
+ scale, displacement, color);
+ }))
+ .class_function("MakeShader", optional_override([](sk_sp<SkShader> shader)->sk_sp<SkImageFilter> {
+ return SkImageFilters::Shader(shader);
+ }))
+ .class_function("_MakeDropShadow", optional_override([](SkScalar dx, SkScalar dy,
+ SkScalar sigmaX, SkScalar sigmaY,
+ WASMPointerF32 cPtr, sk_sp<SkImageFilter> input)->sk_sp<SkImageFilter> {
+ SkColor4f c = ptrToSkColor4f(cPtr);
+ return SkImageFilters::DropShadow(dx, dy, sigmaX, sigmaY, c.toSkColor(), input);
+ }))
+ .class_function("_MakeDropShadowOnly", optional_override([](SkScalar dx, SkScalar dy,
+ SkScalar sigmaX, SkScalar sigmaY,
+ WASMPointerF32 cPtr, sk_sp<SkImageFilter> input)->sk_sp<SkImageFilter> {
+ SkColor4f c = ptrToSkColor4f(cPtr);
+ return SkImageFilters::DropShadowOnly(dx, dy, sigmaX, sigmaY, c.toSkColor(), input);
+ }))
+ .class_function("MakeErode", optional_override([](SkScalar radiusX, SkScalar radiusY,
+ sk_sp<SkImageFilter> input)->sk_sp<SkImageFilter> {
+ return SkImageFilters::Erode(radiusX, radiusY, input);
+ }))
+ .class_function("_MakeImageCubic", optional_override([](sk_sp<SkImage> image,
+ float B, float C,
+ WASMPointerF32 srcPtr,
+ WASMPointerF32 dstPtr
+ )->sk_sp<SkImageFilter> {
+ const SkRect* src = reinterpret_cast<const SkRect*>(srcPtr);
+ const SkRect* dst = reinterpret_cast<const SkRect*>(dstPtr);
+ if (src && dst) {
+ return SkImageFilters::Image(image, *src, *dst, SkSamplingOptions({B, C}));
+ }
+ return SkImageFilters::Image(image, SkSamplingOptions({B, C}));
+ }))
+ .class_function("_MakeImageOptions", optional_override([](sk_sp<SkImage> image,
+ SkFilterMode fm,
+ SkMipmapMode mm,
+ WASMPointerF32 srcPtr,
+ WASMPointerF32 dstPtr
+ )->sk_sp<SkImageFilter> {
+ const SkRect* src = reinterpret_cast<const SkRect*>(srcPtr);
+ const SkRect* dst = reinterpret_cast<const SkRect*>(dstPtr);
+ if (src && dst) {
+ return SkImageFilters::Image(image, *src, *dst, SkSamplingOptions(fm, mm));
+ }
+ return SkImageFilters::Image(image, SkSamplingOptions(fm, mm));
+ }))
.class_function("_MakeMatrixTransformCubic",
optional_override([](WASMPointerF32 mPtr, float B, float C,
sk_sp<SkImageFilter> input)->sk_sp<SkImageFilter> {
@@ -1452,6 +1618,10 @@ EMSCRIPTEN_BINDINGS(Skia) {
sk_sp<SkImageFilter> input)->sk_sp<SkImageFilter> {
OptionalMatrix matr(mPtr);
return SkImageFilters::MatrixTransform(matr, SkSamplingOptions(fm, mm), input);
+ }))
+ .class_function("MakeOffset", optional_override([](SkScalar dx, SkScalar dy,
+ sk_sp<SkImageFilter> input)->sk_sp<SkImageFilter> {
+ return SkImageFilters::Offset(dx, dy, input);
}));
class_<SkMaskFilter>("MaskFilter")
@@ -1549,6 +1719,8 @@ EMSCRIPTEN_BINDINGS(Skia) {
.class_function("MakeFromOp", &MakePathFromOp)
#endif
.class_function("MakeFromSVGString", &MakePathFromSVGString)
+ .class_function("MakeFromPathInterpolation", &MakePathFromInterpolation)
+ .class_function("CanInterpolate", &CanInterpolate)
.class_function("_MakeFromCmds", &MakePathFromCmds)
.class_function("_MakeFromVerbsPointsWeights", &MakePathFromVerbsPointsWeights)
.function("_addArc", optional_override([](SkPath& self,
@@ -1563,6 +1735,13 @@ EMSCRIPTEN_BINDINGS(Skia) {
const SkRect* oval = reinterpret_cast<const SkRect*>(fPtr);
self.addOval(*oval, ccw ? SkPathDirection::kCCW : SkPathDirection::kCW, start);
}))
+ .function("_addCircle", optional_override([](SkPath& self,
+ SkScalar x,
+ SkScalar y,
+ SkScalar r,
+ bool ccw)->void {
+ self.addCircle(x, y, r, ccw ? SkPathDirection::kCCW : SkPathDirection::kCW);
+ }))
// interface.js has 3 overloads of addPath
.function("_addPath", &ApplyAddPath)
.function("_addPoly", optional_override([](SkPath& self,
@@ -1911,7 +2090,7 @@ EMSCRIPTEN_BINDINGS(Skia) {
}))
.function("getUniformName", optional_override([](SkRuntimeEffect& self, int i)->JSString {
auto it = self.uniforms().begin() + i;
- return emscripten::val(it->name.c_str());
+ return emscripten::val(std::string(it->name).c_str());
}))
.function("getUniform", optional_override([](SkRuntimeEffect& self, int i)->RuntimeEffectUniform {
auto it = self.uniforms().begin() + i;
@@ -1946,7 +2125,7 @@ EMSCRIPTEN_BINDINGS(Skia) {
return {ii.width(), ii.height(), ii.colorType(), ii.alphaType(), ii.refColorSpace()};
}))
.function("height", &SkSurface::height)
-#ifdef SK_GL
+#ifdef CK_ENABLE_WEBGL
.function("_makeImageFromTexture", optional_override([](SkSurface& self,
uint32_t webglHandle, uint32_t texHandle,
SimpleImageInfo ii)->sk_sp<SkImage> {
@@ -1966,7 +2145,14 @@ EMSCRIPTEN_BINDINGS(Skia) {
deleteJSTexture,
releaseCtx);
}))
- #endif
+#endif // CK_ENABLE_WEBGL
+#ifdef CK_ENABLE_WEBGPU
+ .function("_replaceBackendTexture", optional_override([](SkSurface& self,
+ uint32_t texHandle, uint32_t texFormat,
+ int width, int height) {
+ return ReplaceBackendTexture(self, texHandle, texFormat, width, height);
+ }))
+#endif // CK_ENABLE_WEBGPU
.function("_makeImageSnapshot", optional_override([](SkSurface& self, WASMPointerU32 iPtr)->sk_sp<SkImage> {
SkIRect* bounds = reinterpret_cast<SkIRect*>(iPtr);
if (!bounds) {
@@ -1977,7 +2163,7 @@ EMSCRIPTEN_BINDINGS(Skia) {
.function("_makeSurface", optional_override([](SkSurface& self, SimpleImageInfo sii)->sk_sp<SkSurface> {
return self.makeSurface(toSkImageInfo(sii));
}), allow_raw_pointers())
-#ifdef SK_GL
+#ifdef ENABLE_GPU
.function("reportBackendTypeIsGPU", optional_override([](SkSurface& self) -> bool {
return self.getCanvas()->recordingContext() != nullptr;
}))
@@ -2124,6 +2310,12 @@ EMSCRIPTEN_BINDINGS(Skia) {
.value("Difference", SkClipOp::kDifference)
.value("Intersect", SkClipOp::kIntersect);
+ enum_<SkColorChannel>("ColorChannel")
+ .value("Red", SkColorChannel::kR)
+ .value("Green", SkColorChannel::kG)
+ .value("Blue", SkColorChannel::kB)
+ .value("Alpha", SkColorChannel::kA);
+
enum_<SkColorType>("ColorType")
.value("Alpha_8", SkColorType::kAlpha_8_SkColorType)
.value("RGB_565", SkColorType::kRGB_565_SkColorType)
@@ -2196,7 +2388,7 @@ EMSCRIPTEN_BINDINGS(Skia) {
.value("Full", SkFontHinting::kFull);
enum_<SkFont::Edging>("FontEdging")
-#ifndef CANVASKIT_NO_ALIAS_FONT
+#ifndef CK_NO_ALIAS_FONT
.value("Alias", SkFont::Edging::kAlias)
#endif
.value("AntiAlias", SkFont::Edging::kAntiAlias)
diff --git a/chromium/third_party/skia/modules/canvaskit/compile.sh b/chromium/third_party/skia/modules/canvaskit/compile.sh
index 5bc9f3c0d5a..79efb091893 100755
--- a/chromium/third_party/skia/modules/canvaskit/compile.sh
+++ b/chromium/third_party/skia/modules/canvaskit/compile.sh
@@ -40,9 +40,16 @@ mkdir -p $BUILD_DIR
rm -f $BUILD_DIR/*.a
ENABLE_GPU="true"
+ENABLE_WEBGL="false"
+ENABLE_WEBGPU="false"
if [[ $@ == *cpu* ]]; then
echo "Using the CPU backend instead of the GPU backend"
ENABLE_GPU="false"
+elif [[ $@ == *webgpu* ]]; then
+ echo "Using WebGPU instead of WebGL"
+ ENABLE_WEBGPU="true"
+else
+ ENABLE_WEBGL="true"
fi
SERIALIZE_SKP="true"
@@ -207,7 +214,9 @@ echo "Compiling"
\
skia_use_angle=false \
skia_use_dng_sdk=false \
- skia_use_webgl=true \
+ skia_use_dawn=${ENABLE_WEBGPU} \
+ skia_use_webgl=${ENABLE_WEBGL} \
+ skia_use_webgpu=${ENABLE_WEBGPU} \
skia_use_expat=${USE_EXPAT} \
skia_use_fontconfig=false \
skia_use_freetype=true \
@@ -255,6 +264,8 @@ echo "Compiling"
skia_canvaskit_enable_alias_font=${ENABLE_ALIAS_FONT} \
skia_canvaskit_legacy_draw_vertices_blend_mode=${LEGACY_DRAW_VERTICES} \
skia_canvaskit_enable_debugger=${DEBUGGER_ENABLED} \
- skia_canvaskit_enable_paragraph=${ENABLE_PARAGRAPH}"
+ skia_canvaskit_enable_paragraph=${ENABLE_PARAGRAPH} \
+ skia_canvaskit_enable_webgl=${ENABLE_WEBGL} \
+ skia_canvaskit_enable_webgpu=${ENABLE_WEBGPU}"
${NINJA} -C ${BUILD_DIR} canvaskit.js
diff --git a/chromium/third_party/skia/modules/canvaskit/compile_gm.sh b/chromium/third_party/skia/modules/canvaskit/compile_gm.sh
index 4a27fe398fe..e6fb9dc2e5b 100755
--- a/chromium/third_party/skia/modules/canvaskit/compile_gm.sh
+++ b/chromium/third_party/skia/modules/canvaskit/compile_gm.sh
@@ -48,8 +48,8 @@ rm -f $BUILD_DIR/*.a
GN_GPU="skia_enable_gpu=true skia_gl_standard = \"webgl\""
GN_GPU_FLAGS="\"-DSK_DISABLE_LEGACY_SHADERCONTEXT\","
-WASM_GPU="-lGL -DSK_SUPPORT_GPU=1 -DSK_GL \
- -DSK_DISABLE_LEGACY_SHADERCONTEXT --pre-js $BASE_DIR/cpu.js --pre-js $BASE_DIR/gpu.js\
+WASM_GPU="-lGL -DSK_SUPPORT_GPU=1 -DSK_GL -DCK_ENABLE_WEBGL \
+ -DSK_DISABLE_LEGACY_SHADERCONTEXT --pre-js $BASE_DIR/cpu.js --pre-js $BASE_DIR/webgl.js\
-sUSE_WEBGL2=1"
GM_LIB="$BUILD_DIR/libgm_wasm.a"
@@ -168,8 +168,7 @@ if false; then
fi
# These gms do not compile or link with the WASM code. Thus, we omit them.
-GLOBIGNORE="gm/cgms.cpp:"\
-"gm/compressed_textures.cpp:"\
+GLOBIGNORE="gm/compressed_textures.cpp:"\
"gm/fiddle.cpp:"\
"gm/particles.cpp:"\
"gm/video_decoder.cpp:"
diff --git a/chromium/third_party/skia/modules/canvaskit/cpu.js b/chromium/third_party/skia/modules/canvaskit/cpu.js
index a1423d4e1af..1aed6ced007 100644
--- a/chromium/third_party/skia/modules/canvaskit/cpu.js
+++ b/chromium/third_party/skia/modules/canvaskit/cpu.js
@@ -1,7 +1,7 @@
// Adds compile-time JS functions to augment the CanvasKit interface.
// Implementations in this file are considerate of GPU builds, i.e. some
// behavior is predicated on whether or not this is being compiled alongside
-// gpu.js.
+// webgl.js or webgpu.js.
(function(CanvasKit){
CanvasKit._extraInitializations = CanvasKit._extraInitializations || [];
CanvasKit._extraInitializations.push(function() {
@@ -104,5 +104,10 @@
CanvasKit.setCurrentContext = CanvasKit.setCurrentContext || function() {
// no op if this is a cpu-only build.
};
+
+ CanvasKit.getCurrentGrDirectContext = CanvasKit.getCurrentGrDirectContext || function() {
+ // No GrDirectContexts without a GPU backend.
+ return null;
+ };
});
}(Module)); // When this file is loaded in, the high level object is "Module";
diff --git a/chromium/third_party/skia/modules/canvaskit/debugger_bindings.cpp b/chromium/third_party/skia/modules/canvaskit/debugger_bindings.cpp
index ae36a6cfb3a..150b45f5728 100644
--- a/chromium/third_party/skia/modules/canvaskit/debugger_bindings.cpp
+++ b/chromium/third_party/skia/modules/canvaskit/debugger_bindings.cpp
@@ -32,7 +32,7 @@
#include <emscripten.h>
#include <emscripten/bind.h>
-#ifdef SK_GL
+#ifdef CK_ENABLE_WEBGL
#include "include/gpu/GrBackendSurface.h"
#include "include/gpu/GrDirectContext.h"
#include "include/gpu/gl/GrGLInterface.h"
diff --git a/chromium/third_party/skia/modules/canvaskit/externs.js b/chromium/third_party/skia/modules/canvaskit/externs.js
index ed2a9d39450..0c03eb7a2e2 100644
--- a/chromium/third_party/skia/modules/canvaskit/externs.js
+++ b/chromium/third_party/skia/modules/canvaskit/externs.js
@@ -38,7 +38,8 @@ var CanvasKit = {
GetWebGLContext: function() {},
MakeCanvas: function() {},
MakeCanvasSurface: function() {},
- MakeGrContext: function() {},
+ MakeGrContext: function() {}, // deprecated
+ MakeWebGLContext: function() {},
/** @return {CanvasKit.AnimatedImage} */
MakeAnimatedImageFromEncoded: function() {},
/** @return {CanvasKit.Image} */
@@ -54,6 +55,10 @@ var CanvasKit = {
MakeParticles: function() {},
MakeVertices: function() {},
MakeSurface: function() {},
+ MakeGPUDeviceContext: function() {},
+ MakeGPUCanvasContext: function() {},
+ MakeGPUCanvasSurface: function() {},
+ MakeGPUTextureSurface: function() {},
MakeRasterDirectSurface: function() {},
MakeWebGLCanvasSurface: function() {},
Malloc: function() {},
@@ -422,12 +427,24 @@ var CanvasKit = {
},
ImageFilter: {
+ MakeBlend: function() {},
MakeBlur: function() {},
MakeColorFilter: function() {},
MakeCompose: function() {},
+ MakeDilate: function() {},
+ MakeDisplacementMap: function() {},
+ MakeDropShadow: function() {},
+ MakeDropShadowOnly: function() {},
+ MakeErode: function() {},
+ MakeImage: function() {},
MakeMatrixTransform: function() {},
+ MakeOffset: function() {},
// private API
+ _MakeDropShadow: function() {},
+ _MakeDropShadowOnly: function() {},
+ _MakeImageCubic: function() {},
+ _MakeImageOptions: function() {},
_MakeMatrixTransformCubic: function() {},
_MakeMatrixTransformOptions: function() {},
},
@@ -541,7 +558,9 @@ var CanvasKit = {
Path: {
// public API (from C++ and JS bindings)
+ CanInterpolate: function() {},
MakeFromCmds: function() {},
+ MakeFromPathInterpolation: function() {},
MakeFromSVGString: function() {},
MakeFromOp: function() {},
MakeFromVerbsPointsWeights: function() {},
@@ -563,6 +582,7 @@ var CanvasKit = {
prototype: {
addArc: function() {},
+ addCircle: function() {},
addOval: function() {},
addPath: function() {},
addPoly: function() {},
@@ -601,6 +621,7 @@ var CanvasKit = {
_MakeFromCmds: function() {},
_MakeFromVerbsPointsWeights: function() {},
_addArc: function() {},
+ _addCircle: function() {},
_addOval: function() {},
_addPath: function() {},
_addPoly: function() {},
diff --git a/chromium/third_party/skia/modules/canvaskit/gm_bindings.cpp b/chromium/third_party/skia/modules/canvaskit/gm_bindings.cpp
index 1133809cf6f..46c5974f70a 100644
--- a/chromium/third_party/skia/modules/canvaskit/gm_bindings.cpp
+++ b/chromium/third_party/skia/modules/canvaskit/gm_bindings.cpp
@@ -219,7 +219,8 @@ static skiatest::Test getTestWithName(std::string name, bool* ok) {
}
}
*ok = false;
- return skiatest::Test(nullptr, /*gpu*/ false, /*graphite*/ false, nullptr);
+ return skiatest::Test(nullptr, /*gpu*/ false, /*graphite*/ false,
+ CtsEnforcement::kNever, nullptr);
}
// Based on DM.cpp:run_test
diff --git a/chromium/third_party/skia/modules/canvaskit/go/gold_test_env/gold_test_env.go b/chromium/third_party/skia/modules/canvaskit/go/gold_test_env/gold_test_env.go
index fd4420300fd..a4033df7564 100644
--- a/chromium/third_party/skia/modules/canvaskit/go/gold_test_env/gold_test_env.go
+++ b/chromium/third_party/skia/modules/canvaskit/go/gold_test_env/gold_test_env.go
@@ -82,6 +82,8 @@ func beginTestManagementLogic(listener net.Listener) {
// test_002
// outputs.zip # contains test_001 and test_002
// This environment var is documented in https://bazel.build/reference/test-encyclopedia
+ // Note that Bazel expects a zip executable to be present on this machine in order to do this.
+ // https://github.com/bazelbuild/bazel/blob/b9ffc16b94c1ee101031b0c010453847bdc532d1/tools/test/test-setup.sh#L425
outPath := os.Getenv("TEST_UNDECLARED_OUTPUTS_DIR")
if outPath == "" {
panic("output directory was not configured")
@@ -103,11 +105,16 @@ func beginTestManagementLogic(listener net.Listener) {
// Write the data in the POST to the special Bazel output directory
fileContents, err := base64.StdEncoding.DecodeString(payload.Base64Data)
if err != nil {
- fmt.Printf("Invalid base64 data: %s\n", err.Error())
+ fmt.Printf("Invalid base64 data: %s\n", err.Error())
http.Error(w, "Invalid base64 data "+err.Error(), http.StatusBadRequest)
return
}
- fp := filepath.Join(outPath, payload.TestName)
+ fileName := payload.TestName
+ if payload.Config != "" {
+ fileName += "." + payload.Config
+ }
+
+ fp := filepath.Join(outPath, fileName+".png")
// Two newlines here makes the log stick out more.
fmt.Printf("Writing test data to %s\n\n", fp)
out, err := os.Create(fp)
@@ -137,6 +144,11 @@ func beginTestManagementLogic(listener net.Listener) {
type testPayload struct {
TestName string `json:"name"`
Base64Data string `json:"b64_data"`
+ // Config, if set, will be added as a suffix before the .png in the file name
+ // e.g. test_name.html_canvas.png. This will be parsed before uploading to Gold to be used
+ // as the value for the "config" key. This allows us to have different variants of the same
+ // test to compare and contrast.
+ Config string `json:"config"`
}
// readPayload reads the body of the given request as JSON and parses it into a testPayload struct.
diff --git a/chromium/third_party/skia/modules/canvaskit/interface.js b/chromium/third_party/skia/modules/canvaskit/interface.js
index 70d749cf575..1cf44ba1b2c 100644
--- a/chromium/third_party/skia/modules/canvaskit/interface.js
+++ b/chromium/third_party/skia/modules/canvaskit/interface.js
@@ -78,6 +78,11 @@ CanvasKit.onRuntimeInitialized = function() {
return this;
};
+ CanvasKit.Path.prototype.addCircle = function(x, y, r, isCCW) {
+ this._addCircle(x, y, r, !!isCCW);
+ return this;
+ };
+
CanvasKit.Path.prototype.addOval = function(oval, isCCW, startIndex) {
if (startIndex === undefined) {
startIndex = 1;
@@ -360,6 +365,7 @@ CanvasKit.onRuntimeInitialized = function() {
}
return this;
};
+
// isComplement is optional, defaults to false
CanvasKit.Path.prototype.trim = function(startT, stopT, isComplement) {
if (this._trim(startT, stopT, !!isComplement)) {
@@ -390,7 +396,7 @@ CanvasKit.onRuntimeInitialized = function() {
return this._makeShaderOptions(xTileMode, yTileMode, filterMode, mipmapMode, localMatrixPtr);
};
- function readPixels(source, srcX, srcY, imageInfo, destMallocObj, bytesPerRow) {
+ function readPixels(source, srcX, srcY, imageInfo, destMallocObj, bytesPerRow, grCtx) {
if (!bytesPerRow) {
bytesPerRow = 4 * imageInfo['width'];
if (imageInfo['colorType'] === CanvasKit.ColorType.RGBA_F16) {
@@ -408,7 +414,13 @@ CanvasKit.onRuntimeInitialized = function() {
pPtr = CanvasKit._malloc(pBytes);
}
- if (!source._readPixels(imageInfo, pPtr, bytesPerRow, srcX, srcY)) {
+ var rv;
+ if (grCtx) {
+ rv = source._readPixels(imageInfo, pPtr, bytesPerRow, srcX, srcY, grCtx);
+ } else {
+ rv = source._readPixels(imageInfo, pPtr, bytesPerRow, srcX, srcY);
+ }
+ if (!rv) {
Debug('Could not read pixels with the given inputs');
if (!destMallocObj) {
CanvasKit._free(pPtr);
@@ -444,7 +456,8 @@ CanvasKit.onRuntimeInitialized = function() {
CanvasKit.Image.prototype.readPixels = function(srcX, srcY, imageInfo, destMallocObj,
bytesPerRow) {
- return readPixels(this, srcX, srcY, imageInfo, destMallocObj, bytesPerRow);
+ var grCtx = CanvasKit.getCurrentGrDirectContext();
+ return readPixels(this, srcX, srcY, imageInfo, destMallocObj, bytesPerRow, grCtx);
};
// Accepts an array of four numbers in the range of 0-1 representing a 4f color
@@ -821,9 +834,10 @@ CanvasKit.onRuntimeInitialized = function() {
return ok;
};
- CanvasKit.ColorFilter.MakeBlend = function(color4f, mode) {
+ CanvasKit.ColorFilter.MakeBlend = function(color4f, mode, colorSpace) {
var cPtr = copyColorToWasm(color4f);
- return CanvasKit.ColorFilter._MakeBlend(cPtr, mode);
+ colorSpace = colorSpace || CanvasKit.ColorSpace.SRGB;
+ return CanvasKit.ColorFilter._MakeBlend(cPtr, mode, colorSpace);
};
// colorMatrix is an ColorMatrix (e.g. Float32Array of length 20)
@@ -848,6 +862,32 @@ CanvasKit.onRuntimeInitialized = function() {
return ta.slice();
};
+ CanvasKit.ImageFilter.MakeDropShadow = function(dx, dy, sx, sy, color, input) {
+ var cPtr = copyColorToWasm(color, _scratchColorPtr);
+ return CanvasKit.ImageFilter._MakeDropShadow(dx, dy, sx, sy, cPtr, input);
+ };
+
+ CanvasKit.ImageFilter.MakeDropShadowOnly = function(dx, dy, sx, sy, color, input) {
+ var cPtr = copyColorToWasm(color, _scratchColorPtr);
+ return CanvasKit.ImageFilter._MakeDropShadowOnly(dx, dy, sx, sy, cPtr, input);
+ };
+
+ CanvasKit.ImageFilter.MakeImage = function(img, sampling, srcRect, dstRect) {
+ var srcPtr = copyRectToWasm(srcRect, _scratchFourFloatsAPtr);
+ var dstPtr = copyRectToWasm(dstRect, _scratchFourFloatsBPtr);
+
+ if ('B' in sampling && 'C' in sampling) {
+ return CanvasKit.ImageFilter._MakeImageCubic(img, sampling.B, sampling.C, srcPtr, dstPtr);
+ } else {
+ const filter = sampling['filter']; // 'filter' is a required field
+ let mipmap = CanvasKit.MipmapMode.None;
+ if ('mipmap' in sampling) { // 'mipmap' is optional
+ mipmap = sampling['mipmap'];
+ }
+ return CanvasKit.ImageFilter._MakeImageOptions(img, filter, mipmap, srcPtr, dstPtr);
+ }
+ };
+
CanvasKit.ImageFilter.MakeMatrixTransform = function(matrix, sampling, input) {
var matrPtr = copy3x3MatrixToWasm(matrix);
@@ -934,7 +974,7 @@ CanvasKit.onRuntimeInitialized = function() {
return s;
};
- CanvasKit.Surface.prototype.requestAnimationFrame = function(callback, dirtyRect) {
+ CanvasKit.Surface.prototype._requestAnimationFrameInternal = function(callback, dirtyRect) {
if (!this._cached_canvas) {
this._cached_canvas = this.getCanvas();
}
@@ -949,10 +989,14 @@ CanvasKit.onRuntimeInitialized = function() {
this.flush(dirtyRect);
}.bind(this));
};
+ if (!CanvasKit.Surface.prototype.requestAnimationFrame) {
+ CanvasKit.Surface.prototype.requestAnimationFrame =
+ CanvasKit.Surface.prototype._requestAnimationFrameInternal;
+ }
// drawOnce will dispose of the surface after drawing the frame using the provided
// callback.
- CanvasKit.Surface.prototype.drawOnce = function(callback, dirtyRect) {
+ CanvasKit.Surface.prototype._drawOnceInternal = function(callback, dirtyRect) {
if (!this._cached_canvas) {
this._cached_canvas = this.getCanvas();
}
@@ -964,6 +1008,9 @@ CanvasKit.onRuntimeInitialized = function() {
this.dispose();
}.bind(this));
};
+ if (!CanvasKit.Surface.prototype.drawOnce) {
+ CanvasKit.Surface.prototype.drawOnce = CanvasKit.Surface.prototype._drawOnceInternal;
+ }
CanvasKit.PathEffect.MakeDash = function(intervals, phase) {
if (!phase) {
diff --git a/chromium/third_party/skia/modules/canvaskit/memory.js b/chromium/third_party/skia/modules/canvaskit/memory.js
index 152468a9147..df0ba6bd50b 100644
--- a/chromium/third_party/skia/modules/canvaskit/memory.js
+++ b/chromium/third_party/skia/modules/canvaskit/memory.js
@@ -284,7 +284,8 @@ function copy4x4MatrixToWasm(matr) {
// skip col 2
wasm4x4Matrix[7] = matr[5];
- // skip row 2
+ // row2 == identity
+ wasm4x4Matrix[10] = 1;
wasm4x4Matrix[12] = matr[6];
wasm4x4Matrix[13] = matr[7];
diff --git a/chromium/third_party/skia/modules/canvaskit/npm_build/example.html b/chromium/third_party/skia/modules/canvaskit/npm_build/example.html
index a1945806171..3bfddc9020e 100644
--- a/chromium/third_party/skia/modules/canvaskit/npm_build/example.html
+++ b/chromium/third_party/skia/modules/canvaskit/npm_build/example.html
@@ -15,7 +15,7 @@
</style>
-<h2>Drop in replacement for HTML Canvas (e.g. node.js)</h2>
+<h2> Drop in replacement for HTML Canvas (e.g. node.js)</h2>
<img id=api1 width=300 height=300>
<canvas id=api1_c width=300 height=300></canvas>
<img id=api2 width=300 height=300>
@@ -33,27 +33,27 @@
<img id=api8 width=300 height=300>
<canvas id=api8_c width=300 height=300></canvas>
-<h2> CanvasKit expands the functionality of a stock HTML canvas</h2>
+<h2 id=title1> CanvasKit expands the functionality of a stock HTML canvas</h2>
<canvas id=vertex1 width=300 height=300></canvas>
<canvas id=gradient1 width=300 height=300></canvas>
<canvas id=patheffect width=300 height=300></canvas>
-<canvas id=paths width=200 height=200></canvas>
+<canvas id=paths width=300 height=300></canvas>
<canvas id=pathperson width=300 height=300></canvas>
<canvas id=ink width=300 height=300></canvas>
<canvas id=surfaces width=300 height=300></canvas>
<canvas id=atlas width=300 height=300></canvas>
<canvas id=decode width=300 height=300></canvas>
-<h2> CanvasKit can allow for text measurement/placement (e.g. breaking, kerning)</h2>
+<h2 id=title2> CanvasKit can allow for text measurement/placement (e.g. breaking, kerning)</h2>
<canvas id=textonpath width=300 height=300></canvas>
<canvas id=drawGlyphs width=300 height=300></canvas>
-<h2> Interactive drawPatch</h2>
+<h2 id=title3> Interactive drawPatch</h2>
<canvas id=interdrawpatch width=512 height=512></canvas>
<script type="text/javascript" src="/build/canvaskit.js"></script>
-<script type="text/javascript" charset="utf-8">
+<script type="text/javascript" charset="utf-8" async>
var CanvasKit = null;
var cdn = 'https://storage.googleapis.com/skia-cdn/misc/';
@@ -64,17 +64,41 @@
const loadNotoSerif = fetch(cdn + 'NotoSerif-Regular.ttf').then((response) => response.arrayBuffer());
const loadTestImage = fetch(cdn + 'test.png').then((response) => response.arrayBuffer());
+ async function initWebGpu(CK) {
+ if (navigator.gpu && CK.webgpu) {
+ const adapter = await navigator.gpu.requestAdapter();
+ const device = await adapter.requestDevice();
+ var gpu = CK.MakeGPUDeviceContext(device);
+ if (!gpu) {
+ console.error('Failed to initialize WebGPU device context');
+ }
+ return gpu;
+ }
+ return null;
+ }
+
+ const ready = async function() {
+ let CK = await ckLoaded;
+ let gpu = await initWebGpu(CK);
+ return [CK, gpu];
+ }();
+
// Examples which only require canvaskit
- ckLoaded.then((CK) => {
+ ready.then((initData) => {
+ const [CK, gpu] = initData;
+ if (gpu) {
+ let titles = ['title1', 'title2', 'title3'];
+ titles.forEach((title) => document.getElementById(title).innerText += " (using WebGPU)");
+ }
CanvasKit = CK;
PathExample(CanvasKit);
- InkExample(CanvasKit);
- PathPersonExample(CanvasKit);
- VertexAPI1(CanvasKit);
- GradiantAPI1(CanvasKit);
- TextOnPathAPI1(CanvasKit);
- DrawGlyphsAPI1(CanvasKit);
- SurfaceAPI1(CanvasKit);
+ InkExample(CanvasKit, gpu);
+ PathPersonExample(CanvasKit, gpu);
+ VertexAPI1(CanvasKit, gpu);
+ GradientAPI1(CanvasKit, gpu);
+ TextOnPathAPI1(CanvasKit, gpu);
+ DrawGlyphsAPI1(CanvasKit, gpu);
+ SurfaceAPI1(CanvasKit, gpu);
if (CanvasKit.MakeCanvas){
CanvasAPI1(CanvasKit);
CanvasAPI2(CanvasKit);
@@ -87,19 +111,38 @@
} else {
console.log("Skipping CanvasAPI1 because it's not compiled in");
}
- InteractivePatch(CanvasKit);
+ InteractivePatch(CanvasKit, gpu);
});
// Examples requiring external resources
- Promise.all([ckLoaded, loadRoboto]).then((results) => {DrawingExample(...results)});
- Promise.all([ckLoaded, loadTestImage]).then((results) => {AtlasAPI1(...results)});
+ Promise.all([ready, loadRoboto]).then((results) => {DrawingExample(...results.flat())});
+ Promise.all([ready, loadTestImage]).then((results) => {AtlasAPI1(...results.flat())});
Promise.all([ckLoaded, loadTestImage]).then((results) => {DecodeAPI(...results)});
- function DrawingExample(CanvasKit, robotoData) {
+ // Helper function to create an optional WebGPU canvas surface, if WebGPU is supported. Falls back
+ // to CanvasKit.MakeCanvasSurface for SW/WebGL otherwise.
+ function MakeCanvasSurface(CanvasKit, gpu, canvasId) {
+ if (gpu) {
+ const canvasContext = CanvasKit.MakeGPUCanvasContext(
+ gpu, document.getElementById(canvasId));
+ if (!canvasContext) {
+ console.error('Failed to configure WebGPU canvas context');
+ return;
+ }
+ const surface = CanvasKit.MakeGPUCanvasSurface(canvasContext);
+ if (!surface) {
+ console.error('Failed to initialize current swapchain Surface');
+ }
+ return surface;
+ }
+ return CanvasKit.MakeCanvasSurface(canvasId);
+ }
+
+ function DrawingExample(CanvasKit, gpu, robotoData) {
if (!robotoData || !CanvasKit) {
return;
}
- const surface = CanvasKit.MakeCanvasSurface('patheffect');
+ const surface = MakeCanvasSurface(CanvasKit, gpu, 'patheffect');
if (!surface) {
console.error('Could not make surface');
return;
@@ -161,9 +204,9 @@
// textFont.delete();
}
- function InteractivePatch(CanvasKit) {
+ function InteractivePatch(CanvasKit, gpu) {
const ELEM = 'interdrawpatch';
- const surface = CanvasKit.MakeCanvasSurface(ELEM);
+ const surface = MakeCanvasSurface(CanvasKit, gpu, ELEM);
if (!surface) {
console.error('Could not make surface');
return;
@@ -221,10 +264,8 @@
canvas.drawPoints(CanvasKit.PointMode.Polygon, live_corner, line_paint);
}
canvas.drawPoints(CanvasKit.PointMode.Points, cubics, pts_paint);
-
surface.requestAnimationFrame(drawFrame);
}
-
surface.requestAnimationFrame(drawFrame);
function length2(x, y) {
@@ -274,8 +315,8 @@
preventScrolling(document.getElementById(ELEM));
}
- function PathPersonExample(CanvasKit) {
- const surface = CanvasKit.MakeSWCanvasSurface('pathperson');
+ function PathPersonExample(CanvasKit, gpu) {
+ const surface = MakeCanvasSurface(CanvasKit, gpu, 'pathperson');
if (!surface) {
console.error('Could not make surface');
return;
@@ -366,8 +407,8 @@
});
}
- function InkExample(CanvasKit) {
- const surface = CanvasKit.MakeCanvasSurface('ink');
+ function InkExample(CanvasKit, gpu) {
+ const surface = MakeCanvasSurface(CanvasKit, gpu, 'ink');
if (!surface) {
console.error('Could not make surface');
return;
@@ -974,8 +1015,8 @@
skcanvas.dispose();
}
- function VertexAPI1(CanvasKit) {
- const surface = CanvasKit.MakeCanvasSurface('vertex1');
+ function VertexAPI1(CanvasKit, gpu) {
+ const surface = MakeCanvasSurface(CanvasKit, gpu, 'vertex1');
if (!surface) {
console.error('Could not make surface');
return;
@@ -1013,10 +1054,11 @@
shader.delete();
paint.delete();
surface.delete();
+ vertices.delete();
}
- function GradiantAPI1(CanvasKit) {
- const surface = CanvasKit.MakeSWCanvasSurface('gradient1');
+ function GradientAPI1(CanvasKit, gpu) {
+ const surface = MakeCanvasSurface(CanvasKit, gpu, 'gradient1');
if (!surface) {
console.error('Could not make surface');
return;
@@ -1039,14 +1081,16 @@
const textBlob = CanvasKit.TextBlob.MakeFromText('Radial', textFont);
canvas.drawTextBlob(textBlob, 10, 200, paint);
+ surface.flush();
paint.delete();
textFont.delete();
textBlob.delete();
- surface.flush();
+ shader.delete();
+ surface.delete();
}
- function TextOnPathAPI1(CanvasKit) {
- const surface = CanvasKit.MakeSWCanvasSurface('textonpath');
+ function TextOnPathAPI1(CanvasKit, gpu) {
+ const surface = MakeCanvasSurface(CanvasKit, gpu, 'textonpath');
if (!surface) {
console.error('Could not make surface');
return;
@@ -1074,6 +1118,7 @@
surface.flush();
+ surface.delete();
textBlob.delete();
arc.delete();
paint.delete();
@@ -1081,34 +1126,35 @@
fontPaint.delete();
}
- function DrawGlyphsAPI1(CanvasKit) {
- const surface = CanvasKit.MakeSWCanvasSurface('drawGlyphs');
- if (!surface) {
- console.error('Could not make surface');
- return;
- }
- const canvas = surface.getCanvas();
- const paint = new CanvasKit.Paint();
- const font = new CanvasKit.Font(null, 16);
- paint.setAntiAlias(true);
-
- let glyphs = [];
- let positions = [];
- for (let i = 0; i < 256; ++i) {
- glyphs.push(i);
- positions.push((i % 16) * 16);
- positions.push(Math.round(i/16) * 16);
- }
- canvas.drawGlyphs(glyphs, positions, 16, 20, font, paint);
-
- surface.flush();
+ function DrawGlyphsAPI1(CanvasKit, gpu) {
+ const surface = MakeCanvasSurface(CanvasKit, gpu, 'drawGlyphs');
+ if (!surface) {
+ console.error('Could not make surface');
+ return;
+ }
+ const canvas = surface.getCanvas();
+ const paint = new CanvasKit.Paint();
+ const font = new CanvasKit.Font(null, 16);
+ paint.setAntiAlias(true);
- paint.delete();
- font.delete();
+ let glyphs = [];
+ let positions = [];
+ for (let i = 0; i < 256; ++i) {
+ glyphs.push(i);
+ positions.push((i % 16) * 16);
+ positions.push(Math.round(i/16) * 16);
}
+ canvas.drawGlyphs(glyphs, positions, 16, 20, font, paint);
- function SurfaceAPI1(CanvasKit) {
- const surface = CanvasKit.MakeCanvasSurface('surfaces');
+ surface.flush();
+
+ surface.delete();
+ paint.delete();
+ font.delete();
+ }
+
+ function SurfaceAPI1(CanvasKit, gpu) {
+ const surface = MakeCanvasSurface(CanvasKit, gpu, 'surfaces');
if (!surface) {
console.error('Could not make surface');
return;
@@ -1161,28 +1207,27 @@
patternPaint.setShader(pattern);
let i = 0;
-
function drawFrame(canvas) {
i++;
canvas.clear(CanvasKit.WHITE);
-
canvas.drawOval(CanvasKit.LTRBRect(i % 60, i % 60, 300 - (i% 60), 300 - (i % 60)), patternPaint);
surface.requestAnimationFrame(drawFrame);
}
surface.requestAnimationFrame(drawFrame);
}
- function AtlasAPI1(CanvasKit, imgData) {
+ function AtlasAPI1(CanvasKit, gpu, imgData) {
if (!CanvasKit || !imgData) {
return;
}
- const surface = CanvasKit.MakeCanvasSurface('atlas');
+
+ const surface = MakeCanvasSurface(CanvasKit, gpu, 'atlas');
if (!surface) {
console.error('Could not make surface');
return;
}
- const img = CanvasKit.MakeImageFromEncoded(imgData);
+ const img = CanvasKit.MakeImageFromEncoded(imgData);
const paint = new CanvasKit.Paint();
paint.setColor(CanvasKit.Color(0, 0, 0, 0.8));
@@ -1225,7 +1270,6 @@
surface.requestAnimationFrame(drawFrame);
}
surface.requestAnimationFrame(drawFrame);
-
}
async function DecodeAPI(CanvasKit, imgData) {
diff --git a/chromium/third_party/skia/modules/canvaskit/npm_build/package-lock.json b/chromium/third_party/skia/modules/canvaskit/npm_build/package-lock.json
index af3c5d3c955..cebabc83aa3 100644
--- a/chromium/third_party/skia/modules/canvaskit/npm_build/package-lock.json
+++ b/chromium/third_party/skia/modules/canvaskit/npm_build/package-lock.json
@@ -1,40 +1,2239 @@
{
"name": "canvaskit-wasm",
- "version": "0.34.1",
- "lockfileVersion": 1,
+ "version": "0.36.0",
+ "lockfileVersion": 2,
"requires": true,
+ "packages": {
+ "": {
+ "name": "canvaskit-wasm",
+ "version": "0.36.0",
+ "license": "BSD-3-Clause",
+ "devDependencies": {
+ "@definitelytyped/header-parser": "0.0.121",
+ "@webgpu/types": "0.1.21",
+ "dtslint": "4.2.1",
+ "typescript": "4.7.4"
+ }
+ },
+ "node_modules/@definitelytyped/header-parser": {
+ "version": "0.0.121",
+ "resolved": "https://registry.npmjs.org/@definitelytyped/header-parser/-/header-parser-0.0.121.tgz",
+ "integrity": "sha512-78HY1J+QiwZPXFZQWb9gPQPxAMNg6/1e4gl7gL/8dmd17vVWLi3AGrLJoG8Pn1p8d7MF2rlPw/2AE6+r1IHNHA==",
+ "dev": true,
+ "dependencies": {
+ "@definitelytyped/typescript-versions": "^0.0.121",
+ "@types/parsimmon": "^1.10.1",
+ "parsimmon": "^1.13.0"
+ }
+ },
+ "node_modules/@definitelytyped/typescript-versions": {
+ "version": "0.0.121",
+ "resolved": "https://registry.npmjs.org/@definitelytyped/typescript-versions/-/typescript-versions-0.0.121.tgz",
+ "integrity": "sha512-mTfkR7MrGo08lzOPZx3ZgIER9PoalRZok3hmrsLDxTUhS5lrgdgXBOpAyDMtnJUAO6AxrIx126XGlkN+1rvKcA==",
+ "dev": true
+ },
+ "node_modules/@definitelytyped/utils": {
+ "version": "0.0.121",
+ "resolved": "https://registry.npmjs.org/@definitelytyped/utils/-/utils-0.0.121.tgz",
+ "integrity": "sha512-H2g09ZJcmCk0BAy86M/UcMP4pq0UGaKBGpjPjPe5btKgZDB6A1Tn1/TKd46cQ6grhFdsxJFE5cb8XWGTKkpA8w==",
+ "dev": true,
+ "dependencies": {
+ "@definitelytyped/typescript-versions": "^0.0.121",
+ "@qiwi/npm-registry-client": "^8.9.1",
+ "@types/node": "^14.14.35",
+ "charm": "^1.0.2",
+ "fs-extra": "^8.1.0",
+ "fstream": "^1.0.12",
+ "tar": "^6.1.11",
+ "tar-stream": "^2.1.4"
+ }
+ },
+ "node_modules/@definitelytyped/utils/node_modules/fs-extra": {
+ "version": "8.1.0",
+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
+ "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",
+ "dev": true,
+ "dependencies": {
+ "graceful-fs": "^4.2.0",
+ "jsonfile": "^4.0.0",
+ "universalify": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=6 <7 || >=8"
+ }
+ },
+ "node_modules/@qiwi/npm-registry-client": {
+ "version": "8.9.1",
+ "resolved": "https://registry.npmjs.org/@qiwi/npm-registry-client/-/npm-registry-client-8.9.1.tgz",
+ "integrity": "sha512-rZF+mG+NfijR0SHphhTLHRr4aM4gtfdwoAMY6we2VGQam8vkN1cxGG1Lg/Llrj8Dd0Mu6VjdFQRyMMRZxtZR2A==",
+ "dev": true,
+ "dependencies": {
+ "concat-stream": "^2.0.0",
+ "graceful-fs": "^4.2.4",
+ "normalize-package-data": "~1.0.1 || ^2.0.0 || ^3.0.0",
+ "npm-package-arg": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^8.0.0",
+ "once": "^1.4.0",
+ "request": "^2.88.2",
+ "retry": "^0.12.0",
+ "safe-buffer": "^5.2.1",
+ "semver": "2 >=2.2.1 || 3.x || 4 || 5 || 7",
+ "slide": "^1.1.6",
+ "ssri": "^8.0.0"
+ },
+ "optionalDependencies": {
+ "npmlog": "2 || ^3.1.0 || ^4.0.0"
+ }
+ },
+ "node_modules/@types/node": {
+ "version": "14.18.21",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.21.tgz",
+ "integrity": "sha512-x5W9s+8P4XteaxT/jKF0PSb7XEvo5VmqEWgsMlyeY4ZlLK8I6aH6g5TPPyDlLAep+GYf4kefb7HFyc7PAO3m+Q==",
+ "dev": true
+ },
+ "node_modules/@types/parsimmon": {
+ "version": "1.10.6",
+ "resolved": "https://registry.npmjs.org/@types/parsimmon/-/parsimmon-1.10.6.tgz",
+ "integrity": "sha512-FwAQwMRbkhx0J6YELkwIpciVzCcgEqXEbIrIn3a2P5d3kGEHQ3wVhlN3YdVepYP+bZzCYO6OjmD4o9TGOZ40rA==",
+ "dev": true
+ },
+ "node_modules/@webgpu/types": {
+ "version": "0.1.21",
+ "resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.21.tgz",
+ "integrity": "sha512-pUrWq3V5PiSGFLeLxoGqReTZmiiXwY3jRkIG5sLLKjyqNxrwm/04b4nw7LSmGWJcKk59XOM/YRTUwOzo4MMlow==",
+ "dev": true
+ },
+ "node_modules/ajv": {
+ "version": "6.12.6",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
+ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
+ "dev": true,
+ "dependencies": {
+ "fast-deep-equal": "^3.1.1",
+ "fast-json-stable-stringify": "^2.0.0",
+ "json-schema-traverse": "^0.4.1",
+ "uri-js": "^4.2.2"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/epoberezkin"
+ }
+ },
+ "node_modules/ansi-regex": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
+ "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/ansi-styles": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
+ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
+ "dev": true,
+ "dependencies": {
+ "color-convert": "^1.9.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/aproba": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz",
+ "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==",
+ "dev": true,
+ "optional": true
+ },
+ "node_modules/are-we-there-yet": {
+ "version": "1.1.7",
+ "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.7.tgz",
+ "integrity": "sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g==",
+ "dev": true,
+ "optional": true,
+ "dependencies": {
+ "delegates": "^1.0.0",
+ "readable-stream": "^2.0.6"
+ }
+ },
+ "node_modules/are-we-there-yet/node_modules/readable-stream": {
+ "version": "2.3.7",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
+ "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
+ "dev": true,
+ "optional": true,
+ "dependencies": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.3",
+ "isarray": "~1.0.0",
+ "process-nextick-args": "~2.0.0",
+ "safe-buffer": "~5.1.1",
+ "string_decoder": "~1.1.1",
+ "util-deprecate": "~1.0.1"
+ }
+ },
+ "node_modules/are-we-there-yet/node_modules/safe-buffer": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
+ "dev": true,
+ "optional": true
+ },
+ "node_modules/are-we-there-yet/node_modules/string_decoder": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
+ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
+ "dev": true,
+ "optional": true,
+ "dependencies": {
+ "safe-buffer": "~5.1.0"
+ }
+ },
+ "node_modules/argparse": {
+ "version": "1.0.10",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
+ "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
+ "dev": true,
+ "dependencies": {
+ "sprintf-js": "~1.0.2"
+ }
+ },
+ "node_modules/asn1": {
+ "version": "0.2.6",
+ "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz",
+ "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==",
+ "dev": true,
+ "dependencies": {
+ "safer-buffer": "~2.1.0"
+ }
+ },
+ "node_modules/assert-plus": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
+ "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.8"
+ }
+ },
+ "node_modules/asynckit": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
+ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
+ "dev": true
+ },
+ "node_modules/aws-sign2": {
+ "version": "0.7.0",
+ "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
+ "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==",
+ "dev": true,
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/aws4": {
+ "version": "1.11.0",
+ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz",
+ "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==",
+ "dev": true
+ },
+ "node_modules/babel-code-frame": {
+ "version": "6.26.0",
+ "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
+ "integrity": "sha512-XqYMR2dfdGMW+hd0IUZ2PwK+fGeFkOxZJ0wY+JaQAHzt1Zx8LcvpiZD2NiGkEG8qx0CfkAOr5xt76d1e8vG90g==",
+ "dev": true,
+ "dependencies": {
+ "chalk": "^1.1.3",
+ "esutils": "^2.0.2",
+ "js-tokens": "^3.0.2"
+ }
+ },
+ "node_modules/babel-code-frame/node_modules/ansi-styles": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
+ "integrity": "sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/babel-code-frame/node_modules/chalk": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
+ "integrity": "sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==",
+ "dev": true,
+ "dependencies": {
+ "ansi-styles": "^2.2.1",
+ "escape-string-regexp": "^1.0.2",
+ "has-ansi": "^2.0.0",
+ "strip-ansi": "^3.0.0",
+ "supports-color": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/babel-code-frame/node_modules/supports-color": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
+ "integrity": "sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.8.0"
+ }
+ },
+ "node_modules/balanced-match": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
+ "dev": true
+ },
+ "node_modules/base64-js": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
+ "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ]
+ },
+ "node_modules/bcrypt-pbkdf": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
+ "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==",
+ "dev": true,
+ "dependencies": {
+ "tweetnacl": "^0.14.3"
+ }
+ },
+ "node_modules/bl": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
+ "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
+ "dev": true,
+ "dependencies": {
+ "buffer": "^5.5.0",
+ "inherits": "^2.0.4",
+ "readable-stream": "^3.4.0"
+ }
+ },
+ "node_modules/brace-expansion": {
+ "version": "1.1.11",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+ "dev": true,
+ "dependencies": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "node_modules/buffer": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
+ "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "dependencies": {
+ "base64-js": "^1.3.1",
+ "ieee754": "^1.1.13"
+ }
+ },
+ "node_modules/buffer-from": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
+ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
+ "dev": true
+ },
+ "node_modules/builtin-modules": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
+ "integrity": "sha512-wxXCdllwGhI2kCC0MnvTGYTMvnVZTvqgypkiTI8Pa5tcz2i6VqsqwYGgqwXji+4RgCzms6EajE4IxiUH6HH8nQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/builtins": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/builtins/-/builtins-1.0.3.tgz",
+ "integrity": "sha512-uYBjakWipfaO/bXI7E8rq6kpwHRZK5cNYrUv2OzZSI/FvmdMyXJ2tG9dKcjEC5YHmHpUAwsargWIZNWdxb/bnQ==",
+ "dev": true
+ },
+ "node_modules/camelcase": {
+ "version": "5.3.1",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
+ "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/caseless": {
+ "version": "0.12.0",
+ "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
+ "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==",
+ "dev": true
+ },
+ "node_modules/chalk": {
+ "version": "2.4.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
+ "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
+ "dev": true,
+ "dependencies": {
+ "ansi-styles": "^3.2.1",
+ "escape-string-regexp": "^1.0.5",
+ "supports-color": "^5.3.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/charm": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/charm/-/charm-1.0.2.tgz",
+ "integrity": "sha512-wqW3VdPnlSWT4eRiYX+hcs+C6ViBPUWk1qTCd+37qw9kEm/a5n2qcyQDMBWvSYKN/ctqZzeXNQaeBjOetJJUkw==",
+ "dev": true,
+ "dependencies": {
+ "inherits": "^2.0.1"
+ }
+ },
+ "node_modules/chownr": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
+ "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/cliui": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
+ "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==",
+ "dev": true,
+ "dependencies": {
+ "string-width": "^4.2.0",
+ "strip-ansi": "^6.0.0",
+ "wrap-ansi": "^6.2.0"
+ }
+ },
+ "node_modules/cliui/node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/cliui/node_modules/is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/cliui/node_modules/string-width": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "dev": true,
+ "dependencies": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/cliui/node_modules/strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "dev": true,
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/code-point-at": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
+ "integrity": "sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==",
+ "dev": true,
+ "optional": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/color-convert": {
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
+ "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
+ "dev": true,
+ "dependencies": {
+ "color-name": "1.1.3"
+ }
+ },
+ "node_modules/color-name": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
+ "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
+ "dev": true
+ },
+ "node_modules/combined-stream": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
+ "dev": true,
+ "dependencies": {
+ "delayed-stream": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/command-exists": {
+ "version": "1.2.9",
+ "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz",
+ "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==",
+ "dev": true
+ },
+ "node_modules/commander": {
+ "version": "2.20.3",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
+ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
+ "dev": true
+ },
+ "node_modules/concat-map": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
+ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
+ "dev": true
+ },
+ "node_modules/concat-stream": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-2.0.0.tgz",
+ "integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==",
+ "dev": true,
+ "engines": [
+ "node >= 6.0"
+ ],
+ "dependencies": {
+ "buffer-from": "^1.0.0",
+ "inherits": "^2.0.3",
+ "readable-stream": "^3.0.2",
+ "typedarray": "^0.0.6"
+ }
+ },
+ "node_modules/console-control-strings": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
+ "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==",
+ "dev": true,
+ "optional": true
+ },
+ "node_modules/core-util-is": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
+ "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==",
+ "dev": true
+ },
+ "node_modules/dashdash": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
+ "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==",
+ "dev": true,
+ "dependencies": {
+ "assert-plus": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=0.10"
+ }
+ },
+ "node_modules/decamelize": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
+ "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/delayed-stream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
+ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/delegates": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
+ "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==",
+ "dev": true,
+ "optional": true
+ },
+ "node_modules/diff": {
+ "version": "3.5.0",
+ "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",
+ "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.3.1"
+ }
+ },
+ "node_modules/dts-critic": {
+ "version": "3.3.11",
+ "resolved": "https://registry.npmjs.org/dts-critic/-/dts-critic-3.3.11.tgz",
+ "integrity": "sha512-HMO2f9AO7ge44YO8OK18f+cxm/IaE1CFuyNFbfJRCEbyazWj5X5wWDF6W4CGdo5Ax0ILYVfJ7L/rOwuUN1fzWw==",
+ "dev": true,
+ "dependencies": {
+ "@definitelytyped/header-parser": "latest",
+ "command-exists": "^1.2.8",
+ "rimraf": "^3.0.2",
+ "semver": "^6.2.0",
+ "tmp": "^0.2.1",
+ "yargs": "^15.3.1"
+ },
+ "engines": {
+ "node": ">=10.17.0"
+ },
+ "peerDependencies": {
+ "typescript": "*"
+ }
+ },
+ "node_modules/dts-critic/node_modules/semver": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "dev": true,
+ "bin": {
+ "semver": "bin/semver.js"
+ }
+ },
+ "node_modules/dtslint": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/dtslint/-/dtslint-4.2.1.tgz",
+ "integrity": "sha512-57mWY9osUEfS6k62ATS9RSgug1dZcuN4O31hO76u+iEexa6VUEbKoPGaA2mNtc0FQDcdTl0zEUtti79UQKSQyQ==",
+ "dev": true,
+ "dependencies": {
+ "@definitelytyped/header-parser": "latest",
+ "@definitelytyped/typescript-versions": "latest",
+ "@definitelytyped/utils": "latest",
+ "dts-critic": "latest",
+ "fs-extra": "^6.0.1",
+ "json-stable-stringify": "^1.0.1",
+ "strip-json-comments": "^2.0.1",
+ "tslint": "5.14.0",
+ "tsutils": "^2.29.0",
+ "yargs": "^15.1.0"
+ },
+ "bin": {
+ "dtslint": "bin/index.js"
+ },
+ "engines": {
+ "node": ">=10.0.0"
+ },
+ "peerDependencies": {
+ "typescript": ">= 3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.7.0-dev || >= 3.8.0-dev || >= 3.9.0-dev || >= 4.0.0-dev"
+ }
+ },
+ "node_modules/ecc-jsbn": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
+ "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==",
+ "dev": true,
+ "dependencies": {
+ "jsbn": "~0.1.0",
+ "safer-buffer": "^2.1.0"
+ }
+ },
+ "node_modules/emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "dev": true
+ },
+ "node_modules/end-of-stream": {
+ "version": "1.4.4",
+ "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
+ "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
+ "dev": true,
+ "dependencies": {
+ "once": "^1.4.0"
+ }
+ },
+ "node_modules/escape-string-regexp": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
+ "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.8.0"
+ }
+ },
+ "node_modules/esprima": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
+ "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
+ "dev": true,
+ "bin": {
+ "esparse": "bin/esparse.js",
+ "esvalidate": "bin/esvalidate.js"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/esutils": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
+ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/extend": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
+ "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",
+ "dev": true
+ },
+ "node_modules/extsprintf": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
+ "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==",
+ "dev": true,
+ "engines": [
+ "node >=0.6.0"
+ ]
+ },
+ "node_modules/fast-deep-equal": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
+ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
+ "dev": true
+ },
+ "node_modules/fast-json-stable-stringify": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
+ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
+ "dev": true
+ },
+ "node_modules/find-up": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
+ "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
+ "dev": true,
+ "dependencies": {
+ "locate-path": "^5.0.0",
+ "path-exists": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/forever-agent": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
+ "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==",
+ "dev": true,
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/form-data": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
+ "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
+ "dev": true,
+ "dependencies": {
+ "asynckit": "^0.4.0",
+ "combined-stream": "^1.0.6",
+ "mime-types": "^2.1.12"
+ },
+ "engines": {
+ "node": ">= 0.12"
+ }
+ },
+ "node_modules/fs-constants": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
+ "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==",
+ "dev": true
+ },
+ "node_modules/fs-extra": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-6.0.1.tgz",
+ "integrity": "sha512-GnyIkKhhzXZUWFCaJzvyDLEEgDkPfb4/TPvJCJVuS8MWZgoSsErf++QpiAlDnKFcqhRlm+tIOcencCjyJE6ZCA==",
+ "dev": true,
+ "dependencies": {
+ "graceful-fs": "^4.1.2",
+ "jsonfile": "^4.0.0",
+ "universalify": "^0.1.0"
+ }
+ },
+ "node_modules/fs-minipass": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",
+ "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==",
+ "dev": true,
+ "dependencies": {
+ "minipass": "^3.0.0"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/fs.realpath": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
+ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
+ "dev": true
+ },
+ "node_modules/fstream": {
+ "version": "1.0.12",
+ "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz",
+ "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==",
+ "dev": true,
+ "dependencies": {
+ "graceful-fs": "^4.1.2",
+ "inherits": "~2.0.0",
+ "mkdirp": ">=0.5 0",
+ "rimraf": "2"
+ },
+ "engines": {
+ "node": ">=0.6"
+ }
+ },
+ "node_modules/fstream/node_modules/rimraf": {
+ "version": "2.7.1",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
+ "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
+ "dev": true,
+ "dependencies": {
+ "glob": "^7.1.3"
+ },
+ "bin": {
+ "rimraf": "bin.js"
+ }
+ },
+ "node_modules/function-bind": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
+ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
+ "dev": true
+ },
+ "node_modules/gauge": {
+ "version": "2.7.4",
+ "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz",
+ "integrity": "sha512-14x4kjc6lkD3ltw589k0NrPD6cCNTD6CWoVUNpB85+DrtONoZn+Rug6xZU5RvSC4+TZPxA5AnBibQYAvZn41Hg==",
+ "dev": true,
+ "optional": true,
+ "dependencies": {
+ "aproba": "^1.0.3",
+ "console-control-strings": "^1.0.0",
+ "has-unicode": "^2.0.0",
+ "object-assign": "^4.1.0",
+ "signal-exit": "^3.0.0",
+ "string-width": "^1.0.1",
+ "strip-ansi": "^3.0.1",
+ "wide-align": "^1.1.0"
+ }
+ },
+ "node_modules/get-caller-file": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
+ "dev": true,
+ "engines": {
+ "node": "6.* || 8.* || >= 10.*"
+ }
+ },
+ "node_modules/getpass": {
+ "version": "0.1.7",
+ "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
+ "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==",
+ "dev": true,
+ "dependencies": {
+ "assert-plus": "^1.0.0"
+ }
+ },
+ "node_modules/glob": {
+ "version": "7.2.3",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
+ "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
+ "dev": true,
+ "dependencies": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.1.1",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ },
+ "engines": {
+ "node": "*"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/graceful-fs": {
+ "version": "4.2.10",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz",
+ "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==",
+ "dev": true
+ },
+ "node_modules/har-schema": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
+ "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==",
+ "dev": true,
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/har-validator": {
+ "version": "5.1.5",
+ "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz",
+ "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==",
+ "deprecated": "this library is no longer supported",
+ "dev": true,
+ "dependencies": {
+ "ajv": "^6.12.3",
+ "har-schema": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/has": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
+ "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
+ "dev": true,
+ "dependencies": {
+ "function-bind": "^1.1.1"
+ },
+ "engines": {
+ "node": ">= 0.4.0"
+ }
+ },
+ "node_modules/has-ansi": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
+ "integrity": "sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg==",
+ "dev": true,
+ "dependencies": {
+ "ansi-regex": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/has-flag": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
+ "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
+ "dev": true,
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/has-unicode": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
+ "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==",
+ "dev": true,
+ "optional": true
+ },
+ "node_modules/hosted-git-info": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz",
+ "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==",
+ "dev": true,
+ "dependencies": {
+ "lru-cache": "^6.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/http-signature": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
+ "integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==",
+ "dev": true,
+ "dependencies": {
+ "assert-plus": "^1.0.0",
+ "jsprim": "^1.2.2",
+ "sshpk": "^1.7.0"
+ },
+ "engines": {
+ "node": ">=0.8",
+ "npm": ">=1.3.7"
+ }
+ },
+ "node_modules/ieee754": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
+ "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ]
+ },
+ "node_modules/inflight": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
+ "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
+ "dev": true,
+ "dependencies": {
+ "once": "^1.3.0",
+ "wrappy": "1"
+ }
+ },
+ "node_modules/inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+ "dev": true
+ },
+ "node_modules/is-core-module": {
+ "version": "2.9.0",
+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz",
+ "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==",
+ "dev": true,
+ "dependencies": {
+ "has": "^1.0.3"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-fullwidth-code-point": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
+ "integrity": "sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==",
+ "dev": true,
+ "optional": true,
+ "dependencies": {
+ "number-is-nan": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-typedarray": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
+ "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==",
+ "dev": true
+ },
+ "node_modules/isarray": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
+ "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",
+ "dev": true,
+ "optional": true
+ },
+ "node_modules/isstream": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
+ "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==",
+ "dev": true
+ },
+ "node_modules/js-tokens": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
+ "integrity": "sha512-RjTcuD4xjtthQkaWH7dFlH85L+QaVtSoOyGdZ3g6HFhS9dFNDfLyqgm2NFe2X6cQpeFmt0452FJjFG5UameExg==",
+ "dev": true
+ },
+ "node_modules/js-yaml": {
+ "version": "3.14.1",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz",
+ "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
+ "dev": true,
+ "dependencies": {
+ "argparse": "^1.0.7",
+ "esprima": "^4.0.0"
+ },
+ "bin": {
+ "js-yaml": "bin/js-yaml.js"
+ }
+ },
+ "node_modules/jsbn": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
+ "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==",
+ "dev": true
+ },
+ "node_modules/json-schema": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz",
+ "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==",
+ "dev": true
+ },
+ "node_modules/json-schema-traverse": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
+ "dev": true
+ },
+ "node_modules/json-stable-stringify": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz",
+ "integrity": "sha512-i/J297TW6xyj7sDFa7AmBPkQvLIxWr2kKPWI26tXydnZrzVAocNqn5DMNT1Mzk0vit1V5UkRM7C1KdVNp7Lmcg==",
+ "dev": true,
+ "dependencies": {
+ "jsonify": "~0.0.0"
+ }
+ },
+ "node_modules/json-stringify-safe": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
+ "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==",
+ "dev": true
+ },
+ "node_modules/jsonfile": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
+ "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==",
+ "dev": true,
+ "optionalDependencies": {
+ "graceful-fs": "^4.1.6"
+ }
+ },
+ "node_modules/jsonify": {
+ "version": "0.0.0",
+ "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz",
+ "integrity": "sha512-trvBk1ki43VZptdBI5rIlG4YOzyeH/WefQt5rj1grasPn4iiZWKet8nkgc4GlsAylaztn0qZfUYOiTsASJFdNA==",
+ "dev": true,
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/jsprim": {
+ "version": "1.4.2",
+ "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz",
+ "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==",
+ "dev": true,
+ "dependencies": {
+ "assert-plus": "1.0.0",
+ "extsprintf": "1.3.0",
+ "json-schema": "0.4.0",
+ "verror": "1.10.0"
+ },
+ "engines": {
+ "node": ">=0.6.0"
+ }
+ },
+ "node_modules/locate-path": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
+ "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
+ "dev": true,
+ "dependencies": {
+ "p-locate": "^4.1.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/lru-cache": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
+ "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
+ "dev": true,
+ "dependencies": {
+ "yallist": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/mime-db": {
+ "version": "1.52.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime-types": {
+ "version": "2.1.35",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
+ "dev": true,
+ "dependencies": {
+ "mime-db": "1.52.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/minimatch": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
+ "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
+ "dev": true,
+ "dependencies": {
+ "brace-expansion": "^1.1.7"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/minimist": {
+ "version": "1.2.6",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
+ "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
+ "dev": true
+ },
+ "node_modules/minipass": {
+ "version": "3.3.4",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.4.tgz",
+ "integrity": "sha512-I9WPbWHCGu8W+6k1ZiGpPu0GkoKBeorkfKNuAFBNS1HNFJvke82sxvI5bzcCNpWPorkOO5QQ+zomzzwRxejXiw==",
+ "dev": true,
+ "dependencies": {
+ "yallist": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/minizlib": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz",
+ "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==",
+ "dev": true,
+ "dependencies": {
+ "minipass": "^3.0.0",
+ "yallist": "^4.0.0"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/mkdirp": {
+ "version": "0.5.6",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",
+ "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",
+ "dev": true,
+ "dependencies": {
+ "minimist": "^1.2.6"
+ },
+ "bin": {
+ "mkdirp": "bin/cmd.js"
+ }
+ },
+ "node_modules/normalize-package-data": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz",
+ "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==",
+ "dev": true,
+ "dependencies": {
+ "hosted-git-info": "^4.0.1",
+ "is-core-module": "^2.5.0",
+ "semver": "^7.3.4",
+ "validate-npm-package-license": "^3.0.1"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/npm-package-arg": {
+ "version": "8.1.5",
+ "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-8.1.5.tgz",
+ "integrity": "sha512-LhgZrg0n0VgvzVdSm1oiZworPbTxYHUJCgtsJW8mGvlDpxTM1vSJc3m5QZeUkhAHIzbz3VCHd/R4osi1L1Tg/Q==",
+ "dev": true,
+ "dependencies": {
+ "hosted-git-info": "^4.0.1",
+ "semver": "^7.3.4",
+ "validate-npm-package-name": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/npmlog": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz",
+ "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==",
+ "dev": true,
+ "optional": true,
+ "dependencies": {
+ "are-we-there-yet": "~1.1.2",
+ "console-control-strings": "~1.1.0",
+ "gauge": "~2.7.3",
+ "set-blocking": "~2.0.0"
+ }
+ },
+ "node_modules/number-is-nan": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
+ "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==",
+ "dev": true,
+ "optional": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/oauth-sign": {
+ "version": "0.9.0",
+ "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
+ "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==",
+ "dev": true,
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
+ "dev": true,
+ "optional": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/once": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
+ "dev": true,
+ "dependencies": {
+ "wrappy": "1"
+ }
+ },
+ "node_modules/p-limit": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
+ "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
+ "dev": true,
+ "dependencies": {
+ "p-try": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/p-locate": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
+ "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
+ "dev": true,
+ "dependencies": {
+ "p-limit": "^2.2.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/p-try": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
+ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/parsimmon": {
+ "version": "1.18.1",
+ "resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-1.18.1.tgz",
+ "integrity": "sha512-u7p959wLfGAhJpSDJVYXoyMCXWYwHia78HhRBWqk7AIbxdmlrfdp5wX0l3xv/iTSH5HvhN9K7o26hwwpgS5Nmw==",
+ "dev": true
+ },
+ "node_modules/path-exists": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
+ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/path-is-absolute": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
+ "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/path-parse": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
+ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
+ "dev": true
+ },
+ "node_modules/performance-now": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
+ "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==",
+ "dev": true
+ },
+ "node_modules/process-nextick-args": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
+ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==",
+ "dev": true,
+ "optional": true
+ },
+ "node_modules/psl": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz",
+ "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==",
+ "dev": true
+ },
+ "node_modules/punycode": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
+ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/qs": {
+ "version": "6.5.3",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz",
+ "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.6"
+ }
+ },
+ "node_modules/readable-stream": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
+ "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
+ "dev": true,
+ "dependencies": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/request": {
+ "version": "2.88.2",
+ "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz",
+ "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==",
+ "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142",
+ "dev": true,
+ "dependencies": {
+ "aws-sign2": "~0.7.0",
+ "aws4": "^1.8.0",
+ "caseless": "~0.12.0",
+ "combined-stream": "~1.0.6",
+ "extend": "~3.0.2",
+ "forever-agent": "~0.6.1",
+ "form-data": "~2.3.2",
+ "har-validator": "~5.1.3",
+ "http-signature": "~1.2.0",
+ "is-typedarray": "~1.0.0",
+ "isstream": "~0.1.2",
+ "json-stringify-safe": "~5.0.1",
+ "mime-types": "~2.1.19",
+ "oauth-sign": "~0.9.0",
+ "performance-now": "^2.1.0",
+ "qs": "~6.5.2",
+ "safe-buffer": "^5.1.2",
+ "tough-cookie": "~2.5.0",
+ "tunnel-agent": "^0.6.0",
+ "uuid": "^3.3.2"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/require-directory": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
+ "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/require-main-filename": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
+ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
+ "dev": true
+ },
+ "node_modules/resolve": {
+ "version": "1.22.1",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz",
+ "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==",
+ "dev": true,
+ "dependencies": {
+ "is-core-module": "^2.9.0",
+ "path-parse": "^1.0.7",
+ "supports-preserve-symlinks-flag": "^1.0.0"
+ },
+ "bin": {
+ "resolve": "bin/resolve"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/retry": {
+ "version": "0.12.0",
+ "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz",
+ "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==",
+ "dev": true,
+ "engines": {
+ "node": ">= 4"
+ }
+ },
+ "node_modules/rimraf": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
+ "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
+ "dev": true,
+ "dependencies": {
+ "glob": "^7.1.3"
+ },
+ "bin": {
+ "rimraf": "bin.js"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/safe-buffer": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ]
+ },
+ "node_modules/safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+ "dev": true
+ },
+ "node_modules/semver": {
+ "version": "7.3.7",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
+ "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
+ "dev": true,
+ "dependencies": {
+ "lru-cache": "^6.0.0"
+ },
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/set-blocking": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
+ "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",
+ "dev": true
+ },
+ "node_modules/signal-exit": {
+ "version": "3.0.7",
+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
+ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
+ "dev": true,
+ "optional": true
+ },
+ "node_modules/slide": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz",
+ "integrity": "sha512-NwrtjCg+lZoqhFU8fOwl4ay2ei8PaqCBOUV3/ektPY9trO1yQ1oXEfmHAhKArUVUr/hOHvy5f6AdP17dCM0zMw==",
+ "dev": true,
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/spdx-correct": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz",
+ "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==",
+ "dev": true,
+ "dependencies": {
+ "spdx-expression-parse": "^3.0.0",
+ "spdx-license-ids": "^3.0.0"
+ }
+ },
+ "node_modules/spdx-exceptions": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz",
+ "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==",
+ "dev": true
+ },
+ "node_modules/spdx-expression-parse": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz",
+ "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==",
+ "dev": true,
+ "dependencies": {
+ "spdx-exceptions": "^2.1.0",
+ "spdx-license-ids": "^3.0.0"
+ }
+ },
+ "node_modules/spdx-license-ids": {
+ "version": "3.0.11",
+ "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.11.tgz",
+ "integrity": "sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==",
+ "dev": true
+ },
+ "node_modules/sprintf-js": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
+ "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==",
+ "dev": true
+ },
+ "node_modules/sshpk": {
+ "version": "1.17.0",
+ "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz",
+ "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==",
+ "dev": true,
+ "dependencies": {
+ "asn1": "~0.2.3",
+ "assert-plus": "^1.0.0",
+ "bcrypt-pbkdf": "^1.0.0",
+ "dashdash": "^1.12.0",
+ "ecc-jsbn": "~0.1.1",
+ "getpass": "^0.1.1",
+ "jsbn": "~0.1.0",
+ "safer-buffer": "^2.0.2",
+ "tweetnacl": "~0.14.0"
+ },
+ "bin": {
+ "sshpk-conv": "bin/sshpk-conv",
+ "sshpk-sign": "bin/sshpk-sign",
+ "sshpk-verify": "bin/sshpk-verify"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/ssri": {
+ "version": "8.0.1",
+ "resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz",
+ "integrity": "sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ==",
+ "dev": true,
+ "dependencies": {
+ "minipass": "^3.1.1"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/string_decoder": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
+ "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
+ "dev": true,
+ "dependencies": {
+ "safe-buffer": "~5.2.0"
+ }
+ },
+ "node_modules/string-width": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
+ "integrity": "sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==",
+ "dev": true,
+ "optional": true,
+ "dependencies": {
+ "code-point-at": "^1.0.0",
+ "is-fullwidth-code-point": "^1.0.0",
+ "strip-ansi": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/strip-ansi": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
+ "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==",
+ "dev": true,
+ "dependencies": {
+ "ansi-regex": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/strip-json-comments": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
+ "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/supports-color": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "dev": true,
+ "dependencies": {
+ "has-flag": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/supports-preserve-symlinks-flag": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
+ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/tar": {
+ "version": "6.1.11",
+ "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz",
+ "integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==",
+ "dev": true,
+ "dependencies": {
+ "chownr": "^2.0.0",
+ "fs-minipass": "^2.0.0",
+ "minipass": "^3.0.0",
+ "minizlib": "^2.1.1",
+ "mkdirp": "^1.0.3",
+ "yallist": "^4.0.0"
+ },
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/tar-stream": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz",
+ "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
+ "dev": true,
+ "dependencies": {
+ "bl": "^4.0.3",
+ "end-of-stream": "^1.4.1",
+ "fs-constants": "^1.0.0",
+ "inherits": "^2.0.3",
+ "readable-stream": "^3.1.1"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/tar/node_modules/mkdirp": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
+ "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
+ "dev": true,
+ "bin": {
+ "mkdirp": "bin/cmd.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/tmp": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz",
+ "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==",
+ "dev": true,
+ "dependencies": {
+ "rimraf": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8.17.0"
+ }
+ },
+ "node_modules/tough-cookie": {
+ "version": "2.5.0",
+ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
+ "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
+ "dev": true,
+ "dependencies": {
+ "psl": "^1.1.28",
+ "punycode": "^2.1.1"
+ },
+ "engines": {
+ "node": ">=0.8"
+ }
+ },
+ "node_modules/tslib": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
+ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
+ "dev": true
+ },
+ "node_modules/tslint": {
+ "version": "5.14.0",
+ "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.14.0.tgz",
+ "integrity": "sha512-IUla/ieHVnB8Le7LdQFRGlVJid2T/gaJe5VkjzRVSRR6pA2ODYrnfR1hmxi+5+au9l50jBwpbBL34txgv4NnTQ==",
+ "dev": true,
+ "dependencies": {
+ "babel-code-frame": "^6.22.0",
+ "builtin-modules": "^1.1.1",
+ "chalk": "^2.3.0",
+ "commander": "^2.12.1",
+ "diff": "^3.2.0",
+ "glob": "^7.1.1",
+ "js-yaml": "^3.7.0",
+ "minimatch": "^3.0.4",
+ "mkdirp": "^0.5.1",
+ "resolve": "^1.3.2",
+ "semver": "^5.3.0",
+ "tslib": "^1.8.0",
+ "tsutils": "^2.29.0"
+ },
+ "bin": {
+ "tslint": "bin/tslint"
+ },
+ "engines": {
+ "node": ">=4.8.0"
+ },
+ "peerDependencies": {
+ "typescript": ">=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >=3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev"
+ }
+ },
+ "node_modules/tslint/node_modules/semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true,
+ "bin": {
+ "semver": "bin/semver"
+ }
+ },
+ "node_modules/tsutils": {
+ "version": "2.29.0",
+ "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz",
+ "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==",
+ "dev": true,
+ "dependencies": {
+ "tslib": "^1.8.1"
+ },
+ "peerDependencies": {
+ "typescript": ">=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >= 3.0.0-dev || >= 3.1.0-dev"
+ }
+ },
+ "node_modules/tunnel-agent": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
+ "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
+ "dev": true,
+ "dependencies": {
+ "safe-buffer": "^5.0.1"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/tweetnacl": {
+ "version": "0.14.5",
+ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
+ "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==",
+ "dev": true
+ },
+ "node_modules/typedarray": {
+ "version": "0.0.6",
+ "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
+ "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==",
+ "dev": true
+ },
+ "node_modules/typescript": {
+ "version": "4.7.4",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz",
+ "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==",
+ "dev": true,
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=4.2.0"
+ }
+ },
+ "node_modules/universalify": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
+ "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
+ "dev": true,
+ "engines": {
+ "node": ">= 4.0.0"
+ }
+ },
+ "node_modules/uri-js": {
+ "version": "4.4.1",
+ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
+ "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
+ "dev": true,
+ "dependencies": {
+ "punycode": "^2.1.0"
+ }
+ },
+ "node_modules/util-deprecate": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
+ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
+ "dev": true
+ },
+ "node_modules/uuid": {
+ "version": "3.4.0",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
+ "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
+ "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
+ "dev": true,
+ "bin": {
+ "uuid": "bin/uuid"
+ }
+ },
+ "node_modules/validate-npm-package-license": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
+ "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==",
+ "dev": true,
+ "dependencies": {
+ "spdx-correct": "^3.0.0",
+ "spdx-expression-parse": "^3.0.0"
+ }
+ },
+ "node_modules/validate-npm-package-name": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz",
+ "integrity": "sha512-M6w37eVCMMouJ9V/sdPGnC5H4uDr73/+xdq0FBLO3TFFX1+7wiUY6Es328NN+y43tmY+doUdN9g9J21vqB7iLw==",
+ "dev": true,
+ "dependencies": {
+ "builtins": "^1.0.3"
+ }
+ },
+ "node_modules/verror": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
+ "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==",
+ "dev": true,
+ "engines": [
+ "node >=0.6.0"
+ ],
+ "dependencies": {
+ "assert-plus": "^1.0.0",
+ "core-util-is": "1.0.2",
+ "extsprintf": "^1.2.0"
+ }
+ },
+ "node_modules/which-module": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
+ "integrity": "sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q==",
+ "dev": true
+ },
+ "node_modules/wide-align": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz",
+ "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==",
+ "dev": true,
+ "optional": true,
+ "dependencies": {
+ "string-width": "^1.0.2 || 2 || 3 || 4"
+ }
+ },
+ "node_modules/wrap-ansi": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
+ "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
+ "dev": true,
+ "dependencies": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/wrap-ansi/node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/wrap-ansi/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "dev": true,
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/wrap-ansi/node_modules/color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "dependencies": {
+ "color-name": "~1.1.4"
+ },
+ "engines": {
+ "node": ">=7.0.0"
+ }
+ },
+ "node_modules/wrap-ansi/node_modules/color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/wrap-ansi/node_modules/string-width": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "dev": true,
+ "dependencies": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/wrap-ansi/node_modules/strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "dev": true,
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
+ "dev": true
+ },
+ "node_modules/y18n": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz",
+ "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==",
+ "dev": true
+ },
+ "node_modules/yallist": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
+ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
+ "dev": true
+ },
+ "node_modules/yargs": {
+ "version": "15.4.1",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz",
+ "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==",
+ "dev": true,
+ "dependencies": {
+ "cliui": "^6.0.0",
+ "decamelize": "^1.2.0",
+ "find-up": "^4.1.0",
+ "get-caller-file": "^2.0.1",
+ "require-directory": "^2.1.1",
+ "require-main-filename": "^2.0.0",
+ "set-blocking": "^2.0.0",
+ "string-width": "^4.2.0",
+ "which-module": "^2.0.0",
+ "y18n": "^4.0.0",
+ "yargs-parser": "^18.1.2"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/yargs-parser": {
+ "version": "18.1.3",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz",
+ "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==",
+ "dev": true,
+ "dependencies": {
+ "camelcase": "^5.0.0",
+ "decamelize": "^1.2.0"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/yargs/node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/yargs/node_modules/is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/yargs/node_modules/string-width": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "dev": true,
+ "dependencies": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/yargs/node_modules/strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "dev": true,
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ }
+ },
"dependencies": {
"@definitelytyped/header-parser": {
- "version": "0.0.57",
- "resolved": "https://registry.npmjs.org/@definitelytyped/header-parser/-/header-parser-0.0.57.tgz",
- "integrity": "sha512-0CNcUUANv93072vleKkXKT8xUNk9JLhaHVMZbBYP/km55T+V8eGCP6BS0pS80MPhvZouq2FmR/r8B5jlR+MQ8w==",
+ "version": "0.0.121",
+ "resolved": "https://registry.npmjs.org/@definitelytyped/header-parser/-/header-parser-0.0.121.tgz",
+ "integrity": "sha512-78HY1J+QiwZPXFZQWb9gPQPxAMNg6/1e4gl7gL/8dmd17vVWLi3AGrLJoG8Pn1p8d7MF2rlPw/2AE6+r1IHNHA==",
"dev": true,
"requires": {
- "@definitelytyped/typescript-versions": "^0.0.57",
+ "@definitelytyped/typescript-versions": "^0.0.121",
"@types/parsimmon": "^1.10.1",
"parsimmon": "^1.13.0"
}
},
"@definitelytyped/typescript-versions": {
- "version": "0.0.57",
- "resolved": "https://registry.npmjs.org/@definitelytyped/typescript-versions/-/typescript-versions-0.0.57.tgz",
- "integrity": "sha512-PpA1dLjH//4fvZ6P5RVR10n+it0lBp/so3dgSAHdFmtHU42kPFc2TlwIYSDL0P5DcNVYViAwIvIIVbYF9hbD+Q==",
+ "version": "0.0.121",
+ "resolved": "https://registry.npmjs.org/@definitelytyped/typescript-versions/-/typescript-versions-0.0.121.tgz",
+ "integrity": "sha512-mTfkR7MrGo08lzOPZx3ZgIER9PoalRZok3hmrsLDxTUhS5lrgdgXBOpAyDMtnJUAO6AxrIx126XGlkN+1rvKcA==",
"dev": true
},
"@definitelytyped/utils": {
- "version": "0.0.57",
- "resolved": "https://registry.npmjs.org/@definitelytyped/utils/-/utils-0.0.57.tgz",
- "integrity": "sha512-YEIxwB2Im0GQ0lapCpoW+m3XeQqctf0aueuVbm2lNESZCVMgLXVSFaTIquhgKcp/KW+HzVldwH7RyEnbTZiWQw==",
+ "version": "0.0.121",
+ "resolved": "https://registry.npmjs.org/@definitelytyped/utils/-/utils-0.0.121.tgz",
+ "integrity": "sha512-H2g09ZJcmCk0BAy86M/UcMP4pq0UGaKBGpjPjPe5btKgZDB6A1Tn1/TKd46cQ6grhFdsxJFE5cb8XWGTKkpA8w==",
"dev": true,
"requires": {
- "@definitelytyped/typescript-versions": "^0.0.57",
- "@types/node": "^12.12.29",
+ "@definitelytyped/typescript-versions": "^0.0.121",
+ "@qiwi/npm-registry-client": "^8.9.1",
+ "@types/node": "^14.14.35",
"charm": "^1.0.2",
"fs-extra": "^8.1.0",
"fstream": "^1.0.12",
- "npm-registry-client": "^8.6.0",
- "tar": "^2.2.2",
- "tar-stream": "1.6.2"
+ "tar": "^6.1.11",
+ "tar-stream": "^2.1.4"
},
"dependencies": {
"fs-extra": {
@@ -50,22 +2249,48 @@
}
}
},
+ "@qiwi/npm-registry-client": {
+ "version": "8.9.1",
+ "resolved": "https://registry.npmjs.org/@qiwi/npm-registry-client/-/npm-registry-client-8.9.1.tgz",
+ "integrity": "sha512-rZF+mG+NfijR0SHphhTLHRr4aM4gtfdwoAMY6we2VGQam8vkN1cxGG1Lg/Llrj8Dd0Mu6VjdFQRyMMRZxtZR2A==",
+ "dev": true,
+ "requires": {
+ "concat-stream": "^2.0.0",
+ "graceful-fs": "^4.2.4",
+ "normalize-package-data": "~1.0.1 || ^2.0.0 || ^3.0.0",
+ "npm-package-arg": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^8.0.0",
+ "npmlog": "2 || ^3.1.0 || ^4.0.0",
+ "once": "^1.4.0",
+ "request": "^2.88.2",
+ "retry": "^0.12.0",
+ "safe-buffer": "^5.2.1",
+ "semver": "2 >=2.2.1 || 3.x || 4 || 5 || 7",
+ "slide": "^1.1.6",
+ "ssri": "^8.0.0"
+ }
+ },
"@types/node": {
- "version": "12.12.64",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.64.tgz",
- "integrity": "sha512-UV1/ZJMC+HcP902wWdpC43cAcGu0IQk/I5bXjP2aSuCjsk3cE74mDvFrLKga7oDC170ugOAYBwfT4DSQW3akDA==",
+ "version": "14.18.21",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.21.tgz",
+ "integrity": "sha512-x5W9s+8P4XteaxT/jKF0PSb7XEvo5VmqEWgsMlyeY4ZlLK8I6aH6g5TPPyDlLAep+GYf4kefb7HFyc7PAO3m+Q==",
"dev": true
},
"@types/parsimmon": {
- "version": "1.10.3",
- "resolved": "https://registry.npmjs.org/@types/parsimmon/-/parsimmon-1.10.3.tgz",
- "integrity": "sha512-BbCYdfYC/XFsVkjWJCeCaUaeYlMHNJ2HmZYaCbsZ14k6qO/mX6n3u2sgtJxSeJLiDPaxb1LESgGA/qGP+AHSCQ==",
+ "version": "1.10.6",
+ "resolved": "https://registry.npmjs.org/@types/parsimmon/-/parsimmon-1.10.6.tgz",
+ "integrity": "sha512-FwAQwMRbkhx0J6YELkwIpciVzCcgEqXEbIrIn3a2P5d3kGEHQ3wVhlN3YdVepYP+bZzCYO6OjmD4o9TGOZ40rA==",
+ "dev": true
+ },
+ "@webgpu/types": {
+ "version": "0.1.21",
+ "resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.21.tgz",
+ "integrity": "sha512-pUrWq3V5PiSGFLeLxoGqReTZmiiXwY3jRkIG5sLLKjyqNxrwm/04b4nw7LSmGWJcKk59XOM/YRTUwOzo4MMlow==",
"dev": true
},
"ajv": {
- "version": "6.12.5",
- "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.5.tgz",
- "integrity": "sha512-lRF8RORchjpKG50/WFf8xmg7sgCLFiYNNnqdKflk63whMQcWR5ngGjiSXkL9bjxy6B2npOK2HSMN49jEBMSkag==",
+ "version": "6.12.6",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
+ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
"dev": true,
"requires": {
"fast-deep-equal": "^3.1.1",
@@ -77,16 +2302,16 @@
"ansi-regex": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
- "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
+ "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==",
"dev": true
},
"ansi-styles": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
- "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
+ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"dev": true,
"requires": {
- "color-convert": "^2.0.1"
+ "color-convert": "^1.9.0"
}
},
"aproba": {
@@ -97,14 +2322,49 @@
"optional": true
},
"are-we-there-yet": {
- "version": "1.1.5",
- "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz",
- "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==",
+ "version": "1.1.7",
+ "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.7.tgz",
+ "integrity": "sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g==",
"dev": true,
"optional": true,
"requires": {
"delegates": "^1.0.0",
"readable-stream": "^2.0.6"
+ },
+ "dependencies": {
+ "readable-stream": {
+ "version": "2.3.7",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
+ "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.3",
+ "isarray": "~1.0.0",
+ "process-nextick-args": "~2.0.0",
+ "safe-buffer": "~5.1.1",
+ "string_decoder": "~1.1.1",
+ "util-deprecate": "~1.0.1"
+ }
+ },
+ "safe-buffer": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
+ "dev": true,
+ "optional": true
+ },
+ "string_decoder": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
+ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "safe-buffer": "~5.1.0"
+ }
+ }
}
},
"argparse": {
@@ -117,9 +2377,9 @@
}
},
"asn1": {
- "version": "0.2.4",
- "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz",
- "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==",
+ "version": "0.2.6",
+ "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz",
+ "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==",
"dev": true,
"requires": {
"safer-buffer": "~2.1.0"
@@ -128,31 +2388,31 @@
"assert-plus": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
- "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
+ "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==",
"dev": true
},
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
- "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=",
+ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
"dev": true
},
"aws-sign2": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
- "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=",
+ "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==",
"dev": true
},
"aws4": {
- "version": "1.10.1",
- "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.1.tgz",
- "integrity": "sha512-zg7Hz2k5lI8kb7U32998pRRFin7zJlkfezGJjUc2heaD4Pw2wObakCDVzkKztTm/Ln7eiVvYsjqak0Ed4LkMDA==",
+ "version": "1.11.0",
+ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz",
+ "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==",
"dev": true
},
"babel-code-frame": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
- "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=",
+ "integrity": "sha512-XqYMR2dfdGMW+hd0IUZ2PwK+fGeFkOxZJ0wY+JaQAHzt1Zx8LcvpiZD2NiGkEG8qx0CfkAOr5xt76d1e8vG90g==",
"dev": true,
"requires": {
"chalk": "^1.1.3",
@@ -163,13 +2423,13 @@
"ansi-styles": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
- "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
+ "integrity": "sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==",
"dev": true
},
"chalk": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
- "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
+ "integrity": "sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==",
"dev": true,
"requires": {
"ansi-styles": "^2.2.1",
@@ -178,41 +2438,45 @@
"strip-ansi": "^3.0.0",
"supports-color": "^2.0.0"
}
+ },
+ "supports-color": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
+ "integrity": "sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==",
+ "dev": true
}
}
},
"balanced-match": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
- "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
+ "dev": true
+ },
+ "base64-js": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
+ "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
"dev": true
},
"bcrypt-pbkdf": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
- "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=",
+ "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==",
"dev": true,
"requires": {
"tweetnacl": "^0.14.3"
}
},
"bl": {
- "version": "1.2.3",
- "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz",
- "integrity": "sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww==",
- "dev": true,
- "requires": {
- "readable-stream": "^2.3.5",
- "safe-buffer": "^5.1.1"
- }
- },
- "block-stream": {
- "version": "0.0.9",
- "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz",
- "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=",
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
+ "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
"dev": true,
"requires": {
- "inherits": "~2.0.0"
+ "buffer": "^5.5.0",
+ "inherits": "^2.0.4",
+ "readable-stream": "^3.4.0"
}
},
"brace-expansion": {
@@ -225,44 +2489,32 @@
"concat-map": "0.0.1"
}
},
- "buffer-alloc": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz",
- "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==",
+ "buffer": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
+ "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
"dev": true,
"requires": {
- "buffer-alloc-unsafe": "^1.1.0",
- "buffer-fill": "^1.0.0"
+ "base64-js": "^1.3.1",
+ "ieee754": "^1.1.13"
}
},
- "buffer-alloc-unsafe": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz",
- "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==",
- "dev": true
- },
- "buffer-fill": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz",
- "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=",
- "dev": true
- },
"buffer-from": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
- "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==",
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
+ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
"dev": true
},
"builtin-modules": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
- "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
+ "integrity": "sha512-wxXCdllwGhI2kCC0MnvTGYTMvnVZTvqgypkiTI8Pa5tcz2i6VqsqwYGgqwXji+4RgCzms6EajE4IxiUH6HH8nQ==",
"dev": true
},
"builtins": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/builtins/-/builtins-1.0.3.tgz",
- "integrity": "sha1-y5T662HIaWRR2zZTThQi+U8K7og=",
+ "integrity": "sha512-uYBjakWipfaO/bXI7E8rq6kpwHRZK5cNYrUv2OzZSI/FvmdMyXJ2tG9dKcjEC5YHmHpUAwsargWIZNWdxb/bnQ==",
"dev": true
},
"camelcase": {
@@ -274,7 +2526,7 @@
"caseless": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
- "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=",
+ "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==",
"dev": true
},
"chalk": {
@@ -286,52 +2538,23 @@
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
- },
- "dependencies": {
- "ansi-styles": {
- "version": "3.2.1",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
- "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
- "dev": true,
- "requires": {
- "color-convert": "^1.9.0"
- }
- },
- "color-convert": {
- "version": "1.9.3",
- "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
- "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
- "dev": true,
- "requires": {
- "color-name": "1.1.3"
- }
- },
- "color-name": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
- "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
- "dev": true
- },
- "supports-color": {
- "version": "5.5.0",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
- "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
- "dev": true,
- "requires": {
- "has-flag": "^3.0.0"
- }
- }
}
},
"charm": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/charm/-/charm-1.0.2.tgz",
- "integrity": "sha1-it02cVOm2aWBMxBSxAkJkdqZXjU=",
+ "integrity": "sha512-wqW3VdPnlSWT4eRiYX+hcs+C6ViBPUWk1qTCd+37qw9kEm/a5n2qcyQDMBWvSYKN/ctqZzeXNQaeBjOetJJUkw==",
"dev": true,
"requires": {
"inherits": "^2.0.1"
}
},
+ "chownr": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
+ "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==",
+ "dev": true
+ },
"cliui": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
@@ -344,9 +2567,9 @@
},
"dependencies": {
"ansi-regex": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
- "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true
},
"is-fullwidth-code-point": {
@@ -356,23 +2579,23 @@
"dev": true
},
"string-width": {
- "version": "4.2.0",
- "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz",
- "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==",
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
"requires": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
- "strip-ansi": "^6.0.0"
+ "strip-ansi": "^6.0.1"
}
},
"strip-ansi": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
- "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"requires": {
- "ansi-regex": "^5.0.0"
+ "ansi-regex": "^5.0.1"
}
}
}
@@ -380,23 +2603,23 @@
"code-point-at": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
- "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
+ "integrity": "sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==",
"dev": true,
"optional": true
},
"color-convert": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
- "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
+ "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
"dev": true,
"requires": {
- "color-name": "~1.1.4"
+ "color-name": "1.1.3"
}
},
"color-name": {
- "version": "1.1.4",
- "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
- "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
+ "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
"dev": true
},
"combined-stream": {
@@ -423,38 +2646,38 @@
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
- "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
+ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
"dev": true
},
"concat-stream": {
- "version": "1.6.2",
- "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
- "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-2.0.0.tgz",
+ "integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==",
"dev": true,
"requires": {
"buffer-from": "^1.0.0",
"inherits": "^2.0.3",
- "readable-stream": "^2.2.2",
+ "readable-stream": "^3.0.2",
"typedarray": "^0.0.6"
}
},
"console-control-strings": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
- "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=",
+ "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==",
"dev": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
- "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
+ "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==",
"dev": true
},
"dashdash": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
- "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",
+ "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==",
"dev": true,
"requires": {
"assert-plus": "^1.0.0"
@@ -463,19 +2686,19 @@
"decamelize": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
- "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
+ "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==",
"dev": true
},
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
- "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
+ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
"dev": true
},
"delegates": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
- "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=",
+ "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==",
"dev": true,
"optional": true
},
@@ -486,12 +2709,12 @@
"dev": true
},
"dts-critic": {
- "version": "3.3.2",
- "resolved": "https://registry.npmjs.org/dts-critic/-/dts-critic-3.3.2.tgz",
- "integrity": "sha512-9rVXHAvZgdB63Au4Pile2QaPA2/2Ucuu5CsVd6MhIqFdOzjuZVnyR9cdJPgrW12mk/fSYQyMJ5b3Nuyq2ZUFoQ==",
+ "version": "3.3.11",
+ "resolved": "https://registry.npmjs.org/dts-critic/-/dts-critic-3.3.11.tgz",
+ "integrity": "sha512-HMO2f9AO7ge44YO8OK18f+cxm/IaE1CFuyNFbfJRCEbyazWj5X5wWDF6W4CGdo5Ax0ILYVfJ7L/rOwuUN1fzWw==",
"dev": true,
"requires": {
- "@definitelytyped/header-parser": "^0.0.57",
+ "@definitelytyped/header-parser": "latest",
"command-exists": "^1.2.8",
"rimraf": "^3.0.2",
"semver": "^6.2.0",
@@ -499,15 +2722,6 @@
"yargs": "^15.3.1"
},
"dependencies": {
- "rimraf": {
- "version": "3.0.2",
- "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
- "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
- "dev": true,
- "requires": {
- "glob": "^7.1.3"
- }
- },
"semver": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
@@ -517,26 +2731,27 @@
}
},
"dtslint": {
- "version": "4.0.4",
- "resolved": "https://registry.npmjs.org/dtslint/-/dtslint-4.0.4.tgz",
- "integrity": "sha512-z5+aPNcF9gRjMLH95bMPsm1AYHERo3O6wFRf+2W1qRn/0b7xh4Qs1g+i0x/Th0Z3XRIIrhrBcW3dkvXgsQ95wA==",
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/dtslint/-/dtslint-4.2.1.tgz",
+ "integrity": "sha512-57mWY9osUEfS6k62ATS9RSgug1dZcuN4O31hO76u+iEexa6VUEbKoPGaA2mNtc0FQDcdTl0zEUtti79UQKSQyQ==",
"dev": true,
"requires": {
- "@definitelytyped/header-parser": "^0.0.57",
- "@definitelytyped/typescript-versions": "^0.0.57",
- "@definitelytyped/utils": "^0.0.57",
- "dts-critic": "^3.3.2",
+ "@definitelytyped/header-parser": "latest",
+ "@definitelytyped/typescript-versions": "latest",
+ "@definitelytyped/utils": "latest",
+ "dts-critic": "latest",
"fs-extra": "^6.0.1",
"json-stable-stringify": "^1.0.1",
"strip-json-comments": "^2.0.1",
"tslint": "5.14.0",
+ "tsutils": "^2.29.0",
"yargs": "^15.1.0"
}
},
"ecc-jsbn": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
- "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=",
+ "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==",
"dev": true,
"requires": {
"jsbn": "~0.1.0",
@@ -561,7 +2776,7 @@
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
- "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
+ "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
"dev": true
},
"esprima": {
@@ -585,7 +2800,7 @@
"extsprintf": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
- "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=",
+ "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==",
"dev": true
},
"fast-deep-equal": {
@@ -613,7 +2828,7 @@
"forever-agent": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
- "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=",
+ "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==",
"dev": true
},
"form-data": {
@@ -644,10 +2859,19 @@
"universalify": "^0.1.0"
}
},
+ "fs-minipass": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",
+ "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==",
+ "dev": true,
+ "requires": {
+ "minipass": "^3.0.0"
+ }
+ },
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
- "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
+ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
"dev": true
},
"fstream": {
@@ -660,12 +2884,29 @@
"inherits": "~2.0.0",
"mkdirp": ">=0.5 0",
"rimraf": "2"
+ },
+ "dependencies": {
+ "rimraf": {
+ "version": "2.7.1",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
+ "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
+ "dev": true,
+ "requires": {
+ "glob": "^7.1.3"
+ }
+ }
}
},
+ "function-bind": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
+ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
+ "dev": true
+ },
"gauge": {
"version": "2.7.4",
"resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz",
- "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=",
+ "integrity": "sha512-14x4kjc6lkD3ltw589k0NrPD6cCNTD6CWoVUNpB85+DrtONoZn+Rug6xZU5RvSC4+TZPxA5AnBibQYAvZn41Hg==",
"dev": true,
"optional": true,
"requires": {
@@ -688,36 +2929,36 @@
"getpass": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
- "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=",
+ "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==",
"dev": true,
"requires": {
"assert-plus": "^1.0.0"
}
},
"glob": {
- "version": "7.1.6",
- "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
- "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
+ "version": "7.2.3",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
+ "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
- "minimatch": "^3.0.4",
+ "minimatch": "^3.1.1",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"graceful-fs": {
- "version": "4.2.4",
- "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
- "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
+ "version": "4.2.10",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz",
+ "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==",
"dev": true
},
"har-schema": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
- "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=",
+ "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==",
"dev": true
},
"har-validator": {
@@ -730,10 +2971,19 @@
"har-schema": "^2.0.0"
}
},
+ "has": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
+ "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
+ "dev": true,
+ "requires": {
+ "function-bind": "^1.1.1"
+ }
+ },
"has-ansi": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
- "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
+ "integrity": "sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg==",
"dev": true,
"requires": {
"ansi-regex": "^2.0.0"
@@ -742,26 +2992,29 @@
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
- "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
+ "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
"dev": true
},
"has-unicode": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
- "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=",
+ "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==",
"dev": true,
"optional": true
},
"hosted-git-info": {
- "version": "2.8.8",
- "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz",
- "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==",
- "dev": true
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz",
+ "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==",
+ "dev": true,
+ "requires": {
+ "lru-cache": "^6.0.0"
+ }
},
"http-signature": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
- "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
+ "integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==",
"dev": true,
"requires": {
"assert-plus": "^1.0.0",
@@ -769,10 +3022,16 @@
"sshpk": "^1.7.0"
}
},
+ "ieee754": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
+ "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
+ "dev": true
+ },
"inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
- "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
+ "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
"dev": true,
"requires": {
"once": "^1.3.0",
@@ -785,10 +3044,19 @@
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"dev": true
},
+ "is-core-module": {
+ "version": "2.9.0",
+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz",
+ "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==",
+ "dev": true,
+ "requires": {
+ "has": "^1.0.3"
+ }
+ },
"is-fullwidth-code-point": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
- "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
+ "integrity": "sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==",
"dev": true,
"optional": true,
"requires": {
@@ -798,31 +3066,32 @@
"is-typedarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
- "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=",
+ "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==",
"dev": true
},
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
- "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
- "dev": true
+ "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",
+ "dev": true,
+ "optional": true
},
"isstream": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
- "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=",
+ "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==",
"dev": true
},
"js-tokens": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
- "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=",
+ "integrity": "sha512-RjTcuD4xjtthQkaWH7dFlH85L+QaVtSoOyGdZ3g6HFhS9dFNDfLyqgm2NFe2X6cQpeFmt0452FJjFG5UameExg==",
"dev": true
},
"js-yaml": {
- "version": "3.14.0",
- "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz",
- "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==",
+ "version": "3.14.1",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz",
+ "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
"dev": true,
"requires": {
"argparse": "^1.0.7",
@@ -832,13 +3101,13 @@
"jsbn": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
- "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=",
+ "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==",
"dev": true
},
"json-schema": {
- "version": "0.2.3",
- "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
- "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=",
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz",
+ "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==",
"dev": true
},
"json-schema-traverse": {
@@ -850,7 +3119,7 @@
"json-stable-stringify": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz",
- "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=",
+ "integrity": "sha512-i/J297TW6xyj7sDFa7AmBPkQvLIxWr2kKPWI26tXydnZrzVAocNqn5DMNT1Mzk0vit1V5UkRM7C1KdVNp7Lmcg==",
"dev": true,
"requires": {
"jsonify": "~0.0.0"
@@ -859,13 +3128,13 @@
"json-stringify-safe": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
- "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=",
+ "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==",
"dev": true
},
"jsonfile": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
- "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
+ "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==",
"dev": true,
"requires": {
"graceful-fs": "^4.1.6"
@@ -874,18 +3143,18 @@
"jsonify": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz",
- "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=",
+ "integrity": "sha512-trvBk1ki43VZptdBI5rIlG4YOzyeH/WefQt5rj1grasPn4iiZWKet8nkgc4GlsAylaztn0qZfUYOiTsASJFdNA==",
"dev": true
},
"jsprim": {
- "version": "1.4.1",
- "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
- "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=",
+ "version": "1.4.2",
+ "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz",
+ "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==",
"dev": true,
"requires": {
"assert-plus": "1.0.0",
"extsprintf": "1.3.0",
- "json-schema": "0.2.3",
+ "json-schema": "0.4.0",
"verror": "1.10.0"
}
},
@@ -898,89 +3167,96 @@
"p-locate": "^4.1.0"
}
},
+ "lru-cache": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
+ "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
+ "dev": true,
+ "requires": {
+ "yallist": "^4.0.0"
+ }
+ },
"mime-db": {
- "version": "1.44.0",
- "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz",
- "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==",
+ "version": "1.52.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"dev": true
},
"mime-types": {
- "version": "2.1.27",
- "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz",
- "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==",
+ "version": "2.1.35",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dev": true,
"requires": {
- "mime-db": "1.44.0"
+ "mime-db": "1.52.0"
}
},
"minimatch": {
- "version": "3.0.4",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
- "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
+ "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
- "version": "1.2.5",
- "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
- "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
+ "version": "1.2.6",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
+ "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
"dev": true
},
+ "minipass": {
+ "version": "3.3.4",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.4.tgz",
+ "integrity": "sha512-I9WPbWHCGu8W+6k1ZiGpPu0GkoKBeorkfKNuAFBNS1HNFJvke82sxvI5bzcCNpWPorkOO5QQ+zomzzwRxejXiw==",
+ "dev": true,
+ "requires": {
+ "yallist": "^4.0.0"
+ }
+ },
+ "minizlib": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz",
+ "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==",
+ "dev": true,
+ "requires": {
+ "minipass": "^3.0.0",
+ "yallist": "^4.0.0"
+ }
+ },
"mkdirp": {
- "version": "0.5.5",
- "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
- "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
+ "version": "0.5.6",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",
+ "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",
"dev": true,
"requires": {
- "minimist": "^1.2.5"
+ "minimist": "^1.2.6"
}
},
"normalize-package-data": {
- "version": "2.5.0",
- "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz",
- "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==",
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz",
+ "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==",
"dev": true,
"requires": {
- "hosted-git-info": "^2.1.4",
- "resolve": "^1.10.0",
- "semver": "2 || 3 || 4 || 5",
+ "hosted-git-info": "^4.0.1",
+ "is-core-module": "^2.5.0",
+ "semver": "^7.3.4",
"validate-npm-package-license": "^3.0.1"
}
},
"npm-package-arg": {
- "version": "6.1.1",
- "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz",
- "integrity": "sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg==",
+ "version": "8.1.5",
+ "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-8.1.5.tgz",
+ "integrity": "sha512-LhgZrg0n0VgvzVdSm1oiZworPbTxYHUJCgtsJW8mGvlDpxTM1vSJc3m5QZeUkhAHIzbz3VCHd/R4osi1L1Tg/Q==",
"dev": true,
"requires": {
- "hosted-git-info": "^2.7.1",
- "osenv": "^0.1.5",
- "semver": "^5.6.0",
+ "hosted-git-info": "^4.0.1",
+ "semver": "^7.3.4",
"validate-npm-package-name": "^3.0.0"
}
},
- "npm-registry-client": {
- "version": "8.6.0",
- "resolved": "https://registry.npmjs.org/npm-registry-client/-/npm-registry-client-8.6.0.tgz",
- "integrity": "sha512-Qs6P6nnopig+Y8gbzpeN/dkt+n7IyVd8f45NTMotGk6Qo7GfBmzwYx6jRLoOOgKiMnaQfYxsuyQlD8Mc3guBhg==",
- "dev": true,
- "requires": {
- "concat-stream": "^1.5.2",
- "graceful-fs": "^4.1.6",
- "normalize-package-data": "~1.0.1 || ^2.0.0",
- "npm-package-arg": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0",
- "npmlog": "2 || ^3.1.0 || ^4.0.0",
- "once": "^1.3.3",
- "request": "^2.74.0",
- "retry": "^0.10.0",
- "safe-buffer": "^5.1.1",
- "semver": "2 >=2.2.1 || 3.x || 4 || 5",
- "slide": "^1.1.3",
- "ssri": "^5.2.4"
- }
- },
"npmlog": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz",
@@ -997,7 +3273,7 @@
"number-is-nan": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
- "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
+ "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==",
"dev": true,
"optional": true
},
@@ -1010,41 +3286,19 @@
"object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
- "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=",
+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
"dev": true,
"optional": true
},
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
- "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
+ "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"dev": true,
"requires": {
"wrappy": "1"
}
},
- "os-homedir": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
- "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
- "dev": true
- },
- "os-tmpdir": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
- "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
- "dev": true
- },
- "osenv": {
- "version": "0.1.5",
- "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz",
- "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==",
- "dev": true,
- "requires": {
- "os-homedir": "^1.0.0",
- "os-tmpdir": "^1.0.0"
- }
- },
"p-limit": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
@@ -1070,9 +3324,9 @@
"dev": true
},
"parsimmon": {
- "version": "1.16.0",
- "resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-1.16.0.tgz",
- "integrity": "sha512-tekGDz2Lny27SQ/5DzJdIK0lqsWwZ667SCLFIDCxaZM7VNgQjyKLbaL7FYPKpbjdxNAXFV/mSxkq5D2fnkW4pA==",
+ "version": "1.18.1",
+ "resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-1.18.1.tgz",
+ "integrity": "sha512-u7p959wLfGAhJpSDJVYXoyMCXWYwHia78HhRBWqk7AIbxdmlrfdp5wX0l3xv/iTSH5HvhN9K7o26hwwpgS5Nmw==",
"dev": true
},
"path-exists": {
@@ -1084,31 +3338,32 @@
"path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
- "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
+ "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
"dev": true
},
"path-parse": {
- "version": "1.0.6",
- "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
- "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
+ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
"dev": true
},
"performance-now": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
- "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=",
+ "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==",
"dev": true
},
"process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==",
- "dev": true
+ "dev": true,
+ "optional": true
},
"psl": {
- "version": "1.8.0",
- "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz",
- "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==",
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz",
+ "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==",
"dev": true
},
"punycode": {
@@ -1118,32 +3373,20 @@
"dev": true
},
"qs": {
- "version": "6.5.2",
- "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
- "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==",
+ "version": "6.5.3",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz",
+ "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==",
"dev": true
},
"readable-stream": {
- "version": "2.3.7",
- "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
- "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
+ "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
"dev": true,
"requires": {
- "core-util-is": "~1.0.0",
- "inherits": "~2.0.3",
- "isarray": "~1.0.0",
- "process-nextick-args": "~2.0.0",
- "safe-buffer": "~5.1.1",
- "string_decoder": "~1.1.1",
- "util-deprecate": "~1.0.1"
- },
- "dependencies": {
- "safe-buffer": {
- "version": "5.1.2",
- "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
- "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
- "dev": true
- }
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
}
},
"request": {
@@ -1177,7 +3420,7 @@
"require-directory": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
- "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=",
+ "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
"dev": true
},
"require-main-filename": {
@@ -1187,24 +3430,26 @@
"dev": true
},
"resolve": {
- "version": "1.17.0",
- "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz",
- "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==",
+ "version": "1.22.1",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz",
+ "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==",
"dev": true,
"requires": {
- "path-parse": "^1.0.6"
+ "is-core-module": "^2.9.0",
+ "path-parse": "^1.0.7",
+ "supports-preserve-symlinks-flag": "^1.0.0"
}
},
"retry": {
- "version": "0.10.1",
- "resolved": "https://registry.npmjs.org/retry/-/retry-0.10.1.tgz",
- "integrity": "sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q=",
+ "version": "0.12.0",
+ "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz",
+ "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==",
"dev": true
},
"rimraf": {
- "version": "2.7.1",
- "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
- "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
+ "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
"dev": true,
"requires": {
"glob": "^7.1.3"
@@ -1223,28 +3468,31 @@
"dev": true
},
"semver": {
- "version": "5.7.1",
- "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
- "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
- "dev": true
+ "version": "7.3.7",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
+ "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
+ "dev": true,
+ "requires": {
+ "lru-cache": "^6.0.0"
+ }
},
"set-blocking": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
- "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
+ "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",
"dev": true
},
"signal-exit": {
- "version": "3.0.3",
- "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
- "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==",
+ "version": "3.0.7",
+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
+ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
"dev": true,
"optional": true
},
"slide": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz",
- "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=",
+ "integrity": "sha512-NwrtjCg+lZoqhFU8fOwl4ay2ei8PaqCBOUV3/ektPY9trO1yQ1oXEfmHAhKArUVUr/hOHvy5f6AdP17dCM0zMw==",
"dev": true
},
"spdx-correct": {
@@ -1274,21 +3522,21 @@
}
},
"spdx-license-ids": {
- "version": "3.0.6",
- "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.6.tgz",
- "integrity": "sha512-+orQK83kyMva3WyPf59k1+Y525csj5JejicWut55zeTWANuN17qSiSLUXWtzHeNWORSvT7GLDJ/E/XiIWoXBTw==",
+ "version": "3.0.11",
+ "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.11.tgz",
+ "integrity": "sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==",
"dev": true
},
"sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
- "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
+ "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==",
"dev": true
},
"sshpk": {
- "version": "1.16.1",
- "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
- "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==",
+ "version": "1.17.0",
+ "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz",
+ "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==",
"dev": true,
"requires": {
"asn1": "~0.2.3",
@@ -1303,18 +3551,27 @@
}
},
"ssri": {
- "version": "5.3.0",
- "resolved": "https://registry.npmjs.org/ssri/-/ssri-5.3.0.tgz",
- "integrity": "sha512-XRSIPqLij52MtgoQavH/x/dU1qVKtWUAAZeOHsR9c2Ddi4XerFy3mc1alf+dLJKl9EUIm/Ht+EowFkTUOA6GAQ==",
+ "version": "8.0.1",
+ "resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz",
+ "integrity": "sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ==",
"dev": true,
"requires": {
- "safe-buffer": "^5.1.1"
+ "minipass": "^3.1.1"
+ }
+ },
+ "string_decoder": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
+ "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "~5.2.0"
}
},
"string-width": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
- "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
+ "integrity": "sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==",
"dev": true,
"optional": true,
"requires": {
@@ -1323,27 +3580,10 @@
"strip-ansi": "^3.0.0"
}
},
- "string_decoder": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
- "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
- "dev": true,
- "requires": {
- "safe-buffer": "~5.1.0"
- },
- "dependencies": {
- "safe-buffer": {
- "version": "5.1.2",
- "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
- "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
- "dev": true
- }
- }
- },
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
- "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
+ "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==",
"dev": true,
"requires": {
"ansi-regex": "^2.0.0"
@@ -1352,39 +3592,57 @@
"strip-json-comments": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
- "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=",
+ "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==",
"dev": true
},
"supports-color": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
- "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ },
+ "supports-preserve-symlinks-flag": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
+ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
"dev": true
},
"tar": {
- "version": "2.2.2",
- "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz",
- "integrity": "sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA==",
+ "version": "6.1.11",
+ "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz",
+ "integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==",
"dev": true,
"requires": {
- "block-stream": "*",
- "fstream": "^1.0.12",
- "inherits": "2"
+ "chownr": "^2.0.0",
+ "fs-minipass": "^2.0.0",
+ "minipass": "^3.0.0",
+ "minizlib": "^2.1.1",
+ "mkdirp": "^1.0.3",
+ "yallist": "^4.0.0"
+ },
+ "dependencies": {
+ "mkdirp": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
+ "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
+ "dev": true
+ }
}
},
"tar-stream": {
- "version": "1.6.2",
- "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz",
- "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==",
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz",
+ "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
"dev": true,
"requires": {
- "bl": "^1.0.0",
- "buffer-alloc": "^1.2.0",
- "end-of-stream": "^1.0.0",
+ "bl": "^4.0.3",
+ "end-of-stream": "^1.4.1",
"fs-constants": "^1.0.0",
- "readable-stream": "^2.3.0",
- "to-buffer": "^1.1.1",
- "xtend": "^4.0.0"
+ "inherits": "^2.0.3",
+ "readable-stream": "^3.1.1"
}
},
"tmp": {
@@ -1394,25 +3652,8 @@
"dev": true,
"requires": {
"rimraf": "^3.0.0"
- },
- "dependencies": {
- "rimraf": {
- "version": "3.0.2",
- "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
- "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
- "dev": true,
- "requires": {
- "glob": "^7.1.3"
- }
- }
}
},
- "to-buffer": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz",
- "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==",
- "dev": true
- },
"tough-cookie": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
@@ -1424,9 +3665,9 @@
}
},
"tslib": {
- "version": "1.13.0",
- "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz",
- "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==",
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
+ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
"dev": true
},
"tslint": {
@@ -1448,6 +3689,14 @@
"semver": "^5.3.0",
"tslib": "^1.8.0",
"tsutils": "^2.29.0"
+ },
+ "dependencies": {
+ "semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true
+ }
}
},
"tsutils": {
@@ -1462,7 +3711,7 @@
"tunnel-agent": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
- "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
+ "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
"dev": true,
"requires": {
"safe-buffer": "^5.0.1"
@@ -1471,19 +3720,19 @@
"tweetnacl": {
"version": "0.14.5",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
- "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=",
+ "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==",
"dev": true
},
"typedarray": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
- "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
+ "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==",
"dev": true
},
"typescript": {
- "version": "4.0.3",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.3.tgz",
- "integrity": "sha512-tEu6DGxGgRJPb/mVPIZ48e69xCn2yRmCgYmDugAVwmJ6o+0u1RI18eO7E7WBTLYLaEVVOhwQmcdhQHweux/WPg==",
+ "version": "4.7.4",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz",
+ "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==",
"dev": true
},
"universalify": {
@@ -1493,9 +3742,9 @@
"dev": true
},
"uri-js": {
- "version": "4.4.0",
- "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz",
- "integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==",
+ "version": "4.4.1",
+ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
+ "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
"dev": true,
"requires": {
"punycode": "^2.1.0"
@@ -1504,7 +3753,7 @@
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
- "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
+ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
"dev": true
},
"uuid": {
@@ -1526,7 +3775,7 @@
"validate-npm-package-name": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz",
- "integrity": "sha1-X6kS2B630MdK/BQN5zF/DKffQ34=",
+ "integrity": "sha512-M6w37eVCMMouJ9V/sdPGnC5H4uDr73/+xdq0FBLO3TFFX1+7wiUY6Es328NN+y43tmY+doUdN9g9J21vqB7iLw==",
"dev": true,
"requires": {
"builtins": "^1.0.3"
@@ -1535,7 +3784,7 @@
"verror": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
- "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",
+ "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==",
"dev": true,
"requires": {
"assert-plus": "^1.0.0",
@@ -1546,17 +3795,17 @@
"which-module": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
- "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=",
+ "integrity": "sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q==",
"dev": true
},
"wide-align": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz",
- "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==",
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz",
+ "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==",
"dev": true,
"optional": true,
"requires": {
- "string-width": "^1.0.2 || 2"
+ "string-width": "^1.0.2 || 2 || 3 || 4"
}
},
"wrap-ansi": {
@@ -1571,9 +3820,33 @@
},
"dependencies": {
"ansi-regex": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
- "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+ "dev": true
+ },
+ "ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "dev": true,
+ "requires": {
+ "color-convert": "^2.0.1"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
"is-fullwidth-code-point": {
@@ -1583,23 +3856,23 @@
"dev": true
},
"string-width": {
- "version": "4.2.0",
- "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz",
- "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==",
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
"requires": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
- "strip-ansi": "^6.0.0"
+ "strip-ansi": "^6.0.1"
}
},
"strip-ansi": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
- "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"requires": {
- "ansi-regex": "^5.0.0"
+ "ansi-regex": "^5.0.1"
}
}
}
@@ -1607,19 +3880,19 @@
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
- "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
+ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
"dev": true
},
- "xtend": {
- "version": "4.0.2",
- "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
- "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
+ "y18n": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz",
+ "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==",
"dev": true
},
- "y18n": {
+ "yallist": {
"version": "4.0.0",
- "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
- "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
+ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"dev": true
},
"yargs": {
@@ -1642,9 +3915,9 @@
},
"dependencies": {
"ansi-regex": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
- "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true
},
"is-fullwidth-code-point": {
@@ -1654,23 +3927,23 @@
"dev": true
},
"string-width": {
- "version": "4.2.0",
- "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz",
- "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==",
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
"requires": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
- "strip-ansi": "^6.0.0"
+ "strip-ansi": "^6.0.1"
}
},
"strip-ansi": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
- "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"requires": {
- "ansi-regex": "^5.0.0"
+ "ansi-regex": "^5.0.1"
}
}
}
diff --git a/chromium/third_party/skia/modules/canvaskit/npm_build/package.json b/chromium/third_party/skia/modules/canvaskit/npm_build/package.json
index 05d6103b567..9a3c42be595 100644
--- a/chromium/third_party/skia/modules/canvaskit/npm_build/package.json
+++ b/chromium/third_party/skia/modules/canvaskit/npm_build/package.json
@@ -1,6 +1,6 @@
{
"name": "canvaskit-wasm",
- "version": "0.34.1",
+ "version": "0.36.0",
"description": "A WASM version of Skia's Canvas API",
"main": "bin/canvaskit.js",
"homepage": "https://github.com/google/skia/tree/main/modules/canvaskit",
@@ -17,7 +17,9 @@
"types": "./types/index.d.ts",
"license": "BSD-3-Clause",
"devDependencies": {
- "dtslint": "^4.0.4",
- "typescript": "^4.0.3"
+ "dtslint": "4.2.1",
+ "typescript": "4.7.4",
+ "@definitelytyped/header-parser": "0.0.121",
+ "@webgpu/types": "0.1.21"
}
}
diff --git a/chromium/third_party/skia/modules/canvaskit/npm_build/types/canvaskit-wasm-tests.ts b/chromium/third_party/skia/modules/canvaskit/npm_build/types/canvaskit-wasm-tests.ts
index 525b089b861..c7c984bc4d6 100644
--- a/chromium/third_party/skia/modules/canvaskit/npm_build/types/canvaskit-wasm-tests.ts
+++ b/chromium/third_party/skia/modules/canvaskit/npm_build/types/canvaskit-wasm-tests.ts
@@ -1,7 +1,6 @@
// This file is type-checked by the Typescript definitions. It is not actually executed.
// Test it by running `npm run dtslint` in the parent directory.
-import {
- CanvasKitInit,
+import CanvasKitInit, {
AnimatedImage,
Canvas,
CanvasKit,
@@ -21,6 +20,7 @@ import {
TextBlob,
Typeface,
Vertices,
+ WebGPUDeviceContext,
} from "canvaskit-wasm";
CanvasKitInit({locateFile: (file: string) => '/node_modules/canvaskit/bin/' + file}).then((CK: CanvasKit) => {
@@ -54,6 +54,7 @@ CanvasKitInit({locateFile: (file: string) => '/node_modules/canvaskit/bin/' + fi
typefaceTests(CK);
vectorTests(CK);
verticesTests(CK);
+ webGPUTest(CK);
});
function animatedImageTests(CK: CanvasKit) {
@@ -226,6 +227,7 @@ function colorFilterTests(CK: CanvasKit) {
const filterThree = cf.MakeSRGBToLinearGamma(); // $ExpectType ColorFilter
const filterFour = cf.MakeCompose(filterOne, filterTwo); // $ExpectType ColorFilter
const filterFive = cf.MakeLerp(0.7, filterThree, filterFour); // $ExpectType ColorFilter
+ const filterSeven = cf.MakeBlend(CK.MAGENTA, CK.BlendMode.SrcOut, CK.ColorSpace.DISPLAY_P3); // $ExpectType ColorFilter
const r = CK.ColorMatrix.rotated(0, .707, -.707); // $ExpectType Float32Array
const b = CK.ColorMatrix.rotated(2, .5, .866);
@@ -235,6 +237,7 @@ function colorFilterTests(CK: CanvasKit) {
CK.ColorMatrix.postTranslate(cm, 20, 0, -10, 0);
const filterSix = CK.ColorFilter.MakeMatrix(cm); // $ExpectType ColorFilter
+ const luma = CK.ColorFilter.MakeLuma(); // $ExpectType ColorFilter
}
function contourMeasureTests(CK: CanvasKit, path?: Path) {
@@ -268,6 +271,12 @@ function imageTests(CK: CanvasKit, imgElement?: HTMLImageElement) {
alphaType: CK.AlphaType.Premul,
colorType: CK.ColorType.RGBA_8888,
});
+ const img6 = CK.MakeLazyImageFromTextureSource(imgElement, {
+ width: 1,
+ height: 1,
+ alphaType: CK.AlphaType.Premul,
+ colorType: CK.ColorType.RGBA_8888,
+ }, true);
if (!img) return;
const dOne = img.encodeToBytes(); // $ExpectType Uint8Array | null
const dTwo = img.encodeToBytes(CK.ImageFormat.JPEG, 97);
@@ -278,7 +287,8 @@ function imageTests(CK: CanvasKit, imgElement?: HTMLImageElement) {
const s2 = mm.makeShaderOptions(CK.TileMode.Decal, CK.TileMode.Repeat, // $ExpectType Shader
CK.FilterMode.Nearest, CK.MipmapMode.Linear,
CK.Matrix.identity());
- const pixels = img.readPixels(85, 1000, { // $ExpectType Float32Array | Uint8Array | null
+ // See https://github.com/microsoft/dtslint/issues/191#issuecomment-1108307671 for below
+ const pixels = img.readPixels(85, 1000, { // $ExpectType Float32Array | Uint8Array | null || Uint8Array | Float32Array | null
width: 79,
height: 205,
colorType: CK.ColorType.RGBA_8888,
@@ -299,8 +309,8 @@ function imageTests(CK: CanvasKit, imgElement?: HTMLImageElement) {
img.delete();
}
-function imageFilterTests(CK: CanvasKit, colorFilter?: ColorFilter) {
- if (!colorFilter) return;
+function imageFilterTests(CK: CanvasKit, colorFilter?: ColorFilter, img?: Image, shader?: Shader) {
+ if (!colorFilter || !img || !shader) return;
const imgf = CK.ImageFilter; // less typing
const filter = imgf.MakeBlur(2, 4, CK.TileMode.Mirror, null); // $ExpectType ImageFilter
const filter1 = imgf.MakeBlur(2, 4, CK.TileMode.Decal, filter); // $ExpectType ImageFilter
@@ -317,6 +327,28 @@ function imageFilterTests(CK: CanvasKit, colorFilter?: ColorFilter) {
const filter9 = imgf.MakeMatrixTransform(CK.M44.identity(),
{ filter: CK.FilterMode.Nearest },
filter6);
+ let filter10 = imgf.MakeBlend(CK.BlendMode.SrcOver, filter8, filter9); // $ExpectType ImageFilter
+ filter10 = imgf.MakeBlend(CK.BlendMode.Xor, null, null);
+ let filter11 = imgf.MakeDilate(2, 10, null); // $ExpectType ImageFilter
+ filter11 = imgf.MakeDilate(2, 10, filter11);
+ let filter12 = imgf.MakeErode(2, 10, null); // $ExpectType ImageFilter
+ filter12 = imgf.MakeErode(2, 10, filter12);
+ let filter13 = imgf.MakeDisplacementMap(// $ExpectType ImageFilter
+ CK.ColorChannel.Red, CK.ColorChannel.Alpha, 3.2, filter11, filter12);
+ filter13 = imgf.MakeDisplacementMap(
+ CK.ColorChannel.Blue, CK.ColorChannel.Green, 512, null, null);
+ let filter14 = imgf.MakeDropShadow(10, -30, 4.0, 2.0, CK.MAGENTA, null); // $ExpectType ImageFilter
+ filter14 = imgf.MakeDropShadow(10, -30, 4.0, 2.0, CK.MAGENTA, filter14);
+ filter14 = imgf.MakeDropShadowOnly(10, -30, 4.0, 2.0, CK.CYAN, null);
+ filter14 = imgf.MakeDropShadowOnly(10, -30, 4.0, 2.0, CK.CYAN, filter14);
+
+ let filter15 = imgf.MakeImage(img, { B: 1 / 3, C: 1 / 3 }); // $ExpectType ImageFilter | null
+ filter15 = imgf.MakeImage(img, { filter: CK.FilterMode.Linear },
+ CK.LTRBRect(1, 2, 3, 4), CK.XYWHRect(5, 6, 7, 8));
+
+ let filter16 = imgf.MakeOffset(5, 3, null); // $ExpectType ImageFilter
+ filter16 = imgf.MakeOffset(-100.3, -18, filter16);
+ imgf.MakeShader(shader); // $ExpectType ImageFilter
}
function fontTests(CK: CanvasKit, face?: Typeface, paint?: Paint) {
@@ -431,7 +463,6 @@ function pathTests(CK: CanvasKit) {
const p5 = CK.Path.MakeFromOp(p4, p2!, CK.PathOp.ReverseDifference); // $ExpectType Path | null
const p6 = CK.Path.MakeFromSVGString('M 205,5 L 795,5 z'); // $ExpectType Path | null
const p7 = p3.makeAsWinding(); // $ExpectType Path | null
-
const someRect = CK.LTRBRect(10, 20, 30, 40);
// Making sure arrays are accepted as rrects.
const someRRect = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
@@ -443,6 +474,7 @@ function pathTests(CK: CanvasKit) {
path.addPoly([20, 20, 40, 40, 20, 40], true);
path.addRect(someRect);
path.addRect(someRect, true);
+ path.addCircle(10, 10, 10);
path.addRRect(someRRect);
path.addRRect(someRRect, true);
path.addVerbsPointsWeights(verbs, [1, 2, 3, 4]);
@@ -499,6 +531,10 @@ function pathTests(CK: CanvasKit) {
path.transform(CK.Matrix.identity());
path.transform(1, 0, 0, 0, 1, 0, 0, 0, 1);
path.trim(0.1, 0.7, false);
+
+ if (CK.Path.CanInterpolate(p3, p4)) {
+ const interpolated = CK.Path.MakeFromPathInterpolation(p3, p4, 0.5); // $ExpectType Path | null
+ }
}
function paragraphTests(CK: CanvasKit, p?: Paragraph) {
@@ -512,8 +548,8 @@ function paragraphTests(CK: CanvasKit, p?: Paragraph) {
const g = p.getMaxIntrinsicWidth(); // $ExpectType number
const h = p.getMaxWidth(); // $ExpectType number
const i = p.getMinIntrinsicWidth(); // $ExpectType number
- const j = p.getRectsForPlaceholders(); // $ExpectType Float32Array
- const k = p.getRectsForRange(2, 10, CK.RectHeightStyle.Max, // $ExpectType Float32Array
+ const j = p.getRectsForPlaceholders(); // $ExpectType Float32Array[]
+ const k = p.getRectsForRange(2, 10, CK.RectHeightStyle.Max, // $ExpectType Float32Array[]
CK.RectWidthStyle.Tight);
const l = p.getWordBoundary(10); // $ExpectType URange
p.layout(300);
@@ -553,6 +589,7 @@ function paragraphBuilderTests(CK: CanvasKit, fontMgr?: FontMgr, paint?: Paint)
decorationThickness: 1.5, // multiplier based on font size
fontSize: 24,
fontFeatures: [{name: 'smcp', value: 1}],
+ fontVariations: [{axis: 'wght', value: 100}],
shadows: [{color: CK.BLACK, blurRadius: 15},
{color: CK.RED, blurRadius: 5, offset: [10, 10]}],
});
@@ -887,7 +924,12 @@ function surfaceTests(CK: CanvasKit, gl?: WebGLRenderingContext) {
alphaType: CK.AlphaType.Unpremul,
});
const img6 = surfaceFour.makeImageFromTextureSource(new ImageData(40, 80)); // $ExpectType Image | null
-
+ const img7 = surfaceFour.makeImageFromTextureSource(videoEle, {
+ height: 40,
+ width: 80,
+ colorType: CK.ColorType.RGBA_8888,
+ alphaType: CK.AlphaType.Premul,
+ }, true);
surfaceSeven.delete();
const ctx = CK.GetWebGLContext(canvasEl); // $ExpectType number
@@ -912,6 +954,7 @@ function surfaceTests(CK: CanvasKit, gl?: WebGLRenderingContext) {
surfaceFour.drawOnce(drawFrame);
surfaceFour.updateTextureFromSource(img5!, videoEle);
+ surfaceFour.updateTextureFromSource(img5!, videoEle, true);
}
function textBlobTests(CK: CanvasKit, font?: Font, path?: Path) {
@@ -980,3 +1023,27 @@ function verticesTests(CK: CanvasKit) {
vertices.bounds(rect);
const id = vertices.uniqueID(); // $ExpectType number
}
+
+function webGPUTest(CK: CanvasKit, device?: GPUDevice, canvas?: HTMLCanvasElement, texture?: GPUTexture) {
+ if (!device || !canvas || !texture) {
+ return;
+ }
+
+ const gpuContext: WebGPUDeviceContext = CK.MakeGPUDeviceContext(device)!; // $ExpectType GrDirectContext
+
+ // Texture surface.
+ const surface1 = CK.MakeGPUTextureSurface(gpuContext, texture, 800, 600, // $ExpectType Surface | null
+ CK.ColorSpace.SRGB);
+
+ // Canvas surfaces.
+ const canvasContext = CK.MakeGPUCanvasContext(gpuContext, canvas, { // $ExpectType WebGPUCanvasContext
+ format: "bgra8unorm",
+ alphaMode: "premultiplied",
+ })!;
+ canvasContext.requestAnimationFrame((canvas: Canvas) => {
+ canvas.clear([0, 0, 0, 0]);
+ });
+
+ const surface2 = CK.MakeGPUCanvasSurface(canvasContext, CK.ColorSpace.SRGB); // $ExpectType Surface | null
+ const surface3 = CK.MakeGPUCanvasSurface(canvasContext, CK.ColorSpace.SRGB, 10, 10); // $ExpectType Surface | null
+}
diff --git a/chromium/third_party/skia/modules/canvaskit/npm_build/types/index.d.ts b/chromium/third_party/skia/modules/canvaskit/npm_build/types/index.d.ts
index f305079d033..6d0e648d423 100644
--- a/chromium/third_party/skia/modules/canvaskit/npm_build/types/index.d.ts
+++ b/chromium/third_party/skia/modules/canvaskit/npm_build/types/index.d.ts
@@ -1,5 +1,7 @@
-// Minimum TypeScript Version: 3.7
-export function CanvasKitInit(opts: CanvasKitInitOptions): Promise<CanvasKit>;
+// Minimum TypeScript Version: 4.4
+/// <reference types="@webgpu/types" />
+
+export default function CanvasKitInit(opts: CanvasKitInitOptions): Promise<CanvasKit>;
export interface CanvasKitInitOptions {
/**
@@ -185,6 +187,7 @@ export interface CanvasKit {
* will first try to create a GPU surface and then fallback to a CPU one if that fails. If just
* the CPU mode has been compiled in, a CPU surface will be created.
* @param canvas - either the canvas element itself or a string with the DOM id of it.
+ * @deprecated - Use MakeSWCanvasSurface, MakeWebGLCanvasSurface, or MakeGPUCanvasSurface.
*/
MakeCanvasSurface(canvas: HTMLCanvasElement | string): Surface | null;
@@ -237,10 +240,17 @@ export interface CanvasKit {
/**
* Creates a GrDirectContext from the given WebGL Context.
* @param ctx
+ * @deprecated Use MakeWebGLContext instead.
*/
MakeGrContext(ctx: WebGLContextHandle): GrDirectContext | null;
/**
+ * Creates a GrDirectContext from the given WebGL Context.
+ * @param ctx
+ */
+ MakeWebGLContext(ctx: WebGLContextHandle): GrDirectContext | null;
+
+ /**
* Creates a Surface that will be drawn to the given GrDirectContext (and show up on screen).
* @param ctx
* @param width - number of pixels of the width of the visible area.
@@ -251,6 +261,47 @@ export interface CanvasKit {
colorSpace: ColorSpace): Surface | null;
/**
+ * Creates a context that operates over the given WebGPU Device.
+ * @param device
+ */
+ MakeGPUDeviceContext(device: GPUDevice): WebGPUDeviceContext | null;
+
+ /**
+ * Creates a Surface that draws to the given GPU texture.
+ * @param ctx
+ * @param texture - A texture that was created on the GPU device associated with `ctx`.
+ * @param width - Width of the visible region in pixels.
+ * @param height - Height of the visible region in pixels.
+ * @param colorSpace
+ */
+ MakeGPUTextureSurface(ctx: WebGPUDeviceContext, texture: GPUTexture, width: number, height: number,
+ colorSpace: ColorSpace): Surface | null;
+
+ /**
+ * Creates and configures a WebGPU context for the given canvas.
+ * @param ctx
+ * @param canvas
+ * @param opts
+ */
+ MakeGPUCanvasContext(ctx: WebGPUDeviceContext, canvas: HTMLCanvasElement,
+ opts?: WebGPUCanvasOptions): WebGPUCanvasContext | null;
+
+ /**
+ * Creates a Surface backed by the next available texture in the swapchain associated with the
+ * given WebGPU canvas context. The context must have been already successfully configured using
+ * the same GPUDevice associated with `ctx`.
+ * @param canvasContext - WebGPU context associated with the canvas. The canvas can either be an
+ * on-screen HTMLCanvasElement or an OffscreenCanvas.
+ * @param colorSpace
+ * @param width - width of the visible region. If not present, the canvas width from `canvasContext`
+ * is used.
+ * @param height - height of the visible region. If not present, the canvas width from `canvasContext`
+ * is used.
+ */
+ MakeGPUCanvasSurface(canvasContext: WebGPUCanvasContext, colorSpace: ColorSpace,
+ width?: number, height?: number): Surface | null;
+
+ /**
* Returns a (non-visible) Surface on the GPU. It has the given dimensions and uses 8888
* color depth and premultiplied alpha. See Surface.h for more details.
* @param ctx
@@ -276,8 +327,12 @@ export interface CanvasKit {
* the image is destroyed.
* @param info - If provided, will be used to determine the width/height/format of the
* source image. If not, sensible defaults will be used.
+ * @param srcIsPremul - set to true if the src data has premultiplied alpha. Otherwise, it will
+ * be assumed to be Unpremultiplied. Note: if this is true and info specifies
+ * Unpremul, Skia will not convert the src pixels first.
*/
- MakeLazyImageFromTextureSource(src: TextureSource, info?: ImageInfo | PartialImageInfo): Image;
+ MakeLazyImageFromTextureSource(src: TextureSource, info?: ImageInfo | PartialImageInfo,
+ srcIsPremul?: boolean): Image;
/**
* Deletes the associated WebGLContext. Function not available on the CPU version.
@@ -431,6 +486,7 @@ export interface CanvasKit {
readonly BlendMode: BlendModeEnumValues;
readonly BlurStyle: BlurStyleEnumValues;
readonly ClipOp: ClipOpEnumValues;
+ readonly ColorChannel: ColorChannelEnumValues;
readonly ColorType: ColorTypeEnumValues;
readonly FillType: FillTypeEnumValues;
readonly FilterMode: FilterModeEnumValues;
@@ -616,6 +672,30 @@ export interface GrDirectContext extends EmbindObject<GrDirectContext> {
}
/**
+ * Represents the context backed by a WebGPU device instance.
+ */
+export type WebGPUDeviceContext = GrDirectContext;
+
+/**
+ * Represents the canvas context and swapchain backed by a WebGPU device.
+ */
+export interface WebGPUCanvasContext {
+ /**
+ * A convenient way to draw multiple frames over the swapchain texture sequence associated with
+ * a canvas element. Each call internally constructs a new Surface that targets the current
+ * GPUTexture in swapchain.
+ *
+ * This requires an environment where a global function called requestAnimationFrame is
+ * available (e.g. on the web, not on Node). The internally created surface is flushed and
+ * destroyed automatically by this wrapper once the `drawFrame` callback returns.
+ *
+ * Users can call canvasContext.requestAnimationFrame in the callback function to
+ * draw multiple frames, e.g. of an animation.
+ */
+ requestAnimationFrame(drawFrame: (_: Canvas) => void): void;
+}
+
+/**
* See Metrics.h for more on this struct.
*/
export interface LineMetrics {
@@ -847,7 +927,7 @@ export interface Paragraph extends EmbindObject<Paragraph> {
getMaxIntrinsicWidth(): number;
getMaxWidth(): number;
getMinIntrinsicWidth(): number;
- getRectsForPlaceholders(): FlattenedRectangleArray;
+ getRectsForPlaceholders(): Rect[];
/**
* Returns bounding boxes that enclose all text in the range of glpyh indexes [start, end).
@@ -857,7 +937,7 @@ export interface Paragraph extends EmbindObject<Paragraph> {
* @param wStyle
*/
getRectsForRange(start: number, end: number, hStyle: RectHeightStyle,
- wStyle: RectWidthStyle): FlattenedRectangleArray;
+ wStyle: RectWidthStyle): Rect[];
/**
* Finds the first and last glyphs that define a word containing the glyph at index offset.
@@ -1018,6 +1098,7 @@ export interface SkSLUniform {
rows: number;
/** The index into the uniforms array that this uniform begins. */
slot: number;
+ isInteger: boolean;
}
/**
@@ -1486,7 +1567,7 @@ export interface Canvas extends EmbindObject<Canvas> {
* not supported in JS, so that colorType corresponds to raw bytes Uint8Array.
*/
readPixels(srcX: number, srcY: number, imageInfo: ImageInfo, dest?: MallocObj,
- bytesPerRow?: number): Uint8Array | Float32Array | null;
+ bytesPerRow?: number): Float32Array | Uint8Array | null;
/**
* Removes changes to the current matrix and clip since Canvas state was
@@ -1863,7 +1944,7 @@ export interface Image extends EmbindObject<Image> {
* not supported in JS, so that colorType corresponds to raw bytes Uint8Array.
*/
readPixels(srcX: number, srcY: number, imageInfo: ImageInfo, dest?: MallocObj,
- bytesPerRow?: number): Uint8Array | Float32Array | null;
+ bytesPerRow?: number): Float32Array | Uint8Array | null;
/**
* Return the width in pixels of the image.
@@ -1992,7 +2073,7 @@ export interface Paint extends EmbindObject<Paint> {
* Sets the current color filter, replacing the existing one if there was one.
* @param filter
*/
- setColorFilter(filter: ColorFilter): void;
+ setColorFilter(filter: ColorFilter | null): void;
/**
* Sets the color used when stroking and filling. The color values are interpreted as being in
@@ -2006,25 +2087,25 @@ export interface Paint extends EmbindObject<Paint> {
* Sets the current image filter, replacing the existing one if there was one.
* @param filter
*/
- setImageFilter(filter: ImageFilter): void;
+ setImageFilter(filter: ImageFilter | null): void;
/**
* Sets the current mask filter, replacing the existing one if there was one.
* @param filter
*/
- setMaskFilter(filter: MaskFilter): void;
+ setMaskFilter(filter: MaskFilter | null): void;
/**
* Sets the current path effect, replacing the existing one if there was one.
* @param effect
*/
- setPathEffect(effect: PathEffect): void;
+ setPathEffect(effect: PathEffect | null): void;
/**
* Sets the current shader, replacing the existing one if there was one.
* @param shader
*/
- setShader(shader: Shader): void;
+ setShader(shader: Shader | null): void;
/**
* Sets the geometry drawn at the beginning and end of strokes.
@@ -2074,6 +2155,18 @@ export interface Path extends EmbindObject<Path> {
addArc(oval: InputRect, startAngle: AngleInDegrees, sweepAngle: AngleInDegrees): Path;
/**
+ * Adds circle centered at (x, y) of size radius to the path.
+ * Has no effect if radius is zero or negative.
+ *
+ * @param x center of circle
+ * @param y center of circle
+ * @param radius distance from center to edge
+ * @param isCCW - if the path should be drawn counter-clockwise or not
+ * @return reference to SkPath
+ */
+ addCircle(x: number, y: number, r: number, isCCW?: boolean): Path;
+
+ /**
* Adds oval to Path, appending kMove_Verb, four kConic_Verb, and kClose_Verb.
* Oval is upright ellipse bounded by Rect oval with radii equal to half oval width
* and half oval height. Oval begins at start and continues clockwise by default.
@@ -2664,8 +2757,12 @@ export interface Surface extends EmbindObject<Surface> {
* @param src
* @param info - If provided, will be used to determine the width/height/format of the
* source image. If not, sensible defaults will be used.
+ * @param srcIsPremul - set to true if the src data has premultiplied alpha. Otherwise, it will
+ * be assumed to be Unpremultiplied. Note: if this is true and info specifies
+ * Unpremul, Skia will not convert the src pixels first.
*/
- makeImageFromTextureSource(src: TextureSource, info?: ImageInfo | PartialImageInfo): Image | null;
+ makeImageFromTextureSource(src: TextureSource, info?: ImageInfo | PartialImageInfo,
+ srcIsPremul?: boolean): Image | null;
/**
* Returns current contents of the surface as an Image. This image will be optimized to be
@@ -2714,8 +2811,11 @@ export interface Surface extends EmbindObject<Surface> {
*
* @param img - A texture-backed Image.
* @param src - A valid texture source of any dimensions.
+ * @param srcIsPremul - set to true if the src data has premultiplied alpha. Otherwise, it will
+ * be assumed to be Unpremultiplied. Note: if this is true and the image was
+ * created with Unpremul, Skia will not convert.
*/
- updateTextureFromSource(img: Image, src: TextureSource): void;
+ updateTextureFromSource(img: Image, src: TextureSource, srcIsPremul?: boolean): void;
/**
* Returns the width of this surface in pixels.
@@ -2838,6 +2938,11 @@ export interface TextFontFeatures {
value: number;
}
+export interface TextFontVariations {
+ axis: string;
+ value: number;
+}
+
export interface TextShadow {
color?: InputColor;
/**
@@ -2858,6 +2963,7 @@ export interface TextStyle {
fontFeatures?: TextFontFeatures[];
fontSize?: number;
fontStyle?: FontStyle;
+ fontVariations?: TextFontVariations[];
foregroundColor?: InputColor;
heightMultiplier?: number;
halfLeading?: boolean;
@@ -2913,6 +3019,15 @@ export interface WebGLOptions {
stencil?: number;
}
+/**
+ * Options for configuring a canvas WebGPU context. If an option is omitted, a default specified by
+ * the WebGPU standard will be used.
+ */
+export interface WebGPUCanvasOptions {
+ format?: GPUTextureFormat;
+ alphaMode?: GPUCanvasAlphaMode;
+}
+
export interface DefaultConstructor<T> {
new (): T;
}
@@ -3163,11 +3278,12 @@ export interface ParagraphStyleConstructor {
*/
export interface ColorFilterFactory {
/**
- * Makes a color filter with the given color and blend mode.
+ * Makes a color filter with the given color, blend mode, and colorSpace.
* @param color
* @param mode
+ * @param colorSpace - If omitted, will use SRGB
*/
- MakeBlend(color: InputColor, mode: BlendMode): ColorFilter;
+ MakeBlend(color: InputColor, mode: BlendMode, colorSpace?: ColorSpace): ColorFilter;
/**
* Makes a color filter composing two color filters.
@@ -3199,6 +3315,12 @@ export interface ColorFilterFactory {
* Makes a color filter that converts between sRGB colors and linear colors.
*/
MakeSRGBToLinearGamma(): ColorFilter;
+
+ /**
+ * Makes a color filter that multiplies the luma of its input into the alpha channel,
+ * and sets the red, green, and blue channels to zero.
+ */
+ MakeLuma(): ColorFilter;
}
export interface ContourMeasureIterConstructor {
@@ -3244,10 +3366,23 @@ export interface FontMgrFactory {
}
/**
- * See effects/ImageFilters.h for more.
+ * See //include/effects/SkImageFilters.h for more.
*/
export interface ImageFilterFactory {
/**
+ * Create a filter that takes a BlendMode and uses it to composite the two filters together.
+ *
+ * At least one of background and foreground should be non-null in nearly all circumstances.
+ *
+ * @param blend The blend mode that defines the compositing operation
+ * @param background The Dst pixels used in blending; if null, use the dynamic source image
+ * (e.g. a saved layer).
+ * @param foreground The Src pixels used in blending; if null, use the dynamic source image.
+ */
+ MakeBlend(blend: BlendMode, background: ImageFilter | null,
+ foreground: ImageFilter | null): ImageFilter;
+
+ /**
* Create a filter that blurs its input by the separate X and Y sigmas. The provided tile mode
* is used when the blur kernel goes outside the input image.
*
@@ -3276,6 +3411,87 @@ export interface ImageFilterFactory {
MakeCompose(outer: ImageFilter | null, inner: ImageFilter | null): ImageFilter;
/**
+ * Create a filter that dilates each input pixel's channel values to the max value within the
+ * given radii along the x and y axes.
+ * @param radiusX The distance to dilate along the x axis to either side of each pixel.
+ * @param radiusY The distance to dilate along the y axis to either side of each pixel.
+ * @param input if null, it will use the dynamic source image (e.g. a saved layer).
+ */
+ MakeDilate(radiusX: number, radiusY: number, input: ImageFilter | null): ImageFilter;
+
+ /**
+ * Create a filter that moves each pixel in its color input based on an (x,y) vector encoded
+ * in its displacement input filter. Two color components of the displacement image are
+ * mapped into a vector as scale * (color[xChannel], color[yChannel]), where the channel
+ * selectors are one of R, G, B, or A.
+ * The mapping takes the 0-255 RGBA values of the image and scales them to be [-0.5 to 0.5],
+ * in a similar fashion to https://developer.mozilla.org/en-US/docs/Web/SVG/Element/feDisplacementMap
+ *
+ * At least one of displacement and color should be non-null in nearly all circumstances.
+ *
+ * @param xChannel RGBA channel that encodes the x displacement per pixel.
+ * @param yChannel RGBA channel that encodes the y displacement per pixel.
+ * @param scale Scale applied to displacement extracted from image.
+ * @param displacement The filter defining the displacement image, or null to use source.
+ * @param color The filter providing the color pixels to be displaced, or null to use source.
+ */
+ MakeDisplacementMap(xChannel: ColorChannel, yChannel: ColorChannel, scale: number,
+ displacement: ImageFilter | null, color: ImageFilter | null): ImageFilter;
+ /**
+ * Create a filter that draws a drop shadow under the input content. This filter produces an
+ * image that includes the inputs' content.
+ * @param dx The X offset of the shadow.
+ * @param dy The Y offset of the shadow.
+ * @param sigmaX The blur radius for the shadow, along the X axis.
+ * @param sigmaY The blur radius for the shadow, along the Y axis.
+ * @param color The color of the drop shadow.
+ * @param input The input filter; if null, it will use the dynamic source image.
+ */
+ MakeDropShadow(dx: number, dy: number, sigmaX: number, sigmaY: number, color: Color,
+ input: ImageFilter | null): ImageFilter;
+
+ /**
+ * Just like MakeDropShadow, except the input content is not in the resulting image.
+ * @param dx The X offset of the shadow.
+ * @param dy The Y offset of the shadow.
+ * @param sigmaX The blur radius for the shadow, along the X axis.
+ * @param sigmaY The blur radius for the shadow, along the Y axis.
+ * @param color The color of the drop shadow.
+ * @param input The input filter; if null, it will use the dynamic source image.
+ */
+ MakeDropShadowOnly(dx: number, dy: number, sigmaX: number, sigmaY: number, color: Color,
+ input: ImageFilter | null): ImageFilter;
+
+ /**
+ * Create a filter that erodes each input pixel's channel values to the minimum channel value
+ * within the given radii along the x and y axes.
+ * @param radiusX The distance to erode along the x axis to either side of each pixel.
+ * @param radiusY The distance to erode along the y axis to either side of each pixel.
+ * @param input if null, it will use the dynamic source image (e.g. a saved layer).
+ */
+ MakeErode(radiusX: number, radiusY: number, input: ImageFilter | null): ImageFilter;
+
+ /**
+ * Create a filter using the given image as a source. Returns null if 'image' is null.
+ *
+ * @param img The image that is output by the filter, subset by 'srcRect'.
+ * @param sampling The sampling to use when drawing the image.
+ */
+ MakeImage(img: Image, sampling: FilterOptions | CubicResampler): ImageFilter | null;
+
+ /**
+ * Create a filter that draws the 'srcRect' portion of image into 'dstRect' using the given
+ * filter quality. Similar to Canvas.drawImageRect. Returns null if 'image' is null.
+ *
+ * @param img The image that is output by the filter, subset by 'srcRect'.
+ * @param sampling The sampling to use when drawing the image.
+ * @param srcRect The source pixels sampled into 'dstRect'.
+ * @param dstRect The local rectangle to draw the image into.
+ */
+ MakeImage(img: Image, sampling: FilterOptions | CubicResampler,
+ srcRect: InputRect, dstRect: InputRect): ImageFilter | null;
+
+ /**
* Create a filter that transforms the input image by 'matrix'. This matrix transforms the
* local space, which means it effectively happens prior to any transformation coming from the
* Canvas initiating the filtering.
@@ -3285,6 +3501,21 @@ export interface ImageFilterFactory {
*/
MakeMatrixTransform(matr: InputMatrix, sampling: FilterOptions | CubicResampler,
input: ImageFilter | null): ImageFilter;
+
+ /**
+ * Create a filter that offsets the input filter by the given vector.
+ * @param dx The x offset in local space that the image is shifted.
+ * @param dy The y offset in local space that the image is shifted.
+ * @param input The input that will be moved, if null, will use the dynamic source image.
+ */
+ MakeOffset(dx: number, dy: number, input: ImageFilter | null): ImageFilter;
+
+ /**
+ * Transforms a shader into an image filter
+ *
+ * @param shader - The Shader to be transformed
+ */
+ MakeShader(shader: Shader): ImageFilter;
}
/**
@@ -3301,10 +3532,18 @@ export interface MaskFilterFactory {
}
/**
- * Contains the ways to create an Path.
+ * Contains the ways to create a Path.
*/
export interface PathConstructorAndFactory extends DefaultConstructor<Path> {
/**
+ * Returns true if the two paths contain equal verbs and equal weights.
+ * @param path1 first path to compate
+ * @param path2 second path to compare
+ * @return true if Path can be interpolated equivalent
+ */
+ CanInterpolate(path1: Path, path2: Path): boolean;
+
+ /**
* Creates a new path from the given list of path commands. If this fails, null will be
* returned instead.
* @param cmds
@@ -3321,6 +3560,28 @@ export interface PathConstructorAndFactory extends DefaultConstructor<Path> {
MakeFromOp(one: Path, two: Path, op: PathOp): Path | null;
/**
+ * Interpolates between Path with point array of equal size.
+ * Copy verb array and weights to result, and set result path to a weighted
+ * average of this path array and ending path.
+ *
+ * weight is most useful when between zero (ending path) and
+ * one (this path); will work with values outside of this
+ * range.
+ *
+ * interpolate() returns undefined if path is not
+ * the same size as ending path. Call isInterpolatable() to check Path
+ * compatibility prior to calling interpolate().
+ *
+ * @param start path to interpolate from
+ * @param end path to interpolate with
+ * @param weight contribution of this path, and
+ * one minus contribution of ending path
+ * @return Path replaced by interpolated averages or null if
+ * not interpolatable
+ */
+ MakeFromPathInterpolation(start: Path, end: Path, weight: number): Path | null;
+
+ /**
* Creates a new path from the provided SVG string. If this fails, null will be
* returned instead.
* @param str
@@ -3881,6 +4142,7 @@ export type AlphaType = EmbindEnumEntity;
export type BlendMode = EmbindEnumEntity;
export type BlurStyle = EmbindEnumEntity;
export type ClipOp = EmbindEnumEntity;
+export type ColorChannel = EmbindEnumEntity;
export type ColorSpace = EmbindObject<ColorSpace>;
export type ColorType = EmbindEnumEntity;
export type EncodedImageFormat = EmbindEnumEntity;
@@ -3983,6 +4245,13 @@ export interface ColorSpaceEnumValues { // not a typical enum, but effectively l
Equals(a: ColorSpace, b: ColorSpace): boolean;
}
+export interface ColorChannelEnumValues extends EmbindEnum {
+ Red: ColorChannel;
+ Green: ColorChannel;
+ Blue: ColorChannel;
+ Alpha: ColorChannel;
+}
+
export interface ColorTypeEnumValues extends EmbindEnum {
Alpha_8: ColorType;
RGB_565: ColorType;
diff --git a/chromium/third_party/skia/modules/canvaskit/npm_build/types/tsconfig.json b/chromium/third_party/skia/modules/canvaskit/npm_build/types/tsconfig.json
index 98dd08e0997..41229f24d47 100644
--- a/chromium/third_party/skia/modules/canvaskit/npm_build/types/tsconfig.json
+++ b/chromium/third_party/skia/modules/canvaskit/npm_build/types/tsconfig.json
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
- "lib": ["es6", "dom"],
+ "lib": ["es6", "dom", "es2017" ],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
@@ -9,6 +9,7 @@
"noEmit": true,
"baseUrl": ".",
- "paths": { "canvaskit-wasm": ["."] }
+ "paths": { "canvaskit-wasm": ["."] },
+ "typeRoots": [ "./node_modules/@webgpu/types", "./node_modules/@types" ]
}
}
diff --git a/chromium/third_party/skia/modules/canvaskit/package-lock.json b/chromium/third_party/skia/modules/canvaskit/package-lock.json
index 257cf26cac0..07dca7f847c 100644
--- a/chromium/third_party/skia/modules/canvaskit/package-lock.json
+++ b/chromium/third_party/skia/modules/canvaskit/package-lock.json
@@ -356,9 +356,9 @@
}
},
"node_modules/ansi-regex": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
- "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"engines": {
"node": ">=8"
@@ -1460,9 +1460,9 @@
}
},
"node_modules/minimist": {
- "version": "1.2.5",
- "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
- "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
+ "version": "1.2.6",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
+ "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
"dev": true
},
"node_modules/mkdirp": {
@@ -2388,9 +2388,9 @@
}
},
"ansi-regex": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
- "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true
},
"ansi-styles": {
@@ -3245,9 +3245,9 @@
}
},
"minimist": {
- "version": "1.2.5",
- "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
- "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
+ "version": "1.2.6",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
+ "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
"dev": true
},
"mkdirp": {
diff --git a/chromium/third_party/skia/modules/canvaskit/paragraph.js b/chromium/third_party/skia/modules/canvaskit/paragraph.js
index cca9e657ce2..e6e140bfbf0 100644
--- a/chromium/third_party/skia/modules/canvaskit/paragraph.js
+++ b/chromium/third_party/skia/modules/canvaskit/paragraph.js
@@ -246,6 +246,19 @@
textStyle['_fontFeatureNamesPtr'] = nullptr;
textStyle['_fontFeatureValuesPtr'] = nullptr;
}
+
+ if (Array.isArray(textStyle['fontVariations']) && textStyle['fontVariations'].length) {
+ var fontVariations = textStyle['fontVariations'];
+ var fontVariationAxes = fontVariations.map(function (s) { return s['axis']; });
+ var fontVariationValues = fontVariations.map(function (s) { return s['value']; });
+ textStyle['_fontVariationLen'] = fontVariations.length;
+ textStyle['_fontVariationAxesPtr'] = naiveCopyStrArray(fontVariationAxes);
+ textStyle['_fontVariationValuesPtr'] = copy1dArray(fontVariationValues, 'HEAPF32');
+ } else {
+ textStyle['_fontVariationLen'] = 0;
+ textStyle['_fontVariationAxesPtr'] = nullptr;
+ textStyle['_fontVariationValuesPtr'] = nullptr;
+ }
}
function freeArrays(textStyle) {
diff --git a/chromium/third_party/skia/modules/canvaskit/paragraph_bindings.cpp b/chromium/third_party/skia/modules/canvaskit/paragraph_bindings.cpp
index 2979bce4140..9584570b634 100644
--- a/chromium/third_party/skia/modules/canvaskit/paragraph_bindings.cpp
+++ b/chromium/third_party/skia/modules/canvaskit/paragraph_bindings.cpp
@@ -69,6 +69,10 @@ struct SimpleTextStyle {
int fontFeatureLen;
WASMPointerF32 fontFeatureNamesPtr;
WASMPointerF32 fontFeatureValuesPtr;
+
+ int fontVariationLen;
+ WASMPointerF32 fontVariationAxesPtr;
+ WASMPointerF32 fontVariationValuesPtr;
};
struct SimpleStrutStyle {
@@ -204,6 +208,28 @@ para::TextStyle toTextStyle(const SimpleTextStyle& s) {
}
}
+ if (s.fontVariationLen > 0) {
+ const char** fontVariationAxes = reinterpret_cast<const char**>(s.fontVariationAxesPtr);
+ const float* fontVariationValues = reinterpret_cast<const float*>(s.fontVariationValuesPtr);
+ std::vector<SkFontArguments::VariationPosition::Coordinate> coordinates;
+ for (int i = 0; i < s.fontVariationLen; i++) {
+ // Font variation axis tags are 4-character simple strings.
+ SkString axis(fontVariationAxes[i]);
+ if (axis.size() != 4) {
+ continue;
+ }
+ coordinates.push_back({
+ SkSetFourByteTag(axis[0], axis[1], axis[2], axis[3]),
+ fontVariationValues[i]
+ });
+ }
+ SkFontArguments::VariationPosition position = {
+ coordinates.data(),
+ static_cast<int>(coordinates.size())
+ };
+ ts.setFontArguments(SkFontArguments().setVariationDesignPosition(position));
+ }
+
return ts;
}
@@ -261,7 +287,7 @@ Float32Array TextBoxesToFloat32Array(std::vector<para::TextBox> boxes) {
return emscripten::val::null();
}
SimpleTextBox* rects = new SimpleTextBox[boxes.size()];
- for (int i = 0; i < boxes.size(); i++) {
+ for (size_t i = 0; i < boxes.size(); i++) {
rects[i].rect = boxes[i].rect;
if (boxes[i].direction == para::TextDirection::kRtl) {
rects[i].direction = 0;
@@ -325,9 +351,9 @@ JSArray GetShapedLines(para::Paragraph& self) {
// not really accumulated, but definitely set
float baseline = 0;
- void reset(int lineNumber) {
+ void reset(int newLineNum) {
new (this) LineAccumulate;
- this->lineNumber = lineNumber;
+ this->lineNumber = newLineNum;
}
};
@@ -622,7 +648,10 @@ EMSCRIPTEN_BINDINGS(Paragraph) {
.field("_shadowBlurRadiiPtr", &SimpleTextStyle::shadowBlurRadiiPtr)
.field("_fontFeatureLen", &SimpleTextStyle::fontFeatureLen)
.field("_fontFeatureNamesPtr", &SimpleTextStyle::fontFeatureNamesPtr)
- .field("_fontFeatureValuesPtr", &SimpleTextStyle::fontFeatureValuesPtr);
+ .field("_fontFeatureValuesPtr", &SimpleTextStyle::fontFeatureValuesPtr)
+ .field("_fontVariationLen", &SimpleTextStyle::fontVariationLen)
+ .field("_fontVariationAxesPtr", &SimpleTextStyle::fontVariationAxesPtr)
+ .field("_fontVariationValuesPtr", &SimpleTextStyle::fontVariationValuesPtr);
// The U stands for unsigned - we can't bind a generic/template object, so we have to specify it
// with the type we are using.
diff --git a/chromium/third_party/skia/modules/canvaskit/gpu.js b/chromium/third_party/skia/modules/canvaskit/webgl.js
index c50d9af1307..18103cdef7c 100644
--- a/chromium/third_party/skia/modules/canvaskit/gpu.js
+++ b/chromium/third_party/skia/modules/canvaskit/webgl.js
@@ -1,5 +1,5 @@
// Adds compile-time JS functions to augment the CanvasKit interface.
-// Specifically, anything that should only be on the GPU version of canvaskit.
+// Specifically, anything that should only be on the WebGL version of canvaskit.
// Functions in this file are supplemented by cpu.js.
(function(CanvasKit){
CanvasKit._extraInitializations = CanvasKit._extraInitializations || [];
@@ -64,7 +64,7 @@
},
});
- CanvasKit.MakeGrContext = function(ctx) {
+ CanvasKit.MakeWebGLContext = function(ctx) {
// Make sure we are pointing at the right WebGL context.
if (!this.setCurrentContext(ctx)) {
return null;
@@ -75,9 +75,13 @@
}
// This context is an index into the emscripten-provided GL wrapper.
grCtx._context = ctx;
+ // Save this so it is easy to access (e.g. Image.readPixels)
+ GL.currentContext.grDirectContext = grCtx;
return grCtx;
}
+ CanvasKit.MakeGrContext = CanvasKit.MakeWebGLContext;
+
CanvasKit.MakeOnScreenGLSurface = function(grCtx, w, h, colorspace) {
if (!this.setCurrentContext(grCtx._context)) {
return null;
@@ -140,11 +144,11 @@
throw 'failed to create webgl context: err ' + ctx;
}
- var grcontext = this.MakeGrContext(ctx);
+ var grcontext = this.MakeWebGLContext(ctx);
// Note that canvas.width/height here is used because it gives the size of the buffer we're
// rendering into. This may not be the same size the element is displayed on the page, which
- // constrolled by css, and available in canvas.clientWidth/height.
+ // controlled by css, and available in canvas.clientWidth/height.
var surface = this.MakeOnScreenGLSurface(grcontext, canvas.width, canvas.height, colorSpace);
if (!surface) {
Debug('falling back from GPU implementation to a SW based one');
@@ -194,13 +198,32 @@
return src['naturalWidth'] || src['videoWidth'] || src['displayWidth'] || src['width'];
}
- CanvasKit.Surface.prototype.makeImageFromTextureSource = function(src, info) {
+ function setupTexture(glCtx, newTex, imageInfo, srcIsPremul) {
+ glCtx.bindTexture(glCtx.TEXTURE_2D, newTex);
+ // See https://github.com/flutter/flutter/issues/106433#issuecomment-1169102945
+ // for an example of what can happen if we do not set this.
+ if (!srcIsPremul && imageInfo['alphaType'] === CanvasKit.AlphaType.Premul) {
+ glCtx.pixelStorei(glCtx.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
+ }
+ return newTex;
+ }
+
+ function resetTexture(glCtx, imageInfo, srcIsPremul) {
+ // If we set this earlier, we want to unset it now.
+ if (!srcIsPremul && imageInfo['alphaType'] === CanvasKit.AlphaType.Premul) {
+ glCtx.pixelStorei(glCtx.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
+ }
+ glCtx.bindTexture(glCtx.TEXTURE_2D, null);
+ }
+
+ CanvasKit.Surface.prototype.makeImageFromTextureSource = function(src, info, srcIsPremul) {
if (!info) {
+ // If the user didn't specify the image info, use some sensible defaults.
info = {
'height': getHeight(src),
'width': getWidth(src),
'colorType': CanvasKit.ColorType.RGBA_8888,
- 'alphaType': CanvasKit.AlphaType.Unpremul,
+ 'alphaType': srcIsPremul ? CanvasKit.AlphaType.Premul: CanvasKit.AlphaType.Unpremul,
};
}
if (!info['colorSpace']) {
@@ -213,40 +236,38 @@
// We want to be pointing at the context associated with this surface.
CanvasKit.setCurrentContext(this._context);
var glCtx = GL.currentContext.GLctx;
- var newTex = glCtx.createTexture();
- glCtx.bindTexture(glCtx.TEXTURE_2D, newTex);
+ var newTex = setupTexture(glCtx, glCtx.createTexture(), info, srcIsPremul);
if (GL.currentContext.version === 2) {
glCtx.texImage2D(glCtx.TEXTURE_2D, 0, glCtx.RGBA, info['width'], info['height'], 0, glCtx.RGBA, glCtx.UNSIGNED_BYTE, src);
} else {
glCtx.texImage2D(glCtx.TEXTURE_2D, 0, glCtx.RGBA, glCtx.RGBA, glCtx.UNSIGNED_BYTE, src);
}
- glCtx.bindTexture(glCtx.TEXTURE_2D, null);
+ resetTexture(glCtx, info);
return this.makeImageFromTexture(newTex, info);
};
- CanvasKit.Surface.prototype.updateTextureFromSource = function(img, src) {
+ CanvasKit.Surface.prototype.updateTextureFromSource = function(img, src, srcIsPremul) {
if (!img._tex) {
Debug('Image is not backed by a user-provided texture');
return;
}
CanvasKit.setCurrentContext(this._context);
+ var ii = img.getImageInfo();
var glCtx = GL.currentContext.GLctx;
// Copy the contents of src over the texture associated with this image.
- var tex = GL.textures[img._tex];
- glCtx.bindTexture(glCtx.TEXTURE_2D, tex);
+ var tex = setupTexture(glCtx, GL.textures[img._tex], ii, srcIsPremul);
if (GL.currentContext.version === 2) {
glCtx.texImage2D(glCtx.TEXTURE_2D, 0, glCtx.RGBA, getWidth(src), getHeight(src), 0, glCtx.RGBA, glCtx.UNSIGNED_BYTE, src);
} else {
glCtx.texImage2D(glCtx.TEXTURE_2D, 0, glCtx.RGBA, glCtx.RGBA, glCtx.UNSIGNED_BYTE, src);
}
- glCtx.bindTexture(glCtx.TEXTURE_2D, null);
+ resetTexture(glCtx, ii, srcIsPremul);
// Tell Skia we messed with the currently bound texture.
this._resetContext();
// Create a new texture entry and put null into the old slot. This keeps our texture alive,
// otherwise it will be deleted when we delete the old Image.
GL.textures[img._tex] = null;
img._tex = pushTexture(tex);
- var ii = img.getImageInfo();
ii['colorSpace'] = img.getColorSpace();
// Skia may cache parts of the image, and some places assume images are immutable. In order
// to make things work, we create a new SkImage based on the same texture as the old image.
@@ -272,13 +293,13 @@
ii['colorSpace'].delete();
}
- CanvasKit.MakeLazyImageFromTextureSource = function(src, info) {
+ CanvasKit.MakeLazyImageFromTextureSource = function(src, info, srcIsPremul) {
if (!info) {
info = {
'height': getHeight(src),
'width': getWidth(src),
'colorType': CanvasKit.ColorType.RGBA_8888,
- 'alphaType': CanvasKit.AlphaType.Unpremul,
+ 'alphaType': srcIsPremul ? CanvasKit.AlphaType.Premul : CanvasKit.AlphaType.Unpremul,
};
}
if (!info['colorSpace']) {
@@ -296,14 +317,13 @@
// This is a lot easier than needing to pass the surface handle from the C++ side here.
var ctx = GL.currentContext;
var glCtx = ctx.GLctx;
- var newTex = glCtx.createTexture();
- glCtx.bindTexture(glCtx.TEXTURE_2D, newTex);
+ var newTex = setupTexture(glCtx, glCtx.createTexture(), info, srcIsPremul);
if (ctx.version === 2) {
glCtx.texImage2D(glCtx.TEXTURE_2D, 0, glCtx.RGBA, info['width'], info['height'], 0, glCtx.RGBA, glCtx.UNSIGNED_BYTE, src);
} else {
glCtx.texImage2D(glCtx.TEXTURE_2D, 0, glCtx.RGBA, glCtx.RGBA, glCtx.UNSIGNED_BYTE, src);
}
- glCtx.bindTexture(glCtx.TEXTURE_2D, null);
+ resetTexture(glCtx, info, srcIsPremul);
return pushTexture(newTex);
},
'freeSrc': function() {
@@ -328,5 +348,12 @@
}
return GL.makeContextCurrent(ctx);
};
+
+ CanvasKit.getCurrentGrDirectContext = function() {
+ if (GL.currentContext) {
+ return GL.currentContext.grDirectContext;
+ }
+ return null;
+ };
});
}(Module)); // When this file is loaded in, the high level object is "Module";
diff --git a/chromium/third_party/skia/modules/canvaskit/webgpu.js b/chromium/third_party/skia/modules/canvaskit/webgpu.js
new file mode 100644
index 00000000000..fe51fe126e5
--- /dev/null
+++ b/chromium/third_party/skia/modules/canvaskit/webgpu.js
@@ -0,0 +1,142 @@
+// Adds compile-time JS functions to augment the CanvasKit interface.
+// Specifically, anything that should only be on the WebGL version of canvaskit.
+// Functions in this file are supplemented by cpu.js.
+(function(CanvasKit){
+ CanvasKit._extraInitializations = CanvasKit._extraInitializations || [];
+ CanvasKit._extraInitializations.push(function() {
+ CanvasKit.MakeGPUDeviceContext = function(device) {
+ if (!device) {
+ return null;
+ }
+
+ // This allows native code to access this device by calling
+ // `emscripten_webgpu_get_device().`
+ CanvasKit.preinitializedWebGPUDevice = device;
+ var context = this._MakeGrContext();
+ context._device = device;
+
+ return context;
+ };
+
+ CanvasKit.MakeGPUCanvasContext = function(devCtx, canvas, opts) {
+ var canvasCtx = canvas.getContext('webgpu');
+ if (!canvasCtx) {
+ return null;
+ }
+
+ let format = (opts && opts.format) ? opts.format : navigator.gpu.getPreferredCanvasFormat();
+ // GPUCanvasConfiguration
+ canvasCtx.configure({
+ device: devCtx._device,
+ format: format,
+ alphaMode: (opts && opts.alphaMode) ? opts.alphaMode : undefined,
+ });
+
+ var context = {
+ '_inner': canvasCtx,
+ '_deviceContext': devCtx,
+ '_textureFormat': format,
+ };
+ context['requestAnimationFrame'] = function(callback) {
+ requestAnimationFrame(function() {
+ const surface = CanvasKit.MakeGPUCanvasSurface(context);
+ if (!surface) {
+ console.error('Failed to initialize Surface for current canvas swapchain texture');
+ return;
+ }
+ callback(surface.getCanvas());
+ surface.flush();
+ surface.dispose();
+ });
+ };
+ return context;
+ };
+
+ CanvasKit.MakeGPUCanvasSurface = function(canvasCtx, colorSpace, width, height) {
+ let context = canvasCtx._inner;
+ if (!width) {
+ width = context.canvas.width;
+ }
+ if (!height) {
+ height = context.canvas.height;
+ }
+ let surface = this.MakeGPUTextureSurface(canvasCtx._deviceContext,
+ context.getCurrentTexture(),
+ canvasCtx._textureFormat,
+ width, height, colorSpace);
+ surface._canvasContext = canvasCtx;
+ return surface;
+ };
+
+ CanvasKit.MakeGPUTextureSurface = function (devCtx, texture, textureFormat, width, height, colorSpace) {
+ colorSpace = colorSpace || null;
+
+ // JsValStore and WebGPU are objects in Emscripten's library_html5_webgpu.js utility
+ // library. JsValStore allows a WebGPU object to be imported by native code by calling the
+ // various `emscripten_webgpu_import_*` functions.
+ //
+ // The CanvasKit WASM module is responsible for removing entries from the value store by
+ // calling `emscripten_webgpu_release_js_handle` after importing the object.
+ //
+ // (see
+ // https://github.com/emscripten-core/emscripten/blob/0e63f74f36b06849ef1c777b130783a43316ade0/src/library_html5_webgpu.js
+ // for reference)
+ return this._MakeGPUTextureSurface(
+ devCtx,
+ this.JsValStore.add(texture),
+ this.WebGPU.TextureFormat.indexOf(textureFormat),
+ width, height,
+ colorSpace);
+ };
+
+ CanvasKit.Surface.prototype.assignCurrentSwapChainTexture = function() {
+ // This feature is only supported for a Surface that was created via MakeGPUCanvasSurface.
+ if (!this._canvasContext) {
+ console.log('Surface is not bound to a canvas context');
+ return false;
+ }
+ let ctx = this._canvasContext._inner;
+ return this._replaceBackendTexture(
+ CanvasKit.JsValStore.add(ctx.getCurrentTexture()),
+ CanvasKit.WebGPU.TextureFormat.indexOf(this._canvasContext._textureFormat),
+ ctx.canvas.width, ctx.canvas.height);
+ };
+
+ CanvasKit.Surface.prototype.requestAnimationFrame = function(callback, dirtyRect) {
+ if (!this.reportBackendTypeIsGPU()) {
+ this._requestAnimationFrameInternal(callback, dirtyRect);
+ return;
+ }
+
+ requestAnimationFrame(function() {
+ // Replace the render target of the Surface with the current swapchain surface if this is
+ // bound to a canvas context.
+ if (this._canvasContext && !this.assignCurrentSwapChainTexture()) {
+ console.log('failed to replace GPU backend texture');
+ return;
+ }
+ callback(this.getCanvas());
+ this.flush(dirtyRect);
+ }.bind(this));
+ };
+
+ CanvasKit.Surface.prototype.drawOnce = function(callback, dirtyRect) {
+ if (!this.reportBackendTypeIsGPU()) {
+ this._drawOnceInternal(callback, dirtyRect);
+ return;
+ }
+
+ requestAnimationFrame(function() {
+ // Replace the render target of the Surface with the current swapchain surface if this is
+ // bound to a canvas context.
+ if (this._canvasContext && !this.assignCurrentSwapChainTexture()) {
+ console.log('failed to replace GPU backend texture');
+ return;
+ }
+ callback(this.getCanvas());
+ this.flush(dirtyRect);
+ this.dispose();
+ }.bind(this));
+ };
+ });
+}(Module)); // When this file is loaded in, the high level object is "Module".
diff --git a/chromium/third_party/skia/modules/particles/BUILD.bazel b/chromium/third_party/skia/modules/particles/BUILD.bazel
index b0487b8c4f1..b1014447df9 100644
--- a/chromium/third_party/skia/modules/particles/BUILD.bazel
+++ b/chromium/third_party/skia/modules/particles/BUILD.bazel
@@ -1,16 +1,16 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy")
+load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_library")
licenses(["notice"])
exports_files_legacy()
-cc_library(
+skia_cc_library(
name = "particles",
srcs = ["//modules/particles/src:srcs"],
hdrs = ["//modules/particles/include:hdrs"],
visibility = ["//:__subpackages__"],
deps = [
- "//:skia_public",
+ "//:skia_internal",
"//modules/skottie",
"//modules/skresources",
],
diff --git a/chromium/third_party/skia/modules/particles/include/SkParticleSerialization.h b/chromium/third_party/skia/modules/particles/include/SkParticleSerialization.h
index 609650af647..808b3220580 100644
--- a/chromium/third_party/skia/modules/particles/include/SkParticleSerialization.h
+++ b/chromium/third_party/skia/modules/particles/include/SkParticleSerialization.h
@@ -35,17 +35,17 @@ public:
SkStrSplit(s.c_str(), "\n", kStrict_SkStrSplitMode, &lines);
fWriter.beginArray(name);
for (const auto& line : lines) {
- fWriter.appendString(line.c_str());
+ fWriter.appendString(line);
}
fWriter.endArray();
} else {
- fWriter.appendString(name, s.c_str());
+ fWriter.appendString(name, s);
}
}
// Compound types
void visit(sk_sp<SkReflected>& e, const SkReflected::Type* baseType) override {
- fWriter.appendString("Type", e ? e->getType()->fName : "Null");
+ fWriter.appendCString("Type", e ? e->getType()->fName : "Null");
}
void enterObject(const char* name) override { fWriter.beginObject(name); }
diff --git a/chromium/third_party/skia/modules/particles/src/SkParticleEffect.cpp b/chromium/third_party/skia/modules/particles/src/SkParticleEffect.cpp
index bf05dfa0bf6..1e32c134e50 100644
--- a/chromium/third_party/skia/modules/particles/src/SkParticleEffect.cpp
+++ b/chromium/third_party/skia/modules/particles/src/SkParticleEffect.cpp
@@ -20,6 +20,7 @@
#include "src/sksl/SkSLCompiler.h"
#include "src/sksl/SkSLUtil.h"
#include "src/sksl/codegen/SkSLVMCodeGenerator.h"
+#include "src/sksl/ir/SkSLProgram.h"
// Cached state for a single program (either all Effect code, or all Particle code)
struct SkParticleProgram {
@@ -157,7 +158,7 @@ void SkParticleEffectParams::prepare(const skresources::ResourceProvider* resour
}
}
- SkSL::Program::Settings settings;
+ SkSL::ProgramSettings settings;
settings.fExternalFunctions = &externalFns;
auto program = compiler.convertProgram(SkSL::ProgramKind::kGeneric, code, settings);
@@ -186,7 +187,7 @@ void SkParticleEffectParams::prepare(const skresources::ResourceProvider* resour
uniformIDs.push_back(b.uniform32(skslUniformPtr, i * sizeof(int)).id);
}
if (!SkSL::ProgramToSkVM(*program, *fn, &b, /*debugTrace=*/nullptr,
- SkMakeSpan(uniformIDs))) {
+ SkSpan(uniformIDs))) {
return skvm::Program{};
}
return b.done();
diff --git a/chromium/third_party/skia/modules/skcms/BUILD.bazel b/chromium/third_party/skia/modules/skcms/BUILD.bazel
new file mode 100644
index 00000000000..267fd638b68
--- /dev/null
+++ b/chromium/third_party/skia/modules/skcms/BUILD.bazel
@@ -0,0 +1,23 @@
+load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_library")
+
+licenses(["notice"])
+
+exports_files_legacy()
+
+skia_cc_library(
+ name = "skcms",
+ srcs = [
+ "skcms.cc",
+ "skcms_internal.h",
+ ],
+ hdrs = [
+ "skcms.h",
+ ],
+ # The following comment will be replaced with G3-specific settings
+ # SKCMS_REPLACE_IN_GOOGLE3_COMPATIBLE_WITH
+ # This header does not compile on its own and is meant to be included from skcms.cc
+ textual_hdrs = [
+ "src/Transform_inl.h",
+ ],
+ visibility = ["//:__subpackages__"],
+)
diff --git a/chromium/third_party/skia/modules/skcms/BUILD.gn b/chromium/third_party/skia/modules/skcms/BUILD.gn
new file mode 100644
index 00000000000..572cb610ef5
--- /dev/null
+++ b/chromium/third_party/skia/modules/skcms/BUILD.gn
@@ -0,0 +1,16 @@
+# Copyright 2022 Google LLC
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("skcms.gni")
+
+static_library("skcms") {
+ cflags = []
+ if (!is_win || is_clang) {
+ cflags += [ "-std=c11" ]
+ }
+
+ public = skcms_public_headers
+ sources = skcms_sources
+}
diff --git a/chromium/third_party/skia/modules/skcms/OWNERS b/chromium/third_party/skia/modules/skcms/OWNERS
new file mode 100644
index 00000000000..cc36d27e3d1
--- /dev/null
+++ b/chromium/third_party/skia/modules/skcms/OWNERS
@@ -0,0 +1,2 @@
+# The auto-roller directly checks in skcms, so give it ownership as well:
+skia-autoroll@skia-public.iam.gserviceaccount.com
diff --git a/chromium/third_party/skia/modules/skcms/README.chromium b/chromium/third_party/skia/modules/skcms/README.chromium
new file mode 100644
index 00000000000..046f6b1d195
--- /dev/null
+++ b/chromium/third_party/skia/modules/skcms/README.chromium
@@ -0,0 +1,5 @@
+Name: skcms
+URL: https://skia.org/
+Version: unknown
+Security Critical: yes
+License: BSD
diff --git a/chromium/third_party/skia/modules/skcms/skcms.cc b/chromium/third_party/skia/modules/skcms/skcms.cc
new file mode 100644
index 00000000000..7d3efa54f18
--- /dev/null
+++ b/chromium/third_party/skia/modules/skcms/skcms.cc
@@ -0,0 +1,3005 @@
+/*
+ * Copyright 2018 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "skcms.h"
+#include "skcms_internal.h"
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if defined(__ARM_NEON)
+ #include <arm_neon.h>
+#elif defined(__SSE__)
+ #include <immintrin.h>
+
+ #if defined(__clang__)
+ // That #include <immintrin.h> is usually enough, but Clang's headers
+ // "helpfully" skip including the whole kitchen sink when _MSC_VER is
+ // defined, because lots of programs on Windows would include that and
+ // it'd be a lot slower. But we want all those headers included so we
+ // can use their features after runtime checks later.
+ #include <smmintrin.h>
+ #include <avxintrin.h>
+ #include <avx2intrin.h>
+ #include <avx512fintrin.h>
+ #include <avx512dqintrin.h>
+ #endif
+#endif
+
+static bool runtime_cpu_detection = true;
+void skcms_DisableRuntimeCPUDetection() {
+ runtime_cpu_detection = false;
+}
+
+// sizeof(x) will return size_t, which is 32-bit on some machines and 64-bit on others.
+// We have better testing on 64-bit machines, so force 32-bit machines to behave like 64-bit.
+//
+// Please do not use sizeof() directly, and size_t only when required.
+// (We have no way of enforcing these requests...)
+#define SAFE_SIZEOF(x) ((uint64_t)sizeof(x))
+
+// Same sort of thing for _Layout structs with a variable sized array at the end (named "variable").
+#define SAFE_FIXED_SIZE(type) ((uint64_t)offsetof(type, variable))
+
+static const union {
+ uint32_t bits;
+ float f;
+} inf_ = { 0x7f800000 };
+#define INFINITY_ inf_.f
+
+#if defined(__clang__) || defined(__GNUC__)
+ #define small_memcpy __builtin_memcpy
+#else
+ #define small_memcpy memcpy
+#endif
+
+static float log2f_(float x) {
+ // The first approximation of log2(x) is its exponent 'e', minus 127.
+ int32_t bits;
+ small_memcpy(&bits, &x, sizeof(bits));
+
+ float e = (float)bits * (1.0f / (1<<23));
+
+ // If we use the mantissa too we can refine the error signficantly.
+ int32_t m_bits = (bits & 0x007fffff) | 0x3f000000;
+ float m;
+ small_memcpy(&m, &m_bits, sizeof(m));
+
+ return (e - 124.225514990f
+ - 1.498030302f*m
+ - 1.725879990f/(0.3520887068f + m));
+}
+static float logf_(float x) {
+ const float ln2 = 0.69314718f;
+ return ln2*log2f_(x);
+}
+
+static float exp2f_(float x) {
+ float fract = x - floorf_(x);
+
+ float fbits = (1.0f * (1<<23)) * (x + 121.274057500f
+ - 1.490129070f*fract
+ + 27.728023300f/(4.84252568f - fract));
+
+ // Before we cast fbits to int32_t, check for out of range values to pacify UBSAN.
+ // INT_MAX is not exactly representable as a float, so exclude it as effectively infinite.
+ // Negative values are effectively underflow - we'll end up returning a (different) negative
+ // value, which makes no sense. So clamp to zero.
+ if (fbits >= (float)INT_MAX) {
+ return INFINITY_;
+ } else if (fbits < 0) {
+ return 0;
+ }
+
+ int32_t bits = (int32_t)fbits;
+ small_memcpy(&x, &bits, sizeof(x));
+ return x;
+}
+
+// Not static, as it's used by some test tools.
+float powf_(float x, float y) {
+ assert (x >= 0);
+ return (x == 0) || (x == 1) ? x
+ : exp2f_(log2f_(x) * y);
+}
+
+static float expf_(float x) {
+ const float log2_e = 1.4426950408889634074f;
+ return exp2f_(log2_e * x);
+}
+
+static float fmaxf_(float x, float y) { return x > y ? x : y; }
+static float fminf_(float x, float y) { return x < y ? x : y; }
+
+static bool isfinitef_(float x) { return 0 == x*0; }
+
+static float minus_1_ulp(float x) {
+ int32_t bits;
+ memcpy(&bits, &x, sizeof(bits));
+ bits = bits - 1;
+ memcpy(&x, &bits, sizeof(bits));
+ return x;
+}
+
+// Most transfer functions we work with are sRGBish.
+// For exotic HDR transfer functions, we encode them using a tf.g that makes no sense,
+// and repurpose the other fields to hold the parameters of the HDR functions.
+enum TFKind { Bad, sRGBish, PQish, HLGish, HLGinvish };
+struct TF_PQish { float A,B,C,D,E,F; };
+struct TF_HLGish { float R,G,a,b,c,K_minus_1; };
+// We didn't originally support a scale factor K for HLG, and instead just stored 0 in
+// the unused `f` field of skcms_TransferFunction for HLGish and HLGInvish transfer functions.
+// By storing f=K-1, those old unusued f=0 values now mean K=1, a noop scale factor.
+
+static float TFKind_marker(TFKind kind) {
+ // We'd use different NaNs, but those aren't guaranteed to be preserved by WASM.
+ return -(float)kind;
+}
+
+static TFKind classify(const skcms_TransferFunction& tf, TF_PQish* pq = nullptr
+ , TF_HLGish* hlg = nullptr) {
+ if (tf.g < 0 && static_cast<float>(static_cast<int>(tf.g)) == tf.g) {
+ // TODO: soundness checks for PQ/HLG like we do for sRGBish?
+ switch ((int)tf.g) {
+ case -PQish: if (pq ) { memcpy(pq , &tf.a, sizeof(*pq )); } return PQish;
+ case -HLGish: if (hlg) { memcpy(hlg, &tf.a, sizeof(*hlg)); } return HLGish;
+ case -HLGinvish: if (hlg) { memcpy(hlg, &tf.a, sizeof(*hlg)); } return HLGinvish;
+ }
+ return Bad;
+ }
+
+ // Basic soundness checks for sRGBish transfer functions.
+ if (isfinitef_(tf.a + tf.b + tf.c + tf.d + tf.e + tf.f + tf.g)
+ // a,c,d,g should be non-negative to make any sense.
+ && tf.a >= 0
+ && tf.c >= 0
+ && tf.d >= 0
+ && tf.g >= 0
+ // Raising a negative value to a fractional tf->g produces complex numbers.
+ && tf.a * tf.d + tf.b >= 0) {
+ return sRGBish;
+ }
+
+ return Bad;
+}
+
+bool skcms_TransferFunction_isSRGBish(const skcms_TransferFunction* tf) {
+ return classify(*tf) == sRGBish;
+}
+bool skcms_TransferFunction_isPQish(const skcms_TransferFunction* tf) {
+ return classify(*tf) == PQish;
+}
+bool skcms_TransferFunction_isHLGish(const skcms_TransferFunction* tf) {
+ return classify(*tf) == HLGish;
+}
+
+bool skcms_TransferFunction_makePQish(skcms_TransferFunction* tf,
+ float A, float B, float C,
+ float D, float E, float F) {
+ *tf = { TFKind_marker(PQish), A,B,C,D,E,F };
+ assert(skcms_TransferFunction_isPQish(tf));
+ return true;
+}
+
+bool skcms_TransferFunction_makeScaledHLGish(skcms_TransferFunction* tf,
+ float K, float R, float G,
+ float a, float b, float c) {
+ *tf = { TFKind_marker(HLGish), R,G, a,b,c, K-1.0f };
+ assert(skcms_TransferFunction_isHLGish(tf));
+ return true;
+}
+
+float skcms_TransferFunction_eval(const skcms_TransferFunction* tf, float x) {
+ float sign = x < 0 ? -1.0f : 1.0f;
+ x *= sign;
+
+ TF_PQish pq;
+ TF_HLGish hlg;
+ switch (classify(*tf, &pq, &hlg)) {
+ case Bad: break;
+
+ case HLGish: {
+ const float K = hlg.K_minus_1 + 1.0f;
+ return K * sign * (x*hlg.R <= 1 ? powf_(x*hlg.R, hlg.G)
+ : expf_((x-hlg.c)*hlg.a) + hlg.b);
+ }
+
+ // skcms_TransferFunction_invert() inverts R, G, and a for HLGinvish so this math is fast.
+ case HLGinvish: {
+ const float K = hlg.K_minus_1 + 1.0f;
+ x /= K;
+ return sign * (x <= 1 ? hlg.R * powf_(x, hlg.G)
+ : hlg.a * logf_(x - hlg.b) + hlg.c);
+ }
+
+
+ case sRGBish: return sign * (x < tf->d ? tf->c * x + tf->f
+ : powf_(tf->a * x + tf->b, tf->g) + tf->e);
+
+ case PQish: return sign * powf_(fmaxf_(pq.A + pq.B * powf_(x, pq.C), 0)
+ / (pq.D + pq.E * powf_(x, pq.C)),
+ pq.F);
+ }
+ return 0;
+}
+
+
+static float eval_curve(const skcms_Curve* curve, float x) {
+ if (curve->table_entries == 0) {
+ return skcms_TransferFunction_eval(&curve->parametric, x);
+ }
+
+ float ix = fmaxf_(0, fminf_(x, 1)) * static_cast<float>(curve->table_entries - 1);
+ int lo = (int) ix ,
+ hi = (int)(float)minus_1_ulp(ix + 1.0f);
+ float t = ix - (float)lo;
+
+ float l, h;
+ if (curve->table_8) {
+ l = curve->table_8[lo] * (1/255.0f);
+ h = curve->table_8[hi] * (1/255.0f);
+ } else {
+ uint16_t be_l, be_h;
+ memcpy(&be_l, curve->table_16 + 2*lo, 2);
+ memcpy(&be_h, curve->table_16 + 2*hi, 2);
+ uint16_t le_l = ((be_l << 8) | (be_l >> 8)) & 0xffff;
+ uint16_t le_h = ((be_h << 8) | (be_h >> 8)) & 0xffff;
+ l = le_l * (1/65535.0f);
+ h = le_h * (1/65535.0f);
+ }
+ return l + (h-l)*t;
+}
+
+float skcms_MaxRoundtripError(const skcms_Curve* curve, const skcms_TransferFunction* inv_tf) {
+ uint32_t N = curve->table_entries > 256 ? curve->table_entries : 256;
+ const float dx = 1.0f / static_cast<float>(N - 1);
+ float err = 0;
+ for (uint32_t i = 0; i < N; i++) {
+ float x = static_cast<float>(i) * dx,
+ y = eval_curve(curve, x);
+ err = fmaxf_(err, fabsf_(x - skcms_TransferFunction_eval(inv_tf, y)));
+ }
+ return err;
+}
+
+bool skcms_AreApproximateInverses(const skcms_Curve* curve, const skcms_TransferFunction* inv_tf) {
+ return skcms_MaxRoundtripError(curve, inv_tf) < (1/512.0f);
+}
+
+// Additional ICC signature values that are only used internally
+enum {
+ // File signature
+ skcms_Signature_acsp = 0x61637370,
+
+ // Tag signatures
+ skcms_Signature_rTRC = 0x72545243,
+ skcms_Signature_gTRC = 0x67545243,
+ skcms_Signature_bTRC = 0x62545243,
+ skcms_Signature_kTRC = 0x6B545243,
+
+ skcms_Signature_rXYZ = 0x7258595A,
+ skcms_Signature_gXYZ = 0x6758595A,
+ skcms_Signature_bXYZ = 0x6258595A,
+
+ skcms_Signature_A2B0 = 0x41324230,
+ skcms_Signature_B2A0 = 0x42324130,
+
+ skcms_Signature_CHAD = 0x63686164,
+ skcms_Signature_WTPT = 0x77747074,
+
+ // Type signatures
+ skcms_Signature_curv = 0x63757276,
+ skcms_Signature_mft1 = 0x6D667431,
+ skcms_Signature_mft2 = 0x6D667432,
+ skcms_Signature_mAB = 0x6D414220,
+ skcms_Signature_mBA = 0x6D424120,
+ skcms_Signature_para = 0x70617261,
+ skcms_Signature_sf32 = 0x73663332,
+ // XYZ is also a PCS signature, so it's defined in skcms.h
+ // skcms_Signature_XYZ = 0x58595A20,
+};
+
+static uint16_t read_big_u16(const uint8_t* ptr) {
+ uint16_t be;
+ memcpy(&be, ptr, sizeof(be));
+#if defined(_MSC_VER)
+ return _byteswap_ushort(be);
+#else
+ return __builtin_bswap16(be);
+#endif
+}
+
+static uint32_t read_big_u32(const uint8_t* ptr) {
+ uint32_t be;
+ memcpy(&be, ptr, sizeof(be));
+#if defined(_MSC_VER)
+ return _byteswap_ulong(be);
+#else
+ return __builtin_bswap32(be);
+#endif
+}
+
+static int32_t read_big_i32(const uint8_t* ptr) {
+ return (int32_t)read_big_u32(ptr);
+}
+
+static float read_big_fixed(const uint8_t* ptr) {
+ return static_cast<float>(read_big_i32(ptr)) * (1.0f / 65536.0f);
+}
+
+// Maps to an in-memory profile so that fields line up to the locations specified
+// in ICC.1:2010, section 7.2
+typedef struct {
+ uint8_t size [ 4];
+ uint8_t cmm_type [ 4];
+ uint8_t version [ 4];
+ uint8_t profile_class [ 4];
+ uint8_t data_color_space [ 4];
+ uint8_t pcs [ 4];
+ uint8_t creation_date_time [12];
+ uint8_t signature [ 4];
+ uint8_t platform [ 4];
+ uint8_t flags [ 4];
+ uint8_t device_manufacturer [ 4];
+ uint8_t device_model [ 4];
+ uint8_t device_attributes [ 8];
+ uint8_t rendering_intent [ 4];
+ uint8_t illuminant_X [ 4];
+ uint8_t illuminant_Y [ 4];
+ uint8_t illuminant_Z [ 4];
+ uint8_t creator [ 4];
+ uint8_t profile_id [16];
+ uint8_t reserved [28];
+ uint8_t tag_count [ 4]; // Technically not part of header, but required
+} header_Layout;
+
+typedef struct {
+ uint8_t signature [4];
+ uint8_t offset [4];
+ uint8_t size [4];
+} tag_Layout;
+
+static const tag_Layout* get_tag_table(const skcms_ICCProfile* profile) {
+ return (const tag_Layout*)(profile->buffer + SAFE_SIZEOF(header_Layout));
+}
+
+// s15Fixed16ArrayType is technically variable sized, holding N values. However, the only valid
+// use of the type is for the CHAD tag that stores exactly nine values.
+typedef struct {
+ uint8_t type [ 4];
+ uint8_t reserved [ 4];
+ uint8_t values [36];
+} sf32_Layout;
+
+bool skcms_GetCHAD(const skcms_ICCProfile* profile, skcms_Matrix3x3* m) {
+ skcms_ICCTag tag;
+ if (!skcms_GetTagBySignature(profile, skcms_Signature_CHAD, &tag)) {
+ return false;
+ }
+
+ if (tag.type != skcms_Signature_sf32 || tag.size < SAFE_SIZEOF(sf32_Layout)) {
+ return false;
+ }
+
+ const sf32_Layout* sf32Tag = (const sf32_Layout*)tag.buf;
+ const uint8_t* values = sf32Tag->values;
+ for (int r = 0; r < 3; ++r)
+ for (int c = 0; c < 3; ++c, values += 4) {
+ m->vals[r][c] = read_big_fixed(values);
+ }
+ return true;
+}
+
+// XYZType is technically variable sized, holding N XYZ triples. However, the only valid uses of
+// the type are for tags/data that store exactly one triple.
+typedef struct {
+ uint8_t type [4];
+ uint8_t reserved [4];
+ uint8_t X [4];
+ uint8_t Y [4];
+ uint8_t Z [4];
+} XYZ_Layout;
+
+static bool read_tag_xyz(const skcms_ICCTag* tag, float* x, float* y, float* z) {
+ if (tag->type != skcms_Signature_XYZ || tag->size < SAFE_SIZEOF(XYZ_Layout)) {
+ return false;
+ }
+
+ const XYZ_Layout* xyzTag = (const XYZ_Layout*)tag->buf;
+
+ *x = read_big_fixed(xyzTag->X);
+ *y = read_big_fixed(xyzTag->Y);
+ *z = read_big_fixed(xyzTag->Z);
+ return true;
+}
+
+bool skcms_GetWTPT(const skcms_ICCProfile* profile, float xyz[3]) {
+ skcms_ICCTag tag;
+ return skcms_GetTagBySignature(profile, skcms_Signature_WTPT, &tag) &&
+ read_tag_xyz(&tag, &xyz[0], &xyz[1], &xyz[2]);
+}
+
+static bool read_to_XYZD50(const skcms_ICCTag* rXYZ, const skcms_ICCTag* gXYZ,
+ const skcms_ICCTag* bXYZ, skcms_Matrix3x3* toXYZ) {
+ return read_tag_xyz(rXYZ, &toXYZ->vals[0][0], &toXYZ->vals[1][0], &toXYZ->vals[2][0]) &&
+ read_tag_xyz(gXYZ, &toXYZ->vals[0][1], &toXYZ->vals[1][1], &toXYZ->vals[2][1]) &&
+ read_tag_xyz(bXYZ, &toXYZ->vals[0][2], &toXYZ->vals[1][2], &toXYZ->vals[2][2]);
+}
+
+typedef struct {
+ uint8_t type [4];
+ uint8_t reserved_a [4];
+ uint8_t function_type [2];
+ uint8_t reserved_b [2];
+ uint8_t variable [1/*variable*/]; // 1, 3, 4, 5, or 7 s15.16, depending on function_type
+} para_Layout;
+
+static bool read_curve_para(const uint8_t* buf, uint32_t size,
+ skcms_Curve* curve, uint32_t* curve_size) {
+ if (size < SAFE_FIXED_SIZE(para_Layout)) {
+ return false;
+ }
+
+ const para_Layout* paraTag = (const para_Layout*)buf;
+
+ enum { kG = 0, kGAB = 1, kGABC = 2, kGABCD = 3, kGABCDEF = 4 };
+ uint16_t function_type = read_big_u16(paraTag->function_type);
+ if (function_type > kGABCDEF) {
+ return false;
+ }
+
+ static const uint32_t curve_bytes[] = { 4, 12, 16, 20, 28 };
+ if (size < SAFE_FIXED_SIZE(para_Layout) + curve_bytes[function_type]) {
+ return false;
+ }
+
+ if (curve_size) {
+ *curve_size = SAFE_FIXED_SIZE(para_Layout) + curve_bytes[function_type];
+ }
+
+ curve->table_entries = 0;
+ curve->parametric.a = 1.0f;
+ curve->parametric.b = 0.0f;
+ curve->parametric.c = 0.0f;
+ curve->parametric.d = 0.0f;
+ curve->parametric.e = 0.0f;
+ curve->parametric.f = 0.0f;
+ curve->parametric.g = read_big_fixed(paraTag->variable);
+
+ switch (function_type) {
+ case kGAB:
+ curve->parametric.a = read_big_fixed(paraTag->variable + 4);
+ curve->parametric.b = read_big_fixed(paraTag->variable + 8);
+ if (curve->parametric.a == 0) {
+ return false;
+ }
+ curve->parametric.d = -curve->parametric.b / curve->parametric.a;
+ break;
+ case kGABC:
+ curve->parametric.a = read_big_fixed(paraTag->variable + 4);
+ curve->parametric.b = read_big_fixed(paraTag->variable + 8);
+ curve->parametric.e = read_big_fixed(paraTag->variable + 12);
+ if (curve->parametric.a == 0) {
+ return false;
+ }
+ curve->parametric.d = -curve->parametric.b / curve->parametric.a;
+ curve->parametric.f = curve->parametric.e;
+ break;
+ case kGABCD:
+ curve->parametric.a = read_big_fixed(paraTag->variable + 4);
+ curve->parametric.b = read_big_fixed(paraTag->variable + 8);
+ curve->parametric.c = read_big_fixed(paraTag->variable + 12);
+ curve->parametric.d = read_big_fixed(paraTag->variable + 16);
+ break;
+ case kGABCDEF:
+ curve->parametric.a = read_big_fixed(paraTag->variable + 4);
+ curve->parametric.b = read_big_fixed(paraTag->variable + 8);
+ curve->parametric.c = read_big_fixed(paraTag->variable + 12);
+ curve->parametric.d = read_big_fixed(paraTag->variable + 16);
+ curve->parametric.e = read_big_fixed(paraTag->variable + 20);
+ curve->parametric.f = read_big_fixed(paraTag->variable + 24);
+ break;
+ }
+ return skcms_TransferFunction_isSRGBish(&curve->parametric);
+}
+
+typedef struct {
+ uint8_t type [4];
+ uint8_t reserved [4];
+ uint8_t value_count [4];
+ uint8_t variable [1/*variable*/]; // value_count, 8.8 if 1, uint16 (n*65535) if > 1
+} curv_Layout;
+
+static bool read_curve_curv(const uint8_t* buf, uint32_t size,
+ skcms_Curve* curve, uint32_t* curve_size) {
+ if (size < SAFE_FIXED_SIZE(curv_Layout)) {
+ return false;
+ }
+
+ const curv_Layout* curvTag = (const curv_Layout*)buf;
+
+ uint32_t value_count = read_big_u32(curvTag->value_count);
+ if (size < SAFE_FIXED_SIZE(curv_Layout) + value_count * SAFE_SIZEOF(uint16_t)) {
+ return false;
+ }
+
+ if (curve_size) {
+ *curve_size = SAFE_FIXED_SIZE(curv_Layout) + value_count * SAFE_SIZEOF(uint16_t);
+ }
+
+ if (value_count < 2) {
+ curve->table_entries = 0;
+ curve->parametric.a = 1.0f;
+ curve->parametric.b = 0.0f;
+ curve->parametric.c = 0.0f;
+ curve->parametric.d = 0.0f;
+ curve->parametric.e = 0.0f;
+ curve->parametric.f = 0.0f;
+ if (value_count == 0) {
+ // Empty tables are a shorthand for an identity curve
+ curve->parametric.g = 1.0f;
+ } else {
+ // Single entry tables are a shorthand for simple gamma
+ curve->parametric.g = read_big_u16(curvTag->variable) * (1.0f / 256.0f);
+ }
+ } else {
+ curve->table_8 = nullptr;
+ curve->table_16 = curvTag->variable;
+ curve->table_entries = value_count;
+ }
+
+ return true;
+}
+
+// Parses both curveType and parametricCurveType data. Ensures that at most 'size' bytes are read.
+// If curve_size is not nullptr, writes the number of bytes used by the curve in (*curve_size).
+static bool read_curve(const uint8_t* buf, uint32_t size,
+ skcms_Curve* curve, uint32_t* curve_size) {
+ if (!buf || size < 4 || !curve) {
+ return false;
+ }
+
+ uint32_t type = read_big_u32(buf);
+ if (type == skcms_Signature_para) {
+ return read_curve_para(buf, size, curve, curve_size);
+ } else if (type == skcms_Signature_curv) {
+ return read_curve_curv(buf, size, curve, curve_size);
+ }
+
+ return false;
+}
+
+// mft1 and mft2 share a large chunk of data
+typedef struct {
+ uint8_t type [ 4];
+ uint8_t reserved_a [ 4];
+ uint8_t input_channels [ 1];
+ uint8_t output_channels [ 1];
+ uint8_t grid_points [ 1];
+ uint8_t reserved_b [ 1];
+ uint8_t matrix [36];
+} mft_CommonLayout;
+
+typedef struct {
+ mft_CommonLayout common [1];
+
+ uint8_t variable [1/*variable*/];
+} mft1_Layout;
+
+typedef struct {
+ mft_CommonLayout common [1];
+
+ uint8_t input_table_entries [2];
+ uint8_t output_table_entries [2];
+ uint8_t variable [1/*variable*/];
+} mft2_Layout;
+
+static bool read_mft_common(const mft_CommonLayout* mftTag, skcms_A2B* a2b) {
+ // MFT matrices are applied before the first set of curves, but must be identity unless the
+ // input is PCSXYZ. We don't support PCSXYZ profiles, so we ignore this matrix. Note that the
+ // matrix in skcms_A2B is applied later in the pipe, so supporting this would require another
+ // field/flag.
+ a2b->matrix_channels = 0;
+ a2b-> input_channels = mftTag-> input_channels[0];
+ a2b->output_channels = mftTag->output_channels[0];
+
+ // We require exactly three (ie XYZ/Lab/RGB) output channels
+ if (a2b->output_channels != ARRAY_COUNT(a2b->output_curves)) {
+ return false;
+ }
+ // We require at least one, and no more than four (ie CMYK) input channels
+ if (a2b->input_channels < 1 || a2b->input_channels > ARRAY_COUNT(a2b->input_curves)) {
+ return false;
+ }
+
+ for (uint32_t i = 0; i < a2b->input_channels; ++i) {
+ a2b->grid_points[i] = mftTag->grid_points[0];
+ }
+ // The grid only makes sense with at least two points along each axis
+ if (a2b->grid_points[0] < 2) {
+ return false;
+ }
+ return true;
+}
+
+// All as the A2B version above, except where noted.
+static bool read_mft_common(const mft_CommonLayout* mftTag, skcms_B2A* b2a) {
+ // Same as A2B.
+ b2a->matrix_channels = 0;
+ b2a-> input_channels = mftTag-> input_channels[0];
+ b2a->output_channels = mftTag->output_channels[0];
+
+
+ // For B2A, exactly 3 input channels (XYZ) and 3 (RGB) or 4 (CMYK) output channels.
+ if (b2a->input_channels != ARRAY_COUNT(b2a->input_curves)) {
+ return false;
+ }
+ if (b2a->output_channels < 3 || b2a->output_channels > ARRAY_COUNT(b2a->output_curves)) {
+ return false;
+ }
+
+ // Same as A2B.
+ for (uint32_t i = 0; i < b2a->input_channels; ++i) {
+ b2a->grid_points[i] = mftTag->grid_points[0];
+ }
+ if (b2a->grid_points[0] < 2) {
+ return false;
+ }
+ return true;
+}
+
+template <typename A2B_or_B2A>
+static bool init_tables(const uint8_t* table_base, uint64_t max_tables_len, uint32_t byte_width,
+ uint32_t input_table_entries, uint32_t output_table_entries,
+ A2B_or_B2A* out) {
+ // byte_width is 1 or 2, [input|output]_table_entries are in [2, 4096], so no overflow
+ uint32_t byte_len_per_input_table = input_table_entries * byte_width;
+ uint32_t byte_len_per_output_table = output_table_entries * byte_width;
+
+ // [input|output]_channels are <= 4, so still no overflow
+ uint32_t byte_len_all_input_tables = out->input_channels * byte_len_per_input_table;
+ uint32_t byte_len_all_output_tables = out->output_channels * byte_len_per_output_table;
+
+ uint64_t grid_size = out->output_channels * byte_width;
+ for (uint32_t axis = 0; axis < out->input_channels; ++axis) {
+ grid_size *= out->grid_points[axis];
+ }
+
+ if (max_tables_len < byte_len_all_input_tables + grid_size + byte_len_all_output_tables) {
+ return false;
+ }
+
+ for (uint32_t i = 0; i < out->input_channels; ++i) {
+ out->input_curves[i].table_entries = input_table_entries;
+ if (byte_width == 1) {
+ out->input_curves[i].table_8 = table_base + i * byte_len_per_input_table;
+ out->input_curves[i].table_16 = nullptr;
+ } else {
+ out->input_curves[i].table_8 = nullptr;
+ out->input_curves[i].table_16 = table_base + i * byte_len_per_input_table;
+ }
+ }
+
+ if (byte_width == 1) {
+ out->grid_8 = table_base + byte_len_all_input_tables;
+ out->grid_16 = nullptr;
+ } else {
+ out->grid_8 = nullptr;
+ out->grid_16 = table_base + byte_len_all_input_tables;
+ }
+
+ const uint8_t* output_table_base = table_base + byte_len_all_input_tables + grid_size;
+ for (uint32_t i = 0; i < out->output_channels; ++i) {
+ out->output_curves[i].table_entries = output_table_entries;
+ if (byte_width == 1) {
+ out->output_curves[i].table_8 = output_table_base + i * byte_len_per_output_table;
+ out->output_curves[i].table_16 = nullptr;
+ } else {
+ out->output_curves[i].table_8 = nullptr;
+ out->output_curves[i].table_16 = output_table_base + i * byte_len_per_output_table;
+ }
+ }
+
+ return true;
+}
+
+template <typename A2B_or_B2A>
+static bool read_tag_mft1(const skcms_ICCTag* tag, A2B_or_B2A* out) {
+ if (tag->size < SAFE_FIXED_SIZE(mft1_Layout)) {
+ return false;
+ }
+
+ const mft1_Layout* mftTag = (const mft1_Layout*)tag->buf;
+ if (!read_mft_common(mftTag->common, out)) {
+ return false;
+ }
+
+ uint32_t input_table_entries = 256;
+ uint32_t output_table_entries = 256;
+
+ return init_tables(mftTag->variable, tag->size - SAFE_FIXED_SIZE(mft1_Layout), 1,
+ input_table_entries, output_table_entries, out);
+}
+
+template <typename A2B_or_B2A>
+static bool read_tag_mft2(const skcms_ICCTag* tag, A2B_or_B2A* out) {
+ if (tag->size < SAFE_FIXED_SIZE(mft2_Layout)) {
+ return false;
+ }
+
+ const mft2_Layout* mftTag = (const mft2_Layout*)tag->buf;
+ if (!read_mft_common(mftTag->common, out)) {
+ return false;
+ }
+
+ uint32_t input_table_entries = read_big_u16(mftTag->input_table_entries);
+ uint32_t output_table_entries = read_big_u16(mftTag->output_table_entries);
+
+ // ICC spec mandates that 2 <= table_entries <= 4096
+ if (input_table_entries < 2 || input_table_entries > 4096 ||
+ output_table_entries < 2 || output_table_entries > 4096) {
+ return false;
+ }
+
+ return init_tables(mftTag->variable, tag->size - SAFE_FIXED_SIZE(mft2_Layout), 2,
+ input_table_entries, output_table_entries, out);
+}
+
+static bool read_curves(const uint8_t* buf, uint32_t size, uint32_t curve_offset,
+ uint32_t num_curves, skcms_Curve* curves) {
+ for (uint32_t i = 0; i < num_curves; ++i) {
+ if (curve_offset > size) {
+ return false;
+ }
+
+ uint32_t curve_bytes;
+ if (!read_curve(buf + curve_offset, size - curve_offset, &curves[i], &curve_bytes)) {
+ return false;
+ }
+
+ if (curve_bytes > UINT32_MAX - 3) {
+ return false;
+ }
+ curve_bytes = (curve_bytes + 3) & ~3U;
+
+ uint64_t new_offset_64 = (uint64_t)curve_offset + curve_bytes;
+ curve_offset = (uint32_t)new_offset_64;
+ if (new_offset_64 != curve_offset) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+// mAB and mBA tags use the same encoding, including color lookup tables.
+typedef struct {
+ uint8_t type [ 4];
+ uint8_t reserved_a [ 4];
+ uint8_t input_channels [ 1];
+ uint8_t output_channels [ 1];
+ uint8_t reserved_b [ 2];
+ uint8_t b_curve_offset [ 4];
+ uint8_t matrix_offset [ 4];
+ uint8_t m_curve_offset [ 4];
+ uint8_t clut_offset [ 4];
+ uint8_t a_curve_offset [ 4];
+} mAB_or_mBA_Layout;
+
+typedef struct {
+ uint8_t grid_points [16];
+ uint8_t grid_byte_width [ 1];
+ uint8_t reserved [ 3];
+ uint8_t variable [1/*variable*/];
+} CLUT_Layout;
+
+static bool read_tag_mab(const skcms_ICCTag* tag, skcms_A2B* a2b, bool pcs_is_xyz) {
+ if (tag->size < SAFE_SIZEOF(mAB_or_mBA_Layout)) {
+ return false;
+ }
+
+ const mAB_or_mBA_Layout* mABTag = (const mAB_or_mBA_Layout*)tag->buf;
+
+ a2b->input_channels = mABTag->input_channels[0];
+ a2b->output_channels = mABTag->output_channels[0];
+
+ // We require exactly three (ie XYZ/Lab/RGB) output channels
+ if (a2b->output_channels != ARRAY_COUNT(a2b->output_curves)) {
+ return false;
+ }
+ // We require no more than four (ie CMYK) input channels
+ if (a2b->input_channels > ARRAY_COUNT(a2b->input_curves)) {
+ return false;
+ }
+
+ uint32_t b_curve_offset = read_big_u32(mABTag->b_curve_offset);
+ uint32_t matrix_offset = read_big_u32(mABTag->matrix_offset);
+ uint32_t m_curve_offset = read_big_u32(mABTag->m_curve_offset);
+ uint32_t clut_offset = read_big_u32(mABTag->clut_offset);
+ uint32_t a_curve_offset = read_big_u32(mABTag->a_curve_offset);
+
+ // "B" curves must be present
+ if (0 == b_curve_offset) {
+ return false;
+ }
+
+ if (!read_curves(tag->buf, tag->size, b_curve_offset, a2b->output_channels,
+ a2b->output_curves)) {
+ return false;
+ }
+
+ // "M" curves and Matrix must be used together
+ if (0 != m_curve_offset) {
+ if (0 == matrix_offset) {
+ return false;
+ }
+ a2b->matrix_channels = a2b->output_channels;
+ if (!read_curves(tag->buf, tag->size, m_curve_offset, a2b->matrix_channels,
+ a2b->matrix_curves)) {
+ return false;
+ }
+
+ // Read matrix, which is stored as a row-major 3x3, followed by the fourth column
+ if (tag->size < matrix_offset + 12 * SAFE_SIZEOF(uint32_t)) {
+ return false;
+ }
+ float encoding_factor = pcs_is_xyz ? (65535 / 32768.0f) : 1.0f;
+ const uint8_t* mtx_buf = tag->buf + matrix_offset;
+ a2b->matrix.vals[0][0] = encoding_factor * read_big_fixed(mtx_buf + 0);
+ a2b->matrix.vals[0][1] = encoding_factor * read_big_fixed(mtx_buf + 4);
+ a2b->matrix.vals[0][2] = encoding_factor * read_big_fixed(mtx_buf + 8);
+ a2b->matrix.vals[1][0] = encoding_factor * read_big_fixed(mtx_buf + 12);
+ a2b->matrix.vals[1][1] = encoding_factor * read_big_fixed(mtx_buf + 16);
+ a2b->matrix.vals[1][2] = encoding_factor * read_big_fixed(mtx_buf + 20);
+ a2b->matrix.vals[2][0] = encoding_factor * read_big_fixed(mtx_buf + 24);
+ a2b->matrix.vals[2][1] = encoding_factor * read_big_fixed(mtx_buf + 28);
+ a2b->matrix.vals[2][2] = encoding_factor * read_big_fixed(mtx_buf + 32);
+ a2b->matrix.vals[0][3] = encoding_factor * read_big_fixed(mtx_buf + 36);
+ a2b->matrix.vals[1][3] = encoding_factor * read_big_fixed(mtx_buf + 40);
+ a2b->matrix.vals[2][3] = encoding_factor * read_big_fixed(mtx_buf + 44);
+ } else {
+ if (0 != matrix_offset) {
+ return false;
+ }
+ a2b->matrix_channels = 0;
+ }
+
+ // "A" curves and CLUT must be used together
+ if (0 != a_curve_offset) {
+ if (0 == clut_offset) {
+ return false;
+ }
+ if (!read_curves(tag->buf, tag->size, a_curve_offset, a2b->input_channels,
+ a2b->input_curves)) {
+ return false;
+ }
+
+ if (tag->size < clut_offset + SAFE_FIXED_SIZE(CLUT_Layout)) {
+ return false;
+ }
+ const CLUT_Layout* clut = (const CLUT_Layout*)(tag->buf + clut_offset);
+
+ if (clut->grid_byte_width[0] == 1) {
+ a2b->grid_8 = clut->variable;
+ a2b->grid_16 = nullptr;
+ } else if (clut->grid_byte_width[0] == 2) {
+ a2b->grid_8 = nullptr;
+ a2b->grid_16 = clut->variable;
+ } else {
+ return false;
+ }
+
+ uint64_t grid_size = a2b->output_channels * clut->grid_byte_width[0]; // the payload
+ for (uint32_t i = 0; i < a2b->input_channels; ++i) {
+ a2b->grid_points[i] = clut->grid_points[i];
+ // The grid only makes sense with at least two points along each axis
+ if (a2b->grid_points[i] < 2) {
+ return false;
+ }
+ grid_size *= a2b->grid_points[i];
+ }
+ if (tag->size < clut_offset + SAFE_FIXED_SIZE(CLUT_Layout) + grid_size) {
+ return false;
+ }
+ } else {
+ if (0 != clut_offset) {
+ return false;
+ }
+
+ // If there is no CLUT, the number of input and output channels must match
+ if (a2b->input_channels != a2b->output_channels) {
+ return false;
+ }
+
+ // Zero out the number of input channels to signal that we're skipping this stage
+ a2b->input_channels = 0;
+ }
+
+ return true;
+}
+
+// Exactly the same as read_tag_mab(), except where there are comments.
+// TODO: refactor the two to eliminate common code?
+static bool read_tag_mba(const skcms_ICCTag* tag, skcms_B2A* b2a, bool pcs_is_xyz) {
+ if (tag->size < SAFE_SIZEOF(mAB_or_mBA_Layout)) {
+ return false;
+ }
+
+ const mAB_or_mBA_Layout* mBATag = (const mAB_or_mBA_Layout*)tag->buf;
+
+ b2a->input_channels = mBATag->input_channels[0];
+ b2a->output_channels = mBATag->output_channels[0];
+
+ // Require exactly 3 inputs (XYZ) and 3 (RGB) or 4 (CMYK) outputs.
+ if (b2a->input_channels != ARRAY_COUNT(b2a->input_curves)) {
+ return false;
+ }
+ if (b2a->output_channels < 3 || b2a->output_channels > ARRAY_COUNT(b2a->output_curves)) {
+ return false;
+ }
+
+ uint32_t b_curve_offset = read_big_u32(mBATag->b_curve_offset);
+ uint32_t matrix_offset = read_big_u32(mBATag->matrix_offset);
+ uint32_t m_curve_offset = read_big_u32(mBATag->m_curve_offset);
+ uint32_t clut_offset = read_big_u32(mBATag->clut_offset);
+ uint32_t a_curve_offset = read_big_u32(mBATag->a_curve_offset);
+
+ if (0 == b_curve_offset) {
+ return false;
+ }
+
+ // "B" curves are our inputs, not outputs.
+ if (!read_curves(tag->buf, tag->size, b_curve_offset, b2a->input_channels,
+ b2a->input_curves)) {
+ return false;
+ }
+
+ if (0 != m_curve_offset) {
+ if (0 == matrix_offset) {
+ return false;
+ }
+ // Matrix channels is tied to input_channels (3), not output_channels.
+ b2a->matrix_channels = b2a->input_channels;
+
+ if (!read_curves(tag->buf, tag->size, m_curve_offset, b2a->matrix_channels,
+ b2a->matrix_curves)) {
+ return false;
+ }
+
+ if (tag->size < matrix_offset + 12 * SAFE_SIZEOF(uint32_t)) {
+ return false;
+ }
+ float encoding_factor = pcs_is_xyz ? (32768 / 65535.0f) : 1.0f; // TODO: understand
+ const uint8_t* mtx_buf = tag->buf + matrix_offset;
+ b2a->matrix.vals[0][0] = encoding_factor * read_big_fixed(mtx_buf + 0);
+ b2a->matrix.vals[0][1] = encoding_factor * read_big_fixed(mtx_buf + 4);
+ b2a->matrix.vals[0][2] = encoding_factor * read_big_fixed(mtx_buf + 8);
+ b2a->matrix.vals[1][0] = encoding_factor * read_big_fixed(mtx_buf + 12);
+ b2a->matrix.vals[1][1] = encoding_factor * read_big_fixed(mtx_buf + 16);
+ b2a->matrix.vals[1][2] = encoding_factor * read_big_fixed(mtx_buf + 20);
+ b2a->matrix.vals[2][0] = encoding_factor * read_big_fixed(mtx_buf + 24);
+ b2a->matrix.vals[2][1] = encoding_factor * read_big_fixed(mtx_buf + 28);
+ b2a->matrix.vals[2][2] = encoding_factor * read_big_fixed(mtx_buf + 32);
+ b2a->matrix.vals[0][3] = encoding_factor * read_big_fixed(mtx_buf + 36);
+ b2a->matrix.vals[1][3] = encoding_factor * read_big_fixed(mtx_buf + 40);
+ b2a->matrix.vals[2][3] = encoding_factor * read_big_fixed(mtx_buf + 44);
+ } else {
+ if (0 != matrix_offset) {
+ return false;
+ }
+ b2a->matrix_channels = 0;
+ }
+
+ if (0 != a_curve_offset) {
+ if (0 == clut_offset) {
+ return false;
+ }
+
+ // "A" curves are our output, not input.
+ if (!read_curves(tag->buf, tag->size, a_curve_offset, b2a->output_channels,
+ b2a->output_curves)) {
+ return false;
+ }
+
+ if (tag->size < clut_offset + SAFE_FIXED_SIZE(CLUT_Layout)) {
+ return false;
+ }
+ const CLUT_Layout* clut = (const CLUT_Layout*)(tag->buf + clut_offset);
+
+ if (clut->grid_byte_width[0] == 1) {
+ b2a->grid_8 = clut->variable;
+ b2a->grid_16 = nullptr;
+ } else if (clut->grid_byte_width[0] == 2) {
+ b2a->grid_8 = nullptr;
+ b2a->grid_16 = clut->variable;
+ } else {
+ return false;
+ }
+
+ uint64_t grid_size = b2a->output_channels * clut->grid_byte_width[0];
+ for (uint32_t i = 0; i < b2a->input_channels; ++i) {
+ b2a->grid_points[i] = clut->grid_points[i];
+ if (b2a->grid_points[i] < 2) {
+ return false;
+ }
+ grid_size *= b2a->grid_points[i];
+ }
+ if (tag->size < clut_offset + SAFE_FIXED_SIZE(CLUT_Layout) + grid_size) {
+ return false;
+ }
+ } else {
+ if (0 != clut_offset) {
+ return false;
+ }
+
+ if (b2a->input_channels != b2a->output_channels) {
+ return false;
+ }
+
+ // Zero out *output* channels to skip this stage.
+ b2a->output_channels = 0;
+ }
+ return true;
+}
+
+// If you pass f, we'll fit a possibly-non-zero value for *f.
+// If you pass nullptr, we'll assume you want *f to be treated as zero.
+static int fit_linear(const skcms_Curve* curve, int N, float tol,
+ float* c, float* d, float* f = nullptr) {
+ assert(N > 1);
+ // We iteratively fit the first points to the TF's linear piece.
+ // We want the cx + f line to pass through the first and last points we fit exactly.
+ //
+ // As we walk along the points we find the minimum and maximum slope of the line before the
+ // error would exceed our tolerance. We stop when the range [slope_min, slope_max] becomes
+ // emtpy, when we definitely can't add any more points.
+ //
+ // Some points' error intervals may intersect the running interval but not lie fully
+ // within it. So we keep track of the last point we saw that is a valid end point candidate,
+ // and once the search is done, back up to build the line through *that* point.
+ const float dx = 1.0f / static_cast<float>(N - 1);
+
+ int lin_points = 1;
+
+ float f_zero = 0.0f;
+ if (f) {
+ *f = eval_curve(curve, 0);
+ } else {
+ f = &f_zero;
+ }
+
+
+ float slope_min = -INFINITY_;
+ float slope_max = +INFINITY_;
+ for (int i = 1; i < N; ++i) {
+ float x = static_cast<float>(i) * dx;
+ float y = eval_curve(curve, x);
+
+ float slope_max_i = (y + tol - *f) / x,
+ slope_min_i = (y - tol - *f) / x;
+ if (slope_max_i < slope_min || slope_max < slope_min_i) {
+ // Slope intervals would no longer overlap.
+ break;
+ }
+ slope_max = fminf_(slope_max, slope_max_i);
+ slope_min = fmaxf_(slope_min, slope_min_i);
+
+ float cur_slope = (y - *f) / x;
+ if (slope_min <= cur_slope && cur_slope <= slope_max) {
+ lin_points = i + 1;
+ *c = cur_slope;
+ }
+ }
+
+ // Set D to the last point that met our tolerance.
+ *d = static_cast<float>(lin_points - 1) * dx;
+ return lin_points;
+}
+
+// If this skcms_Curve holds an identity table, rewrite it as an identity skcms_TransferFunction.
+static void canonicalize_identity(skcms_Curve* curve) {
+ if (curve->table_entries && curve->table_entries <= (uint32_t)INT_MAX) {
+ int N = (int)curve->table_entries;
+
+ float c = 0.0f, d = 0.0f, f = 0.0f;
+ if (N == fit_linear(curve, N, 1.0f/static_cast<float>(2*N), &c,&d,&f)
+ && c == 1.0f
+ && f == 0.0f) {
+ curve->table_entries = 0;
+ curve->table_8 = nullptr;
+ curve->table_16 = nullptr;
+ curve->parametric = skcms_TransferFunction{1,1,0,0,0,0,0};
+ }
+ }
+}
+
+static bool read_a2b(const skcms_ICCTag* tag, skcms_A2B* a2b, bool pcs_is_xyz) {
+ bool ok = false;
+ if (tag->type == skcms_Signature_mft1) { ok = read_tag_mft1(tag, a2b); }
+ if (tag->type == skcms_Signature_mft2) { ok = read_tag_mft2(tag, a2b); }
+ if (tag->type == skcms_Signature_mAB ) { ok = read_tag_mab(tag, a2b, pcs_is_xyz); }
+ if (!ok) {
+ return false;
+ }
+
+ if (a2b->input_channels > 0) { canonicalize_identity(a2b->input_curves + 0); }
+ if (a2b->input_channels > 1) { canonicalize_identity(a2b->input_curves + 1); }
+ if (a2b->input_channels > 2) { canonicalize_identity(a2b->input_curves + 2); }
+ if (a2b->input_channels > 3) { canonicalize_identity(a2b->input_curves + 3); }
+
+ if (a2b->matrix_channels > 0) { canonicalize_identity(a2b->matrix_curves + 0); }
+ if (a2b->matrix_channels > 1) { canonicalize_identity(a2b->matrix_curves + 1); }
+ if (a2b->matrix_channels > 2) { canonicalize_identity(a2b->matrix_curves + 2); }
+
+ if (a2b->output_channels > 0) { canonicalize_identity(a2b->output_curves + 0); }
+ if (a2b->output_channels > 1) { canonicalize_identity(a2b->output_curves + 1); }
+ if (a2b->output_channels > 2) { canonicalize_identity(a2b->output_curves + 2); }
+
+ return true;
+}
+
+static bool read_b2a(const skcms_ICCTag* tag, skcms_B2A* b2a, bool pcs_is_xyz) {
+ bool ok = false;
+ if (tag->type == skcms_Signature_mft1) { ok = read_tag_mft1(tag, b2a); }
+ if (tag->type == skcms_Signature_mft2) { ok = read_tag_mft2(tag, b2a); }
+ if (tag->type == skcms_Signature_mBA ) { ok = read_tag_mba(tag, b2a, pcs_is_xyz); }
+ if (!ok) {
+ return false;
+ }
+
+ if (b2a->input_channels > 0) { canonicalize_identity(b2a->input_curves + 0); }
+ if (b2a->input_channels > 1) { canonicalize_identity(b2a->input_curves + 1); }
+ if (b2a->input_channels > 2) { canonicalize_identity(b2a->input_curves + 2); }
+
+ if (b2a->matrix_channels > 0) { canonicalize_identity(b2a->matrix_curves + 0); }
+ if (b2a->matrix_channels > 1) { canonicalize_identity(b2a->matrix_curves + 1); }
+ if (b2a->matrix_channels > 2) { canonicalize_identity(b2a->matrix_curves + 2); }
+
+ if (b2a->output_channels > 0) { canonicalize_identity(b2a->output_curves + 0); }
+ if (b2a->output_channels > 1) { canonicalize_identity(b2a->output_curves + 1); }
+ if (b2a->output_channels > 2) { canonicalize_identity(b2a->output_curves + 2); }
+ if (b2a->output_channels > 3) { canonicalize_identity(b2a->output_curves + 3); }
+
+ return true;
+}
+
+void skcms_GetTagByIndex(const skcms_ICCProfile* profile, uint32_t idx, skcms_ICCTag* tag) {
+ if (!profile || !profile->buffer || !tag) { return; }
+ if (idx > profile->tag_count) { return; }
+ const tag_Layout* tags = get_tag_table(profile);
+ tag->signature = read_big_u32(tags[idx].signature);
+ tag->size = read_big_u32(tags[idx].size);
+ tag->buf = read_big_u32(tags[idx].offset) + profile->buffer;
+ tag->type = read_big_u32(tag->buf);
+}
+
+bool skcms_GetTagBySignature(const skcms_ICCProfile* profile, uint32_t sig, skcms_ICCTag* tag) {
+ if (!profile || !profile->buffer || !tag) { return false; }
+ const tag_Layout* tags = get_tag_table(profile);
+ for (uint32_t i = 0; i < profile->tag_count; ++i) {
+ if (read_big_u32(tags[i].signature) == sig) {
+ tag->signature = sig;
+ tag->size = read_big_u32(tags[i].size);
+ tag->buf = read_big_u32(tags[i].offset) + profile->buffer;
+ tag->type = read_big_u32(tag->buf);
+ return true;
+ }
+ }
+ return false;
+}
+
+static bool usable_as_src(const skcms_ICCProfile* profile) {
+ return profile->has_A2B
+ || (profile->has_trc && profile->has_toXYZD50);
+}
+
+bool skcms_ParseWithA2BPriority(const void* buf, size_t len,
+ const int priority[], const int priorities,
+ skcms_ICCProfile* profile) {
+ assert(SAFE_SIZEOF(header_Layout) == 132);
+
+ if (!profile) {
+ return false;
+ }
+ memset(profile, 0, SAFE_SIZEOF(*profile));
+
+ if (len < SAFE_SIZEOF(header_Layout)) {
+ return false;
+ }
+
+ // Byte-swap all header fields
+ const header_Layout* header = (const header_Layout*)buf;
+ profile->buffer = (const uint8_t*)buf;
+ profile->size = read_big_u32(header->size);
+ uint32_t version = read_big_u32(header->version);
+ profile->data_color_space = read_big_u32(header->data_color_space);
+ profile->pcs = read_big_u32(header->pcs);
+ uint32_t signature = read_big_u32(header->signature);
+ float illuminant_X = read_big_fixed(header->illuminant_X);
+ float illuminant_Y = read_big_fixed(header->illuminant_Y);
+ float illuminant_Z = read_big_fixed(header->illuminant_Z);
+ profile->tag_count = read_big_u32(header->tag_count);
+
+ // Validate signature, size (smaller than buffer, large enough to hold tag table),
+ // and major version
+ uint64_t tag_table_size = profile->tag_count * SAFE_SIZEOF(tag_Layout);
+ if (signature != skcms_Signature_acsp ||
+ profile->size > len ||
+ profile->size < SAFE_SIZEOF(header_Layout) + tag_table_size ||
+ (version >> 24) > 4) {
+ return false;
+ }
+
+ // Validate that illuminant is D50 white
+ if (fabsf_(illuminant_X - 0.9642f) > 0.0100f ||
+ fabsf_(illuminant_Y - 1.0000f) > 0.0100f ||
+ fabsf_(illuminant_Z - 0.8249f) > 0.0100f) {
+ return false;
+ }
+
+ // Validate that all tag entries have sane offset + size
+ const tag_Layout* tags = get_tag_table(profile);
+ for (uint32_t i = 0; i < profile->tag_count; ++i) {
+ uint32_t tag_offset = read_big_u32(tags[i].offset);
+ uint32_t tag_size = read_big_u32(tags[i].size);
+ uint64_t tag_end = (uint64_t)tag_offset + (uint64_t)tag_size;
+ if (tag_size < 4 || tag_end > profile->size) {
+ return false;
+ }
+ }
+
+ if (profile->pcs != skcms_Signature_XYZ && profile->pcs != skcms_Signature_Lab) {
+ return false;
+ }
+
+ bool pcs_is_xyz = profile->pcs == skcms_Signature_XYZ;
+
+ // Pre-parse commonly used tags.
+ skcms_ICCTag kTRC;
+ if (profile->data_color_space == skcms_Signature_Gray &&
+ skcms_GetTagBySignature(profile, skcms_Signature_kTRC, &kTRC)) {
+ if (!read_curve(kTRC.buf, kTRC.size, &profile->trc[0], nullptr)) {
+ // Malformed tag
+ return false;
+ }
+ profile->trc[1] = profile->trc[0];
+ profile->trc[2] = profile->trc[0];
+ profile->has_trc = true;
+
+ if (pcs_is_xyz) {
+ profile->toXYZD50.vals[0][0] = illuminant_X;
+ profile->toXYZD50.vals[1][1] = illuminant_Y;
+ profile->toXYZD50.vals[2][2] = illuminant_Z;
+ profile->has_toXYZD50 = true;
+ }
+ } else {
+ skcms_ICCTag rTRC, gTRC, bTRC;
+ if (skcms_GetTagBySignature(profile, skcms_Signature_rTRC, &rTRC) &&
+ skcms_GetTagBySignature(profile, skcms_Signature_gTRC, &gTRC) &&
+ skcms_GetTagBySignature(profile, skcms_Signature_bTRC, &bTRC)) {
+ if (!read_curve(rTRC.buf, rTRC.size, &profile->trc[0], nullptr) ||
+ !read_curve(gTRC.buf, gTRC.size, &profile->trc[1], nullptr) ||
+ !read_curve(bTRC.buf, bTRC.size, &profile->trc[2], nullptr)) {
+ // Malformed TRC tags
+ return false;
+ }
+ profile->has_trc = true;
+ }
+
+ skcms_ICCTag rXYZ, gXYZ, bXYZ;
+ if (skcms_GetTagBySignature(profile, skcms_Signature_rXYZ, &rXYZ) &&
+ skcms_GetTagBySignature(profile, skcms_Signature_gXYZ, &gXYZ) &&
+ skcms_GetTagBySignature(profile, skcms_Signature_bXYZ, &bXYZ)) {
+ if (!read_to_XYZD50(&rXYZ, &gXYZ, &bXYZ, &profile->toXYZD50)) {
+ // Malformed XYZ tags
+ return false;
+ }
+ profile->has_toXYZD50 = true;
+ }
+ }
+
+ for (int i = 0; i < priorities; i++) {
+ // enum { perceptual, relative_colormetric, saturation }
+ if (priority[i] < 0 || priority[i] > 2) {
+ return false;
+ }
+ uint32_t sig = skcms_Signature_A2B0 + static_cast<uint32_t>(priority[i]);
+ skcms_ICCTag tag;
+ if (skcms_GetTagBySignature(profile, sig, &tag)) {
+ if (!read_a2b(&tag, &profile->A2B, pcs_is_xyz)) {
+ // Malformed A2B tag
+ return false;
+ }
+ profile->has_A2B = true;
+ break;
+ }
+ }
+
+ for (int i = 0; i < priorities; i++) {
+ // enum { perceptual, relative_colormetric, saturation }
+ if (priority[i] < 0 || priority[i] > 2) {
+ return false;
+ }
+ uint32_t sig = skcms_Signature_B2A0 + static_cast<uint32_t>(priority[i]);
+ skcms_ICCTag tag;
+ if (skcms_GetTagBySignature(profile, sig, &tag)) {
+ if (!read_b2a(&tag, &profile->B2A, pcs_is_xyz)) {
+ // Malformed B2A tag
+ return false;
+ }
+ profile->has_B2A = true;
+ break;
+ }
+ }
+
+ return usable_as_src(profile);
+}
+
+
+const skcms_ICCProfile* skcms_sRGB_profile() {
+ static const skcms_ICCProfile sRGB_profile = {
+ nullptr, // buffer, moot here
+
+ 0, // size, moot here
+ skcms_Signature_RGB, // data_color_space
+ skcms_Signature_XYZ, // pcs
+ 0, // tag count, moot here
+
+ // We choose to represent sRGB with its canonical transfer function,
+ // and with its canonical XYZD50 gamut matrix.
+ true, // has_trc, followed by the 3 trc curves
+ {
+ {{0, {2.4f, (float)(1/1.055), (float)(0.055/1.055), (float)(1/12.92), 0.04045f, 0, 0}}},
+ {{0, {2.4f, (float)(1/1.055), (float)(0.055/1.055), (float)(1/12.92), 0.04045f, 0, 0}}},
+ {{0, {2.4f, (float)(1/1.055), (float)(0.055/1.055), (float)(1/12.92), 0.04045f, 0, 0}}},
+ },
+
+ true, // has_toXYZD50, followed by 3x3 toXYZD50 matrix
+ {{
+ { 0.436065674f, 0.385147095f, 0.143066406f },
+ { 0.222488403f, 0.716873169f, 0.060607910f },
+ { 0.013916016f, 0.097076416f, 0.714096069f },
+ }},
+
+ false, // has_A2B, followed by A2B itself, which we don't care about.
+ {
+ 0,
+ {
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ },
+ {0,0,0,0},
+ nullptr,
+ nullptr,
+
+ 0,
+ {
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ },
+ {{
+ { 0,0,0,0 },
+ { 0,0,0,0 },
+ { 0,0,0,0 },
+ }},
+
+ 0,
+ {
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ },
+ },
+
+ false, // has_B2A, followed by B2A itself, which we also don't care about.
+ {
+ 0,
+ {
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ },
+
+ 0,
+ {{
+ { 0,0,0,0 },
+ { 0,0,0,0 },
+ { 0,0,0,0 },
+ }},
+ {
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ },
+
+ 0,
+ {0,0,0,0},
+ nullptr,
+ nullptr,
+ {
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ },
+ },
+ };
+ return &sRGB_profile;
+}
+
+const skcms_ICCProfile* skcms_XYZD50_profile() {
+ // Just like sRGB above, but with identity transfer functions and toXYZD50 matrix.
+ static const skcms_ICCProfile XYZD50_profile = {
+ nullptr, // buffer, moot here
+
+ 0, // size, moot here
+ skcms_Signature_RGB, // data_color_space
+ skcms_Signature_XYZ, // pcs
+ 0, // tag count, moot here
+
+ true, // has_trc, followed by the 3 trc curves
+ {
+ {{0, {1,1, 0,0,0,0,0}}},
+ {{0, {1,1, 0,0,0,0,0}}},
+ {{0, {1,1, 0,0,0,0,0}}},
+ },
+
+ true, // has_toXYZD50, followed by 3x3 toXYZD50 matrix
+ {{
+ { 1,0,0 },
+ { 0,1,0 },
+ { 0,0,1 },
+ }},
+
+ false, // has_A2B, followed by A2B itself, which we don't care about.
+ {
+ 0,
+ {
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ },
+ {0,0,0,0},
+ nullptr,
+ nullptr,
+
+ 0,
+ {
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ },
+ {{
+ { 0,0,0,0 },
+ { 0,0,0,0 },
+ { 0,0,0,0 },
+ }},
+
+ 0,
+ {
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ },
+ },
+
+ false, // has_B2A, followed by B2A itself, which we also don't care about.
+ {
+ 0,
+ {
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ },
+
+ 0,
+ {{
+ { 0,0,0,0 },
+ { 0,0,0,0 },
+ { 0,0,0,0 },
+ }},
+ {
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ },
+
+ 0,
+ {0,0,0,0},
+ nullptr,
+ nullptr,
+ {
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ {{0, {0,0, 0,0,0,0,0}}},
+ },
+ },
+ };
+
+ return &XYZD50_profile;
+}
+
+const skcms_TransferFunction* skcms_sRGB_TransferFunction() {
+ return &skcms_sRGB_profile()->trc[0].parametric;
+}
+
+const skcms_TransferFunction* skcms_sRGB_Inverse_TransferFunction() {
+ static const skcms_TransferFunction sRGB_inv =
+ {0.416666657f, 1.137283325f, -0.0f, 12.920000076f, 0.003130805f, -0.054969788f, -0.0f};
+ return &sRGB_inv;
+}
+
+const skcms_TransferFunction* skcms_Identity_TransferFunction() {
+ static const skcms_TransferFunction identity = {1,1,0,0,0,0,0};
+ return &identity;
+}
+
+const uint8_t skcms_252_random_bytes[] = {
+ 8, 179, 128, 204, 253, 38, 134, 184, 68, 102, 32, 138, 99, 39, 169, 215,
+ 119, 26, 3, 223, 95, 239, 52, 132, 114, 74, 81, 234, 97, 116, 244, 205, 30,
+ 154, 173, 12, 51, 159, 122, 153, 61, 226, 236, 178, 229, 55, 181, 220, 191,
+ 194, 160, 126, 168, 82, 131, 18, 180, 245, 163, 22, 246, 69, 235, 252, 57,
+ 108, 14, 6, 152, 240, 255, 171, 242, 20, 227, 177, 238, 96, 85, 16, 211,
+ 70, 200, 149, 155, 146, 127, 145, 100, 151, 109, 19, 165, 208, 195, 164,
+ 137, 254, 182, 248, 64, 201, 45, 209, 5, 147, 207, 210, 113, 162, 83, 225,
+ 9, 31, 15, 231, 115, 37, 58, 53, 24, 49, 197, 56, 120, 172, 48, 21, 214,
+ 129, 111, 11, 50, 187, 196, 34, 60, 103, 71, 144, 47, 203, 77, 80, 232,
+ 140, 222, 250, 206, 166, 247, 139, 249, 221, 72, 106, 27, 199, 117, 54,
+ 219, 135, 118, 40, 79, 41, 251, 46, 93, 212, 92, 233, 148, 28, 121, 63,
+ 123, 158, 105, 59, 29, 42, 143, 23, 0, 107, 176, 87, 104, 183, 156, 193,
+ 189, 90, 188, 65, 190, 17, 198, 7, 186, 161, 1, 124, 78, 125, 170, 133,
+ 174, 218, 67, 157, 75, 101, 89, 217, 62, 33, 141, 228, 25, 35, 91, 230, 4,
+ 2, 13, 73, 86, 167, 237, 84, 243, 44, 185, 66, 130, 110, 150, 142, 216, 88,
+ 112, 36, 224, 136, 202, 76, 94, 98, 175, 213
+};
+
+bool skcms_ApproximatelyEqualProfiles(const skcms_ICCProfile* A, const skcms_ICCProfile* B) {
+ // Test for exactly equal profiles first.
+ if (A == B || 0 == memcmp(A,B, sizeof(skcms_ICCProfile))) {
+ return true;
+ }
+
+ // For now this is the essentially the same strategy we use in test_only.c
+ // for our skcms_Transform() smoke tests:
+ // 1) transform A to XYZD50
+ // 2) transform B to XYZD50
+ // 3) return true if they're similar enough
+ // Our current criterion in 3) is maximum 1 bit error per XYZD50 byte.
+
+ // skcms_252_random_bytes are 252 of a random shuffle of all possible bytes.
+ // 252 is evenly divisible by 3 and 4. Only 192, 10, 241, and 43 are missing.
+
+ // We want to allow otherwise equivalent profiles tagged as grayscale and RGB
+ // to be treated as equal. But CMYK profiles are a totally different ballgame.
+ const auto CMYK = skcms_Signature_CMYK;
+ if ((A->data_color_space == CMYK) != (B->data_color_space == CMYK)) {
+ return false;
+ }
+
+ // Interpret as RGB_888 if data color space is RGB or GRAY, RGBA_8888 if CMYK.
+ // TODO: working with RGBA_8888 either way is probably fastest.
+ skcms_PixelFormat fmt = skcms_PixelFormat_RGB_888;
+ size_t npixels = 84;
+ if (A->data_color_space == skcms_Signature_CMYK) {
+ fmt = skcms_PixelFormat_RGBA_8888;
+ npixels = 63;
+ }
+
+ // TODO: if A or B is a known profile (skcms_sRGB_profile, skcms_XYZD50_profile),
+ // use pre-canned results and skip that skcms_Transform() call?
+ uint8_t dstA[252],
+ dstB[252];
+ if (!skcms_Transform(
+ skcms_252_random_bytes, fmt, skcms_AlphaFormat_Unpremul, A,
+ dstA, skcms_PixelFormat_RGB_888, skcms_AlphaFormat_Unpremul, skcms_XYZD50_profile(),
+ npixels)) {
+ return false;
+ }
+ if (!skcms_Transform(
+ skcms_252_random_bytes, fmt, skcms_AlphaFormat_Unpremul, B,
+ dstB, skcms_PixelFormat_RGB_888, skcms_AlphaFormat_Unpremul, skcms_XYZD50_profile(),
+ npixels)) {
+ return false;
+ }
+
+ // TODO: make sure this final check has reasonable codegen.
+ for (size_t i = 0; i < 252; i++) {
+ if (abs((int)dstA[i] - (int)dstB[i]) > 1) {
+ return false;
+ }
+ }
+ return true;
+}
+
+bool skcms_TRCs_AreApproximateInverse(const skcms_ICCProfile* profile,
+ const skcms_TransferFunction* inv_tf) {
+ if (!profile || !profile->has_trc) {
+ return false;
+ }
+
+ return skcms_AreApproximateInverses(&profile->trc[0], inv_tf) &&
+ skcms_AreApproximateInverses(&profile->trc[1], inv_tf) &&
+ skcms_AreApproximateInverses(&profile->trc[2], inv_tf);
+}
+
+static bool is_zero_to_one(float x) {
+ return 0 <= x && x <= 1;
+}
+
+typedef struct { float vals[3]; } skcms_Vector3;
+
+static skcms_Vector3 mv_mul(const skcms_Matrix3x3* m, const skcms_Vector3* v) {
+ skcms_Vector3 dst = {{0,0,0}};
+ for (int row = 0; row < 3; ++row) {
+ dst.vals[row] = m->vals[row][0] * v->vals[0]
+ + m->vals[row][1] * v->vals[1]
+ + m->vals[row][2] * v->vals[2];
+ }
+ return dst;
+}
+
+bool skcms_AdaptToXYZD50(float wx, float wy,
+ skcms_Matrix3x3* toXYZD50) {
+ if (!is_zero_to_one(wx) || !is_zero_to_one(wy) ||
+ !toXYZD50) {
+ return false;
+ }
+
+ // Assumes that Y is 1.0f.
+ skcms_Vector3 wXYZ = { { wx / wy, 1, (1 - wx - wy) / wy } };
+
+ // Now convert toXYZ matrix to toXYZD50.
+ skcms_Vector3 wXYZD50 = { { 0.96422f, 1.0f, 0.82521f } };
+
+ // Calculate the chromatic adaptation matrix. We will use the Bradford method, thus
+ // the matrices below. The Bradford method is used by Adobe and is widely considered
+ // to be the best.
+ skcms_Matrix3x3 xyz_to_lms = {{
+ { 0.8951f, 0.2664f, -0.1614f },
+ { -0.7502f, 1.7135f, 0.0367f },
+ { 0.0389f, -0.0685f, 1.0296f },
+ }};
+ skcms_Matrix3x3 lms_to_xyz = {{
+ { 0.9869929f, -0.1470543f, 0.1599627f },
+ { 0.4323053f, 0.5183603f, 0.0492912f },
+ { -0.0085287f, 0.0400428f, 0.9684867f },
+ }};
+
+ skcms_Vector3 srcCone = mv_mul(&xyz_to_lms, &wXYZ);
+ skcms_Vector3 dstCone = mv_mul(&xyz_to_lms, &wXYZD50);
+
+ *toXYZD50 = {{
+ { dstCone.vals[0] / srcCone.vals[0], 0, 0 },
+ { 0, dstCone.vals[1] / srcCone.vals[1], 0 },
+ { 0, 0, dstCone.vals[2] / srcCone.vals[2] },
+ }};
+ *toXYZD50 = skcms_Matrix3x3_concat(toXYZD50, &xyz_to_lms);
+ *toXYZD50 = skcms_Matrix3x3_concat(&lms_to_xyz, toXYZD50);
+
+ return true;
+}
+
+bool skcms_PrimariesToXYZD50(float rx, float ry,
+ float gx, float gy,
+ float bx, float by,
+ float wx, float wy,
+ skcms_Matrix3x3* toXYZD50) {
+ if (!is_zero_to_one(rx) || !is_zero_to_one(ry) ||
+ !is_zero_to_one(gx) || !is_zero_to_one(gy) ||
+ !is_zero_to_one(bx) || !is_zero_to_one(by) ||
+ !is_zero_to_one(wx) || !is_zero_to_one(wy) ||
+ !toXYZD50) {
+ return false;
+ }
+
+ // First, we need to convert xy values (primaries) to XYZ.
+ skcms_Matrix3x3 primaries = {{
+ { rx, gx, bx },
+ { ry, gy, by },
+ { 1 - rx - ry, 1 - gx - gy, 1 - bx - by },
+ }};
+ skcms_Matrix3x3 primaries_inv;
+ if (!skcms_Matrix3x3_invert(&primaries, &primaries_inv)) {
+ return false;
+ }
+
+ // Assumes that Y is 1.0f.
+ skcms_Vector3 wXYZ = { { wx / wy, 1, (1 - wx - wy) / wy } };
+ skcms_Vector3 XYZ = mv_mul(&primaries_inv, &wXYZ);
+
+ skcms_Matrix3x3 toXYZ = {{
+ { XYZ.vals[0], 0, 0 },
+ { 0, XYZ.vals[1], 0 },
+ { 0, 0, XYZ.vals[2] },
+ }};
+ toXYZ = skcms_Matrix3x3_concat(&primaries, &toXYZ);
+
+ skcms_Matrix3x3 DXtoD50;
+ if (!skcms_AdaptToXYZD50(wx, wy, &DXtoD50)) {
+ return false;
+ }
+
+ *toXYZD50 = skcms_Matrix3x3_concat(&DXtoD50, &toXYZ);
+ return true;
+}
+
+
+bool skcms_Matrix3x3_invert(const skcms_Matrix3x3* src, skcms_Matrix3x3* dst) {
+ double a00 = src->vals[0][0],
+ a01 = src->vals[1][0],
+ a02 = src->vals[2][0],
+ a10 = src->vals[0][1],
+ a11 = src->vals[1][1],
+ a12 = src->vals[2][1],
+ a20 = src->vals[0][2],
+ a21 = src->vals[1][2],
+ a22 = src->vals[2][2];
+
+ double b0 = a00*a11 - a01*a10,
+ b1 = a00*a12 - a02*a10,
+ b2 = a01*a12 - a02*a11,
+ b3 = a20,
+ b4 = a21,
+ b5 = a22;
+
+ double determinant = b0*b5
+ - b1*b4
+ + b2*b3;
+
+ if (determinant == 0) {
+ return false;
+ }
+
+ double invdet = 1.0 / determinant;
+ if (invdet > +FLT_MAX || invdet < -FLT_MAX || !isfinitef_((float)invdet)) {
+ return false;
+ }
+
+ b0 *= invdet;
+ b1 *= invdet;
+ b2 *= invdet;
+ b3 *= invdet;
+ b4 *= invdet;
+ b5 *= invdet;
+
+ dst->vals[0][0] = (float)( a11*b5 - a12*b4 );
+ dst->vals[1][0] = (float)( a02*b4 - a01*b5 );
+ dst->vals[2][0] = (float)( + b2 );
+ dst->vals[0][1] = (float)( a12*b3 - a10*b5 );
+ dst->vals[1][1] = (float)( a00*b5 - a02*b3 );
+ dst->vals[2][1] = (float)( - b1 );
+ dst->vals[0][2] = (float)( a10*b4 - a11*b3 );
+ dst->vals[1][2] = (float)( a01*b3 - a00*b4 );
+ dst->vals[2][2] = (float)( + b0 );
+
+ for (int r = 0; r < 3; ++r)
+ for (int c = 0; c < 3; ++c) {
+ if (!isfinitef_(dst->vals[r][c])) {
+ return false;
+ }
+ }
+ return true;
+}
+
+skcms_Matrix3x3 skcms_Matrix3x3_concat(const skcms_Matrix3x3* A, const skcms_Matrix3x3* B) {
+ skcms_Matrix3x3 m = { { { 0,0,0 },{ 0,0,0 },{ 0,0,0 } } };
+ for (int r = 0; r < 3; r++)
+ for (int c = 0; c < 3; c++) {
+ m.vals[r][c] = A->vals[r][0] * B->vals[0][c]
+ + A->vals[r][1] * B->vals[1][c]
+ + A->vals[r][2] * B->vals[2][c];
+ }
+ return m;
+}
+
+#if defined(__clang__)
+ [[clang::no_sanitize("float-divide-by-zero")]] // Checked for by classify() on the way out.
+#endif
+bool skcms_TransferFunction_invert(const skcms_TransferFunction* src, skcms_TransferFunction* dst) {
+ TF_PQish pq;
+ TF_HLGish hlg;
+ switch (classify(*src, &pq, &hlg)) {
+ case Bad: return false;
+ case sRGBish: break; // handled below
+
+ case PQish:
+ *dst = { TFKind_marker(PQish), -pq.A, pq.D, 1.0f/pq.F
+ , pq.B, -pq.E, 1.0f/pq.C};
+ return true;
+
+ case HLGish:
+ *dst = { TFKind_marker(HLGinvish), 1.0f/hlg.R, 1.0f/hlg.G
+ , 1.0f/hlg.a, hlg.b, hlg.c
+ , hlg.K_minus_1 };
+ return true;
+
+ case HLGinvish:
+ *dst = { TFKind_marker(HLGish), 1.0f/hlg.R, 1.0f/hlg.G
+ , 1.0f/hlg.a, hlg.b, hlg.c
+ , hlg.K_minus_1 };
+ return true;
+ }
+
+ assert (classify(*src) == sRGBish);
+
+ // We're inverting this function, solving for x in terms of y.
+ // y = (cx + f) x < d
+ // (ax + b)^g + e x ≥ d
+ // The inverse of this function can be expressed in the same piecewise form.
+ skcms_TransferFunction inv = {0,0,0,0,0,0,0};
+
+ // We'll start by finding the new threshold inv.d.
+ // In principle we should be able to find that by solving for y at x=d from either side.
+ // (If those two d values aren't the same, it's a discontinuous transfer function.)
+ float d_l = src->c * src->d + src->f,
+ d_r = powf_(src->a * src->d + src->b, src->g) + src->e;
+ if (fabsf_(d_l - d_r) > 1/512.0f) {
+ return false;
+ }
+ inv.d = d_l; // TODO(mtklein): better in practice to choose d_r?
+
+ // When d=0, the linear section collapses to a point. We leave c,d,f all zero in that case.
+ if (inv.d > 0) {
+ // Inverting the linear section is pretty straightfoward:
+ // y = cx + f
+ // y - f = cx
+ // (1/c)y - f/c = x
+ inv.c = 1.0f/src->c;
+ inv.f = -src->f/src->c;
+ }
+
+ // The interesting part is inverting the nonlinear section:
+ // y = (ax + b)^g + e.
+ // y - e = (ax + b)^g
+ // (y - e)^1/g = ax + b
+ // (y - e)^1/g - b = ax
+ // (1/a)(y - e)^1/g - b/a = x
+ //
+ // To make that fit our form, we need to move the (1/a) term inside the exponentiation:
+ // let k = (1/a)^g
+ // (1/a)( y - e)^1/g - b/a = x
+ // (ky - ke)^1/g - b/a = x
+
+ float k = powf_(src->a, -src->g); // (1/a)^g == a^-g
+ inv.g = 1.0f / src->g;
+ inv.a = k;
+ inv.b = -k * src->e;
+ inv.e = -src->b / src->a;
+
+ // We need to enforce the same constraints here that we do when fitting a curve,
+ // a >= 0 and ad+b >= 0. These constraints are checked by classify(), so they're true
+ // of the source function if we're here.
+
+ // Just like when fitting the curve, there's really no way to rescue a < 0.
+ if (inv.a < 0) {
+ return false;
+ }
+ // On the other hand we can rescue an ad+b that's gone slightly negative here.
+ if (inv.a * inv.d + inv.b < 0) {
+ inv.b = -inv.a * inv.d;
+ }
+
+ // That should usually make classify(inv) == sRGBish true, but there are a couple situations
+ // where we might still fail here, like non-finite parameter values.
+ if (classify(inv) != sRGBish) {
+ return false;
+ }
+
+ assert (inv.a >= 0);
+ assert (inv.a * inv.d + inv.b >= 0);
+
+ // Now in principle we're done.
+ // But to preserve the valuable invariant inv(src(1.0f)) == 1.0f, we'll tweak
+ // e or f of the inverse, depending on which segment contains src(1.0f).
+ float s = skcms_TransferFunction_eval(src, 1.0f);
+ if (!isfinitef_(s)) {
+ return false;
+ }
+
+ float sign = s < 0 ? -1.0f : 1.0f;
+ s *= sign;
+ if (s < inv.d) {
+ inv.f = 1.0f - sign * inv.c * s;
+ } else {
+ inv.e = 1.0f - sign * powf_(inv.a * s + inv.b, inv.g);
+ }
+
+ *dst = inv;
+ return classify(*dst) == sRGBish;
+}
+
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
+
+// From here below we're approximating an skcms_Curve with an skcms_TransferFunction{g,a,b,c,d,e,f}:
+//
+// tf(x) = cx + f x < d
+// tf(x) = (ax + b)^g + e x ≥ d
+//
+// When fitting, we add the additional constraint that both pieces meet at d:
+//
+// cd + f = (ad + b)^g + e
+//
+// Solving for e and folding it through gives an alternate formulation of the non-linear piece:
+//
+// tf(x) = cx + f x < d
+// tf(x) = (ax + b)^g - (ad + b)^g + cd + f x ≥ d
+//
+// Our overall strategy is then:
+// For a couple tolerances,
+// - fit_linear(): fit c,d,f iteratively to as many points as our tolerance allows
+// - invert c,d,f
+// - fit_nonlinear(): fit g,a,b using Gauss-Newton given those inverted c,d,f
+// (and by constraint, inverted e) to the inverse of the table.
+// Return the parameters with least maximum error.
+//
+// To run Gauss-Newton to find g,a,b, we'll also need the gradient of the residuals
+// of round-trip f_inv(x), the inverse of the non-linear piece of f(x).
+//
+// let y = Table(x)
+// r(x) = x - f_inv(y)
+//
+// ∂r/∂g = ln(ay + b)*(ay + b)^g
+// - ln(ad + b)*(ad + b)^g
+// ∂r/∂a = yg(ay + b)^(g-1)
+// - dg(ad + b)^(g-1)
+// ∂r/∂b = g(ay + b)^(g-1)
+// - g(ad + b)^(g-1)
+
+// Return the residual of roundtripping skcms_Curve(x) through f_inv(y) with parameters P,
+// and fill out the gradient of the residual into dfdP.
+static float rg_nonlinear(float x,
+ const skcms_Curve* curve,
+ const skcms_TransferFunction* tf,
+ float dfdP[3]) {
+ const float y = eval_curve(curve, x);
+
+ const float g = tf->g, a = tf->a, b = tf->b,
+ c = tf->c, d = tf->d, f = tf->f;
+
+ const float Y = fmaxf_(a*y + b, 0.0f),
+ D = a*d + b;
+ assert (D >= 0);
+
+ // The gradient.
+ dfdP[0] = logf_(Y)*powf_(Y, g)
+ - logf_(D)*powf_(D, g);
+ dfdP[1] = y*g*powf_(Y, g-1)
+ - d*g*powf_(D, g-1);
+ dfdP[2] = g*powf_(Y, g-1)
+ - g*powf_(D, g-1);
+
+ // The residual.
+ const float f_inv = powf_(Y, g)
+ - powf_(D, g)
+ + c*d + f;
+ return x - f_inv;
+}
+
+static bool gauss_newton_step(const skcms_Curve* curve,
+ skcms_TransferFunction* tf,
+ float x0, float dx, int N) {
+ // We'll sample x from the range [x0,x1] (both inclusive) N times with even spacing.
+ //
+ // Let P = [ tf->g, tf->a, tf->b ] (the three terms that we're adjusting).
+ //
+ // We want to do P' = P + (Jf^T Jf)^-1 Jf^T r(P),
+ // where r(P) is the residual vector
+ // and Jf is the Jacobian matrix of f(), ∂r/∂P.
+ //
+ // Let's review the shape of each of these expressions:
+ // r(P) is [N x 1], a column vector with one entry per value of x tested
+ // Jf is [N x 3], a matrix with an entry for each (x,P) pair
+ // Jf^T is [3 x N], the transpose of Jf
+ //
+ // Jf^T Jf is [3 x N] * [N x 3] == [3 x 3], a 3x3 matrix,
+ // and so is its inverse (Jf^T Jf)^-1
+ // Jf^T r(P) is [3 x N] * [N x 1] == [3 x 1], a column vector with the same shape as P
+ //
+ // Our implementation strategy to get to the final ∆P is
+ // 1) evaluate Jf^T Jf, call that lhs
+ // 2) evaluate Jf^T r(P), call that rhs
+ // 3) invert lhs
+ // 4) multiply inverse lhs by rhs
+ //
+ // This is a friendly implementation strategy because we don't have to have any
+ // buffers that scale with N, and equally nice don't have to perform any matrix
+ // operations that are variable size.
+ //
+ // Other implementation strategies could trade this off, e.g. evaluating the
+ // pseudoinverse of Jf ( (Jf^T Jf)^-1 Jf^T ) directly, then multiplying that by
+ // the residuals. That would probably require implementing singular value
+ // decomposition, and would create a [3 x N] matrix to be multiplied by the
+ // [N x 1] residual vector, but on the upside I think that'd eliminate the
+ // possibility of this gauss_newton_step() function ever failing.
+
+ // 0) start off with lhs and rhs safely zeroed.
+ skcms_Matrix3x3 lhs = {{ {0,0,0}, {0,0,0}, {0,0,0} }};
+ skcms_Vector3 rhs = { {0,0,0} };
+
+ // 1,2) evaluate lhs and evaluate rhs
+ // We want to evaluate Jf only once, but both lhs and rhs involve Jf^T,
+ // so we'll have to update lhs and rhs at the same time.
+ for (int i = 0; i < N; i++) {
+ float x = x0 + static_cast<float>(i)*dx;
+
+ float dfdP[3] = {0,0,0};
+ float resid = rg_nonlinear(x,curve,tf, dfdP);
+
+ for (int r = 0; r < 3; r++) {
+ for (int c = 0; c < 3; c++) {
+ lhs.vals[r][c] += dfdP[r] * dfdP[c];
+ }
+ rhs.vals[r] += dfdP[r] * resid;
+ }
+ }
+
+ // If any of the 3 P parameters are unused, this matrix will be singular.
+ // Detect those cases and fix them up to indentity instead, so we can invert.
+ for (int k = 0; k < 3; k++) {
+ if (lhs.vals[0][k]==0 && lhs.vals[1][k]==0 && lhs.vals[2][k]==0 &&
+ lhs.vals[k][0]==0 && lhs.vals[k][1]==0 && lhs.vals[k][2]==0) {
+ lhs.vals[k][k] = 1;
+ }
+ }
+
+ // 3) invert lhs
+ skcms_Matrix3x3 lhs_inv;
+ if (!skcms_Matrix3x3_invert(&lhs, &lhs_inv)) {
+ return false;
+ }
+
+ // 4) multiply inverse lhs by rhs
+ skcms_Vector3 dP = mv_mul(&lhs_inv, &rhs);
+ tf->g += dP.vals[0];
+ tf->a += dP.vals[1];
+ tf->b += dP.vals[2];
+ return isfinitef_(tf->g) && isfinitef_(tf->a) && isfinitef_(tf->b);
+}
+
+static float max_roundtrip_error_checked(const skcms_Curve* curve,
+ const skcms_TransferFunction* tf_inv) {
+ skcms_TransferFunction tf;
+ if (!skcms_TransferFunction_invert(tf_inv, &tf) || sRGBish != classify(tf)) {
+ return INFINITY_;
+ }
+
+ skcms_TransferFunction tf_inv_again;
+ if (!skcms_TransferFunction_invert(&tf, &tf_inv_again)) {
+ return INFINITY_;
+ }
+
+ return skcms_MaxRoundtripError(curve, &tf_inv_again);
+}
+
+// Fit the points in [L,N) to the non-linear piece of tf, or return false if we can't.
+static bool fit_nonlinear(const skcms_Curve* curve, int L, int N, skcms_TransferFunction* tf) {
+ // This enforces a few constraints that are not modeled in gauss_newton_step()'s optimization.
+ auto fixup_tf = [tf]() {
+ // a must be non-negative. That ensures the function is monotonically increasing.
+ // We don't really know how to fix up a if it goes negative.
+ if (tf->a < 0) {
+ return false;
+ }
+ // ad+b must be non-negative. That ensures we don't end up with complex numbers in powf.
+ // We feel just barely not uneasy enough to tweak b so ad+b is zero in this case.
+ if (tf->a * tf->d + tf->b < 0) {
+ tf->b = -tf->a * tf->d;
+ }
+ assert (tf->a >= 0 &&
+ tf->a * tf->d + tf->b >= 0);
+
+ // cd+f must be ~= (ad+b)^g+e. That ensures the function is continuous. We keep e as a free
+ // parameter so we can guarantee this.
+ tf->e = tf->c*tf->d + tf->f
+ - powf_(tf->a*tf->d + tf->b, tf->g);
+
+ return true;
+ };
+
+ if (!fixup_tf()) {
+ return false;
+ }
+
+ // No matter where we start, dx should always represent N even steps from 0 to 1.
+ const float dx = 1.0f / static_cast<float>(N-1);
+
+ skcms_TransferFunction best_tf = *tf;
+ float best_max_error = INFINITY_;
+
+ // Need this or several curves get worse... *sigh*
+ float init_error = max_roundtrip_error_checked(curve, tf);
+ if (init_error < best_max_error) {
+ best_max_error = init_error;
+ best_tf = *tf;
+ }
+
+ // As far as we can tell, 1 Gauss-Newton step won't converge, and 3 steps is no better than 2.
+ for (int j = 0; j < 8; j++) {
+ if (!gauss_newton_step(curve, tf, static_cast<float>(L)*dx, dx, N-L) || !fixup_tf()) {
+ *tf = best_tf;
+ return isfinitef_(best_max_error);
+ }
+
+ float max_error = max_roundtrip_error_checked(curve, tf);
+ if (max_error < best_max_error) {
+ best_max_error = max_error;
+ best_tf = *tf;
+ }
+ }
+
+ *tf = best_tf;
+ return isfinitef_(best_max_error);
+}
+
+bool skcms_ApproximateCurve(const skcms_Curve* curve,
+ skcms_TransferFunction* approx,
+ float* max_error) {
+ if (!curve || !approx || !max_error) {
+ return false;
+ }
+
+ if (curve->table_entries == 0) {
+ // No point approximating an skcms_TransferFunction with an skcms_TransferFunction!
+ return false;
+ }
+
+ if (curve->table_entries == 1 || curve->table_entries > (uint32_t)INT_MAX) {
+ // We need at least two points, and must put some reasonable cap on the maximum number.
+ return false;
+ }
+
+ int N = (int)curve->table_entries;
+ const float dx = 1.0f / static_cast<float>(N - 1);
+
+ *max_error = INFINITY_;
+ const float kTolerances[] = { 1.5f / 65535.0f, 1.0f / 512.0f };
+ for (int t = 0; t < ARRAY_COUNT(kTolerances); t++) {
+ skcms_TransferFunction tf,
+ tf_inv;
+
+ // It's problematic to fit curves with non-zero f, so always force it to zero explicitly.
+ tf.f = 0.0f;
+ int L = fit_linear(curve, N, kTolerances[t], &tf.c, &tf.d);
+
+ if (L == N) {
+ // If the entire data set was linear, move the coefficients to the nonlinear portion
+ // with G == 1. This lets use a canonical representation with d == 0.
+ tf.g = 1;
+ tf.a = tf.c;
+ tf.b = tf.f;
+ tf.c = tf.d = tf.e = tf.f = 0;
+ } else if (L == N - 1) {
+ // Degenerate case with only two points in the nonlinear segment. Solve directly.
+ tf.g = 1;
+ tf.a = (eval_curve(curve, static_cast<float>(N-1)*dx) -
+ eval_curve(curve, static_cast<float>(N-2)*dx))
+ / dx;
+ tf.b = eval_curve(curve, static_cast<float>(N-2)*dx)
+ - tf.a * static_cast<float>(N-2)*dx;
+ tf.e = 0;
+ } else {
+ // Start by guessing a gamma-only curve through the midpoint.
+ int mid = (L + N) / 2;
+ float mid_x = static_cast<float>(mid) / static_cast<float>(N - 1);
+ float mid_y = eval_curve(curve, mid_x);
+ tf.g = log2f_(mid_y) / log2f_(mid_x);
+ tf.a = 1;
+ tf.b = 0;
+ tf.e = tf.c*tf.d + tf.f
+ - powf_(tf.a*tf.d + tf.b, tf.g);
+
+
+ if (!skcms_TransferFunction_invert(&tf, &tf_inv) ||
+ !fit_nonlinear(curve, L,N, &tf_inv)) {
+ continue;
+ }
+
+ // We fit tf_inv, so calculate tf to keep in sync.
+ // fit_nonlinear() should guarantee invertibility.
+ if (!skcms_TransferFunction_invert(&tf_inv, &tf)) {
+ assert(false);
+ continue;
+ }
+ }
+
+ // We'd better have a sane, sRGB-ish TF by now.
+ // Other non-Bad TFs would be fine, but we know we've only ever tried to fit sRGBish;
+ // anything else is just some accident of math and the way we pun tf.g as a type flag.
+ // fit_nonlinear() should guarantee this, but the special cases may fail this test.
+ if (sRGBish != classify(tf)) {
+ continue;
+ }
+
+ // We find our error by roundtripping the table through tf_inv.
+ //
+ // (The most likely use case for this approximation is to be inverted and
+ // used as the transfer function for a destination color space.)
+ //
+ // We've kept tf and tf_inv in sync above, but we can't guarantee that tf is
+ // invertible, so re-verify that here (and use the new inverse for testing).
+ // fit_nonlinear() should guarantee this, but the special cases that don't use
+ // it may fail this test.
+ if (!skcms_TransferFunction_invert(&tf, &tf_inv)) {
+ continue;
+ }
+
+ float err = skcms_MaxRoundtripError(curve, &tf_inv);
+ if (*max_error > err) {
+ *max_error = err;
+ *approx = tf;
+ }
+ }
+ return isfinitef_(*max_error);
+}
+
+// ~~~~ Impl. of skcms_Transform() ~~~~
+
+typedef enum {
+ Op_load_a8,
+ Op_load_g8,
+ Op_load_8888_palette8,
+ Op_load_4444,
+ Op_load_565,
+ Op_load_888,
+ Op_load_8888,
+ Op_load_1010102,
+ Op_load_161616LE,
+ Op_load_16161616LE,
+ Op_load_161616BE,
+ Op_load_16161616BE,
+ Op_load_hhh,
+ Op_load_hhhh,
+ Op_load_fff,
+ Op_load_ffff,
+
+ Op_swap_rb,
+ Op_clamp,
+ Op_invert,
+ Op_force_opaque,
+ Op_premul,
+ Op_unpremul,
+ Op_matrix_3x3,
+ Op_matrix_3x4,
+
+ Op_lab_to_xyz,
+ Op_xyz_to_lab,
+
+ Op_tf_r,
+ Op_tf_g,
+ Op_tf_b,
+ Op_tf_a,
+
+ Op_pq_r,
+ Op_pq_g,
+ Op_pq_b,
+ Op_pq_a,
+
+ Op_hlg_r,
+ Op_hlg_g,
+ Op_hlg_b,
+ Op_hlg_a,
+
+ Op_hlginv_r,
+ Op_hlginv_g,
+ Op_hlginv_b,
+ Op_hlginv_a,
+
+ Op_table_r,
+ Op_table_g,
+ Op_table_b,
+ Op_table_a,
+
+ Op_clut_A2B,
+ Op_clut_B2A,
+
+ Op_store_a8,
+ Op_store_g8,
+ Op_store_4444,
+ Op_store_565,
+ Op_store_888,
+ Op_store_8888,
+ Op_store_1010102,
+ Op_store_161616LE,
+ Op_store_16161616LE,
+ Op_store_161616BE,
+ Op_store_16161616BE,
+ Op_store_hhh,
+ Op_store_hhhh,
+ Op_store_fff,
+ Op_store_ffff,
+} Op;
+
+#if defined(__clang__)
+ template <int N, typename T> using Vec = T __attribute__((ext_vector_type(N)));
+#elif defined(__GNUC__)
+ // For some reason GCC accepts this nonsense, but not the more straightforward version,
+ // template <int N, typename T> using Vec = T __attribute__((vector_size(N*sizeof(T))));
+ template <int N, typename T>
+ struct VecHelper { typedef T __attribute__((vector_size(N*sizeof(T)))) V; };
+
+ template <int N, typename T> using Vec = typename VecHelper<N,T>::V;
+#endif
+
+// First, instantiate our default exec_ops() implementation using the default compiliation target.
+
+namespace baseline {
+#if defined(SKCMS_PORTABLE) || !(defined(__clang__) || defined(__GNUC__)) \
+ || (defined(__EMSCRIPTEN_major__) && !defined(__wasm_simd128__))
+ #define N 1
+ template <typename T> using V = T;
+ using Color = float;
+#elif defined(__AVX512F__) && defined(__AVX512DQ__)
+ #define N 16
+ template <typename T> using V = Vec<N,T>;
+ using Color = float;
+#elif defined(__AVX__)
+ #define N 8
+ template <typename T> using V = Vec<N,T>;
+ using Color = float;
+#elif defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && defined(SKCMS_OPT_INTO_NEON_FP16)
+ #define N 8
+ template <typename T> using V = Vec<N,T>;
+ using Color = _Float16;
+#else
+ #define N 4
+ template <typename T> using V = Vec<N,T>;
+ using Color = float;
+#endif
+
+ #include "src/Transform_inl.h"
+ #undef N
+}
+
+// Now, instantiate any other versions of run_program() we may want for runtime detection.
+#if !defined(SKCMS_PORTABLE) && \
+ !defined(SKCMS_NO_RUNTIME_CPU_DETECTION) && \
+ (( defined(__clang__) && __clang_major__ >= 5) || \
+ (!defined(__clang__) && defined(__GNUC__))) \
+ && defined(__x86_64__)
+
+ #if !defined(__AVX2__)
+ #if defined(__clang__)
+ #pragma clang attribute push(__attribute__((target("avx2,f16c"))), apply_to=function)
+ #elif defined(__GNUC__)
+ #pragma GCC push_options
+ #pragma GCC target("avx2,f16c")
+ #endif
+
+ namespace hsw {
+ #define USING_AVX
+ #define USING_AVX_F16C
+ #define USING_AVX2
+ #define N 8
+ template <typename T> using V = Vec<N,T>;
+ using Color = float;
+
+ #include "src/Transform_inl.h"
+
+ // src/Transform_inl.h will undefine USING_* for us.
+ #undef N
+ }
+
+ #if defined(__clang__)
+ #pragma clang attribute pop
+ #elif defined(__GNUC__)
+ #pragma GCC pop_options
+ #endif
+
+ #define TEST_FOR_HSW
+ #endif
+
+ #if !defined(__AVX512F__) || !defined(__AVX512DQ__)
+ #if defined(__clang__)
+ #pragma clang attribute push(__attribute__((target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl"))), apply_to=function)
+ #elif defined(__GNUC__)
+ #pragma GCC push_options
+ #pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
+ #endif
+
+ namespace skx {
+ #define USING_AVX512F
+ #define N 16
+ template <typename T> using V = Vec<N,T>;
+ using Color = float;
+
+ #include "src/Transform_inl.h"
+
+ // src/Transform_inl.h will undefine USING_* for us.
+ #undef N
+ }
+
+ #if defined(__clang__)
+ #pragma clang attribute pop
+ #elif defined(__GNUC__)
+ #pragma GCC pop_options
+ #endif
+
+ #define TEST_FOR_SKX
+ #endif
+
+ #if defined(TEST_FOR_HSW) || defined(TEST_FOR_SKX)
+ enum class CpuType { None, HSW, SKX };
+ static CpuType cpu_type() {
+ static const CpuType type = []{
+ if (!runtime_cpu_detection) {
+ return CpuType::None;
+ }
+ // See http://www.sandpile.org/x86/cpuid.htm
+
+ // First, a basic cpuid(1) lets us check prerequisites for HSW, SKX.
+ uint32_t eax, ebx, ecx, edx;
+ __asm__ __volatile__("cpuid" : "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx)
+ : "0"(1), "2"(0));
+ if ((edx & (1u<<25)) && // SSE
+ (edx & (1u<<26)) && // SSE2
+ (ecx & (1u<< 0)) && // SSE3
+ (ecx & (1u<< 9)) && // SSSE3
+ (ecx & (1u<<12)) && // FMA (N.B. not used, avoided even)
+ (ecx & (1u<<19)) && // SSE4.1
+ (ecx & (1u<<20)) && // SSE4.2
+ (ecx & (1u<<26)) && // XSAVE
+ (ecx & (1u<<27)) && // OSXSAVE
+ (ecx & (1u<<28)) && // AVX
+ (ecx & (1u<<29))) { // F16C
+
+ // Call cpuid(7) to check for AVX2 and AVX-512 bits.
+ __asm__ __volatile__("cpuid" : "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx)
+ : "0"(7), "2"(0));
+ // eax from xgetbv(0) will tell us whether XMM, YMM, and ZMM state is saved.
+ uint32_t xcr0, dont_need_edx;
+ __asm__ __volatile__("xgetbv" : "=a"(xcr0), "=d"(dont_need_edx) : "c"(0));
+
+ if ((xcr0 & (1u<<1)) && // XMM register state saved?
+ (xcr0 & (1u<<2)) && // YMM register state saved?
+ (ebx & (1u<<5))) { // AVX2
+ // At this point we're at least HSW. Continue checking for SKX.
+ if ((xcr0 & (1u<< 5)) && // Opmasks state saved?
+ (xcr0 & (1u<< 6)) && // First 16 ZMM registers saved?
+ (xcr0 & (1u<< 7)) && // High 16 ZMM registers saved?
+ (ebx & (1u<<16)) && // AVX512F
+ (ebx & (1u<<17)) && // AVX512DQ
+ (ebx & (1u<<28)) && // AVX512CD
+ (ebx & (1u<<30)) && // AVX512BW
+ (ebx & (1u<<31))) { // AVX512VL
+ return CpuType::SKX;
+ }
+ return CpuType::HSW;
+ }
+ }
+ return CpuType::None;
+ }();
+ return type;
+ }
+ #endif
+
+#endif
+
+typedef struct {
+ Op op;
+ const void* arg;
+} OpAndArg;
+
+static OpAndArg select_curve_op(const skcms_Curve* curve, int channel) {
+ static const struct { Op sRGBish, PQish, HLGish, HLGinvish, table; } ops[] = {
+ { Op_tf_r, Op_pq_r, Op_hlg_r, Op_hlginv_r, Op_table_r },
+ { Op_tf_g, Op_pq_g, Op_hlg_g, Op_hlginv_g, Op_table_g },
+ { Op_tf_b, Op_pq_b, Op_hlg_b, Op_hlginv_b, Op_table_b },
+ { Op_tf_a, Op_pq_a, Op_hlg_a, Op_hlginv_a, Op_table_a },
+ };
+ const auto& op = ops[channel];
+
+ if (curve->table_entries == 0) {
+ const OpAndArg noop = { Op_load_a8/*doesn't matter*/, nullptr };
+
+ const skcms_TransferFunction& tf = curve->parametric;
+
+ if (tf.g == 1 && tf.a == 1 &&
+ tf.b == 0 && tf.c == 0 && tf.d == 0 && tf.e == 0 && tf.f == 0) {
+ return noop;
+ }
+
+ switch (classify(tf)) {
+ case Bad: return noop;
+ case sRGBish: return OpAndArg{op.sRGBish, &tf};
+ case PQish: return OpAndArg{op.PQish, &tf};
+ case HLGish: return OpAndArg{op.HLGish, &tf};
+ case HLGinvish: return OpAndArg{op.HLGinvish, &tf};
+ }
+ }
+ return OpAndArg{op.table, curve};
+}
+
+static size_t bytes_per_pixel(skcms_PixelFormat fmt) {
+ switch (fmt >> 1) { // ignore rgb/bgr
+ case skcms_PixelFormat_A_8 >> 1: return 1;
+ case skcms_PixelFormat_G_8 >> 1: return 1;
+ case skcms_PixelFormat_RGBA_8888_Palette8 >> 1: return 1;
+ case skcms_PixelFormat_ABGR_4444 >> 1: return 2;
+ case skcms_PixelFormat_RGB_565 >> 1: return 2;
+ case skcms_PixelFormat_RGB_888 >> 1: return 3;
+ case skcms_PixelFormat_RGBA_8888 >> 1: return 4;
+ case skcms_PixelFormat_RGBA_8888_sRGB >> 1: return 4;
+ case skcms_PixelFormat_RGBA_1010102 >> 1: return 4;
+ case skcms_PixelFormat_RGB_161616LE >> 1: return 6;
+ case skcms_PixelFormat_RGBA_16161616LE >> 1: return 8;
+ case skcms_PixelFormat_RGB_161616BE >> 1: return 6;
+ case skcms_PixelFormat_RGBA_16161616BE >> 1: return 8;
+ case skcms_PixelFormat_RGB_hhh_Norm >> 1: return 6;
+ case skcms_PixelFormat_RGBA_hhhh_Norm >> 1: return 8;
+ case skcms_PixelFormat_RGB_hhh >> 1: return 6;
+ case skcms_PixelFormat_RGBA_hhhh >> 1: return 8;
+ case skcms_PixelFormat_RGB_fff >> 1: return 12;
+ case skcms_PixelFormat_RGBA_ffff >> 1: return 16;
+ }
+ assert(false);
+ return 0;
+}
+
+static bool prep_for_destination(const skcms_ICCProfile* profile,
+ skcms_Matrix3x3* fromXYZD50,
+ skcms_TransferFunction* invR,
+ skcms_TransferFunction* invG,
+ skcms_TransferFunction* invB) {
+ // skcms_Transform() supports B2A destinations...
+ if (profile->has_B2A) { return true; }
+ // ...and destinations with parametric transfer functions and an XYZD50 gamut matrix.
+ return profile->has_trc
+ && profile->has_toXYZD50
+ && profile->trc[0].table_entries == 0
+ && profile->trc[1].table_entries == 0
+ && profile->trc[2].table_entries == 0
+ && skcms_TransferFunction_invert(&profile->trc[0].parametric, invR)
+ && skcms_TransferFunction_invert(&profile->trc[1].parametric, invG)
+ && skcms_TransferFunction_invert(&profile->trc[2].parametric, invB)
+ && skcms_Matrix3x3_invert(&profile->toXYZD50, fromXYZD50);
+}
+
+bool skcms_Transform(const void* src,
+ skcms_PixelFormat srcFmt,
+ skcms_AlphaFormat srcAlpha,
+ const skcms_ICCProfile* srcProfile,
+ void* dst,
+ skcms_PixelFormat dstFmt,
+ skcms_AlphaFormat dstAlpha,
+ const skcms_ICCProfile* dstProfile,
+ size_t npixels) {
+ return skcms_TransformWithPalette(src, srcFmt, srcAlpha, srcProfile,
+ dst, dstFmt, dstAlpha, dstProfile,
+ npixels, nullptr);
+}
+
+bool skcms_TransformWithPalette(const void* src,
+ skcms_PixelFormat srcFmt,
+ skcms_AlphaFormat srcAlpha,
+ const skcms_ICCProfile* srcProfile,
+ void* dst,
+ skcms_PixelFormat dstFmt,
+ skcms_AlphaFormat dstAlpha,
+ const skcms_ICCProfile* dstProfile,
+ size_t nz,
+ const void* palette) {
+ const size_t dst_bpp = bytes_per_pixel(dstFmt),
+ src_bpp = bytes_per_pixel(srcFmt);
+ // Let's just refuse if the request is absurdly big.
+ if (nz * dst_bpp > INT_MAX || nz * src_bpp > INT_MAX) {
+ return false;
+ }
+ int n = (int)nz;
+
+ // Null profiles default to sRGB. Passing null for both is handy when doing format conversion.
+ if (!srcProfile) {
+ srcProfile = skcms_sRGB_profile();
+ }
+ if (!dstProfile) {
+ dstProfile = skcms_sRGB_profile();
+ }
+
+ // We can't transform in place unless the PixelFormats are the same size.
+ if (dst == src && dst_bpp != src_bpp) {
+ return false;
+ }
+ // TODO: more careful alias rejection (like, dst == src + 1)?
+
+ if (needs_palette(srcFmt) && !palette) {
+ return false;
+ }
+
+ Op program [32];
+ const void* arguments[32];
+
+ Op* ops = program;
+ const void** args = arguments;
+
+ // These are always parametric curves of some sort.
+ skcms_Curve dst_curves[3];
+ dst_curves[0].table_entries =
+ dst_curves[1].table_entries =
+ dst_curves[2].table_entries = 0;
+
+ skcms_Matrix3x3 from_xyz;
+
+ switch (srcFmt >> 1) {
+ default: return false;
+ case skcms_PixelFormat_A_8 >> 1: *ops++ = Op_load_a8; break;
+ case skcms_PixelFormat_G_8 >> 1: *ops++ = Op_load_g8; break;
+ case skcms_PixelFormat_ABGR_4444 >> 1: *ops++ = Op_load_4444; break;
+ case skcms_PixelFormat_RGB_565 >> 1: *ops++ = Op_load_565; break;
+ case skcms_PixelFormat_RGB_888 >> 1: *ops++ = Op_load_888; break;
+ case skcms_PixelFormat_RGBA_8888 >> 1: *ops++ = Op_load_8888; break;
+ case skcms_PixelFormat_RGBA_1010102 >> 1: *ops++ = Op_load_1010102; break;
+ case skcms_PixelFormat_RGB_161616LE >> 1: *ops++ = Op_load_161616LE; break;
+ case skcms_PixelFormat_RGBA_16161616LE >> 1: *ops++ = Op_load_16161616LE; break;
+ case skcms_PixelFormat_RGB_161616BE >> 1: *ops++ = Op_load_161616BE; break;
+ case skcms_PixelFormat_RGBA_16161616BE >> 1: *ops++ = Op_load_16161616BE; break;
+ case skcms_PixelFormat_RGB_hhh_Norm >> 1: *ops++ = Op_load_hhh; break;
+ case skcms_PixelFormat_RGBA_hhhh_Norm >> 1: *ops++ = Op_load_hhhh; break;
+ case skcms_PixelFormat_RGB_hhh >> 1: *ops++ = Op_load_hhh; break;
+ case skcms_PixelFormat_RGBA_hhhh >> 1: *ops++ = Op_load_hhhh; break;
+ case skcms_PixelFormat_RGB_fff >> 1: *ops++ = Op_load_fff; break;
+ case skcms_PixelFormat_RGBA_ffff >> 1: *ops++ = Op_load_ffff; break;
+
+ case skcms_PixelFormat_RGBA_8888_Palette8 >> 1: *ops++ = Op_load_8888_palette8;
+ *args++ = palette;
+ break;
+ case skcms_PixelFormat_RGBA_8888_sRGB >> 1:
+ *ops++ = Op_load_8888;
+ *ops++ = Op_tf_r; *args++ = skcms_sRGB_TransferFunction();
+ *ops++ = Op_tf_g; *args++ = skcms_sRGB_TransferFunction();
+ *ops++ = Op_tf_b; *args++ = skcms_sRGB_TransferFunction();
+ break;
+ }
+ if (srcFmt == skcms_PixelFormat_RGB_hhh_Norm ||
+ srcFmt == skcms_PixelFormat_RGBA_hhhh_Norm) {
+ *ops++ = Op_clamp;
+ }
+ if (srcFmt & 1) {
+ *ops++ = Op_swap_rb;
+ }
+ skcms_ICCProfile gray_dst_profile;
+ if ((dstFmt >> 1) == (skcms_PixelFormat_G_8 >> 1)) {
+ // When transforming to gray, stop at XYZ (by setting toXYZ to identity), then transform
+ // luminance (Y) by the destination transfer function.
+ gray_dst_profile = *dstProfile;
+ skcms_SetXYZD50(&gray_dst_profile, &skcms_XYZD50_profile()->toXYZD50);
+ dstProfile = &gray_dst_profile;
+ }
+
+ if (srcProfile->data_color_space == skcms_Signature_CMYK) {
+ // Photoshop creates CMYK images as inverse CMYK.
+ // These happen to be the only ones we've _ever_ seen.
+ *ops++ = Op_invert;
+ // With CMYK, ignore the alpha type, to avoid changing K or conflating CMY with K.
+ srcAlpha = skcms_AlphaFormat_Unpremul;
+ }
+
+ if (srcAlpha == skcms_AlphaFormat_Opaque) {
+ *ops++ = Op_force_opaque;
+ } else if (srcAlpha == skcms_AlphaFormat_PremulAsEncoded) {
+ *ops++ = Op_unpremul;
+ }
+
+ if (dstProfile != srcProfile) {
+
+ if (!prep_for_destination(dstProfile,
+ &from_xyz,
+ &dst_curves[0].parametric,
+ &dst_curves[1].parametric,
+ &dst_curves[2].parametric)) {
+ return false;
+ }
+
+ if (srcProfile->has_A2B) {
+ if (srcProfile->A2B.input_channels) {
+ for (int i = 0; i < (int)srcProfile->A2B.input_channels; i++) {
+ OpAndArg oa = select_curve_op(&srcProfile->A2B.input_curves[i], i);
+ if (oa.arg) {
+ *ops++ = oa.op;
+ *args++ = oa.arg;
+ }
+ }
+ *ops++ = Op_clamp;
+ *ops++ = Op_clut_A2B;
+ *args++ = &srcProfile->A2B;
+ }
+
+ if (srcProfile->A2B.matrix_channels == 3) {
+ for (int i = 0; i < 3; i++) {
+ OpAndArg oa = select_curve_op(&srcProfile->A2B.matrix_curves[i], i);
+ if (oa.arg) {
+ *ops++ = oa.op;
+ *args++ = oa.arg;
+ }
+ }
+
+ static const skcms_Matrix3x4 I = {{
+ {1,0,0,0},
+ {0,1,0,0},
+ {0,0,1,0},
+ }};
+ if (0 != memcmp(&I, &srcProfile->A2B.matrix, sizeof(I))) {
+ *ops++ = Op_matrix_3x4;
+ *args++ = &srcProfile->A2B.matrix;
+ }
+ }
+
+ if (srcProfile->A2B.output_channels == 3) {
+ for (int i = 0; i < 3; i++) {
+ OpAndArg oa = select_curve_op(&srcProfile->A2B.output_curves[i], i);
+ if (oa.arg) {
+ *ops++ = oa.op;
+ *args++ = oa.arg;
+ }
+ }
+ }
+
+ if (srcProfile->pcs == skcms_Signature_Lab) {
+ *ops++ = Op_lab_to_xyz;
+ }
+
+ } else if (srcProfile->has_trc && srcProfile->has_toXYZD50) {
+ for (int i = 0; i < 3; i++) {
+ OpAndArg oa = select_curve_op(&srcProfile->trc[i], i);
+ if (oa.arg) {
+ *ops++ = oa.op;
+ *args++ = oa.arg;
+ }
+ }
+ } else {
+ return false;
+ }
+
+ // A2B sources are in XYZD50 by now, but TRC sources are still in their original gamut.
+ assert (srcProfile->has_A2B || srcProfile->has_toXYZD50);
+
+ if (dstProfile->has_B2A) {
+ // B2A needs its input in XYZD50, so transform TRC sources now.
+ if (!srcProfile->has_A2B) {
+ *ops++ = Op_matrix_3x3;
+ *args++ = &srcProfile->toXYZD50;
+ }
+
+ if (dstProfile->pcs == skcms_Signature_Lab) {
+ *ops++ = Op_xyz_to_lab;
+ }
+
+ if (dstProfile->B2A.input_channels == 3) {
+ for (int i = 0; i < 3; i++) {
+ OpAndArg oa = select_curve_op(&dstProfile->B2A.input_curves[i], i);
+ if (oa.arg) {
+ *ops++ = oa.op;
+ *args++ = oa.arg;
+ }
+ }
+ }
+
+ if (dstProfile->B2A.matrix_channels == 3) {
+ static const skcms_Matrix3x4 I = {{
+ {1,0,0,0},
+ {0,1,0,0},
+ {0,0,1,0},
+ }};
+ if (0 != memcmp(&I, &dstProfile->B2A.matrix, sizeof(I))) {
+ *ops++ = Op_matrix_3x4;
+ *args++ = &dstProfile->B2A.matrix;
+ }
+
+ for (int i = 0; i < 3; i++) {
+ OpAndArg oa = select_curve_op(&dstProfile->B2A.matrix_curves[i], i);
+ if (oa.arg) {
+ *ops++ = oa.op;
+ *args++ = oa.arg;
+ }
+ }
+ }
+
+ if (dstProfile->B2A.output_channels) {
+ *ops++ = Op_clamp;
+ *ops++ = Op_clut_B2A;
+ *args++ = &dstProfile->B2A;
+ for (int i = 0; i < (int)dstProfile->B2A.output_channels; i++) {
+ OpAndArg oa = select_curve_op(&dstProfile->B2A.output_curves[i], i);
+ if (oa.arg) {
+ *ops++ = oa.op;
+ *args++ = oa.arg;
+ }
+ }
+ }
+ } else {
+ // This is a TRC destination.
+ // We'll concat any src->xyz matrix with our xyz->dst matrix into one src->dst matrix.
+ // (A2B sources are already in XYZD50, making that src->xyz matrix I.)
+ static const skcms_Matrix3x3 I = {{
+ { 1.0f, 0.0f, 0.0f },
+ { 0.0f, 1.0f, 0.0f },
+ { 0.0f, 0.0f, 1.0f },
+ }};
+ const skcms_Matrix3x3* to_xyz = srcProfile->has_A2B ? &I : &srcProfile->toXYZD50;
+
+ // There's a chance the source and destination gamuts are identical,
+ // in which case we can skip the gamut transform.
+ if (0 != memcmp(&dstProfile->toXYZD50, to_xyz, sizeof(skcms_Matrix3x3))) {
+ // Concat the entire gamut transform into from_xyz,
+ // now slightly misnamed but it's a handy spot to stash the result.
+ from_xyz = skcms_Matrix3x3_concat(&from_xyz, to_xyz);
+ *ops++ = Op_matrix_3x3;
+ *args++ = &from_xyz;
+ }
+
+ // Encode back to dst RGB using its parametric transfer functions.
+ for (int i = 0; i < 3; i++) {
+ OpAndArg oa = select_curve_op(dst_curves+i, i);
+ if (oa.arg) {
+ assert (oa.op != Op_table_r &&
+ oa.op != Op_table_g &&
+ oa.op != Op_table_b &&
+ oa.op != Op_table_a);
+ *ops++ = oa.op;
+ *args++ = oa.arg;
+ }
+ }
+ }
+ }
+
+ // Clamp here before premul to make sure we're clamping to normalized values _and_ gamut,
+ // not just to values that fit in [0,1].
+ //
+ // E.g. r = 1.1, a = 0.5 would fit fine in fixed point after premul (ra=0.55,a=0.5),
+ // but would be carrying r > 1, which is really unexpected for downstream consumers.
+ if (dstFmt < skcms_PixelFormat_RGB_hhh) {
+ *ops++ = Op_clamp;
+ }
+
+ if (dstProfile->data_color_space == skcms_Signature_CMYK) {
+ // Photoshop creates CMYK images as inverse CMYK.
+ // These happen to be the only ones we've _ever_ seen.
+ *ops++ = Op_invert;
+
+ // CMYK has no alpha channel, so make sure dstAlpha is a no-op.
+ dstAlpha = skcms_AlphaFormat_Unpremul;
+ }
+
+ if (dstAlpha == skcms_AlphaFormat_Opaque) {
+ *ops++ = Op_force_opaque;
+ } else if (dstAlpha == skcms_AlphaFormat_PremulAsEncoded) {
+ *ops++ = Op_premul;
+ }
+ if (dstFmt & 1) {
+ *ops++ = Op_swap_rb;
+ }
+ switch (dstFmt >> 1) {
+ default: return false;
+ case skcms_PixelFormat_A_8 >> 1: *ops++ = Op_store_a8; break;
+ case skcms_PixelFormat_G_8 >> 1: *ops++ = Op_store_g8; break;
+ case skcms_PixelFormat_ABGR_4444 >> 1: *ops++ = Op_store_4444; break;
+ case skcms_PixelFormat_RGB_565 >> 1: *ops++ = Op_store_565; break;
+ case skcms_PixelFormat_RGB_888 >> 1: *ops++ = Op_store_888; break;
+ case skcms_PixelFormat_RGBA_8888 >> 1: *ops++ = Op_store_8888; break;
+ case skcms_PixelFormat_RGBA_1010102 >> 1: *ops++ = Op_store_1010102; break;
+ case skcms_PixelFormat_RGB_161616LE >> 1: *ops++ = Op_store_161616LE; break;
+ case skcms_PixelFormat_RGBA_16161616LE >> 1: *ops++ = Op_store_16161616LE; break;
+ case skcms_PixelFormat_RGB_161616BE >> 1: *ops++ = Op_store_161616BE; break;
+ case skcms_PixelFormat_RGBA_16161616BE >> 1: *ops++ = Op_store_16161616BE; break;
+ case skcms_PixelFormat_RGB_hhh_Norm >> 1: *ops++ = Op_store_hhh; break;
+ case skcms_PixelFormat_RGBA_hhhh_Norm >> 1: *ops++ = Op_store_hhhh; break;
+ case skcms_PixelFormat_RGB_hhh >> 1: *ops++ = Op_store_hhh; break;
+ case skcms_PixelFormat_RGBA_hhhh >> 1: *ops++ = Op_store_hhhh; break;
+ case skcms_PixelFormat_RGB_fff >> 1: *ops++ = Op_store_fff; break;
+ case skcms_PixelFormat_RGBA_ffff >> 1: *ops++ = Op_store_ffff; break;
+
+ case skcms_PixelFormat_RGBA_8888_sRGB >> 1:
+ *ops++ = Op_tf_r; *args++ = skcms_sRGB_Inverse_TransferFunction();
+ *ops++ = Op_tf_g; *args++ = skcms_sRGB_Inverse_TransferFunction();
+ *ops++ = Op_tf_b; *args++ = skcms_sRGB_Inverse_TransferFunction();
+ *ops++ = Op_store_8888;
+ break;
+ }
+
+ auto run = baseline::run_program;
+#if defined(TEST_FOR_HSW)
+ switch (cpu_type()) {
+ case CpuType::None: break;
+ case CpuType::HSW: run = hsw::run_program; break;
+ case CpuType::SKX: run = hsw::run_program; break;
+ }
+#endif
+#if defined(TEST_FOR_SKX)
+ switch (cpu_type()) {
+ case CpuType::None: break;
+ case CpuType::HSW: break;
+ case CpuType::SKX: run = skx::run_program; break;
+ }
+#endif
+ run(program, arguments, (const char*)src, (char*)dst, n, src_bpp,dst_bpp);
+ return true;
+}
+
+static void assert_usable_as_destination(const skcms_ICCProfile* profile) {
+#if defined(NDEBUG)
+ (void)profile;
+#else
+ skcms_Matrix3x3 fromXYZD50;
+ skcms_TransferFunction invR, invG, invB;
+ assert(prep_for_destination(profile, &fromXYZD50, &invR, &invG, &invB));
+#endif
+}
+
+bool skcms_MakeUsableAsDestination(skcms_ICCProfile* profile) {
+ if (!profile->has_B2A) {
+ skcms_Matrix3x3 fromXYZD50;
+ if (!profile->has_trc || !profile->has_toXYZD50
+ || !skcms_Matrix3x3_invert(&profile->toXYZD50, &fromXYZD50)) {
+ return false;
+ }
+
+ skcms_TransferFunction tf[3];
+ for (int i = 0; i < 3; i++) {
+ skcms_TransferFunction inv;
+ if (profile->trc[i].table_entries == 0
+ && skcms_TransferFunction_invert(&profile->trc[i].parametric, &inv)) {
+ tf[i] = profile->trc[i].parametric;
+ continue;
+ }
+
+ float max_error;
+ // Parametric curves from skcms_ApproximateCurve() are guaranteed to be invertible.
+ if (!skcms_ApproximateCurve(&profile->trc[i], &tf[i], &max_error)) {
+ return false;
+ }
+ }
+
+ for (int i = 0; i < 3; ++i) {
+ profile->trc[i].table_entries = 0;
+ profile->trc[i].parametric = tf[i];
+ }
+ }
+ assert_usable_as_destination(profile);
+ return true;
+}
+
+bool skcms_MakeUsableAsDestinationWithSingleCurve(skcms_ICCProfile* profile) {
+ // Call skcms_MakeUsableAsDestination() with B2A disabled;
+ // on success that'll return a TRC/XYZ profile with three skcms_TransferFunctions.
+ skcms_ICCProfile result = *profile;
+ result.has_B2A = false;
+ if (!skcms_MakeUsableAsDestination(&result)) {
+ return false;
+ }
+
+ // Of the three, pick the transfer function that best fits the other two.
+ int best_tf = 0;
+ float min_max_error = INFINITY_;
+ for (int i = 0; i < 3; i++) {
+ skcms_TransferFunction inv;
+ if (!skcms_TransferFunction_invert(&result.trc[i].parametric, &inv)) {
+ return false;
+ }
+
+ float err = 0;
+ for (int j = 0; j < 3; ++j) {
+ err = fmaxf_(err, skcms_MaxRoundtripError(&profile->trc[j], &inv));
+ }
+ if (min_max_error > err) {
+ min_max_error = err;
+ best_tf = i;
+ }
+ }
+
+ for (int i = 0; i < 3; i++) {
+ result.trc[i].parametric = result.trc[best_tf].parametric;
+ }
+
+ *profile = result;
+ assert_usable_as_destination(profile);
+ return true;
+}
diff --git a/chromium/third_party/skia/modules/skcms/skcms.gni b/chromium/third_party/skia/modules/skcms/skcms.gni
new file mode 100644
index 00000000000..39df343d998
--- /dev/null
+++ b/chromium/third_party/skia/modules/skcms/skcms.gni
@@ -0,0 +1,14 @@
+# Copyright 2018 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+#
+# This file is deprecated - clients should use //modules/skcms/skcms.gni
+
+skcms_public_headers = [ "skcms.h" ]
+
+skcms_sources = [
+ "skcms.cc",
+ "skcms_internal.h",
+ "src/Transform_inl.h",
+]
diff --git a/chromium/third_party/skia/modules/skcms/skcms.h b/chromium/third_party/skia/modules/skcms/skcms.h
new file mode 100644
index 00000000000..3e02d954888
--- /dev/null
+++ b/chromium/third_party/skia/modules/skcms/skcms.h
@@ -0,0 +1,394 @@
+/*
+ * Copyright 2018 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#pragma once
+
+// skcms.h contains the entire public API for skcms.
+
+#ifndef SKCMS_API
+ #define SKCMS_API
+#endif
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// A row-major 3x3 matrix (ie vals[row][col])
+typedef struct skcms_Matrix3x3 {
+ float vals[3][3];
+} skcms_Matrix3x3;
+
+// It is _not_ safe to alias the pointers to invert in-place.
+SKCMS_API bool skcms_Matrix3x3_invert(const skcms_Matrix3x3*, skcms_Matrix3x3*);
+SKCMS_API skcms_Matrix3x3 skcms_Matrix3x3_concat(const skcms_Matrix3x3*, const skcms_Matrix3x3*);
+
+// A row-major 3x4 matrix (ie vals[row][col])
+typedef struct skcms_Matrix3x4 {
+ float vals[3][4];
+} skcms_Matrix3x4;
+
+// A transfer function mapping encoded values to linear values,
+// represented by this 7-parameter piecewise function:
+//
+// linear = sign(encoded) * (c*|encoded| + f) , 0 <= |encoded| < d
+// = sign(encoded) * ((a*|encoded| + b)^g + e), d <= |encoded|
+//
+// (A simple gamma transfer function sets g to gamma and a to 1.)
+typedef struct skcms_TransferFunction {
+ float g, a,b,c,d,e,f;
+} skcms_TransferFunction;
+
+SKCMS_API float skcms_TransferFunction_eval (const skcms_TransferFunction*, float);
+SKCMS_API bool skcms_TransferFunction_invert(const skcms_TransferFunction*,
+ skcms_TransferFunction*);
+
+// We can jam a couple alternate transfer function forms into skcms_TransferFunction,
+// including those matching the general forms of the SMPTE ST 2084 PQ function or HLG.
+//
+// PQish:
+// max(A + B|encoded|^C, 0)
+// linear = sign(encoded) * (------------------------) ^ F
+// D + E|encoded|^C
+SKCMS_API bool skcms_TransferFunction_makePQish(skcms_TransferFunction*,
+ float A, float B, float C,
+ float D, float E, float F);
+// HLGish:
+// { K * sign(encoded) * ( (R|encoded|)^G ) when 0 <= |encoded| <= 1/R
+// linear = { K * sign(encoded) * ( e^(a(|encoded|-c)) + b ) when 1/R < |encoded|
+SKCMS_API bool skcms_TransferFunction_makeScaledHLGish(skcms_TransferFunction*,
+ float K, float R, float G,
+ float a, float b, float c);
+
+// Compatibility shim with K=1 for old callers.
+static inline bool skcms_TransferFunction_makeHLGish(skcms_TransferFunction* fn,
+ float R, float G,
+ float a, float b, float c) {
+ return skcms_TransferFunction_makeScaledHLGish(fn, 1.0f, R,G, a,b,c);
+}
+
+// PQ mapping encoded [0,1] to linear [0,1].
+static inline bool skcms_TransferFunction_makePQ(skcms_TransferFunction* tf) {
+ return skcms_TransferFunction_makePQish(tf, -107/128.0f, 1.0f, 32/2523.0f
+ , 2413/128.0f, -2392/128.0f, 8192/1305.0f);
+}
+// HLG mapping encoded [0,1] to linear [0,12].
+static inline bool skcms_TransferFunction_makeHLG(skcms_TransferFunction* tf) {
+ return skcms_TransferFunction_makeHLGish(tf, 2.0f, 2.0f
+ , 1/0.17883277f, 0.28466892f, 0.55991073f);
+}
+
+// Is this an ordinary sRGB-ish transfer function, or one of the HDR forms we support?
+SKCMS_API bool skcms_TransferFunction_isSRGBish(const skcms_TransferFunction*);
+SKCMS_API bool skcms_TransferFunction_isPQish (const skcms_TransferFunction*);
+SKCMS_API bool skcms_TransferFunction_isHLGish (const skcms_TransferFunction*);
+
+// Unified representation of 'curv' or 'para' tag data, or a 1D table from 'mft1' or 'mft2'
+typedef union skcms_Curve {
+ struct {
+ uint32_t alias_of_table_entries;
+ skcms_TransferFunction parametric;
+ };
+ struct {
+ uint32_t table_entries;
+ const uint8_t* table_8;
+ const uint8_t* table_16;
+ };
+} skcms_Curve;
+
+// Complex transforms between device space (A) and profile connection space (B):
+// A2B: device -> [ "A" curves -> CLUT ] -> [ "M" curves -> matrix ] -> "B" curves -> PCS
+// B2A: device <- [ "A" curves <- CLUT ] <- [ "M" curves <- matrix ] <- "B" curves <- PCS
+
+typedef struct skcms_A2B {
+ // Optional: N 1D "A" curves, followed by an N-dimensional CLUT.
+ // If input_channels == 0, these curves and CLUT are skipped,
+ // Otherwise, input_channels must be in [1, 4].
+ uint32_t input_channels;
+ skcms_Curve input_curves[4];
+ uint8_t grid_points[4];
+ const uint8_t* grid_8;
+ const uint8_t* grid_16;
+
+ // Optional: 3 1D "M" curves, followed by a color matrix.
+ // If matrix_channels == 0, these curves and matrix are skipped,
+ // Otherwise, matrix_channels must be 3.
+ uint32_t matrix_channels;
+ skcms_Curve matrix_curves[3];
+ skcms_Matrix3x4 matrix;
+
+ // Required: 3 1D "B" curves. Always present, and output_channels must be 3.
+ uint32_t output_channels;
+ skcms_Curve output_curves[3];
+} skcms_A2B;
+
+typedef struct skcms_B2A {
+ // Required: 3 1D "B" curves. Always present, and input_channels must be 3.
+ uint32_t input_channels;
+ skcms_Curve input_curves[3];
+
+ // Optional: a color matrix, followed by 3 1D "M" curves.
+ // If matrix_channels == 0, this matrix and these curves are skipped,
+ // Otherwise, matrix_channels must be 3.
+ uint32_t matrix_channels;
+ skcms_Matrix3x4 matrix;
+ skcms_Curve matrix_curves[3];
+
+ // Optional: an N-dimensional CLUT, followed by N 1D "A" curves.
+ // If output_channels == 0, this CLUT and these curves are skipped,
+ // Otherwise, output_channels must be in [1, 4].
+ uint32_t output_channels;
+ uint8_t grid_points[4];
+ const uint8_t* grid_8;
+ const uint8_t* grid_16;
+ skcms_Curve output_curves[4];
+} skcms_B2A;
+
+
+typedef struct skcms_ICCProfile {
+ const uint8_t* buffer;
+
+ uint32_t size;
+ uint32_t data_color_space;
+ uint32_t pcs;
+ uint32_t tag_count;
+
+ // skcms_Parse() will set commonly-used fields for you when possible:
+
+ // If we can parse red, green and blue transfer curves from the profile,
+ // trc will be set to those three curves, and has_trc will be true.
+ bool has_trc;
+ skcms_Curve trc[3];
+
+ // If this profile's gamut can be represented by a 3x3 transform to XYZD50,
+ // skcms_Parse() sets toXYZD50 to that transform and has_toXYZD50 to true.
+ bool has_toXYZD50;
+ skcms_Matrix3x3 toXYZD50;
+
+ // If the profile has a valid A2B0 or A2B1 tag, skcms_Parse() sets A2B to
+ // that data, and has_A2B to true. skcms_ParseWithA2BPriority() does the
+ // same following any user-provided prioritization of A2B0, A2B1, or A2B2.
+ bool has_A2B;
+ skcms_A2B A2B;
+
+ // If the profile has a valid B2A0 or B2A1 tag, skcms_Parse() sets B2A to
+ // that data, and has_B2A to true. skcms_ParseWithA2BPriority() does the
+ // same following any user-provided prioritization of B2A0, B2A1, or B2A2.
+ bool has_B2A;
+ skcms_B2A B2A;
+
+} skcms_ICCProfile;
+
+// The sRGB color profile is so commonly used that we offer a canonical skcms_ICCProfile for it.
+SKCMS_API const skcms_ICCProfile* skcms_sRGB_profile(void);
+// Ditto for XYZD50, the most common profile connection space.
+SKCMS_API const skcms_ICCProfile* skcms_XYZD50_profile(void);
+
+SKCMS_API const skcms_TransferFunction* skcms_sRGB_TransferFunction(void);
+SKCMS_API const skcms_TransferFunction* skcms_sRGB_Inverse_TransferFunction(void);
+SKCMS_API const skcms_TransferFunction* skcms_Identity_TransferFunction(void);
+
+// Practical equality test for two skcms_ICCProfiles.
+// The implementation is subject to change, but it will always try to answer
+// "can I substitute A for B?" and "can I skip transforming from A to B?".
+SKCMS_API bool skcms_ApproximatelyEqualProfiles(const skcms_ICCProfile* A,
+ const skcms_ICCProfile* B);
+
+// Practical test that answers: Is curve roughly the inverse of inv_tf? Typically used by passing
+// the inverse of a known parametric transfer function (like sRGB), to determine if a particular
+// curve is very close to sRGB.
+SKCMS_API bool skcms_AreApproximateInverses(const skcms_Curve* curve,
+ const skcms_TransferFunction* inv_tf);
+
+// Similar to above, answering the question for all three TRC curves of the given profile. Again,
+// passing skcms_sRGB_InverseTransferFunction as inv_tf will answer the question:
+// "Does this profile have a transfer function that is very close to sRGB?"
+SKCMS_API bool skcms_TRCs_AreApproximateInverse(const skcms_ICCProfile* profile,
+ const skcms_TransferFunction* inv_tf);
+
+// Parse an ICC profile and return true if possible, otherwise return false.
+// Selects an A2B profile (if present) according to priority list (each entry 0-2).
+// The buffer is not copied; it must remain valid as long as the skcms_ICCProfile will be used.
+SKCMS_API bool skcms_ParseWithA2BPriority(const void*, size_t,
+ const int priority[], int priorities,
+ skcms_ICCProfile*);
+
+static inline bool skcms_Parse(const void* buf, size_t len, skcms_ICCProfile* profile) {
+ // For continuity of existing user expectations,
+ // prefer A2B0 (perceptual) over A2B1 (relative colormetric), and ignore A2B2 (saturation).
+ const int priority[] = {0,1};
+ return skcms_ParseWithA2BPriority(buf, len,
+ priority, sizeof(priority)/sizeof(*priority),
+ profile);
+}
+
+SKCMS_API bool skcms_ApproximateCurve(const skcms_Curve* curve,
+ skcms_TransferFunction* approx,
+ float* max_error);
+
+SKCMS_API bool skcms_GetCHAD(const skcms_ICCProfile*, skcms_Matrix3x3*);
+SKCMS_API bool skcms_GetWTPT(const skcms_ICCProfile*, float xyz[3]);
+
+// These are common ICC signature values
+enum {
+ // data_color_space
+ skcms_Signature_CMYK = 0x434D594B,
+ skcms_Signature_Gray = 0x47524159,
+ skcms_Signature_RGB = 0x52474220,
+
+ // pcs
+ skcms_Signature_Lab = 0x4C616220,
+ skcms_Signature_XYZ = 0x58595A20,
+};
+
+typedef enum skcms_PixelFormat {
+ skcms_PixelFormat_A_8,
+ skcms_PixelFormat_A_8_,
+ skcms_PixelFormat_G_8,
+ skcms_PixelFormat_G_8_,
+ skcms_PixelFormat_RGBA_8888_Palette8,
+ skcms_PixelFormat_BGRA_8888_Palette8,
+
+ skcms_PixelFormat_RGB_565,
+ skcms_PixelFormat_BGR_565,
+
+ skcms_PixelFormat_ABGR_4444,
+ skcms_PixelFormat_ARGB_4444,
+
+ skcms_PixelFormat_RGB_888,
+ skcms_PixelFormat_BGR_888,
+ skcms_PixelFormat_RGBA_8888,
+ skcms_PixelFormat_BGRA_8888,
+ skcms_PixelFormat_RGBA_8888_sRGB, // Automatic sRGB encoding / decoding.
+ skcms_PixelFormat_BGRA_8888_sRGB, // (Generally used with linear transfer functions.)
+
+ skcms_PixelFormat_RGBA_1010102,
+ skcms_PixelFormat_BGRA_1010102,
+
+ skcms_PixelFormat_RGB_161616LE, // Little-endian. Pointers must be 16-bit aligned.
+ skcms_PixelFormat_BGR_161616LE,
+ skcms_PixelFormat_RGBA_16161616LE,
+ skcms_PixelFormat_BGRA_16161616LE,
+
+ skcms_PixelFormat_RGB_161616BE, // Big-endian. Pointers must be 16-bit aligned.
+ skcms_PixelFormat_BGR_161616BE,
+ skcms_PixelFormat_RGBA_16161616BE,
+ skcms_PixelFormat_BGRA_16161616BE,
+
+ skcms_PixelFormat_RGB_hhh_Norm, // 1-5-10 half-precision float in [0,1]
+ skcms_PixelFormat_BGR_hhh_Norm, // Pointers must be 16-bit aligned.
+ skcms_PixelFormat_RGBA_hhhh_Norm,
+ skcms_PixelFormat_BGRA_hhhh_Norm,
+
+ skcms_PixelFormat_RGB_hhh, // 1-5-10 half-precision float.
+ skcms_PixelFormat_BGR_hhh, // Pointers must be 16-bit aligned.
+ skcms_PixelFormat_RGBA_hhhh,
+ skcms_PixelFormat_BGRA_hhhh,
+
+ skcms_PixelFormat_RGB_fff, // 1-8-23 single-precision float (the normal kind).
+ skcms_PixelFormat_BGR_fff, // Pointers must be 32-bit aligned.
+ skcms_PixelFormat_RGBA_ffff,
+ skcms_PixelFormat_BGRA_ffff,
+} skcms_PixelFormat;
+
+// We always store any alpha channel linearly. In the chart below, tf-1() is the inverse
+// transfer function for the given color profile (applying the transfer function linearizes).
+
+// We treat opaque as a strong requirement, not just a performance hint: we will ignore
+// any source alpha and treat it as 1.0, and will make sure that any destination alpha
+// channel is filled with the equivalent of 1.0.
+
+// We used to offer multiple types of premultiplication, but now just one, PremulAsEncoded.
+// This is the premul you're probably used to working with.
+
+typedef enum skcms_AlphaFormat {
+ skcms_AlphaFormat_Opaque, // alpha is always opaque
+ // tf-1(r), tf-1(g), tf-1(b), 1.0
+ skcms_AlphaFormat_Unpremul, // alpha and color are unassociated
+ // tf-1(r), tf-1(g), tf-1(b), a
+ skcms_AlphaFormat_PremulAsEncoded, // premultiplied while encoded
+ // tf-1(r)*a, tf-1(g)*a, tf-1(b)*a, a
+} skcms_AlphaFormat;
+
+// Convert npixels pixels from src format and color profile to dst format and color profile
+// and return true, otherwise return false. It is safe to alias dst == src if dstFmt == srcFmt.
+SKCMS_API bool skcms_Transform(const void* src,
+ skcms_PixelFormat srcFmt,
+ skcms_AlphaFormat srcAlpha,
+ const skcms_ICCProfile* srcProfile,
+ void* dst,
+ skcms_PixelFormat dstFmt,
+ skcms_AlphaFormat dstAlpha,
+ const skcms_ICCProfile* dstProfile,
+ size_t npixels);
+
+// As skcms_Transform(), supporting srcFmts with a palette.
+SKCMS_API bool skcms_TransformWithPalette(const void* src,
+ skcms_PixelFormat srcFmt,
+ skcms_AlphaFormat srcAlpha,
+ const skcms_ICCProfile* srcProfile,
+ void* dst,
+ skcms_PixelFormat dstFmt,
+ skcms_AlphaFormat dstAlpha,
+ const skcms_ICCProfile* dstProfile,
+ size_t npixels,
+ const void* palette);
+
+// If profile can be used as a destination in skcms_Transform, return true. Otherwise, attempt to
+// rewrite it with approximations where reasonable. If successful, return true. If no reasonable
+// approximation exists, leave the profile unchanged and return false.
+SKCMS_API bool skcms_MakeUsableAsDestination(skcms_ICCProfile* profile);
+
+// If profile can be used as a destination with a single parametric transfer function (ie for
+// rasterization), return true. Otherwise, attempt to rewrite it with approximations where
+// reasonable. If successful, return true. If no reasonable approximation exists, leave the
+// profile unchanged and return false.
+SKCMS_API bool skcms_MakeUsableAsDestinationWithSingleCurve(skcms_ICCProfile* profile);
+
+// Returns a matrix to adapt XYZ color from given the whitepoint to D50.
+SKCMS_API bool skcms_AdaptToXYZD50(float wx, float wy,
+ skcms_Matrix3x3* toXYZD50);
+
+// Returns a matrix to convert RGB color into XYZ adapted to D50, given the
+// primaries and whitepoint of the RGB model.
+SKCMS_API bool skcms_PrimariesToXYZD50(float rx, float ry,
+ float gx, float gy,
+ float bx, float by,
+ float wx, float wy,
+ skcms_Matrix3x3* toXYZD50);
+
+// Call before your first call to skcms_Transform() to skip runtime CPU detection.
+SKCMS_API void skcms_DisableRuntimeCPUDetection(void);
+
+// Utilities for programmatically constructing profiles
+static inline void skcms_Init(skcms_ICCProfile* p) {
+ memset(p, 0, sizeof(*p));
+ p->data_color_space = skcms_Signature_RGB;
+ p->pcs = skcms_Signature_XYZ;
+}
+
+static inline void skcms_SetTransferFunction(skcms_ICCProfile* p,
+ const skcms_TransferFunction* tf) {
+ p->has_trc = true;
+ for (int i = 0; i < 3; ++i) {
+ p->trc[i].table_entries = 0;
+ p->trc[i].parametric = *tf;
+ }
+}
+
+static inline void skcms_SetXYZD50(skcms_ICCProfile* p, const skcms_Matrix3x3* m) {
+ p->has_toXYZD50 = true;
+ p->toXYZD50 = *m;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/chromium/third_party/skia/modules/skcms/skcms_internal.h b/chromium/third_party/skia/modules/skcms/skcms_internal.h
new file mode 100644
index 00000000000..cc6d578ba07
--- /dev/null
+++ b/chromium/third_party/skia/modules/skcms/skcms_internal.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2018 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#pragma once
+
+// skcms_internal.h contains APIs shared by skcms' internals and its test tools.
+// Please don't use this header from outside the skcms repo.
+
+#include "skcms.h"
+#include <stdbool.h>
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// ~~~~ General Helper Macros ~~~~
+ #define ARRAY_COUNT(arr) (int)(sizeof((arr)) / sizeof(*(arr)))
+
+ typedef struct skcms_ICCTag {
+ uint32_t signature;
+ uint32_t type;
+ uint32_t size;
+ const uint8_t* buf;
+ } skcms_ICCTag;
+
+ void skcms_GetTagByIndex (const skcms_ICCProfile*, uint32_t idx, skcms_ICCTag*);
+ bool skcms_GetTagBySignature(const skcms_ICCProfile*, uint32_t sig, skcms_ICCTag*);
+
+ float skcms_MaxRoundtripError(const skcms_Curve* curve, const skcms_TransferFunction* inv_tf);
+
+ // 252 of a random shuffle of all possible bytes.
+ // 252 is evenly divisible by 3 and 4. Only 192, 10, 241, and 43 are missing.
+ // Used for ICC profile equivalence testing.
+ extern const uint8_t skcms_252_random_bytes[252];
+
+// ~~~~ Portable Math ~~~~
+ static inline float floorf_(float x) {
+ float roundtrip = (float)((int)x);
+ return roundtrip > x ? roundtrip - 1 : roundtrip;
+ }
+ static inline float fabsf_(float x) { return x < 0 ? -x : x; }
+ float powf_(float, float);
+
+// ~~~~ Does this pixel format need a palette pointer to be usable? ~~~~
+ static inline bool needs_palette(skcms_PixelFormat fmt) {
+ return (fmt >> 1) == (skcms_PixelFormat_RGBA_8888_Palette8 >> 1);
+ }
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/chromium/third_party/skia/modules/skcms/src/Transform_inl.h b/chromium/third_party/skia/modules/skcms/src/Transform_inl.h
new file mode 100644
index 00000000000..7b8aa8ac1c5
--- /dev/null
+++ b/chromium/third_party/skia/modules/skcms/src/Transform_inl.h
@@ -0,0 +1,1609 @@
+/*
+ * Copyright 2018 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+// Intentionally NO #pragma once... included multiple times.
+
+// This file is included from skcms.cc in a namespace with some pre-defines:
+// - N: depth of all vectors, 1,4,8, or 16 (preprocessor define)
+// - V<T>: a template to create a vector of N T's.
+
+using F = V<Color>; // Called F for historic reasons... maybe rename C?
+using I32 = V<int32_t>;
+using U64 = V<uint64_t>;
+using U32 = V<uint32_t>;
+using U16 = V<uint16_t>;
+using U8 = V<uint8_t>;
+
+
+#if defined(__GNUC__) && !defined(__clang__)
+ // Once again, GCC is kind of weird, not allowing vector = scalar directly.
+ static constexpr F F0 = F() + 0.0f,
+ F1 = F() + 1.0f,
+ FInfBits = F() + 0x7f800000; // equals 2139095040, the bit pattern of +Inf
+#else
+ static constexpr F F0 = 0.0f,
+ F1 = 1.0f,
+ FInfBits = 0x7f800000; // equals 2139095040, the bit pattern of +Inf
+#endif
+
+// Instead of checking __AVX__ below, we'll check USING_AVX.
+// This lets skcms.cc set USING_AVX to force us in even if the compiler's not set that way.
+// Same deal for __F16C__ and __AVX2__ ~~~> USING_AVX_F16C, USING_AVX2.
+
+#if !defined(USING_AVX) && N == 8 && defined(__AVX__)
+ #define USING_AVX
+#endif
+#if !defined(USING_AVX_F16C) && defined(USING_AVX) && defined(__F16C__)
+ #define USING AVX_F16C
+#endif
+#if !defined(USING_AVX2) && defined(USING_AVX) && defined(__AVX2__)
+ #define USING_AVX2
+#endif
+#if !defined(USING_AVX512F) && N == 16 && defined(__AVX512F__) && defined(__AVX512DQ__)
+ #define USING_AVX512F
+#endif
+
+// Similar to the AVX+ features, we define USING_NEON and USING_NEON_F16C.
+// This is more for organizational clarity... skcms.cc doesn't force these.
+#if N > 1 && defined(__ARM_NEON)
+ #define USING_NEON
+ #if __ARM_FP & 2
+ #define USING_NEON_F16C
+ #endif
+ #if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && defined(SKCMS_OPT_INTO_NEON_FP16)
+ #define USING_NEON_FP16
+ #endif
+#endif
+
+// These -Wvector-conversion warnings seem to trigger in very bogus situations,
+// like vst3q_f32() expecting a 16x char rather than a 4x float vector. :/
+#if defined(USING_NEON) && defined(__clang__)
+ #pragma clang diagnostic ignored "-Wvector-conversion"
+#endif
+
+// GCC & Clang (but not clang-cl) warn returning U64 on x86 is larger than a register.
+// You'd see warnings like, "using AVX even though AVX is not enabled".
+// We stifle these warnings; our helpers that return U64 are always inlined.
+#if defined(__SSE__) && defined(__GNUC__)
+ #if !defined(__has_warning)
+ #pragma GCC diagnostic ignored "-Wpsabi"
+ #elif __has_warning("-Wpsabi")
+ #pragma GCC diagnostic ignored "-Wpsabi"
+ #endif
+#endif
+
+#if defined(__clang__)
+ #define FALLTHROUGH [[clang::fallthrough]]
+#else
+ #define FALLTHROUGH
+#endif
+
+// We tag most helper functions as SI, to enforce good code generation
+// but also work around what we think is a bug in GCC: when targeting 32-bit
+// x86, GCC tends to pass U16 (4x uint16_t vector) function arguments in the
+// MMX mm0 register, which seems to mess with unrelated code that later uses
+// x87 FP instructions (MMX's mm0 is an alias for x87's st0 register).
+//
+// It helps codegen to call __builtin_memcpy() when we know the byte count at compile time.
+#if defined(__clang__) || defined(__GNUC__)
+ #define SI static inline __attribute__((always_inline))
+#else
+ #define SI static inline
+#endif
+
+template <typename T, typename P>
+SI T load(const P* ptr) {
+ T val;
+ small_memcpy(&val, ptr, sizeof(val));
+ return val;
+}
+template <typename T, typename P>
+SI void store(P* ptr, const T& val) {
+ small_memcpy(ptr, &val, sizeof(val));
+}
+
+// (T)v is a cast when N == 1 and a bit-pun when N>1,
+// so we use cast<T>(v) to actually cast or bit_pun<T>(v) to bit-pun.
+template <typename D, typename S>
+SI D cast(const S& v) {
+#if N == 1
+ return (D)v;
+#elif defined(__clang__)
+ return __builtin_convertvector(v, D);
+#else
+ D d;
+ for (int i = 0; i < N; i++) {
+ d[i] = v[i];
+ }
+ return d;
+#endif
+}
+
+template <typename D, typename S>
+SI D bit_pun(const S& v) {
+ static_assert(sizeof(D) == sizeof(v), "");
+ return load<D>(&v);
+}
+
+// When we convert from float to fixed point, it's very common to want to round,
+// and for some reason compilers generate better code when converting to int32_t.
+// To serve both those ends, we use this function to_fixed() instead of direct cast().
+#if defined(USING_NEON_FP16)
+ // NEON's got a F16 -> U16 instruction, so this should be fine without going via I16.
+ SI U16 to_fixed(F f) { return cast<U16>(f + 0.5f); }
+#else
+ SI U32 to_fixed(F f) { return (U32)cast<I32>(f + 0.5f); }
+#endif
+
+
+// Sometimes we do something crazy on one branch of a conditonal,
+// like divide by zero or convert a huge float to an integer,
+// but then harmlessly select the other side. That trips up N==1
+// sanitizer builds, so we make if_then_else() a macro to avoid
+// evaluating the unused side.
+
+#if N == 1
+ #define if_then_else(cond, t, e) ((cond) ? (t) : (e))
+#else
+ template <typename C, typename T>
+ SI T if_then_else(C cond, T t, T e) {
+ return bit_pun<T>( ( cond & bit_pun<C>(t)) |
+ (~cond & bit_pun<C>(e)) );
+ }
+#endif
+
+
+SI F F_from_Half(U16 half) {
+#if defined(USING_NEON_FP16)
+ return bit_pun<F>(half);
+#elif defined(USING_NEON_F16C)
+ return vcvt_f32_f16((float16x4_t)half);
+#elif defined(USING_AVX512F)
+ return (F)_mm512_cvtph_ps((__m256i)half);
+#elif defined(USING_AVX_F16C)
+ typedef int16_t __attribute__((vector_size(16))) I16;
+ return __builtin_ia32_vcvtph2ps256((I16)half);
+#else
+ U32 wide = cast<U32>(half);
+ // A half is 1-5-10 sign-exponent-mantissa, with 15 exponent bias.
+ U32 s = wide & 0x8000,
+ em = wide ^ s;
+
+ // Constructing the float is easy if the half is not denormalized.
+ F norm = bit_pun<F>( (s<<16) + (em<<13) + ((127-15)<<23) );
+
+ // Simply flush all denorm half floats to zero.
+ return if_then_else(em < 0x0400, F0, norm);
+#endif
+}
+
+#if defined(__clang__)
+ // The -((127-15)<<10) underflows that side of the math when
+ // we pass a denorm half float. It's harmless... we'll take the 0 side anyway.
+ __attribute__((no_sanitize("unsigned-integer-overflow")))
+#endif
+SI U16 Half_from_F(F f) {
+#if defined(USING_NEON_FP16)
+ return bit_pun<U16>(f);
+#elif defined(USING_NEON_F16C)
+ return (U16)vcvt_f16_f32(f);
+#elif defined(USING_AVX512F)
+ return (U16)_mm512_cvtps_ph((__m512 )f, _MM_FROUND_CUR_DIRECTION );
+#elif defined(USING_AVX_F16C)
+ return (U16)__builtin_ia32_vcvtps2ph256(f, 0x04/*_MM_FROUND_CUR_DIRECTION*/);
+#else
+ // A float is 1-8-23 sign-exponent-mantissa, with 127 exponent bias.
+ U32 sem = bit_pun<U32>(f),
+ s = sem & 0x80000000,
+ em = sem ^ s;
+
+ // For simplicity we flush denorm half floats (including all denorm floats) to zero.
+ return cast<U16>(if_then_else(em < 0x38800000, (U32)F0
+ , (s>>16) + (em>>13) - ((127-15)<<10)));
+#endif
+}
+
+// Swap high and low bytes of 16-bit lanes, converting between big-endian and little-endian.
+#if defined(USING_NEON_FP16)
+ SI U16 swap_endian_16(U16 v) {
+ return (U16)vrev16q_u8((uint8x16_t) v);
+ }
+#elif defined(USING_NEON)
+ SI U16 swap_endian_16(U16 v) {
+ return (U16)vrev16_u8((uint8x8_t) v);
+ }
+#endif
+
+SI U64 swap_endian_16x4(const U64& rgba) {
+ return (rgba & 0x00ff00ff00ff00ff) << 8
+ | (rgba & 0xff00ff00ff00ff00) >> 8;
+}
+
+#if defined(USING_NEON_FP16)
+ SI F min_(F x, F y) { return (F)vminq_f16((float16x8_t)x, (float16x8_t)y); }
+ SI F max_(F x, F y) { return (F)vmaxq_f16((float16x8_t)x, (float16x8_t)y); }
+#elif defined(USING_NEON)
+ SI F min_(F x, F y) { return (F)vminq_f32((float32x4_t)x, (float32x4_t)y); }
+ SI F max_(F x, F y) { return (F)vmaxq_f32((float32x4_t)x, (float32x4_t)y); }
+#else
+ SI F min_(F x, F y) { return if_then_else(x > y, y, x); }
+ SI F max_(F x, F y) { return if_then_else(x < y, y, x); }
+#endif
+
+SI F floor_(F x) {
+#if N == 1
+ return floorf_(x);
+#elif defined(USING_NEON_FP16)
+ return vrndmq_f16(x);
+#elif defined(__aarch64__)
+ return vrndmq_f32(x);
+#elif defined(USING_AVX512F)
+ // Clang's _mm512_floor_ps() passes its mask as -1, not (__mmask16)-1,
+ // and integer santizer catches that this implicit cast changes the
+ // value from -1 to 65535. We'll cast manually to work around it.
+ // Read this as `return _mm512_floor_ps(x)`.
+ return _mm512_mask_floor_ps(x, (__mmask16)-1, x);
+#elif defined(USING_AVX)
+ return __builtin_ia32_roundps256(x, 0x01/*_MM_FROUND_FLOOR*/);
+#elif defined(__SSE4_1__)
+ return _mm_floor_ps(x);
+#else
+ // Round trip through integers with a truncating cast.
+ F roundtrip = cast<F>(cast<I32>(x));
+ // If x is negative, truncating gives the ceiling instead of the floor.
+ return roundtrip - if_then_else(roundtrip > x, F1, F0);
+
+ // This implementation fails for values of x that are outside
+ // the range an integer can represent. We expect most x to be small.
+#endif
+}
+
+SI F approx_log2(F x) {
+#if defined(USING_NEON_FP16)
+ // TODO(mtklein)
+ return x;
+#else
+ // The first approximation of log2(x) is its exponent 'e', minus 127.
+ I32 bits = bit_pun<I32>(x);
+
+ F e = cast<F>(bits) * (1.0f / (1<<23));
+
+ // If we use the mantissa too we can refine the error signficantly.
+ F m = bit_pun<F>( (bits & 0x007fffff) | 0x3f000000 );
+
+ return e - 124.225514990f
+ - 1.498030302f*m
+ - 1.725879990f/(0.3520887068f + m);
+#endif
+}
+
+SI F approx_log(F x) {
+ const float ln2 = 0.69314718f;
+ return ln2 * approx_log2(x);
+}
+
+SI F approx_exp2(F x) {
+#if defined(USING_NEON_FP16)
+ // TODO(mtklein)
+ return x;
+#else
+ F fract = x - floor_(x);
+
+ F fbits = (1.0f * (1<<23)) * (x + 121.274057500f
+ - 1.490129070f*fract
+ + 27.728023300f/(4.84252568f - fract));
+ I32 bits = cast<I32>(min_(max_(fbits, F0), FInfBits));
+
+ return bit_pun<F>(bits);
+#endif
+}
+
+SI F approx_pow(F x, float y) {
+ return if_then_else((x == F0) | (x == F1), x
+ , approx_exp2(approx_log2(x) * y));
+}
+
+SI F approx_exp(F x) {
+ const float log2_e = 1.4426950408889634074f;
+ return approx_exp2(log2_e * x);
+}
+
+// Return tf(x).
+SI F apply_tf(const skcms_TransferFunction* tf, F x) {
+#if defined(USING_NEON_FP16)
+ // TODO(mtklein)
+ (void)tf;
+ return x;
+#else
+ // Peel off the sign bit and set x = |x|.
+ U32 bits = bit_pun<U32>(x),
+ sign = bits & 0x80000000;
+ x = bit_pun<F>(bits ^ sign);
+
+ // The transfer function has a linear part up to d, exponential at d and after.
+ F v = if_then_else(x < tf->d, tf->c*x + tf->f
+ , approx_pow(tf->a*x + tf->b, tf->g) + tf->e);
+
+ // Tack the sign bit back on.
+ return bit_pun<F>(sign | bit_pun<U32>(v));
+#endif
+}
+
+SI F apply_pq(const skcms_TransferFunction* tf, F x) {
+#if defined(USING_NEON_FP16)
+ // TODO(mtklein)
+ (void)tf;
+ return x;
+#else
+ U32 bits = bit_pun<U32>(x),
+ sign = bits & 0x80000000;
+ x = bit_pun<F>(bits ^ sign);
+
+ F v = approx_pow(max_(tf->a + tf->b * approx_pow(x, tf->c), F0)
+ / (tf->d + tf->e * approx_pow(x, tf->c)),
+ tf->f);
+
+ return bit_pun<F>(sign | bit_pun<U32>(v));
+#endif
+}
+
+SI F apply_hlg(const skcms_TransferFunction* tf, F x) {
+#if defined(USING_NEON_FP16)
+ // TODO(mtklein)
+ (void)tf;
+ return x;
+#else
+ const float R = tf->a, G = tf->b,
+ a = tf->c, b = tf->d, c = tf->e,
+ K = tf->f + 1;
+ U32 bits = bit_pun<U32>(x),
+ sign = bits & 0x80000000;
+ x = bit_pun<F>(bits ^ sign);
+
+ F v = if_then_else(x*R <= 1, approx_pow(x*R, G)
+ , approx_exp((x-c)*a) + b);
+
+ return K*bit_pun<F>(sign | bit_pun<U32>(v));
+#endif
+}
+
+SI F apply_hlginv(const skcms_TransferFunction* tf, F x) {
+#if defined(USING_NEON_FP16)
+ // TODO(mtklein)
+ (void)tf;
+ return x;
+#else
+ const float R = tf->a, G = tf->b,
+ a = tf->c, b = tf->d, c = tf->e,
+ K = tf->f + 1;
+ U32 bits = bit_pun<U32>(x),
+ sign = bits & 0x80000000;
+ x = bit_pun<F>(bits ^ sign);
+ x /= K;
+
+ F v = if_then_else(x <= 1, R * approx_pow(x, G)
+ , a * approx_log(x - b) + c);
+
+ return bit_pun<F>(sign | bit_pun<U32>(v));
+#endif
+}
+
+
+// Strided loads and stores of N values, starting from p.
+template <typename T, typename P>
+SI T load_3(const P* p) {
+#if N == 1
+ return (T)p[0];
+#elif N == 4
+ return T{p[ 0],p[ 3],p[ 6],p[ 9]};
+#elif N == 8
+ return T{p[ 0],p[ 3],p[ 6],p[ 9], p[12],p[15],p[18],p[21]};
+#elif N == 16
+ return T{p[ 0],p[ 3],p[ 6],p[ 9], p[12],p[15],p[18],p[21],
+ p[24],p[27],p[30],p[33], p[36],p[39],p[42],p[45]};
+#endif
+}
+
+template <typename T, typename P>
+SI T load_4(const P* p) {
+#if N == 1
+ return (T)p[0];
+#elif N == 4
+ return T{p[ 0],p[ 4],p[ 8],p[12]};
+#elif N == 8
+ return T{p[ 0],p[ 4],p[ 8],p[12], p[16],p[20],p[24],p[28]};
+#elif N == 16
+ return T{p[ 0],p[ 4],p[ 8],p[12], p[16],p[20],p[24],p[28],
+ p[32],p[36],p[40],p[44], p[48],p[52],p[56],p[60]};
+#endif
+}
+
+template <typename T, typename P>
+SI void store_3(P* p, const T& v) {
+#if N == 1
+ p[0] = v;
+#elif N == 4
+ p[ 0] = v[ 0]; p[ 3] = v[ 1]; p[ 6] = v[ 2]; p[ 9] = v[ 3];
+#elif N == 8
+ p[ 0] = v[ 0]; p[ 3] = v[ 1]; p[ 6] = v[ 2]; p[ 9] = v[ 3];
+ p[12] = v[ 4]; p[15] = v[ 5]; p[18] = v[ 6]; p[21] = v[ 7];
+#elif N == 16
+ p[ 0] = v[ 0]; p[ 3] = v[ 1]; p[ 6] = v[ 2]; p[ 9] = v[ 3];
+ p[12] = v[ 4]; p[15] = v[ 5]; p[18] = v[ 6]; p[21] = v[ 7];
+ p[24] = v[ 8]; p[27] = v[ 9]; p[30] = v[10]; p[33] = v[11];
+ p[36] = v[12]; p[39] = v[13]; p[42] = v[14]; p[45] = v[15];
+#endif
+}
+
+template <typename T, typename P>
+SI void store_4(P* p, const T& v) {
+#if N == 1
+ p[0] = v;
+#elif N == 4
+ p[ 0] = v[ 0]; p[ 4] = v[ 1]; p[ 8] = v[ 2]; p[12] = v[ 3];
+#elif N == 8
+ p[ 0] = v[ 0]; p[ 4] = v[ 1]; p[ 8] = v[ 2]; p[12] = v[ 3];
+ p[16] = v[ 4]; p[20] = v[ 5]; p[24] = v[ 6]; p[28] = v[ 7];
+#elif N == 16
+ p[ 0] = v[ 0]; p[ 4] = v[ 1]; p[ 8] = v[ 2]; p[12] = v[ 3];
+ p[16] = v[ 4]; p[20] = v[ 5]; p[24] = v[ 6]; p[28] = v[ 7];
+ p[32] = v[ 8]; p[36] = v[ 9]; p[40] = v[10]; p[44] = v[11];
+ p[48] = v[12]; p[52] = v[13]; p[56] = v[14]; p[60] = v[15];
+#endif
+}
+
+
+SI U8 gather_8(const uint8_t* p, I32 ix) {
+#if N == 1
+ U8 v = p[ix];
+#elif N == 4
+ U8 v = { p[ix[0]], p[ix[1]], p[ix[2]], p[ix[3]] };
+#elif N == 8
+ U8 v = { p[ix[0]], p[ix[1]], p[ix[2]], p[ix[3]],
+ p[ix[4]], p[ix[5]], p[ix[6]], p[ix[7]] };
+#elif N == 16
+ U8 v = { p[ix[ 0]], p[ix[ 1]], p[ix[ 2]], p[ix[ 3]],
+ p[ix[ 4]], p[ix[ 5]], p[ix[ 6]], p[ix[ 7]],
+ p[ix[ 8]], p[ix[ 9]], p[ix[10]], p[ix[11]],
+ p[ix[12]], p[ix[13]], p[ix[14]], p[ix[15]] };
+#endif
+ return v;
+}
+
+SI U16 gather_16(const uint8_t* p, I32 ix) {
+ // Load the i'th 16-bit value from p.
+ auto load_16 = [p](int i) {
+ return load<uint16_t>(p + 2*i);
+ };
+#if N == 1
+ U16 v = load_16(ix);
+#elif N == 4
+ U16 v = { load_16(ix[0]), load_16(ix[1]), load_16(ix[2]), load_16(ix[3]) };
+#elif N == 8
+ U16 v = { load_16(ix[0]), load_16(ix[1]), load_16(ix[2]), load_16(ix[3]),
+ load_16(ix[4]), load_16(ix[5]), load_16(ix[6]), load_16(ix[7]) };
+#elif N == 16
+ U16 v = { load_16(ix[ 0]), load_16(ix[ 1]), load_16(ix[ 2]), load_16(ix[ 3]),
+ load_16(ix[ 4]), load_16(ix[ 5]), load_16(ix[ 6]), load_16(ix[ 7]),
+ load_16(ix[ 8]), load_16(ix[ 9]), load_16(ix[10]), load_16(ix[11]),
+ load_16(ix[12]), load_16(ix[13]), load_16(ix[14]), load_16(ix[15]) };
+#endif
+ return v;
+}
+
+SI U32 gather_32(const uint8_t* p, I32 ix) {
+ // Load the i'th 32-bit value from p.
+ auto load_32 = [p](int i) {
+ return load<uint32_t>(p + 4*i);
+ };
+#if N == 1
+ U32 v = load_32(ix);
+#elif N == 4
+ U32 v = { load_32(ix[0]), load_32(ix[1]), load_32(ix[2]), load_32(ix[3]) };
+#elif N == 8
+ U32 v = { load_32(ix[0]), load_32(ix[1]), load_32(ix[2]), load_32(ix[3]),
+ load_32(ix[4]), load_32(ix[5]), load_32(ix[6]), load_32(ix[7]) };
+#elif N == 16
+ U32 v = { load_32(ix[ 0]), load_32(ix[ 1]), load_32(ix[ 2]), load_32(ix[ 3]),
+ load_32(ix[ 4]), load_32(ix[ 5]), load_32(ix[ 6]), load_32(ix[ 7]),
+ load_32(ix[ 8]), load_32(ix[ 9]), load_32(ix[10]), load_32(ix[11]),
+ load_32(ix[12]), load_32(ix[13]), load_32(ix[14]), load_32(ix[15]) };
+#endif
+ // TODO: AVX2 and AVX-512 gathers (c.f. gather_24).
+ return v;
+}
+
+SI U32 gather_24(const uint8_t* p, I32 ix) {
+ // First, back up a byte. Any place we're gathering from has a safe junk byte to read
+ // in front of it, either a previous table value, or some tag metadata.
+ p -= 1;
+
+ // Load the i'th 24-bit value from p, and 1 extra byte.
+ auto load_24_32 = [p](int i) {
+ return load<uint32_t>(p + 3*i);
+ };
+
+ // Now load multiples of 4 bytes (a junk byte, then r,g,b).
+#if N == 1
+ U32 v = load_24_32(ix);
+#elif N == 4
+ U32 v = { load_24_32(ix[0]), load_24_32(ix[1]), load_24_32(ix[2]), load_24_32(ix[3]) };
+#elif N == 8 && !defined(USING_AVX2)
+ U32 v = { load_24_32(ix[0]), load_24_32(ix[1]), load_24_32(ix[2]), load_24_32(ix[3]),
+ load_24_32(ix[4]), load_24_32(ix[5]), load_24_32(ix[6]), load_24_32(ix[7]) };
+#elif N == 8
+ (void)load_24_32;
+ // The gather instruction here doesn't need any particular alignment,
+ // but the intrinsic takes a const int*.
+ const int* p4 = bit_pun<const int*>(p);
+ I32 zero = { 0, 0, 0, 0, 0, 0, 0, 0},
+ mask = {-1,-1,-1,-1, -1,-1,-1,-1};
+ #if defined(__clang__)
+ U32 v = (U32)__builtin_ia32_gatherd_d256(zero, p4, 3*ix, mask, 1);
+ #elif defined(__GNUC__)
+ U32 v = (U32)__builtin_ia32_gathersiv8si(zero, p4, 3*ix, mask, 1);
+ #endif
+#elif N == 16
+ (void)load_24_32;
+ // The intrinsic is supposed to take const void* now, but it takes const int*, just like AVX2.
+ // And AVX-512 swapped the order of arguments. :/
+ const int* p4 = bit_pun<const int*>(p);
+ U32 v = (U32)_mm512_i32gather_epi32((__m512i)(3*ix), p4, 1);
+#endif
+
+ // Shift off the junk byte, leaving r,g,b in low 24 bits (and zero in the top 8).
+ return v >> 8;
+}
+
+#if !defined(__arm__)
+ SI void gather_48(const uint8_t* p, I32 ix, U64* v) {
+ // As in gather_24(), with everything doubled.
+ p -= 2;
+
+ // Load the i'th 48-bit value from p, and 2 extra bytes.
+ auto load_48_64 = [p](int i) {
+ return load<uint64_t>(p + 6*i);
+ };
+
+ #if N == 1
+ *v = load_48_64(ix);
+ #elif N == 4
+ *v = U64{
+ load_48_64(ix[0]), load_48_64(ix[1]), load_48_64(ix[2]), load_48_64(ix[3]),
+ };
+ #elif N == 8 && !defined(USING_AVX2)
+ *v = U64{
+ load_48_64(ix[0]), load_48_64(ix[1]), load_48_64(ix[2]), load_48_64(ix[3]),
+ load_48_64(ix[4]), load_48_64(ix[5]), load_48_64(ix[6]), load_48_64(ix[7]),
+ };
+ #elif N == 8
+ (void)load_48_64;
+ typedef int32_t __attribute__((vector_size(16))) Half_I32;
+ typedef long long __attribute__((vector_size(32))) Half_I64;
+
+ // The gather instruction here doesn't need any particular alignment,
+ // but the intrinsic takes a const long long*.
+ const long long int* p8 = bit_pun<const long long int*>(p);
+
+ Half_I64 zero = { 0, 0, 0, 0},
+ mask = {-1,-1,-1,-1};
+
+ ix *= 6;
+ Half_I32 ix_lo = { ix[0], ix[1], ix[2], ix[3] },
+ ix_hi = { ix[4], ix[5], ix[6], ix[7] };
+
+ #if defined(__clang__)
+ Half_I64 lo = (Half_I64)__builtin_ia32_gatherd_q256(zero, p8, ix_lo, mask, 1),
+ hi = (Half_I64)__builtin_ia32_gatherd_q256(zero, p8, ix_hi, mask, 1);
+ #elif defined(__GNUC__)
+ Half_I64 lo = (Half_I64)__builtin_ia32_gathersiv4di(zero, p8, ix_lo, mask, 1),
+ hi = (Half_I64)__builtin_ia32_gathersiv4di(zero, p8, ix_hi, mask, 1);
+ #endif
+ store((char*)v + 0, lo);
+ store((char*)v + 32, hi);
+ #elif N == 16
+ (void)load_48_64;
+ const long long int* p8 = bit_pun<const long long int*>(p);
+ __m512i lo = _mm512_i32gather_epi64(_mm512_extracti32x8_epi32((__m512i)(6*ix), 0), p8, 1),
+ hi = _mm512_i32gather_epi64(_mm512_extracti32x8_epi32((__m512i)(6*ix), 1), p8, 1);
+ store((char*)v + 0, lo);
+ store((char*)v + 64, hi);
+ #endif
+
+ *v >>= 16;
+ }
+#endif
+
+SI F F_from_U8(U8 v) {
+ return cast<F>(v) * (1/255.0f);
+}
+
+SI F F_from_U16_BE(U16 v) {
+ // All 16-bit ICC values are big-endian, so we byte swap before converting to float.
+ // MSVC catches the "loss" of data here in the portable path, so we also make sure to mask.
+ U16 lo = (v >> 8),
+ hi = (v << 8) & 0xffff;
+ return cast<F>(lo|hi) * (1/65535.0f);
+}
+
+SI U16 U16_from_F(F v) {
+ // 65535 == inf in FP16, so promote to FP32 before converting.
+ return cast<U16>(cast<V<float>>(v) * 65535 + 0.5f);
+}
+
+SI F minus_1_ulp(F v) {
+#if defined(USING_NEON_FP16)
+ return bit_pun<F>( bit_pun<U16>(v) - 1 );
+#else
+ return bit_pun<F>( bit_pun<U32>(v) - 1 );
+#endif
+}
+
+SI F table(const skcms_Curve* curve, F v) {
+ // Clamp the input to [0,1], then scale to a table index.
+ F ix = max_(F0, min_(v, F1)) * (float)(curve->table_entries - 1);
+
+ // We'll look up (equal or adjacent) entries at lo and hi, then lerp by t between the two.
+ I32 lo = cast<I32>( ix ),
+ hi = cast<I32>(minus_1_ulp(ix+1.0f));
+ F t = ix - cast<F>(lo); // i.e. the fractional part of ix.
+
+ // TODO: can we load l and h simultaneously? Each entry in 'h' is either
+ // the same as in 'l' or adjacent. We have a rough idea that's it'd always be safe
+ // to read adjacent entries and perhaps underflow the table by a byte or two
+ // (it'd be junk, but always safe to read). Not sure how to lerp yet.
+ F l,h;
+ if (curve->table_8) {
+ l = F_from_U8(gather_8(curve->table_8, lo));
+ h = F_from_U8(gather_8(curve->table_8, hi));
+ } else {
+ l = F_from_U16_BE(gather_16(curve->table_16, lo));
+ h = F_from_U16_BE(gather_16(curve->table_16, hi));
+ }
+ return l + (h-l)*t;
+}
+
+SI void sample_clut_8(const uint8_t* grid_8, I32 ix, F* r, F* g, F* b) {
+ U32 rgb = gather_24(grid_8, ix);
+
+ *r = cast<F>((rgb >> 0) & 0xff) * (1/255.0f);
+ *g = cast<F>((rgb >> 8) & 0xff) * (1/255.0f);
+ *b = cast<F>((rgb >> 16) & 0xff) * (1/255.0f);
+}
+
+SI void sample_clut_8(const uint8_t* grid_8, I32 ix, F* r, F* g, F* b, F* a) {
+ // TODO: don't forget to optimize gather_32().
+ U32 rgba = gather_32(grid_8, ix);
+
+ *r = cast<F>((rgba >> 0) & 0xff) * (1/255.0f);
+ *g = cast<F>((rgba >> 8) & 0xff) * (1/255.0f);
+ *b = cast<F>((rgba >> 16) & 0xff) * (1/255.0f);
+ *a = cast<F>((rgba >> 24) & 0xff) * (1/255.0f);
+}
+
+SI void sample_clut_16(const uint8_t* grid_16, I32 ix, F* r, F* g, F* b) {
+#if defined(__arm__)
+ // This is up to 2x faster on 32-bit ARM than the #else-case fast path.
+ *r = F_from_U16_BE(gather_16(grid_16, 3*ix+0));
+ *g = F_from_U16_BE(gather_16(grid_16, 3*ix+1));
+ *b = F_from_U16_BE(gather_16(grid_16, 3*ix+2));
+#else
+ // This strategy is much faster for 64-bit builds, and fine for 32-bit x86 too.
+ U64 rgb;
+ gather_48(grid_16, ix, &rgb);
+ rgb = swap_endian_16x4(rgb);
+
+ *r = cast<F>((rgb >> 0) & 0xffff) * (1/65535.0f);
+ *g = cast<F>((rgb >> 16) & 0xffff) * (1/65535.0f);
+ *b = cast<F>((rgb >> 32) & 0xffff) * (1/65535.0f);
+#endif
+}
+
+SI void sample_clut_16(const uint8_t* grid_16, I32 ix, F* r, F* g, F* b, F* a) {
+ // TODO: gather_64()-based fast path?
+ *r = F_from_U16_BE(gather_16(grid_16, 4*ix+0));
+ *g = F_from_U16_BE(gather_16(grid_16, 4*ix+1));
+ *b = F_from_U16_BE(gather_16(grid_16, 4*ix+2));
+ *a = F_from_U16_BE(gather_16(grid_16, 4*ix+3));
+}
+
+static void clut(uint32_t input_channels, uint32_t output_channels,
+ const uint8_t grid_points[4], const uint8_t* grid_8, const uint8_t* grid_16,
+ F* r, F* g, F* b, F* a) {
+
+ const int dim = (int)input_channels;
+ assert (0 < dim && dim <= 4);
+ assert (output_channels == 3 ||
+ output_channels == 4);
+
+ // For each of these arrays, think foo[2*dim], but we use foo[8] since we know dim <= 4.
+ I32 index [8]; // Index contribution by dimension, first low from 0, then high from 4.
+ F weight[8]; // Weight for each contribution, again first low, then high.
+
+ // O(dim) work first: calculate index,weight from r,g,b,a.
+ const F inputs[] = { *r,*g,*b,*a };
+ for (int i = dim-1, stride = 1; i >= 0; i--) {
+ // x is where we logically want to sample the grid in the i-th dimension.
+ F x = inputs[i] * (float)(grid_points[i] - 1);
+
+ // But we can't index at floats. lo and hi are the two integer grid points surrounding x.
+ I32 lo = cast<I32>( x ), // i.e. trunc(x) == floor(x) here.
+ hi = cast<I32>(minus_1_ulp(x+1.0f));
+ // Notice how we fold in the accumulated stride across previous dimensions here.
+ index[i+0] = lo * stride;
+ index[i+4] = hi * stride;
+ stride *= grid_points[i];
+
+ // We'll interpolate between those two integer grid points by t.
+ F t = x - cast<F>(lo); // i.e. fract(x)
+ weight[i+0] = 1-t;
+ weight[i+4] = t;
+ }
+
+ *r = *g = *b = F0;
+ if (output_channels == 4) {
+ *a = F0;
+ }
+
+ // We'll sample 2^dim == 1<<dim table entries per pixel,
+ // in all combinations of low and high in each dimension.
+ for (int combo = 0; combo < (1<<dim); combo++) { // This loop can be done in any order.
+
+ // Each of these upcoming (combo&N)*K expressions here evaluates to 0 or 4,
+ // where 0 selects the low index contribution and its weight 1-t,
+ // or 4 the high index contribution and its weight t.
+
+ // Since 0<dim≤4, we can always just start off with the 0-th channel,
+ // then handle the others conditionally.
+ I32 ix = index [0 + (combo&1)*4];
+ F w = weight[0 + (combo&1)*4];
+
+ switch ((dim-1)&3) { // This lets the compiler know there are no other cases to handle.
+ case 3: ix += index [3 + (combo&8)/2];
+ w *= weight[3 + (combo&8)/2];
+ FALLTHROUGH;
+ // fall through
+
+ case 2: ix += index [2 + (combo&4)*1];
+ w *= weight[2 + (combo&4)*1];
+ FALLTHROUGH;
+ // fall through
+
+ case 1: ix += index [1 + (combo&2)*2];
+ w *= weight[1 + (combo&2)*2];
+ }
+
+ F R,G,B,A=F0;
+ if (output_channels == 3) {
+ if (grid_8) { sample_clut_8 (grid_8 ,ix, &R,&G,&B); }
+ else { sample_clut_16(grid_16,ix, &R,&G,&B); }
+ } else {
+ if (grid_8) { sample_clut_8 (grid_8 ,ix, &R,&G,&B,&A); }
+ else { sample_clut_16(grid_16,ix, &R,&G,&B,&A); }
+ }
+ *r += w*R;
+ *g += w*G;
+ *b += w*B;
+ *a += w*A;
+ }
+}
+
+static void clut(const skcms_A2B* a2b, F* r, F* g, F* b, F a) {
+ clut(a2b->input_channels, a2b->output_channels,
+ a2b->grid_points, a2b->grid_8, a2b->grid_16,
+ r,g,b,&a);
+}
+static void clut(const skcms_B2A* b2a, F* r, F* g, F* b, F* a) {
+ clut(b2a->input_channels, b2a->output_channels,
+ b2a->grid_points, b2a->grid_8, b2a->grid_16,
+ r,g,b,a);
+}
+
+static void exec_ops(const Op* ops, const void** args,
+ const char* src, char* dst, int i) {
+ F r = F0, g = F0, b = F0, a = F1;
+ while (true) {
+ switch (*ops++) {
+ case Op_load_a8:{
+ a = F_from_U8(load<U8>(src + 1*i));
+ } break;
+
+ case Op_load_g8:{
+ r = g = b = F_from_U8(load<U8>(src + 1*i));
+ } break;
+
+ case Op_load_4444:{
+ U16 abgr = load<U16>(src + 2*i);
+
+ r = cast<F>((abgr >> 12) & 0xf) * (1/15.0f);
+ g = cast<F>((abgr >> 8) & 0xf) * (1/15.0f);
+ b = cast<F>((abgr >> 4) & 0xf) * (1/15.0f);
+ a = cast<F>((abgr >> 0) & 0xf) * (1/15.0f);
+ } break;
+
+ case Op_load_565:{
+ U16 rgb = load<U16>(src + 2*i);
+
+ r = cast<F>(rgb & (uint16_t)(31<< 0)) * (1.0f / (31<< 0));
+ g = cast<F>(rgb & (uint16_t)(63<< 5)) * (1.0f / (63<< 5));
+ b = cast<F>(rgb & (uint16_t)(31<<11)) * (1.0f / (31<<11));
+ } break;
+
+ case Op_load_888:{
+ const uint8_t* rgb = (const uint8_t*)(src + 3*i);
+ #if defined(USING_NEON_FP16)
+ // See the explanation under USING_NEON below. This is that doubled up.
+ uint8x16x3_t v = {{ vdupq_n_u8(0), vdupq_n_u8(0), vdupq_n_u8(0) }};
+ v = vld3q_lane_u8(rgb+ 0, v, 0);
+ v = vld3q_lane_u8(rgb+ 3, v, 2);
+ v = vld3q_lane_u8(rgb+ 6, v, 4);
+ v = vld3q_lane_u8(rgb+ 9, v, 6);
+
+ v = vld3q_lane_u8(rgb+12, v, 8);
+ v = vld3q_lane_u8(rgb+15, v, 10);
+ v = vld3q_lane_u8(rgb+18, v, 12);
+ v = vld3q_lane_u8(rgb+21, v, 14);
+
+ r = cast<F>((U16)v.val[0]) * (1/255.0f);
+ g = cast<F>((U16)v.val[1]) * (1/255.0f);
+ b = cast<F>((U16)v.val[2]) * (1/255.0f);
+ #elif defined(USING_NEON)
+ // There's no uint8x4x3_t or vld3 load for it, so we'll load each rgb pixel one at
+ // a time. Since we're doing that, we might as well load them into 16-bit lanes.
+ // (We'd even load into 32-bit lanes, but that's not possible on ARMv7.)
+ uint8x8x3_t v = {{ vdup_n_u8(0), vdup_n_u8(0), vdup_n_u8(0) }};
+ v = vld3_lane_u8(rgb+0, v, 0);
+ v = vld3_lane_u8(rgb+3, v, 2);
+ v = vld3_lane_u8(rgb+6, v, 4);
+ v = vld3_lane_u8(rgb+9, v, 6);
+
+ // Now if we squint, those 3 uint8x8_t we constructed are really U16s, easy to
+ // convert to F. (Again, U32 would be even better here if drop ARMv7 or split
+ // ARMv7 and ARMv8 impls.)
+ r = cast<F>((U16)v.val[0]) * (1/255.0f);
+ g = cast<F>((U16)v.val[1]) * (1/255.0f);
+ b = cast<F>((U16)v.val[2]) * (1/255.0f);
+ #else
+ r = cast<F>(load_3<U32>(rgb+0) ) * (1/255.0f);
+ g = cast<F>(load_3<U32>(rgb+1) ) * (1/255.0f);
+ b = cast<F>(load_3<U32>(rgb+2) ) * (1/255.0f);
+ #endif
+ } break;
+
+ case Op_load_8888:{
+ U32 rgba = load<U32>(src + 4*i);
+
+ r = cast<F>((rgba >> 0) & 0xff) * (1/255.0f);
+ g = cast<F>((rgba >> 8) & 0xff) * (1/255.0f);
+ b = cast<F>((rgba >> 16) & 0xff) * (1/255.0f);
+ a = cast<F>((rgba >> 24) & 0xff) * (1/255.0f);
+ } break;
+
+ case Op_load_8888_palette8:{
+ const uint8_t* palette = (const uint8_t*) *args++;
+ I32 ix = cast<I32>(load<U8>(src + 1*i));
+ U32 rgba = gather_32(palette, ix);
+
+ r = cast<F>((rgba >> 0) & 0xff) * (1/255.0f);
+ g = cast<F>((rgba >> 8) & 0xff) * (1/255.0f);
+ b = cast<F>((rgba >> 16) & 0xff) * (1/255.0f);
+ a = cast<F>((rgba >> 24) & 0xff) * (1/255.0f);
+ } break;
+
+ case Op_load_1010102:{
+ U32 rgba = load<U32>(src + 4*i);
+
+ r = cast<F>((rgba >> 0) & 0x3ff) * (1/1023.0f);
+ g = cast<F>((rgba >> 10) & 0x3ff) * (1/1023.0f);
+ b = cast<F>((rgba >> 20) & 0x3ff) * (1/1023.0f);
+ a = cast<F>((rgba >> 30) & 0x3 ) * (1/ 3.0f);
+ } break;
+
+ case Op_load_161616LE:{
+ uintptr_t ptr = (uintptr_t)(src + 6*i);
+ assert( (ptr & 1) == 0 ); // src must be 2-byte aligned for this
+ const uint16_t* rgb = (const uint16_t*)ptr; // cast to const uint16_t* to be safe.
+ #if defined(USING_NEON_FP16)
+ uint16x8x3_t v = vld3q_u16(rgb);
+ r = cast<F>((U16)v.val[0]) * (1/65535.0f);
+ g = cast<F>((U16)v.val[1]) * (1/65535.0f);
+ b = cast<F>((U16)v.val[2]) * (1/65535.0f);
+ #elif defined(USING_NEON)
+ uint16x4x3_t v = vld3_u16(rgb);
+ r = cast<F>((U16)v.val[0]) * (1/65535.0f);
+ g = cast<F>((U16)v.val[1]) * (1/65535.0f);
+ b = cast<F>((U16)v.val[2]) * (1/65535.0f);
+ #else
+ r = cast<F>(load_3<U32>(rgb+0)) * (1/65535.0f);
+ g = cast<F>(load_3<U32>(rgb+1)) * (1/65535.0f);
+ b = cast<F>(load_3<U32>(rgb+2)) * (1/65535.0f);
+ #endif
+ } break;
+
+ case Op_load_16161616LE:{
+ uintptr_t ptr = (uintptr_t)(src + 8*i);
+ assert( (ptr & 1) == 0 ); // src must be 2-byte aligned for this
+ const uint16_t* rgba = (const uint16_t*)ptr; // cast to const uint16_t* to be safe.
+ #if defined(USING_NEON_FP16)
+ uint16x8x4_t v = vld4q_u16(rgba);
+ r = cast<F>((U16)v.val[0]) * (1/65535.0f);
+ g = cast<F>((U16)v.val[1]) * (1/65535.0f);
+ b = cast<F>((U16)v.val[2]) * (1/65535.0f);
+ a = cast<F>((U16)v.val[3]) * (1/65535.0f);
+ #elif defined(USING_NEON)
+ uint16x4x4_t v = vld4_u16(rgba);
+ r = cast<F>((U16)v.val[0]) * (1/65535.0f);
+ g = cast<F>((U16)v.val[1]) * (1/65535.0f);
+ b = cast<F>((U16)v.val[2]) * (1/65535.0f);
+ a = cast<F>((U16)v.val[3]) * (1/65535.0f);
+ #else
+ U64 px = load<U64>(rgba);
+
+ r = cast<F>((px >> 0) & 0xffff) * (1/65535.0f);
+ g = cast<F>((px >> 16) & 0xffff) * (1/65535.0f);
+ b = cast<F>((px >> 32) & 0xffff) * (1/65535.0f);
+ a = cast<F>((px >> 48) & 0xffff) * (1/65535.0f);
+ #endif
+ } break;
+
+ case Op_load_161616BE:{
+ uintptr_t ptr = (uintptr_t)(src + 6*i);
+ assert( (ptr & 1) == 0 ); // src must be 2-byte aligned for this
+ const uint16_t* rgb = (const uint16_t*)ptr; // cast to const uint16_t* to be safe.
+ #if defined(USING_NEON_FP16)
+ uint16x8x3_t v = vld3q_u16(rgb);
+ r = cast<F>(swap_endian_16((U16)v.val[0])) * (1/65535.0f);
+ g = cast<F>(swap_endian_16((U16)v.val[1])) * (1/65535.0f);
+ b = cast<F>(swap_endian_16((U16)v.val[2])) * (1/65535.0f);
+ #elif defined(USING_NEON)
+ uint16x4x3_t v = vld3_u16(rgb);
+ r = cast<F>(swap_endian_16((U16)v.val[0])) * (1/65535.0f);
+ g = cast<F>(swap_endian_16((U16)v.val[1])) * (1/65535.0f);
+ b = cast<F>(swap_endian_16((U16)v.val[2])) * (1/65535.0f);
+ #else
+ U32 R = load_3<U32>(rgb+0),
+ G = load_3<U32>(rgb+1),
+ B = load_3<U32>(rgb+2);
+ // R,G,B are big-endian 16-bit, so byte swap them before converting to float.
+ r = cast<F>((R & 0x00ff)<<8 | (R & 0xff00)>>8) * (1/65535.0f);
+ g = cast<F>((G & 0x00ff)<<8 | (G & 0xff00)>>8) * (1/65535.0f);
+ b = cast<F>((B & 0x00ff)<<8 | (B & 0xff00)>>8) * (1/65535.0f);
+ #endif
+ } break;
+
+ case Op_load_16161616BE:{
+ uintptr_t ptr = (uintptr_t)(src + 8*i);
+ assert( (ptr & 1) == 0 ); // src must be 2-byte aligned for this
+ const uint16_t* rgba = (const uint16_t*)ptr; // cast to const uint16_t* to be safe.
+ #if defined(USING_NEON_FP16)
+ uint16x8x4_t v = vld4q_u16(rgba);
+ r = cast<F>(swap_endian_16((U16)v.val[0])) * (1/65535.0f);
+ g = cast<F>(swap_endian_16((U16)v.val[1])) * (1/65535.0f);
+ b = cast<F>(swap_endian_16((U16)v.val[2])) * (1/65535.0f);
+ a = cast<F>(swap_endian_16((U16)v.val[3])) * (1/65535.0f);
+ #elif defined(USING_NEON)
+ uint16x4x4_t v = vld4_u16(rgba);
+ r = cast<F>(swap_endian_16((U16)v.val[0])) * (1/65535.0f);
+ g = cast<F>(swap_endian_16((U16)v.val[1])) * (1/65535.0f);
+ b = cast<F>(swap_endian_16((U16)v.val[2])) * (1/65535.0f);
+ a = cast<F>(swap_endian_16((U16)v.val[3])) * (1/65535.0f);
+ #else
+ U64 px = swap_endian_16x4(load<U64>(rgba));
+
+ r = cast<F>((px >> 0) & 0xffff) * (1/65535.0f);
+ g = cast<F>((px >> 16) & 0xffff) * (1/65535.0f);
+ b = cast<F>((px >> 32) & 0xffff) * (1/65535.0f);
+ a = cast<F>((px >> 48) & 0xffff) * (1/65535.0f);
+ #endif
+ } break;
+
+ case Op_load_hhh:{
+ uintptr_t ptr = (uintptr_t)(src + 6*i);
+ assert( (ptr & 1) == 0 ); // src must be 2-byte aligned for this
+ const uint16_t* rgb = (const uint16_t*)ptr; // cast to const uint16_t* to be safe.
+ #if defined(USING_NEON_FP16)
+ uint16x8x3_t v = vld3q_u16(rgb);
+ U16 R = (U16)v.val[0],
+ G = (U16)v.val[1],
+ B = (U16)v.val[2];
+ #elif defined(USING_NEON)
+ uint16x4x3_t v = vld3_u16(rgb);
+ U16 R = (U16)v.val[0],
+ G = (U16)v.val[1],
+ B = (U16)v.val[2];
+ #else
+ U16 R = load_3<U16>(rgb+0),
+ G = load_3<U16>(rgb+1),
+ B = load_3<U16>(rgb+2);
+ #endif
+ r = F_from_Half(R);
+ g = F_from_Half(G);
+ b = F_from_Half(B);
+ } break;
+
+ case Op_load_hhhh:{
+ uintptr_t ptr = (uintptr_t)(src + 8*i);
+ assert( (ptr & 1) == 0 ); // src must be 2-byte aligned for this
+ const uint16_t* rgba = (const uint16_t*)ptr; // cast to const uint16_t* to be safe.
+ #if defined(USING_NEON_FP16)
+ uint16x8x4_t v = vld4q_u16(rgba);
+ U16 R = (U16)v.val[0],
+ G = (U16)v.val[1],
+ B = (U16)v.val[2],
+ A = (U16)v.val[3];
+ #elif defined(USING_NEON)
+ uint16x4x4_t v = vld4_u16(rgba);
+ U16 R = (U16)v.val[0],
+ G = (U16)v.val[1],
+ B = (U16)v.val[2],
+ A = (U16)v.val[3];
+ #else
+ U64 px = load<U64>(rgba);
+ U16 R = cast<U16>((px >> 0) & 0xffff),
+ G = cast<U16>((px >> 16) & 0xffff),
+ B = cast<U16>((px >> 32) & 0xffff),
+ A = cast<U16>((px >> 48) & 0xffff);
+ #endif
+ r = F_from_Half(R);
+ g = F_from_Half(G);
+ b = F_from_Half(B);
+ a = F_from_Half(A);
+ } break;
+
+ case Op_load_fff:{
+ uintptr_t ptr = (uintptr_t)(src + 12*i);
+ assert( (ptr & 3) == 0 ); // src must be 4-byte aligned for this
+ const float* rgb = (const float*)ptr; // cast to const float* to be safe.
+ #if defined(USING_NEON_FP16)
+ float32x4x3_t lo = vld3q_f32(rgb + 0),
+ hi = vld3q_f32(rgb + 12);
+ r = (F)vcombine_f16(vcvt_f16_f32(lo.val[0]), vcvt_f16_f32(hi.val[0]));
+ g = (F)vcombine_f16(vcvt_f16_f32(lo.val[1]), vcvt_f16_f32(hi.val[1]));
+ b = (F)vcombine_f16(vcvt_f16_f32(lo.val[2]), vcvt_f16_f32(hi.val[2]));
+ #elif defined(USING_NEON)
+ float32x4x3_t v = vld3q_f32(rgb);
+ r = (F)v.val[0];
+ g = (F)v.val[1];
+ b = (F)v.val[2];
+ #else
+ r = load_3<F>(rgb+0);
+ g = load_3<F>(rgb+1);
+ b = load_3<F>(rgb+2);
+ #endif
+ } break;
+
+ case Op_load_ffff:{
+ uintptr_t ptr = (uintptr_t)(src + 16*i);
+ assert( (ptr & 3) == 0 ); // src must be 4-byte aligned for this
+ const float* rgba = (const float*)ptr; // cast to const float* to be safe.
+ #if defined(USING_NEON_FP16)
+ float32x4x4_t lo = vld4q_f32(rgba + 0),
+ hi = vld4q_f32(rgba + 16);
+ r = (F)vcombine_f16(vcvt_f16_f32(lo.val[0]), vcvt_f16_f32(hi.val[0]));
+ g = (F)vcombine_f16(vcvt_f16_f32(lo.val[1]), vcvt_f16_f32(hi.val[1]));
+ b = (F)vcombine_f16(vcvt_f16_f32(lo.val[2]), vcvt_f16_f32(hi.val[2]));
+ a = (F)vcombine_f16(vcvt_f16_f32(lo.val[3]), vcvt_f16_f32(hi.val[3]));
+ #elif defined(USING_NEON)
+ float32x4x4_t v = vld4q_f32(rgba);
+ r = (F)v.val[0];
+ g = (F)v.val[1];
+ b = (F)v.val[2];
+ a = (F)v.val[3];
+ #else
+ r = load_4<F>(rgba+0);
+ g = load_4<F>(rgba+1);
+ b = load_4<F>(rgba+2);
+ a = load_4<F>(rgba+3);
+ #endif
+ } break;
+
+ case Op_swap_rb:{
+ F t = r;
+ r = b;
+ b = t;
+ } break;
+
+ case Op_clamp:{
+ r = max_(F0, min_(r, F1));
+ g = max_(F0, min_(g, F1));
+ b = max_(F0, min_(b, F1));
+ a = max_(F0, min_(a, F1));
+ } break;
+
+ case Op_invert:{
+ r = F1 - r;
+ g = F1 - g;
+ b = F1 - b;
+ a = F1 - a;
+ } break;
+
+ case Op_force_opaque:{
+ a = F1;
+ } break;
+
+ case Op_premul:{
+ r *= a;
+ g *= a;
+ b *= a;
+ } break;
+
+ case Op_unpremul:{
+ F scale = if_then_else(F1 / a < INFINITY_, F1 / a, F0);
+ r *= scale;
+ g *= scale;
+ b *= scale;
+ } break;
+
+ case Op_matrix_3x3:{
+ const skcms_Matrix3x3* matrix = (const skcms_Matrix3x3*) *args++;
+ const float* m = &matrix->vals[0][0];
+
+ F R = m[0]*r + m[1]*g + m[2]*b,
+ G = m[3]*r + m[4]*g + m[5]*b,
+ B = m[6]*r + m[7]*g + m[8]*b;
+
+ r = R;
+ g = G;
+ b = B;
+ } break;
+
+ case Op_matrix_3x4:{
+ const skcms_Matrix3x4* matrix = (const skcms_Matrix3x4*) *args++;
+ const float* m = &matrix->vals[0][0];
+
+ F R = m[0]*r + m[1]*g + m[ 2]*b + m[ 3],
+ G = m[4]*r + m[5]*g + m[ 6]*b + m[ 7],
+ B = m[8]*r + m[9]*g + m[10]*b + m[11];
+
+ r = R;
+ g = G;
+ b = B;
+ } break;
+
+ case Op_lab_to_xyz:{
+ // The L*a*b values are in r,g,b, but normalized to [0,1]. Reconstruct them:
+ F L = r * 100.0f,
+ A = g * 255.0f - 128.0f,
+ B = b * 255.0f - 128.0f;
+
+ // Convert to CIE XYZ.
+ F Y = (L + 16.0f) * (1/116.0f),
+ X = Y + A*(1/500.0f),
+ Z = Y - B*(1/200.0f);
+
+ X = if_then_else(X*X*X > 0.008856f, X*X*X, (X - (16/116.0f)) * (1/7.787f));
+ Y = if_then_else(Y*Y*Y > 0.008856f, Y*Y*Y, (Y - (16/116.0f)) * (1/7.787f));
+ Z = if_then_else(Z*Z*Z > 0.008856f, Z*Z*Z, (Z - (16/116.0f)) * (1/7.787f));
+
+ // Adjust to XYZD50 illuminant, and stuff back into r,g,b for the next op.
+ r = X * 0.9642f;
+ g = Y ;
+ b = Z * 0.8249f;
+ } break;
+
+ // As above, in reverse.
+ case Op_xyz_to_lab:{
+ F X = r * (1/0.9642f),
+ Y = g,
+ Z = b * (1/0.8249f);
+
+ X = if_then_else(X > 0.008856f, approx_pow(X, 1/3.0f), X*7.787f + (16/116.0f));
+ Y = if_then_else(Y > 0.008856f, approx_pow(Y, 1/3.0f), Y*7.787f + (16/116.0f));
+ Z = if_then_else(Z > 0.008856f, approx_pow(Z, 1/3.0f), Z*7.787f + (16/116.0f));
+
+ F L = Y*116.0f - 16.0f,
+ A = (X-Y)*500.0f,
+ B = (Y-Z)*200.0f;
+
+ r = L * (1/100.f);
+ g = (A + 128.0f) * (1/255.0f);
+ b = (B + 128.0f) * (1/255.0f);
+ } break;
+
+ case Op_tf_r:{ r = apply_tf((const skcms_TransferFunction*)*args++, r); } break;
+ case Op_tf_g:{ g = apply_tf((const skcms_TransferFunction*)*args++, g); } break;
+ case Op_tf_b:{ b = apply_tf((const skcms_TransferFunction*)*args++, b); } break;
+ case Op_tf_a:{ a = apply_tf((const skcms_TransferFunction*)*args++, a); } break;
+
+ case Op_pq_r:{ r = apply_pq((const skcms_TransferFunction*)*args++, r); } break;
+ case Op_pq_g:{ g = apply_pq((const skcms_TransferFunction*)*args++, g); } break;
+ case Op_pq_b:{ b = apply_pq((const skcms_TransferFunction*)*args++, b); } break;
+ case Op_pq_a:{ a = apply_pq((const skcms_TransferFunction*)*args++, a); } break;
+
+ case Op_hlg_r:{ r = apply_hlg((const skcms_TransferFunction*)*args++, r); } break;
+ case Op_hlg_g:{ g = apply_hlg((const skcms_TransferFunction*)*args++, g); } break;
+ case Op_hlg_b:{ b = apply_hlg((const skcms_TransferFunction*)*args++, b); } break;
+ case Op_hlg_a:{ a = apply_hlg((const skcms_TransferFunction*)*args++, a); } break;
+
+ case Op_hlginv_r:{ r = apply_hlginv((const skcms_TransferFunction*)*args++, r); } break;
+ case Op_hlginv_g:{ g = apply_hlginv((const skcms_TransferFunction*)*args++, g); } break;
+ case Op_hlginv_b:{ b = apply_hlginv((const skcms_TransferFunction*)*args++, b); } break;
+ case Op_hlginv_a:{ a = apply_hlginv((const skcms_TransferFunction*)*args++, a); } break;
+
+ case Op_table_r: { r = table((const skcms_Curve*)*args++, r); } break;
+ case Op_table_g: { g = table((const skcms_Curve*)*args++, g); } break;
+ case Op_table_b: { b = table((const skcms_Curve*)*args++, b); } break;
+ case Op_table_a: { a = table((const skcms_Curve*)*args++, a); } break;
+
+ case Op_clut_A2B: {
+ const skcms_A2B* a2b = (const skcms_A2B*) *args++;
+ clut(a2b, &r,&g,&b,a);
+
+ if (a2b->input_channels == 4) {
+ // CMYK is opaque.
+ a = F1;
+ }
+ } break;
+
+ case Op_clut_B2A: {
+ const skcms_B2A* b2a = (const skcms_B2A*) *args++;
+ clut(b2a, &r,&g,&b,&a);
+ } break;
+
+ // Notice, from here on down the store_ ops all return, ending the loop.
+
+ case Op_store_a8: {
+ store(dst + 1*i, cast<U8>(to_fixed(a * 255)));
+ } return;
+
+ case Op_store_g8: {
+ // g should be holding luminance (Y) (r,g,b ~~~> X,Y,Z)
+ store(dst + 1*i, cast<U8>(to_fixed(g * 255)));
+ } return;
+
+ case Op_store_4444: {
+ store<U16>(dst + 2*i, cast<U16>(to_fixed(r * 15) << 12)
+ | cast<U16>(to_fixed(g * 15) << 8)
+ | cast<U16>(to_fixed(b * 15) << 4)
+ | cast<U16>(to_fixed(a * 15) << 0));
+ } return;
+
+ case Op_store_565: {
+ store<U16>(dst + 2*i, cast<U16>(to_fixed(r * 31) << 0 )
+ | cast<U16>(to_fixed(g * 63) << 5 )
+ | cast<U16>(to_fixed(b * 31) << 11 ));
+ } return;
+
+ case Op_store_888: {
+ uint8_t* rgb = (uint8_t*)dst + 3*i;
+ #if defined(USING_NEON_FP16)
+ // See the explanation under USING_NEON below. This is that doubled up.
+ U16 R = to_fixed(r * 255),
+ G = to_fixed(g * 255),
+ B = to_fixed(b * 255);
+
+ uint8x16x3_t v = {{ (uint8x16_t)R, (uint8x16_t)G, (uint8x16_t)B }};
+ vst3q_lane_u8(rgb+ 0, v, 0);
+ vst3q_lane_u8(rgb+ 3, v, 2);
+ vst3q_lane_u8(rgb+ 6, v, 4);
+ vst3q_lane_u8(rgb+ 9, v, 6);
+
+ vst3q_lane_u8(rgb+12, v, 8);
+ vst3q_lane_u8(rgb+15, v, 10);
+ vst3q_lane_u8(rgb+18, v, 12);
+ vst3q_lane_u8(rgb+21, v, 14);
+ #elif defined(USING_NEON)
+ // Same deal as load_888 but in reverse... we'll store using uint8x8x3_t, but
+ // get there via U16 to save some instructions converting to float. And just
+ // like load_888, we'd prefer to go via U32 but for ARMv7 support.
+ U16 R = cast<U16>(to_fixed(r * 255)),
+ G = cast<U16>(to_fixed(g * 255)),
+ B = cast<U16>(to_fixed(b * 255));
+
+ uint8x8x3_t v = {{ (uint8x8_t)R, (uint8x8_t)G, (uint8x8_t)B }};
+ vst3_lane_u8(rgb+0, v, 0);
+ vst3_lane_u8(rgb+3, v, 2);
+ vst3_lane_u8(rgb+6, v, 4);
+ vst3_lane_u8(rgb+9, v, 6);
+ #else
+ store_3(rgb+0, cast<U8>(to_fixed(r * 255)) );
+ store_3(rgb+1, cast<U8>(to_fixed(g * 255)) );
+ store_3(rgb+2, cast<U8>(to_fixed(b * 255)) );
+ #endif
+ } return;
+
+ case Op_store_8888: {
+ store(dst + 4*i, cast<U32>(to_fixed(r * 255)) << 0
+ | cast<U32>(to_fixed(g * 255)) << 8
+ | cast<U32>(to_fixed(b * 255)) << 16
+ | cast<U32>(to_fixed(a * 255)) << 24);
+ } return;
+
+ case Op_store_1010102: {
+ store(dst + 4*i, cast<U32>(to_fixed(r * 1023)) << 0
+ | cast<U32>(to_fixed(g * 1023)) << 10
+ | cast<U32>(to_fixed(b * 1023)) << 20
+ | cast<U32>(to_fixed(a * 3)) << 30);
+ } return;
+
+ case Op_store_161616LE: {
+ uintptr_t ptr = (uintptr_t)(dst + 6*i);
+ assert( (ptr & 1) == 0 ); // The dst pointer must be 2-byte aligned
+ uint16_t* rgb = (uint16_t*)ptr; // for this cast to uint16_t* to be safe.
+ #if defined(USING_NEON_FP16)
+ uint16x8x3_t v = {{
+ (uint16x8_t)U16_from_F(r),
+ (uint16x8_t)U16_from_F(g),
+ (uint16x8_t)U16_from_F(b),
+ }};
+ vst3q_u16(rgb, v);
+ #elif defined(USING_NEON)
+ uint16x4x3_t v = {{
+ (uint16x4_t)U16_from_F(r),
+ (uint16x4_t)U16_from_F(g),
+ (uint16x4_t)U16_from_F(b),
+ }};
+ vst3_u16(rgb, v);
+ #else
+ store_3(rgb+0, U16_from_F(r));
+ store_3(rgb+1, U16_from_F(g));
+ store_3(rgb+2, U16_from_F(b));
+ #endif
+
+ } return;
+
+ case Op_store_16161616LE: {
+ uintptr_t ptr = (uintptr_t)(dst + 8*i);
+ assert( (ptr & 1) == 0 ); // The dst pointer must be 2-byte aligned
+ uint16_t* rgba = (uint16_t*)ptr; // for this cast to uint16_t* to be safe.
+ #if defined(USING_NEON_FP16)
+ uint16x8x4_t v = {{
+ (uint16x8_t)U16_from_F(r),
+ (uint16x8_t)U16_from_F(g),
+ (uint16x8_t)U16_from_F(b),
+ (uint16x8_t)U16_from_F(a),
+ }};
+ vst4q_u16(rgba, v);
+ #elif defined(USING_NEON)
+ uint16x4x4_t v = {{
+ (uint16x4_t)U16_from_F(r),
+ (uint16x4_t)U16_from_F(g),
+ (uint16x4_t)U16_from_F(b),
+ (uint16x4_t)U16_from_F(a),
+ }};
+ vst4_u16(rgba, v);
+ #else
+ U64 px = cast<U64>(to_fixed(r * 65535)) << 0
+ | cast<U64>(to_fixed(g * 65535)) << 16
+ | cast<U64>(to_fixed(b * 65535)) << 32
+ | cast<U64>(to_fixed(a * 65535)) << 48;
+ store(rgba, px);
+ #endif
+ } return;
+
+ case Op_store_161616BE: {
+ uintptr_t ptr = (uintptr_t)(dst + 6*i);
+ assert( (ptr & 1) == 0 ); // The dst pointer must be 2-byte aligned
+ uint16_t* rgb = (uint16_t*)ptr; // for this cast to uint16_t* to be safe.
+ #if defined(USING_NEON_FP16)
+ uint16x8x3_t v = {{
+ (uint16x8_t)swap_endian_16(U16_from_F(r)),
+ (uint16x8_t)swap_endian_16(U16_from_F(g)),
+ (uint16x8_t)swap_endian_16(U16_from_F(b)),
+ }};
+ vst3q_u16(rgb, v);
+ #elif defined(USING_NEON)
+ uint16x4x3_t v = {{
+ (uint16x4_t)swap_endian_16(cast<U16>(U16_from_F(r))),
+ (uint16x4_t)swap_endian_16(cast<U16>(U16_from_F(g))),
+ (uint16x4_t)swap_endian_16(cast<U16>(U16_from_F(b))),
+ }};
+ vst3_u16(rgb, v);
+ #else
+ U32 R = to_fixed(r * 65535),
+ G = to_fixed(g * 65535),
+ B = to_fixed(b * 65535);
+ store_3(rgb+0, cast<U16>((R & 0x00ff) << 8 | (R & 0xff00) >> 8) );
+ store_3(rgb+1, cast<U16>((G & 0x00ff) << 8 | (G & 0xff00) >> 8) );
+ store_3(rgb+2, cast<U16>((B & 0x00ff) << 8 | (B & 0xff00) >> 8) );
+ #endif
+
+ } return;
+
+ case Op_store_16161616BE: {
+ uintptr_t ptr = (uintptr_t)(dst + 8*i);
+ assert( (ptr & 1) == 0 ); // The dst pointer must be 2-byte aligned
+ uint16_t* rgba = (uint16_t*)ptr; // for this cast to uint16_t* to be safe.
+ #if defined(USING_NEON_FP16)
+ uint16x8x4_t v = {{
+ (uint16x8_t)swap_endian_16(U16_from_F(r)),
+ (uint16x8_t)swap_endian_16(U16_from_F(g)),
+ (uint16x8_t)swap_endian_16(U16_from_F(b)),
+ (uint16x8_t)swap_endian_16(U16_from_F(a)),
+ }};
+ vst4q_u16(rgba, v);
+ #elif defined(USING_NEON)
+ uint16x4x4_t v = {{
+ (uint16x4_t)swap_endian_16(cast<U16>(U16_from_F(r))),
+ (uint16x4_t)swap_endian_16(cast<U16>(U16_from_F(g))),
+ (uint16x4_t)swap_endian_16(cast<U16>(U16_from_F(b))),
+ (uint16x4_t)swap_endian_16(cast<U16>(U16_from_F(a))),
+ }};
+ vst4_u16(rgba, v);
+ #else
+ U64 px = cast<U64>(to_fixed(r * 65535)) << 0
+ | cast<U64>(to_fixed(g * 65535)) << 16
+ | cast<U64>(to_fixed(b * 65535)) << 32
+ | cast<U64>(to_fixed(a * 65535)) << 48;
+ store(rgba, swap_endian_16x4(px));
+ #endif
+ } return;
+
+ case Op_store_hhh: {
+ uintptr_t ptr = (uintptr_t)(dst + 6*i);
+ assert( (ptr & 1) == 0 ); // The dst pointer must be 2-byte aligned
+ uint16_t* rgb = (uint16_t*)ptr; // for this cast to uint16_t* to be safe.
+
+ U16 R = Half_from_F(r),
+ G = Half_from_F(g),
+ B = Half_from_F(b);
+ #if defined(USING_NEON_FP16)
+ uint16x8x3_t v = {{
+ (uint16x8_t)R,
+ (uint16x8_t)G,
+ (uint16x8_t)B,
+ }};
+ vst3q_u16(rgb, v);
+ #elif defined(USING_NEON)
+ uint16x4x3_t v = {{
+ (uint16x4_t)R,
+ (uint16x4_t)G,
+ (uint16x4_t)B,
+ }};
+ vst3_u16(rgb, v);
+ #else
+ store_3(rgb+0, R);
+ store_3(rgb+1, G);
+ store_3(rgb+2, B);
+ #endif
+ } return;
+
+ case Op_store_hhhh: {
+ uintptr_t ptr = (uintptr_t)(dst + 8*i);
+ assert( (ptr & 1) == 0 ); // The dst pointer must be 2-byte aligned
+ uint16_t* rgba = (uint16_t*)ptr; // for this cast to uint16_t* to be safe.
+
+ U16 R = Half_from_F(r),
+ G = Half_from_F(g),
+ B = Half_from_F(b),
+ A = Half_from_F(a);
+ #if defined(USING_NEON_FP16)
+ uint16x8x4_t v = {{
+ (uint16x8_t)R,
+ (uint16x8_t)G,
+ (uint16x8_t)B,
+ (uint16x8_t)A,
+ }};
+ vst4q_u16(rgba, v);
+ #elif defined(USING_NEON)
+ uint16x4x4_t v = {{
+ (uint16x4_t)R,
+ (uint16x4_t)G,
+ (uint16x4_t)B,
+ (uint16x4_t)A,
+ }};
+ vst4_u16(rgba, v);
+ #else
+ store(rgba, cast<U64>(R) << 0
+ | cast<U64>(G) << 16
+ | cast<U64>(B) << 32
+ | cast<U64>(A) << 48);
+ #endif
+
+ } return;
+
+ case Op_store_fff: {
+ uintptr_t ptr = (uintptr_t)(dst + 12*i);
+ assert( (ptr & 3) == 0 ); // The dst pointer must be 4-byte aligned
+ float* rgb = (float*)ptr; // for this cast to float* to be safe.
+ #if defined(USING_NEON_FP16)
+ float32x4x3_t lo = {{
+ vcvt_f32_f16(vget_low_f16(r)),
+ vcvt_f32_f16(vget_low_f16(g)),
+ vcvt_f32_f16(vget_low_f16(b)),
+ }}, hi = {{
+ vcvt_f32_f16(vget_high_f16(r)),
+ vcvt_f32_f16(vget_high_f16(g)),
+ vcvt_f32_f16(vget_high_f16(b)),
+ }};
+ vst3q_f32(rgb + 0, lo);
+ vst3q_f32(rgb + 12, hi);
+ #elif defined(USING_NEON)
+ float32x4x3_t v = {{
+ (float32x4_t)r,
+ (float32x4_t)g,
+ (float32x4_t)b,
+ }};
+ vst3q_f32(rgb, v);
+ #else
+ store_3(rgb+0, r);
+ store_3(rgb+1, g);
+ store_3(rgb+2, b);
+ #endif
+ } return;
+
+ case Op_store_ffff: {
+ uintptr_t ptr = (uintptr_t)(dst + 16*i);
+ assert( (ptr & 3) == 0 ); // The dst pointer must be 4-byte aligned
+ float* rgba = (float*)ptr; // for this cast to float* to be safe.
+ #if defined(USING_NEON_FP16)
+ float32x4x4_t lo = {{
+ vcvt_f32_f16(vget_low_f16(r)),
+ vcvt_f32_f16(vget_low_f16(g)),
+ vcvt_f32_f16(vget_low_f16(b)),
+ vcvt_f32_f16(vget_low_f16(a)),
+ }}, hi = {{
+ vcvt_f32_f16(vget_high_f16(r)),
+ vcvt_f32_f16(vget_high_f16(g)),
+ vcvt_f32_f16(vget_high_f16(b)),
+ vcvt_f32_f16(vget_high_f16(a)),
+ }};
+ vst4q_f32(rgba + 0, lo);
+ vst4q_f32(rgba + 16, hi);
+ #elif defined(USING_NEON)
+ float32x4x4_t v = {{
+ (float32x4_t)r,
+ (float32x4_t)g,
+ (float32x4_t)b,
+ (float32x4_t)a,
+ }};
+ vst4q_f32(rgba, v);
+ #else
+ store_4(rgba+0, r);
+ store_4(rgba+1, g);
+ store_4(rgba+2, b);
+ store_4(rgba+3, a);
+ #endif
+ } return;
+ }
+ }
+}
+
+
+static void run_program(const Op* program, const void** arguments,
+ const char* src, char* dst, int n,
+ const size_t src_bpp, const size_t dst_bpp) {
+ int i = 0;
+ while (n >= N) {
+ exec_ops(program, arguments, src, dst, i);
+ i += N;
+ n -= N;
+ }
+ if (n > 0) {
+ char tmp[4*4*N] = {0};
+
+ memcpy(tmp, (const char*)src + (size_t)i*src_bpp, (size_t)n*src_bpp);
+ exec_ops(program, arguments, tmp, tmp, 0);
+ memcpy((char*)dst + (size_t)i*dst_bpp, tmp, (size_t)n*dst_bpp);
+ }
+}
+
+// Clean up any #defines we may have set so that we can be #included again.
+#if defined(USING_AVX)
+ #undef USING_AVX
+#endif
+#if defined(USING_AVX_F16C)
+ #undef USING_AVX_F16C
+#endif
+#if defined(USING_AVX2)
+ #undef USING_AVX2
+#endif
+#if defined(USING_AVX512F)
+ #undef USING_AVX512F
+#endif
+
+#if defined(USING_NEON)
+ #undef USING_NEON
+#endif
+#if defined(USING_NEON_F16C)
+ #undef USING_NEON_F16C
+#endif
+#if defined(USING_NEON_FP16)
+ #undef USING_NEON_FP16
+#endif
+
+#undef FALLTHROUGH
diff --git a/chromium/third_party/skia/modules/skcms/version.sha1 b/chromium/third_party/skia/modules/skcms/version.sha1
new file mode 100755
index 00000000000..c4ef6193308
--- /dev/null
+++ b/chromium/third_party/skia/modules/skcms/version.sha1
@@ -0,0 +1 @@
+9c30a95f0f167ee1513e5a1ea6846b15a010385c
diff --git a/chromium/third_party/skia/modules/skottie/BUILD.bazel b/chromium/third_party/skia/modules/skottie/BUILD.bazel
index 56aa0964df2..e05080f6050 100644
--- a/chromium/third_party/skia/modules/skottie/BUILD.bazel
+++ b/chromium/third_party/skia/modules/skottie/BUILD.bazel
@@ -1,19 +1,21 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy")
+load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_library")
+load("//bazel:cc_binary_with_flags.bzl", "cc_binary_with_flags")
licenses(["notice"])
exports_files_legacy()
-cc_library(
+skia_cc_library(
name = "skottie",
srcs = [
"//modules/skottie/src:srcs",
+ "//src/utils:json_hdrs",
"//src/utils:json_srcs",
],
hdrs = ["//modules/skottie/include:hdrs"],
visibility = ["//:__subpackages__"],
deps = [
- "//:skia_public",
+ "//:skia_internal",
"//modules/skresources",
"//modules/sksg",
"//modules/skshaper",
@@ -21,7 +23,7 @@ cc_library(
],
)
-cc_library(
+skia_cc_library(
name = "utils",
srcs = ["//modules/skottie/utils:srcs"],
hdrs = ["//modules/skottie/utils:hdrs"],
@@ -30,3 +32,54 @@ cc_library(
":skottie",
],
)
+
+cc_binary_with_flags(
+ name = "skottie_tool_cpu",
+ testonly = True,
+ srcs = [
+ "//modules/skottie/src:skottie_tool",
+ "//tools/flags",
+ ],
+ defines = ["CPU_ONLY"],
+ set_flags = {
+ "fontmgr_factory": ["custom_directory_fontmgr_factory"],
+ "include_decoder": [
+ "jpeg_decode_codec",
+ "png_decode_codec",
+ ],
+ "enable_sksl": ["True"],
+ "use_harfbuzz": ["True"],
+ "use_icu": ["True"],
+ },
+ deps = [
+ ":skottie",
+ ":utils",
+ ],
+)
+
+cc_binary_with_flags(
+ name = "skottie_tool_gpu",
+ testonly = True,
+ srcs = [
+ "//modules/skottie/src:skottie_tool",
+ "//tools/flags",
+ ],
+ defines = ["GPU_ONLY"],
+ set_flags = {
+ "enable_gpu_test_utils": ["True"],
+ "fontmgr_factory": ["custom_directory_fontmgr_factory"],
+ "gpu_backend": ["gl_backend"],
+ "include_decoder": [
+ "jpeg_decode_codec",
+ "png_decode_codec",
+ ],
+ "use_harfbuzz": ["True"],
+ "use_icu": ["True"],
+ "with_gl_standard": ["gl_standard"],
+ },
+ deps = [
+ ":skottie",
+ ":utils",
+ "//tools/gpu:utils",
+ ],
+)
diff --git a/chromium/third_party/skia/modules/skottie/BUILD.gn b/chromium/third_party/skia/modules/skottie/BUILD.gn
index 0f986e81d55..aa964dc1121 100644
--- a/chromium/third_party/skia/modules/skottie/BUILD.gn
+++ b/chromium/third_party/skia/modules/skottie/BUILD.gn
@@ -105,6 +105,50 @@ if (skia_enable_skottie) {
deps = [
"../..:flags",
+ "../..:gpu_tool_utils",
+ "../..:skia",
+ "../../experimental/ffmpeg:video_encoder",
+ ]
+
+ public_deps = [
+ ":skottie",
+ ":utils",
+ ]
+ }
+
+ # A couple of backend specific targets, to facilitate binary size experiments.
+ skia_source_set("tool_cpu") {
+ check_includes = false
+ testonly = true
+
+ configs = [ "../..:skia_private" ]
+ sources = [ "src/SkottieTool.cpp" ]
+ defines = [ "CPU_ONLY" ]
+
+ deps = [
+ "../..:flags",
+ "../..:gpu_tool_utils",
+ "../..:skia",
+ "../../experimental/ffmpeg:video_encoder",
+ ]
+
+ public_deps = [
+ ":skottie",
+ ":utils",
+ ]
+ }
+
+ skia_source_set("tool_gpu") {
+ check_includes = false
+ testonly = true
+
+ configs = [ "../..:skia_private" ]
+ sources = [ "src/SkottieTool.cpp" ]
+ defines = [ "GPU_ONLY" ]
+
+ deps = [
+ "../..:flags",
+ "../..:gpu_tool_utils",
"../..:skia",
"../../experimental/ffmpeg:video_encoder",
]
diff --git a/chromium/third_party/skia/modules/skottie/gm/ExternalProperties.cpp b/chromium/third_party/skia/modules/skottie/gm/ExternalProperties.cpp
index cac776766ed..95e07362dae 100644
--- a/chromium/third_party/skia/modules/skottie/gm/ExternalProperties.cpp
+++ b/chromium/third_party/skia/modules/skottie/gm/ExternalProperties.cpp
@@ -7,6 +7,7 @@
#include "gm/gm.h"
#include "include/core/SkColor.h"
+#include "include/core/SkStream.h"
#include "include/utils/SkAnimCodecPlayer.h"
#include "modules/skottie/include/Skottie.h"
#include "modules/skottie/include/SkottieProperty.h"
@@ -105,7 +106,7 @@ private:
{ "update #3", SK_ColorMAGENTA, SK_ColorCYAN , 150.f },
};
- SkASSERT(i - 1 < SK_ARRAY_COUNT(gTests));
+ SkASSERT(i - 1 < std::size(gTests));
const auto& tst = gTests[i - 1];
for (const auto& prop : fPropManager->getColorProps()) {
diff --git a/chromium/third_party/skia/modules/skottie/gm/SkottieGM.cpp b/chromium/third_party/skia/modules/skottie/gm/SkottieGM.cpp
index e0dab25f3dd..7319275f180 100644
--- a/chromium/third_party/skia/modules/skottie/gm/SkottieGM.cpp
+++ b/chromium/third_party/skia/modules/skottie/gm/SkottieGM.cpp
@@ -7,6 +7,7 @@
#include "gm/gm.h"
#include "include/core/SkColor.h"
+#include "include/core/SkStream.h"
#include "include/utils/SkAnimCodecPlayer.h"
#include "modules/skottie/include/Skottie.h"
#include "modules/skottie/include/SkottieProperty.h"
@@ -148,7 +149,7 @@ protected:
};
if (uni == 'c') {
- fColorIndex = (fColorIndex + 1) % SK_ARRAY_COUNT(kColors);
+ fColorIndex = (fColorIndex + 1) % std::size(kColors);
for (const auto& prop : fColorProps) {
fPropManager->setColor(prop, kColors[fColorIndex]);
}
diff --git a/chromium/third_party/skia/modules/skottie/skottie.gni b/chromium/third_party/skia/modules/skottie/skottie.gni
index 596275f8370..d4c6f36ee0f 100644
--- a/chromium/third_party/skia/modules/skottie/skottie.gni
+++ b/chromium/third_party/skia/modules/skottie/skottie.gni
@@ -15,6 +15,7 @@ skia_skottie_public = [
skia_skottie_sources = [
"$_src/Adapter.h",
+ "$_src/BlendModes.cpp",
"$_src/Camera.cpp",
"$_src/Camera.h",
"$_src/Composition.cpp",
diff --git a/chromium/third_party/skia/modules/skottie/src/BUILD.bazel b/chromium/third_party/skia/modules/skottie/src/BUILD.bazel
index 4138b9d77e8..ca822d14660 100644
--- a/chromium/third_party/skia/modules/skottie/src/BUILD.bazel
+++ b/chromium/third_party/skia/modules/skottie/src/BUILD.bazel
@@ -8,6 +8,7 @@ filegroup(
name = "srcs",
srcs = [
"Adapter.h",
+ "BlendModes.cpp",
"Camera.cpp",
"Camera.h",
"Composition.cpp",
@@ -30,3 +31,11 @@ filegroup(
],
visibility = ["//modules/skottie:__pkg__"],
)
+
+filegroup(
+ name = "skottie_tool",
+ srcs = [
+ "SkottieTool.cpp",
+ ],
+ visibility = ["//modules/skottie:__pkg__"],
+)
diff --git a/chromium/third_party/skia/modules/skottie/src/BlendModes.cpp b/chromium/third_party/skia/modules/skottie/src/BlendModes.cpp
new file mode 100644
index 00000000000..33d673ea05d
--- /dev/null
+++ b/chromium/third_party/skia/modules/skottie/src/BlendModes.cpp
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2022 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "include/core/SkBlendMode.h"
+#include "include/core/SkBlender.h"
+#include "include/effects/SkRuntimeEffect.h"
+#include "modules/skottie/src/SkottieJson.h"
+#include "modules/skottie/src/SkottiePriv.h"
+#include "modules/sksg/include/SkSGRenderEffect.h"
+
+namespace skottie::internal {
+
+namespace {
+
+enum CustomBlenders {
+ HARDMIX = 17,
+};
+
+static sk_sp<SkBlender> hardMix() {
+ static SkRuntimeEffect* hardMixEffect = []{
+ const char hardMix[] = R"(
+ half4 main(half4 src, half4 dst) {
+ src.rgb = unpremul(src).rgb + unpremul(dst).rgb;
+ src.rgb = min(floor(src.rgb), 1) * src.a;
+
+ return src + (1 - src.a)*dst;
+ }
+ )";
+ auto result = SkRuntimeEffect::MakeForBlender(SkString(hardMix));
+ return result.effect.release();
+ }();
+ return hardMixEffect->makeBlender(nullptr);
+}
+
+static sk_sp<SkBlender> get_blender(const skjson::ObjectValue& jobject,
+ const AnimationBuilder* abuilder) {
+ static constexpr SkBlendMode kBlendModeMap[] = {
+ SkBlendMode::kSrcOver, // 0:'normal'
+ SkBlendMode::kMultiply, // 1:'multiply'
+ SkBlendMode::kScreen, // 2:'screen'
+ SkBlendMode::kOverlay, // 3:'overlay
+ SkBlendMode::kDarken, // 4:'darken'
+ SkBlendMode::kLighten, // 5:'lighten'
+ SkBlendMode::kColorDodge, // 6:'color-dodge'
+ SkBlendMode::kColorBurn, // 7:'color-burn'
+ SkBlendMode::kHardLight, // 8:'hard-light'
+ SkBlendMode::kSoftLight, // 9:'soft-light'
+ SkBlendMode::kDifference, // 10:'difference'
+ SkBlendMode::kExclusion, // 11:'exclusion'
+ SkBlendMode::kHue, // 12:'hue'
+ SkBlendMode::kSaturation, // 13:'saturation'
+ SkBlendMode::kColor, // 14:'color'
+ SkBlendMode::kLuminosity, // 15:'luminosity'
+ SkBlendMode::kPlus, // 16:'add'
+ };
+
+ const size_t mode = ParseDefault<size_t>(jobject["bm"], 0);
+
+ // Special handling of src-over, so we can detect the trivial/no-fancy-blending case
+ // (a null blender is equivalent to src-over).
+ if (!mode) {
+ return nullptr;
+ }
+
+ // Modes that are expressible as SkBlendMode.
+ if (mode < std::size(kBlendModeMap)) {
+ return SkBlender::Mode(kBlendModeMap[mode]);
+ }
+
+ // Modes that require custom blenders.
+ switch (mode)
+ {
+ case HARDMIX:
+ return hardMix();
+ default:
+ break;
+ }
+
+ abuilder->log(Logger::Level::kWarning, &jobject, "Unsupported blend mode %zu\n", mode);
+ return nullptr;
+}
+
+} // namespace
+
+sk_sp<sksg::RenderNode> AnimationBuilder::attachBlendMode(const skjson::ObjectValue& jobject,
+ sk_sp<sksg::RenderNode> child) const {
+ if (auto blender = get_blender(jobject, this)) {
+ fHasNontrivialBlending = true;
+ child = sksg::BlenderEffect::Make(std::move(child), std::move(blender));
+ }
+
+ return child;
+}
+
+} // namespace skottie::internal
diff --git a/chromium/third_party/skia/modules/skottie/src/Layer.cpp b/chromium/third_party/skia/modules/skottie/src/Layer.cpp
index 1057a6fe70d..17ab6967452 100644
--- a/chromium/third_party/skia/modules/skottie/src/Layer.cpp
+++ b/chromium/third_party/skia/modules/skottie/src/Layer.cpp
@@ -364,12 +364,9 @@ sk_sp<sksg::Transform> LayerBuilder::getParentTransform(const AnimationBuilder&
return parent_builder->getTransform(abuilder, cbuilder, ttype);
}
- if (ttype == TransformType::k3D) {
- // During camera transform attachment, cbuilder->getCameraTransform() is null.
- // This prevents camera->camera transform chain cycles.
- SkASSERT(!this->isCamera() || !cbuilder->getCameraTransform());
-
- // 3D transform chains are implicitly rooted onto the camera.
+ // Camera layers have no implicit parent transform,
+ // while regular 3D transform chains are implicitly rooted onto the camera.
+ if (ttype == TransformType::k3D && !this->isCamera()) {
return cbuilder->getCameraTransform();
}
@@ -450,7 +447,7 @@ sk_sp<sksg::RenderNode> LayerBuilder::buildRenderTree(const AnimationBuilder& ab
{ nullptr , 0 }, // 'ty': 14 -> light
};
- if (fType < 0 || static_cast<size_t>(fType) >= SK_ARRAY_COUNT(gLayerBuildInfo)) {
+ if (fType < 0 || static_cast<size_t>(fType) >= std::size(gLayerBuildInfo)) {
return nullptr;
}
@@ -557,7 +554,7 @@ sk_sp<sksg::RenderNode> LayerBuilder::buildRenderTree(const AnimationBuilder& ab
sksg::MaskEffect::Mode::kLumaInvert, // tt: 4
};
- if (matte_mode <= SK_ARRAY_COUNT(gMatteModes)) {
+ if (matte_mode <= std::size(gMatteModes)) {
// The current layer is masked with the previous layer *content*.
layer = sksg::MaskEffect::Make(std::move(layer),
prev_layer->fContentTree,
diff --git a/chromium/third_party/skia/modules/skottie/src/Skottie.cpp b/chromium/third_party/skia/modules/skottie/src/Skottie.cpp
index 8c96b52a798..1af63669bc3 100644
--- a/chromium/third_party/skia/modules/skottie/src/Skottie.cpp
+++ b/chromium/third_party/skia/modules/skottie/src/Skottie.cpp
@@ -92,37 +92,6 @@ private:
using INHERITED = DiscardableAdapterBase<OpacityAdapter, sksg::OpacityEffect>;
};
-static SkBlendMode GetBlendMode(const skjson::ObjectValue& jobject,
- const AnimationBuilder* abuilder) {
- static constexpr SkBlendMode kBlendModeMap[] = {
- SkBlendMode::kSrcOver, // 0:'normal'
- SkBlendMode::kMultiply, // 1:'multiply'
- SkBlendMode::kScreen, // 2:'screen'
- SkBlendMode::kOverlay, // 3:'overlay
- SkBlendMode::kDarken, // 4:'darken'
- SkBlendMode::kLighten, // 5:'lighten'
- SkBlendMode::kColorDodge, // 6:'color-dodge'
- SkBlendMode::kColorBurn, // 7:'color-burn'
- SkBlendMode::kHardLight, // 8:'hard-light'
- SkBlendMode::kSoftLight, // 9:'soft-light'
- SkBlendMode::kDifference, // 10:'difference'
- SkBlendMode::kExclusion, // 11:'exclusion'
- SkBlendMode::kHue, // 12:'hue'
- SkBlendMode::kSaturation, // 13:'saturation'
- SkBlendMode::kColor, // 14:'color'
- SkBlendMode::kLuminosity, // 15:'luminosity'
- SkBlendMode::kPlus, // 16:'add'
- };
-
- const size_t bm_index = ParseDefault<size_t>(jobject["bm"], 0);
- if (bm_index >= SK_ARRAY_COUNT(kBlendModeMap)) {
- abuilder->log(Logger::Level::kWarning, &jobject, "Unsupported blend mode %zu\n", bm_index);
- return SkBlendMode::kSrcOver;
- }
-
- return kBlendModeMap[bm_index];
-}
-
} // namespace
sk_sp<sksg::RenderNode> AnimationBuilder::attachOpacity(const skjson::ObjectValue& jobject,
@@ -146,17 +115,6 @@ sk_sp<sksg::RenderNode> AnimationBuilder::attachOpacity(const skjson::ObjectValu
return adapter->node();
}
-sk_sp<sksg::RenderNode> AnimationBuilder::attachBlendMode(const skjson::ObjectValue& jobject,
- sk_sp<sksg::RenderNode> child) const {
- const auto bm = GetBlendMode(jobject, this);
- if (bm != SkBlendMode::kSrcOver) {
- fHasNontrivialBlending = true;
- child = sksg::BlendModeEffect::Make(std::move(child), bm);
- }
-
- return child;
-}
-
AnimationBuilder::AnimationBuilder(sk_sp<ResourceProvider> rp, sk_sp<SkFontMgr> fontmgr,
sk_sp<PropertyObserver> pobserver, sk_sp<Logger> logger,
sk_sp<MarkerObserver> mobserver, sk_sp<PrecompInterceptor> pi,
diff --git a/chromium/third_party/skia/modules/skottie/src/SkottieTest.cpp b/chromium/third_party/skia/modules/skottie/src/SkottieTest.cpp
index 5d7a4024581..0bd84742957 100644
--- a/chromium/third_party/skia/modules/skottie/src/SkottieTest.cpp
+++ b/chromium/third_party/skia/modules/skottie/src/SkottieTest.cpp
@@ -8,13 +8,11 @@
#include "include/core/SkFontMgr.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkStream.h"
-#include "include/core/SkTextBlob.h"
#include "include/core/SkTypeface.h"
#include "modules/skottie/include/Skottie.h"
#include "modules/skottie/include/SkottieProperty.h"
#include "modules/skottie/src/text/SkottieShaper.h"
#include "src/core/SkFontDescriptor.h"
-#include "src/core/SkTextBlobPriv.h"
#include "tests/Test.h"
#include "tools/ToolUtils.h"
@@ -404,40 +402,6 @@ DEF_TEST(Skottie_Annotations, reporter) {
REPORTER_ASSERT(reporter, std::get<2>(observer->fMarkers[1]) == 0.75f);
}
-static SkRect ComputeBlobBounds(const sk_sp<SkTextBlob>& blob) {
- auto bounds = SkRect::MakeEmpty();
-
- if (!blob) {
- return bounds;
- }
-
- SkAutoSTArray<16, SkRect> glyphBounds;
-
- for (SkTextBlobRunIterator it(blob.get()); !it.done(); it.next()) {
- glyphBounds.reset(SkToInt(it.glyphCount()));
- it.font().getBounds(it.glyphs(), it.glyphCount(), glyphBounds.get(), nullptr);
-
- SkASSERT(it.positioning() == SkTextBlobRunIterator::kFull_Positioning);
- for (uint32_t i = 0; i < it.glyphCount(); ++i) {
- bounds.join(glyphBounds[i].makeOffset(it.pos()[i * 2 ],
- it.pos()[i * 2 + 1]));
- }
- }
-
- return bounds;
-}
-
-static SkRect ComputeShapeResultBounds(const skottie::Shaper::Result& res) {
- auto bounds = SkRect::MakeEmpty();
-
- for (const auto& fragment : res.fFragments) {
- bounds.join(ComputeBlobBounds(fragment.fBlob).makeOffset(fragment.fPos.x(),
- fragment.fPos.y()));
- }
-
- return bounds;
-}
-
DEF_TEST(Skottie_Shaper_HAlign, reporter) {
auto typeface = SkTypeface::MakeDefault();
REPORTER_ASSERT(reporter, typeface);
@@ -487,9 +451,9 @@ DEF_TEST(Skottie_Shaper_HAlign, reporter) {
const auto shape_result = Shaper::Shape(text, desc, text_point,
SkFontMgr::RefDefault());
REPORTER_ASSERT(reporter, shape_result.fFragments.size() == 1ul);
- REPORTER_ASSERT(reporter, shape_result.fFragments[0].fBlob);
+ REPORTER_ASSERT(reporter, !shape_result.fFragments[0].fGlyphs.fRuns.empty());
- const auto shape_bounds = ComputeShapeResultBounds(shape_result);
+ const auto shape_bounds = shape_result.computeVisualBounds();
REPORTER_ASSERT(reporter, !shape_bounds.isEmpty());
const auto expected_l = text_point.x() - shape_bounds.width() * talign.l_selector;
@@ -556,9 +520,9 @@ DEF_TEST(Skottie_Shaper_VAlign, reporter) {
const auto shape_result = Shaper::Shape(text, desc, text_box, SkFontMgr::RefDefault());
REPORTER_ASSERT(reporter, shape_result.fFragments.size() == 1ul);
- REPORTER_ASSERT(reporter, shape_result.fFragments[0].fBlob);
+ REPORTER_ASSERT(reporter, !shape_result.fFragments[0].fGlyphs.fRuns.empty());
- const auto shape_bounds = ComputeShapeResultBounds(shape_result);
+ const auto shape_bounds = shape_result.computeVisualBounds();
REPORTER_ASSERT(reporter, !shape_bounds.isEmpty());
const auto v_diff = text_box.height() - shape_bounds.height();
@@ -601,7 +565,7 @@ DEF_TEST(Skottie_Shaper_FragmentGlyphs, reporter) {
const auto shape_result = Shaper::Shape(text, desc, text_box, SkFontMgr::RefDefault());
// Default/consolidated mode => single blob result.
REPORTER_ASSERT(reporter, shape_result.fFragments.size() == 1ul);
- REPORTER_ASSERT(reporter, shape_result.fFragments[0].fBlob);
+ REPORTER_ASSERT(reporter, !shape_result.fFragments[0].fGlyphs.fRuns.empty());
}
{
@@ -612,7 +576,7 @@ DEF_TEST(Skottie_Shaper_FragmentGlyphs, reporter) {
const size_t expectedSize = text.size();
REPORTER_ASSERT(reporter, shape_result.fFragments.size() == expectedSize);
for (size_t i = 0; i < expectedSize; ++i) {
- REPORTER_ASSERT(reporter, shape_result.fFragments[i].fBlob);
+ REPORTER_ASSERT(reporter, !shape_result.fFragments[i].fGlyphs.fRuns.empty());
}
}
}
@@ -692,7 +656,7 @@ DEF_TEST(Skottie_Shaper_ExplicitFontMgr, reporter) {
const auto shape_result = Shaper::Shape(SkString("foo bar"), desc, text_box, fontmgr);
REPORTER_ASSERT(reporter, shape_result.fFragments.size() == 1ul);
- REPORTER_ASSERT(reporter, shape_result.fFragments[0].fBlob);
+ REPORTER_ASSERT(reporter, !shape_result.fFragments[0].fGlyphs.fRuns.empty());
REPORTER_ASSERT(reporter, fontmgr->fallbackCount() == 0ul);
REPORTER_ASSERT(reporter, shape_result.fMissingGlyphCount == 0);
}
@@ -703,7 +667,7 @@ DEF_TEST(Skottie_Shaper_ExplicitFontMgr, reporter) {
desc, text_box, fontmgr);
REPORTER_ASSERT(reporter, shape_result.fFragments.size() == 1ul);
- REPORTER_ASSERT(reporter, shape_result.fFragments[0].fBlob);
+ REPORTER_ASSERT(reporter, !shape_result.fFragments[0].fGlyphs.fRuns.empty());
REPORTER_ASSERT(reporter, fontmgr->fallbackCount() == 1ul);
REPORTER_ASSERT(reporter, shape_result.fMissingGlyphCount == 1ul);
}
diff --git a/chromium/third_party/skia/modules/skottie/src/SkottieTool.cpp b/chromium/third_party/skia/modules/skottie/src/SkottieTool.cpp
index 8b94094210c..34035904855 100644
--- a/chromium/third_party/skia/modules/skottie/src/SkottieTool.cpp
+++ b/chromium/third_party/skia/modules/skottie/src/SkottieTool.cpp
@@ -26,6 +26,11 @@
#include <numeric>
#include <vector>
+#if !defined(CPU_ONLY)
+#include "include/gpu/GrContextOptions.h"
+#include "tools/gpu/GrContextFactory.h"
+#endif
+
#if defined(HAVE_VIDEO_ENCODER)
#include "experimental/ffmpeg/SkVideoEncoder.h"
const char* formats_help = "Output format (png, skp, mp4, or null)";
@@ -45,60 +50,59 @@ static DEFINE_int(width , 800, "Render width.");
static DEFINE_int(height, 600, "Render height.");
static DEFINE_int(threads, 0, "Number of worker threads (0 -> cores count).");
+static DEFINE_bool2(gpu, g, false, "Enable GPU rasterization.");
+
namespace {
static constexpr SkColor kClearColor = SK_ColorWHITE;
-std::unique_ptr<SkFILEWStream> MakeFrameStream(size_t idx, const char* ext) {
- const auto frame_file = SkStringPrintf("0%06zu.%s", idx, ext);
- auto stream = std::make_unique<SkFILEWStream>(SkOSPath::Join(FLAGS_writePath[0],
- frame_file.c_str()).c_str());
- if (!stream->isValid()) {
- return nullptr;
- }
+enum class OutputFormat {
+ kPNG,
+ kSKP,
+ kNull,
+ kMP4,
+};
+
+
+auto ms_since(std::chrono::steady_clock::time_point start) {
+ const auto elapsed = std::chrono::steady_clock::now() - start;
+ return std::chrono::duration_cast<std::chrono::milliseconds>(elapsed).count();
+};
+
+std::unique_ptr<SkFILEWStream> make_file_stream(size_t frame_index, const char* extension) {
+ const auto file = SkStringPrintf("0%06zu.%s", frame_index, extension);
+ const auto path = SkOSPath::Join(FLAGS_writePath[0], file.c_str());
- return stream;
+ auto stream = std::make_unique<SkFILEWStream>(path.c_str());
+
+ return stream->isValid() ? std::move(stream) : nullptr;
}
-class Sink {
+class FrameSink {
public:
- Sink() = default;
- virtual ~Sink() = default;
- Sink(const Sink&) = delete;
- Sink& operator=(const Sink&) = delete;
+ virtual ~FrameSink() = default;
- virtual SkCanvas* beginFrame(size_t idx) = 0;
- virtual bool endFrame(size_t idx) = 0;
-};
+ static std::unique_ptr<FrameSink> Make(OutputFormat fmt, size_t frame_count);
-class PNGSink final : public Sink {
-public:
- static std::unique_ptr<Sink> Make(const SkMatrix& scale_matrix) {
- auto surface = SkSurface::MakeRasterN32Premul(FLAGS_width, FLAGS_height);
- if (!surface) {
- SkDebugf("Could not allocate a %d x %d surface.\n", FLAGS_width, FLAGS_height);
- return nullptr;
- }
+ virtual void writeFrame(sk_sp<SkImage> frame, size_t frame_index) = 0;
- return std::unique_ptr<Sink>(new PNGSink(std::move(surface), scale_matrix));
- }
+ virtual void finalize(double fps) {}
+
+protected:
+ FrameSink() = default;
private:
- PNGSink(sk_sp<SkSurface> surface, const SkMatrix& scale_matrix)
- : fSurface(std::move(surface)) {
- fSurface->getCanvas()->concat(scale_matrix);
- }
+ FrameSink(const FrameSink&) = delete;
+ FrameSink& operator=(const FrameSink&) = delete;
+};
- SkCanvas* beginFrame(size_t) override {
- auto* canvas = fSurface->getCanvas();
- canvas->clear(kClearColor);
- return canvas;
- }
+class PNGSink final : public FrameSink {
+public:
+ void writeFrame(sk_sp<SkImage> frame, size_t frame_index) override {
+ auto stream = make_file_stream(frame_index, "png");
- bool endFrame(size_t idx) override {
- auto stream = MakeFrameStream(idx, "png");
- if (!stream) {
- return false;
+ if (!frame || !stream) {
+ return;
}
// Set encoding options to favor speed over size.
@@ -106,101 +110,279 @@ private:
options.fZLibLevel = 1;
options.fFilterFlags = SkPngEncoder::FilterFlag::kNone;
- sk_sp<SkImage> img = fSurface->makeImageSnapshot();
SkPixmap pixmap;
- return img->peekPixels(&pixmap)
- && SkPngEncoder::Encode(stream.get(), pixmap, options);
+ SkAssertResult(frame->peekPixels(&pixmap));
+
+ SkPngEncoder::Encode(stream.get(), pixmap, options);
}
+};
- const sk_sp<SkSurface> fSurface;
+class NullSink final : public FrameSink {
+public:
+ void writeFrame(sk_sp<SkImage>, size_t) override {}
};
-class SKPSink final : public Sink {
+#if defined(HAVE_VIDEO_ENCODER)
+class MP4Sink final : public FrameSink {
public:
- static std::unique_ptr<Sink> Make(const SkMatrix& scale_matrix) {
- return std::unique_ptr<Sink>(new SKPSink(scale_matrix));
+ explicit MP4Sink(size_t frame_count) {
+ fFrames.resize(frame_count);
}
-private:
- explicit SKPSink(const SkMatrix& scale_matrix)
- : fScaleMatrix(scale_matrix) {}
-
- SkCanvas* beginFrame(size_t) override {
- auto canvas = fRecorder.beginRecording(FLAGS_width, FLAGS_height);
- canvas->concat(fScaleMatrix);
- return canvas;
+ void writeFrame(sk_sp<SkImage> frame, size_t frame_index) override {
+ fFrames[frame_index].set_value(std::move(frame));
}
- bool endFrame(size_t idx) override {
- auto stream = MakeFrameStream(idx, "skp");
- if (!stream) {
- return false;
+ void finalize(double fps) override {
+ SkVideoEncoder encoder;
+ if (!encoder.beginRecording({FLAGS_width, FLAGS_height}, sk_double_round2int(fps))) {
+ fprintf(stderr, "Invalid video stream configuration.\n");
+ }
+
+ std::vector<double> starved_ms;
+ starved_ms.reserve(fFrames.size());
+
+ for (auto& frame_promise : fFrames) {
+ const auto start = std::chrono::steady_clock::now();
+ auto frame = frame_promise.get_future().get();
+ starved_ms.push_back(ms_since(start));
+
+ if (!frame) continue;
+
+ SkPixmap pixmap;
+ SkAssertResult(frame->peekPixels(&pixmap));
+ encoder.addFrame(pixmap);
}
- fRecorder.finishRecordingAsPicture()->serialize(stream.get());
- return true;
+ auto mp4 = encoder.endRecording();
+
+ SkFILEWStream{FLAGS_writePath[0]}
+ .write(mp4->data(), mp4->size());
+
+ // If everything's going well, the first frame should account for the most,
+ // and ideally nearly all, starvation.
+ double first = starved_ms[0];
+ std::sort(starved_ms.begin(), starved_ms.end());
+ double sum = std::accumulate(starved_ms.begin(), starved_ms.end(), 0);
+ printf("Encoder starved stats: "
+ "min %gms, med %gms, avg %gms, max %gms, sum %gms, first %gms (%s)\n",
+ starved_ms[0], starved_ms[fFrames.size()/2], sum/fFrames.size(), starved_ms.back(),
+ sum, first, first == starved_ms.back() ? "ok" : "BAD");
+
}
- const SkMatrix fScaleMatrix;
- SkPictureRecorder fRecorder;
+ std::vector<std::promise<sk_sp<SkImage>>> fFrames;
};
+#endif // HAVE_VIDEO_ENCODER
+
+std::unique_ptr<FrameSink> FrameSink::Make(OutputFormat fmt, size_t frame_count) {
+ switch (fmt) {
+ case OutputFormat::kPNG:
+ return std::make_unique<PNGSink>();
+ case OutputFormat::kSKP:
+ // The SKP generator does not use a sink.
+ [[fallthrough]];
+ case OutputFormat::kNull:
+ return std::make_unique<NullSink>();
+ case OutputFormat::kMP4:
+#if defined(HAVE_VIDEO_ENCODER)
+ return std::make_unique<MP4Sink>(frame_count);
+#else
+ return nullptr;
+#endif
+ }
+
+ SkUNREACHABLE;
+}
+
+class FrameGenerator {
+public:
+ virtual ~FrameGenerator() = default;
+
+ static std::unique_ptr<FrameGenerator> Make(FrameSink*, OutputFormat, const SkMatrix&);
+
+ virtual void generateFrame(const skottie::Animation*, size_t frame_index) {}
+
+protected:
+ explicit FrameGenerator(FrameSink* sink) : fSink(sink) {}
-class NullSink final : public Sink {
+ FrameSink* fSink;
+
+private:
+ FrameGenerator(const FrameGenerator&) = delete;
+ FrameGenerator& operator=(const FrameGenerator&) = delete;
+};
+
+class CPUGenerator final : public FrameGenerator {
public:
- static std::unique_ptr<Sink> Make(const SkMatrix& scale_matrix) {
+#if defined(GPU_ONLY)
+ static std::unique_ptr<FrameGenerator> Make(FrameSink* sink, const SkMatrix& matrix) {
+ return nullptr;
+ }
+#else
+ static std::unique_ptr<FrameGenerator> Make(FrameSink* sink, const SkMatrix& matrix) {
auto surface = SkSurface::MakeRasterN32Premul(FLAGS_width, FLAGS_height);
if (!surface) {
SkDebugf("Could not allocate a %d x %d surface.\n", FLAGS_width, FLAGS_height);
return nullptr;
}
- return std::unique_ptr<Sink>(new NullSink(std::move(surface), scale_matrix));
+ return std::unique_ptr<FrameGenerator>(new CPUGenerator(sink, std::move(surface), matrix));
+ }
+
+ void generateFrame(const skottie::Animation* anim, size_t frame_index) override {
+ fSurface->getCanvas()->clear(kClearColor);
+ anim->render(fSurface->getCanvas());
+
+ fSink->writeFrame(fSurface->makeImageSnapshot(), frame_index);
}
private:
- NullSink(sk_sp<SkSurface> surface, const SkMatrix& scale_matrix)
- : fSurface(std::move(surface)) {
+ CPUGenerator(FrameSink* sink, sk_sp<SkSurface> surface, const SkMatrix& scale_matrix)
+ : FrameGenerator(sink)
+ , fSurface(std::move(surface))
+ {
fSurface->getCanvas()->concat(scale_matrix);
}
- SkCanvas* beginFrame(size_t) override {
- auto* canvas = fSurface->getCanvas();
- canvas->clear(kClearColor);
- return canvas;
+ const sk_sp<SkSurface> fSurface;
+#endif // !GPU_ONLY
+};
+
+class SKPGenerator final : public FrameGenerator {
+public:
+#if defined(CPU_ONLY) || defined(GPU_ONLY)
+ static std::unique_ptr<FrameGenerator> Make(FrameSink* sink, const SkMatrix& matrix) {
+ return nullptr;
+ }
+#else
+ static std::unique_ptr<FrameGenerator> Make(FrameSink* sink, const SkMatrix& scale_matrix) {
+ return std::unique_ptr<FrameGenerator>(new SKPGenerator(sink, scale_matrix));
}
- bool endFrame(size_t) override {
- return true;
+ void generateFrame(const skottie::Animation* anim, size_t frame_index) override {
+ auto* canvas = fRecorder.beginRecording(FLAGS_width, FLAGS_height);
+ canvas->concat(fScaleMatrix);
+ anim->render(canvas);
+
+ auto frame = fRecorder.finishRecordingAsPicture();
+ auto stream = make_file_stream(frame_index, "skp");
+
+ if (frame && stream) {
+ frame->serialize(stream.get());
+ }
}
- const sk_sp<SkSurface> fSurface;
+private:
+ SKPGenerator(FrameSink* sink, const SkMatrix& scale_matrix)
+ : FrameGenerator(sink)
+ , fScaleMatrix(scale_matrix)
+ {}
+
+ const SkMatrix fScaleMatrix;
+ SkPictureRecorder fRecorder;
+#endif // !CPU_ONLY && !GPU_ONLY
};
-static std::vector<std::promise<sk_sp<SkImage>>> gMP4Frames;
+class GPUGenerator final : public FrameGenerator {
+public:
+#if defined(CPU_ONLY)
+ static std::unique_ptr<FrameGenerator> Make(FrameSink* sink, const SkMatrix& matrix) {
+ return nullptr;
+ }
+#else
+ static std::unique_ptr<FrameGenerator> Make(FrameSink* sink, const SkMatrix& matrix) {
+ auto gpu_generator = std::unique_ptr<GPUGenerator>(new GPUGenerator(sink, matrix));
-struct MP4Sink final : public Sink {
- explicit MP4Sink(const SkMatrix& scale_matrix)
- : fSurface(SkSurface::MakeRasterN32Premul(FLAGS_width, FLAGS_height)) {
- fSurface->getCanvas()->concat(scale_matrix);
+ return gpu_generator->isValid()
+ ? std::unique_ptr<FrameGenerator>(gpu_generator.release())
+ : nullptr;
}
- SkCanvas* beginFrame(size_t) override {
- SkCanvas* canvas = fSurface->getCanvas();
- canvas->clear(kClearColor);
- return canvas;
+ ~GPUGenerator() override {
+ // ensure all pending reads are completed
+ fCtx->flushAndSubmit(true);
}
- bool endFrame(size_t i) override {
- if (sk_sp<SkImage> img = fSurface->makeImageSnapshot()) {
- gMP4Frames[i].set_value(std::move(img));
- return true;
+ void generateFrame(const skottie::Animation* anim, size_t frame_index) override {
+ fSurface->getCanvas()->clear(kClearColor);
+ anim->render(fSurface->getCanvas());
+
+ auto rec = std::make_unique<AsyncRec>(fSink, frame_index);
+ fSurface->asyncRescaleAndReadPixels(SkImageInfo::MakeN32Premul(FLAGS_width, FLAGS_height),
+ {0, 0, FLAGS_width, FLAGS_height},
+ SkSurface::RescaleGamma::kSrc,
+ SkImage::RescaleMode::kNearest,
+ AsyncCallback, rec.release());
+
+ fCtx->submit();
+ }
+
+private:
+ GPUGenerator(FrameSink* sink, const SkMatrix& matrix)
+ : FrameGenerator(sink)
+ {
+ fCtx = fFactory.getContextInfo(sk_gpu_test::GrContextFactory::kGL_ContextType)
+ .directContext();
+ fSurface =
+ SkSurface::MakeRenderTarget(fCtx,
+ SkBudgeted::kNo,
+ SkImageInfo::MakeN32Premul(FLAGS_width, FLAGS_height),
+ 0,
+ GrSurfaceOrigin::kTopLeft_GrSurfaceOrigin,
+ nullptr);
+ if (fSurface) {
+ fSurface->getCanvas()->concat(matrix);
+ } else {
+ fprintf(stderr, "Could not initialize GL context.\n");
}
- return false;
}
- const sk_sp<SkSurface> fSurface;
+ bool isValid() const { return !!fSurface; }
+
+ struct AsyncRec {
+ FrameSink* sink;
+ size_t index;
+
+ AsyncRec(FrameSink* sink, size_t index) : sink(sink), index(index) {}
+ };
+
+ static void AsyncCallback(SkSurface::ReadPixelsContext ctx,
+ std::unique_ptr<const SkSurface::AsyncReadResult> result) {
+ std::unique_ptr<const AsyncRec> rec(reinterpret_cast<const AsyncRec*>(ctx));
+ if (result && result->count() == 1) {
+ SkPixmap pm(SkImageInfo::MakeN32Premul(FLAGS_width, FLAGS_height),
+ result->data(0), result->rowBytes(0));
+
+ auto release_proc = [](const void*, SkImage::ReleaseContext ctx) {
+ std::unique_ptr<const SkSurface::AsyncReadResult>
+ adopted(reinterpret_cast<const SkSurface::AsyncReadResult*>(ctx));
+ };
+
+ auto frame_image = SkImage::MakeFromRaster(pm, release_proc, (void*)result.release());
+
+ rec->sink->writeFrame(std::move(frame_image), rec->index);
+ }
+ }
+
+ sk_gpu_test::GrContextFactory fFactory;
+ GrDirectContext* fCtx;
+ sk_sp<SkSurface> fSurface;
+#endif // !CPU_ONLY
};
+std::unique_ptr<FrameGenerator> FrameGenerator::Make(FrameSink* sink,
+ OutputFormat fmt,
+ const SkMatrix& matrix) {
+ if (fmt == OutputFormat::kSKP) {
+ return SKPGenerator::Make(sink, matrix);
+ }
+
+ return FLAGS_gpu
+ ? GPUGenerator::Make(sink, matrix)
+ : CPUGenerator::Make(sink, matrix);
+}
+
class Logger final : public skottie::Logger {
public:
struct LogEntry {
@@ -234,16 +416,6 @@ private:
fWarnings;
};
-std::unique_ptr<Sink> MakeSink(const char* fmt, const SkMatrix& scale_matrix) {
- if (0 == strcmp(fmt, "png")) return PNGSink::Make(scale_matrix);
- if (0 == strcmp(fmt, "skp")) return SKPSink::Make(scale_matrix);
- if (0 == strcmp(fmt, "null")) return NullSink::Make(scale_matrix);
- if (0 == strcmp(fmt, "mp4")) return std::make_unique<MP4Sink>(scale_matrix);
-
- SkDebugf("Unknown format: %s\n", FLAGS_format[0]);
- return nullptr;
-}
-
} // namespace
extern bool gSkUseThreadLocalStrikeCaches_IAcknowledgeThisIsIncrediblyExperimental;
@@ -258,7 +430,23 @@ int main(int argc, char** argv) {
return 1;
}
- if (!FLAGS_format.contains("mp4") && !sk_mkdir(FLAGS_writePath[0])) {
+ OutputFormat fmt;
+ if (0 == strcmp(FLAGS_format[0], "png")) {
+ fmt = OutputFormat::kPNG;
+ } else if (0 == strcmp(FLAGS_format[0], "skp")) {
+ fmt = OutputFormat::kSKP;
+ } else if (0 == strcmp(FLAGS_format[0], "null")) {
+ fmt = OutputFormat::kNull;
+#if defined(HAVE_VIDEO_ENCODER)
+ } else if (0 == strcmp(FLAGS_format[0], "mp4")) {
+ fmt = OutputFormat::kMP4;
+#endif
+ } else {
+ fprintf(stderr, "Unknown format: %s\n", FLAGS_format[0]);
+ return 1;
+ }
+
+ if (fmt != OutputFormat::kMP4 && !sk_mkdir(FLAGS_writePath[0])) {
return 1;
}
@@ -314,83 +502,61 @@ int main(int argc, char** argv) {
}
const auto fps_scale = native_fps / fps;
- SkDebugf("Rendering %f seconds (%d frames @%f fps).\n", duration, frame_count, fps);
+ printf("Rendering %f seconds (%d frames @%f fps).\n", duration, frame_count, fps);
- if (FLAGS_format.contains("mp4")) {
- gMP4Frames.resize(frame_count);
- }
+ const auto sink = FrameSink::Make(fmt, frame_count);
std::vector<double> frames_ms(frame_count);
- auto ms_since = [](auto start) {
- const auto elapsed = std::chrono::steady_clock::now() - start;
- return std::chrono::duration_cast<std::chrono::milliseconds>(elapsed).count();
- };
-
- SkTaskGroup::Enabler enabler(FLAGS_threads - 1);
+ const auto thread_count = FLAGS_gpu ? 0 : FLAGS_threads - 1;
+ SkTaskGroup::Enabler enabler(thread_count);
SkTaskGroup tg;
- tg.batch(frame_count, [&](int i) {
- // SkTaskGroup::Enabler creates a LIFO work pool,
- // but we want our early frames to start first.
- i = frame_count - 1 - i;
-
- const auto start = std::chrono::steady_clock::now();
- thread_local static auto* anim =
- skottie::Animation::Builder()
- .setResourceProvider(rp)
- .setPrecompInterceptor(precomp_interceptor)
- .make(static_cast<const char*>(data->data()), data->size())
- .release();
- thread_local static auto* sink = MakeSink(FLAGS_format[0], scale_matrix).release();
-
- if (sink && anim) {
- anim->seekFrame(frame0 + i * fps_scale);
- anim->render(sink->beginFrame(i));
- sink->endFrame(i);
+ {
+ // Depending on type (gpu vs. everything else), we use either a single generator
+ // or one generator per worker thread, respectively.
+ // Scoping is important for the single generator case because we want its destructor to
+ // flush out any pending async operations.
+ std::unique_ptr<FrameGenerator> singleton_generator;
+ if (FLAGS_gpu) {
+ singleton_generator = FrameGenerator::Make(sink.get(), fmt, scale_matrix);
}
- frames_ms[i] = ms_since(start);
- });
-
-#if defined(HAVE_VIDEO_ENCODER)
- if (FLAGS_format.contains("mp4")) {
- SkVideoEncoder enc;
- if (!enc.beginRecording({FLAGS_width, FLAGS_height}, fps)) {
- SkDEBUGF("Invalid video stream configuration.\n");
- return -1;
- }
+ tg.batch(frame_count, [&](int i) {
+ // SkTaskGroup::Enabler creates a LIFO work pool,
+ // but we want our early frames to start first.
+ i = frame_count - 1 - i;
- std::vector<double> starved_ms;
- for (std::promise<sk_sp<SkImage>>& frame : gMP4Frames) {
const auto start = std::chrono::steady_clock::now();
- sk_sp<SkImage> img = frame.get_future().get();
- starved_ms.push_back(ms_since(start));
-
- SkPixmap pm;
- SkAssertResult(img->peekPixels(&pm));
- enc.addFrame(pm);
- }
- sk_sp<SkData> mp4 = enc.endRecording();
-
- SkFILEWStream{FLAGS_writePath[0]}
- .write(mp4->data(), mp4->size());
-
- // If everything's going well, the first frame should account for the most,
- // and ideally nearly all, starvation.
- double first = starved_ms[0];
- std::sort(starved_ms.begin(), starved_ms.end());
- double sum = std::accumulate(starved_ms.begin(), starved_ms.end(), 0);
- SkDebugf("starved min %gms, med %gms, avg %gms, max %gms, sum %gms, first %gms (%s)\n",
- starved_ms[0], starved_ms[frame_count/2], sum/frame_count, starved_ms.back(), sum,
- first, first == starved_ms.back() ? "ok" : "BAD");
+ thread_local static auto* anim =
+ skottie::Animation::Builder()
+ .setResourceProvider(rp)
+ .setPrecompInterceptor(precomp_interceptor)
+ .make(static_cast<const char*>(data->data()), data->size())
+ .release();
+ thread_local static auto* gen = singleton_generator
+ ? singleton_generator.get()
+ : FrameGenerator::Make(sink.get(), fmt, scale_matrix).release();
+
+ if (gen && anim) {
+ anim->seekFrame(frame0 + i * fps_scale);
+ gen->generateFrame(anim, SkToSizeT(i));
+ } else {
+ sink->writeFrame(nullptr, SkToSizeT(i));
+ }
+
+ frames_ms[i] = ms_since(start);
+ });
}
-#endif
+
+ sink->finalize(fps);
tg.wait();
+
std::sort(frames_ms.begin(), frames_ms.end());
double sum = std::accumulate(frames_ms.begin(), frames_ms.end(), 0);
- SkDebugf("frame time min %gms, med %gms, avg %gms, max %gms, sum %gms\n",
- frames_ms[0], frames_ms[frame_count/2], sum/frame_count, frames_ms.back(), sum);
+ printf("Frame time stats: min %gms, med %gms, avg %gms, max %gms, sum %gms\n",
+ frames_ms[0], frames_ms[frame_count/2], sum/frame_count, frames_ms.back(), sum);
+
return 0;
}
diff --git a/chromium/third_party/skia/modules/skottie/src/effects/CornerPinEffect.cpp b/chromium/third_party/skia/modules/skottie/src/effects/CornerPinEffect.cpp
index 1490f0890c7..0719e45c84a 100644
--- a/chromium/third_party/skia/modules/skottie/src/effects/CornerPinEffect.cpp
+++ b/chromium/third_party/skia/modules/skottie/src/effects/CornerPinEffect.cpp
@@ -55,10 +55,10 @@ private:
{ fUR.x, fUR.y},
{ fLR.x, fLR.y},
{ fLL.x, fLL.y}};
- static_assert(SK_ARRAY_COUNT(src) == SK_ARRAY_COUNT(dst));
+ static_assert(std::size(src) == std::size(dst));
SkMatrix m;
- if (m.setPolyToPoly(src, dst, SK_ARRAY_COUNT(src))) {
+ if (m.setPolyToPoly(src, dst, std::size(src))) {
fMatrixNode->setMatrix(m);
}
}
diff --git a/chromium/third_party/skia/modules/skottie/src/effects/DisplacementMapEffect.cpp b/chromium/third_party/skia/modules/skottie/src/effects/DisplacementMapEffect.cpp
index b90e6d49c28..04343e71bdd 100644
--- a/chromium/third_party/skia/modules/skottie/src/effects/DisplacementMapEffect.cpp
+++ b/chromium/third_party/skia/modules/skottie/src/effects/DisplacementMapEffect.cpp
@@ -153,7 +153,7 @@ private:
};
const auto i = static_cast<size_t>(sel);
- SkASSERT(i < SK_ARRAY_COUNT(gCoeffs));
+ SkASSERT(i < std::size(gCoeffs));
return gCoeffs[i];
}
diff --git a/chromium/third_party/skia/modules/skottie/src/effects/Effects.cpp b/chromium/third_party/skia/modules/skottie/src/effects/Effects.cpp
index 1072b1e3f17..434e151aa2c 100644
--- a/chromium/third_party/skia/modules/skottie/src/effects/Effects.cpp
+++ b/chromium/third_party/skia/modules/skottie/src/effects/Effects.cpp
@@ -158,8 +158,8 @@ sk_sp<sksg::RenderNode> EffectBuilder::attachStyles(const skjson::ArrayValue& js
const auto style_type =
ParseDefault<size_t>((*jstyle)["ty"], std::numeric_limits<size_t>::max());
- auto builder = style_type < SK_ARRAY_COUNT(gStyleBuilders) ? gStyleBuilders[style_type]
- : nullptr;
+ auto builder = style_type < std::size(gStyleBuilders) ? gStyleBuilders[style_type]
+ : nullptr;
if (!builder) {
fBuilder->log(Logger::Level::kWarning, jstyle, "Unsupported layer style.");
diff --git a/chromium/third_party/skia/modules/skottie/src/effects/FractalNoiseEffect.cpp b/chromium/third_party/skia/modules/skottie/src/effects/FractalNoiseEffect.cpp
index 8e1711bb87a..8220c542157 100644
--- a/chromium/third_party/skia/modules/skottie/src/effects/FractalNoiseEffect.cpp
+++ b/chromium/third_party/skia/modules/skottie/src/effects/FractalNoiseEffect.cpp
@@ -216,8 +216,8 @@ sk_sp<SkRuntimeEffect> noise_effect() {
gFractalTurbulentSharpSkSL
};
- static_assert(static_cast<size_t>(FILTER) < SK_ARRAY_COUNT(gFilters));
- static_assert(static_cast<size_t>(FRACTAL) < SK_ARRAY_COUNT(gFractals));
+ static_assert(static_cast<size_t>(FILTER) < std::size(gFilters));
+ static_assert(static_cast<size_t>(FRACTAL) < std::size(gFractals));
static const SkRuntimeEffect* effect =
make_noise_effect(LOOPS,
diff --git a/chromium/third_party/skia/modules/skottie/src/effects/GaussianBlurEffect.cpp b/chromium/third_party/skia/modules/skottie/src/effects/GaussianBlurEffect.cpp
index ac1d7c7ee39..8dfea547c96 100644
--- a/chromium/third_party/skia/modules/skottie/src/effects/GaussianBlurEffect.cpp
+++ b/chromium/third_party/skia/modules/skottie/src/effects/GaussianBlurEffect.cpp
@@ -55,7 +55,7 @@ private:
};
const auto dim_index = SkTPin<size_t>(static_cast<size_t>(fDimensions),
- 1, SK_ARRAY_COUNT(kDimensionsMap)) - 1;
+ 1, std::size(kDimensionsMap)) - 1;
const auto sigma = fBlurriness * kBlurSizeToSigma;
@@ -68,7 +68,7 @@ private:
};
const auto repeat_index = SkTPin<size_t>(static_cast<size_t>(fRepeatEdge),
- 0, SK_ARRAY_COUNT(kRepeatEdgeMap) - 1);
+ 0, std::size(kRepeatEdgeMap) - 1);
fBlur->setTileMode(kRepeatEdgeMap[repeat_index]);
}
diff --git a/chromium/third_party/skia/modules/skottie/src/effects/MotionBlurEffect.cpp b/chromium/third_party/skia/modules/skottie/src/effects/MotionBlurEffect.cpp
index 86aae532df5..74579420ea9 100644
--- a/chromium/third_party/skia/modules/skottie/src/effects/MotionBlurEffect.cpp
+++ b/chromium/third_party/skia/modules/skottie/src/effects/MotionBlurEffect.cpp
@@ -222,13 +222,13 @@ void MotionBlurEffect::onRender(SkCanvas* canvas, const RenderContext* ctx) cons
ScopedRenderContext frame_ctx(canvas, ctx);
SkPaint frame_paint;
- const bool isolate_frames = frame_ctx->fBlendMode != SkBlendMode::kSrcOver;
+ const bool isolate_frames = !!frame_ctx->fBlender;
if (isolate_frames) {
frame_paint.setAlphaf(frame_alpha);
frame_paint.setBlendMode(SkBlendMode::kPlus);
} else {
frame_ctx = frame_ctx.modulateOpacity(frame_alpha)
- .modulateBlendMode(SkBlendMode::kPlus);
+ .modulateBlender(SkBlender::Mode(SkBlendMode::kPlus));
}
SkDEBUGCODE(size_t frames_rendered = 0;)
diff --git a/chromium/third_party/skia/modules/skottie/src/effects/MotionTileEffect.cpp b/chromium/third_party/skia/modules/skottie/src/effects/MotionTileEffect.cpp
index f3162817075..971e2df7a80 100644
--- a/chromium/third_party/skia/modules/skottie/src/effects/MotionTileEffect.cpp
+++ b/chromium/third_party/skia/modules/skottie/src/effects/MotionTileEffect.cpp
@@ -108,7 +108,7 @@ protected:
tile.y() + 2 * (tile.height() - phase_vec.fY) }};
auto mask_shader = SkGradientShader::MakeLinear(pts, colors, pos,
- SK_ARRAY_COUNT(colors),
+ std::size(colors),
SkTileMode::kRepeat);
// First drawing pass: in-place masked layer content.
diff --git a/chromium/third_party/skia/modules/skottie/src/effects/RadialWipeEffect.cpp b/chromium/third_party/skia/modules/skottie/src/effects/RadialWipeEffect.cpp
index d36cf14ebd9..5002571b14a 100644
--- a/chromium/third_party/skia/modules/skottie/src/effects/RadialWipeEffect.cpp
+++ b/chromium/third_party/skia/modules/skottie/src/effects/RadialWipeEffect.cpp
@@ -75,7 +75,7 @@ protected:
fMaskShader = SkGradientShader::MakeSweep(fWipeCenter.x(), fWipeCenter.y(),
grad_colors, grad_pos,
- SK_ARRAY_COUNT(grad_colors),
+ std::size(grad_colors),
SkTileMode::kClamp,
a0, a1, 0, nullptr);
diff --git a/chromium/third_party/skia/modules/skottie/src/effects/ShiftChannelsEffect.cpp b/chromium/third_party/skia/modules/skottie/src/effects/ShiftChannelsEffect.cpp
index cbed0be2a50..cf98d2ca360 100644
--- a/chromium/third_party/skia/modules/skottie/src/effects/ShiftChannelsEffect.cpp
+++ b/chromium/third_party/skia/modules/skottie/src/effects/ShiftChannelsEffect.cpp
@@ -87,7 +87,7 @@ private:
{ 0, 0, 0, 0, 1}, // kFullOn
{ 0, 0, 0, 0, 0}, // kFullOff
};
- static_assert(SK_ARRAY_COUNT(gSourceCoeffs) == static_cast<size_t>(Source::kMax), "");
+ static_assert(std::size(gSourceCoeffs) == static_cast<size_t>(Source::kMax), "");
auto coeffs = [](float src) {
// Channel sources are encoded as Source enum values.
diff --git a/chromium/third_party/skia/modules/skottie/src/effects/VenetianBlindsEffect.cpp b/chromium/third_party/skia/modules/skottie/src/effects/VenetianBlindsEffect.cpp
index f21271b8e5d..6e0269fc314 100644
--- a/chromium/third_party/skia/modules/skottie/src/effects/VenetianBlindsEffect.cpp
+++ b/chromium/third_party/skia/modules/skottie/src/effects/VenetianBlindsEffect.cpp
@@ -128,7 +128,7 @@ private:
1 - df1 - df0, // fp3
1,
};
- static_assert(SK_ARRAY_COUNT(colors) == SK_ARRAY_COUNT(pos), "");
+ static_assert(std::size(colors) == std::size(pos), "");
const auto center = SkPoint::Make(0.5f * this->layerSize().width(),
0.5f * this->layerSize().height()),
@@ -141,7 +141,7 @@ private:
};
return {
- SkGradientShader::MakeLinear(pts, colors, pos, SK_ARRAY_COUNT(colors),
+ SkGradientShader::MakeLinear(pts, colors, pos, std::size(colors),
SkTileMode::kRepeat),
true
};
diff --git a/chromium/third_party/skia/modules/skottie/src/layers/shapelayer/FillStroke.cpp b/chromium/third_party/skia/modules/skottie/src/layers/shapelayer/FillStroke.cpp
index 1193219dcdd..73f77f85b28 100644
--- a/chromium/third_party/skia/modules/skottie/src/layers/shapelayer/FillStroke.cpp
+++ b/chromium/third_party/skia/modules/skottie/src/layers/shapelayer/FillStroke.cpp
@@ -49,7 +49,7 @@ public:
};
this->node()->setStrokeJoin(
gJoins[std::min<size_t>(ParseDefault<size_t>(jpaint["lj"], 1) - 1,
- SK_ARRAY_COUNT(gJoins) - 1)]);
+ std::size(gJoins) - 1)]);
static constexpr SkPaint::Cap gCaps[] = {
SkPaint::kButt_Cap,
@@ -58,7 +58,7 @@ public:
};
this->node()->setStrokeCap(
gCaps[std::min<size_t>(ParseDefault<size_t>(jpaint["lc"], 1) - 1,
- SK_ARRAY_COUNT(gCaps) - 1)]);
+ std::size(gCaps) - 1)]);
}
if (fShaderType == ShaderType::kColor) {
diff --git a/chromium/third_party/skia/modules/skottie/src/layers/shapelayer/MergePaths.cpp b/chromium/third_party/skia/modules/skottie/src/layers/shapelayer/MergePaths.cpp
index e2e41d6bab7..b2bcd9cc4e2 100644
--- a/chromium/third_party/skia/modules/skottie/src/layers/shapelayer/MergePaths.cpp
+++ b/chromium/third_party/skia/modules/skottie/src/layers/shapelayer/MergePaths.cpp
@@ -39,7 +39,7 @@ std::vector<sk_sp<sksg::GeometryNode>> ShapeBuilder::AttachMergeGeometryEffect(
};
const auto mode = gModes[std::min<size_t>(ParseDefault<size_t>(jmerge["mm"], 1) - 1,
- SK_ARRAY_COUNT(gModes) - 1)];
+ std::size(gModes) - 1)];
std::vector<sk_sp<sksg::GeometryNode>> merged;
merged.push_back(ShapeBuilder::MergeGeometry(std::move(geos), mode));
diff --git a/chromium/third_party/skia/modules/skottie/src/layers/shapelayer/OffsetPaths.cpp b/chromium/third_party/skia/modules/skottie/src/layers/shapelayer/OffsetPaths.cpp
index d50f308a3f7..ca22591488a 100644
--- a/chromium/third_party/skia/modules/skottie/src/layers/shapelayer/OffsetPaths.cpp
+++ b/chromium/third_party/skia/modules/skottie/src/layers/shapelayer/OffsetPaths.cpp
@@ -31,7 +31,7 @@ public:
};
const auto join = ParseDefault<int>(joffset["lj"], 1) - 1;
- this->node()->setJoin(gJoinMap[SkTPin<int>(join, 0, SK_ARRAY_COUNT(gJoinMap) - 1)]);
+ this->node()->setJoin(gJoinMap[SkTPin<int>(join, 0, std::size(gJoinMap) - 1)]);
this->bind(abuilder, joffset["a" ], fAmount);
this->bind(abuilder, joffset["ml"], fMiterLimit);
diff --git a/chromium/third_party/skia/modules/skottie/src/layers/shapelayer/Polystar.cpp b/chromium/third_party/skia/modules/skottie/src/layers/shapelayer/Polystar.cpp
index f573f349cae..f77d8433ab3 100644
--- a/chromium/third_party/skia/modules/skottie/src/layers/shapelayer/Polystar.cpp
+++ b/chromium/third_party/skia/modules/skottie/src/layers/shapelayer/Polystar.cpp
@@ -90,7 +90,7 @@ sk_sp<sksg::GeometryNode> ShapeBuilder::AttachPolystarGeometry(const skjson::Obj
};
const auto type = ParseDefault<size_t>(jstar["sy"], 0) - 1;
- if (type >= SK_ARRAY_COUNT(gTypes)) {
+ if (type >= std::size(gTypes)) {
abuilder->log(Logger::Level::kError, &jstar, "Unknown polystar type.");
return nullptr;
}
diff --git a/chromium/third_party/skia/modules/skottie/src/layers/shapelayer/ShapeLayer.cpp b/chromium/third_party/skia/modules/skottie/src/layers/shapelayer/ShapeLayer.cpp
index 04bbc87f0f1..f1584f5c081 100644
--- a/chromium/third_party/skia/modules/skottie/src/layers/shapelayer/ShapeLayer.cpp
+++ b/chromium/third_party/skia/modules/skottie/src/layers/shapelayer/ShapeLayer.cpp
@@ -67,7 +67,7 @@ static constexpr GeometryEffectAttacherT gPaintGeometryAdjusters[] = {
nullptr, // gradient fill
ShapeBuilder::AdjustStrokeGeometry, // gradient stroke
};
-static_assert(SK_ARRAY_COUNT(gPaintGeometryAdjusters) == SK_ARRAY_COUNT(gPaintAttachers), "");
+static_assert(std::size(gPaintGeometryAdjusters) == std::size(gPaintAttachers), "");
using DrawEffectAttacherT =
std::vector<sk_sp<sksg::RenderNode>> (*)(const skjson::ObjectValue&,
@@ -126,7 +126,7 @@ const ShapeInfo* FindShapeInfo(const skjson::ObjectValue& jshape) {
const auto* info = bsearch(type->begin(),
gShapeInfo,
- SK_ARRAY_COUNT(gShapeInfo),
+ std::size(gShapeInfo),
sizeof(ShapeInfo),
[](const void* key, const void* info) {
return strcmp(static_cast<const char*>(key),
@@ -210,7 +210,7 @@ sk_sp<sksg::RenderNode> AnimationBuilder::attachShape(const skjson::ArrayValue*
jtransform = shape;
break;
case ShapeType::kGeometryEffect:
- SkASSERT(info->fAttacherIndex < SK_ARRAY_COUNT(gGeometryEffectAttachers));
+ SkASSERT(info->fAttacherIndex < std::size(gGeometryEffectAttachers));
ctx->fGeometryEffectStack->push_back(
{ *shape, gGeometryEffectAttachers[info->fAttacherIndex] });
break;
@@ -237,14 +237,14 @@ sk_sp<sksg::RenderNode> AnimationBuilder::attachShape(const skjson::ArrayValue*
switch (rec->fInfo.fShapeType) {
case ShapeType::kGeometry: {
- SkASSERT(rec->fInfo.fAttacherIndex < SK_ARRAY_COUNT(gGeometryAttachers));
+ SkASSERT(rec->fInfo.fAttacherIndex < std::size(gGeometryAttachers));
if (auto geo = gGeometryAttachers[rec->fInfo.fAttacherIndex](rec->fJson, this)) {
geos.push_back(std::move(geo));
}
} break;
case ShapeType::kGeometryEffect: {
// Apply the current effect and pop from the stack.
- SkASSERT(rec->fInfo.fAttacherIndex < SK_ARRAY_COUNT(gGeometryEffectAttachers));
+ SkASSERT(rec->fInfo.fAttacherIndex < std::size(gGeometryEffectAttachers));
if (!geos.empty()) {
geos = gGeometryEffectAttachers[rec->fInfo.fAttacherIndex](rec->fJson,
this,
@@ -268,7 +268,7 @@ sk_sp<sksg::RenderNode> AnimationBuilder::attachShape(const skjson::ArrayValue*
}
} break;
case ShapeType::kPaint: {
- SkASSERT(rec->fInfo.fAttacherIndex < SK_ARRAY_COUNT(gPaintAttachers));
+ SkASSERT(rec->fInfo.fAttacherIndex < std::size(gPaintAttachers));
auto paint = gPaintAttachers[rec->fInfo.fAttacherIndex](rec->fJson, this);
if (!paint || geos.empty() || rec->fSuppressed)
break;
@@ -282,7 +282,7 @@ sk_sp<sksg::RenderNode> AnimationBuilder::attachShape(const skjson::ArrayValue*
}
// Apply local paint geometry adjustments (e.g. dashing).
- SkASSERT(rec->fInfo.fAttacherIndex < SK_ARRAY_COUNT(gPaintGeometryAdjusters));
+ SkASSERT(rec->fInfo.fAttacherIndex < std::size(gPaintGeometryAdjusters));
if (const auto adjuster = gPaintGeometryAdjusters[rec->fInfo.fAttacherIndex]) {
drawGeos = adjuster(rec->fJson, this, std::move(drawGeos));
}
@@ -297,7 +297,7 @@ sk_sp<sksg::RenderNode> AnimationBuilder::attachShape(const skjson::ArrayValue*
ctx->fCommittedAnimators = fCurrentAnimatorScope->size();
} break;
case ShapeType::kDrawEffect: {
- SkASSERT(rec->fInfo.fAttacherIndex < SK_ARRAY_COUNT(gDrawEffectAttachers));
+ SkASSERT(rec->fInfo.fAttacherIndex < std::size(gDrawEffectAttachers));
if (!draws.empty()) {
draws = gDrawEffectAttachers[rec->fInfo.fAttacherIndex](rec->fJson,
this,
diff --git a/chromium/third_party/skia/modules/skottie/src/layers/shapelayer/TrimPaths.cpp b/chromium/third_party/skia/modules/skottie/src/layers/shapelayer/TrimPaths.cpp
index bc2dc153a05..cdf814b1cce 100644
--- a/chromium/third_party/skia/modules/skottie/src/layers/shapelayer/TrimPaths.cpp
+++ b/chromium/third_party/skia/modules/skottie/src/layers/shapelayer/TrimPaths.cpp
@@ -81,7 +81,7 @@ std::vector<sk_sp<sksg::GeometryNode>> ShapeBuilder::AttachTrimGeometryEffect(
} gModes[] = { Mode::kParallel, Mode::kSerial};
const auto mode = gModes[std::min<size_t>(ParseDefault<size_t>(jtrim["m"], 1) - 1,
- SK_ARRAY_COUNT(gModes) - 1)];
+ std::size(gModes) - 1)];
std::vector<sk_sp<sksg::GeometryNode>> inputs;
if (mode == Mode::kSerial) {
diff --git a/chromium/third_party/skia/modules/skottie/src/text/RangeSelector.cpp b/chromium/third_party/skia/modules/skottie/src/text/RangeSelector.cpp
index 47c81574e63..9d9316db972 100644
--- a/chromium/third_party/skia/modules/skottie/src/text/RangeSelector.cpp
+++ b/chromium/third_party/skia/modules/skottie/src/text/RangeSelector.cpp
@@ -28,7 +28,7 @@ T ParseEnum(const TArray& arr, const skjson::Value& jenum,
const auto idx = ParseDefault<int>(jenum, 1);
- if (idx > 0 && SkToSizeT(idx) <= SK_ARRAY_COUNT(arr)) {
+ if (idx > 0 && SkToSizeT(idx) <= std::size(arr)) {
return arr[idx - 1];
}
@@ -39,7 +39,7 @@ T ParseEnum(const TArray& arr, const skjson::Value& jenum,
"Ignoring unknown range selector %s '%d'", warn_name, idx);
}
- static_assert(SK_ARRAY_COUNT(arr) > 0, "");
+ SkASSERT(std::size(arr) > 0);
return arr[0];
}
@@ -363,7 +363,7 @@ void RangeSelector::modulateCoverage(const TextAnimator::DomainMaps& maps,
auto r0 = std::get<0>(range),
len = std::max(std::get<1>(range) - r0, std::numeric_limits<float>::epsilon());
- SkASSERT(static_cast<size_t>(fShape) < SK_ARRAY_COUNT(gShapeInfo));
+ SkASSERT(static_cast<size_t>(fShape) < std::size(gShapeInfo));
ShapeGenerator gen(gShapeInfo[static_cast<size_t>(fShape)], ease_lo, ease_hi);
if (fShape == Shape::kSquare) {
diff --git a/chromium/third_party/skia/modules/skottie/src/text/SkottieShaper.cpp b/chromium/third_party/skia/modules/skottie/src/text/SkottieShaper.cpp
index 752ba0cdbf2..a12bbb756ef 100644
--- a/chromium/third_party/skia/modules/skottie/src/text/SkottieShaper.cpp
+++ b/chromium/third_party/skia/modules/skottie/src/text/SkottieShaper.cpp
@@ -7,15 +7,15 @@
#include "modules/skottie/src/text/SkottieShaper.h"
+#include "include/core/SkCanvas.h"
#include "include/core/SkFontMetrics.h"
#include "include/core/SkFontMgr.h"
-#include "include/core/SkTextBlob.h"
#include "include/private/SkTPin.h"
#include "include/private/SkTemplates.h"
#include "modules/skshaper/include/SkShaper.h"
#include "modules/skunicode/include/SkUnicode.h"
+#include "src/core/SkFontPriv.h"
#include "src/core/SkTLazy.h"
-#include "src/core/SkTextBlobPriv.h"
#include "src/utils/SkUTF.h"
#include <algorithm>
@@ -25,29 +25,6 @@
namespace skottie {
namespace {
-SkRect ComputeBlobBounds(const sk_sp<SkTextBlob>& blob) {
- auto bounds = SkRect::MakeEmpty();
-
- if (!blob) {
- return bounds;
- }
-
- SkAutoSTArray<16, SkRect> glyphBounds;
-
- for (SkTextBlobRunIterator it(blob.get()); !it.done(); it.next()) {
- glyphBounds.reset(SkToInt(it.glyphCount()));
- it.font().getBounds(it.glyphs(), it.glyphCount(), glyphBounds.get(), nullptr);
-
- SkASSERT(it.positioning() == SkTextBlobRunIterator::kFull_Positioning);
- for (uint32_t i = 0; i < it.glyphCount(); ++i) {
- bounds.join(glyphBounds[i].makeOffset(it.pos()[i * 2 ],
- it.pos()[i * 2 + 1]));
- }
- }
-
- return bounds;
-}
-
static bool is_whitespace(char c) {
// TODO: we've been getting away with this simple heuristic,
// but ideally we should use SkUicode::isWhiteSpace().
@@ -56,9 +33,9 @@ static bool is_whitespace(char c) {
// Helper for interfacing with SkShaper: buffers shaper-fed runs and performs
// per-line position adjustments (for external line breaking, horizontal alignment, etc).
-class BlobMaker final : public SkShaper::RunHandler {
+class ResultBuilder final : public SkShaper::RunHandler {
public:
- BlobMaker(const Shaper::TextDesc& desc, const SkRect& box, const sk_sp<SkFontMgr>& fontmgr)
+ ResultBuilder(const Shaper::TextDesc& desc, const SkRect& box, const sk_sp<SkFontMgr>& fontmgr)
: fDesc(desc)
, fBox(box)
, fHAlignFactor(HAlignFactor(fDesc.fHAlign))
@@ -139,7 +116,7 @@ public:
// Technically, trailing whitespace could span multiple runs, but realistically,
// SkShaper has no reason to split it. Hence we're only checking the last run.
size_t ws_count = 0;
- for (size_t i = 0; i < fLineRuns.back().fGlyphCount; ++i) {
+ for (size_t i = 0; i < fLineRuns.back().fSize; ++i) {
if (is_whitespace(fUTF8[fLineClusters[SkToInt(fLineGlyphCount - i - 1)]])) {
++ws_count;
} else {
@@ -174,8 +151,8 @@ public:
adjust_trailing_whitespace();
const auto commit_proc = (fDesc.fFlags & Shaper::Flags::kFragmentGlyphs)
- ? &BlobMaker::commitFragementedRun
- : &BlobMaker::commitConsolidatedRun;
+ ? &ResultBuilder::commitFragementedRun
+ : &ResultBuilder::commitConsolidatedRun;
size_t run_offset = 0;
for (const auto& rec : fLineRuns) {
@@ -185,7 +162,7 @@ public:
fLinePos.get() + run_offset,
fLineClusters.get() + run_offset,
fLineCount);
- run_offset += rec.fGlyphCount;
+ run_offset += rec.fSize;
}
fLineCount++;
@@ -193,10 +170,8 @@ public:
Shaper::Result finalize(SkSize* shaped_size) {
if (!(fDesc.fFlags & Shaper::Flags::kFragmentGlyphs)) {
- // All glyphs are pending in a single blob.
- SkASSERT(fResult.fFragments.empty());
- fResult.fFragments.reserve(1);
- fResult.fFragments.push_back({fBuilder.make(), {fBox.x(), fBox.y()}, 0, 0, 0, false});
+ // All glyphs (if any) are pending in a single fragment.
+ SkASSERT(fResult.fFragments.size() <= 1);
}
const auto ascent = this->ascent();
@@ -262,7 +237,7 @@ public:
if (v_offset) {
for (auto& fragment : fResult.fFragments) {
- fragment.fPos.fY += v_offset;
+ fragment.fOrigin.fY += v_offset;
}
}
@@ -303,12 +278,7 @@ public:
}
private:
- struct RunRec {
- SkFont fFont;
- size_t fGlyphCount;
- };
-
- void commitFragementedRun(const RunRec& rec,
+ void commitFragementedRun(const skottie::Shaper::RunRec& run,
const SkGlyphID* glyphs,
const SkPoint* pos,
const uint32_t* clusters,
@@ -317,53 +287,62 @@ private:
if (fDesc.fFlags & Shaper::Flags::kTrackFragmentAdvanceAscent) {
SkFontMetrics metrics;
- rec.fFont.getMetrics(&metrics);
+ run.fFont.getMetrics(&metrics);
ascent = metrics.fAscent;
// Note: we use per-glyph advances for anchoring, but it's unclear whether this
// is exactly the same as AE. E.g. are 'acute' glyphs anchored separately for fonts
// in which they're distinct?
- fAdvanceBuffer.resize(rec.fGlyphCount);
- fFont.getWidths(glyphs, SkToInt(rec.fGlyphCount), fAdvanceBuffer.data());
+ fAdvanceBuffer.resize(run.fSize);
+ fFont.getWidths(glyphs, SkToInt(run.fSize), fAdvanceBuffer.data());
}
// In fragmented mode we immediately push the glyphs to fResult,
- // one fragment (blob) per glyph. Glyph positioning is externalized
+ // one fragment per glyph. Glyph positioning is externalized
// (positions returned in Fragment::fPos).
- for (size_t i = 0; i < rec.fGlyphCount; ++i) {
- const auto& blob_buffer = fBuilder.allocRunPos(rec.fFont, 1);
- blob_buffer.glyphs[0] = glyphs[i];
- blob_buffer.pos[0] = blob_buffer.pos[1] = 0;
-
+ for (size_t i = 0; i < run.fSize; ++i) {
const auto advance = (fDesc.fFlags & Shaper::Flags::kTrackFragmentAdvanceAscent)
? fAdvanceBuffer[SkToInt(i)]
: 0.0f;
+ fResult.fFragments.push_back({
+ {
+ { {run.fFont, 1} },
+ { glyphs[i] },
+ { {0,0} },
+ },
+ { fBox.x() + pos[i].fX, fBox.y() + pos[i].fY },
+ advance, ascent,
+ line_index, is_whitespace(fUTF8[clusters[i]])
+ });
+
// Note: we only check the first code point in the cluster for whitespace.
// It's unclear whether thers's a saner approach.
- fResult.fFragments.push_back({fBuilder.make(),
- { fBox.x() + pos[i].fX, fBox.y() + pos[i].fY },
- advance, ascent,
- line_index, is_whitespace(fUTF8[clusters[i]])
- });
fResult.fMissingGlyphCount += (glyphs[i] == kMissingGlyphID);
}
}
- void commitConsolidatedRun(const RunRec& rec,
+ void commitConsolidatedRun(const skottie::Shaper::RunRec& run,
const SkGlyphID* glyphs,
const SkPoint* pos,
const uint32_t*,
uint32_t) {
- // In consolidated mode we just accumulate glyphs to the blob builder, then push
- // to fResult as a single blob in finalize(). Glyph positions are baked in the
- // blob (Fragment::fPos only reflects the box origin).
- const auto& blob_buffer = fBuilder.allocRunPos(rec.fFont, rec.fGlyphCount);
- for (size_t i = 0; i < rec.fGlyphCount; ++i) {
- blob_buffer.glyphs[i] = glyphs[i];
+ // In consolidated mode we just accumulate glyphs to a single fragment in ResultBuilder.
+ // Glyph positions are baked in the fragment runs (Fragment::fPos only reflects the
+ // box origin).
+
+ if (fResult.fFragments.empty()) {
+ fResult.fFragments.push_back({{{}, {}, {}}, {fBox.x(), fBox.y()}, 0, 0, 0, false});
+ }
+
+ auto& current_glyphs = fResult.fFragments.back().fGlyphs;
+ current_glyphs.fRuns.push_back(run);
+ current_glyphs.fGlyphIDs.insert(current_glyphs.fGlyphIDs.end(), glyphs, glyphs + run.fSize);
+ current_glyphs.fGlyphPos.insert(current_glyphs.fGlyphPos.end(), pos , pos + run.fSize);
+
+ for (size_t i = 0; i < run.fSize; ++i) {
fResult.fMissingGlyphCount += (glyphs[i] == kMissingGlyphID);
}
- sk_careful_memcpy(blob_buffer.pos, pos, rec.fGlyphCount * sizeof(SkPoint));
}
static float HAlignFactor(SkTextUtils::Align align) {
@@ -388,16 +367,15 @@ private:
const float fHAlignFactor;
SkFont fFont;
- SkTextBlobBuilder fBuilder;
std::unique_ptr<SkShaper> fShaper;
- SkAutoSTMalloc<64, SkGlyphID> fLineGlyphs;
- SkAutoSTMalloc<64, SkPoint> fLinePos;
- SkAutoSTMalloc<64, uint32_t> fLineClusters;
- SkSTArray<16, RunRec> fLineRuns;
- size_t fLineGlyphCount = 0;
+ SkAutoSTMalloc<64, SkGlyphID> fLineGlyphs;
+ SkAutoSTMalloc<64, SkPoint> fLinePos;
+ SkAutoSTMalloc<64, uint32_t> fLineClusters;
+ SkSTArray<16, skottie::Shaper::RunRec> fLineRuns;
+ size_t fLineGlyphCount = 0;
- SkSTArray<64, float, true> fAdvanceBuffer;
+ SkSTArray<64, float, true> fAdvanceBuffer;
SkPoint fCurrentPosition{ 0, 0 };
SkPoint fOffset{ 0, 0 };
@@ -423,16 +401,16 @@ Shaper::Result ShapeImpl(const SkString& txt, const Shaper::TextDesc& desc,
const char* line_start = ptr;
const char* end = ptr + txt.size();
- BlobMaker blobMaker(desc, box, fontmgr);
+ ResultBuilder rbuilder(desc, box, fontmgr);
while (ptr < end) {
if (is_line_break(SkUTF::NextUTF8(&ptr, end))) {
- blobMaker.shapeLine(line_start, ptr - 1);
+ rbuilder.shapeLine(line_start, ptr - 1);
line_start = ptr;
}
}
- blobMaker.shapeLine(line_start, ptr);
+ rbuilder.shapeLine(line_start, ptr);
- return blobMaker.finalize(shaped_size);
+ return rbuilder.finalize(shaped_size);
}
bool result_fits(const Shaper::Result& res, const SkSize& res_size,
@@ -573,12 +551,72 @@ Shaper::Result Shaper::Shape(const SkString& orig_txt, const TextDesc& desc, con
SkUNREACHABLE;
}
+SkRect Shaper::ShapedGlyphs::computeBounds(BoundsType btype) const {
+ auto bounds = SkRect::MakeEmpty();
+
+ SkAutoSTArray<16, SkRect> glyphBounds;
+
+ size_t offset = 0;
+ for (const auto& run : fRuns) {
+ SkRect font_bounds;
+ if (btype == BoundsType::kConservative) {
+ font_bounds = SkFontPriv::GetFontBounds(run.fFont);
+
+ // Empty font bounds is likely a font bug -- fall back to tight bounds.
+ if (font_bounds.isEmpty()) {
+ btype = BoundsType::kTight;
+ }
+ }
+
+ switch (btype) {
+ case BoundsType::kConservative: {
+ SkRect run_bounds;
+ run_bounds.setBounds(fGlyphPos.data() + offset, SkToInt(run.fSize));
+ run_bounds.fLeft += font_bounds.left();
+ run_bounds.fTop += font_bounds.top();
+ run_bounds.fRight += font_bounds.right();
+ run_bounds.fBottom += font_bounds.bottom();
+
+ bounds.join(run_bounds);
+ } break;
+ case BoundsType::kTight: {
+ glyphBounds.reset(SkToInt(run.fSize));
+ run.fFont.getBounds(fGlyphIDs.data() + offset,
+ SkToInt(run.fSize), glyphBounds.data(), nullptr);
+
+ for (size_t i = 0; i < run.fSize; ++i) {
+ bounds.join(glyphBounds[SkToInt(i)].makeOffset(fGlyphPos[offset + i]));
+ }
+ } break;
+ }
+
+ offset += run.fSize;
+ }
+
+ return bounds;
+}
+
+void Shaper::ShapedGlyphs::draw(SkCanvas* canvas,
+ const SkPoint& origin,
+ const SkPaint& paint) const {
+ size_t offset = 0;
+ for (const auto& run : fRuns) {
+ canvas->drawGlyphs(SkToInt(run.fSize),
+ fGlyphIDs.data() + offset,
+ fGlyphPos.data() + offset,
+ origin,
+ run.fFont,
+ paint);
+ offset += run.fSize;
+ }
+}
+
SkRect Shaper::Result::computeVisualBounds() const {
auto bounds = SkRect::MakeEmpty();
- for (const auto& fragment : fFragments) {
- bounds.join(ComputeBlobBounds(fragment.fBlob).makeOffset(fragment.fPos.x(),
- fragment.fPos.y()));
+ for (const auto& frag: fFragments) {
+ bounds.join(frag.fGlyphs.computeBounds(ShapedGlyphs::BoundsType::kTight)
+ .makeOffset(frag.fOrigin));
}
return bounds;
diff --git a/chromium/third_party/skia/modules/skottie/src/text/SkottieShaper.h b/chromium/third_party/skia/modules/skottie/src/text/SkottieShaper.h
index 294ba2d9616..a92b16eb9f7 100644
--- a/chromium/third_party/skia/modules/skottie/src/text/SkottieShaper.h
+++ b/chromium/third_party/skia/modules/skottie/src/text/SkottieShaper.h
@@ -8,14 +8,16 @@
#ifndef SkottieShaper_DEFINED
#define SkottieShaper_DEFINED
+#include "include/core/SkFont.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRefCnt.h"
+#include "include/core/SkTextBlob.h"
#include "include/utils/SkTextUtils.h"
#include <vector>
+class SkCanvas;
class SkFontMgr;
-class SkTextBlob;
class SkTypeface;
class SkString;
@@ -27,16 +29,34 @@ namespace skottie {
class Shaper final {
public:
+ struct RunRec {
+ SkFont fFont;
+ size_t fSize;
+ };
+
+ struct ShapedGlyphs {
+ std::vector<RunRec> fRuns;
+
+ // Consolidated storage for all runs.
+ std::vector<SkGlyphID> fGlyphIDs;
+ std::vector<SkPoint> fGlyphPos;
+
+ enum class BoundsType { kConservative, kTight };
+ SkRect computeBounds(BoundsType) const;
+
+ void draw(SkCanvas*, const SkPoint& origin, const SkPaint&) const;
+ };
+
struct Fragment {
- sk_sp<SkTextBlob> fBlob;
- SkPoint fPos;
+ ShapedGlyphs fGlyphs;
+ SkPoint fOrigin;
// Only valid for kFragmentGlyphs
- float fAdvance,
- fAscent;
- uint32_t fLineIndex; // 0-based index for the line this fragment belongs to.
- bool fIsWhitespace; // True if the first code point in the corresponding
- // cluster is whitespace.
+ float fAdvance,
+ fAscent;
+ uint32_t fLineIndex; // 0-based index for the line this fragment belongs to.
+ bool fIsWhitespace; // True if the first code point in the corresponding
+ // cluster is whitespace.
};
struct Result {
diff --git a/chromium/third_party/skia/modules/skottie/src/text/TextAdapter.cpp b/chromium/third_party/skia/modules/skottie/src/text/TextAdapter.cpp
index c918f5d242d..f28e669b533 100644
--- a/chromium/third_party/skia/modules/skottie/src/text/TextAdapter.cpp
+++ b/chromium/third_party/skia/modules/skottie/src/text/TextAdapter.cpp
@@ -7,6 +7,7 @@
#include "modules/skottie/src/text/TextAdapter.h"
+#include "include/core/SkCanvas.h"
#include "include/core/SkContourMeasure.h"
#include "include/core/SkFontMgr.h"
#include "include/core/SkM44.h"
@@ -15,12 +16,12 @@
#include "modules/skottie/src/text/RangeSelector.h"
#include "modules/skottie/src/text/TextAnimator.h"
#include "modules/sksg/include/SkSGDraw.h"
+#include "modules/sksg/include/SkSGGeometryNode.h"
#include "modules/sksg/include/SkSGGroup.h"
#include "modules/sksg/include/SkSGPaint.h"
#include "modules/sksg/include/SkSGPath.h"
#include "modules/sksg/include/SkSGRect.h"
#include "modules/sksg/include/SkSGRenderEffect.h"
-#include "modules/sksg/include/SkSGText.h"
#include "modules/sksg/include/SkSGTransform.h"
// Enable for text layout debugging.
@@ -28,6 +29,38 @@
namespace skottie::internal {
+class GlyphTextNode final : public sksg::GeometryNode {
+public:
+ explicit GlyphTextNode(skottie::Shaper::ShapedGlyphs&& glyphs) : fGlyphs(std::move(glyphs)) {}
+
+ ~GlyphTextNode() override = default;
+
+protected:
+ SkRect onRevalidate(sksg::InvalidationController*, const SkMatrix&) override {
+ return fGlyphs.computeBounds(Shaper::ShapedGlyphs::BoundsType::kConservative);
+ }
+
+ void onDraw(SkCanvas* canvas, const SkPaint& paint) const override {
+ fGlyphs.draw(canvas, {0,0}, paint);
+ }
+
+ void onClip(SkCanvas* canvas, bool antiAlias) const override {
+ canvas->clipPath(this->asPath(), antiAlias);
+ }
+
+ bool onContains(const SkPoint& p) const override {
+ return this->asPath().contains(p.x(), p.y());
+ }
+
+ SkPath onAsPath() const override {
+ // TODO
+ return SkPath();
+ }
+
+private:
+ const skottie::Shaper::ShapedGlyphs fGlyphs;
+};
+
static float align_factor(SkTextUtils::Align a) {
switch (a) {
case SkTextUtils::kLeft_Align : return 0.0f;
@@ -216,7 +249,7 @@ sk_sp<TextAdapter> TextAdapter::Make(const skjson::ObjectValue& jlayer,
AnchorPointGrouping::kAll, // 'g': 4
};
const auto apg = jm
- ? SkTPin<int>(ParseDefault<int>((*jm)["g"], 1), 1, SK_ARRAY_COUNT(gGroupingMap))
+ ? SkTPin<int>(ParseDefault<int>((*jm)["g"], 1), 1, std::size(gGroupingMap))
: 1;
auto adapter = sk_sp<TextAdapter>(new TextAdapter(std::move(fontmgr),
@@ -300,7 +333,7 @@ TextAdapter::TextAdapter(sk_sp<SkFontMgr> fontmgr, sk_sp<Logger> logger, AnchorP
TextAdapter::~TextAdapter() = default;
-void TextAdapter::addFragment(const Shaper::Fragment& frag) {
+void TextAdapter::addFragment(Shaper::Fragment& frag) {
// For a given shaped fragment, build a corresponding SG fragment:
//
// [TransformEffect] -> [Transform]
@@ -310,13 +343,14 @@ void TextAdapter::addFragment(const Shaper::Fragment& frag) {
//
// * where the blob node is shared
- auto blob_node = sksg::TextBlob::Make(frag.fBlob);
+ auto text_node = sk_make_sp<GlyphTextNode>(std::move(frag.fGlyphs));
FragmentRec rec;
- rec.fOrigin = frag.fPos;
+ rec.fOrigin = frag.fOrigin;
rec.fAdvance = frag.fAdvance;
rec.fAscent = frag.fAscent;
- rec.fMatrixNode = sksg::Matrix<SkM44>::Make(SkM44::Translate(frag.fPos.x(), frag.fPos.y()));
+ rec.fMatrixNode = sksg::Matrix<SkM44>::Make(SkM44::Translate(frag.fOrigin.x(),
+ frag.fOrigin.y()));
std::vector<sk_sp<sksg::RenderNode>> draws;
draws.reserve(static_cast<size_t>(fText->fHasFill) + static_cast<size_t>(fText->fHasStroke));
@@ -327,7 +361,7 @@ void TextAdapter::addFragment(const Shaper::Fragment& frag) {
if (fText->fHasFill) {
rec.fFillColorNode = sksg::Color::Make(fText->fFillColor);
rec.fFillColorNode->setAntiAlias(true);
- draws.push_back(sksg::Draw::Make(blob_node, rec.fFillColorNode));
+ draws.push_back(sksg::Draw::Make(text_node, rec.fFillColorNode));
}
};
auto add_stroke = [&] {
@@ -337,7 +371,7 @@ void TextAdapter::addFragment(const Shaper::Fragment& frag) {
rec.fStrokeColorNode->setStyle(SkPaint::kStroke_Style);
rec.fStrokeColorNode->setStrokeWidth(fText->fStrokeWidth * fTextShapingScale);
rec.fStrokeColorNode->setStrokeJoin(fText->fStrokeJoin);
- draws.push_back(sksg::Draw::Make(blob_node, rec.fStrokeColorNode));
+ draws.push_back(sksg::Draw::Make(text_node, rec.fStrokeColorNode));
}
};
@@ -476,7 +510,7 @@ void TextAdapter::reshape() {
fText->fMaxLines,
this->shaperFlags(),
};
- const auto shape_result = Shaper::Shape(fText->fText, text_desc, fText->fBox, fFontMgr);
+ auto shape_result = Shaper::Shape(fText->fText, text_desc, fText->fBox, fFontMgr);
if (fLogger) {
if (shape_result.fFragments.empty() && fText->fText.size() > 0) {
@@ -507,15 +541,6 @@ void TextAdapter::reshape() {
fRoot->clear();
fFragments.clear();
- for (const auto& frag : shape_result.fFragments) {
- this->addFragment(frag);
- }
-
- if (!fAnimators.empty() || fPathInfo) {
- // Range selectors and text paths require fragment domain maps.
- this->buildDomainMaps(shape_result);
- }
-
if (SHOW_LAYOUT_BOXES) {
auto box_color = sksg::Color::Make(0xffff0000);
box_color->setStyle(SkPaint::kStroke_Style);
@@ -543,6 +568,17 @@ void TextAdapter::reshape() {
std::move(path_color)));
}
}
+
+ // N.B. addFragment moves shaped glyph data out of the fragment, so only the fragment
+ // metrics are valid after this block.
+ for (auto& frag : shape_result.fFragments) {
+ this->addFragment(frag);
+ }
+
+ if (!fAnimators.empty() || fPathInfo) {
+ // Range selectors and text paths require fragment domain maps.
+ this->buildDomainMaps(shape_result);
+ }
}
void TextAdapter::onSync() {
diff --git a/chromium/third_party/skia/modules/skottie/src/text/TextAdapter.h b/chromium/third_party/skia/modules/skottie/src/text/TextAdapter.h
index 1dabf09be28..6c166f980cd 100644
--- a/chromium/third_party/skia/modules/skottie/src/text/TextAdapter.h
+++ b/chromium/third_party/skia/modules/skottie/src/text/TextAdapter.h
@@ -65,7 +65,7 @@ private:
};
void reshape();
- void addFragment(const Shaper::Fragment&);
+ void addFragment(Shaper::Fragment&);
void buildDomainMaps(const Shaper::Result&);
void pushPropsToFragment(const TextAnimator::ResolvedProps&, const FragmentRec&,
diff --git a/chromium/third_party/skia/modules/skottie/src/text/TextValue.cpp b/chromium/third_party/skia/modules/skottie/src/text/TextValue.cpp
index 5db03cf2211..d62c48eca23 100644
--- a/chromium/third_party/skia/modules/skottie/src/text/TextValue.cpp
+++ b/chromium/third_party/skia/modules/skottie/src/text/TextValue.cpp
@@ -46,7 +46,7 @@ bool Parse(const skjson::Value& jv, const internal::AnimationBuilder& abuilder,
SkTextUtils::kCenter_Align // 'j': 2
};
v->fHAlign = gAlignMap[std::min<size_t>(ParseDefault<size_t>((*jtxt)["j"], 0),
- SK_ARRAY_COUNT(gAlignMap) - 1)];
+ std::size(gAlignMap) - 1)];
// Optional text box size.
if (const skjson::ArrayValue* jsz = (*jtxt)["sz"]) {
@@ -72,7 +72,7 @@ bool Parse(const skjson::Value& jv, const internal::AnimationBuilder& abuilder,
// TODO: remove "sk_rs" support after migrating clients.
v->fResize = gResizeMap[std::min(std::max(ParseDefault<size_t>((*jtxt)[ "rs"], 0),
ParseDefault<size_t>((*jtxt)["sk_rs"], 0)),
- SK_ARRAY_COUNT(gResizeMap) - 1)];
+ std::size(gResizeMap) - 1)];
// Optional min/max font size and line count (used when aute-resizing)
v->fMinTextSize = ParseDefault<SkScalar>((*jtxt)["mf"], 0.0f);
@@ -100,7 +100,7 @@ bool Parse(const skjson::Value& jv, const internal::AnimationBuilder& abuilder,
Shaper::Capitalization::kUpperCase, // 'ca': 1
};
v->fCapitalization = gCapMap[std::min<size_t>(ParseDefault<size_t>((*jtxt)["ca"], 0),
- SK_ARRAY_COUNT(gCapMap) - 1)];
+ std::size(gCapMap) - 1)];
// In point mode, the text is baseline-aligned.
v->fVAlign = v->fBox.isEmpty() ? Shaper::VAlign::kTopBaseline
@@ -114,7 +114,7 @@ bool Parse(const skjson::Value& jv, const internal::AnimationBuilder& abuilder,
size_t vj;
if (skottie::Parse((*jtxt)[ "vj"], &vj) ||
skottie::Parse((*jtxt)["sk_vj"], &vj)) { // TODO: remove after migrating clients.
- if (vj < SK_ARRAY_COUNT(gVAlignMap)) {
+ if (vj < std::size(gVAlignMap)) {
v->fVAlign = gVAlignMap[vj];
} else {
// Legacy sk_vj values.
@@ -168,7 +168,7 @@ bool Parse(const skjson::Value& jv, const internal::AnimationBuilder& abuilder,
SkPaint::kBevel_Join, // lj: 3
};
v->fStrokeJoin = gJoins[std::min<size_t>(ParseDefault<size_t>((*jtxt)["lj"], 1) - 1,
- SK_ARRAY_COUNT(gJoins) - 1)];
+ std::size(gJoins) - 1)];
}
return true;
diff --git a/chromium/third_party/skia/modules/skparagraph/BUILD.bazel b/chromium/third_party/skia/modules/skparagraph/BUILD.bazel
index 652eb5bd7a1..4839422a405 100644
--- a/chromium/third_party/skia/modules/skparagraph/BUILD.bazel
+++ b/chromium/third_party/skia/modules/skparagraph/BUILD.bazel
@@ -1,19 +1,19 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy")
+load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_library")
licenses(["notice"])
exports_files_legacy()
-cc_library(
+skia_cc_library(
name = "skparagraph",
srcs = ["//modules/skparagraph/src:srcs"],
hdrs = ["//modules/skparagraph/include:hdrs"],
visibility = ["//:__subpackages__"],
deps = [
- "//:skia_public",
+ "//:skia_internal",
"//modules/skshaper",
"//modules/skunicode",
- "//third_party:harfbuzz",
- "//third_party:icu",
+ "@harfbuzz",
+ "@icu",
],
)
diff --git a/chromium/third_party/skia/modules/skparagraph/BUILD.gn b/chromium/third_party/skia/modules/skparagraph/BUILD.gn
index 45da5fb297d..de7520a0702 100644
--- a/chromium/third_party/skia/modules/skparagraph/BUILD.gn
+++ b/chromium/third_party/skia/modules/skparagraph/BUILD.gn
@@ -37,8 +37,8 @@ if (skia_enable_skparagraph && skia_enable_skshaper && skia_use_icu &&
}
if (defined(is_skia_standalone) && skia_enable_tools) {
+ import("skparagraph.gni")
skia_source_set("utils") {
- import("skparagraph.gni")
public_configs = [ ":utils_config" ]
configs = [ "../../:skia_private" ]
sources = skparagraph_utils
@@ -66,7 +66,7 @@ if (skia_enable_skparagraph && skia_enable_skshaper && skia_use_icu &&
skia_source_set("tests") {
if (paragraph_tests_enabled) {
testonly = true
- sources = [ "tests/SkParagraphTest.cpp" ]
+ sources = skparagraph_tests
deps = [
":skparagraph",
"../..:skia",
diff --git a/chromium/third_party/skia/modules/skparagraph/include/ParagraphStyle.h b/chromium/third_party/skia/modules/skparagraph/include/ParagraphStyle.h
index a76facddc1e..5139571ddb0 100644
--- a/chromium/third_party/skia/modules/skparagraph/include/ParagraphStyle.h
+++ b/chromium/third_party/skia/modules/skparagraph/include/ParagraphStyle.h
@@ -83,7 +83,8 @@ struct ParagraphStyle {
this->fEllipsis == rhs.fEllipsis &&
this->fEllipsisUtf16 == rhs.fEllipsisUtf16 &&
this->fTextDirection == rhs.fTextDirection && this->fTextAlign == rhs.fTextAlign &&
- this->fDefaultTextStyle == rhs.fDefaultTextStyle;
+ this->fDefaultTextStyle == rhs.fDefaultTextStyle &&
+ this->fReplaceTabCharacters == rhs.fReplaceTabCharacters;
}
const StrutStyle& getStrutStyle() const { return fStrutStyle; }
@@ -120,6 +121,9 @@ struct ParagraphStyle {
bool hintingIsOn() const { return fHintingIsOn; }
void turnHintingOff() { fHintingIsOn = false; }
+ bool getReplaceTabCharacters() const { return fReplaceTabCharacters; }
+ void setReplaceTabCharacters(bool value) { fReplaceTabCharacters = value; }
+
private:
StrutStyle fStrutStyle;
TextStyle fDefaultTextStyle;
@@ -131,6 +135,7 @@ private:
SkScalar fHeight;
TextHeightBehavior fTextHeightBehavior;
bool fHintingIsOn;
+ bool fReplaceTabCharacters;
};
} // namespace textlayout
} // namespace skia
diff --git a/chromium/third_party/skia/modules/skparagraph/include/TextStyle.h b/chromium/third_party/skia/modules/skparagraph/include/TextStyle.h
index 19220eba182..82b4a7cb13c 100644
--- a/chromium/third_party/skia/modules/skparagraph/include/TextStyle.h
+++ b/chromium/third_party/skia/modules/skparagraph/include/TextStyle.h
@@ -260,7 +260,7 @@ public:
void setPlaceholder() { fIsPlaceholder = true; }
private:
- static const std::vector<SkString> kDefaultFontFamilies;
+ static const std::vector<SkString>* kDefaultFontFamilies;
Decoration fDecoration = {
TextDecoration::kNoDecoration,
@@ -274,7 +274,7 @@ private:
SkFontStyle fFontStyle;
- std::vector<SkString> fFontFamilies = kDefaultFontFamilies;
+ std::vector<SkString> fFontFamilies = *kDefaultFontFamilies;
SkScalar fFontSize = 14.0;
SkScalar fHeight = 1.0;
diff --git a/chromium/third_party/skia/modules/skparagraph/samples/SampleParagraph.cpp b/chromium/third_party/skia/modules/skparagraph/samples/SampleParagraph.cpp
index 7b18c718928..fe6baa1f157 100644
--- a/chromium/third_party/skia/modules/skparagraph/samples/SampleParagraph.cpp
+++ b/chromium/third_party/skia/modules/skparagraph/samples/SampleParagraph.cpp
@@ -21,7 +21,6 @@
#include "modules/skparagraph/utils/TestFontCollection.h"
#include "samplecode/Sample.h"
#include "src/core/SkOSFile.h"
-#include "src/shaders/SkColorShader.h"
#include "src/utils/SkOSPath.h"
#include "src/utils/SkUTF.h"
#include "tools/Resources.h"
@@ -3685,6 +3684,36 @@ private:
using INHERITED = Sample;
};
+class ParagraphView65 : public ParagraphView_Base {
+protected:
+ SkString name() override { return SkString("ParagraphView65"); }
+
+ void onDrawContent(SkCanvas* canvas) override {
+
+ canvas->drawColor(SK_ColorWHITE);
+ ParagraphStyle paragraph_style;
+ paragraph_style.setReplaceTabCharacters(substituteTab);
+ auto fontCollection = sk_make_sp<FontCollection>();
+ fontCollection->setDefaultFontManager(SkFontMgr::RefDefault());
+ fontCollection->enableFontFallback();
+ ParagraphBuilderImpl builder(paragraph_style, fontCollection);
+ TextStyle text_style;
+ text_style.setColor(SK_ColorBLACK);
+ // "Noto Sans Thai"
+ text_style.setFontFamilies({SkString("Roboto")});
+ text_style.setFontSize(100);
+ builder.pushStyle(text_style);
+ builder.addText(u"\u0eb9\u0952\u0301\u0e51A");
+ auto paragraph = builder.Build();
+ paragraph->layout(this->width());
+ paragraph->paint(canvas, 0, 0);
+ }
+
+private:
+ using INHERITED = Sample;
+ bool substituteTab = false;
+};
+
} // namespace
@@ -3751,3 +3780,4 @@ DEF_SAMPLE(return new ParagraphView61();)
DEF_SAMPLE(return new ParagraphView62();)
DEF_SAMPLE(return new ParagraphView63();)
DEF_SAMPLE(return new ParagraphView64();)
+DEF_SAMPLE(return new ParagraphView65();)
diff --git a/chromium/third_party/skia/modules/skparagraph/skparagraph.gni b/chromium/third_party/skia/modules/skparagraph/skparagraph.gni
index 14fc5fc7856..ae60e9d19ac 100644
--- a/chromium/third_party/skia/modules/skparagraph/skparagraph.gni
+++ b/chromium/third_party/skia/modules/skparagraph/skparagraph.gni
@@ -3,6 +3,7 @@
# Things are easiest for everyone if these source paths are absolute.
_src = get_path_info("src", "abspath")
_include = get_path_info("include", "abspath")
+_tests = get_path_info("tests", "abspath")
_utils = get_path_info("utils", "abspath")
skparagraph_public = [
@@ -49,3 +50,10 @@ skparagraph_utils = [
"$_utils/TestFontCollection.h",
"$_utils/TestFontCollection.cpp",
]
+
+skparagraph_tests = [
+ "$_tests/SkParagraphTest.cpp",
+ "$_tests/SkShaperJSONWriter.cpp",
+ "$_tests/SkShaperJSONWriter.h",
+ "$_tests/SkShaperJSONWriterTest.cpp",
+]
diff --git a/chromium/third_party/skia/modules/skparagraph/src/OneLineShaper.cpp b/chromium/third_party/skia/modules/skparagraph/src/OneLineShaper.cpp
index 482236a0344..4a53e064e00 100644
--- a/chromium/third_party/skia/modules/skparagraph/src/OneLineShaper.cpp
+++ b/chromium/third_party/skia/modules/skparagraph/src/OneLineShaper.cpp
@@ -300,11 +300,8 @@ void OneLineShaper::addUnresolvedWithRun(GlyphRange glyphRange) {
// Glue whitespaces to the next/prev unresolved blocks
// (so we don't have chinese text with english whitespaces broken into millions of tiny runs)
-#ifndef SK_PARAGRAPH_GRAPHEME_EDGES
void OneLineShaper::sortOutGlyphs(std::function<void(GlyphRange)>&& sortOutUnresolvedBLock) {
- auto text = fCurrentRun->fOwner->text();
-
GlyphRange block = EMPTY_RANGE;
bool graphemeResolved = false;
TextIndex graphemeStart = EMPTY_INDEX;
@@ -320,9 +317,8 @@ void OneLineShaper::sortOutGlyphs(std::function<void(GlyphRange)>&& sortOutUnres
if ((fCurrentRun->leftToRight() ? gi > graphemeStart : gi < graphemeStart) || graphemeStart == EMPTY_INDEX) {
// This is the Flutter change
// Do not count control codepoints as unresolved
- const char* cluster = text.begin() + ci;
- SkUnichar codepoint = nextUtf8Unit(&cluster, text.end());
- bool isControl8 = fParagraph->getUnicode()->isControl(codepoint);
+ bool isControl8 = fParagraph->codeUnitHasProperty(ci,
+ SkUnicode::CodeUnitFlags::kControl);
// We only count glyph resolved if all the glyphs in its grapheme are resolved
graphemeResolved = glyph != 0 || isControl8;
graphemeStart = gi;
@@ -357,70 +353,6 @@ void OneLineShaper::sortOutGlyphs(std::function<void(GlyphRange)>&& sortOutUnres
sortOutUnresolvedBLock(block);
}
}
-#else
-void OneLineShaper::sortOutGlyphs(std::function<void(GlyphRange)>&& sortOutUnresolvedBLock) {
-
- auto text = fCurrentRun->fOwner->text();
- size_t unresolvedGlyphs = 0;
-
- TextIndex whitespacesStart = EMPTY_INDEX;
- GlyphRange block = EMPTY_RANGE;
- for (size_t i = 0; i < fCurrentRun->size(); ++i) {
-
- const char* cluster = text.begin() + clusterIndex(i);
- SkUnichar codepoint = nextUtf8Unit(&cluster, text.end());
- bool isControl8 = fParagraph->getUnicode()->isControl(codepoint);
- // TODO: This is a temp change to match space handiling in LibTxt
- // (all spaces are resolved with the main font)
-#ifdef SK_PARAGRAPH_LIBTXT_SPACES_RESOLUTION
- bool isWhitespace8 = false; // fParagraph->getUnicode()->isWhitespace(codepoint);
-#else
- bool isWhitespace8 = fParagraph->getUnicode()->isWhitespace(codepoint);
-#endif
- // Inspect the glyph
- auto glyph = fCurrentRun->fGlyphs[i];
- if (glyph == 0 && !isControl8) { // Unresolved glyph and not control codepoint
- ++unresolvedGlyphs;
- if (block.start == EMPTY_INDEX) {
- // Start new unresolved block
- // (all leading whitespaces glued to the resolved part if it's not empty)
- block.start = whitespacesStart == 0 ? 0 : i;
- block.end = EMPTY_INDEX;
- } else {
- // Keep skipping unresolved block
- }
- } else { // Resolved glyph or control codepoint
- if (block.start == EMPTY_INDEX) {
- // Keep skipping resolved code points
- } else if (isWhitespace8) {
- // Glue whitespaces after to the unresolved block
- ++unresolvedGlyphs;
- } else {
- // This is the end of unresolved block (all trailing whitespaces glued to the resolved part)
- block.end = whitespacesStart == EMPTY_INDEX ? i : whitespacesStart;
- sortOutUnresolvedBLock(block);
- block = EMPTY_RANGE;
- whitespacesStart = EMPTY_INDEX;
- }
- }
-
- // Keep updated the start of the latest whitespaces patch
- if (isWhitespace8) {
- if (whitespacesStart == EMPTY_INDEX) {
- whitespacesStart = i;
- }
- } else {
- whitespacesStart = EMPTY_INDEX;
- }
- }
-
- // One last block could have been left
- if (block.start != EMPTY_INDEX) {
- block.end = fCurrentRun->size();
- sortOutUnresolvedBLock(block);
- }
-}
-#endif
void OneLineShaper::iterateThroughFontStyles(TextRange textRange,
SkSpan<Block> styleSpan,
@@ -494,13 +426,30 @@ void OneLineShaper::matchResolvedFonts(const TextStyle& textStyle,
const char* ch = unresolvedText.begin();
// We have the global cache for all already found typefaces for SkUnichar
// but we still need to keep track of all SkUnichars used in this unresolved block
- SkTHashSet<SkUnichar> alreadyTried;
- SkUnichar unicode = nextUtf8Unit(&ch, unresolvedText.end());
+ SkTHashSet<SkUnichar> alreadyTriedCodepoints;
+ SkTHashSet<SkTypefaceID> alreadyTriedTypefaces;
while (true) {
- sk_sp<SkTypeface> typeface;
+ if (ch == unresolvedText.end()) {
+ // Not a single codepoint could be resolved but we finished the block
+ hopelessBlocks.push_back(fUnresolvedBlocks.front());
+ fUnresolvedBlocks.pop_front();
+ break;
+ }
+
+ // See if we can switch to the next DIFFERENT codepoint
+ SkUnichar unicode = -1;
+ while (ch != unresolvedText.end()) {
+ unicode = nextUtf8Unit(&ch, unresolvedText.end());
+ if (!alreadyTriedCodepoints.contains(unicode)) {
+ alreadyTriedCodepoints.add(unicode);
+ break;
+ }
+ }
+ SkASSERT(unicode != -1);
// First try to find in in a cache
+ sk_sp<SkTypeface> typeface;
FontKey fontKey(unicode, textStyle.getFontStyle(), textStyle.getLocale());
auto found = fFallbackFonts.find(fontKey);
if (found != nullptr) {
@@ -515,35 +464,36 @@ void OneLineShaper::matchResolvedFonts(const TextStyle& textStyle,
fFallbackFonts.set(fontKey, typeface);
}
+ // Check if we already tried this font on this text range
+ if (!alreadyTriedTypefaces.contains(typeface->uniqueID())) {
+ alreadyTriedTypefaces.add(typeface->uniqueID());
+ } else {
+ continue;
+ }
+
+ auto resolvedBlocksBefore = fResolvedBlocks.size();
auto resolved = visitor(typeface);
if (resolved == Resolved::Everything) {
- // Resolved everything, no need to try another font
- return;
+ if (hopelessBlocks.empty()) {
+ // Resolved everything, no need to try another font
+ return;
+ } else if (resolvedBlocksBefore < fResolvedBlocks.size()) {
+ // There are some resolved blocks
+ resolved = Resolved::Something;
+ } else {
+ // All blocks are hopeless
+ resolved = Resolved::Nothing;
+ }
}
if (resolved == Resolved::Something) {
// Resolved something, no need to try another codepoint
break;
}
-
- if (ch == unresolvedText.end()) {
- // Not a single codepoint could be resolved but we finished the block
- hopelessBlocks.push_back(fUnresolvedBlocks.front());
- fUnresolvedBlocks.pop_front();
- break;
- }
-
- // We can stop here or we can switch to another DIFFERENT codepoint
- while (ch != unresolvedText.end()) {
- unicode = nextUtf8Unit(&ch, unresolvedText.end());
- if (alreadyTried.find(unicode) == nullptr) {
- alreadyTried.add(unicode);
- break;
- }
- }
}
}
+ // Return hopeless blocks back
for (auto& block : hopelessBlocks) {
fUnresolvedBlocks.emplace_front(block);
}
@@ -687,8 +637,8 @@ bool OneLineShaper::shape() {
LangIterator langIter(unresolvedText, blockSpan,
fParagraph->paragraphStyle().getTextStyle());
SkShaper::TrivialBiDiRunIterator bidiIter(defaultBidiLevel, unresolvedText.size());
- auto scriptIter = SkShaper::MakeSkUnicodeHbScriptRunIterator
- (fParagraph->getUnicode(), unresolvedText.begin(), unresolvedText.size());
+ auto scriptIter = SkShaper::MakeSkUnicodeHbScriptRunIterator(
+ unresolvedText.begin(), unresolvedText.size());
fCurrentText = unresolvedRange;
// Map the block's features to subranges within the unresolved range.
@@ -713,6 +663,8 @@ bool OneLineShaper::shape() {
}
if (fUnresolvedBlocks.empty()) {
+ // In some cases it does not mean everything
+ // (when we excluded some hopeless blocks from the list)
return Resolved::Everything;
} else if (resolvedCount < fResolvedBlocks.size()) {
return Resolved::Something;
@@ -742,7 +694,7 @@ TextRange OneLineShaper::clusteredText(GlyphRange& glyphs) {
if (dir == Dir::right) {
while (index < fCurrentRun->fTextRange.end) {
if (this->fParagraph->codeUnitHasProperty(index,
- CodeUnitFlags::kGraphemeStart)) {
+ SkUnicode::CodeUnitFlags::kGraphemeStart)) {
return index;
}
++index;
@@ -751,7 +703,7 @@ TextRange OneLineShaper::clusteredText(GlyphRange& glyphs) {
} else {
while (index > fCurrentRun->fTextRange.start) {
if (this->fParagraph->codeUnitHasProperty(index,
- CodeUnitFlags::kGraphemeStart)) {
+ SkUnicode::CodeUnitFlags::kGraphemeStart)) {
return index;
}
--index;
diff --git a/chromium/third_party/skia/modules/skparagraph/src/ParagraphCache.cpp b/chromium/third_party/skia/modules/skparagraph/src/ParagraphCache.cpp
index 3c009e23157..af35945f234 100644
--- a/chromium/third_party/skia/modules/skparagraph/src/ParagraphCache.cpp
+++ b/chromium/third_party/skia/modules/skparagraph/src/ParagraphCache.cpp
@@ -86,7 +86,7 @@ public:
SkTArray<Cluster, true> fClusters;
SkTArray<size_t, true> fClustersIndexFromCodeUnit;
// ICU results
- SkTArray<CodeUnitFlags> fCodeUnitProperties;
+ SkTArray<SkUnicode::CodeUnitFlags, true> fCodeUnitProperties;
std::vector<size_t> fWords;
std::vector<SkUnicode::BidiRegion> fBidiRegions;
SkTArray<TextIndex, true> fUTF8IndexForUTF16Index;
@@ -144,6 +144,7 @@ uint32_t ParagraphCacheKey::computeHash() const {
hash = mix(hash, SkGoodHash()(relax(fParagraphStyle.getHeight())));
hash = mix(hash, SkGoodHash()(fParagraphStyle.getTextDirection()));
+ hash = mix(hash, SkGoodHash()(fParagraphStyle.getReplaceTabCharacters() ? 1 : 0));
auto& strutStyle = fParagraphStyle.getStrutStyle();
if (strutStyle.getStrutEnabled()) {
@@ -192,6 +193,10 @@ bool ParagraphCacheKey::operator==(const ParagraphCacheKey& other) const {
return false;
}
+ if (!(fParagraphStyle.getReplaceTabCharacters() == other.fParagraphStyle.getReplaceTabCharacters())) {
+ return false;
+ }
+
for (size_t i = 0; i < fTextStyles.size(); ++i) {
auto& tsa = fTextStyles[i];
auto& tsb = other.fTextStyles[i];
diff --git a/chromium/third_party/skia/modules/skparagraph/src/ParagraphImpl.cpp b/chromium/third_party/skia/modules/skparagraph/src/ParagraphImpl.cpp
index 1f465a81469..ba3f5fe4ab2 100644
--- a/chromium/third_party/skia/modules/skparagraph/src/ParagraphImpl.cpp
+++ b/chromium/third_party/skia/modules/skparagraph/src/ParagraphImpl.cpp
@@ -99,7 +99,7 @@ ParagraphImpl::ParagraphImpl(const std::u16string& utf16text,
std::move(unicode))
{
SkASSERT(fUnicode);
- fText = fUnicode->convertUtf16ToUtf8(utf16text);
+ fText = SkUnicode::convertUtf16ToUtf8(utf16text);
}
ParagraphImpl::~ParagraphImpl() = default;
@@ -133,7 +133,6 @@ void ParagraphImpl::layout(SkScalar rawWidth) {
if (fState < kShaped) {
this->fCodeUnitProperties.reset();
- this->fCodeUnitProperties.push_back_n(fText.size() + 1, CodeUnitFlags::kNoCodeUnitFlag);
this->fWords.clear();
this->fBidiRegions.clear();
this->fUTF8IndexForUTF16Index.reset();
@@ -241,57 +240,38 @@ bool ParagraphImpl::computeCodeUnitProperties() {
}
// Collect all spaces and some extra information
+ // (and also substitute \t with a space while we are at it)
+ if (!fUnicode->computeCodeUnitFlags(&fText[0],
+ fText.size(),
+ this->paragraphStyle().getReplaceTabCharacters(),
+ &fCodeUnitProperties)) {
+ return false;
+ }
+
+ // Get some information about trailing spaces / hard line breaks
fTrailingSpaces = fText.size();
TextIndex firstWhitespace = EMPTY_INDEX;
- fUnicode->forEachCodepoint(fText.c_str(), fText.size(),
- [this, &firstWhitespace](SkUnichar unichar, int32_t start, int32_t end, int32_t count) {
- if (fUnicode->isWhitespace(unichar)) {
- for (auto i = start; i < end; ++i) {
- fCodeUnitProperties[i] |= CodeUnitFlags::kPartOfWhiteSpaceBreak;
- }
- if (fTrailingSpaces == fText.size()) {
- fTrailingSpaces = start;
- }
- if (firstWhitespace == EMPTY_INDEX) {
- firstWhitespace = start;
- }
- } else {
- fTrailingSpaces = fText.size();
+ for (auto i = 0ul; i < fCodeUnitProperties.size(); ++i) {
+ auto flags = fCodeUnitProperties[i];
+ if (SkUnicode::isPartOfWhiteSpaceBreak(flags)) {
+ if (fTrailingSpaces == fText.size()) {
+ fTrailingSpaces = i;
}
- if (fUnicode->isSpace(unichar)) {
- for (auto i = start; i < end; ++i) {
- fCodeUnitProperties[i] |= CodeUnitFlags::kPartOfIntraWordBreak;
- }
+ if (firstWhitespace == EMPTY_INDEX) {
+ firstWhitespace = i;
}
- if (fUnicode->isHardBreak(unichar)) {
- fHasLineBreaks = true;
- }
- });
+ } else {
+ fTrailingSpaces = fText.size();
+ }
+ if (SkUnicode::isHardLineBreak(flags)) {
+ fHasLineBreaks = true;
+ }
+ }
if (firstWhitespace < fTrailingSpaces) {
fHasWhitespacesInside = true;
}
- // Get line breaks
- std::vector<SkUnicode::LineBreakBefore> lineBreaks;
- if (!fUnicode->getLineBreaks(fText.c_str(), fText.size(), &lineBreaks)) {
- return false;
- }
- for (auto& lineBreak : lineBreaks) {
- fCodeUnitProperties[lineBreak.pos] |= lineBreak.breakType == SkUnicode::LineBreakType::kHardLineBreak
- ? CodeUnitFlags::kHardLineBreakBefore
- : CodeUnitFlags::kSoftLineBreakBefore;
- }
-
- // Get graphemes
- std::vector<SkUnicode::Position> graphemes;
- if (!fUnicode->getGraphemes(fText.c_str(), fText.size(), &graphemes)) {
- return false;
- }
- for (auto pos : graphemes) {
- fCodeUnitProperties[pos] |= CodeUnitFlags::kGraphemeStart;
- }
-
return true;
}
@@ -342,10 +322,10 @@ Cluster::Cluster(ParagraphImpl* owner,
}
} else {
for (auto i = fTextRange.start; i < fTextRange.end; ++i) {
- if (fOwner->codeUnitHasProperty(i, CodeUnitFlags::kPartOfWhiteSpaceBreak)) {
+ if (fOwner->codeUnitHasProperty(i, SkUnicode::CodeUnitFlags::kPartOfWhiteSpaceBreak)) {
++whiteSpacesBreakLen;
}
- if (fOwner->codeUnitHasProperty(i, CodeUnitFlags::kPartOfIntraWordBreak)) {
+ if (fOwner->codeUnitHasProperty(i, SkUnicode::CodeUnitFlags::kPartOfIntraWordBreak)) {
++intraWordBreakLen;
}
}
@@ -353,7 +333,8 @@ Cluster::Cluster(ParagraphImpl* owner,
fIsWhiteSpaceBreak = whiteSpacesBreakLen == fTextRange.width();
fIsIntraWordBreak = intraWordBreakLen == fTextRange.width();
- fIsHardBreak = fOwner->codeUnitHasProperty(fTextRange.end, CodeUnitFlags::kHardLineBreakBefore);
+ fIsHardBreak = fOwner->codeUnitHasProperty(fTextRange.end,
+ SkUnicode::CodeUnitFlags::kHardLineBreakBefore);
}
SkScalar Run::calculateWidth(size_t start, size_t end, bool clip) const {
@@ -460,7 +441,7 @@ void ParagraphImpl::buildClusterTable() {
int cluster_count = 1;
for (auto& run : fRuns) {
cluster_count += run.isPlaceholder() ? 1 : run.size();
- fCodeUnitProperties[run.fTextRange.start] |= CodeUnitFlags::kGraphemeStart;
+ fCodeUnitProperties[run.fTextRange.start] |= SkUnicode::CodeUnitFlags::kGraphemeStart;
}
fClusters.reserve_back(cluster_count);
@@ -475,8 +456,8 @@ void ParagraphImpl::buildClusterTable() {
}
// There are no glyphs but we want to have one cluster
fClusters.emplace_back(this, runIndex, 0ul, 1ul, this->text(run.textRange()), run.advance().fX, run.advance().fY);
- fCodeUnitProperties[run.textRange().start] |= CodeUnitFlags::kSoftLineBreakBefore;
- fCodeUnitProperties[run.textRange().end] |= CodeUnitFlags::kSoftLineBreakBefore;
+ fCodeUnitProperties[run.textRange().start] |= SkUnicode::CodeUnitFlags::kSoftLineBreakBefore;
+ fCodeUnitProperties[run.textRange().end] |= SkUnicode::CodeUnitFlags::kSoftLineBreakBefore;
} else {
// Walk through the glyph in the direction of input text
run.iterateThroughClustersInTextOrder([runIndex, this](size_t glyphStart,
@@ -922,7 +903,6 @@ void ParagraphImpl::setState(InternalState state) {
case kUnknown:
fRuns.reset();
fCodeUnitProperties.reset();
- fCodeUnitProperties.push_back_n(fText.size() + 1, kNoCodeUnitFlag);
fWords.clear();
fBidiRegions.clear();
fUTF8IndexForUTF16Index.reset();
@@ -1016,7 +996,7 @@ SkString ParagraphImpl::getEllipsis() const {
if (!ellipsis8.isEmpty()) {
return ellipsis8;
} else {
- return fUnicode->convertUtf16ToUtf8(fParagraphStyle.getEllipsisUtf16());
+ return SkUnicode::convertUtf16ToUtf8(fParagraphStyle.getEllipsisUtf16());
}
}
@@ -1076,7 +1056,7 @@ void ParagraphImpl::updateBackgroundPaint(size_t from, size_t to, SkPaint paint)
TextIndex ParagraphImpl::findPreviousGraphemeBoundary(TextIndex utf8) {
while (utf8 > 0 &&
- (fCodeUnitProperties[utf8] & CodeUnitFlags::kGraphemeStart) == 0) {
+ (fCodeUnitProperties[utf8] & SkUnicode::CodeUnitFlags::kGraphemeStart) == 0) {
--utf8;
}
return utf8;
@@ -1084,41 +1064,19 @@ TextIndex ParagraphImpl::findPreviousGraphemeBoundary(TextIndex utf8) {
TextIndex ParagraphImpl::findNextGraphemeBoundary(TextIndex utf8) {
while (utf8 < fText.size() &&
- (fCodeUnitProperties[utf8] & CodeUnitFlags::kGraphemeStart) == 0) {
+ (fCodeUnitProperties[utf8] & SkUnicode::CodeUnitFlags::kGraphemeStart) == 0) {
++utf8;
}
return utf8;
}
void ParagraphImpl::ensureUTF16Mapping() {
- if (!fUTF16IndexForUTF8Index.empty()) {
- return;
- }
- // Fill out code points 16
- auto ptr = fText.c_str();
- auto end = fText.c_str() + fText.size();
- while (ptr < end) {
-
- size_t index = ptr - fText.c_str();
- SkUnichar u = SkUTF::NextUTF8(&ptr, end);
-
- // All utf8 units refer to the same codepoint
- size_t next = ptr - fText.c_str();
- for (auto i = index; i < next; ++i) {
- fUTF16IndexForUTF8Index.emplace_back(fUTF8IndexForUTF16Index.size());
- }
- SkASSERT(fUTF16IndexForUTF8Index.size() == next);
-
- // One or two codepoints refer to the same text index
- uint16_t buffer[2];
- size_t count = SkUTF::ToUTF16(u, buffer);
- fUTF8IndexForUTF16Index.emplace_back(index);
- if (count > 1) {
- fUTF8IndexForUTF16Index.emplace_back(index);
- }
- }
- fUTF16IndexForUTF8Index.emplace_back(fUTF8IndexForUTF16Index.size());
- fUTF8IndexForUTF16Index.emplace_back(fText.size());
+ fillUTF16MappingOnce([&] {
+ fUnicode->extractUtfConversionMapping(
+ this->text(),
+ [&](size_t index) { fUTF8IndexForUTF16Index.emplace_back(index); },
+ [&](size_t index) { fUTF16IndexForUTF8Index.emplace_back(index); });
+ });
}
void ParagraphImpl::visit(const Visitor& visitor) {
diff --git a/chromium/third_party/skia/modules/skparagraph/src/ParagraphImpl.h b/chromium/third_party/skia/modules/skparagraph/src/ParagraphImpl.h
index 768a8516331..d8453809468 100644
--- a/chromium/third_party/skia/modules/skparagraph/src/ParagraphImpl.h
+++ b/chromium/third_party/skia/modules/skparagraph/src/ParagraphImpl.h
@@ -13,6 +13,7 @@
#include "include/core/SkString.h"
#include "include/core/SkTypes.h"
#include "include/private/SkBitmaskEnum.h"
+#include "include/private/SkOnce.h"
#include "include/private/SkTArray.h"
#include "include/private/SkTHash.h"
#include "include/private/SkTemplates.h"
@@ -36,24 +37,6 @@ class SkCanvas;
namespace skia {
namespace textlayout {
-enum CodeUnitFlags {
- kNoCodeUnitFlag = 0x00,
- kPartOfWhiteSpaceBreak = 0x01,
- kGraphemeStart = 0x02,
- kSoftLineBreakBefore = 0x04,
- kHardLineBreakBefore = 0x08,
- kPartOfIntraWordBreak = 0x10,
-};
-} // namespace textlayout
-} // namespace skia
-
-namespace sknonstd {
-template <> struct is_bitmask_enum<skia::textlayout::CodeUnitFlags> : std::true_type {};
-} // namespace sknonstd
-
-namespace skia {
-namespace textlayout {
-
class LineMetrics;
class TextLine;
@@ -217,7 +200,9 @@ public:
}
}
- bool codeUnitHasProperty(size_t index, CodeUnitFlags property) const { return (fCodeUnitProperties[index] & property) == property; }
+ bool codeUnitHasProperty(size_t index, SkUnicode::CodeUnitFlags property) const {
+ return (fCodeUnitProperties[index] & property) == property;
+ }
SkUnicode* getUnicode() { return fUnicode.get(); }
@@ -247,7 +232,7 @@ private:
InternalState fState;
SkTArray<Run, false> fRuns; // kShaped
SkTArray<Cluster, true> fClusters; // kClusterized (cached: text, word spacing, letter spacing, resolved fonts)
- SkTArray<CodeUnitFlags> fCodeUnitProperties;
+ SkTArray<SkUnicode::CodeUnitFlags, true> fCodeUnitProperties;
SkTArray<size_t, true> fClustersIndexFromCodeUnit;
std::vector<size_t> fWords;
std::vector<SkUnicode::BidiRegion> fBidiRegions;
@@ -255,6 +240,7 @@ private:
// They are filled lazily whenever they need and cached
SkTArray<TextIndex, true> fUTF8IndexForUTF16Index;
SkTArray<size_t, true> fUTF16IndexForUTF8Index;
+ SkOnce fillUTF16MappingOnce;
size_t fUnresolvedGlyphs;
SkTArray<TextLine, false> fLines; // kFormatted (cached: width, max lines, ellipsis, text align)
diff --git a/chromium/third_party/skia/modules/skparagraph/src/ParagraphStyle.cpp b/chromium/third_party/skia/modules/skparagraph/src/ParagraphStyle.cpp
index 577c99c3818..2f0b4429df5 100644
--- a/chromium/third_party/skia/modules/skparagraph/src/ParagraphStyle.cpp
+++ b/chromium/third_party/skia/modules/skparagraph/src/ParagraphStyle.cpp
@@ -26,6 +26,7 @@ ParagraphStyle::ParagraphStyle() {
fHeight = 1;
fTextHeightBehavior = TextHeightBehavior::kAll;
fHintingIsOn = true;
+ fReplaceTabCharacters = false;
}
TextAlign ParagraphStyle::effective_align() const {
diff --git a/chromium/third_party/skia/modules/skparagraph/src/Run.cpp b/chromium/third_party/skia/modules/skparagraph/src/Run.cpp
index f24672615ff..e3e2fab567d 100644
--- a/chromium/third_party/skia/modules/skparagraph/src/Run.cpp
+++ b/chromium/third_party/skia/modules/skparagraph/src/Run.cpp
@@ -316,11 +316,12 @@ SkFont Cluster::font() const {
}
bool Cluster::isSoftBreak() const {
- return fOwner->codeUnitHasProperty(fTextRange.end, CodeUnitFlags::kSoftLineBreakBefore);
+ return fOwner->codeUnitHasProperty(fTextRange.end,
+ SkUnicode::CodeUnitFlags::kSoftLineBreakBefore);
}
bool Cluster::isGraphemeBreak() const {
- return fOwner->codeUnitHasProperty(fTextRange.end, CodeUnitFlags::kGraphemeStart);
+ return fOwner->codeUnitHasProperty(fTextRange.end, SkUnicode::CodeUnitFlags::kGraphemeStart);
}
} // namespace textlayout
} // namespace skia
diff --git a/chromium/third_party/skia/modules/skparagraph/src/Run.h b/chromium/third_party/skia/modules/skparagraph/src/Run.h
index aaaf824d695..9ff49413c5d 100644
--- a/chromium/third_party/skia/modules/skparagraph/src/Run.h
+++ b/chromium/third_party/skia/modules/skparagraph/src/Run.h
@@ -433,6 +433,15 @@ public:
fRawLeading = 0;
}
+ bool isClean() {
+ return (fAscent == SK_ScalarMax &&
+ fDescent == SK_ScalarMin &&
+ fLeading == 0 &&
+ fRawAscent == SK_ScalarMax &&
+ fRawDescent == SK_ScalarMin &&
+ fRawLeading == 0);
+ }
+
SkScalar delta() const { return height() - ideographicBaseline(); }
void updateLineMetrics(InternalLineMetrics& metrics) {
diff --git a/chromium/third_party/skia/modules/skparagraph/src/TextLine.cpp b/chromium/third_party/skia/modules/skparagraph/src/TextLine.cpp
index 1bbe47cbe8e..b8de6d4cc06 100644
--- a/chromium/third_party/skia/modules/skparagraph/src/TextLine.cpp
+++ b/chromium/third_party/skia/modules/skparagraph/src/TextLine.cpp
@@ -137,14 +137,14 @@ TextLine::TextLine(ParagraphImpl* owner,
auto& run = fOwner->run(runIndex);
runLevels[runLevelsIndex++] = run.fBidiLevel;
fMaxRunMetrics.add(
- InternalLineMetrics(run.fFontMetrics.fAscent, run.fFontMetrics.fDescent, run.fFontMetrics.fLeading));
+ InternalLineMetrics(run.correctAscent(), run.correctDescent(), run.fFontMetrics.fLeading));
}
SkASSERT(runLevelsIndex == numRuns);
SkAutoSTArray<kPreallocCount, int32_t> logicalOrder(numRuns);
// TODO: hide all these logic in SkUnicode?
- fOwner->getUnicode()->reorderVisual(runLevels.data(), numRuns, logicalOrder.data());
+ fOwner->getUnicode()->reorderVisual(runLevels.data(), numRuns, logicalOrder.data());
auto firstRunIndex = start.runIndex();
for (auto index : logicalOrder) {
fRunsInVisualOrder.push_back(firstRunIndex + index);
@@ -424,6 +424,7 @@ void TextLine::paintShadow(SkCanvas* canvas,
if (context.clippingNeeded) {
canvas->save();
SkRect clip = extendHeight(context);
+ clip.offset(x, y);
clip.offset(this->offset());
canvas->clipRect(clip);
}
@@ -1041,7 +1042,7 @@ bool TextLine::isLastLine() {
bool TextLine::endsWithHardLineBreak() const {
// TODO: For some reason Flutter imagines a hard line break at the end of the last line.
// To be removed...
- return fOwner->cluster(fGhostClusterRange.end - 1).isHardBreak() ||
+ return (fGhostClusterRange.width() > 0 && fOwner->cluster(fGhostClusterRange.end - 1).isHardBreak()) ||
fEllipsis != nullptr ||
fGhostClusterRange.end == fOwner->clusters().size() - 1;
}
diff --git a/chromium/third_party/skia/modules/skparagraph/src/TextStyle.cpp b/chromium/third_party/skia/modules/skparagraph/src/TextStyle.cpp
index 03c77d099fc..492f94fe106 100644
--- a/chromium/third_party/skia/modules/skparagraph/src/TextStyle.cpp
+++ b/chromium/third_party/skia/modules/skparagraph/src/TextStyle.cpp
@@ -6,7 +6,8 @@
namespace skia {
namespace textlayout {
-const std::vector<SkString> TextStyle::kDefaultFontFamilies = { SkString(DEFAULT_FONT_FAMILY) };
+const std::vector<SkString>* TextStyle::kDefaultFontFamilies =
+ new std::vector<SkString>{SkString(DEFAULT_FONT_FAMILY)};
TextStyle TextStyle::cloneForPlaceholder() {
TextStyle result;
diff --git a/chromium/third_party/skia/modules/skparagraph/src/TextWrapper.cpp b/chromium/third_party/skia/modules/skparagraph/src/TextWrapper.cpp
index 4c4eab68b56..a94ce215029 100644
--- a/chromium/third_party/skia/modules/skparagraph/src/TextWrapper.cpp
+++ b/chromium/third_party/skia/modules/skparagraph/src/TextWrapper.cpp
@@ -311,7 +311,7 @@ void TextWrapper::breakTextIntoLines(ParagraphImpl* parent,
}
// If the line is empty with the hard line break, let's take the paragraph font (flutter???)
- if (fHardLineBreak && fEndLine.width() == 0) {
+ if (fEndLine.metrics().isClean()) {
fEndLine.setMetrics(parent->getEmptyMetrics());
}
diff --git a/chromium/third_party/skia/modules/skplaintexteditor/app/editor_application.cpp b/chromium/third_party/skia/modules/skplaintexteditor/app/editor_application.cpp
index 04097561f03..8e317850931 100644
--- a/chromium/third_party/skia/modules/skplaintexteditor/app/editor_application.cpp
+++ b/chromium/third_party/skia/modules/skplaintexteditor/app/editor_application.cpp
@@ -80,7 +80,7 @@ struct Timer {
static constexpr float kFontSize = 18;
static const char* kTypefaces[3] = {"sans-serif", "serif", "monospace"};
-static constexpr size_t kTypefaceCount = SK_ARRAY_COUNT(kTypefaces);
+static constexpr size_t kTypefaceCount = std::size(kTypefaces);
static constexpr SkFontStyle::Weight kFontWeight = SkFontStyle::kNormal_Weight;
static constexpr SkFontStyle::Width kFontWidth = SkFontStyle::kNormal_Width;
diff --git a/chromium/third_party/skia/modules/skresources/BUILD.bazel b/chromium/third_party/skia/modules/skresources/BUILD.bazel
index 7acf36afe17..836dc965867 100644
--- a/chromium/third_party/skia/modules/skresources/BUILD.bazel
+++ b/chromium/third_party/skia/modules/skresources/BUILD.bazel
@@ -1,15 +1,15 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy")
+load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_library")
licenses(["notice"])
exports_files_legacy()
-cc_library(
+skia_cc_library(
name = "skresources",
srcs = ["//modules/skresources/src:srcs"],
hdrs = ["//modules/skresources/include:hdrs"],
visibility = ["//:__subpackages__"],
deps = [
- "//:skia_public",
+ "//:skia_internal",
],
)
diff --git a/chromium/third_party/skia/modules/skresources/src/SkResources.cpp b/chromium/third_party/skia/modules/skresources/src/SkResources.cpp
index 96d84361d6d..35b1139d050 100644
--- a/chromium/third_party/skia/modules/skresources/src/SkResources.cpp
+++ b/chromium/third_party/skia/modules/skresources/src/SkResources.cpp
@@ -19,6 +19,7 @@
#if defined(HAVE_VIDEO_DECODER)
#include "experimental/ffmpeg/SkVideoDecoder.h"
+ #include "include/core/SkStream.h"
#endif
namespace skresources {
@@ -287,7 +288,7 @@ static sk_sp<SkData> decode_datauri(const char prefix[], const char uri[]) {
return nullptr;
}
- const char* b64Data = encoding + SK_ARRAY_COUNT(kDataURIEncodingStr) - 1;
+ const char* b64Data = encoding + std::size(kDataURIEncodingStr) - 1;
size_t b64DataLen = strlen(b64Data);
size_t dataLen;
if (SkBase64::Decode(b64Data, b64DataLen, nullptr, &dataLen) != SkBase64::kNoError) {
diff --git a/chromium/third_party/skia/modules/sksg/BUILD.bazel b/chromium/third_party/skia/modules/sksg/BUILD.bazel
index ecf9522dc9a..8755fe0434a 100644
--- a/chromium/third_party/skia/modules/sksg/BUILD.bazel
+++ b/chromium/third_party/skia/modules/sksg/BUILD.bazel
@@ -1,10 +1,10 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy")
+load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_library")
licenses(["notice"])
exports_files_legacy()
-cc_library(
+skia_cc_library(
name = "sksg",
srcs = ["//modules/sksg/src:srcs"],
hdrs = ["//modules/sksg/include:hdrs"],
diff --git a/chromium/third_party/skia/modules/sksg/include/SkSGRenderEffect.h b/chromium/third_party/skia/modules/sksg/include/SkSGRenderEffect.h
index aa0d41310d4..1ad21eadf87 100644
--- a/chromium/third_party/skia/modules/sksg/include/SkSGRenderEffect.h
+++ b/chromium/third_party/skia/modules/sksg/include/SkSGRenderEffect.h
@@ -19,6 +19,7 @@
// TODO: merge EffectNode.h with this header
+class SkBlender;
class SkImageFilter;
class SkMaskFilter;
class SkShader;
@@ -225,25 +226,24 @@ private:
};
/**
- * Applies a SkBlendMode to descendant render nodes.
+ * Applies an SkBlender to descendant render nodes.
*/
-class BlendModeEffect final : public EffectNode {
+class BlenderEffect final : public EffectNode {
public:
- ~BlendModeEffect() override;
+ ~BlenderEffect() override;
- static sk_sp<BlendModeEffect> Make(sk_sp<RenderNode> child,
- SkBlendMode = SkBlendMode::kSrcOver);
+ static sk_sp<BlenderEffect> Make(sk_sp<RenderNode> child, sk_sp<SkBlender> = nullptr);
- SG_ATTRIBUTE(Mode, SkBlendMode, fMode)
+ SG_ATTRIBUTE(Blender, sk_sp<SkBlender>, fBlender)
protected:
void onRender(SkCanvas*, const RenderContext*) const override;
const RenderNode* onNodeAt(const SkPoint&) const override;
private:
- BlendModeEffect(sk_sp<RenderNode>, SkBlendMode);
+ BlenderEffect(sk_sp<RenderNode>, sk_sp<SkBlender>);
- SkBlendMode fMode;
+ sk_sp<SkBlender> fBlender;
using INHERITED = EffectNode;
};
diff --git a/chromium/third_party/skia/modules/sksg/include/SkSGRenderNode.h b/chromium/third_party/skia/modules/sksg/include/SkSGRenderNode.h
index 00b7ced0aec..a040722fbe1 100644
--- a/chromium/third_party/skia/modules/sksg/include/SkSGRenderNode.h
+++ b/chromium/third_party/skia/modules/sksg/include/SkSGRenderNode.h
@@ -10,7 +10,7 @@
#include "modules/sksg/include/SkSGNode.h"
-#include "include/core/SkBlendMode.h"
+#include "include/core/SkBlender.h"
#include "include/core/SkColorFilter.h"
#include "include/core/SkShader.h"
@@ -53,10 +53,10 @@ protected:
sk_sp<SkColorFilter> fColorFilter;
sk_sp<SkShader> fShader;
sk_sp<SkShader> fMaskShader;
+ sk_sp<SkBlender> fBlender;
SkMatrix fShaderCTM = SkMatrix::I(),
fMaskCTM = SkMatrix::I();
float fOpacity = 1;
- SkBlendMode fBlendMode = SkBlendMode::kSrcOver;
// Returns true if the paint overrides require a layer when applied to non-atomic draws.
bool requiresIsolation() const;
@@ -91,7 +91,7 @@ protected:
ScopedRenderContext&& modulateColorFilter(sk_sp<SkColorFilter>);
ScopedRenderContext&& modulateShader(sk_sp<SkShader>, const SkMatrix& shader_ctm);
ScopedRenderContext&& modulateMaskShader(sk_sp<SkShader>, const SkMatrix& ms_ctm);
- ScopedRenderContext&& modulateBlendMode(SkBlendMode);
+ ScopedRenderContext&& modulateBlender(sk_sp<SkBlender>);
// Force content isolation for a node sub-DAG by applying the RenderContext
// overrides via a layer.
diff --git a/chromium/third_party/skia/modules/sksg/include/SkSGText.h b/chromium/third_party/skia/modules/sksg/include/SkSGText.h
index 10ac04c70aa..77056b245a6 100644
--- a/chromium/third_party/skia/modules/sksg/include/SkSGText.h
+++ b/chromium/third_party/skia/modules/sksg/include/SkSGText.h
@@ -70,33 +70,6 @@ private:
using INHERITED = GeometryNode;
};
-/**
- * Concrete Geometry node, wrapping an external SkTextBlob.
- */
-class TextBlob final : public GeometryNode {
-public:
- static sk_sp<TextBlob> Make(sk_sp<SkTextBlob> = nullptr);
- ~TextBlob() override;
-
- SG_ATTRIBUTE(Blob , sk_sp<SkTextBlob>, fBlob )
- SG_ATTRIBUTE(Position, SkPoint , fPosition)
-
-protected:
- void onClip(SkCanvas*, bool antiAlias) const override;
- void onDraw(SkCanvas*, const SkPaint&) const override;
- bool onContains(const SkPoint&) const override;
-
- SkRect onRevalidate(InvalidationController*, const SkMatrix&) override;
- SkPath onAsPath() const override;
-
-private:
- explicit TextBlob(sk_sp<SkTextBlob>);
-
- sk_sp<SkTextBlob> fBlob;
- SkPoint fPosition = SkPoint::Make(0, 0);
-
- using INHERITED = GeometryNode;
-};
} // namespace sksg
#endif // SkSGText_DEFINED
diff --git a/chromium/third_party/skia/modules/sksg/src/SkSGRenderEffect.cpp b/chromium/third_party/skia/modules/sksg/src/SkSGRenderEffect.cpp
index 8109b477492..4944ddbcfcc 100644
--- a/chromium/third_party/skia/modules/sksg/src/SkSGRenderEffect.cpp
+++ b/chromium/third_party/skia/modules/sksg/src/SkSGRenderEffect.cpp
@@ -7,6 +7,7 @@
#include "modules/sksg/include/SkSGRenderEffect.h"
+#include "include/core/SkBlender.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkMaskFilter.h"
#include "include/core/SkShader.h"
@@ -202,24 +203,24 @@ sk_sp<SkImageFilter> BlurImageFilter::onRevalidateFilter() {
return SkImageFilters::Blur(fSigma.x(), fSigma.y(), fTileMode, this->refInput(0));
}
-sk_sp<BlendModeEffect> BlendModeEffect::Make(sk_sp<RenderNode> child, SkBlendMode mode) {
- return child ? sk_sp<BlendModeEffect>(new BlendModeEffect(std::move(child), mode))
+sk_sp<BlenderEffect> BlenderEffect::Make(sk_sp<RenderNode> child, sk_sp<SkBlender> blender) {
+ return child ? sk_sp<BlenderEffect>(new BlenderEffect(std::move(child), std::move(blender)))
: nullptr;
}
-BlendModeEffect::BlendModeEffect(sk_sp<RenderNode> child, SkBlendMode mode)
+BlenderEffect::BlenderEffect(sk_sp<RenderNode> child, sk_sp<SkBlender> blender)
: INHERITED(std::move(child))
- , fMode(mode) {}
+ , fBlender (std::move(blender)) {}
-BlendModeEffect::~BlendModeEffect() = default;
+BlenderEffect::~BlenderEffect() = default;
-void BlendModeEffect::onRender(SkCanvas* canvas, const RenderContext* ctx) const {
- const auto local_ctx = ScopedRenderContext(canvas, ctx).modulateBlendMode(fMode);
+void BlenderEffect::onRender(SkCanvas* canvas, const RenderContext* ctx) const {
+ const auto local_ctx = ScopedRenderContext(canvas, ctx).modulateBlender(fBlender);
this->INHERITED::onRender(canvas, local_ctx);
}
-const RenderNode* BlendModeEffect::onNodeAt(const SkPoint& p) const {
+const RenderNode* BlenderEffect::onNodeAt(const SkPoint& p) const {
// TODO: we likely need to do something more sophisticated than delegate to descendants here.
return this->INHERITED::onNodeAt(p);
}
diff --git a/chromium/third_party/skia/modules/sksg/src/SkSGRenderNode.cpp b/chromium/third_party/skia/modules/sksg/src/SkSGRenderNode.cpp
index 9a6ce32a63d..1de209874ea 100644
--- a/chromium/third_party/skia/modules/sksg/src/SkSGRenderNode.cpp
+++ b/chromium/third_party/skia/modules/sksg/src/SkSGRenderNode.cpp
@@ -88,7 +88,7 @@ bool RenderNode::RenderContext::requiresIsolation() const {
return ScaleAlpha(SK_AlphaOPAQUE, fOpacity) != SK_AlphaOPAQUE
|| fColorFilter
|| fMaskShader
- || fBlendMode != SkBlendMode::kSrcOver;
+ || fBlender;
}
void RenderNode::RenderContext::modulatePaint(const SkMatrix& ctm, SkPaint* paint,
@@ -98,8 +98,8 @@ void RenderNode::RenderContext::modulatePaint(const SkMatrix& ctm, SkPaint* pain
if (fShader) {
paint->setShader(LocalShader(fShader, fShaderCTM, ctm));
}
- if (fBlendMode != SkBlendMode::kSrcOver) {
- paint->setBlendMode(fBlendMode);
+ if (fBlender) {
+ paint->setBlender(fBlender);
}
// Only apply the shader mask for regular paints. Isolation layers require
@@ -177,8 +177,8 @@ RenderNode::ScopedRenderContext::modulateMaskShader(sk_sp<SkShader> ms, const Sk
}
RenderNode::ScopedRenderContext&&
-RenderNode::ScopedRenderContext::modulateBlendMode(SkBlendMode mode) {
- fCtx.fBlendMode = mode;
+RenderNode::ScopedRenderContext::modulateBlender(sk_sp<SkBlender> blender) {
+ fCtx.fBlender = std::move(blender);
return std::move(*this);
}
@@ -198,8 +198,8 @@ RenderNode::ScopedRenderContext::setIsolation(const SkRect& bounds, const SkMatr
// Reset only the props applied via isolation layers.
fCtx.fColorFilter = nullptr;
fCtx.fMaskShader = nullptr;
+ fCtx.fBlender = nullptr;
fCtx.fOpacity = 1;
- fCtx.fBlendMode = SkBlendMode::kSrcOver;
}
return std::move(*this);
diff --git a/chromium/third_party/skia/modules/sksg/src/SkSGText.cpp b/chromium/third_party/skia/modules/sksg/src/SkSGText.cpp
index e72f8d89f2b..762be54d955 100644
--- a/chromium/third_party/skia/modules/sksg/src/SkSGText.cpp
+++ b/chromium/third_party/skia/modules/sksg/src/SkSGText.cpp
@@ -86,35 +86,4 @@ void Text::onClip(SkCanvas* canvas, bool antiAlias) const {
canvas->clipPath(this->asPath(), antiAlias);
}
-sk_sp<TextBlob> TextBlob::Make(sk_sp<SkTextBlob> blob) {
- return sk_sp<TextBlob>(new TextBlob(std::move(blob)));
-}
-
-TextBlob::TextBlob(sk_sp<SkTextBlob> blob)
- : fBlob(std::move(blob)) {}
-
-TextBlob::~TextBlob() = default;
-
-SkRect TextBlob::onRevalidate(InvalidationController*, const SkMatrix&) {
- return fBlob ? fBlob->bounds().makeOffset(fPosition.x(), fPosition.y())
- : SkRect::MakeEmpty();
-}
-
-void TextBlob::onDraw(SkCanvas* canvas, const SkPaint& paint) const {
- canvas->drawTextBlob(fBlob, fPosition.x(), fPosition.y(), paint);
-}
-
-bool TextBlob::onContains(const SkPoint& p) const {
- return this->asPath().contains(p.x(), p.y());
-}
-
-SkPath TextBlob::onAsPath() const {
- // TODO
- return SkPath();
-}
-
-void TextBlob::onClip(SkCanvas* canvas, bool antiAlias) const {
- canvas->clipPath(this->asPath(), antiAlias);
-}
-
} // namespace sksg
diff --git a/chromium/third_party/skia/modules/skshaper/BUILD.bazel b/chromium/third_party/skia/modules/skshaper/BUILD.bazel
index 2cbefc5c4eb..3ce487c187d 100644
--- a/chromium/third_party/skia/modules/skshaper/BUILD.bazel
+++ b/chromium/third_party/skia/modules/skshaper/BUILD.bazel
@@ -1,19 +1,33 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy")
+load("//bazel:macros.bzl", "exports_files_legacy", "selects", "skia_cc_library")
licenses(["notice"])
exports_files_legacy()
-cc_library(
+selects.config_setting_group(
+ name = "use_harfbuzz_shaper",
+ match_all = [
+ "//bazel/common_config_settings:use_icu_true",
+ "//bazel/common_config_settings:use_harfbuzz_true",
+ ],
+)
+
+# TODO(kjlubick,bungeman) coretext shaper
+
+skia_cc_library(
name = "skshaper",
srcs = ["//modules/skshaper/src:srcs"],
hdrs = ["//modules/skshaper/include:hdrs"],
+ defines = ["SKSHAPER_IMPLEMENTATION=1"] + select({
+ ":use_harfbuzz_shaper": ["SK_SHAPER_HARFBUZZ_AVAILABLE"],
+ "//conditions:default": [],
+ }),
visibility = ["//:__subpackages__"],
deps = [
- "//:skia_public",
+ "//:skia_internal",
] + select({
- "//bazel/common_config_settings:harfbuzz_shaper": [
- "//third_party:harfbuzz",
+ ":use_harfbuzz_shaper": [
+ "@harfbuzz",
"//modules/skunicode",
],
"//conditions:default": [],
diff --git a/chromium/third_party/skia/modules/skshaper/include/SkShaper.h b/chromium/third_party/skia/modules/skshaper/include/SkShaper.h
index 2b6d5870473..9712cce3d87 100644
--- a/chromium/third_party/skia/modules/skshaper/include/SkShaper.h
+++ b/chromium/third_party/skia/modules/skshaper/include/SkShaper.h
@@ -149,7 +149,10 @@ public:
MakeScriptRunIterator(const char* utf8, size_t utf8Bytes, SkFourByteTag script);
#if defined(SK_SHAPER_HARFBUZZ_AVAILABLE) && defined(SK_UNICODE_AVAILABLE)
static std::unique_ptr<ScriptRunIterator>
- MakeSkUnicodeHbScriptRunIterator(SkUnicode* unicode, const char* utf8, size_t utf8Bytes);
+ MakeSkUnicodeHbScriptRunIterator(const char* utf8, size_t utf8Bytes);
+ static std::unique_ptr<ScriptRunIterator>
+ MakeSkUnicodeHbScriptRunIterator(const char* utf8, size_t utf8Bytes, SkFourByteTag script);
+ // Still used in some cases
static std::unique_ptr<ScriptRunIterator>
MakeHbIcuScriptRunIterator(const char* utf8, size_t utf8Bytes);
#endif
diff --git a/chromium/third_party/skia/modules/skshaper/src/BUILD.bazel b/chromium/third_party/skia/modules/skshaper/src/BUILD.bazel
index 9110d32e34d..37319fd2c44 100644
--- a/chromium/third_party/skia/modules/skshaper/src/BUILD.bazel
+++ b/chromium/third_party/skia/modules/skshaper/src/BUILD.bazel
@@ -10,7 +10,7 @@ filegroup(
"SkShaper.cpp",
"SkShaper_primitive.cpp",
] + select({
- "//bazel/common_config_settings:harfbuzz_shaper": ["SkShaper_harfbuzz.cpp"],
+ "//modules/skshaper:use_harfbuzz_shaper": ["SkShaper_harfbuzz.cpp"],
# TODO(kjlubick, bungeman) Add support for SkShaper_coretext
"//conditions:default": [],
}),
diff --git a/chromium/third_party/skia/modules/skshaper/src/SkShaper.cpp b/chromium/third_party/skia/modules/skshaper/src/SkShaper.cpp
index bb8311500a0..fc421ffde3e 100644
--- a/chromium/third_party/skia/modules/skshaper/src/SkShaper.cpp
+++ b/chromium/third_party/skia/modules/skshaper/src/SkShaper.cpp
@@ -69,7 +69,7 @@ SkShaper::MakeScriptRunIterator(const char* utf8, size_t utf8Bytes, SkFourByteTa
return nullptr;
}
std::unique_ptr<SkShaper::ScriptRunIterator> script =
- SkShaper::MakeSkUnicodeHbScriptRunIterator(unicode.get(), utf8, utf8Bytes);
+ SkShaper::MakeSkUnicodeHbScriptRunIterator(utf8, utf8Bytes, scriptTag);
if (script) {
return script;
}
diff --git a/chromium/third_party/skia/modules/skshaper/src/SkShaper_harfbuzz.cpp b/chromium/third_party/skia/modules/skshaper/src/SkShaper_harfbuzz.cpp
index 3d45a5ee881..c8ca5802571 100644
--- a/chromium/third_party/skia/modules/skshaper/src/SkShaper_harfbuzz.cpp
+++ b/chromium/third_party/skia/modules/skshaper/src/SkShaper_harfbuzz.cpp
@@ -61,7 +61,6 @@ using HBBuffer = resource<hb_buffer_t , decltype(hb_buffer_destroy), hb_buffer
using SkUnicodeBidi = std::unique_ptr<SkBidiIterator>;
using SkUnicodeBreak = std::unique_ptr<SkBreakIterator>;
-using SkUnicodeScript = std::unique_ptr<SkScriptIterator>;
hb_position_t skhb_position(SkScalar value) {
// Treat HarfBuzz hb_position_t as 16.16 fixed-point.
@@ -400,10 +399,13 @@ private:
class SkUnicodeHbScriptRunIterator final: public SkShaper::ScriptRunIterator {
public:
- SkUnicodeHbScriptRunIterator(SkUnicodeScript, const char* utf8, size_t utf8Bytes)
- : fCurrent(utf8), fBegin(utf8), fEnd(fCurrent + utf8Bytes)
- , fCurrentScript(HB_SCRIPT_UNKNOWN)
- {}
+ SkUnicodeHbScriptRunIterator(const char* utf8,
+ size_t utf8Bytes,
+ hb_script_t defaultScript)
+ : fCurrent(utf8)
+ , fBegin(utf8)
+ , fEnd(fCurrent + utf8Bytes)
+ , fCurrentScript(defaultScript) {}
hb_script_t hb_script_for_unichar(SkUnichar u) {
return hb_unicode_script(hb_unicode_funcs_get_default(), u);
}
@@ -562,7 +564,7 @@ void append(SkShaper::RunHandler* handler, const SkShaper::RunHandler::RunInfo&
handler->commitRunBuffer(runInfo);
}
-void emit(const ShapedLine& line, SkShaper::RunHandler* handler) {
+void emit(SkUnicode* unicode, const ShapedLine& line, SkShaper::RunHandler* handler) {
// Reorder the runs and glyphs per line and write them out.
handler->beginLine();
@@ -572,7 +574,7 @@ void emit(const ShapedLine& line, SkShaper::RunHandler* handler) {
runLevels[i] = line.runs[i].fLevel;
}
SkAutoSTMalloc<4, int32_t> logicalFromVisual(numRuns);
- SkBidiIterator::ReorderVisual(runLevels, numRuns, logicalFromVisual);
+ unicode->reorderVisual(runLevels, numRuns, logicalFromVisual);
for (int i = 0; i < numRuns; ++i) {
int logicalIndex = logicalFromVisual[i];
@@ -817,9 +819,7 @@ void ShaperHarfBuzz::shape(const char* utf8, size_t utf8Bytes,
return;
}
- std::unique_ptr<ScriptRunIterator> script(MakeSkUnicodeHbScriptRunIterator(fUnicode.get(),
- utf8,
- utf8Bytes));
+ std::unique_ptr<ScriptRunIterator> script(MakeSkUnicodeHbScriptRunIterator(utf8, utf8Bytes));
if (!script) {
return;
}
@@ -977,7 +977,7 @@ void ShaperDrivenWrapper::wrap(char const * const utf8, size_t utf8Bytes,
// If nothing fit (best score is negative) and the line is not empty
if (width < line.fAdvance.fX + best.fAdvance.fX && !line.runs.empty()) {
- emit(line, handler);
+ emit(fUnicode.get(), line, handler);
line.runs.reset();
line.fAdvance = {0, 0};
} else {
@@ -997,14 +997,14 @@ void ShaperDrivenWrapper::wrap(char const * const utf8, size_t utf8Bytes,
// If item broken, emit line (prevent remainder from accidentally fitting)
if (utf8Start != utf8End) {
- emit(line, handler);
+ emit(fUnicode.get(), line, handler);
line.runs.reset();
line.fAdvance = {0, 0};
}
}
}
}
- emit(line, handler);
+ emit(fUnicode.get(), line, handler);
}
void ShapeThenWrap::wrap(char const * const utf8, size_t utf8Bytes,
@@ -1163,7 +1163,7 @@ void ShapeThenWrap::wrap(char const * const utf8, size_t utf8Bytes,
runLevels[i] = runs[previousBreak.fRunIndex + i].fLevel;
}
SkAutoSTMalloc<4, int32_t> logicalFromVisual(numRuns);
- SkBidiIterator::ReorderVisual(runLevels, numRuns, logicalFromVisual);
+ fUnicode->reorderVisual(runLevels, numRuns, logicalFromVisual);
// step through the runs in reverse visual order and the glyphs in reverse logical order
// until a visible glyph is found and force them to the end of the visual line.
@@ -1375,7 +1375,7 @@ ShapedRun ShaperHarfBuzz::shape(char const * const utf8,
}
SkSTArray<32, hb_feature_t> hbFeatures;
- for (const auto& feature : SkMakeSpan(features, featuresSize)) {
+ for (const auto& feature : SkSpan(features, featuresSize)) {
if (feature.end < SkTo<size_t>(utf8Start - utf8) ||
SkTo<size_t>(utf8End - utf8) <= feature.start)
{
@@ -1490,20 +1490,18 @@ SkShaper::MakeSkUnicodeBidiRunIterator(SkUnicode* unicode, const char* utf8, siz
std::unique_ptr<SkShaper::ScriptRunIterator>
SkShaper::MakeHbIcuScriptRunIterator(const char* utf8, size_t utf8Bytes) {
- auto unicode = SkUnicode::Make();
- if (!unicode) {
- return nullptr;
- }
- return SkShaper::MakeSkUnicodeHbScriptRunIterator(unicode.get(), utf8, utf8Bytes);
+ return SkShaper::MakeSkUnicodeHbScriptRunIterator(utf8, utf8Bytes);
}
std::unique_ptr<SkShaper::ScriptRunIterator>
-SkShaper::MakeSkUnicodeHbScriptRunIterator(SkUnicode* unicode, const char* utf8, size_t utf8Bytes) {
- auto script = unicode->makeScriptIterator();
- if (!script) {
- return nullptr;
- }
- return std::make_unique<SkUnicodeHbScriptRunIterator>(std::move(script), utf8, utf8Bytes);
+SkShaper::MakeSkUnicodeHbScriptRunIterator(const char* utf8, size_t utf8Bytes) {
+ return std::make_unique<SkUnicodeHbScriptRunIterator>(utf8, utf8Bytes, HB_SCRIPT_UNKNOWN);
+}
+
+std::unique_ptr<SkShaper::ScriptRunIterator> SkShaper::MakeSkUnicodeHbScriptRunIterator(
+ const char* utf8, size_t utf8Bytes, SkFourByteTag script) {
+ return std::make_unique<SkUnicodeHbScriptRunIterator>(
+ utf8, utf8Bytes, hb_script_from_iso15924_tag((hb_tag_t)script));
}
std::unique_ptr<SkShaper> SkShaper::MakeShaperDrivenWrapper(sk_sp<SkFontMgr> fontmgr) {
diff --git a/chromium/third_party/skia/modules/skunicode/BUILD.bazel b/chromium/third_party/skia/modules/skunicode/BUILD.bazel
index 52a7a98792a..45269d5cf65 100644
--- a/chromium/third_party/skia/modules/skunicode/BUILD.bazel
+++ b/chromium/third_party/skia/modules/skunicode/BUILD.bazel
@@ -1,16 +1,17 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy")
+load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_library")
licenses(["notice"])
exports_files_legacy()
-cc_library(
+skia_cc_library(
name = "skunicode",
srcs = ["//modules/skunicode/src:srcs"],
hdrs = ["//modules/skunicode/include:hdrs"],
+ defines = ["SK_UNICODE_AVAILABLE"],
visibility = ["//:__subpackages__"],
deps = [
- "//:skia_public",
- "//third_party:icu",
+ "//:skia_internal",
+ "@icu",
],
)
diff --git a/chromium/third_party/skia/modules/skunicode/include/SkUnicode.h b/chromium/third_party/skia/modules/skunicode/include/SkUnicode.h
index 5c1d02b345e..ef5094b8130 100644
--- a/chromium/third_party/skia/modules/skunicode/include/SkUnicode.h
+++ b/chromium/third_party/skia/modules/skunicode/include/SkUnicode.h
@@ -1,15 +1,21 @@
/*
- * Copyright 2020 Google Inc.
+ * Copyright 2020 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkUnicode_DEFINED
#define SkUnicode_DEFINED
-
#include "include/core/SkSpan.h"
+#include "include/core/SkString.h"
#include "include/core/SkTypes.h"
+#include "include/private/SkBitmaskEnum.h"
#include "src/utils/SkUTF.h"
+
+#include <cstddef>
+#include <cstdint>
+#include <memory>
+#include <string>
#include <vector>
#if !defined(SKUNICODE_IMPLEMENTATION)
@@ -50,7 +56,6 @@ public:
virtual ~SkBidiIterator() = default;
virtual Position getLength() = 0;
virtual Level getLevelAt(Position) = 0;
- static void ReorderVisual(const Level runLevels[], int levelsCount, int32_t logicalFromVisual[]);
};
class SKUNICODE_API SkBreakIterator {
@@ -61,25 +66,24 @@ public:
virtual Position first() = 0;
virtual Position current() = 0;
virtual Position next() = 0;
- virtual Position preceding(Position offset) = 0;
- virtual Position following(Position offset) = 0;
virtual Status status() = 0;
virtual bool isDone() = 0;
virtual bool setText(const char utftext8[], int utf8Units) = 0;
virtual bool setText(const char16_t utftext16[], int utf16Units) = 0;
};
-class SKUNICODE_API SkScriptIterator {
- public:
- typedef uint32_t ScriptID;
- virtual ~SkScriptIterator() = default;
- virtual bool getScript(SkUnichar u, ScriptID* script) = 0;
-};
-
class SKUNICODE_API SkUnicode {
public:
- typedef uint32_t CombiningClass;
- typedef uint32_t GeneralCategory;
+ enum CodeUnitFlags {
+ kNoCodeUnitFlag = 0x00,
+ kPartOfWhiteSpaceBreak = 0x01,
+ kGraphemeStart = 0x02,
+ kSoftLineBreakBefore = 0x04,
+ kHardLineBreakBefore = 0x08,
+ kPartOfIntraWordBreak = 0x10,
+ kControl = 0x20,
+ kTabulation = 0x40,
+ };
enum class TextDirection {
kLTR,
kRTL,
@@ -112,10 +116,6 @@ class SKUNICODE_API SkUnicode {
virtual ~SkUnicode() = default;
- virtual bool isControl(SkUnichar utf8) = 0;
- virtual bool isWhitespace(SkUnichar utf8) = 0;
- virtual bool isSpace(SkUnichar utf8) = 0;
- virtual bool isHardBreak(SkUnichar utf8) = 0;
virtual SkString toUpper(const SkString&) = 0;
// Methods used in SkShaper and SkText
@@ -126,53 +126,71 @@ class SKUNICODE_API SkUnicode {
virtual std::unique_ptr<SkBreakIterator> makeBreakIterator
(const char locale[], BreakType breakType) = 0;
virtual std::unique_ptr<SkBreakIterator> makeBreakIterator(BreakType type) = 0;
- virtual std::unique_ptr<SkScriptIterator> makeScriptIterator() = 0;
-
- // High level methods (that we actually use somewhere=SkParagraph)
- virtual bool getBidiRegions
- (const char utf8[], int utf8Units, TextDirection dir, std::vector<BidiRegion>* results) = 0;
- virtual bool getLineBreaks
- (const char utf8[], int utf8Units, std::vector<LineBreakBefore>* results) = 0;
- virtual bool getWords
- (const char utf8[], int utf8Units, std::vector<Position>* results) = 0;
- virtual bool getGraphemes
- (const char utf8[], int utf8Units, std::vector<Position>* results) = 0;
-
- static SkString convertUtf16ToUtf8(const char16_t * utf16, int utf16Units) {
-
- int utf8Units = SkUTF::UTF16ToUTF8(nullptr, 0, (uint16_t*)utf16, utf16Units);
- if (utf8Units < 0) {
- SkDEBUGF("Convert error: Invalid utf16 input");
- return SkString();
- }
- SkAutoTArray<char> utf8(utf8Units);
- SkDEBUGCODE(int dstLen =) SkUTF::UTF16ToUTF8(utf8.data(), utf8Units, (uint16_t*)utf16, utf16Units);
- SkASSERT(dstLen == utf8Units);
- return SkString(utf8.data(), utf8Units);
- }
+ // Methods used in SkParagraph
+ static bool isTabulation(SkUnicode::CodeUnitFlags flags);
+ static bool isHardLineBreak(SkUnicode::CodeUnitFlags flags);
+ static bool isControl(SkUnicode::CodeUnitFlags flags);
+ static bool isPartOfWhiteSpaceBreak(SkUnicode::CodeUnitFlags flags);
+ virtual bool getBidiRegions(const char utf8[],
+ int utf8Units,
+ TextDirection dir,
+ std::vector<BidiRegion>* results) = 0;
+ virtual bool getWords(const char utf8[], int utf8Units, std::vector<Position>* results) = 0;
+ virtual bool computeCodeUnitFlags(char utf8[], int utf8Units, bool replaceTabs,
+ SkTArray<SkUnicode::CodeUnitFlags, true>* results) = 0;
+ virtual bool computeCodeUnitFlags(char16_t utf16[], int utf16Units, bool replaceTabs,
+ SkTArray<SkUnicode::CodeUnitFlags, true>* results) = 0;
- static SkString convertUtf16ToUtf8(const std::u16string& utf16) {
- return convertUtf16ToUtf8(utf16.c_str(), utf16.size());
- }
+ static SkString convertUtf16ToUtf8(const char16_t * utf16, int utf16Units);
+ static SkString convertUtf16ToUtf8(const std::u16string& utf16);
+ static std::u16string convertUtf8ToUtf16(const char* utf8, int utf8Units);
+ static std::u16string convertUtf8ToUtf16(const SkString& utf8);
- static std::u16string convertUtf8ToUtf16(const char* utf8, int utf8Units) {
+ template <typename Appender8, typename Appender16>
+ bool extractUtfConversionMapping(SkSpan<const char> utf8, Appender8&& appender8, Appender16&& appender16) {
+ size_t size8 = 0;
+ size_t size16 = 0;
+ auto ptr = utf8.begin();
+ auto end = utf8.end();
+ while (ptr < end) {
- int utf16Units = SkUTF::UTF8ToUTF16(nullptr, 0, utf8, utf8Units);
- if (utf16Units < 0) {
- SkDEBUGF("Convert error: Invalid utf8 input");
- return std::u16string();
- }
+ size_t index = ptr - utf8.begin();
+ SkUnichar u = SkUTF::NextUTF8(&ptr, end);
- SkAutoTArray<uint16_t> utf16(utf16Units);
- SkDEBUGCODE(int dstLen =) SkUTF::UTF8ToUTF16(utf16.data(), utf16Units, utf8, utf8Units);
- SkASSERT(dstLen == utf16Units);
+ // All UTF8 code units refer to the same codepoint
+ size_t next = ptr - utf8.begin();
+ for (auto i = index; i < next; ++i) {
+ //fUTF16IndexForUTF8Index.emplace_back(fUTF8IndexForUTF16Index.size());
+ appender16(size8);
+ ++size16;
+ }
+ //SkASSERT(fUTF16IndexForUTF8Index.size() == next);
+ SkASSERT(size16 == next);
+ if (size16 != next) {
+ return false;
+ }
- return std::u16string((char16_t *)utf16.data(), utf16Units);
- }
+ // One or two UTF16 code units refer to the same codepoint
+ uint16_t buffer[2];
+ size_t count = SkUTF::ToUTF16(u, buffer);
+ //fUTF8IndexForUTF16Index.emplace_back(index);
+ appender8(index);
+ ++size8;
+ if (count > 1) {
+ //fUTF8IndexForUTF16Index.emplace_back(index);
+ appender8(index);
+ ++size8;
+ }
+ }
+ //fUTF16IndexForUTF8Index.emplace_back(fUTF8IndexForUTF16Index.size());
+ appender16(size8);
+ ++size16;
+ //fUTF8IndexForUTF16Index.emplace_back(fText.size());
+ appender8(utf8.size());
+ ++size8;
- static std::u16string convertUtf8ToUtf16(const SkString& utf8) {
- return convertUtf8ToUtf16(utf8.c_str(), utf8.size());
+ return true;
}
template <typename Callback>
@@ -240,6 +258,14 @@ class SKUNICODE_API SkUnicode {
virtual void reorderVisual(const BidiLevel runLevels[], int levelsCount, int32_t logicalFromVisual[]) = 0;
static std::unique_ptr<SkUnicode> Make();
+
+ static std::unique_ptr<SkUnicode> Make(SkSpan<const char> text,
+ std::vector<SkUnicode::BidiRegion> bidiRegions,
+ std::vector<SkUnicode::Position> graphemeBreaks,
+ std::vector<SkUnicode::LineBreakBefore> lineBreaks);
};
+namespace sknonstd {
+ template <> struct is_bitmask_enum<SkUnicode::CodeUnitFlags> : std::true_type {};
+} // namespace sknonstd
#endif // SkUnicode_DEFINED
diff --git a/chromium/third_party/skia/modules/skunicode/skunicode.gni b/chromium/third_party/skia/modules/skunicode/skunicode.gni
index 19bc4f15743..b1b25c1a853 100644
--- a/chromium/third_party/skia/modules/skunicode/skunicode.gni
+++ b/chromium/third_party/skia/modules/skunicode/skunicode.gni
@@ -10,6 +10,7 @@ _include = get_path_info("include", "abspath")
skia_unicode_public = [ "$_include/SkUnicode.h" ]
skia_unicode_sources = [
+ "$_src/SkUnicode.cpp",
"$_src/SkUnicode_icu.cpp",
"$_src/SkUnicode_icu.h",
]
diff --git a/chromium/third_party/skia/modules/skunicode/src/BUILD.bazel b/chromium/third_party/skia/modules/skunicode/src/BUILD.bazel
index 34ef5687bac..ea8c27c4746 100644
--- a/chromium/third_party/skia/modules/skunicode/src/BUILD.bazel
+++ b/chromium/third_party/skia/modules/skunicode/src/BUILD.bazel
@@ -7,6 +7,7 @@ exports_files_legacy()
filegroup(
name = "srcs",
srcs = [
+ "SkUnicode.cpp",
"SkUnicode_icu.cpp",
"SkUnicode_icu.h",
"SkUnicode_icu_builtin.cpp",
diff --git a/chromium/third_party/skia/modules/skunicode/src/SkUnicode.cpp b/chromium/third_party/skia/modules/skunicode/src/SkUnicode.cpp
new file mode 100644
index 00000000000..240cd220ce6
--- /dev/null
+++ b/chromium/third_party/skia/modules/skunicode/src/SkUnicode.cpp
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "modules/skunicode/include/SkUnicode.h"
+
+SkString SkUnicode::convertUtf16ToUtf8(const char16_t* utf16, int utf16Units) {
+
+ int utf8Units = SkUTF::UTF16ToUTF8(nullptr, 0, (uint16_t*)utf16, utf16Units);
+ if (utf8Units < 0) {
+ SkDEBUGF("Convert error: Invalid utf16 input");
+ return SkString();
+ }
+ SkAutoTArray<char> utf8(utf8Units);
+ SkDEBUGCODE(int dstLen =) SkUTF::UTF16ToUTF8(utf8.data(), utf8Units, (uint16_t*)utf16, utf16Units);
+ SkASSERT(dstLen == utf8Units);
+
+ return SkString(utf8.data(), utf8Units);
+}
+
+SkString SkUnicode::convertUtf16ToUtf8(const std::u16string& utf16) {
+ return convertUtf16ToUtf8(utf16.c_str(), utf16.size());
+}
+
+std::u16string SkUnicode::convertUtf8ToUtf16(const char* utf8, int utf8Units) {
+
+ int utf16Units = SkUTF::UTF8ToUTF16(nullptr, 0, utf8, utf8Units);
+ if (utf16Units < 0) {
+ SkDEBUGF("Convert error: Invalid utf8 input");
+ return std::u16string();
+ }
+
+ SkAutoTArray<uint16_t> utf16(utf16Units);
+ SkDEBUGCODE(int dstLen =) SkUTF::UTF8ToUTF16(utf16.data(), utf16Units, utf8, utf8Units);
+ SkASSERT(dstLen == utf16Units);
+
+ return std::u16string((char16_t *)utf16.data(), utf16Units);
+}
+
+std::u16string SkUnicode::convertUtf8ToUtf16(const SkString& utf8) {
+ return convertUtf8ToUtf16(utf8.c_str(), utf8.size());
+}
+
+bool SkUnicode::isTabulation(SkUnicode::CodeUnitFlags flags) {
+ return (flags & SkUnicode::kTabulation) == SkUnicode::kTabulation;
+}
+
+bool SkUnicode::isHardLineBreak(SkUnicode::CodeUnitFlags flags) {
+ return (flags & SkUnicode::kHardLineBreakBefore) == SkUnicode::kHardLineBreakBefore;
+}
+
+bool SkUnicode::isControl(SkUnicode::CodeUnitFlags flags) {
+ return (flags & SkUnicode::kControl) == SkUnicode::kControl;
+}
+
+bool SkUnicode::isPartOfWhiteSpaceBreak(SkUnicode::CodeUnitFlags flags) {
+ return (flags & SkUnicode::kPartOfWhiteSpaceBreak) == SkUnicode::kPartOfWhiteSpaceBreak;
+}
diff --git a/chromium/third_party/skia/modules/skunicode/src/SkUnicode_icu.cpp b/chromium/third_party/skia/modules/skunicode/src/SkUnicode_icu.cpp
index 0f84cbc3a2f..c217a82dba2 100644
--- a/chromium/third_party/skia/modules/skunicode/src/SkUnicode_icu.cpp
+++ b/chromium/third_party/skia/modules/skunicode/src/SkUnicode_icu.cpp
@@ -4,17 +4,24 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "modules/skunicode/src/SkUnicode_icu.h"
+
#include "include/core/SkString.h"
+#include "include/core/SkTypes.h"
#include "include/private/SkMutex.h"
#include "include/private/SkOnce.h"
#include "include/private/SkTFitsIn.h"
#include "include/private/SkTHash.h"
#include "include/private/SkTemplates.h"
+#include "include/private/SkTo.h"
#include "modules/skunicode/include/SkUnicode.h"
-#include "modules/skunicode/src/SkUnicode_icu.h"
#include "src/utils/SkUTF.h"
-#include <vector>
+
#include <functional>
+#include <string>
+#include <unicode/umachine.h>
+#include <utility>
+#include <vector>
#if defined(SK_USING_THIRD_PARTY_ICU)
#include "SkLoadICU.h"
@@ -125,27 +132,16 @@ public:
}
};
-void SkBidiIterator::ReorderVisual(const Level runLevels[], int levelsCount,
- int32_t logicalFromVisual[]) {
- sk_ubidi_reorderVisual(runLevels, levelsCount, logicalFromVisual);
-}
-
class SkBreakIterator_icu : public SkBreakIterator {
ICUBreakIterator fBreakIterator;
Position fLastResult;
public:
explicit SkBreakIterator_icu(ICUBreakIterator iter)
- : fBreakIterator(std::move(iter)), fLastResult(0) {}
- Position first() override
- { return fLastResult = sk_ubrk_first(fBreakIterator.get()); }
- Position current() override
- { return fLastResult = sk_ubrk_current(fBreakIterator.get()); }
- Position next() override
- { return fLastResult = sk_ubrk_next(fBreakIterator.get()); }
- Position preceding(Position offset) override
- { return fLastResult = sk_ubrk_preceding(fBreakIterator.get(), offset); }
- Position following(Position offset) override
- { return fLastResult = sk_ubrk_following(fBreakIterator.get(), offset);}
+ : fBreakIterator(std::move(iter))
+ , fLastResult(0) {}
+ Position first() override { return fLastResult = sk_ubrk_first(fBreakIterator.get()); }
+ Position current() override { return fLastResult = sk_ubrk_current(fBreakIterator.get()); }
+ Position next() override { return fLastResult = sk_ubrk_next(fBreakIterator.get()); }
Status status() override { return sk_ubrk_getRuleStatus(fBreakIterator.get()); }
bool isDone() override { return fLastResult == UBRK_DONE; }
@@ -223,25 +219,6 @@ class SkIcuBreakIteratorCache {
}
};
-class SkScriptIterator_icu : public SkScriptIterator {
- public:
- bool getScript(SkUnichar u, ScriptID* script) override {
- UErrorCode status = U_ZERO_ERROR;
- UScriptCode scriptCode = sk_uscript_getScript(u, &status);
- if (U_FAILURE (status)) {
- return false;
- }
- if (script) {
- *script = (ScriptID)scriptCode;
- }
- return true;
- }
-
- static std::unique_ptr<SkScriptIterator> makeScriptIterator() {
- return std::unique_ptr<SkScriptIterator>(new SkScriptIterator_icu());
- }
-};
-
class SkUnicode_icu : public SkUnicode {
static bool extractBidi(const char utf8[],
int utf8Units,
@@ -366,10 +343,10 @@ class SkUnicode_icu : public SkUnicode {
auto iter = iterator.get();
int32_t pos = sk_ubrk_first(iter);
while (pos != UBRK_DONE) {
- auto status = type == SkUnicode::BreakType::kLines
- ? UBRK_LINE_SOFT
- : sk_ubrk_getRuleStatus(iter);
- setBreak(pos, status);
+ int s = type == SkUnicode::BreakType::kLines
+ ? UBRK_LINE_SOFT
+ : sk_ubrk_getRuleStatus(iter);
+ setBreak(pos, s);
pos = sk_ubrk_next(iter);
}
@@ -390,6 +367,27 @@ class SkUnicode_icu : public SkUnicode {
return true;
}
+ static bool isControl(SkUnichar utf8) {
+ return sk_u_iscntrl(utf8);
+ }
+
+ static bool isWhitespace(SkUnichar utf8) {
+ return sk_u_isWhitespace(utf8);
+ }
+
+ static bool isSpace(SkUnichar utf8) {
+ return sk_u_isspace(utf8);
+ }
+
+ static bool isTabulation(SkUnichar utf8) {
+ return utf8 == '\t';
+ }
+
+ static bool isHardBreak(SkUnichar utf8) {
+ auto property = sk_u_getIntPropertyValue(utf8, UCHAR_LINE_BREAK);
+ return property == U_LB_LINE_FEED || property == U_LB_MANDATORY_BREAK;
+ }
+
public:
~SkUnicode_icu() override { }
std::unique_ptr<SkBidiIterator> makeBidiIterator(const uint16_t text[], int count,
@@ -415,32 +413,12 @@ public:
std::unique_ptr<SkBreakIterator> makeBreakIterator(BreakType breakType) override {
return makeBreakIterator(sk_uloc_getDefault(), breakType);
}
- std::unique_ptr<SkScriptIterator> makeScriptIterator() override {
- return SkScriptIterator_icu::makeScriptIterator();
- }
static bool isHardLineBreak(SkUnichar utf8) {
auto property = sk_u_getIntPropertyValue(utf8, UCHAR_LINE_BREAK);
return property == U_LB_LINE_FEED || property == U_LB_MANDATORY_BREAK;
}
- // TODO: Use ICU data file to detect controls and whitespaces
- bool isControl(SkUnichar utf8) override {
- return sk_u_iscntrl(utf8);
- }
-
- bool isWhitespace(SkUnichar utf8) override {
- return sk_u_isWhitespace(utf8);
- }
-
- bool isSpace(SkUnichar utf8) override {
- return sk_u_isspace(utf8);
- }
-
- bool isHardBreak(SkUnichar utf8) override {
- return SkUnicode_icu::isHardLineBreak(utf8);
- }
-
SkString toUpper(const SkString& str) override {
// Convert to UTF16 since that's what ICU wants.
auto str16 = convertUtf8ToUtf16(str.c_str(), str.size());
@@ -467,33 +445,114 @@ public:
int utf8Units,
TextDirection dir,
std::vector<BidiRegion>* results) override {
- return extractBidi(utf8, utf8Units, dir, results);
- }
-
- bool getLineBreaks(const char utf8[],
- int utf8Units,
- std::vector<LineBreakBefore>* results) override {
-
- return extractPositions(utf8, utf8Units, BreakType::kLines,
- [results](int pos, int status) {
- results->emplace_back(pos, status == UBRK_LINE_HARD
- ? LineBreakType::kHardLineBreak
- : LineBreakType::kSoftLineBreak);
- });
+ return SkUnicode_icu::extractBidi(utf8, utf8Units, dir, results);
}
bool getWords(const char utf8[], int utf8Units, std::vector<Position>* results) override {
// Convert to UTF16 since we want the results in utf16
auto utf16 = convertUtf8ToUtf16(utf8, utf8Units);
- return extractWords((uint16_t*)utf16.c_str(), utf16.size(), results);
+ return SkUnicode_icu::extractWords((uint16_t*)utf16.c_str(), utf16.size(), results);
}
- bool getGraphemes(const char utf8[], int utf8Units, std::vector<Position>* results) override {
+ bool computeCodeUnitFlags(char utf8[], int utf8Units, bool replaceTabs,
+ SkTArray<SkUnicode::CodeUnitFlags, true>* results) override {
+ results->reset();
+ results->push_back_n(utf8Units + 1, CodeUnitFlags::kNoCodeUnitFlag);
+
+ SkUnicode_icu::extractPositions(utf8, utf8Units, BreakType::kLines, [&](int pos,
+ int status) {
+ (*results)[pos] |= status == UBRK_LINE_HARD
+ ? CodeUnitFlags::kHardLineBreakBefore
+ : CodeUnitFlags::kSoftLineBreakBefore;
+ });
- return extractPositions(utf8, utf8Units, BreakType::kGraphemes,
- [results](int pos, int status) { results->emplace_back(pos);
+ SkUnicode_icu::extractPositions(utf8, utf8Units, BreakType::kGraphemes, [&](int pos,
+ int status) {
+ (*results)[pos] |= CodeUnitFlags::kGraphemeStart;
});
+
+ const char* current = utf8;
+ const char* end = utf8 + utf8Units;
+ while (current < end) {
+ auto before = current - utf8;
+ SkUnichar unichar = SkUTF::NextUTF8(&current, end);
+ if (unichar < 0) unichar = 0xFFFD;
+ auto after = current - utf8;
+ if (replaceTabs && SkUnicode_icu::isTabulation(unichar)) {
+ results->at(before) |= SkUnicode::kTabulation;
+ if (replaceTabs) {
+ unichar = ' ';
+ utf8[before] = ' ';
+ }
+ }
+ for (auto i = before; i < after; ++i) {
+ if (SkUnicode_icu::isSpace(unichar)) {
+ results->at(i) |= SkUnicode::kPartOfIntraWordBreak;
+ }
+ if (SkUnicode_icu::isWhitespace(unichar)) {
+ results->at(i) |= SkUnicode::kPartOfWhiteSpaceBreak;
+ }
+ if (SkUnicode_icu::isControl(unichar)) {
+ results->at(i) |= SkUnicode::kControl;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ bool computeCodeUnitFlags(char16_t utf16[], int utf16Units, bool replaceTabs,
+ SkTArray<SkUnicode::CodeUnitFlags, true>* results) override {
+ results->reset();
+ results->push_back_n(utf16Units + 1, CodeUnitFlags::kNoCodeUnitFlag);
+
+ // Get white spaces
+ this->forEachCodepoint((char16_t*)&utf16[0], utf16Units,
+ [results, replaceTabs, &utf16](SkUnichar unichar, int32_t start, int32_t end) {
+ for (auto i = start; i < end; ++i) {
+ if (replaceTabs && SkUnicode_icu::isTabulation(unichar)) {
+ results->at(i) |= SkUnicode::kTabulation;
+ if (replaceTabs) {
+ unichar = ' ';
+ utf16[start] = ' ';
+ }
+ }
+ if (SkUnicode_icu::isSpace(unichar)) {
+ results->at(i) |= SkUnicode::kPartOfIntraWordBreak;
+ }
+ if (SkUnicode_icu::isWhitespace(unichar)) {
+ results->at(i) |= SkUnicode::kPartOfWhiteSpaceBreak;
+ }
+ if (SkUnicode_icu::isControl(unichar)) {
+ results->at(i) |= SkUnicode::kControl;
+ }
+ }
+ });
+ // Get graphemes
+ this->forEachBreak((char16_t*)&utf16[0],
+ utf16Units,
+ SkUnicode::BreakType::kGraphemes,
+ [results](SkBreakIterator::Position pos, SkBreakIterator::Status) {
+ (*results)[pos] |= CodeUnitFlags::kGraphemeStart;
+ });
+ // Get line breaks
+ this->forEachBreak(
+ (char16_t*)&utf16[0],
+ utf16Units,
+ SkUnicode::BreakType::kLines,
+ [results](SkBreakIterator::Position pos, SkBreakIterator::Status status) {
+ if (status ==
+ (SkBreakIterator::Status)SkUnicode::LineBreakType::kHardLineBreak) {
+ // Hard line breaks clears off all the other flags
+ // TODO: Treat \n as a formatting mark and do not pass it to SkShaper
+ (*results)[pos-1] = CodeUnitFlags::kHardLineBreakBefore;
+ } else {
+ (*results)[pos] |= CodeUnitFlags::kSoftLineBreakBefore;
+ }
+ });
+
+ return true;
}
void reorderVisual(const BidiLevel runLevels[],
diff --git a/chromium/third_party/skia/modules/skunicode/src/SkUnicode_icu.h b/chromium/third_party/skia/modules/skunicode/src/SkUnicode_icu.h
index 63615a1cc45..e3620777183 100644
--- a/chromium/third_party/skia/modules/skunicode/src/SkUnicode_icu.h
+++ b/chromium/third_party/skia/modules/skunicode/src/SkUnicode_icu.h
@@ -7,15 +7,17 @@
#ifndef SkUnicode_icu_DEFINED
#define SkUnicode_icu_DEFINED
+#include <cstdint>
+#include <memory>
#include <unicode/ubidi.h>
#include <unicode/ubrk.h>
+#include <unicode/uchar.h>
+#include <unicode/uloc.h>
#include <unicode/uscript.h>
#include <unicode/ustring.h>
#include <unicode/utext.h>
#include <unicode/utypes.h>
-#include "include/private/SkTemplates.h"
-
#define SKICU_EMIT_FUNCS \
SKICU_FUNC(u_errorName) \
SKICU_FUNC(u_getIntPropertyValue) \
diff --git a/chromium/third_party/skia/modules/skunicode/src/SkUnicode_icu_builtin.cpp b/chromium/third_party/skia/modules/skunicode/src/SkUnicode_icu_builtin.cpp
index a6a8bf285f4..d49951e920c 100644
--- a/chromium/third_party/skia/modules/skunicode/src/SkUnicode_icu_builtin.cpp
+++ b/chromium/third_party/skia/modules/skunicode/src/SkUnicode_icu_builtin.cpp
@@ -7,6 +7,11 @@
#include "modules/skunicode/src/SkUnicode_icu.h"
+#include <memory>
+#include <unicode/ubrk.h>
+#include <unicode/utypes.h>
+#include <utility>
+
#define SKICU_FUNC(funcname) funcname,
// ubrk_clone added as draft in ICU69 and Android API 31 (first ICU NDK).
diff --git a/chromium/third_party/skia/modules/svg/include/SkSVGAttributeParser.h b/chromium/third_party/skia/modules/svg/include/SkSVGAttributeParser.h
index bc30876bf8b..e4ac579f796 100644
--- a/chromium/third_party/skia/modules/svg/include/SkSVGAttributeParser.h
+++ b/chromium/third_party/skia/modules/svg/include/SkSVGAttributeParser.h
@@ -141,7 +141,7 @@ private:
template <typename T, typename TArray>
bool parseEnumMap(const TArray& arr, T* result) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(arr); ++i) {
+ for (size_t i = 0; i < std::size(arr); ++i) {
if (this->parseExpectedStringToken(std::get<0>(arr[i]))) {
*result = std::get<1>(arr[i]);
return true;
diff --git a/chromium/third_party/skia/modules/svg/include/SkSVGTypes.h b/chromium/third_party/skia/modules/svg/include/SkSVGTypes.h
index 39ea8994748..db103bef591 100644
--- a/chromium/third_party/skia/modules/svg/include/SkSVGTypes.h
+++ b/chromium/third_party/skia/modules/svg/include/SkSVGTypes.h
@@ -204,10 +204,10 @@ public:
Type type() const { return fType; }
const SkSVGColorType& color() const { SkASSERT(fType == Type::kColor); return fColor; }
SkSpan<const SkString> vars() const {
- return fVars ? SkMakeSpan<const Vars>(fVars->fData) : SkSpan<const SkString>{nullptr, 0};
+ return fVars ? SkSpan<const SkString>(fVars->fData) : SkSpan<const SkString>();
}
- SkSpan< SkString> vars() {
- return fVars ? SkMakeSpan< Vars>(fVars->fData) : SkSpan< SkString>{nullptr, 0};
+ SkSpan<SkString> vars() {
+ return fVars ? SkSpan<SkString>(fVars->fData) : SkSpan<SkString>();
}
private:
diff --git a/chromium/third_party/skia/modules/svg/src/SkSVGAttributeParser.cpp b/chromium/third_party/skia/modules/svg/src/SkSVGAttributeParser.cpp
index 1be34fe990c..92b23c7e3f3 100644
--- a/chromium/third_party/skia/modules/svg/src/SkSVGAttributeParser.cpp
+++ b/chromium/third_party/skia/modules/svg/src/SkSVGAttributeParser.cpp
@@ -229,7 +229,7 @@ bool SkSVGAttributeParser::parseLengthUnitToken(SkSVGLength::Unit* unit) {
{ "pc", SkSVGLength::Unit::kPC },
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gUnitInfo); ++i) {
+ for (size_t i = 0; i < std::size(gUnitInfo); ++i) {
if (this->parseExpectedStringToken(gUnitInfo[i].fUnitName)) {
*unit = gUnitInfo[i].fUnit;
return true;
@@ -745,7 +745,7 @@ bool SkSVGAttributeParser::parse(SkSVGLineCap* cap) {
};
bool parsedValue = false;
- for (size_t i = 0; i < SK_ARRAY_COUNT(gCapInfo); ++i) {
+ for (size_t i = 0; i < std::size(gCapInfo); ++i) {
if (this->parseExpectedStringToken(gCapInfo[i].fName)) {
*cap = SkSVGLineCap(gCapInfo[i].fType);
parsedValue = true;
@@ -770,7 +770,7 @@ bool SkSVGAttributeParser::parse(SkSVGLineJoin* join) {
};
bool parsedValue = false;
- for (size_t i = 0; i < SK_ARRAY_COUNT(gJoinInfo); ++i) {
+ for (size_t i = 0; i < std::size(gJoinInfo); ++i) {
if (this->parseExpectedStringToken(gJoinInfo[i].fName)) {
*join = SkSVGLineJoin(gJoinInfo[i].fType);
parsedValue = true;
@@ -859,7 +859,7 @@ bool SkSVGAttributeParser::parse(SkSVGFillRule* fillRule) {
};
bool parsedValue = false;
- for (size_t i = 0; i < SK_ARRAY_COUNT(gFillRuleInfo); ++i) {
+ for (size_t i = 0; i < std::size(gFillRuleInfo); ++i) {
if (this->parseExpectedStringToken(gFillRuleInfo[i].fName)) {
*fillRule = SkSVGFillRule(gFillRuleInfo[i].fType);
parsedValue = true;
diff --git a/chromium/third_party/skia/modules/svg/src/SkSVGDOM.cpp b/chromium/third_party/skia/modules/svg/src/SkSVGDOM.cpp
index a0a3edffc34..68b58fe8384 100644
--- a/chromium/third_party/skia/modules/svg/src/SkSVGDOM.cpp
+++ b/chromium/third_party/skia/modules/svg/src/SkSVGDOM.cpp
@@ -291,7 +291,7 @@ bool set_string_attribute(const sk_sp<SkSVGNode>& node, const char* name, const
}
const int attrIndex = SkStrSearch(&gAttributeParseInfo[0].fKey,
- SkTo<int>(SK_ARRAY_COUNT(gAttributeParseInfo)),
+ SkTo<int>(std::size(gAttributeParseInfo)),
name, sizeof(gAttributeParseInfo[0]));
if (attrIndex < 0) {
#if defined(SK_VERBOSE_SVG_PARSING)
@@ -300,7 +300,7 @@ bool set_string_attribute(const sk_sp<SkSVGNode>& node, const char* name, const
return false;
}
- SkASSERT(SkTo<size_t>(attrIndex) < SK_ARRAY_COUNT(gAttributeParseInfo));
+ SkASSERT(SkTo<size_t>(attrIndex) < std::size(gAttributeParseInfo));
const auto& attrInfo = gAttributeParseInfo[attrIndex].fValue;
if (!attrInfo.fSetter(node, attrInfo.fAttr, value)) {
#if defined(SK_VERBOSE_SVG_PARSING)
@@ -351,7 +351,7 @@ sk_sp<SkSVGNode> construct_svg_node(const SkDOM& dom, const ConstructionContext&
}
const int tagIndex = SkStrSearch(&gTagFactories[0].fKey,
- SkTo<int>(SK_ARRAY_COUNT(gTagFactories)),
+ SkTo<int>(std::size(gTagFactories)),
elem, sizeof(gTagFactories[0]));
if (tagIndex < 0) {
#if defined(SK_VERBOSE_SVG_PARSING)
@@ -359,7 +359,7 @@ sk_sp<SkSVGNode> construct_svg_node(const SkDOM& dom, const ConstructionContext&
#endif
return nullptr;
}
- SkASSERT(SkTo<size_t>(tagIndex) < SK_ARRAY_COUNT(gTagFactories));
+ SkASSERT(SkTo<size_t>(tagIndex) < std::size(gTagFactories));
return gTagFactories[tagIndex].fValue();
};
diff --git a/chromium/third_party/skia/modules/svg/src/SkSVGGradient.cpp b/chromium/third_party/skia/modules/svg/src/SkSVGGradient.cpp
index cf09ee5c17a..b39e5784e1a 100644
--- a/chromium/third_party/skia/modules/svg/src/SkSVGGradient.cpp
+++ b/chromium/third_party/skia/modules/svg/src/SkSVGGradient.cpp
@@ -109,7 +109,7 @@ bool SkSVGAttributeParser::parse(SkSVGSpreadMethod* spread) {
};
bool parsedValue = false;
- for (size_t i = 0; i < SK_ARRAY_COUNT(gSpreadInfo); ++i) {
+ for (size_t i = 0; i < std::size(gSpreadInfo); ++i) {
if (this->parseExpectedStringToken(gSpreadInfo[i].fName)) {
*spread = SkSVGSpreadMethod(gSpreadInfo[i].fType);
parsedValue = true;
diff --git a/chromium/third_party/skia/modules/svg/src/SkSVGNode.cpp b/chromium/third_party/skia/modules/svg/src/SkSVGNode.cpp
index c3a5bd0dd6e..7734ede4358 100644
--- a/chromium/third_party/skia/modules/svg/src/SkSVGNode.cpp
+++ b/chromium/third_party/skia/modules/svg/src/SkSVGNode.cpp
@@ -162,8 +162,8 @@ SkMatrix SkSVGNode::ComputeViewboxMatrix(const SkRect& viewBox,
const size_t x_coeff = par.fAlign >> 0 & 0x03,
y_coeff = par.fAlign >> 2 & 0x03;
- SkASSERT(x_coeff < SK_ARRAY_COUNT(gAlignCoeffs) &&
- y_coeff < SK_ARRAY_COUNT(gAlignCoeffs));
+ SkASSERT(x_coeff < std::size(gAlignCoeffs) &&
+ y_coeff < std::size(gAlignCoeffs));
const auto tx = -viewBox.x() * scale.x,
ty = -viewBox.y() * scale.y,
diff --git a/chromium/third_party/skia/modules/svg/src/SkSVGOpenTypeSVGDecoder.cpp b/chromium/third_party/skia/modules/svg/src/SkSVGOpenTypeSVGDecoder.cpp
index c7d6572caa9..848db61c3a3 100644
--- a/chromium/third_party/skia/modules/svg/src/SkSVGOpenTypeSVGDecoder.cpp
+++ b/chromium/third_party/skia/modules/svg/src/SkSVGOpenTypeSVGDecoder.cpp
@@ -56,7 +56,7 @@ private:
return nullptr;
}
- const char* b64Data = encoding + SK_ARRAY_COUNT(kDataURIEncodingStr) - 1;
+ const char* b64Data = encoding + std::size(kDataURIEncodingStr) - 1;
size_t b64DataLen = strlen(b64Data);
size_t dataLen;
if (SkBase64::Decode(b64Data, b64DataLen, nullptr, &dataLen) != SkBase64::kNoError) {
diff --git a/chromium/third_party/skia/platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp b/chromium/third_party/skia/platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp
index 9ba971f76a8..6f0c9f9f6dd 100644
--- a/chromium/third_party/skia/platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp
+++ b/chromium/third_party/skia/platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp
@@ -13,6 +13,7 @@
#include "include/core/SkStream.h"
#include "include/core/SkSurface.h"
#include "include/core/SkTime.h"
+#include "modules/skresources/include/SkResources.h"
#include <jni.h>
#include <math.h>
#include <string>
@@ -150,7 +151,9 @@ Java_org_skia_skottie_SkottieAnimation_nCreateProxy(JNIEnv *env,
skottieAnimation->mRunner = skottieRunner;
skottieAnimation->mStream = std::move(stream);
- skottieAnimation->mAnimation = skottie::Animation::Make(skottieAnimation->mStream.get());
+ skottieAnimation->mAnimation = skottie::Animation::Builder()
+ .setResourceProvider(skresources::DataURIResourceProviderProxy::Make(nullptr))
+ .make(skottieAnimation->mStream.get());
skottieAnimation->mTimeBase = 0.0f; // force a time reset
skottieAnimation->mDuration = 1000 * skottieAnimation->mAnimation->duration();
diff --git a/chromium/third_party/skia/platform_tools/android/apps/skqp/src/main/assets/skqp/rendertests.txt b/chromium/third_party/skia/platform_tools/android/apps/skqp/src/main/assets/skqp/rendertests.txt
deleted file mode 100644
index 169f974defa..00000000000
--- a/chromium/third_party/skia/platform_tools/android/apps/skqp/src/main/assets/skqp/rendertests.txt
+++ /dev/null
@@ -1 +0,0 @@
-foo,-1 \ No newline at end of file
diff --git a/chromium/third_party/skia/platform_tools/android/apps/skqp/src/main/assets/skqp/unittests.txt b/chromium/third_party/skia/platform_tools/android/apps/skqp/src/main/assets/skqp/unittests.txt
deleted file mode 100644
index dfbe740c3e5..00000000000
--- a/chromium/third_party/skia/platform_tools/android/apps/skqp/src/main/assets/skqp/unittests.txt
+++ /dev/null
@@ -1,102 +0,0 @@
-# This file is a list of tests to be excluded from a given run of SkQP.
-
-# The format of the list is: <regex_match_to_tests>[,<optional_android_API_level>]
-# The optional Android API level allows the test to be run if the the device's first
-# API level is greater than or equal to the provided API level. For example ".*FOO.*,33"
-# will exclude all tests containing FOO on devices older than Android T.
-
-# Android API Conversion Chart
-# -----------|--------------|-----------
-# Version | Release Code | API Level
-# -----------|--------------|-----------
-# Android 13 | T | 33
-
-
-# Empty lines and comments starting with # are ignored.
-# This is parsed by tools/skqp/src/skqp.cpp
-# The sheet at go/skqp-cts-tests was the basis of this file.
-
-# Exclude all unit tests that contain ES3 because Android does not require ES3 support.
-.*ES3.*
-
-SkRemoteGlyphCache_.+
-ApplyGamma
-ResourceAllocatorTest
-ClipStack_SWMask
-ComposedImageFilter.+
-DDL.+
-DSL.+
-GpuDrawPath
-GpuRectanizer
-ProcessorOptimizationValidationTest
-
-# Don't test Ganesh internals
-GrContextDump
-GrContextFactory_abandon
-GrContextFactory_executorAndTaskGroup
-GrThreadSafeCache.+
-
-ImageFilter.+
-MorphologyFilterRadiusWithMirrorCTM_Gpu
-
-# Android doesn't use promise images
-PromiseImage.*
-
-SkipCopyTaskTest
-SkipOpsTaskTest
-SmallBoxBlurBug
-SrcSrcOverBatchTest
-
-# Tests chaining/batching logic, not actual execution
-TextureOpTest
-
-# These tests mostly stress the CPU-side math of triangulating, not the GPU drawing
-# triangles, which hopefully we can trust to just work
-TriangulatingPath.+
-
-VkDRMModifierTest
-VkImageLayoutTest
-VkProtectedContext_AsyncReadFromProtectedSurface
-VkProtectedContext_CreateNonprotectedContext
-VkProtectedContext_CreateNonprotectedTextureInProtectedContext
-VkProtectedContext_CreateProtectedContext
-VkProtectedContext_CreateProtectedSkSurface
-VkProtectedContext_CreateProtectedTextureInNonprotectedContext
-VkProtectedContext_DDLMakeRenderTargetTest
-VkProtectedContext_DDLSurfaceCharacterizationTest
-VkProtectedContext_DrawProtectedImageOnProtectedSurface
-VkProtectedContext_DrawRectangle
-VkProtectedContext_DrawRectangleWithAntiAlias
-VkProtectedContext_DrawRectangleWithBlendMode
-VkProtectedContext_DrawRectangleWithFilter
-VkProtectedContext_DrawThinPath
-VkProtectedContext_ReadFromProtectedSurface
-VkProtectedContext_SaveLayer
-VkWrapTests
-
-XfermodeImageFilterCroppedInput_Gpu
-skbug5221_GPU
-
-# Tests which don't pass on some Qualcomm devices without workarounds b/222736702
-DMSAA_dual_source_blend_disable, 33
-GLBackendAllocationTest, 33
-GrSurfaceRenderability, 33
-
-# Test that fail on some existing in-market devices b/229804433
-ES2BlendWithNoTexture, 33
-SkRuntimeEffect_Blender_GPU, 33
-SkSLStructsInFunctions_GPU, 33
-
-# Tests known to fail in Skia's infra on existing Android devices
-# see skia.googlesource.com/skia/+/refs/heads/chrome/m100/infra/bots/gen_tasks_logic/dm_flags.go
-ProcessorCloneTest, 33
-Programs, 33
-SkSLCommaSideEffects_GPU, 33
-SkSLInoutParameters_GPU, 33
-SkSLIntrinsicClampFloat_GPU, 33
-SkSLIntrinsicMixFloat_GPU, 33
-SkSLMatrixToVectorCast_GPU, 33
-SkSLOutParams_GPU, 33
-SkSLOutParamsAreDistinctFromGlobal_GPU, 33
-SkSLOutParamsTricky_GPU, 33
-SkSLUnaryPositiveNegative_GPU, 33
diff --git a/chromium/third_party/skia/public.bzl b/chromium/third_party/skia/public.bzl
index 4b3b5ef9615..88e63205273 100644
--- a/chromium/third_party/skia/public.bzl
+++ b/chromium/third_party/skia/public.bzl
@@ -1,28 +1,5 @@
-################################################################################
-# Starlark macros
-################################################################################
-
-def skia_select(conditions, results):
- """select() for conditions provided externally.
-
- Instead of {"conditionA": resultA, "conditionB": resultB},
- this takes two arrays, ["conditionA", "conditionB"] and [resultA, resultB].
-
- This allows the exact targets of the conditions to be provided externally while
- the results can live here, hiding the structure of those conditions in Google3.
-
- Maybe this is too much paranoia?
-
- Args:
- conditions: [CONDITION_UNIX, CONDITION_ANDROID, CONDITION_IOS, CONDITION_WASM, ...]
- results: [RESULT_UNIX, RESULT_ANDROID, RESULT_IOS, RESULT_WASM, ....]
- Returns:
- The result matching the active condition.
- """
- selector = {}
- for i in range(len(conditions)):
- selector[conditions[i]] = results[i]
- return select(selector)
+# This file contains lists of files and defines used in the legacy G3 build, that is, the G3 build
+# that is not derived from our Bazel rules.
SKIA_PUBLIC_HDRS = [
"include/android/SkAndroidFrameworkUtils.h",
@@ -48,7 +25,6 @@ SKIA_PUBLIC_HDRS = [
"include/core/SkColorPriv.h",
"include/core/SkColorSpace.h",
"include/core/SkColorType.h",
- "include/core/SkCombinationBuilder.h",
"include/core/SkContourMeasure.h",
"include/core/SkCoverageMode.h",
"include/core/SkCubicMap.h",
@@ -127,19 +103,6 @@ SKIA_PUBLIC_HDRS = [
"include/core/SkVertices.h",
"include/core/SkYUVAInfo.h",
"include/core/SkYUVAPixmaps.h",
- "include/c/sk_canvas.h",
- "include/c/sk_colorspace.h",
- "include/c/sk_data.h",
- "include/c/sk_image.h",
- "include/c/sk_imageinfo.h",
- "include/c/sk_maskfilter.h",
- "include/c/sk_matrix.h",
- "include/c/sk_paint.h",
- "include/c/sk_path.h",
- "include/c/sk_picture.h",
- "include/c/sk_shader.h",
- "include/c/sk_surface.h",
- "include/c/sk_types.h",
"include/docs/SkPDFDocument.h",
"include/docs/SkXPSDocument.h",
"include/effects/Sk1DPathEffect.h",
@@ -187,6 +150,7 @@ SKIA_PUBLIC_HDRS = [
"include/gpu/graphite/BackendTexture.h",
"include/gpu/graphite/Context.h",
"include/gpu/graphite/GraphiteTypes.h",
+ "include/gpu/graphite/ImageProvider.h",
"include/gpu/graphite/mtl/MtlBackendContext.h",
"include/gpu/graphite/mtl/MtlTypes.h",
"include/gpu/graphite/Recorder.h",
@@ -325,12 +289,6 @@ BASE_SRCS_ALL = [
"include/private/SkWeakRefCnt.h",
"src/android/SkAndroidFrameworkUtils.cpp",
"src/android/SkAnimatedImage.cpp",
- "src/c/sk_c_from_to.h",
- "src/c/sk_effects.cpp",
- "src/c/sk_imageinfo.cpp",
- "src/c/sk_paint.cpp",
- "src/c/sk_surface.cpp",
- "src/c/sk_types_priv.h",
"src/core/Sk4px.h",
"src/core/SkAAClip.cpp",
"src/core/SkAAClip.h",
@@ -400,12 +358,10 @@ BASE_SRCS_ALL = [
"src/core/SkColorFilterBase.h",
"src/core/SkColorFilterPriv.h",
"src/core/SkColorFilter_Matrix.cpp",
- "src/core/SkColorFilter_Matrix.h",
"src/core/SkColorSpace.cpp",
"src/core/SkColorSpacePriv.h",
"src/core/SkColorSpaceXformSteps.cpp",
"src/core/SkColorSpaceXformSteps.h",
- "src/core/SkCombinationBuilder.cpp",
"src/core/SkCompressedDataUtils.cpp",
"src/core/SkCompressedDataUtils.h",
"src/core/SkContourMeasure.cpp",
@@ -477,8 +433,6 @@ BASE_SRCS_ALL = [
"src/core/SkGlyph.h",
"src/core/SkGlyphBuffer.cpp",
"src/core/SkGlyphBuffer.h",
- "src/core/SkGlyphRun.cpp",
- "src/core/SkGlyphRun.h",
"src/core/SkGlyphRunPainter.cpp",
"src/core/SkGlyphRunPainter.h",
"src/core/SkGpuBlurUtils.cpp",
@@ -537,15 +491,12 @@ BASE_SRCS_ALL = [
"src/core/SkMatrixProvider.h",
"src/core/SkMatrixUtils.h",
"src/core/SkMessageBus.h",
- "src/core/SkMiniRecorder.cpp",
- "src/core/SkMiniRecorder.h",
"src/core/SkMipmap.cpp",
"src/core/SkMipmap.h",
"src/core/SkMipmapAccessor.cpp",
"src/core/SkMipmapAccessor.h",
"src/core/SkMipmapBuilder.h",
"src/core/SkModeColorFilter.cpp",
- "src/core/SkModeColorFilter.h",
"src/core/SkNextID.h",
"src/core/SkOSFile.h",
"src/core/SkOpts.cpp",
@@ -570,7 +521,6 @@ BASE_SRCS_ALL = [
"src/core/SkPathRef.cpp",
"src/core/SkPath_serial.cpp",
"src/core/SkPicture.cpp",
- "src/core/SkPictureCommon.h",
"src/core/SkPictureData.cpp",
"src/core/SkPictureData.h",
"src/core/SkPictureFlat.cpp",
@@ -629,7 +579,9 @@ BASE_SRCS_ALL = [
"src/core/SkResourceCache.cpp",
"src/core/SkResourceCache.h",
"src/core/SkRuntimeEffect.cpp",
+ "src/core/SkRuntimeEffectDictionary.h",
"src/core/SkRuntimeEffectPriv.h",
+ "src/core/SkSLTypeShared.cpp",
"src/core/SkSLTypeShared.h",
"src/core/SkSafeMath.h",
"src/core/SkSafeRange.h",
@@ -666,8 +618,6 @@ BASE_SRCS_ALL = [
"src/core/SkStreamPriv.h",
"src/core/SkStrikeCache.cpp",
"src/core/SkStrikeCache.h",
- "src/core/SkStrikeForGPU.cpp",
- "src/core/SkStrikeForGPU.h",
"src/core/SkStrikeSpec.cpp",
"src/core/SkStrikeSpec.h",
"src/core/SkString.cpp",
@@ -806,8 +756,6 @@ BASE_SRCS_ALL = [
"src/gpu/Swizzle.cpp",
"src/gpu/Swizzle.h",
# We include the ganesh files, but leave out any specific backend (e.g. GL, Vulkan)
- "src/gpu/ganesh/BaseDevice.cpp",
- "src/gpu/ganesh/BaseDevice.h",
"src/gpu/ganesh/GrAHardwareBufferImageGenerator.cpp",
"src/gpu/ganesh/GrAHardwareBufferImageGenerator.h",
"src/gpu/ganesh/GrAHardwareBufferUtils.cpp",
@@ -832,6 +780,8 @@ BASE_SRCS_ALL = [
"src/gpu/ganesh/GrBuffer.h",
"src/gpu/ganesh/GrBufferAllocPool.cpp",
"src/gpu/ganesh/GrBufferAllocPool.h",
+ "src/gpu/ganesh/GrBufferTransferRenderTask.cpp",
+ "src/gpu/ganesh/GrBufferTransferRenderTask.h",
"src/gpu/ganesh/GrCaps.cpp",
"src/gpu/ganesh/GrCaps.h",
"src/gpu/ganesh/GrClientMappedBufferManager.cpp",
@@ -1024,8 +974,22 @@ BASE_SRCS_ALL = [
"src/gpu/ganesh/GrYUVATextureProxies.h",
"src/gpu/ganesh/SkGr.cpp",
"src/gpu/ganesh/SkGr.h",
+ "src/gpu/ganesh/ClipStack.cpp",
+ "src/gpu/ganesh/ClipStack.h",
+ "src/gpu/ganesh/Device.cpp",
+ "src/gpu/ganesh/Device_drawTexture.cpp",
+ "src/gpu/ganesh/Device_v1.h",
+ "src/gpu/ganesh/PathRenderer.cpp",
+ "src/gpu/ganesh/PathRenderer.h",
+ "src/gpu/ganesh/PathRendererChain.cpp",
+ "src/gpu/ganesh/PathRendererChain.h",
+ "src/gpu/ganesh/StencilClip.h",
+ "src/gpu/ganesh/StencilMaskHelper.cpp",
+ "src/gpu/ganesh/StencilMaskHelper.h",
"src/gpu/ganesh/SurfaceContext.cpp",
"src/gpu/ganesh/SurfaceContext.h",
+ "src/gpu/ganesh/SurfaceDrawContext.cpp",
+ "src/gpu/ganesh/SurfaceDrawContext.h",
"src/gpu/ganesh/SurfaceFillContext.cpp",
"src/gpu/ganesh/SurfaceFillContext.h",
"src/gpu/ganesh/effects/GrAtlasedShaderHelpers.h",
@@ -1088,8 +1052,6 @@ BASE_SRCS_ALL = [
"src/gpu/ganesh/geometry/GrStyledShape.h",
"src/gpu/ganesh/geometry/GrTriangulator.cpp",
"src/gpu/ganesh/geometry/GrTriangulator.h",
- "src/gpu/ganesh/glsl/GrGLSL.cpp",
- "src/gpu/ganesh/glsl/GrGLSL.h",
"src/gpu/ganesh/glsl/GrGLSLBlend.cpp",
"src/gpu/ganesh/glsl/GrGLSLBlend.h",
"src/gpu/ganesh/glsl/GrGLSLColorSpaceXformHelper.h",
@@ -1217,22 +1179,6 @@ BASE_SRCS_ALL = [
"src/gpu/ganesh/tessellate/VertexChunkPatchAllocator.h",
"src/gpu/ganesh/text/GrAtlasManager.cpp",
"src/gpu/ganesh/text/GrAtlasManager.h",
- "src/gpu/ganesh/v1/ClipStack.cpp",
- "src/gpu/ganesh/v1/ClipStack.h",
- "src/gpu/ganesh/v1/Device.cpp",
- "src/gpu/ganesh/v1/Device_drawTexture.cpp",
- "src/gpu/ganesh/v1/Device_v1.h",
- "src/gpu/ganesh/v1/PathRenderer.cpp",
- "src/gpu/ganesh/v1/PathRenderer.h",
- "src/gpu/ganesh/v1/PathRendererChain.cpp",
- "src/gpu/ganesh/v1/PathRendererChain.h",
- "src/gpu/ganesh/v1/StencilClip.h",
- "src/gpu/ganesh/v1/StencilMaskHelper.cpp",
- "src/gpu/ganesh/v1/StencilMaskHelper.h",
- "src/gpu/ganesh/v1/SurfaceDrawContext.cpp",
- "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h",
- "src/gpu/ganesh/v1/SurfaceFillContext_v1.cpp",
- "src/gpu/ganesh/v1/SurfaceFillContext_v1.h",
"src/gpu/tessellate/AffineMatrix.h",
"src/gpu/tessellate/CullTest.h",
"src/gpu/tessellate/FixedCountBufferUtils.cpp",
@@ -1414,10 +1360,8 @@ BASE_SRCS_ALL = [
"src/shaders/SkColorFilterShader.cpp",
"src/shaders/SkColorFilterShader.h",
"src/shaders/SkColorShader.cpp",
- "src/shaders/SkColorShader.h",
"src/shaders/SkComposeShader.cpp",
- "src/shaders/SkComposeShader.h",
- "src/shaders/SkEmptyShader.h",
+ "src/shaders/SkEmptyShader.cpp",
"src/shaders/SkImageShader.cpp",
"src/shaders/SkImageShader.h",
"src/shaders/SkLocalMatrixShader.cpp",
@@ -1435,15 +1379,13 @@ BASE_SRCS_ALL = [
"src/shaders/gradients/Sk4fLinearGradient.cpp",
"src/shaders/gradients/Sk4fLinearGradient.h",
"src/shaders/gradients/SkGradientShader.cpp",
- "src/shaders/gradients/SkGradientShaderPriv.h",
+ "src/shaders/gradients/SkGradientShaderBase.cpp",
+ "src/shaders/gradients/SkGradientShaderBase.h",
"src/shaders/gradients/SkLinearGradient.cpp",
"src/shaders/gradients/SkLinearGradient.h",
"src/shaders/gradients/SkRadialGradient.cpp",
- "src/shaders/gradients/SkRadialGradient.h",
"src/shaders/gradients/SkSweepGradient.cpp",
- "src/shaders/gradients/SkSweepGradient.h",
"src/shaders/gradients/SkTwoPointConicalGradient.cpp",
- "src/shaders/gradients/SkTwoPointConicalGradient.h",
"src/sksl/GLSL.std.450.h",
"src/sksl/SkSLAnalysis.cpp",
"src/sksl/SkSLAnalysis.h",
@@ -1496,12 +1438,14 @@ BASE_SRCS_ALL = [
"src/sksl/analysis/SkSLCanExitWithoutReturningValue.cpp",
"src/sksl/analysis/SkSLCheckProgramStructure.cpp",
"src/sksl/analysis/SkSLFinalizationChecks.cpp",
+ "src/sksl/analysis/SkSLGetComputeShaderMainParams.cpp",
"src/sksl/analysis/SkSLGetLoopUnrollInfo.cpp",
"src/sksl/analysis/SkSLIsConstantExpression.cpp",
"src/sksl/analysis/SkSLIsSameExpressionTree.cpp",
"src/sksl/analysis/SkSLIsTrivialExpression.cpp",
"src/sksl/analysis/SkSLNoOpErrorReporter.h",
"src/sksl/analysis/SkSLProgramUsage.cpp",
+ "src/sksl/analysis/SkSLProgramUsage.h",
"src/sksl/analysis/SkSLProgramVisitor.h",
"src/sksl/analysis/SkSLSwitchCaseContainsExit.cpp",
"src/sksl/codegen/SkSLCodeGenerator.h",
@@ -1617,7 +1561,6 @@ BASE_SRCS_ALL = [
"src/sksl/ir/SkSLType.h",
"src/sksl/ir/SkSLTypeReference.cpp",
"src/sksl/ir/SkSLTypeReference.h",
- "src/sksl/ir/SkSLUnresolvedFunction.h",
"src/sksl/ir/SkSLVarDeclarations.cpp",
"src/sksl/ir/SkSLVarDeclarations.h",
"src/sksl/ir/SkSLVariable.cpp",
@@ -1630,14 +1573,20 @@ BASE_SRCS_ALL = [
"src/sksl/tracing/SkVMDebugTrace.h",
"src/sksl/tracing/SkVMDebugTracePlayer.cpp",
"src/sksl/tracing/SkVMDebugTracePlayer.h",
- "src/sksl/transform/SkSLBuiltinVariableScanner.cpp",
+ "src/sksl/transform/SkSLAddConstToVarModifiers.cpp",
"src/sksl/transform/SkSLEliminateDeadFunctions.cpp",
"src/sksl/transform/SkSLEliminateDeadGlobalVariables.cpp",
"src/sksl/transform/SkSLEliminateDeadLocalVariables.cpp",
"src/sksl/transform/SkSLEliminateEmptyStatements.cpp",
"src/sksl/transform/SkSLEliminateUnreachableCode.cpp",
+ "src/sksl/transform/SkSLFindAndDeclareBuiltinFunctions.cpp",
+ "src/sksl/transform/SkSLFindAndDeclareBuiltinVariables.cpp",
"src/sksl/transform/SkSLProgramWriter.h",
"src/sksl/transform/SkSLTransform.h",
+ "src/text/GlyphRun.cpp",
+ "src/text/GlyphRun.h",
+ "src/text/StrikeForGPU.cpp",
+ "src/text/StrikeForGPU.h",
"src/text/gpu/DistanceFieldAdjustTable.cpp",
"src/text/gpu/DistanceFieldAdjustTable.h",
"src/text/gpu/Glyph.h",
@@ -1678,6 +1627,7 @@ BASE_SRCS_ALL = [
"src/utils/SkEventTracer.cpp",
"src/utils/SkFloatToDecimal.cpp",
"src/utils/SkFloatToDecimal.h",
+ "src/utils/SkGaussianColorFilter.cpp",
"src/utils/SkFloatUtils.h",
"src/utils/SkJSON.cpp",
"src/utils/SkJSON.h",
@@ -1706,8 +1656,6 @@ BASE_SRCS_ALL = [
"src/utils/SkShadowTessellator.cpp",
"src/utils/SkShadowTessellator.h",
"src/utils/SkShadowUtils.cpp",
- "src/utils/SkShaperJSONWriter.cpp",
- "src/utils/SkShaperJSONWriter.h",
"src/utils/SkTestCanvas.h",
"src/utils/SkTextUtils.cpp",
"src/utils/SkThreadUtils_pthread.cpp",
@@ -2026,169 +1974,90 @@ VULKAN_SRCS = [
]
################################################################################
-## COPTS
-################################################################################
-
-def base_copts(os_conditions):
- return ["-Wno-implicit-fallthrough"] + skia_select(
- os_conditions,
- [
- # UNIX
- [
- # Internal use of deprecated methods. :(
- "-Wno-deprecated-declarations",
- # TODO(kjlubick)
- "-Wno-self-assign", # Spurious warning in tests/PathOpsDVectorTest.cpp?
- ],
- # ANDROID
- [
- # 'GrResourceCache' declared with greater visibility than the
- # type of its field 'GrResourceCache::fPurgeableQueue'... bogus.
- "-Wno-error=attributes",
- ],
- [], # iOS
- [], # wasm
- [], # Fuchsia
- [], # macOS
- ],
- )
-
-################################################################################
## DEFINES
################################################################################
-def base_defines(os_conditions):
- return [
- # Chrome DEFINES.
- "SK_USE_FREETYPE_EMBOLDEN",
- # Turn on a few Google3-specific build fixes.
- "SK_BUILD_FOR_GOOGLE3",
- # Required for building dm.
- "GR_TEST_UTILS",
- # Staging flags for API changes
- "SK_PARAGRAPH_GRAPHEME_EDGES",
- # Should remove after we update golden images
- "SK_WEBP_ENCODER_USE_DEFAULT_METHOD",
- # Experiment to diagnose image diffs in Google3
- "SK_DISABLE_LOWP_RASTER_PIPELINE",
- # JPEG is in codec_limited and is included in all
- # builds except the no_codec android build
- ] + skia_select(
- os_conditions,
- [
- # UNIX
- [
- "PNG_SKIP_SETJMP_CHECK",
- "SK_BUILD_FOR_UNIX",
- "SK_CODEC_DECODES_PNG",
- "SK_CODEC_DECODES_WEBP",
- "SK_ENCODE_PNG",
- "SK_ENCODE_WEBP",
- "SK_R32_SHIFT=16",
- "SK_GL",
- "SK_CODEC_DECODES_JPEG",
- "SK_ENCODE_JPEG",
- "SK_HAS_ANDROID_CODEC",
- ],
- # ANDROID
- [
- "SK_BUILD_FOR_ANDROID",
- "SK_CODEC_DECODES_PNG",
- "SK_CODEC_DECODES_WEBP",
- "SK_ENCODE_PNG",
- "SK_ENCODE_WEBP",
- "SK_GL",
- "SK_CODEC_DECODES_JPEG",
- "SK_ENCODE_JPEG",
- "SK_HAS_ANDROID_CODEC",
- ],
- # IOS
- [
- "SK_BUILD_FOR_IOS",
- "SK_GL",
- "SK_CODEC_DECODES_JPEG",
- "SK_ENCODE_JPEG",
- "SK_HAS_ANDROID_CODEC",
- ],
- # WASM
- [
- "SK_DISABLE_LEGACY_SHADERCONTEXT",
- "SK_DISABLE_TRACING",
- "SK_GL",
- "SK_SUPPORT_GPU=1",
- "SK_DISABLE_AAA",
- "SK_DISABLE_EFFECT_DESERIALIZATION",
- "SK_FORCE_8_BYTE_ALIGNMENT",
- "SKNX_NO_SIMD",
- "SK_CODEC_DECODES_JPEG",
- "SK_ENCODE_JPEG",
- "SK_HAS_ANDROID_CODEC",
- ],
- # FUCHSIA
- [
- "SK_BUILD_FOR_UNIX",
- "SK_CODEC_DECODES_PNG",
- "SK_CODEC_DECODES_WEBP",
- "SK_ENCODE_PNG",
- "SK_ENCODE_WEBP",
- "SK_R32_SHIFT=16",
- "SK_VULKAN",
- "SK_CODEC_DECODES_JPEG",
- "SK_ENCODE_JPEG",
- "SK_HAS_ANDROID_CODEC",
- ],
- # MACOS
- [
- "SK_BUILD_FOR_MAC",
- "SK_GL",
- "SK_CODEC_DECODES_JPEG",
- "SK_ENCODE_JPEG",
- "SK_HAS_ANDROID_CODEC",
- ],
- # ANDROID W/ NO CODECS
- [
- "SK_BUILD_FOR_ANDROID",
- "SK_GL",
- ],
- ],
- )
-
-################################################################################
-## LINKOPTS
-################################################################################
-
-def base_linkopts(os_conditions):
- return [
- "-ldl",
- ] + skia_select(
- os_conditions,
- [
- [], # Unix
- # ANDROID
- [
- "-lEGL",
- "-lGLESv2",
- ],
- # IOS
- [
- "-framework CoreFoundation",
- "-framework CoreGraphics",
- "-framework CoreText",
- "-framework ImageIO",
- "-framework MobileCoreServices",
- ],
- [], # wasm
- [], # Fuchsia
- # MACOS
- [
- "-framework CoreFoundation",
- "-framework CoreGraphics",
- "-framework CoreText",
- "-framework ImageIO",
- "-framework ApplicationServices",
- ],
- ],
- )
+BASE_DEFINES = [
+ # Chrome DEFINES.
+ "SK_USE_FREETYPE_EMBOLDEN",
+ # Turn on a few Google3-specific build fixes.
+ "SK_BUILD_FOR_GOOGLE3",
+ # Required for building dm.
+ "GR_TEST_UTILS",
+ # Should remove after we update golden images
+ "SK_WEBP_ENCODER_USE_DEFAULT_METHOD",
+ # Experiment to diagnose image diffs in Google3
+ "SK_DISABLE_LOWP_RASTER_PIPELINE",
+ # JPEG is in codec_limited and is included in all
+ # builds except the no_codec android build
+]
+UNIX_DEFINES = [
+ "PNG_SKIP_SETJMP_CHECK",
+ "SK_BUILD_FOR_UNIX",
+ "SK_CODEC_DECODES_PNG",
+ "SK_CODEC_DECODES_WEBP",
+ "SK_ENCODE_PNG",
+ "SK_ENCODE_WEBP",
+ "SK_R32_SHIFT=16",
+ "SK_GL",
+ "SK_CODEC_DECODES_JPEG",
+ "SK_ENCODE_JPEG",
+ "SK_HAS_ANDROID_CODEC",
+]
+ANDROID_DEFINES = [
+ "SK_BUILD_FOR_ANDROID",
+ "SK_CODEC_DECODES_PNG",
+ "SK_CODEC_DECODES_WEBP",
+ "SK_ENCODE_PNG",
+ "SK_ENCODE_WEBP",
+ "SK_GL",
+ "SK_CODEC_DECODES_JPEG",
+ "SK_ENCODE_JPEG",
+ "SK_HAS_ANDROID_CODEC",
+]
+IOS_DEFINES = [
+ "SK_BUILD_FOR_IOS",
+ "SK_GL",
+ "SK_CODEC_DECODES_JPEG",
+ "SK_ENCODE_JPEG",
+ "SK_HAS_ANDROID_CODEC",
+]
+WASM_DEFINES = [
+ "SK_DISABLE_LEGACY_SHADERCONTEXT",
+ "SK_DISABLE_TRACING",
+ "SK_GL",
+ "SK_SUPPORT_GPU=1",
+ "SK_DISABLE_AAA",
+ "SK_DISABLE_EFFECT_DESERIALIZATION",
+ "SK_FORCE_8_BYTE_ALIGNMENT",
+ "SKNX_NO_SIMD",
+ "SK_CODEC_DECODES_JPEG",
+ "SK_ENCODE_JPEG",
+ "SK_HAS_ANDROID_CODEC",
+]
+FUCHSIA_DEFINES = [
+ "SK_BUILD_FOR_UNIX",
+ "SK_CODEC_DECODES_PNG",
+ "SK_CODEC_DECODES_WEBP",
+ "SK_ENCODE_PNG",
+ "SK_ENCODE_WEBP",
+ "SK_R32_SHIFT=16",
+ "SK_VULKAN",
+ "SK_CODEC_DECODES_JPEG",
+ "SK_ENCODE_JPEG",
+ "SK_HAS_ANDROID_CODEC",
+]
+MACOS_DEFINES = [
+ "SK_BUILD_FOR_MAC",
+ "SK_GL",
+ "SK_CODEC_DECODES_JPEG",
+ "SK_ENCODE_JPEG",
+ "SK_HAS_ANDROID_CODEC",
+]
+ANDROID_NO_CODECS_DEFINES = [
+ "SK_BUILD_FOR_ANDROID",
+ "SK_GL",
+]
################################################################################
## sksg_lib
@@ -2314,6 +2183,7 @@ SKOTTIE_LIB_SRCS = [
"modules/skottie/src/animator/Vec2KeyframeAnimator.cpp",
"modules/skottie/src/animator/VectorKeyframeAnimator.cpp",
"modules/skottie/src/animator/VectorKeyframeAnimator.h",
+ "modules/skottie/src/BlendModes.cpp",
"modules/skottie/src/Camera.cpp",
"modules/skottie/src/Camera.h",
"modules/skottie/src/Composition.cpp",
@@ -2418,30 +2288,19 @@ SKOTTIE_SHAPER_SRCS = [
]
################################################################################
-## skottie_tool
-################################################################################
-
-SKOTTIE_TOOL_SRCS = [
- "modules/skottie/src/SkottieTool.cpp",
- "modules/skresources/src/SkResources.cpp",
- "modules/skresources/include/SkResources.h",
- # TODO(benjaminwagner): Add "flags" target.
- "tools/flags/CommandLineFlags.cpp",
- "tools/flags/CommandLineFlags.h",
-]
-
-################################################################################
## SkShaper
################################################################################
# Stubs, pending SkUnicode fission
SKUNICODE_ICU_BUILTIN_SRCS = [
+ "modules/skunicode/src/SkUnicode.cpp",
"modules/skunicode/src/SkUnicode_icu.cpp",
"modules/skunicode/src/SkUnicode_icu.h",
"modules/skunicode/src/SkUnicode_icu_builtin.cpp",
]
SKUNICODE_ICU_RUNTIME_SRCS = [
+ "modules/skunicode/src/SkUnicode.cpp",
"modules/skunicode/src/SkUnicode_icu.cpp",
"modules/skunicode/src/SkUnicode_icu.h",
"modules/skunicode/src/SkUnicode_icu_runtime.cpp",
diff --git a/chromium/third_party/skia/resources/fonts/SampleSVG.ttf b/chromium/third_party/skia/resources/fonts/SampleSVG.ttf
index 9c3061f218e..03bf8b0a94f 100644
--- a/chromium/third_party/skia/resources/fonts/SampleSVG.ttf
+++ b/chromium/third_party/skia/resources/fonts/SampleSVG.ttf
Binary files differ
diff --git a/chromium/third_party/skia/resources/fonts/colrv1_samples.ttf b/chromium/third_party/skia/resources/fonts/colrv1_samples.ttf
deleted file mode 100644
index d54b8ed23c1..00000000000
--- a/chromium/third_party/skia/resources/fonts/colrv1_samples.ttf
+++ /dev/null
Binary files differ
diff --git a/chromium/third_party/skia/resources/fonts/more_samples-glyf_colr_1.ttf b/chromium/third_party/skia/resources/fonts/more_samples-glyf_colr_1.ttf
deleted file mode 100644
index ce3d1974e02..00000000000
--- a/chromium/third_party/skia/resources/fonts/more_samples-glyf_colr_1.ttf
+++ /dev/null
Binary files differ
diff --git a/chromium/third_party/skia/resources/fonts/test_glyphs-glyf_colr_1.ttf b/chromium/third_party/skia/resources/fonts/test_glyphs-glyf_colr_1.ttf
new file mode 100644
index 00000000000..8c9f44b23cb
--- /dev/null
+++ b/chromium/third_party/skia/resources/fonts/test_glyphs-glyf_colr_1.ttf
Binary files differ
diff --git a/chromium/third_party/skia/resources/fonts/test_glyphs-glyf_colr_1_variable.ttf b/chromium/third_party/skia/resources/fonts/test_glyphs-glyf_colr_1_variable.ttf
new file mode 100644
index 00000000000..49e405f3ea9
--- /dev/null
+++ b/chromium/third_party/skia/resources/fonts/test_glyphs-glyf_colr_1_variable.ttf
Binary files differ
diff --git a/chromium/third_party/skia/resources/images/alphabetAnim.avif b/chromium/third_party/skia/resources/images/alphabetAnim.avif
new file mode 100644
index 00000000000..9cf65b37f4b
--- /dev/null
+++ b/chromium/third_party/skia/resources/images/alphabetAnim.avif
Binary files differ
diff --git a/chromium/third_party/skia/resources/images/baby_tux.avif b/chromium/third_party/skia/resources/images/baby_tux.avif
new file mode 100644
index 00000000000..daa0eb1edd6
--- /dev/null
+++ b/chromium/third_party/skia/resources/images/baby_tux.avif
Binary files differ
diff --git a/chromium/third_party/skia/resources/images/dog.avif b/chromium/third_party/skia/resources/images/dog.avif
new file mode 100644
index 00000000000..227e31bf6bf
--- /dev/null
+++ b/chromium/third_party/skia/resources/images/dog.avif
Binary files differ
diff --git a/chromium/third_party/skia/resources/images/ducky.avif b/chromium/third_party/skia/resources/images/ducky.avif
new file mode 100644
index 00000000000..4252d16e247
--- /dev/null
+++ b/chromium/third_party/skia/resources/images/ducky.avif
Binary files differ
diff --git a/chromium/third_party/skia/resources/images/example_1_animated.avif b/chromium/third_party/skia/resources/images/example_1_animated.avif
new file mode 100644
index 00000000000..6c1b4e14625
--- /dev/null
+++ b/chromium/third_party/skia/resources/images/example_1_animated.avif
Binary files differ
diff --git a/chromium/third_party/skia/resources/images/example_3_10bit.avif b/chromium/third_party/skia/resources/images/example_3_10bit.avif
new file mode 100644
index 00000000000..dfda220ad8d
--- /dev/null
+++ b/chromium/third_party/skia/resources/images/example_3_10bit.avif
Binary files differ
diff --git a/chromium/third_party/skia/resources/images/example_3_12bit.avif b/chromium/third_party/skia/resources/images/example_3_12bit.avif
new file mode 100644
index 00000000000..b015cdf5eb8
--- /dev/null
+++ b/chromium/third_party/skia/resources/images/example_3_12bit.avif
Binary files differ
diff --git a/chromium/third_party/skia/resources/rivs/glow.riv b/chromium/third_party/skia/resources/rivs/glow.riv
new file mode 100644
index 00000000000..1d224ac305b
--- /dev/null
+++ b/chromium/third_party/skia/resources/rivs/glow.riv
Binary files differ
diff --git a/chromium/third_party/skia/resources/rivs/knight_square.riv b/chromium/third_party/skia/resources/rivs/knight_square.riv
new file mode 100644
index 00000000000..3913b313863
--- /dev/null
+++ b/chromium/third_party/skia/resources/rivs/knight_square.riv
Binary files differ
diff --git a/chromium/third_party/skia/resources/skottie/skottie-blendmode-hardmix.json b/chromium/third_party/skia/resources/skottie/skottie-blendmode-hardmix.json
new file mode 100644
index 00000000000..732e6993ef2
--- /dev/null
+++ b/chromium/third_party/skia/resources/skottie/skottie-blendmode-hardmix.json
@@ -0,0 +1 @@
+{"assets":[],"ddd":0,"fr":30,"h":500,"ip":0,"layers":[{"ao":0,"bm":17,"ct":1,"ddd":0,"ind":1,"ip":0,"ks":{"a":{"a":0,"ix":1,"k":[0,0,0],"l":2},"o":{"a":0,"ix":11,"k":100},"p":{"a":0,"ix":2,"k":[375,250,0],"l":2},"r":{"a":0,"ix":10,"k":0},"s":{"a":0,"ix":6,"k":[50,50,100],"l":2}},"nm":"Layer Solids 3","op":300.5,"shapes":[{"bm":0,"cix":2,"hd":false,"it":[{"d":1,"hd":false,"mn":"ADBE Vector Shape - Ellipse","nm":"Ellipse Path 1","p":{"a":0,"ix":3,"k":[100,0]},"s":{"a":0,"ix":2,"k":[200,200]},"ty":"el"},{"bm":0,"c":{"a":0,"ix":4,"k":[0,1,0.250980407,1]},"hd":false,"mn":"ADBE Vector Graphic - Fill","nm":"Fill 1","o":{"a":0,"ix":5,"k":75},"r":1,"ty":"fl"},{"a":{"a":0,"ix":1,"k":[0,0]},"nm":"Transform","o":{"a":0,"ix":7,"k":100},"p":{"a":0,"ix":2,"k":[0,0]},"r":{"a":1,"ix":6,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"s":[0],"t":0},{"s":[360],"t":300}]},"s":{"a":0,"ix":3,"k":[100,100]},"sa":{"a":0,"ix":5,"k":0},"sk":{"a":0,"ix":4,"k":0},"ty":"tr"}],"ix":1,"mn":"ADBE Vector Group","nm":"Group 3","np":2,"ty":"gr"}],"sr":1,"st":0,"ty":4},{"ao":0,"bm":17,"ct":1,"ddd":0,"ind":2,"ip":0,"ks":{"a":{"a":0,"ix":1,"k":[0,0,0],"l":2},"o":{"a":0,"ix":11,"k":100},"p":{"a":0,"ix":2,"k":[375,250,0],"l":2},"r":{"a":0,"ix":10,"k":0},"s":{"a":0,"ix":6,"k":[50,50,100],"l":2}},"nm":"Layer Solids 1","op":300.5,"shapes":[{"bm":0,"cix":2,"hd":false,"it":[{"d":1,"hd":false,"ir":{"a":0,"ix":6,"k":50},"is":{"a":0,"ix":8,"k":0},"ix":1,"mn":"ADBE Vector Shape - Star","nm":"Polystar Path 1","or":{"a":0,"ix":7,"k":162},"os":{"a":0,"ix":9,"k":0},"p":{"a":0,"ix":4,"k":[0,0]},"pt":{"a":0,"ix":3,"k":5},"r":{"a":0,"ix":5,"k":0},"sy":1,"ty":"sr"},{"bm":0,"c":{"a":0,"ix":4,"k":[1,0.250980407,0,1]},"hd":false,"mn":"ADBE Vector Graphic - Fill","nm":"Fill 1","o":{"a":0,"ix":5,"k":75},"r":1,"ty":"fl"},{"a":{"a":0,"ix":1,"k":[0,0]},"nm":"Transform","o":{"a":0,"ix":7,"k":100},"p":{"a":0,"ix":2,"k":[0,0]},"r":{"a":1,"ix":6,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"s":[0],"t":0},{"s":[720],"t":300}]},"s":{"a":0,"ix":3,"k":[100,100]},"sa":{"a":0,"ix":5,"k":0},"sk":{"a":0,"ix":4,"k":0},"ty":"tr"}],"ix":1,"mn":"ADBE Vector Group","nm":"Group 1","np":2,"ty":"gr"}],"sr":1,"st":0,"ty":4},{"ao":0,"bm":17,"ct":1,"ddd":0,"ind":3,"ip":0,"ks":{"a":{"a":0,"ix":1,"k":[0,0,0],"l":2},"o":{"a":0,"ix":11,"k":100},"p":{"a":0,"ix":2,"k":[375,250,0],"l":2},"r":{"a":0,"ix":10,"k":0},"s":{"a":0,"ix":6,"k":[50,50,100],"l":2}},"nm":"Layer Solids 2","op":300.5,"shapes":[{"bm":0,"cix":2,"hd":false,"it":[{"d":1,"hd":false,"mn":"ADBE Vector Shape - Rect","nm":"Rectangle Path 1","p":{"a":0,"ix":3,"k":[-90,0]},"r":{"a":0,"ix":4,"k":0},"s":{"a":0,"ix":2,"k":[175,175]},"ty":"rc"},{"bm":0,"c":{"a":0,"ix":4,"k":[0.250980407,0,1,1]},"hd":false,"mn":"ADBE Vector Graphic - Fill","nm":"Fill 1","o":{"a":0,"ix":5,"k":75},"r":1,"ty":"fl"},{"a":{"a":0,"ix":1,"k":[0,0]},"nm":"Transform","o":{"a":0,"ix":7,"k":100},"p":{"a":0,"ix":2,"k":[0,0]},"r":{"a":1,"ix":6,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"s":[0],"t":0},{"s":[-360],"t":300}]},"s":{"a":0,"ix":3,"k":[100,100]},"sa":{"a":0,"ix":5,"k":0},"sk":{"a":0,"ix":4,"k":0},"ty":"tr"}],"ix":1,"mn":"ADBE Vector Group","nm":"Group 2","np":2,"ty":"gr"}],"sr":1,"st":0,"ty":4},{"ao":0,"bm":0,"ct":1,"ddd":0,"ind":4,"ip":0,"ks":{"a":{"a":0,"ix":1,"k":[0,0,0],"l":2},"o":{"a":0,"ix":11,"k":100},"p":{"a":0,"ix":2,"k":[125,250,0],"l":2},"r":{"a":0,"ix":10,"k":0},"s":{"a":0,"ix":6,"k":[50,50,100],"l":2}},"nm":"Shape Solids","op":300.5,"shapes":[{"bm":17,"cix":2,"hd":false,"it":[{"d":1,"hd":false,"mn":"ADBE Vector Shape - Ellipse","nm":"Ellipse Path 1","p":{"a":0,"ix":3,"k":[100,0]},"s":{"a":0,"ix":2,"k":[200,200]},"ty":"el"},{"bm":0,"c":{"a":0,"ix":4,"k":[0,1,0.250980407,1]},"hd":false,"mn":"ADBE Vector Graphic - Fill","nm":"Fill 1","o":{"a":0,"ix":5,"k":75},"r":1,"ty":"fl"},{"a":{"a":0,"ix":1,"k":[0,0]},"nm":"Transform","o":{"a":0,"ix":7,"k":100},"p":{"a":0,"ix":2,"k":[0,0]},"r":{"a":1,"ix":6,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"s":[0],"t":0},{"s":[360],"t":300}]},"s":{"a":0,"ix":3,"k":[100,100]},"sa":{"a":0,"ix":5,"k":0},"sk":{"a":0,"ix":4,"k":0},"ty":"tr"}],"ix":1,"mn":"ADBE Vector Group","nm":"Group 3","np":2,"ty":"gr"},{"bm":17,"cix":2,"hd":false,"it":[{"d":1,"hd":false,"ir":{"a":0,"ix":6,"k":50},"is":{"a":0,"ix":8,"k":0},"ix":1,"mn":"ADBE Vector Shape - Star","nm":"Polystar Path 1","or":{"a":0,"ix":7,"k":162},"os":{"a":0,"ix":9,"k":0},"p":{"a":0,"ix":4,"k":[0,0]},"pt":{"a":0,"ix":3,"k":5},"r":{"a":0,"ix":5,"k":0},"sy":1,"ty":"sr"},{"bm":0,"c":{"a":0,"ix":4,"k":[1,0.250980407,0,1]},"hd":false,"mn":"ADBE Vector Graphic - Fill","nm":"Fill 1","o":{"a":0,"ix":5,"k":75},"r":1,"ty":"fl"},{"a":{"a":0,"ix":1,"k":[0,0]},"nm":"Transform","o":{"a":0,"ix":7,"k":100},"p":{"a":0,"ix":2,"k":[0,0]},"r":{"a":1,"ix":6,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"s":[0],"t":0},{"s":[720],"t":300}]},"s":{"a":0,"ix":3,"k":[100,100]},"sa":{"a":0,"ix":5,"k":0},"sk":{"a":0,"ix":4,"k":0},"ty":"tr"}],"ix":2,"mn":"ADBE Vector Group","nm":"Group 1","np":2,"ty":"gr"},{"bm":17,"cix":2,"hd":false,"it":[{"d":1,"hd":false,"mn":"ADBE Vector Shape - Rect","nm":"Rectangle Path 1","p":{"a":0,"ix":3,"k":[-90,0]},"r":{"a":0,"ix":4,"k":0},"s":{"a":0,"ix":2,"k":[175,175]},"ty":"rc"},{"bm":0,"c":{"a":0,"ix":4,"k":[0.250980407,0,1,1]},"hd":false,"mn":"ADBE Vector Graphic - Fill","nm":"Fill 1","o":{"a":0,"ix":5,"k":75},"r":1,"ty":"fl"},{"a":{"a":0,"ix":1,"k":[0,0]},"nm":"Transform","o":{"a":0,"ix":7,"k":100},"p":{"a":0,"ix":2,"k":[0,0]},"r":{"a":1,"ix":6,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"s":[0],"t":0},{"s":[-360],"t":300}]},"s":{"a":0,"ix":3,"k":[100,100]},"sa":{"a":0,"ix":5,"k":0},"sk":{"a":0,"ix":4,"k":0},"ty":"tr"}],"ix":3,"mn":"ADBE Vector Group","nm":"Group 2","np":2,"ty":"gr"}],"sr":1,"st":0,"ty":4},{"ao":0,"bm":0,"ct":1,"ddd":0,"ind":5,"ip":0,"ks":{"a":{"a":0,"ix":1,"k":[0,0,0],"l":2},"o":{"a":0,"ix":11,"k":100},"p":{"a":0,"ix":2,"k":[250,250,0],"l":2},"r":{"a":0,"ix":10,"k":0},"s":{"a":0,"ix":6,"k":[100,100,100],"l":2}},"nm":"BG","op":300,"shapes":[{"bm":0,"cix":2,"hd":false,"it":[{"d":1,"hd":false,"mn":"ADBE Vector Shape - Rect","nm":"Rectangle Path 1","p":{"a":0,"ix":3,"k":[0,0]},"r":{"a":0,"ix":4,"k":0},"s":{"a":0,"ix":2,"k":[250,500]},"ty":"rc"},{"bm":0,"c":{"a":0,"ix":4,"k":[0.752941191196,0.690196096897,0.690196096897,1]},"hd":false,"mn":"ADBE Vector Graphic - Fill","nm":"Fill 1","o":{"a":0,"ix":5,"k":100},"r":1,"ty":"fl"},{"a":{"a":0,"ix":1,"k":[0,0]},"nm":"Transform","o":{"a":0,"ix":7,"k":100},"p":{"a":0,"ix":2,"k":[0,0]},"r":{"a":0,"ix":6,"k":0},"s":{"a":0,"ix":3,"k":[100,100]},"sa":{"a":0,"ix":5,"k":0},"sk":{"a":0,"ix":4,"k":0},"ty":"tr"}],"ix":1,"mn":"ADBE Vector Group","nm":"Group 2","np":2,"ty":"gr"},{"bm":0,"cix":2,"hd":false,"it":[{"d":1,"hd":false,"mn":"ADBE Vector Shape - Rect","nm":"Rectangle Path 1","p":{"a":0,"ix":3,"k":[0,0]},"r":{"a":0,"ix":4,"k":0},"s":{"a":0,"ix":2,"k":[500,500]},"ty":"rc"},{"bm":0,"c":{"a":0,"ix":4,"k":[0.250980407,0.250980407,0.250980407,1]},"hd":false,"mn":"ADBE Vector Graphic - Fill","nm":"Fill 1","o":{"a":0,"ix":5,"k":100},"r":1,"ty":"fl"},{"a":{"a":0,"ix":1,"k":[0,0]},"nm":"Transform","o":{"a":0,"ix":7,"k":100},"p":{"a":0,"ix":2,"k":[0,0]},"r":{"a":0,"ix":6,"k":0},"s":{"a":0,"ix":3,"k":[100,100]},"sa":{"a":0,"ix":5,"k":0},"sk":{"a":0,"ix":4,"k":0},"ty":"tr"}],"ix":2,"mn":"ADBE Vector Group","nm":"Group 1","np":2,"ty":"gr"}],"sr":1,"st":0,"ty":4}],"markers":[],"nm":"HardMix","op":300,"v":"5.9.5","w":500} \ No newline at end of file
diff --git a/chromium/third_party/skia/resources/sksl/compute/ArrayAdd.compute b/chromium/third_party/skia/resources/sksl/compute/ArrayAdd.compute
new file mode 100644
index 00000000000..5715d079fa9
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/compute/ArrayAdd.compute
@@ -0,0 +1,7 @@
+layout(set=0, binding=0) in int[] src1;
+layout(set=0, binding=1) in int[] src2;
+layout(set=0, binding=2) out int[] dest;
+
+void main() {
+ dest[sk_ThreadPosition.x] = src1[sk_ThreadPosition.x] + src2[sk_ThreadPosition.x];
+}
diff --git a/chromium/third_party/skia/resources/sksl/compute/Desaturate.compute b/chromium/third_party/skia/resources/sksl/compute/Desaturate.compute
new file mode 100644
index 00000000000..31906d852c8
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/compute/Desaturate.compute
@@ -0,0 +1,13 @@
+layout(binding=0) readonly texture2D src;
+layout(binding=1) writeonly texture2D dest;
+
+half4 desaturate(half4 color) {
+ color.rgb = half3(dot(color.rgb, half3(0.22, 0.67, 0.11)));
+ return color;
+}
+
+void main() {
+ if (sk_ThreadPosition.x < width(src) && sk_ThreadPosition.y < height(src)) {
+ write(dest, sk_ThreadPosition.xy, desaturate(read(src, sk_ThreadPosition.xy)));
+ }
+}
diff --git a/chromium/third_party/skia/resources/sksl/compute/DesaturateFunction.compute b/chromium/third_party/skia/resources/sksl/compute/DesaturateFunction.compute
new file mode 100644
index 00000000000..168cc2ddf53
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/compute/DesaturateFunction.compute
@@ -0,0 +1,14 @@
+layout(binding=0) readonly texture2D src;
+layout(binding=1) writeonly texture2D dest;
+
+noinline void desaturate(readonly texture2D src, writeonly texture2D dest) {
+ half4 color = read(src, sk_ThreadPosition.xy);
+ color.rgb = half3(dot(color.rgb, half3(0.22, 0.67, 0.11)));
+ write(dest, sk_ThreadPosition.xy, color);
+}
+
+void main() {
+ if (sk_ThreadPosition.x < width(src) && sk_ThreadPosition.y < height(src)) {
+ desaturate(src, dest);
+ }
+}
diff --git a/chromium/third_party/skia/resources/sksl/compute/DesaturateReadWrite.compute b/chromium/third_party/skia/resources/sksl/compute/DesaturateReadWrite.compute
new file mode 100644
index 00000000000..d27b971913e
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/compute/DesaturateReadWrite.compute
@@ -0,0 +1,12 @@
+layout(binding=0) texture2D tex;
+
+half4 desaturate(half4 color) {
+ color.rgb = half3(dot(color.rgb, half3(0.22, 0.67, 0.11)));
+ return color;
+}
+
+void main() {
+ if (sk_ThreadPosition.x < width(tex) && sk_ThreadPosition.y < height(tex)) {
+ write(tex, sk_ThreadPosition.xy, desaturate(read(tex, sk_ThreadPosition.xy)));
+ }
+}
diff --git a/chromium/third_party/skia/resources/sksl/compute/MatrixMultiply.compute b/chromium/third_party/skia/resources/sksl/compute/MatrixMultiply.compute
new file mode 100644
index 00000000000..5e333013363
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/compute/MatrixMultiply.compute
@@ -0,0 +1,19 @@
+layout(set=0, binding=0) inout int2[] sizes; // in1, in2, out
+layout(set=0, binding=1) in float data1[];
+layout(set=0, binding=2) in float data2[];
+layout(set=1, binding=0) out float resultData[];
+
+void main() {
+ sizes[2] = int2(sizes[0].x, sizes[1].y);
+
+ int2 resultCell = int2(sk_ThreadPosition.x, sk_ThreadPosition.y);
+ float result = 0.0;
+ for (int i = 0; i < sizes[0].y; ++i) {
+ int a = i + resultCell.x * sizes[0].y;
+ int b = resultCell.y + i * sizes[1].y;
+ result += data1[a] * data2[b];
+ }
+
+ int index = resultCell.y + resultCell.x * sizes[1].y;
+ resultData[index] = result;
+}
diff --git a/chromium/third_party/skia/resources/sksl/compute/Raytrace.compute b/chromium/third_party/skia/resources/sksl/compute/Raytrace.compute
new file mode 100644
index 00000000000..67a03ece514
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/compute/Raytrace.compute
@@ -0,0 +1,26 @@
+layout(binding=0) writeonly texture2D dest;
+
+void main () {
+ half4 pixel = half4(0.0, 0.0, 0.0, 1.0);
+
+ float max_x = 5.0;
+ float max_y = 5.0;
+ float x = (float(sk_ThreadPosition.x * 2 - width(dest)) / float(width(dest)));
+ float y = (float(sk_ThreadPosition.y * 2 - height(dest)) / float(height(dest)));
+ float3 ray_origin = float3(0.0, 0.0, -1.0);
+ float3 ray_target = float3(x * max_x, y * max_y, 0.0);
+
+ float3 sphere_center = float3(0.0, 0.0, -10.0);
+ float sphere_radius = 1.0;
+
+ float3 t_minus_c = ray_target - sphere_center;
+ float b = dot(ray_origin, t_minus_c);
+ float c = dot(t_minus_c, t_minus_c) - sphere_radius * sphere_radius;
+ float bsqmc = b * b - c;
+
+ if (bsqmc >= 0.0) {
+ pixel = half4(0.4, 0.4, 1.0, 1.0);
+ }
+
+ write(dest, sk_ThreadPosition.xy, pixel);
+}
diff --git a/chromium/third_party/skia/resources/sksl/compute/Threadgroup.compute b/chromium/third_party/skia/resources/sksl/compute/Threadgroup.compute
new file mode 100644
index 00000000000..95fdf582bde
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/compute/Threadgroup.compute
@@ -0,0 +1,44 @@
+// Implementation of the parallel prefix sum algorithm
+
+const int SIZE = 512;
+
+layout(set=0, binding=0) in float[] in_data;
+layout(set=0, binding=1) out float[] out_data;
+
+threadgroup float[SIZE * 2] shared_data;
+
+// Use a separate function here simply to ensure that we're passing the threadgroups struct
+// correctly
+noinline void store(uint i, float value) {
+ shared_data[i] = value;
+}
+
+void main() {
+ uint id = sk_ThreadPosition.x;
+ uint rd_id;
+ uint wr_id;
+ uint mask;
+
+ // Each thread is responsible for two elements of the output array
+ shared_data[id * 2] = in_data[id * 2];
+ shared_data[id * 2 + 1] = in_data[id * 2 + 1];
+
+ threadgroupBarrier();
+
+ const uint steps = uint(log2(float(SIZE))) + 1;
+ for (uint step = 0; step < steps; step++) {
+ // Calculate the read and write index in the shared array
+ mask = (1 << step) - 1;
+ rd_id = ((id >> step) << (step + 1)) + mask;
+ wr_id = rd_id + 1 + (id & mask);
+
+ // Accumulate the read data into our element
+ store(wr_id, shared_data[wr_id] + shared_data[rd_id]);
+
+ threadgroupBarrier();
+ }
+
+ // Write the final result out
+ out_data[id * 2] = shared_data[id * 2];
+ out_data[id * 2 + 1] = shared_data[id * 2 + 1];
+} \ No newline at end of file
diff --git a/chromium/third_party/skia/resources/sksl/errors/BadModifiers.sksl b/chromium/third_party/skia/resources/sksl/errors/BadModifiers.sksl
index 7884a4b27fa..db878459452 100644
--- a/chromium/third_party/skia/resources/sksl/errors/BadModifiers.sksl
+++ b/chromium/third_party/skia/resources/sksl/errors/BadModifiers.sksl
@@ -1,27 +1,54 @@
-const in out uniform flat noperspective sk_has_side_effects inline noinline void func1() {}
+const in out uniform flat noperspective sk_has_side_effects inline noinline readonly writeonly
+buffer void func1() {}
void func2(const in out uniform flat noperspective sk_has_side_effects
- inline noinline float test) {}
+ inline noinline readonly writeonly buffer float test) {}
-const in out uniform flat noperspective sk_has_side_effects inline noinline float var;
+const in out uniform flat noperspective sk_has_side_effects inline noinline readonly writeonly
+buffer float var;
+
+const in out uniform flat noperspective sk_has_side_effects inline noinline readonly writeonly
+buffer MyInterfaceBlock { float var; };
/*%%*
+'sk_has_side_effects' is not permitted here
'const' is not permitted here
'in' is not permitted here
'out' is not permitted here
'uniform' is not permitted here
'flat' is not permitted here
'noperspective' is not permitted here
+'readonly' is not permitted here
+'writeonly' is not permitted here
+'buffer' is not permitted here
functions cannot be both 'inline' and 'noinline'
+'sk_has_side_effects' is not permitted here
'uniform' is not permitted here
'flat' is not permitted here
'noperspective' is not permitted here
'sk_has_side_effects' is not permitted here
'inline' is not permitted here
'noinline' is not permitted here
+'readonly' is not permitted here
+'writeonly' is not permitted here
+'buffer' is not permitted here
+'sk_has_side_effects' is not permitted here
'in uniform' variables not permitted
+'readonly writeonly' variables not permitted
+'uniform buffer' variables not permitted
+'inline' is not permitted here
+'noinline' is not permitted here
+'readonly' is not permitted here
+'writeonly' is not permitted here
+'buffer' is not permitted here
+'const' variables must be initialized
'sk_has_side_effects' is not permitted here
+'in uniform' variables not permitted
+'readonly writeonly' variables not permitted
+'uniform buffer' variables not permitted
'inline' is not permitted here
'noinline' is not permitted here
+'readonly' is not permitted here
+'writeonly' is not permitted here
'const' variables must be initialized
*%%*/
diff --git a/chromium/third_party/skia/resources/sksl/errors/CallMain.rts b/chromium/third_party/skia/resources/sksl/errors/CallMain.rts
new file mode 100644
index 00000000000..b7674128564
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/errors/CallMain.rts
@@ -0,0 +1,9 @@
+half4 main(float2 coords);
+
+void func(float2 coords) {
+ main(coords);
+}
+
+/*%%*
+call to 'main' is not allowed
+*%%*/
diff --git a/chromium/third_party/skia/resources/sksl/errors/ComputeUniform.compute b/chromium/third_party/skia/resources/sksl/errors/ComputeUniform.compute
new file mode 100644
index 00000000000..612be36680d
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/errors/ComputeUniform.compute
@@ -0,0 +1,8 @@
+uniform int x;
+
+void main() {
+}
+
+/*%%*
+'uniform' is not permitted here
+*%%*/
diff --git a/chromium/third_party/skia/resources/sksl/errors/DuplicateBinding.compute b/chromium/third_party/skia/resources/sksl/errors/DuplicateBinding.compute
new file mode 100644
index 00000000000..7044c054ed9
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/errors/DuplicateBinding.compute
@@ -0,0 +1,9 @@
+layout(set=0, binding=0) in int[] x;
+layout(set=0, binding=0) in int[] y;
+
+void main() {
+}
+
+/*%%*
+layout(set=0, binding=0) has already been defined
+*%%*/
diff --git a/chromium/third_party/skia/resources/sksl/errors/InvalidExtensionDirective.sksl b/chromium/third_party/skia/resources/sksl/errors/InvalidExtensionDirective.sksl
new file mode 100644
index 00000000000..a00ee483082
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/errors/InvalidExtensionDirective.sksl
@@ -0,0 +1,5 @@
+#extension foo : disable disable
+
+/*%%*
+invalid #extension directive
+*%%*/
diff --git a/chromium/third_party/skia/resources/sksl/errors/InvalidInOutType.compute b/chromium/third_party/skia/resources/sksl/errors/InvalidInOutType.compute
new file mode 100644
index 00000000000..8194bd0f908
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/errors/InvalidInOutType.compute
@@ -0,0 +1,11 @@
+layout(set=0, binding=0) in int x;
+layout(set=0, binding=1) out float4 y;
+layout(set=0, binding=2) in int[5] z;
+
+void main() {
+}
+
+/*%%*
+unsupported compute shader in / out type
+compute shader in / out arrays must be unsized
+*%%*/ \ No newline at end of file
diff --git a/chromium/third_party/skia/resources/sksl/errors/InvalidMainParameters.compute b/chromium/third_party/skia/resources/sksl/errors/InvalidMainParameters.compute
new file mode 100644
index 00000000000..c1ea7d65f90
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/errors/InvalidMainParameters.compute
@@ -0,0 +1,7 @@
+void main(in int x, out int y) {
+ y = x;
+}
+
+/*%%*
+shader 'main' must have zero parameters
+*%%*/ \ No newline at end of file
diff --git a/chromium/third_party/skia/resources/sksl/errors/InvalidMainReturn.compute b/chromium/third_party/skia/resources/sksl/errors/InvalidMainReturn.compute
new file mode 100644
index 00000000000..9dbe8142afd
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/errors/InvalidMainReturn.compute
@@ -0,0 +1,7 @@
+int main() {
+ return 0;
+}
+
+/*%%*
+'main' must return 'void'
+*%%*/ \ No newline at end of file
diff --git a/chromium/third_party/skia/resources/sksl/errors/InvalidThreadgroupCompute.compute b/chromium/third_party/skia/resources/sksl/errors/InvalidThreadgroupCompute.compute
new file mode 100644
index 00000000000..4da1d16dce6
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/errors/InvalidThreadgroupCompute.compute
@@ -0,0 +1,18 @@
+layout(set=0, binding=0) in threadgroup float x[];
+layout(set=0, binding=1) out threadgroup float y[];
+
+threadgroup texture2D tex;
+
+threadgroup void a() {}
+
+void b(threadgroup int b) {}
+
+void c() {
+ threadgroup bool x;
+}
+
+/*%%*
+in / out variables may not be declared threadgroup
+'threadgroup' is not permitted here
+expected expression, but found 'threadgroup'
+*%%*/ \ No newline at end of file
diff --git a/chromium/third_party/skia/resources/sksl/errors/InvalidThreadgroupRTS.rts b/chromium/third_party/skia/resources/sksl/errors/InvalidThreadgroupRTS.rts
new file mode 100644
index 00000000000..b6dae8f4095
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/errors/InvalidThreadgroupRTS.rts
@@ -0,0 +1,5 @@
+threadgroup int x;
+
+/*%%*
+'threadgroup' is not permitted here
+*%%*/ \ No newline at end of file
diff --git a/chromium/third_party/skia/resources/sksl/errors/InvalidVersionDirective.sksl b/chromium/third_party/skia/resources/sksl/errors/InvalidVersionDirective.sksl
new file mode 100644
index 00000000000..2b0c3132f0e
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/errors/InvalidVersionDirective.sksl
@@ -0,0 +1,5 @@
+#version 300 void test() {}
+
+/*%%*
+invalid #version directive
+*%%*/
diff --git a/chromium/third_party/skia/resources/sksl/errors/ModifiersInStruct.rts b/chromium/third_party/skia/resources/sksl/errors/ModifiersInStruct.rts
index c5bafc5b5c3..95142bfc051 100644
--- a/chromium/third_party/skia/resources/sksl/errors/ModifiersInStruct.rts
+++ b/chromium/third_party/skia/resources/sksl/errors/ModifiersInStruct.rts
@@ -4,6 +4,9 @@ struct S {
flat half4 c;
noperspective float4 d;
inout bool e;
+ readonly bool f;
+ writeonly bool g;
+ buffer int h;
};
/*%%*
@@ -12,4 +15,7 @@ modifier 'uniform' is not permitted on a struct field
modifier 'flat' is not permitted on a struct field
modifier 'noperspective' is not permitted on a struct field
modifier 'inout' is not permitted on a struct field
+modifier 'readonly' is not permitted on a struct field
+modifier 'writeonly' is not permitted on a struct field
+modifier 'buffer' is not permitted on a struct field
*%%*/
diff --git a/chromium/third_party/skia/resources/sksl/errors/OpaqueTypeOutParam.sksl b/chromium/third_party/skia/resources/sksl/errors/OpaqueTypeOutParam.sksl
new file mode 100644
index 00000000000..14c7759687e
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/errors/OpaqueTypeOutParam.sksl
@@ -0,0 +1,8 @@
+void func1(in sampler2D s) { /*allowed*/ }
+void func2(out sampler2D s) { /*error*/ }
+void func3(inout sampler2D s) { /*error*/ }
+
+/*%%*
+'out' is not permitted here
+'out' is not permitted here
+*%%*/
diff --git a/chromium/third_party/skia/resources/sksl/errors/Ossfuzz38140.sksl b/chromium/third_party/skia/resources/sksl/errors/Ossfuzz38140.sksl
index 61d2782debb..b489c80fc43 100644
--- a/chromium/third_party/skia/resources/sksl/errors/Ossfuzz38140.sksl
+++ b/chromium/third_party/skia/resources/sksl/errors/Ossfuzz38140.sksl
@@ -7,8 +7,5 @@ half4 main(half4 src, half4 dst) {
}
/*%%*
-function 'half4 blend_src_over(half4 src, half4 dst)' was already defined
-shader 'main' must be main() or main(float2)
-unknown identifier 'src'
-unknown identifier 'dst'
+duplicate definition of half4 blend_src_over(half4 src, half4 dst)
*%%*/
diff --git a/chromium/third_party/skia/resources/sksl/errors/Ossfuzz47935.sksl b/chromium/third_party/skia/resources/sksl/errors/Ossfuzz47935.sksl
new file mode 100644
index 00000000000..dc2ddc3e78a
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/errors/Ossfuzz47935.sksl
@@ -0,0 +1,6 @@
+void j = half[4](float[4](5,2,3,1));
+
+/*%%*
+variables of type 'void' are not allowed
+expected 'void', but found 'half[4]'
+*%%*/
diff --git a/chromium/third_party/skia/resources/sksl/errors/Ossfuzz48592.sksl b/chromium/third_party/skia/resources/sksl/errors/Ossfuzz48592.sksl
new file mode 100644
index 00000000000..56af1f13439
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/errors/Ossfuzz48592.sksl
@@ -0,0 +1 @@
+half x[int2((3-3`*cosh(421`.L1
diff --git a/chromium/third_party/skia/resources/sksl/errors/Ossfuzz49558.sksl b/chromium/third_party/skia/resources/sksl/errors/Ossfuzz49558.sksl
new file mode 100644
index 00000000000..4dd4307b427
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/errors/Ossfuzz49558.sksl
@@ -0,0 +1,5 @@
+lessThan
+
+/*%%*
+no type named 'lessThan'
+*%%*/
diff --git a/chromium/third_party/skia/resources/sksl/errors/OverflowFloatIntrinsic.sksl b/chromium/third_party/skia/resources/sksl/errors/OverflowFloatIntrinsic.sksl
new file mode 100644
index 00000000000..eb068f9e6f4
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/errors/OverflowFloatIntrinsic.sksl
@@ -0,0 +1,13 @@
+uniform half4 colorRed, colorGreen;
+uniform float unknownInput;
+
+half4 main(float2 coords) {
+ const float val = pow(1e38, 2);
+ float4 y = val.xxxx;
+
+ return (y.x == val) ? colorGreen : colorRed;
+}
+
+/*%%*
+'const' variable initializer must be a constant expression
+*%%*/
diff --git a/chromium/third_party/skia/resources/sksl/errors/OverloadedBuiltin.sksl b/chromium/third_party/skia/resources/sksl/errors/OverloadedBuiltin.sksl
new file mode 100644
index 00000000000..8c3e06fa2e6
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/errors/OverloadedBuiltin.sksl
@@ -0,0 +1,26 @@
+uniform half4 color;
+
+half fma(half a, half b) { return 0; /* allowed */ }
+half fma(half a, half b, half c) { return 0; /* error: overloads a builtin */ }
+half fma(half a, half b, half c, half d) { return 0; /* allowed */ }
+
+half2 sin(half2 a) { return half2(0); /* error: overloads a builtin */ }
+float3 sin(float3 a) { return float3(0); /* error: overloads a builtin */ }
+half2x2 sin(half2x2 a) { return half2x2(0); /* allowed */ }
+float3x3 sin(float3x3 a) { return float3x3(0); /* allowed */ }
+
+half cos(half2 a) { return 0; /* error: overloads a builtin (despite return type mismatch) */ }
+float2 cos(half2 a) { return 0; /* error: overloads a builtin (despite return type mismatch) */ }
+
+float pow(float x, float y) { return 0; /* error: overloads a builtin */ }
+float pow(float2 x, float y) { return 0; /* allowed */ }
+float pow(half x, float y) { return 0; /* allowed */ }
+
+/*%%*
+duplicate definition of $genHType fma($genHType a, $genHType b, $genHType c)
+duplicate definition of $genHType sin($genHType angle)
+duplicate definition of $genType sin($genType angle)
+duplicate definition of $genHType cos($genHType angle)
+functions 'float2 cos(half2 a)' and '$genHType cos($genHType angle)' differ only in return type
+duplicate definition of $genType pow($genType x, $genType y)
+*%%*/
diff --git a/chromium/third_party/skia/resources/sksl/errors/UnspecifiedBinding.compute b/chromium/third_party/skia/resources/sksl/errors/UnspecifiedBinding.compute
new file mode 100644
index 00000000000..4ea72e72398
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/errors/UnspecifiedBinding.compute
@@ -0,0 +1,8 @@
+in int[] x;
+
+void main() {
+}
+
+/*%%*
+compute shader in / out variables must have a layout binding and set
+*%%*/ \ No newline at end of file
diff --git a/chromium/third_party/skia/resources/sksl/folding/MatrixNoOpFolding.sksl b/chromium/third_party/skia/resources/sksl/folding/MatrixNoOpFolding.sksl
new file mode 100644
index 00000000000..029d5fcd2da
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/folding/MatrixNoOpFolding.sksl
@@ -0,0 +1,103 @@
+uniform float2x2 testMatrix2x2;
+uniform float3x3 testMatrix3x3;
+uniform float4 testInputs;
+uniform half4 colorRed, colorGreen;
+uniform half unknownInput;
+
+bool test_mat2_mat2() {
+ float2x2 m, mm;
+ const float2x2 i = float2x2(1.0);
+ const float2x2 z = float2x2(0.0);
+ const float2x2 s = float2x2(float4(1.0));
+
+ m = testMatrix2x2 * i;
+ m = i * testMatrix2x2;
+
+ m = m * i;
+ m = i * m;
+ m *= i;
+
+ m = m / s;
+ m /= s;
+
+ m = m + z;
+ m = z + m;
+ m += z;
+
+ m = m - z;
+ m = z - m; // negates
+ m -= z;
+
+ mm = m * z;
+ mm = z * m;
+
+ return m == -testMatrix2x2 && mm == z;
+}
+
+bool test_mat3_mat3() {
+ float3x3 m, mm;
+ const float3x3 i = float3x3(1.0);
+ const float3x3 z = float3x3(0.0);
+ const float3x3 s = float3x3(float3(1.0), float3(1.0), float3(1.0));
+
+ m = testMatrix3x3 * i;
+ m = i * testMatrix3x3;
+
+ m = m * i;
+ m = i * m;
+ m *= i;
+
+ m = m / s;
+ m /= s;
+
+ m = m + z;
+ m = z + m;
+ m += z;
+
+ m = m - z;
+ m = z - m; // negates
+ m -= z;
+
+ mm = m * z;
+ mm = z * m;
+
+ return m == -testMatrix3x3 && mm == z;
+}
+
+bool test_mat4_mat4() {
+ float4x4 testMatrix4x4 = float4x4(testInputs, testInputs, testInputs, testInputs);
+
+ float4x4 m, mm;
+ const float4x4 i = float4x4(1.0);
+ const float4x4 z = float4x4(0.0);
+ const float4x4 s = float4x4(float4(1.0), float4(1.0), float4(1.0), float4(1.0));
+
+ m = testMatrix4x4 * i;
+ m = i * testMatrix4x4;
+
+ m = m * i;
+ m = i * m;
+ m *= i;
+
+ m = m / s;
+ m /= s;
+
+ m = m + z;
+ m = z + m;
+ m += z;
+
+ m = m - z;
+ m = z - m; // negates
+ m -= z;
+
+ mm = m * z;
+ mm = z * m;
+
+ return m == -testMatrix4x4 && mm == z;
+}
+
+half4 main(float2 coords) {
+ return test_mat2_mat2() &&
+ test_mat3_mat3() &&
+ test_mat4_mat4() ? colorGreen : colorRed;
+}
diff --git a/chromium/third_party/skia/resources/sksl/folding/MatrixScalarNoOpFolding.sksl b/chromium/third_party/skia/resources/sksl/folding/MatrixScalarNoOpFolding.sksl
new file mode 100644
index 00000000000..91e04d7d5d4
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/folding/MatrixScalarNoOpFolding.sksl
@@ -0,0 +1,194 @@
+uniform float2x2 testMatrix2x2;
+uniform float3x3 testMatrix3x3;
+uniform float4 testInputs;
+uniform half4 colorRed, colorGreen;
+uniform half unknownInput;
+
+bool test_no_op_scalar_X_mat2() {
+ float2x2 m, mm;
+ const float2x2 z = float2x2(0.0);
+
+ // Test meaningful matrix X no-op scalar.
+ m = testMatrix2x2 * 1;
+ m = 1 * testMatrix2x2;
+ m *= 1;
+ if (m != testMatrix2x2) return false;
+
+ m = m / 1;
+ m /= 1;
+ if (m != testMatrix2x2) return false;
+
+ m = m + 0;
+ m = 0 + m;
+ m += 0;
+ if (m != testMatrix2x2) return false;
+
+ m = m - 0;
+ m = 0 - m; // negates
+ m -= 0;
+ if (m != -testMatrix2x2) return false;
+
+ mm = m * 0;
+ mm = 0 * m;
+ return mm == z;
+}
+
+bool test_no_op_scalar_X_mat3() {
+ float3x3 m, mm;
+ const float3x3 z = float3x3(0.0);
+
+ // Test meaningful matrix X no-op scalar.
+ m = testMatrix3x3 * 1;
+ m = 1 * testMatrix3x3;
+ m *= 1;
+ if (m != testMatrix3x3) return false;
+
+ m = m / 1;
+ m /= 1;
+ if (m != testMatrix3x3) return false;
+
+ m = m + 0;
+ m = 0 + m;
+ m += 0;
+ if (m != testMatrix3x3) return false;
+
+ m = m - 0;
+ m = 0 - m; // negates
+ m -= 0;
+ if (m != -testMatrix3x3) return false;
+
+ mm = m * 0;
+ mm = 0 * m;
+ return mm == z;
+}
+
+bool test_no_op_scalar_X_mat4() {
+ float4x4 testMatrix4x4 = float4x4(testInputs, testInputs, testInputs, testInputs);
+ float4x4 m, mm;
+ const float4x4 z = float4x4(0.0);
+
+ // Test meaningful matrix X no-op scalar.
+ m = testMatrix4x4 * 1;
+ m = 1 * testMatrix4x4;
+ m *= 1;
+ if (m != testMatrix4x4) return false;
+
+ m = m / 1;
+ m /= 1;
+ if (m != testMatrix4x4) return false;
+
+ m = m + 0;
+ m = 0 + m;
+ m += 0;
+ if (m != testMatrix4x4) return false;
+
+ m = m - 0;
+ m = 0 - m; // negates
+ m -= 0;
+ if (m != -testMatrix4x4) return false;
+
+ mm = m * 0;
+ mm = 0 * m;
+ return mm == z;
+}
+
+bool test_no_op_mat2_X_scalar() {
+ float2x2 m, mm;
+ const float2x2 i = float2x2(1.0);
+ const float2x2 z = float2x2(0.0);
+ const float2x2 s = float2x2(float4(1.0));
+ float scalar = testInputs.x;
+
+ // These operations can be optimized, because multiplying a scalar across an identity matrix
+ // is conceptually the same as passing a scalar into the diagonal-matrix constructor.
+ m = scalar * i;
+ m = i * scalar;
+ if (m != float2x2(scalar)) return false;
+
+ // These operations are left alone, as they splat the scalar across the matrix.
+ m = scalar / s;
+ if (m != float2x2(scalar, scalar, scalar, scalar)) return false;
+
+ m = scalar + z;
+ m = z + scalar;
+ if (m != float2x2(scalar, scalar, scalar, scalar)) return false;
+
+ m = scalar - z;
+ m = z - scalar; // splats `-scalar` across the matrix
+ if (m != -float2x2(scalar, scalar, scalar, scalar)) return false;
+
+ mm = scalar * z;
+ mm = z * scalar;
+ return mm == z;
+}
+
+bool test_no_op_mat3_X_scalar() {
+ float3x3 m, mm;
+ const float3x3 i = float3x3(1.0);
+ const float3x3 z = float3x3(0.0);
+ const float3x3 s = float3x3(float3(1.0), float3(1.0), float3(1.0));
+ float scalar = testInputs.x;
+ float3 scalar3 = scalar.xxx;
+
+ // These operations can be optimized, because multiplying a scalar across an identity matrix
+ // is conceptually the same as passing a scalar into the diagonal-matrix constructor.
+ m = scalar * i;
+ m = i * scalar;
+ if (m != float3x3(scalar)) return false;
+
+ // These operations are left alone, as they splat the scalar across the matrix.
+ m = scalar / s;
+ if (m != float3x3(scalar3, scalar3, scalar3)) return false;
+
+ m = scalar + z;
+ m = z + scalar;
+ if (m != float3x3(scalar3, scalar3, scalar3)) return false;
+
+ m = scalar - z;
+ m = z - scalar; // splats `-scalar` across the matrix
+ if (m != -float3x3(scalar3, scalar3, scalar3)) return false;
+
+ mm = scalar * z;
+ mm = z * scalar;
+ return mm == z;
+}
+
+bool test_no_op_mat4_X_scalar() {
+ float4x4 m, mm;
+ const float4x4 i = float4x4(1.0);
+ const float4x4 z = float4x4(0.0);
+ const float4x4 s = float4x4(float4(1.0), float4(1.0), float4(1.0), float4(1.0));
+ float scalar = testInputs.x;
+ float4 scalar4 = scalar.xxxx;
+
+ // These operations can be optimized, because multiplying a scalar across an identity matrix
+ // is conceptually the same as passing a scalar into the diagonal-matrix constructor.
+ m = scalar * i;
+ m = i * scalar;
+ if (m != float4x4(scalar)) return false;
+
+ // These operations are left alone, as they splat the scalar across the matrix.
+ m = scalar / s;
+ if (m != float4x4(scalar4, scalar4, scalar4, scalar4)) return false;
+
+ m = scalar + z;
+ m = z + scalar;
+ if (m != float4x4(scalar4, scalar4, scalar4, scalar4)) return false;
+
+ m = scalar - z;
+ m = z - scalar; // splats `-scalar` across the matrix
+ if (m != -float4x4(scalar4, scalar4, scalar4, scalar4)) return false;
+
+ mm = scalar * z;
+ mm = z * scalar;
+ return mm == z;
+}
+
+half4 main(float2 coords) {
+ return test_no_op_scalar_X_mat2() &&
+ test_no_op_scalar_X_mat3() &&
+ test_no_op_scalar_X_mat4() &&
+ test_no_op_mat2_X_scalar() &&
+ test_no_op_mat3_X_scalar() &&
+ test_no_op_mat4_X_scalar() ? colorGreen : colorRed;
+}
diff --git a/chromium/third_party/skia/resources/sksl/folding/MatrixVectorNoOpFolding.sksl b/chromium/third_party/skia/resources/sksl/folding/MatrixVectorNoOpFolding.sksl
new file mode 100644
index 00000000000..3af1fdba341
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/folding/MatrixVectorNoOpFolding.sksl
@@ -0,0 +1,162 @@
+uniform float2x2 testMatrix2x2;
+uniform float3x3 testMatrix3x3;
+uniform float4 testInputs;
+uniform half4 colorRed, colorGreen;
+uniform half unknownInput;
+
+bool test_no_op_mat2_X_vec2() {
+ const float2x2 i = float2x2(1.0);
+ const float2x2 z = float2x2(0.0);
+ const float2x2 n = float2x2(-1.0);
+
+ float2 v, vv;
+ v = testInputs.xy * i;
+ v = i * testInputs.xy;
+ if (v != testInputs.xy) return false;
+
+ v = v * i;
+ v = i * v;
+ v *= i;
+ if (v != testInputs.xy) return false;
+
+ v = testInputs.xy * n;
+ v = n * testInputs.xy;
+ if (v != -testInputs.xy) return false;
+
+ vv = v * z;
+ vv = z * v;
+ return vv == z[0];
+}
+
+bool test_no_op_mat3_X_vec3() {
+ const float3x3 i = float3x3(1.0);
+ const float3x3 z = float3x3(0.0);
+ const float3x3 n = float3x3(-1.0);
+
+ float3 v, vv;
+ v = testInputs.xyz * i;
+ v = i * testInputs.xyz;
+ if (v != testInputs.xyz) return false;
+
+ v = v * i;
+ v = i * v;
+ v *= i;
+ if (v != testInputs.xyz) return false;
+
+ v = testInputs.xyz * n;
+ v = n * testInputs.xyz;
+ if (v != -testInputs.xyz) return false;
+
+ vv = v * z;
+ vv = z * v;
+ return vv == z[0];
+}
+
+bool test_no_op_mat4_X_vec4() {
+ const float4x4 i = float4x4(1.0);
+ const float4x4 z = float4x4(0.0);
+ const float4x4 n = float4x4(-1.0);
+
+ float4 v, vv;
+ v = testInputs * i;
+ v = i * testInputs;
+ if (v != testInputs) return false;
+
+ v = v * i;
+ v = i * v;
+ v *= i;
+ if (v != testInputs) return false;
+
+ v = testInputs * n;
+ v = n * testInputs;
+ if (v != -testInputs) return false;
+
+ vv = v * z;
+ vv = z * v;
+ return vv == z[0];
+}
+
+bool test_no_op_vec2_X_mat2() {
+ const float2 n = float2(-1.0);
+ const float2 i = float2(1.0);
+ const float2 z = float2(0.0);
+
+ // These operations can be optimized; multiplying a zero vector across any matrix always results
+ // in a zero vector.
+ float2 v, vv;
+ vv = z * testMatrix2x2;
+ vv = testMatrix2x2 * z;
+ if (vv != z) return false;
+
+ // These operations can't be simplified; they do real work.
+ v = i * testMatrix2x2;
+ if (v != float2(3, 7)) return false;
+ v = testMatrix2x2 * i;
+ if (v != float2(4, 6)) return false;
+
+ v = n * testMatrix2x2;
+ if (v != -float2(3, 7)) return false;
+ v = testMatrix2x2 * n;
+ return v == -float2(4, 6);
+}
+
+bool test_no_op_vec3_X_mat3() {
+ const float3 n = float3(-1.0);
+ const float3 i = float3(1.0);
+ const float3 z = float3(0.0);
+
+ // These operations can be optimized; multiplying a zero vector across any matrix always results
+ // in a zero vector.
+ float3 v, vv;
+ vv = z * testMatrix3x3;
+ vv = testMatrix3x3 * z;
+ if (vv != z) return false;
+
+ // These operations can't be simplified; they do real work.
+ v = i * testMatrix3x3;
+ if (v != float3(6, 15, 24)) return false;
+ v = testMatrix3x3 * i;
+ if (v != float3(12, 15, 18)) return false;
+
+ v = n * testMatrix3x3;
+ if (v != -float3(6, 15, 24)) return false;
+ v = testMatrix3x3 * n;
+ return v == -float3(12, 15, 18);
+}
+
+bool test_no_op_vec4_X_mat4() {
+ const float4 n = float4(-1.0);
+ const float4 i = float4(1.0);
+ const float4 z = float4(0.0);
+ float4x4 testMatrix4x4 = float4x4(testMatrix2x2[0], testMatrix2x2[1],
+ testMatrix2x2[0], testMatrix2x2[1],
+ testMatrix2x2[0], testMatrix2x2[1],
+ testMatrix2x2[0], testMatrix2x2[1]);
+
+ // These operations can be optimized; multiplying a zero vector across any matrix always results
+ // in a zero vector.
+ float4 v, vv;
+ vv = z * testMatrix4x4;
+ vv = testMatrix4x4 * z;
+ if (vv != z) return false;
+
+ // These operations can't be simplified; they do real work.
+ v = i * testMatrix4x4;
+ if (v != float4(10, 10, 10, 10)) return false;
+ v = testMatrix4x4 * i;
+ if (v != float4(4, 8, 12, 16)) return false;
+
+ v = n * testMatrix4x4;
+ if (v != -float4(10, 10, 10, 10)) return false;
+ v = testMatrix4x4 * n;
+ return v == -float4(4, 8, 12, 16);
+}
+
+half4 main(float2 coords) {
+ return test_no_op_mat2_X_vec2() &&
+ test_no_op_mat3_X_vec3() &&
+ test_no_op_mat4_X_vec4() &&
+ test_no_op_vec2_X_mat2() &&
+ test_no_op_vec3_X_mat3() &&
+ test_no_op_vec4_X_mat4() ? colorGreen : colorRed;
+}
diff --git a/chromium/third_party/skia/resources/sksl/glsl/TextureSharpenVersion110.sksl b/chromium/third_party/skia/resources/sksl/glsl/TextureSharpenVersion110.sksl
index 670413f2f02..6f29ecb0b88 100644
--- a/chromium/third_party/skia/resources/sksl/glsl/TextureSharpenVersion110.sksl
+++ b/chromium/third_party/skia/resources/sksl/glsl/TextureSharpenVersion110.sksl
@@ -1,12 +1,9 @@
/*#pragma settings Version110 Sharpen*/
-uniform sampler1D one;
-uniform sampler2D two;
+uniform sampler2D s;
void main() {
- float4 a = sample(one, 0);
- float4 b = sample(two, float2(0));
- float4 c = sample(one, float2(0));
- float4 d = sample(two, float3(0));
- sk_FragColor = half4(half(a.x), half(b.x), half(c.x), half(d.x));
+ float4 a = sample(s, float2(0));
+ float4 b = sample(s, float3(0));
+ sk_FragColor = half4(half2(a.xy), half2(b.xy));
}
diff --git a/chromium/third_party/skia/resources/sksl/glsl/TextureVersion110.sksl b/chromium/third_party/skia/resources/sksl/glsl/TextureVersion110.sksl
index 13776f812c2..d44cf52fd30 100644
--- a/chromium/third_party/skia/resources/sksl/glsl/TextureVersion110.sksl
+++ b/chromium/third_party/skia/resources/sksl/glsl/TextureVersion110.sksl
@@ -1,12 +1,9 @@
/*#pragma settings Version110*/
-uniform sampler1D one;
-uniform sampler2D two;
+uniform sampler2D s;
void main() {
- float4 a = sample(one, 0);
- float4 b = sample(two, float2(0));
- float4 c = sample(one, float2(0));
- float4 d = sample(two, float3(0));
- sk_FragColor = half4(half(a.x), half(b.x), half(c.x), half(d.x));
+ float4 a = sample(s, float2(0));
+ float4 b = sample(s, float3(0));
+ sk_FragColor = half4(half2(a.xy), half2(b.xy));
}
diff --git a/chromium/third_party/skia/resources/sksl/inliner/InlinerCanBeDisabled.sksl b/chromium/third_party/skia/resources/sksl/inliner/InlinerCanBeDisabled.sksl
index 99ce88eeb39..ef46036bcee 100644
--- a/chromium/third_party/skia/resources/sksl/inliner/InlinerCanBeDisabled.sksl
+++ b/chromium/third_party/skia/resources/sksl/inliner/InlinerCanBeDisabled.sksl
@@ -15,13 +15,13 @@ half mul(half a, half b) {
return a * b;
}
-half fma(half a, half b, half c) {
+half fused_multiply_add(half a, half b, half c) {
return add(mul(a, b), c);
}
void main() {
// Functions used multiple times:
- sk_FragColor = fma(color.x, color.y, color.z).xxxx;
+ sk_FragColor = fused_multiply_add(color.x, color.y, color.z).xxxx;
// Functions used only once:
sk_FragColor *= singleuse();
// Intrinsic functions:
diff --git a/chromium/third_party/skia/resources/sksl/inliner/InlinerManglesNames.sksl b/chromium/third_party/skia/resources/sksl/inliner/InlinerManglesNames.sksl
index 41b975c3221..d17e3e93ae6 100644
--- a/chromium/third_party/skia/resources/sksl/inliner/InlinerManglesNames.sksl
+++ b/chromium/third_party/skia/resources/sksl/inliner/InlinerManglesNames.sksl
@@ -9,13 +9,13 @@ half mul(half a, half b) {
return a * b;
}
-half fma(half a, half b, half c) {
+half fused_multiply_add(half a, half b, half c) {
return add(mul(a, b), c);
}
half4 main(float2 coords) {
- half a = fma(color.x, color.y, color.z);
- half b = fma(color.y, color.z, color.w);
- half c = fma(color.z, color.w, color.x);
+ half a = fused_multiply_add(color.x, color.y, color.z);
+ half b = fused_multiply_add(color.y, color.z, color.w);
+ half c = fused_multiply_add(color.z, color.w, color.x);
return half4(a, b, mul(c, c), mul(a, mul(b, c)));
}
diff --git a/chromium/third_party/skia/resources/sksl/inliner/NoInline.sksl b/chromium/third_party/skia/resources/sksl/inliner/NoInline.sksl
index 7138ba6ff30..f6cec09f706 100644
--- a/chromium/third_party/skia/resources/sksl/inliner/NoInline.sksl
+++ b/chromium/third_party/skia/resources/sksl/inliner/NoInline.sksl
@@ -13,13 +13,13 @@ noinline half mul(half a, half b) {
return a * b;
}
-noinline half fma(half a, half b, half c) {
+noinline half fused_multiply_add(half a, half b, half c) {
return add(mul(a, b), c);
}
half4 main(float2 coords) {
// Functions used multiple times:
- half4 result = fma(colorGreen.a, colorGreen.g, colorGreen.r).0x0x;
+ half4 result = fused_multiply_add(colorGreen.a, colorGreen.g, colorGreen.r).0x0x;
// Functions used only once:
result = multiplyByAlpha(result);
diff --git a/chromium/third_party/skia/resources/sksl/metal/Ossfuzz48371.sksl b/chromium/third_party/skia/resources/sksl/metal/Ossfuzz48371.sksl
new file mode 100644
index 00000000000..14f5b823c50
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/metal/Ossfuzz48371.sksl
@@ -0,0 +1 @@
+uniform texture2D s; \ No newline at end of file
diff --git a/chromium/third_party/skia/resources/sksl/runtime_errors/IllegalLayoutFlags.rts b/chromium/third_party/skia/resources/sksl/runtime_errors/IllegalLayoutFlags.rts
new file mode 100644
index 00000000000..6c1dea84e91
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/runtime_errors/IllegalLayoutFlags.rts
@@ -0,0 +1,30 @@
+layout(builtin=15) float4 sk_FragCoord;
+layout(builtin=17) bool sk_Clockwise;
+layout(builtin=10010) half4 input_color;
+
+layout(origin_upper_left) float upper_left;
+layout(push_constant) float push_constant;
+layout(location=0) float location;
+layout(offset=0) float offset;
+layout(binding=0) float binding;
+layout(index=0) float index;
+layout(set=0) float set;
+layout(input_attachment_index=0) float input_attachment_index;
+
+float4 main(float2 xy) {
+ return sk_FragCoord;
+}
+
+/*%%*
+layout qualifier 'builtin' is not permitted here
+layout qualifier 'builtin' is not permitted here
+layout qualifier 'builtin' is not permitted here
+layout qualifier 'origin_upper_left' is not permitted here
+layout qualifier 'push_constant' is not permitted here
+layout qualifier 'location' is not permitted here
+layout qualifier 'offset' is not permitted here
+layout qualifier 'binding' is not permitted here
+layout qualifier 'index' is not permitted here
+layout qualifier 'set' is not permitted here
+layout qualifier 'input_attachment_index' is not permitted here
+*%%*/
diff --git a/chromium/third_party/skia/resources/sksl/runtime_errors/IllegalModifiers.rts b/chromium/third_party/skia/resources/sksl/runtime_errors/IllegalModifiers.rts
new file mode 100644
index 00000000000..3c08109cd24
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/runtime_errors/IllegalModifiers.rts
@@ -0,0 +1,50 @@
+flat float _flat;
+noperspective float _noperspective;
+in float _in;
+out float _out;
+threadgroup float _threadgroup;
+$es3 float _es3;
+sk_has_side_effects float _sk_has_side_effects;
+inline float _inline;
+noinline float _noinline;
+readonly float _readonly;
+writeonly float _writeonly;
+
+flat void flat_fn() {}
+noperspective void noperspective_fn() {}
+in void in_fn() {}
+out void out_fn() {}
+threadgroup void threadgroup_fn() {}
+$es3 void es3_fn() {}
+sk_has_side_effects void sk_has_side_effect_fn() {}
+readonly void readonly_fn() {}
+writeonly void writeonly_fn() {}
+buffer void buffer_fn() {}
+
+float4 main(float2 xy) {
+ return float4(1);
+}
+
+/*%%*
+'flat' is not permitted here
+'noperspective' is not permitted here
+'in' is not permitted here
+'out' is not permitted here
+'threadgroup' is not permitted here
+'$es3' is not permitted here
+'sk_has_side_effects' is not permitted here
+'inline' is not permitted here
+'noinline' is not permitted here
+'readonly' is not permitted here
+'writeonly' is not permitted here
+'flat' is not permitted here
+'noperspective' is not permitted here
+'in' is not permitted here
+'out' is not permitted here
+'threadgroup' is not permitted here
+'$es3' is not permitted here
+'sk_has_side_effects' is not permitted here
+'readonly' is not permitted here
+'writeonly' is not permitted here
+'buffer' is not permitted here
+*%%*/
diff --git a/chromium/third_party/skia/resources/sksl/runtime_errors/IllegalShaderUse.rts b/chromium/third_party/skia/resources/sksl/runtime_errors/IllegalShaderUse.rts
index 5cd71c87b2c..d867adba97a 100644
--- a/chromium/third_party/skia/resources/sksl/runtime_errors/IllegalShaderUse.rts
+++ b/chromium/third_party/skia/resources/sksl/runtime_errors/IllegalShaderUse.rts
@@ -33,8 +33,8 @@ half4 dangling_eval() { s1.eval; }
/*%%*
variables of type 'shader' must be uniform
-'in' variables not permitted in runtime effects
variables of type 'shader' must be uniform
+'in' is not permitted here
opaque type 'shader' is not permitted in a struct
variables of type 'S' may not be uniform
opaque type 'shader' may not be used in an array
diff --git a/chromium/third_party/skia/resources/sksl/runtime_errors/InvalidUniformTypesES3.rts b/chromium/third_party/skia/resources/sksl/runtime_errors/InvalidUniformTypesES3.rts
new file mode 100644
index 00000000000..ac5dce091c2
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/runtime_errors/InvalidUniformTypesES3.rts
@@ -0,0 +1,52 @@
+#version 300
+
+uniform uint u;
+uniform uint2 u2;
+uniform uint3 u3;
+uniform uint4 u4;
+
+uniform ushort us;
+uniform ushort2 us2;
+uniform ushort3 us3;
+uniform ushort4 us4;
+
+uniform float2x3 f23;
+uniform float2x4 f24;
+uniform float3x2 f32;
+uniform float3x4 f34;
+uniform float4x2 f42;
+uniform float4x3 f43;
+
+uniform half2x3 h23;
+uniform half2x4 h24;
+uniform half3x2 h32;
+uniform half3x4 h34;
+uniform half4x2 h42;
+uniform half4x3 h43;
+
+half4 main(float2 xy) {
+ return half4(0);
+}
+
+/*%%*
+variables of type 'uint' may not be uniform
+variables of type 'uint2' may not be uniform
+variables of type 'uint3' may not be uniform
+variables of type 'uint4' may not be uniform
+variables of type 'ushort' may not be uniform
+variables of type 'ushort2' may not be uniform
+variables of type 'ushort3' may not be uniform
+variables of type 'ushort4' may not be uniform
+variables of type 'float2x3' may not be uniform
+variables of type 'float2x4' may not be uniform
+variables of type 'float3x2' may not be uniform
+variables of type 'float3x4' may not be uniform
+variables of type 'float4x2' may not be uniform
+variables of type 'float4x3' may not be uniform
+variables of type 'half2x3' may not be uniform
+variables of type 'half2x4' may not be uniform
+variables of type 'half3x2' may not be uniform
+variables of type 'half3x4' may not be uniform
+variables of type 'half4x2' may not be uniform
+variables of type 'half4x3' may not be uniform
+*%%*/
diff --git a/chromium/third_party/skia/resources/sksl/runtime_errors/ReservedNameISampler2D.rts b/chromium/third_party/skia/resources/sksl/runtime_errors/ReservedNameISampler2D.rts
deleted file mode 100644
index 8948ec4cb4b..00000000000
--- a/chromium/third_party/skia/resources/sksl/runtime_errors/ReservedNameISampler2D.rts
+++ /dev/null
@@ -1,5 +0,0 @@
-int isampler2D;
-
-/*%%*
-expected an identifier, but found type 'isampler2D'
-*%%*/
diff --git a/chromium/third_party/skia/resources/sksl/runtime_errors/ReservedNameSampler1D.rts b/chromium/third_party/skia/resources/sksl/runtime_errors/ReservedNameSampler1D.rts
index 7dc6cbbc0de..81fac75fb53 100644
--- a/chromium/third_party/skia/resources/sksl/runtime_errors/ReservedNameSampler1D.rts
+++ b/chromium/third_party/skia/resources/sksl/runtime_errors/ReservedNameSampler1D.rts
@@ -1,5 +1,5 @@
int sampler1D;
/*%%*
-expected an identifier, but found type 'sampler1D'
+'sampler1D' is a reserved word
*%%*/
diff --git a/chromium/third_party/skia/resources/sksl/runtime_errors/ReservedNameSampler3D.rts b/chromium/third_party/skia/resources/sksl/runtime_errors/ReservedNameSampler3D.rts
index 3820dc10305..937c8f339c6 100644
--- a/chromium/third_party/skia/resources/sksl/runtime_errors/ReservedNameSampler3D.rts
+++ b/chromium/third_party/skia/resources/sksl/runtime_errors/ReservedNameSampler3D.rts
@@ -1,5 +1,5 @@
int sampler3D;
/*%%*
-expected an identifier, but found type 'sampler3D'
+'sampler3D' is a reserved word
*%%*/
diff --git a/chromium/third_party/skia/resources/sksl/shared/FunctionPrototype.sksl b/chromium/third_party/skia/resources/sksl/shared/FunctionPrototype.sksl
index bc77ee7a0fc..cdd6a1126a6 100644
--- a/chromium/third_party/skia/resources/sksl/shared/FunctionPrototype.sksl
+++ b/chromium/third_party/skia/resources/sksl/shared/FunctionPrototype.sksl
@@ -4,6 +4,7 @@ float this_function_is_prototyped_at_the_start_and_never_defined();
half4 this_function_is_defined_before_use(half4 x);
half4 this_function_is_defined_after_use(half4 x);
half4 this_function_is_defined_near_the_end(half4 x);
+half4 main(float2 coords); // prototyping main is allowed (although not particularly useful)
half4 this_function_is_defined_before_use(half4 x) {
return -this_function_is_defined_near_the_end(x);
diff --git a/chromium/third_party/skia/resources/sksl/shared/IntegerDivisionES3.sksl b/chromium/third_party/skia/resources/sksl/shared/IntegerDivisionES3.sksl
new file mode 100644
index 00000000000..052796f8814
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/shared/IntegerDivisionES3.sksl
@@ -0,0 +1,25 @@
+uniform half4 colorGreen;
+
+int exact_division(int x, int y) {
+ int result = 0;
+ while (x >= y) {
+ ++result;
+ x -= y;
+ }
+ return result;
+}
+
+half4 main(float2 coords) {
+ int zero = int(colorGreen.r);
+ int one = int(colorGreen.g);
+
+ for (int x = zero; x < 100; ++x) {
+ for (int y = one; y < 100; ++y) {
+ if ((x/y) != exact_division(x, y)) {
+ return half4(1, float(x) / 255, float(y) / 255, 1);
+ }
+ }
+ }
+
+ return colorGreen;
+}
diff --git a/chromium/third_party/skia/resources/sksl/shared/InterfaceBlockBuffer.sksl b/chromium/third_party/skia/resources/sksl/shared/InterfaceBlockBuffer.sksl
new file mode 100644
index 00000000000..e15dcacace2
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/shared/InterfaceBlockBuffer.sksl
@@ -0,0 +1,7 @@
+layout(binding=456) buffer testBlock {
+ float x;
+} test;
+
+void main() {
+ sk_FragColor = half4(half(test.x));
+}
diff --git a/chromium/third_party/skia/resources/sksl/shared/SwitchWithEarlyReturn.sksl b/chromium/third_party/skia/resources/sksl/shared/SwitchWithEarlyReturn.sksl
new file mode 100644
index 00000000000..af431c4534c
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/shared/SwitchWithEarlyReturn.sksl
@@ -0,0 +1,208 @@
+uniform half4 colorGreen, colorRed;
+
+bool return_in_one_case(int x) {
+ int val = 0;
+ switch (x) {
+ case 1:
+ ++val;
+ return false;
+ ++val; // unreachable
+ default: ++val;
+ }
+
+ // reachable
+ return val == 1;
+}
+
+bool return_in_default(int x) {
+ int val = 0;
+ switch (x) {
+ default: return true;
+ }
+
+ // unreachable
+ ++val;
+ return val == 1;
+}
+
+bool return_in_every_case(int x) {
+ int val = 0;
+ switch (x) {
+ case 1: return false;
+ default: return true;
+ }
+
+ // unreachable
+ ++val;
+ return val == 1;
+}
+
+bool return_in_every_case_no_default(int x) {
+ int val = 0;
+ switch (x) {
+ case 1: return false;
+ case 2: return true;
+ }
+
+ // reachable
+ ++val;
+ return val == 1;
+}
+
+bool case_has_break_before_return(int x) {
+ int val = 0;
+ switch (x) {
+ case 1:
+ break;
+ return false; // unreachable
+ case 2: return true;
+ default: return true;
+ }
+
+ // reachable
+ ++val;
+ return val == 1;
+}
+
+bool case_has_break_after_return(int x) {
+ int val = 0;
+ switch (x) {
+ case 1:
+ return false;
+ break; // unreachable
+ case 2: return true;
+ default: return true;
+ }
+
+ // unreachable
+ ++val;
+ return val == 1;
+}
+
+bool no_return_in_default(int x) {
+ int val = 0;
+ switch (x) {
+ case 1: return false;
+ case 2: return true;
+ default: break;
+ }
+
+ // reachable
+ ++val;
+ return val == 1;
+}
+
+bool empty_default(int x) {
+ int val = 0;
+ switch (x) {
+ case 1: return false;
+ case 2: return true;
+ default:
+ }
+
+ // reachable
+ ++val;
+ return val == 1;
+}
+
+bool return_with_fallthrough(int x) {
+ int val = 0;
+ switch (x) {
+ case 1:
+ case 2: return true;
+ default: return false;
+ }
+
+ // unreachable
+ ++val;
+ return val == 1;
+}
+
+bool fallthrough_ends_in_break(int x) {
+ int val = 0;
+ switch (x) {
+ case 1:
+ case 2: break;
+ default: return false;
+ }
+
+ // reachable
+ ++val;
+ return val == 1;
+}
+
+bool fallthrough_to_default_with_break(int x) {
+ int val = 0;
+ switch (x) {
+ case 1:
+ case 2:
+ default: break;
+ }
+
+ // reachable
+ ++val;
+ return val == 1;
+}
+
+bool fallthrough_to_default_with_return(int x) {
+ int val = 0;
+ switch (x) {
+ case 1:
+ case 2:
+ default: return true;
+ }
+
+ // unreachable
+ ++val;
+ return val == 1;
+}
+
+bool fallthrough_with_loop_break(int x) {
+ int val = 0;
+ switch (x) {
+ case 1: for (int i = 0; i < 5; ++i) {
+ ++val;
+ break; // break only applies to loop, should fallthrough
+ }
+ case 2:
+ default: return true;
+ }
+
+ // unreachable
+ ++val;
+ return val == 1;
+}
+
+bool fallthrough_with_loop_continue(int x) {
+ int val = 0;
+ switch (x) {
+ case 1: for (int i = 0; i < 5; ++i) {
+ ++val;
+ continue; // continue only applies to loop, should fallthrough
+ }
+ case 2:
+ default: return true;
+ }
+
+ // unreachable
+ ++val;
+ return val == 1;
+}
+
+half4 main(float2 coords) {
+ int x = int(colorGreen.g);
+ return (return_in_one_case(x) &&
+ return_in_default(x) &&
+ return_in_every_case(x) &&
+ return_in_every_case_no_default(x) &&
+ case_has_break_before_return(x) &&
+ case_has_break_after_return(x) &&
+ no_return_in_default(x) &&
+ empty_default(x) &&
+ return_with_fallthrough(x) &&
+ fallthrough_ends_in_break(x) &&
+ fallthrough_to_default_with_break(x) &&
+ fallthrough_to_default_with_return(x) &&
+ fallthrough_with_loop_break(x) &&
+ fallthrough_with_loop_continue(x)) ? colorGreen : colorRed;
+}
diff --git a/chromium/third_party/skia/resources/sksl/shared/SwitchWithLoopsES3.sksl b/chromium/third_party/skia/resources/sksl/shared/SwitchWithLoopsES3.sksl
new file mode 100644
index 00000000000..bf2a2cf3a7a
--- /dev/null
+++ b/chromium/third_party/skia/resources/sksl/shared/SwitchWithLoopsES3.sksl
@@ -0,0 +1,81 @@
+/*#pragma settings RewriteSwitchStatements*/
+
+uniform half4 colorGreen, colorRed;
+
+bool switch_with_break_in_while_loop(int x) {
+ int val = 0;
+ int i = 0;
+ switch (x) {
+ case 1: while (i < 10) { ++i; ++val; break; ++val; }
+ default: ++val;
+ }
+ return val == 2;
+}
+
+bool switch_with_continue_in_while_loop(int x) {
+ int val = 0;
+ int i = 0;
+ switch (x) {
+ case 1: while (i < 10) { ++i; ++val; continue; ++val; }
+ default: ++val;
+ }
+ return val == 11;
+}
+
+bool while_loop_with_break_in_switch(int x) {
+ int val = 0;
+ int i = 0;
+ while (i < 10) {
+ ++i;
+ switch (x) {
+ case 1: ++val; break;
+ default: return false;
+ }
+ ++val;
+ }
+ return val == 20;
+}
+
+bool switch_with_break_in_do_while_loop(int x) {
+ int val = 0;
+ int i = 0;
+ switch (x) {
+ case 1: do { ++i; ++val; break; ++val; } while (i < 10);
+ default: ++val;
+ }
+ return val == 2;
+}
+
+bool switch_with_continue_in_do_while_loop(int x) {
+ int val = 0;
+ int i = 0;
+ switch (x) {
+ case 1: do { ++i; ++val; continue; ++val; } while (i < 10);
+ default: ++val;
+ }
+ return val == 11;
+}
+
+bool do_while_loop_with_break_in_switch(int x) {
+ int val = 0;
+ int i = 0;
+ do {
+ ++i;
+ switch (x) {
+ case 1: ++val; break;
+ default: return false;
+ }
+ ++val;
+ } while (i < 10);
+ return val == 20;
+}
+
+half4 main(float2 coords) {
+ int x = int(colorGreen.g);
+ return (switch_with_break_in_while_loop(x) &&
+ switch_with_continue_in_while_loop(x) &&
+ while_loop_with_break_in_switch(x) &&
+ switch_with_break_in_do_while_loop(x) &&
+ switch_with_continue_in_do_while_loop(x) &&
+ do_while_loop_with_break_in_switch(x)) ? colorGreen : colorRed;
+}
diff --git a/chromium/third_party/skia/resources/sksl/shared/Texture1D.sksl b/chromium/third_party/skia/resources/sksl/shared/Texture1D.sksl
deleted file mode 100644
index 12ff3219482..00000000000
--- a/chromium/third_party/skia/resources/sksl/shared/Texture1D.sksl
+++ /dev/null
@@ -1,7 +0,0 @@
-layout(binding=0) uniform sampler1D tex;
-
-void main() {
- float4 a = sample(tex, 0);
- float4 b = sample(tex, float2(0));
- sk_FragColor = half4(float2(a.xy), float2(b.zw));
-}
diff --git a/chromium/third_party/skia/resources/sksl/shared/TextureSharpen.sksl b/chromium/third_party/skia/resources/sksl/shared/TextureSharpen.sksl
index 3149c12f82d..4202bb921a3 100644
--- a/chromium/third_party/skia/resources/sksl/shared/TextureSharpen.sksl
+++ b/chromium/third_party/skia/resources/sksl/shared/TextureSharpen.sksl
@@ -1,12 +1,9 @@
/*#pragma settings Sharpen*/
-layout(binding=0) uniform sampler1D one;
-layout(binding=1) uniform sampler2D two;
+layout(binding=0) uniform sampler2D s;
void main() {
- float4 a = sample(one, 0);
- float4 b = sample(two, float2(0));
- float4 c = sample(one, float2(0));
- float4 d = sample(two, float3(0));
- sk_FragColor = half4(half(a.x), half(b.x), half(c.x), half(d.x));
+ float4 a = sample(s, float2(0));
+ float4 b = sample(s, float3(0));
+ sk_FragColor = half4(half2(a.xy), half2(b.xy));
}
diff --git a/chromium/third_party/skia/resources/sksl/shared/VectorScalarMath.sksl b/chromium/third_party/skia/resources/sksl/shared/VectorScalarMath.sksl
index 16a66190fd8..34ea1e79ea1 100644
--- a/chromium/third_party/skia/resources/sksl/shared/VectorScalarMath.sksl
+++ b/chromium/third_party/skia/resources/sksl/shared/VectorScalarMath.sksl
@@ -29,28 +29,28 @@ bool test_half() {
ok = ok && (x == half4(9, 9, 10, 10));
x = inputRed.r + inputGreen;
ok = ok && (x == half4(1, 2, 1, 2));
- x.xyz = 9 * inputGreen.aga;
- ok = ok && (x == half4(9, 9, 9, 2));
- x.xy = 36 / x.zw;
- ok = ok && (x == half4(4, 18, 9, 2));
+ x.xyz = 8 * inputGreen.aga;
+ ok = ok && (x == half4(8, 8, 8, 2));
+ x.xy = 32 / x.zw;
+ ok = ok && (x == half4(4, 16, 8, 2));
// (Scalar op vector).swizzle
- x = (36 / x).yxwz;
- ok = ok && (x == half4(2, 9, 18, 4));
+ x = (32 / x).yxwz;
+ ok = ok && (x == half4(2, 8, 16, 4));
// X op= scalar.
x += 2;
x *= 2;
x -= 4;
x /= 2;
- ok = ok && (x == half4(2, 9, 18, 4));
+ ok = ok && (x == half4(2, 8, 16, 4));
// X = X op scalar.
x = x + 2;
x = x * 2;
x = x - 4;
x = x / 2;
- ok = ok && (x == half4(2, 9, 18, 4));
+ ok = ok && (x == half4(2, 8, 16, 4));
return ok;
}
@@ -69,8 +69,8 @@ bool test_int() {
ok = ok && (x == int4(2, 1, 1, 2));
x.xyz = inputGreen.aga * 9;
ok = ok && (x == int4(9, 9, 9, 2));
- x.xy = x.zw / 3;
- ok = ok && (x == int4(3, 0, 9, 2));
+ x.xy = x.zw / 4;
+ ok = ok && (x == int4(2, 0, 9, 2));
// (Vector op scalar).swizzle
x = (inputRed * 5).yxwz;
@@ -83,13 +83,13 @@ bool test_int() {
ok = ok && (x == int4(9, 9, 10, 10));
x = inputRed.r + inputGreen;
ok = ok && (x == int4(1, 2, 1, 2));
- x.xyz = 9 * inputGreen.aga;
- ok = ok && (x == int4(9, 9, 9, 2));
+ x.xyz = 8 * inputGreen.aga;
+ ok = ok && (x == int4(8, 8, 8, 2));
x.xy = 36 / x.zw;
- ok = ok && (x == int4(4, 18, 9, 2));
+ ok = ok && (x == int4(4, 18, 8, 2));
// (Scalar op vector).swizzle
- x = (36 / x).yxwz;
+ x = (37 / x).yxwz;
ok = ok && (x == int4(2, 9, 18, 4));
// X op= scalar.
diff --git a/chromium/third_party/skia/resources/sksl/shared/VectorToMatrixCast.sksl b/chromium/third_party/skia/resources/sksl/shared/VectorToMatrixCast.sksl
index 5f59a9927d7..e8257785e58 100644
--- a/chromium/third_party/skia/resources/sksl/shared/VectorToMatrixCast.sksl
+++ b/chromium/third_party/skia/resources/sksl/shared/VectorToMatrixCast.sksl
@@ -32,5 +32,8 @@ half4 main(float2 coords) {
ok = ok && half2x2(true, false, false, true) == half2x2(bool4(true, false, false, true));
ok = ok && half2x2(true, true, true, true) == half2x2(bool4(true));
+ ok = ok && half2x2(colorGreen - colorRed) == half2x2(-1, 1, 0, 0);
+ ok = ok && half2x2(colorGreen + 5) == half2x2(5, 6, 5, 6);
+
return ok ? colorGreen : colorRed;
}
diff --git a/chromium/third_party/skia/samplecode/Sample3D.cpp b/chromium/third_party/skia/samplecode/Sample3D.cpp
index ec1fa627fdc..f9f4df82517 100644
--- a/chromium/third_party/skia/samplecode/Sample3D.cpp
+++ b/chromium/third_party/skia/samplecode/Sample3D.cpp
@@ -452,7 +452,7 @@ public:
"skottie/skottie-motiontile-effect-phase.json",
};
- for (unsigned i = 0; i < SK_ARRAY_COUNT(files); ++i) {
+ for (unsigned i = 0; i < std::size(files); ++i) {
if (auto stream = GetResourceAsStream(files[i])) {
fAnim[i] = skottie::Animation::Make(stream.get());
}
diff --git a/chromium/third_party/skia/samplecode/SampleAARectModes.cpp b/chromium/third_party/skia/samplecode/SampleAARectModes.cpp
index 99d8f77f1e9..5d3c5e76cb9 100644
--- a/chromium/third_party/skia/samplecode/SampleAARectModes.cpp
+++ b/chromium/third_party/skia/samplecode/SampleAARectModes.cpp
@@ -84,7 +84,7 @@ class AARectsModesView : public Sample {
for (int alpha = 0; alpha < 4; ++alpha) {
canvas->save();
canvas->save();
- for (size_t i = 0; i < SK_ARRAY_COUNT(gModes); ++i) {
+ for (size_t i = 0; i < std::size(gModes); ++i) {
if (6 == i) {
canvas->restore();
canvas->translate(W * 5, 0);
diff --git a/chromium/third_party/skia/samplecode/SampleAARects.cpp b/chromium/third_party/skia/samplecode/SampleAARects.cpp
index b7cc5e88664..1f15f06c330 100644
--- a/chromium/third_party/skia/samplecode/SampleAARects.cpp
+++ b/chromium/third_party/skia/samplecode/SampleAARects.cpp
@@ -61,7 +61,7 @@ class AARectView : public Sample {
SkScalar dx = SkIntToScalar(80);
SkScalar dy = SkIntToScalar(100);
SkMatrix matrix;
- for (size_t p = 0; p < SK_ARRAY_COUNT(paints); ++p) {
+ for (size_t p = 0; p < std::size(paints); ++p) {
for (int stroke = 0; stroke < 2; ++stroke) {
paints[p].setStyle(stroke ? SkPaint::kStroke_Style : SkPaint::kFill_Style);
for (int a = 0; a < 3; ++ a) {
diff --git a/chromium/third_party/skia/samplecode/SampleAnimBlur.cpp b/chromium/third_party/skia/samplecode/SampleAnimBlur.cpp
index c946a2aa2e7..21cec9070be 100644
--- a/chromium/third_party/skia/samplecode/SampleAnimBlur.cpp
+++ b/chromium/third_party/skia/samplecode/SampleAnimBlur.cpp
@@ -36,7 +36,7 @@ class AnimBlurView : public Sample {
};
SkRandom random;
- for (size_t i = 0; i < SK_ARRAY_COUNT(gStyles); ++i) {
+ for (size_t i = 0; i < std::size(gStyles); ++i) {
SkPaint paint;
paint.setMaskFilter(SkMaskFilter::MakeBlur(gStyles[i],
fBlurSigma));
diff --git a/chromium/third_party/skia/samplecode/SampleArc.cpp b/chromium/third_party/skia/samplecode/SampleArc.cpp
index 46629569609..3b620d51106 100644
--- a/chromium/third_party/skia/samplecode/SampleArc.cpp
+++ b/chromium/third_party/skia/samplecode/SampleArc.cpp
@@ -131,7 +131,7 @@ class ArcsView : public Sample {
225, 90
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gAngles); i += 2) {
+ for (size_t i = 0; i < std::size(gAngles); i += 2) {
paint.setColor(SK_ColorBLACK);
DrawRectWithLines(canvas, r, paint);
diff --git a/chromium/third_party/skia/samplecode/SampleClip.cpp b/chromium/third_party/skia/samplecode/SampleClip.cpp
index 2d0fdfdc983..192b5fe1c98 100644
--- a/chromium/third_party/skia/samplecode/SampleClip.cpp
+++ b/chromium/third_party/skia/samplecode/SampleClip.cpp
@@ -117,7 +117,7 @@ class ClipView : public Sample {
for (int aa = 0; aa <= 1; ++aa) {
canvas->save();
- for (size_t i = 0; i < SK_ARRAY_COUNT(gProc); ++i) {
+ for (size_t i = 0; i < std::size(gProc); ++i) {
canvas->save();
canvas->clipPath(clipPath, SkClipOp::kIntersect, SkToBool(aa));
// canvas->drawColor(SK_ColorWHITE);
diff --git a/chromium/third_party/skia/samplecode/SampleComplexClip.cpp b/chromium/third_party/skia/samplecode/SampleComplexClip.cpp
index 64e7af55589..6e8930b125b 100644
--- a/chromium/third_party/skia/samplecode/SampleComplexClip.cpp
+++ b/chromium/third_party/skia/samplecode/SampleComplexClip.cpp
@@ -86,8 +86,8 @@ class ComplexClipView : public Sample {
canvas->save();
for (int invA = 0; invA < 2; ++invA) {
- for (size_t op = 0; op < SK_ARRAY_COUNT(gOps); ++op) {
- size_t idx = invA * SK_ARRAY_COUNT(gOps) + op;
+ for (size_t op = 0; op < std::size(gOps); ++op) {
+ size_t idx = invA * std::size(gOps) + op;
if (!(idx % 3)) {
canvas->restore();
canvas->translate(0, SkIntToScalar(250));
diff --git a/chromium/third_party/skia/samplecode/SampleCusp.cpp b/chromium/third_party/skia/samplecode/SampleCusp.cpp
index 543a3a3f234..26c4c841e8d 100644
--- a/chromium/third_party/skia/samplecode/SampleCusp.cpp
+++ b/chromium/third_party/skia/samplecode/SampleCusp.cpp
@@ -97,7 +97,7 @@ struct data {
{{{0x43480000,0x43960000},{0x436f0222,0x4328051c},{0x435c2222,0x43810f5c},{0x435ae000,0x4351e664},}},
};
-size_t datCount = SK_ARRAY_COUNT(dat);
+size_t datCount = std::size(dat);
class CuspView : public Sample {
public:
diff --git a/chromium/third_party/skia/samplecode/SampleDegenerateTwoPtRadials.cpp b/chromium/third_party/skia/samplecode/SampleDegenerateTwoPtRadials.cpp
index f0c74bef783..16c0887c8c5 100644
--- a/chromium/third_party/skia/samplecode/SampleDegenerateTwoPtRadials.cpp
+++ b/chromium/third_party/skia/samplecode/SampleDegenerateTwoPtRadials.cpp
@@ -28,7 +28,7 @@ static void draw_gradient2(SkCanvas* canvas, const SkRect& rect, SkScalar delta)
SkScalar r1 = 2 * w / 5;
SkPaint paint;
paint.setShader(SkGradientShader::MakeTwoPointConical(c0, r0, c1, r1, colors,
- pos, SK_ARRAY_COUNT(pos),
+ pos, std::size(pos),
SkTileMode::kClamp));
canvas->drawRect(rect, paint);
}
diff --git a/chromium/third_party/skia/samplecode/SampleEffects.cpp b/chromium/third_party/skia/samplecode/SampleEffects.cpp
index 5a49ded3730..134eba79436 100644
--- a/chromium/third_party/skia/samplecode/SampleEffects.cpp
+++ b/chromium/third_party/skia/samplecode/SampleEffects.cpp
@@ -35,7 +35,7 @@ static void paint_proc2(SkPaint* paint) {
static void paint_proc3(SkPaint* paint) {
SkColor colors[] = { SK_ColorRED, COLOR, SK_ColorBLUE };
SkPoint pts[] = { { 3, 0 }, { 7, 5 } };
- paint->setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
+ paint->setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, std::size(colors),
SkTileMode::kMirror));
}
@@ -58,7 +58,7 @@ const PaintProc gPaintProcs[] = {
class EffectsView : public Sample {
public:
SkPath fPath;
- SkPaint fPaint[SK_ARRAY_COUNT(gPaintProcs)];
+ SkPaint fPaint[std::size(gPaintProcs)];
EffectsView() {
size_t i;
@@ -72,11 +72,11 @@ public:
0, -10
};
fPath.moveTo(pts[0], pts[1]);
- for (i = 2; i < SK_ARRAY_COUNT(pts); i += 2) {
+ for (i = 2; i < std::size(pts); i += 2) {
fPath.lineTo(pts[i], pts[i+1]);
}
- for (i = 0; i < SK_ARRAY_COUNT(gPaintProcs); i++) {
+ for (i = 0; i < std::size(gPaintProcs); i++) {
fPaint[i].setAntiAlias(true);
fPaint[i].setColor(COLOR);
gPaintProcs[i](&fPaint[i]);
@@ -91,7 +91,7 @@ protected:
void onDrawContent(SkCanvas* canvas) override {
canvas->scale(3, 3);
canvas->translate(10, 30);
- for (size_t i = 0; i < SK_ARRAY_COUNT(fPaint); i++) {
+ for (size_t i = 0; i < std::size(fPaint); i++) {
canvas->drawPath(fPath, fPaint[i]);
canvas->translate(32, 0);
}
diff --git a/chromium/third_party/skia/samplecode/SampleFilterBounds.cpp b/chromium/third_party/skia/samplecode/SampleFilterBounds.cpp
index 5406b92b9df..5660c59a773 100644
--- a/chromium/third_party/skia/samplecode/SampleFilterBounds.cpp
+++ b/chromium/third_party/skia/samplecode/SampleFilterBounds.cpp
@@ -106,7 +106,7 @@ static const SkColor4f kScaleGradientColors[] =
{ 0.8f, 0.1f, 0.f, 1.f } }; // Severe upscaling, s > 8, log(s) > 3
static const SkScalar kLogScaleFactors[] = { -3.f, -1.f, 0.f, 1.f, 3.f };
static const SkScalar kGradientStops[] = { 0.f, 0.33333f, 0.5f, 0.66667f, 1.f };
-static const int kStopCount = (int) SK_ARRAY_COUNT(kScaleGradientColors);
+static const int kStopCount = (int) std::size(kScaleGradientColors);
static void draw_scale_key(SkCanvas* canvas, float y) {
SkRect key = SkRect::MakeXYWH(15.f, y + 30.f, 15.f, 100.f);
diff --git a/chromium/third_party/skia/samplecode/SampleGradients.cpp b/chromium/third_party/skia/samplecode/SampleGradients.cpp
index a101ec35275..3ea30bf39f7 100644
--- a/chromium/third_party/skia/samplecode/SampleGradients.cpp
+++ b/chromium/third_party/skia/samplecode/SampleGradients.cpp
@@ -133,9 +133,9 @@ protected:
for (int tm = 0; tm < kSkTileModeCount; ++tm) {
canvas->save();
- for (size_t i = 0; i < SK_ARRAY_COUNT(gGradData); i++) {
+ for (size_t i = 0; i < std::size(gGradData); i++) {
canvas->save();
- for (size_t j = 0; j < SK_ARRAY_COUNT(gGradMakers); j++) {
+ for (size_t j = 0; j < std::size(gGradMakers); j++) {
paint.setShader(gGradMakers[j](pts, gGradData[i], (SkTileMode)tm));
canvas->drawRect(r, paint);
canvas->translate(0, SkIntToScalar(120));
@@ -144,7 +144,7 @@ protected:
canvas->translate(SkIntToScalar(120), 0);
}
canvas->restore();
- canvas->translate(SK_ARRAY_COUNT(gGradData)*SkIntToScalar(120), 0);
+ canvas->translate(std::size(gGradData)*SkIntToScalar(120), 0);
}
canvas->restore();
diff --git a/chromium/third_party/skia/samplecode/SampleHairModes.cpp b/chromium/third_party/skia/samplecode/SampleHairModes.cpp
index 6e05fbcedc0..474885063d8 100644
--- a/chromium/third_party/skia/samplecode/SampleHairModes.cpp
+++ b/chromium/third_party/skia/samplecode/SampleHairModes.cpp
@@ -84,7 +84,7 @@ protected:
for (int alpha = 0; alpha < 4; ++alpha) {
canvas->save();
canvas->save();
- for (size_t i = 0; i < SK_ARRAY_COUNT(gModes); ++i) {
+ for (size_t i = 0; i < std::size(gModes); ++i) {
if (6 == i) {
canvas->restore();
canvas->translate(W * 5, 0);
diff --git a/chromium/third_party/skia/samplecode/SampleImageFilterDAG.cpp b/chromium/third_party/skia/samplecode/SampleImageFilterDAG.cpp
index 320af137ec4..8e9cb05a113 100644
--- a/chromium/third_party/skia/samplecode/SampleImageFilterDAG.cpp
+++ b/chromium/third_party/skia/samplecode/SampleImageFilterDAG.cpp
@@ -138,7 +138,7 @@ static void draw_node(SkCanvas* canvas, const FilterNode& node) {
static const SkColor kColors[2] = {SK_ColorGREEN, SK_ColorWHITE};
SkPoint points[2] = { {content.fLeft + 15.f, content.fTop + 15.f},
{content.fRight - 15.f, content.fBottom - 15.f} };
- paint.setShader(SkGradientShader::MakeLinear(points, kColors, nullptr, SK_ARRAY_COUNT(kColors),
+ paint.setShader(SkGradientShader::MakeLinear(points, kColors, nullptr, std::size(kColors),
SkTileMode::kRepeat));
SkPaint line;
diff --git a/chromium/third_party/skia/samplecode/SampleMaterialShadows.cpp b/chromium/third_party/skia/samplecode/SampleMaterialShadows.cpp
index 8cb951fa28f..74a243ad970 100644
--- a/chromium/third_party/skia/samplecode/SampleMaterialShadows.cpp
+++ b/chromium/third_party/skia/samplecode/SampleMaterialShadows.cpp
@@ -72,7 +72,7 @@ class MaterialShadowsView : public Sample {
paint.setColor(SK_ColorWHITE);
canvas->save();
canvas->translate(80, 80);
- for (unsigned int i = 0; i < SK_ARRAY_COUNT(elevations); ++i) {
+ for (unsigned int i = 0; i < std::size(elevations); ++i) {
zPlaneParams.fZ = elevations[i];
this->drawShadowedPath(canvas, fCirclePath, zPlaneParams, paint, kAmbientAlpha,
lightPos, kLightRadius, kSpotAlpha);
@@ -82,7 +82,7 @@ class MaterialShadowsView : public Sample {
canvas->save();
canvas->translate(120, 175);
- for (unsigned int i = 0; i < SK_ARRAY_COUNT(elevations); ++i) {
+ for (unsigned int i = 0; i < std::size(elevations); ++i) {
zPlaneParams.fZ = elevations[i];
this->drawShadowedPath(canvas, fCapsulePath, zPlaneParams, paint, kAmbientAlpha,
lightPos, kLightRadius, kSpotAlpha);
@@ -92,7 +92,7 @@ class MaterialShadowsView : public Sample {
canvas->save();
canvas->translate(120, 320);
- for (unsigned int i = 0; i < SK_ARRAY_COUNT(elevations); ++i) {
+ for (unsigned int i = 0; i < std::size(elevations); ++i) {
zPlaneParams.fZ = elevations[i];
this->drawShadowedPath(canvas, fLargeRRPath, zPlaneParams, paint, kAmbientAlpha,
lightPos, kLightRadius, kSpotAlpha);
@@ -102,7 +102,7 @@ class MaterialShadowsView : public Sample {
canvas->save();
canvas->translate(100, 475);
- for (unsigned int i = 0; i < SK_ARRAY_COUNT(elevations); ++i) {
+ for (unsigned int i = 0; i < std::size(elevations); ++i) {
zPlaneParams.fZ = elevations[i];
this->drawShadowedPath(canvas, fSmallRRPath, zPlaneParams, paint, kAmbientAlpha,
lightPos, kLightRadius, kSpotAlpha);
@@ -112,7 +112,7 @@ class MaterialShadowsView : public Sample {
canvas->save();
canvas->translate(100, 600);
- for (unsigned int i = 0; i < SK_ARRAY_COUNT(elevations); ++i) {
+ for (unsigned int i = 0; i < std::size(elevations); ++i) {
canvas->save();
zPlaneParams.fZ = elevations[i];
canvas->rotate(10);
@@ -125,7 +125,7 @@ class MaterialShadowsView : public Sample {
canvas->save();
canvas->translate(100, 725);
- for (unsigned int i = 0; i < SK_ARRAY_COUNT(elevations); ++i) {
+ for (unsigned int i = 0; i < std::size(elevations); ++i) {
canvas->save();
zPlaneParams.fZ = elevations[i];
canvas->rotate(45);
diff --git a/chromium/third_party/skia/samplecode/SamplePatch.cpp b/chromium/third_party/skia/samplecode/SamplePatch.cpp
index 98dde314913..e5681c86c34 100644
--- a/chromium/third_party/skia/samplecode/SamplePatch.cpp
+++ b/chromium/third_party/skia/samplecode/SamplePatch.cpp
@@ -42,7 +42,7 @@ static sk_sp<SkShader> make_shader1(const SkIPoint& size) {
{ SkIntToScalar(size.fX), SkIntToScalar(size.fY) } };
SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorRED };
return SkGradientShader::MakeLinear(pts, colors, nullptr,
- SK_ARRAY_COUNT(colors), SkTileMode::kMirror);
+ std::size(colors), SkTileMode::kMirror);
}
class Patch {
@@ -261,7 +261,7 @@ struct PatchView : public Sample {
paint.setShader(nullptr);
paint.setAntiAlias(true);
paint.setStrokeWidth(SkIntToScalar(5));
- canvas->drawPoints(SkCanvas::kPoints_PointMode, SK_ARRAY_COUNT(fPts), fPts, paint);
+ canvas->drawPoints(SkCanvas::kPoints_PointMode, std::size(fPts), fPts, paint);
canvas->translate(0, SkIntToScalar(300));
@@ -299,7 +299,7 @@ struct PatchView : public Sample {
Sample::Click* onFindClickHandler(SkScalar x, SkScalar y, skui::ModifierKey modi) override {
x -= DX;
y -= DY;
- for (size_t i = 0; i < SK_ARRAY_COUNT(fPts); i++) {
+ for (size_t i = 0; i < std::size(fPts); i++) {
if (hittest(fPts[i], x, y)) {
return new PtClick((int)i);
}
diff --git a/chromium/third_party/skia/samplecode/SamplePath.cpp b/chromium/third_party/skia/samplecode/SamplePath.cpp
index ac725d91b2f..43203845ff0 100644
--- a/chromium/third_party/skia/samplecode/SamplePath.cpp
+++ b/chromium/third_party/skia/samplecode/SamplePath.cpp
@@ -165,9 +165,9 @@ protected:
SkPaint::kRound_Join
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gJoins); i++) {
+ for (size_t i = 0; i < std::size(gJoins); i++) {
canvas->save();
- for (size_t j = 0; j < SK_ARRAY_COUNT(fPath); j++) {
+ for (size_t j = 0; j < std::size(fPath); j++) {
this->drawPath(canvas, fPath[j], gJoins[i]);
canvas->translate(200, 0);
}
diff --git a/chromium/third_party/skia/samplecode/SamplePathClip.cpp b/chromium/third_party/skia/samplecode/SamplePathClip.cpp
index 8db008d7e00..103fd4f25ee 100644
--- a/chromium/third_party/skia/samplecode/SamplePathClip.cpp
+++ b/chromium/third_party/skia/samplecode/SamplePathClip.cpp
@@ -250,7 +250,7 @@ protected:
public:
DragPolyClick(SkPoint poly[], int count) : fPoly(poly), fCount(count)
{
- SkASSERT((size_t)count <= SK_ARRAY_COUNT(fSrc));
+ SkASSERT((size_t)count <= std::size(fSrc));
memcpy(fSrc, poly, count * sizeof(SkPoint));
}
void handleMove() override {
diff --git a/chromium/third_party/skia/samplecode/SamplePathEffects.cpp b/chromium/third_party/skia/samplecode/SamplePathEffects.cpp
index 5ed32412fbd..bde7f2562ff 100644
--- a/chromium/third_party/skia/samplecode/SamplePathEffects.cpp
+++ b/chromium/third_party/skia/samplecode/SamplePathEffects.cpp
@@ -32,7 +32,7 @@ static sk_sp<SkPathEffect> make_pe(int flags, SkScalar phase) {
SkPath path;
path.moveTo(SkIntToScalar(gXY[0]), SkIntToScalar(gXY[1]));
- for (unsigned i = 2; i < SK_ARRAY_COUNT(gXY); i += 2)
+ for (unsigned i = 2; i < std::size(gXY); i += 2)
path.lineTo(SkIntToScalar(gXY[i]), SkIntToScalar(gXY[i+1]));
path.close();
path.offset(SkIntToScalar(-6), 0);
@@ -50,7 +50,7 @@ static sk_sp<SkPathEffect> make_pe(int flags, SkScalar phase) {
static sk_sp<SkPathEffect> make_warp_pe(SkScalar phase) {
SkPath path;
path.moveTo(SkIntToScalar(gXY[0]), SkIntToScalar(gXY[1]));
- for (unsigned i = 2; i < SK_ARRAY_COUNT(gXY); i += 2) {
+ for (unsigned i = 2; i < std::size(gXY); i += 2) {
path.lineTo(SkIntToScalar(gXY[i]), SkIntToScalar(gXY[i+1]));
}
path.close();
diff --git a/chromium/third_party/skia/samplecode/SamplePathTessellators.cpp b/chromium/third_party/skia/samplecode/SamplePathTessellators.cpp
index 824bc08ec90..3e161c7357f 100644
--- a/chromium/third_party/skia/samplecode/SamplePathTessellators.cpp
+++ b/chromium/third_party/skia/samplecode/SamplePathTessellators.cpp
@@ -14,12 +14,12 @@
#include "src/core/SkCanvasPriv.h"
#include "src/gpu/ganesh/GrOpFlushState.h"
#include "src/gpu/ganesh/GrRecordingContextPriv.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/ops/GrDrawOp.h"
#include "src/gpu/ganesh/ops/GrSimpleMeshDrawOpHelper.h"
#include "src/gpu/ganesh/ops/TessellationPathRenderer.h"
#include "src/gpu/ganesh/tessellate/GrPathTessellationShader.h"
#include "src/gpu/ganesh/tessellate/PathTessellator.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
#include "src/gpu/tessellate/AffineMatrix.h"
#include "src/gpu/tessellate/MiddleOutPolygonTriangulator.h"
diff --git a/chromium/third_party/skia/samplecode/SampleQuadStroker.cpp b/chromium/third_party/skia/samplecode/SampleQuadStroker.cpp
index bd98ad7f519..0993fbe358c 100644
--- a/chromium/third_party/skia/samplecode/SampleQuadStroker.cpp
+++ b/chromium/third_party/skia/samplecode/SampleQuadStroker.cpp
@@ -715,55 +715,55 @@ protected:
};
Sample::Click* onFindClickHandler(SkScalar x, SkScalar y, skui::ModifierKey modi) override {
- for (size_t i = 0; i < SK_ARRAY_COUNT(fPts); ++i) {
+ for (size_t i = 0; i < std::size(fPts); ++i) {
if (hittest(fPts[i], x, y)) {
return new MyClick((int)i);
}
}
const SkRect& rectPt = SkRect::MakeXYWH(x, y, 1, 1);
if (fWeightControl.contains(rectPt)) {
- return new MyClick((int) SK_ARRAY_COUNT(fPts) + 1);
+ return new MyClick((int) std::size(fPts) + 1);
}
if (fRadiusControl.contains(rectPt)) {
- return new MyClick((int) SK_ARRAY_COUNT(fPts) + 2);
+ return new MyClick((int) std::size(fPts) + 2);
}
#ifdef SK_DEBUG
if (fErrorControl.contains(rectPt)) {
- return new MyClick((int) SK_ARRAY_COUNT(fPts) + 3);
+ return new MyClick((int) std::size(fPts) + 3);
}
#endif
if (fWidthControl.contains(rectPt)) {
- return new MyClick((int) SK_ARRAY_COUNT(fPts) + 4);
+ return new MyClick((int) std::size(fPts) + 4);
}
if (fCubicButton.fBounds.contains(rectPt)) {
fCubicButton.fEnabled ^= true;
- return new MyClick((int) SK_ARRAY_COUNT(fPts) + 5);
+ return new MyClick((int) std::size(fPts) + 5);
}
if (fConicButton.fBounds.contains(rectPt)) {
fConicButton.fEnabled ^= true;
- return new MyClick((int) SK_ARRAY_COUNT(fPts) + 6);
+ return new MyClick((int) std::size(fPts) + 6);
}
if (fQuadButton.fBounds.contains(rectPt)) {
fQuadButton.fEnabled ^= true;
- return new MyClick((int) SK_ARRAY_COUNT(fPts) + 7);
+ return new MyClick((int) std::size(fPts) + 7);
}
if (fArcButton.fBounds.contains(rectPt)) {
fArcButton.fEnabled ^= true;
- return new MyClick((int) SK_ARRAY_COUNT(fPts) + 8);
+ return new MyClick((int) std::size(fPts) + 8);
}
if (fRRectButton.fBounds.contains(rectPt)) {
fRRectButton.fEnabled ^= true;
- return new MyClick((int) SK_ARRAY_COUNT(fPts) + 9);
+ return new MyClick((int) std::size(fPts) + 9);
}
if (fCircleButton.fBounds.contains(rectPt)) {
bool wasEnabled = fCircleButton.fEnabled;
fCircleButton.fEnabled = !fCircleButton.fFill;
fCircleButton.fFill = wasEnabled && !fCircleButton.fFill;
- return new MyClick((int) SK_ARRAY_COUNT(fPts) + 10);
+ return new MyClick((int) std::size(fPts) + 10);
}
if (fTextButton.fBounds.contains(rectPt)) {
fTextButton.fEnabled ^= true;
- return new MyClick((int) SK_ARRAY_COUNT(fPts) + 11);
+ return new MyClick((int) std::size(fPts) + 11);
}
return nullptr;
}
@@ -775,22 +775,22 @@ protected:
bool onClick(Click* click) override {
int index = ((MyClick*)click)->fIndex;
- if (index < (int) SK_ARRAY_COUNT(fPts)) {
+ if (index < (int) std::size(fPts)) {
fPts[index].offset(click->fCurr.fX - click->fPrev.fX,
click->fCurr.fY - click->fPrev.fY);
- } else if (index == (int) SK_ARRAY_COUNT(fPts) + 1) {
+ } else if (index == (int) std::size(fPts) + 1) {
fWeight = MapScreenYtoValue(click->fCurr.fY, fWeightControl, 0, 5);
- } else if (index == (int) SK_ARRAY_COUNT(fPts) + 2) {
+ } else if (index == (int) std::size(fPts) + 2) {
fRadius = MapScreenYtoValue(click->fCurr.fY, fRadiusControl, 0, 500);
}
#ifdef SK_DEBUG
- else if (index == (int) SK_ARRAY_COUNT(fPts) + 3) {
+ else if (index == (int) std::size(fPts) + 3) {
gDebugStrokerError = std::max(FLT_EPSILON, MapScreenYtoValue(click->fCurr.fY,
fErrorControl, kStrokerErrorMin, kStrokerErrorMax));
gDebugStrokerErrorSet = true;
}
#endif
- else if (index == (int) SK_ARRAY_COUNT(fPts) + 4) {
+ else if (index == (int) std::size(fPts) + 4) {
fWidth = std::max(FLT_EPSILON, MapScreenYtoValue(click->fCurr.fY, fWidthControl,
kWidthMin, kWidthMax));
fAnimate = fWidth <= kWidthMin;
diff --git a/chromium/third_party/skia/samplecode/SampleSBIX.cpp b/chromium/third_party/skia/samplecode/SampleSBIX.cpp
index 21bf2d040af..2486b92c767 100644
--- a/chromium/third_party/skia/samplecode/SampleSBIX.cpp
+++ b/chromium/third_party/skia/samplecode/SampleSBIX.cpp
@@ -334,7 +334,7 @@ struct SBIXView : public Sample {
canvas->drawPoint(advance, 0, paint);
paint.setStrokeWidth(SkIntToScalar(kPointSize));
- canvas->drawPoints(SkCanvas::kPoints_PointMode, SK_ARRAY_COUNT(fPts), fPts, paint);
+ canvas->drawPoints(SkCanvas::kPoints_PointMode, std::size(fPts), fPts, paint);
canvas->translate(kFontSize, 0);
}
@@ -353,7 +353,7 @@ struct SBIXView : public Sample {
Sample::Click* onFindClickHandler(SkScalar x, SkScalar y, skui::ModifierKey modi) override {
x -= DX;
y -= DY;
- for (size_t i = 0; i < SK_ARRAY_COUNT(fPts); i++) {
+ for (size_t i = 0; i < std::size(fPts); i++) {
if (hittest(fPts[i], x, y)) {
return new PtClick((int)i);
}
diff --git a/chromium/third_party/skia/samplecode/SampleSlides.cpp b/chromium/third_party/skia/samplecode/SampleSlides.cpp
index a17a67405df..11bea6d9ca7 100644
--- a/chromium/third_party/skia/samplecode/SampleSlides.cpp
+++ b/chromium/third_party/skia/samplecode/SampleSlides.cpp
@@ -56,7 +56,7 @@ static void stroke_pe(SkPaint* paint) {
static void dash_pe(SkPaint* paint) {
SkScalar inter[] = { 20, 10, 10, 10 };
paint->setStrokeWidth(12);
- paint->setPathEffect(SkDashPathEffect::Make(inter, SK_ARRAY_COUNT(inter), 0));
+ paint->setPathEffect(SkDashPathEffect::Make(inter, std::size(inter), 0));
compose_pe(paint);
}
@@ -73,7 +73,7 @@ static void scale(SkPath* path, SkScalar scale) {
static void one_d_pe(SkPaint* paint) {
SkPath path;
path.moveTo(SkIntToScalar(gXY[0]), SkIntToScalar(gXY[1]));
- for (unsigned i = 2; i < SK_ARRAY_COUNT(gXY); i += 2)
+ for (unsigned i = 2; i < std::size(gXY); i += 2)
path.lineTo(SkIntToScalar(gXY[i]), SkIntToScalar(gXY[i+1]));
path.close();
path.offset(SkIntToScalar(-6), 0);
@@ -126,7 +126,7 @@ static void patheffect_slide(SkCanvas* canvas) {
size_t i;
canvas->save();
- for (i = 0; i < SK_ARRAY_COUNT(gPE); i++) {
+ for (i = 0; i < std::size(gPE); i++) {
gPE[i](&paint);
canvas->drawPath(path, paint);
canvas->translate(0, 75);
@@ -140,7 +140,7 @@ static void patheffect_slide(SkCanvas* canvas) {
path.addRect(r, SkPathDirection::kCCW);
canvas->translate(320, 20);
- for (i = 0; i < SK_ARRAY_COUNT(gPE2); i++) {
+ for (i = 0; i < std::size(gPE2); i++) {
gPE2[i](&paint);
canvas->drawPath(path, paint);
canvas->translate(0, 160);
@@ -221,9 +221,9 @@ static void gradient_slide(SkCanvas* canvas) {
paint.setDither(true);
canvas->translate(SkIntToScalar(20), SkIntToScalar(10));
- for (size_t i = 0; i < SK_ARRAY_COUNT(gGradData); i++) {
+ for (size_t i = 0; i < std::size(gGradData); i++) {
canvas->save();
- for (size_t j = 0; j < SK_ARRAY_COUNT(gGradMakers); j++) {
+ for (size_t j = 0; j < std::size(gGradMakers); j++) {
paint.setShader(gGradMakers[j](pts, gGradData[i], tm));
canvas->drawRect(r, paint);
canvas->translate(0, SkIntToScalar(120));
@@ -253,7 +253,7 @@ static sk_sp<SkShader> make_shader1(const SkIPoint& size) {
{ SkIntToScalar(size.fX), SkIntToScalar(size.fY) } };
SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorRED };
return SkGradientShader::MakeLinear(pts, colors, nullptr,
- SK_ARRAY_COUNT(colors), SkTileMode::kMirror);
+ std::size(colors), SkTileMode::kMirror);
}
class Rec {
@@ -363,7 +363,7 @@ static void mesh_slide(SkCanvas* canvas) {
SkPaint paint;
paint.setDither(true);
- for (size_t i = 0; i < SK_ARRAY_COUNT(fRecs); i++) {
+ for (size_t i = 0; i < std::size(fRecs); i++) {
auto verts = SkVertices::MakeCopy(fRecs[i].fMode, fRecs[i].fCount,
fRecs[i].fVerts, fRecs[i].fTexs, nullptr);
canvas->save();
@@ -421,7 +421,7 @@ public:
SkCanvas canvas(bm);
SkScalar s = SkIntToScalar(1024) / 640;
canvas.scale(s, s);
- for (size_t i = 0; i < SK_ARRAY_COUNT(gProc); i++) {
+ for (size_t i = 0; i < std::size(gProc); i++) {
canvas.save();
canvas.drawColor(BG_COLOR);
gProc[i](&canvas);
@@ -443,7 +443,7 @@ protected:
Sample::Click* onFindClickHandler(SkScalar x, SkScalar y, skui::ModifierKey) override {
this->init();
- fIndex = (fIndex + 1) % SK_ARRAY_COUNT(gProc);
+ fIndex = (fIndex + 1) % std::size(gProc);
return nullptr;
}
diff --git a/chromium/third_party/skia/samplecode/SampleStrokePath.cpp b/chromium/third_party/skia/samplecode/SampleStrokePath.cpp
index 5feb87cb5a4..c7c69184a4f 100644
--- a/chromium/third_party/skia/samplecode/SampleStrokePath.cpp
+++ b/chromium/third_party/skia/samplecode/SampleStrokePath.cpp
@@ -128,7 +128,7 @@ protected:
void drawSet(SkCanvas* canvas, SkPaint* paint) {
SkAutoCanvasRestore acr(canvas, true);
- for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); i++) {
+ for (size_t i = 0; i < std::size(gRec); i++) {
paint->setStyle(gRec[i].fStyle);
paint->setStrokeJoin(gRec[i].fJoin);
paint->setStrokeWidth(SkIntToScalar(gRec[i].fStrokeWidth));
diff --git a/chromium/third_party/skia/samplecode/SampleStrokeRect.cpp b/chromium/third_party/skia/samplecode/SampleStrokeRect.cpp
index d4cc4ae1191..680a84d66c6 100644
--- a/chromium/third_party/skia/samplecode/SampleStrokeRect.cpp
+++ b/chromium/third_party/skia/samplecode/SampleStrokeRect.cpp
@@ -39,11 +39,11 @@ protected:
};
canvas->translate(paint.getStrokeWidth(), paint.getStrokeWidth());
- for (size_t i = 0; i < SK_ARRAY_COUNT(gJoin); ++i) {
+ for (size_t i = 0; i < std::size(gJoin); ++i) {
paint.setStrokeJoin(gJoin[i]);
canvas->save();
- for (size_t j = 0; j < SK_ARRAY_COUNT(gSize); ++j) {
+ for (size_t j = 0; j < std::size(gSize); ++j) {
SkRect r = SkRect::MakeWH(SkIntToScalar(gSize[j].fWidth),
SkIntToScalar(gSize[j].fHeight));
canvas->drawRect(r, paint);
diff --git a/chromium/third_party/skia/samplecode/SampleTextBox.cpp b/chromium/third_party/skia/samplecode/SampleTextBox.cpp
index d929cadcccd..9f1cc5e3a92 100644
--- a/chromium/third_party/skia/samplecode/SampleTextBox.cpp
+++ b/chromium/third_party/skia/samplecode/SampleTextBox.cpp
@@ -21,7 +21,6 @@
#include "include/utils/SkRandom.h"
#include "modules/skshaper/include/SkShaper.h"
#include "src/core/SkOSFile.h"
-#include "src/shaders/SkColorShader.h"
#include "src/utils/SkUTF.h"
typedef std::unique_ptr<SkShaper> (*ShaperFactory)();
diff --git a/chromium/third_party/skia/samplecode/SampleVertices.cpp b/chromium/third_party/skia/samplecode/SampleVertices.cpp
index d2c7fea54b7..5797a0ce955 100644
--- a/chromium/third_party/skia/samplecode/SampleVertices.cpp
+++ b/chromium/third_party/skia/samplecode/SampleVertices.cpp
@@ -43,7 +43,7 @@ static sk_sp<SkShader> make_shader1(const SkIPoint& size) {
{ SkIntToScalar(size.fX), SkIntToScalar(size.fY) } };
SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorRED };
return SkGradientShader::MakeLinear(pts, colors, nullptr,
- SK_ARRAY_COUNT(colors), SkTileMode::kMirror);
+ std::size(colors), SkTileMode::kMirror);
}
class VerticesView : public Sample {
@@ -75,7 +75,7 @@ protected:
SkPaint paint;
paint.setDither(true);
- for (size_t i = 0; i < SK_ARRAY_COUNT(fRecs); i++) {
+ for (size_t i = 0; i < std::size(fRecs); i++) {
auto verts = SkVertices::MakeCopy(fRecs[i].fMode, fRecs[i].fCount,
fRecs[i].fVerts, fRecs[i].fTexs,
nullptr);
diff --git a/chromium/third_party/skia/samplecode/SampleXfer.cpp b/chromium/third_party/skia/samplecode/SampleXfer.cpp
index 0d57cf4393c..e15d90cf194 100644
--- a/chromium/third_party/skia/samplecode/SampleXfer.cpp
+++ b/chromium/third_party/skia/samplecode/SampleXfer.cpp
@@ -28,7 +28,7 @@ const SkBlendMode gModes[] = {
SkBlendMode::kDstOut,
SkBlendMode::kDstATop,
};
-const int N_Modes = SK_ARRAY_COUNT(gModes);
+const int N_Modes = std::size(gModes);
static SkRandom gRand;
diff --git a/chromium/third_party/skia/samplecode/SampleXfermodesBlur.cpp b/chromium/third_party/skia/samplecode/SampleXfermodesBlur.cpp
index bd603d59a4c..5a5a1e82f73 100644
--- a/chromium/third_party/skia/samplecode/SampleXfermodesBlur.cpp
+++ b/chromium/third_party/skia/samplecode/SampleXfermodesBlur.cpp
@@ -109,7 +109,7 @@ protected:
SkScalar x0 = 0;
for (int twice = 0; twice < 2; twice++) {
SkScalar x = x0, y = 0;
- for (size_t i = 0; i < SK_ARRAY_COUNT(gModes); i++) {
+ for (size_t i = 0; i < std::size(gModes); i++) {
SkRect r;
r.setLTRB(x, y, x+w, y+h);
diff --git a/chromium/third_party/skia/site/about/_index.html b/chromium/third_party/skia/site/about/_index.html
index 69b50b233be..9b4501c4a66 100644
--- a/chromium/third_party/skia/site/about/_index.html
+++ b/chromium/third_party/skia/site/about/_index.html
@@ -24,7 +24,7 @@ menu:
{{< blocks/feature icon="fa-lightbulb" title="Supported Platforms" >}}
<p class=h4>
Windows 7, 8, 8.1, 10<br>
- macOS 10.10.5 or later<br>
+ macOS 10.13 or later<br>
iOS 11 or later<br>
Android 4.1 (JellyBean) or later<br>
Ubuntu 18.04+, Debian 10+, openSUSE 15.2+, or Fedora Linux 32+
diff --git a/chromium/third_party/skia/site/docs/dev/contrib/bazel.md b/chromium/third_party/skia/site/docs/dev/contrib/bazel.md
index 254380a2775..8a7dd662e54 100644
--- a/chromium/third_party/skia/site/docs/dev/contrib/bazel.md
+++ b/chromium/third_party/skia/site/docs/dev/contrib/bazel.md
@@ -32,38 +32,42 @@ third_party deps using `./tools/git-sync-deps`.
### Linux Hosts (you are running Bazel on a Linux machine)
You can run a command like:
```
-bazel build //example:hello_world_gl --config=clang_linux
+bazel build //example:hello_world_gl
```
-This uses the `clang_linux` configuration (defined in `//.bazelrc`), which is a hermetic C++
-toolchain we put together to compile Skia on a Linux host (implementation is in `//toolchain`.
-It builds the _target_ defined in `//examples/BUILD.bazel` named "hello_world_gl", which uses
-the `sk_app` framework we designed to make simple applications using Skia.
+This uses a hermetic C++ toolchain we put together to compile Skia on a Linux host
+(implementation is in `//toolchain`. It builds the _target_ defined in
+`//examples/BUILD.bazel` named "hello_world_gl", which uses the `sk_app` framework
+we designed to make simple applications using Skia.
Bazel will put this executable in `//bazel-bin/example/hello_world_gl` and tell you it did so in
the logs. You can run this executable yourself, or have Bazel run it by modifying the command to
be:
```
-bazel run //example:hello_world_gl --config=clang_linux
+bazel run //example:hello_world_gl
```
If you want to pass one or more flags to `bazel run`, add them on the end after a `--` like:
```
-bazel run //example:hello_world_gl --config=clang_linux -- --flag_one=apple --flag_two=cherry
+bazel run //example:hello_world_gl -- --flag_one=apple --flag_two=cherry
```
### Mac Hosts (you are running Bazel on a Mac machine)
You can run a command like:
```
-bazel build //example:bazel_test_exe --config=clang_mac
+bazel build //example:bazel_test_exe
```
-Similar to the Linux guide, this uses the `clang_mac` configuration (defined in `//.bazelrc`).
-
When building for Mac, we require the user to have Xcode installed on their device so that we can
-use system headers and Mac-specific includes when compiling. Our Bazel toolchain assumes you have
-`xcode-select` in your path so that we may symlink the user's current Xcode directory in the
-toolchain's cache. Make sure `xcode-select -p` returns a valid path.
+use system headers and Mac-specific includes when compiling. Googlers, as per usual, follow the
+instructions at [go/skia-corp-xcode](http://go/skia-corp-xcode) to install Xcode.
+
+Our Bazel toolchain assumes you have `xcode-select` in your path so that we may symlink the
+user's current Xcode directory in the toolchain's cache. Make sure `xcode-select -p`
+returns a valid path.
+
+Your Xcode path should resemble `/Applications/Xcode.app/Contents/Developer/`. Either move your
+Xcode or use `xcode-select` to use the Xcode in this location.
## .bazelrc Tips
You should make a [.bazelrc file](https://bazel.build/docs/bazelrc) in your home directory where
diff --git a/chromium/third_party/skia/site/docs/dev/contrib/style.md b/chromium/third_party/skia/site/docs/dev/contrib/style.md
index 4daaa6ae465..8fd85fd1647 100644
--- a/chromium/third_party/skia/site/docs/dev/contrib/style.md
+++ b/chromium/third_party/skia/site/docs/dev/contrib/style.md
@@ -389,17 +389,19 @@ private:
};
```
-Constructor initializers should be one per line, indented, with punctuation
-placed before the initializer.
+Constructor initializers should be placed on the same line as the constructor,
+if they fit. Otherwise, each initializer should be on its own line, indented,
+with punctuation placed before the initializer.
<!--?prettify?-->
```
-GrDillPickle::GrDillPickle()
- : GrPickle()
- , fSize(kDefaultPickleSize) {
- ...
-}
+GrDillPickle::GrDillPickle() : GrPickle(), fSize(kDefaultPickleSize) {}
+
+GrDillPickle::GrDillPickle(float size, float crunchiness, const PickleOptions* options)
+ : GrPickle(options)
+ , fSize(size)
+ , fCrunchiness(crunchiness) {}
```
Constructors that take one argument should almost always be explicit, with
diff --git a/chromium/third_party/skia/site/docs/dev/contrib/submit.md b/chromium/third_party/skia/site/docs/dev/contrib/submit.md
index 9250a554d35..14b8f92b28a 100644
--- a/chromium/third_party/skia/site/docs/dev/contrib/submit.md
+++ b/chromium/third_party/skia/site/docs/dev/contrib/submit.md
@@ -98,8 +98,8 @@ Google account. It does not have to match the email address you configured using
`git config --global user.email` above, but it can.
The command output should include a URL, similar to
-(https://skia-review.googlesource.com/c/4559/), indicating where your changelist
-can be reviewed.
+([https://skia-review.googlesource.com/c/4559/](https://skia-review.googlesource.com/c/4559/)),
+indicating where your changelist can be reviewed.
### Submit try jobs
diff --git a/chromium/third_party/skia/site/docs/dev/gardening/_index.md b/chromium/third_party/skia/site/docs/dev/gardening/_index.md
index f6f5716deda..cd9bbb1167e 100644
--- a/chromium/third_party/skia/site/docs/dev/gardening/_index.md
+++ b/chromium/third_party/skia/site/docs/dev/gardening/_index.md
@@ -67,12 +67,13 @@ Below is a brief summary of what the gardener does for each task:
### Triage
-You should triage Chromium and Skia bugs that show up under "Untriaged Bugs" on
+You should triage Chromium, Skia, and OSS-fuzz bugs that show up under "Untriaged Bugs" on
the [status page](https://status.skia.org). The Android Gardener will triage the
-untriaged Android Bugs. The GPU Gardener will triage the untriaged OSS-Fuzz
-Bugs. For a more detailed view of bugs see
+untriaged Android Bugs. For a more detailed view of bugs see
[Skia Bugs Central](https://bugs-central.skia.org/).
+To access the oss-fuzz bugs, see [go/skia-fuzz](http://go/skia-fuzz).
+
<a name="blamer"></a>
### Blamer
diff --git a/chromium/third_party/skia/site/docs/dev/tools/tracing.md b/chromium/third_party/skia/site/docs/dev/tools/tracing.md
index 3d20a9394c2..cbb38491fae 100644
--- a/chromium/third_party/skia/site/docs/dev/tools/tracing.md
+++ b/chromium/third_party/skia/site/docs/dev/tools/tracing.md
@@ -87,6 +87,44 @@ For simple situations, all tracing events can be directed to the console with `-
...
~~~
+Tracing with Perfetto
+--------------
+Running any tool with `--trace perfetto` will cause the application to forward
+tracing information to [Perfetto](https://perfetto.dev/docs/instrumentation/track-events).
+Perfetto only supports Linux, Mac, and Android and will not run on other platforms.
+
+By default, Perfetto tracing within Skia has been configured to handle relatively short
+(~10 seconds or less) trace events and sessions (for example, a subset of tests rather than the
+entire testing suite). For any tracing sessions longer than ~10 seconds, it is recommended to use the `--longPerfettoTrace` runtime option which will change Skia's Perfetto configuration to accommodate
+the longer trace. Long traces conducted without this runtime option run the risk of overwriting
+events, leading to a loss of data.
+
+The trace output file path can be changed with runtime arguments. `--perfettoOutputDir` sets the
+output directory, `--perfettoOutputFileName` sets the output file name (without file extension),
+and `--perfettoOutputFileExtension` sets the output file extension. By default, the trace file will
+be placed in the build output directory as `trace.perfetto-trace`.
+
+You can also elect to generate different trace files for each nanobench benchmark. To do so, use
+the
+`--splitPerfettoTracesByBenchmark` option. Note that this will lead to the output files being
+named after the different benchmarks.
+
+These trace files can be visualized using
+[Perfetto's web visualization tool](https://ui.perfetto.dev/). To visualize larger trace files
+(anything greater than around 2 GB), see
+[these instructions](https://perfetto.dev/docs/visualization/large-traces).
+
+Should you run into any issues or unexpected results, Perfetto has some resources which may help.
+To identify potential root causes, check the "Info and stats" page on the web visualization tool, or
+by running SQL queries on the trace file (online, or by using
+[the trace processor application](https://perfetto.dev/docs/analysis/trace-processor)).
+To diagnose these issues, see
+[this section](https://perfetto.dev/docs/concepts/buffers#debugging-data-losses)
+on debugging data losses and
+[this section](https://perfetto.dev/docs/concepts/buffers#flushes-and-windowed-trace-importing)
+on out-of-order events which may appear unexpectedly long.
+
+
Adding More Trace Events
------------------------
diff --git a/chromium/third_party/skia/site/docs/user/api/skcanvas_creation.md b/chromium/third_party/skia/site/docs/user/api/skcanvas_creation.md
index ff182b2564d..7ffcac1e50b 100644
--- a/chromium/third_party/skia/site/docs/user/api/skcanvas_creation.md
+++ b/chromium/third_party/skia/site/docs/user/api/skcanvas_creation.md
@@ -36,7 +36,7 @@ canvas commands are drawn.
draw(rasterCanvas);
sk_sp<SkImage> img(rasterSurface->makeImageSnapshot());
if (!img) { return; }
- sk_sp<SkData> png(img->encode());
+ sk_sp<SkData> png(img->encodeToData());
if (!png) { return; }
SkFILEWStream out(path);
(void)out.write(png->data(), png->size());
@@ -86,15 +86,15 @@ current thread when Skia calls are made.
void gl_example(int width, int height, void (*draw)(SkCanvas*), const char* path) {
// You've already created your OpenGL context and bound it.
- const GrGLInterface* interface = nullptr;
+ sk_sp<const GrGLInterface> interface = nullptr;
// Leaving interface as null makes Skia extract pointers to OpenGL functions for the current
// context in a platform-specific way. Alternatively, you may create your own GrGLInterface and
// initialize it however you like to attach to an alternate OpenGL implementation or intercept
// Skia's OpenGL calls.
- sk_sp<GrContext> context = GrContext::MakeGL(interface);
+ sk_sp<GrDirectContext> context = GrDirectContext::MakeGL(interface);
SkImageInfo info = SkImageInfo:: MakeN32Premul(width, height);
sk_sp<SkSurface> gpuSurface(
- SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info));
+ SkSurface::MakeRenderTarget(context.get(), SkBudgeted::kNo, info));
if (!gpuSurface) {
SkDebugf("SkSurface::MakeRenderTarget returned null\n");
return;
@@ -103,7 +103,7 @@ current thread when Skia calls are made.
draw(gpuCanvas);
sk_sp<SkImage> img(gpuSurface->makeImageSnapshot());
if (!img) { return; }
- sk_sp<SkData> png(img->encode());
+ sk_sp<SkData> png(img->encodeToData());
if (!png) { return; }
SkFILEWStream out(path);
(void)out.write(png->data(), png->size());
diff --git a/chromium/third_party/skia/site/docs/user/build.md b/chromium/third_party/skia/site/docs/user/build.md
index 9a0054d1104..76730412c45 100644
--- a/chromium/third_party/skia/site/docs/user/build.md
+++ b/chromium/third_party/skia/site/docs/user/build.md
@@ -123,9 +123,10 @@ If you do not have an NDK and have access to CIPD, you can use one of these
commands to fetch the NDK our bots use:
```
-./bin/sk asset download android_ndk_linux /tmp/ndk
-./bin/sk asset download android_ndk_darwin /tmp/ndk
-./bin/sk.exe asset download android_ndk_windows C:/ndk
+./bin/fetch-sk
+./bin/sk asset download android_ndk_linux /tmp/ndk # on Linux
+./bin/sk asset download android_ndk_darwin /tmp/ndk # on Mac
+./bin/sk.exe asset download android_ndk_windows C:/ndk # on Windows
```
When generating your GN build files, pass the path to your `ndk` and your
@@ -255,6 +256,9 @@ sudo mount -i -o remount,exec /home/chronos
Mac users may want to pass `--ide=xcode` to `bin/gn gen` to generate an Xcode
project.
+Googlers should see [go/skia-corp-xcode](http://go/skia-corp-xcode) for
+instructions on setting up Xcode on a corp machine.
+
## iOS
Run GN to generate your build files. Set `target_os="ios"` to build for iOS.
diff --git a/chromium/third_party/skia/src/BUILD.bazel b/chromium/third_party/skia/src/BUILD.bazel
index 2ab84b2b3fb..e931f7a6b1f 100644
--- a/chromium/third_party/skia/src/BUILD.bazel
+++ b/chromium/third_party/skia/src/BUILD.bazel
@@ -1,4 +1,4 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy")
+load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_deps")
licenses(["notice"])
@@ -18,15 +18,27 @@ filegroup(
"//src/ports:srcs",
"//src/sfnt:srcs",
"//src/shaders:srcs",
+ "//src/text:srcs",
"//src/utils:srcs",
] + select({
- "//bazel/common_config_settings:has_gpu_backend": [
+ "//src/gpu:has_gpu_backend": [
"//src/gpu:srcs",
"//src/text/gpu:srcs",
],
"//conditions:default": [],
}) + select({
- "//bazel/common_config_settings:needs_sksl": ["//src/sksl:srcs"],
+ "//src/sksl:needs_sksl": ["//src/sksl:srcs"],
+ "//conditions:default": [],
+ }) + select({
+ "//src/svg:enable_svg_canvas_true": [
+ "//src/svg:srcs",
+ "//src/xml:srcs",
+ ],
+ "//conditions:default": [],
+ }) + select({
+ "//src/pdf:enable_pdf_backend_true": [
+ "//src/pdf:srcs",
+ ],
"//conditions:default": [],
}),
visibility = ["//:__pkg__"],
@@ -45,33 +57,55 @@ filegroup(
"//src/ports:private_hdrs",
"//src/sfnt:private_hdrs",
"//src/shaders:private_hdrs",
+ "//src/text:private_hdrs",
"//src/utils:private_hdrs",
] + select({
- "//bazel/common_config_settings:has_gpu_backend": [
+ "//src/gpu:has_gpu_backend": [
"//src/gpu:private_hdrs",
"//src/text/gpu:private_hdrs",
],
"//conditions:default": [],
}) + select({
- "//bazel/common_config_settings:needs_sksl": ["//src/sksl:private_hdrs"],
+ "//src/sksl:needs_sksl": ["//src/sksl:private_hdrs"],
+ "//conditions:default": [],
+ }) + select({
+ "//src/svg:enable_svg_canvas_true": [
+ "//src/svg:private_hdrs",
+ "//src/xml:private_hdrs",
+ ],
+ "//conditions:default": [],
+ }) + select({
+ "//src/pdf:enable_pdf_backend_true": [
+ "//src/pdf:private_hdrs",
+ ],
"//conditions:default": [],
}),
visibility = ["//:__pkg__"],
)
-cc_library(
+skia_cc_deps(
name = "deps",
visibility = ["//:__pkg__"],
deps = [
"//src/codec:deps",
"//src/images:deps",
"//src/ports:deps",
- "//third_party/skcms:skcms",
+ "//modules/skcms:skcms",
] + select({
- "//bazel/common_config_settings:has_gpu_backend": ["//src/gpu:deps"],
+ "//src/gpu:has_gpu_backend": ["//src/gpu:deps"],
+ "//conditions:default": [],
+ }) + select({
+ "//src/sksl:needs_sksl": ["//src/sksl:deps"],
"//conditions:default": [],
}) + select({
- "//bazel/common_config_settings:needs_sksl": ["//src/sksl:deps"],
+ "//src/svg:enable_svg_canvas_true": [
+ "//src/xml:deps",
+ ],
+ "//conditions:default": [],
+ }) + select({
+ "//src/pdf:enable_pdf_backend_true": [
+ "//src/pdf:deps",
+ ],
"//conditions:default": [],
}),
)
diff --git a/chromium/third_party/skia/src/c/BUILD.bazel b/chromium/third_party/skia/src/c/BUILD.bazel
deleted file mode 100644
index 69666adff23..00000000000
--- a/chromium/third_party/skia/src/c/BUILD.bazel
+++ /dev/null
@@ -1,5 +0,0 @@
-load("//bazel:macros.bzl", "exports_files_legacy")
-
-licenses(["notice"])
-
-exports_files_legacy()
diff --git a/chromium/third_party/skia/src/c/sk_c_from_to.h b/chromium/third_party/skia/src/c/sk_c_from_to.h
deleted file mode 100644
index 19fda37a261..00000000000
--- a/chromium/third_party/skia/src/c/sk_c_from_to.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-static bool find_sk(CType from, SKType* to) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(CTypeSkTypeMap); ++i) {
- if (CTypeSkTypeMap[i].fC == from) {
- if (to) {
- *to = CTypeSkTypeMap[i].fSK;
- }
- return true;
- }
- }
- return false;
-}
-
-static bool find_c(SKType from, CType* to) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(CTypeSkTypeMap); ++i) {
- if (CTypeSkTypeMap[i].fSK == from) {
- if (to) {
- *to = CTypeSkTypeMap[i].fC;
- }
- return true;
- }
- }
- return false;
-}
-
-#undef CType
-#undef SKType
-#undef CTypeSkTypeMap
diff --git a/chromium/third_party/skia/src/c/sk_effects.cpp b/chromium/third_party/skia/src/c/sk_effects.cpp
deleted file mode 100644
index 7e226cd756c..00000000000
--- a/chromium/third_party/skia/src/c/sk_effects.cpp
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright 2017 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "include/core/SkMatrix.h"
-#include "src/c/sk_types_priv.h"
-
-static void from_c_matrix(const sk_matrix_t* cmatrix, SkMatrix* matrix) {
- matrix->setAll(cmatrix->mat[0], cmatrix->mat[1], cmatrix->mat[2],
- cmatrix->mat[3], cmatrix->mat[4], cmatrix->mat[5],
- cmatrix->mat[6], cmatrix->mat[7], cmatrix->mat[8]);
-}
-
-#include "include/c/sk_shader.h"
-#include "include/effects/SkGradientShader.h"
-
-const struct {
- sk_shader_tilemode_t fC;
- SkTileMode fSK;
-} gTileModeMap[] = {
- { CLAMP_SK_SHADER_TILEMODE, SkTileMode::kClamp },
- { REPEAT_SK_SHADER_TILEMODE, SkTileMode::kRepeat },
- { MIRROR_SK_SHADER_TILEMODE, SkTileMode::kMirror },
-};
-
-static bool from_c_tilemode(sk_shader_tilemode_t cMode, SkTileMode* skMode) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(gTileModeMap); ++i) {
- if (cMode == gTileModeMap[i].fC) {
- if (skMode) {
- *skMode = gTileModeMap[i].fSK;
- }
- return true;
- }
- }
- return false;
-}
-
-void sk_shader_ref(sk_shader_t* cshader) {
- SkSafeRef(AsShader(cshader));
-}
-
-void sk_shader_unref(sk_shader_t* cshader) {
- SkSafeUnref(AsShader(cshader));
-}
-
-sk_shader_t* sk_shader_new_linear_gradient(const sk_point_t pts[2],
- const sk_color_t colors[],
- const float colorPos[],
- int colorCount,
- sk_shader_tilemode_t cmode,
- const sk_matrix_t* cmatrix) {
- SkTileMode mode;
- if (!from_c_tilemode(cmode, &mode)) {
- return nullptr;
- }
- SkMatrix matrix;
- if (cmatrix) {
- from_c_matrix(cmatrix, &matrix);
- } else {
- matrix.setIdentity();
- }
- return (sk_shader_t*)SkGradientShader::MakeLinear(reinterpret_cast<const SkPoint*>(pts),
- reinterpret_cast<const SkColor*>(colors),
- colorPos, colorCount,
- mode, 0, &matrix).release();
-}
-
-static const SkPoint& to_skpoint(const sk_point_t& p) {
- return reinterpret_cast<const SkPoint&>(p);
-}
-
-sk_shader_t* sk_shader_new_radial_gradient(const sk_point_t* ccenter,
- float radius,
- const sk_color_t colors[],
- const float colorPos[],
- int colorCount,
- sk_shader_tilemode_t cmode,
- const sk_matrix_t* cmatrix) {
- SkTileMode mode;
- if (!from_c_tilemode(cmode, &mode)) {
- return nullptr;
- }
- SkMatrix matrix;
- if (cmatrix) {
- from_c_matrix(cmatrix, &matrix);
- } else {
- matrix.setIdentity();
- }
- SkPoint center = to_skpoint(*ccenter);
- return (sk_shader_t*)SkGradientShader::MakeRadial(center, (SkScalar)radius,
- reinterpret_cast<const SkColor*>(colors),
- reinterpret_cast<const SkScalar*>(colorPos),
- colorCount, mode, 0, &matrix).release();
-}
-
-sk_shader_t* sk_shader_new_sweep_gradient(const sk_point_t* ccenter,
- const sk_color_t colors[],
- const float colorPos[],
- int colorCount,
- const sk_matrix_t* cmatrix) {
- SkMatrix matrix;
- if (cmatrix) {
- from_c_matrix(cmatrix, &matrix);
- } else {
- matrix.setIdentity();
- }
- return (sk_shader_t*)SkGradientShader::MakeSweep((SkScalar)(ccenter->x),
- (SkScalar)(ccenter->y),
- reinterpret_cast<const SkColor*>(colors),
- reinterpret_cast<const SkScalar*>(colorPos),
- colorCount, 0, &matrix).release();
-}
-
-sk_shader_t* sk_shader_new_two_point_conical_gradient(const sk_point_t* start,
- float startRadius,
- const sk_point_t* end,
- float endRadius,
- const sk_color_t colors[],
- const float colorPos[],
- int colorCount,
- sk_shader_tilemode_t cmode,
- const sk_matrix_t* cmatrix) {
- SkTileMode mode;
- if (!from_c_tilemode(cmode, &mode)) {
- return nullptr;
- }
- SkMatrix matrix;
- if (cmatrix) {
- from_c_matrix(cmatrix, &matrix);
- } else {
- matrix.setIdentity();
- }
- SkPoint skstart = to_skpoint(*start);
- SkPoint skend = to_skpoint(*end);
- return (sk_shader_t*)SkGradientShader::MakeTwoPointConical(skstart, (SkScalar)startRadius,
- skend, (SkScalar)endRadius,
- reinterpret_cast<const SkColor*>(colors),
- reinterpret_cast<const SkScalar*>(colorPos),
- colorCount, mode, 0, &matrix).release();
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-#include "include/c/sk_maskfilter.h"
-#include "include/core/SkMaskFilter.h"
-
-const struct {
- sk_blurstyle_t fC;
- SkBlurStyle fSk;
-} gBlurStylePairs[] = {
- { NORMAL_SK_BLUR_STYLE, kNormal_SkBlurStyle },
- { SOLID_SK_BLUR_STYLE, kSolid_SkBlurStyle },
- { OUTER_SK_BLUR_STYLE, kOuter_SkBlurStyle },
- { INNER_SK_BLUR_STYLE, kInner_SkBlurStyle },
-};
-
-static bool find_blurstyle(sk_blurstyle_t csrc, SkBlurStyle* dst) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(gBlurStylePairs); ++i) {
- if (gBlurStylePairs[i].fC == csrc) {
- if (dst) {
- *dst = gBlurStylePairs[i].fSk;
- }
- return true;
- }
- }
- return false;
-}
-
-void sk_maskfilter_ref(sk_maskfilter_t* cfilter) {
- SkSafeRef(AsMaskFilter(cfilter));
-}
-
-void sk_maskfilter_unref(sk_maskfilter_t* cfilter) {
- SkSafeUnref(AsMaskFilter(cfilter));
-}
-
-sk_maskfilter_t* sk_maskfilter_new_blur(sk_blurstyle_t cstyle, float sigma) {
- SkBlurStyle style;
- if (!find_blurstyle(cstyle, &style)) {
- return nullptr;
- }
- return ToMaskFilter(SkMaskFilter::MakeBlur(style, sigma).release());
-}
diff --git a/chromium/third_party/skia/src/c/sk_imageinfo.cpp b/chromium/third_party/skia/src/c/sk_imageinfo.cpp
deleted file mode 100644
index 160c7f9ab70..00000000000
--- a/chromium/third_party/skia/src/c/sk_imageinfo.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright 2018 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "include/core/SkColorSpace.h"
-#include "include/core/SkImageInfo.h"
-
-#include "include/c/sk_colorspace.h"
-#include "include/c/sk_imageinfo.h"
-
-const struct {
- sk_colortype_t fC;
- SkColorType fSK;
-} gColorTypeMap[] = {
- { UNKNOWN_SK_COLORTYPE, kUnknown_SkColorType },
- { RGBA_8888_SK_COLORTYPE, kRGBA_8888_SkColorType },
- { BGRA_8888_SK_COLORTYPE, kBGRA_8888_SkColorType },
- { ALPHA_8_SK_COLORTYPE, kAlpha_8_SkColorType },
- { GRAY_8_SK_COLORTYPE, kGray_8_SkColorType },
- { RGBA_F16_SK_COLORTYPE, kRGBA_F16_SkColorType },
- { RGBA_F32_SK_COLORTYPE, kRGBA_F32_SkColorType },
-};
-
-const struct {
- sk_alphatype_t fC;
- SkAlphaType fSK;
-} gAlphaTypeMap[] = {
- { OPAQUE_SK_ALPHATYPE, kOpaque_SkAlphaType },
- { PREMUL_SK_ALPHATYPE, kPremul_SkAlphaType },
- { UNPREMUL_SK_ALPHATYPE, kUnpremul_SkAlphaType },
-};
-
-static bool from_c_colortype(sk_colortype_t cCT, SkColorType* skCT) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(gColorTypeMap); ++i) {
- if (gColorTypeMap[i].fC == cCT) {
- if (skCT) {
- *skCT = gColorTypeMap[i].fSK;
- }
- return true;
- }
- }
- return false;
-}
-
-static bool to_c_colortype(SkColorType skCT, sk_colortype_t* cCT) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(gColorTypeMap); ++i) {
- if (gColorTypeMap[i].fSK == skCT) {
- if (cCT) {
- *cCT = gColorTypeMap[i].fC;
- }
- return true;
- }
- }
- return false;
-}
-
-static bool from_c_alphatype(sk_alphatype_t cAT, SkAlphaType* skAT) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(gAlphaTypeMap); ++i) {
- if (gAlphaTypeMap[i].fC == cAT) {
- if (skAT) {
- *skAT = gAlphaTypeMap[i].fSK;
- }
- return true;
- }
- }
- return false;
-}
-
-static bool to_c_alphatype(SkAlphaType skAT, sk_alphatype_t* cAT) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(gAlphaTypeMap); ++i) {
- if (gAlphaTypeMap[i].fSK == skAT) {
- if (cAT) {
- *cAT = gAlphaTypeMap[i].fC;
- }
- return true;
- }
- }
- return false;
-}
-
-const SkImageInfo* ToImageInfo(const sk_imageinfo_t* cinfo) {
- return reinterpret_cast<const SkImageInfo*>(cinfo);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////
-
-sk_imageinfo_t* sk_imageinfo_new(int w, int h, sk_colortype_t cct, sk_alphatype_t cat,
- sk_colorspace_t* ccs) {
- SkColorType ct;
- SkAlphaType at;
- if (!from_c_colortype(cct, &ct) || !from_c_alphatype(cat, &at)) {
- return nullptr;
- }
- SkColorSpace* cs = (SkColorSpace*)ccs;
-
- SkImageInfo* info = new SkImageInfo(SkImageInfo::Make(w, h, ct, at, sk_ref_sp(cs)));
- return reinterpret_cast<sk_imageinfo_t*>(info);
-}
-
-void sk_imageinfo_delete(sk_imageinfo_t* cinfo) {
- delete ToImageInfo(cinfo);
-}
-
-int32_t sk_imageinfo_get_width(const sk_imageinfo_t* cinfo) {
- return ToImageInfo(cinfo)->width();
-}
-
-int32_t sk_imageinfo_get_height(const sk_imageinfo_t* cinfo) {
- return ToImageInfo(cinfo)->height();
-}
-
-sk_colortype_t sk_imageinfo_get_colortype(const sk_imageinfo_t* cinfo) {
- sk_colortype_t ct;
- return to_c_colortype(ToImageInfo(cinfo)->colorType(), &ct) ? ct : UNKNOWN_SK_COLORTYPE;
-}
-
-sk_alphatype_t sk_imageinfo_get_alphatype(const sk_imageinfo_t* cinfo) {
- sk_alphatype_t at;
- // odd that we return premul on failure...
- return to_c_alphatype(ToImageInfo(cinfo)->alphaType(), &at) ? at : PREMUL_SK_ALPHATYPE;
-}
-
-sk_colorspace_t* sk_imageinfo_get_colorspace(const sk_imageinfo_t* cinfo) {
- return reinterpret_cast<sk_colorspace_t*>(ToImageInfo(cinfo)->colorSpace());
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////
-
-sk_colorspace_t* sk_colorspace_new_srgb() {
- return reinterpret_cast<sk_colorspace_t*>(SkColorSpace::MakeSRGB().release());
-}
-
-void sk_colorspace_ref(sk_colorspace_t* cs) {
- SkSafeRef(reinterpret_cast<SkColorSpace*>(cs));
-}
-
-void sk_colorspace_unref(sk_colorspace_t* cs) {
- SkSafeUnref(reinterpret_cast<SkColorSpace*>(cs));
-}
-
diff --git a/chromium/third_party/skia/src/c/sk_paint.cpp b/chromium/third_party/skia/src/c/sk_paint.cpp
deleted file mode 100644
index 0236270b152..00000000000
--- a/chromium/third_party/skia/src/c/sk_paint.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "include/core/SkBlendMode.h"
-#include "include/core/SkMaskFilter.h"
-#include "include/core/SkPaint.h"
-#include "include/core/SkShader.h"
-
-#include "include/c/sk_paint.h"
-#include "src/c/sk_types_priv.h"
-
-#define MAKE_FROM_TO_NAME(FROM) g_ ## FROM ## _map
-
-const struct {
- sk_stroke_cap_t fC;
- SkPaint::Cap fSK;
-} MAKE_FROM_TO_NAME(sk_stroke_cap_t)[] = {
- { BUTT_SK_STROKE_CAP, SkPaint::kButt_Cap },
- { ROUND_SK_STROKE_CAP, SkPaint::kRound_Cap },
- { SQUARE_SK_STROKE_CAP, SkPaint::kSquare_Cap },
-};
-
-const struct {
- sk_stroke_join_t fC;
- SkPaint::Join fSK;
-} MAKE_FROM_TO_NAME(sk_stroke_join_t)[] = {
- { MITER_SK_STROKE_JOIN, SkPaint::kMiter_Join },
- { ROUND_SK_STROKE_JOIN, SkPaint::kRound_Join },
- { BEVEL_SK_STROKE_JOIN, SkPaint::kBevel_Join },
-};
-
-#define CType sk_stroke_cap_t
-#define SKType SkPaint::Cap
-#define CTypeSkTypeMap MAKE_FROM_TO_NAME(sk_stroke_cap_t)
-#include "src/c/sk_c_from_to.h"
-
-#define CType sk_stroke_join_t
-#define SKType SkPaint::Join
-#define CTypeSkTypeMap MAKE_FROM_TO_NAME(sk_stroke_join_t)
-#include "src/c/sk_c_from_to.h"
-
-//////////////////////////////////////////////////////////////////////////////////////////////////
-
-sk_paint_t* sk_paint_new() { return (sk_paint_t*)new SkPaint; }
-
-void sk_paint_delete(sk_paint_t* cpaint) { delete AsPaint(cpaint); }
-
-bool sk_paint_is_antialias(const sk_paint_t* cpaint) {
- return AsPaint(*cpaint).isAntiAlias();
-}
-
-void sk_paint_set_antialias(sk_paint_t* cpaint, bool aa) {
- AsPaint(cpaint)->setAntiAlias(aa);
-}
-
-sk_color_t sk_paint_get_color(const sk_paint_t* cpaint) {
- return AsPaint(*cpaint).getColor();
-}
-
-void sk_paint_set_color(sk_paint_t* cpaint, sk_color_t c) {
- AsPaint(cpaint)->setColor(c);
-}
-
-void sk_paint_set_shader(sk_paint_t* cpaint, sk_shader_t* cshader) {
- AsPaint(cpaint)->setShader(sk_ref_sp(AsShader(cshader)));
-}
-
-void sk_paint_set_maskfilter(sk_paint_t* cpaint, sk_maskfilter_t* cfilter) {
- AsPaint(cpaint)->setMaskFilter(sk_ref_sp(AsMaskFilter(cfilter)));
-}
-
-bool sk_paint_is_stroke(const sk_paint_t* cpaint) {
- return AsPaint(*cpaint).getStyle() != SkPaint::kFill_Style;
-}
-
-void sk_paint_set_stroke(sk_paint_t* cpaint, bool doStroke) {
- AsPaint(cpaint)->setStyle(doStroke ? SkPaint::kStroke_Style : SkPaint::kFill_Style);
-}
-
-float sk_paint_get_stroke_width(const sk_paint_t* cpaint) {
- return AsPaint(*cpaint).getStrokeWidth();
-}
-
-void sk_paint_set_stroke_width(sk_paint_t* cpaint, float width) {
- AsPaint(cpaint)->setStrokeWidth(width);
-}
-
-float sk_paint_get_stroke_miter(const sk_paint_t* cpaint) {
- return AsPaint(*cpaint).getStrokeMiter();
-}
-
-void sk_paint_set_stroke_miter(sk_paint_t* cpaint, float miter) {
- AsPaint(cpaint)->setStrokeMiter(miter);
-}
-
-sk_stroke_cap_t sk_paint_get_stroke_cap(const sk_paint_t* cpaint) {
- sk_stroke_cap_t ccap;
- if (find_c(AsPaint(*cpaint).getStrokeCap(), &ccap)) {
- ccap = BUTT_SK_STROKE_CAP;
- }
- return ccap;
-}
-
-void sk_paint_set_stroke_cap(sk_paint_t* cpaint, sk_stroke_cap_t ccap) {
- SkPaint::Cap skcap;
- if (find_sk(ccap, &skcap)) {
- AsPaint(cpaint)->setStrokeCap(skcap);
- } else {
- // unknown ccap
- }
-}
-
-sk_stroke_join_t sk_paint_get_stroke_join(const sk_paint_t* cpaint) {
- sk_stroke_join_t cjoin;
- if (find_c(AsPaint(*cpaint).getStrokeJoin(), &cjoin)) {
- cjoin = MITER_SK_STROKE_JOIN;
- }
- return cjoin;
-}
-
-void sk_paint_set_stroke_join(sk_paint_t* cpaint, sk_stroke_join_t cjoin) {
- SkPaint::Join skjoin;
- if (find_sk(cjoin, &skjoin)) {
- AsPaint(cpaint)->setStrokeJoin(skjoin);
- } else {
- // unknown cjoin
- }
-}
-
-void sk_paint_set_xfermode_mode(sk_paint_t* paint, sk_xfermode_mode_t mode) {
- SkASSERT(paint);
- SkBlendMode skmode;
- switch (mode) {
- #define MAP(X, Y) case (X): skmode = (Y); break
- MAP( CLEAR_SK_XFERMODE_MODE, SkBlendMode::kClear );
- MAP( SRC_SK_XFERMODE_MODE, SkBlendMode::kSrc );
- MAP( DST_SK_XFERMODE_MODE, SkBlendMode::kDst );
- MAP( SRCOVER_SK_XFERMODE_MODE, SkBlendMode::kSrcOver );
- MAP( DSTOVER_SK_XFERMODE_MODE, SkBlendMode::kDstOver );
- MAP( SRCIN_SK_XFERMODE_MODE, SkBlendMode::kSrcIn );
- MAP( DSTIN_SK_XFERMODE_MODE, SkBlendMode::kDstIn );
- MAP( SRCOUT_SK_XFERMODE_MODE, SkBlendMode::kSrcOut );
- MAP( DSTOUT_SK_XFERMODE_MODE, SkBlendMode::kDstOut );
- MAP( SRCATOP_SK_XFERMODE_MODE, SkBlendMode::kSrcATop );
- MAP( DSTATOP_SK_XFERMODE_MODE, SkBlendMode::kDstATop );
- MAP( XOR_SK_XFERMODE_MODE, SkBlendMode::kXor );
- MAP( PLUS_SK_XFERMODE_MODE, SkBlendMode::kPlus );
- MAP( MODULATE_SK_XFERMODE_MODE, SkBlendMode::kModulate );
- MAP( SCREEN_SK_XFERMODE_MODE, SkBlendMode::kScreen );
- MAP( OVERLAY_SK_XFERMODE_MODE, SkBlendMode::kOverlay );
- MAP( DARKEN_SK_XFERMODE_MODE, SkBlendMode::kDarken );
- MAP( LIGHTEN_SK_XFERMODE_MODE, SkBlendMode::kLighten );
- MAP( COLORDODGE_SK_XFERMODE_MODE, SkBlendMode::kColorDodge );
- MAP( COLORBURN_SK_XFERMODE_MODE, SkBlendMode::kColorBurn );
- MAP( HARDLIGHT_SK_XFERMODE_MODE, SkBlendMode::kHardLight );
- MAP( SOFTLIGHT_SK_XFERMODE_MODE, SkBlendMode::kSoftLight );
- MAP( DIFFERENCE_SK_XFERMODE_MODE, SkBlendMode::kDifference );
- MAP( EXCLUSION_SK_XFERMODE_MODE, SkBlendMode::kExclusion );
- MAP( MULTIPLY_SK_XFERMODE_MODE, SkBlendMode::kMultiply );
- MAP( HUE_SK_XFERMODE_MODE, SkBlendMode::kHue );
- MAP( SATURATION_SK_XFERMODE_MODE, SkBlendMode::kSaturation );
- MAP( COLOR_SK_XFERMODE_MODE, SkBlendMode::kColor );
- MAP( LUMINOSITY_SK_XFERMODE_MODE, SkBlendMode::kLuminosity );
- #undef MAP
- default:
- return;
- }
- AsPaint(paint)->setBlendMode(skmode);
-}
diff --git a/chromium/third_party/skia/src/c/sk_surface.cpp b/chromium/third_party/skia/src/c/sk_surface.cpp
deleted file mode 100644
index ca23a7d7eea..00000000000
--- a/chromium/third_party/skia/src/c/sk_surface.cpp
+++ /dev/null
@@ -1,474 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "include/core/SkCanvas.h"
-#include "include/core/SkData.h"
-#include "include/core/SkImage.h"
-#include "include/core/SkMaskFilter.h"
-#include "include/core/SkMatrix.h"
-#include "include/core/SkPaint.h"
-#include "include/core/SkPathBuilder.h"
-#include "include/core/SkPictureRecorder.h"
-#include "include/core/SkSurface.h"
-
-#include "include/c/sk_canvas.h"
-#include "include/c/sk_data.h"
-#include "include/c/sk_image.h"
-#include "include/c/sk_paint.h"
-#include "include/c/sk_path.h"
-#include "include/c/sk_picture.h"
-#include "include/c/sk_surface.h"
-#include "src/c/sk_types_priv.h"
-
-const struct {
- sk_pixelgeometry_t fC;
- SkPixelGeometry fSK;
-} gPixelGeometryMap[] = {
- { UNKNOWN_SK_PIXELGEOMETRY, kUnknown_SkPixelGeometry },
- { RGB_H_SK_PIXELGEOMETRY, kRGB_H_SkPixelGeometry },
- { BGR_H_SK_PIXELGEOMETRY, kBGR_H_SkPixelGeometry },
- { RGB_V_SK_PIXELGEOMETRY, kRGB_V_SkPixelGeometry },
- { BGR_V_SK_PIXELGEOMETRY, kBGR_V_SkPixelGeometry },
-};
-
-
-static bool from_c_pixelgeometry(sk_pixelgeometry_t cGeom, SkPixelGeometry* skGeom) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(gPixelGeometryMap); ++i) {
- if (gPixelGeometryMap[i].fC == cGeom) {
- if (skGeom) {
- *skGeom = gPixelGeometryMap[i].fSK;
- }
- return true;
- }
- }
- return false;
-}
-
-static void from_c_matrix(const sk_matrix_t* cmatrix, SkMatrix* matrix) {
- matrix->setAll(cmatrix->mat[0], cmatrix->mat[1], cmatrix->mat[2],
- cmatrix->mat[3], cmatrix->mat[4], cmatrix->mat[5],
- cmatrix->mat[6], cmatrix->mat[7], cmatrix->mat[8]);
-}
-
-const struct {
- sk_path_direction_t fC;
- SkPathDirection fSk;
-} gPathDirMap[] = {
- { CW_SK_PATH_DIRECTION, SkPathDirection::kCW },
- { CCW_SK_PATH_DIRECTION, SkPathDirection::kCCW },
-};
-
-static bool from_c_path_direction(sk_path_direction_t cdir, SkPathDirection* dir) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(gPathDirMap); ++i) {
- if (gPathDirMap[i].fC == cdir) {
- if (dir) {
- *dir = gPathDirMap[i].fSk;
- }
- return true;
- }
- }
- return false;
-}
-
-static SkData* AsData(const sk_data_t* cdata) {
- return reinterpret_cast<SkData*>(const_cast<sk_data_t*>(cdata));
-}
-
-static sk_data_t* ToData(SkData* data) {
- return reinterpret_cast<sk_data_t*>(data);
-}
-
-static sk_rect_t ToRect(const SkRect& rect) {
- return reinterpret_cast<const sk_rect_t&>(rect);
-}
-
-static const SkRect& AsRect(const sk_rect_t& crect) {
- return reinterpret_cast<const SkRect&>(crect);
-}
-
-static const SkPath& AsPath(const sk_path_t& cpath) {
- return reinterpret_cast<const SkPath&>(cpath);
-}
-
-static SkPathBuilder* as_pathbuilder(sk_pathbuilder_t* cbuilder) {
- return reinterpret_cast<SkPathBuilder*>(cbuilder);
-}
-
-static SkPath* as_path(sk_path_t* cpath) {
- return reinterpret_cast<SkPath*>(cpath);
-}
-
-static const SkImage* AsImage(const sk_image_t* cimage) {
- return reinterpret_cast<const SkImage*>(cimage);
-}
-
-static sk_image_t* ToImage(SkImage* cimage) {
- return reinterpret_cast<sk_image_t*>(cimage);
-}
-
-static sk_canvas_t* ToCanvas(SkCanvas* canvas) {
- return reinterpret_cast<sk_canvas_t*>(canvas);
-}
-
-static SkCanvas* AsCanvas(sk_canvas_t* ccanvas) {
- return reinterpret_cast<SkCanvas*>(ccanvas);
-}
-
-static SkPictureRecorder* AsPictureRecorder(sk_picture_recorder_t* crec) {
- return reinterpret_cast<SkPictureRecorder*>(crec);
-}
-
-static sk_picture_recorder_t* ToPictureRecorder(SkPictureRecorder* rec) {
- return reinterpret_cast<sk_picture_recorder_t*>(rec);
-}
-
-static const SkPicture* AsPicture(const sk_picture_t* cpic) {
- return reinterpret_cast<const SkPicture*>(cpic);
-}
-
-static SkPicture* AsPicture(sk_picture_t* cpic) {
- return reinterpret_cast<SkPicture*>(cpic);
-}
-
-static sk_picture_t* ToPicture(SkPicture* pic) {
- return reinterpret_cast<sk_picture_t*>(pic);
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-sk_image_t* sk_image_new_raster_copy(const sk_imageinfo_t* cinfo, const void* pixels,
- size_t rowBytes) {
- const SkImageInfo* info = reinterpret_cast<const SkImageInfo*>(cinfo);
- return (sk_image_t*)SkImage::MakeRasterCopy(SkPixmap(*info, pixels, rowBytes)).release();
-}
-
-sk_image_t* sk_image_new_from_encoded(const sk_data_t* cdata) {
- return ToImage(SkImage::MakeFromEncoded(sk_ref_sp(AsData(cdata))).release());
-}
-
-sk_data_t* sk_image_encode(const sk_image_t* cimage) {
- return ToData(AsImage(cimage)->encodeToData().release());
-}
-
-void sk_image_ref(const sk_image_t* cimage) {
- AsImage(cimage)->ref();
-}
-
-void sk_image_unref(const sk_image_t* cimage) {
- AsImage(cimage)->unref();
-}
-
-int sk_image_get_width(const sk_image_t* cimage) {
- return AsImage(cimage)->width();
-}
-
-int sk_image_get_height(const sk_image_t* cimage) {
- return AsImage(cimage)->height();
-}
-
-uint32_t sk_image_get_unique_id(const sk_image_t* cimage) {
- return AsImage(cimage)->uniqueID();
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-sk_pathbuilder_t* sk_pathbuilder_new() { return (sk_pathbuilder_t*)new SkPathBuilder; }
-
-void sk_pathbuilder_delete(sk_pathbuilder_t* cbuilder) { delete as_pathbuilder(cbuilder); }
-
-void sk_pathbuilder_move_to(sk_pathbuilder_t* cbuilder, float x, float y) {
- as_pathbuilder(cbuilder)->moveTo(x, y);
-}
-
-void sk_pathbuilder_line_to(sk_pathbuilder_t* cbuilder, float x, float y) {
- as_pathbuilder(cbuilder)->lineTo(x, y);
-}
-
-void sk_pathbuilder_quad_to(sk_pathbuilder_t* cbuilder,
- float x0, float y0, float x1, float y1) {
- as_pathbuilder(cbuilder)->quadTo(x0, y0, x1, y1);
-}
-
-void sk_pathbuilder_conic_to(sk_pathbuilder_t* cbuilder,
- float x0, float y0, float x1, float y1, float w) {
- as_pathbuilder(cbuilder)->conicTo(x0, y0, x1, y1, w);
-}
-
-void sk_pathbuilder_cubic_to(sk_pathbuilder_t* cbuilder,
- float x0, float y0, float x1, float y1, float x2, float y2) {
- as_pathbuilder(cbuilder)->cubicTo(x0, y0, x1, y1, x2, y2);
-}
-
-void sk_pathbuilder_close(sk_pathbuilder_t* cbuilder) {
- as_pathbuilder(cbuilder)->close();
-}
-
-void sk_pathbuilder_add_rect(sk_pathbuilder_t* cbuilder, const sk_rect_t* crect, sk_path_direction_t cdir) {
- SkPathDirection dir;
- if (!from_c_path_direction(cdir, &dir)) {
- return;
- }
- as_pathbuilder(cbuilder)->addRect(AsRect(*crect), dir);
-}
-
-void sk_pathbuilder_add_oval(sk_pathbuilder_t* cbuilder, const sk_rect_t* crect, sk_path_direction_t cdir) {
- SkPathDirection dir;
- if (!from_c_path_direction(cdir, &dir)) {
- return;
- }
- as_pathbuilder(cbuilder)->addOval(AsRect(*crect), dir);
-}
-
-sk_path_t* sk_pathbuilder_detach_path(sk_pathbuilder_t* cbuilder) {
- return (sk_path_t*)(new SkPath(as_pathbuilder(cbuilder)->detach()));
-}
-
-sk_path_t* sk_pathbuilder_snapshot_path(sk_pathbuilder_t* cbuilder) {
- return (sk_path_t*)(new SkPath(as_pathbuilder(cbuilder)->snapshot()));
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////////////
-
-void sk_path_delete(sk_path_t* cpath) { delete as_path(cpath); }
-
-bool sk_path_get_bounds(const sk_path_t* cpath, sk_rect_t* crect) {
- const SkPath& path = AsPath(*cpath);
-
- if (path.isEmpty()) {
- if (crect) {
- *crect = ToRect(SkRect::MakeEmpty());
- }
- return false;
- }
-
- if (crect) {
- *crect = ToRect(path.getBounds());
- }
- return true;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-void sk_canvas_save(sk_canvas_t* ccanvas) {
- AsCanvas(ccanvas)->save();
-}
-
-void sk_canvas_save_layer(sk_canvas_t* ccanvas, const sk_rect_t* crect, const sk_paint_t* cpaint) {
- AsCanvas(ccanvas)->drawRect(AsRect(*crect), AsPaint(*cpaint));
-}
-
-void sk_canvas_restore(sk_canvas_t* ccanvas) {
- AsCanvas(ccanvas)->restore();
-}
-
-void sk_canvas_translate(sk_canvas_t* ccanvas, float dx, float dy) {
- AsCanvas(ccanvas)->translate(dx, dy);
-}
-
-void sk_canvas_scale(sk_canvas_t* ccanvas, float sx, float sy) {
- AsCanvas(ccanvas)->scale(sx, sy);
-}
-
-void sk_canvas_rotate_degrees(sk_canvas_t* ccanvas, float degrees) {
- AsCanvas(ccanvas)->rotate(degrees);
-}
-
-void sk_canvas_rotate_radians(sk_canvas_t* ccanvas, float radians) {
- AsCanvas(ccanvas)->rotate(SkRadiansToDegrees(radians));
-}
-
-void sk_canvas_skew(sk_canvas_t* ccanvas, float sx, float sy) {
- AsCanvas(ccanvas)->skew(sx, sy);
-}
-
-void sk_canvas_concat(sk_canvas_t* ccanvas, const sk_matrix_t* cmatrix) {
- SkASSERT(cmatrix);
- SkMatrix matrix;
- from_c_matrix(cmatrix, &matrix);
- AsCanvas(ccanvas)->concat(matrix);
-}
-
-void sk_canvas_clip_rect(sk_canvas_t* ccanvas, const sk_rect_t* crect) {
- AsCanvas(ccanvas)->clipRect(AsRect(*crect));
-}
-
-void sk_canvas_clip_path(sk_canvas_t* ccanvas, const sk_path_t* cpath) {
- AsCanvas(ccanvas)->clipPath(AsPath(*cpath));
-}
-
-void sk_canvas_draw_paint(sk_canvas_t* ccanvas, const sk_paint_t* cpaint) {
- AsCanvas(ccanvas)->drawPaint(AsPaint(*cpaint));
-}
-
-void sk_canvas_draw_rect(sk_canvas_t* ccanvas, const sk_rect_t* crect, const sk_paint_t* cpaint) {
- AsCanvas(ccanvas)->drawRect(AsRect(*crect), AsPaint(*cpaint));
-}
-
-void sk_canvas_draw_circle(sk_canvas_t* ccanvas, float cx, float cy, float rad,
- const sk_paint_t* cpaint) {
- AsCanvas(ccanvas)->drawCircle(cx, cy, rad, AsPaint(*cpaint));
-}
-
-void sk_canvas_draw_oval(sk_canvas_t* ccanvas, const sk_rect_t* crect, const sk_paint_t* cpaint) {
- AsCanvas(ccanvas)->drawOval(AsRect(*crect), AsPaint(*cpaint));
-}
-
-void sk_canvas_draw_path(sk_canvas_t* ccanvas, const sk_path_t* cpath, const sk_paint_t* cpaint) {
- AsCanvas(ccanvas)->drawPath(AsPath(*cpath), AsPaint(*cpaint));
-}
-
-static SkSamplingOptions to_sampling(const sk_sampling_options_t* s) {
- if (s) {
- if (s->useCubic) {
- return SkSamplingOptions({s->cubic.B, s->cubic.C});
- } else {
- return SkSamplingOptions(SkFilterMode(s->filter), SkMipmapMode(s->mipmap));
- }
- }
- return SkSamplingOptions();
-}
-
-void sk_canvas_draw_image(sk_canvas_t* ccanvas, const sk_image_t* cimage, float x, float y,
- const sk_sampling_options_t* csamp, const sk_paint_t* cpaint) {
- AsCanvas(ccanvas)->drawImage(AsImage(cimage), x, y, to_sampling(csamp), AsPaint(cpaint));
-}
-
-void sk_canvas_draw_image_rect(sk_canvas_t* ccanvas, const sk_image_t* cimage,
- const sk_rect_t* csrcR, const sk_rect_t* cdstR,
- const sk_sampling_options_t* csamp, const sk_paint_t* cpaint) {
- SkCanvas* canvas = AsCanvas(ccanvas);
- const SkImage* image = AsImage(cimage);
- const SkRect& dst = AsRect(*cdstR);
- const SkSamplingOptions sampling = to_sampling(csamp);
- const SkPaint* paint = AsPaint(cpaint);
-
- if (csrcR) {
- canvas->drawImageRect(image, AsRect(*csrcR), dst, sampling, paint,
- SkCanvas::kStrict_SrcRectConstraint);
- } else {
- canvas->drawImageRect(image, dst, sampling, paint);
- }
-}
-
-void sk_canvas_draw_picture(sk_canvas_t* ccanvas, const sk_picture_t* cpicture,
- const sk_matrix_t* cmatrix, const sk_paint_t* cpaint) {
- const SkMatrix* matrixPtr = nullptr;
- SkMatrix matrix;
- if (cmatrix) {
- from_c_matrix(cmatrix, &matrix);
- matrixPtr = &matrix;
- }
- AsCanvas(ccanvas)->drawPicture(AsPicture(cpicture), matrixPtr, AsPaint(cpaint));
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-sk_surface_t* sk_surface_new_raster(const sk_imageinfo_t* cinfo,
- const sk_surfaceprops_t* props) {
- const SkImageInfo* info = reinterpret_cast<const SkImageInfo*>(cinfo);
- SkPixelGeometry geo = kUnknown_SkPixelGeometry;
- if (props && !from_c_pixelgeometry(props->pixelGeometry, &geo)) {
- return nullptr;
- }
-
- SkSurfaceProps surfProps(0, geo);
- return (sk_surface_t*)SkSurface::MakeRaster(*info, &surfProps).release();
-}
-
-sk_surface_t* sk_surface_new_raster_direct(const sk_imageinfo_t* cinfo, void* pixels,
- size_t rowBytes,
- const sk_surfaceprops_t* props) {
- const SkImageInfo* info = reinterpret_cast<const SkImageInfo*>(cinfo);
- SkPixelGeometry geo = kUnknown_SkPixelGeometry;
- if (props && !from_c_pixelgeometry(props->pixelGeometry, &geo)) {
- return nullptr;
- }
-
- SkSurfaceProps surfProps(0, geo);
- return (sk_surface_t*)SkSurface::MakeRasterDirect(*info, pixels, rowBytes, &surfProps).release();
-}
-
-void sk_surface_unref(sk_surface_t* csurf) {
- SkSafeUnref((SkSurface*)csurf);
-}
-
-sk_canvas_t* sk_surface_get_canvas(sk_surface_t* csurf) {
- SkSurface* surf = (SkSurface*)csurf;
- return (sk_canvas_t*)surf->getCanvas();
-}
-
-sk_image_t* sk_surface_new_image_snapshot(sk_surface_t* csurf) {
- SkSurface* surf = (SkSurface*)csurf;
- return (sk_image_t*)surf->makeImageSnapshot().release();
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-sk_picture_recorder_t* sk_picture_recorder_new() {
- return ToPictureRecorder(new SkPictureRecorder);
-}
-
-void sk_picture_recorder_delete(sk_picture_recorder_t* crec) {
- delete AsPictureRecorder(crec);
-}
-
-sk_canvas_t* sk_picture_recorder_begin_recording(sk_picture_recorder_t* crec,
- const sk_rect_t* cbounds) {
- return ToCanvas(AsPictureRecorder(crec)->beginRecording(AsRect(*cbounds)));
-}
-
-sk_picture_t* sk_picture_recorder_end_recording(sk_picture_recorder_t* crec) {
- return ToPicture(AsPictureRecorder(crec)->finishRecordingAsPicture().release());
-}
-
-void sk_picture_ref(sk_picture_t* cpic) {
- SkSafeRef(AsPicture(cpic));
-}
-
-void sk_picture_unref(sk_picture_t* cpic) {
- SkSafeUnref(AsPicture(cpic));
-}
-
-uint32_t sk_picture_get_unique_id(sk_picture_t* cpic) {
- return AsPicture(cpic)->uniqueID();
-}
-
-sk_rect_t sk_picture_get_bounds(sk_picture_t* cpic) {
- return ToRect(AsPicture(cpic)->cullRect());
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-sk_data_t* sk_data_new_with_copy(const void* src, size_t length) {
- return ToData(SkData::MakeWithCopy(src, length).release());
-}
-
-sk_data_t* sk_data_new_from_malloc(const void* memory, size_t length) {
- return ToData(SkData::MakeFromMalloc(memory, length).release());
-}
-
-sk_data_t* sk_data_new_subset(const sk_data_t* csrc, size_t offset, size_t length) {
- return ToData(SkData::MakeSubset(AsData(csrc), offset, length).release());
-}
-
-void sk_data_ref(const sk_data_t* cdata) {
- SkSafeRef(AsData(cdata));
-}
-
-void sk_data_unref(const sk_data_t* cdata) {
- SkSafeUnref(AsData(cdata));
-}
-
-size_t sk_data_get_size(const sk_data_t* cdata) {
- return AsData(cdata)->size();
-}
-
-const void* sk_data_get_data(const sk_data_t* cdata) {
- return AsData(cdata)->data();
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////
diff --git a/chromium/third_party/skia/src/c/sk_types_priv.h b/chromium/third_party/skia/src/c/sk_types_priv.h
deleted file mode 100644
index ea62646700a..00000000000
--- a/chromium/third_party/skia/src/c/sk_types_priv.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef sk_types_priv_DEFINED
-#define sk_types_priv_DEFINED
-
-#include "include/c/sk_types.h"
-
-class SkMaskFilter;
-class SkPaint;
-class SkShader;
-
-static inline const SkPaint& AsPaint(const sk_paint_t& cpaint) {
- return reinterpret_cast<const SkPaint&>(cpaint);
-}
-
-static inline const SkPaint* AsPaint(const sk_paint_t* cpaint) {
- return reinterpret_cast<const SkPaint*>(cpaint);
-}
-
-static inline SkPaint* AsPaint(sk_paint_t* cpaint) {
- return reinterpret_cast<SkPaint*>(cpaint);
-}
-
-static inline SkMaskFilter* AsMaskFilter(sk_maskfilter_t* cfilter) {
- return reinterpret_cast<SkMaskFilter*>(cfilter);
-}
-
-static inline sk_maskfilter_t* ToMaskFilter(SkMaskFilter* filter) {
- return reinterpret_cast<sk_maskfilter_t*>(filter);
-}
-
-static inline SkShader* AsShader(sk_shader_t* cshader) {
- return reinterpret_cast<SkShader*>(cshader);
-}
-
-#endif
diff --git a/chromium/third_party/skia/src/codec/BUILD.bazel b/chromium/third_party/skia/src/codec/BUILD.bazel
index 37d2ed0a0a3..2f0913f0a57 100644
--- a/chromium/third_party/skia/src/codec/BUILD.bazel
+++ b/chromium/third_party/skia/src/codec/BUILD.bazel
@@ -1,10 +1,11 @@
load(
"//bazel:macros.bzl",
- "cc_library",
"exports_files_legacy",
"select_multi",
"selects",
+ "skia_cc_deps",
"split_srcs_and_hdrs",
+ "string_flag_with_values",
)
licenses(["notice"])
@@ -132,11 +133,33 @@ split_srcs_and_hdrs(
files = DECODE_WEBP_FILES,
)
+split_srcs_and_hdrs(
+ name = "decode_avif",
+ files = [
+ "SkAvifCodec.cpp",
+ "SkAvifCodec.h",
+ "SkScalingCodec.h",
+ ],
+)
+
+string_flag_with_values(
+ flag_name = "include_decoder",
+ multiple = True,
+ values = [
+ "avif_decode_codec",
+ "gif_decode_codec",
+ "jpeg_decode_codec",
+ "png_decode_codec",
+ "raw_decode_codec",
+ "webp_decode_codec",
+ ],
+)
+
selects.config_setting_group(
name = "needs_jpeg",
match_any = [
- "//bazel/common_config_settings:jpeg_decode_codec",
- "//bazel/common_config_settings:raw_decode_codec",
+ ":jpeg_decode_codec",
+ ":raw_decode_codec",
],
)
@@ -144,15 +167,15 @@ selects.config_setting_group(
name = "needs_jpeg_priv",
match_any = [
":needs_jpeg",
- "//bazel/common_config_settings:jpeg_encode_codec",
+ "//src/images:jpeg_encode_codec",
],
)
selects.config_setting_group(
name = "needs_png_priv",
match_any = [
- "//bazel/common_config_settings:png_decode_codec",
- "//bazel/common_config_settings:png_encode_codec",
+ ":png_decode_codec",
+ "//src/images:png_encode_codec",
],
)
@@ -164,13 +187,13 @@ filegroup(
":core_srcs",
] + select_multi(
{
- "//bazel/common_config_settings:gif_decode_codec": [":decode_gif_srcs"],
+ ":avif_decode_codec": [":decode_avif_srcs"],
+ ":gif_decode_codec": [":decode_gif_srcs"],
":needs_jpeg": [":decode_jpeg_srcs"],
- "//bazel/common_config_settings:png_decode_codec": [":decode_png_srcs"],
- "//bazel/common_config_settings:raw_decode_codec": [":decode_raw_srcs"],
- "//bazel/common_config_settings:webp_decode_codec": [":decode_webp_srcs"],
+ ":png_decode_codec": [":decode_png_srcs"],
+ ":raw_decode_codec": [":decode_raw_srcs"],
+ ":webp_decode_codec": [":decode_webp_srcs"],
},
- default = [],
),
visibility = ["//src:__pkg__"],
)
@@ -189,31 +212,31 @@ filegroup(
"//conditions:default": [],
}) + select_multi(
{
- "//bazel/common_config_settings:gif_decode_codec": [":decode_gif_hdrs"],
+ ":avif_decode_codec": [":decode_avif_hdrs"],
+ ":gif_decode_codec": [":decode_gif_hdrs"],
":needs_jpeg": [":decode_jpeg_hdrs"],
- "//bazel/common_config_settings:png_decode_codec": [":decode_png_hdrs"],
- "//bazel/common_config_settings:raw_decode_codec": [":decode_raw_hdrs"],
- "//bazel/common_config_settings:webp_decode_codec": [":decode_webp_hdrs"],
+ ":png_decode_codec": [":decode_png_hdrs"],
+ ":raw_decode_codec": [":decode_raw_hdrs"],
+ ":webp_decode_codec": [":decode_webp_hdrs"],
},
- default = [],
),
visibility = ["//src:__pkg__"],
)
-cc_library(
+skia_cc_deps(
name = "deps",
visibility = ["//src:__pkg__"],
deps = select_multi(
{
- "//bazel/common_config_settings:gif_decode_codec": ["@wuffs"],
+ ":avif_decode_codec": ["@libavif"],
+ ":gif_decode_codec": ["@wuffs"],
":needs_jpeg": ["@libjpeg_turbo"],
- "//bazel/common_config_settings:png_decode_codec": ["@libpng"],
- "//bazel/common_config_settings:raw_decode_codec": [
+ ":png_decode_codec": ["@libpng"],
+ ":raw_decode_codec": [
"@dng_sdk",
"@piex",
],
- "//bazel/common_config_settings:webp_decode_codec": ["@libwebp"],
+ ":webp_decode_codec": ["@libwebp"],
},
- default = [],
),
)
diff --git a/chromium/third_party/skia/src/codec/SkAndroidCodec.cpp b/chromium/third_party/skia/src/codec/SkAndroidCodec.cpp
index e955b9aeb9f..5fc6764c646 100644
--- a/chromium/third_party/skia/src/codec/SkAndroidCodec.cpp
+++ b/chromium/third_party/skia/src/codec/SkAndroidCodec.cpp
@@ -7,11 +7,22 @@
#include "include/codec/SkAndroidCodec.h"
#include "include/codec/SkCodec.h"
-#include "include/core/SkPixmap.h"
+#include "include/core/SkData.h"
+#include "include/core/SkPoint.h"
+#include "include/core/SkRect.h"
+#include "include/core/SkScalar.h"
+#include "include/core/SkStream.h"
+#include "modules/skcms/skcms.h"
#include "src/codec/SkAndroidCodecAdapter.h"
#include "src/codec/SkCodecPriv.h"
#include "src/codec/SkSampledCodec.h"
+#include <algorithm>
+#include <cstdint>
+#include <utility>
+
+class SkPngChunkReader;
+
static bool is_valid_sample_size(int sampleSize) {
// FIXME: As Leon has mentioned elsewhere, surely there is also a maximum sampleSize?
return sampleSize > 0;
@@ -83,7 +94,9 @@ std::unique_ptr<SkAndroidCodec> SkAndroidCodec::MakeFromCodec(std::unique_ptr<Sk
case SkEncodedImageFormat::kBMP:
case SkEncodedImageFormat::kWBMP:
case SkEncodedImageFormat::kHEIF:
+#ifndef SK_CODEC_DECODES_AVIF
case SkEncodedImageFormat::kAVIF:
+#endif
return std::make_unique<SkSampledCodec>(codec.release());
#ifdef SK_HAS_WUFFS_LIBRARY
case SkEncodedImageFormat::kGIF:
@@ -94,7 +107,11 @@ std::unique_ptr<SkAndroidCodec> SkAndroidCodec::MakeFromCodec(std::unique_ptr<Sk
#ifdef SK_CODEC_DECODES_RAW
case SkEncodedImageFormat::kDNG:
#endif
-#if defined(SK_CODEC_DECODES_WEBP) || defined(SK_CODEC_DECODES_RAW) || defined(SK_HAS_WUFFS_LIBRARY)
+#ifdef SK_CODEC_DECODES_AVIF
+ case SkEncodedImageFormat::kAVIF:
+#endif
+#if defined(SK_CODEC_DECODES_WEBP) || defined(SK_CODEC_DECODES_RAW) || \
+ defined(SK_HAS_WUFFS_LIBRARY) || defined(SK_CODEC_DECODES_AVIF)
return std::make_unique<SkAndroidCodecAdapter>(codec.release());
#endif
diff --git a/chromium/third_party/skia/src/codec/SkAndroidCodecAdapter.cpp b/chromium/third_party/skia/src/codec/SkAndroidCodecAdapter.cpp
index f9e6fce1faa..089220fd1fe 100644
--- a/chromium/third_party/skia/src/codec/SkAndroidCodecAdapter.cpp
+++ b/chromium/third_party/skia/src/codec/SkAndroidCodecAdapter.cpp
@@ -8,6 +8,9 @@
#include "src/codec/SkAndroidCodecAdapter.h"
#include "src/codec/SkCodecPriv.h"
+struct SkIRect;
+struct SkImageInfo;
+
SkAndroidCodecAdapter::SkAndroidCodecAdapter(SkCodec* codec)
: INHERITED(codec)
{}
diff --git a/chromium/third_party/skia/src/codec/SkAndroidCodecAdapter.h b/chromium/third_party/skia/src/codec/SkAndroidCodecAdapter.h
index d197dc44e80..2d453e39f0b 100644
--- a/chromium/third_party/skia/src/codec/SkAndroidCodecAdapter.h
+++ b/chromium/third_party/skia/src/codec/SkAndroidCodecAdapter.h
@@ -8,6 +8,13 @@
#define SkAndroidCodecAdapter_DEFINED
#include "include/codec/SkAndroidCodec.h"
+#include "include/codec/SkCodec.h"
+#include "include/core/SkSize.h"
+
+#include <cstddef>
+
+struct SkIRect;
+struct SkImageInfo;
/**
* This class wraps SkCodec to implement the functionality of SkAndroidCodec.
diff --git a/chromium/third_party/skia/src/codec/SkAvifCodec.cpp b/chromium/third_party/skia/src/codec/SkAvifCodec.cpp
new file mode 100644
index 00000000000..d717faeb4d9
--- /dev/null
+++ b/chromium/third_party/skia/src/codec/SkAvifCodec.cpp
@@ -0,0 +1,232 @@
+/*
+ * Copyright 2022 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "src/codec/SkAvifCodec.h"
+
+#include "include/codec/SkCodec.h"
+#include "include/core/SkStream.h"
+#include "include/private/SkColorData.h"
+#include "src/codec/SkCodecPriv.h"
+#include "src/core/SkEndian.h"
+#include "src/core/SkStreamPriv.h"
+
+#include "avif/avif.h"
+#include "avif/internal.h"
+
+void AvifDecoderDeleter::operator()(avifDecoder* decoder) const {
+ if (decoder != nullptr) {
+ avifDecoderDestroy(decoder);
+ }
+}
+
+bool SkAvifCodec::IsAvif(const void* buffer, size_t bytesRead) {
+ avifROData avifData = {static_cast<const uint8_t*>(buffer), bytesRead};
+ bool isAvif = avifPeekCompatibleFileType(&avifData) == AVIF_TRUE;
+ if (isAvif) return true;
+ // Peeking sometimes fails if the ftyp box is too large. Check the signature
+ // just to be sure.
+ const char* bytes = static_cast<const char*>(buffer);
+ isAvif = bytesRead >= 12 && !memcmp(&bytes[4], "ftyp", 4) &&
+ (!memcmp(&bytes[8], "avif", 4) || !memcmp(&bytes[8], "avis", 4));
+ return isAvif;
+}
+
+std::unique_ptr<SkCodec> SkAvifCodec::MakeFromStream(std::unique_ptr<SkStream> stream,
+ Result* result) {
+ AvifDecoder avifDecoder(avifDecoderCreate());
+ if (avifDecoder == nullptr) {
+ *result = kInternalError;
+ return nullptr;
+ }
+ avifDecoder->ignoreXMP = AVIF_TRUE;
+ avifDecoder->ignoreExif = AVIF_TRUE;
+ avifDecoder->allowProgressive = AVIF_FALSE;
+ avifDecoder->allowIncremental = AVIF_FALSE;
+ avifDecoder->strictFlags = AVIF_STRICT_DISABLED;
+ // TODO(vigneshv): Enable threading based on number of CPU cores available.
+ avifDecoder->maxThreads = 1;
+
+ // libavif needs a contiguous data buffer.
+ sk_sp<SkData> data = nullptr;
+ if (stream->getMemoryBase()) {
+ // It is safe to make without copy because we'll hold onto the stream.
+ data = SkData::MakeWithoutCopy(stream->getMemoryBase(), stream->getLength());
+ } else {
+ data = SkCopyStreamToData(stream.get());
+ // If we are forced to copy the stream to a data, we can go ahead and
+ // delete the stream.
+ stream.reset(nullptr);
+ }
+
+ avifResult res = avifDecoderSetIOMemory(avifDecoder.get(), data->bytes(), data->size());
+ if (res != AVIF_RESULT_OK) {
+ *result = kInternalError;
+ return nullptr;
+ }
+
+ res = avifDecoderParse(avifDecoder.get());
+ if (res != AVIF_RESULT_OK) {
+ *result = kInvalidInput;
+ return nullptr;
+ }
+
+ std::unique_ptr<SkEncodedInfo::ICCProfile> profile = nullptr;
+ // TODO(vigneshv): Get ICC Profile from the avif decoder.
+
+ const int bitsPerComponent = avifDecoder->image->depth > 8 ? 16 : 8;
+ SkEncodedInfo::Color color;
+ SkEncodedInfo::Alpha alpha;
+ if (avifDecoder->alphaPresent) {
+ color = SkEncodedInfo::kRGBA_Color;
+ alpha = SkEncodedInfo::kUnpremul_Alpha;
+ } else {
+ color = SkEncodedInfo::kRGB_Color;
+ alpha = SkEncodedInfo::kOpaque_Alpha;
+ }
+ SkEncodedInfo info = SkEncodedInfo::Make(avifDecoder->image->width,
+ avifDecoder->image->height,
+ color,
+ alpha,
+ bitsPerComponent,
+ std::move(profile),
+ avifDecoder->image->depth);
+ bool animation = avifDecoder->imageCount > 1;
+ *result = kSuccess;
+ return std::unique_ptr<SkCodec>(new SkAvifCodec(std::move(info),
+ std::move(stream),
+ std::move(data),
+ std::move(avifDecoder),
+ kDefault_SkEncodedOrigin,
+ animation));
+}
+
+SkAvifCodec::SkAvifCodec(SkEncodedInfo&& info,
+ std::unique_ptr<SkStream> stream,
+ sk_sp<SkData> data,
+ AvifDecoder avifDecoder,
+ SkEncodedOrigin origin,
+ bool useAnimation)
+ : INHERITED(std::move(info), skcms_PixelFormat_RGBA_8888, std::move(stream), origin)
+ , fData(std::move(data))
+ , fAvifDecoder(std::move(avifDecoder))
+ , fUseAnimation(useAnimation) {}
+
+int SkAvifCodec::onGetFrameCount() {
+ if (!fUseAnimation) {
+ return 1;
+ }
+
+ if (fFrameHolder.size() == 0) {
+ if (fAvifDecoder->imageCount <= 1) {
+ fUseAnimation = false;
+ return 1;
+ }
+ fFrameHolder.reserve(fAvifDecoder->imageCount);
+ for (int i = 0; i < fAvifDecoder->imageCount; i++) {
+ Frame* frame = fFrameHolder.appendNewFrame(fAvifDecoder->alphaPresent == AVIF_TRUE);
+ frame->setXYWH(0, 0, fAvifDecoder->image->width, fAvifDecoder->image->height);
+ frame->setDisposalMethod(SkCodecAnimation::DisposalMethod::kKeep);
+ avifImageTiming timing;
+ avifDecoderNthImageTiming(fAvifDecoder.get(), i, &timing);
+ frame->setDuration(timing.duration * 1000);
+ frame->setRequiredFrame(SkCodec::kNoFrame);
+ frame->setHasAlpha(fAvifDecoder->alphaPresent == AVIF_TRUE);
+ }
+ }
+
+ return fFrameHolder.size();
+}
+
+const SkFrame* SkAvifCodec::FrameHolder::onGetFrame(int i) const {
+ return static_cast<const SkFrame*>(this->frame(i));
+}
+
+SkAvifCodec::Frame* SkAvifCodec::FrameHolder::appendNewFrame(bool hasAlpha) {
+ const int i = this->size();
+ fFrames.emplace_back(i,
+ hasAlpha ? SkEncodedInfo::kUnpremul_Alpha : SkEncodedInfo::kOpaque_Alpha);
+ return &fFrames[i];
+}
+
+const SkAvifCodec::Frame* SkAvifCodec::FrameHolder::frame(int i) const {
+ SkASSERT(i >= 0 && i < this->size());
+ return &fFrames[i];
+}
+
+bool SkAvifCodec::onGetFrameInfo(int i, FrameInfo* frameInfo) const {
+ if (i >= fFrameHolder.size()) {
+ return false;
+ }
+
+ const Frame* frame = fFrameHolder.frame(i);
+ if (!frame) {
+ return false;
+ }
+
+ if (frameInfo) {
+ frame->fillIn(frameInfo, true);
+ }
+
+ return true;
+}
+
+int SkAvifCodec::onGetRepetitionCount() { return kRepetitionCountInfinite; }
+
+SkCodec::Result SkAvifCodec::onGetPixels(const SkImageInfo& dstInfo,
+ void* dst,
+ size_t dstRowBytes,
+ const Options& options,
+ int* rowsDecoded) {
+ if (options.fSubset) {
+ return kUnimplemented;
+ }
+
+ const SkColorType dstColorType = dstInfo.colorType();
+ if (dstColorType != kRGBA_8888_SkColorType && dstColorType != kRGBA_F16_SkColorType) {
+ // TODO(vigneshv): Check if more color types need to be supported.
+ // Currently android supports at least RGB565 and BGRA8888 which is not
+ // supported here.
+ return kUnimplemented;
+ }
+
+ avifResult result = avifDecoderNthImage(fAvifDecoder.get(), options.fFrameIndex);
+ if (result != AVIF_RESULT_OK) {
+ return kInvalidInput;
+ }
+
+ if (this->dimensions() != dstInfo.dimensions()) {
+ if (!avifImageScale(fAvifDecoder->image,
+ dstInfo.width(),
+ dstInfo.height(),
+ fAvifDecoder->imageSizeLimit,
+ &fAvifDecoder->diag)) {
+ return kInvalidInput;
+ }
+ }
+
+ avifRGBImage rgbImage;
+ avifRGBImageSetDefaults(&rgbImage, fAvifDecoder->image);
+
+ if (dstColorType == kRGBA_8888_SkColorType) {
+ rgbImage.depth = 8;
+ } else if (dstColorType == kRGBA_F16_SkColorType) {
+ rgbImage.depth = 16;
+ rgbImage.isFloat = AVIF_TRUE;
+ }
+
+ rgbImage.pixels = static_cast<uint8_t*>(dst);
+ rgbImage.rowBytes = dstRowBytes;
+ rgbImage.chromaUpsampling = AVIF_CHROMA_UPSAMPLING_FASTEST;
+
+ result = avifImageYUVToRGB(fAvifDecoder->image, &rgbImage);
+ if (result != AVIF_RESULT_OK) {
+ return kInvalidInput;
+ }
+
+ *rowsDecoded = fAvifDecoder->image->height;
+ return kSuccess;
+}
diff --git a/chromium/third_party/skia/src/codec/SkAvifCodec.h b/chromium/third_party/skia/src/codec/SkAvifCodec.h
new file mode 100644
index 00000000000..d63fe3f9ae1
--- /dev/null
+++ b/chromium/third_party/skia/src/codec/SkAvifCodec.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2022 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkAvifCodec_DEFINED
+#define SkAvifCodec_DEFINED
+
+#include "include/codec/SkCodec.h"
+#include "include/codec/SkEncodedOrigin.h"
+#include "include/core/SkImageInfo.h"
+#include "include/core/SkStream.h"
+#include "src/codec/SkFrameHolder.h"
+#include "src/codec/SkScalingCodec.h"
+
+struct avifDecoder;
+struct AvifDecoderDeleter {
+ void operator()(avifDecoder* decoder) const;
+};
+using AvifDecoder = std::unique_ptr<avifDecoder, AvifDecoderDeleter>;
+
+class SkAvifCodec : public SkScalingCodec {
+public:
+ /*
+ * Returns true if an AVIF image is detected. Returns false otherwise.
+ */
+ static bool IsAvif(const void*, size_t);
+
+ /*
+ * Assumes IsAvif() was called and it returned true.
+ */
+ static std::unique_ptr<SkCodec> MakeFromStream(std::unique_ptr<SkStream>, Result*);
+
+protected:
+ Result onGetPixels(const SkImageInfo& dstInfo,
+ void* dst,
+ size_t dstRowBytes,
+ const Options& options,
+ int* rowsDecoded) override;
+
+ SkEncodedImageFormat onGetEncodedFormat() const override { return SkEncodedImageFormat::kAVIF; }
+
+ int onGetFrameCount() override;
+ bool onGetFrameInfo(int, FrameInfo*) const override;
+ int onGetRepetitionCount() override;
+ const SkFrameHolder* getFrameHolder() const override { return &fFrameHolder; }
+
+private:
+ SkAvifCodec(SkEncodedInfo&&,
+ std::unique_ptr<SkStream>,
+ sk_sp<SkData>,
+ AvifDecoder,
+ SkEncodedOrigin,
+ bool);
+
+ // fAvifDecoder has a pointer to this data. This should not be freed until
+ // the decode is completed. To ensure that, we declare this before
+ // fAvifDecoder.
+ sk_sp<SkData> fData;
+
+ AvifDecoder fAvifDecoder;
+ bool fUseAnimation;
+
+ class Frame : public SkFrame {
+ public:
+ Frame(int i, SkEncodedInfo::Alpha alpha) : INHERITED(i), fReportedAlpha(alpha) {}
+
+ protected:
+ SkEncodedInfo::Alpha onReportedAlpha() const override { return fReportedAlpha; }
+
+ private:
+ const SkEncodedInfo::Alpha fReportedAlpha;
+
+ using INHERITED = SkFrame;
+ };
+
+ class FrameHolder : public SkFrameHolder {
+ public:
+ ~FrameHolder() override {}
+ void setScreenSize(int w, int h) {
+ fScreenWidth = w;
+ fScreenHeight = h;
+ }
+ Frame* appendNewFrame(bool hasAlpha);
+ const Frame* frame(int i) const;
+ int size() const { return static_cast<int>(fFrames.size()); }
+ void reserve(int size) { fFrames.reserve(size); }
+
+ protected:
+ const SkFrame* onGetFrame(int i) const override;
+
+ private:
+ std::vector<Frame> fFrames;
+ };
+
+ FrameHolder fFrameHolder;
+ using INHERITED = SkScalingCodec;
+};
+
+#endif // SkAvifCodec_DEFINED
diff --git a/chromium/third_party/skia/src/codec/SkBmpBaseCodec.cpp b/chromium/third_party/skia/src/codec/SkBmpBaseCodec.cpp
index 32a1d373842..1323e88e806 100644
--- a/chromium/third_party/skia/src/codec/SkBmpBaseCodec.cpp
+++ b/chromium/third_party/skia/src/codec/SkBmpBaseCodec.cpp
@@ -4,9 +4,14 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include "include/private/SkMalloc.h"
#include "src/codec/SkBmpBaseCodec.h"
+#include "include/core/SkStream.h"
+#include "include/private/SkEncodedInfo.h"
+#include "include/private/SkMalloc.h"
+
+#include <utility>
+
SkBmpBaseCodec::~SkBmpBaseCodec() {}
SkBmpBaseCodec::SkBmpBaseCodec(SkEncodedInfo&& info, std::unique_ptr<SkStream> stream,
diff --git a/chromium/third_party/skia/src/codec/SkBmpBaseCodec.h b/chromium/third_party/skia/src/codec/SkBmpBaseCodec.h
index a3ceee413b2..15ccaa4c780 100644
--- a/chromium/third_party/skia/src/codec/SkBmpBaseCodec.h
+++ b/chromium/third_party/skia/src/codec/SkBmpBaseCodec.h
@@ -7,9 +7,16 @@
#ifndef SkBmpBaseCodec_DEFINED
#define SkBmpBaseCodec_DEFINED
+#include "include/codec/SkCodec.h"
#include "include/private/SkTemplates.h"
#include "src/codec/SkBmpCodec.h"
+#include <cstdint>
+#include <memory>
+
+class SkStream;
+struct SkEncodedInfo;
+
/*
* Common base class for SkBmpStandardCodec and SkBmpMaskCodec.
*/
diff --git a/chromium/third_party/skia/src/codec/SkBmpCodec.cpp b/chromium/third_party/skia/src/codec/SkBmpCodec.cpp
index 61a2c5114d2..8507653d851 100644
--- a/chromium/third_party/skia/src/codec/SkBmpCodec.cpp
+++ b/chromium/third_party/skia/src/codec/SkBmpCodec.cpp
@@ -7,14 +7,20 @@
#include "src/codec/SkBmpCodec.h"
-#include <memory>
-
+#include "include/core/SkImageInfo.h"
+#include "include/core/SkSize.h"
#include "include/core/SkStream.h"
-#include "include/private/SkColorData.h"
+#include "include/private/SkEncodedInfo.h"
#include "src/codec/SkBmpMaskCodec.h"
#include "src/codec/SkBmpRLECodec.h"
#include "src/codec/SkBmpStandardCodec.h"
#include "src/codec/SkCodecPriv.h"
+#include "src/codec/SkMasks.h"
+
+#include <cstring>
+#include <memory>
+#include <type_traits>
+#include <utility>
/*
* Defines the version and type of the second bitmap header
diff --git a/chromium/third_party/skia/src/codec/SkBmpCodec.h b/chromium/third_party/skia/src/codec/SkBmpCodec.h
index c150692cccb..6e83fa962f3 100644
--- a/chromium/third_party/skia/src/codec/SkBmpCodec.h
+++ b/chromium/third_party/skia/src/codec/SkBmpCodec.h
@@ -8,12 +8,18 @@
#define SkBmpCodec_DEFINED
#include "include/codec/SkCodec.h"
-#include "include/core/SkColorSpace.h"
-#include "include/core/SkImageInfo.h"
-#include "include/core/SkStream.h"
+#include "include/core/SkColorType.h"
+#include "include/core/SkEncodedImageFormat.h"
#include "include/core/SkTypes.h"
-#include "src/codec/SkColorTable.h"
-#include "src/codec/SkSwizzler.h"
+#include "modules/skcms/skcms.h"
+
+#include <cstddef>
+#include <cstdint>
+#include <memory>
+
+class SkStream;
+struct SkEncodedInfo;
+struct SkImageInfo;
/*
* This class enables code sharing between its bmp codec subclasses. The
diff --git a/chromium/third_party/skia/src/codec/SkBmpMaskCodec.cpp b/chromium/third_party/skia/src/codec/SkBmpMaskCodec.cpp
index 874056a08da..06eed6dc737 100644
--- a/chromium/third_party/skia/src/codec/SkBmpMaskCodec.cpp
+++ b/chromium/third_party/skia/src/codec/SkBmpMaskCodec.cpp
@@ -5,10 +5,19 @@
* found in the LICENSE file.
*/
-#include "include/private/SkColorData.h"
#include "src/codec/SkBmpMaskCodec.h"
+
+#include "include/core/SkAlphaType.h"
+#include "include/core/SkImageInfo.h"
+#include "include/core/SkSize.h"
+#include "include/core/SkStream.h"
+#include "include/private/SkEncodedInfo.h"
+#include "include/private/SkTemplates.h"
+#include "src/codec/SkBmpCodec.h"
#include "src/codec/SkCodecPriv.h"
+#include <utility>
+
/*
* Creates an instance of the decoder
*/
diff --git a/chromium/third_party/skia/src/codec/SkBmpMaskCodec.h b/chromium/third_party/skia/src/codec/SkBmpMaskCodec.h
index 686a8fac62a..af9afed6a6c 100644
--- a/chromium/third_party/skia/src/codec/SkBmpMaskCodec.h
+++ b/chromium/third_party/skia/src/codec/SkBmpMaskCodec.h
@@ -8,10 +8,20 @@
#ifndef SkBmpMaskCodec_DEFINED
#define SkBmpMaskCodec_DEFINED
-#include "include/core/SkImageInfo.h"
+#include "include/codec/SkCodec.h"
#include "include/core/SkTypes.h"
#include "src/codec/SkBmpBaseCodec.h"
#include "src/codec/SkMaskSwizzler.h"
+#include "src/codec/SkMasks.h"
+
+#include <cstddef>
+#include <cstdint>
+#include <memory>
+
+class SkSampler;
+class SkStream;
+struct SkEncodedInfo;
+struct SkImageInfo;
/*
* This class implements the decoding for bmp images using bit masks
diff --git a/chromium/third_party/skia/src/codec/SkBmpRLECodec.cpp b/chromium/third_party/skia/src/codec/SkBmpRLECodec.cpp
index 728a933707d..1bd50fb42dc 100644
--- a/chromium/third_party/skia/src/codec/SkBmpRLECodec.cpp
+++ b/chromium/third_party/skia/src/codec/SkBmpRLECodec.cpp
@@ -7,12 +7,23 @@
#include "src/codec/SkBmpRLECodec.h"
-#include <memory>
-
+#include "include/core/SkAlphaType.h"
+#include "include/core/SkColor.h"
+#include "include/core/SkColorPriv.h"
+#include "include/core/SkImageInfo.h"
+#include "include/core/SkSize.h"
#include "include/core/SkStream.h"
#include "include/private/SkColorData.h"
+#include "include/private/SkEncodedInfo.h"
+#include "include/private/SkMalloc.h"
+#include "include/private/SkTemplates.h"
#include "src/codec/SkCodecPriv.h"
+#include <algorithm>
+#include <cstring>
+#include <memory>
+#include <utility>
+
/*
* Creates an instance of the decoder
* Called only by NewFromStream
diff --git a/chromium/third_party/skia/src/codec/SkBmpRLECodec.h b/chromium/third_party/skia/src/codec/SkBmpRLECodec.h
index b920115e2aa..effc0a33411 100644
--- a/chromium/third_party/skia/src/codec/SkBmpRLECodec.h
+++ b/chromium/third_party/skia/src/codec/SkBmpRLECodec.h
@@ -7,12 +7,22 @@
#ifndef SkBmpRLECodec_DEFINED
#define SkBmpRLECodec_DEFINED
-#include "include/core/SkImageInfo.h"
+#include "include/codec/SkCodec.h"
+#include "include/core/SkColorType.h"
+#include "include/core/SkRefCnt.h"
#include "include/core/SkTypes.h"
#include "src/codec/SkBmpCodec.h"
#include "src/codec/SkColorTable.h"
#include "src/codec/SkSampler.h"
+#include <cstddef>
+#include <cstdint>
+#include <memory>
+
+class SkStream;
+struct SkEncodedInfo;
+struct SkImageInfo;
+
/*
* This class implements the decoding for bmp images that use an RLE encoding
*/
diff --git a/chromium/third_party/skia/src/codec/SkBmpStandardCodec.cpp b/chromium/third_party/skia/src/codec/SkBmpStandardCodec.cpp
index 07f373b2cc0..849ec0fac2d 100644
--- a/chromium/third_party/skia/src/codec/SkBmpStandardCodec.cpp
+++ b/chromium/third_party/skia/src/codec/SkBmpStandardCodec.cpp
@@ -5,12 +5,21 @@
* found in the LICENSE file.
*/
-#include "include/core/SkStream.h"
-#include "include/private/SkColorData.h"
#include "src/codec/SkBmpStandardCodec.h"
+
+#include "include/core/SkColor.h"
+#include "include/core/SkColorPriv.h"
+#include "include/core/SkImageInfo.h"
+#include "include/core/SkSize.h"
+#include "include/core/SkStream.h"
+#include "include/private/SkTemplates.h"
+#include "src/codec/SkBmpCodec.h"
#include "src/codec/SkCodecPriv.h"
#include "src/core/SkMathPriv.h"
+#include <algorithm>
+#include <utility>
+
/*
* Creates an instance of the decoder
* Called only by NewFromStream
diff --git a/chromium/third_party/skia/src/codec/SkBmpStandardCodec.h b/chromium/third_party/skia/src/codec/SkBmpStandardCodec.h
index 48cefc80f34..de192af2807 100644
--- a/chromium/third_party/skia/src/codec/SkBmpStandardCodec.h
+++ b/chromium/third_party/skia/src/codec/SkBmpStandardCodec.h
@@ -7,12 +7,24 @@
#ifndef SkBmpStandardCodec_DEFINED
#define SkBmpStandardCodec_DEFINED
-#include "include/core/SkImageInfo.h"
+#include "include/codec/SkCodec.h"
+#include "include/core/SkAlphaType.h"
+#include "include/core/SkColorType.h"
+#include "include/core/SkRefCnt.h"
#include "include/core/SkTypes.h"
+#include "include/private/SkEncodedInfo.h"
#include "src/codec/SkBmpBaseCodec.h"
#include "src/codec/SkColorTable.h"
#include "src/codec/SkSwizzler.h"
+#include <cstddef>
+#include <cstdint>
+#include <memory>
+
+class SkSampler;
+class SkStream;
+struct SkImageInfo;
+
/*
* This class implements the decoding for bmp images that use "standard" modes,
* which essentially means they do not contain bit masks or RLE codes.
diff --git a/chromium/third_party/skia/src/codec/SkCodec.cpp b/chromium/third_party/skia/src/codec/SkCodec.cpp
index 797120d75e4..fcaee949573 100644
--- a/chromium/third_party/skia/src/codec/SkCodec.cpp
+++ b/chromium/third_party/skia/src/codec/SkCodec.cpp
@@ -6,23 +6,35 @@
*/
#include "include/codec/SkCodec.h"
+
#include "include/core/SkBitmap.h"
+#include "include/core/SkColorPriv.h"
#include "include/core/SkColorSpace.h"
+#include "include/core/SkColorType.h"
#include "include/core/SkData.h"
-#include "include/core/SkImage.h"
+#include "include/core/SkImage.h" // IWYU pragma: keep
+#include "include/core/SkMatrix.h"
#include "include/core/SkStream.h"
-#include "include/private/SkHalf.h"
+#include "include/private/SkTemplates.h"
+#include "modules/skcms/skcms.h"
#include "src/codec/SkCodecPriv.h"
#include "src/codec/SkFrameHolder.h"
+#include "src/codec/SkSampler.h"
// We always include and compile in these BMP codecs
#include "src/codec/SkBmpCodec.h"
#include "src/codec/SkWbmpCodec.h"
+#include <utility>
+
#ifdef SK_HAS_ANDROID_CODEC
#include "include/codec/SkAndroidCodec.h"
#endif
+#ifdef SK_CODEC_DECODES_AVIF
+#include "src/codec/SkAvifCodec.h"
+#endif
+
#ifdef SK_HAS_HEIF_LIBRARY
#include "src/codec/SkHeifCodec.h"
#endif
@@ -77,6 +89,9 @@ static std::vector<DecoderProc>* decoders() {
#endif
{ SkBmpCodec::IsBmp, SkBmpCodec::MakeFromStream },
{ SkWbmpCodec::IsWbmp, SkWbmpCodec::MakeFromStream },
+ #ifdef SK_CODEC_DECODES_AVIF
+ { SkAvifCodec::IsAvif, SkAvifCodec::MakeFromStream },
+ #endif
#ifdef SK_CODEC_DECODES_JPEGXL
{ SkJpegxlCodec::IsJpegxl, SkJpegxlCodec::MakeFromStream },
#endif
diff --git a/chromium/third_party/skia/src/codec/SkCodecImageGenerator.cpp b/chromium/third_party/skia/src/codec/SkCodecImageGenerator.cpp
index 33fd3fc8141..6f4371bd1bd 100644
--- a/chromium/third_party/skia/src/codec/SkCodecImageGenerator.cpp
+++ b/chromium/third_party/skia/src/codec/SkCodecImageGenerator.cpp
@@ -7,8 +7,15 @@
#include "src/codec/SkCodecImageGenerator.h"
+#include "include/codec/SkEncodedOrigin.h"
+#include "include/core/SkImageInfo.h"
+#include "include/core/SkPixmap.h"
+#include "include/core/SkTypes.h"
#include "src/core/SkPixmapPriv.h"
+#include <utility>
+
+
std::unique_ptr<SkImageGenerator> SkCodecImageGenerator::MakeFromEncodedCodec(
sk_sp<SkData> data, std::optional<SkAlphaType> at) {
auto codec = SkCodec::MakeFromData(data);
diff --git a/chromium/third_party/skia/src/codec/SkCodecImageGenerator.h b/chromium/third_party/skia/src/codec/SkCodecImageGenerator.h
index db08f3ec9c6..f35bae7e547 100644
--- a/chromium/third_party/skia/src/codec/SkCodecImageGenerator.h
+++ b/chromium/third_party/skia/src/codec/SkCodecImageGenerator.h
@@ -8,11 +8,19 @@
#define SkCodecImageGenerator_DEFINED
#include "include/codec/SkCodec.h"
+#include "include/core/SkAlphaType.h"
#include "include/core/SkData.h"
#include "include/core/SkImageGenerator.h"
+#include "include/core/SkRefCnt.h"
+#include "include/core/SkSize.h"
+#include "include/core/SkYUVAPixmaps.h"
+#include <cstddef>
+#include <memory>
#include <optional>
+struct SkImageInfo;
+
class SkCodecImageGenerator : public SkImageGenerator {
public:
/*
diff --git a/chromium/third_party/skia/src/codec/SkColorTable.cpp b/chromium/third_party/skia/src/codec/SkColorTable.cpp
index c15c4524787..cdeb686aa1e 100644
--- a/chromium/third_party/skia/src/codec/SkColorTable.cpp
+++ b/chromium/third_party/skia/src/codec/SkColorTable.cpp
@@ -4,9 +4,11 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "src/codec/SkColorTable.h"
#include "include/private/SkMalloc.h"
-#include "src/codec/SkColorTable.h"
+
+#include <cstring>
SkColorTable::SkColorTable(const SkPMColor colors[], int count) {
SkASSERT(0 == count || colors);
diff --git a/chromium/third_party/skia/src/codec/SkColorTable.h b/chromium/third_party/skia/src/codec/SkColorTable.h
index 66046771a04..b2f4f3f66d9 100644
--- a/chromium/third_party/skia/src/codec/SkColorTable.h
+++ b/chromium/third_party/skia/src/codec/SkColorTable.h
@@ -10,6 +10,7 @@
#include "include/core/SkColor.h"
#include "include/core/SkRefCnt.h"
+#include "include/core/SkTypes.h"
/** \class SkColorTable
diff --git a/chromium/third_party/skia/src/codec/SkEncodedInfo.cpp b/chromium/third_party/skia/src/codec/SkEncodedInfo.cpp
index 75c4d3061d1..56f1a0259da 100644
--- a/chromium/third_party/skia/src/codec/SkEncodedInfo.cpp
+++ b/chromium/third_party/skia/src/codec/SkEncodedInfo.cpp
@@ -7,6 +7,8 @@
#include "include/private/SkEncodedInfo.h"
+#include "modules/skcms/skcms.h"
+
std::unique_ptr<SkEncodedInfo::ICCProfile> SkEncodedInfo::ICCProfile::Make(sk_sp<SkData> data) {
if (data) {
skcms_ICCProfile profile;
diff --git a/chromium/third_party/skia/src/codec/SkHeifCodec.cpp b/chromium/third_party/skia/src/codec/SkHeifCodec.cpp
index ca57633b83d..63bd9bd5727 100644
--- a/chromium/third_party/skia/src/codec/SkHeifCodec.cpp
+++ b/chromium/third_party/skia/src/codec/SkHeifCodec.cpp
@@ -11,6 +11,7 @@
#include "include/codec/SkCodec.h"
#include "include/core/SkStream.h"
#include "include/private/SkColorData.h"
+#include "include/private/SkTemplates.h"
#include "src/codec/SkCodecPriv.h"
#include "src/codec/SkHeifCodec.h"
#include "src/core/SkEndian.h"
diff --git a/chromium/third_party/skia/src/codec/SkIcoCodec.cpp b/chromium/third_party/skia/src/codec/SkIcoCodec.cpp
index 9340744f767..4d21d143737 100644
--- a/chromium/third_party/skia/src/codec/SkIcoCodec.cpp
+++ b/chromium/third_party/skia/src/codec/SkIcoCodec.cpp
@@ -5,17 +5,28 @@
* found in the LICENSE file.
*/
+#include "src/codec/SkIcoCodec.h"
+
#include "include/core/SkData.h"
+#include "include/core/SkImageInfo.h"
+#include "include/core/SkRefCnt.h"
#include "include/core/SkStream.h"
-#include "include/private/SkColorData.h"
-#include "include/private/SkTDArray.h"
+#include "include/private/SkEncodedInfo.h"
+#include "include/private/SkMalloc.h"
+#include "include/private/SkTemplates.h"
#include "src/codec/SkBmpCodec.h"
#include "src/codec/SkCodecPriv.h"
-#include "src/codec/SkIcoCodec.h"
#include "src/codec/SkPngCodec.h"
#include "src/core/SkStreamPriv.h"
#include "src/core/SkTSort.h"
+#include "modules/skcms/skcms.h"
+#include <cstdint>
+#include <cstring>
+#include <utility>
+
+class SkSampler;
+
/*
* Checks the start of the stream to see if the image is an Ico or Cur
*/
diff --git a/chromium/third_party/skia/src/codec/SkIcoCodec.h b/chromium/third_party/skia/src/codec/SkIcoCodec.h
index 4fb5c35bc85..3994ee53e4a 100644
--- a/chromium/third_party/skia/src/codec/SkIcoCodec.h
+++ b/chromium/third_party/skia/src/codec/SkIcoCodec.h
@@ -8,11 +8,19 @@
#define SkIcoCodec_DEFINED
#include "include/codec/SkCodec.h"
-#include "include/core/SkImageInfo.h"
-#include "include/core/SkStream.h"
+#include "include/core/SkEncodedImageFormat.h"
+#include "include/core/SkSize.h"
#include "include/core/SkTypes.h"
#include "include/private/SkTArray.h"
+#include <cstddef>
+#include <memory>
+
+class SkSampler;
+class SkStream;
+struct SkEncodedInfo;
+struct SkImageInfo;
+
/*
* This class implements the decoding for bmp images
*/
diff --git a/chromium/third_party/skia/src/codec/SkJpegCodec.cpp b/chromium/third_party/skia/src/codec/SkJpegCodec.cpp
index 54e39893d8d..4660570cbb3 100644
--- a/chromium/third_party/skia/src/codec/SkJpegCodec.cpp
+++ b/chromium/third_party/skia/src/codec/SkJpegCodec.cpp
@@ -7,21 +7,33 @@
#include "src/codec/SkJpegCodec.h"
+#ifdef SK_CODEC_DECODES_JPEG
#include "include/codec/SkCodec.h"
+#include "include/core/SkAlphaType.h"
+#include "include/core/SkColorType.h"
+#include "include/core/SkData.h"
+#include "include/core/SkImageInfo.h"
+#include "include/core/SkPixmap.h"
+#include "include/core/SkRefCnt.h"
#include "include/core/SkStream.h"
#include "include/core/SkTypes.h"
-#include "include/private/SkColorData.h"
+#include "include/core/SkYUVAInfo.h"
+#include "include/private/SkMalloc.h"
#include "include/private/SkTemplates.h"
#include "include/private/SkTo.h"
+#include "modules/skcms/skcms.h"
#include "src/codec/SkCodecPriv.h"
#include "src/codec/SkJpegDecoderMgr.h"
+#include "src/codec/SkJpegPriv.h"
#include "src/codec/SkParseEncodedOrigin.h"
+#include "src/codec/SkSwizzler.h"
-// stdio is needed for libjpeg-turbo
-#include <stdio.h>
-#include "src/codec/SkJpegUtility.h"
+#include <array>
+#include <csetjmp>
+#include <cstring>
+#include <utility>
-#ifdef SK_CODEC_DECODES_JPEG
+class SkSampler;
// This warning triggers false postives way too often in here.
#if defined(__GNUC__) && !defined(__clang__)
@@ -29,8 +41,8 @@
#endif
extern "C" {
- #include "jerror.h"
#include "jpeglib.h"
+ #include "jmorecfg.h"
}
bool SkJpegCodec::IsJpeg(const void* buffer, size_t bytesRead) {
@@ -258,6 +270,7 @@ SkJpegCodec::SkJpegCodec(SkEncodedInfo&& info, std::unique_ptr<SkStream> stream,
, fColorXformSrcRow(nullptr)
, fSwizzlerSubset(SkIRect::MakeEmpty())
{}
+SkJpegCodec::~SkJpegCodec() = default;
/*
* Return the row bytes of a particular image type and width
diff --git a/chromium/third_party/skia/src/codec/SkJpegCodec.h b/chromium/third_party/skia/src/codec/SkJpegCodec.h
index ab458bcff84..55b145b4a70 100644
--- a/chromium/third_party/skia/src/codec/SkJpegCodec.h
+++ b/chromium/third_party/skia/src/codec/SkJpegCodec.h
@@ -9,12 +9,24 @@
#define SkJpegCodec_DEFINED
#include "include/codec/SkCodec.h"
-#include "include/core/SkImageInfo.h"
-#include "include/core/SkStream.h"
+#include "include/codec/SkEncodedOrigin.h"
+#include "include/core/SkEncodedImageFormat.h"
+#include "include/core/SkRect.h"
+#include "include/core/SkSize.h"
+#include "include/core/SkTypes.h"
+#include "include/core/SkYUVAPixmaps.h"
+#include "include/private/SkEncodedInfo.h"
#include "include/private/SkTemplates.h"
-#include "src/codec/SkSwizzler.h"
+
+#include <cstddef>
+#include <cstdint>
+#include <memory>
class JpegDecoderMgr;
+class SkSampler;
+class SkStream;
+class SkSwizzler;
+struct SkImageInfo;
/*
*
@@ -23,6 +35,8 @@ class JpegDecoderMgr;
*/
class SkJpegCodec : public SkCodec {
public:
+ ~SkJpegCodec() override;
+
static bool IsJpeg(const void*, size_t);
/*
diff --git a/chromium/third_party/skia/src/codec/SkJpegDecoderMgr.cpp b/chromium/third_party/skia/src/codec/SkJpegDecoderMgr.cpp
index 0ada6d8592a..0567e665f4f 100644
--- a/chromium/third_party/skia/src/codec/SkJpegDecoderMgr.cpp
+++ b/chromium/third_party/skia/src/codec/SkJpegDecoderMgr.cpp
@@ -4,15 +4,17 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
#include "src/codec/SkJpegDecoderMgr.h"
+#include "src/codec/SkCodecPriv.h"
#include "src/codec/SkJpegUtility.h"
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
#include "include/android/SkAndroidFrameworkUtils.h"
#endif
+class SkStream;
+
/*
* Print information, warning, and error messages
*/
diff --git a/chromium/third_party/skia/src/codec/SkJpegDecoderMgr.h b/chromium/third_party/skia/src/codec/SkJpegDecoderMgr.h
index f992bf5411e..4ebd23a0cf7 100644
--- a/chromium/third_party/skia/src/codec/SkJpegDecoderMgr.h
+++ b/chromium/third_party/skia/src/codec/SkJpegDecoderMgr.h
@@ -9,14 +9,17 @@
#define SkJpegDecoderMgr_DEFINED
#include "include/codec/SkCodec.h"
-#include "src/codec/SkCodecPriv.h"
-#include <stdio.h>
+#include "include/private/SkEncodedInfo.h"
+#include "include/private/SkNoncopyable.h"
+#include "src/codec/SkJpegPriv.h"
#include "src/codec/SkJpegUtility.h"
extern "C" {
#include "jpeglib.h"
}
+class SkStream;
+
class JpegDecoderMgr : SkNoncopyable {
public:
diff --git a/chromium/third_party/skia/src/codec/SkJpegUtility.cpp b/chromium/third_party/skia/src/codec/SkJpegUtility.cpp
index d313892cc30..b5d155f5467 100644
--- a/chromium/third_party/skia/src/codec/SkJpegUtility.cpp
+++ b/chromium/third_party/skia/src/codec/SkJpegUtility.cpp
@@ -7,7 +7,19 @@
#include "src/codec/SkJpegUtility.h"
+#include "include/core/SkStream.h"
+#include "include/core/SkTypes.h"
+#include "include/private/SkTArray.h"
#include "src/codec/SkCodecPriv.h"
+#include "src/codec/SkJpegPriv.h"
+
+#include <csetjmp>
+#include <cstddef>
+
+extern "C" {
+ #include "jmorecfg.h"
+ #include "jpeglib.h"
+}
/*
* Call longjmp to continue execution on an error
diff --git a/chromium/third_party/skia/src/codec/SkJpegUtility.h b/chromium/third_party/skia/src/codec/SkJpegUtility.h
index 350f15484a7..1296b0704e3 100644
--- a/chromium/third_party/skia/src/codec/SkJpegUtility.h
+++ b/chromium/third_party/skia/src/codec/SkJpegUtility.h
@@ -9,18 +9,17 @@
#ifndef SkJpegUtility_codec_DEFINED
#define SkJpegUtility_codec_DEFINED
-#include "include/core/SkStream.h"
-#include "src/codec/SkJpegPriv.h"
-
-#include <setjmp.h>
-// stdio is needed for jpeglib
-#include <stdio.h>
+#include <cstdint>
extern "C" {
+ // We need to include stdio.h before jpeg because jpeg does not include it, but uses FILE
+ // See https://github.com/libjpeg-turbo/libjpeg-turbo/issues/17
+ #include <stdio.h> // IWYU pragma: keep
#include "jpeglib.h"
- #include "jerror.h"
}
+class SkStream;
+
/*
* Error handling function
*/
diff --git a/chromium/third_party/skia/src/codec/SkMaskSwizzler.cpp b/chromium/third_party/skia/src/codec/SkMaskSwizzler.cpp
index d3f1f36c51c..4866e876a00 100644
--- a/chromium/third_party/skia/src/codec/SkMaskSwizzler.cpp
+++ b/chromium/third_party/skia/src/codec/SkMaskSwizzler.cpp
@@ -5,9 +5,16 @@
* found in the LICENSE file.
*/
+#include "src/codec/SkMaskSwizzler.h"
+
+#include "include/core/SkAlphaType.h"
+#include "include/core/SkColor.h"
+#include "include/core/SkColorType.h"
+#include "include/core/SkImageInfo.h"
+#include "include/core/SkRect.h"
#include "include/private/SkColorData.h"
#include "src/codec/SkCodecPriv.h"
-#include "src/codec/SkMaskSwizzler.h"
+#include "src/codec/SkMasks.h"
static void swizzle_mask16_to_rgba_opaque(
void* dstRow, const uint8_t* srcRow, int width, SkMasks* masks,
diff --git a/chromium/third_party/skia/src/codec/SkMaskSwizzler.h b/chromium/third_party/skia/src/codec/SkMaskSwizzler.h
index c7c44fd354f..4cac41905ca 100644
--- a/chromium/third_party/skia/src/codec/SkMaskSwizzler.h
+++ b/chromium/third_party/skia/src/codec/SkMaskSwizzler.h
@@ -7,10 +7,14 @@
#ifndef SkMaskSwizzler_DEFINED
#define SkMaskSwizzler_DEFINED
+#include "include/codec/SkCodec.h"
#include "include/core/SkTypes.h"
-#include "src/codec/SkMasks.h"
#include "src/codec/SkSampler.h"
-#include "src/codec/SkSwizzler.h"
+
+#include <cstdint>
+
+class SkMasks;
+struct SkImageInfo;
/*
*
diff --git a/chromium/third_party/skia/src/codec/SkMasks.cpp b/chromium/third_party/skia/src/codec/SkMasks.cpp
index 90b7d527fed..c1161671740 100644
--- a/chromium/third_party/skia/src/codec/SkMasks.cpp
+++ b/chromium/third_party/skia/src/codec/SkMasks.cpp
@@ -4,10 +4,9 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "src/codec/SkMasks.h"
-#include "include/core/SkTypes.h"
#include "src/codec/SkCodecPriv.h"
-#include "src/codec/SkMasks.h"
/*
*
diff --git a/chromium/third_party/skia/src/codec/SkMasks.h b/chromium/third_party/skia/src/codec/SkMasks.h
index 07c64ca7e6a..99d1a9bed73 100644
--- a/chromium/third_party/skia/src/codec/SkMasks.h
+++ b/chromium/third_party/skia/src/codec/SkMasks.h
@@ -9,6 +9,8 @@
#include "include/core/SkTypes.h"
+#include <cstdint>
+
// Contains useful mask routines for SkMaskSwizzler
class SkMasks {
public:
diff --git a/chromium/third_party/skia/src/codec/SkParseEncodedOrigin.cpp b/chromium/third_party/skia/src/codec/SkParseEncodedOrigin.cpp
index 3e5805c2201..fa51d9fc882 100644
--- a/chromium/third_party/skia/src/codec/SkParseEncodedOrigin.cpp
+++ b/chromium/third_party/skia/src/codec/SkParseEncodedOrigin.cpp
@@ -5,9 +5,16 @@
* found in the LICENSE file.
*/
+#include "include/codec/SkEncodedOrigin.h"
+
#include "include/core/SkTypes.h"
+#include "include/private/SkTo.h"
#include "src/codec/SkCodecPriv.h"
+#include <algorithm>
+#include <cstddef>
+#include <cstdint>
+
static bool parse_encoded_origin(const uint8_t* exifData, size_t data_length, uint64_t offset,
bool littleEndian, bool is_root, SkEncodedOrigin* orientation) {
// Require that the marker is at least large enough to contain the number of entries.
diff --git a/chromium/third_party/skia/src/codec/SkPngCodec.cpp b/chromium/third_party/skia/src/codec/SkPngCodec.cpp
index b11c679583e..458da5eedf4 100644
--- a/chromium/third_party/skia/src/codec/SkPngCodec.cpp
+++ b/chromium/third_party/skia/src/codec/SkPngCodec.cpp
@@ -5,30 +5,43 @@
* found in the LICENSE file.
*/
-#include "include/core/SkBitmap.h"
-#include "include/core/SkColorSpace.h"
-#include "include/core/SkMath.h"
-#include "include/core/SkPoint3.h"
+#include "src/codec/SkPngCodec.h"
+
+#include "include/core/SkAlphaType.h"
+#include "include/core/SkColor.h"
+#include "include/core/SkColorType.h"
+#include "include/core/SkData.h"
+#include "include/core/SkImageInfo.h"
+#include "include/core/SkPngChunkReader.h"
+#include "include/core/SkRect.h"
#include "include/core/SkSize.h"
#include "include/core/SkStream.h"
-#include "include/private/SkColorData.h"
-#include "include/private/SkMacros.h"
+#include "include/core/SkTypes.h"
+#include "include/private/SkEncodedInfo.h"
+#include "include/private/SkNoncopyable.h"
#include "include/private/SkTemplates.h"
+#include "modules/skcms/skcms.h"
#include "src/codec/SkCodecPriv.h"
#include "src/codec/SkColorTable.h"
-#include "src/codec/SkPngCodec.h"
#include "src/codec/SkPngPriv.h"
#include "src/codec/SkSwizzler.h"
#include "src/core/SkOpts.h"
-#include <png.h>
+#include <csetjmp>
#include <algorithm>
+#include <cstring>
+#include <utility>
+
+#include <png.h>
+#include <pngconf.h>
+
+class SkSampler;
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
#include "include/android/SkAndroidFrameworkUtils.h"
#endif
-// This warning triggers false postives way too often in here.
+// This warning triggers false positives way too often in here.
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic ignored "-Wclobbered"
#endif
diff --git a/chromium/third_party/skia/src/codec/SkPngCodec.h b/chromium/third_party/skia/src/codec/SkPngCodec.h
index 67c64e1a6c9..f48e83e2ed1 100644
--- a/chromium/third_party/skia/src/codec/SkPngCodec.h
+++ b/chromium/third_party/skia/src/codec/SkPngCodec.h
@@ -9,13 +9,20 @@
#include "include/codec/SkCodec.h"
#include "include/core/SkEncodedImageFormat.h"
-#include "include/core/SkImageInfo.h"
-#include "include/core/SkPngChunkReader.h"
#include "include/core/SkRefCnt.h"
-#include "src/codec/SkColorTable.h"
-#include "src/codec/SkSwizzler.h"
+#include "include/private/SkTemplates.h"
+#include <cstddef>
+#include <cstdint>
+#include <memory>
+
+class SkColorTable;
+class SkPngChunkReader;
+class SkSampler;
class SkStream;
+class SkSwizzler;
+struct SkEncodedInfo;
+struct SkImageInfo;
class SkPngCodec : public SkCodec {
public:
diff --git a/chromium/third_party/skia/src/codec/SkRawCodec.cpp b/chromium/third_party/skia/src/codec/SkRawCodec.cpp
index c0893d5d84c..2b16ed0ab23 100644
--- a/chromium/third_party/skia/src/codec/SkRawCodec.cpp
+++ b/chromium/third_party/skia/src/codec/SkRawCodec.cpp
@@ -5,41 +5,61 @@
* found in the LICENSE file.
*/
+#include "src/codec/SkRawCodec.h"
+
#include "include/codec/SkCodec.h"
+#include "include/core/SkColorSpace.h"
#include "include/core/SkData.h"
+#include "include/core/SkImageInfo.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkStream.h"
#include "include/core/SkTypes.h"
-#include "include/private/SkColorData.h"
+#include "include/private/SkEncodedInfo.h"
#include "include/private/SkMutex.h"
#include "include/private/SkTArray.h"
#include "include/private/SkTemplates.h"
+#include "modules/skcms/skcms.h"
#include "src/codec/SkCodecPriv.h"
#include "src/codec/SkJpegCodec.h"
-#include "src/codec/SkRawCodec.h"
-#include "src/core/SkColorSpacePriv.h"
#include "src/core/SkStreamPriv.h"
#include "src/core/SkTaskGroup.h"
+#include <algorithm>
+#include <cmath>
+#include <cstdint>
+#include <functional>
+#include <limits>
+#include <memory>
+#include <utility>
+#include <vector>
+
#include "dng_area_task.h"
#include "dng_color_space.h"
#include "dng_errors.h"
#include "dng_exceptions.h"
#include "dng_host.h"
+#include "dng_image.h"
#include "dng_info.h"
#include "dng_memory.h"
+#include "dng_mosaic_info.h"
+#include "dng_negative.h"
+#include "dng_pixel_buffer.h"
+#include "dng_point.h"
+#include "dng_rational.h"
+#include "dng_rect.h"
#include "dng_render.h"
+#include "dng_sdk_limits.h"
#include "dng_stream.h"
+#include "dng_tag_types.h"
+#include "dng_types.h"
+#include "dng_utils.h"
#include "src/piex.h"
-
-#include <cmath> // for std::round,floor,ceil
-#include <limits>
-#include <memory>
+#include "src/piex_types.h"
namespace {
-// Caluclates the number of tiles of tile_size that fit into the area in vertical and horizontal
+// Calculates the number of tiles of tile_size that fit into the area in vertical and horizontal
// directions.
dng_point num_tiles_in_area(const dng_point &areaSize,
const dng_point_real64 &tileSize) {
diff --git a/chromium/third_party/skia/src/codec/SkRawCodec.h b/chromium/third_party/skia/src/codec/SkRawCodec.h
index 1551cf98e54..267341c6756 100644
--- a/chromium/third_party/skia/src/codec/SkRawCodec.h
+++ b/chromium/third_party/skia/src/codec/SkRawCodec.h
@@ -9,12 +9,16 @@
#define SkRawCodec_DEFINED
#include "include/codec/SkCodec.h"
-#include "include/core/SkColorSpace.h"
-#include "include/core/SkImageInfo.h"
+#include "include/core/SkEncodedImageFormat.h"
+#include "include/core/SkSize.h"
#include "include/core/SkTypes.h"
+#include <cstddef>
+#include <memory>
+
class SkDngImage;
class SkStream;
+struct SkImageInfo;
/*
*
diff --git a/chromium/third_party/skia/src/codec/SkSampledCodec.cpp b/chromium/third_party/skia/src/codec/SkSampledCodec.cpp
index c5d7790b34b..57d24daf4c8 100644
--- a/chromium/third_party/skia/src/codec/SkSampledCodec.cpp
+++ b/chromium/third_party/skia/src/codec/SkSampledCodec.cpp
@@ -5,11 +5,15 @@
* found in the LICENSE file.
*/
+#include "src/codec/SkSampledCodec.h"
+
#include "include/codec/SkCodec.h"
-#include "include/core/SkMath.h"
+#include "include/core/SkEncodedImageFormat.h"
+#include "include/core/SkImageInfo.h"
+#include "include/core/SkRect.h"
+#include "include/core/SkTypes.h"
#include "include/private/SkTemplates.h"
#include "src/codec/SkCodecPriv.h"
-#include "src/codec/SkSampledCodec.h"
#include "src/codec/SkSampler.h"
#include "src/core/SkMathPriv.h"
diff --git a/chromium/third_party/skia/src/codec/SkSampledCodec.h b/chromium/third_party/skia/src/codec/SkSampledCodec.h
index e9c643d2029..f30edd05533 100644
--- a/chromium/third_party/skia/src/codec/SkSampledCodec.h
+++ b/chromium/third_party/skia/src/codec/SkSampledCodec.h
@@ -9,6 +9,12 @@
#include "include/codec/SkAndroidCodec.h"
#include "include/codec/SkCodec.h"
+#include "include/core/SkSize.h"
+
+#include <cstddef>
+
+struct SkIRect;
+struct SkImageInfo;
/**
* This class implements the functionality of SkAndroidCodec. Scaling will
diff --git a/chromium/third_party/skia/src/codec/SkSampler.cpp b/chromium/third_party/skia/src/codec/SkSampler.cpp
index e84a76ca466..19a7d11a8a4 100644
--- a/chromium/third_party/skia/src/codec/SkSampler.cpp
+++ b/chromium/third_party/skia/src/codec/SkSampler.cpp
@@ -5,11 +5,18 @@
* found in the LICENSE file.
*/
+#include "src/codec/SkSampler.h"
+
#include "include/codec/SkCodec.h"
+#include "include/core/SkColorType.h"
+#include "include/core/SkImageInfo.h"
+#include "include/private/SkTemplates.h"
#include "src/codec/SkCodecPriv.h"
-#include "src/codec/SkSampler.h"
#include "src/core/SkOpts.h"
+#include <cstdint>
+#include <cstring>
+
void SkSampler::Fill(const SkImageInfo& info, void* dst, size_t rowBytes,
SkCodec::ZeroInitialized zeroInit) {
SkASSERT(dst != nullptr);
diff --git a/chromium/third_party/skia/src/codec/SkSampler.h b/chromium/third_party/skia/src/codec/SkSampler.h
index d03b80aa26f..0ad7b85ae4c 100644
--- a/chromium/third_party/skia/src/codec/SkSampler.h
+++ b/chromium/third_party/skia/src/codec/SkSampler.h
@@ -9,8 +9,13 @@
#include "include/codec/SkCodec.h"
#include "include/core/SkTypes.h"
+#include "include/private/SkNoncopyable.h"
#include "src/codec/SkCodecPriv.h"
+#include <cstddef>
+
+struct SkImageInfo;
+
class SkSampler : public SkNoncopyable {
public:
/**
diff --git a/chromium/third_party/skia/src/codec/SkSwizzler.cpp b/chromium/third_party/skia/src/codec/SkSwizzler.cpp
index ac2bfc026e5..a5afe48ed53 100644
--- a/chromium/third_party/skia/src/codec/SkSwizzler.cpp
+++ b/chromium/third_party/skia/src/codec/SkSwizzler.cpp
@@ -5,17 +5,27 @@
* found in the LICENSE file.
*/
+#include "src/codec/SkSwizzler.h"
+
+#include "include/core/SkAlphaType.h"
+#include "include/core/SkColorPriv.h"
+#include "include/core/SkColorType.h"
+#include "include/core/SkImageInfo.h"
+#include "include/core/SkMath.h"
+#include "include/core/SkRect.h"
#include "include/private/SkColorData.h"
+#include "include/private/SkEncodedInfo.h"
#include "include/private/SkHalf.h"
#include "include/private/SkTemplates.h"
#include "src/codec/SkCodecPriv.h"
-#include "src/codec/SkSwizzler.h"
#include "src/core/SkOpts.h"
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
#include "include/android/SkAndroidFrameworkUtils.h"
#endif
+#include <cstring>
+
static void copy(void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, int offset,
const SkPMColor ctable[]) {
// This function must not be called if we are sampling. If we are not
diff --git a/chromium/third_party/skia/src/codec/SkSwizzler.h b/chromium/third_party/skia/src/codec/SkSwizzler.h
index c71b93a4645..e048bee3c8c 100644
--- a/chromium/third_party/skia/src/codec/SkSwizzler.h
+++ b/chromium/third_party/skia/src/codec/SkSwizzler.h
@@ -10,9 +10,17 @@
#include "include/codec/SkCodec.h"
#include "include/core/SkColor.h"
-#include "include/core/SkImageInfo.h"
+#include "include/core/SkTypes.h"
#include "src/codec/SkSampler.h"
+#include <cstddef>
+#include <cstdint>
+#include <memory>
+
+struct SkEncodedInfo;
+struct SkIRect;
+struct SkImageInfo;
+
class SkSwizzler : public SkSampler {
public:
/**
diff --git a/chromium/third_party/skia/src/codec/SkWbmpCodec.cpp b/chromium/third_party/skia/src/codec/SkWbmpCodec.cpp
index 8190c503221..079ff9ceec6 100644
--- a/chromium/third_party/skia/src/codec/SkWbmpCodec.cpp
+++ b/chromium/third_party/skia/src/codec/SkWbmpCodec.cpp
@@ -8,12 +8,16 @@
#include "src/codec/SkWbmpCodec.h"
#include "include/codec/SkCodec.h"
-#include "include/core/SkData.h"
+#include "include/core/SkColorType.h"
+#include "include/core/SkImageInfo.h"
+#include "include/core/SkSize.h"
#include "include/core/SkStream.h"
-#include "include/private/SkColorData.h"
+#include "include/private/SkEncodedInfo.h"
#include "include/private/SkTo.h"
+#include "modules/skcms/skcms.h"
#include "src/codec/SkCodecPriv.h"
-#include "src/codec/SkColorTable.h"
+
+#include <utility>
// Each bit represents a pixel, so width is actually a number of bits.
// A row will always be stored in bytes, so we round width up to the
diff --git a/chromium/third_party/skia/src/codec/SkWbmpCodec.h b/chromium/third_party/skia/src/codec/SkWbmpCodec.h
index dbf4ca4c38f..7a97a2eddec 100644
--- a/chromium/third_party/skia/src/codec/SkWbmpCodec.h
+++ b/chromium/third_party/skia/src/codec/SkWbmpCodec.h
@@ -9,9 +9,20 @@
#define SkCodec_wbmp_DEFINED
#include "include/codec/SkCodec.h"
-#include "include/core/SkColorSpace.h"
+#include "include/core/SkEncodedImageFormat.h"
+#include "include/core/SkTypes.h"
+#include "include/private/SkTemplates.h"
#include "src/codec/SkSwizzler.h"
+#include <cstddef>
+#include <cstdint>
+#include <memory>
+
+class SkSampler;
+class SkStream;
+struct SkEncodedInfo;
+struct SkImageInfo;
+
class SkWbmpCodec final : public SkCodec {
public:
static bool IsWbmp(const void*, size_t);
diff --git a/chromium/third_party/skia/src/codec/SkWebpCodec.cpp b/chromium/third_party/skia/src/codec/SkWebpCodec.cpp
index 2f7a2f0c35d..80ff40d01b0 100644
--- a/chromium/third_party/skia/src/codec/SkWebpCodec.cpp
+++ b/chromium/third_party/skia/src/codec/SkWebpCodec.cpp
@@ -8,16 +8,28 @@
#include "src/codec/SkWebpCodec.h"
#include "include/codec/SkCodecAnimation.h"
+#include "include/core/SkAlphaType.h"
#include "include/core/SkBitmap.h"
-#include "include/core/SkCanvas.h"
+#include "include/core/SkColorType.h"
+#include "include/core/SkImageInfo.h"
+#include "include/core/SkMath.h"
+#include "include/core/SkRect.h"
+#include "include/core/SkSize.h"
+#include "include/core/SkStream.h"
+#include "include/private/SkTFitsIn.h"
#include "include/private/SkTemplates.h"
#include "include/private/SkTo.h"
-#include "src/codec/SkCodecPriv.h"
+#include "modules/skcms/skcms.h"
#include "src/codec/SkParseEncodedOrigin.h"
#include "src/codec/SkSampler.h"
#include "src/core/SkRasterPipeline.h"
#include "src/core/SkStreamPriv.h"
+#include <algorithm>
+#include <cstdint>
+#include <cstring>
+#include <utility>
+
// A WebP decoder on top of (subset of) libwebp
// For more information on WebP image format, and libwebp library, see:
// https://code.google.com/speed/webp/
@@ -28,7 +40,7 @@
// updated accordingly. Here, we enforce using local copy in webp sub-directory.
#include "webp/decode.h"
#include "webp/demux.h"
-#include "webp/encode.h"
+#include "webp/mux_types.h"
bool SkWebpCodec::IsWebp(const void* buf, size_t bytesRead) {
// WEBP starts with the following:
diff --git a/chromium/third_party/skia/src/codec/SkWebpCodec.h b/chromium/third_party/skia/src/codec/SkWebpCodec.h
index 213ff894c3b..f6d0de35e68 100644
--- a/chromium/third_party/skia/src/codec/SkWebpCodec.h
+++ b/chromium/third_party/skia/src/codec/SkWebpCodec.h
@@ -9,15 +9,24 @@
#define SkWebpCodec_DEFINED
#include "include/codec/SkCodec.h"
+#include "include/codec/SkEncodedOrigin.h"
+#include "include/core/SkData.h"
#include "include/core/SkEncodedImageFormat.h"
-#include "include/core/SkImageInfo.h"
+#include "include/core/SkRefCnt.h"
#include "include/core/SkTypes.h"
+#include "include/private/SkEncodedInfo.h"
+#include "include/private/SkTemplates.h"
#include "src/codec/SkFrameHolder.h"
#include "src/codec/SkScalingCodec.h"
+#include <cstddef>
+#include <memory>
#include <vector>
class SkStream;
+struct SkIRect;
+struct SkImageInfo;
+
extern "C" {
struct WebPDemuxer;
void WebPDemuxDelete(WebPDemuxer* dmux);
diff --git a/chromium/third_party/skia/src/codec/SkWuffsCodec.cpp b/chromium/third_party/skia/src/codec/SkWuffsCodec.cpp
index 1e1e1393542..de62ffc6903 100644
--- a/chromium/third_party/skia/src/codec/SkWuffsCodec.cpp
+++ b/chromium/third_party/skia/src/codec/SkWuffsCodec.cpp
@@ -7,10 +7,27 @@
#include "src/codec/SkWuffsCodec.h"
+#include "include/codec/SkCodecAnimation.h"
+#include "include/core/SkAlphaType.h"
#include "include/core/SkBitmap.h"
+#include "include/core/SkBlendMode.h"
+#include "include/core/SkColorType.h"
+#include "include/core/SkData.h"
+#include "include/core/SkEncodedImageFormat.h"
+#include "include/core/SkImageInfo.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"
+#include "include/core/SkPixmap.h"
+#include "include/core/SkRect.h"
+#include "include/core/SkSamplingOptions.h"
+#include "include/core/SkSize.h"
+#include "include/core/SkStream.h"
+#include "include/core/SkTypes.h"
+#include "include/private/SkEncodedInfo.h"
#include "include/private/SkMalloc.h"
+#include "include/private/SkTo.h"
+#include "modules/skcms/skcms.h"
+#include "src/codec/SkCodecPriv.h"
#include "src/codec/SkFrameHolder.h"
#include "src/codec/SkSampler.h"
#include "src/codec/SkScalingCodec.h"
@@ -18,9 +35,12 @@
#include "src/core/SkMatrixProvider.h"
#include "src/core/SkRasterClip.h"
#include "src/core/SkStreamPriv.h"
-#include "src/core/SkUtils.h"
-#include <limits.h>
+#include <climits>
+#include <cstdint>
+#include <cstring>
+#include <utility>
+#include <vector>
// Documentation on the Wuffs language and standard library (in general) and
// its image decoding API (in particular) is at:
diff --git a/chromium/third_party/skia/src/codec/SkWuffsCodec.h b/chromium/third_party/skia/src/codec/SkWuffsCodec.h
index 373c89c1317..805dc0cc0e3 100644
--- a/chromium/third_party/skia/src/codec/SkWuffsCodec.h
+++ b/chromium/third_party/skia/src/codec/SkWuffsCodec.h
@@ -10,6 +10,12 @@
#include "include/codec/SkCodec.h"
+#include <cstddef>
+#include <memory>
+
+class SkStream;
+
+
// These functions' types match DecoderProc in SkCodec.cpp.
bool SkWuffsCodec_IsFormat(const void*, size_t);
std::unique_ptr<SkCodec> SkWuffsCodec_MakeFromStream(std::unique_ptr<SkStream>, SkCodec::Result*);
diff --git a/chromium/third_party/skia/src/core/BUILD.bazel b/chromium/third_party/skia/src/core/BUILD.bazel
index a36a17cc611..37236a140af 100644
--- a/chromium/third_party/skia/src/core/BUILD.bazel
+++ b/chromium/third_party/skia/src/core/BUILD.bazel
@@ -26,8 +26,6 @@ CORE_FILES = [
"SkAutoPixmapStorage.cpp",
"SkAutoPixmapStorage.h",
"SkBBHFactory.cpp",
- "SkBigPicture.cpp",
- "SkBigPicture.h",
"SkBitmap.cpp",
"SkBitmapCache.cpp",
"SkBitmapCache.h",
@@ -74,7 +72,6 @@ CORE_FILES = [
"SkColorFilterBase.h",
"SkColorFilterPriv.h",
"SkColorFilter_Matrix.cpp",
- "SkColorFilter_Matrix.h",
"SkColorSpace.cpp",
"SkColorSpacePriv.h",
"SkColorSpaceXformSteps.cpp",
@@ -134,6 +131,7 @@ CORE_FILES = [
"SkFontDescriptor.cpp",
"SkFontDescriptor.h",
"SkFontMgr.cpp",
+ "SkFontMgrPriv.h",
"SkFontPriv.h",
"SkFontStream.cpp",
"SkFontStream.h",
@@ -148,8 +146,6 @@ CORE_FILES = [
"SkGlyph.h",
"SkGlyphBuffer.cpp",
"SkGlyphBuffer.h",
- "SkGlyphRun.cpp",
- "SkGlyphRun.h",
"SkGlyphRunPainter.cpp",
"SkGlyphRunPainter.h",
"SkGpuBlurUtils.cpp",
@@ -206,15 +202,12 @@ CORE_FILES = [
"SkMesh.cpp",
"SkMeshPriv.h",
"SkMessageBus.h",
- "SkMiniRecorder.cpp",
- "SkMiniRecorder.h",
"SkMipmap.cpp",
"SkMipmap.h",
"SkMipmapAccessor.cpp",
"SkMipmapAccessor.h",
"SkMipmapBuilder.h",
"SkModeColorFilter.cpp",
- "SkModeColorFilter.h",
"SkNextID.h",
"SkOSFile.h",
"SkOpts.cpp",
@@ -235,20 +228,7 @@ CORE_FILES = [
"SkPathPriv.h",
"SkPathRef.cpp",
"SkPath_serial.cpp",
- "SkPicture.cpp",
- "SkPictureCommon.h",
- "SkPictureData.cpp",
- "SkPictureData.h",
- "SkPictureFlat.cpp",
- "SkPictureFlat.h",
- "SkPictureImageGenerator.cpp",
- "SkPicturePlayback.cpp",
- "SkPicturePlayback.h",
"SkPicturePriv.h",
- "SkPictureRecord.cpp",
- "SkPictureRecord.h",
- "SkPictureRecorder.cpp",
- "SkPipelineData.h",
"SkPixelRef.cpp",
"SkPixelRefPriv.h",
"SkPixmap.cpp",
@@ -280,10 +260,6 @@ CORE_FILES = [
"SkRecordOpts.cpp",
"SkRecordOpts.h",
"SkRecordPattern.h",
- "SkRecordedDrawable.cpp",
- "SkRecordedDrawable.h",
- "SkRecorder.cpp",
- "SkRecorder.h",
"SkRecords.cpp",
"SkRecords.h",
"SkRect.cpp",
@@ -293,6 +269,7 @@ CORE_FILES = [
"SkRegion_path.cpp",
"SkResourceCache.cpp",
"SkResourceCache.h",
+ "SkRuntimeEffectDictionary.h",
"SkRuntimeEffectPriv.h",
"SkSafeMath.h",
"SkSafeRange.h",
@@ -311,6 +288,7 @@ CORE_FILES = [
"SkScan_Antihair.cpp",
"SkScan_Hairline.cpp",
"SkScan_Path.cpp",
+ "SkScopeExit.h",
"SkSemaphore.cpp",
"SkSharedMutex.cpp",
"SkSharedMutex.h",
@@ -326,8 +304,6 @@ CORE_FILES = [
"SkStreamPriv.h",
"SkStrikeCache.cpp",
"SkStrikeCache.h",
- "SkStrikeForGPU.cpp",
- "SkStrikeForGPU.h",
"SkStrikeSpec.cpp",
"SkStrikeSpec.h",
"SkString.cpp",
@@ -406,15 +382,17 @@ split_srcs_and_hdrs(
# These files are only needed if SkSL is enabled (GPU backend or SkVM).
SKSL_FILES = [
- "SkCombinationBuilder.cpp",
+ "SkKeyContext.cpp",
"SkKeyContext.h",
"SkKeyHelpers.cpp",
"SkKeyHelpers.h",
"SkPaintParamsKey.cpp",
"SkPaintParamsKey.h",
+ "SkPipelineData.cpp",
+ "SkPipelineData.h",
"SkRuntimeEffect.cpp",
+ "SkSLTypeShared.cpp",
"SkSLTypeShared.h",
- "SkScopeExit.h",
"SkShaderCodeDictionary.cpp",
"SkShaderCodeDictionary.h",
"SkUniform.h",
@@ -425,10 +403,50 @@ split_srcs_and_hdrs(
files = SKSL_FILES,
)
+# Mapped to skia_precompile_sources variable in //gn/core.gni.
+PRECOMPILE_FILES = [
+ "SkCombinationBuilder.cpp",
+ "SkFactoryFunctions.cpp",
+ "SkFactoryFunctions.h",
+ "SkPrecompile.h",
+]
+
+split_srcs_and_hdrs(
+ name = "precompile",
+ files = PRECOMPILE_FILES,
+)
+
+# SkPicture files are maintained as a separate filegroups for backward compatability
+# with GNI files. This allows the generation of skia_skpicture_sources GNI file list.
+SKPICTURE_FILES = [
+ "SkBigPicture.cpp",
+ "SkBigPicture.h",
+ "SkPicture.cpp",
+ "SkPictureData.cpp",
+ "SkPictureData.h",
+ "SkPictureFlat.cpp",
+ "SkPictureFlat.h",
+ "SkPictureImageGenerator.cpp",
+ "SkPicturePlayback.cpp",
+ "SkPicturePlayback.h",
+ "SkPictureRecord.cpp",
+ "SkPictureRecord.h",
+ "SkPictureRecorder.cpp",
+ "SkRecordedDrawable.cpp",
+ "SkRecordedDrawable.h",
+ "SkRecorder.cpp",
+ "SkRecorder.h",
+]
+
+split_srcs_and_hdrs(
+ name = "skpicture",
+ files = SKPICTURE_FILES,
+)
+
filegroup(
name = "srcs",
- srcs = [":core_srcs"] + select({
- "//bazel/common_config_settings:needs_sksl": [
+ srcs = [":core_srcs"] + [":skpicture_srcs"] + select({
+ "//src/sksl:needs_sksl": [
":sksl_srcs",
],
"//conditions:default": [],
@@ -438,8 +456,8 @@ filegroup(
filegroup(
name = "private_hdrs",
- srcs = [":core_hdrs"] + select({
- "//bazel/common_config_settings:needs_sksl": [
+ srcs = [":core_hdrs"] + [":skpicture_hdrs"] + select({
+ "//src/sksl:needs_sksl": [
":sksl_hdrs",
],
"//conditions:default": [],
diff --git a/chromium/third_party/skia/src/core/SkATrace.h b/chromium/third_party/skia/src/core/SkATrace.h
index db05a6d5ac9..e0e642aa101 100644
--- a/chromium/third_party/skia/src/core/SkATrace.h
+++ b/chromium/third_party/skia/src/core/SkATrace.h
@@ -44,6 +44,9 @@ public:
return category;
}
+ // Atrace does not yet support splitting up trace output into sections.
+ void newTracingSection(const char* name) override {}
+
private:
SkATrace(const SkATrace&) = delete;
SkATrace& operator=(const SkATrace&) = delete;
diff --git a/chromium/third_party/skia/src/core/SkAdvancedTypefaceMetrics.h b/chromium/third_party/skia/src/core/SkAdvancedTypefaceMetrics.h
index 178ff27f46d..4c05ce21844 100644
--- a/chromium/third_party/skia/src/core/SkAdvancedTypefaceMetrics.h
+++ b/chromium/third_party/skia/src/core/SkAdvancedTypefaceMetrics.h
@@ -48,9 +48,10 @@ struct SkAdvancedTypefaceMetrics {
FontType fType = kOther_Font;
enum FontFlags : uint8_t {
- kVariable_FontFlag = 0x01, //!<May be true for Type1, CFF, or TrueType fonts.
- kNotEmbeddable_FontFlag = 0x02, //!<May not be embedded.
- kNotSubsettable_FontFlag = 0x04, //!<May not be subset.
+ kVariable_FontFlag = 1 << 0, //!<May be true for Type1, CFF, or TrueType fonts.
+ kNotEmbeddable_FontFlag = 1 << 1, //!<May not be embedded.
+ kNotSubsettable_FontFlag = 1 << 2, //!<May not be subset.
+ kAltDataFormat_FontFlag = 1 << 3, //!<Data compressed. Table access may still work.
};
FontFlags fFlags = (FontFlags)0; // Global font flags.
diff --git a/chromium/third_party/skia/src/core/SkAnalyticEdge.cpp b/chromium/third_party/skia/src/core/SkAnalyticEdge.cpp
index a15b7f8df5d..e684de42be3 100644
--- a/chromium/third_party/skia/src/core/SkAnalyticEdge.cpp
+++ b/chromium/third_party/skia/src/core/SkAnalyticEdge.cpp
@@ -270,6 +270,7 @@ bool SkAnalyticEdge::setLine(const SkPoint& p0, const SkPoint& p1) {
fDY = dx == 0 || slope == 0 ? SK_MaxS32 : absSlope < kInverseTableSize
? quick_inverse(absSlope)
: SkAbs32(quick_div(dy, dx));
+ fEdgeType = kLine_Type;
fCurveCount = 0;
fWinding = SkToS8(winding);
fCurveShift = 0;
@@ -352,6 +353,7 @@ bool SkAnalyticQuadraticEdge::setQuadratic(const SkPoint pts[3]) {
fQEdge.fQLastY = SnapY(fQEdge.fQLastY);
fWinding = fQEdge.fWinding;
+ fEdgeType = kQuad_Type;
fCurveCount = fQEdge.fCurveCount;
fCurveShift = fQEdge.fCurveShift;
@@ -444,6 +446,7 @@ bool SkAnalyticCubicEdge::setCubic(const SkPoint pts[4], bool sortY) {
fCEdge.fCLastY = SnapY(fCEdge.fCLastY);
fWinding = fCEdge.fWinding;
+ fEdgeType = kCubic_Type;
fCurveCount = fCEdge.fCurveCount;
fCurveShift = fCEdge.fCurveShift;
fCubicDShift = fCEdge.fCubicDShift;
diff --git a/chromium/third_party/skia/src/core/SkAnalyticEdge.h b/chromium/third_party/skia/src/core/SkAnalyticEdge.h
index 85d012234a4..113439ebd7f 100644
--- a/chromium/third_party/skia/src/core/SkAnalyticEdge.h
+++ b/chromium/third_party/skia/src/core/SkAnalyticEdge.h
@@ -41,6 +41,8 @@ struct SkAnalyticEdge {
SkFixed fSavedY; // For deferred blitting
SkFixed fSavedDY; // For deferred blitting
+ Type fEdgeType; // Remembers the *initial* edge type
+
int8_t fCurveCount; // only used by kQuad(+) and kCubic(-)
uint8_t fCurveShift; // appled to all Dx/DDx/DDDx except for fCubicDShift exception
uint8_t fCubicDShift; // applied to fCDx and fCDy only in cubic
diff --git a/chromium/third_party/skia/src/core/SkArenaAlloc.cpp b/chromium/third_party/skia/src/core/SkArenaAlloc.cpp
index 764d4c263e5..cdb15436261 100644
--- a/chromium/third_party/skia/src/core/SkArenaAlloc.cpp
+++ b/chromium/third_party/skia/src/core/SkArenaAlloc.cpp
@@ -5,10 +5,15 @@
* found in the LICENSE file.
*/
+#include "include/private/SkMalloc.h"
#include "src/core/SkArenaAlloc.h"
+
#include <algorithm>
#include <new>
+#include "include/private/SkMalloc.h"
+#include "src/core/SkASAN.h"
+
static char* end_chain(char*) { return nullptr; }
SkArenaAlloc::SkArenaAlloc(char* block, size_t size, size_t firstHeapAllocation)
@@ -23,6 +28,7 @@ SkArenaAlloc::SkArenaAlloc(char* block, size_t size, size_t firstHeapAllocation)
if (fCursor != nullptr) {
this->installFooter(end_chain, 0);
+ sk_asan_poison_memory_region(fCursor, fEnd - fCursor);
}
}
@@ -61,11 +67,10 @@ char* SkArenaAlloc::NextBlock(char* footerEnd) {
char* next;
memmove(&next, objEnd, sizeof(char*));
RunDtorsOnBlock(next);
- delete [] objEnd;
+ sk_free(objEnd);
return nullptr;
}
-
void SkArenaAlloc::ensureSpace(uint32_t size, uint32_t alignment) {
constexpr uint32_t headerSize = sizeof(Footer) + sizeof(ptrdiff_t);
constexpr uint32_t maxSize = std::numeric_limits<uint32_t>::max();
@@ -88,12 +93,23 @@ void SkArenaAlloc::ensureSpace(uint32_t size, uint32_t alignment) {
allocationSize = (allocationSize + mask) & ~mask;
}
- char* newBlock = new char[allocationSize];
+ char* newBlock = static_cast<char*>(sk_malloc_throw(allocationSize, 1));
+ size_t actualAllocatedSize = sk_malloc_usable_size(newBlock);
+ // 0 means that the allocated size is not available, don't change anything
+ // then.
+ if (actualAllocatedSize) {
+ AssertRelease(actualAllocatedSize >= allocationSize);
+ allocationSize = actualAllocatedSize;
+ }
auto previousDtor = fDtorCursor;
fCursor = newBlock;
fDtorCursor = newBlock;
fEnd = fCursor + allocationSize;
+
+ // poison the unused bytes in the block.
+ sk_asan_poison_memory_region(fCursor, fEnd - fCursor);
+
this->installRaw(previousDtor);
this->installFooter(NextBlock, 0);
}
diff --git a/chromium/third_party/skia/src/core/SkArenaAlloc.h b/chromium/third_party/skia/src/core/SkArenaAlloc.h
index c8b81d58bd1..8e4707523b4 100644
--- a/chromium/third_party/skia/src/core/SkArenaAlloc.h
+++ b/chromium/third_party/skia/src/core/SkArenaAlloc.h
@@ -11,6 +11,7 @@
#include "include/core/SkTypes.h"
#include "include/private/SkTFitsIn.h"
#include "include/private/SkTo.h"
+#include "src/core/SkASAN.h"
#include <array>
#include <cassert>
@@ -127,6 +128,7 @@ public:
if (std::is_trivially_destructible<T>::value) {
objStart = this->allocObject(size, alignment);
fCursor = objStart + size;
+ sk_asan_unpoison_memory_region(objStart, size);
} else {
objStart = this->allocObjectWithFooter(size + sizeof(Footer), alignment);
// Can never be UB because max value is alignof(T).
@@ -134,6 +136,7 @@ public:
// Advance to end of object to install footer.
fCursor = objStart + size;
+ sk_asan_unpoison_memory_region(objStart, size);
FooterAction* releaser = [](char* objEnd) {
char* objStart = objEnd - (sizeof(T) + sizeof(Footer));
((T*)objStart)->~T();
@@ -187,6 +190,7 @@ public:
AssertRelease(SkTFitsIn<uint32_t>(size));
auto objStart = this->allocObject(SkToU32(size), SkToU32(align));
fCursor = objStart + size;
+ sk_asan_unpoison_memory_region(objStart, size);
return objStart;
}
@@ -205,6 +209,7 @@ private:
template <typename T>
void installRaw(const T& val) {
+ sk_asan_unpoison_memory_region(fCursor, sizeof(val));
memcpy(fCursor, &val, sizeof(val));
fCursor += sizeof(val);
}
@@ -245,6 +250,7 @@ private:
if (std::is_trivially_destructible<T>::value) {
objStart = this->allocObject(arraySize, alignment);
fCursor = objStart + arraySize;
+ sk_asan_unpoison_memory_region(objStart, arraySize);
} else {
constexpr uint32_t overhead = sizeof(Footer) + sizeof(uint32_t);
AssertRelease(arraySize <= std::numeric_limits<uint32_t>::max() - overhead);
@@ -256,6 +262,7 @@ private:
// Advance to end of array to install footer.
fCursor = objStart + arraySize;
+ sk_asan_unpoison_memory_region(objStart, arraySize);
this->installRaw(SkToU32(count));
this->installFooter(
[](char* footerEnd) {
diff --git a/chromium/third_party/skia/src/core/SkAutoBlitterChoose.h b/chromium/third_party/skia/src/core/SkAutoBlitterChoose.h
index 0e5eae1808d..0fb63c94ce9 100644
--- a/chromium/third_party/skia/src/core/SkAutoBlitterChoose.h
+++ b/chromium/third_party/skia/src/core/SkAutoBlitterChoose.h
@@ -13,6 +13,7 @@
#include "src/core/SkBlitter.h"
#include "src/core/SkDraw.h"
#include "src/core/SkRasterClip.h"
+#include "src/core/SkSurfacePriv.h"
class SkMatrix;
class SkPaint;
@@ -36,7 +37,8 @@ public:
matrixProvider = draw.fMatrixProvider;
}
fBlitter = SkBlitter::Choose(draw.fDst, *matrixProvider, paint, &fAlloc, drawCoverage,
- draw.fRC->clipShader());
+ draw.fRC->clipShader(),
+ SkSurfacePropsCopyOrDefault(draw.fProps));
return fBlitter;
}
diff --git a/chromium/third_party/skia/src/core/SkBigPicture.cpp b/chromium/third_party/skia/src/core/SkBigPicture.cpp
index 1c07b44be18..887b9df034f 100644
--- a/chromium/third_party/skia/src/core/SkBigPicture.cpp
+++ b/chromium/third_party/skia/src/core/SkBigPicture.cpp
@@ -7,7 +7,6 @@
#include "include/core/SkBBHFactory.h"
#include "src/core/SkBigPicture.h"
-#include "src/core/SkPictureCommon.h"
#include "src/core/SkRecord.h"
#include "src/core/SkRecordDraw.h"
#include "src/core/SkTraceEvent.h"
diff --git a/chromium/third_party/skia/src/core/SkBigPicture.h b/chromium/third_party/skia/src/core/SkBigPicture.h
index eac2e90f68c..4dd91d18198 100644
--- a/chromium/third_party/skia/src/core/SkBigPicture.h
+++ b/chromium/third_party/skia/src/core/SkBigPicture.h
@@ -20,6 +20,8 @@ class SkMatrix;
class SkRecord;
// An implementation of SkPicture supporting an arbitrary number of drawing commands.
+// This is called "big" because there used to be a "mini" that only supported a subset of the
+// calls as an optimization.
class SkBigPicture final : public SkPicture {
public:
// An array of refcounted const SkPicture pointers.
diff --git a/chromium/third_party/skia/src/core/SkBitmap.cpp b/chromium/third_party/skia/src/core/SkBitmap.cpp
index a9962484d91..473997709ff 100644
--- a/chromium/third_party/skia/src/core/SkBitmap.cpp
+++ b/chromium/third_party/skia/src/core/SkBitmap.cpp
@@ -425,6 +425,10 @@ void SkBitmap::erase(SkColor c, const SkIRect& area) const {
this->erase(SkColor4f::FromColor(c), nullptr, area);
}
+void SkBitmap::erase(SkColor4f c, const SkIRect& area) const {
+ this->erase(c, nullptr, area);
+}
+
void SkBitmap::eraseColor(SkColor4f c, SkColorSpace* colorSpace) const {
this->erase(c, colorSpace, SkIRect::MakeWH(this->width(), this->height()));
}
diff --git a/chromium/third_party/skia/src/core/SkBitmapDevice.cpp b/chromium/third_party/skia/src/core/SkBitmapDevice.cpp
index b1831f026b7..c295e65f6ed 100644
--- a/chromium/third_party/skia/src/core/SkBitmapDevice.cpp
+++ b/chromium/third_party/skia/src/core/SkBitmapDevice.cpp
@@ -18,7 +18,6 @@
#include "include/core/SkSurface.h"
#include "include/core/SkVertices.h"
#include "src/core/SkDraw.h"
-#include "src/core/SkGlyphRun.h"
#include "src/core/SkImageFilterCache.h"
#include "src/core/SkImageFilter_Base.h"
#include "src/core/SkRasterClip.h"
@@ -26,6 +25,7 @@
#include "src/core/SkStrikeCache.h"
#include "src/core/SkTLazy.h"
#include "src/image/SkImage_Base.h"
+#include "src/text/GlyphRun.h"
struct Bounder {
SkRect fBounds;
@@ -118,6 +118,8 @@ public:
fDraw.fRC = &dev->fRCStack.rc();
fOrigin.set(0, 0);
}
+
+ fDraw.fProps = &fDevice->surfaceProps();
}
bool needsTiling() const { return fNeedsTiling; }
@@ -516,7 +518,7 @@ void SkBitmapDevice::drawImageRect(const SkImage* image, const SkRect* src, cons
}
void SkBitmapDevice::onDrawGlyphRunList(SkCanvas* canvas,
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
const SkPaint& initialPaint,
const SkPaint& drawingPaint) {
SkASSERT(!glyphRunList.hasRSXForm());
diff --git a/chromium/third_party/skia/src/core/SkBitmapDevice.h b/chromium/third_party/skia/src/core/SkBitmapDevice.h
index 8d2d9d3b3dd..8dab54150eb 100644
--- a/chromium/third_party/skia/src/core/SkBitmapDevice.h
+++ b/chromium/third_party/skia/src/core/SkBitmapDevice.h
@@ -109,7 +109,7 @@ protected:
///////////////////////////////////////////////////////////////////////////
void onDrawGlyphRunList(SkCanvas*,
- const SkGlyphRunList&,
+ const sktext::GlyphRunList&,
const SkPaint& initialPaint,
const SkPaint& drawingPaint) override;
bool onReadPixels(const SkPixmap&, int x, int y) override;
diff --git a/chromium/third_party/skia/src/core/SkBlitRow_D32.cpp b/chromium/third_party/skia/src/core/SkBlitRow_D32.cpp
index 7374091b03e..cafdfa32a43 100644
--- a/chromium/third_party/skia/src/core/SkBlitRow_D32.cpp
+++ b/chromium/third_party/skia/src/core/SkBlitRow_D32.cpp
@@ -297,8 +297,8 @@ SkBlitRow::Proc32 SkBlitRow::Factory32(unsigned flags) {
blit_row_s32a_blend
};
- SkASSERT(flags < SK_ARRAY_COUNT(kProcs));
- flags &= SK_ARRAY_COUNT(kProcs) - 1; // just to be safe
+ SkASSERT(flags < std::size(kProcs));
+ flags &= std::size(kProcs) - 1; // just to be safe
return flags == 2 ? SkOpts::blit_row_s32a_opaque
: kProcs[flags];
diff --git a/chromium/third_party/skia/src/core/SkBlitter.cpp b/chromium/third_party/skia/src/core/SkBlitter.cpp
index a52dc9a00cf..a6bfcaaf4de 100644
--- a/chromium/third_party/skia/src/core/SkBlitter.cpp
+++ b/chromium/third_party/skia/src/core/SkBlitter.cpp
@@ -273,6 +273,22 @@ void SkBlitter::blitMask(const SkMask& mask, const SkIRect& clip) {
/////////////////////// these are not virtual, just helpers
+#if defined(SK_SUPPORT_LEGACY_ALPHA_BITMAP_AS_COVERAGE)
+void SkBlitter::blitMaskRegion(const SkMask& mask, const SkRegion& clip) {
+ if (clip.quickReject(mask.fBounds)) {
+ return;
+ }
+
+ SkRegion::Cliperator clipper(clip, mask.fBounds);
+
+ while (!clipper.done()) {
+ const SkIRect& cr = clipper.rect();
+ this->blitMask(mask, cr);
+ clipper.next();
+ }
+}
+#endif
+
void SkBlitter::blitRectRegion(const SkIRect& rect, const SkRegion& clip) {
SkRegion::Cliperator clipper(clip, rect);
@@ -682,7 +698,8 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
const SkPaint& origPaint,
SkArenaAlloc* alloc,
bool drawCoverage,
- sk_sp<SkShader> clipShader) {
+ sk_sp<SkShader> clipShader,
+ const SkSurfaceProps& props) {
SkASSERT(alloc);
if (kUnknown_SkColorType == device.colorType()) {
@@ -747,7 +764,7 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
}
}
if (auto blitter = SkCreateRasterPipelineBlitter(
- device, *paint, matrixProvider, alloc, clipShader)) {
+ device, *paint, matrixProvider, alloc, clipShader, props)) {
return blitter;
}
if (!gUseSkVMBlitter) {
@@ -776,7 +793,7 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
SkShaderBase::Context* shaderContext = nullptr;
if (paint->getShader()) {
shaderContext = as_SB(paint->getShader())->makeContext(
- {*paint, ctm, nullptr, device.colorType(), device.colorSpace()},
+ {*paint, ctm, nullptr, device.colorType(), device.colorSpace(), props},
alloc);
// Creating the context isn't always possible... try fallbacks before giving up.
diff --git a/chromium/third_party/skia/src/core/SkBlitter.h b/chromium/third_party/skia/src/core/SkBlitter.h
index 0ed7cd6286f..02fe3b374e3 100644
--- a/chromium/third_party/skia/src/core/SkBlitter.h
+++ b/chromium/third_party/skia/src/core/SkBlitter.h
@@ -21,6 +21,7 @@ class SkMatrix;
class SkMatrixProvider;
class SkPaint;
class SkPixmap;
+class SkSurfaceProps;
struct SkMask;
/** SkBlitter and its subclasses are responsible for actually writing pixels
@@ -132,6 +133,9 @@ public:
}
///@name non-virtual helpers
+#if defined(SK_SUPPORT_LEGACY_ALPHA_BITMAP_AS_COVERAGE)
+ void blitMaskRegion(const SkMask& mask, const SkRegion& clip);
+#endif
void blitRectRegion(const SkIRect& rect, const SkRegion& clip);
void blitRegion(const SkRegion& clip);
///@}
@@ -144,7 +148,8 @@ public:
const SkPaint& paint,
SkArenaAlloc*,
bool drawCoverage,
- sk_sp<SkShader> clipShader);
+ sk_sp<SkShader> clipShader,
+ const SkSurfaceProps& props);
static SkBlitter* ChooseSprite(const SkPixmap& dst,
const SkPaint&,
diff --git a/chromium/third_party/skia/src/core/SkBlockAllocator.h b/chromium/third_party/skia/src/core/SkBlockAllocator.h
index 32d7400c646..23f64a6a345 100644
--- a/chromium/third_party/skia/src/core/SkBlockAllocator.h
+++ b/chromium/third_party/skia/src/core/SkBlockAllocator.h
@@ -154,7 +154,7 @@ public:
this->poisonRange(kDataStart, fSize);
}
- SkDEBUGCODE(int fSentinel;) // known value to check for bad back pointers to blocks
+ SkDEBUGCODE(uint32_t fSentinel;) // known value to check for bad back pointers to blocks
Block* fNext; // doubly-linked list of blocks
Block* fPrev;
@@ -403,8 +403,8 @@ public:
inline BlockIter<false, true> rblocks() const;
#ifdef SK_DEBUG
- inline static constexpr int kAssignedMarker = 0xBEEFFACE;
- inline static constexpr int kFreedMarker = 0xCAFEBABE;
+ inline static constexpr uint32_t kAssignedMarker = 0xBEEFFACE;
+ inline static constexpr uint32_t kFreedMarker = 0xCAFEBABE;
void validate() const;
#endif
diff --git a/chromium/third_party/skia/src/core/SkBlurMF.cpp b/chromium/third_party/skia/src/core/SkBlurMF.cpp
index 7a98433f577..2e74d57f9e5 100644
--- a/chromium/third_party/skia/src/core/SkBlurMF.cpp
+++ b/chromium/third_party/skia/src/core/SkBlurMF.cpp
@@ -40,7 +40,7 @@
#include "src/gpu/ganesh/glsl/GrGLSLProgramDataManager.h"
#include "src/gpu/ganesh/glsl/GrGLSLUniformHandler.h"
#if SK_GPU_V1
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#endif // SK_GPU_V1
#endif // SK_SUPPORT_GPU
@@ -841,7 +841,7 @@ static std::unique_ptr<GrFragmentProcessor> make_circle_blur(GrRecordingContext*
return nullptr;
}
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
uniform shader blurProfile;
uniform half4 circleData;
@@ -976,7 +976,7 @@ static std::unique_ptr<GrFragmentProcessor> make_rect_blur(GrRecordingContext* c
// rectangle (and similar in y).
bool isFast = insetRect.isSorted();
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
// Effect that is a LUT for integral of normal distribution. The value at x:[0,6*sigma] is
// the integral from -inf to (3*sigma - x). I.e. x is mapped from [0, 6*sigma] to
// [3*sigma to -3*sigma]. The flip saves a reversal in the shader.
@@ -1382,7 +1382,7 @@ static std::unique_ptr<GrFragmentProcessor> make_rrect_blur(GrRecordingContext*
return nullptr;
}
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
uniform shader ninePatchFP;
uniform half cornerRadius;
diff --git a/chromium/third_party/skia/src/core/SkBuiltInCodeSnippetID.h b/chromium/third_party/skia/src/core/SkBuiltInCodeSnippetID.h
index 677ade44967..1ddf656d359 100644
--- a/chromium/third_party/skia/src/core/SkBuiltInCodeSnippetID.h
+++ b/chromium/third_party/skia/src/core/SkBuiltInCodeSnippetID.h
@@ -11,13 +11,14 @@
#include "include/core/SkTypes.h"
// TODO: this needs to be expanded into a more flexible dictionary (esp. for user-supplied SkSL)
-enum class SkBuiltInCodeSnippetID : uint8_t {
+enum class SkBuiltInCodeSnippetID : int32_t {
// This isn't just a signal for a failure during paintparams key creation. It also actually
// implements the default behavior for an erroneous draw. Currently it just draws solid
// magenta.
kError,
// SkShader code snippets
+ kPassthroughShader,
kSolidColorShader,
kLinearGradientShader4,
kLinearGradientShader8,
@@ -31,6 +32,14 @@ enum class SkBuiltInCodeSnippetID : uint8_t {
kLocalMatrixShader,
kImageShader,
kBlendShader, // aka ComposeShader
+ kRuntimeShader,
+
+ // SkColorFilter code snippets
+ kMatrixColorFilter,
+ kBlendColorFilter,
+ kComposeColorFilter,
+ kTableColorFilter,
+ kGaussianColorFilter,
// BlendMode code snippets
kFixedFunctionBlender,
diff --git a/chromium/third_party/skia/src/core/SkCanvas.cpp b/chromium/third_party/skia/src/core/SkCanvas.cpp
index a0855f6bcd7..8f887b0097d 100644
--- a/chromium/third_party/skia/src/core/SkCanvas.cpp
+++ b/chromium/third_party/skia/src/core/SkCanvas.cpp
@@ -27,7 +27,6 @@
#include "src/core/SkClipStack.h"
#include "src/core/SkColorFilterBase.h"
#include "src/core/SkDraw.h"
-#include "src/core/SkGlyphRun.h"
#include "src/core/SkImageFilterCache.h"
#include "src/core/SkImageFilter_Base.h"
#include "src/core/SkLatticeIter.h"
@@ -46,6 +45,7 @@
#include "src/core/SkVerticesPriv.h"
#include "src/image/SkImage_Base.h"
#include "src/image/SkSurface_Base.h"
+#include "src/text/GlyphRun.h"
#include "src/utils/SkPatchUtils.h"
#include <memory>
@@ -54,7 +54,6 @@
#if SK_SUPPORT_GPU
#include "include/gpu/GrDirectContext.h"
-#include "src/gpu/ganesh/BaseDevice.h"
#include "src/gpu/ganesh/SkGr.h"
#include "src/utils/SkTestCanvas.h"
#if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK)
@@ -422,7 +421,7 @@ void SkCanvas::init(sk_sp<SkBaseDevice> device) {
fSurfaceBase = nullptr;
fBaseDevice = std::move(device);
- fScratchGlyphRunBuilder = std::make_unique<SkGlyphRunBuilder>();
+ fScratchGlyphRunBuilder = std::make_unique<sktext::GlyphRunBuilder>();
fQuickRejectBounds = this->computeDeviceClipBounds();
}
@@ -1284,12 +1283,24 @@ SkImageInfo SkCanvas::onImageInfo() const {
}
bool SkCanvas::getProps(SkSurfaceProps* props) const {
- return this->onGetProps(props);
+ return this->onGetProps(props, /*top=*/false);
}
-bool SkCanvas::onGetProps(SkSurfaceProps* props) const {
+SkSurfaceProps SkCanvas::getBaseProps() const {
+ SkSurfaceProps props;
+ this->onGetProps(&props, /*top=*/false);
+ return props;
+}
+
+SkSurfaceProps SkCanvas::getTopProps() const {
+ SkSurfaceProps props;
+ this->onGetProps(&props, /*top=*/true);
+ return props;
+}
+
+bool SkCanvas::onGetProps(SkSurfaceProps* props, bool top) const {
if (props) {
- *props = fProps;
+ *props = top ? topDevice()->surfaceProps() : fProps;
}
return true;
}
@@ -2334,7 +2345,7 @@ void SkCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
this->onDrawGlyphRunList(glyphRunList, paint);
}
-void SkCanvas::onDrawGlyphRunList(const SkGlyphRunList& glyphRunList, const SkPaint& paint) {
+void SkCanvas::onDrawGlyphRunList(const sktext::GlyphRunList& glyphRunList, const SkPaint& paint) {
SkRect bounds = glyphRunList.sourceBounds();
if (this->internalQuickReject(bounds, paint)) {
return;
@@ -2354,7 +2365,8 @@ sk_sp<Slug> SkCanvas::convertBlobToSlug(
}
sk_sp<Slug>
-SkCanvas::onConvertGlyphRunListToSlug(const SkGlyphRunList& glyphRunList, const SkPaint& paint) {
+SkCanvas::onConvertGlyphRunListToSlug(
+ const sktext::GlyphRunList& glyphRunList, const SkPaint& paint) {
SkRect bounds = glyphRunList.sourceBounds();
if (bounds.isEmpty() || !bounds.isFinite() || paint.nothingToDraw()) {
return nullptr;
@@ -2392,7 +2404,7 @@ void SkCanvas::drawSimpleText(const void* text, size_t byteLength, SkTextEncodin
TRACE_EVENT0("skia", TRACE_FUNC);
if (byteLength) {
sk_msan_assert_initialized(text, SkTAddOffset<const void>(text, byteLength));
- const SkGlyphRunList& glyphRunList =
+ const sktext::GlyphRunList& glyphRunList =
fScratchGlyphRunBuilder->textToGlyphRunList(
font, paint, text, byteLength, {x, y}, encoding);
if (!glyphRunList.empty()) {
@@ -2406,15 +2418,15 @@ void SkCanvas::drawGlyphs(int count, const SkGlyphID* glyphs, const SkPoint* pos
SkPoint origin, const SkFont& font, const SkPaint& paint) {
if (count <= 0) { return; }
- SkGlyphRun glyphRun {
+ sktext::GlyphRun glyphRun {
font,
- SkMakeSpan(positions, count),
- SkMakeSpan(glyphs, count),
- SkMakeSpan(utf8text, textByteCount),
- SkMakeSpan(clusters, count),
+ SkSpan(positions, count),
+ SkSpan(glyphs, count),
+ SkSpan(utf8text, textByteCount),
+ SkSpan(clusters, count),
SkSpan<SkVector>()
};
- SkGlyphRunList glyphRunList = fScratchGlyphRunBuilder->makeGlyphRunList(
+ sktext::GlyphRunList glyphRunList = fScratchGlyphRunBuilder->makeGlyphRunList(
glyphRun, glyphRun.sourceBounds(paint).makeOffset(origin), origin);
this->onDrawGlyphRunList(glyphRunList, paint);
}
@@ -2423,15 +2435,15 @@ void SkCanvas::drawGlyphs(int count, const SkGlyphID glyphs[], const SkPoint pos
SkPoint origin, const SkFont& font, const SkPaint& paint) {
if (count <= 0) { return; }
- SkGlyphRun glyphRun {
+ sktext::GlyphRun glyphRun {
font,
- SkMakeSpan(positions, count),
- SkMakeSpan(glyphs, count),
+ SkSpan(positions, count),
+ SkSpan(glyphs, count),
SkSpan<const char>(),
SkSpan<const uint32_t>(),
SkSpan<SkVector>()
};
- SkGlyphRunList glyphRunList = fScratchGlyphRunBuilder->makeGlyphRunList(
+ sktext::GlyphRunList glyphRunList = fScratchGlyphRunBuilder->makeGlyphRunList(
glyphRun, glyphRun.sourceBounds(paint).makeOffset(origin), origin);
this->onDrawGlyphRunList(glyphRunList, paint);
}
@@ -2441,17 +2453,17 @@ void SkCanvas::drawGlyphs(int count, const SkGlyphID glyphs[], const SkRSXform x
if (count <= 0) { return; }
auto [positions, rotateScales] =
- fScratchGlyphRunBuilder->convertRSXForm(SkMakeSpan(xforms, count));
+ fScratchGlyphRunBuilder->convertRSXForm(SkSpan(xforms, count));
- SkGlyphRun glyphRun {
+ sktext::GlyphRun glyphRun {
font,
positions,
- SkMakeSpan(glyphs, count),
+ SkSpan(glyphs, count),
SkSpan<const char>(),
SkSpan<const uint32_t>(),
rotateScales
};
- SkGlyphRunList glyphRunList = fScratchGlyphRunBuilder->makeGlyphRunList(
+ sktext::GlyphRunList glyphRunList = fScratchGlyphRunBuilder->makeGlyphRunList(
glyphRun, glyphRun.sourceBounds(paint).makeOffset(origin), origin);
this->onDrawGlyphRunList(glyphRunList, paint);
}
@@ -2894,7 +2906,7 @@ SkTestCanvas<SkSlugTestKey>::SkTestCanvas(SkCanvas* canvas)
: SkCanvas(sk_ref_sp(canvas->baseDevice())) {}
void SkTestCanvas<SkSlugTestKey>::onDrawGlyphRunList(
- const SkGlyphRunList& glyphRunList, const SkPaint& paint) {
+ const sktext::GlyphRunList& glyphRunList, const SkPaint& paint) {
SkRect bounds = glyphRunList.sourceBounds();
if (this->internalQuickReject(bounds, paint)) {
return;
diff --git a/chromium/third_party/skia/src/core/SkCanvasPriv.cpp b/chromium/third_party/skia/src/core/SkCanvasPriv.cpp
index 7a73ece5909..137e588c130 100644
--- a/chromium/third_party/skia/src/core/SkCanvasPriv.cpp
+++ b/chromium/third_party/skia/src/core/SkCanvasPriv.cpp
@@ -101,19 +101,10 @@ void SkCanvasPriv::GetDstClipAndMatrixCounts(const SkCanvas::ImageSetEntry set[]
*totalMatrixCount = maxMatrixIndex + 1;
}
-#ifdef SK_ENABLE_SKSL
-void SkCanvasPriv::DrawMesh(SkCanvas* canvas,
- const SkMesh& mesh,
- sk_sp<SkBlender> blender,
- const SkPaint& paint) {
- canvas->drawMesh(mesh, std::move(blender), paint);
-}
-#endif
-
#if GR_TEST_UTILS
#if SK_SUPPORT_GPU
-#include "src/gpu/ganesh/BaseDevice.h"
+#include "src/gpu/ganesh/Device_v1.h"
#if SK_GPU_V1
skgpu::v1::SurfaceDrawContext* SkCanvasPriv::TopDeviceSurfaceDrawContext(SkCanvas* canvas) {
@@ -123,9 +114,8 @@ skgpu::v1::SurfaceDrawContext* SkCanvasPriv::TopDeviceSurfaceDrawContext(SkCanva
return nullptr;
}
-#endif // SK_GPU_V1
-skgpu::SurfaceFillContext* SkCanvasPriv::TopDeviceSurfaceFillContext(SkCanvas* canvas) {
+skgpu::v1::SurfaceFillContext* SkCanvasPriv::TopDeviceSurfaceFillContext(SkCanvas* canvas) {
if (auto gpuDevice = canvas->topDevice()->asGaneshDevice()) {
return gpuDevice->surfaceFillContext();
}
@@ -133,24 +123,26 @@ skgpu::SurfaceFillContext* SkCanvasPriv::TopDeviceSurfaceFillContext(SkCanvas* c
return nullptr;
}
+#endif // SK_GPU_V1
+
#else // SK_SUPPORT_GPU
#if SK_GPU_V1
skgpu::v1::SurfaceDrawContext* SkCanvasPriv::TopDeviceSurfaceDrawContext(SkCanvas* canvas) {
return nullptr;
}
-#endif // SK_GPU_V1
-skgpu::SurfaceFillContext* SkCanvasPriv::TopDeviceSurfaceFillContext(SkCanvas* canvas) {
+skgpu::v1::SurfaceFillContext* SkCanvasPriv::TopDeviceSurfaceFillContext(SkCanvas* canvas) {
return nullptr;
}
+#endif // SK_GPU_V1
#endif // SK_SUPPORT_GPU
#endif // GR_TEST_UTILS
#if SK_SUPPORT_GPU
-#include "src/gpu/ganesh/BaseDevice.h"
+#include "src/gpu/ganesh/Device_v1.h"
GrRenderTargetProxy* SkCanvasPriv::TopDeviceTargetProxy(SkCanvas* canvas) {
if (auto gpuDevice = canvas->topDevice()->asGaneshDevice()) {
diff --git a/chromium/third_party/skia/src/core/SkCanvasPriv.h b/chromium/third_party/skia/src/core/SkCanvasPriv.h
index 72b57af65bf..86c420ca8a9 100644
--- a/chromium/third_party/skia/src/core/SkCanvasPriv.h
+++ b/chromium/third_party/skia/src/core/SkCanvasPriv.h
@@ -15,12 +15,12 @@ class SkReadBuffer;
class SkWriteBuffer;
#if GR_TEST_UTILS
-namespace skgpu {
- class SurfaceFillContext;
#if SK_GPU_V1
- namespace v1 { class SurfaceDrawContext; }
-#endif // SK_GPU_V1
+namespace skgpu::v1 {
+ class SurfaceDrawContext;
+ class SurfaceFillContext;
}
+#endif // SK_GPU_V1
#endif // GR_TEST_UTILS
// This declaration must match the one in SkDeferredDisplayList.h
@@ -72,8 +72,8 @@ public:
#if GR_TEST_UTILS
#if SK_GPU_V1
static skgpu::v1::SurfaceDrawContext* TopDeviceSurfaceDrawContext(SkCanvas*);
+ static skgpu::v1::SurfaceFillContext* TopDeviceSurfaceFillContext(SkCanvas*);
#endif
- static skgpu::SurfaceFillContext* TopDeviceSurfaceFillContext(SkCanvas*);
#endif // GR_TEST_UTILS
static GrRenderTargetProxy* TopDeviceTargetProxy(SkCanvas*);
@@ -102,11 +102,6 @@ public:
static void SetBackdropScaleFactor(SkCanvas::SaveLayerRec* rec, SkScalar scale) {
rec->fExperimentalBackdropScale = scale;
}
-
- static void DrawMesh(SkCanvas*,
- const SkMesh& mesh,
- sk_sp<SkBlender> blender,
- const SkPaint& paint);
};
/**
diff --git a/chromium/third_party/skia/src/core/SkChromeRemoteGlyphCache.cpp b/chromium/third_party/skia/src/core/SkChromeRemoteGlyphCache.cpp
index aa6e414353b..58e85ad787e 100644
--- a/chromium/third_party/skia/src/core/SkChromeRemoteGlyphCache.cpp
+++ b/chromium/third_party/skia/src/core/SkChromeRemoteGlyphCache.cpp
@@ -7,6 +7,7 @@
#include "include/private/chromium/SkChromeRemoteGlyphCache.h"
+#include <algorithm>
#include <bitset>
#include <iterator>
#include <memory>
@@ -20,21 +21,25 @@
#include "include/private/SkChecksum.h"
#include "include/private/SkTHash.h"
#include "src/core/SkDevice.h"
+#include "src/core/SkDistanceFieldGen.h"
#include "src/core/SkDraw.h"
#include "src/core/SkEnumerate.h"
-#include "src/core/SkGlyphRun.h"
+#include "src/core/SkGlyph.h"
#include "src/core/SkReadBuffer.h"
#include "src/core/SkScalerCache.h"
#include "src/core/SkStrikeCache.h"
-#include "src/core/SkStrikeForGPU.h"
#include "src/core/SkTLazy.h"
#include "src/core/SkTraceEvent.h"
#include "src/core/SkTypeface_remote.h"
+#include "src/text/GlyphRun.h"
+#include "src/text/StrikeForGPU.h"
#if SK_SUPPORT_GPU
#include "include/gpu/GrContextOptions.h"
#include "src/gpu/ganesh/GrDrawOpAtlas.h"
#include "src/text/gpu/SDFTControl.h"
+#include "src/text/gpu/SubRunAllocator.h"
+#include "src/text/gpu/SubRunContainer.h"
#include "src/text/gpu/TextBlob.h"
#endif
@@ -152,38 +157,8 @@ struct StrikeSpec {
SkDiscardableHandleId fDiscardableHandleId = 0u;
};
-// Represent a set of x sub-pixel-position glyphs with a glyph id < kMaxGlyphID and
-// y sub-pixel-position must be 0. Most sub-pixel-positioned glyphs have been x-axis aligned
-// forcing the y sub-pixel position to be zero. We can organize the SkPackedGlyphID to check that
-// the glyph id and the y position == 0 with a single compare in the following way:
-// <y-sub-pixel-position>:2 | <glyphid:16> | <x-sub-pixel-position>:2
-// This organization allows a single check of a packed-id to be:
-// packed-id < kMaxGlyphID * possible-x-sub-pixel-positions
-// where possible-x-sub-pixel-positions == 4.
-class LowerRangeBitVector {
-public:
- bool test(SkPackedGlyphID packedID) const {
- uint32_t bit = packedID.value();
- return bit < kMaxIndex && fBits.test(bit);
- }
- void setIfLower(SkPackedGlyphID packedID) {
- uint32_t bit = packedID.value();
- if (bit < kMaxIndex) {
- fBits.set(bit);
- }
- }
-
-private:
- using GID = SkPackedGlyphID;
- static_assert(GID::kSubPixelX < GID::kGlyphID && GID::kGlyphID < GID::kSubPixelY,
- "SkPackedGlyphID must be organized: sub-y | glyph id | sub-x");
- inline static constexpr int kMaxGlyphID = 128;
- inline static constexpr int kMaxIndex = kMaxGlyphID * (1u << GID::kSubPixelPosLen);
- std::bitset<kMaxIndex> fBits;
-};
-
// -- RemoteStrike ----------------------------------------------------------------------------
-class RemoteStrike final : public SkStrikeForGPU {
+class RemoteStrike final : public sktext::StrikeForGPU {
public:
// N.B. RemoteStrike is not valid until ensureScalerContext is called.
RemoteStrike(const SkStrikeSpec& strikeSpec,
@@ -204,11 +179,15 @@ public:
return fRoundingSpec;
}
- void prepareForMaskDrawing(
- SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected) override;
+ SkRect prepareForMaskDrawing(
+ SkScalar strikeToSourceScale,
+ SkDrawableGlyphBuffer* accepted,
+ SkSourceGlyphBuffer* rejected) override;
- void prepareForSDFTDrawing(
- SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected) override;
+ SkRect prepareForSDFTDrawing(
+ SkScalar strikeToSourceScale,
+ SkDrawableGlyphBuffer* accepted,
+ SkSourceGlyphBuffer* rejected) override;
void prepareForPathDrawing(
SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected) override;
@@ -216,6 +195,10 @@ public:
void prepareForDrawableDrawing(
SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected) override;
+ sktext::SkStrikePromise strikePromise() override;
+
+ SkScalar findMaximumGlyphDimension(SkSpan<const SkGlyphID> glyphs) override;
+
void onAboutToExitScope() override {}
sk_sp<SkStrike> getUnderlyingStrike() const override { return nullptr; }
@@ -227,47 +210,7 @@ public:
void resetScalerContext();
private:
- template <typename Rejector>
- void commonMaskLoop(
- SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected, Rejector&& reject);
-
- // Same thing as MaskSummary, but for paths.
- struct PathSummary {
- constexpr static uint16_t kIsPath = 0;
- SkPackedGlyphID packedID;
- // If drawing glyphID can be done with a path, this is 0, otherwise it is the max
- // dimension of the glyph.
- uint16_t maxDimensionOrPath;
- };
-
- struct PathSummaryTraits {
- static SkPackedGlyphID GetKey(PathSummary summary) {
- return summary.packedID;
- }
-
- static uint32_t Hash(SkPackedGlyphID packedID) {
- return SkChecksum::CheapMix(packedID.value());
- }
- };
-
- // Same thing as MaskSummary, but for drawables.
- struct DrawableSummary {
- constexpr static uint16_t kIsDrawable = 0;
- SkGlyphID glyphID;
- // If drawing glyphID can be done with a drawable, this is 0, otherwise it is the max
- // dimension of the glyph.
- uint16_t maxDimensionOrDrawable;
- };
-
- struct DrawableSummaryTraits {
- static SkGlyphID GetKey(DrawableSummary summary) {
- return summary.glyphID;
- }
-
- static uint32_t Hash(SkGlyphID packedID) {
- return SkChecksum::CheapMix(packedID);
- }
- };
+ SkGlyphDigest digest(SkPackedGlyphID);
void writeGlyphPath(const SkGlyph& glyph, Serializer* serializer) const;
void writeGlyphDrawable(const SkGlyph& glyph, Serializer* serializer) const;
@@ -288,12 +231,10 @@ private:
// Have the metrics been sent for this strike. Only send them once.
bool fHaveSentFontMetrics{false};
- LowerRangeBitVector fSentLowGlyphIDs;
-
// The masks and paths that currently reside in the GPU process.
SkTHashMap<SkPackedGlyphID, SkGlyphDigest, SkPackedGlyphID::Hash> fSentGlyphs;
- SkTHashTable<PathSummary, SkPackedGlyphID, PathSummaryTraits> fSentPaths;
- SkTHashTable<DrawableSummary, SkGlyphID, DrawableSummaryTraits> fSentDrawables;
+ SkTHashMap<SkGlyphID, bool> fSentPaths;
+ SkTHashMap<SkGlyphID, bool> fSentDrawables;
// The Masks, SDFT Mask, and Paths that need to be sent to the GPU task for the processed
// TextBlobs. Cleared after diffs are serialized.
@@ -313,8 +254,7 @@ RemoteStrike::RemoteStrike(
, fDiscardableHandleId(discardableHandleId)
, fRoundingSpec{context->isSubpixel(), context->computeAxisAlignmentForHText()}
// N.B. context must come last because it is used above.
- , fContext{std::move(context)}
- , fSentLowGlyphIDs{} {
+ , fContext{std::move(context)} {
SkASSERT(fDescriptor.getDesc() != nullptr);
SkASSERT(fContext != nullptr);
}
@@ -354,7 +294,7 @@ void RemoteStrike::writePendingGlyphs(Serializer* serializer) {
write_glyph(glyph, serializer);
auto imageSize = glyph.imageSize();
- if (imageSize > 0 && FitsInAtlas(glyph)) {
+ if (imageSize > 0 && SkGlyphDigest::FitsInAtlas(glyph)) {
glyph.setImage(serializer->allocate(imageSize, glyph.formatAlignment()));
fContext->getImage(glyph);
}
@@ -399,6 +339,11 @@ void RemoteStrike::setStrikeSpec(const SkStrikeSpec& strikeSpec) {
}
void RemoteStrike::writeGlyphPath(const SkGlyph& glyph, Serializer* serializer) const {
+ if (glyph.isEmpty()) {
+ serializer->write<uint64_t>(0u);
+ return;
+ }
+
const SkPath* path = glyph.path();
if (path == nullptr) {
@@ -432,97 +377,101 @@ void RemoteStrike::writeGlyphDrawable(const SkGlyph& glyph, Serializer* serializ
memcpy(serializer->allocate(data->size(), kDrawableAlignment), data->data(), data->size());
}
-template <typename Rejector>
-void RemoteStrike::commonMaskLoop(
- SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected, Rejector&& reject) {
- accepted->forEachInput(
- [&](size_t i, SkPackedGlyphID packedID, SkPoint position) {
- SkGlyphDigest* digest = fSentGlyphs.find(packedID);
- if (digest == nullptr) {
- // Put the new SkGlyph in the glyphs to send.
- this->ensureScalerContext();
- fMasksToSend.emplace_back(fContext->makeGlyph(packedID, &fAlloc));
- SkGlyph* glyph = &fMasksToSend.back();
-
- SkGlyphDigest newDigest{0, *glyph};
- digest = fSentGlyphs.set(packedID, newDigest);
- }
+SkGlyphDigest RemoteStrike::digest(SkPackedGlyphID packedID) {
+ SkGlyphDigest* digest = fSentGlyphs.find(packedID);
+ if (digest == nullptr) {
+ // Put the new SkGlyph in the glyphs to send.
+ this->ensureScalerContext();
+ fMasksToSend.emplace_back(fContext->makeGlyph(packedID, &fAlloc));
+ SkGlyph* glyph = &fMasksToSend.back();
- // Reject things that are too big.
- if (reject(*digest)) {
- rejected->reject(i);
- }
- });
+ SkGlyphDigest newDigest{0, *glyph};
+ digest = fSentGlyphs.set(packedID, newDigest);
+ }
+ return *digest;
}
-void RemoteStrike::prepareForMaskDrawing(
- SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected) {
- for (auto [i, variant, _] : SkMakeEnumerate(accepted->input())) {
- SkPackedGlyphID packedID = variant.packedID();
- if (fSentLowGlyphIDs.test(packedID)) {
- #ifdef SK_DEBUG
- SkGlyphDigest* digest = fSentGlyphs.find(packedID);
- SkASSERT(digest != nullptr);
- SkASSERT(digest->canDrawAsMask() && digest->canDrawAsSDFT());
- #endif
- continue;
- }
-
- SkGlyphDigest* digest = fSentGlyphs.find(packedID);
- if (digest == nullptr) {
-
- // Put the new SkGlyph in the glyphs to send.
- this->ensureScalerContext();
- fMasksToSend.emplace_back(fContext->makeGlyph(packedID, &fAlloc));
- SkGlyph* glyph = &fMasksToSend.back();
-
- SkGlyphDigest newDigest{0, *glyph};
+SkScalar RemoteStrike::findMaximumGlyphDimension(SkSpan<const SkGlyphID> glyphs) {
+ SkScalar maxDimension = 0;
+ for (SkGlyphID glyphID : glyphs) {
+ SkGlyphDigest digest = this->digest(SkPackedGlyphID{glyphID});
+ maxDimension = std::max(static_cast<SkScalar>(digest.maxDimension()), maxDimension);
+ }
- digest = fSentGlyphs.set(packedID, newDigest);
+ return maxDimension;
+}
- if (digest->canDrawAsMask() && digest->canDrawAsSDFT()) {
- fSentLowGlyphIDs.setIfLower(packedID);
+SkRect RemoteStrike::prepareForMaskDrawing(
+ SkScalar strikeToSourceScale,
+ SkDrawableGlyphBuffer* accepted,
+ SkSourceGlyphBuffer* rejected) {
+ SkGlyphRect boundingRect = skglyph::empty_rect();
+ for (auto [i, variant, pos] : SkMakeEnumerate(accepted->input())) {
+ SkPackedGlyphID packedID = variant.packedID();
+ SkGlyphDigest digest = this->digest(packedID);
+ if (digest.canDrawAsMask()) {
+ if (!digest.isEmpty()) {
+ const SkGlyphRect glyphBounds =
+ digest.bounds().scaleAndOffset(strikeToSourceScale, pos);
+ boundingRect = skglyph::rect_union(boundingRect, glyphBounds);
+ accepted->accept(packedID, glyphBounds.leftTop(), digest.maskFormat());
}
- }
-
- // Reject things that are too big.
- // N.B. this must have the same behavior as SkScalerCache::prepareForMaskDrawing.
- if (!digest->canDrawAsMask()) {
- rejected->reject(i, digest->maxDimension());
+ } else {
+ // Reject things that are too big.
+ // N.B. this must have the same behavior as SkScalerCache::prepareForMaskDrawing.
+ rejected->reject(i);
}
}
+ return boundingRect.rect();
}
-void RemoteStrike::prepareForSDFTDrawing(
- SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected) {
- this->commonMaskLoop(accepted, rejected,
- [](SkGlyphDigest digest){return !digest.canDrawAsSDFT();});
+SkRect RemoteStrike::prepareForSDFTDrawing(SkScalar strikeToSourceScale,
+ SkDrawableGlyphBuffer* accepted,
+ SkSourceGlyphBuffer* rejected) {
+ SkGlyphRect boundingRect = skglyph::empty_rect();
+ for (auto [i, variant, pos] : SkMakeEnumerate(accepted->input())) {
+ SkPackedGlyphID packedID = variant.packedID();
+ SkGlyphDigest digest = this->digest(packedID);
+ if (digest.canDrawAsSDFT()) {
+ if (!digest.isEmpty()) {
+ // The SDFT glyphs have 2-pixel wide padding that should not be used in
+ // calculating the source rectangle.
+ const SkGlyphRect glyphBounds = digest.bounds()
+ .inset(SK_DistanceFieldInset, SK_DistanceFieldInset)
+ .scaleAndOffset(strikeToSourceScale, pos);
+ boundingRect = skglyph::rect_union(boundingRect, glyphBounds);
+ accepted->accept(packedID, glyphBounds.leftTop(), digest.maskFormat());
+ }
+ } else {
+ // Reject things that are too big.
+ // N.B. this must have the same behavior as SkScalerCache::prepareForMaskDrawing.
+ rejected->reject(i);
+ }
+ }
+ return boundingRect.rect();
}
void RemoteStrike::prepareForPathDrawing(
SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected) {
accepted->forEachInput(
[&](size_t i, SkPackedGlyphID packedID, SkPoint position) {
- PathSummary* summary = fSentPaths.find(packedID);
- if (summary == nullptr) {
-
+ bool* hasPath = fSentPaths.find(packedID.glyphID());
+ if (hasPath == nullptr) {
// Put the new SkGlyph in the glyphs to send.
this->ensureScalerContext();
fPathsToSend.emplace_back(fContext->makeGlyph(packedID, &fAlloc));
SkGlyph* glyph = &fPathsToSend.back();
- uint16_t maxDimensionOrPath = glyph->maxDimension();
glyph->setPath(&fAlloc, fContext.get());
- if (glyph->path() != nullptr) {
- maxDimensionOrPath = PathSummary::kIsPath;
- }
-
- PathSummary newSummary = {packedID, maxDimensionOrPath};
- summary = fSentPaths.set(newSummary);
+ // If the glyph is empty, count it as having a path so that it is not rejected.
+ bool markAsPath = glyph->isEmpty() || glyph->path() != nullptr;
+ hasPath = fSentPaths.set(packedID.glyphID(), markAsPath);
}
- if (summary->maxDimensionOrPath != PathSummary::kIsPath) {
- rejected->reject(i, (int)summary->maxDimensionOrPath);
+ if (*hasPath) {
+ accepted->accept(packedID, position);
+ } else {
+ rejected->reject(i);
}
});
}
@@ -532,30 +481,33 @@ void RemoteStrike::prepareForDrawableDrawing(
accepted->forEachInput(
[&](size_t i, SkPackedGlyphID packedID, SkPoint position) {
SkGlyphID glyphID = packedID.glyphID();
- DrawableSummary* summary = fSentDrawables.find(glyphID);
- if (summary == nullptr) {
+ bool* hasDrawable = fSentDrawables.find(glyphID);
+ if (hasDrawable == nullptr) {
// Put the new SkGlyph in the glyphs to send.
this->ensureScalerContext();
fDrawablesToSend.emplace_back(fContext->makeGlyph(packedID, &fAlloc));
SkGlyph* glyph = &fDrawablesToSend.back();
- uint16_t maxDimensionOrDrawable = glyph->maxDimension();
glyph->setDrawable(&fAlloc, fContext.get());
- if (glyph->drawable() != nullptr) {
- maxDimensionOrDrawable = DrawableSummary::kIsDrawable;
- }
-
- DrawableSummary newSummary = {glyph->getGlyphID(), maxDimensionOrDrawable};
- summary = fSentDrawables.set(newSummary);
+ // If the glyph is empty, count it as having a drawable so that it is not
+ // rejected.
+ bool makeAsDrawable = glyph->isEmpty() || glyph->drawable() != nullptr;
+ hasDrawable = fSentDrawables.set(glyphID, makeAsDrawable);
}
- if (summary->maxDimensionOrDrawable != DrawableSummary::kIsDrawable) {
- rejected->reject(i, (int)summary->maxDimensionOrDrawable);
+ if (*hasDrawable) {
+ accepted->accept(packedID, position);
+ } else {
+ rejected->reject(i);
}
});
}
+sktext::SkStrikePromise RemoteStrike::strikePromise() {
+ return sktext::SkStrikePromise{*this->fStrikeSpec};
+}
+
// -- WireTypeface ---------------------------------------------------------------------------------
struct WireTypeface {
WireTypeface() = default;
@@ -576,7 +528,7 @@ struct WireTypeface {
} // namespace
// -- SkStrikeServerImpl ---------------------------------------------------------------------------
-class SkStrikeServerImpl final : public SkStrikeForGPUCacheInterface {
+class SkStrikeServerImpl final : public sktext::StrikeForGPUCacheInterface {
public:
explicit SkStrikeServerImpl(
SkStrikeServer::DiscardableHandleManager* discardableHandleManager);
@@ -585,7 +537,7 @@ public:
sk_sp<SkData> serializeTypeface(SkTypeface*);
void writeStrikeData(std::vector<uint8_t>* memory);
- SkScopedStrikeForGPU findOrCreateScopedStrike(const SkStrikeSpec& strikeSpec) override;
+ sktext::ScopedStrikeForGPU findOrCreateScopedStrike(const SkStrikeSpec& strikeSpec) override;
// Methods for testing
void setMaxEntriesInDescriptorMapForTesting(size_t count);
@@ -698,8 +650,9 @@ void SkStrikeServerImpl::writeStrikeData(std::vector<uint8_t>* memory) {
#endif
}
-SkScopedStrikeForGPU SkStrikeServerImpl::findOrCreateScopedStrike(const SkStrikeSpec& strikeSpec) {
- return SkScopedStrikeForGPU{this->getOrCreateCache(strikeSpec)};
+sktext::ScopedStrikeForGPU SkStrikeServerImpl::findOrCreateScopedStrike(
+ const SkStrikeSpec& strikeSpec) {
+ return sktext::ScopedStrikeForGPU{this->getOrCreateCache(strikeSpec)};
}
void SkStrikeServerImpl::checkForDeletedEntries() {
@@ -806,7 +759,7 @@ public:
protected:
void onDrawGlyphRunList(SkCanvas*,
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
const SkPaint& initialPaint,
const SkPaint& drawingPaint) override {
SkMatrix drawMatrix = this->localToDevice();
@@ -814,35 +767,44 @@ protected:
// Just ignore the resulting SubRunContainer. Since we're passing in a null SubRunAllocator
// no SubRuns will be produced.
- SubRunContainer::MakeInAlloc(glyphRunList,
- drawMatrix,
- drawingPaint,
- this->strikeDeviceInfo(),
- fStrikeServerImpl,
- nullptr,
- "Cache Diff");
+ STSubRunAllocator<sizeof(SubRunContainer), alignof(SubRunContainer)> tempAlloc;
+ auto container = SubRunContainer::MakeInAlloc(glyphRunList,
+ drawMatrix,
+ drawingPaint,
+ this->strikeDeviceInfo(),
+ fStrikeServerImpl,
+ &tempAlloc,
+ SubRunContainer::kStrikeCalculationsOnly,
+ "Cache Diff");
+ // Calculations only. No SubRuns.
+ SkASSERT(container->isEmpty());
}
- sk_sp<sktext::gpu::Slug> convertGlyphRunListToSlug(const SkGlyphRunList& glyphRunList,
+ sk_sp<sktext::gpu::Slug> convertGlyphRunListToSlug(const sktext::GlyphRunList& glyphRunList,
const SkPaint& initialPaint,
const SkPaint& drawingPaint) override {
// Full matrix for placing glyphs.
SkMatrix positionMatrix = this->localToDevice();
positionMatrix.preTranslate(glyphRunList.origin().x(), glyphRunList.origin().y());
+#ifdef SK_SUPPORT_LEGACY_SLUG_CONVERT
// TODO these two passes can be converted into one when the SkRemoteGlyphCache's strike
// cache is fortified with enough information for supporting slug creation.
// Use the lightweight strike cache provided by SkRemoteGlyphCache through fPainter to do
// the analysis. Just ignore the resulting SubRunContainer. Since we're passing in a null
// SubRunAllocator no SubRuns will be produced.
- SubRunContainer::MakeInAlloc(glyphRunList,
- positionMatrix,
- drawingPaint,
- this->strikeDeviceInfo(),
- fStrikeServerImpl,
- nullptr,
- "Convert Slug Analysis");
+ STSubRunAllocator<sizeof(SubRunContainer), alignof(SubRunContainer)> tempAlloc;
+ auto container = SubRunContainer::MakeInAlloc(glyphRunList,
+ positionMatrix,
+ drawingPaint,
+ this->strikeDeviceInfo(),
+ fStrikeServerImpl,
+ &tempAlloc,
+ SubRunContainer::kStrikeCalculationsOnly,
+ "Convert Slug Analysis");
+ // Calculations only. No SubRuns.
+ SkASSERT(container->isEmpty());
// Use the glyph strike cache to get actual glyph information.
return skgpu::v1::MakeSlug(this->localToDevice(),
@@ -851,6 +813,15 @@ protected:
drawingPaint,
this->strikeDeviceInfo(),
SkStrikeCache::GlobalStrikeCache());
+#else
+ // Use the SkStrikeServer's strike cache to generate the Slug.
+ return skgpu::v1::MakeSlug(this->localToDevice(),
+ glyphRunList,
+ initialPaint,
+ drawingPaint,
+ this->strikeDeviceInfo(),
+ fStrikeServerImpl);
+#endif
}
private:
@@ -914,6 +885,7 @@ public:
~DiscardableStrikePinner() override = default;
bool canDelete() override { return fManager->deleteHandle(fDiscardableHandleId); }
+ void assertValid() override { fManager->assertHandleValid(fDiscardableHandleId); }
private:
const SkDiscardableHandleId fDiscardableHandleId;
@@ -1026,7 +998,7 @@ bool SkStrikeClientImpl::readStrikeData(const volatile void* memory, size_t memo
SkAutoDescriptor ad;
if (!deserializer.readDescriptor(&ad)) READ_FAILURE
#if defined(SK_TRACE_GLYPH_RUN_PROCESS)
- msg.appendf(" Received descriptor:\n%s", sourceAd.getDesc()->dumpRec().c_str());
+ msg.appendf(" Received descriptor:\n%s", ad.getDesc()->dumpRec().c_str());
#endif
bool fontMetricsInitialized;
@@ -1076,7 +1048,7 @@ bool SkStrikeClientImpl::readStrikeData(const volatile void* memory, size_t memo
SkTLazy<SkGlyph> glyph;
if (!ReadGlyph(glyph, &deserializer)) READ_FAILURE
- if (!glyph->isEmpty() && SkStrikeForGPU::FitsInAtlas(*glyph)) {
+ if (!glyph->isEmpty() && SkGlyphDigest::FitsInAtlas(*glyph)) {
const volatile void* image =
deserializer.read(glyph->imageSize(), glyph->formatAlignment());
if (!image) READ_FAILURE
diff --git a/chromium/third_party/skia/src/core/SkClipStack.cpp b/chromium/third_party/skia/src/core/SkClipStack.cpp
index a1016a4729d..aaa78c67e8c 100644
--- a/chromium/third_party/skia/src/core/SkClipStack.cpp
+++ b/chromium/third_party/skia/src/core/SkClipStack.cpp
@@ -972,7 +972,7 @@ void SkClipStack::Element::dump() const {
static_assert(2 == static_cast<int>(DeviceSpaceType::kRRect), "enum mismatch");
static_assert(3 == static_cast<int>(DeviceSpaceType::kPath), "enum mismatch");
static_assert(4 == static_cast<int>(DeviceSpaceType::kShader), "enum mismatch");
- static_assert(SK_ARRAY_COUNT(kTypeStrings) == kTypeCnt, "enum mismatch");
+ static_assert(std::size(kTypeStrings) == kTypeCnt, "enum mismatch");
const char* opName = this->isReplaceOp() ? "replace" :
(fOp == SkClipOp::kDifference ? "difference" : "intersect");
diff --git a/chromium/third_party/skia/src/core/SkColorFilter.cpp b/chromium/third_party/skia/src/core/SkColorFilter.cpp
index cc7f0dc4068..2b402bdb307 100644
--- a/chromium/third_party/skia/src/core/SkColorFilter.cpp
+++ b/chromium/third_party/skia/src/core/SkColorFilter.cpp
@@ -10,7 +10,7 @@
#include "include/core/SkUnPreMultiply.h"
#include "include/effects/SkRuntimeEffect.h"
#include "include/private/SkTDArray.h"
-#include "include/third_party/skcms/skcms.h"
+#include "modules/skcms/skcms.h"
#include "src/core/SkArenaAlloc.h"
#include "src/core/SkColorFilterBase.h"
#include "src/core/SkColorFilterPriv.h"
@@ -29,6 +29,11 @@
#include "src/gpu/ganesh/GrFragmentProcessor.h"
#endif
+#ifdef SK_ENABLE_SKSL
+#include "src/core/SkKeyHelpers.h"
+#include "src/core/SkPaintParamsKey.h"
+#endif
+
bool SkColorFilter::asAColorMode(SkColor* color, SkBlendMode* mode) const {
return as_CFB(this)->onAsAColorMode(color, mode);
}
@@ -61,7 +66,8 @@ bool SkColorFilterBase::onAsAColorMatrix(float matrix[20]) const {
#if SK_SUPPORT_GPU
GrFPResult SkColorFilterBase::asFragmentProcessor(std::unique_ptr<GrFragmentProcessor> inputFP,
GrRecordingContext* context,
- const GrColorInfo& dstColorInfo) const {
+ const GrColorInfo& dstColorInfo,
+ const SkSurfaceProps& props) const {
// This color filter doesn't implement `asFragmentProcessor`.
return GrFPFailure(std::move(inputFP));
}
@@ -108,8 +114,9 @@ SkPMColor4f SkColorFilterBase::onFilterColor4f(const SkPMColor4f& color,
pipeline.append_constant_color(&alloc, color.vec());
SkPaint blankPaint;
SkMatrixProvider matrixProvider(SkMatrix::I());
+ SkSurfaceProps props{}; // default OK; colorFilters don't render text
SkStageRec rec = {
- &pipeline, &alloc, kRGBA_F32_SkColorType, dstCS, blankPaint, nullptr, matrixProvider
+ &pipeline, &alloc, kRGBA_F32_SkColorType, dstCS, blankPaint, nullptr, matrixProvider, props
};
if (as_CFB(this)->onAppendStages(rec, color.fA == 1)) {
@@ -140,6 +147,16 @@ SkPMColor4f SkColorFilterBase::onFilterColor4f(const SkPMColor4f& color,
return SkPMColor4f{0,0,0,0};
}
+#ifdef SK_ENABLE_SKSL
+void SkColorFilterBase::addToKey(const SkKeyContext& keyContext,
+ SkPaintParamsKeyBuilder* builder,
+ SkPipelineDataGatherer* gatherer) const {
+ // Return the input color as-is.
+ PassthroughShaderBlock::BeginBlock(keyContext, builder, gatherer);
+ builder->endBlock();
+}
+#endif
+
///////////////////////////////////////////////////////////////////////////////////////////////////
class SkComposeColorFilter : public SkColorFilterBase {
@@ -168,28 +185,41 @@ public:
#if SK_SUPPORT_GPU
GrFPResult asFragmentProcessor(std::unique_ptr<GrFragmentProcessor> inputFP,
GrRecordingContext* context,
- const GrColorInfo& dstColorInfo) const override {
- GrFragmentProcessor* originalInputFP = inputFP.get();
+ const GrColorInfo& dstColorInfo,
+ const SkSurfaceProps& props) const override {
+ // Unfortunately, we need to clone the input before we know we need it. This lets us return
+ // the original FP if either internal color filter fails.
+ auto inputClone = inputFP ? inputFP->clone() : nullptr;
auto [innerSuccess, innerFP] =
- fInner->asFragmentProcessor(std::move(inputFP), context, dstColorInfo);
+ fInner->asFragmentProcessor(std::move(inputFP), context, dstColorInfo, props);
if (!innerSuccess) {
- return GrFPFailure(std::move(innerFP));
+ return GrFPFailure(std::move(inputClone));
}
auto [outerSuccess, outerFP] =
- fOuter->asFragmentProcessor(std::move(innerFP), context, dstColorInfo);
+ fOuter->asFragmentProcessor(std::move(innerFP), context, dstColorInfo, props);
if (!outerSuccess) {
- // In the rare event that the outer FP cannot be built, we have no good way of
- // separating the inputFP from the innerFP, so we need to return a cloned inputFP.
- // This could hypothetically be expensive, but failure here should be extremely rare.
- return GrFPFailure(originalInputFP->clone());
+ return GrFPFailure(std::move(inputClone));
}
return GrFPSuccess(std::move(outerFP));
}
#endif
+#ifdef SK_ENABLE_SKSL
+ void addToKey(const SkKeyContext& keyContext,
+ SkPaintParamsKeyBuilder* builder,
+ SkPipelineDataGatherer* gatherer) const override {
+ ComposeColorFilterBlock::BeginBlock(keyContext, builder, gatherer);
+
+ as_CFB(fInner)->addToKey(keyContext, builder, gatherer);
+ as_CFB(fOuter)->addToKey(keyContext, builder, gatherer);
+
+ builder->endBlock();
+ }
+#endif // SK_ENABLE_SKSL
+
SK_FLATTENABLE_HOOKS(SkComposeColorFilter)
protected:
@@ -248,7 +278,8 @@ public:
#if SK_SUPPORT_GPU
GrFPResult asFragmentProcessor(std::unique_ptr<GrFragmentProcessor> inputFP,
GrRecordingContext* context,
- const GrColorInfo& dstColorInfo) const override {
+ const GrColorInfo& dstColorInfo,
+ const SkSurfaceProps& props) const override {
// wish our caller would let us know if our input was opaque...
constexpr SkAlphaType alphaType = kPremul_SkAlphaType;
switch (fDir) {
@@ -353,7 +384,8 @@ struct SkWorkingFormatColorFilter : public SkColorFilterBase {
#if SK_SUPPORT_GPU
GrFPResult asFragmentProcessor(std::unique_ptr<GrFragmentProcessor> inputFP,
GrRecordingContext* context,
- const GrColorInfo& dstColorInfo) const override {
+ const GrColorInfo& dstColorInfo,
+ const SkSurfaceProps& props) const override {
sk_sp<SkColorSpace> dstCS = dstColorInfo.refColorSpace();
if (!dstCS) { dstCS = SkColorSpace::MakeSRGB(); }
@@ -364,7 +396,8 @@ struct SkWorkingFormatColorFilter : public SkColorFilterBase {
working = {dstColorInfo.colorType(), workingAT, workingCS};
auto [ok, fp] = as_CFB(fChild)->asFragmentProcessor(
- GrColorSpaceXformEffect::Make(std::move(inputFP), dst,working), context, working);
+ GrColorSpaceXformEffect::Make(std::move(inputFP), dst,working), context, working,
+ props);
return ok ? GrFPSuccess(GrColorSpaceXformEffect::Make(std::move(fp), working,dst))
: GrFPFailure(std::move(fp));
@@ -472,7 +505,7 @@ sk_sp<SkColorFilter> SkColorFilters::Lerp(float weight, sk_sp<SkColorFilter> cf0
return cf1;
}
- sk_sp<SkRuntimeEffect> effect = SkMakeCachedRuntimeEffect(
+ static const SkRuntimeEffect* effect = SkMakeCachedRuntimeEffect(
SkRuntimeEffect::MakeForColorFilter,
"uniform colorFilter cf0;"
"uniform colorFilter cf1;"
@@ -480,12 +513,12 @@ sk_sp<SkColorFilter> SkColorFilters::Lerp(float weight, sk_sp<SkColorFilter> cf0
"half4 main(half4 color) {"
"return mix(cf0.eval(color), cf1.eval(color), weight);"
"}"
- );
+ ).release();
SkASSERT(effect);
sk_sp<SkColorFilter> inputs[] = {cf0,cf1};
return effect->makeColorFilter(SkData::MakeWithCopy(&weight, sizeof(weight)),
- inputs, SK_ARRAY_COUNT(inputs));
+ inputs, std::size(inputs));
#else
// TODO(skia:12197)
return nullptr;
@@ -494,11 +527,11 @@ sk_sp<SkColorFilter> SkColorFilters::Lerp(float weight, sk_sp<SkColorFilter> cf0
///////////////////////////////////////////////////////////////////////////////////////////////////
-#include "src/core/SkModeColorFilter.h"
-
+// TODO: once all these are converted to the new style of registration, move them all to
+// SkFlattenable::PrivateInitializer::InitEffects
void SkColorFilterBase::RegisterFlattenables() {
SK_REGISTER_FLATTENABLE(SkComposeColorFilter);
- SK_REGISTER_FLATTENABLE(SkModeColorFilter);
+ SkRegisterModeColorFilterFlattenable();
SK_REGISTER_FLATTENABLE(SkSRGBGammaColorFilter);
SK_REGISTER_FLATTENABLE(SkWorkingFormatColorFilter);
}
diff --git a/chromium/third_party/skia/src/core/SkColorFilterBase.h b/chromium/third_party/skia/src/core/SkColorFilterBase.h
index 61649aa2554..184c478b10f 100644
--- a/chromium/third_party/skia/src/core/SkColorFilterBase.h
+++ b/chromium/third_party/skia/src/core/SkColorFilterBase.h
@@ -17,8 +17,13 @@ class GrFragmentProcessor;
class GrRecordingContext;
class SkArenaAlloc;
class SkBitmap;
+class SkColorInfo;
class SkColorSpace;
+class SkKeyContext;
+class SkPaintParamsKeyBuilder;
+class SkPipelineDataGatherer;
class SkRuntimeEffect;
+class SkSurfaceProps;
struct SkStageRec;
using GrFPResult = std::tuple<bool, std::unique_ptr<GrFragmentProcessor>>;
@@ -47,7 +52,8 @@ public:
*/
virtual GrFPResult asFragmentProcessor(std::unique_ptr<GrFragmentProcessor> inputFP,
GrRecordingContext* context,
- const GrColorInfo& dstColorInfo) const;
+ const GrColorInfo& dstColorInfo,
+ const SkSurfaceProps& props) const;
#endif
bool affectsTransparentBlack() const {
@@ -75,6 +81,20 @@ public:
virtual SkPMColor4f onFilterColor4f(const SkPMColor4f& color, SkColorSpace* dstCS) const;
+#ifdef SK_ENABLE_SKSL
+ /**
+ Add implementation details, for the specified backend, of this SkColorFilter to the
+ provided key.
+
+ @param keyContext backend context for key creation
+ @param builder builder for creating the key for this SkShader
+ @param gatherer if non-null, storage for this colorFilter's data
+ */
+ virtual void addToKey(const SkKeyContext& keyContext,
+ SkPaintParamsKeyBuilder* builder,
+ SkPipelineDataGatherer* gatherer) const;
+#endif
+
protected:
SkColorFilterBase() {}
@@ -108,4 +128,7 @@ static inline sk_sp<SkColorFilterBase> as_CFB_sp(sk_sp<SkColorFilter> filter) {
return sk_sp<SkColorFilterBase>(static_cast<SkColorFilterBase*>(filter.release()));
}
+void SkRegisterMatrixColorFilterFlattenable();
+void SkRegisterModeColorFilterFlattenable();
+
#endif
diff --git a/chromium/third_party/skia/src/core/SkColorFilter_Matrix.cpp b/chromium/third_party/skia/src/core/SkColorFilter_Matrix.cpp
index 7734397afac..ba4e60f1a6d 100644
--- a/chromium/third_party/skia/src/core/SkColorFilter_Matrix.cpp
+++ b/chromium/third_party/skia/src/core/SkColorFilter_Matrix.cpp
@@ -6,12 +6,11 @@
*/
#include "include/core/SkRefCnt.h"
-#include "include/core/SkString.h"
#include "include/core/SkUnPreMultiply.h"
#include "include/effects/SkColorMatrix.h"
#include "include/effects/SkRuntimeEffect.h"
#include "include/private/SkColorData.h"
-#include "src/core/SkColorFilter_Matrix.h"
+#include "src/core/SkColorFilterBase.h"
#include "src/core/SkColorSpacePriv.h"
#include "src/core/SkRasterPipeline.h"
#include "src/core/SkReadBuffer.h"
@@ -19,6 +18,11 @@
#include "src/core/SkVM.h"
#include "src/core/SkWriteBuffer.h"
+#ifdef SK_ENABLE_SKSL
+#include "src/core/SkKeyHelpers.h"
+#include "src/core/SkPaintParamsKey.h"
+#endif // SK_ENABLE_SKSL
+
static bool is_alpha_unchanged(const float matrix[20]) {
const float* srcA = matrix + 15;
@@ -29,9 +33,46 @@ static bool is_alpha_unchanged(const float matrix[20]) {
&& SkScalarNearlyZero (srcA[4]);
}
+class SkColorFilter_Matrix : public SkColorFilterBase {
+public:
+ enum class Domain : uint8_t { kRGBA, kHSLA };
+
+ explicit SkColorFilter_Matrix(const float array[20], Domain);
+
+ bool onIsAlphaUnchanged() const override { return fAlphaIsUnchanged; }
+
+#if SK_SUPPORT_GPU
+ GrFPResult asFragmentProcessor(std::unique_ptr<GrFragmentProcessor> inputFP,
+ GrRecordingContext*,
+ const GrColorInfo&,
+ const SkSurfaceProps&) const override;
+#endif
+#ifdef SK_ENABLE_SKSL
+ void addToKey(const SkKeyContext&,
+ SkPaintParamsKeyBuilder*,
+ SkPipelineDataGatherer*) const override;
+#endif
+
+private:
+ friend void ::SkRegisterMatrixColorFilterFlattenable();
+ SK_FLATTENABLE_HOOKS(SkColorFilter_Matrix)
+
+ void flatten(SkWriteBuffer&) const override;
+ bool onAsAColorMatrix(float matrix[20]) const override;
+
+ bool onAppendStages(const SkStageRec& rec, bool shaderIsOpaque) const override;
+ skvm::Color onProgram(skvm::Builder*, skvm::Color,
+ const SkColorInfo& dst,
+ skvm::Uniforms* uniforms, SkArenaAlloc*) const override;
+
+ float fMatrix[20];
+ bool fAlphaIsUnchanged;
+ Domain fDomain;
+};
+
SkColorFilter_Matrix::SkColorFilter_Matrix(const float array[20], Domain domain)
- : fAlphaIsUnchanged(is_alpha_unchanged(array))
- , fDomain(domain) {
+ : fAlphaIsUnchanged(is_alpha_unchanged(array))
+ , fDomain(domain) {
memcpy(fMatrix, array, 20 * sizeof(float));
}
@@ -121,83 +162,34 @@ skvm::Color SkColorFilter_Matrix::onProgram(skvm::Builder* p, skvm::Color c,
#if SK_SUPPORT_GPU
#include "src/gpu/ganesh/effects/GrSkSLFP.h"
-// Convert RGBA -> HSLA (including unpremul).
-//
-// Based on work by Sam Hocevar, Emil Persson, and Ian Taylor [1][2][3]. High-level ideas:
-//
-// - minimize the number of branches by sorting and computing the hue phase in parallel (vec4s)
-//
-// - trade the third sorting branch for a potentially faster std::min and leaving 2nd/3rd
-// channels unsorted (based on the observation that swapping both the channels and the bias sign
-// has no effect under abs)
-//
-// - use epsilon offsets for denominators, to avoid explicit zero-checks
-//
-// An additional trick we employ is deferring premul->unpremul conversion until the very end: the
-// alpha factor gets naturally simplified for H and S, and only L requires a dedicated unpremul
-// division (so we trade three divs for one).
-//
-// [1] http://lolengine.net/blog/2013/01/13/fast-rgb-to-hsv
-// [2] http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl
-// [3] http://www.chilliant.com/rgb2hsv.html
static std::unique_ptr<GrFragmentProcessor> rgb_to_hsl(std::unique_ptr<GrFragmentProcessor> child) {
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForColorFilter, R"(
- half4 main(half4 c) {
- half4 p = (c.g < c.b) ? half4(c.bg, -1, 2/3.0)
- : half4(c.gb, 0, -1/3.0);
- half4 q = (c.r < p.x) ? half4(p.x, c.r, p.yw)
- : half4(c.r, p.x, p.yz);
-
- // q.x -> max channel value
- // q.yz -> 2nd/3rd channel values (unsorted)
- // q.w -> bias value dependent on max channel selection
-
- half eps = 0.0001;
- half pmV = q.x;
- half pmC = pmV - min(q.y, q.z);
- half pmL = pmV - pmC * 0.5;
- half H = abs(q.w + (q.y - q.z) / (pmC * 6 + eps));
- half S = pmC / (c.a + eps - abs(pmL * 2 - c.a));
- half L = pmL / (c.a + eps);
-
- return half4(H, S, L, c.a);
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForColorFilter,
+ R"(
+ half4 main(half4 color) {
+ return $rgb_to_hsl(color.rgb, color.a);
}
)");
SkASSERT(SkRuntimeEffectPriv::SupportsConstantOutputForConstantInput(effect));
- return GrSkSLFP::Make(
- effect, "RgbToHsl", std::move(child), GrSkSLFP::OptFlags::kPreservesOpaqueInput);
+ return GrSkSLFP::Make(effect, "RgbToHsl", std::move(child),
+ GrSkSLFP::OptFlags::kPreservesOpaqueInput);
}
-// Convert HSLA -> RGBA (including clamp and premul).
-//
-// Based on work by Sam Hocevar, Emil Persson, and Ian Taylor [1][2][3].
-//
-// [1] http://lolengine.net/blog/2013/01/13/fast-rgb-to-hsv
-// [2] http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl
-// [3] http://www.chilliant.com/rgb2hsv.html
static std::unique_ptr<GrFragmentProcessor> hsl_to_rgb(std::unique_ptr<GrFragmentProcessor> child) {
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForColorFilter, R"(
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForColorFilter,
+ R"(
half4 main(half4 color) {
- half3 hsl = color.rgb;
-
- half C = (1 - abs(2 * hsl.z - 1)) * hsl.y;
- half3 p = hsl.xxx + half3(0, 2/3.0, 1/3.0);
- half3 q = saturate(abs(fract(p) * 6 - 3) - 1);
- half3 rgb = (q - 0.5) * C + hsl.z;
-
- color = saturate(half4(rgb, color.a));
- color.rgb *= color.a;
- return color;
+ return $hsl_to_rgb(color.rgb, color.a);
}
)");
SkASSERT(SkRuntimeEffectPriv::SupportsConstantOutputForConstantInput(effect));
- return GrSkSLFP::Make(
- effect, "HslToRgb", std::move(child), GrSkSLFP::OptFlags::kPreservesOpaqueInput);
+ return GrSkSLFP::Make(effect, "HslToRgb", std::move(child),
+ GrSkSLFP::OptFlags::kPreservesOpaqueInput);
}
GrFPResult SkColorFilter_Matrix::asFragmentProcessor(std::unique_ptr<GrFragmentProcessor> fp,
GrRecordingContext*,
- const GrColorInfo&) const {
+ const GrColorInfo&,
+ const SkSurfaceProps&) const {
switch (fDomain) {
case Domain::kRGBA:
fp = GrFragmentProcessor::ColorMatrix(std::move(fp), fMatrix,
@@ -219,7 +211,19 @@ GrFPResult SkColorFilter_Matrix::asFragmentProcessor(std::unique_ptr<GrFragmentP
return GrFPSuccess(std::move(fp));
}
-#endif
+#endif // SK_SUPPORT_GPU
+
+#ifdef SK_ENABLE_SKSL
+void SkColorFilter_Matrix::addToKey(const SkKeyContext& keyContext,
+ SkPaintParamsKeyBuilder* builder,
+ SkPipelineDataGatherer* gatherer) const {
+ MatrixColorFilterBlock::MatrixColorFilterData matrixCFData(fMatrix,
+ fDomain == Domain::kHSLA);
+
+ MatrixColorFilterBlock::BeginBlock(keyContext, builder, gatherer, matrixCFData);
+ builder->endBlock();
+}
+#endif // SK_ENABLE_SKSL
///////////////////////////////////////////////////////////////////////////////
@@ -247,6 +251,6 @@ sk_sp<SkColorFilter> SkColorFilters::HSLAMatrix(const SkColorMatrix& cm) {
return MakeMatrix(cm.fMat.data(), SkColorFilter_Matrix::Domain::kHSLA);
}
-void SkColorFilter_Matrix::RegisterFlattenables() {
+void SkRegisterMatrixColorFilterFlattenable() {
SK_REGISTER_FLATTENABLE(SkColorFilter_Matrix);
}
diff --git a/chromium/third_party/skia/src/core/SkColorFilter_Matrix.h b/chromium/third_party/skia/src/core/SkColorFilter_Matrix.h
deleted file mode 100644
index 8f94503eaf4..00000000000
--- a/chromium/third_party/skia/src/core/SkColorFilter_Matrix.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkColorFilter_Matrix_DEFINED
-#define SkColorFilter_Matrix_DEFINED
-
-#include "src/core/SkColorFilterBase.h"
-
-class SkColorFilter_Matrix : public SkColorFilterBase {
-public:
- enum class Domain : uint8_t { kRGBA, kHSLA };
-
- explicit SkColorFilter_Matrix(const float array[20], Domain);
-
- bool onIsAlphaUnchanged() const override { return fAlphaIsUnchanged; }
-
-#if SK_SUPPORT_GPU
- GrFPResult asFragmentProcessor(std::unique_ptr<GrFragmentProcessor> inputFP,
- GrRecordingContext*, const GrColorInfo&) const override;
-#endif
-
- static void RegisterFlattenables();
-
-private:
- void flatten(SkWriteBuffer&) const override;
- bool onAsAColorMatrix(float matrix[20]) const override;
-
- SK_FLATTENABLE_HOOKS(SkColorFilter_Matrix)
-
- bool onAppendStages(const SkStageRec& rec, bool shaderIsOpaque) const override;
- skvm::Color onProgram(skvm::Builder*, skvm::Color,
- const SkColorInfo& dst,
- skvm::Uniforms* uniforms, SkArenaAlloc*) const override;
-
- float fMatrix[20];
- bool fAlphaIsUnchanged;
- Domain fDomain;
-
- using INHERITED = SkColorFilterBase;
-};
-
-#endif
diff --git a/chromium/third_party/skia/src/core/SkColorSpace.cpp b/chromium/third_party/skia/src/core/SkColorSpace.cpp
index 7e92a2310f3..387e29c259d 100644
--- a/chromium/third_party/skia/src/core/SkColorSpace.cpp
+++ b/chromium/third_party/skia/src/core/SkColorSpace.cpp
@@ -8,7 +8,7 @@
#include "include/core/SkColorSpace.h"
#include "include/core/SkData.h"
#include "include/private/SkTemplates.h"
-#include "include/third_party/skcms/skcms.h"
+#include "modules/skcms/skcms.h"
#include "src/core/SkColorSpacePriv.h"
#include "src/core/SkOpts.h"
diff --git a/chromium/third_party/skia/src/core/SkColorSpaceXformSteps.cpp b/chromium/third_party/skia/src/core/SkColorSpaceXformSteps.cpp
index f61b0f266ee..ae9d7c3f069 100644
--- a/chromium/third_party/skia/src/core/SkColorSpaceXformSteps.cpp
+++ b/chromium/third_party/skia/src/core/SkColorSpaceXformSteps.cpp
@@ -10,7 +10,7 @@
#include "include/core/SkColorSpace.h"
#include "include/core/SkTypes.h"
#include "include/private/SkFloatingPoint.h"
-#include "include/third_party/skcms/skcms.h"
+#include "modules/skcms/skcms.h"
#include "src/core/SkColorSpacePriv.h"
#include "src/core/SkRasterPipeline.h"
#include "src/core/SkVM.h"
diff --git a/chromium/third_party/skia/src/core/SkColorSpaceXformSteps.h b/chromium/third_party/skia/src/core/SkColorSpaceXformSteps.h
index e9d5d74eb9e..2b8bdaa407e 100644
--- a/chromium/third_party/skia/src/core/SkColorSpaceXformSteps.h
+++ b/chromium/third_party/skia/src/core/SkColorSpaceXformSteps.h
@@ -9,7 +9,7 @@
#define SkColorSpaceXformSteps_DEFINED
#include "include/core/SkAlphaType.h"
-#include "include/third_party/skcms/skcms.h"
+#include "modules/skcms/skcms.h"
#include "src/core/SkVM.h"
#include <stdint.h>
diff --git a/chromium/third_party/skia/src/core/SkCombinationBuilder.cpp b/chromium/third_party/skia/src/core/SkCombinationBuilder.cpp
index cb69d696347..3698404ec10 100644
--- a/chromium/third_party/skia/src/core/SkCombinationBuilder.cpp
+++ b/chromium/third_party/skia/src/core/SkCombinationBuilder.cpp
@@ -95,6 +95,8 @@ public:
int numCombinations() const;
+ void addToKey(const SkKeyContext&, int desiredCombination, SkPaintParamsKeyBuilder*);
+
#ifdef SK_DEBUG
void dump(int indent) const;
#endif
@@ -153,6 +155,39 @@ public:
return this->numIntrinsicCombinations() * this->numChildCombinations();
}
+ void addToKey(const SkKeyContext& keyContext,
+ int desiredCombination,
+ SkPaintParamsKeyBuilder* keyBuilder) {
+ SkASSERT(desiredCombination < this->numCombinations());
+
+ int intrinsicCombination = desiredCombination / this->numChildCombinations();
+ int childCombination = desiredCombination % this->numChildCombinations();
+
+ this->beginBlock(keyContext, intrinsicCombination, keyBuilder);
+
+ if (fNumSlots) {
+ int numCombinationsSeen = 0;
+ for (int slotIndex = 0; slotIndex < fNumSlots; ++slotIndex) {
+ SkSlot* slot = this->getSlot(slotIndex);
+
+ numCombinationsSeen += slot->numCombinations();
+ int numCombosLeft = this->numChildCombinations() / numCombinationsSeen;
+
+ int slotCombination;
+ if (slotIndex+1 < fNumSlots) {
+ slotCombination = childCombination / (numCombosLeft ? numCombosLeft : 1);
+ childCombination %= numCombosLeft;
+ } else {
+ slotCombination = childCombination;
+ }
+
+ slot->addToKey(keyContext, slotCombination, keyBuilder);
+ }
+ }
+
+ keyBuilder->endBlock();
+ }
+
#ifdef SK_DEBUG
void dump(int indent = 0) const {
SkDebugf("%s", type_to_str(fType));
@@ -209,6 +244,21 @@ int SkOption::SkSlot::numCombinations() const {
return numCombinations;
}
+void SkOption::SkSlot::addToKey(const SkKeyContext& keyContext,
+ int desiredCombination,
+ SkPaintParamsKeyBuilder* keyBuilder) {
+ SkASSERT(desiredCombination < this->numCombinations());
+
+ for (SkOption* option = fHead; option; option = option->fNext) {
+ if (desiredCombination < option->numCombinations()) {
+ option->addToKey(keyContext, desiredCombination, keyBuilder);
+ return;
+ }
+
+ desiredCombination -= option->numCombinations();
+ }
+}
+
#ifdef SK_DEBUG
void SkOption::SkSlot::dump(int indent) const {
SkDebugf("{ %d } ", this->numCombinations());
@@ -460,19 +510,11 @@ int SkCombinationOption::numChildSlots() const { return fDataInArena->numSlots()
SkDEBUGCODE(int SkCombinationOption::epoch() const { return fDataInArena->epoch(); })
//--------------------------------------------------------------------------------------------------
-#ifdef SK_GRAPHITE_ENABLED
-SkCombinationBuilder::SkCombinationBuilder(skgpu::graphite::Context* context)
- : fDictionary(context->priv().shaderCodeDictionary()) {
- fArena = std::make_unique<SkArenaAllocWithReset>(64);
- this->reset();
-}
-#else
SkCombinationBuilder::SkCombinationBuilder(SkShaderCodeDictionary* dict)
: fDictionary(dict) {
fArena = std::make_unique<SkArenaAllocWithReset>(64);
this->reset();
}
-#endif
SkCombinationBuilder::~SkCombinationBuilder() = default;
@@ -643,6 +685,40 @@ void SkCombinationBuilder::dump() const {
}
#endif
+void SkCombinationBuilder::createKey(const SkKeyContext& keyContext,
+ int desiredCombination,
+ SkPaintParamsKeyBuilder* keyBuilder) {
+ SkDEBUGCODE(keyBuilder->checkReset();)
+ SkASSERT(desiredCombination < this->numCombinations());
+
+ int numBlendModeCombos = this->numBlendModeCombinations();
+
+ int desiredShaderCombination = desiredCombination / numBlendModeCombos;
+ int desiredBlendCombination = desiredCombination % numBlendModeCombos;
+
+ for (SkOption* shaderOption : fShaderOptions) {
+ if (desiredShaderCombination < shaderOption->numCombinations()) {
+ shaderOption->addToKey(keyContext, desiredShaderCombination, keyBuilder);
+ break;
+ }
+
+ desiredShaderCombination -= shaderOption->numCombinations();
+ }
+
+ if (desiredBlendCombination < SkPopCount(fBlendModes)) {
+ int ith_set_bit = SkNthSet(fBlendModes, desiredBlendCombination);
+
+ SkASSERT(ith_set_bit < kSkBlendModeCount);
+ SkBlendMode bm = (SkBlendMode) ith_set_bit;
+
+ BlendModeBlock::BeginBlock(keyContext, keyBuilder, /*gatherer=*/nullptr, bm); // bm is used!
+ keyBuilder->endBlock();
+ } else {
+ // TODO: need to handle fBlenders here
+ }
+
+}
+
void SkCombinationBuilder::buildCombinations(
SkShaderCodeDictionary* dict,
const std::function<void(SkUniquePaintParamsID)>& func) {
@@ -659,23 +735,12 @@ void SkCombinationBuilder::buildCombinations(
this->addOption(SkShaderType::kSolidColor);
}
- for (int i = 0; i < kSkBlendModeCount; ++i) {
- if (!(fBlendModes & (0x1 << i))) {
- continue;
- }
-
- SkBlendMode bm = (SkBlendMode) i;
+ int numCombos = this->numCombinations();
+ for (int i = 0; i < numCombos; ++i) {
+ this->createKey(keyContext, i, &builder);
- // TODO: actually iterate over the SkOption's combinations and have each option add
- // itself to the key.
- for (SkOption* shaderOption : fShaderOptions) {
- // TODO: expand CreateKey to take either an SkBlendMode or an SkBlendID
- SkUniquePaintParamsID uniqueID = CreateKey(keyContext, &builder,
- shaderOption->type(), bm);
+ auto entry = dict->findOrCreate(&builder);
- func(uniqueID);
- }
+ func(entry->uniqueID());
}
-
- // TODO: need to loop over fBlenders here
}
diff --git a/chromium/third_party/skia/src/core/SkCoreBlitters.h b/chromium/third_party/skia/src/core/SkCoreBlitters.h
index 92e49246431..89c5dd92ad2 100644
--- a/chromium/third_party/skia/src/core/SkCoreBlitters.h
+++ b/chromium/third_party/skia/src/core/SkCoreBlitters.h
@@ -15,6 +15,8 @@
#include "src/shaders/SkBitmapProcShader.h"
#include "src/shaders/SkShaderBase.h"
+class SkSurfaceProps;
+
class SkRasterBlitter : public SkBlitter {
public:
SkRasterBlitter(const SkPixmap& device) : fDevice(device) {}
@@ -166,7 +168,7 @@ private:
SkBlitter* SkCreateRasterPipelineBlitter(const SkPixmap&, const SkPaint&,
const SkMatrixProvider& matrixProvider, SkArenaAlloc*,
- sk_sp<SkShader> clipShader);
+ sk_sp<SkShader> clipShader, const SkSurfaceProps& props);
// Use this if you've pre-baked a shader pipeline, including modulating with paint alpha.
SkBlitter* SkCreateRasterPipelineBlitter(const SkPixmap&, const SkPaint&,
const SkRasterPipeline& shaderPipeline,
diff --git a/chromium/third_party/skia/src/core/SkCpu.cpp b/chromium/third_party/skia/src/core/SkCpu.cpp
index a88f49802ff..24040218077 100644
--- a/chromium/third_party/skia/src/core/SkCpu.cpp
+++ b/chromium/third_party/skia/src/core/SkCpu.cpp
@@ -105,10 +105,10 @@
}
const char kMongoose3[] = "0x00000000531f0020"; // 53 == Samsung.
- char buf[SK_ARRAY_COUNT(kMongoose3) - 1]; // No need for the terminating \0.
+ char buf[std::size(kMongoose3) - 1]; // No need for the terminating \0.
- if (SK_ARRAY_COUNT(buf) != midr_el1.read(buf, SK_ARRAY_COUNT(buf))
- || 0 == memcmp(kMongoose3, buf, SK_ARRAY_COUNT(buf))) {
+ if (std::size(buf) != midr_el1.read(buf, std::size(buf))
+ || 0 == memcmp(kMongoose3, buf, std::size(buf))) {
features &= ~(SkCpu::ASIMDHP);
}
}
diff --git a/chromium/third_party/skia/src/core/SkDeferredDisplayListRecorder.cpp b/chromium/third_party/skia/src/core/SkDeferredDisplayListRecorder.cpp
index dd333a1fa4a..f2de0521660 100644
--- a/chromium/third_party/skia/src/core/SkDeferredDisplayListRecorder.cpp
+++ b/chromium/third_party/skia/src/core/SkDeferredDisplayListRecorder.cpp
@@ -163,7 +163,7 @@ bool SkDeferredDisplayListRecorder::init() {
fCharacterization.refColorSpace(),
fCharacterization.origin(),
fCharacterization.surfaceProps(),
- skgpu::BaseDevice::InitContents::kUninit);
+ skgpu::v1::Device::InitContents::kUninit);
if (!device) {
return false;
}
diff --git a/chromium/third_party/skia/src/core/SkDevice.cpp b/chromium/third_party/skia/src/core/SkDevice.cpp
index 50ea118536b..f98d0390b70 100644
--- a/chromium/third_party/skia/src/core/SkDevice.cpp
+++ b/chromium/third_party/skia/src/core/SkDevice.cpp
@@ -17,7 +17,6 @@
#include "include/core/SkVertices.h"
#include "include/private/SkTo.h"
#include "src/core/SkDraw.h"
-#include "src/core/SkGlyphRun.h"
#include "src/core/SkImageFilterCache.h"
#include "src/core/SkImageFilter_Base.h"
#include "src/core/SkImagePriv.h"
@@ -32,6 +31,7 @@
#include "src/core/SkTextBlobPriv.h"
#include "src/image/SkImage_Base.h"
#include "src/shaders/SkLocalMatrixShader.h"
+#include "src/text/GlyphRun.h"
#include "src/utils/SkPatchUtils.h"
#if SK_SUPPORT_GPU
#include "include/private/chromium/Slug.h"
@@ -388,7 +388,6 @@ bool SkBaseDevice::peekPixels(SkPixmap* pmap) {
#include "src/core/SkUtils.h"
-
// TODO: This does not work for arbitrary shader DAGs (when there is no single leaf local matrix).
// What we really need is proper post-LM plumbing for shaders.
static sk_sp<SkShader> make_post_inverse_lm(const SkShader* shader, const SkMatrix& m) {
@@ -426,7 +425,7 @@ static sk_sp<SkShader> make_post_inverse_lm(const SkShader* shader, const SkMatr
}
void SkBaseDevice::drawGlyphRunList(SkCanvas* canvas,
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
const SkPaint& initialPaint,
const SkPaint& drawingPaint) {
if (!this->localToDevice().isFinite()) {
@@ -441,10 +440,10 @@ void SkBaseDevice::drawGlyphRunList(SkCanvas* canvas,
}
void SkBaseDevice::simplifyGlyphRunRSXFormAndRedraw(SkCanvas* canvas,
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
const SkPaint& initialPaint,
const SkPaint& drawingPaint) {
- for (const SkGlyphRun& run : glyphRunList) {
+ for (const sktext::GlyphRun& run : glyphRunList) {
if (run.scaledRotations().empty()) {
auto subList = glyphRunList.builder()->makeGlyphRunList(
run, run.sourceBounds(drawingPaint), {0, 0});
@@ -453,7 +452,7 @@ void SkBaseDevice::simplifyGlyphRunRSXFormAndRedraw(SkCanvas* canvas,
SkPoint origin = glyphRunList.origin();
SkPoint sharedPos{0, 0}; // we're at the origin
SkGlyphID sharedGlyphID;
- SkGlyphRun glyphRun {
+ sktext::GlyphRun glyphRun {
run.font(),
SkSpan<const SkPoint>{&sharedPos, 1},
SkSpan<const SkGlyphID>{&sharedGlyphID, 1},
@@ -478,7 +477,7 @@ void SkBaseDevice::simplifyGlyphRunRSXFormAndRedraw(SkCanvas* canvas,
make_post_inverse_lm(drawingPaint.getShader(), glyphToLocal));
SkAutoCanvasRestore acr(canvas, true);
canvas->concat(SkM44(glyphToLocal));
- SkGlyphRunList subList = glyphRunList.builder()->makeGlyphRunList(
+ sktext::GlyphRunList subList = glyphRunList.builder()->makeGlyphRunList(
glyphRun, glyphRun.sourceBounds(drawingPaint), {0, 0});
this->drawGlyphRunList(canvas, subList, initialPaint, invertingPaint);
}
@@ -488,7 +487,7 @@ void SkBaseDevice::simplifyGlyphRunRSXFormAndRedraw(SkCanvas* canvas,
#if (SK_SUPPORT_GPU || defined(SK_GRAPHITE_ENABLED))
sk_sp<sktext::gpu::Slug> SkBaseDevice::convertGlyphRunListToSlug(
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
const SkPaint& initialPaint,
const SkPaint& drawingPaint) {
return nullptr;
diff --git a/chromium/third_party/skia/src/core/SkDevice.h b/chromium/third_party/skia/src/core/SkDevice.h
index 3052e1c51bd..acacfb3ed1a 100644
--- a/chromium/third_party/skia/src/core/SkDevice.h
+++ b/chromium/third_party/skia/src/core/SkDevice.h
@@ -22,12 +22,14 @@
#include "src/core/SkScalerContext.h"
#include "src/shaders/SkShaderBase.h"
+namespace sktext {
+class GlyphRun;
+class GlyphRunList;
+}
class SkBitmap;
class SkColorSpace;
class SkMesh;
struct SkDrawShadowRec;
-class SkGlyphRun;
-class SkGlyphRunList;
class SkImageFilter;
class SkImageFilterCache;
struct SkIRect;
@@ -35,8 +37,8 @@ class SkRasterHandleAllocator;
class SkSpecialImage;
namespace skif { class Mapping; }
-namespace skgpu {
-class BaseDevice;
+namespace skgpu::v1 {
+class Device;
}
namespace skgpu::graphite {
class Device;
@@ -212,12 +214,12 @@ public:
virtual bool android_utils_clipWithStencil() { return false; }
- virtual skgpu::BaseDevice* asGaneshDevice() { return nullptr; }
+ virtual skgpu::v1::Device* asGaneshDevice() { return nullptr; }
virtual skgpu::graphite::Device* asGraphiteDevice() { return nullptr; }
// Ensure that non-RSXForm runs are passed to onDrawGlyphRunList.
void drawGlyphRunList(SkCanvas*,
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
const SkPaint& initialPaint,
const SkPaint& drawingPaint);
@@ -332,14 +334,14 @@ protected:
// Only called with glyphRunLists that do not contain RSXForm.
virtual void onDrawGlyphRunList(SkCanvas*,
- const SkGlyphRunList&,
+ const sktext::GlyphRunList&,
const SkPaint& initialPaint,
const SkPaint& drawingPaint) = 0;
// Slug handling routines.
#if (SK_SUPPORT_GPU || defined(SK_GRAPHITE_ENABLED))
virtual sk_sp<sktext::gpu::Slug> convertGlyphRunListToSlug(
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
const SkPaint& initialPaint,
const SkPaint& drawingPaint);
virtual void drawSlug(SkCanvas*, const sktext::gpu::Slug* slug, const SkPaint& drawingPaint);
@@ -461,7 +463,7 @@ private:
friend class DeviceTestingAccess;
void simplifyGlyphRunRSXFormAndRedraw(SkCanvas*,
- const SkGlyphRunList&,
+ const sktext::GlyphRunList&,
const SkPaint& initialPaint,
const SkPaint& drawingPaint);
@@ -576,7 +578,7 @@ protected:
#endif
void onDrawGlyphRunList(
- SkCanvas*, const SkGlyphRunList&, const SkPaint&, const SkPaint&) override {}
+ SkCanvas*, const sktext::GlyphRunList&, const SkPaint&, const SkPaint&) override {}
bool isNoPixelsDevice() const override { return true; }
diff --git a/chromium/third_party/skia/src/core/SkDraw.cpp b/chromium/third_party/skia/src/core/SkDraw.cpp
index 60d18e92bb8..30cbaf207ad 100644
--- a/chromium/third_party/skia/src/core/SkDraw.cpp
+++ b/chromium/third_party/skia/src/core/SkDraw.cpp
@@ -705,6 +705,39 @@ void SkDraw::drawRect(const SkRect& prePaintRect, const SkPaint& paint,
}
}
+#if defined(SK_SUPPORT_LEGACY_ALPHA_BITMAP_AS_COVERAGE)
+void SkDraw::drawDevMask(const SkMask& srcM, const SkPaint& paint) const {
+ if (srcM.fBounds.isEmpty()) {
+ return;
+ }
+
+ const SkMask* mask = &srcM;
+
+ SkMask dstM;
+ if (paint.getMaskFilter() &&
+ as_MFB(paint.getMaskFilter())
+ ->filterMask(&dstM, srcM, fMatrixProvider->localToDevice(), nullptr)) {
+ mask = &dstM;
+ }
+ SkAutoMaskFreeImage ami(dstM.fImage);
+
+ SkAutoBlitterChoose blitterChooser(*this, nullptr, paint);
+ SkBlitter* blitter = blitterChooser.get();
+
+ SkAAClipBlitterWrapper wrapper;
+ const SkRegion* clipRgn;
+
+ if (fRC->isBW()) {
+ clipRgn = &fRC->bwRgn();
+ } else {
+ wrapper.init(*fRC, blitter);
+ clipRgn = &wrapper.getRgn();
+ blitter = wrapper.getBlitter();
+ }
+ blitter->blitMaskRegion(*mask, *clipRgn);
+}
+#endif
+
static SkScalar fast_len(const SkVector& vec) {
SkScalar x = SkScalarAbs(vec.fX);
SkScalar y = SkScalarAbs(vec.fY);
@@ -925,6 +958,94 @@ void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint,
this->drawDevPath(*devPathPtr, *paint, drawCoverage, customBlitter, doFill);
}
+#if defined(SK_SUPPORT_LEGACY_ALPHA_BITMAP_AS_COVERAGE)
+void SkDraw::drawBitmapAsMask(const SkBitmap& bitmap, const SkSamplingOptions& sampling,
+ const SkPaint& paint) const {
+ SkASSERT(bitmap.colorType() == kAlpha_8_SkColorType);
+
+ // nothing to draw
+ if (fRC->isEmpty()) {
+ return;
+ }
+
+ SkMatrix ctm = fMatrixProvider->localToDevice();
+ if (SkTreatAsSprite(ctm, bitmap.dimensions(), sampling, paint))
+ {
+ int ix = SkScalarRoundToInt(ctm.getTranslateX());
+ int iy = SkScalarRoundToInt(ctm.getTranslateY());
+
+ SkPixmap pmap;
+ if (!bitmap.peekPixels(&pmap)) {
+ return;
+ }
+ SkMask mask;
+ mask.fBounds.setXYWH(ix, iy, pmap.width(), pmap.height());
+ mask.fFormat = SkMask::kA8_Format;
+ mask.fRowBytes = SkToU32(pmap.rowBytes());
+ // fImage is typed as writable, but in this case it is used read-only
+ mask.fImage = (uint8_t*)pmap.addr8(0, 0);
+
+ this->drawDevMask(mask, paint);
+ } else { // need to xform the bitmap first
+ SkRect r;
+ SkMask mask;
+
+ r.setIWH(bitmap.width(), bitmap.height());
+ ctm.mapRect(&r);
+ r.round(&mask.fBounds);
+
+ // set the mask's bounds to the transformed bitmap-bounds,
+ // clipped to the actual device and further limited by the clip bounds
+ {
+ SkASSERT(fDst.bounds().contains(fRC->getBounds()));
+ SkIRect devBounds = fDst.bounds();
+ devBounds.intersect(fRC->getBounds().makeOutset(1, 1));
+ // need intersect(l, t, r, b) on irect
+ if (!mask.fBounds.intersect(devBounds)) {
+ return;
+ }
+ }
+
+ mask.fFormat = SkMask::kA8_Format;
+ mask.fRowBytes = SkAlign4(mask.fBounds.width());
+ size_t size = mask.computeImageSize();
+ if (0 == size) {
+ // the mask is too big to allocated, draw nothing
+ return;
+ }
+
+ // allocate (and clear) our temp buffer to hold the transformed bitmap
+ SkAutoTMalloc<uint8_t> storage(size);
+ mask.fImage = storage.get();
+ memset(mask.fImage, 0, size);
+
+ // now draw our bitmap(src) into mask(dst), transformed by the matrix
+ {
+ SkBitmap device;
+ device.installPixels(SkImageInfo::MakeA8(mask.fBounds.width(), mask.fBounds.height()),
+ mask.fImage, mask.fRowBytes);
+
+ SkCanvas c(device);
+ // need the unclipped top/left for the translate
+ c.translate(-SkIntToScalar(mask.fBounds.fLeft),
+ -SkIntToScalar(mask.fBounds.fTop));
+ c.concat(ctm);
+
+ // We can't call drawBitmap, or we'll infinitely recurse. Instead
+ // we manually build a shader and draw that into our new mask
+ SkPaint tmpPaint;
+ tmpPaint.setAntiAlias(paint.isAntiAlias());
+ tmpPaint.setDither(paint.isDither());
+ SkPaint paintWithShader = make_paint_with_image(tmpPaint, bitmap, sampling);
+ SkRect rr;
+ rr.setIWH(bitmap.width(), bitmap.height());
+ c.drawRect(rr, paintWithShader);
+ }
+ this->drawDevMask(mask, paint);
+ }
+}
+#endif
+
static bool clipped_out(const SkMatrix& m, const SkRasterClip& c,
const SkRect& srcR) {
SkRect dstR;
@@ -998,6 +1119,16 @@ void SkDraw::drawBitmap(const SkBitmap& bitmap, const SkMatrix& prematrix,
SkDraw draw(*this);
draw.fMatrixProvider = &matrixProvider;
+ // For a long time, the CPU backend treated A8 bitmaps as coverage, rather than alpha. This was
+ // inconsistent with the GPU backend (skbug.com/9692). When this was fixed, it altered behavior
+ // for some Android apps (b/231400686). Thus: keep the old behavior in the framework.
+#if defined(SK_SUPPORT_LEGACY_ALPHA_BITMAP_AS_COVERAGE)
+ if (bitmap.colorType() == kAlpha_8_SkColorType && !paint->getColorFilter()) {
+ draw.drawBitmapAsMask(bitmap, sampling, *paint);
+ return;
+ }
+#endif
+
SkPaint paintWithShader = make_paint_with_image(*paint, bitmap, sampling);
const SkRect srcBounds = SkRect::MakeIWH(bitmap.width(), bitmap.height());
if (dstBounds) {
diff --git a/chromium/third_party/skia/src/core/SkDraw.h b/chromium/third_party/skia/src/core/SkDraw.h
index 3b880ce26d1..1ee8479e520 100644
--- a/chromium/third_party/skia/src/core/SkDraw.h
+++ b/chromium/third_party/skia/src/core/SkDraw.h
@@ -24,6 +24,7 @@ class SkBlitter;
class SkMatrix;
class SkMatrixProvider;
class SkPath;
+class SkSurfaceProps;
class SkRegion;
class SkRasterClip;
struct SkRect;
@@ -63,7 +64,7 @@ public:
void drawSprite(const SkBitmap&, int x, int y, const SkPaint&) const;
void drawGlyphRunList(SkCanvas* canvas,
SkGlyphRunListPainterCPU* glyphPainter,
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
const SkPaint& paint) const;
/* If skipColorXform, skips color conversion when assigning per-vertex colors */
void drawVertices(const SkVertices*,
@@ -102,6 +103,10 @@ public:
SkMask* mask, SkMask::CreateMode mode,
SkStrokeRec::InitStyle style);
+#if defined(SK_SUPPORT_LEGACY_ALPHA_BITMAP_AS_COVERAGE)
+ void drawDevMask(const SkMask& mask, const SkPaint&) const;
+#endif
+
enum RectType {
kHair_RectType,
kFill_RectType,
@@ -121,6 +126,9 @@ public:
SkPoint* strokeSize);
private:
+#if defined(SK_SUPPORT_LEGACY_ALPHA_BITMAP_AS_COVERAGE)
+ void drawBitmapAsMask(const SkBitmap&, const SkSamplingOptions&, const SkPaint&) const;
+#endif
void drawFixedVertices(const SkVertices* vertices,
sk_sp<SkBlender> blender,
const SkPaint& paint,
@@ -158,6 +166,7 @@ public:
SkPixmap fDst;
const SkMatrixProvider* fMatrixProvider{nullptr}; // required
const SkRasterClip* fRC{nullptr}; // required
+ const SkSurfaceProps* fProps{nullptr}; // optional
#ifdef SK_DEBUG
void validate() const;
diff --git a/chromium/third_party/skia/src/core/SkDraw_atlas.cpp b/chromium/third_party/skia/src/core/SkDraw_atlas.cpp
index 4368f66ed6f..c4431dd8c2c 100644
--- a/chromium/third_party/skia/src/core/SkDraw_atlas.cpp
+++ b/chromium/third_party/skia/src/core/SkDraw_atlas.cpp
@@ -9,6 +9,7 @@
#include "include/core/SkMatrix.h"
#include "include/core/SkRSXform.h"
#include "src/core/SkBlendModePriv.h"
+#include "src/core/SkBlenderBase.h"
#include "src/core/SkColorSpacePriv.h"
#include "src/core/SkColorSpaceXformSteps.h"
#include "src/core/SkCoreBlitters.h"
@@ -17,10 +18,8 @@
#include "src/core/SkRasterClip.h"
#include "src/core/SkRasterPipeline.h"
#include "src/core/SkScan.h"
-#include "src/core/SkScan.h"
#include "src/core/SkVM.h"
#include "src/core/SkVMBlitter.h"
-#include "src/shaders/SkComposeShader.h"
#include "src/shaders/SkShaderBase.h"
static void fill_rect(const SkMatrix& ctm, const SkRasterClip& rc,
@@ -107,13 +106,15 @@ void SkDraw::drawAtlas(const SkRSXform xform[],
auto rpblit = [&]() {
SkRasterPipeline pipeline(&alloc);
+ SkSurfaceProps props = SkSurfacePropsCopyOrDefault(fProps);
SkStageRec rec = {&pipeline,
&alloc,
fDst.colorType(),
fDst.colorSpace(),
p,
nullptr,
- *fMatrixProvider};
+ *fMatrixProvider,
+ props};
SkStageUpdater* updator = as_SB(atlasShader.get())->appendUpdatableStages(rec);
if (!updator) {
@@ -184,17 +185,18 @@ void SkDraw::drawAtlas(const SkRSXform xform[],
};
if (gUseSkVMBlitter || !rpblit()) {
- auto updateShader = as_SB(atlasShader)->updatableShader(&alloc);
+ SkUpdatableShader* updateShader = as_SB(atlasShader)->updatableShader(&alloc);
UpdatableColorShader* colorShader = nullptr;
- SkShaderBase* shader = nullptr;
+ sk_sp<SkShader> shader;
if (colors) {
colorShader = alloc.make<UpdatableColorShader>(fDst.colorSpace());
- shader = alloc.make<SkShader_Blend>(
- std::move(blender), sk_ref_sp(colorShader), sk_ref_sp(updateShader));
+ shader = SkShaders::Blend(std::move(blender),
+ sk_ref_sp(colorShader),
+ sk_ref_sp(updateShader));
} else {
- shader = as_SB(updateShader);
+ shader = sk_ref_sp(updateShader);
}
- p.setShader(sk_ref_sp(shader));
+ p.setShader(std::move(shader));
if (auto blitter = SkVMBlitter::Make(fDst, p, *fMatrixProvider, &alloc,
fRC->clipShader())) {
SkPath scratchPath;
diff --git a/chromium/third_party/skia/src/core/SkDraw_text.cpp b/chromium/third_party/skia/src/core/SkDraw_text.cpp
index 519e53d6539..c7eb02c44da 100644
--- a/chromium/third_party/skia/src/core/SkDraw_text.cpp
+++ b/chromium/third_party/skia/src/core/SkDraw_text.cpp
@@ -8,13 +8,13 @@
#include "include/core/SkBitmap.h"
#include "src/core/SkDraw.h"
#include "src/core/SkFontPriv.h"
-#include "src/core/SkGlyphRun.h"
#include "src/core/SkMatrixProvider.h"
#include "src/core/SkPaintPriv.h"
#include "src/core/SkRasterClip.h"
#include "src/core/SkScalerCache.h"
#include "src/core/SkScalerContext.h"
#include "src/core/SkUtils.h"
+#include "src/text/GlyphRun.h"
#include <climits>
// disable warning : local variable used without having been initialized
@@ -40,8 +40,8 @@ void SkDraw::paintMasks(SkDrawableGlyphBuffer* accepted, const SkPaint& paint) c
// The size used for a typical blitter.
SkSTArenaAlloc<3308> alloc;
- SkBlitter* blitter =
- SkBlitter::Choose(fDst, *fMatrixProvider, paint, &alloc, false, fRC->clipShader());
+ SkBlitter* blitter = SkBlitter::Choose(fDst, *fMatrixProvider, paint, &alloc, false,
+ fRC->clipShader(), SkSurfacePropsCopyOrDefault(fProps));
SkAAClipBlitterWrapper wrapper{*fRC, blitter};
blitter = wrapper.getBlitter();
@@ -108,7 +108,7 @@ void SkDraw::paintMasks(SkDrawableGlyphBuffer* accepted, const SkPaint& paint) c
void SkDraw::drawGlyphRunList(SkCanvas* canvas,
SkGlyphRunListPainterCPU* glyphPainter,
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
const SkPaint& paint) const {
SkDEBUGCODE(this->validate();)
diff --git a/chromium/third_party/skia/src/core/SkDraw_vertices.cpp b/chromium/third_party/skia/src/core/SkDraw_vertices.cpp
index c52ccb07e8f..5a37fc41654 100644
--- a/chromium/third_party/skia/src/core/SkDraw_vertices.cpp
+++ b/chromium/third_party/skia/src/core/SkDraw_vertices.cpp
@@ -10,6 +10,7 @@
#include "include/private/SkVx.h"
#include "src/core/SkArenaAlloc.h"
#include "src/core/SkAutoBlitterChoose.h"
+#include "src/core/SkBlenderBase.h"
#include "src/core/SkConvertPixels.h"
#include "src/core/SkCoreBlitters.h"
#include "src/core/SkDraw.h"
@@ -21,8 +22,6 @@
#include "src/core/SkVMBlitter.h"
#include "src/core/SkVertState.h"
#include "src/core/SkVerticesPriv.h"
-#include "src/shaders/SkColorShader.h"
-#include "src/shaders/SkComposeShader.h"
#include "src/shaders/SkShaderBase.h"
struct Matrix43 {
@@ -83,11 +82,6 @@ public:
int index0, int index1, int index2);
protected:
-#ifdef SK_ENABLE_LEGACY_SHADERCONTEXT
- Context* onMakeContext(const ContextRec& rec, SkArenaAlloc* alloc) const override {
- return nullptr;
- }
-#endif
bool onAppendStages(const SkStageRec& rec) const override {
rec.fPipeline->append(SkRasterPipeline::seed_shader);
if (fUsePersp) {
@@ -284,7 +278,7 @@ static void fill_triangle_3(const VertState& state, SkBlitter* blitter, const Sk
const int count = SkTo<int>(outP - outPoints);
SkASSERT(count == 0 || count == 3 || count == 4);
for (int i = 0; i < count; ++i) {
- float scale = 1.0f / outPoints[i].fZ;
+ float scale = sk_ieee_float_divide(1.0f, outPoints[i].fZ);
dst[i].set(outPoints[i].fX * scale, outPoints[i].fY * scale);
}
return count;
@@ -375,33 +369,39 @@ void SkDraw::drawFixedVertices(const SkVertices* vertices,
}
// Combines per-vertex colors with 'shader' using 'blender'.
- auto applyShaderColorBlend = [&](SkShader* shader) -> SkShader* {
+ auto applyShaderColorBlend = [&](SkShader* shader) -> sk_sp<SkShader> {
if (!colors) {
- return shader;
+ return sk_ref_sp(shader);
}
if (blenderIsDst) {
- return triColorShader;
+ return sk_ref_sp(triColorShader);
}
+ sk_sp<SkShader> shaderWithWhichToBlend;
if (!shader) {
// When there is no shader then the blender applies to the vertex colors and opaque
// paint color.
- shader = outerAlloc->make<SkColor4Shader>(paint.getColor4f().makeOpaque(), nullptr);
+ shaderWithWhichToBlend = SkShaders::Color(paint.getColor4f().makeOpaque(), nullptr);
+ } else {
+ shaderWithWhichToBlend = sk_ref_sp(shader);
}
- return outerAlloc->make<SkShader_Blend>(
- blender, sk_ref_sp(triColorShader), sk_ref_sp(shader));
+ return SkShaders::Blend(blender,
+ sk_ref_sp(triColorShader),
+ std::move(shaderWithWhichToBlend));
};
auto rpblit = [&]() {
VertState state(vertexCount, indices, indexCount);
VertState::Proc vertProc = state.chooseProc(info.mode());
- SkShader* shader = applyShaderColorBlend(paintShader);
+ sk_sp<SkShader> blendShader = applyShaderColorBlend(paintShader);
+ SkSurfaceProps props = SkSurfacePropsCopyOrDefault(fProps);
SkPaint shaderPaint(paint);
- shaderPaint.setShader(sk_ref_sp(shader));
+ shaderPaint.setShader(blendShader);
if (!texCoords) { // only tricolor shader
- auto blitter = SkCreateRasterPipelineBlitter(
- fDst, shaderPaint, *fMatrixProvider, outerAlloc, this->fRC->clipShader());
+ auto blitter = SkCreateRasterPipelineBlitter(fDst, shaderPaint, *fMatrixProvider,
+ outerAlloc, this->fRC->clipShader(),
+ props);
if (!blitter) {
return false;
}
@@ -422,9 +422,10 @@ void SkDraw::drawFixedVertices(const SkVertices* vertices,
fDst.colorSpace(),
shaderPaint,
nullptr,
- *fMatrixProvider};
- if (auto updater = as_SB(shader)->appendUpdatableStages(rec)) {
- bool isOpaque = shader->isOpaque();
+ *fMatrixProvider,
+ props};
+ if (auto updater = as_SB(blendShader)->appendUpdatableStages(rec)) {
+ bool isOpaque = blendShader->isOpaque();
if (triColorShader) {
isOpaque = false; // unless we want to walk all the colors, and see if they are
// all opaque (and the blend mode will keep them that way
@@ -476,8 +477,9 @@ void SkDraw::drawFixedVertices(const SkVertices* vertices,
}
// It'd be nice if we could detect this will fail earlier.
- auto blitter = SkCreateRasterPipelineBlitter(
- fDst, shaderPaint, *matrixProvider, &innerAlloc, this->fRC->clipShader());
+ auto blitter = SkCreateRasterPipelineBlitter(fDst, shaderPaint, *matrixProvider,
+ &innerAlloc, this->fRC->clipShader(),
+ props);
if (!blitter) {
return false;
}
@@ -499,10 +501,10 @@ void SkDraw::drawFixedVertices(const SkVertices* vertices,
texCoordShader = as_SB(shader)->updatableShader(outerAlloc);
shader = texCoordShader;
}
- shader = applyShaderColorBlend(shader);
+ sk_sp<SkShader> blenderShader = applyShaderColorBlend(shader);
SkPaint shaderPaint{paint};
- shaderPaint.setShader(sk_ref_sp(shader));
+ shaderPaint.setShader(std::move(blenderShader));
auto blitter = SkVMBlitter::Make(
fDst, shaderPaint, *fMatrixProvider, outerAlloc, this->fRC->clipShader());
if (!blitter) {
@@ -545,8 +547,7 @@ void SkDraw::drawVertices(const SkVertices* vertices,
constexpr size_t kDefVertexCount = 16;
constexpr size_t kOuterSize = sizeof(SkTriColorShader) +
- sizeof(SkShader_Blend) +
- (2 * sizeof(SkPoint) + sizeof(SkColor4f)) * kDefVertexCount;
+ (2 * sizeof(SkPoint) + sizeof(SkColor4f)) * kDefVertexCount;
SkSTArenaAlloc<kOuterSize> outerAlloc;
SkPoint* dev2 = nullptr;
diff --git a/chromium/third_party/skia/src/core/SkEdge.cpp b/chromium/third_party/skia/src/core/SkEdge.cpp
index 7ec629bdf39..8d47a42153e 100644
--- a/chromium/third_party/skia/src/core/SkEdge.cpp
+++ b/chromium/third_party/skia/src/core/SkEdge.cpp
@@ -33,8 +33,26 @@ static inline SkFixed SkFDot6ToFixedDiv2(SkFDot6 value) {
/////////////////////////////////////////////////////////////////////////
-int SkEdge::setLine(const SkPoint& p0, const SkPoint& p1, const SkIRect* clip,
- int shift) {
+#ifdef SK_DEBUG
+void SkEdge::dump() const {
+ int realLastY = SkScalarToFixed(fLastY);
+ if (fCurveCount > 0) {
+ realLastY = static_cast<const SkQuadraticEdge*>(this)->fQLastY;
+ } else if (fCurveCount < 0) {
+ realLastY = static_cast<const SkCubicEdge*>(this)->fCLastY;
+ }
+ SkDebugf("edge (%c): firstY:%d lastY:%d (%g) x:%g dx:%g w:%d\n",
+ fCurveCount > 0 ? 'Q' : (fCurveCount < 0 ? 'C' : 'L'),
+ fFirstY,
+ fLastY,
+ SkFixedToFloat(realLastY),
+ SkFixedToFloat(fX),
+ SkFixedToFloat(fDX),
+ fWinding);
+}
+#endif
+
+int SkEdge::setLine(const SkPoint& p0, const SkPoint& p1, const SkIRect* clip, int shift) {
SkFDot6 x0, y0, x1, y1;
{
@@ -80,6 +98,7 @@ int SkEdge::setLine(const SkPoint& p0, const SkPoint& p1, const SkIRect* clip,
fDX = slope;
fFirstY = top;
fLastY = bot - 1;
+ fEdgeType = kLine_Type;
fCurveCount = 0;
fWinding = SkToS8(winding);
fCurveShift = 0;
@@ -236,6 +255,7 @@ bool SkQuadraticEdge::setQuadraticWithoutUpdate(const SkPoint pts[3], int shift)
fWinding = SkToS8(winding);
//fCubicDShift only set for cubics
+ fEdgeType = kQuad_Type;
fCurveCount = SkToS8(1 << shift);
/*
@@ -420,6 +440,7 @@ bool SkCubicEdge::setCubicWithoutUpdate(const SkPoint pts[4], int shift, bool so
}
fWinding = SkToS8(winding);
+ fEdgeType = kCubic_Type;
fCurveCount = SkToS8(SkLeftShift(-1, shift));
fCurveShift = SkToU8(shift);
fCubicDShift = SkToU8(downShift);
diff --git a/chromium/third_party/skia/src/core/SkEdge.h b/chromium/third_party/skia/src/core/SkEdge.h
index c0c26ca0c7e..91c6b75ed7e 100644
--- a/chromium/third_party/skia/src/core/SkEdge.h
+++ b/chromium/third_party/skia/src/core/SkEdge.h
@@ -32,7 +32,8 @@ struct SkEdge {
SkFixed fDX;
int32_t fFirstY;
int32_t fLastY;
- int8_t fCurveCount; // only used by kQuad(+) and kCubic(-)
+ Type fEdgeType; // Remembers the *initial* edge type
+ int8_t fCurveCount; // only used by kQuad(+) and kCubic(-)
uint8_t fCurveShift; // appled to all Dx/DDx/DDDx except for fCubicDShift exception
uint8_t fCubicDShift; // applied to fCDx and fCDy only in cubic
int8_t fWinding; // 1 or -1
@@ -49,10 +50,7 @@ struct SkEdge {
}
#ifdef SK_DEBUG
- void dump() const {
- SkDebugf("edge: firstY:%d lastY:%d x:%g dx:%g w:%d\n", fFirstY, fLastY, SkFixedToFloat(fX), SkFixedToFloat(fDX), fWinding);
- }
-
+ void dump() const;
void validate() const {
SkASSERT(fPrev && fNext);
SkASSERT(fPrev->fNext == this);
@@ -129,6 +127,7 @@ int SkEdge::setLine(const SkPoint& p0, const SkPoint& p1, int shift) {
fDX = slope;
fFirstY = top;
fLastY = bot - 1;
+ fEdgeType = kLine_Type;
fCurveCount = 0;
fWinding = SkToS8(winding);
fCurveShift = 0;
diff --git a/chromium/third_party/skia/src/core/SkEdgeBuilder.cpp b/chromium/third_party/skia/src/core/SkEdgeBuilder.cpp
index b11e4bd13d2..32444b321b1 100644
--- a/chromium/third_party/skia/src/core/SkEdgeBuilder.cpp
+++ b/chromium/third_party/skia/src/core/SkEdgeBuilder.cpp
@@ -17,7 +17,9 @@
#include "src/core/SkSafeMath.h"
SkEdgeBuilder::Combine SkBasicEdgeBuilder::combineVertical(const SkEdge* edge, SkEdge* last) {
- if (last->fCurveCount || last->fDX || edge->fX != last->fX) {
+ // We only consider edges that were originally lines to be vertical to avoid numerical issues
+ // (crbug.com/1154864).
+ if (last->fEdgeType != SkEdge::kLine_Type || last->fDX || edge->fX != last->fX) {
return kNo_Combine;
}
if (edge->fWinding == last->fWinding) {
@@ -63,7 +65,9 @@ SkEdgeBuilder::Combine SkAnalyticEdgeBuilder::combineVertical(const SkAnalyticEd
return SkAbs32(a - b) < 0x100;
};
- if (last->fCurveCount || last->fDX || edge->fX != last->fX) {
+ // We only consider edges that were originally lines to be vertical to avoid numerical issues
+ // (crbug.com/1154864).
+ if (last->fEdgeType != SkAnalyticEdge::kLine_Type || last->fDX || edge->fX != last->fX) {
return kNo_Combine;
}
if (edge->fWinding == last->fWinding) {
@@ -109,8 +113,10 @@ SkEdgeBuilder::Combine SkAnalyticEdgeBuilder::combineVertical(const SkAnalyticEd
template <typename Edge>
static bool is_vertical(const Edge* edge) {
- return edge->fDX == 0
- && edge->fCurveCount == 0;
+ // We only consider edges that were originally lines to be vertical to avoid numerical issues
+ // (crbug.com/1154864).
+ return edge->fDX == 0
+ && edge->fEdgeType == Edge::kLine_Type;
}
// TODO: we can deallocate the edge if edge->setFoo() fails
diff --git a/chromium/third_party/skia/src/core/SkEffectPriv.h b/chromium/third_party/skia/src/core/SkEffectPriv.h
index edf66e24da9..c5ee85b726e 100644
--- a/chromium/third_party/skia/src/core/SkEffectPriv.h
+++ b/chromium/third_party/skia/src/core/SkEffectPriv.h
@@ -16,6 +16,7 @@ class SkColorSpace;
class SkMatrixProvider;
class SkPaint;
class SkRasterPipeline;
+class SkSurfaceProps;
// Passed to effects that will add stages to rasterpipeline
struct SkStageRec {
@@ -26,6 +27,7 @@ struct SkStageRec {
const SkPaint& fPaint;
const SkMatrix* fLocalM; // may be nullptr
const SkMatrixProvider& fMatrixProvider;
+ const SkSurfaceProps& fSurfaceProps;
};
#endif // SkEffectPriv_DEFINED
diff --git a/chromium/third_party/skia/src/core/SkEnumBitMask.h b/chromium/third_party/skia/src/core/SkEnumBitMask.h
index 3fe3bd5c8e5..a04f6cd0b8d 100644
--- a/chromium/third_party/skia/src/core/SkEnumBitMask.h
+++ b/chromium/third_party/skia/src/core/SkEnumBitMask.h
@@ -65,16 +65,16 @@ private:
* Defines functions that make it possible to use bitwise operators on an enum.
*/
#define SK_MAKE_BITMASK_OPS(E) \
- SK_MAYBE_UNUSED constexpr SkEnumBitMask<E> operator|(E a, E b) { \
+ [[maybe_unused]] constexpr SkEnumBitMask<E> operator|(E a, E b) { \
return SkEnumBitMask<E>(a) | b; \
} \
- SK_MAYBE_UNUSED constexpr SkEnumBitMask<E> operator&(E a, E b) { \
+ [[maybe_unused]] constexpr SkEnumBitMask<E> operator&(E a, E b) { \
return SkEnumBitMask<E>(a) & b; \
} \
- SK_MAYBE_UNUSED constexpr SkEnumBitMask<E> operator^(E a, E b) { \
+ [[maybe_unused]] constexpr SkEnumBitMask<E> operator^(E a, E b) { \
return SkEnumBitMask<E>(a) ^ b; \
} \
- SK_MAYBE_UNUSED constexpr SkEnumBitMask<E> operator~(E e) { \
+ [[maybe_unused]] constexpr SkEnumBitMask<E> operator~(E e) { \
return ~SkEnumBitMask<E>(e); \
} \
diff --git a/chromium/third_party/skia/src/core/SkFactoryFunctions.cpp b/chromium/third_party/skia/src/core/SkFactoryFunctions.cpp
new file mode 100644
index 00000000000..fac21c9b6b6
--- /dev/null
+++ b/chromium/third_party/skia/src/core/SkFactoryFunctions.cpp
@@ -0,0 +1,232 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "include/core/SkTypes.h"
+
+#ifdef SK_ENABLE_PRECOMPILE
+
+#include "src/core/SkFactoryFunctions.h"
+
+#include "src/core/SkPrecompile.h"
+
+// TODO: wrap this in an SK_PRECOMPILE check
+
+//--------------------------------------------------------------------------------------------------
+class SkPrecompileBlendModeBlender : public SkPrecompileBlender {
+public:
+ SkPrecompileBlendModeBlender(SkBlendMode blendMode) : fBlendMode(blendMode) {}
+
+ std::optional<SkBlendMode> asBlendMode() const final { return fBlendMode; }
+
+private:
+ SkBlendMode fBlendMode;
+};
+
+sk_sp<SkPrecompileBlender> SkPrecompileBlender::Mode(SkBlendMode blendMode) {
+ return sk_make_sp<SkPrecompileBlendModeBlender>(blendMode);
+}
+
+//--------------------------------------------------------------------------------------------------
+class SkBlendPrecompileShader : public SkPrecompileShader {
+public:
+ SkBlendPrecompileShader(SkSpan<const sk_sp<SkPrecompileBlender>> blenders,
+ SkSpan<const sk_sp<SkPrecompileShader>> dsts,
+ SkSpan<const sk_sp<SkPrecompileShader>> srcs)
+ : fBlenders(blenders.begin(), blenders.end())
+ , fDsts(dsts.begin(), dsts.end())
+ , fSrcs(srcs.begin(), srcs.end()) {
+ }
+
+private:
+ std::vector<sk_sp<SkPrecompileBlender>> fBlenders;
+ std::vector<sk_sp<SkPrecompileShader>> fDsts;
+ std::vector<sk_sp<SkPrecompileShader>> fSrcs;
+};
+
+//--------------------------------------------------------------------------------------------------
+sk_sp<SkPrecompileShader> SkPrecompileShaders::Color() {
+ return sk_make_sp<SkPrecompileShader>();
+}
+
+sk_sp<SkPrecompileShader> SkPrecompileShaders::Blend(
+ SkSpan<const sk_sp<SkPrecompileBlender>> blenders,
+ SkSpan<const sk_sp<SkPrecompileShader>> dsts,
+ SkSpan<const sk_sp<SkPrecompileShader>> srcs) {
+ return sk_make_sp<SkBlendPrecompileShader>(std::move(blenders),
+ std::move(dsts), std::move(srcs));
+}
+
+sk_sp<SkPrecompileShader> SkPrecompileShaders::Blend(
+ SkSpan<SkBlendMode> blendModes,
+ SkSpan<const sk_sp<SkPrecompileShader>> dsts,
+ SkSpan<const sk_sp<SkPrecompileShader>> srcs) {
+ std::vector<sk_sp<SkPrecompileBlender>> tmp;
+ tmp.reserve(blendModes.size());
+ for (SkBlendMode bm : blendModes) {
+ tmp.emplace_back(SkPrecompileBlender::Mode(bm));
+ }
+
+ return sk_make_sp<SkBlendPrecompileShader>(tmp, std::move(dsts), std::move(srcs));
+}
+
+sk_sp<SkPrecompileShader> SkPrecompileShaders::Image() {
+ return sk_make_sp<SkPrecompileShader>();
+}
+
+sk_sp<SkPrecompileShader> SkPrecompileShaders::LinearGradient() {
+ return sk_make_sp<SkPrecompileShader>();
+}
+
+sk_sp<SkPrecompileShader> SkPrecompileShaders::RadialGradient() {
+ return sk_make_sp<SkPrecompileShader>();
+}
+
+sk_sp<SkPrecompileShader> SkPrecompileShaders::TwoPointConicalGradient() {
+ return sk_make_sp<SkPrecompileShader>();
+}
+
+sk_sp<SkPrecompileShader> SkPrecompileShaders::SweepGradient() {
+ return sk_make_sp<SkPrecompileShader>();
+}
+
+//--------------------------------------------------------------------------------------------------
+sk_sp<SkPrecompileMaskFilter> SkPrecompileMaskFilters::Blur() {
+ return sk_make_sp<SkPrecompileMaskFilter>();
+}
+
+//--------------------------------------------------------------------------------------------------
+sk_sp<SkPrecompileColorFilter> SkPrecompileColorFilters::Matrix() {
+ return sk_make_sp<SkPrecompileColorFilter>();
+}
+
+//--------------------------------------------------------------------------------------------------
+sk_sp<SkPrecompileImageFilter> SkPrecompileImageFilters::Blur() {
+ return sk_make_sp<SkPrecompileImageFilter>();
+}
+
+sk_sp<SkPrecompileImageFilter> SkPrecompileImageFilters::Image() {
+ return sk_make_sp<SkPrecompileImageFilter>();
+}
+
+//--------------------------------------------------------------------------------------------------
+SkPrecompileChildPtr::SkPrecompileChildPtr(sk_sp<SkPrecompileShader> s) : fChild(std::move(s)) {}
+SkPrecompileChildPtr::SkPrecompileChildPtr(sk_sp<SkPrecompileColorFilter> cf)
+ : fChild(std::move(cf)) {
+}
+SkPrecompileChildPtr::SkPrecompileChildPtr(sk_sp<SkPrecompileBlender> b) : fChild(std::move(b)) {}
+
+namespace {
+
+#ifdef SK_DEBUG
+
+bool precompilebase_is_valid_as_child(const SkPrecompileBase *child) {
+ if (!child) {
+ return true;
+ }
+
+ switch (child->type()) {
+ case SkPrecompileBase::Type::kShader:
+ case SkPrecompileBase::Type::kColorFilter:
+ case SkPrecompileBase::Type::kBlender:
+ return true;
+ default:
+ return false;
+ }
+}
+
+#endif // SK_DEBUG
+
+}
+
+SkPrecompileChildPtr::SkPrecompileChildPtr(sk_sp<SkPrecompileBase> child)
+ : fChild(std::move(child)) {
+ SkASSERT(precompilebase_is_valid_as_child(fChild.get()));
+}
+
+std::optional<SkRuntimeEffect::ChildType> SkPrecompileChildPtr::type() const {
+ if (fChild) {
+ switch (fChild->type()) {
+ case SkPrecompileBase::Type::kShader:
+ return SkRuntimeEffect::ChildType::kShader;
+ case SkPrecompileBase::Type::kColorFilter:
+ return SkRuntimeEffect::ChildType::kColorFilter;
+ case SkPrecompileBase::Type::kBlender:
+ return SkRuntimeEffect::ChildType::kBlender;
+ default:
+ break;
+ }
+ }
+ return std::nullopt;
+}
+
+SkPrecompileShader* SkPrecompileChildPtr::shader() const {
+ return (fChild && fChild->type() == SkPrecompileBase::Type::kShader)
+ ? static_cast<SkPrecompileShader*>(fChild.get())
+ : nullptr;
+}
+
+SkPrecompileColorFilter* SkPrecompileChildPtr::colorFilter() const {
+ return (fChild && fChild->type() == SkPrecompileBase::Type::kColorFilter)
+ ? static_cast<SkPrecompileColorFilter*>(fChild.get())
+ : nullptr;
+}
+
+SkPrecompileBlender* SkPrecompileChildPtr::blender() const {
+ return (fChild && fChild->type() == SkPrecompileBase::Type::kBlender)
+ ? static_cast<SkPrecompileBlender*>(fChild.get())
+ : nullptr;
+}
+
+//--------------------------------------------------------------------------------------------------
+template<typename T>
+class SkPrecompileRTEffect : public T {
+public:
+ SkPrecompileRTEffect(sk_sp<SkRuntimeEffect> effect,
+ SkSpan<const SkPrecompileChildOptions> childOptions)
+ : fEffect(std::move(effect)) {
+ fChildOptions.reserve(childOptions.size());
+ for (SkPrecompileChildOptions c : childOptions) {
+ fChildOptions.push_back({ c.begin(), c.end() });
+ }
+ }
+
+private:
+ sk_sp<SkRuntimeEffect> fEffect;
+ std::vector<std::vector<SkPrecompileChildPtr>> fChildOptions;
+};
+
+sk_sp<SkPrecompileShader> MakePrecompileShader(
+ sk_sp<SkRuntimeEffect> effect,
+ SkSpan<const SkPrecompileChildOptions> childOptions) {
+ // TODO: check that 'effect' has the kAllowShader_Flag bit set and:
+ // for each entry in childOptions:
+ // all the SkPrecompileChildPtrs have the same type as the corresponding child in the effect
+ return sk_make_sp<SkPrecompileRTEffect<SkPrecompileShader>>(std::move(effect), childOptions);
+}
+
+sk_sp<SkPrecompileColorFilter> MakePrecompileColorFilter(
+ sk_sp<SkRuntimeEffect> effect,
+ SkSpan<const SkPrecompileChildOptions> childOptions) {
+ // TODO: check that 'effect' has the kAllowColorFilter_Flag bit set and:
+ // for each entry in childOptions:
+ // all the SkPrecompileChildPtrs have the same type as the corresponding child in the effect
+ return sk_make_sp<SkPrecompileRTEffect<SkPrecompileColorFilter>>(std::move(effect),
+ childOptions);
+}
+
+sk_sp<SkPrecompileBlender> MakePrecompileBlender(
+ sk_sp<SkRuntimeEffect> effect,
+ SkSpan<const SkPrecompileChildOptions> childOptions) {
+ // TODO: check that 'effect' has the kAllowBlender_Flag bit set and:
+ // for each entry in childOptions:
+ // all the SkPrecompileChildPtrs have the same type as the corresponding child in the effect
+ return sk_make_sp<SkPrecompileRTEffect<SkPrecompileBlender>>(std::move(effect), childOptions);
+}
+
+//--------------------------------------------------------------------------------------------------
+
+#endif // SK_ENABLE_PRECOMPILE
diff --git a/chromium/third_party/skia/src/core/SkFactoryFunctions.h b/chromium/third_party/skia/src/core/SkFactoryFunctions.h
new file mode 100644
index 00000000000..aef097b43e1
--- /dev/null
+++ b/chromium/third_party/skia/src/core/SkFactoryFunctions.h
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkFactoryFunctions_DEFINED
+#define SkFactoryFunctions_DEFINED
+
+#include "include/core/SkTypes.h"
+
+#ifdef SK_ENABLE_PRECOMPILE
+
+#include "include/core/SkBlendMode.h"
+#include "include/core/SkRefCnt.h"
+#include "include/core/SkSpan.h"
+#include "include/effects/SkRuntimeEffect.h"
+
+class SkPrecompileBase;
+class SkPrecompileBlender;
+class SkPrecompileColorFilter;
+class SkPrecompileImageFilter;
+class SkPrecompileMaskFilter;
+class SkPrecompileShader;
+
+// All of these factory functions will be moved elsewhere once the pre-compile API becomes public
+
+//--------------------------------------------------------------------------------------------------
+// This will move to be beside SkShaders in include/core/SkShader.h
+class SkPrecompileShaders {
+public:
+ //TODO: Add Empty? - see skbug.com/12165
+ static sk_sp<SkPrecompileShader> Color();
+ static sk_sp<SkPrecompileShader> Blend(SkSpan<const sk_sp<SkPrecompileBlender>> blenders,
+ SkSpan<const sk_sp<SkPrecompileShader>> dsts,
+ SkSpan<const sk_sp<SkPrecompileShader>> srcs);
+ static sk_sp<SkPrecompileShader> Blend(SkSpan<SkBlendMode> blendModes,
+ SkSpan<const sk_sp<SkPrecompileShader>> dsts,
+ SkSpan<const sk_sp<SkPrecompileShader>> srcs);
+ // TODO: add an SkShaders::Image to match this and SkImageFilters (skbug.com/13440)
+ static sk_sp<SkPrecompileShader> Image();
+
+ // TODO: make SkGradientShader match this convention (skbug.com/13438)
+ static sk_sp<SkPrecompileShader> LinearGradient();
+ static sk_sp<SkPrecompileShader> RadialGradient();
+ static sk_sp<SkPrecompileShader> TwoPointConicalGradient();
+ static sk_sp<SkPrecompileShader> SweepGradient();
+
+private:
+ SkPrecompileShaders() = delete;
+};
+
+//--------------------------------------------------------------------------------------------------
+// Initially this will go next to SkMaskFilter in include/core/SkMaskFilter.h but the
+// SkMaskFilter::MakeBlur factory should be split out or removed. This namespace will follow
+// where ever that factory goes.
+class SkPrecompileMaskFilters {
+public:
+ // TODO: change SkMaskFilter::MakeBlur to match this and SkImageFilters::Blur (skbug.com/13441)
+ static sk_sp<SkPrecompileMaskFilter> Blur();
+
+private:
+ SkPrecompileMaskFilters() = delete;
+};
+
+//--------------------------------------------------------------------------------------------------
+// This will move to be beside SkColorFilters in include/core/SkColorFilter.h
+class SkPrecompileColorFilters {
+public:
+ static sk_sp<SkPrecompileColorFilter> Matrix();
+ // TODO: Compose, Blend, HSLAMatrix, LinearToSRGBGamma, SRGBToLinearGamma, Lerp
+
+private:
+ SkPrecompileColorFilters() = delete;
+};
+
+//--------------------------------------------------------------------------------------------------
+// This will move to be beside SkImageFilters in include/effects/SkImageFilters.h
+class SkPrecompileImageFilters {
+public:
+ static sk_sp<SkPrecompileImageFilter> Blur();
+ static sk_sp<SkPrecompileImageFilter> Image();
+ // TODO: AlphaThreshold, Arithmetic, Blend (2 kinds), ColorFilter, Compose, DisplacementMap,
+ // DropShadow, DropShadowOnly, Magnifier, MatrixConvolution, MatrixTransform, Merge, Offset,
+ // Picture, Runtime, Shader, Tile, Dilate, Erode, DistantLitDiffuse, PointLitDiffuse,
+ // SpotLitDiffuse, DistantLitSpecular, PointLitSpecular, SpotLitSpecular
+
+private:
+ SkPrecompileImageFilters() = delete;
+};
+
+//--------------------------------------------------------------------------------------------------
+// Object that allows passing a SkPrecompileShader, SkPrecompileColorFilter or
+// SkPrecompileBlender as a child
+//
+// This will moved to be on SkRuntimeEffect
+class SkPrecompileChildPtr {
+public:
+ SkPrecompileChildPtr() = default;
+ SkPrecompileChildPtr(sk_sp<SkPrecompileShader>);
+ SkPrecompileChildPtr(sk_sp<SkPrecompileColorFilter>);
+ SkPrecompileChildPtr(sk_sp<SkPrecompileBlender>);
+
+ // Asserts that the SkPrecompileBase is either null, or one of the legal derived types
+ SkPrecompileChildPtr(sk_sp<SkPrecompileBase>);
+
+ std::optional<SkRuntimeEffect::ChildType> type() const;
+
+ SkPrecompileShader* shader() const;
+ SkPrecompileColorFilter* colorFilter() const;
+ SkPrecompileBlender* blender() const;
+ SkPrecompileBase* base() const { return fChild.get(); }
+
+private:
+ sk_sp<SkPrecompileBase> fChild;
+};
+
+using SkPrecompileChildOptions = SkSpan<const SkPrecompileChildPtr>;
+
+// These will move to be on SkRuntimeEffect to parallel makeShader, makeColorFilter and
+// makeBlender
+sk_sp<SkPrecompileShader> MakePrecompileShader(
+ sk_sp<SkRuntimeEffect> effect,
+ SkSpan<const SkPrecompileChildOptions> childOptions = {});
+
+sk_sp<SkPrecompileColorFilter> MakePrecompileColorFilter(
+ sk_sp<SkRuntimeEffect> effect,
+ SkSpan<const SkPrecompileChildOptions> childOptions = {});
+
+sk_sp<SkPrecompileBlender> MakePrecompileBlender(
+ sk_sp<SkRuntimeEffect> effect,
+ SkSpan<const SkPrecompileChildOptions> childOptions = {});
+
+#endif // SK_ENABLE_PRECOMPILE
+
+#endif // SkFactoryFunctions_DEFINED
diff --git a/chromium/third_party/skia/src/core/SkFlattenable.cpp b/chromium/third_party/skia/src/core/SkFlattenable.cpp
index 9cff53af084..5f7cc7031a5 100644
--- a/chromium/third_party/skia/src/core/SkFlattenable.cpp
+++ b/chromium/third_party/skia/src/core/SkFlattenable.cpp
@@ -81,7 +81,7 @@ void SkFlattenable::Finalize() {
void SkFlattenable::Register(const char name[], Factory factory) {
SkASSERT(name);
SkASSERT(factory);
- SkASSERT(gCount < (int)SK_ARRAY_COUNT(gEntries));
+ SkASSERT(gCount < (int)std::size(gEntries));
gEntries[gCount].fName = name;
gEntries[gCount].fFactory = factory;
diff --git a/chromium/third_party/skia/src/core/SkFont.cpp b/chromium/third_party/skia/src/core/SkFont.cpp
index 53be4b646ae..929a466b647 100644
--- a/chromium/third_party/skia/src/core/SkFont.cpp
+++ b/chromium/third_party/skia/src/core/SkFont.cpp
@@ -171,7 +171,7 @@ SkScalar SkFont::measureText(const void* text, size_t length, SkTextEncoding enc
auto [strikeSpec, strikeToSourceScale] = SkStrikeSpec::MakeCanonicalized(*this, paint);
SkBulkGlyphMetrics metrics{strikeSpec};
- SkSpan<const SkGlyph*> glyphs = metrics.glyphs(SkMakeSpan(glyphIDs, glyphCount));
+ SkSpan<const SkGlyph*> glyphs = metrics.glyphs(SkSpan(glyphIDs, glyphCount));
SkScalar width = 0;
if (bounds) {
@@ -209,7 +209,7 @@ void SkFont::getWidthsBounds(const SkGlyphID glyphIDs[],
const SkPaint* paint) const {
auto [strikeSpec, strikeToSourceScale] = SkStrikeSpec::MakeCanonicalized(*this, paint);
SkBulkGlyphMetrics metrics{strikeSpec};
- SkSpan<const SkGlyph*> glyphs = metrics.glyphs(SkMakeSpan(glyphIDs, count));
+ SkSpan<const SkGlyph*> glyphs = metrics.glyphs(SkSpan(glyphIDs, count));
if (bounds) {
SkMatrix scaleMat = SkMatrix::Scale(strikeToSourceScale, strikeToSourceScale);
@@ -230,7 +230,7 @@ void SkFont::getWidthsBounds(const SkGlyphID glyphIDs[],
void SkFont::getPos(const SkGlyphID glyphIDs[], int count, SkPoint pos[], SkPoint origin) const {
auto [strikeSpec, strikeToSourceScale] = SkStrikeSpec::MakeCanonicalized(*this);
SkBulkGlyphMetrics metrics{strikeSpec};
- SkSpan<const SkGlyph*> glyphs = metrics.glyphs(SkMakeSpan(glyphIDs, count));
+ SkSpan<const SkGlyph*> glyphs = metrics.glyphs(SkSpan(glyphIDs, count));
SkPoint sum = origin;
for (auto glyph : glyphs) {
@@ -244,7 +244,7 @@ void SkFont::getXPos(
auto [strikeSpec, strikeToSourceScale] = SkStrikeSpec::MakeCanonicalized(*this);
SkBulkGlyphMetrics metrics{strikeSpec};
- SkSpan<const SkGlyph*> glyphs = metrics.glyphs(SkMakeSpan(glyphIDs, count));
+ SkSpan<const SkGlyph*> glyphs = metrics.glyphs(SkSpan(glyphIDs, count));
SkScalar loc = origin;
SkScalar* cursor = xpos;
@@ -262,7 +262,7 @@ void SkFont::getPaths(const SkGlyphID glyphIDs[], int count,
SkStrikeSpec strikeSpec = SkStrikeSpec::MakeWithNoDevice(font);
SkBulkGlyphMetricsAndPaths paths{strikeSpec};
- SkSpan<const SkGlyph*> glyphs = paths.glyphs(SkMakeSpan(glyphIDs, count));
+ SkSpan<const SkGlyph*> glyphs = paths.glyphs(SkSpan(glyphIDs, count));
for (auto glyph : glyphs) {
proc(glyph->path(), mx, ctx);
diff --git a/chromium/third_party/skia/src/core/SkGeometry.cpp b/chromium/third_party/skia/src/core/SkGeometry.cpp
index 8eccfdfea36..399b40503b7 100644
--- a/chromium/third_party/skia/src/core/SkGeometry.cpp
+++ b/chromium/third_party/skia/src/core/SkGeometry.cpp
@@ -727,7 +727,7 @@ int SkChopCubicAtXExtrema(const SkPoint src[4], SkPoint dst[10]) {
C = d - 3c + 3b - a
(BxCy - ByCx)t^2 + (AxCy - AyCx)t + AxBy - AyBx == 0
*/
-int SkFindCubicInflections(const SkPoint src[4], SkScalar tValues[]) {
+int SkFindCubicInflections(const SkPoint src[4], SkScalar tValues[2]) {
SkScalar Ax = src[1].fX - src[0].fX;
SkScalar Ay = src[1].fY - src[0].fY;
SkScalar Bx = src[2].fX - 2 * src[1].fX + src[0].fX;
@@ -741,7 +741,7 @@ int SkFindCubicInflections(const SkPoint src[4], SkScalar tValues[]) {
tValues);
}
-int SkChopCubicAtInflections(const SkPoint src[], SkPoint dst[10]) {
+int SkChopCubicAtInflections(const SkPoint src[4], SkPoint dst[10]) {
SkScalar tValues[2];
int count = SkFindCubicInflections(src, tValues);
@@ -898,7 +898,7 @@ static int collaps_duplicates(SkScalar array[], int count) {
#ifdef SK_DEBUG
-#define TEST_COLLAPS_ENTRY(array) array, SK_ARRAY_COUNT(array)
+#define TEST_COLLAPS_ENTRY(array) array, std::size(array)
static void test_collaps_duplicates() {
static bool gOnce;
@@ -924,7 +924,7 @@ static void test_collaps_duplicates() {
{ TEST_COLLAPS_ENTRY(src5), 2 },
{ TEST_COLLAPS_ENTRY(src6), 3 },
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(data); ++i) {
+ for (size_t i = 0; i < std::size(data); ++i) {
SkScalar dst[3];
memcpy(dst, data[i].fData, data[i].fCount * sizeof(dst[0]));
int count = collaps_duplicates(dst, data[i].fCount);
@@ -1619,7 +1619,7 @@ bool SkConic::findMaxCurvature(SkScalar* t) const {
}
#endif
-SkScalar SkConic::TransformW(const SkPoint pts[], SkScalar w, const SkMatrix& matrix) {
+SkScalar SkConic::TransformW(const SkPoint pts[3], SkScalar w, const SkMatrix& matrix) {
if (!matrix.hasPerspective()) {
return w;
}
diff --git a/chromium/third_party/skia/src/core/SkGeometry.h b/chromium/third_party/skia/src/core/SkGeometry.h
index a9309e3e1f9..2915f2047cc 100644
--- a/chromium/third_party/skia/src/core/SkGeometry.h
+++ b/chromium/third_party/skia/src/core/SkGeometry.h
@@ -75,7 +75,7 @@ inline float SkMeasureQuadRotation(const SkPoint pts[3]) {
/** Given a src quadratic bezier, returns the T value whose tangent angle is halfway between the
tangents at p0 and p3.
*/
-float SkFindQuadMidTangent(const SkPoint src[4]);
+float SkFindQuadMidTangent(const SkPoint src[3]);
/** Given a src quadratic bezier, chop it at the tangent whose angle is halfway between the
tangents at p0 and p2. The new quads are returned in dst[0..2] and dst[2..4].
diff --git a/chromium/third_party/skia/src/core/SkGlyph.cpp b/chromium/third_party/skia/src/core/SkGlyph.cpp
index e1a339fdf93..cb93f7ac6aa 100644
--- a/chromium/third_party/skia/src/core/SkGlyph.cpp
+++ b/chromium/third_party/skia/src/core/SkGlyph.cpp
@@ -401,14 +401,31 @@ void SkGlyph::ensureIntercepts(const SkScalar* bounds, SkScalar scale, SkScalar
SkGlyphDigest::SkGlyphDigest(size_t index, const SkGlyph& glyph)
: fIndex{SkTo<uint32_t>(index)}
, fIsEmpty(glyph.isEmpty())
- , fIsColor(glyph.isColor())
- , fCanDrawAsMask{SkStrikeForGPU::CanDrawAsMask(glyph)}
- , fCanDrawAsSDFT{SkStrikeForGPU::CanDrawAsSDFT(glyph)}
+ , fCanDrawAsMask{CanDrawAsMask(glyph)}
+ , fCanDrawAsSDFT{CanDrawAsSDFT(glyph)}
+ , fFormat(glyph.maskFormat())
, fLeft{SkTo<int16_t>(glyph.left())}
, fTop{SkTo<int16_t>(glyph.top())}
, fWidth{SkTo<uint16_t>(glyph.width())}
, fHeight{SkTo<uint16_t>(glyph.height())} {}
+bool SkGlyphDigest::CanDrawAsMask(const SkGlyph& glyph) {
+ return FitsInAtlas(glyph);
+}
+
+bool SkGlyphDigest::CanDrawAsSDFT(const SkGlyph& glyph) {
+ return FitsInAtlas(glyph) && glyph.maskFormat() == SkMask::kSDF_Format;
+}
+
+bool SkGlyphDigest::CanDrawAsPath(const SkGlyph& glyph) {
+ SkASSERT(glyph.setPathHasBeenCalled());
+ return glyph.path() != nullptr;
+}
+
+bool SkGlyphDigest::FitsInAtlas(const SkGlyph& glyph) {
+ return glyph.maxDimension() <= kSkSideTooBigForAtlas;
+}
+
// -- SkGlyphPositionRoundingSpec ------------------------------------------------------------------
SkVector SkGlyphPositionRoundingSpec::HalfAxisSampleFreq(
bool isSubpixel, SkAxisAlignment axisAlignment) {
diff --git a/chromium/third_party/skia/src/core/SkGlyph.h b/chromium/third_party/skia/src/core/SkGlyph.h
index d2180039e5b..04acb93373b 100644
--- a/chromium/third_party/skia/src/core/SkGlyph.h
+++ b/chromium/third_party/skia/src/core/SkGlyph.h
@@ -226,48 +226,49 @@ SkGlyphRect rect_union(SkGlyphRect, SkGlyphRect);
SkGlyphRect rect_intersection(SkGlyphRect, SkGlyphRect);
} // namespace skglyph
-// SkGlyphRect encodes rectangles with coordinates on [-32767, 32767]. It is specialized for
+// SkGlyphRect encodes rectangles with coordinates using SkScalar. It is specialized for
// rectangle union and intersection operations.
class SkGlyphRect {
public:
SkGlyphRect() = default;
- SkGlyphRect(int16_t left, int16_t top, int16_t right, int16_t bottom)
- : fRect{(int16_t)-left, (int16_t)-top, right, bottom} {
- SkDEBUGCODE(const int32_t min = std::numeric_limits<int16_t>::min());
- SkASSERT(left != min && top != min && right != min && bottom != min);
- }
+ SkGlyphRect(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom)
+ : fRect{-left, -top, right, bottom} { }
bool empty() const {
return -fRect[0] >= fRect[2] || -fRect[1] >= fRect[3];
}
SkRect rect() const {
return SkRect::MakeLTRB(-fRect[0], -fRect[1], fRect[2], fRect[3]);
}
- SkIRect iRect() const {
- return SkIRect::MakeLTRB(-fRect[0], -fRect[1], fRect[2], fRect[3]);
+ SkGlyphRect offset(SkScalar x, SkScalar y) const {
+ return SkGlyphRect{fRect + Storage{-x, -y, x, y}};
+ }
+ SkGlyphRect scaleAndOffset(SkScalar scale, SkPoint offset) const {
+ auto [x, y] = offset;
+ return fRect * scale + Storage{-x, -y, x, y};
}
- SkGlyphRect offset(int16_t x, int16_t y) const {
- return SkGlyphRect{fRect + Storage{SkTo<int16_t>(-x), SkTo<int16_t>(-y), x, y}};
+ SkGlyphRect inset(SkScalar dx, SkScalar dy) const {
+ return fRect - Storage{dx, dy, dx, dy};
}
- skvx::Vec<2, int16_t> leftTop() const { return -this->negLeftTop(); }
- skvx::Vec<2, int16_t> rightBottom() const { return {fRect[2], fRect[3]}; }
- skvx::Vec<2, int16_t> widthHeight() const { return this->rightBottom() + negLeftTop(); }
+ SkPoint leftTop() const { return -this->negLeftTop(); }
+ SkPoint rightBottom() const { return {fRect[2], fRect[3]}; }
+ SkPoint widthHeight() const { return this->rightBottom() + negLeftTop(); }
friend SkGlyphRect skglyph::rect_union(SkGlyphRect, SkGlyphRect);
friend SkGlyphRect skglyph::rect_intersection(SkGlyphRect, SkGlyphRect);
private:
- skvx::Vec<2, int16_t> negLeftTop() const { return {fRect[0], fRect[1]}; }
- using Storage = skvx::Vec<4, int16_t>;
+ SkPoint negLeftTop() const { return {fRect[0], fRect[1]}; }
+ using Storage = skvx::Vec<4, SkScalar>;
SkGlyphRect(Storage rect) : fRect{rect} { }
Storage fRect;
};
namespace skglyph {
inline SkGlyphRect empty_rect() {
- constexpr int16_t max = std::numeric_limits<int16_t>::max();
+ constexpr SkScalar max = std::numeric_limits<SkScalar>::max();
return {max, max, -max, -max};
}
inline SkGlyphRect full_rect() {
- constexpr int16_t max = std::numeric_limits<int16_t>::max();
+ constexpr SkScalar max = std::numeric_limits<SkScalar>::max();
return {-max, -max, max, max};
}
inline SkGlyphRect rect_union(SkGlyphRect a, SkGlyphRect b) {
@@ -278,6 +279,7 @@ inline SkGlyphRect rect_intersection(SkGlyphRect a, SkGlyphRect b) {
}
} // namespace skglyph
+
class SkGlyph;
// SkGlyphDigest contains a digest of information for making GPU drawing decisions. It can be
@@ -285,26 +287,42 @@ class SkGlyph;
// SkGlyphDigest is the only information that needs to be stored in the cache.
class SkGlyphDigest {
public:
+ // An atlas consists of plots, and plots hold glyphs. The minimum a plot can be is 256x256.
+ // This means that the maximum size a glyph can be is 256x256.
+ static constexpr uint16_t kSkSideTooBigForAtlas = 256;
+
// Default ctor is only needed for the hash table.
SkGlyphDigest() = default;
SkGlyphDigest(size_t index, const SkGlyph& glyph);
- int index() const { return fIndex; }
- bool isEmpty() const { return fIsEmpty; }
- bool isColor() const { return fIsColor; }
+ int index() const { return fIndex; }
+ bool isEmpty() const { return fIsEmpty; }
+ bool isColor() const { return fFormat == SkMask::kARGB32_Format; }
bool canDrawAsMask() const { return fCanDrawAsMask; }
bool canDrawAsSDFT() const { return fCanDrawAsSDFT; }
+ SkMask::Format maskFormat() const { return static_cast<SkMask::Format>(fFormat); }
uint16_t maxDimension() const {
return std::max(fWidth, fHeight);
}
+ SkGlyphRect bounds() const {
+ return SkGlyphRect(fLeft, fTop, (SkScalar)fLeft + fWidth, (SkScalar)fTop + fHeight);
+ }
+
+ // Common categories for glyph types used by GPU.
+ static bool CanDrawAsMask(const SkGlyph& glyph);
+ static bool CanDrawAsSDFT(const SkGlyph& glyph);
+ static bool CanDrawAsPath(const SkGlyph& glyph);
+ static bool FitsInAtlas(const SkGlyph& glyph);
+
private:
static_assert(SkPackedGlyphID::kEndData == 20);
+ static_assert(SkMask::kCountMaskFormats <= 8);
struct {
uint32_t fIndex : SkPackedGlyphID::kEndData;
uint32_t fIsEmpty : 1;
- uint32_t fIsColor : 1;
uint32_t fCanDrawAsMask : 1;
uint32_t fCanDrawAsSDFT : 1;
+ uint32_t fFormat : 3;
};
int16_t fLeft, fTop;
uint16_t fWidth, fHeight;
@@ -403,8 +421,7 @@ public:
SkIRect iRect() const { return SkIRect::MakeXYWH(fLeft, fTop, fWidth, fHeight); }
SkRect rect() const { return SkRect::MakeXYWH(fLeft, fTop, fWidth, fHeight); }
SkGlyphRect glyphRect() const {
- return {fLeft, fTop,
- SkTo<int16_t>(fLeft + fWidth), SkTo<int16_t>(fTop + fHeight)};
+ return SkGlyphRect(fLeft, fTop, fLeft + fWidth, fTop + fHeight);
}
int left() const { return fLeft; }
int top() const { return fTop; }
diff --git a/chromium/third_party/skia/src/core/SkGlyphBuffer.cpp b/chromium/third_party/skia/src/core/SkGlyphBuffer.cpp
index 2b385c6bbaa..7e0c40da296 100644
--- a/chromium/third_party/skia/src/core/SkGlyphBuffer.cpp
+++ b/chromium/third_party/skia/src/core/SkGlyphBuffer.cpp
@@ -7,7 +7,7 @@
#include "src/core/SkGlyphBuffer.h"
#include "src/core/SkGlyphRunPainter.h"
-#include "src/core/SkStrikeForGPU.h"
+#include "src/text/StrikeForGPU.h"
void SkSourceGlyphBuffer::reset() {
fRejectedGlyphIDs.reset();
@@ -18,6 +18,7 @@ void SkDrawableGlyphBuffer::ensureSize(size_t size) {
if (size > fMaxSize) {
fMultiBuffer.reset(size);
fPositions.reset(size);
+ fFormats.reset(size);
fMaxSize = size;
}
@@ -86,6 +87,7 @@ void SkDrawableGlyphBuffer::reset() {
if (fMaxSize > 200) {
fMultiBuffer.reset();
fPositions.reset();
+ fFormats.reset();
fMaxSize = 0;
}
fInputSize = 0;
diff --git a/chromium/third_party/skia/src/core/SkGlyphBuffer.h b/chromium/third_party/skia/src/core/SkGlyphBuffer.h
index bce39632f17..dcaab3b8e12 100644
--- a/chromium/third_party/skia/src/core/SkGlyphBuffer.h
+++ b/chromium/third_party/skia/src/core/SkGlyphBuffer.h
@@ -14,11 +14,14 @@
#include <climits>
-class SkStrikeForGPU;
struct SkGlyphPositionRoundingSpec;
class SkPath;
class SkDrawable;
+namespace sktext {
+class StrikeForGPU;
+} // namespace sktext
+
// SkSourceGlyphBuffer is the source of glyphs between the different stages of glyph drawing.
// It starts with the glyphs and positions from the SkGlyphRun as the first source. When glyphs
// are reject by a stage they become the source for the next stage.
@@ -48,27 +51,15 @@ public:
}
}
- void reject(size_t index, int rejectedMaxDimension) {
- auto [prevMin, prevMax] = fMaxDimensionHintForRejects;
- fMaxDimensionHintForRejects =
- {std::min(prevMin, rejectedMaxDimension),
- std::max(prevMax, rejectedMaxDimension)};
- this->reject(index);
- }
-
SkZip<const SkGlyphID, const SkPoint> flipRejectsToSource() {
fRejects = SkMakeZip(fRejectedGlyphIDs, fRejectedPositions).first(fRejectSize);
fSource = fRejects;
fRejectSize = 0;
- fMaxDimensionHintForSource = fMaxDimensionHintForRejects;
- fMaxDimensionHintForRejects = {INT_MAX, 0};
return fSource;
}
SkZip<const SkGlyphID, const SkPoint> source() const { return fSource; }
- std::tuple<int, int> maxDimensionHint() const {return fMaxDimensionHintForSource;}
-
private:
SkSourceGlyphBuffer(const SkZip<const SkGlyphID, const SkPoint>& source) {
fSource = source;
@@ -80,11 +71,6 @@ private:
SkZip<const SkGlyphID, const SkPoint> fSource;
size_t fRejectSize{0};
- // Calculate the smallest and largest max glyph dimension. fMaxDimensionHintForSource captures
- // fMaxDimensionHintForRejects when flipping rejects to the source.
- std::tuple<int, int> fMaxDimensionHintForSource{INT_MAX, 0};
- std::tuple<int, int> fMaxDimensionHintForRejects{INT_MAX, 0};
-
SkZip<SkGlyphID, SkPoint> fRejects;
SkSTArray<4, SkGlyphID> fRejectedGlyphIDs;
SkSTArray<4, SkPoint> fRejectedPositions;
@@ -181,6 +167,22 @@ public:
SkASSERT(fAcceptedSize <= from);
fPositions[fAcceptedSize] = fPositions[from];
fMultiBuffer[fAcceptedSize] = glyph;
+ fFormats[fAcceptedSize] = glyph->maskFormat();
+ fAcceptedSize++;
+ }
+
+ void accept(SkPackedGlyphID glyphID, SkPoint position, SkMask::Format format) {
+ SkASSERT(fPhase == kProcess);
+ fPositions[fAcceptedSize] = position;
+ fMultiBuffer[fAcceptedSize] = glyphID;
+ fFormats[fAcceptedSize] = format;
+ fAcceptedSize++;
+ }
+
+ void accept(SkPackedGlyphID glyphID, SkPoint position) {
+ SkASSERT(fPhase == kProcess);
+ fPositions[fAcceptedSize] = position;
+ fMultiBuffer[fAcceptedSize] = glyphID;
fAcceptedSize++;
}
@@ -191,6 +193,13 @@ public:
return SkZip<SkGlyphVariant, SkPoint>{fAcceptedSize, fMultiBuffer.get(), fPositions};
}
+ SkZip<SkGlyphVariant, SkPoint, SkMask::Format> acceptedWithMaskFormat() {
+ SkASSERT(fPhase == kProcess);
+ SkDEBUGCODE(fPhase = kDraw);
+ return SkZip<SkGlyphVariant, SkPoint, SkMask::Format>{
+ fAcceptedSize, fMultiBuffer.get(), fPositions, fFormats};
+ }
+
bool empty() const {
SkASSERT(fPhase == kProcess || fPhase == kDraw);
return fAcceptedSize == 0;
@@ -211,6 +220,7 @@ private:
size_t fAcceptedSize{0};
SkAutoTArray<SkGlyphVariant> fMultiBuffer;
SkAutoTMalloc<SkPoint> fPositions;
+ SkAutoTMalloc<SkMask::Format> fFormats;
#ifdef SK_DEBUG
enum {
diff --git a/chromium/third_party/skia/src/core/SkGlyphRunPainter.cpp b/chromium/third_party/skia/src/core/SkGlyphRunPainter.cpp
index 288cab71fed..1624ca4632d 100644
--- a/chromium/third_party/skia/src/core/SkGlyphRunPainter.cpp
+++ b/chromium/third_party/skia/src/core/SkGlyphRunPainter.cpp
@@ -11,7 +11,7 @@
#if SK_SUPPORT_GPU
#include "src/gpu/ganesh/GrColorInfo.h"
#include "src/gpu/ganesh/GrDirectContextPriv.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/text/gpu/SDFTControl.h"
#include "src/text/gpu/TextBlobRedrawCoordinator.h"
#endif // SK_SUPPORT_GPU
@@ -28,13 +28,13 @@
#include "src/core/SkEnumerate.h"
#include "src/core/SkFontPriv.h"
#include "src/core/SkGlyphBuffer.h"
-#include "src/core/SkGlyphRun.h"
#include "src/core/SkRasterClip.h"
#include "src/core/SkScalerCache.h"
#include "src/core/SkStrikeCache.h"
-#include "src/core/SkStrikeForGPU.h"
#include "src/core/SkStrikeSpec.h"
#include "src/core/SkTraceEvent.h"
+#include "src/text/GlyphRun.h"
+#include "src/text/StrikeForGPU.h"
#include <cinttypes>
#include <climits>
@@ -64,8 +64,8 @@ SkGlyphRunListPainterCPU::SkGlyphRunListPainterCPU(const SkSurfaceProps& props,
void SkGlyphRunListPainterCPU::drawForBitmapDevice(
SkCanvas* canvas, const BitmapDevicePainter* bitmapDevice,
- const SkGlyphRunList& glyphRunList, const SkPaint& paint, const SkMatrix& drawMatrix) {
- auto bufferScope = SkSubRunBuffers::EnsureBuffers(glyphRunList);
+ const sktext::GlyphRunList& glyphRunList, const SkPaint& paint, const SkMatrix& drawMatrix) {
+ auto bufferScope = sktext::SkSubRunBuffers::EnsureBuffers(glyphRunList);
auto [accepted, rejected] = bufferScope.buffers();
// The bitmap blitters can only draw lcd text to a N32 bitmap in srcOver. Otherwise,
@@ -104,29 +104,34 @@ void SkGlyphRunListPainterCPU::drawForBitmapDevice(
pathPaint.getPathEffect() ||
pathPaint.getMaskFilter() ||
(stroking && !hairline);
- if (!needsExactCTM) {
- for (auto [variant, pos] : accepted->accepted()) {
- const SkPath* path = variant.glyph()->path();
- SkMatrix m;
- SkPoint translate = drawOrigin + pos;
- m.setScaleTranslate(strikeToSourceScale, strikeToSourceScale,
- translate.x(), translate.y());
- SkAutoCanvasRestore acr(canvas, true);
- canvas->concat(m);
- canvas->drawPath(*path, pathPaint);
- }
- } else {
- for (auto [variant, pos] : accepted->accepted()) {
- const SkPath* path = variant.glyph()->path();
- SkMatrix m;
- SkPoint translate = drawOrigin + pos;
- m.setScaleTranslate(strikeToSourceScale, strikeToSourceScale,
- translate.x(), translate.y());
-
- SkPath deviceOutline;
- path->transform(m, &deviceOutline);
- deviceOutline.setIsVolatile(true);
- canvas->drawPath(deviceOutline, pathPaint);
+ {
+ SkBulkGlyphMetricsAndPaths glyphs{sk_sp<SkStrike>(strike)};
+ if (!needsExactCTM) {
+ for (auto [variant, pos] : accepted->accepted()) {
+ const SkGlyph& glyph = *glyphs.glyph(variant.packedID().glyphID());
+ const SkPath* path = glyph.path();
+ SkMatrix m;
+ SkPoint translate = drawOrigin + pos;
+ m.setScaleTranslate(strikeToSourceScale, strikeToSourceScale,
+ translate.x(), translate.y());
+ SkAutoCanvasRestore acr(canvas, true);
+ canvas->concat(m);
+ canvas->drawPath(*path, pathPaint);
+ }
+ } else {
+ for (auto [variant, pos] : accepted->accepted()) {
+ const SkGlyph& glyph = *glyphs.glyph(variant.packedID().glyphID());
+ const SkPath* path = glyph.path();
+ SkMatrix m;
+ SkPoint translate = drawOrigin + pos;
+ m.setScaleTranslate(strikeToSourceScale, strikeToSourceScale,
+ translate.x(), translate.y());
+
+ SkPath deviceOutline;
+ path->transform(m, &deviceOutline);
+ deviceOutline.setIsVolatile(true);
+ canvas->drawPath(deviceOutline, pathPaint);
+ }
}
}
@@ -135,8 +140,10 @@ void SkGlyphRunListPainterCPU::drawForBitmapDevice(
strike->prepareForDrawableDrawing(accepted, rejected);
rejected->flipRejectsToSource();
+ SkBulkGlyphMetricsAndDrawables glyphs(std::move(strike));
for (auto [variant, pos] : accepted->accepted()) {
- SkDrawable* drawable = variant.glyph()->drawable();
+ const SkGlyph& glyph = *glyphs.glyph(variant.packedID().glyphID());
+ SkDrawable* drawable = glyph.drawable();
SkMatrix m;
SkPoint translate = drawOrigin + pos;
m.setScaleTranslate(strikeToSourceScale, strikeToSourceScale,
@@ -249,21 +256,3 @@ void SkGlyphRunListPainterCPU::drawForBitmapDevice(
// rejects in a more sophisticated stage.
}
}
-
-auto SkSubRunBuffers::EnsureBuffers(const SkGlyphRunList& glyphRunList) -> ScopedBuffers {
- size_t size = 0;
- for (const SkGlyphRun& run : glyphRunList) {
- size = std::max(run.runSize(), size);
- }
- return ScopedBuffers(glyphRunList.buffers(), size);
-}
-
-SkSubRunBuffers::ScopedBuffers::ScopedBuffers(SkSubRunBuffers* buffers, size_t size)
- : fBuffers{buffers} {
- fBuffers->fAccepted.ensureSize(size);
-}
-
-SkSubRunBuffers::ScopedBuffers::~ScopedBuffers() {
- fBuffers->fAccepted.reset();
- fBuffers->fRejected.reset();
-}
diff --git a/chromium/third_party/skia/src/core/SkGlyphRunPainter.h b/chromium/third_party/skia/src/core/SkGlyphRunPainter.h
index b2c79cd461d..c66446568d8 100644
--- a/chromium/third_party/skia/src/core/SkGlyphRunPainter.h
+++ b/chromium/third_party/skia/src/core/SkGlyphRunPainter.h
@@ -10,17 +10,14 @@
#include "include/core/SkColorType.h"
#include "include/core/SkSurfaceProps.h"
-#include "src/core/SkDevice.h"
+#include "src/core/SkGlyphBuffer.h"
#include "src/core/SkScalerContext.h"
-class SkGlyphRunList;
-
-class SkStrikeCommon {
-public:
- // An atlas consists of plots, and plots hold glyphs. The minimum a plot can be is 256x256.
- // This means that the maximum size a glyph can be is 256x256.
- inline static constexpr uint16_t kSkSideTooBigForAtlas = 256;
-};
+class SkColorSpace;
+class SkDrawableGlyphBuffer;
+namespace sktext {
+class GlyphRunList;
+}
// -- SkGlyphRunListPainterCPU ---------------------------------------------------------------------
class SkGlyphRunListPainterCPU {
@@ -42,7 +39,8 @@ public:
void drawForBitmapDevice(
SkCanvas* canvas, const BitmapDevicePainter* bitmapDevice,
- const SkGlyphRunList& glyphRunList, const SkPaint& paint, const SkMatrix& drawMatrix);
+ const sktext::GlyphRunList& glyphRunList, const SkPaint& paint,
+ const SkMatrix& drawMatrix);
private:
// The props as on the actual device.
const SkSurfaceProps fDeviceProps;
@@ -52,11 +50,4 @@ private:
const SkColorType fColorType;
const SkScalerContextFlags fScalerContextFlags;
};
-
-#if (SK_SUPPORT_GPU || defined(SK_GRAPHITE_ENABLED))
-namespace sktext::gpu{
-class SubRunList;
-class SubRunAllocator;
-}
-#endif // SK_SUPPORT_GPU || defined(SK_GRAPHITE_ENABLED)
#endif // SkGlyphRunPainter_DEFINED
diff --git a/chromium/third_party/skia/src/core/SkGpuBlurUtils.cpp b/chromium/third_party/skia/src/core/SkGpuBlurUtils.cpp
index 9659e11f467..0a896883a2b 100644
--- a/chromium/third_party/skia/src/core/SkGpuBlurUtils.cpp
+++ b/chromium/third_party/skia/src/core/SkGpuBlurUtils.cpp
@@ -22,12 +22,12 @@
#include "src/gpu/ganesh/effects/GrTextureEffect.h"
#if SK_GPU_V1
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
using Direction = GrGaussianConvolutionFragmentProcessor::Direction;
-static void fill_in_2D_gaussian_kernel(float* kernel, int width, int height,
- SkScalar sigmaX, SkScalar sigmaY) {
+static void fill_in_2D_gaussian_kernel(
+ float* kernel, int width, int height, SkScalar sigmaX, SkScalar sigmaY) {
const float twoSigmaSqrdX = 2.0f * SkScalarToFloat(SkScalarSquare(sigmaX));
const float twoSigmaSqrdY = 2.0f * SkScalarToFloat(SkScalarSquare(sigmaY));
@@ -66,7 +66,7 @@ static void fill_in_2D_gaussian_kernel(float* kernel, int width, int height,
* Draws 'dstRect' into 'surfaceFillContext' evaluating a 1D Gaussian over 'srcView'. The src rect
* is 'dstRect' offset by 'dstToSrcOffset'. 'mode' and 'bounds' are applied to the src coords.
*/
-static void convolve_gaussian_1d(skgpu::SurfaceFillContext* sfc,
+static void convolve_gaussian_1d(skgpu::v1::SurfaceFillContext* sfc,
GrSurfaceProxyView srcView,
const SkIRect srcSubset,
SkIVector dstToSrcOffset,
@@ -114,9 +114,18 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> convolve_gaussian_2d(
!SkGpuBlurUtils::IsEffectivelyZeroSigma(sigmaY));
// Create the sdc with default SkSurfaceProps. Gaussian blurs will soon use a
// SurfaceFillContext, at which point the SkSurfaceProps won't exist anymore.
- auto sdc = skgpu::v1::SurfaceDrawContext::Make(
- rContext, srcColorType, std::move(finalCS), dstFit, dstBounds.size(), SkSurfaceProps(),
- 1, GrMipmapped::kNo, srcView.proxy()->isProtected(), srcView.origin());
+ auto sdc =
+ skgpu::v1::SurfaceDrawContext::Make(rContext,
+ srcColorType,
+ std::move(finalCS),
+ dstFit,
+ dstBounds.size(),
+ SkSurfaceProps(),
+ /*label=*/"SurfaceDrawContext_ConvolveGaussian2d",
+ 1,
+ GrMipmapped::kNo,
+ srcView.proxy()->isProtected(),
+ srcView.origin());
if (!sdc) {
return nullptr;
}
@@ -132,8 +141,16 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> convolve_gaussian_2d(
SkASSERT(size.area() <= GrMatrixConvolutionEffect::kMaxUniformSize);
float kernel[GrMatrixConvolutionEffect::kMaxUniformSize];
fill_in_2D_gaussian_kernel(kernel, size.width(), size.height(), sigmaX, sigmaY);
- auto conv = GrMatrixConvolutionEffect::Make(rContext, std::move(srcView), srcBounds,
- size, kernel, 1.0f, 0.0f, kernelOffset, wm, true,
+ auto conv = GrMatrixConvolutionEffect::Make(rContext,
+ std::move(srcView),
+ srcBounds,
+ size,
+ kernel,
+ 1.0f,
+ 0.0f,
+ kernelOffset,
+ wm,
+ true,
*sdc->caps());
paint.setColorFragmentProcessor(std::move(conv));
@@ -142,8 +159,12 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> convolve_gaussian_2d(
// 'dstBounds' is actually in 'srcView' proxy space. It represents the blurred area from src
// space that we want to capture in the new RTC at {0, 0}. Hence, we use its size as the rect to
// draw and it directly as the local rect.
- sdc->fillRectToRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(),
- SkRect::Make(dstBounds.size()), SkRect::Make(dstBounds));
+ sdc->fillRectToRect(nullptr,
+ std::move(paint),
+ GrAA::kNo,
+ SkMatrix::I(),
+ SkRect::Make(dstBounds.size()),
+ SkRect::Make(dstBounds));
return sdc;
}
@@ -169,9 +190,18 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> convolve_gaussian(
//
// Create the sdc with default SkSurfaceProps. Gaussian blurs will soon use a
// SurfaceFillContext, at which point the SkSurfaceProps won't exist anymore.
- auto dstSDC = skgpu::v1::SurfaceDrawContext::Make(
- rContext, srcColorType, std::move(finalCS), fit, dstBounds.size(), SkSurfaceProps(), 1,
- GrMipmapped::kNo, srcView.proxy()->isProtected(), srcView.origin());
+ auto dstSDC =
+ skgpu::v1::SurfaceDrawContext::Make(rContext,
+ srcColorType,
+ std::move(finalCS),
+ fit,
+ dstBounds.size(),
+ SkSurfaceProps(),
+ /*label=*/"SurfaceDrawContext_ConvolveGaussian",
+ 1,
+ GrMipmapped::kNo,
+ srcView.proxy()->isProtected(),
+ srcView.origin());
if (!dstSDC) {
return nullptr;
}
@@ -184,13 +214,21 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> convolve_gaussian(
bool canSplit = mode == SkTileMode::kDecal || mode == SkTileMode::kClamp;
// ...but it's not worth doing the splitting if we'll get HW tiling instead of shader tiling.
bool canHWTile =
- srcBounds.contains(srcBackingBounds) &&
- !rContext->priv().caps()->reducedShaderMode() && // this mode always uses shader tiling
+ srcBounds.contains(srcBackingBounds) &&
+ !rContext->priv().caps()->reducedShaderMode() && // this mode always uses shader tiling
!(mode == SkTileMode::kDecal && !rContext->priv().caps()->clampToBorderSupport());
if (!canSplit || canHWTile) {
auto dstRect = SkIRect::MakeSize(dstBounds.size());
- convolve_gaussian_1d(dstSDC.get(), std::move(srcView), srcBounds,
- rtcToSrcOffset, dstRect, srcAlphaType, direction, radius, sigma, mode);
+ convolve_gaussian_1d(dstSDC.get(),
+ std::move(srcView),
+ srcBounds,
+ rtcToSrcOffset,
+ dstRect,
+ srcAlphaType,
+ direction,
+ radius,
+ sigma,
+ mode);
return dstSDC;
}
@@ -206,12 +244,12 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> convolve_gaussian(
// Direction::kY.
SkIRect top, bottom;
if (Direction::kX == direction) {
- top = {dstBounds.left(), dstBounds.top() , dstBounds.right(), srcBounds.top() };
+ top = {dstBounds.left(), dstBounds.top(), dstBounds.right(), srcBounds.top()};
bottom = {dstBounds.left(), srcBounds.bottom(), dstBounds.right(), dstBounds.bottom()};
// Inset for sub-rect of 'srcBounds' where the x-dir kernel doesn't reach the edges, clipped
// vertically to dstBounds.
- int midA = std::max(srcBounds.top() , dstBounds.top() );
+ int midA = std::max(srcBounds.top(), dstBounds.top());
int midB = std::min(srcBounds.bottom(), dstBounds.bottom());
mid = {srcBounds.left() + radius, midA, srcBounds.right() - radius, midB};
if (mid.isEmpty()) {
@@ -219,32 +257,40 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> convolve_gaussian(
// width of dst and we will not draw mid or right.
left = {dstBounds.left(), mid.top(), dstBounds.right(), mid.bottom()};
} else {
- left = {dstBounds.left(), mid.top(), mid.left() , mid.bottom()};
- right = {mid.right(), mid.top(), dstBounds.right(), mid.bottom()};
+ left = {dstBounds.left(), mid.top(), mid.left(), mid.bottom()};
+ right = {mid.right(), mid.top(), dstBounds.right(), mid.bottom()};
}
} else {
// This is the same as the x direction code if you turn your head 90 degrees CCW. Swap x and
// y and swap top/bottom with left/right.
- top = {dstBounds.left(), dstBounds.top(), srcBounds.left() , dstBounds.bottom()};
+ top = {dstBounds.left(), dstBounds.top(), srcBounds.left(), dstBounds.bottom()};
bottom = {srcBounds.right(), dstBounds.top(), dstBounds.right(), dstBounds.bottom()};
- int midA = std::max(srcBounds.left() , dstBounds.left() );
+ int midA = std::max(srcBounds.left(), dstBounds.left());
int midB = std::min(srcBounds.right(), dstBounds.right());
mid = {midA, srcBounds.top() + radius, midB, srcBounds.bottom() - radius};
if (mid.isEmpty()) {
left = {mid.left(), dstBounds.top(), mid.right(), dstBounds.bottom()};
} else {
- left = {mid.left(), dstBounds.top(), mid.right(), mid.top() };
- right = {mid.left(), mid.bottom() , mid.right(), dstBounds.bottom()};
+ left = {mid.left(), dstBounds.top(), mid.right(), mid.top()};
+ right = {mid.left(), mid.bottom(), mid.right(), dstBounds.bottom()};
}
}
auto convolve = [&](SkIRect rect) {
// Transform rect into the render target's coord system.
rect.offset(-rtcToSrcOffset);
- convolve_gaussian_1d(dstSDC.get(), srcView, srcBounds, rtcToSrcOffset, rect,
- srcAlphaType, direction, radius, sigma, mode);
+ convolve_gaussian_1d(dstSDC.get(),
+ srcView,
+ srcBounds,
+ rtcToSrcOffset,
+ rect,
+ srcAlphaType,
+ direction,
+ radius,
+ sigma,
+ mode);
};
auto clear = [&](SkIRect rect) {
// Transform rect into the render target's coord system.
@@ -258,7 +304,7 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> convolve_gaussian(
// very arbitrary right now. It is believed that a 21x44 mid on a Moto G4 is a significant
// regression compared to doing one draw but it has not been locally evaluated or tuned.
// The optimal cutoff is likely to vary by GPU.
- if (!mid.isEmpty() && mid.width()*mid.height() < 256*256) {
+ if (!mid.isEmpty() && mid.width() * mid.height() < 256 * 256) {
left.join(mid);
left.join(right);
mid = SkIRect::MakeEmpty();
@@ -303,7 +349,7 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> convolve_gaussian(
// image, so there's no need to account for a proxy offset from the original input.
static std::unique_ptr<skgpu::v1::SurfaceDrawContext> reexpand(
GrRecordingContext* rContext,
- std::unique_ptr<skgpu::SurfaceContext> src,
+ std::unique_ptr<skgpu::v1::SurfaceContext> src,
const SkRect& srcBounds,
SkISize dstSize,
sk_sp<SkColorSpace> colorSpace,
@@ -316,26 +362,38 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> reexpand(
GrColorType srcColorType = src->colorInfo().colorType();
SkAlphaType srcAlphaType = src->colorInfo().alphaType();
- src.reset(); // no longer needed
+ src.reset(); // no longer needed
// Create the sdc with default SkSurfaceProps. Gaussian blurs will soon use a
// SurfaceFillContext, at which point the SkSurfaceProps won't exist anymore.
- auto dstSDC = skgpu::v1::SurfaceDrawContext::Make(
- rContext, srcColorType, std::move(colorSpace), fit, dstSize, SkSurfaceProps(), 1,
- GrMipmapped::kNo, srcView.proxy()->isProtected(), srcView.origin());
+ auto dstSDC = skgpu::v1::SurfaceDrawContext::Make(rContext,
+ srcColorType,
+ std::move(colorSpace),
+ fit,
+ dstSize,
+ SkSurfaceProps(),
+ /*label=*/"SurfaceDrawContext_Reexpand",
+ 1,
+ GrMipmapped::kNo,
+ srcView.proxy()->isProtected(),
+ srcView.origin());
if (!dstSDC) {
return nullptr;
}
GrPaint paint;
- auto fp = GrTextureEffect::MakeSubset(std::move(srcView), srcAlphaType, SkMatrix::I(),
- GrSamplerState::Filter::kLinear, srcBounds, srcBounds,
+ auto fp = GrTextureEffect::MakeSubset(std::move(srcView),
+ srcAlphaType,
+ SkMatrix::I(),
+ GrSamplerState::Filter::kLinear,
+ srcBounds,
+ srcBounds,
*rContext->priv().caps());
paint.setColorFragmentProcessor(std::move(fp));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
- dstSDC->fillRectToRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(),
- SkRect::Make(dstSize), srcBounds);
+ dstSDC->fillRectToRect(
+ nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(), SkRect::Make(dstSize), srcBounds);
return dstSDC;
}
@@ -375,15 +433,15 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> two_pass_gaussian(
float floatH = srcH;
// First row above the dst rect where we should restart the tile mode.
- int n = sk_float_floor2int_no_saturate((xPassDstBounds.top() - srcTop)/floatH);
- int topClip = srcTop + n*srcH;
+ int n = sk_float_floor2int_no_saturate((xPassDstBounds.top() - srcTop) / floatH);
+ int topClip = srcTop + n * srcH;
// First row above below the dst rect where we should restart the tile mode.
- n = sk_float_ceil2int_no_saturate(
- (xPassDstBounds.bottom() - srcBounds.bottom())/floatH);
- int bottomClip = srcBounds.bottom() + n*srcH;
+ n = sk_float_ceil2int_no_saturate((xPassDstBounds.bottom() - srcBounds.bottom()) /
+ floatH);
+ int bottomClip = srcBounds.bottom() + n * srcH;
- xPassDstBounds.fTop = std::max(xPassDstBounds.top(), topClip);
+ xPassDstBounds.fTop = std::max(xPassDstBounds.top(), topClip);
xPassDstBounds.fBottom = std::min(xPassDstBounds.bottom(), bottomClip);
} else {
if (xPassDstBounds.fBottom <= srcBounds.top()) {
@@ -399,15 +457,15 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> two_pass_gaussian(
xPassDstBounds.fBottom = srcBounds.bottom();
xPassDstBounds.fTop = xPassDstBounds.fBottom - 1;
} else {
- xPassDstBounds.fTop = std::max(xPassDstBounds.fTop, srcBounds.top());
+ xPassDstBounds.fTop = std::max(xPassDstBounds.fTop, srcBounds.top());
xPassDstBounds.fBottom = std::min(xPassDstBounds.fBottom, srcBounds.bottom());
}
- int leftSrcEdge = srcBounds.fLeft - radiusX ;
+ int leftSrcEdge = srcBounds.fLeft - radiusX;
int rightSrcEdge = srcBounds.fRight + radiusX;
if (mode == SkTileMode::kClamp) {
// In clamp the column just outside the src bounds has the same value as the
// column just inside, unlike decal.
- leftSrcEdge += 1;
+ leftSrcEdge += 1;
rightSrcEdge -= 1;
}
if (xPassDstBounds.fRight <= leftSrcEdge) {
@@ -428,9 +486,18 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> two_pass_gaussian(
}
}
}
- dstSDC = convolve_gaussian(
- rContext, std::move(srcView), srcColorType, srcAlphaType, srcBounds, xPassDstBounds,
- Direction::kX, radiusX, sigmaX, mode, colorSpace, xFit);
+ dstSDC = convolve_gaussian(rContext,
+ std::move(srcView),
+ srcColorType,
+ srcAlphaType,
+ srcBounds,
+ xPassDstBounds,
+ Direction::kX,
+ radiusX,
+ sigmaX,
+ mode,
+ colorSpace,
+ xFit);
if (!dstSDC) {
return nullptr;
}
@@ -444,10 +511,20 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> two_pass_gaussian(
return dstSDC;
}
- return convolve_gaussian(rContext, std::move(srcView), srcColorType, srcAlphaType, srcBounds,
- dstBounds, Direction::kY, radiusY, sigmaY, mode, colorSpace, fit);
+ return convolve_gaussian(rContext,
+ std::move(srcView),
+ srcColorType,
+ srcAlphaType,
+ srcBounds,
+ dstBounds,
+ Direction::kY,
+ radiusY,
+ sigmaY,
+ mode,
+ colorSpace,
+ fit);
}
-#endif // SK_GPU_V1
+#endif // SK_GPU_V1
namespace SkGpuBlurUtils {
@@ -522,16 +599,18 @@ std::unique_ptr<skgpu::v1::SurfaceDrawContext> GaussianBlur(GrRecordingContext*
if (!radiusX && !radiusY) {
// Create the sdc with default SkSurfaceProps. Gaussian blurs will soon use a
// SurfaceFillContext, at which point the SkSurfaceProps won't exist anymore.
- auto result = skgpu::v1::SurfaceDrawContext::Make(rContext,
- srcColorType,
- std::move(colorSpace),
- fit,
- dstBounds.size(),
- SkSurfaceProps(),
- 1,
- GrMipmapped::kNo,
- srcView.proxy()->isProtected(),
- srcView.origin());
+ auto result =
+ skgpu::v1::SurfaceDrawContext::Make(rContext,
+ srcColorType,
+ std::move(colorSpace),
+ fit,
+ dstBounds.size(),
+ SkSurfaceProps(),
+ /*label=*/"SurfaceDrawContext_GaussianBlur",
+ 1,
+ GrMipmapped::kNo,
+ srcView.proxy()->isProtected(),
+ srcView.origin());
if (!result) {
return nullptr;
}
@@ -557,31 +636,50 @@ std::unique_ptr<skgpu::v1::SurfaceDrawContext> GaussianBlur(GrRecordingContext*
kernelSize <= GrMatrixConvolutionEffect::kMaxUniformSize &&
!rContext->priv().caps()->reducedShaderMode()) {
// Apply the proxy offset to src bounds and offset directly
- return convolve_gaussian_2d(rContext, std::move(srcView), srcColorType, srcBounds,
- dstBounds, radiusX, radiusY, sigmaX, sigmaY, mode,
- std::move(colorSpace), fit);
+ return convolve_gaussian_2d(rContext,
+ std::move(srcView),
+ srcColorType,
+ srcBounds,
+ dstBounds,
+ radiusX,
+ radiusY,
+ sigmaX,
+ sigmaY,
+ mode,
+ std::move(colorSpace),
+ fit);
}
// This will automatically degenerate into a single pass of X or Y if only one of the
// radii are non-zero.
- return two_pass_gaussian(rContext, std::move(srcView), srcColorType, srcAlphaType,
- std::move(colorSpace), srcBounds, dstBounds, sigmaX, sigmaY,
- radiusX, radiusY, mode, fit);
+ return two_pass_gaussian(rContext,
+ std::move(srcView),
+ srcColorType,
+ srcAlphaType,
+ std::move(colorSpace),
+ srcBounds,
+ dstBounds,
+ sigmaX,
+ sigmaY,
+ radiusX,
+ radiusY,
+ mode,
+ fit);
}
GrColorInfo colorInfo(srcColorType, srcAlphaType, colorSpace);
auto srcCtx = rContext->priv().makeSC(srcView, colorInfo);
SkASSERT(srcCtx);
- float scaleX = sigmaX > kMaxSigma ? kMaxSigma/sigmaX : 1.f;
- float scaleY = sigmaY > kMaxSigma ? kMaxSigma/sigmaY : 1.f;
+ float scaleX = sigmaX > kMaxSigma ? kMaxSigma / sigmaX : 1.f;
+ float scaleY = sigmaY > kMaxSigma ? kMaxSigma / sigmaY : 1.f;
// We round down here so that when we recalculate sigmas we know they will be below
// kMaxSigma (but clamp to 1 do we don't have an empty texture).
- SkISize rescaledSize = {std::max(sk_float_floor2int(srcBounds.width() *scaleX), 1),
- std::max(sk_float_floor2int(srcBounds.height()*scaleY), 1)};
+ SkISize rescaledSize = {std::max(sk_float_floor2int(srcBounds.width() * scaleX), 1),
+ std::max(sk_float_floor2int(srcBounds.height() * scaleY), 1)};
// Compute the sigmas using the actual scale factors used once we integerized the
// rescaledSize.
- scaleX = static_cast<float>(rescaledSize.width()) /srcBounds.width();
- scaleY = static_cast<float>(rescaledSize.height())/srcBounds.height();
+ scaleX = static_cast<float>(rescaledSize.width()) / srcBounds.width();
+ scaleY = static_cast<float>(rescaledSize.height()) / srcBounds.height();
sigmaX *= scaleX;
sigmaY *= scaleY;
@@ -602,10 +700,10 @@ std::unique_ptr<skgpu::v1::SurfaceDrawContext> GaussianBlur(GrRecordingContext*
// that is greater than kMaxSigma. By using a pad and making the src 3 wide/tall instead of
// 1 we can recurse again and do another downscale. Since mirror and repeat modes are trivial
// for a single col/row we only add padding based on sigma exceeding kMaxSigma for decal.
- int padX = mode == SkTileMode::kClamp ||
- (mode == SkTileMode::kDecal && sigmaX > kMaxSigma) ? 1 : 0;
- int padY = mode == SkTileMode::kClamp ||
- (mode == SkTileMode::kDecal && sigmaY > kMaxSigma) ? 1 : 0;
+ int padX = mode == SkTileMode::kClamp || (mode == SkTileMode::kDecal && sigmaX > kMaxSigma) ? 1
+ : 0;
+ int padY = mode == SkTileMode::kClamp || (mode == SkTileMode::kDecal && sigmaY > kMaxSigma) ? 1
+ : 0;
// Create the sdc with default SkSurfaceProps. Gaussian blurs will soon use a
// SurfaceFillContext, at which point the SkSurfaceProps won't exist anymore.
auto rescaledSDC = skgpu::v1::SurfaceDrawContext::Make(
@@ -613,8 +711,9 @@ std::unique_ptr<skgpu::v1::SurfaceDrawContext> GaussianBlur(GrRecordingContext*
colorInfo.colorType(),
colorInfo.refColorSpace(),
SkBackingFit::kApprox,
- {rescaledSize.width() + 2*padX, rescaledSize.height() + 2*padY},
+ {rescaledSize.width() + 2 * padX, rescaledSize.height() + 2 * padY},
SkSurfaceProps(),
+ /*label=*/"RescaledSurfaceDrawContext",
1,
GrMipmapped::kNo,
srcCtx->asSurfaceProxy()->isProtected(),
@@ -666,26 +765,19 @@ std::unique_ptr<skgpu::v1::SurfaceDrawContext> GaussianBlur(GrRecordingContext*
// Downscale the edges from the original source. These draws should batch together (and with
// the above interior rescaling when it is a single pass).
- cheapDownscale(SkIRect::MakeXYWH( 0, 1, 1, dh),
- SkIRect::MakeXYWH( sLCol, sy, 1, sh));
- cheapDownscale(SkIRect::MakeXYWH( 1, 0, dw, 1),
- SkIRect::MakeXYWH( sx, sTRow, sw, 1));
- cheapDownscale(SkIRect::MakeXYWH(dw + 1, 1, 1, dh),
- SkIRect::MakeXYWH( sRCol, sy, 1, sh));
- cheapDownscale(SkIRect::MakeXYWH( 1, dh + 1, dw, 1),
- SkIRect::MakeXYWH( sx, sBRow, sw, 1));
+ cheapDownscale(SkIRect::MakeXYWH(0, 1, 1, dh), SkIRect::MakeXYWH(sLCol, sy, 1, sh));
+ cheapDownscale(SkIRect::MakeXYWH(1, 0, dw, 1), SkIRect::MakeXYWH(sx, sTRow, sw, 1));
+ cheapDownscale(SkIRect::MakeXYWH(dw + 1, 1, 1, dh), SkIRect::MakeXYWH(sRCol, sy, 1, sh));
+ cheapDownscale(SkIRect::MakeXYWH(1, dh + 1, dw, 1), SkIRect::MakeXYWH(sx, sBRow, sw, 1));
// Copy the corners from the original source. These would batch with the edges except that
// at time of writing we recognize these can use kNearest and downgrade the filter. So they
// batch with each other but not the edge draws.
- cheapDownscale(SkIRect::MakeXYWH( 0, 0, 1, 1),
- SkIRect::MakeXYWH(sLCol, sTRow, 1, 1));
- cheapDownscale(SkIRect::MakeXYWH(dw + 1, 0, 1, 1),
- SkIRect::MakeXYWH(sRCol, sTRow, 1, 1));
- cheapDownscale(SkIRect::MakeXYWH(dw + 1,dh + 1, 1, 1),
- SkIRect::MakeXYWH(sRCol, sBRow, 1, 1));
- cheapDownscale(SkIRect::MakeXYWH( 0, dh + 1, 1, 1),
- SkIRect::MakeXYWH(sLCol, sBRow, 1, 1));
+ cheapDownscale(SkIRect::MakeXYWH(0, 0, 1, 1), SkIRect::MakeXYWH(sLCol, sTRow, 1, 1));
+ cheapDownscale(SkIRect::MakeXYWH(dw + 1, 0, 1, 1), SkIRect::MakeXYWH(sRCol, sTRow, 1, 1));
+ cheapDownscale(SkIRect::MakeXYWH(dw + 1, dh + 1, 1, 1),
+ SkIRect::MakeXYWH(sRCol, sBRow, 1, 1));
+ cheapDownscale(SkIRect::MakeXYWH(0, dh + 1, 1, 1), SkIRect::MakeXYWH(sLCol, sBRow, 1, 1));
}
srcView = rescaledSDC->readSurfaceView();
// Drop the contexts so we don't hold the proxies longer than necessary.
@@ -696,9 +788,9 @@ std::unique_ptr<skgpu::v1::SurfaceDrawContext> GaussianBlur(GrRecordingContext*
// left since we trimmed off everything above and to the left of the original src bounds during
// the rescale.
SkRect scaledDstBounds = SkRect::Make(dstBounds.makeOffset(-srcBounds.topLeft()));
- scaledDstBounds.fLeft *= scaleX;
- scaledDstBounds.fTop *= scaleY;
- scaledDstBounds.fRight *= scaleX;
+ scaledDstBounds.fLeft *= scaleX;
+ scaledDstBounds.fTop *= scaleY;
+ scaledDstBounds.fRight *= scaleX;
scaledDstBounds.fBottom *= scaleY;
// Account for padding in our rescaled src, if any.
scaledDstBounds.offset(padX, padY);
@@ -723,20 +815,26 @@ std::unique_ptr<skgpu::v1::SurfaceDrawContext> GaussianBlur(GrRecordingContext*
// We rounded out the integer scaled dst bounds. Select the fractional dst bounds from the
// integer dimension blurred result when we scale back up.
scaledDstBounds.offset(-scaledDstBoundsI.left(), -scaledDstBoundsI.top());
- return reexpand(rContext, std::move(sdc), scaledDstBounds, dstBounds.size(),
- std::move(colorSpace), fit);
+ return reexpand(rContext,
+ std::move(sdc),
+ scaledDstBounds,
+ dstBounds.size(),
+ std::move(colorSpace),
+ fit);
}
-#endif // SK_GPU_V1
+#endif // SK_GPU_V1
-bool ComputeBlurredRRectParams(const SkRRect& srcRRect, const SkRRect& devRRect,
- SkScalar sigma, SkScalar xformedSigma,
+bool ComputeBlurredRRectParams(const SkRRect& srcRRect,
+ const SkRRect& devRRect,
+ SkScalar sigma,
+ SkScalar xformedSigma,
SkRRect* rrectToDraw,
SkISize* widthHeight,
SkScalar rectXs[kBlurRRectMaxDivisions],
SkScalar rectYs[kBlurRRectMaxDivisions],
SkScalar texXs[kBlurRRectMaxDivisions],
SkScalar texYs[kBlurRRectMaxDivisions]) {
- unsigned int devBlurRadius = 3*SkScalarCeilToInt(xformedSigma-1/6.0f);
+ unsigned int devBlurRadius = 3 * SkScalarCeilToInt(xformedSigma - 1 / 6.0f);
SkScalar srcBlurRadius = 3.0f * sigma;
const SkRect& devOrig = devRRect.getBounds();
@@ -745,14 +843,14 @@ bool ComputeBlurredRRectParams(const SkRRect& srcRRect, const SkRRect& devRRect,
const SkVector& devRadiiLR = devRRect.radii(SkRRect::kLowerRight_Corner);
const SkVector& devRadiiLL = devRRect.radii(SkRRect::kLowerLeft_Corner);
- const int devLeft = SkScalarCeilToInt(std::max<SkScalar>(devRadiiUL.fX, devRadiiLL.fX));
- const int devTop = SkScalarCeilToInt(std::max<SkScalar>(devRadiiUL.fY, devRadiiUR.fY));
+ const int devLeft = SkScalarCeilToInt(std::max<SkScalar>(devRadiiUL.fX, devRadiiLL.fX));
+ const int devTop = SkScalarCeilToInt(std::max<SkScalar>(devRadiiUL.fY, devRadiiUR.fY));
const int devRight = SkScalarCeilToInt(std::max<SkScalar>(devRadiiUR.fX, devRadiiLR.fX));
- const int devBot = SkScalarCeilToInt(std::max<SkScalar>(devRadiiLL.fY, devRadiiLR.fY));
+ const int devBot = SkScalarCeilToInt(std::max<SkScalar>(devRadiiLL.fY, devRadiiLR.fY));
// This is a conservative check for nine-patchability
- if (devOrig.fLeft + devLeft + devBlurRadius >= devOrig.fRight - devRight - devBlurRadius ||
- devOrig.fTop + devTop + devBlurRadius >= devOrig.fBottom - devBot - devBlurRadius) {
+ if (devOrig.fLeft + devLeft + devBlurRadius >= devOrig.fRight - devRight - devBlurRadius ||
+ devOrig.fTop + devTop + devBlurRadius >= devOrig.fBottom - devBot - devBlurRadius) {
return false;
}
@@ -761,36 +859,36 @@ bool ComputeBlurredRRectParams(const SkRRect& srcRRect, const SkRRect& devRRect,
const SkVector& srcRadiiLR = srcRRect.radii(SkRRect::kLowerRight_Corner);
const SkVector& srcRadiiLL = srcRRect.radii(SkRRect::kLowerLeft_Corner);
- const SkScalar srcLeft = std::max<SkScalar>(srcRadiiUL.fX, srcRadiiLL.fX);
- const SkScalar srcTop = std::max<SkScalar>(srcRadiiUL.fY, srcRadiiUR.fY);
+ const SkScalar srcLeft = std::max<SkScalar>(srcRadiiUL.fX, srcRadiiLL.fX);
+ const SkScalar srcTop = std::max<SkScalar>(srcRadiiUL.fY, srcRadiiUR.fY);
const SkScalar srcRight = std::max<SkScalar>(srcRadiiUR.fX, srcRadiiLR.fX);
- const SkScalar srcBot = std::max<SkScalar>(srcRadiiLL.fY, srcRadiiLR.fY);
+ const SkScalar srcBot = std::max<SkScalar>(srcRadiiLL.fY, srcRadiiLR.fY);
- int newRRWidth = 2*devBlurRadius + devLeft + devRight + 1;
- int newRRHeight = 2*devBlurRadius + devTop + devBot + 1;
+ int newRRWidth = 2 * devBlurRadius + devLeft + devRight + 1;
+ int newRRHeight = 2 * devBlurRadius + devTop + devBot + 1;
widthHeight->fWidth = newRRWidth + 2 * devBlurRadius;
widthHeight->fHeight = newRRHeight + 2 * devBlurRadius;
const SkRect srcProxyRect = srcRRect.getBounds().makeOutset(srcBlurRadius, srcBlurRadius);
rectXs[0] = srcProxyRect.fLeft;
- rectXs[1] = srcProxyRect.fLeft + 2*srcBlurRadius + srcLeft;
- rectXs[2] = srcProxyRect.fRight - 2*srcBlurRadius - srcRight;
+ rectXs[1] = srcProxyRect.fLeft + 2 * srcBlurRadius + srcLeft;
+ rectXs[2] = srcProxyRect.fRight - 2 * srcBlurRadius - srcRight;
rectXs[3] = srcProxyRect.fRight;
rectYs[0] = srcProxyRect.fTop;
- rectYs[1] = srcProxyRect.fTop + 2*srcBlurRadius + srcTop;
- rectYs[2] = srcProxyRect.fBottom - 2*srcBlurRadius - srcBot;
+ rectYs[1] = srcProxyRect.fTop + 2 * srcBlurRadius + srcTop;
+ rectYs[2] = srcProxyRect.fBottom - 2 * srcBlurRadius - srcBot;
rectYs[3] = srcProxyRect.fBottom;
texXs[0] = 0.0f;
- texXs[1] = 2.0f*devBlurRadius + devLeft;
- texXs[2] = 2.0f*devBlurRadius + devLeft + 1;
+ texXs[1] = 2.0f * devBlurRadius + devLeft;
+ texXs[2] = 2.0f * devBlurRadius + devLeft + 1;
texXs[3] = SkIntToScalar(widthHeight->fWidth);
texYs[0] = 0.0f;
- texYs[1] = 2.0f*devBlurRadius + devTop;
- texYs[2] = 2.0f*devBlurRadius + devTop + 1;
+ texYs[1] = 2.0f * devBlurRadius + devTop;
+ texYs[2] = 2.0f * devBlurRadius + devTop + 1;
texYs[3] = SkIntToScalar(widthHeight->fHeight);
const SkRect newRect = SkRect::MakeXYWH(SkIntToScalar(devBlurRadius),
@@ -798,10 +896,10 @@ bool ComputeBlurredRRectParams(const SkRRect& srcRRect, const SkRRect& devRRect,
SkIntToScalar(newRRWidth),
SkIntToScalar(newRRHeight));
SkVector newRadii[4];
- newRadii[0] = { SkScalarCeilToScalar(devRadiiUL.fX), SkScalarCeilToScalar(devRadiiUL.fY) };
- newRadii[1] = { SkScalarCeilToScalar(devRadiiUR.fX), SkScalarCeilToScalar(devRadiiUR.fY) };
- newRadii[2] = { SkScalarCeilToScalar(devRadiiLR.fX), SkScalarCeilToScalar(devRadiiLR.fY) };
- newRadii[3] = { SkScalarCeilToScalar(devRadiiLL.fX), SkScalarCeilToScalar(devRadiiLL.fY) };
+ newRadii[0] = {SkScalarCeilToScalar(devRadiiUL.fX), SkScalarCeilToScalar(devRadiiUL.fY)};
+ newRadii[1] = {SkScalarCeilToScalar(devRadiiUR.fX), SkScalarCeilToScalar(devRadiiUR.fY)};
+ newRadii[2] = {SkScalarCeilToScalar(devRadiiLR.fX), SkScalarCeilToScalar(devRadiiLR.fY)};
+ newRadii[3] = {SkScalarCeilToScalar(devRadiiLL.fX), SkScalarCeilToScalar(devRadiiLL.fY)};
rrectToDraw->setRectRadii(newRect, newRadii);
return true;
@@ -839,7 +937,6 @@ int CreateIntegralTable(float sixSigma, SkBitmap* table) {
return table->width();
}
-
void Compute1DGaussianKernel(float* kernel, float sigma, int radius) {
SkASSERT(radius == SigmaRadius(sigma));
if (SkGpuBlurUtils::IsEffectivelyZeroSigma(sigma)) {
@@ -905,8 +1002,10 @@ void Compute1DLinearGaussianKernel(float* kernel, float* offset, float sigma, in
// | | | |
// \-----^---/ Lower sample
// \---^-----/ Upper sample
- get_new_weight(&kernel[halfradius], &offset[halfradius],
- temp_kernel[index] * 0.5f, temp_kernel[index + 1]);
+ get_new_weight(&kernel[halfradius],
+ &offset[halfradius],
+ temp_kernel[index] * 0.5f,
+ temp_kernel[index + 1]);
kernel[low_index] = kernel[halfradius];
offset[low_index] = -offset[halfradius];
index++;
diff --git a/chromium/third_party/skia/src/core/SkGraphics.cpp b/chromium/third_party/skia/src/core/SkGraphics.cpp
index 20e0d1e3d85..4b165ad1113 100644
--- a/chromium/third_party/skia/src/core/SkGraphics.cpp
+++ b/chromium/third_party/skia/src/core/SkGraphics.cpp
@@ -80,7 +80,7 @@ void SkGraphics::SetFlags(const char* flags) {
paramEnd = nextSemi;
}
size_t paramLen = paramEnd - flags;
- for (int i = 0; i < (int)SK_ARRAY_COUNT(gFlags); ++i) {
+ for (int i = 0; i < (int)std::size(gFlags); ++i) {
if (paramLen != gFlags[i].fLen) {
continue;
}
@@ -139,6 +139,21 @@ SkGraphics::OpenTypeSVGDecoderFactory SkGraphics::GetOpenTypeSVGDecoderFactory()
return gSVGDecoderFactory;
}
+static SkGraphics::VariableColrV1EnabledFunc gVariableCOLRv1EnabledFunc = nullptr;
+
+/* static */
+SkGraphics::VariableColrV1EnabledFunc SkGraphics::SetVariableColrV1EnabledFunc(
+ VariableColrV1EnabledFunc variableCOLRV1EnabledFunc) {
+ VariableColrV1EnabledFunc old = gVariableCOLRv1EnabledFunc;
+ gVariableCOLRv1EnabledFunc = variableCOLRV1EnabledFunc;
+ return old;
+}
+
+/* static */
+bool SkGraphics::GetVariableColrV1Enabled() {
+ return gVariableCOLRv1EnabledFunc ? gVariableCOLRv1EnabledFunc() : false;
+}
+
extern bool gSkVMAllowJIT;
void SkGraphics::AllowJIT() {
diff --git a/chromium/third_party/skia/src/core/SkKeyHelpers.cpp b/chromium/third_party/skia/src/core/SkKeyHelpers.cpp
index 4d21314f3da..10ce86a6a1c 100644
--- a/chromium/third_party/skia/src/core/SkKeyHelpers.cpp
+++ b/chromium/third_party/skia/src/core/SkKeyHelpers.cpp
@@ -7,16 +7,20 @@
#include "src/core/SkKeyHelpers.h"
-#include "include/core/SkCombinationBuilder.h"
+#include "include/core/SkData.h"
+#include "include/effects/SkRuntimeEffect.h"
#include "src/core/SkDebugUtils.h"
#include "src/core/SkKeyContext.h"
#include "src/core/SkPaintParamsKey.h"
#include "src/core/SkPipelineData.h"
+#include "src/core/SkRuntimeEffectPriv.h"
#include "src/core/SkShaderCodeDictionary.h"
#include "src/core/SkUniform.h"
#ifdef SK_GRAPHITE_ENABLED
#include "src/gpu/Blend.h"
+#include "src/gpu/graphite/RecorderPriv.h"
+#include "src/gpu/graphite/ResourceProvider.h"
#include "src/gpu/graphite/Texture.h"
#include "src/gpu/graphite/TextureProxy.h"
#include "src/gpu/graphite/UniformManager.h"
@@ -29,6 +33,23 @@ constexpr SkPMColor4f kErrorColor = { 1, 0, 0, 1 };
//--------------------------------------------------------------------------------------------------
+void PassthroughShaderBlock::BeginBlock(const SkKeyContext& keyContext,
+ SkPaintParamsKeyBuilder* builder,
+ SkPipelineDataGatherer* gatherer) {
+#ifdef SK_GRAPHITE_ENABLED
+ if (builder->backend() == SkBackend::kGraphite) {
+ builder->beginBlock(SkBuiltInCodeSnippetID::kPassthroughShader);
+ return;
+ }
+#endif // SK_GRAPHITE_ENABLED
+
+ if (builder->backend() == SkBackend::kSkVM || builder->backend() == SkBackend::kGanesh) {
+ // TODO: add implementation of other backends
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+
#ifdef SK_GRAPHITE_ENABLED
namespace {
@@ -67,7 +88,6 @@ void SolidColorShaderBlock::BeginBlock(const SkKeyContext& keyContext,
if (builder->backend() == SkBackend::kSkVM || builder->backend() == SkBackend::kGanesh) {
// TODO: add implementation of other backends
}
-
}
//--------------------------------------------------------------------------------------------------
@@ -95,9 +115,6 @@ void add_linear_gradient_uniform_data(const SkShaderCodeDictionary* dict,
gatherer->write(gradData.fPoints[0]);
gatherer->write(gradData.fPoints[1]);
gatherer->write(static_cast<int>(gradData.fTM));
- gatherer->write(0.0f); // padding
- gatherer->write(0.0f);
- gatherer->write(0.0f);
gatherer->addFlags(dict->getSnippetRequirementFlags(codeSnippetID));
};
@@ -145,9 +162,6 @@ void add_sweep_gradient_uniform_data(const SkShaderCodeDictionary* dict,
gatherer->write(gradData.fBias);
gatherer->write(gradData.fScale);
gatherer->write(static_cast<int>(gradData.fTM));
- gatherer->write(0.0f); // padding
- gatherer->write(0.0f);
- gatherer->write(0.0f);
gatherer->addFlags(dict->getSnippetRequirementFlags(codeSnippetID));
};
@@ -173,7 +187,6 @@ void add_conical_gradient_uniform_data(const SkShaderCodeDictionary* dict,
gatherer->write(gradData.fRadii[0]);
gatherer->write(gradData.fRadii[1]);
gatherer->write(static_cast<int>(gradData.fTM));
- gatherer->write(0.0f); // padding
gatherer->addFlags(dict->getSnippetRequirementFlags(codeSnippetID));
};
@@ -397,8 +410,6 @@ void ImageShaderBlock::BeginBlock(const SkKeyContext& keyContext,
if (builder->backend() == SkBackend::kGraphite) {
// TODO: allow through lazy proxies
if (gatherer && !imgData.fTextureProxy) {
- // We're dropping the ImageShader here. This could be an instance of trying to draw
- // a raster-backed image w/ a Graphite-backed canvas.
// TODO: At some point the pre-compile path should also be creating a texture
// proxy (i.e., we can remove the 'pipelineData' in the above test).
SolidColorShaderBlock::BeginBlock(keyContext, builder, gatherer, kErrorColor);
@@ -436,9 +447,6 @@ void add_blendshader_uniform_data(const SkShaderCodeDictionary* dict,
SkPipelineDataGatherer* gatherer) {
VALIDATE_UNIFORMS(gatherer, dict, SkBuiltInCodeSnippetID::kBlendShader)
gatherer->write(SkTo<int>(bm));
- gatherer->write(0); // padding - remove
- gatherer->write(0); // padding - remove
- gatherer->write(0); // padding - remove
gatherer->addFlags(dict->getSnippetRequirementFlags(SkBuiltInCodeSnippetID::kBlendShader));
}
@@ -473,6 +481,168 @@ void BlendShaderBlock::BeginBlock(const SkKeyContext& keyContext,
}
//--------------------------------------------------------------------------------------------------
+
+#ifdef SK_GRAPHITE_ENABLED
+
+namespace {
+
+void add_matrix_colorfilter_uniform_data(const SkShaderCodeDictionary* dict,
+ const MatrixColorFilterBlock::MatrixColorFilterData& data,
+ SkPipelineDataGatherer* gatherer) {
+ VALIDATE_UNIFORMS(gatherer, dict, SkBuiltInCodeSnippetID::kMatrixColorFilter)
+ gatherer->write(data.fMatrix);
+ gatherer->write(data.fTranslate);
+ gatherer->write(static_cast<int>(data.fInHSLA));
+
+ gatherer->addFlags(
+ dict->getSnippetRequirementFlags(SkBuiltInCodeSnippetID::kMatrixColorFilter));
+}
+
+} // anonymous namespace
+
+#endif // SK_GRAPHITE_ENABLED
+
+void MatrixColorFilterBlock::BeginBlock(const SkKeyContext& keyContext,
+ SkPaintParamsKeyBuilder* builder,
+ SkPipelineDataGatherer* gatherer,
+ const MatrixColorFilterData& matrixCFData) {
+#ifdef SK_GRAPHITE_ENABLED
+ if (builder->backend() == SkBackend::kGraphite) {
+ auto dict = keyContext.dict();
+
+ if (gatherer) {
+ add_matrix_colorfilter_uniform_data(dict, matrixCFData, gatherer);
+ }
+
+ builder->beginBlock(SkBuiltInCodeSnippetID::kMatrixColorFilter);
+ }
+#endif // SK_GRAPHITE_ENABLED
+
+ if (builder->backend() == SkBackend::kSkVM || builder->backend() == SkBackend::kGanesh) {
+ // TODO: add implementation for other backends
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+
+#ifdef SK_GRAPHITE_ENABLED
+
+namespace {
+
+void add_blend_colorfilter_uniform_data(const SkShaderCodeDictionary* dict,
+ const BlendColorFilterBlock::BlendColorFilterData& data,
+ SkPipelineDataGatherer* gatherer) {
+ VALIDATE_UNIFORMS(gatherer, dict, SkBuiltInCodeSnippetID::kBlendColorFilter)
+ gatherer->write(SkTo<int>(data.fBlendMode));
+ gatherer->write(data.fSrcColor);
+
+ gatherer->addFlags(dict->getSnippetRequirementFlags(SkBuiltInCodeSnippetID::kBlendColorFilter));
+}
+
+} // anonymous namespace
+
+#endif // SK_GRAPHITE_ENABLED
+
+void BlendColorFilterBlock::BeginBlock(const SkKeyContext& keyContext,
+ SkPaintParamsKeyBuilder* builder,
+ SkPipelineDataGatherer* gatherer,
+ const BlendColorFilterData& data) {
+#ifdef SK_GRAPHITE_ENABLED
+ if (builder->backend() == SkBackend::kGraphite) {
+ auto dict = keyContext.dict();
+
+ if (gatherer) {
+ add_blend_colorfilter_uniform_data(dict, data, gatherer);
+ }
+
+ builder->beginBlock(SkBuiltInCodeSnippetID::kBlendColorFilter);
+ }
+#endif // SK_GRAPHITE_ENABLED
+
+ if (builder->backend() == SkBackend::kSkVM || builder->backend() == SkBackend::kGanesh) {
+ // TODO: add implementation for other backends
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+void ComposeColorFilterBlock::BeginBlock(const SkKeyContext& keyContext,
+ SkPaintParamsKeyBuilder* builder,
+ SkPipelineDataGatherer* gatherer) {
+#ifdef SK_GRAPHITE_ENABLED
+ if (builder->backend() == SkBackend::kGraphite) {
+ builder->beginBlock(SkBuiltInCodeSnippetID::kComposeColorFilter);
+ }
+#endif // SK_GRAPHITE_ENABLED
+
+ if (builder->backend() == SkBackend::kSkVM || builder->backend() == SkBackend::kGanesh) {
+ // TODO: add implementation for other backends
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+void GaussianColorFilterBlock::BeginBlock(const SkKeyContext& keyContext,
+ SkPaintParamsKeyBuilder* builder,
+ SkPipelineDataGatherer* gatherer) {
+#ifdef SK_GRAPHITE_ENABLED
+ if (builder->backend() == SkBackend::kGraphite) {
+ builder->beginBlock(SkBuiltInCodeSnippetID::kGaussianColorFilter);
+ }
+#endif // SK_GRAPHITE_ENABLED
+
+ if (builder->backend() == SkBackend::kSkVM || builder->backend() == SkBackend::kGanesh) {
+ // TODO: add implementation for other backends
+ }
+}
+//--------------------------------------------------------------------------------------------------
+#ifdef SK_GRAPHITE_ENABLED
+
+namespace {
+
+void add_table_colorfilter_uniform_data(const SkShaderCodeDictionary* dict,
+ const TableColorFilterBlock::TableColorFilterData& data,
+ SkPipelineDataGatherer* gatherer) {
+ VALIDATE_UNIFORMS(gatherer, dict, SkBuiltInCodeSnippetID::kTableColorFilter)
+
+ gatherer->addFlags(dict->getSnippetRequirementFlags(SkBuiltInCodeSnippetID::kTableColorFilter));
+}
+
+} // anonymous namespace
+
+#endif // SK_GRAPHITE_ENABLED
+
+TableColorFilterBlock::TableColorFilterData::TableColorFilterData() {}
+
+void TableColorFilterBlock::BeginBlock(const SkKeyContext& keyContext,
+ SkPaintParamsKeyBuilder* builder,
+ SkPipelineDataGatherer* gatherer,
+ const TableColorFilterData& data) {
+#ifdef SK_GRAPHITE_ENABLED
+ if (builder->backend() == SkBackend::kGraphite) {
+ auto dict = keyContext.dict();
+
+ if (gatherer) {
+ if (!data.fTextureProxy) {
+ // We're dropping the color filter here!
+ PassthroughShaderBlock::BeginBlock(keyContext, builder, gatherer);
+ return;
+ }
+
+ static const SkTileMode kTileModes[2] = { SkTileMode::kClamp, SkTileMode::kClamp };
+ gatherer->add(SkSamplingOptions(), kTileModes, data.fTextureProxy);
+
+ add_table_colorfilter_uniform_data(dict, data, gatherer);
+ }
+
+ builder->beginBlock(SkBuiltInCodeSnippetID::kTableColorFilter);
+ }
+#endif // SK_GRAPHITE_ENABLED
+
+ if (builder->backend() == SkBackend::kSkVM || builder->backend() == SkBackend::kGanesh) {
+ // TODO: add implementation for other backends
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
#ifdef SK_GRAPHITE_ENABLED
namespace {
@@ -518,9 +688,6 @@ void add_shaderbasedblender_uniform_data(const SkShaderCodeDictionary* dict,
SkPipelineDataGatherer* gatherer) {
VALIDATE_UNIFORMS(gatherer, dict, SkBuiltInCodeSnippetID::kShaderBasedBlender)
gatherer->write(SkTo<int>(bm));
- gatherer->write(0); // padding - remove
- gatherer->write(0); // padding - remove
- gatherer->write(0); // padding - remove
gatherer->addFlags(
dict->getSnippetRequirementFlags(SkBuiltInCodeSnippetID::kShaderBasedBlender));
@@ -563,103 +730,152 @@ void BlendModeBlock::BeginBlock(const SkKeyContext& keyContext,
}
}
-//--------------------------------------------------------------------------------------------------
-// TODO: we need to feed the number of stops in the gradients into this method from the
-// combination code
-SkUniquePaintParamsID CreateKey(const SkKeyContext& keyContext,
- SkPaintParamsKeyBuilder* builder,
- SkShaderType s,
- SkBlendMode bm) {
- SkDEBUGCODE(builder->checkReset());
-
- // TODO: split out the portion of the block data that is always required from the portion
- // that is only required to gather uniforms. Right now we're passing in a lot of unused
- // data and it is unclear what is actually used.
- switch (s) {
- case SkShaderType::kSolidColor:
- SolidColorShaderBlock::BeginBlock(keyContext, builder, nullptr,
- /* unused */ kErrorColor);
- builder->endBlock();
- break;
- case SkShaderType::kLinearGradient:
- GradientShaderBlocks::BeginBlock(keyContext, builder, nullptr,
- // only the type and numStops are used
- { SkShader::kLinear_GradientType, 0 });
- builder->endBlock();
- break;
- case SkShaderType::kRadialGradient:
- GradientShaderBlocks::BeginBlock(keyContext, builder, nullptr,
- // only the type and numStops are used
- { SkShader::kRadial_GradientType, 0 });
- builder->endBlock();
- break;
- case SkShaderType::kSweepGradient:
- GradientShaderBlocks::BeginBlock(keyContext, builder, nullptr,
- // only the type and numStops are used
- { SkShader::kSweep_GradientType, 0 });
- builder->endBlock();
- break;
- case SkShaderType::kConicalGradient:
- GradientShaderBlocks::BeginBlock(keyContext, builder, nullptr,
- // only the type and numStops are used
- { SkShader::kConical_GradientType, 0 });
- builder->endBlock();
- break;
- case SkShaderType::kLocalMatrix:
- LocalMatrixShaderBlock::BeginBlock(keyContext, builder, nullptr,
- // matrix is unused
- { SkMatrix::I() });
-
- {
- // proxy shader
- SolidColorShaderBlock::BeginBlock(keyContext, builder, nullptr,
- /* unused */ kErrorColor);
- builder->endBlock();
+RuntimeShaderBlock::ShaderData::ShaderData(sk_sp<const SkRuntimeEffect> effect)
+ : fEffect(std::move(effect)) {}
+
+RuntimeShaderBlock::ShaderData::ShaderData(sk_sp<const SkRuntimeEffect> effect,
+ const SkMatrix& localMatrix,
+ sk_sp<const SkData> uniforms)
+ : fEffect(std::move(effect))
+ , fLocalMatrix(localMatrix)
+ , fUniforms(std::move(uniforms)) {}
+
+static bool skdata_matches(const SkData* a, const SkData* b) {
+ // Returns true if both SkData objects hold the same contents, or if they are both null.
+ // (SkData::equals supports passing null, and returns false.)
+ return a ? a->equals(b) : (a == b);
+}
+
+bool RuntimeShaderBlock::ShaderData::operator==(const ShaderData& rhs) const {
+ return fEffect == rhs.fEffect &&
+ fLocalMatrix == rhs.fLocalMatrix &&
+ skdata_matches(fUniforms.get(), rhs.fUniforms.get());
+}
+
+#ifdef SK_GRAPHITE_ENABLED
+static void add_effect_to_recorder(skgpu::graphite::Recorder* recorder,
+ int codeSnippetID,
+ sk_sp<const SkRuntimeEffect> effect) {
+ recorder->priv().resourceProvider()->runtimeEffectDictionary()->set(codeSnippetID,
+ std::move(effect));
+}
+
+static void gather_runtime_effect_uniforms(SkSpan<const SkRuntimeEffect::Uniform> rtsUniforms,
+ SkSpan<const SkUniform> graphiteUniforms,
+ int graphiteStartingIndex,
+ const SkData* uniformData,
+ SkPipelineDataGatherer* gatherer) {
+ // Collect all the other uniforms from the provided SkData.
+ const uint8_t* uniformBase = uniformData->bytes();
+ for (size_t index = 0; index < rtsUniforms.size(); ++index) {
+ // The runtime shader SkShaderSnippet burns index 0 on the local matrix, so adjust our index
+ // to compensate. (Color filters and blenders don't need any adjustment and pass zero.)
+ int graphiteIndex = index + graphiteStartingIndex;
+ const SkUniform& skUniform = graphiteUniforms[graphiteIndex];
+ // Get a pointer to the offset in our data for this uniform.
+ const uint8_t* uniformPtr = uniformBase + rtsUniforms[index].offset;
+ // Pass the uniform data to the gatherer.
+ gatherer->write(skUniform.type(), skUniform.count(), uniformPtr);
+ }
+}
+#endif
+
+void RuntimeShaderBlock::BeginBlock(const SkKeyContext& keyContext,
+ SkPaintParamsKeyBuilder* builder,
+ SkPipelineDataGatherer* gatherer,
+ const ShaderData& shaderData) {
+ switch (builder->backend()) {
+ case SkBackend::kGraphite: {
+#ifdef SK_GRAPHITE_ENABLED
+ // TODO(skia:13508): add support for child effects
+
+ SkShaderCodeDictionary* dict = keyContext.dict();
+ int codeSnippetID = dict->findOrCreateRuntimeEffectSnippet(shaderData.fEffect.get());
+
+ add_effect_to_recorder(keyContext.recorder(), codeSnippetID, shaderData.fEffect);
+
+ if (gatherer) {
+ const SkShaderSnippet* entry = dict->getEntry(codeSnippetID);
+ SkASSERT(entry);
+
+ SkDEBUGCODE(UniformExpectationsValidator uev(gatherer, entry->fUniforms);)
+ gatherer->addFlags(entry->fSnippetRequirementFlags);
+
+ // Pass the local matrix inverse so we can use local coordinates.
+ SkMatrix inverseLocalMatrix;
+ if (!shaderData.fLocalMatrix.invert(&inverseLocalMatrix)) {
+ inverseLocalMatrix.setIdentity();
+ }
+ gatherer->write(SkM44(inverseLocalMatrix));
+
+ gather_runtime_effect_uniforms(shaderData.fEffect->uniforms(),
+ entry->fUniforms,
+ /*graphiteStartingIndex=*/1,
+ shaderData.fUniforms.get(),
+ gatherer);
}
- builder->endBlock();
- break;
- case SkShaderType::kImage:
- ImageShaderBlock::BeginBlock(keyContext, builder, nullptr,
- // none of the ImageData is used
- { SkSamplingOptions(),
- SkTileMode::kClamp, SkTileMode::kClamp,
- SkRect::MakeEmpty(), SkMatrix::I() });
- builder->endBlock();
+ builder->beginBlock(codeSnippetID);
+#endif // SK_GRAPHITE_ENABLED
break;
- case SkShaderType::kBlendShader:
- BlendShaderBlock::BeginBlock(keyContext, builder, nullptr,
- { SkBlendMode::kSrc });
-
- {
- // dst
- SolidColorShaderBlock::BeginBlock(keyContext, builder, nullptr,
- /* unused */ kErrorColor);
- builder->endBlock();
-
- // src
- SolidColorShaderBlock::BeginBlock(keyContext, builder, nullptr,
- /* unused */ kErrorColor);
- builder->endBlock();
- }
+ }
- builder->endBlock();
+ case SkBackend::kSkVM:
+ case SkBackend::kGanesh:
+ // TODO: add implementation for other backends
+ SolidColorShaderBlock::BeginBlock(keyContext, builder, gatherer, kErrorColor);
break;
}
+}
- BlendModeBlock::BeginBlock(keyContext, builder, /* pipelineData*/ nullptr, bm); // 'bm' is used
- builder->endBlock();
+RuntimeColorFilterBlock::ColorFilterData::ColorFilterData(sk_sp<const SkRuntimeEffect> effect)
+ : fEffect(std::move(effect)) {}
- SkPaintParamsKey key = builder->lockAsKey();
+RuntimeColorFilterBlock::ColorFilterData::ColorFilterData(sk_sp<const SkRuntimeEffect> effect,
+ sk_sp<const SkData> uniforms)
+ : fEffect(std::move(effect))
+ , fUniforms(std::move(uniforms)) {}
- auto dict = keyContext.dict();
+bool RuntimeColorFilterBlock::ColorFilterData::operator==(const ColorFilterData& rhs) const {
+ return fEffect == rhs.fEffect &&
+ skdata_matches(fUniforms.get(), rhs.fUniforms.get());
+}
- auto entry = dict->findOrCreate(
- key
+void RuntimeColorFilterBlock::BeginBlock(const SkKeyContext& keyContext,
+ SkPaintParamsKeyBuilder* builder,
+ SkPipelineDataGatherer* gatherer,
+ const ColorFilterData& filterData) {
+ switch (builder->backend()) {
+ case SkBackend::kGraphite: {
#ifdef SK_GRAPHITE_ENABLED
- , builder->blendInfo()
-#endif
- );
+ SkShaderCodeDictionary* dict = keyContext.dict();
+ int codeSnippetID = dict->findOrCreateRuntimeEffectSnippet(filterData.fEffect.get());
+
+ add_effect_to_recorder(keyContext.recorder(), codeSnippetID, filterData.fEffect);
- return entry->uniqueID();
+ if (gatherer) {
+ const SkShaderSnippet* entry = dict->getEntry(codeSnippetID);
+ SkASSERT(entry);
+
+ SkDEBUGCODE(UniformExpectationsValidator uev(gatherer, entry->fUniforms);)
+ gatherer->addFlags(entry->fSnippetRequirementFlags);
+
+ gather_runtime_effect_uniforms(filterData.fEffect->uniforms(),
+ entry->fUniforms,
+ /*graphiteStartingIndex=*/0,
+ filterData.fUniforms.get(),
+ gatherer);
+ }
+
+ builder->beginBlock(codeSnippetID);
+#endif // SK_GRAPHITE_ENABLED
+ break;
+ }
+
+ case SkBackend::kSkVM:
+ case SkBackend::kGanesh:
+ // TODO: add implementation for other backends
+ SolidColorShaderBlock::BeginBlock(keyContext, builder, gatherer, kErrorColor);
+ break;
+ }
}
diff --git a/chromium/third_party/skia/src/core/SkKeyHelpers.h b/chromium/third_party/skia/src/core/SkKeyHelpers.h
index 2e12730c462..318c52c3dab 100644
--- a/chromium/third_party/skia/src/core/SkKeyHelpers.h
+++ b/chromium/third_party/skia/src/core/SkKeyHelpers.h
@@ -10,6 +10,7 @@
#ifdef SK_GRAPHITE_ENABLED
#include "include/gpu/graphite/Context.h"
+#include "src/gpu/graphite/TextureProxy.h"
#endif
#include "include/core/SkBlendMode.h"
@@ -21,15 +22,23 @@
enum class SkBackend : uint8_t;
enum class SkShaderType : uint32_t;
+class SkData;
class SkPaintParamsKeyBuilder;
class SkPipelineDataGatherer;
+class SkRuntimeEffect;
class SkUniquePaintParamsID;
class SkKeyContext;
-namespace skgpu::graphite { class TextureProxy; }
-
// The KeyHelpers can be used to manually construct an SkPaintParamsKey
+struct PassthroughShaderBlock {
+
+ static void BeginBlock(const SkKeyContext&,
+ SkPaintParamsKeyBuilder*,
+ SkPipelineDataGatherer*);
+
+};
+
struct SolidColorShaderBlock {
static void BeginBlock(const SkKeyContext&,
@@ -160,18 +169,127 @@ struct BlendShaderBlock {
};
+struct MatrixColorFilterBlock {
+ struct MatrixColorFilterData {
+ MatrixColorFilterData(const float matrix[20],
+ bool inHSLA)
+ : fMatrix(matrix[ 0], matrix[ 1], matrix[ 2], matrix[ 3],
+ matrix[ 5], matrix[ 6], matrix[ 7], matrix[ 8],
+ matrix[10], matrix[11], matrix[12], matrix[13],
+ matrix[15], matrix[16], matrix[17], matrix[18])
+ , fTranslate(matrix[4], matrix[9], matrix[14], matrix[19])
+ , fInHSLA(inHSLA) {
+ }
+
+ SkM44 fMatrix;
+ skvx::float4 fTranslate;
+ bool fInHSLA;
+ };
+
+ static void BeginBlock(const SkKeyContext&,
+ SkPaintParamsKeyBuilder*,
+ SkPipelineDataGatherer*,
+ const MatrixColorFilterData&);
+};
+
+struct BlendColorFilterBlock {
+ struct BlendColorFilterData {
+ BlendColorFilterData(SkBlendMode blendMode, const SkPMColor4f& srcColor)
+ : fBlendMode(blendMode)
+ , fSrcColor(srcColor) {
+ }
+
+ SkBlendMode fBlendMode;
+ SkPMColor4f fSrcColor;
+ };
+
+ static void BeginBlock(const SkKeyContext&,
+ SkPaintParamsKeyBuilder*,
+ SkPipelineDataGatherer*,
+ const BlendColorFilterData&);
+};
+
+struct ComposeColorFilterBlock {
+ static void BeginBlock(const SkKeyContext&,
+ SkPaintParamsKeyBuilder*,
+ SkPipelineDataGatherer*);
+};
+
+struct TableColorFilterBlock {
+ struct TableColorFilterData {
+ TableColorFilterData();
+
+#ifdef SK_GRAPHITE_ENABLED
+ sk_sp<skgpu::graphite::TextureProxy> fTextureProxy;
+#endif
+ };
+
+ static void BeginBlock(const SkKeyContext&,
+ SkPaintParamsKeyBuilder*,
+ SkPipelineDataGatherer*,
+ const TableColorFilterData&);
+};
+
+struct GaussianColorFilterBlock {
+ static void BeginBlock(const SkKeyContext&,
+ SkPaintParamsKeyBuilder*,
+ SkPipelineDataGatherer*);
+};
+
struct BlendModeBlock {
static void BeginBlock(const SkKeyContext&,
SkPaintParamsKeyBuilder*,
SkPipelineDataGatherer*,
SkBlendMode);
+};
+
+struct RuntimeShaderBlock {
+ struct ShaderData {
+ // This ctor is used during pre-compilation when we don't have enough information to
+ // extract uniform data.
+ ShaderData(sk_sp<const SkRuntimeEffect> effect);
+
+ // This ctor is used when extracting information from PaintParams.
+ ShaderData(sk_sp<const SkRuntimeEffect> effect,
+ const SkMatrix& localMatrix,
+ sk_sp<const SkData> uniforms);
+ bool operator==(const ShaderData& rhs) const;
+ bool operator!=(const ShaderData& rhs) const { return !(*this == rhs); }
+
+ // Runtime shader data.
+ sk_sp<const SkRuntimeEffect> fEffect;
+ SkMatrix fLocalMatrix;
+ sk_sp<const SkData> fUniforms;
+ };
+
+ static void BeginBlock(const SkKeyContext&,
+ SkPaintParamsKeyBuilder*,
+ SkPipelineDataGatherer*,
+ const ShaderData&);
};
-// Bridge between the combinations system and the SkPaintParamsKey
-SkUniquePaintParamsID CreateKey(const SkKeyContext&,
- SkPaintParamsKeyBuilder*,
- SkShaderType,
- SkBlendMode);
+struct RuntimeColorFilterBlock {
+ struct ColorFilterData {
+ // This ctor is used during pre-compilation when we don't have enough information to
+ // extract uniform data.
+ ColorFilterData(sk_sp<const SkRuntimeEffect> effect);
+
+ // This ctor is used when extracting information from PaintParams.
+ ColorFilterData(sk_sp<const SkRuntimeEffect> effect, sk_sp<const SkData> uniforms);
+
+ bool operator==(const ColorFilterData& rhs) const;
+ bool operator!=(const ColorFilterData& rhs) const { return !(*this == rhs); }
+
+ // Runtime shader data.
+ sk_sp<const SkRuntimeEffect> fEffect;
+ sk_sp<const SkData> fUniforms;
+ };
+
+ static void BeginBlock(const SkKeyContext&,
+ SkPaintParamsKeyBuilder*,
+ SkPipelineDataGatherer*,
+ const ColorFilterData&);
+};
#endif // SkKeyHelpers_DEFINED
diff --git a/chromium/third_party/skia/src/core/SkLineClipper.cpp b/chromium/third_party/skia/src/core/SkLineClipper.cpp
index c184d7b8997..baeab1b8141 100644
--- a/chromium/third_party/skia/src/core/SkLineClipper.cpp
+++ b/chromium/third_party/skia/src/core/SkLineClipper.cpp
@@ -172,7 +172,7 @@ static bool is_between_unsorted(SkScalar value,
}
#endif
-int SkLineClipper::ClipLine(const SkPoint pts[], const SkRect& clip, SkPoint lines[],
+int SkLineClipper::ClipLine(const SkPoint pts[2], const SkRect& clip, SkPoint lines[kMaxPoints],
bool canCullToTheRight) {
int index0, index1;
diff --git a/chromium/third_party/skia/src/core/SkMalloc.cpp b/chromium/third_party/skia/src/core/SkMalloc.cpp
index b32242ad6a1..75c75f54256 100644
--- a/chromium/third_party/skia/src/core/SkMalloc.cpp
+++ b/chromium/third_party/skia/src/core/SkMalloc.cpp
@@ -20,3 +20,11 @@ void* sk_realloc_throw(void* buffer, size_t count, size_t elemSize) {
void* sk_malloc_canfail(size_t count, size_t elemSize) {
return sk_malloc_canfail(SkSafeMath::Mul(count, elemSize));
}
+
+size_t sk_malloc_usable_size(void* buffer) {
+ // Since sk_malloc() can be overridden by clients, there is no guarantee
+ // that the memory allocated with it comes from malloc(). So the default
+ // implementation can only return 0 to signal that generic support is not
+ // possible.
+ return 0;
+}
diff --git a/chromium/third_party/skia/src/core/SkMask.cpp b/chromium/third_party/skia/src/core/SkMask.cpp
index 76f093f982f..8361482027c 100644
--- a/chromium/third_party/skia/src/core/SkMask.cpp
+++ b/chromium/third_party/skia/src/core/SkMask.cpp
@@ -11,6 +11,8 @@
#include "include/private/SkTo.h"
#include "src/core/SkSafeMath.h"
+#include <climits>
+
/** returns the product if it is positive and fits in 31 bits. Otherwise this
returns 0.
*/
@@ -57,27 +59,29 @@ SkMask SkMask::PrepareDestination(int radiusX, int radiusY, const SkMask& src) {
SkSafeMath safe;
SkMask dst;
+ dst.fImage = nullptr;
+ dst.fFormat = SkMask::kA8_Format;
+
// dstW = srcW + 2 * radiusX;
size_t dstW = safe.add(src.fBounds.width(), safe.add(radiusX, radiusX));
// dstH = srcH + 2 * radiusY;
size_t dstH = safe.add(src.fBounds.height(), safe.add(radiusY, radiusY));
- if (!SkTFitsIn<int>(dstW) || !SkTFitsIn<int>(dstH)) {
+ size_t toAlloc = safe.mul(dstW, dstH);
+
+ // We can only deal with masks that fit in INT_MAX and sides that fit in int.
+ if (!SkTFitsIn<int>(dstW) || !SkTFitsIn<int>(dstH) || toAlloc > INT_MAX || !safe) {
dst.fBounds.setEmpty();
dst.fRowBytes = 0;
- } else {
- dst.fBounds.setWH(SkTo<int>(dstW), SkTo<int>(dstH));
- dst.fBounds.offset(src.fBounds.x(), src.fBounds.y());
- dst.fBounds.offset(-radiusX, -radiusY);
- dst.fRowBytes = SkTo<uint32_t>(dstW);
+ return dst;
}
- dst.fImage = nullptr;
- dst.fFormat = SkMask::kA8_Format;
-
- size_t toAlloc = safe.mul(dstW, dstH);
+ dst.fBounds.setWH(SkTo<int>(dstW), SkTo<int>(dstH));
+ dst.fBounds.offset(src.fBounds.x(), src.fBounds.y());
+ dst.fBounds.offset(-radiusX, -radiusY);
+ dst.fRowBytes = SkTo<uint32_t>(dstW);
- if (safe && src.fImage != nullptr) {
+ if (src.fImage != nullptr) {
dst.fImage = SkMask::AllocImage(toAlloc);
}
@@ -97,7 +101,7 @@ static const int gMaskFormatToShift[] = {
};
static int maskFormatToShift(SkMask::Format format) {
- SkASSERT((unsigned)format < SK_ARRAY_COUNT(gMaskFormatToShift));
+ SkASSERT((unsigned)format < std::size(gMaskFormatToShift));
SkASSERT(SkMask::kBW_Format != format);
return gMaskFormatToShift[format];
}
diff --git a/chromium/third_party/skia/src/core/SkMaskBlurFilter.cpp b/chromium/third_party/skia/src/core/SkMaskBlurFilter.cpp
index 67058e4dfb0..4445c4fbd03 100644
--- a/chromium/third_party/skia/src/core/SkMaskBlurFilter.cpp
+++ b/chromium/third_party/skia/src/core/SkMaskBlurFilter.cpp
@@ -296,12 +296,6 @@ using ToA8 = decltype(bw_to_a8);
using fp88 = skvx::Vec<8, uint16_t>; // 8-wide fixed point 8.8
-static fp88 mulhi(const fp88& a, const fp88& b) {
- // On NEON, this is optimal; with SSE, clang appears to detect the pattern and convert it to the
- // optimal single instruction, _mm_mulhi_epu16.
- return skvx::cast<uint16_t>(mull(a, b) >> 16);
-}
-
static fp88 load(const uint8_t* from, int width, ToA8* toA8) {
// Our fast path is a full 8-byte load of A8.
// So we'll conditionally handle the two slow paths using tmp:
diff --git a/chromium/third_party/skia/src/core/SkMathPriv.h b/chromium/third_party/skia/src/core/SkMathPriv.h
index c071efe4b15..8d40c7f64f1 100644
--- a/chromium/third_party/skia/src/core/SkMathPriv.h
+++ b/chromium/third_party/skia/src/core/SkMathPriv.h
@@ -161,7 +161,7 @@ constexpr int SkCLZ_portable(uint32_t x) {
y = x >> 4; if (y != 0) {n -= 4; x = y;}
y = x >> 2; if (y != 0) {n -= 2; x = y;}
y = x >> 1; if (y != 0) {return n - 2;}
- return n - x;
+ return n - static_cast<int>(x);
}
static_assert(32 == SkCLZ_portable(0));
@@ -279,12 +279,12 @@ constexpr int SkPrevLog2_portable(uint32_t value) {
*/
static inline int SkNextPow2(int value) {
SkASSERT(value > 0);
- return 1 << SkNextLog2(value);
+ return 1 << SkNextLog2(static_cast<uint32_t>(value));
}
constexpr int SkNextPow2_portable(int value) {
SkASSERT(value > 0);
- return 1 << SkNextLog2_portable(value);
+ return 1 << SkNextLog2_portable(static_cast<uint32_t>(value));
}
/**
@@ -294,12 +294,12 @@ constexpr int SkNextPow2_portable(int value) {
*/
static inline int SkPrevPow2(int value) {
SkASSERT(value > 0);
- return 1 << SkPrevLog2(value);
+ return 1 << SkPrevLog2(static_cast<uint32_t>(value));
}
constexpr int SkPrevPow2_portable(int value) {
SkASSERT(value > 0);
- return 1 << SkPrevLog2_portable(value);
+ return 1 << SkPrevLog2_portable(static_cast<uint32_t>(value));
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/chromium/third_party/skia/src/core/SkMatrix.cpp b/chromium/third_party/skia/src/core/SkMatrix.cpp
index 85e3c1748c1..08bee410a48 100644
--- a/chromium/third_party/skia/src/core/SkMatrix.cpp
+++ b/chromium/third_party/skia/src/core/SkMatrix.cpp
@@ -62,13 +62,13 @@ void SkMatrix::doNormalizePerspective() {
SkMatrix& SkMatrix::reset() { *this = SkMatrix(); return *this; }
-SkMatrix& SkMatrix::set9(const SkScalar buffer[]) {
+SkMatrix& SkMatrix::set9(const SkScalar buffer[9]) {
memcpy(fMat, buffer, 9 * sizeof(SkScalar));
this->setTypeMask(kUnknown_Mask);
return *this;
}
-SkMatrix& SkMatrix::setAffine(const SkScalar buffer[]) {
+SkMatrix& SkMatrix::setAffine(const SkScalar buffer[6]) {
fMat[kMScaleX] = buffer[kAScaleX];
fMat[kMSkewX] = buffer[kASkewX];
fMat[kMTransX] = buffer[kATransX];
diff --git a/chromium/third_party/skia/src/core/SkMesh.cpp b/chromium/third_party/skia/src/core/SkMesh.cpp
index 939795ec541..3cc10ee29e6 100644
--- a/chromium/third_party/skia/src/core/SkMesh.cpp
+++ b/chromium/third_party/skia/src/core/SkMesh.cpp
@@ -51,9 +51,7 @@ using Uniform = SkMeshSpecification::Uniform;
static std::vector<Uniform>::iterator find_uniform(std::vector<Uniform>& uniforms,
std::string_view name) {
return std::find_if(uniforms.begin(), uniforms.end(),
- [name](const SkMeshSpecification::Uniform& u) {
- return u.name.equals(name.data(), name.size());
- });
+ [name](const SkMeshSpecification::Uniform& u) { return u.name == name; });
}
static std::tuple<bool, SkString>
@@ -86,14 +84,14 @@ gather_uniforms_and_check_for_main(const SkSL::Program& program,
if (uniform.isArray() != iter->isArray() ||
uniform.type != iter->type ||
uniform.count != iter->count) {
- return {false, SkStringPrintf("Uniform %s declared with different types"
- " in vertex and fragment shaders.",
- iter->name.c_str())};
+ return {false, SkStringPrintf("Uniform %.*s declared with different types"
+ " in vertex and fragment shaders.",
+ (int)iter->name.size(), iter->name.data())};
}
if (uniform.isColor() != iter->isColor()) {
- return {false, SkStringPrintf("Uniform %s declared with different color"
+ return {false, SkStringPrintf("Uniform %.*s declared with different color"
" layout in vertex and fragment shaders.",
- iter->name.c_str())};
+ (int)iter->name.size(), iter->name.data())};
}
(*iter).flags |= stage;
}
@@ -331,7 +329,7 @@ SkMeshSpecification::Result SkMeshSpecification::MakeFromSourceWithStructs(
size_t offset = 0;
SkSL::SharedCompiler compiler;
- SkSL::Program::Settings settings;
+ SkSL::ProgramSettings settings;
// TODO(skia:11209): Add SkCapabilities to the API, check against required version.
std::unique_ptr<SkSL::Program> vsProgram = compiler->convertProgram(
SkSL::ProgramKind::kMeshVertex,
@@ -450,11 +448,9 @@ size_t SkMeshSpecification::uniformSize() const {
: SkAlign4(fUniforms.back().offset + fUniforms.back().sizeInBytes());
}
-const Uniform* SkMeshSpecification::findUniform(const char* name) const {
- SkASSERT(name);
- size_t len = strlen(name);
- auto iter = std::find_if(fUniforms.begin(), fUniforms.end(), [name, len] (const Uniform& u) {
- return u.name.equals(name, len);
+const Uniform* SkMeshSpecification::findUniform(std::string_view name) const {
+ auto iter = std::find_if(fUniforms.begin(), fUniforms.end(), [name] (const Uniform& u) {
+ return u.name == name;
});
return iter == fUniforms.end() ? nullptr : &(*iter);
}
@@ -470,32 +466,40 @@ SkMesh::SkMesh(SkMesh&&) = default;
SkMesh& SkMesh::operator=(const SkMesh&) = default;
SkMesh& SkMesh::operator=(SkMesh&&) = default;
-sk_sp<IndexBuffer> SkMesh::MakeIndexBuffer(GrDirectContext* dc, sk_sp<const SkData> data) {
- if (!data) {
- return nullptr;
- }
+sk_sp<IndexBuffer> SkMesh::MakeIndexBuffer(GrDirectContext* dc, const void* data, size_t size) {
if (!dc) {
- return SkMeshPriv::CpuIndexBuffer::Make(std::move(data));
+ return SkMeshPriv::CpuIndexBuffer::Make(data, size);
}
#if SK_SUPPORT_GPU
- return SkMeshPriv::GpuIndexBuffer::Make(dc, std::move(data));
+ return SkMeshPriv::GpuIndexBuffer::Make(dc, data, size);
#endif
return nullptr;
}
-sk_sp<VertexBuffer> SkMesh::MakeVertexBuffer(GrDirectContext* dc, sk_sp<const SkData> data) {
+sk_sp<IndexBuffer> SkMesh::MakeIndexBuffer(GrDirectContext* dc, sk_sp<const SkData> data) {
if (!data) {
return nullptr;
}
+ return MakeIndexBuffer(dc, data->data(), data->size());
+}
+
+sk_sp<VertexBuffer> SkMesh::MakeVertexBuffer(GrDirectContext* dc, const void* data, size_t size) {
if (!dc) {
- return SkMeshPriv::CpuVertexBuffer::Make(std::move(data));
+ return SkMeshPriv::CpuVertexBuffer::Make(data, size);
}
#if SK_SUPPORT_GPU
- return SkMeshPriv::GpuVertexBuffer::Make(dc, std::move(data));
+ return SkMeshPriv::GpuVertexBuffer::Make(dc, data, size);
#endif
return nullptr;
}
+sk_sp<VertexBuffer> SkMesh::MakeVertexBuffer(GrDirectContext* dc, sk_sp<const SkData> data) {
+ if (!data) {
+ return nullptr;
+ }
+ return MakeVertexBuffer(dc, data->data(), data->size());
+}
+
SkMesh SkMesh::Make(sk_sp<SkMeshSpecification> spec,
Mode mode,
sk_sp<VertexBuffer> vb,
@@ -608,4 +612,67 @@ bool SkMesh::validate() const {
return sm.ok();
}
+//////////////////////////////////////////////////////////////////////////////
+
+static inline bool check_update(const void* data, size_t offset, size_t size, size_t bufferSize) {
+ SkSafeMath sm;
+ return data &&
+ size &&
+ SkIsAlign4(offset) &&
+ SkIsAlign4(size) &&
+ sm.add(offset, size) <= bufferSize &&
+ sm.ok();
+}
+
+bool SkMesh::IndexBuffer::update(GrDirectContext* dc,
+ const void* data,
+ size_t offset,
+ size_t size) {
+ return check_update(data, offset, size, this->size()) && this->onUpdate(dc, data, offset, size);
+}
+
+bool SkMesh::VertexBuffer::update(GrDirectContext* dc,
+ const void* data,
+ size_t offset,
+ size_t size) {
+ return check_update(data, offset, size, this->size()) && this->onUpdate(dc, data, offset, size);
+}
+
+#if SK_SUPPORT_GPU
+bool SkMeshPriv::UpdateGpuBuffer(GrDirectContext* dc,
+ sk_sp<GrGpuBuffer> buffer,
+ const void* data,
+ size_t offset,
+ size_t size) {
+ if (!dc || dc != buffer->getContext()) {
+ return false;
+ }
+ SkASSERT(!dc->abandoned()); // If dc is abandoned then buffer->getContext() should be null.
+
+ if (!dc->priv().caps()->transferFromBufferToBufferSupport()) {
+ // TODO: Add task that takes a copy of data and pushes it to buffer.
+ return false;
+ }
+
+ // TODO: Use staging buffer manager if available to be more efficient with buffer space.
+ auto tempBuffer = dc->priv().resourceProvider()->createBuffer(size,
+ GrGpuBufferType::kXferCpuToGpu,
+ kDynamic_GrAccessPattern);
+ if (!tempBuffer) {
+ return false;
+ }
+ if (!tempBuffer->updateData(data, 0, size, /*preserve=*/false)) {
+ return false;
+ }
+
+ dc->priv().drawingManager()->newBufferTransferTask(std::move(tempBuffer),
+ /*srcOffset=*/0,
+ std::move(buffer),
+ offset,
+ size);
+
+ return true;
+}
+#endif // SK_SUPPORT_GPU
+
#endif // SK_ENABLE_SKSL
diff --git a/chromium/third_party/skia/src/core/SkMeshPriv.h b/chromium/third_party/skia/src/core/SkMeshPriv.h
index f681bce9029..6d52deda7b5 100644
--- a/chromium/third_party/skia/src/core/SkMeshPriv.h
+++ b/chromium/third_party/skia/src/core/SkMeshPriv.h
@@ -12,12 +12,14 @@
#ifdef SK_ENABLE_SKSL
#include "include/core/SkData.h"
-#include "include/private/gpu/ganesh/GrTypesPriv.h"
#include "src/core/SkSLTypeShared.h"
#if SK_SUPPORT_GPU
#include "include/gpu/GrDirectContext.h"
+#include "include/private/gpu/ganesh/GrTypesPriv.h"
#include "src/gpu/ganesh/GrDirectContextPriv.h"
+#include "src/gpu/ganesh/GrDrawingManager.h"
+#include "src/gpu/ganesh/GrGpuBuffer.h"
#include "src/gpu/ganesh/GrGpuBuffer.h"
#include "src/gpu/ganesh/GrResourceCache.h"
#include "src/gpu/ganesh/GrResourceProvider.h"
@@ -29,7 +31,7 @@ struct SkMeshSpecificationPriv {
using ColorType = SkMeshSpecification::ColorType;
static SkSpan<const Varying> Varyings(const SkMeshSpecification& spec) {
- return SkMakeSpan(spec.fVaryings);
+ return SkSpan(spec.fVaryings);
}
static const SkSL::Program* VS(const SkMeshSpecification& spec) { return spec.fVS.get(); }
@@ -64,6 +66,7 @@ struct SkMeshSpecificationPriv {
SkUNREACHABLE;
}
+#if SK_SUPPORT_GPU
static GrVertexAttribType AttrTypeAsVertexAttribType(Attribute::Type type) {
switch (type) {
case Attribute::Type::kFloat: return kFloat_GrVertexAttribType;
@@ -74,6 +77,7 @@ struct SkMeshSpecificationPriv {
}
SkUNREACHABLE;
}
+#endif
static SkSLType AttrTypeAsSLType(Attribute::Type type) {
switch (type) {
@@ -97,13 +101,11 @@ struct SkMeshPriv {
Buffer& operator=(const Buffer&) = delete;
- virtual sk_sp<const SkData> asData() const { return nullptr; }
+ virtual const void* peek() const { return nullptr; }
#if SK_SUPPORT_GPU
virtual sk_sp<const GrGpuBuffer> asGpuBuffer() const { return nullptr; }
#endif
-
- virtual size_t size() const = 0;
};
class IB : public Buffer, public SkMesh::IndexBuffer {};
@@ -111,17 +113,20 @@ struct SkMeshPriv {
template <typename Base> class CpuBuffer final : public Base {
public:
- CpuBuffer() = default;
~CpuBuffer() override = default;
- static sk_sp<Base> Make(sk_sp<const SkData> data);
+ static sk_sp<Base> Make(const void* data, size_t size);
- sk_sp<const SkData> asData() const override { return fData; }
+ const void* peek() const override { return fData->data(); }
size_t size() const override { return fData->size(); }
private:
- sk_sp<const SkData> fData;
+ CpuBuffer(sk_sp<SkData> data) : fData(std::move(data)) {}
+
+ bool onUpdate(GrDirectContext*, const void* data, size_t offset, size_t size) override;
+
+ sk_sp<SkData> fData;
};
using CpuIndexBuffer = CpuBuffer<IB>;
@@ -134,13 +139,15 @@ struct SkMeshPriv {
~GpuBuffer() override;
- static sk_sp<Base> Make(GrDirectContext*, sk_sp<const SkData>);
+ static sk_sp<Base> Make(GrDirectContext*, const void* data, size_t size);
sk_sp<const GrGpuBuffer> asGpuBuffer() const override { return fBuffer; }
size_t size() const override { return fBuffer->size(); }
private:
+ bool onUpdate(GrDirectContext*, const void* data, size_t offset, size_t size) override;
+
sk_sp<GrGpuBuffer> fBuffer;
GrDirectContext::DirectContextID fContextID;
};
@@ -148,16 +155,42 @@ struct SkMeshPriv {
using GpuIndexBuffer = GpuBuffer<IB, GrGpuBufferType::kIndex >;
using GpuVertexBuffer = GpuBuffer<VB, GrGpuBufferType::kVertex>;
#endif // SK_SUPPORT_GPU
+
+private:
+#if SK_SUPPORT_GPU
+ static bool UpdateGpuBuffer(GrDirectContext*,
+ sk_sp<GrGpuBuffer>,
+ const void*,
+ size_t offset,
+ size_t size);
+#endif
};
inline SkMeshPriv::Buffer::~Buffer() = default;
-template <typename Base> sk_sp<Base> SkMeshPriv::CpuBuffer<Base>::Make(sk_sp<const SkData> data) {
- SkASSERT(data);
- auto result = new CpuBuffer<Base>;
- result->fData = std::move(data);
- return sk_sp<Base>(result);
+template <typename Base> sk_sp<Base> SkMeshPriv::CpuBuffer<Base>::Make(const void* data,
+ size_t size) {
+ SkASSERT(size);
+ sk_sp<SkData> storage;
+ if (data) {
+ storage = SkData::MakeWithCopy(data, size);
+ } else {
+ storage = SkData::MakeUninitialized(size);
+ }
+ return sk_sp<Base>(new CpuBuffer<Base>(std::move(storage)));
+}
+
+template <typename Base> bool SkMeshPriv::CpuBuffer<Base>::onUpdate(GrDirectContext* dc,
+ const void* data,
+ size_t offset,
+ size_t size) {
+ if (dc) {
+ return false;
+ }
+ std::memcpy(SkTAddOffset<void>(fData->writable_data(), offset), data, size);
+ return true;
}
+
#if SK_SUPPORT_GPU
template <typename Base, GrGpuBufferType Type> SkMeshPriv::GpuBuffer<Base, Type>::~GpuBuffer() {
@@ -165,25 +198,38 @@ template <typename Base, GrGpuBufferType Type> SkMeshPriv::GpuBuffer<Base, Type>
}
template <typename Base, GrGpuBufferType Type>
-sk_sp<Base> SkMeshPriv::GpuBuffer<Base, Type>::Make(GrDirectContext* dc,sk_sp<const SkData> data) {
+sk_sp<Base> SkMeshPriv::GpuBuffer<Base, Type>::Make(GrDirectContext* dc,
+ const void* data,
+ size_t size) {
SkASSERT(dc);
- SkASSERT(data);
sk_sp<GrGpuBuffer> buffer = dc->priv().resourceProvider()->createBuffer(
- data->data(),
- data->size(),
+ size,
Type,
kStatic_GrAccessPattern);
if (!buffer) {
return nullptr;
}
+ if (data && !buffer->updateData(data, 0, size, /*preserve=*/false)) {
+ return nullptr;
+ }
+
auto result = new GpuBuffer;
result->fBuffer = std::move(buffer);
result->fContextID = dc->directContextID();
return sk_sp<Base>(result);
}
+
+template <typename Base, GrGpuBufferType Type>
+bool SkMeshPriv::GpuBuffer<Base, Type>::onUpdate(GrDirectContext* dc,
+ const void* data,
+ size_t offset,
+ size_t size) {
+ return UpdateGpuBuffer(dc, fBuffer, data, offset, size);
+}
+
#endif // SK_SUPPORT_GPU
#endif // SK_ENABLE_SKSL
diff --git a/chromium/third_party/skia/src/core/SkMiniRecorder.cpp b/chromium/third_party/skia/src/core/SkMiniRecorder.cpp
deleted file mode 100644
index dd69730afa5..00000000000
--- a/chromium/third_party/skia/src/core/SkMiniRecorder.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "include/core/SkCanvas.h"
-#include "include/core/SkPicture.h"
-#include "include/core/SkTextBlob.h"
-#include "include/private/SkOnce.h"
-#include "src/core/SkMiniRecorder.h"
-#include "src/core/SkPictureCommon.h"
-#include "src/core/SkRecordDraw.h"
-#include "src/core/SkRectPriv.h"
-#include "src/core/SkTLazy.h"
-#include <new>
-
-using namespace SkRecords;
-
-class SkEmptyPicture final : public SkPicture {
-public:
- void playback(SkCanvas*, AbortCallback*) const override { }
-
- size_t approximateBytesUsed() const override { return sizeof(*this); }
- int approximateOpCount(bool) const override { return 0; }
- SkRect cullRect() const override { return SkRect::MakeEmpty(); }
-};
-
-// Calculate conservative bounds for each type of draw op that can be its own mini picture.
-// These are fairly easy because we know they can't be affected by any matrix or saveLayers.
-static SkRect adjust_for_paint(SkRect bounds, const SkPaint& paint) {
- return paint.canComputeFastBounds() ? paint.computeFastBounds(bounds, &bounds)
- : SkRectPriv::MakeLargest();
-}
-static SkRect bounds(const DrawRect& op) {
- return adjust_for_paint(op.rect, op.paint);
-}
-static SkRect bounds(const DrawPath& op) {
- return op.path.isInverseFillType() ? SkRectPriv::MakeLargest()
- : adjust_for_paint(op.path.getBounds(), op.paint);
-}
-static SkRect bounds(const DrawTextBlob& op) {
- return adjust_for_paint(op.blob->bounds().makeOffset(op.x, op.y), op.paint);
-}
-
-template <typename T>
-class SkMiniPicture final : public SkPicture {
-public:
- SkMiniPicture(const SkRect* cull, T&& op)
- : fCull(cull ? *cull : bounds(op))
- , fOp(std::move(op)) {}
-
- void playback(SkCanvas* c, AbortCallback*) const override {
- SkRecords::Draw(c, nullptr, nullptr, 0, nullptr)(fOp);
- }
-
- size_t approximateBytesUsed() const override { return sizeof(*this); }
- int approximateOpCount(bool) const override { return 1; }
- SkRect cullRect() const override { return fCull; }
-
-private:
- SkRect fCull;
- T fOp;
-};
-
-
-SkMiniRecorder::SkMiniRecorder() : fState(State::kEmpty) {}
-SkMiniRecorder::~SkMiniRecorder() {
- if (fState != State::kEmpty) {
- // We have internal state pending.
- // Detaching then deleting a picture is an easy way to clean up.
- (void)this->detachAsPicture(nullptr);
- }
- SkASSERT(fState == State::kEmpty);
-}
-
-#define TRY_TO_STORE(Type, ...) \
- if (fState != State::kEmpty) { return false; } \
- fState = State::k##Type; \
- new (fBuffer) Type{__VA_ARGS__}; \
- return true
-
-bool SkMiniRecorder::drawRect(const SkRect& rect, const SkPaint& paint) {
- TRY_TO_STORE(DrawRect, paint, rect);
-}
-
-bool SkMiniRecorder::drawPath(const SkPath& path, const SkPaint& paint) {
- TRY_TO_STORE(DrawPath, paint, path);
-}
-
-bool SkMiniRecorder::drawTextBlob(const SkTextBlob* b, SkScalar x, SkScalar y, const SkPaint& p) {
- TRY_TO_STORE(DrawTextBlob, p, sk_ref_sp(b), x, y);
-}
-#undef TRY_TO_STORE
-
-
-sk_sp<SkPicture> SkMiniRecorder::detachAsPicture(const SkRect* cull) {
-#define CASE(T) \
- case State::k##T: { \
- T* op = reinterpret_cast<T*>(fBuffer); \
- auto pic = sk_make_sp<SkMiniPicture<T>>(cull, std::move(*op)); \
- op->~T(); \
- fState = State::kEmpty; \
- return std::move(pic); \
- }
-
- static SkOnce once;
- static SkPicture* empty;
-
- switch (fState) {
- case State::kEmpty:
- once([]{ empty = new SkEmptyPicture; });
- return sk_ref_sp(empty);
- CASE(DrawPath)
- CASE(DrawRect)
- CASE(DrawTextBlob)
- }
- SkASSERT(false);
- return nullptr;
-#undef CASE
-}
-
-void SkMiniRecorder::flushAndReset(SkCanvas* canvas) {
-#define CASE(Type) \
- case State::k##Type: { \
- fState = State::kEmpty; \
- Type* op = reinterpret_cast<Type*>(fBuffer); \
- SkRecords::Draw(canvas, nullptr, nullptr, 0, nullptr)(*op); \
- op->~Type(); \
- } return
-
- switch (fState) {
- case State::kEmpty: return;
- CASE(DrawPath);
- CASE(DrawRect);
- CASE(DrawTextBlob);
- }
- SkASSERT(false);
-#undef CASE
-}
diff --git a/chromium/third_party/skia/src/core/SkMiniRecorder.h b/chromium/third_party/skia/src/core/SkMiniRecorder.h
deleted file mode 100644
index dab5648125d..00000000000
--- a/chromium/third_party/skia/src/core/SkMiniRecorder.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkMiniRecorder_DEFINED
-#define SkMiniRecorder_DEFINED
-
-#include "include/core/SkScalar.h"
-#include "include/core/SkTypes.h"
-#include "include/private/SkNoncopyable.h"
-#include "src/core/SkRecords.h"
-class SkCanvas;
-
-// Records small pictures, but only a limited subset of the canvas API, and may fail.
-class SkMiniRecorder : SkNoncopyable {
-public:
- SkMiniRecorder();
- ~SkMiniRecorder();
-
- // Try to record an op. Returns false on failure.
- bool drawPath(const SkPath&, const SkPaint&);
- bool drawRect(const SkRect&, const SkPaint&);
- bool drawTextBlob(const SkTextBlob*, SkScalar x, SkScalar y, const SkPaint&);
-
- // Detach anything we've recorded as a picture, resetting this SkMiniRecorder.
- // If cull is nullptr we'll calculate it.
- sk_sp<SkPicture> detachAsPicture(const SkRect* cull);
-
- // Flush anything we've recorded to the canvas, resetting this SkMiniRecorder.
- // This is logically the same as but rather more efficient than:
- // sk_sp<SkPicture> pic(this->detachAsPicture(nullptr));
- // pic->playback(canvas);
- void flushAndReset(SkCanvas*);
-
-private:
- enum class State {
- kEmpty,
- kDrawPath,
- kDrawRect,
- kDrawTextBlob,
- };
-
- State fState;
-
- template <size_t A, size_t B>
- struct Max { static const size_t val = A > B ? A : B; };
-
- static const size_t kInlineStorage =
- Max<sizeof(SkRecords::DrawPath),
- Max<sizeof(SkRecords::DrawRect),
- sizeof(SkRecords::DrawTextBlob)>::val>::val;
- alignas(void*) alignas(double) char fBuffer[kInlineStorage];
-};
-
-#endif//SkMiniRecorder_DEFINED
diff --git a/chromium/third_party/skia/src/core/SkModeColorFilter.cpp b/chromium/third_party/skia/src/core/SkModeColorFilter.cpp
index bfe3db23463..c47a0f06ed8 100644
--- a/chromium/third_party/skia/src/core/SkModeColorFilter.cpp
+++ b/chromium/third_party/skia/src/core/SkModeColorFilter.cpp
@@ -6,31 +6,70 @@
*/
#include "include/core/SkColorFilter.h"
-#include "include/core/SkString.h"
#include "include/private/SkColorData.h"
-#include "include/utils/SkRandom.h"
#include "src/core/SkArenaAlloc.h"
#include "src/core/SkBlendModePriv.h"
#include "src/core/SkBlitRow.h"
+#include "src/core/SkColorFilterBase.h"
#include "src/core/SkColorSpacePriv.h"
#include "src/core/SkColorSpaceXformSteps.h"
-#include "src/core/SkModeColorFilter.h"
#include "src/core/SkRasterPipeline.h"
#include "src/core/SkReadBuffer.h"
#include "src/core/SkVM.h"
#include "src/core/SkValidationUtils.h"
#include "src/core/SkWriteBuffer.h"
+template <SkAlphaType kDstAT = kPremul_SkAlphaType>
+static SkRGBA4f<kDstAT> map_color(const SkColor4f& c, SkColorSpace* src, SkColorSpace* dst) {
+ SkRGBA4f<kDstAT> color = {c.fR, c.fG, c.fB, c.fA};
+ SkColorSpaceXformSteps(src, kUnpremul_SkAlphaType,
+ dst, kDstAT).apply(color.vec());
+ return color;
+}
+
//////////////////////////////////////////////////////////////////////////////////////////////////
-SkModeColorFilter::SkModeColorFilter(SkColor color, SkBlendMode mode) {
- fColor = color;
- fMode = mode;
-}
+class SkModeColorFilter final : public SkColorFilterBase {
+public:
+ SkModeColorFilter(const SkColor4f& color, SkBlendMode mode);
+
+ bool onIsAlphaUnchanged() const override;
+
+#if SK_SUPPORT_GPU
+ GrFPResult asFragmentProcessor(std::unique_ptr<GrFragmentProcessor> inputFP,
+ GrRecordingContext*,
+ const GrColorInfo&,
+ const SkSurfaceProps&) const override;
+#endif
+#ifdef SK_ENABLE_SKSL
+ void addToKey(const SkKeyContext&,
+ SkPaintParamsKeyBuilder*,
+ SkPipelineDataGatherer*) const override;
+#endif
+
+private:
+ friend void ::SkRegisterModeColorFilterFlattenable();
+ SK_FLATTENABLE_HOOKS(SkModeColorFilter)
+
+ void flatten(SkWriteBuffer&) const override;
+ bool onAsAColorMode(SkColor*, SkBlendMode*) const override;
+
+ bool onAppendStages(const SkStageRec& rec, bool shaderIsOpaque) const override;
+ skvm::Color onProgram(skvm::Builder*, skvm::Color,
+ const SkColorInfo&, skvm::Uniforms*, SkArenaAlloc*) const override;
+
+ SkColor4f fColor; // always stored in sRGB
+ SkBlendMode fMode;
+};
+
+SkModeColorFilter::SkModeColorFilter(const SkColor4f& color,
+ SkBlendMode mode)
+ : fColor(color)
+ , fMode(mode) {}
bool SkModeColorFilter::onAsAColorMode(SkColor* color, SkBlendMode* mode) const {
if (color) {
- *color = fColor;
+ *color = fColor.toSkColor();
}
if (mode) {
*mode = fMode;
@@ -50,22 +89,29 @@ bool SkModeColorFilter::onIsAlphaUnchanged() const {
}
void SkModeColorFilter::flatten(SkWriteBuffer& buffer) const {
- buffer.writeColor(fColor);
- buffer.writeUInt((int)fMode);
+ buffer.writeColor4f(fColor);
+ buffer.writeUInt((int) fMode);
}
sk_sp<SkFlattenable> SkModeColorFilter::CreateProc(SkReadBuffer& buffer) {
- SkColor color = buffer.readColor();
- SkBlendMode mode = (SkBlendMode)buffer.readUInt();
- return SkColorFilters::Blend(color, mode);
+ if (buffer.isVersionLT(SkPicturePriv::kBlend4fColorFilter)) {
+ // Color is 8-bit, sRGB
+ SkColor color = buffer.readColor();
+ SkBlendMode mode = (SkBlendMode)buffer.readUInt();
+ return SkColorFilters::Blend(SkColor4f::FromColor(color), /*sRGB*/nullptr, mode);
+ } else {
+ // Color is 32-bit, sRGB
+ SkColor4f color;
+ buffer.readColor4f(&color);
+ SkBlendMode mode = (SkBlendMode)buffer.readUInt();
+ return SkColorFilters::Blend(color, /*sRGB*/nullptr, mode);
+ }
}
bool SkModeColorFilter::onAppendStages(const SkStageRec& rec, bool shaderIsOpaque) const {
rec.fPipeline->append(SkRasterPipeline::move_src_dst);
- SkColor4f color = SkColor4f::FromColor(fColor);
- SkColorSpaceXformSteps(sk_srgb_singleton(), kUnpremul_SkAlphaType,
- rec.fDstCS, kUnpremul_SkAlphaType).apply(color.vec());
- rec.fPipeline->append_constant_color(rec.fAlloc, color.premul().vec());
+ SkPMColor4f color = map_color(fColor, sk_srgb_singleton(), rec.fDstCS);
+ rec.fPipeline->append_constant_color(rec.fAlloc, color.vec());
SkBlendMode_AppendStages(fMode, rec.fPipeline);
return true;
}
@@ -73,24 +119,25 @@ bool SkModeColorFilter::onAppendStages(const SkStageRec& rec, bool shaderIsOpaqu
skvm::Color SkModeColorFilter::onProgram(skvm::Builder* p, skvm::Color c,
const SkColorInfo& dstInfo,
skvm::Uniforms* uniforms, SkArenaAlloc*) const {
- SkColor4f color = SkColor4f::FromColor(fColor);
- SkColorSpaceXformSteps( sk_srgb_singleton(), kUnpremul_SkAlphaType,
- dstInfo.colorSpace(), kPremul_SkAlphaType).apply(color.vec());
+ SkPMColor4f color = map_color(fColor, sk_srgb_singleton(), dstInfo.colorSpace());
+ // The blend program operates on this as if it were premul but the API takes an SkColor4f
skvm::Color dst = c,
- src = p->uniformColor(color, uniforms);
+ src = p->uniformColor({color.fR, color.fG, color.fB, color.fA}, uniforms);
return p->blend(fMode, src,dst);
}
///////////////////////////////////////////////////////////////////////////////
#if SK_SUPPORT_GPU
#include "src/gpu/Blend.h"
+#include "src/gpu/ganesh/GrColorInfo.h"
#include "src/gpu/ganesh/GrFragmentProcessor.h"
#include "src/gpu/ganesh/SkGr.h"
#include "src/gpu/ganesh/effects/GrBlendFragmentProcessor.h"
GrFPResult SkModeColorFilter::asFragmentProcessor(std::unique_ptr<GrFragmentProcessor> inputFP,
GrRecordingContext*,
- const GrColorInfo& dstColorInfo) const {
+ const GrColorInfo& dstColorInfo,
+ const SkSurfaceProps& props) const {
if (fMode == SkBlendMode::kDst) {
// If the blend mode is "dest," the blend color won't factor into it at all.
// We can return the input FP as-is.
@@ -99,7 +146,9 @@ GrFPResult SkModeColorFilter::asFragmentProcessor(std::unique_ptr<GrFragmentProc
SkDEBUGCODE(const bool fpHasConstIO = !inputFP || inputFP->hasConstantOutputForConstantInput();)
- auto colorFP = GrFragmentProcessor::MakeColor(SkColorToPMColor4f(fColor, dstColorInfo));
+ SkPMColor4f color = map_color(fColor, sk_srgb_singleton(), dstColorInfo.colorSpace());
+
+ auto colorFP = GrFragmentProcessor::MakeColor(color);
auto xferFP = GrBlendFragmentProcessor::Make(std::move(colorFP), std::move(inputFP), fMode);
if (xferFP == nullptr) {
@@ -121,40 +170,71 @@ GrFPResult SkModeColorFilter::asFragmentProcessor(std::unique_ptr<GrFragmentProc
#endif
+#ifdef SK_ENABLE_SKSL
+
+#include "src/core/SkKeyHelpers.h"
+#include "src/core/SkPaintParamsKey.h"
+
+void SkModeColorFilter::addToKey(const SkKeyContext& keyContext,
+ SkPaintParamsKeyBuilder* builder,
+ SkPipelineDataGatherer* gatherer) const {
+ // TODO: Take into account the render target color space once graphite has color management.
+ SkPMColor4f color = map_color(fColor, sk_srgb_singleton(), nullptr);
+ BlendColorFilterBlock::BlendColorFilterData data(fMode, color);
+
+ BlendColorFilterBlock::BeginBlock(keyContext, builder, gatherer, data);
+ builder->endBlock();
+}
+
+#endif
+
///////////////////////////////////////////////////////////////////////////////
-sk_sp<SkColorFilter> SkColorFilters::Blend(SkColor color, SkBlendMode mode) {
+sk_sp<SkColorFilter> SkColorFilters::Blend(const SkColor4f& color,
+ sk_sp<SkColorSpace> colorSpace,
+ SkBlendMode mode) {
if (!SkIsValidMode(mode)) {
return nullptr;
}
- unsigned alpha = SkColorGetA(color);
-
- // first collaps some modes if possible
+ // First map to sRGB to simplify storage in the actual SkColorFilter instance, staying unpremul
+ // until the final dst color space is known when actually filtering.
+ SkColor4f srgb = map_color<kUnpremul_SkAlphaType>(
+ color, colorSpace.get(), sk_srgb_singleton());
+ // Next collapse some modes if possible
+ float alpha = srgb.fA;
if (SkBlendMode::kClear == mode) {
- color = 0;
+ srgb = SkColors::kTransparent;
mode = SkBlendMode::kSrc;
} else if (SkBlendMode::kSrcOver == mode) {
- if (0 == alpha) {
+ if (0.f == alpha) {
mode = SkBlendMode::kDst;
- } else if (255 == alpha) {
+ } else if (1.f == alpha) {
mode = SkBlendMode::kSrc;
}
// else just stay srcover
}
- // weed out combinations that are noops, and just return null
+ // Finally weed out combinations that are noops, and just return null
if (SkBlendMode::kDst == mode ||
- (0 == alpha && (SkBlendMode::kSrcOver == mode ||
- SkBlendMode::kDstOver == mode ||
- SkBlendMode::kDstOut == mode ||
- SkBlendMode::kSrcATop == mode ||
- SkBlendMode::kXor == mode ||
- SkBlendMode::kDarken == mode)) ||
- (0xFF == alpha && SkBlendMode::kDstIn == mode)) {
+ (0.f == alpha && (SkBlendMode::kSrcOver == mode ||
+ SkBlendMode::kDstOver == mode ||
+ SkBlendMode::kDstOut == mode ||
+ SkBlendMode::kSrcATop == mode ||
+ SkBlendMode::kXor == mode ||
+ SkBlendMode::kDarken == mode)) ||
+ (1.f == alpha && SkBlendMode::kDstIn == mode)) {
return nullptr;
}
- return SkModeColorFilter::Make(color, mode);
+ return sk_sp<SkColorFilter>(new SkModeColorFilter(srgb, mode));
+}
+
+sk_sp<SkColorFilter> SkColorFilters::Blend(SkColor color, SkBlendMode mode) {
+ return Blend(SkColor4f::FromColor(color), /*sRGB*/nullptr, mode);
+}
+
+void SkRegisterModeColorFilterFlattenable() {
+ SK_REGISTER_FLATTENABLE(SkModeColorFilter);
}
diff --git a/chromium/third_party/skia/src/core/SkModeColorFilter.h b/chromium/third_party/skia/src/core/SkModeColorFilter.h
deleted file mode 100644
index c66f0b49e65..00000000000
--- a/chromium/third_party/skia/src/core/SkModeColorFilter.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkModeColorFilter_DEFINED
-#define SkModeColorFilter_DEFINED
-
-#include "src/core/SkColorFilterBase.h"
-
-class SkModeColorFilter : public SkColorFilterBase {
-public:
- static sk_sp<SkColorFilter> Make(SkColor color, SkBlendMode mode) {
- return sk_sp<SkColorFilter>(new SkModeColorFilter(color, mode));
- }
-
- bool onIsAlphaUnchanged() const override;
-
-#if SK_SUPPORT_GPU
- GrFPResult asFragmentProcessor(std::unique_ptr<GrFragmentProcessor> inputFP,
- GrRecordingContext*, const GrColorInfo&) const override;
-#endif
-
- SK_FLATTENABLE_HOOKS(SkModeColorFilter)
-
-protected:
- SkModeColorFilter(SkColor color, SkBlendMode mode);
-
- void flatten(SkWriteBuffer&) const override;
- bool onAsAColorMode(SkColor*, SkBlendMode*) const override;
-
- bool onAppendStages(const SkStageRec& rec, bool shaderIsOpaque) const override;
- skvm::Color onProgram(skvm::Builder*, skvm::Color,
- const SkColorInfo&, skvm::Uniforms*, SkArenaAlloc*) const override;
-
-private:
- SkColor fColor;
- SkBlendMode fMode;
-
- friend class SkColorFilter;
-
- using INHERITED = SkColorFilterBase;
-};
-
-#endif
diff --git a/chromium/third_party/skia/src/core/SkOverdrawCanvas.cpp b/chromium/third_party/skia/src/core/SkOverdrawCanvas.cpp
index b29dc3b3499..6acda990b9f 100644
--- a/chromium/third_party/skia/src/core/SkOverdrawCanvas.cpp
+++ b/chromium/third_party/skia/src/core/SkOverdrawCanvas.cpp
@@ -17,12 +17,12 @@
#include "src/core/SkDevice.h"
#include "src/core/SkDrawShadowInfo.h"
#include "src/core/SkGlyphBuffer.h"
-#include "src/core/SkGlyphRun.h"
#include "src/core/SkGlyphRunPainter.h"
#include "src/core/SkImagePriv.h"
#include "src/core/SkLatticeIter.h"
#include "src/core/SkStrikeCache.h"
#include "src/core/SkTextBlobPriv.h"
+#include "src/text/GlyphRun.h"
#include "src/utils/SkPatchUtils.h"
SkOverdrawCanvas::SkOverdrawCanvas(SkCanvas* canvas)
@@ -65,7 +65,7 @@ public:
const SkSamplingOptions&, const SkPaint&) const override {}
void onDrawGlyphRunList(SkCanvas* canvas,
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
const SkPaint& initialPaint,
const SkPaint& drawingPaint) override {
SkASSERT(!glyphRunList.hasRSXForm());
@@ -81,13 +81,13 @@ private:
void SkOverdrawCanvas::onDrawTextBlob(
const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint) {
- SkGlyphRunBuilder b;
+ sktext::GlyphRunBuilder b;
auto glyphRunList = b.blobToGlyphRunList(*blob, {x, y});
this->onDrawGlyphRunList(glyphRunList, paint);
}
void SkOverdrawCanvas::onDrawGlyphRunList(
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
const SkPaint& paint) {
SkSurfaceProps props{0, kUnknown_SkPixelGeometry};
this->getProps(&props);
diff --git a/chromium/third_party/skia/src/core/SkPaintParamsKey.cpp b/chromium/third_party/skia/src/core/SkPaintParamsKey.cpp
index abf36acf07a..d73a2a853c7 100644
--- a/chromium/third_party/skia/src/core/SkPaintParamsKey.cpp
+++ b/chromium/third_party/skia/src/core/SkPaintParamsKey.cpp
@@ -11,12 +11,26 @@
#include "src/core/SkKeyHelpers.h"
#include "src/core/SkShaderCodeDictionary.h"
+using DataPayloadType = SkPaintParamsKey::DataPayloadType;
+using DataPayloadField = SkPaintParamsKey::DataPayloadField;
+
+//--------------------------------------------------------------------------------------------------
+static SkPaintParamsKey::Header read_header(SkSpan<const uint8_t> parentSpan, int headerOffset) {
+ SkASSERT(headerOffset + sizeof(SkPaintParamsKey::Header) <= parentSpan.size());
+
+ SkPaintParamsKey::Header header;
+ memcpy(&header, &parentSpan[headerOffset], sizeof(SkPaintParamsKey::Header));
+ SkASSERT(header.blockSize >= sizeof(SkPaintParamsKey::Header));
+ SkASSERT(headerOffset + header.blockSize <= static_cast<int>(parentSpan.size()));
+
+ return header;
+}
+
//--------------------------------------------------------------------------------------------------
SkPaintParamsKeyBuilder::SkPaintParamsKeyBuilder(const SkShaderCodeDictionary* dict,
SkBackend backend)
: fDict(dict)
- , fBackend(backend) {
-}
+ , fBackend(backend) {}
#ifdef SK_DEBUG
void SkPaintParamsKeyBuilder::checkReset() {
@@ -31,10 +45,10 @@ void SkPaintParamsKeyBuilder::checkReset() {
#endif
// Block headers have the following structure:
-// 1st byte: codeSnippetID
-// 2nd byte: total blockSize in bytes
+// 4 bytes: code-snippet ID
+// 1 byte: size of the block, in bytes (header, plus all data payload bytes)
// This call stores the header's offset in the key on the stack to be used in 'endBlock'
-void SkPaintParamsKeyBuilder::beginBlock(int codeSnippetID) {
+void SkPaintParamsKeyBuilder::beginBlock(int32_t codeSnippetID) {
if (!this->isValid()) {
return;
}
@@ -52,12 +66,12 @@ void SkPaintParamsKeyBuilder::beginBlock(int codeSnippetID) {
fStack.back().fNumActualChildren++;
}
- static const SkPaintParamsKey::DataPayloadField kHeader[2] = {
- {"snippetID", SkPaintParamsKey::DataPayloadType::kByte, 1},
- {"blockSize", SkPaintParamsKey::DataPayloadType::kByte, 1},
+ static constexpr DataPayloadField kHeader[2] = {
+ {"snippetID", DataPayloadType::kInt, 1},
+ {"blockSize", DataPayloadType::kByte, 1},
};
- static const SkSpan<const SkPaintParamsKey::DataPayloadField> kHeaderExpectations(kHeader, 2);
+ static const SkSpan<const DataPayloadField> kHeaderExpectations(kHeader);
#endif
SkASSERT(!this->isLocked());
@@ -65,13 +79,15 @@ void SkPaintParamsKeyBuilder::beginBlock(int codeSnippetID) {
fStack.push_back({ codeSnippetID, this->sizeInBytes(),
SkDEBUGCODE(kHeaderExpectations, 0) });
- this->addByte(SkTo<uint8_t>(codeSnippetID));
- this->addByte(0); // this needs to be patched up with a call to endBlock
+ this->addInt(codeSnippetID);
+ this->addByte(0); // this will be filled in when endBlock is called
#ifdef SK_DEBUG
- fStack.back().fDataPayloadExpectations = fDict->dataPayloadExpectations(codeSnippetID);
+ const SkShaderSnippet* snippet = fDict->getEntry(codeSnippetID);
+
+ fStack.back().fDataPayloadExpectations = snippet->fDataPayloadExpectations;
fStack.back().fCurDataPayloadEntry = 0;
- fStack.back().fNumExpectedChildren = fDict->getEntry(codeSnippetID)->fNumChildren;
+ fStack.back().fNumExpectedChildren = snippet->fNumChildren;
fStack.back().fNumActualChildren = 0;
#endif
}
@@ -96,8 +112,13 @@ void SkPaintParamsKeyBuilder::endBlock() {
int headerOffset = fStack.back().fHeaderOffset;
- SkASSERT(fData[headerOffset] == fStack.back().fCodeSnippetID);
- SkASSERT(fData[headerOffset+SkPaintParamsKey::kBlockSizeOffsetInBytes] == 0);
+#ifdef SK_DEBUG
+ // We don't use `read_header` here because the header block size isn't valid yet.
+ SkPaintParamsKey::Header header;
+ memcpy(&header, &fData[headerOffset], sizeof(SkPaintParamsKey::Header));
+ SkASSERT(header.codeSnippetID == fStack.back().fCodeSnippetID);
+ SkASSERT(header.blockSize == 0);
+#endif
int blockSize = this->sizeInBytes() - headerOffset;
if (blockSize > SkPaintParamsKey::kMaxBlockSize) {
@@ -106,7 +127,7 @@ void SkPaintParamsKeyBuilder::endBlock() {
return;
}
- fData[headerOffset+SkPaintParamsKey::kBlockSizeOffsetInBytes] = blockSize;
+ fData[headerOffset + SkPaintParamsKey::kBlockSizeOffsetInBytes] = blockSize;
fStack.pop();
@@ -119,23 +140,31 @@ void SkPaintParamsKeyBuilder::endBlock() {
}
#ifdef SK_DEBUG
-void SkPaintParamsKeyBuilder::checkExpectations(SkPaintParamsKey::DataPayloadType actualType,
- uint32_t actualCount) {
- const StackFrame& frame = fStack.back();
+void SkPaintParamsKeyBuilder::checkExpectations(DataPayloadType actualType, uint32_t actualCount) {
+ StackFrame& frame = fStack.back();
const auto& expectations = frame.fDataPayloadExpectations;
// TODO: right now we reject writing 'n' bytes one at a time. We could allow it by tracking
// the number of bytes written in the stack frame.
- SkASSERT(frame.fCurDataPayloadEntry < SkTo<int>(expectations.size()) &&
- expectations.data() &&
- expectations[frame.fCurDataPayloadEntry].fType == actualType &&
- expectations[frame.fCurDataPayloadEntry].fCount == actualCount);
+ SkASSERT(expectations[frame.fCurDataPayloadEntry].fType == actualType);
+ SkASSERT(expectations[frame.fCurDataPayloadEntry].fCount == actualCount);
- fStack.back().fCurDataPayloadEntry++;
+ frame.fCurDataPayloadEntry++;
}
#endif // SK_DEBUG
-void SkPaintParamsKeyBuilder::addBytes(uint32_t numBytes, const uint8_t* data) {
+static int field_size(DataPayloadType type) {
+ switch (type) {
+ case DataPayloadType::kByte: return 1;
+ case DataPayloadType::kInt: return 4;
+ case DataPayloadType::kFloat4: return 16;
+ }
+ SkUNREACHABLE;
+}
+
+void SkPaintParamsKeyBuilder::addToKey(uint32_t count,
+ const void* data,
+ DataPayloadType payloadType) {
if (!this->isValid()) {
return;
}
@@ -146,27 +175,22 @@ void SkPaintParamsKeyBuilder::addBytes(uint32_t numBytes, const uint8_t* data) {
return;
}
- SkDEBUGCODE(this->checkExpectations(SkPaintParamsKey::DataPayloadType::kByte, numBytes);)
+ SkDEBUGCODE(this->checkExpectations(payloadType, count);)
SkASSERT(!this->isLocked());
- fData.append(numBytes, data);
+ fData.append(field_size(payloadType) * count, reinterpret_cast<const uint8_t*>(data));
}
-void SkPaintParamsKeyBuilder::add(const SkColor4f& color) {
- if (!this->isValid()) {
- return;
- }
-
- if (fStack.empty()) {
- // SKGPU_LOG_W("Missing call to 'beginBlock'.");
- this->makeInvalid();
- return;
- }
+void SkPaintParamsKeyBuilder::addBytes(uint32_t numBytes, const uint8_t* data) {
+ this->addToKey(numBytes, data, DataPayloadType::kByte);
+}
- SkDEBUGCODE(this->checkExpectations(SkPaintParamsKey::DataPayloadType::kFloat4, 1);)
- SkASSERT(!this->isLocked());
+void SkPaintParamsKeyBuilder::addInts(uint32_t numInts, const int32_t* data) {
+ this->addToKey(numInts, data, DataPayloadType::kInt);
+}
- fData.append(16, reinterpret_cast<const uint8_t*>(&color));
+void SkPaintParamsKeyBuilder::add(int numColors, const SkColor4f* colors) {
+ this->addToKey(numColors, colors, DataPayloadType::kFloat4);
}
SkPaintParamsKey SkPaintParamsKeyBuilder::lockAsKey() {
@@ -182,7 +206,7 @@ SkPaintParamsKey SkPaintParamsKeyBuilder::lockAsKey() {
fIsValid = true;
fStack.rewind();
- return SkPaintParamsKey(SkMakeSpan(fData.begin(), fData.count()), this);
+ return SkPaintParamsKey(SkSpan(fData.begin(), fData.count()), this);
}
void SkPaintParamsKeyBuilder::makeInvalid() {
@@ -237,19 +261,19 @@ void SkPaintParamsKey::dump(const SkShaderCodeDictionary* dict) const {
int curHeaderOffset = 0;
while (curHeaderOffset < this->sizeInBytes()) {
BlockReader reader = this->reader(dict, curHeaderOffset);
- reader.dump(dict, /* indent */ 0);
+ reader.dump(dict, /*indent=*/0);
curHeaderOffset += reader.blockSize();
}
}
#endif // SK_DEBUG
-void SkPaintParamsKey::AddBlockToShaderInfo(SkShaderCodeDictionary* dict,
+void SkPaintParamsKey::AddBlockToShaderInfo(const SkShaderCodeDictionary* dict,
const SkPaintParamsKey::BlockReader& reader,
SkShaderInfo* result) {
result->add(reader);
#ifdef SK_GRAPHITE_ENABLED
- result->addFlags(dict->getSnippetRequirementFlags(reader.codeSnippetId()));
+ result->addFlags(dict->getEntry(reader.codeSnippetId())->fSnippetRequirementFlags);
#endif
// The child blocks appear right after the parent block's header in the key and go
@@ -261,7 +285,8 @@ void SkPaintParamsKey::AddBlockToShaderInfo(SkShaderCodeDictionary* dict,
}
}
-void SkPaintParamsKey::toShaderInfo(SkShaderCodeDictionary* dict, SkShaderInfo* result) const {
+void SkPaintParamsKey::toShaderInfo(const SkShaderCodeDictionary* dict,
+ SkShaderInfo* result) const {
int curHeaderOffset = 0;
while (curHeaderOffset < this->sizeInBytes()) {
@@ -273,46 +298,24 @@ void SkPaintParamsKey::toShaderInfo(SkShaderCodeDictionary* dict, SkShaderInfo*
#if GR_TEST_UTILS
bool SkPaintParamsKey::isErrorKey() const {
- return this->sizeInBytes() == SkPaintParamsKey::kBlockHeaderSizeInBytes &&
- fData[0] == static_cast<int>(SkBuiltInCodeSnippetID::kError) &&
- fData[1] == SkPaintParamsKey::kBlockHeaderSizeInBytes;
-}
-#endif
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-namespace {
-
-#ifdef SK_DEBUG
-void output_indent(int indent) {
- for (int i = 0; i < indent; ++i) {
- SkDebugf(" ");
+ if (this->sizeInBytes() != sizeof(Header)) {
+ return false;
}
+ Header header = read_header(this->asSpan(), /*headerOffset=*/0);
+ return header.codeSnippetID == (int32_t)SkBuiltInCodeSnippetID::kError &&
+ header.blockSize == sizeof(Header);
}
#endif
-std::pair<SkBuiltInCodeSnippetID, uint8_t> read_header(SkSpan<const uint8_t> parentSpan,
- int headerOffset) {
- SkASSERT(headerOffset + SkPaintParamsKey::kBlockHeaderSizeInBytes <=
- SkTo<int>(parentSpan.size()));
-
- SkBuiltInCodeSnippetID id = static_cast<SkBuiltInCodeSnippetID>(parentSpan[headerOffset]);
- uint8_t blockSize = parentSpan[headerOffset+SkPaintParamsKey::kBlockSizeOffsetInBytes];
- SkASSERT(blockSize >= SkPaintParamsKey::kBlockHeaderSizeInBytes);
- SkASSERT(headerOffset + blockSize <= static_cast<int>(parentSpan.size()));
-
- return { id, blockSize };
-}
-
-} // anonymous namespace
+////////////////////////////////////////////////////////////////////////////////////////////////////
SkPaintParamsKey::BlockReader::BlockReader(const SkShaderCodeDictionary* dict,
SkSpan<const uint8_t> parentSpan,
int offsetInParent) {
- auto [codeSnippetID, blockSize] = read_header(parentSpan, offsetInParent);
+ Header header = read_header(parentSpan, offsetInParent);
- fBlock = parentSpan.subspan(offsetInParent, blockSize);
- fEntry = dict->getEntry(codeSnippetID);
+ fBlock = parentSpan.subspan(offsetInParent, header.blockSize);
+ fEntry = dict->getEntry(header.codeSnippetID);
SkASSERT(fEntry);
}
@@ -323,38 +326,66 @@ SkPaintParamsKey::BlockReader SkPaintParamsKey::BlockReader::child(
int childIndex) const {
SkASSERT(childIndex < fEntry->fNumChildren);
- int childOffset = kBlockHeaderSizeInBytes;
+ int childOffset = sizeof(Header);
for (int i = 0; i < childIndex; ++i) {
- auto [_, childBlockSize] = read_header(fBlock, childOffset);
- childOffset += childBlockSize;
+ Header header = read_header(fBlock, childOffset);
+ childOffset += header.blockSize;
}
return BlockReader(dict, fBlock, childOffset);
}
+int32_t SkPaintParamsKey::BlockReader::codeSnippetId() const {
+ Header header = read_header(fBlock, 0);
+ return header.codeSnippetID;
+}
+
SkSpan<const uint8_t> SkPaintParamsKey::BlockReader::dataPayload() const {
- int payloadOffset = kBlockHeaderSizeInBytes;
+ int payloadOffset = sizeof(Header);
for (int i = 0; i < fEntry->fNumChildren; ++i) {
- auto [_, childBlockSize] = read_header(fBlock, payloadOffset);
- payloadOffset += childBlockSize;
+ Header header = read_header(fBlock, payloadOffset);
+ payloadOffset += header.blockSize;
}
int payloadSize = this->blockSize() - payloadOffset;
return fBlock.subspan(payloadOffset, payloadSize);
}
+static int field_offset(SkSpan<const DataPayloadField> fields, int fieldIndex) {
+ int byteOffset = 0;
+ for (int i = 0; i < fieldIndex; ++i) {
+ byteOffset += field_size(fields[i].fType) * fields[i].fCount;
+ }
+ return byteOffset;
+}
+
+template <typename T>
+static SkSpan<const T> payload_subspan_for_field(SkSpan<const uint8_t> dataPayload,
+ SkSpan<const DataPayloadField> fields,
+ int fieldIndex) {
+ int offset = field_offset(fields, fieldIndex);
+ return {reinterpret_cast<const T*>(&dataPayload[offset]), fields[fieldIndex].fCount};
+}
+
SkSpan<const uint8_t> SkPaintParamsKey::BlockReader::bytes(int fieldIndex) const {
SkASSERT(fEntry->fDataPayloadExpectations[fieldIndex].fType == DataPayloadType::kByte);
+ return payload_subspan_for_field<uint8_t>(this->dataPayload(),
+ fEntry->fDataPayloadExpectations,
+ fieldIndex);
+}
- int byteOffsetInPayload = 0;
- for (int i = 0; i < fieldIndex; ++i) {
- SkASSERT(fEntry->fDataPayloadExpectations[i].fType == DataPayloadType::kByte);
- byteOffsetInPayload += fEntry->fDataPayloadExpectations[i].fCount;
- }
+SkSpan<const int32_t> SkPaintParamsKey::BlockReader::ints(int fieldIndex) const {
+ SkASSERT(fEntry->fDataPayloadExpectations[fieldIndex].fType == DataPayloadType::kInt);
+ return payload_subspan_for_field<int32_t>(this->dataPayload(),
+ fEntry->fDataPayloadExpectations,
+ fieldIndex);
+}
- SkSpan<const uint8_t> dataPayload = this->dataPayload();
- return dataPayload.subspan(byteOffsetInPayload,
- fEntry->fDataPayloadExpectations[fieldIndex].fCount);
+SkSpan<const SkColor4f> SkPaintParamsKey::BlockReader::colors(int fieldIndex) const {
+ SkASSERT(fEntry->fDataPayloadExpectations[fieldIndex].fType == DataPayloadType::kFloat4);
+ return payload_subspan_for_field<SkColor4f>(this->dataPayload(),
+ fEntry->fDataPayloadExpectations,
+ fieldIndex);
}
#ifdef SK_DEBUG
@@ -363,6 +394,10 @@ int SkPaintParamsKey::BlockReader::numDataPayloadFields() const {
return fEntry->fDataPayloadExpectations.size();
}
+static void output_indent(int indent) {
+ SkDebugf("%*c", 4 * indent, ' ');
+}
+
void SkPaintParamsKey::BlockReader::dump(const SkShaderCodeDictionary* dict, int indent) const {
uint8_t id = static_cast<uint8_t>(this->codeSnippetId());
uint8_t blockSize = this->blockSize();
diff --git a/chromium/third_party/skia/src/core/SkPaintParamsKey.h b/chromium/third_party/skia/src/core/SkPaintParamsKey.h
index 6315ded1bb2..f847c1afb4f 100644
--- a/chromium/third_party/skia/src/core/SkPaintParamsKey.h
+++ b/chromium/third_party/skia/src/core/SkPaintParamsKey.h
@@ -11,6 +11,7 @@
#include "include/core/SkColor.h"
#include "include/core/SkSpan.h"
#include "include/core/SkTypes.h"
+#include "include/private/SkMacros.h"
#include "include/private/SkTDArray.h"
#include "src/core/SkBuiltInCodeSnippetID.h"
@@ -33,20 +34,27 @@ struct SkShaderSnippet;
// This class is a compact representation of the shader needed to implement a given
// PaintParams. Its structure is a series of blocks where each block has a
-// header that consists of 2-bytes:
-// a 1-byte code-snippet ID
-// a 1-byte number-of-bytes-in-the-block field (incl. the space for the header)
+// Header, consisting of 2 bytes:
+// 4 bytes: code-snippet ID
+// 1 byte: size of the block, in bytes (header, plus all data payload bytes)
// The rest of the data in the block is dependent on the individual code snippet.
-// If a given block has child blocks, they appear in the key right after their
-// parent block's header.
+// If a given block has child blocks, they appear in the key right after their parent
+// block's header.
class SkPaintParamsKey {
public:
- static const int kBlockHeaderSizeInBytes = 2;
- static const int kBlockSizeOffsetInBytes = 1; // offset to the block size w/in the header
+ #pragma pack(push, 1)
+ struct Header {
+ int32_t codeSnippetID;
+ uint8_t blockSize;
+ };
+ #pragma pack(pop)
+
+ static const int kBlockSizeOffsetInBytes = offsetof(Header, blockSize);
static const int kMaxBlockSize = std::numeric_limits<uint8_t>::max();
enum class DataPayloadType {
kByte,
+ kInt,
kFloat4,
};
@@ -63,6 +71,7 @@ public:
class BlockReader {
public:
+ // Returns the combined size of the header, all children, and every data payload.
uint8_t blockSize() const {
SkASSERT(fBlock[kBlockSizeOffsetInBytes] == fBlock.size());
return SkTo<uint8_t>(fBlock.size());
@@ -70,13 +79,17 @@ public:
int numChildren() const;
+ // Returns the code-snippet ID of this block.
+ int32_t codeSnippetId() const;
+
// Return the childIndex-th child's BlockReader
BlockReader child(const SkShaderCodeDictionary*, int childIndex) const;
- // Retrieve the fieldIndex-th field in the data payload as a span of bytes. The type
- // being read (bytes in this case) is checked against the data payload's structure.
+ // Retrieve the fieldIndex-th field in the data payload as a span. The type being read
+ // is checked against the data payload's structure.
SkSpan<const uint8_t> bytes(int fieldIndex) const;
- // TODO: add more types (as needed) and their corresponding access methods
+ SkSpan<const int32_t> ints(int fieldIndex) const;
+ SkSpan<const SkColor4f> colors(int fieldIndex) const;
const SkShaderSnippet* entry() const { return fEntry; }
@@ -92,10 +105,6 @@ public:
SkSpan<const uint8_t> parentSpan,
int offsetInParent);
- SkBuiltInCodeSnippetID codeSnippetId() const {
- return static_cast<SkBuiltInCodeSnippetID>(fBlock[0]);
- }
-
// The data payload appears after any children and occupies the remainder of the
// block's space.
SkSpan<const uint8_t> dataPayload() const;
@@ -113,7 +122,7 @@ public:
}
void dump(const SkShaderCodeDictionary*) const;
#endif
- void toShaderInfo(SkShaderCodeDictionary*, SkShaderInfo*) const;
+ void toShaderInfo(const SkShaderCodeDictionary*, SkShaderInfo*) const;
SkSpan<const uint8_t> asSpan() const { return fData; }
const uint8_t* data() const { return fData.data(); }
@@ -139,16 +148,17 @@ private:
// is in the dictionary). In this case the dictionary will own the memory backing the span.
SkPaintParamsKey(SkSpan<const uint8_t> rawData);
- static void AddBlockToShaderInfo(SkShaderCodeDictionary*,
+ static void AddBlockToShaderInfo(const SkShaderCodeDictionary*,
const SkPaintParamsKey::BlockReader&,
SkShaderInfo*);
// The memory referenced in 'fData' is always owned by someone else.
- // If 'fOriginatingBuilder' is null, the dictionary's SkArena owns the memory and no explicit
- // freeing is required.
- // If 'fOriginatingBuilder' is non-null then the memory must be explicitly locked (in the ctor)
- // and unlocked (in the dtor) on the 'fOriginatingBuilder' object.
+ // If 'fOriginatingBuilder' is null, the dictionary's SkArena owns the 'fData' memory and no
+ // explicit freeing is required.
+ // If 'fOriginatingBuilder' is non-null then the 'fData' memory must be explicitly locked (in
+ // the ctor) and unlocked (in the dtor) on the 'fOriginatingBuilder' object.
SkSpan<const uint8_t> fData;
+
// This class should only ever access the 'lock' and 'unlock' calls on 'fOriginatingBuilder'
SkPaintParamsKeyBuilder* fOriginatingBuilder;
};
@@ -179,15 +189,22 @@ public:
const skgpu::BlendInfo& blendInfo() const { return fBlendInfo; }
#endif
- void beginBlock(int codeSnippetID);
- void beginBlock(SkBuiltInCodeSnippetID id) { this->beginBlock(static_cast<int>(id)); }
+ void beginBlock(int32_t codeSnippetID);
+ void beginBlock(SkBuiltInCodeSnippetID id) { this->beginBlock(static_cast<int32_t>(id)); }
void endBlock();
void addBytes(uint32_t numBytes, const uint8_t* data);
void addByte(uint8_t data) {
this->addBytes(1, &data);
}
- void add(const SkColor4f& color);
+ void addInts(uint32_t numInts, const int32_t* data);
+ void addInt(int32_t data) {
+ this->addInts(1, &data);
+ }
+ void add(int numColors, const SkColor4f* colors);
+ void add(const SkColor4f& color) {
+ this->add(/*numColors=*/1, &color);
+ }
#ifdef SK_DEBUG
// Check that the builder has been reset to its initial state prior to creating a new key.
@@ -219,6 +236,7 @@ public:
SkDEBUGCODE(bool isLocked() const { return fLocked; })
private:
+ void addToKey(uint32_t count, const void* data, SkPaintParamsKey::DataPayloadType payloadType);
void makeInvalid();
#ifdef SK_DEBUG
diff --git a/chromium/third_party/skia/src/core/SkPath.cpp b/chromium/third_party/skia/src/core/SkPath.cpp
index cee6d09a251..efde70a44b9 100644
--- a/chromium/third_party/skia/src/core/SkPath.cpp
+++ b/chromium/third_party/skia/src/core/SkPath.cpp
@@ -1145,6 +1145,8 @@ SkPath& SkPath::arcTo(const SkRect& oval, SkScalar startAngle, SkScalar sweepAng
return *this;
}
+ startAngle = SkScalarMod(startAngle, 360.0f);
+
if (fPathRef->countVerbs() == 0) {
forceMoveTo = true;
}
@@ -1256,7 +1258,7 @@ SkPath& SkPath::arcTo(SkScalar rx, SkScalar ry, SkScalar angle, SkPath::ArcSize
pointTransform.preRotate(-angle);
SkPoint unitPts[2];
- pointTransform.mapPoints(unitPts, srcPts, (int) SK_ARRAY_COUNT(unitPts));
+ pointTransform.mapPoints(unitPts, srcPts, (int) std::size(unitPts));
SkVector delta = unitPts[1] - unitPts[0];
SkScalar d = delta.fX * delta.fX + delta.fY * delta.fY;
@@ -1318,7 +1320,7 @@ SkPath& SkPath::arcTo(SkScalar rx, SkScalar ry, SkScalar angle, SkPath::ArcSize
unitPts[0] = unitPts[1];
unitPts[0].offset(t * sinEndTheta, -t * cosEndTheta);
SkPoint mapped[2];
- pointTransform.mapPoints(mapped, unitPts, (int) SK_ARRAY_COUNT(unitPts));
+ pointTransform.mapPoints(mapped, unitPts, (int) std::size(unitPts));
/*
Computing the arc width introduces rounding errors that cause arcs to start
outside their marks. A round rect may lose convexity as a result. If the input
diff --git a/chromium/third_party/skia/src/core/SkPathBuilder.cpp b/chromium/third_party/skia/src/core/SkPathBuilder.cpp
index 65b1b7c8e36..fb05acdec10 100644
--- a/chromium/third_party/skia/src/core/SkPathBuilder.cpp
+++ b/chromium/third_party/skia/src/core/SkPathBuilder.cpp
@@ -489,7 +489,7 @@ SkPathBuilder& SkPathBuilder::arcTo(SkPoint rad, SkScalar angle, SkPathBuilder::
pointTransform.preRotate(-angle);
SkPoint unitPts[2];
- pointTransform.mapPoints(unitPts, srcPts, (int) SK_ARRAY_COUNT(unitPts));
+ pointTransform.mapPoints(unitPts, srcPts, (int) std::size(unitPts));
SkVector delta = unitPts[1] - unitPts[0];
SkScalar d = delta.fX * delta.fX + delta.fY * delta.fY;
@@ -551,7 +551,7 @@ SkPathBuilder& SkPathBuilder::arcTo(SkPoint rad, SkScalar angle, SkPathBuilder::
unitPts[0] = unitPts[1];
unitPts[0].offset(t * sinEndTheta, -t * cosEndTheta);
SkPoint mapped[2];
- pointTransform.mapPoints(mapped, unitPts, (int) SK_ARRAY_COUNT(unitPts));
+ pointTransform.mapPoints(mapped, unitPts, (int) std::size(unitPts));
/*
Computing the arc width introduces rounding errors that cause arcs to start
outside their marks. A round rect may lose convexity as a result. If the input
diff --git a/chromium/third_party/skia/src/core/SkPathPriv.h b/chromium/third_party/skia/src/core/SkPathPriv.h
index 813613f828d..9be4983eb9f 100644
--- a/chromium/third_party/skia/src/core/SkPathPriv.h
+++ b/chromium/third_party/skia/src/core/SkPathPriv.h
@@ -304,7 +304,7 @@ public:
0 // kDone
};
- SkASSERT(verb < SK_ARRAY_COUNT(gPtsInVerb));
+ SkASSERT(verb < std::size(gPtsInVerb));
return gPtsInVerb[verb];
}
@@ -321,7 +321,7 @@ public:
0 // kDone
};
- SkASSERT(verb < SK_ARRAY_COUNT(gPtsInVerb));
+ SkASSERT(verb < std::size(gPtsInVerb));
return gPtsInVerb[verb];
}
diff --git a/chromium/third_party/skia/src/core/SkPicture.cpp b/chromium/third_party/skia/src/core/SkPicture.cpp
index 868f906f3af..69e449d6cbc 100644
--- a/chromium/third_party/skia/src/core/SkPicture.cpp
+++ b/chromium/third_party/skia/src/core/SkPicture.cpp
@@ -13,7 +13,6 @@
#include "include/private/SkTo.h"
#include "src/core/SkCanvasPriv.h"
#include "src/core/SkMathPriv.h"
-#include "src/core/SkPictureCommon.h"
#include "src/core/SkPictureData.h"
#include "src/core/SkPicturePlayback.h"
#include "src/core/SkPicturePriv.h"
diff --git a/chromium/third_party/skia/src/core/SkPictureCommon.h b/chromium/third_party/skia/src/core/SkPictureCommon.h
deleted file mode 100644
index bd4823d039b..00000000000
--- a/chromium/third_party/skia/src/core/SkPictureCommon.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkPictureCommon_DEFINED
-#define SkPictureCommon_DEFINED
-
-// Some shared code used by both SkBigPicture and SkMiniPicture.
-// SkTextHunter -- SkRecord visitor that returns true when the op draws text.
-// SkPathCounter -- SkRecord visitor that counts paths that draw slowly on the GPU.
-
-#include "include/core/SkPathEffect.h"
-#include "include/core/SkShader.h"
-#include "include/private/SkTLogic.h"
-#include "src/core/SkRecords.h"
-
-// TODO: might be nicer to have operator() return an int (the number of slow paths) ?
-struct SkPathCounter {
- // Some ops have a paint, some have an optional paint. Either way, get back a pointer.
- static const SkPaint* AsPtr(const SkPaint& p) { return &p; }
- static const SkPaint* AsPtr(const SkRecords::Optional<SkPaint>& p) { return p; }
-
- SkPathCounter() : fNumSlowPathsAndDashEffects(0) {}
-
- void checkPaint(const SkPaint* paint) {
- if (paint && paint->getPathEffect()) {
- // Initially assume it's slow.
- fNumSlowPathsAndDashEffects++;
- }
- }
-
- void operator()(const SkRecords::DrawPoints& op) {
- this->checkPaint(&op.paint);
- const SkPathEffect* effect = op.paint.getPathEffect();
- if (effect) {
- SkPathEffect::DashInfo info;
- SkPathEffect::DashType dashType = effect->asADash(&info);
- if (2 == op.count && SkPaint::kRound_Cap != op.paint.getStrokeCap() &&
- SkPathEffect::kDash_DashType == dashType && 2 == info.fCount) {
- fNumSlowPathsAndDashEffects--;
- }
- }
- }
-
- void operator()(const SkRecords::DrawPath& op) {
- this->checkPaint(&op.paint);
- if (op.paint.isAntiAlias() && !op.path.isConvex()) {
- SkPaint::Style paintStyle = op.paint.getStyle();
- const SkRect& pathBounds = op.path.getBounds();
- if (SkPaint::kStroke_Style == paintStyle &&
- 0 == op.paint.getStrokeWidth()) {
- // AA hairline concave path is not slow.
- } else if (SkPaint::kFill_Style == paintStyle && pathBounds.width() < 64.f &&
- pathBounds.height() < 64.f && !op.path.isVolatile()) {
- // AADF eligible concave path is not slow.
- } else {
- fNumSlowPathsAndDashEffects++;
- }
- }
- }
-
- void operator()(const SkRecords::ClipPath& op) {
- // TODO: does the SkRegion op matter?
- if (op.opAA.aa() && !op.path.isConvex()) {
- fNumSlowPathsAndDashEffects++;
- }
- }
-
- void operator()(const SkRecords::SaveLayer& op) {
- this->checkPaint(AsPtr(op.paint));
- }
-
- template <typename T>
- std::enable_if_t<T::kTags & SkRecords::kHasPaint_Tag, void> operator()(const T& op) {
- this->checkPaint(AsPtr(op.paint));
- }
-
- template <typename T>
- std::enable_if_t<!(T::kTags & SkRecords::kHasPaint_Tag), void>
- operator()(const T& op) { /* do nothing */ }
-
- int fNumSlowPathsAndDashEffects;
-};
-
-sk_sp<SkImage> ImageDeserializer_SkDeserialImageProc(const void*, size_t, void* imagedeserializer);
-
-bool SkPicture_StreamIsSKP(SkStream*, SkPictInfo*);
-
-#endif // SkPictureCommon_DEFINED
diff --git a/chromium/third_party/skia/src/core/SkPicturePriv.h b/chromium/third_party/skia/src/core/SkPicturePriv.h
index d62a3af68ee..087711f5c22 100644
--- a/chromium/third_party/skia/src/core/SkPicturePriv.h
+++ b/chromium/third_party/skia/src/core/SkPicturePriv.h
@@ -12,6 +12,8 @@
class SkReadBuffer;
class SkWriteBuffer;
+class SkStream;
+struct SkPictInfo;
class SkPicturePriv {
public:
@@ -115,6 +117,7 @@ public:
kBackdropScaleFactor = 90,
kRawImageShaders = 91,
kAnisotropicFilter = 92,
+ kBlend4fColorFilter = 93,
// Only SKPs within the min/current picture version range (inclusive) can be read.
//
@@ -140,8 +143,10 @@ public:
// Contact the Infra Gardener (or directly ping rmistry@) if the above steps do not work
// for you.
kMin_Version = kPictureShaderFilterParam_Version,
- kCurrent_Version = kAnisotropicFilter
+ kCurrent_Version = kBlend4fColorFilter
};
};
+bool SkPicture_StreamIsSKP(SkStream*, SkPictInfo*);
+
#endif
diff --git a/chromium/third_party/skia/src/core/SkPictureRecord.h b/chromium/third_party/skia/src/core/SkPictureRecord.h
index 334a5fa8033..172ce741d82 100644
--- a/chromium/third_party/skia/src/core/SkPictureRecord.h
+++ b/chromium/third_party/skia/src/core/SkPictureRecord.h
@@ -12,6 +12,7 @@
#include "include/core/SkCanvasVirtualEnforcer.h"
#include "include/core/SkFlattenable.h"
#include "include/core/SkPicture.h"
+#include "include/core/SkTextBlob.h"
#include "include/core/SkVertices.h"
#include "include/private/SkTArray.h"
#include "include/private/SkTDArray.h"
diff --git a/chromium/third_party/skia/src/core/SkPictureRecorder.cpp b/chromium/third_party/skia/src/core/SkPictureRecorder.cpp
index 6dcdcdca702..c918a2cfe2d 100644
--- a/chromium/third_party/skia/src/core/SkPictureRecorder.cpp
+++ b/chromium/third_party/skia/src/core/SkPictureRecorder.cpp
@@ -12,7 +12,6 @@
#include "include/core/SkPictureRecorder.h"
#include "include/core/SkTypes.h"
#include "src/core/SkBigPicture.h"
-#include "src/core/SkMiniRecorder.h"
#include "src/core/SkRecord.h"
#include "src/core/SkRecordDraw.h"
#include "src/core/SkRecordOpts.h"
@@ -21,8 +20,7 @@
SkPictureRecorder::SkPictureRecorder() {
fActivelyRecording = false;
- fMiniRecorder = std::make_unique<SkMiniRecorder>();
- fRecorder = std::make_unique<SkRecorder>(nullptr, SkRect::MakeEmpty(), fMiniRecorder.get());
+ fRecorder = std::make_unique<SkRecorder>(nullptr, SkRect::MakeEmpty());
}
SkPictureRecorder::~SkPictureRecorder() {}
@@ -37,7 +35,7 @@ SkCanvas* SkPictureRecorder::beginRecording(const SkRect& userCullRect,
if (!fRecord) {
fRecord.reset(new SkRecord);
}
- fRecorder->reset(fRecord.get(), cullRect, fMiniRecorder.get());
+ fRecorder->reset(fRecord.get(), cullRect);
fActivelyRecording = true;
return this->getRecordingCanvas();
}
@@ -50,20 +48,21 @@ SkCanvas* SkPictureRecorder::getRecordingCanvas() {
return fActivelyRecording ? fRecorder.get() : nullptr;
}
+class SkEmptyPicture final : public SkPicture {
+public:
+ void playback(SkCanvas*, AbortCallback*) const override { }
+
+ size_t approximateBytesUsed() const override { return sizeof(*this); }
+ int approximateOpCount(bool nested) const override { return 0; }
+ SkRect cullRect() const override { return SkRect::MakeEmpty(); }
+};
+
sk_sp<SkPicture> SkPictureRecorder::finishRecordingAsPicture() {
fActivelyRecording = false;
fRecorder->restoreToCount(1); // If we were missing any restores, add them now.
if (fRecord->count() == 0) {
- auto pic = fMiniRecorder->detachAsPicture(fBBH ? nullptr : &fCullRect);
- if (fBBH) {
- SkRect bounds = pic->cullRect(); // actually the computed bounds, not fCullRect.
- SkBBoxHierarchy::Metadata meta;
- meta.isDraw = true; // All mini-recorder pictures are single draws.
- fBBH->insert(&bounds, &meta, 1);
- }
- fBBH.reset(nullptr);
- return pic;
+ return sk_make_sp<SkEmptyPicture>();
}
// TODO: delay as much of this work until just before first playback?
@@ -125,7 +124,6 @@ void SkPictureRecorder::partialReplay(SkCanvas* canvas) const {
sk_sp<SkDrawable> SkPictureRecorder::finishRecordingAsDrawable() {
fActivelyRecording = false;
- fRecorder->flushMiniRecorder();
fRecorder->restoreToCount(1); // If we were missing any restores, add them now.
SkRecordOptimize(fRecord.get());
diff --git a/chromium/third_party/skia/src/core/SkPipelineData.h b/chromium/third_party/skia/src/core/SkPipelineData.h
index 4504625e430..35a4942b931 100644
--- a/chromium/third_party/skia/src/core/SkPipelineData.h
+++ b/chromium/third_party/skia/src/core/SkPipelineData.h
@@ -16,6 +16,7 @@
#include "include/core/SkTileMode.h"
#include "include/private/SkColorData.h"
#include "src/core/SkEnumBitMask.h"
+#include "src/core/SkUniform.h"
#ifdef SK_GRAPHITE_ENABLED
#include "include/private/SkVx.h"
@@ -148,6 +149,7 @@ public:
void write(int i) { fUniformManager.write(i); }
void write(skvx::float2 v) { fUniformManager.write(v); }
void write(skvx::float4 v) { fUniformManager.write(v); }
+ void write(SkSLType t, unsigned int cnt, const void* v) { fUniformManager.write(t, cnt, v); }
bool hasUniforms() const { return fUniformManager.size(); }
diff --git a/chromium/third_party/skia/src/core/SkPixmap.cpp b/chromium/third_party/skia/src/core/SkPixmap.cpp
index f10885adfea..514e0d4d77f 100644
--- a/chromium/third_party/skia/src/core/SkPixmap.cpp
+++ b/chromium/third_party/skia/src/core/SkPixmap.cpp
@@ -446,6 +446,180 @@ SkColor SkPixmap::getColor(int x, int y) const {
return SkColorSetARGB(0, 0, 0, 0);
}
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+SkColor4f SkPixmap::getColor4f(int x, int y) const {
+ SkASSERT(this->addr());
+ SkASSERT((unsigned)x < (unsigned)this->width());
+ SkASSERT((unsigned)y < (unsigned)this->height());
+
+ const bool needsUnpremul = (kPremul_SkAlphaType == fInfo.alphaType());
+ auto toColor = [needsUnpremul](uint32_t maybePremulColor) {
+ return needsUnpremul ? SkUnPreMultiply::PMColorToColor(maybePremulColor)
+ : SkSwizzle_BGRA_to_PMColor(maybePremulColor);
+ };
+
+ switch (this->colorType()) {
+ case kGray_8_SkColorType: {
+ float value = *this->addr8(x, y) / 255.0f;
+ return SkColor4f{value, value, value, 1.0};
+ }
+ case kR8_unorm_SkColorType: {
+ float value = *this->addr8(x, y) / 255.0f;
+ return SkColor4f{value, 0.0f, 0.0f, 1.0f};
+ }
+ case kAlpha_8_SkColorType: {
+ float value = *this->addr8(x, y) / 255.0f;
+ return SkColor4f{0.0f, 0.0f, 0.0f, value};
+ }
+ case kA16_unorm_SkColorType: {
+ float value = *this->addr16(x, y) / 65535.0f;
+ return SkColor4f{0.0f, 0.0f, 0.0f, value};
+ }
+ case kA16_float_SkColorType: {
+ SkHalf value = *this->addr16(x, y);
+ return SkColor4f{0.0f, 0.0f, 0.0f, SkHalfToFloat(value)};
+ }
+ case kRGB_565_SkColorType: {
+ SkColor c = SkPixel16ToColor(*this->addr16(x, y));
+ return SkColor4f::FromColor(c);
+ }
+ case kARGB_4444_SkColorType: {
+ uint16_t value = *this->addr16(x, y);
+ SkPMColor c = SkPixel4444ToPixel32(value);
+ return SkColor4f::FromColor(toColor(c));
+ }
+ case kR8G8_unorm_SkColorType: {
+ uint16_t value = *this->addr16(x, y);
+ SkColor c = (uint32_t)(((value >> 0) & 0xff)) << 16 |
+ (uint32_t)(((value >> 8) & 0xff)) << 8 | 0xff000000;
+ return SkColor4f::FromColor(c);
+ }
+ case kR16G16_unorm_SkColorType: {
+ uint32_t value = *this->addr32(x, y);
+ SkColor c = (uint32_t)(((value >> 0) & 0xffff) * (255 / 65535.0f)) << 16 |
+ (uint32_t)(((value >> 16) & 0xffff) * (255 / 65535.0f)) << 8 | 0xff000000;
+ return SkColor4f::FromColor(c);
+ }
+ case kR16G16_float_SkColorType: {
+ uint32_t value = *this->addr32(x, y);
+ float r = SkHalfToFloat((value >> 0) & 0xffff);
+ float g = SkHalfToFloat((value >> 16) & 0xffff);
+ return SkColor4f{r, g, 0.0, 1.0};
+ }
+ case kRGB_888x_SkColorType: {
+ uint32_t value = *this->addr32(x, y);
+ SkColor c = SkSwizzle_RB(value | 0xff000000);
+ return SkColor4f::FromColor(c);
+ }
+ case kBGRA_8888_SkColorType: {
+ uint32_t value = *this->addr32(x, y);
+ SkPMColor c = SkSwizzle_BGRA_to_PMColor(value);
+ return SkColor4f::FromColor(toColor(c));
+ }
+ case kRGBA_8888_SkColorType: {
+ uint32_t value = *this->addr32(x, y);
+ SkPMColor c = SkSwizzle_RGBA_to_PMColor(value);
+ return SkColor4f::FromColor(toColor(c));
+ }
+ case kSRGBA_8888_SkColorType: {
+ auto srgb_to_linear = [](float x) {
+ return (x <= 0.04045f) ? x * (1 / 12.92f)
+ : sk_float_pow(x * (1 / 1.055f) + (0.055f / 1.055f), 2.4f);
+ };
+
+ uint32_t value = *this->addr32(x, y);
+ float r = ((value >> 0) & 0xff) * (1 / 255.0f),
+ g = ((value >> 8) & 0xff) * (1 / 255.0f),
+ b = ((value >> 16) & 0xff) * (1 / 255.0f),
+ a = ((value >> 24) & 0xff) * (1 / 255.0f);
+ r = srgb_to_linear(r);
+ g = srgb_to_linear(g);
+ b = srgb_to_linear(b);
+ if (a != 0 && needsUnpremul) {
+ r = SkTPin(r / a, 0.0f, 1.0f);
+ g = SkTPin(g / a, 0.0f, 1.0f);
+ b = SkTPin(b / a, 0.0f, 1.0f);
+ }
+ return SkColor4f{r, g, b, a};
+ }
+ case kRGB_101010x_SkColorType: {
+ uint32_t value = *this->addr32(x, y);
+ // Convert 10-bit rgb to float rgb, and mask in 0xff alpha at the top.
+ float r = (uint32_t)((value >> 0) & 0x3ff) / (1023.0f);
+ float g = (uint32_t)((value >> 10) & 0x3ff) / (1023.0f);
+ float b = (uint32_t)((value >> 20) & 0x3ff) / (1023.0f);
+ float a = 1.0f;
+ return SkColor4f{r, g, b, a};
+ }
+ case kBGR_101010x_SkColorType: {
+ uint32_t value = *this->addr32(x, y);
+ // Convert 10-bit bgr to float rgb, and mask in 0xff alpha at the top.
+ float r = (uint32_t)((value >> 20) & 0x3ff) / (1023.0f);
+ float g = (uint32_t)((value >> 10) & 0x3ff) / (1023.0f);
+ float b = (uint32_t)((value >> 0) & 0x3ff) / (1023.0f);
+ float a = 1.0f;
+ return SkColor4f{r, g, b, a};
+ }
+ case kRGBA_1010102_SkColorType:
+ case kBGRA_1010102_SkColorType: {
+ uint32_t value = *this->addr32(x, y);
+
+ float r = ((value >> 0) & 0x3ff) * (1 / 1023.0f),
+ g = ((value >> 10) & 0x3ff) * (1 / 1023.0f),
+ b = ((value >> 20) & 0x3ff) * (1 / 1023.0f),
+ a = ((value >> 30) & 0x3) * (1 / 3.0f);
+ if (this->colorType() == kBGRA_1010102_SkColorType) {
+ std::swap(r, b);
+ }
+ if (a != 0 && needsUnpremul) {
+ r = SkTPin(r / a, 0.0f, 1.0f);
+ g = SkTPin(g / a, 0.0f, 1.0f);
+ b = SkTPin(b / a, 0.0f, 1.0f);
+ }
+ return SkColor4f{r, g, b, a};
+ }
+ case kR16G16B16A16_unorm_SkColorType: {
+ uint64_t value = *this->addr64(x, y);
+
+ float r = ((value)&0xffff) * (1 / 65535.0f),
+ g = ((value >> 16) & 0xffff) * (1 / 65535.0f),
+ b = ((value >> 32) & 0xffff) * (1 / 65535.0f),
+ a = ((value >> 48) & 0xffff) * (1 / 65535.0f);
+ if (a != 0 && needsUnpremul) {
+ r *= (1.0f / a);
+ g *= (1.0f / a);
+ b *= (1.0f / a);
+ }
+ return SkColor4f{r, g, b, a};
+ }
+ case kRGBA_F16Norm_SkColorType:
+ case kRGBA_F16_SkColorType: {
+ const uint64_t* addr = (const uint64_t*)fPixels + y * (fRowBytes >> 3) + x;
+ skvx::float4 p4 = SkHalfToFloat_finite_ftz(*addr);
+ if (p4[3] && needsUnpremul) {
+ float inva = 1 / p4[3];
+ p4 = p4 * skvx::float4(inva, inva, inva, 1);
+ }
+ return SkColor4f{p4[0], p4[1], p4[2], p4[3]};
+ }
+ case kRGBA_F32_SkColorType: {
+ const float* rgba = (const float*)fPixels + 4 * y * (fRowBytes >> 4) + 4 * x;
+ skvx::float4 p4 = skvx::float4::Load(rgba);
+ // From here on, just like F16:
+ if (p4[3] && needsUnpremul) {
+ float inva = 1 / p4[3];
+ p4 = p4 * skvx::float4(inva, inva, inva, 1);
+ }
+ return SkColor4f{p4[0], p4[1], p4[2], p4[3]};
+ }
+ case kUnknown_SkColorType:
+ break;
+ }
+ SkDEBUGFAIL("");
+ return SkColors::kTransparent;
+}
+
bool SkPixmap::computeIsOpaque() const {
const int height = this->height();
const int width = this->width();
diff --git a/chromium/third_party/skia/src/core/SkPrecompile.h b/chromium/third_party/skia/src/core/SkPrecompile.h
new file mode 100644
index 00000000000..7a959eda2a0
--- /dev/null
+++ b/chromium/third_party/skia/src/core/SkPrecompile.h
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkPrecompile_DEFINED
+#define SkPrecompile_DEFINED
+
+#include "include/core/SkTypes.h"
+
+#ifdef SK_ENABLE_PRECOMPILE
+
+#include "include/core/SkBlendMode.h"
+#include "include/core/SkRefCnt.h"
+#include "include/core/SkSpan.h"
+
+#include <optional>
+#include <vector>
+
+class SkRuntimeEffect;
+
+class SkPrecompileBase : public SkRefCnt {
+public:
+ enum class Type {
+ kBlender,
+ kColorFilter,
+ kImageFilter,
+ kMaskFilter,
+ kShader,
+ // TODO: add others: kDrawable, kPathEffect (?!)
+ };
+
+ SkPrecompileBase(Type type) : fType(type) {}
+
+ Type type() const { return fType; }
+
+private:
+ Type fType;
+};
+
+//--------------------------------------------------------------------------------------------------
+class SkPrecompileShader : public SkPrecompileBase {
+public:
+ SkPrecompileShader() : SkPrecompileBase(Type::kShader) {}
+};
+
+class SkPrecompileMaskFilter : public SkPrecompileBase {
+public:
+ SkPrecompileMaskFilter() : SkPrecompileBase(Type::kMaskFilter) {}
+};
+
+class SkPrecompileColorFilter : public SkPrecompileBase {
+public:
+ SkPrecompileColorFilter() : SkPrecompileBase(Type::kColorFilter) {}
+};
+
+class SkPrecompileImageFilter : public SkPrecompileBase {
+public:
+ SkPrecompileImageFilter() : SkPrecompileBase(Type::kImageFilter) {}
+};
+
+class SkPrecompileBlender : public SkPrecompileBase {
+public:
+ SkPrecompileBlender() : SkPrecompileBase(Type::kBlender) {}
+
+ virtual std::optional<SkBlendMode> asBlendMode() const { return {}; }
+
+ static sk_sp<SkPrecompileBlender> Mode(SkBlendMode blendMode);
+};
+
+//--------------------------------------------------------------------------------------------------
+class SkPaintOptions {
+public:
+ void setShaders(SkSpan<const sk_sp<SkPrecompileShader>> shaders) {
+ fShaders.assign(shaders.begin(), shaders.end());
+ }
+
+ void setMaskFilters(SkSpan<const sk_sp<SkPrecompileMaskFilter>> maskFilters) {
+ fMaskFilters.assign(maskFilters.begin(), maskFilters.end());
+ }
+
+ void setColorFilters(SkSpan<const sk_sp<SkPrecompileColorFilter>> colorFilters) {
+ fColorFilters.assign(colorFilters.begin(), colorFilters.end());
+ }
+
+ void setImageFilters(SkSpan<const sk_sp<SkPrecompileImageFilter>> imageFilters) {
+ fImageFilters.assign(imageFilters.begin(), imageFilters.end());
+ }
+
+ void setBlendModes(SkSpan<SkBlendMode> blendModes) {
+ fBlenders.reserve(blendModes.size());
+ for (SkBlendMode bm : blendModes) {
+ fBlenders.emplace_back(SkPrecompileBlender::Mode(bm));
+ }
+ }
+ void setBlenders(SkSpan<const sk_sp<SkPrecompileBlender>> blenders) {
+ fBlenders.assign(blenders.begin(), blenders.end());
+ }
+
+private:
+ std::vector<sk_sp<SkPrecompileShader>> fShaders;
+ std::vector<sk_sp<SkPrecompileMaskFilter>> fMaskFilters;
+ std::vector<sk_sp<SkPrecompileColorFilter>> fColorFilters;
+ std::vector<sk_sp<SkPrecompileImageFilter>> fImageFilters;
+ std::vector<sk_sp<SkPrecompileBlender>> fBlenders;
+};
+
+#endif // SK_ENABLE_PRECOMPILE
+
+#endif // SkPrecompile_DEFINED
diff --git a/chromium/third_party/skia/src/core/SkRRect.cpp b/chromium/third_party/skia/src/core/SkRRect.cpp
index 060e956c5da..bdcf607d041 100644
--- a/chromium/third_party/skia/src/core/SkRRect.cpp
+++ b/chromium/third_party/skia/src/core/SkRRect.cpp
@@ -367,7 +367,7 @@ static bool radii_are_nine_patch(const SkVector radii[4]) {
void SkRRect::computeType() {
if (fRect.isEmpty()) {
SkASSERT(fRect.isSorted());
- for (size_t i = 0; i < SK_ARRAY_COUNT(fRadii); ++i) {
+ for (size_t i = 0; i < std::size(fRadii); ++i) {
SkASSERT((fRadii[i] == SkVector{0, 0}));
}
fType = kEmpty_Type;
diff --git a/chromium/third_party/skia/src/core/SkRasterPipeline.cpp b/chromium/third_party/skia/src/core/SkRasterPipeline.cpp
index c36b06138a3..f1fa7b09ac5 100644
--- a/chromium/third_party/skia/src/core/SkRasterPipeline.cpp
+++ b/chromium/third_party/skia/src/core/SkRasterPipeline.cpp
@@ -8,7 +8,7 @@
#include "include/private/SkImageInfoPriv.h"
#include "include/private/SkTemplates.h"
#include "include/private/SkVx.h"
-#include "include/third_party/skcms/skcms.h"
+#include "modules/skcms/skcms.h"
#include "src/core/SkColorSpacePriv.h"
#include "src/core/SkOpts.h"
#include "src/core/SkRasterPipeline.h"
@@ -21,9 +21,8 @@ SkRasterPipeline::SkRasterPipeline(SkArenaAlloc* alloc) : fAlloc(alloc) {
this->reset();
}
void SkRasterPipeline::reset() {
- fStages = nullptr;
- fNumStages = 0;
- fSlotsNeeded = 1; // We always need one extra slot for just_return().
+ fStages = nullptr;
+ fNumStages = 0;
}
void SkRasterPipeline::append(StockStage stage, void* ctx) {
@@ -41,8 +40,7 @@ void SkRasterPipeline::append(StockStage stage, void* ctx) {
}
void SkRasterPipeline::unchecked_append(StockStage stage, void* ctx) {
fStages = fAlloc->make<StageList>( StageList{fStages, stage, ctx} );
- fNumStages += 1;
- fSlotsNeeded += ctx ? 2 : 1;
+ fNumStages += 1;
}
void SkRasterPipeline::append(StockStage stage, uintptr_t ctx) {
void* ptrCtx;
@@ -67,8 +65,7 @@ void SkRasterPipeline::extend(const SkRasterPipeline& src) {
stages[0].prev = fStages;
fStages = &stages[src.fNumStages - 1];
- fNumStages += src.fNumStages;
- fSlotsNeeded += src.fSlotsNeeded - 1; // Don't double count just_returns().
+ fNumStages += src.fNumStages;
}
void SkRasterPipeline::dump() const {
@@ -374,9 +371,7 @@ SkRasterPipeline::StartPipelineFn SkRasterPipeline::build_pipeline(void** ip) co
*--ip = (void*)SkOpts::just_return_lowp;
for (const StageList* st = fStages; st; st = st->prev) {
if (auto fn = SkOpts::stages_lowp[st->stage]) {
- if (st->ctx) {
- *--ip = st->ctx;
- }
+ *--ip = st->ctx;
*--ip = (void*)fn;
} else {
ip = reset_point;
@@ -390,9 +385,7 @@ SkRasterPipeline::StartPipelineFn SkRasterPipeline::build_pipeline(void** ip) co
*--ip = (void*)SkOpts::just_return_highp;
for (const StageList* st = fStages; st; st = st->prev) {
- if (st->ctx) {
- *--ip = st->ctx;
- }
+ *--ip = st->ctx;
*--ip = (void*)SkOpts::stages_highp[st->stage];
}
return SkOpts::start_pipeline_highp;
@@ -403,10 +396,12 @@ void SkRasterPipeline::run(size_t x, size_t y, size_t w, size_t h) const {
return;
}
+ int slotsNeeded = 2 * fNumStages + 1; // just_returns have no context
+
// Best to not use fAlloc here... we can't bound how often run() will be called.
- SkAutoSTMalloc<64, void*> program(fSlotsNeeded);
+ SkAutoSTMalloc<64, void*> program(slotsNeeded);
- auto start_pipeline = this->build_pipeline(program.get() + fSlotsNeeded);
+ auto start_pipeline = this->build_pipeline(program.get() + slotsNeeded);
start_pipeline(x,y,x+w,y+h, program.get());
}
@@ -415,9 +410,11 @@ std::function<void(size_t, size_t, size_t, size_t)> SkRasterPipeline::compile()
return [](size_t, size_t, size_t, size_t) {};
}
- void** program = fAlloc->makeArray<void*>(fSlotsNeeded);
+ int slotsNeeded = 2 * fNumStages + 1; // just_returns have no context
+
+ void** program = fAlloc->makeArray<void*>(slotsNeeded);
- auto start_pipeline = this->build_pipeline(program + fSlotsNeeded);
+ auto start_pipeline = this->build_pipeline(program + slotsNeeded);
return [=](size_t x, size_t y, size_t w, size_t h) {
start_pipeline(x,y,x+w,y+h, program);
};
diff --git a/chromium/third_party/skia/src/core/SkRasterPipeline.h b/chromium/third_party/skia/src/core/SkRasterPipeline.h
index 3fcf99b5266..1e430873d27 100644
--- a/chromium/third_party/skia/src/core/SkRasterPipeline.h
+++ b/chromium/third_party/skia/src/core/SkRasterPipeline.h
@@ -272,11 +272,9 @@ private:
void unchecked_append(StockStage, void*);
- // Used by old single-program void** style execution.
SkArenaAlloc* fAlloc;
StageList* fStages;
int fNumStages;
- int fSlotsNeeded;
};
template <size_t bytes>
diff --git a/chromium/third_party/skia/src/core/SkRasterPipelineBlitter.cpp b/chromium/third_party/skia/src/core/SkRasterPipelineBlitter.cpp
index 4668573db74..3e4a7882176 100644
--- a/chromium/third_party/skia/src/core/SkRasterPipelineBlitter.cpp
+++ b/chromium/third_party/skia/src/core/SkRasterPipelineBlitter.cpp
@@ -93,7 +93,8 @@ SkBlitter* SkCreateRasterPipelineBlitter(const SkPixmap& dst,
const SkPaint& paint,
const SkMatrixProvider& matrixProvider,
SkArenaAlloc* alloc,
- sk_sp<SkShader> clipShader) {
+ sk_sp<SkShader> clipShader,
+ const SkSurfaceProps& props) {
if (!paint.asBlendMode()) {
// The raster pipeline doesn't support SkBlender.
return nullptr;
@@ -122,7 +123,7 @@ SkBlitter* SkCreateRasterPipelineBlitter(const SkPixmap& dst,
bool is_constant = shader->isConstant();
if (shader->appendStages(
- {&shaderPipeline, alloc, dstCT, dstCS, paint, nullptr, matrixProvider})) {
+ {&shaderPipeline, alloc, dstCT, dstCS, paint, nullptr, matrixProvider, props})) {
if (paintColor.fA != 1.0f) {
shaderPipeline.append(SkRasterPipeline::scale_1_float,
alloc->make<float>(paintColor.fA));
@@ -173,7 +174,9 @@ SkBlitter* SkRasterPipelineBlitter::Create(const SkPixmap& dst,
SkColorType clipCT = kRGBA_8888_SkColorType;
SkColorSpace* clipCS = nullptr;
SkMatrixProvider clipMatrixProvider(SkMatrix::I());
- SkStageRec rec = {clipP, alloc, clipCT, clipCS, clipPaint, nullptr, clipMatrixProvider};
+ SkSurfaceProps props{}; // default OK; clipShader doesn't render text
+ SkStageRec rec = {clipP, alloc, clipCT, clipCS, clipPaint, nullptr, clipMatrixProvider,
+ props};
if (as_SB(clipShader)->appendStages(rec)) {
struct Storage {
// large enough for highp (float) or lowp(U16)
@@ -194,9 +197,9 @@ SkBlitter* SkRasterPipelineBlitter::Create(const SkPixmap& dst,
// If there's a color filter it comes next.
if (auto colorFilter = paint.getColorFilter()) {
SkMatrixProvider matrixProvider(SkMatrix::I());
- SkStageRec rec = {
- colorPipeline, alloc, dst.colorType(), dst.colorSpace(), paint, nullptr, matrixProvider
- };
+ SkSurfaceProps props{}; // default OK; colorFilter doesn't render text
+ SkStageRec rec = {colorPipeline, alloc, dst.colorType(), dst.colorSpace(), paint, nullptr,
+ matrixProvider, props};
if (!as_CFB(colorFilter)->appendStages(rec, is_opaque)) {
return nullptr;
}
diff --git a/chromium/third_party/skia/src/core/SkRecordedDrawable.cpp b/chromium/third_party/skia/src/core/SkRecordedDrawable.cpp
index 5ad052072fd..ba4f8cf10f3 100644
--- a/chromium/third_party/skia/src/core/SkRecordedDrawable.cpp
+++ b/chromium/third_party/skia/src/core/SkRecordedDrawable.cpp
@@ -71,9 +71,10 @@ void SkRecordedDrawable::flatten(SkWriteBuffer& buffer) const {
}
// Record the draw commands.
+ SkDrawable* const* drawables = fDrawableList ? fDrawableList->begin() : nullptr;
+ int drawableCount = fDrawableList ? fDrawableList->count() : 0;
pictureRecord.beginRecording();
- SkRecordDraw(*fRecord, &pictureRecord, nullptr, fDrawableList->begin(), fDrawableList->count(),
- bbh, nullptr);
+ SkRecordDraw(*fRecord, &pictureRecord, nullptr, drawables, drawableCount, bbh, nullptr);
pictureRecord.endRecording();
// Flatten the recorded commands and drawables.
diff --git a/chromium/third_party/skia/src/core/SkRecorder.cpp b/chromium/third_party/skia/src/core/SkRecorder.cpp
index f55e97f0a82..298e0a1c28c 100644
--- a/chromium/third_party/skia/src/core/SkRecorder.cpp
+++ b/chromium/third_party/skia/src/core/SkRecorder.cpp
@@ -14,7 +14,7 @@
#include "include/private/chromium/Slug.h"
#include "src/core/SkBigPicture.h"
#include "src/core/SkCanvasPriv.h"
-#include "src/core/SkGlyphRun.h"
+#include "src/text/GlyphRun.h"
#include "src/utils/SkPatchUtils.h"
#include <memory>
@@ -56,28 +56,25 @@ static SkIRect safe_picture_bounds(const SkRect& bounds) {
return picBounds;
}
-SkRecorder::SkRecorder(SkRecord* record, int width, int height, SkMiniRecorder* mr)
+SkRecorder::SkRecorder(SkRecord* record, int width, int height)
: SkCanvasVirtualEnforcer<SkNoDrawCanvas>(width, height)
, fApproxBytesUsedBySubPictures(0)
- , fRecord(record)
- , fMiniRecorder(mr) {
+ , fRecord(record) {
SkASSERT(this->imageInfo().width() >= 0 && this->imageInfo().height() >= 0);
}
-SkRecorder::SkRecorder(SkRecord* record, const SkRect& bounds, SkMiniRecorder* mr)
+SkRecorder::SkRecorder(SkRecord* record, const SkRect& bounds)
: SkCanvasVirtualEnforcer<SkNoDrawCanvas>(safe_picture_bounds(bounds))
, fApproxBytesUsedBySubPictures(0)
- , fRecord(record)
- , fMiniRecorder(mr) {
+ , fRecord(record) {
SkASSERT(this->imageInfo().width() >= 0 && this->imageInfo().height() >= 0);
}
-void SkRecorder::reset(SkRecord* record, const SkRect& bounds, SkMiniRecorder* mr) {
+void SkRecorder::reset(SkRecord* record, const SkRect& bounds) {
this->forgetRecord();
fRecord = record;
this->resetCanvas(safe_picture_bounds(bounds));
SkASSERT(this->imageInfo().width() >= 0 && this->imageInfo().height() >= 0);
- fMiniRecorder = mr;
}
void SkRecorder::forgetRecord() {
@@ -89,15 +86,9 @@ void SkRecorder::forgetRecord() {
// To make appending to fRecord a little less verbose.
template<typename T, typename... Args>
void SkRecorder::append(Args&&... args) {
- if (fMiniRecorder) {
- this->flushMiniRecorder();
- }
new (fRecord->append<T>()) T{std::forward<Args>(args)...};
}
-#define TRY_MINIRECORDER(method, ...) \
- if (fMiniRecorder && fMiniRecorder->method(__VA_ARGS__)) return
-
// For methods which must call back into SkNoDrawCanvas.
#define INHERITED(method, ...) this->SkNoDrawCanvas::method(__VA_ARGS__)
@@ -144,14 +135,6 @@ char* SkRecorder::copy(const char* src) {
return this->copy(src, strlen(src)+1);
}
-void SkRecorder::flushMiniRecorder() {
- if (fMiniRecorder) {
- SkMiniRecorder* mr = fMiniRecorder;
- fMiniRecorder = nullptr; // Needs to happen before flushAndReset() or we recurse forever.
- mr->flushAndReset(this);
- }
-}
-
void SkRecorder::onDrawPaint(const SkPaint& paint) {
this->append<SkRecords::DrawPaint>(paint);
}
@@ -168,7 +151,6 @@ void SkRecorder::onDrawPoints(PointMode mode,
}
void SkRecorder::onDrawRect(const SkRect& rect, const SkPaint& paint) {
- TRY_MINIRECORDER(drawRect, rect, paint);
this->append<SkRecords::DrawRect>(paint, rect);
}
@@ -202,7 +184,6 @@ void SkRecorder::onDrawDrawable(SkDrawable* drawable, const SkMatrix* matrix) {
}
void SkRecorder::onDrawPath(const SkPath& path, const SkPaint& paint) {
- TRY_MINIRECORDER(drawPath, path, paint);
this->append<SkRecords::DrawPath>(paint, path);
}
@@ -231,7 +212,6 @@ void SkRecorder::onDrawImageLattice2(const SkImage* image, const Lattice& lattic
void SkRecorder::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
const SkPaint& paint) {
- TRY_MINIRECORDER(drawTextBlob, blob, x, y, paint);
this->append<SkRecords::DrawTextBlob>(paint, sk_ref_sp(blob), x, y);
}
@@ -241,7 +221,8 @@ void SkRecorder::onDrawSlug(const sktext::gpu::Slug* slug) {
}
#endif
-void SkRecorder::onDrawGlyphRunList(const SkGlyphRunList& glyphRunList, const SkPaint& paint) {
+void SkRecorder::onDrawGlyphRunList(
+ const sktext::GlyphRunList& glyphRunList, const SkPaint& paint) {
sk_sp<SkTextBlob> blob = sk_ref_sp(glyphRunList.blob());
if (glyphRunList.blob() == nullptr) {
blob = glyphRunList.makeBlob();
diff --git a/chromium/third_party/skia/src/core/SkRecorder.h b/chromium/third_party/skia/src/core/SkRecorder.h
index df748f79470..c5e0ded5f4e 100644
--- a/chromium/third_party/skia/src/core/SkRecorder.h
+++ b/chromium/third_party/skia/src/core/SkRecorder.h
@@ -12,7 +12,6 @@
#include "include/private/SkTDArray.h"
#include "include/utils/SkNoDrawCanvas.h"
#include "src/core/SkBigPicture.h"
-#include "src/core/SkMiniRecorder.h"
#include "src/core/SkRecord.h"
#include "src/core/SkRecords.h"
@@ -41,10 +40,10 @@ private:
class SkRecorder final : public SkCanvasVirtualEnforcer<SkNoDrawCanvas> {
public:
// Does not take ownership of the SkRecord.
- SkRecorder(SkRecord*, int width, int height, SkMiniRecorder* = nullptr); // TODO: remove
- SkRecorder(SkRecord*, const SkRect& bounds, SkMiniRecorder* = nullptr);
+ SkRecorder(SkRecord*, int width, int height); // TODO: remove
+ SkRecorder(SkRecord*, const SkRect& bounds);
- void reset(SkRecord*, const SkRect& bounds, SkMiniRecorder* = nullptr);
+ void reset(SkRecord*, const SkRect& bounds);
size_t approxBytesUsedBySubPictures() const { return fApproxBytesUsedBySubPictures; }
@@ -76,7 +75,8 @@ public:
#if SK_SUPPORT_GPU
void onDrawSlug(const sktext::gpu::Slug* slug) override;
#endif
- void onDrawGlyphRunList(const SkGlyphRunList& glyphRunList, const SkPaint& paint) override;
+ void onDrawGlyphRunList(
+ const sktext::GlyphRunList& glyphRunList, const SkPaint& paint) override;
void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
const SkPoint texCoords[4], SkBlendMode,
const SkPaint& paint) override;
@@ -122,8 +122,6 @@ public:
sk_sp<SkSurface> onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override;
- void flushMiniRecorder();
-
private:
template <typename T>
T* copy(const T*);
@@ -137,8 +135,6 @@ private:
size_t fApproxBytesUsedBySubPictures;
SkRecord* fRecord;
std::unique_ptr<SkDrawableList> fDrawableList;
-
- SkMiniRecorder* fMiniRecorder;
};
#endif//SkRecorder_DEFINED
diff --git a/chromium/third_party/skia/src/core/SkRegion_path.cpp b/chromium/third_party/skia/src/core/SkRegion_path.cpp
index 097a940bde0..f6939af99f8 100644
--- a/chromium/third_party/skia/src/core/SkRegion_path.cpp
+++ b/chromium/third_party/skia/src/core/SkRegion_path.cpp
@@ -253,7 +253,7 @@ static unsigned verb_to_initial_last_index(unsigned verb) {
0, // kClose_Verb
0 // kDone_Verb
};
- SkASSERT((unsigned)verb < SK_ARRAY_COUNT(gPathVerbToInitialLastIndex));
+ SkASSERT((unsigned)verb < std::size(gPathVerbToInitialLastIndex));
return gPathVerbToInitialLastIndex[verb];
}
@@ -267,7 +267,7 @@ static unsigned verb_to_max_edges(unsigned verb) {
0, // kClose_Verb
0 // kDone_Verb
};
- SkASSERT((unsigned)verb < SK_ARRAY_COUNT(gPathVerbToMaxEdges));
+ SkASSERT((unsigned)verb < std::size(gPathVerbToMaxEdges));
return gPathVerbToMaxEdges[verb];
}
diff --git a/chromium/third_party/skia/src/core/SkRuntimeEffect.cpp b/chromium/third_party/skia/src/core/SkRuntimeEffect.cpp
index d85b4121adf..622e804fc83 100644
--- a/chromium/third_party/skia/src/core/SkRuntimeEffect.cpp
+++ b/chromium/third_party/skia/src/core/SkRuntimeEffect.cpp
@@ -7,6 +7,7 @@
#include "include/effects/SkRuntimeEffect.h"
+#include "include/core/SkCapabilities.h"
#include "include/core/SkColorFilter.h"
#include "include/core/SkData.h"
#include "include/core/SkSurface.h"
@@ -17,9 +18,11 @@
#include "src/core/SkColorFilterBase.h"
#include "src/core/SkColorSpacePriv.h"
#include "src/core/SkColorSpaceXformSteps.h"
+#include "src/core/SkKeyHelpers.h"
#include "src/core/SkLRUCache.h"
#include "src/core/SkMatrixProvider.h"
#include "src/core/SkOpts.h"
+#include "src/core/SkPaintParamsKey.h"
#include "src/core/SkRasterPipeline.h"
#include "src/core/SkReadBuffer.h"
#include "src/core/SkRuntimeEffectPriv.h"
@@ -30,8 +33,10 @@
#include "src/sksl/SkSLCompiler.h"
#include "src/sksl/SkSLSharedCompiler.h"
#include "src/sksl/SkSLUtil.h"
+#include "src/sksl/analysis/SkSLProgramUsage.h"
#include "src/sksl/codegen/SkSLVMCodeGenerator.h"
#include "src/sksl/ir/SkSLFunctionDefinition.h"
+#include "src/sksl/ir/SkSLProgram.h"
#include "src/sksl/ir/SkSLVarDeclarations.h"
#include "src/sksl/tracing/SkVMDebugTrace.h"
@@ -92,7 +97,7 @@ SkRuntimeEffect::Uniform SkRuntimeEffectPriv::VarAsUniform(const SkSL::Variable&
using Uniform = SkRuntimeEffect::Uniform;
SkASSERT(var.modifiers().fFlags & SkSL::Modifiers::kUniform_Flag);
Uniform uni;
- uni.name = SkString(var.name());
+ uni.name = var.name();
uni.flags = 0;
uni.count = 1;
@@ -103,6 +108,10 @@ SkRuntimeEffect::Uniform SkRuntimeEffectPriv::VarAsUniform(const SkSL::Variable&
type = &type->componentType();
}
+ if (type->hasPrecision() && !type->highPrecision()) {
+ uni.flags |= Uniform::kHalfPrecision_Flag;
+ }
+
SkAssertResult(init_uniform_type(context, type, &uni));
if (var.modifiers().fLayout.fFlags & SkSL::Layout::Flag::kColor_Flag) {
uni.flags |= Uniform::kColor_Flag;
@@ -167,6 +176,17 @@ sk_sp<const SkData> SkRuntimeEffectPriv::TransformUniforms(
return data ? data : originalData;
}
+bool SkRuntimeEffectPriv::CanDraw(const SkCapabilities* caps, const SkSL::Program* program) {
+ SkASSERT(caps && program);
+ SkASSERT(program->fConfig->enforcesSkSLVersion());
+ return program->fConfig->fRequiredSkSLVersion <= caps->skslVersion();
+}
+
+bool SkRuntimeEffectPriv::CanDraw(const SkCapabilities* caps, const SkRuntimeEffect* effect) {
+ SkASSERT(effect);
+ return CanDraw(caps, effect->fBaseProgram.get());
+}
+
//////////////////////////////////////////////////////////////////////////////
static bool flattenable_is_valid_as_child(const SkFlattenable* f) {
@@ -291,7 +311,7 @@ SkSL::ProgramSettings SkRuntimeEffect::MakeSettings(const Options& options) {
settings.fInlineThreshold = 0;
settings.fForceNoInline = options.forceUnoptimized;
settings.fOptimize = !options.forceUnoptimized;
- settings.fEnforceES2Restrictions = options.enforceES2Restrictions;
+ settings.fMaxVersionAllowed = options.maxVersionAllowed;
return settings;
}
@@ -308,7 +328,7 @@ SkRuntimeEffect::Result SkRuntimeEffect::MakeFromSource(SkString sksl,
// calling the Make overload at the end, which creates its own (non-reentrant)
// SharedCompiler instance
SkSL::SharedCompiler compiler;
- SkSL::Program::Settings settings = MakeSettings(options);
+ SkSL::ProgramSettings settings = MakeSettings(options);
program = compiler->convertProgram(kind, std::string(sksl.c_str(), sksl.size()), settings);
if (!program) {
@@ -323,6 +343,14 @@ SkRuntimeEffect::Result SkRuntimeEffect::MakeInternal(std::unique_ptr<SkSL::Prog
SkSL::ProgramKind kind) {
SkSL::SharedCompiler compiler;
+ // TODO(skia:11209): Figure out a way to run ES3+ color filters on the CPU. This doesn't need
+ // to be fast - it could just be direct IR evaluation. But without it, there's no way for us
+ // to fully implement the SkColorFilter API (eg, `filterColor`)
+ if (kind == SkSL::ProgramKind::kRuntimeColorFilter &&
+ !SkRuntimeEffectPriv::CanDraw(SkCapabilities::RasterBackend().get(), program.get())) {
+ RETURN_FAILURE("SkSL color filters must target #version 100");
+ }
+
// Find 'main', then locate the sample coords parameter. (It might not be present.)
const SkSL::FunctionDefinition* main = SkSL::Program_GetFunction(*program, "main");
if (!main) {
@@ -392,7 +420,7 @@ SkRuntimeEffect::Result SkRuntimeEffect::MakeInternal(std::unique_ptr<SkSL::Prog
// Child effects that can be sampled ('shader', 'colorFilter', 'blender')
if (varType.isEffectChild()) {
Child c;
- c.name = SkString(var.name());
+ c.name = var.name();
c.type = child_type(varType);
c.index = children.size();
children.push_back(c);
@@ -438,7 +466,7 @@ sk_sp<SkRuntimeEffect> SkRuntimeEffect::makeUnoptimizedClone() {
// from when it was initially made so we don't know what was originally requested.
Options options;
options.forceUnoptimized = true;
- options.enforceES2Restrictions = false;
+ options.maxVersionAllowed = SkSL::Version::k300;
options.usePrivateRTShaderModule = true;
// We do know the original ProgramKind, so we don't need to re-derive it.
@@ -453,7 +481,7 @@ sk_sp<SkRuntimeEffect> SkRuntimeEffect::makeUnoptimizedClone() {
// calling MakeInternal at the end, which creates its own (non-reentrant) SharedCompiler
// instance.
SkSL::SharedCompiler compiler;
- SkSL::Program::Settings settings = MakeSettings(options);
+ SkSL::ProgramSettings settings = MakeSettings(options);
program = compiler->convertProgram(kind, *fBaseProgram->fSource, settings);
if (!program) {
@@ -584,15 +612,16 @@ SkRuntimeEffect::SkRuntimeEffect(std::unique_ptr<SkSL::Program> baseProgram,
// assert below to trigger, please incorporate your field into `fHash` and update KnownOptions
// to match the layout of Options.
struct KnownOptions {
- bool forceUnoptimized, enforceES2Restrictions, usePrivateRTShaderModule;
+ bool forceUnoptimized, usePrivateRTShaderModule;
+ SkSL::Version maxVersionAllowed;
};
static_assert(sizeof(Options) == sizeof(KnownOptions));
fHash = SkOpts::hash_fn(&options.forceUnoptimized,
sizeof(options.forceUnoptimized), fHash);
- fHash = SkOpts::hash_fn(&options.enforceES2Restrictions,
- sizeof(options.enforceES2Restrictions), fHash);
fHash = SkOpts::hash_fn(&options.usePrivateRTShaderModule,
sizeof(options.usePrivateRTShaderModule), fHash);
+ fHash = SkOpts::hash_fn(&options.maxVersionAllowed,
+ sizeof(options.maxVersionAllowed), fHash);
fFilterColorProgram = SkFilterColorProgram::Make(this);
}
@@ -608,20 +637,16 @@ size_t SkRuntimeEffect::uniformSize() const {
: SkAlign4(fUniforms.back().offset + fUniforms.back().sizeInBytes());
}
-const SkRuntimeEffect::Uniform* SkRuntimeEffect::findUniform(const char* name) const {
- SkASSERT(name);
- size_t len = strlen(name);
- auto iter = std::find_if(fUniforms.begin(), fUniforms.end(), [name, len](const Uniform& u) {
- return u.name.equals(name, len);
+const SkRuntimeEffect::Uniform* SkRuntimeEffect::findUniform(std::string_view name) const {
+ auto iter = std::find_if(fUniforms.begin(), fUniforms.end(), [name](const Uniform& u) {
+ return u.name == name;
});
return iter == fUniforms.end() ? nullptr : &(*iter);
}
-const SkRuntimeEffect::Child* SkRuntimeEffect::findChild(const char* name) const {
- SkASSERT(name);
- size_t len = strlen(name);
- auto iter = std::find_if(fChildren.begin(), fChildren.end(), [name, len](const Child& c) {
- return c.name.equals(name, len);
+const SkRuntimeEffect::Child* SkRuntimeEffect::findChild(std::string_view name) const {
+ auto iter = std::find_if(fChildren.begin(), fChildren.end(), [name](const Child& c) {
+ return c.name == name;
});
return iter == fChildren.end() ? nullptr : &(*iter);
}
@@ -774,7 +799,7 @@ std::unique_ptr<SkFilterColorProgram> SkFilterColorProgram::Make(const SkRuntime
effect->fMain,
&p,
/*debugTrace=*/nullptr,
- SkMakeSpan(uniform),
+ SkSpan(uniform),
/*device=*/zeroCoord,
/*local=*/zeroCoord,
inputColor,
@@ -835,7 +860,7 @@ SkPMColor4f SkFilterColorProgram::eval(
return result;
}
-const SkFilterColorProgram* SkRuntimeEffect::getFilterColorProgram() {
+const SkFilterColorProgram* SkRuntimeEffect::getFilterColorProgram() const {
return fFilterColorProgram.get();
}
@@ -864,7 +889,8 @@ static GrFPResult make_effect_fp(sk_sp<SkRuntimeEffect> effect,
auto [success, childFP] = as_CFB(child.colorFilter())
->asFragmentProcessor(/*inputFP=*/nullptr,
childArgs.fContext,
- *childArgs.fDstColorInfo);
+ *childArgs.fDstColorInfo,
+ childArgs.fSurfaceProps);
if (!success) {
return GrFPFailure(std::move(inputFP));
}
@@ -873,7 +899,7 @@ static GrFPResult make_effect_fp(sk_sp<SkRuntimeEffect> effect,
// Convert a SkBlender into a child FP.
auto childFP = as_BB(child.blender())->asFragmentProcessor(
/*srcFP=*/nullptr,
- GrFragmentProcessor::UseDestColorAsInput(/*dstFP=*/nullptr),
+ GrFragmentProcessor::DestColor(),
childArgs);
if (!childFP) {
return GrFPFailure(std::move(inputFP));
@@ -890,12 +916,34 @@ static GrFPResult make_effect_fp(sk_sp<SkRuntimeEffect> effect,
std::move(inputFP),
std::move(destColorFP),
std::move(uniforms),
- SkMakeSpan(childFPs));
+ SkSpan(childFPs));
SkASSERT(fp);
return GrFPSuccess(std::move(fp));
}
#endif
+static void add_children_to_key(SkSpan<const SkRuntimeEffect::ChildPtr> children,
+ const SkKeyContext& keyContext,
+ SkPaintParamsKeyBuilder* builder,
+ SkPipelineDataGatherer* gatherer) {
+ for (const SkRuntimeEffect::ChildPtr& child : children) {
+ std::optional<ChildType> type = child.type();
+ if (type == ChildType::kShader) {
+ as_SB(child.shader())->addToKey(keyContext, builder, gatherer);
+ } else if (type == ChildType::kColorFilter) {
+ as_CFB(child.colorFilter())->addToKey(keyContext, builder, gatherer);
+ } else if (type == ChildType::kBlender) {
+ as_BB(child.blender())->addToKey(keyContext, builder, gatherer);
+ } else {
+ // Patch in a "passthrough" child effect that returns the input color as-is.
+ // TODO(skia:13508): if the child is a blender, we should blend the two inputs using
+ // SrcOver, not pass through the source color.
+ PassthroughShaderBlock::BeginBlock(keyContext, builder, gatherer);
+ builder->endBlock();
+ }
+ }
+}
+
class RuntimeEffectVMCallbacks : public SkSL::SkVMCallbacks {
public:
RuntimeEffectVMCallbacks(skvm::Builder* builder,
@@ -974,7 +1022,8 @@ public:
#if SK_SUPPORT_GPU
GrFPResult asFragmentProcessor(std::unique_ptr<GrFragmentProcessor> inputFP,
GrRecordingContext* context,
- const GrColorInfo& colorInfo) const override {
+ const GrColorInfo& colorInfo,
+ const SkSurfaceProps& props) const override {
sk_sp<const SkData> uniforms = SkRuntimeEffectPriv::TransformUniforms(
fEffect->uniforms(),
fUniforms,
@@ -982,17 +1031,27 @@ public:
SkASSERT(uniforms);
SkOverrideDeviceMatrixProvider matrixProvider(SkMatrix::I());
- GrFPArgs childArgs(context, matrixProvider, &colorInfo);
+ GrFPArgs childArgs(context, matrixProvider, &colorInfo, props);
return make_effect_fp(fEffect,
"runtime_color_filter",
std::move(uniforms),
std::move(inputFP),
/*destColorFP=*/nullptr,
- SkMakeSpan(fChildren),
+ SkSpan(fChildren),
childArgs);
}
#endif
+ void addToKey(const SkKeyContext& keyContext,
+ SkPaintParamsKeyBuilder* builder,
+ SkPipelineDataGatherer* gatherer) const override {
+ RuntimeColorFilterBlock::BeginBlock(keyContext, builder, gatherer, {fEffect, fUniforms});
+
+ add_children_to_key(fChildren, keyContext, builder, gatherer);
+
+ builder->endBlock();
+ }
+
bool onAppendStages(const SkStageRec& rec, bool shaderIsOpaque) const override {
return false;
}
@@ -1000,6 +1059,9 @@ public:
skvm::Color onProgram(skvm::Builder* p, skvm::Color c,
const SkColorInfo& colorInfo,
skvm::Uniforms* uniforms, SkArenaAlloc* alloc) const override {
+ SkASSERT(
+ SkRuntimeEffectPriv::CanDraw(SkCapabilities::RasterBackend().get(), fEffect.get()));
+
sk_sp<const SkData> inputs = SkRuntimeEffectPriv::TransformUniforms(
fEffect->uniforms(),
fUniforms,
@@ -1014,7 +1076,7 @@ public:
// something. (Uninitialized values can trigger asserts in skvm::Builder).
skvm::Coord zeroCoord = { p->splat(0.0f), p->splat(0.0f) };
return SkSL::ProgramToSkVM(*fEffect->fBaseProgram, fEffect->fMain, p,/*debugTrace=*/nullptr,
- SkMakeSpan(uniform), /*device=*/zeroCoord, /*local=*/zeroCoord,
+ SkSpan(uniform), /*device=*/zeroCoord, /*local=*/zeroCoord,
c, c, &callbacks);
}
@@ -1094,7 +1156,7 @@ sk_sp<SkFlattenable> SkRuntimeColorFilter::CreateProc(SkReadBuffer& buffer) {
}
#endif
- return effect->makeColorFilter(std::move(uniforms), SkMakeSpan(children));
+ return effect->makeColorFilter(std::move(uniforms), SkSpan(children));
}
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1116,7 +1178,7 @@ public:
sk_sp<SkRuntimeEffect> unoptimized = fEffect->makeUnoptimizedClone();
sk_sp<SkSL::SkVMDebugTrace> debugTrace = make_skvm_debug_trace(unoptimized.get(), coord);
auto debugShader = sk_make_sp<SkRTShader>(unoptimized, debugTrace, fUniforms,
- &this->getLocalMatrix(), SkMakeSpan(fChildren));
+ &this->getLocalMatrix(), SkSpan(fChildren));
return SkRuntimeEffect::TracedShader{std::move(debugShader), std::move(debugTrace)};
}
@@ -1125,6 +1187,10 @@ public:
#if SK_SUPPORT_GPU
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs& args) const override {
+ if (!SkRuntimeEffectPriv::CanDraw(args.fContext->priv().caps(), fEffect.get())) {
+ return nullptr;
+ }
+
SkMatrix matrix;
if (!this->totalLocalMatrix(args.fPreLocalMatrix)->invert(&matrix)) {
return nullptr;
@@ -1136,13 +1202,16 @@ public:
args.fDstColorInfo->colorSpace());
SkASSERT(uniforms);
+ // We handle the pre-local matrix at this level so strip it out.
+ GrFPArgs fpArgs = args;
+ fpArgs.fPreLocalMatrix = nullptr;
auto [success, fp] = make_effect_fp(fEffect,
"runtime_shader",
std::move(uniforms),
/*inputFP=*/nullptr,
/*destColorFP=*/nullptr,
- SkMakeSpan(fChildren),
- args);
+ SkSpan(fChildren),
+ fpArgs);
if (!success) {
return nullptr;
}
@@ -1151,6 +1220,17 @@ public:
}
#endif
+ void addToKey(const SkKeyContext& keyContext,
+ SkPaintParamsKeyBuilder* builder,
+ SkPipelineDataGatherer* gatherer) const override {
+ RuntimeShaderBlock::BeginBlock(keyContext, builder, gatherer,
+ {fEffect, this->getLocalMatrix(), fUniforms});
+
+ add_children_to_key(fChildren, keyContext, builder, gatherer);
+
+ builder->endBlock();
+ }
+
bool onAppendStages(const SkStageRec& rec) const override {
return false;
}
@@ -1160,6 +1240,10 @@ public:
const SkMatrixProvider& matrices, const SkMatrix* localM,
const SkColorInfo& colorInfo,
skvm::Uniforms* uniforms, SkArenaAlloc* alloc) const override {
+ if (!SkRuntimeEffectPriv::CanDraw(SkCapabilities::RasterBackend().get(), fEffect.get())) {
+ return {};
+ }
+
sk_sp<const SkData> inputs = SkRuntimeEffectPriv::TransformUniforms(fEffect->uniforms(),
fUniforms,
colorInfo.colorSpace());
@@ -1176,7 +1260,7 @@ public:
*inputs);
return SkSL::ProgramToSkVM(*fEffect->fBaseProgram, fEffect->fMain, p, fDebugTrace.get(),
- SkMakeSpan(uniform), device, local, paint, paint, &callbacks);
+ SkSpan(uniform), device, local, paint, paint, &callbacks);
}
void flatten(SkWriteBuffer& buffer) const override {
@@ -1250,7 +1334,7 @@ sk_sp<SkFlattenable> SkRTShader::CreateProc(SkReadBuffer& buffer) {
}
#endif
- return effect->makeShader(std::move(uniforms), SkMakeSpan(children), localMPtr);
+ return effect->makeShader(std::move(uniforms), SkSpan(children), localMPtr);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1269,6 +1353,10 @@ public:
skvm::Color onProgram(skvm::Builder* p, skvm::Color src, skvm::Color dst,
const SkColorInfo& colorInfo, skvm::Uniforms* uniforms,
SkArenaAlloc* alloc) const override {
+ if (!SkRuntimeEffectPriv::CanDraw(SkCapabilities::RasterBackend().get(), fEffect.get())) {
+ return {};
+ }
+
sk_sp<const SkData> inputs = SkRuntimeEffectPriv::TransformUniforms(fEffect->uniforms(),
fUniforms,
colorInfo.colorSpace());
@@ -1281,7 +1369,7 @@ public:
// Emit the blend function as an SkVM program.
skvm::Coord zeroCoord = {p->splat(0.0f), p->splat(0.0f)};
return SkSL::ProgramToSkVM(*fEffect->fBaseProgram, fEffect->fMain, p,/*debugTrace=*/nullptr,
- SkMakeSpan(uniform), /*device=*/zeroCoord, /*local=*/zeroCoord,
+ SkSpan(uniform), /*device=*/zeroCoord, /*local=*/zeroCoord,
src, dst, &callbacks);
}
@@ -1290,6 +1378,10 @@ public:
std::unique_ptr<GrFragmentProcessor> srcFP,
std::unique_ptr<GrFragmentProcessor> dstFP,
const GrFPArgs& args) const override {
+ if (!SkRuntimeEffectPriv::CanDraw(args.fContext->priv().caps(), fEffect.get())) {
+ return nullptr;
+ }
+
sk_sp<const SkData> uniforms = SkRuntimeEffectPriv::TransformUniforms(
fEffect->uniforms(),
fUniforms,
@@ -1300,7 +1392,7 @@ public:
std::move(uniforms),
std::move(srcFP),
std::move(dstFP),
- SkMakeSpan(fChildren),
+ SkSpan(fChildren),
args);
return success ? std::move(fp) : nullptr;
@@ -1347,7 +1439,7 @@ sk_sp<SkFlattenable> SkRuntimeBlender::CreateProc(SkReadBuffer& buffer) {
}
#endif
- return effect->makeBlender(std::move(uniforms), SkMakeSpan(children));
+ return effect->makeBlender(std::move(uniforms), SkSpan(children));
}
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1360,7 +1452,7 @@ sk_sp<SkShader> SkRuntimeEffect::makeShader(sk_sp<const SkData> uniforms,
for (size_t i = 0; i < childCount; ++i) {
children.emplace_back(childShaders[i]);
}
- return this->makeShader(std::move(uniforms), SkMakeSpan(children), localMatrix);
+ return this->makeShader(std::move(uniforms), SkSpan(children), localMatrix);
}
sk_sp<SkShader> SkRuntimeEffect::makeShader(sk_sp<const SkData> uniforms,
@@ -1407,7 +1499,8 @@ sk_sp<SkImage> SkRuntimeEffect::makeImage(GrRecordingContext* rContext,
SkOverrideDeviceMatrixProvider matrixProvider(SkMatrix::I());
GrColorInfo colorInfo(resultInfo.colorInfo());
- GrFPArgs args(rContext, matrixProvider, &colorInfo);
+ SkSurfaceProps props{}; // the images this function creates always use the defaults
+ GrFPArgs args(rContext, matrixProvider, &colorInfo, props);
SkSTArray<8, std::unique_ptr<GrFragmentProcessor>> childFPs;
for (size_t i = 0; i < children.size(); ++i) {
// TODO: add support for other types of child effects
@@ -1423,7 +1516,7 @@ sk_sp<SkImage> SkRuntimeEffect::makeImage(GrRecordingContext* rContext,
/*inputFP=*/nullptr,
/*destColorFP=*/nullptr,
std::move(uniforms),
- SkMakeSpan(childFPs));
+ SkSpan(childFPs));
if (localMatrix) {
SkMatrix invLM;
@@ -1474,7 +1567,7 @@ sk_sp<SkColorFilter> SkRuntimeEffect::makeColorFilter(sk_sp<const SkData> unifor
for (size_t i = 0; i < childCount; ++i) {
children.emplace_back(childColorFilters[i]);
}
- return this->makeColorFilter(std::move(uniforms), SkMakeSpan(children));
+ return this->makeColorFilter(std::move(uniforms), SkSpan(children));
}
sk_sp<SkColorFilter> SkRuntimeEffect::makeColorFilter(sk_sp<const SkData> uniforms,
@@ -1583,7 +1676,7 @@ sk_sp<SkImage> SkRuntimeShaderBuilder::makeImage(GrRecordingContext* recordingCo
bool mipmapped) {
return this->effect()->makeImage(recordingContext,
this->uniforms(),
- SkMakeSpan(this->children(), this->numChildren()),
+ SkSpan(this->children(), this->numChildren()),
localMatrix,
resultInfo,
mipmapped);
@@ -1591,7 +1684,7 @@ sk_sp<SkImage> SkRuntimeShaderBuilder::makeImage(GrRecordingContext* recordingCo
sk_sp<SkShader> SkRuntimeShaderBuilder::makeShader(const SkMatrix* localMatrix) {
return this->effect()->makeShader(
- this->uniforms(), SkMakeSpan(this->children(), this->numChildren()), localMatrix);
+ this->uniforms(), SkSpan(this->children(), this->numChildren()), localMatrix);
}
SkRuntimeBlendBuilder::SkRuntimeBlendBuilder(sk_sp<SkRuntimeEffect> effect)
@@ -1601,7 +1694,7 @@ SkRuntimeBlendBuilder::~SkRuntimeBlendBuilder() = default;
sk_sp<SkBlender> SkRuntimeBlendBuilder::makeBlender() {
return this->effect()->makeBlender(this->uniforms(),
- SkMakeSpan(this->children(), this->numChildren()));
+ SkSpan(this->children(), this->numChildren()));
}
#endif // SK_ENABLE_SKSL
diff --git a/chromium/third_party/skia/src/core/SkRuntimeEffectDictionary.h b/chromium/third_party/skia/src/core/SkRuntimeEffectDictionary.h
new file mode 100644
index 00000000000..040f4f94e9d
--- /dev/null
+++ b/chromium/third_party/skia/src/core/SkRuntimeEffectDictionary.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkRuntimeEffectDictionary_DEFINED
+#define SkRuntimeEffectDictionary_DEFINED
+
+#include "include/core/SkRefCnt.h"
+#include "include/effects/SkRuntimeEffect.h"
+#include "include/private/SkTHash.h"
+#include "src/core/SkRuntimeEffectPriv.h"
+
+class SkRuntimeEffect;
+
+// We keep track of all SkRuntimeEffects that are used by a recording, along with their code
+// snippet ID. This ensures that we have a live reference to every effect that we're going to
+// paint, and gives us a way to retrieve their shader text when we see an their code-snippet ID.
+class SkRuntimeEffectDictionary {
+public:
+ const SkRuntimeEffect* find(int codeSnippetID) const {
+ sk_sp<const SkRuntimeEffect>* effect = fDict.find(codeSnippetID);
+ return effect ? effect->get() : nullptr;
+ }
+
+ void set(int codeSnippetID, sk_sp<const SkRuntimeEffect> effect) {
+ // The same code-snippet ID should never refer to two different effects.
+ SkASSERT(!fDict.find(codeSnippetID) || (SkRuntimeEffectPriv::Hash(*fDict[codeSnippetID]) ==
+ SkRuntimeEffectPriv::Hash(*effect)));
+ fDict.set(codeSnippetID, std::move(effect));
+ }
+
+ void reset() { fDict.reset(); }
+
+private:
+ SkTHashMap<int, sk_sp<const SkRuntimeEffect>> fDict;
+};
+
+#endif // SkRuntimeEffectDictionary_DEFINED
diff --git a/chromium/third_party/skia/src/core/SkRuntimeEffectPriv.h b/chromium/third_party/skia/src/core/SkRuntimeEffectPriv.h
index 42349c66c5f..3cc8b7ffee1 100644
--- a/chromium/third_party/skia/src/core/SkRuntimeEffectPriv.h
+++ b/chromium/third_party/skia/src/core/SkRuntimeEffectPriv.h
@@ -17,23 +17,33 @@
#ifdef SK_ENABLE_SKSL
namespace SkSL {
-class Variable;
class Context;
+class Variable;
+struct Program;
}
+class SkCapabilities;
struct SkColorSpaceXformSteps;
class SkRuntimeEffectPriv {
public:
// Helper function when creating an effect for a GrSkSLFP that verifies an effect will
// implement the constant output for constant input optimization flag.
- static bool SupportsConstantOutputForConstantInput(sk_sp<SkRuntimeEffect> effect) {
+ static bool SupportsConstantOutputForConstantInput(const SkRuntimeEffect* effect) {
return effect->getFilterColorProgram();
}
+ static uint32_t Hash(const SkRuntimeEffect& effect) {
+ return effect.hash();
+ }
+
+ static const SkSL::Program& Program(const SkRuntimeEffect& effect) {
+ return *effect.fBaseProgram;
+ }
+
static SkRuntimeEffect::Options ES3Options() {
SkRuntimeEffect::Options options;
- options.enforceES2Restrictions = false;
+ options.maxVersionAllowed = SkSL::Version::k300;
return options;
}
@@ -53,6 +63,9 @@ public:
static sk_sp<const SkData> TransformUniforms(SkSpan<const SkRuntimeEffect::Uniform> uniforms,
sk_sp<const SkData> originalData,
const SkColorSpace* dstCS);
+
+ static bool CanDraw(const SkCapabilities*, const SkSL::Program*);
+ static bool CanDraw(const SkCapabilities*, const SkRuntimeEffect*);
};
// These internal APIs for creating runtime effects vary from the public API in two ways:
@@ -72,50 +85,18 @@ inline sk_sp<SkRuntimeEffect> SkMakeCachedRuntimeEffect(SkRuntimeEffect::Result
}
// Internal API that assumes (and asserts) that the shader code is valid, but does no internal
-// caching. Used when the caller will cache the result in a static variable.
-inline sk_sp<SkRuntimeEffect> SkMakeRuntimeEffect(
+// caching. Used when the caller will cache the result in a static variable. Ownership is passed to
+// the caller; the effect will be leaked if it the pointer is not stored or explicitly deleted.
+inline SkRuntimeEffect* SkMakeRuntimeEffect(
SkRuntimeEffect::Result (*make)(SkString, const SkRuntimeEffect::Options&),
const char* sksl,
SkRuntimeEffect::Options options = SkRuntimeEffect::Options{}) {
SkRuntimeEffectPriv::UsePrivateRTShaderModule(&options);
auto result = make(SkString{sksl}, options);
SkASSERTF(result.effect, "%s", result.errorText.c_str());
- return result.effect;
+ return result.effect.release();
}
-// This is mostly from skvm's rgb->hsl code, with some GPU-related finesse pulled from
-// GrHighContrastFilterEffect.fp, see next comment.
-inline constexpr char kRGB_to_HSL_sksl[] =
- "half3 rgb_to_hsl(half3 c) {"
- "half mx = max(max(c.r,c.g),c.b),"
- " mn = min(min(c.r,c.g),c.b),"
- " d = mx-mn, "
- " invd = 1.0 / d, "
- " g_lt_b = c.g < c.b ? 6.0 : 0.0;"
-
- // We'd prefer to write these tests like `mx == c.r`, but on some GPUs max(x,y) is
- // not always equal to either x or y. So we use long form, c.r >= c.g && c.r >= c.b.
- "half h = (1/6.0) * (mx == mn ? 0.0 :"
- " /*mx==c.r*/ c.r >= c.g && c.r >= c.b ? invd * (c.g - c.b) + g_lt_b :"
- " /*mx==c.g*/ c.g >= c.b ? invd * (c.b - c.r) + 2.0 "
- " /*mx==c.b*/ : invd * (c.r - c.g) + 4.0);"
-
- "half sum = mx+mn,"
- " l = sum * 0.5,"
- " s = mx == mn ? 0.0"
- " : d / (l > 0.5 ? 2.0 - sum : sum);"
- "return half3(h,s,l);"
- "}";
-
-//This is straight out of GrHSLToRGBFilterEffect.fp.
-inline constexpr char kHSL_to_RGB_sksl[] =
- "half3 hsl_to_rgb(half3 hsl) {"
- "half C = (1 - abs(2 * hsl.z - 1)) * hsl.y;"
- "half3 p = hsl.xxx + half3(0, 2/3.0, 1/3.0);"
- "half3 q = saturate(abs(fract(p) * 6 - 3) - 1);"
- "return (q - 0.5) * C + hsl.z;"
- "}";
-
/**
* Runtime effects are often long lived & cached. Individual color filters or FPs created from them
* and are often short-lived. However, color filters and FPs may need to operate on a single color
diff --git a/chromium/third_party/skia/src/core/SkSLTypeShared.cpp b/chromium/third_party/skia/src/core/SkSLTypeShared.cpp
new file mode 100644
index 00000000000..847c4c46d3f
--- /dev/null
+++ b/chromium/third_party/skia/src/core/SkSLTypeShared.cpp
@@ -0,0 +1,213 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "src/core/SkSLTypeShared.h"
+
+const char* SkSLTypeString(SkSLType t) {
+ switch (t) {
+ case SkSLType::kVoid: return "void";
+ case SkSLType::kBool: return "bool";
+ case SkSLType::kBool2: return "bool2";
+ case SkSLType::kBool3: return "bool3";
+ case SkSLType::kBool4: return "bool4";
+ case SkSLType::kShort: return "short";
+ case SkSLType::kShort2: return "short2";
+ case SkSLType::kShort3: return "short3";
+ case SkSLType::kShort4: return "short4";
+ case SkSLType::kUShort: return "ushort";
+ case SkSLType::kUShort2: return "ushort2";
+ case SkSLType::kUShort3: return "ushort3";
+ case SkSLType::kUShort4: return "ushort4";
+ case SkSLType::kFloat: return "float";
+ case SkSLType::kFloat2: return "float2";
+ case SkSLType::kFloat3: return "float3";
+ case SkSLType::kFloat4: return "float4";
+ case SkSLType::kFloat2x2: return "float2x2";
+ case SkSLType::kFloat3x3: return "float3x3";
+ case SkSLType::kFloat4x4: return "float4x4";
+ case SkSLType::kHalf: return "half";
+ case SkSLType::kHalf2: return "half2";
+ case SkSLType::kHalf3: return "half3";
+ case SkSLType::kHalf4: return "half4";
+ case SkSLType::kHalf2x2: return "half2x2";
+ case SkSLType::kHalf3x3: return "half3x3";
+ case SkSLType::kHalf4x4: return "half4x4";
+ case SkSLType::kInt: return "int";
+ case SkSLType::kInt2: return "int2";
+ case SkSLType::kInt3: return "int3";
+ case SkSLType::kInt4: return "int4";
+ case SkSLType::kUInt: return "uint";
+ case SkSLType::kUInt2: return "uint2";
+ case SkSLType::kUInt3: return "uint3";
+ case SkSLType::kUInt4: return "uint4";
+ case SkSLType::kTexture2DSampler: return "sampler2D";
+ case SkSLType::kTextureExternalSampler: return "samplerExternalOES";
+ case SkSLType::kTexture2DRectSampler: return "sampler2DRect";
+ case SkSLType::kTexture2D: return "texture2D";
+ case SkSLType::kSampler: return "sampler";
+ case SkSLType::kInput: return "subpassInput";
+ }
+ SkUNREACHABLE;
+}
+
+/** Is the shading language type full precision? */
+bool SkSLTypeIsFullPrecisionNumericType(SkSLType type) {
+ switch (type) {
+ // Half-precision types:
+ case SkSLType::kShort:
+ case SkSLType::kShort2:
+ case SkSLType::kShort3:
+ case SkSLType::kShort4:
+ case SkSLType::kUShort:
+ case SkSLType::kUShort2:
+ case SkSLType::kUShort3:
+ case SkSLType::kUShort4:
+ case SkSLType::kHalf:
+ case SkSLType::kHalf2:
+ case SkSLType::kHalf3:
+ case SkSLType::kHalf4:
+ case SkSLType::kHalf2x2:
+ case SkSLType::kHalf3x3:
+ case SkSLType::kHalf4x4:
+ // Non-numeric types:
+ case SkSLType::kVoid:
+ case SkSLType::kTexture2DSampler:
+ case SkSLType::kTextureExternalSampler:
+ case SkSLType::kTexture2DRectSampler:
+ case SkSLType::kTexture2D:
+ case SkSLType::kSampler:
+ case SkSLType::kInput:
+ case SkSLType::kBool:
+ case SkSLType::kBool2:
+ case SkSLType::kBool3:
+ case SkSLType::kBool4:
+ return false;
+
+ // Full-precision numeric types:
+ case SkSLType::kInt:
+ case SkSLType::kInt2:
+ case SkSLType::kInt3:
+ case SkSLType::kInt4:
+ case SkSLType::kUInt:
+ case SkSLType::kUInt2:
+ case SkSLType::kUInt3:
+ case SkSLType::kUInt4:
+ case SkSLType::kFloat:
+ case SkSLType::kFloat2:
+ case SkSLType::kFloat3:
+ case SkSLType::kFloat4:
+ case SkSLType::kFloat2x2:
+ case SkSLType::kFloat3x3:
+ case SkSLType::kFloat4x4:
+ return true;
+ }
+ SkUNREACHABLE;
+}
+
+int SkSLTypeMatrixSize(SkSLType type) {
+ switch (type) {
+ case SkSLType::kFloat2x2:
+ case SkSLType::kHalf2x2:
+ return 2;
+
+ case SkSLType::kFloat3x3:
+ case SkSLType::kHalf3x3:
+ return 3;
+
+ case SkSLType::kFloat4x4:
+ case SkSLType::kHalf4x4:
+ return 4;
+
+ case SkSLType::kFloat:
+ case SkSLType::kHalf:
+ case SkSLType::kBool:
+ case SkSLType::kShort:
+ case SkSLType::kUShort:
+ case SkSLType::kInt:
+ case SkSLType::kUInt:
+ case SkSLType::kFloat2:
+ case SkSLType::kHalf2:
+ case SkSLType::kBool2:
+ case SkSLType::kShort2:
+ case SkSLType::kUShort2:
+ case SkSLType::kInt2:
+ case SkSLType::kUInt2:
+ case SkSLType::kFloat3:
+ case SkSLType::kHalf3:
+ case SkSLType::kBool3:
+ case SkSLType::kShort3:
+ case SkSLType::kUShort3:
+ case SkSLType::kInt3:
+ case SkSLType::kUInt3:
+ case SkSLType::kFloat4:
+ case SkSLType::kHalf4:
+ case SkSLType::kBool4:
+ case SkSLType::kShort4:
+ case SkSLType::kUShort4:
+ case SkSLType::kInt4:
+ case SkSLType::kUInt4:
+ case SkSLType::kVoid:
+ case SkSLType::kTexture2DSampler:
+ case SkSLType::kTextureExternalSampler:
+ case SkSLType::kTexture2DRectSampler:
+ case SkSLType::kTexture2D:
+ case SkSLType::kSampler:
+ case SkSLType::kInput:
+ return -1;
+ }
+ SkUNREACHABLE;
+}
+
+bool SkSLTypeIsCombinedSamplerType(SkSLType type) {
+ switch (type) {
+ case SkSLType::kTexture2DRectSampler:
+ case SkSLType::kTexture2DSampler:
+ case SkSLType::kTextureExternalSampler:
+ return true;
+
+ case SkSLType::kVoid:
+ case SkSLType::kFloat:
+ case SkSLType::kFloat2:
+ case SkSLType::kFloat3:
+ case SkSLType::kFloat4:
+ case SkSLType::kFloat2x2:
+ case SkSLType::kFloat3x3:
+ case SkSLType::kFloat4x4:
+ case SkSLType::kHalf:
+ case SkSLType::kHalf2:
+ case SkSLType::kHalf3:
+ case SkSLType::kHalf4:
+ case SkSLType::kHalf2x2:
+ case SkSLType::kHalf3x3:
+ case SkSLType::kHalf4x4:
+ case SkSLType::kInt:
+ case SkSLType::kInt2:
+ case SkSLType::kInt3:
+ case SkSLType::kInt4:
+ case SkSLType::kUInt:
+ case SkSLType::kUInt2:
+ case SkSLType::kUInt3:
+ case SkSLType::kUInt4:
+ case SkSLType::kBool:
+ case SkSLType::kBool2:
+ case SkSLType::kBool3:
+ case SkSLType::kBool4:
+ case SkSLType::kShort:
+ case SkSLType::kShort2:
+ case SkSLType::kShort3:
+ case SkSLType::kShort4:
+ case SkSLType::kUShort:
+ case SkSLType::kUShort2:
+ case SkSLType::kUShort3:
+ case SkSLType::kUShort4:
+ case SkSLType::kTexture2D:
+ case SkSLType::kSampler:
+ case SkSLType::kInput:
+ return false;
+ }
+ SkUNREACHABLE;
+}
diff --git a/chromium/third_party/skia/src/core/SkSLTypeShared.h b/chromium/third_party/skia/src/core/SkSLTypeShared.h
index 88f6a3f0967..d4b49b32a9f 100644
--- a/chromium/third_party/skia/src/core/SkSLTypeShared.h
+++ b/chromium/third_party/skia/src/core/SkSLTypeShared.h
@@ -60,6 +60,9 @@ enum class SkSLType : char {
};
static const int kSkSLTypeCount = static_cast<int>(SkSLType::kLast) + 1;
+/** Returns the SkSL typename for this type. */
+const char* SkSLTypeString(SkSLType t);
+
/** Is the shading language type float (including vectors/matrices)? */
static constexpr bool SkSLTypeIsFloatType(SkSLType type) {
switch (type) {
@@ -162,15 +165,7 @@ static constexpr bool SkSLTypeIsIntegralType(SkSLType type) {
SkUNREACHABLE;
}
-/**
- * Is the shading language type supported as a uniform (ie, does it have a corresponding set
- * function on GrGLSLProgramDataManager)?
- */
-static constexpr bool SkSLTypeCanBeUniformValue(SkSLType type) {
- return SkSLTypeIsFloatType(type) || SkSLTypeIsIntegralType(type);
-}
-
-/** If the type represents a single value or vector return the vector length, else -1. */
+/** If the type represents a single value or vector return the vector length; otherwise, -1. */
static constexpr int SkSLTypeVecLength(SkSLType type) {
switch (type) {
case SkSLType::kFloat:
@@ -227,54 +222,21 @@ static constexpr int SkSLTypeVecLength(SkSLType type) {
SkUNREACHABLE;
}
-static constexpr bool SkSLTypeIsCombinedSamplerType(SkSLType type) {
- switch (type) {
- case SkSLType::kTexture2DSampler:
- case SkSLType::kTextureExternalSampler:
- case SkSLType::kTexture2DRectSampler:
- return true;
-
- case SkSLType::kVoid:
- case SkSLType::kFloat:
- case SkSLType::kFloat2:
- case SkSLType::kFloat3:
- case SkSLType::kFloat4:
- case SkSLType::kFloat2x2:
- case SkSLType::kFloat3x3:
- case SkSLType::kFloat4x4:
- case SkSLType::kHalf:
- case SkSLType::kHalf2:
- case SkSLType::kHalf3:
- case SkSLType::kHalf4:
- case SkSLType::kHalf2x2:
- case SkSLType::kHalf3x3:
- case SkSLType::kHalf4x4:
- case SkSLType::kInt:
- case SkSLType::kInt2:
- case SkSLType::kInt3:
- case SkSLType::kInt4:
- case SkSLType::kUInt:
- case SkSLType::kUInt2:
- case SkSLType::kUInt3:
- case SkSLType::kUInt4:
- case SkSLType::kBool:
- case SkSLType::kBool2:
- case SkSLType::kBool3:
- case SkSLType::kBool4:
- case SkSLType::kShort:
- case SkSLType::kShort2:
- case SkSLType::kShort3:
- case SkSLType::kShort4:
- case SkSLType::kUShort:
- case SkSLType::kUShort2:
- case SkSLType::kUShort3:
- case SkSLType::kUShort4:
- case SkSLType::kTexture2D:
- case SkSLType::kSampler:
- case SkSLType::kInput:
- return false;
- }
- SkUNREACHABLE;
+/**
+ * Is the shading language type supported as a uniform (ie, does it have a corresponding set
+ * function on GrGLSLProgramDataManager)?
+ */
+static constexpr bool SkSLTypeCanBeUniformValue(SkSLType type) {
+ return SkSLTypeIsFloatType(type) || SkSLTypeIsIntegralType(type);
}
+/** Is the shading language type full precision? */
+bool SkSLTypeIsFullPrecisionNumericType(SkSLType type);
+
+/** If the type represents a square matrix, return its size; otherwise, -1. */
+int SkSLTypeMatrixSize(SkSLType type);
+
+/** If the type represents a square matrix, return its size; otherwise, -1. */
+bool SkSLTypeIsCombinedSamplerType(SkSLType type);
+
#endif // SkSLTypeShared_DEFINED
diff --git a/chromium/third_party/skia/src/core/SkScalerCache.cpp b/chromium/third_party/skia/src/core/SkScalerCache.cpp
index f087fa117d2..8fa5c555c5c 100644
--- a/chromium/third_party/skia/src/core/SkScalerCache.cpp
+++ b/chromium/third_party/skia/src/core/SkScalerCache.cpp
@@ -11,9 +11,11 @@
#include "include/core/SkGraphics.h"
#include "include/core/SkPath.h"
#include "include/core/SkTypeface.h"
+#include "src/core/SkDistanceFieldGen.h"
#include "src/core/SkEnumerate.h"
#include "src/core/SkGlyphBuffer.h"
#include "src/core/SkScalerContext.h"
+#include "src/text/StrikeForGPU.h"
static SkFontMetrics use_or_generate_metrics(
const SkFontMetrics* metrics, SkScalerContext* context) {
@@ -173,6 +175,18 @@ std::tuple<SkSpan<const SkGlyph*>, size_t> SkScalerCache::preparePaths(
return {glyphs, delta};
}
+size_t SkScalerCache::glyphIDsToPaths(SkSpan<sktext::IDOrPath> idsOrPaths) {
+ size_t increase = 0;
+ SkAutoMutexExclusive lock{fMu};
+ for (sktext::IDOrPath& idOrPath : idsOrPaths) {
+ auto [glyph, size] = this->glyph(SkPackedGlyphID{idOrPath.fGlyphID});
+ increase += size;
+ increase += this->preparePath(glyph);
+ new (&idOrPath.fPath) SkPath{*glyph->path()};
+ }
+ return increase;
+}
+
std::tuple<SkSpan<const SkGlyph*>, size_t> SkScalerCache::prepareImages(
SkSpan<const SkPackedGlyphID> glyphIDs, const SkGlyph* results[]) {
const SkGlyph** cursor = results;
@@ -203,6 +217,32 @@ std::tuple<SkSpan<const SkGlyph*>, size_t> SkScalerCache::prepareDrawables(
return {{results, glyphIDs.size()}, delta};
}
+size_t SkScalerCache::glyphIDsToDrawables(SkSpan<sktext::IDOrDrawable> idsOrDrawables) {
+ size_t increase = 0;
+ SkAutoMutexExclusive lock{fMu};
+ for (sktext::IDOrDrawable& idOrDrawable : idsOrDrawables) {
+ auto [glyph, size] = this->glyph(SkPackedGlyphID{idOrDrawable.fGlyphID});
+ increase += size;
+ increase += this->prepareDrawable(glyph);
+ SkASSERT(glyph->drawable() != nullptr);
+ idOrDrawable.fDrawable = glyph->drawable();
+ }
+ return increase;
+}
+
+std::tuple<SkScalar, size_t> SkScalerCache::findMaximumGlyphDimension(
+ SkSpan<const SkGlyphID> glyphs) {
+ size_t totalIncrease = 0;
+ SkScalar maxDimension = 0;
+ SkAutoMutexExclusive lock{fMu};
+ for (SkGlyphID glyphID : glyphs) {
+ auto [digest, increase] = this->digest(SkPackedGlyphID{glyphID});
+ totalIncrease += increase;
+ maxDimension = std::max(static_cast<SkScalar>(digest.maxDimension()), maxDimension);
+ }
+ return {maxDimension, totalIncrease};
+}
+
template <typename Fn>
size_t SkScalerCache::commonFilterLoop(SkDrawableGlyphBuffer* accepted, Fn&& fn) {
size_t total = 0;
@@ -236,78 +276,117 @@ size_t SkScalerCache::prepareForDrawingMasksCPU(SkDrawableGlyphBuffer* accepted)
}
// Note: this does not actually fill out the image. That happens at atlas building time.
-size_t SkScalerCache::prepareForMaskDrawing(
- SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected) {
+std::tuple<SkRect, size_t> SkScalerCache::prepareForMaskDrawing(
+ SkScalar strikeToSourceScale,
+ SkDrawableGlyphBuffer* accepted,
+ SkSourceGlyphBuffer* rejected) {
SkAutoMutexExclusive lock{fMu};
- size_t delta = this->commonFilterLoop(accepted,
- [&](size_t i, SkGlyphDigest digest, SkPoint pos) SK_REQUIRES(fMu) {
- // N.B. this must have the same behavior as RemoteStrike::prepareForMaskDrawing.
- if (digest.canDrawAsMask()) {
- accepted->accept(fGlyphForIndex[digest.index()], i);
- } else {
- rejected->reject(i, digest.maxDimension());
+
+ SkGlyphRect boundingRect = skglyph::empty_rect();
+ size_t increase = 0;
+
+ for (auto [i, packedID, pos] : SkMakeEnumerate(accepted->input())) {
+ if (SkScalarsAreFinite(pos.x(), pos.y())) {
+ auto [digest, glyphIncrease] = this->digest(packedID);
+ increase += glyphIncrease;
+ if (!digest.isEmpty()) {
+ // N.B. this must have the same behavior as RemoteStrike::prepareForMaskDrawing.
+ if (digest.canDrawAsMask()) {
+ const SkGlyphRect glyphBounds =
+ digest.bounds().scaleAndOffset(strikeToSourceScale, pos);
+ boundingRect = skglyph::rect_union(boundingRect, glyphBounds);
+ accepted->accept(packedID, glyphBounds.leftTop(), digest.maskFormat());
+ } else {
+ rejected->reject(i);
+ }
}
- });
+ }
+ }
- return delta;
+ return {boundingRect.rect(), increase};
}
-size_t SkScalerCache::prepareForSDFTDrawing(
- SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected) {
+std::tuple<SkRect, size_t> SkScalerCache::prepareForSDFTDrawing(
+ SkScalar strikeToSourceScale,
+ SkDrawableGlyphBuffer* accepted,
+ SkSourceGlyphBuffer* rejected) {
SkAutoMutexExclusive lock{fMu};
- size_t delta = this->commonFilterLoop(accepted,
- [&](size_t i, SkGlyphDigest digest, SkPoint pos) SK_REQUIRES(fMu) {
- if (digest.canDrawAsSDFT()) {
- accepted->accept(fGlyphForIndex[digest.index()], i);
- } else {
- // Assume whatever follows SDF doesn't care about the maximum rejected size.
- rejected->reject(i);
+
+ SkGlyphRect boundingRect = skglyph::empty_rect();
+ size_t increase = 0;
+
+ for (auto [i, packedID, pos] : SkMakeEnumerate(accepted->input())) {
+ if (SkScalarsAreFinite(pos.x(), pos.y())) {
+ auto [digest, glyphIncrease] = this->digest(packedID);
+ increase += glyphIncrease;
+ if (!digest.isEmpty()) {
+ if (digest.canDrawAsSDFT()) {
+ // The SDFT glyphs have 2-pixel wide padding that should not be used in
+ // calculating the source rectangle.
+ const SkGlyphRect glyphBounds =
+ digest.bounds()
+ .inset(SK_DistanceFieldInset, SK_DistanceFieldInset)
+ .scaleAndOffset(strikeToSourceScale, pos);
+ boundingRect = skglyph::rect_union(boundingRect, glyphBounds);
+ accepted->accept(packedID, glyphBounds.leftTop(), digest.maskFormat());
+ } else {
+ // Assume whatever follows SDF doesn't care about the maximum rejected size.
+ rejected->reject(i);
+ }
}
- });
+ }
+ }
- return delta;
+ return {boundingRect.rect(), increase};
}
size_t SkScalerCache::prepareForPathDrawing(
SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected) {
SkAutoMutexExclusive lock{fMu};
- size_t pathDelta = 0;
- size_t delta = this->commonFilterLoop(accepted,
- [&](size_t i, SkGlyphDigest digest, SkPoint pos) SK_REQUIRES(fMu) {
- SkGlyph* glyph = fGlyphForIndex[digest.index()];
- auto pathSize = this->preparePath(glyph);
- pathDelta += pathSize;
- if (glyph->path() != nullptr) {
- // Save off the path to draw later.
- accepted->accept(glyph, i);
- } else {
- // Glyph does not have a path.
- rejected->reject(i, digest.maxDimension());
+ size_t increase = 0;
+ for (auto [i, packedID, pos] : SkMakeEnumerate(accepted->input())) {
+ if (SkScalarsAreFinite(pos.x(), pos.y())) {
+ auto [digest, glyphIncrease] = this->digest(packedID);
+ increase += glyphIncrease;
+ if (!digest.isEmpty()) {
+ SkGlyph* glyph = fGlyphForIndex[digest.index()];
+ increase += this->preparePath(glyph);
+ if (glyph->path() != nullptr) {
+ // Save off the path to draw later.
+ accepted->accept(packedID, pos);
+ } else {
+ // Glyph does not have a path.
+ rejected->reject(i);
+ }
}
- });
-
- return delta + pathDelta;
+ }
+ }
+ return increase;
}
size_t SkScalerCache::prepareForDrawableDrawing(
SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected) {
SkAutoMutexExclusive lock{fMu};
- size_t drawableDelta = 0;
- size_t delta = this->commonFilterLoop(accepted,
- [&](size_t i, SkGlyphDigest digest, SkPoint pos) SK_REQUIRES(fMu) {
- SkGlyph* glyph = fGlyphForIndex[digest.index()];
- size_t drawableSize = this->prepareDrawable(glyph);
- drawableDelta += drawableSize;
- if (glyph->drawable() != nullptr) {
- // Save off the drawable to draw later.
- accepted->accept(glyph, i);
- } else {
- // Glyph does not have a drawable.
- rejected->reject(i, glyph->maxDimension());
+ size_t increase = 0;
+ for (auto [i, packedID, pos] : SkMakeEnumerate(accepted->input())) {
+ if (SkScalarsAreFinite(pos.x(), pos.y())) {
+ auto [digest, glyphIncrease] = this->digest(packedID);
+ increase += glyphIncrease;
+ if (!digest.isEmpty()) {
+ SkGlyph* glyph = fGlyphForIndex[digest.index()];
+ increase += this->prepareDrawable(glyph);
+ if (glyph->drawable() != nullptr) {
+ // Save off the drawable to draw later.
+ accepted->accept(packedID, pos);
+ } else {
+ // Glyph does not have a drawable.
+ rejected->reject(i);
+ }
}
- });
+ }
+ }
- return delta + drawableDelta;
+ return increase;
}
void SkScalerCache::findIntercepts(const SkScalar bounds[2], SkScalar scale, SkScalar xPos,
diff --git a/chromium/third_party/skia/src/core/SkScalerCache.h b/chromium/third_party/skia/src/core/SkScalerCache.h
index ba538c81fc8..f78a9e7c70b 100644
--- a/chromium/third_party/skia/src/core/SkScalerCache.h
+++ b/chromium/third_party/skia/src/core/SkScalerCache.h
@@ -16,10 +16,14 @@
#include "src/core/SkDescriptor.h"
#include "src/core/SkGlyph.h"
#include "src/core/SkGlyphRunPainter.h"
-#include "src/core/SkStrikeForGPU.h"
+
#include <memory>
class SkScalerContext;
+namespace sktext {
+union IDOrPath;
+union IDOrDrawable;
+} // namespace sktext
// This class represents a strike: a specific combination of typeface, size, matrix, etc., and
// holds the glyphs for that strike.
@@ -75,11 +79,15 @@ public:
return fRoundingSpec;
}
- size_t prepareForMaskDrawing(
- SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected) SK_EXCLUDES(fMu);
+ std::tuple<SkRect, size_t> prepareForMaskDrawing(
+ SkScalar strikeToSourceScale,
+ SkDrawableGlyphBuffer* accepted,
+ SkSourceGlyphBuffer* rejected) SK_EXCLUDES(fMu);
- size_t prepareForSDFTDrawing(
- SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected) SK_EXCLUDES(fMu);
+ std::tuple<SkRect, size_t> prepareForSDFTDrawing(
+ SkScalar strikeToSourceScale,
+ SkDrawableGlyphBuffer* accepted,
+ SkSourceGlyphBuffer* rejected) SK_EXCLUDES(fMu);
size_t prepareForPathDrawing(
SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected) SK_EXCLUDES(fMu);
@@ -87,6 +95,15 @@ public:
size_t prepareForDrawableDrawing(
SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected) SK_EXCLUDES(fMu);
+ // Convert all the IDs into SkPaths in the span.
+ size_t glyphIDsToPaths(SkSpan<sktext::IDOrPath> idsOrPaths) SK_EXCLUDES(fMu);
+
+ // Convert all the IDs into SkDrawables in the span.
+ size_t glyphIDsToDrawables(SkSpan<sktext::IDOrDrawable> idsOrDrawables) SK_EXCLUDES(fMu);
+
+ std::tuple<SkScalar, size_t>
+ findMaximumGlyphDimension(SkSpan<const SkGlyphID> glyphs) SK_EXCLUDES(fMu);
+
void dump() const SK_EXCLUDES(fMu);
SkScalerContext* getScalerContext() const { return fScalerContext.get(); }
diff --git a/chromium/third_party/skia/src/core/SkScalerContext.h b/chromium/third_party/skia/src/core/SkScalerContext.h
index c78f9e5379b..1dedd97546d 100644
--- a/chromium/third_party/skia/src/core/SkScalerContext.h
+++ b/chromium/third_party/skia/src/core/SkScalerContext.h
@@ -20,7 +20,6 @@
#include "src/core/SkGlyph.h"
#include "src/core/SkMask.h"
#include "src/core/SkMaskGamma.h"
-#include "src/core/SkStrikeForGPU.h"
#include "src/core/SkSurfacePriv.h"
#include "src/core/SkWriteBuffer.h"
diff --git a/chromium/third_party/skia/src/core/SkScan_Hairline.cpp b/chromium/third_party/skia/src/core/SkScan_Hairline.cpp
index 3903a471f7b..b44279241c5 100644
--- a/chromium/third_party/skia/src/core/SkScan_Hairline.cpp
+++ b/chromium/third_party/skia/src/core/SkScan_Hairline.cpp
@@ -252,7 +252,7 @@ static void hair_quad(const SkPoint pts[3], const SkRegion* clip,
float2 dt(SK_Scalar1 / lines);
SkPoint tmp[(1 << kMaxQuadSubdivideLevel) + 1];
- SkASSERT((unsigned)lines < SK_ARRAY_COUNT(tmp));
+ SkASSERT((unsigned)lines < std::size(tmp));
tmp[0] = pts[0];
float2 A = coeff.fA;
@@ -379,7 +379,7 @@ static void hair_cubic(const SkPoint pts[4], const SkRegion* clip, SkBlitter* bl
float2 t(0);
SkPoint tmp[(1 << kMaxCubicSubdivideLevel) + 1];
- SkASSERT((unsigned)lines < SK_ARRAY_COUNT(tmp));
+ SkASSERT((unsigned)lines < std::size(tmp));
tmp[0] = pts[0];
float2 A = coeff.fA;
diff --git a/chromium/third_party/skia/src/core/SkShaderCodeDictionary.cpp b/chromium/third_party/skia/src/core/SkShaderCodeDictionary.cpp
index 69345ebb1e2..dfe67bc101c 100644
--- a/chromium/third_party/skia/src/core/SkShaderCodeDictionary.cpp
+++ b/chromium/third_party/skia/src/core/SkShaderCodeDictionary.cpp
@@ -7,139 +7,115 @@
#include "src/core/SkShaderCodeDictionary.h"
-#include "include/core/SkCombinationBuilder.h"
+#include "include/core/SkTileMode.h"
#include "include/effects/SkRuntimeEffect.h"
-#include "include/private/SkSLString.h"
-#include "src/core/SkOpts.h"
-#include "src/sksl/SkSLUtil.h"
+#include "include/private/SkOpts_spi.h"
+#include "src/core/SkRuntimeEffectPriv.h"
+#include "src/core/SkSLTypeShared.h"
#ifdef SK_GRAPHITE_ENABLED
#include "include/gpu/graphite/Context.h"
+#include "include/private/SkSLString.h"
+#include "src/core/SkRuntimeEffectDictionary.h"
+#include "src/gpu/graphite/ContextUtils.h"
+#include "src/gpu/graphite/Renderer.h"
+#include "src/sksl/codegen/SkSLPipelineStageCodeGenerator.h"
+#include "src/sksl/ir/SkSLVarDeclarations.h"
#endif
-namespace {
-
-std::string get_mangled_local_var_name(const char* baseName, int manglingSuffix) {
- return std::string(baseName) + "_" + std::to_string(manglingSuffix);
-}
-
-void add_indent(std::string* result, int indent) {
- result->append(4*indent, ' ');
-}
-
-#if SK_SUPPORT_GPU && defined(SK_GRAPHITE_ENABLED) && defined(SK_METAL)
-std::string generate_default_before_children_glue_code(int entryIndex,
- const SkPaintParamsKey::BlockReader& reader,
- const std::string& parentPreLocalName,
- int indent) {
- std::string result;
-
- if (reader.entry()->needsLocalCoords()) {
- // Every snippet that requests local coordinates must have a preLocalMatrix as its first
- // uniform
- SkASSERT(reader.entry()->fUniforms.size() >= 1);
- SkASSERT(reader.entry()->fUniforms[0].type() == SkSLType::kFloat4x4);
+#ifdef SK_ENABLE_PRECOMPILE
+#include "include/core/SkCombinationBuilder.h"
+#endif
- std::string localMatrixUniformName = reader.entry()->getMangledUniformName(0, entryIndex);
+#include <new>
- std::string preLocalMatrixVarName = get_mangled_local_var_name("preLocal", entryIndex);
+using DataPayloadField = SkPaintParamsKey::DataPayloadField;
+using DataPayloadType = SkPaintParamsKey::DataPayloadType;
- add_indent(&result, indent);
- SkSL::String::appendf(&result,
- "float4x4 %s = %s * %s;\n",
- preLocalMatrixVarName.c_str(),
- parentPreLocalName.c_str(),
- localMatrixUniformName.c_str());
- }
+namespace {
- return result;
+#if defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
+std::string get_mangled_name(const std::string& baseName, int manglingSuffix) {
+ return baseName + "_" + std::to_string(manglingSuffix);
}
#endif
} // anonymous namespace
-std::string SkShaderSnippet::getMangledUniformName(int uniformIndex, int mangleId) const {
+std::string SkShaderSnippet::getMangledUniformName(int uniformIdx, int mangleId) const {
std::string result;
- result = fUniforms[uniformIndex].name() + std::string("_") + std::to_string(mangleId);
+ result = fUniforms[uniformIdx].name() + std::string("_") + std::to_string(mangleId);
return result;
}
-// TODO: SkShaderInfo::toSkSL needs to work outside of both just graphite and metal. To do
-// so we'll need to switch over to using SkSL's uniform capabilities.
-#if SK_SUPPORT_GPU && defined(SK_GRAPHITE_ENABLED) && defined(SK_METAL)
+std::string SkShaderSnippet::getMangledSamplerName(int samplerIdx, int mangleId) const {
+ std::string result;
+ result = fTexturesAndSamplers[samplerIdx].name() + std::string("_") + std::to_string(mangleId);
+ return result;
+}
-// TODO: switch this over to using SkSL's uniform system
-namespace skgpu::graphite {
-std::string GetMtlUniforms(int bufferID,
- const char* name,
- const std::vector<SkPaintParamsKey::BlockReader>&,
- bool needsDev2Local);
-std::string GetMtlTexturesAndSamplers(const std::vector<SkPaintParamsKey::BlockReader>&,
- int* binding);
-} // namespace skgpu::graphite
+#if defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
-// Emit the glue code needed to invoke a single static helper isolated w/in its own scope.
-// The structure of this will be:
-//
-// half4 outColor%d;
-// {
-// half4 child-outColor%d; // for each child
-// {
-// /* emitted snippet sksl assigns to child-outColor%d */
-// }
-//
-// /* emitted snippet sksl assigns to outColor%d - taking a vector of child var names */
-// }
-// Where the %d is filled in with 'entryIndex'.
-std::string SkShaderInfo::emitGlueCodeForEntry(int* entryIndex,
- const std::string& priorStageOutputName,
- const std::string& parentPreLocalName,
- std::string* result,
- int indent) const {
- const SkPaintParamsKey::BlockReader& reader = fBlockReaders[*entryIndex];
- int curEntryIndex = *entryIndex;
+// Returns an expression to invoke this entry, passing along an updated pre-local matrix.
+static std::string emit_expression_for_entry(const SkShaderInfo& shaderInfo,
+ int entryIndex,
+ const std::string& priorStageOutputName,
+ const std::string& fragCoord,
+ std::string preLocalMatrix) {
+ const SkPaintParamsKey::BlockReader& reader = shaderInfo.blockReader(entryIndex);
+ const SkShaderSnippet* entry = reader.entry();
- std::string scopeOutputVar = get_mangled_local_var_name("outColor", curEntryIndex);
+ if (entry->needsLocalCoords()) {
+ // The snippet requested local coordinates; the pre-local matrix must be its first uniform.
+ SkASSERT(entry->fUniforms.size() >= 1);
+ SkASSERT(entry->fUniforms.front().type() == SkSLType::kFloat4x4);
- add_indent(result, indent);
- SkSL::String::appendf(result,
- "half4 %s; // output of %s\n",
- scopeOutputVar.c_str(),
- reader.entry()->fName);
- add_indent(result, indent);
- *result += "{\n";
+ // Multiply in this entry's pre-local coordinate matrix.
+ preLocalMatrix += " * ";
+ preLocalMatrix += entry->getMangledUniformName(0, entryIndex);
+ }
- *result += generate_default_before_children_glue_code(curEntryIndex, reader,
- parentPreLocalName, indent+1);
+ return entry->fExpressionGenerator(shaderInfo, entryIndex, reader, priorStageOutputName,
+ fragCoord, preLocalMatrix);
+}
- // TODO: this could be returned by generate_default_before_children_glue_code
- std::string currentPreLocalName;
- if (reader.entry()->needsLocalCoords()) {
- currentPreLocalName = get_mangled_local_var_name("preLocal", curEntryIndex);
- } else {
- currentPreLocalName = parentPreLocalName;
- }
+// Emit the glue code needed to invoke a single static helper isolated within its own scope.
+// Glue code will assign the resulting color into a variable `half4 outColor%d`, where the %d is
+// filled in with 'entryIndex'.
+static std::string emit_glue_code_for_entry(const SkShaderInfo& shaderInfo,
+ int entryIndex,
+ const std::string& priorStageOutputName,
+ const std::string& fragCoord,
+ const std::string& parentPreLocalName,
+ std::string* funcBody) {
+ const SkShaderSnippet* entry = shaderInfo.blockReader(entryIndex).entry();
+
+ std::string expr = emit_expression_for_entry(shaderInfo,
+ entryIndex,
+ priorStageOutputName,
+ fragCoord,
+ parentPreLocalName);
+ std::string outputVar = get_mangled_name("outColor", entryIndex);
+ SkSL::String::appendf(funcBody,
+ " // %s\n"
+ " half4 %s = %s;\n",
+ entry->fName,
+ outputVar.c_str(),
+ expr.c_str());
+ return outputVar;
+}
- // Although the children appear after the parent in the shader info they are emitted
- // before the parent
- std::vector<std::string> childOutputVarNames;
- for (int j = 0; j < reader.numChildren(); ++j) {
- *entryIndex += 1;
- std::string childOutputVar = this->emitGlueCodeForEntry(entryIndex,
- priorStageOutputName,
- currentPreLocalName,
- result, indent+1);
- childOutputVarNames.push_back(childOutputVar);
- }
+static void emit_preamble_for_entry(const SkShaderInfo& shaderInfo,
+ int* entryIndex,
+ std::string* preamble) {
+ const SkPaintParamsKey::BlockReader& reader = shaderInfo.blockReader(*entryIndex);
- *result += (reader.entry()->fGlueCodeGenerator)(scopeOutputVar, curEntryIndex, reader,
- priorStageOutputName,
- childOutputVarNames, indent+1);
- add_indent(result, indent);
- *result += "}\n";
+ [[maybe_unused]] int startingEntryIndex = *entryIndex;
+ reader.entry()->fPreambleGenerator(shaderInfo, entryIndex, reader, preamble);
- return scopeOutputVar;
+ // Preamble generators are responsible for increasing the entry index as entries are consumed.
+ SkASSERT(*entryIndex > startingEntryIndex);
}
// The current, incomplete, model for shader construction is:
@@ -152,36 +128,71 @@ std::string SkShaderInfo::emitGlueCodeForEntry(int* entryIndex,
// - The result of the final code snippet is then copied into "sk_FragColor".
// Note: each entry's 'fStaticFunctionName' field is expected to match the name of a function
// in the Graphite pre-compiled module.
-std::string SkShaderInfo::toSkSL() const {
+std::string SkShaderInfo::toSkSL(const skgpu::graphite::RenderStep* step,
+ const bool defineLocalCoordsVarying) const {
+ std::string preamble = "layout(location = 0, index = 0) out half4 sk_FragColor;\n";
+ preamble += skgpu::graphite::EmitVaryings(step, "in", defineLocalCoordsVarying);
+
// The uniforms are mangled by having their index in 'fEntries' as a suffix (i.e., "_%d")
- std::string result = skgpu::graphite::GetMtlUniforms(2, "FS", fBlockReaders,
+ // TODO: replace hard-coded bufferIDs with the backend's step and paint uniform-buffer indices.
+ // TODO: The use of these indices is Metal-specific. We should replace these functions with
+ // API-independent ones.
+ if (step->numUniforms() > 0) {
+ preamble += skgpu::graphite::EmitRenderStepUniforms(/*bufferID=*/1, "Step",
+ step->uniforms());
+ }
+ preamble += skgpu::graphite::EmitPaintParamsUniforms(/*bufferID=*/2, "FS", fBlockReaders,
this->needsLocalCoords());
-
int binding = 0;
- result += skgpu::graphite::GetMtlTexturesAndSamplers(fBlockReaders, &binding);
- result += "layout(location = 0, index = 0) out half4 sk_FragColor;\n";
- result += "void main() {\n";
-
- if (this->needsLocalCoords()) {
- result += "const float4x4 initialPreLocal = float4x4(1);\n";
+ preamble += skgpu::graphite::EmitTexturesAndSamplers(fBlockReaders, &binding);
+ if (step->hasTextures()) {
+ preamble += step->texturesAndSamplersSkSL(binding);
}
- std::string parentPreLocal = "initialPreLocal";
- std::string lastOutputVar = "initialColor";
+ // TODO: Remove all the use of dev2LocalUni and the preLocal matrices once all render steps
+ // that require local coordinates emit them directly.
+ std::string mainBody = SkSL::String::printf("void main() {\n"
+ " float4 coords = %s sk_FragCoord;\n",
+ this->needsLocalCoords() ? "dev2LocalUni *" : "");
// TODO: what is the correct initial color to feed in?
- add_indent(&result, 1);
- SkSL::String::appendf(&result, " half4 %s = half4(0.0);", lastOutputVar.c_str());
+ std::string lastOutputVar = "initialColor";
+ SkSL::String::appendf(&mainBody, " half4 %s = half4(0);", lastOutputVar.c_str());
+ if (this->needsLocalCoords()) {
+ // Get the local coordinates varying into half4 format as expected by emit_glue_code.
+ mainBody += "float4 outLocalCoords = float4(localCoordsVar, 0.0, 0.0);\n";
+ }
+
+ for (int entryIndex = 0; entryIndex < (int)fBlockReaders.size();) {
+ // Emit shader main body code. This never alters the preamble or increases the entry index.
+ // TODO - Once RenderSteps that require local coordinates emit them directly to the
+ // localCoordsVar varying, "outLocalCoords" can be passed in here instead of "coords".
+ lastOutputVar = emit_glue_code_for_entry(*this, entryIndex, lastOutputVar, "coords",
+ "float4x4(1.0)", &mainBody);
- for (int entryIndex = 0; entryIndex < (int) fBlockReaders.size(); ++entryIndex) {
- lastOutputVar = this->emitGlueCodeForEntry(&entryIndex, lastOutputVar, parentPreLocal,
- &result, 1);
+ // Emit preamble code. This iterates over all the children as well, and increases the entry
+ // index as we go.
+ emit_preamble_for_entry(*this, &entryIndex, &preamble);
}
- SkSL::String::appendf(&result, " sk_FragColor = %s;\n", lastOutputVar.c_str());
- result += "}\n";
+ if (step->emitsPrimitiveColor()) {
+ mainBody += "half4 primitiveColor;";
+ mainBody += step->fragmentColorSkSL();
+ // TODO: Apply primitive blender
+ // For now, just overwrite the prior color stored in lastOutputVar
+ SkSL::String::appendf(&mainBody, " %s = primitiveColor;\n", lastOutputVar.c_str());
+ }
+ if (step->emitsCoverage()) {
+ mainBody += "half4 outputCoverage;";
+ mainBody += step->fragmentCoverageSkSL();
+ SkSL::String::appendf(&mainBody, " sk_FragColor = %s*outputCoverage;\n",
+ lastOutputVar.c_str());
+ } else {
+ SkSL::String::appendf(&mainBody, " sk_FragColor = %s;\n", lastOutputVar.c_str());
+ }
+ mainBody += "}\n";
- return result;
+ return preamble + "\n" + mainBody;
}
#endif
@@ -194,7 +205,7 @@ SkShaderCodeDictionary::Entry* SkShaderCodeDictionary::makeEntry(
uint8_t* newKeyData = fArena.makeArray<uint8_t>(key.sizeInBytes());
memcpy(newKeyData, key.data(), key.sizeInBytes());
- SkSpan<const uint8_t> newKeyAsSpan = SkMakeSpan(newKeyData, key.sizeInBytes());
+ SkSpan<const uint8_t> newKeyAsSpan = SkSpan(newKeyData, key.sizeInBytes());
#ifdef SK_GRAPHITE_ENABLED
return fArena.make([&](void *ptr) { return new(ptr) Entry(newKeyAsSpan, blendInfo); });
#else
@@ -202,31 +213,33 @@ SkShaderCodeDictionary::Entry* SkShaderCodeDictionary::makeEntry(
#endif
}
-size_t SkShaderCodeDictionary::Hash::operator()(const SkPaintParamsKey* key) const {
- return SkOpts::hash_fn(key->data(), key->sizeInBytes(), 0);
+size_t SkShaderCodeDictionary::SkPaintParamsKeyPtr::Hash::operator()(SkPaintParamsKeyPtr p) const {
+ return SkOpts::hash_fn(p.fKey->data(), p.fKey->sizeInBytes(), 0);
+}
+
+size_t SkShaderCodeDictionary::RuntimeEffectKey::Hash::operator()(RuntimeEffectKey k) const {
+ return SkOpts::hash_fn(&k, sizeof(k), 0);
}
const SkShaderCodeDictionary::Entry* SkShaderCodeDictionary::findOrCreate(
- const SkPaintParamsKey& key
-#ifdef SK_GRAPHITE_ENABLED
- , const skgpu::BlendInfo& blendInfo
-#endif
- ) {
+ SkPaintParamsKeyBuilder* builder) {
+ const SkPaintParamsKey& key = builder->lockAsKey();
+
SkAutoSpinlock lock{fSpinLock};
- auto iter = fHash.find(&key);
- if (iter != fHash.end()) {
- SkASSERT(fEntryVector[iter->second->uniqueID().asUInt()] == iter->second);
- return iter->second;
+ Entry** existingEntry = fHash.find(SkPaintParamsKeyPtr{&key});
+ if (existingEntry) {
+ SkASSERT(fEntryVector[(*existingEntry)->uniqueID().asUInt()] == *existingEntry);
+ return *existingEntry;
}
#ifdef SK_GRAPHITE_ENABLED
- Entry* newEntry = this->makeEntry(key, blendInfo);
+ Entry* newEntry = this->makeEntry(key, builder->blendInfo());
#else
Entry* newEntry = this->makeEntry(key);
#endif
newEntry->setUniqueID(fEntryVector.size());
- fHash.insert(std::make_pair(&newEntry->paintParamsKey(), newEntry));
+ fHash.set(SkPaintParamsKeyPtr{&newEntry->paintParamsKey()}, newEntry);
fEntryVector.push_back(newEntry);
return newEntry;
@@ -250,7 +263,7 @@ SkSpan<const SkUniform> SkShaderCodeDictionary::getUniforms(SkBuiltInCodeSnippet
return fBuiltInCodeSnippets[(int) id].fUniforms;
}
-SkSpan<const SkPaintParamsKey::DataPayloadField> SkShaderCodeDictionary::dataPayloadExpectations(
+SkSpan<const DataPayloadField> SkShaderCodeDictionary::dataPayloadExpectations(
int codeSnippetID) const {
// All callers of this entry point should already have ensured that 'codeSnippetID' is valid
return this->getEntry(codeSnippetID)->fDataPayloadExpectations;
@@ -273,11 +286,8 @@ const SkShaderSnippet* SkShaderCodeDictionary::getEntry(int codeSnippetID) const
return nullptr;
}
-const SkShaderSnippet* SkShaderCodeDictionary::getEntry(SkBlenderID id) const {
- return this->getEntry(id.asUInt());
-}
-
-void SkShaderCodeDictionary::getShaderInfo(SkUniquePaintParamsID uniqueID, SkShaderInfo* info) {
+void SkShaderCodeDictionary::getShaderInfo(SkUniquePaintParamsID uniqueID,
+ SkShaderInfo* info) const {
auto entry = this->lookup(uniqueID);
entry->paintParamsKey().toShaderInfo(this, info);
@@ -290,58 +300,166 @@ void SkShaderCodeDictionary::getShaderInfo(SkUniquePaintParamsID uniqueID, SkSha
//--------------------------------------------------------------------------------------------------
namespace {
-using DataPayloadField = SkPaintParamsKey::DataPayloadField;
-
-// The default glue code just calls a helper function with the signature:
-// half4 fStaticFunctionName(/* all uniforms as parameters */,
-// /* all child output variable names as parameters */);
-// and stores the result in a variable named "resultName".
-std::string GenerateDefaultGlueCode(const std::string& resultName,
- int entryIndex,
- const SkPaintParamsKey::BlockReader& reader,
- const std::string& priorStageOutputName,
- const std::vector<std::string>& childOutputVarNames,
- int indent) {
- const SkShaderSnippet* entry = reader.entry();
-
- SkASSERT((int)childOutputVarNames.size() == entry->numExpectedChildren());
+#if defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
+static std::string append_default_snippet_arguments(const SkShaderSnippet* entry,
+ int entryIndex,
+ const std::string& priorStageOutputName,
+ const std::string& fragCoord,
+ const std::string& currentPreLocalExpr,
+ SkSpan<const std::string> childOutputs) {
+ std::string code = "(";
+
+ const char* separator = "";
+
+ // Append prior-stage output color.
+ if (entry->needsPriorStageOutput()) {
+ code += priorStageOutputName;
+ separator = ", ";
+ }
+ // Append fragment coordinates.
if (entry->needsLocalCoords()) {
- // Every snippet that requests local coordinates must have a localMatrix as its first
- // uniform
- SkASSERT(reader.entry()->fUniforms.size() >= 1);
- SkASSERT(reader.entry()->fUniforms[0].type() == SkSLType::kFloat4x4);
+ code += separator;
+ code += fragCoord;
+ separator = ", ";
}
- std::string result;
-
- add_indent(&result, indent);
- SkSL::String::appendf(&result,
- "%s = %s(",
- resultName.c_str(),
- entry->fStaticFunctionName);
+ // Append uniform names.
for (size_t i = 0; i < entry->fUniforms.size(); ++i) {
- if (i == 0 && reader.entry()->needsLocalCoords()) {
- std::string preLocalMatrixVarName = get_mangled_local_var_name("preLocal",
- entryIndex);
- result += preLocalMatrixVarName;
- result += " * dev2LocalUni";
+ code += separator;
+ separator = ", ";
+
+ if (i == 0 && entry->needsLocalCoords()) {
+ code += currentPreLocalExpr;
} else {
- result += entry->getMangledUniformName(i, entryIndex);
- }
- if (i+1 < entry->fUniforms.size() + childOutputVarNames.size()) {
- result += ", ";
+ code += entry->getMangledUniformName(i, entryIndex);
}
}
- for (size_t i = 0; i < childOutputVarNames.size(); ++i) {
- result += childOutputVarNames[i].c_str();
- if (i+1 < childOutputVarNames.size()) {
- result += ", ";
- }
+
+ // Append samplers.
+ for (size_t i = 0; i < entry->fTexturesAndSamplers.size(); ++i) {
+ code += separator;
+ code += entry->getMangledSamplerName(i, entryIndex);
+ separator = ", ";
}
- result += ");\n";
- return result;
+ // Append child output names.
+ for (const std::string& childOutputVar : childOutputs) {
+ code += separator;
+ separator = ", ";
+ code += childOutputVar;
+ }
+ code.push_back(')');
+
+ return code;
+}
+
+static void emit_helper_function(const SkShaderInfo& shaderInfo,
+ int* entryIndex,
+ std::string* preamble) {
+ const SkPaintParamsKey::BlockReader& reader = shaderInfo.blockReader(*entryIndex);
+ const SkShaderSnippet* entry = reader.entry();
+
+ const int numChildren = reader.numChildren();
+ SkASSERT(numChildren == entry->fNumChildren);
+
+ // Advance over the parent entry.
+ int curEntryIndex = *entryIndex;
+ *entryIndex += 1;
+
+ // Create a helper function that invokes each of the children, then calls the entry's snippet
+ // and passes all the child outputs along as arguments.
+ std::string helperFnName = get_mangled_name(entry->fStaticFunctionName, curEntryIndex);
+ std::string helperFn = SkSL::String::printf(
+ "half4 %s(half4 inColor, float4 pos, float4x4 preLocal) {",
+ helperFnName.c_str());
+ std::vector<std::string> childOutputVarNames;
+ for (int j = 0; j < numChildren; ++j) {
+ // Emit glue code into our helper function body.
+ std::string childOutputVar = emit_glue_code_for_entry(shaderInfo, *entryIndex, "inColor",
+ "pos", "preLocal", &helperFn);
+ childOutputVarNames.push_back(std::move(childOutputVar));
+
+ // If this entry itself requires a preamble, handle that here. This will advance the
+ // entry index forward as required.
+ emit_preamble_for_entry(shaderInfo, entryIndex, preamble);
+ }
+
+ // Finally, invoke the snippet from the helper function, passing uniforms and child outputs.
+ SkSL::String::appendf(&helperFn, " return %s", entry->fStaticFunctionName);
+ helperFn += append_default_snippet_arguments(entry, curEntryIndex, "inColor",
+ "pos", "preLocal", childOutputVarNames);
+ helperFn += ";\n"
+ "}\n";
+
+ // Add our new helper function to the bottom of the preamble.
+ *preamble += helperFn;
+}
+#endif
+
+// If we have no children, the default expression just calls a built-in snippet with the signature:
+// half4 BuiltinFunctionName(/* all uniforms as parameters */);
+//
+// If we do have children, we have created a function in the preamble and we call that instead. Its
+// signature looks like this:
+// half4 BuiltinFunctionName_N(half4 inColor, float4x4 preLocal);
+
+std::string GenerateDefaultExpression(const SkShaderInfo& shaderInfo,
+ int entryIndex,
+ const SkPaintParamsKey::BlockReader& reader,
+ const std::string& priorStageOutputName,
+ const std::string& fragCoord,
+ const std::string& currentPreLocalExpr) {
+#if defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
+ const SkShaderSnippet* entry = reader.entry();
+ if (entry->fNumChildren == 0) {
+ // We don't have any children; return an expression which invokes the snippet directly.
+ return entry->fStaticFunctionName +
+ append_default_snippet_arguments(entry, entryIndex, priorStageOutputName,
+ fragCoord, currentPreLocalExpr,
+ /*childOutputs=*/{});
+ } else {
+ // Return an expression which invokes the helper function from the preamble.
+ std::string helperFnName = get_mangled_name(entry->fStaticFunctionName, entryIndex);
+ return SkSL::String::printf("%s(%s, %s, %s)",
+ helperFnName.c_str(),
+ priorStageOutputName.c_str(),
+ fragCoord.c_str(),
+ currentPreLocalExpr.c_str());
+ }
+#else
+ return priorStageOutputName;
+#endif // defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
+}
+
+// If we have no children, we don't need to add anything into the preamble.
+// If we have child entries, we create a function in the preamble with a signature of:
+// half4 BuiltinFunctionName_N(half4 inColor, float4x4 preLocal) { ... }
+// This function invokes each child in sequence, and then calls the built-in function, passing all
+// uniforms and child outputs along:
+// half4 BuiltinFunctionName(/* all uniforms as parameters */,
+// /* all child output variable names as parameters */);
+void GenerateDefaultPreamble(const SkShaderInfo& shaderInfo,
+ int* entryIndex,
+ const SkPaintParamsKey::BlockReader& reader,
+ std::string* preamble) {
+#if defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
+ const SkShaderSnippet* entry = reader.entry();
+ if (entry->needsLocalCoords()) {
+ // Any snippet that requests local coordinates must have a localMatrix as its first uniform.
+ SkASSERT(entry->fUniforms.size() >= 1);
+ SkASSERT(entry->fUniforms.front().type() == SkSLType::kFloat4x4);
+ }
+
+ if (entry->fNumChildren > 0) {
+ // Create a helper function which invokes all the child snippets.
+ emit_helper_function(shaderInfo, entryIndex, preamble);
+ } else {
+ // We don't need a helper function; just advance over this entry.
+ SkASSERT(reader.numChildren() == 0);
+ *entryIndex += 1;
+ }
+#endif // defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
}
//--------------------------------------------------------------------------------------------------
@@ -355,9 +473,6 @@ static constexpr SkUniform kLinearGradientUniforms4[] = {
{ "point0", SkSLType::kFloat2 },
{ "point1", SkSLType::kFloat2 },
{ "tilemode", SkSLType::kInt },
- { "padding1", SkSLType::kFloat }, // TODO: add automatic uniform padding
- { "padding2", SkSLType::kFloat },
- { "padding3", SkSLType::kFloat },
};
static constexpr SkUniform kLinearGradientUniforms8[] = {
{ "localMatrix", SkSLType::kFloat4x4 },
@@ -366,9 +481,6 @@ static constexpr SkUniform kLinearGradientUniforms8[] = {
{ "point0", SkSLType::kFloat2 },
{ "point1", SkSLType::kFloat2 },
{ "tilemode", SkSLType::kInt },
- { "padding1", SkSLType::kFloat }, // TODO: add automatic uniform padding
- { "padding2", SkSLType::kFloat },
- { "padding3", SkSLType::kFloat },
};
static constexpr SkUniform kRadialGradientUniforms4[] = {
@@ -396,9 +508,6 @@ static constexpr SkUniform kSweepGradientUniforms4[] = {
{ "bias", SkSLType::kFloat },
{ "scale", SkSLType::kFloat },
{ "tilemode", SkSLType::kInt },
- { "padding1", SkSLType::kFloat }, // TODO: add automatic uniform padding
- { "padding2", SkSLType::kFloat },
- { "padding3", SkSLType::kFloat },
};
static constexpr SkUniform kSweepGradientUniforms8[] = {
{ "localMatrix", SkSLType::kFloat4x4 },
@@ -408,9 +517,6 @@ static constexpr SkUniform kSweepGradientUniforms8[] = {
{ "bias", SkSLType::kFloat },
{ "scale", SkSLType::kFloat },
{ "tilemode", SkSLType::kInt },
- { "padding1", SkSLType::kFloat }, // TODO: add automatic uniform padding
- { "padding2", SkSLType::kFloat },
- { "padding3", SkSLType::kFloat },
};
static constexpr SkUniform kConicalGradientUniforms4[] = {
@@ -422,7 +528,6 @@ static constexpr SkUniform kConicalGradientUniforms4[] = {
{ "radius0", SkSLType::kFloat },
{ "radius1", SkSLType::kFloat },
{ "tilemode", SkSLType::kInt },
- { "padding", SkSLType::kFloat }, // TODO: add automatic uniform padding
};
static constexpr SkUniform kConicalGradientUniforms8[] = {
{ "localMatrix", SkSLType::kFloat4x4 },
@@ -433,7 +538,6 @@ static constexpr SkUniform kConicalGradientUniforms8[] = {
{ "radius0", SkSLType::kFloat },
{ "radius1", SkSLType::kFloat },
{ "tilemode", SkSLType::kInt },
- { "padding", SkSLType::kFloat }, // TODO: add automatic uniform padding
};
static constexpr char kLinearGradient4Name[] = "sk_linear_grad_4_shader";
@@ -471,8 +575,7 @@ static constexpr SkUniform kImageShaderUniforms[] = {
{ "imgHeight", SkSLType::kInt },
};
-static constexpr int kNumImageShaderTexturesAndSamplers = 1;
-static constexpr SkTextureAndSampler kISTexturesAndSamplers[kNumImageShaderTexturesAndSamplers] = {
+static constexpr SkTextureAndSampler kISTexturesAndSamplers[] = {
{"sampler"},
};
@@ -484,56 +587,43 @@ static_assert(3 == static_cast<int>(SkTileMode::kDecal), "ImageShader code depe
static constexpr char kImageShaderName[] = "sk_compute_coords";
// This is _not_ what we want to do.
-// Ideally the "compute_coords" code snippet could just take texture and
+// Ideally the "sk_compute_coords" code snippet could just take texture and
// sampler references and do everything. That is going to take more time to figure out though so,
// for the sake of expediency, we're generating custom code to do the sampling.
-std::string GenerateImageShaderGlueCode(const std::string& resultName,
- int entryIndex,
- const SkPaintParamsKey::BlockReader& reader,
- const std::string& priorStageOutputName,
- const std::vector<std::string>& childNames,
- int indent) {
- SkASSERT(childNames.empty());
-
- std::string samplerVarName = std::string("sampler_") + std::to_string(entryIndex) + "_0";
- std::string preLocalMatrixVarName = get_mangled_local_var_name("preLocal", entryIndex);
-
- // Uniform slot 0 is being used for the localMatrix but is handled in
- // generate_default_before_children_glue_code.
+std::string GenerateImageShaderExpression(const SkShaderInfo&,
+ int entryIndex,
+ const SkPaintParamsKey::BlockReader& reader,
+ const std::string& priorStageOutputName,
+ const std::string& fragCoord,
+ const std::string& currentPreLocalExpr) {
+#if defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
+ std::string samplerVarName = reader.entry()->getMangledSamplerName(0, entryIndex);
+
+ // Uniform slot 0 is used to make the preLocalMatrix; it's handled in emit_glue_code_for_entry.
std::string subsetName = reader.entry()->getMangledUniformName(1, entryIndex);
std::string tmXName = reader.entry()->getMangledUniformName(2, entryIndex);
std::string tmYName = reader.entry()->getMangledUniformName(3, entryIndex);
std::string imgWidthName = reader.entry()->getMangledUniformName(4, entryIndex);
std::string imgHeightName = reader.entry()->getMangledUniformName(5, entryIndex);
- std::string result;
-
- add_indent(&result, indent);
- SkSL::String::appendf(&result,
- "float2 coords = %s(%s * dev2LocalUni, %s, %s, %s, %s, %s);",
- reader.entry()->fStaticFunctionName,
- preLocalMatrixVarName.c_str(),
- subsetName.c_str(),
- tmXName.c_str(),
- tmYName.c_str(),
- imgWidthName.c_str(),
- imgHeightName.c_str());
-
- add_indent(&result, indent);
- SkSL::String::appendf(&result,
- "%s = sample(%s, coords);\n",
- resultName.c_str(),
- samplerVarName.c_str());
-
- return result;
+ return SkSL::String::printf("sample(%s, %s(%s, %s, %s, %s, %s, %s, %s))",
+ samplerVarName.c_str(),
+ reader.entry()->fStaticFunctionName,
+ fragCoord.c_str(),
+ currentPreLocalExpr.c_str(),
+ subsetName.c_str(),
+ tmXName.c_str(),
+ tmYName.c_str(),
+ imgWidthName.c_str(),
+ imgHeightName.c_str());
+#else
+ return priorStageOutputName;
+#endif // defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
}
//--------------------------------------------------------------------------------------------------
static constexpr SkUniform kBlendShaderUniforms[] = {
{ "blendMode", SkSLType::kInt },
- { "padding1", SkSLType::kInt }, // TODO: add automatic uniform padding
- { "padding2", SkSLType::kInt },
- { "padding3", SkSLType::kInt },
};
static constexpr int kNumBlendShaderChildren = 2;
@@ -541,39 +631,294 @@ static constexpr int kNumBlendShaderChildren = 2;
static constexpr char kBlendShaderName[] = "sk_blend_shader";
//--------------------------------------------------------------------------------------------------
+static constexpr char kRuntimeShaderName[] = "RuntimeEffect";
+
+#if defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
+
+class GraphitePipelineCallbacks : public SkSL::PipelineStage::Callbacks {
+public:
+ GraphitePipelineCallbacks(const SkShaderInfo& shaderInfo,
+ int entryIndex,
+ const std::vector<int>& childEntryIndices,
+ std::string* preamble)
+ : fShaderInfo(shaderInfo)
+ , fEntryIndex(entryIndex)
+ , fChildEntryIndices(childEntryIndices)
+ , fPreamble(preamble) {}
+
+ std::string declareUniform(const SkSL::VarDeclaration* decl) override {
+ return get_mangled_name(std::string(decl->var().name()), fEntryIndex);
+ }
+
+ void defineFunction(const char* decl, const char* body, bool isMain) override {
+ if (isMain) {
+ SkSL::String::appendf(fPreamble,
+ "half4 %s_%d(half4 inColor, float4 coords, float4x4 preLocal) {\n"
+ " float2 pos = (preLocal * coords).xy;\n"
+ "%s"
+ "}\n",
+ kRuntimeShaderName,
+ fEntryIndex,
+ body);
+ } else {
+ SkSL::String::appendf(fPreamble, "%s {\n%s}\n", decl, body);
+ }
+ }
+
+ void declareFunction(const char* decl) override {
+ *fPreamble += std::string(decl) + ";\n";
+ }
+
+ void defineStruct(const char* definition) override {
+ *fPreamble += std::string(definition) + ";\n";
+ }
+
+ void declareGlobal(const char* declaration) override {
+ *fPreamble += std::string(declaration) + ";\n";
+ }
+
+ std::string sampleShader(int index, std::string coords) override {
+ SkASSERT(index >= 0 && index < (int)fChildEntryIndices.size());
+ return emit_expression_for_entry(fShaderInfo, fChildEntryIndices[index],
+ "inColor", "float4(" + coords + ",0,1)", "float4x4(1.0)");
+ }
+
+ std::string sampleColorFilter(int index, std::string color) override {
+ SkASSERT(index >= 0 && index < (int)fChildEntryIndices.size());
+ return emit_expression_for_entry(fShaderInfo, fChildEntryIndices[index],
+ color, "coords", "float4x4(1.0)");
+ }
+
+ std::string sampleBlender(int index, std::string src, std::string dst) override {
+ // TODO(skia:13508): implement child blenders
+ return src;
+ }
+
+ std::string toLinearSrgb(std::string color) override {
+ // TODO(skia:13508): implement to-linear-SRGB child effect
+ return color;
+ }
+ std::string fromLinearSrgb(std::string color) override {
+ // TODO(skia:13508): implement from-linear-SRGB child effect
+ return color;
+ }
+
+ std::string getMangledName(const char* name) override {
+ return get_mangled_name(name, fEntryIndex);
+ }
+
+private:
+ const SkShaderInfo& fShaderInfo;
+ int fEntryIndex;
+ const std::vector<int>& fChildEntryIndices;
+ std::string* fPreamble;
+};
+
+#endif
+
+void GenerateRuntimeShaderPreamble(const SkShaderInfo& shaderInfo,
+ int* entryIndex,
+ const SkPaintParamsKey::BlockReader& reader,
+ std::string* preamble) {
+#if defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
+ const SkShaderSnippet* entry = reader.entry();
+
+ // Advance over the parent entry.
+ int curEntryIndex = *entryIndex;
+ *entryIndex += 1;
+
+ // Emit the preambles for all of our child effects (and advance the entry-index past them).
+ // This computes the indices of our child effects, which we use when invoking them below.
+ std::vector<int> childEntryIndices;
+ childEntryIndices.reserve(entry->fNumChildren);
+ for (int j = 0; j < entry->fNumChildren; ++j) {
+ childEntryIndices.push_back(*entryIndex);
+ emit_preamble_for_entry(shaderInfo, entryIndex, preamble);
+ }
+
+ // Find this runtime effect in the runtime-effect dictionary.
+ const int codeSnippetId = reader.codeSnippetId();
+ const SkRuntimeEffect* effect = shaderInfo.runtimeEffectDictionary()->find(codeSnippetId);
+ SkASSERT(effect);
+ const SkSL::Program& program = SkRuntimeEffectPriv::Program(*effect);
+
+ GraphitePipelineCallbacks callbacks{shaderInfo, curEntryIndex, childEntryIndices, preamble};
+ SkASSERT(std::string_view(entry->fName) == kRuntimeShaderName); // the callbacks assume this
+ SkSL::PipelineStage::ConvertProgram(program, "pos", "inColor", "half4(1)", &callbacks);
+#endif // defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
+}
+
+std::string GenerateRuntimeShaderExpression(const SkShaderInfo& shaderInfo,
+ int entryIndex,
+ const SkPaintParamsKey::BlockReader& reader,
+ const std::string& priorStageOutputName,
+ const std::string& fragCoord,
+ const std::string& currentPreLocalExpr) {
+#if defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
+ const SkShaderSnippet* entry = reader.entry();
+ return SkSL::String::printf("%s_%d(%s, %s, %s)",
+ entry->fName, entryIndex,
+ priorStageOutputName.c_str(),
+ fragCoord.c_str(),
+ currentPreLocalExpr.c_str());
+#else
+ return priorStageOutputName;
+#endif // defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
+}
+
+//--------------------------------------------------------------------------------------------------
+// TODO: investigate the implications of having separate hlsa and rgba matrix colorfilters. It
+// may be that having them separate will not contribute to combinatorial explosion.
+static constexpr SkUniform kMatrixColorFilterUniforms[] = {
+ { "matrix", SkSLType::kFloat4x4 },
+ { "translate", SkSLType::kFloat4 },
+ { "inHSL", SkSLType::kInt },
+};
+
+static constexpr char kMatrixColorFilterName[] = "sk_matrix_colorfilter";
+
+//--------------------------------------------------------------------------------------------------
+static constexpr SkUniform kBlendColorFilterUniforms[] = {
+ { "blendMode", SkSLType::kInt },
+ { "color", SkSLType::kFloat4 }
+};
+
+static constexpr char kBlendColorFilterName[] = "sk_blend_colorfilter";
+
+//--------------------------------------------------------------------------------------------------
+static constexpr char kComposeColorFilterName[] = "ComposeColorFilter";
+
+static constexpr int kNumComposeColorFilterChildren = 2;
+
+void GenerateComposeColorFilterPreamble(const SkShaderInfo& shaderInfo,
+ int* entryIndex,
+ const SkPaintParamsKey::BlockReader& reader,
+ std::string* preamble) {
+#if defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
+ const SkShaderSnippet* entry = reader.entry();
+ SkASSERT(entry->fNumChildren == 2);
+
+ // Advance over the parent entry.
+ int curEntryIndex = *entryIndex;
+ *entryIndex += 1;
+
+ // Evaluate inner child.
+ std::string innerColor = emit_expression_for_entry(shaderInfo, *entryIndex, "inColor", "coords",
+ "preLocal");
+
+ // Emit preamble code for inner child.
+ emit_preamble_for_entry(shaderInfo, entryIndex, preamble);
+
+ // Evaluate outer child.
+ std::string outerColor = emit_expression_for_entry(shaderInfo, *entryIndex, innerColor,
+ "coords", "preLocal");
+
+ // Emit preamble code for outer child.
+ emit_preamble_for_entry(shaderInfo, entryIndex, preamble);
+
+ // Create a helper function that invokes the inner expression, then passes that result to the
+ // outer expression, and returns the composed result.
+ std::string helperFnName = get_mangled_name(entry->fStaticFunctionName, curEntryIndex);
+ SkSL::String::appendf(preamble,
+ "half4 %s(half4 inColor, float4 coords, float4x4 preLocal) {\n"
+ " return %s;\n"
+ "}\n",
+ helperFnName.c_str(),
+ outerColor.c_str());
+#endif // defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
+}
+
+//--------------------------------------------------------------------------------------------------
+static constexpr SkTextureAndSampler kTableColorFilterTexturesAndSamplers[] = {
+ {"tableSampler"},
+};
+
+static constexpr char kTableColorFilterName[] = "sk_table_colorfilter";
+
+std::string GenerateTableColorFilterExpression(const SkShaderInfo& shaderInfo,
+ int entryIndex,
+ const SkPaintParamsKey::BlockReader& reader,
+ const std::string& priorStageOutputName,
+ const std::string& fragCoord,
+ const std::string& currentPreLocalExpr) {
+#if defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
+ const SkShaderSnippet* entry = reader.entry();
+
+ // Return an expression which invokes the helper function from the preamble.
+ std::string helperFnName = get_mangled_name(entry->fStaticFunctionName, entryIndex);
+ return SkSL::String::printf("%s(%s)",
+ helperFnName.c_str(),
+ priorStageOutputName.c_str());
+#else
+ return priorStageOutputName;
+#endif // defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
+}
+
+void GenerateTableColorFilterPreamble(const SkShaderInfo& shaderInfo,
+ int* entryIndex,
+ const SkPaintParamsKey::BlockReader& reader,
+ std::string* preamble) {
+#if defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
+ const SkShaderSnippet* entry = reader.entry();
+ SkASSERT(entry->fNumChildren == 0);
+
+ int curEntryIndex = *entryIndex;
+ *entryIndex += 1;
+
+ std::string samplerName = reader.entry()->getMangledSamplerName(0, curEntryIndex);
+
+ // Create a helper function that directly uses the mangled sampler
+ std::string helperFnName = get_mangled_name(entry->fStaticFunctionName, curEntryIndex);
+ SkSL::String::appendf(
+ preamble,
+ "half4 %s(half4 colorIn) {\n"
+ " half4 coords = unpremul(colorIn) * 255.0/256.0 + 0.5/256.0;\n"
+ " half4 color = half4(sample(%s, half2(coords.r, 3.0/8.0)).r,\n"
+ " sample(%s, half2(coords.g, 5.0/8.0)).r,\n"
+ " sample(%s, half2(coords.b, 7.0/8.0)).r,\n"
+ " 1);\n"
+ " return color * sample(%s, half2(coords.a, 1.0/8.0)).r;\n"
+ "}\n",
+ helperFnName.c_str(),
+ samplerName.c_str(),
+ samplerName.c_str(),
+ samplerName.c_str(),
+ samplerName.c_str());
+#endif // defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
+}
+
+//--------------------------------------------------------------------------------------------------
+static constexpr char kGaussianColorFilterName[] = "sk_gaussian_colorfilter";
+
+//--------------------------------------------------------------------------------------------------
static constexpr char kErrorName[] = "sk_error";
//--------------------------------------------------------------------------------------------------
+static constexpr char kPassthroughName[] = "sk_passthrough";
+
+//--------------------------------------------------------------------------------------------------
// This method generates the glue code for the case where the SkBlendMode-based blending is
// handled with fixed function blending.
-std::string GenerateFixedFunctionBlenderGlueCode(const std::string& resultName,
- int entryIndex,
- const SkPaintParamsKey::BlockReader& reader,
- const std::string& priorStageOutputName,
- const std::vector<std::string>& childNames,
- int indent) {
- SkASSERT(childNames.empty());
+std::string GenerateFixedFunctionBlenderExpression(const SkShaderInfo&,
+ int entryIndex,
+ const SkPaintParamsKey::BlockReader& reader,
+ const std::string& priorStageOutputName,
+ const std::string& fragCoord,
+ const std::string& currentPreLocalExpr) {
+#if defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
SkASSERT(reader.entry()->fUniforms.empty());
SkASSERT(reader.numDataPayloadFields() == 0);
// The actual blending is set up via the fixed function pipeline so we don't actually
// need to access the blend mode in the glue code.
+#endif // defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
- std::string result;
- add_indent(&result, indent);
- result += "// Fixed-function blending\n";
- add_indent(&result, indent);
- SkSL::String::appendf(&result, "%s = %s;", resultName.c_str(), priorStageOutputName.c_str());
-
- return result;
+ return priorStageOutputName;
}
//--------------------------------------------------------------------------------------------------
static constexpr SkUniform kShaderBasedBlenderUniforms[] = {
{ "blendMode", SkSLType::kInt },
- { "padding1", SkSLType::kInt }, // TODO: add automatic uniform padding
- { "padding2", SkSLType::kInt },
- { "padding3", SkSLType::kInt },
};
static constexpr char kBlendHelperName[] = "sk_blend";
@@ -582,35 +927,27 @@ static constexpr char kBlendHelperName[] = "sk_blend";
// in the shader (i.e., fixed function blending isn't possible).
// It exists as custom glue code so that we can deal with the dest reads. If that can be
// standardized (e.g., via a snippets requirement flag) this could be removed.
-std::string GenerateShaderBasedBlenderGlueCode(const std::string& resultName,
- int entryIndex,
- const SkPaintParamsKey::BlockReader& reader,
- const std::string& priorStageOutputName,
- const std::vector<std::string>& childNames,
- int indent) {
- SkASSERT(childNames.empty());
- SkASSERT(reader.entry()->fUniforms.size() == 4); // actual blend uniform + 3 padding int
+std::string GenerateShaderBasedBlenderExpression(const SkShaderInfo&,
+ int entryIndex,
+ const SkPaintParamsKey::BlockReader& reader,
+ const std::string& priorStageOutputName,
+ const std::string& fragCoord,
+ const std::string& currentPreLocalExpr) {
+#if defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
+ SkASSERT(reader.entry()->fUniforms.size() == 1);
SkASSERT(reader.numDataPayloadFields() == 0);
std::string uniformName = reader.entry()->getMangledUniformName(0, entryIndex);
- std::string result;
-
- add_indent(&result, indent);
- result += "// Shader-based blending\n";
+ // TODO: emit function to perform dest read into preamble, and replace half(1) with that call
- // TODO: emit code to perform dest read here
- add_indent(&result, indent);
- result += "half4 dummyDst = half4(1.0, 1.0, 1.0, 1.0);\n";
-
- add_indent(&result, indent);
- SkSL::String::appendf(&result, "%s = %s(%s, %s, dummyDst);",
- resultName.c_str(),
- reader.entry()->fStaticFunctionName,
- uniformName.c_str(),
- priorStageOutputName.c_str());
-
- return result;
+ return SkSL::String::printf("%s(%s, %s, half4(1))",
+ reader.entry()->fStaticFunctionName,
+ uniformName.c_str(),
+ priorStageOutputName.c_str());
+#else
+ return priorStageOutputName;
+#endif // defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
}
//--------------------------------------------------------------------------------------------------
@@ -632,28 +969,48 @@ bool SkShaderCodeDictionary::isValidID(int snippetID) const {
static constexpr int kNoChildren = 0;
-// TODO: this version needs to be removed
int SkShaderCodeDictionary::addUserDefinedSnippet(
const char* name,
+ SkSpan<const SkUniform> uniforms,
+ SnippetRequirementFlags snippetRequirementFlags,
+ SkSpan<const SkTextureAndSampler> texturesAndSamplers,
+ const char* functionName,
+ SkShaderSnippet::GenerateExpressionForSnippetFn expressionGenerator,
+ SkShaderSnippet::GeneratePreambleForSnippetFn preambleGenerator,
+ int numChildren,
SkSpan<const SkPaintParamsKey::DataPayloadField> dataPayloadExpectations) {
-
- std::unique_ptr<SkShaderSnippet> entry(new SkShaderSnippet("UserDefined",
- {}, // no uniforms
- SnippetRequirementFlags::kNone,
- {}, // no samplers
- name,
- GenerateDefaultGlueCode,
- kNoChildren,
- dataPayloadExpectations));
-
// TODO: the memory for user-defined entries could go in the dictionary's arena but that
// would have to be a thread safe allocation since the arena also stores entries for
// 'fHash' and 'fEntryVector'
- fUserDefinedCodeSnippets.push_back(std::move(entry));
+ fUserDefinedCodeSnippets.push_back(std::make_unique<SkShaderSnippet>(name,
+ uniforms,
+ snippetRequirementFlags,
+ texturesAndSamplers,
+ functionName,
+ expressionGenerator,
+ preambleGenerator,
+ numChildren,
+ dataPayloadExpectations));
return kBuiltInCodeSnippetIDCount + fUserDefinedCodeSnippets.size() - 1;
}
+// TODO: this version needs to be removed
+int SkShaderCodeDictionary::addUserDefinedSnippet(
+ const char* name,
+ SkSpan<const DataPayloadField> dataPayloadExpectations) {
+ return this->addUserDefinedSnippet("UserDefined",
+ {}, // no uniforms
+ SnippetRequirementFlags::kNone,
+ {}, // no samplers
+ name,
+ GenerateDefaultExpression,
+ GenerateDefaultPreamble,
+ kNoChildren,
+ dataPayloadExpectations);
+}
+
+#ifdef SK_ENABLE_PRECOMPILE
SkBlenderID SkShaderCodeDictionary::addUserDefinedBlender(sk_sp<SkRuntimeEffect> effect) {
if (!effect) {
return {};
@@ -663,22 +1020,128 @@ SkBlenderID SkShaderCodeDictionary::addUserDefinedBlender(sk_sp<SkRuntimeEffect>
// from the runtime effect in order to create a real SkShaderSnippet
// Additionally, we need to hash the provided code to deduplicate the runtime effects in case
// the client keeps giving us different rtEffects w/ the same backing SkSL.
+ int codeSnippetID = this->addUserDefinedSnippet("UserDefined",
+ {}, // missing uniforms
+ SnippetRequirementFlags::kNone,
+ {}, // missing samplers
+ "foo",
+ GenerateDefaultExpression,
+ GenerateDefaultPreamble,
+ kNoChildren,
+ /*dataPayloadExpectations=*/{});
+ return SkBlenderID(codeSnippetID);
+}
- std::unique_ptr<SkShaderSnippet> entry(new SkShaderSnippet("UserDefined",
- {}, // missing uniforms
- SnippetRequirementFlags::kNone,
- {}, // missing samplers
- "foo",
- GenerateDefaultGlueCode,
- kNoChildren,
- {})); // missing data payload
+const SkShaderSnippet* SkShaderCodeDictionary::getEntry(SkBlenderID id) const {
+ return this->getEntry(id.asUInt());
+}
- // TODO: the memory for user-defined entries could go in the dictionary's arena but that
- // would have to be a thread safe allocation since the arena also stores entries for
- // 'fHash' and 'fEntryVector'
- fUserDefinedCodeSnippets.push_back(std::move(entry));
+#endif // SK_ENABLE_PRECOMPILE
+
+static SkSLType uniform_type_to_sksl_type(const SkRuntimeEffect::Uniform& u) {
+ using Type = SkRuntimeEffect::Uniform::Type;
+ if (u.flags & SkRuntimeEffect::Uniform::kHalfPrecision_Flag) {
+ switch (u.type) {
+ case Type::kFloat: return SkSLType::kHalf;
+ case Type::kFloat2: return SkSLType::kHalf2;
+ case Type::kFloat3: return SkSLType::kHalf3;
+ case Type::kFloat4: return SkSLType::kHalf4;
+ case Type::kFloat2x2: return SkSLType::kHalf2x2;
+ case Type::kFloat3x3: return SkSLType::kHalf3x3;
+ case Type::kFloat4x4: return SkSLType::kHalf4x4;
+ case Type::kInt: return SkSLType::kShort;
+ case Type::kInt2: return SkSLType::kShort2;
+ case Type::kInt3: return SkSLType::kShort3;
+ case Type::kInt4: return SkSLType::kShort4;
+ }
+ } else {
+ switch (u.type) {
+ case Type::kFloat: return SkSLType::kFloat;
+ case Type::kFloat2: return SkSLType::kFloat2;
+ case Type::kFloat3: return SkSLType::kFloat3;
+ case Type::kFloat4: return SkSLType::kFloat4;
+ case Type::kFloat2x2: return SkSLType::kFloat2x2;
+ case Type::kFloat3x3: return SkSLType::kFloat3x3;
+ case Type::kFloat4x4: return SkSLType::kFloat4x4;
+ case Type::kInt: return SkSLType::kInt;
+ case Type::kInt2: return SkSLType::kInt2;
+ case Type::kInt3: return SkSLType::kInt3;
+ case Type::kInt4: return SkSLType::kInt4;
+ }
+ }
+ SkUNREACHABLE;
+}
- return SkBlenderID(kBuiltInCodeSnippetIDCount + fUserDefinedCodeSnippets.size() - 1);
+const char* SkShaderCodeDictionary::addTextToArena(std::string_view text) {
+ char* textInArena = fArena.makeArrayDefault<char>(text.size() + 1);
+ memcpy(textInArena, text.data(), text.size());
+ textInArena[text.size()] = '\0';
+ return textInArena;
+}
+
+SkSpan<const SkUniform> SkShaderCodeDictionary::convertUniforms(const SkRuntimeEffect* effect) {
+ using Uniform = SkRuntimeEffect::Uniform;
+ SkSpan<const Uniform> uniforms = effect->uniforms();
+
+ bool addLocalMatrixUniform = effect->allowShader();
+
+ // Convert the SkRuntimeEffect::Uniform array into its SkUniform equivalent.
+ int numUniforms = uniforms.size() + (addLocalMatrixUniform ? 1 : 0);
+ SkUniform* uniformArray = fArena.makeInitializedArray<SkUniform>(numUniforms, [&](int index) {
+ // Graphite wants a `localMatrix` float4x4 uniform at the front of the uniform list.
+ const Uniform* u;
+ if (addLocalMatrixUniform) {
+ if (index == 0) {
+ return SkUniform("localMatrix", SkSLType::kFloat4x4);
+ }
+ u = &uniforms[index - 1];
+ } else {
+ u = &uniforms[index];
+ }
+
+ // The existing uniform names live in the passed-in SkRuntimeEffect and may eventually
+ // disappear. Copy them into fArena. (It's safe to do this within makeInitializedArray; the
+ // entire array is allocated in one big slab before any initialization calls are done.)
+ const char* name = this->addTextToArena(u->name);
+
+ // Add one SkUniform to our array.
+ SkSLType type = uniform_type_to_sksl_type(*u);
+ return (u->flags & Uniform::kArray_Flag) ? SkUniform(name, type, u->count)
+ : SkUniform(name, type);
+ });
+
+ return SkSpan<const SkUniform>(uniformArray, numUniforms);
+}
+
+int SkShaderCodeDictionary::findOrCreateRuntimeEffectSnippet(const SkRuntimeEffect* effect) {
+ // Use the combination of {SkSL program hash, uniform size} as our key.
+ // In the unfortunate event of a hash collision, at least we'll have the right amount of
+ // uniform data available.
+ RuntimeEffectKey key;
+ key.fHash = SkRuntimeEffectPriv::Hash(*effect);
+ key.fUniformSize = effect->uniformSize();
+
+ SkAutoSpinlock lock{fSpinLock};
+
+ int32_t* existingCodeSnippetID = fRuntimeEffectMap.find(key);
+ if (existingCodeSnippetID) {
+ return *existingCodeSnippetID;
+ }
+
+ const SnippetRequirementFlags snippetFlags = effect->allowShader()
+ ? SnippetRequirementFlags::kLocalCoords
+ : SnippetRequirementFlags::kNone;
+ int newCodeSnippetID = this->addUserDefinedSnippet("RuntimeEffect",
+ this->convertUniforms(effect),
+ snippetFlags,
+ /*texturesAndSamplers=*/{},
+ kRuntimeShaderName,
+ GenerateRuntimeShaderExpression,
+ GenerateRuntimeShaderPreamble,
+ (int)effect->children().size(),
+ /*dataPayloadExpectations=*/{});
+ fRuntimeEffectMap.set(key, newCodeSnippetID);
+ return newCodeSnippetID;
}
SkShaderCodeDictionary::SkShaderCodeDictionary() {
@@ -691,148 +1154,232 @@ SkShaderCodeDictionary::SkShaderCodeDictionary() {
SnippetRequirementFlags::kNone,
{ }, // no samplers
kErrorName,
- GenerateDefaultGlueCode,
+ GenerateDefaultExpression,
+ GenerateDefaultPreamble,
+ kNoChildren,
+ { } // no data payload
+ };
+ fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kPassthroughShader] = {
+ "Passthrough",
+ { }, // no uniforms
+ SnippetRequirementFlags::kPriorStageOutput,
+ { }, // no samplers
+ kPassthroughName,
+ GenerateDefaultExpression,
+ GenerateDefaultPreamble,
kNoChildren,
- { }
+ { } // no data payload
};
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kSolidColorShader] = {
"SolidColor",
- SkMakeSpan(kSolidShaderUniforms),
+ SkSpan(kSolidShaderUniforms),
SnippetRequirementFlags::kNone,
{ }, // no samplers
kSolidShaderName,
- GenerateDefaultGlueCode,
+ GenerateDefaultExpression,
+ GenerateDefaultPreamble,
kNoChildren,
- { }
+ { } // no data payload
};
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kLinearGradientShader4] = {
"LinearGradient4",
- SkMakeSpan(kLinearGradientUniforms4),
+ SkSpan(kLinearGradientUniforms4),
SnippetRequirementFlags::kLocalCoords,
{ }, // no samplers
kLinearGradient4Name,
- GenerateDefaultGlueCode,
+ GenerateDefaultExpression,
+ GenerateDefaultPreamble,
kNoChildren,
- { }
+ { } // no data payload
};
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kLinearGradientShader8] = {
"LinearGradient8",
- SkMakeSpan(kLinearGradientUniforms8),
+ SkSpan(kLinearGradientUniforms8),
SnippetRequirementFlags::kLocalCoords,
{ }, // no samplers
kLinearGradient8Name,
- GenerateDefaultGlueCode,
+ GenerateDefaultExpression,
+ GenerateDefaultPreamble,
kNoChildren,
- { }
+ { } // no data payload
};
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kRadialGradientShader4] = {
"RadialGradient4",
- SkMakeSpan(kRadialGradientUniforms4),
+ SkSpan(kRadialGradientUniforms4),
SnippetRequirementFlags::kLocalCoords,
{ }, // no samplers
kRadialGradient4Name,
- GenerateDefaultGlueCode,
+ GenerateDefaultExpression,
+ GenerateDefaultPreamble,
kNoChildren,
- { }
+ { } // no data payload
};
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kRadialGradientShader8] = {
"RadialGradient8",
- SkMakeSpan(kRadialGradientUniforms8),
+ SkSpan(kRadialGradientUniforms8),
SnippetRequirementFlags::kLocalCoords,
{ }, // no samplers
kRadialGradient8Name,
- GenerateDefaultGlueCode,
+ GenerateDefaultExpression,
+ GenerateDefaultPreamble,
kNoChildren,
- { }
+ { } // no data payload
};
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kSweepGradientShader4] = {
"SweepGradient4",
- SkMakeSpan(kSweepGradientUniforms4),
+ SkSpan(kSweepGradientUniforms4),
SnippetRequirementFlags::kLocalCoords,
{ }, // no samplers
kSweepGradient4Name,
- GenerateDefaultGlueCode,
+ GenerateDefaultExpression,
+ GenerateDefaultPreamble,
kNoChildren,
- { }
+ { } // no data payload
};
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kSweepGradientShader8] = {
"SweepGradient8",
- SkMakeSpan(kSweepGradientUniforms8),
+ SkSpan(kSweepGradientUniforms8),
SnippetRequirementFlags::kLocalCoords,
{ }, // no samplers
kSweepGradient8Name,
- GenerateDefaultGlueCode,
+ GenerateDefaultExpression,
+ GenerateDefaultPreamble,
kNoChildren,
- { }
+ { } // no data payload
};
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kConicalGradientShader4] = {
"ConicalGradient4",
- SkMakeSpan(kConicalGradientUniforms4),
+ SkSpan(kConicalGradientUniforms4),
SnippetRequirementFlags::kLocalCoords,
{ }, // no samplers
kConicalGradient4Name,
- GenerateDefaultGlueCode,
+ GenerateDefaultExpression,
+ GenerateDefaultPreamble,
kNoChildren,
- { }
+ { } // no data payload
};
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kConicalGradientShader8] = {
"ConicalGradient8",
- SkMakeSpan(kConicalGradientUniforms8),
+ SkSpan(kConicalGradientUniforms8),
SnippetRequirementFlags::kLocalCoords,
{ }, // no samplers
kConicalGradient8Name,
- GenerateDefaultGlueCode,
+ GenerateDefaultExpression,
+ GenerateDefaultPreamble,
kNoChildren,
- { }
+ { } // no data payload
};
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kLocalMatrixShader] = {
"LocalMatrixShader",
- SkMakeSpan(kLocalMatrixShaderUniforms),
+ SkSpan(kLocalMatrixShaderUniforms),
SnippetRequirementFlags::kLocalCoords,
{ }, // no samplers
kLocalMatrixShaderName,
- GenerateDefaultGlueCode,
+ GenerateDefaultExpression,
+ GenerateDefaultPreamble,
kNumLocalMatrixShaderChildren,
- { }
+ { } // no data payload
};
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kImageShader] = {
"ImageShader",
- SkMakeSpan(kImageShaderUniforms),
+ SkSpan(kImageShaderUniforms),
SnippetRequirementFlags::kLocalCoords,
- SkMakeSpan(kISTexturesAndSamplers, kNumImageShaderTexturesAndSamplers),
+ SkSpan(kISTexturesAndSamplers),
kImageShaderName,
- GenerateImageShaderGlueCode,
+ GenerateImageShaderExpression,
+ GenerateDefaultPreamble,
kNoChildren,
- { }
+ { } // no data payload
};
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kBlendShader] = {
"BlendShader",
- SkMakeSpan(kBlendShaderUniforms),
+ SkSpan(kBlendShaderUniforms),
SnippetRequirementFlags::kNone,
{ }, // no samplers
kBlendShaderName,
- GenerateDefaultGlueCode,
+ GenerateDefaultExpression,
+ GenerateDefaultPreamble,
kNumBlendShaderChildren,
- { }
+ { } // no data payload
+ };
+
+ // SkColorFilter snippets
+ fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kMatrixColorFilter] = {
+ "MatrixColorFilter",
+ SkSpan(kMatrixColorFilterUniforms),
+ SnippetRequirementFlags::kPriorStageOutput,
+ { }, // no samplers
+ kMatrixColorFilterName,
+ GenerateDefaultExpression,
+ GenerateDefaultPreamble,
+ kNoChildren,
+ { } // no data payload
+ };
+ fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kBlendColorFilter] = {
+ "BlendColorFilter",
+ SkSpan(kBlendColorFilterUniforms),
+ SnippetRequirementFlags::kPriorStageOutput,
+ { }, // no samplers
+ kBlendColorFilterName,
+ GenerateDefaultExpression,
+ GenerateDefaultPreamble,
+ kNoChildren,
+ { } // no data payload
+ };
+ fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kComposeColorFilter] = {
+ "ComposeColorFilter",
+ { }, // no uniforms
+ SnippetRequirementFlags::kPriorStageOutput,
+ { }, // no samplers
+ kComposeColorFilterName,
+ GenerateDefaultExpression,
+ GenerateComposeColorFilterPreamble,
+ kNumComposeColorFilterChildren,
+ { } // no data payload
};
+ fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kTableColorFilter] = {
+ "TableColorFilter",
+ { }, // no uniforms
+ SnippetRequirementFlags::kPriorStageOutput,
+ SkSpan(kTableColorFilterTexturesAndSamplers),
+ kTableColorFilterName,
+ GenerateTableColorFilterExpression,
+ GenerateTableColorFilterPreamble,
+ kNoChildren,
+ { } // no data payload
+ };
+ fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kGaussianColorFilter] = {
+ "GaussianColorFilter",
+ { }, // no uniforms
+ SnippetRequirementFlags::kPriorStageOutput,
+ { }, // no samplers
+ kGaussianColorFilterName,
+ GenerateDefaultExpression,
+ GenerateDefaultPreamble,
+ kNoChildren,
+ { } // no data payload
+ };
+
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kFixedFunctionBlender] = {
"FixedFunctionBlender",
{ }, // no uniforms
SnippetRequirementFlags::kNone,
{ }, // no samplers
"FF-blending", // fixed function blending doesn't use static SkSL
- GenerateFixedFunctionBlenderGlueCode,
+ GenerateFixedFunctionBlenderExpression,
+ GenerateDefaultPreamble,
kNoChildren,
- { }
+ { } // no data payload
};
fBuiltInCodeSnippets[(int) SkBuiltInCodeSnippetID::kShaderBasedBlender] = {
"ShaderBasedBlender",
- SkMakeSpan(kShaderBasedBlenderUniforms),
+ SkSpan(kShaderBasedBlenderUniforms),
SnippetRequirementFlags::kNone,
{ }, // no samplers
kBlendHelperName,
- GenerateShaderBasedBlenderGlueCode,
+ GenerateShaderBasedBlenderExpression,
+ GenerateDefaultPreamble,
kNoChildren,
- { }
+ { } // no data payload
};
}
diff --git a/chromium/third_party/skia/src/core/SkShaderCodeDictionary.h b/chromium/third_party/skia/src/core/SkShaderCodeDictionary.h
index e43c4c572b8..b4e861c52ef 100644
--- a/chromium/third_party/skia/src/core/SkShaderCodeDictionary.h
+++ b/chromium/third_party/skia/src/core/SkShaderCodeDictionary.h
@@ -8,24 +8,39 @@
#ifndef SkShaderCodeDictionary_DEFINED
#define SkShaderCodeDictionary_DEFINED
-#include <array>
-#include <unordered_map>
-#include <vector>
#include "include/core/SkSpan.h"
+#include "include/core/SkTypes.h"
+#include "include/private/SkMacros.h"
#include "include/private/SkSpinlock.h"
+#include "include/private/SkTHash.h"
+#include "include/private/SkThreadAnnotations.h"
+#include "include/private/SkTo.h"
#include "include/private/SkUniquePaintParamsID.h"
#include "src/core/SkArenaAlloc.h"
+#include "src/core/SkBuiltInCodeSnippetID.h"
#include "src/core/SkEnumBitMask.h"
#include "src/core/SkPaintParamsKey.h"
-#include "src/core/SkPipelineData.h"
#include "src/core/SkUniform.h"
-namespace SkSL {
-struct ShaderCaps;
+#include <array>
+#include <cstddef>
+#include <cstdint>
+#include <memory>
+#include <string>
+#include <string_view>
+#include <vector>
+
+#ifdef SK_GRAPHITE_ENABLED
+namespace skgpu::graphite {
+class RenderStep;
}
+#endif
-class SkBlenderID;
class SkRuntimeEffect;
+class SkRuntimeEffectDictionary;
+#ifdef SK_ENABLE_PRECOMPILE
+class SkBlenderID;
+#endif
// TODO: How to represent the type (e.g., 2D) of texture being sampled?
class SkTextureAndSampler {
@@ -41,16 +56,21 @@ private:
enum class SnippetRequirementFlags : uint32_t {
kNone = 0x0,
kLocalCoords = 0x1,
+ kPriorStageOutput = 0x2
};
SK_MAKE_BITMASK_OPS(SnippetRequirementFlags);
struct SkShaderSnippet {
- using GenerateGlueCodeForEntry = std::string (*)(const std::string& resultName,
- int entryIndex, // for uniform name mangling
- const SkPaintParamsKey::BlockReader&,
- const std::string& priorStageOutputName,
- const std::vector<std::string>& childNames,
- int indent);
+ using GeneratePreambleForSnippetFn = void (*)(const SkShaderInfo& shaderInfo,
+ int* entryIndex,
+ const SkPaintParamsKey::BlockReader&,
+ std::string* preamble);
+ using GenerateExpressionForSnippetFn = std::string (*)(const SkShaderInfo& shaderInfo,
+ int entryIndex,
+ const SkPaintParamsKey::BlockReader&,
+ const std::string& priorStageOutputName,
+ const std::string& fragCoord,
+ const std::string& currentPreLocalName);
SkShaderSnippet() = default;
@@ -59,7 +79,8 @@ struct SkShaderSnippet {
SnippetRequirementFlags snippetRequirementFlags,
SkSpan<const SkTextureAndSampler> texturesAndSamplers,
const char* functionName,
- GenerateGlueCodeForEntry glueCodeGenerator,
+ GenerateExpressionForSnippetFn expressionGenerator,
+ GeneratePreambleForSnippetFn preambleGenerator,
int numChildren,
SkSpan<const SkPaintParamsKey::DataPayloadField> dataPayloadExpectations)
: fName(name)
@@ -67,25 +88,28 @@ struct SkShaderSnippet {
, fSnippetRequirementFlags(snippetRequirementFlags)
, fTexturesAndSamplers(texturesAndSamplers)
, fStaticFunctionName(functionName)
- , fGlueCodeGenerator(glueCodeGenerator)
+ , fExpressionGenerator(expressionGenerator)
+ , fPreambleGenerator(preambleGenerator)
, fNumChildren(numChildren)
- , fDataPayloadExpectations(dataPayloadExpectations) {
- }
+ , fDataPayloadExpectations(dataPayloadExpectations) {}
- std::string getMangledUniformName(int uniformIndex, int mangleId) const;
+ std::string getMangledUniformName(int uniformIdx, int mangleId) const;
+ std::string getMangledSamplerName(int samplerIdx, int mangleId) const;
bool needsLocalCoords() const {
return fSnippetRequirementFlags & SnippetRequirementFlags::kLocalCoords;
}
-
- int numExpectedChildren() const { return fNumChildren; }
+ bool needsPriorStageOutput() const {
+ return fSnippetRequirementFlags & SnippetRequirementFlags::kPriorStageOutput;
+ }
const char* fName = nullptr;
SkSpan<const SkUniform> fUniforms;
SnippetRequirementFlags fSnippetRequirementFlags;
SkSpan<const SkTextureAndSampler> fTexturesAndSamplers;
const char* fStaticFunctionName = nullptr;
- GenerateGlueCodeForEntry fGlueCodeGenerator = nullptr;
+ GenerateExpressionForSnippetFn fExpressionGenerator = nullptr;
+ GeneratePreambleForSnippetFn fPreambleGenerator = nullptr;
int fNumChildren = 0;
SkSpan<const SkPaintParamsKey::DataPayloadField> fDataPayloadExpectations;
};
@@ -94,6 +118,14 @@ struct SkShaderSnippet {
// for program creation and its invocation.
class SkShaderInfo {
public:
+ SkShaderInfo(SkRuntimeEffectDictionary* rteDict = nullptr)
+ : fRuntimeEffectDictionary(rteDict) {}
+ ~SkShaderInfo() = default;
+ SkShaderInfo(SkShaderInfo&&) = default;
+ SkShaderInfo& operator=(SkShaderInfo&&) = default;
+ SkShaderInfo(const SkShaderInfo&) = delete;
+ SkShaderInfo& operator=(const SkShaderInfo&) = delete;
+
void add(const SkPaintParamsKey::BlockReader& reader) {
fBlockReaders.push_back(reader);
}
@@ -103,6 +135,12 @@ public:
bool needsLocalCoords() const {
return fSnippetRequirementFlags & SnippetRequirementFlags::kLocalCoords;
}
+ const SkPaintParamsKey::BlockReader& blockReader(int index) const {
+ return fBlockReaders[index];
+ }
+ const SkRuntimeEffectDictionary* runtimeEffectDictionary() const {
+ return fRuntimeEffectDictionary;
+ }
#ifdef SK_GRAPHITE_ENABLED
void setBlendInfo(const skgpu::BlendInfo& blendInfo) {
@@ -111,22 +149,18 @@ public:
const skgpu::BlendInfo& blendInfo() const { return fBlendInfo; }
#endif
-#if SK_SUPPORT_GPU && defined(SK_GRAPHITE_ENABLED) && defined(SK_METAL)
- std::string toSkSL() const;
+#if defined(SK_GRAPHITE_ENABLED) && defined(SK_ENABLE_SKSL)
+ std::string toSkSL(const skgpu::graphite::RenderStep* step,
+ const bool defineLocalCoordsVarying) const;
#endif
private:
- std::string emitGlueCodeForEntry(int* entryIndex,
- const std::string& priorStageOutputName,
- const std::string& parentPreLocalName,
- std::string* result,
- int indent) const;
-
std::vector<SkPaintParamsKey::BlockReader> fBlockReaders;
- SkEnumBitMask<SnippetRequirementFlags> fSnippetRequirementFlags =SnippetRequirementFlags::kNone;
-#ifdef SK_GRAPHITE_ENABLED
+ SkEnumBitMask<SnippetRequirementFlags> fSnippetRequirementFlags{SnippetRequirementFlags::kNone};
+ SkRuntimeEffectDictionary* fRuntimeEffectDictionary = nullptr;
+#ifdef SK_GRAPHITE_ENABLED
// The blendInfo doesn't actually contribute to the program's creation but, it contains the
// matching fixed-function settings that the program's caller needs to set up.
skgpu::BlendInfo fBlendInfo;
@@ -176,12 +210,7 @@ public:
#endif
};
-#ifdef SK_GRAPHITE_ENABLED
- const Entry* findOrCreate(const SkPaintParamsKey&,
- const skgpu::BlendInfo&) SK_EXCLUDES(fSpinLock);
-#else
- const Entry* findOrCreate(const SkPaintParamsKey&) SK_EXCLUDES(fSpinLock);
-#endif
+ const Entry* findOrCreate(SkPaintParamsKeyBuilder*) SK_EXCLUDES(fSpinLock);
const Entry* lookup(SkUniquePaintParamsID) const SK_EXCLUDES(fSpinLock);
@@ -199,17 +228,18 @@ public:
const SkShaderSnippet* getEntry(SkBuiltInCodeSnippetID codeSnippetID) const {
return this->getEntry(SkTo<int>(codeSnippetID));
}
- const SkShaderSnippet* getEntry(SkBlenderID) const;
- void getShaderInfo(SkUniquePaintParamsID, SkShaderInfo*);
+ void getShaderInfo(SkUniquePaintParamsID, SkShaderInfo*) const;
+
+ int findOrCreateRuntimeEffectSnippet(const SkRuntimeEffect* effect);
- // TODO: this is still experimental but, most likely, it will need to be made thread-safe
- // It returns the code snippet ID to use to identify the supplied user-defined code
- // TODO: add hooks for user to actually provide code.
int addUserDefinedSnippet(const char* name,
SkSpan<const SkPaintParamsKey::DataPayloadField> expectations);
+#ifdef SK_ENABLE_PRECOMPILE
SkBlenderID addUserDefinedBlender(sk_sp<SkRuntimeEffect>);
+ const SkShaderSnippet* getEntry(SkBlenderID) const;
+#endif
private:
#ifdef SK_GRAPHITE_ENABLED
@@ -218,15 +248,22 @@ private:
Entry* makeEntry(const SkPaintParamsKey&);
#endif
- struct Hash {
- size_t operator()(const SkPaintParamsKey*) const;
- };
+ // TODO: this is still experimental but, most likely, it will need to be made thread-safe
+ // It returns the code snippet ID to use to identify the supplied user-defined code
+ int addUserDefinedSnippet(
+ const char* name,
+ SkSpan<const SkUniform> uniforms,
+ SnippetRequirementFlags snippetRequirementFlags,
+ SkSpan<const SkTextureAndSampler> texturesAndSamplers,
+ const char* functionName,
+ SkShaderSnippet::GenerateExpressionForSnippetFn expressionGenerator,
+ SkShaderSnippet::GeneratePreambleForSnippetFn preambleGenerator,
+ int numChildren,
+ SkSpan<const SkPaintParamsKey::DataPayloadField> dataPayloadExpectations);
- struct KeyEqual {
- bool operator()(const SkPaintParamsKey* k1, const SkPaintParamsKey* k2) const {
- return k1->operator==(*k2);
- }
- };
+ const char* addTextToArena(std::string_view text);
+
+ SkSpan<const SkUniform> convertUniforms(const SkRuntimeEffect* effect);
std::array<SkShaderSnippet, kBuiltInCodeSnippetIDCount> fBuiltInCodeSnippets;
@@ -237,13 +274,49 @@ private:
// TODO: can we do something better given this should have write-seldom/read-often behavior?
mutable SkSpinlock fSpinLock;
- using PaintHashMap = std::unordered_map<const SkPaintParamsKey*, Entry*, Hash, KeyEqual>;
+ struct SkPaintParamsKeyPtr {
+ const SkPaintParamsKey* fKey;
+
+ bool operator==(SkPaintParamsKeyPtr rhs) const {
+ return *fKey == *rhs.fKey;
+ }
+ struct Hash {
+ size_t operator()(SkPaintParamsKeyPtr) const;
+ };
+ };
+
+ using PaintHashMap = SkTHashMap<SkPaintParamsKeyPtr, Entry*, SkPaintParamsKeyPtr::Hash>;
PaintHashMap fHash SK_GUARDED_BY(fSpinLock);
std::vector<Entry*> fEntryVector SK_GUARDED_BY(fSpinLock);
+ SK_BEGIN_REQUIRE_DENSE
+ struct RuntimeEffectKey {
+ uint32_t fHash;
+ uint32_t fUniformSize;
+
+ bool operator==(RuntimeEffectKey rhs) const {
+ return fHash == rhs.fHash && fUniformSize == rhs.fUniformSize;
+ }
+ struct Hash {
+ size_t operator()(RuntimeEffectKey) const;
+ };
+ };
+ SK_END_REQUIRE_DENSE
+
+ // A map from RuntimeEffectKeys (hash plus uniforms) to code-snippet IDs. RuntimeEffectKeys
+ // don't track the lifetime of a runtime effect at all; they live forever, and a newly-
+ // instantiated runtime effect with the same program as a previously-discarded effect will reuse
+ // an existing ID. Entries in the runtime-effect map are never removed; they only disappear when
+ // the context is discarded, which takes the ShaderCodeDictionary along with it. However, they
+ // are extremely small (< 20 bytes) so the memory footprint should be unnoticeable.
+ using RuntimeEffectMap = SkTHashMap<RuntimeEffectKey, int32_t>;
+ RuntimeEffectMap fRuntimeEffectMap SK_GUARDED_BY(fSpinLock);
+
// This arena holds:
- // the Entries held in 'fHash' and 'fEntryVector' - thus, guarded by 'fSpinLock'
+ // - the Entries held in `fHash` and `fEntryVector`
+ // - SkUniform data created by `findOrCreateRuntimeEffectSnippet`
+ // and in all cases is guarded by `fSpinLock`
SkArenaAlloc fArena{256};
};
diff --git a/chromium/third_party/skia/src/core/SkSpecialImage.cpp b/chromium/third_party/skia/src/core/SkSpecialImage.cpp
index 5e6ba7a2146..5d5dbe80edf 100644
--- a/chromium/third_party/skia/src/core/SkSpecialImage.cpp
+++ b/chromium/third_party/skia/src/core/SkSpecialImage.cpp
@@ -240,7 +240,8 @@ public:
#if SK_SUPPORT_GPU
GrSurfaceProxyView onView(GrRecordingContext* context) const override {
if (context) {
- return std::get<0>(GrMakeCachedBitmapProxyView(context, fBitmap, GrMipmapped::kNo));
+ return std::get<0>(GrMakeCachedBitmapProxyView(
+ context, fBitmap, /*label=*/"SpecialImageRaster_OnView", GrMipmapped::kNo));
}
return {};
@@ -454,8 +455,13 @@ public:
fColorSpace);
}
- auto subsetView = GrSurfaceProxyView::Copy(fContext, fView, GrMipmapped::kNo, *subset,
- SkBackingFit::kExact, SkBudgeted::kYes);
+ auto subsetView = GrSurfaceProxyView::Copy(fContext,
+ fView,
+ GrMipmapped::kNo,
+ *subset,
+ SkBackingFit::kExact,
+ SkBudgeted::kYes,
+ /*label=*/"SkSpecialImage_AsImage");
if (!subsetView) {
return nullptr;
}
diff --git a/chromium/third_party/skia/src/core/SkSpecialSurface.cpp b/chromium/third_party/skia/src/core/SkSpecialSurface.cpp
index 15451971904..5daac411cd5 100644
--- a/chromium/third_party/skia/src/core/SkSpecialSurface.cpp
+++ b/chromium/third_party/skia/src/core/SkSpecialSurface.cpp
@@ -124,7 +124,7 @@ sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRaster(const SkImageInfo& info,
class SkSpecialSurface_Gpu : public SkSpecialSurface_Base {
public:
- SkSpecialSurface_Gpu(sk_sp<skgpu::BaseDevice> device, SkIRect subset)
+ SkSpecialSurface_Gpu(sk_sp<skgpu::v1::Device> device, SkIRect subset)
: INHERITED(subset, device->surfaceProps())
, fReadView(device->readSurfaceView()) {
@@ -167,7 +167,7 @@ sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRenderTarget(GrRecordingContext* r
auto device = rContext->priv().createDevice(SkBudgeted::kYes, ii, SkBackingFit::kApprox, 1,
GrMipmapped::kNo, GrProtected::kNo,
surfaceOrigin, props,
- skgpu::BaseDevice::InitContents::kUninit);
+ skgpu::v1::Device::InitContents::kUninit);
if (!device) {
return nullptr;
}
diff --git a/chromium/third_party/skia/src/core/SkSpinlock.cpp b/chromium/third_party/skia/src/core/SkSpinlock.cpp
index c5a469b51f6..73ca66788ee 100644
--- a/chromium/third_party/skia/src/core/SkSpinlock.cpp
+++ b/chromium/third_party/skia/src/core/SkSpinlock.cpp
@@ -15,7 +15,7 @@
static void debug_trace() {
void* stack[64];
- int len = backtrace(stack, SK_ARRAY_COUNT(stack));
+ int len = backtrace(stack, std::size(stack));
// As you might imagine, we can't use an SkSpinlock here...
static SkMutex lock;
diff --git a/chromium/third_party/skia/src/core/SkStrikeCache.cpp b/chromium/third_party/skia/src/core/SkStrikeCache.cpp
index 8f8c82edbea..53c8e9a1a05 100644
--- a/chromium/third_party/skia/src/core/SkStrikeCache.cpp
+++ b/chromium/third_party/skia/src/core/SkStrikeCache.cpp
@@ -42,8 +42,8 @@ auto SkStrikeCache::findOrCreateStrike(const SkStrikeSpec& strikeSpec) -> sk_sp<
return strike;
}
-SkScopedStrikeForGPU SkStrikeCache::findOrCreateScopedStrike(const SkStrikeSpec& strikeSpec) {
- return SkScopedStrikeForGPU{this->findOrCreateStrike(strikeSpec).release()};
+sktext::ScopedStrikeForGPU SkStrikeCache::findOrCreateScopedStrike(const SkStrikeSpec& strikeSpec) {
+ return sktext::ScopedStrikeForGPU{this->findOrCreateStrike(strikeSpec).release()};
}
void SkStrikeCache::PurgeAll() {
diff --git a/chromium/third_party/skia/src/core/SkStrikeCache.h b/chromium/third_party/skia/src/core/SkStrikeCache.h
index be26b9aba4a..13a99f376d7 100644
--- a/chromium/third_party/skia/src/core/SkStrikeCache.h
+++ b/chromium/third_party/skia/src/core/SkStrikeCache.h
@@ -16,8 +16,8 @@
#include "include/private/SkTemplates.h"
#include "src/core/SkDescriptor.h"
#include "src/core/SkScalerCache.h"
-#include "src/core/SkStrikeForGPU.h"
#include "src/core/SkStrikeSpec.h"
+#include "src/text/StrikeForGPU.h"
class SkTraceMemoryDump;
class SkStrikeCache;
@@ -36,9 +36,10 @@ class SkStrikePinner {
public:
virtual ~SkStrikePinner() = default;
virtual bool canDelete() = 0;
+ virtual void assertValid() {}
};
-class SkStrike final : public SkRefCnt, public SkStrikeForGPU {
+class SkStrike final : public SkRefCnt, public sktext::StrikeForGPU {
public:
SkStrike(SkStrikeCache* strikeCache,
const SkStrikeSpec& strikeSpec,
@@ -128,7 +129,9 @@ public:
}
void verifyPinnedStrike() const {
- SkASSERT_RELEASE(fPinner == nullptr || !fPinner->canDelete());
+ if (fPinner != nullptr) {
+ fPinner->assertValid();
+ }
}
#if SK_SUPPORT_GPU
@@ -136,16 +139,22 @@ public:
sktext::gpu::StrikeCache* gpuStrikeCache) const;
#endif
- void prepareForMaskDrawing(
- SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected) override {
- size_t increase = fScalerCache.prepareForMaskDrawing(accepted, rejected);
+ SkRect prepareForMaskDrawing(SkScalar strikeToSourceScale,
+ SkDrawableGlyphBuffer* accepted,
+ SkSourceGlyphBuffer* rejected) override {
+ auto [rect, increase] = fScalerCache.prepareForMaskDrawing(
+ strikeToSourceScale, accepted, rejected);
this->updateDelta(increase);
+ return rect;
}
- void prepareForSDFTDrawing(
- SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected) override {
- size_t increase = fScalerCache.prepareForSDFTDrawing(accepted, rejected);
+ SkRect prepareForSDFTDrawing(SkScalar strikeToSourceScale,
+ SkDrawableGlyphBuffer* accepted,
+ SkSourceGlyphBuffer* rejected) override {
+ auto [rect, increase] = fScalerCache.prepareForSDFTDrawing(
+ strikeToSourceScale, accepted, rejected);
this->updateDelta(increase);
+ return rect;
}
void prepareForPathDrawing(
@@ -154,12 +163,32 @@ public:
this->updateDelta(increase);
}
+ void glyphIDsToPaths(SkSpan<sktext::IDOrPath> idsOrPaths) {
+ size_t increase = fScalerCache.glyphIDsToPaths(idsOrPaths);
+ this->updateDelta(increase);
+ }
+
void prepareForDrawableDrawing(
SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected) override {
size_t increase = fScalerCache.prepareForDrawableDrawing(accepted, rejected);
this->updateDelta(increase);
}
+ void glyphIDsToDrawables(SkSpan<sktext::IDOrDrawable> idsOrDrawables) {
+ size_t increase = fScalerCache.glyphIDsToDrawables(idsOrDrawables);
+ this->updateDelta(increase);
+ }
+
+ sktext::SkStrikePromise strikePromise() override {
+ return sktext::SkStrikePromise(sk_ref_sp<SkStrike>(this));
+ }
+
+ SkScalar findMaximumGlyphDimension(SkSpan<const SkGlyphID> glyphs) override {
+ auto [maxDimension, increase] = fScalerCache.findMaximumGlyphDimension(glyphs);
+ this->updateDelta(increase);
+ return maxDimension;
+ }
+
void onAboutToExitScope() override {
this->unref();
}
@@ -180,7 +209,7 @@ public:
bool fRemoved{false};
}; // SkStrike
-class SkStrikeCache final : public SkStrikeForGPUCacheInterface {
+class SkStrikeCache final : public sktext::StrikeForGPUCacheInterface {
public:
SkStrikeCache() = default;
@@ -195,7 +224,7 @@ public:
sk_sp<SkStrike> findOrCreateStrike(const SkStrikeSpec& strikeSpec) SK_EXCLUDES(fLock);
- SkScopedStrikeForGPU findOrCreateScopedStrike(
+ sktext::ScopedStrikeForGPU findOrCreateScopedStrike(
const SkStrikeSpec& strikeSpec) override SK_EXCLUDES(fLock);
static void PurgeAll();
diff --git a/chromium/third_party/skia/src/core/SkStrikeForGPU.cpp b/chromium/third_party/skia/src/core/SkStrikeForGPU.cpp
deleted file mode 100644
index 731ed1f6005..00000000000
--- a/chromium/third_party/skia/src/core/SkStrikeForGPU.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2019 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-
-
-#include "src/core/SkStrikeForGPU.h"
-
-#include "src/core/SkGlyphRunPainter.h"
-
-bool SkStrikeForGPU::CanDrawAsMask(const SkGlyph& glyph) {
- return FitsInAtlas(glyph);
-}
-
-bool SkStrikeForGPU::CanDrawAsSDFT(const SkGlyph& glyph) {
- return FitsInAtlas(glyph) && glyph.maskFormat() == SkMask::kSDF_Format;
-}
-
-bool SkStrikeForGPU::CanDrawAsPath(const SkGlyph& glyph) {
- SkASSERT(glyph.setPathHasBeenCalled());
- return glyph.path() != nullptr;
-}
-
-bool SkStrikeForGPU::FitsInAtlas(const SkGlyph& glyph) {
- return glyph.maxDimension() <= SkStrikeCommon::kSkSideTooBigForAtlas;
-}
-
diff --git a/chromium/third_party/skia/src/core/SkStrikeForGPU.h b/chromium/third_party/skia/src/core/SkStrikeForGPU.h
deleted file mode 100644
index 757fb499843..00000000000
--- a/chromium/third_party/skia/src/core/SkStrikeForGPU.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2019 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkStrikeInterface_DEFINED
-#define SkStrikeInterface_DEFINED
-
-#include "include/core/SkPaint.h"
-#include "include/core/SkPoint.h"
-#include "include/core/SkSpan.h"
-#include "include/core/SkTypes.h"
-
-#include <memory>
-
-class SkDescriptor;
-class SkDrawableGlyphBuffer;
-class SkGlyph;
-class SkMaskFilter;
-class SkPathEffect;
-class SkSourceGlyphBuffer;
-class SkStrike;
-class SkStrikeSpec;
-class SkTypeface;
-struct SkGlyphPositionRoundingSpec;
-struct SkScalerContextEffects;
-
-class SkStrikeForGPU {
-public:
- virtual ~SkStrikeForGPU() = default;
- virtual const SkDescriptor& getDescriptor() const = 0;
-
- virtual void prepareForMaskDrawing(
- SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected) = 0;
-
- virtual void prepareForSDFTDrawing(
- SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected) = 0;
-
- virtual void prepareForPathDrawing(
- SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected) = 0;
-
- virtual void prepareForDrawableDrawing(
- SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected) = 0;
-
- virtual const SkGlyphPositionRoundingSpec& roundingSpec() const = 0;
-
- // Used with SkScopedStrikeForGPU to take action at the end of a scope.
- virtual void onAboutToExitScope() = 0;
-
- // Return underlying SkStrike for building SubRuns while processing glyph runs.
- virtual sk_sp<SkStrike> getUnderlyingStrike() const = 0;
-
- // Common categories for glyph types used by GPU.
- static bool CanDrawAsMask(const SkGlyph& glyph);
- static bool CanDrawAsSDFT(const SkGlyph& glyph);
- static bool CanDrawAsPath(const SkGlyph& glyph);
- static bool FitsInAtlas(const SkGlyph& glyph);
-
-
- struct Deleter {
- void operator()(SkStrikeForGPU* ptr) const {
- ptr->onAboutToExitScope();
- }
- };
-};
-
-using SkScopedStrikeForGPU = std::unique_ptr<SkStrikeForGPU, SkStrikeForGPU::Deleter>;
-
-class SkStrikeForGPUCacheInterface {
-public:
- virtual ~SkStrikeForGPUCacheInterface() = default;
- virtual SkScopedStrikeForGPU findOrCreateScopedStrike(const SkStrikeSpec& strikeSpec) = 0;
-};
-#endif //SkStrikeInterface_DEFINED
diff --git a/chromium/third_party/skia/src/core/SkStrikeSpec.cpp b/chromium/third_party/skia/src/core/SkStrikeSpec.cpp
index 3a8db50a46f..c35e01fcc87 100644
--- a/chromium/third_party/skia/src/core/SkStrikeSpec.cpp
+++ b/chromium/third_party/skia/src/core/SkStrikeSpec.cpp
@@ -35,6 +35,16 @@ SkStrikeSpec SkStrikeSpec::MakeMask(const SkFont& font, const SkPaint& paint,
return SkStrikeSpec(font, paint, surfaceProps, scalerContextFlags, deviceMatrix);
}
+SkStrikeSpec SkStrikeSpec::MakeTransformMask(const SkFont& font,
+ const SkPaint& paint,
+ const SkSurfaceProps& surfaceProps,
+ SkScalerContextFlags scalerContextFlags,
+ const SkMatrix& deviceMatrix) {
+ SkFont sourceFont{font};
+ sourceFont.setSubpixel(false);
+ return SkStrikeSpec(sourceFont, paint, surfaceProps, scalerContextFlags, deviceMatrix);
+}
+
std::tuple<SkStrikeSpec, SkScalar> SkStrikeSpec::MakePath(
const SkFont& font, const SkPaint& paint,
const SkSurfaceProps& surfaceProps,
@@ -55,37 +65,6 @@ std::tuple<SkStrikeSpec, SkScalar> SkStrikeSpec::MakePath(
strikeToSourceScale};
}
-std::tuple<SkStrikeSpec, SkScalar> SkStrikeSpec::MakeSourceFallback(
- const SkFont& font,
- const SkPaint& paint,
- const SkSurfaceProps& surfaceProps,
- SkScalerContextFlags scalerContextFlags,
- SkScalar maxSourceGlyphDimension) {
-
- // Subtract 2 to account for the bilerp pad around the glyph
- SkScalar maxAtlasDimension = SkStrikeCommon::kSkSideTooBigForAtlas - 2;
-
- SkScalar runFontTextSize = font.getSize();
- SkScalar fallbackTextSize = runFontTextSize;
- if (maxSourceGlyphDimension > maxAtlasDimension) {
- // Scale the text size down so the long side of all the glyphs will fit in the atlas.
- fallbackTextSize = SkScalarFloorToScalar(
- (maxAtlasDimension / maxSourceGlyphDimension) * runFontTextSize);
- }
-
- SkFont fallbackFont{font};
- fallbackFont.setSize(fallbackTextSize);
-
- // No sub-pixel needed. The transform to the screen will take care of sub-pixel positioning.
- fallbackFont.setSubpixel(false);
-
- // The scale factor to go from strike size to the source size for glyphs.
- SkScalar strikeToSourceScale = runFontTextSize / fallbackTextSize;
-
- return {SkStrikeSpec(fallbackFont, paint, surfaceProps, scalerContextFlags, SkMatrix::I()),
- strikeToSourceScale};
-}
-
std::tuple<SkStrikeSpec, SkScalar> SkStrikeSpec::MakeCanonicalized(
const SkFont& font, const SkPaint* paint) {
SkPaint canonicalizedPaint;
@@ -210,8 +189,8 @@ SkStrikeSpec::SkStrikeSpec(const SkFont& font, const SkPaint& paint,
fTypeface = font.refTypefaceOrDefault();
}
-SkScopedStrikeForGPU SkStrikeSpec::findOrCreateScopedStrike(
- SkStrikeForGPUCacheInterface* cache) const {
+sktext::ScopedStrikeForGPU SkStrikeSpec::findOrCreateScopedStrike(
+ sktext::StrikeForGPUCacheInterface* cache) const {
return cache->findOrCreateScopedStrike(*this);
}
diff --git a/chromium/third_party/skia/src/core/SkStrikeSpec.h b/chromium/third_party/skia/src/core/SkStrikeSpec.h
index aa40c67dc24..ce23aabb8b4 100644
--- a/chromium/third_party/skia/src/core/SkStrikeSpec.h
+++ b/chromium/third_party/skia/src/core/SkStrikeSpec.h
@@ -10,13 +10,15 @@
#include "include/core/SkMaskFilter.h"
#include "include/core/SkPathEffect.h"
+#include "include/core/SkSpan.h"
#include "src/core/SkDescriptor.h"
-#include "src/core/SkStrikeForGPU.h"
+#include "src/text/StrikeForGPU.h"
#include <tuple>
#if SK_SUPPORT_GPU || defined(SK_GRAPHITE_ENABLED)
#include "src/text/gpu/SDFTControl.h"
+
namespace sktext::gpu {
class StrikeCache;
class TextStrike;
@@ -25,6 +27,7 @@ class TextStrike;
class SkFont;
class SkPaint;
+class SkStrike;
class SkStrikeCache;
class SkSurfaceProps;
@@ -47,19 +50,21 @@ public:
SkScalerContextFlags scalerContextFlags,
const SkMatrix& deviceMatrix);
- // Create a strike spec for path style cache entries.
- static std::tuple<SkStrikeSpec, SkScalar> MakePath(
+ // A strike for finding the max size for transforming masks. This is used to calculate the
+ // maximum dimension of a SubRun of text.
+ static SkStrikeSpec MakeTransformMask(
const SkFont& font,
const SkPaint& paint,
const SkSurfaceProps& surfaceProps,
- SkScalerContextFlags scalerContextFlags);
+ SkScalerContextFlags scalerContextFlags,
+ const SkMatrix& deviceMatrix);
- static std::tuple<SkStrikeSpec, SkScalar> MakeSourceFallback(
+ // Create a strike spec for path style cache entries.
+ static std::tuple<SkStrikeSpec, SkScalar> MakePath(
const SkFont& font,
const SkPaint& paint,
const SkSurfaceProps& surfaceProps,
- SkScalerContextFlags scalerContextFlags,
- SkScalar maxSourceGlyphDimension);
+ SkScalerContextFlags scalerContextFlags);
// Create a canonical strike spec for device-less measurements.
static std::tuple<SkStrikeSpec, SkScalar> MakeCanonicalized(
@@ -83,7 +88,8 @@ public:
sk_sp<sktext::gpu::TextStrike> findOrCreateTextStrike(sktext::gpu::StrikeCache* cache) const;
#endif
- SkScopedStrikeForGPU findOrCreateScopedStrike(SkStrikeForGPUCacheInterface* cache) const;
+ sktext::ScopedStrikeForGPU findOrCreateScopedStrike(
+ sktext::StrikeForGPUCacheInterface* cache) const;
sk_sp<SkStrike> findOrCreateStrike() const;
diff --git a/chromium/third_party/skia/src/core/SkStroke.cpp b/chromium/third_party/skia/src/core/SkStroke.cpp
index 19cfe1a3445..712a8d7ba13 100644
--- a/chromium/third_party/skia/src/core/SkStroke.cpp
+++ b/chromium/third_party/skia/src/core/SkStroke.cpp
@@ -33,11 +33,11 @@ static const int kRecursiveLimits[] = { 5*3, 24, 11*3, 11*3 };
static_assert(0 == kTangent_RecursiveLimit, "cubic_stroke_relies_on_tangent_equalling_zero");
static_assert(1 == kCubic_RecursiveLimit, "cubic_stroke_relies_on_cubic_equalling_one");
-static_assert(SK_ARRAY_COUNT(kRecursiveLimits) == kQuad_RecursiveLimit + 1,
+static_assert(std::size(kRecursiveLimits) == kQuad_RecursiveLimit + 1,
"recursive_limits_mismatch");
#if defined SK_DEBUG && QUAD_STROKE_APPROX_EXTENDED_DEBUGGING
- int gMaxRecursion[SK_ARRAY_COUNT(kRecursiveLimits)] = { 0 };
+ int gMaxRecursion[std::size(kRecursiveLimits)] = { 0 };
#endif
#ifndef DEBUG_QUAD_STROKER
#define DEBUG_QUAD_STROKER 0
diff --git a/chromium/third_party/skia/src/core/SkTLazy.h b/chromium/third_party/skia/src/core/SkTLazy.h
index 8a31d065855..f34a8cf5faf 100644
--- a/chromium/third_party/skia/src/core/SkTLazy.h
+++ b/chromium/third_party/skia/src/core/SkTLazy.h
@@ -169,7 +169,7 @@ public:
void initIfNeeded(Args&&... args) {
if (!fObj) {
SkASSERT(!fLazy.has_value());
- fObj = fLazy.emplace(std::forward<Args>(args)...);
+ fObj = &fLazy.emplace(std::forward<Args>(args)...);
}
}
diff --git a/chromium/third_party/skia/src/core/SkTextBlob.cpp b/chromium/third_party/skia/src/core/SkTextBlob.cpp
index 2bbc5910203..1dd55b2628d 100644
--- a/chromium/third_party/skia/src/core/SkTextBlob.cpp
+++ b/chromium/third_party/skia/src/core/SkTextBlob.cpp
@@ -5,11 +5,11 @@
* found in the LICENSE file.
*/
-#include "include/core/SkRSXform.h"
#include "include/core/SkTextBlob.h"
+
+#include "include/core/SkRSXform.h"
#include "include/core/SkTypeface.h"
#include "src/core/SkFontPriv.h"
-#include "src/core/SkGlyphRun.h"
#include "src/core/SkPaintPriv.h"
#include "src/core/SkReadBuffer.h"
#include "src/core/SkSafeMath.h"
@@ -17,6 +17,7 @@
#include "src/core/SkStrikeSpec.h"
#include "src/core/SkTextBlobPriv.h"
#include "src/core/SkWriteBuffer.h"
+#include "src/text/GlyphRun.h"
#include <atomic>
#include <limits>
@@ -860,7 +861,7 @@ size_t SkTextBlob::serialize(const SkSerialProcs& procs, void* memory, size_t me
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace {
-int get_glyph_run_intercepts(const SkGlyphRun& glyphRun,
+int get_glyph_run_intercepts(const sktext::GlyphRun& glyphRun,
const SkPaint& paint,
const SkScalar bounds[2],
SkScalar intervals[],
@@ -922,11 +923,11 @@ int SkTextBlob::getIntercepts(const SkScalar bounds[2], SkScalar intervals[],
paint = defaultPaint.get();
}
- SkGlyphRunBuilder builder;
+ sktext::GlyphRunBuilder builder;
auto glyphRunList = builder.blobToGlyphRunList(*this, {0, 0});
int intervalCount = 0;
- for (const SkGlyphRun& glyphRun : glyphRunList) {
+ for (const sktext::GlyphRun& glyphRun : glyphRunList) {
// Ignore RSXForm runs.
if (glyphRun.scaledRotations().empty()) {
intervalCount = get_glyph_run_intercepts(
@@ -947,7 +948,7 @@ std::vector<SkScalar> SkFont::getIntercepts(const SkGlyphID glyphs[], int count,
const SkPaint paint(paintPtr ? *paintPtr : SkPaint());
const SkScalar bounds[] = {top, bottom};
- const SkGlyphRun run(*this,
+ const sktext::GlyphRun run(*this,
{positions, size_t(count)}, {glyphs, size_t(count)},
{nullptr, 0}, {nullptr, 0}, {nullptr, 0});
diff --git a/chromium/third_party/skia/src/core/SkTextBlobTrace.cpp b/chromium/third_party/skia/src/core/SkTextBlobTrace.cpp
index df461f54bfe..0e90c578758 100644
--- a/chromium/third_party/skia/src/core/SkTextBlobTrace.cpp
+++ b/chromium/third_party/skia/src/core/SkTextBlobTrace.cpp
@@ -83,7 +83,8 @@ SkTextBlobTrace::Capture::Capture() : fTypefaceSet(new SkRefCntSet) {
SkTextBlobTrace::Capture::~Capture() = default;
-void SkTextBlobTrace::Capture::capture(const SkGlyphRunList& glyphRunList, const SkPaint& paint) {
+void SkTextBlobTrace::Capture::capture(
+ const sktext::GlyphRunList& glyphRunList, const SkPaint& paint) {
const SkTextBlob* blob = glyphRunList.blob();
if (blob != nullptr) {
fWriteBuffer.writeUInt(blob->uniqueID());
diff --git a/chromium/third_party/skia/src/core/SkTextBlobTrace.h b/chromium/third_party/skia/src/core/SkTextBlobTrace.h
index d5f2371a78c..8aa776523ec 100644
--- a/chromium/third_party/skia/src/core/SkTextBlobTrace.h
+++ b/chromium/third_party/skia/src/core/SkTextBlobTrace.h
@@ -9,8 +9,8 @@
#include "include/core/SkPoint.h"
#include "include/core/SkStream.h"
#include "include/core/SkTextBlob.h"
-#include "src/core/SkGlyphRun.h"
#include "src/core/SkWriteBuffer.h"
+#include "src/text/GlyphRun.h"
#include <cstdint>
#include <vector>
@@ -32,7 +32,7 @@ class Capture {
public:
Capture();
~Capture();
- void capture(const SkGlyphRunList&, const SkPaint&);
+ void capture(const sktext::GlyphRunList&, const SkPaint&);
// If `dst` is nullptr, write to a file.
void dump(SkWStream* dst = nullptr) const;
diff --git a/chromium/third_party/skia/src/core/SkTextFormatParams.h b/chromium/third_party/skia/src/core/SkTextFormatParams.h
index 0de36a42753..00f9fce65ce 100644
--- a/chromium/third_party/skia/src/core/SkTextFormatParams.h
+++ b/chromium/third_party/skia/src/core/SkTextFormatParams.h
@@ -24,8 +24,8 @@ static const SkScalar kStdFakeBoldInterpValues[] = {
SK_Scalar1/24,
SK_Scalar1/32,
};
-static_assert(SK_ARRAY_COUNT(kStdFakeBoldInterpKeys) == SK_ARRAY_COUNT(kStdFakeBoldInterpValues),
+static_assert(std::size(kStdFakeBoldInterpKeys) == std::size(kStdFakeBoldInterpValues),
"mismatched_array_size");
-static const int kStdFakeBoldInterpLength = SK_ARRAY_COUNT(kStdFakeBoldInterpKeys);
+static const int kStdFakeBoldInterpLength = std::size(kStdFakeBoldInterpKeys);
#endif //SkTextFormatParams_DEFINES
diff --git a/chromium/third_party/skia/src/core/SkTraceEvent.h b/chromium/third_party/skia/src/core/SkTraceEvent.h
index aef99b027df..c1881e38f09 100644
--- a/chromium/third_party/skia/src/core/SkTraceEvent.h
+++ b/chromium/third_party/skia/src/core/SkTraceEvent.h
@@ -70,6 +70,12 @@
#define TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION \
SkEventTracer::GetInstance()->updateTraceEventDuration
+// Start writing to a new trace output section (file, etc.).
+// Accepts a label for the new section.
+// void TRACE_EVENT_API_NEW_TRACE_SECTION(const char* name)
+#define TRACE_EVENT_API_NEW_TRACE_SECTION \
+ SkEventTracer::GetInstance()->newTracingSection
+
// Defines visibility for classes in trace_event.h
#define TRACE_EVENT_API_CLASS_EXPORT SK_API
diff --git a/chromium/third_party/skia/src/core/SkVM.cpp b/chromium/third_party/skia/src/core/SkVM.cpp
index 068328a80e0..e62897aa3a7 100644
--- a/chromium/third_party/skia/src/core/SkVM.cpp
+++ b/chromium/third_party/skia/src/core/SkVM.cpp
@@ -22,27 +22,10 @@
#include <atomic>
#include <queue>
-#if defined(SKVM_LLVM)
- #include <future>
- #include <llvm/Bitcode/BitcodeWriter.h>
- #include <llvm/ExecutionEngine/ExecutionEngine.h>
- #include <llvm/IR/IRBuilder.h>
- #include <llvm/IR/Verifier.h>
- #include <llvm/Support/TargetSelect.h>
- #include <llvm/Support/Host.h>
-
- // Platform-specific intrinsics got their own files in LLVM 10.
- #if __has_include(<llvm/IR/IntrinsicsX86.h>)
- #include <llvm/IR/IntrinsicsX86.h>
- #endif
-#endif
-
#if !defined(SK_BUILD_FOR_WIN)
#include <unistd.h>
#endif
-// #define SKVM_LLVM_WAIT_FOR_COMPILATION
-
bool gSkVMAllowJIT{false};
bool gSkVMJITViaDylib{false};
@@ -59,14 +42,12 @@ bool gSkVMJITViaDylib{false};
VirtualProtect(ptr, len, PAGE_EXECUTE_READ, &old);
SkASSERT(old == PAGE_READWRITE);
}
- #if !defined(SKVM_LLVM)
static void unmap_jit_buffer(void* ptr, size_t len) {
VirtualFree(ptr, 0, MEM_RELEASE);
}
static void close_dylib(void* dylib) {
SkASSERT(false); // TODO? For now just assert we never make one.
}
- #endif
#else
#include <dlfcn.h>
#include <sys/mman.h>
@@ -83,31 +64,12 @@ bool gSkVMJITViaDylib{false};
__builtin___clear_cache((char*)ptr,
(char*)ptr + len);
}
- #if !defined(SKVM_LLVM)
static void unmap_jit_buffer(void* ptr, size_t len) {
munmap(ptr, len);
}
static void close_dylib(void* dylib) {
dlclose(dylib);
}
- #endif
- #endif
-
- #if defined(SKVM_JIT_VTUNE)
- #include <jitprofiling.h>
- static void notify_vtune(const char* name, void* addr, size_t len) {
- if (iJIT_IsProfilingActive() == iJIT_SAMPLING_ON) {
- iJIT_Method_Load event;
- memset(&event, 0, sizeof(event));
- event.method_id = iJIT_GetNewMethodID();
- event.method_name = const_cast<char*>(name);
- event.method_load_address = addr;
- event.method_size = len;
- iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, &event);
- }
- }
- #else
- static void notify_vtune(const char* name, void* addr, size_t len) {}
#endif
#endif
@@ -171,12 +133,6 @@ namespace skvm {
std::atomic<void*> jit_entry{nullptr}; // TODO: minimal std::memory_orders
size_t jit_size = 0;
void* dylib = nullptr;
-
- #if defined(SKVM_LLVM)
- std::unique_ptr<llvm::LLVMContext> llvm_ctx;
- std::unique_ptr<llvm::ExecutionEngine> llvm_ee;
- std::future<void> llvm_compiling;
- #endif
};
// Debugging tools, mostly for printing various data structures out to a stream.
@@ -370,9 +326,9 @@ namespace skvm {
}
}
- void Program::visualize(SkWStream* output, const char* code) const {
+ void Program::visualize(SkWStream* output) const {
if (fImpl->visualizer) {
- fImpl->visualizer->dump(output, code);
+ fImpl->visualizer->dump(output);
}
}
@@ -1617,10 +1573,8 @@ namespace skvm {
lu = luminance(*r, *g, *b);
auto clip = [&](auto c) {
- c = select(mn >= 0, c
- , lu + ((c-lu)*( lu)) / (lu-mn));
- c = select(mx > a, lu + ((c-lu)*(a-lu)) / (mx-lu)
- , c);
+ c = select(mn < 0 & lu != mn, lu + ((c-lu)*( lu)) / (lu-mn), c);
+ c = select(mx > a & lu != mx, lu + ((c-lu)*(a-lu)) / (mx-lu), c);
return clamp01(c); // May be a little negative, or worse, NaN.
};
*r = clip(*r);
@@ -2643,8 +2597,7 @@ namespace skvm {
#if !defined(SKVM_JIT_BUT_IGNORE_IT)
const void* jit_entry = fImpl->jit_entry.load();
- // jit_entry may be null either simply because we can't JIT, or when using LLVM
- // if the work represented by fImpl->llvm_compiling hasn't finished yet.
+ // jit_entry may be null if we can't JIT
//
// Ordinarily we'd never find ourselves with non-null jit_entry and !gSkVMAllowJIT, but it
// can happen during interactive programs like Viewer that toggle gSkVMAllowJIT on and off,
@@ -2680,450 +2633,17 @@ namespace skvm {
this->nargs(), n, args);
}
- #if defined(SKVM_LLVM)
- // -- SKVM_LLVM --------------------------------------------------------------------------------
- void Program::setupLLVM(const std::vector<OptimizedInstruction>& instructions,
- const char* debug_name) {
- auto ctx = std::make_unique<llvm::LLVMContext>();
-
- auto mod = std::make_unique<llvm::Module>("", *ctx);
- // All the scary bare pointers from here on are owned by ctx or mod, I think.
-
- // Everything I've tested runs faster at K=8 (using ymm) than K=16 (zmm) on SKX machines.
- const int K = (true && SkCpu::Supports(SkCpu::HSW)) ? 8 : 4;
-
- llvm::Type *ptr = llvm::Type::getInt8Ty(*ctx)->getPointerTo(),
- *i32 = llvm::Type::getInt32Ty(*ctx);
-
- std::vector<llvm::Type*> arg_types = { i32 };
- for (size_t i = 0; i < fImpl->strides.size(); i++) {
- arg_types.push_back(ptr);
- }
-
- llvm::FunctionType* fn_type = llvm::FunctionType::get(llvm::Type::getVoidTy(*ctx),
- arg_types, /*vararg?=*/false);
- llvm::Function* fn
- = llvm::Function::Create(fn_type, llvm::GlobalValue::ExternalLinkage, debug_name, *mod);
- for (size_t i = 0; i < fImpl->strides.size(); i++) {
- fn->addParamAttr(i+1, llvm::Attribute::NoAlias);
- }
-
- llvm::BasicBlock *enter = llvm::BasicBlock::Create(*ctx, "enter" , fn),
- *hoistK = llvm::BasicBlock::Create(*ctx, "hoistK", fn),
- *testK = llvm::BasicBlock::Create(*ctx, "testK" , fn),
- *loopK = llvm::BasicBlock::Create(*ctx, "loopK" , fn),
- *hoist1 = llvm::BasicBlock::Create(*ctx, "hoist1", fn),
- *test1 = llvm::BasicBlock::Create(*ctx, "test1" , fn),
- *loop1 = llvm::BasicBlock::Create(*ctx, "loop1" , fn),
- *leave = llvm::BasicBlock::Create(*ctx, "leave" , fn);
-
- using IRBuilder = llvm::IRBuilder<>;
-
- llvm::PHINode* n;
- std::vector<llvm::PHINode*> args;
- std::vector<llvm::Value*> vals(instructions.size());
-
- auto emit = [&](size_t i, bool scalar, IRBuilder* b) {
- auto [op, x,y,z,w, immA,immB,immC, death,can_hoist] = instructions[i];
-
- llvm::Type *i1 = llvm::Type::getInt1Ty (*ctx),
- *i8 = llvm::Type::getInt8Ty (*ctx),
- *i16 = llvm::Type::getInt16Ty(*ctx),
- *f32 = llvm::Type::getFloatTy(*ctx),
- *I1 = scalar ? i1 : llvm::VectorType::get(i1 , K, false ),
- *I8 = scalar ? i8 : llvm::VectorType::get(i8 , K, false ),
- *I16 = scalar ? i16 : llvm::VectorType::get(i16, K, false ),
- *I32 = scalar ? i32 : llvm::VectorType::get(i32, K, false ),
- *F32 = scalar ? f32 : llvm::VectorType::get(f32, K, false );
-
- auto I = [&](llvm::Value* v) { return b->CreateBitCast(v, I32 ); };
- auto F = [&](llvm::Value* v) { return b->CreateBitCast(v, F32 ); };
-
- auto S = [&](llvm::Type* dst, llvm::Value* v) { return b->CreateSExt(v, dst); };
-
- llvm::Type* vt = nullptr;
- switch (llvm::Type* t = nullptr; op) {
- default:
- SkDebugf("can't llvm %s (%d)\n", name(op), op);
- return false;
-
- case Op::assert_true: /*TODO*/ break;
-
- case Op::trace_line:
- case Op::trace_var:
- case Op::trace_enter:
- case Op::trace_exit:
- case Op::trace_scope:
- /* Force this program to run in the interpreter. */
- return false;
-
- case Op::index:
- if (I32->isVectorTy()) {
- std::vector<llvm::Constant*> iota(K);
- for (int j = 0; j < K; j++) {
- iota[j] = b->getInt32(j);
- }
- vals[i] = b->CreateSub(b->CreateVectorSplat(K, n),
- llvm::ConstantVector::get(iota));
- } else {
- vals[i] = n;
- } break;
-
- case Op::load8: t = I8 ; goto load;
- case Op::load16: t = I16; goto load;
- case Op::load32: t = I32; goto load;
- load: {
- llvm::Value* ptr = b->CreateBitCast(args[immA], t->getPointerTo());
- vals[i] = b->CreateZExt(
- b->CreateAlignedLoad(t, ptr, llvm::MaybeAlign{1}), I32);
- } break;
-
-
- case Op::splat: vals[i] = llvm::ConstantInt::get(I32, immA); break;
-
- case Op::uniform32: {
- llvm::Value* ptr = b->CreateBitCast(
- b->CreateConstInBoundsGEP1_32(i8, args[immA], immB),
- i32->getPointerTo());
- llvm::Value* val = b->CreateZExt(
- b->CreateAlignedLoad(i32, ptr, llvm::MaybeAlign{1}), i32);
- vals[i] = I32->isVectorTy() ? b->CreateVectorSplat(K, val)
- : val;
- } break;
-
- case Op::gather8: t = i8 ; vt = I8; goto gather;
- case Op::gather16: t = i16; vt = I16; goto gather;
- case Op::gather32: t = i32; vt = I32; goto gather;
- gather: {
- // Our gather base pointer is immB bytes off of uniform immA.
- llvm::Value* base =
- b->CreateLoad(b->CreateBitCast(
- b->CreateConstInBoundsGEP1_32(i8, args[immA],immB),
- t->getPointerTo()->getPointerTo()));
-
- llvm::Value* ptr = b->CreateInBoundsGEP(t, base, vals[x]);
- llvm::Value* gathered;
- if (ptr->getType()->isVectorTy()) {
- gathered = b->CreateMaskedGather(
- vt,
- ptr,
- llvm::Align{1});
- } else {
- gathered = b->CreateAlignedLoad(vt, ptr, llvm::MaybeAlign{1});
- }
- vals[i] = b->CreateZExt(gathered, I32);
- } break;
-
- case Op::store8: t = I8 ; goto store;
- case Op::store16: t = I16; goto store;
- case Op::store32: t = I32; goto store;
- store: {
- llvm::Value* val = b->CreateTrunc(vals[x], t);
- llvm::Value* ptr = b->CreateBitCast(args[immA],
- val->getType()->getPointerTo());
- vals[i] = b->CreateAlignedStore(val, ptr, llvm::MaybeAlign{1});
- } break;
-
- case Op::bit_and: vals[i] = b->CreateAnd(vals[x], vals[y]); break;
- case Op::bit_or : vals[i] = b->CreateOr (vals[x], vals[y]); break;
- case Op::bit_xor: vals[i] = b->CreateXor(vals[x], vals[y]); break;
- case Op::bit_clear: vals[i] = b->CreateAnd(vals[x], b->CreateNot(vals[y])); break;
-
- case Op::select:
- vals[i] = b->CreateSelect(b->CreateTrunc(vals[x], I1), vals[y], vals[z]);
- break;
-
- case Op::add_i32: vals[i] = b->CreateAdd(vals[x], vals[y]); break;
- case Op::sub_i32: vals[i] = b->CreateSub(vals[x], vals[y]); break;
- case Op::mul_i32: vals[i] = b->CreateMul(vals[x], vals[y]); break;
-
- case Op::shl_i32: vals[i] = b->CreateShl (vals[x], immA); break;
- case Op::sra_i32: vals[i] = b->CreateAShr(vals[x], immA); break;
- case Op::shr_i32: vals[i] = b->CreateLShr(vals[x], immA); break;
-
- case Op:: eq_i32: vals[i] = S(I32, b->CreateICmpEQ (vals[x], vals[y])); break;
- case Op:: gt_i32: vals[i] = S(I32, b->CreateICmpSGT(vals[x], vals[y])); break;
-
- case Op::add_f32: vals[i] = I(b->CreateFAdd(F(vals[x]), F(vals[y]))); break;
- case Op::sub_f32: vals[i] = I(b->CreateFSub(F(vals[x]), F(vals[y]))); break;
- case Op::mul_f32: vals[i] = I(b->CreateFMul(F(vals[x]), F(vals[y]))); break;
- case Op::div_f32: vals[i] = I(b->CreateFDiv(F(vals[x]), F(vals[y]))); break;
-
- case Op:: eq_f32: vals[i] = S(I32, b->CreateFCmpOEQ(F(vals[x]), F(vals[y]))); break;
- case Op::neq_f32: vals[i] = S(I32, b->CreateFCmpUNE(F(vals[x]), F(vals[y]))); break;
- case Op:: gt_f32: vals[i] = S(I32, b->CreateFCmpOGT(F(vals[x]), F(vals[y]))); break;
- case Op::gte_f32: vals[i] = S(I32, b->CreateFCmpOGE(F(vals[x]), F(vals[y]))); break;
-
- case Op::fma_f32:
- vals[i] = I(b->CreateIntrinsic(llvm::Intrinsic::fma, {F32},
- {F(vals[x]), F(vals[y]), F(vals[z])}));
- break;
-
- case Op::fms_f32:
- vals[i] = I(b->CreateIntrinsic(llvm::Intrinsic::fma, {F32},
- {F(vals[x]), F(vals[y]),
- b->CreateFNeg(F(vals[z]))}));
- break;
-
- case Op::fnma_f32:
- vals[i] = I(b->CreateIntrinsic(llvm::Intrinsic::fma, {F32},
- {b->CreateFNeg(F(vals[x])), F(vals[y]),
- F(vals[z])}));
- break;
-
- case Op::ceil:
- vals[i] = I(b->CreateUnaryIntrinsic(llvm::Intrinsic::ceil, F(vals[x])));
- break;
- case Op::floor:
- vals[i] = I(b->CreateUnaryIntrinsic(llvm::Intrinsic::floor, F(vals[x])));
- break;
-
- case Op::max_f32:
- vals[i] = I(b->CreateSelect(b->CreateFCmpOLT(F(vals[x]), F(vals[y])),
- F(vals[y]), F(vals[x])));
- break;
- case Op::min_f32:
- vals[i] = I(b->CreateSelect(b->CreateFCmpOLT(F(vals[y]), F(vals[x])),
- F(vals[y]), F(vals[x])));
- break;
-
- case Op::sqrt_f32:
- vals[i] = I(b->CreateUnaryIntrinsic(llvm::Intrinsic::sqrt, F(vals[x])));
- break;
-
- case Op::to_f32: vals[i] = I(b->CreateSIToFP( vals[x] , F32)); break;
- case Op::trunc : vals[i] = b->CreateFPToSI(F(vals[x]), I32) ; break;
- case Op::round : {
- // Basic impl when we can't use cvtps2dq and co.
- auto round = b->CreateUnaryIntrinsic(llvm::Intrinsic::rint, F(vals[x]));
- vals[i] = b->CreateFPToSI(round, I32);
-
- #if 1 && defined(SK_CPU_X86)
- // Using b->CreateIntrinsic(..., {}, {...}) to avoid name mangling.
- if (scalar) {
- // cvtss2si is float x4 -> int, ignoring input lanes 1,2,3. ¯\_(ツ)_/¯
- llvm::Value* v = llvm::UndefValue::get(
- llvm::VectorType::get(f32, 4, false));
- v = b->CreateInsertElement(v, F(vals[x]), (uint64_t)0);
- vals[i] = b->CreateIntrinsic(llvm::Intrinsic::x86_sse_cvtss2si, {}, {v});
- } else {
- SkASSERT(K == 4 || K == 8);
- auto intr = K == 4 ? llvm::Intrinsic::x86_sse2_cvtps2dq :
- /* K == 8 ?*/ llvm::Intrinsic::x86_avx_cvt_ps2dq_256;
- vals[i] = b->CreateIntrinsic(intr, {}, {F(vals[x])});
- }
- #endif
- } break;
-
- }
- return true;
- };
-
- {
- IRBuilder b(enter);
- b.CreateBr(hoistK);
- }
-
- // hoistK: emit each hoistable vector instruction; goto testK;
- // LLVM can do this sort of thing itself, but we've got the information cheap,
- // and pointer aliasing makes it easier to manually hoist than teach LLVM it's safe.
- {
- IRBuilder b(hoistK);
-
- // Hoisted instructions will need args (think, uniforms), so set that up now.
- // These phi nodes are degenerate... they'll always be the passed-in args from enter.
- // Later on when we start looping the phi nodes will start looking useful.
- llvm::Argument* arg = fn->arg_begin();
- (void)arg++; // Leave n as nullptr... it'd be a bug to use n in a hoisted instruction.
- for (size_t i = 0; i < fImpl->strides.size(); i++) {
- args.push_back(b.CreatePHI(arg->getType(), 1));
- args.back()->addIncoming(arg++, enter);
- }
-
- for (size_t i = 0; i < instructions.size(); i++) {
- if (instructions[i].can_hoist && !emit(i, false, &b)) {
- return;
- }
- }
-
- b.CreateBr(testK);
- }
-
- // testK: if (N >= K) goto loopK; else goto hoist1;
- {
- IRBuilder b(testK);
-
- // New phi nodes for `n` and each pointer argument from hoistK; later we'll add loopK.
- // These also start as the initial function arguments; hoistK can't have changed them.
- llvm::Argument* arg = fn->arg_begin();
-
- n = b.CreatePHI(arg->getType(), 2);
- n->addIncoming(arg++, hoistK);
-
- for (size_t i = 0; i < fImpl->strides.size(); i++) {
- args[i] = b.CreatePHI(arg->getType(), 2);
- args[i]->addIncoming(arg++, hoistK);
- }
-
- b.CreateCondBr(b.CreateICmpSGE(n, b.getInt32(K)), loopK, hoist1);
- }
-
- // loopK: ... insts on K x T vectors; N -= K, args += K*stride; goto testK;
- {
- IRBuilder b(loopK);
- for (size_t i = 0; i < instructions.size(); i++) {
- if (!instructions[i].can_hoist && !emit(i, false, &b)) {
- return;
- }
- }
-
- // n -= K
- llvm::Value* n_next = b.CreateSub(n, b.getInt32(K));
- n->addIncoming(n_next, loopK);
-
- // Each arg ptr += K
- for (size_t i = 0; i < fImpl->strides.size(); i++) {
- llvm::Value* arg_next
- = b.CreateConstInBoundsGEP1_32(
- llvm::Type::getInt8Ty (*ctx),
- args[i],
- K*fImpl->strides[i]);
- args[i]->addIncoming(arg_next, loopK);
- }
- b.CreateBr(testK);
- }
-
- // hoist1: emit each hoistable scalar instruction; goto test1;
- {
- IRBuilder b(hoist1);
- for (size_t i = 0; i < instructions.size(); i++) {
- if (instructions[i].can_hoist && !emit(i, true, &b)) {
- return;
- }
- }
- b.CreateBr(test1);
- }
-
- // test1: if (N >= 1) goto loop1; else goto leave;
- {
- IRBuilder b(test1);
-
- // Set up new phi nodes for `n` and each pointer argument, now from hoist1 and loop1.
- llvm::PHINode* n_new = b.CreatePHI(n->getType(), 2);
- n_new->addIncoming(n, hoist1);
- n = n_new;
-
- for (size_t i = 0; i < fImpl->strides.size(); i++) {
- llvm::PHINode* arg_new = b.CreatePHI(args[i]->getType(), 2);
- arg_new->addIncoming(args[i], hoist1);
- args[i] = arg_new;
- }
-
- b.CreateCondBr(b.CreateICmpSGE(n, b.getInt32(1)), loop1, leave);
- }
-
- // loop1: ... insts on scalars; N -= 1, args += stride; goto test1;
- {
- IRBuilder b(loop1);
- for (size_t i = 0; i < instructions.size(); i++) {
- if (!instructions[i].can_hoist && !emit(i, true, &b)) {
- return;
- }
- }
-
- // n -= 1
- llvm::Value* n_next = b.CreateSub(n, b.getInt32(1));
- n->addIncoming(n_next, loop1);
-
- // Each arg ptr += 1
- for (size_t i = 0; i < fImpl->strides.size(); i++) {
- llvm::Value* arg_next
- = b.CreateConstInBoundsGEP1_32(
- llvm::Type::getInt8Ty (*ctx), args[i], fImpl->strides[i]);
- args[i]->addIncoming(arg_next, loop1);
- }
- b.CreateBr(test1);
- }
-
- // leave: ret
- {
- IRBuilder b(leave);
- b.CreateRetVoid();
- }
-
- SkASSERT(false == llvm::verifyModule(*mod, &llvm::outs()));
-
- if (true) {
- SkString path = SkStringPrintf("/tmp/%s.bc", debug_name);
- std::error_code err;
- llvm::raw_fd_ostream os(path.c_str(), err);
- if (err) {
- return;
- }
- llvm::WriteBitcodeToFile(*mod, os);
- }
-
- static SkOnce once;
- once([]{
- SkAssertResult(false == llvm::InitializeNativeTarget());
- SkAssertResult(false == llvm::InitializeNativeTargetAsmPrinter());
- });
-
- if (llvm::ExecutionEngine* ee = llvm::EngineBuilder(std::move(mod))
- .setEngineKind(llvm::EngineKind::JIT)
- .setMCPU(llvm::sys::getHostCPUName())
- .create()) {
- fImpl->llvm_ctx = std::move(ctx);
- fImpl->llvm_ee.reset(ee);
-
- #if defined(SKVM_LLVM_WAIT_FOR_COMPILATION)
- // Wait for llvm to compile
- void* function = (void*)ee->getFunctionAddress(debug_name);
- fImpl->jit_entry.store(function);
- // We have to be careful here about what we close over and how, in case fImpl moves.
- // fImpl itself may change, but its pointee fields won't, so close over them by value.
- // Also, debug_name will almost certainly leave scope, so copy it.
- #else
- fImpl->llvm_compiling = std::async(std::launch::async, [dst = &fImpl->jit_entry,
- ee = fImpl->llvm_ee.get(),
- name = std::string(debug_name)]{
- // std::atomic<void*>* dst;
- // llvm::ExecutionEngine* ee;
- // std::string name;
- dst->store( (void*)ee->getFunctionAddress(name.c_str()) );
- });
- #endif
- }
- }
- #endif // SKVM_LLVM
-
- void Program::waitForLLVM() const {
- #if defined(SKVM_LLVM) && !defined(SKVM_LLVM_WAIT_FOR_COMPILATION)
- if (fImpl->llvm_compiling.valid()) {
- fImpl->llvm_compiling.wait();
- }
- #endif
- }
-
bool Program::hasTraceHooks() const {
// Identifies a program which has been instrumented for debugging.
return !fImpl->traceHooks.empty();
}
bool Program::hasJIT() const {
- // Program::hasJIT() is really just a debugging / test aid,
- // so we don't mind adding a sync point here to wait for compilation.
- this->waitForLLVM();
-
return fImpl->jit_entry.load() != nullptr;
}
void Program::dropJIT() {
- #if defined(SKVM_LLVM)
- this->waitForLLVM();
- fImpl->llvm_ee .reset(nullptr);
- fImpl->llvm_ctx.reset(nullptr);
- #elif defined(SKVM_JIT)
+ #if defined(SKVM_JIT)
if (fImpl->dylib) {
close_dylib(fImpl->dylib);
} else if (auto jit_entry = fImpl->jit_entry.load()) {
@@ -3163,14 +2683,11 @@ namespace skvm {
fImpl->strides = strides;
fImpl->traceHooks = traceHooks;
if (gSkVMAllowJIT && allow_jit) {
- #if 1 && defined(SKVM_LLVM)
- this->setupLLVM(instructions, debug_name);
- #elif 1 && defined(SKVM_JIT)
+ #if defined(SKVM_JIT)
this->setupJIT(instructions, debug_name);
#endif
}
- // Might as well do this after setupLLVM() to get a little more time to compile.
this->setupInterpreter(instructions);
}
@@ -3478,7 +2995,7 @@ namespace skvm {
*registers_used = 0; // We'll update this as we go.
- if (SK_ARRAY_COUNT(arg) < fImpl->strides.size()) {
+ if (std::size(arg) < fImpl->strides.size()) {
return false;
}
@@ -4353,13 +3870,9 @@ namespace skvm {
// Make sure trace commands stay on JIT for visualizer
continue;
}
- auto start = a->size();
if (instructions[id].can_hoist && !emit(id, /*scalar=*/false)) {
return false;
}
- if (fImpl->visualizer && instructions[id].can_hoist) {
- fImpl->visualizer->addMachineCommands(id, start, a->size());
- }
}
// This point marks a kind of canonical fixed point for register contents: if loop
@@ -4389,13 +3902,9 @@ namespace skvm {
// Make sure trace commands stay on JIT for visualizer
continue;
}
- auto start = a->size();
if (!instructions[id].can_hoist && !emit(id, /*scalar=*/false)) {
return false;
}
- if (fImpl->visualizer && !instructions[id].can_hoist) {
- fImpl->visualizer->addMachineCommands(id, start, a->size());
- }
}
restore_incoming_regs();
for (int i = 0; i < (int)fImpl->strides.size(); i++) {
@@ -4435,6 +3944,17 @@ namespace skvm {
exit();
}
+ // On ARM64, we use immediate offsets to adjust the stack pointer, and those are limited to
+ // 12 bits. If our function is going to require more than 4k of stack, just fail. We could
+ // tweak the code that adjusts `sp`, but then we risk exceeding the (larger) immediate limit
+ // on our sp-relative load and store opcodes.
+ #if defined(__aarch64__)
+ const int stack_bytes = (*stack_hint) * K * 4;
+ if (stack_bytes > mask(12)) {
+ return false;
+ }
+ #endif
+
// Except for explicit aligned load and store instructions, AVX allows
// memory operands to be unaligned. So even though we're creating 16
// byte patterns on ARM or 32-byte patterns on x86, we only need to
@@ -4489,8 +4009,6 @@ namespace skvm {
// Remap as executable, and flush caches on platforms that need that.
remap_as_executable(jit_entry, fImpl->jit_size);
- notify_vtune(debug_name, jit_entry, fImpl->jit_size);
-
#if !defined(SK_BUILD_FOR_WIN)
// For profiling and debugging, it's helpful to have this code loaded
// dynamically rather than just jumping info fImpl->jit_entry.
@@ -4508,6 +4026,9 @@ namespace skvm {
"echo '.global _skvm_jit\n_skvm_jit: .incbin \"%s\"'"
" | clang -x assembler -shared - -o %s",
path.c_str(), path.c_str());
+ #if defined(__aarch64__)
+ cmd.append(" -arch arm64");
+ #endif
system(cmd.c_str());
// Load that dynamic library and look up skvm_jit().
@@ -4544,6 +4065,9 @@ namespace skvm {
"echo '.global _skvm_jit\n_skvm_jit: .incbin \"%s\"'"
" | clang -x assembler -shared - -o %s",
path, path);
+ #if defined(__aarch64__)
+ cmd.append(" -arch arm64");
+ #endif
system(cmd.c_str());
// Now objdump to disassemble our function:
diff --git a/chromium/third_party/skia/src/core/SkVM.h b/chromium/third_party/skia/src/core/SkVM.h
index f14689976f9..60037d1e176 100644
--- a/chromium/third_party/skia/src/core/SkVM.h
+++ b/chromium/third_party/skia/src/core/SkVM.h
@@ -34,10 +34,6 @@ class SkWStream;
#endif
#if 0
- #define SKVM_LLVM
-#endif
-
-#if 0
#undef SKVM_JIT
#endif
@@ -558,7 +554,7 @@ namespace skvm {
for (int bits : ints) {
buf.push_back(bits);
}
- return {base, (int)( sizeof(int)*(buf.size() - SK_ARRAY_COUNT(ints)) )};
+ return {base, (int)( sizeof(int)*(buf.size() - std::size(ints)) )};
}
Uniform pushArray(int32_t a[]) {
@@ -1079,7 +1075,7 @@ namespace skvm {
bool hasJIT() const; // Has this Program been JITted?
bool hasTraceHooks() const; // Is this program instrumented for debugging?
- void visualize(SkWStream* output, const char* code) const;
+ void visualize(SkWStream* output) const;
void dump(SkWStream* = nullptr) const;
void disassemble(SkWStream* = nullptr) const;
viz::Visualizer* visualizer();
@@ -1087,13 +1083,11 @@ namespace skvm {
private:
void setupInterpreter(const std::vector<OptimizedInstruction>&);
void setupJIT (const std::vector<OptimizedInstruction>&, const char* debug_name);
- void setupLLVM (const std::vector<OptimizedInstruction>&, const char* debug_name);
bool jit(const std::vector<OptimizedInstruction>&,
int* stack_hint, uint32_t* registers_used,
Assembler*) const;
- void waitForLLVM() const;
void dropJIT();
struct Impl;
diff --git a/chromium/third_party/skia/src/core/SkVMBlitter.cpp b/chromium/third_party/skia/src/core/SkVMBlitter.cpp
index 50e730ae2c7..3c2475e938d 100644
--- a/chromium/third_party/skia/src/core/SkVMBlitter.cpp
+++ b/chromium/third_party/skia/src/core/SkVMBlitter.cpp
@@ -21,7 +21,6 @@
#include "src/core/SkVM.h"
#include "src/core/SkVMBlitter.h"
#include "src/shaders/SkColorFilterShader.h"
-#include "src/shaders/SkColorShader.h"
#include <cinttypes>
@@ -228,7 +227,12 @@ SkVMBlitter::Params SkVMBlitter::EffectiveParams(const SkPixmap& device,
// but if there is a shader, it's modulated by the paint alpha.
sk_sp<SkShader> shader = paint.refShader();
if (!shader) {
- shader = sk_make_sp<SkColor4Shader>(paint.getColor4f(), nullptr);
+ shader = SkShaders::Color(paint.getColor4f(), nullptr);
+ if (!shader) {
+ // If the paint color is non-finite (possible after RemoveColorFilter), we might not
+ // have a shader. (oss-fuzz:49391)
+ shader = SkShaders::Color(SK_ColorTRANSPARENT);
+ }
} else if (paint.getAlphaf() < 1.0f) {
shader = sk_make_sp<SkColorFilterShader>(std::move(shader),
paint.getAlphaf(),
diff --git a/chromium/third_party/skia/src/core/SkVertices.cpp b/chromium/third_party/skia/src/core/SkVertices.cpp
index 7569de70793..1e364ef8e22 100644
--- a/chromium/third_party/skia/src/core/SkVertices.cpp
+++ b/chromium/third_party/skia/src/core/SkVertices.cpp
@@ -279,13 +279,16 @@ sk_sp<SkVertices> SkVerticesPriv::Decode(SkReadBuffer& buffer) {
// Check that the header fields and buffer are valid. If this is data with the experimental
// custom attributes feature - we don't support that any more.
- if (!safe || !buffer.isValid() || attrCount) {
+ // We also don't support serialized triangle-fan data. We stopped writing that long ago,
+ // so it should never appear in valid encoded data.
+ if (!safe || !buffer.isValid() || attrCount ||
+ mode == SkVertices::kTriangleFan_VertexMode) {
return nullptr;
}
const SkVertices::Desc desc{mode, vertexCount, indexCount, hasTexs, hasColors};
SkVertices::Sizes sizes(desc);
- if (!sizes.isValid()) {
+ if (!sizes.isValid() || sizes.fArrays > buffer.available()) {
return nullptr;
}
@@ -304,9 +307,7 @@ sk_sp<SkVertices> SkVerticesPriv::Decode(SkReadBuffer& buffer) {
}
buffer.readByteArray(builder.texCoords(), sizes.fTSize);
buffer.readByteArray(builder.colors(), sizes.fCSize);
- size_t isize = (mode == SkVertices::kTriangleFan_VertexMode) ? sizes.fBuilderTriFanISize
- : sizes.fISize;
- buffer.readByteArray(builder.indices(), isize);
+ buffer.readByteArray(builder.indices(), sizes.fISize);
if (!buffer.isValid()) {
return nullptr;
diff --git a/chromium/third_party/skia/src/core/SkWriteBuffer.cpp b/chromium/third_party/skia/src/core/SkWriteBuffer.cpp
index c942ef7532d..6489820395a 100644
--- a/chromium/third_party/skia/src/core/SkWriteBuffer.cpp
+++ b/chromium/third_party/skia/src/core/SkWriteBuffer.cpp
@@ -68,8 +68,8 @@ void SkBinaryWriteBuffer::writeUInt(uint32_t value) {
fWriter.write32(value);
}
-void SkBinaryWriteBuffer::writeString(const char* value) {
- fWriter.writeString(value);
+void SkBinaryWriteBuffer::writeString(std::string_view value) {
+ fWriter.writeString(value.data(), value.size());
}
void SkBinaryWriteBuffer::writeColor(SkColor color) {
diff --git a/chromium/third_party/skia/src/core/SkWriteBuffer.h b/chromium/third_party/skia/src/core/SkWriteBuffer.h
index 2441087f170..875a5e36fed 100644
--- a/chromium/third_party/skia/src/core/SkWriteBuffer.h
+++ b/chromium/third_party/skia/src/core/SkWriteBuffer.h
@@ -14,6 +14,8 @@
#include "include/private/SkTHash.h"
#include "src/core/SkWriter32.h"
+#include <string_view>
+
class SkFactorySet;
class SkImage;
class SkM44;
@@ -45,7 +47,7 @@ public:
void write32(int32_t value) {
this->writeInt(value);
}
- virtual void writeString(const char* value) = 0;
+ virtual void writeString(std::string_view value) = 0;
virtual void writeFlattenable(const SkFlattenable* flattenable) = 0;
virtual void writeColor(SkColor color) = 0;
@@ -108,7 +110,7 @@ public:
void writeInt(int32_t value) override;
void writeIntArray(const int32_t* value, uint32_t count) override;
void writeUInt(uint32_t value) override;
- void writeString(const char* value) override;
+ void writeString(std::string_view value) override;
void writeFlattenable(const SkFlattenable* flattenable) override;
void writeColor(SkColor color) override;
diff --git a/chromium/third_party/skia/src/core/SkZip.h b/chromium/third_party/skia/src/core/SkZip.h
index 1f32bfed8f6..b1c59a6ce58 100644
--- a/chromium/third_party/skia/src/core/SkZip.h
+++ b/chromium/third_party/skia/src/core/SkZip.h
@@ -79,7 +79,7 @@ public:
constexpr Iterator begin() const { return Iterator{this, 0}; }
constexpr Iterator end() const { return Iterator{this, this->size()}; }
template<size_t I> constexpr auto get() const {
- return SkMakeSpan(std::get<I>(fPointers), fSize);
+ return SkSpan(std::get<I>(fPointers), fSize);
}
constexpr std::tuple<Ts*...> data() const { return fPointers; }
constexpr SkZip first(size_t n) const {
diff --git a/chromium/third_party/skia/src/effects/Sk1DPathEffect.cpp b/chromium/third_party/skia/src/effects/Sk1DPathEffect.cpp
index 44787a04c8e..f32f20f1225 100644
--- a/chromium/third_party/skia/src/effects/Sk1DPathEffect.cpp
+++ b/chromium/third_party/skia/src/effects/Sk1DPathEffect.cpp
@@ -34,6 +34,9 @@ protected:
}
distance += delta;
}
+ if (governor < 0) {
+ return false;
+ }
} while (meas.nextContour());
return true;
}
diff --git a/chromium/third_party/skia/src/effects/SkHighContrastFilter.cpp b/chromium/third_party/skia/src/effects/SkHighContrastFilter.cpp
index 4504ff19a70..acd8fd2670a 100644
--- a/chromium/third_party/skia/src/effects/SkHighContrastFilter.cpp
+++ b/chromium/third_party/skia/src/effects/SkHighContrastFilter.cpp
@@ -21,31 +21,50 @@ sk_sp<SkColorFilter> SkHighContrastFilter::Make(const SkHighContrastConfig& conf
struct Uniforms { float grayscale, invertStyle, contrast; };
- SkString code{R"(
- uniform half grayscale, invertStyle, contrast;
- )"};
- code += kRGB_to_HSL_sksl;
- code += kHSL_to_RGB_sksl;
- code += R"(
- half4 main(half4 inColor) {
- half4 c = inColor; // linear unpremul RGBA in dst gamut.
- if (grayscale == 1) {
- c.rgb = dot(half3(0.2126, 0.7152, 0.0722), c.rgb).rrr;
- }
- if (invertStyle == 1/*brightness*/) {
- c.rgb = 1 - c.rgb;
- } else if (invertStyle == 2/*lightness*/) {
- c.rgb = rgb_to_hsl(c.rgb);
- c.b = 1 - c.b;
- c.rgb = hsl_to_rgb(c.rgb);
- }
- c.rgb = mix(half3(0.5), c.rgb, contrast);
- return half4(saturate(c.rgb), c.a);
- }
- )";
+ static constexpr char kHighContrastFilterCode[] =
+ "uniform half grayscale, invertStyle, contrast;"
+
+ // TODO(skia:13540): Investigate using $rgb_to_hsl from sksl_shared instead.
+ "half3 rgb_to_hsl(half3 c) {"
+ " half mx = max(max(c.r,c.g),c.b),"
+ " mn = min(min(c.r,c.g),c.b),"
+ " d = mx-mn, "
+ " invd = 1.0 / d, "
+ " g_lt_b = c.g < c.b ? 6.0 : 0.0;"
+
+ // We'd prefer to write these tests like `mx == c.r`, but on some GPUs max(x,y) is
+ // not always equal to either x or y. So we use long form, c.r >= c.g && c.r >= c.b.
+ " half h = (1/6.0) * (mx == mn ? 0.0 :"
+ " /*mx==c.r*/ c.r >= c.g && c.r >= c.b ? invd * (c.g - c.b) + g_lt_b :"
+ " /*mx==c.g*/ c.g >= c.b ? invd * (c.b - c.r) + 2.0 "
+ " /*mx==c.b*/ : invd * (c.r - c.g) + 4.0);"
+ " half sum = mx+mn,"
+ " l = sum * 0.5,"
+ " s = mx == mn ? 0.0"
+ " : d / (l > 0.5 ? 2.0 - sum : sum);"
+ " return half3(h,s,l);"
+ "}"
+ "half4 main(half4 inColor) {"
+ " half4 c = inColor;" // linear unpremul RGBA in dst gamut
+ " if (grayscale == 1) {"
+ " c.rgb = dot(half3(0.2126, 0.7152, 0.0722), c.rgb).rrr;"
+ " }"
+ " if (invertStyle == 1) {" // brightness
+ " c.rgb = 1 - c.rgb;"
+ " } else if (invertStyle == 2) {" // lightness
+ " c.rgb = rgb_to_hsl(c.rgb);"
+ " c.b = 1 - c.b;"
+ " c.rgb = $hsl_to_rgb(c.rgb);"
+ " }"
+ " c.rgb = mix(half3(0.5), c.rgb, contrast);"
+ " return half4(saturate(c.rgb), c.a);"
+ "}";
+
+ static const SkRuntimeEffect* effect = SkMakeCachedRuntimeEffect(
+ SkRuntimeEffect::MakeForColorFilter,
+ SkString(kHighContrastFilterCode)
+ ).release();
- sk_sp<SkRuntimeEffect> effect = SkMakeCachedRuntimeEffect(SkRuntimeEffect::MakeForColorFilter,
- std::move(code));
SkASSERT(effect);
// A contrast setting of exactly +1 would divide by zero (1+c)/(1-c), so pull in to +1-ε.
diff --git a/chromium/third_party/skia/src/effects/SkLumaColorFilter.cpp b/chromium/third_party/skia/src/effects/SkLumaColorFilter.cpp
index 2db4ee5573f..e42a584ed24 100644
--- a/chromium/third_party/skia/src/effects/SkLumaColorFilter.cpp
+++ b/chromium/third_party/skia/src/effects/SkLumaColorFilter.cpp
@@ -12,12 +12,12 @@
sk_sp<SkColorFilter> SkLumaColorFilter::Make() {
#ifdef SK_ENABLE_SKSL
- const char* code =
+ static const SkRuntimeEffect* effect = SkMakeCachedRuntimeEffect(
+ SkRuntimeEffect::MakeForColorFilter,
"half4 main(half4 inColor) {"
- "return saturate(dot(half3(0.2126, 0.7152, 0.0722), inColor.rgb)).000r;"
- "}";
- sk_sp<SkRuntimeEffect> effect = SkMakeCachedRuntimeEffect(SkRuntimeEffect::MakeForColorFilter,
- code);
+ " return saturate(dot(half3(0.2126, 0.7152, 0.0722), inColor.rgb)).000r;"
+ "}"
+ ).release();
SkASSERT(effect);
return effect->makeColorFilter(SkData::MakeEmpty());
diff --git a/chromium/third_party/skia/src/effects/SkOverdrawColorFilter.cpp b/chromium/third_party/skia/src/effects/SkOverdrawColorFilter.cpp
index 435b3bfa64b..427c006fa09 100644
--- a/chromium/third_party/skia/src/effects/SkOverdrawColorFilter.cpp
+++ b/chromium/third_party/skia/src/effects/SkOverdrawColorFilter.cpp
@@ -13,25 +13,26 @@
sk_sp<SkColorFilter> SkOverdrawColorFilter::MakeWithSkColors(const SkColor colors[kNumColors]) {
#ifdef SK_ENABLE_SKSL
- sk_sp<SkRuntimeEffect> effect = SkMakeCachedRuntimeEffect(
- SkRuntimeEffect::MakeForColorFilter,
- R"(uniform half4 color0;
- uniform half4 color1;
- uniform half4 color2;
- uniform half4 color3;
- uniform half4 color4;
- uniform half4 color5;
+ static const SkRuntimeEffect* effect = SkMakeCachedRuntimeEffect(
+ SkRuntimeEffect::MakeForColorFilter,
+ "uniform half4 color0;"
+ "uniform half4 color1;"
+ "uniform half4 color2;"
+ "uniform half4 color3;"
+ "uniform half4 color4;"
+ "uniform half4 color5;"
+ ""
+ "half4 main(half4 color) {"
+ " half alpha = 255.0 * color.a;"
+ " color = alpha < 0.5 ? color0"
+ " : alpha < 1.5 ? color1"
+ " : alpha < 2.5 ? color2"
+ " : alpha < 3.5 ? color3"
+ " : alpha < 4.5 ? color4 : color5;"
+ " return color;"
+ "}"
+ ).release();
- half4 main(half4 color) {
- half alpha = 255.0 * color.a;
- color = alpha < 0.5 ? color0
- : alpha < 1.5 ? color1
- : alpha < 2.5 ? color2
- : alpha < 3.5 ? color3
- : alpha < 4.5 ? color4 : color5;
- return color;
- }
- )");
if (effect) {
auto data = SkData::MakeUninitialized(kNumColors * sizeof(SkPMColor4f));
SkPMColor4f* premul = (SkPMColor4f*)data->writable_data();
diff --git a/chromium/third_party/skia/src/effects/SkTableColorFilter.cpp b/chromium/third_party/skia/src/effects/SkTableColorFilter.cpp
index a5130032c28..57dded83b57 100644
--- a/chromium/third_party/skia/src/effects/SkTableColorFilter.cpp
+++ b/chromium/third_party/skia/src/effects/SkTableColorFilter.cpp
@@ -18,6 +18,10 @@
#include "src/core/SkVM.h"
#include "src/core/SkWriteBuffer.h"
+#ifdef SK_GRAPHITE_ENABLED
+#include "src/gpu/graphite/Image_Graphite.h"
+#endif
+
class SkTable_ColorFilter : public SkColorFilterBase {
public:
SkTable_ColorFilter(const uint8_t tableA[], const uint8_t tableR[],
@@ -38,7 +42,14 @@ public:
#if SK_SUPPORT_GPU
GrFPResult asFragmentProcessor(std::unique_ptr<GrFragmentProcessor> inputFP,
- GrRecordingContext*, const GrColorInfo&) const override;
+ GrRecordingContext*, const GrColorInfo&,
+ const SkSurfaceProps&) const override;
+#endif
+
+#ifdef SK_ENABLE_SKSL
+ void addToKey(const SkKeyContext& keyContext,
+ SkPaintParamsKeyBuilder* builder,
+ SkPipelineDataGatherer* gatherer) const override;
#endif
bool onAppendStages(const SkStageRec& rec, bool shaderIsOpaque) const override {
@@ -182,7 +193,10 @@ std::unique_ptr<GrFragmentProcessor> ColorTableEffect::Make(
SkASSERT(kPremul_SkAlphaType == bitmap.alphaType());
SkASSERT(bitmap.isImmutable());
- auto view = std::get<0>(GrMakeCachedBitmapProxyView(context, bitmap, GrMipmapped::kNo));
+ auto view = std::get<0>(GrMakeCachedBitmapProxyView(context,
+ bitmap,
+ /*label=*/"MakeColorTableEffect",
+ GrMipmapped::kNo));
if (!view) {
return nullptr;
}
@@ -220,9 +234,11 @@ std::unique_ptr<GrFragmentProcessor> ColorTableEffect::TestCreate(GrProcessorTes
(flags & (1 << 3)) ? luts[3] : nullptr
));
sk_sp<SkColorSpace> colorSpace = GrTest::TestColorSpace(d->fRandom);
+ SkSurfaceProps props; // default props for testing
auto [success, fp] = as_CFB(filter)->asFragmentProcessor(
d->inputFP(), d->context(),
- GrColorInfo(GrColorType::kRGBA_8888, kUnknown_SkAlphaType, std::move(colorSpace)));
+ GrColorInfo(GrColorType::kRGBA_8888, kUnknown_SkAlphaType, std::move(colorSpace)),
+ props);
SkASSERT(success);
return std::move(fp);
}
@@ -230,13 +246,46 @@ std::unique_ptr<GrFragmentProcessor> ColorTableEffect::TestCreate(GrProcessorTes
GrFPResult SkTable_ColorFilter::asFragmentProcessor(std::unique_ptr<GrFragmentProcessor> inputFP,
GrRecordingContext* context,
- const GrColorInfo&) const {
+ const GrColorInfo&,
+ const SkSurfaceProps&) const {
auto cte = ColorTableEffect::Make(std::move(inputFP), context, fBitmap);
return cte ? GrFPSuccess(std::move(cte)) : GrFPFailure(nullptr);
}
#endif // SK_SUPPORT_GPU
+#ifdef SK_ENABLE_SKSL
+
+#include "include/core/SkImage.h"
+#include "src/core/SkKeyContext.h"
+#include "src/core/SkKeyHelpers.h"
+#include "src/core/SkPaintParamsKey.h"
+
+void SkTable_ColorFilter::addToKey(const SkKeyContext& keyContext,
+ SkPaintParamsKeyBuilder* builder,
+ SkPipelineDataGatherer* gatherer) const {
+ TableColorFilterBlock::TableColorFilterData data;
+
+#ifdef SK_GRAPHITE_ENABLED
+ // TODO(b/239604347): remove this hack. This is just here until we determine what Graphite's
+ // Recorder-level caching story is going to be.
+ sk_sp<SkImage> image = SkImage::MakeFromBitmap(fBitmap);
+ image = image->makeTextureImage(keyContext.recorder(), { skgpu::graphite::Mipmapped::kNo });
+
+ if (as_IB(image)->isGraphiteBacked()) {
+ skgpu::graphite::Image* grImage = static_cast<skgpu::graphite::Image*>(image.get());
+
+ auto [view, _] = grImage->asView(keyContext.recorder(), skgpu::graphite::Mipmapped::kNo);
+ data.fTextureProxy = view.refProxy();
+ }
+#endif
+
+ TableColorFilterBlock::BeginBlock(keyContext, builder, gatherer, data);
+ builder->endBlock();
+}
+
+#endif
+
///////////////////////////////////////////////////////////////////////////////
sk_sp<SkColorFilter> SkTableColorFilter::Make(const uint8_t table[256]) {
diff --git a/chromium/third_party/skia/src/effects/imagefilters/SkAlphaThresholdImageFilter.cpp b/chromium/third_party/skia/src/effects/imagefilters/SkAlphaThresholdImageFilter.cpp
index 69ff5f34df6..d3a246b3bdc 100644
--- a/chromium/third_party/skia/src/effects/imagefilters/SkAlphaThresholdImageFilter.cpp
+++ b/chromium/third_party/skia/src/effects/imagefilters/SkAlphaThresholdImageFilter.cpp
@@ -24,7 +24,7 @@
#include "src/gpu/ganesh/effects/GrSkSLFP.h"
#include "src/gpu/ganesh/effects/GrTextureEffect.h"
#if SK_GPU_V1
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#endif // SK_GPU_V1
#endif // SK_SUPPORT_GPU
@@ -139,7 +139,7 @@ static std::unique_ptr<GrFragmentProcessor> make_alpha_threshold_fp(
std::unique_ptr<GrFragmentProcessor> maskFP,
float innerThreshold,
float outerThreshold) {
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
uniform shader maskFP;
uniform half innerThreshold;
uniform half outerThreshold;
diff --git a/chromium/third_party/skia/src/effects/imagefilters/SkArithmeticImageFilter.cpp b/chromium/third_party/skia/src/effects/imagefilters/SkArithmeticImageFilter.cpp
index 88c890e4508..1a5a0a37f1a 100644
--- a/chromium/third_party/skia/src/effects/imagefilters/SkArithmeticImageFilter.cpp
+++ b/chromium/third_party/skia/src/effects/imagefilters/SkArithmeticImageFilter.cpp
@@ -305,7 +305,7 @@ std::unique_ptr<GrFragmentProcessor> make_arithmetic_fp(
std::unique_ptr<GrFragmentProcessor> dstFP,
const SkV4& k,
bool enforcePMColor) {
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
uniform shader srcFP;
uniform shader dstFP;
uniform half4 k;
diff --git a/chromium/third_party/skia/src/effects/imagefilters/SkBlendImageFilter.cpp b/chromium/third_party/skia/src/effects/imagefilters/SkBlendImageFilter.cpp
index a4b3e714dc3..a7760c4e336 100644
--- a/chromium/third_party/skia/src/effects/imagefilters/SkBlendImageFilter.cpp
+++ b/chromium/third_party/skia/src/effects/imagefilters/SkBlendImageFilter.cpp
@@ -306,7 +306,8 @@ sk_sp<SkSpecialImage> SkBlendImageFilter::filterImageGPU(const Context& ctx,
foreground->alphaType(), ctx.colorSpace(),
kPremul_SkAlphaType);
- GrFPArgs args(rContext, SkMatrixProvider(SkMatrix::I()), &info.colorInfo());
+ SkSurfaceProps props{}; // default OK; blend-image filters don't render text
+ GrFPArgs args(rContext, SkMatrixProvider(SkMatrix::I()), &info.colorInfo(), props);
fp = as_BB(fBlender)->asFragmentProcessor(std::move(fgFP), std::move(fp), args);
}
diff --git a/chromium/third_party/skia/src/effects/imagefilters/SkBlurImageFilter.cpp b/chromium/third_party/skia/src/effects/imagefilters/SkBlurImageFilter.cpp
index 5be28320bd0..c0f9419ab28 100644
--- a/chromium/third_party/skia/src/effects/imagefilters/SkBlurImageFilter.cpp
+++ b/chromium/third_party/skia/src/effects/imagefilters/SkBlurImageFilter.cpp
@@ -27,7 +27,7 @@
#include "src/gpu/ganesh/GrTextureProxy.h"
#include "src/gpu/ganesh/SkGr.h"
#if SK_GPU_V1
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#endif // SK_GPU_V1
#endif // SK_SUPPORT_GPU
diff --git a/chromium/third_party/skia/src/effects/imagefilters/SkColorFilterImageFilter.cpp b/chromium/third_party/skia/src/effects/imagefilters/SkColorFilterImageFilter.cpp
index 22a3973b3fc..a21b81c03ac 100644
--- a/chromium/third_party/skia/src/effects/imagefilters/SkColorFilterImageFilter.cpp
+++ b/chromium/third_party/skia/src/effects/imagefilters/SkColorFilterImageFilter.cpp
@@ -45,7 +45,17 @@ private:
sk_sp<SkImageFilter> SkImageFilters::ColorFilter(
sk_sp<SkColorFilter> cf, sk_sp<SkImageFilter> input, const CropRect& cropRect) {
if (!cf) {
- return nullptr;
+ // The color filter is the identity, but 'cropRect' and 'input' may perform actions in the
+ // image filter graph.
+ const SkRect* crop = cropRect;
+ if (crop) {
+ // Wrap 'input' in an offset filter with (0,0) and the crop rect.
+ // TODO(michaelludwig): Replace this with SkCropImageFilter when that's ready for use.
+ return SkImageFilters::Offset(0.f, 0.f, std::move(input), cropRect);
+ } else {
+ // Just forward 'input' on
+ return input;
+ }
}
SkColorFilter* inputCF;
diff --git a/chromium/third_party/skia/src/effects/imagefilters/SkLightingImageFilter.cpp b/chromium/third_party/skia/src/effects/imagefilters/SkLightingImageFilter.cpp
index d46538fa303..feb39d0e73b 100644
--- a/chromium/third_party/skia/src/effects/imagefilters/SkLightingImageFilter.cpp
+++ b/chromium/third_party/skia/src/effects/imagefilters/SkLightingImageFilter.cpp
@@ -439,7 +439,7 @@ protected:
private:
#if SK_SUPPORT_GPU
- void drawRect(skgpu::SurfaceFillContext*,
+ void drawRect(skgpu::v1::SurfaceFillContext*,
GrSurfaceProxyView srcView,
const SkMatrix& matrix,
const SkIRect& dstRect,
@@ -456,7 +456,7 @@ private:
} // anonymous namespace
#if SK_SUPPORT_GPU
-void SkLightingImageFilterInternal::drawRect(skgpu::SurfaceFillContext* sfc,
+void SkLightingImageFilterInternal::drawRect(skgpu::v1::SurfaceFillContext* sfc,
GrSurfaceProxyView srcView,
const SkMatrix& matrix,
const SkIRect& dstRect,
@@ -1785,7 +1785,7 @@ void LightingEffect::ImplBase::emitCode(EmitArgs& args) {
SkString sobelFuncName = fragBuilder->getMangledFunctionName("sobel");
fragBuilder->emitFunction(SkSLType::kHalf,
sobelFuncName.c_str(),
- {gSobelArgs, SK_ARRAY_COUNT(gSobelArgs)},
+ {gSobelArgs, std::size(gSobelArgs)},
"return (-a + b - 2.0 * c + 2.0 * d -e + f) * scale;");
const GrShaderVar gPointToNormalArgs[] = {
GrShaderVar("x", SkSLType::kHalf),
@@ -1795,7 +1795,7 @@ void LightingEffect::ImplBase::emitCode(EmitArgs& args) {
SkString pointToNormalName = fragBuilder->getMangledFunctionName("pointToNormal");
fragBuilder->emitFunction(SkSLType::kHalf3,
pointToNormalName.c_str(),
- {gPointToNormalArgs, SK_ARRAY_COUNT(gPointToNormalArgs)},
+ {gPointToNormalArgs, std::size(gPointToNormalArgs)},
"return normalize(half3(-x * scale, -y * scale, 1));");
const GrShaderVar gInteriorNormalArgs[] = {
@@ -1808,7 +1808,7 @@ void LightingEffect::ImplBase::emitCode(EmitArgs& args) {
SkString normalName = fragBuilder->getMangledFunctionName("normal");
fragBuilder->emitFunction(SkSLType::kHalf3,
normalName.c_str(),
- {gInteriorNormalArgs, SK_ARRAY_COUNT(gInteriorNormalArgs)},
+ {gInteriorNormalArgs, std::size(gInteriorNormalArgs)},
normalBody.c_str());
fragBuilder->codeAppendf("float2 coord = %s;", args.fSampleCoord);
@@ -1872,7 +1872,7 @@ void DiffuseLightingEffect::Impl::emitLightFunc(const GrFragmentProcessor* owner
*funcName = fragBuilder->getMangledFunctionName("light");
fragBuilder->emitFunction(SkSLType::kHalf4,
funcName->c_str(),
- {gLightArgs, SK_ARRAY_COUNT(gLightArgs)},
+ {gLightArgs, std::size(gLightArgs)},
lightBody.c_str());
}
@@ -1979,7 +1979,7 @@ void SpecularLightingEffect::Impl::emitLightFunc(const GrFragmentProcessor* owne
*funcName = fragBuilder->getMangledFunctionName("light");
fragBuilder->emitFunction(SkSLType::kHalf4,
funcName->c_str(),
- {gLightArgs, SK_ARRAY_COUNT(gLightArgs)},
+ {gLightArgs, std::size(gLightArgs)},
lightBody.c_str());
}
@@ -2119,7 +2119,7 @@ void GpuSpotLight::emitLightColor(const GrFragmentProcessor* owner,
fLightColorFunc = fragBuilder->getMangledFunctionName("lightColor");
fragBuilder->emitFunction(SkSLType::kHalf3,
fLightColorFunc.c_str(),
- {gLightColorArgs, SK_ARRAY_COUNT(gLightColorArgs)},
+ {gLightColorArgs, std::size(gLightColorArgs)},
lightColorBody.c_str());
fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight);
diff --git a/chromium/third_party/skia/src/effects/imagefilters/SkMagnifierImageFilter.cpp b/chromium/third_party/skia/src/effects/imagefilters/SkMagnifierImageFilter.cpp
index af6855d2d0b..b9dded1b8b9 100644
--- a/chromium/third_party/skia/src/effects/imagefilters/SkMagnifierImageFilter.cpp
+++ b/chromium/third_party/skia/src/effects/imagefilters/SkMagnifierImageFilter.cpp
@@ -100,7 +100,7 @@ static std::unique_ptr<GrFragmentProcessor> make_magnifier_fp(
float yInvZoom,
float xInvInset,
float yInvInset) {
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
uniform shader src;
uniform float4 boundsUniform;
uniform float xInvZoom;
diff --git a/chromium/third_party/skia/src/effects/imagefilters/SkMorphologyImageFilter.cpp b/chromium/third_party/skia/src/effects/imagefilters/SkMorphologyImageFilter.cpp
index 2d04d598e34..16e0a655acf 100644
--- a/chromium/third_party/skia/src/effects/imagefilters/SkMorphologyImageFilter.cpp
+++ b/chromium/third_party/skia/src/effects/imagefilters/SkMorphologyImageFilter.cpp
@@ -359,7 +359,7 @@ std::unique_ptr<GrFragmentProcessor> GrMorphologyEffect::TestCreate(GrProcessorT
}
#endif
-static void apply_morphology_rect(skgpu::SurfaceFillContext* sfc,
+static void apply_morphology_rect(skgpu::v1::SurfaceFillContext* sfc,
GrSurfaceProxyView view,
SkAlphaType srcAlphaType,
const SkIRect& srcRect,
@@ -378,7 +378,7 @@ static void apply_morphology_rect(skgpu::SurfaceFillContext* sfc,
sfc->fillRectToRectWithFP(srcRect, dstRect, std::move(fp));
}
-static void apply_morphology_rect_no_bounds(skgpu::SurfaceFillContext* sfc,
+static void apply_morphology_rect_no_bounds(skgpu::v1::SurfaceFillContext* sfc,
GrSurfaceProxyView view,
SkAlphaType srcAlphaType,
const SkIRect& srcRect,
@@ -391,7 +391,7 @@ static void apply_morphology_rect_no_bounds(skgpu::SurfaceFillContext* sfc,
sfc->fillRectToRectWithFP(srcRect, dstRect, std::move(fp));
}
-static void apply_morphology_pass(skgpu::SurfaceFillContext* sfc,
+static void apply_morphology_pass(skgpu::v1::SurfaceFillContext* sfc,
GrSurfaceProxyView view,
SkAlphaType srcAlphaType,
const SkIRect& srcRect,
diff --git a/chromium/third_party/skia/src/effects/imagefilters/SkRuntimeImageFilter.cpp b/chromium/third_party/skia/src/effects/imagefilters/SkRuntimeImageFilter.cpp
index 25d551d0fb3..0537e473953 100644
--- a/chromium/third_party/skia/src/effects/imagefilters/SkRuntimeImageFilter.cpp
+++ b/chromium/third_party/skia/src/effects/imagefilters/SkRuntimeImageFilter.cpp
@@ -26,14 +26,17 @@ public:
sk_sp<SkData> uniforms,
sk_sp<SkImageFilter> input)
: INHERITED(&input, 1, /*cropRect=*/nullptr)
- , fShaderBuilder(std::move(effect), std::move(uniforms))
- , fChildShaderNames(&fShaderBuilder.effect()->children().front().name, 1) {}
+ , fShaderBuilder(std::move(effect), std::move(uniforms)) {
+ std::string_view childName = fShaderBuilder.effect()->children().front().name;
+ fChildShaderNames.push_back(SkString(childName));
+ }
SkRuntimeImageFilter(const SkRuntimeShaderBuilder& builder,
- const char* childShaderNames[],
+ std::string_view childShaderNames[],
const sk_sp<SkImageFilter> inputs[],
int inputCount)
: INHERITED(inputs, inputCount, /*cropRect=*/nullptr)
, fShaderBuilder(builder) {
+ fChildShaderNames.reserve_back(inputCount);
for (int i = 0; i < inputCount; i++) {
fChildShaderNames.push_back(SkString(childShaderNames[i]));
}
@@ -99,7 +102,7 @@ sk_sp<SkFlattenable> SkRuntimeImageFilter::CreateProc(SkReadBuffer& buffer) {
}
// Read the child shader names
- SkSTArray<4, const char*> childShaderNames;
+ SkSTArray<4, std::string_view> childShaderNames;
SkSTArray<4, SkString> childShaderNameStrings;
childShaderNames.resize(common.inputCount());
childShaderNameStrings.resize(common.inputCount());
@@ -111,8 +114,8 @@ sk_sp<SkFlattenable> SkRuntimeImageFilter::CreateProc(SkReadBuffer& buffer) {
SkRuntimeShaderBuilder builder(std::move(effect), std::move(uniforms));
// Populate the builder with the corresponding children
- for (auto& child : builder.effect()->children()) {
- const char* name = child.name.c_str();
+ for (const SkRuntimeEffect::Child& child : builder.effect()->children()) {
+ std::string_view name = child.name;
switch (child.type) {
case SkRuntimeEffect::ChildType::kBlender: {
builder.child(name) = buffer.readBlender();
@@ -133,8 +136,8 @@ sk_sp<SkFlattenable> SkRuntimeImageFilter::CreateProc(SkReadBuffer& buffer) {
return nullptr;
}
- return SkImageFilters::RuntimeShader(
- builder, childShaderNames.data(), common.inputs(), common.inputCount());
+ return SkImageFilters::RuntimeShader(builder, childShaderNames.data(),
+ common.inputs(), common.inputCount());
}
void SkRuntimeImageFilter::flatten(SkWriteBuffer& buffer) const {
@@ -221,42 +224,42 @@ static bool child_is_shader(const SkRuntimeEffect::Child* child) {
}
sk_sp<SkImageFilter> SkImageFilters::RuntimeShader(const SkRuntimeShaderBuilder& builder,
- const char* childShaderName,
+ std::string_view childShaderName,
sk_sp<SkImageFilter> input) {
- // if no childShaderName is provided check to see if we can implicitly assign it to the only
- // child in the effect
- if (childShaderName == nullptr) {
+ // If no childShaderName is provided, check to see if we can implicitly assign it to the only
+ // child in the effect.
+ if (childShaderName.empty()) {
auto children = builder.effect()->children();
if (children.size() != 1) {
return nullptr;
}
- childShaderName = children.front().name.c_str();
+ childShaderName = children.front().name;
}
return SkImageFilters::RuntimeShader(builder, &childShaderName, &input, 1);
}
sk_sp<SkImageFilter> SkImageFilters::RuntimeShader(const SkRuntimeShaderBuilder& builder,
- const char* childShaderNames[],
+ std::string_view childShaderNames[],
const sk_sp<SkImageFilter> inputs[],
int inputCount) {
for (int i = 0; i < inputCount; i++) {
- const char* name = childShaderNames[i];
- // All names must be non-null, and present as a child shader in the effect:
- if (!name || !child_is_shader(builder.effect()->findChild(name))) {
+ std::string_view name = childShaderNames[i];
+ // All names must be non-empty, and present as a child shader in the effect:
+ if (name.empty() || !child_is_shader(builder.effect()->findChild(name))) {
return nullptr;
}
// We don't allow duplicates, either:
for (int j = 0; j < i; j++) {
- if (!strcmp(name, childShaderNames[j])) {
+ if (name == childShaderNames[j]) {
return nullptr;
}
}
}
- return sk_sp<SkImageFilter>(
- new SkRuntimeImageFilter(builder, childShaderNames, inputs, inputCount));
+ return sk_sp<SkImageFilter>(new SkRuntimeImageFilter(builder, childShaderNames,
+ inputs, inputCount));
}
#endif // SK_ENABLE_SKSL
diff --git a/chromium/third_party/skia/src/gpu/AtlasTypes.h b/chromium/third_party/skia/src/gpu/AtlasTypes.h
index 90e48909d94..468d930194b 100644
--- a/chromium/third_party/skia/src/gpu/AtlasTypes.h
+++ b/chromium/third_party/skia/src/gpu/AtlasTypes.h
@@ -22,6 +22,7 @@
class GrOpFlushState;
class TestingUploadTarget;
+namespace skgpu::graphite { class AtlasManager; }
/**
* This file includes internal types that are used by all of our gpu backends for atlases.
@@ -205,12 +206,13 @@ private:
// Only these classes get to increment the token counters
friend class ::GrOpFlushState;
friend class ::TestingUploadTarget;
+ friend class skgpu::graphite::AtlasManager;
/** Issues the next token for a draw. */
DrawToken issueDrawToken() { return ++fLastIssuedToken; }
/** Advances the last flushed token by one. */
- DrawToken flushToken() { return ++fLastFlushedToken; }
+ DrawToken issueFlushToken() { return ++fLastFlushedToken; }
DrawToken fLastIssuedToken = DrawToken::AlreadyFlushedToken();
DrawToken fLastFlushedToken = DrawToken::AlreadyFlushedToken();
@@ -454,6 +456,7 @@ public:
void resetFlushesSinceLastUsed() { fFlushesSinceLastUse = 0; }
void incFlushesSinceLastUsed() { fFlushesSinceLastUse++; }
+ bool needsUpload() { return !fDirtyRect.isEmpty(); }
std::pair<const void*, SkIRect> prepareForUpload();
void resetRects();
diff --git a/chromium/third_party/skia/src/gpu/BUILD.bazel b/chromium/third_party/skia/src/gpu/BUILD.bazel
index 97e9a91ac99..3c73c1bcf2b 100644
--- a/chromium/third_party/skia/src/gpu/BUILD.bazel
+++ b/chromium/third_party/skia/src/gpu/BUILD.bazel
@@ -1,4 +1,4 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy", "split_srcs_and_hdrs")
+load("//bazel:macros.bzl", "bool_flag", "exports_files_legacy", "selects", "skia_cc_deps", "split_srcs_and_hdrs", "string_flag_with_values")
licenses(["notice"])
@@ -31,6 +31,55 @@ split_srcs_and_hdrs(
files = CORE_FILES,
)
+string_flag_with_values(
+ flag_name = "gpu_backend",
+ multiple = True,
+ values = [
+ "gl_backend",
+ "vulkan_backend",
+ "dawn_backend",
+ ],
+)
+
+string_flag_with_values(
+ flag_name = "with_gl_standard",
+ values = [
+ "gles_standard",
+ "gl_standard",
+ "webgl_standard",
+ ],
+)
+
+selects.config_setting_group(
+ name = "has_gpu_backend",
+ match_any = [
+ ":gl_backend",
+ ":dawn_backend",
+ ":vulkan_backend",
+ ],
+ visibility = ["//:__subpackages__"],
+)
+
+selects.config_setting_group(
+ name = "vulkan_with_vma",
+ match_all = [
+ ":vulkan_backend",
+ ":use_vulkan_memory_allocator_true",
+ ],
+ visibility = ["//:__subpackages__"],
+)
+
+bool_flag(
+ default = True,
+ flag_name = "use_vulkan_memory_allocator",
+ public = False, # Users should use :vulkan_with_vma
+)
+
+bool_flag(
+ default = False,
+ flag_name = "enable_gpu_test_utils",
+)
+
filegroup(
name = "srcs",
srcs = [
@@ -48,13 +97,13 @@ filegroup(
"//src/gpu/ganesh:private_hdrs",
"//src/gpu/tessellate:private_hdrs",
] + select({
- "//bazel/common_config_settings:vulkan_backend": ["//src/gpu/vk:private_hdrs"],
+ "//src/gpu:vulkan_backend": ["//src/gpu/vk:private_hdrs"],
"//conditions:default": [],
}),
visibility = ["//src:__pkg__"],
)
-cc_library(
+skia_cc_deps(
name = "deps",
visibility = ["//src:__pkg__"],
deps = [
diff --git a/chromium/third_party/skia/src/gpu/Blend.cpp b/chromium/third_party/skia/src/gpu/Blend.cpp
index a4caa454379..85dc8c5a5c6 100644
--- a/chromium/third_party/skia/src/gpu/Blend.cpp
+++ b/chromium/third_party/skia/src/gpu/Blend.cpp
@@ -74,27 +74,27 @@ ReducedBlendModeInfo GetReducedBlendModeInfo(SkBlendMode mode) {
static constexpr float kLighten[] = {-1};
switch (mode) {
- case SkBlendMode::kSrcOver: return {"blend_porter_duff", SkMakeSpan(kSrcOver)};
- case SkBlendMode::kDstOver: return {"blend_porter_duff", SkMakeSpan(kDstOver)};
- case SkBlendMode::kSrcIn: return {"blend_porter_duff", SkMakeSpan(kSrcIn)};
- case SkBlendMode::kDstIn: return {"blend_porter_duff", SkMakeSpan(kDstIn)};
- case SkBlendMode::kSrcOut: return {"blend_porter_duff", SkMakeSpan(kSrcOut)};
- case SkBlendMode::kDstOut: return {"blend_porter_duff", SkMakeSpan(kDstOut)};
- case SkBlendMode::kSrcATop: return {"blend_porter_duff", SkMakeSpan(kSrcATop)};
- case SkBlendMode::kDstATop: return {"blend_porter_duff", SkMakeSpan(kDstATop)};
- case SkBlendMode::kXor: return {"blend_porter_duff", SkMakeSpan(kXor)};
- case SkBlendMode::kPlus: return {"blend_porter_duff", SkMakeSpan(kPlus)};
-
- case SkBlendMode::kHue: return {"blend_hslc", SkMakeSpan(kHue)};
- case SkBlendMode::kSaturation: return {"blend_hslc", SkMakeSpan(kSaturation)};
- case SkBlendMode::kColor: return {"blend_hslc", SkMakeSpan(kColor)};
- case SkBlendMode::kLuminosity: return {"blend_hslc", SkMakeSpan(kLuminosity)};
-
- case SkBlendMode::kOverlay: return {"blend_overlay", SkMakeSpan(kOverlay)};
- case SkBlendMode::kHardLight: return {"blend_overlay", SkMakeSpan(kHardLight)};
-
- case SkBlendMode::kDarken: return {"blend_darken", SkMakeSpan(kDarken)};
- case SkBlendMode::kLighten: return {"blend_darken", SkMakeSpan(kLighten)};
+ case SkBlendMode::kSrcOver: return {"blend_porter_duff", SkSpan(kSrcOver)};
+ case SkBlendMode::kDstOver: return {"blend_porter_duff", SkSpan(kDstOver)};
+ case SkBlendMode::kSrcIn: return {"blend_porter_duff", SkSpan(kSrcIn)};
+ case SkBlendMode::kDstIn: return {"blend_porter_duff", SkSpan(kDstIn)};
+ case SkBlendMode::kSrcOut: return {"blend_porter_duff", SkSpan(kSrcOut)};
+ case SkBlendMode::kDstOut: return {"blend_porter_duff", SkSpan(kDstOut)};
+ case SkBlendMode::kSrcATop: return {"blend_porter_duff", SkSpan(kSrcATop)};
+ case SkBlendMode::kDstATop: return {"blend_porter_duff", SkSpan(kDstATop)};
+ case SkBlendMode::kXor: return {"blend_porter_duff", SkSpan(kXor)};
+ case SkBlendMode::kPlus: return {"blend_porter_duff", SkSpan(kPlus)};
+
+ case SkBlendMode::kHue: return {"blend_hslc", SkSpan(kHue)};
+ case SkBlendMode::kSaturation: return {"blend_hslc", SkSpan(kSaturation)};
+ case SkBlendMode::kColor: return {"blend_hslc", SkSpan(kColor)};
+ case SkBlendMode::kLuminosity: return {"blend_hslc", SkSpan(kLuminosity)};
+
+ case SkBlendMode::kOverlay: return {"blend_overlay", SkSpan(kOverlay)};
+ case SkBlendMode::kHardLight: return {"blend_overlay", SkSpan(kHardLight)};
+
+ case SkBlendMode::kDarken: return {"blend_darken", SkSpan(kDarken)};
+ case SkBlendMode::kLighten: return {"blend_darken", SkSpan(kLighten)};
default: return {BlendFuncName(mode), {}};
}
diff --git a/chromium/third_party/skia/src/gpu/BufferWriter.h b/chromium/third_party/skia/src/gpu/BufferWriter.h
index b93273e97a2..35ad787c3f6 100644
--- a/chromium/third_party/skia/src/gpu/BufferWriter.h
+++ b/chromium/third_party/skia/src/gpu/BufferWriter.h
@@ -304,7 +304,7 @@ inline VertexWriter& operator<<(VertexWriter& w, const VertexWriter::RepeatDesc<
}
template <>
-SK_MAYBE_UNUSED inline VertexWriter& operator<<(VertexWriter& w, const skvx::float4& vector) {
+[[maybe_unused]] inline VertexWriter& operator<<(VertexWriter& w, const skvx::float4& vector) {
w.validate(sizeof(vector));
vector.store(w.fPtr);
w = w.makeOffset(sizeof(vector));
@@ -354,7 +354,7 @@ private:
};
template <>
-SK_MAYBE_UNUSED inline VertexWriter& operator<<(VertexWriter& w, const VertexColor& color) {
+[[maybe_unused]] inline VertexWriter& operator<<(VertexWriter& w, const VertexColor& color) {
w << color.fColor[0];
if (color.fWideColor) {
w << color.fColor[1]
diff --git a/chromium/third_party/skia/src/gpu/KeyBuilder.h b/chromium/third_party/skia/src/gpu/KeyBuilder.h
index b0848e4c625..a61197c0b7c 100644
--- a/chromium/third_party/skia/src/gpu/KeyBuilder.h
+++ b/chromium/third_party/skia/src/gpu/KeyBuilder.h
@@ -22,7 +22,7 @@ public:
SkASSERT(fBitsUsed == 0);
}
- virtual void addBits(uint32_t numBits, uint32_t val, const char* label) {
+ virtual void addBits(uint32_t numBits, uint32_t val, std::string_view label) {
SkASSERT(numBits > 0 && numBits <= 32);
SkASSERT(numBits == 32 || (val < (1u << numBits)));
@@ -40,18 +40,18 @@ public:
SkASSERT(fCurValue < (1u << fBitsUsed));
}
- void addBytes(uint32_t numBytes, const void* data, const char* label) {
+ void addBytes(uint32_t numBytes, const void* data, std::string_view label) {
const uint8_t* bytes = reinterpret_cast<const uint8_t*>(data);
for (; numBytes --> 0; bytes++) {
this->addBits(8, *bytes, label);
}
}
- void addBool(bool b, const char* label) {
+ void addBool(bool b, std::string_view label) {
this->addBits(1, b, label);
}
- void add32(uint32_t v, const char* label = "unknown") {
+ void add32(uint32_t v, std::string_view label = "unknown") {
this->addBits(32, v, label);
}
@@ -77,9 +77,9 @@ class StringKeyBuilder : public KeyBuilder {
public:
StringKeyBuilder(SkTArray<uint32_t, true>* data) : KeyBuilder(data) {}
- void addBits(uint32_t numBits, uint32_t val, const char* label) override {
+ void addBits(uint32_t numBits, uint32_t val, std::string_view label) override {
KeyBuilder::addBits(numBits, val, label);
- fDescription.appendf("%s: %u\n", label, val);
+ fDescription.appendf("%.*s: %u\n", (int)label.size(), label.data(), val);
}
void appendComment(const char* comment) override {
diff --git a/chromium/third_party/skia/src/gpu/Swizzle.h b/chromium/third_party/skia/src/gpu/Swizzle.h
index 23b7c186cdb..735943a12af 100644
--- a/chromium/third_party/skia/src/gpu/Swizzle.h
+++ b/chromium/third_party/skia/src/gpu/Swizzle.h
@@ -38,7 +38,7 @@ public:
constexpr char operator[](int i) const {
SkASSERT(i >= 0 && i < 4);
- int idx = (fKey >> (4U * i)) & 0xfU;
+ int idx = (fKey >> (4 * i)) & 0xfU;
return IToC(idx);
}
@@ -62,7 +62,7 @@ public:
private:
explicit constexpr Swizzle(uint16_t key) : fKey(key) {}
- static constexpr float ComponentIndexToFloat(std::array<float, 4>, int idx);
+ static constexpr float ComponentIndexToFloat(std::array<float, 4>, size_t idx);
static constexpr int CToI(char c);
static constexpr char IToC(int idx);
@@ -70,7 +70,8 @@ private:
};
constexpr Swizzle::Swizzle(const char c[4])
- : fKey((CToI(c[0]) << 0) | (CToI(c[1]) << 4) | (CToI(c[2]) << 8) | (CToI(c[3]) << 12)) {}
+ : fKey(static_cast<uint16_t>((CToI(c[0]) << 0) | (CToI(c[1]) << 4) | (CToI(c[2]) << 8) |
+ (CToI(c[3]) << 12))) {}
constexpr Swizzle::Swizzle(const Swizzle& that)
: fKey(that.fKey) {}
@@ -83,7 +84,7 @@ constexpr Swizzle& Swizzle::operator=(const Swizzle& that) {
constexpr std::array<float, 4> Swizzle::applyTo(std::array<float, 4> color) const {
uint32_t key = fKey;
// Index of the input color that should be mapped to output r.
- int idx = (key & 15);
+ size_t idx = (key & 15);
float outR = ComponentIndexToFloat(color, idx);
key >>= 4;
idx = (key & 15);
@@ -97,14 +98,14 @@ constexpr std::array<float, 4> Swizzle::applyTo(std::array<float, 4> color) cons
return { outR, outG, outB, outA };
}
-constexpr float Swizzle::ComponentIndexToFloat(std::array<float, 4> color, int idx) {
+constexpr float Swizzle::ComponentIndexToFloat(std::array<float, 4> color, size_t idx) {
if (idx <= 3) {
return color[idx];
}
- if (idx == CToI('1')) {
+ if (idx == static_cast<size_t>(CToI('1'))) {
return 1.0f;
}
- if (idx == CToI('0')) {
+ if (idx == static_cast<size_t>(CToI('0'))) {
return 0.0f;
}
SkUNREACHABLE;
@@ -138,11 +139,11 @@ constexpr char Swizzle::IToC(int idx) {
constexpr Swizzle Swizzle::Concat(const Swizzle& a, const Swizzle& b) {
uint16_t key = 0;
for (int i = 0; i < 4; ++i) {
- int idx = (b.fKey >> (4U * i)) & 0xfU;
+ int idx = (b.fKey >> (4 * i)) & 0xfU;
if (idx != CToI('0') && idx != CToI('1')) {
SkASSERT(idx >= 0 && idx < 4);
// Get the index value stored in a at location idx.
- idx = ((a.fKey >> (4U * idx)) & 0xfU);
+ idx = ((a.fKey >> (4 * idx)) & 0xfU);
}
key |= (idx << (4U * i));
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/BUILD.bazel b/chromium/third_party/skia/src/gpu/ganesh/BUILD.bazel
index 531fdec0705..d903cc2c55b 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/BUILD.bazel
+++ b/chromium/third_party/skia/src/gpu/ganesh/BUILD.bazel
@@ -1,12 +1,10 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy", "select_multi", "split_srcs_and_hdrs")
+load("//bazel:macros.bzl", "exports_files_legacy", "select_multi", "skia_cc_deps", "split_srcs_and_hdrs")
licenses(["notice"])
exports_files_legacy()
CORE_FILES = [
- "BaseDevice.cpp",
- "BaseDevice.h",
"GrAHardwareBufferImageGenerator.cpp",
"GrAHardwareBufferImageGenerator.h",
"GrAHardwareBufferUtils.cpp",
@@ -31,6 +29,8 @@ CORE_FILES = [
"GrBuffer.h",
"GrBufferAllocPool.cpp",
"GrBufferAllocPool.h",
+ "GrBufferTransferRenderTask.cpp",
+ "GrBufferTransferRenderTask.h",
"GrCaps.cpp",
"GrCaps.h",
"GrClientMappedBufferManager.cpp",
@@ -222,8 +222,22 @@ CORE_FILES = [
"GrYUVATextureProxies.h",
"SkGr.cpp",
"SkGr.h",
+ "ClipStack.cpp",
+ "ClipStack.h",
+ "Device.cpp",
+ "Device_drawTexture.cpp",
+ "Device_v1.h",
+ "PathRenderer.cpp",
+ "PathRenderer.h",
+ "PathRendererChain.cpp",
+ "PathRendererChain.h",
+ "StencilClip.h",
+ "StencilMaskHelper.cpp",
+ "StencilMaskHelper.h",
"SurfaceContext.cpp",
"SurfaceContext.h",
+ "SurfaceDrawContext.cpp",
+ "SurfaceDrawContext.h",
"SurfaceFillContext.cpp",
"SurfaceFillContext.h",
]
@@ -245,15 +259,13 @@ filegroup(
"//src/gpu/ganesh/tessellate:srcs",
"//src/gpu/ganesh/ops:srcs",
"//src/gpu/ganesh/text:srcs",
- "//src/gpu/ganesh/v1:srcs",
] + select_multi(
{
- "//bazel/common_config_settings:dawn_backend": ["//src/gpu/ganesh/dawn:srcs"],
- "//bazel/common_config_settings:gl_backend": ["//src/gpu/ganesh/gl:srcs"],
- "//bazel/common_config_settings:vulkan_backend": ["//src/gpu/ganesh/vk:srcs"],
+ "//src/gpu:dawn_backend": ["//src/gpu/ganesh/dawn:srcs"],
+ "//src/gpu:gl_backend": ["//src/gpu/ganesh/gl:srcs"],
+ "//src/gpu:vulkan_backend": ["//src/gpu/ganesh/vk:srcs"],
# TODO(kjlubick) mtl and d3d backend
},
- default = [],
),
visibility = ["//src/gpu:__pkg__"],
)
@@ -270,29 +282,26 @@ filegroup(
"//src/gpu/ganesh/tessellate:private_hdrs",
"//src/gpu/ganesh/ops:private_hdrs",
"//src/gpu/ganesh/text:private_hdrs",
- "//src/gpu/ganesh/v1:private_hdrs",
] + select_multi(
{
- "//bazel/common_config_settings:dawn_backend": ["//src/gpu/ganesh/dawn:private_hdrs"],
- "//bazel/common_config_settings:gl_backend": ["//src/gpu/ganesh/gl:private_hdrs"],
- "//bazel/common_config_settings:vulkan_backend": ["//src/gpu/ganesh/vk:private_hdrs"],
+ "//src/gpu:dawn_backend": ["//src/gpu/ganesh/dawn:private_hdrs"],
+ "//src/gpu:gl_backend": ["//src/gpu/ganesh/gl:private_hdrs"],
+ "//src/gpu:vulkan_backend": ["//src/gpu/ganesh/vk:private_hdrs"],
# TODO(kjlubick) mtl and d3d backend
},
- default = [],
),
visibility = ["//src/gpu:__pkg__"],
)
-cc_library(
+skia_cc_deps(
name = "deps",
visibility = ["//src/gpu:__pkg__"],
deps = select_multi(
{
- "//bazel/common_config_settings:dawn_backend": ["//src/gpu/ganesh/dawn:deps"],
- "//bazel/common_config_settings:gl_backend": ["//src/gpu/ganesh/gl:deps"],
- "//bazel/common_config_settings:vulkan_backend": ["//src/gpu/ganesh/vk:deps"],
+ "//src/gpu:dawn_backend": ["//src/gpu/ganesh/dawn:deps"],
+ "//src/gpu:gl_backend": ["//src/gpu/ganesh/gl:deps"],
+ "//src/gpu:vulkan_backend": ["//src/gpu/ganesh/vk:deps"],
# TODO(kjlubick) mtl and d3d backend
},
- default = [],
),
)
diff --git a/chromium/third_party/skia/src/gpu/ganesh/BaseDevice.cpp b/chromium/third_party/skia/src/gpu/ganesh/BaseDevice.cpp
deleted file mode 100644
index 8130b50f1ac..00000000000
--- a/chromium/third_party/skia/src/gpu/ganesh/BaseDevice.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright 2021 Google LLC
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "src/gpu/ganesh/BaseDevice.h"
-
-#include "include/core/SkColorSpace.h"
-#include "include/gpu/GrRecordingContext.h"
-#include "src/gpu/ganesh/GrProxyProvider.h"
-#include "src/gpu/ganesh/GrRecordingContextPriv.h"
-#include "src/gpu/ganesh/GrSurfaceProxyView.h"
-#include "src/gpu/ganesh/SurfaceContext.h"
-#include "src/gpu/ganesh/SurfaceFillContext.h"
-
-#define ASSERT_SINGLE_OWNER SKGPU_ASSERT_SINGLE_OWNER(fContext->priv().singleOwner())
-
-namespace skgpu {
-
-BaseDevice::BaseDevice(sk_sp<GrRecordingContext> rContext,
- const SkImageInfo& ii,
- const SkSurfaceProps& props)
- : INHERITED(ii, props)
- , fContext(std::move(rContext)) {
-}
-
-GrSurfaceProxyView BaseDevice::readSurfaceView() {
- return this->surfaceFillContext()->readSurfaceView();
-}
-
-/** Checks that the alpha type is legal and gets constructor flags. Returns false if device creation
- should fail. */
-bool BaseDevice::CheckAlphaTypeAndGetFlags(SkAlphaType alphaType,
- InitContents init,
- DeviceFlags* flags) {
- *flags = DeviceFlags::kNone;
- switch (alphaType) {
- case kPremul_SkAlphaType:
- break;
- case kOpaque_SkAlphaType:
- *flags |= DeviceFlags::kIsOpaque;
- break;
- default: // If it is unpremul or unknown don't try to render
- return false;
- }
- if (InitContents::kClear == init) {
- *flags |= DeviceFlags::kNeedClear;
- }
- return true;
-}
-
-SkImageInfo BaseDevice::MakeInfo(SurfaceContext* sc, DeviceFlags flags) {
- SkColorType colorType = GrColorTypeToSkColorType(sc->colorInfo().colorType());
- return SkImageInfo::Make(sc->width(), sc->height(), colorType,
- flags & DeviceFlags::kIsOpaque ? kOpaque_SkAlphaType
- : kPremul_SkAlphaType,
- sc->colorInfo().refColorSpace());
-}
-
-GrRenderTargetProxy* BaseDevice::targetProxy() {
- return this->readSurfaceView().asRenderTargetProxy();
-}
-
-bool BaseDevice::replaceBackingProxy(SkSurface::ContentChangeMode mode) {
- ASSERT_SINGLE_OWNER
-
- const SkImageInfo& ii = this->imageInfo();
- GrRenderTargetProxy* oldRTP = this->targetProxy();
- GrSurfaceProxyView oldView = this->readSurfaceView();
-
- auto grColorType = SkColorTypeToGrColorType(ii.colorType());
- auto format = fContext->priv().caps()->getDefaultBackendFormat(grColorType, GrRenderable::kYes);
- if (!format.isValid()) {
- return false;
- }
-
- GrProxyProvider* proxyProvider = fContext->priv().proxyProvider();
- // This entry point is used by SkSurface_Gpu::onCopyOnWrite so it must create a
- // kExact-backed render target proxy
- sk_sp<GrTextureProxy> proxy =
- proxyProvider->createProxy(format,
- ii.dimensions(),
- GrRenderable::kYes,
- oldRTP->numSamples(),
- oldView.mipmapped(),
- SkBackingFit::kExact,
- oldRTP->isBudgeted(),
- GrProtected::kNo,
- /*label=*/"BaseDevice_ReplaceBackingProxy");
- if (!proxy) {
- return false;
- }
-
- return this->replaceBackingProxy(mode, sk_ref_sp(proxy->asRenderTargetProxy()),
- grColorType, ii.refColorSpace(), oldView.origin(),
- this->surfaceProps());
-}
-
-} // namespace skgpu
diff --git a/chromium/third_party/skia/src/gpu/ganesh/BaseDevice.h b/chromium/third_party/skia/src/gpu/ganesh/BaseDevice.h
deleted file mode 100644
index 0a8b431197b..00000000000
--- a/chromium/third_party/skia/src/gpu/ganesh/BaseDevice.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright 2021 Google LLC
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef BaseDevice_DEFINED
-#define BaseDevice_DEFINED
-
-#include "include/core/SkImage.h"
-#include "include/private/gpu/ganesh/GrTypesPriv.h"
-#include "src/core/SkDevice.h"
-
-class GrRenderTargetProxy;
-class GrSurfaceProxyView;
-
-namespace skgpu {
-
-class SurfaceContext;
-class SurfaceFillContext;
-#if SK_GPU_V1
-namespace v1 { class SurfaceDrawContext; }
-#endif // SK_GPU_V1
-
-/*
- * This class is left over from the initial v1/v2 split. It should be merged into the v1::Device.
- */
-class BaseDevice : public SkBaseDevice {
-public:
- enum class InitContents {
- kClear,
- kUninit
- };
-
- BaseDevice(sk_sp<GrRecordingContext>, const SkImageInfo&, const SkSurfaceProps&);
-
- GrSurfaceProxyView readSurfaceView();
-
- BaseDevice* asGaneshDevice() override { return this; }
-
-#if SK_GPU_V1
- virtual v1::SurfaceDrawContext* surfaceDrawContext() { return nullptr; }
-#endif
-
- virtual SurfaceFillContext* surfaceFillContext() = 0;
- GrRenderTargetProxy* targetProxy();
- GrRecordingContext* recordingContext() const { return fContext.get(); }
-
- virtual bool wait(int numSemaphores,
- const GrBackendSemaphore* waitSemaphores,
- bool deleteSemaphoresAfterWait) = 0;
- virtual void discard() = 0;
- virtual void resolveMSAA() = 0;
-
- virtual bool replaceBackingProxy(SkSurface::ContentChangeMode,
- sk_sp<GrRenderTargetProxy>,
- GrColorType,
- sk_sp<SkColorSpace>,
- GrSurfaceOrigin,
- const SkSurfaceProps&) = 0;
- bool replaceBackingProxy(SkSurface::ContentChangeMode);
-
- using RescaleGamma = SkImage::RescaleGamma;
- using RescaleMode = SkImage::RescaleMode;
- using ReadPixelsCallback = SkImage::ReadPixelsCallback;
- using ReadPixelsContext = SkImage::ReadPixelsContext;
-
- virtual void asyncRescaleAndReadPixels(const SkImageInfo& info,
- const SkIRect& srcRect,
- RescaleGamma rescaleGamma,
- RescaleMode rescaleMode,
- ReadPixelsCallback callback,
- ReadPixelsContext context) = 0;
-
- virtual void asyncRescaleAndReadPixelsYUV420(SkYUVColorSpace yuvColorSpace,
- sk_sp<SkColorSpace> dstColorSpace,
- const SkIRect& srcRect,
- SkISize dstSize,
- RescaleGamma rescaleGamma,
- RescaleMode,
- ReadPixelsCallback callback,
- ReadPixelsContext context) = 0;
-
-protected:
- enum class DeviceFlags {
- kNone = 0,
- kNeedClear = 1 << 0, //!< Surface requires an initial clear
- kIsOpaque = 1 << 1, //!< Hint from client that rendering to this device will be
- // opaque even if the config supports alpha.
- };
- GR_DECL_BITFIELD_CLASS_OPS_FRIENDS(DeviceFlags);
-
- static bool CheckAlphaTypeAndGetFlags(SkAlphaType, InitContents, DeviceFlags*);
- static SkImageInfo MakeInfo(SurfaceContext*, DeviceFlags);
-
- sk_sp<GrRecordingContext> fContext;
-
-private:
- using INHERITED = SkBaseDevice;
-};
-
-GR_MAKE_BITFIELD_CLASS_OPS(BaseDevice::DeviceFlags)
-
-} // namespace skgpu
-
-#endif // BaseDevice_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/ganesh/v1/ClipStack.cpp b/chromium/third_party/skia/src/gpu/ganesh/ClipStack.cpp
index 63248acb612..8b7be1e965b 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/v1/ClipStack.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/ClipStack.cpp
@@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
-#include "src/gpu/ganesh/v1/ClipStack.h"
+#include "src/gpu/ganesh/ClipStack.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkMatrix.h"
@@ -21,6 +21,8 @@
#include "src/gpu/ganesh/GrProxyProvider.h"
#include "src/gpu/ganesh/GrRecordingContextPriv.h"
#include "src/gpu/ganesh/GrSWMaskHelper.h"
+#include "src/gpu/ganesh/StencilMaskHelper.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/effects/GrBlendFragmentProcessor.h"
#include "src/gpu/ganesh/effects/GrConvexPolyEffect.h"
#include "src/gpu/ganesh/effects/GrRRectEffect.h"
@@ -28,8 +30,6 @@
#include "src/gpu/ganesh/geometry/GrQuadUtils.h"
#include "src/gpu/ganesh/ops/AtlasPathRenderer.h"
#include "src/gpu/ganesh/ops/GrDrawOp.h"
-#include "src/gpu/ganesh/v1/StencilMaskHelper.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
namespace {
@@ -1291,7 +1291,7 @@ GrClip::Effect ClipStack::apply(GrRecordingContext* rContext,
if (cs.shader()) {
static const GrColorInfo kCoverageColorInfo{GrColorType::kUnknown, kPremul_SkAlphaType,
nullptr};
- GrFPArgs args(rContext, *fMatrixProvider, &kCoverageColorInfo);
+ GrFPArgs args(rContext, *fMatrixProvider, &kCoverageColorInfo, sdc->surfaceProps());
clipFP = as_SB(cs.shader())->asFragmentProcessor(args);
if (clipFP) {
// The initial input is the coverage from the geometry processor, so this ensures it
diff --git a/chromium/third_party/skia/src/gpu/ganesh/v1/ClipStack.h b/chromium/third_party/skia/src/gpu/ganesh/ClipStack.h
index 2db990774a9..2db990774a9 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/v1/ClipStack.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/ClipStack.h
diff --git a/chromium/third_party/skia/src/gpu/ganesh/v1/Device.cpp b/chromium/third_party/skia/src/gpu/ganesh/Device.cpp
index bfd2b8a2ccb..d47e48011dc 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/v1/Device.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/Device.cpp
@@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
-#include "src/gpu/ganesh/v1/Device_v1.h"
+#include "src/gpu/ganesh/Device_v1.h"
#include "include/core/SkImageFilter.h"
#include "include/core/SkMaskFilter.h"
@@ -22,7 +22,6 @@
#include "src/core/SkCanvasPriv.h"
#include "src/core/SkClipStack.h"
#include "src/core/SkDraw.h"
-#include "src/core/SkGlyphRun.h"
#include "src/core/SkImageFilterCache.h"
#include "src/core/SkImageFilter_Base.h"
#include "src/core/SkLatticeIter.h"
@@ -38,17 +37,21 @@
#include "src/gpu/ganesh/GrBlurUtils.h"
#include "src/gpu/ganesh/GrDirectContextPriv.h"
#include "src/gpu/ganesh/GrGpu.h"
+#include "src/gpu/ganesh/GrProxyProvider.h"
#include "src/gpu/ganesh/GrRecordingContextPriv.h"
#include "src/gpu/ganesh/GrStyle.h"
#include "src/gpu/ganesh/GrSurfaceProxyPriv.h"
#include "src/gpu/ganesh/GrTracing.h"
#include "src/gpu/ganesh/SkGr.h"
+#include "src/gpu/ganesh/SurfaceContext.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/effects/GrDisableColorXP.h"
#include "src/gpu/ganesh/effects/GrRRectEffect.h"
#include "src/gpu/ganesh/geometry/GrStyledShape.h"
#include "src/image/SkImage_Base.h"
#include "src/image/SkReadPixelsRec.h"
#include "src/image/SkSurface_Gpu.h"
+#include "src/text/GlyphRun.h"
#include "src/utils/SkUTF.h"
#if defined(SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG_STRIKE_SERIALIZE)
@@ -97,6 +100,7 @@ bool init_vertices_paint(GrRecordingContext* rContext,
const SkMatrixProvider& matrixProvider,
sk_sp<SkBlender> blender,
bool hasColors,
+ const SkSurfaceProps& props,
GrPaint* grPaint) {
if (hasColors) {
return SkPaintToGrPaintWithBlend(rContext,
@@ -104,9 +108,10 @@ bool init_vertices_paint(GrRecordingContext* rContext,
skPaint,
matrixProvider,
blender.get(),
+ props,
grPaint);
} else {
- return SkPaintToGrPaint(rContext, colorInfo, skPaint, matrixProvider, grPaint);
+ return SkPaintToGrPaint(rContext, colorInfo, skPaint, matrixProvider, props, grPaint);
}
}
@@ -114,13 +119,13 @@ bool init_vertices_paint(GrRecordingContext* rContext,
namespace skgpu::v1 {
-sk_sp<BaseDevice> Device::Make(GrRecordingContext* rContext,
- GrColorType colorType,
- sk_sp<GrSurfaceProxy> proxy,
- sk_sp<SkColorSpace> colorSpace,
- GrSurfaceOrigin origin,
- const SkSurfaceProps& surfaceProps,
- InitContents init) {
+sk_sp<Device> Device::Make(GrRecordingContext* rContext,
+ GrColorType colorType,
+ sk_sp<GrSurfaceProxy> proxy,
+ sk_sp<SkColorSpace> colorSpace,
+ GrSurfaceOrigin origin,
+ const SkSurfaceProps& surfaceProps,
+ InitContents init) {
auto sdc = SurfaceDrawContext::Make(rContext,
colorType,
std::move(proxy),
@@ -131,9 +136,39 @@ sk_sp<BaseDevice> Device::Make(GrRecordingContext* rContext,
return Device::Make(std::move(sdc), kPremul_SkAlphaType, init);
}
-sk_sp<BaseDevice> Device::Make(std::unique_ptr<SurfaceDrawContext> sdc,
- SkAlphaType alphaType,
- InitContents init) {
+SkImageInfo Device::MakeInfo(SurfaceContext* sc, DeviceFlags flags) {
+ SkColorType colorType = GrColorTypeToSkColorType(sc->colorInfo().colorType());
+ return SkImageInfo::Make(sc->width(), sc->height(), colorType,
+ flags & DeviceFlags::kIsOpaque ? kOpaque_SkAlphaType
+ : kPremul_SkAlphaType,
+ sc->colorInfo().refColorSpace());
+}
+
+
+/** Checks that the alpha type is legal and gets constructor flags. Returns false if device creation
+ should fail. */
+bool Device::CheckAlphaTypeAndGetFlags(SkAlphaType alphaType,
+ InitContents init,
+ DeviceFlags* flags) {
+ *flags = DeviceFlags::kNone;
+ switch (alphaType) {
+ case kPremul_SkAlphaType:
+ break;
+ case kOpaque_SkAlphaType:
+ *flags |= DeviceFlags::kIsOpaque;
+ break;
+ default: // If it is unpremul or unknown don't try to render
+ return false;
+ }
+ if (InitContents::kClear == init) {
+ *flags |= DeviceFlags::kNeedClear;
+ }
+ return true;
+}
+
+sk_sp<Device> Device::Make(std::unique_ptr<SurfaceDrawContext> sdc,
+ SkAlphaType alphaType,
+ InitContents init) {
if (!sdc) {
return nullptr;
}
@@ -153,16 +188,16 @@ sk_sp<BaseDevice> Device::Make(std::unique_ptr<SurfaceDrawContext> sdc,
return sk_sp<Device>(new Device(std::move(sdc), flags));
}
-sk_sp<BaseDevice> Device::Make(GrRecordingContext* rContext,
- SkBudgeted budgeted,
- const SkImageInfo& ii,
- SkBackingFit fit,
- int sampleCount,
- GrMipmapped mipmapped,
- GrProtected isProtected,
- GrSurfaceOrigin origin,
- const SkSurfaceProps& props,
- InitContents init) {
+sk_sp<Device> Device::Make(GrRecordingContext* rContext,
+ SkBudgeted budgeted,
+ const SkImageInfo& ii,
+ SkBackingFit fit,
+ int sampleCount,
+ GrMipmapped mipmapped,
+ GrProtected isProtected,
+ GrSurfaceOrigin origin,
+ const SkSurfaceProps& props,
+ InitContents init) {
if (!rContext) {
return nullptr;
}
@@ -173,6 +208,7 @@ sk_sp<BaseDevice> Device::Make(GrRecordingContext* rContext,
fit,
ii.dimensions(),
props,
+ /*label=*/"MakeDevice",
sampleCount,
mipmapped,
isProtected,
@@ -183,9 +219,8 @@ sk_sp<BaseDevice> Device::Make(GrRecordingContext* rContext,
}
Device::Device(std::unique_ptr<SurfaceDrawContext> sdc, DeviceFlags flags)
- : INHERITED(sk_ref_sp(sdc->recordingContext()),
- MakeInfo(sdc.get(), flags),
- sdc->surfaceProps())
+ : SkBaseDevice(MakeInfo(sdc.get(), flags), sdc->surfaceProps())
+ , fContext(sk_ref_sp(sdc->recordingContext()))
, fSDFTControl(sdc->recordingContext()->priv().getSDFTControl(
sdc->surfaceProps().isUseDeviceIndependentFonts()))
, fSurfaceDrawContext(std::move(sdc))
@@ -197,6 +232,8 @@ Device::Device(std::unique_ptr<SurfaceDrawContext> sdc, DeviceFlags flags)
}
}
+Device::~Device() = default;
+
///////////////////////////////////////////////////////////////////////////////
bool Device::onReadPixels(const SkPixmap& pm, int x, int y) {
@@ -238,7 +275,7 @@ const SurfaceDrawContext* Device::surfaceDrawContext() const {
return fSurfaceDrawContext.get();
}
-skgpu::SurfaceFillContext* Device::surfaceFillContext() {
+SurfaceFillContext* Device::surfaceFillContext() {
ASSERT_SINGLE_OWNER
return fSurfaceDrawContext.get();
}
@@ -331,7 +368,8 @@ void Device::drawPaint(const SkPaint& paint) {
GrPaint grPaint;
if (!SkPaintToGrPaint(this->recordingContext(), fSurfaceDrawContext->colorInfo(), paint,
- this->asMatrixProvider(), &grPaint)) {
+ this->asMatrixProvider(), fSurfaceDrawContext->surfaceProps(),
+ &grPaint)) {
return;
}
@@ -359,6 +397,7 @@ void Device::drawPoints(SkCanvas::PointMode mode,
fSurfaceDrawContext->colorInfo(),
paint,
this->asMatrixProvider(),
+ fSurfaceDrawContext->surfaceProps(),
&grPaint)) {
SkPath path;
path.setIsVolatile(true);
@@ -382,6 +421,7 @@ void Device::drawPoints(SkCanvas::PointMode mode,
fSurfaceDrawContext->colorInfo(),
paint,
this->asMatrixProvider(),
+ fSurfaceDrawContext->surfaceProps(),
&grPaint)) {
fSurfaceDrawContext->drawStrokedLine(this->clip(),
std::move(grPaint),
@@ -428,7 +468,7 @@ void Device::drawPoints(SkCanvas::PointMode mode,
GrPaint grPaint;
if (!SkPaintToGrPaint(this->recordingContext(), fSurfaceDrawContext->colorInfo(), paint,
- *matrixProvider, &grPaint)) {
+ *matrixProvider, fSurfaceDrawContext->surfaceProps(), &grPaint)) {
return;
}
@@ -459,7 +499,8 @@ void Device::drawRect(const SkRect& rect, const SkPaint& paint) {
GrPaint grPaint;
if (!SkPaintToGrPaint(this->recordingContext(), fSurfaceDrawContext->colorInfo(), paint,
- this->asMatrixProvider(), &grPaint)) {
+ this->asMatrixProvider(), fSurfaceDrawContext->surfaceProps(),
+ &grPaint)) {
return;
}
@@ -530,7 +571,8 @@ void Device::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
GrPaint grPaint;
if (!SkPaintToGrPaint(this->recordingContext(), fSurfaceDrawContext->colorInfo(), paint,
- this->asMatrixProvider(), &grPaint)) {
+ this->asMatrixProvider(), fSurfaceDrawContext->surfaceProps(),
+ &grPaint)) {
return;
}
@@ -560,7 +602,8 @@ void Device::drawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPain
*fSurfaceDrawContext->caps()->shaderCaps())) {
GrPaint grPaint;
if (!SkPaintToGrPaint(this->recordingContext(), fSurfaceDrawContext->colorInfo(), paint,
- this->asMatrixProvider(), &grPaint)) {
+ this->asMatrixProvider(), fSurfaceDrawContext->surfaceProps(),
+ &grPaint)) {
return;
}
SkASSERT(!grPaint.hasCoverageFragmentProcessor());
@@ -600,7 +643,8 @@ void Device::drawRegion(const SkRegion& region, const SkPaint& paint) {
GrPaint grPaint;
if (!SkPaintToGrPaint(this->recordingContext(), fSurfaceDrawContext->colorInfo(), paint,
- this->asMatrixProvider(), &grPaint)) {
+ this->asMatrixProvider(), fSurfaceDrawContext->surfaceProps(),
+ &grPaint)) {
return;
}
@@ -621,7 +665,8 @@ void Device::drawOval(const SkRect& oval, const SkPaint& paint) {
GrPaint grPaint;
if (!SkPaintToGrPaint(this->recordingContext(), fSurfaceDrawContext->colorInfo(), paint,
- this->asMatrixProvider(), &grPaint)) {
+ this->asMatrixProvider(), fSurfaceDrawContext->surfaceProps(),
+ &grPaint)) {
return;
}
@@ -638,12 +683,13 @@ void Device::drawArc(const SkRect& oval,
ASSERT_SINGLE_OWNER
GR_CREATE_TRACE_MARKER_CONTEXT("skgpu::v1::Device", "drawArc", fContext.get());
if (paint.getMaskFilter()) {
- this->INHERITED::drawArc(oval, startAngle, sweepAngle, useCenter, paint);
+ this->SkBaseDevice::drawArc(oval, startAngle, sweepAngle, useCenter, paint);
return;
}
GrPaint grPaint;
if (!SkPaintToGrPaint(this->recordingContext(), fSurfaceDrawContext->colorInfo(), paint,
- this->asMatrixProvider(), &grPaint)) {
+ this->asMatrixProvider(), fSurfaceDrawContext->surfaceProps(),
+ &grPaint)) {
return;
}
@@ -666,7 +712,8 @@ void Device::drawPath(const SkPath& origSrcPath, const SkPaint& paint, bool path
if (!paint.getMaskFilter()) {
GrPaint grPaint;
if (!SkPaintToGrPaint(this->recordingContext(), fSurfaceDrawContext->colorInfo(), paint,
- this->asMatrixProvider(), &grPaint)) {
+ this->asMatrixProvider(), fSurfaceDrawContext->surfaceProps(),
+ &grPaint)) {
return;
}
fSurfaceDrawContext->drawPath(this->clip(), std::move(grPaint),
@@ -687,7 +734,8 @@ sk_sp<SkSpecialImage> Device::makeSpecial(const SkBitmap& bitmap) {
// TODO: this makes a tight copy of 'bitmap' but it doesn't have to be (given SkSpecialImage's
// semantics). Since this is cached we would have to bake the fit into the cache key though.
- auto view = std::get<0>(GrMakeCachedBitmapProxyView(fContext.get(), bitmap));
+ auto view = std::get<0>(
+ GrMakeCachedBitmapProxyView(fContext.get(), bitmap, /*label=*/"Device_MakeSpecial"));
if (!view) {
return nullptr;
}
@@ -755,7 +803,8 @@ sk_sp<SkSpecialImage> Device::snapSpecial(const SkIRect& subset, bool forceCopy)
GrMipmapped::kNo, // Don't auto generate mips
subset,
SkBackingFit::kApprox,
- SkBudgeted::kYes); // Always budgeted
+ SkBudgeted::kYes,
+ /*label=*/"Device_SnapSpecial"); // Always budgeted
if (!view) {
return nullptr;
}
@@ -781,7 +830,7 @@ void Device::drawDevice(SkBaseDevice* device,
ASSERT_SINGLE_OWNER
// clear of the source device must occur before CHECK_SHOULD_DRAW
GR_CREATE_TRACE_MARKER_CONTEXT("skgpu::v1::Device", "drawDevice", fContext.get());
- this->INHERITED::drawDevice(device, sampling, paint);
+ this->SkBaseDevice::drawDevice(device, sampling, paint);
}
void Device::drawImageRect(const SkImage* image,
@@ -817,6 +866,7 @@ void Device::drawViewLattice(GrSurfaceProxyView view,
*paint,
this->asMatrixProvider(),
/*shaderFP=*/nullptr,
+ fSurfaceDrawContext->surfaceProps(),
&grPaint)) {
return;
}
@@ -874,6 +924,7 @@ void Device::drawVertices(const SkVertices* vertices,
this->asMatrixProvider(),
std::move(blender),
info.hasColors(),
+ fSurfaceDrawContext->surfaceProps(),
&grPaint)) {
return;
}
@@ -897,6 +948,7 @@ void Device::drawMesh(const SkMesh& mesh, sk_sp<SkBlender> blender, const SkPain
this->asMatrixProvider(),
std::move(blender),
SkMeshSpecificationPriv::HasColors(*mesh.spec()),
+ fSurfaceDrawContext->surfaceProps(),
&grPaint)) {
return;
}
@@ -917,7 +969,7 @@ void Device::drawShadow(const SkPath& path, const SkDrawShadowRec& rec) {
if (!fSurfaceDrawContext->drawFastShadow(this->clip(), this->localToDevice(), path, rec)) {
// failed to find an accelerated case
- this->INHERITED::drawShadow(path, rec);
+ this->SkBaseDevice::drawShadow(path, rec);
}
}
@@ -939,12 +991,14 @@ void Device::drawAtlas(const SkRSXform xform[],
paint,
this->asMatrixProvider(),
blender.get(),
+ fSurfaceDrawContext->surfaceProps(),
&grPaint)) {
return;
}
} else {
if (!SkPaintToGrPaint(this->recordingContext(), fSurfaceDrawContext->colorInfo(),
- paint, this->asMatrixProvider(), &grPaint)) {
+ paint, this->asMatrixProvider(), fSurfaceDrawContext->surfaceProps(),
+ &grPaint)) {
return;
}
}
@@ -957,7 +1011,7 @@ void Device::drawAtlas(const SkRSXform xform[],
#if defined(SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG)
void Device::testingOnly_drawGlyphRunListWithSlug(SkCanvas* canvas,
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
const SkPaint& initialPaint,
const SkPaint& drawingPaint) {
auto slug = this->convertGlyphRunListToSlug(glyphRunList, initialPaint, drawingPaint);
@@ -968,10 +1022,11 @@ void Device::testingOnly_drawGlyphRunListWithSlug(SkCanvas* canvas,
#endif
#if defined(SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG_SERIALIZE)
-void Device::testingOnly_drawGlyphRunListWithSerializedSlug(SkCanvas* canvas,
- const SkGlyphRunList& glyphRunList,
- const SkPaint& initialPaint,
- const SkPaint& drawingPaint) {
+void Device::testingOnly_drawGlyphRunListWithSerializedSlug(
+ SkCanvas* canvas,
+ const sktext::GlyphRunList& glyphRunList,
+ const SkPaint& initialPaint,
+ const SkPaint& drawingPaint) {
// This is not a text blob draw. Handle using glyphRunList conversion.
if (glyphRunList.blob() == nullptr) {
auto slug = this->convertGlyphRunListToSlug(glyphRunList, initialPaint, drawingPaint);
@@ -1054,7 +1109,7 @@ private:
void Device::testingOnly_drawGlyphRunListWithSerializedSlugAndStrike(
SkCanvas* canvas,
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
const SkPaint& initialPaint,
const SkPaint& drawingPaint) {
if (glyphRunList.blob() == nullptr) {
@@ -1106,7 +1161,7 @@ void Device::testingOnly_drawGlyphRunListWithSerializedSlugAndStrike(
#endif
void Device::onDrawGlyphRunList(SkCanvas* canvas,
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
const SkPaint& initialPaint,
const SkPaint& drawingPaint) {
ASSERT_SINGLE_OWNER
@@ -1158,12 +1213,20 @@ void Device::drawDrawable(SkCanvas* canvas, SkDrawable* drawable, const SkMatrix
return;
}
}
- this->INHERITED::drawDrawable(canvas, drawable, matrix);
+ this->SkBaseDevice::drawDrawable(canvas, drawable, matrix);
}
///////////////////////////////////////////////////////////////////////////////
+GrSurfaceProxyView Device::readSurfaceView() {
+ return this->surfaceFillContext()->readSurfaceView();
+}
+
+GrRenderTargetProxy* Device::targetProxy() {
+ return this->readSurfaceView().asRenderTargetProxy();
+}
+
bool Device::wait(int numSemaphores,
const GrBackendSemaphore* waitSemaphores,
bool deleteSemaphoresAfterWait) {
@@ -1173,6 +1236,14 @@ bool Device::wait(int numSemaphores,
deleteSemaphoresAfterWait);
}
+void Device::discard() {
+ fSurfaceDrawContext->discard();
+}
+
+void Device::resolveMSAA() {
+ fSurfaceDrawContext->resolveMSAA();
+}
+
bool Device::replaceBackingProxy(SkSurface::ContentChangeMode mode,
sk_sp<GrRenderTargetProxy> newRTP,
GrColorType grColorType,
@@ -1203,6 +1274,41 @@ bool Device::replaceBackingProxy(SkSurface::ContentChangeMode mode,
return true;
}
+bool Device::replaceBackingProxy(SkSurface::ContentChangeMode mode) {
+ ASSERT_SINGLE_OWNER
+
+ const SkImageInfo& ii = this->imageInfo();
+ GrRenderTargetProxy* oldRTP = this->targetProxy();
+ GrSurfaceProxyView oldView = this->readSurfaceView();
+
+ auto grColorType = SkColorTypeToGrColorType(ii.colorType());
+ auto format = fContext->priv().caps()->getDefaultBackendFormat(grColorType, GrRenderable::kYes);
+ if (!format.isValid()) {
+ return false;
+ }
+
+ GrProxyProvider* proxyProvider = fContext->priv().proxyProvider();
+ // This entry point is used by SkSurface_Gpu::onCopyOnWrite so it must create a
+ // kExact-backed render target proxy
+ sk_sp<GrTextureProxy> proxy =
+ proxyProvider->createProxy(format,
+ ii.dimensions(),
+ GrRenderable::kYes,
+ oldRTP->numSamples(),
+ oldView.mipmapped(),
+ SkBackingFit::kExact,
+ oldRTP->isBudgeted(),
+ GrProtected::kNo,
+ /*label=*/"BaseDevice_ReplaceBackingProxy");
+ if (!proxy) {
+ return false;
+ }
+
+ return this->replaceBackingProxy(mode, sk_ref_sp(proxy->asRenderTargetProxy()),
+ grColorType, ii.refColorSpace(), oldView.origin(),
+ this->surfaceProps());
+}
+
void Device::asyncRescaleAndReadPixels(const SkImageInfo& info,
const SkIRect& srcRect,
RescaleGamma rescaleGamma,
diff --git a/chromium/third_party/skia/src/gpu/ganesh/v1/Device_drawTexture.cpp b/chromium/third_party/skia/src/gpu/ganesh/Device_drawTexture.cpp
index ebba0eb9b8b..db5e280702a 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/v1/Device_drawTexture.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/Device_drawTexture.cpp
@@ -5,8 +5,9 @@
* found in the LICENSE file.
*/
-#include "src/gpu/ganesh/v1/Device_v1.h"
+#include "src/gpu/ganesh/Device_v1.h"
+#include "include/core/SkBitmap.h"
#include "include/gpu/GrDirectContext.h"
#include "include/gpu/GrRecordingContext.h"
#include "include/private/SkTPin.h"
@@ -22,12 +23,12 @@
#include "src/gpu/ganesh/GrRecordingContextPriv.h"
#include "src/gpu/ganesh/GrStyle.h"
#include "src/gpu/ganesh/SkGr.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/effects/GrBicubicEffect.h"
#include "src/gpu/ganesh/effects/GrBlendFragmentProcessor.h"
#include "src/gpu/ganesh/effects/GrTextureEffect.h"
#include "src/gpu/ganesh/geometry/GrRect.h"
#include "src/gpu/ganesh/geometry/GrStyledShape.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
#include "src/image/SkImage_Base.h"
#include "src/image/SkImage_Gpu.h"
@@ -512,7 +513,7 @@ void draw_image(GrRecordingContext* rContext,
if (image.isAlphaOnly()) {
if (const auto* shader = as_SB(paint.getShader())) {
auto shaderFP = shader->asFragmentProcessor(
- GrFPArgs(rContext, matrixProvider, &sdc->colorInfo()));
+ GrFPArgs(rContext, matrixProvider, &sdc->colorInfo(), sdc->surfaceProps()));
if (!shaderFP) {
return;
}
@@ -525,8 +526,8 @@ void draw_image(GrRecordingContext* rContext,
}
GrPaint grPaint;
- if (!SkPaintToGrPaintReplaceShader(
- rContext, sdc->colorInfo(), paint, matrixProvider, std::move(fp), &grPaint)) {
+ if (!SkPaintToGrPaintReplaceShader(rContext, sdc->colorInfo(), paint, matrixProvider,
+ std::move(fp), sdc->surfaceProps(), &grPaint)) {
return;
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/v1/Device_v1.h b/chromium/third_party/skia/src/gpu/ganesh/Device_v1.h
index 60072ec3cc7..4ac903bf6f2 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/v1/Device_v1.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/Device_v1.h
@@ -5,19 +5,19 @@
* found in the LICENSE file.
*/
-#ifndef SkGpuDevice_DEFINED
-#define SkGpuDevice_DEFINED
+#ifndef skgpu_v1_Device_DEFINED
+#define skgpu_v1_Device_DEFINED
-#include "include/core/SkBitmap.h"
-#include "include/core/SkPicture.h"
-#include "include/core/SkRegion.h"
#include "include/core/SkSurface.h"
#include "include/gpu/GrTypes.h"
-#include "src/gpu/ganesh/BaseDevice.h"
+#include "src/core/SkDevice.h"
+#include "src/gpu/ganesh/ClipStack.h"
#include "src/gpu/ganesh/SkGr.h"
-#include "src/gpu/ganesh/v1/ClipStack.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
+#include "src/text/gpu/SDFTControl.h"
+class SkBitmap;
+class SkLatticeIter;
+class SkRegion;
class SkSpecialImage;
class SkSurface;
class SkSurface_Gpu;
@@ -25,37 +25,50 @@ class SkVertices;
namespace skgpu::v1 {
+class SurfaceContext;
+class SurfaceFillContext;
+
/**
- * Subclass of BaseDevice, which directs all drawing to the GrGpu owned by the canvas.
+ * Subclass of SkBaseDevice, which directs all drawing to the GrGpu owned by the canvas.
*/
-class Device final : public BaseDevice {
+class Device final : public SkBaseDevice {
public:
+ enum class InitContents {
+ kClear,
+ kUninit
+ };
+
+ GrSurfaceProxyView readSurfaceView();
+ GrRenderTargetProxy* targetProxy();
+
+ GrRecordingContext* recordingContext() const { return fContext.get(); }
+
bool wait(int numSemaphores,
const GrBackendSemaphore* waitSemaphores,
- bool deleteSemaphoresAfterWait) override;
+ bool deleteSemaphoresAfterWait);
- void discard() override {
- fSurfaceDrawContext->discard();
- }
-
- void resolveMSAA() override {
- fSurfaceDrawContext->resolveMSAA();
- }
+ void discard();
+ void resolveMSAA();
bool replaceBackingProxy(SkSurface::ContentChangeMode,
sk_sp<GrRenderTargetProxy>,
GrColorType,
sk_sp<SkColorSpace>,
GrSurfaceOrigin,
- const SkSurfaceProps&) override;
- using BaseDevice::replaceBackingProxy;
+ const SkSurfaceProps&);
+ bool replaceBackingProxy(SkSurface::ContentChangeMode);
+
+ using RescaleGamma = SkImage::RescaleGamma;
+ using RescaleMode = SkImage::RescaleMode;
+ using ReadPixelsCallback = SkImage::ReadPixelsCallback;
+ using ReadPixelsContext = SkImage::ReadPixelsContext;
void asyncRescaleAndReadPixels(const SkImageInfo& info,
const SkIRect& srcRect,
RescaleGamma rescaleGamma,
RescaleMode rescaleMode,
ReadPixelsCallback callback,
- ReadPixelsContext context) override;
+ ReadPixelsContext context);
void asyncRescaleAndReadPixelsYUV420(SkYUVColorSpace yuvColorSpace,
sk_sp<SkColorSpace> dstColorSpace,
@@ -64,19 +77,19 @@ public:
RescaleGamma rescaleGamma,
RescaleMode,
ReadPixelsCallback callback,
- ReadPixelsContext context) override;
+ ReadPixelsContext context);
/**
* This factory uses the color space, origin, surface properties, and initialization
* method along with the provided proxy to create the gpu device.
*/
- static sk_sp<BaseDevice> Make(GrRecordingContext*,
- GrColorType,
- sk_sp<GrSurfaceProxy>,
- sk_sp<SkColorSpace>,
- GrSurfaceOrigin,
- const SkSurfaceProps&,
- InitContents);
+ static sk_sp<Device> Make(GrRecordingContext*,
+ GrColorType,
+ sk_sp<GrSurfaceProxy>,
+ sk_sp<SkColorSpace>,
+ GrSurfaceOrigin,
+ const SkSurfaceProps&,
+ InitContents);
/**
* This factory uses the budgeted, imageInfo, fit, sampleCount, mipmapped, and isProtected
@@ -84,22 +97,22 @@ public:
* origin, surface properties, and initialization method are then used (with the created proxy)
* to create the device.
*/
- static sk_sp<BaseDevice> Make(GrRecordingContext*,
- SkBudgeted,
- const SkImageInfo&,
- SkBackingFit,
- int sampleCount,
- GrMipmapped,
- GrProtected,
- GrSurfaceOrigin,
- const SkSurfaceProps&,
- InitContents);
-
- ~Device() override {}
-
- SurfaceDrawContext* surfaceDrawContext() override;
+ static sk_sp<Device> Make(GrRecordingContext*,
+ SkBudgeted,
+ const SkImageInfo&,
+ SkBackingFit,
+ int sampleCount,
+ GrMipmapped,
+ GrProtected,
+ GrSurfaceOrigin,
+ const SkSurfaceProps&,
+ InitContents);
+
+ ~Device() override;
+
+ SurfaceDrawContext* surfaceDrawContext();
const SurfaceDrawContext* surfaceDrawContext() const;
- skgpu::SurfaceFillContext* surfaceFillContext() override;
+ SurfaceFillContext* surfaceFillContext();
SkStrikeDeviceInfo strikeDeviceInfo() const override;
@@ -150,6 +163,8 @@ public:
bool android_utils_clipWithStencil() override;
+ Device* asGaneshDevice() override { return this; }
+
protected:
bool onReadPixels(const SkPixmap&, int, int) override;
bool onWritePixels(const SkPixmap&, int, int) override;
@@ -158,12 +173,12 @@ protected:
void onRestore() override { fClip.restore(); }
void onDrawGlyphRunList(SkCanvas*,
- const SkGlyphRunList&,
+ const sktext::GlyphRunList&,
const SkPaint& initialPaint,
const SkPaint& drawingPaint) override;
sk_sp<sktext::gpu::Slug> convertGlyphRunListToSlug(
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
const SkPaint& initialPaint,
const SkPaint& drawingPaint) override;
@@ -197,15 +212,28 @@ protected:
SkIRect onDevClipBounds() const override { return fClip.getConservativeBounds(); }
private:
+ enum class DeviceFlags {
+ kNone = 0,
+ kNeedClear = 1 << 0, //!< Surface requires an initial clear
+ kIsOpaque = 1 << 1, //!< Hint from client that rendering to this device will be
+ // opaque even if the config supports alpha.
+ };
+ GR_DECL_BITFIELD_CLASS_OPS_FRIENDS(DeviceFlags);
+
+ static SkImageInfo MakeInfo(SurfaceContext*, DeviceFlags);
+ static bool CheckAlphaTypeAndGetFlags(SkAlphaType, InitContents, DeviceFlags*);
+
+ sk_sp<GrRecordingContext> fContext;
+
const sktext::gpu::SDFTControl fSDFTControl;
std::unique_ptr<SurfaceDrawContext> fSurfaceDrawContext;
ClipStack fClip;
- static sk_sp<BaseDevice> Make(std::unique_ptr<SurfaceDrawContext>,
- SkAlphaType,
- InitContents);
+ static sk_sp<Device> Make(std::unique_ptr<SurfaceDrawContext>,
+ SkAlphaType,
+ InitContents);
Device(std::unique_ptr<SurfaceDrawContext>, DeviceFlags);
@@ -220,23 +248,24 @@ private:
const GrClip* clip() const { return &fClip; }
#if defined(SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG)
void testingOnly_drawGlyphRunListWithSlug(SkCanvas* canvas,
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
const SkPaint& initialPaint,
const SkPaint& drawingPaint);
#endif
#if defined(SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG_SERIALIZE)
void testingOnly_drawGlyphRunListWithSerializedSlug(SkCanvas* canvas,
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
const SkPaint& initialPaint,
const SkPaint& drawingPaint);
#endif
#if defined(SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG_STRIKE_SERIALIZE)
- void testingOnly_drawGlyphRunListWithSerializedSlugAndStrike(SkCanvas* canvas,
- const SkGlyphRunList& glyphRunList,
- const SkPaint& initialPaint,
- const SkPaint& drawingPaint);
+ void testingOnly_drawGlyphRunListWithSerializedSlugAndStrike(
+ SkCanvas* canvas,
+ const sktext::GlyphRunList& glyphRunList,
+ const SkPaint& initialPaint,
+ const SkPaint& drawingPaint);
#endif
// If not null, dstClip must be contained inside dst and will also respect the edge AA flags.
@@ -256,11 +285,10 @@ private:
const SkPaint&);
friend class ::SkSurface_Gpu; // for access to surfaceProps
- using INHERITED = BaseDevice;
};
-} // namespace skgpu::v1
+GR_MAKE_BITFIELD_CLASS_OPS(Device::DeviceFlags)
-#undef GR_CLIP_STACK
+} // namespace skgpu::v1
-#endif
+#endif // skgpu_v1_Device_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrAHardwareBufferImageGenerator.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrAHardwareBufferImageGenerator.cpp
index dc7ddb5818b..99ec255ffae 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrAHardwareBufferImageGenerator.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrAHardwareBufferImageGenerator.cpp
@@ -207,8 +207,13 @@ GrSurfaceProxyView GrAHardwareBufferImageGenerator::onGenerateTexture(
? SkBudgeted::kNo
: SkBudgeted::kYes;
- return GrSurfaceProxyView::Copy(context, std::move(texProxyView), mipmapped, subset,
- SkBackingFit::kExact, budgeted);
+ return GrSurfaceProxyView::Copy(context,
+ std::move(texProxyView),
+ mipmapped,
+ subset,
+ SkBackingFit::kExact,
+ budgeted,
+ /*label=*/"AHardwareBufferImageGenerator_GenerateTexture");
}
bool GrAHardwareBufferImageGenerator::onIsValid(GrRecordingContext* context) const {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrAHardwareBufferUtils.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrAHardwareBufferUtils.cpp
index 23a4bedbbcc..68758988c47 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrAHardwareBufferUtils.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrAHardwareBufferUtils.cpp
@@ -14,16 +14,21 @@
#include "src/gpu/ganesh/GrAHardwareBufferUtils_impl.h"
#include <android/hardware_buffer.h>
+#ifdef SK_GL
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
+#endif
#include "include/gpu/GrDirectContext.h"
-#include "include/gpu/gl/GrGLTypes.h"
#include "src/gpu/ganesh/GrDirectContextPriv.h"
+
+#ifdef SK_GL
+#include "include/gpu/gl/GrGLTypes.h"
#include "src/gpu/ganesh/gl/GrGLDefines_impl.h"
#include "src/gpu/ganesh/gl/GrGLUtil.h"
+#endif
#ifdef SK_VULKAN
#include "src/gpu/ganesh/vk/GrVkCaps.h"
@@ -69,6 +74,7 @@ GrBackendFormat GetBackendFormat(GrDirectContext* dContext, AHardwareBuffer* har
GrBackendApi backend = dContext->backend();
if (backend == GrBackendApi::kOpenGL) {
+#ifdef SK_GL
switch (bufferFormat) {
//TODO: find out if we can detect, which graphic buffers support GR_GL_TEXTURE_2D
case AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM:
@@ -93,6 +99,9 @@ GrBackendFormat GetBackendFormat(GrDirectContext* dContext, AHardwareBuffer* har
return GrBackendFormat::MakeGL(GR_GL_RGBA8, GR_GL_TEXTURE_EXTERNAL);
}
}
+#else // SK_GL
+ return GrBackendFormat();
+#endif // SK_GL
} else if (backend == GrBackendApi::kVulkan) {
#ifdef SK_VULKAN
switch (bufferFormat) {
@@ -162,13 +171,14 @@ GrBackendFormat GetBackendFormat(GrDirectContext* dContext, AHardwareBuffer* har
}
}
}
-#else
+#else // SK_VULKAN
return GrBackendFormat();
-#endif
+#endif // SK_VULKAN
}
return GrBackendFormat();
}
+#ifdef SK_GL
class GLTextureHelper {
public:
GLTextureHelper(GrGLuint texID, EGLImageKHR image, EGLDisplay display, GrGLuint texTarget)
@@ -279,6 +289,7 @@ static GrBackendTexture make_gl_backend_texture(
return GrBackendTexture(width, height, GrMipmapped::kNo, textureInfo);
}
+#endif // SK_GL
#ifdef SK_VULKAN
class VulkanCleanupHelper {
@@ -518,8 +529,9 @@ static GrBackendTexture make_vk_backend_texture(
return GrBackendTexture(width, height, imageInfo);
}
-#endif
+#endif // SK_VULKAN
+#ifdef SK_GL
static bool can_import_protected_content_eglimpl() {
EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
const char* exts = eglQueryString(dpy, EGL_EXTENSIONS);
@@ -533,17 +545,20 @@ static bool can_import_protected_content_eglimpl() {
bool inMiddle = strstr(exts, " " PROT_CONTENT_EXT_STR " ");
return equal || atStart || atEnd || inMiddle;
}
+#endif // SK_GL
static bool can_import_protected_content(GrDirectContext* dContext) {
if (GrBackendApi::kOpenGL == dContext->backend()) {
+#ifdef SK_GL
// Only compute whether the extension is present once the first time this
// function is called.
static bool hasIt = can_import_protected_content_eglimpl();
return hasIt;
+#endif // SK_GL
} else if (GrBackendApi::kVulkan == dContext->backend()) {
#ifdef SK_VULKAN
return static_cast<GrVkGpu*>(dContext->priv().getGpu())->protectedContext();
-#endif
+#endif // SK_VULKAN
}
return false;
}
@@ -564,9 +579,13 @@ GrBackendTexture MakeBackendTexture(GrDirectContext* dContext, AHardwareBuffer*
bool createProtectedImage = isProtectedContent && can_import_protected_content(dContext);
if (GrBackendApi::kOpenGL == dContext->backend()) {
+#ifdef SK_GL
return make_gl_backend_texture(dContext, hardwareBuffer, width, height, deleteProc,
updateProc, imageCtx, createProtectedImage, backendFormat,
isRenderable);
+#else
+ return GrBackendTexture();
+#endif // SK_GL
} else {
SkASSERT(GrBackendApi::kVulkan == dContext->backend());
#ifdef SK_VULKAN
@@ -575,7 +594,7 @@ GrBackendTexture MakeBackendTexture(GrDirectContext* dContext, AHardwareBuffer*
isRenderable, fromAndroidWindow);
#else
return GrBackendTexture();
-#endif
+#endif // SK_VULKAN
}
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrAttachment.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrAttachment.cpp
index 94ac6c25b3b..1b8ed9e7d97 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrAttachment.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrAttachment.cpp
@@ -93,7 +93,16 @@ void GrAttachment::ComputeScratchKey(const GrCaps& caps,
}
void GrAttachment::computeScratchKey(skgpu::ScratchKey* key) const {
- if (!SkToBool(fSupportedUsages & UsageFlags::kStencilAttachment)) {
+ // We do don't cache GrAttachments as scratch resources when used for stencils or textures. For
+ // stencils we share/cache them with unique keys so that they can be shared. Textures are in a
+ // weird place on the Vulkan backend. Currently, GrVkTexture contains a GrAttachment (GrVkImage)
+ // that actually holds the VkImage. The GrVkTexture is cached as a scratch resource and is
+ // responsible for tracking the gpuMemorySize. Thus we set the size of the texture GrVkImage,
+ // above in onGpuMemorySize, to be zero. Therefore, we can't have the GrVkImage getting cached
+ // separately on its own in the GrResourceCache or we may grow forever adding them thinking they
+ // contatin a memory that's size 0 and never freeing the actual VkImages.
+ if (!SkToBool(fSupportedUsages & UsageFlags::kStencilAttachment) &&
+ !SkToBool(fSupportedUsages & UsageFlags::kTexture)) {
auto isProtected = this->isProtected() ? GrProtected::kYes : GrProtected::kNo;
ComputeScratchKey(*this->getGpu()->caps(),
this->backendFormat(),
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrAuditTrail.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrAuditTrail.cpp
index 972e301d140..0d1febc37a0 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrAuditTrail.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrAuditTrail.cpp
@@ -178,7 +178,7 @@ static void skrect_to_json(SkJSONWriter& writer, const char* name, const SkRect&
void GrAuditTrail::Op::toJson(SkJSONWriter& writer) const {
writer.beginObject();
- writer.appendString("Name", fName.c_str());
+ writer.appendString("Name", fName);
writer.appendS32("ClientID", fClientID);
writer.appendS32("OpsTaskID", fOpsTaskID);
writer.appendS32("ChildID", fChildID);
@@ -186,7 +186,7 @@ void GrAuditTrail::Op::toJson(SkJSONWriter& writer) const {
if (fStackTrace.count()) {
writer.beginArray("Stack");
for (int i = 0; i < fStackTrace.count(); i++) {
- writer.appendString(fStackTrace[i].c_str());
+ writer.appendString(fStackTrace[i]);
}
writer.endArray();
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrBackendSurface.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrBackendSurface.cpp
index 92198fe3769..d3d4ec09f3d 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrBackendSurface.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrBackendSurface.cpp
@@ -462,10 +462,12 @@ GrBackendTexture::GrBackendTexture() : fIsValid(false) {}
#ifdef SK_DAWN
GrBackendTexture::GrBackendTexture(int width,
int height,
- const GrDawnTextureInfo& dawnInfo)
+ const GrDawnTextureInfo& dawnInfo,
+ std::string_view label)
: fIsValid(true)
, fWidth(width)
, fHeight(height)
+ , fLabel(label)
, fMipmapped(GrMipmapped(dawnInfo.fLevelCount > 1))
, fBackend(GrBackendApi::kDawn)
, fTextureType(GrTextureType::k2D)
@@ -473,11 +475,17 @@ GrBackendTexture::GrBackendTexture(int width,
#endif
#ifdef SK_VULKAN
-GrBackendTexture::GrBackendTexture(int width, int height, const GrVkImageInfo& vkInfo)
- : GrBackendTexture(width, height, vkInfo,
- sk_sp<GrBackendSurfaceMutableStateImpl>(
- new GrBackendSurfaceMutableStateImpl(
- vkInfo.fImageLayout, vkInfo.fCurrentQueueFamily))) {}
+GrBackendTexture::GrBackendTexture(int width,
+ int height,
+ const GrVkImageInfo& vkInfo,
+ std::string_view label)
+ : GrBackendTexture(
+ width,
+ height,
+ vkInfo,
+ sk_sp<GrBackendSurfaceMutableStateImpl>(new GrBackendSurfaceMutableStateImpl(
+ vkInfo.fImageLayout, vkInfo.fCurrentQueueFamily)),
+ label) {}
static const VkImageUsageFlags kDefaultUsageFlags =
VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
@@ -508,10 +516,12 @@ static GrTextureType vk_image_info_to_texture_type(const GrVkImageInfo& info) {
GrBackendTexture::GrBackendTexture(int width,
int height,
const GrVkImageInfo& vkInfo,
- sk_sp<GrBackendSurfaceMutableStateImpl> mutableState)
+ sk_sp<GrBackendSurfaceMutableStateImpl> mutableState,
+ std::string_view label)
: fIsValid(true)
, fWidth(width)
, fHeight(height)
+ , fLabel(label)
, fMipmapped(GrMipmapped(vkInfo.fLevelCount > 1))
, fBackend(GrBackendApi::kVulkan)
, fTextureType(vk_image_info_to_texture_type(vkInfo))
@@ -524,10 +534,12 @@ GrBackendTexture::GrBackendTexture(int width,
int height,
GrMipmapped mipmapped,
const GrGLTextureInfo glInfo,
- sk_sp<GrGLTextureParameters> params)
+ sk_sp<GrGLTextureParameters> params,
+ std::string_view label)
: fIsValid(true)
, fWidth(width)
, fHeight(height)
+ , fLabel(label)
, fMipmapped(mipmapped)
, fBackend(GrBackendApi::kOpenGL)
, fTextureType(gl_target_to_gr_target(glInfo.fTarget))
@@ -545,10 +557,12 @@ sk_sp<GrGLTextureParameters> GrBackendTexture::getGLTextureParams() const {
GrBackendTexture::GrBackendTexture(int width,
int height,
GrMipmapped mipmapped,
- const GrMtlTextureInfo& mtlInfo)
+ const GrMtlTextureInfo& mtlInfo,
+ std::string_view label)
: fIsValid(true)
, fWidth(width)
, fHeight(height)
+ , fLabel(label)
, fMipmapped(mipmapped)
, fBackend(GrBackendApi::kMetal)
, fTextureType(GrTextureType::k2D)
@@ -556,19 +570,26 @@ GrBackendTexture::GrBackendTexture(int width,
#endif
#ifdef SK_DIRECT3D
-GrBackendTexture::GrBackendTexture(int width, int height, const GrD3DTextureResourceInfo& d3dInfo)
- : GrBackendTexture(
- width, height, d3dInfo,
- sk_sp<GrD3DResourceState>(new GrD3DResourceState(
- static_cast<D3D12_RESOURCE_STATES>(d3dInfo.fResourceState)))) {}
+GrBackendTexture::GrBackendTexture(int width,
+ int height,
+ const GrD3DTextureResourceInfo& d3dInfo,
+ std::string_view label)
+ : GrBackendTexture(width,
+ height,
+ d3dInfo,
+ sk_sp<GrD3DResourceState>(new GrD3DResourceState(
+ static_cast<D3D12_RESOURCE_STATES>(d3dInfo.fResourceState))),
+ label) {}
GrBackendTexture::GrBackendTexture(int width,
int height,
const GrD3DTextureResourceInfo& d3dInfo,
- sk_sp<GrD3DResourceState> state)
+ sk_sp<GrD3DResourceState> state,
+ std::string_view label)
: fIsValid(true)
, fWidth(width)
, fHeight(height)
+ , fLabel(label)
, fMipmapped(GrMipmapped(d3dInfo.fLevelCount > 1))
, fBackend(GrBackendApi::kDirect3D)
, fTextureType(GrTextureType::k2D)
@@ -579,8 +600,10 @@ GrBackendTexture::GrBackendTexture(int width,
GrBackendTexture::GrBackendTexture(int width,
int height,
GrMipmapped mipmapped,
- const GrGLTextureInfo& glInfo)
- : GrBackendTexture(width, height, mipmapped, glInfo, sk_make_sp<GrGLTextureParameters>()) {
+ const GrGLTextureInfo& glInfo,
+ std::string_view label)
+ : GrBackendTexture(
+ width, height, mipmapped, glInfo, sk_make_sp<GrGLTextureParameters>(), label) {
// Make no assumptions about client's texture's parameters.
this->glTextureParametersModified();
}
@@ -589,10 +612,12 @@ GrBackendTexture::GrBackendTexture(int width,
GrBackendTexture::GrBackendTexture(int width,
int height,
GrMipmapped mipmapped,
- const GrMockTextureInfo& mockInfo)
+ const GrMockTextureInfo& mockInfo,
+ std::string_view label)
: fIsValid(true)
, fWidth(width)
, fHeight(height)
+ , fLabel(label)
, fMipmapped(mipmapped)
, fBackend(GrBackendApi::kMock)
, fTextureType(GrTextureType::k2D)
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrBackendTextureImageGenerator.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrBackendTextureImageGenerator.cpp
index e2c52982cde..7f368113f66 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrBackendTextureImageGenerator.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrBackendTextureImageGenerator.cpp
@@ -230,7 +230,8 @@ GrSurfaceProxyView GrBackendTextureImageGenerator::onGenerateTexture(
mipmapped,
subset,
SkBackingFit::kExact,
- budgeted);
+ budgeted,
+ /*label=*/"BackendTextureImageGenerator_GenerateTexture");
return {std::move(copy), fSurfaceOrigin, readSwizzle};
}
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrBlurUtils.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrBlurUtils.cpp
index 0ed44b0c7db..b46845f0d98 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrBlurUtils.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrBlurUtils.cpp
@@ -29,9 +29,9 @@
#include "src/gpu/ganesh/GrThreadSafeCache.h"
#include "src/gpu/ganesh/GrUtil.h"
#include "src/gpu/ganesh/SkGr.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/effects/GrTextureEffect.h"
#include "src/gpu/ganesh/geometry/GrStyledShape.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
static bool clip_bounds_quick_reject(const SkIRect& clipBounds, const SkIRect& rect) {
return clipBounds.isEmpty() || rect.isEmpty() || !SkIRect::Intersects(clipBounds, rect);
@@ -578,7 +578,8 @@ void GrBlurUtils::drawShapeWithMaskFilter(GrRecordingContext* rContext,
}
GrPaint grPaint;
- if (!SkPaintToGrPaint(rContext, sdc->colorInfo(), paint, matrixProvider, &grPaint)) {
+ if (!SkPaintToGrPaint(rContext, sdc->colorInfo(), paint, matrixProvider, sdc->surfaceProps(),
+ &grPaint)) {
return;
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrBufferAllocPool.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrBufferAllocPool.cpp
index ca02ea04721..d41ea2bf0b4 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrBufferAllocPool.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrBufferAllocPool.cpp
@@ -219,10 +219,10 @@ void* GrBufferAllocPool::makeSpace(size_t size,
// We could honor the space request using by a partial update of the current
// VB (if there is room). But we don't currently use draw calls to GL that
// allow the driver to know that previously issued draws won't read from
- // the part of the buffer we update. Also, the GL buffer implementation
- // may be cheating on the actual buffer size by shrinking the buffer on
- // updateData() if the amount of data passed is less than the full buffer
- // size.
+ // the part of the buffer we update. Also, when this was written the GL
+ // buffer implementation was cheating on the actual buffer size by shrinking
+ // the buffer in updateData() if the amount of data passed was less than
+ // the full buffer size. This is old code and both concerns may be obsolete.
if (!this->createBlock(size)) {
return nullptr;
@@ -402,7 +402,7 @@ void GrBufferAllocPool::flushCpuData(const BufferBlock& block, size_t flushSize)
return;
}
}
- buffer->updateData(fBufferPtr, flushSize);
+ buffer->updateData(fBufferPtr, /*offset=*/0, flushSize, /*preserve=*/false);
VALIDATE(true);
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrBufferTransferRenderTask.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrBufferTransferRenderTask.cpp
new file mode 100644
index 00000000000..8ee9f5349aa
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrBufferTransferRenderTask.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "src/gpu/ganesh/GrBufferTransferRenderTask.h"
+
+#include "src/gpu/ganesh/GrGpu.h"
+#include "src/gpu/ganesh/GrOpFlushState.h"
+#include "src/gpu/ganesh/GrResourceAllocator.h"
+
+sk_sp<GrRenderTask> GrBufferTransferRenderTask::Make(sk_sp<GrGpuBuffer> src,
+ size_t srcOffset,
+ sk_sp<GrGpuBuffer> dst,
+ size_t dstOffset,
+ size_t size) {
+ return sk_sp<GrRenderTask>(new GrBufferTransferRenderTask(std::move(src),
+ srcOffset,
+ std::move(dst),
+ dstOffset,
+ size));
+}
+
+GrBufferTransferRenderTask::GrBufferTransferRenderTask(sk_sp<GrGpuBuffer> src,
+ size_t srcOffset,
+ sk_sp<GrGpuBuffer> dst,
+ size_t dstOffset,
+ size_t size)
+ : fSrc(std::move(src))
+ , fDst(std::move(dst))
+ , fSrcOffset(srcOffset)
+ , fDstOffset(dstOffset)
+ , fSize(size) {
+ this->setFlag(kBlocksReordering_Flag);
+}
+
+GrBufferTransferRenderTask::~GrBufferTransferRenderTask() = default;
+
+bool GrBufferTransferRenderTask::onExecute(GrOpFlushState* flushState) {
+ return flushState->gpu()->transferFromBufferToBuffer(fSrc,
+ fSrcOffset,
+ fDst,
+ fDstOffset,
+ fSize);
+}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrBufferTransferRenderTask.h b/chromium/third_party/skia/src/gpu/ganesh/GrBufferTransferRenderTask.h
new file mode 100644
index 00000000000..bab294ee229
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrBufferTransferRenderTask.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrBufferTransferRenderTask_DEFINED
+#define GrBufferTransferRenderTask_DEFINED
+
+#include "src/gpu/ganesh/GrRenderTask.h"
+
+class GrGpuBuffer;
+
+class GrBufferTransferRenderTask final : public GrRenderTask {
+public:
+ static sk_sp<GrRenderTask> Make(sk_sp<GrGpuBuffer> src,
+ size_t srcOffset,
+ sk_sp<GrGpuBuffer> dst,
+ size_t dstOffset,
+ size_t size);
+
+ ~GrBufferTransferRenderTask() override;
+
+private:
+ GrBufferTransferRenderTask(sk_sp<GrGpuBuffer> src,
+ size_t srcOffset,
+ sk_sp<GrGpuBuffer> dst,
+ size_t dstOffset,
+ size_t size);
+
+ bool onIsUsed(GrSurfaceProxy* proxy) const override { return false; }
+ void gatherProxyIntervals(GrResourceAllocator*) const override {} // no proxies
+ ExpectedOutcome onMakeClosed(GrRecordingContext*, SkIRect* targetUpdateBounds) override {
+ return ExpectedOutcome::kTargetUnchanged; // no target
+ }
+ bool onExecute(GrOpFlushState*) override;
+
+#if GR_TEST_UTILS
+ const char* name() const final { return "BufferTransfer"; }
+#endif
+#ifdef SK_DEBUG
+ void visitProxies_debugOnly(const GrVisitProxyFunc&) const override {}
+#endif
+
+ sk_sp<GrGpuBuffer> fSrc;
+ sk_sp<GrGpuBuffer> fDst;
+
+ size_t fSrcOffset;
+ size_t fDstOffset;
+ size_t fSize;
+};
+
+#endif
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrCaps.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrCaps.cpp
index 14c3e73c416..6ba6994332b 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrCaps.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrCaps.cpp
@@ -51,6 +51,7 @@ GrCaps::GrCaps(const GrContextOptions& options) {
fPerformStencilClearsAsDraws = false;
fTransferFromBufferToTextureSupport = false;
fTransferFromSurfaceToBufferSupport = false;
+ fTransferFromBufferToBufferSupport = false;
fWritePixelsRowBytesSupport = false;
fTransferPixelsToRowBytesSupport = false;
fReadPixelsRowBytesSupport = false;
@@ -264,11 +265,11 @@ void GrCaps::dumpJSON(SkJSONWriter* writer) const {
static_assert(0 == kBasic_BlendEquationSupport);
static_assert(1 == kAdvanced_BlendEquationSupport);
static_assert(2 == kAdvancedCoherent_BlendEquationSupport);
- static_assert(SK_ARRAY_COUNT(kBlendEquationSupportNames) == kLast_BlendEquationSupport + 1);
+ static_assert(std::size(kBlendEquationSupportNames) == kLast_BlendEquationSupport + 1);
- writer->appendString("Blend Equation Support",
- kBlendEquationSupportNames[fBlendEquationSupport]);
- writer->appendString("Map Buffer Support", map_flags_to_string(fMapBufferFlags).c_str());
+ writer->appendCString("Blend Equation Support",
+ kBlendEquationSupportNames[fBlendEquationSupport]);
+ writer->appendString("Map Buffer Support", map_flags_to_string(fMapBufferFlags));
this->onDumpJSON(writer);
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrCaps.h b/chromium/third_party/skia/src/gpu/ganesh/GrCaps.h
index 732aae0f4d2..eacb5591886 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrCaps.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrCaps.h
@@ -217,7 +217,19 @@ public:
uint32_t maxPushConstantsSize() const { return fMaxPushConstantsSize; }
- size_t transferBufferAlignment() const { return fTransferBufferAlignment; }
+ // Alignment requirement for row bytes in buffer<->texture transfers.
+ size_t transferBufferRowBytesAlignment() const { return fTransferBufferRowBytesAlignment; }
+
+ // Alignment requirement for offsets and size in buffer->buffer transfers.
+ size_t transferFromBufferToBufferAlignment() const {
+ return fTransferFromBufferToBufferAlignment;
+ }
+
+ // Alignment requirement for offset and size passed to in GrGpuBuffer::updateData when the
+ // preserve param is true.
+ size_t bufferUpdateDataPreserveAlignment() const {
+ return fBufferUpdateDataPreserveAlignment;
+ }
virtual bool isFormatSRGB(const GrBackendFormat&) const = 0;
@@ -334,12 +346,13 @@ public:
bool transferFromSurfaceToBufferSupport() const { return fTransferFromSurfaceToBufferSupport; }
bool transferFromBufferToTextureSupport() const { return fTransferFromBufferToTextureSupport; }
+ bool transferFromBufferToBufferSupport() const { return fTransferFromBufferToBufferSupport; }
bool suppressPrints() const { return fSuppressPrints; }
size_t bufferMapThreshold() const {
SkASSERT(fBufferMapThreshold >= 0);
- return fBufferMapThreshold;
+ return static_cast<size_t>(fBufferMapThreshold);
}
/** True in environments that will issue errors if memory uploaded to buffers
@@ -558,6 +571,7 @@ protected:
bool fPerformStencilClearsAsDraws : 1;
bool fTransferFromBufferToTextureSupport : 1;
bool fTransferFromSurfaceToBufferSupport : 1;
+ bool fTransferFromBufferToBufferSupport : 1;
bool fWritePixelsRowBytesSupport : 1;
bool fTransferPixelsToRowBytesSupport : 1;
bool fReadPixelsRowBytesSupport : 1;
@@ -598,7 +612,9 @@ protected:
int fMaxWindowRectangles;
int fInternalMultisampleCount;
uint32_t fMaxPushConstantsSize = 0;
- size_t fTransferBufferAlignment = 1;
+ size_t fTransferBufferRowBytesAlignment = 1;
+ size_t fTransferFromBufferToBufferAlignment = 1;
+ size_t fBufferUpdateDataPreserveAlignment = 1;
GrDriverBugWorkarounds fDriverBugWorkarounds;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrColorSpaceXform.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrColorSpaceXform.cpp
index c5de82f007c..a8226128525 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrColorSpaceXform.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrColorSpaceXform.cpp
@@ -8,7 +8,7 @@
#include "src/gpu/ganesh/GrColorSpaceXform.h"
#include "include/core/SkString.h"
-#include "include/third_party/skcms/skcms.h"
+#include "modules/skcms/skcms.h"
#include "src/core/SkColorSpacePriv.h"
#include "src/gpu/KeyBuilder.h"
#include "src/gpu/ganesh/GrColorInfo.h"
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrDataUtils.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrDataUtils.cpp
index c0f2d0d982f..d03fb818b54 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrDataUtils.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrDataUtils.cpp
@@ -9,7 +9,7 @@
#include "include/core/SkColorSpace.h"
#include "include/private/SkTPin.h"
-#include "include/third_party/skcms/skcms.h"
+#include "modules/skcms/skcms.h"
#include "src/core/SkColorSpaceXformSteps.h"
#include "src/core/SkCompressedDataUtils.h"
#include "src/core/SkConvertPixels.h"
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrDirectContext.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrDirectContext.cpp
index 0ff55edd47e..6472381ec8e 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrDirectContext.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrDirectContext.cpp
@@ -144,9 +144,6 @@ void GrDirectContext::abandonContext() {
fGpu->disconnect(GrGpu::DisconnectType::kAbandon);
- // Must be after GrResourceCache::abandonAll().
- fMappedBufferManager.reset();
-
if (fSmallPathAtlasMgr) {
fSmallPathAtlasMgr->reset();
}
@@ -546,7 +543,7 @@ static bool update_texture_with_pixmaps(GrDirectContext* context,
skgpu::Swizzle swizzle = context->priv().caps()->getReadSwizzle(format, ct);
GrSurfaceProxyView view(std::move(proxy), textureOrigin, swizzle);
- skgpu::SurfaceContext surfaceContext(context, std::move(view), src[0].info().colorInfo());
+ skgpu::v1::SurfaceContext surfaceContext(context, std::move(view), src[0].info().colorInfo());
SkAutoSTArray<15, GrCPixmap> tmpSrc(numLevels);
for (int i = 0; i < numLevels; ++i) {
tmpSrc[i] = src[i];
@@ -968,7 +965,7 @@ SkString GrDirectContext::dump() const {
SkJSONWriter writer(&stream, SkJSONWriter::Mode::kPretty);
writer.beginObject();
- writer.appendString("backend", GrBackendApiToStr(this->backend()));
+ writer.appendCString("backend", GrBackendApiToStr(this->backend()));
writer.appendName("caps");
this->caps()->dumpJSON(&writer);
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrDirectContextPriv.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrDirectContextPriv.cpp
index 25c5a2d4cbe..153f7c85949 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrDirectContextPriv.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrDirectContextPriv.cpp
@@ -196,7 +196,8 @@ static std::unique_ptr<GrFragmentProcessor> make_premul_effect(
return nullptr;
}
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForColorFilter, R"(
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForColorFilter,
+ R"(
half4 main(half4 halfColor) {
float4 color = float4(halfColor);
color = floor(color * 255 + 0.5) / 255;
@@ -215,7 +216,8 @@ static std::unique_ptr<GrFragmentProcessor> make_unpremul_effect(
return nullptr;
}
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForColorFilter, R"(
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForColorFilter,
+ R"(
half4 main(half4 halfColor) {
float4 color = float4(halfColor);
color = floor(color * 255 + 0.5) / 255;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrDirectContextPriv.h b/chromium/third_party/skia/src/gpu/ganesh/GrDirectContextPriv.h
index 570997d5ef4..dfad01b0de1 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrDirectContextPriv.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrDirectContextPriv.h
@@ -12,7 +12,7 @@
#include "include/core/SkSurface.h"
#include "include/gpu/GrDirectContext.h"
#include "src/gpu/AtlasTypes.h"
-#include "src/gpu/ganesh/BaseDevice.h"
+#include "src/gpu/ganesh/Device_v1.h"
#include "src/gpu/ganesh/GrRecordingContextPriv.h"
class GrAtlasManager;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrDrawOpAtlas.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrDrawOpAtlas.cpp
index 35ca589b172..15e16fec306 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrDrawOpAtlas.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrDrawOpAtlas.cpp
@@ -30,8 +30,10 @@ using Plot = skgpu::Plot;
using PlotList = skgpu::PlotList;
using PlotLocator = skgpu::PlotLocator;
-#ifdef DUMP_ATLAS_DATA
-static bool gDumpAtlasData = false;
+#if defined(DUMP_ATLAS_DATA)
+static const constexpr bool kDumpAtlasData = true;
+#else
+static const constexpr bool kDumpAtlasData = false;
#endif
#ifdef SK_DEBUG
@@ -349,11 +351,10 @@ void GrDrawOpAtlas::compact(DrawToken startTokenForNextFlush) {
// For all plots but the last one, update number of flushes since used, and check to see
// if there are any in the first pages that the last page can safely upload to.
for (uint32_t pageIndex = 0; pageIndex < lastPageIndex; ++pageIndex) {
-#ifdef DUMP_ATLAS_DATA
- if (gDumpAtlasData) {
+ if constexpr (kDumpAtlasData) {
SkDebugf("page %d: ", pageIndex);
}
-#endif
+
plotIter.init(fPages[pageIndex].fPlotList, PlotList::Iter::kHead_IterStart);
while (Plot* plot = plotIter.get()) {
// Update number of flushes since plot was last used
@@ -364,11 +365,10 @@ void GrDrawOpAtlas::compact(DrawToken startTokenForNextFlush) {
plot->incFlushesSinceLastUsed();
}
-#ifdef DUMP_ATLAS_DATA
- if (gDumpAtlasData) {
+ if constexpr (kDumpAtlasData) {
SkDebugf("%d ", plot->flushesSinceLastUsed());
}
-#endif
+
// Count plots we can potentially upload to in all pages except the last one
// (the potential compactee).
if (plot->flushesSinceLastUsed() > kPlotRecentlyUsedCount) {
@@ -377,11 +377,10 @@ void GrDrawOpAtlas::compact(DrawToken startTokenForNextFlush) {
plotIter.next();
}
-#ifdef DUMP_ATLAS_DATA
- if (gDumpAtlasData) {
+
+ if constexpr (kDumpAtlasData) {
SkDebugf("\n");
}
-#endif
}
// Count recently used plots in the last page and evict any that are no longer in use.
@@ -389,22 +388,20 @@ void GrDrawOpAtlas::compact(DrawToken startTokenForNextFlush) {
// clear out usage of this page unless we have a large need.
plotIter.init(fPages[lastPageIndex].fPlotList, PlotList::Iter::kHead_IterStart);
unsigned int usedPlots = 0;
-#ifdef DUMP_ATLAS_DATA
- if (gDumpAtlasData) {
+ if constexpr (kDumpAtlasData) {
SkDebugf("page %d: ", lastPageIndex);
}
-#endif
+
while (Plot* plot = plotIter.get()) {
// Update number of flushes since plot was last used
if (!plot->lastUseToken().inInterval(fPrevFlushToken, startTokenForNextFlush)) {
plot->incFlushesSinceLastUsed();
}
-#ifdef DUMP_ATLAS_DATA
- if (gDumpAtlasData) {
+ if constexpr (kDumpAtlasData) {
SkDebugf("%d ", plot->flushesSinceLastUsed());
}
-#endif
+
// If this plot was used recently
if (plot->flushesSinceLastUsed() <= kPlotRecentlyUsedCount) {
usedPlots++;
@@ -414,11 +411,10 @@ void GrDrawOpAtlas::compact(DrawToken startTokenForNextFlush) {
}
plotIter.next();
}
-#ifdef DUMP_ATLAS_DATA
- if (gDumpAtlasData) {
+
+ if constexpr (kDumpAtlasData) {
SkDebugf("\n");
}
-#endif
// If recently used plots in the last page are using less than a quarter of the page, try
// to evict them if there's available space in earlier pages. Since we prioritize uploading
@@ -448,11 +444,10 @@ void GrDrawOpAtlas::compact(DrawToken startTokenForNextFlush) {
// If none of the plots in the last page have been used recently, delete it.
if (!usedPlots) {
-#ifdef DUMP_ATLAS_DATA
- if (gDumpAtlasData) {
+ if constexpr (kDumpAtlasData) {
SkDebugf("delete %d\n", fNumActivePages-1);
}
-#endif
+
this->deactivateLastPage();
fFlushesSinceLastUse = 0;
}
@@ -522,11 +517,9 @@ bool GrDrawOpAtlas::activateNewPage(GrResourceProvider* resourceProvider) {
return false;
}
-#ifdef DUMP_ATLAS_DATA
- if (gDumpAtlasData) {
+ if constexpr (kDumpAtlasData) {
SkDebugf("activated page#: %d\n", fNumActivePages);
}
-#endif
++fNumActivePages;
return true;
@@ -574,7 +567,7 @@ GrDrawOpAtlasConfig::GrDrawOpAtlasConfig(int maxTextureSize, size_t maxBytes) {
maxBytes >>= 18;
// Take the floor of the log to get the index
int index = maxBytes > 0
- ? SkTPin<int>(SkPrevLog2(maxBytes), 0, SK_ARRAY_COUNT(kARGBDimensions) - 1)
+ ? SkTPin<int>(SkPrevLog2(maxBytes), 0, std::size(kARGBDimensions) - 1)
: 0;
SkASSERT(kARGBDimensions[index].width() <= kMaxAtlasDim);
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrDrawOpAtlas.h b/chromium/third_party/skia/src/gpu/ganesh/GrDrawOpAtlas.h
index 61754579ab0..91f6b645549 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrDrawOpAtlas.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrDrawOpAtlas.h
@@ -40,8 +40,10 @@ class GrTextureProxy;
* excess space, periodic garbage collection is needed to shift data from the higher index pages to
* the lower ones, and then eventually remove any pages that are no longer in use. "In use" is
* determined by using the GrDrawUploadToken system: After a flush each subarea of the page
- * is checked to see whether it was used in that flush; if it is not, a counter is incremented.
- * Once that counter reaches a threshold that subarea is considered to be no longer in use.
+ * is checked to see whether it was used in that flush. If less than a quarter of the plots have
+ * been used recently (within kPlotRecentlyUsedCount iterations) and there are available
+ * plots in lower index pages, the higher index page will be deactivated, and its glyphs will
+ * gradually migrate to other pages via the usual upload system.
*
* Garbage collection is initiated by the GrDrawOpAtlas's client via the compact() method. One
* solution is to make the client a subclass of GrOnFlushCallbackObject, register it with the
@@ -56,21 +58,23 @@ public:
/**
* Returns a GrDrawOpAtlas. This function can be called anywhere, but the returned atlas
* should only be used inside of GrMeshDrawOp::onPrepareDraws.
- * @param ct The colorType which this atlas will store
- * @param bpp Size in bytes of each pixel
- * @param width width in pixels of the atlas
- * @param height height in pixels of the atlas
- * @param numPlotsX The number of plots the atlas should be broken up into in the X
- * direction
- * @param numPlotsY The number of plots the atlas should be broken up into in the Y
- * direction
- * @param atlasGeneration a pointer to the context's generation counter.
+ * @param proxyProvider Used to create the atlas's texture proxies.
+ * @param format Backend format for the atlas's textures.
+ * Should be compatible with ct.
+ * @param ct The colorType which this atlas will store.
+ * @param bpp Size in bytes of each pixel.
+ * @param width Width in pixels of the atlas.
+ * @param height Height in pixels of the atlas.
+ * @param plotWidth The width of each plot. width/plotWidth should be an integer.
+ * @param plotWidth The height of each plot. height/plotHeight should be an integer.
+ * @param generationCounter A pointer to the context's generation counter.
* @param allowMultitexturing Can the atlas use more than one texture.
- * @param evictor A pointer to an eviction callback class.
+ * @param evictor A pointer to an eviction callback class.
+ * @param label A label for the atlas texture.
*
- * @return An initialized GrDrawOpAtlas, or nullptr if creation fails
+ * @return An initialized DrawAtlas, or nullptr if creation fails.
*/
- static std::unique_ptr<GrDrawOpAtlas> Make(GrProxyProvider*,
+ static std::unique_ptr<GrDrawOpAtlas> Make(GrProxyProvider* proxyProvider,
const GrBackendFormat& format,
SkColorType ct, size_t bpp,
int width, int height,
@@ -92,7 +96,7 @@ public:
* add the subimage. In this case the op being created should be discarded.
*
* NOTE: When the GrDrawOp prepares a draw that reads from the atlas, it must immediately call
- * 'setUseToken' with the currentToken from the GrDrawOp::Target, otherwise the next call to
+ * 'setLastUseToken' with the currentToken from the GrDrawOp::Target, otherwise the next call to
* addToAtlas might cause the previous data to be overwritten before it has been read.
*/
@@ -208,6 +212,11 @@ private:
unsigned int fNumPlots;
const std::string fLabel;
+ // A counter to track the atlas eviction state for Glyphs. Each Glyph has a PlotLocator
+ // which contains its current generation. When the atlas evicts a plot, it increases
+ // the generation counter. If a Glyph's generation is less than the atlas's
+ // generation, then it knows it's been evicted and is either free to be deleted or
+ // re-added to the atlas if necessary.
skgpu::AtlasGenerationCounter* const fGenerationCounter;
uint64_t fAtlasGeneration;
@@ -236,9 +245,9 @@ private:
};
// There are three atlases (A8, 565, ARGB) that are kept in relation with one another. In
-// general, the A8 dimensions are 2x the 565 and ARGB dimensions with the constraint that an atlas
-// size will always contain at least one plot. Since the ARGB atlas takes the most space, its
-// dimensions are used to size the other two atlases.
+// general, because A8 is the most frequently used mask format its dimensions are 2x the 565 and
+// ARGB dimensions, with the constraint that an atlas size will always contain at least one plot.
+// Since the ARGB atlas takes the most space, its dimensions are used to size the other two atlases.
class GrDrawOpAtlasConfig {
public:
// The capabilities of the GPU define maxTextureSize. The client provides maxBytes, and this
@@ -253,8 +262,8 @@ public:
SkISize plotDimensions(skgpu::MaskFormat type) const;
private:
- // On some systems texture coordinates are represented using half-precision floating point,
- // which limits the largest atlas dimensions to 2048x2048.
+ // On some systems texture coordinates are represented using half-precision floating point
+ // with 11 significant bits, which limits the largest atlas dimensions to 2048x2048.
// For simplicity we'll use this constraint for all of our atlas textures.
// This can be revisited later if we need larger atlases.
inline static constexpr int kMaxAtlasDim = 2048;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrDrawOpTest.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrDrawOpTest.cpp
index 77cf8eae10a..f48d269c7ba 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrDrawOpTest.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrDrawOpTest.cpp
@@ -54,7 +54,7 @@ const GrUserStencilSettings* GrGetRandomStencil(SkRandom* random, GrContext_Base
&kWrites,
&kReadsAndWrites,
};
- return kStencilSettings[random->nextULessThan(SK_ARRAY_COUNT(kStencilSettings))];
+ return kStencilSettings[random->nextULessThan(std::size(kStencilSettings))];
}
#endif
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrDrawingManager.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrDrawingManager.cpp
index b47ea61c1a1..42bea94c05e 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrDrawingManager.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrDrawingManager.cpp
@@ -16,6 +16,7 @@
#include "include/gpu/GrRecordingContext.h"
#include "src/core/SkDeferredDisplayListPriv.h"
#include "src/core/SkTInternalLList.h"
+#include "src/gpu/ganesh/GrBufferTransferRenderTask.h"
#include "src/gpu/ganesh/GrClientMappedBufferManager.h"
#include "src/gpu/ganesh/GrCopyRenderTask.h"
#include "src/gpu/ganesh/GrDDLTask.h"
@@ -312,31 +313,59 @@ void GrDrawingManager::removeRenderTasks() {
task->disown(this);
}
fDAG.reset();
+ fReorderBlockerTaskIndices.clear();
fLastRenderTasks.reset();
}
void GrDrawingManager::sortTasks() {
- if (!GrTTopoSort<GrRenderTask, GrRenderTask::TopoSortTraits>(&fDAG)) {
- SkDEBUGFAIL("Render task topo sort failed.");
- return;
- }
+ // We separately sort the ranges around non-reorderable tasks.
+ for (size_t i = 0, start = 0, end; start < fDAG.size(); ++i, start = end + 1) {
+ end = i == fReorderBlockerTaskIndices.size() ? fDAG.size() : fReorderBlockerTaskIndices[i];
+ SkSpan span(fDAG.begin() + start, end - start);
-#if SK_GPU_V1 && defined(SK_DEBUG)
- // This block checks for any unnecessary splits in the opsTasks. If two sequential opsTasks
- // could have merged it means the opsTask was artificially split.
- if (!fDAG.empty()) {
- auto prevOpsTask = fDAG[0]->asOpsTask();
- for (int i = 1; i < fDAG.count(); ++i) {
- auto curOpsTask = fDAG[i]->asOpsTask();
+ SkASSERT(std::none_of(span.begin(), span.end(), [](const auto& t) {
+ return t->blocksReordering();
+ }));
+ SkASSERT(span.end() == fDAG.end() || fDAG[end]->blocksReordering());
- if (prevOpsTask && curOpsTask) {
- SkASSERT(!prevOpsTask->canMerge(curOpsTask));
+#if SK_GPU_V1 && defined(SK_DEBUG)
+ // In order to partition the dag array like this it must be the case that each partition
+ // only depends on nodes in the partition or earlier partitions.
+ auto check = [&](const GrRenderTask* task, auto&& check) -> void {
+ SkASSERT(GrRenderTask::TopoSortTraits::WasOutput(task) ||
+ std::find_if(span.begin(), span.end(), [task](const auto& n) {
+ return n.get() == task; }));
+ for (size_t i = 0; i < task->fDependencies.size(); ++i) {
+ check(task->fDependencies[i], check);
}
+ };
+ for (const auto& node : span) {
+ check(node.get(), check);
+ }
+#endif
- prevOpsTask = curOpsTask;
+ bool sorted = GrTTopoSort<GrRenderTask, GrRenderTask::TopoSortTraits>(span, start);
+ if (!sorted) {
+ SkDEBUGFAIL("Render task topo sort failed.");
+ }
+
+#if SK_GPU_V1 && defined(SK_DEBUG)
+ if (sorted && !span.empty()) {
+ // This block checks for any unnecessary splits in the opsTasks. If two sequential
+ // opsTasks could have merged it means the opsTask was artificially split.
+ auto prevOpsTask = span[0]->asOpsTask();
+ for (size_t j = 1; j < span.size(); ++j) {
+ auto curOpsTask = span[j]->asOpsTask();
+
+ if (prevOpsTask && curOpsTask) {
+ SkASSERT(!prevOpsTask->canMerge(curOpsTask));
+ }
+
+ prevOpsTask = curOpsTask;
+ }
}
- }
#endif
+ }
}
// Reorder the array to match the llist without reffing & unreffing sk_sp's.
@@ -355,8 +384,27 @@ static void reorder_array_by_llist(const SkTInternalLList<T>& llist, SkTArray<sk
bool GrDrawingManager::reorderTasks(GrResourceAllocator* resourceAllocator) {
SkASSERT(fReduceOpsTaskSplitting);
+ // We separately sort the ranges around non-reorderable tasks.
+ bool clustered = false;
SkTInternalLList<GrRenderTask> llist;
- bool clustered = GrClusterRenderTasks(SkMakeSpan(fDAG), &llist);
+ for (size_t i = 0, start = 0, end; start < fDAG.size(); ++i, start = end + 1) {
+ end = i == fReorderBlockerTaskIndices.size() ? fDAG.size() : fReorderBlockerTaskIndices[i];
+ SkSpan span(fDAG.begin() + start, end - start);
+ SkASSERT(std::none_of(span.begin(), span.end(), [](const auto& t) {
+ return t->blocksReordering();
+ }));
+
+ SkTInternalLList<GrRenderTask> subllist;
+ if (GrClusterRenderTasks(span, &subllist)) {
+ clustered = true;
+ }
+
+ if (i < fReorderBlockerTaskIndices.size()) {
+ SkASSERT(fDAG[fReorderBlockerTaskIndices[i]]->blocksReordering());
+ subllist.addToTail(fDAG[fReorderBlockerTaskIndices[i]].get());
+ }
+ llist.concat(std::move(subllist));
+ }
if (!clustered) {
return false;
}
@@ -410,18 +458,22 @@ GrRenderTask* GrDrawingManager::insertTaskBeforeLast(sk_sp<GrRenderTask> task) {
if (fDAG.empty()) {
return fDAG.push_back(std::move(task)).get();
}
- // Release 'fDAG.back()' and grab the raw pointer, in case the SkTArray grows
- // and reallocates during emplace_back.
- // TODO: Either use std::vector that can do this for us, or use SkSTArray to get the
- // perf win.
- fDAG.emplace_back(fDAG.back().release());
- return (fDAG[fDAG.count() - 2] = std::move(task)).get();
+ if (!fReorderBlockerTaskIndices.empty() && fReorderBlockerTaskIndices.back() == fDAG.count()) {
+ fReorderBlockerTaskIndices.back()++;
+ }
+ fDAG.push_back(std::move(task));
+ auto& penultimate = fDAG.fromBack(1);
+ fDAG.back().swap(penultimate);
+ return penultimate.get();
}
GrRenderTask* GrDrawingManager::appendTask(sk_sp<GrRenderTask> task) {
if (!task) {
return nullptr;
}
+ if (task->blocksReordering()) {
+ fReorderBlockerTaskIndices.push_back(fDAG.count());
+ }
return fDAG.push_back(std::move(task)).get();
}
@@ -543,6 +595,7 @@ void GrDrawingManager::moveRenderTasksToDDL(SkDeferredDisplayList* ddl) {
fDAG.swap(ddl->fRenderTasks);
SkASSERT(fDAG.empty());
+ fReorderBlockerTaskIndices.clear();
for (auto& renderTask : ddl->fRenderTasks) {
renderTask->disown(this);
@@ -822,6 +875,41 @@ void GrDrawingManager::newTransferFromRenderTask(sk_sp<GrSurfaceProxy> srcProxy,
SkDEBUGCODE(this->validate());
}
+void GrDrawingManager::newBufferTransferTask(sk_sp<GrGpuBuffer> src,
+ size_t srcOffset,
+ sk_sp<GrGpuBuffer> dst,
+ size_t dstOffset,
+ size_t size) {
+ SkASSERT(src);
+ SkASSERT(dst);
+ SkASSERT(srcOffset + size <= src->size());
+ SkASSERT(dstOffset + size <= dst->size());
+ SkASSERT(src->intendedType() == GrGpuBufferType::kXferCpuToGpu);
+ SkASSERT(dst->intendedType() != GrGpuBufferType::kXferCpuToGpu);
+ SkASSERT(!src->isMapped());
+ SkASSERT(!dst->isMapped());
+
+ SkDEBUGCODE(this->validate());
+ SkASSERT(fContext);
+
+ this->closeActiveOpsTask();
+
+ sk_sp<GrRenderTask> task = GrBufferTransferRenderTask::Make(std::move(src),
+ srcOffset,
+ std::move(dst),
+ dstOffset,
+ size);
+ SkASSERT(task);
+
+ this->appendTask(task);
+ task->makeClosed(fContext);
+
+ // We have closed the previous active oplist but since a new oplist isn't being added there
+ // shouldn't be an active one.
+ SkASSERT(!fActiveOpsTask);
+ SkDEBUGCODE(this->validate());
+}
+
sk_sp<GrRenderTask> GrDrawingManager::newCopyRenderTask(sk_sp<GrSurfaceProxy> src,
SkIRect srcRect,
sk_sp<GrSurfaceProxy> dst,
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrDrawingManager.h b/chromium/third_party/skia/src/gpu/ganesh/GrDrawingManager.h
index c93f38ba2ba..cd03befcc5c 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrDrawingManager.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrDrawingManager.h
@@ -19,8 +19,8 @@
#include "src/gpu/ganesh/GrSurfaceProxy.h"
#if SK_GPU_V1
-#include "src/gpu/ganesh/v1/PathRenderer.h"
-#include "src/gpu/ganesh/v1/PathRendererChain.h"
+#include "src/gpu/ganesh/PathRenderer.h"
+#include "src/gpu/ganesh/PathRendererChain.h"
#endif
// Enabling this will print out which path renderers are being chosen
@@ -103,6 +103,17 @@ public:
SkIPoint dstPoint,
GrSurfaceOrigin);
+ // Adds a render task that copies the range [srcOffset, srcOffset + size] from src to
+ // [dstOffset, dstOffset + size] in dst. The src buffer must have type kXferCpuToGpu and the
+ // dst must NOT have type kXferCpuToGpu. Neither buffer may be mapped. Because this is used to
+ // insert transfers to vertex/index buffers between draws and we don't track dependencies with
+ // buffers, this task is a hard boundary for task reordering.
+ void newBufferTransferTask(sk_sp<GrGpuBuffer> src,
+ size_t srcOffset,
+ sk_sp<GrGpuBuffer> dst,
+ size_t dstOffset,
+ size_t size);
+
// Adds a task that writes the data from the passed GrMipLevels to dst. The lifetime of the
// pixel data in the levels should be tied to the passed SkData or the caller must flush the
// context before the data may become invalid. srcColorType is the color type of the
@@ -221,6 +232,7 @@ private:
sk_sp<GrBufferAllocPool::CpuBufferCache> fCpuBufferCache;
SkTArray<sk_sp<GrRenderTask>> fDAG;
+ std::vector<int> fReorderBlockerTaskIndices;
skgpu::v1::OpsTask* fActiveOpsTask = nullptr;
#if SK_GPU_V1
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrFPArgs.h b/chromium/third_party/skia/src/gpu/ganesh/GrFPArgs.h
index 62c69ebbaba..c28ba6ab393 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrFPArgs.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrFPArgs.h
@@ -13,21 +13,24 @@
class GrColorInfo;
class GrRecordingContext;
class SkMatrixProvider;
+class SkSurfaceProps;
struct GrFPArgs {
GrFPArgs(GrRecordingContext* context,
const SkMatrixProvider& matrixProvider,
- const GrColorInfo* dstColorInfo)
+ const GrColorInfo* dstColorInfo,
+ const SkSurfaceProps& surfaceProps)
: fContext(context)
, fMatrixProvider(matrixProvider)
- , fDstColorInfo(dstColorInfo) {
+ , fDstColorInfo(dstColorInfo)
+ , fSurfaceProps(surfaceProps) {
SkASSERT(fContext);
}
class WithPreLocalMatrix;
GrFPArgs withNewMatrixProvider(const SkMatrixProvider& provider) const {
- GrFPArgs newArgs(fContext, provider, fDstColorInfo);
+ GrFPArgs newArgs(fContext, provider, fDstColorInfo, fSurfaceProps);
newArgs.fPreLocalMatrix = fPreLocalMatrix;
return newArgs;
}
@@ -38,6 +41,8 @@ struct GrFPArgs {
const SkMatrix* fPreLocalMatrix = nullptr;
const GrColorInfo* fDstColorInfo;
+
+ const SkSurfaceProps& fSurfaceProps;
};
class GrFPArgs::WithPreLocalMatrix final : public GrFPArgs {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrFinishCallbacks.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrFinishCallbacks.cpp
index 5519d2ca639..172f07d4de4 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrFinishCallbacks.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrFinishCallbacks.cpp
@@ -35,10 +35,16 @@ void GrFinishCallbacks::check() {
void GrFinishCallbacks::callAll(bool doDelete) {
while (!fCallbacks.empty()) {
- fCallbacks.front().fCallback(fCallbacks.front().fContext);
+ // While we are processing a proc we need to make sure to remove it from
+ // the callback list before calling it. This is because the client could
+ // trigger a call (e.g. calling flushAndSubmit(/*sync=*/true)) that has
+ // us process the finished callbacks. We also must process deleting the
+ // fence before a client may abandon the context.
+ auto finishCallback = fCallbacks.front();
if (doDelete) {
- fGpu->deleteFence(fCallbacks.front().fFence);
+ fGpu->deleteFence(finishCallback.fFence);
}
fCallbacks.pop_front();
+ finishCallback.fCallback(finishCallback.fContext);
}
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrFragmentProcessor.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrFragmentProcessor.cpp
index dd0298fe61b..42f22693e42 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrFragmentProcessor.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrFragmentProcessor.cpp
@@ -190,7 +190,8 @@ void GrFragmentProcessor::cloneAndRegisterAllChildProcessors(const GrFragmentPro
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::MakeColor(SkPMColor4f color) {
// Use ColorFilter signature/factory to get the constant output for constant input optimization
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForColorFilter, R"(
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForColorFilter,
+ R"(
uniform half4 color;
half4 main(half4 inColor) { return color; }
)");
@@ -212,7 +213,8 @@ std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::MulInputByChildAlpha(
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::ApplyPaintAlpha(
std::unique_ptr<GrFragmentProcessor> child) {
SkASSERT(child);
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForColorFilter, R"(
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForColorFilter,
+ R"(
uniform colorFilter fp;
half4 main(half4 inColor) {
return fp.eval(inColor.rgb1) * inColor.a;
@@ -234,14 +236,15 @@ std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::ModulateRGBA(
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::ClampOutput(
std::unique_ptr<GrFragmentProcessor> fp) {
SkASSERT(fp);
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForColorFilter, R"(
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForColorFilter,
+ R"(
half4 main(half4 inColor) {
return saturate(inColor);
}
)");
SkASSERT(SkRuntimeEffectPriv::SupportsConstantOutputForConstantInput(effect));
- return GrSkSLFP::Make(
- effect, "Clamp", std::move(fp), GrSkSLFP::OptFlags::kPreservesOpaqueInput);
+ return GrSkSLFP::Make(effect, "Clamp", std::move(fp),
+ GrSkSLFP::OptFlags::kPreservesOpaqueInput);
}
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::SwizzleOutput(
@@ -319,7 +322,7 @@ std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::OverrideInput(
if (!fp) {
return nullptr;
}
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForColorFilter, R"(
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForColorFilter, R"(
uniform colorFilter fp; // Declared as colorFilter so we can pass a color
uniform half4 color;
half4 main(half4 inColor) {
@@ -341,7 +344,8 @@ std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::DisableCoverageAsAlpha
if (!fp || !fp->compatibleWithCoverageAsAlpha()) {
return fp;
}
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForColorFilter, R"(
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForColorFilter,
+ R"(
half4 main(half4 inColor) { return inColor; }
)");
SkASSERT(SkRuntimeEffectPriv::SupportsConstantOutputForConstantInput(effect));
@@ -351,16 +355,13 @@ std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::DisableCoverageAsAlpha
//////////////////////////////////////////////////////////////////////////////
-std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::UseDestColorAsInput(
- std::unique_ptr<GrFragmentProcessor> fp) {
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForBlender, R"(
- uniform colorFilter fp; // Declared as colorFilter so we can pass a color
+std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::DestColor() {
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForBlender, R"(
half4 main(half4 src, half4 dst) {
- return fp.eval(dst);
+ return dst;
}
)");
- return GrSkSLFP::Make(effect, "UseDestColorAsInput", /*inputFP=*/nullptr,
- GrSkSLFP::OptFlags::kNone, "fp", std::move(fp));
+ return GrSkSLFP::Make(effect, "DestColor", /*inputFP=*/nullptr, GrSkSLFP::OptFlags::kNone);
}
//////////////////////////////////////////////////////////////////////////////
@@ -431,7 +432,7 @@ std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::Compose(
inputColor.setToUnknown();
std::unique_ptr<GrFragmentProcessor> series[2] = {std::move(g), std::move(f)};
- GrColorFragmentProcessorAnalysis info(inputColor, series, SK_ARRAY_COUNT(series));
+ GrColorFragmentProcessorAnalysis info(inputColor, series, std::size(series));
SkPMColor4f knownColor;
int leadingFPsToEliminate = info.initialProcessorsToEliminate(&knownColor);
@@ -461,7 +462,8 @@ std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::ColorMatrix(
bool unpremulInput,
bool clampRGBOutput,
bool premulOutput) {
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForColorFilter, R"(
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForColorFilter,
+ R"(
uniform half4x4 m;
uniform half4 v;
uniform int unpremulInput; // always specialized
@@ -605,7 +607,8 @@ static_assert(static_cast<int>(GrClipEdgeType::kInverseFillAA) == 3);
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::Rect(
std::unique_ptr<GrFragmentProcessor> inputFP, GrClipEdgeType edgeType, SkRect rect) {
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, CLIP_EDGE_SKSL R"(
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader,
+ CLIP_EDGE_SKSL R"(
uniform int edgeType; // GrClipEdgeType, specialized
uniform float4 rectUniform;
@@ -653,7 +656,8 @@ GrFPResult GrFragmentProcessor::Circle(std::unique_ptr<GrFragmentProcessor> inpu
return GrFPFailure(std::move(inputFP));
}
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, CLIP_EDGE_SKSL R"(
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader,
+ CLIP_EDGE_SKSL R"(
uniform int edgeType; // GrClipEdgeType, specialized
// The circle uniform is (center.x, center.y, radius + 0.5, 1 / (radius + 0.5)) for regular
// fills and (..., radius - 0.5, 1 / (radius - 0.5)) for inverse fills.
@@ -713,7 +717,8 @@ GrFPResult GrFragmentProcessor::Ellipse(std::unique_ptr<GrFragmentProcessor> inp
return GrFPFailure(std::move(inputFP));
}
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, CLIP_EDGE_SKSL R"(
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader,
+ CLIP_EDGE_SKSL R"(
uniform int edgeType; // GrClipEdgeType, specialized
uniform int medPrecision; // !sk_Caps.floatIs32Bits, specialized
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrFragmentProcessor.h b/chromium/third_party/skia/src/gpu/ganesh/GrFragmentProcessor.h
index 0f087f020fa..ade8e7aeb98 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrFragmentProcessor.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrFragmentProcessor.h
@@ -94,12 +94,10 @@ public:
std::unique_ptr<GrFragmentProcessor>);
/**
- * Returns a fragment processor which samples the passed-in fragment processor using
- * `args.fDestColor` as its input color. Pass a null FP to access `args.fDestColor` directly.
- * (This is only meaningful in contexts like blenders, which use a source and dest color.)
+ * Returns a fragment processor which returns `args.fDestColor`. This is only meaningful in
+ * contexts like blenders, which use a source and dest color.)
*/
- static std::unique_ptr<GrFragmentProcessor> UseDestColorAsInput(
- std::unique_ptr<GrFragmentProcessor>);
+ static std::unique_ptr<GrFragmentProcessor> DestColor();
/**
* Returns a fragment processor that calls the passed in fragment processor, and then swizzles
@@ -658,5 +656,9 @@ static inline GrFPResult GrFPSuccess(std::unique_ptr<GrFragmentProcessor> fp) {
SkASSERT(fp);
return {true, std::move(fp)};
}
+// Equivalent to GrFPSuccess except it allows the returned fragment processor to be null.
+static inline GrFPResult GrFPNullableSuccess(std::unique_ptr<GrFragmentProcessor> fp) {
+ return {true, std::move(fp)};
+}
#endif
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrGpu.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrGpu.cpp
index 8e4bcafe1ae..16ecf78d09b 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrGpu.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrGpu.cpp
@@ -392,6 +392,11 @@ sk_sp<GrGpuBuffer> GrGpu::createBuffer(size_t size,
GrAccessPattern accessPattern) {
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
this->handleDirtyContext();
+ if ((intendedType == GrGpuBufferType::kXferCpuToGpu ||
+ intendedType == GrGpuBufferType::kXferGpuToCpu) &&
+ accessPattern == kStatic_GrAccessPattern) {
+ return nullptr;
+ }
sk_sp<GrGpuBuffer> buffer = this->onCreateBuffer(size, intendedType, accessPattern);
if (!this->caps()->reuseScratchBuffers()) {
buffer->resourcePriv().removeScratchKey();
@@ -483,18 +488,51 @@ bool GrGpu::writePixels(GrSurface* surface,
}
this->handleDirtyContext();
- if (this->onWritePixels(surface,
- rect,
- surfaceColorType,
- srcColorType,
- texels,
- mipLevelCount,
- prepForTexSampling)) {
- this->didWriteToSurface(surface, kTopLeft_GrSurfaceOrigin, &rect, mipLevelCount);
- fStats.incTextureUploads();
- return true;
+ if (!this->onWritePixels(surface,
+ rect,
+ surfaceColorType,
+ srcColorType,
+ texels,
+ mipLevelCount,
+ prepForTexSampling)) {
+ return false;
}
- return false;
+
+ this->didWriteToSurface(surface, kTopLeft_GrSurfaceOrigin, &rect, mipLevelCount);
+ fStats.incTextureUploads();
+
+ return true;
+}
+
+bool GrGpu::transferFromBufferToBuffer(sk_sp<GrGpuBuffer> src,
+ size_t srcOffset,
+ sk_sp<GrGpuBuffer> dst,
+ size_t dstOffset,
+ size_t size) {
+ SkASSERT(src);
+ SkASSERT(dst);
+ SkASSERT(srcOffset % this->caps()->transferFromBufferToBufferAlignment() == 0);
+ SkASSERT(dstOffset % this->caps()->transferFromBufferToBufferAlignment() == 0);
+ SkASSERT(size % this->caps()->transferFromBufferToBufferAlignment() == 0);
+ SkASSERT(srcOffset + size <= src->size());
+ SkASSERT(dstOffset + size <= dst->size());
+ SkASSERT(src->intendedType() == GrGpuBufferType::kXferCpuToGpu);
+ SkASSERT(dst->intendedType() != GrGpuBufferType::kXferCpuToGpu);
+ SkASSERT(!src->isMapped());
+ SkASSERT(!dst->isMapped());
+
+ this->handleDirtyContext();
+ if (!this->onTransferFromBufferToBuffer(std::move(src),
+ srcOffset,
+ std::move(dst),
+ dstOffset,
+ size)) {
+ return false;
+ }
+
+ fStats.incBufferTransfers();
+
+ return true;
}
bool GrGpu::transferPixelsTo(GrTexture* texture,
@@ -507,6 +545,7 @@ bool GrGpu::transferPixelsTo(GrTexture* texture,
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
SkASSERT(texture);
SkASSERT(transferBuffer);
+ SkASSERT(transferBuffer->intendedType() == GrGpuBufferType::kXferCpuToGpu);
if (texture->readOnly()) {
return false;
@@ -532,19 +571,20 @@ bool GrGpu::transferPixelsTo(GrTexture* texture,
}
this->handleDirtyContext();
- if (this->onTransferPixelsTo(texture,
- rect,
- textureColorType,
- bufferColorType,
- std::move(transferBuffer),
- offset,
- rowBytes)) {
- this->didWriteToSurface(texture, kTopLeft_GrSurfaceOrigin, &rect);
- fStats.incTransfersToTexture();
-
- return true;
+ if (!this->onTransferPixelsTo(texture,
+ rect,
+ textureColorType,
+ bufferColorType,
+ std::move(transferBuffer),
+ offset,
+ rowBytes)) {
+ return false;
}
- return false;
+
+ this->didWriteToSurface(texture, kTopLeft_GrSurfaceOrigin, &rect);
+ fStats.incTransfersToTexture();
+
+ return true;
}
bool GrGpu::transferPixelsFrom(GrSurface* surface,
@@ -556,6 +596,7 @@ bool GrGpu::transferPixelsFrom(GrSurface* surface,
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
SkASSERT(surface);
SkASSERT(transferBuffer);
+ SkASSERT(transferBuffer->intendedType() == GrGpuBufferType::kXferGpuToCpu);
SkASSERT(this->caps()->areColorTypeAndFormatCompatible(surfaceColorType,
surface->backendFormat()));
@@ -572,16 +613,18 @@ bool GrGpu::transferPixelsFrom(GrSurface* surface,
}
this->handleDirtyContext();
- if (this->onTransferPixelsFrom(surface,
- rect,
- surfaceColorType,
- bufferColorType,
- std::move(transferBuffer),
- offset)) {
- fStats.incTransfersFromSurface();
- return true;
+ if (!this->onTransferPixelsFrom(surface,
+ rect,
+ surfaceColorType,
+ bufferColorType,
+ std::move(transferBuffer),
+ offset)) {
+ return false;
}
- return false;
+
+ fStats.incTransfersFromSurface();
+
+ return true;
}
bool GrGpu::regenerateMipMapLevels(GrTexture* texture) {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrGpu.h b/chromium/third_party/skia/src/gpu/ganesh/GrGpu.h
index 5fa0f3ac238..2498cf9bcfe 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrGpu.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrGpu.h
@@ -300,6 +300,23 @@ public:
}
/**
+ * Transfer bytes from one GPU buffer to another. The src buffer must have type kXferCpuToGpu
+ * and the dst buffer must not. Neither buffer may currently be mapped. The offsets and size
+ * must be aligned to GrCaps::transferFromBufferToBufferAlignment.
+ *
+ * @param src the buffer to read from
+ * @param srcOffset the aligned offset at the src at which the transfer begins.
+ * @param dst the buffer to write to
+ * @param dstOffset the aligned offset in the dst at which the transfer begins
+ * @param size the aligned number of bytes to transfer;
+ */
+ bool transferFromBufferToBuffer(sk_sp<GrGpuBuffer> src,
+ size_t srcOffset,
+ sk_sp<GrGpuBuffer> dst,
+ size_t dstOffset,
+ size_t size);
+
+ /**
* Updates the pixels in a rectangle of a texture using a buffer. If the texture is MIP mapped,
* the base level is written to.
*
@@ -445,6 +462,9 @@ public:
int transfersFromSurface() const { return fTransfersFromSurface; }
void incTransfersFromSurface() { fTransfersFromSurface++; }
+ void incBufferTransfers() { fBufferTransfers++; }
+ int bufferTransfers() const { return fBufferTransfers; }
+
int stencilAttachmentCreates() const { return fStencilAttachmentCreates; }
void incStencilAttachmentCreates() { fStencilAttachmentCreates++; }
@@ -481,6 +501,7 @@ public:
int fTextureUploads = 0;
int fTransfersToTexture = 0;
int fTransfersFromSurface = 0;
+ int fBufferTransfers = 0;
int fStencilAttachmentCreates = 0;
int fMSAAAttachmentCreates = 0;
int fNumDraws = 0;
@@ -500,6 +521,7 @@ public:
void incTextureCreates() {}
void incTextureUploads() {}
void incTransfersToTexture() {}
+ void incBufferTransfers() {}
void incTransfersFromSurface() {}
void incStencilAttachmentCreates() {}
void incMSAAAttachmentCreates() {}
@@ -748,10 +770,17 @@ private:
int mipLevelCount,
bool prepForTexSampling) = 0;
+ // overridden by backend-specific derived class to perform the buffer transfer
+ virtual bool onTransferFromBufferToBuffer(sk_sp<GrGpuBuffer> src,
+ size_t srcOffset,
+ sk_sp<GrGpuBuffer> dst,
+ size_t dstOffset,
+ size_t size) = 0;
+
// overridden by backend-specific derived class to perform the texture transfer
virtual bool onTransferPixelsTo(GrTexture*,
SkIRect,
- GrColorType textiueColorType,
+ GrColorType textureColorType,
GrColorType bufferColorType,
sk_sp<GrGpuBuffer> transferBuffer,
size_t offset,
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrGpuBuffer.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrGpuBuffer.cpp
index 852d260c3fd..5a75910082d 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrGpuBuffer.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrGpuBuffer.cpp
@@ -22,9 +22,8 @@ void* GrGpuBuffer::map() {
if (this->wasDestroyed()) {
return nullptr;
}
- SkASSERT(!fHasWrittenToBuffer || fAccessPattern == kDynamic_GrAccessPattern);
if (!fMapPtr) {
- this->onMap();
+ this->onMap(this->mapType());
}
return fMapPtr;
}
@@ -34,29 +33,33 @@ void GrGpuBuffer::unmap() {
return;
}
SkASSERT(fMapPtr);
- this->onUnmap();
+ this->onUnmap(this->mapType());
fMapPtr = nullptr;
-#ifdef SK_DEBUG
- fHasWrittenToBuffer = true;
-#endif
}
bool GrGpuBuffer::isMapped() const { return SkToBool(fMapPtr); }
-bool GrGpuBuffer::updateData(const void* src, size_t srcSizeInBytes) {
- SkASSERT(!fHasWrittenToBuffer || fAccessPattern == kDynamic_GrAccessPattern);
+bool GrGpuBuffer::updateData(const void* src, size_t offset, size_t size, bool preserve) {
SkASSERT(!this->isMapped());
- SkASSERT(srcSizeInBytes <= fSizeInBytes);
- if (this->intendedType() == GrGpuBufferType::kXferGpuToCpu) {
+ SkASSERT(size > 0 && offset + size <= fSizeInBytes);
+ SkASSERT(src);
+
+ if (this->wasDestroyed()) {
return false;
}
- bool result = this->onUpdateData(src, srcSizeInBytes);
-#ifdef SK_DEBUG
- if (result) {
- fHasWrittenToBuffer = true;
+
+ if (preserve) {
+ size_t a = this->getGpu()->caps()->bufferUpdateDataPreserveAlignment();
+ if (SkAlignTo(offset, a) != offset || SkAlignTo(size, a) != size) {
+ return false;
+ }
}
-#endif
- return result;
+
+ if (this->intendedType() == GrGpuBufferType::kXferGpuToCpu) {
+ return false;
+ }
+
+ return this->onUpdateData(src, offset, size, preserve);
}
void GrGpuBuffer::ComputeScratchKeyForDynamicBuffer(size_t size,
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrGpuBuffer.h b/chromium/third_party/skia/src/gpu/ganesh/GrGpuBuffer.h
index cd05251dc47..87c69bbfab7 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrGpuBuffer.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrGpuBuffer.h
@@ -66,8 +66,10 @@ public:
* Updates the buffer data.
*
* The size of the buffer will be preserved. The src data will be
- * placed at the beginning of the buffer and any remaining contents will
- * be undefined. srcSizeInBytes must be <= to the buffer size.
+ * placed at offset. If preserve is false then any remaining content
+ * before/after the range [offset, offset+size) becomes undefined.
+ * Preserving updates will fail if the size and offset are not aligned
+ * to GrCaps::bufferUpdateDataPreserveAlignment().
*
* The buffer must not be mapped.
*
@@ -78,7 +80,9 @@ public:
*
* @return returns true if the update succeeds, false otherwise.
*/
- bool updateData(const void* src, size_t srcSizeInBytes);
+ bool updateData(const void* src, size_t offset, size_t size, bool preserve);
+
+ GrGpuBufferType intendedType() const { return fIntendedType; }
protected:
GrGpuBuffer(GrGpu*,
@@ -86,14 +90,30 @@ protected:
GrGpuBufferType,
GrAccessPattern,
std::string_view label);
- GrGpuBufferType intendedType() const { return fIntendedType; }
+
+ enum class MapType {
+ /** Maps for reading. The effect of writes is undefined. */
+ kRead,
+ /**
+ * Maps for writing. The existing contents are discarded and the initial contents of the
+ * buffer. Reads (even after overwriting initial contents) should be avoided for performance
+ * reasons as the memory may not be cached.
+ */
+ kWriteDiscard,
+ };
void* fMapPtr;
private:
- virtual void onMap() = 0;
- virtual void onUnmap() = 0;
- virtual bool onUpdateData(const void* src, size_t srcSizeInBytes) = 0;
+ /** Currently MapType is determined entirely by the buffer type, as documented in map(). */
+ MapType mapType() const {
+ return this->intendedType() == GrGpuBufferType::kXferGpuToCpu ? MapType::kRead
+ : MapType::kWriteDiscard;
+ }
+
+ virtual void onMap(MapType) = 0;
+ virtual void onUnmap(MapType) = 0;
+ virtual bool onUpdateData(const void* src, size_t offset, size_t size, bool preserve) = 0;
size_t onGpuMemorySize() const override { return fSizeInBytes; }
void onSetLabel() override{}
@@ -103,12 +123,6 @@ private:
size_t fSizeInBytes;
GrAccessPattern fAccessPattern;
GrGpuBufferType fIntendedType;
-
-#ifdef SK_DEBUG
- // Static and stream access buffers are only ever written to once. This is used to track that
- // and assert it is true.
- bool fHasWrittenToBuffer = false;
-#endif
};
#endif
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrMemoryPool.h b/chromium/third_party/skia/src/gpu/ganesh/GrMemoryPool.h
index b5c7cc6d725..4aa3c0909a1 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrMemoryPool.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrMemoryPool.h
@@ -113,7 +113,7 @@ private:
int fID; // ID that can be used to track down leaks by clients.
#endif
#if defined(SK_DEBUG) || defined(SK_SANITIZE_ADDRESS)
- int fSentinel; // set to a known value to check for memory stomping; poisoned in ASAN mode
+ uint32_t fSentinel; // set to a known value to check for memory stomping; poisoned in ASAN mode
#endif
};
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrOpFlushState.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrOpFlushState.cpp
index f406c42e2d5..91281b1d756 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrOpFlushState.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrOpFlushState.cpp
@@ -69,7 +69,7 @@ void GrOpFlushState::executeDrawsAndUploadsForMeshDrawOp(
this->drawMesh(fCurrDraw->fMeshes[i]);
}
- fTokenTracker->flushToken();
+ fTokenTracker->issueFlushToken();
++fCurrDraw;
}
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrPersistentCacheUtils.h b/chromium/third_party/skia/src/gpu/ganesh/GrPersistentCacheUtils.h
index 49eb9b1177f..a702495cf21 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrPersistentCacheUtils.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrPersistentCacheUtils.h
@@ -20,7 +20,7 @@ class SkReadBuffer;
namespace GrPersistentCacheUtils {
struct ShaderMetadata {
- SkSL::Program::Settings* fSettings = nullptr;
+ SkSL::ProgramSettings* fSettings = nullptr;
SkTArray<std::string> fAttributeNames;
bool fHasCustomColorOutput = false;
bool fHasSecondaryColorOutput = false;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrProcessorUnitTest.h b/chromium/third_party/skia/src/gpu/ganesh/GrProcessorUnitTest.h
index d3c647220ac..54c7e948721 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrProcessorUnitTest.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrProcessorUnitTest.h
@@ -128,30 +128,32 @@ private:
/** GrProcessor subclasses should insert this macro in their declaration to be included in the
* program generation unit test.
*/
-#define GR_DECLARE_GEOMETRY_PROCESSOR_TEST \
- static GrGeometryProcessorTestFactory gTestFactory SK_UNUSED; \
+#define GR_DECLARE_GEOMETRY_PROCESSOR_TEST \
+ static GrGeometryProcessorTestFactory* gTestFactory SK_UNUSED; \
static GrGeometryProcessor* TestCreate(GrProcessorTestData*);
-#define GR_DECLARE_FRAGMENT_PROCESSOR_TEST \
- static GrFragmentProcessorTestFactory gTestFactory SK_UNUSED; \
+#define GR_DECLARE_FRAGMENT_PROCESSOR_TEST \
+ static GrFragmentProcessorTestFactory* gTestFactory SK_UNUSED; \
static std::unique_ptr<GrFragmentProcessor> TestCreate(GrProcessorTestData*);
-#define GR_DECLARE_XP_FACTORY_TEST \
- static GrXPFactoryTestFactory gTestFactory SK_UNUSED; \
+#define GR_DECLARE_XP_FACTORY_TEST \
+ static GrXPFactoryTestFactory* gTestFactory SK_UNUSED; \
static const GrXPFactory* TestGet(GrProcessorTestData*);
/** GrProcessor subclasses should insert this macro in their implementation file. They must then
* also implement this static function:
* GrProcessor* TestCreate(GrProcessorTestData*);
*/
-#define GR_DEFINE_FRAGMENT_PROCESSOR_TEST(Effect) \
- GrFragmentProcessorTestFactory Effect::gTestFactory(Effect::TestCreate, #Effect)
+#define GR_DEFINE_FRAGMENT_PROCESSOR_TEST(Effect) \
+ GrFragmentProcessorTestFactory* Effect::gTestFactory = \
+ new GrFragmentProcessorTestFactory(Effect::TestCreate, #Effect)
-#define GR_DEFINE_GEOMETRY_PROCESSOR_TEST(Effect) \
- GrGeometryProcessorTestFactory Effect::gTestFactory(Effect::TestCreate, #Effect)
+#define GR_DEFINE_GEOMETRY_PROCESSOR_TEST(Effect) \
+ GrGeometryProcessorTestFactory* Effect::gTestFactory = \
+ new GrGeometryProcessorTestFactory(Effect::TestCreate, #Effect)
-#define GR_DEFINE_XP_FACTORY_TEST(Factory) \
- GrXPFactoryTestFactory Factory::gTestFactory(Factory::TestGet)
+#define GR_DEFINE_XP_FACTORY_TEST(Factory) \
+ GrXPFactoryTestFactory* Factory::gTestFactory = new GrXPFactoryTestFactory(Factory::TestGet)
#else // !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrProxyProvider.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrProxyProvider.cpp
index 11c716cc298..0b86bf36e4a 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrProxyProvider.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrProxyProvider.cpp
@@ -145,13 +145,14 @@ sk_sp<GrTextureProxy> GrProxyProvider::testingOnly_createInstantiatedProxy(
sk_sp<GrTexture> tex;
if (SkBackingFit::kApprox == fit) {
- tex = resourceProvider->createApproxTexture(dimensions,
- format,
- format.textureType(),
- renderable,
- renderTargetSampleCnt,
- isProtected,
- /*label=*/{});
+ tex = resourceProvider->createApproxTexture(
+ dimensions,
+ format,
+ format.textureType(),
+ renderable,
+ renderTargetSampleCnt,
+ isProtected,
+ /*label=*/"InstantiatedProxyViaApproxTexture_Test");
} else {
tex = resourceProvider->createTexture(dimensions,
format,
@@ -161,7 +162,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::testingOnly_createInstantiatedProxy(
GrMipmapped::kNo,
budgeted,
isProtected,
- /*label=*/{});
+ /*label=*/"InstantiatedProxyViaTexture_Test");
}
if (!tex) {
return nullptr;
@@ -786,7 +787,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::CreatePromiseProxy(GrContextThreadSafePro
GrInternalSurfaceFlags::kReadOnly,
GrSurfaceProxy::UseAllocator::kYes,
GrDDLProvider::kYes,
- /*label=*/{}));
+ /*label=*/"PromiseProxy"));
proxy->priv().setIsPromiseProxy();
return proxy;
}
@@ -828,7 +829,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::createLazyProxy(LazyInstantiateCallback&&
surfaceFlags,
useAllocator,
this->isDDLProvider(),
- /*label=*/{}));
+ /*label=*/"LazyProxy"));
}
sk_sp<GrRenderTargetProxy> GrProxyProvider::createLazyRenderTargetProxy(
@@ -860,37 +861,39 @@ sk_sp<GrRenderTargetProxy> GrProxyProvider::createLazyRenderTargetProxy(
// Wrapped vulkan secondary command buffers don't support texturing since we won't have an
// actual VkImage to texture from.
SkASSERT(!wrapsVkSecondaryCB);
- return sk_sp<GrRenderTargetProxy>(new GrTextureRenderTargetProxy(*this->caps(),
- std::move(callback),
- format,
- dimensions,
- sampleCnt,
- textureInfo->fMipmapped,
- mipmapStatus,
- fit,
- budgeted,
- isProtected,
- surfaceFlags,
- useAllocator,
- this->isDDLProvider(),
- /*label=*/{}));
+ return sk_sp<GrRenderTargetProxy>(new GrTextureRenderTargetProxy(
+ *this->caps(),
+ std::move(callback),
+ format,
+ dimensions,
+ sampleCnt,
+ textureInfo->fMipmapped,
+ mipmapStatus,
+ fit,
+ budgeted,
+ isProtected,
+ surfaceFlags,
+ useAllocator,
+ this->isDDLProvider(),
+ /*label=*/"TextureRenderTarget_LazyRenderTargetProxy"));
}
GrRenderTargetProxy::WrapsVkSecondaryCB vkSCB =
wrapsVkSecondaryCB ? GrRenderTargetProxy::WrapsVkSecondaryCB::kYes
: GrRenderTargetProxy::WrapsVkSecondaryCB::kNo;
- return sk_sp<GrRenderTargetProxy>(new GrRenderTargetProxy(std::move(callback),
- format,
- dimensions,
- sampleCnt,
- fit,
- budgeted,
- isProtected,
- surfaceFlags,
- useAllocator,
- vkSCB,
- /*label=*/{}));
+ return sk_sp<GrRenderTargetProxy>(
+ new GrRenderTargetProxy(std::move(callback),
+ format,
+ dimensions,
+ sampleCnt,
+ fit,
+ budgeted,
+ isProtected,
+ surfaceFlags,
+ useAllocator,
+ vkSCB,
+ /*label=*/"RenderTargetProxy_LazyRenderTargetProxy"));
}
sk_sp<GrTextureProxy> GrProxyProvider::MakeFullyLazyProxy(LazyInstantiateCallback&& callback,
@@ -914,20 +917,21 @@ sk_sp<GrTextureProxy> GrProxyProvider::MakeFullyLazyProxy(LazyInstantiateCallbac
// not being created by a DDL provider.
static constexpr SkISize kLazyDims = {-1, -1};
if (GrRenderable::kYes == renderable) {
- return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(caps,
- std::move(callback),
- format,
- kLazyDims,
- renderTargetSampleCnt,
- GrMipmapped::kNo,
- GrMipmapStatus::kNotAllocated,
- SkBackingFit::kApprox,
- SkBudgeted::kYes,
- isProtected,
- surfaceFlags,
- useAllocator,
- GrDDLProvider::kNo,
- /*label=*/{}));
+ return sk_sp<GrTextureProxy>(
+ new GrTextureRenderTargetProxy(caps,
+ std::move(callback),
+ format,
+ kLazyDims,
+ renderTargetSampleCnt,
+ GrMipmapped::kNo,
+ GrMipmapStatus::kNotAllocated,
+ SkBackingFit::kApprox,
+ SkBudgeted::kYes,
+ isProtected,
+ surfaceFlags,
+ useAllocator,
+ GrDDLProvider::kNo,
+ /*label=*/"TextureRenderTarget_FullyLazyProxy"));
} else {
return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(callback),
format,
@@ -940,7 +944,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::MakeFullyLazyProxy(LazyInstantiateCallbac
surfaceFlags,
useAllocator,
GrDDLProvider::kNo,
- /*label=*/{}));
+ /*label=*/"Texture_FullyLazyProxy"));
}
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrRecordingContextPriv.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrRecordingContextPriv.cpp
index a3c13f4941c..a962772ec7d 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrRecordingContextPriv.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrRecordingContextPriv.cpp
@@ -15,21 +15,21 @@
#include "src/gpu/ganesh/GrSurfaceProxyView.h"
#if SK_GPU_V1
-#include "src/gpu/ganesh/v1/Device_v1.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
-#include "src/gpu/ganesh/v1/SurfaceFillContext_v1.h"
+#include "src/gpu/ganesh/Device_v1.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
+#include "src/gpu/ganesh/SurfaceFillContext.h"
#endif
void GrRecordingContextPriv::addOnFlushCallbackObject(GrOnFlushCallbackObject* onFlushCBObject) {
this->context()->addOnFlushCallbackObject(onFlushCBObject);
}
-sk_sp<skgpu::BaseDevice> GrRecordingContextPriv::createDevice(GrColorType colorType,
+sk_sp<skgpu::v1::Device> GrRecordingContextPriv::createDevice(GrColorType colorType,
sk_sp<GrSurfaceProxy> proxy,
sk_sp<SkColorSpace> colorSpace,
GrSurfaceOrigin origin,
const SkSurfaceProps& props,
- skgpu::BaseDevice::InitContents init) {
+ skgpu::v1::Device::InitContents init) {
#if SK_GPU_V1
return skgpu::v1::Device::Make(this->context(), colorType, std::move(proxy),
std::move(colorSpace), origin, props, init);
@@ -38,7 +38,7 @@ sk_sp<skgpu::BaseDevice> GrRecordingContextPriv::createDevice(GrColorType colorT
#endif
}
-sk_sp<skgpu::BaseDevice> GrRecordingContextPriv::createDevice(SkBudgeted budgeted,
+sk_sp<skgpu::v1::Device> GrRecordingContextPriv::createDevice(SkBudgeted budgeted,
const SkImageInfo& ii,
SkBackingFit fit,
int sampleCount,
@@ -46,7 +46,7 @@ sk_sp<skgpu::BaseDevice> GrRecordingContextPriv::createDevice(SkBudgeted budgete
GrProtected isProtected,
GrSurfaceOrigin origin,
const SkSurfaceProps& props,
- skgpu::BaseDevice::InitContents init) {
+ skgpu::v1::Device::InitContents init) {
#if SK_GPU_V1
return skgpu::v1::Device::Make(this->context(), budgeted, ii, fit, sampleCount,
mipmapped, isProtected, origin, props, init);
@@ -67,8 +67,9 @@ sktext::gpu::SDFTControl GrRecordingContextPriv::getSDFTControl(bool useSDFTForS
this->options().fGlyphsAsPathsFontSize};
}
-std::unique_ptr<skgpu::SurfaceContext> GrRecordingContextPriv::makeSC(GrSurfaceProxyView readView,
- const GrColorInfo& info) {
+std::unique_ptr<skgpu::v1::SurfaceContext> GrRecordingContextPriv::makeSC(
+ GrSurfaceProxyView readView,
+ const GrColorInfo& info) {
#if SK_GPU_V1
// It is probably not necessary to check if the context is abandoned here since uses of the
// SurfaceContext which need the context will mostly likely fail later on w/o an issue.
@@ -80,7 +81,7 @@ std::unique_ptr<skgpu::SurfaceContext> GrRecordingContextPriv::makeSC(GrSurfaceP
GrSurfaceProxy* proxy = readView.proxy();
SkASSERT(proxy && proxy->asTextureProxy());
- std::unique_ptr<skgpu::SurfaceContext> sc;
+ std::unique_ptr<skgpu::v1::SurfaceContext> sc;
if (proxy->asRenderTargetProxy()) {
// Will we ever want a swizzle that is not the default write swizzle for the format and
// colorType here? If so we will need to manually pass that in.
@@ -105,9 +106,9 @@ std::unique_ptr<skgpu::SurfaceContext> GrRecordingContextPriv::makeSC(GrSurfaceP
info);
}
} else {
- sc = std::make_unique<skgpu::SurfaceContext>(this->context(),
- std::move(readView),
- info);
+ sc = std::make_unique<skgpu::v1::SurfaceContext>(this->context(),
+ std::move(readView),
+ info);
}
SkDEBUGCODE(sc->validate();)
return sc;
@@ -115,28 +116,30 @@ std::unique_ptr<skgpu::SurfaceContext> GrRecordingContextPriv::makeSC(GrSurfaceP
return nullptr;
}
-std::unique_ptr<skgpu::SurfaceContext> GrRecordingContextPriv::makeSC(const GrImageInfo& info,
- const GrBackendFormat& format,
- SkBackingFit fit,
- GrSurfaceOrigin origin,
- GrRenderable renderable,
- int sampleCount,
- GrMipmapped mipmapped,
- GrProtected isProtected,
- SkBudgeted budgeted) {
+std::unique_ptr<skgpu::v1::SurfaceContext> GrRecordingContextPriv::makeSC(
+ const GrImageInfo& info,
+ const GrBackendFormat& format,
+ SkBackingFit fit,
+ GrSurfaceOrigin origin,
+ GrRenderable renderable,
+ int sampleCount,
+ GrMipmapped mipmapped,
+ GrProtected isProtected,
+ SkBudgeted budgeted) {
SkASSERT(renderable == GrRenderable::kYes || sampleCount == 1);
if (this->abandoned()) {
return nullptr;
}
- sk_sp<GrTextureProxy> proxy = this->proxyProvider()->createProxy(format,
- info.dimensions(),
- renderable,
- sampleCount,
- mipmapped,
- fit,
- budgeted,
- isProtected,
- /*label=*/{});
+ sk_sp<GrTextureProxy> proxy =
+ this->proxyProvider()->createProxy(format,
+ info.dimensions(),
+ renderable,
+ sampleCount,
+ mipmapped,
+ fit,
+ budgeted,
+ isProtected,
+ /*label=*/"MakeSurfaceContext");
if (!proxy) {
return nullptr;
}
@@ -151,13 +154,14 @@ std::unique_ptr<skgpu::SurfaceContext> GrRecordingContextPriv::makeSC(const GrIm
return this->makeSC(std::move(view), info.colorInfo());
}
-std::unique_ptr<skgpu::SurfaceFillContext> GrRecordingContextPriv::makeSFC(GrImageInfo info,
- SkBackingFit fit,
- int sampleCount,
- GrMipmapped mipmapped,
- GrProtected isProtected,
- GrSurfaceOrigin origin,
- SkBudgeted budgeted) {
+std::unique_ptr<skgpu::v1::SurfaceFillContext> GrRecordingContextPriv::makeSFC(
+ GrImageInfo info,
+ SkBackingFit fit,
+ int sampleCount,
+ GrMipmapped mipmapped,
+ GrProtected isProtected,
+ GrSurfaceOrigin origin,
+ SkBudgeted budgeted) {
#if SK_GPU_V1
if (info.alphaType() == kPremul_SkAlphaType || info.alphaType() == kOpaque_SkAlphaType) {
@@ -167,6 +171,7 @@ std::unique_ptr<skgpu::SurfaceFillContext> GrRecordingContextPriv::makeSFC(GrIma
fit,
info.dimensions(),
SkSurfaceProps(),
+ /*label=*/"RecordingContextPriv_MakeSFC",
sampleCount,
mipmapped,
isProtected,
@@ -175,15 +180,16 @@ std::unique_ptr<skgpu::SurfaceFillContext> GrRecordingContextPriv::makeSFC(GrIma
}
GrBackendFormat format = this->caps()->getDefaultBackendFormat(info.colorType(),
GrRenderable::kYes);
- sk_sp<GrTextureProxy> proxy = this->proxyProvider()->createProxy(format,
- info.dimensions(),
- GrRenderable::kYes,
- sampleCount,
- mipmapped,
- fit,
- budgeted,
- isProtected,
- /*label=*/{});
+ sk_sp<GrTextureProxy> proxy =
+ this->proxyProvider()->createProxy(format,
+ info.dimensions(),
+ GrRenderable::kYes,
+ sampleCount,
+ mipmapped,
+ fit,
+ budgeted,
+ isProtected,
+ /*label=*/"MakeSurfaceFillContextUsingImageInfo");
if (!proxy) {
return nullptr;
}
@@ -192,7 +198,7 @@ std::unique_ptr<skgpu::SurfaceFillContext> GrRecordingContextPriv::makeSFC(GrIma
GrSurfaceProxyView readView( proxy, origin, readSwizzle);
GrSurfaceProxyView writeView(std::move(proxy), origin, writeSwizzle);
- std::unique_ptr<skgpu::SurfaceFillContext> sfc;
+ std::unique_ptr<skgpu::v1::SurfaceFillContext> sfc;
sfc = std::make_unique<skgpu::v1::SurfaceFillContext>(this->context(),
std::move(readView),
std::move(writeView),
@@ -204,7 +210,7 @@ std::unique_ptr<skgpu::SurfaceFillContext> GrRecordingContextPriv::makeSFC(GrIma
return nullptr;
}
-std::unique_ptr<skgpu::SurfaceFillContext> GrRecordingContextPriv::makeSFC(
+std::unique_ptr<skgpu::v1::SurfaceFillContext> GrRecordingContextPriv::makeSFC(
SkAlphaType alphaType,
sk_sp<SkColorSpace> colorSpace,
SkISize dimensions,
@@ -223,37 +229,40 @@ std::unique_ptr<skgpu::SurfaceFillContext> GrRecordingContextPriv::makeSFC(
SkASSERT(sampleCount >= 1);
SkASSERT(format.isValid() && format.backend() == fContext->backend());
if (alphaType == kPremul_SkAlphaType || alphaType == kOpaque_SkAlphaType) {
- return skgpu::v1::SurfaceDrawContext::Make(this->context(),
- std::move(colorSpace),
- fit,
- dimensions,
- format,
- sampleCount,
- mipmapped,
- isProtected,
- readSwizzle,
- writeSwizzle,
- origin,
- budgeted,
- SkSurfaceProps());
+ return skgpu::v1::SurfaceDrawContext::Make(
+ this->context(),
+ std::move(colorSpace),
+ fit,
+ dimensions,
+ format,
+ sampleCount,
+ mipmapped,
+ isProtected,
+ readSwizzle,
+ writeSwizzle,
+ origin,
+ budgeted,
+ SkSurfaceProps(),
+ /*label=*/"MakeCustomConfiguredSurfaceFillContextUsingCustomSwizzles");
}
- sk_sp<GrTextureProxy> proxy = this->proxyProvider()->createProxy(format,
- dimensions,
- GrRenderable::kYes,
- sampleCount,
- mipmapped,
- fit,
- budgeted,
- isProtected,
- /*label=*/{});
+ sk_sp<GrTextureProxy> proxy =
+ this->proxyProvider()->createProxy(format,
+ dimensions,
+ GrRenderable::kYes,
+ sampleCount,
+ mipmapped,
+ fit,
+ budgeted,
+ isProtected,
+ /*label=*/"MakeCustomConfiguredSurfaceFillContext");
if (!proxy) {
return nullptr;
}
GrImageInfo info(GrColorType::kUnknown, alphaType, std::move(colorSpace), dimensions);
GrSurfaceProxyView readView( proxy, origin, readSwizzle);
GrSurfaceProxyView writeView(std::move(proxy), origin, writeSwizzle);
- std::unique_ptr<skgpu::SurfaceFillContext> sfc;
+ std::unique_ptr<skgpu::v1::SurfaceFillContext> sfc;
sfc = std::make_unique<skgpu::v1::SurfaceFillContext>(this->context(),
std::move(readView),
std::move(writeView),
@@ -265,7 +274,7 @@ std::unique_ptr<skgpu::SurfaceFillContext> GrRecordingContextPriv::makeSFC(
return nullptr;
}
-std::unique_ptr<skgpu::SurfaceFillContext> GrRecordingContextPriv::makeSFCWithFallback(
+std::unique_ptr<skgpu::v1::SurfaceFillContext> GrRecordingContextPriv::makeSFCWithFallback(
GrImageInfo info,
SkBackingFit fit,
int sampleCount,
@@ -307,7 +316,7 @@ std::unique_ptr<skgpu::SurfaceFillContext> GrRecordingContextPriv::makeSFCWithFa
return nullptr;
}
-std::unique_ptr<skgpu::SurfaceFillContext> GrRecordingContextPriv::makeSFCFromBackendTexture(
+std::unique_ptr<skgpu::v1::SurfaceFillContext> GrRecordingContextPriv::makeSFCFromBackendTexture(
GrColorInfo info,
const GrBackendTexture& tex,
int sampleCount,
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrRecordingContextPriv.h b/chromium/third_party/skia/src/gpu/ganesh/GrRecordingContextPriv.h
index cf4f26413d5..2af828ef2c3 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrRecordingContextPriv.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrRecordingContextPriv.h
@@ -11,16 +11,18 @@
#include "include/core/SkPaint.h"
#include "include/gpu/GrRecordingContext.h"
#include "src/gpu/RefCntedCallback.h"
-#include "src/gpu/ganesh/BaseDevice.h"
+#include "src/gpu/ganesh/Device_v1.h"
#include "src/gpu/ganesh/GrImageContextPriv.h"
#include "src/text/gpu/SDFTControl.h"
class GrImageInfo;
class SkDeferredDisplayList;
namespace skgpu {
+ class Swizzle;
+}
+namespace skgpu::v1 {
class SurfaceContext;
class SurfaceFillContext;
- class Swizzle;
}
/** Class that exposes methods on GrRecordingContext that are only intended for use internal to
@@ -115,13 +117,13 @@ public:
*/
static sk_sp<GrRecordingContext> MakeDDL(sk_sp<GrContextThreadSafeProxy>);
- sk_sp<skgpu::BaseDevice> createDevice(GrColorType,
+ sk_sp<skgpu::v1::Device> createDevice(GrColorType,
sk_sp<GrSurfaceProxy>,
sk_sp<SkColorSpace>,
GrSurfaceOrigin,
const SkSurfaceProps&,
- skgpu::BaseDevice::InitContents);
- sk_sp<skgpu::BaseDevice> createDevice(SkBudgeted,
+ skgpu::v1::Device::InitContents);
+ sk_sp<skgpu::v1::Device> createDevice(SkBudgeted,
const SkImageInfo&,
SkBackingFit,
int sampleCount,
@@ -129,30 +131,30 @@ public:
GrProtected,
GrSurfaceOrigin,
const SkSurfaceProps&,
- skgpu::BaseDevice::InitContents);
+ skgpu::v1::Device::InitContents);
// If the passed in GrSurfaceProxy is renderable this will return a SurfaceDrawContext,
// otherwise it will return a SurfaceContext.
- std::unique_ptr<skgpu::SurfaceContext> makeSC(GrSurfaceProxyView readView,
- const GrColorInfo&);
+ std::unique_ptr<skgpu::v1::SurfaceContext> makeSC(GrSurfaceProxyView readView,
+ const GrColorInfo&);
// Makes either a SurfaceContext, SurfaceFillContext, or a SurfaceDrawContext, depending on
// GrRenderable and the GrImageInfo.
- std::unique_ptr<skgpu::SurfaceContext> makeSC(const GrImageInfo&,
- const GrBackendFormat&,
- SkBackingFit = SkBackingFit::kExact,
- GrSurfaceOrigin = kTopLeft_GrSurfaceOrigin,
- GrRenderable = GrRenderable::kNo,
- int renderTargetSampleCnt = 1,
- GrMipmapped = GrMipmapped::kNo,
- GrProtected = GrProtected::kNo,
- SkBudgeted = SkBudgeted::kYes);
+ std::unique_ptr<skgpu::v1::SurfaceContext> makeSC(const GrImageInfo&,
+ const GrBackendFormat&,
+ SkBackingFit = SkBackingFit::kExact,
+ GrSurfaceOrigin = kTopLeft_GrSurfaceOrigin,
+ GrRenderable = GrRenderable::kNo,
+ int renderTargetSampleCnt = 1,
+ GrMipmapped = GrMipmapped::kNo,
+ GrProtected = GrProtected::kNo,
+ SkBudgeted = SkBudgeted::kYes);
/**
* Uses GrImageInfo's color type to pick the default texture format. Will return a
* SurfaceDrawContext if possible.
*/
- std::unique_ptr<skgpu::SurfaceFillContext> makeSFC(
+ std::unique_ptr<skgpu::v1::SurfaceFillContext> makeSFC(
GrImageInfo,
SkBackingFit = SkBackingFit::kExact,
int sampleCount = 1,
@@ -166,24 +168,24 @@ public:
* texture format and swizzles. The color type will be kUnknown. Returns a SurfaceDrawContext
* if possible.
*/
- std::unique_ptr<skgpu::SurfaceFillContext> makeSFC(SkAlphaType,
- sk_sp<SkColorSpace>,
- SkISize dimensions,
- SkBackingFit,
- const GrBackendFormat&,
- int sampleCount,
- GrMipmapped,
- GrProtected,
- skgpu::Swizzle readSwizzle,
- skgpu::Swizzle writeSwizzle,
- GrSurfaceOrigin,
- SkBudgeted);
+ std::unique_ptr<skgpu::v1::SurfaceFillContext> makeSFC(SkAlphaType,
+ sk_sp<SkColorSpace>,
+ SkISize dimensions,
+ SkBackingFit,
+ const GrBackendFormat&,
+ int sampleCount,
+ GrMipmapped,
+ GrProtected,
+ skgpu::Swizzle readSwizzle,
+ skgpu::Swizzle writeSwizzle,
+ GrSurfaceOrigin,
+ SkBudgeted);
/**
* Like the above but uses GetFallbackColorTypeAndFormat to find a fallback color type (and
* compatible format) if the passed GrImageInfo's color type is not renderable.
*/
- std::unique_ptr<skgpu::SurfaceFillContext> makeSFCWithFallback(
+ std::unique_ptr<skgpu::v1::SurfaceFillContext> makeSFCWithFallback(
GrImageInfo,
SkBackingFit = SkBackingFit::kExact,
int sampleCount = 1,
@@ -197,7 +199,7 @@ public:
* type must be compatible with backend texture's format or this will fail. All formats are
* considered compatible with kUnknown. Returns a SurfaceDrawContext if possible.
*/
- std::unique_ptr<skgpu::SurfaceFillContext> makeSFCFromBackendTexture(
+ std::unique_ptr<skgpu::v1::SurfaceFillContext> makeSFCFromBackendTexture(
GrColorInfo,
const GrBackendTexture&,
int sampleCount,
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrRenderTargetContext.h b/chromium/third_party/skia/src/gpu/ganesh/GrRenderTargetContext.h
index ac224915ad7..4f0c4066e46 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrRenderTargetContext.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrRenderTargetContext.h
@@ -12,7 +12,7 @@
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
// Android Framework is relying on this header existing and the old name
// of skgpu::v1::SurfaceDrawContext.
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrRenderTask.h b/chromium/third_party/skia/src/gpu/ganesh/GrRenderTask.h
index cc7fcdee603..a8ff867bd53 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrRenderTask.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrRenderTask.h
@@ -65,6 +65,9 @@ public:
bool isSkippable() const { return this->isSetFlag(kSkippable_Flag); }
+ /** If true no other task should be reordered relative to this task. */
+ bool blocksReordering() const { return this->isSetFlag(kBlocksReordering_Flag); }
+
/*
* Notify this GrRenderTask that it relies on the contents of 'dependedOn'
*/
@@ -77,8 +80,8 @@ public:
*/
void addDependenciesFromOtherTask(GrRenderTask* otherTask);
- SkSpan<GrRenderTask*> dependencies() { return SkMakeSpan(fDependencies); }
- SkSpan<GrRenderTask*> dependents() { return SkMakeSpan(fDependents); }
+ SkSpan<GrRenderTask*> dependencies() { return SkSpan(fDependencies); }
+ SkSpan<GrRenderTask*> dependents() { return SkSpan(fDependents); }
void replaceDependency(const GrRenderTask* toReplace, GrRenderTask* replaceWith);
void replaceDependent(const GrRenderTask* toReplace, GrRenderTask* replaceWith);
@@ -174,13 +177,14 @@ protected:
SkTArray<GrTextureProxy*, true> fDeferredProxies;
enum Flags {
- kClosed_Flag = 0x01, //!< This task can't accept any more dependencies.
- kDisowned_Flag = 0x02, //!< This task is disowned by its creating GrDrawingManager.
- kSkippable_Flag = 0x04, //!< This task is skippable.
- kAtlas_Flag = 0x08, //!< This task is atlas.
-
- kWasOutput_Flag = 0x10, //!< Flag for topological sorting
- kTempMark_Flag = 0x20, //!< Flag for topological sorting
+ kClosed_Flag = 0x01, //!< This task can't accept any more dependencies.
+ kDisowned_Flag = 0x02, //!< This task is disowned by its GrDrawingManager.
+ kSkippable_Flag = 0x04, //!< This task is skippable.
+ kAtlas_Flag = 0x08, //!< This task is atlas.
+ kBlocksReordering_Flag = 0x10, //!< No task can be reordered with respect to this task.
+
+ kWasOutput_Flag = 0x20, //!< Flag for topological sorting
+ kTempMark_Flag = 0x40, //!< Flag for topological sorting
};
void setFlag(uint32_t flag) {
@@ -197,13 +201,13 @@ protected:
void setIndex(uint32_t index) {
SkASSERT(!this->isSetFlag(kWasOutput_Flag));
- SkASSERT(index < (1 << 26));
- fFlags |= index << 6;
+ SkASSERT(index < (1 << 25));
+ fFlags |= index << 7;
}
uint32_t getIndex() const {
SkASSERT(this->isSetFlag(kWasOutput_Flag));
- return fFlags >> 6;
+ return fFlags >> 7;
}
private:
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrRenderTaskCluster.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrRenderTaskCluster.cpp
index 1f2c842b3c4..250d36558a7 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrRenderTaskCluster.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrRenderTaskCluster.cpp
@@ -159,6 +159,9 @@ bool GrClusterRenderTasks(SkSpan<const sk_sp<GrRenderTask>> input,
SkASSERT(llist->isEmpty());
if (input.size() < 3) {
+ for (const auto& t : input) {
+ llist->addToTail(t.get());
+ }
return false;
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrRenderTaskCluster.h b/chromium/third_party/skia/src/gpu/ganesh/GrRenderTaskCluster.h
index 81ebf8c016f..308e611c7de 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrRenderTaskCluster.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrRenderTaskCluster.h
@@ -17,7 +17,8 @@ class GrRenderTask;
// Take a topologically-sorted DAG and cluster the tasks together while maintaining the
// dependencies.
//
-// If no clustering is possible, returns false.
+// If no clustering is possible the llist is populated with the nodes in the original order and
+// false is returned.
// Otherwise, returns true and populates the provided llist as such:
// - Contains the same set of tasks as `input`.
// - Obeys the dependency rules in `input`.
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrResourceProvider.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrResourceProvider.cpp
index 1944730018b..dee178d1b01 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrResourceProvider.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrResourceProvider.cpp
@@ -489,7 +489,7 @@ sk_sp<const GrGpuBuffer> GrResourceProvider::findOrMakeStaticBuffer(
if (buffer->isMapped()) {
buffer->unmap();
} else {
- buffer->updateData(stagingBuffer, size);
+ buffer->updateData(stagingBuffer, /*offset=*/0, size, /*preserve=*/false);
}
return std::move(buffer);
@@ -522,7 +522,7 @@ sk_sp<const GrGpuBuffer> GrResourceProvider::createPatternedIndexBuffer(
}
}
if (temp.get()) {
- if (!buffer->updateData(data, bufferSize)) {
+ if (!buffer->updateData(data, /*offset=*/0, bufferSize, /*preserve=*/false)) {
return nullptr;
}
} else {
@@ -547,7 +547,7 @@ sk_sp<const GrGpuBuffer> GrResourceProvider::createNonAAQuadIndexBuffer() {
0, 1, 2, 2, 1, 3
};
- static_assert(SK_ARRAY_COUNT(kNonAAQuadIndexPattern) == kIndicesPerNonAAQuad);
+ static_assert(std::size(kNonAAQuadIndexPattern) == kIndicesPerNonAAQuad);
return this->createPatternedIndexBuffer(kNonAAQuadIndexPattern, kIndicesPerNonAAQuad,
kMaxNumNonAAQuads, kVertsPerNonAAQuad, nullptr);
@@ -575,7 +575,7 @@ sk_sp<const GrGpuBuffer> GrResourceProvider::createAAQuadIndexBuffer() {
};
// clang-format on
- static_assert(SK_ARRAY_COUNT(kAAQuadIndexPattern) == kIndicesPerAAQuad);
+ static_assert(std::size(kAAQuadIndexPattern) == kIndicesPerAAQuad);
return this->createPatternedIndexBuffer(kAAQuadIndexPattern, kIndicesPerAAQuad,
kMaxNumAAQuads, kVertsPerAAQuad, nullptr);
@@ -617,6 +617,21 @@ sk_sp<GrGpuBuffer> GrResourceProvider::createBuffer(size_t size,
return buffer;
}
+sk_sp<GrGpuBuffer> GrResourceProvider::createBuffer(const void* data,
+ size_t size,
+ GrGpuBufferType type,
+ GrAccessPattern pattern) {
+ SkASSERT(data);
+ auto buffer = this->createBuffer(size, type, pattern);
+ if (!buffer) {
+ return nullptr;
+ }
+ if (!buffer->updateData(data, /*offset=*/0, size, /*preserve=*/false)) {
+ return nullptr;
+ }
+ return buffer;
+}
+
static int num_stencil_samples(const GrRenderTarget* rt, bool useMSAASurface, const GrCaps& caps) {
int numSamples = rt->numSamples();
if (numSamples == 1 && useMSAASurface) { // Are we using dynamic msaa?
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrResourceProvider.h b/chromium/third_party/skia/src/gpu/ganesh/GrResourceProvider.h
index f825950e1d1..a67c80e201a 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrResourceProvider.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrResourceProvider.h
@@ -298,11 +298,7 @@ public:
sk_sp<GrGpuBuffer> createBuffer(const void* data,
size_t size,
GrGpuBufferType type,
- GrAccessPattern pattern) {
- SkASSERT(data);
- auto buffer = this->createBuffer(size, type, pattern);
- return buffer && buffer->updateData(data, size) ? buffer : nullptr;
- }
+ GrAccessPattern pattern);
/**
* If passed in render target already has a stencil buffer on the specified surface, return
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrShaderCaps.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrShaderCaps.cpp
index 150c80e2de4..95d3081ade4 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrShaderCaps.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrShaderCaps.cpp
@@ -33,7 +33,7 @@ void GrShaderCaps::dumpJSON(SkJSONWriter* writer) const {
static_assert(0 == kNotSupported_AdvBlendEqInteraction);
static_assert(1 == kAutomatic_AdvBlendEqInteraction);
static_assert(2 == kGeneralEnable_AdvBlendEqInteraction);
- static_assert(SK_ARRAY_COUNT(kAdvBlendEqInteractionStr) == kLast_AdvBlendEqInteraction + 1);
+ static_assert(std::size(kAdvBlendEqInteractionStr) == kLast_AdvBlendEqInteraction + 1);
writer->appendBool("FB Fetch Support", fFBFetchSupport);
writer->appendBool("Uses precision modifiers", fUsesPrecisionModifiers);
@@ -78,8 +78,8 @@ void GrShaderCaps::dumpJSON(SkJSONWriter* writer) const {
writer->appendBool("Use node pools", fUseNodePools);
writer->appendS32("Max FS Samplers", fMaxFragmentSamplers);
- writer->appendString("Advanced blend equation interaction",
- kAdvBlendEqInteractionStr[fAdvBlendEqInteraction]);
+ writer->appendCString("Advanced blend equation interaction",
+ kAdvBlendEqInteractionStr[fAdvBlendEqInteraction]);
writer->endObject();
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrShaderCaps.h b/chromium/third_party/skia/src/gpu/ganesh/GrShaderCaps.h
index b8100c0d27e..a46dfcbab62 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrShaderCaps.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrShaderCaps.h
@@ -9,7 +9,6 @@
#define GrShaderCaps_DEFINED
#include "include/core/SkRefCnt.h"
-#include "src/gpu/ganesh/glsl/GrGLSL.h"
#include "src/sksl/SkSLUtil.h"
struct GrContextOptions;
@@ -20,8 +19,6 @@ struct GrShaderCaps : SkSL::ShaderCaps {
void dumpJSON(SkJSONWriter*) const;
- bool supportsDistanceFieldText() const { return fShaderDerivativeSupport; }
-
const char* noperspectiveInterpolationExtensionString() const {
SkASSERT(this->fNoPerspectiveInterpolationSupport);
return fNoPerspectiveInterpolationExtensionString;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrShaderVar.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrShaderVar.cpp
index a22c1731ebc..5420f659f59 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrShaderVar.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrShaderVar.cpp
@@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
-
+#include "src/core/SkSLTypeShared.h"
#include "src/gpu/ganesh/GrShaderCaps.h"
#include "src/gpu/ganesh/GrShaderVar.h"
@@ -34,10 +34,10 @@ void GrShaderVar::appendDecl(const GrShaderCaps* shaderCaps, SkString* out) cons
if (this->isArray()) {
SkASSERT(this->getArrayCount() > 0);
out->appendf("%s %s[%d]",
- GrGLSLTypeString(effectiveType),
+ SkSLTypeString(effectiveType),
this->getName().c_str(),
this->getArrayCount());
} else {
- out->appendf("%s %s", GrGLSLTypeString(effectiveType), this->getName().c_str());
+ out->appendf("%s %s", SkSLTypeString(effectiveType), this->getName().c_str());
}
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrSurfaceProxy.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrSurfaceProxy.cpp
index 5e675f5b531..ab49e1af90c 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrSurfaceProxy.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrSurfaceProxy.cpp
@@ -269,6 +269,7 @@ sk_sp<GrSurfaceProxy> GrSurfaceProxy::Copy(GrRecordingContext* rContext,
SkIRect srcRect,
SkBackingFit fit,
SkBudgeted budgeted,
+ std::string_view label,
RectsMustMatch rectsMustMatch,
sk_sp<GrRenderTask>* outTask) {
SkASSERT(!src->isFullyLazy());
@@ -342,6 +343,7 @@ sk_sp<GrSurfaceProxy> GrSurfaceProxy::Copy(GrRecordingContext* context,
GrMipmapped mipmapped,
SkBackingFit fit,
SkBudgeted budgeted,
+ std::string_view label,
sk_sp<GrRenderTask>* outTask) {
SkASSERT(!src->isFullyLazy());
auto rect = SkIRect::MakeSize(src->dimensions());
@@ -352,6 +354,7 @@ sk_sp<GrSurfaceProxy> GrSurfaceProxy::Copy(GrRecordingContext* context,
rect,
fit,
budgeted,
+ label,
RectsMustMatch::kNo,
outTask);
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrSurfaceProxy.h b/chromium/third_party/skia/src/gpu/ganesh/GrSurfaceProxy.h
index dca406b4242..4ac5b464f5a 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrSurfaceProxy.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrSurfaceProxy.h
@@ -325,6 +325,7 @@ public:
SkIRect srcRect,
SkBackingFit,
SkBudgeted,
+ std::string_view label,
RectsMustMatch = RectsMustMatch::kNo,
sk_sp<GrRenderTask>* outTask = nullptr);
@@ -335,6 +336,7 @@ public:
GrMipmapped,
SkBackingFit,
SkBudgeted,
+ std::string_view label,
sk_sp<GrRenderTask>* outTask = nullptr);
#if GR_TEST_UTILS
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrSurfaceProxyView.h b/chromium/third_party/skia/src/gpu/ganesh/GrSurfaceProxyView.h
index 2d761533541..933e65068e3 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrSurfaceProxyView.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrSurfaceProxyView.h
@@ -102,14 +102,16 @@ public:
GrMipmapped mipmapped,
SkIRect srcRect,
SkBackingFit fit,
- SkBudgeted budgeted) {
+ SkBudgeted budgeted,
+ std::string_view label) {
auto copy = GrSurfaceProxy::Copy(context,
src.refProxy(),
src.origin(),
mipmapped,
srcRect,
fit,
- budgeted);
+ budgeted,
+ label);
return {std::move(copy), src.origin(), src.swizzle()};
}
@@ -117,13 +119,15 @@ public:
GrSurfaceProxyView src,
GrMipmapped mipmapped,
SkBackingFit fit,
- SkBudgeted budgeted) {
+ SkBudgeted budgeted,
+ std::string_view label) {
auto copy = GrSurfaceProxy::Copy(rContext,
src.refProxy(),
src.origin(),
mipmapped,
fit,
- budgeted);
+ budgeted,
+ label);
return {std::move(copy), src.origin(), src.swizzle()};
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrTTopoSort.h b/chromium/third_party/skia/src/gpu/ganesh/GrTTopoSort.h
index 685c8fd6d41..52a83c59e10 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrTTopoSort.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrTTopoSort.h
@@ -9,23 +9,23 @@
#define GrTTopoSort_DEFINED
#include "include/core/SkRefCnt.h"
-#include "include/private/SkTArray.h"
+#include "include/core/SkSpan.h"
#ifdef SK_DEBUG
template <typename T, typename Traits = T>
-void GrTTopoSort_CheckAllUnmarked(const SkTArray<sk_sp<T>>& graph) {
- for (int i = 0; i < graph.count(); ++i) {
- SkASSERT(!Traits::IsTempMarked(graph[i].get()));
- SkASSERT(!Traits::WasOutput(graph[i].get()));
+void GrTTopoSort_CheckAllUnmarked(SkSpan<const sk_sp<T>> graph) {
+ for (const auto& node : graph) {
+ SkASSERT(!Traits::IsTempMarked(node.get()));
+ SkASSERT(!Traits::WasOutput(node.get()));
}
}
template <typename T, typename Traits = T>
-void GrTTopoSort_CleanExit(const SkTArray<sk_sp<T>>& graph) {
- for (int i = 0; i < graph.count(); ++i) {
+void GrTTopoSort_CleanExit(SkSpan<const sk_sp<T>> graph, uint32_t offset) {
+ for (size_t i = 0; i < graph.size(); ++i) {
SkASSERT(!Traits::IsTempMarked(graph[i].get()));
SkASSERT(Traits::WasOutput(graph[i].get()));
- SkASSERT(Traits::GetIndex(graph[i].get()) == (uint32_t) i);
+ SkASSERT(Traits::GetIndex(graph[i].get()) - offset == (uint32_t) i);
}
}
#endif
@@ -39,29 +39,33 @@ bool GrTTopoSort_Visit(T* node, uint32_t* counter) {
return false;
}
- bool succeeded = true;
-
// If the node under consideration has been already been output it means it
// (and all the nodes it depends on) are already in 'result'.
- if (!Traits::WasOutput(node)) {
- // This node hasn't been output yet. Recursively assess all the
- // nodes it depends on outputing them first.
- Traits::SetTempMark(node);
- for (int i = 0; i < Traits::NumDependencies(node); ++i) {
- if (!GrTTopoSort_Visit<T, Traits>(Traits::Dependency(node, i), counter)) {
- succeeded = false;
- }
+ if (Traits::WasOutput(node)) {
+ return true;
+ }
+
+ bool succeeded = true;
+ // This node hasn't been output yet. Recursively assess all the
+ // nodes it depends on outputing them first.
+ Traits::SetTempMark(node);
+ for (int i = 0; i < Traits::NumDependencies(node); ++i) {
+ if (!GrTTopoSort_Visit<T, Traits>(Traits::Dependency(node, i), counter)) {
+ succeeded = false;
}
- Traits::Output(node, *counter); // mark this node as output
- ++(*counter);
- Traits::ResetTempMark(node);
}
+ Traits::Output(node, *counter); // mark this node as output
+ ++(*counter);
+ Traits::ResetTempMark(node);
+
return succeeded;
}
// Topologically sort the nodes in 'graph'. For this sort, when node 'i' depends
-// on node 'j' it means node 'j' must appear in the result before node 'i'.
+// on node 'j' it means node 'j' must appear in the result before node 'i'. Note that all
+// dependencies of a node in the Span must also be in the Span or already have WasOutput() = true.
+//
// A false return value means there was a loop and the contents of 'graph' will
// be in some arbitrary state.
//
@@ -78,45 +82,48 @@ bool GrTTopoSort_Visit(T* node, uint32_t* counter) {
// static T* Dependency(T* t, int index) { ... } // nodes on which it depends
// We'll look on T for these by default, or you can pass a custom Traits type.
//
+// The offset parameter is useful if you are sorting ranges of a larger graph and when Output()
+// is called on a T it must know it's position in the full graph array.
+//
// TODO: potentially add a version that takes a seed node and just outputs that
// node and all the nodes on which it depends. This could be used to partially
// flush a GrRenderTask DAG.
template <typename T, typename Traits = T>
-bool GrTTopoSort(SkTArray<sk_sp<T>>* graph) {
- uint32_t counter = 0;
+bool GrTTopoSort(SkSpan<sk_sp<T>> graph, uint32_t offset = 0) {
+ uint32_t counter = offset;
#ifdef SK_DEBUG
- GrTTopoSort_CheckAllUnmarked<T, Traits>(*graph);
+ GrTTopoSort_CheckAllUnmarked<T, Traits>(graph);
#endif
bool succeeded = true;
- for (int i = 0; i < graph->count(); ++i) {
- if (Traits::WasOutput((*graph)[i].get())) {
+ for (size_t i = 0; i < graph.size(); ++i) {
+ if (Traits::WasOutput(graph[i].get())) {
// This node was depended on by some earlier node and has already
// been output
continue;
}
// Output this node after all the nodes it depends on have been output.
- if (!GrTTopoSort_Visit<T, Traits>((*graph)[i].get(), &counter)) {
+ if (!GrTTopoSort_Visit<T, Traits>(graph[i].get(), &counter)) {
succeeded = false;
}
}
- SkASSERT(counter == (uint32_t) graph->count());
+ SkASSERT(counter - offset == (uint32_t) graph.size());
// Reorder the array given the output order
- for (uint32_t i = 0; i < (uint32_t) graph->count(); ++i) {
- for (uint32_t correctIndex = Traits::GetIndex((*graph)[i].get());
+ for (uint32_t i = 0; i < (uint32_t) graph.size(); ++i) {
+ for (uint32_t correctIndex = Traits::GetIndex(graph[i].get()) - offset;
correctIndex != i;
- correctIndex = Traits::GetIndex((*graph)[i].get())) {
- (*graph)[i].swap((*graph)[correctIndex]);
+ correctIndex = Traits::GetIndex(graph[i].get()) - offset) {
+ graph[i].swap(graph[correctIndex]);
}
}
#ifdef SK_DEBUG
- GrTTopoSort_CleanExit<T, Traits>(*graph);
+ GrTTopoSort_CleanExit<T, Traits>(graph, offset);
#endif
return succeeded;
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrTestUtils.cpp b/chromium/third_party/skia/src/gpu/ganesh/GrTestUtils.cpp
index a22d92656ea..184349d7d22 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrTestUtils.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrTestUtils.cpp
@@ -40,7 +40,7 @@ static const SkMatrix& test_matrix(SkRandom* random,
gMatrices[4].set(SkMatrix::kMPersp1, -0.000039f);
}
- uint32_t count = static_cast<uint32_t>(SK_ARRAY_COUNT(gMatrices));
+ uint32_t count = static_cast<uint32_t>(std::size(gMatrices));
if (includeNonPerspective && includePerspective) {
return gMatrices[random->nextULessThan(count)];
} else if (!includeNonPerspective) {
@@ -73,11 +73,11 @@ const SkMatrix& TestMatrixPreservesRightAngles(SkRandom* random) {
gMatrices[4].setScale(SkIntToScalar(-1), SkIntToScalar(-1));
gMatrices[4].setRotate(47);
- for (size_t i = 0; i < SK_ARRAY_COUNT(gMatrices); i++) {
+ for (size_t i = 0; i < std::size(gMatrices); i++) {
SkASSERT(gMatrices[i].preservesRightAngles());
}
}
- return gMatrices[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gMatrices)))];
+ return gMatrices[random->nextULessThan(static_cast<uint32_t>(std::size(gMatrices)))];
}
const SkMatrix& TestMatrixRectStaysRect(SkRandom* random) {
@@ -99,11 +99,11 @@ const SkMatrix& TestMatrixRectStaysRect(SkRandom* random) {
// 90 degress rotation
gMatrices[5].setRotate(90);
- for (size_t i = 0; i < SK_ARRAY_COUNT(gMatrices); i++) {
+ for (size_t i = 0; i < std::size(gMatrices); i++) {
SkASSERT(gMatrices[i].rectStaysRect());
}
}
- return gMatrices[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gMatrices)))];
+ return gMatrices[random->nextULessThan(static_cast<uint32_t>(std::size(gMatrices)))];
}
const SkMatrix& TestMatrixInvertible(SkRandom* random) { return test_matrix(random, true, false); }
@@ -115,8 +115,8 @@ void TestWrapModes(SkRandom* random, GrSamplerState::WrapMode wrapModes[2]) {
GrSamplerState::WrapMode::kRepeat,
GrSamplerState::WrapMode::kMirrorRepeat,
};
- wrapModes[0] = kWrapModes[random->nextULessThan(SK_ARRAY_COUNT(kWrapModes))];
- wrapModes[1] = kWrapModes[random->nextULessThan(SK_ARRAY_COUNT(kWrapModes))];
+ wrapModes[0] = kWrapModes[random->nextULessThan(std::size(kWrapModes))];
+ wrapModes[1] = kWrapModes[random->nextULessThan(std::size(kWrapModes))];
}
const SkRect& TestRect(SkRandom* random) {
static SkRect gRects[7];
@@ -130,7 +130,7 @@ const SkRect& TestRect(SkRandom* random) {
gRects[4] = SkRect::MakeLTRB(-65535.0f, -65535.0f, 65535.0f, 65535.0f);
gRects[5] = SkRect::MakeLTRB(-10.0f, -10.0f, 10.0f, 10.0f);
}
- return gRects[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gRects)))];
+ return gRects[random->nextULessThan(static_cast<uint32_t>(std::size(gRects)))];
}
// Just some simple rects for code which expects its input very sanitized
@@ -142,7 +142,7 @@ const SkRect& TestSquare(SkRandom* random) {
gRects[0] = SkRect::MakeWH(128.f, 128.f);
gRects[1] = SkRect::MakeWH(256.0f, 256.0f);
}
- return gRects[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gRects)))];
+ return gRects[random->nextULessThan(static_cast<uint32_t>(std::size(gRects)))];
}
const SkRRect& TestRRectSimple(SkRandom* random) {
@@ -156,11 +156,11 @@ const SkRRect& TestRRectSimple(SkRandom* random) {
// true round rect with elliptical corners
gRRect[1].setRectXY(rectangle, 2.0f, 1.0f);
- for (size_t i = 0; i < SK_ARRAY_COUNT(gRRect); i++) {
+ for (size_t i = 0; i < std::size(gRRect); i++) {
SkASSERT(gRRect[i].isSimple());
}
}
- return gRRect[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gRRect)))];
+ return gRRect[random->nextULessThan(static_cast<uint32_t>(std::size(gRRect)))];
}
const SkPath& TestPath(SkRandom* random) {
@@ -208,7 +208,7 @@ const SkPath& TestPath(SkRandom* random) {
.detach();
}
- return gPath[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gPath)))];
+ return gPath[random->nextULessThan(static_cast<uint32_t>(std::size(gPath)))];
}
const SkPath& TestPathConvex(SkRandom* random) {
@@ -237,12 +237,12 @@ const SkPath& TestPathConvex(SkRandom* random) {
{-40.0f, 50.0f},
{-50.0f, 31.0f}}, false);
- for (size_t i = 0; i < SK_ARRAY_COUNT(gPath); i++) {
+ for (size_t i = 0; i < std::size(gPath); i++) {
SkASSERT(gPath[i].isConvex());
}
}
- return gPath[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gPath)))];
+ return gPath[random->nextULessThan(static_cast<uint32_t>(std::size(gPath)))];
}
static void randomize_stroke_rec(SkStrokeRec* rec, SkRandom* random) {
@@ -321,7 +321,7 @@ sk_sp<SkColorSpace> TestColorSpace(SkRandom* random) {
gColorSpaces[1] = SkColorSpace::MakeSRGB();
gColorSpaces[2] = SkColorSpace::MakeSRGB()->makeColorSpin();
}
- return gColorSpaces[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gColorSpaces)))];
+ return gColorSpaces[random->nextULessThan(static_cast<uint32_t>(std::size(gColorSpaces)))];
}
sk_sp<GrColorSpaceXform> TestColorXform(SkRandom* random) {
@@ -339,7 +339,7 @@ sk_sp<GrColorSpaceXform> TestColorXform(SkRandom* random) {
gXforms[2] = GrColorSpaceXform::Make(spin.get(), kPremul_SkAlphaType,
srgb.get(), kPremul_SkAlphaType);
}
- return gXforms[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gXforms)))];
+ return gXforms[random->nextULessThan(static_cast<uint32_t>(std::size(gXforms)))];
}
TestAsFPArgs::TestAsFPArgs(GrProcessorTestData* d)
@@ -348,7 +348,8 @@ TestAsFPArgs::TestAsFPArgs(GrProcessorTestData* d)
GrColorType::kRGBA_8888, kPremul_SkAlphaType, TestColorSpace(d->fRandom)))
, fArgs(d->context(),
fMatrixProvider,
- fColorInfoStorage.get()) {}
+ fColorInfoStorage.get(),
+ fSurfaceProps) {}
TestAsFPArgs::~TestAsFPArgs() {}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/GrTestUtils.h b/chromium/third_party/skia/src/gpu/ganesh/GrTestUtils.h
index bb18cae6033..c4a54dddad7 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/GrTestUtils.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/GrTestUtils.h
@@ -13,6 +13,7 @@
#if GR_TEST_UTILS
#include "include/core/SkStrokeRec.h"
+#include "include/core/SkSurfaceProps.h"
#include "include/private/SkMacros.h"
#include "include/private/SkTemplates.h"
#include "include/utils/SkRandom.h"
@@ -65,6 +66,7 @@ public:
private:
SkMatrixProvider fMatrixProvider;
std::unique_ptr<GrColorInfo> fColorInfoStorage;
+ SkSurfaceProps fSurfaceProps;
GrFPArgs fArgs;
};
diff --git a/chromium/third_party/skia/src/gpu/ganesh/v1/PathRenderer.cpp b/chromium/third_party/skia/src/gpu/ganesh/PathRenderer.cpp
index 0c6d5eaca7f..20d5d850656 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/v1/PathRenderer.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/PathRenderer.cpp
@@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
-#include "src/gpu/ganesh/v1/PathRenderer.h"
+#include "src/gpu/ganesh/PathRenderer.h"
#include "include/gpu/GrRecordingContext.h"
#include "src/core/SkDrawProcs.h"
@@ -15,7 +15,7 @@
#include "src/gpu/ganesh/GrUserStencilSettings.h"
#include "src/gpu/ganesh/geometry/GrStyledShape.h"
#ifdef SK_DEBUG
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#endif
namespace skgpu::v1 {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/v1/PathRenderer.h b/chromium/third_party/skia/src/gpu/ganesh/PathRenderer.h
index a67001d63c1..a67001d63c1 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/v1/PathRenderer.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/PathRenderer.h
diff --git a/chromium/third_party/skia/src/gpu/ganesh/v1/PathRendererChain.cpp b/chromium/third_party/skia/src/gpu/ganesh/PathRendererChain.cpp
index 50b5a94e47b..e4a1950bde0 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/v1/PathRendererChain.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/PathRendererChain.cpp
@@ -6,7 +6,7 @@
*/
-#include "src/gpu/ganesh/v1/PathRendererChain.h"
+#include "src/gpu/ganesh/PathRendererChain.h"
#include "include/gpu/GrDirectContext.h"
#include "include/gpu/GrRecordingContext.h"
diff --git a/chromium/third_party/skia/src/gpu/ganesh/v1/PathRendererChain.h b/chromium/third_party/skia/src/gpu/ganesh/PathRendererChain.h
index 95fc5b8bc85..2a7b5b48d74 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/v1/PathRendererChain.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/PathRendererChain.h
@@ -8,7 +8,7 @@
#ifndef PathRendererChain_DEFINED
#define PathRendererChain_DEFINED
-#include "src/gpu/ganesh/v1/PathRenderer.h"
+#include "src/gpu/ganesh/PathRenderer.h"
#include "include/core/SkTypes.h"
#include "include/private/SkNoncopyable.h"
diff --git a/chromium/third_party/skia/src/gpu/ganesh/SkGr.cpp b/chromium/third_party/skia/src/gpu/ganesh/SkGr.cpp
index 31328771590..84db31e959e 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/SkGr.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/SkGr.cpp
@@ -98,6 +98,7 @@ sk_sp<SkIDChangeListener> GrMakeUniqueKeyInvalidationListener(skgpu::UniqueKey*
sk_sp<GrSurfaceProxy> GrCopyBaseMipMapToTextureProxy(GrRecordingContext* ctx,
sk_sp<GrSurfaceProxy> baseProxy,
GrSurfaceOrigin origin,
+ std::string_view label,
SkBudgeted budgeted) {
SkASSERT(baseProxy);
@@ -110,7 +111,7 @@ sk_sp<GrSurfaceProxy> GrCopyBaseMipMapToTextureProxy(GrRecordingContext* ctx,
return nullptr;
}
auto copy = GrSurfaceProxy::Copy(ctx, std::move(baseProxy), origin, GrMipmapped::kYes,
- SkBackingFit::kExact, budgeted);
+ SkBackingFit::kExact, budgeted, label);
if (!copy) {
return nullptr;
}
@@ -124,7 +125,10 @@ GrSurfaceProxyView GrCopyBaseMipMapToView(GrRecordingContext* context,
auto origin = src.origin();
auto swizzle = src.swizzle();
auto proxy = src.refProxy();
- return {GrCopyBaseMipMapToTextureProxy(context, proxy, origin, budgeted), origin, swizzle};
+ return {GrCopyBaseMipMapToTextureProxy(
+ context, proxy, origin, /*label=*/"CopyBaseMipMapToView", budgeted),
+ origin,
+ swizzle};
}
static GrMipmapped adjust_mipmapped(GrMipmapped mipmapped,
@@ -169,6 +173,7 @@ static sk_sp<GrTextureProxy> make_bmp_proxy(GrProxyProvider* proxyProvider,
std::tuple<GrSurfaceProxyView, GrColorType>
GrMakeCachedBitmapProxyView(GrRecordingContext* rContext,
const SkBitmap& bitmap,
+ std::string_view label,
GrMipmapped mipmapped) {
if (!bitmap.peekPixels(nullptr)) {
return {};
@@ -214,7 +219,8 @@ GrMakeCachedBitmapProxyView(GrRecordingContext* rContext,
// We need a mipped proxy, but we found a proxy earlier that wasn't mipped. Thus we generate
// a new mipped surface and copy the original proxy into the base layer. We will then let
// the gpu generate the rest of the mips.
- auto mippedProxy = GrCopyBaseMipMapToTextureProxy(rContext, proxy, kTopLeft_GrSurfaceOrigin);
+ auto mippedProxy = GrCopyBaseMipMapToTextureProxy(
+ rContext, proxy, kTopLeft_GrSurfaceOrigin, /*label=*/"MakeCachedBitmapProxyView");
if (!mippedProxy) {
// We failed to make a mipped proxy with the base copied into it. This could have
// been from failure to make the proxy or failure to do the copy. Thus we will fall
@@ -386,7 +392,8 @@ static std::unique_ptr<GrFragmentProcessor> make_dither_effect(
// Pixel 4 Adreno640 500 110ms 221ms (2.01x) 214ms (1.95x)
// Galaxy S20 FE Mali-G77 MP11 600 165ms 360ms (2.18x) 260ms (1.58x)
static const SkBitmap gLUT = make_dither_lut();
- auto [tex, ct] = GrMakeCachedBitmapProxyView(rContext, gLUT, GrMipmapped::kNo);
+ auto [tex, ct] = GrMakeCachedBitmapProxyView(
+ rContext, gLUT, /*label=*/"MakeDitherEffect", GrMipmapped::kNo);
if (!tex) {
return inputFP;
}
@@ -394,7 +401,7 @@ static std::unique_ptr<GrFragmentProcessor> make_dither_effect(
GrSamplerState sampler(GrSamplerState::WrapMode::kRepeat, SkFilterMode::kNearest);
auto te = GrTextureEffect::Make(
std::move(tex), kPremul_SkAlphaType, SkMatrix::I(), sampler, *caps);
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
uniform half range;
uniform shader table;
half4 main(float2 xy, half4 color) {
@@ -404,14 +411,10 @@ static std::unique_ptr<GrFragmentProcessor> make_dither_effect(
return half4(clamp(color.rgb + value * range, 0.0, color.a), color.a);
}
)");
- return GrSkSLFP::Make(effect,
- "Dither",
- std::move(inputFP),
+ return GrSkSLFP::Make(effect, "Dither", std::move(inputFP),
GrSkSLFP::OptFlags::kPreservesOpaqueInput,
- "range",
- range,
- "table",
- std::move(te));
+ "range", range,
+ "table", std::move(te));
}
#endif
@@ -422,11 +425,12 @@ static inline bool skpaint_to_grpaint_impl(
const SkMatrixProvider& matrixProvider,
std::optional<std::unique_ptr<GrFragmentProcessor>> shaderFP,
SkBlender* primColorBlender,
+ const SkSurfaceProps& surfaceProps,
GrPaint* grPaint) {
// Convert SkPaint color to 4f format in the destination color space
SkColor4f origColor = SkColor4fPrepForDst(skPaint.getColor4f(), dstColorInfo);
- GrFPArgs fpArgs(context, matrixProvider, &dstColorInfo);
+ GrFPArgs fpArgs(context, matrixProvider, &dstColorInfo, surfaceProps);
// Setup the initial color considering the shader, the SkPaint color, and the presence or not
// of per-vertex colors.
@@ -463,6 +467,9 @@ static inline bool skpaint_to_grpaint_impl(
paintFP = as_BB(primColorBlender)->asFragmentProcessor(std::move(paintFP),
/*dstFP=*/nullptr,
fpArgs);
+ if (!paintFP) {
+ return false;
+ }
// We can ignore origColor here - alpha is unchanged by gamma
float paintAlpha = skPaint.getColor4f().fA;
@@ -505,6 +512,9 @@ static inline bool skpaint_to_grpaint_impl(
paintFP = as_BB(primColorBlender)->asFragmentProcessor(std::move(paintFP),
/*dstFP=*/nullptr,
fpArgs);
+ if (!paintFP) {
+ return false;
+ }
}
// The paint's *alpha* is applied after the paint/primitive color blend:
@@ -531,7 +541,8 @@ static inline bool skpaint_to_grpaint_impl(
grPaint->setColor4f(colorFilter->filterColor4f(origColor, dstCS, dstCS).premul());
} else {
auto [success, fp] = as_CFB(colorFilter)->asFragmentProcessor(std::move(paintFP),
- context, dstColorInfo);
+ context, dstColorInfo,
+ surfaceProps);
if (!success) {
return false;
}
@@ -572,6 +583,9 @@ static inline bool skpaint_to_grpaint_impl(
std::move(paintFP),
GrFragmentProcessor::SurfaceColor(),
fpArgs);
+ if (!paintFP) {
+ return false;
+ }
grPaint->setXPFactory(SkBlendMode_AsXPFactory(SkBlendMode::kSrc));
}
@@ -598,6 +612,7 @@ bool SkPaintToGrPaint(GrRecordingContext* context,
const GrColorInfo& dstColorInfo,
const SkPaint& skPaint,
const SkMatrixProvider& matrixProvider,
+ const SkSurfaceProps& surfaceProps,
GrPaint* grPaint) {
return skpaint_to_grpaint_impl(context,
dstColorInfo,
@@ -605,6 +620,7 @@ bool SkPaintToGrPaint(GrRecordingContext* context,
matrixProvider,
/*shaderFP=*/std::nullopt,
/*primColorBlender=*/nullptr,
+ surfaceProps,
grPaint);
}
@@ -614,6 +630,7 @@ bool SkPaintToGrPaintReplaceShader(GrRecordingContext* context,
const SkPaint& skPaint,
const SkMatrixProvider& matrixProvider,
std::unique_ptr<GrFragmentProcessor> shaderFP,
+ const SkSurfaceProps& surfaceProps,
GrPaint* grPaint) {
return skpaint_to_grpaint_impl(context,
dstColorInfo,
@@ -621,6 +638,7 @@ bool SkPaintToGrPaintReplaceShader(GrRecordingContext* context,
matrixProvider,
std::move(shaderFP),
/*primColorBlender=*/nullptr,
+ surfaceProps,
grPaint);
}
@@ -631,6 +649,7 @@ bool SkPaintToGrPaintWithBlend(GrRecordingContext* context,
const SkPaint& skPaint,
const SkMatrixProvider& matrixProvider,
SkBlender* primColorBlender,
+ const SkSurfaceProps& surfaceProps,
GrPaint* grPaint) {
return skpaint_to_grpaint_impl(context,
dstColorInfo,
@@ -638,5 +657,6 @@ bool SkPaintToGrPaintWithBlend(GrRecordingContext* context,
matrixProvider,
/*shaderFP=*/std::nullopt,
primColorBlender,
+ surfaceProps,
grPaint);
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/SkGr.h b/chromium/third_party/skia/src/gpu/ganesh/SkGr.h
index 1ac6320c1ae..5a26c18c174 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/SkGr.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/SkGr.h
@@ -38,6 +38,7 @@ class SkMatrixProvider;
class SkPaint;
class SkPixelRef;
class SkPixmap;
+class SkSurfaceProps;
struct SkIRect;
namespace skgpu {
@@ -92,6 +93,7 @@ bool SkPaintToGrPaint(GrRecordingContext*,
const GrColorInfo& dstColorInfo,
const SkPaint& skPaint,
const SkMatrixProvider& matrixProvider,
+ const SkSurfaceProps& surfaceProps,
GrPaint* grPaint);
/** Replaces the SkShader (if any) on skPaint with the passed in GrFragmentProcessor, if not null.
@@ -102,6 +104,7 @@ bool SkPaintToGrPaintReplaceShader(GrRecordingContext*,
const SkPaint& skPaint,
const SkMatrixProvider& matrixProvider,
std::unique_ptr<GrFragmentProcessor> shaderFP,
+ const SkSurfaceProps& surfaceProps,
GrPaint* grPaint);
/** Blends the SkPaint's shader (or color if no shader) with the color which specified via a
@@ -111,6 +114,7 @@ bool SkPaintToGrPaintWithBlend(GrRecordingContext* context,
const SkPaint& skPaint,
const SkMatrixProvider& matrixProvider,
SkBlender* primColorBlender,
+ const SkSurfaceProps& surfaceProps,
GrPaint* grPaint);
////////////////////////////////////////////////////////////////////////////////
@@ -149,6 +153,7 @@ enum class GrImageTexGenPolicy : int {
sk_sp<GrSurfaceProxy> GrCopyBaseMipMapToTextureProxy(GrRecordingContext*,
sk_sp<GrSurfaceProxy> baseProxy,
GrSurfaceOrigin origin,
+ std::string_view label,
SkBudgeted = SkBudgeted::kYes);
/**
* Same as GrCopyBaseMipMapToTextureProxy but takes the src as a view and returns a view with same
@@ -169,6 +174,7 @@ GrSurfaceProxyView GrCopyBaseMipMapToView(GrRecordingContext*,
std::tuple<GrSurfaceProxyView, GrColorType>
GrMakeCachedBitmapProxyView(GrRecordingContext*,
const SkBitmap&,
+ std::string_view label,
GrMipmapped = GrMipmapped::kNo);
/**
diff --git a/chromium/third_party/skia/src/gpu/ganesh/v1/StencilClip.h b/chromium/third_party/skia/src/gpu/ganesh/StencilClip.h
index 6e766702d22..6e766702d22 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/v1/StencilClip.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/StencilClip.h
diff --git a/chromium/third_party/skia/src/gpu/ganesh/v1/StencilMaskHelper.cpp b/chromium/third_party/skia/src/gpu/ganesh/StencilMaskHelper.cpp
index a57e27e7178..32b7e8e81b2 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/v1/StencilMaskHelper.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/StencilMaskHelper.cpp
@@ -5,16 +5,16 @@
* found in the LICENSE file.
*/
-#include "src/gpu/ganesh/v1/StencilMaskHelper.h"
+#include "src/gpu/ganesh/StencilMaskHelper.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPath.h"
#include "src/gpu/ganesh/GrRecordingContextPriv.h"
#include "src/gpu/ganesh/GrStencilSettings.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/effects/GrDisableColorXP.h"
#include "src/gpu/ganesh/geometry/GrShape.h"
#include "src/gpu/ganesh/geometry/GrStyledShape.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
namespace {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/v1/StencilMaskHelper.h b/chromium/third_party/skia/src/gpu/ganesh/StencilMaskHelper.h
index ba019b1282d..7d15bc97c20 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/v1/StencilMaskHelper.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/StencilMaskHelper.h
@@ -8,7 +8,7 @@
#ifndef StencilMaskHelper_DEFINED
#define StencilMaskHelper_DEFINED
-#include "src/gpu/ganesh/v1/StencilClip.h"
+#include "src/gpu/ganesh/StencilClip.h"
class GrShape;
class GrRecordingContext;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/SurfaceContext.cpp b/chromium/third_party/skia/src/gpu/ganesh/SurfaceContext.cpp
index b0e0a443e53..3aa82c19eaa 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/SurfaceContext.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/SurfaceContext.cpp
@@ -35,7 +35,7 @@
#define RETURN_FALSE_IF_ABANDONED if (this->fContext->abandoned()) { return false; }
#define RETURN_NULLPTR_IF_ABANDONED if (this->fContext->abandoned()) { return nullptr; }
-namespace skgpu {
+namespace skgpu::v1 {
SurfaceContext::SurfaceContext(GrRecordingContext* context,
GrSurfaceProxyView readView,
@@ -190,7 +190,8 @@ bool SurfaceContext::readPixels(GrDirectContext* dContext, GrPixmap dst, SkIPoin
this->origin(),
kMipMapped,
kFit,
- kBudgeted);
+ kBudgeted,
+ /*label=*/"SurfaceContext_ReadPixelsWithCopyWholeSrc");
} else {
auto srcRect = SkIRect::MakePtSize(pt, dst.dimensions());
copy = GrSurfaceProxy::Copy(fContext,
@@ -200,6 +201,7 @@ bool SurfaceContext::readPixels(GrDirectContext* dContext, GrPixmap dst, SkIPoin
srcRect,
kFit,
kBudgeted,
+ /*label=*/"SurfaceContext_ReadPixels",
restrictions.fRectsMustMatch);
pt = {0, 0};
}
@@ -597,7 +599,7 @@ void SurfaceContext::asyncRescaleAndReadPixels(GrDirectContext* dContext,
return;
}
- std::unique_ptr<skgpu::SurfaceFillContext> tempFC;
+ std::unique_ptr<SurfaceFillContext> tempFC;
int x = srcRect.fLeft;
int y = srcRect.fTop;
if (needsRescale) {
@@ -763,7 +765,7 @@ void SurfaceContext::asyncReadPixels(GrDirectContext* dContext,
callbackContext,
rect.size(),
colorType,
- this->caps()->transferBufferAlignment(),
+ this->caps()->transferBufferRowBytesAlignment(),
mappedBufferManager,
std::move(transferResult)};
auto finishCallback = [](GrGpuFinishedContext c) {
@@ -850,7 +852,8 @@ void SurfaceContext::asyncRescaleAndReadPixelsYUV420(GrDirectContext* dContext,
GrMipmapped::kNo,
srcRect,
SkBackingFit::kApprox,
- SkBudgeted::kYes);
+ SkBudgeted::kYes,
+ /*label=*/"SurfaceContext_AsyncRescaleAndReadPixelsYUV420");
if (!srcView) {
// If we can't get a texture copy of the contents then give up.
callback(callbackContext, nullptr);
@@ -996,7 +999,7 @@ void SurfaceContext::asyncRescaleAndReadPixelsYUV420(GrDirectContext* dContext,
callbackContext,
dContext->priv().clientMappedBufferManager(),
dstSize,
- this->caps()->transferBufferAlignment(),
+ this->caps()->transferBufferRowBytesAlignment(),
std::move(yTransfer),
std::move(uTransfer),
std::move(vTransfer)};
@@ -1063,11 +1066,11 @@ sk_sp<GrRenderTask> SurfaceContext::copy(sk_sp<GrSurfaceProxy> src,
this->origin());
}
-std::unique_ptr<skgpu::SurfaceFillContext> SurfaceContext::rescale(const GrImageInfo& info,
- GrSurfaceOrigin origin,
- SkIRect srcRect,
- RescaleGamma rescaleGamma,
- RescaleMode rescaleMode) {
+std::unique_ptr<SurfaceFillContext> SurfaceContext::rescale(const GrImageInfo& info,
+ GrSurfaceOrigin origin,
+ SkIRect srcRect,
+ RescaleGamma rescaleGamma,
+ RescaleMode rescaleMode) {
auto sfc = fContext->priv().makeSFCWithFallback(info,
SkBackingFit::kExact,
1,
@@ -1084,7 +1087,7 @@ std::unique_ptr<skgpu::SurfaceFillContext> SurfaceContext::rescale(const GrImage
return sfc;
}
-bool SurfaceContext::rescaleInto(skgpu::SurfaceFillContext* dst,
+bool SurfaceContext::rescaleInto(SurfaceFillContext* dst,
SkIRect dstRect,
SkIRect srcRect,
RescaleGamma rescaleGamma,
@@ -1108,7 +1111,9 @@ bool SurfaceContext::rescaleInto(skgpu::SurfaceFillContext* dst,
// TODO: If copying supported specifying a renderable copy then we could return the copy
// when there are no other conversions.
texView = GrSurfaceProxyView::Copy(fContext, std::move(texView), GrMipmapped::kNo, srcRect,
- SkBackingFit::kApprox, SkBudgeted::kNo);
+ SkBackingFit::kApprox,
+ SkBudgeted::kNo,
+ /*label=*/"SurfaceContext_RescaleInto");
if (!texView) {
return false;
}
@@ -1124,8 +1129,8 @@ bool SurfaceContext::rescaleInto(skgpu::SurfaceFillContext* dst,
// Within a rescaling pass A is the input (if not null) and B is the output. At the end of the
// pass B is moved to A. If 'this' is the input on the first pass then tempA is null.
- std::unique_ptr<skgpu::SurfaceFillContext> tempA;
- std::unique_ptr<skgpu::SurfaceFillContext> tempB;
+ std::unique_ptr<SurfaceFillContext> tempA;
+ std::unique_ptr<SurfaceFillContext> tempB;
// Assume we should ignore the rescale linear request if the surface has no color space since
// it's unclear how we'd linearize from an unknown color space.
@@ -1177,7 +1182,7 @@ bool SurfaceContext::rescaleInto(skgpu::SurfaceFillContext* dst,
}
auto input = tempA ? tempA.get() : this;
sk_sp<GrColorSpaceXform> xform;
- skgpu::SurfaceFillContext* stepDst;
+ SurfaceFillContext* stepDst;
SkIRect stepDstRect;
if (nextDims == finalSize) {
stepDst = dst;
@@ -1265,7 +1270,7 @@ SurfaceContext::PixelTransferResult SurfaceContext::transferPixels(GrColorType d
}
size_t rowBytes = GrColorTypeBytesPerPixel(supportedRead.fColorType) * rect.width();
- rowBytes = SkAlignTo(rowBytes, this->caps()->transferBufferAlignment());
+ rowBytes = SkAlignTo(rowBytes, this->caps()->transferBufferRowBytesAlignment());
size_t size = rowBytes * rect.height();
// By using kStream_GrAccessPattern here, we are not able to cache and reuse the buffer for
// multiple reads. Switching to kDynamic_GrAccessPattern would allow for this, however doing
@@ -1311,4 +1316,4 @@ void SurfaceContext::validate() const {
}
#endif
-} // namespace skgpu
+} // namespace skgpu::v1
diff --git a/chromium/third_party/skia/src/gpu/ganesh/SurfaceContext.h b/chromium/third_party/skia/src/gpu/ganesh/SurfaceContext.h
index 8904c2a9bc3..0c9bba3064b 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/SurfaceContext.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/SurfaceContext.h
@@ -32,20 +32,12 @@ struct SkIRect;
namespace skgpu {
class SingleOwner;
+}
+
+namespace skgpu::v1 {
+
class SurfaceFillContext;
-/**
- * A helper object to orchestrate commands for a particular surface
- *
- * SurfaceContext
- * |
- * SurfaceFillContext
- * |
- * v1::SFC
- * |
- * v1::SDC
- *
- */
class SurfaceContext {
public:
// If it is known that the GrSurfaceProxy is not renderable, you can directly call the ctor
@@ -153,11 +145,11 @@ public:
* different size than srcRect. Though, it could be relaxed to allow non-scaling color
* conversions.
*/
- std::unique_ptr<skgpu::SurfaceFillContext> rescale(const GrImageInfo& info,
- GrSurfaceOrigin,
- SkIRect srcRect,
- SkImage::RescaleGamma,
- SkImage::RescaleMode);
+ std::unique_ptr<SurfaceFillContext> rescale(const GrImageInfo& info,
+ GrSurfaceOrigin,
+ SkIRect srcRect,
+ SkImage::RescaleGamma,
+ SkImage::RescaleMode);
/**
* Like the above but allows the caller ot specify a destination fill context and
@@ -248,6 +240,6 @@ private:
using INHERITED = SkRefCnt;
};
-} // namespace skgpu
+} // namespace skgpu::v1
#endif // SurfaceContext_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/ganesh/v1/SurfaceDrawContext.cpp b/chromium/third_party/skia/src/gpu/ganesh/SurfaceDrawContext.cpp
index 4b7663824f7..f5fe2a9c4ff 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/v1/SurfaceDrawContext.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/SurfaceDrawContext.cpp
@@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkDrawable.h"
@@ -47,6 +47,7 @@
#include "src/gpu/ganesh/GrStencilSettings.h"
#include "src/gpu/ganesh/GrStyle.h"
#include "src/gpu/ganesh/GrTracing.h"
+#include "src/gpu/ganesh/PathRenderer.h"
#include "src/gpu/ganesh/SkGr.h"
#include "src/gpu/ganesh/effects/GrBicubicEffect.h"
#include "src/gpu/ganesh/effects/GrBlendFragmentProcessor.h"
@@ -70,7 +71,6 @@
#include "src/gpu/ganesh/ops/ShadowRRectOp.h"
#include "src/gpu/ganesh/ops/StrokeRectOp.h"
#include "src/gpu/ganesh/ops/TextureOp.h"
-#include "src/gpu/ganesh/v1/PathRenderer.h"
#include "src/text/gpu/SDFTControl.h"
#include "src/text/gpu/TextBlobRedrawCoordinator.h"
@@ -164,7 +164,8 @@ std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::Make(
skgpu::Swizzle writeSwizzle,
GrSurfaceOrigin origin,
SkBudgeted budgeted,
- const SkSurfaceProps& surfaceProps) {
+ const SkSurfaceProps& surfaceProps,
+ std::string_view label) {
// It is probably not necessary to check if the context is abandoned here since uses of the
// SurfaceDrawContext which need the context will mostly likely fail later on without an
// issue. However having this hear adds some reassurance in case there is a path doesn't handle
@@ -182,7 +183,7 @@ std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::Make(
fit,
budgeted,
isProtected,
- /*label=*/{});
+ label);
if (!proxy) {
return nullptr;
}
@@ -207,6 +208,7 @@ std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::Make(
SkBackingFit fit,
SkISize dimensions,
const SkSurfaceProps& surfaceProps,
+ std::string_view label,
int sampleCnt,
GrMipmapped mipmapped,
GrProtected isProtected,
@@ -220,15 +222,16 @@ std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::Make(
if (!format.isValid()) {
return nullptr;
}
- sk_sp<GrTextureProxy> proxy = rContext->priv().proxyProvider()->createProxy(format,
- dimensions,
- GrRenderable::kYes,
- sampleCnt,
- mipmapped,
- fit,
- budgeted,
- isProtected,
- /*label=*/{});
+ sk_sp<GrTextureProxy> proxy = rContext->priv().proxyProvider()->createProxy(
+ format,
+ dimensions,
+ GrRenderable::kYes,
+ sampleCnt,
+ mipmapped,
+ fit,
+ budgeted,
+ isProtected,
+ label);
if (!proxy) {
return nullptr;
}
@@ -259,7 +262,8 @@ std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::MakeWithFallback(
return nullptr;
}
return SurfaceDrawContext::Make(rContext, ct, colorSpace, fit, dimensions, surfaceProps,
- sampleCnt, mipmapped, isProtected, origin, budgeted);
+ /*label=*/"MakeSurfaceDrawContextWithFallback", sampleCnt,
+ mipmapped, isProtected, origin, budgeted);
}
std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::MakeFromBackendTexture(
@@ -327,7 +331,7 @@ void SurfaceDrawContext::willReplaceOpsTask(OpsTask* prevTask, OpsTask* nextTask
void SurfaceDrawContext::drawGlyphRunList(SkCanvas* canvas,
const GrClip* clip,
const SkMatrixProvider& viewMatrix,
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
SkStrikeDeviceInfo strikeDeviceInfo,
const SkPaint& paint) {
ASSERT_SINGLE_OWNER
@@ -1438,6 +1442,10 @@ void SurfaceDrawContext::drawImageLattice(const GrClip* clip,
void SurfaceDrawContext::drawDrawable(std::unique_ptr<SkDrawable::GpuDrawHandler> drawable,
const SkRect& bounds) {
+ ASSERT_SINGLE_OWNER
+ RETURN_IF_ABANDONED
+ SkDEBUGCODE(this->validate();)
+ GR_CREATE_TRACE_MARKER_CONTEXT("SurfaceDrawContext", "drawDrawable", fContext);
GrOp::Owner op(DrawableOp::Make(fContext, std::move(drawable), bounds));
SkASSERT(op);
this->addOp(std::move(op));
@@ -2086,6 +2094,7 @@ bool SurfaceDrawContext::setupDstProxyView(const SkRect& opBounds,
copyRect,
fit,
SkBudgeted::kYes,
+ /*label=*/{},
restrictions.fRectsMustMatch);
SkASSERT(copy);
diff --git a/chromium/third_party/skia/src/gpu/ganesh/v1/SurfaceDrawContext_v1.h b/chromium/third_party/skia/src/gpu/ganesh/SurfaceDrawContext.h
index ad040aedd91..45ea78fcc4c 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/v1/SurfaceDrawContext_v1.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/SurfaceDrawContext.h
@@ -18,9 +18,9 @@
#include "src/gpu/ganesh/GrRenderTargetProxy.h"
#include "src/gpu/ganesh/GrSurfaceProxyView.h"
#include "src/gpu/ganesh/GrXferProcessor.h"
+#include "src/gpu/ganesh/SurfaceFillContext.h"
#include "src/gpu/ganesh/geometry/GrQuad.h"
#include "src/gpu/ganesh/ops/OpsTask.h"
-#include "src/gpu/ganesh/v1/SurfaceFillContext_v1.h"
class GrBackendSemaphore;
class GrClip;
@@ -37,7 +37,6 @@ class GrTextureProxy;
struct GrTextureSetEntry;
struct GrUserStencilSettings;
struct SkDrawShadowRec;
-class SkGlyphRunList;
struct SkIPoint;
struct SkIRect;
class SkLatticeIter;
@@ -53,6 +52,10 @@ struct SkRSXform;
class SkTextBlob;
class SkVertices;
+namespace sktext {
+class GlyphRunList;
+}
+
namespace skgpu::v1 {
/**
@@ -74,6 +77,7 @@ public:
SkBackingFit,
SkISize dimensions,
const SkSurfaceProps&,
+ std::string_view label,
int sampleCnt = 1,
GrMipmapped = GrMipmapped::kNo,
GrProtected = GrProtected::kNo,
@@ -96,7 +100,8 @@ public:
skgpu::Swizzle writeSwizzle,
GrSurfaceOrigin,
SkBudgeted,
- const SkSurfaceProps&);
+ const SkSurfaceProps&,
+ std::string_view label);
// Same as previous factory but will try to use fallback GrColorTypes if the one passed in
// fails. The fallback GrColorType will have at least the number of channels and precision per
@@ -476,7 +481,7 @@ public:
const SkRect& dst);
/**
- * Draw the text specified by the SkGlyphRunList.
+ * Draw the text specified by the GlyphRunList.
*
* @param viewMatrix transformationMatrix
* @param glyphRunList text, text positions, and paint.
@@ -484,7 +489,7 @@ public:
void drawGlyphRunList(SkCanvas*,
const GrClip*,
const SkMatrixProvider& viewMatrix,
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
SkStrikeDeviceInfo strikeDeviceInfo,
const SkPaint& paint);
diff --git a/chromium/third_party/skia/src/gpu/ganesh/SurfaceFillContext.cpp b/chromium/third_party/skia/src/gpu/ganesh/SurfaceFillContext.cpp
index a1655e7442d..fe93fef244f 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/SurfaceFillContext.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/SurfaceFillContext.cpp
@@ -8,8 +8,96 @@
#include "src/gpu/ganesh/SurfaceFillContext.h"
#include "src/gpu/ganesh/effects/GrMatrixEffect.h"
+#include "src/gpu/ganesh/effects/GrTextureEffect.h"
+#include "src/gpu/ganesh/geometry/GrRect.h"
+#include "src/gpu/ganesh/ops/ClearOp.h"
+#include "src/gpu/ganesh/ops/FillRectOp.h"
-namespace skgpu {
+#define ASSERT_SINGLE_OWNER SKGPU_ASSERT_SINGLE_OWNER(this->singleOwner())
+#define RETURN_IF_ABANDONED if (fContext->abandoned()) { return; }
+
+class AutoCheckFlush {
+public:
+ AutoCheckFlush(GrDrawingManager* drawingManager) : fDrawingManager(drawingManager) {
+ SkASSERT(fDrawingManager);
+ }
+ ~AutoCheckFlush() { fDrawingManager->flushIfNecessary(); }
+
+private:
+ GrDrawingManager* fDrawingManager;
+};
+
+namespace skgpu::v1 {
+
+// In MDB mode the reffing of the 'getLastOpsTask' call's result allows in-progress
+// OpsTask to be picked up and added to by SurfaceFillContext lower in the call
+// stack. When this occurs with a closed OpsTask, a new one will be allocated
+// when the SurfaceFillContext attempts to use it (via getOpsTask).
+SurfaceFillContext::SurfaceFillContext(GrRecordingContext* rContext,
+ GrSurfaceProxyView readView,
+ GrSurfaceProxyView writeView,
+ const GrColorInfo& colorInfo)
+ : SurfaceContext(rContext, std::move(readView), colorInfo)
+ , fWriteView(std::move(writeView)) {
+ SkASSERT(this->asSurfaceProxy() == fWriteView.proxy());
+ SkASSERT(this->origin() == fWriteView.origin());
+
+ fOpsTask = sk_ref_sp(rContext->priv().drawingManager()->getLastOpsTask(this->asSurfaceProxy()));
+
+ SkDEBUGCODE(this->validate();)
+}
+
+OpsTask* SurfaceFillContext::getOpsTask() {
+ ASSERT_SINGLE_OWNER
+ SkDEBUGCODE(this->validate();)
+
+ if (!fOpsTask || fOpsTask->isClosed()) {
+ this->replaceOpsTask();
+ }
+ SkASSERT(!fOpsTask->isClosed());
+ return fOpsTask.get();
+}
+
+void SurfaceFillContext::discard() {
+ ASSERT_SINGLE_OWNER
+ RETURN_IF_ABANDONED
+ SkDEBUGCODE(this->validate();)
+ GR_CREATE_TRACE_MARKER_CONTEXT("SurfaceFillContext", "discard", fContext);
+
+ AutoCheckFlush acf(this->drawingManager());
+
+ this->getOpsTask()->discard();
+}
+
+void SurfaceFillContext::resolveMSAA() {
+ ASSERT_SINGLE_OWNER
+ RETURN_IF_ABANDONED
+ SkDEBUGCODE(this->validate();)
+ GR_CREATE_TRACE_MARKER_CONTEXT("SurfaceFillContext", "resolveMSAA", fContext);
+
+ AutoCheckFlush acf(this->drawingManager());
+
+ this->drawingManager()->newTextureResolveRenderTask(this->asSurfaceProxyRef(),
+ GrSurfaceProxy::ResolveFlags::kMSAA,
+ *this->caps());
+}
+
+void SurfaceFillContext::fillRectWithFP(const SkIRect& dstRect,
+ std::unique_ptr<GrFragmentProcessor> fp) {
+ ASSERT_SINGLE_OWNER
+ RETURN_IF_ABANDONED
+ SkDEBUGCODE(this->validate();)
+ GR_CREATE_TRACE_MARKER_CONTEXT("SurfaceFillContext", "fillRectWithFP", fContext);
+
+ AutoCheckFlush acf(this->drawingManager());
+
+ GrPaint paint;
+ paint.setColorFragmentProcessor(std::move(fp));
+ paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
+ auto op = FillRectOp::MakeNonAARect(fContext, std::move(paint), SkMatrix::I(),
+ SkRect::Make(dstRect));
+ this->addDrawOp(std::move(op));
+}
void SurfaceFillContext::fillRectWithFP(const SkIRect& dstRect,
const SkMatrix& localMatrix,
@@ -18,4 +106,163 @@ void SurfaceFillContext::fillRectWithFP(const SkIRect& dstRect,
this->fillRectWithFP(dstRect, std::move(fp));
}
-} // namespace skgpu
+bool SurfaceFillContext::blitTexture(GrSurfaceProxyView view,
+ const SkIRect& srcRect,
+ const SkIPoint& dstPoint) {
+ SkASSERT(view.asTextureProxy());
+ SkIRect clippedSrcRect;
+ SkIPoint clippedDstPoint;
+ if (!GrClipSrcRectAndDstPoint(this->dimensions(),
+ view.dimensions(),
+ srcRect,
+ dstPoint,
+ &clippedSrcRect,
+ &clippedDstPoint)) {
+ return false;
+ }
+
+ auto fp = GrTextureEffect::Make(std::move(view), kUnknown_SkAlphaType);
+ auto dstRect = SkIRect::MakePtSize(clippedDstPoint, clippedSrcRect.size());
+ auto srcRectF = SkRect::Make(clippedSrcRect);
+ this->fillRectToRectWithFP(srcRectF, dstRect, std::move(fp));
+ return true;
+}
+
+sk_sp<GrRenderTask> SurfaceFillContext::refRenderTask() {
+ return sk_ref_sp(this->getOpsTask());
+}
+
+OpsTask* SurfaceFillContext::replaceOpsTask() {
+ sk_sp<OpsTask> newOpsTask = this->drawingManager()->newOpsTask(this->writeSurfaceView(),
+ this->arenas());
+ this->willReplaceOpsTask(fOpsTask.get(), newOpsTask.get());
+ fOpsTask = std::move(newOpsTask);
+ return fOpsTask.get();
+}
+
+void SurfaceFillContext::ClearToGrPaint(std::array<float, 4> color, GrPaint* paint) {
+ paint->setColor4f({color[0], color[1], color[2], color[3]});
+ if (color[3] == 1.f) {
+ // Can just rely on the src-over blend mode to do the right thing.
+ // This may improve batching.
+ paint->setPorterDuffXPFactory(SkBlendMode::kSrcOver);
+ } else {
+ // A clear overwrites the prior color, so even if it's transparent, it behaves as if it
+ // were src blended
+ paint->setPorterDuffXPFactory(SkBlendMode::kSrc);
+ }
+}
+
+void SurfaceFillContext::addOp(GrOp::Owner op) {
+ GrDrawingManager* drawingMgr = this->drawingManager();
+ this->getOpsTask()->addOp(drawingMgr,
+ std::move(op),
+ GrTextureResolveManager(drawingMgr),
+ *this->caps());
+}
+
+
+void SurfaceFillContext::addDrawOp(GrOp::Owner owner) {
+ GrDrawOp* op = static_cast<GrDrawOp*>(owner.get());
+ GrClampType clampType = GrColorTypeClampType(this->colorInfo().colorType());
+ auto clip = GrAppliedClip::Disabled();
+ const GrCaps& caps = *this->caps();
+ GrProcessorSet::Analysis analysis = op->finalize(caps, &clip, clampType);
+ SkASSERT(!op->usesStencil());
+ SkASSERT(!analysis.requiresDstTexture());
+ SkRect bounds = owner->bounds();
+ // We shouldn't have coverage AA or hairline draws in fill contexts.
+ SkASSERT(!op->hasAABloat() && !op->hasZeroArea());
+ if (!bounds.intersect(this->asSurfaceProxy()->getBoundsRect())) {
+ return;
+ }
+ op->setClippedBounds(op->bounds());
+ SkDEBUGCODE(op->fAddDrawOpCalled = true;)
+
+ GrDstProxyView dstProxyView;
+ this->getOpsTask()->addDrawOp(fContext->priv().drawingManager(),
+ std::move(owner),
+ op->usesMSAA(),
+ analysis,
+ std::move(clip),
+ dstProxyView,
+ GrTextureResolveManager(this->drawingManager()),
+ caps);
+}
+
+void SurfaceFillContext::internalClear(const SkIRect* scissor,
+ std::array<float, 4> color,
+ bool upgradePartialToFull) {
+ ASSERT_SINGLE_OWNER
+ RETURN_IF_ABANDONED
+ SkDEBUGCODE(this->validate();)
+ GR_CREATE_TRACE_MARKER_CONTEXT("SurfaceFillContext", "clear", fContext);
+
+ // There are three ways clears are handled: load ops, native clears, and draws. Load ops are
+ // only for fullscreen clears; native clears can be fullscreen or with scissors if the backend
+ // supports then. Drawing an axis-aligned rect is the fallback path.
+ GrScissorState scissorState(this->asSurfaceProxy()->backingStoreDimensions());
+ if (scissor && !scissorState.set(*scissor)) {
+ // The clear is offscreen, so skip it (normally this would be handled by addDrawOp,
+ // except clear ops are not draw ops).
+ return;
+ }
+
+ // If we have a scissor but it's okay to clear beyond it for performance reasons, then disable
+ // the test. We only do this when the clear would be handled by a load op or natively.
+ if (scissorState.enabled() && !this->caps()->performColorClearsAsDraws()) {
+ if (upgradePartialToFull && (this->caps()->preferFullscreenClears() ||
+ this->caps()->shouldInitializeTextures())) {
+ // TODO: wrt the shouldInitializeTextures path, it would be more performant to
+ // only clear the entire target if we knew it had not been cleared before. As
+ // is this could end up doing a lot of redundant clears.
+ scissorState.setDisabled();
+ } else {
+ // Unlike with stencil clears, we also allow clears up to the logical dimensions of the
+ // render target to overflow into any approx-fit padding of the backing store dimensions
+ scissorState.relaxTest(this->dimensions());
+ }
+ }
+
+ if (!scissorState.enabled()) {
+ // This is a fullscreen clear, so could be handled as a load op. Regardless, we can also
+ // discard all prior ops in the current task since the color buffer will be overwritten.
+ auto opsTask = this->getOpsTask();
+ if (opsTask->resetForFullscreenClear(this->canDiscardPreviousOpsOnFullClear()) &&
+ !this->caps()->performColorClearsAsDraws()) {
+ color = this->writeSurfaceView().swizzle().applyTo(color);
+ // The op list was emptied and native clears are allowed, so just use the load op
+ opsTask->setColorLoadOp(GrLoadOp::kClear, color);
+ return;
+ } else {
+ // Will use an op for the clear, reset the load op to discard since the op will
+ // blow away the color buffer contents
+ opsTask->setColorLoadOp(GrLoadOp::kDiscard);
+ }
+ }
+
+ // At this point we are either a partial clear or a fullscreen clear that couldn't be applied
+ // as a load op.
+ bool clearAsDraw = this->caps()->performColorClearsAsDraws() ||
+ (scissorState.enabled() && this->caps()->performPartialClearsAsDraws());
+ if (clearAsDraw) {
+ GrPaint paint;
+ ClearToGrPaint(color, &paint);
+ auto op = FillRectOp::MakeNonAARect(fContext, std::move(paint), SkMatrix::I(),
+ SkRect::Make(scissorState.rect()));
+ this->addDrawOp(std::move(op));
+ } else {
+ color = this->writeSurfaceView().swizzle().applyTo(color);
+ this->addOp(ClearOp::MakeColor(fContext, scissorState, color));
+ }
+}
+
+#ifdef SK_DEBUG
+void SurfaceFillContext::onValidate() const {
+ if (fOpsTask && !fOpsTask->isClosed()) {
+ SkASSERT(this->drawingManager()->getLastRenderTask(fWriteView.proxy()) == fOpsTask.get());
+ }
+}
+#endif
+
+} // namespace skgpu::v1
diff --git a/chromium/third_party/skia/src/gpu/ganesh/SurfaceFillContext.h b/chromium/third_party/skia/src/gpu/ganesh/SurfaceFillContext.h
index 4132c7303a8..5c524f9cb6a 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/SurfaceFillContext.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/SurfaceFillContext.h
@@ -10,22 +10,32 @@
#include "src/gpu/ganesh/SurfaceContext.h"
-namespace skgpu {
+#include "src/gpu/ganesh/ops/OpsTask.h"
+
+namespace skgpu::v1 {
-// This class is left over from the v1/v2 split. It should be merged back into
-// v1::SurfaceFillContext.
class SurfaceFillContext : public SurfaceContext {
public:
+ SurfaceFillContext(GrRecordingContext* rContext,
+ GrSurfaceProxyView readView,
+ GrSurfaceProxyView writeView,
+ const GrColorInfo& colorInfo);
SurfaceFillContext* asFillContext() override { return this; }
+ OpsTask* getOpsTask();
+
+#if GR_TEST_UTILS
+ OpsTask* testingOnly_PeekLastOpsTask() { return fOpsTask.get(); }
+#endif
+
/**
* Provides a performance hint that the render target's contents are allowed
* to become undefined.
*/
- virtual void discard() = 0;
+ void discard();
- virtual void resolveMSAA() = 0;
+ void resolveMSAA();
/**
* Clear the rect of the render target to the given color.
@@ -54,7 +64,7 @@ public:
}
/** Fills 'dstRect' with 'fp' */
- virtual void fillRectWithFP(const SkIRect& dstRect, std::unique_ptr<GrFragmentProcessor>) = 0;
+ void fillRectWithFP(const SkIRect& dstRect, std::unique_ptr<GrFragmentProcessor>);
/**
* A convenience version of fillRectWithFP that applies a coordinate transformation via
@@ -99,22 +109,29 @@ public:
* of the srcRect. The srcRect and dstRect are clipped to the bounds of the src and dst surfaces
* respectively.
*/
- virtual bool blitTexture(GrSurfaceProxyView,
- const SkIRect& srcRect,
- const SkIPoint& dstPoint) = 0;
+ bool blitTexture(GrSurfaceProxyView,
+ const SkIRect& srcRect,
+ const SkIPoint& dstPoint);
+
+ sk_sp<GrRenderTask> refRenderTask();
- virtual sk_sp<GrRenderTask> refRenderTask() = 0;
+ int numSamples() const { return this->asRenderTargetProxy()->numSamples(); }
+ bool wrapsVkSecondaryCB() const { return this->asRenderTargetProxy()->wrapsVkSecondaryCB(); }
+
+ SkArenaAlloc* arenaAlloc() { return this->arenas()->arenaAlloc(); }
+ sktext::gpu::SubRunAllocator* subRunAlloc() { return this->arenas()->subRunAlloc(); }
+
+ const GrSurfaceProxyView& writeSurfaceView() const { return fWriteView; }
protected:
- SurfaceFillContext(GrRecordingContext* rContext,
- GrSurfaceProxyView readView,
- GrSurfaceProxyView writeView,
- const GrColorInfo& colorInfo)
- : SurfaceContext(rContext, std::move(readView), colorInfo)
- , fWriteView(std::move(writeView)) {
- SkASSERT(this->asSurfaceProxy() == fWriteView.proxy());
- SkASSERT(this->origin() == fWriteView.origin());
- }
+ OpsTask* replaceOpsTask();
+
+ /**
+ * Creates a constant color paint for a clear, using src-over if possible to improve batching.
+ */
+ static void ClearToGrPaint(std::array<float, 4> color, GrPaint* paint);
+
+ void addOp(GrOp::Owner);
template <SkAlphaType AlphaType>
static std::array<float, 4> ConvertColor(SkRGBA4f<AlphaType> color);
@@ -125,9 +142,30 @@ protected:
GrSurfaceProxyView fWriteView;
private:
- virtual void internalClear(const SkIRect* scissor,
- std::array<float, 4> color,
- bool upgradePartialToFull = false) = 0;
+ sk_sp<GrArenas> arenas() { return fWriteView.proxy()->asRenderTargetProxy()->arenas(); }
+
+ void addDrawOp(GrOp::Owner);
+
+ /** Override to be notified in subclass before the current ops task is replaced. */
+ virtual void willReplaceOpsTask(OpsTask* prevTask, OpsTask* nextTask) {}
+
+ /**
+ * Override to be called to participate in the decision to discard all previous ops if a
+ * fullscreen clear occurs.
+ */
+ virtual OpsTask::CanDiscardPreviousOps canDiscardPreviousOpsOnFullClear() const {
+ return OpsTask::CanDiscardPreviousOps::kYes;
+ }
+
+ void internalClear(const SkIRect* scissor,
+ std::array<float, 4> color,
+ bool upgradePartialToFull = false);
+
+ SkDEBUGCODE(void onValidate() const override;)
+
+ // The OpsTask can be closed by some other surface context that has picked it up. For this
+ // reason, the OpsTask should only ever be accessed via 'getOpsTask'.
+ sk_sp<OpsTask> fOpsTask;
using INHERITED = SurfaceContext;
};
@@ -153,6 +191,6 @@ std::array<float, 4> SurfaceFillContext::adjustColorAlphaType(SkRGBA4f<AlphaType
return (AlphaType == this->colorInfo().alphaType()) ? color.array() : ConvertColor(color);
}
-} // namespace skgpu
+} // namespace skgpu::v1
#endif // SurfaceFillContext_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DAttachment.cpp b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DAttachment.cpp
index 4a3ef9bd2fd..ff24dd59b0d 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DAttachment.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DAttachment.cpp
@@ -90,3 +90,11 @@ GrD3DGpu* GrD3DAttachment::getD3DGpu() const {
SkASSERT(!this->wasDestroyed());
return static_cast<GrD3DGpu*>(this->getGpu());
}
+
+void GrD3DAttachment::onSetLabel() {
+ SkASSERT(this->d3dResource());
+ if (!this->getLabel().empty()) {
+ const std::string label = "_Skia_" + this->getLabel();
+ this->d3dResource()->SetName((LPCWSTR)label.c_str());
+ }
+}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DAttachment.h b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DAttachment.h
index 07b0814521c..ce4f8faf2ea 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DAttachment.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DAttachment.h
@@ -46,6 +46,8 @@ private:
GrD3DGpu* getD3DGpu() const;
+ void onSetLabel() override;
+
GrD3DDescriptorHeap::CPUHandle fView;
DXGI_FORMAT fFormat;
};
diff --git a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DBuffer.cpp b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DBuffer.cpp
index 7ebae976cb3..d5e32d10bf9 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DBuffer.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DBuffer.cpp
@@ -121,8 +121,7 @@ void GrD3DBuffer::releaseResource() {
}
if (fMapPtr) {
- this->internalUnmap(this->size());
- fMapPtr = nullptr;
+ this->unmap();
}
SkASSERT(fD3DResource);
@@ -141,25 +140,21 @@ void GrD3DBuffer::onAbandon() {
this->INHERITED::onAbandon();
}
-void GrD3DBuffer::onMap() {
- this->internalMap(this->size());
+void GrD3DBuffer::onMap(MapType type) {
+ fMapPtr = this->internalMap(type, 0, this->size());
}
-void GrD3DBuffer::onUnmap() {
- this->internalUnmap(this->size());
+void GrD3DBuffer::onUnmap(MapType type) {
+ this->internalUnmap(type, 0, this->size());
}
-bool GrD3DBuffer::onUpdateData(const void* src, size_t size) {
- SkASSERT(src);
- if (size > this->size()) {
- return false;
- }
+bool GrD3DBuffer::onUpdateData(const void* src, size_t offset, size_t size, bool /*preserve*/) {
if (!fD3DResource) {
return false;
}
- this->internalMap(size);
- if (!fMapPtr) {
+ void* ptr = this->internalMap(MapType::kWriteDiscard, offset, size);
+ if (!ptr) {
return false;
}
if (this->accessPattern() == kStatic_GrAccessPattern) {
@@ -167,76 +162,87 @@ bool GrD3DBuffer::onUpdateData(const void* src, size_t size) {
SkASSERT(!this->getD3DGpu()->protectedContext());
//*** any alignment restrictions?
}
- memcpy(fMapPtr, src, size);
- this->internalUnmap(size);
+ memcpy(ptr, src, size);
+ this->internalUnmap(MapType::kWriteDiscard, offset, size);
return true;
}
-void GrD3DBuffer::internalMap(size_t size) {
+void* GrD3DBuffer::internalMap(MapType type, size_t offset, size_t size) {
// TODO: if UPLOAD heap type, could be persistently mapped (i.e., this would be a no-op)
- if (this->wasDestroyed()) {
- return;
- }
SkASSERT(fD3DResource);
SkASSERT(!this->isMapped());
- SkASSERT(this->size() >= size);
+ SkASSERT(offset + size <= this->size());
VALIDATE();
if (this->accessPattern() == kStatic_GrAccessPattern) {
+ if (type == MapType::kRead) {
+ return nullptr;
+ }
SkASSERT(!fStagingBuffer);
GrStagingBufferManager::Slice slice =
this->getD3DGpu()->stagingBufferManager()->allocateStagingBufferSlice(size);
if (!slice.fBuffer) {
- return;
+ return nullptr;
}
fStagingBuffer = static_cast<const GrD3DBuffer*>(slice.fBuffer)->d3dResource();
fStagingOffset = slice.fOffset;
- fMapPtr = slice.fOffsetMapPtr;
- } else {
- D3D12_RANGE range;
- range.Begin = 0;
- range.End = size;
- fD3DResource->Map(0, &range, &fMapPtr);
+ VALIDATE();
+ return slice.fOffsetMapPtr;
}
+ D3D12_RANGE range;
+ range.Begin = offset;
+ // The range passed here indicates the portion of the resource that may be
+ // read. If we're only writing then pass an empty range.
+ range.End = type == MapType::kRead ? offset + size : offset;
+ void* result;
+ fD3DResource->Map(0, &range, &result);
+ if (result) {
+ result = SkTAddOffset<void>(result, offset);
+ }
VALIDATE();
+ return result;
}
-void GrD3DBuffer::internalUnmap(size_t size) {
+void GrD3DBuffer::internalUnmap(MapType type, size_t offset, size_t size) {
// TODO: if UPLOAD heap type, could be persistently mapped (i.e., this would be a no-op)
- if (this->wasDestroyed()) {
- return;
- }
SkASSERT(fD3DResource);
- SkASSERT(this->isMapped());
+ SkASSERT(offset + size <= this->size());
VALIDATE();
-#ifdef SK_BUILD_FOR_MAC
- // In both cases the size needs to be 4-byte aligned on Mac
- sizeInBytes = SkAlign4(sizeInBytes);
-#endif
if (this->accessPattern() == kStatic_GrAccessPattern) {
+ SkASSERT(type != GrGpuBuffer::MapType::kRead);
SkASSERT(fStagingBuffer);
this->setResourceState(this->getD3DGpu(), D3D12_RESOURCE_STATE_COPY_DEST);
this->getD3DGpu()->currentCommandList()->copyBufferToBuffer(
- sk_ref_sp<GrD3DBuffer>(this), 0, fStagingBuffer, fStagingOffset, size);
+ sk_ref_sp<GrD3DBuffer>(this),
+ offset,
+ fStagingBuffer,
+ fStagingOffset,
+ size);
fStagingBuffer = nullptr;
} else {
D3D12_RANGE range;
- range.Begin = 0;
+ range.Begin = offset;
+ range.End = type == MapType::kWriteDiscard ? offset + size : offset;
// For READBACK heaps, unmap requires an empty range
- range.End = fResourceState == D3D12_RESOURCE_STATE_COPY_DEST ? 0 : size;
- SkASSERT(this->size() >= size);
+ SkASSERT(fResourceState != D3D12_RESOURCE_STATE_COPY_DEST || range.Begin == range.End);
fD3DResource->Unmap(0, &range);
}
- fMapPtr = nullptr;
-
VALIDATE();
}
+void GrD3DBuffer::onSetLabel() {
+ SkASSERT(fD3DResource);
+ if (!this->getLabel().empty()) {
+ const std::string label = "_Skia_" + this->getLabel();
+ fD3DResource->SetName((LPCWSTR)label.c_str());
+ }
+}
+
#ifdef SK_DEBUG
void GrD3DBuffer::validate() const {
SkASSERT(this->intendedType() == GrGpuBufferType::kVertex ||
diff --git a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DBuffer.h b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DBuffer.h
index 2d8c3a478ce..916993d90cb 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DBuffer.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DBuffer.h
@@ -40,14 +40,18 @@ protected:
private:
void releaseResource();
- void onMap() override;
- void onUnmap() override;
- bool onUpdateData(const void* src, size_t srcSizeInBytes) override;
+ void onMap(MapType) override;
+ void onUnmap(MapType) override;
+ bool onUpdateData(const void* src, size_t offset, size_t size, bool preserve) override;
- void internalMap(size_t size);
- void internalUnmap(size_t size);
+ void* internalMap(MapType, size_t offset, size_t size);
+ void internalUnmap(MapType, size_t offset, size_t size);
+#ifdef SK_DEBUG
void validate() const;
+#endif
+
+ void onSetLabel() override;
GrD3DGpu* getD3DGpu() const {
SkASSERT(!this->wasDestroyed());
diff --git a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DCaps.cpp b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DCaps.cpp
index bc8047e39a4..2533462a502 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DCaps.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DCaps.cpp
@@ -51,11 +51,12 @@ GrD3DCaps::GrD3DCaps(const GrContextOptions& contextOptions, IDXGIAdapter1* adap
fTransferFromBufferToTextureSupport = true;
fTransferFromSurfaceToBufferSupport = true;
+ fTransferFromBufferToBufferSupport = true;
fMaxRenderTargetSize = 16384; // minimum required by feature level 11_0
fMaxTextureSize = 16384; // minimum required by feature level 11_0
- fTransferBufferAlignment = D3D12_TEXTURE_DATA_PITCH_ALIGNMENT;
+ fTransferBufferRowBytesAlignment = D3D12_TEXTURE_DATA_PITCH_ALIGNMENT;
// TODO: implement
fDynamicStateArrayGeometryProcessorTextureSupport = false;
@@ -338,9 +339,9 @@ const GrD3DCaps::FormatInfo& GrD3DCaps::getFormatInfo(DXGI_FORMAT format) const
}
GrD3DCaps::FormatInfo& GrD3DCaps::getFormatInfo(DXGI_FORMAT format) {
- static_assert(SK_ARRAY_COUNT(kDxgiFormats) == GrD3DCaps::kNumDxgiFormats,
+ static_assert(std::size(kDxgiFormats) == GrD3DCaps::kNumDxgiFormats,
"Size of DXGI_FORMATs array must match static value in header");
- for (size_t i = 0; i < SK_ARRAY_COUNT(kDxgiFormats); ++i) {
+ for (size_t i = 0; i < std::size(kDxgiFormats); ++i) {
if (kDxgiFormats[i] == format) {
return fFormatTable[i];
}
@@ -350,7 +351,7 @@ GrD3DCaps::FormatInfo& GrD3DCaps::getFormatInfo(DXGI_FORMAT format) {
}
void GrD3DCaps::initFormatTable(const DXGI_ADAPTER_DESC& adapterDesc, ID3D12Device* device) {
- static_assert(SK_ARRAY_COUNT(kDxgiFormats) == GrD3DCaps::kNumDxgiFormats,
+ static_assert(std::size(kDxgiFormats) == GrD3DCaps::kNumDxgiFormats,
"Size of DXGI_FORMATs array must match static value in header");
std::fill_n(fColorTypeToFormatTable, kGrColorTypeCnt, DXGI_FORMAT_UNKNOWN);
diff --git a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DGpu.cpp b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DGpu.cpp
index 38084835901..059695b4c16 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DGpu.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DGpu.cpp
@@ -788,6 +788,30 @@ bool GrD3DGpu::uploadToTexture(GrD3DTexture* tex,
return true;
}
+bool GrD3DGpu::onTransferFromBufferToBuffer(sk_sp<GrGpuBuffer> src,
+ size_t srcOffset,
+ sk_sp<GrGpuBuffer> dst,
+ size_t dstOffset,
+ size_t size) {
+ if (!this->currentCommandList()) {
+ return false;
+ }
+
+ sk_sp<GrD3DBuffer> d3dSrc(static_cast<GrD3DBuffer*>(src.release()));
+ sk_sp<GrD3DBuffer> d3dDst(static_cast<GrD3DBuffer*>(dst.release()));
+
+ fCurrentDirectCommandList->copyBufferToBuffer(std::move(d3dDst),
+ dstOffset,
+ d3dSrc->d3dResource(),
+ srcOffset,
+ size);
+
+ // copyBufferToBuffer refs the dst but not the src
+ this->currentCommandList()->addGrBuffer(std::move(src));
+
+ return true;
+}
+
bool GrD3DGpu::onTransferPixelsTo(GrTexture* texture,
SkIRect rect,
GrColorType surfaceColorType,
diff --git a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DGpu.h b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DGpu.h
index 751f1ccb513..21a22388b80 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DGpu.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DGpu.h
@@ -182,6 +182,12 @@ private:
int mipLevelCount,
bool prepForTexSampling) override;
+ bool onTransferFromBufferToBuffer(sk_sp<GrGpuBuffer> src,
+ size_t srcOffset,
+ sk_sp<GrGpuBuffer> dst,
+ size_t dstOffset,
+ size_t size) override;
+
bool onTransferPixelsTo(GrTexture*,
SkIRect,
GrColorType surfaceColorType,
diff --git a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DPipelineStateBuilder.cpp b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DPipelineStateBuilder.cpp
index d599e9184bc..15f6f6afe4a 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DPipelineStateBuilder.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DPipelineStateBuilder.cpp
@@ -136,7 +136,7 @@ bool GrD3DPipelineStateBuilder::loadHLSLFromCache(SkReadBuffer* reader, gr_cp<ID
gr_cp<ID3DBlob> GrD3DPipelineStateBuilder::compileD3DProgram(
SkSL::ProgramKind kind,
const std::string& sksl,
- const SkSL::Program::Settings& settings,
+ const SkSL::ProgramSettings& settings,
SkSL::Program::Inputs* outInputs,
std::string* outHLSL) {
#ifdef SK_DEBUG
@@ -555,7 +555,7 @@ std::unique_ptr<GrD3DPipelineState> GrD3DPipelineStateBuilder::finalize() {
this->finalizeShaders();
- SkSL::Program::Settings settings;
+ SkSL::ProgramSettings settings;
settings.fSharpenTextures = true;
settings.fRTFlipOffset = fUniformHandler.getRTFlipOffset();
settings.fRTFlipBinding = 0;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DPipelineStateBuilder.h b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DPipelineStateBuilder.h
index bfd41cd5724..5d687fd4dfa 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DPipelineStateBuilder.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DPipelineStateBuilder.h
@@ -54,7 +54,7 @@ private:
gr_cp<ID3DBlob> compileD3DProgram(SkSL::ProgramKind kind,
const std::string& sksl,
- const SkSL::Program::Settings& settings,
+ const SkSL::ProgramSettings& settings,
SkSL::Program::Inputs* outInputs,
std::string* outHLSL);
diff --git a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DRenderTarget.cpp b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DRenderTarget.cpp
index bdf3a658e0e..3d13c526c73 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DRenderTarget.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DRenderTarget.cpp
@@ -208,3 +208,19 @@ void GrD3DRenderTarget::genKey(skgpu::KeyBuilder* b) const {
#endif
b->add32(this->sampleQualityPattern());
}
+
+void GrD3DRenderTarget::onSetLabel() {
+ SkASSERT(this->d3dResource());
+ if (!this->getLabel().empty()) {
+ if (fMSAATextureResource) {
+ SkASSERT(fMSAATextureResource->d3dResource());
+ const std::string msaaLabel = "_Skia_MSAA_" + this->getLabel();
+ fMSAATextureResource->d3dResource()->SetName((LPCWSTR)msaaLabel.c_str());
+ const std::string resolveLabel = "_Skia_Resolve_" + this->getLabel();
+ this->d3dResource()->SetName((LPCWSTR)resolveLabel.c_str());
+ } else {
+ const std::string label = "_Skia_" + this->getLabel();
+ this->d3dResource()->SetName((LPCWSTR)label.c_str());
+ }
+ }
+}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DRenderTarget.h b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DRenderTarget.h
index 07658eb855f..4fdce9dd9bc 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DRenderTarget.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DRenderTarget.h
@@ -87,6 +87,8 @@ protected:
numColorSamples, GrMipmapped::kNo);
}
+ void onSetLabel() override;
+
private:
// Extra param to disambiguate from constructor used by subclasses.
enum Wrapped { kWrapped };
@@ -111,8 +113,6 @@ private:
GrD3DGpu* getD3DGpu() const;
- void onSetLabel() override{}
-
bool completeStencilAttachment(GrAttachment* stencil, bool useMSAASurface) override {
SkASSERT(useMSAASurface == (this->numSamples() > 1));
return true;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DTexture.cpp b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DTexture.cpp
index ccee18dde8b..4ce917f15f0 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DTexture.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DTexture.cpp
@@ -163,3 +163,11 @@ GrD3DGpu* GrD3DTexture::getD3DGpu() const {
SkASSERT(!this->wasDestroyed());
return static_cast<GrD3DGpu*>(this->getGpu());
}
+
+void GrD3DTexture::onSetLabel() {
+ SkASSERT(this->d3dResource());
+ if (!this->getLabel().empty()) {
+ const std::string label = "_Skia_" + this->getLabel();
+ this->d3dResource()->SetName((LPCWSTR)label.c_str());
+ }
+}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DTexture.h b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DTexture.h
index e457ab5fc80..ee4e6d1d906 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DTexture.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DTexture.h
@@ -63,6 +63,8 @@ protected:
return false;
}
+ void onSetLabel() override;
+
private:
GrD3DTexture(GrD3DGpu*, SkBudgeted, SkISize dimensions, const GrD3DTextureResourceInfo&,
sk_sp<GrD3DResourceState>,
@@ -84,8 +86,6 @@ private:
this->setResourceRelease(std::move(releaseHelper));
}
- void onSetLabel() override{}
-
struct SamplerHash {
uint32_t operator()(GrSamplerState state) const {
// In D3D anisotropic filtering uses the same field (D3D12_SAMPLER_DESC::Filter) as
diff --git a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DTextureRenderTarget.cpp b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DTextureRenderTarget.cpp
index ca8cc38f6d7..26aa6ce5a91 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DTextureRenderTarget.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DTextureRenderTarget.cpp
@@ -244,3 +244,8 @@ size_t GrD3DTextureRenderTarget::onGpuMemorySize() const {
numColorSamples, // TODO: this still correct?
this->mipmapped());
}
+
+void GrD3DTextureRenderTarget::onSetLabel() {
+ GrD3DRenderTarget::onSetLabel();
+}
+
diff --git a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DTextureRenderTarget.h b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DTextureRenderTarget.h
index 7d888050c18..7d623baa07a 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DTextureRenderTarget.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/d3d/GrD3DTextureRenderTarget.h
@@ -106,9 +106,9 @@ private:
// GrGLRenderTarget accounts for the texture's memory and any MSAA renderbuffer's memory.
size_t onGpuMemorySize() const override;
- void onSetLabel() override{}
+ void onSetLabel() override;
- // In Vulkan we call the release proc after we are finished with the underlying
+ // In Direct3D we call the release proc after we are finished with the underlying
// GrD3DImage::Resource object (which occurs after the GPU has finished all work on it).
void onSetRelease(sk_sp<skgpu::RefCntedCallback> releaseHelper) override {
// Forward the release proc on to GrD3DImage
diff --git a/chromium/third_party/skia/src/gpu/ganesh/dawn/BUILD.bazel b/chromium/third_party/skia/src/gpu/ganesh/dawn/BUILD.bazel
index 15f009fab4a..28e8524cb4b 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/dawn/BUILD.bazel
+++ b/chromium/third_party/skia/src/gpu/ganesh/dawn/BUILD.bazel
@@ -1,4 +1,4 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy", "split_srcs_and_hdrs")
+load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_deps", "split_srcs_and_hdrs")
licenses(["notice"])
@@ -51,10 +51,13 @@ filegroup(
visibility = ["//src/gpu/ganesh:__pkg__"],
)
-cc_library(
+skia_cc_deps(
name = "deps",
visibility = ["//src/gpu/ganesh:__pkg__"],
- deps = [
- "@dawn",
- ],
+ deps = select({
+ # Dawn headers and symbols are provided by Emscripten in a WASM build. We depend on Dawn
+ # only for native.
+ "//bazel/common_config_settings:cpu_wasm": [],
+ "//conditions:default": ["@dawn"],
+ }),
)
diff --git a/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnBuffer.cpp b/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnBuffer.cpp
index 81141ca94a5..e5be5c069bf 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnBuffer.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnBuffer.cpp
@@ -46,6 +46,15 @@ sk_sp<GrDawnBuffer> GrDawnBuffer::Make(GrDawnGpu* gpu,
mappable = Mappable::kWriteOnly;
}
+ if (mappable == Mappable::kNot) {
+ // onMap can still succeed by using a staging buffer that gets transferred to the real
+ // buffer. updateData will use this same mechanism ("map", copy to staging buffer, "unmap").
+ // The transfer must be 4 byte aligned. So ensure the real size of the buffer is 4 byte
+ // aligned.
+ bufferDesc.size = SkAlign4(bufferDesc.size);
+ SkASSERT(gpu->caps()->transferFromBufferToBufferAlignment() == 4);
+ }
+
wgpu::Buffer buffer;
void* mapPtr = nullptr;
if (mappable == Mappable::kNot || mappable == Mappable::kReadOnly) {
@@ -85,61 +94,89 @@ GrDawnBuffer::GrDawnBuffer(GrDawnGpu* gpu,
this->registerWithCache(SkBudgeted::kYes);
}
-void GrDawnBuffer::onMap() {
- if (this->wasDestroyed()) {
- return;
- }
-
+void* GrDawnBuffer::internalMap(MapType type, size_t offset, size_t size) {
if (fUnmapped) {
SkASSERT(fMappable != Mappable::kNot);
- if (!this->blockingMap()) {
+ void* ptr = this->blockingMap(offset, size);
+ if (!ptr) {
SkDebugf("GrDawnBuffer: failed to map buffer\n");
- return;
+ return nullptr;
}
fUnmapped = false;
+ return SkTAddOffset<void>(ptr, offset);
}
if (fMappable == Mappable::kNot) {
+ // Dawn requires that the offset and size be 4 byte aligned. If the offset is not
+ // then we logically align the staging slice with the previous aligned value, adjust
+ // the pointer into the slice that we return. We'll do the same adjustment when issuing the
+ // transfer in internalUnmap so that the data winds up at the right offset.
+ size_t r = offset & 0x3;
+ size += r;
+ SkASSERT(type == MapType::kWriteDiscard);
GrStagingBufferManager::Slice slice =
this->getDawnGpu()->stagingBufferManager()->allocateStagingBufferSlice(
- this->size());
+ size, /*requiredAlignment=*/4);
fStagingBuffer = static_cast<GrDawnBuffer*>(slice.fBuffer)->get();
fStagingOffset = slice.fOffset;
- fMapPtr = slice.fOffsetMapPtr;
- } else {
- // We always create this buffers mapped or if they've been used on the gpu before we use the
- // async map callback to know when it is safe to reuse them. Thus by the time we get here
- // the buffer should always be mapped.
- SkASSERT(this->isMapped());
+ return SkTAddOffset<void>(slice.fOffsetMapPtr, r);
}
-}
-void GrDawnBuffer::onUnmap() {
- if (this->wasDestroyed()) {
- return;
- }
+ // We always create this buffers mapped or if they've been used on the gpu before we use the
+ // async map callback to know when it is safe to reuse them. Thus by the time we get here
+ // the buffer should always be mapped.
+ SkASSERT(this->isMapped());
+ return SkTAddOffset<void>(fMapPtr, offset);
+}
+void GrDawnBuffer::internalUnmap(MapType type, size_t offset, size_t size) {
if (fMappable == Mappable::kNot) {
+ SkASSERT(type == MapType::kWriteDiscard);
+ // See comment in internalMap() about this adjustment.
+ size_t r = offset & 0x3;
+ offset -= r;
+ size = SkAlign4(size + r);
this->getDawnGpu()->getCopyEncoder().CopyBufferToBuffer(fStagingBuffer, fStagingOffset,
- fBuffer, 0, this->size());
+ fBuffer, offset, size);
} else {
fBuffer.Unmap();
fUnmapped = true;
}
}
-bool GrDawnBuffer::onUpdateData(const void* src, size_t srcSizeInBytes) {
+void GrDawnBuffer::onRelease() {
if (this->wasDestroyed()) {
- return false;
+ return;
}
- this->map();
- if (!this->isMapped()) {
+ if (fMapPtr && fMappable != Mappable::kNot) {
+ fBuffer.Unmap();
+ fMapPtr = nullptr;
+ fUnmapped = true;
+ }
+
+ this->GrGpuBuffer::onRelease();
+}
+
+void GrDawnBuffer::onMap(MapType type) {
+ fMapPtr = this->internalMap(type, 0, this->size());
+}
+
+void GrDawnBuffer::onUnmap(MapType type) {
+ this->internalUnmap(type, 0, this->size());
+}
+
+bool GrDawnBuffer::onUpdateData(const void* src, size_t offset, size_t size, bool /*preserve*/) {
+ // Note that this subclass's impl of kWriteDiscard never actually discards.
+ void* ptr = this->internalMap(MapType::kWriteDiscard, offset, size);
+ if (!ptr) {
return false;
}
- memcpy(fMapPtr, src, srcSizeInBytes);
- this->unmap();
+ memcpy(ptr, src, size);
+
+ this->internalUnmap(MapType::kWriteDiscard, offset, size);
+
return true;
}
@@ -189,12 +226,49 @@ void GrDawnBuffer::mapAsyncDone(WGPUBufferMapAsyncStatus status) {
callback(this->isMapped());
}
-bool GrDawnBuffer::blockingMap() {
+void* GrDawnBuffer::blockingMap(size_t offset, size_t size) {
SkASSERT(fMappable != Mappable::kNot);
- GrDawnAsyncWait wait(this->getDawnGpu()->device());
- this->mapAsync([&wait](bool) { wait.signal(); });
- wait.busyWait();
+ struct Context {
+ GrDawnBuffer* buffer;
+ void* result;
+ GrDawnAsyncWait wait;
+ };
+
+ Context context{this, nullptr, GrDawnAsyncWait{this->getDawnGpu()->device()}};
+
+ // The offset must be a multiple of 8. If not back it up to the previous 8 byte multiple
+ // and compensate by extending the size. In either case size must be a multiple of 4.
+ SkASSERT(SkIsAlign4(offset));
+ size_t r = offset & 0x7;
+ offset -= r;
+ size = SkAlign4(size + r);
+
+ fBuffer.MapAsync(
+ (fMappable == Mappable::kReadOnly) ? wgpu::MapMode::Read : wgpu::MapMode::Write,
+ offset,
+ size,
+ [](WGPUBufferMapAsyncStatus status, void* userData) {
+ auto* context = static_cast<Context*>(userData);
+ if (status != WGPUBufferMapAsyncStatus_Success) {
+ context->result = nullptr;
+ context->wait.signal();
+ return;
+ }
+ auto* wgpuBuffer = &context->buffer->fBuffer;
+ if (context->buffer->fMappable == Mappable::kReadOnly) {
+ context->result = const_cast<void*>(wgpuBuffer->GetConstMappedRange());
+ } else {
+ context->result = wgpuBuffer->GetMappedRange();
+ }
+ if (context->result) {
+ context->buffer->fUnmapped = false;
+ }
+ context->wait.signal();
+ },
+ &context);
+
+ context.wait.busyWait();
- return this->isMapped();
+ return context.result ? SkTAddOffset<void>(context.result, r) : nullptr;
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnBuffer.h b/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnBuffer.h
index d2c8c5892bd..24d59eb7663 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnBuffer.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnBuffer.h
@@ -71,9 +71,10 @@ public:
std::string_view label);
~GrDawnBuffer() override = default;
- void onMap() override;
- void onUnmap() override;
- bool onUpdateData(const void* src, size_t srcSizeInBytes) override;
+ void onMap(MapType) override;
+ void onUnmap(MapType) override;
+ void onRelease() override;
+ bool onUpdateData(const void* src, size_t offset, size_t size, bool preserve) override;
GrDawnGpu* getDawnGpu() const;
wgpu::Buffer get() const { return fBuffer; }
@@ -115,6 +116,9 @@ private:
wgpu::Buffer buffer,
void* mapPtr);
+ void* internalMap(MapType type, size_t offset, size_t size);
+ void internalUnmap(MapType type, size_t offset, size_t size);
+
// Called to handle the asynchronous mapAsync callback.
void mapAsyncDone(WGPUBufferMapAsyncStatus status);
@@ -128,10 +132,10 @@ private:
//
// This procedure is used to cover the case where a buffer that is not managed by a
// GrStagingBufferManager (and thus not asynchronously mapped by the owning GrDawnGpu) is
- // unmapped and needs to get re-mapped for use.
+ // unmapped and needs to get re-mapped for use (e.g. in onUpdateData()).
//
- // Returns false if the buffer fails to map.
- bool blockingMap();
+ // Returns nullptr if the buffer fails to map.
+ void* blockingMap(size_t offset, size_t size);
wgpu::Buffer fBuffer;
Mappable fMappable = Mappable::kNot;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnCaps.cpp b/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnCaps.cpp
index 026ec38b241..10e0bae9ec3 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnCaps.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnCaps.cpp
@@ -33,6 +33,12 @@ GrDawnCaps::GrDawnCaps(const GrContextOptions& contextOptions) : INHERITED(conte
fShaderCaps->fMaxFragmentSamplers = 6;
fShaderCaps->fShaderDerivativeSupport = true;
+ // We haven't yet implemented GrGpu::transferFromBufferToBuffer for Dawn but GrDawnBuffer uses
+ // transfers to implement buffer mapping and updates and transfers must be 4 byte aligned.
+ fTransferFromBufferToBufferAlignment = 4;
+ // Buffer updates are sometimes implemented through transfers in GrDawnBuffer.
+ fBufferUpdateDataPreserveAlignment = 4;
+
this->finishInitialization(contextOptions);
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnGpu.cpp b/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnGpu.cpp
index 59db0d5ba26..bb78fd0b3cf 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnGpu.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnGpu.cpp
@@ -204,6 +204,16 @@ bool GrDawnGpu::onWritePixels(GrSurface* surface,
return true;
}
+bool GrDawnGpu::onTransferFromBufferToBuffer(sk_sp<GrGpuBuffer> src,
+ size_t srcOffset,
+ sk_sp<GrGpuBuffer> dst,
+ size_t dstOffset,
+ size_t size) {
+ // skbug.com/13453
+ SkASSERT(!"unimplemented");
+ return false;
+}
+
bool GrDawnGpu::onTransferPixelsTo(GrTexture* texture,
SkIRect rect,
GrColorType textureColorType,
@@ -211,6 +221,7 @@ bool GrDawnGpu::onTransferPixelsTo(GrTexture* texture,
sk_sp<GrGpuBuffer> transferBuffer,
size_t bufferOffset,
size_t rowBytes) {
+ // skbug.com/13453
SkASSERT(!"unimplemented");
return false;
}
@@ -221,6 +232,7 @@ bool GrDawnGpu::onTransferPixelsFrom(GrSurface* surface,
GrColorType bufferColorType,
sk_sp<GrGpuBuffer> transferBuffer,
size_t offset) {
+ // skbug.com/13453
SkASSERT(!"unimplemented");
return false;
}
@@ -269,7 +281,7 @@ sk_sp<GrTexture> GrDawnGpu::onWrapBackendTexture(const GrBackendTexture& backend
SkISize dimensions = { backendTex.width(), backendTex.height() };
return GrDawnTexture::MakeWrapped(this, dimensions, GrRenderable::kNo, 1, cacheable, ioType,
- info);
+ info, backendTex.getLabel());
}
sk_sp<GrTexture> GrDawnGpu::onWrapCompressedBackendTexture(const GrBackendTexture& backendTex,
@@ -294,7 +306,8 @@ sk_sp<GrTexture> GrDawnGpu::onWrapRenderableBackendTexture(const GrBackendTextur
}
sk_sp<GrTexture> result = GrDawnTexture::MakeWrapped(this, dimensions, GrRenderable::kYes,
- sampleCnt, cacheable, kRW_GrIOType, info);
+ sampleCnt, cacheable, kRW_GrIOType, info,
+ tex.getLabel());
result->markMipmapsDirty();
return result;
}
@@ -307,7 +320,8 @@ sk_sp<GrRenderTarget> GrDawnGpu::onWrapBackendRenderTarget(const GrBackendRender
SkISize dimensions = { rt.width(), rt.height() };
int sampleCnt = 1;
- return GrDawnRenderTarget::MakeWrapped(this, dimensions, sampleCnt, info);
+ return GrDawnRenderTarget::MakeWrapped(
+ this, dimensions, sampleCnt, info, /*label=*/"DawnGpu_WrapBackendRenderTarget");
}
sk_sp<GrAttachment> GrDawnGpu::makeStencilAttachment(const GrBackendFormat& /*colorFormat*/,
@@ -979,7 +993,7 @@ std::string GrDawnGpu::SkSLToSPIRV(const char* shaderString,
uint32_t rtFlipOffset,
SkSL::Program::Inputs* inputs) {
auto errorHandler = this->getContext()->priv().getShaderErrorHandler();
- SkSL::Program::Settings settings;
+ SkSL::ProgramSettings settings;
settings.fRTFlipOffset = rtFlipOffset;
settings.fRTFlipBinding = 0;
settings.fRTFlipSet = 0;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnGpu.h b/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnGpu.h
index 36b74fe9be8..b2bae0f1800 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnGpu.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnGpu.h
@@ -178,6 +178,12 @@ private:
int mipLevelCount,
bool) override;
+ bool onTransferFromBufferToBuffer(sk_sp<GrGpuBuffer> src,
+ size_t srcOffset,
+ sk_sp<GrGpuBuffer> dst,
+ size_t dstOffset,
+ size_t size) override;
+
bool onTransferPixelsTo(GrTexture*,
SkIRect,
GrColorType textureColorType,
diff --git a/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnProgramBuilder.cpp b/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnProgramBuilder.cpp
index c7b734eccb3..8c5c0e9a668 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnProgramBuilder.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnProgramBuilder.cpp
@@ -13,6 +13,7 @@
#include "src/gpu/ganesh/dawn/GrDawnGpu.h"
#include "src/gpu/ganesh/dawn/GrDawnTexture.h"
#include "src/gpu/ganesh/effects/GrTextureEffect.h"
+#include "src/sksl/SkSLCompiler.h"
#include "src/utils/SkShaderUtils.h"
static wgpu::BlendFactor to_dawn_blend_factor(skgpu::BlendCoeff coeff) {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnProgramBuilder.h b/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnProgramBuilder.h
index c2b18ff51be..09d58e2013e 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnProgramBuilder.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnProgramBuilder.h
@@ -11,7 +11,7 @@
#include "src/gpu/ganesh/GrSPIRVUniformHandler.h"
#include "src/gpu/ganesh/GrSPIRVVaryingHandler.h"
#include "src/gpu/ganesh/dawn/GrDawnProgramDataManager.h"
-#include "src/sksl/SkSLCompiler.h"
+#include "src/sksl/ir/SkSLProgram.h"
#include "webgpu/webgpu_cpp.h"
#include "src/gpu/ganesh/glsl/GrGLSLProgramBuilder.h"
@@ -19,6 +19,8 @@
class GrPipeline;
+namespace SkSL { class Compiler; }
+
struct GrDawnProgram : public SkRefCnt {
struct RenderTargetState {
SkISize fRenderTargetSize;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnRenderTarget.cpp b/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnRenderTarget.cpp
index 21709f2f31c..5195c8f23a5 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnRenderTarget.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnRenderTarget.cpp
@@ -23,10 +23,10 @@ GrDawnRenderTarget::GrDawnRenderTarget(GrDawnGpu* gpu,
sk_sp<GrDawnRenderTarget> GrDawnRenderTarget::MakeWrapped(GrDawnGpu* gpu,
SkISize dimensions,
int sampleCnt,
- const GrDawnRenderTargetInfo& info) {
+ const GrDawnRenderTargetInfo& info,
+ std::string_view label) {
sk_sp<GrDawnRenderTarget> rt(
- new GrDawnRenderTarget(gpu, dimensions, sampleCnt, info,
- /*label=*/"DawnRenderTarget_MakeWrapped"));
+ new GrDawnRenderTarget(gpu, dimensions, sampleCnt, info, label));
rt->registerWithCacheWrapped(GrWrapCacheable::kNo);
return rt;
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnRenderTarget.h b/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnRenderTarget.h
index 8169f29ff0a..96e569ca728 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnRenderTarget.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnRenderTarget.h
@@ -18,7 +18,8 @@ public:
static sk_sp<GrDawnRenderTarget> MakeWrapped(GrDawnGpu*,
SkISize dimensions,
int sampleCnt,
- const GrDawnRenderTargetInfo&);
+ const GrDawnRenderTargetInfo&,
+ std::string_view label);
~GrDawnRenderTarget() override;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnTexture.cpp b/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnTexture.cpp
index 241715ad45c..a6181e751e2 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnTexture.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnTexture.cpp
@@ -75,15 +75,16 @@ GrBackendFormat GrDawnTexture::backendFormat() const {
sk_sp<GrDawnTexture> GrDawnTexture::MakeWrapped(GrDawnGpu* gpu, SkISize dimensions,
GrRenderable renderable, int sampleCnt,
GrWrapCacheable cacheable, GrIOType ioType,
- const GrDawnTextureInfo& info) {
+ const GrDawnTextureInfo& info,
+ std::string_view label) {
sk_sp<GrDawnTexture> tex;
GrMipmapStatus status = info.fLevelCount > 1 ? GrMipmapStatus::kValid
: GrMipmapStatus::kNotAllocated;
if (GrRenderable::kYes == renderable) {
tex = sk_sp<GrDawnTexture>(new GrDawnTextureRenderTarget(
- gpu, dimensions, sampleCnt, info, status, /*label=*/{}));
+ gpu, dimensions, sampleCnt, info, status, label));
} else {
- tex = sk_sp<GrDawnTexture>(new GrDawnTexture(gpu, dimensions, info, status, /*label=*/{}));
+ tex = sk_sp<GrDawnTexture>(new GrDawnTexture(gpu, dimensions, info, status, label));
}
tex->registerWithCacheWrapped(cacheable);
if (ioType == kRead_GrIOType) {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnTexture.h b/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnTexture.h
index 56d7a696d13..b2fe46dc84c 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnTexture.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/dawn/GrDawnTexture.h
@@ -27,7 +27,7 @@ public:
static sk_sp<GrDawnTexture> MakeWrapped(GrDawnGpu*, SkISize dimensions, GrRenderable,
int sampleCnt, GrWrapCacheable, GrIOType,
- const GrDawnTextureInfo&);
+ const GrDawnTextureInfo&, std::string_view label);
~GrDawnTexture() override;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/effects/GrBezierEffect.cpp b/chromium/third_party/skia/src/gpu/ganesh/effects/GrBezierEffect.cpp
index 3c163728e1b..b9ffc8b000a 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/effects/GrBezierEffect.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/effects/GrBezierEffect.cpp
@@ -177,7 +177,7 @@ GrConicEffect::GrConicEffect(const SkPMColor4f& color, const SkMatrix& viewMatri
, fLocalMatrix(viewMatrix)
, fUsesLocalCoords(usesLocalCoords)
, fCoverageScale(coverage) {
- this->setVertexAttributesWithImplicitOffsets(kAttributes, SK_ARRAY_COUNT(kAttributes));
+ this->setVertexAttributesWithImplicitOffsets(kAttributes, std::size(kAttributes));
}
//////////////////////////////////////////////////////////////////////////////
@@ -330,7 +330,7 @@ GrQuadEffect::GrQuadEffect(const SkPMColor4f& color, const SkMatrix& viewMatrix,
, fLocalMatrix(localMatrix)
, fUsesLocalCoords(usesLocalCoords)
, fCoverageScale(coverage) {
- this->setVertexAttributesWithImplicitOffsets(kAttributes, SK_ARRAY_COUNT(kAttributes));
+ this->setVertexAttributesWithImplicitOffsets(kAttributes, std::size(kAttributes));
}
//////////////////////////////////////////////////////////////////////////////
diff --git a/chromium/third_party/skia/src/gpu/ganesh/effects/GrBlendFragmentProcessor.cpp b/chromium/third_party/skia/src/gpu/ganesh/effects/GrBlendFragmentProcessor.cpp
index 591d5ebbb75..207c930a1f6 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/effects/GrBlendFragmentProcessor.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/effects/GrBlendFragmentProcessor.cpp
@@ -69,10 +69,19 @@ private:
OptimizationFlags flags;
switch (mode) {
case SkBlendMode::kClear:
+ flags = kNone_OptimizationFlags;
+ break;
+
+ // Just propagates src, and its flags:
case SkBlendMode::kSrc:
+ flags = ProcessorOptimizationFlags(src) &
+ ~kConstantOutputForConstantInput_OptimizationFlag;
+ break;
+
+ // Just propagates dst, and its flags:
case SkBlendMode::kDst:
- SkDEBUGFAIL("Shouldn't have created a Blend FP as 'clear', 'src', or 'dst'.");
- flags = kNone_OptimizationFlags;
+ flags = ProcessorOptimizationFlags(dst) &
+ ~kConstantOutputForConstantInput_OptimizationFlag;
break;
// Produces opaque if both src and dst are opaque. These also will modulate the child's
@@ -192,10 +201,8 @@ std::unique_ptr<GrFragmentProcessor> BlendFragmentProcessor::TestCreate(GrProces
}
bool shareLogic = d->fRandom->nextBool();
- SkBlendMode mode;
- do {
- mode = static_cast<SkBlendMode>(d->fRandom->nextRangeU(0, (int)SkBlendMode::kLastMode));
- } while (SkBlendMode::kClear == mode || SkBlendMode::kSrc == mode || SkBlendMode::kDst == mode);
+ SkBlendMode mode =
+ static_cast<SkBlendMode>(d->fRandom->nextRangeU(0, (int)SkBlendMode::kLastMode));
return std::unique_ptr<GrFragmentProcessor>(
new BlendFragmentProcessor(std::move(src), std::move(dst), mode, shareLogic));
}
@@ -257,15 +264,10 @@ std::unique_ptr<GrFragmentProcessor> GrBlendFragmentProcessor::Make(
std::unique_ptr<GrFragmentProcessor> dst,
SkBlendMode mode,
bool shareBlendLogic) {
- switch (mode) {
- case SkBlendMode::kClear:
- return GrFragmentProcessor::MakeColor(SK_PMColor4fTRANSPARENT);
- case SkBlendMode::kSrc:
- return src;
- case SkBlendMode::kDst:
- return dst;
- default:
- return BlendFragmentProcessor::Make(
- std::move(src), std::move(dst), mode, shareBlendLogic);
+ // These modes simplify dramatically in the shader, but only if we bypass the shared logic:
+ if (mode == SkBlendMode::kClear || mode == SkBlendMode::kSrc || mode == SkBlendMode::kDst) {
+ shareBlendLogic = false;
}
+
+ return BlendFragmentProcessor::Make(std::move(src), std::move(dst), mode, shareBlendLogic);
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/effects/GrDistanceFieldGeoProc.cpp b/chromium/third_party/skia/src/gpu/ganesh/effects/GrDistanceFieldGeoProc.cpp
index 63a5d4b05bd..db9f42ab09c 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/effects/GrDistanceFieldGeoProc.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/effects/GrDistanceFieldGeoProc.cpp
@@ -321,9 +321,9 @@ public:
const GrGeometryProcessor& geomProc) override {
const GrDistanceFieldPathGeoProc& dfpgp = geomProc.cast<GrDistanceFieldPathGeoProc>();
- // We always set the matrix uniform; it's either used to transform from local to device
- // for the output position, or from device to local for the local coord variable.
- SetTransform(pdman, shaderCaps, fMatrixUniform, dfpgp.fMatrix, &fMatrix);
+ // We always set the matrix uniform. It's used to transform from from device to local
+ // for the local coord variable.
+ SetTransform(pdman, shaderCaps, fLocalMatrixUniform, dfpgp.fLocalMatrix, &fLocalMatrix);
const SkISize& atlasDimensions = dfpgp.fAtlasDimensions;
SkASSERT(SkIsPow2(atlasDimensions.fWidth) && SkIsPow2(atlasDimensions.fHeight));
@@ -370,27 +370,15 @@ private:
varyingHandler->addPassThroughAttribute(dfPathEffect.fInColor.asShaderVar(),
args.fOutputColor);
- if (dfPathEffect.fMatrix.hasPerspective()) {
- // Setup position (output position is transformed, local coords are pass through)
- WriteOutputPosition(vertBuilder,
- uniformHandler,
- *args.fShaderCaps,
- gpArgs,
- dfPathEffect.fInPosition.name(),
- dfPathEffect.fMatrix,
- &fMatrixUniform);
- gpArgs->fLocalCoordVar = dfPathEffect.fInPosition.asShaderVar();
- } else {
- // Setup position (output position is pass through, local coords are transformed)
- WriteOutputPosition(vertBuilder, gpArgs, dfPathEffect.fInPosition.name());
- WriteLocalCoord(vertBuilder,
- uniformHandler,
- *args.fShaderCaps,
- gpArgs,
- dfPathEffect.fInPosition.asShaderVar(),
- dfPathEffect.fMatrix,
- &fMatrixUniform);
- }
+ // Setup position (output position is pass through, local coords are transformed)
+ gpArgs->fPositionVar = dfPathEffect.fInPosition.asShaderVar();
+ WriteLocalCoord(vertBuilder,
+ uniformHandler,
+ *args.fShaderCaps,
+ gpArgs,
+ gpArgs->fPositionVar,
+ dfPathEffect.fLocalMatrix,
+ &fLocalMatrixUniform);
// Use highp to work around aliasing issues
fragBuilder->codeAppendf("float2 uv = %s;", uv.fsIn());
@@ -467,8 +455,8 @@ private:
fragBuilder->codeAppendf("half4 %s = half4(val);", args.fOutputCoverage);
}
- SkMatrix fMatrix; // view matrix if perspective, local matrix otherwise
- UniformHandle fMatrixUniform;
+ SkMatrix fLocalMatrix;
+ UniformHandle fLocalMatrixUniform;
SkISize fAtlasDimensions;
UniformHandle fAtlasDimensionsInvUniform;
@@ -479,20 +467,19 @@ private:
///////////////////////////////////////////////////////////////////////////////
GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc(const GrShaderCaps& caps,
- const SkMatrix& matrix,
- bool wideColor,
const GrSurfaceProxyView* views,
int numViews,
GrSamplerState params,
+ const SkMatrix& localMatrix,
uint32_t flags)
: INHERITED(kGrDistanceFieldPathGeoProc_ClassID)
- , fMatrix(matrix)
- , fFlags(flags & kNonLCD_DistanceFieldEffectMask) {
+ , fLocalMatrix(localMatrix)
+ , fFlags(flags & kPath_DistanceFieldEffectMask) {
SkASSERT(numViews <= kMaxTextures);
- SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask));
+ SkASSERT(!(flags & ~kPath_DistanceFieldEffectMask));
- fInPosition = {"inPosition", kFloat2_GrVertexAttribType, SkSLType::kFloat2};
- fInColor = MakeColorAttribute("inColor", wideColor);
+ fInPosition = {"inPosition", kFloat3_GrVertexAttribType, SkSLType::kFloat3};
+ fInColor = MakeColorAttribute("inColor", SkToBool(flags & kWideColor_DistanceFieldEffectFlag));
fInTextureCoords = {"inTextureCoords", kUShort2_GrVertexAttribType,
caps.fIntegerSupport ? SkSLType::kUShort2 : SkSLType::kFloat2};
this->setVertexAttributesWithImplicitOffsets(&fInPosition, 3);
@@ -535,8 +522,8 @@ void GrDistanceFieldPathGeoProc::addNewViews(const GrSurfaceProxyView* views,
void GrDistanceFieldPathGeoProc::addToKey(const GrShaderCaps& caps,
skgpu::KeyBuilder* b) const {
uint32_t key = fFlags;
- key |= ProgramImpl::ComputeMatrixKey(caps, fMatrix) << 16;
- key |= fMatrix.hasPerspective() << (16 + ProgramImpl::kMatrixKeyBits);
+ key |= ProgramImpl::ComputeMatrixKey(caps, fLocalMatrix) << 16;
+ key |= fLocalMatrix.hasPerspective() << (16 + ProgramImpl::kMatrixKeyBits);
b->add32(key);
b->add32(this->numTextureSamplers());
}
@@ -565,13 +552,12 @@ GrGeometryProcessor* GrDistanceFieldPathGeoProc::TestCreate(GrProcessorTestData*
if (flags & kSimilarity_DistanceFieldEffectFlag) {
flags |= d->fRandom->nextBool() ? kScaleOnly_DistanceFieldEffectFlag : 0;
}
+ flags |= d->fRandom->nextBool() ? kWideColor_DistanceFieldEffectFlag : 0;
SkMatrix localMatrix = GrTest::TestMatrix(d->fRandom);
- bool wideColor = d->fRandom->nextBool();
return GrDistanceFieldPathGeoProc::Make(d->allocator(), *d->caps()->shaderCaps(),
- localMatrix,
- wideColor,
&view, 1,
samplerState,
+ localMatrix,
flags);
}
#endif
diff --git a/chromium/third_party/skia/src/gpu/ganesh/effects/GrDistanceFieldGeoProc.h b/chromium/third_party/skia/src/gpu/ganesh/effects/GrDistanceFieldGeoProc.h
index f0625afbe2e..0e63538c6cf 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/effects/GrDistanceFieldGeoProc.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/effects/GrDistanceFieldGeoProc.h
@@ -18,16 +18,17 @@ class GrGLDistanceFieldLCDTextGeoProc;
class GrInvariantOutput;
enum GrDistanceFieldEffectFlags {
- kSimilarity_DistanceFieldEffectFlag = 0x01, // ctm is similarity matrix
- kScaleOnly_DistanceFieldEffectFlag = 0x02, // ctm has only scale and translate
- kPerspective_DistanceFieldEffectFlag = 0x04, // ctm has perspective (and positions are x,y,w)
- kUseLCD_DistanceFieldEffectFlag = 0x08, // use lcd text
- kBGR_DistanceFieldEffectFlag = 0x10, // lcd display has bgr order
- kPortrait_DistanceFieldEffectFlag = 0x20, // lcd display is in portrait mode (not used yet)
- kGammaCorrect_DistanceFieldEffectFlag = 0x40, // assume gamma-correct output (linear blending)
- kAliased_DistanceFieldEffectFlag = 0x80, // monochrome output
-
- kInvalid_DistanceFieldEffectFlag = 0x100, // invalid state (for initialization)
+ kSimilarity_DistanceFieldEffectFlag = 0x001, // ctm is similarity matrix
+ kScaleOnly_DistanceFieldEffectFlag = 0x002, // ctm has only scale and translate
+ kPerspective_DistanceFieldEffectFlag = 0x004, // ctm has perspective (and positions are x,y,w)
+ kUseLCD_DistanceFieldEffectFlag = 0x008, // use lcd text
+ kBGR_DistanceFieldEffectFlag = 0x010, // lcd display has bgr order
+ kPortrait_DistanceFieldEffectFlag = 0x020, // lcd display is in portrait mode (not used yet)
+ kGammaCorrect_DistanceFieldEffectFlag = 0x040, // assume gamma-correct output (linear blending)
+ kAliased_DistanceFieldEffectFlag = 0x080, // monochrome output
+ kWideColor_DistanceFieldEffectFlag = 0x100, // use wide color (only for path)
+
+ kInvalid_DistanceFieldEffectFlag = 0x200, // invalid state (for initialization)
kUniformScale_DistanceFieldEffectMask = kSimilarity_DistanceFieldEffectFlag |
kScaleOnly_DistanceFieldEffectFlag,
@@ -37,6 +38,13 @@ enum GrDistanceFieldEffectFlags {
kPerspective_DistanceFieldEffectFlag |
kGammaCorrect_DistanceFieldEffectFlag |
kAliased_DistanceFieldEffectFlag,
+ // The subset of the flags relevant to GrDistanceFieldPathGeoProc
+ kPath_DistanceFieldEffectMask = kSimilarity_DistanceFieldEffectFlag |
+ kScaleOnly_DistanceFieldEffectFlag |
+ kPerspective_DistanceFieldEffectFlag |
+ kGammaCorrect_DistanceFieldEffectFlag |
+ kAliased_DistanceFieldEffectFlag |
+ kWideColor_DistanceFieldEffectFlag,
// The subset of the flags relevant to GrDistanceFieldLCDTextGeoProc
kLCD_DistanceFieldEffectMask = kSimilarity_DistanceFieldEffectFlag |
kScaleOnly_DistanceFieldEffectFlag |
@@ -139,12 +147,12 @@ public:
/** The local matrix should be identity if local coords are not required by the GrPipeline. */
static GrGeometryProcessor* Make(SkArenaAlloc* arena, const GrShaderCaps& caps,
- const SkMatrix& matrix, bool wideColor,
const GrSurfaceProxyView* views, int numActiveViews,
- GrSamplerState params, uint32_t flags) {
+ GrSamplerState params, const SkMatrix& localMatrix,
+ uint32_t flags) {
return arena->make([&](void* ptr) {
- return new (ptr) GrDistanceFieldPathGeoProc(caps, matrix, wideColor, views,
- numActiveViews, params, flags);
+ return new (ptr) GrDistanceFieldPathGeoProc(caps, views, numActiveViews,
+ params, localMatrix, flags);
});
}
@@ -162,16 +170,15 @@ private:
class Impl;
GrDistanceFieldPathGeoProc(const GrShaderCaps& caps,
- const SkMatrix& matrix,
- bool wideColor,
const GrSurfaceProxyView* views,
int numActiveViews,
GrSamplerState,
+ const SkMatrix& localMatrix,
uint32_t flags);
const TextureSampler& onTextureSampler(int i) const override { return fTextureSamplers[i]; }
- SkMatrix fMatrix; // view matrix if perspective, local matrix otherwise
+ SkMatrix fLocalMatrix;
TextureSampler fTextureSamplers[kMaxTextures];
SkISize fAtlasDimensions; // dimensions for all textures used with fTextureSamplers[].
Attribute fInPosition;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/effects/GrGaussianConvolutionFragmentProcessor.cpp b/chromium/third_party/skia/src/gpu/ganesh/effects/GrGaussianConvolutionFragmentProcessor.cpp
index 9facb0382fd..3d102404f7a 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/effects/GrGaussianConvolutionFragmentProcessor.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/effects/GrGaussianConvolutionFragmentProcessor.cpp
@@ -73,7 +73,7 @@ void GrGaussianConvolutionFragmentProcessor::Impl::emitCode(EmitArgs& args) {
std::string smoothBody = SkSL::String::printf("return %s * offsetAndKernel.y;", sample.c_str());
fragBuilder->emitFunction(SkSLType::kHalf4, smoothFuncName.c_str(),
- {smoothArgs, SK_ARRAY_COUNT(smoothArgs)},
+ {smoothArgs, std::size(smoothArgs)},
smoothBody.c_str());
// Implement the main() function.
@@ -107,7 +107,7 @@ void GrGaussianConvolutionFragmentProcessor::Impl::onSetData(const GrGLSLProgram
pdman.set2fv(fIncrementUni, 1, increment);
int kernelWidth = SkGpuBlurUtils::LinearKernelWidth(conv.fRadius);
- SkASSERT(kernelWidth <= (int)SK_ARRAY_COUNT(fOffsetsAndKernel));
+ SkASSERT(kernelWidth <= kMaxKernelWidth);
pdman.set2fv(fOffsetsAndKernelUni, kernelWidth, conv.fOffsetsAndKernel[0].ptr());
if (fKernelWidthUni.isValid()) {
pdman.set1i(fKernelWidthUni, kernelWidth);
diff --git a/chromium/third_party/skia/src/gpu/ganesh/effects/GrGaussianConvolutionFragmentProcessor.h b/chromium/third_party/skia/src/gpu/ganesh/effects/GrGaussianConvolutionFragmentProcessor.h
index ffbd717fd72..8fe4c07ce52 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/effects/GrGaussianConvolutionFragmentProcessor.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/effects/GrGaussianConvolutionFragmentProcessor.h
@@ -77,7 +77,7 @@ private:
GR_DECLARE_FRAGMENT_PROCESSOR_TEST
- inline static constexpr int kMaxKernelWidth = kMaxKernelRadius + 1;
+ inline static const constexpr int kMaxKernelWidth = kMaxKernelRadius + 1;
SkV2 fOffsetsAndKernel[kMaxKernelWidth];
int fRadius;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/effects/GrSkSLFP.cpp b/chromium/third_party/skia/src/gpu/ganesh/effects/GrSkSLFP.cpp
index 756407621e9..badeb1482ea 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/effects/GrSkSLFP.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/effects/GrSkSLFP.cpp
@@ -12,6 +12,7 @@
#include "include/private/gpu/ganesh/GrContext_Base.h"
#include "src/core/SkColorSpacePriv.h"
#include "src/core/SkRuntimeEffectPriv.h"
+#include "src/core/SkSLTypeShared.h"
#include "src/core/SkVM.h"
#include "src/gpu/KeyBuilder.h"
#include "src/gpu/ganesh/GrBaseContextPriv.h"
@@ -21,6 +22,7 @@
#include "src/gpu/ganesh/glsl/GrGLSLProgramBuilder.h"
#include "src/sksl/SkSLUtil.h"
#include "src/sksl/codegen/SkSLPipelineStageCodeGenerator.h"
+#include "src/sksl/ir/SkSLProgram.h"
#include "src/sksl/ir/SkSLVarDeclarations.h"
class GrSkSLFP::Impl : public ProgramImpl {
@@ -70,7 +72,7 @@ public:
if (*fSpecialized++ == Specialized::kYes) {
SkASSERTF(!isArray, "specializing array uniforms is not allowed");
- std::string value = GrGLSLTypeString(gpuType);
+ std::string value = SkSLTypeString(gpuType);
value.append("(");
bool isFloat = SkSLTypeIsFloatType(gpuType);
@@ -252,8 +254,8 @@ private:
const GrFragmentProcessor& _proc) override {
const GrSkSLFP& outer = _proc.cast<GrSkSLFP>();
pdman.setRuntimeEffectUniforms(outer.fEffect->uniforms(),
- SkMakeSpan(fUniformHandles),
- SkMakeSpan(outer.specialized(), outer.uniformCount()),
+ SkSpan(fUniformHandles),
+ SkSpan(outer.specialized(), outer.uniformCount()),
outer.uniformData());
}
@@ -397,7 +399,7 @@ void GrSkSLFP::onAddToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const
bool specialize = specialized[i] == Specialized::kYes;
b->addBool(specialize, "specialize");
if (specialize) {
- b->addBytes(iter->sizeInBytes(), uniformData + iter->offset, iter->name.c_str());
+ b->addBytes(iter->sizeInBytes(), uniformData + iter->offset, iter->name);
}
}
}
@@ -450,8 +452,9 @@ std::unique_ptr<GrFragmentProcessor> GrSkSLFP::TestCreate(GrProcessorTestData* d
c = d->fRandom->nextU();
}
auto filter = SkOverdrawColorFilter::MakeWithSkColors(colors);
+ SkSurfaceProps props; // default props for testing
auto [success, fp] = as_CFB(filter)->asFragmentProcessor(/*inputFP=*/nullptr, d->context(),
- GrColorInfo{});
+ GrColorInfo{}, props);
SkASSERT(success);
return std::move(fp);
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/effects/GrSkSLFP.h b/chromium/third_party/skia/src/gpu/ganesh/effects/GrSkSLFP.h
index d783836756b..f45329a1ab0 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/effects/GrSkSLFP.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/effects/GrSkSLFP.h
@@ -138,7 +138,7 @@ public:
* uniform data is directly copied into the footer allocated after the FP.
*/
template <typename... Args>
- static std::unique_ptr<GrSkSLFP> Make(sk_sp<SkRuntimeEffect> effect,
+ static std::unique_ptr<GrSkSLFP> Make(const SkRuntimeEffect* effect,
const char* name,
std::unique_ptr<GrFragmentProcessor> inputFP,
OptFlags optFlags,
@@ -155,9 +155,9 @@ public:
// factory should instead construct an GrColorSpaceXformEffect as part of the FP tree.
SkASSERT(!effect->usesColorTransform());
- size_t uniformPayloadSize = UniformPayloadSize(effect.get());
- std::unique_ptr<GrSkSLFP> fp(new (uniformPayloadSize)
- GrSkSLFP(std::move(effect), name, optFlags));
+ size_t uniformPayloadSize = UniformPayloadSize(effect);
+ std::unique_ptr<GrSkSLFP> fp(new (uniformPayloadSize) GrSkSLFP(sk_ref_sp(effect),
+ name, optFlags));
fp->appendArgs(fp->uniformData(), fp->specialized(), std::forward<Args>(args)...);
if (inputFP) {
fp->setInput(std::move(inputFP));
@@ -304,14 +304,17 @@ private:
uniform_iterator uEnd,
child_iterator cIter,
child_iterator cEnd) {
- SkASSERTF(uIter == uEnd, "Expected more uniforms, starting with '%s'", uIter->name.c_str());
- SkASSERTF(cIter == cEnd, "Expected more children, starting with '%s'", cIter->name.c_str());
+ SkASSERTF(uIter == uEnd,
+ "Expected more uniforms, starting with '%.*s'",
+ (int)uIter->name.size(), uIter->name.data());
+ SkASSERTF(cIter == cEnd, "Expected more children, starting with '%.*s'",
+ (int)cIter->name.size(), cIter->name.data());
}
static void checkOneChild(child_iterator cIter, child_iterator cEnd, const char* name) {
SkASSERTF(cIter != cEnd, "Too many children, wasn't expecting '%s'", name);
- SkASSERTF(cIter->name.equals(name),
- "Expected child '%s', got '%s' instead",
- cIter->name.c_str(), name);
+ SkASSERTF(cIter->name == name,
+ "Expected child '%.*s', got '%s' instead",
+ (int)cIter->name.size(), cIter->name.data(), name);
}
template <typename... Args>
static void checkArgs(uniform_iterator uIter,
@@ -373,9 +376,9 @@ private:
const T* /*val*/,
size_t valSize) {
SkASSERTF(uIter != uEnd, "Too many uniforms, wasn't expecting '%s'", name);
- SkASSERTF(uIter->name.equals(name),
- "Expected uniform '%s', got '%s' instead",
- uIter->name.c_str(), name);
+ SkASSERTF(uIter->name == name,
+ "Expected uniform '%.*s', got '%s' instead",
+ (int)uIter->name.size(), uIter->name.data(), name);
SkASSERTF(uIter->sizeInBytes() == valSize,
"Expected uniform '%s' to be %zu bytes, got %zu instead",
name, uIter->sizeInBytes(), valSize);
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/BUILD.bazel b/chromium/third_party/skia/src/gpu/ganesh/gl/BUILD.bazel
index a0e1846c4d0..b8f4a59392d 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/BUILD.bazel
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/BUILD.bazel
@@ -1,4 +1,4 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy", "split_srcs_and_hdrs")
+load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_deps", "split_srcs_and_hdrs")
licenses(["notice"])
@@ -81,7 +81,7 @@ filegroup(
visibility = ["//src/gpu/ganesh:__pkg__"],
)
-cc_library(
+skia_cc_deps(
name = "deps",
linkopts = select({
"@platforms//os:android": ["-landroid"],
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLAssembleGLESInterfaceAutogen.cpp b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLAssembleGLESInterfaceAutogen.cpp
index a6c45bfc672..e5585df211c 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLAssembleGLESInterfaceAutogen.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLAssembleGLESInterfaceAutogen.cpp
@@ -368,6 +368,12 @@ sk_sp<const GrGLInterface> GrGLMakeAssembledGLESInterface(void *ctx, GrGLGetProc
GET_PROC_SUFFIX(PushGroupMarker, EXT);
}
+ if (glVer >= GR_GL_VER(3,0)) {
+ GET_PROC(CopyBufferSubData);
+ } else if (extensions.has("GL_NV_copy_buffer")) {
+ GET_PROC_SUFFIX(CopyBufferSubData, NV);
+ }
+
if (extensions.has("GL_CHROMIUM_framebuffer_mixed_samples")) {
GET_PROC_SUFFIX(CoverageModulation, CHROMIUM);
} else if (extensions.has("GL_NV_framebuffer_mixed_samples")) {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLAssembleGLInterfaceAutogen.cpp b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLAssembleGLInterfaceAutogen.cpp
index 907c42c4d33..c8ed98f5b7f 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLAssembleGLInterfaceAutogen.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLAssembleGLInterfaceAutogen.cpp
@@ -363,6 +363,12 @@ sk_sp<const GrGLInterface> GrGLMakeAssembledGLInterface(void *ctx, GrGLGetProc g
GET_PROC_SUFFIX(PushGroupMarker, EXT);
}
+ if (glVer >= GR_GL_VER(3,1)) {
+ GET_PROC(CopyBufferSubData);
+ } else if (extensions.has("GL_ARB_copy_buffer")) {
+ GET_PROC(CopyBufferSubData);
+ }
+
if (extensions.has("GL_NV_framebuffer_mixed_samples")) {
GET_PROC_SUFFIX(CoverageModulation, NV);
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLAssembleWebGLInterfaceAutogen.cpp b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLAssembleWebGLInterfaceAutogen.cpp
index d09a6b23ebe..7fe3451eaa5 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLAssembleWebGLInterfaceAutogen.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLAssembleWebGLInterfaceAutogen.cpp
@@ -229,6 +229,10 @@ sk_sp<const GrGLInterface> GrGLMakeAssembledWebGLInterface(void *ctx, GrGLGetPro
}
if (glVer >= GR_GL_VER(2,0)) {
+ GET_PROC(CopyBufferSubData);
+ }
+
+ if (glVer >= GR_GL_VER(2,0)) {
GET_PROC(ClientWaitSync);
GET_PROC(DeleteSync);
GET_PROC(FenceSync);
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLBuffer.cpp b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLBuffer.cpp
index bd9c8a28e36..5a0ff039dbb 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLBuffer.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLBuffer.cpp
@@ -16,24 +16,18 @@
#define GL_CALL(X) GR_GL_CALL(this->glGpu()->glInterface(), X)
#define GL_CALL_RET(RET, X) GR_GL_CALL_RET(this->glGpu()->glInterface(), RET, X)
-#define GL_ALLOC_CALL(call) \
- [&] { \
- if (this->glGpu()->glCaps().skipErrorChecks()) { \
- GR_GL_CALL(this->glGpu()->glInterface(), call); \
- return static_cast<GrGLenum>(GR_GL_NO_ERROR); \
- } else { \
- this->glGpu()->clearErrorsAndCheckForOOM(); \
- GR_GL_CALL_NOERRCHECK(this->glGpu()->glInterface(), call); \
- return this->glGpu()->getErrorAndCheckForOOM(); \
- } \
+#define GL_ALLOC_CALL(gpu, call) \
+ [&] { \
+ if (gpu->glCaps().skipErrorChecks()) { \
+ GR_GL_CALL(gpu->glInterface(), call); \
+ return static_cast<GrGLenum>(GR_GL_NO_ERROR); \
+ } else { \
+ gpu->clearErrorsAndCheckForOOM(); \
+ GR_GL_CALL_NOERRCHECK(gpu->glInterface(), call); \
+ return gpu->getErrorAndCheckForOOM(); \
+ } \
}()
-#ifdef SK_DEBUG
-#define VALIDATE() this->validate()
-#else
-#define VALIDATE() do {} while(false)
-#endif
-
sk_sp<GrGLBuffer> GrGLBuffer::Make(GrGLGpu* gpu,
size_t size,
GrGpuBufferType intendedType,
@@ -115,22 +109,19 @@ GrGLBuffer::GrGLBuffer(GrGLGpu* gpu,
, fIntendedType(intendedType)
, fBufferID(0)
, fUsage(gr_to_gl_access_pattern(intendedType, accessPattern, gpu->glCaps()))
- , fGLSizeInBytes(0)
, fHasAttachedToTexture(false) {
GL_CALL(GenBuffers(1, &fBufferID));
- // We only need allocate the buffer if this may be the destination of a transfer. Other use
- // cases will always get an updateData() or map() call before use.
- if (fBufferID && fIntendedType == GrGpuBufferType::kXferGpuToCpu) {
+ if (fBufferID) {
GrGLenum target = gpu->bindBuffer(fIntendedType, this);
- GrGLenum error = GL_ALLOC_CALL(BufferData(target, (GrGLsizeiptr)size, nullptr, fUsage));
+ GrGLenum error = GL_ALLOC_CALL(this->glGpu(), BufferData(target,
+ (GrGLsizeiptr)size,
+ nullptr,
+ fUsage));
if (error != GR_GL_NO_ERROR) {
GL_CALL(DeleteBuffers(1, &fBufferID));
fBufferID = 0;
- } else {
- fGLSizeInBytes = size;
}
}
- VALIDATE();
this->registerWithCache(SkBudgeted::kYes);
if (!fBufferID) {
this->resourcePriv().removeScratchKey();
@@ -150,15 +141,12 @@ void GrGLBuffer::onRelease() {
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
if (!this->wasDestroyed()) {
- VALIDATE();
// make sure we've not been abandoned or already released
if (fBufferID) {
GL_CALL(DeleteBuffers(1, &fBufferID));
fBufferID = 0;
- fGLSizeInBytes = 0;
}
fMapPtr = nullptr;
- VALIDATE();
}
INHERITED::onRelease();
@@ -166,93 +154,81 @@ void GrGLBuffer::onRelease() {
void GrGLBuffer::onAbandon() {
fBufferID = 0;
- fGLSizeInBytes = 0;
fMapPtr = nullptr;
- VALIDATE();
INHERITED::onAbandon();
}
-void GrGLBuffer::onMap() {
+static inline GrGLenum SK_WARN_UNUSED_RESULT invalidate_buffer(GrGLGpu* gpu,
+ GrGLenum target,
+ GrGLenum usage,
+ GrGLuint bufferID,
+ size_t bufferSize) {
+ switch (gpu->glCaps().invalidateBufferType()) {
+ case GrGLCaps::InvalidateBufferType::kNone:
+ return GR_GL_NO_ERROR;
+ case GrGLCaps::InvalidateBufferType::kNullData:
+ return GL_ALLOC_CALL(gpu, BufferData(target, bufferSize, nullptr, usage));
+ case GrGLCaps::InvalidateBufferType::kInvalidate:
+ GR_GL_CALL(gpu->glInterface(), InvalidateBufferData(bufferID));
+ return GR_GL_NO_ERROR;
+ }
+ SkUNREACHABLE;
+}
+
+void GrGLBuffer::onMap(MapType type) {
SkASSERT(fBufferID);
SkASSERT(!this->wasDestroyed());
- VALIDATE();
SkASSERT(!this->isMapped());
- // TODO: Make this a function parameter.
- bool readOnly = (GrGpuBufferType::kXferGpuToCpu == fIntendedType);
-
// Handling dirty context is done in the bindBuffer call
switch (this->glCaps().mapBufferType()) {
case GrGLCaps::kNone_MapBufferType:
return;
case GrGLCaps::kMapBuffer_MapBufferType: {
GrGLenum target = this->glGpu()->bindBuffer(fIntendedType, this);
- if (!readOnly) {
- // Let driver know it can discard the old data
- if (this->glCaps().useBufferDataNullHint() || fGLSizeInBytes != this->size()) {
- GrGLenum error =
- GL_ALLOC_CALL(BufferData(target, this->size(), nullptr, fUsage));
- if (error != GR_GL_NO_ERROR) {
- return;
- }
+ if (type == MapType::kWriteDiscard) {
+ GrGLenum error = invalidate_buffer(this->glGpu(),
+ target,
+ fUsage,
+ fBufferID,
+ this->size());
+ if (error != GR_GL_NO_ERROR) {
+ return;
}
}
- GL_CALL_RET(fMapPtr, MapBuffer(target, readOnly ? GR_GL_READ_ONLY : GR_GL_WRITE_ONLY));
+ GrGLenum access = type == MapType::kRead ? GR_GL_READ_ONLY : GR_GL_WRITE_ONLY;
+ GL_CALL_RET(fMapPtr, MapBuffer(target, access));
break;
}
case GrGLCaps::kMapBufferRange_MapBufferType: {
GrGLenum target = this->glGpu()->bindBuffer(fIntendedType, this);
- // Make sure the GL buffer size agrees with fDesc before mapping.
- if (fGLSizeInBytes != this->size()) {
- GrGLenum error = GL_ALLOC_CALL(BufferData(target, this->size(), nullptr, fUsage));
- if (error != GR_GL_NO_ERROR) {
- return;
- }
- }
GrGLbitfield access;
- if (readOnly) {
- access = GR_GL_MAP_READ_BIT;
- } else {
- access = GR_GL_MAP_WRITE_BIT;
- if (GrGpuBufferType::kXferCpuToGpu != fIntendedType) {
- // TODO: Make this a function parameter.
- access |= GR_GL_MAP_INVALIDATE_BUFFER_BIT;
- }
+ switch (type) {
+ case MapType::kRead:
+ access = GR_GL_MAP_READ_BIT;
+ break;
+ case MapType::kWriteDiscard:
+ access = GR_GL_MAP_WRITE_BIT | GR_GL_MAP_INVALIDATE_BUFFER_BIT;
+ break;
}
GL_CALL_RET(fMapPtr, MapBufferRange(target, 0, this->size(), access));
break;
}
case GrGLCaps::kChromium_MapBufferType: {
GrGLenum target = this->glGpu()->bindBuffer(fIntendedType, this);
- // Make sure the GL buffer size agrees with fDesc before mapping.
- if (fGLSizeInBytes != this->size()) {
- GrGLenum error = GL_ALLOC_CALL(BufferData(target, this->size(), nullptr, fUsage));
- if (error != GR_GL_NO_ERROR) {
- return;
- }
- }
- GL_CALL_RET(fMapPtr, MapBufferSubData(target, 0, this->size(),
- readOnly ? GR_GL_READ_ONLY : GR_GL_WRITE_ONLY));
+ GrGLenum access = type == MapType::kRead ? GR_GL_READ_ONLY : GR_GL_WRITE_ONLY;
+ GL_CALL_RET(fMapPtr, MapBufferSubData(target, 0, this->size(), access));
break;
}
}
- fGLSizeInBytes = this->size();
- VALIDATE();
}
-void GrGLBuffer::onUnmap() {
+void GrGLBuffer::onUnmap(MapType) {
SkASSERT(fBufferID);
- VALIDATE();
- SkASSERT(this->isMapped());
- if (0 == fBufferID) {
- fMapPtr = nullptr;
- return;
- }
// bind buffer handles the dirty context
switch (this->glCaps().mapBufferType()) {
case GrGLCaps::kNone_MapBufferType:
- SkDEBUGFAIL("Shouldn't get here.");
- return;
+ SkUNREACHABLE;
case GrGLCaps::kMapBuffer_MapBufferType: // fall through
case GrGLCaps::kMapBufferRange_MapBufferType: {
GrGLenum target = this->glGpu()->bindBuffer(fIntendedType, this);
@@ -267,56 +243,18 @@ void GrGLBuffer::onUnmap() {
fMapPtr = nullptr;
}
-bool GrGLBuffer::onUpdateData(const void* src, size_t srcSizeInBytes) {
+bool GrGLBuffer::onUpdateData(const void* src, size_t offset, size_t size, bool preserve) {
SkASSERT(fBufferID);
- if (this->wasDestroyed()) {
- return false;
- }
- SkASSERT(!this->isMapped());
- VALIDATE();
- if (srcSizeInBytes > this->size()) {
- return false;
- }
- SkASSERT(srcSizeInBytes <= this->size());
// bindbuffer handles dirty context
GrGLenum target = this->glGpu()->bindBuffer(fIntendedType, this);
-
- if (this->glCaps().useBufferDataNullHint()) {
- if (this->size() == srcSizeInBytes) {
- GrGLenum error =
- GL_ALLOC_CALL(BufferData(target, (GrGLsizeiptr)srcSizeInBytes, src, fUsage));
- if (error != GR_GL_NO_ERROR) {
- return false;
- }
- } else {
- // Before we call glBufferSubData we give the driver a hint using
- // glBufferData with nullptr. This makes the old buffer contents
- // inaccessible to future draws. The GPU may still be processing
- // draws that reference the old contents. With this hint it can
- // assign a different allocation for the new contents to avoid
- // flushing the gpu past draws consuming the old contents.
- // TODO I think we actually want to try calling bufferData here
- GrGLenum error =
- GL_ALLOC_CALL(BufferData(target, (GrGLsizeiptr)this->size(), nullptr, fUsage));
- if (error != GR_GL_NO_ERROR) {
- return false;
- }
- GL_CALL(BufferSubData(target, 0, (GrGLsizeiptr) srcSizeInBytes, src));
- }
- fGLSizeInBytes = this->size();
- } else {
- // Note that we're cheating on the size here. Currently no methods
- // allow a partial update that preserves contents of non-updated
- // portions of the buffer (map() does a glBufferData(..size, nullptr..))
- GrGLenum error =
- GL_ALLOC_CALL(BufferData(target, (GrGLsizeiptr)srcSizeInBytes, src, fUsage));
+ if (!preserve) {
+ GrGLenum error = invalidate_buffer(this->glGpu(), target, fUsage, fBufferID, this->size());
if (error != GR_GL_NO_ERROR) {
return false;
}
- fGLSizeInBytes = srcSizeInBytes;
}
- VALIDATE();
+ GL_CALL(BufferSubData(target, offset, size, src));
return true;
}
@@ -324,27 +262,15 @@ void GrGLBuffer::onSetLabel() {
SkASSERT(fBufferID);
if (!this->getLabel().empty()) {
const std::string label = "_Skia_" + this->getLabel();
- GrGLGpu* glGpu = static_cast<GrGLGpu*>(this->getGpu());
- if (glGpu->glCaps().debugSupport()) {
- GR_GL_CALL(glGpu->glInterface(),
- ObjectLabel(GR_GL_BUFFER, fBufferID, -1, label.c_str()));
+ if (this->glGpu()->glCaps().debugSupport()) {
+ GL_CALL(ObjectLabel(GR_GL_BUFFER, fBufferID, -1, label.c_str()));
}
}
}
void GrGLBuffer::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump,
- const SkString& dumpName) const {
+ const SkString& dumpName) const {
SkString buffer_id;
buffer_id.appendU32(this->bufferID());
- traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_buffer",
- buffer_id.c_str());
+ traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_buffer", buffer_id.c_str());
}
-
-#ifdef SK_DEBUG
-
-void GrGLBuffer::validate() const {
- SkASSERT(0 != fBufferID || 0 == fGLSizeInBytes);
- SkASSERT(nullptr == fMapPtr || fGLSizeInBytes <= this->size());
-}
-
-#endif
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLBuffer.h b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLBuffer.h
index 88a7235a3a5..0319358eb59 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLBuffer.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLBuffer.h
@@ -28,12 +28,6 @@ public:
GrGLuint bufferID() const { return fBufferID; }
- /**
- * Returns the actual size of the underlying GL buffer object. In certain cases we may make this
- * smaller than the size reported by GrGpuBuffer.
- */
- size_t glSizeInBytes() const { return fGLSizeInBytes; }
-
void setHasAttachedToTexture() { fHasAttachedToTexture = true; }
bool hasAttachedToTexture() const { return fHasAttachedToTexture; }
@@ -53,19 +47,15 @@ private:
GrGLGpu* glGpu() const;
const GrGLCaps& glCaps() const;
- void onMap() override;
- void onUnmap() override;
- bool onUpdateData(const void* src, size_t srcSizeInBytes) override;
+ void onMap(MapType) override;
+ void onUnmap(MapType) override;
+ bool onUpdateData(const void* src, size_t offset, size_t size, bool preserve) override;
void onSetLabel() override;
-#ifdef SK_DEBUG
- void validate() const;
-#endif
GrGpuBufferType fIntendedType;
GrGLuint fBufferID;
GrGLenum fUsage;
- size_t fGLSizeInBytes;
bool fHasAttachedToTexture;
using INHERITED = GrGpuBuffer;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLCaps.cpp b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLCaps.cpp
index dfb7cebd255..756cd72b0b5 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLCaps.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLCaps.cpp
@@ -47,7 +47,6 @@ GrGLCaps::GrGLCaps(const GrContextOptions& contextOptions,
fBindUniformLocationSupport = false;
fMipmapLevelControlSupport = false;
fMipmapLodControlSupport = false;
- fUseBufferDataNullHint = false;
fDoManualMipmapping = false;
fClearToBoundaryValuesIsBroken = false;
fClearTextureSupport = false;
@@ -83,6 +82,10 @@ static bool angle_backend_is_d3d(GrGLANGLEBackend backend) {
return backend == GrGLANGLEBackend::kD3D9 || backend == GrGLANGLEBackend::kD3D11;
}
+static bool angle_backend_is_metal(GrGLANGLEBackend backend) {
+ return backend == GrGLANGLEBackend::kMetal;
+}
+
void GrGLCaps::init(const GrContextOptions& contextOptions,
const GrGLContextInfo& ctxInfo,
const GrGLInterface* gli) {
@@ -311,9 +314,15 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
fMipmapLodControlSupport = false;
}
- // Chrome's command buffer will zero out a buffer if null is passed to glBufferData to avoid
- // letting an application see uninitialized memory. WebGL spec explicitly disallows null values.
- fUseBufferDataNullHint = !GR_IS_GR_WEBGL(standard) && !ctxInfo.isOverCommandBuffer();
+ if ((GR_IS_GR_GL_ES(standard) || GR_IS_GR_GL(standard)) &&
+ ctxInfo.hasExtension("GL_ARB_invalidate_subdata")) {
+ fInvalidateBufferType = InvalidateBufferType::kInvalidate;
+ } else if (!GR_IS_GR_WEBGL(standard) && !ctxInfo.isOverCommandBuffer()) {
+ // Chrome's command buffer will push an array of zeros to a buffer if null is passed to
+ // glBufferData (to avoid letting an application see uninitialized memory). This is
+ // expensive so we avoid it. WebGL spec explicitly disallows null values.
+ fInvalidateBufferType = InvalidateBufferType::kNullData;
+ }
if (GR_IS_GR_GL(standard)) {
fClearTextureSupport = (version >= GR_GL_VER(4,4) ||
@@ -509,6 +518,11 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
fMapBufferFlags = kNone_MapFlags;
}
+ // Buffers have more restrictions in WebGL than GLES. For example,
+ // https://www.khronos.org/registry/webgl/specs/latest/2.0/#BUFFER_OBJECT_BINDING
+ // We therefore haven't attempted to support mapping or transfers between buffers and surfaces
+ // or between buffers.
+
if (GR_IS_GR_GL(standard)) {
if (version >= GR_GL_VER(2, 1) || ctxInfo.hasExtension("GL_ARB_pixel_buffer_object") ||
ctxInfo.hasExtension("GL_EXT_pixel_buffer_object")) {
@@ -534,9 +548,14 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
// fTransferFromSurfaceToBufferSupport = false;
// fTransferBufferType = TransferBufferType::kChromium;
}
- } else if (GR_IS_GR_WEBGL(standard)) {
- fTransferFromBufferToTextureSupport = false;
- fTransferFromSurfaceToBufferSupport = false;
+ }
+
+ if (GR_IS_GR_GL(standard) &&
+ (version >= GR_GL_VER(3, 1) || ctxInfo.hasExtension("GL_ARB_copy_buffer"))) {
+ fTransferFromBufferToBufferSupport = true;
+ } else if (GR_IS_GR_GL_ES(standard) &&
+ (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_NV_copy_buffer"))) {
+ fTransferFromBufferToBufferSupport = true;
}
// On many GPUs, map memory is very expensive, so we effectively disable it here by setting the
@@ -928,9 +947,11 @@ void GrGLCaps::initGLSL(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli
// Flat interpolation appears to be slow on Qualcomm GPUs (tested Adreno 405 and 530).
// Avoid on ANGLE too, it inserts a geometry shader into the pipeline to implement flat interp.
// Is this only true on ANGLE's D3D backends or also on the GL backend?
+ // Flat interpolation is slow with ANGLE's Metal backend.
shaderCaps->fPreferFlatInterpolation = shaderCaps->fFlatInterpolationSupport &&
ctxInfo.vendor() != GrGLVendor::kQualcomm &&
- !angle_backend_is_d3d(ctxInfo.angleBackend());
+ !angle_backend_is_d3d(ctxInfo.angleBackend()) &&
+ !angle_backend_is_metal(ctxInfo.angleBackend());
if (GR_IS_GR_GL(standard)) {
shaderCaps->fNoPerspectiveInterpolationSupport =
ctxInfo.glslGeneration() >= SkSL::GLSLGeneration::k130;
@@ -1156,47 +1177,51 @@ void GrGLCaps::onDumpJSON(SkJSONWriter* writer) const {
writer->endArray();
- static const char* kMSFBOExtStr[] = {
- "None",
- "Standard",
- "Apple",
- "IMG MS To Texture",
- "EXT MS To Texture",
+ auto msfboStr = [&] {
+ switch (fMSFBOType) {
+ case kNone_MSFBOType: return "None";
+ case kStandard_MSFBOType: return "Standard";
+ case kES_Apple_MSFBOType: return "Apple";
+ case kES_IMG_MsToTexture_MSFBOType: return "IMG MS To Texture";
+ case kES_EXT_MsToTexture_MSFBOType: return "EXT MS To Texture";
+ }
+ SkUNREACHABLE;
};
- static_assert(0 == kNone_MSFBOType);
- static_assert(1 == kStandard_MSFBOType);
- static_assert(2 == kES_Apple_MSFBOType);
- static_assert(3 == kES_IMG_MsToTexture_MSFBOType);
- static_assert(4 == kES_EXT_MsToTexture_MSFBOType);
- static_assert(SK_ARRAY_COUNT(kMSFBOExtStr) == kLast_MSFBOType + 1);
-
- static const char* kInvalidateFBTypeStr[] = {
- "None",
- "Discard",
- "Invalidate",
+
+ auto invalidateFBTypeStr = [&] {
+ switch (fInvalidateFBType) {
+ case kNone_InvalidateFBType: return "None";
+ case kDiscard_InvalidateFBType: return "Discard";
+ case kInvalidate_InvalidateFBType: return "Invalidate";
+ }
+ SkUNREACHABLE;
};
- static_assert(0 == kNone_InvalidateFBType);
- static_assert(1 == kDiscard_InvalidateFBType);
- static_assert(2 == kInvalidate_InvalidateFBType);
- static_assert(SK_ARRAY_COUNT(kInvalidateFBTypeStr) == kLast_InvalidateFBType + 1);
-
- static const char* kMapBufferTypeStr[] = {
- "None",
- "MapBuffer",
- "MapBufferRange",
- "Chromium",
+
+ auto invalidateBufferTypeStr = [&] {
+ switch (fInvalidateBufferType) {
+ case InvalidateBufferType::kNone: return "None";
+ case InvalidateBufferType::kNullData: return "Null data hint";
+ case InvalidateBufferType::kInvalidate: return "Invalidate";
+ }
+ SkUNREACHABLE;
+ };
+
+ auto mapBufferTypeStr = [&] {
+ switch (fMapBufferType) {
+ case kNone_MapBufferType: return "None";
+ case kMapBuffer_MapBufferType: return "MapBuffer";
+ case kMapBufferRange_MapBufferType: return "MapBufferRange";
+ case kChromium_MapBufferType: return "Chromium";
+ }
+ SkUNREACHABLE;
};
- static_assert(0 == kNone_MapBufferType);
- static_assert(1 == kMapBuffer_MapBufferType);
- static_assert(2 == kMapBufferRange_MapBufferType);
- static_assert(3 == kChromium_MapBufferType);
- static_assert(SK_ARRAY_COUNT(kMapBufferTypeStr) == kLast_MapBufferType + 1);
writer->appendBool("Core Profile", fIsCoreProfile);
- writer->appendString("MSAA Type", kMSFBOExtStr[fMSFBOType]);
- writer->appendString("Invalidate FB Type", kInvalidateFBTypeStr[fInvalidateFBType]);
- writer->appendString("Map Buffer Type", kMapBufferTypeStr[fMapBufferType]);
- writer->appendString("Multi Draw Type", multi_draw_type_name(fMultiDrawType));
+ writer->appendCString("MSAA Type", msfboStr());
+ writer->appendCString("Invalidate FB Type", invalidateFBTypeStr());
+ writer->appendCString("Invalidate Buffer Type", invalidateBufferTypeStr());
+ writer->appendCString("Map Buffer Type", mapBufferTypeStr());
+ writer->appendCString("Multi Draw Type", multi_draw_type_name(fMultiDrawType));
writer->appendS32("Max FS Uniform Vectors", fMaxFragmentUniformVectors);
writer->appendBool("Pack Flip Y support", fPackFlipYSupport);
@@ -1211,7 +1236,6 @@ void GrGLCaps::onDumpJSON(SkJSONWriter* writer) const {
writer->appendBool("Rectangle texture support", fRectangleTextureSupport);
writer->appendBool("Mipmap LOD control support", fMipmapLodControlSupport);
writer->appendBool("Mipmap level control support", fMipmapLevelControlSupport);
- writer->appendBool("Use buffer data null hint", fUseBufferDataNullHint);
writer->appendBool("Clear texture support", fClearTextureSupport);
writer->appendBool("Program binary support", fProgramBinarySupport);
writer->appendBool("Program parameters support", fProgramParameterSupport);
@@ -1951,7 +1975,15 @@ void GrGLCaps::initFormatTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa
// We are confident that Angle does it as we expect. Our non-angle test bots do seem
// to pass and draw correctly so we could consider enabling this more broadly in the
// future.
- if (ctxInfo.angleBackend() != GrGLANGLEBackend::kUnknown) {
+ // In addition, we also need to disable BGRA MSAA on Mesa. When a client attempts
+ // to wrap a GPU-backed texture into an SkSurface with MSAA, Ganesh will create
+ // a MSAA renderbuffer to first render to before resolving to the single-sampled
+ // texture. Mesa claims to support EXT_texture_format_BGRA8888, and according to
+ // the spec, this should imply support for both BGRA textures and renderbuffers.
+ // In practice, however, Mesa only supports BGRA textures and will error on
+ // glRenderbufferStorage* if the internalformat is BGRA.
+ if (ctxInfo.angleBackend() != GrGLANGLEBackend::kUnknown &&
+ ctxInfo.angleDriver() != GrGLDriver::kMesa) {
// Angle incorrectly requires GL_BGRA8_EXT for the interalFormat for both ES2
// and ES3 even though this extension does not define that value. The extension
// only defines GL_BGRA_EXT as an internal format.
@@ -2356,6 +2388,7 @@ void GrGLCaps::initFormatTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa
// supported. This is for simplicity, but a more granular approach is possible.
bool lum16FSupported = false;
bool lum16FSizedFormatSupported = false;
+ GrGLenum lumHalfFloatType = halfFloatType;
if (GR_IS_GR_GL(standard)) {
if (!fIsCoreProfile && ctxInfo.hasExtension("GL_ARB_texture_float")) {
lum16FSupported = true;
@@ -2365,6 +2398,11 @@ void GrGLCaps::initFormatTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa
if (ctxInfo.hasExtension("GL_OES_texture_half_float_linear") &&
ctxInfo.hasExtension("GL_OES_texture_half_float")) {
lum16FSupported = true;
+ // Even in ES 3.0+ LUMINANCE and GL_HALF_FLOAT are not listed as a valid
+ // combination. Thus we must use GL_HALF_FLOAT_OES provided by the extension
+ // GL_OES_texture_half_float. Note: these two types are not defined to be the same
+ // value.
+ lumHalfFloatType = GR_GL_HALF_FLOAT_OES;
// Even on ES3 this extension is required to define LUMINANCE16F.
lum16FSizedFormatSupported = ctxInfo.hasExtension("GL_EXT_texture_storage");
}
@@ -2378,7 +2416,7 @@ void GrGLCaps::initFormatTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa
info.fFormatType = FormatType::kFloat;
info.fInternalFormatForRenderbuffer = GR_GL_LUMINANCE16F;
info.fDefaultExternalFormat = GR_GL_LUMINANCE;
- info.fDefaultExternalType = halfFloatType;
+ info.fDefaultExternalType = lumHalfFloatType;
info.fDefaultColorType = GrColorType::kGray_F16;
if (lum16FSupported) {
@@ -2418,7 +2456,7 @@ void GrGLCaps::initFormatTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa
{
auto& ioFormat = ctInfo.fExternalIOFormats[ioIdx++];
ioFormat.fColorType = GrColorType::kAlpha_F16;
- ioFormat.fExternalType = halfFloatType;
+ ioFormat.fExternalType = lumHalfFloatType;
ioFormat.fExternalTexImageFormat = GR_GL_LUMINANCE;
ioFormat.fExternalReadFormat = 0;
}
@@ -2444,17 +2482,24 @@ void GrGLCaps::initFormatTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa
info.fDefaultExternalType = GR_GL_UNSIGNED_BYTE;
info.fDefaultColorType = GrColorType::kRGB_888x;
- bool supportsRGBXTexStorage = false;
-
- if (GR_IS_GR_GL_ES(standard) && ctxInfo.hasExtension("GL_ANGLE_rgbx_internal_format")) {
- info.fFlags =
- FormatInfo::kTexturable_Flag | FormatInfo::kTransfers_Flag | msaaRenderFlags;
- supportsRGBXTexStorage = true;
+ bool supportsSizedRGBX = false;
+ // The GL_ANGLE_rgbx_internal_format extension only adds the sized GL_RGBX8 type and does
+ // not have a way to create a texture of that format with texImage using an unsized type. So
+ // we require that we either have texture storage support or that tex image supports sized
+ // formats to say that this format is supported.
+ if (GR_IS_GR_GL_ES(standard) && ctxInfo.hasExtension("GL_ANGLE_rgbx_internal_format") &&
+ (texStorageSupported || texImageSupportsSizedInternalFormat)) {
+ supportsSizedRGBX = true;
}
- if (texStorageSupported && supportsRGBXTexStorage) {
- info.fFlags |= FormatInfo::kUseTexStorage_Flag;
+ if (supportsSizedRGBX) {
info.fInternalFormatForTexImageOrStorage = GR_GL_RGBX8;
+ info.fFlags = FormatInfo::kTexturable_Flag |
+ FormatInfo::kTransfers_Flag |
+ msaaRenderFlags;
+ if (texStorageSupported) {
+ info.fFlags |= FormatInfo::kUseTexStorage_Flag;
+ }
info.fColorTypeInfoCount = 1;
info.fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(info.fColorTypeInfoCount);
int ctIdx = 0;
@@ -2475,7 +2520,7 @@ void GrGLCaps::initFormatTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa
auto& ioFormat = ctInfo.fExternalIOFormats[ioIdx++];
ioFormat.fColorType = GrColorType::kRGB_888x;
ioFormat.fExternalType = GR_GL_UNSIGNED_BYTE;
- ioFormat.fExternalTexImageFormat = GR_GL_RGB;
+ ioFormat.fExternalTexImageFormat = GR_GL_RGBA;
ioFormat.fExternalReadFormat = 0;
}
@@ -3367,7 +3412,7 @@ void GrGLCaps::setupSampleCounts(const GrGLContextInfo& ctxInfo, const GrGLInter
maxSampleCnt = std::max(1, maxSampleCnt);
static constexpr int kDefaultSamples[] = {1, 2, 4, 8};
- int count = SK_ARRAY_COUNT(kDefaultSamples);
+ int count = std::size(kDefaultSamples);
for (; count > 0; --count) {
if (kDefaultSamples[count - 1] <= maxSampleCnt) {
break;
@@ -3675,7 +3720,17 @@ void GrGLCaps::applyDriverCorrectnessWorkarounds(const GrGLContextInfo& ctxInfo,
// http://anglebug.com/6030
if (fMSFBOType == kES_EXT_MsToTexture_MSFBOType &&
ctxInfo.angleBackend() == GrGLANGLEBackend::kD3D11) {
- fDisallowDynamicMSAA = true;
+ // As GL_EXT_multisampled_render_to_texture supporting issue,
+ // fall back to default dmsaa path
+ if ((ctxInfo.vendor() == GrGLVendor::kIntel ||
+ ctxInfo.angleVendor() == GrGLVendor::kIntel) &&
+ ctxInfo.renderer() >= GrGLRenderer::kIntelIceLake) {
+ fMSFBOType = kStandard_MSFBOType;
+ fMSAAResolvesAutomatically = false;
+ }
+ else {
+ fDisallowDynamicMSAA = true;
+ }
}
// http://skbug.com/12081
@@ -3683,6 +3738,10 @@ void GrGLCaps::applyDriverCorrectnessWorkarounds(const GrGLContextInfo& ctxInfo,
fDisallowDynamicMSAA = true;
}
+ // Below we are aggressive about turning off all mapping/transfer functionality together. This
+ // could be finer grained if code paths and tests were adjusted to check more specific caps.
+ // For example it might be possible to support buffer to buffer transfers even if buffer mapping
+ // or buffer to surface transfers don't work.
#if defined(__has_feature)
#if defined(SK_BUILD_FOR_MAC) && __has_feature(thread_sanitizer)
// See skbug.com/7058
@@ -3690,6 +3749,7 @@ void GrGLCaps::applyDriverCorrectnessWorkarounds(const GrGLContextInfo& ctxInfo,
fMapBufferFlags = kNone_MapFlags;
fTransferFromBufferToTextureSupport = false;
fTransferFromSurfaceToBufferSupport = false;
+ fTransferFromBufferToBufferSupport = false;
fTransferBufferType = TransferBufferType::kNone;
#endif
#endif
@@ -3704,6 +3764,7 @@ void GrGLCaps::applyDriverCorrectnessWorkarounds(const GrGLContextInfo& ctxInfo,
fMapBufferFlags = kNone_MapFlags;
fTransferFromBufferToTextureSupport = false;
fTransferFromSurfaceToBufferSupport = false;
+ fTransferFromBufferToBufferSupport = false;
fTransferBufferType = TransferBufferType::kNone;
}
@@ -3908,7 +3969,7 @@ void GrGLCaps::applyDriverCorrectnessWorkarounds(const GrGLContextInfo& ctxInfo,
}
// https://b.corp.google.com/issues/188410972
- if (ctxInfo.renderer() == GrGLRenderer::kVirgl) {
+ if (ctxInfo.isRunningOverVirgl()) {
fDrawInstancedSupport = false;
}
@@ -4215,8 +4276,10 @@ void GrGLCaps::applyDriverCorrectnessWorkarounds(const GrGLContextInfo& ctxInfo,
// All Adrenos claim to support LUM16F but don't appear to actually do so.
// The failing devices/gpus were: Nexus5/Adreno330, Nexus5x/Adreno418, Pixel/Adreno530,
// Pixel2XL/Adreno540 and Pixel3/Adreno630
- formatWorkarounds->fDisableLuminance16F = ctxInfo.renderer() == GrGLRenderer::kIntelBroadwell ||
- ctxInfo.vendor() == GrGLVendor::kQualcomm;
+ formatWorkarounds->fDisableLuminance16F =
+ (ctxInfo.renderer() == GrGLRenderer::kIntelBroadwell ||
+ ctxInfo.vendor() == GrGLVendor::kQualcomm) &&
+ ctxInfo.angleBackend() == GrGLANGLEBackend::kUnknown;
#ifdef SK_BUILD_FOR_MAC
// On a MacBookPro 11.5 running MacOS 10.13 with a Radeon M370X the TransferPixelsFrom test
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLCaps.h b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLCaps.h
index 272539ca6ab..4d5b231a6cc 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLCaps.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLCaps.h
@@ -60,8 +60,6 @@ public:
* GL_MAX_SAMPLES value.
*/
kES_EXT_MsToTexture_MSFBOType,
-
- kLast_MSFBOType = kES_EXT_MsToTexture_MSFBOType
};
enum BlitFramebufferFlags {
@@ -76,19 +74,21 @@ public:
enum InvalidateFBType {
kNone_InvalidateFBType,
- kDiscard_InvalidateFBType, //<! glDiscardFramebuffer()
- kInvalidate_InvalidateFBType, //<! glInvalidateFramebuffer()
+ kDiscard_InvalidateFBType, //<! glDiscardFramebuffer()
+ kInvalidate_InvalidateFBType, //<! glInvalidateFramebuffer()
+ };
- kLast_InvalidateFBType = kInvalidate_InvalidateFBType
+ enum class InvalidateBufferType {
+ kNone,
+ kNullData, // Call glBufferData with a null data pointer.
+ kInvalidate // glInvalidateBufferData
};
enum MapBufferType {
kNone_MapBufferType,
- kMapBuffer_MapBufferType, // glMapBuffer()
- kMapBufferRange_MapBufferType, // glMapBufferRange()
- kChromium_MapBufferType, // GL_CHROMIUM_map_sub
-
- kLast_MapBufferType = kChromium_MapBufferType,
+ kMapBuffer_MapBufferType, // glMapBuffer()
+ kMapBufferRange_MapBufferType, // glMapBufferRange()
+ kChromium_MapBufferType, // GL_CHROMIUM_map_sub
};
enum class TransferBufferType {
@@ -361,7 +361,7 @@ public:
void onDumpJSON(SkJSONWriter*) const override;
- bool useBufferDataNullHint() const { return fUseBufferDataNullHint; }
+ InvalidateBufferType invalidateBufferType() const { return fInvalidateBufferType; }
// Certain Intel GPUs on Mac fail to clear if the glClearColor is made up of only 1s and 0s.
bool clearToBoundaryValuesIsBroken() const { return fClearToBoundaryValuesIsBroken; }
@@ -557,12 +557,13 @@ private:
int fMaxFragmentUniformVectors = 0;
float fMaxTextureMaxAnisotropy = 1.f;
- MSFBOType fMSFBOType = kNone_MSFBOType;
- InvalidateFBType fInvalidateFBType = kNone_InvalidateFBType;
- MapBufferType fMapBufferType = kNone_MapBufferType;
- TransferBufferType fTransferBufferType = TransferBufferType::kNone;
- FenceType fFenceType = FenceType::kNone;
- MultiDrawType fMultiDrawType = MultiDrawType::kNone;
+ MSFBOType fMSFBOType = kNone_MSFBOType;
+ InvalidateFBType fInvalidateFBType = kNone_InvalidateFBType;
+ InvalidateBufferType fInvalidateBufferType = InvalidateBufferType::kNone;
+ MapBufferType fMapBufferType = kNone_MapBufferType;
+ TransferBufferType fTransferBufferType = TransferBufferType::kNone;
+ FenceType fFenceType = FenceType::kNone;
+ MultiDrawType fMultiDrawType = MultiDrawType::kNone;
bool fPackFlipYSupport : 1;
bool fTextureUsageSupport : 1;
@@ -578,7 +579,6 @@ private:
bool fRectangleTextureSupport : 1;
bool fMipmapLevelControlSupport : 1;
bool fMipmapLodControlSupport : 1;
- bool fUseBufferDataNullHint : 1;
bool fClearTextureSupport : 1;
bool fProgramBinarySupport : 1;
bool fProgramParameterSupport : 1;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLContext.h b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLContext.h
index d5424ca6cf6..28441ce1838 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLContext.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLContext.h
@@ -13,7 +13,6 @@
#include "include/gpu/gl/GrGLInterface.h"
#include "src/gpu/ganesh/gl/GrGLCaps.h"
#include "src/gpu/ganesh/gl/GrGLUtil.h"
-#include "src/gpu/ganesh/glsl/GrGLSL.h"
struct GrContextOptions;
@@ -53,6 +52,7 @@ public:
}
}
GrGLANGLEBackend angleBackend() const { return fDriverInfo.fANGLEBackend; }
+ GrGLDriver angleDriver() const { return fDriverInfo.fANGLEDriver; }
GrGLVendor angleVendor() const { return fDriverInfo.fANGLEVendor; }
GrGLRenderer angleRenderer() const { return fDriverInfo.fANGLERenderer; }
/** What driver is running our GL implementation? This is not necessarily related to the vendor.
@@ -60,6 +60,7 @@ public:
GrGLDriver driver() const { return fDriverInfo.fDriver; }
GrGLDriverVersion driverVersion() const { return fDriverInfo.fDriverVersion; }
bool isOverCommandBuffer() const { return fDriverInfo.fIsOverCommandBuffer; }
+ bool isRunningOverVirgl() const { return fDriverInfo.fIsRunningOverVirgl; }
const GrGLCaps* caps() const { return fGLCaps.get(); }
GrGLCaps* caps() { return fGLCaps.get(); }
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLExtensions.cpp b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLExtensions.cpp
index 8a2259587f4..287d204d7d5 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLExtensions.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLExtensions.cpp
@@ -159,7 +159,7 @@ void GrGLExtensions::add(const char ext[]) {
void GrGLExtensions::dumpJSON(SkJSONWriter* writer) const {
writer->beginArray();
for (int i = 0; i < fStrings.count(); ++i) {
- writer->appendString(fStrings[i].c_str());
+ writer->appendString(fStrings[i]);
}
writer->endArray();
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLGLSL.cpp b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLGLSL.cpp
index 5f4f16b3c88..f1b7e98e871 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLGLSL.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLGLSL.cpp
@@ -7,6 +7,7 @@
#include "src/gpu/ganesh/gl/GrGLGLSL.h"
#include "src/gpu/ganesh/gl/GrGLUtil.h"
+#include "src/sksl/SkSLGLSL.h"
bool GrGLGetGLSLGeneration(const GrGLDriverInfo& info, SkSL::GLSLGeneration* generation) {
SkASSERT(generation);
@@ -44,7 +45,7 @@ bool GrGLGetGLSLGeneration(const GrGLDriverInfo& info, SkSL::GLSLGeneration* gen
}
return true;
} else if (GR_IS_GR_GL_ES(info.fStandard)) {
- SkASSERT(ver >= GR_GL_VER(1,00));
+ SkASSERT(ver >= GR_GLSL_VER(1,00));
if (ver >= GR_GLSL_VER(3,20)) {
*generation = SkSL::GLSLGeneration::k320es;
} else if (ver >= GR_GLSL_VER(3,10)) {
@@ -56,7 +57,7 @@ bool GrGLGetGLSLGeneration(const GrGLDriverInfo& info, SkSL::GLSLGeneration* gen
}
return true;
} else if (GR_IS_GR_WEBGL(info.fStandard)) {
- SkASSERT(ver >= GR_GL_VER(1,0));
+ SkASSERT(ver >= GR_GLSL_VER(1,0));
if (ver >= GR_GLSL_VER(2,0)) {
*generation = SkSL::GLSLGeneration::k300es;
} else {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLGLSL.h b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLGLSL.h
index 1542fff4b7d..2e4ebbccb0c 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLGLSL.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLGLSL.h
@@ -8,7 +8,7 @@
#ifndef GrGLGLSL_DEFINED
#define GrGLGLSL_DEFINED
-#include "src/gpu/ganesh/glsl/GrGLSL.h"
+#include "src/sksl/SkSLGLSL.h"
struct GrGLDriverInfo;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLGpu.cpp b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLGpu.cpp
index a690a89104b..df6521bc0e8 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLGpu.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLGpu.cpp
@@ -109,7 +109,7 @@ static_assert(14 == (int)skgpu::BlendEquation::kHSLHue);
static_assert(15 == (int)skgpu::BlendEquation::kHSLSaturation);
static_assert(16 == (int)skgpu::BlendEquation::kHSLColor);
static_assert(17 == (int)skgpu::BlendEquation::kHSLLuminosity);
-static_assert(SK_ARRAY_COUNT(gXfermodeEquation2Blend) == skgpu::kBlendEquationCnt);
+static_assert(std::size(gXfermodeEquation2Blend) == skgpu::kBlendEquationCnt);
static const GrGLenum gXfermodeCoeff2Blend[] = {
GR_GL_ZERO,
@@ -403,7 +403,6 @@ GrGLGpu::GrGLGpu(std::unique_ptr<GrGLContext> ctx, GrDirectContext* dContext)
for (int i = 0; i < kGrGpuBufferTypeCount; ++i) {
fHWBufferState[i].invalidate();
}
- static_assert(kGrGpuBufferTypeCount == SK_ARRAY_COUNT(fHWBufferState));
if (this->glCaps().useSamplerObjects()) {
fSamplerObjectCache = std::make_unique<SamplerObjectCache>(this);
@@ -436,13 +435,13 @@ GrGLGpu::~GrGLGpu() {
this->deleteFramebuffer(fStencilClearFBOID);
}
- for (size_t i = 0; i < SK_ARRAY_COUNT(fCopyPrograms); ++i) {
+ for (size_t i = 0; i < std::size(fCopyPrograms); ++i) {
if (0 != fCopyPrograms[i].fProgram) {
GL_CALL(DeleteProgram(fCopyPrograms[i].fProgram));
}
}
- for (size_t i = 0; i < SK_ARRAY_COUNT(fMipmapPrograms); ++i) {
+ for (size_t i = 0; i < std::size(fMipmapPrograms); ++i) {
if (0 != fMipmapPrograms[i].fProgram) {
GL_CALL(DeleteProgram(fMipmapPrograms[i].fProgram));
}
@@ -468,12 +467,12 @@ void GrGLGpu::disconnect(DisconnectType type) {
if (fStencilClearFBOID) {
this->deleteFramebuffer(fStencilClearFBOID);
}
- for (size_t i = 0; i < SK_ARRAY_COUNT(fCopyPrograms); ++i) {
+ for (size_t i = 0; i < std::size(fCopyPrograms); ++i) {
if (fCopyPrograms[i].fProgram) {
GL_CALL(DeleteProgram(fCopyPrograms[i].fProgram));
}
}
- for (size_t i = 0; i < SK_ARRAY_COUNT(fMipmapPrograms); ++i) {
+ for (size_t i = 0; i < std::size(fMipmapPrograms); ++i) {
if (fMipmapPrograms[i].fProgram) {
GL_CALL(DeleteProgram(fMipmapPrograms[i].fProgram));
}
@@ -500,11 +499,11 @@ void GrGLGpu::disconnect(DisconnectType type) {
fTempDstFBOID = 0;
fStencilClearFBOID = 0;
fCopyProgramArrayBuffer.reset();
- for (size_t i = 0; i < SK_ARRAY_COUNT(fCopyPrograms); ++i) {
+ for (size_t i = 0; i < std::size(fCopyPrograms); ++i) {
fCopyPrograms[i].fProgram = 0;
}
fMipmapProgramArrayBuffer.reset();
- for (size_t i = 0; i < SK_ARRAY_COUNT(fMipmapPrograms); ++i) {
+ for (size_t i = 0; i < std::size(fMipmapPrograms); ++i) {
fMipmapPrograms[i].fProgram = 0;
}
@@ -703,7 +702,10 @@ sk_sp<GrTexture> GrGLGpu::onWrapBackendTexture(const GrBackendTexture& backendTe
: GrMipmapStatus::kNotAllocated;
auto texture = GrGLTexture::MakeWrapped(this, mipmapStatus, desc,
- backendTex.getGLTextureParams(), cacheable, ioType);
+ backendTex.getGLTextureParams(),
+ cacheable,
+ ioType,
+ backendTex.getLabel());
if (this->glCaps().isFormatRenderable(backendTex.getBackendFormat(), 1)) {
// Pessimistically assume this external texture may have been bound to a FBO.
texture->baseLevelWasBoundToFBO();
@@ -758,7 +760,7 @@ sk_sp<GrTexture> GrGLGpu::onWrapCompressedBackendTexture(const GrBackendTexture&
auto texture = GrGLTexture::MakeWrapped(this, mipmapStatus, desc,
backendTex.getGLTextureParams(), cacheable,
- kRead_GrIOType);
+ kRead_GrIOType, backendTex.getLabel());
return std::move(texture);
}
@@ -800,7 +802,7 @@ sk_sp<GrTexture> GrGLGpu::onWrapRenderableBackendTexture(const GrBackendTexture&
sk_sp<GrGLTextureRenderTarget> texRT(GrGLTextureRenderTarget::MakeWrapped(
this, sampleCnt, desc, backendTex.getGLTextureParams(), rtIDs, cacheable,
- mipmapStatus));
+ mipmapStatus, backendTex.getLabel()));
texRT->baseLevelWasBoundToFBO();
return std::move(texRT);
}
@@ -835,8 +837,13 @@ sk_sp<GrRenderTarget> GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTa
rtIDs.fRTFBOOwnership = GrBackendObjectOwnership::kBorrowed;
rtIDs.fTotalMemorySamplesPerPixel = sampleCount;
- return GrGLRenderTarget::MakeWrapped(this, backendRT.dimensions(), format, sampleCount, rtIDs,
- backendRT.stencilBits());
+ return GrGLRenderTarget::MakeWrapped(this,
+ backendRT.dimensions(),
+ format,
+ sampleCount,
+ rtIDs,
+ backendRT.stencilBits(),
+ /*label=*/"GLGpu_WrapBackendRenderTarget");
}
static bool check_write_and_transfer_input(GrGLTexture* glTex) {
@@ -895,6 +902,28 @@ bool GrGLGpu::onWritePixels(GrSurface* surface,
mipLevelCount);
}
+bool GrGLGpu::onTransferFromBufferToBuffer(sk_sp<GrGpuBuffer> src,
+ size_t srcOffset,
+ sk_sp<GrGpuBuffer> dst,
+ size_t dstOffset,
+ size_t size) {
+ auto glSrc = static_cast<const GrGLBuffer*>(src.get());
+ auto glDst = static_cast<const GrGLBuffer*>(dst.get());
+
+ // If we refactored bindBuffer() to use something other than GrGpuBufferType to indicate the
+ // binding target then we could use the COPY_READ and COPY_WRITE targets here. But
+ // CopyBufferSubData is documented to work with all the targets so it's not clear it's worth it.
+ this->bindBuffer(GrGpuBufferType::kXferCpuToGpu, glSrc);
+ this->bindBuffer(GrGpuBufferType::kXferGpuToCpu, glDst);
+
+ GL_CALL(CopyBufferSubData(GR_GL_PIXEL_UNPACK_BUFFER,
+ GR_GL_PIXEL_PACK_BUFFER,
+ srcOffset,
+ dstOffset,
+ size));
+ return true;
+}
+
bool GrGLGpu::onTransferPixelsTo(GrTexture* texture,
SkIRect rect,
GrColorType textureColorType,
@@ -926,7 +955,7 @@ bool GrGLGpu::onTransferPixelsTo(GrTexture* texture,
const size_t trimRowBytes = rect.width() * bpp;
const void* pixels = (void*)offset;
- SkASSERT(glBuffer->glSizeInBytes() >= offset + rowBytes*(rect.height() - 1) + trimRowBytes);
+ SkASSERT(glBuffer->size() >= offset + rowBytes*(rect.height() - 1) + trimRowBytes);
bool restoreGLRowLength = false;
if (trimRowBytes != rowBytes) {
@@ -971,9 +1000,9 @@ bool GrGLGpu::onTransferPixelsFrom(GrSurface* surface,
sk_sp<GrGpuBuffer> transferBuffer,
size_t offset) {
auto* glBuffer = static_cast<GrGLBuffer*>(transferBuffer.get());
- SkASSERT(glBuffer->glSizeInBytes() >= offset + (rect.width() *
- rect.height()*
- GrColorTypeBytesPerPixel(dstColorType)));
+ SkASSERT(glBuffer->size() >= offset + (rect.width() *
+ rect.height()*
+ GrColorTypeBytesPerPixel(dstColorType)));
this->bindBuffer(GrGpuBufferType::kXferGpuToCpu, glBuffer);
@@ -3130,7 +3159,7 @@ bool GrGLGpu::createCopyProgram(GrTexture* srcTex) {
sizeof(vdata),
GrGpuBufferType::kVertex,
kStatic_GrAccessPattern);
- fCopyProgramArrayBuffer->updateData(vdata, sizeof(vdata));
+ fCopyProgramArrayBuffer->updateData(vdata, /*offset=*/0, sizeof(vdata), /*preserve=*/false);
}
if (!fCopyProgramArrayBuffer) {
return false;
@@ -3196,7 +3225,7 @@ bool GrGLGpu::createCopyProgram(GrTexture* srcTex) {
auto errorHandler = this->getContext()->priv().getShaderErrorHandler();
std::string sksl(vshaderTxt.c_str(), vshaderTxt.size());
- SkSL::Program::Settings settings;
+ SkSL::ProgramSettings settings;
std::string glsl;
std::unique_ptr<SkSL::Program> program = GrSkSLtoGLSL(this, SkSL::ProgramKind::kVertex,
sksl, settings, &glsl, errorHandler);
@@ -3350,7 +3379,7 @@ bool GrGLGpu::createMipmapProgram(int progIdx) {
auto errorHandler = this->getContext()->priv().getShaderErrorHandler();
std::string sksl(vshaderTxt.c_str(), vshaderTxt.size());
- SkSL::Program::Settings settings;
+ SkSL::ProgramSettings settings;
std::string glsl;
std::unique_ptr<SkSL::Program> program = GrSkSLtoGLSL(this, SkSL::ProgramKind::kVertex,
sksl, settings, &glsl, errorHandler);
@@ -3568,7 +3597,10 @@ bool GrGLGpu::onRegenerateMipMapLevels(GrTexture* texture) {
sizeof(vdata),
GrGpuBufferType::kVertex,
kStatic_GrAccessPattern);
- fMipmapProgramArrayBuffer->updateData(vdata, sizeof(vdata));
+ fMipmapProgramArrayBuffer->updateData(vdata, /*offset=*/0,
+
+ sizeof(vdata),
+ /*preserve=*/false);
}
if (!fMipmapProgramArrayBuffer) {
return false;
@@ -4191,13 +4223,13 @@ void GrGLGpu::onDumpJSON(SkJSONWriter* writer) const {
const GrGLubyte* str;
GL_CALL_RET(str, GetString(GR_GL_VERSION));
- writer->appendString("GL_VERSION", (const char*)(str));
+ writer->appendCString("GL_VERSION", (const char*)(str));
GL_CALL_RET(str, GetString(GR_GL_RENDERER));
- writer->appendString("GL_RENDERER", (const char*)(str));
+ writer->appendCString("GL_RENDERER", (const char*)(str));
GL_CALL_RET(str, GetString(GR_GL_VENDOR));
- writer->appendString("GL_VENDOR", (const char*)(str));
+ writer->appendCString("GL_VENDOR", (const char*)(str));
GL_CALL_RET(str, GetString(GR_GL_SHADING_LANGUAGE_VERSION));
- writer->appendString("GL_SHADING_LANGUAGE_VERSION", (const char*)(str));
+ writer->appendCString("GL_SHADING_LANGUAGE_VERSION", (const char*)(str));
writer->appendName("extensions");
glInterface()->fExtensions.dumpJSON(writer);
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLGpu.h b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLGpu.h
index 3012fe5f07f..04e353b640f 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLGpu.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLGpu.h
@@ -322,6 +322,12 @@ private:
int mipLevelCount,
bool prepForTexSampling) override;
+ bool onTransferFromBufferToBuffer(sk_sp<GrGpuBuffer> src,
+ size_t srcOffset,
+ sk_sp<GrGpuBuffer> dst,
+ size_t dstOffset,
+ size_t size) override;
+
bool onTransferPixelsTo(GrTexture*,
SkIRect,
GrColorType textureColorType,
@@ -682,7 +688,7 @@ private:
auto* hwBufferState(GrGpuBufferType type) {
unsigned typeAsUInt = static_cast<unsigned>(type);
- SkASSERT(typeAsUInt < SK_ARRAY_COUNT(fHWBufferState));
+ SkASSERT(typeAsUInt < std::size(fHWBufferState));
SkASSERT(type != GrGpuBufferType::kUniform);
return &fHWBufferState[typeAsUInt];
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLInterfaceAutogen.cpp b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLInterfaceAutogen.cpp
index 38c1aa81822..c288cd5bd29 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLInterfaceAutogen.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLInterfaceAutogen.cpp
@@ -593,6 +593,19 @@ bool GrGLInterface::validate() const {
}
if ((GR_IS_GR_GL(fStandard) && (
+ (glVer >= GR_GL_VER(3,1)) ||
+ fExtensions.has("GL_ARB_copy_buffer"))) ||
+ (GR_IS_GR_GL_ES(fStandard) && (
+ (glVer >= GR_GL_VER(3,0)) ||
+ fExtensions.has("GL_NV_copy_buffer"))) ||
+ (GR_IS_GR_WEBGL(fStandard) && (
+ (glVer >= GR_GL_VER(2,0))))) {
+ if (!fFunctions.fCopyBufferSubData) {
+ RETURN_FALSE_INTERFACE;
+ }
+ }
+
+ if ((GR_IS_GR_GL(fStandard) && (
fExtensions.has("GL_NV_framebuffer_mixed_samples"))) ||
(GR_IS_GR_GL_ES(fStandard) && (
fExtensions.has("GL_CHROMIUM_framebuffer_mixed_samples") ||
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLRenderTarget.cpp b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLRenderTarget.cpp
index 096a69b009a..114eb50b95f 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLRenderTarget.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLRenderTarget.cpp
@@ -84,7 +84,8 @@ sk_sp<GrGLRenderTarget> GrGLRenderTarget::MakeWrapped(GrGLGpu* gpu,
GrGLFormat format,
int sampleCount,
const IDs& idDesc,
- int stencilBits) {
+ int stencilBits,
+ std::string_view label) {
sk_sp<GrGLAttachment> sb;
if (stencilBits) {
// We pick a "fake" actual format that matches the number of stencil bits. When wrapping
@@ -105,8 +106,7 @@ sk_sp<GrGLRenderTarget> GrGLRenderTarget::MakeWrapped(GrGLGpu* gpu,
sFmt);
}
return sk_sp<GrGLRenderTarget>(new GrGLRenderTarget(
- gpu, dimensions, format, sampleCount, idDesc, std::move(sb),
- /*label=*/"GLRenderTargetMakeWrapped"));
+ gpu, dimensions, format, sampleCount, idDesc, std::move(sb), label));
}
GrBackendRenderTarget GrGLRenderTarget::getBackendRenderTarget() const {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLRenderTarget.h b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLRenderTarget.h
index 728a83a6c8c..eed4c9b7336 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLRenderTarget.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLRenderTarget.h
@@ -40,7 +40,8 @@ public:
GrGLFormat,
int sampleCount,
const IDs&,
- int stencilBits);
+ int stencilBits,
+ std::string_view label);
bool isFBO0(bool multisample) const {
return (multisample ? fMultisampleFBOID : fSingleSampleFBOID) == 0;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLTexture.cpp b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLTexture.cpp
index 3dd21c960e8..1e892320d34 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLTexture.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLTexture.cpp
@@ -146,10 +146,10 @@ sk_sp<GrGLTexture> GrGLTexture::MakeWrapped(GrGLGpu* gpu,
const Desc& desc,
sk_sp<GrGLTextureParameters> parameters,
GrWrapCacheable cacheable,
- GrIOType ioType) {
+ GrIOType ioType,
+ std::string_view label) {
return sk_sp<GrGLTexture>(new GrGLTexture(
- gpu, desc, mipmapStatus, std::move(parameters), cacheable, ioType,
- /*label=*/"GLTextureMakeWrapped"));
+ gpu, desc, mipmapStatus, std::move(parameters), cacheable, ioType, label));
}
bool GrGLTexture::onStealBackendTexture(GrBackendTexture* backendTexture,
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLTexture.h b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLTexture.h
index 9aea09859d0..8babbd7cfed 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLTexture.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLTexture.h
@@ -54,7 +54,8 @@ public:
GrMipmapStatus,
const Desc&,
sk_sp<GrGLTextureParameters>,
- GrWrapCacheable, GrIOType);
+ GrWrapCacheable, GrIOType,
+ std::string_view label);
void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const override;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLTextureRenderTarget.cpp b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLTextureRenderTarget.cpp
index e5f18762f5b..c59480181a6 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLTextureRenderTarget.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLTextureRenderTarget.cpp
@@ -68,7 +68,8 @@ sk_sp<GrGLTextureRenderTarget> GrGLTextureRenderTarget::MakeWrapped(
sk_sp<GrGLTextureParameters> parameters,
const GrGLRenderTarget::IDs& rtIDs,
GrWrapCacheable cacheable,
- GrMipmapStatus mipmapStatus) {
+ GrMipmapStatus mipmapStatus,
+ std::string_view label) {
return sk_sp<GrGLTextureRenderTarget>(
new GrGLTextureRenderTarget(gpu,
sampleCount,
@@ -77,7 +78,7 @@ sk_sp<GrGLTextureRenderTarget> GrGLTextureRenderTarget::MakeWrapped(
rtIDs,
cacheable,
mipmapStatus,
- /*label=*/"GLTextureRenderTargetMakeWrapped"));
+ label));
}
size_t GrGLTextureRenderTarget::onGpuMemorySize() const {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLTextureRenderTarget.h b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLTextureRenderTarget.h
index 382b4bb37a6..447fc33623f 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLTextureRenderTarget.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLTextureRenderTarget.h
@@ -42,7 +42,8 @@ public:
sk_sp<GrGLTextureParameters>,
const GrGLRenderTarget::IDs&,
GrWrapCacheable,
- GrMipmapStatus);
+ GrMipmapStatus,
+ std::string_view label);
GrBackendFormat backendFormat() const override {
// It doesn't matter if we take the texture or render target path, so just pick texture.
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLUtil.cpp b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLUtil.cpp
index 8369dfc3a80..1cffbc4c7ec 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLUtil.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLUtil.cpp
@@ -163,7 +163,7 @@ static GrGLVendor get_vendor(const char* vendorString) {
static GrGLRenderer get_renderer(const char* rendererString, const GrGLExtensions& extensions) {
SkASSERT(rendererString);
static const char kTegraStr[] = "NVIDIA Tegra";
- if (0 == strncmp(rendererString, kTegraStr, SK_ARRAY_COUNT(kTegraStr) - 1)) {
+ if (0 == strncmp(rendererString, kTegraStr, std::size(kTegraStr) - 1)) {
// Tegra strings are not very descriptive. We distinguish between the modern and legacy
// architectures by the presence of NV_path_rendering.
return extensions.has("GL_NV_path_rendering") ? GrGLRenderer::kTegra
@@ -178,17 +178,17 @@ static GrGLRenderer get_renderer(const char* rendererString, const GrGLExtension
static const char kAppleA4Str[] = "Apple A4";
static const char kAppleA5Str[] = "Apple A5";
static const char kAppleA6Str[] = "Apple A6";
- if (0 == strncmp(rendererString, kAppleA4Str, SK_ARRAY_COUNT(kAppleA4Str) - 1) ||
- 0 == strncmp(rendererString, kAppleA5Str, SK_ARRAY_COUNT(kAppleA5Str) - 1) ||
- 0 == strncmp(rendererString, kAppleA6Str, SK_ARRAY_COUNT(kAppleA6Str) - 1)) {
+ if (0 == strncmp(rendererString, kAppleA4Str, std::size(kAppleA4Str) - 1) ||
+ 0 == strncmp(rendererString, kAppleA5Str, std::size(kAppleA5Str) - 1) ||
+ 0 == strncmp(rendererString, kAppleA6Str, std::size(kAppleA6Str) - 1)) {
return GrGLRenderer::kPowerVR54x;
}
static const char kPowerVRRogueStr[] = "PowerVR Rogue";
static const char kAppleA7Str[] = "Apple A7";
static const char kAppleA8Str[] = "Apple A8";
- if (0 == strncmp(rendererString, kPowerVRRogueStr, SK_ARRAY_COUNT(kPowerVRRogueStr) - 1) ||
- 0 == strncmp(rendererString, kAppleA7Str, SK_ARRAY_COUNT(kAppleA7Str) - 1) ||
- 0 == strncmp(rendererString, kAppleA8Str, SK_ARRAY_COUNT(kAppleA8Str) - 1)) {
+ if (0 == strncmp(rendererString, kPowerVRRogueStr, std::size(kPowerVRRogueStr) - 1) ||
+ 0 == strncmp(rendererString, kAppleA7Str, std::size(kAppleA7Str) - 1) ||
+ 0 == strncmp(rendererString, kAppleA8Str, std::size(kAppleA8Str) - 1)) {
return GrGLRenderer::kPowerVRRogue;
}
int adrenoNumber;
@@ -363,15 +363,12 @@ static GrGLRenderer get_renderer(const char* rendererString, const GrGLExtension
if (strstr(rendererString, "llvmpipe")) {
return GrGLRenderer::kGalliumLLVM;
}
- if (strstr(rendererString, "virgl")) {
- return GrGLRenderer::kVirgl;
- }
static const char kMaliGStr[] = "Mali-G";
- if (0 == strncmp(rendererString, kMaliGStr, SK_ARRAY_COUNT(kMaliGStr) - 1)) {
+ if (0 == strncmp(rendererString, kMaliGStr, std::size(kMaliGStr) - 1)) {
return GrGLRenderer::kMaliG;
}
static const char kMaliTStr[] = "Mali-T";
- if (0 == strncmp(rendererString, kMaliTStr, SK_ARRAY_COUNT(kMaliTStr) - 1)) {
+ if (0 == strncmp(rendererString, kMaliTStr, std::size(kMaliTStr) - 1)) {
return GrGLRenderer::kMaliT;
}
int mali400Num;
@@ -388,12 +385,16 @@ static bool is_commamd_buffer(const char* rendererString, const char* versionStr
int major, minor;
static const char kChromium[] = "Chromium";
- char suffix[SK_ARRAY_COUNT(kChromium)] = {0};
+ char suffix[std::size(kChromium)] = {0};
return (0 == strcmp(rendererString, kChromium) ||
(3 == sscanf(versionString, "OpenGL ES %d.%d %8s", &major, &minor, suffix) &&
0 == strcmp(kChromium, suffix)));
}
+static bool is_virgl(const char* rendererString) {
+ return !!strstr(rendererString, "virgl");
+}
+
static std::tuple<GrGLDriver, GrGLDriverVersion> get_driver_and_version(GrGLStandard standard,
GrGLVendor vendor,
const char* vendorString,
@@ -578,7 +579,7 @@ static std::tuple<GrGLANGLEBackend, SkString> get_angle_backend(const char* rend
// crbug.com/1203705 ANGLE renderer will be "ANGLE (<gl-vendor>, <gl-renderer>, <gl-version>)"
// on ANGLE's GL backend with related substitutions for the inner strings on other backends.
static constexpr char kHeader[] = "ANGLE (";
- static constexpr size_t kHeaderLength = SK_ARRAY_COUNT(kHeader) - 1;
+ static constexpr size_t kHeaderLength = std::size(kHeader) - 1;
int rendererLength = strlen(rendererString);
if (!strncmp(rendererString, kHeader, kHeaderLength) &&
rendererString[rendererLength - 1] == ')') {
@@ -588,6 +589,8 @@ static std::tuple<GrGLANGLEBackend, SkString> get_angle_backend(const char* rend
return {GrGLANGLEBackend::kD3D11, std::move(innerString)};
} else if (strstr(rendererString, "Direct3D9")) {
return {GrGLANGLEBackend::kD3D9, std::move(innerString)};
+ } else if (strstr(rendererString, "Metal")) {
+ return {GrGLANGLEBackend::kMetal, std::move(innerString)};
} else if (strstr(rendererString, "OpenGL")) {
return {GrGLANGLEBackend::kOpenGL, std::move(innerString)};
}
@@ -730,6 +733,8 @@ GrGLDriverInfo GrGLGetDriverInfo(const GrGLInterface* interface) {
info.fIsOverCommandBuffer = is_commamd_buffer(renderer, version);
+ info.fIsRunningOverVirgl = is_virgl(renderer);
+
return info;
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLUtil.h b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLUtil.h
index f8a33c2b507..14c910adcdd 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLUtil.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/GrGLUtil.h
@@ -196,8 +196,6 @@ enum class GrGLRenderer {
kGalliumLLVM,
- kVirgl,
-
kMali4xx,
/** G-3x, G-5x, or G-7x */
kMaliG,
@@ -230,6 +228,7 @@ enum class GrGLANGLEBackend {
kUnknown,
kD3D9,
kD3D11,
+ kMetal,
kOpenGL
};
@@ -312,6 +311,9 @@ struct GrGLDriverInfo {
// Are we running over the Chrome interprocess command buffer?
bool fIsOverCommandBuffer = false;
+
+ // Running over virgl guest driver.
+ bool fIsRunningOverVirgl = false;
};
GrGLDriverInfo GrGLGetDriverInfo(const GrGLInterface*);
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/builders/GrGLProgramBuilder.cpp b/chromium/third_party/skia/src/gpu/ganesh/gl/builders/GrGLProgramBuilder.cpp
index 26029cc6220..745dbe547ed 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/builders/GrGLProgramBuilder.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/builders/GrGLProgramBuilder.cpp
@@ -8,7 +8,6 @@
#include "src/gpu/ganesh/gl/builders/GrGLProgramBuilder.h"
#include "include/gpu/GrDirectContext.h"
-#include "src/core/SkATrace.h"
#include "src/core/SkAutoMalloc.h"
#include "src/core/SkReadBuffer.h"
#include "src/core/SkTraceEvent.h"
@@ -156,7 +155,7 @@ static constexpr SkFourByteTag kGLPB_Tag = SkSetFourByteTag('G', 'L', 'P', 'B');
void GrGLProgramBuilder::storeShaderInCache(const SkSL::Program::Inputs& inputs, GrGLuint programID,
const std::string shaders[], bool isSkSL,
- SkSL::Program::Settings* settings) {
+ SkSL::ProgramSettings* settings) {
if (!this->gpu()->getContext()->priv().getPersistentCache()) {
return;
}
@@ -229,7 +228,7 @@ sk_sp<GrGLProgram> GrGLProgramBuilder::finalize(const GrGLPrecompiledProgram* pr
// compile shaders and bind attributes / uniforms
auto errorHandler = this->gpu()->getContext()->priv().getShaderErrorHandler();
const GrGeometryProcessor& geomProc = this->geometryProcessor();
- SkSL::Program::Settings settings;
+ SkSL::ProgramSettings settings;
settings.fSharpenTextures = true;
settings.fFragColorIsInOut = this->fragColorIsInOut();
@@ -490,7 +489,7 @@ bool GrGLProgramBuilder::PrecompileProgram(GrDirectContext* dContext,
const GrGLInterface* gl = glGpu->glInterface();
auto errorHandler = dContext->priv().getShaderErrorHandler();
- SkSL::Program::Settings settings;
+ SkSL::ProgramSettings settings;
settings.fSharpenTextures = true;
GrPersistentCacheUtils::ShaderMetadata meta;
meta.fSettings = &settings;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/builders/GrGLProgramBuilder.h b/chromium/third_party/skia/src/gpu/ganesh/gl/builders/GrGLProgramBuilder.h
index fcdb5d4a606..ac874e6e274 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/builders/GrGLProgramBuilder.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/builders/GrGLProgramBuilder.h
@@ -73,7 +73,7 @@ private:
bool bindAttribLocations);
void storeShaderInCache(const SkSL::Program::Inputs& inputs, GrGLuint programID,
const std::string shaders[], bool isSkSL,
- SkSL::Program::Settings* settings);
+ SkSL::ProgramSettings* settings);
sk_sp<GrGLProgram> finalize(const GrGLPrecompiledProgram*);
void bindProgramResourceLocations(GrGLuint programID);
bool checkLinkStatus(GrGLuint programID, GrContextOptions::ShaderErrorHandler* errorHandler,
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/builders/GrGLShaderStringBuilder.cpp b/chromium/third_party/skia/src/gpu/ganesh/gl/builders/GrGLShaderStringBuilder.cpp
index a275cd9ee9c..4eda9cce58a 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/builders/GrGLShaderStringBuilder.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/builders/GrGLShaderStringBuilder.cpp
@@ -21,7 +21,7 @@ static const bool gPrintGLSL = false;
std::unique_ptr<SkSL::Program> GrSkSLtoGLSL(const GrGLGpu* gpu,
SkSL::ProgramKind programKind,
const std::string& sksl,
- const SkSL::Program::Settings& settings,
+ const SkSL::ProgramSettings& settings,
std::string* glsl,
GrContextOptions::ShaderErrorHandler* errorHandler) {
SkSL::Compiler* compiler = gpu->shaderCompiler();
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/builders/GrGLShaderStringBuilder.h b/chromium/third_party/skia/src/gpu/ganesh/gl/builders/GrGLShaderStringBuilder.h
index 73e637fe1ca..f3985b6e6aa 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/builders/GrGLShaderStringBuilder.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/builders/GrGLShaderStringBuilder.h
@@ -17,7 +17,7 @@
std::unique_ptr<SkSL::Program> GrSkSLtoGLSL(const GrGLGpu* gpu,
SkSL::ProgramKind programKind,
const std::string& sksl,
- const SkSL::Program::Settings& settings,
+ const SkSL::ProgramSettings& settings,
std::string* glsl,
GrContextOptions::ShaderErrorHandler* errorHandler);
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/egl/BUILD.bazel b/chromium/third_party/skia/src/gpu/ganesh/gl/egl/BUILD.bazel
index 69666adff23..a208ecffdf1 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/egl/BUILD.bazel
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/egl/BUILD.bazel
@@ -3,3 +3,7 @@ load("//bazel:macros.bzl", "exports_files_legacy")
licenses(["notice"])
exports_files_legacy()
+
+filegroup(
+ name = "srcs",
+)
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/iOS/BUILD.bazel b/chromium/third_party/skia/src/gpu/ganesh/gl/iOS/BUILD.bazel
index 69666adff23..a208ecffdf1 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/iOS/BUILD.bazel
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/iOS/BUILD.bazel
@@ -3,3 +3,7 @@ load("//bazel:macros.bzl", "exports_files_legacy")
licenses(["notice"])
exports_files_legacy()
+
+filegroup(
+ name = "srcs",
+)
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/mac/BUILD.bazel b/chromium/third_party/skia/src/gpu/ganesh/gl/mac/BUILD.bazel
index 69666adff23..41677c9bd3b 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/mac/BUILD.bazel
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/mac/BUILD.bazel
@@ -3,3 +3,11 @@ load("//bazel:macros.bzl", "exports_files_legacy")
licenses(["notice"])
exports_files_legacy()
+
+filegroup(
+ name = "srcs",
+ srcs = [
+ "GrGLMakeNativeInterface_mac.cpp",
+ ],
+ visibility = ["//src/gpu/ganesh/gl:__pkg__"],
+)
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gl/win/BUILD.bazel b/chromium/third_party/skia/src/gpu/ganesh/gl/win/BUILD.bazel
index 69666adff23..a208ecffdf1 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gl/win/BUILD.bazel
+++ b/chromium/third_party/skia/src/gpu/ganesh/gl/win/BUILD.bazel
@@ -3,3 +3,7 @@ load("//bazel:macros.bzl", "exports_files_legacy")
licenses(["notice"])
exports_files_legacy()
+
+filegroup(
+ name = "srcs",
+)
diff --git a/chromium/third_party/skia/src/gpu/ganesh/glsl/BUILD.bazel b/chromium/third_party/skia/src/gpu/ganesh/glsl/BUILD.bazel
index 3003b2fab7a..79de0c2b8de 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/glsl/BUILD.bazel
+++ b/chromium/third_party/skia/src/gpu/ganesh/glsl/BUILD.bazel
@@ -5,8 +5,6 @@ licenses(["notice"])
exports_files_legacy()
GLSL_FILES = [
- "GrGLSL.cpp",
- "GrGLSL.h",
"GrGLSLBlend.cpp",
"GrGLSLBlend.h",
"GrGLSLColorSpaceXformHelper.h",
diff --git a/chromium/third_party/skia/src/gpu/ganesh/glsl/GrGLSL.cpp b/chromium/third_party/skia/src/gpu/ganesh/glsl/GrGLSL.cpp
deleted file mode 100644
index 3095941ef91..00000000000
--- a/chromium/third_party/skia/src/gpu/ganesh/glsl/GrGLSL.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "src/gpu/ganesh/glsl/GrGLSL.h"
-
-const char* GrGLSLTypeString(SkSLType t) {
- switch (t) {
- case SkSLType::kVoid: return "void";
- case SkSLType::kBool: return "bool";
- case SkSLType::kBool2: return "bool2";
- case SkSLType::kBool3: return "bool3";
- case SkSLType::kBool4: return "bool4";
- case SkSLType::kShort: return "short";
- case SkSLType::kShort2: return "short2";
- case SkSLType::kShort3: return "short3";
- case SkSLType::kShort4: return "short4";
- case SkSLType::kUShort: return "ushort";
- case SkSLType::kUShort2: return "ushort2";
- case SkSLType::kUShort3: return "ushort3";
- case SkSLType::kUShort4: return "ushort4";
- case SkSLType::kFloat: return "float";
- case SkSLType::kFloat2: return "float2";
- case SkSLType::kFloat3: return "float3";
- case SkSLType::kFloat4: return "float4";
- case SkSLType::kFloat2x2: return "float2x2";
- case SkSLType::kFloat3x3: return "float3x3";
- case SkSLType::kFloat4x4: return "float4x4";
- case SkSLType::kHalf: return "half";
- case SkSLType::kHalf2: return "half2";
- case SkSLType::kHalf3: return "half3";
- case SkSLType::kHalf4: return "half4";
- case SkSLType::kHalf2x2: return "half2x2";
- case SkSLType::kHalf3x3: return "half3x3";
- case SkSLType::kHalf4x4: return "half4x4";
- case SkSLType::kInt: return "int";
- case SkSLType::kInt2: return "int2";
- case SkSLType::kInt3: return "int3";
- case SkSLType::kInt4: return "int4";
- case SkSLType::kUInt: return "uint";
- case SkSLType::kUInt2: return "uint2";
- case SkSLType::kUInt3: return "uint3";
- case SkSLType::kUInt4: return "uint4";
- case SkSLType::kTexture2DSampler: return "sampler2D";
- case SkSLType::kTextureExternalSampler: return "samplerExternalOES";
- case SkSLType::kTexture2DRectSampler: return "sampler2DRect";
- case SkSLType::kTexture2D: return "texture2D";
- case SkSLType::kSampler: return "sampler";
- case SkSLType::kInput: return "subpassInput";
- }
- SK_ABORT("Unknown shader var type.");
-}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/glsl/GrGLSL.h b/chromium/third_party/skia/src/gpu/ganesh/glsl/GrGLSL.h
deleted file mode 100644
index 7c867018469..00000000000
--- a/chromium/third_party/skia/src/gpu/ganesh/glsl/GrGLSL.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrGLSL_DEFINED
-#define GrGLSL_DEFINED
-
-#include "src/core/SkSLTypeShared.h"
-#include "src/sksl/SkSLGLSL.h"
-
-const char* GrGLSLTypeString(SkSLType);
-
-#endif
diff --git a/chromium/third_party/skia/src/gpu/ganesh/glsl/GrGLSLProgramBuilder.cpp b/chromium/third_party/skia/src/gpu/ganesh/glsl/GrGLSLProgramBuilder.cpp
index 1a9a1fa0fc8..509f8c33053 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/glsl/GrGLSLProgramBuilder.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/glsl/GrGLSLProgramBuilder.cpp
@@ -275,7 +275,7 @@ void GrGLSLProgramBuilder::writeFPFunction(const GrFragmentProcessor& fp,
}
}
- SkASSERT(numParams <= (int)SK_ARRAY_COUNT(params));
+ SkASSERT(numParams <= (int)std::size(params));
// First, emit every child's function. This needs to happen (even for children that aren't
// sampled), so that all of the expected uniforms are registered.
@@ -293,7 +293,7 @@ void GrGLSLProgramBuilder::writeFPFunction(const GrFragmentProcessor& fp,
fFS.emitFunction(SkSLType::kHalf4,
impl.functionName(),
- SkMakeSpan(params, numParams),
+ SkSpan(params, numParams),
fFS.code().c_str());
fFS.deleteStage();
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/glsl/GrGLSLShaderBuilder.cpp b/chromium/third_party/skia/src/gpu/ganesh/glsl/GrGLSLShaderBuilder.cpp
index 7d0dc7f330e..a88754073e4 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/glsl/GrGLSLShaderBuilder.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/glsl/GrGLSLShaderBuilder.cpp
@@ -7,6 +7,7 @@
#include "src/gpu/ganesh/glsl/GrGLSLShaderBuilder.h"
+#include "src/core/SkSLTypeShared.h"
#include "src/gpu/Blend.h"
#include "src/gpu/Swizzle.h"
#include "src/gpu/ganesh/GrShaderCaps.h"
@@ -50,7 +51,7 @@ SkString GrGLSLShaderBuilder::getMangledFunctionName(const char* baseName) {
void GrGLSLShaderBuilder::appendFunctionDecl(SkSLType returnType,
const char* mangledName,
SkSpan<const GrShaderVar> args) {
- this->functions().appendf("%s %s(", GrGLSLTypeString(returnType), mangledName);
+ this->functions().appendf("%s %s(", SkSLTypeString(returnType), mangledName);
for (size_t i = 0; i < args.size(); ++i) {
if (i > 0) {
this->functions().append(", ");
@@ -193,7 +194,7 @@ void GrGLSLShaderBuilder::appendColorGamutXform(SkString* out,
}
body.append("return s * x;");
SkString funcName = this->getMangledFunctionName(name);
- this->emitFunction(SkSLType::kHalf, funcName.c_str(), {gTFArgs, SK_ARRAY_COUNT(gTFArgs)},
+ this->emitFunction(SkSLType::kHalf, funcName.c_str(), {gTFArgs, std::size(gTFArgs)},
body.c_str());
return funcName;
};
@@ -219,7 +220,7 @@ void GrGLSLShaderBuilder::appendColorGamutXform(SkString* out,
body.append("return color;");
gamutXformFuncName = this->getMangledFunctionName("gamut_xform");
this->emitFunction(SkSLType::kHalf4, gamutXformFuncName.c_str(),
- {gGamutXformArgs, SK_ARRAY_COUNT(gGamutXformArgs)}, body.c_str());
+ {gGamutXformArgs, std::size(gGamutXformArgs)}, body.c_str());
}
// Now define a wrapper function that applies all the intermediate steps
@@ -255,7 +256,7 @@ void GrGLSLShaderBuilder::appendColorGamutXform(SkString* out,
body.append("return half4(color);");
SkString colorXformFuncName = this->getMangledFunctionName("color_xform");
this->emitFunction(SkSLType::kHalf4, colorXformFuncName.c_str(),
- {gColorXformArgs, SK_ARRAY_COUNT(gColorXformArgs)}, body.c_str());
+ {gColorXformArgs, std::size(gColorXformArgs)}, body.c_str());
out->appendf("%s(%s)", colorXformFuncName.c_str(), srcColor);
}
}
@@ -309,7 +310,7 @@ void GrGLSLShaderBuilder::compileAndAppendLayoutQualifiers() {
static_assert(0 == GrGLSLShaderBuilder::kIn_InterfaceQualifier);
static_assert(1 == GrGLSLShaderBuilder::kOut_InterfaceQualifier);
- static_assert(SK_ARRAY_COUNT(interfaceQualifierNames) == kLastInterfaceQualifier + 1);
+ static_assert(std::size(interfaceQualifierNames) == kLastInterfaceQualifier + 1);
}
void GrGLSLShaderBuilder::finalize(uint32_t visibility) {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/glsl/GrGLSLUniformHandler.cpp b/chromium/third_party/skia/src/gpu/ganesh/glsl/GrGLSLUniformHandler.cpp
index ce03012b083..e3d499156e2 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/glsl/GrGLSLUniformHandler.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/glsl/GrGLSLUniformHandler.cpp
@@ -7,7 +7,6 @@
#include "src/gpu/ganesh/glsl/GrGLSLUniformHandler.h"
-#include "src/gpu/ganesh/glsl/GrGLSL.h"
#include "src/gpu/ganesh/glsl/GrGLSLShaderBuilder.h"
GrShaderVar GrGLSLUniformHandler::getUniformMapping(const GrProcessor& owner,
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gradients/GrGradientShader.cpp b/chromium/third_party/skia/src/gpu/ganesh/gradients/GrGradientShader.cpp
index 3e5031eb8fb..0960fe8283f 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gradients/GrGradientShader.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/gradients/GrGradientShader.cpp
@@ -54,7 +54,8 @@ static std::unique_ptr<GrFragmentProcessor> make_textured_colorizer(const SkPMCo
SkASSERT(1 == bitmap.height() && SkIsPow2(bitmap.width()));
SkASSERT(bitmap.isImmutable());
- auto view = std::get<0>(GrMakeCachedBitmapProxyView(args.fContext, bitmap, GrMipmapped::kNo));
+ auto view = std::get<0>(GrMakeCachedBitmapProxyView(
+ args.fContext, bitmap, /*label=*/"MakeTexturedColorizer", GrMipmapped::kNo));
if (!view) {
SkDebugf("Gradient won't draw. Could not create texture.");
return nullptr;
@@ -67,7 +68,7 @@ static std::unique_ptr<GrFragmentProcessor> make_textured_colorizer(const SkPMCo
static std::unique_ptr<GrFragmentProcessor> make_single_interval_colorizer(const SkPMColor4f& start,
const SkPMColor4f& end) {
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
uniform half4 start;
uniform half4 end;
half4 main(float2 coord) {
@@ -87,7 +88,7 @@ static std::unique_ptr<GrFragmentProcessor> make_dual_interval_colorizer(const S
const SkPMColor4f& c2,
const SkPMColor4f& c3,
float threshold) {
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
uniform float4 scale[2];
uniform float4 bias[2];
uniform half threshold;
@@ -120,8 +121,8 @@ static std::unique_ptr<GrFragmentProcessor> make_dual_interval_colorizer(const S
vc2 - threshold * scale[1]};
return GrSkSLFP::Make(effect, "DualIntervalColorizer", /*inputFP=*/nullptr,
GrSkSLFP::OptFlags::kNone,
- "scale", SkMakeSpan(scale),
- "bias", SkMakeSpan(bias),
+ "scale", SkSpan(scale),
+ "bias", SkSpan(bias),
"threshold", threshold);
}
@@ -139,7 +140,7 @@ static std::unique_ptr<GrFragmentProcessor> make_unrolled_colorizer(int interval
SkASSERT(intervalCount >= 1 && intervalCount <= 8);
static SkOnce once[kMaxUnrolledIntervalCount];
- static sk_sp<SkRuntimeEffect> effects[kMaxUnrolledIntervalCount];
+ static const SkRuntimeEffect* effects[kMaxUnrolledIntervalCount];
once[intervalCount - 1]([intervalCount] {
SkString sksl;
@@ -228,15 +229,15 @@ static std::unique_ptr<GrFragmentProcessor> make_unrolled_colorizer(int interval
auto result = SkRuntimeEffect::MakeForShader(std::move(sksl));
SkASSERTF(result.effect, "%s", result.errorText.c_str());
- effects[intervalCount - 1] = std::move(result.effect);
+ effects[intervalCount - 1] = result.effect.release();
});
return GrSkSLFP::Make(effects[intervalCount - 1], "UnrolledBinaryColorizer",
/*inputFP=*/nullptr, GrSkSLFP::OptFlags::kNone,
"thresholds1_7", thresholds1_7,
"thresholds9_13", thresholds9_13,
- "scale", SkMakeSpan(scale, intervalCount),
- "bias", SkMakeSpan(bias, intervalCount));
+ "scale", SkSpan(scale, intervalCount),
+ "bias", SkSpan(bias, intervalCount));
}
// The "looping" colorizer uses a real loop to binary-search the array of gradient stops.
@@ -254,11 +255,11 @@ static std::unique_ptr<GrFragmentProcessor> make_looping_colorizer(int intervalC
struct EffectCacheEntry {
SkOnce once;
- sk_sp<SkRuntimeEffect> effect;
+ const SkRuntimeEffect* effect;
};
static EffectCacheEntry effectCache[kMaxLoopingIntervalCount / 4];
- SkASSERT(cacheIndex >= 0 && cacheIndex < (int)SK_ARRAY_COUNT(effectCache));
+ SkASSERT(cacheIndex >= 0 && cacheIndex < (int)std::size(effectCache));
EffectCacheEntry* cacheEntry = &effectCache[cacheIndex];
cacheEntry->once([intervalCount, intervalChunks, cacheEntry] {
@@ -320,14 +321,14 @@ static std::unique_ptr<GrFragmentProcessor> make_looping_colorizer(int intervalC
auto result = SkRuntimeEffect::MakeForShader(std::move(sksl));
SkASSERTF(result.effect, "%s", result.errorText.c_str());
- cacheEntry->effect = std::move(result.effect);
+ cacheEntry->effect = result.effect.release();
});
return GrSkSLFP::Make(cacheEntry->effect, "LoopingBinaryColorizer",
/*inputFP=*/nullptr, GrSkSLFP::OptFlags::kNone,
- "thresholds", SkMakeSpan((const SkV4*)thresholds, intervalChunks),
- "scale", SkMakeSpan(scale, intervalCount),
- "bias", SkMakeSpan(bias, intervalCount));
+ "thresholds", SkSpan((const SkV4*)thresholds, intervalChunks),
+ "scale", SkSpan(scale, intervalCount),
+ "bias", SkSpan(bias, intervalCount));
}
// Converts an input array of {colors, positions} into an array of {scales, biases, thresholds}.
@@ -539,7 +540,7 @@ static std::unique_ptr<GrFragmentProcessor> make_clamped_gradient(
SkPMColor4f rightBorderColor,
bool makePremul,
bool colorsAreOpaque) {
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
uniform shader colorizer;
uniform shader gradLayout;
@@ -602,7 +603,7 @@ static std::unique_ptr<GrFragmentProcessor> make_tiled_gradient(
bool mirror,
bool makePremul,
bool colorsAreOpaque) {
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
uniform shader colorizer;
uniform shader gradLayout;
@@ -667,13 +668,14 @@ static std::unique_ptr<GrFragmentProcessor> make_tiled_gradient(
GrSkSLFP::Specialize<int>(useFloorAbsWorkaround));
}
+namespace GrGradientShader {
+
// Combines the colorizer and layout with an appropriately configured top-level effect based on the
// gradient's tile mode
-static std::unique_ptr<GrFragmentProcessor> make_gradient(
- const SkGradientShaderBase& shader,
- const GrFPArgs& args,
- std::unique_ptr<GrFragmentProcessor> layout,
- const SkMatrix* overrideMatrix = nullptr) {
+std::unique_ptr<GrFragmentProcessor> MakeGradientFP(const SkGradientShaderBase& shader,
+ const GrFPArgs& args,
+ std::unique_ptr<GrFragmentProcessor> layout,
+ const SkMatrix* overrideMatrix) {
// No shader is possible if a layout couldn't be created, e.g. a layout-specific Make() returned
// null.
if (layout == nullptr) {
@@ -768,8 +770,6 @@ static std::unique_ptr<GrFragmentProcessor> make_gradient(
return gradient;
}
-namespace GrGradientShader {
-
std::unique_ptr<GrFragmentProcessor> MakeLinear(const SkLinearGradient& shader,
const GrFPArgs& args) {
// We add a tiny delta to t. When gradient stops are set up so that a hard stop in a vertically
@@ -779,7 +779,7 @@ std::unique_ptr<GrFragmentProcessor> MakeLinear(const SkLinearGradient& shader,
// falls at X.5 - delta then we still could get inconsistent results, but that is much less
// likely. crbug.com/938592
// If/when we add filtering of the gradient this can be removed.
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
half4 main(float2 coord) {
return half4(half(coord.x) + 0.00001, 1, 0, 0); // y = 1 for always valid
}
@@ -787,201 +787,7 @@ std::unique_ptr<GrFragmentProcessor> MakeLinear(const SkLinearGradient& shader,
// The linear gradient never rejects a pixel so it doesn't change opacity
auto fp = GrSkSLFP::Make(effect, "LinearLayout", /*inputFP=*/nullptr,
GrSkSLFP::OptFlags::kPreservesOpaqueInput);
- return make_gradient(shader, args, std::move(fp));
-}
-
-std::unique_ptr<GrFragmentProcessor> MakeRadial(const SkRadialGradient& shader,
- const GrFPArgs& args) {
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
- half4 main(float2 coord) {
- return half4(half(length(coord)), 1, 0, 0); // y = 1 for always valid
- }
- )");
- // The radial gradient never rejects a pixel so it doesn't change opacity
- auto fp = GrSkSLFP::Make(effect, "RadialLayout", /*inputFP=*/nullptr,
- GrSkSLFP::OptFlags::kPreservesOpaqueInput);
- return make_gradient(shader, args, std::move(fp));
-}
-
-std::unique_ptr<GrFragmentProcessor> MakeSweep(const SkSweepGradient& shader,
- const GrFPArgs& args) {
- // On some devices they incorrectly implement atan2(y,x) as atan(y/x). In actuality it is
- // atan2(y,x) = 2 * atan(y / (sqrt(x^2 + y^2) + x)). So to work around this we pass in (sqrt(x^2
- // + y^2) + x) as the second parameter to atan2 in these cases. We let the device handle the
- // undefined behavior of the second paramenter being 0 instead of doing the divide ourselves and
- // using atan instead.
- int useAtanWorkaround =
- args.fContext->priv().caps()->shaderCaps()->fAtan2ImplementedAsAtanYOverX;
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
- uniform half bias;
- uniform half scale;
- uniform int useAtanWorkaround; // specialized
-
- half4 main(float2 coord) {
- half angle = bool(useAtanWorkaround)
- ? half(2 * atan(-coord.y, length(coord) - coord.x))
- : half(atan(-coord.y, -coord.x));
-
- // 0.1591549430918 is 1/(2*pi), used since atan returns values [-pi, pi]
- half t = (angle * 0.1591549430918 + 0.5 + bias) * scale;
- return half4(t, 1, 0, 0); // y = 1 for always valid
- }
- )");
- // The sweep gradient never rejects a pixel so it doesn't change opacity
- auto fp = GrSkSLFP::Make(effect, "SweepLayout", /*inputFP=*/nullptr,
- GrSkSLFP::OptFlags::kPreservesOpaqueInput,
- "bias", shader.getTBias(),
- "scale", shader.getTScale(),
- "useAtanWorkaround", GrSkSLFP::Specialize(useAtanWorkaround));
- return make_gradient(shader, args, std::move(fp));
-}
-
-std::unique_ptr<GrFragmentProcessor> MakeConical(const SkTwoPointConicalGradient& shader,
- const GrFPArgs& args) {
- // The 2 point conical gradient can reject a pixel so it does change opacity even if the input
- // was opaque. Thus, all of these layout FPs disable that optimization.
- std::unique_ptr<GrFragmentProcessor> fp;
- SkTLazy<SkMatrix> matrix;
- switch (shader.getType()) {
- case SkTwoPointConicalGradient::Type::kStrip: {
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
- uniform half r0_2;
- half4 main(float2 p) {
- half v = 1; // validation flag, set to negative to discard fragment later
- float t = r0_2 - p.y * p.y;
- if (t >= 0) {
- t = p.x + sqrt(t);
- } else {
- v = -1;
- }
- return half4(half(t), v, 0, 0);
- }
- )");
- float r0 = shader.getStartRadius() / shader.getCenterX1();
- fp = GrSkSLFP::Make(effect, "TwoPointConicalStripLayout", /*inputFP=*/nullptr,
- GrSkSLFP::OptFlags::kNone,
- "r0_2", r0 * r0);
- } break;
-
- case SkTwoPointConicalGradient::Type::kRadial: {
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
- uniform half r0;
- uniform half lengthScale;
- half4 main(float2 p) {
- half v = 1; // validation flag, set to negative to discard fragment later
- float t = length(p) * lengthScale - r0;
- return half4(half(t), v, 0, 0);
- }
- )");
- float dr = shader.getDiffRadius();
- float r0 = shader.getStartRadius() / dr;
- bool isRadiusIncreasing = dr >= 0;
- fp = GrSkSLFP::Make(effect, "TwoPointConicalRadialLayout", /*inputFP=*/nullptr,
- GrSkSLFP::OptFlags::kNone,
- "r0", r0,
- "lengthScale", isRadiusIncreasing ? 1.0f : -1.0f);
-
- // GPU radial matrix is different from the original matrix, since we map the diff radius
- // to have |dr| = 1, so manually compute the final gradient matrix here.
-
- // Map center to (0, 0)
- matrix.set(SkMatrix::Translate(-shader.getStartCenter().fX,
- -shader.getStartCenter().fY));
- // scale |diffRadius| to 1
- matrix->postScale(1 / dr, 1 / dr);
- } break;
-
- case SkTwoPointConicalGradient::Type::kFocal: {
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
- // Optimization flags, all specialized:
- uniform int isRadiusIncreasing;
- uniform int isFocalOnCircle;
- uniform int isWellBehaved;
- uniform int isSwapped;
- uniform int isNativelyFocal;
-
- uniform half invR1; // 1/r1
- uniform half fx; // focalX = r0/(r0-r1)
-
- half4 main(float2 p) {
- float t = -1;
- half v = 1; // validation flag, set to negative to discard fragment later
-
- float x_t = -1;
- if (bool(isFocalOnCircle)) {
- x_t = dot(p, p) / p.x;
- } else if (bool(isWellBehaved)) {
- x_t = length(p) - p.x * invR1;
- } else {
- float temp = p.x * p.x - p.y * p.y;
-
- // Only do sqrt if temp >= 0; this is significantly slower than checking
- // temp >= 0 in the if statement that checks r(t) >= 0. But GPU may break if
- // we sqrt a negative float. (Although I havevn't observed that on any
- // devices so far, and the old approach also does sqrt negative value
- // without a check.) If the performance is really critical, maybe we should
- // just compute the area where temp and x_t are always valid and drop all
- // these ifs.
- if (temp >= 0) {
- if (bool(isSwapped) || !bool(isRadiusIncreasing)) {
- x_t = -sqrt(temp) - p.x * invR1;
- } else {
- x_t = sqrt(temp) - p.x * invR1;
- }
- }
- }
-
- // The final calculation of t from x_t has lots of static optimizations but only
- // do them when x_t is positive (which can be assumed true if isWellBehaved is
- // true)
- if (!bool(isWellBehaved)) {
- // This will still calculate t even though it will be ignored later in the
- // pipeline to avoid a branch
- if (x_t <= 0.0) {
- v = -1;
- }
- }
- if (bool(isRadiusIncreasing)) {
- if (bool(isNativelyFocal)) {
- t = x_t;
- } else {
- t = x_t + fx;
- }
- } else {
- if (bool(isNativelyFocal)) {
- t = -x_t;
- } else {
- t = -x_t + fx;
- }
- }
-
- if (bool(isSwapped)) {
- t = 1 - t;
- }
-
- return half4(half(t), v, 0, 0);
- }
- )");
-
- const SkTwoPointConicalGradient::FocalData& focalData = shader.getFocalData();
- bool isRadiusIncreasing = (1 - focalData.fFocalX) > 0,
- isFocalOnCircle = focalData.isFocalOnCircle(),
- isWellBehaved = focalData.isWellBehaved(),
- isSwapped = focalData.isSwapped(),
- isNativelyFocal = focalData.isNativelyFocal();
-
- fp = GrSkSLFP::Make(effect, "TwoPointConicalFocalLayout", /*inputFP=*/nullptr,
- GrSkSLFP::OptFlags::kNone,
- "isRadiusIncreasing", GrSkSLFP::Specialize<int>(isRadiusIncreasing),
- "isFocalOnCircle", GrSkSLFP::Specialize<int>(isFocalOnCircle),
- "isWellBehaved", GrSkSLFP::Specialize<int>(isWellBehaved),
- "isSwapped", GrSkSLFP::Specialize<int>(isSwapped),
- "isNativelyFocal", GrSkSLFP::Specialize<int>(isNativelyFocal),
- "invR1", 1.0f / focalData.fR1,
- "fx", focalData.fFocalX);
- } break;
- }
- return make_gradient(shader, args, std::move(fp), matrix.getMaybeNull());
+ return MakeGradientFP(shader, args, std::move(fp));
}
#if GR_TEST_UTILS
diff --git a/chromium/third_party/skia/src/gpu/ganesh/gradients/GrGradientShader.h b/chromium/third_party/skia/src/gpu/ganesh/gradients/GrGradientShader.h
index 6c978080433..0deb30e564b 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/gradients/GrGradientShader.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/gradients/GrGradientShader.h
@@ -10,29 +10,22 @@
#include "src/gpu/ganesh/GrFPArgs.h"
#include "src/gpu/ganesh/GrFragmentProcessor.h"
-#include "src/shaders/gradients/SkGradientShaderPriv.h"
+#include "src/shaders/gradients/SkGradientShaderBase.h"
#include "src/shaders/gradients/SkLinearGradient.h"
-#include "src/shaders/gradients/SkRadialGradient.h"
-#include "src/shaders/gradients/SkSweepGradient.h"
-#include "src/shaders/gradients/SkTwoPointConicalGradient.h"
#if GR_TEST_UTILS
#include "include/utils/SkRandom.h"
#endif
namespace GrGradientShader {
- std::unique_ptr<GrFragmentProcessor> MakeLinear(const SkLinearGradient& shader,
- const GrFPArgs& args);
+ std::unique_ptr<GrFragmentProcessor> MakeGradientFP(const SkGradientShaderBase& shader,
+ const GrFPArgs& args,
+ std::unique_ptr<GrFragmentProcessor> layout,
+ const SkMatrix* overrideMatrix = nullptr);
- std::unique_ptr<GrFragmentProcessor> MakeRadial(const SkRadialGradient& shader,
+ std::unique_ptr<GrFragmentProcessor> MakeLinear(const SkLinearGradient& shader,
const GrFPArgs& args);
- std::unique_ptr<GrFragmentProcessor> MakeSweep(const SkSweepGradient& shader,
- const GrFPArgs& args);
-
- std::unique_ptr<GrFragmentProcessor> MakeConical(const SkTwoPointConicalGradient& shader,
- const GrFPArgs& args);
-
#if GR_TEST_UTILS
/** Helper struct that stores (and populates) parameters to construct a random gradient.
If fUseColors4f is true, then the SkColor4f factory should be called, with fColors4f and
diff --git a/chromium/third_party/skia/src/gpu/ganesh/mock/GrMockBuffer.h b/chromium/third_party/skia/src/gpu/ganesh/mock/GrMockBuffer.h
index fa4efc6d183..84c252369ae 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/mock/GrMockBuffer.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/mock/GrMockBuffer.h
@@ -22,13 +22,15 @@ public:
}
private:
- void onMap() override {
+ void onMap(MapType) override {
if (GrCaps::kNone_MapFlags != this->getGpu()->caps()->mapBufferFlags()) {
fMapPtr = sk_malloc_throw(this->size());
}
}
- void onUnmap() override { sk_free(fMapPtr); }
- bool onUpdateData(const void* src, size_t srcSizeInBytes) override { return true; }
+ void onUnmap(MapType) override { sk_free(fMapPtr); }
+ bool onUpdateData(const void* src, size_t offset, size_t size, bool preserve) override {
+ return true;
+ }
using INHERITED = GrGpuBuffer;
};
diff --git a/chromium/third_party/skia/src/gpu/ganesh/mock/GrMockGpu.h b/chromium/third_party/skia/src/gpu/ganesh/mock/GrMockGpu.h
index 4c5d52e0b60..072033e51dd 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/mock/GrMockGpu.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/mock/GrMockGpu.h
@@ -110,6 +110,14 @@ private:
return true;
}
+ bool onTransferFromBufferToBuffer(sk_sp<GrGpuBuffer> src,
+ size_t srcOffset,
+ sk_sp<GrGpuBuffer> dst,
+ size_t dstOffset,
+ size_t size) override {
+ return true;
+ }
+
bool onTransferPixelsTo(GrTexture*,
SkIRect,
GrColorType surfaceColorType,
diff --git a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlAttachment.h b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlAttachment.h
index cfa6d83e84f..95f850f4f08 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlAttachment.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlAttachment.h
@@ -39,7 +39,8 @@ public:
SkISize dimensions,
id<MTLTexture>,
UsageFlags attachmentUsages,
- GrWrapCacheable);
+ GrWrapCacheable,
+ std::string_view label);
~GrMtlAttachment() override;
@@ -86,6 +87,8 @@ private:
GrMtlGpu* getMtlGpu() const;
+ void onSetLabel() override;
+
id<MTLTexture> fTexture;
};
diff --git a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlAttachment.mm b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlAttachment.mm
index ffd0c833ae0..86fd7c78445 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlAttachment.mm
+++ b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlAttachment.mm
@@ -151,11 +151,11 @@ sk_sp<GrMtlAttachment> GrMtlAttachment::MakeWrapped(
SkISize dimensions,
id<MTLTexture> texture,
UsageFlags attachmentUsages,
- GrWrapCacheable cacheable) {
+ GrWrapCacheable cacheable,
+ std::string_view label) {
return sk_sp<GrMtlAttachment>(new GrMtlAttachment(gpu, dimensions, attachmentUsages, texture,
- cacheable,
- /*label=*/"MtlAttachment_MakeWrapped"));
+ cacheable, label));
}
GrMtlAttachment::~GrMtlAttachment() {
@@ -178,4 +178,11 @@ GrMtlGpu* GrMtlAttachment::getMtlGpu() const {
return static_cast<GrMtlGpu*>(this->getGpu());
}
+void GrMtlAttachment::onSetLabel() {
+ SkASSERT(fTexture);
+ if (!this->getLabel().empty()) {
+ NSString* labelStr = @(this->getLabel().c_str());
+ fTexture.label = [@"_Skia_" stringByAppendingString:labelStr];
+ }
+}
GR_NORETAIN_END
diff --git a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlBuffer.h b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlBuffer.h
index fe1f57d70e6..f4b47f57cbc 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlBuffer.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlBuffer.h
@@ -18,8 +18,10 @@ class GrMtlGpu;
class GrMtlBuffer: public GrGpuBuffer {
public:
- static sk_sp<GrMtlBuffer> Make(GrMtlGpu*, size_t size, GrGpuBufferType intendedType,
- GrAccessPattern, const void* data = nullptr);
+ static sk_sp<GrMtlBuffer> Make(GrMtlGpu*,
+ size_t size,
+ GrGpuBufferType intendedType,
+ GrAccessPattern);
~GrMtlBuffer() override;
@@ -38,17 +40,19 @@ protected:
private:
GrMtlGpu* mtlGpu() const;
- void onMap() override;
- void onUnmap() override;
- bool onUpdateData(const void* src, size_t srcSizeInBytes) override;
+ void onMap(MapType) override;
+ void onUnmap(MapType) override;
+ bool onUpdateData(const void* src, size_t offset, size_t size, bool preserve) override;
- void internalMap(size_t sizeInBytes);
- void internalUnmap(size_t sizeInBytes);
+ void internalMap();
+ void internalUnmap(size_t writtenOffset, size_t writtenSize);
#ifdef SK_DEBUG
void validate() const;
#endif
+ void onSetLabel() override;
+
bool fIsDynamic;
id<MTLBuffer> fMtlBuffer;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlBuffer.mm b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlBuffer.mm
index 660708b39a3..0c8d7dded47 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlBuffer.mm
+++ b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlBuffer.mm
@@ -35,14 +35,15 @@ NSString* kBufferTypeNames[kGrGpuBufferTypeCount] = {
};
#endif
-sk_sp<GrMtlBuffer> GrMtlBuffer::Make(GrMtlGpu* gpu, size_t size, GrGpuBufferType intendedType,
- GrAccessPattern accessPattern, const void* data) {
- sk_sp<GrMtlBuffer> buffer(new GrMtlBuffer(gpu, size, intendedType, accessPattern,
+sk_sp<GrMtlBuffer> GrMtlBuffer::Make(GrMtlGpu* gpu,
+ size_t size,
+ GrGpuBufferType intendedType,
+ GrAccessPattern accessPattern) {
+ return sk_sp<GrMtlBuffer>(new GrMtlBuffer(gpu,
+ size,
+ intendedType,
+ accessPattern,
/*label=*/"MakeMtlBuffer"));
- if (data && !buffer->onUpdateData(data, size)) {
- return nullptr;
- }
- return buffer;
}
GrMtlBuffer::GrMtlBuffer(GrMtlGpu* gpu, size_t size, GrGpuBufferType intendedType,
@@ -82,46 +83,47 @@ GrMtlBuffer::~GrMtlBuffer() {
SkASSERT(!fMapPtr);
}
-bool GrMtlBuffer::onUpdateData(const void* src, size_t sizeInBytes) {
- if (this->wasDestroyed()) {
- return false;
- }
-
- if (sizeInBytes > this->size()) {
- return false;
- }
-
+bool GrMtlBuffer::onUpdateData(const void *src, size_t offset, size_t size, bool preserve) {
if (fIsDynamic) {
- this->internalMap(sizeInBytes);
+ this->internalMap();
if (!fMapPtr) {
return false;
}
- memcpy(fMapPtr, src, sizeInBytes);
- this->internalUnmap(sizeInBytes);
- } else {
- // copy data to gpu buffer
- GrStagingBufferManager::Slice slice;
- slice = this->mtlGpu()->stagingBufferManager()->allocateStagingBufferSlice(
- sizeInBytes, this->mtlGpu()->mtlCaps().getMinBufferAlignment());
- if (!slice.fBuffer) {
- return false;
- }
- memcpy(slice.fOffsetMapPtr, src, sizeInBytes);
+ memcpy(SkTAddOffset<void>(fMapPtr, offset), src, size);
+ this->internalUnmap(offset, size);
+ return true;
+ }
+ // Update via transfer buffer.
- GrMtlCommandBuffer* cmdBuffer = this->mtlGpu()->commandBuffer();
- id<MTLBlitCommandEncoder> GR_NORETAIN blitCmdEncoder = cmdBuffer->getBlitCommandEncoder();
- if (!blitCmdEncoder) {
- return false;
- }
- GrMtlBuffer* mtlBuffer = static_cast<GrMtlBuffer*>(slice.fBuffer);
- id<MTLBuffer> transferBuffer = mtlBuffer->mtlBuffer();
- [blitCmdEncoder copyFromBuffer: transferBuffer
- sourceOffset: slice.fOffset
- toBuffer: fMtlBuffer
- destinationOffset: 0
- size: sizeInBytes];
+ // We have to respect the transfer alignment. So we may transfer some extra bytes before and
+ // after the region to be updated.
+ size_t transferAlignment = this->getGpu()->caps()->transferFromBufferToBufferAlignment();
+ size_t r = offset%transferAlignment;
+ SkASSERT(!preserve || r == 0); // We can't push extra bytes when preserving.
+
+ offset -= r;
+ size_t transferSize = SkAlignTo(size + r, transferAlignment);
+
+ GrStagingBufferManager::Slice slice;
+ slice = this->mtlGpu()->stagingBufferManager()->allocateStagingBufferSlice(
+ transferSize, this->mtlGpu()->mtlCaps().getMinBufferAlignment());
+ if (!slice.fBuffer) {
+ return false;
}
+ memcpy(SkTAddOffset<void>(slice.fOffsetMapPtr, r), src, size);
+ GrMtlCommandBuffer* cmdBuffer = this->mtlGpu()->commandBuffer();
+ id<MTLBlitCommandEncoder> GR_NORETAIN blitCmdEncoder = cmdBuffer->getBlitCommandEncoder();
+ if (!blitCmdEncoder) {
+ return false;
+ }
+ GrMtlBuffer* mtlBuffer = static_cast<GrMtlBuffer*>(slice.fBuffer);
+ id<MTLBuffer> transferBuffer = mtlBuffer->mtlBuffer();
+ [blitCmdEncoder copyFromBuffer: transferBuffer
+ sourceOffset: slice.fOffset
+ toBuffer: fMtlBuffer
+ destinationOffset: offset
+ size: transferSize];
return true;
}
@@ -147,41 +149,38 @@ void GrMtlBuffer::onRelease() {
INHERITED::onRelease();
}
-void GrMtlBuffer::internalMap(size_t sizeInBytes) {
+void GrMtlBuffer::internalMap() {
if (fIsDynamic) {
VALIDATE();
- SkASSERT(sizeInBytes <= this->size());
SkASSERT(!this->isMapped());
fMapPtr = static_cast<char*>(fMtlBuffer.contents);
VALIDATE();
}
}
-void GrMtlBuffer::internalUnmap(size_t sizeInBytes) {
+void GrMtlBuffer::internalUnmap(size_t writtenOffset, size_t writtenSize) {
SkASSERT(fMtlBuffer);
if (fIsDynamic) {
VALIDATE();
- SkASSERT(sizeInBytes <= this->size());
+ SkASSERT(writtenOffset + writtenSize <= this->size());
SkASSERT(this->isMapped());
#ifdef SK_BUILD_FOR_MAC
- if (this->mtlGpu()->mtlCaps().isMac()) {
- [fMtlBuffer didModifyRange: NSMakeRange(0, sizeInBytes)];
+ if (this->mtlGpu()->mtlCaps().isMac() && writtenSize) {
+ // We should never write to this type of buffer on the CPU.
+ SkASSERT(this->intendedType() != GrGpuBufferType::kXferGpuToCpu);
+ [fMtlBuffer didModifyRange: NSMakeRange(writtenOffset, writtenSize)];
}
#endif
fMapPtr = nullptr;
}
}
-void GrMtlBuffer::onMap() {
- if (!this->wasDestroyed()) {
- this->internalMap(this->size());
- }
+void GrMtlBuffer::onMap(MapType) {
+ this->internalMap();
}
-void GrMtlBuffer::onUnmap() {
- if (!this->wasDestroyed()) {
- this->internalUnmap(this->size());
- }
+void GrMtlBuffer::onUnmap(MapType type) {
+ this->internalUnmap(0, type == MapType::kWriteDiscard ? this-> size() : 0);
}
#ifdef SK_DEBUG
@@ -197,4 +196,12 @@ void GrMtlBuffer::validate() const {
}
#endif
+void GrMtlBuffer::onSetLabel() {
+ SkASSERT(fMtlBuffer);
+ if (!this->getLabel().empty()) {
+ NSString* labelStr = @(this->getLabel().c_str());
+ fMtlBuffer.label = [@"_Skia_" stringByAppendingString:labelStr];
+ }
+}
+
GR_NORETAIN_END
diff --git a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlCaps.mm b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlCaps.mm
index dec3a752f97..e4378aebae5 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlCaps.mm
+++ b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlCaps.mm
@@ -336,7 +336,16 @@ void GrMtlCaps::initGrCaps(id<MTLDevice> device) {
fMaxTextureSize = fMaxRenderTargetSize;
fMaxPushConstantsSize = 4*1024;
- fTransferBufferAlignment = 1;
+ fTransferBufferRowBytesAlignment = 1;
+
+ // This is documented to be 4 for all Macs. However, on Apple GPUs on Mac it appears there is
+ // no actual alignment requirement
+ // https://developer.apple.com/documentation/metal/mtlblitcommandencoder/1400767-copyfrombuffer
+ if (this->isMac()) {
+ fTransferFromBufferToBufferAlignment = 4;
+ // Buffer updates are sometimes implemented through transfers in GrMtlBuffer.
+ fBufferUpdateDataPreserveAlignment = 4;
+ }
// Init sample counts. All devices support 1 (i.e. 0 in skia).
fSampleCounts.push_back(1);
@@ -372,6 +381,7 @@ void GrMtlCaps::initGrCaps(id<MTLDevice> device) {
fTransferFromBufferToTextureSupport = true;
fTransferFromSurfaceToBufferSupport = true;
+ fTransferFromBufferToBufferSupport = true;
fTextureBarrierSupport = false; // Need to figure out if we can do this
@@ -599,7 +609,7 @@ void GrMtlCaps::setColorType(GrColorType colorType, std::initializer_list<MTLPix
}
size_t GrMtlCaps::GetFormatIndex(MTLPixelFormat pixelFormat) {
- static_assert(SK_ARRAY_COUNT(kMtlFormats) == GrMtlCaps::kNumMtlFormats,
+ static_assert(std::size(kMtlFormats) == GrMtlCaps::kNumMtlFormats,
"Size of kMtlFormats array must match static value in header");
for (size_t i = 0; i < GrMtlCaps::kNumMtlFormats; ++i) {
if (kMtlFormats[i] == pixelFormat) {
@@ -1241,13 +1251,13 @@ void GrMtlCaps::onDumpJSON(SkJSONWriter* writer) const {
switch (fGPUFamily) {
case GPUFamily::kMac:
- writer->appendString("GPU Family", "Mac");
+ writer->appendNString("GPU Family", "Mac");
break;
case GPUFamily::kApple:
- writer->appendString("GPU Family", "Apple");
+ writer->appendNString("GPU Family", "Apple");
break;
default:
- writer->appendString("GPU Family", "unknown");
+ writer->appendNString("GPU Family", "unknown");
break;
}
writer->appendS32("Family Group", fFamilyGroup);
diff --git a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlCommandBuffer.mm b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlCommandBuffer.mm
index 47c303d64e6..3df5be0c79d 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlCommandBuffer.mm
+++ b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlCommandBuffer.mm
@@ -26,7 +26,18 @@ sk_sp<GrMtlCommandBuffer> GrMtlCommandBuffer::Make(id<MTLCommandQueue> queue) {
NSLog(@"GrMtlCommandBuffer: WARNING: Creating MTLCommandBuffer while in background.");
}
#endif
- id<MTLCommandBuffer> mtlCommandBuffer = [queue commandBuffer];
+ id<MTLCommandBuffer> mtlCommandBuffer;
+#if GR_METAL_SDK_VERSION >= 230
+ if (@available(macOS 11.0, iOS 14.0, *)) {
+ MTLCommandBufferDescriptor* desc = [[MTLCommandBufferDescriptor alloc] init];
+ desc.errorOptions = MTLCommandBufferErrorOptionEncoderExecutionStatus;
+ mtlCommandBuffer = [queue commandBufferWithDescriptor:desc];
+ } else {
+ mtlCommandBuffer = [queue commandBuffer];
+ }
+#else
+ mtlCommandBuffer = [queue commandBuffer];
+#endif
if (nil == mtlCommandBuffer) {
return nullptr;
}
@@ -187,7 +198,7 @@ GrMtlRenderCommandEncoder* GrMtlCommandBuffer::getRenderCommandEncoder(
bool GrMtlCommandBuffer::commit(bool waitUntilCompleted) {
this->endAllEncoding();
- if (fCmdBuffer.status != MTLCommandBufferStatusNotEnqueued) {
+ if ([fCmdBuffer status] != MTLCommandBufferStatusNotEnqueued) {
NSLog(@"GrMtlCommandBuffer: Tried to commit command buffer while in invalid state.\n");
return false;
}
@@ -202,17 +213,14 @@ bool GrMtlCommandBuffer::commit(bool waitUntilCompleted) {
this->waitUntilCompleted();
}
- if (fCmdBuffer.status == MTLCommandBufferStatusError) {
-#ifdef SK_DEBUG
- NSString* description = [[fCmdBuffer error] localizedDescription];
- const char* errorString = [description UTF8String];
- SkDebugf("Error submitting command buffer: %s\n", errorString);
-#else
- SkDebugf("Error submitting command buffer\n");
-#endif
+ if ([fCmdBuffer status] == MTLCommandBufferStatusError) {
+ SkDebugf("Error submitting command buffer.\n");
+ if (NSError* error = [fCmdBuffer error]) {
+ NSLog(@"%@", error);
+ }
}
- return (fCmdBuffer.status != MTLCommandBufferStatusError);
+ return ([fCmdBuffer status] != MTLCommandBufferStatusError);
}
void GrMtlCommandBuffer::endAllEncoding() {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlGpu.h b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlGpu.h
index f23445774e2..50aedb995a5 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlGpu.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlGpu.h
@@ -196,6 +196,12 @@ private:
void*,
size_t rowBytes) override;
+ bool onTransferFromBufferToBuffer(sk_sp<GrGpuBuffer> src,
+ size_t srcOffset,
+ sk_sp<GrGpuBuffer> dst,
+ size_t dstOffset,
+ size_t size) override;
+
bool onWritePixels(GrSurface*,
SkIRect,
GrColorType surfaceColorType,
diff --git a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlGpu.mm b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlGpu.mm
index 3a9f62e4705..58ffbb7c19d 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlGpu.mm
+++ b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlGpu.mm
@@ -1389,6 +1389,40 @@ bool GrMtlGpu::onReadPixels(GrSurface* surface,
return true;
}
+bool GrMtlGpu::onTransferFromBufferToBuffer(sk_sp<GrGpuBuffer> src,
+ size_t srcOffset,
+ sk_sp<GrGpuBuffer> dst,
+ size_t dstOffset,
+ size_t size) {
+ id<MTLBuffer> GR_NORETAIN mtlSrc = static_cast<GrMtlBuffer*>(src.get())->mtlBuffer();
+ id<MTLBuffer> GR_NORETAIN mtlDst = static_cast<GrMtlBuffer*>(dst.get())->mtlBuffer();
+ SkASSERT(mtlSrc);
+ SkASSERT(mtlDst);
+
+ auto cmdBuffer = this->commandBuffer();
+ id<MTLBlitCommandEncoder> GR_NORETAIN blitCmdEncoder = cmdBuffer->getBlitCommandEncoder();
+ if (!blitCmdEncoder) {
+ return false;
+ }
+
+#ifdef SK_ENABLE_MTL_DEBUG_INFO
+ [blitCmdEncoder pushDebugGroup:@"onTransferFromBufferToBuffer"];
+#endif
+ [blitCmdEncoder copyFromBuffer: mtlSrc
+ sourceOffset: srcOffset
+ toBuffer: mtlDst
+ destinationOffset: dstOffset
+ size: size];
+#ifdef SK_ENABLE_MTL_DEBUG_INFO
+ [blitCmdEncoder popDebugGroup];
+#endif
+
+ cmdBuffer->addGrBuffer(std::move(src));
+ cmdBuffer->addGrBuffer(std::move(dst));
+
+ return true;
+}
+
bool GrMtlGpu::onTransferPixelsTo(GrTexture* texture,
SkIRect rect,
GrColorType textureColorType,
@@ -1751,7 +1785,7 @@ void GrMtlGpu::onDumpJSON(SkJSONWriter* writer) const {
writer->beginObject("Metal GPU");
writer->beginObject("Device");
- writer->appendString("name", fDevice.name.UTF8String);
+ writer->appendCString("name", fDevice.name.UTF8String);
#ifdef SK_BUILD_FOR_MAC
if (@available(macOS 10.11, *)) {
writer->appendBool("isHeadless", fDevice.isHeadless);
@@ -1768,19 +1802,19 @@ void GrMtlGpu::onDumpJSON(SkJSONWriter* writer) const {
if (@available(macOS 10.15, *)) {
switch (fDevice.location) {
case MTLDeviceLocationBuiltIn:
- writer->appendString("location", "builtIn");
+ writer->appendNString("location", "builtIn");
break;
case MTLDeviceLocationSlot:
- writer->appendString("location", "slot");
+ writer->appendNString("location", "slot");
break;
case MTLDeviceLocationExternal:
- writer->appendString("location", "external");
+ writer->appendNString("location", "external");
break;
case MTLDeviceLocationUnspecified:
- writer->appendString("location", "unspecified");
+ writer->appendNString("location", "unspecified");
break;
default:
- writer->appendString("location", "unknown");
+ writer->appendNString("location", "unknown");
break;
}
writer->appendU64("locationNumber", fDevice.locationNumber);
@@ -1844,27 +1878,27 @@ void GrMtlGpu::onDumpJSON(SkJSONWriter* writer) const {
if (@available(macOS 10.13, iOS 11.0, *)) {
switch (fDevice.readWriteTextureSupport) {
case MTLReadWriteTextureTier1:
- writer->appendString("readWriteTextureSupport", "tier1");
+ writer->appendNString("readWriteTextureSupport", "tier1");
break;
case MTLReadWriteTextureTier2:
- writer->appendString("readWriteTextureSupport", "tier2");
+ writer->appendNString("readWriteTextureSupport", "tier2");
break;
case MTLReadWriteTextureTierNone:
- writer->appendString("readWriteTextureSupport", "tierNone");
+ writer->appendNString("readWriteTextureSupport", "tierNone");
break;
default:
- writer->appendString("readWriteTextureSupport", "unknown");
+ writer->appendNString("readWriteTextureSupport", "unknown");
break;
}
switch (fDevice.argumentBuffersSupport) {
case MTLArgumentBuffersTier1:
- writer->appendString("argumentBuffersSupport", "tier1");
+ writer->appendNString("argumentBuffersSupport", "tier1");
break;
case MTLArgumentBuffersTier2:
- writer->appendString("argumentBuffersSupport", "tier2");
+ writer->appendNString("argumentBuffersSupport", "tier2");
break;
default:
- writer->appendString("argumentBuffersSupport", "unknown");
+ writer->appendNString("argumentBuffersSupport", "unknown");
break;
}
}
@@ -1878,7 +1912,7 @@ void GrMtlGpu::onDumpJSON(SkJSONWriter* writer) const {
#endif
writer->endObject();
- writer->appendString("queue", fQueue.label.UTF8String);
+ writer->appendCString("queue", fQueue.label.UTF8String);
writer->appendBool("disconnected", fDisconnected);
writer->endObject();
diff --git a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlPipelineStateBuilder.h b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlPipelineStateBuilder.h
index 7259925aeed..eb7e1f174e0 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlPipelineStateBuilder.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlPipelineStateBuilder.h
@@ -13,7 +13,7 @@
#include "src/gpu/ganesh/glsl/GrGLSLProgramBuilder.h"
#include "src/gpu/ganesh/mtl/GrMtlUniformHandler.h"
#include "src/gpu/ganesh/mtl/GrMtlVaryingHandler.h"
-#include "src/sksl/SkSLCompiler.h"
+#include "src/sksl/ir/SkSLProgram.h"
#import <Metal/Metal.h>
@@ -24,6 +24,8 @@ class GrMtlGpu;
class GrMtlPipelineState;
class SkReadBuffer;
+namespace SkSL { class Compiler; }
+
struct GrMtlPrecompiledLibraries {
// TODO: wrap these in sk_cfp<> or unique_ptr<> when we remove ARC
id<MTLLibrary> fVertexLibrary;
@@ -66,7 +68,7 @@ private:
SkSL::Program::Inputs inputs,
GrContextOptions::ShaderErrorHandler* errorHandler);
void storeShadersInCache(const std::string shaders[], const SkSL::Program::Inputs inputs[],
- SkSL::Program::Settings*, sk_sp<SkData>, bool isSkSL);
+ SkSL::ProgramSettings*, sk_sp<SkData>, bool isSkSL);
GrGLSLUniformHandler* uniformHandler() override { return &fUniformHandler; }
const GrGLSLUniformHandler* uniformHandler() const override { return &fUniformHandler; }
diff --git a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlPipelineStateBuilder.mm b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlPipelineStateBuilder.mm
index ae8ab0c38b7..fed3f513267 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlPipelineStateBuilder.mm
+++ b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlPipelineStateBuilder.mm
@@ -71,7 +71,7 @@ static constexpr SkFourByteTag kSKSL_Tag = SkSetFourByteTag('S', 'K', 'S', 'L');
void GrMtlPipelineStateBuilder::storeShadersInCache(const std::string shaders[],
const SkSL::Program::Inputs inputs[],
- SkSL::Program::Settings* settings,
+ SkSL::ProgramSettings* settings,
sk_sp<SkData> pipelineData,
bool isSkSL) {
sk_sp<SkData> key = SkData::MakeWithoutCopy(this->desc().asKey(),
@@ -322,7 +322,7 @@ static MTLBlendOperation blend_equation_to_mtl_blend_op(skgpu::BlendEquation equ
MTLBlendOperationSubtract, // skgpu::BlendEquation::kSubtract
MTLBlendOperationReverseSubtract, // skgpu::BlendEquation::kReverseSubtract
};
- static_assert(SK_ARRAY_COUNT(gTable) == (int)skgpu::BlendEquation::kFirstAdvanced);
+ static_assert(std::size(gTable) == (int)skgpu::BlendEquation::kFirstAdvanced);
static_assert(0 == (int)skgpu::BlendEquation::kAdd);
static_assert(1 == (int)skgpu::BlendEquation::kSubtract);
static_assert(2 == (int)skgpu::BlendEquation::kReverseSubtract);
@@ -542,7 +542,7 @@ GrMtlPipelineState* GrMtlPipelineStateBuilder::finalize(
this->finalizeShaders();
- SkSL::Program::Settings settings;
+ SkSL::ProgramSettings settings;
settings.fSharpenTextures = true;
SkASSERT(!this->fragColorIsInOut());
@@ -738,7 +738,7 @@ bool GrMtlPipelineStateBuilder::PrecompileShaders(GrMtlGpu* gpu, const SkData& c
auto errorHandler = gpu->getContext()->priv().getShaderErrorHandler();
- SkSL::Program::Settings settings;
+ SkSL::ProgramSettings settings;
settings.fSharpenTextures = true;
GrPersistentCacheUtils::ShaderMetadata meta;
meta.fSettings = &settings;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlRenderTarget.h b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlRenderTarget.h
index fe602946de2..0d6b277cf03 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlRenderTarget.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlRenderTarget.h
@@ -72,6 +72,8 @@ protected:
// This returns zero since the memory should all be handled by the attachments
size_t onGpuMemorySize() const override { return 0; }
+ void onSetLabel() override;
+
sk_sp<GrMtlAttachment> fColorAttachment;
sk_sp<GrMtlAttachment> fResolveAttachment;
@@ -87,8 +89,6 @@ private:
bool completeStencilAttachment(GrAttachment* stencil, bool useMSAASurface) override;
- void onSetLabel() override{}
-
// We can have a renderpass with and without resolve attachment or stencil attachment,
// both of these being completely orthogonal. Thus we have a total of 4 types of render passes.
// We then cache a framebuffer for each type of these render passes.
diff --git a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlRenderTarget.mm b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlRenderTarget.mm
index 592a3866f59..f3de9314559 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlRenderTarget.mm
+++ b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlRenderTarget.mm
@@ -58,7 +58,8 @@ sk_sp<GrMtlRenderTarget> GrMtlRenderTarget::MakeWrappedRenderTarget(GrMtlGpu* gp
sk_sp<GrMtlAttachment> textureAttachment =
GrMtlAttachment::MakeWrapped(gpu, dimensions, texture,
GrAttachment::UsageFlags::kColorAttachment,
- GrWrapCacheable::kNo);
+ GrWrapCacheable::kNo,
+ /*label=*/"MtlAttachment_TextureAttachment");
GrMtlRenderTarget* mtlRT;
if (sampleCnt > 1) {
@@ -78,16 +79,18 @@ sk_sp<GrMtlRenderTarget> GrMtlRenderTarget::MakeWrappedRenderTarget(GrMtlGpu* gp
sk_sp<GrMtlAttachment>(static_cast<GrMtlAttachment*>(msaaAttachment.release()));
mtlRT = new GrMtlRenderTarget(
gpu, dimensions, std::move(colorAttachment), std::move(textureAttachment),
- kWrapped, /*label=*/{});
+ kWrapped, /*label=*/"MakeWrappedRenderTargetWithOneTextureSampleCount");
mtlRT->setRequiresManualMSAAResolve();
} else {
SkASSERT(sampleCnt == static_cast<int>([texture sampleCount]));
mtlRT = new GrMtlRenderTarget(gpu, dimensions, std::move(textureAttachment), nil,
- kWrapped, /*label=*/{});
+ kWrapped,
+ /*label=*/"MakeWrappedRenderTargetWithManySampleCount");
}
} else {
mtlRT = new GrMtlRenderTarget(gpu, dimensions, std::move(textureAttachment), nil,
- kWrapped, /*label=*/{});
+ kWrapped,
+ /*label=*/"MakeWrappedRenderTargetWithOneOrLessSampleCount");
}
return sk_sp<GrMtlRenderTarget>(mtlRT);
@@ -163,4 +166,19 @@ bool GrMtlRenderTarget::completeStencilAttachment(GrAttachment* stencil, bool us
return true;
}
+void GrMtlRenderTarget::onSetLabel() {
+ SkASSERT(fColorAttachment);
+ if (!this->getLabel().empty()) {
+ NSString* labelStr = @(this->getLabel().c_str());
+ if (fResolveAttachment) {
+ fColorAttachment->mtlTexture().label =
+ [@"_Skia_MSAA_" stringByAppendingString:labelStr];
+ fResolveAttachment->mtlTexture().label =
+ [@"_Skia_Resolve_" stringByAppendingString:labelStr];
+ } else {
+ fColorAttachment->mtlTexture().label = [@"_Skia_" stringByAppendingString:labelStr];
+ }
+ }
+}
+
GR_NORETAIN_END
diff --git a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlTexture.h b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlTexture.h
index dcf13740cad..344205f05bb 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlTexture.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlTexture.h
@@ -65,6 +65,8 @@ protected:
return false;
}
+ void onSetLabel() override;
+
private:
enum Wrapped { kWrapped };
@@ -84,8 +86,6 @@ private:
GrIOType,
std::string_view label);
- void onSetLabel() override{}
-
sk_sp<GrMtlAttachment> fTexture;
using INHERITED = GrTexture;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlTexture.mm b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlTexture.mm
index 6bf7740f488..baa343b1630 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlTexture.mm
+++ b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlTexture.mm
@@ -105,7 +105,8 @@ sk_sp<GrMtlTexture> GrMtlTexture::MakeWrappedTexture(GrMtlGpu* gpu,
}
sk_sp<GrMtlAttachment> attachment =
GrMtlAttachment::MakeWrapped(gpu, dimensions, texture,
- GrAttachment::UsageFlags::kTexture, cacheable);
+ GrAttachment::UsageFlags::kTexture, cacheable,
+ /*label=*/"MtlAttachment_MakeWrapped");
if (!attachment) {
return nullptr;
}
@@ -138,4 +139,12 @@ GrBackendFormat GrMtlTexture::backendFormat() const {
return GrBackendFormat::MakeMtl(fTexture->mtlFormat());
}
+void GrMtlTexture::onSetLabel() {
+ SkASSERT(fTexture);
+ if (!this->getLabel().empty()) {
+ NSString* labelStr = @(this->getLabel().c_str());
+ fTexture->mtlTexture().label = [@"_Skia_" stringByAppendingString:labelStr];
+ }
+}
+
GR_NORETAIN_END
diff --git a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlTextureRenderTarget.h b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlTextureRenderTarget.h
index 1c3b609fb1e..eadaa410462 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlTextureRenderTarget.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlTextureRenderTarget.h
@@ -63,7 +63,7 @@ private:
size_t onGpuMemorySize() const override;
- void onSetLabel() override{}
+ void onSetLabel() override;
};
#endif
diff --git a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlTextureRenderTarget.mm b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlTextureRenderTarget.mm
index c8ea53d0597..020ee667829 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlTextureRenderTarget.mm
+++ b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlTextureRenderTarget.mm
@@ -117,7 +117,8 @@ sk_sp<GrMtlTextureRenderTarget> GrMtlTextureRenderTarget::MakeWrappedTextureRend
GrAttachment::UsageFlags textureUsageFlags = GrAttachment::UsageFlags::kTexture |
GrAttachment::UsageFlags::kColorAttachment;
sk_sp<GrMtlAttachment> textureAttachment =
- GrMtlAttachment::MakeWrapped(gpu, dimensions, texture, textureUsageFlags, cacheable);
+ GrMtlAttachment::MakeWrapped(gpu, dimensions, texture, textureUsageFlags, cacheable,
+ /*label=*/"MtlAttachment_TextureAttachment");
if (!textureAttachment) {
return nullptr;
}
@@ -161,4 +162,9 @@ size_t GrMtlTextureRenderTarget::onGpuMemorySize() const {
1 /*colorSamplesPerPixel*/, this->mipmapped());
}
+void GrMtlTextureRenderTarget::onSetLabel() {
+ GrMtlRenderTarget::onSetLabel();
+ GrMtlTexture::onSetLabel();
+}
+
GR_NORETAIN_END
diff --git a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlUtil.h b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlUtil.h
index 41774b3cfa5..b555f5e9cdc 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlUtil.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlUtil.h
@@ -72,7 +72,7 @@ MTLTextureDescriptor* GrGetMTLTextureDescriptor(id<MTLTexture> mtlTexture);
bool GrSkSLToMSL(const GrMtlGpu* gpu,
const std::string& sksl,
SkSL::ProgramKind kind,
- const SkSL::Program::Settings& settings,
+ const SkSL::ProgramSettings& settings,
std::string* msl,
SkSL::Program::Inputs* outInputs,
GrContextOptions::ShaderErrorHandler* errorHandler);
diff --git a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlUtil.mm b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlUtil.mm
index ce40a777815..b0c8f00445b 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlUtil.mm
+++ b/chromium/third_party/skia/src/gpu/ganesh/mtl/GrMtlUtil.mm
@@ -60,7 +60,7 @@ static const bool gPrintMSL = false;
bool GrSkSLToMSL(const GrMtlGpu* gpu,
const std::string& sksl,
SkSL::ProgramKind programKind,
- const SkSL::Program::Settings& settings,
+ const SkSL::ProgramSettings& settings,
std::string* msl,
SkSL::Program::Inputs* outInputs,
GrContextOptions::ShaderErrorHandler* errorHandler) {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/AAConvexPathRenderer.cpp b/chromium/third_party/skia/src/gpu/ganesh/ops/AAConvexPathRenderer.cpp
index 935c0751204..9b7f608f854 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/AAConvexPathRenderer.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/AAConvexPathRenderer.cpp
@@ -21,6 +21,7 @@
#include "src/gpu/ganesh/GrGeometryProcessor.h"
#include "src/gpu/ganesh/GrProcessor.h"
#include "src/gpu/ganesh/GrProgramInfo.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/geometry/GrPathUtils.h"
#include "src/gpu/ganesh/geometry/GrStyledShape.h"
#include "src/gpu/ganesh/glsl/GrGLSLFragmentShaderBuilder.h"
@@ -30,7 +31,6 @@
#include "src/gpu/ganesh/glsl/GrGLSLVertexGeoBuilder.h"
#include "src/gpu/ganesh/ops/GrMeshDrawOp.h"
#include "src/gpu/ganesh/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
namespace skgpu::v1 {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/AAConvexPathRenderer.h b/chromium/third_party/skia/src/gpu/ganesh/ops/AAConvexPathRenderer.h
index 0d1a33b4353..42642d388e2 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/AAConvexPathRenderer.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/AAConvexPathRenderer.h
@@ -8,7 +8,7 @@
#ifndef AAConvexPathRenderer_DEFINED
#define AAConvexPathRenderer_DEFINED
-#include "src/gpu/ganesh/v1/PathRenderer.h"
+#include "src/gpu/ganesh/PathRenderer.h"
namespace skgpu::v1 {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/AAHairLinePathRenderer.cpp b/chromium/third_party/skia/src/gpu/ganesh/ops/AAHairLinePathRenderer.cpp
index 181b7ab0900..af8d1081c6b 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/AAHairLinePathRenderer.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/AAHairLinePathRenderer.cpp
@@ -25,12 +25,12 @@
#include "src/gpu/ganesh/GrResourceProvider.h"
#include "src/gpu/ganesh/GrStyle.h"
#include "src/gpu/ganesh/GrUtil.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/effects/GrBezierEffect.h"
#include "src/gpu/ganesh/geometry/GrPathUtils.h"
#include "src/gpu/ganesh/geometry/GrStyledShape.h"
#include "src/gpu/ganesh/ops/GrMeshDrawOp.h"
#include "src/gpu/ganesh/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
#define PREALLOC_PTARRAY(N) SkSTArray<(N),SkPoint, true>
@@ -72,7 +72,7 @@ static const uint16_t kQuadIdxBufPattern[] = {
1, 4, 2
};
-static const int kIdxsPerQuad = SK_ARRAY_COUNT(kQuadIdxBufPattern);
+static const int kIdxsPerQuad = std::size(kQuadIdxBufPattern);
static const int kQuadNumVertices = 5;
static const int kQuadsNumInIdxBuffer = 256;
SKGPU_DECLARE_STATIC_UNIQUE_KEY(gQuadsIndexBufferKey);
@@ -105,7 +105,7 @@ static const uint16_t kLineSegIdxBufPattern[] = {
1, 5, 3
};
-static const int kIdxsPerLineSeg = SK_ARRAY_COUNT(kLineSegIdxBufPattern);
+static const int kIdxsPerLineSeg = std::size(kLineSegIdxBufPattern);
static const int kLineSegNumVertices = 6;
static const int kLineSegsNumInIdxBuffer = 256;
@@ -1347,4 +1347,3 @@ bool AAHairLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
}
} // namespace skgpu::v1
-
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/AAHairLinePathRenderer.h b/chromium/third_party/skia/src/gpu/ganesh/ops/AAHairLinePathRenderer.h
index 701903509a7..1b4afc08a1d 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/AAHairLinePathRenderer.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/AAHairLinePathRenderer.h
@@ -8,7 +8,7 @@
#ifndef AAHairLinePathRenderer_DEFINED
#define AAHairLinePathRenderer_DEFINED
-#include "src/gpu/ganesh/v1/PathRenderer.h"
+#include "src/gpu/ganesh/PathRenderer.h"
namespace skgpu::v1 {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/AALinearizingConvexPathRenderer.cpp b/chromium/third_party/skia/src/gpu/ganesh/ops/AALinearizingConvexPathRenderer.cpp
index ad55a3952c5..2644a5b805b 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/AALinearizingConvexPathRenderer.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/AALinearizingConvexPathRenderer.cpp
@@ -21,12 +21,12 @@
#include "src/gpu/ganesh/GrProcessor.h"
#include "src/gpu/ganesh/GrProgramInfo.h"
#include "src/gpu/ganesh/GrStyle.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/geometry/GrAAConvexTessellator.h"
#include "src/gpu/ganesh/geometry/GrPathUtils.h"
#include "src/gpu/ganesh/geometry/GrStyledShape.h"
#include "src/gpu/ganesh/ops/GrMeshDrawOp.h"
#include "src/gpu/ganesh/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
///////////////////////////////////////////////////////////////////////////////
namespace skgpu::v1 {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/AALinearizingConvexPathRenderer.h b/chromium/third_party/skia/src/gpu/ganesh/ops/AALinearizingConvexPathRenderer.h
index fc2e877ebfc..127f8e062b4 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/AALinearizingConvexPathRenderer.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/AALinearizingConvexPathRenderer.h
@@ -8,7 +8,7 @@
#ifndef AALinearizingConvexPathRenderer_DEFINED
#define AALinearizingConvexPathRenderer_DEFINED
-#include "src/gpu/ganesh/v1/PathRenderer.h"
+#include "src/gpu/ganesh/PathRenderer.h"
namespace skgpu::v1 {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/AtlasPathRenderer.cpp b/chromium/third_party/skia/src/gpu/ganesh/ops/AtlasPathRenderer.cpp
index 8728b3e9268..88e9c1b42a1 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/AtlasPathRenderer.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/AtlasPathRenderer.cpp
@@ -11,13 +11,13 @@
#include "src/core/SkIPoint16.h"
#include "src/gpu/ganesh/GrClip.h"
#include "src/gpu/ganesh/GrDirectContextPriv.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/effects/GrModulateAtlasCoverageEffect.h"
#include "src/gpu/ganesh/geometry/GrStyledShape.h"
#include "src/gpu/ganesh/ops/AtlasRenderTask.h"
#include "src/gpu/ganesh/ops/DrawAtlasPathOp.h"
#include "src/gpu/ganesh/ops/TessellationPathRenderer.h"
#include "src/gpu/ganesh/tessellate/GrTessellationShader.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
namespace {
@@ -107,6 +107,13 @@ bool AtlasPathRenderer::IsSupported(GrRecordingContext* rContext) {
return false;
}
#endif
+#ifdef SK_BUILD_FOR_WIN
+ // http://skbug.com/13519 There is a bug with the atlas path renderer on Direct3D, running on
+ // Radeon hardware and possibly others. Disable until we can investigate.
+ if (rContext->backend() == GrBackendApi::kDirect3D) {
+ return false;
+ }
+#endif
const GrCaps& caps = *rContext->priv().caps();
auto atlasFormat = caps.getDefaultBackendFormat(kAtlasAlpha8Type, GrRenderable::kYes);
return rContext->asDirectContext() && // The atlas doesn't support DDL yet.
@@ -329,8 +336,10 @@ GrFPResult AtlasPathRenderer::makeAtlasClipEffect(const SurfaceDrawContext* sdc,
const SkRect pathDevBounds = viewMatrix.mapRect(path.getBounds());
if (!is_visible(pathDevBounds, drawBounds)) {
- // The path is empty or outside the drawBounds. No mask is needed.
- return path.isInverseFillType() ? GrFPSuccess(std::move(inputFP))
+ // The path is empty or outside the drawBounds. No mask is needed. We explicitly allow the
+ // returned successful "fp" to be null in case this bypassed atlas clip effect was the first
+ // clip to be processed by the clip stack (at which point inputFP is null).
+ return path.isInverseFillType() ? GrFPNullableSuccess(std::move(inputFP))
: GrFPFailure(std::move(inputFP));
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/AtlasPathRenderer.h b/chromium/third_party/skia/src/gpu/ganesh/ops/AtlasPathRenderer.h
index 49e4f8648c2..f9e164a8c94 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/AtlasPathRenderer.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/AtlasPathRenderer.h
@@ -14,7 +14,7 @@
#include "src/gpu/ganesh/GrDynamicAtlas.h"
#include "src/gpu/ganesh/GrFragmentProcessor.h"
#include "src/gpu/ganesh/GrOnFlushResourceProvider.h"
-#include "src/gpu/ganesh/v1/PathRenderer.h"
+#include "src/gpu/ganesh/PathRenderer.h"
class GrOp;
class GrRecordingContext;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/AtlasTextOp.cpp b/chromium/third_party/skia/src/gpu/ganesh/ops/AtlasTextOp.cpp
index 6991cc0277c..cc30172a2c0 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/AtlasTextOp.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/AtlasTextOp.cpp
@@ -10,7 +10,6 @@
#include "include/core/SkPoint3.h"
#include "include/core/SkSpan.h"
#include "include/gpu/GrRecordingContext.h"
-#include "src/core/SkGlyphRun.h"
#include "src/core/SkMathPriv.h"
#include "src/core/SkMatrixPriv.h"
#include "src/core/SkMatrixProvider.h"
@@ -21,11 +20,12 @@
#include "src/gpu/ganesh/GrRecordingContextPriv.h"
#include "src/gpu/ganesh/GrResourceProvider.h"
#include "src/gpu/ganesh/SkGr.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/effects/GrBitmapTextGeoProc.h"
#include "src/gpu/ganesh/effects/GrDistanceFieldGeoProc.h"
#include "src/gpu/ganesh/ops/GrSimpleMeshDrawOpHelper.h"
#include "src/gpu/ganesh/text/GrAtlasManager.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
+#include "src/text/GlyphRun.h"
#include "src/text/gpu/DistanceFieldAdjustTable.h"
#include <new>
@@ -498,7 +498,7 @@ GrOp::Owner AtlasTextOp::CreateOpTestingOnly(SurfaceDrawContext* sdc,
SkMatrix drawMatrix(mtxProvider.localToDevice());
drawMatrix.preTranslate(x, y);
auto drawOrigin = SkPoint::Make(x, y);
- SkGlyphRunBuilder builder;
+ sktext::GlyphRunBuilder builder;
auto glyphRunList = builder.textToGlyphRunList(font, skPaint, text, textLen, drawOrigin);
if (glyphRunList.empty()) {
return nullptr;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/AtlasTextOp.h b/chromium/third_party/skia/src/gpu/ganesh/ops/AtlasTextOp.h
index 40aa4ec5468..40bdf17cdfb 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/AtlasTextOp.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/AtlasTextOp.h
@@ -228,14 +228,14 @@ private:
int fNumGlyphs; // Sum of glyphs in each geometry's subrun
// All combinable atlas ops have equal bit field values
- uint32_t fDFGPFlags : 9; // Distance field properties
- uint32_t fMaskType : 3; // MaskType
- uint32_t fUsesLocalCoords : 1; // Filled in post processor analysis
+ uint32_t fDFGPFlags : 10; // Distance field properties
+ uint32_t fMaskType : 3; // MaskType
+ uint32_t fUsesLocalCoords : 1; // Filled in post processor analysis
uint32_t fNeedsGlyphTransform : 1;
- uint32_t fHasPerspective : 1; // True if perspective affects draw
+ uint32_t fHasPerspective : 1; // True if perspective affects draw
uint32_t fUseGammaCorrectDistanceTable : 1;
static_assert(kMaskTypeCount <= 8, "MaskType does not fit in 3 bits");
- static_assert(kInvalid_DistanceFieldEffectFlag <= (1 << 8), "DFGP Flags do not fit in 9 bits");
+ static_assert(kInvalid_DistanceFieldEffectFlag <= (1 << 9), "DFGP Flags do not fit in 10 bits");
// Only used for distance fields; per-channel luminance for LCD, or gamma-corrected luminance
// for single-channel distance fields.
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/DashLinePathRenderer.cpp b/chromium/third_party/skia/src/gpu/ganesh/ops/DashLinePathRenderer.cpp
index c4601862a5a..29d1649135e 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/DashLinePathRenderer.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/DashLinePathRenderer.cpp
@@ -9,10 +9,10 @@
#include "src/gpu/ganesh/GrAuditTrail.h"
#include "src/gpu/ganesh/GrGpu.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/geometry/GrStyledShape.h"
#include "src/gpu/ganesh/ops/DashOp.h"
#include "src/gpu/ganesh/ops/GrMeshDrawOp.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
namespace skgpu::v1 {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/DashLinePathRenderer.h b/chromium/third_party/skia/src/gpu/ganesh/ops/DashLinePathRenderer.h
index 67dc342d569..4f45ed9ecb1 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/DashLinePathRenderer.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/DashLinePathRenderer.h
@@ -8,7 +8,7 @@
#ifndef DashLinePathRenderer_DEFINED
#define DashLinePathRenderer_DEFINED
-#include "src/gpu/ganesh/v1/PathRenderer.h"
+#include "src/gpu/ganesh/PathRenderer.h"
class GrGpu;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/DefaultPathRenderer.cpp b/chromium/third_party/skia/src/gpu/ganesh/ops/DefaultPathRenderer.cpp
index 924cb9933f5..232051cacde 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/DefaultPathRenderer.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/DefaultPathRenderer.cpp
@@ -23,13 +23,13 @@
#include "src/gpu/ganesh/GrSimpleMesh.h"
#include "src/gpu/ganesh/GrStyle.h"
#include "src/gpu/ganesh/GrUtil.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/effects/GrDisableColorXP.h"
#include "src/gpu/ganesh/geometry/GrPathUtils.h"
#include "src/gpu/ganesh/geometry/GrStyledShape.h"
#include "src/gpu/ganesh/ops/GrMeshDrawOp.h"
#include "src/gpu/ganesh/ops/GrPathStencilSettings.h"
#include "src/gpu/ganesh/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
////////////////////////////////////////////////////////////////////////////////
// Helpers for drawPath
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/DefaultPathRenderer.h b/chromium/third_party/skia/src/gpu/ganesh/ops/DefaultPathRenderer.h
index 5294efb65bd..e4872063866 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/DefaultPathRenderer.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/DefaultPathRenderer.h
@@ -8,7 +8,7 @@
#ifndef DefaultPathRenderer_DEFINED
#define DefaultPathRenderer_DEFINED
-#include "src/gpu/ganesh/v1/PathRenderer.h"
+#include "src/gpu/ganesh/PathRenderer.h"
namespace skgpu::v1 {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/DrawAtlasPathOp.cpp b/chromium/third_party/skia/src/gpu/ganesh/ops/DrawAtlasPathOp.cpp
index 8bd95fa2b1c..07631c0f1e7 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/DrawAtlasPathOp.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/DrawAtlasPathOp.cpp
@@ -95,7 +95,7 @@ private:
if (shader.fUsesLocalCoords) {
args.fVertBuilder->codeAppendf(R"(
- float2x2 M = float2x2(affineMatrix);
+ float2x2 M = float2x2(affineMatrix.xy, affineMatrix.zw);
float2 localCoord = inverse(M) * (devCoord - translate);)");
gpArgs->fLocalCoordVar.set(SkSLType::kFloat2, "localCoord");
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/DrawMeshOp.cpp b/chromium/third_party/skia/src/gpu/ganesh/ops/DrawMeshOp.cpp
index 851829b27dc..00d87bee87b 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/DrawMeshOp.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/DrawMeshOp.cpp
@@ -85,7 +85,7 @@ private:
}
if (mgp.fUniforms) {
pdman.setRuntimeEffectUniforms(mgp.fSpec->uniforms(),
- SkMakeSpan(fSpecUniformHandles),
+ SkSpan(fSpecUniformHandles),
mgp.fUniforms->data());
}
}
@@ -125,7 +125,7 @@ private:
auto it = std::find_if(uniforms.begin(),
uniforms.end(),
[&name](SkMeshSpecification::Uniform uniform) {
- return uniform.name == name;
+ return uniform.name == std::string_view(name.c_str(), name.size());
});
SkASSERT(it != uniforms.end());
@@ -463,7 +463,7 @@ private:
class Mesh {
public:
Mesh() = delete;
- Mesh(const SkMesh& mesh);
+ explicit Mesh(const SkMesh& mesh);
Mesh(sk_sp<SkVertices>, const SkMatrix& viewMatrix);
Mesh(const Mesh&) = delete;
Mesh(Mesh&& m);
@@ -504,11 +504,11 @@ private:
if (!fMeshData.ib) {
return nullptr;
}
- auto data = fMeshData.ib->asData();
+ auto data = fMeshData.ib->peek();
if (!data) {
return nullptr;
}
- return SkTAddOffset<const uint16_t>(data->data(), fMeshData.ioffset);
+ return SkTAddOffset<const uint16_t>(data, fMeshData.ioffset);
}
int indexCount() const {
@@ -562,6 +562,21 @@ MeshOp::Mesh::Mesh(const SkMesh& mesh) {
fMeshData.voffset = mesh.vertexOffset();
fMeshData.icount = mesh.indexCount();
fMeshData.ioffset = mesh.indexOffset();
+
+ // The caller could modify CPU buffers after the draw so we must copy the data.
+ if (fMeshData.vb->peek()) {
+ auto data = SkTAddOffset<const void>(fMeshData.vb->peek(), fMeshData.voffset);
+ size_t size = fMeshData.vcount*mesh.spec()->stride();
+ fMeshData.vb = SkMeshPriv::CpuVertexBuffer::Make(data, size);
+ fMeshData.voffset = 0;
+ }
+
+ if (fMeshData.ib && fMeshData.ib->peek()) {
+ auto data = SkTAddOffset<const void>(fMeshData.ib->peek(), fMeshData.ioffset);
+ size_t size = fMeshData.icount*sizeof(uint16_t);
+ fMeshData.ib = SkMeshPriv::CpuIndexBuffer::Make(data, size);
+ fMeshData.ioffset = 0;
+ }
}
MeshOp::Mesh::Mesh(sk_sp<SkVertices> vertices, const SkMatrix& viewMatrix)
@@ -609,9 +624,9 @@ void MeshOp::Mesh::writeVertices(skgpu::VertexWriter& writer,
}
}
} else {
- sk_sp<const SkData> data = fMeshData.vb->asData();
+ const void* data = fMeshData.vb->peek();
if (data) {
- auto vdata = static_cast<const char*>(data->data()) + fMeshData.voffset;
+ auto vdata = SkTAddOffset<const char>(data, fMeshData.voffset);
writer << skgpu::VertexWriter::Array(vdata, spec.stride()*fMeshData.vcount);
}
}
@@ -682,9 +697,9 @@ static sk_sp<SkMeshSpecification> make_vertices_spec(bool hasColors, bool hasTex
vs += "return a.pos;\n}";
fs += "}";
auto [spec, error] = SkMeshSpecification::Make(
- SkMakeSpan(attributes),
+ SkSpan(attributes),
size,
- SkMakeSpan(varyings),
+ SkSpan(varyings),
vs,
fs);
SkASSERT(spec);
@@ -904,6 +919,9 @@ void MeshOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
GrOp::CombineResult MeshOp::onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) {
auto that = t->cast<MeshOp>();
+ if (!fMeshes[0].isFromVertices() || !that->fMeshes[0].isFromVertices()) {
+ return GrOp::CombineResult::kCannotCombine;
+ }
// Check for a combinable primitive type.
if (!(fPrimitiveType == GrPrimitiveType::kTriangles ||
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/FillRRectOp.cpp b/chromium/third_party/skia/src/gpu/ganesh/ops/FillRRectOp.cpp
index 110bfd963e9..cc4b4a82289 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/FillRRectOp.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/FillRRectOp.cpp
@@ -375,8 +375,7 @@ private:
Processor(GrAAType aaType, ProcessorFlags flags)
: GrGeometryProcessor(kGrFillRRectOp_Processor_ClassID)
, fFlags(flags) {
- this->setVertexAttributesWithImplicitOffsets(kVertexAttribs,
- SK_ARRAY_COUNT(kVertexAttribs));
+ this->setVertexAttributesWithImplicitOffsets(kVertexAttribs, std::size(kVertexAttribs));
fInstanceAttribs.emplace_back("radii_x", kFloat4_GrVertexAttribType, SkSLType::kFloat4);
fInstanceAttribs.emplace_back("radii_y", kFloat4_GrVertexAttribType, SkSLType::kFloat4);
@@ -834,8 +833,7 @@ void FillRRectOpImpl::onExecute(GrOpFlushState* flushState, const SkRect& chainB
flushState->bindTextures(fProgramInfo->geomProc(), nullptr, fProgramInfo->pipeline());
flushState->bindBuffers(std::move(fIndexBuffer), std::move(fInstanceBuffer),
std::move(fVertexBuffer));
- flushState->drawIndexedInstanced(SK_ARRAY_COUNT(kIndexData), 0, fInstanceCount, fBaseInstance,
- 0);
+ flushState->drawIndexedInstanced(std::size(kIndexData), 0, fInstanceCount, fBaseInstance, 0);
}
// Will the given corner look good if we use HW derivatives?
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/FillRectOp.cpp b/chromium/third_party/skia/src/gpu/ganesh/ops/FillRectOp.cpp
index e15c8103fab..e9e0e8e527b 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/FillRectOp.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/FillRectOp.cpp
@@ -15,6 +15,7 @@
#include "src/gpu/ganesh/GrPaint.h"
#include "src/gpu/ganesh/GrProgramInfo.h"
#include "src/gpu/ganesh/SkGr.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/geometry/GrQuad.h"
#include "src/gpu/ganesh/geometry/GrQuadBuffer.h"
#include "src/gpu/ganesh/geometry/GrQuadUtils.h"
@@ -23,7 +24,6 @@
#include "src/gpu/ganesh/ops/GrMeshDrawOp.h"
#include "src/gpu/ganesh/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
#include "src/gpu/ganesh/ops/QuadPerEdgeAA.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
namespace {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/GrOvalOpFactory.cpp b/chromium/third_party/skia/src/gpu/ganesh/ops/GrOvalOpFactory.cpp
index 97258d5a4eb..f87101d58db 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/GrOvalOpFactory.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/GrOvalOpFactory.cpp
@@ -423,7 +423,7 @@ private:
};
SkString fnName = fragBuilder->getMangledFunctionName("coverage_from_dash_edge");
fragBuilder->emitFunction(SkSLType::kFloat, fnName.c_str(),
- {fnArgs, SK_ARRAY_COUNT(fnArgs)}, R"(
+ {fnArgs, std::size(fnArgs)}, R"(
float linearDist;
angleToEdge = clamp(angleToEdge, -3.1415, 3.1415);
linearDist = diameter * sin(angleToEdge / 2);
@@ -956,8 +956,8 @@ static constexpr SkPoint kOctagonInner[] = {
SkPoint::Make(-kCosPi8, -kSinPi8),
};
-static const int kIndicesPerFillCircle = SK_ARRAY_COUNT(gFillCircleIndices);
-static const int kIndicesPerStrokeCircle = SK_ARRAY_COUNT(gStrokeCircleIndices);
+static const int kIndicesPerFillCircle = std::size(gFillCircleIndices);
+static const int kIndicesPerStrokeCircle = std::size(gStrokeCircleIndices);
static const int kVertsPerStrokeCircle = 16;
static const int kVertsPerFillCircle = 9;
@@ -2443,7 +2443,7 @@ static const uint16_t gOverstrokeRRectIndices[] = {
static const uint16_t* gStandardRRectIndices = gOverstrokeRRectIndices + 6 * 4;
// overstroke count is arraysize minus the center indices
-static const int kIndicesPerOverstrokeRRect = SK_ARRAY_COUNT(gOverstrokeRRectIndices) - 6;
+static const int kIndicesPerOverstrokeRRect = std::size(gOverstrokeRRectIndices) - 6;
// fill count skips overstroke indices and includes center
static const int kIndicesPerFillRRect = kIndicesPerOverstrokeRRect - 6 * 4 + 6;
// stroke count is fill count minus center indices
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/PathStencilCoverOp.cpp b/chromium/third_party/skia/src/gpu/ganesh/ops/PathStencilCoverOp.cpp
index a79e66d084d..93752d01d28 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/PathStencilCoverOp.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/PathStencilCoverOp.cpp
@@ -43,7 +43,7 @@ public:
{"pathBounds", kFloat4_GrVertexAttribType, SkSLType::kFloat4}
};
this->setInstanceAttributesWithImplicitOffsets(kInstanceAttribs,
- SK_ARRAY_COUNT(kInstanceAttribs));
+ std::size(kInstanceAttribs));
}
private:
@@ -78,12 +78,12 @@ std::unique_ptr<GrGeometryProcessor::ProgramImpl> BoundingBoxShader::makeProgram
}
args.fVertBuilder->codeAppend(R"(
// Bloat the bounding box by 1/4px to be certain we will reset every stencil value.
- float2x2 M_ = inverse(float2x2(matrix2d));
+ float2x2 M_ = inverse(float2x2(matrix2d.xy, matrix2d.zw));
float2 bloat = float2(abs(M_[0]) + abs(M_[1])) * .25;
// Find the vertex position.
float2 localcoord = mix(pathBounds.xy - bloat, pathBounds.zw + bloat, unitCoord);
- float2 vertexpos = float2x2(matrix2d) * localcoord + translate;)");
+ float2 vertexpos = float2x2(matrix2d.xy, matrix2d.zw) * localcoord + translate;)");
gpArgs->fLocalCoordVar.set(SkSLType::kFloat2, "localcoord");
gpArgs->fPositionVar.set(SkSLType::kFloat2, "vertexpos");
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/ShadowRRectOp.cpp b/chromium/third_party/skia/src/gpu/ganesh/ops/ShadowRRectOp.cpp
index 719eeb1774a..b911b935e08 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/ShadowRRectOp.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/ShadowRRectOp.cpp
@@ -53,8 +53,8 @@ static const uint16_t gStrokeCircleIndices[] = {
// clang-format on
};
-static const int kIndicesPerFillCircle = SK_ARRAY_COUNT(gFillCircleIndices);
-static const int kIndicesPerStrokeCircle = SK_ARRAY_COUNT(gStrokeCircleIndices);
+static const int kIndicesPerFillCircle = std::size(gFillCircleIndices);
+static const int kIndicesPerStrokeCircle = std::size(gStrokeCircleIndices);
static const int kVertsPerStrokeCircle = 16;
static const int kVertsPerFillCircle = 9;
@@ -137,7 +137,7 @@ static const uint16_t gRRectIndices[] = {
};
// overstroke count
-static const int kIndicesPerOverstrokeRRect = SK_ARRAY_COUNT(gRRectIndices) - 6;
+static const int kIndicesPerOverstrokeRRect = std::size(gRRectIndices) - 6;
// simple stroke count skips overstroke indices
static const int kIndicesPerStrokeRRect = kIndicesPerOverstrokeRRect - 6*4;
// fill count adds final quad to stroke count
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/SmallPathRenderer.cpp b/chromium/third_party/skia/src/gpu/ganesh/ops/SmallPathRenderer.cpp
index b54b6b2f630..330b8563101 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/SmallPathRenderer.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/SmallPathRenderer.cpp
@@ -22,6 +22,7 @@
#include "src/gpu/ganesh/GrDistanceFieldGenFromVector.h"
#include "src/gpu/ganesh/GrDrawOpTest.h"
#include "src/gpu/ganesh/GrResourceProvider.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/effects/GrBitmapTextGeoProc.h"
#include "src/gpu/ganesh/effects/GrDistanceFieldGeoProc.h"
#include "src/gpu/ganesh/geometry/GrQuad.h"
@@ -30,7 +31,6 @@
#include "src/gpu/ganesh/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
#include "src/gpu/ganesh/ops/SmallPathAtlasMgr.h"
#include "src/gpu/ganesh/ops/SmallPathShapeData.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
using MaskFormat = skgpu::MaskFormat;
@@ -168,37 +168,27 @@ private:
// Setup GrGeometryProcessor
const SkMatrix& ctm = fShapes[0].fViewMatrix;
+ SkMatrix invert;
+ if (fHelper.usesLocalCoords()) {
+ if (!ctm.invert(&invert)) {
+ return;
+ }
+ }
if (fUsesDistanceField) {
uint32_t flags = 0;
// Still need to key off of ctm to pick the right shader for the transformed quad
flags |= ctm.isScaleTranslate() ? kScaleOnly_DistanceFieldEffectFlag : 0;
flags |= ctm.isSimilarity() ? kSimilarity_DistanceFieldEffectFlag : 0;
flags |= fGammaCorrect ? kGammaCorrect_DistanceFieldEffectFlag : 0;
+ flags |= fWideColor ? kWideColor_DistanceFieldEffectFlag : 0;
+ // We always use Point3 for position
+ flags |= kPerspective_DistanceFieldEffectFlag;
- const SkMatrix* matrix;
- SkMatrix invert;
- if (ctm.hasPerspective()) {
- matrix = &ctm;
- } else if (fHelper.usesLocalCoords()) {
- if (!ctm.invert(&invert)) {
- return;
- }
- matrix = &invert;
- } else {
- matrix = &SkMatrix::I();
- }
flushInfo.fGeometryProcessor = GrDistanceFieldPathGeoProc::Make(
- target->allocator(), *target->caps().shaderCaps(), *matrix, fWideColor,
+ target->allocator(), *target->caps().shaderCaps(),
views, numActiveProxies, GrSamplerState::Filter::kLinear,
- flags);
+ invert, flags);
} else {
- SkMatrix invert;
- if (fHelper.usesLocalCoords()) {
- if (!ctm.invert(&invert)) {
- return;
- }
- }
-
flushInfo.fGeometryProcessor = GrBitmapTextGeoProc::Make(
target->allocator(), *target->caps().shaderCaps(), this->color(), fWideColor,
views, numActiveProxies, GrSamplerState::Filter::kNearest,
@@ -527,10 +517,16 @@ private:
// set up texture coordinates
auto texCoords = VertexWriter::TriStripFromUVs(shapeData->fAtlasLocator.getUVs());
- if (fUsesDistanceField && !ctm.hasPerspective()) {
- vertices.writeQuad(GrQuad::MakeFromRect(translatedBounds, ctm),
- color,
- texCoords);
+ if (fUsesDistanceField) {
+ SkPoint pts[4];
+ SkPoint3 out[4];
+ translatedBounds.toQuad(pts);
+ ctm.mapHomogeneousPoints(out, pts, 4);
+
+ vertices << out[0] << color << texCoords.l << texCoords.t;
+ vertices << out[3] << color << texCoords.l << texCoords.b;
+ vertices << out[1] << color << texCoords.r << texCoords.t;
+ vertices << out[2] << color << texCoords.r << texCoords.b;
} else {
vertices.writeQuad(VertexWriter::TriStripFromRect(translatedBounds),
color,
@@ -606,23 +602,28 @@ private:
const SkMatrix& thisCtm = this->fShapes[0].fViewMatrix;
const SkMatrix& thatCtm = that->fShapes[0].fViewMatrix;
- if (thisCtm.hasPerspective() != thatCtm.hasPerspective()) {
- return CombineResult::kCannotCombine;
- }
-
- // We can position on the cpu unless we're in perspective,
- // but also need to make sure local matrices are identical
- if ((thisCtm.hasPerspective() || fHelper.usesLocalCoords()) &&
- !SkMatrixPriv::CheapEqual(thisCtm, thatCtm)) {
- return CombineResult::kCannotCombine;
- }
-
- // Depending on the ctm we may have a different shader for SDF paths
if (this->usesDistanceField()) {
+ // Need to make sure local matrices are identical
+ if (fHelper.usesLocalCoords() && !SkMatrixPriv::CheapEqual(thisCtm, thatCtm)) {
+ return CombineResult::kCannotCombine;
+ }
+
+ // Depending on the ctm we may have a different shader for SDF paths
if (thisCtm.isScaleTranslate() != thatCtm.isScaleTranslate() ||
thisCtm.isSimilarity() != thatCtm.isSimilarity()) {
return CombineResult::kCannotCombine;
}
+ } else {
+ if (thisCtm.hasPerspective() != thatCtm.hasPerspective()) {
+ return CombineResult::kCannotCombine;
+ }
+
+ // We can position on the cpu unless we're in perspective,
+ // but also need to make sure local matrices are identical
+ if ((thisCtm.hasPerspective() || fHelper.usesLocalCoords()) &&
+ !SkMatrixPriv::CheapEqual(thisCtm, thatCtm)) {
+ return CombineResult::kCannotCombine;
+ }
}
fShapes.push_back_n(that->fShapes.count(), that->fShapes.begin());
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/SmallPathRenderer.h b/chromium/third_party/skia/src/gpu/ganesh/ops/SmallPathRenderer.h
index bc18e15bd34..cc9e7a74a33 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/SmallPathRenderer.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/SmallPathRenderer.h
@@ -8,7 +8,7 @@
#ifndef SmallPathRenderer_DEFINED
#define SmallPathRenderer_DEFINED
-#include "src/gpu/ganesh/v1/PathRenderer.h"
+#include "src/gpu/ganesh/PathRenderer.h"
class GrStyledShape;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/SoftwarePathRenderer.cpp b/chromium/third_party/skia/src/gpu/ganesh/ops/SoftwarePathRenderer.cpp
index 8e19f4d68d5..49524f11ca6 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/SoftwarePathRenderer.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/SoftwarePathRenderer.cpp
@@ -23,10 +23,10 @@
#include "src/gpu/ganesh/GrSWMaskHelper.h"
#include "src/gpu/ganesh/GrUtil.h"
#include "src/gpu/ganesh/SkGr.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/effects/GrTextureEffect.h"
#include "src/gpu/ganesh/geometry/GrStyledShape.h"
#include "src/gpu/ganesh/ops/GrDrawOp.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
namespace {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/SoftwarePathRenderer.h b/chromium/third_party/skia/src/gpu/ganesh/ops/SoftwarePathRenderer.h
index b4a9be48dba..3cea210aea0 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/SoftwarePathRenderer.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/SoftwarePathRenderer.h
@@ -9,7 +9,7 @@
#define SoftwarePathRenderer_DEFINED
#include "src/gpu/ganesh/GrSurfaceProxyView.h"
-#include "src/gpu/ganesh/v1/PathRenderer.h"
+#include "src/gpu/ganesh/PathRenderer.h"
class GrProxyProvider;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/StrokeRectOp.cpp b/chromium/third_party/skia/src/gpu/ganesh/ops/StrokeRectOp.cpp
index c2af1c06af6..0aff54d3603 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/StrokeRectOp.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/StrokeRectOp.cpp
@@ -694,7 +694,7 @@ sk_sp<const GrGpuBuffer> AAStrokeRectOp::GetIndexBuffer(GrResourceProvider* reso
3 + 8, 0 + 8, 4 + 8, 4 + 8, 7 + 8, 3 + 8,
};
// clang-format on
- static_assert(SK_ARRAY_COUNT(gMiterIndices) == kMiterIndexCnt);
+ static_assert(std::size(gMiterIndices) == kMiterIndexCnt);
SKGPU_DEFINE_STATIC_UNIQUE_KEY(gMiterIndexBufferKey);
return resourceProvider->findOrCreatePatternedIndexBuffer(
gMiterIndices, kMiterIndexCnt, kNumMiterRectsInIndexBuffer, kMiterVertexCnt,
@@ -758,7 +758,7 @@ sk_sp<const GrGpuBuffer> AAStrokeRectOp::GetIndexBuffer(GrResourceProvider* reso
3 + 16, 0 + 16, 4 + 16, 4 + 16, 7 + 16, 3 + 16,
};
// clang-format on
- static_assert(SK_ARRAY_COUNT(gBevelIndices) == kBevelIndexCnt);
+ static_assert(std::size(gBevelIndices) == kBevelIndexCnt);
SKGPU_DEFINE_STATIC_UNIQUE_KEY(gBevelIndexBufferKey);
return resourceProvider->findOrCreatePatternedIndexBuffer(
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/StrokeTessellateOp.cpp b/chromium/third_party/skia/src/gpu/ganesh/ops/StrokeTessellateOp.cpp
index 8f47441eb90..de8153cd0ff 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/StrokeTessellateOp.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/StrokeTessellateOp.cpp
@@ -179,7 +179,12 @@ void StrokeTessellateOp::prePrepareTessellator(GrTessellationShader::ProgramArgs
fStencilProgram = GrTessellationShader::MakeProgram(args, fTessellationShader, pipeline,
&kMarkStencil);
fillStencil = &kTestAndResetStencil;
- args.fXferBarrierFlags = GrXferBarrierFlags::kNone;
+ // TODO: Currently if we have a texture barrier for a dst read it will get put in before
+ // both the stencil draw and the fill draw. In reality we only really need the barrier
+ // once to guard the reads of the color buffer in the fill from the previous writes. Maybe
+ // we can investigate how to remove one of these barriers but it is probably not something
+ // that is required a lot and thus the extra barrier shouldn't be too much of a perf hit to
+ // general Skia use.
}
fFillProgram = GrTessellationShader::MakeProgram(args, fTessellationShader, pipeline,
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/TessellationPathRenderer.cpp b/chromium/third_party/skia/src/gpu/ganesh/ops/TessellationPathRenderer.cpp
index 94a2fae7bf3..d0fee1c2605 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/TessellationPathRenderer.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/TessellationPathRenderer.cpp
@@ -11,13 +11,13 @@
#include "src/gpu/ganesh/GrClip.h"
#include "src/gpu/ganesh/GrMemoryPool.h"
#include "src/gpu/ganesh/GrRecordingContextPriv.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/effects/GrDisableColorXP.h"
#include "src/gpu/ganesh/geometry/GrStyledShape.h"
#include "src/gpu/ganesh/ops/PathInnerTriangulateOp.h"
#include "src/gpu/ganesh/ops/PathStencilCoverOp.h"
#include "src/gpu/ganesh/ops/PathTessellateOp.h"
#include "src/gpu/ganesh/ops/StrokeTessellateOp.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
#include "src/gpu/tessellate/Tessellation.h"
#include "src/gpu/tessellate/WangsFormula.h"
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/TessellationPathRenderer.h b/chromium/third_party/skia/src/gpu/ganesh/ops/TessellationPathRenderer.h
index 2e5bb4c2c43..583b09ab10e 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/TessellationPathRenderer.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/TessellationPathRenderer.h
@@ -9,7 +9,7 @@
#define TessellationPathRenderer_DEFINED
#include "include/gpu/GrTypes.h"
-#include "src/gpu/ganesh/v1/PathRenderer.h"
+#include "src/gpu/ganesh/PathRenderer.h"
class GrCaps;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/TextureOp.cpp b/chromium/third_party/skia/src/gpu/ganesh/ops/TextureOp.cpp
index 79104257ba7..5c5f71109f1 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/TextureOp.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/TextureOp.cpp
@@ -30,6 +30,7 @@
#include "src/gpu/ganesh/GrTexture.h"
#include "src/gpu/ganesh/GrTextureProxy.h"
#include "src/gpu/ganesh/SkGr.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/effects/GrBlendFragmentProcessor.h"
#include "src/gpu/ganesh/effects/GrTextureEffect.h"
#include "src/gpu/ganesh/geometry/GrQuad.h"
@@ -42,7 +43,6 @@
#include "src/gpu/ganesh/ops/GrSimpleMeshDrawOpHelper.h"
#include "src/gpu/ganesh/ops/QuadPerEdgeAA.h"
#include "src/gpu/ganesh/ops/TextureOp.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
namespace {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/TriangulatingPathRenderer.cpp b/chromium/third_party/skia/src/gpu/ganesh/ops/TriangulatingPathRenderer.cpp
index b5063803834..d569d1ccb54 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/TriangulatingPathRenderer.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/TriangulatingPathRenderer.cpp
@@ -22,13 +22,13 @@
#include "src/gpu/ganesh/GrSimpleMesh.h"
#include "src/gpu/ganesh/GrStyle.h"
#include "src/gpu/ganesh/GrThreadSafeCache.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/geometry/GrAATriangulator.h"
#include "src/gpu/ganesh/geometry/GrPathUtils.h"
#include "src/gpu/ganesh/geometry/GrStyledShape.h"
#include "src/gpu/ganesh/geometry/GrTriangulator.h"
#include "src/gpu/ganesh/ops/GrMeshDrawOp.h"
#include "src/gpu/ganesh/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
#include <cstdio>
@@ -134,7 +134,10 @@ public:
if (fCanMapVB) {
fVertexBuffer->unmap();
} else {
- fVertexBuffer->updateData(fVertices, actualCount * fLockStride);
+ fVertexBuffer->updateData(fVertices,
+ /*offset=*/0,
+ /*size=*/actualCount*fLockStride,
+ /*preserve=*/false);
sk_free(fVertices);
}
@@ -554,7 +557,7 @@ GR_DRAW_OP_TEST_DEFINE(TriangulatingPathOp) {
static constexpr GrAAType kAATypes[] = {GrAAType::kNone, GrAAType::kMSAA, GrAAType::kCoverage};
GrAAType aaType;
do {
- aaType = kAATypes[random->nextULessThan(SK_ARRAY_COUNT(kAATypes))];
+ aaType = kAATypes[random->nextULessThan(std::size(kAATypes))];
} while(GrAAType::kMSAA == aaType && numSamples <= 1);
GrStyle style;
do {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/ops/TriangulatingPathRenderer.h b/chromium/third_party/skia/src/gpu/ganesh/ops/TriangulatingPathRenderer.h
index d53e73120ad..b06359daab1 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/ops/TriangulatingPathRenderer.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/ops/TriangulatingPathRenderer.h
@@ -8,7 +8,7 @@
#ifndef TriangulatingPathRenderer_DEFINED
#define TriangulatingPathRenderer_DEFINED
-#include "src/gpu/ganesh/v1/PathRenderer.h"
+#include "src/gpu/ganesh/PathRenderer.h"
namespace skgpu::v1 {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/tessellate/GrPathTessellationShader.cpp b/chromium/third_party/skia/src/gpu/ganesh/tessellate/GrPathTessellationShader.cpp
index c695e3a95ed..42617f49fbe 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/tessellate/GrPathTessellationShader.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/tessellate/GrPathTessellationShader.cpp
@@ -309,7 +309,8 @@ void GrPathTessellationShader::Impl::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs
&affineMatrix);
fTranslateUniform = args.fUniformHandler->addUniform(nullptr, kVertex_GrShaderFlag,
SkSLType::kFloat2, "translate", &translate);
- args.fVertBuilder->codeAppendf("float2x2 AFFINE_MATRIX = float2x2(%s);", affineMatrix);
+ args.fVertBuilder->codeAppendf("float2x2 AFFINE_MATRIX = float2x2(%s.xy, %s.zw);",
+ affineMatrix, affineMatrix);
args.fVertBuilder->codeAppendf("float2 TRANSLATE = %s;", translate);
this->emitVertexCode(*args.fShaderCaps,
shader,
diff --git a/chromium/third_party/skia/src/gpu/ganesh/tessellate/GrStrokeTessellationShader.cpp b/chromium/third_party/skia/src/gpu/ganesh/tessellate/GrStrokeTessellationShader.cpp
index ded909ef9dc..bbc3b582245 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/tessellate/GrStrokeTessellationShader.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/tessellate/GrStrokeTessellationShader.cpp
@@ -248,7 +248,8 @@ void GrStrokeTessellationShader::Impl::onEmitCode(EmitArgs& args, GrGPArgs* gpAr
fTranslateUniform = args.fUniformHandler->addUniform(nullptr, kVertex_GrShaderFlag,
SkSLType::kFloat2, "translate",
&translateName);
- args.fVertBuilder->codeAppendf("float2x2 AFFINE_MATRIX = float2x2(%s);\n", affineMatrixName);
+ args.fVertBuilder->codeAppendf("float2x2 AFFINE_MATRIX = float2x2(%s.xy, %s.zw);\n",
+ affineMatrixName, affineMatrixName);
args.fVertBuilder->codeAppendf("float2 TRANSLATE = %s;\n", translateName);
if (shader.hasExplicitCurveType()) {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/text/GrAtlasManager.cpp b/chromium/third_party/skia/src/gpu/ganesh/text/GrAtlasManager.cpp
index e9a0bf2009c..8abe511364b 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/text/GrAtlasManager.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/text/GrAtlasManager.cpp
@@ -132,22 +132,11 @@ static void get_packed_glyph_image(
}
}
} else {
- // crbug:510931
- // Retrieving the image from the cache can actually change the mask format. This case is
- // very uncommon so for now we just draw a clear box for these glyphs.
- const int bpp = MaskFormatBytesPerPixel(expectedMaskFormat);
- for (int y = 0; y < height; y++) {
- sk_bzero(dst, width * bpp);
- dst = (char*)dst + dstRB;
- }
+ SkUNREACHABLE;
}
}
-// returns true if glyph successfully added to texture atlas, false otherwise. If the glyph's
-// mask format has changed, then addGlyphToAtlas will draw a clear box. This will almost never
-// happen.
-// TODO we can handle some of these cases if we really want to, but the long term solution is to
-// get the actual glyph image itself when we get the glyph metrics.
+// returns true if glyph successfully added to texture atlas, false otherwise.
GrDrawOpAtlas::ErrorCode GrAtlasManager::addGlyphToAtlas(const SkGlyph& skGlyph,
Glyph* glyph,
int srcPadding,
diff --git a/chromium/third_party/skia/src/gpu/ganesh/v1/BUILD.bazel b/chromium/third_party/skia/src/gpu/ganesh/v1/BUILD.bazel
deleted file mode 100644
index d97dc71195c..00000000000
--- a/chromium/third_party/skia/src/gpu/ganesh/v1/BUILD.bazel
+++ /dev/null
@@ -1,41 +0,0 @@
-load("//bazel:macros.bzl", "exports_files_legacy", "split_srcs_and_hdrs")
-
-licenses(["notice"])
-
-exports_files_legacy()
-
-V1_FILES = [
- "ClipStack.cpp",
- "ClipStack.h",
- "Device.cpp",
- "Device_drawTexture.cpp",
- "Device_v1.h",
- "PathRenderer.cpp",
- "PathRenderer.h",
- "PathRendererChain.cpp",
- "PathRendererChain.h",
- "StencilClip.h",
- "StencilMaskHelper.cpp",
- "StencilMaskHelper.h",
- "SurfaceDrawContext.cpp",
- "SurfaceDrawContext_v1.h",
- "SurfaceFillContext_v1.cpp",
- "SurfaceFillContext_v1.h",
-]
-
-split_srcs_and_hdrs(
- name = "v1",
- files = V1_FILES,
-)
-
-filegroup(
- name = "srcs",
- srcs = [":v1_srcs"],
- visibility = ["//src/gpu/ganesh:__pkg__"],
-)
-
-filegroup(
- name = "private_hdrs",
- srcs = [":v1_hdrs"],
- visibility = ["//src/gpu/ganesh:__pkg__"],
-)
diff --git a/chromium/third_party/skia/src/gpu/ganesh/v1/SurfaceFillContext_v1.cpp b/chromium/third_party/skia/src/gpu/ganesh/v1/SurfaceFillContext_v1.cpp
deleted file mode 100644
index a2f767f3412..00000000000
--- a/chromium/third_party/skia/src/gpu/ganesh/v1/SurfaceFillContext_v1.cpp
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Copyright 2020 Google LLC
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "src/gpu/ganesh/v1/SurfaceFillContext_v1.h"
-
-#include "include/private/gpu/ganesh/GrImageContext.h"
-#include "src/gpu/ganesh/GrDstProxyView.h"
-#include "src/gpu/ganesh/GrImageContextPriv.h"
-#include "src/gpu/ganesh/GrProxyProvider.h"
-#include "src/gpu/ganesh/GrTextureResolveRenderTask.h"
-#include "src/gpu/ganesh/effects/GrTextureEffect.h"
-#include "src/gpu/ganesh/geometry/GrRect.h"
-#include "src/gpu/ganesh/ops/ClearOp.h"
-#include "src/gpu/ganesh/ops/FillRectOp.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
-
-#define ASSERT_SINGLE_OWNER SKGPU_ASSERT_SINGLE_OWNER(this->singleOwner())
-#define RETURN_IF_ABANDONED if (fContext->abandoned()) { return; }
-
-class AutoCheckFlush {
-public:
- AutoCheckFlush(GrDrawingManager* drawingManager) : fDrawingManager(drawingManager) {
- SkASSERT(fDrawingManager);
- }
- ~AutoCheckFlush() { fDrawingManager->flushIfNecessary(); }
-
-private:
- GrDrawingManager* fDrawingManager;
-};
-
-namespace skgpu::v1 {
-
-// In MDB mode the reffing of the 'getLastOpsTask' call's result allows in-progress
-// OpsTask to be picked up and added to by SurfaceFillContext lower in the call
-// stack. When this occurs with a closed OpsTask, a new one will be allocated
-// when the SurfaceFillContext attempts to use it (via getOpsTask).
-SurfaceFillContext::SurfaceFillContext(GrRecordingContext* rContext,
- GrSurfaceProxyView readView,
- GrSurfaceProxyView writeView,
- const GrColorInfo& colorInfo)
- : skgpu::SurfaceFillContext(rContext,
- std::move(readView),
- std::move(writeView),
- std::move(colorInfo)) {
- fOpsTask = sk_ref_sp(rContext->priv().drawingManager()->getLastOpsTask(this->asSurfaceProxy()));
-
- SkDEBUGCODE(this->validate();)
-}
-
-void SurfaceFillContext::fillRectWithFP(const SkIRect& dstRect,
- std::unique_ptr<GrFragmentProcessor> fp) {
- ASSERT_SINGLE_OWNER
- RETURN_IF_ABANDONED
- SkDEBUGCODE(this->validate();)
- GR_CREATE_TRACE_MARKER_CONTEXT("v1::SurfaceFillContext", "fillRectWithFP", fContext);
-
- AutoCheckFlush acf(this->drawingManager());
-
- GrPaint paint;
- paint.setColorFragmentProcessor(std::move(fp));
- paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
- auto op = FillRectOp::MakeNonAARect(fContext, std::move(paint), SkMatrix::I(),
- SkRect::Make(dstRect));
- this->addDrawOp(std::move(op));
-}
-
-void SurfaceFillContext::addDrawOp(GrOp::Owner owner) {
- GrDrawOp* op = static_cast<GrDrawOp*>(owner.get());
- GrClampType clampType = GrColorTypeClampType(this->colorInfo().colorType());
- auto clip = GrAppliedClip::Disabled();
- const GrCaps& caps = *this->caps();
- GrProcessorSet::Analysis analysis = op->finalize(caps, &clip, clampType);
- SkASSERT(!op->usesStencil());
- SkASSERT(!analysis.requiresDstTexture());
- SkRect bounds = owner->bounds();
- // We shouldn't have coverage AA or hairline draws in fill contexts.
- SkASSERT(!op->hasAABloat() && !op->hasZeroArea());
- if (!bounds.intersect(this->asSurfaceProxy()->getBoundsRect())) {
- return;
- }
- op->setClippedBounds(op->bounds());
- SkDEBUGCODE(op->fAddDrawOpCalled = true;)
-
- GrDstProxyView dstProxyView;
- this->getOpsTask()->addDrawOp(fContext->priv().drawingManager(),
- std::move(owner),
- op->usesMSAA(),
- analysis,
- std::move(clip),
- dstProxyView,
- GrTextureResolveManager(this->drawingManager()),
- caps);
-}
-
-void SurfaceFillContext::ClearToGrPaint(std::array<float, 4> color, GrPaint* paint) {
- paint->setColor4f({color[0], color[1], color[2], color[3]});
- if (color[3] == 1.f) {
- // Can just rely on the src-over blend mode to do the right thing.
- // This may improve batching.
- paint->setPorterDuffXPFactory(SkBlendMode::kSrcOver);
- } else {
- // A clear overwrites the prior color, so even if it's transparent, it behaves as if it
- // were src blended
- paint->setPorterDuffXPFactory(SkBlendMode::kSrc);
- }
-}
-
-void SurfaceFillContext::addOp(GrOp::Owner op) {
- GrDrawingManager* drawingMgr = this->drawingManager();
- this->getOpsTask()->addOp(drawingMgr,
- std::move(op),
- GrTextureResolveManager(drawingMgr),
- *this->caps());
-}
-
-OpsTask* SurfaceFillContext::getOpsTask() {
- ASSERT_SINGLE_OWNER
- SkDEBUGCODE(this->validate();)
-
- if (!fOpsTask || fOpsTask->isClosed()) {
- this->replaceOpsTask();
- }
- SkASSERT(!fOpsTask->isClosed());
- return fOpsTask.get();
-}
-
-sk_sp<GrRenderTask> SurfaceFillContext::refRenderTask() {
- return sk_ref_sp(this->getOpsTask());
-}
-
-OpsTask* SurfaceFillContext::replaceOpsTask() {
- sk_sp<OpsTask> newOpsTask = this->drawingManager()->newOpsTask(
- this->writeSurfaceView(), this->arenas());
- this->willReplaceOpsTask(fOpsTask.get(), newOpsTask.get());
- fOpsTask = std::move(newOpsTask);
- return fOpsTask.get();
-}
-
-#ifdef SK_DEBUG
-void SurfaceFillContext::onValidate() const {
- if (fOpsTask && !fOpsTask->isClosed()) {
- SkASSERT(this->drawingManager()->getLastRenderTask(fWriteView.proxy()) == fOpsTask.get());
- }
-}
-#endif
-
-void SurfaceFillContext::discard() {
- ASSERT_SINGLE_OWNER
- RETURN_IF_ABANDONED
- SkDEBUGCODE(this->validate();)
- GR_CREATE_TRACE_MARKER_CONTEXT("v1::SurfaceFillContext", "discard", fContext);
-
- AutoCheckFlush acf(this->drawingManager());
-
- this->getOpsTask()->discard();
-}
-
-void SurfaceFillContext::resolveMSAA() {
- ASSERT_SINGLE_OWNER
- RETURN_IF_ABANDONED
- SkDEBUGCODE(this->validate();)
- GR_CREATE_TRACE_MARKER_CONTEXT("v1::SurfaceFillContext", "resolveMSAA", fContext);
-
- AutoCheckFlush acf(this->drawingManager());
-
- this->drawingManager()->newTextureResolveRenderTask(this->asSurfaceProxyRef(),
- GrSurfaceProxy::ResolveFlags::kMSAA,
- *this->caps());
-}
-
-void SurfaceFillContext::internalClear(const SkIRect* scissor,
- std::array<float, 4> color,
- bool upgradePartialToFull) {
- ASSERT_SINGLE_OWNER
- RETURN_IF_ABANDONED
- SkDEBUGCODE(this->validate();)
- GR_CREATE_TRACE_MARKER_CONTEXT("v1::SurfaceFillContext", "clear", fContext);
-
- // There are three ways clears are handled: load ops, native clears, and draws. Load ops are
- // only for fullscreen clears; native clears can be fullscreen or with scissors if the backend
- // supports then. Drawing an axis-aligned rect is the fallback path.
- GrScissorState scissorState(this->asSurfaceProxy()->backingStoreDimensions());
- if (scissor && !scissorState.set(*scissor)) {
- // The clear is offscreen, so skip it (normally this would be handled by addDrawOp,
- // except clear ops are not draw ops).
- return;
- }
-
- // If we have a scissor but it's okay to clear beyond it for performance reasons, then disable
- // the test. We only do this when the clear would be handled by a load op or natively.
- if (scissorState.enabled() && !this->caps()->performColorClearsAsDraws()) {
- if (upgradePartialToFull && (this->caps()->preferFullscreenClears() ||
- this->caps()->shouldInitializeTextures())) {
- // TODO: wrt the shouldInitializeTextures path, it would be more performant to
- // only clear the entire target if we knew it had not been cleared before. As
- // is this could end up doing a lot of redundant clears.
- scissorState.setDisabled();
- } else {
- // Unlike with stencil clears, we also allow clears up to the logical dimensions of the
- // render target to overflow into any approx-fit padding of the backing store dimensions
- scissorState.relaxTest(this->dimensions());
- }
- }
-
- if (!scissorState.enabled()) {
- // This is a fullscreen clear, so could be handled as a load op. Regardless, we can also
- // discard all prior ops in the current task since the color buffer will be overwritten.
- auto opsTask = this->getOpsTask();
- if (opsTask->resetForFullscreenClear(this->canDiscardPreviousOpsOnFullClear()) &&
- !this->caps()->performColorClearsAsDraws()) {
- color = this->writeSurfaceView().swizzle().applyTo(color);
- // The op list was emptied and native clears are allowed, so just use the load op
- opsTask->setColorLoadOp(GrLoadOp::kClear, color);
- return;
- } else {
- // Will use an op for the clear, reset the load op to discard since the op will
- // blow away the color buffer contents
- opsTask->setColorLoadOp(GrLoadOp::kDiscard);
- }
- }
-
- // At this point we are either a partial clear or a fullscreen clear that couldn't be applied
- // as a load op.
- bool clearAsDraw = this->caps()->performColorClearsAsDraws() ||
- (scissorState.enabled() && this->caps()->performPartialClearsAsDraws());
- if (clearAsDraw) {
- GrPaint paint;
- ClearToGrPaint(color, &paint);
- auto op = FillRectOp::MakeNonAARect(fContext, std::move(paint), SkMatrix::I(),
- SkRect::Make(scissorState.rect()));
- this->addDrawOp(std::move(op));
- } else {
- color = this->writeSurfaceView().swizzle().applyTo(color);
- this->addOp(ClearOp::MakeColor(fContext, scissorState, color));
- }
-}
-
-bool SurfaceFillContext::blitTexture(GrSurfaceProxyView view,
- const SkIRect& srcRect,
- const SkIPoint& dstPoint) {
- SkASSERT(view.asTextureProxy());
- SkIRect clippedSrcRect;
- SkIPoint clippedDstPoint;
- if (!GrClipSrcRectAndDstPoint(this->dimensions(),
- view.dimensions(),
- srcRect,
- dstPoint,
- &clippedSrcRect,
- &clippedDstPoint)) {
- return false;
- }
-
- auto fp = GrTextureEffect::Make(std::move(view), kUnknown_SkAlphaType);
- auto dstRect = SkIRect::MakePtSize(clippedDstPoint, clippedSrcRect.size());
- auto srcRectF = SkRect::Make(clippedSrcRect);
- this->fillRectToRectWithFP(srcRectF, dstRect, std::move(fp));
- return true;
-}
-
-} // namespace skgpu::v1
diff --git a/chromium/third_party/skia/src/gpu/ganesh/v1/SurfaceFillContext_v1.h b/chromium/third_party/skia/src/gpu/ganesh/v1/SurfaceFillContext_v1.h
deleted file mode 100644
index 812d9a7d7eb..00000000000
--- a/chromium/third_party/skia/src/gpu/ganesh/v1/SurfaceFillContext_v1.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2020 Google LLC
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SurfaceFillContext_v1_DEFINED
-#define SurfaceFillContext_v1_DEFINED
-
-#include "include/core/SkSize.h"
-#include "include/private/gpu/ganesh/GrTypesPriv.h"
-#include "src/gpu/Swizzle.h"
-#include "src/gpu/ganesh/GrImageInfo.h"
-#include "src/gpu/ganesh/SurfaceFillContext.h"
-#include "src/gpu/ganesh/ops/OpsTask.h"
-
-#include <array>
-#include <tuple>
-
-class GrFragmentProcessor;
-class GrImageContext;
-class GrOp;
-class GrBackendFormat;
-class GrRecordingContext;
-class GrSurfaceProxyView;
-class SkColorSpace;
-
-namespace skgpu::v1 {
-
-class SurfaceFillContext : public skgpu::SurfaceFillContext {
-public:
- SurfaceFillContext(GrRecordingContext*,
- GrSurfaceProxyView readView,
- GrSurfaceProxyView writeView,
- const GrColorInfo&);
-
- void discard() override;
-
- void resolveMSAA() override;
-
- void fillRectWithFP(const SkIRect& dstRect, std::unique_ptr<GrFragmentProcessor> fp) override;
-
- bool blitTexture(GrSurfaceProxyView view,
- const SkIRect& srcRect,
- const SkIPoint& dstPoint) override;
-
- OpsTask* getOpsTask();
- sk_sp<GrRenderTask> refRenderTask() override;
-
- int numSamples() const { return this->asRenderTargetProxy()->numSamples(); }
- bool wrapsVkSecondaryCB() const { return this->asRenderTargetProxy()->wrapsVkSecondaryCB(); }
-
- SkArenaAlloc* arenaAlloc() { return this->arenas()->arenaAlloc(); }
- sktext::gpu::SubRunAllocator* subRunAlloc() { return this->arenas()->subRunAlloc(); }
-
-#if GR_TEST_UTILS
- OpsTask* testingOnly_PeekLastOpsTask() { return fOpsTask.get(); }
-#endif
-
- const GrSurfaceProxyView& writeSurfaceView() const { return fWriteView; }
-
-protected:
- /**
- * Creates a constant color paint for a clear, using src-over if possible to improve batching.
- */
- static void ClearToGrPaint(std::array<float, 4> color, GrPaint* paint);
-
- void addOp(GrOp::Owner);
-
- OpsTask* replaceOpsTask();
-
-private:
- sk_sp<GrArenas> arenas() { return fWriteView.proxy()->asRenderTargetProxy()->arenas(); }
-
- /** Override to be notified in subclass before the current ops task is replaced. */
- virtual void willReplaceOpsTask(OpsTask* prevTask, OpsTask* nextTask) {}
-
- /**
- * Override to be called to participate in the decision to discard all previous ops if a
- * fullscreen clear occurs.
- */
- virtual OpsTask::CanDiscardPreviousOps canDiscardPreviousOpsOnFullClear() const {
- return OpsTask::CanDiscardPreviousOps::kYes;
- }
-
- void internalClear(const SkIRect* scissor,
- std::array<float, 4> color,
- bool upgradePartialToFull = false) override;
-
- void addDrawOp(GrOp::Owner);
-
- SkDEBUGCODE(void onValidate() const override;)
-
- // The OpsTask can be closed by some other surface context that has picked it up. For this
- // reason, the OpsTask should only ever be accessed via 'getOpsTask'.
- sk_sp<OpsTask> fOpsTask;
-
- using INHERITED = skgpu::SurfaceFillContext;
-};
-
-} // namespace skgpu::v1
-
-#endif // SurfaceFillContext_v1_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/ganesh/vk/BUILD.bazel b/chromium/third_party/skia/src/gpu/ganesh/vk/BUILD.bazel
index 84592c66661..6c25ab57107 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/vk/BUILD.bazel
+++ b/chromium/third_party/skia/src/gpu/ganesh/vk/BUILD.bazel
@@ -1,4 +1,4 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy", "split_srcs_and_hdrs")
+load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_deps", "split_srcs_and_hdrs")
licenses(["notice"])
@@ -93,11 +93,11 @@ filegroup(
visibility = ["//src/gpu/ganesh:__pkg__"],
)
-cc_library(
+skia_cc_deps(
name = "deps",
visibility = ["//src/gpu/ganesh:__pkg__"],
deps = select({
- "//bazel/common_config_settings:vulkan_with_vma": ["//third_party/vulkanmemoryallocator"],
+ "//src/gpu:vulkan_with_vma": ["//third_party/vulkanmemoryallocator"],
"//conditions:default": [],
}),
)
diff --git a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkBuffer.cpp b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkBuffer.cpp
index 3c8bd9a339b..d04b2cec28a 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkBuffer.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkBuffer.cpp
@@ -18,11 +18,11 @@
#define VK_CALL(GPU, X) GR_VK_CALL(GPU->vkInterface(), X)
GrVkBuffer::GrVkBuffer(GrVkGpu* gpu,
- size_t sizeInBytes,
- GrGpuBufferType bufferType,
- GrAccessPattern accessPattern,
- VkBuffer buffer,
- const GrVkAlloc& alloc,
+ size_t sizeInBytes,
+ GrGpuBufferType bufferType,
+ GrAccessPattern accessPattern,
+ VkBuffer buffer,
+ const GrVkAlloc& alloc,
const GrVkDescriptorSet* uniformDescriptorSet,
std::string_view label)
: GrGpuBuffer(gpu, sizeInBytes, bufferType, accessPattern, label)
@@ -66,9 +66,9 @@ static const GrVkDescriptorSet* make_uniform_desc_set(GrVkGpu* gpu, VkBuffer buf
}
sk_sp<GrVkBuffer> GrVkBuffer::Make(GrVkGpu* gpu,
- size_t size,
- GrGpuBufferType bufferType,
- GrAccessPattern accessPattern) {
+ size_t size,
+ GrGpuBufferType bufferType,
+ GrAccessPattern accessPattern) {
VkBuffer buffer;
GrVkAlloc alloc;
@@ -89,13 +89,15 @@ sk_sp<GrVkBuffer> GrVkBuffer::Make(GrVkGpu* gpu,
bufInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
bufInfo.flags = 0;
bufInfo.size = size;
+ // To support SkMesh buffer updates we make Vertex and Index buffers capable of being transfer
+ // dsts.
switch (bufferType) {
case GrGpuBufferType::kVertex:
- bufInfo.usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT;
+ bufInfo.usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
allocUsage = requiresMappable ? BufferUsage::kCpuWritesGpuReads : BufferUsage::kGpuOnly;
break;
case GrGpuBufferType::kIndex:
- bufInfo.usage = VK_BUFFER_USAGE_INDEX_BUFFER_BIT;
+ bufInfo.usage = VK_BUFFER_USAGE_INDEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
allocUsage = requiresMappable ? BufferUsage::kCpuWritesGpuReads : BufferUsage::kGpuOnly;
break;
case GrGpuBufferType::kDrawIndirect:
@@ -154,7 +156,7 @@ sk_sp<GrVkBuffer> GrVkBuffer::Make(GrVkGpu* gpu,
/*label=*/"MakeVkBuffer"));
}
-void GrVkBuffer::vkMap(size_t size) {
+void GrVkBuffer::vkMap(size_t readOffset, size_t readSize) {
SkASSERT(!fMapPtr);
if (this->isVkMappable()) {
// Not every buffer will use command buffer usage refs and instead the command buffer just
@@ -163,39 +165,28 @@ void GrVkBuffer::vkMap(size_t size) {
// there isn't a buffer with just a command buffer usage that is trying to be mapped.
SkASSERT(this->internalHasNoCommandBufferUsages());
SkASSERT(fAlloc.fSize > 0);
- SkASSERT(fAlloc.fSize >= size);
+ SkASSERT(fAlloc.fSize >= readOffset + readSize);
fMapPtr = GrVkMemory::MapAlloc(this->getVkGpu(), fAlloc);
- if (fMapPtr && this->intendedType() == GrGpuBufferType::kXferGpuToCpu) {
- GrVkMemory::InvalidateMappedAlloc(this->getVkGpu(), fAlloc, 0, size);
+ if (fMapPtr && readSize != 0) {
+ // "Invalidate" here means make device writes visible to the host. That is, it makes
+ // sure any GPU writes are finished in the range we might read from.
+ GrVkMemory::InvalidateMappedAlloc(this->getVkGpu(), fAlloc, readOffset, readSize);
}
}
}
-void GrVkBuffer::vkUnmap(size_t size) {
+void GrVkBuffer::vkUnmap(size_t flushOffset, size_t flushSize) {
SkASSERT(fMapPtr && this->isVkMappable());
SkASSERT(fAlloc.fSize > 0);
- SkASSERT(fAlloc.fSize >= size);
+ SkASSERT(fAlloc.fSize >= flushOffset + flushSize);
GrVkGpu* gpu = this->getVkGpu();
- GrVkMemory::FlushMappedAlloc(gpu, fAlloc, 0, size);
+ GrVkMemory::FlushMappedAlloc(gpu, fAlloc, flushOffset, flushSize);
GrVkMemory::UnmapAlloc(gpu, fAlloc);
}
-static VkAccessFlags buffer_type_to_access_flags(GrGpuBufferType type) {
- switch (type) {
- case GrGpuBufferType::kIndex:
- return VK_ACCESS_INDEX_READ_BIT;
- case GrGpuBufferType::kVertex:
- return VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT;
- default:
- // This helper is only called for static buffers so we should only ever see index or
- // vertex buffers types
- SkUNREACHABLE;
- }
-}
-
-void GrVkBuffer::copyCpuDataToGpuBuffer(const void* src, size_t size) {
+void GrVkBuffer::copyCpuDataToGpuBuffer(const void* src, size_t offset, size_t size) {
SkASSERT(src);
GrVkGpu* gpu = this->getVkGpu();
@@ -204,9 +195,10 @@ void GrVkBuffer::copyCpuDataToGpuBuffer(const void* src, size_t size) {
SkASSERT(!gpu->protectedContext());
// The vulkan api restricts the use of vkCmdUpdateBuffer to updates that are less than or equal
- // to 65536 bytes and a size the is 4 byte aligned.
- if ((size <= 65536) && (0 == (size & 0x3)) && !gpu->vkCaps().avoidUpdateBuffers()) {
- gpu->updateBuffer(sk_ref_sp(this), src, /*offset=*/0, size);
+ // to 65536 bytes and a size and offset that are both 4 byte aligned.
+ if ((size <= 65536) && SkIsAlign4(size) && SkIsAlign4(offset) &&
+ !gpu->vkCaps().avoidUpdateBuffers()) {
+ gpu->updateBuffer(sk_ref_sp(this), src, offset, size);
} else {
GrResourceProvider* resourceProvider = gpu->getContext()->priv().resourceProvider();
sk_sp<GrGpuBuffer> transferBuffer = resourceProvider->createBuffer(
@@ -218,15 +210,12 @@ void GrVkBuffer::copyCpuDataToGpuBuffer(const void* src, size_t size) {
return;
}
- gpu->copyBuffer(std::move(transferBuffer), sk_ref_sp(this), /*srcOffset=*/0,
- /*dstOffset=*/0, size);
+ gpu->transferFromBufferToBuffer(std::move(transferBuffer),
+ /*srcOffset=*/0,
+ sk_ref_sp(this),
+ offset,
+ size);
}
-
- this->addMemoryBarrier(VK_ACCESS_TRANSFER_WRITE_BIT,
- buffer_type_to_access_flags(this->intendedType()),
- VK_PIPELINE_STAGE_TRANSFER_BIT,
- VK_PIPELINE_STAGE_VERTEX_INPUT_BIT,
- /*byRegion=*/false);
}
void GrVkBuffer::addMemoryBarrier(VkAccessFlags srcAccessMask,
@@ -257,7 +246,7 @@ void GrVkBuffer::vkRelease() {
}
if (fMapPtr) {
- this->vkUnmap(this->size());
+ this->vkUnmap(0, this->size());
fMapPtr = nullptr;
}
@@ -286,37 +275,27 @@ void GrVkBuffer::onAbandon() {
this->GrGpuBuffer::onAbandon();
}
-void GrVkBuffer::onMap() {
- if (!this->wasDestroyed()) {
- this->vkMap(this->size());
- }
+void GrVkBuffer::onMap(MapType type) {
+ this->vkMap(0, type == MapType::kRead ? this->size() : 0);
}
-void GrVkBuffer::onUnmap() {
- if (!this->wasDestroyed()) {
- this->vkUnmap(this->size());
- }
+void GrVkBuffer::onUnmap(MapType type) {
+ this->vkUnmap(0, type == MapType::kWriteDiscard ? this->size() : 0);
}
-bool GrVkBuffer::onUpdateData(const void* src, size_t srcSizeInBytes) {
- if (this->wasDestroyed()) {
- return false;
- }
-
- if (srcSizeInBytes > this->size()) {
- return false;
- }
-
+bool GrVkBuffer::onUpdateData(const void* src, size_t offset, size_t size, bool /*preserve*/) {
if (this->isVkMappable()) {
- this->vkMap(srcSizeInBytes);
+ // We won't be reading the mapped memory so pass an empty range.
+ this->vkMap(0, 0);
if (!fMapPtr) {
return false;
}
- memcpy(fMapPtr, src, srcSizeInBytes);
- this->vkUnmap(srcSizeInBytes);
+ memcpy(SkTAddOffset<void>(fMapPtr, offset), src, size);
+ // We only need to flush the updated portion so pass the true range here.
+ this->vkUnmap(offset, size);
fMapPtr = nullptr;
} else {
- this->copyCpuDataToGpuBuffer(src, srcSizeInBytes);
+ this->copyCpuDataToGpuBuffer(src, offset, size);
}
return true;
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkBuffer.h b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkBuffer.h
index 6509af5a8da..36f55aaf104 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkBuffer.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkBuffer.h
@@ -17,9 +17,9 @@ class GrVkGpu;
class GrVkBuffer : public GrGpuBuffer {
public:
static sk_sp<GrVkBuffer> Make(GrVkGpu* gpu,
- size_t size,
- GrGpuBufferType bufferType,
- GrAccessPattern accessPattern);
+ size_t size,
+ GrGpuBufferType bufferType,
+ GrAccessPattern accessPattern);
VkBuffer vkBuffer() const { return fBuffer; }
@@ -35,25 +35,24 @@ public:
private:
GrVkBuffer(GrVkGpu* gpu,
- size_t sizeInBytes,
- GrGpuBufferType bufferType,
- GrAccessPattern accessPattern,
- VkBuffer buffer,
- const GrVkAlloc& alloc,
+ size_t sizeInBytes,
+ GrGpuBufferType bufferType,
+ GrAccessPattern accessPattern,
+ VkBuffer buffer,
+ const GrVkAlloc& alloc,
const GrVkDescriptorSet* uniformDescriptorSet,
std::string_view label);
bool isVkMappable() const { return fAlloc.fFlags & GrVkAlloc::kMappable_Flag; }
bool vkIsMapped() const { return SkToBool(fMapPtr); }
- void vkMap(size_t size);
- void vkUnmap(size_t size);
- void copyCpuDataToGpuBuffer(const void* srcData, size_t size);
+ void vkMap(size_t readOffset, size_t readSize);
+ void vkUnmap(size_t flushOffset, size_t flushSize);
+ void copyCpuDataToGpuBuffer(const void* srcData, size_t offset, size_t size);
-
- void onMap() override;
- void onUnmap() override;
- bool onUpdateData(const void* src, size_t srcSizeInBytes) override;
+ void onMap(MapType) override;
+ void onUnmap(MapType) override;
+ bool onUpdateData(const void* src, size_t offset, size_t size, bool preserve) override;
void vkRelease();
diff --git a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkCaps.cpp b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkCaps.cpp
index b0a9ce7239d..a04c1f889bc 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkCaps.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkCaps.cpp
@@ -62,6 +62,7 @@ GrVkCaps::GrVkCaps(const GrContextOptions& contextOptions, const GrVkInterface*
fTransferFromBufferToTextureSupport = true;
fTransferFromSurfaceToBufferSupport = true;
+ fTransferFromBufferToBufferSupport = true;
fMaxRenderTargetSize = 4096; // minimum required by spec
fMaxTextureSize = 4096; // minimum required by spec
@@ -583,6 +584,15 @@ void GrVkCaps::applyDriverCorrectnessWorkarounds(const VkPhysicalDevicePropertie
fTextureBarrierSupport = false;
}
+#ifdef SK_BUILD_FOR_WIN
+ // Gen 12 Intel devices running on windows has issues using barriers for dst reads. This is seen
+ // when running the unit tests SkRuntimeEffect_Blender_GPU and DMSAA_aa_dst_read_after_dmsaa.
+ if (kIntel_VkVendor == properties.vendorID &&
+ GetIntelGen(GetIntelGPUType(properties.deviceID)) == 12) {
+ fTextureBarrierSupport = false;
+ }
+#endif
+
// On ARM indirect draws are broken on Android 9 and earlier. This was tested on a P30 and
// Mate 20x running android 9.
if (properties.vendorID == kARM_VkVendor && androidAPIVersion <= 28) {
@@ -596,6 +606,12 @@ void GrVkCaps::applyDriverCorrectnessWorkarounds(const VkPhysicalDevicePropertie
if (kImagination_VkVendor == properties.vendorID) {
fShaderCaps->fAtan2ImplementedAsAtanYOverX = true;
}
+
+ // ARM GPUs calculate `matrix * vector` in SPIR-V at full precision, even when the inputs are
+ // RelaxedPrecision. Rewriting the multiply as a sum of vector*scalar fixes this. (skia:11769)
+ if (kARM_VkVendor == properties.vendorID) {
+ fShaderCaps->fRewriteMatrixVectorMultiply = true;
+ }
}
void GrVkCaps::initGrCaps(const GrVkInterface* vkInterface,
@@ -693,10 +709,6 @@ void GrVkCaps::initShaderCaps(const VkPhysicalDeviceProperties& properties,
shaderCaps->fShaderDerivativeSupport = true;
- // ARM GPUs calculate `matrix * vector` in SPIR-V at full precision, even when the inputs are
- // RelaxedPrecision. Rewriting the multiply as a sum of vector*scalar fixes this. (skia:11769)
- shaderCaps->fRewriteMatrixVectorMultiply = (kARM_VkVendor == properties.vendorID);
-
shaderCaps->fDualSourceBlendingSupport = features.features.dualSrcBlend;
shaderCaps->fIntegerSupport = true;
@@ -812,9 +824,9 @@ const GrVkCaps::FormatInfo& GrVkCaps::getFormatInfo(VkFormat format) const {
}
GrVkCaps::FormatInfo& GrVkCaps::getFormatInfo(VkFormat format) {
- static_assert(SK_ARRAY_COUNT(kVkFormats) == GrVkCaps::kNumVkFormats,
+ static_assert(std::size(kVkFormats) == GrVkCaps::kNumVkFormats,
"Size of VkFormats array must match static value in header");
- for (size_t i = 0; i < SK_ARRAY_COUNT(kVkFormats); ++i) {
+ for (size_t i = 0; i < std::size(kVkFormats); ++i) {
if (kVkFormats[i] == format) {
return fFormatTable[i];
}
@@ -825,7 +837,7 @@ GrVkCaps::FormatInfo& GrVkCaps::getFormatInfo(VkFormat format) {
void GrVkCaps::initFormatTable(const GrVkInterface* interface, VkPhysicalDevice physDev,
const VkPhysicalDeviceProperties& properties) {
- static_assert(SK_ARRAY_COUNT(kVkFormats) == GrVkCaps::kNumVkFormats,
+ static_assert(std::size(kVkFormats) == GrVkCaps::kNumVkFormats,
"Size of VkFormats array must match static value in header");
std::fill_n(fColorTypeToFormatTable, kGrColorTypeCnt, VK_FORMAT_UNDEFINED);
@@ -1915,6 +1927,43 @@ VkShaderStageFlags GrVkCaps::getPushConstantStageFlags() const {
return stageFlags;
}
+template <size_t N>
+static bool intel_deviceID_present(const std::array<uint32_t, N>& array, uint32_t deviceID) {
+ return std::find(array.begin(), array.end(), deviceID) != array.end();
+}
+
+GrVkCaps::IntelGPUType GrVkCaps::GetIntelGPUType(uint32_t deviceID) {
+ // Some common Intel GPU models, currently we cover ICL/RKL/TGL/ADL
+ // Referenced from the following Mesa source files:
+ // https://github.com/mesa3d/mesa/blob/master/include/pci_ids/i965_pci_ids.h
+ // https://github.com/mesa3d/mesa/blob/master/include/pci_ids/iris_pci_ids.h
+ static constexpr std::array<uint32_t, 14> kIceLakeIDs = {
+ {0x8A50, 0x8A51, 0x8A52, 0x8A53, 0x8A54, 0x8A56, 0x8A57,
+ 0x8A58, 0x8A59, 0x8A5A, 0x8A5B, 0x8A5C, 0x8A5D, 0x8A71}};
+ static constexpr std::array<uint32_t, 5> kRocketLakeIDs = {
+ {0x4c8a, 0x4c8b, 0x4c8c, 0x4c90, 0x4c9a}};
+ static constexpr std::array<uint32_t, 11> kTigerLakeIDs = {
+ {0x9A40, 0x9A49, 0x9A59, 0x9A60, 0x9A68, 0x9A70,
+ 0x9A78, 0x9AC0, 0x9AC9, 0x9AD9, 0x9AF8}};
+ static constexpr std::array<uint32_t, 10> kAlderLakeIDs = {
+ {0x4680, 0x4681, 0x4682, 0x4683, 0x4690,
+ 0x4691, 0x4692, 0x4693, 0x4698, 0x4699}};
+
+ if (intel_deviceID_present(kIceLakeIDs, deviceID)) {
+ return IntelGPUType::kIceLake;
+ }
+ if (intel_deviceID_present(kRocketLakeIDs, deviceID)) {
+ return IntelGPUType::kRocketLake;
+ }
+ if (intel_deviceID_present(kTigerLakeIDs, deviceID)) {
+ return IntelGPUType::kTigerLake;
+ }
+ if (intel_deviceID_present(kAlderLakeIDs, deviceID)) {
+ return IntelGPUType::kAlderLake;
+ }
+ return IntelGPUType::kOther;
+}
+
#if GR_TEST_UTILS
std::vector<GrCaps::TestFormatColorTypeCombination> GrVkCaps::getTestingCombinations() const {
std::vector<GrCaps::TestFormatColorTypeCombination> combos = {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkCaps.h b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkCaps.h
index 6fedcdc4eac..31e66f0143d 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkCaps.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkCaps.h
@@ -281,40 +281,37 @@ private:
kQualcomm_VkVendor = 20803,
};
- // Some common Intel GPU models, currently we cover ICL/RKL/TGL/ADL
- // Referenced from the following Mesa source files:
- // https://github.com/mesa3d/mesa/blob/master/include/pci_ids/i965_pci_ids.h
- // https://github.com/mesa3d/mesa/blob/master/include/pci_ids/iris_pci_ids.h
- struct VkIntelGPUInfo {
- // IceLake
- const std::array<uint32_t, 14> IceLake = {
- {0x8A50, 0x8A51, 0x8A52, 0x8A53, 0x8A54, 0x8A56, 0x8A57,
- 0x8A58, 0x8A59, 0x8A5A, 0x8A5B, 0x8A5C, 0x8A5D, 0x8A71}};
- // RocketLake
- const std::array<uint32_t, 5> RocketLake = {
- {0x4c8a, 0x4c8b, 0x4c8c, 0x4c90, 0x4c9a}};
- // TigerLake
- const std::array<uint32_t, 11> TigerLake = {
- {0x9A40, 0x9A49, 0x9A59, 0x9A60, 0x9A68, 0x9A70,
- 0x9A78, 0x9AC0, 0x9AC9, 0x9AD9, 0x9AF8}};
- // Alderlake
- const std::array<uint32_t, 10> Alderlake = {
- {0x4680, 0x4681, 0x4682, 0x4683, 0x4690,
- 0x4691, 0x4692, 0x4693, 0x4698, 0x4699}};
- };
-
- enum class VkIntelGPUType {
+ enum class IntelGPUType {
// 11th gen
- kIntelIceLake,
+ kIceLake,
// 12th gen
- kIntelRocketLake,
- kIntelTigerLake,
- kIntelAlderLake,
+ kRocketLake,
+ kTigerLake,
+ kAlderLake,
kOther
};
+ static IntelGPUType GetIntelGPUType(uint32_t deviceID);
+ static int GetIntelGen(IntelGPUType type) {
+ switch (type) {
+ case IntelGPUType::kIceLake:
+ return 11;
+ case IntelGPUType::kRocketLake: // fall through
+ case IntelGPUType::kTigerLake: // fall through
+ case IntelGPUType::kAlderLake:
+ return 12;
+ case IntelGPUType::kOther:
+ // For now all our workaround checks are in the form of "if gen > some_value". So
+ // we can return 0 for kOther which means we won't put in the new workaround for
+ // older gens which is fine. If we stay on top of adding support for new gen
+ // intel devices we shouldn't hit cases where we'd need to change this pattern.
+ return 0;
+ }
+ SkUNREACHABLE;
+ }
+
void init(const GrContextOptions& contextOptions, const GrVkInterface* vkInterface,
VkPhysicalDevice device, const VkPhysicalDeviceFeatures2&,
uint32_t physicalDeviceVersion, const GrVkExtensions&, GrProtected isProtected);
diff --git a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkGpu.cpp b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkGpu.cpp
index 70fbb5b2ad5..4822a643a43 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkGpu.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkGpu.cpp
@@ -536,6 +536,55 @@ bool GrVkGpu::onWritePixels(GrSurface* surface,
return success;
}
+// If dst is a vertex/index buffer then this functions inserts a mem barrier for that use case.
+// Otherwise, does nothing.
+static void add_dst_buffer_mem_barrier(GrVkGpu* gpu, GrVkBuffer* dst, size_t offset, size_t size) {
+ if (dst->intendedType() != GrGpuBufferType::kIndex &&
+ dst->intendedType() != GrGpuBufferType::kVertex) {
+ return;
+ }
+ VkAccessFlags dstAccessMask = dst->intendedType() == GrGpuBufferType::kIndex
+ ? VK_ACCESS_INDEX_READ_BIT
+ : VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT;
+ VkBufferMemoryBarrier bufferMemoryBarrier = {
+ VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER, // sType
+ nullptr, // pNext
+ VK_ACCESS_TRANSFER_WRITE_BIT, // srcAccessMask
+ dstAccessMask, // dstAccessMask
+ VK_QUEUE_FAMILY_IGNORED, // srcQueueFamilyIndex
+ VK_QUEUE_FAMILY_IGNORED, // dstQueueFamilyIndex
+ dst->vkBuffer(), // buffer
+ offset, // offset
+ size, // size
+ };
+
+ gpu->addBufferMemoryBarrier(VK_PIPELINE_STAGE_TRANSFER_BIT,
+ VK_PIPELINE_STAGE_VERTEX_INPUT_BIT,
+ /*byRegion=*/false,
+ &bufferMemoryBarrier);
+
+}
+
+bool GrVkGpu::onTransferFromBufferToBuffer(sk_sp<GrGpuBuffer> src,
+ size_t srcOffset,
+ sk_sp<GrGpuBuffer> dst,
+ size_t dstOffset,
+ size_t size) {
+ if (!this->currentCommandBuffer()) {
+ return false;
+ }
+
+ VkBufferCopy copyRegion;
+ copyRegion.srcOffset = srcOffset;
+ copyRegion.dstOffset = dstOffset;
+ copyRegion.size = size;
+ this->currentCommandBuffer()->copyBuffer(this, std::move(src), dst, 1, &copyRegion);
+
+ add_dst_buffer_mem_barrier(this, static_cast<GrVkBuffer*>(dst.get()), dstOffset, size);
+
+ return true;
+}
+
bool GrVkGpu::onTransferPixelsTo(GrTexture* texture,
SkIRect rect,
GrColorType surfaceColorType,
@@ -1137,29 +1186,15 @@ sk_sp<GrTexture> GrVkGpu::onCreateCompressedTexture(SkISize dimensions,
////////////////////////////////////////////////////////////////////////////////
-void GrVkGpu::copyBuffer(sk_sp<GrGpuBuffer> srcBuffer,
- sk_sp<GrGpuBuffer> dstBuffer,
- VkDeviceSize srcOffset,
- VkDeviceSize dstOffset,
- VkDeviceSize size) {
- if (!this->currentCommandBuffer()) {
- return;
- }
- VkBufferCopy copyRegion;
- copyRegion.srcOffset = srcOffset;
- copyRegion.dstOffset = dstOffset;
- copyRegion.size = size;
- this->currentCommandBuffer()->copyBuffer(this, std::move(srcBuffer), std::move(dstBuffer), 1,
- &copyRegion);
-}
-
bool GrVkGpu::updateBuffer(sk_sp<GrVkBuffer> buffer, const void* src,
VkDeviceSize offset, VkDeviceSize size) {
if (!this->currentCommandBuffer()) {
return false;
}
// Update the buffer
- this->currentCommandBuffer()->updateBuffer(this, std::move(buffer), offset, size, src);
+ this->currentCommandBuffer()->updateBuffer(this, buffer, offset, size, src);
+
+ add_dst_buffer_mem_barrier(this, static_cast<GrVkBuffer*>(buffer.get()), offset, size);
return true;
}
@@ -1825,6 +1860,7 @@ bool GrVkGpu::setBackendSurfaceState(GrVkImageInfo info,
GrVkImage::UsageFlags::kColorAttachment,
kBorrow_GrWrapOwnership,
GrWrapCacheable::kNo,
+ "VkGpu_SetBackendSurfaceState",
/*forSecondaryCB=*/false);
SkASSERT(texture);
if (!texture) {
diff --git a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkGpu.h b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkGpu.h
index 44bd21dda97..b1f25229b41 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkGpu.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkGpu.h
@@ -174,8 +174,6 @@ public:
std::unique_ptr<GrSemaphore> prepareTextureForCrossContextUsage(GrTexture*) override;
- void copyBuffer(sk_sp<GrGpuBuffer> srcBuffer, sk_sp<GrGpuBuffer> dstBuffer,
- VkDeviceSize srcOffset, VkDeviceSize dstOffset, VkDeviceSize size);
bool updateBuffer(sk_sp<GrVkBuffer> buffer, const void* src, VkDeviceSize offset,
VkDeviceSize size);
@@ -286,6 +284,12 @@ private:
int mipLevelCount,
bool prepForTexSampling) override;
+ bool onTransferFromBufferToBuffer(sk_sp<GrGpuBuffer> src,
+ size_t srcOffset,
+ sk_sp<GrGpuBuffer> dst,
+ size_t dstOffset,
+ size_t size) override;
+
bool onTransferPixelsTo(GrTexture*,
SkIRect,
GrColorType textureColorType,
diff --git a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkImage.cpp b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkImage.cpp
index 1ea2a4c587d..702536a7a67 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkImage.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkImage.cpp
@@ -180,6 +180,7 @@ sk_sp<GrVkImage> GrVkImage::MakeWrapped(GrVkGpu* gpu,
UsageFlags attachmentUsages,
GrWrapOwnership ownership,
GrWrapCacheable cacheable,
+ std::string_view label,
bool forSecondaryCB) {
sk_sp<const GrVkImageView> framebufferView;
sk_sp<const GrVkImageView> textureView;
@@ -203,7 +204,7 @@ sk_sp<GrVkImage> GrVkImage::MakeWrapped(GrVkGpu* gpu,
backendOwnership,
cacheable,
forSecondaryCB,
- /*label=*/"VkImageMakeWrapped"));
+ label));
}
GrVkImage::GrVkImage(GrVkGpu* gpu,
diff --git a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkImage.h b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkImage.h
index f2a198ba615..e33b8a8f26b 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkImage.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkImage.h
@@ -58,6 +58,7 @@ public:
UsageFlags attachmentUsages,
GrWrapOwnership,
GrWrapCacheable,
+ std::string_view label,
bool forSecondaryCB = false);
~GrVkImage() override;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkMSAALoadManager.cpp b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkMSAALoadManager.cpp
index 346f985999c..e853de50618 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkMSAALoadManager.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkMSAALoadManager.cpp
@@ -53,7 +53,7 @@ bool GrVkMSAALoadManager::createMSAALoadProgram(GrVkGpu* gpu) {
"sk_FragColor = subpassLoad(uInput);"
"}");
- SkSL::Program::Settings settings;
+ SkSL::ProgramSettings settings;
std::string spirv;
SkSL::Program::Inputs inputs;
if (!GrCompileVkShaderModule(gpu, vertShaderText, VK_SHADER_STAGE_VERTEX_BIT,
diff --git a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkPipeline.cpp b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkPipeline.cpp
index d04ae0f0bfe..86bf5f20c03 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkPipeline.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkPipeline.cpp
@@ -178,7 +178,7 @@ static VkStencilOp stencil_op_to_vk_stencil_op(GrStencilOp op) {
VK_STENCIL_OP_INCREMENT_AND_CLAMP, // kIncClamp
VK_STENCIL_OP_DECREMENT_AND_CLAMP, // kDecClamp
};
- static_assert(SK_ARRAY_COUNT(gTable) == kGrStencilOpCount);
+ static_assert(std::size(gTable) == kGrStencilOpCount);
static_assert(0 == (int)GrStencilOp::kKeep);
static_assert(1 == (int)GrStencilOp::kZero);
static_assert(2 == (int)GrStencilOp::kReplace);
@@ -202,7 +202,7 @@ static VkCompareOp stencil_func_to_vk_compare_op(GrStencilTest test) {
VK_COMPARE_OP_EQUAL, // kEqual
VK_COMPARE_OP_NOT_EQUAL, // kNotEqual
};
- static_assert(SK_ARRAY_COUNT(gTable) == kGrStencilTestCount);
+ static_assert(std::size(gTable) == kGrStencilTestCount);
static_assert(0 == (int)GrStencilTest::kAlways);
static_assert(1 == (int)GrStencilTest::kNever);
static_assert(2 == (int)GrStencilTest::kGreater);
@@ -371,7 +371,7 @@ static VkBlendOp blend_equation_to_vk_blend_op(skgpu::BlendEquation equation) {
static_assert(15 == (int)skgpu::BlendEquation::kHSLSaturation);
static_assert(16 == (int)skgpu::BlendEquation::kHSLColor);
static_assert(17 == (int)skgpu::BlendEquation::kHSLLuminosity);
- static_assert(SK_ARRAY_COUNT(gTable) == skgpu::kBlendEquationCnt);
+ static_assert(std::size(gTable) == skgpu::kBlendEquationCnt);
SkASSERT((unsigned)equation < skgpu::kBlendEquationCnt);
return gTable[(int)equation];
diff --git a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkPipelineStateBuilder.cpp b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkPipelineStateBuilder.cpp
index 54bc7f857a1..342384e1060 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkPipelineStateBuilder.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkPipelineStateBuilder.cpp
@@ -75,7 +75,7 @@ bool GrVkPipelineStateBuilder::createVkShaderModule(VkShaderStageFlagBits stage,
const std::string& sksl,
VkShaderModule* shaderModule,
VkPipelineShaderStageCreateInfo* stageInfo,
- const SkSL::Program::Settings& settings,
+ const SkSL::ProgramSettings& settings,
std::string* outSPIRV,
SkSL::Program::Inputs* outInputs) {
if (!GrCompileVkShaderModule(fGpu, sksl, stage, shaderModule,
@@ -186,7 +186,7 @@ GrVkPipelineState* GrVkPipelineStateBuilder::finalize(const GrProgramDesc& desc,
bool usePushConstants = fUniformHandler.usePushConstants();
VkPipelineShaderStageCreateInfo shaderStageInfo[3];
- SkSL::Program::Settings settings;
+ SkSL::ProgramSettings settings;
settings.fRTFlipBinding = this->gpu()->vkCaps().getFragmentUniformBinding();
settings.fRTFlipSet = this->gpu()->vkCaps().getFragmentUniformSet();
settings.fSharpenTextures = true;
@@ -279,6 +279,10 @@ GrVkPipelineState* GrVkPipelineStateBuilder::finalize(const GrProgramDesc& desc,
}
}
+ // The vulkan spec says that if a subpass has an input attachment, then the input attachment
+ // descriptor set must be bound to all pipelines in that subpass. This includes pipelines that
+ // don't actually use the input attachment. Thus we look at the renderPassBarriers and not just
+ // the DstProxyView barrier flags to determine if we use the input attachment.
bool usesInput = SkToBool(fProgramInfo.renderPassBarriers() & GrXferBarrierFlags::kTexture);
uint32_t layoutCount =
usesInput ? GrVkUniformHandler::kDescSetCount : (GrVkUniformHandler::kDescSetCount - 1);
diff --git a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkPipelineStateBuilder.h b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkPipelineStateBuilder.h
index 19aafaa0f18..bab6e1b97a6 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkPipelineStateBuilder.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkPipelineStateBuilder.h
@@ -15,6 +15,7 @@
#include "src/gpu/ganesh/vk/GrVkUniformHandler.h"
#include "src/gpu/ganesh/vk/GrVkVaryingHandler.h"
#include "src/sksl/SkSLCompiler.h"
+#include "src/sksl/ir/SkSLProgram.h"
class GrProgramDesc;
class GrVkGpu;
@@ -61,7 +62,7 @@ private:
const std::string& sksl,
VkShaderModule* shaderModule,
VkPipelineShaderStageCreateInfo* stageInfo,
- const SkSL::Program::Settings& settings,
+ const SkSL::ProgramSettings& settings,
std::string* outSPIRV,
SkSL::Program::Inputs* outInputs);
diff --git a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkRenderTarget.cpp b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkRenderTarget.cpp
index 0744e0ee12a..27100369188 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkRenderTarget.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkRenderTarget.cpp
@@ -146,7 +146,8 @@ sk_sp<GrVkRenderTarget> GrVkRenderTarget::MakeWrappedRenderTarget(
std::move(mutableState),
GrAttachment::UsageFlags::kColorAttachment,
kBorrow_GrWrapOwnership,
- GrWrapCacheable::kNo);
+ GrWrapCacheable::kNo,
+ /*label=*/"VkImage_WrappedAttachment");
if (!wrappedAttachment) {
return nullptr;
}
@@ -198,6 +199,7 @@ sk_sp<GrVkRenderTarget> GrVkRenderTarget::MakeSecondaryCBRenderTarget(
GrAttachment::UsageFlags::kColorAttachment,
kBorrow_GrWrapOwnership,
GrWrapCacheable::kNo,
+ "VkImage_ColorAttachment",
true);
std::unique_ptr<GrVkSecondaryCommandBuffer> scb(
diff --git a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkSecondaryCBDrawContext.cpp b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkSecondaryCBDrawContext.cpp
index 949058cb841..fa40ecb1b4d 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkSecondaryCBDrawContext.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkSecondaryCBDrawContext.cpp
@@ -47,7 +47,7 @@ sk_sp<GrVkSecondaryCBDrawContext> GrVkSecondaryCBDrawContext::Make(GrRecordingCo
imageInfo.refColorSpace(),
kTopLeft_GrSurfaceOrigin,
SkSurfacePropsCopyOrDefault(props),
- skgpu::BaseDevice::InitContents::kUninit);
+ skgpu::v1::Device::InitContents::kUninit);
if (!device) {
return nullptr;
}
@@ -56,7 +56,7 @@ sk_sp<GrVkSecondaryCBDrawContext> GrVkSecondaryCBDrawContext::Make(GrRecordingCo
props));
}
-GrVkSecondaryCBDrawContext::GrVkSecondaryCBDrawContext(sk_sp<skgpu::BaseDevice> device,
+GrVkSecondaryCBDrawContext::GrVkSecondaryCBDrawContext(sk_sp<skgpu::v1::Device> device,
const SkSurfaceProps* props)
: fDevice(device)
, fProps(SkSurfacePropsCopyOrDefault(props)) {}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkSecondaryCBDrawContext_impl.h b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkSecondaryCBDrawContext_impl.h
index 48b8b3810ac..5cca04fc1b7 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkSecondaryCBDrawContext_impl.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkSecondaryCBDrawContext_impl.h
@@ -15,7 +15,7 @@
class GrBackendSemaphore;
class GrRecordingContext;
struct GrVkDrawableInfo;
-namespace skgpu { class BaseDevice; }
+namespace skgpu::v1 { class Device; }
class SkCanvas;
class SkDeferredDisplayList;
struct SkImageInfo;
@@ -114,9 +114,9 @@ public:
bool isCompatible(const SkSurfaceCharacterization& characterization) const;
private:
- explicit GrVkSecondaryCBDrawContext(sk_sp<skgpu::BaseDevice>, const SkSurfaceProps*);
+ explicit GrVkSecondaryCBDrawContext(sk_sp<skgpu::v1::Device>, const SkSurfaceProps*);
- sk_sp<skgpu::BaseDevice> fDevice;
+ sk_sp<skgpu::v1::Device> fDevice;
std::unique_ptr<SkCanvas> fCachedCanvas;
const SkSurfaceProps fProps;
diff --git a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkTexture.cpp b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkTexture.cpp
index 482a0db6a88..8fe1e35564f 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkTexture.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkTexture.cpp
@@ -133,7 +133,8 @@ sk_sp<GrVkTexture> GrVkTexture::MakeWrappedTexture(
std::move(mutableState),
GrAttachment::UsageFlags::kTexture,
wrapOwnership,
- cacheable);
+ cacheable,
+ "VkImage_MakeWrappedTexture");
if (!texture) {
return nullptr;
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkTextureRenderTarget.cpp b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkTextureRenderTarget.cpp
index 3ce0480b962..46ee2d441af 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkTextureRenderTarget.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkTextureRenderTarget.cpp
@@ -142,7 +142,8 @@ sk_sp<GrVkTextureRenderTarget> GrVkTextureRenderTarget::MakeWrappedTextureRender
std::move(mutableState),
textureUsageFlags,
wrapOwnership,
- cacheable);
+ cacheable,
+ "VkImage_MakeWrappedTextureRenderTarget");
if (!texture) {
return nullptr;
}
diff --git a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkUtil.cpp b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkUtil.cpp
index 7c532a3b436..49a9c0384e8 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkUtil.cpp
+++ b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkUtil.cpp
@@ -88,7 +88,7 @@ bool GrCompileVkShaderModule(GrVkGpu* gpu,
VkShaderStageFlagBits stage,
VkShaderModule* shaderModule,
VkPipelineShaderStageCreateInfo* stageInfo,
- const SkSL::Program::Settings& settings,
+ const SkSL::ProgramSettings& settings,
std::string* outSPIRV,
SkSL::Program::Inputs* outInputs) {
TRACE_EVENT0("skia.shaders", "CompileVkShaderModule");
diff --git a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkUtil.h b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkUtil.h
index f2646be7165..5a63d7db347 100644
--- a/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkUtil.h
+++ b/chromium/third_party/skia/src/gpu/ganesh/vk/GrVkUtil.h
@@ -182,7 +182,7 @@ bool GrCompileVkShaderModule(GrVkGpu* gpu,
VkShaderStageFlagBits stage,
VkShaderModule* shaderModule,
VkPipelineShaderStageCreateInfo* stageInfo,
- const SkSL::Program::Settings& settings,
+ const SkSL::ProgramSettings& settings,
std::string* outSPIRV,
SkSL::Program::Inputs* outInputs);
diff --git a/chromium/third_party/skia/src/gpu/graphite/AttachmentTypes.h b/chromium/third_party/skia/src/gpu/graphite/AttachmentTypes.h
new file mode 100644
index 00000000000..381032c7430
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/AttachmentTypes.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef skgpu_graphite_AttachmentTypes_DEFINED
+#define skgpu_graphite_AttachmentTypes_DEFINED
+
+#include "include/gpu/graphite/GraphiteTypes.h"
+#include "include/gpu/graphite/TextureInfo.h"
+
+#include <array>
+
+namespace skgpu::graphite {
+
+/**
+ * This enum is used to specify the load operation to be used when a RenderPass begins execution
+ */
+enum class LoadOp : uint8_t {
+ kLoad,
+ kClear,
+ kDiscard,
+
+ kLast = kDiscard
+};
+inline static constexpr int kLoadOpCount = (int)(LoadOp::kLast) + 1;
+
+/**
+ * This enum is used to specify the store operation to be used when a RenderPass ends execution.
+ */
+enum class StoreOp : uint8_t {
+ kStore,
+ kDiscard,
+
+ kLast = kDiscard
+};
+inline static constexpr int kStoreOpCount = (int)(StoreOp::kLast) + 1;
+
+struct AttachmentDesc {
+ TextureInfo fTextureInfo;
+ LoadOp fLoadOp;
+ StoreOp fStoreOp;
+};
+
+struct RenderPassDesc {
+ AttachmentDesc fColorAttachment;
+ std::array<float, 4> fClearColor;
+ AttachmentDesc fColorResolveAttachment;
+
+ AttachmentDesc fDepthStencilAttachment;
+ float fClearDepth;
+ uint32_t fClearStencil;
+
+ // TODO:
+ // * bounds (TBD whether exact bounds vs. granular)
+ // * input attachments
+};
+
+}; // namespace skgpu::graphite
+
+#endif // skgpu_graphite_AttachmentTypes_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/graphite/Buffer.h b/chromium/third_party/skia/src/gpu/graphite/Buffer.h
index 7f5bf6f3a32..aee8485c5cf 100644
--- a/chromium/third_party/skia/src/gpu/graphite/Buffer.h
+++ b/chromium/third_party/skia/src/gpu/graphite/Buffer.h
@@ -23,8 +23,11 @@ public:
bool isMapped() const { return fMapPtr; }
protected:
- Buffer(const Gpu* gpu, size_t size, BufferType type, PrioritizeGpuReads prioritizeGpuReads)
- : Resource(gpu, Ownership::kOwned, SkBudgeted::kYes)
+ Buffer(const SharedContext* sharedContext,
+ size_t size,
+ BufferType type,
+ PrioritizeGpuReads prioritizeGpuReads)
+ : Resource(sharedContext, Ownership::kOwned, SkBudgeted::kYes)
, fSize(size)
, fType(type)
, fPrioritizeGpuReads(prioritizeGpuReads) {}
diff --git a/chromium/third_party/skia/src/gpu/graphite/Caps.cpp b/chromium/third_party/skia/src/gpu/graphite/Caps.cpp
index cb54d072d5f..bd2c0cb5f0c 100644
--- a/chromium/third_party/skia/src/gpu/graphite/Caps.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/Caps.cpp
@@ -7,18 +7,41 @@
#include "src/gpu/graphite/Caps.h"
+#include "include/core/SkCapabilities.h"
+#include "include/gpu/ShaderErrorHandler.h"
+#include "include/gpu/graphite/ContextOptions.h"
#include "include/gpu/graphite/TextureInfo.h"
#include "src/sksl/SkSLUtil.h"
namespace skgpu::graphite {
-Caps::Caps() : fShaderCaps(std::make_unique<SkSL::ShaderCaps>()) {}
+Caps::Caps()
+ : fShaderCaps(std::make_unique<SkSL::ShaderCaps>())
+ , fCapabilities(new SkCapabilities()) {}
+
Caps::~Caps() {}
-void Caps::finishInitialization() {
- this->initSkCaps(fShaderCaps.get());
+void Caps::finishInitialization(const ContextOptions& options) {
+ fCapabilities->initSkCaps(fShaderCaps.get());
+
+ if (options.fShaderErrorHandler) {
+ fShaderErrorHandler = options.fShaderErrorHandler;
+ } else {
+ fShaderErrorHandler = DefaultShaderErrorHandler();
+ }
+
+#if GRAPHITE_TEST_UTILS
+ fMaxTextureAtlasSize = options.fMaxTextureAtlasSize;
+#endif
+ fGlyphCacheTextureMaximumBytes = options.fGlyphCacheTextureMaximumBytes;
+ fMinDistanceFieldFontSize = options.fMinDistanceFieldFontSize;
+ fGlyphsAsPathsFontSize = options.fGlyphsAsPathsFontSize;
+ fAllowMultipleGlyphCacheTextures = options.fAllowMultipleGlyphCacheTextures;
+ fSupportBilerpFromGlyphAtlas = options.fSupportBilerpFromGlyphAtlas;
}
+sk_sp<SkCapabilities> Caps::capabilities() const { return fCapabilities; }
+
bool Caps::isTexturable(const TextureInfo& info) const {
if (info.numSamples() > 1) {
return false;
diff --git a/chromium/third_party/skia/src/gpu/graphite/Caps.h b/chromium/third_party/skia/src/gpu/graphite/Caps.h
index f8f6c0ab34a..455196d8263 100644
--- a/chromium/third_party/skia/src/gpu/graphite/Caps.h
+++ b/chromium/third_party/skia/src/gpu/graphite/Caps.h
@@ -8,7 +8,6 @@
#ifndef skgpu_graphite_Caps_DEFINED
#define skgpu_graphite_Caps_DEFINED
-#include "include/core/SkCapabilities.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkRefCnt.h"
#include "src/core/SkEnumBitMask.h"
@@ -16,23 +15,29 @@
#include "src/gpu/Swizzle.h"
#include "src/gpu/graphite/ResourceTypes.h"
-namespace SkSL {
-struct ShaderCaps;
-}
+class SkCapabilities;
+
+namespace SkSL { struct ShaderCaps; }
+
+namespace skgpu { class ShaderErrorHandler; }
namespace skgpu::graphite {
+struct ContextOptions;
+class ComputePipelineDesc;
class GraphicsPipelineDesc;
class GraphiteResourceKey;
struct RenderPassDesc;
class TextureInfo;
-class Caps : public SkCapabilities {
+class Caps : public SkRefCnt {
public:
~Caps() override;
const SkSL::ShaderCaps* shaderCaps() const { return fShaderCaps.get(); }
+ sk_sp<SkCapabilities> capabilities() const;
+
virtual TextureInfo getDefaultSampledTextureInfo(SkColorType,
uint32_t levelCount,
Protected,
@@ -46,6 +51,7 @@ public:
virtual UniqueKey makeGraphicsPipelineKey(const GraphicsPipelineDesc&,
const RenderPassDesc&) const = 0;
+ virtual UniqueKey makeComputePipelineKey(const ComputePipelineDesc&) const = 0;
bool areColorTypeAndTextureInfoCompatible(SkColorType, const TextureInfo&) const;
@@ -64,6 +70,10 @@ public:
// to a draw.
size_t requiredUniformBufferAlignment() const { return fRequiredUniformBufferAlignment; }
+ // Returns the required alignment in bytes for the offset into a storage buffer when binding it
+ // to a draw.
+ size_t requiredStorageBufferAlignment() const { return fRequiredStorageBufferAlignment; }
+
// Returns the alignment in bytes for the offset into a Buffer when using it
// to transfer to or from a Texture with the given bytes per pixel.
virtual size_t getTransferBufferAlignment(size_t bytesPerPixel) const = 0;
@@ -78,12 +88,22 @@ public:
// SkColorType and TextureInfo.
skgpu::Swizzle getWriteSwizzle(SkColorType, const TextureInfo&) const;
+ skgpu::ShaderErrorHandler* shaderErrorHandler() const { return fShaderErrorHandler; }
+
+ float minDistanceFieldFontSize() const { return fMinDistanceFieldFontSize; }
+ float glyphsAsPathsFontSize() const { return fGlyphsAsPathsFontSize; }
+
+ size_t glyphCacheTextureMaximumBytes() const { return fGlyphCacheTextureMaximumBytes; }
+
+ bool allowMultipleGlyphCacheTextures() const { return fAllowMultipleGlyphCacheTextures; }
+ bool supportBilerpFromGlyphAtlas() const { return fSupportBilerpFromGlyphAtlas; }
+
protected:
Caps();
// Subclasses must call this at the end of their init method in order to do final processing on
// the caps.
- void finishInitialization();
+ void finishInitialization(const ContextOptions&);
// TODO: This value should be set by some context option. For now just making it 4.
uint32_t defaultMSAASamples() const { return 4; }
@@ -106,14 +126,37 @@ protected:
int fMaxTextureSize = 0;
size_t fRequiredUniformBufferAlignment = 0;
+ size_t fRequiredStorageBufferAlignment = 0;
std::unique_ptr<SkSL::ShaderCaps> fShaderCaps;
bool fClampToBorderSupport = true;
+ //////////////////////////////////////////////////////////////////////////////////////////
+ // Client-provided Caps
+
+ /**
+ * If present, use this object to report shader compilation failures. If not, report failures
+ * via SkDebugf and assert.
+ */
+ ShaderErrorHandler* fShaderErrorHandler = nullptr;
+
+#if GRAPHITE_TEST_UTILS
+ int fMaxTextureAtlasSize = 2048;
+#endif
+ size_t fGlyphCacheTextureMaximumBytes = 2048 * 1024 * 4;
+
+ float fMinDistanceFieldFontSize = 18;
+ float fGlyphsAsPathsFontSize = 324;
+
+ bool fAllowMultipleGlyphCacheTextures = true;
+ bool fSupportBilerpFromGlyphAtlas = false;
+
private:
virtual bool onIsTexturable(const TextureInfo&) const = 0;
virtual const ColorTypeInfo* getColorTypeInfo(SkColorType, const TextureInfo&) const = 0;
+
+ sk_sp<SkCapabilities> fCapabilities;
};
} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/ClipStack.cpp b/chromium/third_party/skia/src/gpu/graphite/ClipStack.cpp
index 34318a9ea55..654440aba85 100644
--- a/chromium/third_party/skia/src/gpu/graphite/ClipStack.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/ClipStack.cpp
@@ -16,8 +16,9 @@
#include "src/core/SkRectPriv.h"
#include "src/core/SkTLazy.h"
#include "src/gpu/graphite/Device.h"
-#include "src/gpu/graphite/DrawGeometry.h"
+#include "src/gpu/graphite/DrawParams.h"
#include "src/gpu/graphite/geom/BoundsManager.h"
+#include "src/gpu/graphite/geom/Geometry.h"
namespace skgpu::graphite {
@@ -35,6 +36,51 @@ Rect subtract(const Rect& a, const Rect& b, bool exact) {
}
}
+bool oriented_bbox_intersection(const Rect& a, const Transform& aXform,
+ const Rect& b, const Transform& bXform) {
+ // NOTE: We intentionally exclude projected bounds for two reasons:
+ // 1. We can skip the division by w and worring about clipping to w = 0.
+ // 2. W/o the projective case, the separating axes are simpler to compute (see below).
+ SkASSERT(aXform.type() != Transform::Type::kProjection &&
+ bXform.type() != Transform::Type::kProjection);
+ SkV4 quadA[4], quadB[4];
+
+ aXform.mapPoints(a, quadA);
+ bXform.mapPoints(b, quadB);
+
+ // There are 4 separating axes, defined by the two normals from quadA and from quadB, but
+ // since they were produced by transforming a rectangle by an affine transform, we know the
+ // normals are orthoganal to the basis vectors of upper 2x2 of their two transforms.
+ auto axesX = skvx::float4(-aXform.matrix().rc(1,0), -aXform.matrix().rc(1,1),
+ -bXform.matrix().rc(1,0), -bXform.matrix().rc(1,1));
+ auto axesY = skvx::float4(aXform.matrix().rc(0,0), aXform.matrix().rc(0,1),
+ bXform.matrix().rc(0,0), bXform.matrix().rc(0,1));
+
+ // Projections of the 4 corners of each quadrilateral vs. the 4 axes. For orthonormal
+ // transforms, the projections of a quad's corners to its own normal axes should work out
+ // to the original dimensions of the rectangle, but this code handles skew and scale factors
+ // without branching.
+ auto aProj0 = quadA[0].x * axesX + quadA[0].y * axesY;
+ auto aProj1 = quadA[1].x * axesX + quadA[1].y * axesY;
+ auto aProj2 = quadA[2].x * axesX + quadA[2].y * axesY;
+ auto aProj3 = quadA[3].x * axesX + quadA[3].y * axesY;
+
+ auto bProj0 = quadB[0].x * axesX + quadB[0].y * axesY;
+ auto bProj1 = quadB[1].x * axesX + quadB[1].y * axesY;
+ auto bProj2 = quadB[2].x * axesX + quadB[2].y * axesY;
+ auto bProj3 = quadB[3].x * axesX + quadB[3].y * axesY;
+
+ // Minimum and maximum projected values against the 4 axes, for both quadA and quadB, which
+ // gives us four pairs of intervals to test for separation.
+ auto minA = min(min(aProj0, aProj1), min(aProj2, aProj3));
+ auto maxA = max(max(aProj0, aProj1), max(aProj2, aProj3));
+ auto minB = min(min(bProj0, bProj1), min(bProj2, bProj3));
+ auto maxB = max(max(bProj0, bProj1), max(bProj2, bProj3));
+
+ auto overlaps = (minB <= maxA) & (minA <= maxB);
+ return all(overlaps); // any non-overlapping interval would imply no intersection
+}
+
static const Transform kIdentity{SkM44()};
} // anonymous namespace
@@ -69,45 +115,32 @@ bool ClipStack::TransformedShape::intersects(const TransformedShape& o) const {
if (!fOuterBounds.intersects(o.fOuterBounds)) {
return false;
}
- if (fLocalToDevice == o.fLocalToDevice) {
+
+ if (fLocalToDevice.type() <= Transform::Type::kRectStaysRect &&
+ o.fLocalToDevice.type() <= Transform::Type::kRectStaysRect) {
+ // The two shape's coordinate spaces are different but both rect-stays-rect or simpler.
+ // This means, though, that their outer bounds approximations are tight to their transormed
+ // shape bounds. There's no point to do further tests given that and that we already found
+ // that these outer bounds *do* intersect.
+ return true;
+ } else if (fLocalToDevice == o.fLocalToDevice) {
// Since the two shape's local coordinate spaces are the same, we can compare shape
// bounds directly for a more accurate intersection test. We intentionally do not go
// further and do shape-specific intersection tests since these could have unknown
// complexity (for paths) and limited utility (e.g. two round rects that are disjoint
// solely from their corner curves).
return fShape.bounds().intersects(o.fShape.bounds());
- } else if (fLocalToDevice.type() > Transform::Type::kRectStaysRect ||
- o.fLocalToDevice.type() > Transform::Type::kRectStaysRect) {
+ } else if (fLocalToDevice.type() != Transform::Type::kProjection &&
+ o.fLocalToDevice.type() != Transform::Type::kProjection) {
// The shapes don't share the same coordinate system, and their approximate 'outer'
// bounds in device space could have substantial outsetting to contain the transformed
- // shape (e.g. 45 degree rotation). This makes it worth mapping the corners of o'
- // into this shape's local space for a more accurate test.
- Rect bounds = fShape.bounds();
- SkV4 deviceQuad[4];
- o.fLocalToDevice.mapPoints(o.fShape.bounds(), deviceQuad);
- SkV4 localQuad[4];
- fLocalToDevice.inverseMapPoints(deviceQuad, localQuad, 4);
- for (int i = 0; i < 4; ++i) {
- // TODO: Would be nice to make this consistent with how the GPU clips NDC w.
- if (deviceQuad[i].w < SkPathPriv::kW0PlaneDistance ||
- localQuad[i].w < SkPathPriv::kW0PlaneDistance) {
- // Something in 'o' actually projects behind the W = 0 plane and would be
- // clipped to infinity, so pessimistically assume that they could intersect.
- return true;
- }
- if (bounds.contains(Rect::Point(skvx::float2::Load(localQuad + i) / localQuad[i].w))) {
- // If any corner of 'o's bounds are contained then it intersects our bounds
- return true;
- }
- }
- // Else no corners of 'o's bounds are inside our bounds, so no intersection
- return false;
+ // shape (e.g. 45 degree rotation). Perform a more detailed check on their oriented
+ // bounding boxes.
+ return oriented_bbox_intersection(fShape.bounds(), fLocalToDevice,
+ o.fShape.bounds(), o.fLocalToDevice);
}
-
- // Else the two shape's coordinate spaces are different but both rect-stays-rect or simpler.
- // This means, though, that their outer bounds approximations are tight to their transormed
- // shape bounds. There's no point to do further tests given that and that we already found
- // that these outer bounds *do* intersect.
+ // Else multiple perspective transforms are involved, so assume intersection and allow the
+ // rasterizer to handle perspective clipping.
return true;
}
@@ -115,6 +148,13 @@ bool ClipStack::TransformedShape::contains(const TransformedShape& o) const {
if (fInnerBounds.contains(o.fOuterBounds)) {
return true;
}
+ // Skip more expensive contains() checks if configured not to, or if the extent of 'o' exceeds
+ // this shape's outer bounds. When that happens there must be some part of 'o' that cannot be
+ // contained in this shape.
+ if (fContainsChecksOnlyBounds || !fOuterBounds.contains(o.fOuterBounds)) {
+ return false;
+ }
+
if (fContainsChecksOnlyBounds) {
return false; // don't do any more work
}
@@ -265,7 +305,7 @@ ClipStack::RawElement::RawElement(const Rect& deviceBounds,
// Apply rect-stays-rect transforms to rects and round rects to reduce the number of unique
// local coordinate systems that are in play.
if (!fOuterBounds.isEmptyNegativeOrNaN() &&
- fLocalToDevice.type() == Transform::Type::kRectStaysRect) {
+ fLocalToDevice.type() <= Transform::Type::kRectStaysRect) {
if (fShape.isRect()) {
// The actual geometry can be updated to the device-intersected bounds and we know the
// inner bounds are equal to the outer.
@@ -322,17 +362,16 @@ void ClipStack::RawElement::drawClip(Device* device) {
if (!drawBounds.isEmptyNegativeOrNaN()) {
// Although we are recording this clip draw after all the draws it affects, 'fOrder' was
// determined at the first usage, so after sorting by DrawOrder the clip draw will be in the
- // right place. Unlike regular draws that use their own "Z", by writing the max Z this clip
- // affects, it will cause those draws to fail depth tests where they need to be clipped.
- DrawOrder order{fMaxZ, fOrder};
+ // right place. Unlike regular draws that use their own "Z", by writing (1 + max Z this clip
+ // affects), it will cause those draws to fail either GREATER and GEQUAL depth tests where
+ // they need to be clipped.
+ DrawOrder order{fMaxZ.next(), fOrder};
// An element's clip op is encoded in the shape's fill type. Inverse fills are intersect ops
// and regular fills are difference ops. This means fShape is already in the right state to
// draw directly.
SkASSERT((fOp == SkClipOp::kDifference && !fShape.inverted()) ||
(fOp == SkClipOp::kIntersect && fShape.inverted()));
- // A null paint implies depth-only rendering, a null stroke style implies fill.
- device->recordDraw(fLocalToDevice, fShape, Clip{drawBounds, scissor.asSkIRect()}, order,
- /*paint=*/nullptr, /*stroke=*/nullptr);
+ device->drawClipShape(fLocalToDevice, fShape, Clip{drawBounds, scissor.asSkIRect()}, order);
}
// After the clip shape is drawn, reset its state. If the clip element is being popped off the
@@ -1039,7 +1078,7 @@ void ClipStack::clipShape(const Transform& localToDevice,
std::pair<Clip, CompressedPaintersOrder> ClipStack::applyClipToDraw(
const BoundsManager* boundsManager,
const Transform& localToDevice,
- const Shape& shape,
+ const Geometry& geometry,
const SkStrokeRec& style,
PaintersDepth z) {
const SaveRecord& cs = this->currentSaveRecord();
@@ -1053,14 +1092,23 @@ std::pair<Clip, CompressedPaintersOrder> ClipStack::applyClipToDraw(
// When 'style' isn't fill, 'shape' describes the pre-stroke shape so we can't use it to check
// against clip elements and this will be set to the bounds of the post-stroked shape instead.
- SkTCopyOnFirstWrite<Shape> styledShape{shape};
- Rect drawBounds = shape.bounds();
- if (shape.inverted()) {
+ SkTCopyOnFirstWrite<Shape> styledShape;
+ if (geometry.isShape()) {
+ styledShape.init(geometry.shape());
+ } else {
+ // The geometry is something special like text or vertices, in which case it's definitely
+ // not a shape that could simplify cleanly with the clip stack.
+ styledShape.initIfNeeded(geometry.bounds());
+ }
+
+ Rect drawBounds; // defined in device space
+ if (styledShape->inverted()) {
// Inverse-filled shapes always fill the entire device (restricted to the clip).
drawBounds = deviceBounds;
styledShape.writable()->setRect(drawBounds);
} else {
// Regular filled shapes and strokes get larger based on style and transform
+ drawBounds = styledShape->bounds();
if (!style.isHairlineStyle()) {
float localStyleOutset = style.getInflationRadius();
drawBounds.outset(localStyleOutset);
@@ -1080,9 +1128,11 @@ std::pair<Clip, CompressedPaintersOrder> ClipStack::applyClipToDraw(
// localToDevice already.
styledShape.writable()->setRect(drawBounds);
}
+
+ // Restrict bounds to the device limits
+ drawBounds.intersect(deviceBounds);
}
- drawBounds.intersect(deviceBounds);
if (drawBounds.isEmptyNegativeOrNaN() || cs.state() == ClipState::kWideOpen) {
// Either the draw is off screen, so it's clipped out regardless of the state of the
// SaveRecord, or there are no elements to apply to the draw. In both cases, 'drawBounds'
diff --git a/chromium/third_party/skia/src/gpu/graphite/ClipStack_graphite.h b/chromium/third_party/skia/src/gpu/graphite/ClipStack_graphite.h
index f87e5893694..a65ac4f685d 100644
--- a/chromium/third_party/skia/src/gpu/graphite/ClipStack_graphite.h
+++ b/chromium/third_party/skia/src/gpu/graphite/ClipStack_graphite.h
@@ -22,6 +22,7 @@ namespace skgpu::graphite {
class BoundsManager;
class Clip;
class Device;
+class Geometry;
// TODO: Port over many of the unit tests for skgpu/v1/ClipStack defined in GrClipStackTest since
// those tests do a thorough job of enumerating the different element combinations.
@@ -83,7 +84,7 @@ public:
// If the draw is clipped out, the returned draw bounds will be empty.
std::pair<Clip, CompressedPaintersOrder> applyClipToDraw(const BoundsManager*,
const Transform&,
- const Shape&,
+ const Geometry&,
const SkStrokeRec&,
PaintersDepth z);
diff --git a/chromium/third_party/skia/src/gpu/graphite/CommandBuffer.cpp b/chromium/third_party/skia/src/gpu/graphite/CommandBuffer.cpp
index dbefd46ff2d..94c6e150fe4 100644
--- a/chromium/third_party/skia/src/gpu/graphite/CommandBuffer.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/CommandBuffer.cpp
@@ -10,6 +10,7 @@
#include "src/core/SkTraceEvent.h"
#include "src/gpu/RefCntedCallback.h"
#include "src/gpu/graphite/Buffer.h"
+#include "src/gpu/graphite/ComputePipeline.h"
#include "src/gpu/graphite/GraphicsPipeline.h"
#include "src/gpu/graphite/Sampler.h"
#include "src/gpu/graphite/Texture.h"
@@ -46,12 +47,16 @@ void CommandBuffer::callFinishedProcs(bool success) {
fFinishedProcs.reset();
}
-bool CommandBuffer::beginRenderPass(const RenderPassDesc& renderPassDesc,
- sk_sp<Texture> colorTexture,
- sk_sp<Texture> resolveTexture,
- sk_sp<Texture> depthStencilTexture) {
- if (!this->onBeginRenderPass(renderPassDesc, colorTexture.get(), resolveTexture.get(),
- depthStencilTexture.get())) {
+bool CommandBuffer::addRenderPass(const RenderPassDesc& renderPassDesc,
+ sk_sp<Texture> colorTexture,
+ sk_sp<Texture> resolveTexture,
+ sk_sp<Texture> depthStencilTexture,
+ const std::vector<std::unique_ptr<DrawPass>>& drawPasses) {
+ if (!this->onAddRenderPass(renderPassDesc,
+ colorTexture.get(),
+ resolveTexture.get(),
+ depthStencilTexture.get(),
+ drawPasses)) {
return false;
}
@@ -64,62 +69,30 @@ bool CommandBuffer::beginRenderPass(const RenderPassDesc& renderPassDesc,
if (depthStencilTexture) {
this->trackResource(std::move(depthStencilTexture));
}
-#ifdef SK_DEBUG
- if (renderPassDesc.fColorAttachment.fLoadOp == LoadOp::kClear &&
- (renderPassDesc.fColorAttachment.fStoreOp == StoreOp::kStore ||
- renderPassDesc.fColorResolveAttachment.fStoreOp == StoreOp::kStore)) {
- fHasWork = true;
- }
-#endif
+ // We just assume if you are adding a render pass that the render pass will actually do work. In
+ // theory we could have a discard load that doesn't submit any draws, clears, etc. But hopefully
+ // something so trivial would be caught before getting here.
+ SkDEBUGCODE(fHasWork = true;)
return true;
}
-void CommandBuffer::bindGraphicsPipeline(sk_sp<GraphicsPipeline> graphicsPipeline) {
- this->onBindGraphicsPipeline(graphicsPipeline.get());
- this->trackResource(std::move(graphicsPipeline));
-}
-
-void CommandBuffer::bindUniformBuffer(UniformSlot slot,
- sk_sp<Buffer> uniformBuffer,
- size_t offset) {
- this->onBindUniformBuffer(slot, uniformBuffer.get(), offset);
- this->trackResource(std::move(uniformBuffer));
-}
-
-void CommandBuffer::bindVertexBuffers(sk_sp<Buffer> vertexBuffer, size_t vertexOffset,
- sk_sp<Buffer> instanceBuffer, size_t instanceOffset) {
- this->onBindVertexBuffers(vertexBuffer.get(), vertexOffset,
- instanceBuffer.get(), instanceOffset);
- if (vertexBuffer) {
- this->trackResource(std::move(vertexBuffer));
- }
- if (instanceBuffer) {
- this->trackResource(std::move(instanceBuffer));
+bool CommandBuffer::addComputePass(const ComputePassDesc& computePassDesc,
+ sk_sp<ComputePipeline> pipeline,
+ const std::vector<ResourceBinding>& bindings) {
+ if (!this->onAddComputePass(computePassDesc, pipeline.get(), bindings)) {
+ return false;
}
-}
-void CommandBuffer::bindIndexBuffer(sk_sp<Buffer> indexBuffer, size_t bufferOffset) {
- this->onBindIndexBuffer(indexBuffer.get(), bufferOffset);
- if (indexBuffer) {
- this->trackResource(std::move(indexBuffer));
+ this->trackResource(std::move(pipeline));
+
+ for (const auto& binding : bindings) {
+ this->trackResource(binding.fResource.fBuffer);
}
-}
-void CommandBuffer::bindDrawBuffers(BindBufferInfo vertices,
- BindBufferInfo instances,
- BindBufferInfo indices) {
- this->bindVertexBuffers(sk_ref_sp(vertices.fBuffer), vertices.fOffset,
- sk_ref_sp(instances.fBuffer), instances.fOffset);
- this->bindIndexBuffer(sk_ref_sp(indices.fBuffer), indices.fOffset);
-}
+ SkDEBUGCODE(fHasWork = true;)
-void CommandBuffer::bindTextureAndSampler(sk_sp<Texture> texture,
- sk_sp<Sampler> sampler,
- int bindIndex) {
- this->onBindTextureAndSampler(texture, sampler, bindIndex);
- this->trackResource(std::move(texture));
- this->trackResource(std::move(sampler));
+ return true;
}
bool CommandBuffer::copyTextureToBuffer(sk_sp<Texture> texture,
diff --git a/chromium/third_party/skia/src/gpu/graphite/CommandBuffer.h b/chromium/third_party/skia/src/gpu/graphite/CommandBuffer.h
index e15e429c38d..1e7660456f3 100644
--- a/chromium/third_party/skia/src/gpu/graphite/CommandBuffer.h
+++ b/chromium/third_party/skia/src/gpu/graphite/CommandBuffer.h
@@ -12,7 +12,9 @@
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/private/SkTArray.h"
+#include "src/gpu/graphite/AttachmentTypes.h"
#include "src/gpu/graphite/CommandTypes.h"
+#include "src/gpu/graphite/ComputeTypes.h"
#include "src/gpu/graphite/DrawTypes.h"
#include "src/gpu/graphite/DrawWriter.h"
@@ -21,16 +23,18 @@ class RefCntedCallback;
}
namespace skgpu::graphite {
+
class Buffer;
-class Gpu;
+class ComputePipeline;
+class DrawPass;
+class SharedContext;
class GraphicsPipeline;
class Resource;
class Sampler;
class Texture;
class TextureProxy;
-
-class CommandBuffer : public SkRefCnt, private DrawDispatcher {
+class CommandBuffer : public SkRefCnt {
public:
~CommandBuffer() override;
@@ -45,64 +49,15 @@ public:
void addFinishedProc(sk_sp<RefCntedCallback> finishedProc);
void callFinishedProcs(bool success);
- bool beginRenderPass(const RenderPassDesc&,
- sk_sp<Texture> colorTexture,
- sk_sp<Texture> resolveTexture,
- sk_sp<Texture> depthStencilTexture);
- virtual void endRenderPass() = 0;
+ bool addRenderPass(const RenderPassDesc&,
+ sk_sp<Texture> colorTexture,
+ sk_sp<Texture> resolveTexture,
+ sk_sp<Texture> depthStencilTexture,
+ const std::vector<std::unique_ptr<DrawPass>>& drawPasses);
- //---------------------------------------------------------------
- // Can only be used within renderpasses
- //---------------------------------------------------------------
- void bindGraphicsPipeline(sk_sp<GraphicsPipeline> graphicsPipeline);
- void bindUniformBuffer(UniformSlot, sk_sp<Buffer>, size_t bufferOffset);
-
- void bindDrawBuffers(BindBufferInfo vertices,
- BindBufferInfo instances,
- BindBufferInfo indices) final;
-
- void bindTextureAndSampler(sk_sp<Texture>, sk_sp<Sampler>, int bindIndex);
-
- // TODO: do we want to handle multiple scissor rects and viewports?
- void setScissor(unsigned int left, unsigned int top, unsigned int width, unsigned int height) {
- this->onSetScissor(left, top, width, height);
- }
-
- void setViewport(float x, float y, float width, float height,
- float minDepth = 0, float maxDepth = 1) {
- this->onSetViewport(x, y, width, height, minDepth, maxDepth);
- }
-
- void setBlendConstants(std::array<float, 4> blendConstants) {
- this->onSetBlendConstants(blendConstants);
- }
-
- void draw(PrimitiveType type, unsigned int baseVertex, unsigned int vertexCount) final {
- this->onDraw(type, baseVertex, vertexCount);
- SkDEBUGCODE(fHasWork = true;)
- }
- void drawIndexed(PrimitiveType type, unsigned int baseIndex, unsigned int indexCount,
- unsigned int baseVertex) final {
- this->onDrawIndexed(type, baseIndex, indexCount, baseVertex);
- SkDEBUGCODE(fHasWork = true;)
- }
- void drawInstanced(PrimitiveType type, unsigned int baseVertex, unsigned int vertexCount,
- unsigned int baseInstance, unsigned int instanceCount) final {
- this->onDrawInstanced(type, baseVertex, vertexCount, baseInstance, instanceCount);
- SkDEBUGCODE(fHasWork = true;)
- }
- void drawIndexedInstanced(PrimitiveType type, unsigned int baseIndex, unsigned int indexCount,
- unsigned int baseVertex, unsigned int baseInstance,
- unsigned int instanceCount) final {
- this->onDrawIndexedInstanced(type, baseIndex, indexCount, baseVertex, baseInstance,
- instanceCount);
- SkDEBUGCODE(fHasWork = true;)
- }
-
- // When using a DrawWriter dispatching directly to a CommandBuffer, binding of pipelines and
- // uniforms must be coordinated with forNewPipeline() and forDynamicStateChange(). The direct
- // draw calls and vertex buffer binding calls on CB should not be intermingled with the writer.
- DrawDispatcher* asDrawDispatcher() { return this; }
+ bool addComputePass(const ComputePassDesc&,
+ sk_sp<ComputePipeline> pipeline,
+ const std::vector<ResourceBinding>& bindings);
//---------------------------------------------------------------
// Can only be used outside renderpasses
@@ -121,43 +76,15 @@ protected:
CommandBuffer();
private:
- // TODO: Once all buffer use goes through the DrawBufferManager, we likely do not need to track
- // refs every time a buffer is bound, since the DBM will transfer ownership for any used buffer
- // to the CommandBuffer.
- void bindVertexBuffers(sk_sp<Buffer> vertexBuffer, size_t vertexOffset,
- sk_sp<Buffer> instanceBuffer, size_t instanceOffset);
- void bindIndexBuffer(sk_sp<Buffer> indexBuffer, size_t bufferOffset);
-
- virtual bool onBeginRenderPass(const RenderPassDesc&,
- const Texture* colorTexture,
- const Texture* resolveTexture,
- const Texture* depthStencilTexture) = 0;
-
- virtual void onBindGraphicsPipeline(const GraphicsPipeline*) = 0;
- virtual void onBindUniformBuffer(UniformSlot, const Buffer*, size_t bufferOffset) = 0;
- virtual void onBindVertexBuffers(const Buffer* vertexBuffer, size_t vertexOffset,
- const Buffer* instanceBuffer, size_t instanceOffset) = 0;
- virtual void onBindIndexBuffer(const Buffer* indexBuffer, size_t bufferOffset) = 0;
-
- virtual void onBindTextureAndSampler(sk_sp<Texture>,
- sk_sp<Sampler>,
- unsigned int bindIndex) = 0;
-
- virtual void onSetScissor(unsigned int left, unsigned int top,
- unsigned int width, unsigned int height) = 0;
- virtual void onSetViewport(float x, float y, float width, float height,
- float minDepth, float maxDepth) = 0;
- virtual void onSetBlendConstants(std::array<float, 4> blendConstants) = 0;
-
- virtual void onDraw(PrimitiveType type, unsigned int baseVertex, unsigned int vertexCount) = 0;
- virtual void onDrawIndexed(PrimitiveType type, unsigned int baseIndex, unsigned int indexCount,
- unsigned int baseVertex) = 0;
- virtual void onDrawInstanced(PrimitiveType type,
- unsigned int baseVertex, unsigned int vertexCount,
- unsigned int baseInstance, unsigned int instanceCount) = 0;
- virtual void onDrawIndexedInstanced(PrimitiveType type, unsigned int baseIndex,
- unsigned int indexCount, unsigned int baseVertex,
- unsigned int baseInstance, unsigned int instanceCount) = 0;
+ virtual bool onAddRenderPass(const RenderPassDesc&,
+ const Texture* colorTexture,
+ const Texture* resolveTexture,
+ const Texture* depthStencilTexture,
+ const std::vector<std::unique_ptr<DrawPass>>& drawPasses) = 0;
+
+ virtual bool onAddComputePass(const ComputePassDesc&,
+ const ComputePipeline*,
+ const std::vector<ResourceBinding>& bindings) = 0;
virtual bool onCopyTextureToBuffer(const Texture*,
SkIRect srcRect,
diff --git a/chromium/third_party/skia/src/gpu/graphite/ComputePassTask.cpp b/chromium/third_party/skia/src/gpu/graphite/ComputePassTask.cpp
new file mode 100644
index 00000000000..6f564491137
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/ComputePassTask.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "src/gpu/graphite/ComputePassTask.h"
+
+#include "src/gpu/graphite/Buffer.h"
+#include "src/gpu/graphite/CommandBuffer.h"
+#include "src/gpu/graphite/ResourceProvider.h"
+
+namespace skgpu::graphite {
+
+sk_sp<ComputePassTask> ComputePassTask::Make(std::vector<ResourceBinding> bindings,
+ const ComputePipelineDesc& pipelineDesc,
+ const ComputePassDesc& desc) {
+ return sk_sp<ComputePassTask>(new ComputePassTask(std::move(bindings), pipelineDesc, desc));
+}
+
+ComputePassTask::ComputePassTask(std::vector<ResourceBinding> bindings,
+ const ComputePipelineDesc& pipelineDesc,
+ const ComputePassDesc& desc)
+ : fPipelineDesc(pipelineDesc)
+ , fComputePassDesc(desc)
+ , fBindings(std::move(bindings)) {}
+
+bool ComputePassTask::prepareResources(ResourceProvider* provider) {
+ fPipeline = provider->findOrCreateComputePipeline(fPipelineDesc);
+ return fPipeline != nullptr;
+}
+
+bool ComputePassTask::addCommands(ResourceProvider* provider, CommandBuffer* commandBuffer) {
+ SkASSERT(fPipeline);
+ commandBuffer->addComputePass(fComputePassDesc, fPipeline, fBindings);
+ return true;
+}
+
+} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/ComputePassTask.h b/chromium/third_party/skia/src/gpu/graphite/ComputePassTask.h
new file mode 100644
index 00000000000..a118ddcd9ce
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/ComputePassTask.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef skgpu_graphite_ComputePassTask_DEFINED
+#define skgpu_graphite_ComputePassTask_DEFINED
+
+#include "src/gpu/graphite/ComputePipeline.h"
+#include "src/gpu/graphite/ComputePipelineDesc.h"
+#include "src/gpu/graphite/ComputeTypes.h"
+#include "src/gpu/graphite/Task.h"
+
+#include <vector>
+
+namespace skgpu::graphite {
+
+class Buffer;
+class ComputePipeline;
+class CommandBuffer;
+class ResourceProvider;
+
+/**
+ * ComputePassTask records a compute kernel and its associated resources into a single compute pass
+ * within a command buffer. The creation of bound resources and their binding layout is left up to
+ * the caller and must be compatible with the provided the compute pipeline layout.
+ */
+// TODO(b/240604614): This class could facilitate some of this and also enforce layout validation
+// depending on how we decide to define and combine compute shader code.
+// TODO(b/240625222): This class could consume multiple ComputePass objects and encode them
+// together. The individual passes could execute in parallel depending on the desired data-flow.
+class ComputePassTask final : public Task {
+public:
+ static sk_sp<ComputePassTask> Make(std::vector<ResourceBinding> bindings,
+ const ComputePipelineDesc&,
+ const ComputePassDesc&);
+
+ ~ComputePassTask() override = default;
+
+ bool prepareResources(ResourceProvider*) override;
+ bool addCommands(ResourceProvider*, CommandBuffer*) override;
+
+private:
+ ComputePassTask(std::vector<ResourceBinding> bindings,
+ const ComputePipelineDesc&,
+ const ComputePassDesc&);
+
+ const ComputePipelineDesc fPipelineDesc;
+ const ComputePassDesc fComputePassDesc;
+ const std::vector<ResourceBinding> fBindings;
+
+ sk_sp<ComputePipeline> fPipeline;
+};
+
+} // namespace skgpu::graphite
+
+#endif // skgpu_graphite_ComputePassTask_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/graphite/ComputePipeline.cpp b/chromium/third_party/skia/src/gpu/graphite/ComputePipeline.cpp
new file mode 100644
index 00000000000..eb93e052815
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/ComputePipeline.cpp
@@ -0,0 +1,15 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "src/gpu/graphite/ComputePipeline.h"
+
+namespace skgpu::graphite {
+
+ComputePipeline::ComputePipeline(const SharedContext* sharedContext)
+ : Resource(sharedContext, Ownership::kOwned, SkBudgeted::kYes) {}
+
+} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/ComputePipeline.h b/chromium/third_party/skia/src/gpu/graphite/ComputePipeline.h
new file mode 100644
index 00000000000..e862c227350
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/ComputePipeline.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef skgpu_graphite_ComputePipeline_DEFINED
+#define skgpu_graphite_ComputePipeline_DEFINED
+
+#include "src/gpu/graphite/Resource.h"
+
+namespace skgpu::graphite {
+
+class SharedContext;
+
+/**
+ * ComputePipeline corresponds to a backend specific pipeline used for compute (vs rendering),
+ * e.g. MTLComputePipelineState (Metal),
+ * CreateComputePipeline (Dawn),
+ * CreateComputePipelineState (D3D12),
+ * or VkComputePipelineCreateInfo (Vulkan).
+ */
+class ComputePipeline : public Resource {
+public:
+ ~ComputePipeline() override = default;
+
+ // TODO(b/240615224): The pipeline should return an optional effective local workgroup
+ // size if the value was statically assigned in the shader (when it's not possible to assign
+ // them via specialization constants).
+
+protected:
+ explicit ComputePipeline(const SharedContext*);
+};
+
+} // namespace skgpu::graphite
+
+#endif // skgpu_graphite_ComputePipeline_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/graphite/ComputePipelineDesc.h b/chromium/third_party/skia/src/gpu/graphite/ComputePipelineDesc.h
new file mode 100644
index 00000000000..053889b4d1a
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/ComputePipelineDesc.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#ifndef skgpu_graphite_ComputePipelineDesc_DEFINED
+#define skgpu_graphite_ComputePipelineDesc_DEFINED
+
+#include "include/core/SkSpan.h"
+#include "include/private/SkOpts_spi.h"
+
+#include <array>
+#include <string>
+
+namespace skgpu::graphite {
+
+/**
+ * ComputePipelineDesc represents the state needed to create a backend specific ComputePipeline.
+ */
+class ComputePipelineDesc {
+public:
+ ComputePipelineDesc() = default;
+
+ SkSpan<const uint32_t> asKey() const {
+ return SkSpan(reinterpret_cast<const uint32_t*>(fName.data()),
+ this->keySize() / sizeof(uint32_t));
+ }
+
+ bool operator==(const ComputePipelineDesc& that) const { return this->fName == that.fName; }
+
+ bool operator!=(const ComputePipelineDesc& other) const { return !(*this == other); }
+
+ // TODO(b/240604614): Until we have a more sophisticated way to dynamically construct compute
+ // shader programs, this currently directly takes the entire program SkSL text as input. The
+ // caching scheme is based entirely on the name and could be improved.
+ const std::string& sksl() const { return fSkSL; }
+ const std::string& name() const { return fName; }
+
+ void setProgram(std::string sksl, std::string name) {
+ SkASSERT(!sksl.empty());
+ SkASSERT(name.size() >= sizeof(uint32_t));
+
+ fSkSL = std::move(sksl);
+ fName = std::move(name);
+ }
+
+ struct Hash {
+ uint32_t operator()(const ComputePipelineDesc& desc) const {
+ return SkOpts::hash_fn(desc.fName.data(), desc.keySize(), 0);
+ }
+ };
+
+private:
+ size_t keySize() const {
+ size_t nameLength = fName.length();
+ return nameLength - (nameLength % sizeof(uint32_t));
+ }
+
+ std::string fSkSL;
+ std::string fName;
+};
+
+} // namespace skgpu::graphite
+
+#endif // skgpu_graphite_ComputePipelineDesc_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/graphite/ComputeTypes.h b/chromium/third_party/skia/src/gpu/graphite/ComputeTypes.h
new file mode 100644
index 00000000000..f32829323e8
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/ComputeTypes.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef skgpu_graphite_ComputeTypes_DEFINED
+#define skgpu_graphite_ComputeTypes_DEFINED
+
+#include "src/gpu/graphite/Buffer.h"
+
+namespace skgpu::graphite {
+
+/**
+ * Defines the space that a compute shader operates on. A problem space is logically divided into
+ * abstract "work groups" (or "thread groups" in Metal/D3D12).
+ *
+ * The "work group count" or "global size" of the work group is a 3-dimensional number that defines
+ * the size of the problem space. The user must provide the global size to define the number of
+ * work groups that execute as part of a dispatch.
+ *
+ * The local size of a work group defines the number of parallel execution units that run in that
+ * group (these are called "threads" in Metal/D3D12, "wavefronts" in OpenCL, "warps" in CUDA). The
+ * local size is defined in 3 dimensions and must be determined based on hardware limitations, which
+ * can be queried via Caps::maxComputeWorkgroupSize() (for each individual dimension) and
+ * Caps::maxComputeInvocationsPerWorkgroup().
+ *
+ * The WorkgroupSize type is used to represent both global size and local size.
+ */
+struct WorkgroupSize {
+ WorkgroupSize() = default;
+ WorkgroupSize(uint32_t width, uint32_t height, uint32_t depth)
+ : fWidth(width)
+ , fHeight(height)
+ , fDepth(depth) {}
+
+ uint32_t fWidth = 1;
+ uint32_t fHeight = 1;
+ uint32_t fDepth = 1;
+};
+
+struct ComputePassDesc {
+ WorkgroupSize fGlobalDispatchSize;
+
+ // TODO(b/240615224): On OpenGL D3D, and Vulkan 1.0, the local work group size is expressed with
+ // literals in the shading language and is tied to the pipeline state. On those platforms, we
+ // could either:
+ //
+ // 1. Defer pipeline creation until `fLocalDispatchSize` is known for a particular compute
+ // pass and build the shader text using this value, or
+ // 2. Hard-code reasonable defaults within GPU capabilities and disregard
+ // `fLocalDispatchSize`.
+ //
+ // The local size is a function of both the number of supported hardware threads AND how the
+ // problem is divided between the global and local sizes. Which approach is more optimal depends
+ // on the problem.
+ WorkgroupSize fLocalDispatchSize;
+};
+
+// TODO(armansito): These types aren't specific to compute and could share definitions with render
+// pipeline stack.
+using BindingIndex = uint32_t;
+
+struct BufferBinding {
+ sk_sp<Buffer> fBuffer;
+ size_t fOffset;
+};
+
+struct ResourceBinding {
+ BindingIndex fIndex;
+ BufferBinding fResource;
+};
+
+} // namespace skgpu::graphite
+
+#endif // skgpu_graphite_ComputeTypes_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/graphite/Context.cpp b/chromium/third_party/skia/src/gpu/graphite/Context.cpp
index d3686e30f58..ae2cbe44eba 100644
--- a/chromium/third_party/skia/src/gpu/graphite/Context.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/Context.cpp
@@ -20,10 +20,12 @@
#include "src/gpu/graphite/CommandBuffer.h"
#include "src/gpu/graphite/ContextPriv.h"
#include "src/gpu/graphite/GlobalCache.h"
-#include "src/gpu/graphite/Gpu.h"
#include "src/gpu/graphite/GraphicsPipelineDesc.h"
+#include "src/gpu/graphite/QueueManager.h"
+#include "src/gpu/graphite/RecordingPriv.h"
#include "src/gpu/graphite/Renderer.h"
#include "src/gpu/graphite/ResourceProvider.h"
+#include "src/gpu/graphite/SharedContext.h"
#ifdef SK_METAL
#include "src/gpu/graphite/mtl/MtlTrampoline.h"
@@ -31,64 +33,75 @@
namespace skgpu::graphite {
+#define ASSERT_SINGLE_OWNER SKGPU_ASSERT_SINGLE_OWNER(this->singleOwner())
+
//--------------------------------------------------------------------------------------------------
-Context::Context(sk_sp<Gpu> gpu, BackendApi backend)
- : fGpu(std::move(gpu))
- , fGlobalCache(sk_make_sp<GlobalCache>())
- , fBackend(backend) {
+Context::Context(sk_sp<SharedContext> sharedContext, std::unique_ptr<QueueManager> queueManager)
+ : fSharedContext(std::move(sharedContext))
+ , fQueueManager(std::move(queueManager))
+ , fGlobalCache(sk_make_sp<GlobalCache>()) {
}
Context::~Context() {}
+BackendApi Context::backend() const { return fSharedContext->backend(); }
+
#ifdef SK_METAL
-std::unique_ptr<Context> Context::MakeMetal(const MtlBackendContext& backendContext) {
- sk_sp<Gpu> gpu = MtlTrampoline::MakeGpu(backendContext);
- if (!gpu) {
+std::unique_ptr<Context> Context::MakeMetal(const MtlBackendContext& backendContext,
+ const ContextOptions& options) {
+ sk_sp<SharedContext> sharedContext = MtlTrampoline::MakeSharedContext(backendContext, options);
+ if (!sharedContext) {
+ return nullptr;
+ }
+
+ auto queueManager = MtlTrampoline::MakeQueueManager(backendContext, sharedContext.get());
+ if (!queueManager) {
return nullptr;
}
- return std::unique_ptr<Context>(new Context(std::move(gpu), BackendApi::kMetal));
+ auto context = std::unique_ptr<Context>(new Context(std::move(sharedContext),
+ std::move(queueManager)));
+ SkASSERT(context);
+
+ // We have to create this after the Context because we need to pass in the Context's
+ // SingleOwner object.
+ auto resourceProvider = MtlTrampoline::MakeResourceProvider(context->fSharedContext.get(),
+ context->fGlobalCache,
+ context->singleOwner());
+ if (!resourceProvider) {
+ return nullptr;
+ }
+ context->fResourceProvider = std::move(resourceProvider);
+ return context;
}
#endif
-std::unique_ptr<Recorder> Context::makeRecorder() {
- return std::unique_ptr<Recorder>(new Recorder(fGpu, fGlobalCache));
+std::unique_ptr<Recorder> Context::makeRecorder(const RecorderOptions& options) {
+ ASSERT_SINGLE_OWNER
+
+ return std::unique_ptr<Recorder>(new Recorder(fSharedContext, fGlobalCache, options));
}
void Context::insertRecording(const InsertRecordingInfo& info) {
- sk_sp<RefCntedCallback> callback;
- if (info.fFinishedProc) {
- callback = RefCntedCallback::Make(info.fFinishedProc, info.fFinishedContext);
- }
+ ASSERT_SINGLE_OWNER
- SkASSERT(info.fRecording);
- if (!info.fRecording) {
- if (callback) {
- callback->setFailureResult();
- }
- return;
- }
-
- SkASSERT(!fCurrentCommandBuffer);
- // For now we only allow one CommandBuffer. So we just ref it off the InsertRecordingInfo and
- // hold onto it until we submit.
- fCurrentCommandBuffer = info.fRecording->fCommandBuffer;
- if (callback) {
- fCurrentCommandBuffer->addFinishedProc(std::move(callback));
- }
+ fQueueManager->addRecording(info, fResourceProvider.get());
}
void Context::submit(SyncToCpu syncToCpu) {
- SkASSERT(fCurrentCommandBuffer);
-
- fGpu->submit(std::move(fCurrentCommandBuffer));
+ ASSERT_SINGLE_OWNER
- fGpu->checkForFinishedWork(syncToCpu);
+ fQueueManager->submitToGpu();
+ fQueueManager->checkForFinishedWork(syncToCpu);
}
void Context::checkAsyncWorkCompletion() {
- fGpu->checkForFinishedWork(SyncToCpu::kNo);
+ ASSERT_SINGLE_OWNER
+
+ fQueueManager->checkForFinishedWork(SyncToCpu::kNo);
}
+#ifdef SK_ENABLE_PRECOMPILE
+
SkBlenderID Context::addUserDefinedBlender(sk_sp<SkRuntimeEffect> effect) {
auto dict = this->priv().shaderCodeDictionary();
@@ -96,6 +109,8 @@ SkBlenderID Context::addUserDefinedBlender(sk_sp<SkRuntimeEffect> effect) {
}
void Context::precompile(SkCombinationBuilder* combinationBuilder) {
+ ASSERT_SINGLE_OWNER
+
static const Renderer* kRenderers[] = {
&Renderer::StencilTessellatedCurvesAndTris(SkPathFillType::kWinding),
&Renderer::StencilTessellatedCurvesAndTris(SkPathFillType::kEvenOdd),
@@ -131,18 +146,15 @@ void Context::precompile(SkCombinationBuilder* combinationBuilder) {
// shading, and just use ShaderType::kNone.
}
-BackendTexture Context::createBackendTexture(SkISize dimensions, const TextureInfo& info) {
- if (!info.isValid() || info.backend() != this->backend()) {
- return {};
- }
- return fGpu->createBackendTexture(dimensions, info);
-}
-
void Context::deleteBackendTexture(BackendTexture& texture) {
+ ASSERT_SINGLE_OWNER
+
if (!texture.isValid() || texture.backend() != this->backend()) {
return;
}
- fGpu->deleteBackendTexture(texture);
+ fResourceProvider->deleteBackendTexture(texture);
}
+#endif // SK_ENABLE_PRECOMPILE
+
} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/ContextPriv.cpp b/chromium/third_party/skia/src/gpu/graphite/ContextPriv.cpp
index 5047dc49d36..52c21a97e28 100644
--- a/chromium/third_party/skia/src/gpu/graphite/ContextPriv.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/ContextPriv.cpp
@@ -8,17 +8,15 @@
#include "src/gpu/graphite/ContextPriv.h"
#include "src/gpu/graphite/GlobalCache.h"
-#include "src/gpu/graphite/Gpu.h"
+#include "src/gpu/graphite/SharedContext.h"
namespace skgpu::graphite {
-Gpu* ContextPriv::gpu() {
- return fContext->fGpu.get();
-}
-
-const Gpu* ContextPriv::gpu() const {
- return fContext->fGpu.get();
+#if GRAPHITE_TEST_UTILS
+const Caps* ContextPriv::caps() const {
+ return fContext->fSharedContext->caps();
}
+#endif
SkShaderCodeDictionary* ContextPriv::shaderCodeDictionary() {
return fContext->fGlobalCache->shaderCodeDictionary();
diff --git a/chromium/third_party/skia/src/gpu/graphite/ContextPriv.h b/chromium/third_party/skia/src/gpu/graphite/ContextPriv.h
index 0689bf212b4..06293dabbe1 100644
--- a/chromium/third_party/skia/src/gpu/graphite/ContextPriv.h
+++ b/chromium/third_party/skia/src/gpu/graphite/ContextPriv.h
@@ -14,8 +14,8 @@ class SkShaderCodeDictionary;
namespace skgpu::graphite {
+class Caps;
class GlobalCache;
-class Gpu;
class ResourceProvider;
/** Class that adds methods to Context that are only intended for use internal to Skia.
@@ -23,8 +23,9 @@ class ResourceProvider;
data members or virtual methods. */
class ContextPriv {
public:
- Gpu* gpu();
- const Gpu* gpu() const;
+#if GRAPHITE_TEST_UTILS
+ const Caps* caps() const;
+#endif
SkShaderCodeDictionary* shaderCodeDictionary();
diff --git a/chromium/third_party/skia/src/gpu/graphite/ContextUtils.cpp b/chromium/third_party/skia/src/gpu/graphite/ContextUtils.cpp
index bb3133a2021..ed6ed0c587d 100644
--- a/chromium/third_party/skia/src/gpu/graphite/ContextUtils.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/ContextUtils.cpp
@@ -8,11 +8,13 @@
#include "src/gpu/graphite/ContextUtils.h"
#include <string>
+#include "include/private/SkSLString.h"
#include "include/private/SkUniquePaintParamsID.h"
#include "src/core/SkBlenderBase.h"
#include "src/core/SkKeyContext.h"
#include "src/core/SkPipelineData.h"
#include "src/core/SkShaderCodeDictionary.h"
+#include "src/gpu/graphite/GraphicsPipelineDesc.h"
#include "src/gpu/graphite/PaintParams.h"
#include "src/gpu/graphite/RecorderPriv.h"
#include "src/gpu/graphite/Renderer.h"
@@ -35,34 +37,263 @@ ExtractPaintData(Recorder* recorder,
p.toKey(keyContext, builder, gatherer);
- SkPaintParamsKey key = builder->lockAsKey();
-
auto dict = recorder->priv().resourceProvider()->shaderCodeDictionary();
UniformDataCache* uniformDataCache = recorder->priv().uniformDataCache();
TextureDataCache* textureDataCache = recorder->priv().textureDataCache();
- auto entry = dict->findOrCreate(key, builder->blendInfo());
- UniformDataCache::Index uniformIndex = uniformDataCache->insert(gatherer->peekUniformData());
- TextureDataCache::Index textureIndex = textureDataCache->insert(gatherer->textureDataBlock());
+ auto entry = dict->findOrCreate(builder);
+ UniformDataCache::Index uniformIndex;
+ if (gatherer->hasUniforms()) {
+ uniformIndex = uniformDataCache->insert(gatherer->peekUniformData());
+ }
+ TextureDataCache::Index textureIndex;
+ if (gatherer->hasTextures()) {
+ textureIndex = textureDataCache->insert(gatherer->textureDataBlock());
+ }
gatherer->reset();
return { entry->uniqueID(), uniformIndex, textureIndex };
}
-UniformDataCache::Index ExtractRenderStepData(UniformDataCache* geometryUniformDataCache,
- SkPipelineDataGatherer* gatherer,
- const RenderStep* step,
- const DrawGeometry& geometry) {
+std::tuple<UniformDataCache::Index, TextureDataCache::Index>
+ExtractRenderStepData(UniformDataCache* geometryUniformDataCache,
+ TextureDataCache* textureDataCache,
+ SkPipelineDataGatherer* gatherer,
+ const RenderStep* step,
+ const DrawParams& params) {
SkDEBUGCODE(gatherer->checkReset());
- step->writeUniforms(geometry, gatherer);
+ step->writeUniformsAndTextures(params, gatherer);
UniformDataCache::Index uIndex = geometryUniformDataCache->insert(gatherer->peekUniformData());
+ TextureDataCache::Index textureIndex;
+ if (step->hasTextures()) {
+ textureIndex = textureDataCache->insert(gatherer->textureDataBlock());
+ }
+
gatherer->reset();
- return uIndex;
+ return { uIndex, textureIndex };
+}
+
+namespace {
+std::string get_uniform_header(int bufferID, const char* name) {
+ std::string result;
+
+ SkSL::String::appendf(&result, "layout (binding=%d) uniform %sUniforms {\n", bufferID, name);
+
+ return result;
+}
+
+std::string get_uniforms(SkSpan<const SkUniform> uniforms, int* offset, int manglingSuffix) {
+ std::string result;
+ UniformOffsetCalculator offsetter(Layout::kMetal, *offset);
+
+ for (const SkUniform& u : uniforms) {
+ SkSL::String::appendf(&result, " layout(offset=%zu) %s %s",
+ offsetter.calculateOffset(u.type(), u.count()),
+ SkSLTypeString(u.type()),
+ u.name());
+ if (manglingSuffix >= 0) {
+ result.append("_");
+ result.append(std::to_string(manglingSuffix));
+ }
+ if (u.count()) {
+ result.append("[");
+ result.append(std::to_string(u.count()));
+ result.append("]");
+ }
+ result.append(";\n");
+ }
+
+ *offset = offsetter.size();
+ return result;
+}
+} // anonymous namespace
+
+std::string EmitPaintParamsUniforms(int bufferID,
+ const char* name,
+ const std::vector<SkPaintParamsKey::BlockReader>& readers,
+ bool needsLocalCoords) {
+ size_t numUniforms = 0;
+ for (auto r : readers) {
+ numUniforms += r.entry()->fUniforms.size();
+ }
+
+ if (!numUniforms) {
+ return {};
+ }
+
+ int offset = 0;
+
+ std::string result = get_uniform_header(bufferID, name);
+ for (int i = 0; i < (int) readers.size(); ++i) {
+ SkSpan<const SkUniform> uniforms = readers[i].entry()->fUniforms;
+
+ if (!uniforms.empty()) {
+ SkSL::String::appendf(&result, "// %s uniforms\n", readers[i].entry()->fName);
+ result += get_uniforms(uniforms, &offset, i);
+ }
+ }
+ if (needsLocalCoords) {
+ static constexpr SkUniform kDev2LocalUniform[] = {{ "dev2LocalUni", SkSLType::kFloat4x4 }};
+ result += "// NeedsLocalCoords\n";
+ result += get_uniforms(SkSpan<const SkUniform>(kDev2LocalUniform, 1), &offset, -1);
+ }
+ result.append("};\n\n");
+
+ return result;
+}
+
+std::string EmitRenderStepUniforms(int bufferID, const char* name,
+ SkSpan<const SkUniform> uniforms) {
+ int offset = 0;
+
+ std::string result = get_uniform_header(bufferID, name);
+ result += get_uniforms(uniforms, &offset, -1);
+ result.append("};\n\n");
+
+ return result;
+}
+
+std::string EmitTexturesAndSamplers(const std::vector<SkPaintParamsKey::BlockReader>& readers,
+ int* binding) {
+ std::string result;
+ for (int i = 0; i < (int) readers.size(); ++i) {
+ SkSpan<const SkTextureAndSampler> samplers = readers[i].entry()->fTexturesAndSamplers;
+
+ if (!samplers.empty()) {
+ SkSL::String::appendf(&result, "// %s samplers\n", readers[i].entry()->fName);
+
+ for (const SkTextureAndSampler& t : samplers) {
+ SkSL::String::appendf(&result,
+ "layout(binding=%d) uniform sampler2D %s_%d;\n",
+ *binding, t.name(), i);
+ (*binding)++;
+ }
+ }
+ }
+
+ return result;
+}
+
+namespace {
+std::string emit_attributes(SkSpan<const Attribute> vertexAttrs,
+ SkSpan<const Attribute> instanceAttrs) {
+ std::string result;
+
+ int attr = 0;
+ auto add_attrs = [&](SkSpan<const Attribute> attrs) {
+ for (auto a : attrs) {
+ SkSL::String::appendf(&result, " layout(location=%d) in ", attr++);
+ result.append(SkSLTypeString(a.gpuType()));
+ SkSL::String::appendf(&result, " %s;\n", a.name());
+ }
+ };
+
+ if (!vertexAttrs.empty()) {
+ result.append("// vertex attrs\n");
+ add_attrs(vertexAttrs);
+ }
+ if (!instanceAttrs.empty()) {
+ result.append("// instance attrs\n");
+ add_attrs(instanceAttrs);
+ }
+
+ return result;
+}
+} // anonymous namespace
+
+std::string EmitVaryings(const RenderStep* step, const char* direction,
+ bool emitLocalCoordsVarying) {
+ std::string result;
+ int location = 0;
+
+ if (emitLocalCoordsVarying) {
+ SkSL::String::appendf(&result, " layout(location=%d) %s ", location++, direction);
+ result.append(SkSLTypeString(SkSLType::kFloat2));
+ SkSL::String::appendf(&result, " localCoordsVar;\n");
+ }
+
+ for (auto v : step->varyings()) {
+ SkSL::String::appendf(&result, " layout(location=%d) %s ", location++, direction);
+ result.append(SkSLTypeString(v.fType));
+ SkSL::String::appendf(&result, " %s;\n", v.fName);
+ }
+
+ return result;
+}
+
+std::string GetSkSLVS(const GraphicsPipelineDesc& desc, bool defineLocalCoordsVarying) {
+ const RenderStep* step = desc.renderStep();
+ // TODO: To more completely support end-to-end rendering, this will need to be updated so that
+ // the RenderStep shader snippet can produce a device coord, a local coord, and depth.
+ // If the paint combination doesn't need the local coord it can be ignored, otherwise we need
+ // a varying for it. The fragment function's output will need to be updated to have a color and
+ // the depth, or when there's no combination, just the depth. Lastly, we also should add the
+ // static/intrinsic uniform binding point so that we can handle normalizing the device position
+ // produced by the RenderStep automatically.
+
+ // Fixed program header
+ std::string sksl =
+ "layout (binding=0) uniform intrinsicUniforms {\n"
+ " layout(offset=0) float4 rtAdjust;\n"
+ "};\n"
+ "\n";
+
+ if (step->numVertexAttributes() > 0 || step->numInstanceAttributes() > 0) {
+ sksl += emit_attributes(step->vertexAttributes(), step->instanceAttributes());
+ }
+
+ // Uniforms needed by RenderStep
+ // The uniforms are mangled by having their index in 'fEntries' as a suffix (i.e., "_%d")
+ // TODO: replace hard-coded bufferID with the backend's renderstep uniform-buffer index.
+ if (step->numUniforms() > 0) {
+ sksl += EmitRenderStepUniforms(1, "Step", step->uniforms());
+ }
+
+ // Varyings needed by RenderStep
+ sksl += EmitVaryings(step, "out", defineLocalCoordsVarying);
+
+ // Vertex shader function declaration
+ sksl += "void main() {\n";
+ // Create stepLocalCoords which render steps can write to.
+ sksl += "float2 stepLocalCoords = float2(0);\n";
+ // Vertex shader body
+ sksl += step->vertexSkSL();
+ sksl += "sk_Position = float4(devPosition.xy * rtAdjust.xy + rtAdjust.zw, devPosition.zw);\n";
+
+ if (defineLocalCoordsVarying) {
+ // Assign Render Step's stepLocalCoords to the localCoordsVar varying.
+ sksl += "localCoordsVar = stepLocalCoords;\n";
+ }
+ sksl += "}\n";
+
+ return sksl;
+}
+
+std::string GetSkSLFS(SkShaderCodeDictionary* dict,
+ SkRuntimeEffectDictionary* rteDict,
+ const GraphicsPipelineDesc& desc,
+ BlendInfo* blendInfo,
+ bool* requiresLocalCoordsVarying) {
+ if (!desc.paintParamsID().isValid()) {
+ // TODO: we should return the error shader code here
+ return {};
+ }
+
+ SkShaderInfo shaderInfo(rteDict);
+
+ dict->getShaderInfo(desc.paintParamsID(), &shaderInfo);
+ *blendInfo = shaderInfo.blendInfo();
+ *requiresLocalCoordsVarying = shaderInfo.needsLocalCoords();
+
+ std::string sksl;
+ sksl += shaderInfo.toSkSL(desc.renderStep(), *requiresLocalCoordsVarying);
+
+ return sksl;
}
} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/ContextUtils.h b/chromium/third_party/skia/src/gpu/graphite/ContextUtils.h
index 4984b371089..4e7c4c1fdad 100644
--- a/chromium/third_party/skia/src/gpu/graphite/ContextUtils.h
+++ b/chromium/third_party/skia/src/gpu/graphite/ContextUtils.h
@@ -8,16 +8,19 @@
#ifndef skgpu_graphite_ContextUtils_DEFINED
#define skgpu_graphite_ContextUtils_DEFINED
+#include "src/core/SkPaintParamsKey.h"
#include "src/gpu/graphite/PipelineDataCache.h"
class SkM44;
class SkPaintParamsKeyBuilder;
class SkPipelineDataGatherer;
+class SkRuntimeEffectDictionary;
class SkUniquePaintParamsID;
namespace skgpu::graphite {
-class DrawGeometry;
+class DrawParams;
+class GraphicsPipelineDesc;
class PaintParams;
class Recorder;
class RenderStep;
@@ -29,10 +32,30 @@ ExtractPaintData(Recorder*,
const SkM44& dev2local,
const PaintParams&);
-UniformDataCache::Index ExtractRenderStepData(UniformDataCache* geometryUniformDataCache,
- SkPipelineDataGatherer* gatherer,
- const RenderStep* step,
- const DrawGeometry& geometry);
+std::tuple<UniformDataCache::Index, TextureDataCache::Index>
+ExtractRenderStepData(UniformDataCache* geometryUniformDataCache,
+ TextureDataCache* textureDataCache,
+ SkPipelineDataGatherer* gatherer,
+ const RenderStep* step,
+ const DrawParams& params);
+
+std::string GetSkSLVS(const GraphicsPipelineDesc& desc, bool defineLocalCoordsVarying);
+
+std::string GetSkSLFS(SkShaderCodeDictionary* dict,
+ SkRuntimeEffectDictionary* rteDict,
+ const GraphicsPipelineDesc& desc,
+ BlendInfo* blendInfo,
+ bool* requiresLocalCoordsVarying);
+
+std::string EmitPaintParamsUniforms(int bufferID,
+ const char* name,
+ const std::vector<SkPaintParamsKey::BlockReader>&,
+ bool needsDev2Local);
+std::string EmitRenderStepUniforms(int bufferID, const char* name,
+ SkSpan<const SkUniform> uniforms);
+std::string EmitTexturesAndSamplers(const std::vector<SkPaintParamsKey::BlockReader>&,
+ int* binding);
+std::string EmitVaryings(const RenderStep*, const char* direction, bool emitLocalCoordsVarying);
} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/Device.cpp b/chromium/third_party/skia/src/gpu/graphite/Device.cpp
index 031f9b7f082..37c1d9f46a8 100644
--- a/chromium/third_party/skia/src/gpu/graphite/Device.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/Device.cpp
@@ -9,35 +9,43 @@
#include "include/gpu/graphite/Recorder.h"
#include "include/gpu/graphite/SkStuff.h"
+#include "src/gpu/AtlasTypes.h"
#include "src/gpu/graphite/Buffer.h"
#include "src/gpu/graphite/Caps.h"
#include "src/gpu/graphite/CommandBuffer.h"
#include "src/gpu/graphite/ContextPriv.h"
#include "src/gpu/graphite/DrawContext.h"
-#include "src/gpu/graphite/DrawGeometry.h"
#include "src/gpu/graphite/DrawList.h"
-#include "src/gpu/graphite/Gpu.h"
+#include "src/gpu/graphite/DrawParams.h"
+#include "src/gpu/graphite/ImageUtils.h"
#include "src/gpu/graphite/Log.h"
#include "src/gpu/graphite/RecorderPriv.h"
#include "src/gpu/graphite/Renderer.h"
+#include "src/gpu/graphite/SharedContext.h"
#include "src/gpu/graphite/TextureProxy.h"
#include "src/gpu/graphite/TextureUtils.h"
#include "src/gpu/graphite/geom/BoundsManager.h"
+#include "src/gpu/graphite/geom/Geometry.h"
#include "src/gpu/graphite/geom/IntersectionTree.h"
#include "src/gpu/graphite/geom/Shape.h"
#include "src/gpu/graphite/geom/Transform_graphite.h"
+#include "src/gpu/graphite/text/AtlasManager.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkPath.h"
#include "include/core/SkPathEffect.h"
#include "include/core/SkStrokeRec.h"
#include "include/private/SkImageInfoPriv.h"
+#include "src/core/SkVerticesPriv.h"
#include "src/core/SkConvertPixels.h"
#include "src/core/SkMatrixPriv.h"
#include "src/core/SkPaintPriv.h"
#include "src/core/SkSpecialImage.h"
+#include "src/core/SkTraceEvent.h"
#include "src/shaders/SkImageShader.h"
+#include "src/text/gpu/SubRunContainer.h"
+#include "src/text/gpu/TextBlobRedrawCoordinator.h"
#include <unordered_map>
#include <vector>
@@ -49,7 +57,7 @@ namespace {
static const SkStrokeRec kFillStyle(SkStrokeRec::kFill_InitStyle);
bool paint_depends_on_dst(const PaintParams& paintParams) {
- std::optional<SkBlendMode> bm = paintParams.asBlendMode();
+ std::optional<SkBlendMode> bm = paintParams.asFinalBlendMode();
if (!bm.has_value()) {
return true;
}
@@ -59,9 +67,9 @@ bool paint_depends_on_dst(const PaintParams& paintParams) {
return false;
} else if (bm.value() == SkBlendMode::kSrcOver) {
// src-over does not depend on dst if src is opaque (a = 1)
- // TODO: This will get more complicated when PaintParams has color filters and blenders
return !paintParams.color().isOpaque() ||
- (paintParams.shader() && !paintParams.shader()->isOpaque());
+ (paintParams.shader() && !paintParams.shader()->isOpaque()) ||
+ (paintParams.colorFilter() && !paintParams.colorFilter()->isAlphaUnchanged());
} else {
// TODO: Are their other modes that don't depend on dst that can be trivially detected?
return true;
@@ -182,15 +190,29 @@ sk_sp<Device> Device::Make(Recorder* recorder,
return sk_sp<Device>(new Device(recorder, std::move(dc)));
}
+// These default tuning numbers for the HybridBoundsManager were chosen from looking at performance
+// and accuracy curves produced by the BoundsManagerBench for random draw bounding boxes. This
+// config will use brute force for the first 64 draw calls to the Device and then switch to a grid
+// that is dynamically sized to produce cells that are 16x16, which seemed to be in the sweet spot
+// for maintaining good performance without becoming too inaccurate.
+// TODO: These could be exposed as context options or surface options, and we may want to have
+// different strategies in place for a base device vs. a layer's device.
+static constexpr int kGridCellSize = 16;
+static constexpr int kMaxBruteForceN = 64;
+
Device::Device(Recorder* recorder, sk_sp<DrawContext> dc)
: SkBaseDevice(dc->imageInfo(), SkSurfaceProps())
, fRecorder(recorder)
, fDC(std::move(dc))
, fClip(this)
- , fColorDepthBoundsManager(std::make_unique<NaiveBoundsManager>())
+ , fColorDepthBoundsManager(
+ std::make_unique<HybridBoundsManager>(fDC->imageInfo().dimensions(),
+ kGridCellSize,
+ kMaxBruteForceN))
, fDisjointStencilSet(std::make_unique<IntersectionTreeSet>())
, fCachedLocalToDevice(SkM44())
, fCurrentDepth(DrawOrder::kClearDepth)
+ , fSDFTControl(recorder->priv().getSDFTControl(false))
, fDrawsOverlap(false) {
SkASSERT(SkToBool(fDC) && SkToBool(fRecorder));
fRecorder->registerDevice(this);
@@ -214,6 +236,10 @@ const Transform& Device::localToDeviceTransform() {
return fCachedLocalToDevice;
}
+SkStrikeDeviceInfo Device::strikeDeviceInfo() const {
+ return {this->surfaceProps(), this->scalerContextFlags(), &fSDFTControl};
+}
+
SkBaseDevice* Device::onCreateDevice(const CreateInfo& info, const SkPaint*) {
// TODO: Inspect the paint and create info to determine if there's anything that has to be
// modified to support inline subpasses.
@@ -417,28 +443,44 @@ void Device::drawPaint(const SkPaint& paint) {
return;
}
Rect localCoveringBounds = localToDevice.inverseMapRect(fClip.conservativeBounds());
- this->drawShape(Shape(localCoveringBounds), paint, kFillStyle,
- DrawFlags::kIgnorePathEffect | DrawFlags::kIgnoreMaskFilter);
+ this->drawGeometry(localToDevice, Geometry(Shape(localCoveringBounds)), paint, kFillStyle,
+ DrawFlags::kIgnorePathEffect | DrawFlags::kIgnoreMaskFilter);
}
void Device::drawRect(const SkRect& r, const SkPaint& paint) {
- this->drawShape(Shape(r), paint, SkStrokeRec(paint));
+ this->drawGeometry(this->localToDeviceTransform(), Geometry(Shape(r)),
+ paint, SkStrokeRec(paint));
+}
+
+void Device::drawVertices(const SkVertices* vertices, sk_sp<SkBlender> blender,
+ const SkPaint& paint, bool skipColorXform) {
+ // TODO - Add GPU handling of skipColorXform once Graphite has its color system more fleshed out.
+ this->drawGeometry(this->localToDeviceTransform(),
+ Geometry(sk_ref_sp(vertices)),
+ paint,
+ kFillStyle,
+ DrawFlags::kIgnorePathEffect | DrawFlags::kIgnoreMaskFilter,
+ std::move(blender),
+ skipColorXform);
}
void Device::drawOval(const SkRect& oval, const SkPaint& paint) {
// TODO: This has wasted effort from the SkCanvas level since it instead converts rrects that
// happen to be ovals into this, only for us to go right back to rrect.
- this->drawShape(Shape(SkRRect::MakeOval(oval)), paint, SkStrokeRec(paint));
+ this->drawGeometry(this->localToDeviceTransform(), Geometry(Shape(SkRRect::MakeOval(oval))),
+ paint, SkStrokeRec(paint));
}
void Device::drawRRect(const SkRRect& rr, const SkPaint& paint) {
- this->drawShape(Shape(rr), paint, SkStrokeRec(paint));
+ this->drawGeometry(this->localToDeviceTransform(), Geometry(Shape(rr)),
+ paint, SkStrokeRec(paint));
}
void Device::drawPath(const SkPath& path, const SkPaint& paint, bool pathIsMutable) {
// TODO: If we do try to inspect the path, it should happen here and possibly after computing
// the path effect. Alternatively, all that should be handled in SkCanvas.
- this->drawShape(Shape(path), paint, SkStrokeRec(paint));
+ this->drawGeometry(this->localToDeviceTransform(), Geometry(Shape(path)),
+ paint, SkStrokeRec(paint));
}
void Device::drawPoints(SkCanvas::PointMode mode, size_t count,
@@ -452,9 +494,12 @@ void Device::drawPoints(SkCanvas::PointMode mode, size_t count,
points[i].fX + radius, points[i].fY + radius);
// drawOval/drawRect with a forced fill style
if (paint.getStrokeCap() == SkPaint::kRound_Cap) {
- this->drawShape(Shape(SkRRect::MakeOval(pointRect)), paint, kFillStyle);
+ this->drawGeometry(this->localToDeviceTransform(),
+ Geometry(Shape(SkRRect::MakeOval(pointRect))),
+ paint, kFillStyle);
} else {
- this->drawShape(Shape(pointRect), paint, kFillStyle);
+ this->drawGeometry(this->localToDeviceTransform(), Geometry(Shape(pointRect)),
+ paint, kFillStyle);
}
}
} else {
@@ -462,7 +507,9 @@ void Device::drawPoints(SkCanvas::PointMode mode, size_t count,
SkStrokeRec stroke(paint, SkPaint::kStroke_Style);
size_t inc = (mode == SkCanvas::kLines_PointMode) ? 2 : 1;
for (size_t i = 0; i < count; i += inc) {
- this->drawShape(Shape(points[i], points[(i + 1) % count]), paint, stroke);
+ this->drawGeometry(this->localToDeviceTransform(),
+ Geometry(Shape(points[i], points[(i + 1) % count])),
+ paint, stroke);
}
}
}
@@ -499,10 +546,17 @@ void Device::drawImageRect(const SkImage* image, const SkRect* src, const SkRect
}
}
+ auto [ imageToDraw, newSampling ] = skgpu::graphite::GetGraphiteBacked(this->recorder(),
+ image, sampling);
+ if (!imageToDraw) {
+ SKGPU_LOG_W("Device::drawImageRect: Creation of Graphite-backed image failed");
+ return;
+ }
+
// construct a shader, so we can call drawRect with the dst
- auto s = make_img_shader_for_paint(paint, sk_ref_sp(image), tmpSrc,
+ auto s = make_img_shader_for_paint(paint, std::move(imageToDraw), tmpSrc,
SkTileMode::kClamp, SkTileMode::kClamp,
- sampling, &matrix);
+ newSampling, &matrix);
if (!s) {
return;
}
@@ -515,11 +569,63 @@ void Device::drawImageRect(const SkImage* image, const SkRect* src, const SkRect
this->drawRect(tmpDst, paintWithShader);
}
-void Device::drawShape(const Shape& shape,
- const SkPaint& paint,
- const SkStrokeRec& style,
- SkEnumBitMask<DrawFlags> flags) {
- const Transform& localToDevice = this->localToDeviceTransform();
+void Device::onDrawGlyphRunList(SkCanvas* canvas,
+ const sktext::GlyphRunList& glyphRunList,
+ const SkPaint& initialPaint,
+ const SkPaint& drawingPaint) {
+ fRecorder->priv().textBlobCache()->drawGlyphRunList(canvas,
+ this->localToDevice(),
+ glyphRunList,
+ drawingPaint,
+ this->strikeDeviceInfo(),
+ this);
+}
+
+void Device::drawAtlasSubRun(const sktext::gpu::AtlasSubRun* subRun,
+ SkPoint drawOrigin,
+ const SkPaint& paint,
+ sk_sp<SkRefCnt> subRunStorage) {
+ // TODO: This exercises the glyph uploads but still needs work for rendering.
+
+ const int subRunEnd = subRun->glyphCount();
+ for (int subRunCursor = 0; subRunCursor < subRunEnd;) {
+ // For the remainder of the run, add any atlas uploads to the Recorder's AtlasManager
+ auto[ok, glyphsRegenerated] = subRun->regenerateAtlas(subRunCursor, subRunEnd, fRecorder);
+ // There was a problem allocating the glyph in the atlas. Bail.
+ if (!ok) {
+ return;
+ }
+ if (glyphsRegenerated) {
+ auto [bounds, localToDevice] = subRun->boundsAndDeviceMatrix(
+ this->localToDeviceTransform(), drawOrigin);
+ this->drawGeometry(localToDevice,
+ Geometry(SubRunData(subRun, std::move(subRunStorage),
+ bounds, subRunCursor, glyphsRegenerated,
+ fRecorder)),
+ paint,
+ kFillStyle,
+ DrawFlags::kIgnorePathEffect | DrawFlags::kIgnoreMaskFilter);
+ }
+ subRunCursor += glyphsRegenerated;
+
+ if (subRunCursor < subRunEnd) {
+ // Flush if not all the glyphs are handled because the atlas is out of space.
+ // We flush every Device because the glyphs that are being flushed/referenced are not
+ // necessarily specific to this Device. This addresses both multiple SkSurfaces within
+ // a Recorder, and nested layers.
+ ATRACE_ANDROID_FRAMEWORK_ALWAYS("Atlas full");
+ fRecorder->priv().flushTrackedDevices();
+ }
+ }
+}
+
+void Device::drawGeometry(const Transform& localToDevice,
+ const Geometry& geometry,
+ const SkPaint& paint,
+ const SkStrokeRec& style,
+ SkEnumBitMask<DrawFlags> flags,
+ sk_sp<SkBlender> primitiveBlender,
+ bool skipColorXform) {
if (!localToDevice.valid()) {
// If the transform is not invertible or not finite then drawing isn't well defined.
SKGPU_LOG_W("Skipping draw with non-invertible/non-finite transform.");
@@ -529,20 +635,29 @@ void Device::drawShape(const Shape& shape,
// Heavy weight paint options like path effects, mask filters, and stroke-and-fill style are
// applied on the CPU by generating a new shape and recursing on drawShape() with updated flags
if (!(flags & DrawFlags::kIgnorePathEffect) && paint.getPathEffect()) {
- // Apply the path effect before anything else
+ // Apply the path effect before anything else, which if we are applying here, means that we
+ // are dealing with a Shape. drawVertices (and a SkVertices geometry) should pass in
+ // kIgnorePathEffect per SkCanvas spec. Text geometry also should pass in kIgnorePathEffect
+ // because the path effect is applied per glyph by the SkStrikeSpec already.
+ SkASSERT(geometry.isShape());
+
// TODO: If asADash() returns true and the base path matches the dashing fast path, then
// that should be detected now as well. Maybe add dashPath to Device so canvas can handle it
SkStrokeRec newStyle = style;
newStyle.setResScale(localToDevice.maxScaleFactor());
SkPath dst;
- if (paint.getPathEffect()->filterPath(&dst, shape.asPath(), &newStyle,
+ if (paint.getPathEffect()->filterPath(&dst, geometry.shape().asPath(), &newStyle,
nullptr, localToDevice)) {
// Recurse using the path and new style, while disabling downstream path effect handling
- this->drawShape(Shape(dst), paint, newStyle, flags | DrawFlags::kIgnorePathEffect);
+ this->drawGeometry(localToDevice, Geometry(Shape(dst)), paint, style,
+ flags | DrawFlags::kIgnorePathEffect, std::move(primitiveBlender),
+ skipColorXform);
return;
} else {
SKGPU_LOG_W("Path effect failed to apply, drawing original path.");
- this->drawShape(shape, paint, style, flags | DrawFlags::kIgnorePathEffect);
+ this->drawGeometry(localToDevice, geometry, paint, style,
+ flags | DrawFlags::kIgnorePathEffect, std::move(primitiveBlender),
+ skipColorXform);
return;
}
}
@@ -551,7 +666,19 @@ void Device::drawShape(const Shape& shape,
// TODO: Handle mask filters, ignored for the sprint.
// TODO: Could this be handled by SkCanvas by drawing a mask, blurring, and then sampling
// with a rect draw? What about fast paths for rrect blur masks...
- this->drawShape(shape, paint, style, flags | DrawFlags::kIgnoreMaskFilter);
+ this->drawGeometry(localToDevice, geometry, paint, style,
+ flags | DrawFlags::kIgnoreMaskFilter, std::move(primitiveBlender),
+ skipColorXform);
+ return;
+ }
+
+ // TODO: The tessellating path renderers haven't implemented perspective yet, so transform to
+ // device space so we draw something approximately correct (barring local coord issues).
+ if (geometry.isShape() && localToDevice.type() == Transform::Type::kProjection) {
+ SkPath devicePath = geometry.shape().asPath();
+ devicePath.transform(localToDevice.matrix().asM33());
+ this->drawGeometry(Transform::Identity(), Geometry(Shape(devicePath)), paint, style, flags,
+ std::move(primitiveBlender), skipColorXform);
return;
}
@@ -566,18 +693,42 @@ void Device::drawShape(const Shape& shape,
SkASSERT(!SkToBool(paint.getMaskFilter()) || (flags & DrawFlags::kIgnoreMaskFilter));
// Check if we have room to record into the current list before determining clipping and order
- const SkStrokeRec::Style styleType = style.getStyle();
+ SkStrokeRec::Style styleType = style.getStyle();
if (this->needsFlushBeforeDraw(styleType == SkStrokeRec::kStrokeAndFill_Style ? 2 : 1)) {
this->flushPendingWorkToRecorder();
}
DrawOrder order(fCurrentDepth.next());
auto [clip, clipOrder] = fClip.applyClipToDraw(
- fColorDepthBoundsManager.get(), localToDevice, shape, style, order.depth());
+ fColorDepthBoundsManager.get(), localToDevice, geometry, style, order.depth());
if (clip.drawBounds().isEmptyNegativeOrNaN()) {
// Clipped out, so don't record anything
return;
}
+ // Some Renderer decisions are based on estimated fill rate, which requires the clipped bounds.
+ // Since the fallbacks shouldn't change the bounds of the draw, it's okay to have evaluated the
+ // clip stack before calling ChooseRenderer.
+ const Renderer* renderer = ChooseRenderer(geometry, clip, style);
+ if (!renderer) {
+ SKGPU_LOG_W("Skipping draw with no supported renderer.");
+ return;
+ }
+
+#if defined(SK_DEBUG)
+ // Renderers and their component RenderSteps have flexibility in defining their
+ // DepthStencilSettings. However, the clipping and ordering managed between Device and ClipStack
+ // requires that only GREATER or GEQUAL depth tests are used for draws recorded through the
+ // client-facing, painters-order-oriented API. We assert here vs. in Renderer's constructor to
+ // allow internal-oriented Renderers that are never selected for a "regular" draw call to have
+ // more flexibility in their settings.
+ for (const RenderStep* step : renderer->steps()) {
+ auto dss = step->depthStencilSettings();
+ SkASSERT((!step->performsShading() || dss.fDepthTestEnabled) &&
+ (!dss.fDepthTestEnabled ||
+ dss.fDepthCompareOp == CompareOp::kGreater ||
+ dss.fDepthCompareOp == CompareOp::kGEqual));
+ }
+#endif
// A draw's order always depends on the clips that must be drawn before it
order.dependsOnPaintersOrder(clipOrder);
@@ -585,77 +736,138 @@ void Device::drawShape(const Shape& shape,
// If a draw is not opaque, it must be drawn after the most recent draw it intersects with in
// order to blend correctly. We always query the most recent draw (even when opaque) because it
// also lets Device easily track whether or not there are any overlapping draws.
- PaintParams shading{paint};
- const bool dependsOnDst = paint_depends_on_dst(shading);
+ PaintParams shading{paint, std::move(primitiveBlender), skipColorXform};
+ const bool dependsOnDst = renderer->emitsCoverage() || paint_depends_on_dst(shading);
CompressedPaintersOrder prevDraw =
fColorDepthBoundsManager->getMostRecentDraw(clip.drawBounds());
if (dependsOnDst) {
order.dependsOnPaintersOrder(prevDraw);
}
+ // Now that the base paint order and draw bounds are finalized, if the Renderer relies on the
+ // stencil attachment, we compute a secondary sorting field to allow disjoint draws to reorder
+ // the RenderSteps across draws instead of in sequence for each draw.
+ if (renderer->depthStencilFlags() & DepthStencilFlags::kStencil) {
+ DisjointStencilIndex setIndex = fDisjointStencilSet->add(order.paintOrder(),
+ clip.drawBounds());
+ order.dependsOnStencil(setIndex);
+ }
+
if (styleType == SkStrokeRec::kStroke_Style ||
styleType == SkStrokeRec::kHairline_Style ||
styleType == SkStrokeRec::kStrokeAndFill_Style) {
+ // For stroke-and-fill, 'renderer' is used for the fill and we always use the
+ // TessellatedStrokes renderer; for stroke and hairline, 'renderer' is used.
StrokeStyle stroke(style.getWidth(), style.getMiter(), style.getJoin(), style.getCap());
- this->recordDraw(localToDevice, shape, clip, order, &shading, &stroke);
+ fDC->recordDraw(styleType == SkStrokeRec::kStrokeAndFill_Style ?
+ Renderer::TessellatedStrokes() : *renderer,
+ localToDevice, geometry, clip, order, &shading, &stroke);
}
if (styleType == SkStrokeRec::kFill_Style ||
styleType == SkStrokeRec::kStrokeAndFill_Style) {
- this->recordDraw(localToDevice, shape, clip, order, &shading, nullptr);
+ fDC->recordDraw(*renderer, localToDevice, geometry, clip, order, &shading, nullptr);
}
- // Record the painters order and depth used for this draw
- // TODO: If recordDraw picked a coverage AA renderer, 'dependsOnDst' is out of date.
- const bool fullyOpaque = !dependsOnDst &&
- clipOrder == DrawOrder::kNoIntersection &&
- shape.isRect() &&
- localToDevice.type() <= Transform::Type::kRectStaysRect;
- fColorDepthBoundsManager->recordDraw(clip.drawBounds(),
- order.paintOrder(),
- order.depth(),
- fullyOpaque);
+ // TODO: If 'fullyOpaque' is true, it might be useful to store the draw bounds and Z in a
+ // special occluders list for filtering the DrawList/DrawPass when flushing.
+ // const bool fullyOpaque = !dependsOnDst &&
+ // clipOrder == DrawOrder::kNoIntersection &&
+ // shape.isRect() &&
+ // localToDevice.type() <= Transform::Type::kRectStaysRect;
+ // Post-draw book keeping (bounds manager, depth tracking, etc.)
+ fColorDepthBoundsManager->recordDraw(clip.drawBounds(), order.paintOrder());
fCurrentDepth = order.depth();
fDrawsOverlap |= (prevDraw != DrawOrder::kNoIntersection);
}
-void Device::recordDraw(const Transform& localToDevice,
- const Shape& shape,
- const Clip& clip,
- DrawOrder ordering,
- const PaintParams* paint,
- const StrokeStyle* stroke) {
- // TODO: remove after CPU-transform fallbacks are no longer needed
- static const Transform kIdentity{SkM44()};
+void Device::drawClipShape(const Transform& localToDevice,
+ const Shape& shape,
+ const Clip& clip,
+ DrawOrder order) {
+ // This call represents one of the deferred clip shapes that's already pessimistically counted
+ // in needsFlushBeforeDraw(), so the DrawContext should have room to add it.
+ SkASSERT(fDC->pendingDrawCount() + 1 < DrawList::kMaxDraws);
- // TODO: The tessellating path renderers haven't implemented perspective yet, so transform to
- // device space so we draw something approximately correct (barring local coord issues).
+ // A clip draw's state is almost fully defined by the ClipStack. The only thing we need
+ // to account for is selecting a Renderer and tracking the stencil buffer usage.
+ Geometry geometry{shape};
+ const Renderer* renderer = ChooseRenderer(geometry, clip, kFillStyle);
+ if (!renderer) {
+ SKGPU_LOG_W("Skipping clip with no supported path renderer.");
+ return;
+ } else if (renderer->depthStencilFlags() & DepthStencilFlags::kStencil) {
+ DisjointStencilIndex setIndex = fDisjointStencilSet->add(order.paintOrder(),
+ clip.drawBounds());
+ order.dependsOnStencil(setIndex);
+ }
+
+ // Clips draws are depth-only (null PaintParams), and filled (null StrokeStyle).
+ // TODO: Remove this CPU-transform once perspective is supported for all path renderers
if (localToDevice.type() == Transform::Type::kProjection) {
- SkPath devicePath = shape.asPath();
+ SkPath devicePath = geometry.shape().asPath();
devicePath.transform(localToDevice.matrix().asM33());
- this->recordDraw(kIdentity, Shape(devicePath), clip, ordering, paint, nullptr);
- return;
+ fDC->recordDraw(*renderer, Transform::Identity(), Geometry(Shape(devicePath)), clip, order,
+ nullptr, nullptr);
+ } else {
+ fDC->recordDraw(*renderer, localToDevice, geometry, clip, order, nullptr, nullptr);
+ }
+ // This ensures that draws recorded after this clip shape has been popped off the stack will
+ // be unaffected by the Z value the clip shape wrote to the depth attachment.
+ if (order.depth() > fCurrentDepth) {
+ fCurrentDepth = order.depth();
+ }
+}
+
+const Renderer* Device::ChooseRenderer(const Geometry& geometry,
+ const Clip& clip,
+ const SkStrokeRec& style) {
+ SkStrokeRec::Style type = style.getStyle();
+
+ if (geometry.isSubRun()) {
+ return geometry.subRunData().subRun()->renderer();
+ } else if (geometry.isVertices()) {
+ SkVerticesPriv info(geometry.vertices()->priv());
+ return &Renderer::Vertices(info.mode(), info.hasColors(), info.hasTexCoords());
+ }
+
+ if (!geometry.isShape()) {
+ // TODO: Other Geometry types will have pretty specific Renderers
+ return nullptr;
}
- // TODO: Eventually the Renderer selection logic should be lifted to some external
- // RendererSelector that can be reused between Device and other wrappers around DrawContext.
// TODO: All shapes that select a tessellating path renderer need to be "pre-chopped" if they
- // are large enough to exceed the fixed count tessellation limits.
- const Renderer* renderer = nullptr;
+ // are large enough to exceed the fixed count tessellation limits. Fills are pre-chopped to the
+ // viewport bounds, strokes and stroke-and-fills are pre-chopped to the viewport bounds outset
+ // by the stroke radius (hence taking the whole style and not just its type).
- if (stroke) {
+ if (type == SkStrokeRec::kStroke_Style ||
+ type == SkStrokeRec::kHairline_Style) {
+ // Unlike in Ganesh, the HW stroke tessellator can work with arbitrary paints since the
+ // depth test prevents double-blending when there is transparency, thus we can HW stroke
+ // any path regardless of its paint.
// TODO: We treat inverse-filled strokes as regular strokes. We could handle them by
// stenciling first with the HW stroke tessellator and then covering their bounds, but
// inverse-filled strokes are not well-specified in our public canvas behavior so we may be
// able to remove it.
- // Unlike in Ganesh, the HW stroke tessellator can work with arbitrary paints since the
- // depth test prevents double-blending when there is transparency, thus we can HW stroke
- // any path regardless of its paint.
- renderer = &Renderer::TessellatedStrokes();
- } else if (shape.convex() && !shape.inverted()) {
+ // TODO: For non-stroke-and-fill strokes, we may add coverage-AA renderers for primitives
+ // that we want to avoid triggering MSAA on.
+ return &Renderer::TessellatedStrokes();
+ }
+
+ // TODO: stroke-and-fill returns the fill renderer, but if there is ever a case where a shape
+ // can't be stroked with the TessellatedStrokes renderer, we should return null even if we there
+ // is a valid renderer for the fill. Additionally, if we have coverage-AA renderers for filled
+ // primitives to avoid triggering MSAA, we do NOT want to select them for stroke-and-fill or
+ // we'll add AA seams where the separate fill and stroke draws overlap.
+ //
+ // For now, neither of these cases apply so stroke-and-fill and fill are handled the same.
+
+ const Shape& shape = geometry.shape();
+ if (shape.convex() && !shape.inverted()) {
// TODO: Ganesh doesn't have a curve+middle-out triangles option for convex paths, but it
// would be pretty trivial to spin up.
- renderer = &Renderer::ConvexTessellatedWedges();
+ return &Renderer::ConvexTessellatedWedges();
} else {
// TODO: Combine this heuristic with what is used in PathStencilCoverOp to choose between
// wedges curves consistently in Graphite and Ganesh.
@@ -663,26 +875,11 @@ void Device::recordDraw(const Transform& localToDevice,
clip.drawBounds().area() <= (256 * 256);
if (preferWedges) {
- renderer = &Renderer::StencilTessellatedWedges(shape.fillType());
+ return &Renderer::StencilTessellatedWedges(shape.fillType());
} else {
- renderer = &Renderer::StencilTessellatedCurvesAndTris(shape.fillType());
+ return &Renderer::StencilTessellatedCurvesAndTris(shape.fillType());
}
}
-
- if (!renderer) {
- SKGPU_LOG_W("Skipping draw with no supported path renderer.");
- return;
- }
-
- if (renderer->depthStencilFlags() & DepthStencilFlags::kStencil) {
- DisjointStencilIndex setIndex = fDisjointStencilSet->add(ordering.paintOrder(),
- clip.drawBounds());
- ordering.dependsOnStencil(setIndex);
- }
- // TODO: if the chosen Renderer uses coverage AA, then 'ordering' depends on painter's order,
- // so we will need to take into account the previous draw. Since no Renderer uses coverage AA
- // right now, it's not an issue yet.
- fDC->recordDraw(*renderer, localToDevice, shape, clip, ordering, paint, stroke);
}
void Device::flushPendingWorkToRecorder() {
@@ -691,13 +888,19 @@ void Device::flushPendingWorkToRecorder() {
// TODO: we may need to further split this function up since device->device drawList and
// DrawPass stealing will need to share some of the same logic w/o becoming a Task.
+ // push any pending uploads from the atlasmanager
+ auto atlasManager = fRecorder->priv().atlasManager();
+ if (!atlasManager->recordUploads(fDC.get())) {
+ SKGPU_LOG_E("AtlasManager uploads have failed -- may see invalid results.");
+ }
+
auto uploadTask = fDC->snapUploadTask(fRecorder);
if (uploadTask) {
fRecorder->priv().add(std::move(uploadTask));
}
fClip.recordDeferredClipDraws();
- auto drawTask = fDC->snapRenderPassTask(fRecorder, fColorDepthBoundsManager.get());
+ auto drawTask = fDC->snapRenderPassTask(fRecorder);
if (drawTask) {
fRecorder->priv().add(std::move(drawTask));
}
diff --git a/chromium/third_party/skia/src/gpu/graphite/Device.h b/chromium/third_party/skia/src/gpu/graphite/Device.h
index 6afa4df2544..79f64b6eb14 100644
--- a/chromium/third_party/skia/src/gpu/graphite/Device.h
+++ b/chromium/third_party/skia/src/gpu/graphite/Device.h
@@ -15,17 +15,29 @@
#include "src/gpu/graphite/DrawOrder.h"
#include "src/gpu/graphite/geom/Rect.h"
#include "src/gpu/graphite/geom/Transform_graphite.h"
+#include "src/text/gpu/SDFTControl.h"
+#include "src/text/gpu/SubRunContainer.h"
class SkStrokeRec;
+namespace {
+class DirectMaskSubRun;
+class TransformedMaskSubRun;
+class SDFTSubRun;
+}
+
+namespace sktext::gpu { class AtlasSubRun; }
+
namespace skgpu::graphite {
class BoundsManager;
class Clip;
class Context;
class DrawContext;
+class Geometry;
class PaintParams;
class Recorder;
+class Renderer;
class Shape;
class StrokeStyle;
class TextureProxy;
@@ -56,6 +68,8 @@ public:
const Transform& localToDeviceTransform();
+ SkStrikeDeviceInfo strikeDeviceInfo() const override;
+
#if GRAPHITE_TEST_UTILS
TextureProxy* proxy();
#endif
@@ -108,6 +122,9 @@ private:
bool onWritePixels(const SkPixmap&, int x, int y) override;
+ void onDrawGlyphRunList(SkCanvas*, const sktext::GlyphRunList&,
+ const SkPaint&, const SkPaint&) override;
+
// TODO: This will likely be implemented with the same primitive building block that drawRect
// and drawRRect will rely on.
void drawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
@@ -130,11 +147,9 @@ private:
const SkPaint&) override {}
void drawDrawable(SkCanvas*, SkDrawable*, const SkMatrix*) override {}
- void drawVertices(const SkVertices*, sk_sp<SkBlender>, const SkPaint&, bool) override {}
+ void drawVertices(const SkVertices*, sk_sp<SkBlender>, const SkPaint&, bool) override;
void drawMesh(const SkMesh&, sk_sp<SkBlender>, const SkPaint&) override {}
void drawShadow(const SkPath&, const SkDrawShadowRec&) override {}
- void onDrawGlyphRunList(
- SkCanvas*, const SkGlyphRunList&, const SkPaint&, const SkPaint&) override {}
void drawDevice(SkBaseDevice*, const SkSamplingOptions&, const SkPaint&) override {}
void drawSpecial(SkSpecialImage*, const SkMatrix& localToDevice,
@@ -146,17 +161,17 @@ private:
// DrawFlags alters the effects used by drawShape.
enum class DrawFlags : unsigned {
- kNone = 0b00,
+ kNone = 0b000,
- // Any SkMaskFilter on the SkPaint passed into drawShape() is ignored.
+ // Any SkMaskFilter on the SkPaint passed into drawGeometry() is ignored.
// - drawPaint, drawVertices, drawAtlas
// - drawShape after it's applied the mask filter.
- kIgnoreMaskFilter = 0b01,
+ kIgnoreMaskFilter = 0b001,
- // Any SkPathEffect on the SkPaint passed into drawShape() is ignored.
+ // Any SkPathEffect on the SkPaint passed into drawGeometry() is ignored.
// - drawPaint, drawImageLattice, drawImageRect, drawEdgeAAImageSet, drawVertices, drawAtlas
// - drawShape after it's applied the path effect.
- kIgnorePathEffect = 0b10,
+ kIgnorePathEffect = 0b010,
};
SK_DECL_BITMASK_OPS_FRIENDS(DrawFlags);
@@ -164,17 +179,35 @@ private:
// Handles applying path effects, mask filters, stroke-and-fill styles, and hairlines.
// Ignores geometric style on the paint in favor of explicitly provided SkStrokeRec and flags.
- void drawShape(const Shape&,
- const SkPaint&,
- const SkStrokeRec&,
- SkEnumBitMask<DrawFlags> = DrawFlags::kNone);
- // Lowest level draw recording where everything but Renderer has been decided.
- void recordDraw(const Transform& localToDevice,
- const Shape& shape,
- const Clip& clip,
- DrawOrder ordering,
- const PaintParams* paint,
- const StrokeStyle* stroke);
+ // All overridden SkDevice::draw() functions should bottom-out with calls to drawGeometry().
+ void drawGeometry(const Transform&,
+ const Geometry&,
+ const SkPaint&,
+ const SkStrokeRec&,
+ SkEnumBitMask<DrawFlags> = DrawFlags::kNone,
+ sk_sp<SkBlender> primitiveBlender = nullptr,
+ bool skipColorXform = false);
+
+ // Like drawGeometry() but is Shape-only, depth-only, fill-only, and lets the ClipStack define
+ // the transform, clip, and DrawOrder (although Device still tracks stencil buffer usage).
+ void drawClipShape(const Transform&, const Shape&, const Clip&, DrawOrder);
+
+ // Handles primitive processing for atlas-based text
+ void drawAtlasSubRun(const sktext::gpu::AtlasSubRun*,
+ SkPoint drawOrigin,
+ const SkPaint& paint,
+ sk_sp<SkRefCnt> subRunStorage);
+
+ // Returns the Renderer to draw the shape in the given style. If SkStrokeRec is a
+ // stroke-and-fill, this returns the Renderer used for the fill portion and it can be assumed
+ // that Renderer::TessellatedStrokes() will be used for the stroke portion.
+ //
+ // TODO: Renderers may have fallbacks (e.g. pre-chop large paths, or convert stroke to fill).
+ // Are those handled inside ChooseRenderer() where it can modify the shape, stroke? or does it
+ // return a retry error code? or does drawGeometry() handle all the fallbacks, knowing that
+ // a particular shape type needs to be pre-chopped?
+ // TODO: Move this into a RendererSelector object provided by the Context.
+ static const Renderer* ChooseRenderer(const Geometry&, const Clip&, const SkStrokeRec&);
bool needsFlushBeforeDraw(int numNewDraws) const;
@@ -195,9 +228,14 @@ private:
// The max depth value sent to the DrawContext, incremented so each draw has a unique value.
PaintersDepth fCurrentDepth;
+ const sktext::gpu::SDFTControl fSDFTControl;
+
bool fDrawsOverlap;
friend class ClipStack; // for recordDraw
+ friend class ::DirectMaskSubRun; // for drawAtlasSubRun
+ friend class ::TransformedMaskSubRun; // for drawAtlasSubRun
+ friend class ::SDFTSubRun; // for drawAtlasSubRun
};
SK_MAKE_BITMASK_OPS(Device::DrawFlags)
diff --git a/chromium/third_party/skia/src/gpu/graphite/DrawAtlas.cpp b/chromium/third_party/skia/src/gpu/graphite/DrawAtlas.cpp
new file mode 100644
index 00000000000..f8d4b367dc6
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/DrawAtlas.cpp
@@ -0,0 +1,502 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "src/gpu/graphite/DrawAtlas.h"
+
+#include <memory>
+
+#include "include/gpu/graphite/Recorder.h"
+#include "include/private/SkTPin.h"
+#include "src/core/SkMathPriv.h"
+#include "src/core/SkOpts.h"
+#include "src/core/SkTraceEvent.h"
+#include "src/gpu/AtlasTypes.h"
+#include "src/gpu/graphite/Caps.h"
+#include "src/gpu/graphite/CommandTypes.h"
+#include "src/gpu/graphite/DrawContext.h"
+#include "src/gpu/graphite/RecorderPriv.h"
+#include "src/gpu/graphite/TextureProxy.h"
+
+namespace skgpu::graphite {
+
+#if defined(DUMP_ATLAS_DATA)
+static const constexpr bool kDumpAtlasData = true;
+#else
+static const constexpr bool kDumpAtlasData = false;
+#endif
+
+#ifdef SK_DEBUG
+void DrawAtlas::validate(const AtlasLocator& atlasLocator) const {
+ // Verify that the plotIndex stored in the PlotLocator is consistent with the glyph rectangle
+ int numPlotsX = fTextureWidth / fPlotWidth;
+ int numPlotsY = fTextureHeight / fPlotHeight;
+
+ int plotIndex = atlasLocator.plotIndex();
+ auto topLeft = atlasLocator.topLeft();
+ int plotX = topLeft.x() / fPlotWidth;
+ int plotY = topLeft.y() / fPlotHeight;
+ SkASSERT(plotIndex == (numPlotsY - plotY - 1) * numPlotsX + (numPlotsX - plotX - 1));
+}
+#endif
+
+std::unique_ptr<DrawAtlas> DrawAtlas::Make(SkColorType colorType, size_t bpp, int width,
+ int height, int plotWidth, int plotHeight,
+ AtlasGenerationCounter* generationCounter,
+ AllowMultitexturing allowMultitexturing,
+ PlotEvictionCallback* evictor,
+ std::string_view label) {
+ std::unique_ptr<DrawAtlas> atlas(new DrawAtlas(colorType, bpp, width, height,
+ plotWidth, plotHeight, generationCounter,
+ allowMultitexturing, label));
+
+ if (evictor != nullptr) {
+ atlas->fEvictionCallbacks.emplace_back(evictor);
+ }
+ return atlas;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+DrawAtlas::DrawAtlas(SkColorType colorType, size_t bpp, int width, int height,
+ int plotWidth, int plotHeight, AtlasGenerationCounter* generationCounter,
+ AllowMultitexturing allowMultitexturing, std::string_view label)
+ : fColorType(colorType)
+ , fBytesPerPixel(bpp)
+ , fTextureWidth(width)
+ , fTextureHeight(height)
+ , fPlotWidth(plotWidth)
+ , fPlotHeight(plotHeight)
+ , fLabel(label)
+ , fGenerationCounter(generationCounter)
+ , fAtlasGeneration(fGenerationCounter->next())
+ , fPrevFlushToken(DrawToken::AlreadyFlushedToken())
+ , fFlushesSinceLastUse(0)
+ , fMaxPages(AllowMultitexturing::kYes == allowMultitexturing ?
+ PlotLocator::kMaxMultitexturePages : 1)
+ , fNumActivePages(0) {
+ int numPlotsX = width/plotWidth;
+ int numPlotsY = height/plotHeight;
+ SkASSERT(numPlotsX * numPlotsY <= PlotLocator::kMaxPlots);
+ SkASSERT(fPlotWidth * numPlotsX == fTextureWidth);
+ SkASSERT(fPlotHeight * numPlotsY == fTextureHeight);
+
+ fNumPlots = numPlotsX * numPlotsY;
+
+ this->createPages(generationCounter);
+}
+
+inline void DrawAtlas::processEviction(PlotLocator plotLocator) {
+ for (PlotEvictionCallback* evictor : fEvictionCallbacks) {
+ evictor->evict(plotLocator);
+ }
+
+ fAtlasGeneration = fGenerationCounter->next();
+}
+
+inline bool DrawAtlas::updatePlot(AtlasLocator* atlasLocator, Plot* plot) {
+ int pageIdx = plot->pageIndex();
+ this->makeMRU(plot, pageIdx);
+
+ // The actual upload will be created in recordUploads().
+
+ atlasLocator->updatePlotLocator(plot->plotLocator());
+ SkDEBUGCODE(this->validate(*atlasLocator);)
+ return true;
+}
+
+bool DrawAtlas::addToPage(unsigned int pageIdx, int width, int height, const void* image,
+ AtlasLocator* atlasLocator) {
+ SkASSERT(fProxies[pageIdx]);
+
+ // look through all allocated plots for one we can share, in Most Recently Refed order
+ PlotList::Iter plotIter;
+ plotIter.init(fPages[pageIdx].fPlotList, PlotList::Iter::kHead_IterStart);
+
+ for (Plot* plot = plotIter.get(); plot; plot = plotIter.next()) {
+ if (plot->addSubImage(width, height, image, atlasLocator)) {
+ return this->updatePlot(atlasLocator, plot);
+ }
+ }
+
+ return false;
+}
+
+bool DrawAtlas::recordUploads(DrawContext* dc, Recorder* recorder) {
+ TRACE_EVENT0("skia.gpu", TRACE_FUNC);
+ for (uint32_t pageIdx = 0; pageIdx < fNumActivePages; ++pageIdx) {
+ PlotList::Iter plotIter;
+ plotIter.init(fPages[pageIdx].fPlotList, PlotList::Iter::kHead_IterStart);
+ for (Plot* plot = plotIter.get(); plot; plot = plotIter.next()) {
+ if (plot->needsUpload()) {
+ TextureProxy* proxy = fProxies[pageIdx].get();
+ SkASSERT(proxy);
+
+ const void* dataPtr;
+ SkIRect dstRect;
+ std::tie(dataPtr, dstRect) = plot->prepareForUpload();
+
+ std::vector<MipLevel> levels;
+ levels.push_back({dataPtr, fBytesPerPixel*fPlotWidth});
+
+ if (!dc->recordUpload(recorder, sk_ref_sp(proxy), fColorType, levels, dstRect)) {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+}
+
+// Number of atlas-related flushes beyond which we consider a plot to no longer be in use.
+//
+// This value is somewhat arbitrary -- the idea is to keep it low enough that
+// a page with unused plots will get removed reasonably quickly, but allow it
+// to hang around for a bit in case it's needed. The assumption is that flushes
+// are rare; i.e., we are not continually refreshing the frame.
+static constexpr auto kPlotRecentlyUsedCount = 32;
+static constexpr auto kAtlasRecentlyUsedCount = 128;
+
+DrawAtlas::ErrorCode DrawAtlas::addToAtlas(Recorder* recorder,
+ int width, int height, const void* image,
+ AtlasLocator* atlasLocator) {
+ if (width > fPlotWidth || height > fPlotHeight) {
+ return ErrorCode::kError;
+ }
+
+ // Look through each page to see if we can upload without having to flush
+ // We prioritize this upload to the first pages, not the most recently used, to make it easier
+ // to remove unused pages in reverse page order.
+ for (unsigned int pageIdx = 0; pageIdx < fNumActivePages; ++pageIdx) {
+ if (this->addToPage(pageIdx, width, height, image, atlasLocator)) {
+ return ErrorCode::kSucceeded;
+ }
+ }
+
+ // If the above fails, then see if the least recently used plot per page has already been
+ // queued for upload if we're at max page allocation, or if the plot has aged out otherwise.
+ // We wait until we've grown to the full number of pages to begin evicting already queued
+ // plots so that we can maximize the opportunity for reuse.
+ // As before we prioritize this upload to the first pages, not the most recently used.
+ if (fNumActivePages == this->maxPages()) {
+ for (unsigned int pageIdx = 0; pageIdx < fNumActivePages; ++pageIdx) {
+ Plot* plot = fPages[pageIdx].fPlotList.tail();
+ SkASSERT(plot);
+ if (plot->lastUseToken() < recorder->priv().tokenTracker()->nextTokenToFlush()) {
+ this->processEvictionAndResetRects(plot);
+ SkDEBUGCODE(bool verify = )plot->addSubImage(width, height, image, atlasLocator);
+ SkASSERT(verify);
+ if (!this->updatePlot(atlasLocator, plot)) {
+ return ErrorCode::kError;
+ }
+ return ErrorCode::kSucceeded;
+ }
+ }
+ } else {
+ // If we haven't activated all the available pages, try to create a new one and add to it
+ if (!this->activateNewPage(recorder)) {
+ return ErrorCode::kError;
+ }
+
+ if (this->addToPage(fNumActivePages-1, width, height, image, atlasLocator)) {
+ return ErrorCode::kSucceeded;
+ } else {
+ // If we fail to upload to a newly activated page then something has gone terribly
+ // wrong - return an error
+ return ErrorCode::kError;
+ }
+ }
+
+ if (!fNumActivePages) {
+ return ErrorCode::kError;
+ }
+
+ // All plots are currently in use by the current set of draws, so we need to fail. This
+ // gives the Device a chance to snap the current set of uploads and draws, advance the draw
+ // token, and call back into this function. The subsequent call will have plots available
+ // for fresh uploads.
+ return ErrorCode::kTryAgain;
+}
+
+void DrawAtlas::compact(DrawToken startTokenForNextFlush) {
+ if (fNumActivePages < 1) {
+ fPrevFlushToken = startTokenForNextFlush;
+ return;
+ }
+
+ // For all plots, reset number of flushes since used if used this frame.
+ PlotList::Iter plotIter;
+ bool atlasUsedThisFlush = false;
+ for (uint32_t pageIndex = 0; pageIndex < fNumActivePages; ++pageIndex) {
+ plotIter.init(fPages[pageIndex].fPlotList, PlotList::Iter::kHead_IterStart);
+ while (Plot* plot = plotIter.get()) {
+ // Reset number of flushes since used
+ if (plot->lastUseToken().inInterval(fPrevFlushToken, startTokenForNextFlush)) {
+ plot->resetFlushesSinceLastUsed();
+ atlasUsedThisFlush = true;
+ }
+
+ plotIter.next();
+ }
+ }
+
+ if (atlasUsedThisFlush) {
+ fFlushesSinceLastUse = 0;
+ } else {
+ ++fFlushesSinceLastUse;
+ }
+
+ // We only try to compact if the atlas was used in the recently completed flush or
+ // hasn't been used in a long time.
+ // This is to handle the case where a lot of text or path rendering has occurred but then just
+ // a blinking cursor is drawn.
+ if (atlasUsedThisFlush || fFlushesSinceLastUse > kAtlasRecentlyUsedCount) {
+ SkTArray<Plot*> availablePlots;
+ uint32_t lastPageIndex = fNumActivePages - 1;
+
+ // For all plots but the last one, update number of flushes since used, and check to see
+ // if there are any in the first pages that the last page can safely upload to.
+ for (uint32_t pageIndex = 0; pageIndex < lastPageIndex; ++pageIndex) {
+ if constexpr (kDumpAtlasData) {
+ SkDebugf("page %d: ", pageIndex);
+ }
+
+ plotIter.init(fPages[pageIndex].fPlotList, PlotList::Iter::kHead_IterStart);
+ while (Plot* plot = plotIter.get()) {
+ // Update number of flushes since plot was last used
+ // We only increment the 'sinceLastUsed' count for flushes where the atlas was used
+ // to avoid deleting everything when we return to text drawing in the blinking
+ // cursor case
+ if (!plot->lastUseToken().inInterval(fPrevFlushToken, startTokenForNextFlush)) {
+ plot->incFlushesSinceLastUsed();
+ }
+
+ if constexpr (kDumpAtlasData) {
+ SkDebugf("%d ", plot->flushesSinceLastUsed());
+ }
+
+ // Count plots we can potentially upload to in all pages except the last one
+ // (the potential compactee).
+ if (plot->flushesSinceLastUsed() > kPlotRecentlyUsedCount) {
+ availablePlots.push_back() = plot;
+ }
+
+ plotIter.next();
+ }
+
+ if constexpr (kDumpAtlasData) {
+ SkDebugf("\n");
+ }
+ }
+
+ // Count recently used plots in the last page and evict any that are no longer in use.
+ // Since we prioritize uploading to the first pages, this will eventually
+ // clear out usage of this page unless we have a large need.
+ plotIter.init(fPages[lastPageIndex].fPlotList, PlotList::Iter::kHead_IterStart);
+ unsigned int usedPlots = 0;
+ if constexpr (kDumpAtlasData) {
+ SkDebugf("page %d: ", lastPageIndex);
+ }
+ while (Plot* plot = plotIter.get()) {
+ // Update number of flushes since plot was last used
+ if (!plot->lastUseToken().inInterval(fPrevFlushToken, startTokenForNextFlush)) {
+ plot->incFlushesSinceLastUsed();
+ }
+
+ if constexpr (kDumpAtlasData) {
+ SkDebugf("%d ", plot->flushesSinceLastUsed());
+ }
+
+ // If this plot was used recently
+ if (plot->flushesSinceLastUsed() <= kPlotRecentlyUsedCount) {
+ usedPlots++;
+ } else if (plot->lastUseToken() != DrawToken::AlreadyFlushedToken()) {
+ // otherwise if aged out just evict it.
+ this->processEvictionAndResetRects(plot);
+ }
+ plotIter.next();
+ }
+
+ if constexpr (kDumpAtlasData) {
+ SkDebugf("\n");
+ }
+
+ // If recently used plots in the last page are using less than a quarter of the page, try
+ // to evict them if there's available space in lower index pages. Since we prioritize
+ // uploading to the first pages, this will eventually clear out usage of this page unless
+ // we have a large need.
+ if (availablePlots.count() && usedPlots && usedPlots <= fNumPlots / 4) {
+ plotIter.init(fPages[lastPageIndex].fPlotList, PlotList::Iter::kHead_IterStart);
+ while (Plot* plot = plotIter.get()) {
+ // If this plot was used recently
+ if (plot->flushesSinceLastUsed() <= kPlotRecentlyUsedCount) {
+ // See if there's room in an lower index page and if so evict.
+ // We need to be somewhat harsh here so that a handful of plots that are
+ // consistently in use don't end up locking the page in memory.
+ if (availablePlots.count() > 0) {
+ this->processEvictionAndResetRects(plot);
+ this->processEvictionAndResetRects(availablePlots.back());
+ availablePlots.pop_back();
+ --usedPlots;
+ }
+ if (!usedPlots || !availablePlots.count()) {
+ break;
+ }
+ }
+ plotIter.next();
+ }
+ }
+
+ // If none of the plots in the last page have been used recently, delete it.
+ if (!usedPlots) {
+ if constexpr (kDumpAtlasData) {
+ SkDebugf("delete %d\n", fNumActivePages-1);
+ }
+
+ this->deactivateLastPage();
+ fFlushesSinceLastUse = 0;
+ }
+ }
+
+ fPrevFlushToken = startTokenForNextFlush;
+}
+
+bool DrawAtlas::createPages(AtlasGenerationCounter* generationCounter) {
+ SkASSERT(SkIsPow2(fTextureWidth) && SkIsPow2(fTextureHeight));
+
+ int numPlotsX = fTextureWidth/fPlotWidth;
+ int numPlotsY = fTextureHeight/fPlotHeight;
+
+ for (uint32_t i = 0; i < this->maxPages(); ++i) {
+ // Proxies are uncreated at first
+ fProxies[i] = nullptr;
+
+ // set up allocated plots
+ fPages[i].fPlotArray = std::make_unique<sk_sp<Plot>[]>(numPlotsX * numPlotsY);
+
+ sk_sp<Plot>* currPlot = fPages[i].fPlotArray.get();
+ for (int y = numPlotsY - 1, r = 0; y >= 0; --y, ++r) {
+ for (int x = numPlotsX - 1, c = 0; x >= 0; --x, ++c) {
+ uint32_t plotIndex = r * numPlotsX + c;
+ currPlot->reset(new Plot(
+ i, plotIndex, generationCounter, x, y, fPlotWidth, fPlotHeight, fColorType,
+ fBytesPerPixel));
+
+ // build LRU list
+ fPages[i].fPlotList.addToHead(currPlot->get());
+ ++currPlot;
+ }
+ }
+
+ }
+
+ return true;
+}
+
+bool DrawAtlas::activateNewPage(Recorder* recorder) {
+ SkASSERT(fNumActivePages < this->maxPages());
+ SkASSERT(!fProxies[fNumActivePages]);
+
+ auto textureInfo = recorder->priv().caps()->getDefaultSampledTextureInfo(fColorType,
+ /*levelCount=*/1,
+ Protected::kNo,
+ Renderable::kNo);
+ fProxies[fNumActivePages].reset(new TextureProxy({fTextureWidth, fTextureHeight}, textureInfo,
+ SkBudgeted::kYes));
+ if (!fProxies[fNumActivePages]) {
+ return false;
+ }
+
+ if constexpr (kDumpAtlasData) {
+ SkDebugf("activated page#: %d\n", fNumActivePages);
+ }
+
+ ++fNumActivePages;
+ return true;
+}
+
+inline void DrawAtlas::deactivateLastPage() {
+ SkASSERT(fNumActivePages);
+
+ uint32_t lastPageIndex = fNumActivePages - 1;
+
+ int numPlotsX = fTextureWidth/fPlotWidth;
+ int numPlotsY = fTextureHeight/fPlotHeight;
+
+ fPages[lastPageIndex].fPlotList.reset();
+ for (int r = 0; r < numPlotsY; ++r) {
+ for (int c = 0; c < numPlotsX; ++c) {
+ uint32_t plotIndex = r * numPlotsX + c;
+
+ Plot* currPlot = fPages[lastPageIndex].fPlotArray[plotIndex].get();
+ currPlot->resetRects();
+ currPlot->resetFlushesSinceLastUsed();
+
+ // rebuild the LRU list
+ SkDEBUGCODE(currPlot->resetListPtrs());
+ fPages[lastPageIndex].fPlotList.addToHead(currPlot);
+ }
+ }
+
+ // remove ref to the texture proxy
+ fProxies[lastPageIndex].reset();
+ --fNumActivePages;
+}
+
+DrawAtlasConfig::DrawAtlasConfig(int maxTextureSize, size_t maxBytes) {
+ static const SkISize kARGBDimensions[] = {
+ {256, 256}, // maxBytes < 2^19
+ {512, 256}, // 2^19 <= maxBytes < 2^20
+ {512, 512}, // 2^20 <= maxBytes < 2^21
+ {1024, 512}, // 2^21 <= maxBytes < 2^22
+ {1024, 1024}, // 2^22 <= maxBytes < 2^23
+ {2048, 1024}, // 2^23 <= maxBytes
+ };
+
+ // Index 0 corresponds to maxBytes of 2^18, so start by dividing it by that
+ maxBytes >>= 18;
+ // Take the floor of the log to get the index
+ int index = maxBytes > 0
+ ? SkTPin<int>(SkPrevLog2(maxBytes), 0, std::size(kARGBDimensions) - 1)
+ : 0;
+
+ SkASSERT(kARGBDimensions[index].width() <= kMaxAtlasDim);
+ SkASSERT(kARGBDimensions[index].height() <= kMaxAtlasDim);
+ fARGBDimensions.set(std::min<int>(kARGBDimensions[index].width(), maxTextureSize),
+ std::min<int>(kARGBDimensions[index].height(), maxTextureSize));
+ fMaxTextureSize = std::min<int>(maxTextureSize, kMaxAtlasDim);
+}
+
+SkISize DrawAtlasConfig::atlasDimensions(MaskFormat type) const {
+ if (MaskFormat::kA8 == type) {
+ // A8 is always 2x the ARGB dimensions, clamped to the max allowed texture size
+ return { std::min<int>(2 * fARGBDimensions.width(), fMaxTextureSize),
+ std::min<int>(2 * fARGBDimensions.height(), fMaxTextureSize) };
+ } else {
+ return fARGBDimensions;
+ }
+}
+
+SkISize DrawAtlasConfig::plotDimensions(MaskFormat type) const {
+ if (MaskFormat::kA8 == type) {
+ SkISize atlasDimensions = this->atlasDimensions(type);
+ // For A8 we want to grow the plots at larger texture sizes to accept more of the
+ // larger SDF glyphs. Since the largest SDF glyph can be 170x170 with padding, this
+ // allows us to pack 3 in a 512x256 plot, or 9 in a 512x512 plot.
+
+ // This will give us 512x256 plots for 2048x1024, 512x512 plots for 2048x2048,
+ // and 256x256 plots otherwise.
+ int plotWidth = atlasDimensions.width() >= 2048 ? 512 : 256;
+ int plotHeight = atlasDimensions.height() >= 2048 ? 512 : 256;
+
+ return { plotWidth, plotHeight };
+ } else {
+ // ARGB and LCD always use 256x256 plots -- this has been shown to be faster
+ return { 256, 256 };
+ }
+}
+
+} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/DrawAtlas.h b/chromium/third_party/skia/src/gpu/graphite/DrawAtlas.h
new file mode 100644
index 00000000000..2eefb21c642
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/DrawAtlas.h
@@ -0,0 +1,263 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef skgpu_graphite_DrawAtlas_DEFINED
+#define skgpu_graphite_DrawAtlas_DEFINED
+
+#include <cmath>
+#include <string>
+#include <string_view>
+#include <vector>
+
+#include "src/core/SkIPoint16.h"
+#include "src/gpu/AtlasTypes.h"
+#include "src/gpu/RectanizerSkyline.h"
+
+namespace skgpu::graphite {
+
+class DrawContext;
+class Recorder;
+class TextureProxy;
+
+/**
+ * TODO: the process described here is tentative, and this comment revised once locked down.
+ *
+ * This class manages one or more atlas textures on behalf of primitive draws in Device. The
+ * drawing processes that use the atlas add preceding UploadTasks when generating RenderPassTasks.
+ * The class provides facilities for using DrawTokens to detect data hazards. Plots that need
+ * uploads are tracked until it is impossible to add data without overwriting texels read by draws
+ * that have not yet been snapped to a RenderPassTask. At that point, the atlas will attempt to
+ * allocate a new atlas texture (or "page") of the same size, up to a maximum number of textures,
+ * and upload to that texture. If that's not possible, then the atlas will fail to add a subimage.
+ * This gives the Device the chance to end the current draw, snap a RenderpassTask, and begin a new
+ * one. Additional uploads will then succeed.
+ *
+ * When the atlas has multiple pages, new uploads are prioritized to the lower index pages, i.e.,
+ * it will try to upload to page 0 before page 1 or 2. To keep the atlas from continually using
+ * excess space, periodic garbage collection is needed to shift data from the higher index pages to
+ * the lower ones, and then eventually remove any pages that are no longer in use. "In use" is
+ * determined by using the DrawToken system: After a DrawPass is snapped a subarea of the page, or
+ * "plot" is checked to see whether it was used in that DrawPass. If less than a quarter of the
+ * plots have been used recently (within kPlotRecentlyUsedCount iterations) and there are available
+ * plots in lower index pages, the higher index page will be deactivated, and its glyphs will
+ * gradually migrate to other pages via the usual upload system.
+ *
+ * Garbage collection is initiated by the DrawAtlas's client via the compact() method.
+ */
+class DrawAtlas {
+public:
+ /** Is the atlas allowed to use more than one texture? */
+ enum class AllowMultitexturing : bool { kNo, kYes };
+
+ /**
+ * Returns a DrawAtlas.
+ * @param ct The colorType which this atlas will store.
+ * @param bpp Size in bytes of each pixel.
+ * @param width Width in pixels of the atlas.
+ * @param height Height in pixels of the atlas.
+ * @param plotWidth The width of each plot. width/plotWidth should be an integer.
+ * @param plotWidth The height of each plot. height/plotHeight should be an integer.
+ * @param atlasGeneration A pointer to the context's generation counter.
+ * @param allowMultitexturing Can the atlas use more than one texture.
+ * @param evictor A pointer to an eviction callback class.
+ *
+ * @return An initialized DrawAtlas, or nullptr if creation fails.
+ */
+ static std::unique_ptr<DrawAtlas> Make(SkColorType ct, size_t bpp,
+ int width, int height,
+ int plotWidth, int plotHeight,
+ AtlasGenerationCounter* generationCounter,
+ AllowMultitexturing allowMultitexturing,
+ PlotEvictionCallback* evictor,
+ std::string_view label);
+
+ /**
+ * TODO: the process described here is tentative, and this comment revised once locked down.
+ *
+ * Adds a width x height subimage to the atlas. Upon success it returns 'kSucceeded' and returns
+ * the ID and the subimage's coordinates in the backing texture. 'kTryAgain' is returned if
+ * the subimage cannot fit in the atlas without overwriting texels that will be read in the
+ * current list of draws. This indicates that the Device should end its current draw, snap a
+ * DrawPass, and begin another before adding more data. 'kError' will be returned when some
+ * unrecoverable error was encountered while trying to add the subimage. In this case the draw
+ * being created should be discarded.
+ *
+ * This tracking does not generate UploadTasks per se. Instead, when the RenderPassTask is
+ * ready to be snapped, recordUploads() will be called by the Device and that will generate the
+ * necessary UploadTasks.
+ *
+ * NOTE: When a draw that reads from the atlas is added to the DrawList, the client using this
+ * DrawAtlas must immediately call 'setLastUseToken' with the currentToken from the Recorder,
+ * otherwise the next call to addToAtlas might cause the previous data to be overwritten before
+ * it has been read.
+ */
+
+ enum class ErrorCode {
+ kError,
+ kSucceeded,
+ kTryAgain
+ };
+
+ ErrorCode addToAtlas(Recorder*, int width, int height, const void* image, AtlasLocator*);
+ bool recordUploads(DrawContext*, Recorder*);
+
+ const sk_sp<TextureProxy>* getProxies() const { return fProxies; }
+
+ uint64_t atlasGeneration() const { return fAtlasGeneration; }
+
+ bool hasID(const PlotLocator& plotLocator) {
+ if (!plotLocator.isValid()) {
+ return false;
+ }
+
+ uint32_t plot = plotLocator.plotIndex();
+ uint32_t page = plotLocator.pageIndex();
+ uint64_t plotGeneration = fPages[page].fPlotArray[plot]->genID();
+ uint64_t locatorGeneration = plotLocator.genID();
+ return plot < fNumPlots && page < fNumActivePages && plotGeneration == locatorGeneration;
+ }
+
+ /** To ensure the atlas does not evict a given entry, the client must set the last use token. */
+ void setLastUseToken(const AtlasLocator& atlasLocator, DrawToken token) {
+ SkASSERT(this->hasID(atlasLocator.plotLocator()));
+ uint32_t plotIdx = atlasLocator.plotIndex();
+ SkASSERT(plotIdx < fNumPlots);
+ uint32_t pageIdx = atlasLocator.pageIndex();
+ SkASSERT(pageIdx < fNumActivePages);
+ Plot* plot = fPages[pageIdx].fPlotArray[plotIdx].get();
+ this->makeMRU(plot, pageIdx);
+ plot->setLastUseToken(token);
+ }
+
+ uint32_t numActivePages() { return fNumActivePages; }
+
+ void setLastUseTokenBulk(const BulkUsePlotUpdater& updater,
+ DrawToken token) {
+ int count = updater.count();
+ for (int i = 0; i < count; i++) {
+ const BulkUsePlotUpdater::PlotData& pd = updater.plotData(i);
+ // it's possible we've added a plot to the updater and subsequently the plot's page
+ // was deleted -- so we check to prevent a crash
+ if (pd.fPageIndex < fNumActivePages) {
+ Plot* plot = fPages[pd.fPageIndex].fPlotArray[pd.fPlotIndex].get();
+ this->makeMRU(plot, pd.fPageIndex);
+ plot->setLastUseToken(token);
+ }
+ }
+ }
+
+ void compact(DrawToken startTokenForNextFlush);
+
+ uint32_t maxPages() const {
+ return fMaxPages;
+ }
+
+ int numAllocated_TestingOnly() const;
+ void setMaxPages_TestingOnly(uint32_t maxPages);
+
+private:
+ DrawAtlas(SkColorType, size_t bpp, int width, int height, int plotWidth, int plotHeight,
+ AtlasGenerationCounter* generationCounter,
+ AllowMultitexturing allowMultitexturing, std::string_view label);
+
+ bool updatePlot(AtlasLocator*, Plot* plot);
+
+ inline void makeMRU(Plot* plot, int pageIdx) {
+ if (fPages[pageIdx].fPlotList.head() == plot) {
+ return;
+ }
+
+ fPages[pageIdx].fPlotList.remove(plot);
+ fPages[pageIdx].fPlotList.addToHead(plot);
+
+ // No MRU update for pages -- since we will always try to add from
+ // the front and remove from the back there is no need for MRU.
+ }
+
+ bool addToPage(unsigned int pageIdx, int width, int height, const void* image, AtlasLocator*);
+
+ bool createPages(AtlasGenerationCounter*);
+ bool activateNewPage(Recorder*);
+ void deactivateLastPage();
+
+ void processEviction(PlotLocator);
+ inline void processEvictionAndResetRects(Plot* plot) {
+ this->processEviction(plot->plotLocator());
+ plot->resetRects();
+ }
+
+ SkColorType fColorType;
+ size_t fBytesPerPixel;
+ int fTextureWidth;
+ int fTextureHeight;
+ int fPlotWidth;
+ int fPlotHeight;
+ unsigned int fNumPlots;
+ const std::string fLabel;
+
+ // A counter to track the atlas eviction state for Glyphs. Each Glyph has a PlotLocator
+ // which contains its current generation. When the atlas evicts a plot, it increases
+ // the generation counter. If a Glyph's generation is less than the atlas's
+ // generation, then it knows it's been evicted and is either free to be deleted or
+ // re-added to the atlas if necessary.
+ AtlasGenerationCounter* const fGenerationCounter;
+ uint64_t fAtlasGeneration;
+
+ // nextTokenToFlush() value at the end of the previous DrawPass
+ // TODO: rename
+ DrawToken fPrevFlushToken;
+
+ // the number of flushes since this atlas has been last used
+ // TODO: rename
+ int fFlushesSinceLastUse;
+
+ std::vector<PlotEvictionCallback*> fEvictionCallbacks;
+
+ struct Page {
+ // allocated array of Plots
+ std::unique_ptr<sk_sp<Plot>[]> fPlotArray;
+ // LRU list of Plots (MRU at head - LRU at tail)
+ PlotList fPlotList;
+ };
+ // proxies kept separate to make it easier to pass them up to client
+ sk_sp<TextureProxy> fProxies[PlotLocator::kMaxMultitexturePages];
+ Page fPages[PlotLocator::kMaxMultitexturePages];
+ uint32_t fMaxPages;
+
+ uint32_t fNumActivePages;
+
+ SkDEBUGCODE(void validate(const AtlasLocator& atlasLocator) const;)
+};
+
+// For text there are three atlases (A8, 565, ARGB) that are kept in relation with one another. In
+// general, because A8 is the most frequently used mask format its dimensions are 2x the 565 and
+// ARGB dimensions, with the constraint that an atlas size will always contain at least one plot.
+// Since the ARGB atlas takes the most space, its dimensions are used to size the other two atlases.
+class DrawAtlasConfig {
+public:
+ // The capabilities of the GPU define maxTextureSize. The client provides maxBytes, and this
+ // represents the largest they want a single atlas texture to be. Due to multitexturing, we
+ // may expand temporarily to use more space as needed.
+ DrawAtlasConfig(int maxTextureSize, size_t maxBytes);
+
+ SkISize atlasDimensions(MaskFormat type) const;
+ SkISize plotDimensions(MaskFormat type) const;
+
+private:
+ // On some systems texture coordinates are represented using half-precision floating point
+ // with 11 significant bits, which limits the largest atlas dimensions to 2048x2048.
+ // For simplicity we'll use this constraint for all of our atlas textures.
+ // This can be revisited later if we need larger atlases.
+ inline static constexpr int kMaxAtlasDim = 2048;
+
+ SkISize fARGBDimensions;
+ int fMaxTextureSize;
+};
+
+} // namespace skgpu::graphite
+
+#endif
diff --git a/chromium/third_party/skia/src/gpu/graphite/DrawBufferManager.cpp b/chromium/third_party/skia/src/gpu/graphite/DrawBufferManager.cpp
index 4903ab6f781..df56a787746 100644
--- a/chromium/third_party/skia/src/gpu/graphite/DrawBufferManager.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/DrawBufferManager.cpp
@@ -7,8 +7,9 @@
#include "src/gpu/graphite/DrawBufferManager.h"
+#include "include/gpu/graphite/Recording.h"
#include "src/gpu/graphite/Buffer.h"
-#include "src/gpu/graphite/CommandBuffer.h"
+#include "src/gpu/graphite/RecordingPriv.h"
#include "src/gpu/graphite/ResourceProvider.h"
namespace skgpu::graphite {
@@ -19,6 +20,7 @@ namespace {
static constexpr size_t kVertexBufferSize = 16 << 10; // 16 KB
static constexpr size_t kIndexBufferSize = 2 << 10; // 2 KB
static constexpr size_t kUniformBufferSize = 2 << 10; // 2 KB
+static constexpr size_t kStorageBufferSize = 2 << 10; // 2 KB
void* map_offset(BindBufferInfo binding) {
// DrawBufferManager owns the Buffer, and this is only ever called when we know
@@ -42,9 +44,11 @@ size_t sufficient_block_size(size_t requiredBytes) {
} // anonymous namespace
DrawBufferManager::DrawBufferManager(ResourceProvider* resourceProvider,
- size_t uniformStartAlignment)
+ size_t uniformStartAlignment,
+ size_t ssboStartAlignment)
: fResourceProvider(resourceProvider)
- , fUniformStartAlignment(uniformStartAlignment) {}
+ , fUniformStartAlignment(uniformStartAlignment)
+ , fSsboStartAlignment(ssboStartAlignment) {}
DrawBufferManager::~DrawBufferManager() {}
@@ -144,6 +148,32 @@ std::tuple<UniformWriter, BindBufferInfo> DrawBufferManager::getUniformWriter(
return {UniformWriter(map_offset(bindInfo), requiredBytes), bindInfo};
}
+std::tuple<UniformWriter, BindBufferInfo> DrawBufferManager::getSsboWriter(size_t requiredBytes) {
+ if (!requiredBytes) {
+ return {UniformWriter(), BindBufferInfo()};
+ }
+ if (fCurrentStorageBuffer &&
+ !can_fit(requiredBytes, fCurrentStorageBuffer.get(), fSsboOffset, fSsboStartAlignment)) {
+ fUsedBuffers.push_back(std::move(fCurrentStorageBuffer));
+ }
+
+ if (!fCurrentStorageBuffer) {
+ size_t bufferSize = sufficient_block_size<kStorageBufferSize>(requiredBytes);
+ fCurrentStorageBuffer = fResourceProvider->findOrCreateBuffer(
+ bufferSize, BufferType::kStorage, PrioritizeGpuReads::kNo);
+ fSsboOffset = 0;
+ if (!fCurrentStorageBuffer) {
+ return {UniformWriter(), BindBufferInfo()};
+ }
+ }
+ fSsboOffset = SkAlignTo(fSsboOffset, fSsboStartAlignment);
+ BindBufferInfo bindInfo;
+ bindInfo.fBuffer = fCurrentStorageBuffer.get();
+ bindInfo.fOffset = fSsboOffset;
+ fSsboOffset += requiredBytes;
+ return {UniformWriter(map_offset(bindInfo), requiredBytes), bindInfo};
+}
+
BindBufferInfo DrawBufferManager::getStaticBuffer(BufferType type,
InitializeBufferFn initFn,
BufferSizeFn sizeFn) {
@@ -171,10 +201,10 @@ BindBufferInfo DrawBufferManager::getStaticBuffer(BufferType type,
return {buffer.get(), 0};
}
-void DrawBufferManager::transferToCommandBuffer(CommandBuffer* commandBuffer) {
+void DrawBufferManager::transferToRecording(Recording* recording) {
for (auto& buffer : fUsedBuffers) {
buffer->unmap();
- commandBuffer->trackResource(std::move(buffer));
+ recording->priv().addResourceRef(std::move(buffer));
}
fUsedBuffers.clear();
@@ -182,22 +212,26 @@ void DrawBufferManager::transferToCommandBuffer(CommandBuffer* commandBuffer) {
// so we need to handle them as well.
if (fCurrentVertexBuffer) {
fCurrentVertexBuffer->unmap();
- commandBuffer->trackResource(std::move(fCurrentVertexBuffer));
+ recording->priv().addResourceRef(std::move(fCurrentVertexBuffer));
}
if (fCurrentIndexBuffer) {
fCurrentIndexBuffer->unmap();
- commandBuffer->trackResource(std::move(fCurrentIndexBuffer));
+ recording->priv().addResourceRef(std::move(fCurrentIndexBuffer));
}
if (fCurrentUniformBuffer) {
fCurrentUniformBuffer->unmap();
- commandBuffer->trackResource(std::move(fCurrentUniformBuffer));
+ recording->priv().addResourceRef(std::move(fCurrentUniformBuffer));
+ }
+ if (fCurrentStorageBuffer) {
+ fCurrentStorageBuffer->unmap();
+ recording->priv().addResourceRef(std::move(fCurrentStorageBuffer));
}
// Assume all static buffers were used, but don't lose our ref
// TODO(skbug:13059) - If static buffers are stored in the ResourceProvider and queried on each
// draw or owned by the RenderStep, we still need a way to track the static buffer *once* per
// frame that relies on it.
for (auto [_, buffer] : fStaticBuffers) {
- commandBuffer->trackResource(buffer);
+ recording->priv().addResourceRef(buffer);
}
}
diff --git a/chromium/third_party/skia/src/gpu/graphite/DrawBufferManager.h b/chromium/third_party/skia/src/gpu/graphite/DrawBufferManager.h
index 4dba9ba7007..7c59763ad3f 100644
--- a/chromium/third_party/skia/src/gpu/graphite/DrawBufferManager.h
+++ b/chromium/third_party/skia/src/gpu/graphite/DrawBufferManager.h
@@ -19,17 +19,18 @@
namespace skgpu::graphite {
class Buffer;
-class CommandBuffer;
+class Recording;
class ResourceProvider;
class DrawBufferManager {
public:
- DrawBufferManager(ResourceProvider*, size_t uniformStartAlignment);
+ DrawBufferManager(ResourceProvider*, size_t uniformStartAlignment, size_t ssboStartAlignment);
~DrawBufferManager();
std::tuple<VertexWriter, BindBufferInfo> getVertexWriter(size_t requiredBytes);
std::tuple<IndexWriter, BindBufferInfo> getIndexWriter(size_t requiredBytes);
std::tuple<UniformWriter, BindBufferInfo> getUniformWriter(size_t requiredBytes);
+ std::tuple<UniformWriter, BindBufferInfo> getSsboWriter(size_t requiredBytes);
// Returns the last 'unusedBytes' from the last call to getVertexWriter(). Assumes that
// 'unusedBytes' is less than the 'requiredBytes' to the original allocation.
@@ -48,8 +49,8 @@ public:
InitializeBufferFn,
BufferSizeFn);
- // Finalizes all buffers and transfers ownership of them to the CommandBuffer.
- void transferToCommandBuffer(CommandBuffer*);
+ // Finalizes all buffers and transfers ownership of them to a Recording.
+ void transferToRecording(Recording*);
private:
ResourceProvider* fResourceProvider;
@@ -63,7 +64,11 @@ private:
sk_sp<Buffer> fCurrentUniformBuffer;
size_t fUniformOffset = 0;
- size_t fUniformStartAlignment;
+ sk_sp<Buffer> fCurrentStorageBuffer;
+ size_t fSsboOffset = 0;
+
+ const size_t fUniformStartAlignment;
+ const size_t fSsboStartAlignment;
std::vector<sk_sp<Buffer>> fUsedBuffers;
// TODO(skbug.com/13059): This is likely not the final location for static buffers, but makes it
diff --git a/chromium/third_party/skia/src/gpu/graphite/DrawCommands.h b/chromium/third_party/skia/src/gpu/graphite/DrawCommands.h
new file mode 100644
index 00000000000..cacf0a5ec26
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/DrawCommands.h
@@ -0,0 +1,227 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef skgpu_graphite_DrawPassCommands_DEFINED
+#define skgpu_graphite_DrawPassCommands_DEFINED
+
+#include "include/core/SkRect.h"
+#include "src/core/SkArenaAlloc.h"
+#include "src/core/SkTBlockList.h"
+#include "src/gpu/graphite/DrawTypes.h"
+
+namespace skgpu::graphite {
+
+namespace DrawPassCommands {
+
+// A list of all the commands types used by a DrawPass.
+// Each of these is reified into a struct below.
+//
+// The design of this systems is based on SkRecords.
+
+// (We're using the macro-of-macro trick here to do several different things with the same list.)
+//
+// We leave this SKGPU_DRAW_COMMAND_TYPES macro defined for use by code that wants to operate on
+// DrawPassCommands types polymorphically.
+#define SKGPU_DRAW_PASS_COMMAND_TYPES(M) \
+ M(BindGraphicsPipeline) \
+ M(SetBlendConstants) \
+ M(BindUniformBuffer) \
+ M(BindDrawBuffers) \
+ M(BindTexturesAndSamplers) \
+ M(SetViewport) \
+ M(SetScissor) \
+ M(Draw) \
+ M(DrawIndexed) \
+ M(DrawInstanced) \
+ M(DrawIndexedInstanced)
+
+// Defines DrawPassCommands::Type, an enum of all draw command types.
+#define ENUM(T) k##T,
+enum class Type { SKGPU_DRAW_PASS_COMMAND_TYPES(ENUM) };
+#undef ENUM
+
+#define ACT_AS_PTR(ptr) \
+ operator T*() const { return ptr; } \
+ T* operator->() const { return ptr; }
+
+// PODArray doesn't own the pointer's memory, and we assume the data is POD.
+template <typename T>
+class PODArray {
+public:
+ PODArray() {}
+ PODArray(T* ptr) : fPtr(ptr) {}
+ // Default copy and assign.
+
+ ACT_AS_PTR(fPtr)
+private:
+ T* fPtr;
+};
+
+#undef ACT_AS_PTR
+
+// A macro to make it a little easier to define a struct that can be stored in DrawPass.
+#define COMMAND(T, ...) \
+struct T { \
+static constexpr Type kType = Type::k##T; \
+ __VA_ARGS__; \
+};
+
+COMMAND(BindGraphicsPipeline,
+ uint32_t fPipelineIndex);
+COMMAND(SetBlendConstants,
+ PODArray<float> fBlendConstants);
+COMMAND(BindUniformBuffer,
+ BindBufferInfo fInfo;
+ UniformSlot fSlot);
+COMMAND(BindDrawBuffers,
+ BindBufferInfo fVertices;
+ BindBufferInfo fInstances;
+ BindBufferInfo fIndices);
+COMMAND(BindTexturesAndSamplers,
+ int fNumTexSamplers;
+ PODArray<int> fTextureIndices;
+ PODArray<int> fSamplerIndices);
+COMMAND(SetViewport,
+ SkRect fViewport;
+ float fMinDepth;
+ float fMaxDepth);
+COMMAND(SetScissor,
+ SkIRect fScissor);
+COMMAND(Draw,
+ PrimitiveType fType;
+ uint32_t fBaseVertex;
+ uint32_t fVertexCount);
+COMMAND(DrawIndexed,
+ PrimitiveType fType;
+ uint32_t fBaseIndex;
+ uint32_t fIndexCount;
+ uint32_t fBaseVertex);
+COMMAND(DrawInstanced,
+ PrimitiveType fType;
+ uint32_t fBaseVertex;
+ uint32_t fVertexCount;
+ uint32_t fBaseInstance;
+ uint32_t fInstanceCount);
+COMMAND(DrawIndexedInstanced,
+ PrimitiveType fType;
+ uint32_t fBaseIndex;
+ uint32_t fIndexCount;
+ uint32_t fBaseVertex;
+ uint32_t fBaseInstance;
+ uint32_t fInstanceCount);
+
+#undef COMMAND
+
+#define ASSERT_TRIV_DES(T) static_assert(std::is_trivially_destructible<T>::value);
+SKGPU_DRAW_PASS_COMMAND_TYPES(ASSERT_TRIV_DES)
+#undef ASSERT_TRIV_DES
+#define ASSERT_TRIV_CPY(T) static_assert(std::is_trivially_copyable<T>::value);
+SKGPU_DRAW_PASS_COMMAND_TYPES(ASSERT_TRIV_CPY)
+#undef ASSERT_TRIV_CPY
+
+class List {
+public:
+ List() = default;
+ ~List() = default;
+
+ void bindGraphicsPipeline(uint32_t pipelineIndex) {
+ this->add<BindGraphicsPipeline>(pipelineIndex);
+ }
+
+ void setBlendConstants(std::array<float, 4> blendConstants) {
+ this->add<SetBlendConstants>(this->copy(blendConstants.data(), 4));
+ }
+
+ void bindUniformBuffer(BindBufferInfo info, UniformSlot slot) {
+ this->add<BindUniformBuffer>(info, slot);
+ }
+
+ void bindTexturesAndSamplers(int numTexSamplers,
+ int* textureIndices,
+ int* samplerIndices) {
+ this->add<BindTexturesAndSamplers>(numTexSamplers,
+ this->copy(textureIndices, numTexSamplers),
+ this->copy(samplerIndices, numTexSamplers));
+ }
+
+ void setViewport(const SkRect& viewport,
+ float minDepth = 0,
+ float maxDepth = 1) {
+ this->add<SetViewport>(viewport, minDepth, maxDepth);
+ }
+
+ void setScissor(SkIRect scissor) {
+ this->add<SetScissor>(scissor);
+ }
+
+ void bindDrawBuffers(BindBufferInfo vertexAttribs,
+ BindBufferInfo instanceAttribs,
+ BindBufferInfo indices) {
+ this->add<BindDrawBuffers>(vertexAttribs, instanceAttribs, indices);
+ }
+
+ void draw(PrimitiveType type, unsigned int baseVertex, unsigned int vertexCount) {
+ this->add<Draw>(type, baseVertex, vertexCount);
+ }
+
+ void drawIndexed(PrimitiveType type, unsigned int baseIndex,
+ unsigned int indexCount, unsigned int baseVertex) {
+ this->add<DrawIndexed>(type, baseIndex, indexCount, baseVertex);
+ }
+
+ void drawInstanced(PrimitiveType type,
+ unsigned int baseVertex, unsigned int vertexCount,
+ unsigned int baseInstance, unsigned int instanceCount) {
+ this->add<DrawInstanced>(type, baseVertex, vertexCount, baseInstance, instanceCount);
+ }
+
+ void drawIndexedInstanced(PrimitiveType type,
+ unsigned int baseIndex, unsigned int indexCount,
+ unsigned int baseVertex, unsigned int baseInstance,
+ unsigned int instanceCount) {
+ this->add<DrawIndexedInstanced>(type,
+ baseIndex,
+ indexCount,
+ baseVertex,
+ baseInstance,
+ instanceCount);
+ }
+
+ using Command = std::pair<Type, void*>;
+ using Iter = SkTBlockList<Command>::CIter;
+ Iter commands() const { return fCommands.items(); }
+
+private:
+ template <typename T, typename... Args>
+ void add(Args&&... args) {
+ T* cmd = fAlloc.make<T>(T{std::forward<Args>(args)...});
+ fCommands.push_back(std::make_pair(T::kType, cmd));
+ }
+
+ // This copy() is for arrays.
+ // It will work with POD only arrays.
+ template <typename T>
+ T* copy(const T src[], size_t count) {
+ static_assert(std::is_trivially_copyable<T>::value);
+ T* dst = fAlloc.makeArrayDefault<T>(count);
+ memcpy(dst, src, count*sizeof(T));
+ return dst;
+ }
+
+ SkTBlockList<Command> fCommands;
+
+ // fAlloc needs to be a data structure which can append variable length data in contiguous
+ // chunks, returning a stable handle to that data for later retrieval.
+ SkArenaAlloc fAlloc{256};
+};
+
+} // namespace DrawPassCommands
+
+} // namespace skgpu::graphite
+
+#endif // skgpu_graphite_DrawPassCommands_DEFINED
+
diff --git a/chromium/third_party/skia/src/gpu/graphite/DrawContext.cpp b/chromium/third_party/skia/src/gpu/graphite/DrawContext.cpp
index ba84074066b..79a0b1c457b 100644
--- a/chromium/third_party/skia/src/gpu/graphite/DrawContext.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/DrawContext.cpp
@@ -19,14 +19,14 @@
#include "src/gpu/graphite/ContextPriv.h"
#include "src/gpu/graphite/DrawList.h"
#include "src/gpu/graphite/DrawPass.h"
-#include "src/gpu/graphite/Gpu.h"
#include "src/gpu/graphite/RecorderPriv.h"
#include "src/gpu/graphite/RenderPassTask.h"
#include "src/gpu/graphite/ResourceTypes.h"
+#include "src/gpu/graphite/SharedContext.h"
#include "src/gpu/graphite/TextureProxy.h"
#include "src/gpu/graphite/UploadTask.h"
#include "src/gpu/graphite/geom/BoundsManager.h"
-#include "src/gpu/graphite/geom/Shape.h"
+#include "src/gpu/graphite/geom/Geometry.h"
namespace skgpu::graphite {
@@ -74,13 +74,13 @@ void DrawContext::clear(const SkColor4f& clearColor) {
void DrawContext::recordDraw(const Renderer& renderer,
const Transform& localToDevice,
- const Shape& shape,
+ const Geometry& geometry,
const Clip& clip,
DrawOrder ordering,
const PaintParams* paint,
const StrokeStyle* stroke) {
SkASSERT(SkIRect::MakeSize(fTarget->dimensions()).contains(clip.scissor()));
- fPendingDraws->recordDraw(renderer, localToDevice, shape, clip, ordering, paint, stroke);
+ fPendingDraws->recordDraw(renderer, localToDevice, geometry, clip, ordering, paint, stroke);
}
bool DrawContext::recordUpload(Recorder* recorder,
@@ -97,23 +97,24 @@ bool DrawContext::recordUpload(Recorder* recorder,
dstRect);
}
-void DrawContext::snapDrawPass(Recorder* recorder, const BoundsManager* occlusionCuller) {
+void DrawContext::snapDrawPass(Recorder* recorder) {
if (fPendingDraws->drawCount() == 0) {
return;
}
- auto pass = DrawPass::Make(recorder, std::move(fPendingDraws), fTarget,
- std::make_pair(fPendingLoadOp, fPendingStoreOp), fPendingClearColor,
- occlusionCuller);
+ auto pass = DrawPass::Make(recorder,
+ std::move(fPendingDraws),
+ fTarget,
+ std::make_pair(fPendingLoadOp, fPendingStoreOp),
+ fPendingClearColor);
fDrawPasses.push_back(std::move(pass));
fPendingDraws = std::make_unique<DrawList>();
fPendingLoadOp = LoadOp::kLoad;
fPendingStoreOp = StoreOp::kStore;
}
-sk_sp<Task> DrawContext::snapRenderPassTask(Recorder* recorder,
- const BoundsManager* occlusionCuller) {
- this->snapDrawPass(recorder, occlusionCuller);
+sk_sp<Task> DrawContext::snapRenderPassTask(Recorder* recorder) {
+ this->snapDrawPass(recorder);
if (fDrawPasses.empty()) {
return nullptr;
}
diff --git a/chromium/third_party/skia/src/gpu/graphite/DrawContext.h b/chromium/third_party/skia/src/gpu/graphite/DrawContext.h
index 9f5d60d6308..cef0c6367eb 100644
--- a/chromium/third_party/skia/src/gpu/graphite/DrawContext.h
+++ b/chromium/third_party/skia/src/gpu/graphite/DrawContext.h
@@ -11,6 +11,7 @@
#include "include/core/SkImageInfo.h"
#include "include/core/SkRefCnt.h"
+#include "src/gpu/graphite/AttachmentTypes.h"
#include "src/gpu/graphite/DrawList.h"
#include "src/gpu/graphite/DrawOrder.h"
#include "src/gpu/graphite/DrawTypes.h"
@@ -22,9 +23,8 @@ class SkPixmap;
namespace skgpu::graphite {
-class BoundsManager;
+class Geometry;
class Recorder;
-class Shape;
class Transform;
class DrawPass;
@@ -54,7 +54,7 @@ public:
void recordDraw(const Renderer& renderer,
const Transform& localToDevice,
- const Shape& shape,
+ const Geometry& geometry,
const Clip& clip,
DrawOrder ordering,
const PaintParams* paint,
@@ -71,11 +71,10 @@ public:
// appended DrawPasses from a child SDC. A new DrawList is started to record subsequent drawing
// operations.
//
- // If 'occlusionCuller' is null, then culling is skipped when converting the DrawList into a
- // DrawPass.
+ // TBD - Should this take a special occluder list to filter the DrawList?
// TBD - should this also return the task so the caller can point to it with its own
// dependencies? Or will that be mostly automatic based on draws and proxy refs?
- void snapDrawPass(Recorder*, const BoundsManager* occlusionCuller);
+ void snapDrawPass(Recorder*);
// TBD: snapRenderPassTask() might not need to be public, and could be spec'ed to require that
// snapDrawPass() must have been called first. A lot of it will depend on how the task graph is
@@ -86,7 +85,7 @@ public:
// caller is responsible for configuring the returned Tasks's dependencies.
//
// Returns null if there are no pending commands or draw passes to move into a task.
- sk_sp<Task> snapRenderPassTask(Recorder*, const BoundsManager* occlusionCuller);
+ sk_sp<Task> snapRenderPassTask(Recorder*);
// Ends the current UploadList if needed, and moves the accumulated Uploads into an UploadTask
// that can be drawn and depended on. The caller is responsible for configuring the returned
diff --git a/chromium/third_party/skia/src/gpu/graphite/DrawList.cpp b/chromium/third_party/skia/src/gpu/graphite/DrawList.cpp
index d19843f21fa..b96b66e57cb 100644
--- a/chromium/third_party/skia/src/gpu/graphite/DrawList.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/DrawList.cpp
@@ -9,6 +9,7 @@
#include "src/gpu/BufferWriter.h"
#include "src/gpu/graphite/Renderer.h"
+#include "src/gpu/graphite/geom/Shape.h"
namespace skgpu::graphite {
@@ -23,20 +24,20 @@ const Transform& DrawList::deduplicateTransform(const Transform& localToDevice)
void DrawList::recordDraw(const Renderer& renderer,
const Transform& localToDevice,
- const Shape& shape,
+ const Geometry& geometry,
const Clip& clip,
DrawOrder ordering,
const PaintParams* paint,
const StrokeStyle* stroke) {
SkASSERT(localToDevice.valid());
- SkASSERT(!shape.isEmpty() && !clip.drawBounds().isEmptyNegativeOrNaN());
+ SkASSERT(!geometry.isEmpty() && !clip.drawBounds().isEmptyNegativeOrNaN());
SkASSERT(!(renderer.depthStencilFlags() & DepthStencilFlags::kStencil) ||
ordering.stencilIndex() != DrawOrder::kUnassigned);
// TODO: Add validation that the renderer's expected shape type and stroke params match provided
fDraws.push_back({renderer, this->deduplicateTransform(localToDevice),
- shape, clip, ordering, paint, stroke});
+ geometry, clip, ordering, paint, stroke});
fRenderStepCount += renderer.numRenderSteps();
}
diff --git a/chromium/third_party/skia/src/gpu/graphite/DrawList.h b/chromium/third_party/skia/src/gpu/graphite/DrawList.h
index f2f1c1b6881..5c8f9666038 100644
--- a/chromium/third_party/skia/src/gpu/graphite/DrawList.h
+++ b/chromium/third_party/skia/src/gpu/graphite/DrawList.h
@@ -11,9 +11,10 @@
#include "include/core/SkPaint.h"
#include "src/core/SkTBlockList.h"
-#include "src/gpu/graphite/DrawGeometry.h"
#include "src/gpu/graphite/DrawOrder.h"
+#include "src/gpu/graphite/DrawParams.h"
#include "src/gpu/graphite/PaintParams.h"
+#include "src/gpu/graphite/geom/Geometry.h"
#include "src/gpu/graphite/geom/Transform_graphite.h"
#include <limits>
@@ -22,7 +23,6 @@
namespace skgpu::graphite {
class Renderer;
-class Shape;
/**
* A DrawList represents a collection of drawing commands (and related clip/shading state) in
@@ -70,7 +70,7 @@ public:
// must have a valid stencil index as well.
void recordDraw(const Renderer& renderer,
const Transform& localToDevice,
- const Shape& shape,
+ const Geometry& geometry,
const Clip& clip,
DrawOrder ordering,
const PaintParams* paint,
@@ -84,14 +84,14 @@ private:
struct Draw {
const Renderer& fRenderer; // Statically defined by function that recorded the Draw
- DrawGeometry fGeometry; // The GeomParam's transform is owned by fTransforms of the DrawList
+ DrawParams fDrawParams; // The DrawParam's transform is owned by fTransforms of the DrawList
std::optional<PaintParams> fPaintParams; // Not present implies depth-only draw
- Draw(const Renderer& renderer, const Transform& transform, const Shape& shape,
+ Draw(const Renderer& renderer, const Transform& transform, const Geometry& geometry,
const Clip& clip, DrawOrder order, const PaintParams* paint,
const StrokeStyle* stroke)
: fRenderer(renderer)
- , fGeometry(transform, shape, clip, order, stroke)
+ , fDrawParams(transform, geometry, clip, order, stroke)
, fPaintParams(paint ? std::optional<PaintParams>(*paint) : std::nullopt) {}
};
diff --git a/chromium/third_party/skia/src/gpu/graphite/DrawOrder.h b/chromium/third_party/skia/src/gpu/graphite/DrawOrder.h
index dd793473c00..4e985f64553 100644
--- a/chromium/third_party/skia/src/gpu/graphite/DrawOrder.h
+++ b/chromium/third_party/skia/src/gpu/graphite/DrawOrder.h
@@ -44,7 +44,7 @@ public:
private:
constexpr MonotonicValue(uint16_t index) : fIndex(index) {}
- uint16_t fIndex = 0;
+ uint16_t fIndex;
};
/**
diff --git a/chromium/third_party/skia/src/gpu/graphite/DrawGeometry.h b/chromium/third_party/skia/src/gpu/graphite/DrawParams.h
index 92e2f34099a..dc0c5c9dd2a 100644
--- a/chromium/third_party/skia/src/gpu/graphite/DrawGeometry.h
+++ b/chromium/third_party/skia/src/gpu/graphite/DrawParams.h
@@ -5,15 +5,15 @@
* found in the LICENSE file.
*/
-#ifndef skgpu_DrawGeometry_DEFINED
-#define skgpu_DrawGeometry_DEFINED
+#ifndef skgpu_DrawParams_DEFINED
+#define skgpu_DrawParams_DEFINED
#include "include/core/SkPaint.h"
#include "include/core/SkRect.h"
#include "src/gpu/graphite/DrawOrder.h"
+#include "src/gpu/graphite/geom/Geometry.h"
#include "src/gpu/graphite/geom/Rect.h"
-#include "src/gpu/graphite/geom/Shape.h"
#include "src/gpu/graphite/geom/Transform_graphite.h"
#include <optional>
@@ -84,21 +84,21 @@ private:
// Encapsulates all geometric state for a single high-level draw call. RenderSteps are responsible
// for transforming this state into actual rendering; shading from PaintParams is handled separately
-class DrawGeometry {
+class DrawParams {
public:
- DrawGeometry(const Transform& transform,
- const Shape& shape,
- const Clip& clip,
- DrawOrder drawOrder,
- const StrokeStyle* stroke)
+ DrawParams(const Transform& transform,
+ const Geometry& geometry,
+ const Clip& clip,
+ DrawOrder drawOrder,
+ const StrokeStyle* stroke)
: fTransform(transform)
- , fShape(shape)
+ , fGeometry(geometry)
, fClip(clip)
, fOrder(drawOrder)
, fStroke(stroke ? std::optional<StrokeStyle>(*stroke) : std::nullopt) {}
const Transform& transform() const { return fTransform; }
- const Shape& shape() const { return fShape; }
+ const Geometry& geometry() const { return fGeometry; }
const Clip& clip() const { return fClip; }
DrawOrder order() const { return fOrder; }
@@ -112,7 +112,7 @@ public:
private:
const Transform& fTransform; // Lifetime of the transform must be held longer than the geometry
- Shape fShape;
+ Geometry fGeometry;
Clip fClip;
DrawOrder fOrder;
@@ -121,4 +121,4 @@ private:
} // namespace skgpu
-#endif // skgpu_DrawGeometry_DEFINED
+#endif // skgpu_DrawParams_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/graphite/DrawPass.cpp b/chromium/third_party/skia/src/gpu/graphite/DrawPass.cpp
index 344a9c3e7c0..e7ee1c1d985 100644
--- a/chromium/third_party/skia/src/gpu/graphite/DrawPass.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/DrawPass.cpp
@@ -51,6 +51,34 @@ struct Bitfield {
static uint64_t set(uint32_t v) { return (v & kMask) << kOffset; }
};
+struct TextureBindingBlock {
+ TextureDataCache::Index fPaintTextureIndex;
+ TextureDataCache::Index fStepTextureIndex;
+
+ static std::unique_ptr<TextureBindingBlock> Make(const TextureBindingBlock& other,
+ SkArenaAlloc*) {
+ return std::make_unique<TextureBindingBlock>(other);
+ }
+
+ bool operator==(const TextureBindingBlock& other) const {
+ return fPaintTextureIndex == other.fPaintTextureIndex &&
+ fStepTextureIndex == other.fStepTextureIndex;
+ }
+ bool operator!=(const TextureBindingBlock& other) const { return !(*this == other); }
+
+ uint32_t hash() const {
+ uint32_t hash = 0;
+ uint32_t index = fPaintTextureIndex.asUInt();
+ hash = SkOpts::hash_fn(&index, sizeof(index), hash);
+ index = fStepTextureIndex.asUInt();
+ hash = SkOpts::hash_fn(&index, sizeof(index), hash);
+
+ return hash;
+ }
+};
+using TextureBindingCache =
+ PipelineDataCache<std::unique_ptr<TextureBindingBlock>, TextureBindingBlock>;
+
/**
* Each Draw in a DrawList might be processed by multiple RenderSteps (determined by the Draw's
* Renderer), which can be sorted independently. Each (step, draw) pair produces its own SortKey.
@@ -81,14 +109,14 @@ public:
uint32_t pipelineIndex,
UniformDataCache::Index geomUniformIndex,
UniformDataCache::Index shadingUniformIndex,
- TextureDataCache::Index textureDataIndex)
- : fPipelineKey(ColorDepthOrderField::set(draw->fGeometry.order().paintOrder().bits()) |
- StencilIndexField::set(draw->fGeometry.order().stencilIndex().bits()) |
- RenderStepField::set(static_cast<uint32_t>(renderStep)) |
+ TextureBindingCache::Index textureBindingIndex)
+ : fPipelineKey(ColorDepthOrderField::set(draw->fDrawParams.order().paintOrder().bits()) |
+ StencilIndexField::set(draw->fDrawParams.order().stencilIndex().bits()) |
+ RenderStepField::set(static_cast<uint32_t>(renderStep)) |
PipelineField::set(pipelineIndex))
, fUniformKey(GeometryUniformField::set(geomUniformIndex.asUInt()) |
ShadingUniformField::set(shadingUniformIndex.asUInt()) |
- TextureBindingsField::set(textureDataIndex.asUInt()))
+ TextureBindingsField::set(textureBindingIndex.asUInt()))
, fDraw(draw) {
SkASSERT(renderStep <= draw->fRenderer.numRenderSteps());
}
@@ -111,8 +139,8 @@ public:
UniformDataCache::Index shadingUniforms() const {
return UniformDataCache::Index(ShadingUniformField::get(fUniformKey));
}
- TextureDataCache::Index textureBindings() const {
- return TextureDataCache::Index(TextureBindingsField::get(fUniformKey));
+ TextureBindingCache::Index textureBindings() const {
+ return TextureBindingCache::Index(TextureBindingsField::get(fUniformKey));
}
private:
@@ -146,45 +174,6 @@ private:
SkNextLog2_portable(Renderer::kMaxRenderSteps * DrawList::kMaxDraws));
};
-class DrawPass::Drawer final : public DrawDispatcher {
-public:
- Drawer(DrawPass* drawPass) : fPass(drawPass) {}
- ~Drawer() override = default;
-
- void bindDrawBuffers(BindBufferInfo vertexAttribs,
- BindBufferInfo instanceAttribs,
- BindBufferInfo indices) override {
- fPass->fCommands.emplace_back(BindDrawBuffers{vertexAttribs, instanceAttribs, indices});
- }
-
- void draw(PrimitiveType type, unsigned int baseVertex, unsigned int vertexCount) override {
- fPass->fCommands.emplace_back(Draw{type, baseVertex, vertexCount});
- }
-
- void drawIndexed(PrimitiveType type, unsigned int baseIndex,
- unsigned int indexCount, unsigned int baseVertex) override {
- fPass->fCommands.emplace_back(DrawIndexed{type, baseIndex, indexCount, baseVertex});
- }
-
- void drawInstanced(PrimitiveType type,
- unsigned int baseVertex, unsigned int vertexCount,
- unsigned int baseInstance, unsigned int instanceCount) override {
- fPass->fCommands.emplace_back(DrawInstanced{type, baseVertex, vertexCount,
- baseInstance, instanceCount});
- }
-
- void drawIndexedInstanced(PrimitiveType type,
- unsigned int baseIndex, unsigned int indexCount,
- unsigned int baseVertex, unsigned int baseInstance,
- unsigned int instanceCount) override {
- fPass->fCommands.emplace_back(DrawIndexedInstanced{type, baseIndex, indexCount, baseVertex,
- baseInstance, instanceCount});
- }
-
-private:
- DrawPass* fPass;
-};
-
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace {
@@ -249,8 +238,7 @@ DrawPass::DrawPass(sk_sp<TextureProxy> target,
std::pair<LoadOp, StoreOp> ops,
std::array<float, 4> clearColor,
int renderStepCount)
- : fCommands(std::max(1, renderStepCount / 4), SkBlockAllocator::GrowthPolicy::kFibonacci)
- , fTarget(std::move(target))
+ : fTarget(std::move(target))
, fBounds(SkIRect::MakeEmpty())
, fOps(ops)
, fClearColor(clearColor) {
@@ -261,7 +249,6 @@ DrawPass::DrawPass(sk_sp<TextureProxy> target,
// many draws should be using a similar small set of samplers.
static constexpr int kReserveSamplerCnt = 8;
fSamplerDescs.reserve(kReserveSamplerCnt);
- fCommands.reserve(renderStepCount);
}
DrawPass::~DrawPass() = default;
@@ -317,8 +304,7 @@ std::unique_ptr<DrawPass> DrawPass::Make(Recorder* recorder,
std::unique_ptr<DrawList> draws,
sk_sp<TextureProxy> target,
std::pair<LoadOp, StoreOp> ops,
- std::array<float, 4> clearColor,
- const BoundsManager* occlusionCuller) {
+ std::array<float, 4> clearColor) {
// NOTE: This assert is here to ensure SortKey is as tightly packed as possible. Any change to
// its size should be done with care and good reason. The performance of sorting the keys is
// heavily tied to the total size.
@@ -350,6 +336,7 @@ std::unique_ptr<DrawPass> DrawPass::Make(Recorder* recorder,
UniformBindingCache geometryUniformBindings(bufferMgr, &geometryUniformDataCache);
UniformBindingCache shadingUniformBindings(bufferMgr, recorder->priv().uniformDataCache());
TextureDataCache* textureDataCache = recorder->priv().textureDataCache();
+ TextureBindingCache textureBindingIndices;
std::unordered_map<const GraphicsPipelineDesc*, uint32_t, Hash, Eq> pipelineDescToIndex;
@@ -360,23 +347,20 @@ std::unique_ptr<DrawPass> DrawPass::Make(Recorder* recorder,
SkPaintParamsKeyBuilder builder(dict, SkBackend::kGraphite);
SkPipelineDataGatherer gatherer(Layout::kMetal); // TODO: get the layout from the recorder
- for (const DrawList::Draw& draw : draws->fDraws.items()) {
- if (occlusionCuller && occlusionCuller->isOccluded(draw.fGeometry.clip().drawBounds(),
- draw.fGeometry.order().depth())) {
- continue;
- }
+ int maxTexturesInSingleDraw = 0;
+ for (const DrawList::Draw& draw : draws->fDraws.items()) {
// If we have two different descriptors, such that the uniforms from the PaintParams can be
// bound independently of those used by the rest of the RenderStep, then we can upload now
// and remember the location for re-use on any RenderStep that does shading.
SkUniquePaintParamsID shaderID;
UniformDataCache::Index shadingUniformIndex;
- TextureDataCache::Index textureBindingIndex;
+ TextureDataCache::Index paintTextureDataIndex;
if (draw.fPaintParams.has_value()) {
UniformDataCache::Index uniformDataIndex;
- std::tie(shaderID, uniformDataIndex, textureBindingIndex) =
+ std::tie(shaderID, uniformDataIndex, paintTextureDataIndex) =
ExtractPaintData(recorder, &gatherer, &builder,
- draw.fGeometry.transform().inverse(),
+ draw.fDrawParams.transform().inverse(),
draw.fPaintParams.value());
shadingUniformIndex = shadingUniformBindings.addUniforms(uniformDataIndex);
} // else depth-only
@@ -385,25 +369,43 @@ std::unique_ptr<DrawPass> DrawPass::Make(Recorder* recorder,
const RenderStep* const step = draw.fRenderer.steps()[stepIndex];
const bool performsShading = draw.fPaintParams.has_value() && step->performsShading();
+ UniformDataCache::Index geometryUniformIndex;
+ TextureDataCache::Index stepTextureDataIndex;
+ if (step->numUniforms() > 0 || step->hasTextures()) {
+ UniformDataCache::Index uniformDataIndex;
+ std::tie(uniformDataIndex, stepTextureDataIndex) =
+ ExtractRenderStepData(&geometryUniformDataCache,
+ textureDataCache,
+ &gatherer,
+ step,
+ draw.fDrawParams);
+ if (uniformDataIndex.isValid()) {
+ geometryUniformIndex = geometryUniformBindings.addUniforms(uniformDataIndex);
+ }
+ }
+
SkUniquePaintParamsID stepShaderID;
UniformDataCache::Index stepShadingUniformIndex;
- TextureDataCache::Index stepTextureBindingIndex;
+ TextureBindingCache::Index stepTextureBindingIndex;
if (performsShading) {
stepShaderID = shaderID;
stepShadingUniformIndex = shadingUniformIndex;
- stepTextureBindingIndex = textureBindingIndex;
+ if (paintTextureDataIndex.isValid() || stepTextureDataIndex.isValid()) {
+ stepTextureBindingIndex = textureBindingIndices.insert({paintTextureDataIndex,
+ stepTextureDataIndex});
+ int numTextures = 0;
+ if (paintTextureDataIndex.isValid()) {
+ auto textureDataBlock = textureDataCache->lookup(paintTextureDataIndex);
+ numTextures = textureDataBlock->numTextures();
+ }
+ if (stepTextureDataIndex.isValid()) {
+ auto textureDataBlock = textureDataCache->lookup(stepTextureDataIndex);
+ numTextures += textureDataBlock->numTextures();
+ }
+ maxTexturesInSingleDraw = std::max(maxTexturesInSingleDraw, numTextures);
+ }
} // else depth-only draw or stencil-only step of renderer so no shading is needed
- UniformDataCache::Index geometryUniformIndex;
- if (step->numUniforms() > 0) {
- UniformDataCache::Index uniformDataIndex;
- uniformDataIndex = ExtractRenderStepData(&geometryUniformDataCache,
- &gatherer,
- step,
- draw.fGeometry);
- geometryUniformIndex = geometryUniformBindings.addUniforms(uniformDataIndex);
- }
-
GraphicsPipelineDesc desc;
desc.setProgram(step, stepShaderID);
uint32_t pipelineIndex = 0;
@@ -424,7 +426,7 @@ std::unique_ptr<DrawPass> DrawPass::Make(Recorder* recorder,
stepTextureBindingIndex});
}
- passBounds.join(draw.fGeometry.clip().drawBounds());
+ passBounds.join(draw.fDrawParams.clip().drawBounds());
drawPass->fDepthStencilFlags |= draw.fRenderer.depthStencilFlags();
drawPass->fRequiresMSAA |= draw.fRenderer.requiresMSAA();
}
@@ -439,16 +441,24 @@ std::unique_ptr<DrawPass> DrawPass::Make(Recorder* recorder,
std::sort(keys.begin(), keys.end());
// Used to record vertex/instance data, buffer binds, and draw calls
- Drawer drawer(drawPass.get());
- DrawWriter drawWriter(&drawer, bufferMgr);
+ DrawWriter drawWriter(&drawPass->fCommandList, bufferMgr);
// Used to track when a new pipeline or dynamic state needs recording between draw steps.
// Setting to # render steps ensures the very first time through the loop will bind a pipeline.
uint32_t lastPipeline = draws->renderStepCount();
UniformDataCache::Index lastShadingUniforms;
- TextureDataCache::Index lastTextureBindings;
+ TextureBindingCache::Index lastTextureBindings;
UniformDataCache::Index lastGeometryUniforms;
SkIRect lastScissor = SkIRect::MakeSize(drawPass->fTarget->dimensions());
+ // We will reuse these vectors for all the draws as they are just meant for temporary storage
+ // as we are creating commands on the fCommandList.
+ std::vector<int> textureIndices(maxTexturesInSingleDraw);
+ std::vector<int> samplerIndices(maxTexturesInSingleDraw);
+
+ // Set viewport to the entire texture for now (eventually, we may have logically smaller bounds
+ // within an approx-sized texture). It is assumed that this also configures the sk_rtAdjust
+ // intrinsic for programs (however the backend chooses to do so).
+ drawPass->fCommandList.setViewport(SkRect::Make(drawPass->fTarget->dimensions()));
for (const SortKey& key : keys) {
const DrawList::Draw& draw = *key.draw();
@@ -465,7 +475,7 @@ std::unique_ptr<DrawPass> DrawPass::Make(Recorder* recorder,
const bool stateChange = geometryUniformChange ||
shadingUniformChange ||
textureBindingsChange ||
- draw.fGeometry.clip().scissor() != lastScissor;
+ draw.fDrawParams.clip().scissor() != lastScissor;
// Update DrawWriter *before* we actually change any state so that accumulated draws from
// the previous state use the proper state.
@@ -479,47 +489,62 @@ std::unique_ptr<DrawPass> DrawPass::Make(Recorder* recorder,
// Make state changes before accumulating new draw data
if (pipelineChange) {
- drawPass->fCommands.emplace_back(BindGraphicsPipeline{key.pipeline()});
+ drawPass->fCommandList.bindGraphicsPipeline(key.pipeline());
lastPipeline = key.pipeline();
}
if (stateChange) {
if (geometryUniformChange) {
auto binding = geometryUniformBindings.getBinding(key.geometryUniforms());
- drawPass->fCommands.emplace_back(
- BindUniformBuffer{binding, UniformSlot::kRenderStep});
+ drawPass->fCommandList.bindUniformBuffer(binding, UniformSlot::kRenderStep);
lastGeometryUniforms = key.geometryUniforms();
}
if (shadingUniformChange) {
auto binding = shadingUniformBindings.getBinding(key.shadingUniforms());
- drawPass->fCommands.emplace_back(
- BindUniformBuffer{binding, UniformSlot::kPaint});
+ drawPass->fCommandList.bindUniformBuffer(binding, UniformSlot::kPaint);
lastShadingUniforms = key.shadingUniforms();
}
if (textureBindingsChange) {
- auto textureDataBlock = textureDataCache->lookup(key.textureBindings());
- BindTexturesAndSamplers bts;
- bts.fNumTexSamplers = textureDataBlock->numTextures();
- // TODO: Remove this assert once BindTexturesAndSamplers doesn't have a fixed size
- // of textures and samplers arrays.
- SkASSERT(bts.fNumTexSamplers <= 32);
- for (int i = 0; i < bts.fNumTexSamplers; ++i) {
- auto& info = textureDataBlock->texture(i);
- std::tie(bts.fTextureIndices[i], bts.fSamplerIndices[i]) =
- get_unique_texture_sampler_indices(drawPass->fSampledTextures,
- drawPass->fSamplerDescs,
- info);
- }
-
- drawPass->fCommands.push_back(Command(bts));
+ auto textureIndexBlock = textureBindingIndices.lookup(key.textureBindings());
+
+ auto collect_textures = [](TextureDataCache* cache,
+ TextureDataCache::Index cacheIndex,
+ DrawPass* drawPass,
+ int* numTextures,
+ std::vector<int>* textureIndices,
+ std::vector<int>* samplerIndices) {
+ if (cacheIndex.isValid()) {
+ auto textureDataBlock = cache->lookup(cacheIndex);
+ for (int i = 0; i < textureDataBlock->numTextures(); ++i) {
+ auto& info = textureDataBlock->texture(i);
+ std::tie((*textureIndices)[i + *numTextures],
+ (*samplerIndices)[i + *numTextures]) =
+ get_unique_texture_sampler_indices(drawPass->fSampledTextures,
+ drawPass->fSamplerDescs,
+ info);
+ }
+ *numTextures += textureDataBlock->numTextures();
+ }
+ };
+
+ int numTextures = 0;
+ collect_textures(textureDataCache, textureIndexBlock->fPaintTextureIndex,
+ drawPass.get(), &numTextures, &textureIndices, &samplerIndices);
+ collect_textures(textureDataCache, textureIndexBlock->fStepTextureIndex,
+ drawPass.get(), &numTextures, &textureIndices, &samplerIndices);
+ SkASSERT(numTextures <= maxTexturesInSingleDraw);
+ drawPass->fCommandList.bindTexturesAndSamplers(numTextures,
+ textureIndices.data(),
+ samplerIndices.data());
lastTextureBindings = key.textureBindings();
}
- if (draw.fGeometry.clip().scissor() != lastScissor) {
- drawPass->fCommands.emplace_back(SetScissor{draw.fGeometry.clip().scissor()});
- lastScissor = draw.fGeometry.clip().scissor();
+ if (draw.fDrawParams.clip().scissor() != lastScissor) {
+ drawPass->fCommandList.setScissor(draw.fDrawParams.clip().scissor());
+ lastScissor = draw.fDrawParams.clip().scissor();
}
}
- renderStep.writeVertices(&drawWriter, draw.fGeometry);
+ // TODO(b/238623626): Pass in an actual SSBO index, if using storage buffers.
+ renderStep.writeVertices(&drawWriter, draw.fDrawParams, 0);
}
// Finish recording draw calls for any collected data at the end of the loop
drawWriter.flush();
@@ -537,7 +562,7 @@ bool DrawPass::prepareResources(ResourceProvider* resourceProvider,
auto pipeline = resourceProvider->findOrCreateGraphicsPipeline(pipelineDesc,
renderPassDesc);
if (!pipeline) {
- SKGPU_LOG_W("Failed to create GraphicsPipeline for draw in RenderPass. Droping Pass");
+ SKGPU_LOG_W("Failed to create GraphicsPipeline for draw in RenderPass. Dropping pass!");
return false;
}
fFullPipelines.push_back(std::move(pipeline));
@@ -551,6 +576,7 @@ bool DrawPass::prepareResources(ResourceProvider* resourceProvider,
// snapshot, save layers, etc. Right now we only support SkImages directly made for graphite
// and all others have a TextureProxy with an invalid TextureInfo.
if (!fSampledTextures[i]->textureInfo().isValid()) {
+ SKGPU_LOG_W("Failed to validate sampled texture. Will not create renderpass!");
return false;
}
if (!fSampledTextures[i]->instantiate(resourceProvider)) {
@@ -576,72 +602,28 @@ bool DrawPass::prepareResources(ResourceProvider* resourceProvider,
return true;
}
-bool DrawPass::addCommands(CommandBuffer* buffer) const {
- // TODO: Validate RenderPass state against DrawPass's target and requirements?
- // Generate actual GraphicsPipeline objects combining the target-level properties and each of
- // the GraphicsPipelineDesc's referenced in this DrawPass.
-
- // Set viewport to the entire texture for now (eventually, we may have logically smaller bounds
- // within an approx-sized texture). It is assumed that this also configures the sk_rtAdjust
- // intrinsic for programs (however the backend chooses to do so).
- buffer->setViewport(0, 0, fTarget->dimensions().width(), fTarget->dimensions().height());
-
- for (const Command& c : fCommands.items()) {
- switch(c.fType) {
- case CommandType::kBindGraphicsPipeline: {
- auto& d = c.fBindGraphicsPipeline;
- buffer->bindGraphicsPipeline(fFullPipelines[d.fPipelineIndex]);
- } break;
- case CommandType::kBindUniformBuffer: {
- auto& d = c.fBindUniformBuffer;
- buffer->bindUniformBuffer(d.fSlot, sk_ref_sp(d.fInfo.fBuffer), d.fInfo.fOffset);
- } break;
- case CommandType::kBindTexturesAndSamplers: {
- auto& d = c.fBindTexturesAndSamplers;
-
- for (int i = 0; i < d.fNumTexSamplers; ++i) {
- SkASSERT(fSampledTextures[d.fTextureIndices[i]]);
- SkASSERT(fSampledTextures[d.fTextureIndices[i]]->texture());
- SkASSERT(fSamplers[d.fSamplerIndices[i]]);
- buffer->bindTextureAndSampler(
- fSampledTextures[d.fTextureIndices[i]]->refTexture(),
- fSamplers[d.fSamplerIndices[i]],
- i);
- }
-
- } break;
- case CommandType::kBindDrawBuffers: {
- auto& d = c.fBindDrawBuffers;
- buffer->bindDrawBuffers(d.fVertices, d.fInstances, d.fIndices);
- break; }
- case CommandType::kDraw: {
- auto& d = c.fDraw;
- buffer->draw(d.fType, d.fBaseVertex, d.fVertexCount);
- break; }
- case CommandType::kDrawIndexed: {
- auto& d = c.fDrawIndexed;
- buffer->drawIndexed(d.fType, d.fBaseIndex, d.fIndexCount, d.fBaseVertex);
- break; }
- case CommandType::kDrawInstanced: {
- auto& d = c.fDrawInstanced;
- buffer->drawInstanced(d.fType, d.fBaseVertex, d.fVertexCount,
- d.fBaseInstance, d.fInstanceCount);
- break; }
- case CommandType::kDrawIndexedInstanced: {
- auto& d = c.fDrawIndexedInstanced;
- buffer->drawIndexedInstanced(d.fType, d.fBaseIndex, d.fIndexCount, d.fBaseVertex,
- d.fBaseInstance, d.fInstanceCount);
- break; }
- case CommandType::kSetScissor: {
- auto& d = c.fSetScissor;
- buffer->setScissor(d.fScissor.fLeft, d.fScissor.fTop,
- d.fScissor.width(), d.fScissor.height());
- break;
- }
- }
+void DrawPass::addResourceRefs(CommandBuffer* commandBuffer) const {
+ for (size_t i = 0; i < fFullPipelines.size(); ++i) {
+ commandBuffer->trackResource(fFullPipelines[i]);
+ }
+ for (size_t i = 0; i < fSampledTextures.size(); ++i) {
+ commandBuffer->trackResource(fSampledTextures[i]->refTexture());
+ }
+ for (size_t i = 0; i < fSamplers.size(); ++i) {
+ commandBuffer->trackResource(fSamplers[i]);
}
+}
- return true;
+const Texture* DrawPass::getTexture(size_t index) const {
+ SkASSERT(index < fSampledTextures.size());
+ SkASSERT(fSampledTextures[index]);
+ SkASSERT(fSampledTextures[index]->texture());
+ return fSampledTextures[index]->texture();
+}
+const Sampler* DrawPass::getSampler(size_t index) const {
+ SkASSERT(index < fSamplers.size());
+ SkASSERT(fSamplers[index]);
+ return fSamplers[index].get();
}
} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/DrawPass.h b/chromium/third_party/skia/src/gpu/graphite/DrawPass.h
index a41e23deeb6..13a1ef4561d 100644
--- a/chromium/third_party/skia/src/gpu/graphite/DrawPass.h
+++ b/chromium/third_party/skia/src/gpu/graphite/DrawPass.h
@@ -13,6 +13,8 @@
#include "include/core/SkRefCnt.h"
#include "src/core/SkEnumBitMask.h"
#include "src/core/SkTBlockList.h"
+#include "src/gpu/graphite/AttachmentTypes.h"
+#include "src/gpu/graphite/DrawCommands.h"
#include "src/gpu/graphite/DrawTypes.h"
#include "src/gpu/graphite/GraphicsPipelineDesc.h"
#include "src/gpu/graphite/ResourceTypes.h"
@@ -34,6 +36,7 @@ class ResourceProvider;
class Sampler;
struct SamplerDesc;
class TextureProxy;
+class Texture;
enum class UniformSlot;
/**
@@ -57,8 +60,7 @@ public:
std::unique_ptr<DrawList>,
sk_sp<TextureProxy>,
std::pair<LoadOp, StoreOp>,
- std::array<float, 4> clearColor,
- const BoundsManager* occlusionCuller);
+ std::array<float, 4> clearColor);
// Defined relative to the top-left corner of the surface the DrawPass renders to, and is
// contained within its dimensions.
@@ -75,140 +77,34 @@ public:
size_t vertexBufferSize() const { return 0; }
size_t uniformBufferSize() const { return 0; }
- // TODO: Real return types, but it seems useful for DrawPass to report these as sets so that
- // task execution can compile necessary programs and track resources within a render pass.
- // Maybe these won't need to be exposed and RenderPassTask can do it per command as needed when
- // it iterates over the DrawPass contents.
- void samplers() const {}
- void programs() const {}
-
// Instantiate and prepare any resources used by the DrawPass that require the Recorder's
// ResourceProvider. This includes things likes GraphicsPipelines, sampled Textures, Samplers,
// etc.
bool prepareResources(ResourceProvider*, const RenderPassDesc&);
- // Transform this DrawPass into commands issued to the CommandBuffer. Assumes that the buffer
- // has already begun a correctly configured render pass matching this pass's target.
- // Returns true on success; false on failure
- bool addCommands(CommandBuffer*) const;
+ DrawPassCommands::List::Iter commands() const {
+ return fCommandList.commands();
+ }
+
+ const GraphicsPipeline* getPipeline(size_t index) const {
+ return fFullPipelines[index].get();
+ }
+ const Texture* getTexture(size_t index) const;
+ const Sampler* getSampler(size_t index) const;
+
+ void addResourceRefs(CommandBuffer*) const;
private:
class SortKey;
class Drawer;
- struct BindGraphicsPipeline {
- // Points to a GraphicsPipelineDesc in DrawPass's fPipelineDescs array. It will also
- // index into a parallel array of full GraphicsPipelines when commands are added to the CB.
- uint32_t fPipelineIndex;
- };
- struct BindUniformBuffer {
- BindBufferInfo fInfo;
- UniformSlot fSlot;
- };
- struct BindTexturesAndSamplers {
- int fNumTexSamplers;
- // TODO: Right now we are hardcoding these arrays to be 32. However, when we rewrite the
- // command system here to be more flexible and not require fixed sized structs, we will
- // remove this hardcode size.
- int fTextureIndices[32];
- int fSamplerIndices[32];
- };
- struct BindDrawBuffers {
- BindBufferInfo fVertices;
- BindBufferInfo fInstances;
- BindBufferInfo fIndices;
- };
- struct Draw {
- PrimitiveType fType;
- uint32_t fBaseVertex;
- uint32_t fVertexCount;
- };
- struct DrawIndexed {
- PrimitiveType fType;
- uint32_t fBaseIndex;
- uint32_t fIndexCount;
- uint32_t fBaseVertex;
- };
- struct DrawInstanced {
- PrimitiveType fType;
- uint32_t fBaseVertex;
- uint32_t fVertexCount;
- uint32_t fBaseInstance;
- uint32_t fInstanceCount;
- };
- struct DrawIndexedInstanced {
- PrimitiveType fType;
- uint32_t fBaseIndex;
- uint32_t fIndexCount;
- uint32_t fBaseVertex;
- uint32_t fBaseInstance;
- uint32_t fInstanceCount;
- };
- struct SetScissor {
- SkIRect fScissor;
- };
-
- // TODO: BindSampler
-
- enum class CommandType {
- kBindGraphicsPipeline,
- kBindUniformBuffer,
- kBindTexturesAndSamplers,
- kBindDrawBuffers,
- kDraw,
- kDrawIndexed,
- kDrawInstanced,
- kDrawIndexedInstanced,
- kSetScissor,
- // kBindSampler
- };
- // TODO: The goal is keep all command data in line, vs. type + void* to another data array, but
- // the current union is memory inefficient. It would be better to have a byte buffer with per
- // type advances, but then we need to work out alignment etc. so that will be easier to add
- // once we have something up and running.
- struct Command {
- CommandType fType;
- union {
- BindGraphicsPipeline fBindGraphicsPipeline;
- BindUniformBuffer fBindUniformBuffer;
- BindTexturesAndSamplers fBindTexturesAndSamplers;
- BindDrawBuffers fBindDrawBuffers;
- Draw fDraw;
- DrawIndexed fDrawIndexed;
- DrawInstanced fDrawInstanced;
- DrawIndexedInstanced fDrawIndexedInstanced;
- SetScissor fSetScissor;
- };
-
- explicit Command(BindGraphicsPipeline d)
- : fType(CommandType::kBindGraphicsPipeline), fBindGraphicsPipeline(d) {}
- explicit Command(BindUniformBuffer d)
- : fType(CommandType::kBindUniformBuffer), fBindUniformBuffer(d) {}
- explicit Command(BindTexturesAndSamplers d)
- : fType(CommandType::kBindTexturesAndSamplers), fBindTexturesAndSamplers(d) {}
- explicit Command(BindDrawBuffers d)
- : fType(CommandType::kBindDrawBuffers), fBindDrawBuffers(d) {}
- explicit Command(Draw d)
- : fType(CommandType::kDraw), fDraw(d) {}
- explicit Command(DrawIndexed d)
- : fType(CommandType::kDrawIndexed), fDrawIndexed(d) {}
- explicit Command(DrawInstanced d)
- : fType(CommandType::kDrawInstanced), fDrawInstanced(d) {}
- explicit Command(DrawIndexedInstanced d)
- : fType(CommandType::kDrawIndexedInstanced), fDrawIndexedInstanced(d) {}
- explicit Command(SetScissor d)
- : fType(CommandType::kSetScissor), fSetScissor(d) {}
- };
- // Not strictly necessary, but keeping Command trivially destructible means the command list
- // can be cleaned up efficiently once it's converted to a command buffer.
- static_assert(std::is_trivially_destructible<Command>::value);
-
DrawPass(sk_sp<TextureProxy> target,
std::pair<LoadOp, StoreOp> ops,
std::array<float, 4> clearColor,
int renderStepCount);
- SkTBlockList<Command, 32> fCommands;
+ DrawPassCommands::List fCommandList;
+
// The pipelines are referenced by index in BindGraphicsPipeline, but that will index into a
// an array of actual GraphicsPipelines. fPipelineDescs only needs to accumulate encountered
// GraphicsPipelineDescs and provide stable pointers, hence SkTBlockList.
diff --git a/chromium/third_party/skia/src/gpu/graphite/DrawTypes.h b/chromium/third_party/skia/src/gpu/graphite/DrawTypes.h
index f2c077241fe..e79e12c9fb0 100644
--- a/chromium/third_party/skia/src/gpu/graphite/DrawTypes.h
+++ b/chromium/third_party/skia/src/gpu/graphite/DrawTypes.h
@@ -9,7 +9,6 @@
#define skgpu_graphite_DrawTypes_DEFINED
#include "include/gpu/graphite/GraphiteTypes.h"
-#include "include/gpu/graphite/TextureInfo.h"
#include <array>
@@ -29,49 +28,6 @@ enum class CType : unsigned {
};
/**
- * This enum is used to specify the load operation to be used when a RenderPass begins execution
- */
-enum class LoadOp : uint8_t {
- kLoad,
- kClear,
- kDiscard,
-
- kLast = kDiscard
-};
-inline static constexpr int kLoadOpCount = (int)(LoadOp::kLast) + 1;
-
-/**
- * This enum is used to specify the store operation to be used when a RenderPass ends execution.
- */
-enum class StoreOp : uint8_t {
- kStore,
- kDiscard,
-
- kLast = kDiscard
-};
-inline static constexpr int kStoreOpCount = (int)(StoreOp::kLast) + 1;
-
-struct AttachmentDesc {
- TextureInfo fTextureInfo;
- LoadOp fLoadOp;
- StoreOp fStoreOp;
-};
-
-struct RenderPassDesc {
- AttachmentDesc fColorAttachment;
- std::array<float, 4> fClearColor;
- AttachmentDesc fColorResolveAttachment;
-
- AttachmentDesc fDepthStencilAttachment;
- float fClearDepth;
- uint32_t fClearStencil;
-
- // TODO:
- // * bounds (TBD whether exact bounds vs. granular)
- // * input attachments
-};
-
-/**
* Geometric primitives used for drawing.
*/
enum class PrimitiveType : uint8_t {
diff --git a/chromium/third_party/skia/src/gpu/graphite/DrawWriter.cpp b/chromium/third_party/skia/src/gpu/graphite/DrawWriter.cpp
index 62d5b341136..1e19776a35a 100644
--- a/chromium/third_party/skia/src/gpu/graphite/DrawWriter.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/DrawWriter.cpp
@@ -9,22 +9,16 @@
#include "src/gpu/BufferWriter.h"
#include "src/gpu/graphite/DrawBufferManager.h"
+#include "src/gpu/graphite/DrawCommands.h"
namespace skgpu::graphite {
-DrawWriter::DrawWriter(DrawDispatcher* dispatcher, DrawBufferManager* bufferManager)
- : DrawWriter(dispatcher, bufferManager, PrimitiveType::kTriangles, 0, 0) {}
-
-DrawWriter::DrawWriter(DrawDispatcher* dispatcher,
- DrawBufferManager* bufferManager,
- PrimitiveType primitiveType,
- size_t vertexStride,
- size_t instanceStride)
- : fDispatcher(dispatcher)
+DrawWriter::DrawWriter(DrawPassCommands::List* commandList, DrawBufferManager* bufferManager)
+ : fCommandList(commandList)
, fManager(bufferManager)
- , fPrimitiveType(primitiveType)
- , fVertexStride(vertexStride)
- , fInstanceStride(instanceStride)
+ , fPrimitiveType(PrimitiveType::kTriangles)
+ , fVertexStride(0)
+ , fInstanceStride(0)
, fVertices()
, fIndices()
, fInstances()
@@ -32,7 +26,7 @@ DrawWriter::DrawWriter(DrawDispatcher* dispatcher,
, fPendingCount(0)
, fPendingBase(0)
, fPendingBufferBinds(true) {
- SkASSERT(dispatcher && bufferManager);
+ SkASSERT(commandList && bufferManager);
}
void DrawWriter::setTemplate(BindBufferInfo vertices,
@@ -89,7 +83,7 @@ void DrawWriter::flush() {
return;
}
if (fPendingBufferBinds) {
- fDispatcher->bindDrawBuffers(fVertices, fInstances, fIndices);
+ fCommandList->bindDrawBuffers(fVertices, fInstances, fIndices);
fPendingBufferBinds = false;
}
@@ -104,18 +98,18 @@ void DrawWriter::flush() {
}
if (fIndices) {
- fDispatcher->drawIndexedInstanced(fPrimitiveType, 0, realVertexCount, 0,
- fPendingBase, fPendingCount);
+ fCommandList->drawIndexedInstanced(fPrimitiveType, 0, realVertexCount, 0,
+ fPendingBase, fPendingCount);
} else {
- fDispatcher->drawInstanced(fPrimitiveType, 0, realVertexCount,
- fPendingBase, fPendingCount);
+ fCommandList->drawInstanced(fPrimitiveType, 0, realVertexCount,
+ fPendingBase, fPendingCount);
}
} else {
SkASSERT(!fInstances);
if (fIndices) {
- fDispatcher->drawIndexed(fPrimitiveType, 0, fPendingCount, fPendingBase);
+ fCommandList->drawIndexed(fPrimitiveType, 0, fPendingCount, fPendingBase);
} else {
- fDispatcher->draw(fPrimitiveType, fPendingBase, fPendingCount);
+ fCommandList->draw(fPrimitiveType, fPendingBase, fPendingCount);
}
}
diff --git a/chromium/third_party/skia/src/gpu/graphite/DrawWriter.h b/chromium/third_party/skia/src/gpu/graphite/DrawWriter.h
index 4c3613bb170..aadc7074663 100644
--- a/chromium/third_party/skia/src/gpu/graphite/DrawWriter.h
+++ b/chromium/third_party/skia/src/gpu/graphite/DrawWriter.h
@@ -14,7 +14,9 @@
namespace skgpu::graphite {
-class DrawDispatcher; // Forward declaration, handles virtual dispatch of binds/draws
+namespace DrawPassCommands {
+class List;
+}
/**
* DrawWriter is a helper around recording draws (to a temporary buffer or directly to a
@@ -53,10 +55,7 @@ class DrawWriter {
public:
// NOTE: This constructor creates a writer that defaults 0 vertex and instance stride, so
// 'newPipelineState()' must be called once the pipeline properties are known before it's used.
- DrawWriter(DrawDispatcher*, DrawBufferManager*);
-
- DrawWriter(DrawDispatcher*, DrawBufferManager*,
- PrimitiveType type, size_t vertexStride, size_t instanceStride);
+ DrawWriter(DrawPassCommands::List*, DrawBufferManager*);
// Cannot move or copy
DrawWriter(const DrawWriter&) = delete;
@@ -189,7 +188,7 @@ public:
private:
// Both of these pointers must outlive the DrawWriter.
- DrawDispatcher* fDispatcher;
+ DrawPassCommands::List* fCommandList;
DrawBufferManager* fManager;
// Pipeline state matching currently bound pipeline
@@ -230,29 +229,6 @@ private:
SkDEBUGCODE(const Appender* fAppender = nullptr;)
};
-// Mirrors the CommandBuffer API, since a DrawWriter is meant to aggregate and then map onto
-// CommandBuffer commands, although these are virtual to allow for recording to intermediate
-// storage before a CommandBuffer is available.
-class DrawDispatcher {
-public:
- virtual ~DrawDispatcher() = default;
-
- virtual void bindDrawBuffers(BindBufferInfo vertexAttribs,
- BindBufferInfo instanceAttribs,
- BindBufferInfo indices) = 0;
-
- virtual void draw(PrimitiveType type, unsigned int baseVertex, unsigned int vertexCount) = 0;
- virtual void drawIndexed(PrimitiveType type, unsigned int baseIndex,
- unsigned int indexCount, unsigned int baseVertex) = 0;
- virtual void drawInstanced(PrimitiveType type,
- unsigned int baseVertex, unsigned int vertexCount,
- unsigned int baseInstance, unsigned int instanceCount) = 0;
- virtual void drawIndexedInstanced(PrimitiveType type,
- unsigned int baseIndex, unsigned int indexCount,
- unsigned int baseVertex, unsigned int baseInstance,
- unsigned int instanceCount) = 0;
-};
-
// Appender implementations for DrawWriter that set the template on creation and provide a
// template-specific API to accumulate vertex/instance data.
class DrawWriter::Appender {
diff --git a/chromium/third_party/skia/src/gpu/graphite/GlobalCache.cpp b/chromium/third_party/skia/src/gpu/graphite/GlobalCache.cpp
index 7fd9130edc6..64d6ed610c1 100644
--- a/chromium/third_party/skia/src/gpu/graphite/GlobalCache.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/GlobalCache.cpp
@@ -8,10 +8,54 @@
#include "src/gpu/graphite/GlobalCache.h"
#include "src/core/SkShaderCodeDictionary.h"
+#include "src/gpu/graphite/ComputePipeline.h"
+#include "src/gpu/graphite/ContextUtils.h"
+#include "src/gpu/graphite/GraphicsPipeline.h"
namespace skgpu::graphite {
-GlobalCache::GlobalCache() : fShaderCodeDictionary(std::make_unique<SkShaderCodeDictionary>()) {}
-GlobalCache::~GlobalCache() {};
+GlobalCache::GlobalCache()
+ : fShaderCodeDictionary(std::make_unique<SkShaderCodeDictionary>())
+ , fGraphicsPipelineCache(16) // TODO: find a good value for these limits
+ , fComputePipelineCache(16) {}
+
+GlobalCache::~GlobalCache() = default;
+
+sk_sp<GraphicsPipeline> GlobalCache::findGraphicsPipeline(const UniqueKey& key) {
+ SkAutoSpinlock lock{fSpinLock};
+
+ sk_sp<GraphicsPipeline>* entry = fGraphicsPipelineCache.find(key);
+ return entry ? *entry : nullptr;
+}
+
+sk_sp<GraphicsPipeline> GlobalCache::addGraphicsPipeline(const UniqueKey& key,
+ sk_sp<GraphicsPipeline> pipeline) {
+ SkAutoSpinlock lock{fSpinLock};
+
+ sk_sp<GraphicsPipeline>* entry = fGraphicsPipelineCache.find(key);
+ if (!entry) {
+ // No equivalent pipeline was stored in the cache between a previous call to
+ // findGraphicsPipeline() that returned null (triggering the pipeline creation) and this
+ // later adding to the cache.
+ entry = fGraphicsPipelineCache.insert(key, std::move(pipeline));
+ } // else there was a race creating the same pipeline and this thread lost, so return the winner
+ return *entry;
+}
+
+sk_sp<ComputePipeline> GlobalCache::findComputePipeline(const UniqueKey& key) {
+ SkAutoSpinlock lock{fSpinLock};
+ sk_sp<ComputePipeline>* entry = fComputePipelineCache.find(key);
+ return entry ? *entry : nullptr;
+}
+
+sk_sp<ComputePipeline> GlobalCache::addComputePipeline(const UniqueKey& key,
+ sk_sp<ComputePipeline> pipeline) {
+ SkAutoSpinlock lock{fSpinLock};
+ sk_sp<ComputePipeline>* entry = fComputePipelineCache.find(key);
+ if (!entry) {
+ entry = fComputePipelineCache.insert(key, std::move(pipeline));
+ }
+ return *entry;
+}
} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/GlobalCache.h b/chromium/third_party/skia/src/gpu/graphite/GlobalCache.h
index 8c79c7e977d..50b3c59decf 100644
--- a/chromium/third_party/skia/src/gpu/graphite/GlobalCache.h
+++ b/chromium/third_party/skia/src/gpu/graphite/GlobalCache.h
@@ -9,26 +9,69 @@
#define skgpu_graphite_GlobalCache_DEFINED
#include "include/core/SkRefCnt.h"
+#include "include/private/SkSpinlock.h"
+#include "src/core/SkLRUCache.h"
+#include "src/gpu/ResourceKey.h"
class SkShaderCodeDictionary;
-namespace SkSL {
-struct ShaderCaps;
-}
-
namespace skgpu::graphite {
-// TODO: This class needs to be thread safe. In the current version there is no thread safety and
-// we need to go back and add protection around access to any of its memebers.
+class ComputePipeline;
+class GraphicsPipeline;
+
+/**
+ * GlobalCache holds GPU resources that should be shared by every Recorder. The common requirement
+ * of these resources are they are static/read-only, have long lifetimes, and are likely to be used
+ * by multiple Recorders. The canonical example of this are pipelines.
+ *
+ * GlobalCache is thread safe, but intentionally splits queries and storing operations so that they
+ * are not atomic. The pattern is to query for a resource, which has a high likelihood of a cache
+ * hit. If it's not found, the Recorder creates the resource on its own, without locking the
+ * GlobalCache. After the resource is created, it is added to the GlobalCache, atomically returning
+ * the winning Resource in the event of a race between Recorders for the same UniqueKey.
+ */
class GlobalCache : public SkRefCnt {
public:
GlobalCache();
~GlobalCache() override;
+ // Find a cached GraphicsPipeline that matches the associated key.
+ sk_sp<GraphicsPipeline> findGraphicsPipeline(const UniqueKey&) SK_EXCLUDES(fSpinLock);
+ // Associate the given pipeline with the key. If the key has already had a separate pipeline
+ // associated with the key, that pipeline is returned and the passed-in pipeline is discarded.
+ // Otherwise, the passed-in pipeline is held by the GlobalCache and also returned back.
+ sk_sp<GraphicsPipeline> addGraphicsPipeline(const UniqueKey&,
+ sk_sp<GraphicsPipeline>) SK_EXCLUDES(fSpinLock);
+
+ // Find amd add operations for ComputePipelines, with the same pattern as GraphicsPipelines.
+ sk_sp<ComputePipeline> findComputePipeline(const UniqueKey&) SK_EXCLUDES(fSpinLock);
+ sk_sp<ComputePipeline> addComputePipeline(const UniqueKey&,
+ sk_sp<ComputePipeline>) SK_EXCLUDES(fSpinLock);
+
SkShaderCodeDictionary* shaderCodeDictionary() const { return fShaderCodeDictionary.get(); }
private:
+ struct KeyHash {
+ uint32_t operator()(const UniqueKey& key) const { return key.hash(); }
+ };
+
+ using GraphicsPipelineCache = SkLRUCache<UniqueKey, sk_sp<GraphicsPipeline>, KeyHash>;
+ using ComputePipelineCache = SkLRUCache<UniqueKey, sk_sp<ComputePipeline>, KeyHash>;
+
+ // TODO: Have this owned through Context separately from GlobalCache
std::unique_ptr<SkShaderCodeDictionary> fShaderCodeDictionary;
+
+ // TODO: can we do something better given this should have write-seldom/read-often behavior?
+ mutable SkSpinlock fSpinLock;
+
+ // GraphicsPipelines and ComputePipelines are expensive to create, likely to be used by multiple
+ // Recorders, and are ideally pre-compiled on process startup so thread write-contention is
+ // expected to be low. For these reasons we store pipelines globally instead of per-Recorder.
+ GraphicsPipelineCache fGraphicsPipelineCache SK_GUARDED_BY(fSpinLock);
+ ComputePipelineCache fComputePipelineCache SK_GUARDED_BY(fSpinLock);
+
+ // TODO: Cache/own static and GPU-private buffers that RenderSteps create on initialization?
};
} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/Gpu.h b/chromium/third_party/skia/src/gpu/graphite/Gpu.h
deleted file mode 100644
index 2e0b349cb82..00000000000
--- a/chromium/third_party/skia/src/gpu/graphite/Gpu.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright 2021 Google LLC
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef skgpu_graphite_Gpu_DEFINED
-#define skgpu_graphite_Gpu_DEFINED
-
-#include "include/core/SkRefCnt.h"
-#include "include/core/SkSize.h"
-#include "include/private/SkDeque.h"
-
-#include "include/gpu/graphite/GraphiteTypes.h"
-
-namespace SkSL {
- class Compiler;
-}
-
-namespace skgpu {
-class SingleOwner;
-}
-
-namespace skgpu::graphite {
-
-class BackendTexture;
-class Caps;
-class CommandBuffer;
-class GlobalCache;
-class GpuWorkSubmission;
-class ResourceProvider;
-class TextureInfo;
-
-// TODO: Figure out if we need to fission Gpu into parts that are needed by a Recorder and parts
-// that are needed only by the Context. In general the Recorder part of Gpu should not be stateful
-// as it will be shared and used by all Recorders. We also don't need calls like submit on the
-// Recorders.
-class Gpu : public SkRefCnt {
-public:
- ~Gpu() override;
-
- /**
- * Gets the capabilities of the draw target.
- */
- const Caps* caps() const { return fCaps.get(); }
- sk_sp<const Caps> refCaps() const;
-
- SkSL::Compiler* shaderCompiler() const { return fCompiler.get(); }
-
- virtual std::unique_ptr<ResourceProvider> makeResourceProvider(sk_sp<GlobalCache>,
- SingleOwner*) const = 0;
-
- bool submit(sk_sp<CommandBuffer>);
- void checkForFinishedWork(SyncToCpu);
-
- BackendTexture createBackendTexture(SkISize dimensions, const TextureInfo&);
- void deleteBackendTexture(BackendTexture&);
-
-#if GRAPHITE_TEST_UTILS
- virtual void testingOnly_startCapture() {}
- virtual void testingOnly_endCapture() {}
-#endif
-
-protected:
- Gpu(sk_sp<const Caps>);
-
- // Subclass must call this to initialize compiler in its constructor.
- void initCompiler();
-
- using OutstandingSubmission = std::unique_ptr<GpuWorkSubmission>;
-
-private:
- virtual OutstandingSubmission onSubmit(sk_sp<CommandBuffer>) = 0;
-
- virtual BackendTexture onCreateBackendTexture(SkISize dimensions, const TextureInfo&) = 0;
- virtual void onDeleteBackendTexture(BackendTexture&) = 0;
-
- sk_sp<const Caps> fCaps;
- // Compiler used for compiling SkSL into backend shader code. We only want to create the
- // compiler once, as there is significant overhead to the first compile.
- std::unique_ptr<SkSL::Compiler> fCompiler;
-
- SkDeque fOutstandingSubmissions;
-};
-
-} // namespace skgpu::graphite
-
-#endif // skgpu_graphite_Gpu_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/graphite/GpuWorkSubmission.h b/chromium/third_party/skia/src/gpu/graphite/GpuWorkSubmission.h
index cba1684715d..f54e76c77d3 100644
--- a/chromium/third_party/skia/src/gpu/graphite/GpuWorkSubmission.h
+++ b/chromium/third_party/skia/src/gpu/graphite/GpuWorkSubmission.h
@@ -12,14 +12,14 @@
namespace skgpu::graphite {
class CommandBuffer;
-class Gpu;
+class SharedContext;
class GpuWorkSubmission {
public:
virtual ~GpuWorkSubmission();
virtual bool isFinished() = 0;
- virtual void waitUntilFinished(const Gpu*) = 0;
+ virtual void waitUntilFinished(const SharedContext*) = 0;
protected:
CommandBuffer* commandBuffer() { return fCommandBuffer.get(); }
diff --git a/chromium/third_party/skia/src/gpu/graphite/GraphicsPipeline.cpp b/chromium/third_party/skia/src/gpu/graphite/GraphicsPipeline.cpp
index 1c326483357..a957bc8a591 100644
--- a/chromium/third_party/skia/src/gpu/graphite/GraphicsPipeline.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/GraphicsPipeline.cpp
@@ -9,9 +9,8 @@
namespace skgpu::graphite {
-GraphicsPipeline::GraphicsPipeline(const Gpu* gpu) : Resource(gpu,
- Ownership::kOwned,
- SkBudgeted::kYes) {
+GraphicsPipeline::GraphicsPipeline(const SharedContext* sharedContext)
+ : Resource(sharedContext, Ownership::kOwned, SkBudgeted::kYes) {
}
GraphicsPipeline::~GraphicsPipeline() {
diff --git a/chromium/third_party/skia/src/gpu/graphite/GraphicsPipeline.h b/chromium/third_party/skia/src/gpu/graphite/GraphicsPipeline.h
index ff66c529dff..e80944ee932 100644
--- a/chromium/third_party/skia/src/gpu/graphite/GraphicsPipeline.h
+++ b/chromium/third_party/skia/src/gpu/graphite/GraphicsPipeline.h
@@ -27,7 +27,7 @@ public:
~GraphicsPipeline() override;
protected:
- GraphicsPipeline(const Gpu*);
+ GraphicsPipeline(const SharedContext*);
private:
};
diff --git a/chromium/third_party/skia/src/gpu/graphite/GraphicsPipelineDesc.h b/chromium/third_party/skia/src/gpu/graphite/GraphicsPipelineDesc.h
index 888b176fb2c..b4b316d6d1b 100644
--- a/chromium/third_party/skia/src/gpu/graphite/GraphicsPipelineDesc.h
+++ b/chromium/third_party/skia/src/gpu/graphite/GraphicsPipelineDesc.h
@@ -30,7 +30,7 @@ class GraphicsPipelineDesc {
public:
GraphicsPipelineDesc();
- SkSpan<const uint32_t> asKey() const { return SkMakeSpan(fKey.data(), fKey.size()); }
+ SkSpan<const uint32_t> asKey() const { return SkSpan(fKey.data(), fKey.size()); }
bool operator==(const GraphicsPipelineDesc& that) const {
return this->fKey == that.fKey;
diff --git a/chromium/third_party/skia/src/gpu/graphite/ImageUtils.cpp b/chromium/third_party/skia/src/gpu/graphite/ImageUtils.cpp
new file mode 100644
index 00000000000..c6de4055992
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/ImageUtils.cpp
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "src/gpu/graphite/ImageUtils.h"
+
+#include "include/gpu/graphite/ImageProvider.h"
+#include "include/gpu/graphite/Recorder.h"
+#include "src/image/SkImage_Base.h"
+
+namespace {
+
+// We require that the user returns a Graphite-backed image that preserves the dimensions, channels
+// and alpha type of the original image. Additionally, it must satisfy the mipmap requirements.
+// The bit depth of the individual channels can change (e.g., 4444 -> 8888 is allowed).
+bool valid_client_provided_image(const SkImage* clientProvided,
+ const SkImage* original,
+ SkImage::RequiredImageProperties requiredProps) {
+ if (!clientProvided ||
+ !as_IB(clientProvided)->isGraphiteBacked() ||
+ original->dimensions() != clientProvided->dimensions() ||
+ original->alphaType() != clientProvided->alphaType()) {
+ return false;
+ }
+
+ uint32_t origChannels = SkColorTypeChannelFlags(original->colorType());
+ uint32_t clientChannels = SkColorTypeChannelFlags(clientProvided->colorType());
+ if (origChannels != clientChannels) {
+ return false;
+ }
+
+ return requiredProps.fMipmapped == skgpu::graphite::Mipmapped::kNo ||
+ clientProvided->hasMipmaps();
+}
+
+} // anonymous namespace
+
+namespace skgpu::graphite {
+
+std::pair<sk_sp<SkImage>, SkSamplingOptions> GetGraphiteBacked(Recorder* recorder,
+ const SkImage* imageIn,
+ SkSamplingOptions sampling) {
+ skgpu::graphite::Mipmapped mipmapped = (sampling.mipmap != SkMipmapMode::kNone)
+ ? skgpu::graphite::Mipmapped::kYes
+ : skgpu::graphite::Mipmapped::kNo;
+
+ if (imageIn->dimensions().area() <= 1 && mipmapped == skgpu::graphite::Mipmapped::kYes) {
+ mipmapped = skgpu::graphite::Mipmapped::kNo;
+ sampling = SkSamplingOptions(SkFilterMode::kLinear, SkMipmapMode::kNone);
+ }
+
+ sk_sp<SkImage> result;
+ if (as_IB(imageIn)->isGraphiteBacked()) {
+ result = sk_ref_sp(imageIn);
+
+ // If the preexisting Graphite-backed image doesn't have the required mipmaps we will drop
+ // down the sampling
+ if (mipmapped == skgpu::graphite::Mipmapped::kYes && !result->hasMipmaps()) {
+ mipmapped = skgpu::graphite::Mipmapped::kNo;
+ sampling = SkSamplingOptions(SkFilterMode::kLinear, SkMipmapMode::kNone);
+ }
+ } else {
+ auto clientImageProvider = recorder->clientImageProvider();
+ result = clientImageProvider->findOrCreate(recorder, imageIn, { mipmapped });
+
+ if (!valid_client_provided_image(result.get(), imageIn, { mipmapped })) {
+ // The client did not fulfill the ImageProvider contract so drop the image.
+ result = nullptr;
+ }
+ }
+
+ return { result, sampling };
+}
+
+} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/ImageUtils.h b/chromium/third_party/skia/src/gpu/graphite/ImageUtils.h
new file mode 100644
index 00000000000..ffaeb1cdd5a
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/ImageUtils.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef skgpu_graphite_ImageUtils_DEFINED
+#define skgpu_graphite_ImageUtils_DEFINED
+
+#include "include/core/SkRefCnt.h"
+
+class SkImage;
+struct SkSamplingOptions;
+
+namespace skgpu::graphite {
+
+class Recorder;
+
+std::pair<sk_sp<SkImage>, SkSamplingOptions> GetGraphiteBacked(Recorder*,
+ const SkImage*,
+ SkSamplingOptions);
+
+} // namespace skgpu::graphite
+
+#endif // skgpu_graphite_ImageUtils_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/graphite/Image_Graphite.cpp b/chromium/third_party/skia/src/gpu/graphite/Image_Graphite.cpp
index f036e234ddc..d6eaf1761c7 100644
--- a/chromium/third_party/skia/src/gpu/graphite/Image_Graphite.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/Image_Graphite.cpp
@@ -58,26 +58,26 @@ std::tuple<TextureProxyView, SkColorType> Image::onAsView(Recorder*,
} // namespace skgpu::graphite
sk_sp<SkImage> SkImage::makeTextureImage(skgpu::graphite::Recorder* recorder,
- skgpu::graphite::Mipmapped mipmapped) const {
+ RequiredImageProperties requiredProps) const {
if (!recorder) {
return nullptr;
}
if (this->dimensions().area() <= 1) {
- mipmapped = skgpu::graphite::Mipmapped::kNo;
+ requiredProps.fMipmapped = skgpu::graphite::Mipmapped::kNo;
}
if (as_IB(this)->isGraphiteBacked()) {
- if (mipmapped == skgpu::graphite::Mipmapped::kNo || this->hasMipmaps()) {
+ if (requiredProps.fMipmapped == skgpu::graphite::Mipmapped::kNo || this->hasMipmaps()) {
const SkImage* image = this;
return sk_ref_sp(const_cast<SkImage*>(image));
}
}
- auto [view, ct] = as_IB(this)->asView(recorder, mipmapped);
+ auto [view, ct] = as_IB(this)->asView(recorder, requiredProps.fMipmapped);
if (!view) {
return nullptr;
}
SkASSERT(view.proxy());
- SkASSERT(mipmapped == skgpu::graphite::Mipmapped::kNo ||
+ SkASSERT(requiredProps.fMipmapped == skgpu::graphite::Mipmapped::kNo ||
view.proxy()->mipmapped() == skgpu::graphite::Mipmapped::kYes);
SkColorInfo colorInfo(ct, this->alphaType(), this->refColorSpace());
return sk_make_sp<skgpu::graphite::Image>(std::move(view),
diff --git a/chromium/third_party/skia/src/gpu/graphite/PaintParams.cpp b/chromium/third_party/skia/src/gpu/graphite/PaintParams.cpp
index 09881d3f65b..b84c49e5ef7 100644
--- a/chromium/third_party/skia/src/gpu/graphite/PaintParams.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/PaintParams.cpp
@@ -9,6 +9,7 @@
#include "include/core/SkShader.h"
#include "src/core/SkBlenderBase.h"
+#include "src/core/SkColorFilterBase.h"
#include "src/core/SkKeyContext.h"
#include "src/core/SkKeyHelpers.h"
#include "src/core/SkPaintParamsKey.h"
@@ -19,30 +20,43 @@
namespace skgpu::graphite {
PaintParams::PaintParams(const SkColor4f& color,
- sk_sp<SkBlender> blender,
- sk_sp<SkShader> shader)
+ sk_sp<SkBlender> finalBlender,
+ sk_sp<SkShader> shader,
+ sk_sp<SkColorFilter> colorFilter,
+ sk_sp<SkBlender> primitiveBlender,
+ bool skipColorXform)
: fColor(color)
- , fBlender(std::move(blender))
- , fShader(std::move(shader)) {}
-
-PaintParams::PaintParams(const SkPaint& paint)
+ , fFinalBlender(std::move(finalBlender))
+ , fShader(std::move(shader))
+ , fColorFilter(std::move(colorFilter))
+ , fPrimitiveBlender(std::move(primitiveBlender))
+ , fSkipColorXform(skipColorXform) {}
+
+PaintParams::PaintParams(const SkPaint& paint,
+ sk_sp<SkBlender> primitiveBlender,
+ bool skipColorXform)
: fColor(paint.getColor4f())
- , fBlender(paint.refBlender())
- , fShader(paint.refShader()) {}
+ , fFinalBlender(paint.refBlender())
+ , fShader(paint.refShader())
+ , fColorFilter(paint.refColorFilter())
+ , fPrimitiveBlender(std::move(primitiveBlender))
+ , fSkipColorXform(skipColorXform) {}
PaintParams::PaintParams(const PaintParams& other) = default;
PaintParams::~PaintParams() = default;
PaintParams& PaintParams::operator=(const PaintParams& other) = default;
-std::optional<SkBlendMode> PaintParams::asBlendMode() const {
- return fBlender ? as_BB(fBlender)->asBlendMode()
- : SkBlendMode::kSrcOver;
+std::optional<SkBlendMode> PaintParams::asFinalBlendMode() const {
+ return fFinalBlender ? as_BB(fFinalBlender)->asBlendMode()
+ : SkBlendMode::kSrcOver;
}
-sk_sp<SkBlender> PaintParams::refBlender() const { return fBlender; }
+sk_sp<SkBlender> PaintParams::refFinalBlender() const { return fFinalBlender; }
sk_sp<SkShader> PaintParams::refShader() const { return fShader; }
+sk_sp<SkColorFilter> PaintParams::refColorFilter() const { return fColorFilter; }
+
void PaintParams::toKey(const SkKeyContext& keyContext,
SkPaintParamsKeyBuilder* builder,
SkPipelineDataGatherer* gatherer) const {
@@ -54,8 +68,12 @@ void PaintParams::toKey(const SkKeyContext& keyContext,
builder->endBlock();
}
- if (fBlender) {
- as_BB(fBlender)->addToKey(keyContext, builder, gatherer);
+ if (fColorFilter) {
+ as_CFB(fColorFilter)->addToKey(keyContext, builder, gatherer);
+ }
+
+ if (fFinalBlender) {
+ as_BB(fFinalBlender)->addToKey(keyContext, builder, gatherer);
} else {
BlendModeBlock::BeginBlock(keyContext, builder, gatherer, SkBlendMode::kSrcOver);
builder->endBlock();
diff --git a/chromium/third_party/skia/src/gpu/graphite/PaintParams.h b/chromium/third_party/skia/src/gpu/graphite/PaintParams.h
index 05e7c9380a5..6ad64b593e9 100644
--- a/chromium/third_party/skia/src/gpu/graphite/PaintParams.h
+++ b/chromium/third_party/skia/src/gpu/graphite/PaintParams.h
@@ -27,8 +27,15 @@ namespace skgpu::graphite {
// assumed to be anti-aliased.
class PaintParams {
public:
- PaintParams(const SkColor4f& color, sk_sp<SkBlender>, sk_sp<SkShader>);
- explicit PaintParams(const SkPaint&);
+ PaintParams(const SkColor4f& color,
+ sk_sp<SkBlender> finalBlender,
+ sk_sp<SkShader>,
+ sk_sp<SkColorFilter>,
+ sk_sp<SkBlender> primitiveBlender,
+ bool skipColorXform);
+ explicit PaintParams(const SkPaint&,
+ sk_sp<SkBlender> primitiveBlender = nullptr,
+ bool skipColorXform = false);
PaintParams(const PaintParams&);
~PaintParams();
@@ -37,21 +44,34 @@ public:
SkColor4f color() const { return fColor; }
- std::optional<SkBlendMode> asBlendMode() const;
- SkBlender* blender() const { return fBlender.get(); }
- sk_sp<SkBlender> refBlender() const;
+ std::optional<SkBlendMode> asFinalBlendMode() const;
+ SkBlender* finalBlender() const { return fFinalBlender.get(); }
+ sk_sp<SkBlender> refFinalBlender() const;
SkShader* shader() const { return fShader.get(); }
sk_sp<SkShader> refShader() const;
+ SkColorFilter* colorFilter() const { return fColorFilter.get(); }
+ sk_sp<SkColorFilter> refColorFilter() const;
+
+ SkBlender* primitiveBlender() const { return fPrimitiveBlender.get(); }
+ sk_sp<SkBlender> refPrimitiveBlender() const;
+
+ bool skipColorXform() const { return fSkipColorXform; }
+
void toKey(const SkKeyContext&,
SkPaintParamsKeyBuilder*,
SkPipelineDataGatherer*) const;
private:
- SkColor4f fColor;
- sk_sp<SkBlender> fBlender; // A nullptr here means SrcOver blending
- sk_sp<SkShader> fShader; // For now only use SkShader::asAGradient() when converting to GPU
+ SkColor4f fColor;
+ sk_sp<SkBlender> fFinalBlender; // A nullptr here means SrcOver blending
+ sk_sp<SkShader> fShader;
+ sk_sp<SkColorFilter> fColorFilter;
+ // A nullptr fPrimitiveBlender means there's no primitive color blending and it is skipped
+ sk_sp<SkBlender> fPrimitiveBlender;
+ bool fSkipColorXform;
+
// TODO: Will also store ColorFilter, dither, and any extra shader from an
// active clipShader().
};
diff --git a/chromium/third_party/skia/src/gpu/graphite/Gpu.cpp b/chromium/third_party/skia/src/gpu/graphite/QueueManager.cpp
index 5ab60031a3b..df72b825f57 100644
--- a/chromium/third_party/skia/src/gpu/graphite/Gpu.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/QueueManager.cpp
@@ -1,20 +1,18 @@
/*
- * Copyright 2021 Google LLC
+ * Copyright 2022 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include "src/gpu/graphite/Gpu.h"
+#include "src/gpu/graphite/QueueManager.h"
-#include "include/gpu/graphite/BackendTexture.h"
-#include "include/gpu/graphite/TextureInfo.h"
-#include "src/gpu/graphite/Caps.h"
+#include "include/gpu/graphite/Recording.h"
+#include "src/gpu/RefCntedCallback.h"
#include "src/gpu/graphite/CommandBuffer.h"
#include "src/gpu/graphite/GpuWorkSubmission.h"
#include "src/gpu/graphite/Log.h"
-#include "src/gpu/graphite/ResourceProvider.h"
-#include "src/sksl/SkSLCompiler.h"
+#include "src/gpu/graphite/RecordingPriv.h"
namespace skgpu::graphite {
@@ -24,41 +22,66 @@ namespace skgpu::graphite {
// submissions we expect to see.
static constexpr int kDefaultOutstandingAllocCnt = 8;
-Gpu::Gpu(sk_sp<const Caps> caps)
- : fCaps(std::move(caps))
- , fOutstandingSubmissions(sizeof(OutstandingSubmission), kDefaultOutstandingAllocCnt) {
- // subclasses create their own subclassed resource provider
+QueueManager::QueueManager(const SharedContext* sharedContext)
+ : fSharedContext(sharedContext)
+ , fOutstandingSubmissions(sizeof(OutstandingSubmission), kDefaultOutstandingAllocCnt) {
}
-Gpu::~Gpu() {
- // TODO: add disconnect?
-
-
- // TODO: destroyResources instead?
- // TODO: how do we handle command buffers that haven't been submitted yet?
+QueueManager::~QueueManager() {
this->checkForFinishedWork(SyncToCpu::kYes);
}
-void Gpu::initCompiler() {
- fCompiler = std::make_unique<SkSL::Compiler>(fCaps->shaderCaps());
-}
+void QueueManager::addRecording(const InsertRecordingInfo& info,
+ ResourceProvider* resourceProvider) {
+ sk_sp<RefCntedCallback> callback;
+ if (info.fFinishedProc) {
+ callback = RefCntedCallback::Make(info.fFinishedProc, info.fFinishedContext);
+ }
+
+ SkASSERT(info.fRecording);
+ if (!info.fRecording) {
+ if (callback) {
+ callback->setFailureResult();
+ }
+ SKGPU_LOG_W("No valid Recording passed into addRecording call");
+ return;
+ }
+
+ if (!fCurrentCommandBuffer) {
+ fCurrentCommandBuffer = this->getNewCommandBuffer();
+ }
+ if (!fCurrentCommandBuffer) {
+ if (callback) {
+ callback->setFailureResult();
+ }
+ return;
+ }
-sk_sp<const Caps> Gpu::refCaps() const {
- return fCaps;
+ if (!info.fRecording->priv().addCommands(resourceProvider, fCurrentCommandBuffer.get())) {
+ if (callback) {
+ callback->setFailureResult();
+ }
+ return;
+ }
+
+ if (callback) {
+ fCurrentCommandBuffer->addFinishedProc(std::move(callback));
+ }
}
-bool Gpu::submit(sk_sp<CommandBuffer> commandBuffer) {
- if (!commandBuffer) {
+bool QueueManager::submitToGpu() {
+ if (!fCurrentCommandBuffer) {
+ SKGPU_LOG_W("Submit called with no active command buffer!");
return false;
}
#ifdef SK_DEBUG
- if (!commandBuffer->hasWork()) {
+ if (!fCurrentCommandBuffer->hasWork()) {
SKGPU_LOG_W("Submitting empty command buffer!");
}
#endif
- auto submission = this->onSubmit(std::move(commandBuffer));
+ auto submission = this->onSubmitToGpu();
if (!submission) {
return false;
}
@@ -67,12 +90,12 @@ bool Gpu::submit(sk_sp<CommandBuffer> commandBuffer) {
return true;
}
-void Gpu::checkForFinishedWork(SyncToCpu sync) {
+void QueueManager::checkForFinishedWork(SyncToCpu sync) {
if (sync == SyncToCpu::kYes) {
// wait for the last submission to finish
OutstandingSubmission* back = (OutstandingSubmission*)fOutstandingSubmissions.back();
if (back) {
- (*back)->waitUntilFinished(this);
+ (*back)->waitUntilFinished(fSharedContext);
}
}
@@ -93,20 +116,4 @@ void Gpu::checkForFinishedWork(SyncToCpu sync) {
SkASSERT(sync == SyncToCpu::kNo || fOutstandingSubmissions.empty());
}
-BackendTexture Gpu::createBackendTexture(SkISize dimensions, const TextureInfo& info) {
- if (dimensions.isEmpty() || dimensions.width() > this->caps()->maxTextureSize() ||
- dimensions.height() > this->caps()->maxTextureSize()) {
- return {};
- }
-
- return this->onCreateBackendTexture(dimensions, info);
-}
-
-void Gpu::deleteBackendTexture(BackendTexture& texture) {
- this->onDeleteBackendTexture(texture);
- // Invalidate the texture;
- texture = BackendTexture();
-}
-
-
} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/QueueManager.h b/chromium/third_party/skia/src/gpu/graphite/QueueManager.h
new file mode 100644
index 00000000000..94bf2c84e54
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/QueueManager.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef skgpu_graphite_QueueManager_DEFINED
+#define skgpu_graphite_QueueManager_DEFINED
+
+#include "include/core/SkRefCnt.h"
+#include "include/gpu/graphite/GraphiteTypes.h"
+#include "include/private/SkDeque.h"
+
+namespace skgpu::graphite {
+
+class CommandBuffer;
+class GpuWorkSubmission;
+struct InsertRecordingInfo;
+class ResourceProvider;
+class SharedContext;
+
+class QueueManager {
+public:
+ virtual ~QueueManager();
+
+ // Adds the commands from the passed in Recording to the current CommandBuffer
+ void addRecording(const InsertRecordingInfo&, ResourceProvider*);
+
+ bool submitToGpu();
+ void checkForFinishedWork(SyncToCpu);
+
+#if GRAPHITE_TEST_UTILS
+ virtual void testingOnly_startCapture() {}
+ virtual void testingOnly_endCapture() {}
+#endif
+
+protected:
+ QueueManager(const SharedContext* sharedContext);
+
+ using OutstandingSubmission = std::unique_ptr<GpuWorkSubmission>;
+
+ const SharedContext* fSharedContext;
+ sk_sp<CommandBuffer> fCurrentCommandBuffer;
+
+private:
+ virtual sk_sp<CommandBuffer> getNewCommandBuffer() = 0;
+ virtual OutstandingSubmission onSubmitToGpu() = 0;
+
+ SkDeque fOutstandingSubmissions;
+};
+
+} // namespace skgpu::graphite
+
+#endif // skgpu_graphite_QueueManager_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/graphite/Recorder.cpp b/chromium/third_party/skia/src/gpu/graphite/Recorder.cpp
index c4e7170a580..57c0644210d 100644
--- a/chromium/third_party/skia/src/gpu/graphite/Recorder.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/Recorder.cpp
@@ -7,33 +7,92 @@
#include "include/gpu/graphite/Recorder.h"
+#include "include/effects/SkRuntimeEffect.h"
+#include "include/gpu/graphite/BackendTexture.h"
+#include "include/gpu/graphite/GraphiteTypes.h"
+#include "include/gpu/graphite/ImageProvider.h"
#include "include/gpu/graphite/Recording.h"
#include "src/core/SkPipelineData.h"
+#include "src/gpu/AtlasTypes.h"
#include "src/gpu/graphite/Caps.h"
#include "src/gpu/graphite/CommandBuffer.h"
#include "src/gpu/graphite/ContextPriv.h"
#include "src/gpu/graphite/Device.h"
#include "src/gpu/graphite/DrawBufferManager.h"
#include "src/gpu/graphite/GlobalCache.h"
-#include "src/gpu/graphite/Gpu.h"
#include "src/gpu/graphite/PipelineDataCache.h"
#include "src/gpu/graphite/ResourceProvider.h"
+#include "src/gpu/graphite/SharedContext.h"
#include "src/gpu/graphite/TaskGraph.h"
#include "src/gpu/graphite/UploadBufferManager.h"
+#include "src/gpu/graphite/text/AtlasManager.h"
+#include "src/image/SkImage_Base.h"
+#include "src/text/gpu/StrikeCache.h"
+#include "src/text/gpu/TextBlobRedrawCoordinator.h"
namespace skgpu::graphite {
#define ASSERT_SINGLE_OWNER SKGPU_ASSERT_SINGLE_OWNER(this->singleOwner())
-Recorder::Recorder(sk_sp<Gpu> gpu, sk_sp<GlobalCache> globalCache)
- : fGpu(std::move(gpu))
+/*
+ * The default image provider doesn't perform any conversion so, by default, Graphite won't
+ * draw any non-Graphite-backed images.
+ */
+class DefaultImageProvider final : public ImageProvider {
+public:
+ static sk_sp<DefaultImageProvider> Make() {
+ return sk_ref_sp(new DefaultImageProvider);
+ }
+
+ sk_sp<SkImage> findOrCreate(Recorder* recorder,
+ const SkImage* image,
+ SkImage::RequiredImageProperties) override {
+ SkASSERT(!as_IB(image)->isGraphiteBacked());
+
+ return nullptr;
+ }
+
+private:
+ DefaultImageProvider() {}
+};
+
+/**************************************************************************************************/
+RecorderOptions::~RecorderOptions() = default;
+
+/**************************************************************************************************/
+static int32_t next_id() {
+ static std::atomic<int32_t> nextID{1};
+ int32_t id;
+ do {
+ id = nextID.fetch_add(1, std::memory_order_relaxed);
+ } while (id == SK_InvalidGenID);
+ return id;
+}
+
+Recorder::Recorder(sk_sp<SharedContext> sharedContext,
+ sk_sp<GlobalCache> globalCache,
+ const RecorderOptions& options)
+ : fSharedContext(std::move(sharedContext))
, fGraph(new TaskGraph)
, fUniformDataCache(new UniformDataCache)
- , fTextureDataCache(new TextureDataCache) {
+ , fTextureDataCache(new TextureDataCache)
+ , fRecorderID(next_id())
+ , fAtlasManager(std::make_unique<AtlasManager>(this))
+ , fTokenTracker(std::make_unique<TokenTracker>())
+ , fStrikeCache(std::make_unique<sktext::gpu::StrikeCache>())
+ , fTextBlobCache(std::make_unique<sktext::gpu::TextBlobRedrawCoordinator>(fRecorderID)) {
+
+ fClientImageProvider = options.fImageProvider;
+ if (!fClientImageProvider) {
+ fClientImageProvider = DefaultImageProvider::Make();
+ }
- fResourceProvider = fGpu->makeResourceProvider(std::move(globalCache), this->singleOwner());
- fDrawBufferManager.reset(new DrawBufferManager(fResourceProvider.get(),
- fGpu->caps()->requiredUniformBufferAlignment()));
+ fResourceProvider = fSharedContext->makeResourceProvider(std::move(globalCache),
+ this->singleOwner());
+ fDrawBufferManager.reset(
+ new DrawBufferManager(fResourceProvider.get(),
+ fSharedContext->caps()->requiredUniformBufferAlignment(),
+ fSharedContext->caps()->requiredStorageBufferAlignment()));
fUploadBufferManager.reset(new UploadBufferManager(fResourceProvider.get()));
SkASSERT(fResourceProvider);
}
@@ -43,8 +102,13 @@ Recorder::~Recorder() {
for (auto& device : fTrackedDevices) {
device->abandonRecorder();
}
+
+ // TODO: needed?
+ fStrikeCache->freeAll();
}
+BackendApi Recorder::backend() const { return fSharedContext->backend(); }
+
std::unique_ptr<Recording> Recorder::snap() {
ASSERT_SINGLE_OWNER
for (auto& device : fTrackedDevices) {
@@ -57,37 +121,23 @@ std::unique_ptr<Recording> Recorder::snap() {
if (!fGraph->prepareResources(fResourceProvider.get())) {
// Leaving 'fTrackedDevices' alone since they were flushed earlier and could still be
// attached to extant SkSurfaces.
- size_t requiredAlignment = fGpu->caps()->requiredUniformBufferAlignment();
- fDrawBufferManager.reset(new DrawBufferManager(fResourceProvider.get(), requiredAlignment));
- fTextureDataCache = std::make_unique<TextureDataCache>();
- // We leave the UniformDataCache alone
- fGraph->reset();
- return nullptr;
- }
-
- // TODO: Adding commands to a CommandBuffer should all take place in the Context when we insert
- // a Recording.
- auto commandBuffer = fResourceProvider->createCommandBuffer();
-
- if (!fGraph->addCommands(fResourceProvider.get(), commandBuffer.get())) {
- // Leaving 'fTrackedDevices' alone since they were flushed earlier and could still be
- // attached to extant SkSurfaces.
- size_t requiredAlignment = fGpu->caps()->requiredUniformBufferAlignment();
- fDrawBufferManager.reset(new DrawBufferManager(fResourceProvider.get(), requiredAlignment));
+ fDrawBufferManager.reset(
+ new DrawBufferManager(fResourceProvider.get(),
+ fSharedContext->caps()->requiredUniformBufferAlignment(),
+ fSharedContext->caps()->requiredStorageBufferAlignment()));
fTextureDataCache = std::make_unique<TextureDataCache>();
// We leave the UniformDataCache alone
fGraph->reset();
+ fResourceProvider->resetAfterSnap();
return nullptr;
}
- // TODO: These buffer refs will need to be stored on Recording before they eventually get passed
- // onto the CommandBuffer.
- fDrawBufferManager->transferToCommandBuffer(commandBuffer.get());
- fUploadBufferManager->transferToCommandBuffer(commandBuffer.get());
+ std::unique_ptr<Recording> recording(new Recording(std::move(fGraph)));
+ fDrawBufferManager->transferToRecording(recording.get());
+ fUploadBufferManager->transferToRecording(recording.get());
- fGraph->reset();
- std::unique_ptr<Recording> recording(new Recording(std::move(commandBuffer),
- std::move(fTextureDataCache)));
+ fGraph = std::make_unique<TaskGraph>();
+ fResourceProvider->resetAfterSnap();
fTextureDataCache = std::make_unique<TextureDataCache>();
return recording;
}
@@ -119,4 +169,22 @@ bool Recorder::deviceIsRegistered(Device* device) {
}
#endif
+BackendTexture Recorder::createBackendTexture(SkISize dimensions, const TextureInfo& info) {
+ ASSERT_SINGLE_OWNER
+
+ if (!info.isValid() || info.backend() != this->backend()) {
+ return {};
+ }
+ return fResourceProvider->createBackendTexture(dimensions, info);
+}
+
+void Recorder::deleteBackendTexture(BackendTexture& texture) {
+ ASSERT_SINGLE_OWNER
+
+ if (!texture.isValid() || texture.backend() != this->backend()) {
+ return;
+ }
+ fResourceProvider->deleteBackendTexture(texture);
+}
+
} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/RecorderPriv.cpp b/chromium/third_party/skia/src/gpu/graphite/RecorderPriv.cpp
index acd5db469c4..b98a35f7c6b 100644
--- a/chromium/third_party/skia/src/gpu/graphite/RecorderPriv.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/RecorderPriv.cpp
@@ -7,10 +7,12 @@
#include "src/gpu/graphite/RecorderPriv.h"
+#include "src/core/SkRuntimeEffectPriv.h"
#include "src/gpu/graphite/Caps.h"
#include "src/gpu/graphite/Device.h"
-#include "src/gpu/graphite/Gpu.h"
+#include "src/gpu/graphite/SharedContext.h"
#include "src/gpu/graphite/TaskGraph.h"
+#include "src/sksl/SkSLUtil.h"
namespace skgpu::graphite {
@@ -29,11 +31,11 @@ TextureDataCache* RecorderPriv::textureDataCache() const {
}
const Caps* RecorderPriv::caps() const {
- return fRecorder->fGpu->caps();
+ return fRecorder->fSharedContext->caps();
}
sk_sp<const Caps> RecorderPriv::refCaps() const {
- return fRecorder->fGpu->refCaps();
+ return fRecorder->fSharedContext->refCaps();
}
DrawBufferManager* RecorderPriv::drawBufferManager() const {
@@ -44,6 +46,31 @@ UploadBufferManager* RecorderPriv::uploadBufferManager() const {
return fRecorder->fUploadBufferManager.get();
}
+AtlasManager* RecorderPriv::atlasManager() {
+ return fRecorder->fAtlasManager.get();
+}
+
+TokenTracker* RecorderPriv::tokenTracker() {
+ return fRecorder->fTokenTracker.get();
+}
+
+sktext::gpu::StrikeCache* RecorderPriv::strikeCache() {
+ return fRecorder->fStrikeCache.get();
+}
+
+sktext::gpu::TextBlobRedrawCoordinator* RecorderPriv::textBlobCache() {
+ return fRecorder->fTextBlobCache.get();
+}
+
+sktext::gpu::SDFTControl RecorderPriv::getSDFTControl(bool useSDFTForSmallText) const {
+ return sktext::gpu::SDFTControl{
+ this->caps()->shaderCaps()->supportsDistanceFieldText(),
+ useSDFTForSmallText,
+ this->caps()->minDistanceFieldFontSize(),
+ this->caps()->glyphsAsPathsFontSize(),
+ false /*forcePaths*/};
+}
+
void RecorderPriv::add(sk_sp<Task> task) {
ASSERT_SINGLE_OWNER
fRecorder->fGraph->add(std::move(task));
diff --git a/chromium/third_party/skia/src/gpu/graphite/RecorderPriv.h b/chromium/third_party/skia/src/gpu/graphite/RecorderPriv.h
index f5241251870..15a544c6270 100644
--- a/chromium/third_party/skia/src/gpu/graphite/RecorderPriv.h
+++ b/chromium/third_party/skia/src/gpu/graphite/RecorderPriv.h
@@ -9,9 +9,16 @@
#define skgpu_graphite_RecorderPriv_DEFINED
#include "include/gpu/graphite/Recorder.h"
+#include "src/text/gpu/SDFTControl.h"
+
+namespace skgpu {
+enum class MaskFormat : int;
+}
namespace skgpu::graphite {
+class TextureProxy;
+
class RecorderPriv {
public:
void add(sk_sp<Task>);
@@ -21,9 +28,17 @@ public:
TextureDataCache* textureDataCache() const;
DrawBufferManager* drawBufferManager() const;
UploadBufferManager* uploadBufferManager() const;
+ AtlasManager* atlasManager();
+ TokenTracker* tokenTracker();
+ sktext::gpu::StrikeCache* strikeCache();
+ sktext::gpu::TextBlobRedrawCoordinator* textBlobCache();
+ sktext::gpu::SDFTControl getSDFTControl(bool useSDFTForSmallText) const;
const Caps* caps() const;
sk_sp<const Caps> refCaps() const;
+ const sk_sp<skgpu::graphite::TextureProxy>* getAtlasProxies(skgpu::MaskFormat maskformat,
+ unsigned int* numActiveProxies);
+
void flushTrackedDevices();
private:
diff --git a/chromium/third_party/skia/src/gpu/graphite/Recording.cpp b/chromium/third_party/skia/src/gpu/graphite/Recording.cpp
index 28fa10d7ddf..452a84f1e1e 100644
--- a/chromium/third_party/skia/src/gpu/graphite/Recording.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/Recording.cpp
@@ -8,16 +8,32 @@
#include "include/gpu/graphite/Recording.h"
#include "src/gpu/graphite/CommandBuffer.h"
-#include "src/gpu/graphite/PipelineDataCache.h"
+#include "src/gpu/graphite/RecordingPriv.h"
+#include "src/gpu/graphite/Resource.h"
+#include "src/gpu/graphite/ResourceProvider.h"
+#include "src/gpu/graphite/TaskGraph.h"
namespace skgpu::graphite {
-Recording::Recording(sk_sp<CommandBuffer> commandBuffer,
- std::unique_ptr<TextureDataCache> textureDataCache)
- : fCommandBuffer(std::move(commandBuffer))
- , fTextureDataCache(std::move(textureDataCache)) {
+Recording::Recording(std::unique_ptr<TaskGraph> graph) : fGraph(std::move(graph)) {
}
Recording::~Recording() {}
+////////////////////////////////////////////////////////////////////////////////
+
+bool RecordingPriv::addCommands(ResourceProvider* resourceProvider, CommandBuffer* commandBuffer) {
+ if (!fRecording->fGraph->addCommands(resourceProvider, commandBuffer)) {
+ return false;
+ }
+ for (size_t i = 0; i < fRecording->fExtraResourceRefs.size(); ++i) {
+ commandBuffer->trackResource(fRecording->fExtraResourceRefs[i]);
+ }
+ return true;
+}
+
+void RecordingPriv::addResourceRef(sk_sp<Resource> resource) {
+ fRecording->fExtraResourceRefs.push_back(std::move(resource));
+}
+
} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/RecordingPriv.h b/chromium/third_party/skia/src/gpu/graphite/RecordingPriv.h
new file mode 100644
index 00000000000..c76884a3708
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/RecordingPriv.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef skgpu_graphite_RecorderPriv_DEFINED
+#define skgpu_graphite_RecorderPriv_DEFINED
+
+#include "include/gpu/graphite/Recording.h"
+
+namespace skgpu::graphite {
+
+class RecordingPriv {
+public:
+ bool addCommands(ResourceProvider*, CommandBuffer*);
+ void addResourceRef(sk_sp<Resource> resource);
+
+private:
+ explicit RecordingPriv(Recording* recorder) : fRecording(recorder) {}
+ RecordingPriv& operator=(const RecordingPriv&) = delete;
+
+ // No taking addresses of this type.
+ const RecordingPriv* operator&() const = delete;
+ RecordingPriv* operator&() = delete;
+
+ Recording* fRecording;
+
+ friend class Recording; // to construct/copy this type.
+};
+
+inline RecordingPriv Recording::priv() {
+ return RecordingPriv(this);
+}
+
+} // namespace skgpu::graphite
+
+#endif // skgpu_graphite_RecordingPriv_DEFINED
+
diff --git a/chromium/third_party/skia/src/gpu/graphite/RenderPassTask.cpp b/chromium/third_party/skia/src/gpu/graphite/RenderPassTask.cpp
index 222bda266ec..fc66e0035af 100644
--- a/chromium/third_party/skia/src/gpu/graphite/RenderPassTask.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/RenderPassTask.cpp
@@ -103,23 +103,11 @@ bool RenderPassTask::addCommands(ResourceProvider* resourceProvider, CommandBuff
// single sample resolve as an input attachment in that subpass, and then do a draw. The big
// thing with Vulkan is that this input attachment and subpass means we also need to update
// the fRenderPassDesc here.
- if (commandBuffer->beginRenderPass(fRenderPassDesc,
- std::move(colorAttachment),
- std::move(resolveAttachment),
- std::move(depthStencilAttachment))) {
- // Assuming one draw pass per renderpasstask for now
- SkASSERT(fDrawPasses.size() == 1);
- for (const auto& drawPass: fDrawPasses) {
- if (!drawPass->addCommands(commandBuffer)) {
- commandBuffer->endRenderPass();
- return false;
- }
- }
-
- commandBuffer->endRenderPass();
- }
-
- return true;
+ return commandBuffer->addRenderPass(fRenderPassDesc,
+ std::move(colorAttachment),
+ std::move(resolveAttachment),
+ std::move(depthStencilAttachment),
+ fDrawPasses);
}
} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/Renderer.h b/chromium/third_party/skia/src/gpu/graphite/Renderer.h
index 414ace2d6ba..3b45247ab0a 100644
--- a/chromium/third_party/skia/src/gpu/graphite/Renderer.h
+++ b/chromium/third_party/skia/src/gpu/graphite/Renderer.h
@@ -16,6 +16,7 @@
#include "include/core/SkSpan.h"
#include "include/core/SkString.h"
#include "include/core/SkTypes.h"
+#include "include/core/SkVertices.h"
#include "src/core/SkUniform.h"
#include <array>
@@ -26,12 +27,22 @@
enum class SkPathFillType;
class SkPipelineDataGatherer;
+class SkTextureDataBlock;
+
+namespace skgpu { enum class MaskFormat; }
namespace skgpu::graphite {
+
class DrawWriter;
-class DrawGeometry;
+class DrawParams;
class ResourceProvider;
+struct Varying {
+ const char* fName;
+ SkSLType fType;
+ // TODO: add modifier (e.g., flat and noperspective) support
+};
+
class RenderStep {
public:
virtual ~RenderStep() = default;
@@ -39,22 +50,19 @@ public:
// The DrawWriter is configured with the vertex and instance strides of the RenderStep, and its
// primitive type. The recorded draws will be executed with a graphics pipeline compatible with
// this RenderStep.
- virtual void writeVertices(DrawWriter*, const DrawGeometry&) const = 0;
+ virtual void writeVertices(DrawWriter*, const DrawParams&, int ssboIndex) const = 0;
- // Write out the uniform values (aligned for the layout). These values will be de-duplicated
- // across all draws using the RenderStep before uploading to the GPU, but it can be assumed the
- // uniforms will be bound before the draws recorded in 'writeVertices' are executed.
+ // Write out the uniform values (aligned for the layout), textures, and samplers. The uniform
+ // values will be de-duplicated across all draws using the RenderStep before uploading to the
+ // GPU, but it can be assumed the uniforms will be bound before the draws recorded in
+ // 'writeVertices' are executed.
// TODO: We definitely want this to return CPU memory since it's better for the caller to handle
// the de-duplication and GPU upload/binding (DrawPass tracks all this). However, a RenderStep's
// uniforms aren't going to change, and the Layout won't change during a process, so it would be
// nice if we could remember the offsets for the layout/gpu and reuse them across draws.
// Similarly, it would be nice if this could write into reusable storage and then DrawPass or
// UniformCache handles making an sk_sp if we need to assign a new unique ID to the uniform data
- virtual void writeUniforms(const DrawGeometry&, SkPipelineDataGatherer*) const = 0;
-
- // Returns a name formatted as "Subclass[variant]", where "Subclass" matches the C++ class name
- // and variant is a unique term describing instance's specific configuration.
- const char* name() const { return fName.c_str(); }
+ virtual void writeUniformsAndTextures(const DrawParams&, SkPipelineDataGatherer*) const = 0;
// TODO: This is only temporary. Eventually the RenderStep will define its logic in SkSL and
// be able to have code operate in both the vertex and fragment shaders. Ideally the RenderStep
@@ -62,23 +70,56 @@ public:
// although we could go as far as allowing RenderStep to handle composing the final SkSL if
// given the paint combination's SkSL.
- // Returns the body of a vertex function, which must define a float4 devPosition variable.
- // It has access to the variables declared by vertexAttributes(), instanceAttributes(),
- // and uniforms(). The 'devPosition' variable's z must store the PaintDepth normalized to a
- // float from [0, 1], for each processed draw although the RenderStep can choose to upload it
- // as attributes or uniforms.
+ // Returns the body of a vertex function, which must define a float4 devPosition variable and
+ // can optionally define a float2 stepLocalCoords variable. It has access to the variables
+ // declared by vertexAttributes(), instanceAttributes(), and uniforms(). The 'devPosition'
+ // variable's z must store the PaintDepth normalized to a float from [0, 1], for each processed
+ // draw although the RenderStep can choose to upload it as attributes or uniforms.
//
// NOTE: The above contract is mainly so that the entire SkSL program can be created by just str
// concatenating struct definitions generated from the RenderStep and paint Combination
// and then including the function bodies returned here.
virtual const char* vertexSkSL() const = 0;
- bool requiresMSAA() const { return fFlags & Flags::kRequiresMSAA; }
- bool performsShading() const { return fFlags & Flags::kPerformsShading; }
+ // Emits code to set up textures and samplers. Should only be defined if hasTextures is true.
+ virtual std::string texturesAndSamplersSkSL(int startBinding) const { return R"()"; }
+
+ // Emits code to set up coverage value. Should only be defined if overridesCoverage is true.
+ // When implemented the returned SkSL fragment should write its coverage into a
+ // 'half4 outputCoverage' variable (defined in the calling code) with the actual
+ // coverage splatted out into all four channels.
+ virtual const char* fragmentCoverageSkSL() const { return R"()"; }
+
+ // Emits code to set up a primitive color value. Should only be defined if emitsPrimitiveColor
+ // is true. When implemented, the returned SkSL fragment should write its color into a
+ // 'half4 primitiveColor' variable (defined in the calling code).
+ virtual const char* fragmentColorSkSL() const { return R"()"; }
+
+ // Returns a name formatted as "Subclass[variant]", where "Subclass" matches the C++ class name
+ // and variant is a unique term describing instance's specific configuration.
+ const char* name() const { return fName.c_str(); }
+
+ bool requiresMSAA() const { return fFlags & Flags::kRequiresMSAA; }
+ bool performsShading() const { return fFlags & Flags::kPerformsShading; }
+ bool hasTextures() const { return fFlags & Flags::kHasTextures; }
+ bool emitsCoverage() const { return fFlags & Flags::kEmitsCoverage; }
+ bool emitsPrimitiveColor() const { return fFlags & Flags::kEmitsPrimitiveColor; }
+
+ PrimitiveType primitiveType() const { return fPrimitiveType; }
+ size_t vertexStride() const { return fVertexStride; }
+ size_t instanceStride() const { return fInstanceStride; }
- PrimitiveType primitiveType() const { return fPrimitiveType; }
- size_t vertexStride() const { return fVertexStride; }
- size_t instanceStride() const { return fInstanceStride; }
+ size_t numUniforms() const { return fUniforms.size(); }
+ size_t numVertexAttributes() const { return fVertexAttrs.size(); }
+ size_t numInstanceAttributes() const { return fInstanceAttrs.size(); }
+ size_t numVaryings() const { return fVaryings.size(); }
+
+ // The uniforms of a RenderStep are bound to the kRenderStep slot, the rest of the pipeline
+ // may still use uniforms bound to other slots.
+ SkSpan<const SkUniform> uniforms() const { return SkSpan(fUniforms); }
+ SkSpan<const Attribute> vertexAttributes() const { return SkSpan(fVertexAttrs); }
+ SkSpan<const Attribute> instanceAttributes() const { return SkSpan(fInstanceAttrs); }
+ SkSpan<const Varying> varyings() const { return SkSpan(fVaryings); }
const DepthStencilSettings& depthStencilSettings() const { return fDepthStencilSettings; }
@@ -89,17 +130,6 @@ public:
? DepthStencilFlags::kDepth : DepthStencilFlags::kNone);
}
- size_t numUniforms() const { return fUniforms.size(); }
- size_t numVertexAttributes() const { return fVertexAttrs.size(); }
- size_t numInstanceAttributes() const { return fInstanceAttrs.size(); }
-
- // The uniforms of a RenderStep are bound to the kRenderStep slot, the rest of the pipeline
- // may still use uniforms bound to other slots.
- SkSpan<const SkUniform> uniforms() const { return SkMakeSpan(fUniforms); }
- SkSpan<const Attribute> vertexAttributes() const { return SkMakeSpan(fVertexAttrs); }
- SkSpan<const Attribute> instanceAttributes() const { return SkMakeSpan(fInstanceAttrs); }
-
-
// TODO: Actual API to do things
// 6. Some Renderers benefit from being able to share vertices between RenderSteps. Must find a
// way to support that. It may mean that RenderSteps get state per draw.
@@ -107,12 +137,14 @@ public:
// - Does DrawList->DrawPass conversion build a separate array of blind data that the
// stateless Renderstep can refer to for {draw,step} pairs?
// - Does each DrawList::Draw have extra space (e.g. 8 bytes) that steps can cache data in?
- // 7. Painter's order for the draw sent as uniform or attribute
protected:
enum class Flags : unsigned {
- kNone = 0b000,
- kRequiresMSAA = 0b001,
- kPerformsShading = 0b010,
+ kNone = 0b00000,
+ kRequiresMSAA = 0b00001,
+ kPerformsShading = 0b00010,
+ kHasTextures = 0b00100,
+ kEmitsCoverage = 0b01000,
+ kEmitsPrimitiveColor = 0b10000,
};
SK_DECL_BITMASK_OPS_FRIENDS(Flags);
@@ -126,13 +158,15 @@ protected:
PrimitiveType primitiveType,
DepthStencilSettings depthStencilSettings,
std::initializer_list<Attribute> vertexAttrs,
- std::initializer_list<Attribute> instanceAttrs)
+ std::initializer_list<Attribute> instanceAttrs,
+ std::initializer_list<Varying> varyings = {})
: fFlags(flags)
, fPrimitiveType(primitiveType)
, fDepthStencilSettings(depthStencilSettings)
, fUniforms(uniforms)
, fVertexAttrs(vertexAttrs)
, fInstanceAttrs(instanceAttrs)
+ , fVaryings(varyings)
, fVertexStride(0)
, fInstanceStride(0)
, fName(className) {
@@ -168,6 +202,7 @@ private:
std::vector<SkUniform> fUniforms;
std::vector<Attribute> fVertexAttrs;
std::vector<Attribute> fInstanceAttrs;
+ std::vector<Varying> fVaryings;
size_t fVertexStride; // derived from vertex attribute set
size_t fInstanceStride; // derived from instance attribute set
@@ -205,8 +240,15 @@ public:
static const Renderer& TessellatedStrokes();
- // TODO: Add renderers for primitives (rect, rrect, etc.), special draws (atlas, vertices, text)
- // and support inverse filled strokes.
+ static const Renderer& TextDirect(bool isA8);
+
+ static const Renderer& TextSDF(bool useLCDText);
+
+ static const Renderer& Vertices(SkVertices::VertexMode, bool hasColors, bool hasTexCoords);
+
+
+ // TODO: Add renderers for primitives (rect, rrect, etc.) and atlas draws; add support for
+ // inverse filled strokes.
// The maximum number of render steps that any Renderer is allowed to have.
static constexpr int kMaxRenderSteps = 4;
@@ -215,9 +257,11 @@ public:
return {&fSteps.front(), static_cast<size_t>(fStepCount) };
}
- const char* name() const { return fName.c_str(); }
- int numRenderSteps() const { return fStepCount; }
- bool requiresMSAA() const { return fRequiresMSAA; }
+ const char* name() const { return fName.c_str(); }
+ int numRenderSteps() const { return fStepCount; }
+ bool requiresMSAA() const { return fRequiresMSAA; }
+ bool emitsCoverage() const { return fEmitsCoverage; }
+ bool emitsPrimitiveColor() const { return fEmitsPrimitiveColor; }
SkEnumBitMask<DepthStencilFlags> depthStencilFlags() const { return fDepthStencilFlags; }
@@ -245,7 +289,9 @@ private:
for (int i = 0 ; i < fStepCount; ++i) {
fSteps[i] = steps[i];
fRequiresMSAA |= fSteps[i]->requiresMSAA();
+ fEmitsCoverage |= fSteps[i]->emitsCoverage();
fDepthStencilFlags |= fSteps[i]->depthStencilFlags();
+ fEmitsPrimitiveColor |= fSteps[i]->emitsPrimitiveColor();
SkDEBUGCODE(performsShading |= fSteps[i]->performsShading());
}
SkASSERT(performsShading); // at least one step needs to actually shade
@@ -260,6 +306,8 @@ private:
SkString fName;
int fStepCount;
bool fRequiresMSAA = false;
+ bool fEmitsCoverage = false;
+ bool fEmitsPrimitiveColor = false;
SkEnumBitMask<DepthStencilFlags> fDepthStencilFlags = DepthStencilFlags::kNone;
};
diff --git a/chromium/third_party/skia/src/gpu/graphite/Resource.cpp b/chromium/third_party/skia/src/gpu/graphite/Resource.cpp
index aee179506b9..8d9afeea78b 100644
--- a/chromium/third_party/skia/src/gpu/graphite/Resource.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/Resource.cpp
@@ -11,8 +11,8 @@
namespace skgpu::graphite {
-Resource::Resource(const Gpu* gpu, Ownership ownership, SkBudgeted budgeted)
- : fGpu(gpu)
+Resource::Resource(const SharedContext* sharedContext, Ownership ownership, SkBudgeted budgeted)
+ : fSharedContext(sharedContext)
, fUsageRefCnt(1)
, fCommandBufferRefCnt(0)
, fCacheRefCnt(0)
@@ -57,9 +57,9 @@ bool Resource::notifyARefIsZero(LastRemovedRef removedRef) const {
}
void Resource::internalDispose() {
- SkASSERT(fGpu);
+ SkASSERT(fSharedContext);
this->freeGpuData();
- fGpu = nullptr;
+ fSharedContext = nullptr;
// TODO: If we ever support freeing all the backend objects without deleting the object, we'll
// need to add a hasAnyRefs() check here.
delete this;
diff --git a/chromium/third_party/skia/src/gpu/graphite/Resource.h b/chromium/third_party/skia/src/gpu/graphite/Resource.h
index 97bdfca4b4d..d01ac9e3950 100644
--- a/chromium/third_party/skia/src/gpu/graphite/Resource.h
+++ b/chromium/third_party/skia/src/gpu/graphite/Resource.h
@@ -18,8 +18,8 @@ class SkMutex;
namespace skgpu::graphite {
-class Gpu;
class ResourceCache;
+class SharedContext;
/**
* Base class for objects that can be kept in the ResourceCache.
@@ -92,7 +92,7 @@ public:
// deleting this object. However, I want to implement all the purging logic first to make sure
// we don't have a use case for calling internalDispose but not wanting to delete the actual
// object yet.
- bool wasDestroyed() const { return fGpu == nullptr; }
+ bool wasDestroyed() const { return fSharedContext == nullptr; }
const GraphiteResourceKey& key() const { return fKey; }
// This should only ever be called by the ResourceProvider
@@ -102,7 +102,7 @@ public:
}
protected:
- Resource(const Gpu*, Ownership, SkBudgeted);
+ Resource(const SharedContext*, Ownership, SkBudgeted);
virtual ~Resource();
// Overridden to free GPU resources in the backend API.
@@ -219,7 +219,7 @@ private:
// This is not ref'ed but internalDispose() will be called before the Gpu object is destroyed.
// That call will set this to nullptr.
- const Gpu* fGpu;
+ const SharedContext* fSharedContext;
mutable std::atomic<int32_t> fUsageRefCnt;
mutable std::atomic<int32_t> fCommandBufferRefCnt;
diff --git a/chromium/third_party/skia/src/gpu/graphite/ResourceProvider.cpp b/chromium/third_party/skia/src/gpu/graphite/ResourceProvider.cpp
index 030d40eaab7..7e395628e52 100644
--- a/chromium/third_party/skia/src/gpu/graphite/ResourceProvider.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/ResourceProvider.cpp
@@ -7,38 +7,72 @@
#include "src/gpu/graphite/ResourceProvider.h"
+#include "include/core/SkSamplingOptions.h"
+#include "include/core/SkTileMode.h"
+#include "include/gpu/graphite/BackendTexture.h"
#include "src/gpu/graphite/Buffer.h"
#include "src/gpu/graphite/Caps.h"
#include "src/gpu/graphite/CommandBuffer.h"
+#include "src/gpu/graphite/ComputePipeline.h"
#include "src/gpu/graphite/ContextPriv.h"
#include "src/gpu/graphite/GlobalCache.h"
-#include "src/gpu/graphite/Gpu.h"
#include "src/gpu/graphite/GraphicsPipeline.h"
+#include "src/gpu/graphite/GraphicsPipelineDesc.h"
+#include "src/gpu/graphite/Log.h"
#include "src/gpu/graphite/ResourceCache.h"
#include "src/gpu/graphite/Sampler.h"
+#include "src/gpu/graphite/SharedContext.h"
#include "src/gpu/graphite/Texture.h"
+#include "src/sksl/SkSLCompiler.h"
namespace skgpu::graphite {
-ResourceProvider::ResourceProvider(const Gpu* gpu,
+ResourceProvider::ResourceProvider(const SharedContext* sharedContext,
sk_sp<GlobalCache> globalCache,
SingleOwner* singleOwner)
- : fGpu(gpu)
+ : fSharedContext(sharedContext)
, fResourceCache(ResourceCache::Make(singleOwner))
, fGlobalCache(std::move(globalCache)) {
SkASSERT(fResourceCache);
- fGraphicsPipelineCache.reset(new GraphicsPipelineCache(this));
+ fCompiler = std::make_unique<SkSL::Compiler>(fSharedContext->caps()->shaderCaps());
}
ResourceProvider::~ResourceProvider() {
- fGraphicsPipelineCache.release();
fResourceCache->shutdown();
}
sk_sp<GraphicsPipeline> ResourceProvider::findOrCreateGraphicsPipeline(
- const GraphicsPipelineDesc& pipelineDesc,
- const RenderPassDesc& renderPassDesc) {
- return fGraphicsPipelineCache->refPipeline(fGpu->caps(), pipelineDesc, renderPassDesc);
+ const GraphicsPipelineDesc& pipelineDesc, const RenderPassDesc& renderPassDesc) {
+ UniqueKey pipelineKey = fSharedContext->caps()->makeGraphicsPipelineKey(pipelineDesc,
+ renderPassDesc);
+ sk_sp<GraphicsPipeline> pipeline = fGlobalCache->findGraphicsPipeline(pipelineKey);
+ if (!pipeline) {
+ // Haven't encountered this pipeline, so create a new one. Since pipelines are shared
+ // across Recorders, we could theoretically create equivalent pipelines on different
+ // threads. If this happens, GlobalCache returns the first-through-gate pipeline and we
+ // discard the redundant pipeline. While this is wasted effort in the rare event of a race,
+ // it allows pipeline creation to be performed without locking the global cache.
+ pipeline = this->createGraphicsPipeline(pipelineDesc, renderPassDesc);
+ if (pipeline) {
+ // TODO: Should we store a null pipeline if we failed to create one so that subsequent
+ // usage immediately sees that the pipeline cannot be created, vs. retrying every time?
+ pipeline = fGlobalCache->addGraphicsPipeline(pipelineKey, std::move(pipeline));
+ }
+ }
+ return pipeline;
+}
+
+sk_sp<ComputePipeline> ResourceProvider::findOrCreateComputePipeline(
+ const ComputePipelineDesc& pipelineDesc) {
+ UniqueKey pipelineKey = fSharedContext->caps()->makeComputePipelineKey(pipelineDesc);
+ sk_sp<ComputePipeline> pipeline = fGlobalCache->findComputePipeline(pipelineKey);
+ if (!pipeline) {
+ pipeline = this->createComputePipeline(pipelineDesc);
+ if (pipeline) {
+ pipeline = fGlobalCache->addComputePipeline(pipelineKey, std::move(pipeline));
+ }
+ }
+ return pipeline;
}
SkShaderCodeDictionary* ResourceProvider::shaderCodeDictionary() const {
@@ -47,42 +81,6 @@ SkShaderCodeDictionary* ResourceProvider::shaderCodeDictionary() const {
////////////////////////////////////////////////////////////////////////////////////////////////
-struct ResourceProvider::GraphicsPipelineCache::Entry {
- Entry(sk_sp<GraphicsPipeline> pipeline) : fPipeline(std::move(pipeline)) {}
-
- sk_sp<GraphicsPipeline> fPipeline;
-};
-
-ResourceProvider::GraphicsPipelineCache::GraphicsPipelineCache(ResourceProvider* resourceProvider)
- : fMap(16) // TODO: find a good value for this
- , fResourceProvider(resourceProvider) {}
-
-ResourceProvider::GraphicsPipelineCache::~GraphicsPipelineCache() {
- SkASSERT(0 == fMap.count());
-}
-
-void ResourceProvider::GraphicsPipelineCache::release() {
- fMap.reset();
-}
-
-sk_sp<GraphicsPipeline> ResourceProvider::GraphicsPipelineCache::refPipeline(
- const Caps* caps,
- const GraphicsPipelineDesc& pipelineDesc,
- const RenderPassDesc& renderPassDesc) {
- UniqueKey pipelineKey = caps->makeGraphicsPipelineKey(pipelineDesc, renderPassDesc);
-
- std::unique_ptr<Entry>* entry = fMap.find(pipelineKey);
-
- if (!entry) {
- auto pipeline = fResourceProvider->onCreateGraphicsPipeline(pipelineDesc, renderPassDesc);
- if (!pipeline) {
- return nullptr;
- }
- entry = fMap.insert(pipelineKey, std::unique_ptr<Entry>(new Entry(std::move(pipeline))));
- }
- return (*entry)->fPipeline;
-}
-
sk_sp<Texture> ResourceProvider::findOrCreateScratchTexture(SkISize dimensions,
const TextureInfo& info,
SkBudgeted budgeted) {
@@ -92,7 +90,7 @@ sk_sp<Texture> ResourceProvider::findOrCreateScratchTexture(SkISize dimensions,
GraphiteResourceKey key;
// Scratch textures are not shareable
- fGpu->caps()->buildKeyForTexture(dimensions, info, kType, Shareable::kNo, &key);
+ fSharedContext->caps()->buildKeyForTexture(dimensions, info, kType, Shareable::kNo, &key);
return this->findOrCreateTextureWithKey(dimensions, info, key, budgeted);
}
@@ -107,7 +105,7 @@ sk_sp<Texture> ResourceProvider::findOrCreateDepthStencilAttachment(SkISize dime
// We always make depth and stencil attachments shareable. Between any render pass the values
// are reset. Thus it is safe to be used by multiple different render passes without worry of
// stomping on each other's data.
- fGpu->caps()->buildKeyForTexture(dimensions, info, kType, Shareable::kYes, &key);
+ fSharedContext->caps()->buildKeyForTexture(dimensions, info, kType, Shareable::kYes, &key);
return this->findOrCreateTextureWithKey(dimensions, info, key, SkBudgeted::kYes);
}
@@ -123,7 +121,7 @@ sk_sp<Texture> ResourceProvider::findOrCreateDiscardableMSAAAttachment(SkISize d
// the values of the MSAA texture. Thus it is safe to be used by multiple different render
// passes without worry of stomping on each other's data. It is the callings code responsiblity
// to populate the discardable MSAA texture with data at the start of the render pass.
- fGpu->caps()->buildKeyForTexture(dimensions, info, kType, Shareable::kYes, &key);
+ fSharedContext->caps()->buildKeyForTexture(dimensions, info, kType, Shareable::kYes, &key);
return this->findOrCreateTextureWithKey(dimensions, info, key, SkBudgeted::kYes);
}
@@ -154,7 +152,46 @@ sk_sp<Texture> ResourceProvider::findOrCreateTextureWithKey(SkISize dimensions,
sk_sp<Sampler> ResourceProvider::findOrCreateCompatibleSampler(const SkSamplingOptions& smplOptions,
SkTileMode xTileMode,
SkTileMode yTileMode) {
- return this->createSampler(smplOptions, xTileMode, yTileMode);
+ static const ResourceType kType = GraphiteResourceKey::GenerateResourceType();
+
+ GraphiteResourceKey key;
+ {
+ constexpr int kNumTileModeBits = SkNextLog2_portable(int(SkTileMode::kLastTileMode)+1);
+ constexpr int kNumFilterModeBits = SkNextLog2_portable(int(SkFilterMode::kLast)+1);
+ constexpr int kNumMipmapModeBits = SkNextLog2_portable(int(SkMipmapMode::kLast)+1);
+
+ constexpr int kTileModeXShift = 0;
+ constexpr int kTileModeYShift = kTileModeXShift + kNumTileModeBits;
+ constexpr int kFilterModeShift = kTileModeYShift + kNumTileModeBits;
+ constexpr int kMipmapModeShift = kFilterModeShift + kNumFilterModeBits;
+
+ static_assert(kMipmapModeShift + kNumMipmapModeBits <= 32);
+
+ // For the key we need only one uint32_t.
+ // TODO: add aniso value when used
+ static_assert(sizeof(uint32_t) == 4);
+
+ GraphiteResourceKey::Builder builder(&key, kType, 1, Shareable::kYes);
+ uint32_t myKey =
+ (static_cast<uint32_t>(xTileMode) << kTileModeXShift) |
+ (static_cast<uint32_t>(yTileMode) << kTileModeYShift) |
+ (static_cast<uint32_t>(smplOptions.filter) << kFilterModeShift) |
+ (static_cast<uint32_t>(smplOptions.mipmap) << kMipmapModeShift);
+ builder[0] = myKey;
+ }
+
+ SkBudgeted budgeted = SkBudgeted::kYes;
+ if (Resource* resource = fResourceCache->findAndRefResource(key, budgeted)) {
+ return sk_sp<Sampler>(static_cast<Sampler*>(resource));
+ }
+ sk_sp<Sampler> sampler = this->createSampler(smplOptions, xTileMode, yTileMode);
+ if (!sampler) {
+ return nullptr;
+ }
+
+ sampler->setKey(key);
+ fResourceCache->insertResource(sampler.get());
+ return sampler;
}
sk_sp<Buffer> ResourceProvider::findOrCreateBuffer(size_t size,
@@ -197,5 +234,29 @@ sk_sp<Buffer> ResourceProvider::findOrCreateBuffer(size_t size,
return buffer;
}
+void ResourceProvider::resetAfterSnap() {
+ fRuntimeEffectDictionary.reset();
+}
+
+BackendTexture ResourceProvider::createBackendTexture(SkISize dimensions, const TextureInfo& info) {
+ const auto maxTextureSize = fSharedContext->caps()->maxTextureSize();
+ if (dimensions.isEmpty() ||
+ dimensions.width() > maxTextureSize ||
+ dimensions.height() > maxTextureSize) {
+ SKGPU_LOG_W("call to createBackendTexture has requested dimensions (%d, %d) larger than the"
+ " supported gpu max texture size: %d. Or the dimensions are empty.",
+ dimensions.fWidth, dimensions.fHeight, maxTextureSize);
+ return {};
+ }
+
+ return this->onCreateBackendTexture(dimensions, info);
+}
+
+void ResourceProvider::deleteBackendTexture(BackendTexture& texture) {
+ this->onDeleteBackendTexture(texture);
+ // Invalidate the texture;
+ texture = BackendTexture();
+}
+
-} // namespace skgpu::graphite
+} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/ResourceProvider.h b/chromium/third_party/skia/src/gpu/graphite/ResourceProvider.h
index 962680407f5..5f766952faf 100644
--- a/chromium/third_party/skia/src/gpu/graphite/ResourceProvider.h
+++ b/chromium/third_party/skia/src/gpu/graphite/ResourceProvider.h
@@ -11,9 +11,9 @@
#include "include/core/SkSize.h"
#include "include/core/SkTileMode.h"
#include "src/core/SkLRUCache.h"
+#include "src/core/SkRuntimeEffectDictionary.h"
#include "src/gpu/ResourceKey.h"
#include "src/gpu/graphite/CommandBuffer.h"
-#include "src/gpu/graphite/GraphicsPipelineDesc.h"
#include "src/gpu/graphite/ResourceTypes.h"
struct SkSamplingOptions;
@@ -23,17 +23,24 @@ namespace skgpu {
class SingleOwner;
}
+namespace SkSL {
+ class Compiler;
+}
+
namespace skgpu::graphite {
class BackendTexture;
class Buffer;
class Caps;
+class ComputePipeline;
+class ComputePipelineDesc;
class GlobalCache;
-class Gpu;
class GraphicsPipeline;
+class GraphicsPipelineDesc;
class GraphiteResourceKey;
class ResourceCache;
class Sampler;
+class SharedContext;
class Texture;
class TextureInfo;
@@ -41,11 +48,11 @@ class ResourceProvider {
public:
virtual ~ResourceProvider();
- virtual sk_sp<CommandBuffer> createCommandBuffer() = 0;
-
sk_sp<GraphicsPipeline> findOrCreateGraphicsPipeline(const GraphicsPipelineDesc&,
const RenderPassDesc&);
+ sk_sp<ComputePipeline> findOrCreateComputePipeline(const ComputePipelineDesc&);
+
sk_sp<Texture> findOrCreateScratchTexture(SkISize, const TextureInfo&, SkBudgeted);
virtual sk_sp<Texture> createWrappedTexture(const BackendTexture&) = 0;
@@ -63,19 +70,31 @@ public:
SkShaderCodeDictionary* shaderCodeDictionary() const;
+ SkRuntimeEffectDictionary* runtimeEffectDictionary() { return &fRuntimeEffectDictionary; }
+
+ SkSL::Compiler* skslCompiler() { return fCompiler.get(); }
+
+ void resetAfterSnap();
+
+ BackendTexture createBackendTexture(SkISize dimensions, const TextureInfo&);
+ void deleteBackendTexture(BackendTexture&);
+
#if GRAPHITE_TEST_UTILS
ResourceCache* resourceCache() { return fResourceCache.get(); }
- const Gpu* gpu() { return fGpu; }
+ const SharedContext* sharedContext() { return fSharedContext; }
#endif
protected:
- ResourceProvider(const Gpu* gpu, sk_sp<GlobalCache>, SingleOwner* singleOwner);
+ ResourceProvider(const SharedContext* sharedContext,
+ sk_sp<GlobalCache>,
+ SingleOwner* singleOwner);
- const Gpu* fGpu;
+ const SharedContext* fSharedContext;
private:
- virtual sk_sp<GraphicsPipeline> onCreateGraphicsPipeline(const GraphicsPipelineDesc&,
- const RenderPassDesc&) = 0;
+ virtual sk_sp<GraphicsPipeline> createGraphicsPipeline(const GraphicsPipelineDesc&,
+ const RenderPassDesc&) = 0;
+ virtual sk_sp<ComputePipeline> createComputePipeline(const ComputePipelineDesc&) = 0;
virtual sk_sp<Texture> createTexture(SkISize, const TextureInfo&, SkBudgeted) = 0;
virtual sk_sp<Buffer> createBuffer(size_t size, BufferType type, PrioritizeGpuReads) = 0;
@@ -88,34 +107,17 @@ private:
const GraphiteResourceKey& key,
SkBudgeted);
- class GraphicsPipelineCache {
- public:
- GraphicsPipelineCache(ResourceProvider* resourceProvider);
- ~GraphicsPipelineCache();
-
- void release();
- sk_sp<GraphicsPipeline> refPipeline(const Caps* caps,
- const GraphicsPipelineDesc&,
- const RenderPassDesc&);
-
- private:
- struct Entry;
- struct KeyHash {
- uint32_t operator()(const UniqueKey& key) const {
- return key.hash();
- }
- };
- SkLRUCache<UniqueKey, std::unique_ptr<Entry>, KeyHash> fMap;
-
- ResourceProvider* fResourceProvider;
- };
+ virtual BackendTexture onCreateBackendTexture(SkISize dimensions, const TextureInfo&) = 0;
+ virtual void onDeleteBackendTexture(BackendTexture&) = 0;
sk_sp<ResourceCache> fResourceCache;
- sk_sp<GlobalCache> fGlobalCache;
+ sk_sp<GlobalCache> fGlobalCache;
- // Cache of GraphicsPipelines
- // TODO: Move this onto GlobalCache
- std::unique_ptr<GraphicsPipelineCache> fGraphicsPipelineCache;
+ // TODO: To be moved to Recorder
+ SkRuntimeEffectDictionary fRuntimeEffectDictionary;
+ // Compiler used for compiling SkSL into backend shader code. We only want to create the
+ // compiler once, as there is significant overhead to the first compile.
+ std::unique_ptr<SkSL::Compiler> fCompiler;
};
} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/ResourceTypes.h b/chromium/third_party/skia/src/gpu/graphite/ResourceTypes.h
index 44ab53a76c8..ead20514170 100644
--- a/chromium/third_party/skia/src/gpu/graphite/ResourceTypes.h
+++ b/chromium/third_party/skia/src/gpu/graphite/ResourceTypes.h
@@ -38,8 +38,9 @@ enum class BufferType {
kXferCpuToGpu,
kXferGpuToCpu,
kUniform,
+ kStorage,
};
-static const int kBufferTypeCount = static_cast<int>(BufferType::kUniform) + 1;
+static const int kBufferTypeCount = static_cast<int>(BufferType::kStorage) + 1;
/**
* When creating the memory for a resource should we use a memory type that prioritizes the
diff --git a/chromium/third_party/skia/src/gpu/graphite/Sampler.cpp b/chromium/third_party/skia/src/gpu/graphite/Sampler.cpp
index c2273139f20..90a43ed46f8 100644
--- a/chromium/third_party/skia/src/gpu/graphite/Sampler.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/Sampler.cpp
@@ -9,7 +9,8 @@
namespace skgpu::graphite {
-Sampler::Sampler(const Gpu* gpu) : Resource(gpu, Ownership::kOwned, SkBudgeted::kYes) {}
+Sampler::Sampler(const SharedContext* sharedContext)
+ : Resource(sharedContext, Ownership::kOwned, SkBudgeted::kYes) {}
Sampler::~Sampler() {}
diff --git a/chromium/third_party/skia/src/gpu/graphite/Sampler.h b/chromium/third_party/skia/src/gpu/graphite/Sampler.h
index de178cb7d90..dacc96af908 100644
--- a/chromium/third_party/skia/src/gpu/graphite/Sampler.h
+++ b/chromium/third_party/skia/src/gpu/graphite/Sampler.h
@@ -17,7 +17,7 @@ public:
~Sampler() override;
protected:
- Sampler(const Gpu*);
+ Sampler(const SharedContext*);
private:
};
diff --git a/chromium/third_party/skia/src/gpu/graphite/SharedContext.cpp b/chromium/third_party/skia/src/gpu/graphite/SharedContext.cpp
new file mode 100644
index 00000000000..bc3217d9b5e
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/SharedContext.cpp
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2021 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "src/gpu/graphite/SharedContext.h"
+
+#include "include/gpu/graphite/BackendTexture.h"
+#include "include/gpu/graphite/TextureInfo.h"
+#include "src/gpu/graphite/Caps.h"
+#include "src/gpu/graphite/CommandBuffer.h"
+#include "src/gpu/graphite/GpuWorkSubmission.h"
+#include "src/gpu/graphite/ResourceProvider.h"
+
+namespace skgpu::graphite {
+
+SharedContext::SharedContext(sk_sp<const Caps> caps, BackendApi backend)
+ : fCaps(std::move(caps))
+ , fBackend(backend) {
+}
+
+SharedContext::~SharedContext() {
+ // TODO: add disconnect?
+
+ // TODO: destroyResources instead?
+}
+
+sk_sp<const Caps> SharedContext::refCaps() const {
+ return fCaps;
+}
+
+} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/SharedContext.h b/chromium/third_party/skia/src/gpu/graphite/SharedContext.h
new file mode 100644
index 00000000000..235eef9b856
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/SharedContext.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2021 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef skgpu_graphite_SharedContext_DEFINED
+#define skgpu_graphite_SharedContext_DEFINED
+
+#include "include/core/SkRefCnt.h"
+#include "include/core/SkSize.h"
+
+#include "include/gpu/graphite/GraphiteTypes.h"
+
+namespace skgpu {
+class SingleOwner;
+}
+
+namespace skgpu::graphite {
+
+class BackendTexture;
+class Caps;
+class CommandBuffer;
+class GlobalCache;
+class ResourceProvider;
+class TextureInfo;
+
+class SharedContext : public SkRefCnt {
+public:
+ ~SharedContext() override;
+
+ /**
+ * Gets the capabilities of the draw target.
+ */
+ const Caps* caps() const { return fCaps.get(); }
+ sk_sp<const Caps> refCaps() const;
+
+ BackendApi backend() const { return fBackend; }
+
+ virtual std::unique_ptr<ResourceProvider> makeResourceProvider(sk_sp<GlobalCache>,
+ SingleOwner*) const = 0;
+
+protected:
+ SharedContext(sk_sp<const Caps>, BackendApi);
+
+private:
+ sk_sp<const Caps> fCaps;
+ BackendApi fBackend;
+};
+
+} // namespace skgpu::graphite
+
+#endif // skgpu_graphite_SharedContext_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/graphite/SkStuff.cpp b/chromium/third_party/skia/src/gpu/graphite/SkStuff.cpp
index 203c5b3bfe0..25d1af49a94 100644
--- a/chromium/third_party/skia/src/gpu/graphite/SkStuff.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/SkStuff.cpp
@@ -14,9 +14,9 @@
#include "src/gpu/graphite/Caps.h"
#include "src/gpu/graphite/ContextPriv.h"
#include "src/gpu/graphite/Device.h"
-#include "src/gpu/graphite/Gpu.h"
#include "src/gpu/graphite/RecorderPriv.h"
#include "src/gpu/graphite/ResourceProvider.h"
+#include "src/gpu/graphite/SharedContext.h"
#include "src/gpu/graphite/Surface_Graphite.h"
#include "src/gpu/graphite/Texture.h"
#include "src/gpu/graphite/TextureProxy.h"
diff --git a/chromium/third_party/skia/src/gpu/graphite/Surface_Graphite.cpp b/chromium/third_party/skia/src/gpu/graphite/Surface_Graphite.cpp
index 57ad45b8a5c..c48ded8762f 100644
--- a/chromium/third_party/skia/src/gpu/graphite/Surface_Graphite.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/Surface_Graphite.cpp
@@ -60,7 +60,7 @@ bool Surface::onReadPixels(Context* context,
}
sk_sp<const SkCapabilities> Surface::onCapabilities() {
- return fDevice->recorder()->priv().refCaps();
+ return fDevice->recorder()->priv().caps()->capabilities();
}
#if GRAPHITE_TEST_UTILS && SK_SUPPORT_GPU
diff --git a/chromium/third_party/skia/src/gpu/graphite/Texture.cpp b/chromium/third_party/skia/src/gpu/graphite/Texture.cpp
index bb3f20f10f6..890d9d6a6eb 100644
--- a/chromium/third_party/skia/src/gpu/graphite/Texture.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/Texture.cpp
@@ -9,12 +9,12 @@
namespace skgpu::graphite {
-Texture::Texture(const Gpu* gpu,
+Texture::Texture(const SharedContext* sharedContext,
SkISize dimensions,
const TextureInfo& info,
Ownership ownership,
SkBudgeted budgeted)
- : Resource(gpu, ownership, budgeted)
+ : Resource(sharedContext, ownership, budgeted)
, fDimensions(dimensions)
, fInfo(info) {}
diff --git a/chromium/third_party/skia/src/gpu/graphite/Texture.h b/chromium/third_party/skia/src/gpu/graphite/Texture.h
index d1b49a64d20..02a88f85b64 100644
--- a/chromium/third_party/skia/src/gpu/graphite/Texture.h
+++ b/chromium/third_party/skia/src/gpu/graphite/Texture.h
@@ -26,7 +26,10 @@ public:
const TextureInfo& textureInfo() const { return fInfo; }
protected:
- Texture(const Gpu*, SkISize dimensions, const TextureInfo& info, Ownership, SkBudgeted);
+ Texture(const SharedContext*,
+ SkISize dimensions,
+ const TextureInfo& info,
+ Ownership, SkBudgeted);
private:
SkISize fDimensions;
diff --git a/chromium/third_party/skia/src/gpu/graphite/TextureUtils.cpp b/chromium/third_party/skia/src/gpu/graphite/TextureUtils.cpp
index 222da08f562..21dcd2bbe94 100644
--- a/chromium/third_party/skia/src/gpu/graphite/TextureUtils.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/TextureUtils.cpp
@@ -65,13 +65,14 @@ std::tuple<TextureProxyView, SkColorType> MakeBitmapProxyView(Recorder* recorder
}
// setup MipLevels
+ sk_sp<SkMipmap> mipmaps;
std::vector<MipLevel> texels;
if (mipLevelCount == 1) {
texels.resize(mipLevelCount);
texels[0].fPixels = bmpToUpload.getPixels();
texels[0].fRowBytes = bmpToUpload.rowBytes();
} else {
- sk_sp<SkMipmap> mipmaps(SkMipmap::Build(bmpToUpload.pixmap(), nullptr));
+ mipmaps.reset(SkMipmap::Build(bmpToUpload.pixmap(), nullptr));
if (!mipmaps) {
return {};
}
diff --git a/chromium/third_party/skia/src/gpu/graphite/UniformManager.cpp b/chromium/third_party/skia/src/gpu/graphite/UniformManager.cpp
index 949665ed610..fdf8842be70 100644
--- a/chromium/third_party/skia/src/gpu/graphite/UniformManager.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/UniformManager.cpp
@@ -77,19 +77,19 @@ struct Rules140 {
if (Cols != 1) {
// This is a matrix or array of matrices. We return the stride between columns.
SkASSERT(RowsOrVecLength > 1);
- return Rules140<BaseType, RowsOrVecLength>::Stride(1);
+ return Rules140<BaseType, RowsOrVecLength>::Stride(SkUniform::kNonArray);
}
+
+ // Get alignment of a single non-array vector of BaseType by Rule 1, 2, or 3.
+ int n = RowsOrVecLength == 3 ? 4 : RowsOrVecLength;
if (count == 0) {
- // Stride doesn't matter for a non-array.
- return RowsOrVecLength * sizeof(BaseType);
+ return n * sizeof(BaseType);
}
// Rule 4.
// Alignment of vec4 by Rule 2.
constexpr size_t kVec4Alignment = tight_vec_size<float>(4);
- // Get alignment of a single vector of BaseType by Rule 1, 2, or 3
- int n = RowsOrVecLength == 3 ? 4 : RowsOrVecLength;
size_t kElementAlignment = tight_vec_size<BaseType>(n);
// Round kElementAlignment up to multiple of kVec4Alignment.
size_t m = (kElementAlignment + kVec4Alignment - 1) / kVec4Alignment;
@@ -113,14 +113,17 @@ struct Rules430 {
if (Cols != 1) {
// This is a matrix or array of matrices. We return the stride between columns.
SkASSERT(RowsOrVecLength > 1);
- return Rules430<BaseType, RowsOrVecLength>::Stride(1);
+ return Rules430<BaseType, RowsOrVecLength>::Stride(SkUniform::kNonArray);
}
+
+ // Get alignment of a single non-array vector of BaseType by Rule 1, 2, or 3.
+ int n = RowsOrVecLength == 3 ? 4 : RowsOrVecLength;
if (count == 0) {
- // Stride doesn't matter for a non-array.
- return RowsOrVecLength * sizeof(BaseType);
+ return n * sizeof(BaseType);
}
+
// Rule 4 without the round up to a multiple of align-of vec4.
- return tight_vec_size<BaseType>(RowsOrVecLength == 3 ? 4 : RowsOrVecLength);
+ return tight_vec_size<BaseType>(n);
}
};
@@ -133,16 +136,20 @@ struct RulesMetal {
SkASSERT(count >= 1 || count == SkUniform::kNonArray);
static_assert(RowsOrVecLength >= 1 && RowsOrVecLength <= 4);
static_assert(Cols >= 1 && Cols <= 4);
+
if (Cols != 1) {
// This is a matrix or array of matrices. We return the stride between columns.
SkASSERT(RowsOrVecLength > 1);
- return RulesMetal<BaseType, RowsOrVecLength>::Stride(1);
+ return RulesMetal<BaseType, RowsOrVecLength>::Stride(SkUniform::kNonArray);
}
+
+ // Get alignment of a single non-array vector of BaseType by Rule 1, 2, or 3.
+ int n = RowsOrVecLength == 3 ? 4 : RowsOrVecLength;
if (count == 0) {
- // Stride doesn't matter for a non-array.
- return RowsOrVecLength * sizeof(BaseType);
+ return n * sizeof(BaseType);
}
- return tight_vec_size<BaseType>(RowsOrVecLength == 3 ? 4 : RowsOrVecLength);
+
+ return tight_vec_size<BaseType>(n);
}
};
@@ -168,6 +175,17 @@ private:
return;
}
+ if constexpr (std::is_same<MemType, int32_t>::value &&
+ std::is_same<UniformType, int16_t>::value) {
+ // Convert ints to short.
+ const int32_t* intBits = static_cast<const int32_t*>(src);
+ int16_t* shortBits = static_cast<int16_t*>(dst);
+ while (numUniforms-- > 0) {
+ *shortBits++ = int16_t(*intBits++);
+ }
+ return;
+ }
+
SK_ABORT("implement conversion from MemType to UniformType");
}
@@ -227,6 +245,18 @@ public:
const void *src) {
SkASSERT(n >= 1 || n == SkUniform::kNonArray);
switch (type) {
+ case SkSLType::kShort:
+ return Write<int32_t, int16_t>(dest, n, static_cast<const int32_t *>(src));
+
+ case SkSLType::kShort2:
+ return Write<int32_t, int16_t, 2>(dest, n, static_cast<const int32_t *>(src));
+
+ case SkSLType::kShort3:
+ return Write<int32_t, int16_t, 3>(dest, n, static_cast<const int32_t *>(src));
+
+ case SkSLType::kShort4:
+ return Write<int32_t, int16_t, 4>(dest, n, static_cast<const int32_t *>(src));
+
case SkSLType::kInt:
return Write<int32_t, int32_t>(dest, n, static_cast<const int32_t *>(src));
@@ -299,7 +329,6 @@ public:
}
};
-#ifdef SK_DEBUG
// To determine whether a current offset is aligned, we can just 'and' the lowest bits with the
// alignment mask. A value of 0 means aligned, any other value is how many bytes past alignment we
// are. This works since all alignments are powers of 2. The mask is always (alignment - 1).
@@ -368,8 +397,8 @@ static uint32_t sksltype_to_alignment_mask(SkSLType type) {
SK_ABORT("Unexpected type");
}
-/** Returns the size in bytes taken up in Metal buffers for SkSLTypes. */
-inline uint32_t sksltype_to_mtl_size(SkSLType type) {
+/** Returns the size in bytes taken up in uniform buffers for SkSLTypes. */
+inline uint32_t sksltype_to_size(SkSLType type) {
switch (type) {
case SkSLType::kInt:
case SkSLType::kUInt:
@@ -438,60 +467,59 @@ inline uint32_t sksltype_to_mtl_size(SkSLType type) {
// taking into consideration all alignment requirements. The uniformOffset is set to the offset for
// the new uniform, and currentOffset is updated to be the offset to the end of the new uniform.
static uint32_t get_ubo_aligned_offset(uint32_t* currentOffset,
- uint32_t* maxAlignment,
SkSLType type,
int arrayCount) {
uint32_t alignmentMask = sksltype_to_alignment_mask(type);
- if (alignmentMask > *maxAlignment) {
- *maxAlignment = alignmentMask;
- }
uint32_t offsetDiff = *currentOffset & alignmentMask;
if (offsetDiff != 0) {
offsetDiff = alignmentMask - offsetDiff + 1;
}
uint32_t uniformOffset = *currentOffset + offsetDiff;
- SkASSERT(sizeof(float) == 4);
+
if (arrayCount) {
- *currentOffset = uniformOffset + sksltype_to_mtl_size(type) * arrayCount;
+ // TODO(skia:13478): array size calculations currently do not honor std140 layout.
+ *currentOffset = uniformOffset + sksltype_to_size(type) * arrayCount;
} else {
- *currentOffset = uniformOffset + sksltype_to_mtl_size(type);
+ *currentOffset = uniformOffset + sksltype_to_size(type);
}
return uniformOffset;
}
-#endif // SK_DEBUG
-SkSLType UniformManager::getUniformTypeForLayout(SkSLType type) {
+SkSLType UniformOffsetCalculator::getUniformTypeForLayout(SkSLType type) {
if (fLayout != Layout::kMetal) {
// GL/Vk expect uniforms in 32-bit precision. Convert lower-precision types to 32-bit.
switch (type) {
- case SkSLType::kShort: return SkSLType::kInt;
- case SkSLType::kUShort: return SkSLType::kUInt;
- case SkSLType::kHalf: return SkSLType::kFloat;
+ case SkSLType::kShort: return SkSLType::kInt;
+ case SkSLType::kUShort: return SkSLType::kUInt;
+ case SkSLType::kHalf: return SkSLType::kFloat;
- case SkSLType::kShort2: return SkSLType::kInt2;
- case SkSLType::kUShort2: return SkSLType::kUInt2;
- case SkSLType::kHalf2: return SkSLType::kFloat2;
+ case SkSLType::kShort2: return SkSLType::kInt2;
+ case SkSLType::kUShort2: return SkSLType::kUInt2;
+ case SkSLType::kHalf2: return SkSLType::kFloat2;
- case SkSLType::kShort3: return SkSLType::kInt3;
- case SkSLType::kUShort3: return SkSLType::kUInt3;
- case SkSLType::kHalf3: return SkSLType::kFloat3;
+ case SkSLType::kShort3: return SkSLType::kInt3;
+ case SkSLType::kUShort3: return SkSLType::kUInt3;
+ case SkSLType::kHalf3: return SkSLType::kFloat3;
- case SkSLType::kShort4: return SkSLType::kInt4;
- case SkSLType::kUShort4: return SkSLType::kUInt4;
- case SkSLType::kHalf4: return SkSLType::kFloat4;
+ case SkSLType::kShort4: return SkSLType::kInt4;
+ case SkSLType::kUShort4: return SkSLType::kUInt4;
+ case SkSLType::kHalf4: return SkSLType::kFloat4;
- case SkSLType::kHalf2x2: return SkSLType::kFloat2x2;
- case SkSLType::kHalf3x3: return SkSLType::kFloat3x3;
- case SkSLType::kHalf4x4: return SkSLType::kFloat4x4;
+ case SkSLType::kHalf2x2: return SkSLType::kFloat2x2;
+ case SkSLType::kHalf3x3: return SkSLType::kFloat3x3;
+ case SkSLType::kHalf4x4: return SkSLType::kFloat4x4;
- default: break;
+ default: break;
}
}
return type;
}
-UniformManager::UniformManager(Layout layout) : fLayout(layout) {
+UniformOffsetCalculator::UniformOffsetCalculator(Layout layout, uint32_t startingOffset)
+ : fLayout(layout)
+ , fOffset(startingOffset)
+ , fCurUBOOffset(startingOffset) {
switch (layout) {
case Layout::kStd140:
@@ -504,34 +532,41 @@ UniformManager::UniformManager(Layout layout) : fLayout(layout) {
fWriteUniform = Writer<RulesMetal>::WriteUniform;
break;
}
+}
+
+size_t UniformOffsetCalculator::calculateOffset(SkSLType type, unsigned int count) {
+ SkSLType revisedType = this->getUniformTypeForLayout(type);
- this->reset();
+ // Insert padding as needed to get the correct uniform alignment.
+ uint32_t alignedOffset = get_ubo_aligned_offset(&fCurUBOOffset, revisedType, count);
+ SkASSERT(alignedOffset >= fOffset);
+
+ // Append the uniform size to our offset, then return the uniform start position.
+ uint32_t uniformSize = fWriteUniform(revisedType, CType::kDefault,
+ /*dest=*/nullptr, count, /*src=*/nullptr);
+ fOffset = alignedOffset + uniformSize;
+ return alignedOffset;
}
SkUniformDataBlock UniformManager::peekData() const {
- return SkUniformDataBlock(SkMakeSpan(fStorage.begin(), fStorage.count()));
+ return SkUniformDataBlock(SkSpan(fStorage.begin(), fStorage.count()));
}
void UniformManager::reset() {
-#ifdef SK_DEBUG
fCurUBOOffset = 0;
- fCurUBOMaxAlignment = 0;
-#endif
fOffset = 0;
fStorage.rewind();
}
-#ifdef SK_DEBUG
void UniformManager::checkReset() const {
SkASSERT(fCurUBOOffset == 0);
- SkASSERT(fCurUBOMaxAlignment == 0);
SkASSERT(fOffset == 0);
SkASSERT(fStorage.empty());
}
void UniformManager::setExpectedUniforms(SkSpan<const SkUniform> expectedUniforms) {
- fExpectedUniforms = expectedUniforms;
- fExpectedUniformIndex = 0;
+ SkDEBUGCODE(fExpectedUniforms = expectedUniforms;)
+ SkDEBUGCODE(fExpectedUniformIndex = 0;)
}
void UniformManager::checkExpected(SkSLType type, unsigned int count) {
@@ -541,27 +576,29 @@ void UniformManager::checkExpected(SkSLType type, unsigned int count) {
SkASSERT(fExpectedUniforms[fExpectedUniformIndex].type() == type);
SkASSERT((fExpectedUniforms[fExpectedUniformIndex].count() == 0 && count == 1) ||
fExpectedUniforms[fExpectedUniformIndex].count() == count);
- fExpectedUniformIndex++;
-
- SkSLType revisedType = this->getUniformTypeForLayout(type);
-
- uint32_t debugOffset = get_ubo_aligned_offset(&fCurUBOOffset,
- &fCurUBOMaxAlignment,
- revisedType,
- count);
- SkASSERT(debugOffset == fOffset);
+ SkDEBUGCODE(fExpectedUniformIndex++;)
}
void UniformManager::doneWithExpectedUniforms() {
SkASSERT(fExpectedUniformIndex == static_cast<int>(fExpectedUniforms.size()));
- fExpectedUniforms = {};
+ SkDEBUGCODE(fExpectedUniforms = {};)
}
-#endif // SK_DEBUG
void UniformManager::write(SkSLType type, unsigned int count, const void* src) {
+ this->checkExpected(type, (count == SkUniform::kNonArray) ? 1 : count);
+
SkSLType revisedType = this->getUniformTypeForLayout(type);
- uint32_t bytesNeeded = fWriteUniform(revisedType, CType::kDefault, nullptr, count, nullptr);
+ // Insert padding as needed to get the correct uniform alignment.
+ uint32_t alignedOffset = get_ubo_aligned_offset(&fCurUBOOffset, revisedType, count);
+ SkASSERT(alignedOffset >= fOffset);
+ if (alignedOffset > fOffset) {
+ fStorage.append(alignedOffset - fOffset);
+ fOffset = alignedOffset;
+ }
+
+ uint32_t bytesNeeded = fWriteUniform(revisedType, CType::kDefault,
+ /*dest=*/nullptr, count, /*src=*/nullptr);
char* dst = fStorage.append(bytesNeeded);
uint32_t bytesWritten = fWriteUniform(revisedType, CType::kDefault, dst, count, src);
SkASSERT(bytesNeeded == bytesWritten);
@@ -569,56 +606,47 @@ void UniformManager::write(SkSLType type, unsigned int count, const void* src) {
}
void UniformManager::write(const SkM44& mat) {
- static const SkSLType kType = SkSLType::kFloat4x4;
- SkDEBUGCODE(this->checkExpected(kType, 1);)
+ static constexpr SkSLType kType = SkSLType::kFloat4x4;
this->write(kType, 1, &mat);
}
void UniformManager::write(const SkColor4f* colors, int count) {
- static const SkSLType kType = SkSLType::kFloat4;
- SkDEBUGCODE(this->checkExpected(kType, count);)
+ static constexpr SkSLType kType = SkSLType::kFloat4;
this->write(kType, count, colors);
}
void UniformManager::write(const SkPMColor4f* premulColors, int count) {
- static const SkSLType kType = SkSLType::kFloat4;
- SkDEBUGCODE(this->checkExpected(kType, count);)
+ static constexpr SkSLType kType = SkSLType::kFloat4;
this->write(kType, count, premulColors);
}
void UniformManager::write(const SkRect& rect) {
- static const SkSLType kType = SkSLType::kFloat4;
- SkDEBUGCODE(this->checkExpected(kType, 1);)
+ static constexpr SkSLType kType = SkSLType::kFloat4;
this->write(kType, 1, &rect);
}
void UniformManager::write(SkPoint point) {
- static const SkSLType kType = SkSLType::kFloat2;
- SkDEBUGCODE(this->checkExpected(kType, 1);)
+ static constexpr SkSLType kType = SkSLType::kFloat2;
this->write(kType, 1, &point);
}
void UniformManager::write(const float* floats, int count) {
- static const SkSLType kType = SkSLType::kFloat;
- SkDEBUGCODE(this->checkExpected(kType, count);)
+ static constexpr SkSLType kType = SkSLType::kFloat;
this->write(kType, count, floats);
}
void UniformManager::write(int i) {
- static const SkSLType kType = SkSLType::kInt;
- SkDEBUGCODE(this->checkExpected(kType, 1);)
+ static constexpr SkSLType kType = SkSLType::kInt;
this->write(kType, 1, &i);
}
void UniformManager::write(skvx::float2 v) {
- static const SkSLType kType = SkSLType::kFloat2;
- SkDEBUGCODE(this->checkExpected(kType, 1);)
+ static constexpr SkSLType kType = SkSLType::kFloat2;
this->write(kType, 1, &v);
}
void UniformManager::write(skvx::float4 v) {
- static const SkSLType kType = SkSLType::kFloat4;
- SkDEBUGCODE(this->checkExpected(kType, 1);)
+ static constexpr SkSLType kType = SkSLType::kFloat4;
this->write(kType, 1, &v);
}
diff --git a/chromium/third_party/skia/src/gpu/graphite/UniformManager.h b/chromium/third_party/skia/src/gpu/graphite/UniformManager.h
index 103aa6dcff0..d461edafe79 100644
--- a/chromium/third_party/skia/src/gpu/graphite/UniformManager.h
+++ b/chromium/third_party/skia/src/gpu/graphite/UniformManager.h
@@ -31,21 +31,42 @@ enum class Layout {
kMetal, /** This is our own self-imposed layout we use for Metal. */
};
-// TODO: This is only used in the SkPipelineDataGatherer - maybe hide it better.
-class UniformManager {
+class UniformOffsetCalculator {
public:
- UniformManager(Layout layout);
+ UniformOffsetCalculator(Layout layout, uint32_t startingOffset);
+
+ size_t size() const { return fCurUBOOffset; }
+
+ size_t calculateOffset(SkSLType type, unsigned int count);
+
+protected:
+ SkSLType getUniformTypeForLayout(SkSLType type);
+
+ using WriteUniformFn = uint32_t (*)(SkSLType type,
+ CType ctype,
+ void *dest,
+ int n,
+ const void *src);
+
+ WriteUniformFn fWriteUniform;
+ Layout fLayout; // TODO: eventually 'fLayout' will not need to be stored
+ uint32_t fOffset = 0;
+ uint32_t fCurUBOOffset = 0;
+};
+
+class UniformManager : public UniformOffsetCalculator {
+public:
+ UniformManager(Layout layout) : UniformOffsetCalculator(layout, /*startingOffset=*/0) {}
SkUniformDataBlock peekData() const;
- int size() const { return fStorage.count(); }
+ size_t size() const { return fStorage.size(); }
void reset();
-#ifdef SK_DEBUG
+
void checkReset() const;
void setExpectedUniforms(SkSpan<const SkUniform>);
void checkExpected(SkSLType, unsigned int count);
void doneWithExpectedUniforms();
-#endif
// TODO: do we need to add a 'makeArray' parameter to these?
void write(const SkM44&);
@@ -59,27 +80,13 @@ public:
void write(int);
void write(skvx::float2);
void write(skvx::float4);
-
-private:
- SkSLType getUniformTypeForLayout(SkSLType type);
void write(SkSLType type, unsigned int count, const void* src);
- using WriteUniformFn = uint32_t(*)(SkSLType type,
- CType ctype,
- void *dest,
- int n,
- const void *src);
-
- WriteUniformFn fWriteUniform;
- Layout fLayout; // TODO: eventually 'fLayout' will not need to be stored
+private:
#ifdef SK_DEBUG
- uint32_t fCurUBOOffset;
- uint32_t fCurUBOMaxAlignment;
-
SkSpan<const SkUniform> fExpectedUniforms;
int fExpectedUniformIndex = 0;
#endif // SK_DEBUG
- uint32_t fOffset;
SkTDArray<char> fStorage;
};
diff --git a/chromium/third_party/skia/src/gpu/graphite/UploadBufferManager.cpp b/chromium/third_party/skia/src/gpu/graphite/UploadBufferManager.cpp
index aed96b8da21..c4131360c16 100644
--- a/chromium/third_party/skia/src/gpu/graphite/UploadBufferManager.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/UploadBufferManager.cpp
@@ -7,8 +7,9 @@
#include "src/gpu/graphite/UploadBufferManager.h"
+#include "include/gpu/graphite/Recording.h"
#include "src/gpu/graphite/Buffer.h"
-#include "src/gpu/graphite/CommandBuffer.h"
+#include "src/gpu/graphite/RecordingPriv.h"
#include "src/gpu/graphite/ResourceProvider.h"
namespace skgpu::graphite {
@@ -66,16 +67,16 @@ std::tuple<UploadWriter, BindBufferInfo> UploadBufferManager::getUploadWriter(
return {UploadWriter(bufferMapPtr, requiredBytes), bindInfo};
}
-void UploadBufferManager::transferToCommandBuffer(CommandBuffer* commandBuffer) {
+void UploadBufferManager::transferToRecording(Recording* recording) {
for (sk_sp<Buffer>& buffer : fUsedBuffers) {
buffer->unmap();
- commandBuffer->trackResource(std::move(buffer));
+ recording->priv().addResourceRef(std::move(buffer));
}
fUsedBuffers.clear();
if (fReusedBuffer) {
fReusedBuffer->unmap();
- commandBuffer->trackResource(std::move(fReusedBuffer));
+ recording->priv().addResourceRef(std::move(fReusedBuffer));
}
}
diff --git a/chromium/third_party/skia/src/gpu/graphite/UploadBufferManager.h b/chromium/third_party/skia/src/gpu/graphite/UploadBufferManager.h
index 5ef48d6b276..2a7a612d46c 100644
--- a/chromium/third_party/skia/src/gpu/graphite/UploadBufferManager.h
+++ b/chromium/third_party/skia/src/gpu/graphite/UploadBufferManager.h
@@ -17,7 +17,7 @@
namespace skgpu::graphite {
class Buffer;
-class CommandBuffer;
+class Recording;
class ResourceProvider;
class UploadBufferManager {
@@ -28,8 +28,8 @@ public:
std::tuple<UploadWriter, BindBufferInfo> getUploadWriter(size_t requiredBytes,
size_t requiredAlignment);
- // Finalizes all buffers and transfers ownership of them to the CommandBuffer.
- void transferToCommandBuffer(CommandBuffer*);
+ // Finalizes all buffers and transfers ownership of them to a Recording.
+ void transferToRecording(Recording*);
private:
ResourceProvider* fResourceProvider;
diff --git a/chromium/third_party/skia/src/gpu/graphite/UploadTask.cpp b/chromium/third_party/skia/src/gpu/graphite/UploadTask.cpp
index 280db7a9ab1..700575f0391 100644
--- a/chromium/third_party/skia/src/gpu/graphite/UploadTask.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/UploadTask.cpp
@@ -45,7 +45,6 @@ size_t compute_combined_buffer_size(int mipLevelCount,
size_t trimmedSize = levelDimensions.area() * bytesPerPixel;
combinedBufferSize = SkAlignTo(combinedBufferSize, minTransferBufferAlignment);
- SkASSERT((0 == combinedBufferSize % 4) && (0 == combinedBufferSize % bytesPerPixel));
individualMipOffsets->push_back(combinedBufferSize);
combinedBufferSize += trimmedSize;
diff --git a/chromium/third_party/skia/src/gpu/graphite/geom/BoundsManager.h b/chromium/third_party/skia/src/gpu/graphite/geom/BoundsManager.h
index 86b4d9e5c55..ae9bb67136f 100644
--- a/chromium/third_party/skia/src/gpu/graphite/geom/BoundsManager.h
+++ b/chromium/third_party/skia/src/gpu/graphite/geom/BoundsManager.h
@@ -8,10 +8,12 @@
#ifndef skgpu_graphite_geom_BoundsManager_DEFINED
#define skgpu_graphite_geom_BoundsManager_DEFINED
-#include "src/gpu/graphite/DrawOrder.h"
-#include "src/gpu/graphite/geom/Rect.h"
+#include "include/core/SkSize.h"
+#include "include/private/SkTemplates.h"
#include "src/core/SkTBlockList.h"
+#include "src/gpu/graphite/DrawOrder.h"
+#include "src/gpu/graphite/geom/Rect.h"
#include <cstdint>
@@ -19,14 +21,13 @@ namespace skgpu::graphite {
/**
* BoundsManager is an acceleration structure for device-space related pixel bounds queries.
- * The BoundsManager relies on two related ordinal values: the CompressedPaintersOrder of a draw
- * and the Z/depth value of the draw. The CompressedPaintersOrder enforces a specific submission
- * order of draws to the GPU but can re-arrange draws out of their original painter's order if the
- * GREATER depth test and the draw's Z value resolve out-of-order rendering.
+ * The BoundsManager tracks a single ordinal value per bounds: the CompressedPaintersOrder of a draw
+ * The CompressedPaintersOrder enforces a specific submission order of draws to the GPU but can
+ * re-arrange draws out of their original painter's order if the GREATER depth test and the draw's Z
+ * value resolve out-of-order rendering.
*
* It supports querying the most recent draw intersecting a bounding rect (represented as a
- * CompressedPaintersOrder value), recording a (bounds, CompressedPaintersOrder, and Z value) tuple,
- * and querying if a (bounds, Z value) pair is fully occluded by another draw.
+ * CompressedPaintersOrder value), and recording a (bounds, CompressedPaintersOrder) pair.
*/
class BoundsManager {
public:
@@ -34,12 +35,7 @@ public:
virtual CompressedPaintersOrder getMostRecentDraw(const Rect& bounds) const = 0;
- virtual bool isOccluded(const Rect& bounds, PaintersDepth z) const = 0;
-
- virtual void recordDraw(const Rect& bounds,
- CompressedPaintersOrder order,
- PaintersDepth z,
- bool fullyOpaque=false) = 0;
+ virtual void recordDraw(const Rect& bounds, CompressedPaintersOrder order) = 0;
virtual void reset() = 0;
};
@@ -57,10 +53,8 @@ public:
return fLatestDraw;
}
- bool isOccluded(const Rect& bounds, PaintersDepth z) const override { return false; }
- void recordDraw(const Rect& bounds, CompressedPaintersOrder order, PaintersDepth z,
- bool fullyOpaque=false) override {
+ void recordDraw(const Rect& bounds, CompressedPaintersOrder order) override {
if (fLatestDraw < order) {
fLatestDraw = order;
}
@@ -81,43 +75,233 @@ public:
~BruteForceBoundsManager() override {}
CompressedPaintersOrder getMostRecentDraw(const Rect& bounds) const override {
+ SkASSERT(fRects.count() == fOrders.count());
+
+ Rect::ComplementRect boundsComplement(bounds);
+ CompressedPaintersOrder max = CompressedPaintersOrder::First();
+ auto orderIter = fOrders.items().begin();
+ for (const Rect& r : fRects.items()) {
+ if (r.intersects(boundsComplement) && max < *orderIter) {
+ max = *orderIter;
+ }
+ ++orderIter;
+ }
+ return max;
+ }
+
+ void recordDraw(const Rect& bounds, CompressedPaintersOrder order) override {
+ fRects.push_back(bounds);
+ fOrders.push_back(order);
+ }
+
+ void reset() override {
+ fRects.reset();
+ fOrders.reset();
+ }
+
+ int count() const { return fRects.count(); }
+
+ void replayDraws(BoundsManager* manager) const {
+ auto orderIter = fOrders.items().begin();
+ for (const Rect& r : fRects.items()) {
+ manager->recordDraw(r, *orderIter);
+ ++orderIter;
+ }
+ }
+
+private:
+ // fRects and fOrders are parallel, but kept separate to avoid wasting padding since Rect is
+ // an over-aligned type.
+ SkTBlockList<Rect> fRects{16, SkBlockAllocator::GrowthPolicy::kFibonacci};
+ SkTBlockList<CompressedPaintersOrder> fOrders{16, SkBlockAllocator::GrowthPolicy::kFibonacci};
+};
+
+// A BoundsManager that tracks highest CompressedPaintersOrder over a uniform spatial grid.
+class GridBoundsManager : public BoundsManager {
+public:
+ // 'gridSize' is the number of cells in the X and Y directions, splitting the pixels from [0,0]
+ // to 'deviceSize' into uniformly-sized cells.
+ static std::unique_ptr<GridBoundsManager> Make(const SkISize& deviceSize,
+ const SkISize& gridSize) {
+ SkASSERT(deviceSize.width() > 0 && deviceSize.height() > 0);
+ SkASSERT(gridSize.width() >= 1 && gridSize.height() >= 1);
+
+ return std::unique_ptr<GridBoundsManager>(new GridBoundsManager(deviceSize, gridSize));
+ }
+
+ static std::unique_ptr<GridBoundsManager> Make(const SkISize& deviceSize, int gridSize) {
+ return Make(deviceSize, {gridSize, gridSize});
+ }
+
+ static std::unique_ptr<GridBoundsManager> MakeRes(const SkISize& deviceSize, int gridCellSize) {
+ SkASSERT(deviceSize.width() > 0 && deviceSize.height() > 0);
+ SkASSERT(gridCellSize >= 1);
+
+ int gridWidth = SkScalarCeilToInt(deviceSize.width() / (float) gridCellSize);
+ int gridHeight = SkScalarCeilToInt(deviceSize.height() / (float) gridCellSize);
+
+ // This keeps the grid cells exactly at the requested resolution, but pads the right and
+ // bottom edges out to a multiple of the cell size. The alternative is pass in the unpadded
+ // device size, which would mean the actual cell size will be smaller than the requested
+ // (by (deviceSize % gridCellSize)/gridDims).
+ SkISize paddedDeviceSize = {gridWidth * gridCellSize, gridHeight * gridCellSize};
+ return Make(paddedDeviceSize, {gridWidth, gridHeight});
+ }
+
+ ~GridBoundsManager() override {}
+
+
+ CompressedPaintersOrder getMostRecentDraw(const Rect& bounds) const override {
+ SkASSERT(!bounds.isEmptyNegativeOrNaN());
+
+ auto ltrb = this->getGridCoords(bounds);
+ const CompressedPaintersOrder* p = fNodes.data() + ltrb[1] * fGridWidth + ltrb[0];
+ int h = ltrb[3] - ltrb[1];
+ int w = ltrb[2] - ltrb[0];
+
CompressedPaintersOrder max = CompressedPaintersOrder::First();
- for (const Record& r : fRects.items()) {
- if (max < r.fOrder && r.fBounds.intersects(bounds)) {
- max = r.fOrder;
+ for (int y = 0; y <= h; ++y ) {
+ for (int x = 0; x <= w; ++x) {
+ CompressedPaintersOrder v = *(p + x);
+ if (v > max) {
+ max = v;
+ }
}
+ p = p + fGridWidth;
}
+
return max;
}
- bool isOccluded(const Rect& bounds, PaintersDepth z) const override {
- // Iterate in reverse since the records were likely recorded in increasing Z
- for (const Record& r : fRects.ritems()) {
- if (r.fOpaque && z < r.fZ && r.fBounds.contains(bounds)) {
- return true;
+ void recordDraw(const Rect& bounds, CompressedPaintersOrder order) override {
+ SkASSERT(!bounds.isEmptyNegativeOrNaN());
+
+ auto ltrb = this->getGridCoords(bounds);
+ CompressedPaintersOrder* p = fNodes.data() + ltrb[1] * fGridWidth + ltrb[0];
+ int h = ltrb[3] - ltrb[1];
+ int w = ltrb[2] - ltrb[0];
+
+ for (int y = 0; y <= h; ++y) {
+ for (int x = 0; x <= w; ++x) {
+ CompressedPaintersOrder v = *(p + x);
+ if (order > v) {
+ *(p + x) = order;
+ }
}
+ p = p + fGridWidth;
}
- return false;
}
- void recordDraw(const Rect& bounds, CompressedPaintersOrder order, PaintersDepth z,
- bool fullyOpaque=false) override {
- fRects.push_back({bounds, order, z, fullyOpaque});
+ void reset() override {
+ memset(fNodes.data(), 0, sizeof(CompressedPaintersOrder) * fGridWidth * fGridHeight);
+ }
+
+private:
+ GridBoundsManager(const SkISize& deviceSize, const SkISize& gridSize)
+ : fScaleX(gridSize.width() / (float) deviceSize.width())
+ , fScaleY(gridSize.height() / (float) deviceSize.height())
+ , fGridWidth(gridSize.width())
+ , fGridHeight(gridSize.height())
+ , fNodes((size_t) fGridWidth * fGridHeight) {
+ // Reset is needed to zero-out the uninitialized fNodes values.
+ this->reset();
+ }
+
+ skvx::int4 getGridCoords(const Rect& bounds) const {
+ // Normalize bounds by 1/wh of device bounds, then scale up to number of cells per side.
+ // fScaleXY includes both 1/wh and the grid dimension scaling, then clamp to [0, gridDim-1].
+ return pin(skvx::cast<int32_t>(bounds.ltrb() * skvx::float2(fScaleX, fScaleY).xyxy()),
+ skvx::int4(0),
+ skvx::int2(fGridWidth, fGridHeight).xyxy() - 1);
+ }
+
+ const float fScaleX;
+ const float fScaleY;
+
+ const int fGridWidth;
+ const int fGridHeight;
+
+ SkAutoTMalloc<CompressedPaintersOrder> fNodes;
+};
+
+// A BoundsManager that first relies on BruteForceBoundsManager for N draw calls, and then switches
+// to the GridBoundsManager if it exceeds its limit. For low N, the brute force approach is
+// surprisingly efficient, has the highest accuracy, and very low memory overhead. Once the draw
+// call count is large enough, the grid's lower performance complexity outweigh its memory cost and
+// reduced accuracy.
+class HybridBoundsManager : public BoundsManager {
+public:
+ HybridBoundsManager(const SkISize& deviceSize,
+ int gridCellSize,
+ int maxBruteForceN)
+ : fDeviceSize(deviceSize)
+ , fGridCellSize(gridCellSize)
+ , fMaxBruteForceN(maxBruteForceN)
+ , fCurrentManager(&fBruteForceManager) {
+ SkASSERT(deviceSize.width() >= 1 && deviceSize.height() >= 1 &&
+ gridCellSize >= 1 && maxBruteForceN >= 1);
+ }
+
+ CompressedPaintersOrder getMostRecentDraw(const Rect& bounds) const override {
+ return fCurrentManager->getMostRecentDraw(bounds);
+ }
+
+ void recordDraw(const Rect& bounds, CompressedPaintersOrder order) override {
+ this->updateCurrentManagerIfNeeded();
+ fCurrentManager->recordDraw(bounds, order);
}
void reset() override {
- fRects.reset();
+ const bool usedGrid = fCurrentManager == fGridManager.get();
+ if (usedGrid) {
+ // Reset the grid manager so it's ready to use next frame, but don't delete it.
+ fGridManager->reset();
+ // Assume brute force manager was reset when we swapped to the grid originally
+ fCurrentManager = &fBruteForceManager;
+ } else {
+ if (fGridManager) {
+ // Clean up the grid manager that was created over a frame ago without being used.
+ // This could lead to re-allocating the grid every-other frame, but it's a simple
+ // way to ensure we don't hold onto the grid in perpetuity if it's not needed.
+ fGridManager = nullptr;
+ }
+ fBruteForceManager.reset();
+ SkASSERT(fCurrentManager == &fBruteForceManager);
+ }
}
private:
- struct Record {
- Rect fBounds;
- CompressedPaintersOrder fOrder;
- PaintersDepth fZ;
- bool fOpaque;
- };
-
- SkTBlockList<Record> fRects{16, SkBlockAllocator::GrowthPolicy::kFibonacci};
+ const SkISize fDeviceSize;
+ const int fGridCellSize;
+ const int fMaxBruteForceN;
+
+ BoundsManager* fCurrentManager;
+
+ BruteForceBoundsManager fBruteForceManager;
+
+ // The grid manager starts out null and is created the first time we exceed fMaxBruteForceN.
+ // However, even if we reset back to the brute force manager, we keep the grid around under the
+ // assumption that the owning Device will have similar frame-to-frame draw counts and will need
+ // to upgrade to the grid manager again.
+ std::unique_ptr<GridBoundsManager> fGridManager;
+
+ void updateCurrentManagerIfNeeded() {
+ if (fCurrentManager == fGridManager.get() ||
+ fBruteForceManager.count() < fMaxBruteForceN) {
+ // Already using the grid or the about-to-be-recorded draw will not cause us to exceed
+ // the brute force limit, so no need to change the current manager implementation.
+ return;
+ }
+ // Else we need to switch from the brute force manager to the grid manager
+ if (!fGridManager) {
+ fGridManager = GridBoundsManager::MakeRes(fDeviceSize, fGridCellSize);
+ }
+ fCurrentManager = fGridManager.get();
+
+ // Fill out the grid manager with the recorded draws in the brute force manager
+ fBruteForceManager.replayDraws(fCurrentManager);
+ fBruteForceManager.reset();
+ }
};
} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/geom/Geometry.h b/chromium/third_party/skia/src/gpu/graphite/geom/Geometry.h
new file mode 100644
index 00000000000..0f4f5bf8598
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/geom/Geometry.h
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef skgpu_graphite_geom_Geometry_DEFINED
+#define skgpu_graphite_geom_Geometry_DEFINED
+
+#include "include/core/SkVertices.h"
+#include "src/core/SkVerticesPriv.h"
+#include "src/gpu/graphite/geom/Rect.h"
+#include "src/gpu/graphite/geom/Shape.h"
+#include "src/gpu/graphite/geom/SubRunData.h"
+
+namespace skgpu::graphite {
+
+/**
+ * Geometry is a container that can house Shapes, SkVertices, and text SubRuns.
+ * TODO - Add unit tests for Geometry.
+ */
+class Geometry {
+public:
+ enum class Type : uint8_t {
+ kEmpty, kShape, kVertices, kSubRun
+ };
+
+ Geometry() {}
+ explicit Geometry(const Shape& shape) { this->setShape(shape); }
+ explicit Geometry(const SubRunData& subrun) { this->setSubRun(subrun); }
+ explicit Geometry(sk_sp<SkVertices> vertices) { this->setVertices(vertices); }
+ ~Geometry() { this->setType(Type::kEmpty); }
+
+ Geometry& operator=(Geometry&& geom) {
+ if (this != &geom) {
+ switch (geom.type()) {
+ case Type::kEmpty:
+ this->setType(Type::kEmpty);
+ break;
+ case Type::kShape:
+ this->setShape(geom.shape());
+ geom.setType(Type::kEmpty);
+ break;
+ case Type::kVertices:
+ this->setVertices(std::move(geom.fVertices));
+ geom.setType(Type::kEmpty);
+ break;
+ case Type::kSubRun:
+ this->setSubRun(geom.subRunData());
+ geom.setType(Type::kEmpty);
+ break;
+ }
+ }
+ return *this;
+ }
+ Geometry& operator=(const Geometry& geom) {
+ switch (geom.type()) {
+ case Type::kEmpty: this->setType(Type::kEmpty); break;
+ case Type::kShape: this->setShape(geom.shape()); break;
+ case Type::kSubRun: this->setSubRun(geom.subRunData()); break;
+ case Type::kVertices: this->setVertices(geom.fVertices); break;
+ default: break;
+ }
+ return *this;
+ }
+ Geometry(const Geometry& geom) {
+ *this = geom;
+ }
+
+ void setShape(const Shape& shape) {
+ if (fType == Type::kShape) {
+ fShape = shape;
+ } else {
+ this->setType(Type::kShape);
+ new (&fShape) Shape(shape);
+ }
+ }
+ void setSubRun(const SubRunData& subRun) {
+ if (fType == Type::kSubRun) {
+ fSubRunData = subRun;
+ } else {
+ this->setType(Type::kSubRun);
+ new (&fSubRunData) SubRunData(subRun);
+ }
+ }
+ void setVertices(sk_sp<SkVertices> vertices) {
+ if (fType == Type::kVertices) {
+ fVertices = std::move(vertices);
+ } else {
+ this->setType(Type::kVertices);
+ new (&fVertices) sk_sp<SkVertices>(std::move(vertices));
+ }
+ }
+
+ const Shape& shape() const { SkASSERT(this->isShape()); return fShape; }
+ const SubRunData& subRunData() const { SkASSERT(this->isSubRun()); return fSubRunData; }
+ const SkVertices* vertices() const { SkASSERT(this->isVertices()); return fVertices.get(); }
+ sk_sp<SkVertices> refVertices() const {
+ SkASSERT(this->isVertices());
+ return fVertices;
+ }
+ Rect bounds() const {
+ switch (fType) {
+ case Type::kEmpty: return Rect(0, 0, 0, 0);
+ case Type::kShape: return fShape.bounds();
+ case Type::kVertices: return fVertices->bounds();
+ case Type::kSubRun: return fSubRunData.bounds();
+ }
+ SkUNREACHABLE;
+ }
+ Type type() const { return fType; }
+
+ bool isShape() const { return fType == Type::kShape; }
+ bool isVertices() const { return fType == Type::kVertices; }
+ bool isSubRun() const { return fType == Type::kSubRun; }
+ bool isEmpty() const {
+ return fType == (Type::kEmpty) || (this->isShape() && this->shape().isEmpty());
+ }
+
+private:
+ void setType(Type type) {
+ if (this->isShape() && type != Type::kShape) {
+ fShape.~Shape();
+ } else if (this->isSubRun() && type != Type::kSubRun) {
+ fSubRunData.~SubRunData();
+ } else if (this->isVertices() && type != Type::kVertices) {
+ fVertices.~sk_sp<SkVertices>();
+ }
+ fType = type;
+ }
+
+ Type fType = Type::kEmpty;
+ union {
+ Shape fShape;
+ SubRunData fSubRunData;
+ sk_sp<SkVertices> fVertices;
+ };
+};
+} // namespace skgpu::graphite
+
+#endif // skgpu_graphite_geom_Geometry_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/graphite/geom/Shape.cpp b/chromium/third_party/skia/src/gpu/graphite/geom/Shape.cpp
index 5bdbdae76db..0a8f5b28a31 100644
--- a/chromium/third_party/skia/src/gpu/graphite/geom/Shape.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/geom/Shape.cpp
@@ -48,17 +48,6 @@ bool Shape::conservativeContains(skvx::float2 point) const {
SkUNREACHABLE;
}
-bool Shape::closed() const {
- switch (fType) {
- case Type::kEmpty: return true;
- case Type::kLine: return false;
- case Type::kRect: return true;
- case Type::kRRect: return true;
- case Type::kPath: return SkPathPriv::IsClosedSingleContour(fPath);
- }
- SkUNREACHABLE;
-}
-
bool Shape::convex(bool simpleFill) const {
if (this->isPath()) {
// SkPath.isConvex() really means "is this path convex were it to be closed".
diff --git a/chromium/third_party/skia/src/gpu/graphite/geom/Shape.h b/chromium/third_party/skia/src/gpu/graphite/geom/Shape.h
index bc8c3d9e294..974af65ea62 100644
--- a/chromium/third_party/skia/src/gpu/graphite/geom/Shape.h
+++ b/chromium/third_party/skia/src/gpu/graphite/geom/Shape.h
@@ -86,10 +86,6 @@ public:
bool conservativeContains(const Rect& rect) const;
bool conservativeContains(skvx::float2 point) const;
- // True if the underlying geometry represents a closed shape, without the need for an
- // implicit close.
- bool closed() const;
-
// True if the underlying shape is known to be convex, assuming no other styles. If 'simpleFill'
// is true, it is assumed the contours will be implicitly closed when drawn or used.
bool convex(bool simpleFill = true) const;
diff --git a/chromium/third_party/skia/src/gpu/graphite/geom/SubRunData.h b/chromium/third_party/skia/src/gpu/graphite/geom/SubRunData.h
new file mode 100644
index 00000000000..70a8893dcff
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/geom/SubRunData.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef skgpu_graphite_geom_SubRunData_DEFINED
+#define skgpu_graphite_geom_SubRunData_DEFINED
+
+#include "src/gpu/graphite/geom/Rect.h"
+
+namespace sktext::gpu { class AtlasSubRun; }
+
+namespace skgpu::graphite {
+
+class Recorder;
+
+/**
+ * SubRunData contains all the data we need to render AtlasSubRuns
+ */
+class SubRunData {
+public:
+ SubRunData() = delete;
+ SubRunData(const SubRunData& subRun) = default;
+ SubRunData(SubRunData&&) = delete;
+
+ SubRunData(const sktext::gpu::AtlasSubRun* subRun,
+ sk_sp<SkRefCnt> supportDataKeepAlive,
+ Rect deviceBounds,
+ int startGlyphIndex,
+ int glyphCount,
+ Recorder* recorder)
+ : fSubRun(subRun)
+ , fSupportDataKeepAlive(std::move(supportDataKeepAlive))
+ , fBounds(deviceBounds)
+ , fStartGlyphIndex(startGlyphIndex)
+ , fGlyphCount(glyphCount)
+ , fRecorder(recorder) {}
+
+ ~SubRunData() = default;
+
+ // NOTE: None of the geometry types benefit from move semantics, so we don't bother
+ // defining a move assignment operator for SubRunData.
+ SubRunData& operator=(SubRunData&&) = delete;
+ SubRunData& operator=(const SubRunData& that) = default;
+
+ // The bounding box of the subrun data.
+ Rect bounds() const { return fBounds; }
+
+ // Access the individual elements of the subrun data.
+ const sktext::gpu::AtlasSubRun* subRun() const { return fSubRun; }
+ int startGlyphIndex() const { return fStartGlyphIndex; }
+ int glyphCount() const { return fGlyphCount; }
+ Recorder* recorder() const { return fRecorder; }
+
+private:
+ const sktext::gpu::AtlasSubRun* fSubRun;
+ // Keep the TextBlob or Slug alive until we're done with the Geometry.
+ sk_sp<SkRefCnt> fSupportDataKeepAlive;
+
+ Rect fBounds; // bounds of the data stored in the SubRun
+ int fStartGlyphIndex;
+ int fGlyphCount;
+ Recorder* fRecorder; // this SubRun can only be associated with this Recorder's atlas
+};
+
+} // namespace skgpu::graphite
+
+#endif // skgpu_graphite_geom_SubRunData_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/graphite/geom/Transform.cpp b/chromium/third_party/skia/src/gpu/graphite/geom/Transform.cpp
index ac688ba353c..6c5de8a059c 100644
--- a/chromium/third_party/skia/src/gpu/graphite/geom/Transform.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/geom/Transform.cpp
@@ -93,6 +93,15 @@ Transform::Transform(const SkM44& m) : fM(m) {
fType = get_matrix_info(m, &fInvM, &fScale);
}
+const Transform& Transform::Identity() {
+ static const Transform kIdentity{SkM44()};
+ return kIdentity;
+}
+const Transform& Transform::Invalid() {
+ static const Transform kInvalid{SkM44(SkM44::kNaN_Constructor)};
+ return kInvalid;
+}
+
bool Transform::operator==(const Transform& t) const {
// Checking fM should be sufficient as all other values are computed from it.
SkASSERT(fM != t.fM || (fInvM == t.fInvM && fType == t.fType && fScale == t.fScale));
@@ -131,4 +140,50 @@ void Transform::inverseMapPoints(const SkV4* deviceIn, SkV4* localOut, int count
return map_points(fInvM, deviceIn, localOut, count);
}
+Transform Transform::preTranslate(float x, float y) const {
+ Transform t = *this;
+ t.fM.preTranslate(x, y);
+ t.fInvM.postTranslate(-x, -y);
+
+ // Under normal conditions, type and scale won't change, but if we've overflown the translation
+ // components, mark the matrix as invalid.
+ if (!t.fM.isFinite() || !t.fInvM.isFinite()) {
+ t.fType = Type::kInvalid;
+ }
+ return t;
+}
+
+Transform Transform::postTranslate(float x, float y) const {
+ Transform t = *this;
+ t.fM.postTranslate(x, y);
+ t.fInvM.preTranslate(-x, -y);
+ if (!t.fM.isFinite() || !t.fInvM.isFinite()) {
+ t.fType = Type::kInvalid;
+ }
+ return t;
+}
+
+Transform Transform::concat(const Transform& t) const {
+ Transform c = {fM * t.fM, t.fInvM * fInvM, std::max(fType, t.fType), {fScale * t.fScale}};
+ if (!c.fM.isFinite() || !c.fInvM.isFinite()) {
+ c.fType = Type::kInvalid;
+ }
+ return c;
+}
+
+Transform Transform::concatInverse(const Transform& t) const {
+ Transform c = {fM * t.fInvM, t.fM * fInvM, std::max(fType, t.fType), {fScale * (1.f/t.fScale)}};
+ if (!c.fM.isFinite() || !c.fInvM.isFinite()) {
+ c.fType = Type::kInvalid;
+ }
+ return c;
+}
+
+Transform Transform::concatInverse(const SkM44& t) const {
+ // saves a multiply compared to inverting just t and then computing fM*t^-1 and t*fInvM, if we
+ // instead start with (t*fInvM) and swap definition of computed fM and fInvM.
+ Transform inverse{t * fInvM};
+ return {inverse.fInvM, inverse.fM, inverse.fType, 1.f / inverse.fScale};
+}
+
} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/geom/Transform_graphite.h b/chromium/third_party/skia/src/gpu/graphite/geom/Transform_graphite.h
index dc1dddea4cc..790131f0f2c 100644
--- a/chromium/third_party/skia/src/gpu/graphite/geom/Transform_graphite.h
+++ b/chromium/third_party/skia/src/gpu/graphite/geom/Transform_graphite.h
@@ -44,6 +44,9 @@ public:
explicit Transform(const SkM44& m);
Transform(const Transform& t) = default;
+ static const Transform& Identity();
+ static const Transform& Invalid();
+
Transform& operator=(const Transform& t) = default;
operator const SkM44&() const { return fM; }
@@ -70,7 +73,22 @@ public:
void mapPoints(const SkV4* localIn, SkV4* deviceOut, int count) const;
void inverseMapPoints(const SkV4* deviceIn, SkV4* localOut, int count) const;
+ // Returns a transform equal to the pre- or post-translating this matrix
+ Transform preTranslate(float x, float y) const;
+ Transform postTranslate(float x, float y) const;
+
+ // Returns a transform equal to (this * t)
+ Transform concat(const Transform& t) const;
+ Transform concat(const SkM44& t) const { return Transform(fM * t); }
+
+ // Returns a transform equal to (this * t^-1)
+ Transform concatInverse(const Transform& t) const;
+ Transform concatInverse(const SkM44& t) const;
+
private:
+ Transform(const SkM44& m, const SkM44& invM, Type type, const SkV2 scale)
+ : fM(m), fInvM(invM), fType(type), fScale(scale) {}
+
SkM44 fM;
SkM44 fInvM; // M^-1
Type fType;
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlBlitCommandEncoder.h b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlBlitCommandEncoder.h
index 3911a832274..1a82b08d346 100644
--- a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlBlitCommandEncoder.h
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlBlitCommandEncoder.h
@@ -22,12 +22,13 @@ namespace skgpu::graphite {
*/
class MtlBlitCommandEncoder : public Resource {
public:
- static sk_sp<MtlBlitCommandEncoder> Make(const skgpu::graphite::Gpu* gpu,
+ static sk_sp<MtlBlitCommandEncoder> Make(const SharedContext* sharedContext,
id<MTLCommandBuffer> commandBuffer) {
// Adding a retain here to keep our own ref separate from the autorelease pool
sk_cfp<id<MTLBlitCommandEncoder>> encoder =
sk_ret_cfp<id<MTLBlitCommandEncoder>>([commandBuffer blitCommandEncoder]);
- return sk_sp<MtlBlitCommandEncoder>(new MtlBlitCommandEncoder(gpu, std::move(encoder)));
+ return sk_sp<MtlBlitCommandEncoder>(new MtlBlitCommandEncoder(sharedContext,
+ std::move(encoder)));
}
void pushDebugGroup(NSString* string) {
@@ -80,9 +81,9 @@ public:
}
private:
- MtlBlitCommandEncoder(const skgpu::graphite::Gpu* gpu,
+ MtlBlitCommandEncoder(const SharedContext* sharedContext,
sk_cfp<id<MTLBlitCommandEncoder>> encoder)
- : Resource(gpu, Ownership::kOwned, SkBudgeted::kYes)
+ : Resource(sharedContext, Ownership::kOwned, SkBudgeted::kYes)
, fCommandEncoder(std::move(encoder)) {}
void freeGpuData() override {
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlBuffer.h b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlBuffer.h
index 9ccf5d8db7f..ecb9c80e01e 100644
--- a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlBuffer.h
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlBuffer.h
@@ -15,16 +15,22 @@
#import <Metal/Metal.h>
namespace skgpu::graphite {
-class MtlGpu;
+class MtlSharedContext;
class MtlBuffer : public Buffer {
public:
- static sk_sp<Buffer> Make(const MtlGpu*, size_t size, BufferType type, PrioritizeGpuReads);
+ static sk_sp<Buffer> Make(const MtlSharedContext*,
+ size_t size,
+ BufferType type,
+ PrioritizeGpuReads);
id<MTLBuffer> mtlBuffer() const { return fBuffer.get(); }
private:
- MtlBuffer(const MtlGpu*, size_t size, BufferType type, PrioritizeGpuReads,
+ MtlBuffer(const MtlSharedContext*,
+ size_t size,
+ BufferType type,
+ PrioritizeGpuReads,
sk_cfp<id<MTLBuffer>>);
void onMap() override;
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlBuffer.mm b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlBuffer.mm
index 338471b0c16..76de8ee2bfe 100644
--- a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlBuffer.mm
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlBuffer.mm
@@ -7,7 +7,7 @@
#include "src/gpu/graphite/mtl/MtlBuffer.h"
-#include "src/gpu/graphite/mtl/MtlGpu.h"
+#include "src/gpu/graphite/mtl/MtlSharedContext.h"
namespace skgpu::graphite {
@@ -18,10 +18,11 @@ NSString* kBufferTypeNames[kBufferTypeCount] = {
@"Xfer CPU to GPU",
@"Xfer GPU to CPU",
@"Uniform",
+ @"Storage",
};
#endif
-sk_sp<Buffer> MtlBuffer::Make(const MtlGpu* gpu,
+sk_sp<Buffer> MtlBuffer::Make(const MtlSharedContext* sharedContext,
size_t size,
BufferType type,
PrioritizeGpuReads prioritizeGpuReads) {
@@ -29,7 +30,7 @@ sk_sp<Buffer> MtlBuffer::Make(const MtlGpu* gpu,
return nullptr;
}
- const MtlCaps& mtlCaps = gpu->mtlCaps();
+ const MtlCaps& mtlCaps = sharedContext->mtlCaps();
NSUInteger options = 0;
if (@available(macOS 10.11, iOS 9.0, *)) {
@@ -50,20 +51,25 @@ sk_sp<Buffer> MtlBuffer::Make(const MtlGpu* gpu,
}
size = SkAlignTo(size, mtlCaps.getMinBufferAlignment());
- sk_cfp<id<MTLBuffer>> buffer([gpu->device() newBufferWithLength: size options: options]);
+ sk_cfp<id<MTLBuffer>> buffer([sharedContext->device() newBufferWithLength:size
+ options:options]);
#ifdef SK_ENABLE_MTL_DEBUG_INFO
(*buffer).label = kBufferTypeNames[(int)type];
#endif
- return sk_sp<Buffer>(new MtlBuffer(gpu, size, type, prioritizeGpuReads, std::move(buffer)));
+ return sk_sp<Buffer>(new MtlBuffer(sharedContext,
+ size,
+ type,
+ prioritizeGpuReads,
+ std::move(buffer)));
}
-MtlBuffer::MtlBuffer(const MtlGpu* gpu,
+MtlBuffer::MtlBuffer(const MtlSharedContext* sharedContext,
size_t size,
BufferType type,
PrioritizeGpuReads prioritizeGpuReads,
sk_cfp<id<MTLBuffer>> buffer)
- : Buffer(gpu, size, type, prioritizeGpuReads)
+ : Buffer(sharedContext, size, type, prioritizeGpuReads)
, fBuffer(std::move(buffer)) {}
void MtlBuffer::onMap() {
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlCaps.h b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlCaps.h
index 0fe9009ffda..d0ab9a7a8df 100644
--- a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlCaps.h
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlCaps.h
@@ -15,10 +15,11 @@
#include "src/gpu/graphite/Caps.h"
namespace skgpu::graphite {
+struct ContextOptions;
class MtlCaps final : public skgpu::graphite::Caps {
public:
- MtlCaps(const id<MTLDevice>);
+ MtlCaps(const id<MTLDevice>, const ContextOptions&);
~MtlCaps() override {}
TextureInfo getDefaultSampledTextureInfo(SkColorType,
@@ -34,6 +35,7 @@ public:
UniqueKey makeGraphicsPipelineKey(const GraphicsPipelineDesc&,
const RenderPassDesc&) const override;
+ UniqueKey makeComputePipelineKey(const ComputePipelineDesc&) const override;
bool isMac() const { return fGPUFamily == GPUFamily::kMac; }
bool isApple()const { return fGPUFamily == GPUFamily::kApple; }
@@ -101,7 +103,7 @@ private:
std::unique_ptr<ColorTypeInfo[]> fColorTypeInfos;
int fColorTypeInfoCount = 0;
};
- inline static constexpr size_t kNumMtlFormats = 9;
+ inline static constexpr size_t kNumMtlFormats = 10;
static size_t GetFormatIndex(MTLPixelFormat);
FormatInfo fFormatTable[kNumMtlFormats];
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlCaps.mm b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlCaps.mm
index 3533066d8b0..51b93fc4077 100644
--- a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlCaps.mm
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlCaps.mm
@@ -10,6 +10,7 @@
#include "include/gpu/graphite/TextureInfo.h"
#include "include/gpu/graphite/mtl/MtlTypes.h"
#include "src/gpu/graphite/CommandBuffer.h"
+#include "src/gpu/graphite/ComputePipelineDesc.h"
#include "src/gpu/graphite/GraphicsPipelineDesc.h"
#include "src/gpu/graphite/GraphiteResourceKey.h"
#include "src/gpu/graphite/mtl/MtlUtils.h"
@@ -17,7 +18,7 @@
namespace skgpu::graphite {
-MtlCaps::MtlCaps(const id<MTLDevice> device)
+MtlCaps::MtlCaps(const id<MTLDevice> device, const ContextOptions& options)
: Caps() {
this->initGPUFamily(device);
this->initCaps(device);
@@ -27,7 +28,7 @@ MtlCaps::MtlCaps(const id<MTLDevice> device)
// Metal-specific MtlCaps
- this->finishInitialization();
+ this->finishInitialization(options);
}
// translates from older MTLFeatureSet interface to MTLGPUFamily interface
@@ -231,6 +232,9 @@ void MtlCaps::initCaps(const id<MTLDevice> device) {
fRequiredUniformBufferAlignment = 16;
}
+ // Metal does not distinguish between uniform and storage buffers.
+ fRequiredStorageBufferAlignment = fRequiredUniformBufferAlignment;
+
if (@available(macOS 10.12, ios 14.0, *)) {
fClampToBorderSupport = (this->isMac() || fFamilyGroup >= 7);
} else {
@@ -289,6 +293,8 @@ static constexpr MTLPixelFormat kMtlFormats[] = {
MTLPixelFormatBGRA8Unorm,
kMTLPixelFormatB5G6R5Unorm,
+ MTLPixelFormatRGBA16Float,
+
MTLPixelFormatStencil8,
MTLPixelFormatDepth32Float,
MTLPixelFormatDepth32Float_Stencil8,
@@ -327,7 +333,7 @@ void MtlCaps::setColorType(SkColorType colorType, std::initializer_list<MTLPixel
}
size_t MtlCaps::GetFormatIndex(MTLPixelFormat pixelFormat) {
- static_assert(SK_ARRAY_COUNT(kMtlFormats) == MtlCaps::kNumMtlFormats,
+ static_assert(std::size(kMtlFormats) == MtlCaps::kNumMtlFormats,
"Size of kMtlFormats array must match static value in header");
for (size_t i = 0; i < MtlCaps::kNumMtlFormats; ++i) {
if (kMtlFormats[i] == pixelFormat) {
@@ -445,6 +451,21 @@ void MtlCaps::initFormatTable() {
}
}
+ // Format: RGBA16Float
+ {
+ info = &fFormatTable[GetFormatIndex(MTLPixelFormatRGBA16Float)];
+ info->fFlags = FormatInfo::kAllFlags;
+ info->fColorTypeInfoCount = 1;
+ info->fColorTypeInfos.reset(new ColorTypeInfo[info->fColorTypeInfoCount]());
+ int ctIdx = 0;
+ // Format: RGBA16Float, Surface: RGBA_F16
+ {
+ auto& ctInfo = info->fColorTypeInfos[ctIdx++];
+ ctInfo.fColorType = kRGBA_F16_SkColorType;
+ ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag;
+ }
+ }
+
/*
* Non-color formats
*/
@@ -496,6 +517,7 @@ void MtlCaps::initFormatTable() {
this->setColorType(kBGRA_8888_SkColorType, { MTLPixelFormatBGRA8Unorm });
this->setColorType(kGray_8_SkColorType, { MTLPixelFormatR8Unorm });
this->setColorType(kR8_unorm_SkColorType, { MTLPixelFormatR8Unorm });
+ this->setColorType(kRGBA_F16_SkColorType, { MTLPixelFormatRGBA16Float });
}
TextureInfo MtlCaps::getDefaultSampledTextureInfo(SkColorType colorType,
@@ -579,7 +601,7 @@ UniqueKey MtlCaps::makeGraphicsPipelineKey(const GraphicsPipelineDesc& pipelineD
static const skgpu::UniqueKey::Domain kGraphicsPipelineDomain = UniqueKey::GenerateDomain();
SkSpan<const uint32_t> pipelineDescKey = pipelineDesc.asKey();
UniqueKey::Builder builder(&pipelineKey, kGraphicsPipelineDomain,
- pipelineDescKey.size() + 1, "GraphicsPipeline");
+ pipelineDescKey.size() + 2, "GraphicsPipeline");
// add graphicspipelinedesc key
for (unsigned int i = 0; i < pipelineDescKey.size(); ++i) {
builder[i] = pipelineDescKey[i];
@@ -589,14 +611,37 @@ UniqueKey MtlCaps::makeGraphicsPipelineKey(const GraphicsPipelineDesc& pipelineD
renderPassDesc.fColorAttachment.fTextureInfo.getMtlTextureInfo(&colorInfo);
renderPassDesc.fDepthStencilAttachment.fTextureInfo.getMtlTextureInfo(&depthStencilInfo);
SkASSERT(colorInfo.fFormat < 65535 && depthStencilInfo.fFormat < 65535);
- uint32_t renderPassKey = colorInfo.fFormat << 16 | depthStencilInfo.fFormat;
- builder[pipelineDescKey.size()] = renderPassKey;
+ uint32_t colorAttachmentKey = colorInfo.fFormat << 16 | colorInfo.fSampleCount;
+ uint32_t dsAttachmentKey = depthStencilInfo.fFormat << 16 | depthStencilInfo.fSampleCount;
+ builder[pipelineDescKey.size()] = colorAttachmentKey;
+ builder[pipelineDescKey.size()+1] = dsAttachmentKey;
builder.finish();
}
return pipelineKey;
}
+UniqueKey MtlCaps::makeComputePipelineKey(const ComputePipelineDesc& pipelineDesc) const {
+ UniqueKey pipelineKey;
+ {
+ static const skgpu::UniqueKey::Domain kComputePipelineDomain = UniqueKey::GenerateDomain();
+ SkSpan<const uint32_t> pipelineDescKey = pipelineDesc.asKey();
+ UniqueKey::Builder builder(
+ &pipelineKey, kComputePipelineDomain, pipelineDescKey.size(), "ComputePipeline");
+ // Add ComputePipelineDesc key
+ for (unsigned int i = 0; i < pipelineDescKey.size(); ++i) {
+ builder[i] = pipelineDescKey[i];
+ }
+
+ // TODO(b/240615224): The local work group size may need to factor into the key on platforms
+ // that don't support specialization constants and require the workgroup/threadgroup size to
+ // be specified in the shader text (D3D12, Vulkan 1.0, and OpenGL).
+
+ builder.finish();
+ }
+ return pipelineKey;
+}
+
bool MtlCaps::onIsTexturable(const TextureInfo& info) const {
if (!(info.mtlTextureSpec().fUsage & MTLTextureUsageShaderRead)) {
return false;
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlCommandBuffer.h b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlCommandBuffer.h
index f2dceb06238..d02e9dd160e 100644
--- a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlCommandBuffer.h
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlCommandBuffer.h
@@ -9,6 +9,7 @@
#define skgpu_graphite_MtlCommandBuffer_DEFINED
#include "src/gpu/graphite/CommandBuffer.h"
+#include "src/gpu/graphite/DrawPass.h"
#include "src/gpu/graphite/GpuWorkSubmission.h"
#include "src/gpu/graphite/Log.h"
@@ -21,12 +22,13 @@
namespace skgpu::graphite {
class MtlBlitCommandEncoder;
-class MtlGpu;
+class MtlComputeCommandEncoder;
class MtlRenderCommandEncoder;
+class MtlSharedContext;
class MtlCommandBuffer final : public CommandBuffer {
public:
- static sk_sp<MtlCommandBuffer> Make(const MtlGpu*);
+ static sk_sp<MtlCommandBuffer> Make(id<MTLCommandQueue>, const MtlSharedContext*);
~MtlCommandBuffer() override;
bool isFinished() {
@@ -34,7 +36,7 @@ public:
(*fCommandBuffer).status == MTLCommandBufferStatusError;
}
- void waitUntilFinished() {
+ void waitUntilFinished(const SharedContext*) {
// TODO: it's not clear what do to if status is Enqueued. Commit and then wait?
if ((*fCommandBuffer).status == MTLCommandBufferStatusScheduled ||
(*fCommandBuffer).status == MTLCommandBufferStatusCommitted) {
@@ -49,41 +51,62 @@ public:
bool commit();
private:
- MtlCommandBuffer(sk_cfp<id<MTLCommandBuffer>> cmdBuffer, const MtlGpu* gpu);
-
- bool onBeginRenderPass(const RenderPassDesc&,
- const Texture* colorTexture,
- const Texture* resolveTexture,
- const Texture* depthStencilTexture) override;
- void endRenderPass() override;
-
- void onBindGraphicsPipeline(const GraphicsPipeline*) override;
- void onBindUniformBuffer(UniformSlot, const Buffer*, size_t offset) override;
- void onBindVertexBuffers(const Buffer* vertexBuffer, size_t vertexOffset,
- const Buffer* instanceBuffer, size_t instanceOffset) override;
- void onBindIndexBuffer(const Buffer* indexBuffer, size_t offset) override;
-
-
- void onBindTextureAndSampler(sk_sp<Texture>,
- sk_sp<Sampler>,
- unsigned int bindIndex) override;
-
- void onSetScissor(unsigned int left, unsigned int top,
- unsigned int width, unsigned int height) override;
- void onSetViewport(float x, float y, float width, float height,
- float minDepth, float maxDepth) override;
- void onSetBlendConstants(std::array<float, 4> blendConstants) override;
-
- void onDraw(PrimitiveType type, unsigned int baseVertex, unsigned int vertexCount) override;
- void onDrawIndexed(PrimitiveType type, unsigned int baseIndex, unsigned int indexCount,
- unsigned int baseVertex) override;
- void onDrawInstanced(PrimitiveType type,
- unsigned int baseVertex, unsigned int vertexCount,
- unsigned int baseInstance, unsigned int instanceCount) override;
- void onDrawIndexedInstanced(PrimitiveType type, unsigned int baseIndex,
- unsigned int indexCount, unsigned int baseVertex,
- unsigned int baseInstance, unsigned int instanceCount) override;
-
+ MtlCommandBuffer(sk_cfp<id<MTLCommandBuffer>> cmdBuffer, const MtlSharedContext* sharedContext);
+
+ bool onAddRenderPass(const RenderPassDesc&,
+ const Texture* colorTexture,
+ const Texture* resolveTexture,
+ const Texture* depthStencilTexture,
+ const std::vector<std::unique_ptr<DrawPass>>& drawPasses) override;
+ bool onAddComputePass(const ComputePassDesc&,
+ const ComputePipeline*,
+ const std::vector<ResourceBinding>& bindings) override;
+
+ // Methods for populating a MTLRenderCommandEncoder:
+ bool beginRenderPass(const RenderPassDesc&,
+ const Texture* colorTexture,
+ const Texture* resolveTexture,
+ const Texture* depthStencilTexture);
+ void endRenderPass();
+
+ void addDrawPass(const DrawPass*);
+
+ void bindGraphicsPipeline(const GraphicsPipeline*);
+ void setBlendConstants(float* blendConstants);
+
+ void bindUniformBuffer(const BindBufferInfo& info, UniformSlot);
+ void bindDrawBuffers(const BindBufferInfo& vertices,
+ const BindBufferInfo& instances,
+ const BindBufferInfo& indices);
+ void bindVertexBuffers(const Buffer* vertexBuffer, size_t vertexOffset,
+ const Buffer* instanceBuffer, size_t instanceOffset);
+ void bindIndexBuffer(const Buffer* indexBuffer, size_t offset);
+
+ void bindTextureAndSampler(const Texture*, const Sampler*, unsigned int bindIndex);
+
+ void setScissor(unsigned int left, unsigned int top,
+ unsigned int width, unsigned int height);
+ void setViewport(float x, float y, float width, float height,
+ float minDepth, float maxDepth);
+
+ void draw(PrimitiveType type, unsigned int baseVertex, unsigned int vertexCount);
+ void drawIndexed(PrimitiveType type, unsigned int baseIndex, unsigned int indexCount,
+ unsigned int baseVertex);
+ void drawInstanced(PrimitiveType type,
+ unsigned int baseVertex, unsigned int vertexCount,
+ unsigned int baseInstance, unsigned int instanceCount);
+ void drawIndexedInstanced(PrimitiveType type, unsigned int baseIndex,
+ unsigned int indexCount, unsigned int baseVertex,
+ unsigned int baseInstance, unsigned int instanceCount);
+
+ // Methods for populating a MTLComputeCommandEncoder:
+ void beginComputePass();
+ void bindComputePipeline(const ComputePipeline*);
+ void bindBuffer(const Buffer* buffer, unsigned int offset, unsigned int index);
+ void dispatchThreadgroups(const WorkgroupSize& globalSize, const WorkgroupSize& localSize);
+ void endComputePass();
+
+ // Methods for populating a MTLBlitCommandEncoder:
bool onCopyTextureToBuffer(const Texture*,
SkIRect srcRect,
const Buffer*,
@@ -99,6 +122,7 @@ private:
sk_cfp<id<MTLCommandBuffer>> fCommandBuffer;
sk_sp<MtlRenderCommandEncoder> fActiveRenderCommandEncoder;
+ sk_sp<MtlComputeCommandEncoder> fActiveComputeCommandEncoder;
sk_sp<MtlBlitCommandEncoder> fActiveBlitCommandEncoder;
size_t fCurrentVertexStride = 0;
@@ -106,7 +130,7 @@ private:
id<MTLBuffer> fCurrentIndexBuffer;
size_t fCurrentIndexBufferOffset = 0;
- const MtlGpu* fGpu;
+ const MtlSharedContext* fSharedContext;
};
} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlCommandBuffer.mm b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlCommandBuffer.mm
index d6c42a79412..7ea8369e649 100644
--- a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlCommandBuffer.mm
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlCommandBuffer.mm
@@ -12,18 +12,20 @@
#include "src/gpu/graphite/mtl/MtlBlitCommandEncoder.h"
#include "src/gpu/graphite/mtl/MtlBuffer.h"
#include "src/gpu/graphite/mtl/MtlCaps.h"
-#include "src/gpu/graphite/mtl/MtlGpu.h"
+#include "src/gpu/graphite/mtl/MtlComputeCommandEncoder.h"
+#include "src/gpu/graphite/mtl/MtlComputePipeline.h"
#include "src/gpu/graphite/mtl/MtlGraphicsPipeline.h"
#include "src/gpu/graphite/mtl/MtlRenderCommandEncoder.h"
#include "src/gpu/graphite/mtl/MtlSampler.h"
+#include "src/gpu/graphite/mtl/MtlSharedContext.h"
#include "src/gpu/graphite/mtl/MtlTexture.h"
#include "src/gpu/graphite/mtl/MtlUtils.h"
namespace skgpu::graphite {
-sk_sp<MtlCommandBuffer> MtlCommandBuffer::Make(const MtlGpu* gpu) {
+sk_sp<MtlCommandBuffer> MtlCommandBuffer::Make(id<MTLCommandQueue> queue,
+ const MtlSharedContext* sharedContext) {
sk_cfp<id<MTLCommandBuffer>> cmdBuffer;
- id<MTLCommandQueue> queue = gpu->queue();
if (@available(macOS 11.0, iOS 14.0, tvOS 14.0, *)) {
sk_cfp<MTLCommandBufferDescriptor*> desc([[MTLCommandBufferDescriptor alloc] init]);
(*desc).retainedReferences = NO;
@@ -44,16 +46,18 @@ sk_sp<MtlCommandBuffer> MtlCommandBuffer::Make(const MtlGpu* gpu) {
(*cmdBuffer).label = @"MtlCommandBuffer::Make";
#endif
- return sk_sp<MtlCommandBuffer>(new MtlCommandBuffer(std::move(cmdBuffer), gpu));
+ return sk_sp<MtlCommandBuffer>(new MtlCommandBuffer(std::move(cmdBuffer), sharedContext));
}
-MtlCommandBuffer::MtlCommandBuffer(sk_cfp<id<MTLCommandBuffer>> cmdBuffer, const MtlGpu* gpu)
- : fCommandBuffer(std::move(cmdBuffer)), fGpu(gpu) {}
+MtlCommandBuffer::MtlCommandBuffer(sk_cfp<id<MTLCommandBuffer>> cmdBuffer,
+ const MtlSharedContext* sharedContext)
+ : fCommandBuffer(std::move(cmdBuffer)), fSharedContext(sharedContext) {}
MtlCommandBuffer::~MtlCommandBuffer() {}
bool MtlCommandBuffer::commit() {
SkASSERT(!fActiveRenderCommandEncoder);
+ SkASSERT(!fActiveComputeCommandEncoder);
this->endBlitCommandEncoder();
#ifdef SK_BUILD_FOR_IOS
if (MtlIsAppInBackground()) {
@@ -72,11 +76,44 @@ bool MtlCommandBuffer::commit() {
return ((*fCommandBuffer).status != MTLCommandBufferStatusError);
}
-bool MtlCommandBuffer::onBeginRenderPass(const RenderPassDesc& renderPassDesc,
- const Texture* colorTexture,
- const Texture* resolveTexture,
- const Texture* depthStencilTexture) {
+bool MtlCommandBuffer::onAddRenderPass(const RenderPassDesc& renderPassDesc,
+ const Texture* colorTexture,
+ const Texture* resolveTexture,
+ const Texture* depthStencilTexture,
+ const std::vector<std::unique_ptr<DrawPass>>& drawPasses) {
+ if (!this->beginRenderPass(renderPassDesc, colorTexture, resolveTexture, depthStencilTexture)) {
+ return false;
+ }
+
+ for (size_t i = 0; i < drawPasses.size(); ++i) {
+ this->addDrawPass(drawPasses[i].get());
+ }
+
+ this->endRenderPass();
+ return true;
+}
+
+bool MtlCommandBuffer::onAddComputePass(const ComputePassDesc& computePassDesc,
+ const ComputePipeline* pipeline,
+ const std::vector<ResourceBinding>& bindings) {
+ this->beginComputePass();
+ this->bindComputePipeline(pipeline);
+ for (const ResourceBinding& binding : bindings) {
+ this->bindBuffer(
+ binding.fResource.fBuffer.get(), binding.fResource.fOffset, binding.fIndex);
+ }
+ this->dispatchThreadgroups(computePassDesc.fGlobalDispatchSize,
+ computePassDesc.fLocalDispatchSize);
+ this->endComputePass();
+ return true;
+}
+
+bool MtlCommandBuffer::beginRenderPass(const RenderPassDesc& renderPassDesc,
+ const Texture* colorTexture,
+ const Texture* resolveTexture,
+ const Texture* depthStencilTexture) {
SkASSERT(!fActiveRenderCommandEncoder);
+ SkASSERT(!fActiveComputeCommandEncoder);
this->endBlitCommandEncoder();
#ifdef SK_BUILD_FOR_IOS
if (MtlIsAppInBackground()) {
@@ -93,7 +130,7 @@ bool MtlCommandBuffer::onBeginRenderPass(const RenderPassDesc& renderPassDesc,
static_assert((int)LoadOp::kLoad == 0);
static_assert((int)LoadOp::kClear == 1);
static_assert((int)LoadOp::kDiscard == 2);
- static_assert(SK_ARRAY_COUNT(mtlLoadAction) == kLoadOpCount);
+ static_assert(std::size(mtlLoadAction) == kLoadOpCount);
const static MTLStoreAction mtlStoreAction[] {
MTLStoreActionStore,
@@ -101,7 +138,7 @@ bool MtlCommandBuffer::onBeginRenderPass(const RenderPassDesc& renderPassDesc,
};
static_assert((int)StoreOp::kStore == 0);
static_assert((int)StoreOp::kDiscard == 1);
- static_assert(SK_ARRAY_COUNT(mtlStoreAction) == kStoreOpCount);
+ static_assert(std::size(mtlStoreAction) == kStoreOpCount);
sk_cfp<MTLRenderPassDescriptor*> descriptor([[MTLRenderPassDescriptor alloc] init]);
// Set up color attachment.
@@ -160,7 +197,7 @@ bool MtlCommandBuffer::onBeginRenderPass(const RenderPassDesc& renderPassDesc,
SkASSERT(!depthStencilInfo.fTextureInfo.isValid());
}
- fActiveRenderCommandEncoder = MtlRenderCommandEncoder::Make(fGpu,
+ fActiveRenderCommandEncoder = MtlRenderCommandEncoder::Make(fSharedContext,
fCommandBuffer.get(),
descriptor.get());
@@ -175,6 +212,92 @@ void MtlCommandBuffer::endRenderPass() {
fActiveRenderCommandEncoder.reset();
}
+void MtlCommandBuffer::addDrawPass(const DrawPass* drawPass) {
+ drawPass->addResourceRefs(this);
+
+ for (auto[type, cmdPtr] : drawPass->commands()) {
+ switch (type) {
+ case DrawPassCommands::Type::kBindGraphicsPipeline: {
+ auto bgp = static_cast<DrawPassCommands::BindGraphicsPipeline*>(cmdPtr);
+ this->bindGraphicsPipeline(drawPass->getPipeline(bgp->fPipelineIndex));
+ break;
+ }
+ case DrawPassCommands::Type::kSetBlendConstants: {
+ auto sbc = static_cast<DrawPassCommands::SetBlendConstants*>(cmdPtr);
+ this->setBlendConstants(sbc->fBlendConstants);
+ break;
+ }
+ case DrawPassCommands::Type::kBindUniformBuffer: {
+ auto bub = static_cast<DrawPassCommands::BindUniformBuffer*>(cmdPtr);
+ this->bindUniformBuffer(bub->fInfo, bub->fSlot);
+ break;
+ }
+ case DrawPassCommands::Type::kBindDrawBuffers: {
+ auto bdb = static_cast<DrawPassCommands::BindDrawBuffers*>(cmdPtr);
+ this->bindDrawBuffers(bdb->fVertices, bdb->fInstances, bdb->fIndices);
+ break;
+ }
+ case DrawPassCommands::Type::kBindTexturesAndSamplers: {
+ auto bts = static_cast<DrawPassCommands::BindTexturesAndSamplers*>(cmdPtr);
+ for (int j = 0; j < bts->fNumTexSamplers; ++j) {
+ this->bindTextureAndSampler(drawPass->getTexture(bts->fTextureIndices[j]),
+ drawPass->getSampler(bts->fSamplerIndices[j]),
+ j);
+ }
+ break;
+ }
+ case DrawPassCommands::Type::kSetViewport: {
+ auto sv = static_cast<DrawPassCommands::SetViewport*>(cmdPtr);
+ this->setViewport(sv->fViewport.fLeft,
+ sv->fViewport.fTop,
+ sv->fViewport.width(),
+ sv->fViewport.height(),
+ sv->fMinDepth,
+ sv->fMaxDepth);
+ break;
+ }
+ case DrawPassCommands::Type::kSetScissor: {
+ auto ss = static_cast<DrawPassCommands::SetScissor*>(cmdPtr);
+ const SkIRect& rect = ss->fScissor;
+ this->setScissor(rect.fLeft, rect.fTop, rect.width(), rect.height());
+ break;
+ }
+ case DrawPassCommands::Type::kDraw: {
+ auto draw = static_cast<DrawPassCommands::Draw*>(cmdPtr);
+ this->draw(draw->fType, draw->fBaseVertex, draw->fVertexCount);
+ break;
+ }
+ case DrawPassCommands::Type::kDrawIndexed: {
+ auto draw = static_cast<DrawPassCommands::DrawIndexed*>(cmdPtr);
+ this->drawIndexed(draw->fType,
+ draw->fBaseIndex,
+ draw->fIndexCount,
+ draw->fBaseVertex);
+ break;
+ }
+ case DrawPassCommands::Type::kDrawInstanced: {
+ auto draw = static_cast<DrawPassCommands::DrawInstanced*>(cmdPtr);
+ this->drawInstanced(draw->fType,
+ draw->fBaseVertex,
+ draw->fVertexCount,
+ draw->fBaseInstance,
+ draw->fInstanceCount);
+ break;
+ }
+ case DrawPassCommands::Type::kDrawIndexedInstanced: {
+ auto draw = static_cast<DrawPassCommands::DrawIndexedInstanced*>(cmdPtr);
+ this->drawIndexedInstanced(draw->fType,
+ draw->fBaseIndex,
+ draw->fIndexCount,
+ draw->fBaseVertex,
+ draw->fBaseInstance,
+ draw->fInstanceCount);
+ break;
+ }
+ }
+ }
+}
+
MtlBlitCommandEncoder* MtlCommandBuffer::getBlitCommandEncoder() {
if (fActiveBlitCommandEncoder) {
return fActiveBlitCommandEncoder.get();
@@ -186,7 +309,7 @@ MtlBlitCommandEncoder* MtlCommandBuffer::getBlitCommandEncoder() {
}
#endif
- fActiveBlitCommandEncoder = MtlBlitCommandEncoder::Make(fGpu, fCommandBuffer.get());
+ fActiveBlitCommandEncoder = MtlBlitCommandEncoder::Make(fSharedContext, fCommandBuffer.get());
if (!fActiveBlitCommandEncoder) {
return nullptr;
@@ -205,7 +328,7 @@ void MtlCommandBuffer::endBlitCommandEncoder() {
}
}
-void MtlCommandBuffer::onBindGraphicsPipeline(const GraphicsPipeline* graphicsPipeline) {
+void MtlCommandBuffer::bindGraphicsPipeline(const GraphicsPipeline* graphicsPipeline) {
SkASSERT(fActiveRenderCommandEncoder);
auto mtlPipeline = static_cast<const MtlGraphicsPipeline*>(graphicsPipeline);
@@ -220,13 +343,11 @@ void MtlCommandBuffer::onBindGraphicsPipeline(const GraphicsPipeline* graphicsPi
fCurrentInstanceStride = mtlPipeline->instanceStride();
}
-void MtlCommandBuffer::onBindUniformBuffer(UniformSlot slot,
- const Buffer* uniformBuffer,
- size_t uniformOffset) {
+void MtlCommandBuffer::bindUniformBuffer(const BindBufferInfo& info, UniformSlot slot) {
SkASSERT(fActiveRenderCommandEncoder);
- id<MTLBuffer> mtlBuffer = uniformBuffer ?
- static_cast<const MtlBuffer*>(uniformBuffer)->mtlBuffer() : nullptr;
+ id<MTLBuffer> mtlBuffer = info.fBuffer ?
+ static_cast<const MtlBuffer*>(info.fBuffer)->mtlBuffer() : nullptr;
unsigned int bufferIndex;
switch(slot) {
@@ -238,14 +359,24 @@ void MtlCommandBuffer::onBindUniformBuffer(UniformSlot slot,
break;
}
- fActiveRenderCommandEncoder->setVertexBuffer(mtlBuffer, uniformOffset, bufferIndex);
- fActiveRenderCommandEncoder->setFragmentBuffer(mtlBuffer, uniformOffset, bufferIndex);
+ fActiveRenderCommandEncoder->setVertexBuffer(mtlBuffer, info.fOffset, bufferIndex);
+ fActiveRenderCommandEncoder->setFragmentBuffer(mtlBuffer, info.fOffset, bufferIndex);
}
-void MtlCommandBuffer::onBindVertexBuffers(const Buffer* vertexBuffer,
- size_t vertexOffset,
- const Buffer* instanceBuffer,
- size_t instanceOffset) {
+void MtlCommandBuffer::bindDrawBuffers(const BindBufferInfo& vertices,
+ const BindBufferInfo& instances,
+ const BindBufferInfo& indices) {
+ this->bindVertexBuffers(vertices.fBuffer,
+ vertices.fOffset,
+ instances.fBuffer,
+ instances.fOffset);
+ this->bindIndexBuffer(indices.fBuffer, indices.fOffset);
+}
+
+void MtlCommandBuffer::bindVertexBuffers(const Buffer* vertexBuffer,
+ size_t vertexOffset,
+ const Buffer* instanceBuffer,
+ size_t instanceOffset) {
SkASSERT(fActiveRenderCommandEncoder);
if (vertexBuffer) {
@@ -264,7 +395,7 @@ void MtlCommandBuffer::onBindVertexBuffers(const Buffer* vertexBuffer,
}
}
-void MtlCommandBuffer::onBindIndexBuffer(const Buffer* indexBuffer, size_t offset) {
+void MtlCommandBuffer::bindIndexBuffer(const Buffer* indexBuffer, size_t offset) {
if (indexBuffer) {
fCurrentIndexBuffer = static_cast<const MtlBuffer*>(indexBuffer)->mtlBuffer();
fCurrentIndexBufferOffset = offset;
@@ -274,26 +405,26 @@ void MtlCommandBuffer::onBindIndexBuffer(const Buffer* indexBuffer, size_t offse
}
}
-void MtlCommandBuffer::onBindTextureAndSampler(sk_sp<Texture> texture,
- sk_sp<Sampler> sampler,
- unsigned int bindIndex) {
+void MtlCommandBuffer::bindTextureAndSampler(const Texture* texture,
+ const Sampler* sampler,
+ unsigned int bindIndex) {
SkASSERT(texture && sampler);
- id<MTLTexture> mtlTexture = ((MtlTexture*)texture.get())->mtlTexture();
- id<MTLSamplerState> mtlSamplerState = ((MtlSampler*)sampler.get())->mtlSamplerState();
+ id<MTLTexture> mtlTexture = ((const MtlTexture*)texture)->mtlTexture();
+ id<MTLSamplerState> mtlSamplerState = ((const MtlSampler*)sampler)->mtlSamplerState();
fActiveRenderCommandEncoder->setFragmentTexture(mtlTexture, bindIndex);
fActiveRenderCommandEncoder->setFragmentSamplerState(mtlSamplerState, bindIndex);
}
-void MtlCommandBuffer::onSetScissor(unsigned int left, unsigned int top,
- unsigned int width, unsigned int height) {
+void MtlCommandBuffer::setScissor(unsigned int left, unsigned int top,
+ unsigned int width, unsigned int height) {
SkASSERT(fActiveRenderCommandEncoder);
MTLScissorRect scissorRect = { left, top, width, height };
fActiveRenderCommandEncoder->setScissorRect(scissorRect);
}
-void MtlCommandBuffer::onSetViewport(float x, float y, float width, float height,
- float minDepth, float maxDepth) {
+void MtlCommandBuffer::setViewport(float x, float y, float width, float height,
+ float minDepth, float maxDepth) {
SkASSERT(fActiveRenderCommandEncoder);
MTLViewport viewport = { x, y, width, height, minDepth, maxDepth };
fActiveRenderCommandEncoder->setViewport(viewport);
@@ -308,10 +439,10 @@ void MtlCommandBuffer::onSetViewport(float x, float y, float width, float height
MtlGraphicsPipeline::kIntrinsicUniformBufferIndex);
}
-void MtlCommandBuffer::onSetBlendConstants(std::array<float, 4> blendConstants) {
+void MtlCommandBuffer::setBlendConstants(float* blendConstants) {
SkASSERT(fActiveRenderCommandEncoder);
- fActiveRenderCommandEncoder->setBlendColor(blendConstants.data());
+ fActiveRenderCommandEncoder->setBlendColor(blendConstants);
}
static MTLPrimitiveType graphite_to_mtl_primitive(PrimitiveType primitiveType) {
@@ -328,9 +459,9 @@ static MTLPrimitiveType graphite_to_mtl_primitive(PrimitiveType primitiveType) {
return mtlPrimitiveType[static_cast<int>(primitiveType)];
}
-void MtlCommandBuffer::onDraw(PrimitiveType type,
- unsigned int baseVertex,
- unsigned int vertexCount) {
+void MtlCommandBuffer::draw(PrimitiveType type,
+ unsigned int baseVertex,
+ unsigned int vertexCount) {
SkASSERT(fActiveRenderCommandEncoder);
auto mtlPrimitiveType = graphite_to_mtl_primitive(type);
@@ -338,8 +469,8 @@ void MtlCommandBuffer::onDraw(PrimitiveType type,
fActiveRenderCommandEncoder->drawPrimitives(mtlPrimitiveType, baseVertex, vertexCount);
}
-void MtlCommandBuffer::onDrawIndexed(PrimitiveType type, unsigned int baseIndex,
- unsigned int indexCount, unsigned int baseVertex) {
+void MtlCommandBuffer::drawIndexed(PrimitiveType type, unsigned int baseIndex,
+ unsigned int indexCount, unsigned int baseVertex) {
SkASSERT(fActiveRenderCommandEncoder);
if (@available(macOS 10.11, iOS 9.0, *)) {
@@ -357,9 +488,9 @@ void MtlCommandBuffer::onDrawIndexed(PrimitiveType type, unsigned int baseIndex,
}
}
-void MtlCommandBuffer::onDrawInstanced(PrimitiveType type, unsigned int baseVertex,
- unsigned int vertexCount, unsigned int baseInstance,
- unsigned int instanceCount) {
+void MtlCommandBuffer::drawInstanced(PrimitiveType type, unsigned int baseVertex,
+ unsigned int vertexCount, unsigned int baseInstance,
+ unsigned int instanceCount) {
SkASSERT(fActiveRenderCommandEncoder);
auto mtlPrimitiveType = graphite_to_mtl_primitive(type);
@@ -369,12 +500,12 @@ void MtlCommandBuffer::onDrawInstanced(PrimitiveType type, unsigned int baseVert
instanceCount, baseInstance);
}
-void MtlCommandBuffer::onDrawIndexedInstanced(PrimitiveType type,
- unsigned int baseIndex,
- unsigned int indexCount,
- unsigned int baseVertex,
- unsigned int baseInstance,
- unsigned int instanceCount) {
+void MtlCommandBuffer::drawIndexedInstanced(PrimitiveType type,
+ unsigned int baseIndex,
+ unsigned int indexCount,
+ unsigned int baseVertex,
+ unsigned int baseInstance,
+ unsigned int instanceCount) {
SkASSERT(fActiveRenderCommandEncoder);
if (@available(macOS 10.11, iOS 9.0, *)) {
@@ -390,6 +521,40 @@ void MtlCommandBuffer::onDrawIndexedInstanced(PrimitiveType type,
}
}
+void MtlCommandBuffer::beginComputePass() {
+ SkASSERT(!fActiveRenderCommandEncoder);
+ SkASSERT(!fActiveComputeCommandEncoder);
+ this->endBlitCommandEncoder();
+ fActiveComputeCommandEncoder = MtlComputeCommandEncoder::Make(fSharedContext,
+ fCommandBuffer.get());
+}
+
+void MtlCommandBuffer::bindComputePipeline(const ComputePipeline* computePipeline) {
+ SkASSERT(fActiveComputeCommandEncoder);
+
+ auto mtlPipeline = static_cast<const MtlComputePipeline*>(computePipeline);
+ fActiveComputeCommandEncoder->setComputePipelineState(mtlPipeline->mtlPipelineState());
+}
+
+void MtlCommandBuffer::bindBuffer(const Buffer* buffer, unsigned int offset, unsigned int index) {
+ SkASSERT(fActiveComputeCommandEncoder);
+
+ id<MTLBuffer> mtlBuffer = buffer ? static_cast<const MtlBuffer*>(buffer)->mtlBuffer() : nullptr;
+ fActiveComputeCommandEncoder->setBuffer(mtlBuffer, offset, index);
+}
+
+void MtlCommandBuffer::dispatchThreadgroups(const WorkgroupSize& globalSize,
+ const WorkgroupSize& localSize) {
+ SkASSERT(fActiveComputeCommandEncoder);
+ fActiveComputeCommandEncoder->dispatchThreadgroups(globalSize, localSize);
+}
+
+void MtlCommandBuffer::endComputePass() {
+ SkASSERT(fActiveComputeCommandEncoder);
+ fActiveComputeCommandEncoder->endEncoding();
+ fActiveComputeCommandEncoder.reset();
+}
+
static bool check_max_blit_width(int widthInPixels) {
if (widthInPixels > 32767) {
SkASSERT(false); // surfaces should not be this wide anyway
@@ -404,6 +569,7 @@ bool MtlCommandBuffer::onCopyTextureToBuffer(const Texture* texture,
size_t bufferOffset,
size_t bufferRowBytes) {
SkASSERT(!fActiveRenderCommandEncoder);
+ SkASSERT(!fActiveComputeCommandEncoder);
if (!check_max_blit_width(srcRect.width())) {
return false;
@@ -422,7 +588,7 @@ bool MtlCommandBuffer::onCopyTextureToBuffer(const Texture* texture,
#endif
blitCmdEncoder->copyFromTexture(mtlTexture, srcRect, mtlBuffer, bufferOffset, bufferRowBytes);
- if (fGpu->mtlCaps().isMac()) {
+ if (fSharedContext->mtlCaps().isMac()) {
#ifdef SK_BUILD_FOR_MAC
// Sync GPU data back to the CPU
blitCmdEncoder->synchronizeResource(mtlBuffer);
@@ -439,6 +605,7 @@ bool MtlCommandBuffer::onCopyBufferToTexture(const Buffer* buffer,
const BufferTextureCopyData* copyData,
int count) {
SkASSERT(!fActiveRenderCommandEncoder);
+ SkASSERT(!fActiveComputeCommandEncoder);
id<MTLBuffer> mtlBuffer = static_cast<const MtlBuffer*>(buffer)->mtlBuffer();
id<MTLTexture> mtlTexture = static_cast<const MtlTexture*>(texture)->mtlTexture();
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlComputeCommandEncoder.h b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlComputeCommandEncoder.h
new file mode 100644
index 00000000000..74757844bc4
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlComputeCommandEncoder.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2022 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef skgpu_graphite_MtlComputeCommandEncoder_DEFINED
+#define skgpu_graphite_MtlComputeCommandEncoder_DEFINED
+
+#include "include/core/SkRefCnt.h"
+#include "include/ports/SkCFObject.h"
+#include "src/gpu/graphite/ComputeTypes.h"
+#include "src/gpu/graphite/Resource.h"
+
+#import <Metal/Metal.h>
+
+namespace skgpu::graphite {
+
+/**
+ * Wraps a MTLComputeCommandEncoder object and associated tracked state
+ */
+class MtlComputeCommandEncoder : public Resource {
+public:
+ static sk_sp<MtlComputeCommandEncoder> Make(const SharedContext* sharedContext,
+ id<MTLCommandBuffer> commandBuffer) {
+ // Adding a retain here to keep our own ref separate from the autorelease pool
+ sk_cfp<id<MTLComputeCommandEncoder>> encoder =
+ sk_ret_cfp([commandBuffer computeCommandEncoder]);
+
+ // TODO(armansito): Support concurrent dispatch of compute passes using
+ // MTLDispatchTypeConcurrent on macOS 10.14+ and iOS 12.0+.
+ return sk_sp<MtlComputeCommandEncoder>(
+ new MtlComputeCommandEncoder(sharedContext, std::move(encoder)));
+ }
+
+ void setLabel(NSString* label) { [(*fCommandEncoder) setLabel:label]; }
+
+ void pushDebugGroup(NSString* string) { [(*fCommandEncoder) pushDebugGroup:string]; }
+ void popDebugGroup() { [(*fCommandEncoder) popDebugGroup]; }
+ void insertDebugSignpost(NSString* string) { [(*fCommandEncoder) insertDebugSignpost:string]; }
+
+ void setComputePipelineState(id<MTLComputePipelineState> pso) {
+ if (fCurrentComputePipelineState != pso) {
+ [(*fCommandEncoder) setComputePipelineState:pso];
+ fCurrentComputePipelineState = pso;
+ }
+ }
+
+ void setBuffer(id<MTLBuffer> buffer, NSUInteger offset, NSUInteger index) {
+ SkASSERT(buffer != nil);
+ // TODO(skia:13580): As with the setVertexBufferOffset:atIndex: and
+ // setFragmentBufferOffset:atIndex: methods of MTLRenderCommandEncoder,
+ // Apple recommends using setBufferOffset:atIndex: to avoid rebinding a buffer when only
+ // updating its offset. Consider tracking buffers/offsets by index and limiting calls to
+ // setBuffer:offset:atIndex.
+ [(*fCommandEncoder) setBuffer:buffer offset:offset atIndex:index];
+ }
+
+ void setTexture(id<MTLTexture> texture, NSUInteger index) {
+ SkASSERT(texture != nil);
+ [(*fCommandEncoder) setTexture:texture atIndex:index];
+ }
+
+ void setSamplerState(id<MTLSamplerState> sampler, NSUInteger index) {
+ SkASSERT(sampler != nil);
+ [(*fCommandEncoder) setSamplerState:sampler atIndex:index];
+ }
+
+ void dispatchThreadgroups(const WorkgroupSize& globalSize, const WorkgroupSize& localSize) {
+ MTLSize threadgroupCount =
+ MTLSizeMake(globalSize.fWidth, globalSize.fHeight, globalSize.fDepth);
+ MTLSize threadsPerThreadgroup =
+ MTLSizeMake(localSize.fWidth, localSize.fHeight, localSize.fDepth);
+ [(*fCommandEncoder) dispatchThreadgroups:threadgroupCount
+ threadsPerThreadgroup:threadsPerThreadgroup];
+ }
+
+ void endEncoding() { [(*fCommandEncoder) endEncoding]; }
+
+private:
+ MtlComputeCommandEncoder(const SharedContext* sharedContext,
+ sk_cfp<id<MTLComputeCommandEncoder>> encoder)
+ : Resource(sharedContext, Ownership::kOwned, SkBudgeted::kYes)
+ , fCommandEncoder(std::move(encoder)) {}
+
+ void freeGpuData() override { fCommandEncoder.reset(); }
+
+ sk_cfp<id<MTLComputeCommandEncoder>> fCommandEncoder;
+
+ id<MTLComputePipelineState> fCurrentComputePipelineState = nil;
+
+ // TODO(skia:13580): Keep track of texture/sampler and buffer resources?
+};
+
+} // namespace skgpu::graphite
+
+#endif // skgpu_graphite_MtlComputeCommandEncoder_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlComputePipeline.h b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlComputePipeline.h
new file mode 100644
index 00000000000..71aa2da968b
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlComputePipeline.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef skgpu_graphite_MtlComputePipeline_DEFINED
+#define skgpu_graphite_MtlComputePipeline_DEFINED
+
+#include "include/core/SkRefCnt.h"
+#include "include/ports/SkCFObject.h"
+#include "src/gpu/graphite/ComputePipeline.h"
+
+#import <Metal/Metal.h>
+
+namespace skgpu::graphite {
+
+class ComputePipelineDesc;
+class ResourceProvider;
+class MtlSharedContext;
+
+class MtlComputePipeline final : public ComputePipeline {
+public:
+ static sk_sp<MtlComputePipeline> Make(ResourceProvider*,
+ const MtlSharedContext*,
+ const ComputePipelineDesc&);
+ ~MtlComputePipeline() override = default;
+
+ id<MTLComputePipelineState> mtlPipelineState() const { return fPipelineState.get(); }
+
+private:
+ MtlComputePipeline(const SharedContext* sharedContext, sk_cfp<id<MTLComputePipelineState>> pso)
+ : ComputePipeline(sharedContext)
+ , fPipelineState(std::move(pso)) {}
+
+ void freeGpuData() override;
+
+ sk_cfp<id<MTLComputePipelineState>> fPipelineState;
+};
+
+} // namespace skgpu::graphite
+
+#endif // skgpu_graphite_MtlComputePipeline_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlComputePipeline.mm b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlComputePipeline.mm
new file mode 100644
index 00000000000..395f78e0bce
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlComputePipeline.mm
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "src/gpu/graphite/mtl/MtlComputePipeline.h"
+
+#include "include/gpu/ShaderErrorHandler.h"
+#include "src/gpu/graphite/ComputePipelineDesc.h"
+#include "src/gpu/graphite/Log.h"
+#include "src/gpu/graphite/ResourceProvider.h"
+#include "src/gpu/graphite/mtl/MtlSharedContext.h"
+#include "src/gpu/graphite/mtl/MtlUtils.h"
+
+namespace skgpu::graphite {
+
+// static
+sk_sp<MtlComputePipeline> MtlComputePipeline::Make(ResourceProvider* resourceProvider,
+ const MtlSharedContext* sharedContext,
+ const ComputePipelineDesc& pipelineDesc) {
+ sk_cfp<MTLComputePipelineDescriptor*> psoDescriptor([MTLComputePipelineDescriptor new]);
+
+ std::string msl;
+ SkSL::Program::Inputs inputs;
+ SkSL::ProgramSettings settings;
+
+ auto skslCompiler = resourceProvider->skslCompiler();
+ ShaderErrorHandler* errorHandler = sharedContext->caps()->shaderErrorHandler();
+ if (!SkSLToMSL(skslCompiler,
+ pipelineDesc.sksl(),
+ SkSL::ProgramKind::kCompute,
+ settings,
+ &msl,
+ &inputs,
+ errorHandler)) {
+ return nullptr;
+ }
+
+ sk_cfp<id<MTLLibrary>> shaderLibrary = MtlCompileShaderLibrary(sharedContext,
+ msl,
+ errorHandler);
+ if (!shaderLibrary) {
+ return nullptr;
+ }
+
+ (*psoDescriptor).label = @(pipelineDesc.name().c_str());
+ (*psoDescriptor).computeFunction = [shaderLibrary.get() newFunctionWithName:@"computeMain"];
+
+ // TODO(b/240604614): Populate input data attribute and buffer layout descriptors using the
+ // `stageInputDescriptor` property based on the contents of `pipelineDesc` (on iOS 10+ or
+ // macOS 10.12+).
+
+ // TODO(b/240604614): Define input buffer mutability using the `buffers` property based on
+ // the contents of `pipelineDesc` (on iOS 11+ or macOS 10.13+).
+
+ // TODO(b/240615224): Metal docs claim that setting the
+ // `threadGroupSizeIsMultipleOfThreadExecutionWidth` to YES may improve performance, IF we can
+ // guarantee that the thread group size used in a dispatch command is a multiple of
+ // `threadExecutionWidth` property of the pipeline state object (otherwise this will cause UB).
+
+ NSError* error;
+ sk_cfp<id<MTLComputePipelineState>> pso([sharedContext->device()
+ newComputePipelineStateWithDescriptor:psoDescriptor.get()
+ options:MTLPipelineOptionNone
+ reflection:NULL
+ error:&error]);
+ if (!pso) {
+ SKGPU_LOG_E("Compute pipeline creation failure:\n%s", error.debugDescription.UTF8String);
+ return nullptr;
+ }
+
+ return sk_sp<MtlComputePipeline>(new MtlComputePipeline(sharedContext, std::move(pso)));
+}
+
+void MtlComputePipeline::freeGpuData() { fPipelineState.reset(); }
+
+} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlGpu.h b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlGpu.h
deleted file mode 100644
index a3b2b7fcc6d..00000000000
--- a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlGpu.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2021 Google LLC
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef skgpu_graphite_MtlGpu_DEFINED
-#define skgpu_graphite_MtlGpu_DEFINED
-
-#include "src/gpu/graphite/Gpu.h"
-
-#include "include/ports/SkCFObject.h"
-
-#include "include/gpu/graphite/mtl/MtlBackendContext.h"
-#include "src/gpu/graphite/mtl/MtlCaps.h"
-
-#import <Metal/Metal.h>
-
-namespace skgpu::graphite {
-
-class MtlGpu final : public Gpu {
-public:
- static sk_sp<Gpu> Make(const MtlBackendContext&);
- ~MtlGpu() override;
-
- id<MTLDevice> device() const { return fDevice.get(); }
- id<MTLCommandQueue> queue() const { return fQueue.get(); }
-
- const MtlCaps& mtlCaps() const { return static_cast<const MtlCaps&>(*this->caps()); }
-
- std::unique_ptr<ResourceProvider> makeResourceProvider(
- sk_sp<GlobalCache>, SingleOwner*) const override;
-
-private:
- MtlGpu(sk_cfp<id<MTLDevice>>, sk_cfp<id<MTLCommandQueue>>, sk_sp<const MtlCaps>);
-
- Gpu::OutstandingSubmission onSubmit(sk_sp<CommandBuffer>) override;
-
- BackendTexture onCreateBackendTexture(SkISize dimensions, const TextureInfo&) override;
- void onDeleteBackendTexture(BackendTexture&) override;
-
-#if GRAPHITE_TEST_UTILS
- void testingOnly_startCapture() override;
- void testingOnly_endCapture() override;
-#endif
-
- sk_cfp<id<MTLDevice>> fDevice;
- sk_cfp<id<MTLCommandQueue>> fQueue;
-};
-
-} // namespace skgpu::graphite
-
-#endif // skgpu_graphite_MtlGpu_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlGpu.mm b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlGpu.mm
deleted file mode 100644
index b10e9692d57..00000000000
--- a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlGpu.mm
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright 2021 Google LLC
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "src/gpu/graphite/mtl/MtlGpu.h"
-
-#include "include/gpu/graphite/BackendTexture.h"
-#include "include/gpu/graphite/TextureInfo.h"
-#include "src/gpu/graphite/Caps.h"
-#include "src/gpu/graphite/GlobalCache.h"
-#include "src/gpu/graphite/Log.h"
-#include "src/gpu/graphite/mtl/MtlCommandBuffer.h"
-#include "src/gpu/graphite/mtl/MtlResourceProvider.h"
-#include "src/gpu/graphite/mtl/MtlTexture.h"
-
-namespace skgpu::graphite {
-
-sk_sp<skgpu::graphite::Gpu> MtlGpu::Make(const MtlBackendContext& context) {
- // TODO: This was taken from GrMtlGpu.mm's Make, does graphite deserve a higher version?
- if (@available(macOS 10.14, iOS 11.0, *)) {
- // no warning needed
- } else {
- SKGPU_LOG_E("Skia's Graphite backend no longer supports this OS version.");
-#ifdef SK_BUILD_FOR_IOS
- SKGPU_LOG_E("Minimum supported version is iOS 11.0.");
-#else
- SKGPU_LOG_E("Minimum supported version is MacOS 10.14.");
-#endif
- return nullptr;
- }
-
- sk_cfp<id<MTLDevice>> device = sk_ret_cfp((id<MTLDevice>)(context.fDevice.get()));
- sk_cfp<id<MTLCommandQueue>> queue = sk_ret_cfp((id<MTLCommandQueue>)(context.fQueue.get()));
-
- sk_sp<const MtlCaps> caps(new MtlCaps(device.get()));
-
- return sk_sp<skgpu::graphite::Gpu>(new MtlGpu(std::move(device), std::move(queue), std::move(caps)));
-}
-
-MtlGpu::MtlGpu(sk_cfp<id<MTLDevice>> device,
- sk_cfp<id<MTLCommandQueue>> queue,
- sk_sp<const MtlCaps> caps)
- : skgpu::graphite::Gpu(std::move(caps))
- , fDevice(std::move(device))
- , fQueue(std::move(queue)) {
- this->initCompiler();
-}
-
-MtlGpu::~MtlGpu() {
-}
-
-std::unique_ptr<ResourceProvider> MtlGpu::makeResourceProvider(
- sk_sp<GlobalCache> globalCache, SingleOwner* singleOwner) const {
- return std::unique_ptr<ResourceProvider>(new MtlResourceProvider(this,
- std::move(globalCache),
- singleOwner));
-}
-
-class WorkSubmission final : public GpuWorkSubmission {
-public:
- WorkSubmission(sk_sp<CommandBuffer> cmdBuffer)
- : GpuWorkSubmission(std::move(cmdBuffer)) {}
- ~WorkSubmission() override {}
-
- bool isFinished() override {
- return static_cast<MtlCommandBuffer*>(this->commandBuffer())->isFinished();
- }
- void waitUntilFinished(const Gpu*) override {
- return static_cast<MtlCommandBuffer*>(this->commandBuffer())->waitUntilFinished();
- }
-};
-
-skgpu::graphite::Gpu::OutstandingSubmission MtlGpu::onSubmit(sk_sp<CommandBuffer> commandBuffer) {
- SkASSERT(commandBuffer);
- MtlCommandBuffer* mtlCmdBuffer = static_cast<MtlCommandBuffer*>(commandBuffer.get());
- if (!mtlCmdBuffer->commit()) {
- commandBuffer->callFinishedProcs(/*success=*/false);
- return nullptr;
- }
-
- std::unique_ptr<GpuWorkSubmission> submission(new WorkSubmission(std::move(commandBuffer)));
- return submission;
-}
-
-BackendTexture MtlGpu::onCreateBackendTexture(SkISize dimensions, const TextureInfo& info) {
- sk_cfp<id<MTLTexture>> texture = MtlTexture::MakeMtlTexture(this, dimensions, info);
- if (!texture) {
- return {};
- }
- return BackendTexture(dimensions, (Handle)texture.release());
-}
-
-void MtlGpu::onDeleteBackendTexture(BackendTexture& texture) {
- SkASSERT(texture.backend() == BackendApi::kMetal);
- MtlHandle texHandle = texture.getMtlTexture();
- SkCFSafeRelease(texHandle);
-}
-
-#if GRAPHITE_TEST_UTILS
-void MtlGpu::testingOnly_startCapture() {
- if (@available(macOS 10.13, iOS 11.0, *)) {
- // TODO: add newer Metal interface as well
- MTLCaptureManager* captureManager = [MTLCaptureManager sharedCaptureManager];
- if (captureManager.isCapturing) {
- return;
- }
- if (@available(macOS 10.15, iOS 13.0, *)) {
- MTLCaptureDescriptor* captureDescriptor = [[MTLCaptureDescriptor alloc] init];
- captureDescriptor.captureObject = fQueue.get();
-
- NSError *error;
- if (![captureManager startCaptureWithDescriptor: captureDescriptor error:&error])
- {
- NSLog(@"Failed to start capture, error %@", error);
- }
- } else {
- [captureManager startCaptureWithCommandQueue: fQueue.get()];
- }
- }
-}
-
-void MtlGpu::testingOnly_endCapture() {
- if (@available(macOS 10.13, iOS 11.0, *)) {
- MTLCaptureManager* captureManager = [MTLCaptureManager sharedCaptureManager];
- if (captureManager.isCapturing) {
- [captureManager stopCapture];
- }
- }
-}
-#endif
-
-} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlGraphicsPipeline.h b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlGraphicsPipeline.h
index b14ea2f94e1..69d71fff6d4 100644
--- a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlGraphicsPipeline.h
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlGraphicsPipeline.h
@@ -20,8 +20,8 @@ class SkShaderCodeDictionary;
namespace skgpu::graphite {
class Context;
class GraphicsPipelineDesc;
-class MtlGpu;
class MtlResourceProvider;
+class MtlSharedContext;
struct RenderPassDesc;
class MtlGraphicsPipeline final : public GraphicsPipeline {
@@ -33,7 +33,7 @@ public:
inline static constexpr unsigned int kInstanceBufferIndex = 4;
static sk_sp<MtlGraphicsPipeline> Make(MtlResourceProvider*,
- const MtlGpu*,
+ const MtlSharedContext*,
const GraphicsPipelineDesc&,
const RenderPassDesc&);
~MtlGraphicsPipeline() override {}
@@ -45,13 +45,13 @@ public:
size_t instanceStride() const { return fInstanceStride; }
private:
- MtlGraphicsPipeline(const skgpu::graphite::Gpu* gpu,
+ MtlGraphicsPipeline(const skgpu::graphite::SharedContext* sharedContext,
sk_cfp<id<MTLRenderPipelineState>> pso,
sk_cfp<id<MTLDepthStencilState>> dss,
uint32_t refValue,
size_t vertexStride,
size_t instanceStride)
- : GraphicsPipeline(gpu)
+ : GraphicsPipeline(sharedContext)
, fPipelineState(std::move(pso))
, fDepthStencilState(dss)
, fStencilReferenceValue(refValue)
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlGraphicsPipeline.mm b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlGraphicsPipeline.mm
index 6378f8692ce..5af1418561a 100644
--- a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlGraphicsPipeline.mm
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlGraphicsPipeline.mm
@@ -10,14 +10,15 @@
#include "include/core/SkSpan.h"
#include "include/gpu/ShaderErrorHandler.h"
#include "include/gpu/graphite/TextureInfo.h"
-#include "include/private/SkSLString.h"
#include "src/core/SkPipelineData.h"
-#include "src/core/SkShaderCodeDictionary.h"
+#include "src/core/SkSLTypeShared.h"
+#include "src/gpu/graphite/ContextUtils.h"
#include "src/gpu/graphite/GraphicsPipelineDesc.h"
#include "src/gpu/graphite/Log.h"
#include "src/gpu/graphite/Renderer.h"
-#include "src/gpu/graphite/mtl/MtlGpu.h"
+#include "src/gpu/graphite/UniformManager.h"
#include "src/gpu/graphite/mtl/MtlResourceProvider.h"
+#include "src/gpu/graphite/mtl/MtlSharedContext.h"
#include "src/gpu/graphite/mtl/MtlUtils.h"
#include "src/gpu/tessellate/WangsFormula.h"
@@ -26,180 +27,6 @@ namespace skgpu::graphite {
namespace {
-std::string get_uniform_header(int bufferID, const char* name) {
- std::string result;
-
- SkSL::String::appendf(&result, "layout (binding=%d) uniform %sUniforms {\n", bufferID, name);
-
- return result;
-}
-
-std::string get_uniforms(SkSpan<const SkUniform> uniforms, int* offset, int manglingSuffix) {
- std::string result;
-
- for (auto u : uniforms) {
- int count = u.count() ? u.count() : 1;
- // TODO: this is sufficient for the sprint but should be changed to use SkSL's
- // machinery
- SkSL::String::appendf(&result, " layout(offset=%d) ", *offset);
- switch (u.type()) {
- case SkSLType::kFloat4:
- result.append("float4");
- *offset += 16 * count;
- break;
- case SkSLType::kFloat2:
- result.append("float2");
- *offset += 8 * count;
- break;
- case SkSLType::kFloat:
- result.append("float");
- *offset += 4 * count;
- break;
- case SkSLType::kFloat4x4:
- result.append("float4x4");
- *offset += 64 * count;
- break;
- case SkSLType::kHalf4:
- result.append("half4");
- *offset += 8 * count;
- break;
- case SkSLType::kInt:
- result.append("int");
- *offset += 4 * count;
- break;
- default:
- SkASSERT(0);
- }
-
- result.append(" ");
- result.append(u.name());
- if (manglingSuffix >= 0) {
- result.append("_");
- result.append(std::to_string(manglingSuffix));
- }
- if (u.count()) {
- result.append("[");
- result.append(std::to_string(u.count()));
- result.append("]");
- }
- result.append(";\n");
- }
-
- return result;
-}
-
-std::string emit_SKSL_uniforms(int bufferID, const char* name, SkSpan<const SkUniform> uniforms) {
- int offset = 0;
-
- std::string result = get_uniform_header(bufferID, name);
- result += get_uniforms(uniforms, &offset, -1);
- result.append("};\n\n");
-
- return result;
-}
-
-std::string emit_SkSL_attributes(SkSpan<const Attribute> vertexAttrs,
- SkSpan<const Attribute> instanceAttrs) {
- std::string result;
-
- int attr = 0;
- auto add_attrs = [&](SkSpan<const Attribute> attrs) {
- for (auto a : attrs) {
- // TODO: this is sufficient for the sprint but should be changed to use SkSL's
- // machinery
- SkSL::String::appendf(&result, " layout(location=%d) in ", attr++);
- switch (a.gpuType()) {
- case SkSLType::kFloat4:
- result.append("float4");
- break;
- case SkSLType::kFloat2:
- result.append("float2");
- break;
- case SkSLType::kFloat3:
- result.append("float3");
- break;
- case SkSLType::kFloat:
- result.append("float");
- break;
- case SkSLType::kHalf4:
- result.append("half4");
- break;
- default:
- SkASSERT(0);
- }
-
- SkSL::String::appendf(&result, " %s;\n", a.name());
- }
- };
-
- if (!vertexAttrs.empty()) {
- result.append("// vertex attrs\n");
- add_attrs(vertexAttrs);
- }
- if (!instanceAttrs.empty()) {
- result.append("// instance attrs\n");
- add_attrs(instanceAttrs);
- }
-
- return result;
-}
-
-std::string get_sksl_vs(const GraphicsPipelineDesc& desc) {
- const RenderStep* step = desc.renderStep();
- // TODO: To more completely support end-to-end rendering, this will need to be updated so that
- // the RenderStep shader snippet can produce a device coord, a local coord, and depth.
- // If the paint combination doesn't need the local coord it can be ignored, otherwise we need
- // a varying for it. The fragment function's output will need to be updated to have a color and
- // the depth, or when there's no combination, just the depth. Lastly, we also should add the
- // static/intrinsic uniform binding point so that we can handle normalizing the device position
- // produced by the RenderStep automatically.
-
- // Fixed program header
- std::string sksl =
- "layout (binding=0) uniform intrinsicUniforms {\n"
- " layout(offset=0) float4 rtAdjust;\n"
- "};\n"
- "\n";
-
- if (step->numVertexAttributes() > 0 || step->numInstanceAttributes() > 0) {
- sksl += emit_SkSL_attributes(step->vertexAttributes(), step->instanceAttributes());
- }
-
- // Uniforms needed by RenderStep
- if (step->numUniforms() > 0) {
- sksl += emit_SKSL_uniforms(1, "Step", step->uniforms());
- }
-
- // Vertex shader function declaration
- sksl += "void main() {\n";
- // Vertex shader body
- sksl += step->vertexSkSL();
- sksl += "sk_Position = float4(devPosition.xy * rtAdjust.xy + rtAdjust.zw, devPosition.zw);\n"
- "}\n";
-
- return sksl;
-}
-
-std::string get_sksl_fs(SkShaderCodeDictionary* dict,
- const GraphicsPipelineDesc& desc,
- BlendInfo* blendInfo) {
- if (!desc.paintParamsID().isValid()) {
- // TODO: we should return the error shader code here
- return {};
- }
-
- SkShaderInfo shaderInfo;
-
- dict->getShaderInfo(desc.paintParamsID(), &shaderInfo);
-
- *blendInfo = shaderInfo.blendInfo();
-#if SK_SUPPORT_GPU
- return shaderInfo.toSkSL();
-#else
- return {};
-#endif
-}
-
inline MTLVertexFormat attribute_type_to_mtlformat(VertexAttribType type) {
switch (type) {
case VertexAttribType::kFloat:
@@ -395,7 +222,7 @@ static MTLBlendOperation blend_equation_to_mtl_blend_op(skgpu::BlendEquation equ
MTLBlendOperationSubtract, // skgpu::BlendEquation::kSubtract
MTLBlendOperationReverseSubtract, // skgpu::BlendEquation::kReverseSubtract
};
- static_assert(SK_ARRAY_COUNT(gTable) == (int)skgpu::BlendEquation::kFirstAdvanced);
+ static_assert(std::size(gTable) == (int)skgpu::BlendEquation::kFirstAdvanced);
static_assert(0 == (int)skgpu::BlendEquation::kAdd);
static_assert(1 == (int)skgpu::BlendEquation::kSubtract);
static_assert(2 == (int)skgpu::BlendEquation::kReverseSubtract);
@@ -437,58 +264,6 @@ static MTLRenderPipelineColorAttachmentDescriptor* create_color_attachment(
} // anonymous namespace
-std::string GetMtlUniforms(int bufferID,
- const char* name,
- const std::vector<SkPaintParamsKey::BlockReader>& readers,
- bool needsLocalCoords) {
- size_t numUniforms = 0;
- for (auto r : readers) {
- numUniforms += r.entry()->fUniforms.size();
- }
-
- if (!numUniforms) {
- return {};
- }
-
- int offset = 0;
-
- std::string result = get_uniform_header(bufferID, name);
- for (int i = 0; i < (int) readers.size(); ++i) {
- SkSL::String::appendf(&result,
- "// %s\n",
- readers[i].entry()->fName);
- result += get_uniforms(readers[i].entry()->fUniforms, &offset, i);
- }
- if (needsLocalCoords) {
- static constexpr SkUniform kDev2LocalUniform[] = {{ "dev2LocalUni", SkSLType::kFloat4x4 }};
- result += "// NeedsLocalCoords\n";
- result += get_uniforms(SkSpan<const SkUniform>(kDev2LocalUniform, 1), &offset, -1);
- }
- result.append("};\n\n");
-
- return result;
-}
-
-std::string GetMtlTexturesAndSamplers(const std::vector<SkPaintParamsKey::BlockReader>& readers,
- int* binding) {
-
- std::string result;
- for (int i = 0; i < (int) readers.size(); ++i) {
- auto texturesAndSamplers = readers[i].entry()->fTexturesAndSamplers;
-
- for (int j = 0; j < (int) texturesAndSamplers.size(); ++j) {
- const SkTextureAndSampler& t = texturesAndSamplers[j];
- SkSL::String::appendf(&result,
- "layout(binding=%d) uniform sampler2D %s_%d_%d;\n",
- *binding, t.name(), i, j);
- (*binding)++;
- }
- }
-
- return result;
-}
-
-
enum ShaderType {
kVertex_ShaderType = 0,
kFragment_ShaderType = 1,
@@ -498,32 +273,26 @@ enum ShaderType {
static const int kShaderTypeCount = kLast_ShaderType + 1;
sk_sp<MtlGraphicsPipeline> MtlGraphicsPipeline::Make(
- MtlResourceProvider* resourceProvider, const MtlGpu* gpu,
+ MtlResourceProvider* resourceProvider, const MtlSharedContext* sharedContext,
const GraphicsPipelineDesc& pipelineDesc,
const RenderPassDesc& renderPassDesc) {
sk_cfp<MTLRenderPipelineDescriptor*> psoDescriptor([[MTLRenderPipelineDescriptor alloc] init]);
std::string msl[kShaderTypeCount];
SkSL::Program::Inputs inputs[kShaderTypeCount];
- SkSL::Program::Settings settings;
+ SkSL::ProgramSettings settings;
settings.fForceNoRTFlip = true;
- ShaderErrorHandler* errorHandler = DefaultShaderErrorHandler();
- if (!SkSLToMSL(gpu,
- get_sksl_vs(pipelineDesc),
- SkSL::ProgramKind::kGraphiteVertex,
- settings,
- &msl[kVertex_ShaderType],
- &inputs[kVertex_ShaderType],
- errorHandler)) {
- return nullptr;
- }
+ auto skslCompiler = resourceProvider->skslCompiler();
+ ShaderErrorHandler* errorHandler = sharedContext->caps()->shaderErrorHandler();
BlendInfo blendInfo;
+ bool localCoordsNeeded = false;
auto dict = resourceProvider->shaderCodeDictionary();
- if (!SkSLToMSL(gpu,
- get_sksl_fs(dict, pipelineDesc, &blendInfo),
+ if (!SkSLToMSL(skslCompiler,
+ GetSkSLFS(dict, resourceProvider->runtimeEffectDictionary(),
+ pipelineDesc, &blendInfo, &localCoordsNeeded),
SkSL::ProgramKind::kGraphiteFragment,
settings,
&msl[kFragment_ShaderType],
@@ -532,12 +301,22 @@ sk_sp<MtlGraphicsPipeline> MtlGraphicsPipeline::Make(
return nullptr;
}
+ if (!SkSLToMSL(skslCompiler,
+ GetSkSLVS(pipelineDesc, localCoordsNeeded),
+ SkSL::ProgramKind::kGraphiteVertex,
+ settings,
+ &msl[kVertex_ShaderType],
+ &inputs[kVertex_ShaderType],
+ errorHandler)) {
+ return nullptr;
+ }
+
sk_cfp<id<MTLLibrary>> shaderLibraries[kShaderTypeCount];
- shaderLibraries[kVertex_ShaderType] = MtlCompileShaderLibrary(gpu,
+ shaderLibraries[kVertex_ShaderType] = MtlCompileShaderLibrary(sharedContext,
msl[kVertex_ShaderType],
errorHandler);
- shaderLibraries[kFragment_ShaderType] = MtlCompileShaderLibrary(gpu,
+ shaderLibraries[kFragment_ShaderType] = MtlCompileShaderLibrary(sharedContext,
msl[kFragment_ShaderType],
errorHandler);
if (!shaderLibraries[kVertex_ShaderType] || !shaderLibraries[kFragment_ShaderType]) {
@@ -578,10 +357,10 @@ sk_sp<MtlGraphicsPipeline> MtlGraphicsPipeline::Make(
NSError* error;
sk_cfp<id<MTLRenderPipelineState>> pso(
- [gpu->device() newRenderPipelineStateWithDescriptor:psoDescriptor.get()
- error:&error]);
+ [sharedContext->device() newRenderPipelineStateWithDescriptor:psoDescriptor.get()
+ error:&error]);
if (!pso) {
- SKGPU_LOG_E("Pipeline creation failure:\n%s", error.debugDescription.UTF8String);
+ SKGPU_LOG_E("Render pipeline creation failure:\n%s", error.debugDescription.UTF8String);
return nullptr;
}
@@ -591,7 +370,7 @@ sk_sp<MtlGraphicsPipeline> MtlGraphicsPipeline::Make(
resourceProvider->findOrCreateCompatibleDepthStencilState(depthStencilSettings);
return sk_sp<MtlGraphicsPipeline>(
- new MtlGraphicsPipeline(gpu,
+ new MtlGraphicsPipeline(sharedContext,
std::move(pso),
std::move(dss),
depthStencilSettings.fStencilReferenceValue,
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlQueueManager.h b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlQueueManager.h
new file mode 100644
index 00000000000..3259e36f91b
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlQueueManager.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef skgpu_graphite_MtlQueueManager_DEFINED
+#define skgpu_graphite_MtlQueueManager_DEFINED
+
+#include "include/ports/SkCFObject.h"
+#include "src/gpu/graphite/QueueManager.h"
+
+#import <Metal/Metal.h>
+
+namespace skgpu::graphite {
+
+class MtlSharedContext;
+class SharedContext;
+
+class MtlQueueManager : public QueueManager {
+public:
+ MtlQueueManager(sk_cfp<id<MTLCommandQueue>> queue, const SharedContext*);
+ ~MtlQueueManager() override {}
+
+private:
+ const MtlSharedContext* mtlSharedContext() const;
+
+ sk_sp<CommandBuffer> getNewCommandBuffer() override;
+ OutstandingSubmission onSubmitToGpu() override;
+
+#if GRAPHITE_TEST_UTILS
+ void testingOnly_startCapture() override;
+ void testingOnly_endCapture() override;
+#endif
+
+ sk_cfp<id<MTLCommandQueue>> fQueue;
+};
+
+} // namespace skgpu::graphite
+
+#endif // skgpu_graphite_MtlQueueManager_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlQueueManager.mm b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlQueueManager.mm
new file mode 100644
index 00000000000..d682bd66725
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlQueueManager.mm
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "src/gpu/graphite/mtl/MtlQueueManager.h"
+
+#include "src/gpu/graphite/mtl/MtlCommandBuffer.h"
+#include "src/gpu/graphite/mtl/MtlSharedContext.h"
+
+namespace skgpu::graphite {
+
+MtlQueueManager::MtlQueueManager(sk_cfp<id<MTLCommandQueue>> queue,
+ const SharedContext* sharedContext)
+ : QueueManager(sharedContext)
+ , fQueue(std::move(queue)) {}
+
+const MtlSharedContext* MtlQueueManager::mtlSharedContext() const {
+ return static_cast<const MtlSharedContext*>(fSharedContext);
+}
+
+sk_sp<CommandBuffer> MtlQueueManager::getNewCommandBuffer() {
+ return MtlCommandBuffer::Make(fQueue.get(), this->mtlSharedContext());
+}
+
+class WorkSubmission final : public GpuWorkSubmission {
+public:
+ WorkSubmission(sk_sp<CommandBuffer> cmdBuffer)
+ : GpuWorkSubmission(std::move(cmdBuffer)) {}
+ ~WorkSubmission() override {}
+
+ bool isFinished() override {
+ return static_cast<MtlCommandBuffer*>(this->commandBuffer())->isFinished();
+ }
+ void waitUntilFinished(const SharedContext* context) override {
+ return static_cast<MtlCommandBuffer*>(this->commandBuffer())->waitUntilFinished(context);
+ }
+};
+
+QueueManager::OutstandingSubmission MtlQueueManager::onSubmitToGpu() {
+ SkASSERT(fCurrentCommandBuffer);
+ MtlCommandBuffer* mtlCmdBuffer = static_cast<MtlCommandBuffer*>(fCurrentCommandBuffer.get());
+ if (!mtlCmdBuffer->commit()) {
+ fCurrentCommandBuffer->callFinishedProcs(/*success=*/false);
+ return nullptr;
+ }
+
+ std::unique_ptr<GpuWorkSubmission> submission(
+ new WorkSubmission(std::move(fCurrentCommandBuffer)));
+ return submission;
+}
+
+#if GRAPHITE_TEST_UTILS
+void MtlQueueManager::testingOnly_startCapture() {
+ if (@available(macOS 10.13, iOS 11.0, *)) {
+ // TODO: add newer Metal interface as well
+ MTLCaptureManager* captureManager = [MTLCaptureManager sharedCaptureManager];
+ if (captureManager.isCapturing) {
+ return;
+ }
+ if (@available(macOS 10.15, iOS 13.0, *)) {
+ MTLCaptureDescriptor* captureDescriptor = [[MTLCaptureDescriptor alloc] init];
+ captureDescriptor.captureObject = fQueue.get();
+
+ NSError *error;
+ if (![captureManager startCaptureWithDescriptor: captureDescriptor error:&error])
+ {
+ NSLog(@"Failed to start capture, error %@", error);
+ }
+ } else {
+ [captureManager startCaptureWithCommandQueue: fQueue.get()];
+ }
+ }
+}
+
+void MtlQueueManager::testingOnly_endCapture() {
+ if (@available(macOS 10.13, iOS 11.0, *)) {
+ MTLCaptureManager* captureManager = [MTLCaptureManager sharedCaptureManager];
+ if (captureManager.isCapturing) {
+ [captureManager stopCapture];
+ }
+ }
+}
+#endif
+
+} // namespace skgpu::graphite
+
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlRenderCommandEncoder.h b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlRenderCommandEncoder.h
index 0a2fb73f2d6..34747d34ad7 100644
--- a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlRenderCommandEncoder.h
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlRenderCommandEncoder.h
@@ -21,13 +21,14 @@ namespace skgpu::graphite {
*/
class MtlRenderCommandEncoder : public Resource {
public:
- static sk_sp<MtlRenderCommandEncoder> Make(const Gpu* gpu,
+ static sk_sp<MtlRenderCommandEncoder> Make(const SharedContext* sharedContext,
id<MTLCommandBuffer> commandBuffer,
MTLRenderPassDescriptor* descriptor) {
// Adding a retain here to keep our own ref separate from the autorelease pool
sk_cfp<id<MTLRenderCommandEncoder>> encoder =
sk_ret_cfp([commandBuffer renderCommandEncoderWithDescriptor:descriptor]);
- return sk_sp<MtlRenderCommandEncoder>(new MtlRenderCommandEncoder(gpu, std::move(encoder)));
+ return sk_sp<MtlRenderCommandEncoder>(new MtlRenderCommandEncoder(sharedContext,
+ std::move(encoder)));
}
void setLabel(NSString* label) {
@@ -247,8 +248,9 @@ private:
inline static constexpr int kMaxExpectedBuffers = 5;
inline static constexpr int kMaxExpectedTextures = 16;
- MtlRenderCommandEncoder(const Gpu* gpu, sk_cfp<id<MTLRenderCommandEncoder>> encoder)
- : Resource(gpu, Ownership::kOwned, SkBudgeted::kYes)
+ MtlRenderCommandEncoder(const SharedContext* sharedContext,
+ sk_cfp<id<MTLRenderCommandEncoder>> encoder)
+ : Resource(sharedContext, Ownership::kOwned, SkBudgeted::kYes)
, fCommandEncoder(std::move(encoder)) {
for (int i = 0; i < kMaxExpectedBuffers; i++) {
fCurrentVertexBuffer[i] = nil;
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlResourceProvider.h b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlResourceProvider.h
index 4c50f1752b7..e782fe12a62 100644
--- a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlResourceProvider.h
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlResourceProvider.h
@@ -17,11 +17,11 @@
namespace skgpu::graphite {
class CommandBuffer;
-class MtlGpu;
+class MtlSharedContext;
class MtlResourceProvider final : public ResourceProvider {
public:
- MtlResourceProvider(const Gpu* gpu, sk_sp<GlobalCache>, SingleOwner*);
+ MtlResourceProvider(const SharedContext* sharedContext, sk_sp<GlobalCache>, SingleOwner*);
~MtlResourceProvider() override {}
sk_sp<Texture> createWrappedTexture(const BackendTexture&) override;
@@ -31,17 +31,21 @@ public:
const DepthStencilSettings&);
private:
- const MtlGpu* mtlGpu();
+ const MtlSharedContext* mtlSharedContext();
+
+ sk_sp<GraphicsPipeline> createGraphicsPipeline(const GraphicsPipelineDesc&,
+ const RenderPassDesc&) override;
+ sk_sp<ComputePipeline> createComputePipeline(const ComputePipelineDesc&) override;
- sk_sp<CommandBuffer> createCommandBuffer() override;
- sk_sp<GraphicsPipeline> onCreateGraphicsPipeline(const GraphicsPipelineDesc&,
- const RenderPassDesc&) override;
sk_sp<Texture> createTexture(SkISize, const TextureInfo&, SkBudgeted) override;
sk_sp<Buffer> createBuffer(size_t size, BufferType type, PrioritizeGpuReads) override;
sk_sp<Sampler> createSampler(const SkSamplingOptions&,
- SkTileMode xTileMode,
- SkTileMode yTileMode) override;
+ SkTileMode xTileMode,
+ SkTileMode yTileMode) override;
+
+ BackendTexture onCreateBackendTexture(SkISize dimensions, const TextureInfo&) override;
+ void onDeleteBackendTexture(BackendTexture&) override;
SkTHashMap<DepthStencilSettings, sk_cfp<id<MTLDepthStencilState>>> fDepthStencilStates;
};
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlResourceProvider.mm b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlResourceProvider.mm
index 572fbc3609d..b7ab84eb2b6 100644
--- a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlResourceProvider.mm
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlResourceProvider.mm
@@ -12,42 +12,44 @@
#include "src/gpu/graphite/GraphicsPipelineDesc.h"
#include "src/gpu/graphite/mtl/MtlBuffer.h"
#include "src/gpu/graphite/mtl/MtlCommandBuffer.h"
-#include "src/gpu/graphite/mtl/MtlGpu.h"
+#include "src/gpu/graphite/mtl/MtlComputePipeline.h"
#include "src/gpu/graphite/mtl/MtlGraphicsPipeline.h"
#include "src/gpu/graphite/mtl/MtlSampler.h"
+#include "src/gpu/graphite/mtl/MtlSharedContext.h"
#include "src/gpu/graphite/mtl/MtlTexture.h"
#import <Metal/Metal.h>
namespace skgpu::graphite {
-MtlResourceProvider::MtlResourceProvider(const Gpu* gpu,
+MtlResourceProvider::MtlResourceProvider(const SharedContext* sharedContext,
sk_sp<GlobalCache> globalCache,
SingleOwner* singleOwner)
- : ResourceProvider(gpu, std::move(globalCache), singleOwner) {
+ : ResourceProvider(sharedContext, std::move(globalCache), singleOwner) {
}
-const MtlGpu* MtlResourceProvider::mtlGpu() {
- return static_cast<const MtlGpu*>(fGpu);
+const MtlSharedContext* MtlResourceProvider::mtlSharedContext() {
+ return static_cast<const MtlSharedContext*>(fSharedContext);
}
-sk_sp<CommandBuffer> MtlResourceProvider::createCommandBuffer() {
- return MtlCommandBuffer::Make(this->mtlGpu());
-}
-
-sk_sp<GraphicsPipeline> MtlResourceProvider::onCreateGraphicsPipeline(
+sk_sp<GraphicsPipeline> MtlResourceProvider::createGraphicsPipeline(
const GraphicsPipelineDesc& pipelineDesc,
const RenderPassDesc& renderPassDesc) {
return MtlGraphicsPipeline::Make(this,
- this->mtlGpu(),
+ this->mtlSharedContext(),
pipelineDesc,
renderPassDesc);
}
+sk_sp<ComputePipeline> MtlResourceProvider::createComputePipeline(
+ const ComputePipelineDesc& pipelineDesc) {
+ return MtlComputePipeline::Make(this, this->mtlSharedContext(), pipelineDesc);
+}
+
sk_sp<Texture> MtlResourceProvider::createTexture(SkISize dimensions,
const TextureInfo& info,
SkBudgeted budgeted) {
- return MtlTexture::Make(this->mtlGpu(), dimensions, info, budgeted);
+ return MtlTexture::Make(this->mtlSharedContext(), dimensions, info, budgeted);
}
sk_sp<Texture> MtlResourceProvider::createWrappedTexture(const BackendTexture& texture) {
@@ -56,7 +58,7 @@ sk_sp<Texture> MtlResourceProvider::createWrappedTexture(const BackendTexture& t
return nullptr;
}
sk_cfp<id<MTLTexture>> mtlTexture = sk_ret_cfp((id<MTLTexture>)mtlHandleTexture);
- return MtlTexture::MakeWrapped(this->mtlGpu(),
+ return MtlTexture::MakeWrapped(this->mtlSharedContext(),
texture.dimensions(),
texture.info(),
std::move(mtlTexture));
@@ -65,13 +67,13 @@ sk_sp<Texture> MtlResourceProvider::createWrappedTexture(const BackendTexture& t
sk_sp<Buffer> MtlResourceProvider::createBuffer(size_t size,
BufferType type,
PrioritizeGpuReads prioritizeGpuReads) {
- return MtlBuffer::Make(this->mtlGpu(), size, type, prioritizeGpuReads);
+ return MtlBuffer::Make(this->mtlSharedContext(), size, type, prioritizeGpuReads);
}
sk_sp<Sampler> MtlResourceProvider::createSampler(const SkSamplingOptions& samplingOptions,
- SkTileMode xTileMode,
- SkTileMode yTileMode) {
- return MtlSampler::Make(this->mtlGpu(), samplingOptions, xTileMode, yTileMode);
+ SkTileMode xTileMode,
+ SkTileMode yTileMode) {
+ return MtlSampler::Make(this->mtlSharedContext(), samplingOptions, xTileMode, yTileMode);
}
namespace {
@@ -146,7 +148,7 @@ sk_cfp<id<MTLDepthStencilState>> MtlResourceProvider::findOrCreateCompatibleDept
}
sk_cfp<id<MTLDepthStencilState>> dss(
- [this->mtlGpu()->device() newDepthStencilStateWithDescriptor: desc]);
+ [this->mtlSharedContext()->device() newDepthStencilStateWithDescriptor: desc]);
depthStencilState = fDepthStencilStates.set(depthStencilSettings, std::move(dss));
}
@@ -154,4 +156,21 @@ sk_cfp<id<MTLDepthStencilState>> MtlResourceProvider::findOrCreateCompatibleDept
return *depthStencilState;
}
+BackendTexture MtlResourceProvider::onCreateBackendTexture(SkISize dimensions,
+ const TextureInfo& info) {
+ sk_cfp<id<MTLTexture>> texture = MtlTexture::MakeMtlTexture(this->mtlSharedContext(),
+ dimensions,
+ info);
+ if (!texture) {
+ return {};
+ }
+ return BackendTexture(dimensions, (Handle)texture.release());
+}
+
+void MtlResourceProvider::onDeleteBackendTexture(BackendTexture& texture) {
+ SkASSERT(texture.backend() == BackendApi::kMetal);
+ MtlHandle texHandle = texture.getMtlTexture();
+ SkCFSafeRelease(texHandle);
+}
+
} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlSampler.h b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlSampler.h
index e091a706d71..05a5c42b2a7 100644
--- a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlSampler.h
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlSampler.h
@@ -20,11 +20,11 @@ struct SkSamplingOptions;
namespace skgpu::graphite {
-class MtlGpu;
+class MtlSharedContext;
class MtlSampler : public Sampler {
public:
- static sk_sp<MtlSampler> Make(const MtlGpu*,
+ static sk_sp<MtlSampler> Make(const MtlSharedContext*,
const SkSamplingOptions& samplingOptions,
SkTileMode xTileMode,
SkTileMode yTileMode);
@@ -34,7 +34,7 @@ public:
id<MTLSamplerState> mtlSamplerState() const { return fSamplerState.get(); }
private:
- MtlSampler(const MtlGpu* gpu,
+ MtlSampler(const MtlSharedContext* sharedContext,
sk_cfp<id<MTLSamplerState>>);
void freeGpuData() override;
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlSampler.mm b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlSampler.mm
index 5e93c0a55ae..e8924a6c07a 100644
--- a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlSampler.mm
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlSampler.mm
@@ -9,13 +9,13 @@
#include "include/core/SkSamplingOptions.h"
#include "src/gpu/graphite/mtl/MtlCaps.h"
-#include "src/gpu/graphite/mtl/MtlGpu.h"
+#include "src/gpu/graphite/mtl/MtlSharedContext.h"
namespace skgpu::graphite {
-MtlSampler::MtlSampler(const MtlGpu* gpu,
+MtlSampler::MtlSampler(const MtlSharedContext* sharedContext,
sk_cfp<id<MTLSamplerState>> samplerState)
- : Sampler(gpu)
+ : Sampler(sharedContext)
, fSamplerState(std::move(samplerState)) {}
static inline MTLSamplerAddressMode tile_mode_to_mtl_sampler_address(SkTileMode tileMode,
@@ -44,7 +44,7 @@ static inline MTLSamplerAddressMode tile_mode_to_mtl_sampler_address(SkTileMode
SkUNREACHABLE;
}
-sk_sp<MtlSampler> MtlSampler::Make(const MtlGpu* gpu,
+sk_sp<MtlSampler> MtlSampler::Make(const MtlSharedContext* sharedContext,
const SkSamplingOptions& samplingOptions,
SkTileMode xTileMode,
SkTileMode yTileMode) {
@@ -67,29 +67,49 @@ sk_sp<MtlSampler> MtlSampler::Make(const MtlGpu* gpu,
SkUNREACHABLE;
}();
- auto samplerDesc = [[MTLSamplerDescriptor alloc] init];
- samplerDesc.rAddressMode = MTLSamplerAddressModeClampToEdge;
- samplerDesc.sAddressMode = tile_mode_to_mtl_sampler_address(xTileMode, gpu->mtlCaps());
- samplerDesc.tAddressMode = tile_mode_to_mtl_sampler_address(yTileMode, gpu->mtlCaps());
- samplerDesc.magFilter = minMagFilter;
- samplerDesc.minFilter = minMagFilter;
- samplerDesc.mipFilter = mipFilter;
- samplerDesc.lodMinClamp = 0.0f;
- samplerDesc.lodMaxClamp = FLT_MAX; // default value according to docs.
- samplerDesc.maxAnisotropy = 1.0f;
- samplerDesc.normalizedCoordinates = true;
+ (*desc).rAddressMode = MTLSamplerAddressModeClampToEdge;
+ (*desc).sAddressMode = tile_mode_to_mtl_sampler_address(xTileMode, sharedContext->mtlCaps());
+ (*desc).tAddressMode = tile_mode_to_mtl_sampler_address(yTileMode, sharedContext->mtlCaps());
+ (*desc).magFilter = minMagFilter;
+ (*desc).minFilter = minMagFilter;
+ (*desc).mipFilter = mipFilter;
+ (*desc).lodMinClamp = 0.0f;
+ (*desc).lodMaxClamp = FLT_MAX; // default value according to docs.
+ (*desc).maxAnisotropy = 1; // TODO: if we start using aniso, need to add to key
+ (*desc).normalizedCoordinates = true;
if (@available(macOS 10.11, iOS 9.0, *)) {
- samplerDesc.compareFunction = MTLCompareFunctionNever;
+ (*desc).compareFunction = MTLCompareFunctionNever;
}
#ifdef SK_ENABLE_MTL_DEBUG_INFO
- // TODO: add label?
+ NSString* tileModeLabels[] = {
+ @"Clamp",
+ @"Repeat",
+ @"Mirror",
+ @"Decal"
+ };
+ NSString* minMagFilterLabels[] = {
+ @"Nearest",
+ @"Linear"
+ };
+ NSString* mipFilterLabels[] = {
+ @"MipNone",
+ @"MipNearest",
+ @"MipLinear"
+ };
+
+ (*desc).label = [NSString stringWithFormat:@"X%@Y%@%@%@",
+ tileModeLabels[(int)xTileMode],
+ tileModeLabels[(int)yTileMode],
+ minMagFilterLabels[(int)samplingOptions.filter],
+ mipFilterLabels[(int)samplingOptions.mipmap]];
#endif
- sk_cfp<id<MTLSamplerState>> sampler([gpu->device() newSamplerStateWithDescriptor:desc.get()]);
+ sk_cfp<id<MTLSamplerState>> sampler(
+ [sharedContext->device() newSamplerStateWithDescriptor:desc.get()]);
if (!sampler) {
return nullptr;
}
- return sk_sp<MtlSampler>(new MtlSampler(gpu, std::move(sampler)));
+ return sk_sp<MtlSampler>(new MtlSampler(sharedContext, std::move(sampler)));
}
void MtlSampler::freeGpuData() {
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlSharedContext.h b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlSharedContext.h
new file mode 100644
index 00000000000..2d69f2ab036
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlSharedContext.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2021 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef skgpu_graphite_MtlSharedContext_DEFINED
+#define skgpu_graphite_MtlSharedContext_DEFINED
+
+#include "src/gpu/graphite/SharedContext.h"
+
+#include "include/ports/SkCFObject.h"
+
+#include "include/gpu/graphite/mtl/MtlBackendContext.h"
+#include "src/gpu/graphite/mtl/MtlCaps.h"
+
+#import <Metal/Metal.h>
+
+namespace skgpu::graphite {
+struct ContextOptions;
+
+class MtlSharedContext final : public SharedContext {
+public:
+ static sk_sp<SharedContext> Make(const MtlBackendContext&, const ContextOptions&);
+ ~MtlSharedContext() override;
+
+ id<MTLDevice> device() const { return fDevice.get(); }
+
+ const MtlCaps& mtlCaps() const { return static_cast<const MtlCaps&>(*this->caps()); }
+
+ std::unique_ptr<ResourceProvider> makeResourceProvider(
+ sk_sp<GlobalCache>, SingleOwner*) const override;
+
+private:
+ MtlSharedContext(sk_cfp<id<MTLDevice>>, sk_sp<const MtlCaps>);
+
+ sk_cfp<id<MTLDevice>> fDevice;
+};
+
+} // namespace skgpu::graphite
+
+#endif // skgpu_graphite_MtlSharedContext_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlSharedContext.mm b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlSharedContext.mm
new file mode 100644
index 00000000000..5966b8a75bb
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlSharedContext.mm
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2021 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "src/gpu/graphite/mtl/MtlSharedContext.h"
+
+#include "include/gpu/graphite/BackendTexture.h"
+#include "include/gpu/graphite/TextureInfo.h"
+#include "src/gpu/graphite/Caps.h"
+#include "src/gpu/graphite/GlobalCache.h"
+#include "src/gpu/graphite/Log.h"
+#include "src/gpu/graphite/mtl/MtlCommandBuffer.h"
+#include "src/gpu/graphite/mtl/MtlResourceProvider.h"
+#include "src/gpu/graphite/mtl/MtlTexture.h"
+
+namespace skgpu::graphite {
+
+sk_sp<skgpu::graphite::SharedContext> MtlSharedContext::Make(const MtlBackendContext& context,
+ const ContextOptions& options) {
+ // TODO: This was taken from GrMtlGpu.mm's Make, does graphite deserve a higher version?
+ if (@available(macOS 10.14, iOS 11.0, *)) {
+ // no warning needed
+ } else {
+ SKGPU_LOG_E("Skia's Graphite backend no longer supports this OS version.");
+#ifdef SK_BUILD_FOR_IOS
+ SKGPU_LOG_E("Minimum supported version is iOS 11.0.");
+#else
+ SKGPU_LOG_E("Minimum supported version is MacOS 10.14.");
+#endif
+ return nullptr;
+ }
+
+ sk_cfp<id<MTLDevice>> device = sk_ret_cfp((id<MTLDevice>)(context.fDevice.get()));
+
+ sk_sp<const MtlCaps> caps(new MtlCaps(device.get(), options));
+
+ return sk_sp<skgpu::graphite::SharedContext>(new MtlSharedContext(std::move(device),
+ std::move(caps)));
+}
+
+MtlSharedContext::MtlSharedContext(sk_cfp<id<MTLDevice>> device,
+ sk_sp<const MtlCaps> caps)
+ : skgpu::graphite::SharedContext(std::move(caps), BackendApi::kMetal)
+ , fDevice(std::move(device)) {
+}
+
+MtlSharedContext::~MtlSharedContext() {
+}
+
+std::unique_ptr<ResourceProvider> MtlSharedContext::makeResourceProvider(
+ sk_sp<GlobalCache> globalCache, SingleOwner* singleOwner) const {
+ return std::unique_ptr<ResourceProvider>(new MtlResourceProvider(this,
+ std::move(globalCache),
+ singleOwner));
+}
+
+} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlTexture.h b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlTexture.h
index ffc6b702451..6e393c7e8b4 100644
--- a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlTexture.h
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlTexture.h
@@ -14,20 +14,20 @@
#import <Metal/Metal.h>
namespace skgpu::graphite {
-class MtlGpu;
+class MtlSharedContext;
class MtlTexture : public Texture {
public:
- static sk_cfp<id<MTLTexture>> MakeMtlTexture(const MtlGpu*,
+ static sk_cfp<id<MTLTexture>> MakeMtlTexture(const MtlSharedContext*,
SkISize dimensions,
const TextureInfo&);
- static sk_sp<Texture> Make(const MtlGpu*,
+ static sk_sp<Texture> Make(const MtlSharedContext*,
SkISize dimensions,
const TextureInfo&,
SkBudgeted);
- static sk_sp<Texture> MakeWrapped(const MtlGpu*,
+ static sk_sp<Texture> MakeWrapped(const MtlSharedContext*,
SkISize dimensions,
const TextureInfo&,
sk_cfp<id<MTLTexture>>);
@@ -37,7 +37,7 @@ public:
id<MTLTexture> mtlTexture() const { return fTexture.get(); }
private:
- MtlTexture(const MtlGpu* gpu,
+ MtlTexture(const MtlSharedContext* sharedContext,
SkISize dimensions,
const TextureInfo& info,
sk_cfp<id<MTLTexture>>,
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlTexture.mm b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlTexture.mm
index 65a49380e40..92bbd60be68 100644
--- a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlTexture.mm
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlTexture.mm
@@ -10,15 +10,15 @@
#include "include/gpu/graphite/mtl/MtlTypes.h"
#include "include/private/gpu/graphite/MtlTypesPriv.h"
#include "src/gpu/graphite/mtl/MtlCaps.h"
-#include "src/gpu/graphite/mtl/MtlGpu.h"
+#include "src/gpu/graphite/mtl/MtlSharedContext.h"
#include "src/gpu/graphite/mtl/MtlUtils.h"
namespace skgpu::graphite {
-sk_cfp<id<MTLTexture>> MtlTexture::MakeMtlTexture(const MtlGpu* gpu,
+sk_cfp<id<MTLTexture>> MtlTexture::MakeMtlTexture(const MtlSharedContext* sharedContext,
SkISize dimensions,
const TextureInfo& info) {
- const skgpu::graphite::Caps* caps = gpu->caps();
+ const Caps* caps = sharedContext->caps();
if (dimensions.width() > caps->maxTextureSize() ||
dimensions.height() > caps->maxTextureSize()) {
return nullptr;
@@ -48,7 +48,7 @@ sk_cfp<id<MTLTexture>> MtlTexture::MakeMtlTexture(const MtlGpu* gpu,
(*desc).usage = mtlSpec.fUsage;
(*desc).storageMode = (MTLStorageMode)mtlSpec.fStorageMode;
- sk_cfp<id<MTLTexture>> texture([gpu->device() newTextureWithDescriptor:desc.get()]);
+ sk_cfp<id<MTLTexture>> texture([sharedContext->device() newTextureWithDescriptor:desc.get()]);
#ifdef SK_ENABLE_MTL_DEBUG_INFO
if (mtlSpec.fUsage & MTLTextureUsageRenderTarget) {
if (MtlFormatIsDepthOrStencil((MTLPixelFormat)mtlSpec.fFormat)) {
@@ -77,24 +77,24 @@ sk_cfp<id<MTLTexture>> MtlTexture::MakeMtlTexture(const MtlGpu* gpu,
return texture;
}
-MtlTexture::MtlTexture(const MtlGpu* gpu,
+MtlTexture::MtlTexture(const MtlSharedContext* sharedContext,
SkISize dimensions,
const TextureInfo& info,
sk_cfp<id<MTLTexture>> texture,
Ownership ownership,
SkBudgeted budgeted)
- : Texture(gpu, dimensions, info, ownership, budgeted)
+ : Texture(sharedContext, dimensions, info, ownership, budgeted)
, fTexture(std::move(texture)) {}
-sk_sp<Texture> MtlTexture::Make(const MtlGpu* gpu,
+sk_sp<Texture> MtlTexture::Make(const MtlSharedContext* sharedContext,
SkISize dimensions,
const TextureInfo& info,
SkBudgeted budgeted) {
- sk_cfp<id<MTLTexture>> texture = MakeMtlTexture(gpu, dimensions, info);
+ sk_cfp<id<MTLTexture>> texture = MakeMtlTexture(sharedContext, dimensions, info);
if (!texture) {
return nullptr;
}
- return sk_sp<Texture>(new MtlTexture(gpu,
+ return sk_sp<Texture>(new MtlTexture(sharedContext,
dimensions,
info,
std::move(texture),
@@ -102,11 +102,11 @@ sk_sp<Texture> MtlTexture::Make(const MtlGpu* gpu,
budgeted));
}
-sk_sp<Texture> MtlTexture::MakeWrapped(const MtlGpu* gpu,
+sk_sp<Texture> MtlTexture::MakeWrapped(const MtlSharedContext* sharedContext,
SkISize dimensions,
const TextureInfo& info,
sk_cfp<id<MTLTexture>> texture) {
- return sk_sp<Texture>(new MtlTexture(gpu,
+ return sk_sp<Texture>(new MtlTexture(sharedContext,
dimensions,
info,
std::move(texture),
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlTrampoline.h b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlTrampoline.h
index a664503fdce..831439a1a71 100644
--- a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlTrampoline.h
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlTrampoline.h
@@ -10,9 +10,19 @@
#include "include/core/SkRefCnt.h"
+#include <memory>
+
+namespace skgpu {
+class SingleOwner;
+}
+
namespace skgpu::graphite {
-class Gpu;
+struct ContextOptions;
+class GlobalCache;
struct MtlBackendContext;
+class QueueManager;
+class ResourceProvider;
+class SharedContext;
/*
* This class is used to hold functions which trampoline from the Graphite cpp code
@@ -20,7 +30,13 @@ struct MtlBackendContext;
*/
class MtlTrampoline {
public:
- static sk_sp<skgpu::graphite::Gpu> MakeGpu(const MtlBackendContext&);
+ static sk_sp<SharedContext> MakeSharedContext(const MtlBackendContext&, const ContextOptions&);
+ static std::unique_ptr<QueueManager> MakeQueueManager(const MtlBackendContext&,
+ const SharedContext*);
+ static std::unique_ptr<ResourceProvider> MakeResourceProvider(const SharedContext*,
+ sk_sp<GlobalCache>,
+ SingleOwner*);
+
};
} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlTrampoline.mm b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlTrampoline.mm
index 064abc09ddc..4d2d7212f65 100644
--- a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlTrampoline.mm
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlTrampoline.mm
@@ -7,11 +7,32 @@
#include "src/gpu/graphite/mtl/MtlTrampoline.h"
-#include "src/gpu/graphite/mtl/MtlGpu.h"
+#include "src/gpu/graphite/GlobalCache.h"
+#include "src/gpu/graphite/mtl/MtlQueueManager.h"
+#include "src/gpu/graphite/mtl/MtlResourceProvider.h"
+#include "src/gpu/graphite/mtl/MtlSharedContext.h"
namespace skgpu::graphite {
-sk_sp<skgpu::graphite::Gpu> MtlTrampoline::MakeGpu(const MtlBackendContext& backendContext) {
- return MtlGpu::Make(backendContext);
+sk_sp<SharedContext> MtlTrampoline::MakeSharedContext(const MtlBackendContext& backendContext,
+ const ContextOptions& options) {
+ return MtlSharedContext::Make(backendContext, options);
+}
+
+std::unique_ptr<QueueManager> MtlTrampoline::MakeQueueManager(
+ const MtlBackendContext& backendContext, const SharedContext* sharedContext) {
+
+ sk_cfp<id<MTLCommandQueue>> queue =
+ sk_ret_cfp((id<MTLCommandQueue>)(backendContext.fQueue.get()));
+ return std::make_unique<MtlQueueManager>(std::move(queue), sharedContext);
+}
+
+std::unique_ptr<ResourceProvider> MtlTrampoline::MakeResourceProvider(
+ const SharedContext* sharedContext,
+ sk_sp<GlobalCache> globalCache,
+ SingleOwner* singleOwner) {
+ return std::make_unique<MtlResourceProvider>(sharedContext,
+ std::move(globalCache),
+ singleOwner);
}
} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlUtils.h b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlUtils.h
index 2c1abb507fc..e63835f51bb 100644
--- a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlUtils.h
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlUtils.h
@@ -19,8 +19,12 @@ namespace skgpu {
class ShaderErrorHandler;
}
+namespace SkSL {
+ class Compiler;
+}
+
namespace skgpu::graphite {
-class MtlGpu;
+class MtlSharedContext;
bool MtlFormatIsDepthOrStencil(MTLPixelFormat);
bool MtlFormatIsDepth(MTLPixelFormat);
@@ -31,15 +35,15 @@ MTLPixelFormat MtlDepthStencilFlagsToFormat(SkEnumBitMask<DepthStencilFlags>);
/**
* Produces MSL code generated by SkSLC
*/
-bool SkSLToMSL(const MtlGpu* gpu,
+bool SkSLToMSL(SkSL::Compiler*,
const std::string& sksl,
SkSL::ProgramKind kind,
- const SkSL::Program::Settings& settings,
+ const SkSL::ProgramSettings& settings,
std::string* msl,
SkSL::Program::Inputs* outInputs,
ShaderErrorHandler* errorHandler);
-sk_cfp<id<MTLLibrary>> MtlCompileShaderLibrary(const MtlGpu* gpu,
+sk_cfp<id<MTLLibrary>> MtlCompileShaderLibrary(const MtlSharedContext* sharedContext,
const std::string& msl,
ShaderErrorHandler* errorHandler);
diff --git a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlUtils.mm b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlUtils.mm
index 52df89b6693..1c4ba3dd7c9 100644
--- a/chromium/third_party/skia/src/gpu/graphite/mtl/MtlUtils.mm
+++ b/chromium/third_party/skia/src/gpu/graphite/mtl/MtlUtils.mm
@@ -10,7 +10,7 @@
#include "include/gpu/ShaderErrorHandler.h"
#include "include/private/SkSLString.h"
#include "src/core/SkTraceEvent.h"
-#include "src/gpu/graphite/mtl/MtlGpu.h"
+#include "src/gpu/graphite/mtl/MtlSharedContext.h"
#include "src/sksl/SkSLCompiler.h"
#include "src/utils/SkShaderUtils.h"
@@ -71,10 +71,10 @@ MTLPixelFormat MtlDepthStencilFlagsToFormat(SkEnumBitMask<DepthStencilFlags> mas
static const bool gPrintSKSL = false;
static const bool gPrintMSL = false;
-bool SkSLToMSL(const MtlGpu* gpu,
+bool SkSLToMSL(SkSL::Compiler* compiler,
const std::string& sksl,
SkSL::ProgramKind programKind,
- const SkSL::Program::Settings& settings,
+ const SkSL::ProgramSettings& settings,
std::string* msl,
SkSL::Program::Inputs* outInputs,
ShaderErrorHandler* errorHandler) {
@@ -83,11 +83,9 @@ bool SkSLToMSL(const MtlGpu* gpu,
#else
const std::string& src = sksl;
#endif
- SkSL::Compiler* compiler = gpu->shaderCompiler();
- std::unique_ptr<SkSL::Program> program =
- gpu->shaderCompiler()->convertProgram(programKind,
- src,
- settings);
+ std::unique_ptr<SkSL::Program> program = compiler->convertProgram(programKind,
+ src,
+ settings);
if (!program || !compiler->toMetal(*program, msl)) {
errorHandler->compileError(src.c_str(), compiler->errorText().c_str());
return false;
@@ -109,7 +107,7 @@ bool SkSLToMSL(const MtlGpu* gpu,
return true;
}
-sk_cfp<id<MTLLibrary>> MtlCompileShaderLibrary(const MtlGpu* gpu,
+sk_cfp<id<MTLLibrary>> MtlCompileShaderLibrary(const MtlSharedContext* sharedContext,
const std::string& msl,
ShaderErrorHandler* errorHandler) {
TRACE_EVENT0("skia.shaders", "driver_compile_shader");
@@ -130,9 +128,9 @@ sk_cfp<id<MTLLibrary>> MtlCompileShaderLibrary(const MtlGpu* gpu,
NSError* error = nil;
// TODO: do we need a version with a timeout?
- sk_cfp<id<MTLLibrary>> compiledLibrary([gpu->device() newLibraryWithSource:nsSource
- options:options
- error:&error]);
+ sk_cfp<id<MTLLibrary>> compiledLibrary([sharedContext->device() newLibraryWithSource:nsSource
+ options:options
+ error:&error]);
if (!compiledLibrary) {
errorHandler->compileError(msl.c_str(), error.debugDescription.UTF8String);
return nil;
diff --git a/chromium/third_party/skia/src/gpu/graphite/render/BitmapTextRenderStep.cpp b/chromium/third_party/skia/src/gpu/graphite/render/BitmapTextRenderStep.cpp
new file mode 100644
index 00000000000..da13f4353f0
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/render/BitmapTextRenderStep.cpp
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "src/gpu/graphite/render/BitmapTextRenderStep.h"
+
+#include "src/core/SkPipelineData.h"
+
+#include "include/gpu/graphite/Recorder.h"
+#include "include/private/SkSLString.h"
+#include "src/gpu/graphite/DrawParams.h"
+#include "src/gpu/graphite/DrawWriter.h"
+#include "src/gpu/graphite/RecorderPriv.h"
+#include "src/gpu/graphite/text/AtlasManager.h"
+#include "src/text/gpu/SubRunContainer.h"
+
+using AtlasSubRun = sktext::gpu::AtlasSubRun;
+
+namespace skgpu::graphite {
+
+namespace {
+static constexpr DepthStencilSettings kDirectShadingPass = {
+ /*frontStencil=*/{},
+ /*backStencil=*/ {},
+ /*refValue=*/ 0,
+ /*stencilTest=*/ false,
+ /*depthCompare=*/CompareOp::kGEqual,
+ /*depthTest=*/ true,
+ /*depthWrite=*/ true
+};
+
+// We are expecting to sample from up to 4 textures
+constexpr int kNumTextAtlasTextures = 4;
+} // namespace
+
+BitmapTextRenderStep::BitmapTextRenderStep(bool isA8)
+ : RenderStep("BitmapTextRenderStep",
+ "",
+ Flags::kPerformsShading | Flags::kHasTextures | Flags::kEmitsCoverage,
+ /*uniforms=*/{{"atlasSizeInv", SkSLType::kFloat2}},
+ PrimitiveType::kTriangles,
+ kDirectShadingPass,
+ /*vertexAttrs=*/
+ {{"position", VertexAttribType::kFloat2, SkSLType::kFloat2},
+ {"depth", VertexAttribType::kFloat, SkSLType::kFloat},
+ {"texCoords", VertexAttribType::kUShort2, SkSLType::kUShort2},
+ {"ssboIndex", VertexAttribType::kInt, SkSLType::kInt}},
+ /*instanceAttrs=*/{},
+ /*varyings=*/
+ {{"textureCoords", SkSLType::kFloat2},
+ {"texIndex", SkSLType::kFloat}})
+ , fIsA8(isA8) {}
+
+BitmapTextRenderStep::~BitmapTextRenderStep() {}
+
+const char* BitmapTextRenderStep::vertexSkSL() const {
+ return R"(
+ int2 coords = int2(texCoords.x, texCoords.y);
+ int texIdx = coords.x >> 13;
+ float2 unormTexCoords = float2(coords.x & 0x1FFF, coords.y);
+
+ textureCoords = unormTexCoords * atlasSizeInv;
+ texIndex = float(texIdx);
+
+ float4 devPosition = float4(position, depth, 1);
+ )";
+}
+
+std::string BitmapTextRenderStep::texturesAndSamplersSkSL(int binding) const {
+ std::string result;
+
+ for (unsigned int i = 0; i < kNumTextAtlasTextures; ++i) {
+ SkSL::String::appendf(&result,
+ "layout(binding=%d) uniform sampler2D text_atlas_%d;\n", binding, i);
+ binding++;
+ }
+
+ return result;
+}
+
+const char* BitmapTextRenderStep::fragmentCoverageSkSL() const {
+ if (fIsA8) {
+ return R"(
+ half4 texColor;
+ if (texIndex == 0) {
+ texColor = sample(text_atlas_0, textureCoords).rrrr;
+ } else if (texIndex == 1) {
+ texColor = sample(text_atlas_1, textureCoords).rrrr;
+ } else if (texIndex == 2) {
+ texColor = sample(text_atlas_2, textureCoords).rrrr;
+ } else if (texIndex == 3) {
+ texColor = sample(text_atlas_3, textureCoords).rrrr;
+ } else {
+ texColor = sample(text_atlas_0, textureCoords).rrrr;
+ }
+ outputCoverage = texColor;
+ )";
+ } else {
+ return R"(
+ half4 texColor;
+ if (texIndex == 0) {
+ texColor = sample(text_atlas_0, textureCoords);
+ } else if (texIndex == 1) {
+ texColor = sample(text_atlas_1, textureCoords);
+ } else if (texIndex == 2) {
+ texColor = sample(text_atlas_2, textureCoords);
+ } else if (texIndex == 3) {
+ texColor = sample(text_atlas_3, textureCoords);
+ } else {
+ texColor = sample(text_atlas_0, textureCoords);
+ }
+ outputCoverage = texColor;
+ )";
+ }
+}
+
+void BitmapTextRenderStep::writeVertices(DrawWriter* dw,
+ const DrawParams& params,
+ int ssboIndex) const {
+ const SubRunData& subRunData = params.geometry().subRunData();
+ // TODO: pass through the color from the SkPaint via the SubRunData
+ subRunData.subRun()->fillVertexData(dw, subRunData.startGlyphIndex(), subRunData.glyphCount(),
+ ssboIndex,
+ params.order().depthAsFloat(),
+ params.transform());
+}
+
+void BitmapTextRenderStep::writeUniformsAndTextures(const DrawParams& params,
+ SkPipelineDataGatherer* gatherer) const {
+ SkDEBUGCODE(UniformExpectationsValidator uev(gatherer, this->uniforms());)
+
+ const SubRunData& subRunData = params.geometry().subRunData();
+ unsigned int numProxies;
+ Recorder* recorder = subRunData.recorder();
+ const sk_sp<TextureProxy>* proxies =
+ recorder->priv().atlasManager()->getProxies(subRunData.subRun()->maskFormat(),
+ &numProxies);
+ SkASSERT(proxies && numProxies > 0);
+
+ // write uniforms
+ skvx::float2 atlasDimensionsInverse = {1.f/proxies[0]->dimensions().width(),
+ 1.f/proxies[0]->dimensions().height()};
+ gatherer->write(atlasDimensionsInverse);
+
+ // write textures and samplers
+ const SkSamplingOptions kSamplingOptions(SkFilterMode::kNearest);
+ constexpr SkTileMode kTileModes[2] = { SkTileMode::kClamp, SkTileMode::kClamp };
+ for (unsigned int i = 0; i < numProxies; ++i) {
+ gatherer->add(kSamplingOptions, kTileModes, proxies[i]);
+ }
+ // If the atlas has less than 4 active proxies we still need to set up samplers for the shader.
+ for (unsigned int i = numProxies; i < kNumTextAtlasTextures; ++i) {
+ gatherer->add(kSamplingOptions, kTileModes, proxies[0]);
+ }
+}
+
+} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/render/BitmapTextRenderStep.h b/chromium/third_party/skia/src/gpu/graphite/render/BitmapTextRenderStep.h
new file mode 100644
index 00000000000..3ec3327211a
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/render/BitmapTextRenderStep.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef skgpu_graphite_render_BitmapTextRenderStep_DEFINED
+#define skgpu_graphite_render_BitmapTextRenderStep_DEFINED
+
+#include "src/gpu/graphite/Renderer.h"
+
+namespace skgpu::graphite {
+
+class BitmapTextRenderStep final : public RenderStep {
+public:
+ BitmapTextRenderStep(bool isA8);
+
+ ~BitmapTextRenderStep() override;
+
+ const char* vertexSkSL() const override;
+ std::string texturesAndSamplersSkSL(int startBinding) const override;
+ const char* fragmentCoverageSkSL() const override;
+
+ void writeVertices(DrawWriter*, const DrawParams&, int ssboIndex) const override;
+ void writeUniformsAndTextures(const DrawParams&, SkPipelineDataGatherer*) const override;
+
+private:
+ bool fIsA8;
+};
+
+} // namespace skgpu::graphite
+
+#endif // skgpu_graphite_render_BitmapTextRenderStep_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/graphite/render/CoverBoundsRenderStep.cpp b/chromium/third_party/skia/src/gpu/graphite/render/CoverBoundsRenderStep.cpp
index 7165f1d6ae3..8b52f73d825 100644
--- a/chromium/third_party/skia/src/gpu/graphite/render/CoverBoundsRenderStep.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/render/CoverBoundsRenderStep.cpp
@@ -7,7 +7,7 @@
#include "src/gpu/graphite/render/CoverBoundsRenderStep.h"
-#include "src/gpu/graphite/DrawGeometry.h"
+#include "src/gpu/graphite/DrawParams.h"
#include "src/gpu/graphite/DrawWriter.h"
#include "src/gpu/graphite/render/StencilAndCoverDSS.h"
@@ -18,46 +18,72 @@ CoverBoundsRenderStep::CoverBoundsRenderStep(bool inverseFill)
inverseFill ? "inverse" : "regular",
Flags::kPerformsShading,
/*uniforms=*/{},
- PrimitiveType::kTriangles,
+ PrimitiveType::kTriangleStrip,
inverseFill ? kInverseCoverPass : kRegularCoverPass,
/*vertexAttrs=*/{{"position",
VertexAttribType::kFloat4,
SkSLType::kFloat4}},
- /*instanceAttrs=*/{})
+ /*instanceAttrs=*/{{"bounds", VertexAttribType::kFloat4, SkSLType::kFloat4},
+ {"depth", VertexAttribType::kFloat, SkSLType::kFloat},
+ {"ssboIndex", VertexAttribType::kInt, SkSLType::kInt},
+ {"mat0", VertexAttribType::kFloat3, SkSLType::kFloat3},
+ {"mat1", VertexAttribType::kFloat3, SkSLType::kFloat3},
+ {"mat2", VertexAttribType::kFloat3, SkSLType::kFloat3}})
, fInverseFill(inverseFill) {}
CoverBoundsRenderStep::~CoverBoundsRenderStep() {}
const char* CoverBoundsRenderStep::vertexSkSL() const {
- return " float4 devPosition = position;\n";
+ return R"(
+ float3x3 matrix = float3x3(mat0, mat1, mat2);
+ float2 corner = float2(float(sk_VertexID / 2), float(sk_VertexID % 2));
+
+ float4 devPosition;
+ if (bounds.L <= bounds.R && bounds.T <= bounds.B) {
+ // A regular fill
+ corner = (1.0 - corner) * bounds.LT + corner * bounds.RB;
+ float3 devCorner = matrix * float3(corner, 1.0);
+ devPosition = float4(devCorner.xy, depth, devCorner.z);
+ } else {
+ // An inverse fill
+ corner = corner * bounds.LT + (1.0 - corner) * bounds.RB;
+ devPosition = float4(corner, depth, 1.0);
+ // TODO: transform corner by matrix to get updated local coordinates
+ }
+ )";
}
-void CoverBoundsRenderStep::writeVertices(DrawWriter* writer, const DrawGeometry& geom) const {
- SkV4 devPoints[4]; // ordered TL, TR, BR, BL
+void CoverBoundsRenderStep::writeVertices(DrawWriter* writer,
+ const DrawParams& params,
+ int ssboIndex) const {
+ // Each instance is 4 vertices, forming 2 triangles from a single triangle strip, so no indices
+ // are needed. sk_VertexID is used to place vertex positions, so no vertex buffer is needed.
+ DrawWriter::Instances instances{*writer, {}, {}, 4};
+ skvx::float4 bounds;
+ const SkM44* m;
if (fInverseFill) {
- // TODO: When we handle local coords, we'd need to map these corners by the inverse.
- const SkIRect& bounds = geom.clip().scissor();
- devPoints[0] = {(float) bounds.fLeft, (float) bounds.fTop, 0.f, 1.f};
- devPoints[1] = {(float) bounds.fRight, (float) bounds.fTop, 0.f, 1.f};
- devPoints[2] = {(float) bounds.fRight, (float) bounds.fBottom, 0.f, 1.f};
- devPoints[3] = {(float) bounds.fLeft, (float) bounds.fBottom, 0.f, 1.f};
+ // Normally all bounding boxes are sorted such that l<r and t<b. We upload an inverted
+ // rectangle [r,b,l,t] when it's an inverse fill to encode that the bounds are already in
+ // device space and then use the inverse of the transform to compute local coordinates.
+ bounds = skvx::shuffle</*R*/2, /*B*/3, /*L*/0, /*T*/1>(
+ skvx::cast<float>(skvx::int4::Load(&params.clip().scissor())));
+ m = &params.transform().inverse();
} else {
- geom.transform().mapPoints(geom.shape().bounds(), devPoints);
+ bounds = params.geometry().bounds().ltrb();
+ m = &params.transform().matrix();
}
- float depth = geom.order().depthAsFloat();
- DrawWriter::Vertices verts{*writer};
- verts.append(6) << devPoints[0].x << devPoints[0].y << depth << devPoints[0].w // TL
- << devPoints[3].x << devPoints[3].y << depth << devPoints[3].w // BL
- << devPoints[1].x << devPoints[1].y << depth << devPoints[1].w // TR
- << devPoints[1].x << devPoints[1].y << depth << devPoints[1].w // TR
- << devPoints[3].x << devPoints[3].y << depth << devPoints[3].w // BL
- << devPoints[2].x << devPoints[2].y << depth << devPoints[2].w;// BR
+ // Since the local coords always have Z=0, we can discard the 3rd row and column of the matrix.
+ instances.append(1) << bounds << params.order().depthAsFloat() << ssboIndex
+ << m->rc(0,0) << m->rc(1,0) << m->rc(3,0)
+ << m->rc(0,1) << m->rc(1,1) << m->rc(3,1)
+ << m->rc(0,3) << m->rc(1,3) << m->rc(3,3);
}
-void CoverBoundsRenderStep::writeUniforms(const DrawGeometry&, SkPipelineDataGatherer*) const {
- // Control points are pre-transformed to device space on the CPU, so no uniforms needed.
+void CoverBoundsRenderStep::writeUniformsAndTextures(const DrawParams&,
+ SkPipelineDataGatherer*) const {
+ // All data is uploaded as instance attributes, so no uniforms are needed.
}
} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/render/CoverBoundsRenderStep.h b/chromium/third_party/skia/src/gpu/graphite/render/CoverBoundsRenderStep.h
index 2c548ee6e6b..d2487346eaf 100644
--- a/chromium/third_party/skia/src/gpu/graphite/render/CoverBoundsRenderStep.h
+++ b/chromium/third_party/skia/src/gpu/graphite/render/CoverBoundsRenderStep.h
@@ -19,8 +19,8 @@ public:
~CoverBoundsRenderStep() override;
const char* vertexSkSL() const override;
- void writeVertices(DrawWriter*, const DrawGeometry&) const override;
- void writeUniforms(const DrawGeometry&, SkPipelineDataGatherer*) const override;
+ void writeVertices(DrawWriter*, const DrawParams&, int ssboIndex) const override;
+ void writeUniformsAndTextures(const DrawParams&, SkPipelineDataGatherer*) const override;
private:
const bool fInverseFill;
diff --git a/chromium/third_party/skia/src/gpu/graphite/render/MiddleOutFanRenderStep.cpp b/chromium/third_party/skia/src/gpu/graphite/render/MiddleOutFanRenderStep.cpp
index c3a20303687..a0ab293d0f7 100644
--- a/chromium/third_party/skia/src/gpu/graphite/render/MiddleOutFanRenderStep.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/render/MiddleOutFanRenderStep.cpp
@@ -7,7 +7,7 @@
#include "src/gpu/graphite/render/MiddleOutFanRenderStep.h"
-#include "src/gpu/graphite/DrawGeometry.h"
+#include "src/gpu/graphite/DrawParams.h"
#include "src/gpu/graphite/DrawWriter.h"
#include "src/gpu/graphite/render/StencilAndCoverDSS.h"
@@ -25,7 +25,10 @@ MiddleOutFanRenderStep::MiddleOutFanRenderStep(bool evenOdd)
evenOdd ? kEvenOddStencilPass : kWindingStencilPass,
/*vertexAttrs=*/{{"position",
VertexAttribType::kFloat4,
- SkSLType::kFloat4}},
+ SkSLType::kFloat4},
+ {"ssboIndex",
+ VertexAttribType::kInt,
+ SkSLType::kInt}},
/*instanceAttrs=*/{}) {}
MiddleOutFanRenderStep::~MiddleOutFanRenderStep() {}
@@ -34,14 +37,16 @@ const char* MiddleOutFanRenderStep::vertexSkSL() const {
return " float4 devPosition = position;\n";
}
-void MiddleOutFanRenderStep::writeVertices(DrawWriter* writer, const DrawGeometry& geom) const {
+void MiddleOutFanRenderStep::writeVertices(DrawWriter* writer,
+ const DrawParams& params,
+ int ssboIndex) const {
// TODO: Have Shape provide a path-like iterator so we don't actually have to convert non
// paths to SkPath just to iterate their pts/verbs
- SkPath path = geom.shape().asPath();
+ SkPath path = params.geometry().shape().asPath();
const int maxTrianglesInFans = std::max(path.countVerbs() - 2, 0);
- float depth = geom.order().depthAsFloat();
+ float depth = params.order().depthAsFloat();
DrawWriter::Vertices verts{*writer};
verts.reserve(maxTrianglesInFans * 3);
@@ -50,16 +55,20 @@ void MiddleOutFanRenderStep::writeVertices(DrawWriter* writer, const DrawGeometr
// TODO: PathMiddleOutFanIter should use SkV2 instead of SkPoint?
SkV2 p[3] = {{p0.fX, p0.fY}, {p1.fX, p1.fY}, {p2.fX, p2.fY}};
SkV4 devPoints[3];
- geom.transform().mapPoints(p, devPoints, 3);
+ params.transform().mapPoints(p, devPoints, 3);
verts.append(3) << devPoints[0].x << devPoints[0].y << depth << devPoints[0].w // p0
+ << ssboIndex
<< devPoints[1].x << devPoints[1].y << depth << devPoints[1].w // p1
- << devPoints[2].x << devPoints[2].y << depth << devPoints[2].w; // p2
+ << ssboIndex
+ << devPoints[2].x << devPoints[2].y << depth << devPoints[2].w // p2
+ << ssboIndex;
}
}
}
-void MiddleOutFanRenderStep::writeUniforms(const DrawGeometry&, SkPipelineDataGatherer*) const {
+void MiddleOutFanRenderStep::writeUniformsAndTextures(const DrawParams&,
+ SkPipelineDataGatherer*) const {
// Control points are pre-transformed to device space on the CPU, so no uniforms needed.
}
diff --git a/chromium/third_party/skia/src/gpu/graphite/render/MiddleOutFanRenderStep.h b/chromium/third_party/skia/src/gpu/graphite/render/MiddleOutFanRenderStep.h
index 5c082ee37f6..70ca83c7e6a 100644
--- a/chromium/third_party/skia/src/gpu/graphite/render/MiddleOutFanRenderStep.h
+++ b/chromium/third_party/skia/src/gpu/graphite/render/MiddleOutFanRenderStep.h
@@ -22,8 +22,8 @@ public:
~MiddleOutFanRenderStep() override;
const char* vertexSkSL() const override;
- void writeVertices(DrawWriter*, const DrawGeometry&) const override;
- void writeUniforms(const DrawGeometry&, SkPipelineDataGatherer*) const override;
+ void writeVertices(DrawWriter*, const DrawParams&, int ssboIndex) const override;
+ void writeUniformsAndTextures(const DrawParams&, SkPipelineDataGatherer*) const override;
};
} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/render/SDFTextRenderStep.cpp b/chromium/third_party/skia/src/gpu/graphite/render/SDFTextRenderStep.cpp
new file mode 100644
index 00000000000..9642e82894c
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/render/SDFTextRenderStep.cpp
@@ -0,0 +1,186 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "src/gpu/graphite/render/SDFTextRenderStep.h"
+
+#include "src/core/SkPipelineData.h"
+
+#include "include/gpu/graphite/Recorder.h"
+#include "include/private/SkSLString.h"
+#include "src/gpu/graphite/DrawParams.h"
+#include "src/gpu/graphite/DrawWriter.h"
+#include "src/gpu/graphite/RecorderPriv.h"
+#include "src/gpu/graphite/text/AtlasManager.h"
+#include "src/text/gpu/SubRunContainer.h"
+
+namespace skgpu::graphite {
+
+namespace {
+static constexpr DepthStencilSettings kDirectShadingPass = {
+ /*frontStencil=*/{},
+ /*backStencil=*/ {},
+ /*refValue=*/ 0,
+ /*stencilTest=*/ false,
+ /*depthCompare=*/CompareOp::kGEqual,
+ /*depthTest=*/ true,
+ /*depthWrite=*/ true
+};
+
+// We are expecting to sample from up to 4 textures
+constexpr int kNumSDFAtlasTextures = 4;
+} // namespace
+
+SDFTextRenderStep::SDFTextRenderStep(bool isA8)
+ : RenderStep("SDFTextRenderStep",
+ isA8 ? "A8" : "565",
+ Flags::kPerformsShading | Flags::kHasTextures | Flags::kEmitsCoverage,
+ /*uniforms=*/{{"atlasSizeInv", SkSLType::kFloat2},
+ {"distanceAdjust", SkSLType::kFloat}},
+ PrimitiveType::kTriangles,
+ kDirectShadingPass,
+ /*vertexAttrs=*/
+ {{"position", VertexAttribType::kFloat2, SkSLType::kFloat2},
+ {"depth", VertexAttribType::kFloat, SkSLType::kFloat},
+ {"texCoords", VertexAttribType::kUShort2, SkSLType::kUShort2},
+ {"ssboIndex", VertexAttribType::kInt, SkSLType::kInt}},
+ /*instanceAttrs=*/{},
+ /*varyings=*/
+ {{"unormTexCoords", SkSLType::kFloat2},
+ {"textureCoords", SkSLType::kFloat2},
+ {"texIndex", SkSLType::kFloat}}) {
+ // TODO: store if it's A8 and adjust shader
+}
+
+SDFTextRenderStep::~SDFTextRenderStep() {}
+
+const char* SDFTextRenderStep::vertexSkSL() const {
+ return R"(
+ int2 coords = int2(texCoords.x, texCoords.y);
+ int texIdx = coords.x >> 13;
+
+ unormTexCoords = float2(coords.x & 0x1FFF, coords.y);
+ textureCoords = unormTexCoords * atlasSizeInv;
+ texIndex = float(texIdx);
+
+ float4 devPosition = float4(position, depth, 1);
+ )";
+}
+
+std::string SDFTextRenderStep::texturesAndSamplersSkSL(int binding) const {
+ std::string result;
+
+ for (unsigned int i = 0; i < kNumSDFAtlasTextures; ++i) {
+ SkSL::String::appendf(&result,
+ "layout(binding=%d) uniform sampler2D sdf_atlas_%d;\n", binding, i);
+ binding++;
+ }
+
+ return result;
+}
+
+const char* SDFTextRenderStep::fragmentCoverageSkSL() const {
+ // TODO: To minimize the number of shaders generated this is the full affine shader.
+ // For best performance it may be worth creating the uniform scale shader as well,
+ // as that's the most common case.
+ // TODO: Need to add 565 support.
+ // TODO: Need aliased and possibly sRGB support.
+ return R"(
+ half texColor;
+ if (texIndex == 0) {
+ texColor = sample(sdf_atlas_0, textureCoords).r;
+ } else if (texIndex == 1) {
+ texColor = sample(sdf_atlas_1, textureCoords).r;
+ } else if (texIndex == 2) {
+ texColor = sample(sdf_atlas_2, textureCoords).r;
+ } else if (texIndex == 3) {
+ texColor = sample(sdf_atlas_3, textureCoords).r;
+ } else {
+ texColor = sample(sdf_atlas_0, textureCoords).r;
+ }
+ // The distance field is constructed as uchar8_t values, so that the zero value is at 128,
+ // and the supported range of distances is [-4 * 127/128, 4].
+ // Hence to convert to floats our multiplier (width of the range) is 4 * 255/128 = 7.96875
+ // and zero threshold is 128/255 = 0.50196078431.
+ half distance = 7.96875*(texColor - 0.50196078431);
+
+ // We may further adjust the distance for gamma correction.
+ distance -= half(distanceAdjust);
+
+ // After the distance is unpacked, we need to correct it by a factor dependent on the
+ // current transformation. For general transforms, to determine the amount of correction
+ // we multiply a unit vector pointing along the SDF gradient direction by the Jacobian of
+ // unormTexCoords (which is the inverse transform for this fragment) and take the length of
+ // the result.
+ half2 dist_grad = half2(float2(dFdx(distance), dFdy(distance)));
+ half dg_len2 = dot(dist_grad, dist_grad);
+
+ // The length of the gradient may be near 0, so we need to check for that. This also
+ // compensates for the Adreno, which likes to drop tiles on division by 0
+ if (dg_len2 < 0.0001) {
+ dist_grad = half2(0.7071, 0.7071);
+ } else {
+ dist_grad = dist_grad*half(inversesqrt(dg_len2));
+ }
+
+ // Computing the Jacobian and multiplying by the gradient.
+ half2 Jdx = half2(dFdx(unormTexCoords));
+ half2 Jdy = half2(dFdy(unormTexCoords));
+ half2 grad = half2(dist_grad.x*Jdx.x + dist_grad.y*Jdy.x,
+ dist_grad.x*Jdx.y + dist_grad.y*Jdy.y);
+
+ // This gives us a smooth step across approximately one fragment.
+ half afwidth = 0.65*length(grad);
+ // TODO: handle aliased and sRGB rendering
+ half val = smoothstep(-afwidth, afwidth, distance);
+ outputCoverage = half4(val);
+ )";
+}
+
+void SDFTextRenderStep::writeVertices(DrawWriter* dw,
+ const DrawParams& params,
+ int ssboIndex) const {
+ const SubRunData& subRunData = params.geometry().subRunData();
+ subRunData.subRun()->fillVertexData(dw, subRunData.startGlyphIndex(), subRunData.glyphCount(),
+ ssboIndex,
+ params.order().depthAsFloat(),
+ params.transform());
+}
+
+void SDFTextRenderStep::writeUniformsAndTextures(const DrawParams& params,
+ SkPipelineDataGatherer* gatherer) const {
+ SkDEBUGCODE(UniformExpectationsValidator uev(gatherer, this->uniforms());)
+
+ const SubRunData& subRunData = params.geometry().subRunData();
+ unsigned int numProxies;
+ Recorder* recorder = subRunData.recorder();
+ const sk_sp<TextureProxy>* proxies =
+ recorder->priv().atlasManager()->getProxies(subRunData.subRun()->maskFormat(),
+ &numProxies);
+ SkASSERT(proxies && numProxies > 0);
+
+ // write uniforms
+ skvx::float2 atlasDimensionsInverse = {1.f/proxies[0]->dimensions().width(),
+ 1.f/proxies[0]->dimensions().height()};
+ gatherer->write(atlasDimensionsInverse);
+
+ // TODO: get this from DistanceFieldAdjustTable and luminance color (set in SubRunData?)
+ float gammaCorrection = 0.f;
+ gatherer->write(gammaCorrection);
+
+ // write textures and samplers
+ const SkSamplingOptions kSamplingOptions(SkFilterMode::kLinear);
+ constexpr SkTileMode kTileModes[2] = { SkTileMode::kClamp, SkTileMode::kClamp };
+ for (unsigned int i = 0; i < numProxies; ++i) {
+ gatherer->add(kSamplingOptions, kTileModes, proxies[i]);
+ }
+ // If the atlas has less than 4 active proxies we still need to set up samplers for the shader.
+ for (unsigned int i = numProxies; i < kNumSDFAtlasTextures; ++i) {
+ gatherer->add(kSamplingOptions, kTileModes, proxies[0]);
+ }
+}
+
+} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/render/SDFTextRenderStep.h b/chromium/third_party/skia/src/gpu/graphite/render/SDFTextRenderStep.h
new file mode 100644
index 00000000000..6f7fccee979
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/render/SDFTextRenderStep.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef skgpu_graphite_render_SDFTextRenderStep_DEFINED
+#define skgpu_graphite_render_SDFTextRenderStep_DEFINED
+
+#include "src/gpu/graphite/Renderer.h"
+
+namespace skgpu { enum class MaskFormat; }
+
+namespace skgpu::graphite {
+
+class SDFTextRenderStep final : public RenderStep {
+public:
+ SDFTextRenderStep(bool isA8);
+
+ ~SDFTextRenderStep() override;
+
+ const char* vertexSkSL() const override;
+ std::string texturesAndSamplersSkSL(int startBinding) const override;
+ const char* fragmentCoverageSkSL() const override;
+
+ void writeVertices(DrawWriter*, const DrawParams&, int ssboIndex) const override;
+ void writeUniformsAndTextures(const DrawParams&, SkPipelineDataGatherer*) const override;
+};
+
+} // namespace skgpu::graphite
+
+#endif // skgpu_graphite_render_SDFTextRenderStep_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/graphite/render/StencilAndFillPathRenderer.cpp b/chromium/third_party/skia/src/gpu/graphite/render/StencilAndFillPathRenderer.cpp
index 0323722e85b..f585142ba5b 100644
--- a/chromium/third_party/skia/src/gpu/graphite/render/StencilAndFillPathRenderer.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/render/StencilAndFillPathRenderer.cpp
@@ -8,11 +8,13 @@
#include "src/gpu/graphite/Renderer.h"
#include "include/core/SkPathTypes.h"
+#include "include/core/SkVertices.h"
#include "src/gpu/graphite/render/CoverBoundsRenderStep.h"
#include "src/gpu/graphite/render/MiddleOutFanRenderStep.h"
#include "src/gpu/graphite/render/StencilAndCoverDSS.h"
#include "src/gpu/graphite/render/TessellateCurvesRenderStep.h"
#include "src/gpu/graphite/render/TessellateWedgesRenderStep.h"
+#include "src/gpu/graphite/render/VerticesRenderStep.h"
namespace skgpu::graphite {
@@ -106,4 +108,73 @@ const Renderer& Renderer::ConvexTessellatedWedges() {
return kConvexWedgeRenderer;
}
-} // namespace skgpu
+const Renderer& Renderer::Vertices(SkVertices::VertexMode mode, bool hasColors, bool hasTexCoords) {
+ static const VerticesRenderStep kTrianglesStep{PrimitiveType::kTriangles,
+ "triangles",
+ /*hasColor=*/false,
+ /*hasTexture=*/false};
+ static const VerticesRenderStep kTrianglesColorStep{PrimitiveType::kTriangles,
+ "triangles-color",
+ /*hasColor=*/true,
+ /*hasTexture=*/false};
+ static const VerticesRenderStep kTrianglesTexStep{PrimitiveType::kTriangles,
+ "triangles-tex",
+ /*hasColor=*/false,
+ /*hasTexture=*/true};
+ static const VerticesRenderStep kTrianglesColorTexStep{PrimitiveType::kTriangles,
+ "triangles-color-tex",
+ /*hasColor=*/true,
+ /*hasTexture=*/true};
+ static const VerticesRenderStep kTriangleStripStep{PrimitiveType::kTriangleStrip,
+ "triangle-strip",
+ /*hasColor=*/false,
+ /*hasTexture=*/false};
+ static const VerticesRenderStep kTriangleStripColorStep{PrimitiveType::kTriangleStrip,
+ "triangle-strip-color",
+ /*hasColor=*/true,
+ /*hasTexture=*/false};
+ static const VerticesRenderStep kTriangleStripTexStep{PrimitiveType::kTriangleStrip,
+ "triangle-strip-tex",
+ /*hasColor=*/false,
+ /*hasTexture=*/true};
+ static const VerticesRenderStep kTriangleStripColorTexStep{PrimitiveType::kTriangleStrip,
+ "triangle-strip-color-tex",
+ /*hasColor=*/true,
+ /*hasTexture=*/true};
+
+ static const Renderer kTrianglesVerticesRenderer{"Vertices[triangles]", &kTrianglesStep};
+ static const Renderer kTrianglesColorVerticesRenderer{"Vertices[triangles-color]",
+ &kTrianglesColorStep};
+ static const Renderer kTrianglesTexVerticesRenderer{"Vertices[triangles-tex]",
+ &kTrianglesTexStep};
+ static const Renderer kTrianglesColorTexVerticesRenderer{"Vertices[triangles-color-tex]",
+ &kTrianglesColorTexStep};
+ static const Renderer kTriangleStripVerticesRenderer{"Vertices[triangle-strip]",
+ &kTriangleStripStep};
+ static const Renderer kTriangleStripColorVerticesRenderer{"Vertices[triangle-strip-color]",
+ &kTriangleStripColorStep};
+ static const Renderer kTriangleStripTexVerticesRenderer{"Vertices[triangle-strip-tex]",
+ &kTriangleStripTexStep};
+ static const Renderer kTriangleStripColorTexVerticesRenderer{
+ "Vertices[triangle-strip-color-tex]",
+ &kTriangleStripColorTexStep};
+
+ // Assert that the SkVertices builder has converted triangle fans to regular triangles.
+ SkASSERT(mode != SkVertices::kTriangleFan_VertexMode);
+ // There should now only be two possible primary types: triangles and triangle strips.
+ const bool triangleStrips = mode == SkVertices::VertexMode::kTriangleStrip_VertexMode;
+ if (hasColors && hasTexCoords) {
+ return triangleStrips ? kTriangleStripColorTexVerticesRenderer
+ : kTrianglesColorTexVerticesRenderer;
+ } else if (hasColors) {
+ return triangleStrips ? kTriangleStripColorVerticesRenderer
+ : kTrianglesColorVerticesRenderer;
+ } else if (hasTexCoords) {
+ return triangleStrips ? kTriangleStripTexVerticesRenderer
+ : kTrianglesTexVerticesRenderer;
+ } else {
+ return triangleStrips ? kTriangleStripVerticesRenderer
+ : kTrianglesVerticesRenderer;
+ }
+}
+}
diff --git a/chromium/third_party/skia/src/gpu/graphite/render/TessellateCurvesRenderStep.cpp b/chromium/third_party/skia/src/gpu/graphite/render/TessellateCurvesRenderStep.cpp
index bf00f685fed..b57e4189cbe 100644
--- a/chromium/third_party/skia/src/gpu/graphite/render/TessellateCurvesRenderStep.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/render/TessellateCurvesRenderStep.cpp
@@ -7,7 +7,7 @@
#include "src/gpu/graphite/render/TessellateCurvesRenderStep.h"
-#include "src/gpu/graphite/DrawGeometry.h"
+#include "src/gpu/graphite/DrawParams.h"
#include "src/gpu/graphite/DrawWriter.h"
#include "src/gpu/graphite/render/DynamicInstancesPatchAllocator.h"
#include "src/gpu/graphite/render/StencilAndCoverDSS.h"
@@ -26,9 +26,11 @@ using namespace skgpu::tess;
// No explicit curve type, since we assume infinity is supported on GPUs using graphite
// No color or wide color attribs, since it might always be part of the PaintParams
// or we'll add a color-only fast path to RenderStep later.
-static constexpr PatchAttribs kAttribs = PatchAttribs::kPaintDepth;
+static constexpr PatchAttribs kAttribs = PatchAttribs::kPaintDepth |
+ PatchAttribs::kSsboIndex;
using Writer = PatchWriter<DynamicInstancesPatchAllocator<FixedCountCurves>,
Required<PatchAttribs::kPaintDepth>,
+ Required<PatchAttribs::kSsboIndex>,
AddTrianglesWhenChopping,
DiscardFlatCurves>;
@@ -45,7 +47,8 @@ TessellateCurvesRenderStep::TessellateCurvesRenderStep(bool evenOdd)
VertexAttribType::kFloat2, SkSLType::kFloat2}},
/*instanceAttrs=*/{{"p01", VertexAttribType::kFloat4, SkSLType::kFloat4},
{"p23", VertexAttribType::kFloat4, SkSLType::kFloat4},
- {"depth", VertexAttribType::kFloat, SkSLType::kFloat}}) {
+ {"depth", VertexAttribType::kFloat, SkSLType::kFloat},
+ {"ssboIndex", VertexAttribType::kInt, SkSLType::kInt}}) {
SkASSERT(this->instanceStride() == PatchStride(kAttribs));
}
@@ -57,8 +60,10 @@ const char* TessellateCurvesRenderStep::vertexSkSL() const {
"depth, 1.0);\n";
}
-void TessellateCurvesRenderStep::writeVertices(DrawWriter* dw, const DrawGeometry& geom) const {
- SkPath path = geom.shape().asPath(); // TODO: Iterate the Shape directly
+void TessellateCurvesRenderStep::writeVertices(DrawWriter* dw,
+ const DrawParams& params,
+ int ssboIndex) const {
+ SkPath path = params.geometry().shape().asPath(); // TODO: Iterate the Shape directly
BindBufferInfo fixedVertexBuffer = dw->bufferManager()->getStaticBuffer(
BufferType::kVertex,
@@ -72,7 +77,8 @@ void TessellateCurvesRenderStep::writeVertices(DrawWriter* dw, const DrawGeometr
int patchReserveCount = FixedCountCurves::PreallocCount(path.countVerbs());
Writer writer{kAttribs, *dw, fixedVertexBuffer, fixedIndexBuffer, patchReserveCount};
- writer.updatePaintDepthAttrib(geom.order().depthAsFloat());
+ writer.updatePaintDepthAttrib(params.order().depthAsFloat());
+ writer.updateSsboIndexAttrib(ssboIndex);
// TODO: Is it better to pre-transform on the CPU and only have a matrix uniform to compute
// local coords, or is it better to always transform on the GPU (less CPU usage, more
@@ -83,7 +89,7 @@ void TessellateCurvesRenderStep::writeVertices(DrawWriter* dw, const DrawGeometr
// TODO: This doesn't handle perspective yet, and ideally wouldn't go through SkMatrix.
// It may not be relevant, though, if transforms are applied on the GPU and we only need to
// determine an approximate 2x2 for 'shaderXform' and Wang's formula evaluation.
- AffineMatrix m(geom.transform().matrix().asM33());
+ AffineMatrix m(params.transform().matrix().asM33());
// TODO: For filled curves, the path verb loop is simple enough that it's not too big a deal
// to copy the logic from PathCurveTessellator::write_patches. It may be required if we end
@@ -123,7 +129,8 @@ void TessellateCurvesRenderStep::writeVertices(DrawWriter* dw, const DrawGeometr
}
}
-void TessellateCurvesRenderStep::writeUniforms(const DrawGeometry&, SkPipelineDataGatherer*) const {
+void TessellateCurvesRenderStep::writeUniformsAndTextures(const DrawParams&,
+ SkPipelineDataGatherer*) const {
// Control points are pre-transformed to device space on the CPU, so no uniforms needed.
}
diff --git a/chromium/third_party/skia/src/gpu/graphite/render/TessellateCurvesRenderStep.h b/chromium/third_party/skia/src/gpu/graphite/render/TessellateCurvesRenderStep.h
index 5823a1d1094..711cda828d4 100644
--- a/chromium/third_party/skia/src/gpu/graphite/render/TessellateCurvesRenderStep.h
+++ b/chromium/third_party/skia/src/gpu/graphite/render/TessellateCurvesRenderStep.h
@@ -22,8 +22,8 @@ public:
~TessellateCurvesRenderStep() override;
const char* vertexSkSL() const override;
- void writeVertices(DrawWriter*, const DrawGeometry&) const override;
- void writeUniforms(const DrawGeometry&, SkPipelineDataGatherer*) const override;
+ void writeVertices(DrawWriter*, const DrawParams&, int ssboIndex) const override;
+ void writeUniformsAndTextures(const DrawParams&, SkPipelineDataGatherer*) const override;
};
} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/render/TessellateStrokesRenderStep.cpp b/chromium/third_party/skia/src/gpu/graphite/render/TessellateStrokesRenderStep.cpp
index e21407991d5..fd96f844669 100644
--- a/chromium/third_party/skia/src/gpu/graphite/render/TessellateStrokesRenderStep.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/render/TessellateStrokesRenderStep.cpp
@@ -10,7 +10,7 @@
#include "src/core/SkGeometry.h"
#include "src/core/SkPipelineData.h"
-#include "src/gpu/graphite/DrawGeometry.h"
+#include "src/gpu/graphite/DrawParams.h"
#include "src/gpu/graphite/DrawTypes.h"
#include "src/gpu/graphite/DrawWriter.h"
#include "src/gpu/graphite/render/DynamicInstancesPatchAllocator.h"
@@ -46,11 +46,13 @@ static constexpr DepthStencilSettings kDirectShadingPass = {
// or we'll add a color-only fast path to RenderStep later.
static constexpr PatchAttribs kAttribs = PatchAttribs::kJoinControlPoint |
PatchAttribs::kStrokeParams |
- PatchAttribs::kPaintDepth;
+ PatchAttribs::kPaintDepth |
+ PatchAttribs::kSsboIndex;
using Writer = PatchWriter<DynamicInstancesPatchAllocator<FixedCountStrokes>,
Required<PatchAttribs::kJoinControlPoint>,
Required<PatchAttribs::kStrokeParams>,
Required<PatchAttribs::kPaintDepth>,
+ Required<PatchAttribs::kSsboIndex>,
ReplicateLineEndPoints,
TrackJoinControlPoints>;
@@ -70,7 +72,8 @@ TessellateStrokesRenderStep::TessellateStrokesRenderStep()
{"p23", VertexAttribType::kFloat4, SkSLType::kFloat4},
{"prevPoint", VertexAttribType::kFloat2, SkSLType::kFloat2},
{"stroke", VertexAttribType::kFloat2, SkSLType::kFloat2},
- {"depth", VertexAttribType::kFloat, SkSLType::kFloat}}) {}
+ {"depth", VertexAttribType::kFloat, SkSLType::kFloat},
+ {"ssboIndex", VertexAttribType::kInt, SkSLType::kInt}}) {}
TessellateStrokesRenderStep::~TessellateStrokesRenderStep() {}
@@ -82,15 +85,17 @@ const char* TessellateStrokesRenderStep::vertexSkSL() const {
if ((sk_VertexID & 1) != 0) {
edgeID = -edgeID;
}
- float2x2 affine = float2x2(affineMatrix);
+ float2x2 affine = float2x2(affineMatrix.xy, affineMatrix.zw);
float4 devPosition = float4(
tessellate_stroked_curve(edgeID, 16383, affine, translate,
maxScale, p01, p23, prevPoint, stroke),
depth, 1.0);)";
}
-void TessellateStrokesRenderStep::writeVertices(DrawWriter* dw, const DrawGeometry& geom) const {
- SkPath path = geom.shape().asPath(); // TODO: Iterate the Shape directly
+void TessellateStrokesRenderStep::writeVertices(DrawWriter* dw,
+ const DrawParams& params,
+ int ssboIndex) const {
+ SkPath path = params.geometry().shape().asPath(); // TODO: Iterate the Shape directly
int patchReserveCount = FixedCountStrokes::PreallocCount(path.countVerbs());
// Stroke tessellation does not use fixed indices or vertex data, and only needs the vertex ID
@@ -99,29 +104,30 @@ void TessellateStrokesRenderStep::writeVertices(DrawWriter* dw, const DrawGeomet
// we support Vulkan+Swiftshader, we will need the vertex buffer ID fallback unless Swiftshader
// has figured out how to support vertex IDs before then.
Writer writer{kAttribs, *dw, kNullBinding, kNullBinding, patchReserveCount};
- writer.updatePaintDepthAttrib(geom.order().depthAsFloat());
+ writer.updatePaintDepthAttrib(params.order().depthAsFloat());
+ writer.updateSsboIndexAttrib(ssboIndex);
// The vector xform approximates how the control points are transformed by the shader to
// more accurately compute how many *parametric* segments are needed.
// getMaxScale() returns -1 if it can't compute a scale factor (e.g. perspective), taking the
// absolute value automatically converts that to an identity scale factor for our purposes.
- writer.setShaderTransform(wangs_formula::VectorXform{geom.transform()},
- geom.transform().maxScaleFactor());
+ writer.setShaderTransform(wangs_formula::VectorXform{params.transform().matrix()},
+ params.transform().maxScaleFactor());
- SkASSERT(geom.isStroke());
- writer.updateStrokeParamsAttrib({geom.strokeStyle().halfWidth(),
- geom.strokeStyle().joinLimit()});
+ SkASSERT(params.isStroke());
+ writer.updateStrokeParamsAttrib({params.strokeStyle().halfWidth(),
+ params.strokeStyle().joinLimit()});
// TODO: If PatchWriter can handle adding caps to its deferred patches, and we can convert
// hairlines to use round caps instead of square, then StrokeIterator can be deleted entirely.
// Besides being simpler, PatchWriter already has what it needs from the shader matrix and
// stroke params, so we don't have to re-extract them here.
- SkMatrix shaderMatrix = geom.transform();
+ SkMatrix shaderMatrix = params.transform();
SkStrokeRec stroke{SkStrokeRec::kHairline_InitStyle};
- stroke.setStrokeStyle(geom.strokeStyle().width());
- stroke.setStrokeParams(geom.strokeStyle().cap(),
- geom.strokeStyle().join(),
- geom.strokeStyle().miterLimit());
+ stroke.setStrokeStyle(params.strokeStyle().width());
+ stroke.setStrokeParams(params.strokeStyle().cap(),
+ params.strokeStyle().join(),
+ params.strokeStyle().miterLimit());
StrokeIterator strokeIter(path, &stroke, &shaderMatrix);
while (strokeIter.next()) {
using Verb = StrokeIterator::Verb;
@@ -211,22 +217,22 @@ void TessellateStrokesRenderStep::writeVertices(DrawWriter* dw, const DrawGeomet
}
}
-void TessellateStrokesRenderStep::writeUniforms(const DrawGeometry& geom,
- SkPipelineDataGatherer* gatherer) const {
- SkASSERT(geom.transform().type() < Transform::Type::kProjection); // TODO: Implement perspective
+void TessellateStrokesRenderStep::writeUniformsAndTextures(const DrawParams& params,
+ SkPipelineDataGatherer* gatherer) const {
+ SkASSERT(params.transform().type() < Transform::Type::kProjection); // TODO: Implement perspective
SkDEBUGCODE(UniformExpectationsValidator uev(gatherer, this->uniforms());)
// affineMatrix = float4 (2x2 of transform), translate = float2, maxScale = float
// Column-major 2x2 of the transform.
- skvx::float4 upper = {geom.transform().matrix().rc(0, 0), geom.transform().matrix().rc(1, 0),
- geom.transform().matrix().rc(0, 1), geom.transform().matrix().rc(1, 1)};
+ skvx::float4 upper = {params.transform().matrix().rc(0, 0), params.transform().matrix().rc(1, 0),
+ params.transform().matrix().rc(0, 1), params.transform().matrix().rc(1, 1)};
gatherer->write(upper);
- gatherer->write(SkPoint{geom.transform().matrix().rc(0, 3),
- geom.transform().matrix().rc(1, 3)});
+ gatherer->write(SkPoint{params.transform().matrix().rc(0, 3),
+ params.transform().matrix().rc(1, 3)});
- gatherer->write(geom.transform().maxScaleFactor());
+ gatherer->write(params.transform().maxScaleFactor());
}
const Renderer& Renderer::TessellatedStrokes() {
diff --git a/chromium/third_party/skia/src/gpu/graphite/render/TessellateStrokesRenderStep.h b/chromium/third_party/skia/src/gpu/graphite/render/TessellateStrokesRenderStep.h
index 4cfeb1e5369..99e067a74d2 100644
--- a/chromium/third_party/skia/src/gpu/graphite/render/TessellateStrokesRenderStep.h
+++ b/chromium/third_party/skia/src/gpu/graphite/render/TessellateStrokesRenderStep.h
@@ -22,8 +22,8 @@ public:
~TessellateStrokesRenderStep() override;
const char* vertexSkSL() const override;
- void writeVertices(DrawWriter*, const DrawGeometry&) const override;
- void writeUniforms(const DrawGeometry&, SkPipelineDataGatherer*) const override;
+ void writeVertices(DrawWriter*, const DrawParams&, int ssboIndex) const override;
+ void writeUniformsAndTextures(const DrawParams&, SkPipelineDataGatherer*) const override;
};
} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/render/TessellateWedgesRenderStep.cpp b/chromium/third_party/skia/src/gpu/graphite/render/TessellateWedgesRenderStep.cpp
index 5cfd017db18..68458b69c37 100644
--- a/chromium/third_party/skia/src/gpu/graphite/render/TessellateWedgesRenderStep.cpp
+++ b/chromium/third_party/skia/src/gpu/graphite/render/TessellateWedgesRenderStep.cpp
@@ -7,7 +7,7 @@
#include "src/gpu/graphite/render/TessellateWedgesRenderStep.h"
-#include "src/gpu/graphite/DrawGeometry.h"
+#include "src/gpu/graphite/DrawParams.h"
#include "src/gpu/graphite/DrawWriter.h"
#include "src/gpu/graphite/render/DynamicInstancesPatchAllocator.h"
@@ -27,11 +27,13 @@ using namespace skgpu::tess;
// No color or wide color attribs, since it might always be part of the PaintParams
// or we'll add a color-only fast path to RenderStep later.
static constexpr PatchAttribs kAttribs = PatchAttribs::kFanPoint |
- PatchAttribs::kPaintDepth;
+ PatchAttribs::kPaintDepth |
+ PatchAttribs::kSsboIndex;
using Writer = PatchWriter<DynamicInstancesPatchAllocator<FixedCountWedges>,
Required<PatchAttribs::kFanPoint>,
- Required<PatchAttribs::kPaintDepth>>;
+ Required<PatchAttribs::kPaintDepth>,
+ Required<PatchAttribs::kSsboIndex>>;
} // namespace
@@ -51,7 +53,8 @@ TessellateWedgesRenderStep::TessellateWedgesRenderStep(std::string_view variantN
{"p23", VertexAttribType::kFloat4, SkSLType::kFloat4},
{"fanPointAttrib", VertexAttribType::kFloat2,
SkSLType::kFloat2},
- {"depth", VertexAttribType::kFloat, SkSLType::kFloat}}) {
+ {"depth", VertexAttribType::kFloat, SkSLType::kFloat},
+ {"ssboIndex", VertexAttribType::kInt, SkSLType::kInt}}) {
SkASSERT(this->instanceStride() == PatchStride(kAttribs));
}
@@ -63,8 +66,10 @@ const char* TessellateWedgesRenderStep::vertexSkSL() const {
"fanPointAttrib), depth, 1.0);\n";
}
-void TessellateWedgesRenderStep::writeVertices(DrawWriter* dw, const DrawGeometry& geom) const {
- SkPath path = geom.shape().asPath(); // TODO: Iterate the Shape directly
+void TessellateWedgesRenderStep::writeVertices(DrawWriter* dw,
+ const DrawParams& geom,
+ int ssboIndex) const {
+ SkPath path = geom.geometry().shape().asPath(); // TODO: Iterate the Shape directly
BindBufferInfo fixedVertexBuffer = dw->bufferManager()->getStaticBuffer(
BufferType::kVertex,
@@ -78,6 +83,7 @@ void TessellateWedgesRenderStep::writeVertices(DrawWriter* dw, const DrawGeometr
int patchReserveCount = FixedCountWedges::PreallocCount(path.countVerbs());
Writer writer{kAttribs, *dw, fixedVertexBuffer, fixedIndexBuffer, patchReserveCount};
writer.updatePaintDepthAttrib(geom.order().depthAsFloat());
+ writer.updateSsboIndexAttrib(ssboIndex);
// TODO: Is it better to pre-transform on the CPU and only have a matrix uniform to compute
// local coords, or is it better to always transform on the GPU (less CPU usage, more
@@ -154,7 +160,8 @@ void TessellateWedgesRenderStep::writeVertices(DrawWriter* dw, const DrawGeometr
}
}
-void TessellateWedgesRenderStep::writeUniforms(const DrawGeometry&, SkPipelineDataGatherer*) const {
+void TessellateWedgesRenderStep::writeUniformsAndTextures(const DrawParams&,
+ SkPipelineDataGatherer*) const {
// Control points are pre-transformed to device space on the CPU, so no uniforms needed.
}
diff --git a/chromium/third_party/skia/src/gpu/graphite/render/TessellateWedgesRenderStep.h b/chromium/third_party/skia/src/gpu/graphite/render/TessellateWedgesRenderStep.h
index af8e101bc38..9cedd46019f 100644
--- a/chromium/third_party/skia/src/gpu/graphite/render/TessellateWedgesRenderStep.h
+++ b/chromium/third_party/skia/src/gpu/graphite/render/TessellateWedgesRenderStep.h
@@ -20,8 +20,8 @@ public:
~TessellateWedgesRenderStep() override;
const char* vertexSkSL() const override;
- void writeVertices(DrawWriter*, const DrawGeometry&) const override;
- void writeUniforms(const DrawGeometry&, SkPipelineDataGatherer*) const override;
+ void writeVertices(DrawWriter*, const DrawParams&, int ssboIndex) const override;
+ void writeUniformsAndTextures(const DrawParams&, SkPipelineDataGatherer*) const override;
};
diff --git a/chromium/third_party/skia/src/gpu/graphite/render/TextRenderer.cpp b/chromium/third_party/skia/src/gpu/graphite/render/TextRenderer.cpp
new file mode 100644
index 00000000000..1ef4d6ff05d
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/render/TextRenderer.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2021 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "src/gpu/graphite/Renderer.h"
+
+#include "src/gpu/AtlasTypes.h"
+#include "src/gpu/graphite/render/BitmapTextRenderStep.h"
+#include "src/gpu/graphite/render/SDFTextRenderStep.h"
+
+namespace skgpu::graphite {
+
+const Renderer& Renderer::TextDirect(bool isA8) {
+ static const BitmapTextRenderStep kDirectA8{true};
+ static const BitmapTextRenderStep kDirectColor{false};
+
+ static const Renderer kTextDirectA8Renderer{"TextDirectA8Renderer",
+ &kDirectA8};
+ static const Renderer kTextDirectColorRenderer{"TextDirectColorRenderer",
+ &kDirectColor};
+ if (isA8) {
+ return kTextDirectA8Renderer;
+ } else {
+ return kTextDirectColorRenderer;
+ }
+}
+
+const Renderer& Renderer::TextSDF(bool useLCDText) {
+ static const SDFTextRenderStep kA8{false};
+ static const SDFTextRenderStep kLCD{true};
+
+ static const Renderer kTextSDFA8Renderer{"TextSDFA8Renderer",
+ &kA8};
+ static const Renderer kTextSDFLCDRenderer{"TextSDFLCDRenderer",
+ &kLCD};
+
+ if (useLCDText) {
+ return kTextSDFLCDRenderer;
+ } else {
+ return kTextSDFA8Renderer;
+ }
+ SkUNREACHABLE;
+}
+
+} // namespace skgpu
diff --git a/chromium/third_party/skia/src/gpu/graphite/render/VerticesRenderStep.cpp b/chromium/third_party/skia/src/gpu/graphite/render/VerticesRenderStep.cpp
new file mode 100644
index 00000000000..2db9896b5f8
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/render/VerticesRenderStep.cpp
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "src/gpu/graphite/render/VerticesRenderStep.h"
+
+#include "src/core/SkPipelineData.h"
+#include "src/core/SkVertState.h"
+#include "src/core/SkVerticesPriv.h"
+#include "src/gpu/graphite/DrawParams.h"
+#include "src/gpu/graphite/DrawWriter.h"
+#include "src/gpu/graphite/render/StencilAndCoverDSS.h"
+
+namespace skgpu::graphite {
+
+namespace {
+static constexpr DepthStencilSettings kDirectShadingPass = {
+ /*frontStencil=*/{},
+ /*backStencil=*/ {},
+ /*refValue=*/ 0,
+ /*stencilTest=*/ false,
+ /*depthCompare=*/CompareOp::kGreater,
+ /*depthTest=*/ true,
+ /*depthWrite=*/ true
+};
+
+static constexpr Attribute positionAttribute = {"position", VertexAttribType::kFloat2,
+ SkSLType::kFloat2};
+static constexpr Attribute ssboIndexAttribute = {"ssboIndex", VertexAttribType::kInt,
+ SkSLType::kInt};
+static constexpr Attribute textureAttribute = {"texCoords", VertexAttribType::kFloat2,
+ SkSLType::kFloat2};
+// static constexpr Attribute colorAttribute = {"color", VertexAttribType::kFloat4,
+// SkSLType::kFloat4};
+
+static constexpr std::initializer_list<Attribute> positionOnly = {positionAttribute,
+ ssboIndexAttribute};
+// static constexpr std::initializer_list<Attribute> withColor = {positionAttribute,
+// colorAttribute};
+static constexpr std::initializer_list<Attribute> withTexture = {positionAttribute,
+ textureAttribute,
+ ssboIndexAttribute};
+// static constexpr std::initializer_list<Attribute> withTextureAndColor = {positionAttribute,
+// colorAttribute,
+// textureAttribute};
+
+// static constexpr std::initializer_list<Attribute> attributeArray [4] = { positionOnly, withColor,
+// withTexture,
+// withTextureAndColor };
+} // namespace
+
+VerticesRenderStep::VerticesRenderStep(PrimitiveType type, std::string_view variantName,
+ bool hasColor, bool hasTexture)
+ : RenderStep("VerticesRenderStep",
+ variantName,
+ Flags::kPerformsShading,
+ /*uniforms=*/{{"depth", SkSLType::kFloat}},
+ type,
+ kDirectShadingPass,
+ // TODO: Select attributes based upon whether the vertices has color and/or
+ // texture information.
+ /*vertexAttrs=*/hasTexture ? withTexture : positionOnly,
+ /*instanceAttrs=*/{})
+ , fHasColor(hasColor)
+ , fHasTexture(hasTexture) {
+ // TODO: Remove the following line once fHasColor is used. Here for now to prevent a warning.
+ (void) fHasColor;
+}
+
+VerticesRenderStep::~VerticesRenderStep() {}
+
+const char* VerticesRenderStep::vertexSkSL() const {
+ // Add cases for color and color+texture.
+ if (fHasTexture) {
+ return R"(
+ float4 devPosition = float4(position, 1.0, 1.0);
+ stepLocalCoords = texCoords;
+ )";
+ } else {
+ return R"(
+ float4 devPosition = float4(position, 1.0, 1.0);
+ stepLocalCoords = position;
+ )";
+ }
+}
+
+void VerticesRenderStep::writeVertices(DrawWriter* writer,
+ const DrawParams& params,
+ int ssboIndex) const {
+ // TODO: Instead of fHasColor and fHasTexture, use info() and assert.
+ // Add cases for color and color+texture.
+ if (fHasTexture) {
+ this->writeVerticesTexture(writer, params, ssboIndex);
+ } else {
+ SkVerticesPriv info(params.geometry().vertices()->priv());
+ const int vertexCount = info.vertexCount();
+ const int indexCount = info.indexCount();
+ const SkPoint* positions = info.positions();
+ const uint16_t* indices = info.indices();
+
+ DrawWriter::Vertices verts{*writer};
+ verts.reserve(indexCount);
+
+ VertState state(vertexCount, indices, indexCount);
+ VertState::Proc vertProc = state.chooseProc(info.mode());
+ while (vertProc(&state)) {
+ SkV2 p[3] = {{positions[state.f0].x(), positions[state.f0].y()},
+ {positions[state.f1].x(), positions[state.f1].y()},
+ {positions[state.f2].x(), positions[state.f2].y()}};
+ SkV4 devPoints[3];
+ params.transform().mapPoints(p, devPoints, 3);
+ verts.append(3) << devPoints[0].x << devPoints[0].y << ssboIndex
+ << devPoints[1].x << devPoints[1].y << ssboIndex
+ << devPoints[2].x << devPoints[2].y << ssboIndex;
+ }
+ }
+}
+
+void VerticesRenderStep::writeUniformsAndTextures(const DrawParams& params,
+ SkPipelineDataGatherer* gatherer) const {
+ // Vertices are currently pre-transformed to device space on the CPU so no transformation matrix
+ // is needed. Store PaintDepth as a uniform to avoid copying the same depth for each vertex.
+ SkDEBUGCODE(UniformExpectationsValidator uev(gatherer, this->uniforms());)
+ gatherer->write(params.order().depthAsFloat());
+}
+
+void VerticesRenderStep::writeVerticesTexture(DrawWriter* writer, const DrawParams& params,
+ int ssboIndex) const {
+ SkVerticesPriv info(params.geometry().vertices()->priv());
+ const int vertexCount = info.vertexCount();
+ const int indexCount = info.indexCount();
+ const SkPoint* positions = info.positions();
+ const uint16_t* indices = info.indices();
+ const SkPoint* texCoords = info.texCoords();
+
+ DrawWriter::Vertices verts{*writer};
+
+ VertState state(vertexCount, indices, indexCount);
+ VertState::Proc vertProc = state.chooseProc(info.mode());
+ while (vertProc(&state)) {
+ SkV2 p[3] = {{positions[state.f0].x(), positions[state.f0].y()},
+ {positions[state.f1].x(), positions[state.f1].y()},
+ {positions[state.f2].x(), positions[state.f2].y()}};
+
+ SkV4 devPoints[3];
+ params.transform().mapPoints(p, devPoints, 3);
+
+ verts.append(3) << devPoints[0].x << devPoints[0].y << texCoords[state.f0] << ssboIndex
+ << devPoints[1].x << devPoints[1].y << texCoords[state.f1] << ssboIndex
+ << devPoints[2].x << devPoints[2].y << texCoords[state.f2] << ssboIndex;
+ }
+}
+
+} // namespace skgpu::graphite
diff --git a/chromium/third_party/skia/src/gpu/graphite/render/VerticesRenderStep.h b/chromium/third_party/skia/src/gpu/graphite/render/VerticesRenderStep.h
new file mode 100644
index 00000000000..3ceee2be23c
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/render/VerticesRenderStep.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef skgpu_graphite_render_VerticesRenderStep_DEFINED
+#define skgpu_graphite_render_VerticesRenderStep_DEFINED
+
+#include "include/core/SkVertices.h"
+#include "src/gpu/graphite/Renderer.h"
+
+namespace skgpu::graphite {
+
+class VerticesRenderStep final : public RenderStep {
+public:
+ explicit VerticesRenderStep(PrimitiveType, std::string_view, bool hasColor, bool hasTexture);
+
+ ~VerticesRenderStep() override;
+
+ const char* vertexSkSL() const override;
+ void writeVertices(DrawWriter* writer, const DrawParams& params, int ssboIndex) const override;
+ void writeUniformsAndTextures(const DrawParams&, SkPipelineDataGatherer*) const override;
+
+private:
+ bool fHasColor;
+ bool fHasTexture;
+
+ void writeVerticesTexture(DrawWriter* writer, const DrawParams& params, int ssboIndex) const;
+};
+
+} // namespace skgpu::graphite
+
+#endif // skgpu_graphite_render_VerticesRenderStep_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/graphite/text/AtlasManager.cpp b/chromium/third_party/skia/src/gpu/graphite/text/AtlasManager.cpp
new file mode 100644
index 00000000000..879a1023f92
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/text/AtlasManager.cpp
@@ -0,0 +1,362 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "src/gpu/graphite/text/AtlasManager.h"
+
+#include "include/core/SkColorSpace.h"
+#include "include/gpu/graphite/Recorder.h"
+#include "src/codec/SkMasks.h"
+#include "src/core/SkAutoMalloc.h"
+#include "src/core/SkDistanceFieldGen.h"
+#include "src/gpu/graphite/DrawAtlas.h"
+#include "src/gpu/graphite/RecorderPriv.h"
+#include "src/gpu/graphite/TextureProxy.h"
+#include "src/sksl/SkSLUtil.h"
+#include "src/text/gpu/Glyph.h"
+#include "src/text/gpu/GlyphVector.h"
+#include "src/text/gpu/StrikeCache.h"
+
+using Glyph = sktext::gpu::Glyph;
+
+namespace skgpu::graphite {
+
+AtlasManager::AtlasManager(Recorder* recorder)
+ : fRecorder(recorder)
+ , fSupportBilerpAtlas{recorder->priv().caps()->supportBilerpFromGlyphAtlas()}
+ , fAtlasConfig{recorder->priv().caps()->maxTextureSize(),
+ recorder->priv().caps()->glyphCacheTextureMaximumBytes()} {
+ if (!recorder->priv().caps()->allowMultipleGlyphCacheTextures() ||
+ // multitexturing supported only if range can represent the index + texcoords fully
+ !(recorder->priv().caps()->shaderCaps()->fFloatIs32Bits ||
+ recorder->priv().caps()->shaderCaps()->fIntegerSupport)) {
+ fAllowMultitexturing = DrawAtlas::AllowMultitexturing::kNo;
+ } else {
+ fAllowMultitexturing = DrawAtlas::AllowMultitexturing::kYes;
+ }
+}
+
+AtlasManager::~AtlasManager() = default;
+
+void AtlasManager::freeAll() {
+ for (int i = 0; i < kMaskFormatCount; ++i) {
+ fAtlases[i] = nullptr;
+ }
+}
+
+bool AtlasManager::hasGlyph(MaskFormat format, Glyph* glyph) {
+ SkASSERT(glyph);
+ return this->getAtlas(format)->hasID(glyph->fAtlasLocator.plotLocator());
+}
+
+template <typename INT_TYPE>
+static void expand_bits(INT_TYPE* dst,
+ const uint8_t* src,
+ int width,
+ int height,
+ int dstRowBytes,
+ int srcRowBytes) {
+ for (int y = 0; y < height; ++y) {
+ int rowWritesLeft = width;
+ const uint8_t* s = src;
+ INT_TYPE* d = dst;
+ while (rowWritesLeft > 0) {
+ unsigned mask = *s++;
+ for (int x = 7; x >= 0 && rowWritesLeft; --x, --rowWritesLeft) {
+ *d++ = (mask & (1 << x)) ? (INT_TYPE)(~0UL) : 0;
+ }
+ }
+ dst = reinterpret_cast<INT_TYPE*>(reinterpret_cast<intptr_t>(dst) + dstRowBytes);
+ src += srcRowBytes;
+ }
+}
+
+static void get_packed_glyph_image(
+ const SkGlyph& glyph, int dstRB, MaskFormat expectedMaskFormat, void* dst) {
+ const int width = glyph.width();
+ const int height = glyph.height();
+ const void* src = glyph.image();
+ SkASSERT(src != nullptr);
+
+ MaskFormat maskFormat = Glyph::FormatFromSkGlyph(glyph.maskFormat());
+ if (maskFormat == expectedMaskFormat) {
+ int srcRB = glyph.rowBytes();
+ // Notice this comparison is with the glyphs raw mask format, and not its MaskFormat.
+ if (glyph.maskFormat() != SkMask::kBW_Format) {
+ if (srcRB != dstRB) {
+ const int bbp = MaskFormatBytesPerPixel(expectedMaskFormat);
+ for (int y = 0; y < height; y++) {
+ memcpy(dst, src, width * bbp);
+ src = (const char*) src + srcRB;
+ dst = (char*) dst + dstRB;
+ }
+ } else {
+ memcpy(dst, src, dstRB * height);
+ }
+ } else {
+ // Handle 8-bit format by expanding the mask to the expected format.
+ const uint8_t* bits = reinterpret_cast<const uint8_t*>(src);
+ switch (expectedMaskFormat) {
+ case MaskFormat::kA8: {
+ uint8_t* bytes = reinterpret_cast<uint8_t*>(dst);
+ expand_bits(bytes, bits, width, height, dstRB, srcRB);
+ break;
+ }
+ case MaskFormat::kA565: {
+ uint16_t* rgb565 = reinterpret_cast<uint16_t*>(dst);
+ expand_bits(rgb565, bits, width, height, dstRB, srcRB);
+ break;
+ }
+ default:
+ SK_ABORT("Invalid MaskFormat");
+ }
+ }
+ } else if (maskFormat == MaskFormat::kA565 &&
+ expectedMaskFormat == MaskFormat::kARGB) {
+ // Convert if the glyph uses a 565 mask format since it is using LCD text rendering
+ // but the expected format is 8888 (will happen on Intel MacOS with Metal since that
+ // combination does not support 565).
+ static constexpr SkMasks masks{
+ {0b1111'1000'0000'0000, 11, 5}, // Red
+ {0b0000'0111'1110'0000, 5, 6}, // Green
+ {0b0000'0000'0001'1111, 0, 5}, // Blue
+ {0, 0, 0} // Alpha
+ };
+ constexpr int a565Bpp = MaskFormatBytesPerPixel(MaskFormat::kA565);
+ constexpr int argbBpp = MaskFormatBytesPerPixel(MaskFormat::kARGB);
+ for (int y = 0; y < height; y++) {
+ for (int x = 0; x < width; x++) {
+ uint16_t color565 = 0;
+ memcpy(&color565, src, a565Bpp);
+ // TODO: create Graphite version of GrColorPackRGBA?
+ uint32_t colorRGBA = masks.getRed(color565) |
+ (masks.getGreen(color565) << 8) |
+ (masks.getBlue(color565) << 16) |
+ (0xFF << 24);
+ memcpy(dst, &colorRGBA, argbBpp);
+ src = (char*)src + a565Bpp;
+ dst = (char*)dst + argbBpp;
+ }
+ }
+ } else {
+ SkUNREACHABLE;
+ }
+}
+
+MaskFormat AtlasManager::resolveMaskFormat(MaskFormat format) const {
+ if (MaskFormat::kA565 == format &&
+ !fRecorder->priv().caps()->getDefaultSampledTextureInfo(kRGB_565_SkColorType, 1,
+ Protected::kNo,
+ Renderable::kNo).isValid()) {
+ format = MaskFormat::kARGB;
+ }
+ return format;
+}
+
+// Returns kSucceeded if glyph successfully added to texture atlas, kTryAgain if a RenderPassTask
+// needs to be snapped before adding the glyph, and kError if it can't be added at all.
+DrawAtlas::ErrorCode AtlasManager::addGlyphToAtlas(const SkGlyph& skGlyph,
+ Glyph* glyph,
+ int srcPadding) {
+ SkASSERT(0 <= srcPadding && srcPadding <= SK_DistanceFieldInset);
+
+ if (skGlyph.image() == nullptr) {
+ return DrawAtlas::ErrorCode::kError;
+ }
+ SkASSERT(glyph != nullptr);
+
+ MaskFormat glyphFormat = Glyph::FormatFromSkGlyph(skGlyph.maskFormat());
+ MaskFormat expectedMaskFormat = this->resolveMaskFormat(glyphFormat);
+ int bytesPerPixel = MaskFormatBytesPerPixel(expectedMaskFormat);
+
+ int padding;
+ switch (srcPadding) {
+ case 0:
+ // The direct mask/image case.
+ padding = 0;
+ if (fSupportBilerpAtlas) {
+ // Force direct masks (glyph with no padding) to have padding.
+ padding = 1;
+ srcPadding = 1;
+ }
+ break;
+ case 1:
+ // The transformed mask/image case.
+ padding = 1;
+ break;
+ case SK_DistanceFieldInset:
+ // The SDFT case.
+ // If the srcPadding == SK_DistanceFieldInset (SDFT case) then the padding is built
+ // into the image on the glyph; no extra padding needed.
+ // TODO: can the SDFT glyph image in the cache be reduced by the padding?
+ padding = 0;
+ break;
+ default:
+ // The padding is not one of the know forms.
+ return DrawAtlas::ErrorCode::kError;
+ }
+
+ const int width = skGlyph.width() + 2*padding;
+ const int height = skGlyph.height() + 2*padding;
+ int rowBytes = width * bytesPerPixel;
+ size_t size = height * rowBytes;
+
+ // Temporary storage for normalizing glyph image.
+ SkAutoSMalloc<1024> storage(size);
+ void* dataPtr = storage.get();
+ if (padding > 0) {
+ sk_bzero(dataPtr, size);
+ // Advance in one row and one column.
+ dataPtr = (char*)(dataPtr) + rowBytes + bytesPerPixel;
+ }
+
+ get_packed_glyph_image(skGlyph, rowBytes, expectedMaskFormat, dataPtr);
+
+ DrawAtlas* atlas = this->getAtlas(expectedMaskFormat);
+ auto errorCode = atlas->addToAtlas(fRecorder,
+ width,
+ height,
+ storage.get(),
+ &glyph->fAtlasLocator);
+
+ if (errorCode == DrawAtlas::ErrorCode::kSucceeded) {
+ glyph->fAtlasLocator.insetSrc(srcPadding);
+ }
+
+ return errorCode;
+}
+
+bool AtlasManager::recordUploads(DrawContext* dc) {
+ for (int i = 0; i < skgpu::kMaskFormatCount; i++) {
+ if (fAtlases[i] && !fAtlases[i]->recordUploads(dc, fRecorder)) {
+ return false;
+ }
+ }
+
+ fRecorder->priv().tokenTracker()->issueFlushToken();
+ return true;
+}
+
+void AtlasManager::addGlyphToBulkAndSetUseToken(BulkUsePlotUpdater* updater,
+ MaskFormat format, Glyph* glyph,
+ DrawToken token) {
+ SkASSERT(glyph);
+ if (updater->add(glyph->fAtlasLocator)) {
+ this->getAtlas(format)->setLastUseToken(glyph->fAtlasLocator, token);
+ }
+}
+
+void AtlasManager::setAtlasDimensionsToMinimum_ForTesting() {
+ // Delete any old atlases.
+ // This should be safe to do as long as we are not in the middle of a flush.
+ for (int i = 0; i < skgpu::kMaskFormatCount; i++) {
+ fAtlases[i] = nullptr;
+ }
+
+ // Set all the atlas sizes to 1x1 plot each.
+ new (&fAtlasConfig) DrawAtlasConfig{2048, 0};
+}
+
+bool AtlasManager::initAtlas(MaskFormat format) {
+ int index = MaskFormatToAtlasIndex(format);
+ if (fAtlases[index] == nullptr) {
+ SkColorType colorType = MaskFormatToColorType(format);
+ SkISize atlasDimensions = fAtlasConfig.atlasDimensions(format);
+ SkISize plotDimensions = fAtlasConfig.plotDimensions(format);
+ fAtlases[index] = DrawAtlas::Make(colorType,
+ SkColorTypeBytesPerPixel(colorType),
+ atlasDimensions.width(), atlasDimensions.height(),
+ plotDimensions.width(), plotDimensions.height(),
+ this,
+ fAllowMultitexturing,
+ nullptr,
+ /*label=*/"TextAtlas");
+ if (!fAtlases[index]) {
+ return false;
+ }
+ }
+ return true;
+}
+
+} // namespace skgpu::graphite
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace sktext::gpu {
+
+using DrawAtlas = skgpu::graphite::DrawAtlas;
+
+std::tuple<bool, int> GlyphVector::regenerateAtlas(int begin, int end,
+ skgpu::MaskFormat maskFormat,
+ int srcPadding,
+ skgpu::graphite::Recorder* recorder) {
+ auto atlasManager = recorder->priv().atlasManager();
+ auto tokenTracker = recorder->priv().tokenTracker();
+
+ // TODO: this is not a great place for this -- need a better way to init atlases when needed
+ unsigned int numActiveProxies;
+ const sk_sp<skgpu::graphite::TextureProxy>* proxies =
+ atlasManager->getProxies(maskFormat, &numActiveProxies);
+ if (!proxies) {
+ SkDebugf("Could not allocate backing texture for atlas\n");
+ return {false, 0};
+ }
+
+ uint64_t currentAtlasGen = atlasManager->atlasGeneration(maskFormat);
+
+ this->packedGlyphIDToGlyph(recorder->priv().strikeCache());
+
+ if (fAtlasGeneration != currentAtlasGen) {
+ // Calculate the texture coordinates for the vertexes during first use (fAtlasGeneration
+ // is set to kInvalidAtlasGeneration) or the atlas has changed in subsequent calls..
+ fBulkUseUpdater.reset();
+
+ SkBulkGlyphMetricsAndImages metricsAndImages{fTextStrike->strikeSpec()};
+
+ // Update the atlas information in the GrStrike.
+ auto glyphs = fGlyphs.subspan(begin, end - begin);
+ int glyphsPlacedInAtlas = 0;
+ bool success = true;
+ for (const Variant& variant : glyphs) {
+ Glyph* gpuGlyph = variant.glyph;
+ SkASSERT(gpuGlyph != nullptr);
+
+ if (!atlasManager->hasGlyph(maskFormat, gpuGlyph)) {
+ const SkGlyph& skGlyph = *metricsAndImages.glyph(gpuGlyph->fPackedID);
+ auto code = atlasManager->addGlyphToAtlas(skGlyph, gpuGlyph, srcPadding);
+ if (code != DrawAtlas::ErrorCode::kSucceeded) {
+ success = code != DrawAtlas::ErrorCode::kError;
+ break;
+ }
+ }
+ atlasManager->addGlyphToBulkAndSetUseToken(
+ &fBulkUseUpdater, maskFormat, gpuGlyph,
+ tokenTracker->nextTokenToFlush());
+ glyphsPlacedInAtlas++;
+ }
+
+ // Update atlas generation if there are no more glyphs to put in the atlas.
+ if (success && begin + glyphsPlacedInAtlas == SkCount(fGlyphs)) {
+ // Need to get the freshest value of the atlas' generation because
+ // updateTextureCoordinates may have changed it.
+ fAtlasGeneration = atlasManager->atlasGeneration(maskFormat);
+ }
+
+ return {success, glyphsPlacedInAtlas};
+ } else {
+ // The atlas hasn't changed, so our texture coordinates are still valid.
+ if (end == SkCount(fGlyphs)) {
+ // The atlas hasn't changed and the texture coordinates are all still valid. Update
+ // all the plots used to the new use token.
+ atlasManager->setUseTokenBulk(fBulkUseUpdater,
+ tokenTracker->nextTokenToFlush(),
+ maskFormat);
+ }
+ return {true, end - begin};
+ }
+}
+
+} // namespace sktext::gpu
diff --git a/chromium/third_party/skia/src/gpu/graphite/text/AtlasManager.h b/chromium/third_party/skia/src/gpu/graphite/text/AtlasManager.h
new file mode 100644
index 00000000000..4e5e27d7658
--- /dev/null
+++ b/chromium/third_party/skia/src/gpu/graphite/text/AtlasManager.h
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef skgpu_graphite_AtlasManager_DEFINED
+#define skgpu_graphite_AtlasManager_DEFINED
+
+#include "include/gpu/graphite/TextureInfo.h"
+#include "src/gpu/AtlasTypes.h"
+#include "src/gpu/graphite/Caps.h"
+#include "src/gpu/graphite/DrawAtlas.h"
+
+namespace sktext::gpu {
+class Glyph;
+}
+class SkGlyph;
+
+namespace skgpu::graphite {
+
+class DrawContext;
+class Recorder;
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/** The AtlasManager manages the lifetime of and access to DrawAtlases.
+ */
+class AtlasManager : public AtlasGenerationCounter {
+public:
+ AtlasManager(Recorder*);
+ ~AtlasManager();
+
+ // If getProxies returns nullptr, the client must not try to use other functions on the
+ // StrikeCache which use the atlas. This function *must* be called first, before other
+ // functions which use the atlas.
+ const sk_sp<TextureProxy>* getProxies(MaskFormat format,
+ unsigned int* numActiveProxies) {
+ format = this->resolveMaskFormat(format);
+ if (this->initAtlas(format)) {
+ *numActiveProxies = this->getAtlas(format)->numActivePages();
+ return this->getAtlas(format)->getProxies();
+ }
+ *numActiveProxies = 0;
+ return nullptr;
+ }
+
+ void freeAll();
+
+ bool hasGlyph(MaskFormat, sktext::gpu::Glyph*);
+
+ DrawAtlas::ErrorCode addGlyphToAtlas(const SkGlyph&,
+ sktext::gpu::Glyph*,
+ int srcPadding);
+
+ // To ensure the DrawAtlas does not evict the Glyph Mask from its texture backing store,
+ // the client must pass in the current draw token along with the sktext::gpu::Glyph.
+ // A BulkUsePlotUpdater is used to manage bulk last use token updating in the Atlas.
+ // For convenience, this function will also set the use token for the current glyph if required
+ // NOTE: the bulk uploader is only valid if the subrun has a valid atlasGeneration
+ void addGlyphToBulkAndSetUseToken(BulkUsePlotUpdater*, MaskFormat,
+ sktext::gpu::Glyph*, DrawToken);
+
+ void setUseTokenBulk(const BulkUsePlotUpdater& updater,
+ DrawToken token,
+ MaskFormat format) {
+ this->getAtlas(format)->setLastUseTokenBulk(updater, token);
+ }
+
+ bool recordUploads(DrawContext* dc);
+
+ // Some clients may wish to verify the integrity of the texture backing store of the
+ // GrDrawOpAtlas. The atlasGeneration returned below is a monotonically increasing number which
+ // changes every time something is removed from the texture backing store.
+ uint64_t atlasGeneration(skgpu::MaskFormat format) const {
+ return this->getAtlas(format)->atlasGeneration();
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Functions intended debug only
+
+ void setAtlasDimensionsToMinimum_ForTesting();
+ void setMaxPages_TestingOnly(uint32_t maxPages);
+
+private:
+ bool initAtlas(MaskFormat);
+ // Change an expected 565 mask format to 8888 if 565 is not supported (will happen when using
+ // Metal on Intel MacOS). The actual conversion of the data is handled in
+ // get_packed_glyph_image() in StrikeCache.cpp
+ MaskFormat resolveMaskFormat(MaskFormat format) const;
+
+ // There is a 1:1 mapping between skgpu::MaskFormats and atlas indices
+ static int MaskFormatToAtlasIndex(skgpu::MaskFormat format) {
+ return static_cast<int>(format);
+ }
+ static skgpu::MaskFormat AtlasIndexToMaskFormat(int idx) {
+ return static_cast<skgpu::MaskFormat>(idx);
+ }
+
+ DrawAtlas* getAtlas(skgpu::MaskFormat format) const {
+ format = this->resolveMaskFormat(format);
+ int atlasIndex = MaskFormatToAtlasIndex(format);
+ SkASSERT(fAtlases[atlasIndex]);
+ return fAtlases[atlasIndex].get();
+ }
+
+ Recorder* fRecorder;
+ DrawAtlas::AllowMultitexturing fAllowMultitexturing;
+ std::unique_ptr<DrawAtlas> fAtlases[kMaskFormatCount];
+ static_assert(kMaskFormatCount == 3);
+ bool fSupportBilerpAtlas;
+ DrawAtlasConfig fAtlasConfig;
+};
+
+} // namespace skgpu::graphite
+
+#endif // skgpu_graphite_AtlasManager_DEFINED
diff --git a/chromium/third_party/skia/src/gpu/tessellate/PatchWriter.h b/chromium/third_party/skia/src/gpu/tessellate/PatchWriter.h
index d2cc59d0aea..5bb8d753498 100644
--- a/chromium/third_party/skia/src/gpu/tessellate/PatchWriter.h
+++ b/chromium/third_party/skia/src/gpu/tessellate/PatchWriter.h
@@ -227,6 +227,7 @@ class PatchWriter {
DEF_ATTRIB_TYPE(ColorAttrib, PatchAttribs::kColor, Color);
DEF_ATTRIB_TYPE(DepthAttrib, PatchAttribs::kPaintDepth, float);
DEF_ATTRIB_TYPE(CurveTypeAttrib, PatchAttribs::kExplicitCurveType, float);
+ DEF_ATTRIB_TYPE(SsboIndexAttrib, PatchAttribs::kSsboIndex, int);
#undef DEF_ATTRIB_TYPE
static constexpr size_t kMaxStride = 4 * sizeof(SkPoint) + // control points
@@ -235,7 +236,8 @@ class PatchWriter {
(StrokeAttrib::kEnabled ? sizeof(StrokeParams) : 0) +
(ColorAttrib::kEnabled ? std::min(sizeof(Color), sizeof(SkPMColor4f)) : 0) +
(DepthAttrib::kEnabled ? sizeof(float) : 0) +
- (CurveTypeAttrib::kEnabled ? sizeof(float) : 0);
+ (CurveTypeAttrib::kEnabled ? sizeof(float) : 0) +
+ (SsboIndexAttrib::kEnabled ? sizeof(int) : 0);
// Types that vary depending on the activated features, but do not define the patch data.
using DeferredPatch = std::conditional_t<kTrackJoinControlPoints,
@@ -258,7 +260,8 @@ public:
, fFanPoint(attribs)
, fStrokeParams(attribs)
, fColor(attribs)
- , fDepth(attribs) {
+ , fDepth(attribs)
+ , fSsboIndex(attribs) {
// Explicit curve types are provided on the writePatch signature, and not a field of
// PatchWriter, so initialize one in the ctor to validate the provided runtime attribs.
SkDEBUGCODE((void) CurveTypeAttrib(attribs);)
@@ -359,6 +362,13 @@ public:
fDepth = depth;
}
+ // Updates the storage buffer index used to access uniforms.
+ ENABLE_IF(SsboIndexAttrib::kEnabled)
+ updateSsboIndexAttrib(int ssboIndex) {
+ SkASSERT(fAttribs & PatchAttribs::kSsboIndex);
+ fSsboIndex = ssboIndex;
+ }
+
/**
* writeX functions for supported patch geometry types. Every geometric type is converted to an
* equivalent cubic or conic, so this will always write at minimum 8 floats for the four control
@@ -490,7 +500,7 @@ private:
float explicitCurveType) {
// NOTE: operator<< overrides automatically handle optional and disabled attribs.
vertexWriter << join << fFanPoint << fStrokeParams << fColor << fDepth
- << CurveTypeAttrib{fAttribs, explicitCurveType};
+ << CurveTypeAttrib{fAttribs, explicitCurveType} << fSsboIndex;
}
AI VertexWriter appendPatch() {
@@ -724,6 +734,11 @@ private:
StrokeAttrib fStrokeParams;
ColorAttrib fColor;
DepthAttrib fDepth;
+
+ // Index into a shared storage buffer containing this PatchWriter's patches' corresponding
+ // uniforms. Written out as an attribute with every patch, to read the appropriate uniform
+ // values from the storage buffer on draw.
+ SsboIndexAttrib fSsboIndex;
};
} // namespace skgpu::tess
diff --git a/chromium/third_party/skia/src/gpu/tessellate/Tessellation.h b/chromium/third_party/skia/src/gpu/tessellate/Tessellation.h
index 8cb33d5b68c..173530c6674 100644
--- a/chromium/third_party/skia/src/gpu/tessellate/Tessellation.h
+++ b/chromium/third_party/skia/src/gpu/tessellate/Tessellation.h
@@ -78,6 +78,8 @@ enum class PatchAttribs {
kColor = 1 << 3, // [ubyte4 or float4] Used when patches have different colors.
kPaintDepth = 1 << 4, // [float] Used in Graphite to specify depth attachment value for draw.
kExplicitCurveType = 1 << 5, // [float] Used when GPU can't infer curve type based on infinity.
+ kSsboIndex = 1 << 7, // [int] Used to index into a shared storage buffer for this patch's
+ // uniform values.
// Extra flags.
kWideColorIfEnabled = 1 << 6, // If kColor is set, specifies it to be float4 wide color.
@@ -87,9 +89,9 @@ GR_MAKE_BITFIELD_CLASS_OPS(PatchAttribs)
// When PatchAttribs::kExplicitCurveType is set, these are the values that tell the GPU what type of
// curve is being drawn.
-constexpr static float kCubicCurveType SK_MAYBE_UNUSED = 0;
-constexpr static float kConicCurveType SK_MAYBE_UNUSED = 1;
-constexpr static float kTriangularConicCurveType SK_MAYBE_UNUSED = 2; // Conic curve with w=Inf.
+constexpr static float kCubicCurveType [[maybe_unused]] = 0;
+constexpr static float kConicCurveType [[maybe_unused]] = 1;
+constexpr static float kTriangularConicCurveType [[maybe_unused]] = 2; // Conic curve with w=Inf.
// Returns the packed size in bytes of the attribs portion of tessellation patches (or instances) in
// GPU buffers.
@@ -101,7 +103,8 @@ constexpr size_t PatchAttribsStride(PatchAttribs attribs) {
? (attribs & PatchAttribs::kWideColorIfEnabled ? sizeof(float)
: sizeof(uint8_t)) * 4 : 0) +
(attribs & PatchAttribs::kPaintDepth ? sizeof(float) : 0) +
- (attribs & PatchAttribs::kExplicitCurveType ? sizeof(float) : 0);
+ (attribs & PatchAttribs::kExplicitCurveType ? sizeof(float) : 0) +
+ (attribs & PatchAttribs::kSsboIndex ? (sizeof(int)) : 0);
}
constexpr size_t PatchStride(PatchAttribs attribs) {
return 4*sizeof(SkPoint) + PatchAttribsStride(attribs);
diff --git a/chromium/third_party/skia/src/gpu/tessellate/WangsFormula.h b/chromium/third_party/skia/src/gpu/tessellate/WangsFormula.h
index b8637b0f3f1..0209f439844 100644
--- a/chromium/third_party/skia/src/gpu/tessellate/WangsFormula.h
+++ b/chromium/third_party/skia/src/gpu/tessellate/WangsFormula.h
@@ -8,6 +8,7 @@
#ifndef skgpu_tessellate_WangsFormula_DEFINED
#define skgpu_tessellate_WangsFormula_DEFINED
+#include "include/core/SkM44.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPoint.h"
#include "include/core/SkString.h"
@@ -15,7 +16,7 @@
#include "include/private/SkVx.h"
#include "src/gpu/tessellate/Tessellation.h"
-#define AI SK_MAYBE_UNUSED SK_ALWAYS_INLINE
+#define AI [[maybe_unused]] SK_ALWAYS_INLINE
// Wang's formula gives the minimum number of evenly spaced (in the parametric sense) line segments
// that a bezier curve must be chopped into in order to guarantee all lines stay within a distance
@@ -63,54 +64,33 @@ AI int nextlog16(float x) {
//
class VectorXform {
public:
- AI VectorXform() : fType(Type::kIdentity) {}
+ AI VectorXform() : fC0{1.0f, 0.f}, fC1{0.f, 1.f} {}
AI explicit VectorXform(const SkMatrix& m) { *this = m; }
+ AI explicit VectorXform(const SkM44& m) { *this = m; }
+
AI VectorXform& operator=(const SkMatrix& m) {
SkASSERT(!m.hasPerspective());
- if (m.getType() & SkMatrix::kAffine_Mask) {
- fType = Type::kAffine;
- fScaleXSkewY = {m.getScaleX(), m.getSkewY()};
- fSkewXScaleY = {m.getSkewX(), m.getScaleY()};
- fScaleXYXY = {m.getScaleX(), m.getScaleY(), m.getScaleX(), m.getScaleY()};
- fSkewXYXY = {m.getSkewX(), m.getSkewY(), m.getSkewX(), m.getSkewY()};
- } else if (m.getType() & SkMatrix::kScale_Mask) {
- fType = Type::kScale;
- fScaleXY = {m.getScaleX(), m.getScaleY()};
- fScaleXYXY = {m.getScaleX(), m.getScaleY(), m.getScaleX(), m.getScaleY()};
- } else {
- SkASSERT(!(m.getType() & ~SkMatrix::kTranslate_Mask));
- fType = Type::kIdentity;
- }
+ fC0 = {m.rc(0,0), m.rc(1,0)};
+ fC1 = {m.rc(0,1), m.rc(1,1)};
+ return *this;
+ }
+ AI VectorXform& operator=(const SkM44& m) {
+ SkASSERT(m.rc(3,0) == 0.f && m.rc(3,1) == 0.f && m.rc(3,2) == 0.f && m.rc(3,3) == 1.f);
+ fC0 = {m.rc(0,0), m.rc(1,0)};
+ fC1 = {m.rc(0,1), m.rc(1,1)};
return *this;
}
AI skvx::float2 operator()(skvx::float2 vector) const {
- switch (fType) {
- case Type::kIdentity:
- return vector;
- case Type::kScale:
- return fScaleXY * vector;
- case Type::kAffine:
- return fScaleXSkewY * skvx::float2(vector[0]) + fSkewXScaleY * vector[1];
- }
- SkUNREACHABLE;
+ return fC0 * vector.x() + fC1 * vector.y();
}
AI skvx::float4 operator()(skvx::float4 vectors) const {
- switch (fType) {
- case Type::kIdentity:
- return vectors;
- case Type::kScale:
- return vectors * fScaleXYXY;
- case Type::kAffine:
- return fScaleXYXY * vectors + fSkewXYXY * vectors.yxwz();
- }
- SkUNREACHABLE;
+ return join(fC0 * vectors.x() + fC1 * vectors.y(),
+ fC0 * vectors.z() + fC1 * vectors.w());
}
private:
- enum class Type { kIdentity, kScale, kAffine } fType;
- union { skvx::float2 fScaleXY, fScaleXSkewY; };
- skvx::float2 fSkewXScaleY;
- skvx::float4 fScaleXYXY;
- skvx::float4 fSkewXYXY;
+ // First and second columns of 2x2 matrix
+ skvx::float2 fC0;
+ skvx::float2 fC1;
};
// Returns Wang's formula, raised to the 4th power, specialized for a quadratic curve.
diff --git a/chromium/third_party/skia/src/image/BUILD.bazel b/chromium/third_party/skia/src/image/BUILD.bazel
index 2760d0998cc..34d6cac5c7c 100644
--- a/chromium/third_party/skia/src/image/BUILD.bazel
+++ b/chromium/third_party/skia/src/image/BUILD.bazel
@@ -42,7 +42,7 @@ split_srcs_and_hdrs(
filegroup(
name = "srcs",
srcs = [":core_srcs"] + select({
- "//bazel/common_config_settings:has_gpu_backend": [":gpu_srcs"],
+ "//src/gpu:has_gpu_backend": [":gpu_srcs"],
"//conditions:default": [],
}),
visibility = ["//src:__pkg__"],
@@ -51,7 +51,7 @@ filegroup(
filegroup(
name = "private_hdrs",
srcs = [":core_hdrs"] + select({
- "//bazel/common_config_settings:has_gpu_backend": [":gpu_hdrs"],
+ "//src/gpu:has_gpu_backend": [":gpu_hdrs"],
"//conditions:default": [],
}),
visibility = ["//src:__pkg__"],
diff --git a/chromium/third_party/skia/src/image/SkImage_Base.h b/chromium/third_party/skia/src/image/SkImage_Base.h
index 07a2844644e..c92dad99040 100644
--- a/chromium/third_party/skia/src/image/SkImage_Base.h
+++ b/chromium/third_party/skia/src/image/SkImage_Base.h
@@ -189,7 +189,8 @@ protected:
static GrSurfaceProxyView CopyView(GrRecordingContext*,
GrSurfaceProxyView src,
GrMipmapped,
- GrImageTexGenPolicy);
+ GrImageTexGenPolicy,
+ std::string_view label);
static std::unique_ptr<GrFragmentProcessor> MakeFragmentProcessorFromView(GrRecordingContext*,
GrSurfaceProxyView,
@@ -256,7 +257,8 @@ static inline const SkImage_Base* as_IB(const SkImage* image) {
inline GrSurfaceProxyView SkImage_Base::CopyView(GrRecordingContext* context,
GrSurfaceProxyView src,
GrMipmapped mipmapped,
- GrImageTexGenPolicy policy) {
+ GrImageTexGenPolicy policy,
+ std::string_view label) {
SkBudgeted budgeted = policy == GrImageTexGenPolicy::kNew_Uncached_Budgeted
? SkBudgeted::kYes
: SkBudgeted::kNo;
@@ -264,7 +266,8 @@ inline GrSurfaceProxyView SkImage_Base::CopyView(GrRecordingContext* context,
std::move(src),
mipmapped,
SkBackingFit::kExact,
- budgeted);
+ budgeted,
+ /*label=*/label);
}
#endif
diff --git a/chromium/third_party/skia/src/image/SkImage_Gpu.cpp b/chromium/third_party/skia/src/image/SkImage_Gpu.cpp
index db00ba919d9..1023227c22a 100644
--- a/chromium/third_party/skia/src/image/SkImage_Gpu.cpp
+++ b/chromium/third_party/skia/src/image/SkImage_Gpu.cpp
@@ -198,6 +198,7 @@ sk_sp<SkImage> SkImage_Gpu::MakeWithVolatileSrc(sk_sp<GrRecordingContext> rConte
mm,
SkBackingFit::kExact,
SkBudgeted::kYes,
+ /*label=*/"ImageGpu_MakeWithVolatileSrc",
&copyTask);
if (!copy) {
return nullptr;
@@ -777,13 +778,13 @@ sk_sp<SkImage> SkImage::MakeFromAHardwareBufferWithData(GrDirectContext* dContex
return nullptr;
}
- skgpu::SurfaceContext surfaceContext(
+ skgpu::v1::SurfaceContext surfaceContext(
dContext, std::move(framebufferView),image->imageInfo().colorInfo());
surfaceContext.writePixels(dContext, pixmap, {0, 0});
GrSurfaceProxy* p[1] = {surfaceContext.asSurfaceProxy()};
- drawingManager->flush(SkMakeSpan(p), SkSurface::BackendSurfaceAccess::kNoAccess, {}, nullptr);
+ drawingManager->flush(p, SkSurface::BackendSurfaceAccess::kNoAccess, {}, nullptr);
return image;
}
@@ -846,7 +847,11 @@ std::tuple<GrSurfaceProxyView, GrColorType> SkImage_Gpu::onAsView(
return {};
}
if (policy != GrImageTexGenPolicy::kDraw) {
- return {CopyView(recordingContext, this->makeView(recordingContext), mipmapped, policy),
+ return {CopyView(recordingContext,
+ this->makeView(recordingContext),
+ mipmapped,
+ policy,
+ /*label=*/"SkImageGpu_AsView"),
SkColorTypeToGrColorType(this->colorType())};
}
GrSurfaceProxyView view = this->makeView(recordingContext);
diff --git a/chromium/third_party/skia/src/image/SkImage_Gpu.h b/chromium/third_party/skia/src/image/SkImage_Gpu.h
index 4e9bbe58954..6ec42200a8c 100644
--- a/chromium/third_party/skia/src/image/SkImage_Gpu.h
+++ b/chromium/third_party/skia/src/image/SkImage_Gpu.h
@@ -87,7 +87,7 @@ private:
std::unique_ptr<GrFragmentProcessor> onAsFragmentProcessor(GrRecordingContext*,
SkSamplingOptions,
- const SkTileMode[],
+ const SkTileMode[2],
const SkMatrix&,
const SkRect*,
const SkRect*) const override;
diff --git a/chromium/third_party/skia/src/image/SkImage_GpuBase.cpp b/chromium/third_party/skia/src/image/SkImage_GpuBase.cpp
index 8e892ea071f..6fba18389bc 100644
--- a/chromium/third_party/skia/src/image/SkImage_GpuBase.cpp
+++ b/chromium/third_party/skia/src/image/SkImage_GpuBase.cpp
@@ -145,7 +145,8 @@ sk_sp<SkImage> SkImage_GpuBase::onMakeSubset(const SkIRect& subset,
GrMipmapped::kNo,
subset,
SkBackingFit::kExact,
- isBudgeted);
+ isBudgeted,
+ /*label=*/"ImageGpuBase_MakeSubset");
if (!copyView) {
return nullptr;
diff --git a/chromium/third_party/skia/src/image/SkImage_GpuYUVA.h b/chromium/third_party/skia/src/image/SkImage_GpuYUVA.h
index 0db4f18a838..85e52238c33 100644
--- a/chromium/third_party/skia/src/image/SkImage_GpuYUVA.h
+++ b/chromium/third_party/skia/src/image/SkImage_GpuYUVA.h
@@ -55,7 +55,7 @@ private:
std::unique_ptr<GrFragmentProcessor> onAsFragmentProcessor(GrRecordingContext*,
SkSamplingOptions,
- const SkTileMode[],
+ const SkTileMode[2],
const SkMatrix&,
const SkRect*,
const SkRect*) const override;
diff --git a/chromium/third_party/skia/src/image/SkImage_Lazy.cpp b/chromium/third_party/skia/src/image/SkImage_Lazy.cpp
index fb394dc4094..96bb33b7041 100644
--- a/chromium/third_party/skia/src/image/SkImage_Lazy.cpp
+++ b/chromium/third_party/skia/src/image/SkImage_Lazy.cpp
@@ -24,6 +24,7 @@
#include "src/gpu/ResourceKey.h"
#include "src/gpu/ganesh/GrCaps.h"
#include "src/gpu/ganesh/GrColorSpaceXform.h"
+#include "src/gpu/ganesh/GrDirectContextPriv.h"
#include "src/gpu/ganesh/GrGpuResourcePriv.h"
#include "src/gpu/ganesh/GrPaint.h"
#include "src/gpu/ganesh/GrProxyProvider.h"
@@ -128,7 +129,7 @@ SkImage_Lazy::SkImage_Lazy(Validator* validator)
//////////////////////////////////////////////////////////////////////////////////////////////////
-bool SkImage_Lazy::getROPixels(GrDirectContext*, SkBitmap* bitmap,
+bool SkImage_Lazy::getROPixels(GrDirectContext* ctx, SkBitmap* bitmap,
SkImage::CachingHint chint) const {
auto check_output_bitmap = [bitmap]() {
SkASSERT(bitmap->isImmutable());
@@ -145,23 +146,61 @@ bool SkImage_Lazy::getROPixels(GrDirectContext*, SkBitmap* bitmap,
if (SkImage::kAllow_CachingHint == chint) {
SkPixmap pmap;
SkBitmapCache::RecPtr cacheRec = SkBitmapCache::Alloc(desc, this->imageInfo(), &pmap);
- if (!cacheRec || !ScopedGenerator(fSharedGenerator)->getPixels(pmap)) {
+ if (!cacheRec) {
+ return false;
+ }
+ bool success = false;
+ { // make sure ScopedGenerator goes out of scope before we try readPixelsProxy
+ success = ScopedGenerator(fSharedGenerator)->getPixels(pmap);
+ }
+ if (!success && !this->readPixelsProxy(ctx, pmap)) {
return false;
}
SkBitmapCache::Add(std::move(cacheRec), bitmap);
this->notifyAddedToRasterCache();
} else {
- if (!bitmap->tryAllocPixels(this->imageInfo()) ||
- !ScopedGenerator(fSharedGenerator)->getPixels(bitmap->pixmap())) {
+ if (!bitmap->tryAllocPixels(this->imageInfo())) {
+ return false;
+ }
+ bool success = false;
+ { // make sure ScopedGenerator goes out of scope before we try readPixelsProxy
+ success = ScopedGenerator(fSharedGenerator)->getPixels(bitmap->pixmap());
+ }
+ if (!success && !this->readPixelsProxy(ctx, bitmap->pixmap())) {
return false;
}
bitmap->setImmutable();
}
-
check_output_bitmap();
return true;
}
+bool SkImage_Lazy::readPixelsProxy(GrDirectContext* ctx, const SkPixmap& pixmap) const {
+#if SK_SUPPORT_GPU
+ if (!ctx) {
+ return false;
+ }
+ GrSurfaceProxyView view = this->lockTextureProxyView(ctx,
+ GrImageTexGenPolicy::kDraw,
+ GrMipmapped::kNo);
+
+ if (!view) {
+ return false;
+ }
+
+ GrColorType ct = this->colorTypeOfLockTextureProxy(ctx->priv().caps());
+ GrColorInfo colorInfo(ct, this->alphaType(), this->refColorSpace());
+ auto sContext = ctx->priv().makeSC(std::move(view), colorInfo);
+ if (!sContext) {
+ return false;
+ }
+ size_t rowBytes = this->imageInfo().minRowBytes();
+ return sContext->readPixels(ctx, {this->imageInfo(), pixmap.writable_addr(), rowBytes}, {0, 0});
+#else
+ return false;
+#endif // SK_SUPPORT_GPU
+}
+
//////////////////////////////////////////////////////////////////////////////////////////////////
bool SkImage_Lazy::onReadPixels(GrDirectContext* dContext,
diff --git a/chromium/third_party/skia/src/image/SkImage_Lazy.h b/chromium/third_party/skia/src/image/SkImage_Lazy.h
index c2883ffd9d6..1c59b7d1027 100644
--- a/chromium/third_party/skia/src/image/SkImage_Lazy.h
+++ b/chromium/third_party/skia/src/image/SkImage_Lazy.h
@@ -67,13 +67,14 @@ public:
private:
void addUniqueIDListener(sk_sp<SkIDChangeListener>) const;
+ bool readPixelsProxy(GrDirectContext*, const SkPixmap&) const;
#if SK_SUPPORT_GPU
std::tuple<GrSurfaceProxyView, GrColorType> onAsView(GrRecordingContext*,
GrMipmapped,
GrImageTexGenPolicy) const override;
std::unique_ptr<GrFragmentProcessor> onAsFragmentProcessor(GrRecordingContext*,
SkSamplingOptions,
- const SkTileMode[],
+ const SkTileMode[2],
const SkMatrix&,
const SkRect*,
const SkRect*) const override;
diff --git a/chromium/third_party/skia/src/image/SkImage_Raster.cpp b/chromium/third_party/skia/src/image/SkImage_Raster.cpp
index 015519edc52..5feb2888aae 100644
--- a/chromium/third_party/skia/src/image/SkImage_Raster.cpp
+++ b/chromium/third_party/skia/src/image/SkImage_Raster.cpp
@@ -236,9 +236,11 @@ bool SkImage_Raster::onPinAsTexture(GrRecordingContext* rContext) const {
} else {
SkASSERT(fPinnedCount == 0);
SkASSERT(fPinnedUniqueID == 0);
- std::tie(fPinnedView, fPinnedColorType) = GrMakeCachedBitmapProxyView(rContext,
- fBitmap,
- GrMipmapped::kNo);
+ std::tie(fPinnedView, fPinnedColorType) =
+ GrMakeCachedBitmapProxyView(rContext,
+ fBitmap,
+ /*label=*/"SkImageRaster_PinAsTexture",
+ GrMipmapped::kNo);
if (!fPinnedView) {
fPinnedColorType = GrColorType::kUnknown;
return false;
@@ -450,7 +452,12 @@ std::tuple<GrSurfaceProxyView, GrColorType> SkImage_Raster::onAsView(
// if mipmapping is desired (skbug.com/10411)
mipmapped = GrMipmapped::kNo;
if (policy != GrImageTexGenPolicy::kDraw) {
- return {CopyView(rContext, fPinnedView, mipmapped, policy), fPinnedColorType};
+ return {CopyView(rContext,
+ fPinnedView,
+ mipmapped,
+ policy,
+ /*label=*/"TextureForImageRasterWithPolicyNotEqualKDraw"),
+ fPinnedColorType};
}
return {fPinnedView, fPinnedColorType};
}
@@ -462,7 +469,10 @@ std::tuple<GrSurfaceProxyView, GrColorType> SkImage_Raster::onAsView(
if (this->hasMipmaps()) {
mipmapped = GrMipmapped::kYes;
}
- return GrMakeCachedBitmapProxyView(rContext, fBitmap, mipmapped);
+ return GrMakeCachedBitmapProxyView(rContext,
+ fBitmap,
+ /*label=*/"TextureForImageRasterWithPolicyEqualKDraw",
+ mipmapped);
}
auto budgeted = (policy == GrImageTexGenPolicy::kNew_Uncached_Unbudgeted)
? SkBudgeted::kNo
diff --git a/chromium/third_party/skia/src/image/SkSurface_Gpu.cpp b/chromium/third_party/skia/src/image/SkSurface_Gpu.cpp
index 19714bd6bd5..c8abc31e79e 100644
--- a/chromium/third_party/skia/src/image/SkSurface_Gpu.cpp
+++ b/chromium/third_party/skia/src/image/SkSurface_Gpu.cpp
@@ -16,7 +16,6 @@
#include "include/gpu/GrRecordingContext.h"
#include "src/core/SkImagePriv.h"
#include "src/core/SkSurfacePriv.h"
-#include "src/gpu/ganesh/BaseDevice.h"
#include "src/gpu/ganesh/GrAHardwareBufferUtils_impl.h"
#include "src/gpu/ganesh/GrCaps.h"
#include "src/gpu/ganesh/GrContextThreadSafeProxyPriv.h"
@@ -31,7 +30,7 @@
#if SK_SUPPORT_GPU
-SkSurface_Gpu::SkSurface_Gpu(sk_sp<skgpu::BaseDevice> device)
+SkSurface_Gpu::SkSurface_Gpu(sk_sp<skgpu::v1::Device> device)
: INHERITED(device->width(), device->height(), &device->surfaceProps())
, fDevice(std::move(device)) {
SkASSERT(fDevice->targetProxy()->priv().isExact());
@@ -44,7 +43,7 @@ GrRecordingContext* SkSurface_Gpu::onGetRecordingContext() {
return fDevice->recordingContext();
}
-skgpu::BaseDevice* SkSurface_Gpu::getDevice() {
+skgpu::v1::Device* SkSurface_Gpu::getDevice() {
return fDevice.get();
}
@@ -132,8 +131,13 @@ sk_sp<SkImage> SkSurface_Gpu::onNewImageSnapshot(const SkIRect* subset) {
}
auto rect = subset ? *subset : SkIRect::MakeSize(srcView.dimensions());
GrMipmapped mipmapped = srcView.mipmapped();
- srcView = GrSurfaceProxyView::Copy(rContext, std::move(srcView), mipmapped, rect,
- SkBackingFit::kExact, budgeted);
+ srcView = GrSurfaceProxyView::Copy(rContext,
+ std::move(srcView),
+ mipmapped,
+ rect,
+ SkBackingFit::kExact,
+ budgeted,
+ /*label=*/"SurfaceGpu_NewImageSnapshot");
}
const SkImageInfo info = fDevice->imageInfo();
@@ -417,7 +421,7 @@ sk_sp<SkSurface> SkSurface::MakeRenderTarget(GrRecordingContext* rContext,
auto device = rContext->priv().createDevice(budgeted, c.imageInfo(), SkBackingFit::kExact,
c.sampleCount(), GrMipmapped(c.isMipMapped()),
c.isProtected(), c.origin(), c.surfaceProps(),
- skgpu::BaseDevice::InitContents::kClear);
+ skgpu::v1::Device::InitContents::kClear);
if (!device) {
return nullptr;
}
@@ -476,7 +480,7 @@ sk_sp<SkSurface> SkSurface::MakeRenderTarget(GrRecordingContext* rContext, SkBud
auto device = rContext->priv().createDevice(budgeted, info, SkBackingFit::kExact,
sampleCount, mipmapped, GrProtected::kNo, origin,
SkSurfacePropsCopyOrDefault(props),
- skgpu::BaseDevice::InitContents::kClear);
+ skgpu::v1::Device::InitContents::kClear);
if (!device) {
return nullptr;
}
@@ -518,7 +522,7 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTexture(GrRecordingContext* rContext,
auto device = rContext->priv().createDevice(grColorType, std::move(proxy),
std::move(colorSpace), origin,
SkSurfacePropsCopyOrDefault(props),
- skgpu::BaseDevice::InitContents::kUninit);
+ skgpu::v1::Device::InitContents::kUninit);
if (!device) {
return nullptr;
}
@@ -634,7 +638,7 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrRecordingContext* rCon
auto device = rContext->priv().createDevice(grColorType, std::move(proxy),
std::move(colorSpace), origin,
SkSurfacePropsCopyOrDefault(props),
- skgpu::BaseDevice::InitContents::kUninit);
+ skgpu::v1::Device::InitContents::kUninit);
if (!device) {
return nullptr;
}
diff --git a/chromium/third_party/skia/src/image/SkSurface_Gpu.h b/chromium/third_party/skia/src/image/SkSurface_Gpu.h
index b0b97959da5..4a7bc420a11 100644
--- a/chromium/third_party/skia/src/image/SkSurface_Gpu.h
+++ b/chromium/third_party/skia/src/image/SkSurface_Gpu.h
@@ -14,11 +14,11 @@
#if SK_SUPPORT_GPU
class GrBackendFormat;
-namespace skgpu { class BaseDevice; }
+namespace skgpu::v1 { class Device; }
class SkSurface_Gpu : public SkSurface_Base {
public:
- SkSurface_Gpu(sk_sp<skgpu::BaseDevice>);
+ SkSurface_Gpu(sk_sp<skgpu::v1::Device>);
~SkSurface_Gpu() override;
GrRecordingContext* onGetRecordingContext() override;
@@ -58,10 +58,10 @@ public:
bool onDraw(sk_sp<const SkDeferredDisplayList>, SkIPoint offset) override;
sk_sp<const SkCapabilities> onCapabilities() override;
- skgpu::BaseDevice* getDevice();
+ skgpu::v1::Device* getDevice();
private:
- sk_sp<skgpu::BaseDevice> fDevice;
+ sk_sp<skgpu::v1::Device> fDevice;
using INHERITED = SkSurface_Base;
};
diff --git a/chromium/third_party/skia/src/image/SkSurface_GpuMtl.mm b/chromium/third_party/skia/src/image/SkSurface_GpuMtl.mm
index e6ffd29e418..b38f4dc2b8c 100644
--- a/chromium/third_party/skia/src/image/SkSurface_GpuMtl.mm
+++ b/chromium/third_party/skia/src/image/SkSurface_GpuMtl.mm
@@ -13,7 +13,7 @@
#include "src/gpu/ganesh/GrRecordingContextPriv.h"
#include "src/gpu/ganesh/GrResourceProvider.h"
#include "src/gpu/ganesh/GrResourceProviderPriv.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/image/SkSurface_Gpu.h"
#if SK_SUPPORT_GPU
@@ -88,7 +88,7 @@ sk_sp<SkSurface> SkSurface::MakeFromCAMetalLayer(GrRecordingContext* rContext,
std::move(colorSpace),
origin,
SkSurfacePropsCopyOrDefault(surfaceProps),
- skgpu::BaseDevice::InitContents::kUninit);
+ skgpu::v1::Device::InitContents::kUninit);
if (!device) {
return nullptr;
}
@@ -157,7 +157,7 @@ sk_sp<SkSurface> SkSurface::MakeFromMTKView(GrRecordingContext* rContext,
std::move(colorSpace),
origin,
SkSurfacePropsCopyOrDefault(surfaceProps),
- skgpu::BaseDevice::InitContents::kUninit);
+ skgpu::v1::Device::InitContents::kUninit);
if (!device) {
return nullptr;
}
diff --git a/chromium/third_party/skia/src/images/BUILD.bazel b/chromium/third_party/skia/src/images/BUILD.bazel
index 0521333ada2..bb46b29e87f 100644
--- a/chromium/third_party/skia/src/images/BUILD.bazel
+++ b/chromium/third_party/skia/src/images/BUILD.bazel
@@ -1,23 +1,32 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy", "select_multi")
+load("//bazel:macros.bzl", "exports_files_legacy", "select_multi", "skia_cc_deps", "string_flag_with_values")
licenses(["notice"])
exports_files_legacy()
+string_flag_with_values(
+ flag_name = "include_encoder",
+ multiple = True,
+ values = [
+ "jpeg_encode_codec",
+ "png_encode_codec",
+ "webp_encode_codec",
+ ],
+)
+
filegroup(
name = "srcs",
srcs = [
"SkImageEncoder.cpp",
] + select_multi(
{
- "//bazel/common_config_settings:jpeg_encode_codec": [
+ ":jpeg_encode_codec": [
"SkJPEGWriteUtility.cpp",
"SkJpegEncoder.cpp",
],
- "//bazel/common_config_settings:png_encode_codec": ["SkPngEncoder.cpp"],
- "//bazel/common_config_settings:webp_encode_codec": ["SkWebpEncoder.cpp"],
+ ":png_encode_codec": ["SkPngEncoder.cpp"],
+ ":webp_encode_codec": ["SkWebpEncoder.cpp"],
},
- default = [],
),
visibility = ["//src:__pkg__"],
)
@@ -28,21 +37,20 @@ filegroup(
"SkImageEncoderFns.h",
"SkImageEncoderPriv.h",
] + select({
- "//bazel/common_config_settings:jpeg_encode_codec": ["SkJPEGWriteUtility.h"],
+ ":jpeg_encode_codec": ["SkJPEGWriteUtility.h"],
"//conditions:default": [],
}),
visibility = ["//src:__pkg__"],
)
-cc_library(
+skia_cc_deps(
name = "deps",
visibility = ["//src:__pkg__"],
deps = select_multi(
{
- "//bazel/common_config_settings:jpeg_encode_codec": ["@libjpeg_turbo"],
- "//bazel/common_config_settings:png_encode_codec": ["@libpng"],
- "//bazel/common_config_settings:webp_encode_codec": ["@libwebp"],
+ ":jpeg_encode_codec": ["@libjpeg_turbo"],
+ ":png_encode_codec": ["@libpng"],
+ ":webp_encode_codec": ["@libwebp"],
},
- default = [],
),
)
diff --git a/chromium/third_party/skia/src/images/SkImageEncoder.cpp b/chromium/third_party/skia/src/images/SkImageEncoder.cpp
index 821e5b5ba35..91ef92a2288 100644
--- a/chromium/third_party/skia/src/images/SkImageEncoder.cpp
+++ b/chromium/third_party/skia/src/images/SkImageEncoder.cpp
@@ -4,12 +4,23 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "include/core/SkImageEncoder.h"
#include "include/core/SkBitmap.h"
+#include "include/core/SkData.h"
+#include "include/core/SkEncodedImageFormat.h"
+#include "include/core/SkPixmap.h"
+#include "include/core/SkRefCnt.h"
+#include "include/core/SkStream.h"
+#include "include/core/SkTypes.h"
+#include "include/encode/SkEncoder.h"
#include "include/encode/SkJpegEncoder.h"
#include "include/encode/SkPngEncoder.h"
#include "include/encode/SkWebpEncoder.h"
+
+#if SK_ENABLE_NDK_IMAGES || SK_USE_CG_ENCODER || SK_USE_WIC_ENCODER
#include "src/images/SkImageEncoderPriv.h"
+#endif
#ifndef SK_ENCODE_JPEG
bool SkJpegEncoder::Encode(SkWStream*, const SkPixmap&, const Options&) { return false; }
diff --git a/chromium/third_party/skia/src/images/SkImageEncoderFns.h b/chromium/third_party/skia/src/images/SkImageEncoderFns.h
index 1047dac06a5..6ce9c244b0d 100644
--- a/chromium/third_party/skia/src/images/SkImageEncoderFns.h
+++ b/chromium/third_party/skia/src/images/SkImageEncoderFns.h
@@ -13,7 +13,7 @@
#include "include/core/SkICC.h"
#include "include/core/SkTypes.h"
#include "include/private/SkColorData.h"
-#include "include/third_party/skcms/skcms.h"
+#include "modules/skcms/skcms.h"
typedef void (*transform_scanline_proc)(char* dst, const char* src, int width, int bpp);
diff --git a/chromium/third_party/skia/src/images/SkImageEncoderPriv.h b/chromium/third_party/skia/src/images/SkImageEncoderPriv.h
index dc1f6da606e..877233e53db 100644
--- a/chromium/third_party/skia/src/images/SkImageEncoderPriv.h
+++ b/chromium/third_party/skia/src/images/SkImageEncoderPriv.h
@@ -8,9 +8,12 @@
#ifndef SkImageEncoderPriv_DEFINED
#define SkImageEncoderPriv_DEFINED
-#include "include/core/SkImageEncoder.h"
+#include "include/core/SkEncodedImageFormat.h"
+#include "include/core/SkPixmap.h"
#include "include/private/SkImageInfoPriv.h"
+class SkWStream;
+
static inline bool SkPixmapIsValid(const SkPixmap& src) {
if (!SkImageInfoIsValid(src.info())) {
return false;
diff --git a/chromium/third_party/skia/src/images/SkJPEGWriteUtility.cpp b/chromium/third_party/skia/src/images/SkJPEGWriteUtility.cpp
index 4536bb4ff61..4da5994bad3 100644
--- a/chromium/third_party/skia/src/images/SkJPEGWriteUtility.cpp
+++ b/chromium/third_party/skia/src/images/SkJPEGWriteUtility.cpp
@@ -8,6 +8,18 @@
#include "src/images/SkJPEGWriteUtility.h"
+#include "include/core/SkStream.h"
+#include "include/private/SkTArray.h"
+#include "src/codec/SkJpegPriv.h"
+
+#include <csetjmp>
+#include <cstddef>
+
+extern "C" {
+ #include "jerror.h"
+ #include "jmorecfg.h"
+}
+
///////////////////////////////////////////////////////////////////////////////
static void sk_init_destination(j_compress_ptr cinfo) {
diff --git a/chromium/third_party/skia/src/images/SkJPEGWriteUtility.h b/chromium/third_party/skia/src/images/SkJPEGWriteUtility.h
index 781e9dc66fb..fac4281ea53 100644
--- a/chromium/third_party/skia/src/images/SkJPEGWriteUtility.h
+++ b/chromium/third_party/skia/src/images/SkJPEGWriteUtility.h
@@ -9,15 +9,18 @@
#ifndef SkJpegUtility_DEFINED
#define SkJpegUtility_DEFINED
-#include "include/core/SkStream.h"
-#include "src/codec/SkJpegPriv.h"
+#include "include/core/SkTypes.h"
+
+#include <cstdint>
extern "C" {
+ // We need to include stdio.h before jpeg because jpeg does not include it, but uses FILE
+ // See https://github.com/libjpeg-turbo/libjpeg-turbo/issues/17
+ #include <stdio.h> // IWYU pragma: keep
#include "jpeglib.h"
- #include "jerror.h"
}
-#include <setjmp.h>
+class SkWStream;
void skjpeg_error_exit(j_common_ptr cinfo);
diff --git a/chromium/third_party/skia/src/images/SkJpegEncoder.cpp b/chromium/third_party/skia/src/images/SkJpegEncoder.cpp
index b87d73a6a90..185eaf6abf0 100644
--- a/chromium/third_party/skia/src/images/SkJpegEncoder.cpp
+++ b/chromium/third_party/skia/src/images/SkJpegEncoder.cpp
@@ -5,26 +5,39 @@
* found in the LICENSE file.
*/
-#include "src/images/SkImageEncoderPriv.h"
+#include "include/core/SkTypes.h"
#ifdef SK_ENCODE_JPEG
-#include "include/core/SkStream.h"
+#include "include/core/SkAlphaType.h"
+#include "include/core/SkColorType.h"
+#include "include/core/SkData.h"
+#include "include/core/SkImageInfo.h"
+#include "include/core/SkPixmap.h"
+#include "include/core/SkRefCnt.h"
+#include "include/encode/SkEncoder.h"
#include "include/encode/SkJpegEncoder.h"
-#include "include/private/SkColorData.h"
-#include "include/private/SkImageInfoPriv.h"
+#include "include/private/SkNoncopyable.h"
#include "include/private/SkTemplates.h"
+#include "src/codec/SkJpegPriv.h"
#include "src/core/SkMSAN.h"
#include "src/images/SkImageEncoderFns.h"
+#include "src/images/SkImageEncoderPriv.h"
#include "src/images/SkJPEGWriteUtility.h"
-#include <stdio.h>
+#include <csetjmp>
+#include <cstdint>
+#include <cstring>
+#include <memory>
+#include <utility>
extern "C" {
#include "jpeglib.h"
- #include "jerror.h"
+ #include "jmorecfg.h"
}
+class SkWStream;
+
class SkJpegEncoderMgr final : SkNoncopyable {
public:
diff --git a/chromium/third_party/skia/src/images/SkPngEncoder.cpp b/chromium/third_party/skia/src/images/SkPngEncoder.cpp
index 7fa6215c591..0db5b050192 100644
--- a/chromium/third_party/skia/src/images/SkPngEncoder.cpp
+++ b/chromium/third_party/skia/src/images/SkPngEncoder.cpp
@@ -5,21 +5,39 @@
* found in the LICENSE file.
*/
-#include "src/images/SkImageEncoderPriv.h"
+#include "include/core/SkTypes.h"
#ifdef SK_ENCODE_PNG
+#include "include/core/SkAlphaType.h"
+#include "include/core/SkColorSpace.h"
+#include "include/core/SkColorType.h"
+#include "include/core/SkData.h"
+#include "include/core/SkDataTable.h"
+#include "include/core/SkImageInfo.h"
+#include "include/core/SkPixmap.h"
+#include "include/core/SkRefCnt.h"
#include "include/core/SkStream.h"
#include "include/core/SkString.h"
+#include "include/encode/SkEncoder.h"
#include "include/encode/SkPngEncoder.h"
-#include "include/private/SkImageInfoPriv.h"
-#include "src/codec/SkColorTable.h"
+#include "include/private/SkNoncopyable.h"
+#include "include/private/SkTemplates.h"
#include "src/codec/SkPngPriv.h"
#include "src/core/SkMSAN.h"
#include "src/images/SkImageEncoderFns.h"
+#include "src/images/SkImageEncoderPriv.h"
+
+#include <algorithm>
+#include <csetjmp>
+#include <cstdint>
+#include <memory>
+#include <string>
+#include <utility>
#include <vector>
#include <png.h>
+#include <pngconf.h>
static_assert(PNG_FILTER_NONE == (int)SkPngEncoder::FilterFlag::kNone, "Skia libpng filter err.");
static_assert(PNG_FILTER_SUB == (int)SkPngEncoder::FilterFlag::kSub, "Skia libpng filter err.");
diff --git a/chromium/third_party/skia/src/images/SkWebpEncoder.cpp b/chromium/third_party/skia/src/images/SkWebpEncoder.cpp
index 07b8fa018e4..1977298df3d 100644
--- a/chromium/third_party/skia/src/images/SkWebpEncoder.cpp
+++ b/chromium/third_party/skia/src/images/SkWebpEncoder.cpp
@@ -5,19 +5,26 @@
* found in the LICENSE file.
*/
-#include "src/images/SkImageEncoderPriv.h"
+#include "include/core/SkTypes.h"
#ifdef SK_ENCODE_WEBP
+#include "include/core/SkAlphaType.h"
#include "include/core/SkBitmap.h"
+#include "include/core/SkColorType.h"
+#include "include/core/SkData.h"
+#include "include/core/SkImageInfo.h"
+#include "include/core/SkPixmap.h"
+#include "include/core/SkRefCnt.h"
#include "include/core/SkStream.h"
-#include "include/core/SkUnPreMultiply.h"
#include "include/encode/SkWebpEncoder.h"
-#include "include/private/SkColorData.h"
#include "include/private/SkImageInfoPriv.h"
#include "include/private/SkTemplates.h"
#include "src/images/SkImageEncoderFns.h"
-#include "src/utils/SkUTF.h"
+#include "src/images/SkImageEncoderPriv.h"
+
+#include <cstddef>
+#include <cstdint>
// A WebP encoder only, on top of (subset of) libwebp
// For more information on WebP image format, and libwebp library, see:
@@ -25,12 +32,12 @@
// http://www.webmproject.org/code/#libwebp_webp_image_decoder_library
// http://review.webmproject.org/gitweb?p=libwebp.git
-#include <stdio.h>
extern "C" {
// If moving libwebp out of skia source tree, path for webp headers must be
// updated accordingly. Here, we enforce using local copy in webp sub-directory.
#include "webp/encode.h"
#include "webp/mux.h"
+#include "webp/mux_types.h"
}
static int stream_writer(const uint8_t* data, size_t data_size,
diff --git a/chromium/third_party/skia/src/lazy/BUILD.bazel b/chromium/third_party/skia/src/lazy/BUILD.bazel
index 69666adff23..c7b3ff1ea6f 100644
--- a/chromium/third_party/skia/src/lazy/BUILD.bazel
+++ b/chromium/third_party/skia/src/lazy/BUILD.bazel
@@ -1,5 +1,15 @@
-load("//bazel:macros.bzl", "exports_files_legacy")
+load("//bazel:macros.bzl", "exports_files_legacy", "split_srcs_and_hdrs")
licenses(["notice"])
exports_files_legacy()
+
+LAZY_FILES = [
+ "SkDiscardableMemoryPool.cpp",
+ "SkDiscardableMemoryPool.h",
+]
+
+split_srcs_and_hdrs(
+ name = "lazy",
+ files = LAZY_FILES,
+)
diff --git a/chromium/third_party/skia/src/opts/SkRasterPipeline_opts.h b/chromium/third_party/skia/src/opts/SkRasterPipeline_opts.h
index 94c5cb902f5..bf0838be1a3 100644
--- a/chromium/third_party/skia/src/opts/SkRasterPipeline_opts.h
+++ b/chromium/third_party/skia/src/opts/SkRasterPipeline_opts.h
@@ -10,7 +10,7 @@
#include "include/core/SkData.h"
#include "include/core/SkTypes.h"
-#include "include/third_party/skcms/skcms.h"
+#include "modules/skcms/skcms.h"
#include "src/core/SkUtils.h" // unaligned_{load,store}
#include <cstdint>
@@ -48,21 +48,19 @@ SI void* load_and_inc(void**& program) {
#endif
}
-// Lazily resolved on first cast. Does nothing if cast to Ctx::None.
struct Ctx {
struct None {};
- void* ptr;
void**& program;
- explicit Ctx(void**& p) : ptr(nullptr), program(p) {}
-
template <typename T>
operator T*() {
- if (!ptr) { ptr = load_and_inc(program); }
- return (T*)ptr;
+ return (T*)load_and_inc(program);
+ }
+ operator None() {
+ load_and_inc(program);
+ return None{};
}
- operator None() { return None{}; }
};
@@ -1109,6 +1107,12 @@ static void start_pipeline(size_t dx, size_t dy, size_t xlimit, size_t ylimit, v
}
}
+#if __has_cpp_attribute(clang::musttail) && !defined(__EMSCRIPTEN__)
+ #define JUMPER_MUSTTAIL [[clang::musttail]]
+#else
+ #define JUMPER_MUSTTAIL
+#endif
+
#if JUMPER_NARROW_STAGES
#define STAGE(name, ...) \
SI void name##_k(__VA_ARGS__, size_t dx, size_t dy, size_t tail, \
@@ -1118,7 +1122,7 @@ static void start_pipeline(size_t dx, size_t dy, size_t xlimit, size_t ylimit, v
name##_k(Ctx{program},params->dx,params->dy,params->tail, r,g,b,a, \
params->dr, params->dg, params->db, params->da); \
auto next = (Stage)load_and_inc(program); \
- next(params,program, r,g,b,a); \
+ JUMPER_MUSTTAIL return next(params,program, r,g,b,a); \
} \
SI void name##_k(__VA_ARGS__, size_t dx, size_t dy, size_t tail, \
F& r, F& g, F& b, F& a, F& dr, F& dg, F& db, F& da)
@@ -1130,7 +1134,7 @@ static void start_pipeline(size_t dx, size_t dy, size_t xlimit, size_t ylimit, v
F r, F g, F b, F a, F dr, F dg, F db, F da) { \
name##_k(Ctx{program},dx,dy,tail, r,g,b,a, dr,dg,db,da); \
auto next = (Stage)load_and_inc(program); \
- next(tail,program,dx,dy, r,g,b,a, dr,dg,db,da); \
+ JUMPER_MUSTTAIL return next(tail,program,dx,dy, r,g,b,a, dr,dg,db,da); \
} \
SI void name##_k(__VA_ARGS__, size_t dx, size_t dy, size_t tail, \
F& r, F& g, F& b, F& a, F& dr, F& dg, F& db, F& da)
@@ -1468,11 +1472,7 @@ BLEND_MODE(softlight) {
// 3. light src, light dst?
F darkSrc = d*(sa + (s2 - sa)*(1.0f - m)), // Used in case 1.
darkDst = (m4*m4 + m4)*(m - 1.0f) + 7.0f*m, // Used in case 2.
- #if defined(SK_RASTER_PIPELINE_LEGACY_RCP_RSQRT)
- liteDst = rcp_fast(rsqrt(m)) - m, // Used in case 3.
- #else
liteDst = sqrt_(m) - m,
- #endif
liteSrc = d*sa + da*(s2 - sa) * if_then_else(two(two(d)) <= da, darkDst, liteDst); // 2 or 3?
return s*inv(da) + d*inv(sa) + if_then_else(s2 <= sa, darkSrc, liteSrc); // 1 or (2 or 3)?
}
@@ -1514,8 +1514,8 @@ SI void clip_color(F* r, F* g, F* b, F a) {
l = lum(*r, *g, *b);
auto clip = [=](F c) {
- c = if_then_else(mn >= 0, c, l + (c - l) * ( l) / (l - mn) );
- c = if_then_else(mx > a, l + (c - l) * (a - l) / (mx - l), c);
+ c = if_then_else(mn < 0 && l != mn, l + (c - l) * ( l) / (l - mn), c);
+ c = if_then_else(mx > a && l != mx, l + (c - l) * (a - l) / (mx - l), c);
c = max(c, 0); // Sometimes without this we may dip just a little negative.
return c;
};
@@ -3013,7 +3013,7 @@ static void start_pipeline(const size_t x0, const size_t y0,
split(x, &r,&g); \
split(y, &b,&a); \
auto next = (Stage)load_and_inc(program); \
- next(params,program, r,g,b,a); \
+ JUMPER_MUSTTAIL return next(params,program, r,g,b,a); \
} \
SI void name##_k(__VA_ARGS__, size_t dx, size_t dy, size_t tail, F& x, F& y)
@@ -3027,7 +3027,7 @@ static void start_pipeline(const size_t x0, const size_t y0,
name##_k(Ctx{program}, params->dx,params->dy,params->tail, x,y, r,g,b,a, \
params->dr,params->dg,params->db,params->da); \
auto next = (Stage)load_and_inc(program); \
- next(params,program, r,g,b,a); \
+ JUMPER_MUSTTAIL return next(params,program, r,g,b,a); \
} \
SI void name##_k(__VA_ARGS__, size_t dx, size_t dy, size_t tail, F x, F y, \
U16& r, U16& g, U16& b, U16& a, \
@@ -3041,7 +3041,7 @@ static void start_pipeline(const size_t x0, const size_t y0,
name##_k(Ctx{program}, params->dx,params->dy,params->tail, r,g,b,a, \
params->dr,params->dg,params->db,params->da); \
auto next = (Stage)load_and_inc(program); \
- next(params,program, r,g,b,a); \
+ JUMPER_MUSTTAIL return next(params,program, r,g,b,a); \
} \
SI void name##_k(__VA_ARGS__, size_t dx, size_t dy, size_t tail, \
U16& r, U16& g, U16& b, U16& a, \
@@ -3058,7 +3058,7 @@ static void start_pipeline(const size_t x0, const size_t y0,
split(x, &r,&g); \
split(y, &b,&a); \
auto next = (Stage)load_and_inc(program); \
- next(tail,program,dx,dy, r,g,b,a, dr,dg,db,da); \
+ JUMPER_MUSTTAIL return next(tail,program,dx,dy, r,g,b,a, dr,dg,db,da); \
} \
SI void name##_k(__VA_ARGS__, size_t dx, size_t dy, size_t tail, F& x, F& y)
@@ -3073,7 +3073,7 @@ static void start_pipeline(const size_t x0, const size_t y0,
y = join<F>(b,a); \
name##_k(Ctx{program}, dx,dy,tail, x,y, r,g,b,a, dr,dg,db,da); \
auto next = (Stage)load_and_inc(program); \
- next(tail,program,dx,dy, r,g,b,a, dr,dg,db,da); \
+ JUMPER_MUSTTAIL return next(tail,program,dx,dy, r,g,b,a, dr,dg,db,da); \
} \
SI void name##_k(__VA_ARGS__, size_t dx, size_t dy, size_t tail, F x, F y, \
U16& r, U16& g, U16& b, U16& a, \
@@ -3088,7 +3088,7 @@ static void start_pipeline(const size_t x0, const size_t y0,
U16 dr, U16 dg, U16 db, U16 da) { \
name##_k(Ctx{program}, dx,dy,tail, r,g,b,a, dr,dg,db,da); \
auto next = (Stage)load_and_inc(program); \
- next(tail,program,dx,dy, r,g,b,a, dr,dg,db,da); \
+ JUMPER_MUSTTAIL return next(tail,program,dx,dy, r,g,b,a, dr,dg,db,da); \
} \
SI void name##_k(__VA_ARGS__, size_t dx, size_t dy, size_t tail, \
U16& r, U16& g, U16& b, U16& a, \
@@ -4117,8 +4117,6 @@ STAGE_GP(evenly_spaced_2_stop_gradient, const SkRasterPipeline_EvenlySpaced2Stop
&r,&g,&b,&a);
}
-SI F cast (U32 v) { return __builtin_convertvector((I32)v, F); }
-#if !defined(SK_SUPPORT_LEGACY_BILERP_HIGHP)
STAGE_GP(bilerp_clamp_8888, const SkRasterPipeline_GatherCtx* ctx) {
// Quantize sample point and transform into lerp coordinates converting them to 16.16 fixed
// point number.
@@ -4214,7 +4212,6 @@ STAGE_GP(bilerp_clamp_8888, const SkRasterPipeline_GatherCtx* ctx) {
b = lerpY(topB, bottomB);
a = lerpY(topA, bottomA);
}
-#endif // SK_SUPPORT_LEGACY_BILERP_HIGHP
STAGE_GG(xy_to_unit_angle, Ctx::None) {
F xabs = abs_(x),
@@ -4346,9 +4343,6 @@ STAGE_PP(swizzle, void* ctx) {
NOT_IMPLEMENTED(repeat_y)
NOT_IMPLEMENTED(negate_x)
NOT_IMPLEMENTED(bilinear)
-#if defined(SK_SUPPORT_LEGACY_BILERP_HIGHP)
- NOT_IMPLEMENTED(bilerp_clamp_8888)
-#endif
NOT_IMPLEMENTED(bicubic)
NOT_IMPLEMENTED(bicubic_clamp_8888)
NOT_IMPLEMENTED(bilinear_nx)
diff --git a/chromium/third_party/skia/src/opts/SkVM_opts.h b/chromium/third_party/skia/src/opts/SkVM_opts.h
index 6cf12b1ff53..af87d404585 100644
--- a/chromium/third_party/skia/src/opts/SkVM_opts.h
+++ b/chromium/third_party/skia/src/opts/SkVM_opts.h
@@ -74,7 +74,7 @@ namespace SkVMInterpreterTypes {
Slot* r = few_regs;
- if (nregs > (int)SK_ARRAY_COUNT(few_regs)) {
+ if (nregs > (int)std::size(few_regs)) {
// Annoyingly we can't trust that malloc() or new will work with Slot because
// the skvx::Vec types may have alignment greater than what they provide.
// We'll overallocate one extra register so we can align manually.
@@ -272,7 +272,7 @@ namespace SkVMInterpreterTypes {
16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63 };
- static_assert(K <= SK_ARRAY_COUNT(iota), "");
+ static_assert(K <= std::size(iota), "");
r[d].i32 = n - I32::Load(iota);
} break;
diff --git a/chromium/third_party/skia/src/pathops/SkIntersections.cpp b/chromium/third_party/skia/src/pathops/SkIntersections.cpp
index 2b1db9a45f9..8361f3b8c83 100644
--- a/chromium/third_party/skia/src/pathops/SkIntersections.cpp
+++ b/chromium/third_party/skia/src/pathops/SkIntersections.cpp
@@ -100,7 +100,7 @@ int SkIntersections::insert(double one, double two, const SkDPoint& pt) {
fT[0][index] = one;
fT[1][index] = two;
++fUsed;
- SkASSERT(fUsed <= SK_ARRAY_COUNT(fPt));
+ SkASSERT(fUsed <= std::size(fPt));
return index;
}
diff --git a/chromium/third_party/skia/src/pathops/SkIntersections.h b/chromium/third_party/skia/src/pathops/SkIntersections.h
index 71d1c80fcc4..6e9ae2bebbb 100644
--- a/chromium/third_party/skia/src/pathops/SkIntersections.h
+++ b/chromium/third_party/skia/src/pathops/SkIntersections.h
@@ -200,7 +200,7 @@ public:
}
void setMax(int max) {
- SkASSERT(max <= (int) SK_ARRAY_COUNT(fPt));
+ SkASSERT(max <= (int) std::size(fPt));
fMax = max;
}
diff --git a/chromium/third_party/skia/src/pathops/SkOpEdgeBuilder.cpp b/chromium/third_party/skia/src/pathops/SkOpEdgeBuilder.cpp
index 927d9ae132b..ba005f02ce0 100644
--- a/chromium/third_party/skia/src/pathops/SkOpEdgeBuilder.cpp
+++ b/chromium/third_party/skia/src/pathops/SkOpEdgeBuilder.cpp
@@ -208,10 +208,10 @@ bool SkOpEdgeBuilder::walk() {
if (SkChopQuadAtMaxCurvature(pointsPtr, pair) == 1) {
goto addOneQuad;
}
- if (!SkScalarsAreFinite(&pair[0].fX, SK_ARRAY_COUNT(pair) * 2)) {
+ if (!SkScalarsAreFinite(&pair[0].fX, std::size(pair) * 2)) {
return false;
}
- for (unsigned index = 0; index < SK_ARRAY_COUNT(pair); ++index) {
+ for (unsigned index = 0; index < std::size(pair); ++index) {
pair[index] = force_small_to_zero(pair[index]);
}
SkPoint cStorage[2][2];
@@ -269,7 +269,7 @@ bool SkOpEdgeBuilder::walk() {
fContourBuilder.addCubic(pointsPtr);
break;
}
- SkASSERT(breaks <= (int) SK_ARRAY_COUNT(splitT));
+ SkASSERT(breaks <= (int) std::size(splitT));
struct Splitsville {
double fT[2];
SkPoint fPts[4];
@@ -277,7 +277,7 @@ bool SkOpEdgeBuilder::walk() {
SkPath::Verb fVerb;
bool fCanAdd;
} splits[4];
- SkASSERT(SK_ARRAY_COUNT(splits) == SK_ARRAY_COUNT(splitT) + 1);
+ SkASSERT(std::size(splits) == std::size(splitT) + 1);
SkTQSort(splitT, splitT + breaks);
for (int index = 0; index <= breaks; ++index) {
Splitsville* split = &splits[index];
@@ -306,7 +306,7 @@ bool SkOpEdgeBuilder::walk() {
split->fPts[0] = splits[prior].fPts[0];
}
int next = index;
- int breakLimit = std::min(breaks, (int) SK_ARRAY_COUNT(splits) - 1);
+ int breakLimit = std::min(breaks, (int) std::size(splits) - 1);
while (next < breakLimit && !splits[next + 1].fCanAdd) {
++next;
}
diff --git a/chromium/third_party/skia/src/pathops/SkPathOpsCubic.cpp b/chromium/third_party/skia/src/pathops/SkPathOpsCubic.cpp
index f6e91120747..fcf7e1ce7dd 100644
--- a/chromium/third_party/skia/src/pathops/SkPathOpsCubic.cpp
+++ b/chromium/third_party/skia/src/pathops/SkPathOpsCubic.cpp
@@ -514,7 +514,7 @@ SkDVector SkDCubic::dxdyAtT(double t) const {
}
// OPTIMIZE? share code with formulate_F1DotF2
-int SkDCubic::findInflections(double tValues[]) const {
+int SkDCubic::findInflections(double tValues[2]) const {
double Ax = fPts[1].fX - fPts[0].fX;
double Ay = fPts[1].fY - fPts[0].fY;
double Bx = fPts[2].fX - 2 * fPts[1].fX + fPts[0].fX;
diff --git a/chromium/third_party/skia/src/pathops/SkPathOpsDebug.cpp b/chromium/third_party/skia/src/pathops/SkPathOpsDebug.cpp
index 7c897925394..45c04821b8c 100644
--- a/chromium/third_party/skia/src/pathops/SkPathOpsDebug.cpp
+++ b/chromium/third_party/skia/src/pathops/SkPathOpsDebug.cpp
@@ -564,7 +564,7 @@ void SkOpGlobalState::debugAddToGlobalCoinDicts() {
#if DEBUG_T_SECT_LOOP_COUNT
void SkOpGlobalState::debugAddLoopCount(SkIntersections* i, const SkIntersectionHelper& wt,
const SkIntersectionHelper& wn) {
- for (int index = 0; index < (int) SK_ARRAY_COUNT(fDebugLoopCount); ++index) {
+ for (int index = 0; index < (int) std::size(fDebugLoopCount); ++index) {
SkIntersections::DebugLoop looper = (SkIntersections::DebugLoop) index;
if (fDebugLoopCount[index] >= i->debugLoopCount(looper)) {
continue;
@@ -584,7 +584,7 @@ void SkOpGlobalState::debugAddLoopCount(SkIntersections* i, const SkIntersection
}
void SkOpGlobalState::debugDoYourWorst(SkOpGlobalState* local) {
- for (int index = 0; index < (int) SK_ARRAY_COUNT(fDebugLoopCount); ++index) {
+ for (int index = 0; index < (int) std::size(fDebugLoopCount); ++index) {
if (fDebugLoopCount[index] >= local->fDebugLoopCount[index]) {
continue;
}
@@ -627,7 +627,7 @@ static void dump_curve(SkPath::Verb verb, const SkPoint& pts, float weight) {
void SkOpGlobalState::debugLoopReport() {
const char* loops[] = { "iterations", "coinChecks", "perpCalcs" };
SkDebugf("\n");
- for (int index = 0; index < (int) SK_ARRAY_COUNT(fDebugLoopCount); ++index) {
+ for (int index = 0; index < (int) std::size(fDebugLoopCount); ++index) {
SkDebugf("%s: %d\n", loops[index], fDebugLoopCount[index]);
dump_curve(fDebugWorstVerb[index * 2], fDebugWorstPts[index * 2 * 4],
fDebugWorstWeight[index * 2]);
diff --git a/chromium/third_party/skia/src/pathops/SkPathOpsTSect.cpp b/chromium/third_party/skia/src/pathops/SkPathOpsTSect.cpp
index b2e66c31058..58011cada70 100644
--- a/chromium/third_party/skia/src/pathops/SkPathOpsTSect.cpp
+++ b/chromium/third_party/skia/src/pathops/SkPathOpsTSect.cpp
@@ -1084,7 +1084,7 @@ int SkTSect::linesIntersect(SkTSpan* span,
if (thisRayI.used() > 1) {
int ptMatches = 0;
for (int tIndex = 0; tIndex < thisRayI.used(); ++tIndex) {
- for (int lIndex = 0; lIndex < (int) SK_ARRAY_COUNT(thisLine.fPts); ++lIndex) {
+ for (int lIndex = 0; lIndex < (int) std::size(thisLine.fPts); ++lIndex) {
ptMatches += thisRayI.pt(tIndex).approximatelyEqual(thisLine.fPts[lIndex]);
}
}
@@ -1095,7 +1095,7 @@ int SkTSect::linesIntersect(SkTSpan* span,
if (oppRayI.used() > 1) {
int ptMatches = 0;
for (int oIndex = 0; oIndex < oppRayI.used(); ++oIndex) {
- for (int lIndex = 0; lIndex < (int) SK_ARRAY_COUNT(oppLine.fPts); ++lIndex) {
+ for (int lIndex = 0; lIndex < (int) std::size(oppLine.fPts); ++lIndex) {
ptMatches += oppRayI.pt(oIndex).approximatelyEqual(oppLine.fPts[lIndex]);
}
}
diff --git a/chromium/third_party/skia/src/pathops/SkPathOpsTypes.cpp b/chromium/third_party/skia/src/pathops/SkPathOpsTypes.cpp
index 65fb7800654..4cf13b20ae1 100644
--- a/chromium/third_party/skia/src/pathops/SkPathOpsTypes.cpp
+++ b/chromium/third_party/skia/src/pathops/SkPathOpsTypes.cpp
@@ -123,7 +123,10 @@ bool AlmostDequalUlps(double a, double b) {
if (fabs(a) < SK_ScalarMax && fabs(b) < SK_ScalarMax) {
return AlmostDequalUlps(SkDoubleToScalar(a), SkDoubleToScalar(b));
}
- return fabs(a - b) / std::max(fabs(a), fabs(b)) < FLT_EPSILON * 16;
+ // We allow divide-by-zero here. It only happens if one of a,b is zero, and the other is NaN.
+ // (Otherwise, we'd hit the condition above). Thus, if std::max returns 0, we compute NaN / 0,
+ // which will produce NaN. The comparison will return false, which is the correct answer.
+ return sk_ieee_double_divide(fabs(a - b), std::max(fabs(a), fabs(b))) < FLT_EPSILON * 16;
}
bool AlmostEqualUlps(float a, float b) {
diff --git a/chromium/third_party/skia/src/pdf/BUILD.bazel b/chromium/third_party/skia/src/pdf/BUILD.bazel
index 69666adff23..ece2898e381 100644
--- a/chromium/third_party/skia/src/pdf/BUILD.bazel
+++ b/chromium/third_party/skia/src/pdf/BUILD.bazel
@@ -1,5 +1,118 @@
-load("//bazel:macros.bzl", "exports_files_legacy")
+load("//bazel:macros.bzl", "bool_flag", "exports_files_legacy", "selects", "skia_cc_deps", "split_srcs_and_hdrs")
licenses(["notice"])
exports_files_legacy()
+
+PDF_FILES = [
+ "SkBitmapKey.h",
+ "SkClusterator.cpp",
+ "SkClusterator.h",
+ "SkDeflate.cpp",
+ "SkDeflate.h",
+ "SkJpegInfo.cpp",
+ "SkJpegInfo.h",
+ "SkKeyedImage.cpp",
+ "SkKeyedImage.h",
+ "SkPDFBitmap.cpp",
+ "SkPDFBitmap.h",
+ "SkPDFDevice.cpp",
+ "SkPDFDevice.h",
+ "SkPDFDocument.cpp",
+ "SkPDFDocumentPriv.h",
+ "SkPDFFont.cpp",
+ "SkPDFFont.h",
+ "SkPDFFormXObject.cpp",
+ "SkPDFFormXObject.h",
+ "SkPDFGlyphUse.h",
+ "SkPDFGradientShader.cpp",
+ "SkPDFGradientShader.h",
+ "SkPDFGraphicStackState.cpp",
+ "SkPDFGraphicStackState.h",
+ "SkPDFGraphicState.cpp",
+ "SkPDFGraphicState.h",
+ "SkPDFMakeCIDGlyphWidthsArray.cpp",
+ "SkPDFMakeCIDGlyphWidthsArray.h",
+ "SkPDFMakeToUnicodeCmap.cpp",
+ "SkPDFMakeToUnicodeCmap.h",
+ "SkPDFMetadata.cpp",
+ "SkPDFMetadata.h",
+ "SkPDFResourceDict.cpp",
+ "SkPDFResourceDict.h",
+ "SkPDFShader.cpp",
+ "SkPDFShader.h",
+ "SkPDFSubsetFont.cpp",
+ "SkPDFSubsetFont.h",
+ "SkPDFTag.cpp",
+ "SkPDFTag.h",
+ "SkPDFType1Font.cpp",
+ "SkPDFType1Font.h",
+ "SkPDFTypes.cpp",
+ "SkPDFTypes.h",
+ "SkPDFUnion.h",
+ "SkPDFUtils.cpp",
+ "SkPDFUtils.h",
+ "SkUUID.h",
+]
+
+split_srcs_and_hdrs(
+ name = "pdf",
+ files = PDF_FILES,
+)
+
+filegroup(
+ name = "srcs",
+ srcs = [
+ ":pdf_srcs",
+ ],
+ visibility = ["//src:__pkg__"],
+)
+
+filegroup(
+ name = "private_hdrs",
+ srcs = [
+ ":pdf_hdrs",
+ ],
+ visibility = ["//src:__pkg__"],
+)
+
+bool_flag(
+ default = False,
+ flag_name = "enable_pdf_backend",
+)
+
+bool_flag(
+ default = True, # This defaults it to be on if icu and harfbuzz are on
+ flag_name = "enable_pdf_subset_harfbuzz",
+)
+
+selects.config_setting_group(
+ name = "uses_jpeg",
+ match_any = [
+ "//src/images:jpeg_encode_codec",
+ "//src/codec:jpeg_decode_codec",
+ ],
+)
+
+selects.config_setting_group(
+ name = "uses_harfbuzz",
+ match_all = [
+ "//bazel/common_config_settings:use_icu_true",
+ "//bazel/common_config_settings:use_harfbuzz_true",
+ ":enable_pdf_subset_harfbuzz_true",
+ ],
+)
+
+# TODO(kjlubick) sfntly support
+
+skia_cc_deps(
+ name = "deps",
+ visibility = ["//src:__pkg__"],
+ deps = ["@zlib_skia//:zlib"] + select({
+ ":uses_jpeg": ["@libjpeg_turbo"],
+ "//conditions:default": [],
+ }) + select({
+ ":uses_harfbuzz": ["@harfbuzz"],
+ "//conditions:default": [],
+ }),
+)
diff --git a/chromium/third_party/skia/src/pdf/SkClusterator.cpp b/chromium/third_party/skia/src/pdf/SkClusterator.cpp
index ab2fceba719..37d372e4b5a 100644
--- a/chromium/third_party/skia/src/pdf/SkClusterator.cpp
+++ b/chromium/third_party/skia/src/pdf/SkClusterator.cpp
@@ -8,7 +8,7 @@
#include "src/pdf/SkClusterator.h"
#include "include/private/SkTo.h"
-#include "src/core/SkGlyphRun.h"
+#include "src/text/GlyphRun.h"
#include "src/utils/SkUTF.h"
static bool is_reversed(const uint32_t* clusters, uint32_t count) {
@@ -25,7 +25,7 @@ static bool is_reversed(const uint32_t* clusters, uint32_t count) {
return true;
}
-SkClusterator::SkClusterator(const SkGlyphRun& run)
+SkClusterator::SkClusterator(const sktext::GlyphRun& run)
: fClusters(run.clusters().data())
, fUtf8Text(run.text().data())
, fGlyphCount(SkToU32(run.glyphsIDs().size()))
diff --git a/chromium/third_party/skia/src/pdf/SkClusterator.h b/chromium/third_party/skia/src/pdf/SkClusterator.h
index ec87d4dd669..86fd6cdfdf3 100644
--- a/chromium/third_party/skia/src/pdf/SkClusterator.h
+++ b/chromium/third_party/skia/src/pdf/SkClusterator.h
@@ -7,16 +7,18 @@
#ifndef SkClusterator_DEFINED
#define SkClusterator_DEFINED
-#include <vector>
#include <cstdint>
+#include <vector>
-class SkGlyphRun;
+namespace sktext {
+class GlyphRun;
+}
/** Given the m-to-n glyph-to-character mapping data (as returned by
harfbuzz), iterate over the clusters. */
class SkClusterator {
public:
- SkClusterator(const SkGlyphRun& run);
+ SkClusterator(const sktext::GlyphRun& run);
uint32_t glyphCount() const { return fGlyphCount; }
bool reversedChars() const { return fReversedChars; }
struct Cluster {
@@ -42,6 +44,4 @@ private:
bool const fReversedChars;
uint32_t fCurrentGlyphIndex = 0;
};
-
-
#endif // SkClusterator_DEFINED
diff --git a/chromium/third_party/skia/src/pdf/SkPDFBitmap.cpp b/chromium/third_party/skia/src/pdf/SkPDFBitmap.cpp
index a2de621cf35..64a9e7acb41 100644
--- a/chromium/third_party/skia/src/pdf/SkPDFBitmap.cpp
+++ b/chromium/third_party/skia/src/pdf/SkPDFBitmap.cpp
@@ -114,7 +114,7 @@ static void do_deflated_alpha(const SkPixmap& pm, SkPDFDocument* doc, SkPDFIndir
const uint32_t* stop = ptr + pm.height() * pm.width();
uint8_t byteBuffer[4092];
- uint8_t* bufferStop = byteBuffer + SK_ARRAY_COUNT(byteBuffer);
+ uint8_t* bufferStop = byteBuffer + std::size(byteBuffer);
uint8_t* dst = byteBuffer;
while (ptr != stop) {
*dst++ = 0xFF & ((*ptr++) >> SK_BGRA_A32_SHIFT);
@@ -162,8 +162,8 @@ static void do_deflated_image(const SkPixmap& pm,
SkASSERT(pm.colorType() == kBGRA_8888_SkColorType);
SkASSERT(pm.rowBytes() == (size_t)pm.width() * 4);
uint8_t byteBuffer[3072];
- static_assert(SK_ARRAY_COUNT(byteBuffer) % 3 == 0, "");
- uint8_t* bufferStop = byteBuffer + SK_ARRAY_COUNT(byteBuffer);
+ static_assert(std::size(byteBuffer) % 3 == 0, "");
+ uint8_t* bufferStop = byteBuffer + std::size(byteBuffer);
uint8_t* dst = byteBuffer;
for (int y = 0; y < pm.height(); ++y) {
const SkColor* src = pm.addr32(0, y);
diff --git a/chromium/third_party/skia/src/pdf/SkPDFDevice.cpp b/chromium/third_party/skia/src/pdf/SkPDFDevice.cpp
index 2b3c9d3766c..d9b4bb30d51 100644
--- a/chromium/third_party/skia/src/pdf/SkPDFDevice.cpp
+++ b/chromium/third_party/skia/src/pdf/SkPDFDevice.cpp
@@ -26,7 +26,6 @@
#include "src/core/SkBitmapDevice.h"
#include "src/core/SkColorSpacePriv.h"
#include "src/core/SkDraw.h"
-#include "src/core/SkGlyphRun.h"
#include "src/core/SkImageFilterCache.h"
#include "src/core/SkImageFilter_Base.h"
#include "src/core/SkMaskFilterBase.h"
@@ -47,6 +46,7 @@
#include "src/pdf/SkPDFShader.h"
#include "src/pdf/SkPDFTypes.h"
#include "src/pdf/SkPDFUtils.h"
+#include "src/text/GlyphRun.h"
#include "src/utils/SkClipStackUtils.h"
#include "src/utils/SkUTF.h"
@@ -753,7 +753,7 @@ static bool contains(const SkRect& r, SkPoint p) {
}
void SkPDFDevice::drawGlyphRunAsPath(
- const SkGlyphRun& glyphRun, SkPoint offset, const SkPaint& runPaint) {
+ const sktext::GlyphRun& glyphRun, SkPoint offset, const SkPaint& runPaint) {
const SkFont& font = glyphRun.font();
SkPath path;
@@ -778,7 +778,7 @@ void SkPDFDevice::drawGlyphRunAsPath(
SkFont transparentFont = glyphRun.font();
transparentFont.setEmbolden(false); // Stop Recursion
- SkGlyphRun tmpGlyphRun(glyphRun, transparentFont);
+ sktext::GlyphRun tmpGlyphRun(glyphRun, transparentFont);
SkPaint transparent;
transparent.setColor(SK_ColorTRANSPARENT);
@@ -809,7 +809,7 @@ static bool needs_new_font(SkPDFFont* font, const SkGlyph* glyph,
}
void SkPDFDevice::internalDrawGlyphRun(
- const SkGlyphRun& glyphRun, SkPoint offset, const SkPaint& runPaint) {
+ const sktext::GlyphRun& glyphRun, SkPoint offset, const SkPaint& runPaint) {
const SkGlyphID* glyphIDs = glyphRun.glyphsIDs().data();
uint32_t glyphCount = SkToU32(glyphRun.glyphsIDs().size());
@@ -948,11 +948,11 @@ void SkPDFDevice::internalDrawGlyphRun(
}
void SkPDFDevice::onDrawGlyphRunList(SkCanvas*,
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
const SkPaint& initialPaint,
const SkPaint& drawingPaint) {
SkASSERT(!glyphRunList.hasRSXForm());
- for (const SkGlyphRun& glyphRun : glyphRunList) {
+ for (const sktext::GlyphRun& glyphRun : glyphRunList) {
this->internalDrawGlyphRun(glyphRun, glyphRunList.origin(), drawingPaint);
}
}
diff --git a/chromium/third_party/skia/src/pdf/SkPDFDevice.h b/chromium/third_party/skia/src/pdf/SkPDFDevice.h
index 378917c58a9..715d535768f 100644
--- a/chromium/third_party/skia/src/pdf/SkPDFDevice.h
+++ b/chromium/third_party/skia/src/pdf/SkPDFDevice.h
@@ -25,7 +25,11 @@
#include <vector>
-class SkGlyphRunList;
+namespace sktext {
+class GlyphRun;
+class GlyphRunList;
+}
+
class SkKeyedImage;
class SkPDFArray;
class SkPDFDevice;
@@ -85,7 +89,7 @@ public:
const SkPaint&,
SkCanvas::SrcRectConstraint) override;
void onDrawGlyphRunList(SkCanvas*,
- const SkGlyphRunList&,
+ const sktext::GlyphRunList&,
const SkPaint& initialPaint,
const SkPaint& drawingPaint) override;
void drawVertices(const SkVertices*, sk_sp<SkBlender>, const SkPaint&, bool) override;
@@ -166,8 +170,10 @@ private:
void finishContentEntry(const SkClipStack*, SkBlendMode, SkPDFIndirectReference, SkPath*);
bool isContentEmpty();
- void internalDrawGlyphRun(const SkGlyphRun& glyphRun, SkPoint offset, const SkPaint& runPaint);
- void drawGlyphRunAsPath(const SkGlyphRun& glyphRun, SkPoint offset, const SkPaint& runPaint);
+ void internalDrawGlyphRun(
+ const sktext::GlyphRun& glyphRun, SkPoint offset, const SkPaint& runPaint);
+ void drawGlyphRunAsPath(
+ const sktext::GlyphRun& glyphRun, SkPoint offset, const SkPaint& runPaint);
void internalDrawImageRect(SkKeyedImage,
const SkRect* src,
diff --git a/chromium/third_party/skia/src/pdf/SkPDFFont.cpp b/chromium/third_party/skia/src/pdf/SkPDFFont.cpp
index 2354908a2b2..f1eb69e0f6d 100644
--- a/chromium/third_party/skia/src/pdf/SkPDFFont.cpp
+++ b/chromium/third_party/skia/src/pdf/SkPDFFont.cpp
@@ -171,6 +171,12 @@ const std::vector<SkUnichar>& SkPDFFont::GetUnicodeMap(const SkTypeface* typefac
SkAdvancedTypefaceMetrics::FontType SkPDFFont::FontType(const SkTypeface& typeface,
const SkAdvancedTypefaceMetrics& metrics) {
if (SkToBool(metrics.fFlags & SkAdvancedTypefaceMetrics::kVariable_FontFlag) ||
+ // PDF is actually interested in the encoding of the data, not just the logical format.
+ // If the TrueType is actually wOFF or wOF2 then it should not be directly embedded in PDF.
+ // For now export these as Type3 until the subsetter can handle table based fonts.
+ // See https://github.com/harfbuzz/harfbuzz/issues/3609 and
+ // https://skia-review.googlesource.com/c/skia/+/543485
+ SkToBool(metrics.fFlags & SkAdvancedTypefaceMetrics::kAltDataFormat_FontFlag) ||
SkToBool(metrics.fFlags & SkAdvancedTypefaceMetrics::kNotEmbeddable_FontFlag)) {
// force Type3 fallback.
return SkAdvancedTypefaceMetrics::kOther_Font;
diff --git a/chromium/third_party/skia/src/pdf/SkPDFGradientShader.cpp b/chromium/third_party/skia/src/pdf/SkPDFGradientShader.cpp
index 0511f7a0ee3..4db74f24e5c 100644
--- a/chromium/third_party/skia/src/pdf/SkPDFGradientShader.cpp
+++ b/chromium/third_party/skia/src/pdf/SkPDFGradientShader.cpp
@@ -269,7 +269,7 @@ static void gradient_function_code(const SkShader::GradientInfo& info,
}
// If a cap on depth is needed, loop here.
- write_gradient_ranges(info, SkMakeSpan(rangeEnds.get(), rangeEndsCount), true, true, result);
+ write_gradient_ranges(info, SkSpan(rangeEnds.get(), rangeEndsCount), true, true, result);
// Clamp the final color.
result->writeText("0 gt {");
diff --git a/chromium/third_party/skia/src/pdf/SkPDFMakeCIDGlyphWidthsArray.cpp b/chromium/third_party/skia/src/pdf/SkPDFMakeCIDGlyphWidthsArray.cpp
index 2696166b0b7..d6e0fe0645a 100644
--- a/chromium/third_party/skia/src/pdf/SkPDFMakeCIDGlyphWidthsArray.cpp
+++ b/chromium/third_party/skia/src/pdf/SkPDFMakeCIDGlyphWidthsArray.cpp
@@ -111,7 +111,7 @@ std::unique_ptr<SkPDFArray> SkPDFMakeCIDGlyphWidthsArray(const SkTypeface& typef
subset.getSetValues([&](unsigned index) {
glyphIDs.push_back(SkToU16(index));
});
- auto glyphs = paths.glyphs(SkMakeSpan(glyphIDs));
+ auto glyphs = paths.glyphs(SkSpan(glyphIDs));
#if defined(SK_PDF_CAN_USE_DW)
std::vector<int16_t> advances;
@@ -120,7 +120,7 @@ std::unique_ptr<SkPDFArray> SkPDFMakeCIDGlyphWidthsArray(const SkTypeface& typef
advances.push_back((int16_t)glyph->advanceX());
}
std::sort(advances.begin(), advances.end());
- int16_t modeAdvance = findMode(SkMakeSpan(advances));
+ int16_t modeAdvance = findMode(SkSpan(advances));
*defaultAdvance = scale_from_font_units(modeAdvance, emSize);
#else
*defaultAdvance = 0;
diff --git a/chromium/third_party/skia/src/pdf/SkPDFResourceDict.cpp b/chromium/third_party/skia/src/pdf/SkPDFResourceDict.cpp
index 6705b044363..a4eeed30293 100644
--- a/chromium/third_party/skia/src/pdf/SkPDFResourceDict.cpp
+++ b/chromium/third_party/skia/src/pdf/SkPDFResourceDict.cpp
@@ -29,7 +29,7 @@ static char* get_resource_name(char dst[kMaxResourceNameLength], SkPDFResourceTy
'X', // kXObject
'F' // kFont
};
- SkASSERT((unsigned)type < SK_ARRAY_COUNT(kResourceTypePrefixes));
+ SkASSERT((unsigned)type < std::size(kResourceTypePrefixes));
dst[0] = kResourceTypePrefixes[(unsigned)type];
return SkStrAppendS32(dst + 1, key);
}
@@ -49,7 +49,7 @@ static const char* resource_name(SkPDFResourceType type) {
"XObject",
"Font"
};
- SkASSERT((unsigned)type < SK_ARRAY_COUNT(kResourceTypeNames));
+ SkASSERT((unsigned)type < std::size(kResourceTypeNames));
return kResourceTypeNames[(unsigned)type];
}
@@ -74,7 +74,7 @@ static void add_subdict(const std::vector<SkPDFIndirectReference>& resourceList,
static std::unique_ptr<SkPDFArray> make_proc_set() {
auto procSets = SkPDFMakeArray();
static const char kProcs[][7] = { "PDF", "Text", "ImageB", "ImageC", "ImageI"};
- procSets->reserve(SK_ARRAY_COUNT(kProcs));
+ procSets->reserve(std::size(kProcs));
for (const char* proc : kProcs) {
procSets->appendName(proc);
}
diff --git a/chromium/third_party/skia/src/pdf/SkPDFType1Font.cpp b/chromium/third_party/skia/src/pdf/SkPDFType1Font.cpp
index 7a60669b4b1..8dd8c5dbaa4 100644
--- a/chromium/third_party/skia/src/pdf/SkPDFType1Font.cpp
+++ b/chromium/third_party/skia/src/pdf/SkPDFType1Font.cpp
@@ -310,7 +310,7 @@ void SkPDFEmitType1Font(const SkPDFFont& pdfFont, SkPDFDocument* doc) {
}
SkStrikeSpec strikeSpec = SkStrikeSpec::MakePDFVector(*typeface, &emSize);
SkBulkGlyphMetrics metrics{strikeSpec};
- auto glyphs = metrics.glyphs(SkMakeSpan(glyphIDs.get(), glyphRangeSize));
+ auto glyphs = metrics.glyphs(SkSpan(glyphIDs.get(), glyphRangeSize));
for (int i = 0; i < glyphRangeSize; ++i) {
widths->appendScalar(from_font_units(glyphs[i]->advanceX(), SkToU16(emSize)));
}
diff --git a/chromium/third_party/skia/src/ports/BUILD.bazel b/chromium/third_party/skia/src/ports/BUILD.bazel
index 1dcb9a00dc0..a0405c6c611 100644
--- a/chromium/third_party/skia/src/ports/BUILD.bazel
+++ b/chromium/third_party/skia/src/ports/BUILD.bazel
@@ -1,4 +1,4 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy", "select_multi", "selects")
+load("//bazel:macros.bzl", "exports_files_legacy", "select_multi", "selects", "skia_cc_deps")
licenses(["notice"])
@@ -26,6 +26,9 @@ filegroup(
"//bazel/common_config_settings:custom_empty_fontmgr_factory": [
":fontmgr_custom_empty_factory",
],
+ "//bazel/common_config_settings:fontconfig_fontmgr_factory": [
+ ":fontmgr_fontconfig_factory",
+ ],
("//bazel/common_config_settings:empty_fontmgr_factory", "//conditions:default"): [
":fontmgr_empty_factory",
],
@@ -39,8 +42,8 @@ filegroup(
"//bazel/common_config_settings:custom_directory_fontmgr": [":fontmgr_custom_directory"],
"//bazel/common_config_settings:custom_embedded_fontmgr": [":fontmgr_custom_embedded"],
"//bazel/common_config_settings:custom_empty_fontmgr": [":fontmgr_custom_empty"],
+ "//bazel/common_config_settings:fontconfig_fontmgr": [":fontmgr_fontconfig"],
},
- default = [],
),
)
@@ -108,6 +111,22 @@ filegroup(
)
filegroup(
+ name = "fontmgr_fontconfig",
+ srcs = [
+ "SkFontMgr_fontconfig.cpp",
+ ":typeface_freetype",
+ ],
+)
+
+filegroup(
+ name = "fontmgr_fontconfig_factory",
+ srcs = [
+ "SkFontMgr_fontconfig_factory.cpp",
+ ":fontmgr_fontconfig",
+ ],
+)
+
+filegroup(
name = "global_init",
srcs = ["SkGlobalInitialization_default.cpp"],
)
@@ -167,7 +186,7 @@ filegroup(
filegroup(
name = "private_hdrs",
srcs = ["SkOSLibrary.h"] + select({
- ":any_freetype_fontmgr": [
+ ":uses_freetype": [
"SkFontHost_FreeType_common.h",
"SkFontMgr_custom.h",
],
@@ -180,7 +199,7 @@ filegroup(
)
selects.config_setting_group(
- name = "any_freetype_fontmgr",
+ name = "uses_freetype",
match_any = [
"//bazel/common_config_settings:custom_directory_fontmgr",
"//bazel/common_config_settings:custom_directory_fontmgr_factory",
@@ -188,10 +207,20 @@ selects.config_setting_group(
"//bazel/common_config_settings:custom_embedded_fontmgr_factory",
"//bazel/common_config_settings:custom_empty_fontmgr",
"//bazel/common_config_settings:custom_empty_fontmgr_factory",
+ "//bazel/common_config_settings:fontconfig_fontmgr",
+ "//bazel/common_config_settings:fontconfig_fontmgr_factory",
+ ],
+)
+
+selects.config_setting_group(
+ name = "uses_fontconfig",
+ match_any = [
+ "//bazel/common_config_settings:fontconfig_fontmgr",
+ "//bazel/common_config_settings:fontconfig_fontmgr_factory",
],
)
-cc_library(
+skia_cc_deps(
name = "deps",
linkopts = select({
"@platforms//os:linux": ["-ldl"],
@@ -199,9 +228,10 @@ cc_library(
}),
visibility = ["//src:__pkg__"],
deps = select({
- ":any_freetype_fontmgr": [
- "//third_party:freetype2",
- ],
+ ":uses_freetype": ["@freetype"],
+ "//conditions:default": [],
+ }) + select({
+ ":uses_fontconfig": ["//bazel/external/fontconfig:fontconfig"],
"//conditions:default": [],
}),
)
diff --git a/chromium/third_party/skia/src/ports/SkFontConfigInterface_direct.cpp b/chromium/third_party/skia/src/ports/SkFontConfigInterface_direct.cpp
index c16b2c1cf62..5dc4d0bb726 100644
--- a/chromium/third_party/skia/src/ports/SkFontConfigInterface_direct.cpp
+++ b/chromium/third_party/skia/src/ports/SkFontConfigInterface_direct.cpp
@@ -411,7 +411,7 @@ static SkFontStyle skfontstyle_from_fcpattern(FcPattern* pattern) {
{ FC_WEIGHT_EXTRABLACK, SkFS::kExtraBlack_Weight },
};
SkScalar weight = map_ranges(get_int(pattern, FC_WEIGHT, FC_WEIGHT_REGULAR),
- weightRanges, SK_ARRAY_COUNT(weightRanges));
+ weightRanges, std::size(weightRanges));
static constexpr MapRanges widthRanges[] = {
{ FC_WIDTH_ULTRACONDENSED, SkFS::kUltraCondensed_Width },
@@ -425,7 +425,7 @@ static SkFontStyle skfontstyle_from_fcpattern(FcPattern* pattern) {
{ FC_WIDTH_ULTRAEXPANDED, SkFS::kUltraExpanded_Width },
};
SkScalar width = map_ranges(get_int(pattern, FC_WIDTH, FC_WIDTH_NORMAL),
- widthRanges, SK_ARRAY_COUNT(widthRanges));
+ widthRanges, std::size(widthRanges));
SkFS::Slant slant = SkFS::kUpright_Slant;
switch (get_int(pattern, FC_SLANT, FC_SLANT_ROMAN)) {
@@ -455,7 +455,7 @@ static void fcpattern_from_skfontstyle(SkFontStyle style, FcPattern* pattern) {
{ SkFS::kBlack_Weight, FC_WEIGHT_BLACK },
{ SkFS::kExtraBlack_Weight, FC_WEIGHT_EXTRABLACK },
};
- int weight = map_ranges(style.weight(), weightRanges, SK_ARRAY_COUNT(weightRanges));
+ int weight = map_ranges(style.weight(), weightRanges, std::size(weightRanges));
static constexpr MapRanges widthRanges[] = {
{ SkFS::kUltraCondensed_Width, FC_WIDTH_ULTRACONDENSED },
@@ -468,7 +468,7 @@ static void fcpattern_from_skfontstyle(SkFontStyle style, FcPattern* pattern) {
{ SkFS::kExtraExpanded_Width, FC_WIDTH_EXTRAEXPANDED },
{ SkFS::kUltraExpanded_Width, FC_WIDTH_ULTRAEXPANDED },
};
- int width = map_ranges(style.width(), widthRanges, SK_ARRAY_COUNT(widthRanges));
+ int width = map_ranges(style.width(), widthRanges, std::size(widthRanges));
int slant = FC_SLANT_ROMAN;
switch (style.slant()) {
diff --git a/chromium/third_party/skia/src/ports/SkFontHost_FreeType.cpp b/chromium/third_party/skia/src/ports/SkFontHost_FreeType.cpp
index 74c4324d276..d53cfb65041 100644
--- a/chromium/third_party/skia/src/ports/SkFontHost_FreeType.cpp
+++ b/chromium/third_party/skia/src/ports/SkFontHost_FreeType.cpp
@@ -33,6 +33,8 @@
#include "src/core/SkTSearch.h"
#include "src/ports/SkFontHost_FreeType_common.h"
#include "src/sfnt/SkOTUtils.h"
+#include "src/sfnt/SkSFNTHeader.h"
+#include "src/sfnt/SkTTCFHeader.h"
#include "src/utils/SkCallableTraits.h"
#include "src/utils/SkMatrix22.h"
@@ -122,7 +124,7 @@ static_assert(std::is_same<FT_Alloc_size_t, long >::value ||
extern "C" {
static void* sk_ft_alloc(FT_Memory, FT_Alloc_size_t size) {
- return sk_malloc_throw(size);
+ return sk_malloc_canfail(size);
}
static void sk_ft_free(FT_Memory, void* block) {
sk_free(block);
@@ -143,6 +145,14 @@ public:
FT_Add_Default_Modules(fLibrary);
FT_Set_Default_Properties(fLibrary);
+#ifdef TT_SUPPORT_COLRV1
+ if (SkGraphics::GetVariableColrV1Enabled()) {
+ FT_Bool variableColrV1Enabled = true;
+ FT_Property_Set(
+ fLibrary, "truetype", "TEMPORARY-enable-variable-colrv1", &variableColrV1Enabled);
+ }
+#endif
+
// Subpixel anti-aliasing may be unfiltered until the LCD filter is set.
// Newer versions may still need this, so this test with side effects must come first.
// The default has changed over time, so this doesn't mean the same thing to all users.
@@ -505,6 +515,27 @@ static SkAdvancedTypefaceMetrics::FontType get_font_type(FT_Face face) {
return SkAdvancedTypefaceMetrics::kOther_Font;
}
+static bool is_opentype_font_data_standard_format(const SkTypeface& typeface) {
+ // FreeType reports TrueType for any data that can be decoded to TrueType or OpenType.
+ // However, there are alternate data formats for OpenType, like wOFF and wOF2.
+ std::unique_ptr<SkStreamAsset> stream = typeface.openStream(nullptr);
+ if (!stream) {
+ return false;
+ }
+ char buffer[4];
+ if (stream->read(buffer, 4) < 4) {
+ return false;
+ }
+
+ SkFourByteTag tag = SkSetFourByteTag(buffer[0], buffer[1], buffer[2], buffer[3]);
+ SK_OT_ULONG otTag = SkEndian_SwapBE32(tag);
+ return otTag == SkSFNTHeader::fontType_WindowsTrueType::TAG ||
+ otTag == SkSFNTHeader::fontType_MacTrueType::TAG ||
+ otTag == SkSFNTHeader::fontType_PostScript::TAG ||
+ otTag == SkSFNTHeader::fontType_OpenTypeCFF::TAG ||
+ otTag == SkTTCFHeader::TAG;
+}
+
std::unique_ptr<SkAdvancedTypefaceMetrics> SkTypeface_FreeType::onGetAdvancedMetrics() const {
AutoFTAccess fta(this);
FT_Face face = fta.face();
@@ -527,6 +558,12 @@ std::unique_ptr<SkAdvancedTypefaceMetrics> SkTypeface_FreeType::onGetAdvancedMet
}
info->fType = get_font_type(face);
+ if (info->fType == SkAdvancedTypefaceMetrics::kTrueType_Font &&
+ !is_opentype_font_data_standard_format(*this))
+ {
+ info->fFlags |= SkAdvancedTypefaceMetrics::kAltDataFormat_FontFlag;
+ }
+
info->fStyle = (SkAdvancedTypefaceMetrics::StyleFlags)0;
if (FT_IS_FIXED_WIDTH(face)) {
info->fStyle |= SkAdvancedTypefaceMetrics::kFixedPitch_Style;
@@ -2143,7 +2180,7 @@ bool SkTypeface_FreeType::Scanner::scanFont(
{ "ultraheavy", SkFontStyle::kExtraBlack_Weight },
{ "ultralight", SkFontStyle::kExtraLight_Weight },
};
- int const index = SkStrLCSearch(&commonWeights[0].name, SK_ARRAY_COUNT(commonWeights),
+ int const index = SkStrLCSearch(&commonWeights[0].name, std::size(commonWeights),
psFontInfo.weight, sizeof(commonWeights[0]));
if (index >= 0) {
weight = commonWeights[index].weight;
diff --git a/chromium/third_party/skia/src/ports/SkFontHost_FreeType_common.cpp b/chromium/third_party/skia/src/ports/SkFontHost_FreeType_common.cpp
index ffcb3fd23fa..40510e3d0d3 100644
--- a/chromium/third_party/skia/src/ports/SkFontHost_FreeType_common.cpp
+++ b/chromium/third_party/skia/src/ports/SkFontHost_FreeType_common.cpp
@@ -93,6 +93,12 @@ const char* SkTraceFtrGetError(int e) {
bool operator==(const FT_OpaquePaint& a, const FT_OpaquePaint& b) {
return a.p == b.p && a.insert_root_transform == b.insert_root_transform;
}
+
+// The stop_offset field is being upgraded to a larger representation in FreeType, and changed from
+// 2.14 to 16.16. Adjust the shift factor depending on size type.
+static_assert(sizeof(FT_Fixed) != sizeof(FT_F2Dot14));
+constexpr float kColorStopShift =
+ sizeof(FT_ColorStop::stop_offset) == sizeof(FT_F2Dot14) ? 1 << 14 : 1 << 16;
#endif
namespace {
@@ -551,7 +557,7 @@ bool colrv1_configure_skpaint(FT_Face face,
FT_ColorStopIterator mutable_color_stop_iterator = colorStopIterator;
while (FT_Get_Colorline_Stops(face, &color_stop, &mutable_color_stop_iterator)) {
FT_UInt index = mutable_color_stop_iterator.current_color_stop - 1;
- colorStopsSorted[index].pos = color_stop.stop_offset / float(1 << 14);
+ colorStopsSorted[index].pos = color_stop.stop_offset / kColorStopShift;
FT_UInt16& palette_index = color_stop.color.palette_index;
if (palette_index == kForegroundColorPaletteIndex) {
U8CPU newAlpha = SkColorGetA(foregroundColor) *
@@ -692,6 +698,44 @@ bool colrv1_configure_skpaint(FT_Face face,
return true;
}
+ SkScalar colorStopRange = stops.back() - stops.front();
+ if (colorStopRange != 1 || stops.front() != 0.f) {
+ // For the Skia two-point caonical shader to understand the
+ // COLRv1 color stops we need to scale stops to 0 to 1 range and
+ // interpolate new centers and radii. Otherwise the shader
+ // clamps stops outside the range to 0 and 1 (larger interval)
+ // or repeats the outer stops at 0 and 1 if the (smaller
+ // interval).
+ SkVector startToEnd = end - start;
+ SkScalar radiusDiff = endRadius - startRadius;
+ SkScalar scaleFactor = 1 / colorStopRange;
+ SkScalar stopsStartOffset = stops.front();
+
+ SkVector startOffset = startToEnd;
+ startOffset.scale(stops.front());
+ SkVector endOffset = startToEnd;
+ endOffset.scale(stops.back());
+
+ // The order of the following computations is important in order to avoid
+ // overwriting start or startRadius before the second reassignment.
+ end = start + endOffset;
+ start = start + startOffset;
+ endRadius = startRadius + radiusDiff * stops.back();
+ startRadius = startRadius + radiusDiff * stops.front();
+
+ for (auto& stop : stops) {
+ stop = (stop - stopsStartOffset) * scaleFactor;
+ }
+ }
+
+ // TODO(https://crbug.com/skia/13653): Interpolate a zero radius
+ // circle with manual color interpolation or upgrade the
+ // MakeTwoPointConical shader to understand negative radii.
+ if (startRadius < 0 || endRadius < 0) {
+ paint->setColor(SK_ColorTRANSPARENT);
+ return true;
+ }
+
// An opaque color is needed to ensure the gradient is not modulated by alpha.
paint->setColor(SK_ColorBLACK);
@@ -704,8 +748,16 @@ bool colrv1_configure_skpaint(FT_Face face,
const FT_PaintSweepGradient& sweepGradient = colrPaint.u.sweep_gradient;
SkPoint center = SkPoint::Make( SkFixedToScalar(sweepGradient.center.x),
-SkFixedToScalar(sweepGradient.center.y));
+
+
SkScalar startAngle = SkFixedToScalar(sweepGradient.start_angle * 180.0f);
SkScalar endAngle = SkFixedToScalar(sweepGradient.end_angle * 180.0f);
+ if (SkGraphics::GetVariableColrV1Enabled()) {
+ // OpenType 1.9.1 adds a shift to the angle to ease specification of a 0 to 360
+ // degree sweep. We want to release that in sync with releasing variable COLRv1.
+ startAngle += 180.0f;
+ endAngle += 180.0f;
+ }
std::vector<SkScalar> stops;
std::vector<SkColor> colors;
@@ -721,35 +773,108 @@ bool colrv1_configure_skpaint(FT_Face face,
// An opaque color is needed to ensure the gradient is not modulated by alpha.
paint->setColor(SK_ColorBLACK);
- // Prepare angles to be within range for the shader.
- auto clampAngleToRange = [](SkScalar angle) {
- SkScalar clampedAngle = SkScalarMod(angle, 360.f);
- if (clampedAngle < 0) {
- return clampedAngle + 360.f;
+ if (SkGraphics::GetVariableColrV1Enabled()) {
+ // New (Var)SweepGradient implementation compliant with OpenType 1.9.1 from here.
+ // The plan is to release this in sync with variable COLRv1 support.
+
+ // The shader expects stops from 0 to 1, so we need to account for
+ // minimum and maximum stop positions being different from 0 and
+ // 1. We do that by scaling minimum and maximum stop positions to
+ // the 0 to 1 interval and scaling the angles inverse proportionally.
+
+ // 1) Scale angles to their equivalent positions if stops were from 0 to 1.
+
+ SkScalar sectorAngle = endAngle - startAngle;
+ SkTileMode tileMode = ToSkTileMode(sweepGradient.colorline.extend);
+ if (sectorAngle == 0 && tileMode != SkTileMode::kClamp) {
+ // "If the ColorLine's extend mode is reflect or repeat and start and end angle
+ // are equal, nothing is drawn.".
+ paint->setColor(SK_ColorTRANSPARENT);
+ return true;
}
- return clampedAngle;
- };
- startAngle = clampAngleToRange(startAngle);
- endAngle = clampAngleToRange(endAngle);
- SkScalar sectorAngle =
- endAngle > startAngle ? endAngle - startAngle : endAngle + 360.0f - startAngle;
-
- /* https://docs.microsoft.com/en-us/typography/opentype/spec/colr#sweep-gradients
- * "The angles are expressed in counter-clockwise degrees from the
- * direction of the positive x-axis on the design grid. [...] The
- * color line progresses from the start angle to the end angle in
- * the counter-clockwise direction;"
- */
-
- SkMatrix localMatrix;
- localMatrix.postRotate(startAngle, center.x(), center.y());
- /* Mirror along x-axis to change angle direction. */
- localMatrix.postScale(1, -1, center.x(), center.y());
- SkTileMode tileMode = ToSkTileMode(sweepGradient.colorline.extend);
-
- paint->setShader(SkGradientShader::MakeSweep(
- center.x(), center.y(), colors.data(), stops.data(), stops.size(),
- tileMode, 0, sectorAngle, 0, &localMatrix));
+
+
+ SkScalar startAngleScaled = startAngle + sectorAngle * stops.front();
+ SkScalar endAngleScaled = startAngle + sectorAngle * stops.back();
+
+ // 2) Scale stops accordingly to 0 to 1 range.
+ SkScalar scaleFactor = 1 / (stops.back() - stops.front());
+ SkScalar startOffset = stops.front();
+
+ for (SkScalar& stop : stops) {
+ stop = (stop - startOffset) * scaleFactor;
+ }
+
+ // 3) If start angle is larger then end angle, the scaler won't accept it and will
+ // return nullptr. In order to draw this and make the shader accept it, need to swap
+ // start and end angle and reverse the list of colors.
+ if (startAngleScaled > endAngleScaled) {
+ std::swap(startAngleScaled, endAngleScaled);
+ std::reverse(colors.begin(), colors.end());
+ }
+ /* https://docs.microsoft.com/en-us/typography/opentype/spec/colr#sweep-gradients
+ * "The angles are expressed in counter-clockwise degrees from the
+ * direction of the positive x-axis on the design grid. [...] The
+ * color line progresses from the start angle to the end angle in
+ * the counter-clockwise direction;" - convert angles and stops from
+ * counter-clockwise to clockwise for the shader. */
+ std::swap(startAngleScaled, endAngleScaled);
+ startAngleScaled = 360.f - startAngleScaled;
+ endAngleScaled = 360.f - endAngleScaled;
+ std::reverse(stops.begin(), stops.end());
+ std::reverse(colors.begin(), colors.end());
+ for (auto& stop : stops) {
+ stop = 1.0f - stop;
+ }
+
+ paint->setShader(SkGradientShader::MakeSweep(center.x(), center.y(),
+ colors.data(),
+ stops.data(), stops.size(),
+ tileMode,
+ startAngleScaled,
+ endAngleScaled,
+ 0, nullptr));
+
+ } else {
+ // Old (Var)SweepGradient implementation, which is aiming to be compliant with
+ // OpenType 1.9. but ambiguities and issues were found in the spec resolved in
+ // 1.9.1. see above. TODO(drott): This else block is to be removed when the new
+ // implementation has shipped in Chrome.
+
+ // Prepare angles to be within range for the shader.
+ auto clampAngleToRange = [](SkScalar angle) {
+ SkScalar clampedAngle = SkScalarMod(angle, 360.f);
+ if (clampedAngle < 0) {
+ return clampedAngle + 360.f;
+ }
+ return clampedAngle;
+ };
+ startAngle = clampAngleToRange(startAngle);
+ endAngle = clampAngleToRange(endAngle);
+ SkScalar sectorAngle = endAngle > startAngle ? endAngle - startAngle
+ : endAngle + 360.0f - startAngle;
+
+ /* https://docs.microsoft.com/en-us/typography/opentype/spec/colr#sweep-gradients
+ * "The angles are expressed in counter-clockwise degrees from the
+ * direction of the positive x-axis on the design grid. [...] The
+ * color line progresses from the start angle to the end angle in
+ * the counter-clockwise direction;"
+ */
+
+ SkMatrix localMatrix;
+ localMatrix.postRotate(startAngle, center.x(), center.y());
+ /* Mirror along x-axis to change angle direction. */
+ localMatrix.postScale(1, -1, center.x(), center.y());
+ SkTileMode tileMode = ToSkTileMode(sweepGradient.colorline.extend);
+
+ paint->setShader(SkGradientShader::MakeSweep(center.x(), center.y(),
+ colors.data(),
+ stops.data(), stops.size(),
+ tileMode,
+ 0,
+ sectorAngle,
+ 0, &localMatrix));
+ }
return true;
}
default: {
diff --git a/chromium/third_party/skia/src/ports/SkFontHost_FreeType_common.h b/chromium/third_party/skia/src/ports/SkFontHost_FreeType_common.h
index 4a1a26413c2..c5d1f1fa6c5 100644
--- a/chromium/third_party/skia/src/ports/SkFontHost_FreeType_common.h
+++ b/chromium/third_party/skia/src/ports/SkFontHost_FreeType_common.h
@@ -9,6 +9,7 @@
#ifndef SKFONTHOST_FREETYPE_COMMON_H_
#define SKFONTHOST_FREETYPE_COMMON_H_
+#include "include/core/SkSpan.h"
#include "include/core/SkTypeface.h"
#include "include/core/SkTypes.h"
#include "include/private/SkMutex.h"
diff --git a/chromium/third_party/skia/src/ports/SkFontHost_win.cpp b/chromium/third_party/skia/src/ports/SkFontHost_win.cpp
index 8e097ca42e3..d22cf559d1c 100644
--- a/chromium/third_party/skia/src/ports/SkFontHost_win.cpp
+++ b/chromium/third_party/skia/src/ports/SkFontHost_win.cpp
@@ -1718,7 +1718,7 @@ std::unique_ptr<SkAdvancedTypefaceMetrics> LogFontTypeface::onGetAdvancedMetrics
// This probably isn't very good with an italic font.
min_width = SHRT_MAX;
info->fStemV = 0;
- for (size_t i = 0; i < SK_ARRAY_COUNT(stem_chars); i++) {
+ for (size_t i = 0; i < std::size(stem_chars); i++) {
ABC abcWidths;
if (GetCharABCWidths(hdc, stem_chars[i], stem_chars[i], &abcWidths)) {
int16_t width = abcWidths.abcB;
@@ -1735,7 +1735,7 @@ std::unique_ptr<SkAdvancedTypefaceMetrics> LogFontTypeface::onGetAdvancedMetrics
//Placeholder representation of a Base64 encoded GUID from create_unique_font_name.
#define BASE64_GUID_ID "XXXXXXXXXXXXXXXXXXXXXXXX"
//Length of GUID representation from create_id, including nullptr terminator.
-#define BASE64_GUID_ID_LEN SK_ARRAY_COUNT(BASE64_GUID_ID)
+#define BASE64_GUID_ID_LEN std::size(BASE64_GUID_ID)
static_assert(BASE64_GUID_ID_LEN < LF_FACESIZE, "GUID_longer_than_facesize");
@@ -1805,7 +1805,7 @@ static sk_sp<SkTypeface> create_from_stream(std::unique_ptr<SkStreamAsset> strea
// Create a unique and unpredictable font name.
// Avoids collisions and access from CSS.
char familyName[BASE64_GUID_ID_LEN];
- const int familyNameSize = SK_ARRAY_COUNT(familyName);
+ const int familyNameSize = std::size(familyName);
if (FAILED(create_unique_font_name(familyName, familyNameSize))) {
return nullptr;
}
@@ -1839,7 +1839,7 @@ std::unique_ptr<SkStreamAsset> LogFontTypeface::onOpenStream(int* ttcIndex) cons
std::unique_ptr<SkStreamAsset> stream;
DWORD tables[2] = {kTTCTag, 0};
- for (size_t i = 0; i < SK_ARRAY_COUNT(tables); i++) {
+ for (size_t i = 0; i < std::size(tables); i++) {
DWORD bufferSize = GetFontData(hdc, tables[i], 0, nullptr, 0);
if (bufferSize == GDI_ERROR) {
call_ensure_accessible(lf);
diff --git a/chromium/third_party/skia/src/ports/SkFontMgr_android.cpp b/chromium/third_party/skia/src/ports/SkFontMgr_android.cpp
index 49fc79adde5..c2a2908f54c 100644
--- a/chromium/third_party/skia/src/ports/SkFontMgr_android.cpp
+++ b/chromium/third_party/skia/src/ports/SkFontMgr_android.cpp
@@ -562,7 +562,7 @@ static char const * const gSystemFontUseStrings[] = {
sk_sp<SkFontMgr> SkFontMgr_New_Android(const SkFontMgr_Android_CustomFonts* custom) {
if (custom) {
SkASSERT(0 <= custom->fSystemFontUse);
- SkASSERT(custom->fSystemFontUse < SK_ARRAY_COUNT(gSystemFontUseStrings));
+ SkASSERT(custom->fSystemFontUse < std::size(gSystemFontUseStrings));
SkDEBUGF("SystemFontUse: %s BasePath: %s Fonts: %s FallbackFonts: %s\n",
gSystemFontUseStrings[custom->fSystemFontUse],
custom->fBasePath,
diff --git a/chromium/third_party/skia/src/ports/SkFontMgr_custom.cpp b/chromium/third_party/skia/src/ports/SkFontMgr_custom.cpp
index 72ccb029ea0..73a096dfba4 100644
--- a/chromium/third_party/skia/src/ports/SkFontMgr_custom.cpp
+++ b/chromium/third_party/skia/src/ports/SkFontMgr_custom.cpp
@@ -169,7 +169,7 @@ SkFontMgr_Custom::SkFontMgr_Custom(const SystemFontLoader& loader) : fDefaultFam
static const char* defaultNames[] = {
"Arial", "Verdana", "Times New Roman", "Droid Sans", nullptr
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(defaultNames); ++i) {
+ for (size_t i = 0; i < std::size(defaultNames); ++i) {
sk_sp<SkFontStyleSet_Custom> set(this->onMatchFamily(defaultNames[i]));
if (nullptr == set) {
continue;
diff --git a/chromium/third_party/skia/src/ports/SkFontMgr_fontconfig.cpp b/chromium/third_party/skia/src/ports/SkFontMgr_fontconfig.cpp
index c87f20ac7d2..d79ab014b96 100644
--- a/chromium/third_party/skia/src/ports/SkFontMgr_fontconfig.cpp
+++ b/chromium/third_party/skia/src/ports/SkFontMgr_fontconfig.cpp
@@ -220,7 +220,7 @@ static SkWeakReturn is_weak(FcPattern* pattern, const char object[], int id) {
// However, there appears to be no way to match/sort without it.
SkAutoFcConfig config;
FcFontSet* fontSets[1] = { fontSet };
- SkAutoFcPattern match(FcFontSetMatch(config, fontSets, SK_ARRAY_COUNT(fontSets),
+ SkAutoFcPattern match(FcFontSetMatch(config, fontSets, std::size(fontSets),
minimal, &result));
FcLangSet* matchLangSet;
@@ -321,7 +321,7 @@ static SkFontStyle skfontstyle_from_fcpattern(FcPattern* pattern) {
{ FC_WEIGHT_EXTRABLACK, SkFS::kExtraBlack_Weight },
};
SkScalar weight = map_ranges(get_int(pattern, FC_WEIGHT, FC_WEIGHT_REGULAR),
- weightRanges, SK_ARRAY_COUNT(weightRanges));
+ weightRanges, std::size(weightRanges));
static constexpr MapRanges widthRanges[] = {
{ FC_WIDTH_ULTRACONDENSED, SkFS::kUltraCondensed_Width },
@@ -335,7 +335,7 @@ static SkFontStyle skfontstyle_from_fcpattern(FcPattern* pattern) {
{ FC_WIDTH_ULTRAEXPANDED, SkFS::kUltraExpanded_Width },
};
SkScalar width = map_ranges(get_int(pattern, FC_WIDTH, FC_WIDTH_NORMAL),
- widthRanges, SK_ARRAY_COUNT(widthRanges));
+ widthRanges, std::size(widthRanges));
SkFS::Slant slant = SkFS::kUpright_Slant;
switch (get_int(pattern, FC_SLANT, FC_SLANT_ROMAN)) {
@@ -368,7 +368,7 @@ static void fcpattern_from_skfontstyle(SkFontStyle style, FcPattern* pattern) {
{ SkFS::kBlack_Weight, FC_WEIGHT_BLACK },
{ SkFS::kExtraBlack_Weight, FC_WEIGHT_EXTRABLACK },
};
- int weight = map_ranges(style.weight(), weightRanges, SK_ARRAY_COUNT(weightRanges));
+ int weight = map_ranges(style.weight(), weightRanges, std::size(weightRanges));
static constexpr MapRanges widthRanges[] = {
{ SkFS::kUltraCondensed_Width, FC_WIDTH_ULTRACONDENSED },
@@ -381,7 +381,7 @@ static void fcpattern_from_skfontstyle(SkFontStyle style, FcPattern* pattern) {
{ SkFS::kExtraExpanded_Width, FC_WIDTH_EXTRAEXPANDED },
{ SkFS::kUltraExpanded_Width, FC_WIDTH_ULTRAEXPANDED },
};
- int width = map_ranges(style.width(), widthRanges, SK_ARRAY_COUNT(widthRanges));
+ int width = map_ranges(style.width(), widthRanges, std::size(widthRanges));
int slant = FC_SLANT_ROMAN;
switch (style.slant()) {
@@ -620,7 +620,7 @@ class SkFontMgr_fontconfig : public SkFontMgr {
FcResult result;
FcFontSet* fontSets[1] = { fFontSet };
return FcFontSetMatch(fFontMgr->fFC,
- fontSets, SK_ARRAY_COUNT(fontSets),
+ fontSets, std::size(fontSets),
pattern, &result);
}());
@@ -649,7 +649,7 @@ class SkFontMgr_fontconfig : public SkFontMgr {
SkTDArray<size_t> sizes;
static const FcSetName fcNameSet[] = { FcSetSystem, FcSetApplication };
- for (int setIndex = 0; setIndex < (int)SK_ARRAY_COUNT(fcNameSet); ++setIndex) {
+ for (int setIndex = 0; setIndex < (int)std::size(fcNameSet); ++setIndex) {
// Return value of FcConfigGetFonts must not be destroyed.
FcFontSet* allFonts(FcConfigGetFonts(fcconfig, fcNameSet[setIndex]));
if (nullptr == allFonts) {
@@ -851,7 +851,7 @@ protected:
// The patterns are exactly the same except for the FC_FILE.
// It should be possible to collapse these patterns by normalizing.
static const FcSetName fcNameSet[] = { FcSetSystem, FcSetApplication };
- for (int setIndex = 0; setIndex < (int)SK_ARRAY_COUNT(fcNameSet); ++setIndex) {
+ for (int setIndex = 0; setIndex < (int)std::size(fcNameSet); ++setIndex) {
// Return value of FcConfigGetFonts must not be destroyed.
FcFontSet* allFonts(FcConfigGetFonts(fFC, fcNameSet[setIndex]));
if (nullptr == allFonts) {
diff --git a/chromium/third_party/skia/src/ports/SkFontMgr_mac_ct.cpp b/chromium/third_party/skia/src/ports/SkFontMgr_mac_ct.cpp
index f5af81e36cb..43edf326bb6 100644
--- a/chromium/third_party/skia/src/ports/SkFontMgr_mac_ct.cpp
+++ b/chromium/third_party/skia/src/ports/SkFontMgr_mac_ct.cpp
@@ -216,7 +216,7 @@ static const char* map_css_names(const char* name) {
{ "monospace", "Courier" }
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gPairs); i++) {
+ for (size_t i = 0; i < std::size(gPairs); i++) {
if (strcmp(name, gPairs[i].fFrom) == 0) {
return gPairs[i].fTo;
}
diff --git a/chromium/third_party/skia/src/ports/SkGlobalInitialization_default.cpp b/chromium/third_party/skia/src/ports/SkGlobalInitialization_default.cpp
index f05ed5df9b5..56727e1ccf2 100644
--- a/chromium/third_party/skia/src/ports/SkGlobalInitialization_default.cpp
+++ b/chromium/third_party/skia/src/ports/SkGlobalInitialization_default.cpp
@@ -27,7 +27,6 @@
#include "include/effects/SkShaderMaskFilter.h"
#include "include/effects/SkTableColorFilter.h"
#include "src/core/SkBlendModeBlender.h"
- #include "src/core/SkColorFilter_Matrix.h"
#include "src/core/SkImageFilter_Base.h"
#include "src/core/SkRecordedDrawable.h"
#include "src/effects/SkDashImpl.h"
@@ -36,9 +35,6 @@
#include "src/effects/SkTrimPE.h"
#include "src/shaders/SkBitmapProcShader.h"
#include "src/shaders/SkColorFilterShader.h"
- #include "src/shaders/SkColorShader.h"
- #include "src/shaders/SkComposeShader.h"
- #include "src/shaders/SkEmptyShader.h"
#include "src/shaders/SkImageShader.h"
#include "src/shaders/SkLocalMatrixShader.h"
#include "src/shaders/SkPictureShader.h"
@@ -65,11 +61,11 @@
*/
void SkFlattenable::PrivateInitializer::InitEffects() {
// Shaders.
- SK_REGISTER_FLATTENABLE(SkColor4Shader);
+ SkRegisterColor4ShaderFlattenable();
SK_REGISTER_FLATTENABLE(SkColorFilterShader);
- SK_REGISTER_FLATTENABLE(SkColorShader);
- SK_REGISTER_FLATTENABLE(SkShader_Blend);
- SK_REGISTER_FLATTENABLE(SkEmptyShader);
+ SkRegisterColorShaderFlattenable();
+ SkRegisterComposeShaderFlattenable();
+ SkRegisterEmptyShaderFlattenable();
SK_REGISTER_FLATTENABLE(SkLocalMatrixShader);
SK_REGISTER_FLATTENABLE(SkPictureShader);
SkGradientShader::RegisterFlattenables();
@@ -77,7 +73,7 @@
SkShaderBase::RegisterFlattenables();
// Color filters.
- SkColorFilter_Matrix::RegisterFlattenables();
+ SkRegisterMatrixColorFilterFlattenable();
SkColorFilterBase::RegisterFlattenables();
SkTableColorFilter::RegisterFlattenables();
diff --git a/chromium/third_party/skia/src/ports/SkImageEncoder_NDK.cpp b/chromium/third_party/skia/src/ports/SkImageEncoder_NDK.cpp
index d7f6005bb12..a11b5d61c93 100644
--- a/chromium/third_party/skia/src/ports/SkImageEncoder_NDK.cpp
+++ b/chromium/third_party/skia/src/ports/SkImageEncoder_NDK.cpp
@@ -5,6 +5,8 @@
* found in the LICENSE file.
*/
+#include "include/core/SkPixmap.h"
+#include "include/core/SkStream.h"
#include "include/private/SkTFitsIn.h"
#include "include/private/SkTo.h"
#include "src/images/SkImageEncoderPriv.h"
diff --git a/chromium/third_party/skia/src/ports/SkScalerContext_win_dw.cpp b/chromium/third_party/skia/src/ports/SkScalerContext_win_dw.cpp
index f1bf2e947fc..045b59a361c 100644
--- a/chromium/third_party/skia/src/ports/SkScalerContext_win_dw.cpp
+++ b/chromium/third_party/skia/src/ports/SkScalerContext_win_dw.cpp
@@ -12,11 +12,15 @@
#undef GetGlyphIndices
#include "include/codec/SkCodec.h"
+#include "include/core/SkBBHFactory.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkData.h"
#include "include/core/SkDrawable.h"
#include "include/core/SkFontMetrics.h"
+#include "include/core/SkGraphics.h"
+#include "include/core/SkOpenTypeSVGDecoder.h"
#include "include/core/SkPath.h"
+#include "include/core/SkPictureRecorder.h"
#include "include/private/SkMutex.h"
#include "include/private/SkTo.h"
#include "src/core/SkDraw.h"
@@ -567,6 +571,20 @@ bool SkScalerContext_DW::isPngGlyph(const SkGlyph& glyph) {
return f & DWRITE_GLYPH_IMAGE_FORMATS_PNG;
}
+bool SkScalerContext_DW::isSVGGlyph(const SkGlyph& glyph) {
+ if (!SkGraphics::GetOpenTypeSVGDecoderFactory() ||
+ !this->getDWriteTypeface()->fDWriteFontFace4)
+ {
+ return false;
+ }
+
+ DWRITE_GLYPH_IMAGE_FORMATS f;
+ IDWriteFontFace4* fontFace4 = this->getDWriteTypeface()->fDWriteFontFace4.get();
+ HRBM(fontFace4->GetGlyphImageFormats(glyph.getGlyphID(), 0, UINT32_MAX, &f),
+ "Cannot get glyph image formats.");
+ return f & DWRITE_GLYPH_IMAGE_FORMATS_SVG;
+}
+
bool SkScalerContext_DW::getColorGlyphRun(const SkGlyph& glyph,
IDWriteColorGlyphRunEnumerator** colorGlyph)
{
@@ -596,6 +614,23 @@ bool SkScalerContext_DW::getColorGlyphRun(const SkGlyph& glyph,
return true;
}
+void SkScalerContext_DW::SetGlyphBounds(SkGlyph* glyph, const SkRect& bounds) {
+ SkIRect ibounds = bounds.roundOut();
+
+ if (!SkTFitsIn<decltype(glyph->fWidth )>(ibounds.width ()) ||
+ !SkTFitsIn<decltype(glyph->fHeight)>(ibounds.height()) ||
+ !SkTFitsIn<decltype(glyph->fTop )>(ibounds.top ()) ||
+ !SkTFitsIn<decltype(glyph->fLeft )>(ibounds.left ()) )
+ {
+ ibounds = SkIRect::MakeEmpty();
+ }
+
+ glyph->fWidth = SkToU16(ibounds.width ());
+ glyph->fHeight = SkToU16(ibounds.height());
+ glyph->fTop = SkToS16(ibounds.top ());
+ glyph->fLeft = SkToS16(ibounds.left ());
+}
+
bool SkScalerContext_DW::generateColorMetrics(SkGlyph* glyph) {
SkTScopedComPtr<IDWriteColorGlyphRunEnumerator> colorLayers;
if (!getColorGlyphRun(*glyph, &colorLayers)) {
@@ -634,13 +669,24 @@ bool SkScalerContext_DW::generateColorMetrics(SkGlyph* glyph) {
SkFixedToScalar(glyph->getSubYFixed()));
}
matrix.mapRect(&bounds);
- // Round float bound values into integer.
- SkIRect ibounds = bounds.roundOut();
+ SetGlyphBounds(glyph, bounds);
+ return true;
+}
- glyph->fWidth = ibounds.fRight - ibounds.fLeft;
- glyph->fHeight = ibounds.fBottom - ibounds.fTop;
- glyph->fLeft = ibounds.fLeft;
- glyph->fTop = ibounds.fTop;
+bool SkScalerContext_DW::generateSVGMetrics(SkGlyph* glyph) {
+ SkPictureRecorder recorder;
+ SkRect infiniteRect = SkRect::MakeLTRB(-SK_ScalarInfinity, -SK_ScalarInfinity,
+ SK_ScalarInfinity, SK_ScalarInfinity);
+ sk_sp<SkBBoxHierarchy> bboxh = SkRTreeFactory()();
+ SkCanvas* recordingCanvas = recorder.beginRecording(infiniteRect, bboxh);
+ if (!this->drawSVGGlyphImage(*glyph, *recordingCanvas)) {
+ return false;
+ }
+ sk_sp<SkPicture> pic = recorder.finishRecordingAsPicture();
+ SkRect bounds = pic->cullRect();
+ SkASSERT(bounds.isFinite());
+
+ SetGlyphBounds(glyph, bounds);
return true;
}
@@ -701,12 +747,7 @@ bool SkScalerContext_DW::generatePngMetrics(SkGlyph* glyph) {
SkFixedToScalar(glyph->getSubYFixed()));
}
matrix.mapRect(&bounds);
- bounds.roundOut();
-
- glyph->fWidth = bounds.width();
- glyph->fHeight = bounds.height();
- glyph->fLeft = bounds.left();
- glyph->fTop = bounds.top();
+ SetGlyphBounds(glyph, bounds);
return true;
}
@@ -745,16 +786,27 @@ void SkScalerContext_DW::generateMetrics(SkGlyph* glyph, SkArenaAlloc* alloc) {
}
DWriteFontTypeface* typeface = this->getDWriteTypeface();
- if (typeface->fIsColorFont && isColorGlyph(*glyph) && generateColorMetrics(glyph)) {
- glyph->fMaskFormat = SkMask::kARGB32_Format;
- glyph->setPath(alloc, nullptr, false);
- return;
- }
+ if (typeface->fIsColorFont) {
+ if (isColorGlyph(*glyph) && generateColorMetrics(glyph)) {
+ glyph->fMaskFormat = SkMask::kARGB32_Format;
+ glyph->fScalerContextBits |= ScalerContextBits::COLR;
+ glyph->setPath(alloc, nullptr, false);
+ return;
+ }
- if (typeface->fIsColorFont && isPngGlyph(*glyph) && generatePngMetrics(glyph)) {
- glyph->fMaskFormat = SkMask::kARGB32_Format;
- glyph->setPath(alloc, nullptr, false);
- return;
+ if (isSVGGlyph(*glyph) && generateSVGMetrics(glyph)) {
+ glyph->fMaskFormat = SkMask::kARGB32_Format;
+ glyph->fScalerContextBits |= ScalerContextBits::SVG;
+ glyph->setPath(alloc, nullptr, false);
+ return;
+ }
+
+ if (isPngGlyph(*glyph) && generatePngMetrics(glyph)) {
+ glyph->fMaskFormat = SkMask::kARGB32_Format;
+ glyph->fScalerContextBits |= ScalerContextBits::PNG;
+ glyph->setPath(alloc, nullptr, false);
+ return;
+ }
}
RECT bbox;
@@ -1053,11 +1105,11 @@ const void* SkScalerContext_DW::drawDWMask(const SkGlyph& glyph,
return fBits.begin();
}
-void SkScalerContext_DW::drawColorGlyphImage(const SkGlyph& glyph, SkCanvas& canvas) {
+bool SkScalerContext_DW::drawColorGlyphImage(const SkGlyph& glyph, SkCanvas& canvas) {
SkTScopedComPtr<IDWriteColorGlyphRunEnumerator> colorLayers;
if (!getColorGlyphRun(glyph, &colorLayers)) {
- SK_ABORT("Could not get color layers");
- return;
+ SkASSERTF(false, "Could not get color layers");
+ return false;
}
SkPaint paint;
@@ -1075,7 +1127,7 @@ void SkScalerContext_DW::drawColorGlyphImage(const SkGlyph& glyph, SkCanvas& can
BOOL hasNextRun = FALSE;
while (SUCCEEDED(colorLayers->MoveNext(&hasNextRun)) && hasNextRun) {
const DWRITE_COLOR_GLYPH_RUN* colorGlyph;
- HRVM(colorLayers->GetCurrentRun(&colorGlyph), "Could not get current color glyph run");
+ HRBM(colorLayers->GetCurrentRun(&colorGlyph), "Could not get current color glyph run");
SkColor color;
if (colorGlyph->paletteIndex == 0xffff) {
@@ -1090,11 +1142,11 @@ void SkScalerContext_DW::drawColorGlyphImage(const SkGlyph& glyph, SkCanvas& can
SkPath path;
SkTScopedComPtr<IDWriteGeometrySink> geometryToPath;
- HRVM(SkDWriteGeometrySink::Create(&path, &geometryToPath),
+ HRBM(SkDWriteGeometrySink::Create(&path, &geometryToPath),
"Could not create geometry to path converter.");
{
Exclusive l(maybe_dw_mutex(*this->getDWriteTypeface()));
- HRVM(colorGlyph->glyphRun.fontFace->GetGlyphRunOutline(
+ HRBM(colorGlyph->glyphRun.fontFace->GetGlyphRunOutline(
colorGlyph->glyphRun.fontEmSize,
colorGlyph->glyphRun.glyphIndices,
colorGlyph->glyphRun.glyphAdvances,
@@ -1107,8 +1159,10 @@ void SkScalerContext_DW::drawColorGlyphImage(const SkGlyph& glyph, SkCanvas& can
}
canvas.drawPath(path, paint);
}
+ return true;
}
-void SkScalerContext_DW::generateColorGlyphImage(const SkGlyph& glyph) {
+
+bool SkScalerContext_DW::generateColorGlyphImage(const SkGlyph& glyph) {
SkASSERT(isColorGlyph(glyph));
SkASSERT(glyph.fMaskFormat == SkMask::Format::kARGB32_Format);
@@ -1127,14 +1181,79 @@ void SkScalerContext_DW::generateColorGlyphImage(const SkGlyph& glyph) {
}
canvas.translate(-SkIntToScalar(glyph.fLeft), -SkIntToScalar(glyph.fTop));
- this->drawColorGlyphImage(glyph, canvas);
+ return this->drawColorGlyphImage(glyph, canvas);
}
-void SkScalerContext_DW::drawPngGlyphImage(const SkGlyph& glyph, SkCanvas& canvas) {
+bool SkScalerContext_DW::drawSVGGlyphImage(const SkGlyph& glyph, SkCanvas& canvas) {
+ SkASSERT(isSVGGlyph(glyph));
+ SkASSERT(this->getDWriteTypeface()->fDWriteFontFace4);
+
+ SkGraphics::OpenTypeSVGDecoderFactory svgFactory = SkGraphics::GetOpenTypeSVGDecoderFactory();
+ if (!svgFactory) {
+ return false;
+ }
+
+ DWriteFontTypeface* typeface = this->getDWriteTypeface();
+ IDWriteFontFace4* fontFace4 = typeface->fDWriteFontFace4.get();
+ DWRITE_GLYPH_IMAGE_DATA glyphData;
+ void* glyphDataContext;
+ HRBM(fontFace4->GetGlyphImageData(glyph.getGlyphID(),
+ fTextSizeRender,
+ DWRITE_GLYPH_IMAGE_FORMATS_SVG,
+ &glyphData,
+ &glyphDataContext),
+ "Glyph SVG data could not be acquired.");
+ auto svgDecoder = svgFactory((const uint8_t*)glyphData.imageData, glyphData.imageDataSize);
+ fontFace4->ReleaseGlyphImageData(glyphDataContext);
+ if (!svgDecoder) {
+ return false;
+ }
+
+ size_t paletteEntryCount = typeface->fPaletteEntryCount;
+ SkColor* palette = typeface->fPalette.get();
+ int upem = typeface->getUnitsPerEm();
+
+ SkMatrix matrix = fSkXform;
+ SkScalar scale = fTextSizeRender / upem;
+ matrix.preScale(scale, scale);
+ matrix.preTranslate(-glyphData.horizontalLeftOrigin.x, -glyphData.horizontalLeftOrigin.y);
+ if (this->isSubpixel()) {
+ matrix.postTranslate(SkFixedToScalar(glyph.getSubXFixed()),
+ SkFixedToScalar(glyph.getSubYFixed()));
+ }
+ canvas.concat(matrix);
+
+ return svgDecoder->render(canvas, upem, glyph.getGlyphID(),
+ fRec.fForegroundColor, SkSpan(palette, paletteEntryCount));
+}
+
+bool SkScalerContext_DW::generateSVGGlyphImage(const SkGlyph& glyph) {
+ SkASSERT(isSVGGlyph(glyph));
+ SkASSERT(glyph.fMaskFormat == SkMask::Format::kARGB32_Format);
+
+ SkBitmap dstBitmap;
+ // TODO: mark this as sRGB when the blits will be sRGB.
+ dstBitmap.setInfo(SkImageInfo::Make(glyph.fWidth, glyph.fHeight,
+ kN32_SkColorType, kPremul_SkAlphaType),
+ glyph.rowBytes());
+ dstBitmap.setPixels(glyph.fImage);
+
+ SkCanvas canvas(dstBitmap);
+ if constexpr (kSkShowTextBlitCoverage) {
+ canvas.clear(0x33FF0000);
+ } else {
+ canvas.clear(SK_ColorTRANSPARENT);
+ }
+ canvas.translate(-SkIntToScalar(glyph.fLeft), -SkIntToScalar(glyph.fTop));
+
+ return this->drawSVGGlyphImage(glyph, canvas);
+}
+
+bool SkScalerContext_DW::drawPngGlyphImage(const SkGlyph& glyph, SkCanvas& canvas) {
IDWriteFontFace4* fontFace4 = this->getDWriteTypeface()->fDWriteFontFace4.get();
DWRITE_GLYPH_IMAGE_DATA glyphData;
void* glyphDataContext;
- HRVM(fontFace4->GetGlyphImageData(glyph.getGlyphID(),
+ HRBM(fontFace4->GetGlyphImageData(glyph.getGlyphID(),
fTextSizeRender,
DWRITE_GLYPH_IMAGE_FORMATS_PNG,
&glyphData,
@@ -1146,6 +1265,9 @@ void SkScalerContext_DW::drawPngGlyphImage(const SkGlyph& glyph, SkCanvas& canva
&ReleaseProc,
context);
sk_sp<SkImage> image = SkImage::MakeFromEncoded(std::move(data));
+ if (!image) {
+ return false;
+ }
if (this->isSubpixel()) {
canvas.translate(SkFixedToScalar(glyph.getSubXFixed()),
@@ -1156,9 +1278,10 @@ void SkScalerContext_DW::drawPngGlyphImage(const SkGlyph& glyph, SkCanvas& canva
canvas.scale(ratio, ratio);
canvas.translate(-glyphData.horizontalLeftOrigin.x, -glyphData.horizontalLeftOrigin.y);
canvas.drawImage(image, 0, 0);
+ return true;
}
-void SkScalerContext_DW::generatePngGlyphImage(const SkGlyph& glyph) {
+bool SkScalerContext_DW::generatePngGlyphImage(const SkGlyph& glyph) {
SkASSERT(isPngGlyph(glyph));
SkASSERT(glyph.fMaskFormat == SkMask::Format::kARGB32_Format);
SkASSERT(this->getDWriteTypeface()->fDWriteFontFace4);
@@ -1173,10 +1296,24 @@ void SkScalerContext_DW::generatePngGlyphImage(const SkGlyph& glyph) {
canvas.clear(SK_ColorTRANSPARENT);
canvas.translate(-glyph.left(), -glyph.top());
- this->drawPngGlyphImage(glyph, canvas);
+ return this->drawPngGlyphImage(glyph, canvas);
}
void SkScalerContext_DW::generateImage(const SkGlyph& glyph) {
+ ScalerContextBits::value_type format = glyph.fScalerContextBits & ScalerContextBits::FormatMask;
+ if (format == ScalerContextBits::COLR) {
+ this->generateColorGlyphImage(glyph);
+ return;
+ }
+ if (format == ScalerContextBits::SVG) {
+ this->generateSVGGlyphImage(glyph);
+ return;
+ }
+ if (format == ScalerContextBits::PNG) {
+ this->generatePngGlyphImage(glyph);
+ return;
+ }
+
//Create the mask.
DWRITE_RENDERING_MODE renderingMode = fRenderingMode;
DWRITE_TEXTURE_TYPE textureType = fTextureType;
@@ -1184,21 +1321,6 @@ void SkScalerContext_DW::generateImage(const SkGlyph& glyph) {
renderingMode = DWRITE_RENDERING_MODE_ALIASED;
textureType = DWRITE_TEXTURE_ALIASED_1x1;
}
-
- if (SkMask::kARGB32_Format == glyph.fMaskFormat) {
- if (this->getDWriteTypeface()->fIsColorFont) {
- if (isColorGlyph(glyph)) {
- this->generateColorGlyphImage(glyph);
- return;
- } else if (isPngGlyph(glyph)) {
- this->generatePngGlyphImage(glyph);
- return;
- }
- }
- SkDEBUGFAIL("Could not generate image from the given color font format.");
- return;
- }
-
const void* bits = this->drawDWMask(glyph, renderingMode, textureType);
if (!bits) {
sk_bzero(glyph.fImage, glyph.imageSize());
@@ -1280,22 +1402,41 @@ bool SkScalerContext_DW::generatePath(const SkGlyph& glyph, SkPath* path) {
}
sk_sp<SkDrawable> SkScalerContext_DW::generateDrawable(const SkGlyph& glyph) {
- struct DirectWriteGlyphDrawable : public SkDrawable {
+ struct GlyphDrawable : public SkDrawable {
SkScalerContext_DW* fSelf;
SkGlyph fGlyph;
- DirectWriteGlyphDrawable(SkScalerContext_DW* self, const SkGlyph& glyph)
- : fSelf(self), fGlyph(glyph) {}
+ GlyphDrawable(SkScalerContext_DW* self, const SkGlyph& glyph) : fSelf(self), fGlyph(glyph){}
SkRect onGetBounds() override { return fGlyph.rect(); }
- size_t onApproximateBytesUsed() override { return sizeof(DirectWriteGlyphDrawable); }
-
+ size_t onApproximateBytesUsed() override { return sizeof(GlyphDrawable); }
+ void maybeShowTextBlitCoverage(SkCanvas* canvas) {
+ if constexpr (kSkShowTextBlitCoverage) {
+ SkPaint paint;
+ paint.setColor(0x3300FF00);
+ paint.setStyle(SkPaint::kFill_Style);
+ canvas->drawRect(this->onGetBounds(), paint);
+ }
+ }
+ };
+ struct COLRGlyphDrawable : public GlyphDrawable {
+ using GlyphDrawable::GlyphDrawable;
void onDraw(SkCanvas* canvas) override {
+ this->maybeShowTextBlitCoverage(canvas);
fSelf->drawColorGlyphImage(fGlyph, *canvas);
}
};
- if (this->getDWriteTypeface()->fIsColorFont) {
- if (isColorGlyph(glyph)) {
- return sk_sp<DirectWriteGlyphDrawable>(new DirectWriteGlyphDrawable(this, glyph));
+ struct SVGGlyphDrawable : public GlyphDrawable {
+ using GlyphDrawable::GlyphDrawable;
+ void onDraw(SkCanvas* canvas) override {
+ this->maybeShowTextBlitCoverage(canvas);
+ fSelf->drawSVGGlyphImage(fGlyph, *canvas);
}
+ };
+ ScalerContextBits::value_type format = glyph.fScalerContextBits & ScalerContextBits::FormatMask;
+ if (format == ScalerContextBits::COLR) {
+ return sk_sp<SkDrawable>(new COLRGlyphDrawable(this, glyph));
+ }
+ if (format == ScalerContextBits::SVG) {
+ return sk_sp<SkDrawable>(new SVGGlyphDrawable(this, glyph));
}
return nullptr;
}
diff --git a/chromium/third_party/skia/src/ports/SkScalerContext_win_dw.h b/chromium/third_party/skia/src/ports/SkScalerContext_win_dw.h
index 7d66a2a32d4..c89c54ee25e 100644
--- a/chromium/third_party/skia/src/ports/SkScalerContext_win_dw.h
+++ b/chromium/third_party/skia/src/ports/SkScalerContext_win_dw.h
@@ -39,6 +39,12 @@ private:
struct ScalerContextBits {
using value_type = decltype(SkGlyph::fScalerContextBits);
static const constexpr value_type ForceBW = 1 << 0;
+
+ static const constexpr value_type OUTLINE = 0 << 1;
+ static const constexpr value_type PNG = 1 << 1;
+ static const constexpr value_type SVG = 2 << 1;
+ static const constexpr value_type COLR = 3 << 1;
+ static const constexpr value_type FormatMask = 0x3 << 1;
};
static void BilevelToBW(const uint8_t* SK_RESTRICT src, const SkGlyph& glyph);
@@ -73,14 +79,20 @@ private:
bool isColorGlyph(const SkGlyph&);
bool getColorGlyphRun(const SkGlyph&, IDWriteColorGlyphRunEnumerator**);
bool generateColorMetrics(SkGlyph*);
- void generateColorGlyphImage(const SkGlyph&);
- void drawColorGlyphImage(const SkGlyph&, SkCanvas&);
+ bool generateColorGlyphImage(const SkGlyph&);
+ bool drawColorGlyphImage(const SkGlyph&, SkCanvas&);
+
+ bool isSVGGlyph(const SkGlyph&);
+ bool generateSVGMetrics(SkGlyph*);
+ bool generateSVGGlyphImage(const SkGlyph&);
+ bool drawSVGGlyphImage(const SkGlyph&, SkCanvas&);
bool isPngGlyph(const SkGlyph&);
bool generatePngMetrics(SkGlyph*);
- void generatePngGlyphImage(const SkGlyph&);
- void drawPngGlyphImage(const SkGlyph&, SkCanvas&);
+ bool generatePngGlyphImage(const SkGlyph&);
+ bool drawPngGlyphImage(const SkGlyph&, SkCanvas&);
+ static void SetGlyphBounds(SkGlyph* glyph, const SkRect& bounds);
SkTDArray<uint8_t> fBits;
/** The total matrix without the text height scale. */
diff --git a/chromium/third_party/skia/src/ports/SkTypeface_mac_ct.cpp b/chromium/third_party/skia/src/ports/SkTypeface_mac_ct.cpp
index 970e131b6f5..8923f418043 100644
--- a/chromium/third_party/skia/src/ports/SkTypeface_mac_ct.cpp
+++ b/chromium/third_party/skia/src/ports/SkTypeface_mac_ct.cpp
@@ -343,7 +343,7 @@ CGFloat SkCTFontCTWeightForCSSWeight(int fontstyleWeight) {
}
});
static constexpr Interpolator nativeInterpolator(
- nativeWeightMappings, SK_ARRAY_COUNT(nativeWeightMappings));
+ nativeWeightMappings, std::size(nativeWeightMappings));
return nativeInterpolator.map(fontstyleWeight);
}
@@ -374,9 +374,9 @@ static int ct_weight_to_fontstyle(CGFloat cgWeight, bool fromDataProvider) {
}
});
static constexpr Interpolator nativeInterpolator(
- nativeWeightMappings, SK_ARRAY_COUNT(nativeWeightMappings));
+ nativeWeightMappings, std::size(nativeWeightMappings));
static constexpr Interpolator dataProviderInterpolator(
- dataProviderWeightMappings, SK_ARRAY_COUNT(dataProviderWeightMappings));
+ dataProviderWeightMappings, std::size(dataProviderWeightMappings));
return fromDataProvider ? dataProviderInterpolator.map(cgWeight)
: nativeInterpolator.map(cgWeight);
@@ -392,7 +392,7 @@ CGFloat SkCTFontCTWidthForCSSWidth(int fontstyleWidth) {
{ 0, -0.5 },
{ 10, 0.5 },
};
- static constexpr Interpolator interpolator(widthMappings, SK_ARRAY_COUNT(widthMappings));
+ static constexpr Interpolator interpolator(widthMappings, std::size(widthMappings));
return interpolator.map(fontstyleWidth);
}
@@ -406,7 +406,7 @@ static int ct_width_to_fontstyle(CGFloat cgWidth) {
{ -0.5, 0 },
{ 0.5, 10 },
};
- static constexpr Interpolator interpolator(widthMappings, SK_ARRAY_COUNT(widthMappings));
+ static constexpr Interpolator interpolator(widthMappings, std::size(widthMappings));
return interpolator.map(cgWidth);
}
diff --git a/chromium/third_party/skia/src/sfnt/SkOTTable_name.cpp b/chromium/third_party/skia/src/sfnt/SkOTTable_name.cpp
index 90d59558ecb..8ceef664e81 100644
--- a/chromium/third_party/skia/src/sfnt/SkOTTable_name.cpp
+++ b/chromium/third_party/skia/src/sfnt/SkOTTable_name.cpp
@@ -574,7 +574,7 @@ bool SkOTTableName::Iterator::next(SkOTTableName::Iterator::Record& record) {
// Handle format 0 languages, translating them into BCP 47.
const BCP47FromLanguageId target = { languageID, "" };
int languageIndex = SkTSearch<BCP47FromLanguageId, BCP47FromLanguageIdLess>(
- BCP47FromLanguageID, SK_ARRAY_COUNT(BCP47FromLanguageID), target, sizeof(target));
+ BCP47FromLanguageID, std::size(BCP47FromLanguageID), target, sizeof(target));
if (languageIndex >= 0) {
record.language = BCP47FromLanguageID[languageIndex].bcp47;
return true;
diff --git a/chromium/third_party/skia/src/sfnt/SkOTUtils.cpp b/chromium/third_party/skia/src/sfnt/SkOTUtils.cpp
index b80f969aa22..a679ae41b0c 100644
--- a/chromium/third_party/skia/src/sfnt/SkOTUtils.cpp
+++ b/chromium/third_party/skia/src/sfnt/SkOTUtils.cpp
@@ -191,7 +191,7 @@ sk_sp<SkOTUtils::LocalizedStrings_NameTable>
SkOTUtils::LocalizedStrings_NameTable::MakeForFamilyNames(const SkTypeface& typeface) {
return Make(typeface,
SkOTUtils::LocalizedStrings_NameTable::familyNameTypes,
- SK_ARRAY_COUNT(SkOTUtils::LocalizedStrings_NameTable::familyNameTypes));
+ std::size(SkOTUtils::LocalizedStrings_NameTable::familyNameTypes));
}
bool SkOTUtils::LocalizedStrings_NameTable::next(SkTypeface::LocalizedString* localizedString) {
diff --git a/chromium/third_party/skia/src/shaders/BUILD.bazel b/chromium/third_party/skia/src/shaders/BUILD.bazel
index 06630f4c8c2..d55dacd9adb 100644
--- a/chromium/third_party/skia/src/shaders/BUILD.bazel
+++ b/chromium/third_party/skia/src/shaders/BUILD.bazel
@@ -1,4 +1,4 @@
-load("//bazel:macros.bzl", "exports_files_legacy", "split_srcs_and_hdrs")
+load("//bazel:macros.bzl", "bool_flag", "exports_files_legacy", "split_srcs_and_hdrs")
licenses(["notice"])
@@ -10,17 +10,13 @@ SHADER_FILES = [
"SkColorFilterShader.cpp",
"SkColorFilterShader.h",
"SkColorShader.cpp",
- "SkColorShader.h",
"SkComposeShader.cpp",
- "SkComposeShader.h",
- "SkEmptyShader.h",
+ "SkEmptyShader.cpp",
"SkImageShader.cpp",
"SkImageShader.h",
"SkLocalMatrixShader.cpp",
"SkLocalMatrixShader.h",
"SkPerlinNoiseShader.cpp",
- "SkPictureShader.cpp",
- "SkPictureShader.h",
"SkShader.cpp",
"SkShaderBase.h",
"SkTransformShader.cpp",
@@ -32,10 +28,28 @@ split_srcs_and_hdrs(
files = SHADER_FILES,
)
+# Maintain SkPicture files in separate filegroups so that the legacy
+# skia_skpicture_sources GNI file list can be created.
+SKPICTURE_FILES = [
+ "SkPictureShader.cpp",
+ "SkPictureShader.h",
+]
+
+split_srcs_and_hdrs(
+ name = "skpicture",
+ files = SKPICTURE_FILES,
+)
+
+bool_flag(
+ default = True,
+ flag_name = "legacy_shader_context",
+)
+
filegroup(
name = "srcs",
srcs = [
":shader_srcs",
+ ":skpicture_srcs",
"//src/shaders/gradients:srcs",
],
visibility = ["//src:__pkg__"],
@@ -45,6 +59,7 @@ filegroup(
name = "private_hdrs",
srcs = [
":shader_hdrs",
+ ":skpicture_hdrs",
"//src/shaders/gradients:private_hdrs",
],
visibility = ["//src:__pkg__"],
diff --git a/chromium/third_party/skia/src/shaders/SkColorFilterShader.cpp b/chromium/third_party/skia/src/shaders/SkColorFilterShader.cpp
index 90f5d055895..24aeeb36969 100644
--- a/chromium/third_party/skia/src/shaders/SkColorFilterShader.cpp
+++ b/chromium/third_party/skia/src/shaders/SkColorFilterShader.cpp
@@ -102,7 +102,7 @@ std::unique_ptr<GrFragmentProcessor> SkColorFilterShader::asFragmentProcessor(
SkASSERT(fAlpha == 1.0f);
auto [success, fp] = fFilter->asFragmentProcessor(std::move(shaderFP), args.fContext,
- *args.fDstColorInfo);
+ *args.fDstColorInfo, args.fSurfaceProps);
// If the filter FP could not be created, we still want to return the shader FP, so checking
// success can be omitted here.
return std::move(fp);
diff --git a/chromium/third_party/skia/src/shaders/SkColorShader.cpp b/chromium/third_party/skia/src/shaders/SkColorShader.cpp
index 7de422e64c3..93eaa9348a1 100644
--- a/chromium/third_party/skia/src/shaders/SkColorShader.cpp
+++ b/chromium/third_party/skia/src/shaders/SkColorShader.cpp
@@ -5,9 +5,8 @@
* found in the LICENSE file.
*/
-#include "src/shaders/SkColorShader.h"
-
#include "include/core/SkColorSpace.h"
+#include "include/core/SkFlattenable.h"
#include "src/core/SkArenaAlloc.h"
#include "src/core/SkColorSpacePriv.h"
#include "src/core/SkColorSpaceXformSteps.h"
@@ -21,6 +20,89 @@
#include "src/core/SkPaintParamsKey.h"
#endif
+#include "src/shaders/SkShaderBase.h"
+
+class SkShaderCodeDictionary;
+
+/** \class SkColorShader
+ A Shader that represents a single color. In general, this effect can be
+ accomplished by just using the color field on the paint, but if an
+ actual shader object is needed, this provides that feature.
+*/
+class SkColorShader : public SkShaderBase {
+public:
+ /** Create a ColorShader that ignores the color in the paint, and uses the
+ specified color. Note: like all shaders, at draw time the paint's alpha
+ will be respected, and is applied to the specified color.
+ */
+ explicit SkColorShader(SkColor c);
+
+ bool isOpaque() const override;
+ bool isConstant() const override { return true; }
+
+ GradientType asAGradient(GradientInfo* info) const override;
+
+#if SK_SUPPORT_GPU
+ std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
+#endif
+
+#ifdef SK_ENABLE_SKSL
+ void addToKey(const SkKeyContext&,
+ SkPaintParamsKeyBuilder*,
+ SkPipelineDataGatherer*) const override;
+#endif
+
+private:
+ friend void ::SkRegisterColorShaderFlattenable();
+ SK_FLATTENABLE_HOOKS(SkColorShader)
+
+ void flatten(SkWriteBuffer&) const override;
+
+ bool onAsLuminanceColor(SkColor* lum) const override {
+ *lum = fColor;
+ return true;
+ }
+
+ bool onAppendStages(const SkStageRec&) const override;
+
+ skvm::Color onProgram(skvm::Builder*, skvm::Coord device, skvm::Coord local, skvm::Color paint,
+ const SkMatrixProvider&, const SkMatrix* localM, const SkColorInfo& dst,
+ skvm::Uniforms* uniforms, SkArenaAlloc*) const override;
+
+ SkColor fColor;
+};
+
+class SkColor4Shader : public SkShaderBase {
+public:
+ SkColor4Shader(const SkColor4f&, sk_sp<SkColorSpace>);
+
+ bool isOpaque() const override { return fColor.isOpaque(); }
+ bool isConstant() const override { return true; }
+
+#if SK_SUPPORT_GPU
+ std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
+#endif
+#ifdef SK_ENABLE_SKSL
+ void addToKey(const SkKeyContext&,
+ SkPaintParamsKeyBuilder*,
+ SkPipelineDataGatherer*) const override;
+#endif
+
+private:
+ friend void ::SkRegisterColor4ShaderFlattenable();
+ SK_FLATTENABLE_HOOKS(SkColor4Shader)
+
+ void flatten(SkWriteBuffer&) const override;
+ bool onAppendStages(const SkStageRec&) const override;
+
+ skvm::Color onProgram(skvm::Builder*, skvm::Coord device, skvm::Coord local, skvm::Color paint,
+ const SkMatrixProvider&, const SkMatrix* localM, const SkColorInfo& dst,
+ skvm::Uniforms* uniforms, SkArenaAlloc*) const override;
+
+ sk_sp<SkColorSpace> fColorSpace;
+ const SkColor4f fColor;
+};
+
SkColorShader::SkColorShader(SkColor c) : fColor(c) {}
bool SkColorShader::isOpaque() const {
@@ -73,14 +155,6 @@ void SkColor4Shader::flatten(SkWriteBuffer& buffer) const {
}
}
-
-sk_sp<SkShader> SkShaders::Color(const SkColor4f& color, sk_sp<SkColorSpace> space) {
- if (!SkScalarsAreFinite(color.vec(), 4)) {
- return nullptr;
- }
- return sk_make_sp<SkColor4Shader>(color, std::move(space));
-}
-
bool SkColorShader::onAppendStages(const SkStageRec& rec) const {
SkColor4f color = SkColor4f::FromColor(fColor);
SkColorSpaceXformSteps(sk_srgb_singleton(), kUnpremul_SkAlphaType,
@@ -157,3 +231,20 @@ void SkColor4Shader::addToKey(const SkKeyContext& keyContext,
builder->endBlock();
}
#endif
+
+sk_sp<SkShader> SkShaders::Color(SkColor color) { return sk_make_sp<SkColorShader>(color); }
+
+sk_sp<SkShader> SkShaders::Color(const SkColor4f& color, sk_sp<SkColorSpace> space) {
+ if (!SkScalarsAreFinite(color.vec(), 4)) {
+ return nullptr;
+ }
+ return sk_make_sp<SkColor4Shader>(color, std::move(space));
+}
+
+void SkRegisterColor4ShaderFlattenable() {
+ SK_REGISTER_FLATTENABLE(SkColor4Shader);
+}
+
+void SkRegisterColorShaderFlattenable() {
+ SK_REGISTER_FLATTENABLE(SkColorShader);
+}
diff --git a/chromium/third_party/skia/src/shaders/SkColorShader.h b/chromium/third_party/skia/src/shaders/SkColorShader.h
deleted file mode 100644
index f24474b5fb5..00000000000
--- a/chromium/third_party/skia/src/shaders/SkColorShader.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2007 The Android Open Source Project
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkColorShader_DEFINED
-#define SkColorShader_DEFINED
-
-#include "src/shaders/SkShaderBase.h"
-
-class SkShaderCodeDictionary;
-
-/** \class SkColorShader
- A Shader that represents a single color. In general, this effect can be
- accomplished by just using the color field on the paint, but if an
- actual shader object is needed, this provides that feature.
-*/
-class SkColorShader : public SkShaderBase {
-public:
- /** Create a ColorShader that ignores the color in the paint, and uses the
- specified color. Note: like all shaders, at draw time the paint's alpha
- will be respected, and is applied to the specified color.
- */
- explicit SkColorShader(SkColor c);
-
- bool isOpaque() const override;
- bool isConstant() const override { return true; }
-
- GradientType asAGradient(GradientInfo* info) const override;
-
-#if SK_SUPPORT_GPU
- std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
-#endif
-
-#ifdef SK_ENABLE_SKSL
- void addToKey(const SkKeyContext&,
- SkPaintParamsKeyBuilder*,
- SkPipelineDataGatherer*) const override;
-#endif
-
-private:
- SK_FLATTENABLE_HOOKS(SkColorShader)
-
- void flatten(SkWriteBuffer&) const override;
-
- bool onAsLuminanceColor(SkColor* lum) const override {
- *lum = fColor;
- return true;
- }
-
- bool onAppendStages(const SkStageRec&) const override;
-
- skvm::Color onProgram(skvm::Builder*, skvm::Coord device, skvm::Coord local, skvm::Color paint,
- const SkMatrixProvider&, const SkMatrix* localM, const SkColorInfo& dst,
- skvm::Uniforms* uniforms, SkArenaAlloc*) const override;
-
- SkColor fColor;
-};
-
-class SkColor4Shader : public SkShaderBase {
-public:
- SkColor4Shader(const SkColor4f&, sk_sp<SkColorSpace>);
-
- bool isOpaque() const override { return fColor.isOpaque(); }
- bool isConstant() const override { return true; }
-
-#if SK_SUPPORT_GPU
- std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
-#endif
-#ifdef SK_ENABLE_SKSL
- void addToKey(const SkKeyContext&,
- SkPaintParamsKeyBuilder*,
- SkPipelineDataGatherer*) const override;
-#endif
-
-private:
- SK_FLATTENABLE_HOOKS(SkColor4Shader)
-
- void flatten(SkWriteBuffer&) const override;
- bool onAppendStages(const SkStageRec&) const override;
-
- skvm::Color onProgram(skvm::Builder*, skvm::Coord device, skvm::Coord local, skvm::Color paint,
- const SkMatrixProvider&, const SkMatrix* localM, const SkColorInfo& dst,
- skvm::Uniforms* uniforms, SkArenaAlloc*) const override;
-
- sk_sp<SkColorSpace> fColorSpace;
- const SkColor4f fColor;
-};
-
-#endif
diff --git a/chromium/third_party/skia/src/shaders/SkComposeShader.cpp b/chromium/third_party/skia/src/shaders/SkComposeShader.cpp
index 2f16c8b48be..81993a9e523 100644
--- a/chromium/third_party/skia/src/shaders/SkComposeShader.cpp
+++ b/chromium/third_party/skia/src/shaders/SkComposeShader.cpp
@@ -6,6 +6,7 @@
*/
#include "include/core/SkColorFilter.h"
+#include "include/core/SkFlattenable.h"
#include "include/core/SkString.h"
#include "include/private/SkColorData.h"
#include "src/core/SkArenaAlloc.h"
@@ -16,8 +17,6 @@
#include "src/core/SkRuntimeEffectPriv.h"
#include "src/core/SkVM.h"
#include "src/core/SkWriteBuffer.h"
-#include "src/shaders/SkColorShader.h"
-#include "src/shaders/SkComposeShader.h"
#ifdef SK_ENABLE_SKSL
#include "src/core/SkKeyHelpers.h"
@@ -47,30 +46,48 @@ private:
} // namespace
-sk_sp<SkShader> SkShaders::Blend(SkBlendMode mode, sk_sp<SkShader> dst, sk_sp<SkShader> src) {
- if (!src || !dst) {
- return nullptr;
- }
- switch (mode) {
- case SkBlendMode::kClear: return Color(0);
- case SkBlendMode::kDst: return dst;
- case SkBlendMode::kSrc: return src;
- default: break;
- }
- return sk_sp<SkShader>(new SkShader_Blend(mode, std::move(dst), std::move(src)));
-}
+///////////////////////////////////////////////////////////////////////////////
-sk_sp<SkShader> SkShaders::Blend(sk_sp<SkBlender> blender, sk_sp<SkShader> dst, sk_sp<SkShader> src) {
- if (!src || !dst) {
- return nullptr;
- }
- if (!blender) {
- return SkShaders::Blend(SkBlendMode::kSrcOver, std::move(dst), std::move(src));
- }
- return sk_sp<SkShader>(new SkShader_Blend(std::move(blender), std::move(dst), std::move(src)));
-}
+class SkShader_Blend final : public SkShaderBase {
+public:
+ SkShader_Blend(SkBlendMode mode, sk_sp<SkShader> dst, sk_sp<SkShader> src)
+ : fDst(std::move(dst))
+ , fSrc(std::move(src))
+ , fBlender(nullptr)
+ , fMode(mode)
+ {}
-///////////////////////////////////////////////////////////////////////////////
+ SkShader_Blend(sk_sp<SkBlender> blender, sk_sp<SkShader> dst, sk_sp<SkShader> src);
+
+#if SK_SUPPORT_GPU
+ std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
+#endif
+
+#ifdef SK_ENABLE_SKSL
+ void addToKey(const SkKeyContext&,
+ SkPaintParamsKeyBuilder*,
+ SkPipelineDataGatherer*) const override;
+#endif
+
+protected:
+ SkShader_Blend(SkReadBuffer&);
+ void flatten(SkWriteBuffer&) const override;
+ bool onAppendStages(const SkStageRec&) const override;
+ skvm::Color onProgram(skvm::Builder*, skvm::Coord device, skvm::Coord local, skvm::Color paint,
+ const SkMatrixProvider&, const SkMatrix* localM, const SkColorInfo& dst,
+ skvm::Uniforms*, SkArenaAlloc*) const override;
+
+private:
+ friend void ::SkRegisterComposeShaderFlattenable();
+ SK_FLATTENABLE_HOOKS(SkShader_Blend)
+
+ sk_sp<SkShader> fDst;
+ sk_sp<SkShader> fSrc;
+ sk_sp<SkBlender> fBlender; // if null, use fMode
+ SkBlendMode fMode; // only use if fBlender is null
+
+ using INHERITED = SkShaderBase;
+};
SkShader_Blend::SkShader_Blend(sk_sp<SkBlender> blender, sk_sp<SkShader> dst, sk_sp<SkShader> src)
: fDst(std::move(dst))
@@ -209,3 +226,32 @@ void SkShader_Blend::addToKey(const SkKeyContext& keyContext,
builder->endBlock();
}
#endif
+
+sk_sp<SkShader> SkShaders::Blend(SkBlendMode mode, sk_sp<SkShader> dst, sk_sp<SkShader> src) {
+ if (!src || !dst) {
+ return nullptr;
+ }
+ switch (mode) {
+ case SkBlendMode::kClear: return Color(0);
+ case SkBlendMode::kDst: return dst;
+ case SkBlendMode::kSrc: return src;
+ default: break;
+ }
+ return sk_sp<SkShader>(new SkShader_Blend(mode, std::move(dst), std::move(src)));
+}
+
+sk_sp<SkShader> SkShaders::Blend(sk_sp<SkBlender> blender,
+ sk_sp<SkShader> dst,
+ sk_sp<SkShader> src) {
+ if (!src || !dst) {
+ return nullptr;
+ }
+ if (!blender) {
+ return SkShaders::Blend(SkBlendMode::kSrcOver, std::move(dst), std::move(src));
+ }
+ return sk_sp<SkShader>(new SkShader_Blend(std::move(blender), std::move(dst), std::move(src)));
+}
+
+void SkRegisterComposeShaderFlattenable() {
+ SK_REGISTER_FLATTENABLE(SkShader_Blend);
+}
diff --git a/chromium/third_party/skia/src/shaders/SkComposeShader.h b/chromium/third_party/skia/src/shaders/SkComposeShader.h
deleted file mode 100644
index 7a3c467626b..00000000000
--- a/chromium/third_party/skia/src/shaders/SkComposeShader.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2006 The Android Open Source Project
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkComposeShader_DEFINED
-#define SkComposeShader_DEFINED
-
-#include "include/core/SkBlendMode.h"
-#include "src/core/SkBlendModePriv.h"
-#include "src/core/SkBlenderBase.h"
-#include "src/shaders/SkShaderBase.h"
-
-class SkShaderCodeDictionary;
-
-class SkShader_Blend final : public SkShaderBase {
-public:
- SkShader_Blend(SkBlendMode mode, sk_sp<SkShader> dst, sk_sp<SkShader> src)
- : fDst(std::move(dst))
- , fSrc(std::move(src))
- , fBlender(nullptr)
- , fMode(mode)
- {}
-
- SkShader_Blend(sk_sp<SkBlender> blender, sk_sp<SkShader> dst, sk_sp<SkShader> src);
-
-#if SK_SUPPORT_GPU
- std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
-#endif
-
-#ifdef SK_ENABLE_SKSL
- void addToKey(const SkKeyContext&,
- SkPaintParamsKeyBuilder*,
- SkPipelineDataGatherer*) const override;
-#endif
-
-protected:
- SkShader_Blend(SkReadBuffer&);
- void flatten(SkWriteBuffer&) const override;
- bool onAppendStages(const SkStageRec&) const override;
- skvm::Color onProgram(skvm::Builder*, skvm::Coord device, skvm::Coord local, skvm::Color paint,
- const SkMatrixProvider&, const SkMatrix* localM, const SkColorInfo& dst,
- skvm::Uniforms*, SkArenaAlloc*) const override;
-
-private:
- SK_FLATTENABLE_HOOKS(SkShader_Blend)
-
- sk_sp<SkShader> fDst;
- sk_sp<SkShader> fSrc;
- sk_sp<SkBlender> fBlender; // if null, use fMode
- SkBlendMode fMode; // only use if fBlender is null
-
- using INHERITED = SkShaderBase;
-};
-
-#endif
diff --git a/chromium/third_party/skia/src/shaders/SkEmptyShader.h b/chromium/third_party/skia/src/shaders/SkEmptyShader.cpp
index 4f605176572..77d3bbacaee 100644
--- a/chromium/third_party/skia/src/shaders/SkEmptyShader.h
+++ b/chromium/third_party/skia/src/shaders/SkEmptyShader.cpp
@@ -1,16 +1,14 @@
/*
- * Copyright 2011 Google Inc.
+ * Copyright 2022 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#ifndef SkEmptyShader_DEFINED
-#define SkEmptyShader_DEFINED
-
#include "src/shaders/SkShaderBase.h"
-// TODO: move this to private, as there is a public factory on SkShader
+#include "include/core/SkFlattenable.h"
+#include "src/core/SkVM.h"
/**
* \class SkEmptyShader
@@ -21,12 +19,6 @@ public:
SkEmptyShader() {}
protected:
-#ifdef SK_ENABLE_LEGACY_SHADERCONTEXT
- Context* onMakeContext(const ContextRec&, SkArenaAlloc*) const override {
- return nullptr;
- }
-#endif
-
void flatten(SkWriteBuffer& buffer) const override {
// Do nothing.
// We just don't want to fall through to SkShader::flatten(),
@@ -42,9 +34,24 @@ protected:
skvm::Uniforms*, SkArenaAlloc*) const override;
private:
+ friend void ::SkRegisterEmptyShaderFlattenable();
SK_FLATTENABLE_HOOKS(SkEmptyShader)
using INHERITED = SkShaderBase;
};
-#endif
+skvm::Color SkEmptyShader::onProgram(skvm::Builder*, skvm::Coord, skvm::Coord, skvm::Color,
+ const SkMatrixProvider&, const SkMatrix*, const SkColorInfo&,
+ skvm::Uniforms*, SkArenaAlloc*) const {
+ return {}; // signal failure
+}
+
+sk_sp<SkFlattenable> SkEmptyShader::CreateProc(SkReadBuffer&) {
+ return SkShaders::Empty();
+}
+
+sk_sp<SkShader> SkShaders::Empty() { return sk_make_sp<SkEmptyShader>(); }
+
+void SkRegisterEmptyShaderFlattenable() {
+ SK_REGISTER_FLATTENABLE(SkEmptyShader);
+}
diff --git a/chromium/third_party/skia/src/shaders/SkImageShader.cpp b/chromium/third_party/skia/src/shaders/SkImageShader.cpp
index 49f9800c0cd..e83b529d5bd 100755
--- a/chromium/third_party/skia/src/shaders/SkImageShader.cpp
+++ b/chromium/third_party/skia/src/shaders/SkImageShader.cpp
@@ -21,13 +21,12 @@
#include "src/core/SkWriteBuffer.h"
#include "src/image/SkImage_Base.h"
#include "src/shaders/SkBitmapProcShader.h"
-#include "src/shaders/SkEmptyShader.h"
#include "src/shaders/SkTransformShader.h"
#ifdef SK_ENABLE_SKSL
#ifdef SK_GRAPHITE_ENABLED
-#include "src/gpu/graphite/Image_Graphite.h"
+#include "src/gpu/graphite/ImageUtils.h"
#endif
#include "src/core/SkKeyContext.h"
@@ -79,7 +78,7 @@ static SkTileMode optimize(SkTileMode tm, int dimension) {
// TODO: currently this only *always* used in asFragmentProcessor(), which is excluded on no-gpu
// builds. No-gpu builds only use needs_subset() in asserts, so release+no-gpu doesn't use it, which
// can cause builds to fail if unused warnings are treated as errors.
-SK_MAYBE_UNUSED static bool needs_subset(SkImage* img, const SkRect& subset) {
+[[maybe_unused]] static bool needs_subset(SkImage* img, const SkRect& subset) {
return subset != SkRect::Make(img->dimensions());
}
@@ -301,7 +300,7 @@ sk_sp<SkShader> SkImageShader::MakeRaw(sk_sp<SkImage> image,
return nullptr;
}
if (!image) {
- return sk_make_sp<SkEmptyShader>();
+ return SkShaders::Empty();
}
return sk_sp<SkShader>{new SkImageShader(
image, SkRect::Make(image->dimensions()), tmx, tmy, options, localMatrix,
@@ -323,7 +322,7 @@ sk_sp<SkShader> SkImageShader::MakeSubset(sk_sp<SkImage> image,
}
}
if (!image || subset.isEmpty()) {
- return sk_make_sp<SkEmptyShader>();
+ return SkShaders::Empty();
}
// Validate subset and check if we can drop it
@@ -387,12 +386,17 @@ void SkImageShader::addToKey(const SkKeyContext& keyContext,
this->getLocalMatrix());
#ifdef SK_GRAPHITE_ENABLED
- if (as_IB(fImage)->isGraphiteBacked()) {
- skgpu::graphite::Image* grImage = static_cast<skgpu::graphite::Image*>(fImage.get());
+ auto [ imageToDraw, newSampling ] = skgpu::graphite::GetGraphiteBacked(keyContext.recorder(),
+ fImage.get(),
+ fSampling);
- auto mipmapped = (fSampling.mipmap != SkMipmapMode::kNone) ?
- skgpu::graphite::Mipmapped::kYes : skgpu::graphite::Mipmapped::kNo;
- auto[view, ct] = grImage->asView(keyContext.recorder(), mipmapped);
+ if (imageToDraw) {
+ imgData.fSampling = newSampling;
+ skgpu::graphite::Mipmapped mipmapped = (newSampling.mipmap != SkMipmapMode::kNone)
+ ? skgpu::graphite::Mipmapped::kYes
+ : skgpu::graphite::Mipmapped::kNo;
+
+ auto [view, _] = as_IB(imageToDraw)->asView(keyContext.recorder(), mipmapped);
imgData.fTextureProxy = view.refProxy();
}
#endif
diff --git a/chromium/third_party/skia/src/shaders/SkLocalMatrixShader.cpp b/chromium/third_party/skia/src/shaders/SkLocalMatrixShader.cpp
index f346a2ba5ae..018ba796fbb 100644
--- a/chromium/third_party/skia/src/shaders/SkLocalMatrixShader.cpp
+++ b/chromium/third_party/skia/src/shaders/SkLocalMatrixShader.cpp
@@ -156,10 +156,6 @@ public:
protected:
void flatten(SkWriteBuffer&) const override { SkASSERT(false); }
-#ifdef SK_ENABLE_LEGACY_SHADERCONTEXT
- Context* onMakeContext(const ContextRec&, SkArenaAlloc*) const override { return nullptr; }
-#endif
-
bool onAppendStages(const SkStageRec& rec) const override {
SkOverrideDeviceMatrixProvider matrixProvider(fCTM);
SkStageRec newRec = {
@@ -170,6 +166,7 @@ protected:
rec.fPaint,
rec.fLocalM,
matrixProvider,
+ rec.fSurfaceProps
};
return as_SB(fProxyShader)->appendStages(newRec);
}
diff --git a/chromium/third_party/skia/src/shaders/SkPerlinNoiseShader.cpp b/chromium/third_party/skia/src/shaders/SkPerlinNoiseShader.cpp
index 2a629fd04b9..4447ba60a0f 100644
--- a/chromium/third_party/skia/src/shaders/SkPerlinNoiseShader.cpp
+++ b/chromium/third_party/skia/src/shaders/SkPerlinNoiseShader.cpp
@@ -803,11 +803,11 @@ void GrPerlinNoise2Effect::Impl::emitCode(EmitArgs& args) {
SkString noiseFuncName = fragBuilder->getMangledFunctionName("noiseFuncName");
if (pne.stitchTiles()) {
fragBuilder->emitFunction(SkSLType::kHalf, noiseFuncName.c_str(),
- {gPerlinNoiseStitchArgs, SK_ARRAY_COUNT(gPerlinNoiseStitchArgs)},
+ {gPerlinNoiseStitchArgs, std::size(gPerlinNoiseStitchArgs)},
noiseCode.c_str());
} else {
fragBuilder->emitFunction(SkSLType::kHalf, noiseFuncName.c_str(),
- {gPerlinNoiseArgs, SK_ARRAY_COUNT(gPerlinNoiseArgs)},
+ {gPerlinNoiseArgs, std::size(gPerlinNoiseArgs)},
noiseCode.c_str());
}
@@ -955,8 +955,12 @@ std::unique_ptr<GrFragmentProcessor> SkPerlinNoiseShaderImpl::asFragmentProcesso
const SkBitmap& permutationsBitmap = paintingData->getPermutationsBitmap();
const SkBitmap& noiseBitmap = paintingData->getNoiseBitmap();
- auto permutationsView = std::get<0>(GrMakeCachedBitmapProxyView(context, permutationsBitmap));
- auto noiseView = std::get<0>(GrMakeCachedBitmapProxyView(context, noiseBitmap));
+ auto permutationsView = std::get<0>(GrMakeCachedBitmapProxyView(
+ context,
+ permutationsBitmap,
+ /*label=*/"PerlinNoiseShader_FragmentProcessor_PermutationsView"));
+ auto noiseView = std::get<0>(GrMakeCachedBitmapProxyView(
+ context, noiseBitmap, /*label=*/"PerlinNoiseShader_FragmentProcessor_NoiseView"));
if (permutationsView && noiseView) {
return GrPerlinNoise2Effect::Make(fType,
diff --git a/chromium/third_party/skia/src/shaders/SkPictureShader.cpp b/chromium/third_party/skia/src/shaders/SkPictureShader.cpp
index 418d236188b..0a46c938c5d 100644
--- a/chromium/third_party/skia/src/shaders/SkPictureShader.cpp
+++ b/chromium/third_party/skia/src/shaders/SkPictureShader.cpp
@@ -51,18 +51,20 @@ struct ImageFromPictureKey : public SkResourceCache::Key {
public:
ImageFromPictureKey(SkColorSpace* colorSpace, SkColorType colorType,
uint32_t pictureID, const SkRect& subset,
- SkSize scale)
+ SkSize scale, const SkSurfaceProps& surfaceProps)
: fColorSpaceXYZHash(colorSpace->toXYZD50Hash())
, fColorSpaceTransferFnHash(colorSpace->transferFnHash())
, fColorType(static_cast<uint32_t>(colorType))
, fSubset(subset)
, fScale(scale)
+ , fSurfaceProps(surfaceProps)
{
static const size_t keySize = sizeof(fColorSpaceXYZHash) +
sizeof(fColorSpaceTransferFnHash) +
sizeof(fColorType) +
sizeof(fSubset) +
- sizeof(fScale);
+ sizeof(fScale) +
+ sizeof(fSurfaceProps);
// This better be packed.
SkASSERT(sizeof(uint32_t) * (&fEndOfStruct - &fColorSpaceXYZHash) == keySize);
this->init(&gImageFromPictureKeyNamespaceLabel,
@@ -71,11 +73,12 @@ public:
}
private:
- uint32_t fColorSpaceXYZHash;
- uint32_t fColorSpaceTransferFnHash;
- uint32_t fColorType;
- SkRect fSubset;
- SkSize fScale;
+ uint32_t fColorSpaceXYZHash;
+ uint32_t fColorSpaceTransferFnHash;
+ uint32_t fColorType;
+ SkRect fSubset;
+ SkSize fScale;
+ SkSurfaceProps fSurfaceProps;
SkDEBUGCODE(uint32_t fEndOfStruct;)
};
@@ -168,19 +171,23 @@ static sk_sp<SkColorSpace> ref_or_srgb(SkColorSpace* cs) {
}
struct CachedImageInfo {
- bool success;
- SkSize tileScale;
- SkMatrix matrixForDraw;
- SkImageInfo imageInfo;
+ bool success;
+ SkSize tileScale;
+ SkMatrix matrixForDraw;
+ SkImageInfo imageInfo;
+ SkSurfaceProps props;
static CachedImageInfo Make(const SkRect& bounds,
const SkMatrix& viewMatrix,
SkTCopyOnFirstWrite<SkMatrix>* localMatrix, // in/out
SkColorType dstColorType,
SkColorSpace* dstColorSpace,
- const int maxTextureSize) {
+ const int maxTextureSize,
+ const SkSurfaceProps& propsIn) {
const SkMatrix m = SkMatrix::Concat(viewMatrix, **localMatrix);
+ SkSurfaceProps props = propsIn.cloneWithPixelGeometry(kUnknown_SkPixelGeometry);
+
const SkSize scaledSize = [&]() {
SkSize size;
// Use a rotation-invariant scale
@@ -219,7 +226,7 @@ struct CachedImageInfo {
const SkISize tileSize = scaledSize.toCeil();
if (tileSize.isEmpty()) {
- return {false, {}, {}, {}};
+ return {false, {}, {}, {}, {}};
}
const SkSize tileScale = {
@@ -240,6 +247,7 @@ struct CachedImageInfo {
SkMatrix::RectToRect(bounds, SkRect::MakeIWH(tileSize.width(), tileSize.height())),
SkImageInfo::Make(tileSize.width(), tileSize.height(),
imgCT, kPremul_SkAlphaType, imgCS),
+ props
};
}
@@ -259,21 +267,22 @@ struct CachedImageInfo {
sk_sp<SkShader> SkPictureShader::rasterShader(const SkMatrix& viewMatrix,
SkTCopyOnFirstWrite<SkMatrix>* localMatrix,
SkColorType dstColorType,
- SkColorSpace* dstColorSpace) const {
+ SkColorSpace* dstColorSpace,
+ const SkSurfaceProps& propsIn) const {
const int maxTextureSize_NotUsedForCPU = 0;
CachedImageInfo info = CachedImageInfo::Make(fTile, viewMatrix, localMatrix,
dstColorType, dstColorSpace,
- maxTextureSize_NotUsedForCPU);
+ maxTextureSize_NotUsedForCPU, propsIn);
if (!info.success) {
return nullptr;
}
ImageFromPictureKey key(info.imageInfo.colorSpace(), info.imageInfo.colorType(),
- fPicture->uniqueID(), fTile, info.tileScale);
+ fPicture->uniqueID(), fTile, info.tileScale, info.props);
sk_sp<SkImage> image;
if (!SkResourceCache::Find(key, ImageFromPictureRec::Visitor, &image)) {
- image = info.makeImage(SkSurface::MakeRaster(info.imageInfo), fPicture.get());
+ image = info.makeImage(SkSurface::MakeRaster(info.imageInfo, &info.props), fPicture.get());
if (!image) {
return nullptr;
}
@@ -289,7 +298,7 @@ bool SkPictureShader::onAppendStages(const SkStageRec& rec) const {
// Keep bitmapShader alive by using alloc instead of stack memory
auto& bitmapShader = *rec.fAlloc->make<sk_sp<SkShader>>();
bitmapShader = this->rasterShader(rec.fMatrixProvider.localToDevice(), &lm,
- rec.fDstColorType, rec.fDstCS);
+ rec.fDstColorType, rec.fDstCS, rec.fSurfaceProps);
if (!bitmapShader) {
return false;
}
@@ -307,17 +316,20 @@ skvm::Color SkPictureShader::onProgram(skvm::Builder* p,
skvm::Uniforms* uniforms, SkArenaAlloc* alloc) const {
auto lm = this->totalLocalMatrix(localM);
+ // TODO: We'll need additional plumbing to get the correct props from our callers.
+ SkSurfaceProps props{};
+
// Keep bitmapShader alive by using alloc instead of stack memory
auto& bitmapShader = *alloc->make<sk_sp<SkShader>>();
bitmapShader = this->rasterShader(matrices.localToDevice(), &lm,
- dst.colorType(), dst.colorSpace());
+ dst.colorType(), dst.colorSpace(), props);
if (!bitmapShader) {
return {};
}
- return as_SB(bitmapShader)->program(p, device,local, paint,
- matrices,lm, dst,
- uniforms,alloc);
+ return as_SB(bitmapShader)->program(p, device, local, paint,
+ matrices, lm, dst,
+ uniforms, alloc);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -327,7 +339,7 @@ SkShaderBase::Context* SkPictureShader::onMakeContext(const ContextRec& rec, SkA
const {
auto lm = this->totalLocalMatrix(rec.fLocalMatrix);
sk_sp<SkShader> bitmapShader = this->rasterShader(*rec.fMatrix, &lm, rec.fDstColorType,
- rec.fDstColorSpace);
+ rec.fDstColorSpace, rec.fProps);
if (!bitmapShader) {
return nullptr;
}
@@ -335,37 +347,12 @@ const {
ContextRec localRec = rec;
localRec.fLocalMatrix = lm->isIdentity() ? nullptr : lm.get();
- PictureShaderContext* ctx =
- alloc->make<PictureShaderContext>(*this, localRec, std::move(bitmapShader), alloc);
- if (nullptr == ctx->fBitmapShaderContext) {
- ctx = nullptr;
- }
- return ctx;
+ return as_SB(bitmapShader)->makeContext(localRec, alloc);
}
#endif
/////////////////////////////////////////////////////////////////////////////////////////
-SkPictureShader::PictureShaderContext::PictureShaderContext(
- const SkPictureShader& shader, const ContextRec& rec, sk_sp<SkShader> bitmapShader,
- SkArenaAlloc* alloc)
- : INHERITED(shader, rec)
- , fBitmapShader(std::move(bitmapShader))
-{
- fBitmapShaderContext = as_SB(fBitmapShader)->makeContext(rec, alloc);
- //if fBitmapShaderContext is null, we are invalid
-}
-
-uint32_t SkPictureShader::PictureShaderContext::getFlags() const {
- SkASSERT(fBitmapShaderContext);
- return fBitmapShaderContext->getFlags();
-}
-
-void SkPictureShader::PictureShaderContext::shadeSpan(int x, int y, SkPMColor dstC[], int count) {
- SkASSERT(fBitmapShaderContext);
- fBitmapShaderContext->shadeSpan(x, y, dstC, count);
-}
-
#if SK_SUPPORT_GPU
#include "src/gpu/ganesh/GrProxyProvider.h"
@@ -381,9 +368,9 @@ std::unique_ptr<GrFragmentProcessor> SkPictureShader::asFragmentProcessor(
}
auto dstCS = ref_or_srgb(args.fDstColorInfo->colorSpace());
- auto info = CachedImageInfo::Make(fTile, args.fMatrixProvider.localToDevice(), &lm,
- dstColorType, dstCS.get(),
- ctx->priv().caps()->maxTextureSize());
+ auto viewMatrix = args.fMatrixProvider.localToDevice();
+ auto info = CachedImageInfo::Make(fTile, viewMatrix, &lm, dstColorType, dstCS.get(),
+ ctx->priv().caps()->maxTextureSize(), args.fSurfaceProps);
SkMatrix inv;
if (!info.success || !(*lm).invert(&inv)) {
return nullptr;
@@ -396,13 +383,18 @@ std::unique_ptr<GrFragmentProcessor> SkPictureShader::asFragmentProcessor(
static const skgpu::UniqueKey::Domain kDomain = skgpu::UniqueKey::GenerateDomain();
skgpu::UniqueKey key;
- skgpu::UniqueKey::Builder builder(&key, kDomain, 10, "Picture Shader Image");
- builder[0] = dstCS->toXYZD50Hash();
- builder[1] = dstCS->transferFnHash();
- builder[2] = static_cast<uint32_t>(dstColorType);
- builder[3] = fPicture->uniqueID();
- memcpy(&builder[4], &fTile, sizeof(fTile)); // 4,5,6,7
- memcpy(&builder[8], &info.tileScale, sizeof(info.tileScale)); // 8,9
+ std::tuple keyData = {
+ dstCS->toXYZD50Hash(),
+ dstCS->transferFnHash(),
+ static_cast<uint32_t>(dstColorType),
+ fPicture->uniqueID(),
+ fTile,
+ info.tileScale,
+ info.props
+ };
+ skgpu::UniqueKey::Builder builder(&key, kDomain, sizeof(keyData)/sizeof(uint32_t),
+ "Picture Shader Image");
+ memcpy(&builder[0], &keyData, sizeof(keyData));
builder.finish();
GrProxyProvider* provider = ctx->priv().proxyProvider();
@@ -411,14 +403,13 @@ std::unique_ptr<GrFragmentProcessor> SkPictureShader::asFragmentProcessor(
view = GrSurfaceProxyView(proxy, kTopLeft_GrSurfaceOrigin, skgpu::Swizzle());
} else {
const int msaaSampleCount = 0;
- const SkSurfaceProps* props = nullptr;
const bool createWithMips = false;
auto image = info.makeImage(SkSurface::MakeRenderTarget(ctx,
SkBudgeted::kYes,
info.imageInfo,
msaaSampleCount,
kTopLeft_GrSurfaceOrigin,
- props,
+ &info.props,
createWithMips),
fPicture.get());
if (!image) {
diff --git a/chromium/third_party/skia/src/shaders/SkPictureShader.h b/chromium/third_party/skia/src/shaders/SkPictureShader.h
index e26649968af..31412f90a13 100644
--- a/chromium/third_party/skia/src/shaders/SkPictureShader.h
+++ b/chromium/third_party/skia/src/shaders/SkPictureShader.h
@@ -50,23 +50,8 @@ private:
const SkMatrix*, const SkRect*);
sk_sp<SkShader> rasterShader(const SkMatrix&, SkTCopyOnFirstWrite<SkMatrix>* localMatrix,
- SkColorType dstColorType, SkColorSpace* dstColorSpace) const;
-
- class PictureShaderContext : public Context {
- public:
- PictureShaderContext(
- const SkPictureShader&, const ContextRec&, sk_sp<SkShader> bitmapShader, SkArenaAlloc*);
-
- uint32_t getFlags() const override;
-
- void shadeSpan(int x, int y, SkPMColor dstC[], int count) override;
-
- sk_sp<SkShader> fBitmapShader;
- SkShaderBase::Context* fBitmapShaderContext;
- void* fBitmapShaderContextStorage;
-
- using INHERITED = Context;
- };
+ SkColorType dstColorType, SkColorSpace* dstColorSpace,
+ const SkSurfaceProps& props) const;
sk_sp<SkPicture> fPicture;
SkRect fTile;
diff --git a/chromium/third_party/skia/src/shaders/SkShader.cpp b/chromium/third_party/skia/src/shaders/SkShader.cpp
index 2af3777c0e0..fbf1f39494c 100644
--- a/chromium/third_party/skia/src/shaders/SkShader.cpp
+++ b/chromium/third_party/skia/src/shaders/SkShader.cpp
@@ -7,7 +7,6 @@
#include "include/core/SkMallocPixelRef.h"
#include "include/core/SkPaint.h"
-#include "include/core/SkPicture.h"
#include "include/core/SkScalar.h"
#include "src/core/SkArenaAlloc.h"
#include "src/core/SkColorSpacePriv.h"
@@ -16,13 +15,9 @@
#include "src/core/SkRasterPipeline.h"
#include "src/core/SkReadBuffer.h"
#include "src/core/SkTLazy.h"
-#include "src/core/SkVM.h"
#include "src/core/SkWriteBuffer.h"
#include "src/shaders/SkBitmapProcShader.h"
-#include "src/shaders/SkColorShader.h"
-#include "src/shaders/SkEmptyShader.h"
#include "src/shaders/SkImageShader.h"
-#include "src/shaders/SkPictureShader.h"
#include "src/shaders/SkShaderBase.h"
#include "src/shaders/SkTransformShader.h"
@@ -163,9 +158,6 @@ void SkShaderBase::addToKey(const SkKeyContext& keyContext,
}
#endif
-sk_sp<SkShader> SkShaders::Empty() { return sk_make_sp<SkEmptyShader>(); }
-sk_sp<SkShader> SkShaders::Color(SkColor color) { return sk_make_sp<SkColorShader>(color); }
-
sk_sp<SkShader> SkBitmap::makeShader(SkTileMode tmx, SkTileMode tmy,
const SkSamplingOptions& sampling,
const SkMatrix* lm) const {
@@ -190,7 +182,7 @@ bool SkShaderBase::onAppendStages(const SkStageRec& rec) const {
}
ContextRec cr(*opaquePaint, rec.fMatrixProvider.localToDevice(), rec.fLocalM, rec.fDstColorType,
- sk_srgb_singleton());
+ sk_srgb_singleton(), rec.fSurfaceProps);
struct CallbackCtx : SkRasterPipeline_CallbackCtx {
sk_sp<const SkShader> shader;
@@ -289,15 +281,3 @@ skvm::Coord SkShaderBase::ApplyMatrix(skvm::Builder* p, const SkMatrix& m,
}
return {x,y};
}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-skvm::Color SkEmptyShader::onProgram(skvm::Builder*, skvm::Coord, skvm::Coord, skvm::Color,
- const SkMatrixProvider&, const SkMatrix*, const SkColorInfo&,
- skvm::Uniforms*, SkArenaAlloc*) const {
- return {}; // signal failure
-}
-
-sk_sp<SkFlattenable> SkEmptyShader::CreateProc(SkReadBuffer&) {
- return SkShaders::Empty();
-}
diff --git a/chromium/third_party/skia/src/shaders/SkShaderBase.h b/chromium/third_party/skia/src/shaders/SkShaderBase.h
index f35afd2ab5a..cc3183d59ab 100644
--- a/chromium/third_party/skia/src/shaders/SkShaderBase.h
+++ b/chromium/third_party/skia/src/shaders/SkShaderBase.h
@@ -12,6 +12,7 @@
#include "include/core/SkPaint.h"
#include "include/core/SkSamplingOptions.h"
#include "include/core/SkShader.h"
+#include "include/core/SkSurfaceProps.h"
#include "include/private/SkNoncopyable.h"
#include "src/core/SkEffectPriv.h"
#include "src/core/SkMask.h"
@@ -74,11 +75,12 @@ public:
*/
struct ContextRec {
ContextRec(const SkPaint& paint, const SkMatrix& matrix, const SkMatrix* localM,
- SkColorType dstColorType, SkColorSpace* dstColorSpace)
+ SkColorType dstColorType, SkColorSpace* dstColorSpace, SkSurfaceProps props)
: fMatrix(&matrix)
, fLocalMatrix(localM)
, fDstColorType(dstColorType)
- , fDstColorSpace(dstColorSpace) {
+ , fDstColorSpace(dstColorSpace)
+ , fProps(props) {
fPaintAlpha = paint.getAlpha();
fPaintDither = paint.isDither();
}
@@ -87,6 +89,7 @@ public:
const SkMatrix* fLocalMatrix; // optional local matrix
SkColorType fDstColorType; // the color type of the dest surface
SkColorSpace* fDstColorSpace; // the color space of the dest surface (if any)
+ SkSurfaceProps fProps; // props of the dest surface
SkAlpha fPaintAlpha;
bool fPaintDither;
@@ -304,4 +307,9 @@ inline const SkShaderBase* as_SB(const sk_sp<SkShader>& shader) {
return static_cast<SkShaderBase*>(shader.get());
}
+void SkRegisterColor4ShaderFlattenable();
+void SkRegisterColorShaderFlattenable();
+void SkRegisterComposeShaderFlattenable();
+void SkRegisterEmptyShaderFlattenable();
+
#endif // SkShaderBase_DEFINED
diff --git a/chromium/third_party/skia/src/shaders/gradients/BUILD.bazel b/chromium/third_party/skia/src/shaders/gradients/BUILD.bazel
index 58cfb77dc8d..6367552d515 100644
--- a/chromium/third_party/skia/src/shaders/gradients/BUILD.bazel
+++ b/chromium/third_party/skia/src/shaders/gradients/BUILD.bazel
@@ -11,15 +11,13 @@ GRADIENT_FILES = [
"Sk4fLinearGradient.cpp",
"Sk4fLinearGradient.h",
"SkGradientShader.cpp",
- "SkGradientShaderPriv.h",
+ "SkGradientShaderBase.cpp",
+ "SkGradientShaderBase.h",
"SkLinearGradient.cpp",
"SkLinearGradient.h",
"SkRadialGradient.cpp",
- "SkRadialGradient.h",
"SkSweepGradient.cpp",
- "SkSweepGradient.h",
"SkTwoPointConicalGradient.cpp",
- "SkTwoPointConicalGradient.h",
]
split_srcs_and_hdrs(
diff --git a/chromium/third_party/skia/src/shaders/gradients/Sk4fGradientBase.h b/chromium/third_party/skia/src/shaders/gradients/Sk4fGradientBase.h
index 38578558f42..ea2a77deb1f 100644
--- a/chromium/third_party/skia/src/shaders/gradients/Sk4fGradientBase.h
+++ b/chromium/third_party/skia/src/shaders/gradients/Sk4fGradientBase.h
@@ -14,7 +14,7 @@
#include "src/core/SkMatrixPriv.h"
#include "src/shaders/SkShaderBase.h"
#include "src/shaders/gradients/Sk4fGradientPriv.h"
-#include "src/shaders/gradients/SkGradientShaderPriv.h"
+#include "src/shaders/gradients/SkGradientShaderBase.h"
struct Sk4fGradientInterval {
Sk4fGradientInterval(const skvx::float4& c0, SkScalar t0,
diff --git a/chromium/third_party/skia/src/shaders/gradients/SkGradientShader.cpp b/chromium/third_party/skia/src/shaders/gradients/SkGradientShader.cpp
index 78d403f4fa0..ac4949f9289 100644
--- a/chromium/third_party/skia/src/shaders/gradients/SkGradientShader.cpp
+++ b/chromium/third_party/skia/src/shaders/gradients/SkGradientShader.cpp
@@ -5,834 +5,16 @@
* found in the LICENSE file.
*/
+#include "include/effects/SkGradientShader.h"
+
#include "include/core/SkColorSpace.h"
-#include "include/core/SkMallocPixelRef.h"
-#include "include/private/SkFloatBits.h"
-#include "include/private/SkHalf.h"
-#include "include/private/SkTPin.h"
-#include "include/private/SkVx.h"
-#include "src/core/SkColorSpacePriv.h"
-#include "src/core/SkConvertPixels.h"
-#include "src/core/SkMatrixProvider.h"
-#include "src/core/SkReadBuffer.h"
-#include "src/core/SkVM.h"
-#include "src/core/SkWriteBuffer.h"
-#include "src/shaders/gradients/Sk4fLinearGradient.h"
-#include "src/shaders/gradients/SkGradientShaderPriv.h"
+#include "include/private/SkTArray.h"
+#include "src/shaders/gradients/SkGradientShaderBase.h"
#include "src/shaders/gradients/SkLinearGradient.h"
-#include "src/shaders/gradients/SkRadialGradient.h"
-#include "src/shaders/gradients/SkSweepGradient.h"
-#include "src/shaders/gradients/SkTwoPointConicalGradient.h"
-
-#include <algorithm>
-
-enum GradientSerializationFlags {
- // Bits 29:31 used for various boolean flags
- kHasPosition_GSF = 0x80000000,
- kHasLocalMatrix_GSF = 0x40000000,
- kHasColorSpace_GSF = 0x20000000,
-
- // Bits 12:28 unused
-
- // Bits 8:11 for fTileMode
- kTileModeShift_GSF = 8,
- kTileModeMask_GSF = 0xF,
-
- // Bits 0:7 for fGradFlags (note that kForce4fContext_PrivateFlag is 0x80)
- kGradFlagsShift_GSF = 0,
- kGradFlagsMask_GSF = 0xFF,
-};
-
-SkGradientShaderBase::Descriptor::Descriptor() {
- sk_bzero(this, sizeof(*this));
- fTileMode = SkTileMode::kClamp;
-}
-SkGradientShaderBase::Descriptor::~Descriptor() = default;
-
-void SkGradientShaderBase::Descriptor::flatten(SkWriteBuffer& buffer) const {
- uint32_t flags = 0;
- if (fPos) {
- flags |= kHasPosition_GSF;
- }
- if (fLocalMatrix) {
- flags |= kHasLocalMatrix_GSF;
- }
- sk_sp<SkData> colorSpaceData = fColorSpace ? fColorSpace->serialize() : nullptr;
- if (colorSpaceData) {
- flags |= kHasColorSpace_GSF;
- }
- SkASSERT(static_cast<uint32_t>(fTileMode) <= kTileModeMask_GSF);
- flags |= ((unsigned)fTileMode << kTileModeShift_GSF);
- SkASSERT(fGradFlags <= kGradFlagsMask_GSF);
- flags |= (fGradFlags << kGradFlagsShift_GSF);
-
- buffer.writeUInt(flags);
-
- buffer.writeColor4fArray(fColors, fCount);
- if (colorSpaceData) {
- buffer.writeDataAsByteArray(colorSpaceData.get());
- }
- if (fPos) {
- buffer.writeScalarArray(fPos, fCount);
- }
- if (fLocalMatrix) {
- buffer.writeMatrix(*fLocalMatrix);
- }
-}
-
-template <int N, typename T, bool MEM_MOVE>
-static bool validate_array(SkReadBuffer& buffer, size_t count, SkSTArray<N, T, MEM_MOVE>* array) {
- if (!buffer.validateCanReadN<T>(count)) {
- return false;
- }
-
- array->resize_back(count);
- return true;
-}
-
-bool SkGradientShaderBase::DescriptorScope::unflatten(SkReadBuffer& buffer) {
- // New gradient format. Includes floating point color, color space, densely packed flags
- uint32_t flags = buffer.readUInt();
-
- fTileMode = (SkTileMode)((flags >> kTileModeShift_GSF) & kTileModeMask_GSF);
- fGradFlags = (flags >> kGradFlagsShift_GSF) & kGradFlagsMask_GSF;
-
- fCount = buffer.getArrayCount();
-
- if (!(validate_array(buffer, fCount, &fColorStorage) &&
- buffer.readColor4fArray(fColorStorage.begin(), fCount))) {
- return false;
- }
- fColors = fColorStorage.begin();
-
- if (SkToBool(flags & kHasColorSpace_GSF)) {
- sk_sp<SkData> data = buffer.readByteArrayAsData();
- fColorSpace = data ? SkColorSpace::Deserialize(data->data(), data->size()) : nullptr;
- } else {
- fColorSpace = nullptr;
- }
- if (SkToBool(flags & kHasPosition_GSF)) {
- if (!(validate_array(buffer, fCount, &fPosStorage) &&
- buffer.readScalarArray(fPosStorage.begin(), fCount))) {
- return false;
- }
- fPos = fPosStorage.begin();
- } else {
- fPos = nullptr;
- }
- if (SkToBool(flags & kHasLocalMatrix_GSF)) {
- fLocalMatrix = &fLocalMatrixStorage;
- buffer.readMatrix(&fLocalMatrixStorage);
- } else {
- fLocalMatrix = nullptr;
- }
- return buffer.isValid();
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-
-SkGradientShaderBase::SkGradientShaderBase(const Descriptor& desc, const SkMatrix& ptsToUnit)
- : INHERITED(desc.fLocalMatrix)
- , fPtsToUnit(ptsToUnit)
- , fColorSpace(desc.fColorSpace ? desc.fColorSpace : SkColorSpace::MakeSRGB())
- , fColorsAreOpaque(true)
-{
- fPtsToUnit.getType(); // Precache so reads are threadsafe.
- SkASSERT(desc.fCount > 1);
-
- fGradFlags = static_cast<uint8_t>(desc.fGradFlags);
-
- SkASSERT((unsigned)desc.fTileMode < kSkTileModeCount);
- fTileMode = desc.fTileMode;
-
- /* Note: we let the caller skip the first and/or last position.
- i.e. pos[0] = 0.3, pos[1] = 0.7
- In these cases, we insert entries to ensure that the final data
- will be bracketed by [0, 1].
- i.e. our_pos[0] = 0, our_pos[1] = 0.3, our_pos[2] = 0.7, our_pos[3] = 1
-
- Thus colorCount (the caller's value, and fColorCount (our value) may
- differ by up to 2. In the above example:
- colorCount = 2
- fColorCount = 4
- */
- fColorCount = desc.fCount;
- // check if we need to add in start and/or end position/colors
- bool needsFirst = false;
- bool needsLast = false;
- if (desc.fPos) {
- needsFirst = desc.fPos[0] != 0;
- needsLast = desc.fPos[desc.fCount - 1] != SK_Scalar1;
- fColorCount += needsFirst + needsLast;
- }
-
- size_t storageSize = fColorCount * (sizeof(SkColor4f) + (desc.fPos ? sizeof(SkScalar) : 0));
- fOrigColors4f = reinterpret_cast<SkColor4f*>(fStorage.reset(storageSize));
- fOrigPos = desc.fPos ? reinterpret_cast<SkScalar*>(fOrigColors4f + fColorCount)
- : nullptr;
-
- // Now copy over the colors, adding the dummies as needed
- SkColor4f* origColors = fOrigColors4f;
- if (needsFirst) {
- *origColors++ = desc.fColors[0];
- }
- for (int i = 0; i < desc.fCount; ++i) {
- origColors[i] = desc.fColors[i];
- fColorsAreOpaque = fColorsAreOpaque && (desc.fColors[i].fA == 1);
- }
- if (needsLast) {
- origColors += desc.fCount;
- *origColors = desc.fColors[desc.fCount - 1];
- }
-
- if (desc.fPos) {
- SkScalar prev = 0;
- SkScalar* origPosPtr = fOrigPos;
- *origPosPtr++ = prev; // force the first pos to 0
-
- int startIndex = needsFirst ? 0 : 1;
- int count = desc.fCount + needsLast;
-
- bool uniformStops = true;
- const SkScalar uniformStep = desc.fPos[startIndex] - prev;
- for (int i = startIndex; i < count; i++) {
- // Pin the last value to 1.0, and make sure pos is monotonic.
- auto curr = (i == desc.fCount) ? 1 : SkTPin(desc.fPos[i], prev, 1.0f);
- uniformStops &= SkScalarNearlyEqual(uniformStep, curr - prev);
-
- *origPosPtr++ = prev = curr;
- }
-
- // If the stops are uniform, treat them as implicit.
- if (uniformStops) {
- fOrigPos = nullptr;
- }
- }
-}
-
-SkGradientShaderBase::~SkGradientShaderBase() {}
-
-void SkGradientShaderBase::flatten(SkWriteBuffer& buffer) const {
- Descriptor desc;
- desc.fColors = fOrigColors4f;
- desc.fColorSpace = fColorSpace;
- desc.fPos = fOrigPos;
- desc.fCount = fColorCount;
- desc.fTileMode = fTileMode;
- desc.fGradFlags = fGradFlags;
-
- const SkMatrix& m = this->getLocalMatrix();
- desc.fLocalMatrix = m.isIdentity() ? nullptr : &m;
- desc.flatten(buffer);
-}
-
-static void add_stop_color(SkRasterPipeline_GradientCtx* ctx, size_t stop, SkPMColor4f Fs, SkPMColor4f Bs) {
- (ctx->fs[0])[stop] = Fs.fR;
- (ctx->fs[1])[stop] = Fs.fG;
- (ctx->fs[2])[stop] = Fs.fB;
- (ctx->fs[3])[stop] = Fs.fA;
-
- (ctx->bs[0])[stop] = Bs.fR;
- (ctx->bs[1])[stop] = Bs.fG;
- (ctx->bs[2])[stop] = Bs.fB;
- (ctx->bs[3])[stop] = Bs.fA;
-}
-
-static void add_const_color(SkRasterPipeline_GradientCtx* ctx, size_t stop, SkPMColor4f color) {
- add_stop_color(ctx, stop, { 0, 0, 0, 0 }, color);
-}
-
-// Calculate a factor F and a bias B so that color = F*t + B when t is in range of
-// the stop. Assume that the distance between stops is 1/gapCount.
-static void init_stop_evenly(
- SkRasterPipeline_GradientCtx* ctx, float gapCount, size_t stop, SkPMColor4f c_l, SkPMColor4f c_r) {
- // Clankium's GCC 4.9 targeting ARMv7 is barfing when we use Sk4f math here, so go scalar...
- SkPMColor4f Fs = {
- (c_r.fR - c_l.fR) * gapCount,
- (c_r.fG - c_l.fG) * gapCount,
- (c_r.fB - c_l.fB) * gapCount,
- (c_r.fA - c_l.fA) * gapCount,
- };
- SkPMColor4f Bs = {
- c_l.fR - Fs.fR*(stop/gapCount),
- c_l.fG - Fs.fG*(stop/gapCount),
- c_l.fB - Fs.fB*(stop/gapCount),
- c_l.fA - Fs.fA*(stop/gapCount),
- };
- add_stop_color(ctx, stop, Fs, Bs);
-}
-
-// For each stop we calculate a bias B and a scale factor F, such that
-// for any t between stops n and n+1, the color we want is B[n] + F[n]*t.
-static void init_stop_pos(
- SkRasterPipeline_GradientCtx* ctx, size_t stop, float t_l, float t_r, SkPMColor4f c_l, SkPMColor4f c_r) {
- // See note about Clankium's old compiler in init_stop_evenly().
- SkPMColor4f Fs = {
- (c_r.fR - c_l.fR) / (t_r - t_l),
- (c_r.fG - c_l.fG) / (t_r - t_l),
- (c_r.fB - c_l.fB) / (t_r - t_l),
- (c_r.fA - c_l.fA) / (t_r - t_l),
- };
- SkPMColor4f Bs = {
- c_l.fR - Fs.fR*t_l,
- c_l.fG - Fs.fG*t_l,
- c_l.fB - Fs.fB*t_l,
- c_l.fA - Fs.fA*t_l,
- };
- ctx->ts[stop] = t_l;
- add_stop_color(ctx, stop, Fs, Bs);
-}
-
-bool SkGradientShaderBase::onAppendStages(const SkStageRec& rec) const {
- SkRasterPipeline* p = rec.fPipeline;
- SkArenaAlloc* alloc = rec.fAlloc;
- SkRasterPipeline_DecalTileCtx* decal_ctx = nullptr;
-
- SkMatrix matrix;
- if (!this->computeTotalInverse(rec.fMatrixProvider.localToDevice(), rec.fLocalM, &matrix)) {
- return false;
- }
- matrix.postConcat(fPtsToUnit);
-
- SkRasterPipeline_<256> postPipeline;
-
- p->append(SkRasterPipeline::seed_shader);
- p->append_matrix(alloc, matrix);
- this->appendGradientStages(alloc, p, &postPipeline);
-
- switch(fTileMode) {
- case SkTileMode::kMirror: p->append(SkRasterPipeline::mirror_x_1); break;
- case SkTileMode::kRepeat: p->append(SkRasterPipeline::repeat_x_1); break;
- case SkTileMode::kDecal:
- decal_ctx = alloc->make<SkRasterPipeline_DecalTileCtx>();
- decal_ctx->limit_x = SkBits2Float(SkFloat2Bits(1.0f) + 1);
- // reuse mask + limit_x stage, or create a custom decal_1 that just stores the mask
- p->append(SkRasterPipeline::decal_x, decal_ctx);
- [[fallthrough]];
-
- case SkTileMode::kClamp:
- if (!fOrigPos) {
- // We clamp only when the stops are evenly spaced.
- // If not, there may be hard stops, and clamping ruins hard stops at 0 and/or 1.
- // In that case, we must make sure we're using the general "gradient" stage,
- // which is the only stage that will correctly handle unclamped t.
- p->append(SkRasterPipeline::clamp_x_1);
- }
- break;
- }
-
- const bool premulGrad = fGradFlags & SkGradientShader::kInterpolateColorsInPremul_Flag;
-
- // Transform all of the colors to destination color space
- SkColor4fXformer xformedColors(fOrigColors4f, fColorCount, fColorSpace.get(), rec.fDstCS);
-
- auto prepareColor = [premulGrad, &xformedColors](int i) {
- SkColor4f c = xformedColors.fColors[i];
- return premulGrad ? c.premul()
- : SkPMColor4f{ c.fR, c.fG, c.fB, c.fA };
- };
-
- // The two-stop case with stops at 0 and 1.
- if (fColorCount == 2 && fOrigPos == nullptr) {
- const SkPMColor4f c_l = prepareColor(0),
- c_r = prepareColor(1);
-
- // See F and B below.
- auto ctx = alloc->make<SkRasterPipeline_EvenlySpaced2StopGradientCtx>();
- (skvx::float4::Load(c_r.vec()) - skvx::float4::Load(c_l.vec())).store(ctx->f);
- ( skvx::float4::Load(c_l.vec())).store(ctx->b);
- ctx->interpolatedInPremul = premulGrad;
-
- p->append(SkRasterPipeline::evenly_spaced_2_stop_gradient, ctx);
- } else {
- auto* ctx = alloc->make<SkRasterPipeline_GradientCtx>();
- ctx->interpolatedInPremul = premulGrad;
-
- // Note: In order to handle clamps in search, the search assumes a stop conceptully placed
- // at -inf. Therefore, the max number of stops is fColorCount+1.
- for (int i = 0; i < 4; i++) {
- // Allocate at least at for the AVX2 gather from a YMM register.
- ctx->fs[i] = alloc->makeArray<float>(std::max(fColorCount+1, 8));
- ctx->bs[i] = alloc->makeArray<float>(std::max(fColorCount+1, 8));
- }
-
- if (fOrigPos == nullptr) {
- // Handle evenly distributed stops.
-
- size_t stopCount = fColorCount;
- float gapCount = stopCount - 1;
-
- SkPMColor4f c_l = prepareColor(0);
- for (size_t i = 0; i < stopCount - 1; i++) {
- SkPMColor4f c_r = prepareColor(i + 1);
- init_stop_evenly(ctx, gapCount, i, c_l, c_r);
- c_l = c_r;
- }
- add_const_color(ctx, stopCount - 1, c_l);
-
- ctx->stopCount = stopCount;
- p->append(SkRasterPipeline::evenly_spaced_gradient, ctx);
- } else {
- // Handle arbitrary stops.
-
- ctx->ts = alloc->makeArray<float>(fColorCount+1);
-
- // Remove the default stops inserted by SkGradientShaderBase::SkGradientShaderBase
- // because they are naturally handled by the search method.
- int firstStop;
- int lastStop;
- if (fColorCount > 2) {
- firstStop = fOrigColors4f[0] != fOrigColors4f[1] ? 0 : 1;
- lastStop = fOrigColors4f[fColorCount - 2] != fOrigColors4f[fColorCount - 1]
- ? fColorCount - 1 : fColorCount - 2;
- } else {
- firstStop = 0;
- lastStop = 1;
- }
-
- size_t stopCount = 0;
- float t_l = fOrigPos[firstStop];
- SkPMColor4f c_l = prepareColor(firstStop);
- add_const_color(ctx, stopCount++, c_l);
- // N.B. lastStop is the index of the last stop, not one after.
- for (int i = firstStop; i < lastStop; i++) {
- float t_r = fOrigPos[i + 1];
- SkPMColor4f c_r = prepareColor(i + 1);
- SkASSERT(t_l <= t_r);
- if (t_l < t_r) {
- init_stop_pos(ctx, stopCount, t_l, t_r, c_l, c_r);
- stopCount += 1;
- }
- t_l = t_r;
- c_l = c_r;
- }
-
- ctx->ts[stopCount] = t_l;
- add_const_color(ctx, stopCount++, c_l);
-
- ctx->stopCount = stopCount;
- p->append(SkRasterPipeline::gradient, ctx);
- }
- }
-
- if (decal_ctx) {
- p->append(SkRasterPipeline::check_decal_mask, decal_ctx);
- }
-
- if (!premulGrad && !this->colorsAreOpaque()) {
- p->append(SkRasterPipeline::premul);
- }
-
- p->extend(postPipeline);
-
- return true;
-}
-
-skvm::Color SkGradientShaderBase::onProgram(skvm::Builder* p,
- skvm::Coord device, skvm::Coord local,
- skvm::Color /*paint*/,
- const SkMatrixProvider& mats, const SkMatrix* localM,
- const SkColorInfo& dstInfo,
- skvm::Uniforms* uniforms, SkArenaAlloc* alloc) const {
- SkMatrix inv;
- if (!this->computeTotalInverse(mats.localToDevice(), localM, &inv)) {
- return {};
- }
- inv.postConcat(fPtsToUnit);
- inv.normalizePerspective();
-
- local = SkShaderBase::ApplyMatrix(p, inv, local, uniforms);
-
- skvm::I32 mask = p->splat(~0);
- skvm::F32 t = this->transformT(p,uniforms, local, &mask);
-
- // Perhaps unexpectedly, clamping is handled naturally by our search, so we
- // don't explicitly clamp t to [0,1]. That clamp would break hard stops
- // right at 0 or 1 boundaries in kClamp mode. (kRepeat and kMirror always
- // produce values in [0,1].)
- switch(fTileMode) {
- case SkTileMode::kClamp:
- break;
-
- case SkTileMode::kDecal:
- mask &= (t == clamp01(t));
- break;
-
- case SkTileMode::kRepeat:
- t = fract(t);
- break;
-
- case SkTileMode::kMirror: {
- // t = | (t-1) - 2*(floor( (t-1)*0.5 )) - 1 |
- // {-A-} {--------B-------}
- skvm::F32 A = t - 1.0f,
- B = floor(A * 0.5f);
- t = abs(A - (B + B) - 1.0f);
- } break;
- }
-
- // Transform our colors as we want them interpolated, in dst color space, possibly premul.
- SkImageInfo common = SkImageInfo::Make(fColorCount,1, kRGBA_F32_SkColorType
- , kUnpremul_SkAlphaType),
- src = common.makeColorSpace(fColorSpace),
- dst = common.makeColorSpace(dstInfo.refColorSpace());
- if (fGradFlags & SkGradientShader::kInterpolateColorsInPremul_Flag) {
- dst = dst.makeAlphaType(kPremul_SkAlphaType);
- }
-
- std::vector<float> rgba(4*fColorCount); // TODO: SkSTArray?
- SkAssertResult(SkConvertPixels(dst, rgba.data(), dst.minRowBytes(),
- src, fOrigColors4f, src.minRowBytes()));
-
- // Transform our colors into a scale factor f and bias b such that for
- // any t between stops i and i+1, the color we want is mad(t, f[i], b[i]).
- using F4 = skvx::Vec<4,float>;
- struct FB { F4 f,b; };
- skvm::Color color;
-
- auto uniformF = [&](float x) { return p->uniformF(uniforms->pushF(x)); };
-
- if (fColorCount == 2) {
- // 2-stop gradients have colors at 0 and 1, and so must be evenly spaced.
- SkASSERT(fOrigPos == nullptr);
-
- // With 2 stops, we upload the single FB as uniforms and interpolate directly with t.
- F4 lo = F4::Load(rgba.data() + 0),
- hi = F4::Load(rgba.data() + 4);
- F4 F = hi - lo,
- B = lo;
-
- auto T = clamp01(t);
- color = {
- T * uniformF(F[0]) + uniformF(B[0]),
- T * uniformF(F[1]) + uniformF(B[1]),
- T * uniformF(F[2]) + uniformF(B[2]),
- T * uniformF(F[3]) + uniformF(B[3]),
- };
- } else {
- // To handle clamps in search we add a conceptual stop at t=-inf, so we
- // may need up to fColorCount+1 FBs and fColorCount t stops between them:
- //
- // FBs: [color 0] [color 0->1] [color 1->2] [color 2->3] ...
- // stops: (-inf) t0 t1 t2 ...
- //
- // Both these arrays could end up shorter if any hard stops share the same t.
- FB* fb = alloc->makeArrayDefault<FB>(fColorCount+1);
- std::vector<float> stops; // TODO: SkSTArray?
- stops.reserve(fColorCount);
-
- // Here's our conceptual stop at t=-inf covering all t<=0, clamping to our first color.
- float t_lo = this->getPos(0);
- F4 color_lo = F4::Load(rgba.data());
- fb[0] = { 0.0f, color_lo };
- // N.B. No stops[] entry for this implicit -inf.
-
- // Now the non-edge cases, calculating scale and bias between adjacent normal stops.
- for (int i = 1; i < fColorCount; i++) {
- float t_hi = this->getPos(i);
- F4 color_hi = F4::Load(rgba.data() + 4*i);
-
- // If t_lo == t_hi, we're on a hard stop, and transition immediately to the next color.
- SkASSERT(t_lo <= t_hi);
- if (t_lo < t_hi) {
- F4 f = (color_hi - color_lo) / (t_hi - t_lo),
- b = color_lo - f*t_lo;
- stops.push_back(t_lo);
- fb[stops.size()] = {f,b};
- }
-
- t_lo = t_hi;
- color_lo = color_hi;
- }
- // Anything >= our final t clamps to our final color.
- stops.push_back(t_lo);
- fb[stops.size()] = { 0.0f, color_lo };
-
- // We'll gather FBs from that array we just created.
- skvm::Uniform fbs = uniforms->pushPtr(fb);
-
- // Find the two stops we need to interpolate.
- skvm::I32 ix;
- if (fOrigPos == nullptr) {
- // Evenly spaced stops... we can calculate ix directly.
- // Of note: we need to clamp t and skip over that conceptual -inf stop we made up.
- ix = trunc(clamp01(t) * uniformF(stops.size() - 1) + 1.0f);
- } else {
- // Starting ix at 0 bakes in our conceptual first stop at -inf.
- // TODO: good place to experiment with a loop in skvm.... stops.size() can be huge.
- ix = p->splat(0);
- for (float stop : stops) {
- // ix += (t >= stop) ? +1 : 0 ~~>
- // ix -= (t >= stop) ? -1 : 0
- ix -= (t >= uniformF(stop));
- }
- // TODO: we could skip any of the default stops GradientShaderBase's ctor added
- // to ensure the full [0,1] span is covered. This linear search doesn't need
- // them for correctness, and it'd be up to two fewer stops to check.
- // N.B. we do still need those stops for the fOrigPos == nullptr direct math path.
- }
-
- // A scale factor and bias for each lane, 8 total.
- // TODO: simpler, faster, tidier to push 8 uniform pointers, one for each struct lane?
- ix = shl(ix, 3);
- skvm::F32 Fr = gatherF(fbs, ix + 0);
- skvm::F32 Fg = gatherF(fbs, ix + 1);
- skvm::F32 Fb = gatherF(fbs, ix + 2);
- skvm::F32 Fa = gatherF(fbs, ix + 3);
-
- skvm::F32 Br = gatherF(fbs, ix + 4);
- skvm::F32 Bg = gatherF(fbs, ix + 5);
- skvm::F32 Bb = gatherF(fbs, ix + 6);
- skvm::F32 Ba = gatherF(fbs, ix + 7);
-
- // This is what we've been building towards!
- color = {
- t * Fr + Br,
- t * Fg + Bg,
- t * Fb + Bb,
- t * Fa + Ba,
- };
- }
-
- // If we interpolated unpremul, premul now to match our output convention.
- if (0 == (fGradFlags & SkGradientShader::kInterpolateColorsInPremul_Flag)
- && !fColorsAreOpaque) {
- color = premul(color);
- }
-
- return {
- pun_to_F32(mask & pun_to_I32(color.r)),
- pun_to_F32(mask & pun_to_I32(color.g)),
- pun_to_F32(mask & pun_to_I32(color.b)),
- pun_to_F32(mask & pun_to_I32(color.a)),
- };
-}
-
-
-bool SkGradientShaderBase::isOpaque() const {
- return fColorsAreOpaque && (this->getTileMode() != SkTileMode::kDecal);
-}
-
-static unsigned rounded_divide(unsigned numer, unsigned denom) {
- return (numer + (denom >> 1)) / denom;
-}
-
-bool SkGradientShaderBase::onAsLuminanceColor(SkColor* lum) const {
- // we just compute an average color.
- // possibly we could weight this based on the proportional width for each color
- // assuming they are not evenly distributed in the fPos array.
- int r = 0;
- int g = 0;
- int b = 0;
- const int n = fColorCount;
- // TODO: use linear colors?
- for (int i = 0; i < n; ++i) {
- SkColor c = this->getLegacyColor(i);
- r += SkColorGetR(c);
- g += SkColorGetG(c);
- b += SkColorGetB(c);
- }
- *lum = SkColorSetRGB(rounded_divide(r, n), rounded_divide(g, n), rounded_divide(b, n));
- return true;
-}
-
-SkColor4fXformer::SkColor4fXformer(const SkColor4f* colors, int colorCount,
- SkColorSpace* src, SkColorSpace* dst) {
- fColors = colors;
-
- if (dst && !SkColorSpace::Equals(src, dst)) {
- fStorage.reset(colorCount);
-
- auto info = SkImageInfo::Make(colorCount,1, kRGBA_F32_SkColorType, kUnpremul_SkAlphaType);
-
- auto dstInfo = info.makeColorSpace(sk_ref_sp(dst));
- auto srcInfo = info.makeColorSpace(sk_ref_sp(src));
- SkAssertResult(SkConvertPixels(dstInfo, fStorage.begin(), info.minRowBytes(),
- srcInfo, fColors , info.minRowBytes()));
-
- fColors = fStorage.begin();
- }
-}
-
-void SkGradientShaderBase::commonAsAGradient(GradientInfo* info) const {
- if (info) {
- if (info->fColorCount >= fColorCount) {
- if (info->fColors) {
- for (int i = 0; i < fColorCount; ++i) {
- info->fColors[i] = this->getLegacyColor(i);
- }
- }
- if (info->fColorOffsets) {
- for (int i = 0; i < fColorCount; ++i) {
- info->fColorOffsets[i] = this->getPos(i);
- }
- }
- }
- info->fColorCount = fColorCount;
- info->fTileMode = fTileMode;
- info->fGradientFlags = fGradFlags;
- }
-}
///////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-
-// Return true if these parameters are valid/legal/safe to construct a gradient
-//
-static bool valid_grad(const SkColor4f colors[], const SkScalar pos[], int count,
- SkTileMode tileMode) {
- return nullptr != colors && count >= 1 && (unsigned)tileMode < kSkTileModeCount;
-}
-
-static void desc_init(SkGradientShaderBase::Descriptor* desc,
- const SkColor4f colors[], sk_sp<SkColorSpace> colorSpace,
- const SkScalar pos[], int colorCount,
- SkTileMode mode, uint32_t flags, const SkMatrix* localMatrix) {
- SkASSERT(colorCount > 1);
-
- desc->fColors = colors;
- desc->fColorSpace = std::move(colorSpace);
- desc->fPos = pos;
- desc->fCount = colorCount;
- desc->fTileMode = mode;
- desc->fGradFlags = flags;
- desc->fLocalMatrix = localMatrix;
-}
-
-static SkColor4f average_gradient_color(const SkColor4f colors[], const SkScalar pos[],
- int colorCount) {
- // The gradient is a piecewise linear interpolation between colors. For a given interval,
- // the integral between the two endpoints is 0.5 * (ci + cj) * (pj - pi), which provides that
- // intervals average color. The overall average color is thus the sum of each piece. The thing
- // to keep in mind is that the provided gradient definition may implicitly use p=0 and p=1.
- skvx::float4 blend(0.0f);
- for (int i = 0; i < colorCount - 1; ++i) {
- // Calculate the average color for the interval between pos(i) and pos(i+1)
- auto c0 = skvx::float4::Load(&colors[i]);
- auto c1 = skvx::float4::Load(&colors[i + 1]);
-
- // when pos == null, there are colorCount uniformly distributed stops, going from 0 to 1,
- // so pos[i + 1] - pos[i] = 1/(colorCount-1)
- SkScalar w;
- if (pos) {
- // Match position fixing in SkGradientShader's constructor, clamping positions outside
- // [0, 1] and forcing the sequence to be monotonic
- SkScalar p0 = SkTPin(pos[i], 0.f, 1.f);
- SkScalar p1 = SkTPin(pos[i + 1], p0, 1.f);
- w = p1 - p0;
-
- // And account for any implicit intervals at the start or end of the positions
- if (i == 0) {
- if (p0 > 0.0f) {
- // The first color is fixed between p = 0 to pos[0], so 0.5*(ci + cj)*(pj - pi)
- // becomes 0.5*(c + c)*(pj - 0) = c * pj
- auto c = skvx::float4::Load(&colors[0]);
- blend += p0 * c;
- }
- }
- if (i == colorCount - 2) {
- if (p1 < 1.f) {
- // The last color is fixed between pos[n-1] to p = 1, so 0.5*(ci + cj)*(pj - pi)
- // becomes 0.5*(c + c)*(1 - pi) = c * (1 - pi)
- auto c = skvx::float4::Load(&colors[colorCount - 1]);
- blend += (1.f - p1) * c;
- }
- }
- } else {
- w = 1.f / (colorCount - 1);
- }
-
- blend += 0.5f * w * (c1 + c0);
- }
-
- SkColor4f avg;
- blend.store(&avg);
- return avg;
-}
-
-// The default SkScalarNearlyZero threshold of .0024 is too big and causes regressions for svg
-// gradients defined in the wild.
-static constexpr SkScalar kDegenerateThreshold = SK_Scalar1 / (1 << 15);
-
-// Except for special circumstances of clamped gradients, every gradient shape--when degenerate--
-// can be mapped to the same fallbacks. The specific shape factories must account for special
-// clamped conditions separately, this will always return the last color for clamped gradients.
-static sk_sp<SkShader> make_degenerate_gradient(const SkColor4f colors[], const SkScalar pos[],
- int colorCount, sk_sp<SkColorSpace> colorSpace,
- SkTileMode mode) {
- switch(mode) {
- case SkTileMode::kDecal:
- // normally this would reject the area outside of the interpolation region, so since
- // inside region is empty when the radii are equal, the entire draw region is empty
- return SkShaders::Empty();
- case SkTileMode::kRepeat:
- case SkTileMode::kMirror:
- // repeat and mirror are treated the same: the border colors are never visible,
- // but approximate the final color as infinite repetitions of the colors, so
- // it can be represented as the average color of the gradient.
- return SkShaders::Color(
- average_gradient_color(colors, pos, colorCount), std::move(colorSpace));
- case SkTileMode::kClamp:
- // Depending on how the gradient shape degenerates, there may be a more specialized
- // fallback representation for the factories to use, but this is a reasonable default.
- return SkShaders::Color(colors[colorCount - 1], std::move(colorSpace));
- }
- SkDEBUGFAIL("Should not be reached");
- return nullptr;
-}
-
-// assumes colors is SkColor4f* and pos is SkScalar*
-#define EXPAND_1_COLOR(count) \
- SkColor4f tmp[2]; \
- do { \
- if (1 == count) { \
- tmp[0] = tmp[1] = colors[0]; \
- colors = tmp; \
- pos = nullptr; \
- count = 2; \
- } \
- } while (0)
-
-struct ColorStopOptimizer {
- ColorStopOptimizer(const SkColor4f* colors, const SkScalar* pos, int count, SkTileMode mode)
- : fColors(colors)
- , fPos(pos)
- , fCount(count) {
-
- if (!pos || count != 3) {
- return;
- }
-
- if (SkScalarNearlyEqual(pos[0], 0.0f) &&
- SkScalarNearlyEqual(pos[1], 0.0f) &&
- SkScalarNearlyEqual(pos[2], 1.0f)) {
-
- if (SkTileMode::kRepeat == mode || SkTileMode::kMirror == mode ||
- colors[0] == colors[1]) {
-
- // Ignore the leftmost color/pos.
- fColors += 1;
- fPos += 1;
- fCount = 2;
- }
- } else if (SkScalarNearlyEqual(pos[0], 0.0f) &&
- SkScalarNearlyEqual(pos[1], 1.0f) &&
- SkScalarNearlyEqual(pos[2], 1.0f)) {
-
- if (SkTileMode::kRepeat == mode || SkTileMode::kMirror == mode ||
- colors[1] == colors[2]) {
-
- // Ignore the rightmost color/pos.
- fCount = 2;
- }
- }
- }
-
- const SkColor4f* fColors;
- const SkScalar* fPos;
- int fCount;
-};
+// TODO: move the ColorConverter into SkGradientShaderBase
struct ColorConverter {
ColorConverter(const SkColor* colors, int count) {
const float ONE_OVER_255 = 1.f / 255;
@@ -876,7 +58,7 @@ sk_sp<SkShader> SkGradientShader::MakeLinear(const SkPoint pts[2],
if (!pts || !SkScalarIsFinite((pts[1] - pts[0]).length())) {
return nullptr;
}
- if (!valid_grad(colors, pos, colorCount, mode)) {
+ if (!SkGradientShaderBase::ValidGradient(colors, pos, colorCount, mode)) {
return nullptr;
}
if (1 == colorCount) {
@@ -886,19 +68,20 @@ sk_sp<SkShader> SkGradientShader::MakeLinear(const SkPoint pts[2],
return nullptr;
}
- if (SkScalarNearlyZero((pts[1] - pts[0]).length(), kDegenerateThreshold)) {
+ if (SkScalarNearlyZero((pts[1] - pts[0]).length(),
+ SkGradientShaderBase::kDegenerateThreshold)) {
// Degenerate gradient, the only tricky complication is when in clamp mode, the limit of
// the gradient approaches two half planes of solid color (first and last). However, they
// are divided by the line perpendicular to the start and end point, which becomes undefined
// once start and end are exactly the same, so just use the end color for a stable solution.
- return make_degenerate_gradient(colors, pos, colorCount, std::move(colorSpace), mode);
+ return SkGradientShaderBase::MakeDegenerateGradient(colors, pos, colorCount,
+ std::move(colorSpace), mode);
}
- ColorStopOptimizer opt(colors, pos, colorCount, mode);
+ SkGradientShaderBase::ColorStopOptimizer opt(colors, pos, colorCount, mode);
- SkGradientShaderBase::Descriptor desc;
- desc_init(&desc, opt.fColors, std::move(colorSpace), opt.fPos, opt.fCount, mode, flags,
- localMatrix);
+ SkGradientShaderBase::Descriptor desc(opt.fColors, std::move(colorSpace), opt.fPos,
+ opt.fCount, mode, flags, localMatrix);
return sk_make_sp<SkLinearGradient>(pts, desc);
}
@@ -920,39 +103,6 @@ sk_sp<SkShader> SkGradientShader::MakeRadial(const SkPoint& center, SkScalar rad
return MakeRadial(center, radius, colors, std::move(colorSpace), pos, count, mode, 0, nullptr);
}
-sk_sp<SkShader> SkGradientShader::MakeRadial(const SkPoint& center, SkScalar radius,
- const SkColor4f colors[],
- sk_sp<SkColorSpace> colorSpace,
- const SkScalar pos[], int colorCount,
- SkTileMode mode,
- uint32_t flags,
- const SkMatrix* localMatrix) {
- if (radius < 0) {
- return nullptr;
- }
- if (!valid_grad(colors, pos, colorCount, mode)) {
- return nullptr;
- }
- if (1 == colorCount) {
- return SkShaders::Color(colors[0], std::move(colorSpace));
- }
- if (localMatrix && !localMatrix->invert(nullptr)) {
- return nullptr;
- }
-
- if (SkScalarNearlyZero(radius, kDegenerateThreshold)) {
- // Degenerate gradient optimization, and no special logic needed for clamped radial gradient
- return make_degenerate_gradient(colors, pos, colorCount, std::move(colorSpace), mode);
- }
-
- ColorStopOptimizer opt(colors, pos, colorCount, mode);
-
- SkGradientShaderBase::Descriptor desc;
- desc_init(&desc, opt.fColors, std::move(colorSpace), opt.fPos, opt.fCount, mode, flags,
- localMatrix);
- return sk_make_sp<SkRadialGradient>(center, radius, desc);
-}
-
sk_sp<SkShader> SkGradientShader::MakeTwoPointConical(const SkPoint& start,
SkScalar startRadius,
const SkPoint& end,
@@ -980,67 +130,6 @@ sk_sp<SkShader> SkGradientShader::MakeTwoPointConical(const SkPoint& start,
std::move(colorSpace), pos, count, mode, 0, nullptr);
}
-sk_sp<SkShader> SkGradientShader::MakeTwoPointConical(const SkPoint& start,
- SkScalar startRadius,
- const SkPoint& end,
- SkScalar endRadius,
- const SkColor4f colors[],
- sk_sp<SkColorSpace> colorSpace,
- const SkScalar pos[],
- int colorCount,
- SkTileMode mode,
- uint32_t flags,
- const SkMatrix* localMatrix) {
- if (startRadius < 0 || endRadius < 0) {
- return nullptr;
- }
- if (!valid_grad(colors, pos, colorCount, mode)) {
- return nullptr;
- }
- if (SkScalarNearlyZero((start - end).length(), kDegenerateThreshold)) {
- // If the center positions are the same, then the gradient is the radial variant of a 2 pt
- // conical gradient, an actual radial gradient (startRadius == 0), or it is fully degenerate
- // (startRadius == endRadius).
- if (SkScalarNearlyEqual(startRadius, endRadius, kDegenerateThreshold)) {
- // Degenerate case, where the interpolation region area approaches zero. The proper
- // behavior depends on the tile mode, which is consistent with the default degenerate
- // gradient behavior, except when mode = clamp and the radii > 0.
- if (mode == SkTileMode::kClamp && endRadius > kDegenerateThreshold) {
- // The interpolation region becomes an infinitely thin ring at the radius, so the
- // final gradient will be the first color repeated from p=0 to 1, and then a hard
- // stop switching to the last color at p=1.
- static constexpr SkScalar circlePos[3] = {0, 1, 1};
- SkColor4f reColors[3] = {colors[0], colors[0], colors[colorCount - 1]};
- return MakeRadial(start, endRadius, reColors, std::move(colorSpace),
- circlePos, 3, mode, flags, localMatrix);
- } else {
- // Otherwise use the default degenerate case
- return make_degenerate_gradient(
- colors, pos, colorCount, std::move(colorSpace), mode);
- }
- } else if (SkScalarNearlyZero(startRadius, kDegenerateThreshold)) {
- // We can treat this gradient as radial, which is faster. If we got here, we know
- // that endRadius is not equal to 0, so this produces a meaningful gradient
- return MakeRadial(start, endRadius, colors, std::move(colorSpace), pos, colorCount,
- mode, flags, localMatrix);
- }
- // Else it's the 2pt conical radial variant with no degenerate radii, so fall through to the
- // regular 2pt constructor.
- }
-
- if (localMatrix && !localMatrix->invert(nullptr)) {
- return nullptr;
- }
- EXPAND_1_COLOR(colorCount);
-
- ColorStopOptimizer opt(colors, pos, colorCount, mode);
-
- SkGradientShaderBase::Descriptor desc;
- desc_init(&desc, opt.fColors, std::move(colorSpace), opt.fPos, opt.fCount, mode, flags,
- localMatrix);
- return SkTwoPointConicalGradient::Create(start, startRadius, end, endRadius, desc);
-}
-
sk_sp<SkShader> SkGradientShader::MakeSweep(SkScalar cx, SkScalar cy,
const SkColor colors[],
const SkScalar pos[],
@@ -1070,65 +159,11 @@ sk_sp<SkShader> SkGradientShader::MakeSweep(SkScalar cx, SkScalar cy,
return MakeSweep(cx, cy, colors, std::move(colorSpace), pos, count, 0, nullptr);
}
-sk_sp<SkShader> SkGradientShader::MakeSweep(SkScalar cx, SkScalar cy,
- const SkColor4f colors[],
- sk_sp<SkColorSpace> colorSpace,
- const SkScalar pos[],
- int colorCount,
- SkTileMode mode,
- SkScalar startAngle,
- SkScalar endAngle,
- uint32_t flags,
- const SkMatrix* localMatrix) {
- if (!valid_grad(colors, pos, colorCount, mode)) {
- return nullptr;
- }
- if (1 == colorCount) {
- return SkShaders::Color(colors[0], std::move(colorSpace));
- }
- if (!SkScalarIsFinite(startAngle) || !SkScalarIsFinite(endAngle) || startAngle > endAngle) {
- return nullptr;
- }
- if (localMatrix && !localMatrix->invert(nullptr)) {
- return nullptr;
- }
-
- if (SkScalarNearlyEqual(startAngle, endAngle, kDegenerateThreshold)) {
- // Degenerate gradient, which should follow default degenerate behavior unless it is
- // clamped and the angle is greater than 0.
- if (mode == SkTileMode::kClamp && endAngle > kDegenerateThreshold) {
- // In this case, the first color is repeated from 0 to the angle, then a hardstop
- // switches to the last color (all other colors are compressed to the infinitely thin
- // interpolation region).
- static constexpr SkScalar clampPos[3] = {0, 1, 1};
- SkColor4f reColors[3] = {colors[0], colors[0], colors[colorCount - 1]};
- return MakeSweep(cx, cy, reColors, std::move(colorSpace), clampPos, 3, mode, 0,
- endAngle, flags, localMatrix);
- } else {
- return make_degenerate_gradient(colors, pos, colorCount, std::move(colorSpace), mode);
- }
- }
-
- if (startAngle <= 0 && endAngle >= 360) {
- // If the t-range includes [0,1], then we can always use clamping (presumably faster).
- mode = SkTileMode::kClamp;
- }
-
- ColorStopOptimizer opt(colors, pos, colorCount, mode);
-
- SkGradientShaderBase::Descriptor desc;
- desc_init(&desc, opt.fColors, std::move(colorSpace), opt.fPos, opt.fCount, mode, flags,
- localMatrix);
-
- const SkScalar t0 = startAngle / 360,
- t1 = endAngle / 360;
-
- return sk_make_sp<SkSweepGradient>(SkPoint::Make(cx, cy), t0, t1, desc);
-}
+// TODO: flatten this into SkFlattenable::PrivateInitializer::InitEffects
void SkGradientShader::RegisterFlattenables() {
SK_REGISTER_FLATTENABLE(SkLinearGradient);
- SK_REGISTER_FLATTENABLE(SkRadialGradient);
- SK_REGISTER_FLATTENABLE(SkSweepGradient);
- SK_REGISTER_FLATTENABLE(SkTwoPointConicalGradient);
+ SkRegisterRadialGradientShaderFlattenable();
+ SkRegisterSweepGradientShaderFlattenable();
+ SkRegisterTwoPointConicalGradientShaderFlattenable();
}
diff --git a/chromium/third_party/skia/src/shaders/gradients/SkGradientShaderBase.cpp b/chromium/third_party/skia/src/shaders/gradients/SkGradientShaderBase.cpp
new file mode 100644
index 00000000000..5835f328f7a
--- /dev/null
+++ b/chromium/third_party/skia/src/shaders/gradients/SkGradientShaderBase.cpp
@@ -0,0 +1,807 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "src/shaders/gradients/SkGradientShaderBase.h"
+
+#include "include/core/SkColorSpace.h"
+#include "include/private/SkVx.h"
+#include "src/core/SkConvertPixels.h"
+#include "src/core/SkMatrixProvider.h"
+#include "src/core/SkRasterPipeline.h"
+#include "src/core/SkReadBuffer.h"
+#include "src/core/SkVM.h"
+#include "src/core/SkWriteBuffer.h"
+
+enum GradientSerializationFlags {
+ // Bits 29:31 used for various boolean flags
+ kHasPosition_GSF = 0x80000000,
+ kHasLocalMatrix_GSF = 0x40000000,
+ kHasColorSpace_GSF = 0x20000000,
+
+ // Bits 12:28 unused
+
+ // Bits 8:11 for fTileMode
+ kTileModeShift_GSF = 8,
+ kTileModeMask_GSF = 0xF,
+
+ // Bits 0:7 for fGradFlags (note that kForce4fContext_PrivateFlag is 0x80)
+ kGradFlagsShift_GSF = 0,
+ kGradFlagsMask_GSF = 0xFF,
+};
+
+SkGradientShaderBase::Descriptor::Descriptor() {
+ sk_bzero(this, sizeof(*this));
+ fTileMode = SkTileMode::kClamp;
+}
+SkGradientShaderBase::Descriptor::~Descriptor() = default;
+
+void SkGradientShaderBase::Descriptor::flatten(SkWriteBuffer& buffer) const {
+ uint32_t flags = 0;
+ if (fPos) {
+ flags |= kHasPosition_GSF;
+ }
+ if (fLocalMatrix) {
+ flags |= kHasLocalMatrix_GSF;
+ }
+ sk_sp<SkData> colorSpaceData = fColorSpace ? fColorSpace->serialize() : nullptr;
+ if (colorSpaceData) {
+ flags |= kHasColorSpace_GSF;
+ }
+ SkASSERT(static_cast<uint32_t>(fTileMode) <= kTileModeMask_GSF);
+ flags |= ((unsigned)fTileMode << kTileModeShift_GSF);
+ SkASSERT(fGradFlags <= kGradFlagsMask_GSF);
+ flags |= (fGradFlags << kGradFlagsShift_GSF);
+
+ buffer.writeUInt(flags);
+
+ buffer.writeColor4fArray(fColors, fCount);
+ if (colorSpaceData) {
+ buffer.writeDataAsByteArray(colorSpaceData.get());
+ }
+ if (fPos) {
+ buffer.writeScalarArray(fPos, fCount);
+ }
+ if (fLocalMatrix) {
+ buffer.writeMatrix(*fLocalMatrix);
+ }
+}
+
+template <int N, typename T, bool MEM_MOVE>
+static bool validate_array(SkReadBuffer& buffer, size_t count, SkSTArray<N, T, MEM_MOVE>* array) {
+ if (!buffer.validateCanReadN<T>(count)) {
+ return false;
+ }
+
+ array->resize_back(count);
+ return true;
+}
+
+bool SkGradientShaderBase::DescriptorScope::unflatten(SkReadBuffer& buffer) {
+ // New gradient format. Includes floating point color, color space, densely packed flags
+ uint32_t flags = buffer.readUInt();
+
+ fTileMode = (SkTileMode)((flags >> kTileModeShift_GSF) & kTileModeMask_GSF);
+ fGradFlags = (flags >> kGradFlagsShift_GSF) & kGradFlagsMask_GSF;
+
+ fCount = buffer.getArrayCount();
+
+ if (!(validate_array(buffer, fCount, &fColorStorage) &&
+ buffer.readColor4fArray(fColorStorage.begin(), fCount))) {
+ return false;
+ }
+ fColors = fColorStorage.begin();
+
+ if (SkToBool(flags & kHasColorSpace_GSF)) {
+ sk_sp<SkData> data = buffer.readByteArrayAsData();
+ fColorSpace = data ? SkColorSpace::Deserialize(data->data(), data->size()) : nullptr;
+ } else {
+ fColorSpace = nullptr;
+ }
+ if (SkToBool(flags & kHasPosition_GSF)) {
+ if (!(validate_array(buffer, fCount, &fPosStorage) &&
+ buffer.readScalarArray(fPosStorage.begin(), fCount))) {
+ return false;
+ }
+ fPos = fPosStorage.begin();
+ } else {
+ fPos = nullptr;
+ }
+ if (SkToBool(flags & kHasLocalMatrix_GSF)) {
+ fLocalMatrix = &fLocalMatrixStorage;
+ buffer.readMatrix(&fLocalMatrixStorage);
+ } else {
+ fLocalMatrix = nullptr;
+ }
+ return buffer.isValid();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+
+SkGradientShaderBase::SkGradientShaderBase(const Descriptor& desc, const SkMatrix& ptsToUnit)
+ : INHERITED(desc.fLocalMatrix)
+ , fPtsToUnit(ptsToUnit)
+ , fColorSpace(desc.fColorSpace ? desc.fColorSpace : SkColorSpace::MakeSRGB())
+ , fColorsAreOpaque(true)
+{
+ fPtsToUnit.getType(); // Precache so reads are threadsafe.
+ SkASSERT(desc.fCount > 1);
+
+ fGradFlags = static_cast<uint8_t>(desc.fGradFlags);
+
+ SkASSERT((unsigned)desc.fTileMode < kSkTileModeCount);
+ fTileMode = desc.fTileMode;
+
+ /* Note: we let the caller skip the first and/or last position.
+ i.e. pos[0] = 0.3, pos[1] = 0.7
+ In these cases, we insert entries to ensure that the final data
+ will be bracketed by [0, 1].
+ i.e. our_pos[0] = 0, our_pos[1] = 0.3, our_pos[2] = 0.7, our_pos[3] = 1
+
+ Thus colorCount (the caller's value, and fColorCount (our value) may
+ differ by up to 2. In the above example:
+ colorCount = 2
+ fColorCount = 4
+ */
+ fColorCount = desc.fCount;
+ // check if we need to add in start and/or end position/colors
+ bool needsFirst = false;
+ bool needsLast = false;
+ if (desc.fPos) {
+ needsFirst = desc.fPos[0] != 0;
+ needsLast = desc.fPos[desc.fCount - 1] != SK_Scalar1;
+ fColorCount += needsFirst + needsLast;
+ }
+
+ size_t storageSize = fColorCount * (sizeof(SkColor4f) + (desc.fPos ? sizeof(SkScalar) : 0));
+ fOrigColors4f = reinterpret_cast<SkColor4f*>(fStorage.reset(storageSize));
+ fOrigPos = desc.fPos ? reinterpret_cast<SkScalar*>(fOrigColors4f + fColorCount)
+ : nullptr;
+
+ // Now copy over the colors, adding the dummies as needed
+ SkColor4f* origColors = fOrigColors4f;
+ if (needsFirst) {
+ *origColors++ = desc.fColors[0];
+ }
+ for (int i = 0; i < desc.fCount; ++i) {
+ origColors[i] = desc.fColors[i];
+ fColorsAreOpaque = fColorsAreOpaque && (desc.fColors[i].fA == 1);
+ }
+ if (needsLast) {
+ origColors += desc.fCount;
+ *origColors = desc.fColors[desc.fCount - 1];
+ }
+
+ if (desc.fPos) {
+ SkScalar prev = 0;
+ SkScalar* origPosPtr = fOrigPos;
+ *origPosPtr++ = prev; // force the first pos to 0
+
+ int startIndex = needsFirst ? 0 : 1;
+ int count = desc.fCount + needsLast;
+
+ bool uniformStops = true;
+ const SkScalar uniformStep = desc.fPos[startIndex] - prev;
+ for (int i = startIndex; i < count; i++) {
+ // Pin the last value to 1.0, and make sure pos is monotonic.
+ auto curr = (i == desc.fCount) ? 1 : SkTPin(desc.fPos[i], prev, 1.0f);
+ uniformStops &= SkScalarNearlyEqual(uniformStep, curr - prev);
+
+ *origPosPtr++ = prev = curr;
+ }
+
+ // If the stops are uniform, treat them as implicit.
+ if (uniformStops) {
+ fOrigPos = nullptr;
+ }
+ }
+}
+
+SkGradientShaderBase::~SkGradientShaderBase() {}
+
+void SkGradientShaderBase::flatten(SkWriteBuffer& buffer) const {
+ Descriptor desc;
+ desc.fColors = fOrigColors4f;
+ desc.fColorSpace = fColorSpace;
+ desc.fPos = fOrigPos;
+ desc.fCount = fColorCount;
+ desc.fTileMode = fTileMode;
+ desc.fGradFlags = fGradFlags;
+
+ const SkMatrix& m = this->getLocalMatrix();
+ desc.fLocalMatrix = m.isIdentity() ? nullptr : &m;
+ desc.flatten(buffer);
+}
+
+static void add_stop_color(SkRasterPipeline_GradientCtx* ctx, size_t stop,
+ SkPMColor4f Fs, SkPMColor4f Bs) {
+ (ctx->fs[0])[stop] = Fs.fR;
+ (ctx->fs[1])[stop] = Fs.fG;
+ (ctx->fs[2])[stop] = Fs.fB;
+ (ctx->fs[3])[stop] = Fs.fA;
+
+ (ctx->bs[0])[stop] = Bs.fR;
+ (ctx->bs[1])[stop] = Bs.fG;
+ (ctx->bs[2])[stop] = Bs.fB;
+ (ctx->bs[3])[stop] = Bs.fA;
+}
+
+static void add_const_color(SkRasterPipeline_GradientCtx* ctx, size_t stop, SkPMColor4f color) {
+ add_stop_color(ctx, stop, { 0, 0, 0, 0 }, color);
+}
+
+// Calculate a factor F and a bias B so that color = F*t + B when t is in range of
+// the stop. Assume that the distance between stops is 1/gapCount.
+static void init_stop_evenly(SkRasterPipeline_GradientCtx* ctx, float gapCount, size_t stop,
+ SkPMColor4f c_l, SkPMColor4f c_r) {
+ // Clankium's GCC 4.9 targeting ARMv7 is barfing when we use Sk4f math here, so go scalar...
+ SkPMColor4f Fs = {
+ (c_r.fR - c_l.fR) * gapCount,
+ (c_r.fG - c_l.fG) * gapCount,
+ (c_r.fB - c_l.fB) * gapCount,
+ (c_r.fA - c_l.fA) * gapCount,
+ };
+ SkPMColor4f Bs = {
+ c_l.fR - Fs.fR*(stop/gapCount),
+ c_l.fG - Fs.fG*(stop/gapCount),
+ c_l.fB - Fs.fB*(stop/gapCount),
+ c_l.fA - Fs.fA*(stop/gapCount),
+ };
+ add_stop_color(ctx, stop, Fs, Bs);
+}
+
+// For each stop we calculate a bias B and a scale factor F, such that
+// for any t between stops n and n+1, the color we want is B[n] + F[n]*t.
+static void init_stop_pos(SkRasterPipeline_GradientCtx* ctx, size_t stop, float t_l, float t_r,
+ SkPMColor4f c_l, SkPMColor4f c_r) {
+ // See note about Clankium's old compiler in init_stop_evenly().
+ SkPMColor4f Fs = {
+ (c_r.fR - c_l.fR) / (t_r - t_l),
+ (c_r.fG - c_l.fG) / (t_r - t_l),
+ (c_r.fB - c_l.fB) / (t_r - t_l),
+ (c_r.fA - c_l.fA) / (t_r - t_l),
+ };
+ SkPMColor4f Bs = {
+ c_l.fR - Fs.fR*t_l,
+ c_l.fG - Fs.fG*t_l,
+ c_l.fB - Fs.fB*t_l,
+ c_l.fA - Fs.fA*t_l,
+ };
+ ctx->ts[stop] = t_l;
+ add_stop_color(ctx, stop, Fs, Bs);
+}
+
+bool SkGradientShaderBase::onAppendStages(const SkStageRec& rec) const {
+ SkRasterPipeline* p = rec.fPipeline;
+ SkArenaAlloc* alloc = rec.fAlloc;
+ SkRasterPipeline_DecalTileCtx* decal_ctx = nullptr;
+
+ SkMatrix matrix;
+ if (!this->computeTotalInverse(rec.fMatrixProvider.localToDevice(), rec.fLocalM, &matrix)) {
+ return false;
+ }
+ matrix.postConcat(fPtsToUnit);
+
+ SkRasterPipeline_<256> postPipeline;
+
+ p->append(SkRasterPipeline::seed_shader);
+ p->append_matrix(alloc, matrix);
+ this->appendGradientStages(alloc, p, &postPipeline);
+
+ switch(fTileMode) {
+ case SkTileMode::kMirror: p->append(SkRasterPipeline::mirror_x_1); break;
+ case SkTileMode::kRepeat: p->append(SkRasterPipeline::repeat_x_1); break;
+ case SkTileMode::kDecal:
+ decal_ctx = alloc->make<SkRasterPipeline_DecalTileCtx>();
+ decal_ctx->limit_x = SkBits2Float(SkFloat2Bits(1.0f) + 1);
+ // reuse mask + limit_x stage, or create a custom decal_1 that just stores the mask
+ p->append(SkRasterPipeline::decal_x, decal_ctx);
+ [[fallthrough]];
+
+ case SkTileMode::kClamp:
+ if (!fOrigPos) {
+ // We clamp only when the stops are evenly spaced.
+ // If not, there may be hard stops, and clamping ruins hard stops at 0 and/or 1.
+ // In that case, we must make sure we're using the general "gradient" stage,
+ // which is the only stage that will correctly handle unclamped t.
+ p->append(SkRasterPipeline::clamp_x_1);
+ }
+ break;
+ }
+
+ const bool premulGrad = fGradFlags & SkGradientShader::kInterpolateColorsInPremul_Flag;
+
+ // Transform all of the colors to destination color space
+ SkColor4fXformer xformedColors(fOrigColors4f, fColorCount, fColorSpace.get(), rec.fDstCS);
+
+ auto prepareColor = [premulGrad, &xformedColors](int i) {
+ SkColor4f c = xformedColors.fColors[i];
+ return premulGrad ? c.premul()
+ : SkPMColor4f{ c.fR, c.fG, c.fB, c.fA };
+ };
+
+ // The two-stop case with stops at 0 and 1.
+ if (fColorCount == 2 && fOrigPos == nullptr) {
+ const SkPMColor4f c_l = prepareColor(0),
+ c_r = prepareColor(1);
+
+ // See F and B below.
+ auto ctx = alloc->make<SkRasterPipeline_EvenlySpaced2StopGradientCtx>();
+ (skvx::float4::Load(c_r.vec()) - skvx::float4::Load(c_l.vec())).store(ctx->f);
+ ( skvx::float4::Load(c_l.vec())).store(ctx->b);
+ ctx->interpolatedInPremul = premulGrad;
+
+ p->append(SkRasterPipeline::evenly_spaced_2_stop_gradient, ctx);
+ } else {
+ auto* ctx = alloc->make<SkRasterPipeline_GradientCtx>();
+ ctx->interpolatedInPremul = premulGrad;
+
+ // Note: In order to handle clamps in search, the search assumes a stop conceptully placed
+ // at -inf. Therefore, the max number of stops is fColorCount+1.
+ for (int i = 0; i < 4; i++) {
+ // Allocate at least at for the AVX2 gather from a YMM register.
+ ctx->fs[i] = alloc->makeArray<float>(std::max(fColorCount+1, 8));
+ ctx->bs[i] = alloc->makeArray<float>(std::max(fColorCount+1, 8));
+ }
+
+ if (fOrigPos == nullptr) {
+ // Handle evenly distributed stops.
+
+ size_t stopCount = fColorCount;
+ float gapCount = stopCount - 1;
+
+ SkPMColor4f c_l = prepareColor(0);
+ for (size_t i = 0; i < stopCount - 1; i++) {
+ SkPMColor4f c_r = prepareColor(i + 1);
+ init_stop_evenly(ctx, gapCount, i, c_l, c_r);
+ c_l = c_r;
+ }
+ add_const_color(ctx, stopCount - 1, c_l);
+
+ ctx->stopCount = stopCount;
+ p->append(SkRasterPipeline::evenly_spaced_gradient, ctx);
+ } else {
+ // Handle arbitrary stops.
+
+ ctx->ts = alloc->makeArray<float>(fColorCount+1);
+
+ // Remove the default stops inserted by SkGradientShaderBase::SkGradientShaderBase
+ // because they are naturally handled by the search method.
+ int firstStop;
+ int lastStop;
+ if (fColorCount > 2) {
+ firstStop = fOrigColors4f[0] != fOrigColors4f[1] ? 0 : 1;
+ lastStop = fOrigColors4f[fColorCount - 2] != fOrigColors4f[fColorCount - 1]
+ ? fColorCount - 1 : fColorCount - 2;
+ } else {
+ firstStop = 0;
+ lastStop = 1;
+ }
+
+ size_t stopCount = 0;
+ float t_l = fOrigPos[firstStop];
+ SkPMColor4f c_l = prepareColor(firstStop);
+ add_const_color(ctx, stopCount++, c_l);
+ // N.B. lastStop is the index of the last stop, not one after.
+ for (int i = firstStop; i < lastStop; i++) {
+ float t_r = fOrigPos[i + 1];
+ SkPMColor4f c_r = prepareColor(i + 1);
+ SkASSERT(t_l <= t_r);
+ if (t_l < t_r) {
+ init_stop_pos(ctx, stopCount, t_l, t_r, c_l, c_r);
+ stopCount += 1;
+ }
+ t_l = t_r;
+ c_l = c_r;
+ }
+
+ ctx->ts[stopCount] = t_l;
+ add_const_color(ctx, stopCount++, c_l);
+
+ ctx->stopCount = stopCount;
+ p->append(SkRasterPipeline::gradient, ctx);
+ }
+ }
+
+ if (decal_ctx) {
+ p->append(SkRasterPipeline::check_decal_mask, decal_ctx);
+ }
+
+ if (!premulGrad && !this->colorsAreOpaque()) {
+ p->append(SkRasterPipeline::premul);
+ }
+
+ p->extend(postPipeline);
+
+ return true;
+}
+
+skvm::Color SkGradientShaderBase::onProgram(skvm::Builder* p,
+ skvm::Coord device, skvm::Coord local,
+ skvm::Color /*paint*/,
+ const SkMatrixProvider& mats, const SkMatrix* localM,
+ const SkColorInfo& dstInfo,
+ skvm::Uniforms* uniforms, SkArenaAlloc* alloc) const {
+ SkMatrix inv;
+ if (!this->computeTotalInverse(mats.localToDevice(), localM, &inv)) {
+ return {};
+ }
+ inv.postConcat(fPtsToUnit);
+ inv.normalizePerspective();
+
+ local = SkShaderBase::ApplyMatrix(p, inv, local, uniforms);
+
+ skvm::I32 mask = p->splat(~0);
+ skvm::F32 t = this->transformT(p,uniforms, local, &mask);
+
+ // Perhaps unexpectedly, clamping is handled naturally by our search, so we
+ // don't explicitly clamp t to [0,1]. That clamp would break hard stops
+ // right at 0 or 1 boundaries in kClamp mode. (kRepeat and kMirror always
+ // produce values in [0,1].)
+ switch(fTileMode) {
+ case SkTileMode::kClamp:
+ break;
+
+ case SkTileMode::kDecal:
+ mask &= (t == clamp01(t));
+ break;
+
+ case SkTileMode::kRepeat:
+ t = fract(t);
+ break;
+
+ case SkTileMode::kMirror: {
+ // t = | (t-1) - 2*(floor( (t-1)*0.5 )) - 1 |
+ // {-A-} {--------B-------}
+ skvm::F32 A = t - 1.0f,
+ B = floor(A * 0.5f);
+ t = abs(A - (B + B) - 1.0f);
+ } break;
+ }
+
+ // Transform our colors as we want them interpolated, in dst color space, possibly premul.
+ SkImageInfo common = SkImageInfo::Make(fColorCount,1, kRGBA_F32_SkColorType
+ , kUnpremul_SkAlphaType),
+ src = common.makeColorSpace(fColorSpace),
+ dst = common.makeColorSpace(dstInfo.refColorSpace());
+ if (fGradFlags & SkGradientShader::kInterpolateColorsInPremul_Flag) {
+ dst = dst.makeAlphaType(kPremul_SkAlphaType);
+ }
+
+ std::vector<float> rgba(4*fColorCount); // TODO: SkSTArray?
+ SkAssertResult(SkConvertPixels(dst, rgba.data(), dst.minRowBytes(),
+ src, fOrigColors4f, src.minRowBytes()));
+
+ // Transform our colors into a scale factor f and bias b such that for
+ // any t between stops i and i+1, the color we want is mad(t, f[i], b[i]).
+ using F4 = skvx::Vec<4,float>;
+ struct FB { F4 f,b; };
+ skvm::Color color;
+
+ auto uniformF = [&](float x) { return p->uniformF(uniforms->pushF(x)); };
+
+ if (fColorCount == 2) {
+ // 2-stop gradients have colors at 0 and 1, and so must be evenly spaced.
+ SkASSERT(fOrigPos == nullptr);
+
+ // With 2 stops, we upload the single FB as uniforms and interpolate directly with t.
+ F4 lo = F4::Load(rgba.data() + 0),
+ hi = F4::Load(rgba.data() + 4);
+ F4 F = hi - lo,
+ B = lo;
+
+ auto T = clamp01(t);
+ color = {
+ T * uniformF(F[0]) + uniformF(B[0]),
+ T * uniformF(F[1]) + uniformF(B[1]),
+ T * uniformF(F[2]) + uniformF(B[2]),
+ T * uniformF(F[3]) + uniformF(B[3]),
+ };
+ } else {
+ // To handle clamps in search we add a conceptual stop at t=-inf, so we
+ // may need up to fColorCount+1 FBs and fColorCount t stops between them:
+ //
+ // FBs: [color 0] [color 0->1] [color 1->2] [color 2->3] ...
+ // stops: (-inf) t0 t1 t2 ...
+ //
+ // Both these arrays could end up shorter if any hard stops share the same t.
+ FB* fb = alloc->makeArrayDefault<FB>(fColorCount+1);
+ std::vector<float> stops; // TODO: SkSTArray?
+ stops.reserve(fColorCount);
+
+ // Here's our conceptual stop at t=-inf covering all t<=0, clamping to our first color.
+ float t_lo = this->getPos(0);
+ F4 color_lo = F4::Load(rgba.data());
+ fb[0] = { 0.0f, color_lo };
+ // N.B. No stops[] entry for this implicit -inf.
+
+ // Now the non-edge cases, calculating scale and bias between adjacent normal stops.
+ for (int i = 1; i < fColorCount; i++) {
+ float t_hi = this->getPos(i);
+ F4 color_hi = F4::Load(rgba.data() + 4*i);
+
+ // If t_lo == t_hi, we're on a hard stop, and transition immediately to the next color.
+ SkASSERT(t_lo <= t_hi);
+ if (t_lo < t_hi) {
+ F4 f = (color_hi - color_lo) / (t_hi - t_lo),
+ b = color_lo - f*t_lo;
+ stops.push_back(t_lo);
+ fb[stops.size()] = {f,b};
+ }
+
+ t_lo = t_hi;
+ color_lo = color_hi;
+ }
+ // Anything >= our final t clamps to our final color.
+ stops.push_back(t_lo);
+ fb[stops.size()] = { 0.0f, color_lo };
+
+ // We'll gather FBs from that array we just created.
+ skvm::Uniform fbs = uniforms->pushPtr(fb);
+
+ // Find the two stops we need to interpolate.
+ skvm::I32 ix;
+ if (fOrigPos == nullptr) {
+ // Evenly spaced stops... we can calculate ix directly.
+ // Of note: we need to clamp t and skip over that conceptual -inf stop we made up.
+ ix = trunc(clamp01(t) * uniformF(stops.size() - 1) + 1.0f);
+ } else {
+ // Starting ix at 0 bakes in our conceptual first stop at -inf.
+ // TODO: good place to experiment with a loop in skvm.... stops.size() can be huge.
+ ix = p->splat(0);
+ for (float stop : stops) {
+ // ix += (t >= stop) ? +1 : 0 ~~>
+ // ix -= (t >= stop) ? -1 : 0
+ ix -= (t >= uniformF(stop));
+ }
+ // TODO: we could skip any of the default stops GradientShaderBase's ctor added
+ // to ensure the full [0,1] span is covered. This linear search doesn't need
+ // them for correctness, and it'd be up to two fewer stops to check.
+ // N.B. we do still need those stops for the fOrigPos == nullptr direct math path.
+ }
+
+ // A scale factor and bias for each lane, 8 total.
+ // TODO: simpler, faster, tidier to push 8 uniform pointers, one for each struct lane?
+ ix = shl(ix, 3);
+ skvm::F32 Fr = gatherF(fbs, ix + 0);
+ skvm::F32 Fg = gatherF(fbs, ix + 1);
+ skvm::F32 Fb = gatherF(fbs, ix + 2);
+ skvm::F32 Fa = gatherF(fbs, ix + 3);
+
+ skvm::F32 Br = gatherF(fbs, ix + 4);
+ skvm::F32 Bg = gatherF(fbs, ix + 5);
+ skvm::F32 Bb = gatherF(fbs, ix + 6);
+ skvm::F32 Ba = gatherF(fbs, ix + 7);
+
+ // This is what we've been building towards!
+ color = {
+ t * Fr + Br,
+ t * Fg + Bg,
+ t * Fb + Bb,
+ t * Fa + Ba,
+ };
+ }
+
+ // If we interpolated unpremul, premul now to match our output convention.
+ if (0 == (fGradFlags & SkGradientShader::kInterpolateColorsInPremul_Flag)
+ && !fColorsAreOpaque) {
+ color = premul(color);
+ }
+
+ return {
+ pun_to_F32(mask & pun_to_I32(color.r)),
+ pun_to_F32(mask & pun_to_I32(color.g)),
+ pun_to_F32(mask & pun_to_I32(color.b)),
+ pun_to_F32(mask & pun_to_I32(color.a)),
+ };
+}
+
+
+bool SkGradientShaderBase::isOpaque() const {
+ return fColorsAreOpaque && (this->getTileMode() != SkTileMode::kDecal);
+}
+
+static unsigned rounded_divide(unsigned numer, unsigned denom) {
+ return (numer + (denom >> 1)) / denom;
+}
+
+bool SkGradientShaderBase::onAsLuminanceColor(SkColor* lum) const {
+ // we just compute an average color.
+ // possibly we could weight this based on the proportional width for each color
+ // assuming they are not evenly distributed in the fPos array.
+ int r = 0;
+ int g = 0;
+ int b = 0;
+ const int n = fColorCount;
+ // TODO: use linear colors?
+ for (int i = 0; i < n; ++i) {
+ SkColor c = this->getLegacyColor(i);
+ r += SkColorGetR(c);
+ g += SkColorGetG(c);
+ b += SkColorGetB(c);
+ }
+ *lum = SkColorSetRGB(rounded_divide(r, n), rounded_divide(g, n), rounded_divide(b, n));
+ return true;
+}
+
+SkColor4fXformer::SkColor4fXformer(const SkColor4f* colors, int colorCount,
+ SkColorSpace* src, SkColorSpace* dst) {
+ fColors = colors;
+
+ if (dst && !SkColorSpace::Equals(src, dst)) {
+ fStorage.reset(colorCount);
+
+ auto info = SkImageInfo::Make(colorCount,1, kRGBA_F32_SkColorType, kUnpremul_SkAlphaType);
+
+ auto dstInfo = info.makeColorSpace(sk_ref_sp(dst));
+ auto srcInfo = info.makeColorSpace(sk_ref_sp(src));
+ SkAssertResult(SkConvertPixels(dstInfo, fStorage.begin(), info.minRowBytes(),
+ srcInfo, fColors , info.minRowBytes()));
+
+ fColors = fStorage.begin();
+ }
+}
+
+void SkGradientShaderBase::commonAsAGradient(GradientInfo* info) const {
+ if (info) {
+ if (info->fColorCount >= fColorCount) {
+ if (info->fColors) {
+ for (int i = 0; i < fColorCount; ++i) {
+ info->fColors[i] = this->getLegacyColor(i);
+ }
+ }
+ if (info->fColorOffsets) {
+ for (int i = 0; i < fColorCount; ++i) {
+ info->fColorOffsets[i] = this->getPos(i);
+ }
+ }
+ }
+ info->fColorCount = fColorCount;
+ info->fTileMode = fTileMode;
+ info->fGradientFlags = fGradFlags;
+ }
+}
+
+// Return true if these parameters are valid/legal/safe to construct a gradient
+//
+bool SkGradientShaderBase::ValidGradient(const SkColor4f colors[], const SkScalar pos[], int count,
+ SkTileMode tileMode) {
+ return nullptr != colors && count >= 1 && (unsigned)tileMode < kSkTileModeCount;
+}
+
+SkGradientShaderBase::Descriptor::Descriptor(const SkColor4f colors[],
+ sk_sp<SkColorSpace> colorSpace,
+ const SkScalar pos[],
+ int colorCount,
+ SkTileMode mode,
+ uint32_t flags,
+ const SkMatrix* localMatrix)
+ : fLocalMatrix(localMatrix)
+ , fColors(colors)
+ , fColorSpace(std::move(colorSpace))
+ , fPos(pos)
+ , fCount(colorCount)
+ , fTileMode(mode)
+ , fGradFlags(flags) {
+ SkASSERT(fCount > 1);
+}
+
+static SkColor4f average_gradient_color(const SkColor4f colors[], const SkScalar pos[],
+ int colorCount) {
+ // The gradient is a piecewise linear interpolation between colors. For a given interval,
+ // the integral between the two endpoints is 0.5 * (ci + cj) * (pj - pi), which provides that
+ // intervals average color. The overall average color is thus the sum of each piece. The thing
+ // to keep in mind is that the provided gradient definition may implicitly use p=0 and p=1.
+ skvx::float4 blend(0.0f);
+ for (int i = 0; i < colorCount - 1; ++i) {
+ // Calculate the average color for the interval between pos(i) and pos(i+1)
+ auto c0 = skvx::float4::Load(&colors[i]);
+ auto c1 = skvx::float4::Load(&colors[i + 1]);
+
+ // when pos == null, there are colorCount uniformly distributed stops, going from 0 to 1,
+ // so pos[i + 1] - pos[i] = 1/(colorCount-1)
+ SkScalar w;
+ if (pos) {
+ // Match position fixing in SkGradientShader's constructor, clamping positions outside
+ // [0, 1] and forcing the sequence to be monotonic
+ SkScalar p0 = SkTPin(pos[i], 0.f, 1.f);
+ SkScalar p1 = SkTPin(pos[i + 1], p0, 1.f);
+ w = p1 - p0;
+
+ // And account for any implicit intervals at the start or end of the positions
+ if (i == 0) {
+ if (p0 > 0.0f) {
+ // The first color is fixed between p = 0 to pos[0], so 0.5*(ci + cj)*(pj - pi)
+ // becomes 0.5*(c + c)*(pj - 0) = c * pj
+ auto c = skvx::float4::Load(&colors[0]);
+ blend += p0 * c;
+ }
+ }
+ if (i == colorCount - 2) {
+ if (p1 < 1.f) {
+ // The last color is fixed between pos[n-1] to p = 1, so 0.5*(ci + cj)*(pj - pi)
+ // becomes 0.5*(c + c)*(1 - pi) = c * (1 - pi)
+ auto c = skvx::float4::Load(&colors[colorCount - 1]);
+ blend += (1.f - p1) * c;
+ }
+ }
+ } else {
+ w = 1.f / (colorCount - 1);
+ }
+
+ blend += 0.5f * w * (c1 + c0);
+ }
+
+ SkColor4f avg;
+ blend.store(&avg);
+ return avg;
+}
+
+// Except for special circumstances of clamped gradients, every gradient shape--when degenerate--
+// can be mapped to the same fallbacks. The specific shape factories must account for special
+// clamped conditions separately, this will always return the last color for clamped gradients.
+sk_sp<SkShader> SkGradientShaderBase::MakeDegenerateGradient(const SkColor4f colors[],
+ const SkScalar pos[],
+ int colorCount,
+ sk_sp<SkColorSpace> colorSpace,
+ SkTileMode mode) {
+ switch(mode) {
+ case SkTileMode::kDecal:
+ // normally this would reject the area outside of the interpolation region, so since
+ // inside region is empty when the radii are equal, the entire draw region is empty
+ return SkShaders::Empty();
+ case SkTileMode::kRepeat:
+ case SkTileMode::kMirror:
+ // repeat and mirror are treated the same: the border colors are never visible,
+ // but approximate the final color as infinite repetitions of the colors, so
+ // it can be represented as the average color of the gradient.
+ return SkShaders::Color(
+ average_gradient_color(colors, pos, colorCount), std::move(colorSpace));
+ case SkTileMode::kClamp:
+ // Depending on how the gradient shape degenerates, there may be a more specialized
+ // fallback representation for the factories to use, but this is a reasonable default.
+ return SkShaders::Color(colors[colorCount - 1], std::move(colorSpace));
+ }
+ SkDEBUGFAIL("Should not be reached");
+ return nullptr;
+}
+
+SkGradientShaderBase::ColorStopOptimizer::ColorStopOptimizer(const SkColor4f* colors,
+ const SkScalar* pos,
+ int count,
+ SkTileMode mode)
+ : fColors(colors)
+ , fPos(pos)
+ , fCount(count) {
+
+ if (!pos || count != 3) {
+ return;
+ }
+
+ if (SkScalarNearlyEqual(pos[0], 0.0f) &&
+ SkScalarNearlyEqual(pos[1], 0.0f) &&
+ SkScalarNearlyEqual(pos[2], 1.0f)) {
+
+ if (SkTileMode::kRepeat == mode || SkTileMode::kMirror == mode ||
+ colors[0] == colors[1]) {
+
+ // Ignore the leftmost color/pos.
+ fColors += 1;
+ fPos += 1;
+ fCount = 2;
+ }
+ } else if (SkScalarNearlyEqual(pos[0], 0.0f) &&
+ SkScalarNearlyEqual(pos[1], 1.0f) &&
+ SkScalarNearlyEqual(pos[2], 1.0f)) {
+
+ if (SkTileMode::kRepeat == mode || SkTileMode::kMirror == mode ||
+ colors[1] == colors[2]) {
+
+ // Ignore the rightmost color/pos.
+ fCount = 2;
+ }
+ }
+}
diff --git a/chromium/third_party/skia/src/shaders/gradients/SkGradientShaderPriv.h b/chromium/third_party/skia/src/shaders/gradients/SkGradientShaderBase.h
index 3de22b76d00..1c1879169a8 100644
--- a/chromium/third_party/skia/src/shaders/gradients/SkGradientShaderPriv.h
+++ b/chromium/third_party/skia/src/shaders/gradients/SkGradientShaderBase.h
@@ -28,6 +28,10 @@ public:
Descriptor();
~Descriptor();
+ Descriptor(const SkColor4f colors[], sk_sp<SkColorSpace> colorSpace,
+ const SkScalar pos[], int colorCount,
+ SkTileMode mode, uint32_t flags, const SkMatrix* localMatrix);
+
const SkMatrix* fLocalMatrix;
const SkColor4f* fColors;
sk_sp<SkColorSpace> fColorSpace;
@@ -65,6 +69,26 @@ public:
const SkMatrix& getGradientMatrix() const { return fPtsToUnit; }
+ static bool ValidGradient(const SkColor4f colors[], const SkScalar pos[], int count,
+ SkTileMode tileMode);
+
+ static sk_sp<SkShader> MakeDegenerateGradient(const SkColor4f colors[], const SkScalar pos[],
+ int colorCount, sk_sp<SkColorSpace> colorSpace,
+ SkTileMode mode);
+
+ struct ColorStopOptimizer {
+ ColorStopOptimizer(const SkColor4f* colors, const SkScalar* pos, int count,
+ SkTileMode mode);
+
+ const SkColor4f* fColors;
+ const SkScalar* fPos;
+ int fCount;
+ };
+
+ // The default SkScalarNearlyZero threshold of .0024 is too big and causes regressions for svg
+ // gradients defined in the wild.
+ static constexpr SkScalar kDegenerateThreshold = SK_Scalar1 / (1 << 15);
+
protected:
class GradientShaderBase4fContext;
@@ -150,4 +174,8 @@ struct SkColor4fXformer {
SkSTArray<4, SkColor4f, true> fStorage;
};
+void SkRegisterRadialGradientShaderFlattenable();
+void SkRegisterSweepGradientShaderFlattenable();
+void SkRegisterTwoPointConicalGradientShaderFlattenable();
+
#endif
diff --git a/chromium/third_party/skia/src/shaders/gradients/SkLinearGradient.h b/chromium/third_party/skia/src/shaders/gradients/SkLinearGradient.h
index 66d620fe28b..b0020f786fa 100644
--- a/chromium/third_party/skia/src/shaders/gradients/SkLinearGradient.h
+++ b/chromium/third_party/skia/src/shaders/gradients/SkLinearGradient.h
@@ -8,11 +8,11 @@
#ifndef SkLinearGradient_DEFINED
#define SkLinearGradient_DEFINED
-#include "src/shaders/gradients/SkGradientShaderPriv.h"
+#include "src/shaders/gradients/SkGradientShaderBase.h"
class SkShaderCodeDictionary;
-class SkLinearGradient : public SkGradientShaderBase {
+class SkLinearGradient final : public SkGradientShaderBase {
public:
SkLinearGradient(const SkPoint pts[2], const Descriptor&);
diff --git a/chromium/third_party/skia/src/shaders/gradients/SkRadialGradient.cpp b/chromium/third_party/skia/src/shaders/gradients/SkRadialGradient.cpp
index a66998614cf..a14ed0259aa 100644
--- a/chromium/third_party/skia/src/shaders/gradients/SkRadialGradient.cpp
+++ b/chromium/third_party/skia/src/shaders/gradients/SkRadialGradient.cpp
@@ -5,8 +5,6 @@
* found in the LICENSE file.
*/
-#include "src/shaders/gradients/SkRadialGradient.h"
-
#include "src/core/SkRasterPipeline.h"
#include "src/core/SkReadBuffer.h"
#include "src/core/SkWriteBuffer.h"
@@ -16,6 +14,10 @@
#include "src/core/SkPaintParamsKey.h"
#endif
+#include "src/shaders/gradients/SkGradientShaderBase.h"
+
+class SkShaderCodeDictionary;
+
namespace {
SkMatrix rad_to_unit_matrix(const SkPoint& center, SkScalar radius) {
@@ -30,6 +32,36 @@ SkMatrix rad_to_unit_matrix(const SkPoint& center, SkScalar radius) {
} // namespace
/////////////////////////////////////////////////////////////////////
+class SkRadialGradient final : public SkGradientShaderBase {
+public:
+ SkRadialGradient(const SkPoint& center, SkScalar radius, const Descriptor&);
+
+ GradientType asAGradient(GradientInfo* info) const override;
+#if SK_SUPPORT_GPU
+ std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
+#endif
+#ifdef SK_ENABLE_SKSL
+ void addToKey(const SkKeyContext&,
+ SkPaintParamsKeyBuilder*,
+ SkPipelineDataGatherer*) const override;
+#endif
+protected:
+ SkRadialGradient(SkReadBuffer& buffer);
+ void flatten(SkWriteBuffer& buffer) const override;
+
+ void appendGradientStages(SkArenaAlloc* alloc, SkRasterPipeline* tPipeline,
+ SkRasterPipeline* postPipeline) const override;
+
+ skvm::F32 transformT(skvm::Builder*, skvm::Uniforms*,
+ skvm::Coord coord, skvm::I32* mask) const final;
+
+private:
+ friend void ::SkRegisterRadialGradientShaderFlattenable();
+ SK_FLATTENABLE_HOOKS(SkRadialGradient)
+
+ const SkPoint fCenter;
+ const SkScalar fRadius;
+};
SkRadialGradient::SkRadialGradient(const SkPoint& center, SkScalar radius, const Descriptor& desc)
: SkGradientShaderBase(desc, rad_to_unit_matrix(center, radius))
@@ -59,7 +91,7 @@ sk_sp<SkFlattenable> SkRadialGradient::CreateProc(SkReadBuffer& buffer) {
}
void SkRadialGradient::flatten(SkWriteBuffer& buffer) const {
- this->INHERITED::flatten(buffer);
+ this->SkGradientShaderBase::flatten(buffer);
buffer.writePoint(fCenter);
buffer.writeScalar(fRadius);
}
@@ -78,11 +110,22 @@ skvm::F32 SkRadialGradient::transformT(skvm::Builder* p, skvm::Uniforms*,
#if SK_SUPPORT_GPU
+#include "src/core/SkRuntimeEffectPriv.h"
+#include "src/gpu/ganesh/effects/GrSkSLFP.h"
#include "src/gpu/ganesh/gradients/GrGradientShader.h"
+
std::unique_ptr<GrFragmentProcessor> SkRadialGradient::asFragmentProcessor(
const GrFPArgs& args) const {
- return GrGradientShader::MakeRadial(*this, args);
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
+ half4 main(float2 coord) {
+ return half4(half(length(coord)), 1, 0, 0); // y = 1 for always valid
+ }
+ )");
+ // The radial gradient never rejects a pixel so it doesn't change opacity
+ auto fp = GrSkSLFP::Make(effect, "RadialLayout", /*inputFP=*/nullptr,
+ GrSkSLFP::OptFlags::kPreservesOpaqueInput);
+ return GrGradientShader::MakeGradientFP(*this, args, std::move(fp));
}
#endif
@@ -105,3 +148,40 @@ void SkRadialGradient::addToKey(const SkKeyContext& keyContext,
builder->endBlock();
}
#endif
+
+sk_sp<SkShader> SkGradientShader::MakeRadial(const SkPoint& center, SkScalar radius,
+ const SkColor4f colors[],
+ sk_sp<SkColorSpace> colorSpace,
+ const SkScalar pos[], int colorCount,
+ SkTileMode mode,
+ uint32_t flags,
+ const SkMatrix* localMatrix) {
+ if (radius < 0) {
+ return nullptr;
+ }
+ if (!SkGradientShaderBase::ValidGradient(colors, pos, colorCount, mode)) {
+ return nullptr;
+ }
+ if (1 == colorCount) {
+ return SkShaders::Color(colors[0], std::move(colorSpace));
+ }
+ if (localMatrix && !localMatrix->invert(nullptr)) {
+ return nullptr;
+ }
+
+ if (SkScalarNearlyZero(radius, SkGradientShaderBase::kDegenerateThreshold)) {
+ // Degenerate gradient optimization, and no special logic needed for clamped radial gradient
+ return SkGradientShaderBase::MakeDegenerateGradient(colors, pos, colorCount,
+ std::move(colorSpace), mode);
+ }
+
+ SkGradientShaderBase::ColorStopOptimizer opt(colors, pos, colorCount, mode);
+
+ SkGradientShaderBase::Descriptor desc(opt.fColors, std::move(colorSpace), opt.fPos,
+ opt.fCount, mode, flags, localMatrix);
+ return sk_make_sp<SkRadialGradient>(center, radius, desc);
+}
+
+void SkRegisterRadialGradientShaderFlattenable() {
+ SK_REGISTER_FLATTENABLE(SkRadialGradient);
+}
diff --git a/chromium/third_party/skia/src/shaders/gradients/SkRadialGradient.h b/chromium/third_party/skia/src/shaders/gradients/SkRadialGradient.h
deleted file mode 100644
index 50e469d212c..00000000000
--- a/chromium/third_party/skia/src/shaders/gradients/SkRadialGradient.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkRadialGradient_DEFINED
-#define SkRadialGradient_DEFINED
-
-#include "src/shaders/gradients/SkGradientShaderPriv.h"
-
-class SkShaderCodeDictionary;
-
-class SkRadialGradient final : public SkGradientShaderBase {
-public:
- SkRadialGradient(const SkPoint& center, SkScalar radius, const Descriptor&);
-
- GradientType asAGradient(GradientInfo* info) const override;
-#if SK_SUPPORT_GPU
- std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
-#endif
-#ifdef SK_ENABLE_SKSL
- void addToKey(const SkKeyContext&,
- SkPaintParamsKeyBuilder*,
- SkPipelineDataGatherer*) const override;
-#endif
-protected:
- SkRadialGradient(SkReadBuffer& buffer);
- void flatten(SkWriteBuffer& buffer) const override;
-
- void appendGradientStages(SkArenaAlloc* alloc, SkRasterPipeline* tPipeline,
- SkRasterPipeline* postPipeline) const override;
-
- skvm::F32 transformT(skvm::Builder*, skvm::Uniforms*,
- skvm::Coord coord, skvm::I32* mask) const final;
-
-private:
- SK_FLATTENABLE_HOOKS(SkRadialGradient)
-
- const SkPoint fCenter;
- const SkScalar fRadius;
-
- friend class SkGradientShader;
- using INHERITED = SkGradientShaderBase;
-};
-
-#endif
diff --git a/chromium/third_party/skia/src/shaders/gradients/SkSweepGradient.cpp b/chromium/third_party/skia/src/shaders/gradients/SkSweepGradient.cpp
index 7358afb1019..818a82f4747 100644
--- a/chromium/third_party/skia/src/shaders/gradients/SkSweepGradient.cpp
+++ b/chromium/third_party/skia/src/shaders/gradients/SkSweepGradient.cpp
@@ -5,8 +5,6 @@
* found in the LICENSE file.
*/
-#include "src/shaders/gradients/SkSweepGradient.h"
-
#include "include/private/SkFloatingPoint.h"
#include "src/core/SkRasterPipeline.h"
#include "src/core/SkReadBuffer.h"
@@ -17,6 +15,40 @@
#include "src/core/SkPaintParamsKey.h"
#endif
+#include "src/shaders/gradients/SkGradientShaderBase.h"
+
+class SkSweepGradient final : public SkGradientShaderBase {
+public:
+ SkSweepGradient(const SkPoint& center, SkScalar t0, SkScalar t1, const Descriptor&);
+
+ GradientType asAGradient(GradientInfo* info) const override;
+
+#if SK_SUPPORT_GPU
+ std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
+#endif
+#ifdef SK_ENABLE_SKSL
+ void addToKey(const SkKeyContext&,
+ SkPaintParamsKeyBuilder*,
+ SkPipelineDataGatherer*) const override;
+#endif
+
+protected:
+ void flatten(SkWriteBuffer& buffer) const override;
+
+ void appendGradientStages(SkArenaAlloc* alloc, SkRasterPipeline* tPipeline,
+ SkRasterPipeline* postPipeline) const override;
+
+ skvm::F32 transformT(skvm::Builder*, skvm::Uniforms*,
+ skvm::Coord coord, skvm::I32* mask) const final;
+private:
+ friend void ::SkRegisterSweepGradientShaderFlattenable();
+ SK_FLATTENABLE_HOOKS(SkSweepGradient)
+
+ const SkPoint fCenter;
+ const SkScalar fTBias;
+ const SkScalar fTScale;
+};
+
SkSweepGradient::SkSweepGradient(const SkPoint& center, SkScalar t0, SkScalar t1,
const Descriptor& desc)
: SkGradientShaderBase(desc, SkMatrix::Translate(-center.x(), -center.y()))
@@ -57,7 +89,7 @@ sk_sp<SkFlattenable> SkSweepGradient::CreateProc(SkReadBuffer& buffer) {
}
void SkSweepGradient::flatten(SkWriteBuffer& buffer) const {
- this->INHERITED::flatten(buffer);
+ this->SkGradientShaderBase::flatten(buffer);
buffer.writePoint(fCenter);
buffer.writeScalar(fTBias);
buffer.writeScalar(fTScale);
@@ -102,11 +134,43 @@ skvm::F32 SkSweepGradient::transformT(skvm::Builder* p, skvm::Uniforms* uniforms
#if SK_SUPPORT_GPU
+#include "src/core/SkRuntimeEffectPriv.h"
+#include "src/gpu/ganesh/GrRecordingContextPriv.h"
+#include "src/gpu/ganesh/effects/GrSkSLFP.h"
#include "src/gpu/ganesh/gradients/GrGradientShader.h"
std::unique_ptr<GrFragmentProcessor> SkSweepGradient::asFragmentProcessor(
const GrFPArgs& args) const {
- return GrGradientShader::MakeSweep(*this, args);
+ // On some devices they incorrectly implement atan2(y,x) as atan(y/x). In actuality it is
+ // atan2(y,x) = 2 * atan(y / (sqrt(x^2 + y^2) + x)). So to work around this we pass in (sqrt(x^2
+ // + y^2) + x) as the second parameter to atan2 in these cases. We let the device handle the
+ // undefined behavior of the second paramenter being 0 instead of doing the divide ourselves and
+ // using atan instead.
+ int useAtanWorkaround =
+ args.fContext->priv().caps()->shaderCaps()->fAtan2ImplementedAsAtanYOverX;
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
+ uniform half bias;
+ uniform half scale;
+ uniform int useAtanWorkaround; // specialized
+
+ half4 main(float2 coord) {
+ half angle = bool(useAtanWorkaround)
+ ? half(2 * atan(-coord.y, length(coord) - coord.x))
+ : half(atan(-coord.y, -coord.x));
+
+ // 0.1591549430918 is 1/(2*pi), used since atan returns values [-pi, pi]
+ half t = (angle * 0.1591549430918 + 0.5 + bias) * scale;
+ return half4(t, 1, 0, 0); // y = 1 for always valid
+ }
+ )");
+
+ // The sweep gradient never rejects a pixel so it doesn't change opacity
+ auto fp = GrSkSLFP::Make(effect, "SweepLayout", /*inputFP=*/nullptr,
+ GrSkSLFP::OptFlags::kPreservesOpaqueInput,
+ "bias", fTBias,
+ "scale", fTScale,
+ "useAtanWorkaround", GrSkSLFP::Specialize(useAtanWorkaround));
+ return GrGradientShader::MakeGradientFP(*this, args, std::move(fp));
}
#endif
@@ -129,3 +193,63 @@ void SkSweepGradient::addToKey(const SkKeyContext& keyContext,
builder->endBlock();
}
#endif
+
+sk_sp<SkShader> SkGradientShader::MakeSweep(SkScalar cx, SkScalar cy,
+ const SkColor4f colors[],
+ sk_sp<SkColorSpace> colorSpace,
+ const SkScalar pos[],
+ int colorCount,
+ SkTileMode mode,
+ SkScalar startAngle,
+ SkScalar endAngle,
+ uint32_t flags,
+ const SkMatrix* localMatrix) {
+ if (!SkGradientShaderBase::ValidGradient(colors, pos, colorCount, mode)) {
+ return nullptr;
+ }
+ if (1 == colorCount) {
+ return SkShaders::Color(colors[0], std::move(colorSpace));
+ }
+ if (!SkScalarIsFinite(startAngle) || !SkScalarIsFinite(endAngle) || startAngle > endAngle) {
+ return nullptr;
+ }
+ if (localMatrix && !localMatrix->invert(nullptr)) {
+ return nullptr;
+ }
+
+ if (SkScalarNearlyEqual(startAngle, endAngle, SkGradientShaderBase::kDegenerateThreshold)) {
+ // Degenerate gradient, which should follow default degenerate behavior unless it is
+ // clamped and the angle is greater than 0.
+ if (mode == SkTileMode::kClamp && endAngle > SkGradientShaderBase::kDegenerateThreshold) {
+ // In this case, the first color is repeated from 0 to the angle, then a hardstop
+ // switches to the last color (all other colors are compressed to the infinitely thin
+ // interpolation region).
+ static constexpr SkScalar clampPos[3] = {0, 1, 1};
+ SkColor4f reColors[3] = {colors[0], colors[0], colors[colorCount - 1]};
+ return MakeSweep(cx, cy, reColors, std::move(colorSpace), clampPos, 3, mode, 0,
+ endAngle, flags, localMatrix);
+ } else {
+ return SkGradientShaderBase::MakeDegenerateGradient(colors, pos, colorCount,
+ std::move(colorSpace), mode);
+ }
+ }
+
+ if (startAngle <= 0 && endAngle >= 360) {
+ // If the t-range includes [0,1], then we can always use clamping (presumably faster).
+ mode = SkTileMode::kClamp;
+ }
+
+ SkGradientShaderBase::ColorStopOptimizer opt(colors, pos, colorCount, mode);
+
+ SkGradientShaderBase::Descriptor desc(opt.fColors, std::move(colorSpace), opt.fPos,
+ opt.fCount, mode, flags, localMatrix);
+
+ const SkScalar t0 = startAngle / 360,
+ t1 = endAngle / 360;
+
+ return sk_make_sp<SkSweepGradient>(SkPoint::Make(cx, cy), t0, t1, desc);
+}
+
+void SkRegisterSweepGradientShaderFlattenable() {
+ SK_REGISTER_FLATTENABLE(SkSweepGradient);
+}
diff --git a/chromium/third_party/skia/src/shaders/gradients/SkSweepGradient.h b/chromium/third_party/skia/src/shaders/gradients/SkSweepGradient.h
deleted file mode 100644
index 93490cfb4ea..00000000000
--- a/chromium/third_party/skia/src/shaders/gradients/SkSweepGradient.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkSweepGradient_DEFINED
-#define SkSweepGradient_DEFINED
-
-#include "src/shaders/gradients/SkGradientShaderPriv.h"
-
-class SkShaderCodeDictionary;
-
-class SkSweepGradient final : public SkGradientShaderBase {
-public:
- SkSweepGradient(const SkPoint& center, SkScalar t0, SkScalar t1, const Descriptor&);
-
- GradientType asAGradient(GradientInfo* info) const override;
-
-#if SK_SUPPORT_GPU
- std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
-#endif
-#ifdef SK_ENABLE_SKSL
- void addToKey(const SkKeyContext&,
- SkPaintParamsKeyBuilder*,
- SkPipelineDataGatherer*) const override;
-#endif
-
- SkScalar getTBias() const { return fTBias; }
-
- SkScalar getTScale() const { return fTScale; }
-
-protected:
- void flatten(SkWriteBuffer& buffer) const override;
-
- void appendGradientStages(SkArenaAlloc* alloc, SkRasterPipeline* tPipeline,
- SkRasterPipeline* postPipeline) const override;
-
- skvm::F32 transformT(skvm::Builder*, skvm::Uniforms*,
- skvm::Coord coord, skvm::I32* mask) const final;
-private:
- SK_FLATTENABLE_HOOKS(SkSweepGradient)
-
- const SkPoint fCenter;
- const SkScalar fTBias,
- fTScale;
-
- friend class SkGradientShader;
- using INHERITED = SkGradientShaderBase;
-};
-
-#endif
diff --git a/chromium/third_party/skia/src/shaders/gradients/SkTwoPointConicalGradient.cpp b/chromium/third_party/skia/src/shaders/gradients/SkTwoPointConicalGradient.cpp
index f46382afa11..d027f1ff6e0 100644
--- a/chromium/third_party/skia/src/shaders/gradients/SkTwoPointConicalGradient.cpp
+++ b/chromium/third_party/skia/src/shaders/gradients/SkTwoPointConicalGradient.cpp
@@ -5,12 +5,11 @@
* found in the LICENSE file.
*/
-#include "src/shaders/gradients/SkTwoPointConicalGradient.h"
-
#include "include/private/SkFloatingPoint.h"
#include "src/core/SkRasterPipeline.h"
#include "src/core/SkReadBuffer.h"
#include "src/core/SkWriteBuffer.h"
+#include "src/shaders/gradients/SkGradientShaderBase.h"
#include <utility>
@@ -21,6 +20,90 @@
// Please see https://skia.org/dev/design/conical for how our shader works.
+class SkTwoPointConicalGradient final : public SkGradientShaderBase {
+public:
+ // See https://skia.org/dev/design/conical for what focal data means and how our shader works.
+ // We make it public so the GPU shader can also use it.
+ struct FocalData {
+ SkScalar fR1; // r1 after mapping focal point to (0, 0)
+ SkScalar fFocalX; // f
+ bool fIsSwapped; // whether we swapped r0, r1
+
+ // The input r0, r1 are the radii when we map centers to {(0, 0), (1, 0)}.
+ // We'll post concat matrix with our transformation matrix that maps focal point to (0, 0).
+ // Returns true if the set succeeded
+ bool set(SkScalar r0, SkScalar r1, SkMatrix* matrix);
+
+ // Whether the focal point (0, 0) is on the end circle with center (1, 0) and radius r1. If
+ // this is true, it's as if an aircraft is flying at Mach 1 and all circles (soundwaves)
+ // will go through the focal point (aircraft). In our previous implementations, this was
+ // known as the edge case where the inside circle touches the outside circle (on the focal
+ // point). If we were to solve for t bruteforcely using a quadratic equation, this case
+ // implies that the quadratic equation degenerates to a linear equation.
+ bool isFocalOnCircle() const { return SkScalarNearlyZero(1 - fR1); }
+
+ bool isSwapped() const { return fIsSwapped; }
+ bool isWellBehaved() const { return !this->isFocalOnCircle() && fR1 > 1; }
+ bool isNativelyFocal() const { return SkScalarNearlyZero(fFocalX); }
+ };
+
+ enum class Type {
+ kRadial,
+ kStrip,
+ kFocal
+ };
+
+ static sk_sp<SkShader> Create(const SkPoint& start, SkScalar startRadius,
+ const SkPoint& end, SkScalar endRadius,
+ const Descriptor&);
+
+ SkShader::GradientType asAGradient(GradientInfo* info) const override;
+#if SK_SUPPORT_GPU
+ std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
+#endif
+#ifdef SK_ENABLE_SKSL
+ void addToKey(const SkKeyContext&,
+ SkPaintParamsKeyBuilder*,
+ SkPipelineDataGatherer*) const override;
+#endif
+ bool isOpaque() const override;
+
+ SkScalar getCenterX1() const { return SkPoint::Distance(fCenter1, fCenter2); }
+ SkScalar getStartRadius() const { return fRadius1; }
+ SkScalar getDiffRadius() const { return fRadius2 - fRadius1; }
+ const SkPoint& getStartCenter() const { return fCenter1; }
+ const SkPoint& getEndCenter() const { return fCenter2; }
+ SkScalar getEndRadius() const { return fRadius2; }
+
+ Type getType() const { return fType; }
+ const FocalData& getFocalData() const { return fFocalData; }
+
+protected:
+ void flatten(SkWriteBuffer& buffer) const override;
+
+ void appendGradientStages(SkArenaAlloc* alloc, SkRasterPipeline* tPipeline,
+ SkRasterPipeline* postPipeline) const override;
+
+ skvm::F32 transformT(skvm::Builder*, skvm::Uniforms*,
+ skvm::Coord coord, skvm::I32* mask) const final;
+
+private:
+ friend void ::SkRegisterTwoPointConicalGradientShaderFlattenable();
+ SK_FLATTENABLE_HOOKS(SkTwoPointConicalGradient)
+
+ SkTwoPointConicalGradient(const SkPoint& c0, SkScalar r0,
+ const SkPoint& c1, SkScalar r1,
+ const Descriptor&, Type, const SkMatrix&, const FocalData&);
+
+ SkPoint fCenter1;
+ SkPoint fCenter2;
+ SkScalar fRadius1;
+ SkScalar fRadius2;
+ Type fType;
+
+ FocalData fFocalData;
+};
+
bool SkTwoPointConicalGradient::FocalData::set(SkScalar r0, SkScalar r1, SkMatrix* matrix) {
fIsSwapped = false;
fFocalX = sk_ieee_float_divide(r0, (r0 - r1));
@@ -152,7 +235,7 @@ sk_sp<SkFlattenable> SkTwoPointConicalGradient::CreateProc(SkReadBuffer& buffer)
}
void SkTwoPointConicalGradient::flatten(SkWriteBuffer& buffer) const {
- this->INHERITED::flatten(buffer);
+ this->SkGradientShaderBase::flatten(buffer);
buffer.writePoint(fCenter1);
buffer.writePoint(fCenter2);
buffer.writeScalar(fRadius1);
@@ -272,11 +355,160 @@ skvm::F32 SkTwoPointConicalGradient::transformT(skvm::Builder* p, skvm::Uniforms
#if SK_SUPPORT_GPU
+#include "src/core/SkRuntimeEffectPriv.h"
+#include "src/gpu/ganesh/effects/GrSkSLFP.h"
#include "src/gpu/ganesh/gradients/GrGradientShader.h"
std::unique_ptr<GrFragmentProcessor> SkTwoPointConicalGradient::asFragmentProcessor(
const GrFPArgs& args) const {
- return GrGradientShader::MakeConical(*this, args);
+ // The 2 point conical gradient can reject a pixel so it does change opacity even if the input
+ // was opaque. Thus, all of these layout FPs disable that optimization.
+ std::unique_ptr<GrFragmentProcessor> fp;
+ SkTLazy<SkMatrix> matrix;
+ switch (this->getType()) {
+ case SkTwoPointConicalGradient::Type::kStrip: {
+ static const SkRuntimeEffect* kEffect =
+ SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
+ uniform half r0_2;
+ half4 main(float2 p) {
+ half v = 1; // validation flag,set to negative to discard fragment later
+ float t = r0_2 - p.y * p.y;
+ if (t >= 0) {
+ t = p.x + sqrt(t);
+ } else {
+ v = -1;
+ }
+ return half4(half(t), v, 0, 0);
+ }
+ )");
+ float r0 = this->getStartRadius() / this->getCenterX1();
+ fp = GrSkSLFP::Make(kEffect, "TwoPointConicalStripLayout", /*inputFP=*/nullptr,
+ GrSkSLFP::OptFlags::kNone,
+ "r0_2", r0 * r0);
+ } break;
+
+ case SkTwoPointConicalGradient::Type::kRadial: {
+ static const SkRuntimeEffect* kEffect =
+ SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
+ uniform half r0;
+ uniform half lengthScale;
+ half4 main(float2 p) {
+ half v = 1; // validation flag,set to negative to discard fragment later
+ float t = length(p) * lengthScale - r0;
+ return half4(half(t), v, 0, 0);
+ }
+ )");
+ float dr = this->getDiffRadius();
+ float r0 = this->getStartRadius() / dr;
+ bool isRadiusIncreasing = dr >= 0;
+ fp = GrSkSLFP::Make(kEffect, "TwoPointConicalRadialLayout", /*inputFP=*/nullptr,
+ GrSkSLFP::OptFlags::kNone,
+ "r0", r0,
+ "lengthScale", isRadiusIncreasing ? 1.0f : -1.0f);
+
+ // GPU radial matrix is different from the original matrix, since we map the diff radius
+ // to have |dr| = 1, so manually compute the final gradient matrix here.
+
+ // Map center to (0, 0)
+ matrix.set(SkMatrix::Translate(-this->getStartCenter().fX,
+ -this->getStartCenter().fY));
+ // scale |diffRadius| to 1
+ matrix->postScale(1 / dr, 1 / dr);
+ } break;
+
+ case SkTwoPointConicalGradient::Type::kFocal: {
+ static const SkRuntimeEffect* kEffect =
+ SkMakeRuntimeEffect(SkRuntimeEffect::MakeForShader, R"(
+ // Optimization flags, all specialized:
+ uniform int isRadiusIncreasing;
+ uniform int isFocalOnCircle;
+ uniform int isWellBehaved;
+ uniform int isSwapped;
+ uniform int isNativelyFocal;
+
+ uniform half invR1; // 1/r1
+ uniform half fx; // focalX = r0/(r0-r1)
+
+ half4 main(float2 p) {
+ float t = -1;
+ half v = 1; // validation flag,set to negative to discard fragment later
+
+ float x_t = -1;
+ if (bool(isFocalOnCircle)) {
+ x_t = dot(p, p) / p.x;
+ } else if (bool(isWellBehaved)) {
+ x_t = length(p) - p.x * invR1;
+ } else {
+ float temp = p.x * p.x - p.y * p.y;
+
+ // Only do sqrt if temp >= 0; this is significantly slower than
+ // checking temp >= 0 in the if statement that checks r(t) >= 0.
+ // But GPU may break if we sqrt a negative float. (Although I
+ // haven't observed that on any devices so far, and the old
+ // approach also does sqrt negative value without a check.) If
+ // the performance is really critical, maybe we should just
+ // compute the area where temp and x_t are always valid and drop
+ // all these ifs.
+ if (temp >= 0) {
+ if (bool(isSwapped) || !bool(isRadiusIncreasing)) {
+ x_t = -sqrt(temp) - p.x * invR1;
+ } else {
+ x_t = sqrt(temp) - p.x * invR1;
+ }
+ }
+ }
+
+ // The final calculation of t from x_t has lots of static
+ // optimizations but only do them when x_t is positive (which
+ // can be assumed true if isWellBehaved is true)
+ if (!bool(isWellBehaved)) {
+ // This will still calculate t even though it will be ignored
+ // later in the pipeline to avoid a branch
+ if (x_t <= 0.0) {
+ v = -1;
+ }
+ }
+ if (bool(isRadiusIncreasing)) {
+ if (bool(isNativelyFocal)) {
+ t = x_t;
+ } else {
+ t = x_t + fx;
+ }
+ } else {
+ if (bool(isNativelyFocal)) {
+ t = -x_t;
+ } else {
+ t = -x_t + fx;
+ }
+ }
+
+ if (bool(isSwapped)) {
+ t = 1 - t;
+ }
+
+ return half4(half(t), v, 0, 0);
+ }
+ )");
+
+ const SkTwoPointConicalGradient::FocalData& focalData = this->getFocalData();
+ bool isRadiusIncreasing = (1 - focalData.fFocalX) > 0,
+ isFocalOnCircle = focalData.isFocalOnCircle(),
+ isWellBehaved = focalData.isWellBehaved(),
+ isSwapped = focalData.isSwapped(),
+ isNativelyFocal = focalData.isNativelyFocal();
+
+ fp = GrSkSLFP::Make(kEffect, "TwoPointConicalFocalLayout", /*inputFP=*/nullptr,
+ GrSkSLFP::OptFlags::kNone,
+ "isRadiusIncreasing", GrSkSLFP::Specialize<int>(isRadiusIncreasing),
+ "isFocalOnCircle", GrSkSLFP::Specialize<int>(isFocalOnCircle),
+ "isWellBehaved", GrSkSLFP::Specialize<int>(isWellBehaved),
+ "isSwapped", GrSkSLFP::Specialize<int>(isSwapped),
+ "isNativelyFocal", GrSkSLFP::Specialize<int>(isNativelyFocal),
+ "invR1", 1.0f / focalData.fR1,
+ "fx", focalData.fFocalX);
+ } break;
+ }
+ return GrGradientShader::MakeGradientFP(*this, args, std::move(fp), matrix.getMaybeNull());
}
#endif
@@ -299,3 +531,83 @@ void SkTwoPointConicalGradient::addToKey(const SkKeyContext& keyContext,
builder->endBlock();
}
#endif
+
+// assumes colors is SkColor4f* and pos is SkScalar*
+#define EXPAND_1_COLOR(count) \
+ SkColor4f tmp[2]; \
+ do { \
+ if (1 == count) { \
+ tmp[0] = tmp[1] = colors[0]; \
+ colors = tmp; \
+ pos = nullptr; \
+ count = 2; \
+ } \
+ } while (0)
+
+sk_sp<SkShader> SkGradientShader::MakeTwoPointConical(const SkPoint& start,
+ SkScalar startRadius,
+ const SkPoint& end,
+ SkScalar endRadius,
+ const SkColor4f colors[],
+ sk_sp<SkColorSpace> colorSpace,
+ const SkScalar pos[],
+ int colorCount,
+ SkTileMode mode,
+ uint32_t flags,
+ const SkMatrix* localMatrix) {
+ if (startRadius < 0 || endRadius < 0) {
+ return nullptr;
+ }
+ if (!SkGradientShaderBase::ValidGradient(colors, pos, colorCount, mode)) {
+ return nullptr;
+ }
+ if (SkScalarNearlyZero((start - end).length(), SkGradientShaderBase::kDegenerateThreshold)) {
+ // If the center positions are the same, then the gradient is the radial variant of a 2 pt
+ // conical gradient, an actual radial gradient (startRadius == 0), or it is fully degenerate
+ // (startRadius == endRadius).
+ if (SkScalarNearlyEqual(startRadius, endRadius,
+ SkGradientShaderBase::kDegenerateThreshold)) {
+ // Degenerate case, where the interpolation region area approaches zero. The proper
+ // behavior depends on the tile mode, which is consistent with the default degenerate
+ // gradient behavior, except when mode = clamp and the radii > 0.
+ if (mode == SkTileMode::kClamp &&
+ endRadius > SkGradientShaderBase::kDegenerateThreshold) {
+ // The interpolation region becomes an infinitely thin ring at the radius, so the
+ // final gradient will be the first color repeated from p=0 to 1, and then a hard
+ // stop switching to the last color at p=1.
+ static constexpr SkScalar circlePos[3] = {0, 1, 1};
+ SkColor4f reColors[3] = {colors[0], colors[0], colors[colorCount - 1]};
+ return MakeRadial(start, endRadius, reColors, std::move(colorSpace),
+ circlePos, 3, mode, flags, localMatrix);
+ } else {
+ // Otherwise use the default degenerate case
+ return SkGradientShaderBase::MakeDegenerateGradient(colors, pos, colorCount,
+ std::move(colorSpace), mode);
+ }
+ } else if (SkScalarNearlyZero(startRadius, SkGradientShaderBase::kDegenerateThreshold)) {
+ // We can treat this gradient as radial, which is faster. If we got here, we know
+ // that endRadius is not equal to 0, so this produces a meaningful gradient
+ return MakeRadial(start, endRadius, colors, std::move(colorSpace), pos, colorCount,
+ mode, flags, localMatrix);
+ }
+ // Else it's the 2pt conical radial variant with no degenerate radii, so fall through to the
+ // regular 2pt constructor.
+ }
+
+ if (localMatrix && !localMatrix->invert(nullptr)) {
+ return nullptr;
+ }
+ EXPAND_1_COLOR(colorCount);
+
+ SkGradientShaderBase::ColorStopOptimizer opt(colors, pos, colorCount, mode);
+
+ SkGradientShaderBase::Descriptor desc(opt.fColors, std::move(colorSpace), opt.fPos,
+ opt.fCount, mode, flags, localMatrix);
+ return SkTwoPointConicalGradient::Create(start, startRadius, end, endRadius, desc);
+}
+
+#undef EXPAND_1_COLOR
+
+void SkRegisterTwoPointConicalGradientShaderFlattenable() {
+ SK_REGISTER_FLATTENABLE(SkTwoPointConicalGradient);
+}
diff --git a/chromium/third_party/skia/src/shaders/gradients/SkTwoPointConicalGradient.h b/chromium/third_party/skia/src/shaders/gradients/SkTwoPointConicalGradient.h
deleted file mode 100644
index 44bc37f5588..00000000000
--- a/chromium/third_party/skia/src/shaders/gradients/SkTwoPointConicalGradient.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkTwoPointConicalGradient_DEFINED
-#define SkTwoPointConicalGradient_DEFINED
-
-#include "src/shaders/gradients/SkGradientShaderPriv.h"
-
-class SkShaderCodeDictionary;
-
-class SkTwoPointConicalGradient final : public SkGradientShaderBase {
-public:
- // See https://skia.org/dev/design/conical for what focal data means and how our shader works.
- // We make it public so the GPU shader can also use it.
- struct FocalData {
- SkScalar fR1; // r1 after mapping focal point to (0, 0)
- SkScalar fFocalX; // f
- bool fIsSwapped; // whether we swapped r0, r1
-
- // The input r0, r1 are the radii when we map centers to {(0, 0), (1, 0)}.
- // We'll post concat matrix with our transformation matrix that maps focal point to (0, 0).
- // Returns true if the set succeeded
- bool set(SkScalar r0, SkScalar r1, SkMatrix* matrix);
-
- // Whether the focal point (0, 0) is on the end circle with center (1, 0) and radius r1. If
- // this is true, it's as if an aircraft is flying at Mach 1 and all circles (soundwaves)
- // will go through the focal point (aircraft). In our previous implementations, this was
- // known as the edge case where the inside circle touches the outside circle (on the focal
- // point). If we were to solve for t bruteforcely using a quadratic equation, this case
- // implies that the quadratic equation degenerates to a linear equation.
- bool isFocalOnCircle() const { return SkScalarNearlyZero(1 - fR1); }
-
- bool isSwapped() const { return fIsSwapped; }
- bool isWellBehaved() const { return !this->isFocalOnCircle() && fR1 > 1; }
- bool isNativelyFocal() const { return SkScalarNearlyZero(fFocalX); }
- };
-
- enum class Type {
- kRadial,
- kStrip,
- kFocal
- };
-
- static sk_sp<SkShader> Create(const SkPoint& start, SkScalar startRadius,
- const SkPoint& end, SkScalar endRadius,
- const Descriptor&);
-
- SkShader::GradientType asAGradient(GradientInfo* info) const override;
-#if SK_SUPPORT_GPU
- std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
-#endif
-#ifdef SK_ENABLE_SKSL
- void addToKey(const SkKeyContext&,
- SkPaintParamsKeyBuilder*,
- SkPipelineDataGatherer*) const override;
-#endif
- bool isOpaque() const override;
-
- SkScalar getCenterX1() const { return SkPoint::Distance(fCenter1, fCenter2); }
- SkScalar getStartRadius() const { return fRadius1; }
- SkScalar getDiffRadius() const { return fRadius2 - fRadius1; }
- const SkPoint& getStartCenter() const { return fCenter1; }
- const SkPoint& getEndCenter() const { return fCenter2; }
- SkScalar getEndRadius() const { return fRadius2; }
-
- Type getType() const { return fType; }
- const FocalData& getFocalData() const { return fFocalData; }
-
-protected:
- void flatten(SkWriteBuffer& buffer) const override;
-
- void appendGradientStages(SkArenaAlloc* alloc, SkRasterPipeline* tPipeline,
- SkRasterPipeline* postPipeline) const override;
-
- skvm::F32 transformT(skvm::Builder*, skvm::Uniforms*,
- skvm::Coord coord, skvm::I32* mask) const final;
-
-private:
- SK_FLATTENABLE_HOOKS(SkTwoPointConicalGradient)
-
- SkTwoPointConicalGradient(const SkPoint& c0, SkScalar r0,
- const SkPoint& c1, SkScalar r1,
- const Descriptor&, Type, const SkMatrix&, const FocalData&);
-
- SkPoint fCenter1;
- SkPoint fCenter2;
- SkScalar fRadius1;
- SkScalar fRadius2;
- Type fType;
-
- FocalData fFocalData;
-
- friend class SkGradientShader;
- using INHERITED = SkGradientShaderBase;
-};
-
-#endif
diff --git a/chromium/third_party/skia/src/sksl/BUILD.bazel b/chromium/third_party/skia/src/sksl/BUILD.bazel
index e99a5a56980..324c2b2ae22 100644
--- a/chromium/third_party/skia/src/sksl/BUILD.bazel
+++ b/chromium/third_party/skia/src/sksl/BUILD.bazel
@@ -1,4 +1,4 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy", "selects", "split_srcs_and_hdrs")
+load("//bazel:macros.bzl", "bool_flag", "exports_files_legacy", "selects", "skia_cc_deps", "split_srcs_and_hdrs")
licenses(["notice"])
@@ -7,12 +7,14 @@ exports_files_legacy()
filegroup(
name = "txts",
srcs = [
+ "generated/sksl_compute.dehydrated.sksl",
"generated/sksl_frag.dehydrated.sksl",
"generated/sksl_gpu.dehydrated.sksl",
"generated/sksl_graphite_frag.dehydrated.sksl",
"generated/sksl_graphite_vert.dehydrated.sksl",
"generated/sksl_public.dehydrated.sksl",
"generated/sksl_rt_shader.dehydrated.sksl",
+ "generated/sksl_shared.dehydrated.sksl",
"generated/sksl_vert.dehydrated.sksl",
],
visibility = ["//:__subpackages__"],
@@ -76,11 +78,36 @@ split_srcs_and_hdrs(
)
selects.config_setting_group(
+ name = "needs_sksl",
+ match_any = [
+ "//src/gpu:has_gpu_backend",
+ ":enable_sksl_true",
+ ],
+ visibility = ["//:__subpackages__"],
+)
+
+selects.config_setting_group(
name = "use_sksl_gpu_srcs",
match_any = [
- "//bazel/common_config_settings:has_gpu_backend",
- "//bazel/common_config_settings:enable_skslc_true",
+ "//src/gpu:has_gpu_backend",
+ ":enable_skslc_true",
],
+ visibility = ["//:__subpackages__"],
+)
+
+bool_flag(
+ default = False,
+ flag_name = "enable_sksl",
+)
+
+bool_flag(
+ default = False,
+ flag_name = "enable_skslc",
+)
+
+bool_flag(
+ default = False,
+ flag_name = "enable_sksl_tracing",
)
filegroup(
@@ -116,7 +143,7 @@ filegroup(
visibility = ["//src:__pkg__"],
)
-cc_library(
+skia_cc_deps(
name = "deps",
textual_hdrs = [
":txts",
@@ -125,7 +152,7 @@ cc_library(
deps = [
"//src/sksl/codegen:deps",
] + select({
- "//bazel/common_config_settings:enable_skslc_true": [
+ "//src/sksl:enable_skslc_true": [
"@spirv_tools",
"@dawn//:tint",
],
diff --git a/chromium/third_party/skia/src/sksl/SkSLAnalysis.cpp b/chromium/third_party/skia/src/sksl/SkSLAnalysis.cpp
index 185a1a34897..73cf649fead 100644
--- a/chromium/third_party/skia/src/sksl/SkSLAnalysis.cpp
+++ b/chromium/third_party/skia/src/sksl/SkSLAnalysis.cpp
@@ -23,6 +23,7 @@
#include "src/sksl/SkSLConstantFolder.h"
#include "src/sksl/SkSLContext.h"
#include "src/sksl/analysis/SkSLNoOpErrorReporter.h"
+#include "src/sksl/analysis/SkSLProgramUsage.h"
#include "src/sksl/analysis/SkSLProgramVisitor.h"
#include "src/sksl/ir/SkSLBinaryExpression.h"
#include "src/sksl/ir/SkSLBlock.h"
diff --git a/chromium/third_party/skia/src/sksl/SkSLAnalysis.h b/chromium/third_party/skia/src/sksl/SkSLAnalysis.h
index a9927e56908..9becac57377 100644
--- a/chromium/third_party/skia/src/sksl/SkSLAnalysis.h
+++ b/chromium/third_party/skia/src/sksl/SkSLAnalysis.h
@@ -9,13 +9,15 @@
#define SkSLAnalysis_DEFINED
#include "include/private/SkSLSampleUsage.h"
+#include "include/private/SkTArray.h"
-#include <stdint.h>
+#include <cstdint>
#include <memory>
#include <set>
namespace SkSL {
+class Context;
class ErrorReporter;
class Expression;
class FunctionDeclaration;
@@ -188,6 +190,13 @@ bool CanExitWithoutReturningValue(const FunctionDeclaration& funcDecl, const Sta
*/
void DoFinalizationChecks(const Program& program);
+/**
+ * Error checks compute shader in/outs and returns a vector containing them ordered by location.
+ */
+SkTArray<const SkSL::Variable*> GetComputeShaderMainParams(const Context& context,
+ const Program& program);
+
+
} // namespace Analysis
} // namespace SkSL
diff --git a/chromium/third_party/skia/src/sksl/SkSLBuiltinTypes.cpp b/chromium/third_party/skia/src/sksl/SkSLBuiltinTypes.cpp
index 31ad14fdc0b..3d7f0e468f1 100644
--- a/chromium/third_party/skia/src/sksl/SkSLBuiltinTypes.cpp
+++ b/chromium/third_party/skia/src/sksl/SkSLBuiltinTypes.cpp
@@ -95,24 +95,12 @@ BuiltinTypes::BuiltinTypes()
, fMat4x2(Type::MakeAliasType("mat4x2", *fFloat4x2))
, fMat4x3(Type::MakeAliasType("mat4x3", *fFloat4x3))
, fMat4x4(Type::MakeAliasType("mat4x4", *fFloat4x4))
- , fTexture1D(Type::MakeTextureType("texture1D",
- SpvDim1D,
- /*isDepth=*/false,
- /*isArrayedTexture=*/false,
- /*isMultisampled=*/false,
- /*isSampled=*/true))
, fTexture2D(Type::MakeTextureType("texture2D",
SpvDim2D,
/*isDepth=*/false,
/*isArrayedTexture=*/false,
/*isMultisampled=*/false,
/*isSampled=*/true))
- , fTexture3D(Type::MakeTextureType("texture3D",
- SpvDim3D,
- /*isDepth=*/false,
- /*isArrayedTexture=*/false,
- /*isMultisampled=*/false,
- /*isSampled=*/true))
, fTextureExternalOES(Type::MakeTextureType("textureExternalOES",
SpvDim2D,
/*isDepth=*/false,
@@ -125,20 +113,10 @@ BuiltinTypes::BuiltinTypes()
/*isArrayedTexture=*/false,
/*isMultisampled=*/false,
/*isSampled=*/true))
- , fITexture2D(Type::MakeTextureType("itexture2D",
- SpvDim2D,
- /*isDepth=*/false,
- /*isArrayedTexture=*/false,
- /*isMultisampled=*/false,
- /*isSampled=*/true))
- , fSampler1D(Type::MakeSamplerType("sampler1D", *fTexture1D))
, fSampler2D(Type::MakeSamplerType("sampler2D", *fTexture2D))
- , fSampler3D(Type::MakeSamplerType("sampler3D", *fTexture3D))
, fSamplerExternalOES(Type::MakeSamplerType("samplerExternalOES", *fTextureExternalOES))
, fSampler2DRect(Type::MakeSamplerType("sampler2DRect", *fTexture2DRect))
- , fISampler2D(Type::MakeSamplerType("isampler2D", *fITexture2D))
-
, fSampler(Type::MakeSpecialType("sampler", "ss", Type::TypeKind::kSeparateSampler))
, fSubpassInput(Type::MakeTextureType("subpassInput",
diff --git a/chromium/third_party/skia/src/sksl/SkSLBuiltinTypes.h b/chromium/third_party/skia/src/sksl/SkSLBuiltinTypes.h
index a11325712ba..cba993ae09d 100644
--- a/chromium/third_party/skia/src/sksl/SkSLBuiltinTypes.h
+++ b/chromium/third_party/skia/src/sksl/SkSLBuiltinTypes.h
@@ -108,20 +108,14 @@ public:
const std::unique_ptr<Type> fMat4x3;
const std::unique_ptr<Type> fMat4x4;
- const std::unique_ptr<Type> fTexture1D;
const std::unique_ptr<Type> fTexture2D;
- const std::unique_ptr<Type> fTexture3D;
const std::unique_ptr<Type> fTextureExternalOES;
const std::unique_ptr<Type> fTexture2DRect;
- const std::unique_ptr<Type> fITexture2D;
- const std::unique_ptr<Type> fSampler1D;
const std::unique_ptr<Type> fSampler2D;
- const std::unique_ptr<Type> fSampler3D;
const std::unique_ptr<Type> fSamplerExternalOES;
const std::unique_ptr<Type> fSampler2DRect;
- const std::unique_ptr<Type> fISampler2D;
const std::unique_ptr<Type> fSampler;
const std::unique_ptr<Type> fSubpassInput;
diff --git a/chromium/third_party/skia/src/sksl/SkSLCompiler.cpp b/chromium/third_party/skia/src/sksl/SkSLCompiler.cpp
index 47e2f491e02..5132a48fc88 100644
--- a/chromium/third_party/skia/src/sksl/SkSLCompiler.cpp
+++ b/chromium/third_party/skia/src/sksl/SkSLCompiler.cpp
@@ -7,7 +7,6 @@
#include "src/sksl/SkSLCompiler.h"
-#include "include/private/SkSLLayout.h"
#include "include/private/SkSLModifiers.h"
#include "include/private/SkSLStatement.h"
#include "include/private/SkSLSymbol.h"
@@ -24,13 +23,6 @@
#include "src/sksl/SkSLProgramSettings.h"
#include "src/sksl/SkSLRehydrator.h"
#include "src/sksl/SkSLStringStream.h"
-#include "src/sksl/SkSLThreadContext.h"
-#include "src/sksl/SkSLUtil.h"
-#include "src/sksl/codegen/SkSLGLSLCodeGenerator.h"
-#include "src/sksl/codegen/SkSLMetalCodeGenerator.h"
-#include "src/sksl/codegen/SkSLSPIRVCodeGenerator.h"
-#include "src/sksl/codegen/SkSLSPIRVtoHLSL.h"
-#include "src/sksl/codegen/SkSLWGSLCodeGenerator.h"
#include "src/sksl/ir/SkSLExpression.h"
#include "src/sksl/ir/SkSLExternalFunction.h"
#include "src/sksl/ir/SkSLExternalFunctionReference.h"
@@ -40,10 +32,10 @@
#include "src/sksl/ir/SkSLFunctionDefinition.h"
#include "src/sksl/ir/SkSLFunctionReference.h"
#include "src/sksl/ir/SkSLInterfaceBlock.h"
+#include "src/sksl/ir/SkSLProgram.h"
#include "src/sksl/ir/SkSLSymbolTable.h"
#include "src/sksl/ir/SkSLType.h"
#include "src/sksl/ir/SkSLTypeReference.h"
-#include "src/sksl/ir/SkSLUnresolvedFunction.h"
#include "src/sksl/ir/SkSLVarDeclarations.h"
#include "src/sksl/ir/SkSLVariable.h"
#include "src/sksl/ir/SkSLVariableReference.h"
@@ -55,6 +47,14 @@
#include <stdio.h>
#include <utility>
+#if defined(SKSL_STANDALONE) || SK_SUPPORT_GPU || defined(SK_GRAPHITE_ENABLED)
+#include "src/sksl/codegen/SkSLGLSLCodeGenerator.h"
+#include "src/sksl/codegen/SkSLMetalCodeGenerator.h"
+#include "src/sksl/codegen/SkSLSPIRVCodeGenerator.h"
+#include "src/sksl/codegen/SkSLSPIRVtoHLSL.h"
+#include "src/sksl/codegen/SkSLWGSLCodeGenerator.h"
+#endif
+
#ifdef SK_ENABLE_SPIRV_VALIDATION
#include "spirv-tools/libspirv.hpp"
#endif
@@ -73,13 +73,17 @@
#if REHYDRATE
// At runtime, we load the dehydrated sksl data files. The data is a (pointer, size) pair.
+#include "src/sksl/generated/sksl_shared.dehydrated.sksl"
+#include "src/sksl/generated/sksl_compute.dehydrated.sksl"
#include "src/sksl/generated/sksl_frag.dehydrated.sksl"
-#include "src/sksl/generated/sksl_graphite_frag.dehydrated.sksl"
-#include "src/sksl/generated/sksl_graphite_vert.dehydrated.sksl"
#include "src/sksl/generated/sksl_gpu.dehydrated.sksl"
#include "src/sksl/generated/sksl_public.dehydrated.sksl"
#include "src/sksl/generated/sksl_rt_shader.dehydrated.sksl"
#include "src/sksl/generated/sksl_vert.dehydrated.sksl"
+#if defined(SK_GRAPHITE_ENABLED)
+#include "src/sksl/generated/sksl_graphite_frag.dehydrated.sksl"
+#include "src/sksl/generated/sksl_graphite_vert.dehydrated.sksl"
+#endif
#define MODULE_DATA(name) MakeModuleData(SKSL_INCLUDE_sksl_##name,\
SKSL_INCLUDE_sksl_##name##_LENGTH)
@@ -94,6 +98,8 @@
namespace SkSL {
+class ProgramUsage;
+
// These flags allow tools like Viewer or Nanobench to override the compiler's ProgramSettings.
Compiler::OverrideFlag Compiler::sOptimizer = OverrideFlag::kDefault;
Compiler::OverrideFlag Compiler::sInliner = OverrideFlag::kDefault;
@@ -152,7 +158,6 @@ Compiler::Compiler(const ShaderCaps* caps)
, fInliner(fContext.get()) {
SkASSERT(caps);
fRootModule.fSymbols = this->makeRootSymbolTable();
- fPrivateModule.fSymbols = this->makePrivateSymbolTable(fRootModule.fSymbols);
}
Compiler::~Compiler() {}
@@ -200,11 +205,8 @@ inline static constexpr BuiltinTypePtr kRootTypes[] = {
};
inline static constexpr BuiltinTypePtr kPrivateTypes[] = {
- TYPE(Sampler1D), TYPE(Sampler2D), TYPE(Sampler3D),
- TYPE(SamplerExternalOES),
- TYPE(Sampler2DRect),
+ TYPE(Sampler2D), TYPE(SamplerExternalOES), TYPE(Sampler2DRect),
- TYPE(ISampler2D),
TYPE(SubpassInput), TYPE(SubpassInputMS),
TYPE(Sampler),
@@ -213,38 +215,41 @@ inline static constexpr BuiltinTypePtr kPrivateTypes[] = {
#undef TYPE
-std::shared_ptr<SymbolTable> Compiler::makeRootSymbolTable() const {
- auto rootSymbolTable = std::make_shared<SymbolTable>(*fContext, /*builtin=*/true);
+std::shared_ptr<SymbolTable> Compiler::makeRootSymbolTable() {
+ auto rootSymbolTable = std::make_shared<SymbolTable>(/*builtin=*/true);
for (BuiltinTypePtr rootType : kRootTypes) {
rootSymbolTable->addWithoutOwnership((fContext->fTypes.*rootType).get());
}
- return rootSymbolTable;
-}
-
-std::shared_ptr<SymbolTable> Compiler::makePrivateSymbolTable(std::shared_ptr<SymbolTable> parent) {
- auto privateSymbolTable = std::make_shared<SymbolTable>(parent, /*builtin=*/true);
-
for (BuiltinTypePtr privateType : kPrivateTypes) {
- privateSymbolTable->addWithoutOwnership((fContext->fTypes.*privateType).get());
+ rootSymbolTable->addWithoutOwnership((fContext->fTypes.*privateType).get());
}
// sk_Caps is "builtin", but all references to it are resolved to Settings, so we don't need to
// treat it as builtin (ie, no need to clone it into the Program).
- privateSymbolTable->add(std::make_unique<Variable>(/*pos=*/Position(),
- /*modifiersPosition=*/Position(),
- fCoreModifiers.add(Modifiers{}),
- "sk_Caps",
- fContext->fTypes.fSkCaps.get(),
- /*builtin=*/false,
- Variable::Storage::kGlobal));
- return privateSymbolTable;
+ rootSymbolTable->add(std::make_unique<Variable>(/*pos=*/Position(),
+ /*modifiersPosition=*/Position(),
+ fCoreModifiers.add(Modifiers{}),
+ "sk_Caps",
+ fContext->fTypes.fSkCaps.get(),
+ /*builtin=*/false,
+ Variable::Storage::kGlobal));
+ return rootSymbolTable;
+}
+
+const ParsedModule& Compiler::loadSharedModule() {
+ if (!fSharedModule.fSymbols) {
+ fSharedModule = this->parseModule(ProgramKind::kFragment, MODULE_DATA(shared),
+ fRootModule);
+ }
+ return fSharedModule;
}
const ParsedModule& Compiler::loadGPUModule() {
if (!fGPUModule.fSymbols) {
- fGPUModule = this->parseModule(ProgramKind::kFragment, MODULE_DATA(gpu), fPrivateModule);
+ fGPUModule = this->parseModule(ProgramKind::kFragment, MODULE_DATA(gpu),
+ this->loadSharedModule());
}
return fGPUModule;
}
@@ -265,25 +270,41 @@ const ParsedModule& Compiler::loadVertexModule() {
return fVertexModule;
}
+const ParsedModule& Compiler::loadComputeModule() {
+ if (!fComputeModule.fSymbols) {
+ fComputeModule = this->parseModule(ProgramKind::kCompute, MODULE_DATA(compute),
+ this->loadGPUModule());
+ }
+ return fComputeModule;
+}
+
const ParsedModule& Compiler::loadGraphiteFragmentModule() {
+#if defined(SK_GRAPHITE_ENABLED)
if (!fGraphiteFragmentModule.fSymbols) {
fGraphiteFragmentModule = this->parseModule(ProgramKind::kGraphiteFragment,
MODULE_DATA(graphite_frag),
this->loadFragmentModule());
}
return fGraphiteFragmentModule;
+#else
+ return this->loadFragmentModule();
+#endif
}
const ParsedModule& Compiler::loadGraphiteVertexModule() {
+#if defined(SK_GRAPHITE_ENABLED)
if (!fGraphiteVertexModule.fSymbols) {
fGraphiteVertexModule = this->parseModule(ProgramKind::kGraphiteVertex,
MODULE_DATA(graphite_vert),
this->loadVertexModule());
}
return fGraphiteVertexModule;
+#else
+ return this->loadVertexModule();
+#endif
}
-static void add_glsl_type_aliases(SkSL::SymbolTable* symbols, const SkSL::BuiltinTypes& types) {
+static void add_public_type_aliases(SkSL::SymbolTable* symbols, const SkSL::BuiltinTypes& types) {
// Add some aliases to the runtime effect modules so that it's friendlier, and more like GLSL.
symbols->addWithoutOwnership(types.fVec2.get());
symbols->addWithoutOwnership(types.fVec3.get());
@@ -311,23 +332,25 @@ static void add_glsl_type_aliases(SkSL::SymbolTable* symbols, const SkSL::Builti
symbols->addWithoutOwnership(types.fMat4x3.get());
symbols->addWithoutOwnership(types.fMat4x4.get());
- // Alias every private type to "invalid". This will prevent code from using built-in names like
- // `sampler2D` as variable names.
+ // Hide all the private symbols by aliasing them all to "invalid". This will prevent code from
+ // using built-in names like `sampler2D` as variable names.
for (BuiltinTypePtr privateType : kPrivateTypes) {
symbols->add(Type::MakeAliasType((types.*privateType)->name(), *types.fInvalid));
}
+ symbols->add(Type::MakeAliasType("sk_Caps", *types.fInvalid));
}
-std::shared_ptr<SymbolTable> Compiler::makeGLSLRootSymbolTable() const {
- auto result = this->makeRootSymbolTable();
- add_glsl_type_aliases(result.get(), fContext->fTypes);
+std::shared_ptr<SymbolTable> Compiler::makeRootSymbolTableWithPublicTypes() {
+ auto result = std::make_shared<SymbolTable>(fRootModule.fSymbols, /*builtin=*/true);
+ add_public_type_aliases(result.get(), fContext->fTypes);
return result;
}
const ParsedModule& Compiler::loadPublicModule() {
if (!fPublicModule.fSymbols) {
- fPublicModule = this->parseModule(ProgramKind::kGeneric, MODULE_DATA(public), fRootModule);
- add_glsl_type_aliases(fPublicModule.fSymbols.get(), fContext->fTypes);
+ fPublicModule = this->parseModule(ProgramKind::kGeneric, MODULE_DATA(public),
+ this->loadSharedModule());
+ add_public_type_aliases(fPublicModule.fSymbols.get(), fContext->fTypes);
}
return fPublicModule;
}
@@ -344,6 +367,7 @@ const ParsedModule& Compiler::moduleForProgramKind(ProgramKind kind) {
switch (kind) {
case ProgramKind::kVertex: return this->loadVertexModule(); break;
case ProgramKind::kFragment: return this->loadFragmentModule(); break;
+ case ProgramKind::kCompute: return this->loadComputeModule(); break;
case ProgramKind::kGraphiteVertex: return this->loadGraphiteVertexModule(); break;
case ProgramKind::kGraphiteFragment: return this->loadGraphiteFragmentModule(); break;
case ProgramKind::kRuntimeColorFilter: return this->loadPublicModule(); break;
@@ -362,13 +386,11 @@ LoadedModule Compiler::loadModule(ProgramKind kind,
std::shared_ptr<SymbolTable> base,
bool dehydrate) {
if (dehydrate) {
- // NOTE: This is a workaround. When dehydrating includes, skslc doesn't know which module
- // it's preparing, nor what the correct base module is. We can't use 'Root', because many
- // GPU intrinsics reference private types, like samplers or textures. Today, 'Private' does
- // contain the union of all known types, so this is safe. If we ever have types that only
- // exist in 'Public' (for example), this logic needs to be smarter (by choosing the correct
- // base for the module we're compiling).
- base = fPrivateModule.fSymbols;
+ // sksl-precompile passes `true` when dehydrating the lowest-level module to indicate that
+ // we should use the root module. Child modules that depend on the earlier module will pass
+ // `false` and pass the lower-level module's symbol table in `base`.
+ SkASSERT(base == nullptr);
+ base = fRootModule.fSymbols;
}
SkASSERT(base);
@@ -376,7 +398,7 @@ LoadedModule Compiler::loadModule(ProgramKind kind,
AutoModifiersPool autoPool(fContext, &fCoreModifiers);
// Built-in modules always use default program settings.
- Program::Settings settings;
+ ProgramSettings settings;
settings.fReplaceSettings = !dehydrate;
#if REHYDRATE
@@ -461,7 +483,7 @@ ParsedModule Compiler::parseModule(ProgramKind kind, ModuleData data, const Pars
std::unique_ptr<Program> Compiler::convertProgram(ProgramKind kind,
std::string text,
- Program::Settings settings) {
+ ProgramSettings settings) {
TRACE_EVENT0("skia.shaders", "SkSL::Compiler::convertProgram");
SkASSERT(!settings.fExternalFunctions || (kind == ProgramKind::kGeneric));
@@ -513,21 +535,6 @@ std::unique_ptr<Program> Compiler::convertProgram(ProgramKind kind,
return DSLParser(this, settings, kind, std::move(text)).program();
}
-void Compiler::updateInputsForBuiltinVariable(const Variable& var) {
- switch (var.modifiers().fLayout.fBuiltin) {
- case SK_FRAGCOORD_BUILTIN:
- if (fContext->fCaps.fCanUseFragCoord) {
- ThreadContext::Inputs().fUseFlipRTUniform =
- !fContext->fConfig->fSettings.fForceNoRTFlip;
- }
- break;
- case SK_CLOCKWISE_BUILTIN:
- ThreadContext::Inputs().fUseFlipRTUniform =
- !fContext->fConfig->fSettings.fForceNoRTFlip;
- break;
- }
-}
-
std::unique_ptr<Expression> Compiler::convertIdentifier(Position pos, std::string_view name) {
const Symbol* result = (*fSymbolTable)[name];
if (!result) {
@@ -536,14 +543,8 @@ std::unique_ptr<Expression> Compiler::convertIdentifier(Position pos, std::strin
}
switch (result->kind()) {
case Symbol::Kind::kFunctionDeclaration: {
- std::vector<const FunctionDeclaration*> f = {
- &result->as<FunctionDeclaration>()
- };
- return std::make_unique<FunctionReference>(*fContext, pos, f);
- }
- case Symbol::Kind::kUnresolvedFunction: {
- const UnresolvedFunction* f = &result->as<UnresolvedFunction>();
- return std::make_unique<FunctionReference>(*fContext, pos, f->functions());
+ return std::make_unique<FunctionReference>(*fContext, pos,
+ &result->as<FunctionDeclaration>());
}
case Symbol::Kind::kVariable: {
const Variable* var = &result->as<Variable>();
@@ -639,16 +640,16 @@ bool Compiler::optimize(Program& program) {
this->runInliner(program.fOwnedElements, program.fSymbols, usage);
// Unreachable code can confuse some drivers, so it's worth removing. (skia:12012)
- Transform::EliminateUnreachableCode(program, usage);
+ Transform::EliminateUnreachableCode(program);
- while (Transform::EliminateDeadFunctions(program, usage)) {
+ while (Transform::EliminateDeadFunctions(program)) {
// Removing dead functions may cause more functions to become unreferenced. Try again.
}
- while (Transform::EliminateDeadLocalVariables(program, usage)) {
+ while (Transform::EliminateDeadLocalVariables(program)) {
// Removing dead variables may cause more variables to become unreferenced. Try again.
}
- Transform::EliminateDeadGlobalVariables(program, usage);
+ Transform::EliminateDeadGlobalVariables(program);
}
return this->errorCount() == 0;
@@ -675,6 +676,12 @@ bool Compiler::runInliner(const std::vector<std::unique_ptr<ProgramElement>>& el
}
bool Compiler::finalize(Program& program) {
+ // Copy all referenced built-in functions into the Program.
+ Transform::FindAndDeclareBuiltinFunctions(program);
+
+ // Variables defined in the pre-includes need their declaring elements added to the program.
+ Transform::FindAndDeclareBuiltinVariables(program);
+
// Do one last correctness-check pass. This looks for @if/@switch statements that didn't
// optimize away, or dangling FunctionReference or TypeReference expressions, and reports them
// as errors.
diff --git a/chromium/third_party/skia/src/sksl/SkSLCompiler.h b/chromium/third_party/skia/src/sksl/SkSLCompiler.h
index e1a6450fb71..a6a54b63a5c 100644
--- a/chromium/third_party/skia/src/sksl/SkSLCompiler.h
+++ b/chromium/third_party/skia/src/sksl/SkSLCompiler.h
@@ -19,9 +19,10 @@
#include "src/sksl/SkSLMangler.h"
#include "src/sksl/SkSLModifiersPool.h"
#include "src/sksl/SkSLParsedModule.h"
-#include "src/sksl/ir/SkSLProgram.h"
#include <array>
+#include <cstddef>
+#include <cstdint>
#include <memory>
#include <string>
#include <string_view>
@@ -37,6 +38,7 @@
#define SK_SECONDARYFRAGCOLOR_BUILTIN 10012
#define SK_FRAGCOORD_BUILTIN 15
#define SK_CLOCKWISE_BUILTIN 17
+#define SK_THREADPOSITION 28
#define SK_VERTEXID_BUILTIN 42
#define SK_INSTANCEID_BUILTIN 43
#define SK_POSITION_BUILTIN 0
@@ -54,10 +56,11 @@ class Context;
class Expression;
class IRNode;
class OutputStream;
-class SymbolTable;
-class Variable;
-
+struct Program;
+struct ProgramSettings;
+class ProgramUsage;
struct ShaderCaps;
+class SymbolTable;
struct LoadedModule {
ProgramKind fKind;
@@ -146,16 +149,12 @@ public:
* table of the Program, but ownership is *not* transferred. It is up to the caller to keep them
* alive.
*/
- std::unique_ptr<Program> convertProgram(
- ProgramKind kind,
- std::string text,
- Program::Settings settings);
+ std::unique_ptr<Program> convertProgram(ProgramKind kind,
+ std::string text,
+ ProgramSettings settings);
std::unique_ptr<Expression> convertIdentifier(Position pos, std::string_view name);
- /** Updates the Program's Inputs when a builtin variable is referenced. */
- void updateInputsForBuiltinVariable(const Variable& var);
-
bool toSPIRV(Program& program, OutputStream& out);
bool toSPIRV(Program& program, std::string* out);
@@ -233,17 +232,9 @@ private:
Compiler& fCompiler;
};
- const ParsedModule& loadGPUModule();
- const ParsedModule& loadFragmentModule();
- const ParsedModule& loadVertexModule();
- const ParsedModule& loadGraphiteFragmentModule();
- const ParsedModule& loadGraphiteVertexModule();
- const ParsedModule& loadPublicModule();
- const ParsedModule& loadPrivateRTShaderModule();
- std::shared_ptr<SymbolTable> makeRootSymbolTable() const;
- std::shared_ptr<SymbolTable> makeGLSLRootSymbolTable() const;
- std::shared_ptr<SymbolTable> makePrivateSymbolTable(std::shared_ptr<SymbolTable> parent);
+ std::shared_ptr<SymbolTable> makeRootSymbolTable();
+ std::shared_ptr<SymbolTable> makeRootSymbolTableWithPublicTypes();
/** Optimize every function in the program. */
bool optimize(Program& program);
@@ -262,19 +253,31 @@ private:
std::shared_ptr<SymbolTable> symbols,
ProgramUsage* usage);
+ const ParsedModule& loadSharedModule();
+ const ParsedModule& loadGPUModule();
+ const ParsedModule& loadVertexModule();
+ const ParsedModule& loadFragmentModule();
+ const ParsedModule& loadComputeModule();
+ const ParsedModule& loadGraphiteVertexModule();
+ const ParsedModule& loadGraphiteFragmentModule();
+
+ const ParsedModule& loadPublicModule();
+ const ParsedModule& loadPrivateRTShaderModule();
+
CompilerErrorReporter fErrorReporter;
std::shared_ptr<Context> fContext;
- ParsedModule fRootModule; // Core types
+ ParsedModule fRootModule; // Core public and private types
- ParsedModule fPrivateModule; // [Root] + Internal types
- ParsedModule fGPUModule; // [Private] + GPU intrinsics, helper functions
+ ParsedModule fSharedModule; // [Root] + Public intrinsics
+ ParsedModule fGPUModule; // [Shared] + Non-public intrinsics/helper functions
ParsedModule fVertexModule; // [GPU] + Vertex stage decls
ParsedModule fFragmentModule; // [GPU] + Fragment stage decls
+ ParsedModule fComputeModule; // [GPU] + Compute stage decls
ParsedModule fGraphiteVertexModule; // [Vert] + Graphite vertex helpers
ParsedModule fGraphiteFragmentModule; // [Frag] + Graphite fragment helpers
- ParsedModule fPublicModule; // [Root] + Public features
+ ParsedModule fPublicModule; // [Shared] + Runtime effect intrinsics - Private types
ParsedModule fRuntimeShaderModule; // [Public] + Runtime shader decls
// holds ModifiersPools belonging to the core includes for lifetime purposes
diff --git a/chromium/third_party/skia/src/sksl/SkSLConstantFolder.cpp b/chromium/third_party/skia/src/sksl/SkSLConstantFolder.cpp
index 39b798113e2..9c11c749384 100644
--- a/chromium/third_party/skia/src/sksl/SkSLConstantFolder.cpp
+++ b/chromium/third_party/skia/src/sksl/SkSLConstantFolder.cpp
@@ -15,6 +15,7 @@
#include "src/sksl/SkSLContext.h"
#include "src/sksl/SkSLProgramSettings.h"
#include "src/sksl/ir/SkSLConstructorCompound.h"
+#include "src/sksl/ir/SkSLConstructorDiagonalMatrix.h"
#include "src/sksl/ir/SkSLConstructorSplat.h"
#include "src/sksl/ir/SkSLExpression.h"
#include "src/sksl/ir/SkSLLiteral.h"
@@ -23,7 +24,9 @@
#include "src/sksl/ir/SkSLVariable.h"
#include "src/sksl/ir/SkSLVariableReference.h"
+#include <cfloat>
#include <cmath>
+#include <cstdint>
#include <limits>
#include <optional>
#include <string>
@@ -274,8 +277,36 @@ static std::unique_ptr<Expression> cast_expression(const Context& context,
const Expression& expr,
const Type& type) {
SkASSERT(type.componentType().matches(expr.type().componentType()));
- return expr.type().isScalar() ? ConstructorSplat::Make(context, pos, type, expr.clone())
- : expr.clone(pos);
+ if (expr.type().isScalar()) {
+ if (type.isMatrix()) {
+ return ConstructorDiagonalMatrix::Make(context, pos, type, expr.clone());
+ }
+ if (type.isVector()) {
+ return ConstructorSplat::Make(context, pos, type, expr.clone());
+ }
+ }
+ if (type.matches(expr.type())) {
+ return expr.clone(pos);
+ }
+ // We can't cast matrices into vectors or vice-versa.
+ return nullptr;
+}
+
+static std::unique_ptr<Expression> zero_expression(const Context& context,
+ Position pos,
+ const Type& type) {
+ std::unique_ptr<Expression> zero = Literal::Make(pos, 0.0, &type.componentType());
+ if (type.isScalar()) {
+ return zero;
+ }
+ if (type.isVector()) {
+ return ConstructorSplat::Make(context, pos, type, std::move(zero));
+ }
+ if (type.isMatrix()) {
+ return ConstructorDiagonalMatrix::Make(context, pos, type, std::move(zero));
+ }
+ SkDEBUGFAILF("unsupported type %s", type.description().c_str());
+ return nullptr;
}
static std::unique_ptr<Expression> negate_expression(const Context& context,
@@ -316,7 +347,8 @@ static bool contains_constant_zero(const Expression& expr) {
return false;
}
-static bool is_constant_value(const Expression& expr, double value) {
+// Returns true if the expression contains `value` in every slot.
+static bool is_constant_splat(const Expression& expr, double value) {
int numSlots = expr.type().slotCount();
for (int index = 0; index < numSlots; ++index) {
std::optional<double> slotVal = expr.getConstantValue(index);
@@ -327,6 +359,33 @@ static bool is_constant_value(const Expression& expr, double value) {
return true;
}
+// Returns true if the expression is a square diagonal matrix containing `value`.
+static bool is_constant_diagonal(const Expression& expr, double value) {
+ SkASSERT(expr.type().isMatrix());
+ int columns = expr.type().columns();
+ int rows = expr.type().rows();
+ if (columns != rows) {
+ return false;
+ }
+ int slotIdx = 0;
+ for (int c = 0; c < columns; ++c) {
+ for (int r = 0; r < rows; ++r) {
+ double expectation = (c == r) ? value : 0;
+ std::optional<double> slotVal = expr.getConstantValue(slotIdx++);
+ if (!slotVal.has_value() || *slotVal != expectation) {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+// Returns true if the expression is a scalar, vector, or diagonal matrix containing `value`.
+static bool is_constant_value(const Expression& expr, double value) {
+ return expr.type().isMatrix() ? is_constant_diagonal(expr, value)
+ : is_constant_splat(expr, value);
+}
+
static bool error_on_divide_by_zero(const Context& context, Position pos, Operator op,
const Expression& right) {
switch (op.kind()) {
@@ -379,6 +438,14 @@ std::unique_ptr<Expression> ConstantFolder::MakeConstantValueForVariable(Positio
return expr;
}
+static bool is_scalar_op_matrix(const Expression& left, const Expression& right) {
+ return left.type().isScalar() && right.type().isMatrix();
+}
+
+static bool is_matrix_op_scalar(const Expression& left, const Expression& right) {
+ return is_scalar_op_matrix(right, left);
+}
+
static std::unique_ptr<Expression> simplify_no_op_arithmetic(const Context& context,
Position pos,
const Expression& left,
@@ -387,55 +454,82 @@ static std::unique_ptr<Expression> simplify_no_op_arithmetic(const Context& cont
const Type& resultType) {
switch (op.kind()) {
case Operator::Kind::PLUS:
- if (is_constant_value(right, 0.0)) { // x + 0
- return cast_expression(context, pos, left, resultType);
+ if (!is_scalar_op_matrix(left, right) && is_constant_splat(right, 0.0)) { // x + 0
+ if (std::unique_ptr<Expression> expr = cast_expression(context, pos, left,
+ resultType)) {
+ return expr;
+ }
}
- if (is_constant_value(left, 0.0)) { // 0 + x
- return cast_expression(context, pos, right, resultType);
+ if (!is_matrix_op_scalar(left, right) && is_constant_splat(left, 0.0)) { // 0 + x
+ if (std::unique_ptr<Expression> expr = cast_expression(context, pos, right,
+ resultType)) {
+ return expr;
+ }
}
break;
case Operator::Kind::STAR:
if (is_constant_value(right, 1.0)) { // x * 1
- return cast_expression(context, pos, left, resultType);
+ if (std::unique_ptr<Expression> expr = cast_expression(context, pos, left,
+ resultType)) {
+ return expr;
+ }
}
if (is_constant_value(left, 1.0)) { // 1 * x
- return cast_expression(context, pos, right, resultType);
+ if (std::unique_ptr<Expression> expr = cast_expression(context, pos, right,
+ resultType)) {
+ return expr;
+ }
}
if (is_constant_value(right, 0.0) && !left.hasSideEffects()) { // x * 0
- return cast_expression(context, pos, right, resultType);
+ return zero_expression(context, pos, resultType);
}
if (is_constant_value(left, 0.0) && !right.hasSideEffects()) { // 0 * x
- return cast_expression(context, pos, left, resultType);
+ return zero_expression(context, pos, resultType);
}
if (is_constant_value(right, -1.0)) { // x * -1 (to `-x`)
- return negate_expression(context, pos, left, resultType);
+ if (std::unique_ptr<Expression> expr = negate_expression(context, pos, left,
+ resultType)) {
+ return expr;
+ }
}
if (is_constant_value(left, -1.0)) { // -1 * x (to `-x`)
- return negate_expression(context, pos, right, resultType);
+ if (std::unique_ptr<Expression> expr = negate_expression(context, pos, right,
+ resultType)) {
+ return expr;
+ }
}
break;
case Operator::Kind::MINUS:
- if (is_constant_value(right, 0.0)) { // x - 0
- return cast_expression(context, pos, left, resultType);
+ if (!is_scalar_op_matrix(left, right) && is_constant_splat(right, 0.0)) { // x - 0
+ if (std::unique_ptr<Expression> expr = cast_expression(context, pos, left,
+ resultType)) {
+ return expr;
+ }
}
- if (is_constant_value(left, 0.0)) { // 0 - x (to `-x`)
- return negate_expression(context, pos, right, resultType);
+ if (!is_matrix_op_scalar(left, right) && is_constant_splat(left, 0.0)) { // 0 - x
+ if (std::unique_ptr<Expression> expr = negate_expression(context, pos, right,
+ resultType)) {
+ return expr;
+ }
}
break;
case Operator::Kind::SLASH:
- if (is_constant_value(right, 1.0)) { // x / 1
- return cast_expression(context, pos, left, resultType);
+ if (!is_scalar_op_matrix(left, right) && is_constant_splat(right, 1.0)) { // x / 1
+ if (std::unique_ptr<Expression> expr = cast_expression(context, pos, left,
+ resultType)) {
+ return expr;
+ }
}
break;
case Operator::Kind::PLUSEQ:
case Operator::Kind::MINUSEQ:
- if (is_constant_value(right, 0.0)) { // x += 0, x -= 0
+ if (is_constant_splat(right, 0.0)) { // x += 0, x -= 0
if (std::unique_ptr<Expression> var = cast_expression(context, pos, left,
- resultType)) {
+ resultType)) {
Analysis::UpdateVariableRefKind(var.get(), VariableRefKind::kRead);
return var;
}
@@ -443,10 +537,19 @@ static std::unique_ptr<Expression> simplify_no_op_arithmetic(const Context& cont
break;
case Operator::Kind::STAREQ:
+ if (is_constant_value(right, 1.0)) { // x *= 1
+ if (std::unique_ptr<Expression> var = cast_expression(context, pos, left,
+ resultType)) {
+ Analysis::UpdateVariableRefKind(var.get(), VariableRefKind::kRead);
+ return var;
+ }
+ }
+ break;
+
case Operator::Kind::SLASHEQ:
- if (is_constant_value(right, 1.0)) { // x *= 1, x /= 1
+ if (is_constant_splat(right, 1.0)) { // x /= 1
if (std::unique_ptr<Expression> var = cast_expression(context, pos, left,
- resultType)) {
+ resultType)) {
Analysis::UpdateVariableRefKind(var.get(), VariableRefKind::kRead);
return var;
}
@@ -464,9 +567,11 @@ template <typename T>
static std::unique_ptr<Expression> fold_float_expression(Position pos,
T result,
const Type* resultType) {
- // If constant-folding this expression would generate a NaN/infinite result, leave it as-is.
if constexpr (!std::is_same<T, bool>::value) {
- if (!std::isfinite(result)) {
+ if (result >= -FLT_MAX && result <= FLT_MAX) {
+ // This result will fit inside a float Literal.
+ } else {
+ // The value is outside the float range or is NaN (all if-checks fail); do not optimize.
return nullptr;
}
}
@@ -557,9 +662,7 @@ std::unique_ptr<Expression> ConstantFolder::Simplify(const Context& context,
// Optimize away no-op arithmetic like `x * 1`, `x *= 1`, `x + 0`, `x * 0`, `0 / x`, etc.
const Type& leftType = left->type();
const Type& rightType = right->type();
- if (context.fConfig->fSettings.fOptimize &&
- (leftType.isScalar() || leftType.isVector()) &&
- (rightType.isScalar() || rightType.isVector())) {
+ if (context.fConfig->fSettings.fOptimize) {
if (std::unique_ptr<Expression> expr = simplify_no_op_arithmetic(context, pos, *left, op,
*right, resultType)) {
return expr;
diff --git a/chromium/third_party/skia/src/sksl/SkSLDSLParser.cpp b/chromium/third_party/skia/src/sksl/SkSLDSLParser.cpp
index 83bf05dc49a..c1de6b58bc9 100644
--- a/chromium/third_party/skia/src/sksl/SkSLDSLParser.cpp
+++ b/chromium/third_party/skia/src/sksl/SkSLDSLParser.cpp
@@ -30,6 +30,7 @@
#include "src/sksl/ir/SkSLProgram.h"
#include <algorithm>
+#include <climits>
#include <initializer_list>
#include <memory>
#include <type_traits>
@@ -60,6 +61,10 @@ static int parse_modifier_token(Token::Kind token) {
case Token::Kind::TK_MEDIUMP: return Modifiers::kMediump_Flag;
case Token::Kind::TK_LOWP: return Modifiers::kLowp_Flag;
case Token::Kind::TK_ES3: return Modifiers::kES3_Flag;
+ case Token::Kind::TK_THREADGROUP: return Modifiers::kThreadgroup_Flag;
+ case Token::Kind::TK_READONLY: return Modifiers::kReadOnly_Flag;
+ case Token::Kind::TK_WRITEONLY: return Modifiers::kWriteOnly_Flag;
+ case Token::Kind::TK_BUFFER: return Modifiers::kBuffer_Flag;
default: return 0;
}
}
@@ -153,6 +158,22 @@ static bool is_whitespace(Token::Kind kind) {
}
}
+bool DSLParser::expectNewline() {
+ Token token = this->nextRawToken();
+ if (token.fKind == Token::Kind::TK_WHITESPACE) {
+ // The lexer doesn't distinguish newlines from other forms of whitespace, so we check
+ // for newlines by searching through the token text.
+ std::string_view tokenText = this->text(token);
+ if (tokenText.find_first_of('\r') != std::string_view::npos ||
+ tokenText.find_first_of('\n') != std::string_view::npos) {
+ return true;
+ }
+ }
+ // We didn't find a newline.
+ this->pushback(token);
+ return false;
+}
+
Token DSLParser::nextToken() {
for (;;) {
Token token = this->nextRawToken();
@@ -208,7 +229,7 @@ bool DSLParser::expectIdentifier(Token* result) {
if (!this->expect(Token::Kind::TK_IDENTIFIER, "an identifier", result)) {
return false;
}
- if (IsBuiltinType(this->text(*result))) {
+ if (CurrentSymbolTable()->isBuiltinType(this->text(*result))) {
this->error(*result, "expected an identifier, but found type '" +
std::string(this->text(*result)) + "'");
this->fEncounteredFatalError = true;
@@ -221,7 +242,7 @@ bool DSLParser::checkIdentifier(Token* result) {
if (!this->checkNext(Token::Kind::TK_IDENTIFIER, result)) {
return false;
}
- if (IsBuiltinType(this->text(*result))) {
+ if (CurrentSymbolTable()->isBuiltinType(this->text(*result))) {
this->pushback(std::move(*result));
return false;
}
@@ -316,7 +337,8 @@ void DSLParser::declarations() {
}
}
-/* DIRECTIVE(#extension) IDENTIFIER COLON IDENTIFIER */
+/* DIRECTIVE(#extension) IDENTIFIER COLON IDENTIFIER NEWLINE |
+ DIRECTIVE(#version) INTLITERAL NEWLINE */
void DSLParser::directive(bool allowVersion) {
Token start;
if (!this->expect(Token::Kind::TK_DIRECTIVE, "a directive", &start)) {
@@ -337,14 +359,19 @@ void DSLParser::directive(bool allowVersion) {
return;
}
std::string_view behaviorText = this->text(behavior);
- if (behaviorText == "disable") {
- return;
+ if (behaviorText != "disable") {
+ if (behaviorText == "require" || behaviorText == "enable" || behaviorText == "warn") {
+ // We don't currently do anything different between require, enable, and warn
+ dsl::AddExtension(this->text(name));
+ } else {
+ this->error(behavior, "expected 'require', 'enable', 'warn', or 'disable'");
+ }
}
- if (behaviorText != "require" && behaviorText != "enable" && behaviorText != "warn") {
- this->error(behavior, "expected 'require', 'enable', 'warn', or 'disable'");
+
+ // We expect a newline after an #extension directive.
+ if (!this->expectNewline()) {
+ this->error(start, "invalid #extension directive");
}
- // We don't currently do anything different between require, enable, and warn
- dsl::AddExtension(this->text(name));
} else if (text == "#version") {
if (!allowVersion) {
this->error(start, "#version directive must appear before anything else");
@@ -365,6 +392,10 @@ void DSLParser::directive(bool allowVersion) {
this->error(start, "unsupported version number");
return;
}
+ // We expect a newline after a #version directive.
+ if (!this->expectNewline()) {
+ this->error(start, "invalid #version directive");
+ }
} else {
this->error(start, "unsupported directive '" + std::string(this->text(start)) + "'");
}
@@ -381,7 +412,8 @@ bool DSLParser::declaration() {
}
DSLModifiers modifiers = this->modifiers();
Token lookahead = this->peek();
- if (lookahead.fKind == Token::Kind::TK_IDENTIFIER && !IsType(this->text(lookahead))) {
+ if (lookahead.fKind == Token::Kind::TK_IDENTIFIER &&
+ !CurrentSymbolTable()->isType(this->text(lookahead))) {
// we have an identifier that's not a type, could be the start of an interface block
return this->interfaceBlock(modifiers);
}
@@ -497,7 +529,11 @@ bool DSLParser::parseArrayDimensions(Position pos, DSLType* type) {
Token next;
while (this->checkNext(Token::Kind::TK_LBRACKET, &next)) {
if (this->checkNext(Token::Kind::TK_RBRACKET)) {
- this->error(this->rangeFrom(pos), "unsized arrays are not permitted here");
+ if (this->allowUnsizedArrays()) {
+ *type = UnsizedArray(*type, this->rangeFrom(pos));
+ } else {
+ this->error(this->rangeFrom(pos), "unsized arrays are not permitted here");
+ }
} else {
SKSL_INT size;
if (!this->arraySize(&size)) {
@@ -615,7 +651,7 @@ DSLStatement DSLParser::varDeclarationsOrExpressionStatement() {
if (nextToken.fKind == Token::Kind::TK_HIGHP ||
nextToken.fKind == Token::Kind::TK_MEDIUMP ||
nextToken.fKind == Token::Kind::TK_LOWP ||
- IsType(this->text(nextToken))) {
+ CurrentSymbolTable()->isType(this->text(nextToken))) {
// Statements that begin with a typename are most often variable declarations, but
// occasionally the type is part of a constructor, and these are actually expression-
// statements in disguise. First, attempt the common case: parse it as a vardecl.
@@ -724,7 +760,7 @@ DSLType DSLParser::structDeclaration() {
this->error(this->rangeFrom(start), "struct '" + std::string(this->text(name)) +
"' must contain at least one field");
}
- return dsl::Struct(this->text(name), SkMakeSpan(fields), this->rangeFrom(start));
+ return dsl::Struct(this->text(name), SkSpan(fields), this->rangeFrom(start));
}
/* structDeclaration ((IDENTIFIER varDeclarationEnd) | SEMICOLON) */
@@ -892,7 +928,7 @@ DSLLayout DSLParser::layout() {
}
/* layout? (UNIFORM | CONST | IN | OUT | INOUT | LOWP | MEDIUMP | HIGHP | FLAT | NOPERSPECTIVE |
- VARYING | INLINE)* */
+ VARYING | INLINE | THREADGROUP | READONLY | WRITEONLY | BUFFER)* */
DSLModifiers DSLParser::modifiers() {
int start = this->peek().fOffset;
DSLLayout layout = this->layout();
@@ -903,13 +939,19 @@ DSLModifiers DSLParser::modifiers() {
}
int flags = 0;
for (;;) {
- // TODO(ethannicholas): handle duplicate / incompatible flags
+ // TODO: handle duplicate flags
int tokenFlag = parse_modifier_token(peek().fKind);
if (!tokenFlag) {
break;
}
+ Token modifier = this->nextToken();
+ // We have to check for this (internal) modifier here. It's automatically added to user
+ // functions before the IR is built, so testing for it in Convert gives false positives.
+ if (tokenFlag == Modifiers::kHasSideEffects_Flag && !ThreadContext::IsModule()) {
+ this->error(modifier, "'sk_has_side_effects' is not permitted here");
+ }
flags |= tokenFlag;
- end = this->position(this->nextToken()).endOffset();
+ end = this->position(modifier).endOffset();
}
return DSLModifiers(std::move(layout), flags, Position::Range(start, end));
}
@@ -967,7 +1009,7 @@ DSLType DSLParser::type(DSLModifiers* modifiers) {
if (!this->expect(Token::Kind::TK_IDENTIFIER, "a type", &type)) {
return DSLType(nullptr);
}
- if (!IsType(this->text(type))) {
+ if (!CurrentSymbolTable()->isType(this->text(type))) {
this->error(type, "no type named '" + std::string(this->text(type)) + "'");
return DSLType(nullptr);
}
@@ -975,7 +1017,11 @@ DSLType DSLParser::type(DSLModifiers* modifiers) {
Token bracket;
while (this->checkNext(Token::Kind::TK_LBRACKET, &bracket)) {
if (this->checkNext(Token::Kind::TK_RBRACKET)) {
- this->error(this->rangeFrom(bracket), "unsized arrays are not permitted here");
+ if (this->allowUnsizedArrays()) {
+ result = UnsizedArray(result, this->rangeFrom(type));
+ } else {
+ this->error(this->rangeFrom(bracket), "unsized arrays are not permitted here");
+ }
} else {
SKSL_INT size;
if (!this->arraySize(&size)) {
diff --git a/chromium/third_party/skia/src/sksl/SkSLDSLParser.h b/chromium/third_party/skia/src/sksl/SkSLDSLParser.h
index aa520838cd8..3369845a668 100644
--- a/chromium/third_party/skia/src/sksl/SkSLDSLParser.h
+++ b/chromium/third_party/skia/src/sksl/SkSLDSLParser.h
@@ -25,6 +25,7 @@
#include "src/sksl/SkSLLexer.h"
#include "src/sksl/SkSLProgramSettings.h"
+#include <cstddef>
#include <memory>
#include <optional>
#include <string>
@@ -117,6 +118,9 @@ private:
*/
bool expectIdentifier(Token* result);
+ /** If the next token is a newline, consumes it and returns true. If not, returns false. */
+ bool expectNewline();
+
void error(Token token, std::string_view msg);
void error(Position position, std::string_view msg);
@@ -166,6 +170,10 @@ private:
SkTArray<dsl::DSLGlobalVar> structVarDeclaration(Position start,
const dsl::DSLModifiers& modifiers);
+ bool allowUnsizedArrays() {
+ return ProgramConfig::IsCompute(fKind);
+ }
+
bool parseArrayDimensions(Position pos, dsl::DSLType* type);
bool parseInitializer(Position pos, dsl::DSLExpression* initializer);
diff --git a/chromium/third_party/skia/src/sksl/SkSLDehydrator.cpp b/chromium/third_party/skia/src/sksl/SkSLDehydrator.cpp
index cab8df5ceb9..30622cfc811 100644
--- a/chromium/third_party/skia/src/sksl/SkSLDehydrator.cpp
+++ b/chromium/third_party/skia/src/sksl/SkSLDehydrator.cpp
@@ -56,12 +56,13 @@
#include "src/sksl/ir/SkSLSymbolTable.h"
#include "src/sksl/ir/SkSLTernaryExpression.h"
#include "src/sksl/ir/SkSLType.h"
-#include "src/sksl/ir/SkSLUnresolvedFunction.h"
#include "src/sksl/ir/SkSLVarDeclarations.h"
#include "src/sksl/ir/SkSLVariable.h"
#include "src/sksl/ir/SkSLVariableReference.h"
-#include <map>
+#include <algorithm>
+
+#define SYMBOL_DEBUGF(...) //SkDebugf(__VA_ARGS__)
namespace SkSL {
@@ -169,22 +170,11 @@ void Dehydrator::write(const Symbol& s) {
this->write(f.name());
this->writeU8(f.parameters().size());
for (const Variable* p : f.parameters()) {
- this->writeU16(this->symbolId(p));
+ this->write(*p);
}
this->write(f.returnType());
break;
}
- case Symbol::Kind::kUnresolvedFunction: {
- this->allocSymbolId(&s);
- const UnresolvedFunction& f = s.as<UnresolvedFunction>();
- this->writeCommand(Rehydrator::kUnresolvedFunction_Command);
- this->writeId(&f);
- this->writeU8(f.functions().size());
- for (const FunctionDeclaration* funcDecl : f.functions()) {
- this->write(*funcDecl);
- }
- break;
- }
case Symbol::Kind::kType: {
const Type& t = s.as<Type>();
switch (t.typeKind()) {
@@ -241,41 +231,81 @@ void Dehydrator::write(const Symbol& s) {
}
void Dehydrator::write(const SymbolTable& symbols) {
+ auto symbolIsReferenced = [&](const Symbol& sym) -> bool {
+ if (sym.is<Variable>()) {
+ // Only dehydrate Variables that haven't been optimized away.
+ return sym.as<Variable>().storage() != VariableStorage::kEliminated;
+ }
+ return true;
+ };
+
this->writeCommand(Rehydrator::kSymbolTable_Command);
this->writeU8(symbols.isBuiltin());
- this->writeU16(symbols.fOwnedSymbols.size());
- // write owned symbols
+ // Make a list of all the owned symbols which are referenced.
+ std::vector<const Symbol*> ownedSymbols;
for (const std::unique_ptr<const Symbol>& s : symbols.fOwnedSymbols) {
+ if (symbolIsReferenced(*s)) {
+ ownedSymbols.push_back(s.get());
+ }
+ }
+ // Write the owned symbols.
+ SYMBOL_DEBUGF("\nOwned symbols in Dehydrator:\n\n\n");
+ this->writeU16(ownedSymbols.size());
+ for (const Symbol* s : ownedSymbols) {
this->write(*s);
+ SYMBOL_DEBUGF("%s\n", s->description().c_str());
}
- // write symbols
- this->writeU16(symbols.fSymbols.count());
- std::map<std::string_view, const Symbol*> ordered;
+ // Make an ordered list of every referenced symbol in the symbol-table, owned or not.
+ std::vector<const Symbol*> ordered;
symbols.foreach([&](std::string_view name, const Symbol* symbol) {
- ordered.insert({name, symbol});
+ if (symbolIsReferenced(*symbol)) {
+ if (!symbol->is<FunctionDeclaration>()) {
+ // Copy over the symbol as-is.
+ ordered.push_back(symbol);
+ } else {
+ // For functions, we actually want to copy over the entire overload chain from this
+ // symbol table. This will allow the rehydrator to recreate the overload chain in
+ // the proper order. If we don't do this, at rehydration time, we only add in one
+ // overload for the function, and the others are forgotten.
+ for (const std::unique_ptr<const Symbol>& owned : symbols.fOwnedSymbols) {
+ if (owned->is<FunctionDeclaration>() && owned->name() == symbol->name()) {
+ ordered.push_back(owned.get());
+ }
+ }
+ }
+ }
});
- for (std::pair<std::string_view, const Symbol*> p : ordered) {
+ std::stable_sort(ordered.begin(), ordered.end(), [](const Symbol* a, const Symbol* b) {
+ return a->name() < b->name();
+ });
+
+ // List the symbols in named order.
+ SYMBOL_DEBUGF("\nOrdered symbols in Dehydrator:\n\n\n");
+ this->writeU16(ordered.size());
+ for (const Symbol* symbol : ordered) {
bool found = false;
- for (size_t i = 0; i < symbols.fOwnedSymbols.size(); ++i) {
- if (symbols.fOwnedSymbols[i].get() == p.second) {
+ for (size_t i = 0; i < ownedSymbols.size(); ++i) {
+ if (ownedSymbols[i] == symbol) {
fCommandBreaks.add(fBody.bytesWritten());
this->writeU16(i);
found = true;
break;
}
}
- if (!found) {
+ if (found) {
+ SYMBOL_DEBUGF("%s\n", symbol->description().c_str());
+ } else {
// we should only fail to find builtin types
- SkASSERT(p.second->is<Type>() && p.second->as<Type>().isInBuiltinTypes());
+ SYMBOL_DEBUGF("(builtin symbol) %s\n", symbol->description().c_str());
+ SkASSERT(symbol->is<Type>() && symbol->as<Type>().isInBuiltinTypes());
this->writeU16(Rehydrator::kBuiltin_Symbol);
- this->write(p.second->name());
+ this->write(symbol->name());
}
}
}
-
void Dehydrator::writeExpressionSpan(const SkSpan<const std::unique_ptr<Expression>>& span) {
this->writeU8(span.size());
for (const auto& expr : span) {
diff --git a/chromium/third_party/skia/src/sksl/SkSLInliner.cpp b/chromium/third_party/skia/src/sksl/SkSLInliner.cpp
index 25a3215fb08..22433b36fb6 100644
--- a/chromium/third_party/skia/src/sksl/SkSLInliner.cpp
+++ b/chromium/third_party/skia/src/sksl/SkSLInliner.cpp
@@ -19,6 +19,7 @@
#include "include/sksl/SkSLPosition.h"
#include "src/sksl/SkSLAnalysis.h"
#include "src/sksl/SkSLMangler.h"
+#include "src/sksl/analysis/SkSLProgramUsage.h"
#include "src/sksl/analysis/SkSLProgramVisitor.h"
#include "src/sksl/ir/SkSLBinaryExpression.h"
#include "src/sksl/ir/SkSLChildCall.h"
@@ -56,9 +57,11 @@
#include "src/sksl/ir/SkSLVarDeclarations.h"
#include "src/sksl/ir/SkSLVariable.h"
#include "src/sksl/ir/SkSLVariableReference.h"
+#include "src/sksl/transform/SkSLTransform.h"
#include <algorithm>
#include <climits>
+#include <cstddef>
#include <memory>
#include <string>
#include <string_view>
@@ -432,11 +435,12 @@ std::unique_ptr<Statement> Inliner::inlineStatement(Position pos,
std::unique_ptr<Expression>* resultExpr,
ReturnComplexity returnComplexity,
const Statement& statement,
+ const ProgramUsage& usage,
bool isBuiltinCode) {
auto stmt = [&](const std::unique_ptr<Statement>& s) -> std::unique_ptr<Statement> {
if (s) {
return this->inlineStatement(pos, varMap, symbolTableForStatement, resultExpr,
- returnComplexity, *s, isBuiltinCode);
+ returnComplexity, *s, usage, isBuiltinCode);
}
return nullptr;
};
@@ -454,6 +458,10 @@ std::unique_ptr<Statement> Inliner::inlineStatement(Position pos,
}
return nullptr;
};
+ auto variableModifiers = [&](const Variable& variable,
+ const Expression* initialValue) -> const Modifiers* {
+ return Transform::AddConstToVarModifiers(*fContext, variable, initialValue, &usage);
+ };
++fInlinedStatementCounter;
@@ -562,13 +570,13 @@ std::unique_ptr<Statement> Inliner::inlineStatement(Position pos,
const std::string* name = symbolTableForStatement->takeOwnershipOfString(
fContext->fMangler->uniqueName(variable.name(), symbolTableForStatement));
auto clonedVar = std::make_unique<Variable>(
- pos,
- variable.modifiersPosition(),
- &variable.modifiers(),
- name->c_str(),
- variable.type().clone(symbolTableForStatement),
- isBuiltinCode,
- variable.storage());
+ pos,
+ variable.modifiersPosition(),
+ variableModifiers(variable, initialValue.get()),
+ name->c_str(),
+ variable.type().clone(symbolTableForStatement),
+ isBuiltinCode,
+ variable.storage());
varMap->set(&variable, VariableReference::Make(pos, clonedVar.get()));
auto result = VarDeclaration::Make(*fContext,
clonedVar.get(),
@@ -663,7 +671,7 @@ Inliner::InlinedCall Inliner::inlineCall(FunctionCall* call,
for (const std::unique_ptr<Statement>& stmt : body.children()) {
inlineStatements.push_back(this->inlineStatement(pos, &varMap, symbolTable.get(),
&resultExpr, returnComplexity, *stmt,
- caller->isBuiltin()));
+ usage, caller->isBuiltin()));
}
SkASSERT(inlineStatements.count() <= expectedStmtCount);
diff --git a/chromium/third_party/skia/src/sksl/SkSLInliner.h b/chromium/third_party/skia/src/sksl/SkSLInliner.h
index 65dec3e409c..9a018a00ce2 100644
--- a/chromium/third_party/skia/src/sksl/SkSLInliner.h
+++ b/chromium/third_party/skia/src/sksl/SkSLInliner.h
@@ -13,7 +13,6 @@
#include "src/sksl/SkSLProgramSettings.h"
#include "src/sksl/ir/SkSLBlock.h"
#include "src/sksl/ir/SkSLExpression.h"
-#include "src/sksl/ir/SkSLProgram.h"
#include <memory>
#include <vector>
@@ -25,6 +24,7 @@ class FunctionDeclaration;
class FunctionDefinition;
class Position;
class ProgramElement;
+class ProgramUsage;
class Statement;
class SymbolTable;
class Variable;
@@ -57,7 +57,7 @@ private:
kEarlyReturns,
};
- const Program::Settings& settings() const { return fContext->fConfig->fSettings; }
+ const ProgramSettings& settings() const { return fContext->fConfig->fSettings; }
void buildCandidateList(const std::vector<std::unique_ptr<ProgramElement>>& elements,
std::shared_ptr<SymbolTable> symbols, ProgramUsage* usage,
@@ -73,6 +73,7 @@ private:
std::unique_ptr<Expression>* resultExpr,
ReturnComplexity returnComplexity,
const Statement& statement,
+ const ProgramUsage& usage,
bool isBuiltinCode);
/**
diff --git a/chromium/third_party/skia/src/sksl/SkSLIntrinsicList.h b/chromium/third_party/skia/src/sksl/SkSLIntrinsicList.h
index d4c1622780f..f0c4f4281de 100644
--- a/chromium/third_party/skia/src/sksl/SkSLIntrinsicList.h
+++ b/chromium/third_party/skia/src/sksl/SkSLIntrinsicList.h
@@ -10,100 +10,104 @@
// A list of every intrinsic supported by SkSL.
// Using an X-Macro (https://en.wikipedia.org/wiki/X_Macro) to manage the list.
-#define SKSL_INTRINSIC_LIST \
- SKSL_INTRINSIC(abs) \
- SKSL_INTRINSIC(acosh) \
- SKSL_INTRINSIC(acos) \
- SKSL_INTRINSIC(all) \
- SKSL_INTRINSIC(any) \
- SKSL_INTRINSIC(asinh) \
- SKSL_INTRINSIC(asin) \
- SKSL_INTRINSIC(atanh) \
- SKSL_INTRINSIC(atan) \
- SKSL_INTRINSIC(bitCount) \
- SKSL_INTRINSIC(ceil) \
- SKSL_INTRINSIC(clamp) \
- SKSL_INTRINSIC(cosh) \
- SKSL_INTRINSIC(cos) \
- SKSL_INTRINSIC(cross) \
- SKSL_INTRINSIC(degrees) \
- SKSL_INTRINSIC(determinant) \
- SKSL_INTRINSIC(dFdx) \
- SKSL_INTRINSIC(dFdy) \
- SKSL_INTRINSIC(distance) \
- SKSL_INTRINSIC(dot) \
- SKSL_INTRINSIC(equal) \
- SKSL_INTRINSIC(eval) \
- SKSL_INTRINSIC(exp2) \
- SKSL_INTRINSIC(exp) \
- SKSL_INTRINSIC(faceforward) \
- SKSL_INTRINSIC(findLSB) \
- SKSL_INTRINSIC(findMSB) \
- SKSL_INTRINSIC(floatBitsToInt) \
- SKSL_INTRINSIC(floatBitsToUint) \
- SKSL_INTRINSIC(floor) \
- SKSL_INTRINSIC(fma) \
- SKSL_INTRINSIC(fract) \
- SKSL_INTRINSIC(frexp) \
- SKSL_INTRINSIC(fwidth) \
- SKSL_INTRINSIC(greaterThanEqual) \
- SKSL_INTRINSIC(greaterThan) \
- SKSL_INTRINSIC(intBitsToFloat) \
- SKSL_INTRINSIC(inversesqrt) \
- SKSL_INTRINSIC(inverse) \
- SKSL_INTRINSIC(isinf) \
- SKSL_INTRINSIC(isnan) \
- SKSL_INTRINSIC(ldexp) \
- SKSL_INTRINSIC(length) \
- SKSL_INTRINSIC(lessThanEqual) \
- SKSL_INTRINSIC(lessThan) \
- SKSL_INTRINSIC(log2) \
- SKSL_INTRINSIC(log) \
- SKSL_INTRINSIC(makeSampler2D) \
- SKSL_INTRINSIC(matrixCompMult) \
- SKSL_INTRINSIC(matrixInverse) \
- SKSL_INTRINSIC(max) \
- SKSL_INTRINSIC(min) \
- SKSL_INTRINSIC(mix) \
- SKSL_INTRINSIC(modf) \
- SKSL_INTRINSIC(mod) \
- SKSL_INTRINSIC(normalize) \
- SKSL_INTRINSIC(notEqual) \
- SKSL_INTRINSIC(not ) \
- SKSL_INTRINSIC(outerProduct) \
- SKSL_INTRINSIC(packDouble2x32) \
- SKSL_INTRINSIC(packHalf2x16) \
- SKSL_INTRINSIC(packSnorm2x16) \
- SKSL_INTRINSIC(packSnorm4x8) \
- SKSL_INTRINSIC(packUnorm2x16) \
- SKSL_INTRINSIC(packUnorm4x8) \
- SKSL_INTRINSIC(pow) \
- SKSL_INTRINSIC(radians) \
- SKSL_INTRINSIC(reflect) \
- SKSL_INTRINSIC(refract) \
- SKSL_INTRINSIC(roundEven) \
- SKSL_INTRINSIC(round) \
- SKSL_INTRINSIC(sample) \
- SKSL_INTRINSIC(saturate) \
- SKSL_INTRINSIC(sign) \
- SKSL_INTRINSIC(sinh) \
- SKSL_INTRINSIC(sin) \
- SKSL_INTRINSIC(smoothstep) \
- SKSL_INTRINSIC(sqrt) \
- SKSL_INTRINSIC(step) \
- SKSL_INTRINSIC(subpassLoad) \
- SKSL_INTRINSIC(tanh) \
- SKSL_INTRINSIC(tan) \
- SKSL_INTRINSIC(transpose) \
- SKSL_INTRINSIC(trunc) \
- SKSL_INTRINSIC(uintBitsToFloat) \
- SKSL_INTRINSIC(unpackDouble2x32) \
- SKSL_INTRINSIC(unpackHalf2x16) \
- SKSL_INTRINSIC(unpackSnorm2x16) \
- SKSL_INTRINSIC(unpackSnorm4x8) \
- SKSL_INTRINSIC(unpackUnorm2x16) \
- SKSL_INTRINSIC(unpackUnorm4x8) \
- SKSL_INTRINSIC(toLinearSrgb) \
- SKSL_INTRINSIC(fromLinearSrgb)
-
+#define SKSL_INTRINSIC_LIST \
+ SKSL_INTRINSIC(abs) \
+ SKSL_INTRINSIC(acosh) \
+ SKSL_INTRINSIC(acos) \
+ SKSL_INTRINSIC(all) \
+ SKSL_INTRINSIC(any) \
+ SKSL_INTRINSIC(asinh) \
+ SKSL_INTRINSIC(asin) \
+ SKSL_INTRINSIC(atanh) \
+ SKSL_INTRINSIC(atan) \
+ SKSL_INTRINSIC(bitCount) \
+ SKSL_INTRINSIC(ceil) \
+ SKSL_INTRINSIC(clamp) \
+ SKSL_INTRINSIC(cosh) \
+ SKSL_INTRINSIC(cos) \
+ SKSL_INTRINSIC(cross) \
+ SKSL_INTRINSIC(degrees) \
+ SKSL_INTRINSIC(determinant) \
+ SKSL_INTRINSIC(dFdx) \
+ SKSL_INTRINSIC(dFdy) \
+ SKSL_INTRINSIC(distance) \
+ SKSL_INTRINSIC(dot) \
+ SKSL_INTRINSIC(equal) \
+ SKSL_INTRINSIC(eval) \
+ SKSL_INTRINSIC(exp2) \
+ SKSL_INTRINSIC(exp) \
+ SKSL_INTRINSIC(faceforward) \
+ SKSL_INTRINSIC(findLSB) \
+ SKSL_INTRINSIC(findMSB) \
+ SKSL_INTRINSIC(floatBitsToInt) \
+ SKSL_INTRINSIC(floatBitsToUint) \
+ SKSL_INTRINSIC(floor) \
+ SKSL_INTRINSIC(fma) \
+ SKSL_INTRINSIC(fract) \
+ SKSL_INTRINSIC(frexp) \
+ SKSL_INTRINSIC(fromLinearSrgb) \
+ SKSL_INTRINSIC(fwidth) \
+ SKSL_INTRINSIC(greaterThanEqual) \
+ SKSL_INTRINSIC(greaterThan) \
+ SKSL_INTRINSIC(height) \
+ SKSL_INTRINSIC(intBitsToFloat) \
+ SKSL_INTRINSIC(inversesqrt) \
+ SKSL_INTRINSIC(inverse) \
+ SKSL_INTRINSIC(isinf) \
+ SKSL_INTRINSIC(isnan) \
+ SKSL_INTRINSIC(ldexp) \
+ SKSL_INTRINSIC(length) \
+ SKSL_INTRINSIC(lessThanEqual) \
+ SKSL_INTRINSIC(lessThan) \
+ SKSL_INTRINSIC(log2) \
+ SKSL_INTRINSIC(log) \
+ SKSL_INTRINSIC(makeSampler2D) \
+ SKSL_INTRINSIC(matrixCompMult) \
+ SKSL_INTRINSIC(matrixInverse) \
+ SKSL_INTRINSIC(max) \
+ SKSL_INTRINSIC(min) \
+ SKSL_INTRINSIC(mix) \
+ SKSL_INTRINSIC(modf) \
+ SKSL_INTRINSIC(mod) \
+ SKSL_INTRINSIC(normalize) \
+ SKSL_INTRINSIC(notEqual) \
+ SKSL_INTRINSIC(not) \
+ SKSL_INTRINSIC(outerProduct) \
+ SKSL_INTRINSIC(packDouble2x32) \
+ SKSL_INTRINSIC(packHalf2x16) \
+ SKSL_INTRINSIC(packSnorm2x16) \
+ SKSL_INTRINSIC(packSnorm4x8) \
+ SKSL_INTRINSIC(packUnorm2x16) \
+ SKSL_INTRINSIC(packUnorm4x8) \
+ SKSL_INTRINSIC(pow) \
+ SKSL_INTRINSIC(radians) \
+ SKSL_INTRINSIC(read) \
+ SKSL_INTRINSIC(reflect) \
+ SKSL_INTRINSIC(refract) \
+ SKSL_INTRINSIC(roundEven) \
+ SKSL_INTRINSIC(round) \
+ SKSL_INTRINSIC(sample) \
+ SKSL_INTRINSIC(saturate) \
+ SKSL_INTRINSIC(sign) \
+ SKSL_INTRINSIC(sinh) \
+ SKSL_INTRINSIC(sin) \
+ SKSL_INTRINSIC(smoothstep) \
+ SKSL_INTRINSIC(sqrt) \
+ SKSL_INTRINSIC(step) \
+ SKSL_INTRINSIC(subpassLoad) \
+ SKSL_INTRINSIC(tanh) \
+ SKSL_INTRINSIC(tan) \
+ SKSL_INTRINSIC(threadgroupBarrier) \
+ SKSL_INTRINSIC(toLinearSrgb) \
+ SKSL_INTRINSIC(transpose) \
+ SKSL_INTRINSIC(trunc) \
+ SKSL_INTRINSIC(uintBitsToFloat) \
+ SKSL_INTRINSIC(unpackDouble2x32) \
+ SKSL_INTRINSIC(unpackHalf2x16) \
+ SKSL_INTRINSIC(unpackSnorm2x16) \
+ SKSL_INTRINSIC(unpackSnorm4x8) \
+ SKSL_INTRINSIC(unpackUnorm2x16) \
+ SKSL_INTRINSIC(unpackUnorm4x8) \
+ SKSL_INTRINSIC(width) \
+ SKSL_INTRINSIC(write)
#endif
diff --git a/chromium/third_party/skia/src/sksl/SkSLLexer.cpp b/chromium/third_party/skia/src/sksl/SkSLLexer.cpp
index 76a30174aed..f3b2e971a8f 100644
--- a/chromium/third_party/skia/src/sksl/SkSLLexer.cpp
+++ b/chromium/third_party/skia/src/sksl/SkSLLexer.cpp
@@ -25,9 +25,7 @@ struct FullEntry {
State data[72];
};
struct CompactEntry {
- State v0 : 6;
- State v1 : 9;
- State v2 : 9;
+ uint32_t values;
uint8_t data[18];
};
static constexpr FullEntry kFull[] = {
@@ -35,8 +33,8 @@ static constexpr FullEntry kFull[] = {
0, 2, 3, 4, 5, 7, 9, 14, 16, 19, 20, 21, 23, 26, 27,
30, 35, 41, 60, 60, 60, 60, 60, 60, 62, 63, 64, 68, 70, 74,
75, 84, 84, 84, 84, 84, 84, 84, 84, 84, 85, 86, 87, 84, 90,
- 100, 105, 121, 141, 153, 169, 174, 182, 84, 206, 216, 223, 249, 254, 270,
- 276, 348, 365, 381, 393, 84, 84, 84, 398, 399, 402, 403,
+ 100, 110, 126, 146, 158, 174, 179, 187, 84, 211, 221, 228, 254, 259, 275,
+ 287, 359, 385, 401, 413, 84, 84, 84, 426, 427, 430, 431,
},
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 50, 50, 50, 50, 50, 50, 51,
@@ -61,1891 +59,6799 @@ static constexpr FullEntry kFull[] = {
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10,
10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 0, 0, 0, 10, 106, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 109, 10, 10, 112, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0,
+ 10, 10, 10, 10, 0, 0, 0, 10, 111, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 114, 10, 10, 117, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0,
},
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10,
10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 0, 0, 0, 10, 10, 10, 10, 10, 122, 10, 10, 10, 128, 10,
- 10, 10, 10, 134, 10, 10, 10, 10, 10, 138, 10, 10, 10, 10, 0, 0, 0, 0,
+ 10, 10, 10, 10, 0, 0, 0, 10, 10, 10, 10, 10, 127, 10, 10, 10, 133, 10,
+ 10, 10, 10, 139, 10, 10, 10, 10, 10, 143, 10, 10, 10, 10, 0, 0, 0, 0,
},
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10,
10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10,
10, 10, 10, 10, 0, 0, 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 142, 10, 145, 10, 10, 10, 10, 10, 10, 10, 10, 147, 10, 10, 0, 0, 0, 0,
+ 147, 10, 150, 10, 10, 10, 10, 10, 10, 10, 10, 152, 10, 10, 0, 0, 0, 0,
},
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10,
10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 0, 0, 0, 10, 154, 10, 10, 10, 10, 10, 10, 10, 158, 10,
- 161, 10, 10, 164, 10, 10, 10, 10, 10, 166, 10, 10, 10, 10, 0, 0, 0, 0,
+ 10, 10, 10, 10, 0, 0, 0, 10, 159, 10, 10, 10, 10, 10, 10, 10, 163, 10,
+ 166, 10, 10, 169, 10, 10, 10, 10, 10, 171, 10, 10, 10, 10, 0, 0, 0, 0,
},
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10,
10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10,
10, 10, 10, 10, 0, 0, 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 185, 10, 10, 189, 192, 10, 10, 194, 10, 200, 10, 10, 10, 10, 0, 0, 0, 0,
+ 190, 10, 10, 194, 197, 10, 10, 199, 10, 205, 10, 10, 10, 10, 0, 0, 0, 0,
},
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10,
10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 0, 0, 0, 10, 255, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 259, 10, 10, 266, 10, 10, 10, 10, 10, 0, 0, 0, 0,
+ 10, 10, 10, 10, 0, 0, 0, 10, 260, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 264, 10, 10, 271, 10, 10, 10, 10, 10, 0, 0, 0, 0,
},
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10,
10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 0, 0, 0, 10, 277, 10, 10, 10, 10, 10, 10, 10, 309, 313,
- 10, 10, 10, 10, 10, 10, 10, 331, 339, 10, 343, 10, 10, 10, 0, 0, 0, 0,
+ 10, 10, 10, 10, 0, 0, 0, 10, 288, 10, 10, 10, 10, 10, 10, 10, 320, 324,
+ 10, 10, 10, 10, 10, 10, 10, 342, 350, 10, 354, 10, 10, 10, 0, 0, 0, 0,
},
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10,
- 283, 290, 301, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 10, 306, 10, 10, 10,
+ 294, 301, 312, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 10, 317, 10, 10, 10,
10, 10, 10, 10, 0, 0, 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0,
},
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10,
10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 0, 0, 0, 10, 10, 10, 10, 10, 349, 10, 10, 355, 10, 10,
- 10, 10, 10, 10, 10, 357, 10, 10, 10, 10, 10, 10, 360, 10, 0, 0, 0, 0,
+ 10, 10, 10, 10, 0, 0, 0, 10, 10, 10, 10, 10, 360, 10, 10, 366, 10, 10,
+ 10, 10, 10, 10, 10, 377, 10, 10, 10, 10, 10, 10, 380, 10, 0, 0, 0, 0,
},
};
static constexpr CompactEntry kCompact[] = {
{0,
- 0,
- 0,
{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
}},
- {0,
- 0,
- 3,
+ {3,
{
- 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 195,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
}},
- {0,
- 0,
- 6,
+ {6,
{
- 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 63,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
}},
- {0,
- 0,
- 8,
+ {8,
{
- 0, 0, 0, 0, 0, 0, 0, 192, 255, 255, 192, 255, 255, 255, 255, 255, 255, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 63,
+ 0,
+ 0,
+ 63,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 255,
}},
- {0,
- 0,
- 8,
+ {8,
{
- 0, 0, 0, 0, 252, 255, 0, 192, 255, 255, 192, 255, 255, 255, 255, 255, 255, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 3,
+ 0,
+ 255,
+ 63,
+ 0,
+ 0,
+ 63,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 255,
}},
- {0,
- 10,
- 11,
+ {11 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 0,
- 10,
+ {10,
{
- 0, 0, 0, 0, 252, 255, 0, 192, 255, 255, 192, 255, 255, 255, 255, 255, 255, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 3,
+ 0,
+ 255,
+ 63,
+ 0,
+ 0,
+ 63,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 255,
}},
- {0,
- 10,
- 12,
+ {12 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 171, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 255,
}},
- {0,
- 10,
- 13,
+ {13 | (10 << 9),
{
- 0, 0, 0, 0, 168, 171, 0, 128, 170, 170, 128, 170, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 84,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 0,
- 15,
+ {15,
{
- 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 63,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
}},
- {0,
- 17,
- 18,
+ {18 | (17 << 9),
{
- 0, 0, 2, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 253,
+ 255,
+ 255,
+ 255,
+ 63,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
}},
- {0,
- 0,
- 22,
+ {22,
{
- 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 63,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
}},
- {0,
- 24,
- 25,
+ {25 | (24 << 9),
{
- 0, 0, 0, 2, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 253,
+ 255,
+ 255,
+ 63,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
}},
- {0,
- 28,
- 29,
+ {29 | (28 << 9),
+ {
+ 255,
+ 255,
+ 255,
+ 223,
+ 255,
+ 255,
+ 63,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ }},
+ {31,
{
- 0, 0, 0, 32, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 3,
+ 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
}},
- {0,
- 0,
- 31,
+ {32 | (31 << 9),
{
- 0, 0, 0, 0, 252, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 255,
+ 207,
+ 255,
+ 255,
+ 255,
+ 252,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
}},
- {0,
- 31,
- 32,
+ {34 | (33 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 0, 48, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 221,
+ 3,
+ 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
}},
- {0,
- 33,
- 34,
+ {34,
{
- 0, 0, 0, 34, 252, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 3,
+ 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
}},
- {0,
- 0,
- 34,
+ {40 | (39 << 9) | (36 << 18),
{
- 0, 0, 0, 0, 252, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 191,
+ 255,
+ 253,
+ 255,
+ 63,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
}},
- {36,
- 39,
- 40,
+ {37 | (36 << 9),
+ {
+ 87,
+ 85,
+ 21,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ }},
+ {38 | (36 << 9),
+ {
+ 87,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ }},
+ {39,
+ {
+ 51,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ }},
+ {47 | (43 << 9),
{
- 0, 0, 64, 0, 2, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 255,
+ 207,
+ 255,
+ 255,
+ 255,
+ 252,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
}},
- {0,
- 36,
- 37,
+ {44 | (43 << 9),
{
- 168,
- 170,
- 234,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 255,
+ 207,
+ 255,
+ 255,
+ 255,
+ 252,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
}},
- {0,
- 36,
- 38,
+ {46 | (45 << 9),
{
- 168,
- 170,
- 170,
- 170,
+ 255,
+ 255,
+ 255,
+ 221,
+ 3,
+ 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ }},
+ {46,
+ {
+ 255,
+ 255,
+ 255,
+ 255,
+ 3,
+ 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ }},
+ {49 | (48 << 9),
+ {
+ 255,
+ 255,
+ 255,
+ 221,
+ 3,
+ 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ }},
+ {49,
+ {
+ 255,
+ 255,
+ 255,
+ 255,
+ 3,
+ 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ }},
+ {54 | (53 << 9),
+ {
+ 255,
+ 255,
+ 255,
+ 221,
+ 3,
+ 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ }},
+ {54,
+ {
+ 255,
+ 255,
+ 255,
+ 255,
+ 3,
+ 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ }},
+ {59,
+ {
+ 255,
+ 255,
+ 255,
+ 255,
+ 3,
+ 0,
+ 255,
+ 63,
+ 192,
+ 255,
+ 255,
+ 0,
+ 240,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ }},
+ {59 | (57 << 9),
+ {
+ 255,
+ 255,
+ 255,
+ 255,
+ 3,
+ 0,
+ 255,
+ 63,
+ 192,
+ 223,
+ 255,
+ 0,
+ 240,
+ 255,
+ 255,
+ 223,
+ 255,
+ 255,
+ }},
+ {67 | (65 << 9),
+ {
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 31,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ }},
+ {66,
+ {
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 63,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ }},
+ {69,
+ {
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 63,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ }},
+ {72 | (71 << 9),
+ {
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 127,
+ 252,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ }},
+ {73,
+ {
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 63,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ }},
+ {78 | (76 << 9),
+ {
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 253,
+ 255,
+ 252,
+ 255,
+ 255,
+ }},
+ {77,
+ {
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 243,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ }},
+ {79,
+ {
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 252,
+ 255,
+ }},
+ {80,
+ {
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 252,
+ 255,
+ 255,
+ 255,
+ 255,
+ }},
+ {81,
+ {
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 243,
+ 255,
+ 255,
+ }},
+ {82,
+ {
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 207,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ }},
+ {83,
+ {
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 63,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ }},
+ {89 | (88 << 9),
+ {
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 127,
+ 255,
+ 255,
+ 255,
+ 207,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ }},
+ {93 | (91 << 9) | (10 << 18),
+ {
+ 255,
+ 255,
+ 255,
+ 255,
171,
170,
+ 255,
+ 191,
170,
170,
+ 191,
170,
170,
170,
170,
+ 161,
170,
- 170,
- 170,
- 170,
- 170,
- 170,
+ 255,
}},
- {0,
- 0,
- 39,
+ {92 | (10 << 9),
{
- 204,
255,
255,
255,
255,
+ 87,
+ 85,
255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 21,
+ 85,
+ 85,
+ 85,
255,
+ }},
+ {94 | (10 << 9),
+ {
255,
255,
255,
255,
+ 87,
+ 85,
255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 255,
+ }},
+ {95 | (10 << 9),
+ {
255,
255,
255,
255,
+ 87,
+ 85,
255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 21,
+ 85,
+ 85,
255,
}},
- {0,
- 43,
- 47,
- {
- 0, 0, 0, 0, 168, 170, 0, 0, 48, 0, 0, 0, 3, 0, 0, 0, 0, 0,
- }},
- {0,
- 43,
- 44,
- {
- 0, 0, 0, 0, 168, 170, 0, 0, 48, 0, 0, 0, 3, 0, 0, 0, 0, 0,
- }},
- {0,
- 45,
- 46,
- {
- 0, 0, 0, 34, 252, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- }},
- {0,
- 0,
- 46,
+ {96 | (10 << 9),
{
- 0, 0, 0, 0, 252, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 48,
- 49,
+ {97 | (10 << 9),
{
- 0, 0, 0, 34, 252, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 81,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 0,
- 49,
+ {98 | (10 << 9),
{
- 0, 0, 0, 0, 252, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 255,
}},
- {0,
- 53,
- 54,
+ {99 | (10 << 9),
{
- 0, 0, 0, 34, 252, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 255,
}},
- {0,
- 0,
- 54,
+ {92 | (10 << 9),
{
- 0, 0, 0, 0, 252, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 0,
- 59,
+ {105 | (101 << 9) | (10 << 18),
{
- 0, 0, 0, 0, 252, 255, 0, 192, 63, 0, 0, 255, 15, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 171,
+ 170,
+ 255,
+ 191,
+ 170,
+ 170,
+ 191,
+ 170,
+ 170,
+ 170,
+ 106,
+ 138,
+ 170,
+ 255,
}},
- {0,
- 57,
- 59,
+ {102 | (10 << 9),
{
- 0, 0, 0, 0, 252, 255, 0, 192, 63, 32, 0, 255, 15, 0, 0, 32, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 65,
- 67,
+ {103 | (10 << 9),
{
- 0, 0, 0, 0, 0, 0, 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 0,
- 66,
+ {104 | (10 << 9),
{
- 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 81,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 0,
- 69,
+ {106 | (10 << 9),
{
- 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 81,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 71,
- 72,
+ {107 | (10 << 9),
{
- 0, 0, 0, 0, 0, 0, 128, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 81,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 0,
- 73,
+ {108 | (10 << 9),
{
- 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 76,
- 78,
+ {109 | (10 << 9),
{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 3, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 21,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 0,
- 77,
+ {112 | (10 << 9),
{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 255,
}},
- {0,
- 0,
- 79,
+ {113 | (92 << 9) | (10 << 18),
{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 171,
+ 170,
+ 255,
+ 191,
+ 170,
+ 170,
+ 191,
+ 170,
+ 168,
+ 170,
+ 170,
+ 166,
+ 170,
+ 255,
}},
- {0,
- 0,
- 80,
+ {115 | (10 << 9),
{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 0,
- 81,
+ {116 | (10 << 9),
{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 255,
}},
- {0,
- 0,
- 82,
+ {92 | (10 << 9),
{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 255,
}},
- {0,
- 0,
- 83,
+ {118 | (10 << 9),
{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 88,
- 89,
+ {121 | (119 << 9) | (10 << 18),
{
- 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 171,
+ 170,
+ 255,
+ 191,
+ 170,
+ 170,
+ 191,
+ 170,
+ 170,
+ 170,
+ 170,
+ 161,
+ 170,
+ 255,
}},
- {10,
- 91,
- 93,
+ {120 | (10 << 9),
{
- 0, 0, 0, 0, 84, 85, 0, 64, 85, 85, 64, 85, 85, 85, 85, 94, 85, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 255,
}},
- {0,
- 10,
- 92,
+ {122 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 234, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 94,
+ {123 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 174, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 95,
+ {124 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 234, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 255,
}},
- {0,
- 10,
- 96,
+ {125 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 171, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 97,
+ {128 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 174, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 81,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 98,
+ {129 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 186, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 99,
+ {130 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 174, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 255,
}},
- {0,
- 10,
- 92,
+ {131 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 101,
+ {132 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 234, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 255,
}},
- {0,
- 10,
- 102,
+ {134 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 255,
}},
- {0,
- 10,
- 103,
+ {135 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 171, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 69,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 104,
+ {136 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 174, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 107,
+ {137 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 171, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 21,
+ 85,
+ 85,
+ 255,
}},
- {10,
- 92,
- 108,
+ {138 | (10 << 9),
{
- 0, 0, 0, 0, 84, 85, 0, 64, 85, 85, 64, 85, 87, 85, 85, 89, 85, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 21,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 110,
+ {140 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 171, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 255,
}},
- {0,
- 10,
- 111,
+ {141 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 171, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 81,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 92,
+ {142 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 171, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 113,
+ {144 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 171, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {10,
- 114,
- 116,
+ {145 | (10 << 9),
{
- 0, 0, 0, 0, 84, 85, 0, 64, 85, 85, 64, 85, 85, 85, 85, 94, 85, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 69,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 115,
+ {92 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 174, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 23,
+ 80,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 117,
+ {148 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 171, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 255,
}},
- {0,
- 10,
- 118,
+ {149 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 171, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 119,
+ {151 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 186, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 255,
}},
- {0,
- 10,
- 120,
+ {153 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 255,
}},
- {0,
- 10,
- 123,
+ {154 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 174, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 124,
+ {155 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 171, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 21,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 125,
+ {156 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 186, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 126,
+ {157 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 186, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 127,
+ {92 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 174, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 129,
+ {160 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 171, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 130,
+ {161 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 186, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 255,
}},
- {0,
- 10,
- 131,
+ {162 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 171, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 132,
+ {164 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 234, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 81,
+ 255,
}},
- {0,
- 10,
- 133,
+ {165 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 234, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 135,
+ {92 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 186, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 21,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 136,
+ {167 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 174, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 137,
+ {168 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 186, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 255,
}},
- {0,
- 10,
- 139,
+ {170 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 21,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 140,
+ {172 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 186, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 92,
+ {173 | (10 << 9),
{
- 0, 0, 0, 0, 232, 175, 0, 128, 170, 170, 128, 170, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 69,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 143,
+ {177 | (175 << 9) | (10 << 18),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 171, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 171,
+ 170,
+ 255,
+ 191,
+ 170,
+ 170,
+ 191,
+ 170,
+ 170,
+ 154,
+ 162,
+ 170,
+ 170,
+ 255,
}},
- {0,
- 10,
- 144,
+ {176 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 63,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 146,
+ {176,
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 186, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 3,
+ 0,
+ 255,
+ 63,
+ 0,
+ 0,
+ 63,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 255,
}},
- {0,
- 10,
- 148,
+ {178 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 174, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 255,
}},
- {0,
- 10,
- 149,
+ {92 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 150,
+ {184 | (180 << 9) | (10 << 18),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 234, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 171,
+ 170,
+ 255,
+ 191,
+ 170,
+ 170,
+ 191,
+ 170,
+ 170,
+ 169,
+ 170,
+ 42,
+ 170,
+ 255,
}},
- {0,
- 10,
- 151,
+ {181 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 171, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 69,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 152,
+ {182 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 171, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 21,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 92,
+ {183 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 186, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 155,
+ {185 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 186, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 156,
+ {186 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 171, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 69,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 157,
+ {189 | (188 << 9) | (10 << 18),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 171,
+ 170,
+ 255,
+ 191,
+ 170,
+ 170,
+ 191,
+ 170,
+ 166,
+ 170,
+ 168,
+ 170,
+ 170,
+ 255,
}},
- {0,
- 10,
- 159,
+ {191 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 170, 174, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 160,
+ {192 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 92,
+ {193 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 234, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 162,
+ {195 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 171, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 255,
}},
- {0,
- 10,
- 163,
+ {196 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 174, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 255,
}},
- {0,
- 10,
- 165,
+ {198 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 234, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 255,
}},
- {0,
- 10,
- 167,
+ {92 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 255,
}},
- {0,
- 10,
- 168,
+ {200 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 186, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {10,
- 170,
- 172,
+ {201 | (10 << 9),
{
- 0, 0, 0, 0, 84, 85, 0, 64, 85, 85, 64, 85, 85, 101, 93, 85, 85, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 21,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 171,
+ {202 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 192, 170, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 81,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 0,
- 171,
+ {203 | (10 << 9),
{
- 0, 0, 0, 0, 252, 255, 0, 192, 255, 255, 192, 255, 255, 255, 255, 255, 255, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 173,
+ {204 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 174, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 69,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 92,
+ {206 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 174, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {10,
- 175,
- 179,
+ {207 | (10 << 9),
{
- 0, 0, 0, 0, 84, 85, 0, 64, 85, 85, 64, 85, 85, 86, 85, 213, 85, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 21,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 176,
+ {208 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 186, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 177,
+ {209 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 234, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 178,
+ {210 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 186, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 180,
+ {217 | (212 << 9) | (10 << 18),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 171,
+ 170,
+ 255,
+ 191,
+ 170,
+ 170,
+ 191,
+ 169,
+ 170,
+ 170,
+ 162,
+ 170,
+ 170,
+ 255,
}},
- {0,
- 10,
- 181,
+ {213 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 186, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 69,
+ 255,
}},
- {10,
- 183,
- 184,
+ {214 | (10 << 9),
{
- 0, 0, 0, 0, 84, 85, 0, 64, 85, 85, 64, 85, 89, 85, 87, 85, 85, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 186,
+ {215 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 171, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 255,
}},
- {0,
- 10,
- 187,
+ {216 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 171, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 255,
}},
- {0,
- 10,
- 188,
+ {219 | (218 << 9) | (10 << 18),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 171,
+ 170,
+ 255,
+ 191,
+ 170,
+ 170,
+ 191,
+ 170,
+ 170,
+ 170,
+ 169,
+ 170,
+ 168,
+ 255,
}},
- {0,
- 10,
- 190,
+ {92 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 186, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 69,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 191,
+ {220 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 174, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 193,
+ {222 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 186, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 92,
+ {223 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 174, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 21,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 195,
+ {224 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 196,
+ {225 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 234, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 255,
}},
- {0,
- 10,
- 197,
+ {226 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 174, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 21,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 198,
+ {227 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 171, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 199,
+ {236 | (229 << 9) | (10 << 18),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 186, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 171,
+ 170,
+ 255,
+ 191,
+ 170,
+ 170,
+ 191,
+ 169,
+ 170,
+ 170,
+ 162,
+ 170,
+ 170,
+ 255,
}},
- {0,
- 10,
- 201,
+ {230 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 171, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 21,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 202,
+ {231 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 234, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 203,
+ {232 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 171, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 255,
}},
- {0,
- 10,
- 204,
+ {233 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 171, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 205,
+ {234 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 171, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {10,
- 207,
- 212,
+ {235 | (10 << 9),
{
- 0, 0, 0, 0, 84, 85, 0, 64, 85, 85, 64, 86, 85, 85, 93, 85, 85, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 69,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 208,
+ {243 | (237 << 9) | (10 << 18),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 170, 186, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 171,
+ 170,
+ 255,
+ 191,
+ 170,
+ 170,
+ 191,
+ 170,
+ 170,
+ 169,
+ 138,
+ 170,
+ 170,
+ 255,
}},
- {0,
- 10,
- 209,
+ {238 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 174, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 210,
+ {239 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 186, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 211,
+ {240 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 174, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {10,
- 213,
- 214,
+ {241 | (10 << 9),
{
- 0, 0, 0, 0, 84, 85, 0, 64, 85, 85, 64, 85, 85, 85, 86, 85, 87, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 92,
+ {242 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 186, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 215,
+ {244 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 186, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 217,
+ {245 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 21,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 218,
+ {246 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 234, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 255,
}},
- {0,
- 10,
- 219,
+ {247 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 171, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 220,
+ {248 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 186, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 221,
+ {249 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 234, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 69,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 222,
+ {250 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 186, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 255,
}},
- {10,
- 224,
- 231,
+ {251 | (10 << 9),
{
- 0, 0, 0, 0, 84, 85, 0, 64, 85, 85, 64, 86, 85, 85, 93, 85, 85, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 225,
+ {252 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 234, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 21,
+ 85,
+ 255,
}},
- {0,
- 10,
- 226,
+ {253 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 227,
+ {255 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 171, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 255,
}},
- {0,
- 10,
- 228,
+ {256 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 186, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 255,
}},
- {0,
- 10,
- 229,
+ {257 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 171, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 230,
+ {258 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 186, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 255,
}},
- {10,
- 232,
- 238,
+ {261 | (10 << 9),
{
- 0, 0, 0, 0, 84, 85, 0, 64, 85, 85, 64, 85, 85, 86, 117, 85, 85, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 69,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 233,
+ {262 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 171, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 81,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 234,
+ {263 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 186, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 235,
+ {265 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 171, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 236,
+ {266 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 171, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 69,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 237,
+ {267 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 239,
+ {268 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 255,
}},
- {0,
- 10,
- 240,
+ {269 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 234, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 241,
+ {270 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 171, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 242,
+ {92 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 186, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 243,
+ {272 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 81,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 244,
+ {273 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 186, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 245,
+ {274 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 174, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 246,
+ {92 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 171, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 69,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 247,
+ {276 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 234, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 248,
+ {283 | (277 << 9) | (10 << 18),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 171,
+ 170,
+ 255,
+ 191,
+ 170,
+ 170,
+ 191,
+ 169,
+ 170,
+ 170,
+ 170,
+ 162,
+ 170,
+ 255,
}},
- {0,
- 10,
- 250,
+ {278 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 186, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 21,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 251,
+ {279 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 174, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 252,
+ {280 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 186, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 253,
+ {281 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 186, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 256,
+ {282 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 186, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 69,
+ 255,
}},
- {0,
- 10,
- 257,
+ {284 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 174, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 255,
}},
- {0,
- 10,
- 258,
+ {285 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 21,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 260,
+ {286 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 261,
+ {289 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 186, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 21,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 262,
+ {290 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 171, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 263,
+ {291 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 171, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 264,
+ {292 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 171, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 265,
+ {293 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 174, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 21,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 92,
+ {295 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 171, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 81,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 267,
+ {296 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 174, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 81,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 268,
+ {297 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 186, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 21,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 269,
+ {298 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 171, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 92,
+ {299 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 186, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 21,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 271,
+ {300 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 272,
+ {92 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 174, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 84,
+ 255,
}},
- {0,
- 10,
- 273,
+ {302 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 186, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 81,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 274,
+ {303 | (296 << 9) | (10 << 18),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 234, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 171,
+ 170,
+ 255,
+ 191,
+ 170,
+ 164,
+ 191,
+ 170,
+ 170,
+ 170,
+ 170,
+ 170,
+ 170,
+ 255,
}},
- {0,
- 10,
- 275,
+ {304 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 171, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 278,
+ {305 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 234, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 69,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 279,
+ {306 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 186, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 255,
}},
- {0,
- 10,
- 280,
+ {307 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 186, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 81,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 281,
+ {308 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 21,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 282,
+ {309 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 234, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 284,
+ {310 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 174, 170, 128, 170, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 21,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 285,
+ {311 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 174, 128, 170, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 286,
+ {313 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 234, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 81,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 287,
+ {314 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 171, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 84,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 288,
+ {315 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 234, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 289,
+ {316 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 174, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 69,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 92,
+ {318 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 170, 171, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 255,
}},
- {0,
- 10,
- 291,
+ {319 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 174, 170, 128, 170, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 81,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {10,
- 285,
- 292,
+ {321 | (10 << 9),
{
- 0, 0, 0, 0, 84, 85, 0, 64, 85, 91, 64, 85, 85, 85, 85, 85, 85, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 21,
+ 255,
}},
- {0,
- 10,
- 293,
+ {322 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 294,
+ {323 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 186, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 295,
+ {92 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 174, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 81,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 296,
+ {325 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 174, 128, 170, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 63,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 297,
+ {326 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 234, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 21,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 298,
+ {327 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 171, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 299,
+ {328 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 234, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 255,
}},
- {0,
- 10,
- 300,
+ {329 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 174, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 63,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 302,
+ {330 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 174, 170, 128, 170, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 255,
}},
- {0,
- 10,
- 303,
+ {331 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 171, 128, 170, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 304,
+ {332 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 21,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 305,
+ {333 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 186, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 307,
+ {334 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 186, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 63,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 308,
+ {335 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 174, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 310,
+ {336 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 170, 234, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 81,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 311,
+ {337 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 81,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 312,
+ {338 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 174, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 92,
+ {339 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 174, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 69,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 314,
+ {340 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 192, 170, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 255,
}},
- {0,
- 10,
- 315,
+ {341 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 234, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 255,
}},
- {0,
- 10,
- 316,
+ {346 | (343 << 9) | (10 << 18),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 171, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 171,
+ 170,
+ 255,
+ 191,
+ 170,
+ 170,
+ 191,
+ 169,
+ 170,
+ 170,
+ 42,
+ 170,
+ 170,
+ 255,
}},
- {0,
- 10,
- 317,
+ {344 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 171, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 255,
}},
- {0,
- 10,
- 318,
+ {345 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 192, 170, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 319,
+ {347 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 171, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 255,
}},
- {0,
- 10,
- 320,
+ {348 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 171, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 69,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 321,
+ {349 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 234, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 255,
}},
- {0,
- 10,
- 322,
+ {351 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 323,
+ {352 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 192, 170, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 324,
+ {353 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 21,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 325,
+ {92 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 174, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 326,
+ {355 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 174, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 327,
+ {356 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 255,
}},
- {0,
- 10,
- 328,
+ {357 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 186, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 69,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 329,
+ {358 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 174, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 21,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 330,
+ {361 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 171, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 21,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {10,
- 332,
- 335,
+ {362 | (10 << 9),
{
- 0, 0, 0, 0, 84, 85, 0, 64, 85, 85, 64, 86, 85, 85, 213, 85, 85, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 333,
+ {363 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 174, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 334,
+ {364 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 171, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 336,
+ {365 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 186, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 255,
}},
- {0,
- 10,
- 337,
+ {368 | (367 << 9) | (10 << 18),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 186, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 171,
+ 170,
+ 255,
+ 191,
+ 170,
+ 170,
+ 191,
+ 170,
+ 170,
+ 169,
+ 42,
+ 170,
+ 170,
+ 255,
}},
- {0,
- 10,
- 338,
+ {369 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 174, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 340,
+ {370 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 186, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 341,
+ {371 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 21,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 342,
+ {372 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 234, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 69,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 92,
+ {373 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 186, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 21,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 344,
+ {374 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 171, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 345,
+ {375 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 174, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 255,
}},
- {0,
- 10,
- 346,
+ {376 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 186, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 347,
+ {378 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 234, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 255,
}},
- {0,
- 10,
- 350,
+ {379 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 234, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 351,
+ {381 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 186, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 352,
+ {382 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 186, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 353,
+ {383 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 171, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 21,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 354,
+ {384 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 174, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 356,
+ {398 | (386 << 9) | (10 << 18),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 171, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 171,
+ 170,
+ 255,
+ 191,
+ 170,
+ 170,
+ 191,
+ 170,
+ 170,
+ 170,
+ 169,
+ 168,
+ 170,
+ 255,
}},
- {0,
- 10,
- 358,
+ {393 | (387 << 9) | (10 << 18),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 186, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 171,
+ 170,
+ 255,
+ 191,
+ 170,
+ 170,
+ 191,
+ 170,
+ 170,
+ 169,
+ 170,
+ 168,
+ 170,
+ 255,
}},
- {0,
- 10,
- 359,
+ {392 | (388 << 9) | (10 << 18),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 171,
+ 170,
+ 255,
+ 191,
+ 170,
+ 170,
+ 191,
+ 170,
+ 166,
+ 170,
+ 162,
+ 170,
+ 170,
+ 255,
}},
- {0,
- 10,
- 361,
+ {389 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 186, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 362,
+ {390 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 21,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 363,
+ {391 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 234, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 21,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 364,
+ {394 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {10,
- 366,
- 378,
+ {395 | (10 << 9),
{
- 0, 0, 0, 0, 84, 85, 0, 64, 85, 85, 64, 85, 85, 85, 86, 87, 85, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 69,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {10,
- 367,
- 373,
+ {396 | (10 << 9),
{
- 0, 0, 0, 0, 84, 85, 0, 64, 85, 85, 64, 85, 85, 86, 85, 87, 85, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 255,
}},
- {10,
- 368,
- 372,
+ {397 | (10 << 9),
{
- 0, 0, 0, 0, 84, 85, 0, 64, 85, 85, 64, 85, 89, 85, 93, 85, 85, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 369,
+ {399 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 174, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 370,
+ {400 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 234, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 371,
+ {407 | (402 << 9) | (10 << 18),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 234, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 171,
+ 170,
+ 255,
+ 191,
+ 170,
+ 170,
+ 191,
+ 169,
+ 170,
+ 170,
+ 162,
+ 170,
+ 170,
+ 255,
}},
- {0,
- 10,
- 374,
+ {403 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 171, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 21,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 375,
+ {404 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 186, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 69,
+ 255,
}},
- {0,
- 10,
- 376,
+ {405 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 171, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 377,
+ {406 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 379,
+ {408 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 171, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 380,
+ {409 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 171, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {10,
- 382,
- 387,
+ {410 | (10 << 9),
{
- 0, 0, 0, 0, 84, 85, 0, 64, 85, 85, 64, 86, 85, 85, 93, 85, 85, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 255,
}},
- {0,
- 10,
- 383,
+ {411 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 234, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 384,
+ {412 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 170, 186, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 385,
+ {418 | (414 << 9) | (10 << 18),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 171, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 171,
+ 170,
+ 255,
+ 191,
+ 170,
+ 170,
+ 191,
+ 170,
+ 106,
+ 170,
+ 42,
+ 170,
+ 170,
+ 255,
}},
- {0,
- 10,
- 386,
+ {415 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 171, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 388,
+ {416 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 186, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 389,
+ {417 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 171, 170, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 390,
+ {419 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 170, 170, 174, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 391,
+ {420 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 171, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 255,
}},
- {0,
- 10,
- 392,
+ {421 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 186, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 84,
+ 85,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 394,
+ {422 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 234, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 81,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 395,
+ {423 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 171, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 84,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 396,
+ {424 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 170, 186, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 69,
+ 85,
+ 85,
+ 85,
+ 255,
}},
- {0,
- 10,
- 397,
+ {425 | (10 << 9),
{
- 0, 0, 0, 0, 168, 170, 0, 128, 170, 170, 128, 170, 171, 170, 170, 170, 170, 0,
+ 255,
+ 255,
+ 255,
+ 255,
+ 87,
+ 85,
+ 255,
+ 127,
+ 85,
+ 85,
+ 127,
+ 85,
+ 85,
+ 85,
+ 85,
+ 85,
+ 69,
+ 255,
}},
- {0,
- 400,
- 401,
+ {429 | (428 << 9),
{
- 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 127,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 255,
+ 243,
}},
};
static constexpr IndexEntry kIndices[] = {
@@ -1954,24 +6860,25 @@ static constexpr IndexEntry kIndices[] = {
19, 20, 0, 21, 0, -2, 22, 23, 24, 25, 25, 26, 27, 27, -3, -4, 28, 29,
29, 0, 0, 0, 30, 31, -5, -5, 0, 0, 32, 33, 0, 0, 34, 0, 35, 0,
36, 0, 0, 37, 38, 0, 39, 40, 41, 42, 43, 0, 6, 0, 0, 44, 0, 0,
- 45, 46, 6, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 6, -6, 58, 59,
- 6, 60, 61, 62, 63, 64, 65, 6, 66, 67, 68, 69, 6, -7, 70, 71, 72, 73,
- 74, 6, 75, 76, 77, 78, 79, 6, 80, 81, 82, 53, 83, 84, 85, -8, 86, 87,
- 6, 88, 46, 89, 90, 91, 92, 93, 94, -9, 95, 96, 97, 6, 98, 99, 100, 101,
- 102, 6, 103, 6, 104, 105, 85, 106, 107, 108, 109, 110, 111, 112, 113, 114, 6, 115,
- 116, 85, 117, 6, -10, 118, 119, 120, 6, 121, 122, 6, 123, 124, 125, 126, 127, 128,
- 129, 53, 130, 131, 132, 133, 134, 124, 135, 136, 137, 138, 139, 6, 140, 141, 142, 6,
- 143, 144, 145, 146, 147, 148, 6, 149, 150, 151, 152, 153, 154, 155, 53, 156, 157, 158,
- 159, 160, 161, 6, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 6, 172, 173, 174,
- 175, 124, -11, 176, 177, 178, 100, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
- 190, 191, 192, 193, 194, 6, -12, 195, 196, 197, 198, 199, -13, 200, 201, 202, 203, 204,
- 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 206, 217, 218, 219, 220, 124,
- 221, 222, 53, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237,
- 238, 239, 240, 241, 242, 243, 6, 244, 245, 246, 189, 247, 248, 249, 6, 250, 251, 252,
- 253, 254, 255, 256, 257, 6, -14, 258, 259, 260, 261, 262, 53, 263, 62, 264, 265, 6,
- 266, 267, 268, 269, 226, 270, 271, 272, 273, 274, 275, 6, 185, 276, 277, 278, 279, 100,
- 280, 281, 141, 282, 283, 284, 285, 286, 141, 287, 288, 289, 290, 291, 53, 292, 293, 294,
- 295, 6, 0, 296, 0, 0, 0, 0,
+ 45, 46, 6, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 6, 58, 59, 60,
+ 61, 6, -6, 62, 63, 6, 64, 65, 66, 67, 68, 69, 6, 70, 71, 72, 73, 6,
+ -7, 74, 75, 76, 77, 78, 6, 79, 80, 81, 82, 83, 6, 84, 85, 86, 53, 87,
+ 88, 89, -8, 90, 91, 6, 92, 46, 93, 94, 95, 96, 97, 98, -9, 99, 100, 101,
+ 6, 102, 103, 104, 105, 106, 6, 107, 6, 108, 109, 89, 110, 111, 112, 113, 114, 115,
+ 116, 117, 118, 6, 119, 120, 89, 121, 6, -10, 122, 123, 124, 6, 125, 126, 6, 127,
+ 128, 129, 130, 131, 132, 133, 53, 134, 135, 136, 137, 138, 128, 139, 140, 141, 142, 143,
+ 6, 144, 145, 146, 6, 147, 148, 149, 150, 151, 152, 6, 153, 154, 155, 156, 157, 158,
+ 159, 53, 160, 161, 162, 163, 164, 165, 6, 166, 167, 168, 169, 170, 171, 172, 173, 174,
+ 175, 6, 176, 177, 178, 179, 128, -11, 180, 181, 182, 104, 183, 184, 185, 186, 187, 188,
+ 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 6, 201, 202, 203, 6, -12,
+ 204, 205, 206, 207, 208, -13, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220,
+ 221, 222, 223, 224, 225, 215, 226, 227, 228, 229, 128, 230, 231, 53, 232, 233, 234, 235,
+ 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 6,
+ 253, 254, 255, 193, 256, 257, 258, 6, 259, 260, 261, 262, 263, 264, 265, 266, 6, -14,
+ 267, 268, 269, 270, 271, 53, 272, 66, 273, 274, 275, 276, 277, 278, 279, 280, 6, 281,
+ 282, 6, 283, 284, 285, 286, 235, 287, 288, 289, 290, 291, 292, 6, 189, 293, 294, 295,
+ 296, 104, 297, 298, 145, 299, 300, 301, 302, 303, 145, 304, 305, 306, 307, 308, 53, 309,
+ 310, 311, 312, 6, 313, 314, 315, 316, 317, 318, 319, 6, 0, 320, 0, 0, 0, 0,
};
State get_transition(int transition, int state) {
IndexEntry index = kIndices[state];
@@ -1979,31 +6886,32 @@ State get_transition(int transition, int state) {
return kFull[~index].data[transition];
}
const CompactEntry& entry = kCompact[index];
- int value = entry.data[transition >> 2];
- value >>= 2 * (transition & 3);
- value &= 3;
- State table[] = {0, entry.v0, entry.v1, entry.v2};
- return table[value];
+ int v = entry.data[transition >> 2];
+ v >>= 2 * (transition & 3);
+ v &= 3;
+ v *= 9;
+ return (entry.values >> v) & 511;
}
-static const int8_t kAccepts[404] = {
- -1, -1, 84, 84, 87, 63, 68, 87, 38, 37, 37, 37, 37, 35, 53, 77, 58, 62, 82, 39, 40, 51, 75,
- 49, 47, 73, 46, 50, 48, 74, 45, 1, -1, -1, 1, 52, -1, -1, 86, 85, 76, 2, 1, 1, -1, -1,
- 1, -1, -1, 1, 2, 3, -1, -1, 1, 3, 2, 2, -1, 2, 2, 2, 65, 83, 70, 54, 78, 72, 66,
- 67, 69, 71, 55, 79, 64, 87, -1, 7, -1, -1, -1, -1, -1, 13, 37, 43, 44, 57, 81, 61, 37, 37,
- 36, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 16, 37, 37, 37, 14, 37, 37, 37, 37, 37, 37,
- 24, 37, 37, 37, 37, 17, 37, 37, 37, 37, 37, 37, 15, 37, 37, 37, 37, 37, 18, 11, 37, 37, 37,
- 37, 37, 37, 37, 37, 37, 8, 37, 37, 37, 37, 37, 37, 36, 37, 37, 37, 37, 37, 5, 37, 37, 37,
- 37, 37, 25, 37, 9, 37, 37, 37, 37, 37, 36, 37, 37, 37, 37, 37, 37, 32, 37, 37, 37, 37, 6,
- 20, 37, 37, 37, 27, 37, 37, 22, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
- 37, 37, 37, 37, 31, 37, 37, 37, 34, 37, 37, 37, 37, 37, 37, 33, 37, 37, 37, 37, 37, 37, 37,
- 37, 37, 37, 37, 37, 37, 37, 28, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 26, 37, 37, 21, 37,
- 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 19,
- 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
- 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
- 37, 37, 37, 37, 37, 37, 37, 37, 29, 37, 37, 37, 37, 37, 37, 37, 30, 37, 37, 37, 37, 37, 37,
- 37, 37, 12, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 4, 37, 37, 37, 37, 37, 37, 37, 37,
- 37, 37, 37, 23, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
- 37, 37, 37, 37, 37, 37, 10, 41, 56, 80, 60, 42, 59,
+static const int8_t kAccepts[432] = {
+ -1, -1, 88, 88, 91, 67, 72, 91, 42, 41, 41, 41, 41, 38, 57, 81, 62, 66, 86, 43, 44, 55, 79,
+ 53, 51, 77, 50, 54, 52, 78, 49, 1, -1, -1, 1, 56, -1, -1, 90, 89, 80, 2, 1, 1, -1, -1,
+ 1, -1, -1, 1, 2, 3, -1, -1, 1, 3, 2, 2, -1, 2, 2, 2, 69, 87, 74, 58, 82, 76, 70,
+ 71, 73, 75, 59, 83, 68, 91, -1, 7, -1, -1, -1, -1, -1, 13, 41, 47, 48, 61, 85, 65, 41, 41,
+ 40, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 16, 41, 41, 41, 41, 32, 41, 41, 41, 14, 41,
+ 41, 41, 41, 41, 41, 24, 41, 41, 41, 41, 17, 41, 41, 41, 41, 41, 41, 15, 41, 41, 41, 41, 41,
+ 18, 11, 41, 41, 41, 41, 41, 41, 41, 41, 41, 8, 41, 41, 41, 41, 41, 41, 40, 41, 41, 41, 41,
+ 41, 5, 41, 41, 41, 41, 41, 25, 41, 9, 41, 41, 41, 41, 41, 40, 41, 41, 41, 41, 41, 41, 35,
+ 41, 41, 41, 41, 6, 20, 41, 41, 41, 27, 41, 41, 22, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
+ 41, 41, 41, 41, 41, 41, 41, 41, 41, 34, 41, 41, 41, 37, 41, 41, 41, 41, 41, 41, 36, 41, 41,
+ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 28, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
+ 26, 41, 41, 21, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
+ 41, 41, 41, 41, 41, 41, 30, 41, 41, 41, 19, 41, 41, 41, 41, 41, 41, 41, 41, 40, 41, 41, 41,
+ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 40, 41, 41, 41, 41, 41, 41, 41, 41,
+ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 29, 41, 41, 41,
+ 41, 41, 41, 41, 33, 41, 41, 41, 41, 41, 41, 41, 41, 12, 41, 41, 41, 41, 41, 41, 41, 41, 41,
+ 41, 41, 41, 41, 41, 41, 41, 41, 39, 41, 41, 4, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
+ 23, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
+ 41, 41, 41, 10, 41, 41, 41, 41, 41, 41, 41, 31, 45, 60, 84, 64, 46, 63,
};
Token Lexer::next() {
diff --git a/chromium/third_party/skia/src/sksl/SkSLLexer.h b/chromium/third_party/skia/src/sksl/SkSLLexer.h
index 6d1e0868124..7d959d2e9b4 100644
--- a/chromium/third_party/skia/src/sksl/SkSLLexer.h
+++ b/chromium/third_party/skia/src/sksl/SkSLLexer.h
@@ -45,12 +45,16 @@ struct Token {
TK_INLINE,
TK_NOINLINE,
TK_HASSIDEEFFECTS,
+ TK_READONLY,
+ TK_WRITEONLY,
+ TK_BUFFER,
TK_STRUCT,
TK_LAYOUT,
TK_HIGHP,
TK_MEDIUMP,
TK_LOWP,
TK_ES3,
+ TK_THREADGROUP,
TK_RESERVED,
TK_IDENTIFIER,
TK_DIRECTIVE,
@@ -108,7 +112,9 @@ struct Token {
Token() {}
Token(Kind kind, int32_t offset, int32_t length)
- : fKind(kind), fOffset(offset), fLength(length) {}
+ : fKind(kind)
+ , fOffset(offset)
+ , fLength(length) {}
Kind fKind = Kind::TK_NONE;
int32_t fOffset = -1;
diff --git a/chromium/third_party/skia/src/sksl/SkSLMangler.cpp b/chromium/third_party/skia/src/sksl/SkSLMangler.cpp
index eaba2d6eff1..9fcb723b711 100644
--- a/chromium/third_party/skia/src/sksl/SkSLMangler.cpp
+++ b/chromium/third_party/skia/src/sksl/SkSLMangler.cpp
@@ -52,7 +52,7 @@ std::string Mangler::uniqueName(std::string_view baseName, SymbolTable* symbolTa
// This code is a performance hotspot. Assemble the string manually to save a few cycles.
char uniqueName[256];
uniqueName[0] = '_';
- char* uniqueNameEnd = uniqueName + SK_ARRAY_COUNT(uniqueName);
+ char* uniqueNameEnd = uniqueName + std::size(uniqueName);
for (;;) {
// _123
char* endPtr = SkStrAppendS32(uniqueName + 1, fCounter++);
diff --git a/chromium/third_party/skia/src/sksl/SkSLOutputStream.h b/chromium/third_party/skia/src/sksl/SkSLOutputStream.h
index e9b409ba11d..542ffd6f90d 100644
--- a/chromium/third_party/skia/src/sksl/SkSLOutputStream.h
+++ b/chromium/third_party/skia/src/sksl/SkSLOutputStream.h
@@ -10,7 +10,9 @@
#include "include/core/SkTypes.h"
-#include <stdarg.h>
+#include <cstdarg>
+#include <cstddef>
+#include <cstdint>
#include <string>
namespace SkSL {
diff --git a/chromium/third_party/skia/src/sksl/SkSLPool.h b/chromium/third_party/skia/src/sksl/SkSLPool.h
index 74ce03364ab..9e64d44b9a3 100644
--- a/chromium/third_party/skia/src/sksl/SkSLPool.h
+++ b/chromium/third_party/skia/src/sksl/SkSLPool.h
@@ -10,7 +10,7 @@
#include "src/sksl/SkSLMemoryPool.h"
-#include <stddef.h>
+#include <cstddef>
#include <memory>
namespace SkSL {
diff --git a/chromium/third_party/skia/src/sksl/SkSLProgramSettings.h b/chromium/third_party/skia/src/sksl/SkSLProgramSettings.h
index ebd2d8ac0eb..fb6885925b3 100644
--- a/chromium/third_party/skia/src/sksl/SkSLProgramSettings.h
+++ b/chromium/third_party/skia/src/sksl/SkSLProgramSettings.h
@@ -67,9 +67,10 @@ struct ProgramSettings {
// If true, any synthetic uniforms must use push constant syntax
bool fUsePushConstants = false;
// TODO(skia:11209) - Replace this with a "promised" capabilities?
- // If true, configurations which demand strict ES2 conformance (runtime effects, generic
- // programs, and SkVM rendering) will fail during compilation if ES2 restrictions are violated.
- bool fEnforceES2Restrictions = true;
+ // Sets a maximum SkSL version. Compilation will fail if the program uses features that aren't
+ // allowed at the requested version. For instance, a valid program must have fully-unrollable
+ // `for` loops at version 100, but any loop structure is allowed at version 300.
+ SkSL::Version fMaxVersionAllowed = SkSL::Version::k100;
// If true, SkVM debug traces will contain the `trace_var` opcode. This opcode can cause the
// generated code to contain a lot of extra computations, because we need to explicitly compute
// every temporary value, even ones that would otherwise be optimized away entirely. The other
@@ -106,7 +107,7 @@ struct ProgramConfig {
bool strictES2Mode() const {
// TODO(skia:11209): Remove the first condition - so this is just based on #version.
// Make it more generic (eg, isVersionLT) checking.
- return fSettings.fEnforceES2Restrictions &&
+ return fSettings.fMaxVersionAllowed == Version::k100 &&
fRequiredSkSLVersion == Version::k100 &&
this->enforcesSkSLVersion();
}
@@ -131,6 +132,10 @@ struct ProgramConfig {
kind == ProgramKind::kGraphiteVertex;
}
+ static bool IsCompute(ProgramKind kind) {
+ return kind == ProgramKind::kCompute;
+ }
+
static bool IsRuntimeEffect(ProgramKind kind) {
return (kind == ProgramKind::kRuntimeColorFilter ||
kind == ProgramKind::kRuntimeShader ||
diff --git a/chromium/third_party/skia/src/sksl/SkSLRehydrator.cpp b/chromium/third_party/skia/src/sksl/SkSLRehydrator.cpp
index 62164b0bd64..2ee7a54a659 100644
--- a/chromium/third_party/skia/src/sksl/SkSLRehydrator.cpp
+++ b/chromium/third_party/skia/src/sksl/SkSLRehydrator.cpp
@@ -65,7 +65,6 @@
#include "src/sksl/ir/SkSLSymbolTable.h"
#include "src/sksl/ir/SkSLTernaryExpression.h"
#include "src/sksl/ir/SkSLType.h"
-#include "src/sksl/ir/SkSLUnresolvedFunction.h"
#include "src/sksl/ir/SkSLVarDeclarations.h"
#include "src/sksl/ir/SkSLVariable.h"
#include "src/sksl/ir/SkSLVariableReference.h"
@@ -76,6 +75,8 @@
#include <type_traits>
#include <utility>
+#define SYMBOL_DEBUGF(...) //SkDebugf(__VA_ARGS__)
+
namespace SkSL {
class AutoRehydratorSymbolTable {
@@ -98,10 +99,13 @@ private:
std::shared_ptr<SymbolTable> fOldSymbols;
};
+Rehydrator::Rehydrator(Compiler& compiler, const uint8_t* src, size_t length)
+ : Rehydrator(compiler, src, length, compiler.makeRootSymbolTableWithPublicTypes()) {}
+
Rehydrator::Rehydrator(Compiler& compiler, const uint8_t* src, size_t length,
- std::shared_ptr<SymbolTable> symbols)
+ std::shared_ptr<SymbolTable> symbols)
: fCompiler(compiler)
- , fSymbolTable(symbols ? std::move(symbols) : compiler.makeGLSLRootSymbolTable())
+ , fSymbolTable(std::move(symbols))
SkDEBUGCODE(, fEnd(src + length)) {
SkASSERT(fSymbolTable);
SkASSERT(fSymbolTable->isBuiltin());
@@ -172,7 +176,7 @@ Modifiers Rehydrator::modifiers() {
}
}
-const Symbol* Rehydrator::symbol() {
+Symbol* Rehydrator::symbol() {
int kind = this->readU8();
switch (kind) {
case kArrayType_Command: {
@@ -181,7 +185,7 @@ const Symbol* Rehydrator::symbol() {
int8_t count = this->readS8();
const std::string* arrayName =
fSymbolTable->takeOwnershipOfString(componentType->getArrayName(count));
- const Type* result = fSymbolTable->takeOwnershipOfSymbol(
+ Type* result = fSymbolTable->takeOwnershipOfSymbol(
Type::MakeArrayType(*arrayName, *componentType, count));
this->addSymbol(id, result);
return result;
@@ -194,24 +198,23 @@ const Symbol* Rehydrator::symbol() {
std::vector<const Variable*> parameters;
parameters.reserve(parameterCount);
for (int i = 0; i < parameterCount; ++i) {
- parameters.push_back(this->symbolRef<Variable>());
+ parameters.push_back(&this->symbol()->as<Variable>());
}
const Type* returnType = this->type();
- const FunctionDeclaration* result =
- fSymbolTable->takeOwnershipOfSymbol(std::make_unique<FunctionDeclaration>(
- Position(),
- this->modifiersPool().add(modifiers),
- name,
- std::move(parameters),
- returnType,
- fSymbolTable->isBuiltin()));
- this->addSymbol(id, result);
- return result;
+ auto decl = std::make_unique<FunctionDeclaration>(Position(),
+ this->modifiersPool().add(modifiers),
+ name,
+ std::move(parameters),
+ returnType,
+ fSymbolTable->isBuiltin());
+ FunctionDeclaration* sym = fSymbolTable->takeOwnershipOfSymbol(std::move(decl));
+ this->addSymbol(id, sym);
+ return sym;
}
case kField_Command: {
const Variable* owner = this->symbolRef<Variable>();
uint8_t index = this->readU8();
- const Field* result = fSymbolTable->takeOwnershipOfSymbol(
+ Field* result = fSymbolTable->takeOwnershipOfSymbol(
std::make_unique<Field>(Position(), owner, index));
return result;
}
@@ -229,28 +232,13 @@ const Symbol* Rehydrator::symbol() {
}
bool interfaceBlock = this->readU8();
std::string_view nameChars(*fSymbolTable->takeOwnershipOfString(std::move(name)));
- const Type* result = fSymbolTable->takeOwnershipOfSymbol(Type::MakeStructType(
- Position(), nameChars, std::move(fields), interfaceBlock));
+ Type* result = fSymbolTable->takeOwnershipOfSymbol(
+ Type::MakeStructType(Position(), nameChars, std::move(fields), interfaceBlock));
this->addSymbol(id, result);
return result;
}
case kSymbolRef_Command: {
- return this->possiblyBuiltinSymbolRef();
- }
- case kUnresolvedFunction_Command: {
- uint16_t id = this->readU16();
- int length = this->readU8();
- std::vector<const FunctionDeclaration*> functions;
- functions.reserve(length);
- for (int i = 0; i < length; ++i) {
- const Symbol* f = this->symbol();
- SkASSERT(f && f->kind() == Symbol::Kind::kFunctionDeclaration);
- functions.push_back((const FunctionDeclaration*) f);
- }
- const UnresolvedFunction* result = fSymbolTable->takeOwnershipOfSymbol(
- std::make_unique<UnresolvedFunction>(std::move(functions)));
- this->addSymbol(id, result);
- return result;
+ return (Symbol*)this->possiblyBuiltinSymbolRef();
}
case kVariable_Command: {
uint16_t id = this->readU16();
@@ -258,7 +246,7 @@ const Symbol* Rehydrator::symbol() {
std::string_view name = this->readString();
const Type* type = this->type();
Variable::Storage storage = (Variable::Storage) this->readU8();
- const Variable* result = fSymbolTable->takeOwnershipOfSymbol(std::make_unique<Variable>(
+ Variable* result = fSymbolTable->takeOwnershipOfSymbol(std::make_unique<Variable>(
/*pos=*/Position(), /*modifiersPosition=*/Position(), m, name, type,
fSymbolTable->isBuiltin(), storage));
this->addSymbol(id, result);
@@ -287,7 +275,7 @@ std::unique_ptr<Program> Rehydrator::program() {
auto config = std::make_unique<ProgramConfig>();
config->fKind = (ProgramKind)this->readU8();
config->fRequiredSkSLVersion = (SkSL::Version)this->readU8();
- config->fSettings.fEnforceES2Restrictions = false;
+ config->fSettings.fMaxVersionAllowed = SkSL::Version::k300;
Context& context = this->context();
ProgramConfig* oldConfig = context.fConfig;
@@ -564,18 +552,8 @@ std::unique_ptr<Expression> Rehydrator::expression() {
const Type* type = this->type();
const Symbol* symbol = this->possiblyBuiltinSymbolRef();
ExpressionArray args = this->expressionArray();
- const FunctionDeclaration* f;
- if (symbol->is<FunctionDeclaration>()) {
- f = &symbol->as<FunctionDeclaration>();
- } else if (symbol->is<UnresolvedFunction>()) {
- const UnresolvedFunction& unresolved = symbol->as<UnresolvedFunction>();
- f = FunctionCall::FindBestFunctionForCall(this->context(), unresolved.functions(),
- args);
- SkASSERT(f);
- } else {
- SkASSERT(false);
- return nullptr;
- }
+ const FunctionDeclaration* f = &symbol->as<FunctionDeclaration>();
+ f = FunctionCall::FindBestFunctionForCall(this->context(), f, args);
return FunctionCall::Make(this->context(), pos, type, *f, std::move(args));
}
case Rehydrator::kIndex_Command: {
@@ -646,17 +624,22 @@ std::shared_ptr<SymbolTable> Rehydrator::symbolTable() {
bool builtin = this->readU8();
uint16_t ownedCount = this->readU16();
fSymbolTable = std::make_shared<SymbolTable>(std::move(fSymbolTable), builtin);
- std::vector<const Symbol*> ownedSymbols;
+ std::vector<Symbol*> ownedSymbols;
ownedSymbols.reserve(ownedCount);
+
+ // Write the owned symbols.
+ SYMBOL_DEBUGF("\nOwned symbols in Rehydrator:\n\n\n");
for (int i = 0; i < ownedCount; ++i) {
ownedSymbols.push_back(this->symbol());
+ SYMBOL_DEBUGF("%s\n", ownedSymbols.back()->description().c_str());
}
+
+ SYMBOL_DEBUGF("\nOrdered symbols in Rehydrator:\n\n\n");
uint16_t symbolCount = this->readU16();
- std::vector<std::pair<std::string_view, int>> symbols;
- symbols.reserve(symbolCount);
for (int i = 0; i < symbolCount; ++i) {
int index = this->readU16();
if (index != kBuiltin_Symbol) {
+ SYMBOL_DEBUGF("%s\n", ownedSymbols[index]->description().c_str());
fSymbolTable->addWithoutOwnership(ownedSymbols[index]);
} else {
std::string_view name = this->readString();
@@ -666,6 +649,7 @@ std::shared_ptr<SymbolTable> Rehydrator::symbolTable() {
}
const Symbol* s = (*root)[name];
SkASSERT(s);
+ SYMBOL_DEBUGF("(builtin symbol) %s\n", s->description().c_str());
fSymbolTable->addWithoutOwnership(s);
}
}
diff --git a/chromium/third_party/skia/src/sksl/SkSLRehydrator.h b/chromium/third_party/skia/src/sksl/SkSLRehydrator.h
index 85f45d460b5..a279fc6580b 100644
--- a/chromium/third_party/skia/src/sksl/SkSLRehydrator.h
+++ b/chromium/third_party/skia/src/sksl/SkSLRehydrator.h
@@ -15,6 +15,8 @@
#include "src/sksl/SkSLContext.h"
#include "src/sksl/ir/SkSLSymbolTable.h"
+#include <cstddef>
+#include <cstdint>
#include <memory>
#include <string_view>
#include <string>
@@ -39,7 +41,7 @@ struct Program;
*/
class Rehydrator {
public:
- static constexpr uint16_t kVersion = 11;
+ static constexpr uint16_t kVersion = 14;
// see binary_format.md for a description of the command data
enum Command {
@@ -97,7 +99,6 @@ public:
kSymbolRef_Command,
kSymbolTable_Command,
kTernary_Command,
- kUnresolvedFunction_Command,
kVariable_Command,
kVarDeclaration_Command,
kVariableReference_Command,
@@ -105,8 +106,10 @@ public:
};
// src must remain in memory as long as the objects created from it do
+ Rehydrator(Compiler& compiler, const uint8_t* src, size_t length);
+
Rehydrator(Compiler& compiler, const uint8_t* src, size_t length,
- std::shared_ptr<SymbolTable> base = nullptr);
+ std::shared_ptr<SymbolTable> base);
#ifdef SK_DEBUG
~Rehydrator();
@@ -167,7 +170,7 @@ private:
return std::string_view(chars, length);
}
- void addSymbol(int id, const Symbol* symbol) {
+ void addSymbol(int id, Symbol* symbol) {
while ((size_t) id >= fSymbols.size()) {
fSymbols.push_back(nullptr);
}
@@ -179,7 +182,7 @@ private:
uint16_t result = this->readU16();
SkASSERTF(result != kBuiltin_Symbol, "use possiblyBuiltinSymbolRef() instead");
SkASSERT(fSymbols.size() > result);
- return (T*) fSymbols[result];
+ return static_cast<T*>(fSymbols[result]);
}
/**
@@ -204,7 +207,7 @@ private:
Modifiers modifiers();
- const Symbol* symbol();
+ Symbol* symbol();
std::unique_ptr<ProgramElement> element();
@@ -224,7 +227,7 @@ private:
Compiler& fCompiler;
std::shared_ptr<SymbolTable> fSymbolTable;
- std::vector<const Symbol*> fSymbols;
+ std::vector<Symbol*> fSymbols;
const uint8_t* fStringStart;
const uint8_t* fIP;
diff --git a/chromium/third_party/skia/src/sksl/SkSLString.cpp b/chromium/third_party/skia/src/sksl/SkSLString.cpp
index a06a3c5d178..8f222d8e35a 100644
--- a/chromium/third_party/skia/src/sksl/SkSLString.cpp
+++ b/chromium/third_party/skia/src/sksl/SkSLString.cpp
@@ -7,13 +7,13 @@
#include "include/private/SkSLString.h"
+#include <cerrno>
#include <cmath>
-#include <errno.h>
+#include <cstdio>
+#include <cstdlib>
#include <locale>
#include <memory>
#include <sstream>
-#include <stdio.h>
-#include <stdlib.h>
#include <string>
std::string skstd::to_string(float value) {
diff --git a/chromium/third_party/skia/src/sksl/SkSLThreadContext.cpp b/chromium/third_party/skia/src/sksl/SkSLThreadContext.cpp
index 7de12dfe46e..fe570666f73 100644
--- a/chromium/third_party/skia/src/sksl/SkSLThreadContext.cpp
+++ b/chromium/third_party/skia/src/sksl/SkSLThreadContext.cpp
@@ -75,11 +75,13 @@ void ThreadContext::setupSymbolTable() {
SkSL::Context& context = *fCompiler->fContext;
SymbolTable::Push(&fCompiler->fSymbolTable, context.fConfig->fIsBuiltinCode);
+ SkSL::SymbolTable& symbolTable = *fCompiler->fSymbolTable;
+ symbolTable.markModuleBoundary();
+
if (fSettings.fExternalFunctions) {
// Add any external values to the new symbol table, so they're only visible to this Program.
- SkSL::SymbolTable& symbols = *fCompiler->fSymbolTable;
for (const std::unique_ptr<ExternalFunction>& ef : *fSettings.fExternalFunctions) {
- symbols.addWithoutOwnership(ef.get());
+ symbolTable.addWithoutOwnership(ef.get());
}
}
}
diff --git a/chromium/third_party/skia/src/sksl/SkSLUtil.h b/chromium/third_party/skia/src/sksl/SkSLUtil.h
index efb7eeb5cf5..4ff306d221b 100644
--- a/chromium/third_party/skia/src/sksl/SkSLUtil.h
+++ b/chromium/third_party/skia/src/sksl/SkSLUtil.h
@@ -79,6 +79,8 @@ struct ShaderCaps {
return SkSL::Version::k100;
}
+ bool supportsDistanceFieldText() const { return fShaderDerivativeSupport; }
+
SkSL::GLSLGeneration fGLSLGeneration = SkSL::GLSLGeneration::k330;
bool fShaderDerivativeSupport = false;
diff --git a/chromium/third_party/skia/src/sksl/analysis/BUILD.bazel b/chromium/third_party/skia/src/sksl/analysis/BUILD.bazel
index 2eb53cbbc21..060f0362044 100644
--- a/chromium/third_party/skia/src/sksl/analysis/BUILD.bazel
+++ b/chromium/third_party/skia/src/sksl/analysis/BUILD.bazel
@@ -9,11 +9,13 @@ ANALYSIS_FILES = [
"SkSLCheckProgramStructure.cpp",
"SkSLFinalizationChecks.cpp",
"SkSLGetLoopUnrollInfo.cpp",
+ "SkSLGetComputeShaderMainParams.cpp",
"SkSLIsConstantExpression.cpp",
"SkSLIsSameExpressionTree.cpp",
"SkSLIsTrivialExpression.cpp",
"SkSLNoOpErrorReporter.h",
"SkSLProgramUsage.cpp",
+ "SkSLProgramUsage.h",
"SkSLProgramVisitor.h",
"SkSLSwitchCaseContainsExit.cpp",
]
diff --git a/chromium/third_party/skia/src/sksl/analysis/SkSLFinalizationChecks.cpp b/chromium/third_party/skia/src/sksl/analysis/SkSLFinalizationChecks.cpp
index 9d2dbefeb25..4f2fb6cad2f 100644
--- a/chromium/third_party/skia/src/sksl/analysis/SkSLFinalizationChecks.cpp
+++ b/chromium/third_party/skia/src/sksl/analysis/SkSLFinalizationChecks.cpp
@@ -7,14 +7,18 @@
#include "include/core/SkTypes.h"
#include "include/private/SkSLDefines.h"
+#include "include/private/SkSLLayout.h"
#include "include/private/SkSLModifiers.h"
#include "include/private/SkSLProgramElement.h"
#include "include/private/SkSLStatement.h"
+#include "include/private/SkTHash.h"
#include "include/sksl/SkSLErrorReporter.h"
#include "src/core/SkSafeMath.h"
#include "src/sksl/SkSLAnalysis.h"
#include "src/sksl/SkSLBuiltinTypes.h"
#include "src/sksl/SkSLContext.h"
+#include "src/sksl/SkSLProgramSettings.h"
+#include "src/sksl/analysis/SkSLProgramUsage.h"
#include "src/sksl/analysis/SkSLProgramVisitor.h"
#include "src/sksl/ir/SkSLExpression.h"
#include "src/sksl/ir/SkSLFunctionCall.h"
@@ -27,6 +31,8 @@
#include "src/sksl/ir/SkSLVarDeclarations.h"
#include "src/sksl/ir/SkSLVariable.h"
+#include <cstddef>
+#include <cstdint>
#include <memory>
#include <string>
#include <vector>
@@ -42,6 +48,7 @@ public:
switch (pe.kind()) {
case ProgramElement::Kind::kGlobalVar: {
this->checkGlobalVariableSizeLimit(pe.as<GlobalVarDeclaration>());
+ this->checkBindUniqueness(pe.as<GlobalVarDeclaration>());
break;
}
case ProgramElement::Kind::kFunction: {
@@ -55,6 +62,9 @@ public:
}
void checkGlobalVariableSizeLimit(const GlobalVarDeclaration& globalDecl) {
+ if (ProgramConfig::IsCompute(fContext.fConfig->fKind)) {
+ return;
+ }
const VarDeclaration& decl = globalDecl.declaration()->as<VarDeclaration>();
size_t prevSlotsUsed = fGlobalSlotsUsed;
@@ -68,6 +78,28 @@ public:
}
}
+ void checkBindUniqueness(const GlobalVarDeclaration& globalDecl) {
+ const Variable& var = globalDecl.declaration()->as<VarDeclaration>().var();
+ int32_t set = var.modifiers().fLayout.fSet;
+ int32_t binding = var.modifiers().fLayout.fBinding;
+ if (binding != -1) {
+ uint64_t key = ((uint64_t)set << 32) + binding;
+ if (!fBindings.contains(key)) {
+ fBindings.add(key);
+ } else {
+ if (set != -1) {
+ fContext.fErrors->error(globalDecl.fPosition,
+ "layout(set=" + std::to_string(set) + ", binding=" +
+ std::to_string(binding) + ") has already been defined");
+ } else {
+ fContext.fErrors->error(globalDecl.fPosition,
+ "layout(binding=" + std::to_string(binding) +
+ ") has already been defined");
+ }
+ }
+ }
+ }
+
void checkOutParamsAreAssigned(const FunctionDefinition& funcDef) {
const FunctionDeclaration& funcDecl = funcDef.declaration();
@@ -143,6 +175,8 @@ private:
size_t fGlobalSlotsUsed = 0;
const Context& fContext;
const ProgramUsage& fUsage;
+ // we pack the set/binding pair into a single 64 bit int
+ SkTHashSet<uint64_t> fBindings;
};
} // namespace
diff --git a/chromium/third_party/skia/src/sksl/analysis/SkSLGetComputeShaderMainParams.cpp b/chromium/third_party/skia/src/sksl/analysis/SkSLGetComputeShaderMainParams.cpp
new file mode 100644
index 00000000000..af06a233836
--- /dev/null
+++ b/chromium/third_party/skia/src/sksl/analysis/SkSLGetComputeShaderMainParams.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "include/core/SkTypes.h"
+#include "include/private/SkSLLayout.h"
+#include "include/private/SkSLModifiers.h"
+#include "include/private/SkSLProgramElement.h"
+#include "include/private/SkSLStatement.h"
+#include "include/private/SkTArray.h"
+#include "src/sksl/SkSLAnalysis.h"
+#include "src/sksl/ir/SkSLProgram.h"
+#include "src/sksl/ir/SkSLVarDeclarations.h"
+#include "src/sksl/ir/SkSLVariable.h"
+
+#include <algorithm>
+#include <memory>
+#include <tuple>
+
+namespace SkSL {
+
+class Context;
+
+static bool compare(const SkSL::Variable* a, const SkSL::Variable* b) {
+ int setA = a->modifiers().fLayout.fSet;
+ int setB = b->modifiers().fLayout.fSet;
+ int bindingA = a->modifiers().fLayout.fBinding;
+ int bindingB = b->modifiers().fLayout.fBinding;
+ return std::tie(setA, bindingA) < std::tie(setB, bindingB);
+}
+
+SkTArray<const SkSL::Variable*> Analysis::GetComputeShaderMainParams(const Context& context,
+ const Program& program) {
+ SkTArray<const SkSL::Variable*> result;
+ for (const ProgramElement* e : program.elements()) {
+ if (e->is<GlobalVarDeclaration>()) {
+ const Variable& var =
+ e->as<GlobalVarDeclaration>().declaration()->as<VarDeclaration>().var();
+ if (var.modifiers().fLayout.fBinding != -1 && var.modifiers().fLayout.fSet != -1) {
+ result.push_back(&var);
+ }
+ }
+ }
+ std::sort(result.begin(), result.end(), compare);
+ return result;
+}
+
+} // namespace SkSL
diff --git a/chromium/third_party/skia/src/sksl/analysis/SkSLIsSameExpressionTree.cpp b/chromium/third_party/skia/src/sksl/analysis/SkSLIsSameExpressionTree.cpp
index 9c5242de31d..9826283f4ed 100644
--- a/chromium/third_party/skia/src/sksl/analysis/SkSLIsSameExpressionTree.cpp
+++ b/chromium/third_party/skia/src/sksl/analysis/SkSLIsSameExpressionTree.cpp
@@ -21,6 +21,7 @@
#include "src/sksl/ir/SkSLType.h"
#include "src/sksl/ir/SkSLVariableReference.h"
+#include <cstddef>
#include <memory>
namespace SkSL {
diff --git a/chromium/third_party/skia/src/sksl/analysis/SkSLProgramUsage.cpp b/chromium/third_party/skia/src/sksl/analysis/SkSLProgramUsage.cpp
index b09f3d2f5e6..01659d55da2 100644
--- a/chromium/third_party/skia/src/sksl/analysis/SkSLProgramUsage.cpp
+++ b/chromium/third_party/skia/src/sksl/analysis/SkSLProgramUsage.cpp
@@ -14,13 +14,13 @@
#include "src/sksl/SkSLBuiltinMap.h" // IWYU pragma: keep
#include "src/sksl/SkSLCompiler.h"
#include "src/sksl/SkSLParsedModule.h"
+#include "src/sksl/analysis/SkSLProgramUsage.h"
#include "src/sksl/analysis/SkSLProgramVisitor.h"
#include "src/sksl/ir/SkSLExpression.h"
#include "src/sksl/ir/SkSLFunctionCall.h"
#include "src/sksl/ir/SkSLFunctionDeclaration.h"
#include "src/sksl/ir/SkSLFunctionDefinition.h"
#include "src/sksl/ir/SkSLInterfaceBlock.h"
-#include "src/sksl/ir/SkSLProgram.h"
#include "src/sksl/ir/SkSLVarDeclarations.h"
#include "src/sksl/ir/SkSLVariable.h"
#include "src/sksl/ir/SkSLVariableReference.h"
@@ -32,6 +32,9 @@
#include <vector>
namespace SkSL {
+
+struct Program;
+
namespace {
class ProgramUsageVisitor : public ProgramVisitor {
diff --git a/chromium/third_party/skia/src/sksl/analysis/SkSLProgramUsage.h b/chromium/third_party/skia/src/sksl/analysis/SkSLProgramUsage.h
new file mode 100644
index 00000000000..db7b580cd6a
--- /dev/null
+++ b/chromium/third_party/skia/src/sksl/analysis/SkSLProgramUsage.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SKSL_PROGRAMUSAGE
+#define SKSL_PROGRAMUSAGE
+
+#include "include/core/SkTypes.h"
+#include "include/private/SkTHash.h"
+
+namespace SkSL {
+
+class Expression;
+class FunctionDeclaration;
+class ProgramElement;
+class Statement;
+class Variable;
+
+/**
+ * Side-car class holding mutable information about a Program's IR
+ */
+class ProgramUsage {
+public:
+ struct VariableCounts {
+ int fDeclared = 0;
+ int fRead = 0;
+ int fWrite = 0;
+ };
+ VariableCounts get(const Variable&) const;
+ bool isDead(const Variable&) const;
+
+ int get(const FunctionDeclaration&) const;
+
+ void add(const Expression* expr);
+ void add(const Statement* stmt);
+ void add(const ProgramElement& element);
+ void remove(const Expression* expr);
+ void remove(const Statement* stmt);
+ void remove(const ProgramElement& element);
+
+ SkTHashMap<const Variable*, VariableCounts> fVariableCounts;
+ SkTHashMap<const FunctionDeclaration*, int> fCallCounts;
+};
+
+} // namespace SkSL
+
+#endif
diff --git a/chromium/third_party/skia/src/sksl/binary_format.md b/chromium/third_party/skia/src/sksl/binary_format.md
index 015efe78644..d4b38926a68 100644
--- a/chromium/third_party/skia/src/sksl/binary_format.md
+++ b/chromium/third_party/skia/src/sksl/binary_format.md
@@ -302,9 +302,13 @@ its own ID; references to a Field are compiled in terms of the owner’s ID.
| `Modifiers` | modifiers |
| `String` | name |
| `uint8` | parameterCount |
-| `SymbolId[parameterCount]` | parameters |
+| `Symbol[parameterCount]` | parameters |
| `Type` | returnType |
+If a function is overloaded, the overloads will by dehydrated in the same order that they appear in
+the code. SkSL will prefer the first overload when a function call is ambiguous, so maintaining the
+overload order is important.
+
---
#### kStructType_Command
@@ -336,16 +340,6 @@ Refers to a Symbol which has already been written by another command.
---
-#### kUnresolvedFunction_Command
-
-| Type | Field Name |
-|------------------------------|------------|
-| `uint16` | id |
-| `uint8` | count |
-| `FunctionDeclaration[count]` | functions |
-
----
-
#### kVariable_Command
| Type | Field Name |
diff --git a/chromium/third_party/skia/src/sksl/codegen/BUILD.bazel b/chromium/third_party/skia/src/sksl/codegen/BUILD.bazel
index fbd03bf1d5f..e94e9a1f669 100644
--- a/chromium/third_party/skia/src/sksl/codegen/BUILD.bazel
+++ b/chromium/third_party/skia/src/sksl/codegen/BUILD.bazel
@@ -1,4 +1,4 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy", "split_srcs_and_hdrs")
+load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_deps", "split_srcs_and_hdrs")
licenses(["notice"])
@@ -8,7 +8,6 @@ filegroup(
name = "core_srcs",
srcs = [
"SkSLVMCodeGenerator.cpp",
- "SkSLVMCodeGenerator.h",
],
)
@@ -57,11 +56,11 @@ filegroup(
visibility = ["//src/sksl:__pkg__"],
)
-cc_library(
+skia_cc_deps(
name = "deps",
visibility = ["//src/sksl:__pkg__"],
deps = select({
- "//src/sksl:use_sksl_gpu_srcs": ["//third_party:spirv_cross"],
+ "//src/sksl:use_sksl_gpu_srcs": ["@spirv_cross"],
"//conditions:default": [],
}),
)
diff --git a/chromium/third_party/skia/src/sksl/codegen/SkSLGLSLCodeGenerator.cpp b/chromium/third_party/skia/src/sksl/codegen/SkSLGLSLCodeGenerator.cpp
index 2fdbee92c1f..9883d84677c 100644
--- a/chromium/third_party/skia/src/sksl/codegen/SkSLGLSLCodeGenerator.cpp
+++ b/chromium/third_party/skia/src/sksl/codegen/SkSLGLSLCodeGenerator.cpp
@@ -18,6 +18,7 @@
#include "include/private/SkTArray.h"
#include "include/sksl/SkSLErrorReporter.h"
#include "include/sksl/SkSLPosition.h"
+#include "src/sksl/SkSLAnalysis.h"
#include "src/sksl/SkSLBuiltinTypes.h"
#include "src/sksl/SkSLCompiler.h"
#include "src/sksl/SkSLGLSL.h"
@@ -28,6 +29,7 @@
#include "src/sksl/ir/SkSLBlock.h"
#include "src/sksl/ir/SkSLConstructor.h"
#include "src/sksl/ir/SkSLConstructorArrayCast.h"
+#include "src/sksl/ir/SkSLConstructorCompound.h"
#include "src/sksl/ir/SkSLConstructorDiagonalMatrix.h"
#include "src/sksl/ir/SkSLDoStatement.h"
#include "src/sksl/ir/SkSLExpression.h"
@@ -205,8 +207,10 @@ void GLSLCodeGenerator::writeExpression(const Expression& expr, Precedence paren
case Expression::Kind::kConstructorArrayCast:
this->writeExpression(*expr.as<ConstructorArrayCast>().argument(), parentPrecedence);
break;
- case Expression::Kind::kConstructorArray:
case Expression::Kind::kConstructorCompound:
+ this->writeConstructorCompound(expr.as<ConstructorCompound>(), parentPrecedence);
+ break;
+ case Expression::Kind::kConstructorArray:
case Expression::Kind::kConstructorMatrixResize:
case Expression::Kind::kConstructorSplat:
case Expression::Kind::kConstructorStruct:
@@ -732,6 +736,43 @@ void GLSLCodeGenerator::writeConstructorDiagonalMatrix(const ConstructorDiagonal
this->writeAnyConstructor(c, parentPrecedence);
}
+void GLSLCodeGenerator::writeConstructorCompound(const ConstructorCompound& c,
+ Precedence parentPrecedence) {
+ // If this is a 2x2 matrix constructor containing a single argument...
+ if (c.type().isMatrix() && c.arguments().size() == 1) {
+ // ... and that argument is a vec4...
+ const Expression& expr = *c.arguments().front();
+ if (expr.type().isVector() && expr.type().columns() == 4) {
+ // ... let's rewrite the cast to dodge issues on very old GPUs. (skia:13559)
+ if (Analysis::IsTrivialExpression(expr)) {
+ this->writeType(c.type());
+ this->write("(");
+ this->writeExpression(expr, Precedence::kPostfix);
+ this->write(".xy, ");
+ this->writeExpression(expr, Precedence::kPostfix);
+ this->write(".zw)");
+ } else {
+ std::string tempVec = "_tempVec" + std::to_string(fVarCount++);
+ this->fFunctionHeader += std::string(" ") + this->getTypePrecision(expr.type()) +
+ this->getTypeName(expr.type()) + " " + tempVec + ";\n";
+ this->write("((");
+ this->write(tempVec);
+ this->write(" = ");
+ this->writeExpression(expr, Precedence::kAssignment);
+ this->write("), ");
+ this->writeType(c.type());
+ this->write("(");
+ this->write(tempVec);
+ this->write(".xy, ");
+ this->write(tempVec);
+ this->write(".zw))");
+ }
+ return;
+ }
+ }
+ this->writeAnyConstructor(c, parentPrecedence);
+}
+
void GLSLCodeGenerator::writeCastConstructor(const AnyConstructor& c, Precedence parentPrecedence) {
const auto arguments = c.argumentSpan();
SkASSERT(arguments.size() == 1);
@@ -839,7 +880,7 @@ void GLSLCodeGenerator::writeVariableReference(const VariableReference& ref) {
}
break;
default:
- this->write(ref.variable()->name());
+ this->write(ref.variable()->mangledName());
break;
}
}
@@ -1063,7 +1104,7 @@ void GLSLCodeGenerator::writeFunctionDeclaration(const FunctionDeclaration& f) {
}
this->writeTypePrecision(*type);
this->writeType(*type);
- this->write(" " + std::string(param->name()));
+ this->write(" " + std::string(param->mangledName()));
for (int s : sizes) {
this->write("[" + std::to_string(s) + "]");
}
@@ -1143,6 +1184,15 @@ void GLSLCodeGenerator::writeModifiers(const Modifiers& modifiers,
}
}
+ if (modifiers.fFlags & Modifiers::kReadOnly_Flag) {
+ this->write("readonly ");
+ }
+ if (modifiers.fFlags & Modifiers::kWriteOnly_Flag) {
+ this->write("writeonly ");
+ }
+ if (modifiers.fFlags & Modifiers::kBuffer_Flag) {
+ this->write("buffer ");
+ }
}
void GLSLCodeGenerator::writeInterfaceBlock(const InterfaceBlock& intf) {
@@ -1220,7 +1270,7 @@ void GLSLCodeGenerator::writeVarDeclaration(const VarDeclaration& var, bool glob
this->writeTypePrecision(var.baseType());
this->writeType(var.baseType());
this->write(" ");
- this->write(var.var().name());
+ this->write(var.var().mangledName());
if (var.arraySize() > 0) {
this->write("[");
this->write(std::to_string(var.arraySize()));
diff --git a/chromium/third_party/skia/src/sksl/codegen/SkSLGLSLCodeGenerator.h b/chromium/third_party/skia/src/sksl/codegen/SkSLGLSLCodeGenerator.h
index a5894596914..16eab7aa3b4 100644
--- a/chromium/third_party/skia/src/sksl/codegen/SkSLGLSLCodeGenerator.h
+++ b/chromium/third_party/skia/src/sksl/codegen/SkSLGLSLCodeGenerator.h
@@ -22,6 +22,7 @@ namespace SkSL {
class AnyConstructor;
class BinaryExpression;
class Block;
+class ConstructorCompound;
class ConstructorDiagonalMatrix;
class DoStatement;
class Expression;
@@ -131,6 +132,8 @@ protected:
virtual void writeFunctionCall(const FunctionCall& c);
+ void writeConstructorCompound(const ConstructorCompound& c, Precedence parentPrecedence);
+
void writeConstructorDiagonalMatrix(const ConstructorDiagonalMatrix& c,
Precedence parentPrecedence);
diff --git a/chromium/third_party/skia/src/sksl/codegen/SkSLMetalCodeGenerator.cpp b/chromium/third_party/skia/src/sksl/codegen/SkSLMetalCodeGenerator.cpp
index fd0c77fc8ad..c23df24b084 100644
--- a/chromium/third_party/skia/src/sksl/codegen/SkSLMetalCodeGenerator.cpp
+++ b/chromium/third_party/skia/src/sksl/codegen/SkSLMetalCodeGenerator.cpp
@@ -63,6 +63,7 @@
#include "src/sksl/spirv.h"
#include <algorithm>
+#include <cstddef>
#include <functional>
#include <limits>
#include <memory>
@@ -81,11 +82,18 @@ class MetalCodeGenerator::GlobalStructVisitor {
public:
virtual ~GlobalStructVisitor() = default;
virtual void visitInterfaceBlock(const InterfaceBlock& block, std::string_view blockName) = 0;
- virtual void visitTexture(const Type& type, std::string_view name) = 0;
+ virtual void visitTexture(const Type& type, const Modifiers& modifiers,
+ std::string_view name) = 0;
virtual void visitSampler(const Type& type, std::string_view name) = 0;
virtual void visitVariable(const Variable& var, const Expression* value) = 0;
};
+class MetalCodeGenerator::ThreadgroupStructVisitor {
+public:
+ virtual ~ThreadgroupStructVisitor() = default;
+ virtual void visitVariable(const Variable& var) = 0;
+};
+
void MetalCodeGenerator::write(std::string_view s) {
if (s.empty()) {
return;
@@ -116,8 +124,13 @@ void MetalCodeGenerator::writeExtension(const Extension& ext) {
}
std::string MetalCodeGenerator::typeName(const Type& type) {
+ // we need to know the modifiers for textures
+ SkASSERT(type.typeKind() != Type::TypeKind::kTexture);
switch (type.typeKind()) {
case Type::TypeKind::kArray:
+ if (type.columns() == Type::kUnsizedArray) {
+ return this->typeName(type.componentType()) + "*";
+ }
SkASSERTF(type.columns() > 0, "invalid array size: %s", type.description().c_str());
return String::printf("array<%s, %d>",
this->typeName(type.componentType()).c_str(), type.columns());
@@ -130,13 +143,37 @@ std::string MetalCodeGenerator::typeName(const Type& type) {
std::to_string(type.rows());
case Type::TypeKind::kSampler:
- return "texture2d<half>"; // FIXME - support other texture types
+ if (type.dimensions() != SpvDim2D) {
+ fContext.fErrors->error(Position(), "Unsupported texture dimensions");
+ }
+ return "sampler2D";
default:
return std::string(type.name());
}
}
+std::string MetalCodeGenerator::textureTypeName(const Type& type, const Modifiers* modifiers) {
+ if (type.typeKind() == Type::TypeKind::kTexture && modifiers) {
+ std::string result = "texture2d<half, access::";
+ switch (modifiers->fFlags & (Modifiers::kReadOnly_Flag | Modifiers::kWriteOnly_Flag)) {
+ case 0:
+ result += "read_write>";
+ break;
+ case Modifiers::kWriteOnly_Flag:
+ result += "write>";
+ break;
+ case Modifiers::kReadOnly_Flag:
+ default:
+ result += "read>";
+ break;
+ }
+ return result;
+ } else {
+ return "texture2d<half>";
+ }
+}
+
void MetalCodeGenerator::writeStructDefinition(const StructDefinition& s) {
const Type& type = s.type();
this->writeLine("struct " + type.displayName() + " {");
@@ -150,6 +187,18 @@ void MetalCodeGenerator::writeType(const Type& type) {
this->write(this->typeName(type));
}
+void MetalCodeGenerator::writeTextureType(const Type& type, const Modifiers& modifiers) {
+ this->write(this->textureTypeName(type, &modifiers));
+}
+
+void MetalCodeGenerator::writeParameterType(const Type& type, const Modifiers& modifiers) {
+ if (type.typeKind() == Type::TypeKind::kTexture) {
+ this->writeTextureType(type, modifiers);
+ } else {
+ this->writeType(type);
+ }
+}
+
void MetalCodeGenerator::writeExpression(const Expression& expr, Precedence parentPrecedence) {
switch (expr.kind()) {
case Expression::Kind::kBinary:
@@ -213,9 +262,24 @@ void MetalCodeGenerator::writeExpression(const Expression& expr, Precedence pare
}
}
+// returns true if we should pass by reference instead of by value
+static bool pass_by_reference(const Type& type, const Modifiers& modifiers) {
+ return (modifiers.fFlags & Modifiers::kOut_Flag) && !type.isUnsizedArray();
+}
+
+// returns true if we need to specify an address space modifier
+static bool needs_address_space(const Type& type, const Modifiers& modifiers) {
+ return type.isUnsizedArray() || pass_by_reference(type, modifiers);
+}
+
+// returns true if the InterfaceBlock has the `buffer` modifier
+static bool is_buffer(const InterfaceBlock& block) {
+ return block.variable().modifiers().fFlags & Modifiers::kBuffer_Flag;
+}
+
std::string MetalCodeGenerator::getOutParamHelper(const FunctionCall& call,
- const ExpressionArray& arguments,
- const SkTArray<VariableReference*>& outVars) {
+ const ExpressionArray& arguments,
+ const SkTArray<VariableReference*>& outVars) {
AutoOutputStream outputToExtraFunctions(this, &fExtraFunctions, &fIndentation);
const FunctionDeclaration& function = call.function();
@@ -255,9 +319,9 @@ std::string MetalCodeGenerator::getOutParamHelper(const FunctionCall& call,
this->writeModifiers(param->modifiers());
const Type* type = outVars[index] ? &outVars[index]->type() : &arguments[index]->type();
- this->writeType(*type);
+ this->writeParameterType(*type, param->modifiers());
- if (param->modifiers().fFlags & Modifiers::kOut_Flag) {
+ if (pass_by_reference(param->type(), param->modifiers())) {
this->write("&");
}
if (outVars[index]) {
@@ -560,24 +624,30 @@ void MetalCodeGenerator::writeArgumentList(const ExpressionArray& arguments) {
bool MetalCodeGenerator::writeIntrinsicCall(const FunctionCall& c, IntrinsicKind kind) {
const ExpressionArray& arguments = c.arguments();
switch (kind) {
- case k_sample_IntrinsicKind: {
- this->writeExpression(*arguments[0], Precedence::kSequence);
- this->write(".sample(");
- this->writeExpression(*arguments[0], Precedence::kSequence);
- this->write(SAMPLER_SUFFIX);
+ case k_read_IntrinsicKind: {
+ this->writeExpression(*arguments[0], Precedence::kTopLevel);
+ this->write(".read(");
+ this->writeExpression(*arguments[1], Precedence::kSequence);
+ this->write(")");
+ return true;
+ }
+ case k_write_IntrinsicKind: {
+ this->writeExpression(*arguments[0], Precedence::kTopLevel);
+ this->write(".write(");
+ this->writeExpression(*arguments[2], Precedence::kSequence);
this->write(", ");
- const Type& arg1Type = arguments[1]->type();
- if (arg1Type.columns() == 3) {
- // have to store the vector in a temp variable to avoid double evaluating it
- std::string tmpVar = this->getTempVariable(arg1Type);
- this->write("(" + tmpVar + " = ");
- this->writeExpression(*arguments[1], Precedence::kSequence);
- this->write(", " + tmpVar + ".xy / " + tmpVar + ".z))");
- } else {
- SkASSERT(arg1Type.columns() == 2);
- this->writeExpression(*arguments[1], Precedence::kSequence);
- this->write(")");
- }
+ this->writeExpression(*arguments[1], Precedence::kSequence);
+ this->write(")");
+ return true;
+ }
+ case k_width_IntrinsicKind: {
+ this->writeExpression(*arguments[0], Precedence::kTopLevel);
+ this->write(".get_width()");
+ return true;
+ }
+ case k_height_IntrinsicKind: {
+ this->writeExpression(*arguments[0], Precedence::kTopLevel);
+ this->write(".get_height()");
return true;
}
case k_mod_IntrinsicKind: {
@@ -961,6 +1031,10 @@ bool MetalCodeGenerator::writeIntrinsicCall(const FunctionCall& c, IntrinsicKind
this->write(")");
return true;
}
+ case k_threadgroupBarrier_IntrinsicKind:
+ this->write("threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | "
+ "mem_flags::mem_texture)");
+ return true;
default:
return false;
}
@@ -1350,12 +1424,34 @@ void MetalCodeGenerator::writeFragCoord() {
}
}
+// true if the var is part of the Inputs struct
+static bool is_input(const Variable& var) {
+ return var.modifiers().fFlags & Modifiers::kIn_Flag &&
+ (var.modifiers().fLayout.fBuiltin == -1 ||
+ var.modifiers().fLayout.fBuiltin == SK_THREADPOSITION) &&
+ var.type().typeKind() != Type::TypeKind::kTexture;
+}
+
+// true if the var is part of the Outputs struct
+static bool is_output(const Variable& var) {
+ // inout vars get written into the Inputs struct, so we exclude them from Outputs
+ return (var.modifiers().fFlags & Modifiers::kOut_Flag) &&
+ !(var.modifiers().fFlags & Modifiers::kIn_Flag) &&
+ var.modifiers().fLayout.fBuiltin == -1 &&
+ var.type().typeKind() != Type::TypeKind::kTexture;
+}
+
+// true if the var is part of the Threadgroups struct
+static bool is_threadgroup(const Variable& var) {
+ return var.modifiers().fFlags & Modifiers::kThreadgroup_Flag;
+}
+
void MetalCodeGenerator::writeVariableReference(const VariableReference& ref) {
// When assembling out-param helper functions, we copy variables into local clones with matching
// names. We never want to prepend "_in." or "_globals." when writing these variables since
// we're actually targeting the clones.
if (fIgnoreVariableReferenceModifiers) {
- this->writeName(ref.variable()->name());
+ this->writeName(ref.variable()->mangledName());
return;
}
@@ -1384,18 +1480,20 @@ void MetalCodeGenerator::writeVariableReference(const VariableReference& ref) {
default:
const Variable& var = *ref.variable();
if (var.storage() == Variable::Storage::kGlobal) {
- if (var.modifiers().fFlags & Modifiers::kIn_Flag) {
+ if (is_input(var)) {
this->write("_in.");
- } else if (var.modifiers().fFlags & Modifiers::kOut_Flag) {
+ } else if (is_output(var)) {
this->write("_out.");
} else if (var.modifiers().fFlags & Modifiers::kUniform_Flag &&
var.type().typeKind() != Type::TypeKind::kSampler) {
this->write("_uniforms.");
+ } else if (is_threadgroup(var)) {
+ this->write("_threadgroups.");
} else {
this->write("_globals.");
}
}
- this->writeName(var.name());
+ this->writeName(var.mangledName());
}
}
@@ -1837,6 +1935,11 @@ void MetalCodeGenerator::writeFunctionRequirementArgs(const FunctionDeclaration&
this->write("_fragCoord");
separator = ", ";
}
+ if (requirements & kThreadgroups_Requirement) {
+ this->write(separator);
+ this->write("_threadgroups");
+ separator = ", ";
+ }
}
void MetalCodeGenerator::writeFunctionRequirementParams(const FunctionDeclaration& f,
@@ -1867,6 +1970,11 @@ void MetalCodeGenerator::writeFunctionRequirementParams(const FunctionDeclaratio
this->write("float4 _fragCoord");
separator = ", ";
}
+ if (requirements & kThreadgroups_Requirement) {
+ this->write(separator);
+ this->write("threadgroup Threadgroups& _threadgroups");
+ separator = ", ";
+ }
}
int MetalCodeGenerator::getUniformBinding(const Modifiers& m) {
@@ -1879,6 +1987,25 @@ int MetalCodeGenerator::getUniformSet(const Modifiers& m) {
: fProgram.fConfig->fSettings.fDefaultUniformSet;
}
+bool MetalCodeGenerator::writeComputeShaderMainParams() {
+ SkTArray<const SkSL::Variable*> args = Analysis::GetComputeShaderMainParams(fContext, fProgram);
+ const char* separator = "";
+ for (const SkSL::Variable* var : args) {
+ SkASSERT(var);
+ this->write(separator);
+ separator = ", ";
+ this->writeModifiers(var->modifiers());
+ const Type* type = &var->type();
+ this->writeType(*type);
+ if (!var->type().isArray()) {
+ this->write("&");
+ }
+ this->write(" ");
+ this->writeName(var->mangledName());
+ }
+ return !args.empty();
+}
+
bool MetalCodeGenerator::writeFunctionDeclaration(const FunctionDeclaration& f) {
fRTFlipName = fProgram.fInputs.fUseFlipRTUniform
? "_globals._anonInterface0->" SKSL_RTFLIP_NAME
@@ -1889,63 +2016,96 @@ bool MetalCodeGenerator::writeFunctionDeclaration(const FunctionDeclaration& f)
this->write("fragment Outputs fragmentMain");
} else if (ProgramConfig::IsVertex(fProgram.fConfig->fKind)) {
this->write("vertex Outputs vertexMain");
+ } else if (ProgramConfig::IsCompute(fProgram.fConfig->fKind)) {
+ this->write("kernel void computeMain");
} else {
fContext.fErrors->error(Position(), "unsupported kind of program");
return false;
}
- this->write("(Inputs _in [[stage_in]]");
+ this->write("(");
+ if (ProgramConfig::IsCompute(fProgram.fConfig->fKind)) {
+ bool wroteSomething = this->writeComputeShaderMainParams();
+ if (wroteSomething) {
+ separator = ", ";
+ }
+ } else {
+ this->write("Inputs _in [[stage_in]]");
+ separator = ", ";
+ }
if (-1 != fUniformBuffer) {
- this->write(", constant Uniforms& _uniforms [[buffer(" +
+ this->write(separator);
+ this->write("constant Uniforms& _uniforms [[buffer(" +
std::to_string(fUniformBuffer) + ")]]");
+ separator = ", ";
}
for (const ProgramElement* e : fProgram.elements()) {
if (e->is<GlobalVarDeclaration>()) {
const GlobalVarDeclaration& decls = e->as<GlobalVarDeclaration>();
- const VarDeclaration& var = decls.declaration()->as<VarDeclaration>();
- if (var.var().type().typeKind() == Type::TypeKind::kSampler) {
- if (var.var().type().dimensions() != SpvDim2D) {
+ const VarDeclaration& decl = decls.declaration()->as<VarDeclaration>();
+ const Variable& var = decl.var();
+ const SkSL::Type::TypeKind varKind = var.type().typeKind();
+
+ if (varKind == Type::TypeKind::kSampler || varKind == Type::TypeKind::kTexture) {
+ if (var.type().dimensions() != SpvDim2D) {
// Not yet implemented--Skia currently only uses 2D textures.
fContext.fErrors->error(decls.fPosition, "Unsupported texture dimensions");
return false;
}
- int binding = getUniformBinding(var.var().modifiers());
- this->write(", texture2d<half> ");
- this->writeName(var.var().name());
- this->write("[[texture(");
- this->write(std::to_string(binding));
- this->write(")]]");
- this->write(", sampler ");
- this->writeName(var.var().name());
- this->write(SAMPLER_SUFFIX);
- this->write("[[sampler(");
+
+ int binding = getUniformBinding(var.modifiers());
+ this->write(separator);
+ separator = ", ";
+ this->writeTextureType(var.type(), var.modifiers());
+ this->write(" ");
+ this->writeName(var.mangledName());
+ this->write(varKind == Type::TypeKind::kSampler ? kTextureSuffix : "");
+ this->write(" [[texture(");
this->write(std::to_string(binding));
this->write(")]]");
+ if (varKind == Type::TypeKind::kSampler) {
+ this->write(", sampler ");
+ this->writeName(var.mangledName());
+ this->write(kSamplerSuffix);
+ this->write(" [[sampler(");
+ this->write(std::to_string(binding));
+ this->write(")]]");
+ }
}
} else if (e->is<InterfaceBlock>()) {
const InterfaceBlock& intf = e->as<InterfaceBlock>();
if (intf.typeName() == "sk_PerVertex") {
continue;
}
- this->write(", constant ");
+ this->write(is_buffer(intf) ? ", device " : ", constant ");
this->writeType(intf.variable().type());
this->write("& " );
this->write(fInterfaceBlockNameMap[&intf]);
this->write(" [[buffer(");
this->write(std::to_string(this->getUniformBinding(intf.variable().modifiers())));
this->write(")]]");
+ separator = ", ";
}
}
if (ProgramConfig::IsFragment(fProgram.fConfig->fKind)) {
if (fProgram.fInputs.fUseFlipRTUniform && fInterfaceBlockNameMap.empty()) {
- this->write(", constant sksl_synthetic_uniforms& _anonInterface0 [[buffer(1)]]");
+ this->write(separator);
+ this->write("constant sksl_synthetic_uniforms& _anonInterface0 [[buffer(1)]]");
fRTFlipName = "_anonInterface0." SKSL_RTFLIP_NAME;
+ separator = ", ";
}
- this->write(", bool _frontFacing [[front_facing]]");
+ this->write(separator);
+ this->write("bool _frontFacing [[front_facing]]");
this->write(", float4 _fragCoord [[position]]");
+ separator = ", ";
} else if (ProgramConfig::IsVertex(fProgram.fConfig->fKind)) {
- this->write(", uint sk_VertexID [[vertex_id]], uint sk_InstanceID [[instance_id]]");
+ this->write(separator);
+ this->write("uint sk_VertexID [[vertex_id]], uint sk_InstanceID [[instance_id]]");
+ separator = ", ";
+ } else if (ProgramConfig::IsCompute(fProgram.fConfig->fKind)) {
+ this->write(separator);
+ this->write("uint3 sk_ThreadPosition [[thread_position_in_grid]]");
+ separator = ", ";
}
- separator = ", ";
} else {
this->writeType(f.returnType());
this->write(" ");
@@ -1953,20 +2113,19 @@ bool MetalCodeGenerator::writeFunctionDeclaration(const FunctionDeclaration& f)
this->write("(");
this->writeFunctionRequirementParams(f, separator);
}
- for (const auto& param : f.parameters()) {
+ for (const Variable* param : f.parameters()) {
if (f.isMain() && param->modifiers().fLayout.fBuiltin != -1) {
continue;
}
this->write(separator);
separator = ", ";
this->writeModifiers(param->modifiers());
- const Type* type = &param->type();
- this->writeType(*type);
- if (param->modifiers().fFlags & Modifiers::kOut_Flag) {
+ this->writeParameterType(param->type(), param->modifiers());
+ if (pass_by_reference(param->type(), param->modifiers())) {
this->write("&");
}
this->write(" ");
- this->writeName(param->name());
+ this->writeName(param->mangledName());
}
this->write(")");
return true;
@@ -1998,6 +2157,42 @@ static bool is_block_ending_with_return(const Statement* stmt) {
return false;
}
+void MetalCodeGenerator::writeComputeMainInputsAndOutputs() {
+ // Compute shaders have their parameters structured differently than other types of shaders,
+ // receiving individual parameters rather than entire input / output structs. We collect those
+ // parameters into structs here, since the rest of the code expects the normal _in / _out
+ // pattern.
+ this->write(" Inputs _in = { ");
+ const char* separator = "";
+ for (const ProgramElement* e : fProgram.elements()) {
+ if (e->is<GlobalVarDeclaration>()) {
+ const GlobalVarDeclaration& decls = e->as<GlobalVarDeclaration>();
+ const Variable& var = decls.declaration()->as<VarDeclaration>().var();
+ if (is_input(var)) {
+ this->write(separator);
+ separator = ", ";
+ this->writeName(var.mangledName());
+ }
+ }
+ }
+ this->write(" };\n");
+
+ separator = "";
+ this->write(" Outputs _out = { ");
+ for (const ProgramElement* e : fProgram.elements()) {
+ if (e->is<GlobalVarDeclaration>()) {
+ const GlobalVarDeclaration& decls = e->as<GlobalVarDeclaration>();
+ const Variable& var = decls.declaration()->as<VarDeclaration>().var();
+ if (is_output(var)) {
+ this->write(separator);
+ separator = ", ";
+ this->writeName(var.mangledName());
+ }
+ }
+ }
+ this->writeLine(" };");
+}
+
void MetalCodeGenerator::writeFunction(const FunctionDefinition& f) {
SkASSERT(!fProgram.fConfig->fSettings.fFragColorIsInOut);
@@ -2012,8 +2207,14 @@ void MetalCodeGenerator::writeFunction(const FunctionDefinition& f) {
if (f.declaration().isMain()) {
this->writeGlobalInit();
- this->writeLine(" Outputs _out;");
- this->writeLine(" (void)_out;");
+ if (ProgramConfig::IsCompute(fProgram.fConfig->fKind)) {
+ this->writeThreadgroupInit();
+ this->writeComputeMainInputsAndOutputs();
+ }
+ else {
+ this->writeLine(" Outputs _out;");
+ this->writeLine(" (void)_out;");
+ }
}
fFunctionHeader.clear();
@@ -2042,7 +2243,10 @@ void MetalCodeGenerator::writeFunction(const FunctionDefinition& f) {
}
void MetalCodeGenerator::writeModifiers(const Modifiers& modifiers) {
- if (modifiers.fFlags & Modifiers::kOut_Flag) {
+ if (ProgramConfig::IsCompute(fProgram.fConfig->fKind) &&
+ (modifiers.fFlags & (Modifiers::kIn_Flag | Modifiers::kOut_Flag))) {
+ this->write("device ");
+ } else if (modifiers.fFlags & Modifiers::kOut_Flag) {
this->write("thread ");
}
if (modifiers.fFlags & Modifiers::kConst_Flag) {
@@ -2150,7 +2354,7 @@ void MetalCodeGenerator::writeVarDeclaration(const VarDeclaration& varDecl) {
this->writeModifiers(varDecl.var().modifiers());
this->writeType(varDecl.var().type());
this->write(" ");
- this->writeName(varDecl.var().name());
+ this->writeName(varDecl.var().mangledName());
if (varDecl.value()) {
this->write(" = ");
this->writeVarInitializer(varDecl.var(), *varDecl.value());
@@ -2307,6 +2511,8 @@ void MetalCodeGenerator::writeReturnStatementFromMain() {
if (ProgramConfig::IsVertex(fProgram.fConfig->fKind) ||
ProgramConfig::IsFragment(fProgram.fConfig->fKind)) {
this->write("return _out;");
+ } else if (ProgramConfig::IsCompute(fProgram.fConfig->fKind)) {
+ this->write("return;");
} else {
SkDEBUGFAIL("unsupported kind of program");
}
@@ -2343,13 +2549,57 @@ void MetalCodeGenerator::writeHeader() {
this->write("using namespace metal;\n");
}
+void MetalCodeGenerator::writeSampler2DPolyfill() {
+ class : public GlobalStructVisitor {
+ public:
+ void visitInterfaceBlock(const InterfaceBlock& block,
+ std::string_view blockName) override {}
+
+ void visitTexture(const Type& type,
+ const Modifiers& modifiers,
+ std::string_view name) override {}
+
+ void visitSampler(const Type&, std::string_view) override {
+ if (fWrotePolyfill) {
+ return;
+ }
+ fWrotePolyfill = true;
+
+ std::string polyfill = SkSL::String::printf(R"(
+struct sampler2D {
+ texture2d<half> tex;
+ sampler smp;
+};
+half4 sample(sampler2D i, float2 p, float b=%g) { return i.tex.sample(i.smp, p, bias(b)); }
+half4 sample(sampler2D i, float3 p, float b=%g) { return i.tex.sample(i.smp, p.xy / p.z, bias(b)); }
+
+)",
+ fTextureBias,
+ fTextureBias);
+ fCodeGen->write(polyfill.c_str());
+ }
+
+ void visitVariable(const Variable& var, const Expression* value) override {}
+
+ MetalCodeGenerator* fCodeGen = nullptr;
+ float fTextureBias = 0.0f;
+ bool fWrotePolyfill = false;
+ } visitor;
+
+ visitor.fCodeGen = this;
+ visitor.fTextureBias = fProgram.fConfig->fSettings.fSharpenTextures ? kSharpenTexturesBias
+ : 0.0f;
+ this->visitGlobalStruct(&visitor);
+}
+
void MetalCodeGenerator::writeUniformStruct() {
for (const ProgramElement* e : fProgram.elements()) {
if (e->is<GlobalVarDeclaration>()) {
const GlobalVarDeclaration& decls = e->as<GlobalVarDeclaration>();
const Variable& var = decls.declaration()->as<VarDeclaration>().var();
if (var.modifiers().fFlags & Modifiers::kUniform_Flag &&
- var.type().typeKind() != Type::TypeKind::kSampler) {
+ var.type().typeKind() != Type::TypeKind::kSampler &&
+ var.type().typeKind() != Type::TypeKind::kTexture) {
int uniformSet = this->getUniformSet(var.modifiers());
// Make sure that the program's uniform-set value is consistent throughout.
if (-1 == fUniformBuffer) {
@@ -2363,7 +2613,7 @@ void MetalCodeGenerator::writeUniformStruct() {
this->write(" ");
this->writeType(var.type());
this->write(" ");
- this->writeName(var.name());
+ this->writeName(var.mangledName());
this->write(";\n");
}
}
@@ -2379,12 +2629,19 @@ void MetalCodeGenerator::writeInputStruct() {
if (e->is<GlobalVarDeclaration>()) {
const GlobalVarDeclaration& decls = e->as<GlobalVarDeclaration>();
const Variable& var = decls.declaration()->as<VarDeclaration>().var();
- if (var.modifiers().fFlags & Modifiers::kIn_Flag &&
- -1 == var.modifiers().fLayout.fBuiltin) {
+ if (is_input(var)) {
this->write(" ");
+ if (ProgramConfig::IsCompute(fProgram.fConfig->fKind) &&
+ needs_address_space(var.type(), var.modifiers())) {
+ // TODO: address space support
+ this->write("device ");
+ }
this->writeType(var.type());
+ if (pass_by_reference(var.type(), var.modifiers())) {
+ this->write("&");
+ }
this->write(" ");
- this->writeName(var.name());
+ this->writeName(var.mangledName());
if (-1 != var.modifiers().fLayout.fLocation) {
if (ProgramConfig::IsVertex(fProgram.fConfig->fKind)) {
this->write(" [[attribute(" +
@@ -2412,15 +2669,24 @@ void MetalCodeGenerator::writeOutputStruct() {
if (e->is<GlobalVarDeclaration>()) {
const GlobalVarDeclaration& decls = e->as<GlobalVarDeclaration>();
const Variable& var = decls.declaration()->as<VarDeclaration>().var();
- if (var.modifiers().fFlags & Modifiers::kOut_Flag &&
- -1 == var.modifiers().fLayout.fBuiltin) {
+ if (is_output(var)) {
this->write(" ");
+ if (ProgramConfig::IsCompute(fProgram.fConfig->fKind) &&
+ needs_address_space(var.type(), var.modifiers())) {
+ // TODO: address space support
+ this->write("device ");
+ }
this->writeType(var.type());
+ if (ProgramConfig::IsCompute(fProgram.fConfig->fKind) &&
+ pass_by_reference(var.type(), var.modifiers())) {
+ this->write("&");
+ }
this->write(" ");
- this->writeName(var.name());
+ this->writeName(var.mangledName());
int location = var.modifiers().fLayout.fLocation;
- if (location < 0) {
+ if (!ProgramConfig::IsCompute(fProgram.fConfig->fKind) && location < 0 &&
+ var.type().typeKind() != Type::TypeKind::kTexture) {
fContext.fErrors->error(var.fPosition,
"Metal out variables must have 'layout(location=...)'");
} else if (ProgramConfig::IsVertex(fProgram.fConfig->fKind)) {
@@ -2479,14 +2745,15 @@ void MetalCodeGenerator::visitGlobalStruct(GlobalStructVisitor* visitor) {
const VarDeclaration& decl = global.declaration()->as<VarDeclaration>();
const Variable& var = decl.var();
if (var.type().typeKind() == Type::TypeKind::kSampler) {
- // Samplers are represented as a "texture/sampler" duo in the global struct.
- visitor->visitTexture(var.type(), var.name());
- visitor->visitSampler(var.type(), std::string(var.name()) + SAMPLER_SUFFIX);
+ visitor->visitSampler(var.type(), var.mangledName());
+ continue;
+ }
+ if (var.type().typeKind() == Type::TypeKind::kTexture) {
+ visitor->visitTexture(var.type(), var.modifiers(), var.mangledName());
continue;
}
-
if (!(var.modifiers().fFlags & ~Modifiers::kConst_Flag) &&
- -1 == var.modifiers().fLayout.fBuiltin) {
+ var.modifiers().fLayout.fBuiltin == -1) {
// Visit a regular variable.
visitor->visitVariable(var, decl.value().get());
}
@@ -2499,23 +2766,24 @@ void MetalCodeGenerator::writeGlobalStruct() {
void visitInterfaceBlock(const InterfaceBlock& block,
std::string_view blockName) override {
this->addElement();
- fCodeGen->write(" constant ");
+ fCodeGen->write(is_buffer(block) ? " device " : " constant ");
fCodeGen->write(block.typeName());
fCodeGen->write("* ");
fCodeGen->writeName(blockName);
fCodeGen->write(";\n");
}
- void visitTexture(const Type& type, std::string_view name) override {
+ void visitTexture(const Type& type, const Modifiers& modifiers,
+ std::string_view name) override {
this->addElement();
fCodeGen->write(" ");
- fCodeGen->writeType(type);
+ fCodeGen->writeTextureType(type, modifiers);
fCodeGen->write(" ");
fCodeGen->writeName(name);
fCodeGen->write(";\n");
}
void visitSampler(const Type&, std::string_view name) override {
this->addElement();
- fCodeGen->write(" sampler ");
+ fCodeGen->write(" sampler2D ");
fCodeGen->writeName(name);
fCodeGen->write(";\n");
}
@@ -2525,7 +2793,7 @@ void MetalCodeGenerator::writeGlobalStruct() {
fCodeGen->writeModifiers(var.modifiers());
fCodeGen->writeType(var.type());
fCodeGen->write(" ");
- fCodeGen->writeName(var.name());
+ fCodeGen->writeName(var.mangledName());
fCodeGen->write(";\n");
}
void addElement() {
@@ -2559,13 +2827,19 @@ void MetalCodeGenerator::writeGlobalInit() {
fCodeGen->write("&");
fCodeGen->writeName(blockName);
}
- void visitTexture(const Type&, std::string_view name) override {
+ void visitTexture(const Type&, const Modifiers& modifiers, std::string_view name) override {
this->addElement();
fCodeGen->writeName(name);
}
void visitSampler(const Type&, std::string_view name) override {
this->addElement();
+ fCodeGen->write("{");
fCodeGen->writeName(name);
+ fCodeGen->write(kTextureSuffix);
+ fCodeGen->write(", ");
+ fCodeGen->writeName(name);
+ fCodeGen->write(kSamplerSuffix);
+ fCodeGen->write("}");
}
void visitVariable(const Variable& var, const Expression* value) override {
this->addElement();
@@ -2598,6 +2872,85 @@ void MetalCodeGenerator::writeGlobalInit() {
visitor.finish();
}
+void MetalCodeGenerator::visitThreadgroupStruct(ThreadgroupStructVisitor* visitor) {
+ for (const ProgramElement* element : fProgram.elements()) {
+ if (!element->is<GlobalVarDeclaration>()) {
+ continue;
+ }
+ const GlobalVarDeclaration& global = element->as<GlobalVarDeclaration>();
+ const VarDeclaration& decl = global.declaration()->as<VarDeclaration>();
+ const Variable& var = decl.var();
+ if (var.modifiers().fFlags & Modifiers::kThreadgroup_Flag) {
+ SkASSERT(!decl.value());
+ visitor->visitVariable(var);
+ }
+ }
+}
+
+void MetalCodeGenerator::writeThreadgroupStruct() {
+ class : public ThreadgroupStructVisitor {
+ public:
+ void visitVariable(const Variable& var) override {
+ this->addElement();
+ fCodeGen->write(" ");
+ fCodeGen->writeModifiers(var.modifiers());
+ fCodeGen->writeType(var.type());
+ fCodeGen->write(" ");
+ fCodeGen->writeName(var.mangledName());
+ fCodeGen->write(";\n");
+ }
+ void addElement() {
+ if (fFirst) {
+ fCodeGen->write("struct Threadgroups {\n");
+ fFirst = false;
+ }
+ }
+ void finish() {
+ if (!fFirst) {
+ fCodeGen->writeLine("};");
+ fFirst = true;
+ }
+ }
+
+ MetalCodeGenerator* fCodeGen = nullptr;
+ bool fFirst = true;
+ } visitor;
+
+ visitor.fCodeGen = this;
+ this->visitThreadgroupStruct(&visitor);
+ visitor.finish();
+}
+
+void MetalCodeGenerator::writeThreadgroupInit() {
+ class : public ThreadgroupStructVisitor {
+ public:
+ void visitVariable(const Variable& var) override {
+ this->addElement();
+ fCodeGen->write("{}");
+ }
+ void addElement() {
+ if (fFirst) {
+ fCodeGen->write(" threadgroup Threadgroups _threadgroups{");
+ fFirst = false;
+ } else {
+ fCodeGen->write(", ");
+ }
+ }
+ void finish() {
+ if (!fFirst) {
+ fCodeGen->writeLine("};");
+ fCodeGen->writeLine(" (void)_threadgroups;");
+ }
+ }
+ MetalCodeGenerator* fCodeGen = nullptr;
+ bool fFirst = true;
+ } visitor;
+
+ visitor.fCodeGen = this;
+ this->visitThreadgroupStruct(&visitor);
+ visitor.finish();
+}
+
void MetalCodeGenerator::writeProgramElement(const ProgramElement& e) {
switch (e.kind()) {
case ProgramElement::Kind::kExtension:
@@ -2695,6 +3048,8 @@ MetalCodeGenerator::Requirements MetalCodeGenerator::requirements(const Expressi
} else if (modifiers.fFlags & Modifiers::kUniform_Flag &&
v.variable()->type().typeKind() != Type::TypeKind::kSampler) {
result = kUniforms_Requirement;
+ } else if (modifiers.fFlags & Modifiers::kThreadgroup_Flag) {
+ result = kThreadgroups_Requirement;
} else {
result = kGlobals_Requirement;
}
@@ -2785,12 +3140,14 @@ bool MetalCodeGenerator::generateCode() {
{
AutoOutputStream outputToHeader(this, &header, &fIndentation);
this->writeHeader();
+ this->writeSampler2DPolyfill();
this->writeStructDefinitions();
this->writeUniformStruct();
this->writeInputStruct();
this->writeOutputStruct();
this->writeInterfaceBlocks();
this->writeGlobalStruct();
+ this->writeThreadgroupStruct();
}
StringStream body;
{
diff --git a/chromium/third_party/skia/src/sksl/codegen/SkSLMetalCodeGenerator.h b/chromium/third_party/skia/src/sksl/codegen/SkSLMetalCodeGenerator.h
index 01da5f58ebb..f0bfef139a2 100644
--- a/chromium/third_party/skia/src/sksl/codegen/SkSLMetalCodeGenerator.h
+++ b/chromium/third_party/skia/src/sksl/codegen/SkSLMetalCodeGenerator.h
@@ -16,7 +16,7 @@
#include "src/sksl/codegen/SkSLCodeGenerator.h"
#include "src/sksl/ir/SkSLType.h"
-#include <stdint.h>
+#include <cstdint>
#include <initializer_list>
#include <set>
#include <string>
@@ -71,9 +71,6 @@ struct Swizzle;
*/
class MetalCodeGenerator : public CodeGenerator {
public:
- inline static constexpr const char* SAMPLER_SUFFIX = "Smplr";
- inline static constexpr const char* PACKED_PREFIX = "packed_";
-
MetalCodeGenerator(const Context* context, const Program* program, OutputStream* out)
: INHERITED(context, program, out)
, fReservedWords({"atan2", "rsqrt", "rint", "dfdx", "dfdy", "vertex", "fragment"})
@@ -85,16 +82,20 @@ protected:
using Precedence = Operator::Precedence;
typedef int Requirements;
- inline static constexpr Requirements kNo_Requirements = 0;
- inline static constexpr Requirements kInputs_Requirement = 1 << 0;
- inline static constexpr Requirements kOutputs_Requirement = 1 << 1;
- inline static constexpr Requirements kUniforms_Requirement = 1 << 2;
- inline static constexpr Requirements kGlobals_Requirement = 1 << 3;
- inline static constexpr Requirements kFragCoord_Requirement = 1 << 4;
+ inline static constexpr Requirements kNo_Requirements = 0;
+ inline static constexpr Requirements kInputs_Requirement = 1 << 0;
+ inline static constexpr Requirements kOutputs_Requirement = 1 << 1;
+ inline static constexpr Requirements kUniforms_Requirement = 1 << 2;
+ inline static constexpr Requirements kGlobals_Requirement = 1 << 3;
+ inline static constexpr Requirements kFragCoord_Requirement = 1 << 4;
+ inline static constexpr Requirements kThreadgroups_Requirement = 1 << 5;
class GlobalStructVisitor;
void visitGlobalStruct(GlobalStructVisitor* visitor);
+ class ThreadgroupStructVisitor;
+ void visitThreadgroupStruct(ThreadgroupStructVisitor* visitor);
+
void write(std::string_view s);
void writeLine(std::string_view s = std::string_view());
@@ -103,6 +104,8 @@ protected:
void writeHeader();
+ void writeSampler2DPolyfill();
+
void writeUniformStruct();
void writeInputStruct();
@@ -124,14 +127,24 @@ protected:
void writeGlobalInit();
+ void writeThreadgroupStruct();
+
+ void writeThreadgroupInit();
+
void writePrecisionModifier();
std::string typeName(const Type& type);
+ std::string textureTypeName(const Type& type, const Modifiers* modifiers);
+
void writeStructDefinition(const StructDefinition& s);
void writeType(const Type& type);
+ void writeTextureType(const Type& type, const Modifiers& modifiers);
+
+ void writeParameterType(const Type& type, const Modifiers& modifiers);
+
void writeExtension(const Extension& ext);
void writeInterfaceBlock(const InterfaceBlock& intf);
@@ -166,8 +179,8 @@ protected:
void writeMinAbsHack(Expression& absExpr, Expression& otherExpr);
std::string getOutParamHelper(const FunctionCall& c,
- const ExpressionArray& arguments,
- const SkTArray<VariableReference*>& outVars);
+ const ExpressionArray& arguments,
+ const SkTArray<VariableReference*>& outVars);
std::string getInversePolyfill(const ExpressionArray& arguments);
@@ -276,6 +289,13 @@ protected:
Requirements requirements(const Statement* s);
+ // Returns true if it wrote anything
+ bool writeComputeShaderMainParams();
+
+ // For compute shader main functions, writes and initializes the _in and _out structs (the
+ // instances, not the types themselves)
+ void writeComputeMainInputsAndOutputs();
+
int getUniformBinding(const Modifiers& m);
int getUniformSet(const Modifiers& m);
@@ -302,6 +322,8 @@ protected:
const FunctionDeclaration* fCurrentFunction = nullptr;
int fSwizzleHelperCount = 0;
bool fIgnoreVariableReferenceModifiers = false;
+ static constexpr char kTextureSuffix[] = "_Tex";
+ static constexpr char kSamplerSuffix[] = "_Smplr";
using INHERITED = CodeGenerator;
};
diff --git a/chromium/third_party/skia/src/sksl/codegen/SkSLPipelineStageCodeGenerator.cpp b/chromium/third_party/skia/src/sksl/codegen/SkSLPipelineStageCodeGenerator.cpp
index 5cf8fba6c50..a0c033f8bac 100644
--- a/chromium/third_party/skia/src/sksl/codegen/SkSLPipelineStageCodeGenerator.cpp
+++ b/chromium/third_party/skia/src/sksl/codegen/SkSLPipelineStageCodeGenerator.cpp
@@ -358,6 +358,11 @@ std::string PipelineStageCodeGenerator::functionName(const FunctionDeclaration&
}
void PipelineStageCodeGenerator::writeFunction(const FunctionDefinition& f) {
+ if (f.declaration().isBuiltin()) {
+ // Don't re-emit builtin functions.
+ return;
+ }
+
AutoOutputBuffer body(this);
// We allow public SkSL's main() to return half4 -or- float4 (ie vec4). When we emit
@@ -407,7 +412,7 @@ std::string PipelineStageCodeGenerator::functionDeclaration(const FunctionDeclar
}
void PipelineStageCodeGenerator::writeFunctionDeclaration(const FunctionDeclaration& decl) {
- if (!decl.isMain()) {
+ if (!decl.isMain() && !decl.isBuiltin()) {
fCallbacks->declareFunction(this->functionDeclaration(decl).c_str());
}
}
diff --git a/chromium/third_party/skia/src/sksl/codegen/SkSLSPIRVCodeGenerator.cpp b/chromium/third_party/skia/src/sksl/codegen/SkSLSPIRVCodeGenerator.cpp
index 602996cd004..0b1f8e2ec1d 100644
--- a/chromium/third_party/skia/src/sksl/codegen/SkSLSPIRVCodeGenerator.cpp
+++ b/chromium/third_party/skia/src/sksl/codegen/SkSLSPIRVCodeGenerator.cpp
@@ -31,6 +31,7 @@
#include "src/sksl/SkSLProgramSettings.h"
#include "src/sksl/SkSLThreadContext.h"
#include "src/sksl/SkSLUtil.h"
+#include "src/sksl/analysis/SkSLProgramUsage.h"
#include "src/sksl/ir/SkSLBinaryExpression.h"
#include "src/sksl/ir/SkSLBlock.h"
#include "src/sksl/ir/SkSLConstructor.h"
@@ -68,6 +69,7 @@
#include <cmath>
#include <set>
+#include <string>
#include <type_traits>
#include <utility>
@@ -761,7 +763,7 @@ SpvId SPIRVCodeGenerator::writeOpCompositeConstruct(const Type& type,
// If this is a vector composed entirely of literals, write a constant-composite instead.
if (type.isVector()) {
SkSTArray<4, SpvId> constants;
- if (this->toConstants(SkMakeSpan(values), &constants)) {
+ if (this->toConstants(SkSpan(values), &constants)) {
// Create a vector from literals.
return this->writeOpConstantComposite(type, constants);
}
@@ -770,7 +772,7 @@ SpvId SPIRVCodeGenerator::writeOpCompositeConstruct(const Type& type,
// If this is a matrix composed entirely of literals, constant-composite them instead.
if (type.isMatrix()) {
SkSTArray<16, SpvId> constants;
- if (this->toConstants(SkMakeSpan(values), &constants)) {
+ if (this->toConstants(SkSpan(values), &constants)) {
// Create each matrix column.
SkASSERT(type.isMatrix());
const Type& vecType = type.componentType().toCompound(fContext,
@@ -3654,9 +3656,9 @@ void SPIRVCodeGenerator::writeDoStatement(const DoStatement& d, OutputStream& ou
this->writeStatement(*d.statement(), out);
if (fCurrentBlock) {
this->writeInstruction(SpvOpBranch, next, out);
+ this->writeLabel(next, kBranchIsOnPreviousLine, out);
+ this->writeInstruction(SpvOpBranch, continueTarget, out);
}
- this->writeLabel(next, kBranchIsOnPreviousLine, out);
- this->writeInstruction(SpvOpBranch, continueTarget, out);
this->writeLabel(continueTarget, kBranchIsAbove, conditionalOps, out);
SpvId test = this->writeExpression(*d.test(), out);
this->writeInstruction(SpvOpBranchConditional, test, header, end, out);
@@ -3825,8 +3827,8 @@ void SPIRVCodeGenerator::writeUniformBuffer(std::shared_ptr<SymbolTable> topLeve
fUniformBuffer.fInnerVariable = std::make_unique<Variable>(
/*pos=*/Position(), /*modifiersPosition=*/Position(),
- fProgram.fModifiers->add(modifiers), kUniformBufferName, fUniformBuffer.fStruct.get(),
- /*builtin=*/false, Variable::Storage::kGlobal);
+ fContext.fModifiersPool->add(modifiers), kUniformBufferName,
+ fUniformBuffer.fStruct.get(), /*builtin=*/false, Variable::Storage::kGlobal);
// Create an interface block object for this global variable.
fUniformBuffer.fInterfaceBlock = std::make_unique<InterfaceBlock>(
@@ -3890,7 +3892,7 @@ void SPIRVCodeGenerator::addRTFlipUniform(Position pos) {
/*builtin=*/-1,
/*inputAttachmentIndex=*/-1),
Modifiers::kUniform_Flag);
- modsPtr = fProgram.fModifiers->add(modifiers);
+ modsPtr = fContext.fModifiersPool->add(modifiers);
}
const Variable* intfVar = fSynthetics.takeOwnershipOfSymbol(
std::make_unique<Variable>(/*pos=*/Position(),
@@ -3910,7 +3912,7 @@ void SPIRVCodeGenerator::addRTFlipUniform(Position pos) {
name,
/*instanceName=*/"",
/*arraySize=*/0,
- std::make_shared<SymbolTable>(fContext, /*builtin=*/false));
+ std::make_shared<SymbolTable>(/*builtin=*/false));
this->writeInterfaceBlock(intf, false);
}
diff --git a/chromium/third_party/skia/src/sksl/codegen/SkSLSPIRVCodeGenerator.h b/chromium/third_party/skia/src/sksl/codegen/SkSLSPIRVCodeGenerator.h
index f5e5bd29400..464e6049e85 100644
--- a/chromium/third_party/skia/src/sksl/codegen/SkSLSPIRVCodeGenerator.h
+++ b/chromium/third_party/skia/src/sksl/codegen/SkSLSPIRVCodeGenerator.h
@@ -25,10 +25,10 @@
#include "src/sksl/ir/SkSLVariable.h"
#include "src/sksl/spirv.h"
+#include <cstddef>
#include <cstdint>
#include <memory>
#include <stack>
-#include <string>
#include <string_view>
#include <vector>
@@ -108,7 +108,7 @@ public:
, fCapabilities(0)
, fIdCount(1)
, fCurrentBlock(0)
- , fSynthetics(fContext, /*builtin=*/true) {}
+ , fSynthetics(/*builtin=*/true) {}
bool generateCode() override;
diff --git a/chromium/third_party/skia/src/sksl/codegen/SkSLSPIRVtoHLSL.cpp b/chromium/third_party/skia/src/sksl/codegen/SkSLSPIRVtoHLSL.cpp
index 8f63bf0380c..98bb969c5bf 100644
--- a/chromium/third_party/skia/src/sksl/codegen/SkSLSPIRVtoHLSL.cpp
+++ b/chromium/third_party/skia/src/sksl/codegen/SkSLSPIRVtoHLSL.cpp
@@ -9,7 +9,7 @@
#if defined(SK_ENABLE_SPIRV_CROSS)
-#include "third_party/externals/spirv-cross/spirv_hlsl.hpp"
+#include <spirv_hlsl.hpp>
/*
* This translation unit serves as a bridge between Skia/SkSL and SPIRV-Cross.
diff --git a/chromium/third_party/skia/src/sksl/codegen/SkSLVMCodeGenerator.cpp b/chromium/third_party/skia/src/sksl/codegen/SkSLVMCodeGenerator.cpp
index afa8026752f..99defe71f62 100644
--- a/chromium/third_party/skia/src/sksl/codegen/SkSLVMCodeGenerator.cpp
+++ b/chromium/third_party/skia/src/sksl/codegen/SkSLVMCodeGenerator.cpp
@@ -62,7 +62,7 @@
#include "src/sksl/tracing/SkVMDebugTrace.h"
#include <algorithm>
-#include <cstddef>
+#include <cstdint>
#include <functional>
#include <iterator>
#include <string_view>
@@ -155,7 +155,7 @@ struct Value {
return fVals[i];
}
- SkSpan<skvm::Val> asSpan() { return SkMakeSpan(fVals); }
+ SkSpan<skvm::Val> asSpan() { return SkSpan(fVals); }
private:
SkSTArray<4, skvm::Val, true> fVals;
@@ -1341,7 +1341,7 @@ Value SkVMGenerator::writeIntrinsicCall(const FunctionCall& c) {
const size_t nargs = c.arguments().size();
const size_t kMaxArgs = 3; // eg: clamp, mix, smoothstep
Value args[kMaxArgs];
- SkASSERT(nargs >= 1 && nargs <= SK_ARRAY_COUNT(args));
+ SkASSERT(nargs >= 1 && nargs <= std::size(args));
// All other intrinsics have at most three args, and those can all be evaluated up front:
for (size_t i = 0; i < nargs; ++i) {
@@ -1599,7 +1599,7 @@ Value SkVMGenerator::writeFunctionCall(const FunctionCall& call) {
// This merges currentFunction().fReturned into fConditionMask. Lanes that conditionally
// returned in the current function would otherwise resume execution within the child.
ScopedCondition m(this, ~currentFunction().fReturned);
- returnSlot = this->writeFunction(call, funcDef, SkMakeSpan(argVals));
+ returnSlot = this->writeFunction(call, funcDef, SkSpan(argVals));
}
// Propagate new values of any 'out' params back to the original arguments
@@ -2118,13 +2118,13 @@ skvm::Color ProgramToSkVM(const Program& program,
switch (param->modifiers().fLayout.fBuiltin) {
case SK_MAIN_COORDS_BUILTIN:
SkASSERT(param->type().slotCount() == 2);
- SkASSERT((argSlots + 2) <= SK_ARRAY_COUNT(args));
+ SkASSERT((argSlots + 2) <= std::size(args));
args[argSlots++] = local.x.id;
args[argSlots++] = local.y.id;
break;
case SK_INPUT_COLOR_BUILTIN:
SkASSERT(param->type().slotCount() == 4);
- SkASSERT((argSlots + 4) <= SK_ARRAY_COUNT(args));
+ SkASSERT((argSlots + 4) <= std::size(args));
args[argSlots++] = inputColor.r.id;
args[argSlots++] = inputColor.g.id;
args[argSlots++] = inputColor.b.id;
@@ -2132,7 +2132,7 @@ skvm::Color ProgramToSkVM(const Program& program,
break;
case SK_DEST_COLOR_BUILTIN:
SkASSERT(param->type().slotCount() == 4);
- SkASSERT((argSlots + 4) <= SK_ARRAY_COUNT(args));
+ SkASSERT((argSlots + 4) <= std::size(args));
args[argSlots++] = destColor.r.id;
args[argSlots++] = destColor.g.id;
args[argSlots++] = destColor.b.id;
@@ -2143,7 +2143,7 @@ skvm::Color ProgramToSkVM(const Program& program,
return {};
}
}
- SkASSERT(argSlots <= SK_ARRAY_COUNT(args));
+ SkASSERT(argSlots <= std::size(args));
// Make sure that the SkVMDebugTrace starts from a clean slate.
if (debugTrace) {
@@ -2153,7 +2153,7 @@ skvm::Color ProgramToSkVM(const Program& program,
}
SkVMGenerator generator(program, builder, debugTrace, callbacks);
- generator.writeProgram(uniforms, device, function, {args, argSlots}, SkMakeSpan(result));
+ generator.writeProgram(uniforms, device, function, {args, argSlots}, SkSpan(result));
return skvm::Color{{builder, result[0]},
{builder, result[1]},
@@ -2232,7 +2232,7 @@ bool ProgramToSkVM(const Program& program,
Callbacks callbacks(sampledColor);
SkVMGenerator generator(program, b, debugTrace, &callbacks);
- generator.writeProgram(uniforms, device, function, SkMakeSpan(argVals), SkMakeSpan(returnVals));
+ generator.writeProgram(uniforms, device, function, SkSpan(argVals), SkSpan(returnVals));
// If the SkSL tried to use any shader, colorFilter, or blender objects - we don't have a
// mechanism (yet) for binding to those.
@@ -2396,7 +2396,7 @@ bool testingOnly_ProgramToSkVMShader(const Program& program,
skvm::Color destColor = builder->uniformColor(SkColors::kBlack, &uniforms);
skvm::Color result = SkSL::ProgramToSkVM(program, *main, builder, debugTrace,
- SkMakeSpan(uniformVals), device, local, inColor,
+ SkSpan(uniformVals), device, local, inColor,
destColor, &callbacks);
storeF(builder->varying<float>(), result.r);
diff --git a/chromium/third_party/skia/src/sksl/codegen/SkSLVMCodeGenerator.h b/chromium/third_party/skia/src/sksl/codegen/SkSLVMCodeGenerator.h
index d8777ad3582..fb5550163b8 100644
--- a/chromium/third_party/skia/src/sksl/codegen/SkSLVMCodeGenerator.h
+++ b/chromium/third_party/skia/src/sksl/codegen/SkSLVMCodeGenerator.h
@@ -11,6 +11,7 @@
#include "src/core/SkVM.h"
#include "src/sksl/ir/SkSLType.h"
+#include <cstddef>
#include <memory>
#include <string>
#include <vector>
diff --git a/chromium/third_party/skia/src/sksl/codegen/SkSLWGSLCodeGenerator.cpp b/chromium/third_party/skia/src/sksl/codegen/SkSLWGSLCodeGenerator.cpp
index 03735f2030b..2f56c5094c9 100644
--- a/chromium/third_party/skia/src/sksl/codegen/SkSLWGSLCodeGenerator.cpp
+++ b/chromium/third_party/skia/src/sksl/codegen/SkSLWGSLCodeGenerator.cpp
@@ -568,7 +568,7 @@ void WGSLCodeGenerator::writeFunctionDeclaration(const FunctionDeclaration& f) {
for (const Variable* param : f.parameters()) {
this->write(separator);
separator = ", ";
- this->writeName(param->name());
+ this->writeName(param->mangledName());
this->write(": ");
// Declare an "out" function parameter as a pointer.
@@ -594,14 +594,14 @@ void WGSLCodeGenerator::writeEntryPoint(const FunctionDefinition& main) {
// function.
std::string outputType;
if (ProgramConfig::IsVertex(fProgram.fConfig->fKind)) {
- this->write("@stage(vertex) fn vertexMain(");
+ this->write("@vertex fn vertexMain(");
if (fPipelineInputCount > 0) {
this->write("_stageIn: VSIn");
}
this->writeLine(") -> VSOut {");
outputType = "VSOut";
} else if (ProgramConfig::IsFragment(fProgram.fConfig->fKind)) {
- this->write("@stage(fragment) fn fragmentMain(");
+ this->write("@fragment fn fragmentMain(");
if (fPipelineInputCount > 0) {
this->write("_stageIn: FSIn");
}
@@ -735,7 +735,7 @@ void WGSLCodeGenerator::writeVarDeclaration(const VarDeclaration& varDecl) {
} else {
this->write("var ");
}
- this->writeName(varDecl.var().name());
+ this->writeName(varDecl.var().mangledName());
this->write(": ");
this->write(to_wgsl_type(varDecl.var().type()));
@@ -880,7 +880,7 @@ void WGSLCodeGenerator::writeVariableReference(const VariableReference& r) {
}
}
- this->writeName(v.name());
+ this->writeName(v.mangledName());
if (conversion.has_value()) {
this->write(")");
@@ -978,7 +978,7 @@ void WGSLCodeGenerator::writeStageInputStruct() {
e->as<GlobalVarDeclaration>().declaration()->as<VarDeclaration>().var();
if (v.modifiers().fFlags & Modifiers::kIn_Flag) {
this->writePipelineIODeclaration(
- v.modifiers(), v.type(), v.name(), Delimiter::kComma);
+ v.modifiers(), v.type(), v.mangledName(), Delimiter::kComma);
if (v.modifiers().fLayout.fBuiltin == SK_FRAGCOORD_BUILTIN) {
declaredFragCoordsBuiltin = true;
}
@@ -1033,7 +1033,7 @@ void WGSLCodeGenerator::writeStageOutputStruct() {
e->as<GlobalVarDeclaration>().declaration()->as<VarDeclaration>().var();
if (v.modifiers().fFlags & Modifiers::kOut_Flag) {
this->writePipelineIODeclaration(
- v.modifiers(), v.type(), v.name(), Delimiter::kComma);
+ v.modifiers(), v.type(), v.mangledName(), Delimiter::kComma);
}
} else if (e->is<InterfaceBlock>()) {
const Variable& v = e->as<InterfaceBlock>().variable();
diff --git a/chromium/third_party/skia/src/sksl/codegen/SkSLWGSLCodeGenerator.h b/chromium/third_party/skia/src/sksl/codegen/SkSLWGSLCodeGenerator.h
index d592f21bcf0..e44d03d7245 100644
--- a/chromium/third_party/skia/src/sksl/codegen/SkSLWGSLCodeGenerator.h
+++ b/chromium/third_party/skia/src/sksl/codegen/SkSLWGSLCodeGenerator.h
@@ -8,16 +8,16 @@
#ifndef SKSL_WGSLCODEGENERATOR
#define SKSL_WGSLCODEGENERATOR
-#include <stdint.h>
-#include <string_view>
-#include <type_traits>
-#include <utility>
-
#include "include/private/SkSLDefines.h"
#include "include/private/SkTHash.h"
#include "include/sksl/SkSLOperator.h"
#include "src/sksl/codegen/SkSLCodeGenerator.h"
+#include <cstdint>
+#include <string_view>
+#include <type_traits>
+#include <utility>
+
namespace sknonstd {
template <typename T> struct is_bitmask_enum;
} // namespace sknonstd
diff --git a/chromium/third_party/skia/src/sksl/dsl/DSLCore.cpp b/chromium/third_party/skia/src/sksl/dsl/DSLCore.cpp
index 97ba0b75b54..34ed3a127c4 100644
--- a/chromium/third_party/skia/src/sksl/dsl/DSLCore.cpp
+++ b/chromium/third_party/skia/src/sksl/dsl/DSLCore.cpp
@@ -47,8 +47,8 @@
#include "src/sksl/ir/SkSLType.h"
#include "src/sksl/ir/SkSLVarDeclarations.h"
#include "src/sksl/ir/SkSLVariable.h"
-#include "src/sksl/transform/SkSLTransform.h"
+#include <cstddef>
#include <type_traits>
#include <vector>
@@ -89,12 +89,6 @@ public:
static std::unique_ptr<SkSL::Program> ReleaseProgram(std::unique_ptr<std::string> source) {
ThreadContext& instance = ThreadContext::Instance();
SkSL::Compiler& compiler = *instance.fCompiler;
- const SkSL::Context& context = *compiler.fContext;
- // Variables defined in the pre-includes need their declaring elements added to the program
- if (!instance.fConfig->fIsBuiltinCode && context.fBuiltins) {
- Transform::FindAndDeclareBuiltinVariables(context, instance.fConfig->fKind,
- instance.fSharedElements);
- }
Pool* pool = instance.fPool.get();
auto result = std::make_unique<SkSL::Program>(std::move(source),
std::move(instance.fConfig),
diff --git a/chromium/third_party/skia/src/sksl/dsl/DSLFunction.cpp b/chromium/third_party/skia/src/sksl/dsl/DSLFunction.cpp
index 7b93e561b5d..8a2792f518b 100644
--- a/chromium/third_party/skia/src/sksl/dsl/DSLFunction.cpp
+++ b/chromium/third_party/skia/src/sksl/dsl/DSLFunction.cpp
@@ -25,6 +25,7 @@
#include "src/sksl/ir/SkSLFunctionPrototype.h"
#include "src/sksl/ir/SkSLVariable.h"
+#include <cstddef>
#include <memory>
#include <string>
#include <vector>
diff --git a/chromium/third_party/skia/src/sksl/dsl/DSLSymbols.cpp b/chromium/third_party/skia/src/sksl/dsl/DSLSymbols.cpp
index ffc61af1114..9eb36e778ad 100644
--- a/chromium/third_party/skia/src/sksl/dsl/DSLSymbols.cpp
+++ b/chromium/third_party/skia/src/sksl/dsl/DSLSymbols.cpp
@@ -7,13 +7,11 @@
#include "include/sksl/DSLSymbols.h"
-#include "include/private/SkSLSymbol.h"
#include "include/sksl/SkSLPosition.h"
#include "src/sksl/SkSLCompiler.h"
#include "src/sksl/SkSLThreadContext.h"
#include "src/sksl/dsl/priv/DSLWriter.h"
#include "src/sksl/ir/SkSLSymbolTable.h"
-#include "src/sksl/ir/SkSLType.h"
#include "src/sksl/ir/SkSLVariable.h"
#include <type_traits>
@@ -24,11 +22,6 @@ namespace dsl {
class DSLVarBase;
-static bool is_type_in_symbol_table(std::string_view name, SkSL::SymbolTable* symbols) {
- const SkSL::Symbol* s = (*symbols)[name];
- return s && s->is<Type>();
-}
-
void PushSymbolTable() {
SymbolTable::Push(&ThreadContext::SymbolTable());
}
@@ -45,14 +38,6 @@ DSLExpression Symbol(std::string_view name, Position pos) {
return DSLExpression(ThreadContext::Compiler().convertIdentifier(pos, name), pos);
}
-bool IsType(std::string_view name) {
- return is_type_in_symbol_table(name, CurrentSymbolTable().get());
-}
-
-bool IsBuiltinType(std::string_view name) {
- return is_type_in_symbol_table(name, CurrentSymbolTable()->builtinParent());
-}
-
void AddToSymbolTable(DSLVarBase& var, Position pos) {
const SkSL::Variable* skslVar = DSLWriter::Var(var);
if (skslVar) {
diff --git a/chromium/third_party/skia/src/sksl/generated/sksl_compute.dehydrated.sksl b/chromium/third_party/skia/src/sksl/generated/sksl_compute.dehydrated.sksl
new file mode 100644
index 00000000000..cc6e07fa7be
--- /dev/null
+++ b/chromium/third_party/skia/src/sksl/generated/sksl_compute.dehydrated.sksl
@@ -0,0 +1,80 @@
+static constexpr uint8_t SKSL_INCLUDE_sksl_compute[] = {14,0,111,0,
+17,115,107,95,84,104,114,101,97,100,80,111,115,105,116,105,111,110,
+5,117,105,110,116,51,
+1,116,
+9,116,101,120,116,117,114,101,50,68,
+3,112,111,115,
+5,117,105,110,116,50,
+4,114,101,97,100,
+5,104,97,108,102,52,
+5,99,111,108,111,114,
+5,119,114,105,116,101,
+4,118,111,105,100,
+5,119,105,100,116,104,
+4,117,105,110,116,
+6,104,101,105,103,104,116,
+18,116,104,114,101,97,100,103,114,111,117,112,66,97,114,114,105,101,114,
+52,1,13,0,
+54,1,0,
+38,
+37,0,2,0,0,255,255,255,255,255,255,255,28,0,255,16,2,0,
+51,255,255,20,0,0,
+54,2,0,
+17,26,0,
+51,255,255,28,0,3,
+54,3,0,
+17,38,0,
+51,255,255,42,0,3,
+28,4,0,
+39,
+16,0,64,0,0,48,0,2,
+51,2,0,
+51,3,0,
+51,255,255,53,0,
+54,5,0,
+17,26,0,
+51,255,255,28,0,3,
+54,6,0,
+17,38,0,
+51,255,255,42,0,3,
+54,7,0,
+17,59,0,
+51,255,255,53,0,3,
+28,8,0,
+39,
+16,0,64,0,0,65,0,3,
+51,5,0,
+51,6,0,
+51,7,0,
+51,255,255,71,0,
+54,9,0,
+17,26,0,
+51,255,255,28,0,3,
+28,10,0,
+17,76,0,1,
+51,9,0,
+51,255,255,82,0,
+54,11,0,
+17,26,0,
+51,255,255,28,0,3,
+28,12,0,
+17,87,0,1,
+51,11,0,
+51,255,255,82,0,
+28,13,0,
+39,
+16,0,64,0,0,94,0,0,
+51,255,255,71,0,6,0,
+11,0,
+3,0,
+0,0,
+12,0,
+9,0,
+7,0,
+20,
+31,
+55,1,0,
+51,255,255,20,0,0,
+57,
+21,};
+static constexpr size_t SKSL_INCLUDE_sksl_compute_LENGTH = sizeof(SKSL_INCLUDE_sksl_compute);
diff --git a/chromium/third_party/skia/src/sksl/generated/sksl_frag.dehydrated.sksl b/chromium/third_party/skia/src/sksl/generated/sksl_frag.dehydrated.sksl
index 1b6fde0318a..fc3a7d58071 100644
--- a/chromium/third_party/skia/src/sksl/generated/sksl_frag.dehydrated.sksl
+++ b/chromium/third_party/skia/src/sksl/generated/sksl_frag.dehydrated.sksl
@@ -1,4 +1,4 @@
-static uint8_t SKSL_INCLUDE_sksl_frag[] = {11,0,96,0,
+static constexpr uint8_t SKSL_INCLUDE_sksl_frag[] = {14,0,96,0,
12,115,107,95,70,114,97,103,67,111,111,114,100,
6,102,108,111,97,116,52,
12,115,107,95,67,108,111,99,107,119,105,115,101,
@@ -8,23 +8,23 @@ static uint8_t SKSL_INCLUDE_sksl_frag[] = {11,0,96,0,
16,115,107,95,76,97,115,116,70,114,97,103,67,111,108,111,114,
21,115,107,95,83,101,99,111,110,100,97,114,121,70,114,97,103,67,111,108,111,114,
52,1,5,0,
-55,1,0,
+54,1,0,
38,
37,0,2,0,0,255,255,255,255,255,255,255,15,0,255,16,2,0,
51,255,255,15,0,0,
-55,2,0,
+54,2,0,
38,
37,0,2,0,0,255,255,255,255,255,255,255,17,0,255,16,22,0,
51,255,255,35,0,0,
-55,3,0,
+54,3,0,
38,
37,144,2,0,0,0,255,255,255,255,0,255,17,39,255,32,40,0,
51,255,255,53,0,0,
-55,4,0,
+54,4,0,
38,
37,0,2,0,0,255,255,255,255,255,255,255,24,39,255,0,59,0,
51,255,255,53,0,0,
-55,5,0,
+54,5,0,
38,
37,0,2,0,0,255,255,255,255,255,255,255,28,39,255,32,76,0,
51,255,255,53,0,0,5,0,
@@ -35,24 +35,24 @@ static uint8_t SKSL_INCLUDE_sksl_frag[] = {11,0,96,0,
4,0,
20,
31,
-56,1,0,
+55,1,0,
51,255,255,15,0,0,
-58,
+57,
31,
-56,2,0,
+55,2,0,
51,255,255,35,0,0,
-58,
+57,
31,
-56,3,0,
+55,3,0,
51,255,255,53,0,0,
-58,
+57,
31,
-56,4,0,
+55,4,0,
51,255,255,53,0,0,
-58,
+57,
31,
-56,5,0,
+55,5,0,
51,255,255,53,0,0,
-58,
+57,
21,};
static constexpr size_t SKSL_INCLUDE_sksl_frag_LENGTH = sizeof(SKSL_INCLUDE_sksl_frag);
diff --git a/chromium/third_party/skia/src/sksl/generated/sksl_gpu.dehydrated.sksl b/chromium/third_party/skia/src/sksl/generated/sksl_gpu.dehydrated.sksl
index 57d830298bf..35a4a6aaa22 100644
--- a/chromium/third_party/skia/src/sksl/generated/sksl_gpu.dehydrated.sksl
+++ b/chromium/third_party/skia/src/sksl/generated/sksl_gpu.dehydrated.sksl
@@ -1,135 +1,34 @@
-static uint8_t SKSL_INCLUDE_sksl_gpu[] = {11,0,197,8,
-7,100,101,103,114,101,101,115,
-8,36,103,101,110,84,121,112,101,
-7,114,97,100,105,97,110,115,
-5,97,110,103,108,101,
-3,115,105,110,
-3,99,111,115,
-3,116,97,110,
+static constexpr uint8_t SKSL_INCLUDE_sksl_gpu[] = {14,0,100,5,
1,120,
-4,97,115,105,110,
-4,97,99,111,115,
-1,121,
-4,97,116,97,110,
-8,121,95,111,118,101,114,95,120,
-4,115,105,110,104,
-4,99,111,115,104,
-4,116,97,110,104,
-5,97,115,105,110,104,
-5,97,99,111,115,104,
-5,97,116,97,110,104,
-3,112,111,119,
-3,101,120,112,
-3,108,111,103,
-4,101,120,112,50,
-4,108,111,103,50,
-4,115,113,114,116,
-9,36,103,101,110,72,84,121,112,101,
-11,105,110,118,101,114,115,101,115,113,114,116,
-3,97,98,115,
9,36,103,101,110,73,84,121,112,101,
-4,115,105,103,110,
-5,102,108,111,111,114,
-5,116,114,117,110,99,
-5,114,111,117,110,100,
-9,114,111,117,110,100,69,118,101,110,
-4,99,101,105,108,
-5,102,114,97,99,116,
-5,102,108,111,97,116,
-3,109,111,100,
-4,104,97,108,102,
-1,105,
-4,109,111,100,102,
-3,109,105,110,
-3,105,110,116,
-3,109,97,120,
-6,109,105,110,86,97,108,
-6,109,97,120,86,97,108,
-5,99,108,97,109,112,
-9,36,103,101,110,85,84,121,112,101,
-4,117,105,110,116,
-8,115,97,116,117,114,97,116,101,
+1,121,
1,97,
-3,109,105,120,
9,36,103,101,110,66,84,121,112,101,
-4,101,100,103,101,
-4,115,116,101,112,
-5,101,100,103,101,48,
-5,101,100,103,101,49,
-10,115,109,111,111,116,104,115,116,101,112,
-5,105,115,110,97,110,
-5,105,115,105,110,102,
-5,118,97,108,117,101,
-14,102,108,111,97,116,66,105,116,115,84,111,73,110,116,
-15,102,108,111,97,116,66,105,116,115,84,111,85,105,110,116,
-14,105,110,116,66,105,116,115,84,111,70,108,111,97,116,
-15,117,105,110,116,66,105,116,115,84,111,70,108,111,97,116,
+3,109,105,120,
+8,36,103,101,110,84,121,112,101,
1,98,
1,99,
3,102,109,97,
+9,36,103,101,110,72,84,121,112,101,
+3,101,120,112,
5,102,114,101,120,112,
5,108,100,101,120,112,
1,118,
6,102,108,111,97,116,50,
-13,112,97,99,107,85,110,111,114,109,50,120,49,54,
13,112,97,99,107,83,110,111,114,109,50,120,49,54,
+4,117,105,110,116,
6,102,108,111,97,116,52,
12,112,97,99,107,85,110,111,114,109,52,120,56,
12,112,97,99,107,83,110,111,114,109,52,120,56,
1,112,
-15,117,110,112,97,99,107,85,110,111,114,109,50,120,49,54,
15,117,110,112,97,99,107,83,110,111,114,109,50,120,49,54,
14,117,110,112,97,99,107,85,110,111,114,109,52,120,56,
14,117,110,112,97,99,107,83,110,111,114,109,52,120,56,
12,112,97,99,107,72,97,108,102,50,120,49,54,
14,117,110,112,97,99,107,72,97,108,102,50,120,49,54,
-6,108,101,110,103,116,104,
-2,112,48,
-2,112,49,
-8,100,105,115,116,97,110,99,101,
-3,100,111,116,
-6,102,108,111,97,116,51,
-5,99,114,111,115,115,
-5,104,97,108,102,51,
-9,110,111,114,109,97,108,105,122,101,
-1,78,
-1,73,
-4,78,114,101,102,
-11,102,97,99,101,102,111,114,119,97,114,100,
-7,114,101,102,108,101,99,116,
-3,101,116,97,
-7,114,101,102,114,97,99,116,
-4,36,109,97,116,
-14,109,97,116,114,105,120,67,111,109,112,77,117,108,116,
-5,36,104,109,97,116,
-4,36,118,101,99,
-1,114,
-12,111,117,116,101,114,80,114,111,100,117,99,116,
-10,36,115,113,117,97,114,101,77,97,116,
-8,102,108,111,97,116,50,120,51,
-8,102,108,111,97,116,51,120,50,
-8,102,108,111,97,116,50,120,52,
-8,102,108,111,97,116,52,120,50,
-8,102,108,111,97,116,51,120,52,
-8,102,108,111,97,116,52,120,51,
-5,36,104,118,101,99,
-11,36,115,113,117,97,114,101,72,77,97,116,
-5,104,97,108,102,50,
-7,104,97,108,102,50,120,51,
-7,104,97,108,102,51,120,50,
-5,104,97,108,102,52,
-7,104,97,108,102,50,120,52,
-7,104,97,108,102,52,120,50,
-7,104,97,108,102,51,120,52,
-7,104,97,108,102,52,120,51,
-1,109,
-9,116,114,97,110,115,112,111,115,101,
-11,100,101,116,101,114,109,105,110,97,110,116,
-7,105,110,118,101,114,115,101,
+5,36,115,118,101,99,
8,108,101,115,115,84,104,97,110,
5,36,98,118,101,99,
-5,36,105,118,101,99,
-5,36,115,118,101,99,
6,36,117,115,118,101,99,
5,36,117,118,101,99,
13,108,101,115,115,84,104,97,110,69,113,117,97,108,
@@ -137,11 +36,9 @@ static uint8_t SKSL_INCLUDE_sksl_gpu[] = {11,0,197,8,
16,103,114,101,97,116,101,114,84,104,97,110,69,113,117,97,108,
5,101,113,117,97,108,
8,110,111,116,69,113,117,97,108,
-3,97,110,121,
-4,98,111,111,108,
-3,97,108,108,
-3,110,111,116,
+5,118,97,108,117,101,
8,98,105,116,67,111,117,110,116,
+9,36,103,101,110,85,84,121,112,101,
7,102,105,110,100,76,83,66,
7,102,105,110,100,77,83,66,
7,116,101,120,116,117,114,101,
@@ -150,27 +47,19 @@ static uint8_t SKSL_INCLUDE_sksl_gpu[] = {11,0,197,8,
7,115,97,109,112,108,101,114,
13,109,97,107,101,83,97,109,112,108,101,114,50,68,
9,115,97,109,112,108,101,114,50,68,
-13,115,97,109,112,108,101,114,50,68,82,101,99,116,
-11,116,101,120,116,117,114,101,83,105,122,101,
-4,105,110,116,50,
-9,115,97,109,112,108,101,114,49,68,
1,80,
6,115,97,109,112,108,101,
-4,98,105,97,115,
-10,105,115,97,109,112,108,101,114,50,68,
-4,105,110,116,52,
+5,104,97,108,102,52,
18,115,97,109,112,108,101,114,69,120,116,101,114,110,97,108,79,69,83,
+4,98,105,97,115,
+5,102,108,111,97,116,
+13,115,97,109,112,108,101,114,50,68,82,101,99,116,
+6,102,108,111,97,116,51,
7,115,117,98,112,97,115,115,
12,115,117,98,112,97,115,115,73,110,112,117,116,
11,115,117,98,112,97,115,115,76,111,97,100,
14,115,117,98,112,97,115,115,73,110,112,117,116,77,83,
-4,100,70,100,120,
-4,100,70,100,121,
-6,102,119,105,100,116,104,
-11,105,110,116,101,114,112,111,108,97,110,116,
-19,105,110,116,101,114,112,111,108,97,116,101,65,116,83,97,109,112,108,101,
-6,111,102,102,115,101,116,
-19,105,110,116,101,114,112,111,108,97,116,101,65,116,79,102,102,115,101,116,
+3,105,110,116,
3,115,114,99,
3,100,115,116,
11,98,108,101,110,100,95,99,108,101,97,114,
@@ -190,8 +79,10 @@ static uint8_t SKSL_INCLUDE_sksl_gpu[] = {11,0,197,8,
17,98,108,101,110,100,95,112,111,114,116,101,114,95,100,117,102,102,
14,98,108,101,110,100,95,109,111,100,117,108,97,116,101,
12,98,108,101,110,100,95,115,99,114,101,101,110,
+5,104,97,108,102,50,
1,100,
24,36,98,108,101,110,100,95,111,118,101,114,108,97,121,95,99,111,109,112,111,110,101,110,116,
+4,104,97,108,102,
13,98,108,101,110,100,95,111,118,101,114,108,97,121,
4,102,108,105,112,
13,98,108,101,110,100,95,108,105,103,104,116,101,110,
@@ -199,6 +90,7 @@ static uint8_t SKSL_INCLUDE_sksl_gpu[] = {11,0,197,8,
12,98,108,101,110,100,95,100,97,114,107,101,110,
1,110,
15,36,103,117,97,114,100,101,100,95,100,105,118,105,100,101,
+5,104,97,108,102,51,
22,36,99,111,108,111,114,95,100,111,100,103,101,95,99,111,109,112,111,110,101,110,116,
17,98,108,101,110,100,95,99,111,108,111,114,95,100,111,100,103,101,
21,36,99,111,108,111,114,95,98,117,114,110,95,99,111,109,112,111,110,101,110,116,
@@ -224,17 +116,20 @@ static uint8_t SKSL_INCLUDE_sksl_gpu[] = {11,0,197,8,
16,98,108,101,110,100,95,115,97,116,117,114,97,116,105,111,110,
11,98,108,101,110,100,95,99,111,108,111,114,
16,98,108,101,110,100,95,108,117,109,105,110,111,115,105,116,121,
-8,117,110,112,114,101,109,117,108,
4,112,114,111,106,
15,99,114,111,115,115,95,108,101,110,103,116,104,95,50,100,
+3,109,105,110,
5,99,111,101,102,102,
6,114,101,115,117,108,116,
-43,109,117,115,116,71,117,97,114,100,68,105,118,105,115,105,111,110,69,118,101,110,65,102,116,101,114,69,120,112,108,105,99,105,116,90,101,114,111,67,104,101,99,107,
+4,98,111,111,108,
+3,109,97,120,
5,100,101,108,116,97,
4,68,83,113,100,
4,68,67,117,98,
5,68,97,83,113,100,
5,68,97,67,117,98,
+4,115,113,114,116,
+3,100,111,116,
3,108,117,109,
7,109,105,110,67,111,109,112,
7,109,97,120,67,111,109,112,
@@ -243,3525 +138,1169 @@ static uint8_t SKSL_INCLUDE_sksl_gpu[] = {11,0,197,8,
3,115,100,97,
3,100,115,97,
1,108,
-25,98,117,105,108,116,105,110,68,101,116,101,114,109,105,110,97,110,116,83,117,112,112,111,114,116,
-8,102,108,111,97,116,50,120,50,
-7,104,97,108,102,50,120,50,
-52,1,225,3,
-55,1,0,
+1,114,
+52,1,25,1,
+54,1,0,
17,2,0,
-51,255,255,10,0,3,
-28,2,0,
-17,19,0,1,1,0,
-51,255,255,10,0,
-55,3,0,
-17,19,0,
-51,255,255,10,0,3,
+51,255,255,4,0,3,
+54,2,0,
+17,14,0,
+51,255,255,4,0,3,
+54,3,0,
+17,16,0,
+51,255,255,18,0,3,
28,4,0,
-17,2,0,1,3,0,
-51,255,255,10,0,
-55,5,0,
-17,27,0,
-51,255,255,10,0,3,
-28,6,0,
-17,33,0,1,5,0,
-51,255,255,10,0,
-55,7,0,
-17,27,0,
-51,255,255,10,0,3,
+17,28,0,3,
+51,1,0,
+51,2,0,
+51,3,0,
+51,255,255,4,0,
+54,5,0,
+17,2,0,
+51,255,255,18,0,3,
+54,6,0,
+17,14,0,
+51,255,255,18,0,3,
+54,7,0,
+17,16,0,
+51,255,255,18,0,3,
28,8,0,
-17,37,0,1,7,0,
-51,255,255,10,0,
-55,9,0,
-17,27,0,
-51,255,255,10,0,3,
-28,10,0,
-17,41,0,1,9,0,
-51,255,255,10,0,
-55,11,0,
-17,45,0,
-51,255,255,10,0,3,
+17,28,0,3,
+51,5,0,
+51,6,0,
+51,7,0,
+51,255,255,18,0,
+54,9,0,
+17,16,0,
+51,255,255,32,0,3,
+54,10,0,
+17,41,0,
+51,255,255,32,0,3,
+54,11,0,
+17,43,0,
+51,255,255,32,0,3,
28,12,0,
-17,47,0,1,11,0,
-51,255,255,10,0,
-55,13,0,
-17,45,0,
-51,255,255,10,0,3,
-28,14,0,
-17,52,0,1,13,0,
-51,255,255,10,0,
-55,15,0,
-17,57,0,
-51,255,255,10,0,3,
-55,16,0,
-17,45,0,
-51,255,255,10,0,3,
-28,17,0,
-17,59,0,2,15,0,16,0,
-51,255,255,10,0,
-55,18,0,
-17,64,0,
-51,255,255,10,0,3,
-54,19,0,2,
+17,45,0,3,
+51,9,0,
+51,10,0,
+51,11,0,
+51,255,255,32,0,
+54,13,0,
+17,16,0,
+51,255,255,49,0,3,
+54,14,0,
+17,41,0,
+51,255,255,49,0,3,
+54,15,0,
+17,43,0,
+51,255,255,49,0,3,
+28,16,0,
+17,45,0,3,
+51,13,0,
+51,14,0,
+51,15,0,
+51,255,255,49,0,
+54,17,0,
+17,2,0,
+51,255,255,32,0,3,
+54,18,0,
+38,
+16,32,59,0,
+51,255,255,4,0,3,
+28,19,0,
+39,
+16,0,64,0,0,63,0,2,
51,17,0,
-28,20,0,
-17,59,0,1,18,0,
-51,255,255,10,0,
-51,20,0,
-55,21,0,
-17,45,0,
-51,255,255,10,0,3,
+51,18,0,
+51,255,255,32,0,
+54,20,0,
+17,2,0,
+51,255,255,49,0,3,
+54,21,0,
+38,
+16,32,59,0,
+51,255,255,4,0,3,
28,22,0,
-17,73,0,1,21,0,
-51,255,255,10,0,
-55,23,0,
-17,45,0,
-51,255,255,10,0,3,
-28,24,0,
-17,78,0,1,23,0,
-51,255,255,10,0,
-55,25,0,
-17,45,0,
-51,255,255,10,0,3,
-28,26,0,
-17,83,0,1,25,0,
-51,255,255,10,0,
-55,27,0,
-17,45,0,
-51,255,255,10,0,3,
+39,
+16,0,64,0,0,63,0,2,
+51,20,0,
+51,21,0,
+51,255,255,49,0,
+54,23,0,
+17,2,0,
+51,255,255,32,0,3,
+54,24,0,
+17,59,0,
+51,255,255,4,0,3,
+28,25,0,
+17,69,0,2,
+51,23,0,
+51,24,0,
+51,255,255,32,0,
+54,26,0,
+17,2,0,
+51,255,255,49,0,3,
+54,27,0,
+17,59,0,
+51,255,255,4,0,3,
28,28,0,
-17,88,0,1,27,0,
-51,255,255,10,0,
-55,29,0,
-17,45,0,
-51,255,255,10,0,3,
+17,69,0,2,
+51,26,0,
+51,27,0,
+51,255,255,49,0,
+54,29,0,
+17,75,0,
+51,255,255,77,0,3,
28,30,0,
-17,94,0,1,29,0,
-51,255,255,10,0,
-55,31,0,
-17,45,0,
-51,255,255,10,0,3,
+17,84,0,1,
+51,29,0,
+51,255,255,98,0,
+54,31,0,
+17,75,0,
+51,255,255,103,0,3,
28,32,0,
-17,100,0,1,31,0,
-51,255,255,10,0,
-55,33,0,
-17,45,0,
-51,255,255,10,0,3,
-55,34,0,
-17,57,0,
-51,255,255,10,0,3,
-28,35,0,
-17,106,0,2,33,0,34,0,
-51,255,255,10,0,
-55,36,0,
-17,45,0,
-51,255,255,10,0,3,
-28,37,0,
-17,110,0,1,36,0,
-51,255,255,10,0,
-55,38,0,
-17,45,0,
-51,255,255,10,0,3,
-28,39,0,
-17,114,0,1,38,0,
-51,255,255,10,0,
-55,40,0,
-17,45,0,
-51,255,255,10,0,3,
-28,41,0,
-17,118,0,1,40,0,
-51,255,255,10,0,
-55,42,0,
-17,45,0,
-51,255,255,10,0,3,
-28,43,0,
-17,123,0,1,42,0,
-51,255,255,10,0,
-55,44,0,
-17,45,0,
-51,255,255,10,0,3,
-28,45,0,
-17,128,0,1,44,0,
-51,255,255,10,0,
-55,46,0,
+17,110,0,1,
+51,31,0,
+51,255,255,98,0,
+54,33,0,
+17,75,0,
+51,255,255,103,0,3,
+28,34,0,
+17,123,0,1,
+51,33,0,
+51,255,255,98,0,
+54,35,0,
+17,136,0,
+51,255,255,98,0,3,
+28,36,0,
+17,138,0,1,
+51,35,0,
+51,255,255,77,0,
+54,37,0,
+17,136,0,
+51,255,255,98,0,3,
+28,38,0,
+17,154,0,1,
+51,37,0,
+51,255,255,103,0,
+54,39,0,
+17,136,0,
+51,255,255,98,0,3,
+28,40,0,
+17,169,0,1,
+51,39,0,
+51,255,255,103,0,
+54,41,0,
+17,75,0,
+51,255,255,77,0,3,
+28,42,0,
+17,184,0,1,
+51,41,0,
+51,255,255,98,0,
+54,43,0,
+17,75,0,
+51,255,255,98,0,3,
+28,44,0,
+17,197,0,1,
+51,43,0,
+51,255,255,77,0,
+54,45,0,
17,2,0,
-51,255,255,133,0,3,
-54,47,0,2,
-51,2,0,
-28,48,0,
-17,19,0,1,46,0,
-51,255,255,133,0,
+51,255,255,212,0,3,
+54,46,0,
+17,14,0,
+51,255,255,212,0,3,
+28,47,0,
+17,218,0,2,
+51,45,0,
+51,46,0,
+51,255,255,227,0,
+54,48,0,
+17,2,0,
+51,255,255,233,0,3,
+54,49,0,
+17,14,0,
+51,255,255,233,0,3,
+28,50,0,
+17,218,0,2,
51,48,0,
-55,49,0,
-17,19,0,
-51,255,255,133,0,3,
-54,50,0,2,
-51,4,0,
-28,51,0,
-17,2,0,1,49,0,
-51,255,255,133,0,
+51,49,0,
+51,255,255,227,0,
+54,51,0,
+17,2,0,
+51,255,255,240,0,3,
+54,52,0,
+17,14,0,
+51,255,255,240,0,3,
+28,53,0,
+17,218,0,2,
51,51,0,
-55,52,0,
-17,27,0,
-51,255,255,133,0,3,
-54,53,0,2,
-51,6,0,
-28,54,0,
-17,33,0,1,52,0,
-51,255,255,133,0,
+51,52,0,
+51,255,255,227,0,
+54,54,0,
+17,2,0,
+51,255,255,240,0,3,
+54,55,0,
+17,14,0,
+51,255,255,240,0,3,
+28,56,0,
+17,246,0,2,
51,54,0,
-55,55,0,
-17,27,0,
-51,255,255,133,0,3,
-54,56,0,2,
-51,8,0,
-28,57,0,
-17,37,0,1,55,0,
-51,255,255,133,0,
+51,55,0,
+51,255,255,227,0,
+54,57,0,
+17,2,0,
+51,255,255,212,0,3,
+54,58,0,
+17,14,0,
+51,255,255,212,0,3,
+28,59,0,
+17,246,0,2,
51,57,0,
-55,58,0,
-17,27,0,
-51,255,255,133,0,3,
-54,59,0,2,
-51,10,0,
-28,60,0,
-17,41,0,1,58,0,
-51,255,255,133,0,
+51,58,0,
+51,255,255,227,0,
+54,60,0,
+17,2,0,
+51,255,255,233,0,3,
+54,61,0,
+17,14,0,
+51,255,255,233,0,3,
+28,62,0,
+17,246,0,2,
51,60,0,
-55,61,0,
-17,45,0,
-51,255,255,133,0,3,
-54,62,0,2,
-51,12,0,
-28,63,0,
-17,47,0,1,61,0,
-51,255,255,133,0,
+51,61,0,
+51,255,255,227,0,
+54,63,0,
+17,2,0,
+51,255,255,240,0,3,
+54,64,0,
+17,14,0,
+51,255,255,240,0,3,
+28,65,0,
+17,4,1,2,
51,63,0,
-55,64,0,
-17,45,0,
-51,255,255,133,0,3,
-54,65,0,2,
-51,14,0,
-28,66,0,
-17,52,0,1,64,0,
-51,255,255,133,0,
+51,64,0,
+51,255,255,227,0,
+54,66,0,
+17,2,0,
+51,255,255,212,0,3,
+54,67,0,
+17,14,0,
+51,255,255,212,0,3,
+28,68,0,
+17,4,1,2,
51,66,0,
-55,67,0,
-17,57,0,
-51,255,255,133,0,3,
-55,68,0,
-17,45,0,
-51,255,255,133,0,3,
-54,69,0,3,
-51,17,0,
-51,20,0,
-28,70,0,
-17,59,0,2,67,0,68,0,
-51,255,255,133,0,
-51,70,0,
-55,71,0,
-17,64,0,
-51,255,255,133,0,3,
-54,72,0,4,
-51,17,0,
-51,20,0,
+51,67,0,
+51,255,255,227,0,
+54,69,0,
+17,2,0,
+51,255,255,233,0,3,
+54,70,0,
+17,14,0,
+51,255,255,233,0,3,
+28,71,0,
+17,4,1,2,
+51,69,0,
51,70,0,
-28,73,0,
-17,59,0,1,71,0,
-51,255,255,133,0,
+51,255,255,227,0,
+54,72,0,
+17,2,0,
+51,255,255,240,0,3,
+54,73,0,
+17,14,0,
+51,255,255,240,0,3,
+28,74,0,
+17,16,1,2,
+51,72,0,
51,73,0,
-55,74,0,
-17,45,0,
-51,255,255,133,0,3,
-54,75,0,2,
-51,22,0,
-28,76,0,
-17,73,0,1,74,0,
-51,255,255,133,0,
+51,255,255,227,0,
+54,75,0,
+17,2,0,
+51,255,255,212,0,3,
+54,76,0,
+17,14,0,
+51,255,255,212,0,3,
+28,77,0,
+17,16,1,2,
+51,75,0,
51,76,0,
-55,77,0,
-17,45,0,
-51,255,255,133,0,3,
-54,78,0,2,
-51,24,0,
-28,79,0,
-17,78,0,1,77,0,
-51,255,255,133,0,
+51,255,255,227,0,
+54,78,0,
+17,2,0,
+51,255,255,233,0,3,
+54,79,0,
+17,14,0,
+51,255,255,233,0,3,
+28,80,0,
+17,16,1,2,
+51,78,0,
51,79,0,
-55,80,0,
-17,45,0,
-51,255,255,133,0,3,
-54,81,0,2,
-51,26,0,
-28,82,0,
-17,83,0,1,80,0,
-51,255,255,133,0,
+51,255,255,227,0,
+54,81,0,
+17,2,0,
+51,255,255,240,0,3,
+54,82,0,
+17,14,0,
+51,255,255,240,0,3,
+28,83,0,
+17,33,1,2,
+51,81,0,
51,82,0,
-55,83,0,
-17,45,0,
-51,255,255,133,0,3,
-54,84,0,2,
-51,28,0,
-28,85,0,
-17,88,0,1,83,0,
-51,255,255,133,0,
+51,255,255,227,0,
+54,84,0,
+17,2,0,
+51,255,255,212,0,3,
+54,85,0,
+17,14,0,
+51,255,255,212,0,3,
+28,86,0,
+17,33,1,2,
+51,84,0,
51,85,0,
-55,86,0,
-17,45,0,
-51,255,255,133,0,3,
-54,87,0,2,
-51,30,0,
-28,88,0,
-17,94,0,1,86,0,
-51,255,255,133,0,
+51,255,255,227,0,
+54,87,0,
+17,2,0,
+51,255,255,233,0,3,
+54,88,0,
+17,14,0,
+51,255,255,233,0,3,
+28,89,0,
+17,33,1,2,
+51,87,0,
51,88,0,
-55,89,0,
-17,45,0,
-51,255,255,133,0,3,
-54,90,0,2,
-51,32,0,
-28,91,0,
-17,100,0,1,89,0,
-51,255,255,133,0,
+51,255,255,227,0,
+54,90,0,
+17,2,0,
+51,255,255,240,0,3,
+54,91,0,
+17,14,0,
+51,255,255,240,0,3,
+28,92,0,
+17,39,1,2,
+51,90,0,
51,91,0,
-55,92,0,
-17,45,0,
-51,255,255,133,0,3,
-55,93,0,
-17,57,0,
-51,255,255,133,0,3,
-54,94,0,2,
-51,35,0,
+51,255,255,227,0,
+54,93,0,
+17,2,0,
+51,255,255,212,0,3,
+54,94,0,
+17,14,0,
+51,255,255,212,0,3,
28,95,0,
-17,106,0,2,92,0,93,0,
-51,255,255,133,0,
-51,95,0,
-55,96,0,
-17,45,0,
-51,255,255,133,0,3,
-54,97,0,2,
-51,37,0,
+17,39,1,2,
+51,93,0,
+51,94,0,
+51,255,255,227,0,
+54,96,0,
+17,2,0,
+51,255,255,233,0,3,
+54,97,0,
+17,14,0,
+51,255,255,233,0,3,
28,98,0,
-17,110,0,1,96,0,
-51,255,255,133,0,
-51,98,0,
-55,99,0,
-17,45,0,
-51,255,255,133,0,3,
-54,100,0,2,
-51,39,0,
-28,101,0,
-17,114,0,1,99,0,
-51,255,255,133,0,
+17,39,1,2,
+51,96,0,
+51,97,0,
+51,255,255,227,0,
+54,99,0,
+17,48,1,
+51,255,255,4,0,3,
+28,100,0,
+17,54,1,1,
+51,99,0,
+51,255,255,4,0,
+54,101,0,
+17,48,1,
+51,255,255,63,1,3,
+28,102,0,
+17,54,1,1,
51,101,0,
-55,102,0,
-17,45,0,
-51,255,255,133,0,3,
-54,103,0,2,
-51,41,0,
+51,255,255,4,0,
+54,103,0,
+17,48,1,
+51,255,255,4,0,3,
28,104,0,
-17,118,0,1,102,0,
-51,255,255,133,0,
-51,104,0,
-55,105,0,
-17,45,0,
-51,255,255,133,0,3,
-54,106,0,2,
-51,43,0,
-28,107,0,
-17,123,0,1,105,0,
-51,255,255,133,0,
+17,73,1,1,
+51,103,0,
+51,255,255,4,0,
+54,105,0,
+17,48,1,
+51,255,255,63,1,3,
+28,106,0,
+17,73,1,1,
+51,105,0,
+51,255,255,4,0,
+54,107,0,
+17,48,1,
+51,255,255,4,0,3,
+28,108,0,
+17,81,1,1,
51,107,0,
-55,108,0,
-17,45,0,
-51,255,255,133,0,3,
-54,109,0,2,
-51,45,0,
+51,255,255,4,0,
+54,109,0,
+17,48,1,
+51,255,255,63,1,3,
28,110,0,
-17,128,0,1,108,0,
-51,255,255,133,0,
-51,110,0,
-55,111,0,
-17,45,0,
-51,255,255,10,0,3,
-28,112,0,
-17,143,0,1,111,0,
-51,255,255,10,0,
-55,113,0,
-17,45,0,
-51,255,255,133,0,3,
-54,114,0,2,
+17,81,1,1,
+51,109,0,
+51,255,255,4,0,
+54,111,0,
+17,89,1,
+51,255,255,97,1,3,
+54,112,0,
+17,107,1,
+51,255,255,109,1,3,
+28,113,0,
+17,117,1,2,
+51,111,0,
51,112,0,
-28,115,0,
-17,143,0,1,113,0,
-51,255,255,133,0,
+51,255,255,131,1,
+54,114,0,
+17,107,1,
+51,255,255,131,1,3,
+54,115,0,
+17,141,1,
+51,255,255,77,0,3,
+28,116,0,
+17,143,1,2,
+51,114,0,
51,115,0,
-55,116,0,
-17,45,0,
-51,255,255,10,0,3,
-28,117,0,
-17,155,0,1,116,0,
-51,255,255,10,0,
-55,118,0,
-17,45,0,
-51,255,255,133,0,3,
-54,119,0,2,
-51,117,0,
+51,255,255,150,1,
+54,117,0,
+17,107,1,
+51,255,255,156,1,3,
+54,118,0,
+17,141,1,
+51,255,255,77,0,3,
+54,119,0,
+17,175,1,
+51,255,255,180,1,3,
28,120,0,
-17,155,0,1,118,0,
-51,255,255,133,0,
-51,120,0,
-55,121,0,
-17,45,0,
-51,255,255,159,0,3,
-54,122,0,3,
+17,143,1,3,
51,117,0,
-51,120,0,
+51,118,0,
+51,119,0,
+51,255,255,150,1,
+54,121,0,
+17,107,1,
+51,255,255,156,1,3,
+54,122,0,
+17,141,1,
+51,255,255,77,0,3,
28,123,0,
-17,155,0,1,121,0,
-51,255,255,159,0,
-51,123,0,
-55,124,0,
-17,45,0,
-51,255,255,10,0,3,
-28,125,0,
-17,169,0,1,124,0,
-51,255,255,10,0,
-55,126,0,
-17,45,0,
-51,255,255,133,0,3,
-54,127,0,2,
-51,125,0,
-28,128,0,
-17,169,0,1,126,0,
-51,255,255,133,0,
-51,128,0,
-55,129,0,
-17,45,0,
-51,255,255,159,0,3,
-54,130,0,3,
+17,143,1,2,
+51,121,0,
+51,122,0,
+51,255,255,150,1,
+54,124,0,
+17,107,1,
+51,255,255,186,1,3,
+54,125,0,
+17,141,1,
+51,255,255,77,0,3,
+28,126,0,
+17,143,1,2,
+51,124,0,
51,125,0,
+51,255,255,150,1,
+54,127,0,
+17,107,1,
+51,255,255,186,1,3,
+54,128,0,
+17,141,1,
+51,255,255,200,1,3,
+28,129,0,
+17,143,1,2,
+51,127,0,
51,128,0,
+51,255,255,150,1,
+54,130,0,
+17,207,1,
+51,255,255,215,1,3,
28,131,0,
-17,169,0,1,129,0,
-51,255,255,159,0,
-51,131,0,
-55,132,0,
-17,45,0,
-51,255,255,10,0,3,
-28,133,0,
-17,174,0,1,132,0,
-51,255,255,10,0,
-55,134,0,
-17,45,0,
-51,255,255,133,0,3,
-54,135,0,2,
+17,228,1,1,
+51,130,0,
+51,255,255,150,1,
+54,132,0,
+17,207,1,
+51,255,255,240,1,3,
+54,133,0,
+17,143,1,
+51,255,255,255,1,3,
+28,134,0,
+17,228,1,2,
+51,132,0,
51,133,0,
-28,136,0,
-17,174,0,1,134,0,
-51,255,255,133,0,
+51,255,255,150,1,
+54,135,0,
+17,107,1,
+51,255,255,131,1,3,
+54,136,0,
+17,141,1,
+51,255,255,200,1,3,
+28,137,0,
+17,143,1,2,
+51,135,0,
51,136,0,
-55,137,0,
-17,45,0,
-51,255,255,10,0,3,
-28,138,0,
-17,180,0,1,137,0,
-51,255,255,10,0,
-55,139,0,
-17,45,0,
-51,255,255,133,0,3,
-54,140,0,2,
-51,138,0,
+51,255,255,150,1,
+54,138,0,
+17,107,1,
+51,255,255,131,1,3,
+54,139,0,
+17,141,1,
+51,255,255,200,1,3,
+54,140,0,
+17,175,1,
+51,255,255,180,1,3,
28,141,0,
-17,180,0,1,139,0,
-51,255,255,133,0,
-51,141,0,
-55,142,0,
-17,45,0,
-51,255,255,10,0,3,
-28,143,0,
-17,186,0,1,142,0,
-51,255,255,10,0,
-55,144,0,
-17,45,0,
-51,255,255,133,0,3,
-54,145,0,2,
+17,143,1,3,
+51,138,0,
+51,139,0,
+51,140,0,
+51,255,255,150,1,
+54,142,0,
+17,3,2,
+51,255,255,150,1,3,
+54,143,0,
+17,7,2,
+51,255,255,150,1,3,
+28,144,0,
+17,11,2,2,
+51,142,0,
51,143,0,
-28,146,0,
-17,186,0,1,144,0,
-51,255,255,133,0,
+51,255,255,150,1,
+54,145,0,
+17,3,2,
+51,255,255,150,1,3,
+54,146,0,
+17,7,2,
+51,255,255,150,1,3,
+28,147,0,
+17,23,2,2,
+51,145,0,
51,146,0,
-55,147,0,
-17,45,0,
-51,255,255,10,0,3,
-28,148,0,
-17,192,0,1,147,0,
-51,255,255,10,0,
-55,149,0,
-17,45,0,
-51,255,255,133,0,3,
-54,150,0,2,
+51,255,255,150,1,
+54,148,0,
+17,3,2,
+51,255,255,150,1,3,
+54,149,0,
+17,7,2,
+51,255,255,150,1,3,
+28,150,0,
+17,33,2,2,
51,148,0,
-28,151,0,
-17,192,0,1,149,0,
-51,255,255,133,0,
-51,151,0,
-55,152,0,
-17,45,0,
-51,255,255,10,0,3,
+51,149,0,
+51,255,255,150,1,
+54,151,0,
+17,3,2,
+51,255,255,150,1,3,
+54,152,0,
+17,7,2,
+51,255,255,150,1,3,
28,153,0,
-17,202,0,1,152,0,
-51,255,255,10,0,
-55,154,0,
-17,45,0,
-51,255,255,133,0,3,
-54,155,0,2,
-51,153,0,
+17,43,2,2,
+51,151,0,
+51,152,0,
+51,255,255,150,1,
+54,154,0,
+17,3,2,
+51,255,255,150,1,3,
+54,155,0,
+17,7,2,
+51,255,255,150,1,3,
28,156,0,
-17,202,0,1,154,0,
-51,255,255,133,0,
-51,156,0,
-55,157,0,
-17,45,0,
-51,255,255,10,0,3,
-28,158,0,
-17,207,0,1,157,0,
-51,255,255,10,0,
-55,159,0,
-17,45,0,
-51,255,255,133,0,3,
-54,160,0,2,
+17,58,2,2,
+51,154,0,
+51,155,0,
+51,255,255,150,1,
+54,157,0,
+17,3,2,
+51,255,255,150,1,3,
+54,158,0,
+17,7,2,
+51,255,255,150,1,3,
+28,159,0,
+17,73,2,2,
+51,157,0,
51,158,0,
-28,161,0,
-17,207,0,1,159,0,
-51,255,255,133,0,
+51,255,255,150,1,
+54,160,0,
+17,3,2,
+51,255,255,150,1,3,
+54,161,0,
+17,7,2,
+51,255,255,150,1,3,
+28,162,0,
+17,86,2,2,
+51,160,0,
51,161,0,
-55,162,0,
-17,45,0,
-51,255,255,10,0,3,
-55,163,0,
-17,57,0,
-51,255,255,213,0,3,
-28,164,0,
-17,219,0,2,162,0,163,0,
-51,255,255,10,0,
-55,165,0,
-17,45,0,
-51,255,255,10,0,3,
-55,166,0,
-17,57,0,
-51,255,255,10,0,3,
-54,167,0,2,
+51,255,255,150,1,
+54,163,0,
+17,3,2,
+51,255,255,150,1,3,
+54,164,0,
+17,7,2,
+51,255,255,150,1,3,
+28,165,0,
+17,99,2,2,
+51,163,0,
51,164,0,
+51,255,255,150,1,
+54,166,0,
+17,3,2,
+51,255,255,150,1,3,
+54,167,0,
+17,7,2,
+51,255,255,150,1,3,
28,168,0,
-17,219,0,2,165,0,166,0,
-51,255,255,10,0,
-51,168,0,
-55,169,0,
-17,45,0,
-51,255,255,133,0,3,
-55,170,0,
-17,57,0,
-51,255,255,223,0,3,
-54,171,0,3,
-51,164,0,
-51,168,0,
-28,172,0,
-17,219,0,2,169,0,170,0,
-51,255,255,133,0,
+17,113,2,2,
+51,166,0,
+51,167,0,
+51,255,255,150,1,
+54,169,0,
+17,3,2,
+51,255,255,150,1,3,
+54,170,0,
+17,7,2,
+51,255,255,150,1,3,
+28,171,0,
+17,127,2,2,
+51,169,0,
+51,170,0,
+51,255,255,150,1,
+54,172,0,
+17,3,2,
+51,255,255,150,1,3,
+54,173,0,
+17,7,2,
+51,255,255,150,1,3,
+28,174,0,
+17,142,2,2,
51,172,0,
-55,173,0,
-17,45,0,
-51,255,255,133,0,3,
-55,174,0,
-17,57,0,
-51,255,255,133,0,3,
-54,175,0,4,
-51,164,0,
-51,168,0,
-51,172,0,
-28,176,0,
-17,219,0,2,173,0,174,0,
-51,255,255,133,0,
+51,173,0,
+51,255,255,150,1,
+54,175,0,
+17,3,2,
+51,255,255,150,1,3,
+54,176,0,
+17,7,2,
+51,255,255,150,1,3,
+28,177,0,
+17,157,2,2,
+51,175,0,
51,176,0,
-55,177,0,
-17,45,0,
-51,255,255,10,0,3,
-55,178,0,
-38,
-16,32,228,0,
-51,255,255,10,0,3,
-28,179,0,
-17,230,0,2,177,0,178,0,
-51,255,255,10,0,
-55,180,0,
-17,45,0,
-51,255,255,133,0,3,
-55,181,0,
-38,
-16,32,228,0,
-51,255,255,133,0,3,
-54,182,0,2,
+51,255,255,150,1,
+54,178,0,
+17,3,2,
+51,255,255,150,1,3,
+54,179,0,
+17,7,2,
+51,255,255,150,1,3,
+28,180,0,
+17,167,2,2,
+51,178,0,
51,179,0,
-28,183,0,
-17,230,0,2,180,0,181,0,
-51,255,255,133,0,
+51,255,255,150,1,
+54,181,0,
+17,3,2,
+51,255,255,150,1,3,
+54,182,0,
+17,7,2,
+51,255,255,150,1,3,
+54,183,0,
+17,178,2,
+51,255,255,150,1,3,
+28,184,0,
+17,186,2,3,
+51,181,0,
+51,182,0,
51,183,0,
-55,184,0,
-17,45,0,
-51,255,255,10,0,3,
-55,185,0,
-17,57,0,
-51,255,255,10,0,3,
-28,186,0,
-17,235,0,2,184,0,185,0,
-51,255,255,10,0,
-55,187,0,
-17,45,0,
-51,255,255,10,0,3,
-55,188,0,
-17,57,0,
-51,255,255,213,0,3,
-54,189,0,2,
+51,255,255,150,1,
+54,185,0,
+17,3,2,
+51,255,255,150,1,3,
+54,186,0,
+17,7,2,
+51,255,255,150,1,3,
+28,187,0,
+17,204,2,2,
+51,185,0,
51,186,0,
+51,255,255,150,1,
+54,188,0,
+17,3,2,
+51,255,255,150,1,3,
+54,189,0,
+17,7,2,
+51,255,255,150,1,3,
28,190,0,
-17,235,0,2,187,0,188,0,
-51,255,255,10,0,
-51,190,0,
-55,191,0,
-17,45,0,
-51,255,255,133,0,3,
-55,192,0,
-17,57,0,
-51,255,255,133,0,3,
-54,193,0,3,
-51,186,0,
-51,190,0,
-28,194,0,
-17,235,0,2,191,0,192,0,
-51,255,255,133,0,
-51,194,0,
-55,195,0,
-17,45,0,
-51,255,255,133,0,3,
-55,196,0,
-17,57,0,
-51,255,255,223,0,3,
-54,197,0,4,
-51,186,0,
-51,190,0,
-51,194,0,
-28,198,0,
-17,235,0,2,195,0,196,0,
-51,255,255,133,0,
-51,198,0,
-55,199,0,
-17,45,0,
-51,255,255,159,0,3,
-55,200,0,
-17,57,0,
-51,255,255,159,0,3,
-54,201,0,5,
-51,186,0,
-51,190,0,
-51,194,0,
-51,198,0,
-28,202,0,
-17,235,0,2,199,0,200,0,
-51,255,255,159,0,
-51,202,0,
-55,203,0,
-17,45,0,
-51,255,255,159,0,3,
-55,204,0,
-17,57,0,
-51,255,255,239,0,3,
-54,205,0,6,
-51,186,0,
-51,190,0,
+17,219,2,2,
+51,188,0,
+51,189,0,
+51,255,255,150,1,
+54,191,0,
+17,107,1,
+51,255,255,232,2,3,
+54,192,0,
+17,238,2,
+51,255,255,232,2,3,
+28,193,0,
+17,240,2,2,
+51,191,0,
+51,192,0,
+51,255,255,9,3,
+54,194,0,
+17,3,2,
+51,255,255,150,1,3,
+54,195,0,
+17,7,2,
+51,255,255,150,1,3,
+28,196,0,
+17,14,3,2,
51,194,0,
+51,195,0,
+51,255,255,150,1,
+54,197,0,
+17,16,0,
+51,255,255,150,1,3,
+54,198,0,
+17,41,0,
+51,255,255,150,1,3,
+54,199,0,
+17,28,3,
+51,255,255,9,3,3,
+28,200,0,
+17,14,3,3,
+51,197,0,
51,198,0,
+51,199,0,
+51,255,255,150,1,
+54,201,0,
+17,3,2,
+51,255,255,150,1,3,
+54,202,0,
+17,7,2,
+51,255,255,150,1,3,
+28,203,0,
+17,33,3,2,
+51,201,0,
51,202,0,
-28,206,0,
-17,235,0,2,203,0,204,0,
-51,255,255,159,0,
+51,255,255,150,1,
+54,204,0,
+17,3,2,
+51,255,255,150,1,3,
+54,205,0,
+17,7,2,
+51,255,255,150,1,3,
+54,206,0,
+17,47,3,
+51,255,255,9,3,3,
+28,207,0,
+17,52,3,3,
+51,204,0,
+51,205,0,
51,206,0,
-55,207,0,
-17,45,0,
-51,255,255,10,0,3,
-55,208,0,
-17,57,0,
-51,255,255,10,0,3,
-28,209,0,
-17,243,0,2,207,0,208,0,
-51,255,255,10,0,
-55,210,0,
-17,45,0,
-51,255,255,10,0,3,
-55,211,0,
-17,57,0,
-51,255,255,213,0,3,
-54,212,0,2,
+51,255,255,150,1,
+54,208,0,
+17,3,2,
+51,255,255,150,1,3,
+54,209,0,
+17,7,2,
+51,255,255,150,1,3,
+28,210,0,
+17,52,3,2,
+51,208,0,
51,209,0,
+51,255,255,150,1,
+54,211,0,
+17,65,3,
+51,255,255,9,3,3,
+54,212,0,
+17,238,2,
+51,255,255,9,3,3,
28,213,0,
-17,243,0,2,210,0,211,0,
-51,255,255,10,0,
-51,213,0,
-55,214,0,
-17,45,0,
-51,255,255,133,0,3,
-55,215,0,
-17,57,0,
-51,255,255,133,0,3,
-54,216,0,3,
-51,209,0,
-51,213,0,
-28,217,0,
-17,243,0,2,214,0,215,0,
-51,255,255,133,0,
-51,217,0,
-55,218,0,
-17,45,0,
-51,255,255,133,0,3,
-55,219,0,
-17,57,0,
-51,255,255,223,0,3,
-54,220,0,4,
-51,209,0,
-51,213,0,
-51,217,0,
-28,221,0,
-17,243,0,2,218,0,219,0,
-51,255,255,133,0,
-51,221,0,
-55,222,0,
-17,45,0,
-51,255,255,159,0,3,
-55,223,0,
-17,57,0,
-51,255,255,159,0,3,
-54,224,0,5,
-51,209,0,
-51,213,0,
+17,67,3,2,
+51,211,0,
+51,212,0,
+51,255,255,9,3,
+54,214,0,
+17,65,3,
+51,255,255,83,3,3,
+54,215,0,
+17,238,2,
+51,255,255,9,3,3,
+28,216,0,
+17,67,3,2,
+51,214,0,
+51,215,0,
+51,255,255,83,3,
+54,217,0,
+17,107,1,
+51,255,255,232,2,3,
+54,218,0,
+17,238,2,
+51,255,255,232,2,3,
+28,219,0,
+17,89,3,2,
51,217,0,
+51,218,0,
+51,255,255,9,3,
+54,220,0,
+17,3,2,
+51,255,255,150,1,3,
+54,221,0,
+17,7,2,
+51,255,255,150,1,3,
+28,222,0,
+17,112,3,2,
+51,220,0,
51,221,0,
+51,255,255,150,1,
+54,223,0,
+17,107,1,
+51,255,255,232,2,3,
+54,224,0,
+17,238,2,
+51,255,255,232,2,3,
28,225,0,
-17,243,0,2,222,0,223,0,
-51,255,255,159,0,
-51,225,0,
-55,226,0,
-17,45,0,
-51,255,255,159,0,3,
-55,227,0,
-17,57,0,
-51,255,255,239,0,3,
-54,228,0,6,
-51,209,0,
-51,213,0,
-51,217,0,
-51,221,0,
-51,225,0,
-28,229,0,
-17,243,0,2,226,0,227,0,
-51,255,255,159,0,
+17,130,3,2,
+51,223,0,
+51,224,0,
+51,255,255,9,3,
+54,226,0,
+17,3,2,
+51,255,255,150,1,3,
+54,227,0,
+17,7,2,
+51,255,255,150,1,3,
+28,228,0,
+17,152,3,2,
+51,226,0,
+51,227,0,
+51,255,255,150,1,
+54,229,0,
+17,3,2,
+51,255,255,150,1,3,
+54,230,0,
+17,7,2,
+51,255,255,150,1,3,
+28,231,0,
+17,169,3,2,
51,229,0,
-55,230,0,
-17,45,0,
-51,255,255,10,0,3,
-55,231,0,
-17,247,0,
-51,255,255,10,0,3,
-55,232,0,
-17,254,0,
-51,255,255,10,0,3,
-28,233,0,
-17,5,1,3,230,0,231,0,232,0,
-51,255,255,10,0,
-55,234,0,
-17,45,0,
-51,255,255,10,0,3,
-55,235,0,
-17,247,0,
-51,255,255,213,0,3,
-55,236,0,
-17,254,0,
-51,255,255,213,0,3,
-54,237,0,2,
-51,233,0,
-28,238,0,
-17,5,1,3,234,0,235,0,236,0,
-51,255,255,10,0,
-51,238,0,
-55,239,0,
-17,45,0,
-51,255,255,133,0,3,
-55,240,0,
-17,247,0,
-51,255,255,133,0,3,
-55,241,0,
-17,254,0,
-51,255,255,133,0,3,
-54,242,0,3,
+51,230,0,
+51,255,255,150,1,
+54,232,0,
+17,107,1,
+51,255,255,232,2,3,
+54,233,0,
+17,238,2,
+51,255,255,232,2,3,
+28,234,0,
+17,186,3,2,
+51,232,0,
51,233,0,
+51,255,255,9,3,
+54,235,0,
+17,3,2,
+51,255,255,150,1,3,
+54,236,0,
+17,7,2,
+51,255,255,150,1,3,
+28,237,0,
+17,208,3,2,
+51,235,0,
+51,236,0,
+51,255,255,150,1,
+54,238,0,
+17,3,2,
+51,255,255,150,1,3,
+54,239,0,
+17,7,2,
+51,255,255,150,1,3,
+28,240,0,
+17,225,3,2,
51,238,0,
+51,239,0,
+51,255,255,150,1,
+54,241,0,
+17,3,2,
+51,255,255,150,1,3,
+54,242,0,
+17,7,2,
+51,255,255,150,1,3,
28,243,0,
-17,5,1,3,239,0,240,0,241,0,
-51,255,255,133,0,
-51,243,0,
-55,244,0,
-17,45,0,
-51,255,255,133,0,3,
-55,245,0,
-17,247,0,
-51,255,255,223,0,3,
-55,246,0,
-17,254,0,
-51,255,255,223,0,3,
-54,247,0,4,
-51,233,0,
-51,238,0,
-51,243,0,
+17,242,3,2,
+51,241,0,
+51,242,0,
+51,255,255,150,1,
+54,244,0,
+17,3,2,
+51,255,255,150,1,3,
+54,245,0,
+17,7,2,
+51,255,255,150,1,3,
+28,246,0,
+17,2,4,2,
+51,244,0,
+51,245,0,
+51,255,255,150,1,
+54,247,0,
+17,17,4,
+51,255,255,83,3,3,
28,248,0,
-17,5,1,3,244,0,245,0,246,0,
-51,255,255,133,0,
-51,248,0,
-55,249,0,
-17,45,0,
-51,255,255,159,0,3,
-55,250,0,
-17,247,0,
-51,255,255,159,0,3,
-55,251,0,
-17,254,0,
-51,255,255,159,0,3,
-54,252,0,5,
-51,233,0,
-51,238,0,
-51,243,0,
-51,248,0,
-28,253,0,
-17,5,1,3,249,0,250,0,251,0,
-51,255,255,159,0,
-51,253,0,
-55,254,0,
-17,45,0,
-51,255,255,159,0,3,
-55,255,0,
-17,247,0,
-51,255,255,239,0,3,
-55,0,1,
-17,254,0,
-51,255,255,239,0,3,
-54,1,1,6,
-51,233,0,
-51,238,0,
-51,243,0,
-51,248,0,
-51,253,0,
-28,2,1,
-17,5,1,3,254,0,255,0,0,1,
-51,255,255,159,0,
-51,2,1,
-55,3,1,
-17,45,0,
-51,255,255,11,1,3,
-55,4,1,
-17,247,0,
-51,255,255,11,1,3,
-55,5,1,
-17,254,0,
-51,255,255,11,1,3,
-54,6,1,7,
-51,233,0,
-51,238,0,
-51,243,0,
-51,248,0,
-51,253,0,
-51,2,1,
-28,7,1,
-17,5,1,3,3,1,4,1,5,1,
-51,255,255,11,1,
-51,7,1,
-55,8,1,
-17,45,0,
-51,255,255,11,1,3,
-55,9,1,
-17,247,0,
-51,255,255,21,1,3,
-55,10,1,
-17,254,0,
-51,255,255,21,1,3,
-54,11,1,8,
-51,233,0,
-51,238,0,
-51,243,0,
-51,248,0,
+17,23,4,1,
+51,247,0,
+51,255,255,9,3,
+54,249,0,
+17,46,4,
+51,255,255,83,3,3,
+54,250,0,
+17,58,4,
+51,255,255,9,3,3,
+54,251,0,
+17,64,4,
+51,255,255,83,3,3,
+28,252,0,
+17,73,4,3,
+51,249,0,
+51,250,0,
+51,251,0,
+51,255,255,83,3,
+54,253,0,
+17,17,4,
+51,255,255,83,3,3,
+28,254,0,
+17,100,4,1,
51,253,0,
+51,255,255,9,3,
+54,255,0,
+17,17,4,
+51,255,255,83,3,3,
+54,0,1,
+17,124,4,
+51,255,255,83,3,3,
+28,1,1,
+17,133,4,2,
+51,255,0,
+51,0,1,
+51,255,255,83,3,
+54,2,1,
+17,3,2,
+51,255,255,150,1,3,
+54,3,1,
+17,7,2,
+51,255,255,150,1,3,
+54,4,1,
+17,161,4,
+51,255,255,232,2,3,
+28,5,1,
+17,169,4,3,
51,2,1,
+51,3,1,
+51,4,1,
+51,255,255,150,1,
+54,6,1,
+17,3,2,
+51,255,255,150,1,3,
+54,7,1,
+17,7,2,
+51,255,255,150,1,3,
+28,8,1,
+17,180,4,2,
+51,6,1,
51,7,1,
-28,12,1,
-17,5,1,3,8,1,9,1,10,1,
-51,255,255,11,1,
-51,12,1,
-55,13,1,
-17,45,0,
-51,255,255,10,0,3,
+51,255,255,150,1,
+54,9,1,
+17,3,2,
+51,255,255,150,1,3,
+54,10,1,
+17,7,2,
+51,255,255,150,1,3,
+28,11,1,
+17,190,4,2,
+51,9,1,
+51,10,1,
+51,255,255,150,1,
+54,12,1,
+17,3,2,
+51,255,255,150,1,3,
+54,13,1,
+17,7,2,
+51,255,255,150,1,3,
28,14,1,
-17,26,1,1,13,1,
-51,255,255,10,0,
-55,15,1,
-17,45,0,
-51,255,255,133,0,3,
-54,16,1,2,
-51,14,1,
+17,207,4,2,
+51,12,1,
+51,13,1,
+51,255,255,150,1,
+54,15,1,
+17,3,2,
+51,255,255,150,1,3,
+54,16,1,
+17,7,2,
+51,255,255,150,1,3,
28,17,1,
-17,26,1,1,15,1,
-51,255,255,133,0,
-51,17,1,
-55,18,1,
-17,45,0,
-51,255,255,10,0,3,
-55,19,1,
-17,57,0,
-51,255,255,10,0,3,
-55,20,1,
-17,35,1,
-51,255,255,10,0,3,
-28,21,1,
-17,37,1,3,18,1,19,1,20,1,
-51,255,255,10,0,
-55,22,1,
-17,45,0,
-51,255,255,10,0,3,
-55,23,1,
-17,57,0,
-51,255,255,10,0,3,
-55,24,1,
-17,35,1,
-51,255,255,213,0,3,
-54,25,1,2,
-51,21,1,
-28,26,1,
-17,37,1,3,22,1,23,1,24,1,
-51,255,255,10,0,
-51,26,1,
-55,27,1,
-17,45,0,
-51,255,255,133,0,3,
-55,28,1,
-17,57,0,
-51,255,255,133,0,3,
-55,29,1,
-17,35,1,
-51,255,255,133,0,3,
-54,30,1,3,
+17,219,4,2,
+51,15,1,
+51,16,1,
+51,255,255,150,1,
+54,18,1,
+17,136,0,
+51,255,255,200,1,3,
+28,19,1,
+17,236,4,1,
+51,18,1,
+51,255,255,77,0,
+54,20,1,
+17,16,0,
+51,255,255,77,0,3,
+54,21,1,
+17,41,0,
+51,255,255,77,0,3,
+28,22,1,
+17,241,4,2,
+51,20,1,
51,21,1,
-51,26,1,
-28,31,1,
-17,37,1,3,27,1,28,1,29,1,
-51,255,255,133,0,
-51,31,1,
-55,32,1,
-17,45,0,
-51,255,255,133,0,3,
-55,33,1,
-17,57,0,
-51,255,255,133,0,3,
-55,34,1,
-17,35,1,
-51,255,255,223,0,3,
-54,35,1,4,
-51,21,1,
-51,26,1,
-51,31,1,
-28,36,1,
-17,37,1,3,32,1,33,1,34,1,
-51,255,255,133,0,
-51,36,1,
-55,37,1,
-17,45,0,
-51,255,255,10,0,3,
-55,38,1,
-17,57,0,
-51,255,255,10,0,3,
-55,39,1,
-17,35,1,
-51,255,255,41,1,3,
-54,40,1,5,
-51,21,1,
-51,26,1,
-51,31,1,
-51,36,1,
-28,41,1,
-17,37,1,3,37,1,38,1,39,1,
-51,255,255,10,0,
-51,41,1,
-55,42,1,
-17,45,0,
-51,255,255,133,0,3,
-55,43,1,
-17,57,0,
-51,255,255,133,0,3,
-55,44,1,
-17,35,1,
-51,255,255,41,1,3,
-54,45,1,6,
-51,21,1,
-51,26,1,
-51,31,1,
-51,36,1,
-51,41,1,
-28,46,1,
-17,37,1,3,42,1,43,1,44,1,
-51,255,255,133,0,
-51,46,1,
-55,47,1,
-17,45,0,
-51,255,255,159,0,3,
-55,48,1,
-17,57,0,
-51,255,255,159,0,3,
-55,49,1,
-17,35,1,
-51,255,255,41,1,3,
-54,50,1,7,
-51,21,1,
-51,26,1,
-51,31,1,
-51,36,1,
-51,41,1,
-51,46,1,
-28,51,1,
-17,37,1,3,47,1,48,1,49,1,
-51,255,255,159,0,
-51,51,1,
-55,52,1,
-17,45,0,
-51,255,255,41,1,3,
-55,53,1,
-17,57,0,
-51,255,255,41,1,3,
-55,54,1,
-17,35,1,
-51,255,255,41,1,3,
-54,55,1,8,
-51,21,1,
-51,26,1,
-51,31,1,
-51,36,1,
-51,41,1,
-51,46,1,
-51,51,1,
-28,56,1,
-17,37,1,3,52,1,53,1,54,1,
-51,255,255,41,1,
-51,56,1,
-55,57,1,
-17,51,1,
-51,255,255,10,0,3,
-55,58,1,
-17,45,0,
-51,255,255,10,0,3,
-28,59,1,
-17,56,1,2,57,1,58,1,
-51,255,255,10,0,
-55,60,1,
-17,51,1,
-51,255,255,213,0,3,
-55,61,1,
-17,45,0,
-51,255,255,10,0,3,
-54,62,1,2,
-51,59,1,
-28,63,1,
-17,56,1,2,60,1,61,1,
-51,255,255,10,0,
-51,63,1,
-55,64,1,
-17,51,1,
-51,255,255,133,0,3,
-55,65,1,
-17,45,0,
-51,255,255,133,0,3,
-54,66,1,3,
-51,59,1,
-51,63,1,
-28,67,1,
-17,56,1,2,64,1,65,1,
-51,255,255,133,0,
-51,67,1,
-55,68,1,
-17,51,1,
-51,255,255,223,0,3,
-55,69,1,
-17,45,0,
-51,255,255,133,0,3,
-54,70,1,4,
-51,59,1,
-51,63,1,
-51,67,1,
-28,71,1,
-17,56,1,2,68,1,69,1,
-51,255,255,133,0,
-51,71,1,
-55,72,1,
-17,61,1,
-51,255,255,10,0,3,
-55,73,1,
-17,67,1,
-51,255,255,10,0,3,
-55,74,1,
-17,45,0,
-51,255,255,10,0,3,
-28,75,1,
-17,73,1,3,72,1,73,1,74,1,
-51,255,255,10,0,
-55,76,1,
-17,61,1,
-51,255,255,213,0,3,
-55,77,1,
-17,67,1,
-51,255,255,213,0,3,
-55,78,1,
-17,45,0,
-51,255,255,10,0,3,
-54,79,1,2,
-51,75,1,
-28,80,1,
-17,73,1,3,76,1,77,1,78,1,
-51,255,255,10,0,
-51,80,1,
-55,81,1,
-17,61,1,
-51,255,255,133,0,3,
-55,82,1,
-17,67,1,
-51,255,255,133,0,3,
-55,83,1,
-17,45,0,
-51,255,255,133,0,3,
-54,84,1,3,
-51,75,1,
-51,80,1,
-28,85,1,
-17,73,1,3,81,1,82,1,83,1,
-51,255,255,133,0,
-51,85,1,
-55,86,1,
-17,61,1,
-51,255,255,223,0,3,
-55,87,1,
-17,67,1,
-51,255,255,223,0,3,
-55,88,1,
-17,45,0,
-51,255,255,133,0,3,
-54,89,1,4,
-51,75,1,
-51,80,1,
-51,85,1,
-28,90,1,
-17,73,1,3,86,1,87,1,88,1,
-51,255,255,133,0,
-51,90,1,
-55,91,1,
-17,45,0,
-51,255,255,10,0,3,
-28,92,1,
-17,84,1,1,91,1,
-51,255,255,41,1,
-55,93,1,
-17,45,0,
-51,255,255,10,0,3,
-28,94,1,
-17,90,1,1,93,1,
-51,255,255,41,1,
-55,95,1,
-17,96,1,
-51,255,255,10,0,3,
-28,96,1,
-17,102,1,1,95,1,
-51,255,255,159,0,
-55,97,1,
-17,96,1,
-51,255,255,10,0,3,
-28,98,1,
-17,117,1,1,97,1,
-51,255,255,11,1,
-55,99,1,
-17,96,1,
-51,255,255,159,0,3,
-28,100,1,
-17,133,1,1,99,1,
-51,255,255,10,0,
-55,101,1,
-17,96,1,
-51,255,255,11,1,3,
-28,102,1,
-17,148,1,1,101,1,
-51,255,255,10,0,
-55,103,1,
-17,35,1,
-51,255,255,10,0,3,
-55,104,1,
-17,164,1,
-51,255,255,10,0,3,
-55,105,1,
-17,166,1,
-51,255,255,10,0,3,
-28,106,1,
-17,168,1,3,103,1,104,1,105,1,
-51,255,255,10,0,
-55,107,1,
-17,35,1,
-51,255,255,133,0,3,
-55,108,1,
-17,164,1,
-51,255,255,133,0,3,
-55,109,1,
-17,166,1,
-51,255,255,133,0,3,
-54,110,1,2,
-51,106,1,
-28,111,1,
-17,168,1,3,107,1,108,1,109,1,
-51,255,255,133,0,
-51,111,1,
-55,112,1,
-17,45,0,
-51,255,255,10,0,3,
-55,113,1,
-38,
-16,32,110,0,
-51,255,255,159,0,3,
-28,114,1,
-39,
-16,0,4,0,0,172,1,2,112,1,113,1,
-51,255,255,10,0,
-55,115,1,
-17,45,0,
-51,255,255,133,0,3,
-55,116,1,
-38,
-16,32,110,0,
-51,255,255,159,0,3,
-54,117,1,2,
-51,114,1,
-28,118,1,
-39,
-16,0,4,0,0,172,1,2,115,1,116,1,
-51,255,255,133,0,
-51,118,1,
-55,119,1,
-17,45,0,
-51,255,255,10,0,3,
-55,120,1,
-17,110,0,
-51,255,255,159,0,3,
-28,121,1,
-17,178,1,2,119,1,120,1,
-51,255,255,10,0,
-55,122,1,
-17,45,0,
-51,255,255,133,0,3,
-55,123,1,
-17,110,0,
-51,255,255,159,0,3,
-54,124,1,2,
-51,121,1,
-28,125,1,
-17,178,1,2,122,1,123,1,
-51,255,255,133,0,
-51,125,1,
-55,126,1,
-17,184,1,
-51,255,255,186,1,3,
-28,127,1,
-17,193,1,1,126,1,
-51,255,255,21,1,
-55,128,1,
-17,184,1,
-51,255,255,186,1,3,
-28,129,1,
-17,207,1,1,128,1,
-51,255,255,21,1,
-55,130,1,
-17,184,1,
-51,255,255,221,1,3,
-28,131,1,
-17,228,1,1,130,1,
-51,255,255,21,1,
-55,132,1,
-17,184,1,
-51,255,255,221,1,3,
-28,133,1,
-17,241,1,1,132,1,
-51,255,255,21,1,
-55,134,1,
-17,254,1,
-51,255,255,21,1,3,
-28,135,1,
-17,0,2,1,134,1,
-51,255,255,186,1,
-55,136,1,
-17,254,1,
-51,255,255,21,1,3,
-28,137,1,
-17,16,2,1,136,1,
-51,255,255,186,1,
-55,138,1,
-17,254,1,
-51,255,255,21,1,3,
-28,139,1,
-17,32,2,1,138,1,
-51,255,255,221,1,
-55,140,1,
-17,254,1,
-51,255,255,21,1,3,
-28,141,1,
-17,47,2,1,140,1,
-51,255,255,221,1,
-55,142,1,
-17,184,1,
-51,255,255,186,1,3,
-28,143,1,
-17,62,2,1,142,1,
-51,255,255,21,1,
-55,144,1,
-17,184,1,
-51,255,255,21,1,3,
-28,145,1,
-17,75,2,1,144,1,
-51,255,255,186,1,
-55,146,1,
-17,45,0,
-51,255,255,10,0,3,
-28,147,1,
-17,90,2,1,146,1,
-51,255,255,213,0,
-55,148,1,
-17,45,0,
-51,255,255,133,0,3,
-54,149,1,2,
-51,147,1,
-28,150,1,
-17,90,2,1,148,1,
-51,255,255,223,0,
-51,150,1,
-55,151,1,
-17,97,2,
-51,255,255,10,0,3,
-55,152,1,
-17,100,2,
-51,255,255,10,0,3,
-28,153,1,
-17,103,2,2,151,1,152,1,
-51,255,255,213,0,
-55,154,1,
-17,97,2,
-51,255,255,133,0,3,
-55,155,1,
-17,100,2,
-51,255,255,133,0,3,
-54,156,1,2,
-51,153,1,
-28,157,1,
-17,103,2,2,154,1,155,1,
-51,255,255,223,0,
-51,157,1,
-55,158,1,
-17,45,0,
-51,255,255,10,0,3,
-55,159,1,
-17,57,0,
-51,255,255,10,0,3,
-28,160,1,
-17,112,2,2,158,1,159,1,
-51,255,255,213,0,
-55,161,1,
-17,45,0,
-51,255,255,133,0,3,
-55,162,1,
-17,57,0,
-51,255,255,133,0,3,
-54,163,1,2,
-51,160,1,
-28,164,1,
-17,112,2,2,161,1,162,1,
-51,255,255,223,0,
-51,164,1,
-55,165,1,
-17,45,0,
-51,255,255,116,2,3,
-55,166,1,
-17,57,0,
-51,255,255,116,2,3,
-28,167,1,
-17,123,2,2,165,1,166,1,
-51,255,255,116,2,
-55,168,1,
-17,45,0,
-51,255,255,129,2,3,
-55,169,1,
-17,57,0,
-51,255,255,129,2,3,
-54,170,1,2,
-51,167,1,
-28,171,1,
-17,123,2,2,168,1,169,1,
-51,255,255,129,2,
-51,171,1,
-55,172,1,
-17,45,0,
-51,255,255,10,0,3,
-28,173,1,
-17,135,2,1,172,1,
-51,255,255,10,0,
-55,174,1,
-17,45,0,
-51,255,255,133,0,3,
-54,175,1,2,
-51,173,1,
-28,176,1,
-17,135,2,1,174,1,
-51,255,255,133,0,
-51,176,1,
-55,177,1,
-17,145,2,
-51,255,255,10,0,3,
-55,178,1,
-17,147,2,
-51,255,255,10,0,3,
-55,179,1,
-17,149,2,
-51,255,255,10,0,3,
-28,180,1,
-17,154,2,3,177,1,178,1,179,1,
-51,255,255,10,0,
-55,181,1,
-17,145,2,
-51,255,255,133,0,3,
-55,182,1,
-17,147,2,
-51,255,255,133,0,3,
-55,183,1,
-17,149,2,
-51,255,255,133,0,3,
-54,184,1,2,
-51,180,1,
-28,185,1,
-17,154,2,3,181,1,182,1,183,1,
-51,255,255,133,0,
-51,185,1,
-55,186,1,
-17,147,2,
-51,255,255,10,0,3,
-55,187,1,
-17,145,2,
-51,255,255,10,0,3,
-28,188,1,
-17,166,2,2,186,1,187,1,
-51,255,255,10,0,
-55,189,1,
-17,147,2,
-51,255,255,133,0,3,
-55,190,1,
-17,145,2,
-51,255,255,133,0,3,
-54,191,1,2,
-51,188,1,
-28,192,1,
-17,166,2,2,189,1,190,1,
-51,255,255,133,0,
-51,192,1,
-55,193,1,
-17,147,2,
-51,255,255,10,0,3,
-55,194,1,
-17,145,2,
-51,255,255,10,0,3,
-55,195,1,
-17,174,2,
-51,255,255,213,0,3,
-28,196,1,
-17,178,2,3,193,1,194,1,195,1,
-51,255,255,10,0,
-55,197,1,
-17,147,2,
-51,255,255,133,0,3,
-55,198,1,
-17,145,2,
-51,255,255,133,0,3,
-55,199,1,
-17,174,2,
-51,255,255,223,0,3,
-54,200,1,2,
-51,196,1,
-28,201,1,
-17,178,2,3,197,1,198,1,199,1,
-51,255,255,133,0,
-51,201,1,
-55,202,1,
-17,45,0,
-51,255,255,186,2,3,
-55,203,1,
-17,57,0,
-51,255,255,186,2,3,
-28,204,1,
-17,191,2,2,202,1,203,1,
-51,255,255,186,2,
-55,205,1,
-17,45,0,
-51,255,255,206,2,3,
-55,206,1,
-17,57,0,
-51,255,255,206,2,3,
-54,207,1,2,
-51,204,1,
-28,208,1,
-17,191,2,2,205,1,206,1,
-51,255,255,206,2,
-51,208,1,
-55,209,1,
-17,166,1,
-51,255,255,212,2,3,
-55,210,1,
-17,217,2,
-51,255,255,212,2,3,
-28,211,1,
-17,219,2,2,209,1,210,1,
-51,255,255,232,2,
-55,212,1,
-17,166,1,
-51,255,255,116,2,3,
-55,213,1,
-17,217,2,
-51,255,255,186,1,3,
-54,214,1,2,
-51,211,1,
-28,215,1,
-17,219,2,2,212,1,213,1,
-51,255,255,243,2,
-51,215,1,
-55,216,1,
-17,166,1,
-51,255,255,186,1,3,
-55,217,1,
-17,217,2,
-51,255,255,116,2,3,
-54,218,1,3,
-51,211,1,
-51,215,1,
-28,219,1,
-17,219,2,2,216,1,217,1,
-51,255,255,252,2,
-51,219,1,
-55,220,1,
-17,166,1,
-51,255,255,221,1,3,
-55,221,1,
-17,217,2,
-51,255,255,186,1,3,
-54,222,1,4,
-51,211,1,
-51,215,1,
-51,219,1,
-28,223,1,
-17,219,2,2,220,1,221,1,
-51,255,255,5,3,
-51,223,1,
-55,224,1,
-17,166,1,
-51,255,255,186,1,3,
-55,225,1,
-17,217,2,
-51,255,255,221,1,3,
-54,226,1,5,
-51,211,1,
-51,215,1,
-51,219,1,
-51,223,1,
-28,227,1,
-17,219,2,2,224,1,225,1,
-51,255,255,14,3,
-51,227,1,
-55,228,1,
-17,166,1,
-51,255,255,221,1,3,
-55,229,1,
-17,217,2,
-51,255,255,116,2,3,
-54,230,1,6,
-51,211,1,
-51,215,1,
-51,219,1,
-51,223,1,
-51,227,1,
-28,231,1,
-17,219,2,2,228,1,229,1,
-51,255,255,23,3,
-51,231,1,
-55,232,1,
-17,166,1,
-51,255,255,116,2,3,
-55,233,1,
-17,217,2,
-51,255,255,221,1,3,
-54,234,1,7,
-51,211,1,
-51,215,1,
-51,219,1,
-51,223,1,
-51,227,1,
-51,231,1,
-28,235,1,
-17,219,2,2,232,1,233,1,
-51,255,255,32,3,
-51,235,1,
-55,236,1,
-17,166,1,
-51,255,255,41,3,3,
-55,237,1,
-17,217,2,
-51,255,255,41,3,3,
-54,238,1,8,
-51,211,1,
-51,215,1,
-51,219,1,
-51,223,1,
-51,227,1,
-51,231,1,
-51,235,1,
-28,239,1,
-17,219,2,2,236,1,237,1,
-51,255,255,47,3,
-51,239,1,
-55,240,1,
-17,166,1,
-51,255,255,129,2,3,
-55,241,1,
-17,217,2,
-51,255,255,59,3,3,
-54,242,1,9,
-51,211,1,
-51,215,1,
-51,219,1,
-51,223,1,
-51,227,1,
-51,231,1,
-51,235,1,
-51,239,1,
-28,243,1,
-17,219,2,2,240,1,241,1,
-51,255,255,65,3,
-51,243,1,
-55,244,1,
-17,166,1,
-51,255,255,59,3,3,
-55,245,1,
-17,217,2,
-51,255,255,129,2,3,
-54,246,1,10,
-51,211,1,
-51,215,1,
-51,219,1,
-51,223,1,
-51,227,1,
-51,231,1,
-51,235,1,
-51,239,1,
-51,243,1,
-28,247,1,
-17,219,2,2,244,1,245,1,
-51,255,255,73,3,
-51,247,1,
-55,248,1,
-17,166,1,
-51,255,255,81,3,3,
-55,249,1,
-17,217,2,
-51,255,255,59,3,3,
-54,250,1,11,
-51,211,1,
-51,215,1,
-51,219,1,
-51,223,1,
-51,227,1,
-51,231,1,
-51,235,1,
-51,239,1,
-51,243,1,
-51,247,1,
-28,251,1,
-17,219,2,2,248,1,249,1,
-51,255,255,87,3,
-51,251,1,
-55,252,1,
-17,166,1,
-51,255,255,59,3,3,
-55,253,1,
-17,217,2,
-51,255,255,81,3,3,
-54,254,1,12,
-51,211,1,
-51,215,1,
-51,219,1,
-51,223,1,
-51,227,1,
-51,231,1,
-51,235,1,
-51,239,1,
-51,243,1,
-51,247,1,
-51,251,1,
-28,255,1,
-17,219,2,2,252,1,253,1,
-51,255,255,95,3,
-51,255,1,
-55,0,2,
-17,166,1,
-51,255,255,81,3,3,
-55,1,2,
-17,217,2,
-51,255,255,129,2,3,
-54,2,2,13,
-51,211,1,
-51,215,1,
-51,219,1,
-51,223,1,
-51,227,1,
-51,231,1,
-51,235,1,
-51,239,1,
-51,243,1,
-51,247,1,
-51,251,1,
-51,255,1,
-28,3,2,
-17,219,2,2,0,2,1,2,
-51,255,255,103,3,
-51,3,2,
-55,4,2,
-17,166,1,
-51,255,255,129,2,3,
-55,5,2,
-17,217,2,
-51,255,255,81,3,3,
-54,6,2,14,
-51,211,1,
-51,215,1,
-51,219,1,
-51,223,1,
-51,227,1,
-51,231,1,
-51,235,1,
-51,239,1,
-51,243,1,
-51,247,1,
-51,251,1,
-51,255,1,
-51,3,2,
-28,7,2,
-17,219,2,2,4,2,5,2,
-51,255,255,111,3,
-51,7,2,
-55,8,2,
-17,119,3,
-51,255,255,232,2,3,
-28,9,2,
-17,121,3,1,8,2,
-51,255,255,232,2,
-55,10,2,
-17,119,3,
-51,255,255,252,2,3,
-54,11,2,2,
-51,9,2,
-28,12,2,
-17,121,3,1,10,2,
-51,255,255,243,2,
-51,12,2,
-55,13,2,
-17,119,3,
-51,255,255,243,2,3,
-54,14,2,3,
-51,9,2,
-51,12,2,
-28,15,2,
-17,121,3,1,13,2,
-51,255,255,252,2,
-51,15,2,
-55,16,2,
-17,119,3,
-51,255,255,14,3,3,
-54,17,2,4,
-51,9,2,
-51,12,2,
-51,15,2,
-28,18,2,
-17,121,3,1,16,2,
-51,255,255,5,3,
-51,18,2,
-55,19,2,
-17,119,3,
-51,255,255,5,3,3,
-54,20,2,5,
-51,9,2,
-51,12,2,
-51,15,2,
-51,18,2,
-28,21,2,
-17,121,3,1,19,2,
-51,255,255,14,3,
-51,21,2,
-55,22,2,
-17,119,3,
-51,255,255,32,3,3,
-54,23,2,6,
-51,9,2,
-51,12,2,
-51,15,2,
-51,18,2,
-51,21,2,
-28,24,2,
-17,121,3,1,22,2,
-51,255,255,23,3,
-51,24,2,
-55,25,2,
-17,119,3,
-51,255,255,23,3,3,
-54,26,2,7,
-51,9,2,
-51,12,2,
-51,15,2,
-51,18,2,
-51,21,2,
-51,24,2,
-28,27,2,
-17,121,3,1,25,2,
-51,255,255,32,3,
-51,27,2,
-55,28,2,
-17,119,3,
-51,255,255,47,3,3,
-54,29,2,8,
-51,9,2,
-51,12,2,
-51,15,2,
-51,18,2,
-51,21,2,
-51,24,2,
-51,27,2,
-28,30,2,
-17,121,3,1,28,2,
-51,255,255,47,3,
-51,30,2,
-55,31,2,
-17,119,3,
-51,255,255,73,3,3,
-54,32,2,9,
-51,9,2,
-51,12,2,
-51,15,2,
-51,18,2,
-51,21,2,
-51,24,2,
-51,27,2,
-51,30,2,
-28,33,2,
-17,121,3,1,31,2,
-51,255,255,65,3,
-51,33,2,
-55,34,2,
-17,119,3,
-51,255,255,65,3,3,
-54,35,2,10,
-51,9,2,
-51,12,2,
-51,15,2,
-51,18,2,
-51,21,2,
-51,24,2,
-51,27,2,
-51,30,2,
-51,33,2,
-28,36,2,
-17,121,3,1,34,2,
-51,255,255,73,3,
-51,36,2,
-55,37,2,
-17,119,3,
-51,255,255,95,3,3,
-54,38,2,11,
-51,9,2,
-51,12,2,
-51,15,2,
-51,18,2,
-51,21,2,
-51,24,2,
-51,27,2,
-51,30,2,
-51,33,2,
-51,36,2,
-28,39,2,
-17,121,3,1,37,2,
-51,255,255,87,3,
-51,39,2,
-55,40,2,
-17,119,3,
-51,255,255,87,3,3,
-54,41,2,12,
-51,9,2,
-51,12,2,
-51,15,2,
-51,18,2,
-51,21,2,
-51,24,2,
-51,27,2,
-51,30,2,
-51,33,2,
-51,36,2,
-51,39,2,
-28,42,2,
-17,121,3,1,40,2,
-51,255,255,95,3,
-51,42,2,
-55,43,2,
-17,119,3,
-51,255,255,111,3,3,
-54,44,2,13,
-51,9,2,
-51,12,2,
-51,15,2,
-51,18,2,
-51,21,2,
-51,24,2,
-51,27,2,
-51,30,2,
-51,33,2,
-51,36,2,
-51,39,2,
-51,42,2,
-28,45,2,
-17,121,3,1,43,2,
-51,255,255,103,3,
-51,45,2,
-55,46,2,
-17,119,3,
-51,255,255,103,3,3,
-54,47,2,14,
-51,9,2,
-51,12,2,
-51,15,2,
-51,18,2,
-51,21,2,
-51,24,2,
-51,27,2,
-51,30,2,
-51,33,2,
-51,36,2,
-51,39,2,
-51,42,2,
-51,45,2,
-28,48,2,
-17,121,3,1,46,2,
-51,255,255,111,3,
-51,48,2,
-55,49,2,
-17,119,3,
+51,255,255,180,1,
+54,23,1,
+17,16,0,
51,255,255,232,2,3,
-28,50,2,
-17,131,3,1,49,2,
-51,255,255,213,0,
-55,51,2,
-17,119,3,
-51,255,255,47,3,3,
-54,52,2,2,
-51,50,2,
-28,53,2,
-17,131,3,1,51,2,
-51,255,255,223,0,
-51,53,2,
-55,54,2,
-17,119,3,
+54,24,1,
+17,41,0,
51,255,255,232,2,3,
-28,55,2,
-17,143,3,1,54,2,
-51,255,255,232,2,
-55,56,2,
-17,119,3,
-51,255,255,47,3,3,
-54,57,2,2,
-51,55,2,
-28,58,2,
-17,143,3,1,56,2,
-51,255,255,47,3,
-51,58,2,
-55,59,2,
-17,45,0,
-51,255,255,212,2,3,
-55,60,2,
-17,57,0,
-51,255,255,212,2,3,
-28,61,2,
-17,151,3,2,59,2,60,2,
-51,255,255,160,3,
-55,62,2,
-17,45,0,
-51,255,255,41,3,3,
-55,63,2,
-17,57,0,
-51,255,255,41,3,3,
-54,64,2,2,
-51,61,2,
-28,65,2,
-17,151,3,2,62,2,63,2,
-51,255,255,160,3,
-51,65,2,
-55,66,2,
-17,45,0,
-51,255,255,166,3,3,
-55,67,2,
-17,57,0,
-51,255,255,166,3,3,
-54,68,2,3,
-51,61,2,
-51,65,2,
-28,69,2,
-17,151,3,2,66,2,67,2,
-51,255,255,160,3,
-51,69,2,
-55,70,2,
-17,45,0,
-51,255,255,172,3,3,
-55,71,2,
-17,57,0,
-51,255,255,172,3,3,
-54,72,2,4,
-51,61,2,
-51,65,2,
-51,69,2,
-28,73,2,
-17,151,3,2,70,2,71,2,
-51,255,255,160,3,
-51,73,2,
-55,74,2,
-17,45,0,
-51,255,255,178,3,3,
-55,75,2,
-17,57,0,
-51,255,255,178,3,3,
-54,76,2,5,
-51,61,2,
-51,65,2,
-51,69,2,
-51,73,2,
-28,77,2,
-17,151,3,2,74,2,75,2,
-51,255,255,160,3,
-51,77,2,
-55,78,2,
-17,45,0,
-51,255,255,185,3,3,
-55,79,2,
-17,57,0,
-51,255,255,185,3,3,
-54,80,2,6,
-51,61,2,
-51,65,2,
-51,69,2,
-51,73,2,
-51,77,2,
-28,81,2,
-17,151,3,2,78,2,79,2,
-51,255,255,160,3,
-51,81,2,
-55,82,2,
-17,45,0,
-51,255,255,212,2,3,
-55,83,2,
-17,57,0,
-51,255,255,212,2,3,
-28,84,2,
-17,191,3,2,82,2,83,2,
-51,255,255,160,3,
-55,85,2,
-17,45,0,
-51,255,255,41,3,3,
-55,86,2,
-17,57,0,
-51,255,255,41,3,3,
-54,87,2,2,
-51,84,2,
-28,88,2,
-17,191,3,2,85,2,86,2,
-51,255,255,160,3,
-51,88,2,
-55,89,2,
-17,45,0,
-51,255,255,166,3,3,
-55,90,2,
-17,57,0,
-51,255,255,166,3,3,
-54,91,2,3,
-51,84,2,
-51,88,2,
-28,92,2,
-17,191,3,2,89,2,90,2,
-51,255,255,160,3,
-51,92,2,
-55,93,2,
-17,45,0,
-51,255,255,185,3,3,
-55,94,2,
-17,57,0,
-51,255,255,185,3,3,
-54,95,2,4,
-51,84,2,
-51,88,2,
-51,92,2,
-28,96,2,
-17,191,3,2,93,2,94,2,
-51,255,255,160,3,
-51,96,2,
-55,97,2,
-17,45,0,
-51,255,255,172,3,3,
-55,98,2,
-17,57,0,
-51,255,255,172,3,3,
-54,99,2,5,
-51,84,2,
-51,88,2,
-51,92,2,
-51,96,2,
-28,100,2,
-17,191,3,2,97,2,98,2,
-51,255,255,160,3,
-51,100,2,
-55,101,2,
-17,45,0,
-51,255,255,178,3,3,
-55,102,2,
-17,57,0,
-51,255,255,178,3,3,
-54,103,2,6,
-51,84,2,
-51,88,2,
-51,92,2,
-51,96,2,
-51,100,2,
-28,104,2,
-17,191,3,2,101,2,102,2,
-51,255,255,160,3,
-51,104,2,
-55,105,2,
-17,45,0,
-51,255,255,212,2,3,
-55,106,2,
-17,57,0,
-51,255,255,212,2,3,
-28,107,2,
-17,205,3,2,105,2,106,2,
-51,255,255,160,3,
-55,108,2,
-17,45,0,
-51,255,255,41,3,3,
-55,109,2,
-17,57,0,
-51,255,255,41,3,3,
-54,110,2,2,
-51,107,2,
-28,111,2,
-17,205,3,2,108,2,109,2,
-51,255,255,160,3,
-51,111,2,
-55,112,2,
-17,45,0,
-51,255,255,166,3,3,
-55,113,2,
-17,57,0,
-51,255,255,166,3,3,
-54,114,2,3,
-51,107,2,
-51,111,2,
-28,115,2,
-17,205,3,2,112,2,113,2,
-51,255,255,160,3,
-51,115,2,
-55,116,2,
-17,45,0,
-51,255,255,185,3,3,
-55,117,2,
-17,57,0,
-51,255,255,185,3,3,
-54,118,2,4,
-51,107,2,
-51,111,2,
-51,115,2,
-28,119,2,
-17,205,3,2,116,2,117,2,
-51,255,255,160,3,
-51,119,2,
-55,120,2,
-17,45,0,
-51,255,255,172,3,3,
-55,121,2,
-17,57,0,
-51,255,255,172,3,3,
-54,122,2,5,
-51,107,2,
-51,111,2,
-51,115,2,
-51,119,2,
-28,123,2,
-17,205,3,2,120,2,121,2,
-51,255,255,160,3,
-51,123,2,
-55,124,2,
-17,45,0,
-51,255,255,178,3,3,
-55,125,2,
-17,57,0,
-51,255,255,178,3,3,
-54,126,2,6,
-51,107,2,
-51,111,2,
-51,115,2,
-51,119,2,
-51,123,2,
-28,127,2,
-17,205,3,2,124,2,125,2,
-51,255,255,160,3,
-51,127,2,
-55,128,2,
-17,45,0,
-51,255,255,212,2,3,
-55,129,2,
-17,57,0,
-51,255,255,212,2,3,
-28,130,2,
-17,217,3,2,128,2,129,2,
-51,255,255,160,3,
-55,131,2,
-17,45,0,
-51,255,255,41,3,3,
-55,132,2,
-17,57,0,
-51,255,255,41,3,3,
-54,133,2,2,
-51,130,2,
-28,134,2,
-17,217,3,2,131,2,132,2,
-51,255,255,160,3,
-51,134,2,
-55,135,2,
-17,45,0,
-51,255,255,166,3,3,
-55,136,2,
-17,57,0,
-51,255,255,166,3,3,
-54,137,2,3,
-51,130,2,
-51,134,2,
-28,138,2,
-17,217,3,2,135,2,136,2,
-51,255,255,160,3,
-51,138,2,
-55,139,2,
-17,45,0,
-51,255,255,185,3,3,
-55,140,2,
-17,57,0,
-51,255,255,185,3,3,
-54,141,2,4,
-51,130,2,
-51,134,2,
-51,138,2,
-28,142,2,
-17,217,3,2,139,2,140,2,
-51,255,255,160,3,
-51,142,2,
-55,143,2,
-17,45,0,
-51,255,255,172,3,3,
-55,144,2,
-17,57,0,
-51,255,255,172,3,3,
-54,145,2,5,
-51,130,2,
-51,134,2,
-51,138,2,
-51,142,2,
-28,146,2,
-17,217,3,2,143,2,144,2,
-51,255,255,160,3,
-51,146,2,
-55,147,2,
-17,45,0,
-51,255,255,178,3,3,
-55,148,2,
-17,57,0,
-51,255,255,178,3,3,
-54,149,2,6,
-51,130,2,
-51,134,2,
-51,138,2,
-51,142,2,
-51,146,2,
-28,150,2,
-17,217,3,2,147,2,148,2,
-51,255,255,160,3,
-51,150,2,
-55,151,2,
-17,45,0,
-51,255,255,212,2,3,
-55,152,2,
-17,57,0,
-51,255,255,212,2,3,
-28,153,2,
-17,234,3,2,151,2,152,2,
-51,255,255,160,3,
-55,154,2,
-17,45,0,
-51,255,255,41,3,3,
-55,155,2,
-17,57,0,
-51,255,255,41,3,3,
-54,156,2,2,
-51,153,2,
-28,157,2,
-17,234,3,2,154,2,155,2,
-51,255,255,160,3,
-51,157,2,
-55,158,2,
-17,45,0,
-51,255,255,166,3,3,
-55,159,2,
-17,57,0,
-51,255,255,166,3,3,
-54,160,2,3,
-51,153,2,
-51,157,2,
-28,161,2,
-17,234,3,2,158,2,159,2,
-51,255,255,160,3,
-51,161,2,
-55,162,2,
-17,45,0,
-51,255,255,185,3,3,
-55,163,2,
-17,57,0,
-51,255,255,185,3,3,
-54,164,2,4,
-51,153,2,
-51,157,2,
-51,161,2,
-28,165,2,
-17,234,3,2,162,2,163,2,
-51,255,255,160,3,
-51,165,2,
-55,166,2,
-17,45,0,
-51,255,255,172,3,3,
-55,167,2,
-17,57,0,
-51,255,255,172,3,3,
-54,168,2,5,
-51,153,2,
-51,157,2,
-51,161,2,
-51,165,2,
-28,169,2,
-17,234,3,2,166,2,167,2,
-51,255,255,160,3,
-51,169,2,
-55,170,2,
-17,45,0,
-51,255,255,178,3,3,
-55,171,2,
-17,57,0,
-51,255,255,178,3,3,
-54,172,2,6,
-51,153,2,
-51,157,2,
-51,161,2,
-51,165,2,
-51,169,2,
-28,173,2,
-17,234,3,2,170,2,171,2,
-51,255,255,160,3,
-51,173,2,
-55,174,2,
-17,45,0,
-51,255,255,160,3,3,
-55,175,2,
-17,57,0,
-51,255,255,160,3,3,
-54,176,2,7,
-51,153,2,
-51,157,2,
-51,161,2,
-51,165,2,
-51,169,2,
-51,173,2,
-28,177,2,
-17,234,3,2,174,2,175,2,
-51,255,255,160,3,
-51,177,2,
-55,178,2,
-17,45,0,
-51,255,255,212,2,3,
-55,179,2,
-17,57,0,
-51,255,255,212,2,3,
-28,180,2,
-17,240,3,2,178,2,179,2,
-51,255,255,160,3,
-55,181,2,
-17,45,0,
-51,255,255,41,3,3,
-55,182,2,
-17,57,0,
-51,255,255,41,3,3,
-54,183,2,2,
-51,180,2,
-28,184,2,
-17,240,3,2,181,2,182,2,
-51,255,255,160,3,
-51,184,2,
-55,185,2,
-17,45,0,
-51,255,255,166,3,3,
-55,186,2,
-17,57,0,
-51,255,255,166,3,3,
-54,187,2,3,
-51,180,2,
-51,184,2,
-28,188,2,
-17,240,3,2,185,2,186,2,
-51,255,255,160,3,
-51,188,2,
-55,189,2,
-17,45,0,
-51,255,255,185,3,3,
-55,190,2,
-17,57,0,
-51,255,255,185,3,3,
-54,191,2,4,
-51,180,2,
-51,184,2,
-51,188,2,
-28,192,2,
-17,240,3,2,189,2,190,2,
-51,255,255,160,3,
-51,192,2,
-55,193,2,
-17,45,0,
-51,255,255,172,3,3,
-55,194,2,
-17,57,0,
-51,255,255,172,3,3,
-54,195,2,5,
-51,180,2,
-51,184,2,
-51,188,2,
-51,192,2,
-28,196,2,
-17,240,3,2,193,2,194,2,
-51,255,255,160,3,
-51,196,2,
-55,197,2,
-17,45,0,
-51,255,255,178,3,3,
-55,198,2,
-17,57,0,
-51,255,255,178,3,3,
-54,199,2,6,
-51,180,2,
-51,184,2,
-51,188,2,
-51,192,2,
-51,196,2,
-28,200,2,
-17,240,3,2,197,2,198,2,
-51,255,255,160,3,
-51,200,2,
-55,201,2,
-17,45,0,
-51,255,255,160,3,3,
-55,202,2,
-17,57,0,
-51,255,255,160,3,3,
-54,203,2,7,
-51,180,2,
-51,184,2,
-51,188,2,
-51,192,2,
-51,196,2,
-51,200,2,
-28,204,2,
-17,240,3,2,201,2,202,2,
-51,255,255,160,3,
-51,204,2,
-55,205,2,
-17,45,0,
-51,255,255,160,3,3,
-28,206,2,
-17,249,3,1,205,2,
-51,255,255,253,3,
-55,207,2,
-17,45,0,
-51,255,255,160,3,3,
-28,208,2,
-17,2,4,1,207,2,
-51,255,255,253,3,
-55,209,2,
-17,45,0,
-51,255,255,160,3,3,
-28,210,2,
-17,6,4,1,209,2,
-51,255,255,160,3,
-55,211,2,
-17,96,1,
-51,255,255,159,0,3,
-28,212,2,
-17,10,4,1,211,2,
-51,255,255,159,0,
-55,213,2,
-17,96,1,
-51,255,255,11,1,3,
-54,214,2,2,
-51,212,2,
-28,215,2,
-17,10,4,1,213,2,
-51,255,255,159,0,
-51,215,2,
-55,216,2,
-17,96,1,
-51,255,255,159,0,3,
-28,217,2,
-17,19,4,1,216,2,
-51,255,255,159,0,
-55,218,2,
-17,96,1,
-51,255,255,11,1,3,
-54,219,2,2,
-51,217,2,
-28,220,2,
-17,19,4,1,218,2,
-51,255,255,159,0,
-51,220,2,
-55,221,2,
-17,96,1,
-51,255,255,159,0,3,
-28,222,2,
-17,27,4,1,221,2,
-51,255,255,159,0,
-55,223,2,
-17,96,1,
-51,255,255,11,1,3,
-54,224,2,2,
-51,222,2,
-28,225,2,
-17,27,4,1,223,2,
-51,255,255,159,0,
-51,225,2,
-55,226,2,
-17,35,4,
-51,255,255,43,4,3,
-55,227,2,
-17,53,4,
-51,255,255,55,4,3,
-28,228,2,
-17,63,4,2,226,2,227,2,
-51,255,255,77,4,
-55,229,2,
-17,53,4,
-51,255,255,87,4,3,
-28,230,2,
-17,101,4,1,229,2,
-51,255,255,113,4,
-55,231,2,
-17,53,4,
-51,255,255,118,4,3,
-55,232,2,
-17,128,4,
-51,255,255,213,0,3,
-28,233,2,
-17,130,4,2,231,2,232,2,
-51,255,255,81,3,
-55,234,2,
-17,53,4,
-51,255,255,118,4,3,
-55,235,2,
-17,128,4,
-51,255,255,213,0,3,
-55,236,2,
-17,137,4,
-51,255,255,213,0,3,
-54,237,2,2,
-51,233,2,
-28,238,2,
-17,130,4,3,234,2,235,2,236,2,
-51,255,255,81,3,
-51,238,2,
-55,239,2,
-17,53,4,
-51,255,255,77,4,3,
-55,240,2,
-17,128,4,
-51,255,255,186,1,3,
-54,241,2,3,
-51,233,2,
-51,238,2,
-28,242,2,
-17,130,4,2,239,2,240,2,
-51,255,255,81,3,
-51,242,2,
-55,243,2,
-17,53,4,
-51,255,255,142,4,3,
-55,244,2,
-17,128,4,
-51,255,255,186,1,3,
-54,245,2,4,
-51,233,2,
-51,238,2,
-51,242,2,
-28,246,2,
-17,130,4,2,243,2,244,2,
-51,255,255,153,4,
-51,246,2,
-55,247,2,
-17,53,4,
-51,255,255,158,4,3,
-55,248,2,
-17,128,4,
-51,255,255,186,1,3,
-55,249,2,
-17,137,4,
-51,255,255,213,0,3,
-54,250,2,5,
-51,233,2,
-51,238,2,
-51,242,2,
-51,246,2,
-28,251,2,
-17,130,4,3,247,2,248,2,249,2,
-51,255,255,81,3,
-51,251,2,
-55,252,2,
-17,53,4,
-51,255,255,158,4,3,
-55,253,2,
-17,128,4,
-51,255,255,186,1,3,
-54,254,2,6,
-51,233,2,
-51,238,2,
-51,242,2,
-51,246,2,
-51,251,2,
-28,255,2,
-17,130,4,2,252,2,253,2,
-51,255,255,81,3,
-51,255,2,
-55,0,3,
-17,53,4,
-51,255,255,87,4,3,
-55,1,3,
-17,128,4,
-51,255,255,186,1,3,
-54,2,3,7,
-51,233,2,
-51,238,2,
-51,242,2,
-51,246,2,
-51,251,2,
-51,255,2,
-28,3,3,
-17,130,4,2,0,3,1,3,
-51,255,255,81,3,
-51,3,3,
-55,4,3,
-17,53,4,
-51,255,255,87,4,3,
-55,5,3,
-17,128,4,
-51,255,255,116,2,3,
-54,6,3,8,
-51,233,2,
-51,238,2,
-51,242,2,
-51,246,2,
-51,251,2,
-51,255,2,
-51,3,3,
-28,7,3,
-17,130,4,2,4,3,5,3,
-51,255,255,81,3,
-51,7,3,
-55,8,3,
-17,177,4,
-51,255,255,185,4,3,
-28,9,3,
-17,198,4,1,8,3,
-51,255,255,81,3,
-55,10,3,
-17,177,4,
-51,255,255,210,4,3,
-55,11,3,
-17,130,4,
-51,255,255,239,0,3,
-54,12,3,2,
-51,9,3,
-28,13,3,
-17,198,4,2,10,3,11,3,
-51,255,255,81,3,
-51,13,3,
-55,14,3,
-17,53,4,
-51,255,255,118,4,3,
-55,15,3,
-17,128,4,
-51,255,255,186,1,3,
-54,16,3,9,
-51,233,2,
-51,238,2,
-51,242,2,
-51,246,2,
-51,251,2,
-51,255,2,
-51,3,3,
-51,7,3,
-28,17,3,
-17,130,4,2,14,3,15,3,
-51,255,255,81,3,
-51,17,3,
-55,18,3,
-17,53,4,
-51,255,255,118,4,3,
-55,19,3,
-17,128,4,
-51,255,255,186,1,3,
-55,20,3,
-17,137,4,
-51,255,255,213,0,3,
-54,21,3,10,
-51,233,2,
-51,238,2,
-51,242,2,
-51,246,2,
-51,251,2,
-51,255,2,
-51,3,3,
-51,7,3,
-51,17,3,
-28,22,3,
-17,130,4,3,18,3,19,3,20,3,
-51,255,255,81,3,
-51,22,3,
-55,23,3,
-17,53,4,
-51,255,255,77,4,3,
-55,24,3,
-17,128,4,
-51,255,255,116,2,3,
-54,25,3,11,
-51,233,2,
-51,238,2,
-51,242,2,
-51,246,2,
-51,251,2,
-51,255,2,
-51,3,3,
-51,7,3,
-51,17,3,
-51,22,3,
-28,26,3,
-17,130,4,2,23,3,24,3,
-51,255,255,81,3,
-51,26,3,
-55,27,3,
-17,53,4,
-51,255,255,77,4,3,
-55,28,3,
-17,128,4,
-51,255,255,116,2,3,
-55,29,3,
-17,137,4,
-51,255,255,213,0,3,
-54,30,3,12,
-51,233,2,
-51,238,2,
-51,242,2,
-51,246,2,
-51,251,2,
-51,255,2,
-51,3,3,
-51,7,3,
-51,17,3,
-51,22,3,
-51,26,3,
-28,31,3,
-17,130,4,3,27,3,28,3,29,3,
-51,255,255,81,3,
-51,31,3,
-55,32,3,
-17,254,1,
-51,255,255,10,0,3,
-28,33,3,
-17,225,4,1,32,3,
-51,255,255,10,0,
-55,34,3,
-17,254,1,
-51,255,255,10,0,3,
-28,35,3,
-17,230,4,1,34,3,
-51,255,255,10,0,
-55,36,3,
-17,254,1,
-51,255,255,133,0,3,
-54,37,3,2,
-51,33,3,
-28,38,3,
-17,225,4,1,36,3,
-51,255,255,133,0,
-51,38,3,
-55,39,3,
-17,254,1,
-51,255,255,133,0,3,
-54,40,3,2,
-51,35,3,
-28,41,3,
-17,230,4,1,39,3,
-51,255,255,133,0,
-51,41,3,
-55,42,3,
-17,254,1,
-51,255,255,10,0,3,
-28,43,3,
-17,235,4,1,42,3,
-51,255,255,10,0,
-55,44,3,
-17,254,1,
-51,255,255,133,0,3,
-54,45,3,2,
-51,43,3,
-28,46,3,
-17,235,4,1,44,3,
-51,255,255,133,0,
-51,46,3,
-55,47,3,
-17,242,4,
-51,255,255,213,0,3,
-55,48,3,
-17,130,4,
-51,255,255,239,0,3,
-28,49,3,
-17,254,4,2,47,3,48,3,
-51,255,255,213,0,
-55,50,3,
-17,242,4,
-51,255,255,186,1,3,
-55,51,3,
-17,130,4,
-51,255,255,239,0,3,
-54,52,3,2,
-51,49,3,
-28,53,3,
-17,254,4,2,50,3,51,3,
-51,255,255,186,1,
-51,53,3,
-55,54,3,
-17,242,4,
-51,255,255,116,2,3,
-55,55,3,
-17,130,4,
-51,255,255,239,0,3,
-54,56,3,3,
-51,49,3,
-51,53,3,
-28,57,3,
-17,254,4,2,54,3,55,3,
-51,255,255,116,2,
-51,57,3,
-55,58,3,
-17,242,4,
-51,255,255,221,1,3,
-55,59,3,
-17,130,4,
-51,255,255,239,0,3,
-54,60,3,4,
-51,49,3,
-51,53,3,
-51,57,3,
-28,61,3,
-17,254,4,2,58,3,59,3,
-51,255,255,221,1,
-51,61,3,
-55,62,3,
-17,242,4,
-51,255,255,213,0,3,
-55,63,3,
-17,18,5,
-51,255,255,186,1,3,
-28,64,3,
-17,25,5,2,62,3,63,3,
-51,255,255,213,0,
-55,65,3,
-17,242,4,
-51,255,255,186,1,3,
-55,66,3,
-17,18,5,
-51,255,255,186,1,3,
-54,67,3,2,
-51,64,3,
-28,68,3,
-17,25,5,2,65,3,66,3,
-51,255,255,186,1,
-51,68,3,
-55,69,3,
-17,242,4,
-51,255,255,116,2,3,
-55,70,3,
-17,18,5,
-51,255,255,186,1,3,
-54,71,3,3,
-51,64,3,
-51,68,3,
-28,72,3,
-17,25,5,2,69,3,70,3,
-51,255,255,116,2,
-51,72,3,
-55,73,3,
-17,242,4,
-51,255,255,221,1,3,
-55,74,3,
-17,18,5,
-51,255,255,186,1,3,
-54,75,3,4,
-51,64,3,
-51,68,3,
-51,72,3,
-28,76,3,
-17,25,5,2,73,3,74,3,
-51,255,255,221,1,
-51,76,3,
-55,77,3,
-17,45,5,
-51,255,255,81,3,3,
-55,78,3,
-17,49,5,
-51,255,255,81,3,3,
-28,79,3,
-17,53,5,2,77,3,78,3,
-51,255,255,81,3,
-55,80,3,
-17,45,5,
-51,255,255,81,3,3,
-55,81,3,
-17,49,5,
-51,255,255,81,3,3,
-28,82,3,
-17,65,5,2,80,3,81,3,
-51,255,255,81,3,
-55,83,3,
-17,45,5,
-51,255,255,81,3,3,
-55,84,3,
-17,49,5,
-51,255,255,81,3,3,
-28,85,3,
-17,75,5,2,83,3,84,3,
-51,255,255,81,3,
-55,86,3,
-17,45,5,
-51,255,255,81,3,3,
-55,87,3,
-17,49,5,
-51,255,255,81,3,3,
-28,88,3,
-17,85,5,2,86,3,87,3,
-51,255,255,81,3,
-55,89,3,
-17,45,5,
-51,255,255,81,3,3,
-55,90,3,
-17,49,5,
-51,255,255,81,3,3,
-28,91,3,
-17,100,5,2,89,3,90,3,
-51,255,255,81,3,
-55,92,3,
-17,45,5,
-51,255,255,81,3,3,
-55,93,3,
-17,49,5,
-51,255,255,81,3,3,
-28,94,3,
-17,115,5,2,92,3,93,3,
-51,255,255,81,3,
-55,95,3,
-17,45,5,
-51,255,255,81,3,3,
-55,96,3,
-17,49,5,
-51,255,255,81,3,3,
-28,97,3,
-17,128,5,2,95,3,96,3,
-51,255,255,81,3,
-55,98,3,
-17,45,5,
-51,255,255,81,3,3,
-55,99,3,
-17,49,5,
-51,255,255,81,3,3,
-28,100,3,
-17,141,5,2,98,3,99,3,
-51,255,255,81,3,
-55,101,3,
-17,45,5,
-51,255,255,81,3,3,
-55,102,3,
-17,49,5,
-51,255,255,81,3,3,
-28,103,3,
-17,155,5,2,101,3,102,3,
-51,255,255,81,3,
-55,104,3,
-17,45,5,
-51,255,255,81,3,3,
-55,105,3,
-17,49,5,
-51,255,255,81,3,3,
-28,106,3,
-17,169,5,2,104,3,105,3,
-51,255,255,81,3,
-55,107,3,
-17,45,5,
-51,255,255,81,3,3,
-55,108,3,
-17,49,5,
-51,255,255,81,3,3,
-28,109,3,
-17,184,5,2,107,3,108,3,
-51,255,255,81,3,
-55,110,3,
-17,45,5,
-51,255,255,81,3,3,
-55,111,3,
-17,49,5,
-51,255,255,81,3,3,
-28,112,3,
-17,199,5,2,110,3,111,3,
-51,255,255,81,3,
-55,113,3,
-17,45,5,
-51,255,255,81,3,3,
-55,114,3,
-17,49,5,
-51,255,255,81,3,3,
-28,115,3,
-17,209,5,2,113,3,114,3,
-51,255,255,81,3,
-55,116,3,
-17,45,5,
-51,255,255,81,3,3,
-55,117,3,
-17,49,5,
-51,255,255,81,3,3,
-55,118,3,
-17,220,5,
-51,255,255,81,3,3,
-28,119,3,
-17,228,5,3,116,3,117,3,118,3,
-51,255,255,81,3,
-55,120,3,
-17,45,5,
-51,255,255,81,3,3,
-55,121,3,
-17,49,5,
-51,255,255,81,3,3,
-28,122,3,
-17,246,5,2,120,3,121,3,
-51,255,255,81,3,
-55,123,3,
-17,45,5,
-51,255,255,81,3,3,
-55,124,3,
-17,49,5,
-51,255,255,81,3,3,
-28,125,3,
-17,5,6,2,123,3,124,3,
-51,255,255,81,3,
-55,126,3,
-17,53,4,
-51,255,255,59,3,3,
-55,127,3,
-17,18,6,
-51,255,255,59,3,3,
-28,128,3,
-17,20,6,2,126,3,127,3,
-51,255,255,223,0,
-55,129,3,
-17,45,5,
-51,255,255,81,3,3,
-55,130,3,
-17,49,5,
-51,255,255,81,3,3,
-28,131,3,
-17,45,6,2,129,3,130,3,
-51,255,255,81,3,
-55,132,3,
-17,35,1,
-51,255,255,81,3,3,
-55,133,3,
-17,164,1,
-51,255,255,81,3,3,
-55,134,3,
-17,59,6,
-51,255,255,223,0,3,
-54,135,3,2,
-51,131,3,
-28,136,3,
-17,45,6,3,132,3,133,3,134,3,
-51,255,255,81,3,
-51,136,3,
-55,137,3,
-17,45,5,
-51,255,255,81,3,3,
-55,138,3,
-17,49,5,
-51,255,255,81,3,3,
-28,139,3,
-17,64,6,2,137,3,138,3,
-51,255,255,81,3,
-55,140,3,
-17,45,5,
-51,255,255,81,3,3,
-55,141,3,
-17,49,5,
-51,255,255,81,3,3,
-55,142,3,
-17,78,6,
-51,255,255,223,0,3,
-28,143,3,
-17,83,6,3,140,3,141,3,142,3,
-51,255,255,81,3,
-55,144,3,
-17,45,5,
-51,255,255,81,3,3,
-55,145,3,
-17,49,5,
-51,255,255,81,3,3,
-54,146,3,2,
-51,143,3,
-28,147,3,
-17,83,6,2,144,3,145,3,
-51,255,255,81,3,
-51,147,3,
-55,148,3,
-17,96,6,
-51,255,255,223,0,3,
-55,149,3,
-17,18,6,
-51,255,255,223,0,3,
-28,150,3,
-17,98,6,2,148,3,149,3,
-51,255,255,223,0,
-55,151,3,
-17,96,6,
-51,255,255,129,2,3,
-55,152,3,
-17,18,6,
-51,255,255,223,0,3,
-54,153,3,2,
-51,150,3,
-28,154,3,
-17,98,6,2,151,3,152,3,
-51,255,255,129,2,
-51,154,3,
-55,155,3,
-17,53,4,
-51,255,255,59,3,3,
-55,156,3,
-17,18,6,
-51,255,255,59,3,3,
-28,157,3,
-17,114,6,2,155,3,156,3,
-51,255,255,223,0,
-55,158,3,
-17,45,5,
-51,255,255,81,3,3,
-55,159,3,
-17,49,5,
-51,255,255,81,3,3,
-28,160,3,
-17,137,6,2,158,3,159,3,
-51,255,255,81,3,
-55,161,3,
-17,53,4,
-51,255,255,59,3,3,
-55,162,3,
-17,18,6,
-51,255,255,59,3,3,
-28,163,3,
-17,155,6,2,161,3,162,3,
-51,255,255,223,0,
-55,164,3,
-17,45,5,
-51,255,255,81,3,3,
-55,165,3,
-17,49,5,
-51,255,255,81,3,3,
-28,166,3,
-17,177,6,2,164,3,165,3,
-51,255,255,81,3,
-55,167,3,
-17,45,5,
-51,255,255,81,3,3,
-55,168,3,
-17,49,5,
-51,255,255,81,3,3,
-28,169,3,
-17,194,6,2,167,3,168,3,
-51,255,255,81,3,
-55,170,3,
-17,53,4,
-51,255,255,59,3,3,
-55,171,3,
-17,18,6,
-51,255,255,59,3,3,
-28,172,3,
-17,211,6,2,170,3,171,3,
-51,255,255,223,0,
-55,173,3,
-17,45,5,
-51,255,255,81,3,3,
-55,174,3,
-17,49,5,
-51,255,255,81,3,3,
-28,175,3,
-17,233,6,2,173,3,174,3,
-51,255,255,81,3,
-55,176,3,
-17,45,5,
-51,255,255,81,3,3,
-55,177,3,
-17,49,5,
-51,255,255,81,3,3,
-28,178,3,
-17,250,6,2,176,3,177,3,
-51,255,255,81,3,
-55,179,3,
-17,45,5,
-51,255,255,81,3,3,
-55,180,3,
-17,49,5,
-51,255,255,81,3,3,
-28,181,3,
-17,11,7,2,179,3,180,3,
-51,255,255,81,3,
-55,182,3,
-17,45,5,
-51,255,255,81,3,3,
-55,183,3,
-17,49,5,
-51,255,255,81,3,3,
-28,184,3,
-17,27,7,2,182,3,183,3,
-51,255,255,81,3,
-55,185,3,
-17,42,7,
-51,255,255,129,2,3,
-28,186,3,
-17,48,7,1,185,3,
-51,255,255,223,0,
-55,187,3,
-17,71,7,
-51,255,255,129,2,3,
-55,188,3,
-17,83,7,
-51,255,255,223,0,3,
-55,189,3,
-17,89,7,
-51,255,255,129,2,3,
-28,190,3,
-17,98,7,3,187,3,188,3,189,3,
-51,255,255,129,2,
-55,191,3,
-17,42,7,
-51,255,255,129,2,3,
-28,192,3,
-17,125,7,1,191,3,
-51,255,255,223,0,
-55,193,3,
-17,42,7,
-51,255,255,129,2,3,
-55,194,3,
-17,149,7,
-51,255,255,129,2,3,
-28,195,3,
-17,158,7,2,193,3,194,3,
-51,255,255,129,2,
-55,196,3,
-17,45,5,
-51,255,255,81,3,3,
-55,197,3,
-17,49,5,
-51,255,255,81,3,3,
-55,198,3,
-17,186,7,
-51,255,255,59,3,3,
-28,199,3,
-17,194,7,3,196,3,197,3,198,3,
-51,255,255,81,3,
-55,200,3,
-17,45,5,
-51,255,255,81,3,3,
-55,201,3,
-17,49,5,
-51,255,255,81,3,3,
-28,202,3,
-17,205,7,2,200,3,201,3,
-51,255,255,81,3,
-55,203,3,
-17,45,5,
-51,255,255,81,3,3,
-55,204,3,
-17,49,5,
-51,255,255,81,3,3,
-28,205,3,
-17,215,7,2,203,3,204,3,
-51,255,255,81,3,
-55,206,3,
-17,45,5,
-51,255,255,81,3,3,
-55,207,3,
-17,49,5,
-51,255,255,81,3,3,
-28,208,3,
-17,232,7,2,206,3,207,3,
-51,255,255,81,3,
-55,209,3,
-17,45,5,
-51,255,255,81,3,3,
-55,210,3,
-17,49,5,
-51,255,255,81,3,3,
-28,211,3,
-17,244,7,2,209,3,210,3,
-51,255,255,81,3,
-55,212,3,
-17,42,7,
-51,255,255,81,3,3,
-28,213,3,
-17,5,8,1,212,3,
-51,255,255,81,3,
-55,214,3,
-17,42,7,
-51,255,255,221,1,3,
-54,215,3,2,
-51,213,3,
-28,216,3,
-17,5,8,1,214,3,
-51,255,255,221,1,
-51,216,3,
-55,217,3,
-17,254,1,
-51,255,255,116,2,3,
-28,218,3,
-17,14,8,1,217,3,
-51,255,255,186,1,
-55,219,3,
-17,35,1,
-51,255,255,186,1,3,
-55,220,3,
-17,164,1,
-51,255,255,186,1,3,
-28,221,3,
-17,19,8,2,219,3,220,3,
-51,255,255,213,0,
-55,222,3,
-17,35,1,
-51,255,255,59,3,3,
-55,223,3,
-17,164,1,
-51,255,255,59,3,3,
-54,224,3,2,
-51,221,3,
-28,225,3,
-17,19,8,2,222,3,223,3,
-51,255,255,223,0,
-51,225,3,134,0,
-185,3,
-191,3,
-127,3,
-189,3,
-194,3,
-162,3,
-156,3,
-152,3,
-171,3,
-121,0,
-64,0,
-86,0,
-207,2,
-205,2,
-61,0,
-83,0,
-71,0,
-89,0,
-213,2,
-78,3,
-207,3,
-165,3,
-159,3,
-145,3,
-177,3,
-84,3,
-108,3,
-96,3,
-102,3,
-90,3,
-180,3,
-168,3,
-198,3,
-201,3,
-138,3,
-210,3,
-121,3,
-183,3,
-134,3,
-114,3,
-118,3,
-204,3,
-124,3,
-174,3,
-81,3,
-105,3,
-93,3,
-99,3,
-87,3,
-111,3,
-154,0,
-10,1,
-55,0,
-77,0,
-169,1,
-223,3,
-36,3,
-39,3,
-49,0,
-51,2,
-155,1,
-162,1,
-175,2,
-96,0,
-102,0,
-183,1,
-218,2,
-223,2,
-95,1,
-97,1,
-134,0,
-109,1,
-159,0,
-116,1,
-44,3,
-125,2,
-148,2,
-99,1,
-74,3,
-59,3,
-56,2,
-113,0,
-93,1,
-91,1,
-123,1,
-148,1,
-79,2,
-102,2,
+28,25,1,
+17,241,4,2,
+51,23,1,
+51,24,1,
+51,255,255,9,3,96,0,
+247,0,
+253,0,
+192,0,
+251,0,
+0,1,
+224,0,
+218,0,
+212,0,
+215,0,
+233,0,
99,0,
-105,0,
-227,2,
-206,1,
+101,0,
+143,0,
+13,1,
227,0,
-204,0,
-54,1,
-174,0,
-181,0,
-174,1,
-209,2,
-202,2,
-5,2,
-142,1,
-128,1,
-132,1,
-126,1,
-130,1,
-93,0,
-217,3,
-46,0,
-190,1,
-199,1,
-144,0,
+221,0,
+206,0,
+209,0,
+239,0,
149,0,
-29,3,
-15,1,
-129,0,
+173,0,
+161,0,
+167,0,
+155,0,
+242,0,
+230,0,
+4,1,
+7,1,
+202,0,
+16,1,
+186,0,
+245,0,
+195,0,
+199,0,
+179,0,
+183,0,
+10,1,
+189,0,
+236,0,
+146,0,
+170,0,
+158,0,
+164,0,
+152,0,
+176,0,
+21,1,
+24,1,
+82,0,
+85,0,
+88,0,
+103,0,
+105,0,
+107,0,
+109,0,
+11,0,
+15,0,
+18,0,
+21,0,
+64,0,
+67,0,
+70,0,
+73,0,
+76,0,
+79,0,
+24,0,
+27,0,
+46,0,
+49,0,
52,0,
-74,0,
-88,1,
-108,0,
-69,1,
-11,3,
+55,0,
58,0,
-80,0,
-229,2,
-46,2,
-139,0,
-101,1,
-144,1,
-136,1,
-140,1,
-134,1,
-138,1,
-214,3,
+61,0,
+112,0,
+3,0,
+7,0,
+91,0,
+94,0,
+97,0,
+41,0,
+29,0,
+33,0,
+31,0,
+18,1,
+115,0,
+119,0,
+122,0,
+125,0,
+128,0,
+136,0,
+140,0,
+130,0,
+133,0,
+43,0,
+35,0,
+39,0,
+37,0,
20,
-29,79,3,
+29,144,0,
2,
52,1,0,0,0,0,1,
44,
13,
-51,255,255,81,3,1,
+51,255,255,150,1,1,
25,
-51,255,255,223,0,0,0,0,0,1,
-29,82,3,
+51,255,255,9,3,0,0,0,0,1,
+29,147,0,
2,
52,1,0,0,0,0,1,
44,
-57,80,3,0,1,
-29,85,3,
+56,145,0,0,1,
+29,150,0,
2,
52,1,0,0,0,0,1,
44,
-57,84,3,0,1,
-29,88,3,
+56,149,0,0,1,
+29,153,0,
2,
52,1,0,0,0,0,1,
44,
1,
-57,86,3,0,0,
+56,151,0,0,0,
1,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,86,3,0,1,3,2,
-57,87,3,0,1,
-29,91,3,
+56,151,0,0,1,3,2,
+56,152,0,0,1,
+29,156,0,
2,
52,1,0,0,0,0,1,
44,
@@ -3769,66 +1308,66 @@ static uint8_t SKSL_INCLUDE_sksl_gpu[] = {11,0,197,8,
1,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,90,3,0,1,3,2,
-57,89,3,0,0,
-57,90,3,0,1,
-29,94,3,
+56,155,0,0,1,3,2,
+56,154,0,0,0,
+56,155,0,0,1,
+29,159,0,
2,
52,1,0,0,0,0,1,
44,
1,
-57,92,3,0,2,
+56,157,0,0,2,
50,
-57,93,3,0,1,3,1,
-29,97,3,
+56,158,0,0,1,3,1,
+29,162,0,
2,
52,1,0,0,0,0,1,
44,
1,
-57,96,3,0,2,
+56,161,0,0,2,
50,
-57,95,3,0,1,3,1,
-29,100,3,
+56,160,0,0,1,3,1,
+29,165,0,
2,
52,1,0,0,0,0,1,
44,
1,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,99,3,0,1,3,2,
-57,98,3,0,1,
-29,103,3,
+56,164,0,0,1,3,2,
+56,163,0,0,1,
+29,168,0,
2,
52,1,0,0,0,0,1,
44,
1,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,101,3,0,1,3,2,
-57,102,3,0,1,
-29,106,3,
+56,166,0,0,1,3,2,
+56,167,0,0,1,
+29,171,0,
2,
52,1,0,0,0,0,1,
44,
1,
1,
50,
-57,105,3,0,1,3,2,
-57,104,3,0,0,
+56,170,0,0,1,3,2,
+56,169,0,0,0,
1,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,104,3,0,1,3,2,
-57,105,3,0,1,
-29,109,3,
+56,169,0,0,1,3,2,
+56,170,0,0,1,
+29,174,0,
2,
52,1,0,0,0,0,1,
44,
@@ -3836,15 +1375,15 @@ static uint8_t SKSL_INCLUDE_sksl_gpu[] = {11,0,197,8,
1,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,108,3,0,1,3,2,
-57,107,3,0,0,
+56,173,0,0,1,3,2,
+56,172,0,0,0,
1,
50,
-57,107,3,0,1,3,2,
-57,108,3,0,1,
-29,112,3,
+56,172,0,0,1,3,2,
+56,173,0,0,1,
+29,177,0,
2,
52,1,0,0,0,0,1,
44,
@@ -3852,92 +1391,92 @@ static uint8_t SKSL_INCLUDE_sksl_gpu[] = {11,0,197,8,
1,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,111,3,0,1,3,2,
-57,110,3,0,0,
+56,176,0,0,1,3,2,
+56,175,0,0,0,
1,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,110,3,0,1,3,2,
-57,111,3,0,1,
-29,115,3,
+56,175,0,0,1,3,2,
+56,176,0,0,1,
+29,180,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,81,3,198,0,2,
+51,255,255,150,1,255,255,1,5,2,
1,
-57,113,3,0,0,
-57,114,3,0,
+56,178,0,0,0,
+56,179,0,0,
25,
-51,255,255,223,0,0,0,128,63,1,
-29,119,3,
+51,255,255,9,3,0,0,128,63,1,
+29,184,0,
2,
52,1,1,0,
-55,226,3,
-17,35,8,
-51,255,255,59,3,2,1,0,
+54,26,1,
+17,5,5,
+51,255,255,232,2,2,1,0,
0,0,2,
-56,226,3,
-51,255,255,59,3,0,
+55,26,1,
+51,255,255,232,2,0,
1,
50,
-57,118,3,0,2,0,1,0,
+56,183,0,0,2,0,1,0,
1,
50,
-57,118,3,0,2,2,3,2,
+56,183,0,0,2,2,3,2,
1,
8,
-51,255,255,59,3,2,
+51,255,255,232,2,2,
50,
-57,117,3,0,1,3,
+56,182,0,0,1,3,
50,
-57,116,3,0,1,3,0,
+56,181,0,0,1,3,0,
27,
-51,255,255,59,3,198,0,2,
+51,255,255,232,2,255,255,1,5,2,
50,
-57,118,3,0,2,2,3,
+56,183,0,0,2,2,3,
25,
-51,255,255,223,0,0,0,0,0,
+51,255,255,9,3,0,0,0,0,
44,
27,
-51,255,255,81,3,194,0,2,
+51,255,255,150,1,255,255,1,5,2,
13,
-51,255,255,81,3,1,
+51,255,255,150,1,1,
25,
-51,255,255,223,0,0,0,128,63,
+51,255,255,9,3,0,0,128,63,
1,
1,
-57,116,3,0,2,
+56,181,0,0,2,
50,
-57,226,3,0,1,0,0,
+56,26,1,0,1,0,0,
1,
-57,117,3,0,2,
+56,182,0,0,2,
50,
-57,226,3,0,1,1,1,
-29,122,3,
+56,26,1,0,1,1,1,
+29,187,0,
2,
52,1,0,0,0,0,1,
44,
1,
-57,120,3,0,2,
-57,121,3,0,1,
-29,125,3,
+56,185,0,0,2,
+56,186,0,0,1,
+29,190,0,
2,
52,1,0,0,0,0,1,
44,
1,
-57,123,3,0,0,
+56,188,0,0,0,
1,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
-57,123,3,0,2,
-57,124,3,0,1,
-29,128,3,
+51,255,255,9,3,0,0,128,63,1,
+56,188,0,0,2,
+56,189,0,0,1,
+29,193,0,
2,
52,1,0,0,0,0,1,
44,
@@ -3945,279 +1484,263 @@ static uint8_t SKSL_INCLUDE_sksl_gpu[] = {11,0,197,8,
1,
1,
25,
-51,255,255,223,0,0,0,0,64,2,
+51,255,255,9,3,0,0,0,64,2,
50,
-57,127,3,0,1,0,20,
+56,192,0,0,1,0,20,
50,
-57,127,3,0,1,1,
+56,192,0,0,1,1,
1,
1,
25,
-51,255,255,223,0,0,0,0,64,2,
+51,255,255,9,3,0,0,0,64,2,
50,
-57,126,3,0,1,0,2,
+56,191,0,0,1,0,2,
50,
-57,127,3,0,1,0,
+56,192,0,0,1,0,
1,
1,
50,
-57,126,3,0,1,1,2,
+56,191,0,0,1,1,2,
50,
-57,127,3,0,1,1,1,
+56,192,0,0,1,1,1,
1,
1,
25,
-51,255,255,223,0,0,0,0,64,2,
+51,255,255,9,3,0,0,0,64,2,
1,
50,
-57,127,3,0,1,1,1,
+56,192,0,0,1,1,1,
50,
-57,127,3,0,1,0,2,
+56,192,0,0,1,0,2,
1,
50,
-57,126,3,0,1,1,1,
+56,191,0,0,1,1,1,
50,
-57,126,3,0,1,0,1,
-29,131,3,
+56,191,0,0,1,0,1,
+29,196,0,
2,
52,1,1,0,
-55,227,3,
-17,41,8,
-51,255,255,81,3,2,1,0,
+54,27,1,
+17,11,5,
+51,255,255,150,1,2,1,0,
0,0,3,
-56,227,3,
-51,255,255,81,3,0,
+55,27,1,
+51,255,255,150,1,0,
8,
-51,255,255,81,3,4,
+51,255,255,150,1,4,
27,
-51,255,255,223,0,128,3,2,
+51,255,255,9,3,193,0,2,
50,
-57,129,3,0,2,0,3,
+56,194,0,0,2,0,3,
50,
-57,130,3,0,2,0,3,
+56,195,0,0,2,0,3,
27,
-51,255,255,223,0,128,3,2,
+51,255,255,9,3,193,0,2,
50,
-57,129,3,0,2,1,3,
+56,194,0,0,2,1,3,
50,
-57,130,3,0,2,1,3,
+56,195,0,0,2,1,3,
27,
-51,255,255,223,0,128,3,2,
+51,255,255,9,3,193,0,2,
50,
-57,129,3,0,2,2,3,
+56,194,0,0,2,2,3,
50,
-57,130,3,0,2,2,3,
+56,195,0,0,2,2,3,
1,
50,
-57,129,3,0,1,3,0,
+56,194,0,0,1,3,0,
1,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,129,3,0,1,3,2,
+56,194,0,0,1,3,2,
50,
-57,130,3,0,1,3,
+56,195,0,0,1,3,
22,
1,
50,
-57,227,3,2,3,0,1,2,22,
+56,27,1,2,3,0,1,2,22,
1,
1,
50,
-57,130,3,0,3,0,1,2,2,
+56,195,0,0,3,0,1,2,2,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,129,3,0,1,3,0,
+56,194,0,0,1,3,0,
1,
50,
-57,129,3,0,3,0,1,2,2,
+56,194,0,0,3,0,1,2,2,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,130,3,0,1,3,
+56,195,0,0,1,3,
44,
-57,227,3,0,1,
-29,136,3,
+56,27,1,0,1,
+29,200,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,81,3,131,3,2,
+51,255,255,150,1,196,0,2,
53,
12,
-51,255,255,253,3,1,
-57,134,3,0,
-57,133,3,0,
-57,132,3,0,
+51,255,255,18,5,1,
+56,199,0,0,
+56,198,0,0,
+56,197,0,0,
53,
12,
-51,255,255,253,3,1,
-57,134,3,0,
-57,132,3,0,
-57,133,3,0,1,
-29,139,3,
+51,255,255,18,5,1,
+56,199,0,0,
+56,197,0,0,
+56,198,0,0,1,
+29,203,0,
2,
52,1,1,0,
-55,228,3,
-17,41,8,
-51,255,255,81,3,2,1,0,
+54,28,1,
+17,11,5,
+51,255,255,150,1,2,1,0,
0,0,3,
-56,228,3,
-51,255,255,81,3,0,
+55,28,1,
+51,255,255,150,1,0,
27,
-51,255,255,81,3,88,3,2,
-57,137,3,0,
-57,138,3,0,
+51,255,255,150,1,153,0,2,
+56,201,0,0,
+56,202,0,0,
22,
1,
50,
-57,228,3,1,3,0,1,2,15,
+56,28,1,1,3,0,1,2,15,
27,
-51,255,255,129,2,217,0,2,
+51,255,255,83,3,255,255,23,5,2,
50,
-57,228,3,0,3,0,1,2,
+56,28,1,0,3,0,1,2,
1,
1,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,138,3,0,1,3,2,
+56,202,0,0,1,3,2,
50,
-57,137,3,0,3,0,1,2,0,
+56,201,0,0,3,0,1,2,0,
50,
-57,138,3,0,3,0,1,2,
+56,202,0,0,3,0,1,2,
44,
-57,228,3,0,1,
-29,143,3,
+56,28,1,0,1,
+29,207,0,
2,
52,1,2,0,
-55,229,3,
-17,35,1,
-51,255,255,81,3,2,
-55,230,3,
-17,164,1,
-51,255,255,129,2,2,2,0,
+54,29,1,
+17,16,0,
+51,255,255,150,1,2,
+54,30,1,
+17,41,0,
+51,255,255,83,3,2,2,0,
0,0,
1,0,4,
-56,229,3,
-51,255,255,81,3,0,
+55,29,1,
+51,255,255,150,1,0,
27,
-51,255,255,81,3,88,3,2,
-57,140,3,0,
-57,141,3,0,
-56,230,3,
-51,255,255,129,2,0,
+51,255,255,150,1,153,0,2,
+56,204,0,0,
+56,205,0,0,
+55,30,1,
+51,255,255,83,3,0,
1,
1,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,141,3,0,1,3,2,
+56,205,0,0,1,3,2,
50,
-57,140,3,0,3,0,1,2,0,
+56,204,0,0,3,0,1,2,0,
50,
-57,141,3,0,3,0,1,2,
+56,205,0,0,3,0,1,2,
22,
1,
50,
-57,229,3,1,3,0,1,2,15,
+56,29,1,1,3,0,1,2,15,
1,
-57,142,3,0,2,
+56,206,0,0,2,
27,
-51,255,255,129,2,194,0,2,
+51,255,255,83,3,255,255,1,5,2,
1,
50,
-57,229,3,0,3,0,1,2,2,
-57,142,3,0,
+56,29,1,0,3,0,1,2,2,
+56,206,0,0,
1,
-57,230,3,0,2,
-57,142,3,0,
+56,30,1,0,2,
+56,206,0,0,
44,
-57,229,3,0,1,
-29,147,3,
+56,29,1,0,1,
+29,210,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,81,3,143,3,3,
-57,144,3,0,
-57,145,3,0,
+51,255,255,150,1,207,0,3,
+56,208,0,0,
+56,209,0,0,
25,
-51,255,255,223,0,0,0,128,63,1,
-29,150,3,
+51,255,255,9,3,0,0,128,63,1,
+29,213,0,
2,
52,1,0,0,0,0,1,
44,
-53,
-45,48,8,
1,
-57,148,3,0,3,
-1,
-57,149,3,0,0,
-25,
-51,255,255,223,0,119,204,43,50,
-1,
-57,148,3,0,3,
-57,149,3,0,1,
-29,154,3,
+56,211,0,0,3,
+56,212,0,0,1,
+29,216,0,
2,
52,1,0,0,0,0,1,
44,
-53,
-45,48,8,
1,
-57,151,3,0,3,
-1,
-57,152,3,0,0,
-25,
-51,255,255,223,0,119,204,43,50,
-1,
-57,151,3,0,3,
-57,152,3,0,1,
-29,157,3,
+56,214,0,0,3,
+56,215,0,0,1,
+29,219,0,
2,
52,1,0,0,0,0,1,
32,0,
1,
50,
-57,156,3,0,1,0,16,
+56,218,0,0,1,0,16,
25,
-51,255,255,223,0,0,0,0,0,
+51,255,255,9,3,0,0,0,0,
2,
52,1,0,0,0,0,1,
44,
1,
50,
-57,155,3,0,1,0,2,
+56,217,0,0,1,0,2,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,156,3,0,1,1,1,
+56,218,0,0,1,1,1,
2,
52,1,1,0,
-55,231,3,
-17,92,8,
-51,255,255,223,0,2,1,0,
+54,31,1,
+17,27,5,
+51,255,255,9,3,2,1,0,
0,0,2,
-56,231,3,
-51,255,255,223,0,0,
+55,31,1,
+51,255,255,9,3,0,
1,
50,
-57,155,3,0,1,1,1,
+56,217,0,0,1,1,1,
50,
-57,155,3,0,1,0,
+56,217,0,0,1,0,
32,0,
1,
-57,231,3,0,16,
+56,31,1,0,16,
25,
-51,255,255,223,0,0,0,0,0,
+51,255,255,9,3,0,0,0,0,
2,
52,1,0,0,0,0,1,
44,
@@ -4225,109 +1748,109 @@ static uint8_t SKSL_INCLUDE_sksl_gpu[] = {11,0,197,8,
1,
1,
50,
-57,155,3,0,1,1,2,
+56,217,0,0,1,1,2,
50,
-57,156,3,0,1,1,0,
+56,218,0,0,1,1,0,
1,
50,
-57,155,3,0,1,0,2,
+56,217,0,0,1,0,2,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,156,3,0,1,1,0,
+56,218,0,0,1,1,0,
1,
50,
-57,156,3,0,1,0,2,
+56,218,0,0,1,0,2,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,155,3,0,1,1,1,
+56,217,0,0,1,1,1,
2,
52,1,0,0,0,0,2,
22,
1,
-57,231,3,1,15,
+56,31,1,1,15,
27,
-51,255,255,223,0,194,0,2,
+51,255,255,9,3,255,255,1,5,2,
50,
-57,156,3,0,1,1,
+56,218,0,0,1,1,
27,
-51,255,255,223,0,150,3,2,
+51,255,255,9,3,213,0,2,
1,
50,
-57,156,3,0,1,0,2,
+56,218,0,0,1,0,2,
50,
-57,155,3,0,1,1,
-57,231,3,0,
+56,217,0,0,1,1,
+56,31,1,0,
44,
1,
1,
1,
-57,231,3,0,2,
+56,31,1,0,2,
50,
-57,155,3,0,1,1,0,
+56,217,0,0,1,1,0,
1,
50,
-57,155,3,0,1,0,2,
+56,217,0,0,1,0,2,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,156,3,0,1,1,0,
+56,218,0,0,1,1,0,
1,
50,
-57,156,3,0,1,0,2,
+56,218,0,0,1,0,2,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,155,3,0,1,1,1,1,1,
-29,160,3,
+56,217,0,0,1,1,1,1,1,
+29,222,0,
2,
52,1,0,0,0,0,1,
44,
8,
-51,255,255,81,3,4,
+51,255,255,150,1,4,
27,
-51,255,255,223,0,157,3,2,
+51,255,255,9,3,219,0,2,
50,
-57,158,3,0,2,0,3,
+56,220,0,0,2,0,3,
50,
-57,159,3,0,2,0,3,
+56,221,0,0,2,0,3,
27,
-51,255,255,223,0,157,3,2,
+51,255,255,9,3,219,0,2,
50,
-57,158,3,0,2,1,3,
+56,220,0,0,2,1,3,
50,
-57,159,3,0,2,1,3,
+56,221,0,0,2,1,3,
27,
-51,255,255,223,0,157,3,2,
+51,255,255,9,3,219,0,2,
50,
-57,158,3,0,2,2,3,
+56,220,0,0,2,2,3,
50,
-57,159,3,0,2,2,3,
+56,221,0,0,2,2,3,
1,
50,
-57,158,3,0,1,3,0,
+56,220,0,0,1,3,0,
1,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,158,3,0,1,3,2,
+56,220,0,0,1,3,2,
50,
-57,159,3,0,1,3,1,
-29,163,3,
+56,221,0,0,1,3,1,
+29,225,0,
2,
52,1,0,0,0,0,1,
32,0,
1,
50,
-57,162,3,0,1,1,16,
+56,224,0,0,1,1,16,
50,
-57,162,3,0,1,0,
+56,224,0,0,1,0,
2,
52,1,0,0,0,0,1,
44,
@@ -4335,308 +1858,308 @@ static uint8_t SKSL_INCLUDE_sksl_gpu[] = {11,0,197,8,
1,
1,
50,
-57,161,3,0,1,1,2,
+56,223,0,0,1,1,2,
50,
-57,162,3,0,1,1,0,
+56,224,0,0,1,1,0,
1,
50,
-57,161,3,0,1,0,2,
+56,223,0,0,1,0,2,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,162,3,0,1,1,0,
+56,224,0,0,1,1,0,
1,
50,
-57,162,3,0,1,0,2,
+56,224,0,0,1,0,2,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,161,3,0,1,1,1,
+56,223,0,0,1,1,1,
32,0,
1,
50,
-57,161,3,0,1,0,16,
+56,223,0,0,1,0,16,
25,
-51,255,255,223,0,0,0,0,0,
+51,255,255,9,3,0,0,0,0,
2,
52,1,0,0,0,0,1,
44,
1,
50,
-57,162,3,0,1,0,2,
+56,224,0,0,1,0,2,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,161,3,0,1,1,1,
+56,223,0,0,1,1,1,
2,
52,1,1,0,
-55,232,3,
-17,92,8,
-51,255,255,223,0,2,1,0,
+54,32,1,
+17,27,5,
+51,255,255,9,3,2,1,0,
0,0,2,
-56,232,3,
-51,255,255,223,0,0,
+55,32,1,
+51,255,255,9,3,0,
27,
-51,255,255,223,0,217,0,2,
+51,255,255,9,3,255,255,23,5,2,
25,
-51,255,255,223,0,0,0,0,0,
+51,255,255,9,3,0,0,0,0,
1,
50,
-57,162,3,0,1,1,1,
+56,224,0,0,1,1,1,
27,
-51,255,255,223,0,150,3,2,
+51,255,255,9,3,213,0,2,
1,
1,
50,
-57,162,3,0,1,1,1,
+56,224,0,0,1,1,1,
50,
-57,162,3,0,1,0,2,
+56,224,0,0,1,0,2,
50,
-57,161,3,0,1,1,
+56,223,0,0,1,1,
50,
-57,161,3,0,1,0,
+56,223,0,0,1,0,
44,
1,
1,
1,
-57,232,3,0,2,
+56,32,1,0,2,
50,
-57,161,3,0,1,1,0,
+56,223,0,0,1,1,0,
1,
50,
-57,161,3,0,1,0,2,
+56,223,0,0,1,0,2,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,162,3,0,1,1,0,
+56,224,0,0,1,1,0,
1,
50,
-57,162,3,0,1,0,2,
+56,224,0,0,1,0,2,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,161,3,0,1,1,1,1,
-29,166,3,
+56,223,0,0,1,1,1,1,
+29,228,0,
2,
52,1,0,0,0,0,1,
44,
8,
-51,255,255,81,3,4,
+51,255,255,150,1,4,
27,
-51,255,255,223,0,163,3,2,
+51,255,255,9,3,225,0,2,
50,
-57,164,3,0,2,0,3,
+56,226,0,0,2,0,3,
50,
-57,165,3,0,2,0,3,
+56,227,0,0,2,0,3,
27,
-51,255,255,223,0,163,3,2,
+51,255,255,9,3,225,0,2,
50,
-57,164,3,0,2,1,3,
+56,226,0,0,2,1,3,
50,
-57,165,3,0,2,1,3,
+56,227,0,0,2,1,3,
27,
-51,255,255,223,0,163,3,2,
+51,255,255,9,3,225,0,2,
50,
-57,164,3,0,2,2,3,
+56,226,0,0,2,2,3,
50,
-57,165,3,0,2,2,3,
+56,227,0,0,2,2,3,
1,
50,
-57,164,3,0,1,3,0,
+56,226,0,0,1,3,0,
1,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,164,3,0,1,3,2,
+56,226,0,0,1,3,2,
50,
-57,165,3,0,1,3,1,
-29,169,3,
+56,227,0,0,1,3,1,
+29,231,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,81,3,131,3,2,
-57,168,3,0,
-57,167,3,0,1,
-29,172,3,
+51,255,255,150,1,196,0,2,
+56,230,0,0,
+56,229,0,0,1,
+29,234,0,
2,
52,1,0,0,0,0,1,
32,0,
1,
1,
25,
-51,255,255,223,0,0,0,0,64,2,
+51,255,255,9,3,0,0,0,64,2,
50,
-57,170,3,0,1,0,20,
+56,232,0,0,1,0,20,
50,
-57,170,3,0,1,1,
+56,232,0,0,1,1,
2,
52,1,0,0,0,0,1,
44,
1,
1,
27,
-51,255,255,223,0,150,3,2,
+51,255,255,9,3,213,0,2,
1,
1,
50,
-57,171,3,0,1,0,2,
+56,233,0,0,1,0,2,
50,
-57,171,3,0,1,0,2,
+56,233,0,0,1,0,2,
1,
50,
-57,170,3,0,1,1,1,
+56,232,0,0,1,1,1,
1,
25,
-51,255,255,223,0,0,0,0,64,2,
+51,255,255,9,3,0,0,0,64,2,
50,
-57,170,3,0,1,0,
+56,232,0,0,1,0,
50,
-57,171,3,0,1,1,0,
+56,233,0,0,1,1,0,
1,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,171,3,0,1,1,2,
+56,233,0,0,1,1,2,
50,
-57,170,3,0,1,0,0,
+56,232,0,0,1,0,0,
1,
50,
-57,171,3,0,1,0,2,
+56,233,0,0,1,0,2,
1,
1,
42,1,
50,
-57,170,3,0,1,1,0,
+56,232,0,0,1,1,0,
1,
25,
-51,255,255,223,0,0,0,0,64,2,
+51,255,255,9,3,0,0,0,64,2,
50,
-57,170,3,0,1,0,0,
+56,232,0,0,1,0,0,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
32,0,
1,
1,
25,
-51,255,255,223,0,0,0,128,64,2,
+51,255,255,9,3,0,0,128,64,2,
50,
-57,171,3,0,1,0,20,
+56,233,0,0,1,0,20,
50,
-57,171,3,0,1,1,
+56,233,0,0,1,1,
2,
52,1,4,0,
-55,233,3,
-17,98,8,
-51,255,255,223,0,2,
-55,234,3,
-17,103,8,
-51,255,255,223,0,2,
-55,235,3,
-17,108,8,
-51,255,255,223,0,2,
-55,236,3,
-17,114,8,
-51,255,255,223,0,2,4,0,
+54,33,1,
+17,33,5,
+51,255,255,9,3,2,
+54,34,1,
+17,38,5,
+51,255,255,9,3,2,
+54,35,1,
+17,43,5,
+51,255,255,9,3,2,
+54,36,1,
+17,49,5,
+51,255,255,9,3,2,4,0,
1,0,
0,0,
3,0,
2,0,5,
-56,233,3,
-51,255,255,223,0,0,
+55,33,1,
+51,255,255,9,3,0,
1,
50,
-57,171,3,0,1,0,2,
+56,233,0,0,1,0,2,
50,
-57,171,3,0,1,0,
-56,234,3,
-51,255,255,223,0,0,
+56,233,0,0,1,0,
+55,34,1,
+51,255,255,9,3,0,
1,
-57,233,3,0,2,
+56,33,1,0,2,
50,
-57,171,3,0,1,0,
-56,235,3,
-51,255,255,223,0,0,
+56,233,0,0,1,0,
+55,35,1,
+51,255,255,9,3,0,
1,
50,
-57,171,3,0,1,1,2,
+56,233,0,0,1,1,2,
50,
-57,171,3,0,1,1,
-56,236,3,
-51,255,255,223,0,0,
+56,233,0,0,1,1,
+55,36,1,
+51,255,255,9,3,0,
1,
-57,235,3,0,2,
+56,35,1,0,2,
50,
-57,171,3,0,1,1,
+56,233,0,0,1,1,
44,
27,
-51,255,255,223,0,150,3,2,
+51,255,255,9,3,213,0,2,
1,
1,
1,
1,
-57,235,3,0,2,
+56,35,1,0,2,
1,
50,
-57,170,3,0,1,0,1,
+56,232,0,0,1,0,1,
1,
50,
-57,171,3,0,1,0,2,
+56,233,0,0,1,0,2,
1,
1,
1,
25,
-51,255,255,223,0,0,0,64,64,2,
+51,255,255,9,3,0,0,64,64,2,
50,
-57,170,3,0,1,1,1,
+56,232,0,0,1,1,1,
1,
25,
-51,255,255,223,0,0,0,192,64,2,
+51,255,255,9,3,0,0,192,64,2,
50,
-57,170,3,0,1,0,1,
+56,232,0,0,1,0,1,
25,
-51,255,255,223,0,0,0,128,63,0,
+51,255,255,9,3,0,0,128,63,0,
1,
1,
1,
25,
-51,255,255,223,0,0,0,64,65,2,
+51,255,255,9,3,0,0,64,65,2,
50,
-57,171,3,0,1,1,2,
-57,233,3,0,2,
+56,233,0,0,1,1,2,
+56,33,1,0,2,
1,
50,
-57,170,3,0,1,1,1,
+56,232,0,0,1,1,1,
1,
25,
-51,255,255,223,0,0,0,0,64,2,
+51,255,255,9,3,0,0,0,64,2,
50,
-57,170,3,0,1,0,1,
+56,232,0,0,1,0,1,
1,
1,
25,
-51,255,255,223,0,0,0,128,65,2,
-57,234,3,0,2,
+51,255,255,9,3,0,0,128,65,2,
+56,34,1,0,2,
1,
50,
-57,170,3,0,1,1,1,
+56,232,0,0,1,1,1,
1,
25,
-51,255,255,223,0,0,0,0,64,2,
+51,255,255,9,3,0,0,0,64,2,
50,
-57,170,3,0,1,0,1,
+56,232,0,0,1,0,1,
1,
-57,236,3,0,2,
+56,36,1,0,2,
50,
-57,170,3,0,1,0,
-57,235,3,0,1,
+56,232,0,0,1,0,
+56,35,1,0,1,
2,
52,1,0,0,0,0,1,
44,
@@ -4645,647 +2168,597 @@ static uint8_t SKSL_INCLUDE_sksl_gpu[] = {11,0,197,8,
1,
1,
50,
-57,171,3,0,1,0,2,
+56,233,0,0,1,0,2,
1,
1,
50,
-57,170,3,0,1,1,1,
+56,232,0,0,1,1,1,
1,
25,
-51,255,255,223,0,0,0,0,64,2,
+51,255,255,9,3,0,0,0,64,2,
50,
-57,170,3,0,1,0,0,
+56,232,0,0,1,0,0,
25,
-51,255,255,223,0,0,0,128,63,0,
+51,255,255,9,3,0,0,128,63,0,
50,
-57,170,3,0,1,0,1,
+56,232,0,0,1,0,1,
1,
27,
-51,255,255,223,0,110,0,1,
+51,255,255,9,3,255,255,55,5,1,
1,
50,
-57,171,3,0,1,1,2,
+56,233,0,0,1,1,2,
50,
-57,171,3,0,1,0,2,
+56,233,0,0,1,0,2,
1,
50,
-57,170,3,0,1,1,1,
+56,232,0,0,1,1,1,
1,
25,
-51,255,255,223,0,0,0,0,64,2,
+51,255,255,9,3,0,0,0,64,2,
50,
-57,170,3,0,1,0,1,
+56,232,0,0,1,0,1,
1,
50,
-57,171,3,0,1,1,2,
+56,233,0,0,1,1,2,
50,
-57,170,3,0,1,0,1,1,
-29,175,3,
+56,232,0,0,1,0,1,1,
+29,237,0,
2,
52,1,0,0,0,0,1,
44,
53,
1,
50,
-57,174,3,0,1,3,16,
+56,236,0,0,1,3,16,
25,
-51,255,255,223,0,0,0,0,0,
-57,173,3,0,
+51,255,255,9,3,0,0,0,0,
+56,235,0,0,
8,
-51,255,255,81,3,4,
+51,255,255,150,1,4,
27,
-51,255,255,223,0,172,3,2,
+51,255,255,9,3,234,0,2,
50,
-57,173,3,0,2,0,3,
+56,235,0,0,2,0,3,
50,
-57,174,3,0,2,0,3,
+56,236,0,0,2,0,3,
27,
-51,255,255,223,0,172,3,2,
+51,255,255,9,3,234,0,2,
50,
-57,173,3,0,2,1,3,
+56,235,0,0,2,1,3,
50,
-57,174,3,0,2,1,3,
+56,236,0,0,2,1,3,
27,
-51,255,255,223,0,172,3,2,
+51,255,255,9,3,234,0,2,
50,
-57,173,3,0,2,2,3,
+56,235,0,0,2,2,3,
50,
-57,174,3,0,2,2,3,
+56,236,0,0,2,2,3,
1,
50,
-57,173,3,0,1,3,0,
+56,235,0,0,1,3,0,
1,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,173,3,0,1,3,2,
+56,235,0,0,1,3,2,
50,
-57,174,3,0,1,3,1,
-29,178,3,
+56,236,0,0,1,3,1,
+29,240,0,
2,
52,1,0,0,0,0,1,
44,
8,
-51,255,255,81,3,2,
+51,255,255,150,1,2,
1,
1,
50,
-57,176,3,0,3,0,1,2,0,
+56,238,0,0,3,0,1,2,0,
50,
-57,177,3,0,3,0,1,2,1,
+56,239,0,0,3,0,1,2,1,
1,
25,
-51,255,255,223,0,0,0,0,64,2,
+51,255,255,9,3,0,0,0,64,2,
27,
-51,255,255,129,2,194,0,2,
+51,255,255,83,3,255,255,1,5,2,
1,
50,
-57,176,3,0,3,0,1,2,2,
+56,238,0,0,3,0,1,2,2,
50,
-57,177,3,0,1,3,
+56,239,0,0,1,3,
1,
50,
-57,177,3,0,3,0,1,2,2,
+56,239,0,0,3,0,1,2,2,
50,
-57,176,3,0,1,3,
+56,238,0,0,1,3,
1,
50,
-57,176,3,0,1,3,0,
+56,238,0,0,1,3,0,
1,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,176,3,0,1,3,2,
+56,238,0,0,1,3,2,
50,
-57,177,3,0,1,3,1,
-29,181,3,
+56,239,0,0,1,3,1,
+29,243,0,
2,
52,1,0,0,0,0,1,
44,
8,
-51,255,255,81,3,2,
+51,255,255,150,1,2,
1,
1,
50,
-57,180,3,0,3,0,1,2,0,
+56,242,0,0,3,0,1,2,0,
50,
-57,179,3,0,3,0,1,2,1,
+56,241,0,0,3,0,1,2,1,
1,
1,
25,
-51,255,255,223,0,0,0,0,64,2,
+51,255,255,9,3,0,0,0,64,2,
50,
-57,180,3,0,3,0,1,2,2,
+56,242,0,0,3,0,1,2,2,
50,
-57,179,3,0,3,0,1,2,
+56,241,0,0,3,0,1,2,
1,
50,
-57,179,3,0,1,3,0,
+56,241,0,0,1,3,0,
1,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,179,3,0,1,3,2,
+56,241,0,0,1,3,2,
50,
-57,180,3,0,1,3,1,
-29,184,3,
+56,242,0,0,1,3,1,
+29,246,0,
2,
52,1,0,0,0,0,1,
44,
8,
-51,255,255,81,3,2,
+51,255,255,150,1,2,
1,
1,
1,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,182,3,0,1,3,2,
+56,244,0,0,1,3,2,
50,
-57,183,3,0,3,0,1,2,0,
+56,245,0,0,3,0,1,2,0,
1,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,183,3,0,1,3,2,
+56,245,0,0,1,3,2,
50,
-57,182,3,0,3,0,1,2,0,
+56,244,0,0,3,0,1,2,0,
1,
50,
-57,182,3,0,3,0,1,2,2,
+56,244,0,0,3,0,1,2,2,
50,
-57,183,3,0,3,0,1,2,
+56,245,0,0,3,0,1,2,
1,
50,
-57,182,3,0,1,3,0,
+56,244,0,0,1,3,0,
1,
1,
25,
-51,255,255,223,0,0,0,128,63,1,
+51,255,255,9,3,0,0,128,63,1,
50,
-57,182,3,0,1,3,2,
+56,244,0,0,1,3,2,
50,
-57,183,3,0,1,3,1,
-29,186,3,
+56,245,0,0,1,3,1,
+29,248,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,223,0,164,1,2,
+51,255,255,9,3,255,255,60,5,2,
8,
-51,255,255,129,2,3,
+51,255,255,83,3,3,
25,
-51,255,255,223,0,154,153,153,62,
+51,255,255,9,3,154,153,153,62,
25,
-51,255,255,223,0,61,10,23,63,
+51,255,255,9,3,61,10,23,63,
25,
-51,255,255,223,0,174,71,225,61,
-57,185,3,0,1,
-29,190,3,
+51,255,255,9,3,174,71,225,61,
+56,247,0,0,1,
+29,252,0,
2,
52,1,4,0,
-55,237,3,
-17,120,8,
-51,255,255,223,0,2,
-55,238,3,
-17,41,8,
-51,255,255,129,2,2,
-55,239,3,
-17,124,8,
-51,255,255,223,0,2,
-55,240,3,
-17,132,8,
-51,255,255,223,0,2,4,0,
+54,37,1,
+17,64,5,
+51,255,255,9,3,2,
+54,38,1,
+17,11,5,
+51,255,255,83,3,2,
+54,39,1,
+17,68,5,
+51,255,255,9,3,2,
+54,40,1,
+17,76,5,
+51,255,255,9,3,2,4,0,
0,0,
3,0,
2,0,
1,0,7,
-56,237,3,
-51,255,255,223,0,0,
+55,37,1,
+51,255,255,9,3,0,
27,
-51,255,255,223,0,186,3,1,
-57,189,3,0,
-56,238,3,
-51,255,255,129,2,0,
+51,255,255,9,3,248,0,1,
+56,251,0,0,
+55,38,1,
+51,255,255,83,3,0,
1,
1,
-57,237,3,0,1,
+56,37,1,0,1,
27,
-51,255,255,223,0,186,3,1,
-57,187,3,0,0,
-57,187,3,0,
-56,239,3,
-51,255,255,223,0,0,
+51,255,255,9,3,248,0,1,
+56,249,0,0,0,
+56,249,0,0,
+55,39,1,
+51,255,255,9,3,0,
27,
-51,255,255,223,0,194,0,2,
+51,255,255,9,3,255,255,1,5,2,
27,
-51,255,255,223,0,194,0,2,
+51,255,255,9,3,255,255,1,5,2,
50,
-57,238,3,0,1,0,
+56,38,1,0,1,0,
50,
-57,238,3,0,1,1,
+56,38,1,0,1,1,
50,
-57,238,3,0,1,2,
-56,240,3,
-51,255,255,223,0,0,
+56,38,1,0,1,2,
+55,40,1,
+51,255,255,9,3,0,
27,
-51,255,255,223,0,217,0,2,
+51,255,255,9,3,255,255,23,5,2,
27,
-51,255,255,223,0,217,0,2,
+51,255,255,9,3,255,255,23,5,2,
50,
-57,238,3,0,1,0,
+56,38,1,0,1,0,
50,
-57,238,3,0,1,1,
+56,38,1,0,1,1,
50,
-57,238,3,0,1,2,
+56,38,1,0,1,2,
32,0,
1,
1,
-57,239,3,0,18,
+56,39,1,0,18,
25,
-51,255,255,223,0,0,0,0,0,8,
+51,255,255,9,3,0,0,0,0,8,
1,
-57,237,3,0,17,
-57,239,3,0,
+56,37,1,0,17,
+56,39,1,0,
2,
52,1,0,0,0,0,1,
22,
1,
-57,238,3,1,15,
+56,38,1,1,15,
1,
-57,237,3,0,0,
+56,37,1,0,0,
1,
1,
-57,238,3,0,1,
-57,237,3,0,2,
+56,38,1,0,1,
+56,37,1,0,2,
27,
-51,255,255,223,0,150,3,2,
-57,237,3,0,
+51,255,255,9,3,213,0,2,
+56,37,1,0,
1,
-57,237,3,0,1,
-57,239,3,0,1,
-58,
+56,37,1,0,1,
+56,39,1,0,1,
+57,
32,0,
1,
1,
-57,240,3,0,19,
-57,188,3,0,8,
+56,40,1,0,19,
+56,250,0,0,8,
1,
-57,240,3,0,17,
-57,237,3,0,
+56,40,1,0,17,
+56,37,1,0,
2,
52,1,0,0,0,0,1,
22,
1,
-57,238,3,1,15,
+56,38,1,1,15,
1,
-57,237,3,0,0,
+56,37,1,0,0,
27,
-51,255,255,129,2,154,3,2,
+51,255,255,83,3,216,0,2,
1,
1,
-57,238,3,0,1,
-57,237,3,0,2,
+56,38,1,0,1,
+56,37,1,0,2,
1,
-57,188,3,0,1,
-57,237,3,0,
+56,250,0,0,1,
+56,37,1,0,
1,
-57,240,3,0,1,
-57,237,3,0,1,
-58,
+56,40,1,0,1,
+56,37,1,0,1,
+57,
44,
-57,238,3,0,1,
-29,192,3,
+56,38,1,0,1,
+29,254,0,
2,
52,1,0,0,0,0,1,
44,
1,
27,
-51,255,255,223,0,217,0,2,
+51,255,255,9,3,255,255,23,5,2,
27,
-51,255,255,223,0,217,0,2,
+51,255,255,9,3,255,255,23,5,2,
50,
-57,191,3,0,1,0,
+56,253,0,0,1,0,
50,
-57,191,3,0,1,1,
+56,253,0,0,1,1,
50,
-57,191,3,0,1,2,1,
+56,253,0,0,1,2,1,
27,
-51,255,255,223,0,194,0,2,
+51,255,255,9,3,255,255,1,5,2,
27,
-51,255,255,223,0,194,0,2,
+51,255,255,9,3,255,255,1,5,2,
50,
-57,191,3,0,1,0,
+56,253,0,0,1,0,
50,
-57,191,3,0,1,1,
+56,253,0,0,1,1,
50,
-57,191,3,0,1,2,1,
-29,195,3,
+56,253,0,0,1,2,1,
+29,1,1,
2,
52,1,2,0,
-55,241,3,
-17,140,8,
-51,255,255,223,0,2,
-55,242,3,
-17,143,8,
-51,255,255,223,0,2,2,0,
+54,41,1,
+17,84,5,
+51,255,255,9,3,2,
+54,42,1,
+17,87,5,
+51,255,255,9,3,2,2,0,
0,0,
1,0,3,
-56,241,3,
-51,255,255,223,0,0,
+55,41,1,
+51,255,255,9,3,0,
27,
-51,255,255,223,0,194,0,2,
+51,255,255,9,3,255,255,1,5,2,
27,
-51,255,255,223,0,194,0,2,
+51,255,255,9,3,255,255,1,5,2,
50,
-57,193,3,0,1,0,
+56,255,0,0,1,0,
50,
-57,193,3,0,1,1,
+56,255,0,0,1,1,
50,
-57,193,3,0,1,2,
-56,242,3,
-51,255,255,223,0,0,
+56,255,0,0,1,2,
+55,42,1,
+51,255,255,9,3,0,
27,
-51,255,255,223,0,217,0,2,
+51,255,255,9,3,255,255,23,5,2,
27,
-51,255,255,223,0,217,0,2,
+51,255,255,9,3,255,255,23,5,2,
50,
-57,193,3,0,1,0,
+56,255,0,0,1,0,
50,
-57,193,3,0,1,1,
+56,255,0,0,1,1,
50,
-57,193,3,0,1,2,
+56,255,0,0,1,2,
44,
53,
1,
-57,242,3,0,19,
-57,241,3,0,
+56,42,1,0,19,
+56,41,1,0,
1,
1,
1,
-57,193,3,0,1,
-57,241,3,0,2,
+56,255,0,0,1,
+56,41,1,0,2,
27,
-51,255,255,223,0,192,3,1,
-57,194,3,0,3,
+51,255,255,9,3,254,0,1,
+56,0,1,0,3,
1,
-57,242,3,0,1,
-57,241,3,0,
+56,42,1,0,1,
+56,41,1,0,
13,
-51,255,255,129,2,1,
+51,255,255,83,3,1,
25,
-51,255,255,223,0,0,0,0,0,1,
-29,199,3,
+51,255,255,9,3,0,0,0,0,1,
+29,5,1,
2,
52,1,5,0,
-55,243,3,
-17,83,7,
-51,255,255,223,0,2,
-55,244,3,
-17,146,8,
-51,255,255,129,2,2,
-55,245,3,
-17,150,8,
-51,255,255,129,2,2,
-55,246,3,
-17,154,8,
-51,255,255,129,2,2,
-55,247,3,
-17,217,2,
-51,255,255,129,2,2,5,0,
+54,43,1,
+17,58,4,
+51,255,255,9,3,2,
+54,44,1,
+17,90,5,
+51,255,255,83,3,2,
+54,45,1,
+17,94,5,
+51,255,255,83,3,2,
+54,46,1,
+17,98,5,
+51,255,255,83,3,2,
+54,47,1,
+17,100,5,
+51,255,255,83,3,2,5,0,
0,0,
2,0,
3,0,
4,0,
1,0,7,
-56,243,3,
-51,255,255,223,0,0,
+55,43,1,
+51,255,255,9,3,0,
1,
50,
-57,197,3,0,1,3,2,
+56,3,1,0,1,3,2,
50,
-57,196,3,0,1,3,
-56,244,3,
-51,255,255,129,2,0,
+56,2,1,0,1,3,
+55,44,1,
+51,255,255,83,3,0,
1,
50,
-57,196,3,0,3,0,1,2,2,
+56,2,1,0,3,0,1,2,2,
50,
-57,197,3,0,1,3,
-56,245,3,
-51,255,255,129,2,0,
+56,3,1,0,1,3,
+55,45,1,
+51,255,255,83,3,0,
1,
50,
-57,197,3,0,3,0,1,2,2,
+56,3,1,0,3,0,1,2,2,
50,
-57,196,3,0,1,3,
-56,246,3,
-51,255,255,129,2,0,
+56,2,1,0,1,3,
+55,46,1,
+51,255,255,83,3,0,
53,
12,
-51,255,255,253,3,1,
+51,255,255,18,5,1,
50,
-57,198,3,0,1,0,
-57,245,3,0,
-57,244,3,0,
-56,247,3,
-51,255,255,129,2,0,
+56,4,1,0,1,0,
+56,45,1,0,
+56,44,1,0,
+55,47,1,
+51,255,255,83,3,0,
53,
12,
-51,255,255,253,3,1,
+51,255,255,18,5,1,
50,
-57,198,3,0,1,0,
-57,244,3,0,
-57,245,3,0,
+56,4,1,0,1,0,
+56,44,1,0,
+56,45,1,0,
32,0,
12,
-51,255,255,253,3,1,
+51,255,255,18,5,1,
50,
-57,198,3,0,1,1,
+56,4,1,0,1,1,
2,
52,1,0,0,0,0,2,
22,
1,
-57,246,3,1,15,
+56,46,1,1,15,
27,
-51,255,255,129,2,195,3,2,
-57,246,3,0,
-57,247,3,0,
+51,255,255,83,3,1,1,2,
+56,46,1,0,
+56,47,1,0,
22,
1,
-57,247,3,1,15,
-57,245,3,0,1,
-58,
+56,47,1,1,15,
+56,45,1,0,1,
+57,
44,
8,
-51,255,255,81,3,2,
+51,255,255,150,1,2,
1,
1,
1,
1,
27,
-51,255,255,129,2,190,3,3,
-57,246,3,0,
-57,243,3,0,
-57,247,3,0,0,
+51,255,255,83,3,252,0,3,
+56,46,1,0,
+56,43,1,0,
+56,47,1,0,0,
50,
-57,197,3,0,3,0,1,2,1,
-57,245,3,0,0,
+56,3,1,0,3,0,1,2,1,
+56,45,1,0,0,
50,
-57,196,3,0,3,0,1,2,1,
-57,244,3,0,
+56,2,1,0,3,0,1,2,1,
+56,44,1,0,
1,
1,
50,
-57,196,3,0,1,3,0,
+56,2,1,0,1,3,0,
50,
-57,197,3,0,1,3,1,
-57,243,3,0,1,
-29,202,3,
+56,3,1,0,1,3,1,
+56,43,1,0,1,
+29,8,1,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,81,3,199,3,3,
-57,200,3,0,
-57,201,3,0,
+51,255,255,150,1,5,1,3,
+56,6,1,0,
+56,7,1,0,
8,
-51,255,255,59,3,2,
+51,255,255,232,2,2,
25,
-51,255,255,223,0,0,0,0,0,
+51,255,255,9,3,0,0,0,0,
25,
-51,255,255,223,0,0,0,128,63,1,
-29,205,3,
+51,255,255,9,3,0,0,128,63,1,
+29,11,1,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,81,3,199,3,3,
-57,203,3,0,
-57,204,3,0,
+51,255,255,150,1,5,1,3,
+56,9,1,0,
+56,10,1,0,
13,
-51,255,255,59,3,1,
+51,255,255,232,2,1,
25,
-51,255,255,223,0,0,0,128,63,1,
-29,208,3,
+51,255,255,9,3,0,0,128,63,1,
+29,14,1,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,81,3,199,3,3,
-57,206,3,0,
-57,207,3,0,
+51,255,255,150,1,5,1,3,
+56,12,1,0,
+56,13,1,0,
13,
-51,255,255,59,3,1,
+51,255,255,232,2,1,
25,
-51,255,255,223,0,0,0,0,0,1,
-29,211,3,
+51,255,255,9,3,0,0,0,0,1,
+29,17,1,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,81,3,199,3,3,
-57,209,3,0,
-57,210,3,0,
+51,255,255,150,1,5,1,3,
+56,15,1,0,
+56,16,1,0,
8,
-51,255,255,59,3,2,
-25,
-51,255,255,223,0,0,0,128,63,
-25,
-51,255,255,223,0,0,0,0,0,1,
-29,213,3,
-2,
-52,1,0,0,0,0,1,
-44,
-8,
-51,255,255,81,3,2,
-1,
-50,
-57,212,3,0,3,0,1,2,3,
-27,
-51,255,255,223,0,217,0,2,
-50,
-57,212,3,0,1,3,
+51,255,255,232,2,2,
25,
-51,255,255,223,0,23,183,209,56,
-50,
-57,212,3,0,1,3,1,
-29,216,3,
-2,
-52,1,0,0,0,0,1,
-44,
-8,
-51,255,255,221,1,2,
-1,
-50,
-57,214,3,0,3,0,1,2,3,
-27,
-51,255,255,213,0,209,0,2,
-50,
-57,214,3,0,1,3,
+51,255,255,9,3,0,0,128,63,
25,
-51,255,255,213,0,23,183,209,56,
-50,
-57,214,3,0,1,3,1,
-29,218,3,
+51,255,255,9,3,0,0,0,0,1,
+29,19,1,
2,
52,1,0,0,0,0,1,
44,
1,
50,
-57,217,3,0,2,0,1,3,
+56,18,1,0,2,0,1,3,
50,
-57,217,3,0,1,2,1,
-29,221,3,
+56,18,1,0,1,2,1,
+29,22,1,
2,
52,1,0,0,0,0,1,
44,
-53,
-45,156,8,
-27,
-51,255,255,213,0,50,2,1,
-8,
-51,255,255,182,8,2,
-57,219,3,0,
-57,220,3,0,
1,
1,
50,
-57,219,3,0,1,0,2,
+56,20,1,0,1,0,2,
50,
-57,220,3,0,1,1,1,
+56,21,1,0,1,1,1,
1,
50,
-57,219,3,0,1,1,2,
+56,20,1,0,1,1,2,
50,
-57,220,3,0,1,0,1,
-29,225,3,
+56,21,1,0,1,0,1,
+29,25,1,
2,
52,1,0,0,0,0,1,
44,
-53,
-45,156,8,
-27,
-51,255,255,223,0,53,2,1,
-8,
-51,255,255,191,8,2,
-57,222,3,0,
-57,223,3,0,
1,
1,
50,
-57,222,3,0,1,0,2,
+56,23,1,0,1,0,2,
50,
-57,223,3,0,1,1,1,
+56,24,1,0,1,1,1,
1,
50,
-57,222,3,0,1,1,2,
+56,23,1,0,1,1,2,
50,
-57,223,3,0,1,0,1,
+56,24,1,0,1,0,1,
21,};
static constexpr size_t SKSL_INCLUDE_sksl_gpu_LENGTH = sizeof(SKSL_INCLUDE_sksl_gpu);
diff --git a/chromium/third_party/skia/src/sksl/generated/sksl_graphite_frag.dehydrated.sksl b/chromium/third_party/skia/src/sksl/generated/sksl_graphite_frag.dehydrated.sksl
index 612920e1769..10142aa225c 100644
--- a/chromium/third_party/skia/src/sksl/generated/sksl_graphite_frag.dehydrated.sksl
+++ b/chromium/third_party/skia/src/sksl/generated/sksl_graphite_frag.dehydrated.sksl
@@ -1,10 +1,13 @@
-static uint8_t SKSL_INCLUDE_sksl_graphite_frag[] = {11,0,196,6,
+static constexpr uint8_t SKSL_INCLUDE_sksl_graphite_frag[] = {14,0,12,6,
8,115,107,95,101,114,114,111,114,
5,104,97,108,102,52,
+5,99,111,108,111,114,
+14,115,107,95,112,97,115,115,116,104,114,111,117,103,104,
10,99,111,108,111,114,80,97,114,97,109,
6,102,108,111,97,116,52,
15,115,107,95,115,111,108,105,100,95,115,104,97,100,101,114,
-11,108,111,99,97,108,77,97,116,114,105,120,
+18,95,115,107,65,110,111,110,121,109,111,117,115,80,97,114,97,109,48,
+18,95,115,107,65,110,111,110,121,109,111,117,115,80,97,114,97,109,49,
8,102,108,111,97,116,52,120,52,
11,99,104,105,108,100,82,101,115,117,108,116,
22,115,107,95,108,111,99,97,108,95,109,97,116,114,105,120,95,115,104,97,100,101,114,
@@ -16,7 +19,8 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_frag[] = {11,0,196,6,
3,109,97,120,
10,110,111,114,109,97,108,105,122,101,114,
5,36,116,105,108,101,
-9,100,101,118,50,76,111,99,97,108,
+6,99,111,111,114,100,115,
+8,112,114,101,76,111,99,97,108,
6,115,117,98,115,101,116,
3,116,109,88,
3,116,109,89,
@@ -48,33 +52,35 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_frag[] = {11,0,196,6,
12,114,97,100,105,117,115,48,80,97,114,97,109,
12,114,97,100,105,117,115,49,80,97,114,97,109,
20,36,99,111,110,105,99,97,108,95,103,114,97,100,95,108,97,121,111,117,116,
-8,112,97,100,100,105,110,103,48,
-8,112,97,100,100,105,110,103,49,
-8,112,97,100,100,105,110,103,50,
23,115,107,95,108,105,110,101,97,114,95,103,114,97,100,95,52,95,115,104,97,100,101,114,
23,115,107,95,108,105,110,101,97,114,95,103,114,97,100,95,56,95,115,104,97,100,101,114,
23,115,107,95,114,97,100,105,97,108,95,103,114,97,100,95,52,95,115,104,97,100,101,114,
23,115,107,95,114,97,100,105,97,108,95,103,114,97,100,95,56,95,115,104,97,100,101,114,
22,115,107,95,115,119,101,101,112,95,103,114,97,100,95,52,95,115,104,97,100,101,114,
22,115,107,95,115,119,101,101,112,95,103,114,97,100,95,56,95,115,104,97,100,101,114,
-7,112,97,100,100,105,110,103,
24,115,107,95,99,111,110,105,99,97,108,95,103,114,97,100,95,52,95,115,104,97,100,101,114,
24,115,107,95,99,111,110,105,99,97,108,95,103,114,97,100,95,56,95,115,104,97,100,101,114,
+7,99,111,108,111,114,73,110,
+1,109,
+1,118,
+6,105,110,72,83,76,65,
+21,115,107,95,109,97,116,114,105,120,95,99,111,108,111,114,102,105,108,116,101,114,
9,98,108,101,110,100,77,111,100,101,
3,115,114,99,
3,100,115,116,
8,115,107,95,98,108,101,110,100,
-4,112,97,100,48,
-4,112,97,100,49,
-4,112,97,100,50,
6,99,104,105,108,100,48,
6,99,104,105,108,100,49,
15,115,107,95,98,108,101,110,100,95,115,104,97,100,101,114,
+8,100,115,116,67,111,108,111,114,
+8,115,114,99,67,111,108,111,114,
+20,115,107,95,98,108,101,110,100,95,99,111,108,111,114,102,105,108,116,101,114,
+7,105,110,67,111,108,111,114,
+23,115,107,95,103,97,117,115,115,105,97,110,95,99,111,108,111,114,102,105,108,116,101,114,
4,104,97,108,102,
6,107,67,108,97,109,112,
7,107,82,101,112,101,97,116,
13,107,77,105,114,114,111,114,82,101,112,101,97,116,
-14,107,67,108,97,109,112,84,111,66,111,114,100,101,114,
5,99,108,97,109,112,
6,108,101,110,103,116,104,
3,109,111,100,
@@ -82,13 +88,6 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_frag[] = {11,0,196,6,
3,116,109,112,
3,109,105,120,
4,115,116,101,112,
-11,108,111,99,97,108,67,111,111,114,100,115,
-6,99,111,111,114,100,115,
-12,115,107,95,70,114,97,103,67,111,111,114,100,
-14,107,71,114,97,100,105,101,110,116,67,108,97,109,112,
-15,107,71,114,97,100,105,101,110,116,82,101,112,101,97,116,
-15,107,71,114,97,100,105,101,110,116,77,105,114,114,111,114,
-14,107,71,114,97,100,105,101,110,116,68,101,99,97,108,
5,102,114,97,99,116,
3,116,95,49,
5,102,108,111,111,114,
@@ -128,35 +127,11 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_frag[] = {11,0,196,6,
3,120,95,116,
5,116,109,112,80,116,
4,116,101,109,112,
-6,107,67,108,101,97,114,
-4,107,83,114,99,
-4,107,68,115,116,
-8,107,83,114,99,79,118,101,114,
-8,107,68,115,116,79,118,101,114,
-6,107,83,114,99,73,110,
-6,107,68,115,116,73,110,
-7,107,83,114,99,79,117,116,
-7,107,68,115,116,79,117,116,
-8,107,83,114,99,65,84,111,112,
-8,107,68,115,116,65,84,111,112,
-4,107,88,111,114,
-5,107,80,108,117,115,
-9,107,77,111,100,117,108,97,116,101,
-7,107,83,99,114,101,101,110,
-8,107,79,118,101,114,108,97,121,
-7,107,68,97,114,107,101,110,
-8,107,76,105,103,104,116,101,110,
-11,107,67,111,108,111,114,68,111,100,103,101,
-10,107,67,111,108,111,114,66,117,114,110,
-10,107,72,97,114,100,76,105,103,104,116,
-10,107,83,111,102,116,76,105,103,104,116,
-11,107,68,105,102,102,101,114,101,110,99,101,
-10,107,69,120,99,108,117,115,105,111,110,
-9,107,77,117,108,116,105,112,108,121,
-4,107,72,117,101,
-11,107,83,97,116,117,114,97,116,105,111,110,
-6,107,67,111,108,111,114,
-11,107,76,117,109,105,110,111,115,105,116,121,
+8,99,111,108,111,114,79,117,116,
+11,36,114,103,98,95,116,111,95,104,115,108,
+8,117,110,112,114,101,109,117,108,
+11,36,104,115,108,95,116,111,95,114,103,98,
+8,115,97,116,117,114,97,116,101,
11,98,108,101,110,100,95,99,108,101,97,114,
9,98,108,101,110,100,95,115,114,99,
9,98,108,101,110,100,95,100,115,116,
@@ -173,459 +148,601 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_frag[] = {11,0,196,6,
14,98,108,101,110,100,95,109,117,108,116,105,112,108,121,
10,98,108,101,110,100,95,104,115,108,99,
5,104,97,108,102,50,
-52,1,143,0,
+6,102,97,99,116,111,114,
+3,101,120,112,
+52,1,149,0,
28,1,0,
17,2,0,0,
51,255,255,11,0,
-55,2,0,
+54,2,0,
17,17,0,
-51,255,255,28,0,3,
+51,255,255,11,0,3,
28,3,0,
-17,35,0,1,2,0,
+17,23,0,1,
+51,2,0,
51,255,255,11,0,
-55,4,0,
-17,51,0,
-51,255,255,63,0,3,
-55,5,0,
+54,4,0,
+17,38,0,
+51,255,255,49,0,3,
+28,5,0,
+17,56,0,1,
+51,4,0,
+51,255,255,11,0,
+54,6,0,
17,72,0,
+51,255,255,49,0,3,
+54,7,0,
+17,91,0,
+51,255,255,110,0,3,
+54,8,0,
+17,119,0,
51,255,255,11,0,3,
-28,6,0,
-17,84,0,2,4,0,5,0,
+28,9,0,
+17,131,0,3,
+51,6,0,
+51,7,0,
+51,8,0,
51,255,255,11,0,
-55,7,0,
-17,107,0,
-51,255,255,110,0,3,
-55,8,0,
-17,114,0,
-51,255,255,116,0,3,
-55,9,0,
-17,122,0,
-51,255,255,116,0,3,
-55,10,0,
-17,126,0,
-51,255,255,116,0,3,
-55,11,0,
-17,130,0,
-51,255,255,116,0,3,
-28,12,0,
-17,141,0,5,7,0,8,0,9,0,10,0,11,0,
-51,255,255,116,0,
-55,13,0,
-17,147,0,
-51,255,255,63,0,3,
-55,14,0,
-17,157,0,
-51,255,255,28,0,3,
-55,15,0,
-17,164,0,
+54,10,0,
+17,154,0,
+51,255,255,157,0,3,
+54,11,0,
+17,161,0,
+51,255,255,163,0,3,
+54,12,0,
+17,169,0,
+51,255,255,163,0,3,
+54,13,0,
+17,173,0,
+51,255,255,163,0,3,
+54,14,0,
+17,177,0,
+51,255,255,163,0,3,
+28,15,0,
+17,188,0,5,
+51,10,0,
+51,11,0,
+51,12,0,
+51,13,0,
+51,14,0,
+51,255,255,163,0,
+54,16,0,
+17,194,0,
+51,255,255,49,0,3,
+54,17,0,
+17,201,0,
51,255,255,110,0,3,
-55,16,0,
-17,168,0,
-51,255,255,110,0,3,
-55,17,0,
-17,172,0,
-51,255,255,110,0,3,
-55,18,0,
-17,181,0,
-51,255,255,110,0,3,
-28,19,0,
-17,191,0,6,13,0,14,0,15,0,16,0,17,0,18,0,
-51,255,255,209,0,
-55,20,0,
-17,216,0,
-51,255,255,110,0,3,
-55,21,0,
-17,225,0,
-51,255,255,209,0,3,
-28,22,0,
-17,227,0,2,20,0,21,0,
-51,255,255,209,0,
-0,23,0,
-51,255,255,28,0,4,
-0,24,0,
-51,255,255,116,0,4,
-55,25,0,
-17,238,0,
-51,23,0,3,
-55,26,0,
-17,250,0,
-51,24,0,3,
-55,27,0,
+54,18,0,
+17,210,0,
+51,255,255,49,0,3,
+54,19,0,
+17,217,0,
+51,255,255,157,0,3,
+54,20,0,
+17,221,0,
+51,255,255,157,0,3,
+54,21,0,
17,225,0,
-51,255,255,209,0,3,
-28,28,0,
-17,7,1,3,25,0,26,0,27,0,
+51,255,255,157,0,3,
+54,22,0,
+17,234,0,
+51,255,255,157,0,3,
+28,23,0,
+17,244,0,7,
+51,16,0,
+51,17,0,
+51,18,0,
+51,19,0,
+51,20,0,
+51,21,0,
+51,22,0,
+51,255,255,6,1,
+54,24,0,
+17,13,1,
+51,255,255,157,0,3,
+54,25,0,
+17,22,1,
+51,255,255,6,1,3,
+28,26,0,
+17,24,1,2,
+51,24,0,
+51,25,0,
+51,255,255,6,1,
+0,27,0,
+51,255,255,49,0,4,
+0,28,0,
+51,255,255,163,0,4,
+54,29,0,
+17,35,1,
+51,27,0,3,
+54,30,0,
+17,47,1,
+51,28,0,3,
+54,31,0,
+17,22,1,
+51,255,255,6,1,3,
+28,32,0,
+17,60,1,3,
+51,29,0,
+51,30,0,
+51,31,0,
51,255,255,11,0,
-0,29,0,
-51,255,255,28,0,8,
-0,30,0,
-51,255,255,116,0,8,
-55,31,0,
-17,238,0,
-51,29,0,3,
-55,32,0,
-17,250,0,
-51,30,0,3,
-55,33,0,
-17,225,0,
-51,255,255,209,0,3,
-28,34,0,
-17,24,1,3,31,0,32,0,33,0,
-51,255,255,11,0,
-55,35,0,
-17,41,1,
-51,255,255,209,0,3,
-55,36,0,
-17,53,1,
-51,255,255,209,0,3,
-55,37,0,
-17,65,1,
-51,255,255,209,0,3,
+0,33,0,
+51,255,255,49,0,8,
+0,34,0,
+51,255,255,163,0,8,
+54,35,0,
+17,35,1,
+51,33,0,3,
+54,36,0,
+17,47,1,
+51,34,0,3,
+54,37,0,
+17,22,1,
+51,255,255,6,1,3,
28,38,0,
-17,69,1,3,35,0,36,0,37,0,
-51,255,255,209,0,
-55,39,0,
-17,89,1,
-51,255,255,209,0,3,
-55,40,0,
-17,101,1,
-51,255,255,116,0,3,
-55,41,0,
-17,65,1,
-51,255,255,209,0,3,
+17,77,1,3,
+51,35,0,
+51,36,0,
+51,37,0,
+51,255,255,11,0,
+54,39,0,
+17,94,1,
+51,255,255,6,1,3,
+54,40,0,
+17,106,1,
+51,255,255,6,1,3,
+54,41,0,
+17,118,1,
+51,255,255,6,1,3,
28,42,0,
-17,113,1,3,39,0,40,0,41,0,
-51,255,255,209,0,
-55,43,0,
-17,89,1,
-51,255,255,209,0,3,
-55,44,0,
-17,133,1,
-51,255,255,116,0,3,
-55,45,0,
-17,143,1,
-51,255,255,116,0,3,
-55,46,0,
-17,65,1,
-51,255,255,209,0,3,
-28,47,0,
-17,154,1,4,43,0,44,0,45,0,46,0,
-51,255,255,209,0,
-55,48,0,
-17,173,1,
-51,255,255,209,0,3,
-55,49,0,
-17,176,1,
-51,255,255,209,0,3,
-28,50,0,
-17,179,1,2,48,0,49,0,
-51,255,255,194,1,
-55,51,0,
-17,41,1,
-51,255,255,209,0,3,
-55,52,0,
-17,53,1,
-51,255,255,209,0,3,
-55,53,0,
-17,203,1,
-51,255,255,116,0,3,
-55,54,0,
-17,216,1,
-51,255,255,116,0,3,
-55,55,0,
-17,65,1,
-51,255,255,209,0,3,
-28,56,0,
-17,229,1,5,51,0,52,0,53,0,54,0,55,0,
-51,255,255,209,0,
-55,57,0,
-17,147,0,
-51,255,255,63,0,3,
-55,58,0,
-17,238,0,
-51,23,0,3,
-55,59,0,
-17,250,0,
-51,24,0,3,
-55,60,0,
-17,41,1,
-51,255,255,209,0,3,
-55,61,0,
-17,53,1,
-51,255,255,209,0,3,
-55,62,0,
-17,216,0,
+17,122,1,3,
+51,39,0,
+51,40,0,
+51,41,0,
+51,255,255,6,1,
+54,43,0,
+17,142,1,
+51,255,255,6,1,3,
+54,44,0,
+17,154,1,
+51,255,255,163,0,3,
+54,45,0,
+17,118,1,
+51,255,255,6,1,3,
+28,46,0,
+17,166,1,3,
+51,43,0,
+51,44,0,
+51,45,0,
+51,255,255,6,1,
+54,47,0,
+17,142,1,
+51,255,255,6,1,3,
+54,48,0,
+17,186,1,
+51,255,255,163,0,3,
+54,49,0,
+17,196,1,
+51,255,255,163,0,3,
+54,50,0,
+17,118,1,
+51,255,255,6,1,3,
+28,51,0,
+17,207,1,4,
+51,47,0,
+51,48,0,
+51,49,0,
+51,50,0,
+51,255,255,6,1,
+54,52,0,
+17,226,1,
+51,255,255,6,1,3,
+54,53,0,
+17,229,1,
+51,255,255,6,1,3,
+28,54,0,
+17,232,1,2,
+51,52,0,
+51,53,0,
+51,255,255,247,1,
+54,55,0,
+17,94,1,
+51,255,255,6,1,3,
+54,56,0,
+17,106,1,
+51,255,255,6,1,3,
+54,57,0,
+17,0,2,
+51,255,255,163,0,3,
+54,58,0,
+17,13,2,
+51,255,255,163,0,3,
+54,59,0,
+17,118,1,
+51,255,255,6,1,3,
+28,60,0,
+17,26,2,5,
+51,55,0,
+51,56,0,
+51,57,0,
+51,58,0,
+51,59,0,
+51,255,255,6,1,
+54,61,0,
+17,194,0,
+51,255,255,49,0,3,
+54,62,0,
+17,201,0,
51,255,255,110,0,3,
-55,63,0,
-17,250,1,
-51,255,255,116,0,3,
-55,64,0,
-17,3,2,
-51,255,255,116,0,3,
-55,65,0,
-17,12,2,
-51,255,255,116,0,3,
-28,66,0,
-17,21,2,9,57,0,58,0,59,0,60,0,61,0,62,0,63,0,64,0,65,0,
+54,63,0,
+17,35,1,
+51,27,0,3,
+54,64,0,
+17,47,1,
+51,28,0,3,
+54,65,0,
+17,94,1,
+51,255,255,6,1,3,
+54,66,0,
+17,106,1,
+51,255,255,6,1,3,
+54,67,0,
+17,13,1,
+51,255,255,157,0,3,
+28,68,0,
+17,47,2,7,
+51,61,0,
+51,62,0,
+51,63,0,
+51,64,0,
+51,65,0,
+51,66,0,
+51,67,0,
51,255,255,11,0,
-55,67,0,
-17,147,0,
-51,255,255,63,0,3,
-55,68,0,
-17,238,0,
-51,29,0,3,
-55,69,0,
-17,250,0,
-51,30,0,3,
-55,70,0,
-17,41,1,
-51,255,255,209,0,3,
-55,71,0,
-17,53,1,
-51,255,255,209,0,3,
-55,72,0,
-17,216,0,
+54,69,0,
+17,194,0,
+51,255,255,49,0,3,
+54,70,0,
+17,201,0,
51,255,255,110,0,3,
-55,73,0,
-17,250,1,
-51,255,255,116,0,3,
-55,74,0,
-17,3,2,
-51,255,255,116,0,3,
-55,75,0,
-17,12,2,
-51,255,255,116,0,3,
+54,71,0,
+17,35,1,
+51,33,0,3,
+54,72,0,
+17,47,1,
+51,34,0,3,
+54,73,0,
+17,94,1,
+51,255,255,6,1,3,
+54,74,0,
+17,106,1,
+51,255,255,6,1,3,
+54,75,0,
+17,13,1,
+51,255,255,157,0,3,
28,76,0,
-17,45,2,9,67,0,68,0,69,0,70,0,71,0,72,0,73,0,74,0,75,0,
+17,71,2,7,
+51,69,0,
+51,70,0,
+51,71,0,
+51,72,0,
+51,73,0,
+51,74,0,
+51,75,0,
51,255,255,11,0,
-55,77,0,
-17,147,0,
-51,255,255,63,0,3,
-55,78,0,
-17,238,0,
-51,23,0,3,
-55,79,0,
-17,250,0,
-51,24,0,3,
-55,80,0,
-17,89,1,
-51,255,255,209,0,3,
-55,81,0,
-17,101,1,
-51,255,255,116,0,3,
-55,82,0,
-17,216,0,
+54,77,0,
+17,194,0,
+51,255,255,49,0,3,
+54,78,0,
+17,201,0,
51,255,255,110,0,3,
-28,83,0,
-17,69,2,6,77,0,78,0,79,0,80,0,81,0,82,0,
+54,79,0,
+17,35,1,
+51,27,0,3,
+54,80,0,
+17,47,1,
+51,28,0,3,
+54,81,0,
+17,142,1,
+51,255,255,6,1,3,
+54,82,0,
+17,154,1,
+51,255,255,163,0,3,
+54,83,0,
+17,13,1,
+51,255,255,157,0,3,
+28,84,0,
+17,95,2,7,
+51,77,0,
+51,78,0,
+51,79,0,
+51,80,0,
+51,81,0,
+51,82,0,
+51,83,0,
51,255,255,11,0,
-55,84,0,
-17,147,0,
-51,255,255,63,0,3,
-55,85,0,
-17,238,0,
-51,29,0,3,
-55,86,0,
-17,250,0,
-51,30,0,3,
-55,87,0,
-17,89,1,
-51,255,255,209,0,3,
-55,88,0,
-17,101,1,
-51,255,255,116,0,3,
-55,89,0,
-17,216,0,
+54,85,0,
+17,194,0,
+51,255,255,49,0,3,
+54,86,0,
+17,201,0,
51,255,255,110,0,3,
-28,90,0,
-17,93,2,6,84,0,85,0,86,0,87,0,88,0,89,0,
+54,87,0,
+17,35,1,
+51,33,0,3,
+54,88,0,
+17,47,1,
+51,34,0,3,
+54,89,0,
+17,142,1,
+51,255,255,6,1,3,
+54,90,0,
+17,154,1,
+51,255,255,163,0,3,
+54,91,0,
+17,13,1,
+51,255,255,157,0,3,
+28,92,0,
+17,119,2,7,
+51,85,0,
+51,86,0,
+51,87,0,
+51,88,0,
+51,89,0,
+51,90,0,
+51,91,0,
51,255,255,11,0,
-55,91,0,
-17,147,0,
-51,255,255,63,0,3,
-55,92,0,
-17,238,0,
-51,23,0,3,
-55,93,0,
-17,250,0,
-51,24,0,3,
-55,94,0,
-17,89,1,
-51,255,255,209,0,3,
-55,95,0,
-17,133,1,
-51,255,255,116,0,3,
-55,96,0,
-17,143,1,
-51,255,255,116,0,3,
-55,97,0,
-17,216,0,
+54,93,0,
+17,194,0,
+51,255,255,49,0,3,
+54,94,0,
+17,201,0,
51,255,255,110,0,3,
-55,98,0,
-17,250,1,
-51,255,255,116,0,3,
-55,99,0,
-17,3,2,
-51,255,255,116,0,3,
-55,100,0,
-17,12,2,
-51,255,255,116,0,3,
+54,95,0,
+17,35,1,
+51,27,0,3,
+54,96,0,
+17,47,1,
+51,28,0,3,
+54,97,0,
+17,142,1,
+51,255,255,6,1,3,
+54,98,0,
+17,186,1,
+51,255,255,163,0,3,
+54,99,0,
+17,196,1,
+51,255,255,163,0,3,
+54,100,0,
+17,13,1,
+51,255,255,157,0,3,
28,101,0,
-17,117,2,10,91,0,92,0,93,0,94,0,95,0,96,0,97,0,98,0,99,0,100,0,
+17,143,2,8,
+51,93,0,
+51,94,0,
+51,95,0,
+51,96,0,
+51,97,0,
+51,98,0,
+51,99,0,
+51,100,0,
51,255,255,11,0,
-55,102,0,
-17,147,0,
-51,255,255,63,0,3,
-55,103,0,
-17,238,0,
-51,29,0,3,
-55,104,0,
-17,250,0,
-51,30,0,3,
-55,105,0,
-17,89,1,
-51,255,255,209,0,3,
-55,106,0,
-17,133,1,
-51,255,255,116,0,3,
-55,107,0,
-17,143,1,
-51,255,255,116,0,3,
-55,108,0,
-17,216,0,
+54,102,0,
+17,194,0,
+51,255,255,49,0,3,
+54,103,0,
+17,201,0,
51,255,255,110,0,3,
-55,109,0,
-17,250,1,
-51,255,255,116,0,3,
-55,110,0,
-17,3,2,
-51,255,255,116,0,3,
-55,111,0,
-17,12,2,
-51,255,255,116,0,3,
-28,112,0,
-17,140,2,10,102,0,103,0,104,0,105,0,106,0,107,0,108,0,109,0,110,0,111,0,
+54,104,0,
+17,35,1,
+51,33,0,3,
+54,105,0,
+17,47,1,
+51,34,0,3,
+54,106,0,
+17,142,1,
+51,255,255,6,1,3,
+54,107,0,
+17,186,1,
+51,255,255,163,0,3,
+54,108,0,
+17,196,1,
+51,255,255,163,0,3,
+54,109,0,
+17,13,1,
+51,255,255,157,0,3,
+28,110,0,
+17,166,2,8,
+51,102,0,
+51,103,0,
+51,104,0,
+51,105,0,
+51,106,0,
+51,107,0,
+51,108,0,
+51,109,0,
51,255,255,11,0,
-55,113,0,
-17,147,0,
-51,255,255,63,0,3,
-55,114,0,
-17,238,0,
-51,23,0,3,
-55,115,0,
-17,250,0,
-51,24,0,3,
-55,116,0,
-17,41,1,
-51,255,255,209,0,3,
-55,117,0,
-17,53,1,
-51,255,255,209,0,3,
-55,118,0,
-17,203,1,
-51,255,255,116,0,3,
-55,119,0,
-17,216,1,
-51,255,255,116,0,3,
-55,120,0,
-17,216,0,
+54,111,0,
+17,194,0,
+51,255,255,49,0,3,
+54,112,0,
+17,201,0,
51,255,255,110,0,3,
-55,121,0,
-17,163,2,
-51,255,255,116,0,3,
-28,122,0,
-17,171,2,9,113,0,114,0,115,0,116,0,117,0,118,0,119,0,120,0,121,0,
+54,113,0,
+17,35,1,
+51,27,0,3,
+54,114,0,
+17,47,1,
+51,28,0,3,
+54,115,0,
+17,94,1,
+51,255,255,6,1,3,
+54,116,0,
+17,106,1,
+51,255,255,6,1,3,
+54,117,0,
+17,0,2,
+51,255,255,163,0,3,
+54,118,0,
+17,13,2,
+51,255,255,163,0,3,
+54,119,0,
+17,13,1,
+51,255,255,157,0,3,
+28,120,0,
+17,189,2,9,
+51,111,0,
+51,112,0,
+51,113,0,
+51,114,0,
+51,115,0,
+51,116,0,
+51,117,0,
+51,118,0,
+51,119,0,
51,255,255,11,0,
-55,123,0,
-17,147,0,
-51,255,255,63,0,3,
-55,124,0,
-17,238,0,
-51,29,0,3,
-55,125,0,
-17,250,0,
-51,30,0,3,
-55,126,0,
-17,41,1,
-51,255,255,209,0,3,
-55,127,0,
-17,53,1,
-51,255,255,209,0,3,
-55,128,0,
-17,203,1,
-51,255,255,116,0,3,
-55,129,0,
-17,216,1,
-51,255,255,116,0,3,
-55,130,0,
-17,216,0,
+54,121,0,
+17,194,0,
+51,255,255,49,0,3,
+54,122,0,
+17,201,0,
51,255,255,110,0,3,
-55,131,0,
-17,163,2,
-51,255,255,116,0,3,
-28,132,0,
-17,196,2,9,123,0,124,0,125,0,126,0,127,0,128,0,129,0,130,0,131,0,
+54,123,0,
+17,35,1,
+51,33,0,3,
+54,124,0,
+17,47,1,
+51,34,0,3,
+54,125,0,
+17,94,1,
+51,255,255,6,1,3,
+54,126,0,
+17,106,1,
+51,255,255,6,1,3,
+54,127,0,
+17,0,2,
+51,255,255,163,0,3,
+54,128,0,
+17,13,2,
+51,255,255,163,0,3,
+54,129,0,
+17,13,1,
+51,255,255,157,0,3,
+28,130,0,
+17,214,2,9,
+51,121,0,
+51,122,0,
+51,123,0,
+51,124,0,
+51,125,0,
+51,126,0,
+51,127,0,
+51,128,0,
+51,129,0,
51,255,255,11,0,
-55,133,0,
-17,221,2,
+54,131,0,
+17,239,2,
+51,255,255,11,0,3,
+54,132,0,
+17,247,2,
51,255,255,110,0,3,
-55,134,0,
-17,231,2,
+54,133,0,
+17,249,2,
+51,255,255,49,0,3,
+54,134,0,
+17,251,2,
+51,255,255,157,0,3,
+28,135,0,
+17,2,3,4,
+51,131,0,
+51,132,0,
+51,133,0,
+51,134,0,
+51,255,255,11,0,
+54,136,0,
+17,24,3,
+51,255,255,157,0,3,
+54,137,0,
+17,34,3,
51,255,255,11,0,3,
-55,135,0,
-17,235,2,
+54,138,0,
+17,38,3,
51,255,255,11,0,3,
-28,136,0,
-17,239,2,3,133,0,134,0,135,0,
+28,139,0,
+17,42,3,3,
+51,136,0,
+51,137,0,
+51,138,0,
51,255,255,11,0,
-55,137,0,
-17,221,2,
-51,255,255,110,0,3,
-55,138,0,
-17,248,2,
-51,255,255,110,0,3,
-55,139,0,
-17,253,2,
-51,255,255,110,0,3,
-55,140,0,
-17,2,3,
-51,255,255,110,0,3,
-55,141,0,
-17,7,3,
+54,140,0,
+17,24,3,
+51,255,255,157,0,3,
+54,141,0,
+17,51,3,
51,255,255,11,0,3,
-55,142,0,
-17,14,3,
+54,142,0,
+17,58,3,
51,255,255,11,0,3,
28,143,0,
-17,21,3,6,137,0,138,0,139,0,140,0,141,0,142,0,
-51,255,255,11,0,27,0,
-27,0,
-33,0,
-55,0,
+17,65,3,3,
+51,140,0,
+51,141,0,
+51,142,0,
+51,255,255,11,0,
+54,144,0,
+17,81,3,
+51,255,255,11,0,3,
+54,145,0,
+17,24,3,
+51,255,255,157,0,3,
+54,146,0,
+17,90,3,
+51,255,255,49,0,3,
+28,147,0,
+17,99,3,3,
+51,144,0,
+51,145,0,
+51,146,0,
+51,255,255,11,0,
+54,148,0,
+17,120,3,
+51,255,255,11,0,3,
+28,149,0,
+17,128,3,1,
+51,148,0,
+51,255,255,11,0,31,0,
+31,0,
37,0,
-49,0,
+59,0,
41,0,
-46,0,
-11,0,
-21,0,
-22,0,
-28,0,
-23,0,
-29,0,
-135,0,
+53,0,
+45,0,
+50,0,
+14,0,
+25,0,
+26,0,
+32,0,
+27,0,
+33,0,
+138,0,
+146,0,
142,0,
-18,0,
-121,0,
-131,0,
+22,0,
+119,0,
+129,0,
0,0,
-65,0,
+148,0,
+67,0,
75,0,
-5,0,
-82,0,
-89,0,
+8,0,
+134,0,
2,0,
+83,0,
+91,0,
+4,0,
100,0,
-111,0,
+109,0,
20,
29,1,0,
2,
@@ -634,1250 +751,1216 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_frag[] = {11,0,196,6,
8,
51,255,255,11,0,4,
25,
-51,255,255,37,3,0,0,128,63,
+51,255,255,152,3,0,0,128,63,
25,
-51,255,255,37,3,0,0,0,0,
+51,255,255,152,3,0,0,0,0,
25,
-51,255,255,37,3,0,0,128,63,
+51,255,255,152,3,0,0,128,63,
25,
-51,255,255,37,3,0,0,128,63,1,
+51,255,255,152,3,0,0,128,63,1,
29,3,0,
2,
52,1,0,0,0,0,1,
44,
+56,2,0,0,1,
+29,5,0,
+2,
+52,1,0,0,0,0,1,
+44,
9,
51,255,255,11,0,1,
-57,2,0,0,1,
-29,6,0,
+56,4,0,0,1,
+29,9,0,
2,
52,1,0,0,0,0,1,
44,
-57,5,0,0,1,
-29,12,0,
+56,8,0,0,1,
+29,15,0,
2,
-52,1,4,0,
-55,144,0,
-38,
-16,4,42,3,
-51,255,255,110,0,2,
-55,145,0,
+52,1,3,0,
+54,150,0,
38,
-16,4,49,3,
-51,255,255,110,0,2,
-55,146,0,
+16,4,157,3,
+51,255,255,157,0,2,
+54,151,0,
38,
-16,4,57,3,
-51,255,255,110,0,2,
-55,147,0,
+16,4,164,3,
+51,255,255,157,0,2,
+54,152,0,
38,
-16,4,71,3,
-51,255,255,110,0,2,4,0,
+16,4,172,3,
+51,255,255,157,0,2,3,0,
0,0,
-3,0,
2,0,
1,0,4,
-56,144,0,
-51,255,255,110,0,0,
+55,150,0,
+51,255,255,157,0,0,
36,
-51,255,255,110,0,0,0,0,0,
-56,145,0,
-51,255,255,110,0,0,
+51,255,255,157,0,0,0,0,0,
+55,151,0,
+51,255,255,157,0,0,
36,
-51,255,255,110,0,1,0,0,0,
-56,146,0,
-51,255,255,110,0,0,
+51,255,255,157,0,1,0,0,0,
+55,152,0,
+51,255,255,157,0,0,
36,
-51,255,255,110,0,2,0,0,0,
+51,255,255,157,0,2,0,0,0,
32,0,
1,
-57,7,0,0,16,
-57,144,0,0,
+56,10,0,0,16,
+56,150,0,0,
2,
52,1,0,0,0,0,1,
44,
1,
27,
-51,255,255,116,0,255,255,86,3,3,
-57,8,0,0,
-57,9,0,0,
-57,10,0,0,3,
-57,11,0,0,1,
+51,255,255,163,0,255,255,186,3,3,
+56,11,0,0,
+56,12,0,0,
+56,13,0,0,3,
+56,14,0,0,1,
32,0,
1,
-57,7,0,0,16,
-57,145,0,0,
+56,10,0,0,16,
+56,151,0,0,
2,
52,1,1,0,
-55,148,0,
-17,92,3,
-51,255,255,116,0,2,1,0,
+54,153,0,
+17,192,3,
+51,255,255,163,0,2,1,0,
0,0,2,
-56,148,0,
-51,255,255,116,0,0,
+55,153,0,
+51,255,255,163,0,0,
1,
-57,10,0,0,1,
-57,9,0,0,
+56,13,0,0,1,
+56,12,0,0,
44,
1,
1,
27,
-51,255,255,116,0,255,255,99,3,2,
+51,255,255,163,0,255,255,199,3,2,
1,
-57,8,0,0,1,
-57,9,0,0,
-57,148,0,0,0,
-57,9,0,0,3,
-57,11,0,0,1,
+56,11,0,0,1,
+56,12,0,0,
+56,153,0,0,0,
+56,12,0,0,3,
+56,14,0,0,1,
32,0,
1,
-57,7,0,0,16,
-57,146,0,0,
+56,10,0,0,16,
+56,152,0,0,
2,
52,1,3,0,
-55,149,0,
-17,92,3,
-51,255,255,116,0,2,
-55,150,0,
-17,103,3,
-51,255,255,116,0,2,
-55,151,0,
-17,111,3,
-51,255,255,116,0,2,3,0,
+54,154,0,
+17,192,3,
+51,255,255,163,0,2,
+54,155,0,
+17,203,3,
+51,255,255,163,0,2,
+54,156,0,
+17,211,3,
+51,255,255,163,0,2,3,0,
0,0,
1,0,
2,0,4,
-56,149,0,
-51,255,255,116,0,0,
+55,154,0,
+51,255,255,163,0,0,
1,
-57,10,0,0,1,
-57,9,0,0,
-56,150,0,
-51,255,255,116,0,0,
+56,13,0,0,1,
+56,12,0,0,
+55,155,0,
+51,255,255,163,0,0,
1,
25,
-51,255,255,116,0,0,0,0,64,2,
-57,149,0,0,
-56,151,0,
-51,255,255,116,0,0,
+51,255,255,163,0,0,0,0,64,2,
+56,154,0,0,
+55,156,0,
+51,255,255,163,0,0,
27,
-51,255,255,116,0,255,255,99,3,2,
+51,255,255,163,0,255,255,199,3,2,
1,
-57,8,0,0,1,
-57,9,0,0,
-57,150,0,0,
+56,11,0,0,1,
+56,12,0,0,
+56,155,0,0,
44,
1,
1,
27,
-51,255,255,116,0,255,255,115,3,3,
-57,151,0,0,
+51,255,255,163,0,255,255,215,3,3,
+56,156,0,0,
1,
-57,150,0,0,1,
-57,151,0,0,
+56,155,0,0,1,
+56,156,0,0,
27,
-51,255,255,116,0,255,255,119,3,2,
-57,149,0,0,
-57,151,0,0,0,
-57,9,0,0,3,
-57,11,0,0,1,
+51,255,255,163,0,255,255,219,3,2,
+56,154,0,0,
+56,156,0,0,0,
+56,12,0,0,3,
+56,14,0,0,1,
2,
52,1,0,0,0,0,1,
44,
1,
27,
-51,255,255,116,0,255,255,86,3,3,
-57,8,0,0,
-57,9,0,0,
-57,10,0,0,3,
-57,11,0,0,1,1,
-29,19,0,
+51,255,255,163,0,255,255,186,3,3,
+56,11,0,0,
+56,12,0,0,
+56,13,0,0,3,
+56,14,0,0,1,1,
+29,23,0,
2,
-52,1,2,0,
-55,152,0,
-17,124,3,
-51,255,255,28,0,2,
-55,153,0,
-17,136,3,
-51,255,255,209,0,2,2,0,
-1,0,
-0,0,3,
-56,152,0,
-51,255,255,28,0,0,
+52,1,1,0,
+54,157,0,
+17,118,1,
+51,255,255,6,1,2,1,0,
+0,0,2,
+55,157,0,
+51,255,255,6,1,0,
+50,
1,
-57,13,0,0,2,
-57,255,255,143,3,0,
-56,153,0,
-51,255,255,209,0,0,
+56,17,0,0,2,
+56,16,0,0,2,0,1,
+44,
8,
-51,255,255,209,0,2,
+51,255,255,6,1,2,
27,
-51,255,255,116,0,12,0,5,
-57,15,0,0,
+51,255,255,163,0,15,0,5,
+56,19,0,0,
50,
-57,152,0,0,1,0,
+56,157,0,0,1,0,
50,
-57,14,0,0,1,0,
+56,18,0,0,1,0,
50,
-57,14,0,0,1,2,
+56,18,0,0,1,2,
12,
-51,255,255,116,0,1,
-57,17,0,0,
+51,255,255,163,0,1,
+56,21,0,0,
27,
-51,255,255,116,0,12,0,5,
-57,16,0,0,
+51,255,255,163,0,15,0,5,
+56,20,0,0,
50,
-57,152,0,0,1,1,
+56,157,0,0,1,1,
50,
-57,14,0,0,1,1,
+56,18,0,0,1,1,
50,
-57,14,0,0,1,3,
+56,18,0,0,1,3,
12,
-51,255,255,116,0,1,
-57,18,0,0,
-44,
-57,153,0,0,1,
-29,22,0,
+51,255,255,163,0,1,
+56,22,0,0,1,
+29,26,0,
2,
-52,1,4,0,
-55,154,0,
-38,
-16,4,156,3,
-51,255,255,110,0,2,
-55,155,0,
-38,
-16,4,171,3,
-51,255,255,110,0,2,
-55,156,0,
-38,
-16,4,187,3,
-51,255,255,110,0,2,
-55,157,0,
-38,
-16,4,203,3,
-51,255,255,110,0,2,4,0,
-0,0,
-3,0,
-2,0,
-1,0,2,
+52,1,0,0,0,0,2,
49,0,
-52,1,4,0,
-51,154,0,
-51,155,0,
-51,156,0,
-51,157,0,4,0,
-0,0,
-3,0,
-2,0,
-1,0,
-57,20,0,0,4,0,0,0,0,0,
+52,1,0,0,0,0,
+56,24,0,0,4,0,0,0,0,0,
2,
-58,2,
+57,2,
22,
1,
50,
-57,21,0,1,1,0,15,
+56,25,0,1,1,0,15,
27,
-51,255,255,116,0,255,255,86,3,3,
+51,255,255,163,0,255,255,186,3,3,
50,
-57,21,0,0,1,0,
+56,25,0,0,1,0,
25,
-51,255,255,116,0,0,0,0,0,
+51,255,255,163,0,0,0,0,0,
25,
-51,255,255,116,0,0,0,128,63,
+51,255,255,163,0,0,0,128,63,
4,0,0,1,0,0,0,
2,
-58,2,
+57,2,
22,
1,
50,
-57,21,0,1,1,0,15,
+56,25,0,1,1,0,15,
27,
-51,255,255,116,0,255,255,218,3,1,
+51,255,255,163,0,255,255,224,3,1,
50,
-57,21,0,0,1,0,
+56,25,0,0,1,0,
4,0,0,2,0,0,0,
2,
52,1,1,0,
-55,158,0,
-17,224,3,
-51,255,255,116,0,2,1,0,
+54,158,0,
+17,230,3,
+51,255,255,163,0,2,1,0,
0,0,4,
-56,158,0,
-51,255,255,116,0,0,
+55,158,0,
+51,255,255,163,0,0,
1,
50,
-57,21,0,0,1,0,1,
+56,25,0,0,1,0,1,
25,
-51,255,255,116,0,0,0,128,63,
+51,255,255,163,0,0,0,128,63,
22,
1,
50,
-57,21,0,1,1,0,15,
+56,25,0,1,1,0,15,
1,
1,
-57,158,0,0,1,
+56,158,0,0,1,
1,
25,
-51,255,255,116,0,0,0,0,64,2,
+51,255,255,163,0,0,0,0,64,2,
27,
-51,255,255,116,0,255,255,228,3,1,
+51,255,255,163,0,255,255,234,3,1,
1,
-57,158,0,0,2,
+56,158,0,0,2,
25,
-51,255,255,116,0,0,0,0,63,1,
+51,255,255,163,0,0,0,0,63,1,
25,
-51,255,255,116,0,0,0,128,63,
+51,255,255,163,0,0,0,128,63,
22,
1,
50,
-57,21,0,1,1,0,15,
+56,25,0,1,1,0,15,
27,
-51,255,255,116,0,255,255,234,3,1,
+51,255,255,163,0,255,255,240,3,1,
50,
-57,21,0,0,1,0,
+56,25,0,0,1,0,
4,1,0,3,0,0,0,
2,
-58,2,
+57,2,
32,0,
1,
1,
50,
-57,21,0,0,1,0,18,
+56,25,0,0,1,0,18,
25,
-51,255,255,116,0,0,0,0,0,9,
+51,255,255,163,0,0,0,0,0,9,
1,
50,
-57,21,0,0,1,0,19,
+56,25,0,0,1,0,19,
25,
-51,255,255,116,0,0,0,128,63,
+51,255,255,163,0,0,0,128,63,
2,
52,1,0,0,0,0,1,
44,
8,
-51,255,255,209,0,2,
+51,255,255,6,1,2,
25,
-51,255,255,116,0,0,0,0,0,
+51,255,255,163,0,0,0,0,0,
25,
-51,255,255,116,0,0,0,128,191,1,
-58,
+51,255,255,163,0,0,0,128,191,1,
+57,
4,0,
44,
-57,21,0,0,1,
-29,28,0,
+56,25,0,0,1,
+29,32,0,
2,
52,1,0,0,0,0,1,
32,0,
1,
50,
-57,27,0,0,1,1,18,
+56,31,0,0,1,1,18,
25,
-51,255,255,116,0,0,0,0,0,
+51,255,255,163,0,0,0,0,0,
2,
52,1,0,0,0,0,1,
44,
13,
51,255,255,11,0,1,
25,
-51,255,255,37,3,0,0,0,0,1,
+51,255,255,152,3,0,0,0,0,1,
32,0,
1,
50,
-57,27,0,0,1,0,20,
+56,31,0,0,1,0,20,
33,
-57,26,0,0,
+56,30,0,0,
36,
-51,255,255,238,3,0,0,0,0,
+51,255,255,244,3,0,0,0,0,
2,
52,1,0,0,0,0,1,
44,
9,
51,255,255,11,0,1,
33,
-57,25,0,0,
+56,29,0,0,
36,
-51,255,255,238,3,0,0,0,0,1,
+51,255,255,244,3,0,0,0,0,1,
32,0,
1,
50,
-57,27,0,0,1,0,18,
+56,31,0,0,1,0,18,
33,
-57,26,0,0,
+56,30,0,0,
36,
-51,255,255,238,3,1,0,0,0,
+51,255,255,244,3,1,0,0,0,
2,
52,1,0,0,0,0,1,
44,
9,
51,255,255,11,0,1,
27,
-51,255,255,28,0,255,255,115,3,3,
+51,255,255,49,0,255,255,215,3,3,
33,
-57,25,0,0,
+56,29,0,0,
36,
-51,255,255,238,3,0,0,0,0,
+51,255,255,244,3,0,0,0,0,
33,
-57,25,0,0,
+56,29,0,0,
36,
-51,255,255,238,3,1,0,0,0,
+51,255,255,244,3,1,0,0,0,
1,
1,
50,
-57,27,0,0,1,0,1,
+56,31,0,0,1,0,1,
33,
-57,26,0,0,
+56,30,0,0,
36,
-51,255,255,238,3,0,0,0,0,3,
+51,255,255,244,3,0,0,0,0,3,
1,
33,
-57,26,0,0,
+56,30,0,0,
36,
-51,255,255,238,3,1,0,0,0,1,
+51,255,255,244,3,1,0,0,0,1,
33,
-57,26,0,0,
+56,30,0,0,
36,
-51,255,255,238,3,0,0,0,0,1,
+51,255,255,244,3,0,0,0,0,1,
32,0,
1,
50,
-57,27,0,0,1,0,18,
+56,31,0,0,1,0,18,
33,
-57,26,0,0,
+56,30,0,0,
36,
-51,255,255,238,3,2,0,0,0,
+51,255,255,244,3,2,0,0,0,
2,
52,1,0,0,0,0,1,
44,
9,
51,255,255,11,0,1,
27,
-51,255,255,28,0,255,255,115,3,3,
+51,255,255,49,0,255,255,215,3,3,
33,
-57,25,0,0,
+56,29,0,0,
36,
-51,255,255,238,3,1,0,0,0,
+51,255,255,244,3,1,0,0,0,
33,
-57,25,0,0,
+56,29,0,0,
36,
-51,255,255,238,3,2,0,0,0,
+51,255,255,244,3,2,0,0,0,
1,
1,
50,
-57,27,0,0,1,0,1,
+56,31,0,0,1,0,1,
33,
-57,26,0,0,
+56,30,0,0,
36,
-51,255,255,238,3,1,0,0,0,3,
+51,255,255,244,3,1,0,0,0,3,
1,
33,
-57,26,0,0,
+56,30,0,0,
36,
-51,255,255,238,3,2,0,0,0,1,
+51,255,255,244,3,2,0,0,0,1,
33,
-57,26,0,0,
+56,30,0,0,
36,
-51,255,255,238,3,1,0,0,0,1,
+51,255,255,244,3,1,0,0,0,1,
32,0,
1,
50,
-57,27,0,0,1,0,18,
+56,31,0,0,1,0,18,
33,
-57,26,0,0,
+56,30,0,0,
36,
-51,255,255,238,3,3,0,0,0,
+51,255,255,244,3,3,0,0,0,
2,
52,1,0,0,0,0,1,
44,
9,
51,255,255,11,0,1,
27,
-51,255,255,28,0,255,255,115,3,3,
+51,255,255,49,0,255,255,215,3,3,
33,
-57,25,0,0,
+56,29,0,0,
36,
-51,255,255,238,3,2,0,0,0,
+51,255,255,244,3,2,0,0,0,
33,
-57,25,0,0,
+56,29,0,0,
36,
-51,255,255,238,3,3,0,0,0,
+51,255,255,244,3,3,0,0,0,
1,
1,
50,
-57,27,0,0,1,0,1,
+56,31,0,0,1,0,1,
33,
-57,26,0,0,
+56,30,0,0,
36,
-51,255,255,238,3,2,0,0,0,3,
+51,255,255,244,3,2,0,0,0,3,
1,
33,
-57,26,0,0,
+56,30,0,0,
36,
-51,255,255,238,3,3,0,0,0,1,
+51,255,255,244,3,3,0,0,0,1,
33,
-57,26,0,0,
+56,30,0,0,
36,
-51,255,255,238,3,2,0,0,0,1,
+51,255,255,244,3,2,0,0,0,1,
2,
52,1,0,0,0,0,1,
44,
9,
51,255,255,11,0,1,
33,
-57,25,0,0,
+56,29,0,0,
36,
-51,255,255,238,3,3,0,0,0,1,1,
-29,34,0,
+51,255,255,244,3,3,0,0,0,1,1,
+29,38,0,
2,
52,1,0,0,0,0,1,
32,0,
1,
50,
-57,33,0,0,1,1,18,
+56,37,0,0,1,1,18,
25,
-51,255,255,116,0,0,0,0,0,
+51,255,255,163,0,0,0,0,0,
2,
52,1,0,0,0,0,1,
44,
13,
51,255,255,11,0,1,
25,
-51,255,255,37,3,0,0,0,0,1,
+51,255,255,152,3,0,0,0,0,1,
32,0,
1,
50,
-57,33,0,0,1,0,18,
+56,37,0,0,1,0,18,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,4,0,0,0,
+51,255,255,244,3,4,0,0,0,
2,
52,1,0,0,0,0,1,
32,0,
1,
50,
-57,33,0,0,1,0,18,
+56,37,0,0,1,0,18,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,2,0,0,0,
+51,255,255,244,3,2,0,0,0,
2,
52,1,0,0,0,0,1,
32,0,
1,
50,
-57,33,0,0,1,0,20,
+56,37,0,0,1,0,20,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,0,0,0,0,
+51,255,255,244,3,0,0,0,0,
2,
52,1,0,0,0,0,1,
44,
9,
51,255,255,11,0,1,
33,
-57,31,0,0,
+56,35,0,0,
36,
-51,255,255,238,3,0,0,0,0,1,
+51,255,255,244,3,0,0,0,0,1,
32,0,
1,
50,
-57,33,0,0,1,0,18,
+56,37,0,0,1,0,18,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,1,0,0,0,
+51,255,255,244,3,1,0,0,0,
2,
52,1,0,0,0,0,1,
44,
9,
51,255,255,11,0,1,
27,
-51,255,255,28,0,255,255,115,3,3,
+51,255,255,49,0,255,255,215,3,3,
33,
-57,31,0,0,
+56,35,0,0,
36,
-51,255,255,238,3,0,0,0,0,
+51,255,255,244,3,0,0,0,0,
33,
-57,31,0,0,
+56,35,0,0,
36,
-51,255,255,238,3,1,0,0,0,
+51,255,255,244,3,1,0,0,0,
1,
1,
50,
-57,33,0,0,1,0,1,
+56,37,0,0,1,0,1,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,0,0,0,0,3,
+51,255,255,244,3,0,0,0,0,3,
1,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,1,0,0,0,1,
+51,255,255,244,3,1,0,0,0,1,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,0,0,0,0,1,
+51,255,255,244,3,0,0,0,0,1,
2,
52,1,0,0,0,0,1,
44,
9,
51,255,255,11,0,1,
27,
-51,255,255,28,0,255,255,115,3,3,
+51,255,255,49,0,255,255,215,3,3,
33,
-57,31,0,0,
+56,35,0,0,
36,
-51,255,255,238,3,1,0,0,0,
+51,255,255,244,3,1,0,0,0,
33,
-57,31,0,0,
+56,35,0,0,
36,
-51,255,255,238,3,2,0,0,0,
+51,255,255,244,3,2,0,0,0,
1,
1,
50,
-57,33,0,0,1,0,1,
+56,37,0,0,1,0,1,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,1,0,0,0,3,
+51,255,255,244,3,1,0,0,0,3,
1,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,2,0,0,0,1,
+51,255,255,244,3,2,0,0,0,1,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,1,0,0,0,1,1,
+51,255,255,244,3,1,0,0,0,1,1,
2,
52,1,0,0,0,0,1,
32,0,
1,
50,
-57,33,0,0,1,0,18,
+56,37,0,0,1,0,18,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,3,0,0,0,
+51,255,255,244,3,3,0,0,0,
2,
52,1,0,0,0,0,1,
44,
9,
51,255,255,11,0,1,
27,
-51,255,255,28,0,255,255,115,3,3,
+51,255,255,49,0,255,255,215,3,3,
33,
-57,31,0,0,
+56,35,0,0,
36,
-51,255,255,238,3,2,0,0,0,
+51,255,255,244,3,2,0,0,0,
33,
-57,31,0,0,
+56,35,0,0,
36,
-51,255,255,238,3,3,0,0,0,
+51,255,255,244,3,3,0,0,0,
1,
1,
50,
-57,33,0,0,1,0,1,
+56,37,0,0,1,0,1,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,2,0,0,0,3,
+51,255,255,244,3,2,0,0,0,3,
1,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,3,0,0,0,1,
+51,255,255,244,3,3,0,0,0,1,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,2,0,0,0,1,
+51,255,255,244,3,2,0,0,0,1,
2,
52,1,0,0,0,0,1,
44,
9,
51,255,255,11,0,1,
27,
-51,255,255,28,0,255,255,115,3,3,
+51,255,255,49,0,255,255,215,3,3,
33,
-57,31,0,0,
+56,35,0,0,
36,
-51,255,255,238,3,3,0,0,0,
+51,255,255,244,3,3,0,0,0,
33,
-57,31,0,0,
+56,35,0,0,
36,
-51,255,255,238,3,4,0,0,0,
+51,255,255,244,3,4,0,0,0,
1,
1,
50,
-57,33,0,0,1,0,1,
+56,37,0,0,1,0,1,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,3,0,0,0,3,
+51,255,255,244,3,3,0,0,0,3,
1,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,4,0,0,0,1,
+51,255,255,244,3,4,0,0,0,1,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,3,0,0,0,1,1,1,
+51,255,255,244,3,3,0,0,0,1,1,1,
2,
52,1,0,0,0,0,1,
32,0,
1,
50,
-57,33,0,0,1,0,18,
+56,37,0,0,1,0,18,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,6,0,0,0,
+51,255,255,244,3,6,0,0,0,
2,
52,1,0,0,0,0,1,
32,0,
1,
50,
-57,33,0,0,1,0,18,
+56,37,0,0,1,0,18,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,5,0,0,0,
+51,255,255,244,3,5,0,0,0,
2,
52,1,0,0,0,0,1,
44,
9,
51,255,255,11,0,1,
27,
-51,255,255,28,0,255,255,115,3,3,
+51,255,255,49,0,255,255,215,3,3,
33,
-57,31,0,0,
+56,35,0,0,
36,
-51,255,255,238,3,4,0,0,0,
+51,255,255,244,3,4,0,0,0,
33,
-57,31,0,0,
+56,35,0,0,
36,
-51,255,255,238,3,5,0,0,0,
+51,255,255,244,3,5,0,0,0,
1,
1,
50,
-57,33,0,0,1,0,1,
+56,37,0,0,1,0,1,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,4,0,0,0,3,
+51,255,255,244,3,4,0,0,0,3,
1,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,5,0,0,0,1,
+51,255,255,244,3,5,0,0,0,1,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,4,0,0,0,1,
+51,255,255,244,3,4,0,0,0,1,
2,
52,1,0,0,0,0,1,
44,
9,
51,255,255,11,0,1,
27,
-51,255,255,28,0,255,255,115,3,3,
+51,255,255,49,0,255,255,215,3,3,
33,
-57,31,0,0,
+56,35,0,0,
36,
-51,255,255,238,3,5,0,0,0,
+51,255,255,244,3,5,0,0,0,
33,
-57,31,0,0,
+56,35,0,0,
36,
-51,255,255,238,3,6,0,0,0,
+51,255,255,244,3,6,0,0,0,
1,
1,
50,
-57,33,0,0,1,0,1,
+56,37,0,0,1,0,1,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,5,0,0,0,3,
+51,255,255,244,3,5,0,0,0,3,
1,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,6,0,0,0,1,
+51,255,255,244,3,6,0,0,0,1,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,5,0,0,0,1,1,
+51,255,255,244,3,5,0,0,0,1,1,
2,
52,1,0,0,0,0,1,
32,0,
1,
50,
-57,33,0,0,1,0,18,
+56,37,0,0,1,0,18,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,7,0,0,0,
+51,255,255,244,3,7,0,0,0,
2,
52,1,0,0,0,0,1,
44,
9,
51,255,255,11,0,1,
27,
-51,255,255,28,0,255,255,115,3,3,
+51,255,255,49,0,255,255,215,3,3,
33,
-57,31,0,0,
+56,35,0,0,
36,
-51,255,255,238,3,6,0,0,0,
+51,255,255,244,3,6,0,0,0,
33,
-57,31,0,0,
+56,35,0,0,
36,
-51,255,255,238,3,7,0,0,0,
+51,255,255,244,3,7,0,0,0,
1,
1,
50,
-57,33,0,0,1,0,1,
+56,37,0,0,1,0,1,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,6,0,0,0,3,
+51,255,255,244,3,6,0,0,0,3,
1,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,7,0,0,0,1,
+51,255,255,244,3,7,0,0,0,1,
33,
-57,32,0,0,
+56,36,0,0,
36,
-51,255,255,238,3,6,0,0,0,1,
+51,255,255,244,3,6,0,0,0,1,
2,
52,1,0,0,0,0,1,
44,
9,
51,255,255,11,0,1,
33,
-57,31,0,0,
+56,35,0,0,
36,
-51,255,255,238,3,7,0,0,0,1,1,1,1,
-29,38,0,
+51,255,255,244,3,7,0,0,0,1,1,1,1,
+29,42,0,
2,
52,1,2,0,
-55,159,0,
-17,250,3,
-51,255,255,209,0,2,
-55,160,0,
-17,225,0,
-51,255,255,116,0,2,2,0,
+54,159,0,
+17,0,4,
+51,255,255,6,1,2,
+54,160,0,
+17,22,1,
+51,255,255,163,0,2,2,0,
0,0,
1,0,4,
22,
1,
-57,37,0,2,23,
-57,35,0,0,
-56,159,0,
-51,255,255,209,0,0,
+56,41,0,2,23,
+56,39,0,0,
+55,159,0,
+51,255,255,6,1,0,
1,
-57,36,0,0,1,
-57,35,0,0,
-56,160,0,
-51,255,255,116,0,0,
+56,40,0,0,1,
+56,39,0,0,
+55,160,0,
+51,255,255,163,0,0,
1,
27,
-51,255,255,116,0,255,255,0,4,2,
-57,37,0,0,
-57,159,0,0,3,
+51,255,255,163,0,255,255,6,4,2,
+56,41,0,0,
+56,159,0,0,3,
27,
-51,255,255,116,0,255,255,0,4,2,
-57,159,0,0,
-57,159,0,0,
+51,255,255,163,0,255,255,6,4,2,
+56,159,0,0,
+56,159,0,0,
44,
8,
-51,255,255,209,0,2,
-57,160,0,0,
+51,255,255,6,1,2,
+56,160,0,0,
25,
-51,255,255,116,0,0,0,128,63,1,
-29,42,0,
+51,255,255,163,0,0,0,128,63,1,
+29,46,0,
2,
52,1,1,0,
-55,161,0,
-17,225,0,
-51,255,255,116,0,2,1,0,
+54,161,0,
+17,22,1,
+51,255,255,163,0,2,1,0,
0,0,2,
-56,161,0,
-51,255,255,116,0,0,
+55,161,0,
+51,255,255,163,0,0,
1,
27,
-51,255,255,116,0,255,255,4,4,2,
-57,41,0,0,
-57,39,0,0,3,
-57,40,0,0,
+51,255,255,163,0,255,255,10,4,2,
+56,45,0,0,
+56,43,0,0,3,
+56,44,0,0,
44,
8,
-51,255,255,209,0,2,
-57,161,0,0,
+51,255,255,6,1,2,
+56,161,0,0,
25,
-51,255,255,116,0,0,0,128,63,1,
-29,47,0,
+51,255,255,163,0,0,0,128,63,1,
+29,51,0,
2,
52,1,2,0,
-55,162,0,
-17,13,4,
-51,255,255,116,0,2,
-55,163,0,
-17,225,0,
-51,255,255,116,0,2,2,0,
+54,162,0,
+17,19,4,
+51,255,255,163,0,2,
+54,163,0,
+17,22,1,
+51,255,255,163,0,2,2,0,
0,0,
1,0,4,
22,
1,
-57,46,0,2,23,
-57,43,0,0,
-56,162,0,
-51,255,255,116,0,0,
+56,50,0,2,23,
+56,47,0,0,
+55,162,0,
+51,255,255,163,0,0,
27,
-51,255,255,116,0,255,255,19,4,2,
+51,255,255,163,0,255,255,25,4,2,
42,1,
50,
-57,46,0,0,1,1,
+56,50,0,0,1,1,
42,1,
50,
-57,46,0,0,1,0,
-56,163,0,
-51,255,255,116,0,0,
+56,50,0,0,1,0,
+55,163,0,
+51,255,255,163,0,0,
1,
1,
1,
1,
-57,162,0,0,2,
+56,162,0,0,2,
25,
-51,255,255,116,0,131,249,34,62,0,
+51,255,255,163,0,131,249,34,62,0,
25,
-51,255,255,116,0,0,0,0,63,0,
-57,44,0,0,2,
-57,45,0,0,
+51,255,255,163,0,0,0,0,63,0,
+56,48,0,0,2,
+56,49,0,0,
44,
8,
-51,255,255,209,0,2,
-57,163,0,0,
+51,255,255,6,1,2,
+56,163,0,0,
25,
-51,255,255,116,0,0,0,128,63,1,
-29,50,0,
+51,255,255,163,0,0,0,128,63,1,
+29,54,0,
2,
52,1,0,0,0,0,1,
44,
1,
8,
-51,255,255,194,1,9,
+51,255,255,247,1,9,
25,
-51,255,255,116,0,0,0,0,0,
+51,255,255,163,0,0,0,0,0,
25,
-51,255,255,116,0,0,0,128,191,
+51,255,255,163,0,0,0,128,191,
25,
-51,255,255,116,0,0,0,0,0,
+51,255,255,163,0,0,0,0,0,
25,
-51,255,255,116,0,0,0,128,63,
+51,255,255,163,0,0,0,128,63,
25,
-51,255,255,116,0,0,0,0,0,
+51,255,255,163,0,0,0,0,0,
25,
-51,255,255,116,0,0,0,0,0,
+51,255,255,163,0,0,0,0,0,
25,
-51,255,255,116,0,0,0,0,0,
+51,255,255,163,0,0,0,0,0,
25,
-51,255,255,116,0,0,0,0,0,
+51,255,255,163,0,0,0,0,0,
25,
-51,255,255,116,0,0,0,128,63,2,
+51,255,255,163,0,0,0,128,63,2,
27,
-51,255,255,194,1,255,255,24,4,1,
+51,255,255,247,1,255,255,30,4,1,
8,
-51,255,255,194,1,9,
+51,255,255,247,1,9,
1,
50,
-57,49,0,0,1,1,1,
+56,53,0,0,1,1,1,
50,
-57,48,0,0,1,1,
+56,52,0,0,1,1,
1,
50,
-57,48,0,0,1,0,1,
+56,52,0,0,1,0,1,
50,
-57,49,0,0,1,0,
+56,53,0,0,1,0,
25,
-51,255,255,116,0,0,0,0,0,
+51,255,255,163,0,0,0,0,0,
1,
50,
-57,49,0,0,1,0,1,
+56,53,0,0,1,0,1,
50,
-57,48,0,0,1,0,
+56,52,0,0,1,0,
1,
50,
-57,49,0,0,1,1,1,
+56,53,0,0,1,1,1,
50,
-57,48,0,0,1,1,
+56,52,0,0,1,1,
25,
-51,255,255,116,0,0,0,0,0,
+51,255,255,163,0,0,0,0,0,
50,
-57,48,0,0,1,0,
+56,52,0,0,1,0,
50,
-57,48,0,0,1,1,
+56,52,0,0,1,1,
25,
-51,255,255,116,0,0,0,128,63,1,
-29,56,0,
+51,255,255,163,0,0,0,128,63,1,
+29,60,0,
2,
52,1,5,0,
-55,164,0,
+54,164,0,
38,
-16,4,32,4,
-51,255,255,116,0,2,
-55,165,0,
-17,52,4,
-51,255,255,116,0,2,
-55,166,0,
-17,60,4,
-51,255,255,116,0,2,
-55,167,0,
-17,68,4,
-51,255,255,75,4,2,
-55,168,0,
-17,80,4,
-51,255,255,75,4,2,5,0,
+16,4,38,4,
+51,255,255,163,0,2,
+54,165,0,
+17,58,4,
+51,255,255,163,0,2,
+54,166,0,
+17,66,4,
+51,255,255,163,0,2,
+54,167,0,
+17,74,4,
+51,255,255,81,4,2,
+54,168,0,
+17,86,4,
+51,255,255,81,4,2,5,0,
0,0,
1,0,
2,0,
3,0,
4,0,6,
-56,164,0,
-51,255,255,116,0,0,
+55,164,0,
+51,255,255,163,0,0,
25,
-51,255,255,116,0,0,0,128,57,
-56,165,0,
-51,255,255,116,0,0,
+51,255,255,163,0,0,0,128,57,
+55,165,0,
+51,255,255,163,0,0,
27,
-51,255,255,116,0,255,255,4,4,2,
-57,51,0,0,
-57,52,0,0,
-56,166,0,
-51,255,255,116,0,0,
+51,255,255,163,0,255,255,10,4,2,
+56,55,0,0,
+56,56,0,0,
+55,166,0,
+51,255,255,163,0,0,
1,
-57,54,0,0,1,
-57,53,0,0,
-56,167,0,
-51,255,255,75,4,0,
+56,58,0,0,1,
+56,57,0,0,
+55,167,0,
+51,255,255,81,4,0,
1,
-57,165,0,0,18,
-57,164,0,0,
-56,168,0,
-51,255,255,75,4,0,
+56,165,0,0,18,
+56,164,0,0,
+55,168,0,
+51,255,255,81,4,0,
1,
27,
-51,255,255,116,0,255,255,234,3,1,
-57,166,0,0,18,
-57,164,0,0,
+51,255,255,163,0,255,255,240,3,1,
+56,166,0,0,18,
+56,164,0,0,
32,0,
-57,167,0,0,
+56,167,0,0,
2,
52,1,5,0,
-55,169,0,
-17,86,4,
-51,255,255,116,0,2,
-55,170,0,
+54,169,0,
17,92,4,
-51,255,255,116,0,2,
-55,171,0,
-17,102,4,
-51,255,255,116,0,2,
-55,172,0,
-17,107,4,
-51,255,255,209,0,2,
-55,173,0,
-17,225,0,
-51,255,255,116,0,2,5,0,
+51,255,255,163,0,2,
+54,170,0,
+17,98,4,
+51,255,255,163,0,2,
+54,171,0,
+17,108,4,
+51,255,255,163,0,2,
+54,172,0,
+17,113,4,
+51,255,255,6,1,2,
+54,173,0,
+17,22,1,
+51,255,255,163,0,2,5,0,
2,0,
3,0,
0,0,
1,0,
4,0,7,
32,0,
-57,168,0,0,
+56,168,0,0,
2,
52,1,0,0,0,0,1,
44,
8,
-51,255,255,209,0,2,
+51,255,255,6,1,2,
25,
-51,255,255,116,0,0,0,0,0,
+51,255,255,163,0,0,0,0,0,
25,
-51,255,255,116,0,0,0,128,191,1,
-58,
-56,169,0,
-51,255,255,116,0,0,
+51,255,255,163,0,0,0,128,191,1,
+57,
+55,169,0,
+51,255,255,163,0,0,
1,
25,
-51,255,255,116,0,0,0,128,63,3,
-57,166,0,0,
-56,170,0,
-51,255,255,116,0,0,
+51,255,255,163,0,0,0,128,63,3,
+56,166,0,0,
+55,170,0,
+51,255,255,163,0,0,
27,
-51,255,255,116,0,255,255,110,4,1,
-57,166,0,0,
-56,171,0,
-51,255,255,116,0,0,
+51,255,255,163,0,255,255,116,4,1,
+56,166,0,0,
+55,171,0,
+51,255,255,163,0,0,
1,
-57,53,0,0,3,
-57,166,0,0,
-56,172,0,
-51,255,255,209,0,0,
+56,57,0,0,3,
+56,166,0,0,
+55,172,0,
+51,255,255,6,1,0,
1,
1,
-57,55,0,0,1,
-57,51,0,0,2,
-57,169,0,0,
-56,173,0,
-51,255,255,116,0,0,
+56,59,0,0,1,
+56,55,0,0,2,
+56,169,0,0,
+55,173,0,
+51,255,255,163,0,0,
1,
1,
27,
-51,255,255,116,0,255,255,92,3,1,
-57,172,0,0,2,
-57,170,0,0,1,
-57,171,0,0,
+51,255,255,163,0,255,255,192,3,1,
+56,172,0,0,2,
+56,170,0,0,1,
+56,171,0,0,
44,
8,
-51,255,255,209,0,2,
-57,173,0,0,
+51,255,255,6,1,2,
+56,173,0,0,
25,
-51,255,255,116,0,0,0,128,63,1,
+51,255,255,163,0,0,0,128,63,1,
32,0,
-57,168,0,0,
+56,168,0,0,
2,
52,1,5,0,
-55,174,0,
-17,115,4,
-51,255,255,194,1,2,
-55,175,0,
-17,125,4,
-51,255,255,116,0,2,
-55,176,0,
-17,127,4,
-51,255,255,116,0,2,
-55,177,0,
-17,107,4,
-51,255,255,209,0,2,
-55,178,0,
-17,225,0,
-51,255,255,116,0,2,5,0,
+54,174,0,
+17,121,4,
+51,255,255,247,1,2,
+54,175,0,
+17,131,4,
+51,255,255,163,0,2,
+54,176,0,
+17,133,4,
+51,255,255,163,0,2,
+54,177,0,
+17,113,4,
+51,255,255,6,1,2,
+54,178,0,
+17,22,1,
+51,255,255,163,0,2,5,0,
3,0,
1,0,
2,0,
4,0,
0,0,8,
-56,174,0,
-51,255,255,194,1,0,
+55,174,0,
+51,255,255,247,1,0,
27,
-51,255,255,194,1,50,0,2,
-57,51,0,0,
-57,52,0,0,
-56,175,0,
-51,255,255,116,0,0,
+51,255,255,247,1,54,0,2,
+56,55,0,0,
+56,56,0,0,
+55,175,0,
+51,255,255,163,0,0,
1,
-57,53,0,0,3,
-57,165,0,0,
-56,176,0,
-51,255,255,116,0,0,
+56,57,0,0,3,
+56,165,0,0,
+55,176,0,
+51,255,255,163,0,0,
1,
-57,175,0,0,2,
-57,175,0,0,
-56,177,0,
-51,255,255,209,0,0,
+56,175,0,0,2,
+56,175,0,0,
+55,177,0,
+51,255,255,6,1,0,
50,
1,
-57,174,0,0,2,
+56,174,0,0,2,
8,
-51,255,255,131,4,2,
-57,55,0,0,
+51,255,255,137,4,2,
+56,59,0,0,
25,
-51,255,255,116,0,0,0,128,63,2,0,1,
-56,178,0,
-51,255,255,116,0,0,
+51,255,255,163,0,0,0,128,63,2,0,1,
+55,178,0,
+51,255,255,163,0,0,
1,
-57,176,0,0,1,
+56,176,0,0,1,
1,
50,
-57,177,0,0,1,1,2,
+56,177,0,0,1,1,2,
50,
-57,177,0,0,1,1,
+56,177,0,0,1,1,
32,0,
1,
-57,178,0,0,18,
+56,178,0,0,18,
25,
-51,255,255,116,0,0,0,0,0,
+51,255,255,163,0,0,0,0,0,
2,
52,1,0,0,0,0,1,
44,
8,
-51,255,255,209,0,2,
+51,255,255,6,1,2,
25,
-51,255,255,116,0,0,0,0,0,
+51,255,255,163,0,0,0,0,0,
25,
-51,255,255,116,0,0,0,128,191,1,
-58,
+51,255,255,163,0,0,0,128,191,1,
+57,
22,
1,
-57,178,0,1,15,
+56,178,0,1,15,
1,
50,
-57,177,0,0,1,0,0,
+56,177,0,0,1,0,0,
27,
-51,255,255,116,0,255,255,138,4,1,
-57,178,0,0,
+51,255,255,163,0,255,255,144,4,1,
+56,178,0,0,
44,
8,
-51,255,255,209,0,2,
-57,178,0,0,
+51,255,255,6,1,2,
+56,178,0,0,
25,
-51,255,255,116,0,0,0,128,63,1,
+51,255,255,163,0,0,0,128,63,1,
2,
52,1,14,0,
-55,179,0,
-17,114,0,
-51,255,255,116,0,2,
-55,180,0,
-17,143,4,
-51,255,255,75,4,2,
-55,181,0,
-17,153,4,
-51,255,255,209,0,2,
-55,182,0,
-17,115,4,
-51,255,255,194,1,2,
-55,183,0,
-17,156,4,
-51,255,255,116,0,2,
-55,184,0,
-17,163,4,
-51,255,255,116,0,2,
-55,185,0,
-17,170,4,
-51,255,255,116,0,2,
-55,186,0,
-17,173,4,
-51,255,255,75,4,2,
-55,187,0,
-17,107,4,
-51,255,255,209,0,2,
-55,188,0,
-17,189,4,
-51,255,255,116,0,2,
-55,189,0,
+54,179,0,
+17,161,0,
+51,255,255,163,0,2,
+54,180,0,
+17,149,4,
+51,255,255,81,4,2,
+54,181,0,
+17,159,4,
+51,255,255,6,1,2,
+54,182,0,
+17,121,4,
+51,255,255,247,1,2,
+54,183,0,
+17,162,4,
+51,255,255,163,0,2,
+54,184,0,
+17,169,4,
+51,255,255,163,0,2,
+54,185,0,
+17,176,4,
+51,255,255,163,0,2,
+54,186,0,
+17,179,4,
+51,255,255,81,4,2,
+54,187,0,
+17,113,4,
+51,255,255,6,1,2,
+54,188,0,
17,195,4,
-51,255,255,116,0,2,
-55,190,0,
-17,207,4,
-51,255,255,75,4,2,
-55,191,0,
-17,221,4,
-51,255,255,116,0,2,
-55,192,0,
-17,225,0,
-51,255,255,116,0,2,14,0,
+51,255,255,163,0,2,
+54,189,0,
+17,201,4,
+51,255,255,163,0,2,
+54,190,0,
+17,213,4,
+51,255,255,81,4,2,
+54,191,0,
+17,227,4,
+51,255,255,163,0,2,
+54,192,0,
+17,22,1,
+51,255,255,163,0,2,14,0,
2,0,
10,0,
0,0,
@@ -1892,1184 +1975,1097 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_frag[] = {11,0,196,6,
13,0,
3,0,
12,0,21,
-56,179,0,
-51,255,255,116,0,0,
+55,179,0,
+51,255,255,163,0,0,
1,
-57,53,0,0,3,
+56,57,0,0,3,
1,
-57,53,0,0,1,
-57,54,0,0,
-56,180,0,
-51,255,255,75,4,0,
+56,57,0,0,1,
+56,58,0,0,
+55,180,0,
+51,255,255,81,4,0,
1,
27,
-51,255,255,116,0,255,255,234,3,1,
+51,255,255,163,0,255,255,240,3,1,
1,
-57,179,0,0,1,
+56,179,0,0,1,
25,
-51,255,255,116,0,0,0,128,63,18,
-57,164,0,0,
+51,255,255,163,0,0,0,128,63,18,
+56,164,0,0,
32,0,
-57,180,0,0,
+56,180,0,0,
2,
52,1,1,0,
-55,193,0,
-17,225,4,
-51,255,255,209,0,2,1,0,
+54,193,0,
+17,231,4,
+51,255,255,6,1,2,1,0,
0,0,4,
-56,193,0,
-51,255,255,209,0,0,
-57,51,0,0,
+55,193,0,
+51,255,255,6,1,0,
+56,55,0,0,
22,
1,
-57,51,0,1,15,
-57,52,0,0,
+56,55,0,1,15,
+56,56,0,0,
22,
1,
-57,52,0,1,15,
-57,193,0,0,
+56,56,0,1,15,
+56,193,0,0,
22,
1,
-57,179,0,1,15,
+56,179,0,1,15,
25,
-51,255,255,116,0,0,0,0,0,1,
-58,
-56,181,0,
-51,255,255,209,0,0,
+51,255,255,163,0,0,0,0,0,1,
+57,
+55,181,0,
+51,255,255,6,1,0,
1,
1,
-57,51,0,0,2,
+56,55,0,0,2,
1,
25,
-51,255,255,116,0,0,0,128,63,1,
-57,179,0,0,0,
+51,255,255,163,0,0,0,128,63,1,
+56,179,0,0,0,
1,
-57,52,0,0,2,
-57,179,0,0,
-56,182,0,
-51,255,255,194,1,0,
+56,56,0,0,2,
+56,179,0,0,
+55,182,0,
+51,255,255,247,1,0,
27,
-51,255,255,194,1,50,0,2,
-57,181,0,0,
-57,52,0,0,
-56,183,0,
-51,255,255,116,0,0,
+51,255,255,247,1,54,0,2,
+56,181,0,0,
+56,56,0,0,
+55,183,0,
+51,255,255,163,0,0,
27,
-51,255,255,116,0,255,255,234,3,1,
+51,255,255,163,0,255,255,240,3,1,
1,
25,
-51,255,255,116,0,0,0,128,63,1,
-57,179,0,0,
-56,184,0,
-51,255,255,116,0,0,
-57,183,0,0,
-56,185,0,
-51,255,255,116,0,0,
+51,255,255,163,0,0,0,128,63,1,
+56,179,0,0,
+55,184,0,
+51,255,255,163,0,0,
+56,183,0,0,
+55,185,0,
+51,255,255,163,0,0,
1,
27,
-51,255,255,116,0,255,255,234,3,1,
+51,255,255,163,0,255,255,240,3,1,
1,
-57,54,0,0,1,
-57,53,0,0,3,
-57,165,0,0,
-56,186,0,
-51,255,255,75,4,0,
+56,58,0,0,1,
+56,57,0,0,3,
+56,165,0,0,
+55,186,0,
+51,255,255,81,4,0,
1,
27,
-51,255,255,116,0,255,255,234,3,1,
+51,255,255,163,0,255,255,240,3,1,
1,
-57,185,0,0,1,
+56,185,0,0,1,
25,
-51,255,255,116,0,0,0,128,63,18,
-57,164,0,0,
+51,255,255,163,0,0,0,128,63,18,
+56,164,0,0,
32,0,
-57,186,0,0,
+56,186,0,0,
2,
52,1,0,0,0,0,2,
22,
1,
-57,183,0,2,24,
+56,183,0,2,24,
25,
-51,255,255,116,0,0,0,0,63,
+51,255,255,163,0,0,0,0,63,
22,
1,
-57,184,0,2,24,
+56,184,0,2,24,
25,
-51,255,255,116,0,0,0,0,63,1,
+51,255,255,163,0,0,0,0,63,1,
2,
52,1,0,0,0,0,2,
22,
1,
-57,183,0,2,24,
+56,183,0,2,24,
1,
-57,185,0,0,3,
+56,185,0,0,3,
1,
1,
-57,185,0,0,2,
-57,185,0,0,1,
+56,185,0,0,2,
+56,185,0,0,1,
25,
-51,255,255,116,0,0,0,128,63,
+51,255,255,163,0,0,0,128,63,
22,
1,
-57,184,0,2,25,
+56,184,0,2,25,
27,
-51,255,255,116,0,255,255,138,4,1,
+51,255,255,163,0,255,255,144,4,1,
27,
-51,255,255,116,0,255,255,234,3,1,
+51,255,255,163,0,255,255,240,3,1,
1,
1,
-57,185,0,0,2,
-57,185,0,0,1,
+56,185,0,0,2,
+56,185,0,0,1,
25,
-51,255,255,116,0,0,0,128,63,1,
+51,255,255,163,0,0,0,128,63,1,
22,
1,
-57,182,0,1,15,
+56,182,0,1,15,
1,
8,
-51,255,255,194,1,9,
-57,183,0,0,
+51,255,255,247,1,9,
+56,183,0,0,
25,
-51,255,255,116,0,0,0,0,0,
+51,255,255,163,0,0,0,0,0,
25,
-51,255,255,116,0,0,0,0,0,
+51,255,255,163,0,0,0,0,0,
25,
-51,255,255,116,0,0,0,0,0,
-57,184,0,0,
+51,255,255,163,0,0,0,0,0,
+56,184,0,0,
25,
-51,255,255,116,0,0,0,0,0,
+51,255,255,163,0,0,0,0,0,
25,
-51,255,255,116,0,0,0,0,0,
+51,255,255,163,0,0,0,0,0,
25,
-51,255,255,116,0,0,0,0,0,
+51,255,255,163,0,0,0,0,0,
25,
-51,255,255,116,0,0,0,128,63,2,
-57,182,0,0,
-56,187,0,
-51,255,255,209,0,0,
+51,255,255,163,0,0,0,128,63,2,
+56,182,0,0,
+55,187,0,
+51,255,255,6,1,0,
50,
1,
-57,182,0,0,2,
+56,182,0,0,2,
8,
-51,255,255,131,4,2,
-57,55,0,0,
+51,255,255,137,4,2,
+56,59,0,0,
25,
-51,255,255,116,0,0,0,128,63,2,0,1,
-56,188,0,
-51,255,255,116,0,0,
+51,255,255,163,0,0,0,128,63,2,0,1,
+55,188,0,
+51,255,255,163,0,0,
1,
25,
-51,255,255,116,0,0,0,128,63,3,
-57,185,0,0,
-56,189,0,
-51,255,255,116,0,0,
+51,255,255,163,0,0,0,128,63,3,
+56,185,0,0,
+55,189,0,
+51,255,255,163,0,0,
27,
-51,255,255,116,0,255,255,110,4,1,
+51,255,255,163,0,255,255,116,4,1,
1,
25,
-51,255,255,116,0,0,0,128,63,1,
-57,179,0,0,
-56,190,0,
-51,255,255,75,4,0,
+51,255,255,163,0,0,0,128,63,1,
+56,179,0,0,
+55,190,0,
+51,255,255,81,4,0,
1,
42,7,
-57,186,0,0,8,
+56,186,0,0,8,
1,
-57,185,0,0,19,
+56,185,0,0,19,
25,
-51,255,255,116,0,0,0,128,63,
-56,191,0,
-51,255,255,116,0,0,
+51,255,255,163,0,0,0,128,63,
+55,191,0,
+51,255,255,163,0,0,
25,
-51,255,255,116,0,0,0,128,191,
+51,255,255,163,0,0,0,128,191,
32,0,
-57,186,0,0,
+56,186,0,0,
2,
52,1,0,0,0,0,1,
22,
1,
-57,191,0,1,15,
+56,191,0,1,15,
1,
27,
-51,255,255,116,0,255,255,0,4,2,
-57,187,0,0,
-57,187,0,0,3,
+51,255,255,163,0,255,255,6,4,2,
+56,187,0,0,
+56,187,0,0,3,
50,
-57,187,0,0,1,0,1,
+56,187,0,0,1,0,1,
32,0,
-57,190,0,0,
+56,190,0,0,
2,
52,1,0,0,0,0,1,
22,
1,
-57,191,0,1,15,
+56,191,0,1,15,
1,
27,
-51,255,255,116,0,255,255,92,3,1,
-57,187,0,0,1,
+51,255,255,163,0,255,255,192,3,1,
+56,187,0,0,1,
1,
50,
-57,187,0,0,1,0,2,
-57,188,0,0,1,
+56,187,0,0,1,0,2,
+56,188,0,0,1,
2,
52,1,1,0,
-55,194,0,
-17,231,4,
-51,255,255,116,0,2,1,0,
+54,194,0,
+17,237,4,
+51,255,255,163,0,2,1,0,
0,0,2,
-56,194,0,
-51,255,255,116,0,0,
+55,194,0,
+51,255,255,163,0,0,
1,
1,
50,
-57,187,0,0,1,0,2,
+56,187,0,0,1,0,2,
50,
-57,187,0,0,1,0,1,
+56,187,0,0,1,0,1,
1,
50,
-57,187,0,0,1,1,2,
+56,187,0,0,1,1,2,
50,
-57,187,0,0,1,1,
+56,187,0,0,1,1,
32,0,
1,
-57,194,0,0,21,
+56,194,0,0,21,
25,
-51,255,255,116,0,0,0,0,0,
+51,255,255,163,0,0,0,0,0,
2,
52,1,0,0,0,0,1,
32,0,
1,
-57,180,0,0,9,
+56,180,0,0,9,
1,
-57,189,0,0,18,
+56,189,0,0,18,
25,
-51,255,255,116,0,0,0,0,0,
+51,255,255,163,0,0,0,0,0,
2,
52,1,0,0,0,0,1,
22,
1,
-57,191,0,1,15,
+56,191,0,1,15,
1,
42,1,
27,
-51,255,255,116,0,255,255,138,4,1,
-57,194,0,0,1,
+51,255,255,163,0,255,255,144,4,1,
+56,194,0,0,1,
1,
50,
-57,187,0,0,1,0,2,
-57,188,0,0,1,
+56,187,0,0,1,0,2,
+56,188,0,0,1,
2,
52,1,0,0,0,0,1,
22,
1,
-57,191,0,1,15,
+56,191,0,1,15,
1,
27,
-51,255,255,116,0,255,255,138,4,1,
-57,194,0,0,1,
+51,255,255,163,0,255,255,144,4,1,
+56,194,0,0,1,
1,
50,
-57,187,0,0,1,0,2,
-57,188,0,0,1,1,
-58,1,
+56,187,0,0,1,0,2,
+56,188,0,0,1,1,
+57,1,
32,0,
1,
42,7,
-57,190,0,0,8,
+56,190,0,0,8,
1,
-57,191,0,0,18,
+56,191,0,0,18,
25,
-51,255,255,116,0,0,0,0,0,
+51,255,255,163,0,0,0,0,0,
2,
52,1,0,0,0,0,1,
44,
8,
-51,255,255,209,0,2,
+51,255,255,6,1,2,
25,
-51,255,255,116,0,0,0,0,0,
+51,255,255,163,0,0,0,0,0,
25,
-51,255,255,116,0,0,0,128,191,1,
-58,
-56,192,0,
-51,255,255,116,0,0,
+51,255,255,163,0,0,0,128,191,1,
+57,
+55,192,0,
+51,255,255,163,0,0,
1,
-57,179,0,0,0,
+56,179,0,0,0,
1,
-57,189,0,0,2,
-57,191,0,0,
+56,189,0,0,2,
+56,191,0,0,
32,0,
-57,180,0,0,
+56,180,0,0,
2,
52,1,0,0,0,0,1,
22,
1,
-57,192,0,1,15,
+56,192,0,1,15,
1,
25,
-51,255,255,116,0,0,0,128,63,1,
-57,192,0,0,1,
-58,
+51,255,255,163,0,0,0,128,63,1,
+56,192,0,0,1,
+57,
44,
8,
-51,255,255,209,0,2,
-57,192,0,0,
+51,255,255,6,1,2,
+56,192,0,0,
25,
-51,255,255,116,0,0,0,128,63,1,1,
-29,66,0,
+51,255,255,163,0,0,0,128,63,1,1,
+29,68,0,
2,
52,1,2,0,
-55,195,0,
-17,65,1,
-51,255,255,209,0,2,
-55,196,0,
-17,225,0,
-51,255,255,209,0,2,2,0,
+54,195,0,
+17,118,1,
+51,255,255,6,1,2,
+54,196,0,
+17,22,1,
+51,255,255,6,1,2,2,0,
0,0,
1,0,4,
-56,195,0,
-51,255,255,209,0,0,
+55,195,0,
+51,255,255,6,1,0,
50,
1,
-57,57,0,0,2,
-57,255,255,143,3,0,2,0,1,
-56,196,0,
-51,255,255,209,0,0,
+56,62,0,0,2,
+56,61,0,0,2,0,1,
+55,196,0,
+51,255,255,6,1,0,
27,
-51,255,255,209,0,38,0,3,
-57,60,0,0,
-57,61,0,0,
-57,195,0,0,
+51,255,255,6,1,42,0,3,
+56,65,0,0,
+56,66,0,0,
+56,195,0,0,
22,
1,
-57,196,0,1,15,
+56,196,0,1,15,
27,
-51,255,255,209,0,22,0,2,
-57,62,0,0,
-57,196,0,0,
+51,255,255,6,1,26,0,2,
+56,67,0,0,
+56,196,0,0,
44,
27,
-51,255,255,11,0,28,0,3,
-57,58,0,0,
-57,59,0,0,
-57,196,0,0,1,
+51,255,255,11,0,32,0,3,
+56,63,0,0,
+56,64,0,0,
+56,196,0,0,1,
29,76,0,
2,
52,1,2,0,
-55,197,0,
-17,65,1,
-51,255,255,209,0,2,
-55,198,0,
-17,225,0,
-51,255,255,209,0,2,2,0,
+54,197,0,
+17,118,1,
+51,255,255,6,1,2,
+54,198,0,
+17,22,1,
+51,255,255,6,1,2,2,0,
0,0,
1,0,4,
-56,197,0,
-51,255,255,209,0,0,
+55,197,0,
+51,255,255,6,1,0,
50,
1,
-57,67,0,0,2,
-57,255,255,143,3,0,2,0,1,
-56,198,0,
-51,255,255,209,0,0,
+56,70,0,0,2,
+56,69,0,0,2,0,1,
+55,198,0,
+51,255,255,6,1,0,
27,
-51,255,255,209,0,38,0,3,
-57,70,0,0,
-57,71,0,0,
-57,197,0,0,
+51,255,255,6,1,42,0,3,
+56,73,0,0,
+56,74,0,0,
+56,197,0,0,
22,
1,
-57,198,0,1,15,
+56,198,0,1,15,
27,
-51,255,255,209,0,22,0,2,
-57,72,0,0,
-57,198,0,0,
+51,255,255,6,1,26,0,2,
+56,75,0,0,
+56,198,0,0,
44,
27,
-51,255,255,11,0,34,0,3,
-57,68,0,0,
-57,69,0,0,
-57,198,0,0,1,
-29,83,0,
+51,255,255,11,0,38,0,3,
+56,71,0,0,
+56,72,0,0,
+56,198,0,0,1,
+29,84,0,
2,
52,1,2,0,
-55,199,0,
-17,65,1,
-51,255,255,209,0,2,
-55,200,0,
-17,225,0,
-51,255,255,209,0,2,2,0,
+54,199,0,
+17,118,1,
+51,255,255,6,1,2,
+54,200,0,
+17,22,1,
+51,255,255,6,1,2,2,0,
0,0,
1,0,4,
-56,199,0,
-51,255,255,209,0,0,
+55,199,0,
+51,255,255,6,1,0,
50,
1,
-57,77,0,0,2,
-57,255,255,143,3,0,2,0,1,
-56,200,0,
-51,255,255,209,0,0,
+56,78,0,0,2,
+56,77,0,0,2,0,1,
+55,200,0,
+51,255,255,6,1,0,
27,
-51,255,255,209,0,42,0,3,
-57,80,0,0,
-57,81,0,0,
-57,199,0,0,
+51,255,255,6,1,46,0,3,
+56,81,0,0,
+56,82,0,0,
+56,199,0,0,
22,
1,
-57,200,0,1,15,
+56,200,0,1,15,
27,
-51,255,255,209,0,22,0,2,
-57,82,0,0,
-57,200,0,0,
+51,255,255,6,1,26,0,2,
+56,83,0,0,
+56,200,0,0,
44,
27,
-51,255,255,11,0,28,0,3,
-57,78,0,0,
-57,79,0,0,
-57,200,0,0,1,
-29,90,0,
+51,255,255,11,0,32,0,3,
+56,79,0,0,
+56,80,0,0,
+56,200,0,0,1,
+29,92,0,
2,
52,1,2,0,
-55,201,0,
-17,65,1,
-51,255,255,209,0,2,
-55,202,0,
-17,225,0,
-51,255,255,209,0,2,2,0,
+54,201,0,
+17,118,1,
+51,255,255,6,1,2,
+54,202,0,
+17,22,1,
+51,255,255,6,1,2,2,0,
0,0,
1,0,4,
-56,201,0,
-51,255,255,209,0,0,
+55,201,0,
+51,255,255,6,1,0,
50,
1,
-57,84,0,0,2,
-57,255,255,143,3,0,2,0,1,
-56,202,0,
-51,255,255,209,0,0,
+56,86,0,0,2,
+56,85,0,0,2,0,1,
+55,202,0,
+51,255,255,6,1,0,
27,
-51,255,255,209,0,42,0,3,
-57,87,0,0,
-57,88,0,0,
-57,201,0,0,
+51,255,255,6,1,46,0,3,
+56,89,0,0,
+56,90,0,0,
+56,201,0,0,
22,
1,
-57,202,0,1,15,
+56,202,0,1,15,
27,
-51,255,255,209,0,22,0,2,
-57,89,0,0,
-57,202,0,0,
+51,255,255,6,1,26,0,2,
+56,91,0,0,
+56,202,0,0,
44,
27,
-51,255,255,11,0,34,0,3,
-57,85,0,0,
-57,86,0,0,
-57,202,0,0,1,
+51,255,255,11,0,38,0,3,
+56,87,0,0,
+56,88,0,0,
+56,202,0,0,1,
29,101,0,
2,
52,1,2,0,
-55,203,0,
-17,65,1,
-51,255,255,209,0,2,
-55,204,0,
-17,225,0,
-51,255,255,209,0,2,2,0,
+54,203,0,
+17,118,1,
+51,255,255,6,1,2,
+54,204,0,
+17,22,1,
+51,255,255,6,1,2,2,0,
0,0,
1,0,4,
-56,203,0,
-51,255,255,209,0,0,
+55,203,0,
+51,255,255,6,1,0,
50,
1,
-57,91,0,0,2,
-57,255,255,143,3,0,2,0,1,
-56,204,0,
-51,255,255,209,0,0,
+56,94,0,0,2,
+56,93,0,0,2,0,1,
+55,204,0,
+51,255,255,6,1,0,
27,
-51,255,255,209,0,47,0,4,
-57,94,0,0,
-57,95,0,0,
-57,96,0,0,
-57,203,0,0,
+51,255,255,6,1,51,0,4,
+56,97,0,0,
+56,98,0,0,
+56,99,0,0,
+56,203,0,0,
22,
1,
-57,204,0,1,15,
+56,204,0,1,15,
27,
-51,255,255,209,0,22,0,2,
-57,97,0,0,
-57,204,0,0,
+51,255,255,6,1,26,0,2,
+56,100,0,0,
+56,204,0,0,
44,
27,
-51,255,255,11,0,28,0,3,
-57,92,0,0,
-57,93,0,0,
-57,204,0,0,1,
-29,112,0,
+51,255,255,11,0,32,0,3,
+56,95,0,0,
+56,96,0,0,
+56,204,0,0,1,
+29,110,0,
2,
52,1,2,0,
-55,205,0,
-17,65,1,
-51,255,255,209,0,2,
-55,206,0,
-17,225,0,
-51,255,255,209,0,2,2,0,
+54,205,0,
+17,118,1,
+51,255,255,6,1,2,
+54,206,0,
+17,22,1,
+51,255,255,6,1,2,2,0,
0,0,
1,0,4,
-56,205,0,
-51,255,255,209,0,0,
+55,205,0,
+51,255,255,6,1,0,
50,
1,
-57,102,0,0,2,
-57,255,255,143,3,0,2,0,1,
-56,206,0,
-51,255,255,209,0,0,
+56,103,0,0,2,
+56,102,0,0,2,0,1,
+55,206,0,
+51,255,255,6,1,0,
27,
-51,255,255,209,0,47,0,4,
-57,105,0,0,
-57,106,0,0,
-57,107,0,0,
-57,205,0,0,
+51,255,255,6,1,51,0,4,
+56,106,0,0,
+56,107,0,0,
+56,108,0,0,
+56,205,0,0,
22,
1,
-57,206,0,1,15,
+56,206,0,1,15,
27,
-51,255,255,209,0,22,0,2,
-57,108,0,0,
-57,206,0,0,
+51,255,255,6,1,26,0,2,
+56,109,0,0,
+56,206,0,0,
44,
27,
-51,255,255,11,0,34,0,3,
-57,103,0,0,
-57,104,0,0,
-57,206,0,0,1,
-29,122,0,
+51,255,255,11,0,38,0,3,
+56,104,0,0,
+56,105,0,0,
+56,206,0,0,1,
+29,120,0,
2,
52,1,2,0,
-55,207,0,
-17,65,1,
-51,255,255,209,0,2,
-55,208,0,
-17,225,0,
-51,255,255,209,0,2,2,0,
+54,207,0,
+17,118,1,
+51,255,255,6,1,2,
+54,208,0,
+17,22,1,
+51,255,255,6,1,2,2,0,
0,0,
1,0,4,
-56,207,0,
-51,255,255,209,0,0,
+55,207,0,
+51,255,255,6,1,0,
50,
1,
-57,113,0,0,2,
-57,255,255,143,3,0,2,0,1,
-56,208,0,
-51,255,255,209,0,0,
-27,
-51,255,255,209,0,56,0,5,
-57,116,0,0,
-57,117,0,0,
-57,118,0,0,
-57,119,0,0,
-57,207,0,0,
+56,112,0,0,2,
+56,111,0,0,2,0,1,
+55,208,0,
+51,255,255,6,1,0,
+27,
+51,255,255,6,1,60,0,5,
+56,115,0,0,
+56,116,0,0,
+56,117,0,0,
+56,118,0,0,
+56,207,0,0,
22,
1,
-57,208,0,1,15,
+56,208,0,1,15,
27,
-51,255,255,209,0,22,0,2,
-57,120,0,0,
-57,208,0,0,
+51,255,255,6,1,26,0,2,
+56,119,0,0,
+56,208,0,0,
44,
27,
-51,255,255,11,0,28,0,3,
-57,114,0,0,
-57,115,0,0,
-57,208,0,0,1,
-29,132,0,
+51,255,255,11,0,32,0,3,
+56,113,0,0,
+56,114,0,0,
+56,208,0,0,1,
+29,130,0,
2,
52,1,2,0,
-55,209,0,
-17,65,1,
-51,255,255,209,0,2,
-55,210,0,
-17,225,0,
-51,255,255,209,0,2,2,0,
+54,209,0,
+17,118,1,
+51,255,255,6,1,2,
+54,210,0,
+17,22,1,
+51,255,255,6,1,2,2,0,
0,0,
1,0,4,
-56,209,0,
-51,255,255,209,0,0,
+55,209,0,
+51,255,255,6,1,0,
50,
1,
-57,123,0,0,2,
-57,255,255,143,3,0,2,0,1,
-56,210,0,
-51,255,255,209,0,0,
-27,
-51,255,255,209,0,56,0,5,
-57,126,0,0,
-57,127,0,0,
-57,128,0,0,
-57,129,0,0,
-57,209,0,0,
+56,122,0,0,2,
+56,121,0,0,2,0,1,
+55,210,0,
+51,255,255,6,1,0,
+27,
+51,255,255,6,1,60,0,5,
+56,125,0,0,
+56,126,0,0,
+56,127,0,0,
+56,128,0,0,
+56,209,0,0,
22,
1,
-57,210,0,1,15,
+56,210,0,1,15,
27,
-51,255,255,209,0,22,0,2,
-57,130,0,0,
-57,210,0,0,
+51,255,255,6,1,26,0,2,
+56,129,0,0,
+56,210,0,0,
44,
27,
-51,255,255,11,0,34,0,3,
-57,124,0,0,
-57,125,0,0,
-57,210,0,0,1,
-29,136,0,
+51,255,255,11,0,38,0,3,
+56,123,0,0,
+56,124,0,0,
+56,210,0,0,1,
+29,135,0,
+2,
+52,1,1,0,
+54,211,0,
+17,242,4,
+51,255,255,11,0,2,1,0,
+0,0,4,
+32,0,
+12,
+51,255,255,81,4,1,
+56,134,0,0,
+2,
+52,1,0,0,0,0,1,
+22,
+1,
+56,131,0,1,15,
+27,
+51,255,255,11,0,255,255,251,4,2,
+50,
+56,131,0,0,3,0,1,2,
+50,
+56,131,0,0,1,3,1,
2,
-52,1,29,0,
+52,1,0,0,0,0,1,
+22,
+1,
+56,131,0,1,15,
+27,
+51,255,255,11,0,255,255,7,5,1,
+56,131,0,0,1,
55,211,0,
-38,
-16,4,236,4,
-51,255,255,110,0,2,
-55,212,0,
-38,
-16,4,243,4,
-51,255,255,110,0,2,
-55,213,0,
-38,
-16,4,248,4,
-51,255,255,110,0,2,
-55,214,0,
-38,
-16,4,253,4,
-51,255,255,110,0,2,
-55,215,0,
-38,
-16,4,6,5,
-51,255,255,110,0,2,
-55,216,0,
-38,
-16,4,15,5,
-51,255,255,110,0,2,
-55,217,0,
-38,
-16,4,22,5,
-51,255,255,110,0,2,
-55,218,0,
-38,
-16,4,29,5,
-51,255,255,110,0,2,
-55,219,0,
-38,
-16,4,37,5,
-51,255,255,110,0,2,
-55,220,0,
-38,
-16,4,45,5,
-51,255,255,110,0,2,
-55,221,0,
-38,
-16,4,54,5,
-51,255,255,110,0,2,
-55,222,0,
-38,
-16,4,63,5,
-51,255,255,110,0,2,
-55,223,0,
-38,
-16,4,68,5,
-51,255,255,110,0,2,
-55,224,0,
-38,
-16,4,74,5,
-51,255,255,110,0,2,
-55,225,0,
-38,
-16,4,84,5,
-51,255,255,110,0,2,
-55,226,0,
-38,
-16,4,92,5,
-51,255,255,110,0,2,
-55,227,0,
-38,
-16,4,101,5,
-51,255,255,110,0,2,
-55,228,0,
-38,
-16,4,109,5,
-51,255,255,110,0,2,
-55,229,0,
-38,
-16,4,118,5,
-51,255,255,110,0,2,
-55,230,0,
-38,
-16,4,130,5,
-51,255,255,110,0,2,
-55,231,0,
-38,
-16,4,141,5,
-51,255,255,110,0,2,
-55,232,0,
-38,
-16,4,152,5,
-51,255,255,110,0,2,
-55,233,0,
-38,
-16,4,163,5,
-51,255,255,110,0,2,
-55,234,0,
-38,
-16,4,175,5,
-51,255,255,110,0,2,
-55,235,0,
-38,
-16,4,186,5,
-51,255,255,110,0,2,
-55,236,0,
-38,
-16,4,196,5,
-51,255,255,110,0,2,
-55,237,0,
-38,
-16,4,201,5,
-51,255,255,110,0,2,
-55,238,0,
-38,
-16,4,213,5,
-51,255,255,110,0,2,
-55,239,0,
-38,
-16,4,220,5,
-51,255,255,110,0,2,29,0,
-0,0,
-27,0,
-19,0,
-18,0,
-16,0,
-22,0,
-2,0,
-10,0,
-6,0,
-8,0,
-4,0,
-23,0,
-20,0,
-25,0,
-17,0,
-28,0,
-13,0,
-24,0,
-15,0,
-12,0,
-26,0,
-14,0,
-21,0,
-1,0,
-9,0,
-5,0,
-7,0,
-3,0,
-11,0,1,
+51,255,255,11,0,0,
+9,
+51,255,255,11,0,1,
+1,
+1,
+56,132,0,0,2,
+9,
+51,255,255,49,0,1,
+56,131,0,0,0,
+56,133,0,0,
+32,0,
+12,
+51,255,255,81,4,1,
+56,134,0,0,
+2,
+52,1,0,0,0,0,1,
+22,
+1,
+56,211,0,1,15,
+27,
+51,255,255,11,0,255,255,16,5,2,
+50,
+56,211,0,0,3,0,1,2,
+50,
+56,211,0,0,1,3,1,
+2,
+52,1,0,0,0,0,2,
+22,
+1,
+56,211,0,1,15,
+27,
+51,255,255,11,0,255,255,28,5,1,
+56,211,0,0,
+22,
+1,
+50,
+56,211,0,2,3,0,1,2,24,
+50,
+56,211,0,0,1,3,1,
+44,
+56,211,0,0,1,
+29,139,0,
+2,
+52,1,0,0,0,0,1,
49,0,
-52,1,29,0,
-51,211,0,
-51,212,0,
-51,213,0,
-51,214,0,
-51,215,0,
-51,216,0,
-51,217,0,
-51,218,0,
-51,219,0,
-51,220,0,
-51,221,0,
-51,222,0,
-51,223,0,
-51,224,0,
-51,225,0,
-51,226,0,
-51,227,0,
-51,228,0,
-51,229,0,
-51,230,0,
-51,231,0,
-51,232,0,
-51,233,0,
-51,234,0,
-51,235,0,
-51,236,0,
-51,237,0,
-51,238,0,
-51,239,0,29,0,
-0,0,
-27,0,
-19,0,
-18,0,
-16,0,
-22,0,
-2,0,
-10,0,
-6,0,
-8,0,
-4,0,
-23,0,
-20,0,
-25,0,
-17,0,
-28,0,
-13,0,
-24,0,
-15,0,
-12,0,
-26,0,
-14,0,
-21,0,
-1,0,
-9,0,
-5,0,
-7,0,
-3,0,
-11,0,
-57,133,0,0,30,0,0,0,0,0,
+52,1,0,0,0,0,
+56,136,0,0,30,0,0,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,232,5,2,
-57,134,0,0,
-57,135,0,0,1,0,1,0,0,0,
+51,255,255,11,0,255,255,37,5,2,
+56,137,0,0,
+56,138,0,0,1,0,1,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,244,5,2,
-57,134,0,0,
-57,135,0,0,1,0,2,0,0,0,
+51,255,255,11,0,255,255,49,5,2,
+56,137,0,0,
+56,138,0,0,1,0,2,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,254,5,2,
-57,134,0,0,
-57,135,0,0,1,0,3,0,0,0,
+51,255,255,11,0,255,255,59,5,2,
+56,137,0,0,
+56,138,0,0,1,0,3,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,8,6,3,
-57,134,0,0,
-57,135,0,0,
+51,255,255,11,0,255,255,69,5,3,
+56,137,0,0,
+56,138,0,0,
8,
51,255,255,11,0,4,
25,
-51,255,255,37,3,0,0,128,63,
+51,255,255,152,3,0,0,128,63,
25,
-51,255,255,37,3,0,0,0,0,
+51,255,255,152,3,0,0,0,0,
25,
-51,255,255,37,3,0,0,0,0,
+51,255,255,152,3,0,0,0,0,
25,
-51,255,255,37,3,0,0,128,191,1,0,4,0,0,0,
+51,255,255,152,3,0,0,128,191,1,0,4,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,8,6,3,
-57,134,0,0,
-57,135,0,0,
+51,255,255,11,0,255,255,69,5,3,
+56,137,0,0,
+56,138,0,0,
8,
51,255,255,11,0,4,
25,
-51,255,255,37,3,0,0,0,0,
+51,255,255,152,3,0,0,0,0,
25,
-51,255,255,37,3,0,0,128,63,
+51,255,255,152,3,0,0,128,63,
25,
-51,255,255,37,3,0,0,128,191,
+51,255,255,152,3,0,0,128,191,
25,
-51,255,255,37,3,0,0,0,0,1,0,5,0,0,0,
+51,255,255,152,3,0,0,0,0,1,0,5,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,8,6,3,
-57,134,0,0,
-57,135,0,0,
+51,255,255,11,0,255,255,69,5,3,
+56,137,0,0,
+56,138,0,0,
8,
51,255,255,11,0,4,
25,
-51,255,255,37,3,0,0,0,0,
+51,255,255,152,3,0,0,0,0,
25,
-51,255,255,37,3,0,0,0,0,
+51,255,255,152,3,0,0,0,0,
25,
-51,255,255,37,3,0,0,128,63,
+51,255,255,152,3,0,0,128,63,
25,
-51,255,255,37,3,0,0,0,0,1,0,6,0,0,0,
+51,255,255,152,3,0,0,0,0,1,0,6,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,8,6,3,
-57,134,0,0,
-57,135,0,0,
+51,255,255,11,0,255,255,69,5,3,
+56,137,0,0,
+56,138,0,0,
8,
51,255,255,11,0,4,
25,
-51,255,255,37,3,0,0,0,0,
+51,255,255,152,3,0,0,0,0,
25,
-51,255,255,37,3,0,0,0,0,
+51,255,255,152,3,0,0,0,0,
25,
-51,255,255,37,3,0,0,0,0,
+51,255,255,152,3,0,0,0,0,
25,
-51,255,255,37,3,0,0,128,63,1,0,7,0,0,0,
+51,255,255,152,3,0,0,128,63,1,0,7,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,8,6,3,
-57,134,0,0,
-57,135,0,0,
+51,255,255,11,0,255,255,69,5,3,
+56,137,0,0,
+56,138,0,0,
8,
51,255,255,11,0,4,
25,
-51,255,255,37,3,0,0,0,0,
+51,255,255,152,3,0,0,0,0,
25,
-51,255,255,37,3,0,0,0,0,
+51,255,255,152,3,0,0,0,0,
25,
-51,255,255,37,3,0,0,128,191,
+51,255,255,152,3,0,0,128,191,
25,
-51,255,255,37,3,0,0,0,0,1,0,8,0,0,0,
+51,255,255,152,3,0,0,0,0,1,0,8,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,8,6,3,
-57,134,0,0,
-57,135,0,0,
+51,255,255,11,0,255,255,69,5,3,
+56,137,0,0,
+56,138,0,0,
8,
51,255,255,11,0,4,
25,
-51,255,255,37,3,0,0,0,0,
+51,255,255,152,3,0,0,0,0,
25,
-51,255,255,37,3,0,0,0,0,
+51,255,255,152,3,0,0,0,0,
25,
-51,255,255,37,3,0,0,0,0,
+51,255,255,152,3,0,0,0,0,
25,
-51,255,255,37,3,0,0,128,191,1,0,9,0,0,0,
+51,255,255,152,3,0,0,128,191,1,0,9,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,8,6,3,
-57,134,0,0,
-57,135,0,0,
+51,255,255,11,0,255,255,69,5,3,
+56,137,0,0,
+56,138,0,0,
8,
51,255,255,11,0,4,
25,
-51,255,255,37,3,0,0,0,0,
+51,255,255,152,3,0,0,0,0,
25,
-51,255,255,37,3,0,0,0,0,
+51,255,255,152,3,0,0,0,0,
25,
-51,255,255,37,3,0,0,128,63,
+51,255,255,152,3,0,0,128,63,
25,
-51,255,255,37,3,0,0,128,191,1,0,10,0,0,0,
+51,255,255,152,3,0,0,128,191,1,0,10,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,8,6,3,
-57,134,0,0,
-57,135,0,0,
+51,255,255,11,0,255,255,69,5,3,
+56,137,0,0,
+56,138,0,0,
8,
51,255,255,11,0,4,
25,
-51,255,255,37,3,0,0,0,0,
+51,255,255,152,3,0,0,0,0,
25,
-51,255,255,37,3,0,0,0,0,
+51,255,255,152,3,0,0,0,0,
25,
-51,255,255,37,3,0,0,128,191,
+51,255,255,152,3,0,0,128,191,
25,
-51,255,255,37,3,0,0,128,63,1,0,11,0,0,0,
+51,255,255,152,3,0,0,128,63,1,0,11,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,8,6,3,
-57,134,0,0,
-57,135,0,0,
+51,255,255,11,0,255,255,69,5,3,
+56,137,0,0,
+56,138,0,0,
8,
51,255,255,11,0,4,
25,
-51,255,255,37,3,0,0,0,0,
+51,255,255,152,3,0,0,0,0,
25,
-51,255,255,37,3,0,0,0,0,
+51,255,255,152,3,0,0,0,0,
25,
-51,255,255,37,3,0,0,128,191,
+51,255,255,152,3,0,0,128,191,
25,
-51,255,255,37,3,0,0,128,191,1,0,12,0,0,0,
+51,255,255,152,3,0,0,128,191,1,0,12,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,8,6,3,
-57,134,0,0,
-57,135,0,0,
+51,255,255,11,0,255,255,69,5,3,
+56,137,0,0,
+56,138,0,0,
8,
51,255,255,11,0,4,
25,
-51,255,255,37,3,0,0,128,63,
+51,255,255,152,3,0,0,128,63,
25,
-51,255,255,37,3,0,0,128,63,
+51,255,255,152,3,0,0,128,63,
25,
-51,255,255,37,3,0,0,0,0,
+51,255,255,152,3,0,0,0,0,
25,
-51,255,255,37,3,0,0,0,0,1,0,13,0,0,0,
+51,255,255,152,3,0,0,0,0,1,0,13,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,26,6,2,
-57,134,0,0,
-57,135,0,0,1,0,14,0,0,0,
+51,255,255,11,0,255,255,87,5,2,
+56,137,0,0,
+56,138,0,0,1,0,14,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,41,6,2,
-57,134,0,0,
-57,135,0,0,1,0,15,0,0,0,
+51,255,255,11,0,255,255,102,5,2,
+56,137,0,0,
+56,138,0,0,1,0,15,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,54,6,3,
-57,134,0,0,
-57,135,0,0,
+51,255,255,11,0,255,255,115,5,3,
+56,137,0,0,
+56,138,0,0,
25,
-51,255,255,37,3,0,0,0,0,1,0,16,0,0,0,
+51,255,255,152,3,0,0,0,0,1,0,16,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,68,6,3,
-57,134,0,0,
-57,135,0,0,
+51,255,255,11,0,255,255,129,5,3,
+56,137,0,0,
+56,138,0,0,
25,
-51,255,255,37,3,0,0,128,63,1,0,17,0,0,0,
+51,255,255,152,3,0,0,128,63,1,0,17,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,68,6,3,
-57,134,0,0,
-57,135,0,0,
+51,255,255,11,0,255,255,129,5,3,
+56,137,0,0,
+56,138,0,0,
25,
-51,255,255,37,3,0,0,128,191,1,0,18,0,0,0,
+51,255,255,152,3,0,0,128,191,1,0,18,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,81,6,2,
-57,134,0,0,
-57,135,0,0,1,0,19,0,0,0,
+51,255,255,11,0,255,255,142,5,2,
+56,137,0,0,
+56,138,0,0,1,0,19,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,99,6,2,
-57,134,0,0,
-57,135,0,0,1,0,20,0,0,0,
+51,255,255,11,0,255,255,160,5,2,
+56,137,0,0,
+56,138,0,0,1,0,20,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,54,6,3,
-57,134,0,0,
-57,135,0,0,
+51,255,255,11,0,255,255,115,5,3,
+56,137,0,0,
+56,138,0,0,
25,
-51,255,255,37,3,0,0,128,63,1,0,21,0,0,0,
+51,255,255,152,3,0,0,128,63,1,0,21,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,116,6,2,
-57,134,0,0,
-57,135,0,0,1,0,22,0,0,0,
+51,255,255,11,0,255,255,177,5,2,
+56,137,0,0,
+56,138,0,0,1,0,22,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,133,6,2,
-57,134,0,0,
-57,135,0,0,1,0,23,0,0,0,
+51,255,255,11,0,255,255,194,5,2,
+56,137,0,0,
+56,138,0,0,1,0,23,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,150,6,2,
-57,134,0,0,
-57,135,0,0,1,0,24,0,0,0,
+51,255,255,11,0,255,255,211,5,2,
+56,137,0,0,
+56,138,0,0,1,0,24,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,166,6,2,
-57,134,0,0,
-57,135,0,0,1,0,25,0,0,0,
+51,255,255,11,0,255,255,227,5,2,
+56,137,0,0,
+56,138,0,0,1,0,25,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,181,6,3,
-57,134,0,0,
-57,135,0,0,
+51,255,255,11,0,255,255,242,5,3,
+56,137,0,0,
+56,138,0,0,
8,
-51,255,255,192,6,2,
+51,255,255,253,5,2,
25,
-51,255,255,37,3,0,0,0,0,
+51,255,255,152,3,0,0,0,0,
25,
-51,255,255,37,3,0,0,128,63,1,0,26,0,0,0,
+51,255,255,152,3,0,0,128,63,1,0,26,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,181,6,3,
-57,134,0,0,
-57,135,0,0,
+51,255,255,11,0,255,255,242,5,3,
+56,137,0,0,
+56,138,0,0,
13,
-51,255,255,192,6,1,
+51,255,255,253,5,1,
25,
-51,255,255,37,3,0,0,128,63,1,0,27,0,0,0,
+51,255,255,152,3,0,0,128,63,1,0,27,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,181,6,3,
-57,134,0,0,
-57,135,0,0,
+51,255,255,11,0,255,255,242,5,3,
+56,137,0,0,
+56,138,0,0,
13,
-51,255,255,192,6,1,
+51,255,255,253,5,1,
25,
-51,255,255,37,3,0,0,0,0,1,0,28,0,0,0,
+51,255,255,152,3,0,0,0,0,1,0,28,0,0,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,255,255,181,6,3,
-57,134,0,0,
-57,135,0,0,
+51,255,255,11,0,255,255,242,5,3,
+56,137,0,0,
+56,138,0,0,
8,
-51,255,255,192,6,2,
+51,255,255,253,5,2,
25,
-51,255,255,37,3,0,0,128,63,
+51,255,255,152,3,0,0,128,63,
25,
-51,255,255,37,3,0,0,0,0,1,1,
+51,255,255,152,3,0,0,0,0,1,1,
44,
13,
51,255,255,11,0,1,
25,
-51,255,255,37,3,0,0,0,0,1,
+51,255,255,152,3,0,0,0,0,1,
29,143,0,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,11,0,136,0,3,
-57,137,0,0,
-57,142,0,0,
-57,141,0,0,1,
+51,255,255,11,0,139,0,3,
+56,140,0,0,
+56,142,0,0,
+56,141,0,0,1,
+29,147,0,
+2,
+52,1,0,0,0,0,1,
+44,
+27,
+51,255,255,11,0,139,0,3,
+56,145,0,0,
+9,
+51,255,255,11,0,1,
+56,146,0,0,
+56,144,0,0,1,
+29,149,0,
+2,
+52,1,1,0,
+54,212,0,
+17,3,6,
+51,255,255,152,3,2,1,0,
+0,0,3,
+55,212,0,
+51,255,255,152,3,0,
+1,
+25,
+51,255,255,152,3,0,0,128,63,1,
+50,
+56,148,0,0,1,3,
+22,
+1,
+56,212,0,1,15,
+1,
+27,
+51,255,255,152,3,255,255,10,6,1,
+1,
+1,
+42,1,
+56,212,0,0,2,
+56,212,0,0,2,
+25,
+51,255,255,152,3,0,0,128,64,1,
+25,
+51,255,255,152,3,188,116,147,60,
+44,
+13,
+51,255,255,11,0,1,
+56,212,0,0,1,
21,};
static constexpr size_t SKSL_INCLUDE_sksl_graphite_frag_LENGTH = sizeof(SKSL_INCLUDE_sksl_graphite_frag);
diff --git a/chromium/third_party/skia/src/sksl/generated/sksl_graphite_vert.dehydrated.sksl b/chromium/third_party/skia/src/sksl/generated/sksl_graphite_vert.dehydrated.sksl
index 33c4c7e123c..aa40420f45f 100644
--- a/chromium/third_party/skia/src/sksl/generated/sksl_graphite_vert.dehydrated.sksl
+++ b/chromium/third_party/skia/src/sksl/generated/sksl_graphite_vert.dehydrated.sksl
@@ -1,4 +1,4 @@
-static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
+static constexpr uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {14,0,162,5,
3,36,80,73,
5,102,108,111,97,116,
7,36,68,101,103,114,101,101,
@@ -147,265 +147,319 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
11,109,97,120,82,111,116,97,116,105,111,110,
3,99,111,115,
3,115,105,110,
-52,1,84,0,
-55,1,0,
+52,1,82,0,
+54,1,0,
38,
16,4,2,0,
51,255,255,6,0,0,
-55,2,0,
+54,2,0,
38,
16,4,12,0,
51,255,255,6,0,0,
-55,3,0,
+54,3,0,
38,
16,4,20,0,
51,255,255,6,0,0,
-55,4,0,
+54,4,0,
38,
16,4,31,0,
51,255,255,6,0,0,
-55,5,0,
+54,5,0,
38,
16,4,43,0,
51,255,255,6,0,0,
-55,6,0,
+54,6,0,
17,59,0,
51,255,255,62,0,3,
-55,7,0,
+54,7,0,
17,69,0,
51,255,255,62,0,3,
-55,8,0,
+54,8,0,
17,72,0,
51,255,255,62,0,3,
-55,9,0,
+54,9,0,
17,75,0,
51,255,255,62,0,3,
-55,10,0,
+54,10,0,
17,78,0,
51,255,255,85,0,3,
28,11,0,
-17,94,0,5,6,0,7,0,8,0,9,0,10,0,
+17,94,0,5,
+51,6,0,
+51,7,0,
+51,8,0,
+51,9,0,
+51,10,0,
51,255,255,6,0,
-55,12,0,
+54,12,0,
17,59,0,
51,255,255,62,0,3,
-55,13,0,
+54,13,0,
17,69,0,
51,255,255,62,0,3,
-55,14,0,
+54,14,0,
17,72,0,
51,255,255,62,0,3,
-55,15,0,
+54,15,0,
17,75,0,
51,255,255,62,0,3,
-55,16,0,
+54,16,0,
17,78,0,
51,255,255,85,0,3,
28,17,0,
-17,121,0,5,12,0,13,0,14,0,15,0,16,0,
+17,121,0,5,
+51,12,0,
+51,13,0,
+51,14,0,
+51,15,0,
+51,16,0,
51,255,255,6,0,
-55,18,0,
+54,18,0,
17,59,0,
51,255,255,62,0,3,
-55,19,0,
+54,19,0,
17,69,0,
51,255,255,62,0,3,
-55,20,0,
+54,20,0,
17,72,0,
51,255,255,62,0,3,
-55,21,0,
+54,21,0,
17,75,0,
51,255,255,62,0,3,
-55,22,0,
+54,22,0,
17,78,0,
51,255,255,85,0,3,
28,23,0,
-17,141,0,5,18,0,19,0,20,0,21,0,22,0,
+17,141,0,5,
+51,18,0,
+51,19,0,
+51,20,0,
+51,21,0,
+51,22,0,
51,255,255,6,0,
-55,24,0,
+54,24,0,
17,59,0,
51,255,255,62,0,3,
-55,25,0,
+54,25,0,
17,69,0,
51,255,255,62,0,3,
-55,26,0,
+54,26,0,
17,72,0,
51,255,255,62,0,3,
-55,27,0,
+54,27,0,
17,166,0,
51,255,255,6,0,3,
28,28,0,
-17,168,0,4,24,0,25,0,26,0,27,0,
+17,168,0,4,
+51,24,0,
+51,25,0,
+51,26,0,
+51,27,0,
51,255,255,6,0,
-55,29,0,
+54,29,0,
17,59,0,
51,255,255,62,0,3,
-55,30,0,
+54,30,0,
17,69,0,
51,255,255,62,0,3,
-55,31,0,
+54,31,0,
17,72,0,
51,255,255,62,0,3,
-55,32,0,
+54,32,0,
17,166,0,
51,255,255,6,0,3,
28,33,0,
-17,191,0,4,29,0,30,0,31,0,32,0,
+17,191,0,4,
+51,29,0,
+51,30,0,
+51,31,0,
+51,32,0,
51,255,255,6,0,
-55,34,0,
+54,34,0,
17,59,0,
51,255,255,62,0,3,
-55,35,0,
+54,35,0,
17,69,0,
51,255,255,62,0,3,
-55,36,0,
+54,36,0,
17,72,0,
51,255,255,62,0,3,
-55,37,0,
+54,37,0,
17,166,0,
51,255,255,6,0,3,
28,38,0,
-17,211,0,4,34,0,35,0,36,0,37,0,
+17,211,0,4,
+51,34,0,
+51,35,0,
+51,36,0,
+51,37,0,
51,255,255,6,0,
-55,39,0,
+54,39,0,
17,236,0,
51,255,255,62,0,3,
-55,40,0,
+54,40,0,
17,238,0,
51,255,255,62,0,3,
28,41,0,
-17,240,0,2,39,0,40,0,
+17,240,0,2,
+51,39,0,
+51,40,0,
51,255,255,62,0,
-55,42,0,
+54,42,0,
17,236,0,
51,255,255,62,0,3,
-55,43,0,
+54,43,0,
17,238,0,
51,255,255,62,0,3,
28,44,0,
-17,6,1,2,42,0,43,0,
+17,6,1,2,
+51,42,0,
+51,43,0,
51,255,255,6,0,
-55,45,0,
+54,45,0,
17,34,1,
51,255,255,6,0,3,
-55,46,0,
+54,46,0,
17,43,1,
51,255,255,6,0,3,
28,47,0,
-17,54,1,2,45,0,46,0,
+17,54,1,2,
+51,45,0,
+51,46,0,
51,255,255,6,0,
-55,48,0,
+54,48,0,
17,67,1,
51,255,255,6,0,3,
28,49,0,
-17,89,1,1,48,0,
+17,89,1,1,
+51,48,0,
51,255,255,6,0,
-55,50,0,
+54,50,0,
17,236,0,
51,255,255,6,0,3,
-55,51,0,
+54,51,0,
17,238,0,
51,255,255,6,0,3,
-55,52,0,
+54,52,0,
17,120,1,
51,255,255,6,0,3,
28,53,0,
-17,122,1,3,50,0,51,0,52,0,
+17,122,1,3,
+51,50,0,
+51,51,0,
+51,52,0,
51,255,255,6,0,
-55,54,0,
+54,54,0,
17,236,0,
51,255,255,62,0,3,
-55,55,0,
+54,55,0,
17,238,0,
51,255,255,62,0,3,
-55,56,0,
+54,56,0,
17,120,1,
51,255,255,6,0,3,
-54,57,0,2,
-51,53,0,
-28,58,0,
-17,122,1,3,54,0,55,0,56,0,
+28,57,0,
+17,122,1,3,
+51,54,0,
+51,55,0,
+51,56,0,
51,255,255,62,0,
-51,58,0,
-55,59,0,
+54,58,0,
17,236,0,
51,255,255,136,1,3,
-55,60,0,
+54,59,0,
17,238,0,
51,255,255,136,1,3,
-55,61,0,
+54,60,0,
17,120,1,
51,255,255,136,1,3,
-54,62,0,3,
-51,53,0,
+28,61,0,
+17,122,1,3,
51,58,0,
-28,63,0,
-17,122,1,3,59,0,60,0,61,0,
+51,59,0,
+51,60,0,
51,255,255,136,1,
-51,63,0,
-55,64,0,
+54,62,0,
17,143,1,
51,255,255,6,0,3,
-55,65,0,
+54,63,0,
17,156,1,
51,255,255,6,0,3,
-55,66,0,
+54,64,0,
17,174,1,
51,255,255,136,1,3,
-55,67,0,
+54,65,0,
17,178,1,
51,255,255,136,1,3,
-28,68,0,
-17,182,1,4,64,0,65,0,66,0,67,0,
+28,66,0,
+17,182,1,4,
+51,62,0,
+51,63,0,
+51,64,0,
+51,65,0,
51,255,255,62,0,
-55,69,0,
+54,67,0,
17,143,1,
51,255,255,6,0,3,
-55,70,0,
+54,68,0,
17,156,1,
51,255,255,6,0,3,
-55,71,0,
+54,69,0,
17,174,1,
51,255,255,136,1,3,
-55,72,0,
+54,70,0,
17,178,1,
51,255,255,136,1,3,
-55,73,0,
+54,71,0,
17,206,1,
51,255,255,62,0,3,
-28,74,0,
-17,221,1,5,69,0,70,0,71,0,72,0,73,0,
+28,72,0,
+17,221,1,5,
+51,67,0,
+51,68,0,
+51,69,0,
+51,70,0,
+51,71,0,
51,255,255,62,0,
-55,75,0,
+54,73,0,
17,245,1,
51,255,255,6,0,3,
-55,76,0,
+54,74,0,
17,252,1,
51,255,255,6,0,3,
-55,77,0,
+54,75,0,
17,5,2,
51,255,255,85,0,3,
-55,78,0,
+54,76,0,
17,18,2,
51,255,255,62,0,3,
-55,79,0,
+54,77,0,
17,28,2,
51,255,255,6,0,3,
-55,80,0,
+54,78,0,
17,174,1,
51,255,255,136,1,3,
-55,81,0,
+54,79,0,
17,178,1,
51,255,255,136,1,3,
-55,82,0,
+54,80,0,
17,37,2,
51,255,255,62,0,3,
-55,83,0,
+54,81,0,
17,54,2,
51,255,255,62,0,3,
-28,84,0,
-17,67,2,9,75,0,76,0,77,0,78,0,79,0,80,0,81,0,82,0,83,0,
-51,255,255,62,0,19,0,
+28,82,0,
+17,67,2,9,
+51,73,0,
+51,74,0,
+51,75,0,
+51,76,0,
+51,77,0,
+51,78,0,
+51,79,0,
+51,80,0,
+51,81,0,
+51,255,255,62,0,21,0,
1,0,
3,0,
4,0,
@@ -415,10 +469,12 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
46,0,
48,0,
40,0,
-67,0,
-73,0,
-83,0,
-61,0,
+65,0,
+71,0,
+81,0,
+52,0,
+56,0,
+60,0,
32,0,
37,0,
27,0,
@@ -427,45 +483,45 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
10,0,
20,
31,
-56,1,0,
+55,1,0,
51,255,255,6,0,0,
25,
51,255,255,6,0,219,15,73,64,
31,
-56,2,0,
+55,2,0,
51,255,255,6,0,0,
25,
51,255,255,6,0,0,0,64,64,
31,
-56,3,0,
+55,3,0,
51,255,255,6,0,0,
25,
51,255,255,6,0,0,0,128,64,
31,
-56,4,0,
+55,4,0,
51,255,255,6,0,0,
25,
51,255,255,6,0,0,0,64,64,
31,
-56,5,0,
+55,5,0,
51,255,255,6,0,0,
25,
51,255,255,6,0,0,0,16,65,
29,11,0,
2,
52,1,2,0,
-55,85,0,
+54,83,0,
17,92,2,
51,255,255,62,0,2,
-55,86,0,
+54,84,0,
17,95,2,
51,255,255,62,0,2,2,0,
0,0,
1,0,3,
-56,85,0,
+55,83,0,
51,255,255,62,0,0,
1,
-57,10,0,0,2,
+56,10,0,0,2,
1,
27,
51,255,255,62,0,255,255,98,2,3,
@@ -473,13 +529,13 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
51,255,255,62,0,1,
25,
51,255,255,6,0,0,0,0,192,
-57,7,0,0,
-57,8,0,0,0,
-57,6,0,0,
-56,86,0,
+56,7,0,0,
+56,8,0,0,0,
+56,6,0,0,
+55,84,0,
51,255,255,62,0,0,
1,
-57,10,0,0,2,
+56,10,0,0,2,
1,
27,
51,255,255,62,0,255,255,98,2,3,
@@ -487,36 +543,36 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
51,255,255,62,0,1,
25,
51,255,255,6,0,0,0,0,192,
-57,8,0,0,
-57,9,0,0,0,
-57,7,0,0,
+56,8,0,0,
+56,9,0,0,0,
+56,7,0,0,
44,
27,
51,255,255,6,0,255,255,102,2,2,
27,
51,255,255,6,0,255,255,106,2,2,
-57,85,0,0,
-57,85,0,0,
+56,83,0,0,
+56,83,0,0,
27,
51,255,255,6,0,255,255,106,2,2,
-57,86,0,0,
-57,86,0,0,1,
+56,84,0,0,
+56,84,0,0,1,
29,17,0,
2,
52,1,1,0,
-55,87,0,
+54,85,0,
17,110,2,
51,255,255,6,0,2,1,0,
0,0,2,
-56,87,0,
+55,85,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,11,0,5,
-57,12,0,0,
-57,13,0,0,
-57,14,0,0,
-57,15,0,0,
-57,16,0,0,
+56,12,0,0,
+56,13,0,0,
+56,14,0,0,
+56,15,0,0,
+56,16,0,0,
44,
27,
51,255,255,6,0,255,255,102,2,2,
@@ -525,28 +581,28 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
27,
51,255,255,6,0,255,255,117,2,1,
1,
-57,4,0,0,2,
+56,4,0,0,2,
27,
51,255,255,6,0,255,255,117,2,1,
-57,87,0,0,
+56,85,0,0,
25,
51,255,255,6,0,0,0,128,63,1,
29,23,0,
2,
52,1,1,0,
-55,88,0,
+54,86,0,
17,110,2,
51,255,255,6,0,2,1,0,
0,0,2,
-56,88,0,
+55,86,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,11,0,5,
-57,18,0,0,
-57,19,0,0,
-57,20,0,0,
-57,21,0,0,
-57,22,0,0,
+56,18,0,0,
+56,19,0,0,
+56,20,0,0,
+56,21,0,0,
+56,22,0,0,
44,
27,
51,255,255,6,0,255,255,112,2,1,
@@ -556,8 +612,8 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
27,
51,255,255,6,0,255,255,102,2,2,
1,
-57,5,0,0,2,
-57,88,0,0,
+56,5,0,0,2,
+56,86,0,0,
25,
51,255,255,6,0,0,0,128,63,2,
25,
@@ -565,25 +621,25 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
29,28,0,
2,
52,1,7,0,
-55,89,0,
+54,87,0,
17,127,2,
51,255,255,62,0,2,
-55,90,0,
+54,88,0,
17,110,2,
51,255,255,6,0,2,
-55,91,0,
+54,89,0,
17,129,2,
51,255,255,62,0,2,
-55,92,0,
+54,90,0,
17,132,2,
51,255,255,6,0,2,
-55,93,0,
+54,91,0,
17,135,2,
51,255,255,6,0,2,
-55,94,0,
+54,92,0,
17,146,2,
51,255,255,6,0,2,
-55,95,0,
+54,93,0,
17,152,2,
51,255,255,6,0,2,7,0,
0,0,
@@ -593,7 +649,7 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
1,0,
5,0,
4,0,11,
-56,89,0,
+55,87,0,
51,255,255,62,0,0,
1,
1,
@@ -601,31 +657,31 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
51,255,255,62,0,255,255,158,2,2,
27,
51,255,255,62,0,255,255,158,2,2,
-57,24,0,0,
-57,25,0,0,
-57,26,0,0,0,
+56,24,0,0,
+56,25,0,0,
+56,26,0,0,0,
27,
51,255,255,62,0,255,255,102,2,2,
27,
51,255,255,62,0,255,255,102,2,2,
-57,24,0,0,
-57,25,0,0,
-57,26,0,0,2,
+56,24,0,0,
+56,25,0,0,
+56,26,0,0,2,
25,
51,255,255,6,0,0,0,0,63,
22,
1,
-57,24,0,2,23,
-57,89,0,0,
+56,24,0,2,23,
+56,87,0,0,
22,
1,
-57,25,0,2,23,
-57,89,0,0,
+56,25,0,2,23,
+56,87,0,0,
22,
1,
-57,26,0,2,23,
-57,89,0,0,
-56,90,0,
+56,26,0,2,23,
+56,87,0,0,
+55,88,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,255,255,117,2,1,
@@ -635,17 +691,17 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
51,255,255,6,0,255,255,102,2,2,
27,
51,255,255,6,0,255,255,106,2,2,
-57,24,0,0,
-57,24,0,0,
+56,24,0,0,
+56,24,0,0,
27,
51,255,255,6,0,255,255,106,2,2,
-57,25,0,0,
-57,25,0,0,
+56,25,0,0,
+56,25,0,0,
27,
51,255,255,6,0,255,255,106,2,2,
-57,26,0,0,
-57,26,0,0,
-56,91,0,
+56,26,0,0,
+56,26,0,0,
+55,89,0,
51,255,255,62,0,0,
1,
27,
@@ -655,11 +711,11 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
1,
25,
51,255,255,6,0,0,0,0,192,2,
-57,27,0,0,
-57,25,0,0,
-57,24,0,0,0,
-57,26,0,0,
-56,92,0,
+56,27,0,0,
+56,25,0,0,
+56,24,0,0,0,
+56,26,0,0,
+55,90,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,255,255,162,2,1,
@@ -667,10 +723,10 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
51,255,255,6,0,255,255,98,2,3,
25,
51,255,255,6,0,0,0,0,192,
-57,27,0,0,
+56,27,0,0,
25,
51,255,255,6,0,0,0,0,64,
-56,93,0,
+55,91,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,255,255,102,2,2,
@@ -678,50 +734,50 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
51,255,255,6,0,0,0,0,0,
27,
51,255,255,6,0,255,255,98,2,3,
-57,90,0,0,
-57,3,0,0,
+56,88,0,0,
+56,3,0,0,
25,
51,255,255,6,0,0,0,128,191,
-56,94,0,
+55,92,0,
51,255,255,6,0,0,
1,
1,
27,
51,255,255,6,0,255,255,166,2,1,
-57,91,0,0,2,
-57,3,0,0,0,
+56,89,0,0,2,
+56,3,0,0,0,
1,
-57,93,0,0,2,
-57,92,0,0,
-56,95,0,
+56,91,0,0,2,
+56,90,0,0,
+55,93,0,
51,255,255,6,0,0,
1,
25,
51,255,255,6,0,0,0,128,64,2,
27,
51,255,255,6,0,255,255,158,2,2,
-57,27,0,0,
+56,27,0,0,
25,
51,255,255,6,0,0,0,128,63,
44,
1,
-57,94,0,0,3,
-57,95,0,0,1,
+56,92,0,0,3,
+56,93,0,0,1,
29,33,0,
2,
52,1,1,0,
-55,96,0,
+54,94,0,
17,173,2,
51,255,255,6,0,2,1,0,
0,0,2,
-56,96,0,
+55,94,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,28,0,4,
-57,29,0,0,
-57,30,0,0,
-57,31,0,0,
-57,32,0,0,
+56,29,0,0,
+56,30,0,0,
+56,31,0,0,
+56,32,0,0,
44,
27,
51,255,255,6,0,255,255,102,2,2,
@@ -729,24 +785,24 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
51,255,255,6,0,255,255,112,2,1,
27,
51,255,255,6,0,255,255,117,2,1,
-57,96,0,0,
+56,94,0,0,
25,
51,255,255,6,0,0,0,128,63,1,
29,38,0,
2,
52,1,1,0,
-55,97,0,
+54,95,0,
17,173,2,
51,255,255,6,0,2,1,0,
0,0,2,
-56,97,0,
+55,95,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,28,0,4,
-57,34,0,0,
-57,35,0,0,
-57,36,0,0,
-57,37,0,0,
+56,34,0,0,
+56,35,0,0,
+56,36,0,0,
+56,37,0,0,
44,
27,
51,255,255,6,0,255,255,112,2,1,
@@ -755,7 +811,7 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
51,255,255,6,0,255,255,122,2,1,
27,
51,255,255,6,0,255,255,102,2,2,
-57,97,0,0,
+56,95,0,0,
25,
51,255,255,6,0,0,0,128,63,2,
25,
@@ -763,18 +819,18 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
29,41,0,
2,
52,1,1,0,
-55,98,0,
+54,96,0,
17,176,2,
51,255,255,62,0,2,1,0,
0,0,2,
-56,98,0,
+55,96,0,
51,255,255,62,0,0,
1,
-57,39,0,0,1,
-57,40,0,0,
+56,39,0,0,1,
+56,40,0,0,
32,0,
1,
-57,98,0,0,16,
+56,96,0,0,16,
13,
51,255,255,62,0,1,
25,
@@ -788,11 +844,11 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
51,255,255,6,0,0,0,0,0,1,
2,
52,1,1,0,
-55,99,0,
+54,97,0,
17,181,2,
51,255,255,6,0,2,1,0,
0,0,2,
-56,99,0,
+55,97,0,
51,255,255,6,0,0,
1,
25,
@@ -802,17 +858,17 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
27,
51,255,255,6,0,255,255,162,2,1,
50,
-57,98,0,0,1,0,
+56,96,0,0,1,0,
27,
51,255,255,6,0,255,255,162,2,1,
50,
-57,98,0,0,1,1,
+56,96,0,0,1,1,
44,
27,
51,255,255,62,0,255,255,188,2,1,
1,
-57,99,0,0,2,
-57,98,0,0,1,1,
+56,97,0,0,2,
+56,96,0,0,1,1,
29,44,0,
2,
52,1,0,0,0,0,1,
@@ -821,8 +877,8 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
51,255,255,6,0,255,255,198,2,3,
27,
51,255,255,6,0,255,255,106,2,2,
-57,42,0,0,
-57,43,0,0,
+56,42,0,0,
+56,43,0,0,
25,
51,255,255,6,0,0,0,128,191,
25,
@@ -830,15 +886,15 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
29,47,0,
2,
52,1,1,0,
-55,100,0,
+54,98,0,
17,204,2,
51,255,255,6,0,2,1,0,
0,0,2,
-56,100,0,
+55,98,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,255,255,98,2,3,
-57,45,0,0,
+56,45,0,0,
25,
51,255,255,6,0,0,0,0,63,
25,
@@ -848,17 +904,17 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
1,
1,
1,
-57,100,0,0,2,
-57,46,0,0,2,
-57,46,0,0,21,
+56,98,0,0,2,
+56,46,0,0,2,
+56,46,0,0,21,
25,
51,255,255,6,0,0,0,128,63,
27,
51,255,255,6,0,255,255,206,2,1,
-57,100,0,0,
+56,98,0,0,
27,
51,255,255,6,0,255,255,117,2,1,
-57,100,0,0,1,
+56,98,0,0,1,
29,49,0,
2,
52,1,0,0,0,0,1,
@@ -876,7 +932,7 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
1,
25,
51,255,255,6,0,0,0,128,62,3,
-57,48,0,0,
+56,48,0,0,
25,
51,255,255,6,0,0,0,128,191,1,
29,53,0,
@@ -886,91 +942,91 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
27,
51,255,255,6,0,255,255,98,2,3,
1,
-57,51,0,0,1,
-57,50,0,0,
-57,52,0,0,
-57,50,0,0,1,
-29,58,0,
+56,51,0,0,1,
+56,50,0,0,
+56,52,0,0,
+56,50,0,0,1,
+29,57,0,
2,
52,1,0,0,0,0,1,
44,
27,
51,255,255,62,0,255,255,98,2,3,
1,
-57,55,0,0,1,
-57,54,0,0,
+56,55,0,0,1,
+56,54,0,0,
13,
51,255,255,62,0,1,
-57,56,0,0,
-57,54,0,0,1,
-29,63,0,
+56,56,0,0,
+56,54,0,0,1,
+29,61,0,
2,
52,1,0,0,0,0,1,
44,
27,
51,255,255,136,1,255,255,98,2,3,
1,
-57,60,0,0,1,
-57,59,0,0,
-57,61,0,0,
-57,59,0,0,1,
-29,68,0,
+56,59,0,0,1,
+56,58,0,0,
+56,60,0,0,
+56,58,0,0,1,
+29,66,0,
2,
52,1,1,0,
-55,101,0,
+54,99,0,
17,223,2,
51,255,255,62,0,2,1,0,
0,0,3,
-56,101,0,
+55,99,0,
51,255,255,62,0,0,
-58,
+57,
32,0,
27,
51,255,255,234,2,255,255,239,2,1,
50,
-57,67,0,0,1,2,
+56,65,0,0,1,2,
2,
52,1,0,0,0,0,1,
22,
1,
-57,101,0,1,15,
+56,99,0,1,15,
53,
1,
-57,64,0,0,17,
+56,62,0,0,17,
25,
51,255,255,6,0,0,0,0,0,
50,
-57,66,0,0,2,2,3,
+56,64,0,0,2,2,3,
53,
1,
-57,65,0,0,17,
+56,63,0,0,17,
25,
51,255,255,6,0,0,0,0,0,
50,
-57,67,0,0,2,0,1,
+56,65,0,0,2,0,1,
50,
-57,66,0,0,2,0,1,1,
+56,64,0,0,2,0,1,1,
2,
52,1,7,0,
-55,102,0,
+54,100,0,
17,59,0,
51,255,255,62,0,2,
-55,103,0,
+54,101,0,
17,69,0,
51,255,255,62,0,2,
-55,104,0,
+54,102,0,
17,72,0,
51,255,255,62,0,2,
-55,105,0,
+54,103,0,
17,75,0,
51,255,255,62,0,2,
-55,106,0,
+54,104,0,
17,166,0,
51,255,255,6,0,2,
-55,107,0,
+54,105,0,
17,245,2,
51,255,255,6,0,2,
-55,108,0,
+54,106,0,
17,5,3,
51,255,255,6,0,2,7,0,
6,0,
@@ -981,99 +1037,99 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
3,0,
4,0,7,
2,
-58,4,
-56,102,0,
+57,4,
+55,100,0,
51,255,255,62,0,0,
50,
-57,66,0,0,2,0,1,
-56,103,0,
+56,64,0,0,2,0,1,
+55,101,0,
51,255,255,62,0,0,
50,
-57,66,0,0,2,2,3,
-56,104,0,
+56,64,0,0,2,2,3,
+55,102,0,
51,255,255,62,0,0,
50,
-57,67,0,0,2,0,1,
-56,105,0,
+56,65,0,0,2,0,1,
+55,103,0,
51,255,255,62,0,0,
50,
-57,67,0,0,2,2,3,2,
-56,106,0,
+56,65,0,0,2,2,3,2,
+55,104,0,
51,255,255,6,0,0,
25,
51,255,255,6,0,0,0,128,191,
-56,107,0,
+55,105,0,
51,255,255,6,0,0,
-58,
+57,
32,0,
27,
51,255,255,234,2,255,255,239,2,1,
50,
-57,67,0,0,1,3,
+56,65,0,0,1,3,
2,
52,1,0,0,0,0,4,
22,
1,
-57,106,0,1,15,
+56,104,0,1,15,
50,
-57,105,0,0,1,0,
+56,103,0,0,1,0,
22,
1,
-57,107,0,1,15,
+56,105,0,1,15,
27,
51,255,255,6,0,38,0,4,
-57,102,0,0,
-57,103,0,0,
-57,104,0,0,
-57,106,0,0,
+56,100,0,0,
+56,101,0,0,
+56,102,0,0,
+56,104,0,0,
22,
1,
-57,103,0,2,24,
-57,106,0,0,
+56,101,0,2,24,
+56,104,0,0,
22,
1,
-57,105,0,1,15,
-57,104,0,0,1,
+56,103,0,1,15,
+56,102,0,0,1,
2,
52,1,0,0,0,0,1,
22,
1,
-57,107,0,1,15,
+56,105,0,1,15,
27,
51,255,255,6,0,23,0,5,
-57,102,0,0,
-57,103,0,0,
-57,104,0,0,
-57,105,0,0,
+56,100,0,0,
+56,101,0,0,
+56,102,0,0,
+56,103,0,0,
10,
51,255,255,85,0,1,
25,
51,255,255,6,0,0,0,128,63,1,
32,0,
1,
-57,64,0,0,19,
-57,107,0,0,
+56,62,0,0,19,
+56,105,0,0,
2,
52,1,0,0,0,0,2,
22,
1,
-57,65,0,1,15,
+56,63,0,1,15,
27,
51,255,255,6,0,255,255,19,3,1,
27,
51,255,255,6,0,255,255,25,3,2,
-57,65,0,0,
+56,63,0,0,
12,
51,255,255,31,3,1,
1,
-57,107,0,0,1,
-57,64,0,0,
+56,105,0,0,1,
+56,62,0,0,
22,
1,
-57,64,0,1,15,
-57,107,0,0,1,
-58,
-56,108,0,
+56,62,0,1,15,
+56,105,0,0,1,
+57,
+55,106,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,255,255,19,3,1,
@@ -1082,53 +1138,53 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
51,255,255,6,0,0,0,0,63,0,
27,
51,255,255,6,0,255,255,25,3,2,
-57,65,0,0,
+56,63,0,0,
12,
51,255,255,31,3,1,
1,
25,
51,255,255,6,0,0,0,160,64,1,
-57,64,0,0,
+56,62,0,0,
32,0,
1,
1,
25,
51,255,255,6,0,0,0,0,0,18,
-57,108,0,0,8,
+56,106,0,0,8,
1,
-57,108,0,0,18,
+56,106,0,0,18,
25,
51,255,255,6,0,0,0,0,66,
2,
52,1,10,0,
-55,109,0,
+54,107,0,
17,120,1,
51,255,255,6,0,2,
-55,110,0,
+54,108,0,
17,35,3,
51,255,255,62,0,2,
-55,111,0,
+54,109,0,
17,38,3,
51,255,255,62,0,2,
-55,112,0,
+54,110,0,
17,41,3,
51,255,255,62,0,2,
-55,113,0,
+54,111,0,
17,44,3,
51,255,255,62,0,2,
-55,114,0,
+54,112,0,
17,48,3,
51,255,255,62,0,2,
-55,115,0,
+54,113,0,
17,52,3,
51,255,255,62,0,2,
-55,116,0,
+54,114,0,
17,57,3,
51,255,255,6,0,2,
-55,117,0,
+54,115,0,
17,59,3,
51,255,255,6,0,2,
-55,118,0,
+54,116,0,
17,61,3,
51,255,255,6,0,2,10,0,
0,0,
@@ -1141,200 +1197,200 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
7,0,
9,0,
8,0,11,
-56,109,0,
+55,107,0,
51,255,255,6,0,0,
1,
-57,108,0,0,2,
+56,106,0,0,2,
25,
51,255,255,6,0,0,0,0,61,
-56,110,0,
+55,108,0,
51,255,255,62,0,0,
27,
51,255,255,62,0,255,255,64,3,3,
-57,102,0,0,
-57,103,0,0,
-57,109,0,0,
-56,111,0,
+56,100,0,0,
+56,101,0,0,
+56,107,0,0,
+55,109,0,
51,255,255,62,0,0,
27,
51,255,255,62,0,255,255,64,3,3,
-57,103,0,0,
-57,104,0,0,
-57,109,0,0,
-56,112,0,
+56,101,0,0,
+56,102,0,0,
+56,107,0,0,
+55,110,0,
51,255,255,62,0,0,
27,
51,255,255,62,0,255,255,64,3,3,
-57,104,0,0,
-57,105,0,0,
-57,109,0,0,
-56,113,0,
+56,102,0,0,
+56,103,0,0,
+56,107,0,0,
+55,111,0,
51,255,255,62,0,0,
27,
51,255,255,62,0,255,255,64,3,3,
-57,110,0,0,
-57,111,0,0,
-57,109,0,0,
-56,114,0,
+56,108,0,0,
+56,109,0,0,
+56,107,0,0,
+55,112,0,
51,255,255,62,0,0,
27,
51,255,255,62,0,255,255,64,3,3,
-57,111,0,0,
-57,112,0,0,
-57,109,0,0,
-56,115,0,
+56,109,0,0,
+56,110,0,0,
+56,107,0,0,
+55,113,0,
51,255,255,62,0,0,
27,
51,255,255,62,0,255,255,64,3,3,
-57,113,0,0,
-57,114,0,0,
-57,109,0,0,
-56,116,0,
+56,111,0,0,
+56,112,0,0,
+56,107,0,0,
+55,114,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,255,255,64,3,3,
25,
51,255,255,6,0,0,0,128,63,
-57,106,0,0,
-57,109,0,0,
-56,117,0,
+56,104,0,0,
+56,107,0,0,
+55,115,0,
51,255,255,6,0,0,
1,
1,
-57,106,0,0,0,
+56,104,0,0,0,
25,
51,255,255,6,0,0,0,128,63,1,
-57,116,0,0,
-56,118,0,
+56,114,0,0,
+55,116,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,255,255,64,3,3,
-57,116,0,0,
-57,117,0,0,
-57,109,0,0,
+56,114,0,0,
+56,115,0,0,
+56,107,0,0,
22,
1,
-57,101,0,1,15,
+56,99,0,1,15,
53,
1,
-57,106,0,0,18,
+56,104,0,0,18,
25,
51,255,255,6,0,0,0,0,0,
-57,115,0,0,
+56,113,0,0,
1,
-57,113,0,0,3,
-57,118,0,0,1,
+56,111,0,0,3,
+56,116,0,0,1,
2,
52,1,0,0,0,0,1,
22,
1,
-57,101,0,1,15,
+56,99,0,1,15,
53,
1,
-57,108,0,0,16,
+56,106,0,0,16,
25,
51,255,255,6,0,0,0,0,0,
-57,102,0,0,
-57,105,0,0,1,1,
+56,100,0,0,
+56,103,0,0,1,1,
44,
-57,101,0,0,1,
-29,74,0,
+56,99,0,0,1,
+29,72,0,
2,
52,1,0,0,0,0,1,
32,0,
1,
-57,69,0,0,18,
+56,67,0,0,18,
25,
51,255,255,6,0,0,0,0,0,
2,
52,1,0,0,0,0,1,
44,
-57,73,0,0,1,
+56,71,0,0,1,
2,
52,1,0,0,0,0,1,
44,
27,
-51,255,255,62,0,68,0,4,
-57,69,0,0,
-57,70,0,0,
-57,71,0,0,
-57,72,0,0,1,1,
-29,84,0,
+51,255,255,62,0,66,0,4,
+56,67,0,0,
+56,68,0,0,
+56,69,0,0,
+56,70,0,0,1,1,
+29,82,0,
2,
52,1,25,0,
-55,119,0,
+54,117,0,
17,59,0,
51,255,255,62,0,2,
-55,120,0,
+54,118,0,
17,69,0,
51,255,255,62,0,2,
-55,121,0,
+54,119,0,
17,72,0,
51,255,255,62,0,2,
-55,122,0,
+54,120,0,
17,75,0,
51,255,255,62,0,2,
-55,123,0,
+54,121,0,
17,166,0,
51,255,255,6,0,2,
-55,124,0,
+54,122,0,
17,68,3,
51,255,255,6,0,2,
-55,125,0,
+54,123,0,
17,90,3,
51,255,255,6,0,2,
-55,126,0,
+54,124,0,
17,103,3,
51,255,255,6,0,2,
-55,127,0,
+54,125,0,
17,112,3,
51,255,255,234,2,2,
-55,128,0,
+54,126,0,
17,123,3,
51,255,255,6,0,2,
-55,129,0,
+54,127,0,
17,150,3,
51,255,255,62,0,2,
-55,130,0,
+54,128,0,
17,155,3,
51,255,255,62,0,2,
-55,131,0,
+54,129,0,
17,160,3,
51,255,255,6,0,2,
-55,132,0,
+54,130,0,
17,175,3,
51,255,255,6,0,2,
-55,133,0,
+54,131,0,
17,180,3,
51,255,255,6,0,2,
-55,134,0,
+54,132,0,
17,34,1,
51,255,255,6,0,2,
-55,135,0,
+54,133,0,
17,195,3,
51,255,255,6,0,2,
-55,136,0,
+54,134,0,
17,204,3,
51,255,255,6,0,2,
-55,137,0,
+54,135,0,
17,222,3,
51,255,255,6,0,2,
-55,138,0,
+54,136,0,
17,235,3,
51,255,255,6,0,2,
-55,139,0,
+54,137,0,
17,250,3,
51,255,255,6,0,2,
-55,140,0,
+54,138,0,
17,14,4,
51,255,255,234,2,2,
-55,141,0,
+54,139,0,
17,26,4,
51,255,255,62,0,2,
-55,142,0,
+54,140,0,
17,34,4,
51,255,255,62,0,2,
-55,143,0,
+54,141,0,
17,46,4,
51,255,255,62,0,2,25,0,
14,0,
@@ -1363,24 +1419,24 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
13,0,
4,0,35,
2,
-58,4,
-56,119,0,
+57,4,
+55,117,0,
51,255,255,62,0,0,
50,
-57,80,0,0,2,0,1,
-56,120,0,
+56,78,0,0,2,0,1,
+55,118,0,
51,255,255,62,0,0,
50,
-57,80,0,0,2,2,3,
-56,121,0,
+56,78,0,0,2,2,3,
+55,119,0,
51,255,255,62,0,0,
50,
-57,81,0,0,2,0,1,
-56,122,0,
+56,79,0,0,2,0,1,
+55,120,0,
51,255,255,62,0,0,
50,
-57,81,0,0,2,2,3,2,
-56,123,0,
+56,79,0,0,2,2,3,2,
+55,121,0,
51,255,255,6,0,0,
25,
51,255,255,6,0,0,0,128,191,
@@ -1388,25 +1444,25 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
27,
51,255,255,234,2,255,255,239,2,1,
50,
-57,81,0,0,1,3,
+56,79,0,0,1,3,
2,
52,1,0,0,0,0,2,
22,
1,
-57,123,0,1,15,
+56,121,0,1,15,
50,
-57,122,0,0,1,0,
+56,120,0,0,1,0,
22,
1,
-57,122,0,1,15,
-57,121,0,0,1,
-58,
-56,124,0,
+56,120,0,1,15,
+56,119,0,0,1,
+57,
+55,122,0,
51,255,255,6,0,0,
-58,
+57,
32,0,
1,
-57,123,0,0,18,
+56,121,0,0,18,
25,
51,255,255,6,0,0,0,0,0,
2,
@@ -1414,162 +1470,162 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
32,0,
1,
1,
-57,119,0,0,16,
-57,120,0,0,8,
+56,117,0,0,16,
+56,118,0,0,8,
1,
-57,121,0,0,16,
-57,122,0,0,
+56,119,0,0,16,
+56,120,0,0,
2,
52,1,0,0,0,0,1,
22,
1,
-57,124,0,1,15,
+56,122,0,1,15,
25,
51,255,255,6,0,0,0,128,63,1,
2,
52,1,0,0,0,0,1,
22,
1,
-57,124,0,1,15,
+56,122,0,1,15,
27,
51,255,255,6,0,17,0,5,
-57,119,0,0,
-57,120,0,0,
-57,121,0,0,
-57,122,0,0,
-57,77,0,0,1,1,
+56,117,0,0,
+56,118,0,0,
+56,119,0,0,
+56,120,0,0,
+56,75,0,0,1,1,
2,
52,1,0,0,0,0,1,
22,
1,
-57,124,0,1,15,
+56,122,0,1,15,
27,
51,255,255,6,0,33,0,4,
1,
-57,77,0,0,2,
-57,119,0,0,
+56,75,0,0,2,
+56,117,0,0,
1,
-57,77,0,0,2,
-57,120,0,0,
+56,75,0,0,2,
+56,118,0,0,
1,
-57,77,0,0,2,
-57,121,0,0,
-57,123,0,0,1,
-56,125,0,
+56,75,0,0,2,
+56,119,0,0,
+56,121,0,0,1,
+55,123,0,
51,255,255,6,0,0,
50,
-57,83,0,0,1,0,
-56,126,0,
+56,81,0,0,1,0,
+55,124,0,
51,255,255,6,0,0,
50,
-57,83,0,0,1,1,
-56,127,0,
+56,81,0,0,1,1,
+55,125,0,
51,255,255,234,2,0,
1,
50,
-57,83,0,0,1,0,16,
+56,81,0,0,1,0,16,
25,
51,255,255,6,0,0,0,0,0,
-56,128,0,
+55,126,0,
51,255,255,6,0,0,
-58,
+57,
32,0,
-57,127,0,0,
+56,125,0,0,
2,
52,1,0,0,0,0,2,
22,
1,
-57,128,0,1,15,
+56,126,0,1,15,
27,
51,255,255,6,0,49,0,1,
25,
51,255,255,6,0,0,0,128,63,
22,
1,
-57,125,0,1,15,
+56,123,0,1,15,
25,
51,255,255,6,0,0,0,0,63,1,
2,
52,1,0,0,0,0,1,
22,
1,
-57,128,0,1,15,
+56,126,0,1,15,
27,
51,255,255,6,0,49,0,1,
1,
-57,79,0,0,2,
+56,77,0,0,2,
50,
-57,83,0,0,1,0,1,
+56,81,0,0,1,0,1,
32,0,
-57,127,0,0,
+56,125,0,0,
2,
52,1,0,0,0,0,5,
22,
1,
-57,119,0,1,15,
+56,117,0,1,15,
1,
-57,77,0,0,2,
-57,119,0,0,
+56,75,0,0,2,
+56,117,0,0,
22,
1,
-57,120,0,1,15,
+56,118,0,1,15,
1,
-57,77,0,0,2,
-57,120,0,0,
+56,75,0,0,2,
+56,118,0,0,
22,
1,
-57,121,0,1,15,
+56,119,0,1,15,
1,
-57,77,0,0,2,
-57,121,0,0,
+56,75,0,0,2,
+56,119,0,0,
22,
1,
-57,122,0,1,15,
+56,120,0,1,15,
1,
-57,77,0,0,2,
-57,122,0,0,
+56,75,0,0,2,
+56,120,0,0,
22,
1,
-57,82,0,1,15,
+56,80,0,1,15,
1,
-57,77,0,0,2,
-57,82,0,0,1,
-58,
-56,129,0,
+56,75,0,0,2,
+56,80,0,0,1,
+57,
+55,127,0,
51,255,255,62,0,0,
27,
51,255,255,62,0,41,0,2,
53,
1,
-57,119,0,0,16,
-57,120,0,0,
+56,117,0,0,16,
+56,118,0,0,
53,
1,
-57,120,0,0,16,
-57,121,0,0,
-57,122,0,0,
-57,121,0,0,
-57,120,0,0,
-57,119,0,0,
-56,130,0,
+56,118,0,0,16,
+56,119,0,0,
+56,120,0,0,
+56,119,0,0,
+56,118,0,0,
+56,117,0,0,
+55,128,0,
51,255,255,62,0,0,
27,
51,255,255,62,0,41,0,2,
-57,122,0,0,
+56,120,0,0,
53,
1,
-57,122,0,0,16,
-57,121,0,0,
+56,120,0,0,16,
+56,119,0,0,
53,
1,
-57,121,0,0,16,
-57,120,0,0,
-57,119,0,0,
-57,120,0,0,
-57,121,0,0,
+56,119,0,0,16,
+56,118,0,0,
+56,117,0,0,
+56,118,0,0,
+56,119,0,0,
32,0,
1,
-57,129,0,0,16,
+56,127,0,0,16,
13,
51,255,255,62,0,1,
25,
@@ -1578,7 +1634,7 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
52,1,0,0,0,0,2,
22,
1,
-57,129,0,1,15,
+56,127,0,1,15,
8,
51,255,255,62,0,2,
25,
@@ -1587,304 +1643,304 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
51,255,255,6,0,0,0,0,0,
22,
1,
-57,130,0,1,15,
+56,128,0,1,15,
8,
51,255,255,62,0,2,
25,
51,255,255,6,0,0,0,128,191,
25,
51,255,255,6,0,0,0,0,0,1,
-58,
-56,131,0,
+57,
+55,129,0,
51,255,255,6,0,0,
-58,
+57,
32,0,
1,
-57,126,0,0,21,
+56,124,0,0,21,
25,
51,255,255,6,0,0,0,0,0,
2,
52,1,0,0,0,0,1,
22,
1,
-57,131,0,1,15,
+56,129,0,1,15,
1,
1,
27,
51,255,255,6,0,255,255,52,4,1,
-57,126,0,0,0,
+56,124,0,0,0,
25,
51,255,255,6,0,0,0,128,63,0,
25,
51,255,255,6,0,0,0,0,64,1,
2,
52,1,3,0,
-55,144,0,
+54,142,0,
17,57,4,
51,255,255,62,0,2,
-55,145,0,
+54,143,0,
17,65,4,
51,255,255,6,0,2,
-55,146,0,
+54,144,0,
17,74,4,
51,255,255,6,0,2,3,0,
1,0,
2,0,
0,0,5,
-56,144,0,
+55,142,0,
51,255,255,62,0,0,
27,
51,255,255,62,0,41,0,2,
-57,119,0,0,
-57,82,0,0,
-56,145,0,
+56,117,0,0,
+56,80,0,0,
+55,143,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,255,255,218,2,1,
27,
51,255,255,6,0,44,0,2,
-57,144,0,0,
-57,129,0,0,
-56,146,0,
+56,142,0,0,
+56,127,0,0,
+55,144,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,255,255,102,2,2,
27,
51,255,255,6,0,255,255,112,2,1,
1,
-57,145,0,0,2,
-57,128,0,0,
+56,143,0,0,2,
+56,126,0,0,
25,
51,255,255,6,0,0,0,128,63,
22,
1,
-57,131,0,1,15,
+56,129,0,1,15,
1,
-57,146,0,0,0,
+56,144,0,0,0,
25,
51,255,255,6,0,0,0,0,64,
22,
1,
-57,131,0,1,15,
+56,129,0,1,15,
27,
51,255,255,6,0,255,255,158,2,2,
-57,131,0,0,
+56,129,0,0,
1,
-57,76,0,0,1,
+56,74,0,0,1,
25,
51,255,255,6,0,0,0,0,64,1,
-56,132,0,
+55,130,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,255,255,98,4,2,
1,
-57,121,0,0,1,
-57,119,0,0,
+56,119,0,0,1,
+56,117,0,0,
1,
-57,122,0,0,1,
-57,120,0,0,
-56,133,0,
+56,120,0,0,1,
+56,118,0,0,
+55,131,0,
51,255,255,6,0,0,
1,
27,
51,255,255,6,0,255,255,162,2,1,
-57,75,0,0,1,
-57,131,0,0,
+56,73,0,0,1,
+56,129,0,0,
32,0,
1,
-57,133,0,0,18,
+56,131,0,0,18,
25,
51,255,255,6,0,0,0,0,0,
2,
52,1,0,0,0,0,3,
22,
1,
-57,130,0,1,15,
-57,129,0,0,
+56,128,0,1,15,
+56,127,0,0,
32,0,
1,
-57,82,0,0,17,
-57,119,0,0,
+56,80,0,0,17,
+56,117,0,0,
2,
52,1,0,0,0,0,1,
22,
1,
-57,129,0,1,15,
+56,127,0,1,15,
27,
51,255,255,62,0,41,0,2,
-57,119,0,0,
-57,82,0,0,1,
-58,
+56,117,0,0,
+56,80,0,0,1,
+57,
22,
1,
-57,132,0,1,15,
+56,130,0,1,15,
27,
51,255,255,6,0,255,255,98,4,2,
-57,129,0,0,
-57,130,0,0,1,
-58,
-56,134,0,
+56,127,0,0,
+56,128,0,0,1,
+57,
+55,132,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,44,0,2,
-57,129,0,0,
-57,130,0,0,
-56,135,0,
+56,127,0,0,
+56,128,0,0,
+55,133,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,255,255,218,2,1,
-57,134,0,0,
+56,132,0,0,
32,0,
1,
-57,132,0,0,18,
+56,130,0,0,18,
25,
51,255,255,6,0,0,0,0,0,
2,
52,1,0,0,0,0,1,
22,
1,
-57,135,0,1,15,
+56,133,0,1,15,
42,1,
-57,135,0,0,1,
-58,
-56,136,0,
+56,133,0,0,1,
+57,
+55,134,0,
51,255,255,6,0,0,
-58,
-56,137,0,
+57,
+55,135,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,255,255,52,4,1,
-57,75,0,0,
+56,73,0,0,
32,0,
1,
-57,133,0,0,18,
+56,131,0,0,18,
25,
51,255,255,6,0,0,0,0,0,
2,
52,1,2,0,
-55,147,0,
+54,145,0,
17,114,4,
51,255,255,6,0,2,
-55,148,0,
+54,146,0,
17,125,4,
51,255,255,234,2,2,2,0,
0,0,
1,0,8,
22,
1,
-57,136,0,1,15,
+56,134,0,1,15,
1,
-57,131,0,0,1,
+56,129,0,0,1,
25,
51,255,255,6,0,0,0,0,64,
22,
1,
-57,124,0,1,15,
+56,122,0,1,15,
25,
51,255,255,6,0,0,0,128,63,
22,
1,
-57,122,0,1,15,
+56,120,0,1,15,
1,
-57,121,0,1,15,
+56,119,0,1,15,
1,
-57,120,0,1,15,
-57,119,0,0,
+56,118,0,1,15,
+56,117,0,0,
22,
1,
-57,133,0,2,22,
+56,131,0,2,22,
1,
-57,136,0,0,0,
+56,134,0,0,0,
25,
51,255,255,6,0,0,0,128,63,
-56,147,0,
+55,145,0,
51,255,255,6,0,0,
25,
51,255,255,6,0,10,215,35,60,
-56,148,0,
+55,146,0,
51,255,255,234,2,0,
1,
1,
27,
51,255,255,6,0,255,255,162,2,1,
-57,132,0,0,2,
+56,130,0,0,2,
27,
51,255,255,6,0,255,255,206,2,1,
1,
27,
51,255,255,6,0,255,255,106,2,2,
-57,129,0,0,
-57,129,0,0,2,
+56,127,0,0,
+56,127,0,0,2,
27,
51,255,255,6,0,255,255,106,2,2,
-57,130,0,0,
-57,130,0,0,18,
-57,147,0,0,
+56,128,0,0,
+56,128,0,0,18,
+56,145,0,0,
32,0,
1,
42,7,
-57,148,0,0,9,
+56,146,0,0,9,
1,
27,
51,255,255,6,0,255,255,106,2,2,
-57,129,0,0,
-57,130,0,0,18,
+56,127,0,0,
+56,128,0,0,18,
25,
51,255,255,6,0,0,0,0,0,
2,
52,1,0,0,0,0,1,
32,0,
1,
-57,133,0,0,21,
+56,131,0,0,21,
25,
51,255,255,6,0,0,0,0,0,
2,
52,1,0,0,0,0,1,
22,
1,
-57,137,0,1,15,
+56,135,0,1,15,
53,
1,
-57,132,0,0,18,
+56,130,0,0,18,
25,
51,255,255,6,0,0,0,0,0,
27,
51,255,255,6,0,255,255,158,2,2,
-57,137,0,0,
+56,135,0,0,
25,
51,255,255,6,0,0,0,0,0,
27,
51,255,255,6,0,255,255,102,2,2,
-57,137,0,0,
+56,135,0,0,
25,
51,255,255,6,0,0,0,0,0,1,
-58,1,
-58,
+57,1,
+57,
22,
1,
-57,133,0,1,15,
+56,131,0,1,15,
27,
51,255,255,6,0,255,255,102,2,2,
-57,133,0,0,
+56,131,0,0,
25,
51,255,255,6,0,0,0,0,0,1,
2,
52,1,1,0,
-55,149,0,
+54,147,0,
17,148,4,
51,255,255,6,0,2,1,0,
0,0,4,
-56,149,0,
+55,147,0,
51,255,255,6,0,0,
1,
1,
-57,76,0,0,1,
-57,131,0,0,1,
+56,74,0,0,1,
+56,129,0,0,1,
25,
51,255,255,6,0,0,0,128,63,
22,
1,
-57,136,0,1,15,
+56,134,0,1,15,
27,
51,255,255,6,0,255,255,102,2,2,
27,
@@ -1892,196 +1948,196 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
1,
27,
51,255,255,6,0,255,255,162,2,1,
-57,135,0,0,2,
-57,128,0,0,
+56,133,0,0,2,
+56,126,0,0,
25,
51,255,255,6,0,0,0,128,63,
22,
1,
-57,136,0,1,15,
+56,134,0,1,15,
27,
51,255,255,6,0,255,255,158,2,2,
-57,136,0,0,
-57,149,0,0,
+56,134,0,0,
+56,147,0,0,
22,
1,
-57,124,0,1,15,
+56,122,0,1,15,
27,
51,255,255,6,0,255,255,158,2,2,
-57,124,0,0,
+56,122,0,0,
1,
1,
-57,149,0,0,1,
-57,136,0,0,0,
+56,147,0,0,1,
+56,134,0,0,0,
25,
51,255,255,6,0,0,0,128,63,1,
-56,138,0,
+55,136,0,
51,255,255,6,0,0,
1,
-57,135,0,0,3,
-57,136,0,0,
-56,139,0,
+56,133,0,0,3,
+56,134,0,0,
+55,137,0,
51,255,255,6,0,0,
1,
1,
-57,124,0,0,0,
-57,136,0,0,1,
+56,122,0,0,0,
+56,134,0,0,1,
25,
51,255,255,6,0,0,0,128,63,
-56,140,0,
+55,138,0,
51,255,255,234,2,0,
1,
-57,133,0,0,21,
-57,139,0,0,
+56,131,0,0,21,
+56,137,0,0,
32,0,
1,
-57,133,0,0,19,
-57,139,0,0,
+56,131,0,0,19,
+56,137,0,0,
2,
52,1,0,0,0,0,1,
22,
1,
-57,137,0,1,15,
+56,135,0,1,15,
25,
51,255,255,6,0,0,0,0,0,1,
-58,
+57,
32,0,
1,
1,
27,
51,255,255,6,0,255,255,162,2,1,
-57,75,0,0,16,
+56,73,0,0,16,
25,
51,255,255,6,0,0,0,0,64,8,
1,
-57,126,0,0,19,
+56,124,0,0,19,
25,
51,255,255,6,0,0,0,0,0,
2,
52,1,0,0,0,0,1,
22,
1,
-57,137,0,2,24,
+56,135,0,2,24,
27,
51,255,255,6,0,47,0,2,
-57,134,0,0,
-57,126,0,0,1,
-58,
+56,132,0,0,
+56,124,0,0,1,
+57,
2,
-58,2,
-56,141,0,
+57,2,
+55,139,0,
51,255,255,62,0,0,
-58,
-56,142,0,
+57,
+55,140,0,
51,255,255,62,0,0,
-58,2,
+57,2,
32,0,
1,
1,
-57,133,0,0,17,
+56,131,0,0,17,
25,
51,255,255,6,0,0,0,0,0,8,
42,7,
-57,140,0,0,
+56,138,0,0,
2,
52,1,33,0,
-55,150,0,
+54,148,0,
17,168,4,
51,255,255,62,0,2,
-55,151,0,
+54,149,0,
17,170,4,
51,255,255,62,0,2,
-55,152,0,
+54,150,0,
17,127,2,
51,255,255,62,0,2,
-55,153,0,
+54,151,0,
17,172,4,
51,255,255,62,0,2,
-55,154,0,
+54,152,0,
17,174,4,
51,255,255,62,0,2,
-55,155,0,
+54,153,0,
17,177,4,
51,255,255,62,0,2,
-55,156,0,
+54,154,0,
17,180,4,
51,255,255,6,0,2,
-55,157,0,
+54,155,0,
17,201,4,
51,255,255,6,0,2,
-55,158,0,
+54,156,0,
17,221,4,
51,255,255,6,0,2,
-55,159,0,
+54,157,0,
17,242,4,
51,255,255,6,0,2,
-55,160,0,
+54,158,0,
17,255,4,
51,255,255,6,0,2,
-55,161,0,
+54,159,0,
17,11,5,
51,255,255,6,0,2,
-55,162,0,
+54,160,0,
17,28,5,
51,255,255,6,0,2,
-55,163,0,
+54,161,0,
17,35,5,
51,255,255,6,0,2,
-55,164,0,
+54,162,0,
17,47,5,
51,255,255,62,0,2,
-55,165,0,
+54,163,0,
17,236,0,
51,255,255,6,0,2,
-55,166,0,
+54,164,0,
17,52,5,
51,255,255,6,0,2,
-55,167,0,
+54,165,0,
17,61,5,
51,255,255,6,0,2,
-55,168,0,
+54,166,0,
17,63,5,
51,255,255,6,0,2,
-55,169,0,
+54,167,0,
17,76,5,
51,255,255,6,0,2,
-55,170,0,
+54,168,0,
17,78,5,
51,255,255,6,0,2,
-55,171,0,
+54,169,0,
17,83,5,
51,255,255,62,0,2,
-55,172,0,
+54,170,0,
17,88,5,
51,255,255,6,0,2,
-55,173,0,
+54,171,0,
17,120,1,
51,255,255,6,0,2,
-55,174,0,
+54,172,0,
17,35,3,
51,255,255,62,0,2,
-55,175,0,
+54,173,0,
17,38,3,
51,255,255,62,0,2,
-55,176,0,
+54,174,0,
17,41,3,
51,255,255,62,0,2,
-55,177,0,
+54,175,0,
17,44,3,
51,255,255,62,0,2,
-55,178,0,
+54,176,0,
17,48,3,
51,255,255,62,0,2,
-55,179,0,
+54,177,0,
17,52,3,
51,255,255,62,0,2,
-55,180,0,
+54,178,0,
17,57,3,
51,255,255,6,0,2,
-55,181,0,
+54,179,0,
17,59,3,
51,255,255,6,0,2,
-55,182,0,
+54,180,0,
17,61,3,
51,255,255,6,0,2,33,0,
0,0,
@@ -2118,357 +2174,357 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
32,0,
31,0,39,
2,
-58,3,
-56,150,0,
+57,3,
+55,148,0,
51,255,255,62,0,0,
-58,
-56,151,0,
+57,
+55,149,0,
51,255,255,62,0,0,
-58,
-56,152,0,
+57,
+55,150,0,
51,255,255,62,0,0,
1,
-57,120,0,0,1,
-57,119,0,0,2,
-56,153,0,
+56,118,0,0,1,
+56,117,0,0,2,
+55,151,0,
51,255,255,62,0,0,
1,
-57,122,0,0,1,
-57,119,0,0,
+56,120,0,0,1,
+56,117,0,0,
32,0,
1,
-57,123,0,0,21,
+56,121,0,0,21,
25,
51,255,255,6,0,0,0,0,0,
2,
52,1,0,0,0,0,4,
22,
1,
-57,152,0,2,24,
-57,123,0,0,
+56,150,0,2,24,
+56,121,0,0,
22,
1,
-57,151,0,1,15,
+56,149,0,1,15,
1,
1,
25,
51,255,255,6,0,0,0,0,63,2,
-57,153,0,0,1,
-57,152,0,0,
+56,151,0,0,1,
+56,150,0,0,
22,
1,
-57,150,0,1,15,
+56,148,0,1,15,
1,
1,
-57,123,0,0,1,
+56,121,0,0,1,
25,
51,255,255,6,0,0,0,128,63,2,
-57,153,0,0,
+56,151,0,0,
22,
1,
-57,120,0,2,24,
-57,123,0,0,1,
+56,118,0,2,24,
+56,121,0,0,1,
2,
52,1,1,0,
-55,183,0,
+54,181,0,
17,96,5,
51,255,255,62,0,2,1,0,
0,0,3,
-56,183,0,
+55,181,0,
51,255,255,62,0,0,
1,
-57,121,0,0,1,
-57,120,0,0,
+56,119,0,0,1,
+56,118,0,0,
22,
1,
-57,151,0,1,15,
+56,149,0,1,15,
1,
-57,183,0,0,1,
-57,152,0,0,
+56,181,0,0,1,
+56,150,0,0,
22,
1,
-57,150,0,1,15,
+56,148,0,1,15,
27,
51,255,255,62,0,255,255,98,2,3,
13,
51,255,255,62,0,1,
25,
51,255,255,6,0,0,0,64,192,
-57,183,0,0,
-57,153,0,0,1,
-56,154,0,
+56,181,0,0,
+56,151,0,0,1,
+55,152,0,
51,255,255,62,0,0,
1,
-57,151,0,0,2,
+56,149,0,0,2,
1,
-57,124,0,0,2,
+56,122,0,0,2,
25,
51,255,255,6,0,0,0,0,64,
-56,155,0,
+55,153,0,
51,255,255,62,0,0,
1,
-57,152,0,0,2,
+56,150,0,0,2,
1,
-57,124,0,0,2,
-57,124,0,0,
-56,156,0,
+56,122,0,0,2,
+56,122,0,0,
+55,154,0,
51,255,255,6,0,0,
25,
51,255,255,6,0,0,0,0,0,
-56,157,0,
+55,155,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,255,255,158,2,2,
1,
-57,124,0,0,1,
+56,122,0,0,1,
25,
51,255,255,6,0,0,0,128,63,
-57,133,0,0,
-56,158,0,
+56,131,0,0,
+55,156,0,
51,255,255,6,0,0,
42,1,
27,
51,255,255,6,0,255,255,162,2,1,
-57,138,0,0,
-56,159,0,
+56,136,0,0,
+55,157,0,
51,255,255,6,0,0,
1,
1,
25,
51,255,255,6,0,0,0,128,63,0,
-57,133,0,0,2,
+56,131,0,0,2,
27,
51,255,255,6,0,255,255,162,2,1,
-57,138,0,0,
+56,136,0,0,
26,
52,1,1,0,
-55,184,0,
+54,182,0,
17,98,5,
51,255,255,31,3,2,1,0,
0,0,
-56,184,0,
+55,182,0,
51,255,255,31,3,0,
36,
51,255,255,31,3,4,0,0,0,
1,
-57,184,0,0,21,
+56,182,0,0,21,
36,
51,255,255,31,3,0,0,0,0,
42,33,
-57,184,0,2,
+56,182,0,2,
2,
52,1,1,0,
-55,185,0,
+54,183,0,
17,102,5,
51,255,255,6,0,2,1,0,
0,0,2,
-56,185,0,
+55,183,0,
51,255,255,6,0,0,
1,
-57,156,0,0,0,
+56,154,0,0,0,
27,
51,255,255,6,0,255,255,119,5,1,
12,
51,255,255,6,0,1,
-57,184,0,0,
+56,182,0,0,
32,0,
1,
-57,185,0,0,20,
-57,157,0,0,
+56,183,0,0,20,
+56,155,0,0,
2,
52,1,3,0,
-55,186,0,
+54,184,0,
17,124,5,
51,255,255,62,0,2,
-55,187,0,
+54,185,0,
17,132,5,
51,255,255,6,0,2,
-55,188,0,
+54,186,0,
17,144,5,
51,255,255,6,0,2,3,0,
1,0,
2,0,
0,0,6,
-56,186,0,
+55,184,0,
51,255,255,62,0,0,
27,
51,255,255,62,0,255,255,98,2,3,
13,
51,255,255,62,0,1,
-57,185,0,0,
-57,150,0,0,
-57,154,0,0,
+56,183,0,0,
+56,148,0,0,
+56,152,0,0,
22,
1,
-57,186,0,1,15,
+56,184,0,1,15,
27,
51,255,255,62,0,255,255,98,2,3,
13,
51,255,255,62,0,1,
-57,185,0,0,
-57,186,0,0,
-57,155,0,0,
-56,187,0,
+56,183,0,0,
+56,184,0,0,
+56,153,0,0,
+55,185,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,255,255,106,2,2,
27,
51,255,255,62,0,255,255,188,2,1,
-57,186,0,0,
-57,129,0,0,
-56,188,0,
+56,184,0,0,
+56,127,0,0,
+55,186,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,255,255,98,2,3,
-57,185,0,0,
-57,158,0,0,
-57,159,0,0,
+56,183,0,0,
+56,156,0,0,
+56,157,0,0,
22,
1,
-57,188,0,1,15,
+56,186,0,1,15,
27,
51,255,255,6,0,255,255,158,2,2,
-57,188,0,0,
-57,1,0,0,
+56,186,0,0,
+56,1,0,0,
32,0,
1,
-57,187,0,0,21,
+56,185,0,0,21,
27,
51,255,255,6,0,255,255,156,5,1,
-57,188,0,0,
+56,186,0,0,
2,
52,1,0,0,0,0,1,
22,
1,
-57,156,0,1,15,
-57,185,0,0,1,
-58,1,
-58,1,
-56,160,0,
+56,154,0,1,15,
+56,183,0,0,1,
+57,1,
+57,1,
+55,158,0,
51,255,255,6,0,0,
1,
-57,156,0,0,3,
-57,124,0,0,
-56,161,0,
+56,154,0,0,3,
+56,122,0,0,
+55,159,0,
51,255,255,6,0,0,
1,
-57,133,0,0,1,
-57,156,0,0,
-56,162,0,
+56,131,0,0,1,
+56,154,0,0,
+55,160,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,255,255,218,2,1,
27,
51,255,255,6,0,255,255,198,2,3,
50,
-57,129,0,0,1,0,
+56,127,0,0,1,0,
25,
51,255,255,6,0,0,0,128,191,
25,
51,255,255,6,0,0,0,128,63,
22,
1,
-57,162,0,1,15,
+56,160,0,1,15,
53,
1,
50,
-57,129,0,0,1,1,21,
+56,127,0,0,1,1,21,
25,
51,255,255,6,0,0,0,0,0,
-57,162,0,0,
+56,160,0,0,
42,1,
-57,162,0,0,
-56,163,0,
+56,160,0,0,
+55,161,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,255,255,98,2,3,
-57,161,0,0,
-57,138,0,0,
-57,162,0,0,
+56,159,0,0,
+56,136,0,0,
+56,160,0,0,
22,
1,
-57,141,0,1,15,
+56,139,0,1,15,
8,
51,255,255,62,0,2,
27,
51,255,255,6,0,255,255,156,5,1,
-57,163,0,0,
+56,161,0,0,
27,
51,255,255,6,0,255,255,160,5,1,
-57,163,0,0,
-56,164,0,
+56,161,0,0,
+55,162,0,
51,255,255,62,0,0,
8,
51,255,255,62,0,2,
42,1,
50,
-57,141,0,0,1,1,
+56,139,0,0,1,1,
50,
-57,141,0,0,1,0,
+56,139,0,0,1,0,
2,
-58,3,
-56,165,0,
+57,3,
+55,163,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,255,255,106,2,2,
-57,164,0,0,
-57,150,0,0,
-56,166,0,
+56,162,0,0,
+56,148,0,0,
+55,164,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,255,255,106,2,2,
-57,164,0,0,
-57,151,0,0,
-56,167,0,
+56,162,0,0,
+56,149,0,0,
+55,165,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,255,255,106,2,2,
-57,164,0,0,
-57,152,0,0,2,
-56,168,0,
+56,162,0,0,
+56,150,0,0,2,
+55,166,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,255,255,102,2,2,
1,
1,
-57,166,0,0,2,
-57,166,0,0,1,
+56,164,0,0,2,
+56,164,0,0,1,
1,
-57,165,0,0,2,
-57,167,0,0,
+56,163,0,0,2,
+56,165,0,0,
25,
51,255,255,6,0,0,0,0,0,
-56,169,0,
+55,167,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,255,255,117,2,1,
-57,168,0,0,
+56,166,0,0,
32,0,
1,
-57,166,0,0,19,
+56,164,0,0,19,
25,
51,255,255,6,0,0,0,0,0,
2,
52,1,0,0,0,0,1,
22,
1,
-57,169,0,1,15,
+56,167,0,1,15,
42,1,
-57,169,0,0,1,
-58,
+56,167,0,0,1,
+57,
22,
1,
-57,169,0,2,23,
-57,166,0,0,
-56,170,0,
+56,167,0,2,23,
+56,164,0,0,
+55,168,0,
51,255,255,6,0,0,
1,
1,
25,
51,255,255,6,0,0,0,0,191,2,
-57,169,0,0,2,
-57,165,0,0,
-56,171,0,
+56,167,0,0,2,
+56,163,0,0,
+55,169,0,
51,255,255,62,0,0,
53,
1,
@@ -2476,226 +2532,226 @@ static uint8_t SKSL_INCLUDE_sksl_graphite_vert[] = {11,0,162,5,
51,255,255,6,0,255,255,162,2,1,
27,
51,255,255,6,0,255,255,98,2,3,
-57,169,0,0,
-57,169,0,0,
-57,170,0,0,18,
+56,167,0,0,
+56,167,0,0,
+56,168,0,0,18,
27,
51,255,255,6,0,255,255,162,2,1,
27,
51,255,255,6,0,255,255,98,2,3,
-57,165,0,0,
-57,167,0,0,
-57,170,0,0,
+56,163,0,0,
+56,165,0,0,
+56,168,0,0,
8,
51,255,255,62,0,2,
-57,169,0,0,
-57,165,0,0,
+56,167,0,0,
+56,163,0,0,
8,
51,255,255,62,0,2,
-57,167,0,0,
-57,169,0,0,
-56,172,0,
+56,165,0,0,
+56,167,0,0,
+55,170,0,
51,255,255,6,0,0,
53,
1,
50,
-57,171,0,0,1,1,17,
+56,169,0,0,1,1,17,
25,
51,255,255,6,0,0,0,0,0,
1,
50,
-57,171,0,0,1,0,3,
+56,169,0,0,1,0,3,
50,
-57,171,0,0,1,1,
+56,169,0,0,1,1,
25,
51,255,255,6,0,0,0,0,0,
22,
1,
-57,172,0,1,15,
+56,170,0,1,15,
27,
51,255,255,6,0,255,255,198,2,3,
-57,172,0,0,
+56,170,0,0,
25,
51,255,255,6,0,0,0,0,0,
25,
51,255,255,6,0,0,0,128,63,
32,0,
1,
-57,161,0,0,16,
+56,159,0,0,16,
25,
51,255,255,6,0,0,0,0,0,
2,
52,1,0,0,0,0,1,
22,
1,
-57,172,0,1,15,
+56,170,0,1,15,
25,
51,255,255,6,0,0,0,0,0,1,
-58,
-56,173,0,
+57,
+55,171,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,255,255,102,2,2,
-57,160,0,0,
-57,172,0,0,
-56,174,0,
+56,158,0,0,
+56,170,0,0,
+55,172,0,
51,255,255,62,0,0,
27,
-51,255,255,62,0,58,0,3,
-57,119,0,0,
-57,120,0,0,
-57,173,0,0,
-56,175,0,
+51,255,255,62,0,57,0,3,
+56,117,0,0,
+56,118,0,0,
+56,171,0,0,
+55,173,0,
51,255,255,62,0,0,
27,
-51,255,255,62,0,58,0,3,
-57,120,0,0,
-57,121,0,0,
-57,173,0,0,
-56,176,0,
+51,255,255,62,0,57,0,3,
+56,118,0,0,
+56,119,0,0,
+56,171,0,0,
+55,174,0,
51,255,255,62,0,0,
27,
-51,255,255,62,0,58,0,3,
-57,121,0,0,
-57,122,0,0,
-57,173,0,0,
-56,177,0,
+51,255,255,62,0,57,0,3,
+56,119,0,0,
+56,120,0,0,
+56,171,0,0,
+55,175,0,
51,255,255,62,0,0,
27,
-51,255,255,62,0,58,0,3,
-57,174,0,0,
-57,175,0,0,
-57,173,0,0,
-56,178,0,
+51,255,255,62,0,57,0,3,
+56,172,0,0,
+56,173,0,0,
+56,171,0,0,
+55,176,0,
51,255,255,62,0,0,
27,
-51,255,255,62,0,58,0,3,
-57,175,0,0,
-57,176,0,0,
-57,173,0,0,
-56,179,0,
+51,255,255,62,0,57,0,3,
+56,173,0,0,
+56,174,0,0,
+56,171,0,0,
+55,177,0,
51,255,255,62,0,0,
27,
-51,255,255,62,0,58,0,3,
-57,177,0,0,
-57,178,0,0,
-57,173,0,0,
-56,180,0,
+51,255,255,62,0,57,0,3,
+56,175,0,0,
+56,176,0,0,
+56,171,0,0,
+55,178,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,53,0,3,
25,
51,255,255,6,0,0,0,128,63,
-57,123,0,0,
-57,173,0,0,
-56,181,0,
+56,121,0,0,
+56,171,0,0,
+55,179,0,
51,255,255,6,0,0,
1,
1,
-57,123,0,0,0,
+56,121,0,0,0,
25,
51,255,255,6,0,0,0,128,63,1,
-57,180,0,0,
-56,182,0,
+56,178,0,0,
+55,180,0,
51,255,255,6,0,0,
27,
51,255,255,6,0,53,0,3,
-57,180,0,0,
-57,181,0,0,
-57,173,0,0,
+56,178,0,0,
+56,179,0,0,
+56,171,0,0,
32,0,
1,
-57,173,0,0,17,
-57,172,0,0,
+56,171,0,0,17,
+56,170,0,0,
2,
52,1,0,0,0,0,1,
22,
1,
-57,141,0,1,15,
+56,139,0,1,15,
53,
1,
-57,123,0,0,21,
+56,121,0,0,21,
25,
51,255,255,6,0,0,0,0,0,
27,
51,255,255,62,0,41,0,2,
1,
-57,175,0,0,2,
-57,180,0,0,
+56,173,0,0,2,
+56,178,0,0,
1,
-57,174,0,0,2,
-57,181,0,0,
+56,172,0,0,2,
+56,179,0,0,
27,
51,255,255,62,0,41,0,2,
-57,178,0,0,
-57,177,0,0,1,
-58,
+56,176,0,0,
+56,175,0,0,1,
+57,
22,
1,
-57,142,0,1,15,
+56,140,0,1,15,
53,
1,
-57,123,0,0,21,
+56,121,0,0,21,
25,
51,255,255,6,0,0,0,0,0,
1,
-57,177,0,0,3,
-57,182,0,0,
-57,179,0,0,1,
+56,175,0,0,3,
+56,180,0,0,
+56,177,0,0,1,
2,
52,1,0,0,0,0,2,
22,
1,
-57,141,0,1,15,
+56,139,0,1,15,
53,
1,
-57,133,0,0,16,
+56,131,0,0,16,
25,
51,255,255,6,0,0,0,0,0,
-57,129,0,0,
-57,130,0,0,
+56,127,0,0,
+56,128,0,0,
22,
1,
-57,142,0,1,15,
+56,140,0,1,15,
53,
1,
-57,133,0,0,16,
+56,131,0,0,16,
25,
51,255,255,6,0,0,0,0,0,
-57,119,0,0,
-57,122,0,0,1,
-56,143,0,
+56,117,0,0,
+56,120,0,0,1,
+55,141,0,
51,255,255,62,0,0,
8,
51,255,255,62,0,2,
50,
-57,141,0,0,1,1,
+56,139,0,0,1,1,
42,1,
50,
-57,141,0,0,1,0,
+56,139,0,0,1,0,
22,
1,
-57,142,0,2,22,
+56,140,0,2,22,
1,
-57,143,0,0,2,
+56,141,0,0,2,
1,
-57,125,0,0,2,
-57,137,0,0,
+56,123,0,0,2,
+56,135,0,0,
32,0,
-57,127,0,0,
+56,125,0,0,
2,
52,1,0,0,0,0,1,
44,
1,
-57,142,0,0,0,
-57,78,0,0,1,
+56,140,0,0,0,
+56,76,0,0,1,
2,
52,1,0,0,0,0,1,
44,
1,
1,
-57,77,0,0,2,
-57,142,0,0,0,
-57,78,0,0,1,1,
+56,75,0,0,2,
+56,140,0,0,0,
+56,76,0,0,1,1,
21,};
static constexpr size_t SKSL_INCLUDE_sksl_graphite_vert_LENGTH = sizeof(SKSL_INCLUDE_sksl_graphite_vert);
diff --git a/chromium/third_party/skia/src/sksl/generated/sksl_interp.dehydrated.sksl b/chromium/third_party/skia/src/sksl/generated/sksl_interp.dehydrated.sksl
deleted file mode 100644
index d564c54afe8..00000000000
--- a/chromium/third_party/skia/src/sksl/generated/sksl_interp.dehydrated.sksl
+++ /dev/null
@@ -1,152 +0,0 @@
-static uint8_t SKSL_INCLUDE_sksl_interp[] = {81,0,
-1,120,
-9,36,103,101,110,73,84,121,112,101,
-1,121,
-3,109,105,110,
-3,105,110,116,
-3,109,97,120,
-6,109,105,110,86,97,108,
-6,109,97,120,86,97,108,
-5,99,108,97,109,112,
-8,36,103,101,110,84,121,112,101,
-1,97,
-9,36,103,101,110,66,84,121,112,101,
-3,109,105,120,
-9,36,103,101,110,72,84,121,112,101,
-42,42,0,
-46,1,0,
-9,2,0,
-43,2,0,4,0,3,
-46,3,0,
-9,14,0,
-40,2,0,3,
-23,4,0,
-9,16,0,2,1,0,3,0,
-40,2,0,
-46,5,0,
-9,2,0,
-40,2,0,3,
-46,6,0,
-9,14,0,
-43,7,0,20,0,3,
-45,8,0,2,
-40,4,0,
-23,9,0,
-9,16,0,2,5,0,6,0,
-40,2,0,
-40,9,0,
-46,10,0,
-9,2,0,
-40,2,0,3,
-46,11,0,
-9,14,0,
-40,2,0,3,
-23,12,0,
-9,24,0,2,10,0,11,0,
-40,2,0,
-46,13,0,
-9,2,0,
-40,2,0,3,
-46,14,0,
-9,14,0,
-40,7,0,3,
-45,15,0,2,
-40,12,0,
-23,16,0,
-9,24,0,2,13,0,14,0,
-40,2,0,
-40,16,0,
-46,17,0,
-9,2,0,
-40,2,0,3,
-46,18,0,
-9,28,0,
-40,2,0,3,
-46,19,0,
-9,35,0,
-40,2,0,3,
-23,20,0,
-9,42,0,3,17,0,18,0,19,0,
-40,2,0,
-46,21,0,
-9,2,0,
-40,2,0,3,
-46,22,0,
-9,28,0,
-40,7,0,3,
-46,23,0,
-9,35,0,
-40,7,0,3,
-45,24,0,2,
-40,20,0,
-23,25,0,
-9,42,0,3,21,0,22,0,23,0,
-40,2,0,
-40,25,0,
-46,26,0,
-9,2,0,
-43,27,0,48,0,3,
-46,28,0,
-9,14,0,
-40,27,0,3,
-46,29,0,
-9,57,0,
-43,30,0,59,0,3,
-23,31,0,
-9,69,0,3,26,0,28,0,29,0,
-40,27,0,
-46,32,0,
-9,2,0,
-43,33,0,73,0,3,
-46,34,0,
-9,14,0,
-40,33,0,3,
-46,35,0,
-9,57,0,
-40,30,0,3,
-45,36,0,2,
-40,31,0,
-23,37,0,
-9,69,0,3,32,0,34,0,35,0,
-40,33,0,
-40,37,0,
-46,38,0,
-9,2,0,
-40,2,0,3,
-46,39,0,
-9,14,0,
-40,2,0,3,
-46,40,0,
-9,57,0,
-40,30,0,3,
-45,41,0,3,
-40,31,0,
-40,37,0,
-23,42,0,
-9,69,0,3,38,0,39,0,40,0,
-40,2,0,
-40,42,0,
-46,43,0,
-9,2,0,
-40,30,0,3,
-46,44,0,
-9,14,0,
-40,30,0,3,
-46,45,0,
-9,57,0,
-40,30,0,3,
-45,46,0,4,
-40,31,0,
-40,37,0,
-40,42,0,
-23,47,0,
-9,69,0,3,43,0,44,0,45,0,
-40,30,0,
-40,47,0,4,0,
-21,0,
-12,0,
-5,0,
-40,0,
-12,
-13,};
-static constexpr size_t SKSL_INCLUDE_sksl_interp_LENGTH = sizeof(SKSL_INCLUDE_sksl_interp);
diff --git a/chromium/third_party/skia/src/sksl/generated/sksl_public.dehydrated.sksl b/chromium/third_party/skia/src/sksl/generated/sksl_public.dehydrated.sksl
index 571dad55b99..285dd89b5d3 100644
--- a/chromium/third_party/skia/src/sksl/generated/sksl_public.dehydrated.sksl
+++ b/chromium/third_party/skia/src/sksl/generated/sksl_public.dehydrated.sksl
@@ -1,2528 +1,77 @@
-static uint8_t SKSL_INCLUDE_sksl_public[] = {11,0,227,3,
-7,100,101,103,114,101,101,115,
-8,36,103,101,110,84,121,112,101,
-7,114,97,100,105,97,110,115,
-9,36,103,101,110,72,84,121,112,101,
-5,97,110,103,108,101,
-3,115,105,110,
-3,99,111,115,
-3,116,97,110,
-1,120,
-4,97,115,105,110,
-4,97,99,111,115,
-1,121,
-4,97,116,97,110,
-8,121,95,111,118,101,114,95,120,
-4,115,105,110,104,
-4,99,111,115,104,
-4,116,97,110,104,
-5,97,115,105,110,104,
-5,97,99,111,115,104,
-5,97,116,97,110,104,
-3,112,111,119,
-3,101,120,112,
-3,108,111,103,
-4,101,120,112,50,
-4,108,111,103,50,
-4,115,113,114,116,
-11,105,110,118,101,114,115,101,115,113,114,116,
-3,97,98,115,
-4,115,105,103,110,
-5,102,108,111,111,114,
-4,99,101,105,108,
-5,102,114,97,99,116,
-5,102,108,111,97,116,
-3,109,111,100,
-4,104,97,108,102,
-3,109,105,110,
-3,109,97,120,
-6,109,105,110,86,97,108,
-6,109,97,120,86,97,108,
-5,99,108,97,109,112,
-8,115,97,116,117,114,97,116,101,
-1,97,
-3,109,105,120,
-4,101,100,103,101,
-4,115,116,101,112,
-5,101,100,103,101,48,
-5,101,100,103,101,49,
-10,115,109,111,111,116,104,115,116,101,112,
-9,36,103,101,110,73,84,121,112,101,
-5,118,97,108,117,101,
-14,102,108,111,97,116,66,105,116,115,84,111,73,110,116,
-15,102,108,111,97,116,66,105,116,115,84,111,85,105,110,116,
-9,36,103,101,110,85,84,121,112,101,
-14,105,110,116,66,105,116,115,84,111,70,108,111,97,116,
-15,117,105,110,116,66,105,116,115,84,111,70,108,111,97,116,
-5,116,114,117,110,99,
-5,114,111,117,110,100,
-9,114,111,117,110,100,69,118,101,110,
-3,105,110,116,
-4,117,105,110,116,
-9,36,103,101,110,66,84,121,112,101,
-5,105,115,110,97,110,
-5,105,115,105,110,102,
-1,105,
-4,109,111,100,102,
-1,118,
-6,102,108,111,97,116,50,
-13,112,97,99,107,85,110,111,114,109,50,120,49,54,
-1,112,
-15,117,110,112,97,99,107,85,110,111,114,109,50,120,49,54,
-6,108,101,110,103,116,104,
-2,112,48,
-2,112,49,
-8,100,105,115,116,97,110,99,101,
-3,100,111,116,
-6,102,108,111,97,116,51,
-5,99,114,111,115,115,
-5,104,97,108,102,51,
-9,110,111,114,109,97,108,105,122,101,
-1,78,
-1,73,
-4,78,114,101,102,
-11,102,97,99,101,102,111,114,119,97,114,100,
-7,114,101,102,108,101,99,116,
-3,101,116,97,
-7,114,101,102,114,97,99,116,
-10,36,115,113,117,97,114,101,77,97,116,
-14,109,97,116,114,105,120,67,111,109,112,77,117,108,116,
-11,36,115,113,117,97,114,101,72,77,97,116,
-4,36,109,97,116,
-5,36,104,109,97,116,
-1,109,
-7,105,110,118,101,114,115,101,
-11,100,101,116,101,114,109,105,110,97,110,116,
-9,116,114,97,110,115,112,111,115,101,
-8,102,108,111,97,116,51,120,50,
-8,102,108,111,97,116,50,120,51,
-7,104,97,108,102,51,120,50,
-7,104,97,108,102,50,120,51,
-8,102,108,111,97,116,52,120,50,
-8,102,108,111,97,116,50,120,52,
-7,104,97,108,102,52,120,50,
-7,104,97,108,102,50,120,52,
-8,102,108,111,97,116,52,120,51,
-8,102,108,111,97,116,51,120,52,
-7,104,97,108,102,52,120,51,
-7,104,97,108,102,51,120,52,
-1,99,
-4,36,118,101,99,
-1,114,
-12,111,117,116,101,114,80,114,111,100,117,99,116,
-5,36,104,118,101,99,
-5,104,97,108,102,50,
-6,102,108,111,97,116,52,
-5,104,97,108,102,52,
-8,108,101,115,115,84,104,97,110,
-5,36,98,118,101,99,
-5,36,105,118,101,99,
-13,108,101,115,115,84,104,97,110,69,113,117,97,108,
-11,103,114,101,97,116,101,114,84,104,97,110,
-16,103,114,101,97,116,101,114,84,104,97,110,69,113,117,97,108,
-5,101,113,117,97,108,
-8,110,111,116,69,113,117,97,108,
-3,97,110,121,
-4,98,111,111,108,
-3,97,108,108,
-3,110,111,116,
-4,100,70,100,120,
-4,100,70,100,121,
-6,102,119,105,100,116,104,
+static constexpr uint8_t SKSL_INCLUDE_sksl_public[] = {14,0,107,0,
5,99,111,108,111,114,
-8,117,110,112,114,101,109,117,108,
+5,104,97,108,102,51,
12,116,111,76,105,110,101,97,114,83,114,103,98,
14,102,114,111,109,76,105,110,101,97,114,83,114,103,98,
6,99,111,111,114,100,115,
+6,102,108,111,97,116,50,
1,115,
6,115,104,97,100,101,114,
5,36,101,118,97,108,
+5,104,97,108,102,52,
1,102,
11,99,111,108,111,114,70,105,108,116,101,114,
3,115,114,99,
3,100,115,116,
1,98,
7,98,108,101,110,100,101,114,
-52,1,139,2,
-55,1,0,
+52,1,14,0,
+54,1,0,
17,2,0,
-51,255,255,10,0,3,
+51,255,255,8,0,3,
28,2,0,
-17,19,0,1,1,0,
-51,255,255,10,0,
-55,3,0,
+17,14,0,1,
+51,1,0,
+51,255,255,8,0,
+54,3,0,
17,2,0,
-51,255,255,27,0,3,
-54,4,0,2,
-51,2,0,
-28,5,0,
-17,19,0,1,3,0,
-51,255,255,27,0,
-51,5,0,
-55,6,0,
-17,19,0,
-51,255,255,10,0,3,
+51,255,255,8,0,3,
+28,4,0,
+17,27,0,1,
+51,3,0,
+51,255,255,8,0,
+54,5,0,
+17,42,0,
+51,255,255,49,0,3,
+54,6,0,
+17,56,0,
+51,255,255,58,0,3,
28,7,0,
-17,2,0,1,6,0,
-51,255,255,10,0,
-55,8,0,
-17,19,0,
-51,255,255,27,0,3,
-54,9,0,2,
-51,7,0,
+17,65,0,2,
+51,5,0,
+51,6,0,
+51,255,255,71,0,
+54,8,0,
+17,2,0,
+51,255,255,71,0,3,
+54,9,0,
+17,77,0,
+51,255,255,79,0,3,
28,10,0,
-17,2,0,1,8,0,
-51,255,255,27,0,
-51,10,0,
-55,11,0,
-17,37,0,
-51,255,255,10,0,3,
-28,12,0,
-17,43,0,1,11,0,
-51,255,255,10,0,
-55,13,0,
-17,37,0,
-51,255,255,27,0,3,
-54,14,0,2,
+17,65,0,2,
+51,8,0,
+51,9,0,
+51,255,255,71,0,
+54,11,0,
+17,91,0,
+51,255,255,71,0,3,
+54,12,0,
+17,95,0,
+51,255,255,71,0,3,
+54,13,0,
+17,99,0,
+51,255,255,101,0,3,
+28,14,0,
+17,65,0,3,
+51,11,0,
51,12,0,
-28,15,0,
-17,43,0,1,13,0,
-51,255,255,27,0,
-51,15,0,
-55,16,0,
-17,37,0,
-51,255,255,10,0,3,
-28,17,0,
-17,47,0,1,16,0,
-51,255,255,10,0,
-55,18,0,
-17,37,0,
-51,255,255,27,0,3,
-54,19,0,2,
-51,17,0,
-28,20,0,
-17,47,0,1,18,0,
-51,255,255,27,0,
-51,20,0,
-55,21,0,
-17,37,0,
-51,255,255,10,0,3,
-28,22,0,
-17,51,0,1,21,0,
-51,255,255,10,0,
-55,23,0,
-17,37,0,
-51,255,255,27,0,3,
-54,24,0,2,
-51,22,0,
-28,25,0,
-17,51,0,1,23,0,
-51,255,255,27,0,
-51,25,0,
-55,26,0,
-17,55,0,
-51,255,255,10,0,3,
-28,27,0,
-17,57,0,1,26,0,
-51,255,255,10,0,
-55,28,0,
-17,55,0,
-51,255,255,27,0,3,
-54,29,0,2,
-51,27,0,
-28,30,0,
-17,57,0,1,28,0,
-51,255,255,27,0,
-51,30,0,
-55,31,0,
-17,55,0,
-51,255,255,10,0,3,
-28,32,0,
-17,62,0,1,31,0,
-51,255,255,10,0,
-55,33,0,
-17,55,0,
-51,255,255,27,0,3,
-54,34,0,2,
-51,32,0,
-28,35,0,
-17,62,0,1,33,0,
-51,255,255,27,0,
-51,35,0,
-55,36,0,
-17,67,0,
-51,255,255,10,0,3,
-55,37,0,
-17,55,0,
-51,255,255,10,0,3,
-28,38,0,
-17,69,0,2,36,0,37,0,
-51,255,255,10,0,
-55,39,0,
-17,67,0,
-51,255,255,27,0,3,
-55,40,0,
-17,55,0,
-51,255,255,27,0,3,
-54,41,0,2,
-51,38,0,
-28,42,0,
-17,69,0,2,39,0,40,0,
-51,255,255,27,0,
-51,42,0,
-55,43,0,
-17,74,0,
-51,255,255,10,0,3,
-54,44,0,3,
-51,38,0,
-51,42,0,
-28,45,0,
-17,69,0,1,43,0,
-51,255,255,10,0,
-51,45,0,
-55,46,0,
-17,74,0,
-51,255,255,27,0,3,
-54,47,0,4,
-51,38,0,
-51,42,0,
-51,45,0,
-28,48,0,
-17,69,0,1,46,0,
-51,255,255,27,0,
-51,48,0,
-55,49,0,
-17,55,0,
-51,255,255,10,0,3,
-28,50,0,
-39,
-16,0,2,0,0,83,0,1,49,0,
-51,255,255,10,0,
-55,51,0,
-17,55,0,
-51,255,255,27,0,3,
-54,52,0,2,
-51,50,0,
-28,53,0,
-39,
-16,0,2,0,0,83,0,1,51,0,
-51,255,255,27,0,
-51,53,0,
-55,54,0,
-17,55,0,
-51,255,255,10,0,3,
-28,55,0,
-39,
-16,0,2,0,0,88,0,1,54,0,
-51,255,255,10,0,
-55,56,0,
-17,55,0,
-51,255,255,27,0,3,
-54,57,0,2,
-51,55,0,
-28,58,0,
-39,
-16,0,2,0,0,88,0,1,56,0,
-51,255,255,27,0,
-51,58,0,
-55,59,0,
-17,55,0,
-51,255,255,10,0,3,
-28,60,0,
-39,
-16,0,2,0,0,93,0,1,59,0,
-51,255,255,10,0,
-55,61,0,
-17,55,0,
-51,255,255,27,0,3,
-54,62,0,2,
-51,60,0,
-28,63,0,
-39,
-16,0,2,0,0,93,0,1,61,0,
-51,255,255,27,0,
-51,63,0,
-55,64,0,
-17,55,0,
-51,255,255,10,0,3,
-28,65,0,
-39,
-16,0,2,0,0,98,0,1,64,0,
-51,255,255,10,0,
-55,66,0,
-17,55,0,
-51,255,255,27,0,3,
-54,67,0,2,
-51,65,0,
-28,68,0,
-39,
-16,0,2,0,0,98,0,1,66,0,
-51,255,255,27,0,
-51,68,0,
-55,69,0,
-17,55,0,
-51,255,255,10,0,3,
-28,70,0,
-39,
-16,0,2,0,0,104,0,1,69,0,
-51,255,255,10,0,
-55,71,0,
-17,55,0,
-51,255,255,27,0,3,
-54,72,0,2,
-51,70,0,
-28,73,0,
-39,
-16,0,2,0,0,104,0,1,71,0,
-51,255,255,27,0,
-51,73,0,
-55,74,0,
-17,55,0,
-51,255,255,10,0,3,
-28,75,0,
-39,
-16,0,2,0,0,110,0,1,74,0,
-51,255,255,10,0,
-55,76,0,
-17,55,0,
-51,255,255,27,0,3,
-54,77,0,2,
-51,75,0,
-28,78,0,
-39,
-16,0,2,0,0,110,0,1,76,0,
-51,255,255,27,0,
-51,78,0,
-55,79,0,
-17,55,0,
-51,255,255,10,0,3,
-55,80,0,
-17,67,0,
-51,255,255,10,0,3,
-28,81,0,
-17,116,0,2,79,0,80,0,
-51,255,255,10,0,
-55,82,0,
-17,55,0,
-51,255,255,27,0,3,
-55,83,0,
-17,67,0,
-51,255,255,27,0,3,
-54,84,0,2,
-51,81,0,
-28,85,0,
-17,116,0,2,82,0,83,0,
-51,255,255,27,0,
-51,85,0,
-55,86,0,
-17,55,0,
-51,255,255,10,0,3,
-28,87,0,
-17,120,0,1,86,0,
-51,255,255,10,0,
-55,88,0,
-17,55,0,
-51,255,255,27,0,3,
-54,89,0,2,
-51,87,0,
-28,90,0,
-17,120,0,1,88,0,
-51,255,255,27,0,
-51,90,0,
-55,91,0,
-17,55,0,
-51,255,255,10,0,3,
-28,92,0,
-17,124,0,1,91,0,
-51,255,255,10,0,
-55,93,0,
-17,55,0,
-51,255,255,27,0,3,
-54,94,0,2,
-51,92,0,
-28,95,0,
-17,124,0,1,93,0,
-51,255,255,27,0,
-51,95,0,
-55,96,0,
-17,55,0,
-51,255,255,10,0,3,
-28,97,0,
-17,128,0,1,96,0,
-51,255,255,10,0,
-55,98,0,
-17,55,0,
-51,255,255,27,0,3,
-54,99,0,2,
-51,97,0,
-28,100,0,
-17,128,0,1,98,0,
-51,255,255,27,0,
-51,100,0,
-55,101,0,
-17,55,0,
-51,255,255,10,0,3,
-28,102,0,
-17,133,0,1,101,0,
-51,255,255,10,0,
-55,103,0,
-17,55,0,
-51,255,255,27,0,3,
-54,104,0,2,
-51,102,0,
-28,105,0,
-17,133,0,1,103,0,
-51,255,255,27,0,
-51,105,0,
-55,106,0,
-17,55,0,
-51,255,255,10,0,3,
-28,107,0,
-17,138,0,1,106,0,
-51,255,255,10,0,
-55,108,0,
-17,55,0,
-51,255,255,27,0,3,
-54,109,0,2,
-51,107,0,
-28,110,0,
-17,138,0,1,108,0,
-51,255,255,27,0,
-51,110,0,
-55,111,0,
-17,55,0,
-51,255,255,10,0,3,
-28,112,0,
-17,143,0,1,111,0,
-51,255,255,10,0,
-55,113,0,
-17,55,0,
-51,255,255,27,0,3,
-54,114,0,2,
-51,112,0,
-28,115,0,
-17,143,0,1,113,0,
-51,255,255,27,0,
-51,115,0,
-55,116,0,
-17,55,0,
-51,255,255,10,0,3,
-28,117,0,
-17,155,0,1,116,0,
-51,255,255,10,0,
-55,118,0,
-17,55,0,
-51,255,255,27,0,3,
-54,119,0,2,
-51,117,0,
-28,120,0,
-17,155,0,1,118,0,
-51,255,255,27,0,
-51,120,0,
-55,121,0,
-17,55,0,
-51,255,255,10,0,3,
-28,122,0,
-17,159,0,1,121,0,
-51,255,255,10,0,
-55,123,0,
-17,55,0,
-51,255,255,27,0,3,
-54,124,0,2,
-51,122,0,
-28,125,0,
-17,159,0,1,123,0,
-51,255,255,27,0,
-51,125,0,
-55,126,0,
-17,55,0,
-51,255,255,10,0,3,
-28,127,0,
-17,164,0,1,126,0,
-51,255,255,10,0,
-55,128,0,
-17,55,0,
-51,255,255,27,0,3,
-54,129,0,2,
-51,127,0,
-28,130,0,
-17,164,0,1,128,0,
-51,255,255,27,0,
-51,130,0,
-55,131,0,
-17,55,0,
-51,255,255,10,0,3,
-28,132,0,
-17,170,0,1,131,0,
-51,255,255,10,0,
-55,133,0,
-17,55,0,
-51,255,255,27,0,3,
-54,134,0,2,
-51,132,0,
-28,135,0,
-17,170,0,1,133,0,
-51,255,255,27,0,
-51,135,0,
-55,136,0,
-17,55,0,
-51,255,255,10,0,3,
-28,137,0,
-17,175,0,1,136,0,
-51,255,255,10,0,
-55,138,0,
-17,55,0,
-51,255,255,27,0,3,
-54,139,0,2,
-51,137,0,
-28,140,0,
-17,175,0,1,138,0,
-51,255,255,27,0,
-51,140,0,
-55,141,0,
-17,55,0,
-51,255,255,10,0,3,
-55,142,0,
-17,67,0,
-51,255,255,181,0,3,
-28,143,0,
-17,187,0,2,141,0,142,0,
-51,255,255,10,0,
-55,144,0,
-17,55,0,
-51,255,255,10,0,3,
-55,145,0,
-17,67,0,
-51,255,255,10,0,3,
-54,146,0,2,
-51,143,0,
-28,147,0,
-17,187,0,2,144,0,145,0,
-51,255,255,10,0,
-51,147,0,
-55,148,0,
-17,55,0,
-51,255,255,27,0,3,
-55,149,0,
-17,67,0,
-51,255,255,191,0,3,
-54,150,0,3,
-51,143,0,
-51,147,0,
-28,151,0,
-17,187,0,2,148,0,149,0,
-51,255,255,27,0,
-51,151,0,
-55,152,0,
-17,55,0,
-51,255,255,27,0,3,
-55,153,0,
-17,67,0,
-51,255,255,27,0,3,
-54,154,0,4,
-51,143,0,
-51,147,0,
-51,151,0,
-28,155,0,
-17,187,0,2,152,0,153,0,
-51,255,255,27,0,
-51,155,0,
-55,156,0,
-17,55,0,
-51,255,255,10,0,3,
-55,157,0,
-17,67,0,
-51,255,255,10,0,3,
-28,158,0,
-17,196,0,2,156,0,157,0,
-51,255,255,10,0,
-55,159,0,
-17,55,0,
-51,255,255,10,0,3,
-55,160,0,
-17,67,0,
-51,255,255,181,0,3,
-54,161,0,2,
-51,158,0,
-28,162,0,
-17,196,0,2,159,0,160,0,
-51,255,255,10,0,
-51,162,0,
-55,163,0,
-17,55,0,
-51,255,255,27,0,3,
-55,164,0,
-17,67,0,
-51,255,255,27,0,3,
-54,165,0,3,
-51,158,0,
-51,162,0,
-28,166,0,
-17,196,0,2,163,0,164,0,
-51,255,255,27,0,
-51,166,0,
-55,167,0,
-17,55,0,
-51,255,255,27,0,3,
-55,168,0,
-17,67,0,
-51,255,255,191,0,3,
-54,169,0,4,
-51,158,0,
-51,162,0,
-51,166,0,
-28,170,0,
-17,196,0,2,167,0,168,0,
-51,255,255,27,0,
-51,170,0,
-55,171,0,
-17,55,0,
-51,255,255,10,0,3,
-55,172,0,
-17,67,0,
-51,255,255,10,0,3,
-28,173,0,
-17,200,0,2,171,0,172,0,
-51,255,255,10,0,
-55,174,0,
-17,55,0,
-51,255,255,10,0,3,
-55,175,0,
-17,67,0,
-51,255,255,181,0,3,
-54,176,0,2,
-51,173,0,
-28,177,0,
-17,200,0,2,174,0,175,0,
-51,255,255,10,0,
-51,177,0,
-55,178,0,
-17,55,0,
-51,255,255,27,0,3,
-55,179,0,
-17,67,0,
-51,255,255,27,0,3,
-54,180,0,3,
-51,173,0,
-51,177,0,
-28,181,0,
-17,200,0,2,178,0,179,0,
-51,255,255,27,0,
-51,181,0,
-55,182,0,
-17,55,0,
-51,255,255,27,0,3,
-55,183,0,
-17,67,0,
-51,255,255,191,0,3,
-54,184,0,4,
-51,173,0,
-51,177,0,
-51,181,0,
-28,185,0,
-17,200,0,2,182,0,183,0,
-51,255,255,27,0,
-51,185,0,
-55,186,0,
-17,55,0,
-51,255,255,10,0,3,
-55,187,0,
-17,204,0,
-51,255,255,10,0,3,
-55,188,0,
-17,211,0,
-51,255,255,10,0,3,
-28,189,0,
-17,218,0,3,186,0,187,0,188,0,
-51,255,255,10,0,
-55,190,0,
-17,55,0,
-51,255,255,10,0,3,
-55,191,0,
-17,204,0,
-51,255,255,181,0,3,
-55,192,0,
-17,211,0,
-51,255,255,181,0,3,
-54,193,0,2,
-51,189,0,
-28,194,0,
-17,218,0,3,190,0,191,0,192,0,
-51,255,255,10,0,
-51,194,0,
-55,195,0,
-17,55,0,
-51,255,255,27,0,3,
-55,196,0,
-17,204,0,
-51,255,255,27,0,3,
-55,197,0,
-17,211,0,
-51,255,255,27,0,3,
-54,198,0,3,
-51,189,0,
-51,194,0,
-28,199,0,
-17,218,0,3,195,0,196,0,197,0,
-51,255,255,27,0,
-51,199,0,
-55,200,0,
-17,55,0,
-51,255,255,27,0,3,
-55,201,0,
-17,204,0,
-51,255,255,191,0,3,
-55,202,0,
-17,211,0,
-51,255,255,191,0,3,
-54,203,0,4,
-51,189,0,
-51,194,0,
-51,199,0,
-28,204,0,
-17,218,0,3,200,0,201,0,202,0,
-51,255,255,27,0,
-51,204,0,
-55,205,0,
-17,55,0,
-51,255,255,10,0,3,
-28,206,0,
-17,224,0,1,205,0,
-51,255,255,10,0,
-55,207,0,
-17,55,0,
-51,255,255,27,0,3,
-54,208,0,2,
-51,206,0,
-28,209,0,
-17,224,0,1,207,0,
-51,255,255,27,0,
-51,209,0,
-55,210,0,
-17,55,0,
-51,255,255,10,0,3,
-55,211,0,
-17,67,0,
-51,255,255,10,0,3,
-55,212,0,
-17,233,0,
-51,255,255,10,0,3,
-28,213,0,
-17,235,0,3,210,0,211,0,212,0,
-51,255,255,10,0,
-55,214,0,
-17,55,0,
-51,255,255,10,0,3,
-55,215,0,
-17,67,0,
-51,255,255,10,0,3,
-55,216,0,
-17,233,0,
-51,255,255,181,0,3,
-54,217,0,2,
-51,213,0,
-28,218,0,
-17,235,0,3,214,0,215,0,216,0,
-51,255,255,10,0,
-51,218,0,
-55,219,0,
-17,55,0,
-51,255,255,27,0,3,
-55,220,0,
-17,67,0,
-51,255,255,27,0,3,
-55,221,0,
-17,233,0,
-51,255,255,27,0,3,
-54,222,0,3,
-51,213,0,
-51,218,0,
-28,223,0,
-17,235,0,3,219,0,220,0,221,0,
-51,255,255,27,0,
-51,223,0,
-55,224,0,
-17,55,0,
-51,255,255,27,0,3,
-55,225,0,
-17,67,0,
-51,255,255,27,0,3,
-55,226,0,
-17,233,0,
-51,255,255,191,0,3,
-54,227,0,4,
-51,213,0,
-51,218,0,
-51,223,0,
-28,228,0,
-17,235,0,3,224,0,225,0,226,0,
-51,255,255,27,0,
-51,228,0,
-55,229,0,
-17,239,0,
-51,255,255,10,0,3,
-55,230,0,
-17,55,0,
-51,255,255,10,0,3,
-28,231,0,
-17,244,0,2,229,0,230,0,
-51,255,255,10,0,
-55,232,0,
-17,239,0,
-51,255,255,181,0,3,
-55,233,0,
-17,55,0,
-51,255,255,10,0,3,
-54,234,0,2,
-51,231,0,
-28,235,0,
-17,244,0,2,232,0,233,0,
-51,255,255,10,0,
-51,235,0,
-55,236,0,
-17,239,0,
-51,255,255,27,0,3,
-55,237,0,
-17,55,0,
-51,255,255,27,0,3,
-54,238,0,3,
-51,231,0,
-51,235,0,
-28,239,0,
-17,244,0,2,236,0,237,0,
-51,255,255,27,0,
-51,239,0,
-55,240,0,
-17,239,0,
-51,255,255,191,0,3,
-55,241,0,
-17,55,0,
-51,255,255,27,0,3,
-54,242,0,4,
-51,231,0,
-51,235,0,
-51,239,0,
-28,243,0,
-17,244,0,2,240,0,241,0,
-51,255,255,27,0,
-51,243,0,
-55,244,0,
-17,249,0,
-51,255,255,10,0,3,
-55,245,0,
-17,255,0,
-51,255,255,10,0,3,
-55,246,0,
-17,55,0,
-51,255,255,10,0,3,
-28,247,0,
-17,5,1,3,244,0,245,0,246,0,
-51,255,255,10,0,
-55,248,0,
-17,249,0,
-51,255,255,181,0,3,
-55,249,0,
-17,255,0,
-51,255,255,181,0,3,
-55,250,0,
-17,55,0,
-51,255,255,10,0,3,
-54,251,0,2,
-51,247,0,
-28,252,0,
-17,5,1,3,248,0,249,0,250,0,
-51,255,255,10,0,
-51,252,0,
-55,253,0,
-17,249,0,
-51,255,255,27,0,3,
-55,254,0,
-17,255,0,
-51,255,255,27,0,3,
-55,255,0,
-17,55,0,
-51,255,255,27,0,3,
-54,0,1,3,
-51,247,0,
-51,252,0,
-28,1,1,
-17,5,1,3,253,0,254,0,255,0,
-51,255,255,27,0,
-51,1,1,
-55,2,1,
-17,249,0,
-51,255,255,191,0,3,
-55,3,1,
-17,255,0,
-51,255,255,191,0,3,
-55,4,1,
-17,55,0,
-51,255,255,27,0,3,
-54,5,1,4,
-51,247,0,
-51,252,0,
-51,1,1,
-28,6,1,
-17,5,1,3,2,1,3,1,4,1,
-51,255,255,27,0,
-51,6,1,
-55,7,1,
-17,55,0,
-51,255,255,16,1,3,
-54,8,1,3,
-51,117,0,
-51,120,0,
-28,9,1,
-39,
-16,0,2,0,0,155,0,1,7,1,
-51,255,255,16,1,
-51,9,1,
-55,10,1,
-17,55,0,
-51,255,255,16,1,3,
-54,11,1,3,
-51,122,0,
-51,125,0,
-28,12,1,
-39,
-16,0,2,0,0,159,0,1,10,1,
-51,255,255,16,1,
-51,12,1,
-55,13,1,
-17,26,1,
-51,255,255,10,0,3,
-28,14,1,
-39,
-16,0,2,0,0,32,1,1,13,1,
-51,255,255,16,1,
-55,15,1,
-17,26,1,
-51,255,255,10,0,3,
-28,16,1,
-39,
-16,0,2,0,0,47,1,1,15,1,
-51,255,255,63,1,
-55,17,1,
-17,26,1,
-51,255,255,16,1,3,
-28,18,1,
-39,
-16,0,2,0,0,73,1,1,17,1,
-51,255,255,10,0,
-55,19,1,
-17,26,1,
-51,255,255,63,1,3,
-28,20,1,
-39,
-16,0,2,0,0,88,1,1,19,1,
-51,255,255,10,0,
-55,21,1,
-17,55,0,
-51,255,255,10,0,3,
-28,22,1,
-39,
-16,0,2,0,0,104,1,1,21,1,
-51,255,255,10,0,
-55,23,1,
-17,55,0,
-51,255,255,27,0,3,
-54,24,1,2,
-51,22,1,
-28,25,1,
-39,
-16,0,2,0,0,104,1,1,23,1,
-51,255,255,27,0,
-51,25,1,
-55,26,1,
-17,55,0,
-51,255,255,10,0,3,
-28,27,1,
-39,
-16,0,2,0,0,110,1,1,26,1,
-51,255,255,10,0,
-55,28,1,
-17,55,0,
-51,255,255,27,0,3,
-54,29,1,2,
-51,27,1,
-28,30,1,
-39,
-16,0,2,0,0,110,1,1,28,1,
-51,255,255,27,0,
-51,30,1,
-55,31,1,
-17,55,0,
-51,255,255,10,0,3,
-28,32,1,
-39,
-16,0,2,0,0,116,1,1,31,1,
-51,255,255,10,0,
-55,33,1,
-17,55,0,
-51,255,255,27,0,3,
-54,34,1,2,
-51,32,1,
-28,35,1,
-39,
-16,0,2,0,0,116,1,1,33,1,
-51,255,255,27,0,
-51,35,1,
-55,36,1,
-17,55,0,
-51,255,255,16,1,3,
-55,37,1,
-17,67,0,
-51,255,255,16,1,3,
-54,38,1,5,
-51,158,0,
-51,162,0,
-51,166,0,
-51,170,0,
-28,39,1,
-39,
-16,0,2,0,0,196,0,2,36,1,37,1,
-51,255,255,16,1,
-51,39,1,
-55,40,1,
-17,55,0,
-51,255,255,16,1,3,
-55,41,1,
-17,67,0,
-51,255,255,126,1,3,
-54,42,1,6,
-51,158,0,
-51,162,0,
-51,166,0,
-51,170,0,
-51,39,1,
-28,43,1,
-39,
-16,0,2,0,0,196,0,2,40,1,41,1,
-51,255,255,16,1,
-51,43,1,
-55,44,1,
-17,55,0,
-51,255,255,16,1,3,
-55,45,1,
-17,67,0,
-51,255,255,16,1,3,
-54,46,1,5,
-51,173,0,
-51,177,0,
-51,181,0,
-51,185,0,
-28,47,1,
-39,
-16,0,2,0,0,200,0,2,44,1,45,1,
-51,255,255,16,1,
-51,47,1,
-55,48,1,
-17,55,0,
-51,255,255,16,1,3,
-55,49,1,
-17,67,0,
-51,255,255,126,1,3,
-54,50,1,6,
-51,173,0,
-51,177,0,
-51,181,0,
-51,185,0,
-51,47,1,
-28,51,1,
-39,
-16,0,2,0,0,200,0,2,48,1,49,1,
-51,255,255,16,1,
-51,51,1,
-55,52,1,
-17,55,0,
-51,255,255,16,1,3,
-55,53,1,
-17,204,0,
-51,255,255,16,1,3,
-55,54,1,
-17,211,0,
-51,255,255,16,1,3,
-54,55,1,5,
-51,189,0,
-51,194,0,
-51,199,0,
-51,204,0,
-28,56,1,
-39,
-16,0,2,0,0,218,0,3,52,1,53,1,54,1,
-51,255,255,16,1,
-51,56,1,
-55,57,1,
-17,55,0,
-51,255,255,16,1,3,
-55,58,1,
-17,204,0,
-51,255,255,126,1,3,
-55,59,1,
-17,211,0,
-51,255,255,126,1,3,
-54,60,1,6,
-51,189,0,
-51,194,0,
-51,199,0,
-51,204,0,
-51,56,1,
-28,61,1,
-39,
-16,0,2,0,0,218,0,3,57,1,58,1,59,1,
-51,255,255,16,1,
-51,61,1,
-55,62,1,
-17,55,0,
-51,255,255,63,1,3,
-55,63,1,
-17,204,0,
-51,255,255,63,1,3,
-55,64,1,
-17,211,0,
-51,255,255,63,1,3,
-54,65,1,7,
-51,189,0,
-51,194,0,
-51,199,0,
-51,204,0,
-51,56,1,
-51,61,1,
-28,66,1,
-39,
-16,0,2,0,0,218,0,3,62,1,63,1,64,1,
-51,255,255,63,1,
-51,66,1,
-55,67,1,
-17,55,0,
-51,255,255,63,1,3,
-55,68,1,
-17,204,0,
-51,255,255,130,1,3,
-55,69,1,
-17,211,0,
-51,255,255,130,1,3,
-54,70,1,8,
-51,189,0,
-51,194,0,
-51,199,0,
-51,204,0,
-51,56,1,
-51,61,1,
-51,66,1,
-28,71,1,
-39,
-16,0,2,0,0,218,0,3,67,1,68,1,69,1,
-51,255,255,63,1,
-51,71,1,
-55,72,1,
-17,55,0,
-51,255,255,10,0,3,
-55,73,1,
-17,67,0,
-51,255,255,10,0,3,
-55,74,1,
-17,233,0,
-51,255,255,135,1,3,
-54,75,1,5,
-51,213,0,
-51,218,0,
-51,223,0,
-51,228,0,
-28,76,1,
-39,
-16,0,2,0,0,235,0,3,72,1,73,1,74,1,
-51,255,255,10,0,
-51,76,1,
-55,77,1,
-17,55,0,
-51,255,255,27,0,3,
-55,78,1,
-17,67,0,
-51,255,255,27,0,3,
-55,79,1,
-17,233,0,
-51,255,255,135,1,3,
-54,80,1,6,
-51,213,0,
-51,218,0,
-51,223,0,
-51,228,0,
-51,76,1,
-28,81,1,
-39,
-16,0,2,0,0,235,0,3,77,1,78,1,79,1,
-51,255,255,27,0,
-51,81,1,
-55,82,1,
-17,55,0,
-51,255,255,10,0,3,
-28,83,1,
-39,
-16,0,2,0,0,145,1,1,82,1,
-51,255,255,135,1,
-55,84,1,
-17,55,0,
-51,255,255,27,0,3,
-54,85,1,2,
-51,83,1,
-28,86,1,
-39,
-16,0,2,0,0,145,1,1,84,1,
-51,255,255,135,1,
-51,86,1,
-55,87,1,
-17,55,0,
-51,255,255,10,0,3,
-28,88,1,
-39,
-16,0,2,0,0,151,1,1,87,1,
-51,255,255,135,1,
-55,89,1,
-17,55,0,
-51,255,255,27,0,3,
-54,90,1,2,
-51,88,1,
-28,91,1,
-39,
-16,0,2,0,0,151,1,1,89,1,
-51,255,255,135,1,
-51,91,1,
-55,92,1,
-17,55,0,
-51,255,255,10,0,3,
-55,93,1,
-38,
-16,32,157,1,
-51,255,255,10,0,3,
-28,94,1,
-39,
-16,0,2,0,0,159,1,2,92,1,93,1,
-51,255,255,10,0,
-55,95,1,
-17,55,0,
-51,255,255,27,0,3,
-55,96,1,
-38,
-16,32,157,1,
-51,255,255,27,0,3,
-54,97,1,2,
-51,94,1,
-28,98,1,
-39,
-16,0,2,0,0,159,1,2,95,1,96,1,
-51,255,255,27,0,
-51,98,1,
-55,99,1,
-17,164,1,
-51,255,255,166,1,3,
-28,100,1,
-39,
-16,0,2,0,0,173,1,1,99,1,
-51,255,255,130,1,
-55,101,1,
-17,187,1,
-51,255,255,130,1,3,
-28,102,1,
-39,
-16,0,2,0,0,189,1,1,101,1,
-51,255,255,166,1,
-55,103,1,
-17,55,0,
-51,255,255,10,0,3,
-28,104,1,
-17,205,1,1,103,1,
-51,255,255,181,0,
-55,105,1,
-17,55,0,
-51,255,255,27,0,3,
-54,106,1,2,
-51,104,1,
-28,107,1,
-17,205,1,1,105,1,
-51,255,255,191,0,
-51,107,1,
-55,108,1,
-17,212,1,
-51,255,255,10,0,3,
-55,109,1,
-17,215,1,
-51,255,255,10,0,3,
-28,110,1,
-17,218,1,2,108,1,109,1,
-51,255,255,181,0,
-55,111,1,
-17,212,1,
-51,255,255,27,0,3,
-55,112,1,
-17,215,1,
-51,255,255,27,0,3,
-54,113,1,2,
-51,110,1,
-28,114,1,
-17,218,1,2,111,1,112,1,
-51,255,255,191,0,
-51,114,1,
-55,115,1,
-17,55,0,
-51,255,255,10,0,3,
-55,116,1,
-17,67,0,
-51,255,255,10,0,3,
-28,117,1,
-17,227,1,2,115,1,116,1,
-51,255,255,181,0,
-55,118,1,
-17,55,0,
-51,255,255,27,0,3,
-55,119,1,
-17,67,0,
-51,255,255,27,0,3,
-54,120,1,2,
-51,117,1,
-28,121,1,
-17,227,1,2,118,1,119,1,
-51,255,255,191,0,
-51,121,1,
-55,122,1,
-17,55,0,
-51,255,255,231,1,3,
-55,123,1,
-17,67,0,
-51,255,255,231,1,3,
-28,124,1,
-17,238,1,2,122,1,123,1,
-51,255,255,231,1,
-55,125,1,
-17,55,0,
-51,255,255,244,1,3,
-55,126,1,
-17,67,0,
-51,255,255,244,1,3,
-54,127,1,2,
-51,124,1,
-28,128,1,
-17,238,1,2,125,1,126,1,
-51,255,255,244,1,
-51,128,1,
-55,129,1,
-17,55,0,
-51,255,255,10,0,3,
-28,130,1,
-17,250,1,1,129,1,
-51,255,255,10,0,
-55,131,1,
-17,55,0,
-51,255,255,27,0,3,
-54,132,1,2,
-51,130,1,
-28,133,1,
-17,250,1,1,131,1,
-51,255,255,27,0,
-51,133,1,
-55,134,1,
-17,4,2,
-51,255,255,10,0,3,
-55,135,1,
-17,6,2,
-51,255,255,10,0,3,
-55,136,1,
-17,8,2,
-51,255,255,10,0,3,
-28,137,1,
-17,13,2,3,134,1,135,1,136,1,
-51,255,255,10,0,
-55,138,1,
-17,4,2,
-51,255,255,27,0,3,
-55,139,1,
-17,6,2,
-51,255,255,27,0,3,
-55,140,1,
-17,8,2,
-51,255,255,27,0,3,
-54,141,1,2,
-51,137,1,
-28,142,1,
-17,13,2,3,138,1,139,1,140,1,
-51,255,255,27,0,
-51,142,1,
-55,143,1,
-17,6,2,
-51,255,255,10,0,3,
-55,144,1,
-17,4,2,
-51,255,255,10,0,3,
-28,145,1,
-17,25,2,2,143,1,144,1,
-51,255,255,10,0,
-55,146,1,
-17,6,2,
-51,255,255,27,0,3,
-55,147,1,
-17,4,2,
-51,255,255,27,0,3,
-54,148,1,2,
-51,145,1,
-28,149,1,
-17,25,2,2,146,1,147,1,
-51,255,255,27,0,
-51,149,1,
-55,150,1,
-17,6,2,
-51,255,255,10,0,3,
-55,151,1,
-17,4,2,
-51,255,255,10,0,3,
-55,152,1,
-17,33,2,
-51,255,255,181,0,3,
-28,153,1,
-17,37,2,3,150,1,151,1,152,1,
-51,255,255,10,0,
-55,154,1,
-17,6,2,
-51,255,255,27,0,3,
-55,155,1,
-17,4,2,
-51,255,255,27,0,3,
-55,156,1,
-17,33,2,
-51,255,255,191,0,3,
-54,157,1,2,
-51,153,1,
-28,158,1,
-17,37,2,3,154,1,155,1,156,1,
-51,255,255,27,0,
-51,158,1,
-55,159,1,
-17,55,0,
-51,255,255,45,2,3,
-55,160,1,
-17,67,0,
-51,255,255,45,2,3,
-28,161,1,
-17,56,2,2,159,1,160,1,
-51,255,255,45,2,
-55,162,1,
-17,55,0,
-51,255,255,71,2,3,
-55,163,1,
-17,67,0,
-51,255,255,71,2,3,
-54,164,1,2,
-51,161,1,
-28,165,1,
-17,56,2,2,162,1,163,1,
-51,255,255,71,2,
-51,165,1,
-55,166,1,
-17,55,0,
-51,255,255,83,2,3,
-55,167,1,
-17,67,0,
-51,255,255,83,2,3,
-54,168,1,3,
-51,161,1,
-51,165,1,
-28,169,1,
-39,
-16,0,2,0,0,56,2,2,166,1,167,1,
-51,255,255,83,2,
-51,169,1,
-55,170,1,
-17,55,0,
-51,255,255,88,2,3,
-55,171,1,
-17,67,0,
-51,255,255,88,2,3,
-54,172,1,4,
-51,161,1,
-51,165,1,
-51,169,1,
-28,173,1,
-39,
-16,0,2,0,0,56,2,2,170,1,171,1,
-51,255,255,88,2,
-51,173,1,
-55,174,1,
-17,94,2,
-51,255,255,45,2,3,
-28,175,1,
-17,96,2,1,174,1,
-51,255,255,45,2,
-55,176,1,
-17,94,2,
-51,255,255,71,2,3,
-54,177,1,2,
-51,175,1,
-28,178,1,
-17,96,2,1,176,1,
-51,255,255,71,2,
-51,178,1,
-55,179,1,
-17,94,2,
-51,255,255,45,2,3,
-28,180,1,
-39,
-16,0,2,0,0,104,2,1,179,1,
-51,255,255,181,0,
-55,181,1,
-17,94,2,
-51,255,255,71,2,3,
-54,182,1,2,
-51,180,1,
-28,183,1,
-39,
-16,0,2,0,0,104,2,1,181,1,
-51,255,255,191,0,
-51,183,1,
-55,184,1,
-17,94,2,
-51,255,255,45,2,3,
-28,185,1,
-39,
-16,0,2,0,0,116,2,1,184,1,
-51,255,255,45,2,
-55,186,1,
-17,94,2,
-51,255,255,71,2,3,
-54,187,1,2,
-51,185,1,
-28,188,1,
-39,
-16,0,2,0,0,116,2,1,186,1,
-51,255,255,71,2,
-51,188,1,
-55,189,1,
-17,94,2,
-51,255,255,126,2,3,
-54,190,1,3,
-51,185,1,
-51,188,1,
-28,191,1,
-39,
-16,0,2,0,0,116,2,1,189,1,
-51,255,255,135,2,
-51,191,1,
-55,192,1,
-17,94,2,
-51,255,255,144,2,3,
-54,193,1,4,
-51,185,1,
-51,188,1,
-51,191,1,
-28,194,1,
-39,
-16,0,2,0,0,116,2,1,192,1,
-51,255,255,152,2,
-51,194,1,
-55,195,1,
-17,94,2,
-51,255,255,160,2,3,
-54,196,1,5,
-51,185,1,
-51,188,1,
-51,191,1,
-51,194,1,
-28,197,1,
-39,
-16,0,2,0,0,116,2,1,195,1,
-51,255,255,169,2,
-51,197,1,
-55,198,1,
-17,94,2,
-51,255,255,178,2,3,
-54,199,1,6,
-51,185,1,
-51,188,1,
-51,191,1,
-51,194,1,
-51,197,1,
-28,200,1,
-39,
-16,0,2,0,0,116,2,1,198,1,
-51,255,255,186,2,
-51,200,1,
-55,201,1,
-17,94,2,
-51,255,255,135,2,3,
-54,202,1,7,
-51,185,1,
-51,188,1,
-51,191,1,
-51,194,1,
-51,197,1,
-51,200,1,
-28,203,1,
-39,
-16,0,2,0,0,116,2,1,201,1,
-51,255,255,126,2,
-51,203,1,
-55,204,1,
-17,94,2,
-51,255,255,152,2,3,
-54,205,1,8,
-51,185,1,
-51,188,1,
-51,191,1,
-51,194,1,
-51,197,1,
-51,200,1,
-51,203,1,
-28,206,1,
-39,
-16,0,2,0,0,116,2,1,204,1,
-51,255,255,144,2,
-51,206,1,
-55,207,1,
-17,94,2,
-51,255,255,194,2,3,
-54,208,1,9,
-51,185,1,
-51,188,1,
-51,191,1,
-51,194,1,
-51,197,1,
-51,200,1,
-51,203,1,
-51,206,1,
-28,209,1,
-39,
-16,0,2,0,0,116,2,1,207,1,
-51,255,255,203,2,
-51,209,1,
-55,210,1,
-17,94,2,
-51,255,255,212,2,3,
-54,211,1,10,
-51,185,1,
-51,188,1,
-51,191,1,
-51,194,1,
-51,197,1,
-51,200,1,
-51,203,1,
-51,206,1,
-51,209,1,
-28,212,1,
-39,
-16,0,2,0,0,116,2,1,210,1,
-51,255,255,220,2,
-51,212,1,
-55,213,1,
-17,94,2,
-51,255,255,169,2,3,
-54,214,1,11,
-51,185,1,
-51,188,1,
-51,191,1,
-51,194,1,
-51,197,1,
-51,200,1,
-51,203,1,
-51,206,1,
-51,209,1,
-51,212,1,
-28,215,1,
-39,
-16,0,2,0,0,116,2,1,213,1,
-51,255,255,160,2,
-51,215,1,
-55,216,1,
-17,94,2,
-51,255,255,186,2,3,
-54,217,1,12,
-51,185,1,
-51,188,1,
-51,191,1,
-51,194,1,
-51,197,1,
-51,200,1,
-51,203,1,
-51,206,1,
-51,209,1,
-51,212,1,
-51,215,1,
-28,218,1,
-39,
-16,0,2,0,0,116,2,1,216,1,
-51,255,255,178,2,
-51,218,1,
-55,219,1,
-17,94,2,
-51,255,255,203,2,3,
-54,220,1,13,
-51,185,1,
-51,188,1,
-51,191,1,
-51,194,1,
-51,197,1,
-51,200,1,
-51,203,1,
-51,206,1,
-51,209,1,
-51,212,1,
-51,215,1,
-51,218,1,
-28,221,1,
-39,
-16,0,2,0,0,116,2,1,219,1,
-51,255,255,194,2,
-51,221,1,
-55,222,1,
-17,94,2,
-51,255,255,220,2,3,
-54,223,1,14,
-51,185,1,
-51,188,1,
-51,191,1,
-51,194,1,
-51,197,1,
-51,200,1,
-51,203,1,
-51,206,1,
-51,209,1,
-51,212,1,
-51,215,1,
-51,218,1,
-51,221,1,
-28,224,1,
-39,
-16,0,2,0,0,116,2,1,222,1,
-51,255,255,212,2,
-51,224,1,
-55,225,1,
-17,228,2,
-51,255,255,230,2,3,
-55,226,1,
-17,235,2,
-51,255,255,230,2,3,
-28,227,1,
-39,
-16,0,2,0,0,237,2,2,225,1,226,1,
-51,255,255,45,2,
-55,228,1,
-17,228,2,
-51,255,255,250,2,3,
-55,229,1,
-17,235,2,
-51,255,255,250,2,3,
-54,230,1,2,
-51,227,1,
-28,231,1,
-39,
-16,0,2,0,0,237,2,2,228,1,229,1,
-51,255,255,71,2,
-51,231,1,
-55,232,1,
-17,228,2,
-51,255,255,231,1,3,
-55,233,1,
-17,235,2,
-51,255,255,166,1,3,
-54,234,1,3,
-51,227,1,
-51,231,1,
-28,235,1,
-39,
-16,0,2,0,0,237,2,2,232,1,233,1,
-51,255,255,135,2,
-51,235,1,
-55,236,1,
-17,228,2,
-51,255,255,244,1,3,
-55,237,1,
-17,235,2,
-51,255,255,0,3,3,
-54,238,1,4,
-51,227,1,
-51,231,1,
-51,235,1,
-28,239,1,
-39,
-16,0,2,0,0,237,2,2,236,1,237,1,
-51,255,255,152,2,
-51,239,1,
-55,240,1,
-17,228,2,
-51,255,255,166,1,3,
-55,241,1,
-17,235,2,
-51,255,255,231,1,3,
-54,242,1,5,
-51,227,1,
-51,231,1,
-51,235,1,
-51,239,1,
-28,243,1,
-39,
-16,0,2,0,0,237,2,2,240,1,241,1,
-51,255,255,126,2,
-51,243,1,
-55,244,1,
-17,228,2,
-51,255,255,0,3,3,
-55,245,1,
-17,235,2,
-51,255,255,244,1,3,
-54,246,1,6,
-51,227,1,
-51,231,1,
-51,235,1,
-51,239,1,
-51,243,1,
-28,247,1,
-39,
-16,0,2,0,0,237,2,2,244,1,245,1,
-51,255,255,144,2,
-51,247,1,
-55,248,1,
-17,228,2,
-51,255,255,6,3,3,
-55,249,1,
-17,235,2,
-51,255,255,166,1,3,
-54,250,1,7,
-51,227,1,
-51,231,1,
-51,235,1,
-51,239,1,
-51,243,1,
-51,247,1,
-28,251,1,
-39,
-16,0,2,0,0,237,2,2,248,1,249,1,
-51,255,255,169,2,
-51,251,1,
-55,252,1,
-17,228,2,
-51,255,255,13,3,3,
-55,253,1,
-17,235,2,
-51,255,255,0,3,3,
-54,254,1,8,
-51,227,1,
-51,231,1,
-51,235,1,
-51,239,1,
-51,243,1,
-51,247,1,
-51,251,1,
-28,255,1,
-39,
-16,0,2,0,0,237,2,2,252,1,253,1,
-51,255,255,186,2,
-51,255,1,
-55,0,2,
-17,228,2,
-51,255,255,166,1,3,
-55,1,2,
-17,235,2,
-51,255,255,6,3,3,
-54,2,2,9,
-51,227,1,
-51,231,1,
-51,235,1,
-51,239,1,
-51,243,1,
-51,247,1,
-51,251,1,
-51,255,1,
-28,3,2,
-39,
-16,0,2,0,0,237,2,2,0,2,1,2,
-51,255,255,160,2,
-51,3,2,
-55,4,2,
-17,228,2,
-51,255,255,0,3,3,
-55,5,2,
-17,235,2,
-51,255,255,13,3,3,
-54,6,2,10,
-51,227,1,
-51,231,1,
-51,235,1,
-51,239,1,
-51,243,1,
-51,247,1,
-51,251,1,
-51,255,1,
-51,3,2,
-28,7,2,
-39,
-16,0,2,0,0,237,2,2,4,2,5,2,
-51,255,255,178,2,
-51,7,2,
-55,8,2,
-17,228,2,
-51,255,255,6,3,3,
-55,9,2,
-17,235,2,
-51,255,255,231,1,3,
-54,10,2,11,
-51,227,1,
-51,231,1,
-51,235,1,
-51,239,1,
-51,243,1,
-51,247,1,
-51,251,1,
-51,255,1,
-51,3,2,
-51,7,2,
-28,11,2,
-39,
-16,0,2,0,0,237,2,2,8,2,9,2,
-51,255,255,203,2,
-51,11,2,
-55,12,2,
-17,228,2,
-51,255,255,13,3,3,
-55,13,2,
-17,235,2,
-51,255,255,244,1,3,
-54,14,2,12,
-51,227,1,
-51,231,1,
-51,235,1,
-51,239,1,
-51,243,1,
-51,247,1,
-51,251,1,
-51,255,1,
-51,3,2,
-51,7,2,
-51,11,2,
-28,15,2,
-39,
-16,0,2,0,0,237,2,2,12,2,13,2,
-51,255,255,220,2,
-51,15,2,
-55,16,2,
-17,228,2,
-51,255,255,231,1,3,
-55,17,2,
-17,235,2,
-51,255,255,6,3,3,
-54,18,2,13,
-51,227,1,
-51,231,1,
-51,235,1,
-51,239,1,
-51,243,1,
-51,247,1,
-51,251,1,
-51,255,1,
-51,3,2,
-51,7,2,
-51,11,2,
-51,15,2,
-28,19,2,
-39,
-16,0,2,0,0,237,2,2,16,2,17,2,
-51,255,255,194,2,
-51,19,2,
-55,20,2,
-17,228,2,
-51,255,255,244,1,3,
-55,21,2,
-17,235,2,
-51,255,255,13,3,3,
-54,22,2,14,
-51,227,1,
-51,231,1,
-51,235,1,
-51,239,1,
-51,243,1,
-51,247,1,
-51,251,1,
-51,255,1,
-51,3,2,
-51,7,2,
-51,11,2,
-51,15,2,
-51,19,2,
-28,23,2,
-39,
-16,0,2,0,0,237,2,2,20,2,21,2,
-51,255,255,212,2,
-51,23,2,
-55,24,2,
-17,55,0,
-51,255,255,230,2,3,
-55,25,2,
-17,67,0,
-51,255,255,230,2,3,
-28,26,2,
-17,19,3,2,24,2,25,2,
-51,255,255,28,3,
-55,27,2,
-17,55,0,
-51,255,255,250,2,3,
-55,28,2,
-17,67,0,
-51,255,255,250,2,3,
-54,29,2,2,
-51,26,2,
-28,30,2,
-17,19,3,2,27,2,28,2,
-51,255,255,28,3,
-51,30,2,
-55,31,2,
-17,55,0,
-51,255,255,34,3,3,
-55,32,2,
-17,67,0,
-51,255,255,34,3,3,
-54,33,2,3,
-51,26,2,
-51,30,2,
-28,34,2,
-17,19,3,2,31,2,32,2,
-51,255,255,28,3,
-51,34,2,
-55,35,2,
-17,55,0,
-51,255,255,230,2,3,
-55,36,2,
-17,67,0,
-51,255,255,230,2,3,
-28,37,2,
-17,40,3,2,35,2,36,2,
-51,255,255,28,3,
-55,38,2,
-17,55,0,
-51,255,255,250,2,3,
-55,39,2,
-17,67,0,
-51,255,255,250,2,3,
-54,40,2,2,
-51,37,2,
-28,41,2,
-17,40,3,2,38,2,39,2,
-51,255,255,28,3,
-51,41,2,
-55,42,2,
-17,55,0,
-51,255,255,34,3,3,
-55,43,2,
-17,67,0,
-51,255,255,34,3,3,
-54,44,2,3,
-51,37,2,
-51,41,2,
-28,45,2,
-17,40,3,2,42,2,43,2,
-51,255,255,28,3,
-51,45,2,
-55,46,2,
-17,55,0,
-51,255,255,230,2,3,
-55,47,2,
-17,67,0,
-51,255,255,230,2,3,
-28,48,2,
-17,54,3,2,46,2,47,2,
-51,255,255,28,3,
-55,49,2,
-17,55,0,
-51,255,255,250,2,3,
-55,50,2,
-17,67,0,
-51,255,255,250,2,3,
-54,51,2,2,
-51,48,2,
-28,52,2,
-17,54,3,2,49,2,50,2,
-51,255,255,28,3,
-51,52,2,
-55,53,2,
-17,55,0,
-51,255,255,34,3,3,
-55,54,2,
-17,67,0,
-51,255,255,34,3,3,
-54,55,2,3,
-51,48,2,
-51,52,2,
-28,56,2,
-17,54,3,2,53,2,54,2,
-51,255,255,28,3,
-51,56,2,
-55,57,2,
-17,55,0,
-51,255,255,230,2,3,
-55,58,2,
-17,67,0,
-51,255,255,230,2,3,
-28,59,2,
-17,66,3,2,57,2,58,2,
-51,255,255,28,3,
-55,60,2,
-17,55,0,
-51,255,255,250,2,3,
-55,61,2,
-17,67,0,
-51,255,255,250,2,3,
-54,62,2,2,
-51,59,2,
-28,63,2,
-17,66,3,2,60,2,61,2,
-51,255,255,28,3,
-51,63,2,
-55,64,2,
-17,55,0,
-51,255,255,34,3,3,
-55,65,2,
-17,67,0,
-51,255,255,34,3,3,
-54,66,2,3,
-51,59,2,
-51,63,2,
-28,67,2,
-17,66,3,2,64,2,65,2,
-51,255,255,28,3,
-51,67,2,
-55,68,2,
-17,55,0,
-51,255,255,230,2,3,
-55,69,2,
-17,67,0,
-51,255,255,230,2,3,
-28,70,2,
-17,83,3,2,68,2,69,2,
-51,255,255,28,3,
-55,71,2,
-17,55,0,
-51,255,255,250,2,3,
-55,72,2,
-17,67,0,
-51,255,255,250,2,3,
-54,73,2,2,
-51,70,2,
-28,74,2,
-17,83,3,2,71,2,72,2,
-51,255,255,28,3,
-51,74,2,
-55,75,2,
-17,55,0,
-51,255,255,34,3,3,
-55,76,2,
-17,67,0,
-51,255,255,34,3,3,
-54,77,2,3,
-51,70,2,
-51,74,2,
-28,78,2,
-17,83,3,2,75,2,76,2,
-51,255,255,28,3,
-51,78,2,
-55,79,2,
-17,55,0,
-51,255,255,28,3,3,
-55,80,2,
-17,67,0,
-51,255,255,28,3,3,
-54,81,2,4,
-51,70,2,
-51,74,2,
-51,78,2,
-28,82,2,
-17,83,3,2,79,2,80,2,
-51,255,255,28,3,
-51,82,2,
-55,83,2,
-17,55,0,
-51,255,255,230,2,3,
-55,84,2,
-17,67,0,
-51,255,255,230,2,3,
-28,85,2,
-17,89,3,2,83,2,84,2,
-51,255,255,28,3,
-55,86,2,
-17,55,0,
-51,255,255,250,2,3,
-55,87,2,
-17,67,0,
-51,255,255,250,2,3,
-54,88,2,2,
-51,85,2,
-28,89,2,
-17,89,3,2,86,2,87,2,
-51,255,255,28,3,
-51,89,2,
-55,90,2,
-17,55,0,
-51,255,255,34,3,3,
-55,91,2,
-17,67,0,
-51,255,255,34,3,3,
-54,92,2,3,
-51,85,2,
-51,89,2,
-28,93,2,
-17,89,3,2,90,2,91,2,
-51,255,255,28,3,
-51,93,2,
-55,94,2,
-17,55,0,
-51,255,255,28,3,3,
-55,95,2,
-17,67,0,
-51,255,255,28,3,3,
-54,96,2,4,
-51,85,2,
-51,89,2,
-51,93,2,
-28,97,2,
-17,89,3,2,94,2,95,2,
-51,255,255,28,3,
-51,97,2,
-55,98,2,
-17,55,0,
-51,255,255,28,3,3,
-28,99,2,
-17,98,3,1,98,2,
-51,255,255,102,3,
-55,100,2,
-17,55,0,
-51,255,255,28,3,3,
-28,101,2,
-17,107,3,1,100,2,
-51,255,255,102,3,
-55,102,2,
-17,55,0,
-51,255,255,28,3,3,
-28,103,2,
-17,111,3,1,102,2,
-51,255,255,28,3,
-55,104,2,
-17,187,1,
-51,255,255,10,0,3,
-28,105,2,
-39,
-16,0,2,0,0,115,3,1,104,2,
-51,255,255,10,0,
-55,106,2,
-17,187,1,
-51,255,255,10,0,3,
-28,107,2,
-39,
-16,0,2,0,0,120,3,1,106,2,
-51,255,255,10,0,
-55,108,2,
-17,187,1,
-51,255,255,27,0,3,
-54,109,2,2,
-51,105,2,
-28,110,2,
-39,
-16,0,2,0,0,115,3,1,108,2,
-51,255,255,27,0,
-51,110,2,
-55,111,2,
-17,187,1,
-51,255,255,27,0,3,
-54,112,2,2,
-51,107,2,
-28,113,2,
-39,
-16,0,2,0,0,120,3,1,111,2,
-51,255,255,27,0,
-51,113,2,
-55,114,2,
-17,187,1,
-51,255,255,10,0,3,
-28,115,2,
-39,
-16,0,2,0,0,125,3,1,114,2,
-51,255,255,10,0,
-55,116,2,
-17,187,1,
-51,255,255,27,0,3,
-54,117,2,2,
-51,115,2,
-28,118,2,
-39,
-16,0,2,0,0,125,3,1,116,2,
-51,255,255,27,0,
-51,118,2,
-55,119,2,
-17,132,3,
-51,255,255,13,3,3,
-28,120,2,
-17,138,3,1,119,2,
-51,255,255,13,3,
-55,121,2,
-17,132,3,
-51,255,255,6,3,3,
-54,122,2,2,
-51,120,2,
-28,123,2,
-17,138,3,1,121,2,
-51,255,255,6,3,
-51,123,2,
-55,124,2,
-17,132,3,
-51,255,255,244,1,3,
-28,125,2,
-17,147,3,1,124,2,
-51,255,255,244,1,
-55,126,2,
-17,132,3,
-51,255,255,244,1,3,
-28,127,2,
-17,160,3,1,126,2,
-51,255,255,244,1,
-55,128,2,
-17,175,3,
-51,255,255,166,1,3,
-55,129,2,
-17,182,3,
-51,255,255,184,3,3,
-28,130,2,
-17,191,3,2,128,2,129,2,
-51,255,255,13,3,
-55,131,2,
-17,132,3,
-51,255,255,13,3,3,
-55,132,2,
-17,197,3,
-51,255,255,199,3,3,
-54,133,2,2,
-51,130,2,
-28,134,2,
-17,191,3,2,131,2,132,2,
-51,255,255,13,3,
-51,134,2,
-55,135,2,
-17,211,3,
-51,255,255,13,3,3,
-55,136,2,
-17,215,3,
-51,255,255,13,3,3,
-55,137,2,
-17,219,3,
-51,255,255,221,3,3,
-54,138,2,3,
-51,130,2,
-51,134,2,
-28,139,2,
-17,191,3,3,135,2,136,2,137,2,
-51,255,255,13,3,
-51,139,2,75,0,
-137,2,
-7,1,
-33,0,
-71,0,
-100,2,
-98,2,
-28,0,
-66,0,
-46,0,
-76,0,
-133,0,
-69,1,
-18,0,
-56,0,
-126,1,
-108,2,
-111,2,
-8,0,
-181,1,
-112,1,
-119,1,
-80,2,
-88,0,
-98,0,
-140,1,
-13,1,
-15,1,
-128,0,
-138,0,
-126,2,
-116,2,
-54,2,
-65,2,
-17,1,
-176,1,
-113,0,
-89,1,
-84,1,
-105,1,
-32,2,
-43,2,
-93,0,
-103,0,
-171,1,
-49,1,
-41,1,
-79,1,
-153,0,
-96,1,
-131,1,
-102,2,
-95,2,
-21,2,
-99,1,
-83,0,
-3,0,
-147,1,
-156,1,
-28,1,
-33,1,
-207,0,
-10,1,
+51,13,0,
+51,255,255,71,0,5,0,
+6,0,
+9,0,
13,0,
-51,0,
-4,1,
-108,0,
-241,0,
-23,0,
-61,0,
-124,2,
-222,1,
-23,1,
-19,1,
-101,1,
-121,2,
+3,0,
+1,0,
20,
-29,120,2,
-2,
-52,1,0,0,0,0,1,
-44,
-8,
-51,255,255,13,3,2,
-1,
-50,
-57,119,2,0,3,0,1,2,3,
-27,
-51,255,255,191,0,181,0,2,
-50,
-57,119,2,0,1,3,
-25,
-51,255,255,191,0,23,183,209,56,
-50,
-57,119,2,0,1,3,1,
-29,123,2,
-2,
-52,1,0,0,0,0,1,
-44,
-8,
-51,255,255,6,3,2,
-1,
-50,
-57,121,2,0,3,0,1,2,3,
-27,
-51,255,255,181,0,173,0,2,
-50,
-57,121,2,0,1,3,
-25,
-51,255,255,181,0,23,183,209,56,
-50,
-57,121,2,0,1,3,1,
21,};
static constexpr size_t SKSL_INCLUDE_sksl_public_LENGTH = sizeof(SKSL_INCLUDE_sksl_public);
diff --git a/chromium/third_party/skia/src/sksl/generated/sksl_rt_shader.dehydrated.sksl b/chromium/third_party/skia/src/sksl/generated/sksl_rt_shader.dehydrated.sksl
index 1f090180b6f..7c73a678bdc 100644
--- a/chromium/third_party/skia/src/sksl/generated/sksl_rt_shader.dehydrated.sksl
+++ b/chromium/third_party/skia/src/sksl/generated/sksl_rt_shader.dehydrated.sksl
@@ -1,16 +1,16 @@
-static uint8_t SKSL_INCLUDE_sksl_rt_shader[] = {11,0,20,0,
+static constexpr uint8_t SKSL_INCLUDE_sksl_rt_shader[] = {14,0,20,0,
12,115,107,95,70,114,97,103,67,111,111,114,100,
6,102,108,111,97,116,52,
52,1,1,0,
-55,1,0,
+54,1,0,
38,
37,0,2,0,0,255,255,255,255,255,255,255,15,0,255,0,2,0,
51,255,255,15,0,0,1,0,
0,0,
20,
31,
-56,1,0,
+55,1,0,
51,255,255,15,0,0,
-58,
+57,
21,};
static constexpr size_t SKSL_INCLUDE_sksl_rt_shader_LENGTH = sizeof(SKSL_INCLUDE_sksl_rt_shader);
diff --git a/chromium/third_party/skia/src/sksl/generated/sksl_runtime.dehydrated.sksl b/chromium/third_party/skia/src/sksl/generated/sksl_runtime.dehydrated.sksl
deleted file mode 100644
index 03e4fde7209..00000000000
--- a/chromium/third_party/skia/src/sksl/generated/sksl_runtime.dehydrated.sksl
+++ /dev/null
@@ -1,54 +0,0 @@
-static uint8_t SKSL_INCLUDE_sksl_runtime[] = {71,0,
-0,
-12,115,107,95,70,114,97,103,67,111,111,114,100,
-6,102,108,111,97,116,52,
-1,115,
-6,115,104,97,100,101,114,
-6,115,97,109,112,108,101,
-5,104,97,108,102,52,
-6,99,111,111,114,100,115,
-6,102,108,111,97,116,50,
-1,102,
-11,99,111,108,111,114,70,105,108,116,101,114,
-49,10,0,
-53,1,0,
-37,
-36,0,32,0,0,255,255,255,255,255,15,0,255,255,255,255,2,0,0,0,3,0,
-50,2,0,16,0,0,
-53,3,0,
-16,23,0,
-50,4,0,25,0,3,
-30,5,0,
-16,32,0,1,3,0,
-50,6,0,39,0,
-53,7,0,
-16,23,0,
-47,4,0,3,
-53,8,0,
-16,45,0,
-50,9,0,52,0,3,
-52,10,0,2,
-47,5,0,
-30,11,0,
-16,32,0,2,7,0,8,0,
-47,6,0,
-47,11,0,
-53,12,0,
-16,59,0,
-50,13,0,61,0,3,
-52,14,0,3,
-47,5,0,
-47,11,0,
-30,15,0,
-16,32,0,1,12,0,
-47,6,0,
-47,15,0,2,0,
-8,0,
-0,0,
-19,
-55,
-54,1,0,
-47,2,0,0,
-57,
-20,};
-static constexpr size_t SKSL_INCLUDE_sksl_runtime_LENGTH = sizeof(SKSL_INCLUDE_sksl_runtime);
diff --git a/chromium/third_party/skia/src/sksl/generated/sksl_shared.dehydrated.sksl b/chromium/third_party/skia/src/sksl/generated/sksl_shared.dehydrated.sksl
new file mode 100644
index 00000000000..ddd2e5f24e3
--- /dev/null
+++ b/chromium/third_party/skia/src/sksl/generated/sksl_shared.dehydrated.sksl
@@ -0,0 +1,2588 @@
+static constexpr uint8_t SKSL_INCLUDE_sksl_shared[] = {14,0,200,3,
+7,100,101,103,114,101,101,115,
+8,36,103,101,110,84,121,112,101,
+7,114,97,100,105,97,110,115,
+9,36,103,101,110,72,84,121,112,101,
+5,97,110,103,108,101,
+3,115,105,110,
+3,99,111,115,
+3,116,97,110,
+1,120,
+4,97,115,105,110,
+4,97,99,111,115,
+1,121,
+4,97,116,97,110,
+8,121,95,111,118,101,114,95,120,
+4,115,105,110,104,
+4,99,111,115,104,
+4,116,97,110,104,
+5,97,115,105,110,104,
+5,97,99,111,115,104,
+5,97,116,97,110,104,
+3,112,111,119,
+3,101,120,112,
+3,108,111,103,
+4,101,120,112,50,
+4,108,111,103,50,
+4,115,113,114,116,
+11,105,110,118,101,114,115,101,115,113,114,116,
+3,97,98,115,
+4,115,105,103,110,
+5,102,108,111,111,114,
+4,99,101,105,108,
+5,102,114,97,99,116,
+5,102,108,111,97,116,
+3,109,111,100,
+4,104,97,108,102,
+3,109,105,110,
+3,109,97,120,
+6,109,105,110,86,97,108,
+6,109,97,120,86,97,108,
+5,99,108,97,109,112,
+8,115,97,116,117,114,97,116,101,
+1,97,
+3,109,105,120,
+4,101,100,103,101,
+4,115,116,101,112,
+5,101,100,103,101,48,
+5,101,100,103,101,49,
+10,115,109,111,111,116,104,115,116,101,112,
+9,36,103,101,110,73,84,121,112,101,
+5,118,97,108,117,101,
+14,102,108,111,97,116,66,105,116,115,84,111,73,110,116,
+15,102,108,111,97,116,66,105,116,115,84,111,85,105,110,116,
+9,36,103,101,110,85,84,121,112,101,
+14,105,110,116,66,105,116,115,84,111,70,108,111,97,116,
+15,117,105,110,116,66,105,116,115,84,111,70,108,111,97,116,
+5,116,114,117,110,99,
+5,114,111,117,110,100,
+9,114,111,117,110,100,69,118,101,110,
+3,105,110,116,
+4,117,105,110,116,
+9,36,103,101,110,66,84,121,112,101,
+5,105,115,110,97,110,
+5,105,115,105,110,102,
+1,105,
+4,109,111,100,102,
+1,118,
+6,102,108,111,97,116,50,
+13,112,97,99,107,85,110,111,114,109,50,120,49,54,
+1,112,
+15,117,110,112,97,99,107,85,110,111,114,109,50,120,49,54,
+6,108,101,110,103,116,104,
+2,112,48,
+2,112,49,
+8,100,105,115,116,97,110,99,101,
+3,100,111,116,
+6,102,108,111,97,116,51,
+5,99,114,111,115,115,
+5,104,97,108,102,51,
+9,110,111,114,109,97,108,105,122,101,
+1,78,
+1,73,
+4,78,114,101,102,
+11,102,97,99,101,102,111,114,119,97,114,100,
+7,114,101,102,108,101,99,116,
+3,101,116,97,
+7,114,101,102,114,97,99,116,
+10,36,115,113,117,97,114,101,77,97,116,
+14,109,97,116,114,105,120,67,111,109,112,77,117,108,116,
+11,36,115,113,117,97,114,101,72,77,97,116,
+4,36,109,97,116,
+5,36,104,109,97,116,
+1,109,
+7,105,110,118,101,114,115,101,
+11,100,101,116,101,114,109,105,110,97,110,116,
+9,116,114,97,110,115,112,111,115,101,
+8,102,108,111,97,116,51,120,50,
+8,102,108,111,97,116,50,120,51,
+7,104,97,108,102,51,120,50,
+7,104,97,108,102,50,120,51,
+8,102,108,111,97,116,52,120,50,
+8,102,108,111,97,116,50,120,52,
+7,104,97,108,102,52,120,50,
+7,104,97,108,102,50,120,52,
+8,102,108,111,97,116,52,120,51,
+8,102,108,111,97,116,51,120,52,
+7,104,97,108,102,52,120,51,
+7,104,97,108,102,51,120,52,
+1,99,
+4,36,118,101,99,
+1,114,
+12,111,117,116,101,114,80,114,111,100,117,99,116,
+5,36,104,118,101,99,
+5,104,97,108,102,50,
+6,102,108,111,97,116,52,
+5,104,97,108,102,52,
+8,108,101,115,115,84,104,97,110,
+5,36,98,118,101,99,
+5,36,105,118,101,99,
+13,108,101,115,115,84,104,97,110,69,113,117,97,108,
+11,103,114,101,97,116,101,114,84,104,97,110,
+16,103,114,101,97,116,101,114,84,104,97,110,69,113,117,97,108,
+5,101,113,117,97,108,
+8,110,111,116,69,113,117,97,108,
+3,97,110,121,
+4,98,111,111,108,
+3,97,108,108,
+3,110,111,116,
+4,100,70,100,120,
+4,100,70,100,121,
+6,102,119,105,100,116,104,
+5,99,111,108,111,114,
+8,117,110,112,114,101,109,117,108,
+11,36,114,103,98,95,116,111,95,104,115,108,
+3,104,115,108,
+11,36,104,115,108,95,116,111,95,114,103,98,
+1,113,
+4,107,69,112,115,
+3,112,109,86,
+3,112,109,67,
+3,112,109,76,
+1,72,
+1,83,
+1,76,
+1,67,
+52,1,6,2,
+54,1,0,
+17,2,0,
+51,255,255,10,0,3,
+28,2,0,
+17,19,0,1,
+51,1,0,
+51,255,255,10,0,
+54,3,0,
+17,2,0,
+51,255,255,27,0,3,
+28,4,0,
+17,19,0,1,
+51,3,0,
+51,255,255,27,0,
+54,5,0,
+17,19,0,
+51,255,255,10,0,3,
+28,6,0,
+17,2,0,1,
+51,5,0,
+51,255,255,10,0,
+54,7,0,
+17,19,0,
+51,255,255,27,0,3,
+28,8,0,
+17,2,0,1,
+51,7,0,
+51,255,255,27,0,
+54,9,0,
+17,37,0,
+51,255,255,10,0,3,
+28,10,0,
+17,43,0,1,
+51,9,0,
+51,255,255,10,0,
+54,11,0,
+17,37,0,
+51,255,255,27,0,3,
+28,12,0,
+17,43,0,1,
+51,11,0,
+51,255,255,27,0,
+54,13,0,
+17,37,0,
+51,255,255,10,0,3,
+28,14,0,
+17,47,0,1,
+51,13,0,
+51,255,255,10,0,
+54,15,0,
+17,37,0,
+51,255,255,27,0,3,
+28,16,0,
+17,47,0,1,
+51,15,0,
+51,255,255,27,0,
+54,17,0,
+17,37,0,
+51,255,255,10,0,3,
+28,18,0,
+17,51,0,1,
+51,17,0,
+51,255,255,10,0,
+54,19,0,
+17,37,0,
+51,255,255,27,0,3,
+28,20,0,
+17,51,0,1,
+51,19,0,
+51,255,255,27,0,
+54,21,0,
+17,55,0,
+51,255,255,10,0,3,
+28,22,0,
+17,57,0,1,
+51,21,0,
+51,255,255,10,0,
+54,23,0,
+17,55,0,
+51,255,255,27,0,3,
+28,24,0,
+17,57,0,1,
+51,23,0,
+51,255,255,27,0,
+54,25,0,
+17,55,0,
+51,255,255,10,0,3,
+28,26,0,
+17,62,0,1,
+51,25,0,
+51,255,255,10,0,
+54,27,0,
+17,55,0,
+51,255,255,27,0,3,
+28,28,0,
+17,62,0,1,
+51,27,0,
+51,255,255,27,0,
+54,29,0,
+17,67,0,
+51,255,255,10,0,3,
+54,30,0,
+17,55,0,
+51,255,255,10,0,3,
+28,31,0,
+17,69,0,2,
+51,29,0,
+51,30,0,
+51,255,255,10,0,
+54,32,0,
+17,67,0,
+51,255,255,27,0,3,
+54,33,0,
+17,55,0,
+51,255,255,27,0,3,
+28,34,0,
+17,69,0,2,
+51,32,0,
+51,33,0,
+51,255,255,27,0,
+54,35,0,
+17,74,0,
+51,255,255,10,0,3,
+28,36,0,
+17,69,0,1,
+51,35,0,
+51,255,255,10,0,
+54,37,0,
+17,74,0,
+51,255,255,27,0,3,
+28,38,0,
+17,69,0,1,
+51,37,0,
+51,255,255,27,0,
+54,39,0,
+17,55,0,
+51,255,255,10,0,3,
+28,40,0,
+39,
+16,0,32,0,0,83,0,1,
+51,39,0,
+51,255,255,10,0,
+54,41,0,
+17,55,0,
+51,255,255,27,0,3,
+28,42,0,
+39,
+16,0,32,0,0,83,0,1,
+51,41,0,
+51,255,255,27,0,
+54,43,0,
+17,55,0,
+51,255,255,10,0,3,
+28,44,0,
+39,
+16,0,32,0,0,88,0,1,
+51,43,0,
+51,255,255,10,0,
+54,45,0,
+17,55,0,
+51,255,255,27,0,3,
+28,46,0,
+39,
+16,0,32,0,0,88,0,1,
+51,45,0,
+51,255,255,27,0,
+54,47,0,
+17,55,0,
+51,255,255,10,0,3,
+28,48,0,
+39,
+16,0,32,0,0,93,0,1,
+51,47,0,
+51,255,255,10,0,
+54,49,0,
+17,55,0,
+51,255,255,27,0,3,
+28,50,0,
+39,
+16,0,32,0,0,93,0,1,
+51,49,0,
+51,255,255,27,0,
+54,51,0,
+17,55,0,
+51,255,255,10,0,3,
+28,52,0,
+39,
+16,0,32,0,0,98,0,1,
+51,51,0,
+51,255,255,10,0,
+54,53,0,
+17,55,0,
+51,255,255,27,0,3,
+28,54,0,
+39,
+16,0,32,0,0,98,0,1,
+51,53,0,
+51,255,255,27,0,
+54,55,0,
+17,55,0,
+51,255,255,10,0,3,
+28,56,0,
+39,
+16,0,32,0,0,104,0,1,
+51,55,0,
+51,255,255,10,0,
+54,57,0,
+17,55,0,
+51,255,255,27,0,3,
+28,58,0,
+39,
+16,0,32,0,0,104,0,1,
+51,57,0,
+51,255,255,27,0,
+54,59,0,
+17,55,0,
+51,255,255,10,0,3,
+28,60,0,
+39,
+16,0,32,0,0,110,0,1,
+51,59,0,
+51,255,255,10,0,
+54,61,0,
+17,55,0,
+51,255,255,27,0,3,
+28,62,0,
+39,
+16,0,32,0,0,110,0,1,
+51,61,0,
+51,255,255,27,0,
+54,63,0,
+17,55,0,
+51,255,255,10,0,3,
+54,64,0,
+17,67,0,
+51,255,255,10,0,3,
+28,65,0,
+17,116,0,2,
+51,63,0,
+51,64,0,
+51,255,255,10,0,
+54,66,0,
+17,55,0,
+51,255,255,27,0,3,
+54,67,0,
+17,67,0,
+51,255,255,27,0,3,
+28,68,0,
+17,116,0,2,
+51,66,0,
+51,67,0,
+51,255,255,27,0,
+54,69,0,
+17,55,0,
+51,255,255,10,0,3,
+28,70,0,
+17,120,0,1,
+51,69,0,
+51,255,255,10,0,
+54,71,0,
+17,55,0,
+51,255,255,27,0,3,
+28,72,0,
+17,120,0,1,
+51,71,0,
+51,255,255,27,0,
+54,73,0,
+17,55,0,
+51,255,255,10,0,3,
+28,74,0,
+17,124,0,1,
+51,73,0,
+51,255,255,10,0,
+54,75,0,
+17,55,0,
+51,255,255,27,0,3,
+28,76,0,
+17,124,0,1,
+51,75,0,
+51,255,255,27,0,
+54,77,0,
+17,55,0,
+51,255,255,10,0,3,
+28,78,0,
+17,128,0,1,
+51,77,0,
+51,255,255,10,0,
+54,79,0,
+17,55,0,
+51,255,255,27,0,3,
+28,80,0,
+17,128,0,1,
+51,79,0,
+51,255,255,27,0,
+54,81,0,
+17,55,0,
+51,255,255,10,0,3,
+28,82,0,
+17,133,0,1,
+51,81,0,
+51,255,255,10,0,
+54,83,0,
+17,55,0,
+51,255,255,27,0,3,
+28,84,0,
+17,133,0,1,
+51,83,0,
+51,255,255,27,0,
+54,85,0,
+17,55,0,
+51,255,255,10,0,3,
+28,86,0,
+17,138,0,1,
+51,85,0,
+51,255,255,10,0,
+54,87,0,
+17,55,0,
+51,255,255,27,0,3,
+28,88,0,
+17,138,0,1,
+51,87,0,
+51,255,255,27,0,
+54,89,0,
+17,55,0,
+51,255,255,10,0,3,
+28,90,0,
+17,143,0,1,
+51,89,0,
+51,255,255,10,0,
+54,91,0,
+17,55,0,
+51,255,255,27,0,3,
+28,92,0,
+17,143,0,1,
+51,91,0,
+51,255,255,27,0,
+54,93,0,
+17,55,0,
+51,255,255,10,0,3,
+28,94,0,
+17,155,0,1,
+51,93,0,
+51,255,255,10,0,
+54,95,0,
+17,55,0,
+51,255,255,27,0,3,
+28,96,0,
+17,155,0,1,
+51,95,0,
+51,255,255,27,0,
+54,97,0,
+17,55,0,
+51,255,255,10,0,3,
+28,98,0,
+17,159,0,1,
+51,97,0,
+51,255,255,10,0,
+54,99,0,
+17,55,0,
+51,255,255,27,0,3,
+28,100,0,
+17,159,0,1,
+51,99,0,
+51,255,255,27,0,
+54,101,0,
+17,55,0,
+51,255,255,10,0,3,
+28,102,0,
+17,164,0,1,
+51,101,0,
+51,255,255,10,0,
+54,103,0,
+17,55,0,
+51,255,255,27,0,3,
+28,104,0,
+17,164,0,1,
+51,103,0,
+51,255,255,27,0,
+54,105,0,
+17,55,0,
+51,255,255,10,0,3,
+28,106,0,
+17,170,0,1,
+51,105,0,
+51,255,255,10,0,
+54,107,0,
+17,55,0,
+51,255,255,27,0,3,
+28,108,0,
+17,170,0,1,
+51,107,0,
+51,255,255,27,0,
+54,109,0,
+17,55,0,
+51,255,255,10,0,3,
+28,110,0,
+17,175,0,1,
+51,109,0,
+51,255,255,10,0,
+54,111,0,
+17,55,0,
+51,255,255,27,0,3,
+28,112,0,
+17,175,0,1,
+51,111,0,
+51,255,255,27,0,
+54,113,0,
+17,55,0,
+51,255,255,10,0,3,
+54,114,0,
+17,67,0,
+51,255,255,181,0,3,
+28,115,0,
+17,187,0,2,
+51,113,0,
+51,114,0,
+51,255,255,10,0,
+54,116,0,
+17,55,0,
+51,255,255,10,0,3,
+54,117,0,
+17,67,0,
+51,255,255,10,0,3,
+28,118,0,
+17,187,0,2,
+51,116,0,
+51,117,0,
+51,255,255,10,0,
+54,119,0,
+17,55,0,
+51,255,255,27,0,3,
+54,120,0,
+17,67,0,
+51,255,255,191,0,3,
+28,121,0,
+17,187,0,2,
+51,119,0,
+51,120,0,
+51,255,255,27,0,
+54,122,0,
+17,55,0,
+51,255,255,27,0,3,
+54,123,0,
+17,67,0,
+51,255,255,27,0,3,
+28,124,0,
+17,187,0,2,
+51,122,0,
+51,123,0,
+51,255,255,27,0,
+54,125,0,
+17,55,0,
+51,255,255,10,0,3,
+54,126,0,
+17,67,0,
+51,255,255,10,0,3,
+28,127,0,
+17,196,0,2,
+51,125,0,
+51,126,0,
+51,255,255,10,0,
+54,128,0,
+17,55,0,
+51,255,255,10,0,3,
+54,129,0,
+17,67,0,
+51,255,255,181,0,3,
+28,130,0,
+17,196,0,2,
+51,128,0,
+51,129,0,
+51,255,255,10,0,
+54,131,0,
+17,55,0,
+51,255,255,27,0,3,
+54,132,0,
+17,67,0,
+51,255,255,27,0,3,
+28,133,0,
+17,196,0,2,
+51,131,0,
+51,132,0,
+51,255,255,27,0,
+54,134,0,
+17,55,0,
+51,255,255,27,0,3,
+54,135,0,
+17,67,0,
+51,255,255,191,0,3,
+28,136,0,
+17,196,0,2,
+51,134,0,
+51,135,0,
+51,255,255,27,0,
+54,137,0,
+17,55,0,
+51,255,255,10,0,3,
+54,138,0,
+17,67,0,
+51,255,255,10,0,3,
+28,139,0,
+17,200,0,2,
+51,137,0,
+51,138,0,
+51,255,255,10,0,
+54,140,0,
+17,55,0,
+51,255,255,10,0,3,
+54,141,0,
+17,67,0,
+51,255,255,181,0,3,
+28,142,0,
+17,200,0,2,
+51,140,0,
+51,141,0,
+51,255,255,10,0,
+54,143,0,
+17,55,0,
+51,255,255,27,0,3,
+54,144,0,
+17,67,0,
+51,255,255,27,0,3,
+28,145,0,
+17,200,0,2,
+51,143,0,
+51,144,0,
+51,255,255,27,0,
+54,146,0,
+17,55,0,
+51,255,255,27,0,3,
+54,147,0,
+17,67,0,
+51,255,255,191,0,3,
+28,148,0,
+17,200,0,2,
+51,146,0,
+51,147,0,
+51,255,255,27,0,
+54,149,0,
+17,55,0,
+51,255,255,10,0,3,
+54,150,0,
+17,204,0,
+51,255,255,10,0,3,
+54,151,0,
+17,211,0,
+51,255,255,10,0,3,
+28,152,0,
+17,218,0,3,
+51,149,0,
+51,150,0,
+51,151,0,
+51,255,255,10,0,
+54,153,0,
+17,55,0,
+51,255,255,10,0,3,
+54,154,0,
+17,204,0,
+51,255,255,181,0,3,
+54,155,0,
+17,211,0,
+51,255,255,181,0,3,
+28,156,0,
+17,218,0,3,
+51,153,0,
+51,154,0,
+51,155,0,
+51,255,255,10,0,
+54,157,0,
+17,55,0,
+51,255,255,27,0,3,
+54,158,0,
+17,204,0,
+51,255,255,27,0,3,
+54,159,0,
+17,211,0,
+51,255,255,27,0,3,
+28,160,0,
+17,218,0,3,
+51,157,0,
+51,158,0,
+51,159,0,
+51,255,255,27,0,
+54,161,0,
+17,55,0,
+51,255,255,27,0,3,
+54,162,0,
+17,204,0,
+51,255,255,191,0,3,
+54,163,0,
+17,211,0,
+51,255,255,191,0,3,
+28,164,0,
+17,218,0,3,
+51,161,0,
+51,162,0,
+51,163,0,
+51,255,255,27,0,
+54,165,0,
+17,55,0,
+51,255,255,10,0,3,
+28,166,0,
+17,224,0,1,
+51,165,0,
+51,255,255,10,0,
+54,167,0,
+17,55,0,
+51,255,255,27,0,3,
+28,168,0,
+17,224,0,1,
+51,167,0,
+51,255,255,27,0,
+54,169,0,
+17,55,0,
+51,255,255,10,0,3,
+54,170,0,
+17,67,0,
+51,255,255,10,0,3,
+54,171,0,
+17,233,0,
+51,255,255,10,0,3,
+28,172,0,
+17,235,0,3,
+51,169,0,
+51,170,0,
+51,171,0,
+51,255,255,10,0,
+54,173,0,
+17,55,0,
+51,255,255,10,0,3,
+54,174,0,
+17,67,0,
+51,255,255,10,0,3,
+54,175,0,
+17,233,0,
+51,255,255,181,0,3,
+28,176,0,
+17,235,0,3,
+51,173,0,
+51,174,0,
+51,175,0,
+51,255,255,10,0,
+54,177,0,
+17,55,0,
+51,255,255,27,0,3,
+54,178,0,
+17,67,0,
+51,255,255,27,0,3,
+54,179,0,
+17,233,0,
+51,255,255,27,0,3,
+28,180,0,
+17,235,0,3,
+51,177,0,
+51,178,0,
+51,179,0,
+51,255,255,27,0,
+54,181,0,
+17,55,0,
+51,255,255,27,0,3,
+54,182,0,
+17,67,0,
+51,255,255,27,0,3,
+54,183,0,
+17,233,0,
+51,255,255,191,0,3,
+28,184,0,
+17,235,0,3,
+51,181,0,
+51,182,0,
+51,183,0,
+51,255,255,27,0,
+54,185,0,
+17,239,0,
+51,255,255,10,0,3,
+54,186,0,
+17,55,0,
+51,255,255,10,0,3,
+28,187,0,
+17,244,0,2,
+51,185,0,
+51,186,0,
+51,255,255,10,0,
+54,188,0,
+17,239,0,
+51,255,255,181,0,3,
+54,189,0,
+17,55,0,
+51,255,255,10,0,3,
+28,190,0,
+17,244,0,2,
+51,188,0,
+51,189,0,
+51,255,255,10,0,
+54,191,0,
+17,239,0,
+51,255,255,27,0,3,
+54,192,0,
+17,55,0,
+51,255,255,27,0,3,
+28,193,0,
+17,244,0,2,
+51,191,0,
+51,192,0,
+51,255,255,27,0,
+54,194,0,
+17,239,0,
+51,255,255,191,0,3,
+54,195,0,
+17,55,0,
+51,255,255,27,0,3,
+28,196,0,
+17,244,0,2,
+51,194,0,
+51,195,0,
+51,255,255,27,0,
+54,197,0,
+17,249,0,
+51,255,255,10,0,3,
+54,198,0,
+17,255,0,
+51,255,255,10,0,3,
+54,199,0,
+17,55,0,
+51,255,255,10,0,3,
+28,200,0,
+17,5,1,3,
+51,197,0,
+51,198,0,
+51,199,0,
+51,255,255,10,0,
+54,201,0,
+17,249,0,
+51,255,255,181,0,3,
+54,202,0,
+17,255,0,
+51,255,255,181,0,3,
+54,203,0,
+17,55,0,
+51,255,255,10,0,3,
+28,204,0,
+17,5,1,3,
+51,201,0,
+51,202,0,
+51,203,0,
+51,255,255,10,0,
+54,205,0,
+17,249,0,
+51,255,255,27,0,3,
+54,206,0,
+17,255,0,
+51,255,255,27,0,3,
+54,207,0,
+17,55,0,
+51,255,255,27,0,3,
+28,208,0,
+17,5,1,3,
+51,205,0,
+51,206,0,
+51,207,0,
+51,255,255,27,0,
+54,209,0,
+17,249,0,
+51,255,255,191,0,3,
+54,210,0,
+17,255,0,
+51,255,255,191,0,3,
+54,211,0,
+17,55,0,
+51,255,255,27,0,3,
+28,212,0,
+17,5,1,3,
+51,209,0,
+51,210,0,
+51,211,0,
+51,255,255,27,0,
+54,213,0,
+17,55,0,
+51,255,255,16,1,3,
+28,214,0,
+39,
+16,0,32,0,0,155,0,1,
+51,213,0,
+51,255,255,16,1,
+54,215,0,
+17,55,0,
+51,255,255,16,1,3,
+28,216,0,
+39,
+16,0,32,0,0,159,0,1,
+51,215,0,
+51,255,255,16,1,
+54,217,0,
+17,26,1,
+51,255,255,10,0,3,
+28,218,0,
+39,
+16,0,32,0,0,32,1,1,
+51,217,0,
+51,255,255,16,1,
+54,219,0,
+17,26,1,
+51,255,255,10,0,3,
+28,220,0,
+39,
+16,0,32,0,0,47,1,1,
+51,219,0,
+51,255,255,63,1,
+54,221,0,
+17,26,1,
+51,255,255,16,1,3,
+28,222,0,
+39,
+16,0,32,0,0,73,1,1,
+51,221,0,
+51,255,255,10,0,
+54,223,0,
+17,26,1,
+51,255,255,63,1,3,
+28,224,0,
+39,
+16,0,32,0,0,88,1,1,
+51,223,0,
+51,255,255,10,0,
+54,225,0,
+17,55,0,
+51,255,255,10,0,3,
+28,226,0,
+39,
+16,0,32,0,0,104,1,1,
+51,225,0,
+51,255,255,10,0,
+54,227,0,
+17,55,0,
+51,255,255,27,0,3,
+28,228,0,
+39,
+16,0,32,0,0,104,1,1,
+51,227,0,
+51,255,255,27,0,
+54,229,0,
+17,55,0,
+51,255,255,10,0,3,
+28,230,0,
+39,
+16,0,32,0,0,110,1,1,
+51,229,0,
+51,255,255,10,0,
+54,231,0,
+17,55,0,
+51,255,255,27,0,3,
+28,232,0,
+39,
+16,0,32,0,0,110,1,1,
+51,231,0,
+51,255,255,27,0,
+54,233,0,
+17,55,0,
+51,255,255,10,0,3,
+28,234,0,
+39,
+16,0,32,0,0,116,1,1,
+51,233,0,
+51,255,255,10,0,
+54,235,0,
+17,55,0,
+51,255,255,27,0,3,
+28,236,0,
+39,
+16,0,32,0,0,116,1,1,
+51,235,0,
+51,255,255,27,0,
+54,237,0,
+17,55,0,
+51,255,255,16,1,3,
+54,238,0,
+17,67,0,
+51,255,255,16,1,3,
+28,239,0,
+39,
+16,0,32,0,0,196,0,2,
+51,237,0,
+51,238,0,
+51,255,255,16,1,
+54,240,0,
+17,55,0,
+51,255,255,16,1,3,
+54,241,0,
+17,67,0,
+51,255,255,126,1,3,
+28,242,0,
+39,
+16,0,32,0,0,196,0,2,
+51,240,0,
+51,241,0,
+51,255,255,16,1,
+54,243,0,
+17,55,0,
+51,255,255,16,1,3,
+54,244,0,
+17,67,0,
+51,255,255,16,1,3,
+28,245,0,
+39,
+16,0,32,0,0,200,0,2,
+51,243,0,
+51,244,0,
+51,255,255,16,1,
+54,246,0,
+17,55,0,
+51,255,255,16,1,3,
+54,247,0,
+17,67,0,
+51,255,255,126,1,3,
+28,248,0,
+39,
+16,0,32,0,0,200,0,2,
+51,246,0,
+51,247,0,
+51,255,255,16,1,
+54,249,0,
+17,55,0,
+51,255,255,16,1,3,
+54,250,0,
+17,204,0,
+51,255,255,16,1,3,
+54,251,0,
+17,211,0,
+51,255,255,16,1,3,
+28,252,0,
+39,
+16,0,32,0,0,218,0,3,
+51,249,0,
+51,250,0,
+51,251,0,
+51,255,255,16,1,
+54,253,0,
+17,55,0,
+51,255,255,16,1,3,
+54,254,0,
+17,204,0,
+51,255,255,126,1,3,
+54,255,0,
+17,211,0,
+51,255,255,126,1,3,
+28,0,1,
+39,
+16,0,32,0,0,218,0,3,
+51,253,0,
+51,254,0,
+51,255,0,
+51,255,255,16,1,
+54,1,1,
+17,55,0,
+51,255,255,63,1,3,
+54,2,1,
+17,204,0,
+51,255,255,63,1,3,
+54,3,1,
+17,211,0,
+51,255,255,63,1,3,
+28,4,1,
+39,
+16,0,32,0,0,218,0,3,
+51,1,1,
+51,2,1,
+51,3,1,
+51,255,255,63,1,
+54,5,1,
+17,55,0,
+51,255,255,63,1,3,
+54,6,1,
+17,204,0,
+51,255,255,130,1,3,
+54,7,1,
+17,211,0,
+51,255,255,130,1,3,
+28,8,1,
+39,
+16,0,32,0,0,218,0,3,
+51,5,1,
+51,6,1,
+51,7,1,
+51,255,255,63,1,
+54,9,1,
+17,55,0,
+51,255,255,10,0,3,
+54,10,1,
+17,67,0,
+51,255,255,10,0,3,
+54,11,1,
+17,233,0,
+51,255,255,135,1,3,
+28,12,1,
+39,
+16,0,32,0,0,235,0,3,
+51,9,1,
+51,10,1,
+51,11,1,
+51,255,255,10,0,
+54,13,1,
+17,55,0,
+51,255,255,27,0,3,
+54,14,1,
+17,67,0,
+51,255,255,27,0,3,
+54,15,1,
+17,233,0,
+51,255,255,135,1,3,
+28,16,1,
+39,
+16,0,32,0,0,235,0,3,
+51,13,1,
+51,14,1,
+51,15,1,
+51,255,255,27,0,
+54,17,1,
+17,55,0,
+51,255,255,10,0,3,
+28,18,1,
+39,
+16,0,32,0,0,145,1,1,
+51,17,1,
+51,255,255,135,1,
+54,19,1,
+17,55,0,
+51,255,255,27,0,3,
+28,20,1,
+39,
+16,0,32,0,0,145,1,1,
+51,19,1,
+51,255,255,135,1,
+54,21,1,
+17,55,0,
+51,255,255,10,0,3,
+28,22,1,
+39,
+16,0,32,0,0,151,1,1,
+51,21,1,
+51,255,255,135,1,
+54,23,1,
+17,55,0,
+51,255,255,27,0,3,
+28,24,1,
+39,
+16,0,32,0,0,151,1,1,
+51,23,1,
+51,255,255,135,1,
+54,25,1,
+17,55,0,
+51,255,255,10,0,3,
+54,26,1,
+38,
+16,32,157,1,
+51,255,255,10,0,3,
+28,27,1,
+39,
+16,0,32,0,0,159,1,2,
+51,25,1,
+51,26,1,
+51,255,255,10,0,
+54,28,1,
+17,55,0,
+51,255,255,27,0,3,
+54,29,1,
+38,
+16,32,157,1,
+51,255,255,27,0,3,
+28,30,1,
+39,
+16,0,32,0,0,159,1,2,
+51,28,1,
+51,29,1,
+51,255,255,27,0,
+54,31,1,
+17,164,1,
+51,255,255,166,1,3,
+28,32,1,
+39,
+16,0,32,0,0,173,1,1,
+51,31,1,
+51,255,255,130,1,
+54,33,1,
+17,187,1,
+51,255,255,130,1,3,
+28,34,1,
+39,
+16,0,32,0,0,189,1,1,
+51,33,1,
+51,255,255,166,1,
+54,35,1,
+17,55,0,
+51,255,255,10,0,3,
+28,36,1,
+17,205,1,1,
+51,35,1,
+51,255,255,181,0,
+54,37,1,
+17,55,0,
+51,255,255,27,0,3,
+28,38,1,
+17,205,1,1,
+51,37,1,
+51,255,255,191,0,
+54,39,1,
+17,212,1,
+51,255,255,10,0,3,
+54,40,1,
+17,215,1,
+51,255,255,10,0,3,
+28,41,1,
+17,218,1,2,
+51,39,1,
+51,40,1,
+51,255,255,181,0,
+54,42,1,
+17,212,1,
+51,255,255,27,0,3,
+54,43,1,
+17,215,1,
+51,255,255,27,0,3,
+28,44,1,
+17,218,1,2,
+51,42,1,
+51,43,1,
+51,255,255,191,0,
+54,45,1,
+17,55,0,
+51,255,255,10,0,3,
+54,46,1,
+17,67,0,
+51,255,255,10,0,3,
+28,47,1,
+17,227,1,2,
+51,45,1,
+51,46,1,
+51,255,255,181,0,
+54,48,1,
+17,55,0,
+51,255,255,27,0,3,
+54,49,1,
+17,67,0,
+51,255,255,27,0,3,
+28,50,1,
+17,227,1,2,
+51,48,1,
+51,49,1,
+51,255,255,191,0,
+54,51,1,
+17,55,0,
+51,255,255,231,1,3,
+54,52,1,
+17,67,0,
+51,255,255,231,1,3,
+28,53,1,
+17,238,1,2,
+51,51,1,
+51,52,1,
+51,255,255,231,1,
+54,54,1,
+17,55,0,
+51,255,255,244,1,3,
+54,55,1,
+17,67,0,
+51,255,255,244,1,3,
+28,56,1,
+17,238,1,2,
+51,54,1,
+51,55,1,
+51,255,255,244,1,
+54,57,1,
+17,55,0,
+51,255,255,10,0,3,
+28,58,1,
+17,250,1,1,
+51,57,1,
+51,255,255,10,0,
+54,59,1,
+17,55,0,
+51,255,255,27,0,3,
+28,60,1,
+17,250,1,1,
+51,59,1,
+51,255,255,27,0,
+54,61,1,
+17,4,2,
+51,255,255,10,0,3,
+54,62,1,
+17,6,2,
+51,255,255,10,0,3,
+54,63,1,
+17,8,2,
+51,255,255,10,0,3,
+28,64,1,
+17,13,2,3,
+51,61,1,
+51,62,1,
+51,63,1,
+51,255,255,10,0,
+54,65,1,
+17,4,2,
+51,255,255,27,0,3,
+54,66,1,
+17,6,2,
+51,255,255,27,0,3,
+54,67,1,
+17,8,2,
+51,255,255,27,0,3,
+28,68,1,
+17,13,2,3,
+51,65,1,
+51,66,1,
+51,67,1,
+51,255,255,27,0,
+54,69,1,
+17,6,2,
+51,255,255,10,0,3,
+54,70,1,
+17,4,2,
+51,255,255,10,0,3,
+28,71,1,
+17,25,2,2,
+51,69,1,
+51,70,1,
+51,255,255,10,0,
+54,72,1,
+17,6,2,
+51,255,255,27,0,3,
+54,73,1,
+17,4,2,
+51,255,255,27,0,3,
+28,74,1,
+17,25,2,2,
+51,72,1,
+51,73,1,
+51,255,255,27,0,
+54,75,1,
+17,6,2,
+51,255,255,10,0,3,
+54,76,1,
+17,4,2,
+51,255,255,10,0,3,
+54,77,1,
+17,33,2,
+51,255,255,181,0,3,
+28,78,1,
+17,37,2,3,
+51,75,1,
+51,76,1,
+51,77,1,
+51,255,255,10,0,
+54,79,1,
+17,6,2,
+51,255,255,27,0,3,
+54,80,1,
+17,4,2,
+51,255,255,27,0,3,
+54,81,1,
+17,33,2,
+51,255,255,191,0,3,
+28,82,1,
+17,37,2,3,
+51,79,1,
+51,80,1,
+51,81,1,
+51,255,255,27,0,
+54,83,1,
+17,55,0,
+51,255,255,45,2,3,
+54,84,1,
+17,67,0,
+51,255,255,45,2,3,
+28,85,1,
+17,56,2,2,
+51,83,1,
+51,84,1,
+51,255,255,45,2,
+54,86,1,
+17,55,0,
+51,255,255,71,2,3,
+54,87,1,
+17,67,0,
+51,255,255,71,2,3,
+28,88,1,
+17,56,2,2,
+51,86,1,
+51,87,1,
+51,255,255,71,2,
+54,89,1,
+17,55,0,
+51,255,255,83,2,3,
+54,90,1,
+17,67,0,
+51,255,255,83,2,3,
+28,91,1,
+39,
+16,0,32,0,0,56,2,2,
+51,89,1,
+51,90,1,
+51,255,255,83,2,
+54,92,1,
+17,55,0,
+51,255,255,88,2,3,
+54,93,1,
+17,67,0,
+51,255,255,88,2,3,
+28,94,1,
+39,
+16,0,32,0,0,56,2,2,
+51,92,1,
+51,93,1,
+51,255,255,88,2,
+54,95,1,
+17,94,2,
+51,255,255,45,2,3,
+28,96,1,
+17,96,2,1,
+51,95,1,
+51,255,255,45,2,
+54,97,1,
+17,94,2,
+51,255,255,71,2,3,
+28,98,1,
+17,96,2,1,
+51,97,1,
+51,255,255,71,2,
+54,99,1,
+17,94,2,
+51,255,255,45,2,3,
+28,100,1,
+39,
+16,0,32,0,0,104,2,1,
+51,99,1,
+51,255,255,181,0,
+54,101,1,
+17,94,2,
+51,255,255,71,2,3,
+28,102,1,
+39,
+16,0,32,0,0,104,2,1,
+51,101,1,
+51,255,255,191,0,
+54,103,1,
+17,94,2,
+51,255,255,45,2,3,
+28,104,1,
+39,
+16,0,32,0,0,116,2,1,
+51,103,1,
+51,255,255,45,2,
+54,105,1,
+17,94,2,
+51,255,255,71,2,3,
+28,106,1,
+39,
+16,0,32,0,0,116,2,1,
+51,105,1,
+51,255,255,71,2,
+54,107,1,
+17,94,2,
+51,255,255,126,2,3,
+28,108,1,
+39,
+16,0,32,0,0,116,2,1,
+51,107,1,
+51,255,255,135,2,
+54,109,1,
+17,94,2,
+51,255,255,144,2,3,
+28,110,1,
+39,
+16,0,32,0,0,116,2,1,
+51,109,1,
+51,255,255,152,2,
+54,111,1,
+17,94,2,
+51,255,255,160,2,3,
+28,112,1,
+39,
+16,0,32,0,0,116,2,1,
+51,111,1,
+51,255,255,169,2,
+54,113,1,
+17,94,2,
+51,255,255,178,2,3,
+28,114,1,
+39,
+16,0,32,0,0,116,2,1,
+51,113,1,
+51,255,255,186,2,
+54,115,1,
+17,94,2,
+51,255,255,135,2,3,
+28,116,1,
+39,
+16,0,32,0,0,116,2,1,
+51,115,1,
+51,255,255,126,2,
+54,117,1,
+17,94,2,
+51,255,255,152,2,3,
+28,118,1,
+39,
+16,0,32,0,0,116,2,1,
+51,117,1,
+51,255,255,144,2,
+54,119,1,
+17,94,2,
+51,255,255,194,2,3,
+28,120,1,
+39,
+16,0,32,0,0,116,2,1,
+51,119,1,
+51,255,255,203,2,
+54,121,1,
+17,94,2,
+51,255,255,212,2,3,
+28,122,1,
+39,
+16,0,32,0,0,116,2,1,
+51,121,1,
+51,255,255,220,2,
+54,123,1,
+17,94,2,
+51,255,255,169,2,3,
+28,124,1,
+39,
+16,0,32,0,0,116,2,1,
+51,123,1,
+51,255,255,160,2,
+54,125,1,
+17,94,2,
+51,255,255,186,2,3,
+28,126,1,
+39,
+16,0,32,0,0,116,2,1,
+51,125,1,
+51,255,255,178,2,
+54,127,1,
+17,94,2,
+51,255,255,203,2,3,
+28,128,1,
+39,
+16,0,32,0,0,116,2,1,
+51,127,1,
+51,255,255,194,2,
+54,129,1,
+17,94,2,
+51,255,255,220,2,3,
+28,130,1,
+39,
+16,0,32,0,0,116,2,1,
+51,129,1,
+51,255,255,212,2,
+54,131,1,
+17,228,2,
+51,255,255,230,2,3,
+54,132,1,
+17,235,2,
+51,255,255,230,2,3,
+28,133,1,
+39,
+16,0,32,0,0,237,2,2,
+51,131,1,
+51,132,1,
+51,255,255,45,2,
+54,134,1,
+17,228,2,
+51,255,255,250,2,3,
+54,135,1,
+17,235,2,
+51,255,255,250,2,3,
+28,136,1,
+39,
+16,0,32,0,0,237,2,2,
+51,134,1,
+51,135,1,
+51,255,255,71,2,
+54,137,1,
+17,228,2,
+51,255,255,231,1,3,
+54,138,1,
+17,235,2,
+51,255,255,166,1,3,
+28,139,1,
+39,
+16,0,32,0,0,237,2,2,
+51,137,1,
+51,138,1,
+51,255,255,135,2,
+54,140,1,
+17,228,2,
+51,255,255,244,1,3,
+54,141,1,
+17,235,2,
+51,255,255,0,3,3,
+28,142,1,
+39,
+16,0,32,0,0,237,2,2,
+51,140,1,
+51,141,1,
+51,255,255,152,2,
+54,143,1,
+17,228,2,
+51,255,255,166,1,3,
+54,144,1,
+17,235,2,
+51,255,255,231,1,3,
+28,145,1,
+39,
+16,0,32,0,0,237,2,2,
+51,143,1,
+51,144,1,
+51,255,255,126,2,
+54,146,1,
+17,228,2,
+51,255,255,0,3,3,
+54,147,1,
+17,235,2,
+51,255,255,244,1,3,
+28,148,1,
+39,
+16,0,32,0,0,237,2,2,
+51,146,1,
+51,147,1,
+51,255,255,144,2,
+54,149,1,
+17,228,2,
+51,255,255,6,3,3,
+54,150,1,
+17,235,2,
+51,255,255,166,1,3,
+28,151,1,
+39,
+16,0,32,0,0,237,2,2,
+51,149,1,
+51,150,1,
+51,255,255,169,2,
+54,152,1,
+17,228,2,
+51,255,255,13,3,3,
+54,153,1,
+17,235,2,
+51,255,255,0,3,3,
+28,154,1,
+39,
+16,0,32,0,0,237,2,2,
+51,152,1,
+51,153,1,
+51,255,255,186,2,
+54,155,1,
+17,228,2,
+51,255,255,166,1,3,
+54,156,1,
+17,235,2,
+51,255,255,6,3,3,
+28,157,1,
+39,
+16,0,32,0,0,237,2,2,
+51,155,1,
+51,156,1,
+51,255,255,160,2,
+54,158,1,
+17,228,2,
+51,255,255,0,3,3,
+54,159,1,
+17,235,2,
+51,255,255,13,3,3,
+28,160,1,
+39,
+16,0,32,0,0,237,2,2,
+51,158,1,
+51,159,1,
+51,255,255,178,2,
+54,161,1,
+17,228,2,
+51,255,255,6,3,3,
+54,162,1,
+17,235,2,
+51,255,255,231,1,3,
+28,163,1,
+39,
+16,0,32,0,0,237,2,2,
+51,161,1,
+51,162,1,
+51,255,255,203,2,
+54,164,1,
+17,228,2,
+51,255,255,13,3,3,
+54,165,1,
+17,235,2,
+51,255,255,244,1,3,
+28,166,1,
+39,
+16,0,32,0,0,237,2,2,
+51,164,1,
+51,165,1,
+51,255,255,220,2,
+54,167,1,
+17,228,2,
+51,255,255,231,1,3,
+54,168,1,
+17,235,2,
+51,255,255,6,3,3,
+28,169,1,
+39,
+16,0,32,0,0,237,2,2,
+51,167,1,
+51,168,1,
+51,255,255,194,2,
+54,170,1,
+17,228,2,
+51,255,255,244,1,3,
+54,171,1,
+17,235,2,
+51,255,255,13,3,3,
+28,172,1,
+39,
+16,0,32,0,0,237,2,2,
+51,170,1,
+51,171,1,
+51,255,255,212,2,
+54,173,1,
+17,55,0,
+51,255,255,230,2,3,
+54,174,1,
+17,67,0,
+51,255,255,230,2,3,
+28,175,1,
+17,19,3,2,
+51,173,1,
+51,174,1,
+51,255,255,28,3,
+54,176,1,
+17,55,0,
+51,255,255,250,2,3,
+54,177,1,
+17,67,0,
+51,255,255,250,2,3,
+28,178,1,
+17,19,3,2,
+51,176,1,
+51,177,1,
+51,255,255,28,3,
+54,179,1,
+17,55,0,
+51,255,255,34,3,3,
+54,180,1,
+17,67,0,
+51,255,255,34,3,3,
+28,181,1,
+17,19,3,2,
+51,179,1,
+51,180,1,
+51,255,255,28,3,
+54,182,1,
+17,55,0,
+51,255,255,230,2,3,
+54,183,1,
+17,67,0,
+51,255,255,230,2,3,
+28,184,1,
+17,40,3,2,
+51,182,1,
+51,183,1,
+51,255,255,28,3,
+54,185,1,
+17,55,0,
+51,255,255,250,2,3,
+54,186,1,
+17,67,0,
+51,255,255,250,2,3,
+28,187,1,
+17,40,3,2,
+51,185,1,
+51,186,1,
+51,255,255,28,3,
+54,188,1,
+17,55,0,
+51,255,255,34,3,3,
+54,189,1,
+17,67,0,
+51,255,255,34,3,3,
+28,190,1,
+17,40,3,2,
+51,188,1,
+51,189,1,
+51,255,255,28,3,
+54,191,1,
+17,55,0,
+51,255,255,230,2,3,
+54,192,1,
+17,67,0,
+51,255,255,230,2,3,
+28,193,1,
+17,54,3,2,
+51,191,1,
+51,192,1,
+51,255,255,28,3,
+54,194,1,
+17,55,0,
+51,255,255,250,2,3,
+54,195,1,
+17,67,0,
+51,255,255,250,2,3,
+28,196,1,
+17,54,3,2,
+51,194,1,
+51,195,1,
+51,255,255,28,3,
+54,197,1,
+17,55,0,
+51,255,255,34,3,3,
+54,198,1,
+17,67,0,
+51,255,255,34,3,3,
+28,199,1,
+17,54,3,2,
+51,197,1,
+51,198,1,
+51,255,255,28,3,
+54,200,1,
+17,55,0,
+51,255,255,230,2,3,
+54,201,1,
+17,67,0,
+51,255,255,230,2,3,
+28,202,1,
+17,66,3,2,
+51,200,1,
+51,201,1,
+51,255,255,28,3,
+54,203,1,
+17,55,0,
+51,255,255,250,2,3,
+54,204,1,
+17,67,0,
+51,255,255,250,2,3,
+28,205,1,
+17,66,3,2,
+51,203,1,
+51,204,1,
+51,255,255,28,3,
+54,206,1,
+17,55,0,
+51,255,255,34,3,3,
+54,207,1,
+17,67,0,
+51,255,255,34,3,3,
+28,208,1,
+17,66,3,2,
+51,206,1,
+51,207,1,
+51,255,255,28,3,
+54,209,1,
+17,55,0,
+51,255,255,230,2,3,
+54,210,1,
+17,67,0,
+51,255,255,230,2,3,
+28,211,1,
+17,83,3,2,
+51,209,1,
+51,210,1,
+51,255,255,28,3,
+54,212,1,
+17,55,0,
+51,255,255,250,2,3,
+54,213,1,
+17,67,0,
+51,255,255,250,2,3,
+28,214,1,
+17,83,3,2,
+51,212,1,
+51,213,1,
+51,255,255,28,3,
+54,215,1,
+17,55,0,
+51,255,255,34,3,3,
+54,216,1,
+17,67,0,
+51,255,255,34,3,3,
+28,217,1,
+17,83,3,2,
+51,215,1,
+51,216,1,
+51,255,255,28,3,
+54,218,1,
+17,55,0,
+51,255,255,28,3,3,
+54,219,1,
+17,67,0,
+51,255,255,28,3,3,
+28,220,1,
+17,83,3,2,
+51,218,1,
+51,219,1,
+51,255,255,28,3,
+54,221,1,
+17,55,0,
+51,255,255,230,2,3,
+54,222,1,
+17,67,0,
+51,255,255,230,2,3,
+28,223,1,
+17,89,3,2,
+51,221,1,
+51,222,1,
+51,255,255,28,3,
+54,224,1,
+17,55,0,
+51,255,255,250,2,3,
+54,225,1,
+17,67,0,
+51,255,255,250,2,3,
+28,226,1,
+17,89,3,2,
+51,224,1,
+51,225,1,
+51,255,255,28,3,
+54,227,1,
+17,55,0,
+51,255,255,34,3,3,
+54,228,1,
+17,67,0,
+51,255,255,34,3,3,
+28,229,1,
+17,89,3,2,
+51,227,1,
+51,228,1,
+51,255,255,28,3,
+54,230,1,
+17,55,0,
+51,255,255,28,3,3,
+54,231,1,
+17,67,0,
+51,255,255,28,3,3,
+28,232,1,
+17,89,3,2,
+51,230,1,
+51,231,1,
+51,255,255,28,3,
+54,233,1,
+17,55,0,
+51,255,255,28,3,3,
+28,234,1,
+17,98,3,1,
+51,233,1,
+51,255,255,102,3,
+54,235,1,
+17,55,0,
+51,255,255,28,3,3,
+28,236,1,
+17,107,3,1,
+51,235,1,
+51,255,255,102,3,
+54,237,1,
+17,55,0,
+51,255,255,28,3,3,
+28,238,1,
+17,111,3,1,
+51,237,1,
+51,255,255,28,3,
+54,239,1,
+17,187,1,
+51,255,255,10,0,3,
+28,240,1,
+39,
+16,0,32,0,0,115,3,1,
+51,239,1,
+51,255,255,10,0,
+54,241,1,
+17,187,1,
+51,255,255,10,0,3,
+28,242,1,
+39,
+16,0,32,0,0,120,3,1,
+51,241,1,
+51,255,255,10,0,
+54,243,1,
+17,187,1,
+51,255,255,27,0,3,
+28,244,1,
+39,
+16,0,32,0,0,115,3,1,
+51,243,1,
+51,255,255,27,0,
+54,245,1,
+17,187,1,
+51,255,255,27,0,3,
+28,246,1,
+39,
+16,0,32,0,0,120,3,1,
+51,245,1,
+51,255,255,27,0,
+54,247,1,
+17,187,1,
+51,255,255,10,0,3,
+28,248,1,
+39,
+16,0,32,0,0,125,3,1,
+51,247,1,
+51,255,255,10,0,
+54,249,1,
+17,187,1,
+51,255,255,27,0,3,
+28,250,1,
+39,
+16,0,32,0,0,125,3,1,
+51,249,1,
+51,255,255,27,0,
+54,251,1,
+17,132,3,
+51,255,255,13,3,3,
+28,252,1,
+17,138,3,1,
+51,251,1,
+51,255,255,13,3,
+54,253,1,
+17,132,3,
+51,255,255,6,3,3,
+28,254,1,
+17,138,3,1,
+51,253,1,
+51,255,255,6,3,
+54,255,1,
+17,228,2,
+51,255,255,244,1,3,
+54,0,2,
+17,233,0,
+51,255,255,191,0,3,
+28,1,2,
+17,147,3,2,
+51,255,1,
+51,0,2,
+51,255,255,13,3,
+54,2,2,
+17,159,3,
+51,255,255,244,1,3,
+28,3,2,
+17,163,3,1,
+51,2,2,
+51,255,255,244,1,
+54,4,2,
+17,159,3,
+51,255,255,244,1,3,
+54,5,2,
+17,233,0,
+51,255,255,191,0,3,
+28,6,2,
+17,163,3,2,
+51,4,2,
+51,5,2,
+51,255,255,13,3,200,0,
+2,2,
+5,2,
+0,2,
+93,0,
+95,0,
+213,0,
+25,0,
+27,0,
+55,0,
+57,0,
+235,1,
+233,1,
+21,0,
+23,0,
+51,0,
+53,0,
+30,0,
+33,0,
+35,0,
+37,0,
+59,0,
+61,0,
+105,0,
+107,0,
+151,0,
+155,0,
+159,0,
+163,0,
+251,0,
+255,0,
+3,1,
+7,1,
+13,0,
+15,0,
+43,0,
+45,0,
+52,1,
+55,1,
+239,1,
+243,1,
+241,1,
+245,1,
+5,0,
+7,0,
+99,1,
+101,1,
+40,1,
+43,1,
+46,1,
+49,1,
+210,1,
+213,1,
+216,1,
+219,1,
+69,0,
+71,0,
+77,0,
+79,0,
+63,1,
+67,1,
+217,0,
+219,0,
+101,0,
+103,0,
+109,0,
+111,0,
+247,1,
+249,1,
+192,1,
+195,1,
+198,1,
+201,1,
+204,1,
+207,1,
+221,0,
+95,1,
+97,1,
+89,0,
+91,0,
+21,1,
+23,1,
+17,1,
+19,1,
+35,1,
+37,1,
+174,1,
+177,1,
+180,1,
+183,1,
+186,1,
+189,1,
+73,0,
+75,0,
+81,0,
+83,0,
+84,1,
+87,1,
+90,1,
+93,1,
+138,0,
+141,0,
+144,0,
+147,0,
+244,0,
+247,0,
+126,0,
+129,0,
+132,0,
+135,0,
+238,0,
+241,0,
+171,0,
+175,0,
+179,0,
+183,0,
+11,1,
+15,1,
+114,0,
+117,0,
+120,0,
+123,0,
+26,1,
+29,1,
+57,1,
+59,1,
+237,1,
+222,1,
+225,1,
+228,1,
+231,1,
+132,1,
+135,1,
+138,1,
+141,1,
+144,1,
+147,1,
+150,1,
+153,1,
+156,1,
+159,1,
+162,1,
+165,1,
+168,1,
+171,1,
+31,1,
+64,0,
+67,0,
+1,0,
+3,0,
+70,1,
+73,1,
+77,1,
+81,1,
+229,0,
+231,0,
+233,0,
+235,0,
+165,0,
+167,0,
+97,0,
+99,0,
+215,0,
+9,0,
+11,0,
+39,0,
+41,0,
+199,0,
+203,0,
+207,0,
+211,0,
+85,0,
+87,0,
+186,0,
+189,0,
+192,0,
+195,0,
+17,0,
+19,0,
+47,0,
+49,0,
+103,1,
+105,1,
+107,1,
+109,1,
+111,1,
+113,1,
+115,1,
+117,1,
+119,1,
+121,1,
+123,1,
+125,1,
+127,1,
+129,1,
+225,0,
+227,0,
+223,0,
+33,1,
+251,1,
+253,1,
+20,
+29,252,1,
+2,
+52,1,0,0,0,0,1,
+44,
+8,
+51,255,255,13,3,2,
+1,
+50,
+56,251,1,0,3,0,1,2,3,
+27,
+51,255,255,191,0,145,0,2,
+50,
+56,251,1,0,1,3,
+25,
+51,255,255,191,0,23,183,209,56,
+50,
+56,251,1,0,1,3,1,
+29,254,1,
+2,
+52,1,0,0,0,0,1,
+44,
+8,
+51,255,255,6,3,2,
+1,
+50,
+56,253,1,0,3,0,1,2,3,
+27,
+51,255,255,181,0,139,0,2,
+50,
+56,253,1,0,1,3,
+25,
+51,255,255,181,0,23,183,209,56,
+50,
+56,253,1,0,1,3,1,
+29,1,2,
+2,
+52,1,9,0,
+54,7,2,
+17,187,1,
+51,255,255,13,3,2,
+54,8,2,
+17,175,3,
+51,255,255,13,3,2,
+54,9,2,
+38,
+16,4,177,3,
+51,255,255,191,0,2,
+54,10,2,
+17,182,3,
+51,255,255,191,0,2,
+54,11,2,
+17,186,3,
+51,255,255,191,0,2,
+54,12,2,
+17,190,3,
+51,255,255,191,0,2,
+54,13,2,
+17,194,3,
+51,255,255,191,0,2,
+54,14,2,
+17,196,3,
+51,255,255,191,0,2,
+54,15,2,
+17,198,3,
+51,255,255,191,0,2,9,0,
+6,0,
+8,0,
+7,0,
+2,0,
+0,0,
+4,0,
+5,0,
+3,0,
+1,0,10,
+55,7,2,
+51,255,255,13,3,0,
+53,
+1,
+50,
+56,255,1,0,1,1,18,
+50,
+56,255,1,0,1,2,
+8,
+51,255,255,13,3,3,
+50,
+56,255,1,0,2,2,1,
+25,
+51,255,255,191,0,0,0,128,191,
+25,
+51,255,255,191,0,171,170,42,63,
+8,
+51,255,255,13,3,3,
+50,
+56,255,1,0,2,1,2,
+25,
+51,255,255,191,0,0,0,0,0,
+25,
+51,255,255,191,0,171,170,170,190,
+55,8,2,
+51,255,255,13,3,0,
+53,
+1,
+50,
+56,255,1,0,1,0,18,
+50,
+56,7,2,0,1,0,
+8,
+51,255,255,13,3,3,
+50,
+56,7,2,0,1,0,
+50,
+56,255,1,0,1,0,
+50,
+56,7,2,0,2,1,3,
+8,
+51,255,255,13,3,3,
+50,
+56,255,1,0,1,0,
+50,
+56,7,2,0,1,0,
+50,
+56,7,2,0,2,1,2,
+55,9,2,
+51,255,255,191,0,0,
+25,
+51,255,255,191,0,23,183,209,56,
+55,10,2,
+51,255,255,191,0,0,
+50,
+56,8,2,0,1,0,
+55,11,2,
+51,255,255,191,0,0,
+1,
+56,10,2,0,1,
+27,
+51,255,255,191,0,133,0,2,
+50,
+56,8,2,0,1,1,
+50,
+56,8,2,0,1,2,
+55,12,2,
+51,255,255,191,0,0,
+1,
+56,10,2,0,1,
+1,
+56,11,2,0,2,
+25,
+51,255,255,191,0,0,0,0,63,
+55,13,2,
+51,255,255,191,0,0,
+27,
+51,255,255,191,0,96,0,1,
+1,
+50,
+56,8,2,0,1,3,0,
+1,
+1,
+50,
+56,8,2,0,1,1,1,
+50,
+56,8,2,0,1,2,3,
+1,
+1,
+56,11,2,0,2,
+25,
+51,255,255,191,0,0,0,192,64,0,
+56,9,2,0,
+55,14,2,
+51,255,255,191,0,0,
+1,
+56,11,2,0,3,
+1,
+1,
+56,0,2,0,0,
+56,9,2,0,1,
+27,
+51,255,255,191,0,96,0,1,
+1,
+1,
+56,12,2,0,2,
+25,
+51,255,255,191,0,0,0,0,64,1,
+56,0,2,0,
+55,15,2,
+51,255,255,191,0,0,
+1,
+56,12,2,0,3,
+1,
+56,0,2,0,0,
+56,9,2,0,
+44,
+8,
+51,255,255,13,3,4,
+56,13,2,0,
+56,14,2,0,
+56,15,2,0,
+56,0,2,0,1,
+29,3,2,
+2,
+52,1,3,0,
+54,16,2,
+17,200,3,
+51,255,255,191,0,2,
+54,17,2,
+17,187,1,
+51,255,255,244,1,2,
+54,18,2,
+17,175,3,
+51,255,255,244,1,2,3,0,
+0,0,
+1,0,
+2,0,4,
+55,16,2,
+51,255,255,191,0,0,
+1,
+1,
+25,
+51,255,255,191,0,0,0,128,63,1,
+27,
+51,255,255,191,0,96,0,1,
+1,
+1,
+25,
+51,255,255,191,0,0,0,0,64,2,
+50,
+56,2,2,0,1,2,1,
+25,
+51,255,255,191,0,0,0,128,63,2,
+50,
+56,2,2,0,1,1,
+55,17,2,
+51,255,255,244,1,0,
+1,
+50,
+56,2,2,0,3,0,0,0,0,
+8,
+51,255,255,244,1,3,
+25,
+51,255,255,191,0,0,0,0,0,
+25,
+51,255,255,191,0,171,170,42,63,
+25,
+51,255,255,191,0,171,170,170,62,
+55,18,2,
+51,255,255,244,1,0,
+27,
+51,255,255,244,1,168,0,1,
+1,
+27,
+51,255,255,244,1,96,0,1,
+1,
+1,
+27,
+51,255,255,244,1,112,0,1,
+56,17,2,0,2,
+25,
+51,255,255,191,0,0,0,192,64,1,
+25,
+51,255,255,191,0,0,0,64,64,1,
+25,
+51,255,255,191,0,0,0,128,63,
+44,
+1,
+1,
+1,
+56,18,2,0,1,
+25,
+51,255,255,191,0,0,0,0,63,2,
+56,16,2,0,0,
+50,
+56,2,2,0,1,2,1,
+29,6,2,
+2,
+52,1,0,0,0,0,1,
+44,
+27,
+51,255,255,13,3,168,0,1,
+8,
+51,255,255,13,3,2,
+1,
+27,
+51,255,255,244,1,3,2,1,
+56,4,2,0,2,
+56,5,2,0,
+56,5,2,0,1,
+21,};
+static constexpr size_t SKSL_INCLUDE_sksl_shared_LENGTH = sizeof(SKSL_INCLUDE_sksl_shared);
diff --git a/chromium/third_party/skia/src/sksl/generated/sksl_vert.dehydrated.sksl b/chromium/third_party/skia/src/sksl/generated/sksl_vert.dehydrated.sksl
index 3010f0b5658..8ccf3eefd7b 100644
--- a/chromium/third_party/skia/src/sksl/generated/sksl_vert.dehydrated.sksl
+++ b/chromium/third_party/skia/src/sksl/generated/sksl_vert.dehydrated.sksl
@@ -1,4 +1,4 @@
-static uint8_t SKSL_INCLUDE_sksl_vert[] = {11,0,82,0,
+static constexpr uint8_t SKSL_INCLUDE_sksl_vert[] = {14,0,82,0,
12,115,107,95,80,101,114,86,101,114,116,101,120,
11,115,107,95,80,111,115,105,116,105,111,110,
6,102,108,111,97,116,52,
@@ -16,17 +16,17 @@ static uint8_t SKSL_INCLUDE_sksl_vert[] = {11,0,82,0,
38,
37,0,2,0,0,255,255,255,255,255,255,255,1,0,255,0,34,0,
51,255,255,47,0,1,
-55,2,0,
+54,2,0,
38,
16,32,2,0,
51,1,0,0,
23,2,0,0,
23,2,0,1,
-55,3,0,
+54,3,0,
38,
37,0,2,0,0,255,255,255,255,255,255,255,42,0,255,16,53,0,
51,255,255,65,0,0,
-55,4,0,
+54,4,0,
38,
37,0,2,0,0,255,255,255,255,255,255,255,43,0,255,16,69,0,
51,255,255,65,0,0,4,0,
@@ -38,12 +38,12 @@ static uint8_t SKSL_INCLUDE_sksl_vert[] = {11,0,82,0,
35,
51,2,0,2,0,83,0,0,
31,
-56,3,0,
+55,3,0,
51,255,255,65,0,0,
-58,
+57,
31,
-56,4,0,
+55,4,0,
51,255,255,65,0,0,
-58,
+57,
21,};
static constexpr size_t SKSL_INCLUDE_sksl_vert_LENGTH = sizeof(SKSL_INCLUDE_sksl_vert);
diff --git a/chromium/third_party/skia/src/sksl/ir/BUILD.bazel b/chromium/third_party/skia/src/sksl/ir/BUILD.bazel
index 58b4ccca16e..c4ad0961030 100644
--- a/chromium/third_party/skia/src/sksl/ir/BUILD.bazel
+++ b/chromium/third_party/skia/src/sksl/ir/BUILD.bazel
@@ -90,7 +90,6 @@ IR_FILES = [
"SkSLType.h",
"SkSLTypeReference.cpp",
"SkSLTypeReference.h",
- "SkSLUnresolvedFunction.h",
"SkSLVarDeclarations.cpp",
"SkSLVarDeclarations.h",
"SkSLVariable.cpp",
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLChildCall.cpp b/chromium/third_party/skia/src/sksl/ir/SkSLChildCall.cpp
index 825c08091bd..7d7a1de0000 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLChildCall.cpp
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLChildCall.cpp
@@ -14,6 +14,8 @@
#include "src/sksl/ir/SkSLType.h"
#include "src/sksl/ir/SkSLVariable.h"
+#include <cstddef>
+
namespace SkSL {
bool ChildCall::hasProperty(Property property) const {
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLConstructorArrayCast.cpp b/chromium/third_party/skia/src/sksl/ir/SkSLConstructorArrayCast.cpp
index 59f5336c034..4824670b3e6 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLConstructorArrayCast.cpp
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLConstructorArrayCast.cpp
@@ -19,6 +19,7 @@
namespace SkSL {
static std::unique_ptr<Expression> cast_constant_array(const Context& context,
+ Position pos,
const Type& destType,
std::unique_ptr<Expression> constCtor) {
const Type& scalarType = destType.componentType();
@@ -28,17 +29,17 @@ static std::unique_ptr<Expression> cast_constant_array(const Context& context,
ExpressionArray typecastArgs;
typecastArgs.reserve_back(inputArgs.size());
for (std::unique_ptr<Expression>& arg : inputArgs) {
- Position pos = arg->fPosition;
+ Position argPos = arg->fPosition;
if (arg->type().isScalar()) {
- typecastArgs.push_back(ConstructorScalarCast::Make(context, pos, scalarType,
+ typecastArgs.push_back(ConstructorScalarCast::Make(context, argPos, scalarType,
std::move(arg)));
} else {
- typecastArgs.push_back(ConstructorCompoundCast::Make(context, pos, scalarType,
+ typecastArgs.push_back(ConstructorCompoundCast::Make(context, argPos, scalarType,
std::move(arg)));
}
}
- return ConstructorArray::Make(context, constCtor->fPosition, destType, std::move(typecastArgs));
+ return ConstructorArray::Make(context, pos, destType, std::move(typecastArgs));
}
std::unique_ptr<Expression> ConstructorArrayCast::Make(const Context& context,
@@ -53,6 +54,7 @@ std::unique_ptr<Expression> ConstructorArrayCast::Make(const Context& context,
// If this is a no-op cast, return the expression as-is.
if (type.matches(arg->type())) {
+ arg->fPosition = pos;
return arg;
}
@@ -62,7 +64,7 @@ std::unique_ptr<Expression> ConstructorArrayCast::Make(const Context& context,
// We can cast a vector of compile-time constants at compile-time.
if (arg->isCompileTimeConstant()) {
- return cast_constant_array(context, type, std::move(arg));
+ return cast_constant_array(context, pos, type, std::move(arg));
}
return std::make_unique<ConstructorArrayCast>(pos, type, std::move(arg));
}
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLConstructorCompoundCast.cpp b/chromium/third_party/skia/src/sksl/ir/SkSLConstructorCompoundCast.cpp
index 05af06b1275..f54197a7a11 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLConstructorCompoundCast.cpp
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLConstructorCompoundCast.cpp
@@ -17,6 +17,7 @@
#include "src/sksl/ir/SkSLLiteral.h"
#include "src/sksl/ir/SkSLType.h"
+#include <cstddef>
#include <optional>
namespace SkSL {
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLFieldAccess.cpp b/chromium/third_party/skia/src/sksl/ir/SkSLFieldAccess.cpp
index c0dbf6981f2..6c23c1304e2 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLFieldAccess.cpp
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLFieldAccess.cpp
@@ -20,7 +20,8 @@
#include "src/sksl/ir/SkSLMethodReference.h"
#include "src/sksl/ir/SkSLSetting.h"
#include "src/sksl/ir/SkSLSymbolTable.h"
-#include "src/sksl/ir/SkSLUnresolvedFunction.h"
+
+#include <cstddef>
namespace SkSL {
@@ -34,25 +35,12 @@ std::unique_ptr<Expression> FieldAccess::Convert(const Context& context,
// Turn the field name into a free function name, prefixed with '$':
std::string methodName = "$" + std::string(field);
const Symbol* result = symbolTable[methodName];
- if (result) {
- switch (result->kind()) {
- case Symbol::Kind::kFunctionDeclaration: {
- std::vector<const FunctionDeclaration*> f = {
- &result->as<FunctionDeclaration>()};
- return std::make_unique<MethodReference>(
- context, pos, std::move(base), f);
- }
- case Symbol::Kind::kUnresolvedFunction: {
- const UnresolvedFunction& f = result->as<UnresolvedFunction>();
- return std::make_unique<MethodReference>(
- context, pos, std::move(base), f.functions());
- }
- default:
- break;
- }
+ if (result && result->is<FunctionDeclaration>()) {
+ return std::make_unique<MethodReference>(context, pos, std::move(base),
+ &result->as<FunctionDeclaration>());
}
context.fErrors->error(pos, "type '" + baseType.displayName() + "' has no method named '" +
- std::string(field) + "'");
+ std::string(field) + "'");
return nullptr;
}
if (baseType.isStruct()) {
@@ -68,7 +56,7 @@ std::unique_ptr<Expression> FieldAccess::Convert(const Context& context,
}
context.fErrors->error(pos, "type '" + baseType.displayName() +
- "' does not have a field named '" + std::string(field) + "'");
+ "' does not have a field named '" + std::string(field) + "'");
return nullptr;
}
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLFunctionCall.cpp b/chromium/third_party/skia/src/sksl/ir/SkSLFunctionCall.cpp
index 5a7ed5456b9..88c69b54970 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLFunctionCall.cpp
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLFunctionCall.cpp
@@ -7,6 +7,7 @@
#include "src/sksl/ir/SkSLFunctionCall.h"
+#include "include/core/SkSpan.h"
#include "include/core/SkTypes.h"
#include "include/private/SkFloatingPoint.h"
#include "include/private/SkSLModifiers.h"
@@ -31,15 +32,20 @@
#include "src/sksl/ir/SkSLFunctionReference.h"
#include "src/sksl/ir/SkSLLiteral.h"
#include "src/sksl/ir/SkSLMethodReference.h"
+#include "src/sksl/ir/SkSLType.h"
#include "src/sksl/ir/SkSLTypeReference.h"
#include "src/sksl/ir/SkSLVariable.h"
#include "src/sksl/ir/SkSLVariableReference.h"
#include <algorithm>
#include <array>
+#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include <cstdint>
#include <optional>
#include <string_view>
+#include <vector>
namespace SkSL {
@@ -132,8 +138,10 @@ static std::unique_ptr<Expression> coalesce_n_way_vector(const Expression* arg0,
value = coalesce(value, *arg0Value, *arg1Value);
- // If coalescing the intrinsic yields a non-finite value, do not optimize.
- if (!std::isfinite(value)) {
+ if (value >= -FLT_MAX && value <= FLT_MAX) {
+ // This result will fit inside a float Literal.
+ } else {
+ // The value is outside the float range or is NaN (all if-checks fail); do not optimize.
return nullptr;
}
}
@@ -251,8 +259,10 @@ static std::unique_ptr<Expression> evaluate_n_way_intrinsic(const Context& conte
array[index] = eval(*arg0Value, *arg1Value, *arg2Value);
- // If evaluation of the intrinsic yields a non-finite value, do not optimize.
- if (!std::isfinite(array[index])) {
+ if (array[index] >= -FLT_MAX && array[index] <= FLT_MAX) {
+ // This result will fit inside a float Literal.
+ } else {
+ // The value is outside the float range or is NaN (all if-checks fail); do not optimize.
return nullptr;
}
}
@@ -755,7 +765,7 @@ static std::unique_ptr<Expression> optimize_intrinsic_call(const Context& contex
}
double dmat[16];
- std::copy(mat, mat + SK_ARRAY_COUNT(mat), dmat);
+ std::copy(mat, mat + std::size(mat), dmat);
return assemble_compound(context, arguments[0]->fPosition, returnType, dmat);
}
// 8.7 : Vector Relational Functions
@@ -813,7 +823,7 @@ std::unique_ptr<Expression> FunctionCall::clone(Position pos) const {
std::string FunctionCall::description() const {
std::string result = std::string(this->function().name()) + "(";
- std::string separator;
+ const char* separator = "";
for (const std::unique_ptr<Expression>& arg : this->arguments()) {
result += separator;
result += arg->description();
@@ -828,8 +838,9 @@ std::string FunctionCall::description() const {
* particular meaning other than "lower costs are preferred". Returns CoercionCost::Impossible() if
* the call is not valid.
*/
-CoercionCost FunctionCall::CallCost(const Context& context, const FunctionDeclaration& function,
- const ExpressionArray& arguments){
+static CoercionCost call_cost(const Context& context,
+ const FunctionDeclaration& function,
+ const ExpressionArray& arguments) {
if (context.fConfig->strictES2Mode() &&
(function.modifiers().fFlags & Modifiers::kES3_Flag)) {
return CoercionCost::Impossible();
@@ -851,21 +862,32 @@ CoercionCost FunctionCall::CallCost(const Context& context, const FunctionDeclar
const FunctionDeclaration* FunctionCall::FindBestFunctionForCall(
const Context& context,
- const std::vector<const FunctionDeclaration*>& functions,
+ const FunctionDeclaration* overloadChain,
const ExpressionArray& arguments) {
- if (functions.size() == 1) {
- return functions.front();
+ if (!overloadChain->nextOverload()) {
+ return overloadChain;
}
CoercionCost bestCost = CoercionCost::Impossible();
const FunctionDeclaration* best = nullptr;
- for (const auto& f : functions) {
- CoercionCost cost = CallCost(context, *f, arguments);
- if (cost < bestCost) {
+ for (const FunctionDeclaration* f = overloadChain; f != nullptr; f = f->nextOverload()) {
+ CoercionCost cost = call_cost(context, *f, arguments);
+ if (cost <= bestCost) {
bestCost = cost;
best = f;
}
}
- return best;
+ return bestCost.fImpossible ? nullptr : best;
+}
+
+static std::string build_argument_type_list(SkSpan<const std::unique_ptr<Expression>> arguments) {
+ std::string result = "(";
+ const char* separator = "";
+ for (const std::unique_ptr<Expression>& arg : arguments) {
+ result += separator;
+ separator = ", ";
+ result += arg->type().displayName();
+ }
+ return result + ")";
}
std::unique_ptr<Expression> FunctionCall::Convert(const Context& context,
@@ -901,20 +923,13 @@ std::unique_ptr<Expression> FunctionCall::Convert(const Context& context,
}
case Expression::Kind::kFunctionReference: {
const FunctionReference& ref = functionValue->as<FunctionReference>();
- const std::vector<const FunctionDeclaration*>& functions = ref.functions();
- const FunctionDeclaration* best = FindBestFunctionForCall(context, functions,
- arguments);
+ const FunctionDeclaration* best = FindBestFunctionForCall(context, ref.overloadChain(),
+ arguments);
if (best) {
return FunctionCall::Convert(context, pos, *best, std::move(arguments));
}
- std::string msg = "no match for " + std::string(functions[0]->name()) + "(";
- std::string separator;
- for (size_t i = 0; i < arguments.size(); i++) {
- msg += separator;
- separator = ", ";
- msg += arguments[i]->type().displayName();
- }
- msg += ")";
+ std::string msg = "no match for " + std::string(ref.overloadChain()->name()) +
+ build_argument_type_list(arguments);
context.fErrors->error(pos, msg);
return nullptr;
}
@@ -922,21 +937,15 @@ std::unique_ptr<Expression> FunctionCall::Convert(const Context& context,
MethodReference& ref = functionValue->as<MethodReference>();
arguments.push_back(std::move(ref.self()));
- const std::vector<const FunctionDeclaration*>& functions = ref.functions();
- const FunctionDeclaration* best = FindBestFunctionForCall(context, functions,
- arguments);
+ const FunctionDeclaration* best = FindBestFunctionForCall(context, ref.overloadChain(),
+ arguments);
if (best) {
return FunctionCall::Convert(context, pos, *best, std::move(arguments));
}
- std::string msg = "no match for " + arguments.back()->type().displayName() +
- "::" + std::string(functions[0]->name().substr(1)) + "(";
- std::string separator;
- for (size_t i = 0; i < arguments.size() - 1; i++) {
- msg += separator;
- separator = ", ";
- msg += arguments[i]->type().displayName();
- }
- msg += ")";
+ std::string msg =
+ "no match for " + arguments.back()->type().displayName() +
+ "::" + std::string(ref.overloadChain()->name().substr(1)) +
+ build_argument_type_list(SkSpan(arguments).first(arguments.size() - 1));
context.fErrors->error(pos, msg);
return nullptr;
}
@@ -975,14 +984,8 @@ std::unique_ptr<Expression> FunctionCall::Convert(const Context& context,
FunctionDeclaration::ParamTypes types;
const Type* returnType;
if (!function.determineFinalTypes(arguments, &types, &returnType)) {
- std::string msg = "no match for " + std::string(function.name()) + "(";
- std::string separator ;
- for (const std::unique_ptr<Expression>& arg : arguments) {
- msg += separator;
- msg += arg->type().displayName();
- separator = ", ";
- }
- msg += ")";
+ std::string msg = "no match for " + std::string(function.name()) +
+ build_argument_type_list(arguments);
context.fErrors->error(pos, msg);
return nullptr;
}
@@ -1003,6 +1006,13 @@ std::unique_ptr<Expression> FunctionCall::Convert(const Context& context,
return nullptr;
}
}
+ // TODO(skia:13609): Make sure that we don't pass writeonly objects to readonly parameters,
+ // or vice-versa.
+ }
+
+ if (function.isMain()) {
+ context.fErrors->error(pos, "call to 'main' is not allowed");
+ return nullptr;
}
if (function.intrinsicKind() == k_eval_IntrinsicKind) {
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLFunctionCall.h b/chromium/third_party/skia/src/sksl/ir/SkSLFunctionCall.h
index 342e4436016..386a1aa5549 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLFunctionCall.h
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLFunctionCall.h
@@ -11,17 +11,16 @@
#include "include/private/SkSLDefines.h"
#include "include/sksl/SkSLPosition.h"
#include "src/sksl/ir/SkSLExpression.h"
-#include "src/sksl/ir/SkSLType.h"
#include <memory>
#include <string>
#include <utility>
-#include <vector>
namespace SkSL {
class Context;
class FunctionDeclaration;
+class Type;
/**
* A function invocation.
@@ -55,10 +54,9 @@ public:
const FunctionDeclaration& function,
ExpressionArray arguments);
- static const FunctionDeclaration* FindBestFunctionForCall(
- const Context& context,
- const std::vector<const FunctionDeclaration*>& functions,
- const ExpressionArray& arguments);
+ static const FunctionDeclaration* FindBestFunctionForCall(const Context& context,
+ const FunctionDeclaration* overloads,
+ const ExpressionArray& arguments);
const FunctionDeclaration& function() const {
return fFunction;
@@ -79,10 +77,6 @@ public:
std::string description() const override;
private:
- static CoercionCost CallCost(const Context& context,
- const FunctionDeclaration& function,
- const ExpressionArray& arguments);
-
const FunctionDeclaration& fFunction;
ExpressionArray fArguments;
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLFunctionDeclaration.cpp b/chromium/third_party/skia/src/sksl/ir/SkSLFunctionDeclaration.cpp
index c6002792ecd..917c8b48b8c 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLFunctionDeclaration.cpp
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLFunctionDeclaration.cpp
@@ -7,7 +7,6 @@
#include "src/sksl/ir/SkSLFunctionDeclaration.h"
-#include "include/core/SkSpan.h"
#include "include/core/SkTypes.h"
#include "include/private/SkSLDefines.h"
#include "include/private/SkSLLayout.h"
@@ -25,9 +24,10 @@
#include "src/sksl/ir/SkSLExpression.h"
#include "src/sksl/ir/SkSLSymbolTable.h"
#include "src/sksl/ir/SkSLType.h"
-#include "src/sksl/ir/SkSLUnresolvedFunction.h"
#include "src/sksl/ir/SkSLVariable.h"
+#include <algorithm>
+#include <cstddef>
#include <initializer_list>
#include <utility>
@@ -95,16 +95,24 @@ static bool check_parameters(const Context& context,
// Check modifiers on each function parameter.
for (auto& param : parameters) {
- param->modifiers().checkPermitted(context, param->modifiersPosition(),
- Modifiers::kConst_Flag | Modifiers::kIn_Flag | Modifiers::kOut_Flag,
- /*permittedLayoutFlags=*/0);
const Type& type = param->type();
+ int permittedFlags = Modifiers::kConst_Flag | Modifiers::kIn_Flag;
+ if (!type.isOpaque()) {
+ permittedFlags |= Modifiers::kOut_Flag;
+ }
+ if (type.typeKind() == Type::TypeKind::kTexture) {
+ permittedFlags |= Modifiers::kReadOnly_Flag | Modifiers::kWriteOnly_Flag;
+ }
+ param->modifiers().checkPermitted(context,
+ param->modifiersPosition(),
+ permittedFlags,
+ /*permittedLayoutFlags=*/0);
// Only the (builtin) declarations of 'sample' are allowed to have shader/colorFilter or FP
// parameters. You can pass other opaque types to functions safely; this restriction is
// specific to "child" objects.
if (type.isEffectChild() && !context.fConfig->fIsBuiltinCode) {
context.fErrors->error(param->fPosition, "parameters of type '" + type.displayName() +
- "' not allowed");
+ "' not allowed");
return false;
}
@@ -129,7 +137,7 @@ static bool check_parameters(const Context& context,
m.fLayout.fBuiltin = SK_MAIN_COORDS_BUILTIN;
modifiersChanged = true;
} else if (typeIsValidForColor(type) &&
- builtinColorIndex < SK_ARRAY_COUNT(kBuiltinColorIDs)) {
+ builtinColorIndex < std::size(kBuiltinColorIDs)) {
m.fLayout.fBuiltin = kBuiltinColorIDs[builtinColorIndex++];
modifiersChanged = true;
}
@@ -292,6 +300,11 @@ static bool check_main_signature(const Context& context, Position pos, const Typ
}
case ProgramKind::kVertex:
case ProgramKind::kGraphiteVertex:
+ case ProgramKind::kCompute:
+ if (!returnType.matches(*context.fTypes.fVoid)) {
+ errors.error(pos, "'main' must return 'void'");
+ return false;
+ }
if (parameters.size()) {
errors.error(pos, "shader 'main' must have zero parameters");
return false;
@@ -302,23 +315,85 @@ static bool check_main_signature(const Context& context, Position pos, const Typ
}
/**
- * Checks for a previously existing declaration of this function, reporting errors if there is an
- * incompatible symbol. Returns true and sets outExistingDecl to point to the existing declaration
- * (or null if none) on success, returns false on error.
+ * Given a concrete type (`float3`) and a generic type (`$genType`), returns the index of the
+ * concrete type within the generic type's typelist. Returns -1 if there is no match.
+ */
+static int find_generic_index(const Type& concreteType,
+ const Type& genericType,
+ bool allowNarrowing) {
+ const std::vector<const Type*>& genericTypes = genericType.coercibleTypes();
+ for (size_t index = 0; index < genericTypes.size(); ++index) {
+ if (concreteType.canCoerceTo(*genericTypes[index], allowNarrowing)) {
+ return index;
+ }
+ }
+ return -1;
+}
+
+/** Returns true if the types match, or if `concreteType` can be found in `maybeGenericType`. */
+static bool type_generically_matches(const Type& concreteType, const Type& maybeGenericType) {
+ return maybeGenericType.isGeneric()
+ ? find_generic_index(concreteType, maybeGenericType, /*allowNarrowing=*/false) != -1
+ : concreteType.matches(maybeGenericType);
+}
+
+/**
+ * Checks a parameter list (params) against the parameters of a function that was declared earlier
+ * (otherParams). Returns true if they match, even if the parameters in `otherParams` contain
+ * generic types.
*/
static bool parameters_match(const std::vector<std::unique_ptr<Variable>>& params,
const std::vector<const Variable*>& otherParams) {
+ // If the param lists are different lengths, they're definitely not a match.
if (params.size() != otherParams.size()) {
return false;
}
+
+ // Figure out a consistent generic index (or bail if we find a contradiction).
+ int genericIndex = -1;
+ for (size_t i = 0; i < params.size(); ++i) {
+ const Type* paramType = &params[i]->type();
+ const Type* otherParamType = &otherParams[i]->type();
+
+ if (otherParamType->isGeneric()) {
+ int genericIndexForThisParam = find_generic_index(*paramType, *otherParamType,
+ /*allowNarrowing=*/false);
+ if (genericIndexForThisParam == -1) {
+ // The type wasn't a match for this generic at all; these params can't be a match.
+ return false;
+ }
+ if (genericIndex != -1 && genericIndex != genericIndexForThisParam) {
+ // The generic index mismatches from what we determined on a previous parameter.
+ return false;
+ }
+ genericIndex = genericIndexForThisParam;
+ }
+ }
+
+ // Now that we've determined a generic index (if we needed one), do a parameter check.
for (size_t i = 0; i < params.size(); i++) {
- if (!params[i]->type().matches(otherParams[i]->type())) {
+ const Type* paramType = &params[i]->type();
+ const Type* otherParamType = &otherParams[i]->type();
+
+ // Make generic types concrete.
+ if (otherParamType->isGeneric()) {
+ SkASSERT(genericIndex != -1);
+ SkASSERT(genericIndex < (int)otherParamType->coercibleTypes().size());
+ otherParamType = otherParamType->coercibleTypes()[genericIndex];
+ }
+ // Detect type mismatches.
+ if (!paramType->matches(*otherParamType)) {
return false;
}
}
return true;
}
+/**
+ * Checks for a previously existing declaration of this function, reporting errors if there is an
+ * incompatible symbol. Returns true and sets outExistingDecl to point to the existing declaration
+ * (or null if none) on success, returns false on error.
+ */
static bool find_existing_declaration(const Context& context,
SymbolTable& symbols,
Position pos,
@@ -331,26 +406,17 @@ static bool find_existing_declaration(const Context& context,
const Symbol* entry = symbols[name];
*outExistingDecl = nullptr;
if (entry) {
- SkSpan<const FunctionDeclaration* const> functions;
- const FunctionDeclaration* declPtr;
- switch (entry->kind()) {
- case Symbol::Kind::kUnresolvedFunction:
- functions = SkMakeSpan(entry->as<UnresolvedFunction>().functions());
- break;
- case Symbol::Kind::kFunctionDeclaration:
- declPtr = &entry->as<FunctionDeclaration>();
- functions = SkMakeSpan(&declPtr, 1);
- break;
- default:
- errors.error(pos, "symbol '" + std::string(name) + "' was already defined");
- return false;
+ if (!entry->is<FunctionDeclaration>()) {
+ errors.error(pos, "symbol '" + std::string(name) + "' was already defined");
+ return false;
}
- for (const FunctionDeclaration* other : functions) {
+ for (const FunctionDeclaration* other = &entry->as<FunctionDeclaration>();
+ other; other = other->nextOverload()) {
SkASSERT(name == other->name());
if (!parameters_match(parameters, other->parameters())) {
continue;
}
- if (!returnType->matches(other->returnType())) {
+ if (!type_generically_matches(*returnType, other->returnType())) {
std::vector<const Variable*> paramPtrs;
paramPtrs.reserve(parameters.size());
for (std::unique_ptr<Variable>& param : parameters) {
@@ -374,7 +440,7 @@ static bool find_existing_declaration(const Context& context,
return false;
}
}
- if (other->definition() && !other->isBuiltin()) {
+ if (other->definition() || other->isBuiltin()) {
errors.error(pos, "duplicate definition of " + other->description());
return false;
}
@@ -398,7 +464,10 @@ FunctionDeclaration::FunctionDeclaration(Position pos,
, fReturnType(returnType)
, fBuiltin(builtin)
, fIsMain(name == "main")
- , fIntrinsicKind(builtin ? identify_intrinsic(name) : kNotIntrinsic) {}
+ , fIntrinsicKind(builtin ? identify_intrinsic(name) : kNotIntrinsic) {
+ // None of the parameters are allowed to be be null.
+ SkASSERT(std::count(fParameters.begin(), fParameters.end(), nullptr) == 0);
+}
const FunctionDeclaration* FunctionDeclaration::Convert(
const Context& context,
@@ -443,7 +512,7 @@ std::string FunctionDeclaration::mangledName() const {
// Builtins without a definition (like `sin` or `sqrt`) must use their real names.
return std::string(this->name());
}
- // Built-in functions can have a $ prefix, which will fail to compile in GLSL/Metal. Remove the
+ // Built-in functions can have a $ prefix, which will fail to compile in GLSL. Remove the
// $ and add a unique mangling specifier, so user code can't conflict with the name.
std::string_view name = this->name();
const char* builtinMarker = "";
@@ -504,31 +573,26 @@ bool FunctionDeclaration::determineFinalTypes(const ExpressionArray& arguments,
for (size_t i = 0; i < arguments.size(); i++) {
// Non-generic parameters are final as-is.
const Type& parameterType = parameters[i]->type();
- if (parameterType.typeKind() != Type::TypeKind::kGeneric) {
+ if (!parameterType.isGeneric()) {
outParameterTypes->push_back(&parameterType);
continue;
}
// We use the first generic parameter we find to lock in the generic index;
// e.g. if we find `float3` here, all `$genType`s will be assumed to be `float3`.
- const std::vector<const Type*>& types = parameterType.coercibleTypes();
if (genericIndex == -1) {
- for (size_t j = 0; j < types.size(); j++) {
- if (arguments[i]->type().canCoerceTo(*types[j], /*allowNarrowing=*/true)) {
- genericIndex = j;
- break;
- }
- }
+ genericIndex = find_generic_index(arguments[i]->type(), parameterType,
+ /*allowNarrowing=*/true);
if (genericIndex == -1) {
// The passed-in type wasn't a match for ANY of the generic possibilities.
// This function isn't a match at all.
return false;
}
}
- outParameterTypes->push_back(types[genericIndex]);
+ outParameterTypes->push_back(parameterType.coercibleTypes()[genericIndex]);
}
// Apply the generic index to our return type.
const Type& returnType = this->returnType();
- if (returnType.typeKind() == Type::TypeKind::kGeneric) {
+ if (returnType.isGeneric()) {
if (genericIndex == -1) {
// We don't support functions with a generic return type and no other generics.
return false;
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLFunctionDeclaration.h b/chromium/third_party/skia/src/sksl/ir/SkSLFunctionDeclaration.h
index 2b84f9b98a7..c050e63d1f2 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLFunctionDeclaration.h
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLFunctionDeclaration.h
@@ -8,6 +8,7 @@
#ifndef SKSL_FUNCTIONDECLARATION
#define SKSL_FUNCTIONDECLARATION
+#include "include/core/SkTypes.h"
#include "include/private/SkSLSymbol.h"
#include "include/private/SkTArray.h"
#include "src/sksl/SkSLIntrinsicList.h"
@@ -75,6 +76,11 @@ public:
fIntrinsicKind = kNotIntrinsic;
}
+ void setNextOverload(const FunctionDeclaration* overload) {
+ SkASSERT(!overload || overload->name() == this->name());
+ fNextOverload = overload;
+ }
+
const std::vector<const Variable*>& parameters() const {
return fParameters;
}
@@ -99,6 +105,10 @@ public:
return this->intrinsicKind() != kNotIntrinsic;
}
+ const FunctionDeclaration* nextOverload() const {
+ return fNextOverload;
+ }
+
std::string mangledName() const;
std::string description() const override;
@@ -127,6 +137,7 @@ public:
private:
mutable const FunctionDefinition* fDefinition;
+ const FunctionDeclaration* fNextOverload = nullptr;
const Modifiers* fModifiers;
std::vector<const Variable*> fParameters;
const Type* fReturnType;
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLFunctionDefinition.cpp b/chromium/third_party/skia/src/sksl/ir/SkSLFunctionDefinition.cpp
index a508b6db018..52493f29288 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLFunctionDefinition.cpp
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLFunctionDefinition.cpp
@@ -24,9 +24,7 @@
#include "src/sksl/ir/SkSLBlock.h"
#include "src/sksl/ir/SkSLExpression.h"
#include "src/sksl/ir/SkSLFieldAccess.h"
-#include "src/sksl/ir/SkSLFunctionCall.h"
#include "src/sksl/ir/SkSLInterfaceBlock.h"
-#include "src/sksl/ir/SkSLProgram.h"
#include "src/sksl/ir/SkSLReturnStatement.h"
#include "src/sksl/ir/SkSLType.h"
#include "src/sksl/ir/SkSLVarDeclarations.h"
@@ -35,10 +33,8 @@
#include "src/sksl/transform/SkSLProgramWriter.h"
#include <algorithm>
+#include <cstddef>
#include <forward_list>
-#include <string_view>
-#include <unordered_map>
-#include <vector>
namespace SkSL {
@@ -95,69 +91,22 @@ std::unique_ptr<FunctionDefinition> FunctionDefinition::Convert(const Context& c
bool builtin) {
class Finalizer : public ProgramWriter {
public:
- Finalizer(const Context& context, const FunctionDeclaration& function,
- FunctionSet* referencedBuiltinFunctions)
+ Finalizer(const Context& context, const FunctionDeclaration& function)
: fContext(context)
- , fFunction(function)
- , fReferencedBuiltinFunctions(referencedBuiltinFunctions) {}
+ , fFunction(function) {}
~Finalizer() override {
SkASSERT(fBreakableLevel == 0);
SkASSERT(fContinuableLevel == std::forward_list<int>{0});
}
- void copyBuiltinFunctionIfNeeded(const FunctionDeclaration& function) {
- if (const ProgramElement* found =
- fContext.fBuiltins->findAndInclude(function.description())) {
- const FunctionDefinition& original = found->as<FunctionDefinition>();
-
- // Sort the referenced builtin functions into a consistent order; otherwise our
- // output will become non-deterministic.
- std::vector<const FunctionDeclaration*> builtinFunctions(
- original.referencedBuiltinFunctions().begin(),
- original.referencedBuiltinFunctions().end());
- std::sort(builtinFunctions.begin(), builtinFunctions.end(),
- [](const FunctionDeclaration* a, const FunctionDeclaration* b) {
- if (a->isBuiltin() != b->isBuiltin()) {
- return a->isBuiltin() < b->isBuiltin();
- }
- if (a->fPosition != b->fPosition) {
- return a->fPosition < b->fPosition;
- }
- if (a->name() != b->name()) {
- return a->name() < b->name();
- }
- return a->description() < b->description();
- });
- for (const FunctionDeclaration* f : builtinFunctions) {
- this->copyBuiltinFunctionIfNeeded(*f);
- }
-
- ThreadContext::SharedElements().push_back(found);
- }
- }
-
bool functionReturnsValue() const {
return !fFunction.returnType().isVoid();
}
bool visitExpression(Expression& expr) override {
- if (expr.is<FunctionCall>()) {
- const FunctionDeclaration& func = expr.as<FunctionCall>().function();
- if (func.isBuiltin()) {
- if (func.intrinsicKind() == k_dFdy_IntrinsicKind) {
- ThreadContext::Inputs().fUseFlipRTUniform =
- !fContext.fConfig->fSettings.fForceNoRTFlip;
- }
- if (func.definition()) {
- fReferencedBuiltinFunctions->insert(&func);
- }
- if (!fContext.fConfig->fIsBuiltinCode && fContext.fBuiltins) {
- this->copyBuiltinFunctionIfNeeded(func);
- }
- }
- }
- return INHERITED::visitExpression(expr);
+ // We don't need to scan expressions.
+ return false;
}
bool visitStatement(Statement& stmt) override {
@@ -258,8 +207,6 @@ std::unique_ptr<FunctionDefinition> FunctionDefinition::Convert(const Context& c
private:
const Context& fContext;
const FunctionDeclaration& fFunction;
- // which builtin functions have we encountered in this function
- FunctionSet* fReferencedBuiltinFunctions;
// how deeply nested we are in breakable constructs (for, do, switch).
int fBreakableLevel = 0;
// number of slots consumed by all variables declared in the function
@@ -271,21 +218,19 @@ std::unique_ptr<FunctionDefinition> FunctionDefinition::Convert(const Context& c
using INHERITED = ProgramWriter;
};
- FunctionSet referencedBuiltinFunctions;
- Finalizer(context, function, &referencedBuiltinFunctions).visitStatement(*body);
+ Finalizer(context, function).visitStatement(*body);
if (function.isMain() && ProgramConfig::IsVertex(context.fConfig->fKind)) {
append_rtadjust_fixup_to_vertex_main(context, function, body->as<Block>());
}
if (Analysis::CanExitWithoutReturningValue(function, *body)) {
context.fErrors->error(body->fPosition, "function '" + std::string(function.name()) +
- "' can exit without returning a value");
+ "' can exit without returning a value");
}
SkASSERTF(!function.isIntrinsic(), "Intrinsic %s should not have a definition",
- std::string(function.name()).c_str());
- return std::make_unique<FunctionDefinition>(pos, &function, builtin, std::move(body),
- std::move(referencedBuiltinFunctions));
+ std::string(function.name()).c_str());
+ return std::make_unique<FunctionDefinition>(pos, &function, builtin, std::move(body));
}
} // namespace SkSL
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLFunctionDefinition.h b/chromium/third_party/skia/src/sksl/ir/SkSLFunctionDefinition.h
index c5517ee5ecb..cc2b0772e03 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLFunctionDefinition.h
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLFunctionDefinition.h
@@ -15,7 +15,6 @@
#include <memory>
#include <string>
-#include <unordered_set>
#include <utility>
namespace SkSL {
@@ -29,15 +28,12 @@ class FunctionDefinition final : public ProgramElement {
public:
inline static constexpr Kind kProgramElementKind = Kind::kFunction;
- using FunctionSet = std::unordered_set<const FunctionDeclaration*>;
-
FunctionDefinition(Position pos, const FunctionDeclaration* declaration, bool builtin,
- std::unique_ptr<Statement> body, FunctionSet referencedBuiltinFunctions)
+ std::unique_ptr<Statement> body)
: INHERITED(pos, kProgramElementKind)
, fDeclaration(declaration)
, fBuiltin(builtin)
- , fBody(std::move(body))
- , fReferencedBuiltinFunctions(std::move(referencedBuiltinFunctions)) {}
+ , fBody(std::move(body)) {}
/**
* Coerces `return` statements to the return type of the function, and reports errors in the
@@ -72,14 +68,9 @@ public:
return fBody;
}
- const FunctionSet& referencedBuiltinFunctions() const {
- return fReferencedBuiltinFunctions;
- }
-
std::unique_ptr<ProgramElement> clone() const override {
return std::make_unique<FunctionDefinition>(fPosition, &this->declaration(),
- /*builtin=*/false, this->body()->clone(),
- this->referencedBuiltinFunctions());
+ /*builtin=*/false, this->body()->clone());
}
std::string description() const override {
@@ -90,9 +81,6 @@ private:
const FunctionDeclaration* fDeclaration;
bool fBuiltin;
std::unique_ptr<Statement> fBody;
- // We track the builtin functions we reference so that we can ensure that all of them end up
- // copied into the final output.
- FunctionSet fReferencedBuiltinFunctions;
using INHERITED = ProgramElement;
};
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLFunctionReference.h b/chromium/third_party/skia/src/sksl/ir/SkSLFunctionReference.h
index 7be03e942ee..648dfc8bbbd 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLFunctionReference.h
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLFunctionReference.h
@@ -23,12 +23,12 @@ public:
inline static constexpr Kind kExpressionKind = Kind::kFunctionReference;
FunctionReference(const Context& context, Position pos,
- std::vector<const FunctionDeclaration*> functions)
+ const FunctionDeclaration* overloadChain)
: INHERITED(pos, kExpressionKind, context.fTypes.fInvalid.get())
- , fFunctions(std::move(functions)) {}
+ , fOverloadChain(overloadChain) {}
- const std::vector<const FunctionDeclaration*>& functions() const {
- return fFunctions;
+ const FunctionDeclaration* overloadChain() const {
+ return fOverloadChain;
}
bool hasProperty(Property property) const override {
@@ -36,7 +36,7 @@ public:
}
std::unique_ptr<Expression> clone(Position pos) const override {
- return std::unique_ptr<Expression>(new FunctionReference(pos, this->functions(),
+ return std::unique_ptr<Expression>(new FunctionReference(pos, this->overloadChain(),
&this->type()));
}
@@ -45,12 +45,11 @@ public:
}
private:
- FunctionReference(Position pos, std::vector<const FunctionDeclaration*> functions,
- const Type* type)
- : INHERITED(pos, kExpressionKind, type)
- , fFunctions(std::move(functions)) {}
+ FunctionReference(Position pos, const FunctionDeclaration* overloadChain, const Type* type)
+ : INHERITED(pos, kExpressionKind, type)
+ , fOverloadChain(overloadChain) {}
- std::vector<const FunctionDeclaration*> fFunctions;
+ const FunctionDeclaration* fOverloadChain;
using INHERITED = Expression;
};
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLIndexExpression.cpp b/chromium/third_party/skia/src/sksl/ir/SkSLIndexExpression.cpp
index b1c9834b5cd..632a6e262e4 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLIndexExpression.cpp
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLIndexExpression.cpp
@@ -22,6 +22,7 @@
#include "src/sksl/ir/SkSLType.h"
#include "src/sksl/ir/SkSLTypeReference.h"
+#include <cstdint>
#include <optional>
namespace SkSL {
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLMethodReference.h b/chromium/third_party/skia/src/sksl/ir/SkSLMethodReference.h
index 084eaa33a97..6458458b47f 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLMethodReference.h
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLMethodReference.h
@@ -34,21 +34,21 @@ public:
MethodReference(const Context& context,
Position pos,
std::unique_ptr<Expression> self,
- std::vector<const FunctionDeclaration*> functions)
+ const FunctionDeclaration* overloadChain)
: INHERITED(pos, kExpressionKind, context.fTypes.fInvalid.get())
, fSelf(std::move(self))
- , fFunctions(std::move(functions)) {}
+ , fOverloadChain(overloadChain) {}
std::unique_ptr<Expression>& self() { return fSelf; }
const std::unique_ptr<Expression>& self() const { return fSelf; }
- const std::vector<const FunctionDeclaration*>& functions() const { return fFunctions; }
+ const FunctionDeclaration* overloadChain() const { return fOverloadChain; }
bool hasProperty(Property property) const override { return false; }
std::unique_ptr<Expression> clone(Position pos) const override {
- return std::unique_ptr<Expression>(new MethodReference(pos, this->self()->clone(),
- this->functions(), &this->type()));
+ return std::unique_ptr<Expression>(new MethodReference(
+ pos, this->self()->clone(), this->overloadChain(), &this->type()));
}
std::string description() const override {
@@ -58,14 +58,14 @@ public:
private:
MethodReference(Position pos,
std::unique_ptr<Expression> self,
- std::vector<const FunctionDeclaration*> functions,
+ const FunctionDeclaration* overloadChain,
const Type* type)
: INHERITED(pos, kExpressionKind, type)
, fSelf(std::move(self))
- , fFunctions(std::move(functions)) {}
+ , fOverloadChain(overloadChain) {}
std::unique_ptr<Expression> fSelf;
- std::vector<const FunctionDeclaration*> fFunctions;
+ const FunctionDeclaration* fOverloadChain;
using INHERITED = Expression;
};
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLModifiers.cpp b/chromium/third_party/skia/src/sksl/ir/SkSLModifiers.cpp
index 85a1ed579f6..6d209c264f7 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLModifiers.cpp
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLModifiers.cpp
@@ -14,8 +14,10 @@
namespace SkSL {
-bool Modifiers::checkPermitted(const Context& context, Position pos, int permittedModifierFlags,
- int permittedLayoutFlags) const {
+bool Modifiers::checkPermitted(const Context& context,
+ Position pos,
+ int permittedModifierFlags,
+ int permittedLayoutFlags) const {
static constexpr struct { Modifiers::Flag flag; const char* name; } kModifierFlags[] = {
{ Modifiers::kConst_Flag, "const" },
{ Modifiers::kIn_Flag, "in" },
@@ -30,6 +32,10 @@ bool Modifiers::checkPermitted(const Context& context, Position pos, int permitt
{ Modifiers::kMediump_Flag, "mediump" },
{ Modifiers::kLowp_Flag, "lowp" },
{ Modifiers::kES3_Flag, "$es3" },
+ { Modifiers::kThreadgroup_Flag, "threadgroup" },
+ { Modifiers::kReadOnly_Flag, "readonly" },
+ { Modifiers::kWriteOnly_Flag, "writeonly" },
+ { Modifiers::kBuffer_Flag, "buffer" },
};
bool success = true;
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLProgram.h b/chromium/third_party/skia/src/sksl/ir/SkSLProgram.h
index 43f1716aeb4..e541337f490 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLProgram.h
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLProgram.h
@@ -17,6 +17,7 @@
#include "include/private/SkTHash.h"
#include "src/sksl/SkSLAnalysis.h"
#include "src/sksl/SkSLProgramSettings.h"
+#include "src/sksl/analysis/SkSLProgramUsage.h"
#include "src/sksl/ir/SkSLExpression.h"
#include "src/sksl/ir/SkSLLiteral.h"
#include "src/sksl/ir/SkSLSymbolTable.h"
@@ -34,37 +35,9 @@ class Context;
class Pool;
/**
- * Side-car class holding mutable information about a Program's IR
- */
-class ProgramUsage {
-public:
- struct VariableCounts {
- int fDeclared = 0;
- int fRead = 0;
- int fWrite = 0;
- };
- VariableCounts get(const Variable&) const;
- bool isDead(const Variable&) const;
-
- int get(const FunctionDeclaration&) const;
-
- void add(const Expression* expr);
- void add(const Statement* stmt);
- void add(const ProgramElement& element);
- void remove(const Expression* expr);
- void remove(const Statement* stmt);
- void remove(const ProgramElement& element);
-
- SkTHashMap<const Variable*, VariableCounts> fVariableCounts;
- SkTHashMap<const FunctionDeclaration*, int> fCallCounts;
-};
-
-/**
* Represents a fully-digested program, ready for code generation.
*/
struct Program {
- using Settings = ProgramSettings;
-
struct Inputs {
bool fUseFlipRTUniform = false;
bool operator==(const Inputs& that) const {
@@ -85,12 +58,12 @@ struct Program {
: fSource(std::move(source))
, fConfig(std::move(config))
, fContext(context)
+ , fModifiers(std::move(modifiers))
, fSymbols(symbols)
, fPool(std::move(pool))
, fOwnedElements(std::move(elements))
, fSharedElements(std::move(sharedElements))
- , fInputs(inputs)
- , fModifiers(std::move(modifiers)) {
+ , fInputs(inputs) {
fUsage = Analysis::GetUsage(*this);
}
@@ -185,6 +158,8 @@ struct Program {
std::unique_ptr<std::string> fSource;
std::unique_ptr<ProgramConfig> fConfig;
std::shared_ptr<Context> fContext;
+ std::unique_ptr<ProgramUsage> fUsage;
+ std::unique_ptr<ModifiersPool> fModifiers;
// it's important to keep fOwnedElements defined after (and thus destroyed before) fSymbols,
// because destroying elements can modify reference counts in symbols
std::shared_ptr<SymbolTable> fSymbols;
@@ -195,14 +170,6 @@ struct Program {
// Use elements() to iterate over the combined set of owned + shared elements.
std::vector<const ProgramElement*> fSharedElements;
Inputs fInputs;
-
-private:
- std::unique_ptr<ModifiersPool> fModifiers;
- std::unique_ptr<ProgramUsage> fUsage;
-
- friend class Compiler;
- friend class Inliner; // fUsage
- friend class SPIRVCodeGenerator; // fModifiers
};
} // namespace SkSL
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLSwizzle.cpp b/chromium/third_party/skia/src/sksl/ir/SkSLSwizzle.cpp
index 6f46a9a1586..6d900723ed1 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLSwizzle.cpp
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLSwizzle.cpp
@@ -20,6 +20,8 @@
#include "src/sksl/ir/SkSLLiteral.h"
#include <algorithm>
+#include <cstddef>
+#include <cstdint>
#include <optional>
namespace SkSL {
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLSymbolTable.cpp b/chromium/third_party/skia/src/sksl/ir/SkSLSymbolTable.cpp
index 4c80618e2cb..0b781e612b6 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLSymbolTable.cpp
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLSymbolTable.cpp
@@ -7,77 +7,36 @@
#include "src/sksl/ir/SkSLSymbolTable.h"
-#include "include/sksl/SkSLErrorReporter.h"
-#include "src/sksl/SkSLContext.h"
+#include "src/sksl/SkSLThreadContext.h"
#include "src/sksl/ir/SkSLFunctionDeclaration.h"
#include "src/sksl/ir/SkSLType.h"
-#include "src/sksl/ir/SkSLUnresolvedFunction.h"
namespace SkSL {
-std::vector<const FunctionDeclaration*> SymbolTable::GetFunctions(const Symbol& s) {
- switch (s.kind()) {
- case Symbol::Kind::kFunctionDeclaration:
- return { &s.as<FunctionDeclaration>() };
- case Symbol::Kind::kUnresolvedFunction:
- return s.as<UnresolvedFunction>().functions();
- default:
- return std::vector<const FunctionDeclaration*>();
- }
+const Symbol* SymbolTable::operator[](std::string_view name) const {
+ return this->lookup(MakeSymbolKey(name));
}
-const Symbol* SymbolTable::operator[](std::string_view name) {
- return this->lookup(fBuiltin ? nullptr : this, MakeSymbolKey(name));
+bool SymbolTable::isType(std::string_view name) const {
+ const Symbol* symbol = (*this)[name];
+ return symbol && symbol->is<Type>();
}
-const Symbol* SymbolTable::lookup(SymbolTable* writableSymbolTable, const SymbolKey& key) {
- // Symbol-table lookup can cause new UnresolvedFunction nodes to be created; however, we don't
- // want these to end up in built-in root symbol tables (where they will outlive the Program
- // associated with those UnresolvedFunction nodes). `writableSymbolTable` tracks the closest
- // symbol table to the root which is not a built-in.
- if (!fBuiltin) {
- writableSymbolTable = this;
+bool SymbolTable::isBuiltinType(std::string_view name) const {
+ if (!this->isBuiltin()) {
+ return fParent && fParent->isBuiltinType(name);
}
+ return this->isType(name);
+}
+
+const Symbol* SymbolTable::lookup(const SymbolKey& key) const {
const Symbol** symbolPPtr = fSymbols.find(key);
- if (!symbolPPtr) {
- if (fParent) {
- return fParent->lookup(writableSymbolTable, key);
- }
- return nullptr;
+ if (symbolPPtr) {
+ return *symbolPPtr;
}
- const Symbol* symbol = *symbolPPtr;
- if (fParent) {
- auto functions = GetFunctions(*symbol);
- if (functions.size() > 0) {
- bool modified = false;
- const Symbol* previous = fParent->lookup(writableSymbolTable, key);
- if (previous) {
- auto previousFunctions = GetFunctions(*previous);
- for (const FunctionDeclaration* prev : previousFunctions) {
- bool found = false;
- for (const FunctionDeclaration* current : functions) {
- if (current->matches(*prev)) {
- found = true;
- break;
- }
- }
- if (!found) {
- functions.push_back(prev);
- modified = true;
- }
- }
- if (modified) {
- SkASSERT(functions.size() > 1);
- return writableSymbolTable
- ? writableSymbolTable->takeOwnershipOfSymbol(
- std::make_unique<UnresolvedFunction>(functions))
- : nullptr;
- }
- }
- }
- }
- return symbol;
+ // The symbol wasn't found; recurse into the parent symbol table.
+ return fParent ? fParent->lookup(key) : nullptr;
}
const std::string* SymbolTable::takeOwnershipOfString(std::string str) {
@@ -86,44 +45,44 @@ const std::string* SymbolTable::takeOwnershipOfString(std::string str) {
return &fOwnedStrings.front();
}
-void SymbolTable::addWithoutOwnership(const Symbol* symbol) {
- const std::string_view& name = symbol->name();
+void SymbolTable::addWithoutOwnership(Symbol* symbol) {
+ auto key = MakeSymbolKey(symbol->name());
+
+ // If this is a function declaration, we need to keep the overload chain in sync.
+ if (symbol->is<FunctionDeclaration>()) {
+ // If we have a function with the same name...
+ const Symbol* existingSymbol = this->lookup(key);
+ if (existingSymbol && existingSymbol->is<FunctionDeclaration>()) {
+ // ... add the existing function as the next overload in the chain.
+ const FunctionDeclaration* existingDecl = &existingSymbol->as<FunctionDeclaration>();
+ symbol->as<FunctionDeclaration>().setNextOverload(existingDecl);
+ fSymbols[key] = symbol;
+ return;
+ }
+ }
+
+ return this->addWithoutOwnership(symbol, key);
+}
+
+void SymbolTable::addWithoutOwnership(const Symbol* symbol, const SymbolKey& key) {
+ const Symbol*& refInSymbolTable = fSymbols[key];
- const Symbol*& refInSymbolTable = fSymbols[MakeSymbolKey(name)];
if (refInSymbolTable == nullptr) {
refInSymbolTable = symbol;
return;
}
- if (!symbol->is<FunctionDeclaration>()) {
- fContext.fErrors->error(symbol->fPosition, "symbol '" + std::string(name) +
- "' was already defined");
- return;
- }
-
- std::vector<const FunctionDeclaration*> functions;
- if (refInSymbolTable->is<FunctionDeclaration>()) {
- functions = {&refInSymbolTable->as<FunctionDeclaration>(),
- &symbol->as<FunctionDeclaration>()};
-
- refInSymbolTable = this->takeOwnershipOfSymbol(
- std::make_unique<UnresolvedFunction>(std::move(functions)));
- } else if (refInSymbolTable->is<UnresolvedFunction>()) {
- functions = refInSymbolTable->as<UnresolvedFunction>().functions();
- functions.push_back(&symbol->as<FunctionDeclaration>());
-
- refInSymbolTable = this->takeOwnershipOfSymbol(
- std::make_unique<UnresolvedFunction>(std::move(functions)));
- }
+ ThreadContext::ReportError("symbol '" + std::string(symbol->name()) + "' was already defined",
+ symbol->fPosition);
}
const Type* SymbolTable::addArrayDimension(const Type* type, int arraySize) {
if (arraySize == 0) {
return type;
}
- // If this is a builtin type, we add it to the topmost non-builtin symbol table to enable
- // additional reuse of the array-type.
- if (type->isInBuiltinTypes() && fParent && !fParent->fBuiltin) {
+ // If this is a builtin type, we add it as high as possible in the symbol table tree (at the
+ // module boundary), to enable additional reuse of the array-type.
+ if (type->isInBuiltinTypes() && fParent && !fAtModuleBoundary) {
return fParent->addArrayDimension(type, arraySize);
}
// Reuse an existing array type with this name if one already exists in our symbol table.
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLSymbolTable.h b/chromium/third_party/skia/src/sksl/ir/SkSLSymbolTable.h
index e16b2f203e3..0352f8e81d7 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLSymbolTable.h
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLSymbolTable.h
@@ -13,6 +13,8 @@
#include "include/private/SkSLSymbol.h"
#include "include/private/SkTHash.h"
+#include <cstddef>
+#include <cstdint>
#include <forward_list>
#include <memory>
#include <string>
@@ -23,24 +25,19 @@
namespace SkSL {
-class Context;
-class FunctionDeclaration;
class Type;
/**
- * Maps identifiers to symbols. Functions, in particular, are mapped to either FunctionDeclaration
- * or UnresolvedFunction depending on whether they are overloaded or not.
+ * Maps identifiers to symbols.
*/
class SymbolTable {
public:
- SymbolTable(const Context& context, bool builtin)
- : fBuiltin(builtin)
- , fContext(context) {}
+ SymbolTable(bool builtin)
+ : fBuiltin(builtin) {}
SymbolTable(std::shared_ptr<SymbolTable> parent, bool builtin)
- : fParent(parent)
- , fBuiltin(builtin)
- , fContext(parent->fContext) {}
+ : fParent(parent)
+ , fBuiltin(builtin) {}
/** Replaces the passed-in SymbolTable with a newly-created child symbol table. */
static void Push(std::shared_ptr<SymbolTable>* table) {
@@ -74,25 +71,50 @@ public:
}
/**
- * Looks up the requested symbol and returns it. If a function has overloads, an
- * UnresolvedFunction symbol (pointing to all of the candidates) will be added to the symbol
- * table and returned.
+ * Looks up the requested symbol and returns it.
*/
- const Symbol* operator[](std::string_view name);
+ const Symbol* operator[](std::string_view name) const;
- void addWithoutOwnership(const Symbol* symbol);
+ /**
+ * Returns true if the name refers to a type (user or built-in) in the current symbol table.
+ */
+ bool isType(std::string_view name) const;
+
+ /**
+ * Returns true if the name refers to a builtin type.
+ */
+ bool isBuiltinType(std::string_view name) const;
+
+ /**
+ * Adds a symbol to this symbol table, without conferring ownership. The caller is responsible
+ * for keeping the Symbol alive throughout the lifetime of the program/module.
+ */
+ void addWithoutOwnership(Symbol* symbol);
+
+ void addWithoutOwnership(const Symbol* symbol) {
+ // If the symbol is a FunctionDeclaration, we need to use the non-const
+ // `addWithoutOwnership` call to ensure that overload chains are kept up-to-date.
+ SkASSERT(symbol->kind() != Symbol::Kind::kFunctionDeclaration);
+ return this->addWithoutOwnership(symbol, MakeSymbolKey(symbol->name()));
+ }
+ /**
+ * Adds a symbol to this symbol table, conferring ownership.
+ */
template <typename T>
const T* add(std::unique_ptr<T> symbol) {
- const T* ptr = symbol.get();
+ T* ptr = symbol.get();
this->addWithoutOwnership(ptr);
this->takeOwnershipOfSymbol(std::move(symbol));
return ptr;
}
+ /**
+ * Confers ownership of a symbol without adding its name to the lookup table.
+ */
template <typename T>
- const T* takeOwnershipOfSymbol(std::unique_ptr<T> symbol) {
- const T* ptr = symbol.get();
+ T* takeOwnershipOfSymbol(std::unique_ptr<T> symbol) {
+ T* ptr = symbol.get();
fOwnedSymbols.push_back(std::move(symbol));
return ptr;
}
@@ -120,16 +142,15 @@ public:
return fBuiltin;
}
+ const std::string* takeOwnershipOfString(std::string n);
+
/**
- * Returns the built-in symbol table that this SymbolTable rests upon.
- * If this symbol table is already a built-in, it will be returned as-is.
+ * Indicates that this symbol table's parent is in a different module than this one.
*/
- SkSL::SymbolTable* builtinParent() {
- return this->isBuiltin() ? this : fParent->builtinParent();
+ void markModuleBoundary() {
+ fAtModuleBoundary = true;
}
- const std::string* takeOwnershipOfString(std::string n);
-
std::shared_ptr<SymbolTable> fParent;
std::vector<std::unique_ptr<const Symbol>> fOwnedSymbols;
@@ -150,14 +171,14 @@ private:
return SymbolKey{name, SkOpts::hash_fn(name.data(), name.size(), 0)};
}
- const Symbol* lookup(SymbolTable* writableSymbolTable, const SymbolKey& key);
+ const Symbol* lookup(const SymbolKey& key) const;
- static std::vector<const FunctionDeclaration*> GetFunctions(const Symbol& s);
+ void addWithoutOwnership(const Symbol* symbol, const SymbolKey& key);
bool fBuiltin = false;
+ bool fAtModuleBoundary = false;
std::forward_list<std::string> fOwnedStrings;
SkTHashMap<SymbolKey, const Symbol*, SymbolKey::Hash> fSymbols;
- const Context& fContext;
friend class Dehydrator;
};
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLType.cpp b/chromium/third_party/skia/src/sksl/ir/SkSLType.cpp
index 2622f856e36..31b6f41a875 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLType.cpp
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLType.cpp
@@ -19,7 +19,6 @@
#include "src/sksl/ir/SkSLConstructorCompoundCast.h"
#include "src/sksl/ir/SkSLConstructorScalarCast.h"
#include "src/sksl/ir/SkSLExpression.h"
-#include "src/sksl/ir/SkSLProgram.h"
#include "src/sksl/ir/SkSLSymbolTable.h"
#include <algorithm>
@@ -106,6 +105,10 @@ public:
return fTargetType.isArray();
}
+ bool isUnsizedArray() const override {
+ return fTargetType.isUnsizedArray();
+ }
+
bool isStruct() const override {
return fTargetType.isStruct();
}
@@ -141,6 +144,10 @@ public:
return true;
}
+ bool isUnsizedArray() const override {
+ return fCount == kUnsizedArray;
+ }
+
const Type& componentType() const override {
return fComponentType;
}
@@ -873,7 +880,7 @@ std::unique_ptr<Expression> Type::coerceExpression(std::unique_ptr<Expression> e
}
const Position pos = expr->fPosition;
- const Program::Settings& settings = context.fConfig->fSettings;
+ const ProgramSettings& settings = context.fConfig->fSettings;
if (!expr->coercionCost(*this).isPossible(settings.fAllowNarrowingConversions)) {
context.fErrors->error(pos, "expected '" + this->displayName() + "', but found '" +
expr->type().displayName() + "'");
@@ -960,18 +967,17 @@ bool Type::checkForOutOfRangeLiteral(const Context& context, const Expression& e
bool Type::checkForOutOfRangeLiteral(const Context& context, double value, Position pos) const {
SkASSERT(this->isScalar());
- if (this->isInteger()) {
- if (value < this->minimumValue() || value > this->maximumValue()) {
- // We found a value that can't fit in the type. Flag it as an error.
- context.fErrors->error(
- pos,
- SkSL::String::printf("integer is out of range for type '%s': %.0f",
- this->displayName().c_str(),
- std::floor(value)));
- return true;
- }
+ if (!this->isInteger()) {
+ return false;
}
- return false;
+ if (value >= this->minimumValue() && value <= this->maximumValue()) {
+ return false;
+ }
+ // We found a value that can't fit in our integral type. Flag it as an error.
+ context.fErrors->error(pos, SkSL::String::printf("integer is out of range for type '%s': %.0f",
+ this->displayName().c_str(),
+ std::floor(value)));
+ return true;
}
bool Type::checkIfUsableInArray(const Context& context, Position arrayPos) const {
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLType.h b/chromium/third_party/skia/src/sksl/ir/SkSLType.h
index 1f05cfdf06f..2f1bf282e1c 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLType.h
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLType.h
@@ -15,6 +15,8 @@
#include "include/sksl/SkSLPosition.h"
#include "src/sksl/spirv.h"
+#include <cstddef>
+#include <cstdint>
#include <memory>
#include <string>
#include <string_view>
@@ -51,6 +53,11 @@ struct CoercionCost {
std::tie(rhs.fImpossible, rhs.fNarrowingCost, rhs.fNormalCost);
}
+ bool operator<=(CoercionCost rhs) const {
+ return std::tie( fImpossible, fNarrowingCost, fNormalCost) <=
+ std::tie(rhs.fImpossible, rhs.fNarrowingCost, rhs.fNormalCost);
+ }
+
int fNormalCost;
int fNarrowingCost;
bool fImpossible;
@@ -434,6 +441,10 @@ public:
return fTypeKind == TypeKind::kVoid;
}
+ bool isGeneric() const {
+ return fTypeKind == TypeKind::kGeneric;
+ }
+
virtual bool isScalar() const {
return false;
}
@@ -458,6 +469,10 @@ public:
return false;
}
+ virtual bool isUnsizedArray() const {
+ return false;
+ }
+
virtual bool isStruct() const {
return false;
}
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLUnresolvedFunction.h b/chromium/third_party/skia/src/sksl/ir/SkSLUnresolvedFunction.h
deleted file mode 100644
index 9374f4fbd90..00000000000
--- a/chromium/third_party/skia/src/sksl/ir/SkSLUnresolvedFunction.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SKSL_UNRESOLVEDFUNCTION
-#define SKSL_UNRESOLVEDFUNCTION
-
-#include "src/sksl/ir/SkSLFunctionDeclaration.h"
-
-namespace SkSL {
-
-/**
- * A symbol representing multiple functions with the same name.
- */
-class UnresolvedFunction final : public Symbol {
-public:
- inline static constexpr Kind kSymbolKind = Kind::kUnresolvedFunction;
-
- UnresolvedFunction(std::vector<const FunctionDeclaration*> funcs)
- : INHERITED(Position(), kSymbolKind, funcs[0]->name())
- , fFunctions(std::move(funcs)) {
-#ifdef SK_DEBUG
- SkASSERT(!this->functions().empty());
- for (auto func : this->functions()) {
- SkASSERT(func->name() == name());
- }
-#endif
- }
-
- const std::vector<const FunctionDeclaration*>& functions() const {
- return fFunctions;
- }
-
- std::string description() const override {
- return std::string(this->name());
- }
-
-private:
- std::vector<const FunctionDeclaration*> fFunctions;
-
- using INHERITED = Symbol;
-};
-
-} // namespace SkSL
-
-#endif
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLVarDeclarations.cpp b/chromium/third_party/skia/src/sksl/ir/SkSLVarDeclarations.cpp
index 8cc1b997f72..3a296e6f6ae 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLVarDeclarations.cpp
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLVarDeclarations.cpp
@@ -43,9 +43,20 @@ static bool check_valid_uniform_type(Position pos,
{
bool error = false;
if (ProgramConfig::IsRuntimeEffect(context.fConfig->fKind)) {
- if (t->isEffectChild() ||
- ((t->isScalar() || t->isVector()) && ct.isSigned() && ct.bitWidth() == 32) ||
- ((t->isScalar() || t->isVector() || t->isMatrix()) && ct.isFloat())) {
+ // `shader`, `blender`, `colorFilter`
+ if (t->isEffectChild()) {
+ return true;
+ }
+
+ // `int`, `int2`, `int3`, `int4`
+ if (ct.isSigned() && ct.bitWidth() == 32 && (t->isScalar() || t->isVector())) {
+ return true;
+ }
+
+ // `float`, `float2`, `float3`, `float4`, `float2x2`, `float3x3`, `float4x4`
+ // `half`, `half2`, `half3`, `half4`, `half2x2`, `half3x3`, `half4x4`
+ if (ct.isFloat() &&
+ (t->isScalar() || t->isVector() || (t->isMatrix() && t->rows() == t->columns()))) {
return true;
}
@@ -127,8 +138,12 @@ void VarDeclaration::ErrorCheck(const Context& context,
Position pos,
Position modifiersPosition,
const Modifiers& modifiers,
- const Type* baseType,
+ const Type* type,
Variable::Storage storage) {
+ const Type* baseType = type;
+ if (baseType->isArray()) {
+ baseType = &baseType->componentType();
+ }
SkASSERT(!baseType->isArray());
if (baseType->matches(*context.fTypes.fInvalid)) {
@@ -150,14 +165,27 @@ void VarDeclaration::ErrorCheck(const Context& context,
if ((modifiers.fFlags & Modifiers::kIn_Flag) && (modifiers.fFlags & Modifiers::kUniform_Flag)) {
context.fErrors->error(pos, "'in uniform' variables not permitted");
}
+ if ((modifiers.fFlags & Modifiers::kReadOnly_Flag) &&
+ (modifiers.fFlags & Modifiers::kWriteOnly_Flag)) {
+ context.fErrors->error(pos, "'readonly writeonly' variables not permitted");
+ }
+ if ((modifiers.fFlags & Modifiers::kUniform_Flag) &&
+ (modifiers.fFlags & Modifiers::kBuffer_Flag)) {
+ context.fErrors->error(pos, "'uniform buffer' variables not permitted");
+ }
+ if (ProgramConfig::IsCompute(context.fConfig->fKind) &&
+ (modifiers.fFlags & (Modifiers::kIn_Flag | Modifiers::kOut_Flag)) &&
+ type->isArray() && !type->isUnsizedArray()) {
+ // TODO(skia:13471): remove this restriction
+ context.fErrors->error(pos, "compute shader in / out arrays must be unsized");
+ }
+ if ((modifiers.fFlags & Modifiers::kThreadgroup_Flag) &&
+ (modifiers.fFlags & (Modifiers::kIn_Flag | Modifiers::kOut_Flag))) {
+ context.fErrors->error(pos, "in / out variables may not be declared threadgroup");
+ }
if ((modifiers.fFlags & Modifiers::kUniform_Flag)) {
check_valid_uniform_type(pos, baseType, context);
}
- if (ProgramConfig::IsRuntimeEffect(context.fConfig->fKind)) {
- if (modifiers.fFlags & Modifiers::kIn_Flag) {
- context.fErrors->error(pos, "'in' variables not permitted in runtime effects");
- }
- }
if (baseType->isEffectChild() && !(modifiers.fFlags & Modifiers::kUniform_Flag)) {
context.fErrors->error(pos,
"variables of type '" + baseType->displayName() + "' must be uniform");
@@ -187,9 +215,38 @@ void VarDeclaration::ErrorCheck(const Context& context,
int permitted = Modifiers::kConst_Flag | Modifiers::kHighp_Flag | Modifiers::kMediump_Flag |
Modifiers::kLowp_Flag;
if (storage == Variable::Storage::kGlobal) {
- permitted |= Modifiers::kIn_Flag | Modifiers::kOut_Flag | Modifiers::kUniform_Flag |
- Modifiers::kFlat_Flag | Modifiers::kNoPerspective_Flag;
+ if (!ProgramConfig::IsCompute(context.fConfig->fKind)) {
+ permitted |= Modifiers::kUniform_Flag;
+ }
+ if (baseType->isInterfaceBlock()) {
+ permitted |= Modifiers::kBuffer_Flag;
+ }
+ // No other modifiers are allowed in runtime effects
+ if (!ProgramConfig::IsRuntimeEffect(context.fConfig->fKind)) {
+ if (baseType->typeKind() == Type::TypeKind::kTexture) {
+ // Only texture types allow `readonly` and `writeonly`.
+ permitted |= Modifiers::kReadOnly_Flag | Modifiers::kWriteOnly_Flag;
+ }
+ if (!baseType->isOpaque()) {
+ // Only non-opaque types allow `in` and `out`.
+ permitted |= Modifiers::kIn_Flag | Modifiers::kOut_Flag;
+ }
+ if (ProgramConfig::IsCompute(context.fConfig->fKind)) {
+ // Only compute shaders allow `threadgroup`.
+ if (!baseType->isOpaque()) {
+ permitted |= Modifiers::kThreadgroup_Flag;
+ }
+ } else {
+ // Only vertex/fragment shaders allow `flat` and `noperspective`.
+ permitted |= Modifiers::kFlat_Flag | Modifiers::kNoPerspective_Flag;
+ }
+ }
}
+ // This modifier isn't actually allowed on variables, at all. However, it's restricted to only
+ // appear in module code by the parser. We "allow" it here, to avoid double-reporting errors.
+ // This means that module code could put it on a variable (to no effect). We'll live with that.
+ permitted |= Modifiers::kHasSideEffects_Flag;
+
// TODO(skbug.com/11301): Migrate above checks into building a mask of permitted layout flags
int permittedLayoutFlags = ~0;
@@ -205,16 +262,16 @@ void VarDeclaration::ErrorCheck(const Context& context,
permittedLayoutFlags &= ~Layout::kBinding_Flag;
permittedLayoutFlags &= ~Layout::kSet_Flag;
}
+ if (ProgramConfig::IsRuntimeEffect(context.fConfig->fKind)) {
+ // Disallow all layout flags except 'color' in runtime effects
+ permittedLayoutFlags &= Layout::kColor_Flag;
+ }
modifiers.checkPermitted(context, modifiersPosition, permitted, permittedLayoutFlags);
}
bool VarDeclaration::ErrorCheckAndCoerce(const Context& context, const Variable& var,
std::unique_ptr<Expression>& value) {
- const Type* baseType = &var.type();
- if (baseType->isArray()) {
- baseType = &baseType->componentType();
- }
- ErrorCheck(context, var.fPosition, var.modifiersPosition(), var.modifiers(), baseType,
+ ErrorCheck(context, var.fPosition, var.modifiersPosition(), var.modifiers(), &var.type(),
var.storage());
if (value) {
if (var.type().isOpaque()) {
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLVarDeclarations.h b/chromium/third_party/skia/src/sksl/ir/SkSLVarDeclarations.h
index 98c58d451be..10ee0df810b 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLVarDeclarations.h
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLVarDeclarations.h
@@ -58,7 +58,7 @@ public:
// errors if needed. This method is implicitly called during Convert(), but is also explicitly
// called while processing interface block fields.
static void ErrorCheck(const Context& context, Position pos, Position modifiersPosition,
- const Modifiers& modifiers, const Type* baseType, Variable::Storage storage);
+ const Modifiers& modifiers, const Type* type, Variable::Storage storage);
// Does proper error checking and type coercion; reports errors via ErrorReporter.
static std::unique_ptr<Statement> Convert(const Context& context, std::unique_ptr<Variable> var,
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLVariable.cpp b/chromium/third_party/skia/src/sksl/ir/SkSLVariable.cpp
index 23946670861..b8871e61e4c 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLVariable.cpp
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLVariable.cpp
@@ -36,6 +36,18 @@ const Expression* Variable::initialValue() const {
return fDeclaration ? fDeclaration->value().get() : nullptr;
}
+std::string Variable::mangledName() const {
+ // Only private variables need to use name mangling.
+ std::string_view name = this->name();
+ if (!skstd::starts_with(name, '$')) {
+ return std::string(name);
+ }
+
+ // The $ prefix will fail to compile in GLSL, so replace it with `sk_Priv`.
+ name.remove_prefix(1);
+ return "sk_Priv" + std::string(name);
+}
+
std::unique_ptr<Variable> Variable::Convert(const Context& context, Position pos,
Position modifiersPos, const Modifiers& modifiers, const Type* baseType, Position namePos,
std::string_view name, bool isArray, std::unique_ptr<Expression> arraySize,
@@ -49,8 +61,29 @@ std::unique_ptr<Variable> Variable::Convert(const Context& context, Position pos
if (!context.fConfig->fIsBuiltinCode && skstd::starts_with(name, '$')) {
context.fErrors->error(namePos, "name '" + std::string(name) + "' is reserved");
}
- if (baseType->isArray() && baseType->columns() == Type::kUnsizedArray) {
- context.fErrors->error(pos, "unsized arrays are not permitted here");
+ if (baseType->isUnsizedArray()) {
+ if (!ProgramConfig::IsCompute(ThreadContext::Context().fConfig->fKind)) {
+ context.fErrors->error(pos, "unsized arrays are not permitted here");
+ } else if (storage != Variable::Storage::kGlobal) {
+ context.fErrors->error(pos, "unsized arrays must be global");
+ } else if (!(modifiers.fFlags & (Modifiers::kIn_Flag | Modifiers::kOut_Flag))) {
+ context.fErrors->error(pos, "unsized arrays must be declared 'in' and/or 'out'");
+ }
+ }
+ if (ProgramConfig::IsCompute(ThreadContext::Context().fConfig->fKind) &&
+ modifiers.fLayout.fBuiltin == -1) {
+ if (storage == Variable::Storage::kGlobal &&
+ (modifiers.fFlags & (Modifiers::kIn_Flag | Modifiers::kOut_Flag))) {
+ if (baseType->typeKind() != Type::TypeKind::kTexture && !baseType->isArray() &&
+ !isArray) {
+ context.fErrors->error(pos, "unsupported compute shader in / out type");
+ }
+ if (baseType->typeKind() != Type::TypeKind::kTexture &&
+ (modifiers.fLayout.fBinding == -1 || modifiers.fLayout.fSet == -1)) {
+ context.fErrors->error(pos,
+ "compute shader in / out variables must have a layout binding and set");
+ }
+ }
}
return Make(context, pos, modifiersPos, modifiers, baseType, name, isArray,
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLVariable.h b/chromium/third_party/skia/src/sksl/ir/SkSLVariable.h
index fe3a8997725..2d0f3d5984b 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLVariable.h
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLVariable.h
@@ -15,6 +15,7 @@
#include "include/sksl/SkSLPosition.h"
#include "src/sksl/ir/SkSLType.h"
+#include <cstdint>
#include <memory>
#include <string>
#include <string_view>
@@ -35,7 +36,8 @@ enum class VariableStorage : int8_t {
kGlobal,
kInterfaceBlock,
kLocal,
- kParameter
+ kParameter,
+ kEliminated
};
/**
@@ -100,7 +102,7 @@ public:
}
Storage storage() const {
- return (Storage) fStorage;
+ return fStorage;
}
const Expression* initialValue() const;
@@ -121,6 +123,15 @@ public:
std::string(this->name());
}
+ std::string mangledName() const;
+
+ void markEliminated() {
+ // We mark eliminated variables by changing their storage type.
+ // We can drop eliminated variables during dehydration to save a little space.
+ SkASSERT(!fDeclaration);
+ fStorage = Storage::kEliminated;
+ }
+
private:
VarDeclaration* fDeclaration = nullptr;
// We don't store the position in the Modifiers object itself because they are pooled
diff --git a/chromium/third_party/skia/src/sksl/ir/SkSLVariableReference.h b/chromium/third_party/skia/src/sksl/ir/SkSLVariableReference.h
index 9c5973cec37..afebd8034de 100644
--- a/chromium/third_party/skia/src/sksl/ir/SkSLVariableReference.h
+++ b/chromium/third_party/skia/src/sksl/ir/SkSLVariableReference.h
@@ -12,6 +12,7 @@
#include "include/sksl/SkSLPosition.h"
#include "src/sksl/ir/SkSLExpression.h"
+#include <cstdint>
#include <memory>
#include <string>
diff --git a/chromium/third_party/skia/src/sksl/lex/TransitionTable.cpp b/chromium/third_party/skia/src/sksl/lex/TransitionTable.cpp
index 9e9fb253125..83720fca1c1 100644
--- a/chromium/third_party/skia/src/sksl/lex/TransitionTable.cpp
+++ b/chromium/third_party/skia/src/sksl/lex/TransitionTable.cpp
@@ -57,14 +57,14 @@ static int add_compact_entry(const TransitionSet& transitionSet,
CompactEntry result{};
assert(transitionSet.size() <= result.v.size());
std::copy(transitionSet.begin(), transitionSet.end(), result.v.begin());
- std::sort(result.v.begin(), result.v.end());
+ std::sort(result.v.rbegin(), result.v.rend());
- // Create a mapping from real values to small values. (0 -> 0, v[0] -> 1, v[1] -> 2, v[2] -> 3)
+ // Create a mapping from real values to small values.
std::unordered_map<int, int> translationTable;
for (size_t index = 0; index < result.v.size(); ++index) {
- translationTable[result.v[index]] = 1 + index;
+ translationTable[result.v[index]] = index;
}
- translationTable[0] = 0;
+ translationTable[0] = result.v.size();
// Convert the real values into small values.
for (size_t index = 0; index < data.size(); ++index) {
@@ -142,29 +142,33 @@ void WriteTransitionTable(std::ofstream& out, const DFA& dfa, size_t states) {
}
// Find the largest value for each compact-entry slot.
- int maxValue[kNumValues] = {};
+ int maxValue = 0;
for (const CompactEntry& entry : compactEntries) {
for (int index=0; index < kNumValues; ++index) {
- maxValue[index] = std::max(maxValue[index], entry.v[index]);
+ maxValue = std::max(maxValue, entry.v[index]);
}
}
+ // Figure out how many bits we need to store our max value.
+ int bitsPerValue = std::ceil(std::log2(maxValue));
+ maxValue = (1 << bitsPerValue) - 1;
+
+ // If we exceed 10 bits per value, three values would overflow 32 bits. If this happens, we'll
+ // need to pack our values another way.
+ assert(bitsPerValue <= 10);
+
// Emit all the structs our transition table will use.
out << "using IndexEntry = int16_t;\n"
<< "struct FullEntry {\n"
<< " State data[" << numTransitions << "];\n"
<< "};\n";
- // Emit the compact-entry structure; minimize the number of bits needed per value.
- out << "struct CompactEntry {\n";
- for (int index=0; index < kNumValues; ++index) {
- if (maxValue[index] > 0) {
- out << " State v" << index << " : " << int(std::ceil(std::log2(maxValue[index])))
- << ";\n";
- }
- }
-
- out << " uint8_t data[" << std::ceil(float(numTransitions) / float(kDataPerByte)) << "];\n"
+ // Emit the compact-entry structure. We store all three values in `v`. If kNumBits were to
+ // change, we would need to adjust the packing algorithm.
+ static_assert(kNumBits == 2);
+ out << "struct CompactEntry {\n"
+ << " uint32_t values;\n"
+ << " uint8_t data[" << std::ceil(float(numTransitions) / float(kDataPerByte)) << "];\n"
<< "};\n";
// Emit the full-table data.
@@ -182,12 +186,19 @@ void WriteTransitionTable(std::ofstream& out, const DFA& dfa, size_t states) {
out << "static constexpr CompactEntry kCompact[] = {\n";
for (const CompactEntry& entry : compactEntries) {
out << " {";
- for (int index=0; index < kNumValues; ++index) {
- if (maxValue[index] > 0) {
- out << entry.v[index] << ", ";
- }
+
+ // We pack all three values into `v`. If kNumBits were to change, we would need to adjust
+ // this packing algorithm.
+ static_assert(kNumBits == 2);
+ out << entry.v[0];
+ if (entry.v[1]) {
+ out << " | (" << entry.v[1] << " << " << bitsPerValue << ")";
}
- out << "{";
+ if (entry.v[2]) {
+ out << " | (" << entry.v[2] << " << " << (2 * bitsPerValue) << ")";
+ }
+ out << ", {";
+
unsigned int shiftBits = 0, combinedBits = 0;
for (int index = 0; index < numTransitions; index++) {
combinedBits |= entry.data[index] << shiftBits;
@@ -221,20 +232,10 @@ void WriteTransitionTable(std::ofstream& out, const DFA& dfa, size_t states) {
<< " IndexEntry index = kIndices[state];\n"
<< " if (index < 0) { return kFull[~index].data[transition]; }\n"
<< " const CompactEntry& entry = kCompact[index];\n"
- << " int value = entry.data[transition >> " << std::log2(kDataPerByte) << "];\n"
- << " value >>= " << kNumBits << " * (transition & " << kDataPerByte - 1 << ");\n"
- << " value &= " << kNumValues << ";\n"
- << " State table[] = {0";
-
- for (int index=0; index < kNumValues; ++index) {
- if (maxValue[index] > 0) {
- out << ", entry.v" << index;
- } else {
- out << ", 0";
- }
- }
-
- out << "};\n"
- << " return table[value];\n"
+ << " int v = entry.data[transition >> " << std::log2(kDataPerByte) << "];\n"
+ << " v >>= " << kNumBits << " * (transition & " << kDataPerByte - 1 << ");\n"
+ << " v &= " << kNumValues << ";\n"
+ << " v *= " << bitsPerValue << ";\n"
+ << " return (entry.values >> v) & " << maxValue << ";\n"
<< "}\n";
}
diff --git a/chromium/third_party/skia/src/sksl/lex/sksl.lex b/chromium/third_party/skia/src/sksl/lex/sksl.lex
index 31bfb31a5ae..b766884e4ed 100644
--- a/chromium/third_party/skia/src/sksl/lex/sksl.lex
+++ b/chromium/third_party/skia/src/sksl/lex/sksl.lex
@@ -38,13 +38,17 @@ NOPERSPECTIVE = "noperspective"
INLINE = "inline"
NOINLINE = "noinline"
HASSIDEEFFECTS = "sk_has_side_effects"
+READONLY = "readonly"
+WRITEONLY = "writeonly"
+BUFFER = "buffer"
STRUCT = "struct"
LAYOUT = "layout"
HIGHP = "highp"
MEDIUMP = "mediump"
LOWP = "lowp"
ES3 = "$es3"
-RESERVED = attribute|varying|precision|invariant|asm|class|union|enum|typedef|template|this|packed|goto|volatile|public|static|extern|external|interface|long|double|fixed|unsigned|superp|input|output|hvec[234]|dvec[234]|fvec[234]|sampler[12]DShadow|sampler3DRect|sampler2DRectShadow|samplerCube|sizeof|cast|namespace|using|gl_[0-9a-zA-Z_]*
+THREADGROUP = "threadgroup"
+RESERVED = attribute|varying|precision|invariant|asm|class|union|enum|typedef|template|this|packed|goto|volatile|public|static|extern|external|interface|long|double|fixed|unsigned|superp|input|output|hvec[234]|dvec[234]|fvec[234]|sampler[13]D|sampler[12]DShadow|sampler3DRect|sampler2DRectShadow|samplerCube|sizeof|cast|namespace|using|gl_[0-9a-zA-Z_]*
IDENTIFIER = [a-zA-Z_$][0-9a-zA-Z_]*
DIRECTIVE = #[a-zA-Z_][0-9a-zA-Z_]*
LPAREN = "("
diff --git a/chromium/third_party/skia/src/sksl/sksl_compute.sksl b/chromium/third_party/skia/src/sksl/sksl_compute.sksl
new file mode 100644
index 00000000000..f2e8829cdea
--- /dev/null
+++ b/chromium/third_party/skia/src/sksl/sksl_compute.sksl
@@ -0,0 +1,10 @@
+// defines built-in interfaces supported by SkSL compute shaders
+
+layout(builtin=28) in uint3 sk_ThreadPosition;
+
+sk_has_side_effects half4 read(texture2D t, uint2 pos);
+sk_has_side_effects void write(texture2D t, uint2 pos, half4 color);
+uint width(texture2D t);
+uint height(texture2D t);
+
+sk_has_side_effects void threadgroupBarrier(); \ No newline at end of file
diff --git a/chromium/third_party/skia/src/sksl/sksl_gpu.sksl b/chromium/third_party/skia/src/sksl/sksl_gpu.sksl
index f05c3787a3b..c7ac4a949bc 100644
--- a/chromium/third_party/skia/src/sksl/sksl_gpu.sksl
+++ b/chromium/third_party/skia/src/sksl/sksl_gpu.sksl
@@ -1,224 +1,41 @@
-// defines built-in functions supported by SkSL when running on a GPU
-
-$genType radians($genType degrees);
-$genType degrees($genType radians);
-$genType sin($genType angle);
-$genType cos($genType angle);
-$genType tan($genType angle);
-$genType asin($genType x);
-$genType acos($genType x);
-$genType atan($genType y, $genType x);
-$genType atan($genType y_over_x);
-$genType sinh($genType x);
-$genType cosh($genType x);
-$genType tanh($genType x);
-$genType asinh($genType x);
-$genType acosh($genType x);
-$genType atanh($genType x);
-$genType pow($genType x, $genType y);
-$genType exp($genType x);
-$genType log($genType x);
-$genType exp2($genType x);
-$genType log2($genType x);
-$genType sqrt($genType x);
-$genHType radians($genHType degrees);
-$genHType degrees($genHType radians);
-$genHType sin($genHType angle);
-$genHType cos($genHType angle);
-$genHType tan($genHType angle);
-$genHType asin($genHType x);
-$genHType acos($genHType x);
-$genHType atan($genHType y, $genHType x);
-$genHType atan($genHType y_over_x);
-$genHType sinh($genHType x);
-$genHType cosh($genHType x);
-$genHType tanh($genHType x);
-$genHType asinh($genHType x);
-$genHType acosh($genHType x);
-$genHType atanh($genHType x);
-$genHType pow($genHType x, $genHType y);
-$genHType exp($genHType x);
-$genHType log($genHType x);
-$genHType exp2($genHType x);
-$genHType log2($genHType x);
-$genHType sqrt($genHType x);
-$genType inversesqrt($genType x);
-$genHType inversesqrt($genHType x);
-$genType abs($genType x);
-$genHType abs($genHType x);
-$genIType abs($genIType x);
-$genType sign($genType x);
-$genHType sign($genHType x);
-$genIType sign($genIType x);
-$genType floor($genType x);
-$genHType floor($genHType x);
-$genType trunc($genType x);
-$genHType trunc($genHType x);
-$genType round($genType x);
-$genHType round($genHType x);
-$genType roundEven($genType x);
-$genHType roundEven($genHType x);
-$genType ceil($genType x);
-$genHType ceil($genHType x);
-$genType fract($genType x);
-$genHType fract($genHType x);
-$genType mod($genType x, float y);
-$genType mod($genType x, $genType y);
-$genHType mod($genHType x, half y);
-$genHType mod($genHType x, $genHType y);
-$genType modf($genType x, out $genType i);
-$genHType modf($genHType x, out $genHType i);
-$genType min($genType x, $genType y);
-$genType min($genType x, float y);
-$genHType min($genHType x, $genHType y);
-$genHType min($genHType x, half y);
-$genIType min($genIType x, $genIType y);
-$genIType min($genIType x, int y);
-$genType max($genType x, $genType y);
-$genType max($genType x, float y);
-$genHType max($genHType x, $genHType y);
-$genHType max($genHType x, half y);
-$genIType max($genIType x, $genIType y);
-$genIType max($genIType x, int y);
-$genType clamp($genType x, $genType minVal, $genType maxVal);
-$genType clamp($genType x, float minVal, float maxVal);
-$genHType clamp($genHType x, $genHType minVal, $genHType maxVal);
-$genHType clamp($genHType x, half minVal, half maxVal);
-$genIType clamp($genIType x, $genIType minVal, $genIType maxVal);
-$genIType clamp($genIType x, int minVal, int maxVal);
-$genUType clamp($genUType x, $genUType minVal, $genUType maxVal);
-$genUType clamp($genUType x, uint minVal, uint maxVal);
-$genType saturate($genType x);
-$genHType saturate($genHType x);
-$genType mix($genType x, $genType y, $genType a);
-$genType mix($genType x, $genType y, float a);
-$genHType mix($genHType x, $genHType y, $genHType a);
-$genHType mix($genHType x, $genHType y, half a);
-$genType mix($genType x, $genType y, $genBType a);
-$genHType mix($genHType x, $genHType y, $genBType a);
+// Not exposed in shared module
+
$genIType mix($genIType x, $genIType y, $genBType a);
$genBType mix($genBType x, $genBType y, $genBType a);
-$genType step($genType edge, $genType x);
-$genType step(float edge, $genType x);
-$genHType step($genHType edge, $genHType x);
-$genHType step(half edge, $genHType x);
-$genType smoothstep($genType edge0, $genType edge1, $genType x);
-$genType smoothstep(float edge0, float edge1, $genType x);
-$genHType smoothstep($genHType edge0, $genHType edge1, $genHType x);
-$genHType smoothstep(half edge0, half edge1, $genHType x);
-$genBType isnan($genType x);
-$genBType isinf($genType x);
-$genIType floatBitsToInt($genType value);
-$genUType floatBitsToUint($genType value);
-$genType intBitsToFloat($genIType value);
-$genType uintBitsToFloat($genUType value);
$genType fma($genType a, $genType b, $genType c);
$genHType fma($genHType a, $genHType b, $genHType c);
sk_has_side_effects $genType frexp($genType x, out $genIType exp);
sk_has_side_effects $genHType frexp($genHType x, out $genIType exp);
$genType ldexp($genType x, in $genIType exp);
$genHType ldexp($genHType x, in $genIType exp);
-uint packUnorm2x16(float2 v);
+
uint packSnorm2x16(float2 v);
uint packUnorm4x8(float4 v);
uint packSnorm4x8(float4 v);
-float2 unpackUnorm2x16(uint p);
float2 unpackSnorm2x16(uint p);
float4 unpackUnorm4x8(uint p);
float4 unpackSnorm4x8(uint p);
uint packHalf2x16(float2 v);
float2 unpackHalf2x16(uint v);
-float length($genType x);
-half length($genHType x);
-float distance($genType p0, $genType p1);
-half distance($genHType p0, $genHType p1);
-float dot($genType x, $genType y);
-half dot($genHType x, $genHType y);
-float3 cross(float3 x, float3 y);
-half3 cross(half3 x, half3 y);
-$genType normalize($genType x);
-$genHType normalize($genHType x);
-$genType faceforward($genType N, $genType I, $genType Nref);
-$genHType faceforward($genHType N, $genHType I, $genHType Nref);
-$genType reflect($genType I, $genType N);
-$genHType reflect($genHType I, $genHType N);
-$genType refract($genType I, $genType N, float eta);
-$genHType refract($genHType I, $genHType N, half eta);
-$mat matrixCompMult($mat x, $mat y);
-$hmat matrixCompMult($hmat x, $hmat y);
-$squareMat outerProduct($vec c, $vec r);
-float2x3 outerProduct(float3 c, float2 r);
-float3x2 outerProduct(float2 c, float3 r);
-float2x4 outerProduct(float4 c, float2 r);
-float4x2 outerProduct(float2 c, float4 r);
-float3x4 outerProduct(float4 c, float3 r);
-float4x3 outerProduct(float3 c, float4 r);
-$squareHMat outerProduct($hvec c, $hvec r);
-half2x3 outerProduct(half3 c, half2 r);
-half3x2 outerProduct(half2 c, half3 r);
-half2x4 outerProduct(half4 c, half2 r);
-half4x2 outerProduct(half2 c, half4 r);
-half3x4 outerProduct(half4 c, half3 r);
-half4x3 outerProduct(half3 c, half4 r);
-$squareMat transpose($squareMat m);
-float2x3 transpose(float3x2 m);
-float3x2 transpose(float2x3 m);
-float2x4 transpose(float4x2 m);
-float4x2 transpose(float2x4 m);
-float3x4 transpose(float4x3 m);
-float4x3 transpose(float3x4 m);
-$squareHMat transpose($squareHMat m);
-half2x3 transpose(half3x2 m);
-half3x2 transpose(half2x3 m);
-half2x4 transpose(half4x2 m);
-half4x2 transpose(half2x4 m);
-half3x4 transpose(half4x3 m);
-half4x3 transpose(half3x4 m);
-float determinant($squareMat m);
-half determinant($squareHMat m);
-$squareMat inverse($squareMat m);
-$squareHMat inverse($squareHMat m);
-$bvec lessThan($vec x, $vec y);
-$bvec lessThan($hvec x, $hvec y);
-$bvec lessThan($ivec x, $ivec y);
+
$bvec lessThan($svec x, $svec y);
$bvec lessThan($usvec x, $usvec y);
$bvec lessThan($uvec x, $uvec y);
-$bvec lessThanEqual($vec x, $vec y);
-$bvec lessThanEqual($hvec x, $hvec y);
-$bvec lessThanEqual($ivec x, $ivec y);
$bvec lessThanEqual($uvec x, $uvec y);
$bvec lessThanEqual($svec x, $svec y);
$bvec lessThanEqual($usvec x, $usvec y);
-$bvec greaterThan($vec x, $vec y);
-$bvec greaterThan($hvec x, $hvec y);
-$bvec greaterThan($ivec x, $ivec y);
$bvec greaterThan($uvec x, $uvec y);
$bvec greaterThan($svec x, $svec y);
$bvec greaterThan($usvec x, $usvec y);
-$bvec greaterThanEqual($vec x, $vec y);
-$bvec greaterThanEqual($hvec x, $hvec y);
-$bvec greaterThanEqual($ivec x, $ivec y);
$bvec greaterThanEqual($uvec x, $uvec y);
$bvec greaterThanEqual($svec x, $svec y);
$bvec greaterThanEqual($usvec x, $usvec y);
-$bvec equal($vec x, $vec y);
-$bvec equal($hvec x, $hvec y);
-$bvec equal($ivec x, $ivec y);
$bvec equal($uvec x, $uvec y);
$bvec equal($svec x, $svec y);
$bvec equal($usvec x, $usvec y);
-$bvec equal($bvec x, $bvec y);
-$bvec notEqual($vec x, $vec y);
-$bvec notEqual($hvec x, $hvec y);
-$bvec notEqual($ivec x, $ivec y);
$bvec notEqual($uvec x, $uvec y);
$bvec notEqual($svec x, $svec y);
$bvec notEqual($usvec x, $usvec y);
-$bvec notEqual($bvec x, $bvec y);
-bool any($bvec x);
-bool all($bvec x);
-$bvec not($bvec x);
$genIType bitCount($genIType value);
$genIType bitCount($genUType value);
@@ -228,12 +45,8 @@ $genIType findMSB($genIType value);
$genIType findMSB($genUType value);
sampler2D makeSampler2D(texture2D texture, sampler s);
-int2 textureSize(sampler2DRect s);
-half4 sample(sampler1D s, float P);
-half4 sample(sampler1D s, float P, float bias);
half4 sample(sampler2D s, float2 P);
-int4 sample(isampler2D s, float2 P);
half4 sample(samplerExternalOES s, float2 P, float bias);
half4 sample(samplerExternalOES s, float2 P);
@@ -245,26 +58,9 @@ half4 sample(sampler2DRect s, float3 P);
half4 subpassLoad(subpassInput subpass);
half4 subpassLoad(subpassInputMS subpass, int sample);
-half4 sample(sampler1D s, float2 P);
-half4 sample(sampler1D s, float2 P, float bias);
half4 sample(sampler2D s, float3 P);
half4 sample(sampler2D s, float3 P, float bias);
-$genType dFdx($genType p);
-$genType dFdy($genType p);
-$genHType dFdx($genHType p);
-$genHType dFdy($genHType p);
-$genType fwidth($genType p);
-$genHType fwidth($genHType p);
-float interpolateAtSample(float interpolant, int sample);
-float2 interpolateAtSample(float2 interpolant, int sample);
-float3 interpolateAtSample(float3 interpolant, int sample);
-float4 interpolateAtSample(float4 interpolant, int sample);
-float interpolateAtOffset(float interpolant, float2 offset);
-float2 interpolateAtOffset(float2 interpolant, float2 offset);
-float3 interpolateAtOffset(float3 interpolant, float2 offset);
-float4 interpolateAtOffset(float4 interpolant, float2 offset);
-
// Definitions of functions implementing all of the SkBlendMode blends.
half4 blend_clear(half4 src, half4 dst) { return half4(0); }
@@ -498,10 +294,6 @@ half4 blend_luminosity(half4 src, half4 dst) {
return blend_hslc(src, dst, half2(1, 0));
}
-// The max() guards against division by zero when the incoming color is transparent black
-half4 unpremul(half4 color) { return half4(color.rgb / max(color.a, 0.0001), color.a); }
-float4 unpremul(float4 color) { return float4(color.rgb / max(color.a, 0.0001), color.a); }
-
float2 proj(float3 p) { return p.xy / p.z; }
// Implement cross() as a determinant to communicate our intent more clearly to the compiler.
diff --git a/chromium/third_party/skia/src/sksl/sksl_graphite_frag.sksl b/chromium/third_party/skia/src/sksl/sksl_graphite_frag.sksl
index 4f544fc662a..d6e8a2465f0 100644
--- a/chromium/third_party/skia/src/sksl/sksl_graphite_frag.sksl
+++ b/chromium/third_party/skia/src/sksl/sksl_graphite_frag.sksl
@@ -4,13 +4,18 @@ half4 sk_error() {
return half4(1.0, 0.0, 1.0, 1.0);
}
+half4 sk_passthrough(half4 color) {
+ return color;
+}
+
half4 sk_solid_shader(float4 colorParam) {
return half4(colorParam);
}
// The localMatrix is passed to the child by the glue code. This snippet just needs to bubble the
-// child's output back up. 'localMatrix' is passed in to be consistent w/ the default glue code.
-half4 sk_local_matrix_shader(float4x4 localMatrix, half4 childResult) {
+// child's output back up. Local coordinates are passed in from the default glue code and can
+// just be ignored here.
+half4 sk_local_matrix_shader(float4, float4x4, half4 childResult) {
return childResult;
}
@@ -36,16 +41,16 @@ float $tile(int tm, float f, float min, float max, float normalizer) {
}
}
-float2 sk_compute_coords(float4x4 dev2Local,
+float2 sk_compute_coords(float4 coords,
+ float4x4 preLocal,
float4 subset,
int tmX,
int tmY,
int imgWidth,
int imgHeight) {
- float4 localCoords = dev2Local * sk_FragCoord;
- float2 coords = float2($tile(tmX, localCoords.x, subset.x, subset.z, float(imgWidth)),
- $tile(tmY, localCoords.y, subset.y, subset.w, float(imgHeight)));
- return coords;
+ float2 pos = (preLocal * coords).xy;
+ return float2($tile(tmX, pos.x, subset.x, subset.z, float(imgWidth)),
+ $tile(tmY, pos.y, subset.y, subset.w, float(imgHeight)));
}
float2 $tile_grad(int tileMode, float2 t) {
@@ -314,122 +319,138 @@ float2 $conical_grad_layout(float2 point0Param,
}
}
-half4 sk_linear_grad_4_shader(float4x4 dev2Local,
+half4 sk_linear_grad_4_shader(float4 coords,
+ float4x4 preLocal,
float4 colorsParam[4],
float offsetsParam[4],
float2 point0Param,
float2 point1Param,
- int tileMode,
- float padding0,
- float padding1,
- float padding2) {
- float2 pos = (dev2Local * sk_FragCoord).xy;
+ int tileMode) {
+ float2 pos = (preLocal * coords).xy;
float2 t = $linear_grad_layout(point0Param, point1Param, pos);
t = $tile_grad(tileMode, t);
return $colorize_grad_4(colorsParam, offsetsParam, t);
}
-half4 sk_linear_grad_8_shader(float4x4 dev2Local,
+half4 sk_linear_grad_8_shader(float4 coords,
+ float4x4 preLocal,
float4 colorsParam[8],
float offsetsParam[8],
float2 point0Param,
float2 point1Param,
- int tileMode,
- float padding0,
- float padding1,
- float padding2) {
- float2 pos = (dev2Local * sk_FragCoord).xy;
+ int tileMode) {
+ float2 pos = (preLocal * coords).xy;
float2 t = $linear_grad_layout(point0Param, point1Param, pos);
t = $tile_grad(tileMode, t);
return $colorize_grad_8(colorsParam, offsetsParam, t);
}
-half4 sk_radial_grad_4_shader(float4x4 dev2Local,
+half4 sk_radial_grad_4_shader(float4 coords,
+ float4x4 preLocal,
float4 colorsParam[4],
float offsetsParam[4],
float2 centerParam,
float radiusParam,
int tileMode) {
- float2 pos = (dev2Local * sk_FragCoord).xy;
+ float2 pos = (preLocal * coords).xy;
float2 t = $radial_grad_layout(centerParam, radiusParam, pos);
t = $tile_grad(tileMode, t);
return $colorize_grad_4(colorsParam, offsetsParam, t);
}
-half4 sk_radial_grad_8_shader(float4x4 dev2Local,
+half4 sk_radial_grad_8_shader(float4 coords,
+ float4x4 preLocal,
float4 colorsParam[8],
float offsetsParam[8],
float2 centerParam,
float radiusParam,
int tileMode) {
- float2 pos = (dev2Local * sk_FragCoord).xy;
+ float2 pos = (preLocal * coords).xy;
float2 t = $radial_grad_layout(centerParam, radiusParam, pos);
t = $tile_grad(tileMode, t);
return $colorize_grad_8(colorsParam, offsetsParam, t);
}
-half4 sk_sweep_grad_4_shader(float4x4 dev2Local,
+half4 sk_sweep_grad_4_shader(float4 coords,
+ float4x4 preLocal,
float4 colorsParam[4],
float offsetsParam[4],
float2 centerParam,
float biasParam,
float scaleParam,
- int tileMode,
- float padding0,
- float padding1,
- float padding2) {
- float2 pos = (dev2Local * sk_FragCoord).xy;
+ int tileMode) {
+ float2 pos = (preLocal * coords).xy;
float2 t = $sweep_grad_layout(centerParam, biasParam, scaleParam, pos);
t = $tile_grad(tileMode, t);
return $colorize_grad_4(colorsParam, offsetsParam, t);
}
-half4 sk_sweep_grad_8_shader(float4x4 dev2Local,
+half4 sk_sweep_grad_8_shader(float4 coords,
+ float4x4 preLocal,
float4 colorsParam[8],
float offsetsParam[8],
float2 centerParam,
float biasParam,
float scaleParam,
- int tileMode,
- float padding0,
- float padding1,
- float padding2) {
- float2 pos = (dev2Local * sk_FragCoord).xy;
+ int tileMode) {
+ float2 pos = (preLocal * coords).xy;
float2 t = $sweep_grad_layout(centerParam, biasParam, scaleParam, pos);
t = $tile_grad(tileMode, t);
return $colorize_grad_8(colorsParam, offsetsParam, t);
}
-half4 sk_conical_grad_4_shader(float4x4 dev2Local,
+half4 sk_conical_grad_4_shader(float4 coords,
+ float4x4 preLocal,
float4 colorsParam[4],
float offsetsParam[4],
float2 point0Param,
float2 point1Param,
float radius0Param,
float radius1Param,
- int tileMode,
- float padding) {
- float2 pos = (dev2Local * sk_FragCoord).xy;
+ int tileMode) {
+ float2 pos = (preLocal * coords).xy;
float2 t = $conical_grad_layout(point0Param, point1Param, radius0Param, radius1Param, pos);
t = $tile_grad(tileMode, t);
return $colorize_grad_4(colorsParam, offsetsParam, t);
}
-half4 sk_conical_grad_8_shader(float4x4 dev2Local,
+half4 sk_conical_grad_8_shader(float4 coords,
+ float4x4 preLocal,
float4 colorsParam[8],
float offsetsParam[8],
float2 point0Param,
float2 point1Param,
float radius0Param,
float radius1Param,
- int tileMode,
- float padding) {
- float2 pos = (dev2Local * sk_FragCoord).xy;
+ int tileMode) {
+ float2 pos = (preLocal * coords).xy;
float2 t = $conical_grad_layout(point0Param, point1Param, radius0Param, radius1Param, pos);
t = $tile_grad(tileMode, t);
return $colorize_grad_8(colorsParam, offsetsParam, t);
}
+half4 sk_matrix_colorfilter(half4 colorIn,
+ float4x4 m,
+ float4 v,
+ int inHSLA) {
+ if (bool(inHSLA)) {
+ colorIn = $rgb_to_hsl(colorIn.rgb, colorIn.a); // includes unpremul
+ } else {
+ colorIn = unpremul(colorIn);
+ }
+
+ half4 colorOut = half4((m * colorIn) + v);
+
+ if (bool(inHSLA)) {
+ colorOut = $hsl_to_rgb(colorOut.rgb, colorOut.a); // includes clamp and premul
+ } else {
+ colorOut = saturate(colorOut);
+ colorOut.rgb *= colorOut.a;
+ }
+
+ return colorOut;
+}
+
half4 sk_blend(int blendMode, half4 src, half4 dst) {
const int kClear = 0;
const int kSrc = 1;
@@ -495,6 +516,16 @@ half4 sk_blend(int blendMode, half4 src, half4 dst) {
}
}
-half4 sk_blend_shader(int blendMode, int pad0, int pad1, int pad2, half4 child0, half4 child1) {
+half4 sk_blend_shader(int blendMode, half4 child0, half4 child1) {
return sk_blend(blendMode, child1, child0);
}
+
+half4 sk_blend_colorfilter(half4 dstColor, int blendMode, float4 srcColor) {
+ return sk_blend(blendMode, half4(srcColor), dstColor);
+}
+
+half4 sk_gaussian_colorfilter(half4 inColor) {
+ half factor = 1 - inColor.a;
+ factor = exp(-factor * factor * 4) - 0.018;
+ return half4(factor);
+}
diff --git a/chromium/third_party/skia/src/sksl/sksl_public.sksl b/chromium/third_party/skia/src/sksl/sksl_public.sksl
index 9e4863d0d93..9225815ecc0 100644
--- a/chromium/third_party/skia/src/sksl/sksl_public.sksl
+++ b/chromium/third_party/skia/src/sksl/sksl_public.sksl
@@ -1,238 +1,4 @@
-// Reduced set of intrinsics that are available to public SkSL (RuntimeEffect and Interpreter)
-
-// See "The OpenGL ES Shading Language, Section 8"
-
-// 8.1 : Angle and Trigonometry Functions
-$genType radians($genType degrees);
-$genHType radians($genHType degrees);
-$genType degrees($genType radians);
-$genHType degrees($genHType radians);
-
-$genType sin($genType angle);
-$genHType sin($genHType angle);
-$genType cos($genType angle);
-$genHType cos($genHType angle);
-$genType tan($genType angle);
-$genHType tan($genHType angle);
-
-$genType asin($genType x);
-$genHType asin($genHType x);
-$genType acos($genType x);
-$genHType acos($genHType x);
-$genType atan($genType y, $genType x);
-$genHType atan($genHType y, $genHType x);
-$genType atan($genType y_over_x);
-$genHType atan($genHType y_over_x);
-
-// 8.1 : Angle and Trigonometry Functions (GLSL ES 3.0)
-$es3 $genType sinh($genType x);
-$es3 $genHType sinh($genHType x);
-$es3 $genType cosh($genType x);
-$es3 $genHType cosh($genHType x);
-$es3 $genType tanh($genType x);
-$es3 $genHType tanh($genHType x);
-$es3 $genType asinh($genType x);
-$es3 $genHType asinh($genHType x);
-$es3 $genType acosh($genType x);
-$es3 $genHType acosh($genHType x);
-$es3 $genType atanh($genType x);
-$es3 $genHType atanh($genHType x);
-
-// 8.2 : Exponential Functions
-$genType pow($genType x, $genType y);
-$genHType pow($genHType x, $genHType y);
-$genType exp($genType x);
-$genHType exp($genHType x);
-$genType log($genType x);
-$genHType log($genHType x);
-$genType exp2($genType x);
-$genHType exp2($genHType x);
-$genType log2($genType x);
-$genHType log2($genHType x);
-
-$genType sqrt($genType x);
-$genHType sqrt($genHType x);
-$genType inversesqrt($genType x);
-$genHType inversesqrt($genHType x);
-
-// 8.3 : Common Functions
-$genType abs($genType x);
-$genHType abs($genHType x);
-$genType sign($genType x);
-$genHType sign($genHType x);
-$genType floor($genType x);
-$genHType floor($genHType x);
-$genType ceil($genType x);
-$genHType ceil($genHType x);
-$genType fract($genType x);
-$genHType fract($genHType x);
-$genType mod($genType x, float y);
-$genType mod($genType x, $genType y);
-$genHType mod($genHType x, half y);
-$genHType mod($genHType x, $genHType y);
-
-$genType min($genType x, $genType y);
-$genType min($genType x, float y);
-$genHType min($genHType x, $genHType y);
-$genHType min($genHType x, half y);
-$genType max($genType x, $genType y);
-$genType max($genType x, float y);
-$genHType max($genHType x, $genHType y);
-$genHType max($genHType x, half y);
-$genType clamp($genType x, $genType minVal, $genType maxVal);
-$genType clamp($genType x, float minVal, float maxVal);
-$genHType clamp($genHType x, $genHType minVal, $genHType maxVal);
-$genHType clamp($genHType x, half minVal, half maxVal);
-$genType saturate($genType x); // SkSL extension
-$genHType saturate($genHType x); // SkSL extension
-$genType mix($genType x, $genType y, $genType a);
-$genType mix($genType x, $genType y, float a);
-$genHType mix($genHType x, $genHType y, $genHType a);
-$genHType mix($genHType x, $genHType y, half a);
-$genType step($genType edge, $genType x);
-$genType step(float edge, $genType x);
-$genHType step($genHType edge, $genHType x);
-$genHType step(half edge, $genHType x);
-$genType smoothstep($genType edge0, $genType edge1, $genType x);
-$genType smoothstep(float edge0, float edge1, $genType x);
-$genHType smoothstep($genHType edge0, $genHType edge1, $genHType x);
-$genHType smoothstep(half edge0, half edge1, $genHType x);
-
-// 8.3 : Common Functions (GLSL ES 3.0)
-$es3 $genIType abs($genIType x);
-$es3 $genIType sign($genIType x);
-$es3 $genIType floatBitsToInt ($genType value);
-$es3 $genUType floatBitsToUint($genType value);
-$es3 $genType intBitsToFloat ($genIType value);
-$es3 $genType uintBitsToFloat($genUType value);
-$es3 $genType trunc($genType x);
-$es3 $genHType trunc($genHType x);
-$es3 $genType round($genType x);
-$es3 $genHType round($genHType x);
-$es3 $genType roundEven($genType x);
-$es3 $genHType roundEven($genHType x);
-$es3 $genIType min($genIType x, $genIType y);
-$es3 $genIType min($genIType x, int y);
-$es3 $genIType max($genIType x, $genIType y);
-$es3 $genIType max($genIType x, int y);
-$es3 $genIType clamp($genIType x, $genIType minVal, $genIType maxVal);
-$es3 $genIType clamp($genIType x, int minVal, int maxVal);
-$es3 $genUType clamp($genUType x, $genUType minVal, $genUType maxVal);
-$es3 $genUType clamp($genUType x, uint minVal, uint maxVal);
-$es3 $genType mix($genType x, $genType y, $genBType a);
-$es3 $genHType mix($genHType x, $genHType y, $genBType a);
-
-// 8.3 : Common Functions (GLSL ES 3.0) -- cannot be used in constant-expressions
-$es3 $genBType isnan($genType x);
-$es3 $genBType isnan($genHType x);
-$es3 $genBType isinf($genType x);
-$es3 $genBType isinf($genHType x);
-$es3 $genType modf($genType x, out $genType i);
-$es3 $genHType modf($genHType x, out $genHType i);
-
-// 8.4 : Floating-Point Pack and Unpack Functions (GLSL ES 3.0)
-$es3 uint packUnorm2x16(float2 v);
-$es3 float2 unpackUnorm2x16(uint p);
-
-// 8.5 : Geometric Functions
-float length($genType x);
-half length($genHType x);
-float distance($genType p0, $genType p1);
-half distance($genHType p0, $genHType p1);
-float dot($genType x, $genType y);
-half dot($genHType x, $genHType y);
-float3 cross(float3 x, float3 y);
-half3 cross(half3 x, half3 y);
-$genType normalize($genType x);
-$genHType normalize($genHType x);
-$genType faceforward($genType N, $genType I, $genType Nref);
-$genHType faceforward($genHType N, $genHType I, $genHType Nref);
-$genType reflect($genType I, $genType N);
-$genHType reflect($genHType I, $genHType N);
-$genType refract($genType I, $genType N, float eta);
-$genHType refract($genHType I, $genHType N, half eta);
-
-// 8.6 : Matrix Functions
-$squareMat matrixCompMult($squareMat x, $squareMat y);
-$squareHMat matrixCompMult($squareHMat x, $squareHMat y);
-$es3 $mat matrixCompMult($mat x, $mat y);
-$es3 $hmat matrixCompMult($hmat x, $hmat y);
-
-// 8.6 : Matrix Functions (GLSL 1.4, poly-filled by SkSL as needed)
-$squareMat inverse($squareMat m);
-$squareHMat inverse($squareHMat m);
-
-// 8.6 : Matrix Functions (GLSL ES 3.0)
-$es3 float determinant($squareMat m);
-$es3 half determinant($squareHMat m);
-$es3 $squareMat transpose($squareMat m);
-$es3 $squareHMat transpose($squareHMat m);
-$es3 float2x3 transpose(float3x2 m);
-$es3 half2x3 transpose(half3x2 m);
-$es3 float2x4 transpose(float4x2 m);
-$es3 half2x4 transpose(half4x2 m);
-$es3 float3x2 transpose(float2x3 m);
-$es3 half3x2 transpose(half2x3 m);
-$es3 float3x4 transpose(float4x3 m);
-$es3 half3x4 transpose(half4x3 m);
-$es3 float4x2 transpose(float2x4 m);
-$es3 half4x2 transpose(half2x4 m);
-$es3 float4x3 transpose(float3x4 m);
-$es3 half4x3 transpose(half3x4 m);
-$es3 $squareMat outerProduct($vec c, $vec r);
-$es3 $squareHMat outerProduct($hvec c, $hvec r);
-$es3 float2x3 outerProduct(float3 c, float2 r);
-$es3 half2x3 outerProduct(half3 c, half2 r);
-$es3 float3x2 outerProduct(float2 c, float3 r);
-$es3 half3x2 outerProduct(half2 c, half3 r);
-$es3 float2x4 outerProduct(float4 c, float2 r);
-$es3 half2x4 outerProduct(half4 c, half2 r);
-$es3 float4x2 outerProduct(float2 c, float4 r);
-$es3 half4x2 outerProduct(half2 c, half4 r);
-$es3 float3x4 outerProduct(float4 c, float3 r);
-$es3 half3x4 outerProduct(half4 c, half3 r);
-$es3 float4x3 outerProduct(float3 c, float4 r);
-$es3 half4x3 outerProduct(half3 c, half4 r);
-
-// 8.7 : Vector Relational Functions
-$bvec lessThan($vec x, $vec y);
-$bvec lessThan($hvec x, $hvec y);
-$bvec lessThan($ivec x, $ivec y);
-$bvec lessThanEqual($vec x, $vec y);
-$bvec lessThanEqual($hvec x, $hvec y);
-$bvec lessThanEqual($ivec x, $ivec y);
-$bvec greaterThan($vec x, $vec y);
-$bvec greaterThan($hvec x, $hvec y);
-$bvec greaterThan($ivec x, $ivec y);
-$bvec greaterThanEqual($vec x, $vec y);
-$bvec greaterThanEqual($hvec x, $hvec y);
-$bvec greaterThanEqual($ivec x, $ivec y);
-$bvec equal($vec x, $vec y);
-$bvec equal($hvec x, $hvec y);
-$bvec equal($ivec x, $ivec y);
-$bvec equal($bvec x, $bvec y);
-$bvec notEqual($vec x, $vec y);
-$bvec notEqual($hvec x, $hvec y);
-$bvec notEqual($ivec x, $ivec y);
-$bvec notEqual($bvec x, $bvec y);
-
-bool any($bvec x);
-bool all($bvec x);
-$bvec not($bvec x);
-
-// 8.9 : Fragment Processing Functions (GLSL ES 3.0)
-$es3 $genType dFdx($genType p);
-$es3 $genType dFdy($genType p);
-$es3 $genHType dFdx($genHType p);
-$es3 $genHType dFdy($genHType p);
-$es3 $genType fwidth($genType p);
-$es3 $genHType fwidth($genHType p);
-
-
-// SkSL intrinsics that are not part of GLSL:
-// The max() guards against division by zero when the incoming color is transparent black
-half4 unpremul(half4 color) { return half4 (color.rgb / max(color.a, 0.0001), color.a); }
-float4 unpremul(float4 color) { return float4(color.rgb / max(color.a, 0.0001), color.a); }
+// SkSL intrinsics that are not part of GLSL
// Color space transformation, between the working (destination) space and fixed (known) spaces:
half3 toLinearSrgb(half3 color);
diff --git a/chromium/third_party/skia/src/sksl/sksl_shared.sksl b/chromium/third_party/skia/src/sksl/sksl_shared.sksl
new file mode 100644
index 00000000000..d0b62c0b6a5
--- /dev/null
+++ b/chromium/third_party/skia/src/sksl/sksl_shared.sksl
@@ -0,0 +1,297 @@
+// Intrinsics that are available to public SkSL (SkRuntimeEffect)
+
+// See "The OpenGL ES Shading Language, Section 8"
+
+// 8.1 : Angle and Trigonometry Functions
+$genType radians($genType degrees);
+$genHType radians($genHType degrees);
+$genType degrees($genType radians);
+$genHType degrees($genHType radians);
+
+$genType sin($genType angle);
+$genHType sin($genHType angle);
+$genType cos($genType angle);
+$genHType cos($genHType angle);
+$genType tan($genType angle);
+$genHType tan($genHType angle);
+
+$genType asin($genType x);
+$genHType asin($genHType x);
+$genType acos($genType x);
+$genHType acos($genHType x);
+$genType atan($genType y, $genType x);
+$genHType atan($genHType y, $genHType x);
+$genType atan($genType y_over_x);
+$genHType atan($genHType y_over_x);
+
+// 8.1 : Angle and Trigonometry Functions (GLSL ES 3.0)
+$es3 $genType sinh($genType x);
+$es3 $genHType sinh($genHType x);
+$es3 $genType cosh($genType x);
+$es3 $genHType cosh($genHType x);
+$es3 $genType tanh($genType x);
+$es3 $genHType tanh($genHType x);
+$es3 $genType asinh($genType x);
+$es3 $genHType asinh($genHType x);
+$es3 $genType acosh($genType x);
+$es3 $genHType acosh($genHType x);
+$es3 $genType atanh($genType x);
+$es3 $genHType atanh($genHType x);
+
+// 8.2 : Exponential Functions
+$genType pow($genType x, $genType y);
+$genHType pow($genHType x, $genHType y);
+$genType exp($genType x);
+$genHType exp($genHType x);
+$genType log($genType x);
+$genHType log($genHType x);
+$genType exp2($genType x);
+$genHType exp2($genHType x);
+$genType log2($genType x);
+$genHType log2($genHType x);
+
+$genType sqrt($genType x);
+$genHType sqrt($genHType x);
+$genType inversesqrt($genType x);
+$genHType inversesqrt($genHType x);
+
+// 8.3 : Common Functions
+$genType abs($genType x);
+$genHType abs($genHType x);
+$genType sign($genType x);
+$genHType sign($genHType x);
+$genType floor($genType x);
+$genHType floor($genHType x);
+$genType ceil($genType x);
+$genHType ceil($genHType x);
+$genType fract($genType x);
+$genHType fract($genHType x);
+$genType mod($genType x, float y);
+$genType mod($genType x, $genType y);
+$genHType mod($genHType x, half y);
+$genHType mod($genHType x, $genHType y);
+
+$genType min($genType x, $genType y);
+$genType min($genType x, float y);
+$genHType min($genHType x, $genHType y);
+$genHType min($genHType x, half y);
+$genType max($genType x, $genType y);
+$genType max($genType x, float y);
+$genHType max($genHType x, $genHType y);
+$genHType max($genHType x, half y);
+$genType clamp($genType x, $genType minVal, $genType maxVal);
+$genType clamp($genType x, float minVal, float maxVal);
+$genHType clamp($genHType x, $genHType minVal, $genHType maxVal);
+$genHType clamp($genHType x, half minVal, half maxVal);
+$genType saturate($genType x); // SkSL extension
+$genHType saturate($genHType x); // SkSL extension
+$genType mix($genType x, $genType y, $genType a);
+$genType mix($genType x, $genType y, float a);
+$genHType mix($genHType x, $genHType y, $genHType a);
+$genHType mix($genHType x, $genHType y, half a);
+$genType step($genType edge, $genType x);
+$genType step(float edge, $genType x);
+$genHType step($genHType edge, $genHType x);
+$genHType step(half edge, $genHType x);
+$genType smoothstep($genType edge0, $genType edge1, $genType x);
+$genType smoothstep(float edge0, float edge1, $genType x);
+$genHType smoothstep($genHType edge0, $genHType edge1, $genHType x);
+$genHType smoothstep(half edge0, half edge1, $genHType x);
+
+// 8.3 : Common Functions (GLSL ES 3.0)
+$es3 $genIType abs($genIType x);
+$es3 $genIType sign($genIType x);
+$es3 $genIType floatBitsToInt ($genType value);
+$es3 $genUType floatBitsToUint($genType value);
+$es3 $genType intBitsToFloat ($genIType value);
+$es3 $genType uintBitsToFloat($genUType value);
+$es3 $genType trunc($genType x);
+$es3 $genHType trunc($genHType x);
+$es3 $genType round($genType x);
+$es3 $genHType round($genHType x);
+$es3 $genType roundEven($genType x);
+$es3 $genHType roundEven($genHType x);
+$es3 $genIType min($genIType x, $genIType y);
+$es3 $genIType min($genIType x, int y);
+$es3 $genIType max($genIType x, $genIType y);
+$es3 $genIType max($genIType x, int y);
+$es3 $genIType clamp($genIType x, $genIType minVal, $genIType maxVal);
+$es3 $genIType clamp($genIType x, int minVal, int maxVal);
+$es3 $genUType clamp($genUType x, $genUType minVal, $genUType maxVal);
+$es3 $genUType clamp($genUType x, uint minVal, uint maxVal);
+$es3 $genType mix($genType x, $genType y, $genBType a);
+$es3 $genHType mix($genHType x, $genHType y, $genBType a);
+
+// 8.3 : Common Functions (GLSL ES 3.0) -- cannot be used in constant-expressions
+$es3 $genBType isnan($genType x);
+$es3 $genBType isnan($genHType x);
+$es3 $genBType isinf($genType x);
+$es3 $genBType isinf($genHType x);
+$es3 $genType modf($genType x, out $genType i);
+$es3 $genHType modf($genHType x, out $genHType i);
+
+// 8.4 : Floating-Point Pack and Unpack Functions (GLSL ES 3.0)
+$es3 uint packUnorm2x16(float2 v);
+$es3 float2 unpackUnorm2x16(uint p);
+
+// 8.5 : Geometric Functions
+float length($genType x);
+half length($genHType x);
+float distance($genType p0, $genType p1);
+half distance($genHType p0, $genHType p1);
+float dot($genType x, $genType y);
+half dot($genHType x, $genHType y);
+float3 cross(float3 x, float3 y);
+half3 cross(half3 x, half3 y);
+$genType normalize($genType x);
+$genHType normalize($genHType x);
+$genType faceforward($genType N, $genType I, $genType Nref);
+$genHType faceforward($genHType N, $genHType I, $genHType Nref);
+$genType reflect($genType I, $genType N);
+$genHType reflect($genHType I, $genHType N);
+$genType refract($genType I, $genType N, float eta);
+$genHType refract($genHType I, $genHType N, half eta);
+
+// 8.6 : Matrix Functions
+$squareMat matrixCompMult($squareMat x, $squareMat y);
+$squareHMat matrixCompMult($squareHMat x, $squareHMat y);
+$es3 $mat matrixCompMult($mat x, $mat y);
+$es3 $hmat matrixCompMult($hmat x, $hmat y);
+
+// 8.6 : Matrix Functions (GLSL 1.4, poly-filled by SkSL as needed)
+$squareMat inverse($squareMat m);
+$squareHMat inverse($squareHMat m);
+
+// 8.6 : Matrix Functions (GLSL ES 3.0)
+$es3 float determinant($squareMat m);
+$es3 half determinant($squareHMat m);
+$es3 $squareMat transpose($squareMat m);
+$es3 $squareHMat transpose($squareHMat m);
+$es3 float2x3 transpose(float3x2 m);
+$es3 half2x3 transpose(half3x2 m);
+$es3 float2x4 transpose(float4x2 m);
+$es3 half2x4 transpose(half4x2 m);
+$es3 float3x2 transpose(float2x3 m);
+$es3 half3x2 transpose(half2x3 m);
+$es3 float3x4 transpose(float4x3 m);
+$es3 half3x4 transpose(half4x3 m);
+$es3 float4x2 transpose(float2x4 m);
+$es3 half4x2 transpose(half2x4 m);
+$es3 float4x3 transpose(float3x4 m);
+$es3 half4x3 transpose(half3x4 m);
+$es3 $squareMat outerProduct($vec c, $vec r);
+$es3 $squareHMat outerProduct($hvec c, $hvec r);
+$es3 float2x3 outerProduct(float3 c, float2 r);
+$es3 half2x3 outerProduct(half3 c, half2 r);
+$es3 float3x2 outerProduct(float2 c, float3 r);
+$es3 half3x2 outerProduct(half2 c, half3 r);
+$es3 float2x4 outerProduct(float4 c, float2 r);
+$es3 half2x4 outerProduct(half4 c, half2 r);
+$es3 float4x2 outerProduct(float2 c, float4 r);
+$es3 half4x2 outerProduct(half2 c, half4 r);
+$es3 float3x4 outerProduct(float4 c, float3 r);
+$es3 half3x4 outerProduct(half4 c, half3 r);
+$es3 float4x3 outerProduct(float3 c, float4 r);
+$es3 half4x3 outerProduct(half3 c, half4 r);
+
+// 8.7 : Vector Relational Functions
+$bvec lessThan($vec x, $vec y);
+$bvec lessThan($hvec x, $hvec y);
+$bvec lessThan($ivec x, $ivec y);
+$bvec lessThanEqual($vec x, $vec y);
+$bvec lessThanEqual($hvec x, $hvec y);
+$bvec lessThanEqual($ivec x, $ivec y);
+$bvec greaterThan($vec x, $vec y);
+$bvec greaterThan($hvec x, $hvec y);
+$bvec greaterThan($ivec x, $ivec y);
+$bvec greaterThanEqual($vec x, $vec y);
+$bvec greaterThanEqual($hvec x, $hvec y);
+$bvec greaterThanEqual($ivec x, $ivec y);
+$bvec equal($vec x, $vec y);
+$bvec equal($hvec x, $hvec y);
+$bvec equal($ivec x, $ivec y);
+$bvec equal($bvec x, $bvec y);
+$bvec notEqual($vec x, $vec y);
+$bvec notEqual($hvec x, $hvec y);
+$bvec notEqual($ivec x, $ivec y);
+$bvec notEqual($bvec x, $bvec y);
+
+bool any($bvec x);
+bool all($bvec x);
+$bvec not($bvec x);
+
+// 8.9 : Fragment Processing Functions (GLSL ES 3.0)
+$es3 $genType dFdx($genType p);
+$es3 $genType dFdy($genType p);
+$es3 $genHType dFdx($genHType p);
+$es3 $genHType dFdy($genHType p);
+$es3 $genType fwidth($genType p);
+$es3 $genHType fwidth($genHType p);
+
+
+// SkSL utility functions
+
+// The max() guards against division by zero when the incoming color is transparent black
+half4 unpremul(half4 color) { return half4 (color.rgb / max(color.a, 0.0001), color.a); }
+float4 unpremul(float4 color) { return float4(color.rgb / max(color.a, 0.0001), color.a); }
+
+// Convert RGBA -> HSLA (including unpremul).
+//
+// Based on work by Sam Hocevar, Emil Persson, and Ian Taylor [1][2][3]. High-level ideas:
+//
+// - minimize the number of branches by sorting and computing the hue phase in parallel (vec4s)
+//
+// - trade the third sorting branch for a potentially faster std::min and leaving 2nd/3rd
+// channels unsorted (based on the observation that swapping both the channels and the bias sign
+// has no effect under abs)
+//
+// - use epsilon offsets for denominators, to avoid explicit zero-checks
+//
+// An additional trick we employ is deferring premul->unpremul conversion until the very end: the
+// alpha factor gets naturally simplified for H and S, and only L requires a dedicated unpremul
+// division (so we trade three divs for one).
+//
+// [1] http://lolengine.net/blog/2013/01/13/fast-rgb-to-hsv
+// [2] http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl
+// [3] http://www.chilliant.com/rgb2hsv.html
+
+half4 $rgb_to_hsl(half3 c, half a) {
+ half4 p = (c.g < c.b) ? half4(c.bg, -1, 2/3.0)
+ : half4(c.gb, 0, -1/3.0);
+ half4 q = (c.r < p.x) ? half4(p.x, c.r, p.yw)
+ : half4(c.r, p.x, p.yz);
+
+ // q.x -> max channel value
+ // q.yz -> 2nd/3rd channel values (unsorted)
+ // q.w -> bias value dependent on max channel selection
+
+ const half kEps = 0.0001;
+ half pmV = q.x;
+ half pmC = pmV - min(q.y, q.z);
+ half pmL = pmV - pmC * 0.5;
+ half H = abs(q.w + (q.y - q.z) / (pmC * 6 + kEps));
+ half S = pmC / (a + kEps - abs(pmL * 2 - a));
+ half L = pmL / (a + kEps);
+
+ return half4(H, S, L, a);
+}
+
+// Convert HSLA -> RGBA (including clamp and premul).
+//
+// Based on work by Sam Hocevar, Emil Persson, and Ian Taylor [1][2][3].
+//
+// [1] http://lolengine.net/blog/2013/01/13/fast-rgb-to-hsv
+// [2] http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl
+// [3] http://www.chilliant.com/rgb2hsv.html
+
+half3 $hsl_to_rgb(half3 hsl) {
+ half C = (1 - abs(2 * hsl.z - 1)) * hsl.y;
+ half3 p = hsl.xxx + half3(0, 2/3.0, 1/3.0);
+ half3 q = saturate(abs(fract(p) * 6 - 3) - 1);
+
+ return (q - 0.5) * C + hsl.z;
+}
+
+half4 $hsl_to_rgb(half3 hsl, half a) {
+ return saturate(half4($hsl_to_rgb(hsl) * a, a));
+}
diff --git a/chromium/third_party/skia/src/sksl/tracing/BUILD.bazel b/chromium/third_party/skia/src/sksl/tracing/BUILD.bazel
index 7e7dac932b9..35c8ff120ee 100644
--- a/chromium/third_party/skia/src/sksl/tracing/BUILD.bazel
+++ b/chromium/third_party/skia/src/sksl/tracing/BUILD.bazel
@@ -9,8 +9,8 @@ filegroup(
srcs = [
"SkVMDebugTrace.cpp",
] + select({
- "//bazel/common_config_settings:enable_sksl_tracing_true": ["SkVMDebugTracePlayer.cpp"],
- "//bazel/common_config_settings:enable_sksl_tracing_false": [],
+ "//src/sksl:enable_sksl_tracing_true": ["SkVMDebugTracePlayer.cpp"],
+ "//src/sksl:enable_sksl_tracing_false": [],
}),
visibility = ["//src/sksl:__pkg__"],
)
@@ -20,8 +20,8 @@ filegroup(
srcs = [
"SkVMDebugTrace.h",
] + select({
- "//bazel/common_config_settings:enable_sksl_tracing_true": ["SkVMDebugTracePlayer.h"],
- "//bazel/common_config_settings:enable_sksl_tracing_false": [],
+ "//src/sksl:enable_sksl_tracing_true": ["SkVMDebugTracePlayer.h"],
+ "//src/sksl:enable_sksl_tracing_false": [],
}),
visibility = ["//src/sksl:__pkg__"],
)
diff --git a/chromium/third_party/skia/src/sksl/tracing/SkVMDebugTrace.cpp b/chromium/third_party/skia/src/sksl/tracing/SkVMDebugTrace.cpp
index 72d4b50d130..a6139ad825c 100644
--- a/chromium/third_party/skia/src/sksl/tracing/SkVMDebugTrace.cpp
+++ b/chromium/third_party/skia/src/sksl/tracing/SkVMDebugTrace.cpp
@@ -17,7 +17,8 @@
#include "src/utils/SkJSON.h"
#include "src/utils/SkJSONWriter.h"
-#include <stdio.h>
+#include <cstddef>
+#include <cstdio>
#include <sstream>
#include <string>
#include <string_view>
@@ -78,7 +79,7 @@ std::string SkVMDebugTrace::slotValueToString(int slotIndex, double value) const
}
default: {
char buffer[32];
- snprintf(buffer, SK_ARRAY_COUNT(buffer), "%.8g", value);
+ snprintf(buffer, std::size(buffer), "%.8g", value);
return buffer;
}
}
@@ -204,11 +205,11 @@ void SkVMDebugTrace::writeTrace(SkWStream* w) const {
SkJSONWriter json(w);
json.beginObject(); // root
- json.appendString("version", kTraceVersion);
+ json.appendNString("version", kTraceVersion);
json.beginArray("source");
for (const std::string& line : fSource) {
- json.appendString(line.c_str());
+ json.appendString(line);
}
json.endArray(); // code
@@ -218,7 +219,7 @@ void SkVMDebugTrace::writeTrace(SkWStream* w) const {
const SkVMSlotInfo& info = fSlotInfo[index];
json.beginObject();
- json.appendString("name", info.name.c_str());
+ json.appendString("name", info.name.data(), info.name.size());
json.appendS32("columns", info.columns);
json.appendS32("rows", info.rows);
json.appendS32("index", info.componentIndex);
@@ -240,7 +241,7 @@ void SkVMDebugTrace::writeTrace(SkWStream* w) const {
const SkVMFunctionInfo& info = fFuncInfo[index];
json.beginObject();
- json.appendString("name", info.name.c_str());
+ json.appendString("name", info.name);
json.endObject();
}
@@ -253,7 +254,7 @@ void SkVMDebugTrace::writeTrace(SkWStream* w) const {
json.appendS32((int)trace.op);
// Skip trailing zeros in the data (since most ops only use one value).
- int lastDataIdx = SK_ARRAY_COUNT(trace.data) - 1;
+ int lastDataIdx = std::size(trace.data) - 1;
while (lastDataIdx >= 0 && !trace.data[lastDataIdx]) {
--lastDataIdx;
}
@@ -367,7 +368,7 @@ bool SkVMDebugTrace::readTrace(SkStream* r) {
fTraceInfo.push_back(SkVMTraceInfo{});
SkVMTraceInfo& info = fTraceInfo.back();
- if (!element || element->size() < 1 || element->size() > (1 + SK_ARRAY_COUNT(info.data))) {
+ if (!element || element->size() < 1 || element->size() > (1 + std::size(info.data))) {
return false;
}
const skjson::NumberValue* opVal = (*element)[0];
diff --git a/chromium/third_party/skia/src/sksl/tracing/SkVMDebugTrace.h b/chromium/third_party/skia/src/sksl/tracing/SkVMDebugTrace.h
index f863e20c2c0..dabf1fa16f3 100644
--- a/chromium/third_party/skia/src/sksl/tracing/SkVMDebugTrace.h
+++ b/chromium/third_party/skia/src/sksl/tracing/SkVMDebugTrace.h
@@ -14,8 +14,8 @@
#include "src/core/SkVM.h"
#include "src/sksl/ir/SkSLType.h"
+#include <cstdint>
#include <memory>
-#include <stdint.h>
#include <string>
#include <vector>
diff --git a/chromium/third_party/skia/src/sksl/tracing/SkVMDebugTracePlayer.h b/chromium/third_party/skia/src/sksl/tracing/SkVMDebugTracePlayer.h
index c261d85c0e8..13ee7b7bd8e 100644
--- a/chromium/third_party/skia/src/sksl/tracing/SkVMDebugTracePlayer.h
+++ b/chromium/third_party/skia/src/sksl/tracing/SkVMDebugTracePlayer.h
@@ -11,6 +11,8 @@
#include "include/core/SkTypes.h"
#include "src/utils/SkBitSet.h"
+#include <cstddef>
+#include <cstdint>
#include <optional>
#include <unordered_map>
#include <unordered_set>
diff --git a/chromium/third_party/skia/src/sksl/transform/BUILD.bazel b/chromium/third_party/skia/src/sksl/transform/BUILD.bazel
index 81b2ad436a3..9945c3b7671 100644
--- a/chromium/third_party/skia/src/sksl/transform/BUILD.bazel
+++ b/chromium/third_party/skia/src/sksl/transform/BUILD.bazel
@@ -5,12 +5,14 @@ licenses(["notice"])
exports_files_legacy()
TRANSFORM_FILES = [
- "SkSLBuiltinVariableScanner.cpp",
+ "SkSLAddConstToVarModifiers.cpp",
"SkSLEliminateDeadFunctions.cpp",
"SkSLEliminateDeadGlobalVariables.cpp",
"SkSLEliminateDeadLocalVariables.cpp",
"SkSLEliminateEmptyStatements.cpp",
"SkSLEliminateUnreachableCode.cpp",
+ "SkSLFindAndDeclareBuiltinFunctions.cpp",
+ "SkSLFindAndDeclareBuiltinVariables.cpp",
"SkSLProgramWriter.h",
"SkSLTransform.h",
]
diff --git a/chromium/third_party/skia/src/sksl/transform/SkSLAddConstToVarModifiers.cpp b/chromium/third_party/skia/src/sksl/transform/SkSLAddConstToVarModifiers.cpp
new file mode 100644
index 00000000000..3aa485e5276
--- /dev/null
+++ b/chromium/third_party/skia/src/sksl/transform/SkSLAddConstToVarModifiers.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "include/private/SkSLModifiers.h"
+#include "src/sksl/SkSLContext.h"
+#include "src/sksl/SkSLModifiersPool.h"
+#include "src/sksl/analysis/SkSLProgramUsage.h"
+#include "src/sksl/ir/SkSLExpression.h"
+#include "src/sksl/ir/SkSLVariable.h"
+#include "src/sksl/transform/SkSLTransform.h"
+
+namespace SkSL {
+
+const Modifiers* Transform::AddConstToVarModifiers(const Context& context,
+ const Variable& var,
+ const Expression* initialValue,
+ const ProgramUsage* usage) {
+ // If the variable is already marked as `const`, keep our existing modifiers.
+ const Modifiers* modifiers = &var.modifiers();
+ if (modifiers->fFlags & Modifiers::kConst_Flag) {
+ return modifiers;
+ }
+ // If the variable doesn't have a compile-time-constant initial value, we can't `const` it.
+ if (!initialValue || !initialValue->isCompileTimeConstant()) {
+ return modifiers;
+ }
+ // This only works for variables that are written-to a single time.
+ ProgramUsage::VariableCounts counts = usage->get(var);
+ if (counts.fWrite != 1) {
+ return modifiers;
+ }
+ // Add `const` to our variable's modifiers, making it eligible for constant-folding.
+ Modifiers constModifiers = *modifiers;
+ constModifiers.fFlags |= Modifiers::kConst_Flag;
+ return context.fModifiersPool->add(constModifiers);
+}
+
+} // namespace SkSL
diff --git a/chromium/third_party/skia/src/sksl/transform/SkSLBuiltinVariableScanner.cpp b/chromium/third_party/skia/src/sksl/transform/SkSLBuiltinVariableScanner.cpp
deleted file mode 100644
index f17e28c7496..00000000000
--- a/chromium/third_party/skia/src/sksl/transform/SkSLBuiltinVariableScanner.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright 2021 Google LLC.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "src/sksl/transform/SkSLTransform.h"
-
-#include "include/core/SkTypes.h"
-#include "include/private/SkSLProgramElement.h"
-#include "include/private/SkSLProgramKind.h"
-#include "src/sksl/SkSLBuiltinMap.h"
-#include "src/sksl/SkSLBuiltinTypes.h"
-#include "src/sksl/SkSLCompiler.h"
-#include "src/sksl/SkSLContext.h"
-#include "src/sksl/SkSLProgramSettings.h"
-#include "src/sksl/SkSLThreadContext.h"
-#include "src/sksl/analysis/SkSLProgramVisitor.h"
-#include "src/sksl/ir/SkSLExpression.h"
-#include "src/sksl/ir/SkSLFunctionDeclaration.h"
-#include "src/sksl/ir/SkSLFunctionDefinition.h"
-#include "src/sksl/ir/SkSLType.h"
-#include "src/sksl/ir/SkSLVariable.h"
-#include "src/sksl/ir/SkSLVariableReference.h"
-
-#ifdef SK_DEBUG
-#include "src/sksl/ir/SkSLInterfaceBlock.h"
-#include "src/sksl/ir/SkSLVarDeclarations.h"
-#endif
-
-#include <memory>
-#include <string>
-#include <vector>
-
-namespace SkSL {
-namespace Transform {
-namespace {
-
-class BuiltinVariableScanner : public ProgramVisitor {
-public:
- BuiltinVariableScanner(const Context& context) : fContext(context) {}
-
- void addDeclaringElement(const std::string& name) {
- // If this is the *first* time we've seen this builtin, findAndInclude will return the
- // corresponding ProgramElement.
- BuiltinMap& builtins = *fContext.fBuiltins;
- if (const ProgramElement* decl = builtins.findAndInclude(name)) {
- SkASSERT(decl->is<GlobalVarDeclaration>() || decl->is<InterfaceBlock>());
- fNewElements.push_back(decl);
- }
- }
-
- bool visitProgramElement(const ProgramElement& pe) override {
- if (pe.is<FunctionDefinition>()) {
- const FunctionDefinition& funcDef = pe.as<FunctionDefinition>();
- // We synthesize writes to sk_FragColor if main() returns a color, even if it's
- // otherwise unreferenced. Check main's return type to see if it's half4.
- if (funcDef.declaration().isMain() &&
- funcDef.declaration().returnType().matches(*fContext.fTypes.fHalf4)) {
- fPreserveFragColor = true;
- }
- }
- return INHERITED::visitProgramElement(pe);
- }
-
- bool visitExpression(const Expression& e) override {
- if (e.is<VariableReference>()) {
- const Variable* var = e.as<VariableReference>().variable();
- if (var->isBuiltin()) {
- this->addDeclaringElement(std::string(var->name()));
- }
-
- ThreadContext::Compiler().updateInputsForBuiltinVariable(*var);
- }
- return INHERITED::visitExpression(e);
- }
-
- const Context& fContext;
- std::vector<const ProgramElement*> fNewElements;
- bool fPreserveFragColor = false;
-
- using INHERITED = ProgramVisitor;
- using INHERITED::visitProgramElement;
-};
-
-} // namespace
-
-void FindAndDeclareBuiltinVariables(const Context& context,
- ProgramKind programKind,
- std::vector<const ProgramElement*>& sharedElements) {
- BuiltinVariableScanner scanner(context);
- for (auto& e : ThreadContext::ProgramElements()) {
- scanner.visitProgramElement(*e);
- }
-
- for (auto& e : ThreadContext::SharedElements()) {
- scanner.visitProgramElement(*e);
- }
-
- if (scanner.fPreserveFragColor) {
- // main() returns a half4, so make sure we don't dead-strip sk_FragColor.
- scanner.addDeclaringElement(Compiler::FRAGCOLOR_NAME);
- }
-
- if (ProgramConfig::IsFragment(programKind)) {
- // Vulkan requires certain builtin variables be present, even if they're unused. At one
- // time, validation errors would result if sk_Clockwise was missing. Now, it's just (Adreno)
- // driver bugs that drop or corrupt draws if they're missing.
- scanner.addDeclaringElement("sk_Clockwise");
- }
-
- sharedElements.insert(sharedElements.begin(), scanner.fNewElements.begin(),
- scanner.fNewElements.end());
-}
-
-} // namespace Transform
-} // namespace SkSL
diff --git a/chromium/third_party/skia/src/sksl/transform/SkSLEliminateDeadFunctions.cpp b/chromium/third_party/skia/src/sksl/transform/SkSLEliminateDeadFunctions.cpp
index 24325a263cf..f60585770ff 100644
--- a/chromium/third_party/skia/src/sksl/transform/SkSLEliminateDeadFunctions.cpp
+++ b/chromium/third_party/skia/src/sksl/transform/SkSLEliminateDeadFunctions.cpp
@@ -7,6 +7,7 @@
#include "include/private/SkSLProgramElement.h"
#include "src/sksl/SkSLProgramSettings.h"
+#include "src/sksl/analysis/SkSLProgramUsage.h"
#include "src/sksl/ir/SkSLFunctionDeclaration.h"
#include "src/sksl/ir/SkSLFunctionDefinition.h"
#include "src/sksl/ir/SkSLProgram.h"
@@ -18,7 +19,8 @@
namespace SkSL {
-bool Transform::EliminateDeadFunctions(Program& program, ProgramUsage* usage) {
+bool Transform::EliminateDeadFunctions(Program& program) {
+ ProgramUsage* usage = program.fUsage.get();
bool madeChanges = false;
if (program.fConfig->fSettings.fRemoveDeadFunctions) {
diff --git a/chromium/third_party/skia/src/sksl/transform/SkSLEliminateDeadGlobalVariables.cpp b/chromium/third_party/skia/src/sksl/transform/SkSLEliminateDeadGlobalVariables.cpp
index b68d1ecf9d2..a649e0c0380 100644
--- a/chromium/third_party/skia/src/sksl/transform/SkSLEliminateDeadGlobalVariables.cpp
+++ b/chromium/third_party/skia/src/sksl/transform/SkSLEliminateDeadGlobalVariables.cpp
@@ -8,6 +8,7 @@
#include "include/private/SkSLProgramElement.h"
#include "include/private/SkSLStatement.h"
#include "src/sksl/SkSLProgramSettings.h"
+#include "src/sksl/analysis/SkSLProgramUsage.h"
#include "src/sksl/ir/SkSLProgram.h"
#include "src/sksl/ir/SkSLVarDeclarations.h"
#include "src/sksl/transform/SkSLTransform.h"
@@ -18,7 +19,8 @@
namespace SkSL {
-bool Transform::EliminateDeadGlobalVariables(Program& program, ProgramUsage* usage) {
+bool Transform::EliminateDeadGlobalVariables(Program& program) {
+ ProgramUsage* usage = program.fUsage.get();
bool madeChanges = false;
if (program.fConfig->fSettings.fRemoveDeadVariables) {
diff --git a/chromium/third_party/skia/src/sksl/transform/SkSLEliminateDeadLocalVariables.cpp b/chromium/third_party/skia/src/sksl/transform/SkSLEliminateDeadLocalVariables.cpp
index 33943407c5d..38a70461212 100644
--- a/chromium/third_party/skia/src/sksl/transform/SkSLEliminateDeadLocalVariables.cpp
+++ b/chromium/third_party/skia/src/sksl/transform/SkSLEliminateDeadLocalVariables.cpp
@@ -12,6 +12,7 @@
#include "include/private/SkTHash.h"
#include "src/sksl/SkSLCompiler.h"
#include "src/sksl/SkSLProgramSettings.h"
+#include "src/sksl/analysis/SkSLProgramUsage.h"
#include "src/sksl/ir/SkSLExpression.h"
#include "src/sksl/ir/SkSLExpressionStatement.h"
#include "src/sksl/ir/SkSLFunctionDefinition.h"
@@ -65,6 +66,8 @@ static bool eliminate_dead_local_variables(const Context& context,
fUsage->remove(stmt.get());
stmt = Nop::Make();
}
+ // The variable is no longer referenced anywhere so it should be safe to change.
+ const_cast<Variable*>(var)->markEliminated();
fMadeChanges = true;
}
return false;
@@ -112,14 +115,14 @@ static bool eliminate_dead_local_variables(const Context& context,
bool Transform::EliminateDeadLocalVariables(const Context& context,
LoadedModule& module,
ProgramUsage* usage) {
- return eliminate_dead_local_variables(context, SkMakeSpan(module.fElements), usage);
+ return eliminate_dead_local_variables(context, SkSpan(module.fElements), usage);
}
-bool Transform::EliminateDeadLocalVariables(Program& program, ProgramUsage* usage) {
+bool Transform::EliminateDeadLocalVariables(Program& program) {
return program.fConfig->fSettings.fRemoveDeadVariables
? eliminate_dead_local_variables(*program.fContext,
- SkMakeSpan(program.fOwnedElements),
- usage)
+ SkSpan(program.fOwnedElements),
+ program.fUsage.get())
: false;
}
diff --git a/chromium/third_party/skia/src/sksl/transform/SkSLEliminateEmptyStatements.cpp b/chromium/third_party/skia/src/sksl/transform/SkSLEliminateEmptyStatements.cpp
index 238f4ec041a..ca49a151a6a 100644
--- a/chromium/third_party/skia/src/sksl/transform/SkSLEliminateEmptyStatements.cpp
+++ b/chromium/third_party/skia/src/sksl/transform/SkSLEliminateEmptyStatements.cpp
@@ -56,7 +56,7 @@ static void eliminate_empty_statements(SkSpan<std::unique_ptr<ProgramElement>> e
}
void Transform::EliminateEmptyStatements(LoadedModule& module) {
- return eliminate_empty_statements(SkMakeSpan(module.fElements));
+ return eliminate_empty_statements(SkSpan(module.fElements));
}
} // namespace SkSL
diff --git a/chromium/third_party/skia/src/sksl/transform/SkSLEliminateUnreachableCode.cpp b/chromium/third_party/skia/src/sksl/transform/SkSLEliminateUnreachableCode.cpp
index 2e44912f070..fd3fa2596c8 100644
--- a/chromium/third_party/skia/src/sksl/transform/SkSLEliminateUnreachableCode.cpp
+++ b/chromium/third_party/skia/src/sksl/transform/SkSLEliminateUnreachableCode.cpp
@@ -6,14 +6,19 @@
*/
#include "include/core/SkSpan.h"
+#include "include/core/SkTypes.h"
+#include "include/private/SkSLDefines.h"
#include "include/private/SkSLProgramElement.h"
#include "include/private/SkSLStatement.h"
#include "include/private/SkTArray.h"
#include "src/sksl/SkSLCompiler.h"
+#include "src/sksl/analysis/SkSLProgramUsage.h"
#include "src/sksl/ir/SkSLFunctionDefinition.h"
#include "src/sksl/ir/SkSLIfStatement.h"
#include "src/sksl/ir/SkSLNop.h"
#include "src/sksl/ir/SkSLProgram.h"
+#include "src/sksl/ir/SkSLSwitchCase.h"
+#include "src/sksl/ir/SkSLSwitchStatement.h"
#include "src/sksl/transform/SkSLProgramWriter.h"
#include "src/sksl/transform/SkSLTransform.h"
@@ -29,7 +34,7 @@ static void eliminate_unreachable_code(SkSpan<std::unique_ptr<ProgramElement>> e
public:
UnreachableCodeEliminator(ProgramUsage* usage) : fUsage(usage) {
fFoundFunctionExit.push_back(false);
- fFoundLoopExit.push_back(false);
+ fFoundBlockExit.push_back(false);
}
bool visitExpressionPtr(std::unique_ptr<Expression>& expr) override {
@@ -38,7 +43,7 @@ static void eliminate_unreachable_code(SkSpan<std::unique_ptr<ProgramElement>> e
}
bool visitStatementPtr(std::unique_ptr<Statement>& stmt) override {
- if (fFoundFunctionExit.back() || fFoundLoopExit.back()) {
+ if (fFoundFunctionExit.back() || fFoundBlockExit.back()) {
// If we already found an exit in this section, anything beyond it is dead code.
if (!stmt->is<Nop>()) {
// Eliminate the dead statement by substituting a Nop.
@@ -56,11 +61,12 @@ static void eliminate_unreachable_code(SkSpan<std::unique_ptr<ProgramElement>> e
break;
case Statement::Kind::kBreak:
+ // A `break` statement can either be breaking out of a loop or terminating an
+ // individual switch case. We treat both cases the same way: they only apply
+ // to the statements associated with the parent statement (i.e. enclosing loop
+ // block / preceding case label).
case Statement::Kind::kContinue:
- // We found a loop exit on this path. Note that we skip over switch statements
- // completely when eliminating code, so any `break` statement would be breaking
- // out of a loop, not out of a switch.
- fFoundLoopExit.back() = true;
+ fFoundBlockExit.back() = true;
break;
case Statement::Kind::kExpression:
@@ -76,18 +82,18 @@ static void eliminate_unreachable_code(SkSpan<std::unique_ptr<ProgramElement>> e
case Statement::Kind::kDo: {
// Function-exits are allowed to propagate outside of a do-loop, because it
// always executes its body at least once.
- fFoundLoopExit.push_back(false);
+ fFoundBlockExit.push_back(false);
bool result = INHERITED::visitStatementPtr(stmt);
- fFoundLoopExit.pop_back();
+ fFoundBlockExit.pop_back();
return result;
}
case Statement::Kind::kFor: {
// Function-exits are not allowed to propagate out, because a for-loop or while-
// loop could potentially run zero times.
fFoundFunctionExit.push_back(false);
- fFoundLoopExit.push_back(false);
+ fFoundBlockExit.push_back(false);
bool result = INHERITED::visitStatementPtr(stmt);
- fFoundLoopExit.pop_back();
+ fFoundBlockExit.pop_back();
fFoundFunctionExit.pop_back();
return result;
}
@@ -98,33 +104,83 @@ static void eliminate_unreachable_code(SkSpan<std::unique_ptr<ProgramElement>> e
IfStatement& ifStmt = stmt->as<IfStatement>();
fFoundFunctionExit.push_back(false);
- fFoundLoopExit.push_back(false);
+ fFoundBlockExit.push_back(false);
bool result = (ifStmt.ifTrue() && this->visitStatementPtr(ifStmt.ifTrue()));
bool foundFunctionExitOnTrue = fFoundFunctionExit.back();
- bool foundLoopExitOnTrue = fFoundLoopExit.back();
+ bool foundLoopExitOnTrue = fFoundBlockExit.back();
fFoundFunctionExit.pop_back();
- fFoundLoopExit.pop_back();
+ fFoundBlockExit.pop_back();
fFoundFunctionExit.push_back(false);
- fFoundLoopExit.push_back(false);
+ fFoundBlockExit.push_back(false);
result |= (ifStmt.ifFalse() && this->visitStatementPtr(ifStmt.ifFalse()));
bool foundFunctionExitOnFalse = fFoundFunctionExit.back();
- bool foundLoopExitOnFalse = fFoundLoopExit.back();
+ bool foundLoopExitOnFalse = fFoundBlockExit.back();
fFoundFunctionExit.pop_back();
- fFoundLoopExit.pop_back();
+ fFoundBlockExit.pop_back();
fFoundFunctionExit.back() |= foundFunctionExitOnTrue &&
foundFunctionExitOnFalse;
- fFoundLoopExit.back() |= foundLoopExitOnTrue &&
- foundLoopExitOnFalse;
+ fFoundBlockExit.back() |= foundLoopExitOnTrue &&
+ foundLoopExitOnFalse;
+ return result;
+ }
+ case Statement::Kind::kSwitch: {
+ // In switch statements we consider unreachable code on a per-case basis.
+ SwitchStatement& sw = stmt->as<SwitchStatement>();
+ bool result = false;
+
+ // Tracks whether we found at least one case that doesn't lead to a return
+ // statement (potentially via fallthrough).
+ bool foundCaseWithoutReturn = false;
+ bool hasDefault = false;
+ for (std::unique_ptr<Statement>& c : sw.cases()) {
+ // We eliminate unreachable code within the statements of the individual
+ // case. Breaks are not allowed to propagate outside the case statement
+ // itself. Function returns are allowed to propagate out only if all cases
+ // have a return AND one of the cases is default (so that we know at least
+ // one of the branches will be taken). This is similar to how we handle if
+ // statements above.
+ fFoundFunctionExit.push_back(false);
+ fFoundBlockExit.push_back(false);
+
+ SwitchCase& sc = c->as<SwitchCase>();
+ result |= this->visitStatementPtr(sc.statement());
+
+ // When considering whether a case has a return we can propagate, we
+ // assume the following:
+ // 1. The default case is always placed last in a switch statement and
+ // it is the last possible label reachable via fallthrough. Thus if
+ // it does not contain a return statement, then we don't propagate a
+ // function return.
+ // 2. In all other cases we prevent the return from propagating only if
+ // we encounter a break statement. If no return or break is found,
+ // we defer the decision to the fallthrough case. We won't propagate
+ // a return unless we eventually encounter a default label.
+ //
+ // See resources/sksl/shared/SwitchWithEarlyReturn.sksl for test cases that
+ // exercise this.
+ if (sc.isDefault()) {
+ foundCaseWithoutReturn |= !fFoundFunctionExit.back();
+ hasDefault = true;
+ } else {
+ // We can only be sure that a case does not lead to a return if it
+ // doesn't fallthrough.
+ foundCaseWithoutReturn |=
+ (!fFoundFunctionExit.back() && fFoundBlockExit.back());
+ }
+
+ fFoundFunctionExit.pop_back();
+ fFoundBlockExit.pop_back();
+ }
+
+ fFoundFunctionExit.back() |= !foundCaseWithoutReturn && hasDefault;
return result;
}
- case Statement::Kind::kSwitch:
case Statement::Kind::kSwitchCase:
- // We skip past switch statements entirely when scanning for dead code. Their
- // control flow is quite complex and we already do a good job of flattening out
- // switches on constant values.
- break;
+ // We should never hit this case as switch cases are handled in the previous
+ // case.
+ SkUNREACHABLE;
}
return false;
@@ -132,7 +188,7 @@ static void eliminate_unreachable_code(SkSpan<std::unique_ptr<ProgramElement>> e
ProgramUsage* fUsage;
SkSTArray<32, bool> fFoundFunctionExit;
- SkSTArray<32, bool> fFoundLoopExit;
+ SkSTArray<32, bool> fFoundBlockExit;
using INHERITED = ProgramWriter;
};
@@ -146,11 +202,11 @@ static void eliminate_unreachable_code(SkSpan<std::unique_ptr<ProgramElement>> e
}
void Transform::EliminateUnreachableCode(LoadedModule& module, ProgramUsage* usage) {
- return eliminate_unreachable_code(SkMakeSpan(module.fElements), usage);
+ return eliminate_unreachable_code(SkSpan(module.fElements), usage);
}
-void Transform::EliminateUnreachableCode(Program& program, ProgramUsage* usage) {
- return eliminate_unreachable_code(SkMakeSpan(program.fOwnedElements), usage);
+void Transform::EliminateUnreachableCode(Program& program) {
+ return eliminate_unreachable_code(SkSpan(program.fOwnedElements), program.fUsage.get());
}
} // namespace SkSL
diff --git a/chromium/third_party/skia/src/sksl/transform/SkSLFindAndDeclareBuiltinFunctions.cpp b/chromium/third_party/skia/src/sksl/transform/SkSLFindAndDeclareBuiltinFunctions.cpp
new file mode 100644
index 00000000000..47e114049c7
--- /dev/null
+++ b/chromium/third_party/skia/src/sksl/transform/SkSLFindAndDeclareBuiltinFunctions.cpp
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "include/core/SkTypes.h"
+#include "include/private/SkSLProgramElement.h"
+#include "include/private/SkTHash.h"
+#include "src/sksl/SkSLBuiltinMap.h"
+#include "src/sksl/SkSLContext.h"
+#include "src/sksl/SkSLProgramSettings.h"
+#include "src/sksl/analysis/SkSLProgramUsage.h"
+#include "src/sksl/ir/SkSLFunctionDeclaration.h"
+#include "src/sksl/ir/SkSLFunctionDefinition.h"
+#include "src/sksl/ir/SkSLProgram.h"
+#include "src/sksl/transform/SkSLTransform.h"
+
+#include <algorithm>
+#include <cstddef>
+#include <memory>
+#include <string>
+#include <string_view>
+#include <vector>
+
+namespace SkSL {
+
+void Transform::FindAndDeclareBuiltinFunctions(Program& program) {
+ ProgramUsage* usage = program.fUsage.get();
+ Context& context = *program.fContext;
+
+ std::vector<const FunctionDefinition*> addedBuiltins;
+ for (;;) {
+ // Find all the built-ins referenced by the program but not yet included in the code.
+ size_t numBuiltinsAtStart = addedBuiltins.size();
+ for (const auto& [fn, count] : usage->fCallCounts) {
+ if (!fn->isBuiltin() || count == 0) {
+ // Not a built-in; skip it.
+ continue;
+ }
+ if (fn->intrinsicKind() == k_dFdy_IntrinsicKind) {
+ // Programs that invoke the `dFdy` intrinsic will need the RTFlip input.
+ program.fInputs.fUseFlipRTUniform = !context.fConfig->fSettings.fForceNoRTFlip;
+ }
+ const ProgramElement* added = context.fBuiltins->findAndInclude(fn->description());
+ if (!added) {
+ // This built-in has already been dealt with; skip it.
+ continue;
+ }
+ addedBuiltins.push_back(&added->as<FunctionDefinition>());
+ }
+
+ if (addedBuiltins.size() == numBuiltinsAtStart) {
+ // If we didn't reference any more built-in functions than before, we're done.
+ break;
+ }
+
+ // Sort the referenced builtin functions into a consistent order; otherwise our output will
+ // become non-deterministic. The exact order isn't particularly important; we sort backwards
+ // because we add elements to the shared-elements in reverse order at the end.
+ std::sort(addedBuiltins.begin() + numBuiltinsAtStart,
+ addedBuiltins.end(),
+ [](const FunctionDefinition* aDefinition, const FunctionDefinition* bDefinition) {
+ const FunctionDeclaration& a = aDefinition->declaration();
+ const FunctionDeclaration& b = bDefinition->declaration();
+ if (a.name() != b.name()) {
+ return a.name() > b.name();
+ }
+ return a.description() > b.description();
+ });
+
+ // Update the ProgramUsage to track all these newly discovered functions.
+ int usageCallCounts = usage->fCallCounts.count();
+
+ for (size_t index = numBuiltinsAtStart; index < addedBuiltins.size(); ++index) {
+ usage->add(*addedBuiltins[index]);
+ }
+
+ if (usage->fCallCounts.count() == usageCallCounts) {
+ // If we aren't making any more unique function calls than before, we're done.
+ break;
+ }
+ }
+
+ // Insert the new functions into the program's shared elements, right at the front.
+ // They are added in reverse so that the deepest dependencies are added to the top.
+ program.fSharedElements.insert(program.fSharedElements.begin(),
+ addedBuiltins.rbegin(), addedBuiltins.rend());
+}
+
+} // namespace SkSL
diff --git a/chromium/third_party/skia/src/sksl/transform/SkSLFindAndDeclareBuiltinVariables.cpp b/chromium/third_party/skia/src/sksl/transform/SkSLFindAndDeclareBuiltinVariables.cpp
new file mode 100644
index 00000000000..9acfbda4075
--- /dev/null
+++ b/chromium/third_party/skia/src/sksl/transform/SkSLFindAndDeclareBuiltinVariables.cpp
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2021 Google LLC.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "include/core/SkTypes.h"
+#include "include/private/SkSLLayout.h"
+#include "include/private/SkSLModifiers.h"
+#include "include/private/SkSLProgramElement.h"
+#include "include/private/SkSLStatement.h"
+#include "include/private/SkTHash.h"
+#include "src/sksl/SkSLBuiltinMap.h"
+#include "src/sksl/SkSLBuiltinTypes.h"
+#include "src/sksl/SkSLCompiler.h"
+#include "src/sksl/SkSLContext.h"
+#include "src/sksl/SkSLProgramSettings.h"
+#include "src/sksl/SkSLUtil.h"
+#include "src/sksl/analysis/SkSLProgramUsage.h"
+#include "src/sksl/analysis/SkSLProgramVisitor.h"
+#include "src/sksl/ir/SkSLFunctionDeclaration.h"
+#include "src/sksl/ir/SkSLFunctionDefinition.h"
+#include "src/sksl/ir/SkSLInterfaceBlock.h"
+#include "src/sksl/ir/SkSLProgram.h"
+#include "src/sksl/ir/SkSLType.h"
+#include "src/sksl/ir/SkSLVarDeclarations.h"
+#include "src/sksl/ir/SkSLVariable.h"
+#include "src/sksl/transform/SkSLTransform.h"
+
+#include <algorithm>
+#include <memory>
+#include <string>
+#include <string_view>
+#include <vector>
+
+namespace SkSL {
+namespace Transform {
+namespace {
+
+class BuiltinVariableScanner : public ProgramVisitor {
+public:
+ BuiltinVariableScanner(const Context& context) : fContext(context) {}
+
+ void addDeclaringElement(const std::string& name) {
+ // If this is the *first* time we've seen this builtin, findAndInclude will return the
+ // corresponding ProgramElement.
+ BuiltinMap& builtins = *fContext.fBuiltins;
+ if (const ProgramElement* decl = builtins.findAndInclude(name)) {
+ SkASSERT(decl->is<GlobalVarDeclaration>() || decl->is<InterfaceBlock>());
+ fNewElements.push_back(decl);
+ }
+ }
+
+ bool visitProgramElement(const ProgramElement& pe) override {
+ if (pe.is<FunctionDefinition>()) {
+ const FunctionDefinition& funcDef = pe.as<FunctionDefinition>();
+ // We synthesize writes to sk_FragColor if main() returns a color, even if it's
+ // otherwise unreferenced. Check main's return type to see if it's half4.
+ if (funcDef.declaration().isMain()) {
+ if (funcDef.declaration().returnType().matches(*fContext.fTypes.fHalf4)) {
+ // main() returns a half4, so make sure we don't dead-strip sk_FragColor.
+ this->addDeclaringElement(Compiler::FRAGCOLOR_NAME);
+ }
+ // Once we find main(), we can stop scanning.
+ return true;
+ }
+ }
+ return false;
+ }
+
+ static std::string_view GlobalVarBuiltinName(const ProgramElement& elem) {
+ return elem.as<GlobalVarDeclaration>().declaration()->as<VarDeclaration>().var().name();
+ }
+
+ static std::string_view InterfaceBlockName(const ProgramElement& elem) {
+ return elem.as<InterfaceBlock>().instanceName();
+ }
+
+ void sortNewElements() {
+ std::sort(fNewElements.begin(),
+ fNewElements.end(),
+ [](const ProgramElement* a, const ProgramElement* b) {
+ if (a->kind() != b->kind()) {
+ return a->kind() < b->kind();
+ }
+ switch (a->kind()) {
+ case ProgramElement::Kind::kGlobalVar:
+ SkASSERT(GlobalVarBuiltinName(*a) != GlobalVarBuiltinName(*b));
+ return GlobalVarBuiltinName(*a) < GlobalVarBuiltinName(*b);
+
+ case ProgramElement::Kind::kInterfaceBlock:
+ SkASSERT(InterfaceBlockName(*a) != InterfaceBlockName(*b));
+ return InterfaceBlockName(*a) < InterfaceBlockName(*b);
+
+ default:
+ SkUNREACHABLE;
+ }
+ });
+ }
+
+ const Context& fContext;
+ std::vector<const ProgramElement*> fNewElements;
+};
+
+} // namespace
+
+void FindAndDeclareBuiltinVariables(Program& program) {
+ const Context& context = *program.fContext;
+ BuiltinVariableScanner scanner(context);
+
+ // Find main() in the program and check its return type.
+ for (auto& e : program.fOwnedElements) {
+ scanner.visitProgramElement(*e);
+ }
+
+ if (ProgramConfig::IsFragment(program.fConfig->fKind)) {
+ // Vulkan requires certain builtin variables be present, even if they're unused. At one
+ // time, validation errors would result if sk_Clockwise was missing. Now, it's just (Adreno)
+ // driver bugs that drop or corrupt draws if they're missing.
+ scanner.addDeclaringElement("sk_Clockwise");
+ }
+
+ // Scan all the variables used by the program and declare any built-ins.
+ for (const auto& [var, counts] : program.fUsage->fVariableCounts) {
+ if (var->isBuiltin()) {
+ scanner.addDeclaringElement(std::string(var->name()));
+
+ // Set the FlipRT program input if we find sk_FragCoord or sk_Clockwise.
+ switch (var->modifiers().fLayout.fBuiltin) {
+ case SK_FRAGCOORD_BUILTIN:
+ if (context.fCaps.fCanUseFragCoord) {
+ program.fInputs.fUseFlipRTUniform =
+ !context.fConfig->fSettings.fForceNoRTFlip;
+ }
+ break;
+
+ case SK_CLOCKWISE_BUILTIN:
+ program.fInputs.fUseFlipRTUniform = !context.fConfig->fSettings.fForceNoRTFlip;
+ break;
+ }
+ }
+ }
+
+ // Sort the referenced builtin functions into a consistent order; otherwise our output will
+ // become non-deterministic. The exact order isn't particularly important.
+ scanner.sortNewElements();
+
+ // Add all the newly-declared elements to the program, and update ProgramUsage to match.
+ program.fSharedElements.insert(program.fSharedElements.begin(),
+ scanner.fNewElements.begin(),
+ scanner.fNewElements.end());
+
+ for (const ProgramElement* element : scanner.fNewElements) {
+ program.fUsage->add(*element);
+ }
+}
+
+} // namespace Transform
+} // namespace SkSL
diff --git a/chromium/third_party/skia/src/sksl/transform/SkSLTransform.h b/chromium/third_party/skia/src/sksl/transform/SkSLTransform.h
index 2bc0e67f6c7..be2caa565d3 100644
--- a/chromium/third_party/skia/src/sksl/transform/SkSLTransform.h
+++ b/chromium/third_party/skia/src/sksl/transform/SkSLTransform.h
@@ -15,28 +15,46 @@
namespace SkSL {
class Context;
+class Expression;
struct LoadedModule;
+struct Modifiers;
struct Program;
class ProgramElement;
class ProgramUsage;
class Statement;
+class Variable;
enum class ProgramKind : int8_t;
namespace Transform {
/**
+ * Checks to see if it would be safe to add `const` to the modifiers of a variable. If so, returns
+ * the modifiers with `const` applied; if not, returns the existing modifiers as-is. Adding `const`
+ * allows the inliner to fold away more values and generate tighter code.
+ */
+const Modifiers* AddConstToVarModifiers(const Context& context,
+ const Variable& var,
+ const Expression* initialValue,
+ const ProgramUsage* usage);
+
+/**
+ * Copies built-in functions from modules into the program. Relies on ProgramUsage to determine
+ * which functions are necessary.
+ */
+void FindAndDeclareBuiltinFunctions(Program& program);
+
+/**
* Scans the finished program for built-in variables like `sk_FragColor` and adds them to the
* program's shared elements.
*/
-void FindAndDeclareBuiltinVariables(const Context& context, ProgramKind programKind,
- std::vector<const ProgramElement*>& sharedElements);
+void FindAndDeclareBuiltinVariables(Program& program);
/**
* Eliminates statements in a block which cannot be reached; for example, a statement
* immediately after a `return` or `continue` can safely be eliminated.
*/
void EliminateUnreachableCode(LoadedModule& module, ProgramUsage* usage);
-void EliminateUnreachableCode(Program& program, ProgramUsage* usage);
+void EliminateUnreachableCode(Program& program);
/**
* Eliminates empty statements in a module (Nops, or blocks holding only Nops). Not implemented for
@@ -47,15 +65,15 @@ void EliminateEmptyStatements(LoadedModule& module);
/**
* Eliminates functions in a program which are never called. Returns true if any changes were made.
*/
-bool EliminateDeadFunctions(Program& program, ProgramUsage* usage);
+bool EliminateDeadFunctions(Program& program);
/**
* Eliminates variables in a program which are never read or written (past their initializer).
* Preserves side effects from initializers, if any. Returns true if any changes were made.
*/
bool EliminateDeadLocalVariables(const Context& context, LoadedModule& module, ProgramUsage* usage);
-bool EliminateDeadLocalVariables(Program& program, ProgramUsage* usage);
-bool EliminateDeadGlobalVariables(Program& program, ProgramUsage* usage);
+bool EliminateDeadLocalVariables(Program& program);
+bool EliminateDeadGlobalVariables(Program& program);
} // namespace Transform
} // namespace SkSL
diff --git a/chromium/third_party/skia/src/svg/BUILD.bazel b/chromium/third_party/skia/src/svg/BUILD.bazel
new file mode 100644
index 00000000000..9dbde614b24
--- /dev/null
+++ b/chromium/third_party/skia/src/svg/BUILD.bazel
@@ -0,0 +1,27 @@
+load("//bazel:macros.bzl", "bool_flag", "exports_files_legacy")
+
+licenses(["notice"])
+
+exports_files_legacy()
+
+bool_flag(
+ default = False,
+ flag_name = "enable_svg_canvas",
+)
+
+filegroup(
+ name = "srcs",
+ srcs = [
+ "SkSVGCanvas.cpp",
+ "SkSVGDevice.cpp",
+ ],
+ visibility = ["//src:__pkg__"],
+)
+
+filegroup(
+ name = "private_hdrs",
+ srcs = [
+ "SkSVGDevice.h",
+ ],
+ visibility = ["//src:__pkg__"],
+)
diff --git a/chromium/third_party/skia/src/svg/SkSVGDevice.cpp b/chromium/third_party/skia/src/svg/SkSVGDevice.cpp
index 32ce3a771c0..dcb51de458e 100644
--- a/chromium/third_party/skia/src/svg/SkSVGDevice.cpp
+++ b/chromium/third_party/skia/src/svg/SkSVGDevice.cpp
@@ -48,14 +48,14 @@
#include "src/core/SkClipStack.h"
#include "src/core/SkDevice.h"
#include "src/core/SkFontPriv.h"
-#include "src/core/SkGlyphRun.h"
#include "src/core/SkTLazy.h"
#include "src/image/SkImage_Base.h"
#include "src/shaders/SkShaderBase.h"
+#include "src/text/GlyphRun.h"
#include "src/xml/SkXMLWriter.h"
-#include <string>
#include <memory>
+#include <string>
#include <utility>
#if SK_SUPPORT_GPU
@@ -130,10 +130,10 @@ static const char* cap_map[] = {
"round", // kRound_Cap
"square" // kSquare_Cap
};
-static_assert(SK_ARRAY_COUNT(cap_map) == SkPaint::kCapCount, "missing_cap_map_entry");
+static_assert(std::size(cap_map) == SkPaint::kCapCount, "missing_cap_map_entry");
static const char* svg_cap(SkPaint::Cap cap) {
- SkASSERT(cap < SK_ARRAY_COUNT(cap_map));
+ SkASSERT(static_cast<size_t>(cap) < std::size(cap_map));
return cap_map[cap];
}
@@ -143,10 +143,10 @@ static const char* join_map[] = {
"round", // kRound_Join
"bevel" // kBevel_Join
};
-static_assert(SK_ARRAY_COUNT(join_map) == SkPaint::kJoinCount, "missing_join_map_entry");
+static_assert(std::size(join_map) == SkPaint::kJoinCount, "missing_join_map_entry");
static const char* svg_join(SkPaint::Join join) {
- SkASSERT(join < SK_ARRAY_COUNT(join_map));
+ SkASSERT(join < std::size(join_map));
return join_map[join];
}
@@ -208,7 +208,7 @@ bool RequiresViewportReset(const SkPaint& paint) {
return false;
}
-void AddPath(const SkGlyphRun& glyphRun, const SkPoint& offset, SkPath* path) {
+void AddPath(const sktext::GlyphRun& glyphRun, const SkPoint& offset, SkPath* path) {
struct Rec {
SkPath* fPath;
const SkPoint fOffset;
@@ -1017,7 +1017,7 @@ void SkSVGDevice::drawImageRect(const SkImage* image, const SkRect* src, const S
class SVGTextBuilder : SkNoncopyable {
public:
- SVGTextBuilder(SkPoint origin, const SkGlyphRun& glyphRun)
+ SVGTextBuilder(SkPoint origin, const sktext::GlyphRun& glyphRun)
: fOrigin(origin) {
auto runSize = glyphRun.runSize();
SkAutoSTArray<64, SkUnichar> unichars(runSize);
@@ -1105,7 +1105,7 @@ private:
};
void SkSVGDevice::onDrawGlyphRunList(SkCanvas* canvas,
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
const SkPaint& initialPaint,
const SkPaint& drawingPaint) {
SkASSERT(!glyphRunList.hasRSXForm());
diff --git a/chromium/third_party/skia/src/svg/SkSVGDevice.h b/chromium/third_party/skia/src/svg/SkSVGDevice.h
index 7f111588900..8705ad50666 100644
--- a/chromium/third_party/skia/src/svg/SkSVGDevice.h
+++ b/chromium/third_party/skia/src/svg/SkSVGDevice.h
@@ -15,14 +15,19 @@
#include "include/utils/SkParsePath.h"
#include "src/core/SkClipStackDevice.h"
+#include <cstddef>
+#include <cstdint>
#include <memory>
+namespace sktext {
+class GlyphRunList;
+}
+
class SkBaseDevice;
class SkBitmap;
class SkBlender;
class SkClipStack;
class SkData;
-class SkGlyphRunList;
class SkImage;
class SkPaint;
class SkPath;
@@ -58,7 +63,7 @@ protected:
bool pathIsMutable = false) override;
void onDrawGlyphRunList(SkCanvas*,
- const SkGlyphRunList&,
+ const sktext::GlyphRunList&,
const SkPaint& initialPaint,
const SkPaint& drawingPaint) override;
void drawVertices(const SkVertices*, sk_sp<SkBlender>, const SkPaint&, bool) override;
diff --git a/chromium/third_party/skia/src/text/BUILD.bazel b/chromium/third_party/skia/src/text/BUILD.bazel
new file mode 100644
index 00000000000..8463fcaf36d
--- /dev/null
+++ b/chromium/third_party/skia/src/text/BUILD.bazel
@@ -0,0 +1,29 @@
+load("//bazel:macros.bzl", "exports_files_legacy", "split_srcs_and_hdrs")
+
+licenses(["notice"])
+
+exports_files_legacy()
+
+TEXT_FILES = [
+ "GlyphRun.cpp",
+ "GlyphRun.h",
+ "StrikeForGPU.cpp",
+ "StrikeForGPU.h",
+]
+
+split_srcs_and_hdrs(
+ name = "text",
+ files = TEXT_FILES,
+)
+
+filegroup(
+ name = "srcs",
+ srcs = [":text_srcs"],
+ visibility = ["//src:__pkg__"],
+)
+
+filegroup(
+ name = "private_hdrs",
+ srcs = [":text_hdrs"],
+ visibility = ["//src:__pkg__"],
+)
diff --git a/chromium/third_party/skia/src/core/SkGlyphRun.cpp b/chromium/third_party/skia/src/text/GlyphRun.cpp
index 655f4e373fa..d230fddb797 100644
--- a/chromium/third_party/skia/src/core/SkGlyphRun.cpp
+++ b/chromium/third_party/skia/src/text/GlyphRun.cpp
@@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
-#include "src/core/SkGlyphRun.h"
+#include "src/text/GlyphRun.h"
#include "include/core/SkFont.h"
#include "include/core/SkPaint.h"
@@ -19,26 +19,27 @@
#include "src/core/SkTextBlobPriv.h"
#include "src/core/SkUtils.h"
-// -- SkGlyphRun -----------------------------------------------------------------------------------
-SkGlyphRun::SkGlyphRun(const SkFont& font,
- SkSpan<const SkPoint> positions,
- SkSpan<const SkGlyphID> glyphIDs,
- SkSpan<const char> text,
- SkSpan<const uint32_t> clusters,
- SkSpan<const SkVector> scaledRotations)
+namespace sktext {
+// -- GlyphRun -------------------------------------------------------------------------------------
+GlyphRun::GlyphRun(const SkFont& font,
+ SkSpan<const SkPoint> positions,
+ SkSpan<const SkGlyphID> glyphIDs,
+ SkSpan<const char> text,
+ SkSpan<const uint32_t> clusters,
+ SkSpan<const SkVector> scaledRotations)
: fSource{SkMakeZip(glyphIDs, positions)}
, fText{text}
, fClusters{clusters}
, fScaledRotations{scaledRotations}
, fFont{font} {}
-SkGlyphRun::SkGlyphRun(const SkGlyphRun& that, const SkFont& font)
+GlyphRun::GlyphRun(const GlyphRun& that, const SkFont& font)
: fSource{that.fSource}
, fText{that.fText}
, fClusters{that.fClusters}
, fFont{font} {}
-SkRect SkGlyphRun::sourceBounds(const SkPaint& paint) const {
+SkRect GlyphRun::sourceBounds(const SkPaint& paint) const {
SkASSERT(this->runSize() > 0);
const SkRect fontBounds = SkFontPriv::GetFontBounds(fFont);
@@ -102,35 +103,34 @@ SkRect SkGlyphRun::sourceBounds(const SkPaint& paint) const {
}
}
-// -- SkGlyphRunList -------------------------------------------------------------------------------
-SkGlyphRunList::SkGlyphRunList(
- const SkTextBlob* blob,
- SkRect bounds,
- SkPoint origin,
- SkSpan<const SkGlyphRun> glyphRunList,
- SkGlyphRunBuilder* builder)
+// -- GlyphRunList ---------------------------------------------------------------------------------
+GlyphRunList::GlyphRunList(const SkTextBlob* blob,
+ SkRect bounds,
+ SkPoint origin,
+ SkSpan<const GlyphRun> glyphRunList,
+ GlyphRunBuilder* builder)
: fGlyphRuns{glyphRunList}
, fOriginalTextBlob{blob}
, fSourceBounds{bounds}
, fOrigin{origin}
, fBuilder{builder} {}
-SkGlyphRunList::SkGlyphRunList(const SkGlyphRun& glyphRun,
- const SkRect& bounds,
- SkPoint origin,
- SkGlyphRunBuilder* builder)
- : fGlyphRuns{SkSpan<const SkGlyphRun>{&glyphRun, 1}}
+GlyphRunList::GlyphRunList(const GlyphRun& glyphRun,
+ const SkRect& bounds,
+ SkPoint origin,
+ GlyphRunBuilder* builder)
+ : fGlyphRuns{SkSpan<const GlyphRun>{&glyphRun, 1}}
, fOriginalTextBlob{nullptr}
, fSourceBounds{bounds}
, fOrigin{origin}
, fBuilder{builder} {}
-uint64_t SkGlyphRunList::uniqueID() const {
+uint64_t GlyphRunList::uniqueID() const {
return fOriginalTextBlob != nullptr ? fOriginalTextBlob->uniqueID()
: SK_InvalidUniqueID;
}
-bool SkGlyphRunList::anyRunsLCD() const {
+bool GlyphRunList::anyRunsLCD() const {
for (const auto& r : fGlyphRuns) {
if (r.font().getEdging() == SkFont::Edging::kSubpixelAntiAlias) {
return true;
@@ -139,12 +139,12 @@ bool SkGlyphRunList::anyRunsLCD() const {
return false;
}
-void SkGlyphRunList::temporaryShuntBlobNotifyAddedToCache(uint32_t cacheID) const {
+void GlyphRunList::temporaryShuntBlobNotifyAddedToCache(uint32_t cacheID) const {
SkASSERT(fOriginalTextBlob != nullptr);
fOriginalTextBlob->notifyAddedToCache(cacheID);
}
-sk_sp<SkTextBlob> SkGlyphRunList::makeBlob() const {
+sk_sp<SkTextBlob> GlyphRunList::makeBlob() const {
SkTextBlobBuilder builder;
for (auto& run : *this) {
SkTextBlobBuilder::RunBuffer buffer;
@@ -174,10 +174,10 @@ sk_sp<SkTextBlob> SkGlyphRunList::makeBlob() const {
return builder.make();
}
-// -- SkGlyphRunBuilder ----------------------------------------------------------------------------
-SkGlyphRunList SkGlyphRunBuilder::makeGlyphRunList(
- const SkGlyphRun& run, SkRect bounds, SkPoint origin) {
- return SkGlyphRunList{run, bounds, origin, this};
+// -- GlyphRunBuilder ------------------------------------------------------------------------------
+GlyphRunList GlyphRunBuilder::makeGlyphRunList(
+ const GlyphRun& run, SkRect bounds, SkPoint origin) {
+ return GlyphRunList{run, bounds, origin, this};
}
static SkSpan<const SkPoint> draw_text_positions(
@@ -192,10 +192,10 @@ static SkSpan<const SkPoint> draw_text_positions(
*positionCursor++ = endOfLastGlyph;
endOfLastGlyph += glyph->advanceVector();
}
- return SkMakeSpan(buffer, glyphIDs.size());
+ return SkSpan(buffer, glyphIDs.size());
}
-const SkGlyphRunList& SkGlyphRunBuilder::textToGlyphRunList(
+const GlyphRunList& GlyphRunBuilder::textToGlyphRunList(
const SkFont& font, const SkPaint& paint,
const void* bytes, size_t byteLength, SkPoint origin,
SkTextEncoding encoding) {
@@ -216,7 +216,7 @@ const SkGlyphRunList& SkGlyphRunBuilder::textToGlyphRunList(
return this->setGlyphRunList(nullptr, bounds.makeOffset(origin), origin);
}
-const SkGlyphRunList& SkGlyphRunBuilder::blobToGlyphRunList(
+const GlyphRunList& sktext::GlyphRunBuilder::blobToGlyphRunList(
const SkTextBlob& blob, SkPoint origin) {
// Pre-size all the buffers, so they don't move during processing.
this->initialize(blob);
@@ -242,20 +242,20 @@ const SkGlyphRunList& SkGlyphRunBuilder::blobToGlyphRunList(
break;
}
case SkTextBlobRunIterator::kHorizontal_Positioning: {
- positions = SkMakeSpan(positionCursor, runSize);
+ positions = SkSpan(positionCursor, runSize);
for (auto x : SkSpan<const SkScalar>{it.pos(), glyphIDs.size()}) {
*positionCursor++ = SkPoint::Make(x, it.offset().y());
}
break;
}
case SkTextBlobRunIterator::kFull_Positioning: {
- positions = SkMakeSpan(it.points(), runSize);
+ positions = SkSpan(it.points(), runSize);
break;
}
case SkTextBlobRunIterator::kRSXform_Positioning: {
- positions = SkMakeSpan(positionCursor, runSize);
- scaledRotations = SkMakeSpan(scaledRotationsCursor, runSize);
- for (const SkRSXform& xform : SkMakeSpan(it.xforms(), runSize)) {
+ positions = SkSpan(positionCursor, runSize);
+ scaledRotations = SkSpan(scaledRotationsCursor, runSize);
+ for (const SkRSXform& xform : SkSpan(it.xforms(), runSize)) {
*positionCursor++ = {xform.fTx, xform.fTy};
*scaledRotationsCursor++ = {xform.fSCos, xform.fSSin};
}
@@ -263,12 +263,13 @@ const SkGlyphRunList& SkGlyphRunBuilder::blobToGlyphRunList(
}
}
+ const uint32_t* clusters = it.clusters();
this->makeGlyphRun(
font,
glyphIDs,
positions,
SkSpan<const char>(it.text(), it.textSize()),
- SkSpan<const uint32_t>(it.clusters(), runSize),
+ SkSpan<const uint32_t>(clusters, clusters ? runSize : 0),
scaledRotations);
}
@@ -276,11 +277,11 @@ const SkGlyphRunList& SkGlyphRunBuilder::blobToGlyphRunList(
}
std::tuple<SkSpan<const SkPoint>, SkSpan<const SkVector>>
-SkGlyphRunBuilder::convertRSXForm(SkSpan<const SkRSXform> xforms) {
+GlyphRunBuilder::convertRSXForm(SkSpan<const SkRSXform> xforms) {
const int count = SkCount(xforms);
this->prepareBuffers(count, count);
- auto positions = SkMakeSpan(fPositions.get(), count);
- auto scaledRotations = SkMakeSpan(fScaledRotations.get(), count);
+ auto positions = SkSpan(fPositions.get(), count);
+ auto scaledRotations = SkSpan(fScaledRotations.get(), count);
for (auto [pos, sr, xform] : SkMakeZip(positions, scaledRotations, xforms)) {
auto [scos, ssin, tx, ty] = xform;
pos = {tx, ty};
@@ -289,7 +290,7 @@ SkGlyphRunBuilder::convertRSXForm(SkSpan<const SkRSXform> xforms) {
return {positions, scaledRotations};
}
-void SkGlyphRunBuilder::initialize(const SkTextBlob& blob) {
+void GlyphRunBuilder::initialize(const SkTextBlob& blob) {
int positionCount = 0;
int rsxFormCount = 0;
for (SkTextBlobRunIterator it(&blob); !it.done(); it.next()) {
@@ -304,7 +305,7 @@ void SkGlyphRunBuilder::initialize(const SkTextBlob& blob) {
prepareBuffers(positionCount, rsxFormCount);
}
-void SkGlyphRunBuilder::prepareBuffers(int positionCount, int RSXFormCount) {
+void GlyphRunBuilder::prepareBuffers(int positionCount, int RSXFormCount) {
if (positionCount > fMaxTotalRunSize) {
fMaxTotalRunSize = positionCount;
fPositions.reset(fMaxTotalRunSize);
@@ -318,14 +319,14 @@ void SkGlyphRunBuilder::prepareBuffers(int positionCount, int RSXFormCount) {
fGlyphRunListStorage.clear();
}
-SkSpan<const SkGlyphID> SkGlyphRunBuilder::textToGlyphIDs(
+SkSpan<const SkGlyphID> GlyphRunBuilder::textToGlyphIDs(
const SkFont& font, const void* bytes, size_t byteLength, SkTextEncoding encoding) {
if (encoding != SkTextEncoding::kGlyphID) {
int count = font.countText(bytes, byteLength, encoding);
if (count > 0) {
fScratchGlyphIDs.resize(count);
font.textToGlyphs(bytes, byteLength, encoding, fScratchGlyphIDs.data(), count);
- return SkMakeSpan(fScratchGlyphIDs);
+ return SkSpan(fScratchGlyphIDs);
} else {
return SkSpan<const SkGlyphID>();
}
@@ -334,7 +335,7 @@ SkSpan<const SkGlyphID> SkGlyphRunBuilder::textToGlyphIDs(
}
}
-void SkGlyphRunBuilder::makeGlyphRun(
+void GlyphRunBuilder::makeGlyphRun(
const SkFont& font,
SkSpan<const SkGlyphID> glyphIDs,
SkSpan<const SkPoint> positions,
@@ -354,8 +355,28 @@ void SkGlyphRunBuilder::makeGlyphRun(
}
}
-const SkGlyphRunList& SkGlyphRunBuilder::setGlyphRunList(
+const GlyphRunList& sktext::GlyphRunBuilder::setGlyphRunList(
const SkTextBlob* blob, const SkRect& bounds, SkPoint origin) {
- fGlyphRunList.emplace(blob, bounds, origin, SkMakeSpan(fGlyphRunListStorage), this);
+ fGlyphRunList.emplace(blob, bounds, origin, SkSpan(fGlyphRunListStorage), this);
return fGlyphRunList.value();
}
+
+// -- SKSubRunBuffers ------------------------------------------------------------------------------
+auto SkSubRunBuffers::EnsureBuffers(const GlyphRunList& glyphRunList) -> ScopedBuffers {
+ size_t size = 0;
+ for (const GlyphRun& run : glyphRunList) {
+ size = std::max(run.runSize(), size);
+ }
+ return ScopedBuffers(glyphRunList.buffers(), size);
+}
+
+SkSubRunBuffers::ScopedBuffers::ScopedBuffers(SkSubRunBuffers* buffers, size_t size)
+ : fBuffers{buffers} {
+ fBuffers->fAccepted.ensureSize(size);
+}
+
+SkSubRunBuffers::ScopedBuffers::~ScopedBuffers() {
+ fBuffers->fAccepted.reset();
+ fBuffers->fRejected.reset();
+}
+} // namespace sktext
diff --git a/chromium/third_party/skia/src/core/SkGlyphRun.h b/chromium/third_party/skia/src/text/GlyphRun.h
index abab7edbea0..c12a7b6ab1d 100644
--- a/chromium/third_party/skia/src/core/SkGlyphRun.h
+++ b/chromium/third_party/skia/src/text/GlyphRun.h
@@ -25,11 +25,13 @@
class SkBaseDevice;
class SkCanvas;
class SkGlyph;
-class SkGlyphRunList;
-class SkGlyphRunBuilder;
class SkTextBlob;
class SkTextBlobRunIterator;
+namespace sktext {
+class GlyphRunBuilder;
+class GlyphRunList;
+
class SkSubRunBuffers {
public:
class ScopedBuffers {
@@ -43,23 +45,23 @@ public:
private:
SkSubRunBuffers* const fBuffers;
};
- static ScopedBuffers SK_WARN_UNUSED_RESULT EnsureBuffers(const SkGlyphRunList& glyphRunList);
+ static ScopedBuffers SK_WARN_UNUSED_RESULT EnsureBuffers(const GlyphRunList& glyphRunList);
private:
SkDrawableGlyphBuffer fAccepted;
SkSourceGlyphBuffer fRejected;
};
-class SkGlyphRun {
+class GlyphRun {
public:
- SkGlyphRun(const SkFont& font,
- SkSpan<const SkPoint> positions,
- SkSpan<const SkGlyphID> glyphIDs,
- SkSpan<const char> text,
- SkSpan<const uint32_t> clusters,
- SkSpan<const SkVector> scaledRotations);
+ GlyphRun(const SkFont& font,
+ SkSpan<const SkPoint> positions,
+ SkSpan<const SkGlyphID> glyphIDs,
+ SkSpan<const char> text,
+ SkSpan<const uint32_t> clusters,
+ SkSpan<const SkVector> scaledRotations);
- SkGlyphRun(const SkGlyphRun& glyphRun, const SkFont& font);
+ GlyphRun(const GlyphRun& glyphRun, const SkFont& font);
size_t runSize() const { return fSource.size(); }
SkSpan<const SkPoint> positions() const { return fSource.get<1>(); }
@@ -84,22 +86,21 @@ private:
SkFont fFont;
};
-class SkGlyphRunList {
- SkSpan<const SkGlyphRun> fGlyphRuns;
+class GlyphRunList {
+ SkSpan<const GlyphRun> fGlyphRuns;
public:
// Blob maybe null.
- SkGlyphRunList(
- const SkTextBlob* blob,
- SkRect bounds,
- SkPoint origin,
- SkSpan<const SkGlyphRun> glyphRunList,
- SkGlyphRunBuilder* builder);
-
- SkGlyphRunList(const SkGlyphRun& glyphRun,
- const SkRect& bounds,
- SkPoint origin,
- SkGlyphRunBuilder* builder);
+ GlyphRunList(const SkTextBlob* blob,
+ SkRect bounds,
+ SkPoint origin,
+ SkSpan<const GlyphRun> glyphRunList,
+ GlyphRunBuilder* builder);
+
+ GlyphRunList(const GlyphRun& glyphRun,
+ const SkRect& bounds,
+ SkPoint origin,
+ GlyphRunBuilder* builder);
uint64_t uniqueID() const;
bool anyRunsLCD() const;
void temporaryShuntBlobNotifyAddedToCache(uint32_t cacheID) const;
@@ -108,14 +109,14 @@ public:
size_t runCount() const { return fGlyphRuns.size(); }
size_t totalGlyphCount() const {
size_t glyphCount = 0;
- for (const SkGlyphRun& run : *this) {
+ for (const GlyphRun& run : *this) {
glyphCount += run.runSize();
}
return glyphCount;
}
bool hasRSXForm() const {
- for (const SkGlyphRun& run : *this) {
+ for (const GlyphRun& run : *this) {
if (!run.scaledRotations().empty()) { return true; }
}
return false;
@@ -126,7 +127,7 @@ public:
SkPoint origin() const { return fOrigin; }
SkRect sourceBounds() const { return fSourceBounds; }
const SkTextBlob* blob() const { return fOriginalTextBlob; }
- SkGlyphRunBuilder* builder() const { return fBuilder; }
+ GlyphRunBuilder* builder() const { return fBuilder; }
SkSubRunBuffers* buffers() const;
auto begin() -> decltype(fGlyphRuns.begin()) { return fGlyphRuns.begin(); }
@@ -143,20 +144,20 @@ private:
const SkTextBlob* fOriginalTextBlob{nullptr};
const SkRect fSourceBounds{SkRect::MakeEmpty()};
const SkPoint fOrigin = {0, 0};
- SkGlyphRunBuilder* const fBuilder;
+ GlyphRunBuilder* const fBuilder;
};
-class SkGlyphRunBuilder {
+class GlyphRunBuilder {
public:
- SkGlyphRunList makeGlyphRunList(
- const SkGlyphRun& run, SkRect bounds, SkPoint origin);
- const SkGlyphRunList& textToGlyphRunList(const SkFont& font,
- const SkPaint& paint,
- const void* bytes,
- size_t byteLength,
- SkPoint origin,
- SkTextEncoding encoding = SkTextEncoding::kUTF8);
- const SkGlyphRunList& blobToGlyphRunList(const SkTextBlob& blob, SkPoint origin);
+ GlyphRunList makeGlyphRunList(
+ const GlyphRun& run, SkRect bounds, SkPoint origin);
+ const GlyphRunList& textToGlyphRunList(const SkFont& font,
+ const SkPaint& paint,
+ const void* bytes,
+ size_t byteLength,
+ SkPoint origin,
+ SkTextEncoding encoding = SkTextEncoding::kUTF8);
+ const GlyphRunList& blobToGlyphRunList(const SkTextBlob& blob, SkPoint origin);
std::tuple<SkSpan<const SkPoint>, SkSpan<const SkVector>>
convertRSXForm(SkSpan<const SkRSXform> xforms);
@@ -178,7 +179,7 @@ private:
SkSpan<const uint32_t> clusters,
SkSpan<const SkVector> scaledRotations);
- const SkGlyphRunList& setGlyphRunList(
+ const GlyphRunList& setGlyphRunList(
const SkTextBlob* blob, const SkRect& bounds, SkPoint origin);
int fMaxTotalRunSize{0};
@@ -186,8 +187,8 @@ private:
int fMaxScaledRotations{0};
SkAutoTMalloc<SkVector> fScaledRotations;
- std::vector<SkGlyphRun> fGlyphRunListStorage;
- std::optional<SkGlyphRunList> fGlyphRunList; // Defaults to no value;
+ std::vector<GlyphRun> fGlyphRunListStorage;
+ std::optional<GlyphRunList> fGlyphRunList; // Defaults to no value;
// Used as a temporary for preparing using utfN text. This implies that only one run of
// glyph ids will ever be needed because blobs are already glyph based.
@@ -195,7 +196,7 @@ private:
SkSubRunBuffers fSubRunBuffers;
};
-
-inline SkSubRunBuffers* SkGlyphRunList::buffers() const { return fBuilder->buffers(); }
+inline SkSubRunBuffers* GlyphRunList::buffers() const { return fBuilder->buffers(); }
+} // namespace sktext
#endif // SkGlyphRun_DEFINED
diff --git a/chromium/third_party/skia/src/text/StrikeForGPU.cpp b/chromium/third_party/skia/src/text/StrikeForGPU.cpp
new file mode 100644
index 00000000000..b5a43c470c7
--- /dev/null
+++ b/chromium/third_party/skia/src/text/StrikeForGPU.cpp
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "src/text/StrikeForGPU.h"
+
+#include <memory>
+#include <utility>
+
+#include "include/private/chromium/SkChromeRemoteGlyphCache.h"
+#include "src/core/SkDescriptor.h"
+#include "src/core/SkReadBuffer.h"
+#include "src/core/SkStrikeCache.h"
+#include "src/core/SkWriteBuffer.h"
+
+namespace sktext {
+// -- SkStrikePromise ------------------------------------------------------------------------------
+SkStrikePromise::SkStrikePromise(sktext::SkStrikePromise&&) = default;
+SkStrikePromise& SkStrikePromise::operator=(sktext::SkStrikePromise&&) = default;
+SkStrikePromise::SkStrikePromise(sk_sp<SkStrike>&& strike)
+ : fStrikeOrSpec{std::move(strike)} {}
+SkStrikePromise::SkStrikePromise(const SkStrikeSpec& spec)
+ : fStrikeOrSpec{std::make_unique<SkStrikeSpec>(spec)} {}
+
+SkStrike* SkStrikePromise::strike() {
+ if (std::holds_alternative<std::unique_ptr<SkStrikeSpec>>(fStrikeOrSpec)) {
+ // Turn the strike spec into a strike.
+ std::unique_ptr<SkStrikeSpec> spec =
+ std::exchange(std::get<std::unique_ptr<SkStrikeSpec>>(fStrikeOrSpec), nullptr);
+
+ fStrikeOrSpec = SkStrikeCache::GlobalStrikeCache()->findOrCreateStrike(*spec);
+ }
+ return std::get<sk_sp<SkStrike>>(fStrikeOrSpec).get();
+}
+
+void SkStrikePromise::resetStrike() {
+ fStrikeOrSpec = sk_sp<SkStrike>();
+}
+
+const SkDescriptor& SkStrikePromise::descriptor() const {
+ if (std::holds_alternative<std::unique_ptr<SkStrikeSpec>>(fStrikeOrSpec)) {
+ return std::get<std::unique_ptr<SkStrikeSpec>>(fStrikeOrSpec)->descriptor();
+ }
+
+ return std::get<sk_sp<SkStrike>>(fStrikeOrSpec)->getDescriptor();
+}
+
+void SkStrikePromise::flatten(SkWriteBuffer& buffer) const {
+ this->descriptor().flatten(buffer);
+}
+
+std::optional<SkStrikePromise> SkStrikePromise::MakeFromBuffer(
+ SkReadBuffer& buffer, const SkStrikeClient* client, SkStrikeCache* strikeCache) {
+ std::optional<SkAutoDescriptor> descriptor = SkAutoDescriptor::MakeFromBuffer(buffer);
+ if (!buffer.validate(descriptor.has_value())) {
+ return std::nullopt;
+ }
+
+ // If there is a client, then this from a different process. Translate the SkTypefaceID from
+ // the strike server (Renderer) process to strike client (GPU) process.
+ if (client != nullptr) {
+ if (!client->translateTypefaceID(&descriptor.value())) {
+ return std::nullopt;
+ }
+ }
+
+ sk_sp<SkStrike> strike = strikeCache->findStrike(*descriptor->getDesc());
+ SkASSERT(strike != nullptr);
+ if (!buffer.validate(strike != nullptr)) {
+ return std::nullopt;
+ }
+
+ return SkStrikePromise{std::move(strike)};
+}
+} // namespace sktext
diff --git a/chromium/third_party/skia/src/text/StrikeForGPU.h b/chromium/third_party/skia/src/text/StrikeForGPU.h
new file mode 100644
index 00000000000..b7a7439b606
--- /dev/null
+++ b/chromium/third_party/skia/src/text/StrikeForGPU.h
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2019 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef sktext_StrikeForGPU_DEFINED
+#define sktext_StrikeForGPU_DEFINED
+
+#include "include/core/SkImageInfo.h"
+#include "include/core/SkPoint.h"
+#include "include/core/SkSpan.h"
+#include "include/core/SkTypes.h"
+#include "src/core/SkGlyph.h"
+
+#include <memory>
+#include <optional>
+#include <variant>
+
+class SkDescriptor;
+class SkDrawableGlyphBuffer;
+class SkReadBuffer;
+class SkSourceGlyphBuffer;
+class SkStrike;
+class SkStrikeCache;
+class SkStrikeClient;
+class SkStrikeSpec;
+class SkWriteBuffer;
+struct SkGlyphPositionRoundingSpec;
+struct SkScalerContextEffects;
+
+namespace sktext {
+// -- SkStrikePromise ------------------------------------------------------------------------------
+// SkStrikePromise produces an SkStrike when needed by GPU glyph rendering. In ordinary
+// operation, it just wraps an SkStrike. When used for remote glyph cache operation, the promise is
+// serialized to an SkDescriptor. When SkStrikePromise is deserialized, it uses the descriptor to
+// look up the SkStrike.
+//
+// When deserializing some care must be taken; if the needed SkStrike is removed from the cache,
+// then looking up using the descriptor will fail resulting in a deserialization failure. The
+// Renderer/GPU system solves this problem by pinning all the strikes needed into the cache.
+class SkStrikePromise {
+public:
+ SkStrikePromise() = delete;
+ SkStrikePromise(const SkStrikePromise&) = delete;
+ SkStrikePromise& operator=(const SkStrikePromise&) = delete;
+ SkStrikePromise(SkStrikePromise&&);
+ SkStrikePromise& operator=(SkStrikePromise&&);
+
+ explicit SkStrikePromise(sk_sp<SkStrike>&& strike);
+ explicit SkStrikePromise(const SkStrikeSpec& spec);
+
+ static std::optional<SkStrikePromise> MakeFromBuffer(SkReadBuffer& buffer,
+ const SkStrikeClient* client,
+ SkStrikeCache* strikeCache);
+ void flatten(SkWriteBuffer& buffer) const;
+
+ // Do what is needed to return a strike.
+ SkStrike* strike();
+
+ // Reset the sk_sp<SkStrike> to nullptr.
+ void resetStrike();
+
+ // Return a descriptor used to look up the SkStrike.
+ const SkDescriptor& descriptor() const;
+
+private:
+ std::variant<sk_sp<SkStrike>, std::unique_ptr<SkStrikeSpec>> fStrikeOrSpec;
+};
+
+// -- StrikeForGPU ---------------------------------------------------------------------------------
+class StrikeForGPU {
+public:
+ virtual ~StrikeForGPU() = default;
+ virtual const SkDescriptor& getDescriptor() const = 0;
+
+ // Returns the bounding rectangle of the accepted glyphs. Remember for device masks this
+ // rectangle will be in device space, and for transformed masks this rectangle will be in
+ // source space.
+ virtual SkRect prepareForMaskDrawing(
+ SkScalar strikeToSourceScale,
+ SkDrawableGlyphBuffer* accepted,
+ SkSourceGlyphBuffer* rejected) = 0;
+
+ virtual SkRect prepareForSDFTDrawing(
+ SkScalar strikeToSourceScale,
+ SkDrawableGlyphBuffer* accepted,
+ SkSourceGlyphBuffer* rejected) = 0;
+
+ virtual void prepareForPathDrawing(
+ SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected) = 0;
+
+ virtual void prepareForDrawableDrawing(
+ SkDrawableGlyphBuffer* accepted, SkSourceGlyphBuffer* rejected) = 0;
+
+ virtual const SkGlyphPositionRoundingSpec& roundingSpec() const = 0;
+
+ // Used with SkScopedStrikeForGPU to take action at the end of a scope.
+ virtual void onAboutToExitScope() = 0;
+
+ // Return underlying SkStrike for building SubRuns while processing glyph runs.
+ virtual sk_sp<SkStrike> getUnderlyingStrike() const = 0;
+
+ // Return a strike promise.
+ virtual SkStrikePromise strikePromise() = 0;
+
+ // Return the maximum dimension of a span of glyphs.
+ virtual SkScalar findMaximumGlyphDimension(SkSpan<const SkGlyphID> glyphs) = 0;
+
+ struct Deleter {
+ void operator()(StrikeForGPU* ptr) const {
+ ptr->onAboutToExitScope();
+ }
+ };
+};
+
+// -- ScopedStrikeForGPU ---------------------------------------------------------------------------
+using ScopedStrikeForGPU = std::unique_ptr<StrikeForGPU, StrikeForGPU::Deleter>;
+
+// prepareForPathDrawing uses this union to convert glyph ids to paths.
+union IDOrPath {
+ IDOrPath() {}
+
+ // PathOpSubmitter takes care of destroying the paths.
+ ~IDOrPath() {}
+ SkGlyphID fGlyphID;
+ SkPath fPath;
+};
+
+// prepareForDrawableDrawing uses this union to convert glyph ids to drawables.
+union IDOrDrawable {
+ SkGlyphID fGlyphID;
+ SkDrawable* fDrawable;
+};
+
+// -- StrikeForGPUCacheInterface -------------------------------------------------------------------
+class StrikeForGPUCacheInterface {
+public:
+ virtual ~StrikeForGPUCacheInterface() = default;
+ virtual ScopedStrikeForGPU findOrCreateScopedStrike(const SkStrikeSpec& strikeSpec) = 0;
+};
+} // namespace sktext
+#endif // sktext_StrikeForGPU_DEFINED
diff --git a/chromium/third_party/skia/src/text/gpu/GlyphVector.cpp b/chromium/third_party/skia/src/text/gpu/GlyphVector.cpp
index 654329c0a8d..e2bcd24f751 100644
--- a/chromium/third_party/skia/src/text/gpu/GlyphVector.cpp
+++ b/chromium/third_party/skia/src/text/gpu/GlyphVector.cpp
@@ -7,100 +7,108 @@
#include "src/text/gpu/GlyphVector.h"
-#include "include/private/chromium/SkChromeRemoteGlyphCache.h"
#include "src/core/SkReadBuffer.h"
#include "src/core/SkStrikeCache.h"
#include "src/core/SkWriteBuffer.h"
+#include "src/text/StrikeForGPU.h"
+
+#include <optional>
+
+class SkStrikeClient;
using MaskFormat = skgpu::MaskFormat;
namespace sktext::gpu {
-
-GlyphVector::GlyphVector(sk_sp<SkStrike>&& strike, SkSpan<Variant> glyphs)
- : fSkStrike{std::move(strike)}
+// -- GlyphVector ----------------------------------------------------------------------------------
+GlyphVector::GlyphVector(SkStrikePromise&& strikePromise, SkSpan<Variant> glyphs)
+ : fStrikePromise{std::move(strikePromise)}
, fGlyphs{glyphs} {
- SkASSERT(fSkStrike != nullptr);
SkASSERT(fGlyphs.size() > 0);
}
-GlyphVector GlyphVector::Make(
- sk_sp<SkStrike>&& strike, SkSpan<SkGlyphVariant> glyphs, SubRunAllocator* alloc) {
- SkASSERT(strike != nullptr);
- SkASSERT(glyphs.size() > 0);
+GlyphVector::Variant*
+GlyphVector::MakeGlyphs(SkSpan<SkGlyphVariant> glyphs, sktext::gpu::SubRunAllocator* alloc) {
Variant* variants = alloc->makePODArray<Variant>(glyphs.size());
for (auto [i, gv] : SkMakeEnumerate(glyphs)) {
- variants[i] = gv.glyph()->getPackedID();
+ variants[i] = gv.packedID();
}
+ return variants;
+}
- return GlyphVector{std::move(strike), SkMakeSpan(variants, glyphs.size())};
+GlyphVector GlyphVector::Make(
+ SkStrikePromise&& promise, SkSpan<SkGlyphVariant> glyphs, SubRunAllocator* alloc) {
+ SkASSERT(glyphs.size() > 0);
+ Variant* variants = MakeGlyphs(glyphs, alloc);
+ return GlyphVector{std::move(promise), SkSpan(variants, glyphs.size())};
}
std::optional<GlyphVector> GlyphVector::MakeFromBuffer(SkReadBuffer& buffer,
const SkStrikeClient* client,
SubRunAllocator* alloc) {
- auto descriptor = SkAutoDescriptor::MakeFromBuffer(buffer);
- if (!buffer.validate(descriptor.has_value())) { return {}; }
-
- if (client != nullptr) {
- if (!client->translateTypefaceID(&descriptor.value())) { return {}; }
+ std::optional<SkStrikePromise> promise =
+ SkStrikePromise::MakeFromBuffer(buffer, client, SkStrikeCache::GlobalStrikeCache());
+ if (!buffer.validate(promise.has_value())) {
+ return std::nullopt;
}
- sk_sp<SkStrike> strike = SkStrikeCache::GlobalStrikeCache()->findStrike(*descriptor->getDesc());
- if (!buffer.validate(strike != nullptr)) { return {}; }
-
int32_t glyphCount = buffer.read32();
// Since the glyph count can never be zero. There was a buffer reading problem.
- if (!buffer.validate(glyphCount > 0)) { return {}; }
+ if (!buffer.validate(glyphCount > 0)) {
+ return std::nullopt;
+ }
// Make sure we can multiply without overflow in the check below.
static constexpr int kMaxCount = (int)(INT_MAX / sizeof(uint32_t));
- if (!buffer.validate(glyphCount <= kMaxCount)) { return {}; }
+ if (!buffer.validate(glyphCount <= kMaxCount)) {
+ return std::nullopt;
+ }
// Check for enough bytes to populate the packedGlyphID array. If not enough something has
// gone wrong.
- if (!buffer.validate(glyphCount * sizeof(uint32_t) <= buffer.available())) { return {}; }
+ if (!buffer.validate(glyphCount * sizeof(uint32_t) <= buffer.available())) {
+ return std::nullopt;
+ }
Variant* variants = alloc->makePODArray<Variant>(glyphCount);
for (int i = 0; i < glyphCount; i++) {
variants[i].packedGlyphID = SkPackedGlyphID(buffer.readUInt());
}
- return {GlyphVector{std::move(strike), SkMakeSpan(variants, glyphCount)}};
+ return GlyphVector{std::move(promise.value()), SkSpan(variants, glyphCount)};
}
-void GlyphVector::flatten(SkWriteBuffer& buffer) {
+void GlyphVector::flatten(SkWriteBuffer& buffer) const {
// There should never be a glyph vector with zero glyphs.
SkASSERT(fGlyphs.size() != 0);
- if (!fSkStrike) { SK_ABORT("Can't flatten with already drawn."); }
-
- fSkStrike->getDescriptor().flatten(buffer);
+ fStrikePromise.flatten(buffer);
// Write out the span of packedGlyphIDs.
buffer.write32(SkTo<int32_t>(fGlyphs.size()));
- for (auto variant : fGlyphs) {
+ for (Variant variant : fGlyphs) {
buffer.writeUInt(variant.packedGlyphID.value());
}
}
SkSpan<const Glyph*> GlyphVector::glyphs() const {
- return SkMakeSpan(reinterpret_cast<const Glyph**>(fGlyphs.data()), fGlyphs.size());
+ return SkSpan(reinterpret_cast<const Glyph**>(fGlyphs.data()), fGlyphs.size());
}
// packedGlyphIDToGlyph must be run in single-threaded mode.
-// If fSkStrike != nullptr then the conversion to Glyph* has not happened.
+// If fSkStrike is not sk_sp<SkStrike> then the conversion to Glyph* has not happened.
void GlyphVector::packedGlyphIDToGlyph(StrikeCache* cache) {
- if (fSkStrike != nullptr) {
- fTextStrike = cache->findOrCreateStrike(fSkStrike->strikeSpec());
+ if (fTextStrike == nullptr) {
+ SkStrike* strike = fStrikePromise.strike();
+ fTextStrike = cache->findOrCreateStrike(strike->strikeSpec());
- for (auto& variant : fGlyphs) {
+ // Get all the atlas locations for each glyph.
+ for (Variant& variant : fGlyphs) {
variant.glyph = fTextStrike->getGlyph(variant.packedGlyphID);
}
// This must be pinned for the Atlas filling to work.
- fSkStrike->verifyPinnedStrike();
+ strike->verifyPinnedStrike();
- // Drop the ref on the strike that was taken in the SkGlyphRunPainter process* methods.
- fSkStrike = nullptr;
+ // Drop the ref to the strike so that it can be purged if needed.
+ fStrikePromise.resetStrike();
}
}
-
} // namespace sktext::gpu
diff --git a/chromium/third_party/skia/src/text/gpu/GlyphVector.h b/chromium/third_party/skia/src/text/gpu/GlyphVector.h
index 5ae70975464..430419ae877 100644
--- a/chromium/third_party/skia/src/text/gpu/GlyphVector.h
+++ b/chromium/third_party/skia/src/text/gpu/GlyphVector.h
@@ -7,11 +7,11 @@
#ifndef sktext_gpu_GlyphVector_DEFINED
#define sktext_gpu_GlyphVector_DEFINED
-
#include "include/core/SkSpan.h"
#include "src/core/SkGlyph.h"
#include "src/core/SkGlyphBuffer.h"
#include "src/gpu/AtlasTypes.h"
+#include "src/text/StrikeForGPU.h"
#include "src/text/gpu/Glyph.h"
#include "src/text/gpu/StrikeCache.h"
#include "src/text/gpu/SubRunAllocator.h"
@@ -20,6 +20,9 @@ class SkStrikeClient;
#if SK_SUPPORT_GPU
class GrMeshDrawTarget;
#endif
+#if defined(SK_GRAPHITE_ENABLED)
+namespace skgpu::graphite { class Recorder; }
+#endif
namespace sktext::gpu {
@@ -38,16 +41,17 @@ public:
Variant(SkPackedGlyphID id) : packedGlyphID{id} {}
};
- GlyphVector(sk_sp<SkStrike>&& strike, SkSpan<Variant> glyphs);
+ GlyphVector(SkStrikePromise&& strikePromise, SkSpan<Variant> glyphs);
static GlyphVector Make(
- sk_sp<SkStrike>&& strike, SkSpan<SkGlyphVariant> glyphs, SubRunAllocator* alloc);
+ SkStrikePromise&& promise, SkSpan<SkGlyphVariant> glyphs, SubRunAllocator* alloc);
+
SkSpan<const Glyph*> glyphs() const;
static std::optional<GlyphVector> MakeFromBuffer(SkReadBuffer& buffer,
const SkStrikeClient* strikeClient,
SubRunAllocator* alloc);
- void flatten(SkWriteBuffer& buffer);
+ void flatten(SkWriteBuffer& buffer) const;
// This doesn't need to include sizeof(GlyphVector) because this is embedded in each of
// the sub runs.
@@ -63,19 +67,27 @@ public:
GrMeshDrawTarget*);
#endif
+#if defined(SK_GRAPHITE_ENABLED)
+ std::tuple<bool, int> regenerateAtlas(
+ int begin, int end,
+ skgpu::MaskFormat maskFormat,
+ int srcPadding,
+ skgpu::graphite::Recorder*);
+#endif
+
static size_t GlyphVectorSize(size_t count) {
return sizeof(Variant) * count;
}
private:
- friend class TestingPeer;
- sk_sp<SkStrike> fSkStrike;
+ friend class GlyphVectorTestingPeer;
+ static Variant* MakeGlyphs(SkSpan<SkGlyphVariant> glyphs, SubRunAllocator* alloc);
+
+ SkStrikePromise fStrikePromise;
SkSpan<Variant> fGlyphs;
sk_sp<TextStrike> fTextStrike{nullptr};
uint64_t fAtlasGeneration{skgpu::AtlasGenerationCounter::kInvalidGeneration};
skgpu::BulkUsePlotUpdater fBulkUseUpdater;
};
-
} // namespace sktext::gpu
-
#endif // sktext_gpu_GlyphVector_DEFINED
diff --git a/chromium/third_party/skia/src/text/gpu/SDFTControl.cpp b/chromium/third_party/skia/src/text/gpu/SDFTControl.cpp
index 0d382e53ad1..4153c48dfdc 100644
--- a/chromium/third_party/skia/src/text/gpu/SDFTControl.cpp
+++ b/chromium/third_party/skia/src/text/gpu/SDFTControl.cpp
@@ -38,20 +38,23 @@ SkScalar SDFTControl::MinSDFTRange(bool useSDFTForSmallText, SkScalar min) {
}
SDFTControl::SDFTControl(
- bool ableToUseSDFT, bool useSDFTForSmallText, SkScalar min, SkScalar max)
+ bool ableToUseSDFT, bool useSDFTForSmallText, SkScalar min, SkScalar max, bool forcePaths)
: fMinDistanceFieldFontSize{MinSDFTRange(useSDFTForSmallText, min)}
, fMaxDistanceFieldFontSize{max}
- , fAbleToUseSDFT{ableToUseSDFT} {
+ , fAbleToUseSDFT{ableToUseSDFT}
+ , fForcePaths{forcePaths} {
SkASSERT_RELEASE(0 < min && min <= max);
}
bool SDFTControl::isDirect(SkScalar approximateDeviceTextSize, const SkPaint& paint) const {
- return !isSDFT(approximateDeviceTextSize, paint) &&
- approximateDeviceTextSize < SkStrikeCommon::kSkSideTooBigForAtlas;
+ return !fForcePaths &&
+ !isSDFT(approximateDeviceTextSize, paint) &&
+ approximateDeviceTextSize < SkGlyphDigest::kSkSideTooBigForAtlas;
}
bool SDFTControl::isSDFT(SkScalar approximateDeviceTextSize, const SkPaint& paint) const {
- return fAbleToUseSDFT &&
+ return !fForcePaths &&
+ fAbleToUseSDFT &&
paint.getMaskFilter() == nullptr &&
paint.getStyle() == SkPaint::kFill_Style &&
fMinDistanceFieldFontSize <= approximateDeviceTextSize &&
diff --git a/chromium/third_party/skia/src/text/gpu/SDFTControl.h b/chromium/third_party/skia/src/text/gpu/SDFTControl.h
index cebd374d93d..0c4ddda0baf 100644
--- a/chromium/third_party/skia/src/text/gpu/SDFTControl.h
+++ b/chromium/third_party/skia/src/text/gpu/SDFTControl.h
@@ -35,7 +35,8 @@ private:
class SDFTControl {
public:
- SDFTControl(bool ableToUseSDFT, bool useSDFTForSmallText, SkScalar min, SkScalar max);
+ SDFTControl(bool ableToUseSDFT, bool useSDFTForSmallText, SkScalar min, SkScalar max,
+ bool forcePaths = false);
// Produce a font, a scale factor from the nominal size to the source space size, and matrix
// range where this font can be reused.
@@ -44,6 +45,7 @@ public:
bool isDirect(SkScalar approximateDeviceTextSize, const SkPaint& paint) const;
bool isSDFT(SkScalar approximateDeviceTextSize, const SkPaint& paint) const;
+ bool forcePaths() const { return fForcePaths; }
private:
static SkScalar MinSDFTRange(bool useSDFTForSmallText, SkScalar min);
@@ -56,6 +58,7 @@ private:
const SkScalar fMaxDistanceFieldFontSize;
const bool fAbleToUseSDFT;
+ const bool fForcePaths;
};
} // namespace sktext::gpu
diff --git a/chromium/third_party/skia/src/text/gpu/SubRunAllocator.h b/chromium/third_party/skia/src/text/gpu/SubRunAllocator.h
index 533b4d49d58..c1db792a1f3 100644
--- a/chromium/third_party/skia/src/text/gpu/SubRunAllocator.h
+++ b/chromium/third_party/skia/src/text/gpu/SubRunAllocator.h
@@ -88,12 +88,18 @@ public:
template <int size>
using Storage = std::array<char, PlatformMinimumSizeWithOverhead(size, 1)>;
+ // Returns true if n * sizeof(T) will fit in an allocation block.
+ template <typename T>
+ static bool WillCountFit(int n) {
+ constexpr int kMaxN = kMaxByteSize / sizeof(T);
+ return 0 <= n && n < kMaxN;
+ }
+
// Returns a pointer to memory suitable for holding n Ts.
template <typename T> char* allocateBytesFor(int n = 1) {
static_assert(alignof(T) <= kMaxAlignment, "Alignment is too big for arena");
static_assert(sizeof(T) < kMaxByteSize, "Size is too big for arena");
- constexpr int kMaxN = kMaxByteSize / sizeof(T);
- SkASSERT_RELEASE(0 <= n && n < kMaxN);
+ SkASSERT_RELEASE(WillCountFit<T>(n));
int size = n ? n * sizeof(T) : 1;
return this->allocateBytes(size, alignof(T));
@@ -286,6 +292,20 @@ private:
BagOfBytes fAlloc;
};
+// Helper for defining allocators with inline/reserved storage.
+// For argument declarations, stick to the base type (SubRunAllocator).
+// Note: Inheriting from the storage first means the storage will outlive the
+// SubRunAllocator, letting ~SubRunAllocator read it as it calls destructors.
+// (This is mostly only relevant for strict tools like MSAN.)
+template <size_t InlineStorageSize, size_t InlineStorageAlignment>
+class STSubRunAllocator : private std::array<char,
+ BagOfBytes::PlatformMinimumSizeWithOverhead(
+ InlineStorageSize, InlineStorageAlignment)>,
+ public SubRunAllocator {
+public:
+ explicit STSubRunAllocator(size_t firstHeapAllocation = InlineStorageSize)
+ : SubRunAllocator{this->data(), SkToInt(this->size()), SkToInt(firstHeapAllocation)} {}
+};
} // namespace sktext::gpu
#endif // sktext_gpu_SubRunAllocator_DEFINED
diff --git a/chromium/third_party/skia/src/text/gpu/SubRunContainer.cpp b/chromium/third_party/skia/src/text/gpu/SubRunContainer.cpp
index b35a32cda1e..26b3f5c4ca2 100644
--- a/chromium/third_party/skia/src/text/gpu/SubRunContainer.cpp
+++ b/chromium/third_party/skia/src/text/gpu/SubRunContainer.cpp
@@ -1,34 +1,47 @@
/*
-* Copyright 2022 Google LLC
-*
-* Use of this source code is governed by a BSD-style license that can be
-* found in the LICENSE file.
-*/
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
#include "src/text/gpu/SubRunContainer.h"
+#include "include/core/SkScalar.h"
+#include "include/private/SkOnce.h"
#include "include/private/chromium/SkChromeRemoteGlyphCache.h"
#include "src/core/SkDescriptor.h"
#include "src/core/SkDistanceFieldGen.h"
+#include "src/core/SkEnumerate.h"
+#include "src/core/SkGlyph.h"
#include "src/core/SkGlyphBuffer.h"
-#include "src/core/SkGlyphRun.h"
#include "src/core/SkReadBuffer.h"
#include "src/core/SkRectPriv.h"
#include "src/core/SkStrikeCache.h"
#include "src/gpu/AtlasTypes.h"
+#include "src/text/GlyphRun.h"
+#include "src/text/StrikeForGPU.h"
#include "src/text/gpu/Glyph.h"
#include "src/text/gpu/GlyphVector.h"
#include "src/text/gpu/SubRunAllocator.h"
+#include <optional>
+
#if SK_SUPPORT_GPU // Ganesh Support
#include "src/gpu/ganesh/GrClip.h"
#include "src/gpu/ganesh/GrStyle.h"
#include "src/gpu/ganesh/SkGr.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/ops/AtlasTextOp.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
using AtlasTextOp = skgpu::v1::AtlasTextOp;
#endif // SK_SUPPORT_GPU
+#ifdef SK_GRAPHITE_ENABLED
+#include "src/gpu/graphite/Device.h"
+#include "src/gpu/graphite/DrawWriter.h"
+#include "src/gpu/graphite/Renderer.h"
+#endif
+
#include <cinttypes>
namespace sktext::gpu {
@@ -46,8 +59,19 @@ enum SubRun::SubRunType : int {
using MaskFormat = skgpu::MaskFormat;
+using namespace sktext;
using namespace sktext::gpu;
+#if defined(SK_GRAPHITE_ENABLED)
+using Device = skgpu::graphite::Device;
+using DrawWriter = skgpu::graphite::DrawWriter;
+using Rect = skgpu::graphite::Rect;
+using Recorder = skgpu::graphite::Recorder;
+using Renderer = skgpu::graphite::Renderer;
+using TextureProxy = skgpu::graphite::TextureProxy;
+using Transform = skgpu::graphite::Transform;
+#endif
+
namespace {
// Use the following in your args.gn to dump telemetry for diagnosing chrome Renderer/GPU
// differences.
@@ -58,16 +82,6 @@ static const constexpr bool kTrace = true;
static const constexpr bool kTrace = false;
#endif
-template <typename T>
-bool pun_read(SkReadBuffer& buffer, T* dst) {
- return buffer.readPad32(dst, sizeof(T));
-}
-
-template <typename T>
-void pun_write(SkWriteBuffer& buffer, const T& src) {
- buffer.writePad32(&src, sizeof(T));
-}
-
// -- TransformedMaskVertexFiller ------------------------------------------------------------------
class TransformedMaskVertexFiller {
public:
@@ -76,7 +90,8 @@ public:
SkRect sourceBounds,
SkSpan<const SkPoint> leftTop);
- static TransformedMaskVertexFiller Make(MaskFormat maskType,
+ static TransformedMaskVertexFiller Make(SkRect sourceBounds,
+ MaskFormat maskType,
int strikePadding,
SkScalar strikeToSourceScale,
const SkZip<SkGlyphVariant, SkPoint>& accepted,
@@ -107,6 +122,16 @@ public:
AtlasTextOp::MaskType opMaskType() const;
#endif // SK_SUPPORT_GPU
+#if defined(SK_GRAPHITE_ENABLED)
+ SkRect localRect() const { return fSourceBounds; }
+
+ void fillVertexData(DrawWriter* dw,
+ int offset, int count,
+ int ssboIndex,
+ SkSpan<const Glyph*> glyphs,
+ SkScalar depth,
+ const skgpu::graphite::Transform& toDevice) const;
+#endif
SkRect deviceRect(const SkMatrix& drawMatrix, SkPoint drawOrigin) const;
MaskFormat grMaskType() const {return fMaskType;}
int count() const { return SkCount(fLeftTop); }
@@ -174,61 +199,61 @@ TransformedMaskVertexFiller::TransformedMaskVertexFiller(
, fLeftTop{leftTop} {}
TransformedMaskVertexFiller TransformedMaskVertexFiller::Make(
+ SkRect sourceBounds,
MaskFormat maskType,
int strikePadding,
SkScalar strikeToSourceScale,
const SkZip<SkGlyphVariant, SkPoint>& accepted,
SubRunAllocator* alloc) {
- SkRect sourceBounds = SkRectPriv::MakeLargestInverted();
SkSpan<SkPoint> leftTop = alloc->makePODArray<SkPoint>(
accepted,
[&](auto e) -> SkPoint {
auto [variant, pos] = e;
- const SkGlyph* skGlyph = variant;
-
- // Make the glyphBounds and inset by any padding which may be included in the
- // strike mask.
- SkRect glyphBounds = skGlyph->rect();
- glyphBounds.inset(strikePadding, strikePadding);
-
- // Scale and position the glyph in source space.
- SkRect sourceGlyphBounds = SkRect::MakeXYWH(
- glyphBounds.left() * strikeToSourceScale + pos.x(),
- glyphBounds.top() * strikeToSourceScale + pos.y(),
- glyphBounds.width() * strikeToSourceScale,
- glyphBounds.height() * strikeToSourceScale);
-
- sourceBounds.joinPossiblyEmptyRect(sourceGlyphBounds);
- return {sourceGlyphBounds.left(), sourceGlyphBounds.top()};
+ return pos;
});
return TransformedMaskVertexFiller{maskType, strikeToSourceScale, sourceBounds, leftTop};
}
-static bool check_glyph_count(SkReadBuffer& buffer, int glyphCount) {
- return 0 < glyphCount && static_cast<size_t>(glyphCount) < (buffer.available() / 4);
+
+// Returns the empty span if there is a problem reading the positions.
+SkSpan<SkPoint> make_points_from_buffer(SkReadBuffer& buffer, SubRunAllocator* alloc) {
+ uint32_t glyphCount = buffer.getArrayCount();
+
+ // Zero indicates a problem with serialization.
+ if (!buffer.validate(glyphCount != 0)) { return {}; }
+
+ // Check that the count will not overflow the arena.
+ if (!buffer.validate(glyphCount <= INT_MAX &&
+ BagOfBytes::WillCountFit<SkPoint>(glyphCount))) { return {}; }
+
+ SkPoint* positionsData = alloc->makePODArray<SkPoint>(glyphCount);
+ if (!buffer.readPointArray(positionsData, glyphCount)) { return {}; }
+ return {positionsData, glyphCount};
}
std::optional<TransformedMaskVertexFiller> TransformedMaskVertexFiller::MakeFromBuffer(
SkReadBuffer& buffer, SubRunAllocator* alloc) {
int checkingMaskType = buffer.readInt();
if (!buffer.validate(0 <= checkingMaskType && checkingMaskType < skgpu::kMaskFormatCount)) {
- return {};
+ return std::nullopt;
}
MaskFormat maskType = (MaskFormat)checkingMaskType;
SkScalar strikeToSourceScale = buffer.readScalar();
- if (!buffer.validate(0 < strikeToSourceScale)) { return {}; }
+ if (!buffer.validate(0 < strikeToSourceScale)) { return std::nullopt; }
SkRect sourceBounds = buffer.readRect();
- int glyphCount = buffer.readInt();
- if (!buffer.validate(check_glyph_count(buffer, glyphCount))) { return {}; }
- SkPoint* leftTopStorage =
- alloc->makePODArray<SkPoint>(glyphCount);
- for (int i = 0; i < glyphCount; ++i) {
- leftTopStorage[i] = buffer.readPoint();
- }
- SkSpan<SkPoint> topLeft(leftTopStorage, glyphCount);
+ SkSpan<SkPoint> leftTop = make_points_from_buffer(buffer, alloc);
+ if (leftTop.empty()) { return std::nullopt; }
- return {TransformedMaskVertexFiller{maskType, strikeToSourceScale, sourceBounds, topLeft}};
+ SkASSERT(buffer.isValid());
+ return {TransformedMaskVertexFiller{maskType, strikeToSourceScale, sourceBounds, leftTop}};
+}
+
+void TransformedMaskVertexFiller::flatten(SkWriteBuffer& buffer) const {
+ buffer.writeInt(static_cast<int>(fMaskType));
+ buffer.writeScalar(fStrikeToSourceScale);
+ buffer.writeRect(fSourceBounds);
+ buffer.writePointArray(fLeftTop.data(), SkCount(fLeftTop));
}
SkRect TransformedMaskVertexFiller::deviceRect(
@@ -242,16 +267,6 @@ int TransformedMaskVertexFiller::unflattenSize() const {
return fLeftTop.size_bytes();
}
-void TransformedMaskVertexFiller::flatten(SkWriteBuffer& buffer) const {
- buffer.writeInt(static_cast<int>(fMaskType));
- buffer.writeScalar(fStrikeToSourceScale);
- buffer.writeRect(fSourceBounds);
- buffer.writeInt(SkCount(fLeftTop));
- for (SkPoint leftTop : fLeftTop) {
- buffer.writePoint(leftTop);
- }
-}
-
#if SK_SUPPORT_GPU
void TransformedMaskVertexFiller::fillVertexData(int offset, int count,
SkSpan<const Glyph*> glyphs,
@@ -346,6 +361,52 @@ AtlasTextOp::MaskType TransformedMaskVertexFiller::opMaskType() const {
}
#endif // SK_SUPPORT_GPU
+#if defined(SK_GRAPHITE_ENABLED)
+void TransformedMaskVertexFiller::fillVertexData(DrawWriter* dw,
+ int offset, int count,
+ int ssboIndex,
+ SkSpan<const Glyph*> glyphs,
+ SkScalar depth,
+ const Transform& toDevice) const {
+ auto quadData = [&]() {
+ return SkMakeZip(glyphs.subspan(offset, count),
+ fLeftTop.subspan(offset, count));
+ };
+
+ // TODO: can't handle perspective right now
+ if (toDevice.type() == Transform::Type::kProjection) {
+ return;
+ }
+
+ DrawWriter::Vertices verts{*dw};
+ verts.reserve(6*count);
+ for (auto [glyph, leftTop]: quadData()) {
+ auto[al, at, ar, ab] = glyph->fAtlasLocator.getUVs();
+ SkPoint widthHeight = SkPoint::Make(glyph->fAtlasLocator.width() * fStrikeToSourceScale,
+ glyph->fAtlasLocator.height() * fStrikeToSourceScale);
+ auto [l, t] = leftTop;
+ auto [r, b] = leftTop + widthHeight;
+ SkV2 localCorners[4] = {{l, t}, {r, t}, {r, b}, {l, b}};
+ SkV4 devOut[4];
+ toDevice.mapPoints(localCorners, devOut, 4);
+ // TODO: Ganesh uses indices but that's not available with dynamic vertex data
+ // TODO: we should really use instances as well.
+ verts.append(6) << SkPoint{devOut[0].x, devOut[0].y} << depth << AtlasPt{al, at} // L,T
+ << ssboIndex
+ << SkPoint{devOut[3].x, devOut[3].y} << depth << AtlasPt{al, ab} // L,B
+ << ssboIndex
+ << SkPoint{devOut[1].x, devOut[1].y} << depth << AtlasPt{ar, at} // R,T
+ << ssboIndex
+ << SkPoint{devOut[3].x, devOut[3].y} << depth << AtlasPt{al, ab} // L,B
+ << ssboIndex
+ << SkPoint{devOut[2].x, devOut[2].y} << depth << AtlasPt{ar, ab} // R,B
+ << ssboIndex
+ << SkPoint{devOut[1].x, devOut[1].y} << depth << AtlasPt{ar, at} // R,T
+ << ssboIndex;
+ }
+}
+#endif
+
struct AtlasPt {
uint16_t u;
@@ -390,19 +451,20 @@ AtlasTextOp::MaskType op_mask_type(MaskFormat maskFormat) {
SkUNREACHABLE;
}
-SkPMColor4f calculate_colors(skgpu::SurfaceContext* sc,
+SkPMColor4f calculate_colors(skgpu::v1::SurfaceContext* sc,
const SkPaint& paint,
const SkMatrixProvider& matrix,
MaskFormat maskFormat,
+ const SkSurfaceProps& props,
GrPaint* grPaint) {
GrRecordingContext* rContext = sc->recordingContext();
const GrColorInfo& colorInfo = sc->colorInfo();
if (maskFormat == MaskFormat::kARGB) {
- SkPaintToGrPaintReplaceShader(rContext, colorInfo, paint, matrix, nullptr, grPaint);
+ SkPaintToGrPaintReplaceShader(rContext, colorInfo, paint, matrix, nullptr, props, grPaint);
float a = grPaint->getColor4f().fA;
return {a, a, a, a};
}
- SkPaintToGrPaint(rContext, colorInfo, paint, matrix, grPaint);
+ SkPaintToGrPaint(rContext, colorInfo, paint, matrix, props, grPaint);
return grPaint->getColor4f();
}
@@ -431,22 +493,39 @@ std::tuple<bool, SkVector> can_use_direct(
}
// -- PathOpSubmitter ------------------------------------------------------------------------------
-// Shared code for submitting GPU ops for drawing glyphs as paths.
+// PathOpSubmitter holds glyph ids until ready to draw. During drawing, the glyph ids are
+// converted to SkPaths. PathOpSubmitter can only be serialized when it is holding glyph ids;
+// it can only be serialized before submitDraws has been called.
class PathOpSubmitter {
- union Variant;
-
public:
+ PathOpSubmitter() = delete;
+ PathOpSubmitter(const PathOpSubmitter&) = delete;
+ const PathOpSubmitter& operator=(const PathOpSubmitter&) = delete;
+ PathOpSubmitter(PathOpSubmitter&& that)
+ // Transfer ownership of fIDsOrPaths from that to this.
+ : fIDsOrPaths{std::exchange(
+ const_cast<SkSpan<IDOrPath>&>(that.fIDsOrPaths), SkSpan<IDOrPath>{})}
+ , fPositions{that.fPositions}
+ , fStrikeToSourceScale{that.fStrikeToSourceScale}
+ , fIsAntiAliased{that.fIsAntiAliased}
+ , fStrikePromise{std::move(that.fStrikePromise)} {}
+ PathOpSubmitter& operator=(PathOpSubmitter&& that) {
+ this->~PathOpSubmitter();
+ new (this) PathOpSubmitter{std::move(that)};
+ return *this;
+ }
PathOpSubmitter(bool isAntiAliased,
SkScalar strikeToSourceScale,
SkSpan<SkPoint> positions,
- SkSpan<SkGlyphID> glyphIDs,
- std::unique_ptr<SkPath[], SubRunAllocator::ArrayDestroyer> paths,
- const SkDescriptor& descriptor);
+ SkSpan<IDOrPath> idsOrPaths,
+ SkStrikePromise&& strikePromise);
+
+ ~PathOpSubmitter();
- static PathOpSubmitter Make(const SkZip<SkGlyphVariant, SkPoint>& accepted,
+ static PathOpSubmitter Make(const SkZip<SkPackedGlyphID, SkPoint>& accepted,
bool isAntiAliased,
SkScalar strikeToSourceScale,
- const SkDescriptor& descriptor,
+ SkStrikePromise&& strikePromise,
SubRunAllocator* alloc);
int unflattenSize() const;
@@ -455,143 +534,135 @@ public:
SubRunAllocator* alloc,
const SkStrikeClient* client);
-#if SK_SUPPORT_GPU
- void submitOps(SkCanvas*,
- const GrClip* clip,
- const SkMatrixProvider& viewMatrix,
- SkPoint drawOrigin,
- const SkPaint& paint,
- skgpu::v1::SurfaceDrawContext* sdc) const;
-#endif // SK_SUPPORT_GPU
+ // submitDraws is not thread safe. It only occurs the single thread drawing portion of the GPU
+ // rendering.
+ void submitDraws(SkCanvas*,
+ SkPoint drawOrigin,
+ const SkPaint& paint) const;
private:
- const bool fIsAntiAliased;
- const SkScalar fStrikeToSourceScale;
+ // When PathOpSubmitter is created only the glyphIDs are needed, during the submitDraws call,
+ // the glyphIDs are converted to SkPaths.
+ const SkSpan<IDOrPath> fIDsOrPaths;
const SkSpan<const SkPoint> fPositions;
- const SkSpan<const SkGlyphID> fGlyphIDs;
- std::unique_ptr<SkPath[], SubRunAllocator::ArrayDestroyer> fPaths;
- const SkAutoDescriptor fDescriptor;
+ const SkScalar fStrikeToSourceScale;
+ const bool fIsAntiAliased;
+
+ mutable SkStrikePromise fStrikePromise;
+ mutable SkOnce fConvertIDsToPaths;
+ mutable bool fPathsAreCreated{false};
};
int PathOpSubmitter::unflattenSize() const {
- return fPositions.size_bytes() + fGlyphIDs.size_bytes() + SkCount(fGlyphIDs) * sizeof(SkPath);
+ return fPositions.size_bytes() + fIDsOrPaths.size_bytes();
}
void PathOpSubmitter::flatten(SkWriteBuffer& buffer) const {
+ fStrikePromise.flatten(buffer);
+
buffer.writeInt(fIsAntiAliased);
buffer.writeScalar(fStrikeToSourceScale);
- buffer.writeInt(SkCount(fPositions));
- for (auto pos : fPositions) {
- buffer.writePoint(pos);
- }
- for (SkGlyphID glyphID : fGlyphIDs) {
- buffer.writeInt(glyphID);
+ buffer.writePointArray(fPositions.data(), SkCount(fPositions));
+ for (IDOrPath& idOrPath : fIDsOrPaths) {
+ buffer.writeInt(idOrPath.fGlyphID);
}
- fDescriptor.getDesc()->flatten(buffer);
}
std::optional<PathOpSubmitter> PathOpSubmitter::MakeFromBuffer(SkReadBuffer& buffer,
SubRunAllocator* alloc,
const SkStrikeClient* client) {
+ std::optional<SkStrikePromise> strikePromise =
+ SkStrikePromise::MakeFromBuffer(buffer, client, SkStrikeCache::GlobalStrikeCache());
+ if (!buffer.validate(strikePromise.has_value())) {
+ return std::nullopt;
+ }
+
bool isAntiAlias = buffer.readInt();
SkScalar strikeToSourceScale = buffer.readScalar();
- int glyphCount = buffer.readInt();
- if (!buffer.validate(check_glyph_count(buffer, glyphCount))) { return {}; }
- if (!buffer.validateCanReadN<SkPoint>(glyphCount)) { return {}; }
- SkPoint* positions = alloc->makePODArray<SkPoint>(glyphCount);
- for (int i = 0; i < glyphCount; ++i) {
- positions[i] = buffer.readPoint();
- }
+ SkSpan<SkPoint> positions = make_points_from_buffer(buffer, alloc);
+ if (positions.empty()) { return std::nullopt; }
+ const int glyphCount = SkCount(positions);
// Remember, we stored an int for glyph id.
- if (!buffer.validateCanReadN<int>(glyphCount)) { return {}; }
- SkGlyphID* glyphIDs = alloc->makePODArray<SkGlyphID>(glyphCount);
- for (int i = 0; i < glyphCount; ++i) {
- glyphIDs[i] = SkTo<SkGlyphID>(buffer.readInt());
+ if (!buffer.validateCanReadN<int>(glyphCount)) { return std::nullopt; }
+ auto idsOrPaths = SkSpan(alloc->makeUniqueArray<IDOrPath>(glyphCount).release(), glyphCount);
+ for (auto& idOrPath : idsOrPaths) {
+ idOrPath.fGlyphID = SkTo<SkGlyphID>(buffer.readInt());
}
- auto descriptor = SkAutoDescriptor::MakeFromBuffer(buffer);
- if (!buffer.validate(descriptor.has_value())) { return {}; }
-
- // Translate the TypefaceID if this was transferred from the GPU process.
- if (client != nullptr) {
- if (!client->translateTypefaceID(&descriptor.value())) { return {}; }
- }
+ if (!buffer.isValid()) { return std::nullopt; }
- auto strike = SkStrikeCache::GlobalStrikeCache()->findStrike(*descriptor->getDesc());
- if (!buffer.validate(strike != nullptr)) { return {}; }
-
- auto paths = alloc->makeUniqueArray<SkPath>(glyphCount);
- SkBulkGlyphMetricsAndPaths pathGetter{std::move(strike)};
-
- for (auto [i, glyphID] : SkMakeEnumerate(SkMakeSpan(glyphIDs, glyphCount))) {
- const SkPath* path = pathGetter.glyph(glyphID)->path();
- // There should never be missing paths in a sub run.
- if (path == nullptr) { return {}; }
- paths[i] = *path;
- }
-
- SkASSERT(buffer.isValid());
- return {PathOpSubmitter{isAntiAlias,
- strikeToSourceScale,
- SkMakeSpan(positions, glyphCount),
- SkMakeSpan(glyphIDs, glyphCount),
- std::move(paths),
- *descriptor->getDesc()}};
+ return PathOpSubmitter{isAntiAlias,
+ strikeToSourceScale,
+ positions,
+ idsOrPaths,
+ std::move(strikePromise.value())};
}
PathOpSubmitter::PathOpSubmitter(
bool isAntiAliased,
SkScalar strikeToSourceScale,
SkSpan<SkPoint> positions,
- SkSpan<SkGlyphID> glyphIDs,
- std::unique_ptr<SkPath[], SubRunAllocator::ArrayDestroyer> paths,
- const SkDescriptor& descriptor)
- : fIsAntiAliased{isAntiAliased}
- , fStrikeToSourceScale{strikeToSourceScale}
+ SkSpan<IDOrPath> idsOrPaths,
+ SkStrikePromise&& strikePromise)
+ : fIDsOrPaths{idsOrPaths}
, fPositions{positions}
- , fGlyphIDs{glyphIDs}
- , fPaths{std::move(paths)}
- , fDescriptor{descriptor} {
+ , fStrikeToSourceScale{strikeToSourceScale}
+ , fIsAntiAliased{isAntiAliased}
+ , fStrikePromise{std::move(strikePromise)} {
SkASSERT(!fPositions.empty());
}
-PathOpSubmitter PathOpSubmitter::Make(const SkZip<SkGlyphVariant, SkPoint>& accepted,
+PathOpSubmitter::~PathOpSubmitter() {
+ // If we have converted glyph IDs to paths, then clean up the SkPaths.
+ if (fPathsAreCreated) {
+ for (auto& idOrPath : fIDsOrPaths) {
+ idOrPath.fPath.~SkPath();
+ }
+ }
+}
+
+PathOpSubmitter PathOpSubmitter::Make(const SkZip<SkPackedGlyphID, SkPoint>& accepted,
bool isAntiAliased,
SkScalar strikeToSourceScale,
- const SkDescriptor& descriptor,
+ SkStrikePromise&& strikePromise,
SubRunAllocator* alloc) {
int glyphCount = SkCount(accepted);
SkPoint* positions = alloc->makePODArray<SkPoint>(glyphCount);
- SkGlyphID* glyphIDs = alloc->makePODArray<SkGlyphID>(glyphCount);
- auto paths = alloc->makeUniqueArray<SkPath>(glyphCount);
+ IDOrPath* idsOrPaths = alloc->makeUniqueArray<IDOrPath>(glyphCount).release();
- for (auto [i, variant, pos] : SkMakeEnumerate(accepted)) {
- positions[i] = pos;
- glyphIDs[i] = variant.glyph()->getGlyphID();
- paths[i] = *variant.glyph()->path();
+ for (auto [dstIdOrPath, dstPosition, srcPackedGlyphID, srcPosition] :
+ SkMakeZip(idsOrPaths, positions, accepted.get<0>(), accepted.get<1>())) {
+ dstPosition = srcPosition;
+ dstIdOrPath.fGlyphID = srcPackedGlyphID.glyphID();
}
return PathOpSubmitter{isAntiAliased,
strikeToSourceScale,
- SkMakeSpan(positions, glyphCount),
- SkMakeSpan(glyphIDs, glyphCount),
- std::move(paths),
- descriptor};
+ SkSpan(positions, glyphCount),
+ SkSpan(idsOrPaths, glyphCount),
+ std::move(strikePromise)};
}
-#if SK_SUPPORT_GPU
-void PathOpSubmitter::submitOps(SkCanvas* canvas,
- const GrClip* clip,
- const SkMatrixProvider& viewMatrix,
- SkPoint drawOrigin,
- const SkPaint& paint,
- skgpu::v1::SurfaceDrawContext* sdc) const {
+void PathOpSubmitter::submitDraws(SkCanvas* canvas,
+ SkPoint drawOrigin,
+ const SkPaint& paint) const {
+
+ // Convert the glyph IDs to paths if it hasn't been done yet. This is thread safe.
+ fConvertIDsToPaths([&]() {
+ if (SkStrike* strike = fStrikePromise.strike()) {
+ strike->glyphIDsToPaths(fIDsOrPaths);
+
+ // Drop ref to strike so that it can be purged from the cache if needed.
+ fStrikePromise.resetStrike();
+ fPathsAreCreated = true;
+ }
+ });
+
SkPaint runPaint{paint};
runPaint.setAntiAlias(fIsAntiAliased);
-
SkMaskFilterBase* maskFilter = as_MFB(runPaint.getMaskFilter());
// Calculate the matrix that maps the path glyphs from their size in the strike to
@@ -601,9 +672,10 @@ void PathOpSubmitter::submitOps(SkCanvas* canvas,
// If there are shaders, non-blur mask filters or styles, the path must be scaled into source
// space independently of the CTM. This allows the CTM to be correct for the different effects.
- GrStyle style(runPaint);
+ SkStrokeRec style(runPaint);
bool needsExactCTM = runPaint.getShader()
- || style.applies()
+ || runPaint.getPathEffect()
+ || (!style.isFillStyle() && !style.isHairlineStyle())
|| (maskFilter != nullptr && !maskFilter->asABlur(nullptr));
if (!needsExactCTM) {
SkMaskFilterBase::BlurRec blurRec;
@@ -614,58 +686,66 @@ void PathOpSubmitter::submitOps(SkCanvas* canvas,
runPaint.setMaskFilter(
SkMaskFilter::MakeBlur(blurRec.fStyle, blurRec.fSigma / fStrikeToSourceScale));
}
- for (auto [path, pos] : SkMakeZip(fPaths.get(), fPositions)) {
+ for (auto [idOrPath, pos] : SkMakeZip(fIDsOrPaths, fPositions)) {
// Transform the glyph to source space.
SkMatrix pathMatrix = strikeToSource;
pathMatrix.postTranslate(pos.x(), pos.y());
SkAutoCanvasRestore acr(canvas, true);
canvas->concat(pathMatrix);
- canvas->drawPath(path, runPaint);
+ canvas->drawPath(idOrPath.fPath, runPaint);
}
} else {
// Transform the path to device because the deviceMatrix must be unchanged to
// draw effect, filter or shader paths.
- for (auto [path, pos] : SkMakeZip(fPaths.get(), fPositions)) {
+ for (auto [idOrPath, pos] : SkMakeZip(fIDsOrPaths, fPositions)) {
// Transform the glyph to source space.
SkMatrix pathMatrix = strikeToSource;
pathMatrix.postTranslate(pos.x(), pos.y());
SkPath deviceOutline;
- path.transform(pathMatrix, &deviceOutline);
+ idOrPath.fPath.transform(pathMatrix, &deviceOutline);
deviceOutline.setIsVolatile(true);
canvas->drawPath(deviceOutline, runPaint);
}
}
}
-#endif // SK_SUPPORT_GPU
// -- PathSubRun -----------------------------------------------------------------------------------
class PathSubRun final : public SubRun {
public:
PathSubRun(PathOpSubmitter&& pathDrawing) : fPathDrawing(std::move(pathDrawing)) {}
- static SubRunOwner Make(const SkZip<SkGlyphVariant, SkPoint>& accepted,
+ static SubRunOwner Make(const SkZip<SkPackedGlyphID, SkPoint>& accepted,
bool isAntiAliased,
SkScalar strikeToSourceScale,
- const SkDescriptor& descriptor,
+ SkStrikePromise&& strikePromise,
SubRunAllocator* alloc) {
return alloc->makeUnique<PathSubRun>(
- PathOpSubmitter::Make(
- accepted, isAntiAliased, strikeToSourceScale, descriptor, alloc));
+ PathOpSubmitter::Make(
+ accepted, isAntiAliased, strikeToSourceScale, std::move(strikePromise), alloc));
}
#if SK_SUPPORT_GPU
void draw(SkCanvas* canvas,
- const GrClip* clip,
- const SkMatrixProvider& viewMatrix,
+ const GrClip*,
+ const SkMatrixProvider&,
SkPoint drawOrigin,
const SkPaint& paint,
- sk_sp<SkRefCnt> subRunStorage,
- skgpu::v1::SurfaceDrawContext* sdc) const override {
- fPathDrawing.submitOps(canvas, clip, viewMatrix, drawOrigin, paint, sdc);
+ sk_sp<SkRefCnt>,
+ skgpu::v1::SurfaceDrawContext*) const override {
+ fPathDrawing.submitDraws(canvas, drawOrigin, paint);
}
#endif // SK_SUPPORT_GPU
+#if defined(SK_GRAPHITE_ENABLED)
+ void draw(SkCanvas* canvas,
+ SkPoint drawOrigin,
+ const SkPaint& paint,
+ sk_sp<SkRefCnt> subRunStorage,
+ Device* device) const override {
+ fPathDrawing.submitDraws(canvas, drawOrigin, paint);
+ }
+#endif // SK_GRAPHITE_ENABLED
int unflattenSize() const override;
@@ -707,17 +787,27 @@ SubRunOwner PathSubRun::MakeFromBuffer(const SkMatrix& initialPositionMatrix,
// Shared code for submitting GPU ops for drawing glyphs as drawables.
class DrawableOpSubmitter {
public:
+ DrawableOpSubmitter() = delete;
+ DrawableOpSubmitter(const DrawableOpSubmitter&) = delete;
+ const DrawableOpSubmitter& operator=(const DrawableOpSubmitter&) = delete;
+ DrawableOpSubmitter(DrawableOpSubmitter&& that)
+ : fStrikeToSourceScale{that.fStrikeToSourceScale}
+ , fPositions{that.fPositions}
+ , fIDsOrDrawables{that.fIDsOrDrawables}
+ , fStrikePromise{std::move(that.fStrikePromise)} {}
+ DrawableOpSubmitter& operator=(DrawableOpSubmitter&& that) {
+ this->~DrawableOpSubmitter();
+ new (this) DrawableOpSubmitter{std::move(that)};
+ return *this;
+ }
DrawableOpSubmitter(SkScalar strikeToSourceScale,
SkSpan<SkPoint> positions,
- SkSpan<SkGlyphID> glyphIDs,
- SkSpan<SkDrawable*> drawableData,
- sk_sp<SkStrike>&& strike,
- const SkDescriptor& descriptor);
+ SkSpan<IDOrDrawable> idsOrDrawables,
+ SkStrikePromise&& strikePromise);
- static DrawableOpSubmitter Make(const SkZip<SkGlyphVariant, SkPoint>& accepted,
- sk_sp<SkStrike>&& strike,
+ static DrawableOpSubmitter Make(const SkZip<SkPackedGlyphID, SkPoint>& accepted,
SkScalar strikeToSourceScale,
- const SkDescriptor& descriptor,
+ SkStrikePromise&& strikePromise,
SubRunAllocator* alloc);
int unflattenSize() const;
@@ -737,114 +827,83 @@ public:
private:
const SkScalar fStrikeToSourceScale;
const SkSpan<SkPoint> fPositions;
- const SkSpan<SkGlyphID> fGlyphIDs;
- const SkSpan<SkDrawable*> fDrawables;
- sk_sp<SkStrike> fStrike; // Owns the fDrawables.
- const SkAutoDescriptor fDescriptor;
+ const SkSpan<IDOrDrawable> fIDsOrDrawables;
+ // When the promise is converted to a strike it acts as the ref on the strike to keep the
+ // SkDrawable data alive.
+ mutable SkStrikePromise fStrikePromise;
+ mutable SkOnce fConvertIDsToDrawables;
};
int DrawableOpSubmitter::unflattenSize() const {
- return fPositions.size_bytes() +
- fGlyphIDs.size_bytes() +
- SkCount(fPositions) * sizeof(sk_sp<SkDrawable>);
+ return fPositions.size_bytes() + fIDsOrDrawables.size_bytes();
}
void DrawableOpSubmitter::flatten(SkWriteBuffer& buffer) const {
+ fStrikePromise.flatten(buffer);
+
buffer.writeScalar(fStrikeToSourceScale);
- buffer.writeInt(SkCount(fPositions));
- for (auto pos : fPositions) {
- buffer.writePoint(pos);
+ buffer.writePointArray(fPositions.data(), SkCount(fPositions));
+ for (IDOrDrawable idOrDrawable : fIDsOrDrawables) {
+ buffer.writeInt(idOrDrawable.fGlyphID);
}
- for (SkGlyphID glyphID : fGlyphIDs) {
- buffer.writeInt(glyphID);
- }
- fDescriptor.getDesc()->flatten(buffer);
}
std::optional<DrawableOpSubmitter> DrawableOpSubmitter::MakeFromBuffer(
SkReadBuffer& buffer, SubRunAllocator* alloc, const SkStrikeClient* client) {
- SkScalar strikeToSourceScale = buffer.readScalar();
-
- int glyphCount = buffer.readInt();
- if (!buffer.validate(check_glyph_count(buffer, glyphCount))) { return {}; }
- if (!buffer.validateCanReadN<SkPoint>(glyphCount)) { return {}; }
- SkPoint* positions = alloc->makePODArray<SkPoint>(glyphCount);
- for (int i = 0; i < glyphCount; ++i) {
- positions[i] = buffer.readPoint();
- }
-
- // Remember, we stored an int for glyph id.
- if (!buffer.validateCanReadN<int>(glyphCount)) { return {}; }
- SkGlyphID* glyphIDs = alloc->makePODArray<SkGlyphID>(glyphCount);
- for (int i = 0; i < glyphCount; ++i) {
- glyphIDs[i] = SkTo<SkGlyphID>(buffer.readInt());
- }
-
- auto descriptor = SkAutoDescriptor::MakeFromBuffer(buffer);
- if (!buffer.validate(descriptor.has_value())) { return {}; }
-
- // Translate the TypefaceID if this was transferred from the GPU process.
- if (client != nullptr) {
- if (!client->translateTypefaceID(&descriptor.value())) { return {}; }
+ std::optional<SkStrikePromise> strikePromise =
+ SkStrikePromise::MakeFromBuffer(buffer, client, SkStrikeCache::GlobalStrikeCache());
+ if (!buffer.validate(strikePromise.has_value())) {
+ return std::nullopt;
}
- auto strike = SkStrikeCache::GlobalStrikeCache()->findStrike(*descriptor->getDesc());
- if (!buffer.validate(strike != nullptr)) { return {}; }
+ SkScalar strikeToSourceScale = buffer.readScalar();
- auto drawables = alloc->makePODArray<SkDrawable*>(glyphCount);
- SkBulkGlyphMetricsAndDrawables drawableGetter(sk_sp<SkStrike>{strike});
- auto glyphs = drawableGetter.glyphs(SkMakeSpan(glyphIDs, glyphCount));
+ SkSpan<SkPoint> positions = make_points_from_buffer(buffer, alloc);
+ if (positions.empty()) { return std::nullopt; }
+ const int glyphCount = SkCount(positions);
- for (auto [i, glyph] : SkMakeEnumerate(glyphs)) {
- drawables[i] = glyph->drawable();
+ if (!buffer.validateCanReadN<int>(glyphCount)) { return std::nullopt; }
+ auto idsOrDrawables = alloc->makePODArray<IDOrDrawable>(glyphCount);
+ for (int i = 0; i < SkToInt(glyphCount); ++i) {
+ // Remember, we stored an int for glyph id.
+ idsOrDrawables[i].fGlyphID = SkTo<SkGlyphID>(buffer.readInt());
}
SkASSERT(buffer.isValid());
- return {DrawableOpSubmitter{strikeToSourceScale,
- SkMakeSpan(positions, glyphCount),
- SkMakeSpan(glyphIDs, glyphCount),
- SkMakeSpan(drawables, glyphCount),
- std::move(strike),
- *descriptor->getDesc()}};
+ return DrawableOpSubmitter{strikeToSourceScale,
+ positions,
+ SkSpan(idsOrDrawables, glyphCount),
+ std::move(strikePromise.value())};
}
DrawableOpSubmitter::DrawableOpSubmitter(
SkScalar strikeToSourceScale,
SkSpan<SkPoint> positions,
- SkSpan<SkGlyphID> glyphIDs,
- SkSpan<SkDrawable*> drawables,
- sk_sp<SkStrike>&& strike,
- const SkDescriptor& descriptor)
+ SkSpan<IDOrDrawable> idsOrDrawables,
+ SkStrikePromise&& strikePromise)
: fStrikeToSourceScale{strikeToSourceScale}
, fPositions{positions}
- , fGlyphIDs{glyphIDs}
- , fDrawables{std::move(drawables)}
- , fStrike(std::move(strike))
- , fDescriptor{descriptor} {
+ , fIDsOrDrawables{idsOrDrawables}
+ , fStrikePromise(std::move(strikePromise)) {
SkASSERT(!fPositions.empty());
}
-DrawableOpSubmitter DrawableOpSubmitter::Make(const SkZip<SkGlyphVariant, SkPoint>& accepted,
- sk_sp<SkStrike>&& strike,
+DrawableOpSubmitter DrawableOpSubmitter::Make(const SkZip<SkPackedGlyphID, SkPoint>& accepted,
SkScalar strikeToSourceScale,
- const SkDescriptor& descriptor,
+ SkStrikePromise&& strikePromise,
SubRunAllocator* alloc) {
int glyphCount = SkCount(accepted);
SkPoint* positions = alloc->makePODArray<SkPoint>(glyphCount);
- SkGlyphID* glyphIDs = alloc->makePODArray<SkGlyphID>(glyphCount);
- SkDrawable** drawables = alloc->makePODArray<SkDrawable*>(glyphCount);
+ IDOrDrawable* idsOrDrawables = alloc->makePODArray<IDOrDrawable>(glyphCount);
for (auto [i, variant, pos] : SkMakeEnumerate(accepted)) {
positions[i] = pos;
- glyphIDs[i] = variant.glyph()->getGlyphID();
- drawables[i] = variant.glyph()->drawable();
+ idsOrDrawables[i].fGlyphID = variant.glyphID();
}
return DrawableOpSubmitter{strikeToSourceScale,
- SkMakeSpan(positions, glyphCount),
- SkMakeSpan(glyphIDs, glyphCount),
- SkMakeSpan(drawables, glyphCount),
- std::move(strike),
- descriptor};
+ SkSpan(positions, glyphCount),
+ SkSpan(idsOrDrawables, glyphCount),
+ std::move(strikePromise)};
}
#if SK_SUPPORT_GPU
@@ -854,6 +913,13 @@ void DrawableOpSubmitter::submitOps(SkCanvas* canvas,
SkPoint drawOrigin,
const SkPaint& paint,
skgpu::v1::SurfaceDrawContext* sdc) const {
+ // Convert glyph IDs to Drawables if it hasn't been done yet.
+ fConvertIDsToDrawables([&]() {
+ fStrikePromise.strike()->glyphIDsToDrawables(fIDsOrDrawables);
+ // Do not call resetStrike() because the strike must remain owned to ensure the Drawable
+ // data is not freed.
+ });
+
// Calculate the matrix that maps the path glyphs from their size in the strike to
// the graphics source space.
SkMatrix strikeToSource = SkMatrix::Scale(fStrikeToSourceScale, fStrikeToSourceScale);
@@ -862,7 +928,15 @@ void DrawableOpSubmitter::submitOps(SkCanvas* canvas,
// Transform the path to device because the deviceMatrix must be unchanged to
// draw effect, filter or shader paths.
for (auto [i, position] : SkMakeEnumerate(fPositions)) {
- SkDrawable* drawable = fDrawables[i];
+ SkDrawable* drawable = fIDsOrDrawables[i].fDrawable;
+
+ if (drawable == nullptr) {
+ // This better be pinned to keep the drawable data alive.
+ fStrikePromise.strike()->verifyPinnedStrike();
+ SkDEBUGFAIL("Drawable should not be nullptr.");
+ continue;
+ }
+
// Transform the glyph to source space.
SkMatrix pathMatrix = strikeToSource;
pathMatrix.postTranslate(position.x(), position.y());
@@ -877,14 +951,12 @@ void DrawableOpSubmitter::submitOps(SkCanvas* canvas,
#endif // SK_SUPPORT_GPU
template <typename SubRunT>
-SubRunOwner make_drawable_sub_run(const SkZip<SkGlyphVariant, SkPoint>& drawables,
- sk_sp<SkStrike>&& strike,
+SubRunOwner make_drawable_sub_run(const SkZip<SkPackedGlyphID, SkPoint>& drawables,
SkScalar strikeToSourceScale,
- const SkDescriptor& descriptor,
+ SkStrikePromise&& strikePromise,
SubRunAllocator* alloc) {
return alloc->makeUnique<SubRunT>(
- DrawableOpSubmitter::Make(drawables, std::move(strike),
- strikeToSourceScale, descriptor, alloc));
+ DrawableOpSubmitter::Make(drawables, strikeToSourceScale, std::move(strikePromise), alloc));
}
// -- DrawableSubRun -------------------------------------------------------------------------------
@@ -908,6 +980,15 @@ public:
fDrawingDrawing.submitOps(canvas, clip, viewMatrix, drawOrigin, paint, sdc);
}
#endif // SK_SUPPORT_GPU
+#if defined(SK_GRAPHITE_ENABLED)
+ void draw(SkCanvas* canvas,
+ SkPoint drawOrigin,
+ const SkPaint& paint,
+ sk_sp<SkRefCnt> subRunStorage,
+ Device* device) const override {
+ // TODO
+ }
+#endif // SK_SUPPORT_GPU
int unflattenSize() const override;
@@ -940,7 +1021,7 @@ SubRunOwner DrawableSubRun::MakeFromBuffer(const SkMatrix&,
return alloc->makeUnique<DrawableSubRun>(std::move(*drawableOpSubmitter));
}
-bool DrawableSubRun::canReuse( const SkPaint& paint, const SkMatrix& positionMatrix) const {
+bool DrawableSubRun::canReuse(const SkPaint& paint, const SkMatrix& positionMatrix) const {
return true;
}
@@ -948,8 +1029,6 @@ const AtlasSubRun* DrawableSubRun::testingOnly_atlasSubRun() const {
return nullptr;
}
-using DevicePosition = skvx::Vec<2, int16_t>;
-
#if SK_SUPPORT_GPU
enum ClipMethod {
kClippedOut,
@@ -1005,8 +1084,8 @@ void generalized_direct_2D(SkZip<Quad, const Glyph*, const VertexData> quadData,
auto[al, at, ar, ab] = glyph->fAtlasLocator.getUVs();
uint16_t w = ar - al,
h = ab - at;
- SkScalar l = (SkScalar)leftTop[0] + originOffset.x(),
- t = (SkScalar)leftTop[1] + originOffset.y();
+ SkScalar l = leftTop.x() + originOffset.x(),
+ t = leftTop.y() + originOffset.y();
if (clip == nullptr) {
auto[dl, dt, dr, db] = SkRect::MakeLTRB(l, t, l + w, t + h);
quad[0] = {{dl, dt}, color, {al, at}}; // L,T
@@ -1042,13 +1121,13 @@ void generalized_direct_2D(SkZip<Quad, const Glyph*, const VertexData> quadData,
// The 99% case. No clip. Non-color only.
void direct_2D(SkZip<Mask2DVertex[4],
const Glyph*,
- const DevicePosition> quadData,
+ const SkPoint> quadData,
GrColor color,
SkPoint originOffset) {
for (auto[quad, glyph, leftTop] : quadData) {
auto[al, at, ar, ab] = glyph->fAtlasLocator.getUVs();
- SkScalar dl = leftTop[0] + originOffset.x(),
- dt = leftTop[1] + originOffset.y(),
+ SkScalar dl = leftTop.x() + originOffset.x(),
+ dt = leftTop.y() + originOffset.y(),
dr = dl + (ar - al),
db = dt + (ab - at);
@@ -1065,14 +1144,14 @@ class DirectMaskSubRun final : public SubRun, public AtlasSubRun {
public:
DirectMaskSubRun(MaskFormat format,
const SkMatrix& initialPositionMatrix,
- SkGlyphRect deviceBounds,
- SkSpan<const DevicePosition> devicePositions,
- GlyphVector&& glyphs,
- bool glyphsOutOfBounds);
+ SkRect deviceBounds,
+ SkSpan<const SkPoint> devicePositions,
+ GlyphVector&& glyphs);
- static SubRunOwner Make(const SkZip<SkGlyphVariant, SkPoint>& accepted,
+ static SubRunOwner Make(SkRect runBounds,
+ const SkZip<SkGlyphVariant, SkPoint>& accepted,
const SkMatrix& initialPositionMatrix,
- sk_sp<SkStrike>&& strike,
+ SkStrikePromise&& strikePromise,
MaskFormat format,
SubRunAllocator* alloc);
@@ -1090,11 +1169,19 @@ public:
skgpu::v1::SurfaceDrawContext* sdc) const override;
#endif // SK_SUPPORT_GPU
+#ifdef SK_GRAPHITE_ENABLED
+ void draw(SkCanvas*,
+ SkPoint drawOrigin,
+ const SkPaint&,
+ sk_sp<SkRefCnt> subRunStorage,
+ Device*) const override;
+#endif
+
int unflattenSize() const override;
int glyphCount() const override;
- void testingOnly_packedGlyphIDToGlyph(StrikeCache *cache) const override;
+ void testingOnly_packedGlyphIDToGlyph(StrikeCache* cache) const override;
#if SK_SUPPORT_GPU
size_t vertexStride(const SkMatrix& drawMatrix) const override;
@@ -1116,6 +1203,26 @@ public:
SkIRect clip) const override;
#endif // SK_SUPPORT_GPU
+#if defined(SK_GRAPHITE_ENABLED)
+ std::tuple<bool, int>
+ regenerateAtlas(int begin, int end, Recorder*) const override;
+
+ std::tuple<Rect, Transform> boundsAndDeviceMatrix(const Transform&,
+ SkPoint drawOrigin) const override;
+
+ const Renderer* renderer() const override {
+ return &Renderer::TextDirect(fMaskFormat == skgpu::MaskFormat::kA8);
+ }
+
+ void fillVertexData(DrawWriter*,
+ int offset, int count,
+ int ssboIndex,
+ SkScalar depth,
+ const skgpu::graphite::Transform& transform) const override;
+
+ MaskFormat maskFormat() const override { return fMaskFormat; }
+#endif
+
bool canReuse(const SkPaint& paint, const SkMatrix& positionMatrix) const override;
const AtlasSubRun* testingOnly_atlasSubRun() const override;
@@ -1134,9 +1241,8 @@ private:
const SkMatrix& fInitialPositionMatrix;
// The vertex bounds in device space. The bounds are the joined rectangles of all the glyphs.
- const SkGlyphRect fGlyphDeviceBounds;
- const SkSpan<const DevicePosition> fLeftTopDevicePos;
- const bool fSomeGlyphsExcluded;
+ const SkRect fGlyphDeviceBounds;
+ const SkSpan<const SkPoint> fLeftTopDevicePos;
// The regenerateAtlas method mutates fGlyphs. It should be called from onPrepare which must
// be single threaded.
@@ -1145,73 +1251,37 @@ private:
DirectMaskSubRun::DirectMaskSubRun(MaskFormat format,
const SkMatrix& initialPositionMatrix,
- SkGlyphRect deviceBounds,
- SkSpan<const DevicePosition> devicePositions,
- GlyphVector&& glyphs,
- bool glyphsOutOfBounds)
+ SkRect deviceBounds,
+ SkSpan<const SkPoint> devicePositions,
+ GlyphVector&& glyphs)
: fMaskFormat{format}
, fInitialPositionMatrix{initialPositionMatrix}
, fGlyphDeviceBounds{deviceBounds}
, fLeftTopDevicePos{devicePositions}
- , fSomeGlyphsExcluded{glyphsOutOfBounds}
- , fGlyphs{std::move(glyphs)} { }
+ , fGlyphs{std::move(glyphs)} {}
-SubRunOwner DirectMaskSubRun::Make(const SkZip<SkGlyphVariant, SkPoint>& accepted,
+SubRunOwner DirectMaskSubRun::Make(SkRect runBounds,
+ const SkZip<SkGlyphVariant, SkPoint>& accepted,
const SkMatrix& initialPositionMatrix,
- sk_sp<SkStrike>&& strike,
+ SkStrikePromise&& strikePromise,
MaskFormat format,
SubRunAllocator* alloc) {
- auto glyphLeftTop = alloc->makePODArray<DevicePosition>(accepted.size());
+ auto glyphLeftTop = alloc->makePODArray<SkPoint>(accepted.size());
auto glyphIDs = alloc->makePODArray<GlyphVector::Variant>(accepted.size());
- // Because this is the direct case, the maximum width or height is the size that fits in the
- // atlas. This boundary is checked below to ensure that the call to SkGlyphRect below will
- // not overflow.
- constexpr SkScalar kMaxPos =
- std::numeric_limits<int16_t>::max() - SkStrikeCommon::kSkSideTooBigForAtlas;
- SkGlyphRect runBounds = skglyph::empty_rect();
- size_t goodPosCount = 0;
- for (auto [variant, pos] : accepted) {
- auto [x, y] = pos;
- // Ensure that the .offset() call below does not overflow. And, at this point none of the
- // rectangles are empty because they were culled before the run was created. Basically,
- // cull all the glyphs that can't appear on the screen.
- if (-kMaxPos < x && x < kMaxPos && -kMaxPos < y && y < kMaxPos) {
- const SkGlyph* const skGlyph = variant;
- const SkGlyphRect deviceBounds =
- skGlyph->glyphRect().offset(SkScalarRoundToInt(x), SkScalarRoundToInt(y));
- runBounds = skglyph::rect_union(runBounds, deviceBounds);
- glyphLeftTop[goodPosCount] = deviceBounds.leftTop();
- glyphIDs[goodPosCount].packedGlyphID = skGlyph->getPackedID();
- goodPosCount += 1;
- }
- }
-
- // Wow! no glyphs are in bounds and had non-empty bounds.
- if (goodPosCount == 0) {
- return nullptr;
+ for (auto [i, variant, pos] : SkMakeEnumerate(accepted)) {
+ glyphLeftTop[i] = pos;
+ glyphIDs[i].packedGlyphID = variant.packedID();
}
- // If some glyphs were excluded by the bounds, then this subrun can't be generally be used
- // for other draws. Mark the subrun as not general.
- bool glyphsExcluded = goodPosCount != accepted.size();
- SkSpan<const DevicePosition> leftTop{glyphLeftTop, goodPosCount};
+ SkSpan<const SkPoint> leftTop{glyphLeftTop, accepted.size()};
return alloc->makeUnique<DirectMaskSubRun>(
format, initialPositionMatrix, runBounds, leftTop,
- GlyphVector{std::move(strike), {glyphIDs, goodPosCount}},
- glyphsExcluded);
+ GlyphVector{std::move(strikePromise), {glyphIDs, accepted.size()}});
}
bool DirectMaskSubRun::canReuse(const SkPaint& paint, const SkMatrix& positionMatrix) const {
- auto [reuse, translation] =
- can_use_direct(fInitialPositionMatrix, positionMatrix);
-
- // If glyphs were excluded because of position bounds, then this subrun can only be reused if
- // there is no change in position.
- if (fSomeGlyphsExcluded) {
- return translation.x() == 0 && translation.y() == 0;
- }
-
+ auto [reuse, _] = can_use_direct(fInitialPositionMatrix, positionMatrix);
return reuse;
}
@@ -1220,42 +1290,32 @@ SubRunOwner DirectMaskSubRun::MakeFromBuffer(const SkMatrix& initialPositionMatr
SubRunAllocator* alloc,
const SkStrikeClient* client) {
MaskFormat maskType = (MaskFormat)buffer.readInt();
- SkGlyphRect runBounds;
- pun_read(buffer, &runBounds);
+ SkRect runBounds = buffer.readRect();
- int glyphCount = buffer.readInt();
- if (!buffer.validate(check_glyph_count(buffer, glyphCount))) { return nullptr; }
- if (!buffer.validateCanReadN<DevicePosition>(glyphCount)) { return nullptr; }
- DevicePosition* positionsData = alloc->makePODArray<DevicePosition>(glyphCount);
- for (int i = 0; i < glyphCount; ++i) {
- pun_read(buffer, &positionsData[i]);
- }
- SkSpan<DevicePosition> positions(positionsData, glyphCount);
+ SkSpan<SkPoint> leftTop = make_points_from_buffer(buffer, alloc);
+ if (leftTop.empty()) { return nullptr; }
+ const int glyphCount = SkCount(leftTop);
auto glyphVector = GlyphVector::MakeFromBuffer(buffer, client, alloc);
if (!buffer.validate(glyphVector.has_value())) { return nullptr; }
if (!buffer.validate(SkCount(glyphVector->glyphs()) == glyphCount)) { return nullptr; }
SkASSERT(buffer.isValid());
return alloc->makeUnique<DirectMaskSubRun>(
- maskType, initialPositionMatrix, runBounds, positions,
- std::move(glyphVector.value()), false);
+ maskType, initialPositionMatrix, runBounds, leftTop,
+ std::move(glyphVector.value()));
}
void DirectMaskSubRun::doFlatten(SkWriteBuffer& buffer) const {
buffer.writeInt(static_cast<int>(fMaskFormat));
- pun_write(buffer, fGlyphDeviceBounds);
- int glyphCount = SkTo<int>(fLeftTopDevicePos.size());
- buffer.writeInt(glyphCount);
- for (auto pos : fLeftTopDevicePos) {
- pun_write(buffer, pos);
- }
+ buffer.writeRect(fGlyphDeviceBounds);
+ buffer.writePointArray(fLeftTopDevicePos.data(), SkCount(fLeftTopDevicePos));
fGlyphs.flatten(buffer);
}
int DirectMaskSubRun::unflattenSize() const {
return sizeof(DirectMaskSubRun) +
fGlyphs.unflattenSize() +
- sizeof(DevicePosition) * fGlyphs.glyphs().size();
+ sizeof(SkPoint) * fGlyphs.glyphs().size();
}
const AtlasSubRun* DirectMaskSubRun::testingOnly_atlasSubRun() const {
@@ -1341,7 +1401,7 @@ std::tuple<const GrClip*, GrOp::Owner> DirectMaskSubRun::makeAtlasTextOp(
GrPaint grPaint;
const SkPMColor4f drawingColor =
- calculate_colors(sdc, paint, viewMatrix, fMaskFormat, &grPaint);
+ calculate_colors(sdc, paint, viewMatrix, fMaskFormat, sdc->surfaceProps(), &grPaint);
auto geometry = AtlasTextOp::Geometry::Make(*this,
drawMatrix,
@@ -1363,6 +1423,17 @@ std::tuple<const GrClip*, GrOp::Owner> DirectMaskSubRun::makeAtlasTextOp(
}
#endif // SK_SUPPORT_GPU
+#ifdef SK_GRAPHITE_ENABLED
+void DirectMaskSubRun::draw(SkCanvas*,
+ SkPoint drawOrigin,
+ const SkPaint& paint,
+ sk_sp<SkRefCnt> subRunStorage,
+ Device* device) const {
+ // TODO: see makeAtlasTextOp for Geometry set up
+ device->drawAtlasSubRun(this, drawOrigin, paint, std::move(subRunStorage));
+}
+#endif
+
void DirectMaskSubRun::testingOnly_packedGlyphIDToGlyph(StrikeCache *cache) const {
fGlyphs.packedGlyphIDToGlyph(cache);
}
@@ -1379,8 +1450,8 @@ void transformed_direct_2D(SkZip<Quad, const Glyph*, const VertexData> quadData,
const SkMatrix& matrix) {
for (auto[quad, glyph, leftTop] : quadData) {
auto[al, at, ar, ab] = glyph->fAtlasLocator.getUVs();
- SkScalar dl = leftTop[0],
- dt = leftTop[1],
+ SkScalar dl = leftTop.x(),
+ dt = leftTop.y(),
dr = dl + (ar - al),
db = dt + (ab - at);
SkPoint lt = matrix.mapXY(dl, dt),
@@ -1406,8 +1477,8 @@ void transformed_direct_3D(SkZip<Quad, const Glyph*, const VertexData> quadData,
};
for (auto[quad, glyph, leftTop] : quadData) {
auto[al, at, ar, ab] = glyph->fAtlasLocator.getUVs();
- SkScalar dl = leftTop[0],
- dt = leftTop[1],
+ SkScalar dl = leftTop.x(),
+ dt = leftTop.y(),
dr = dl + (ar - al),
db = dt + (ab - at);
SkPoint3 lt = mapXYZ(dl, dt),
@@ -1484,6 +1555,127 @@ void DirectMaskSubRun::fillVertexData(void* vertexDst, int offset, int count,
}
#endif // SK_SUPPORT_GPU
+#if defined(SK_GRAPHITE_ENABLED)
+std::tuple<bool, int> DirectMaskSubRun::regenerateAtlas(int begin, int end,
+ Recorder* recorder) const {
+ return fGlyphs.regenerateAtlas(begin, end, fMaskFormat, 0, recorder);
+}
+
+std::tuple<Rect, Transform> DirectMaskSubRun::boundsAndDeviceMatrix(const Transform& localToDevice,
+ SkPoint drawOrigin) const {
+ // The baked-in matrix differs from the current localToDevice by a translation if the upper 2x2
+ // remains the same, and there's no perspective. Since there's no projection, Z is irrelevant
+ // so it's okay that fInitialPositionMatrix is an SkMatrix and has discarded the 3rd row/col,
+ // and can ignore those values in localToDevice.
+ const SkM44& positionMatrix = localToDevice.matrix();
+ const bool compatibleMatrix = positionMatrix.rc(0,0) == fInitialPositionMatrix.rc(0,0) &&
+ positionMatrix.rc(0,1) == fInitialPositionMatrix.rc(0,1) &&
+ positionMatrix.rc(1,0) == fInitialPositionMatrix.rc(1,0) &&
+ positionMatrix.rc(1,1) == fInitialPositionMatrix.rc(1,1) &&
+ localToDevice.type() != Transform::Type::kProjection &&
+ !fInitialPositionMatrix.hasPerspective();
+
+ if (compatibleMatrix) {
+ const SkV4 mappedOrigin = positionMatrix.map(drawOrigin.x(), drawOrigin.y(), 0.f, 1.f);
+ const SkV2 offset = {mappedOrigin.x - fInitialPositionMatrix.getTranslateX(),
+ mappedOrigin.y - fInitialPositionMatrix.getTranslateY()};
+ if (SkScalarIsInt(offset.x) && SkScalarIsInt(offset.y)) {
+ // The offset is an integer (but make sure), which means the generated mask can be
+ // accessed without changing how texels would be sampled.
+ return {Rect(fGlyphDeviceBounds),
+ Transform(SkM44::Translate(SkScalarRoundToInt(offset.x),
+ SkScalarRoundToInt(offset.y)))};
+ }
+ }
+
+ // Otherwise compute the relative transformation from fInitialPositionMatrix to localToDevice,
+ // with the drawOrigin applied. If fInitialPositionMatrix or the concatenation is not invertible
+ // the returned Transform is marked invalid and the draw will be automatically dropped.
+ return {Rect(fGlyphDeviceBounds),
+ localToDevice.preTranslate(drawOrigin.x(), drawOrigin.y())
+ .concatInverse(SkM44(fInitialPositionMatrix))};
+}
+
+template<typename VertexData>
+void direct_dw(DrawWriter* dw,
+ int ssboIndex,
+ SkZip<const Glyph*, const VertexData> quadData,
+ SkScalar depth) {
+ DrawWriter::Vertices verts{*dw};
+ verts.reserve(6*quadData.size());
+ for (auto [glyph, leftTop]: quadData) {
+ auto[al, at, ar, ab] = glyph->fAtlasLocator.getUVs();
+ SkScalar dl = leftTop.x(),
+ dt = leftTop.y(),
+ dr = dl + (ar - al),
+ db = dt + (ab - at);
+ // TODO: Ganesh uses indices but that's not available with dynamic vertex data
+ // TODO: we should really use instances as well.
+ verts.append(6) << SkPoint{dl, dt} << depth << AtlasPt{al, at} << ssboIndex // L,T
+ << SkPoint{dl, db} << depth << AtlasPt{al, ab} << ssboIndex // L,B
+ << SkPoint{dr, dt} << depth << AtlasPt{ar, at} << ssboIndex // R,T
+ << SkPoint{dl, db} << depth << AtlasPt{al, ab} << ssboIndex // L,B
+ << SkPoint{dr, db} << depth << AtlasPt{ar, ab} << ssboIndex // R,B
+ << SkPoint{dr, dt} << depth << AtlasPt{ar, at} << ssboIndex; // R,T
+ }
+}
+
+template<typename VertexData>
+void transformed_direct_dw(DrawWriter* dw,
+ int ssboIndex,
+ SkZip<const Glyph*, const VertexData> quadData,
+ SkScalar depth, const Transform& transform) {
+ DrawWriter::Vertices verts{*dw};
+ verts.reserve(6*quadData.size());
+ for (auto [glyph, leftTop]: quadData) {
+ auto[al, at, ar, ab] = glyph->fAtlasLocator.getUVs();
+ SkScalar dl = leftTop.x(),
+ dt = leftTop.y(),
+ dr = dl + (ar - al),
+ db = dt + (ab - at);
+ SkV2 localCorners[4] = {{dl, dt}, {dr, dt}, {dr, db}, {dl, db}};
+ SkV4 devOut[4];
+ transform.mapPoints(localCorners, devOut, 4);
+ // TODO: Ganesh uses indices but that's not available with dynamic vertex data
+ // TODO: we should really use instances as well.
+ verts.append(6) << SkPoint{devOut[0].x, devOut[0].y} << depth << AtlasPt{al, at} // L,T
+ << ssboIndex
+ << SkPoint{devOut[3].x, devOut[3].y} << depth << AtlasPt{al, ab} // L,B
+ << ssboIndex
+ << SkPoint{devOut[1].x, devOut[1].y} << depth << AtlasPt{ar, at} // R,T
+ << ssboIndex
+ << SkPoint{devOut[3].x, devOut[3].y} << depth << AtlasPt{al, ab} // L,B
+ << ssboIndex
+ << SkPoint{devOut[2].x, devOut[2].y} << depth << AtlasPt{ar, ab} // R,B
+ << ssboIndex
+ << SkPoint{devOut[1].x, devOut[1].y} << depth << AtlasPt{ar, at} // R,T
+ << ssboIndex;
+ }
+}
+
+void DirectMaskSubRun::fillVertexData(DrawWriter* dw,
+ int offset, int count,
+ int ssboIndex,
+ SkScalar depth,
+ const skgpu::graphite::Transform& toDevice) const {
+ auto quadData = [&]() {
+ return SkMakeZip(fGlyphs.glyphs().subspan(offset, count),
+ fLeftTopDevicePos.subspan(offset, count));
+ };
+
+ // TODO: Can't handle perspective right now
+ if (toDevice.type() == Transform::Type::kProjection) {
+ return;
+ }
+ bool noTransformNeeded = (toDevice.type() == Transform::Type::kIdentity);
+ if (noTransformNeeded) {
+ direct_dw(dw, ssboIndex, quadData(), depth);
+ } else {
+ transformed_direct_dw(dw, ssboIndex, quadData(), depth, toDevice);
+ }
+}
+#endif
+
// true if only need to translate by integer amount, device rect.
std::tuple<bool, SkRect> DirectMaskSubRun::deviceRectAndCheckTransform(
const SkMatrix& positionMatrix) const {
@@ -1498,15 +1690,10 @@ std::tuple<bool, SkRect> DirectMaskSubRun::deviceRectAndCheckTransform(
!initialMatrix.hasPerspective();
if (compatibleMatrix && SkScalarIsInt(offset.x()) && SkScalarIsInt(offset.y())) {
- // Handle the integer offset case.
- // The offset should be integer, but make sure.
- SkIVector iOffset = {SkScalarRoundToInt(offset.x()), SkScalarRoundToInt(offset.y())};
-
- SkIRect outBounds = fGlyphDeviceBounds.iRect();
- return {true, SkRect::Make(outBounds.makeOffset(iOffset))};
+ return {true, fGlyphDeviceBounds.makeOffset(offset)};
} else if (SkMatrix inverse; fInitialPositionMatrix.invert(&inverse)) {
SkMatrix viewDifference = SkMatrix::Concat(positionMatrix, inverse);
- return {false, viewDifference.mapRect(fGlyphDeviceBounds.rect())};
+ return {false, viewDifference.mapRect(fGlyphDeviceBounds)};
}
// initialPositionMatrix is singular. Do nothing.
@@ -1522,7 +1709,8 @@ public:
static SubRunOwner Make(const SkZip<SkGlyphVariant, SkPoint>& accepted,
const SkMatrix& initialPositionMatrix,
- sk_sp<SkStrike>&& strike,
+ SkStrikePromise&& strikePromise,
+ SkRect sourceBounds,
SkScalar strikeToSourceScale,
MaskFormat maskType,
SubRunAllocator* alloc);
@@ -1548,6 +1736,13 @@ public:
sk_sp<SkRefCnt>&& subRunStorage,
skgpu::v1::SurfaceDrawContext*) const override;
#endif // SK_SUPPORT_GPU
+#if defined(SK_GRAPHITE_ENABLED)
+ void draw(SkCanvas*,
+ SkPoint drawOrigin,
+ const SkPaint&,
+ sk_sp<SkRefCnt> subRunStorage,
+ Device*) const override;
+#endif
int unflattenSize() const override;
@@ -1568,6 +1763,24 @@ public:
size_t vertexStride(const SkMatrix& drawMatrix) const override;
#endif // SK_SUPPORT_GPU
+#if defined(SK_GRAPHITE_ENABLED)
+ std::tuple<bool, int> regenerateAtlas(int begin, int end, Recorder*) const override;
+
+ std::tuple<Rect, Transform> boundsAndDeviceMatrix(const Transform&,
+ SkPoint drawOrigin) const override;
+
+ const Renderer* renderer() const override {
+ return &Renderer::TextDirect(fVertexFiller.grMaskType() == skgpu::MaskFormat::kA8);
+ }
+
+ void fillVertexData(DrawWriter*,
+ int offset, int count,
+ int ssboIndex,
+ SkScalar depth,
+ const skgpu::graphite::Transform& transform) const override;
+
+ MaskFormat maskFormat() const override { return fVertexFiller.grMaskType(); }
+#endif
int glyphCount() const override;
@@ -1597,14 +1810,15 @@ TransformedMaskSubRun::TransformedMaskSubRun(const SkMatrix& initialPositionMatr
SubRunOwner TransformedMaskSubRun::Make(const SkZip<SkGlyphVariant, SkPoint>& accepted,
const SkMatrix& initialPositionMatrix,
- sk_sp<SkStrike>&& strike,
+ SkStrikePromise&& strikePromise,
+ SkRect sourceBounds,
SkScalar strikeToSourceScale,
MaskFormat maskType,
SubRunAllocator* alloc) {
auto vertexFiller = TransformedMaskVertexFiller::Make(
- maskType, 0, strikeToSourceScale, accepted, alloc);
+ sourceBounds, maskType, 0, strikeToSourceScale, accepted, alloc);
- auto glyphVector = GlyphVector::Make(std::move(strike), accepted.get<0>(), alloc);
+ auto glyphVector = GlyphVector::Make(std::move(strikePromise), accepted.get<0>(), alloc);
return alloc->makeUnique<TransformedMaskSubRun>(
initialPositionMatrix, std::move(vertexFiller), std::move(glyphVector));
@@ -1615,11 +1829,13 @@ SubRunOwner TransformedMaskSubRun::MakeFromBuffer(const SkMatrix& initialPositio
SubRunAllocator* alloc,
const SkStrikeClient* client) {
auto vertexFiller = TransformedMaskVertexFiller::MakeFromBuffer(buffer, alloc);
- if (!buffer.validate(vertexFiller.has_value())) { return {}; }
+ if (!buffer.validate(vertexFiller.has_value())) { return nullptr; }
auto glyphVector = GlyphVector::MakeFromBuffer(buffer, client, alloc);
- if (!buffer.validate(glyphVector.has_value())) { return {}; }
- if (!buffer.validate(SkCount(glyphVector->glyphs()) == vertexFiller->count())) { return {}; }
+ if (!buffer.validate(glyphVector.has_value())) { return nullptr; }
+ if (!buffer.validate(SkCount(glyphVector->glyphs()) == vertexFiller->count())) {
+ return nullptr;
+ }
return alloc->makeUnique<TransformedMaskSubRun>(
initialPositionMatrix, std::move(*vertexFiller), std::move(*glyphVector));
}
@@ -1661,7 +1877,7 @@ TransformedMaskSubRun::makeAtlasTextOp(const GrClip* clip,
GrPaint grPaint;
SkPMColor4f drawingColor = calculate_colors(
- sdc, paint, viewMatrix, fVertexFiller.grMaskType(), &grPaint);
+ sdc, paint, viewMatrix, fVertexFiller.grMaskType(), sdc->surfaceProps(), &grPaint);
auto geometry = AtlasTextOp::Geometry::Make(*this,
drawMatrix,
@@ -1683,6 +1899,16 @@ TransformedMaskSubRun::makeAtlasTextOp(const GrClip* clip,
}
#endif // SK_SUPPORT_GPU
+#if defined(SK_GRAPHITE_ENABLED)
+void TransformedMaskSubRun::draw(SkCanvas*,
+ SkPoint drawOrigin,
+ const SkPaint& paint,
+ sk_sp<SkRefCnt> subRunStorage,
+ Device* device) const {
+ // TODO: see makeAtlasTextOp for Geometry set up
+ device->drawAtlasSubRun(this, drawOrigin, paint, std::move(subRunStorage));
+}
+#endif
// If we are not scaling the cache entry to be larger, than a cache with smaller glyphs may be
// better.
bool TransformedMaskSubRun::canReuse(const SkPaint& paint, const SkMatrix& positionMatrix) const {
@@ -1720,6 +1946,32 @@ size_t TransformedMaskSubRun::vertexStride(const SkMatrix& drawMatrix) const {
}
#endif // SK_SUPPORT_GPU
+#if defined(SK_GRAPHITE_ENABLED)
+std::tuple<bool, int> TransformedMaskSubRun::regenerateAtlas(int begin, int end,
+ Recorder* recorder) const {
+ return fGlyphs.regenerateAtlas(begin, end, fVertexFiller.grMaskType(), 1, recorder);
+}
+
+std::tuple<Rect, Transform> TransformedMaskSubRun::boundsAndDeviceMatrix(
+ const Transform& localToDevice, SkPoint drawOrigin) const {
+ return {Rect(fVertexFiller.localRect()),
+ localToDevice.preTranslate(drawOrigin.x(), drawOrigin.y())};
+}
+
+void TransformedMaskSubRun::fillVertexData(DrawWriter* dw,
+ int offset, int count,
+ int ssboIndex,
+ SkScalar depth,
+ const Transform& transform) const {
+ fVertexFiller.fillVertexData(dw,
+ offset, count,
+ ssboIndex,
+ fGlyphs.glyphs(),
+ depth,
+ transform);
+}
+#endif
+
int TransformedMaskSubRun::glyphCount() const {
return SkCount(fGlyphs.glyphs());
}
@@ -1743,7 +1995,8 @@ public:
static SubRunOwner Make(const SkZip<SkGlyphVariant, SkPoint>& accepted,
const SkFont& runFont,
- sk_sp<SkStrike>&& strike,
+ SkStrikePromise&& strikePromise,
+ SkRect sourceBounds,
SkScalar strikeToSourceScale,
const SDFTMatrixRange& matrixRange,
SubRunAllocator* alloc);
@@ -1769,6 +2022,13 @@ public:
sk_sp<SkRefCnt>&& subRunStorage,
skgpu::v1::SurfaceDrawContext*) const override;
#endif // SK_SUPPORT_GPU
+#if defined(SK_GRAPHITE_ENABLED)
+ void draw(SkCanvas*,
+ SkPoint drawOrigin,
+ const SkPaint&,
+ sk_sp<SkRefCnt> subRunStorage,
+ Device*) const override;
+#endif
int unflattenSize() const override;
@@ -1789,6 +2049,22 @@ public:
size_t vertexStride(const SkMatrix& drawMatrix) const override;
#endif // SK_SUPPORT_GPU
+#if defined(SK_GRAPHITE_ENABLED)
+ std::tuple<bool, int> regenerateAtlas(int begin, int end, Recorder*) const override;
+
+ std::tuple<Rect, Transform> boundsAndDeviceMatrix(const Transform&,
+ SkPoint drawOrigin) const override;
+
+ const Renderer* renderer() const override { return &Renderer::TextSDF(fUseLCDText); }
+
+ void fillVertexData(DrawWriter*,
+ int offset, int count,
+ int ssboIndex,
+ SkScalar depth,
+ const skgpu::graphite::Transform& transform) const override;
+
+ MaskFormat maskFormat() const override { return fVertexFiller.grMaskType(); }
+#endif
int glyphCount() const override;
@@ -1802,7 +2078,7 @@ private:
const bool fUseLCDText;
const bool fAntiAliased;
- const sktext::gpu::SDFTMatrixRange fMatrixRange;
+ const SDFTMatrixRange fMatrixRange;
const TransformedMaskVertexFiller fVertexFiller;
@@ -1830,18 +2106,20 @@ bool has_some_antialiasing(const SkFont& font ) {
SubRunOwner SDFTSubRun::Make(const SkZip<SkGlyphVariant, SkPoint>& accepted,
const SkFont& runFont,
- sk_sp<SkStrike>&& strike,
+ SkStrikePromise&& strikePromise,
+ SkRect sourceBounds,
SkScalar strikeToSourceScale,
const SDFTMatrixRange& matrixRange,
SubRunAllocator* alloc) {
auto vertexFiller = TransformedMaskVertexFiller::Make(
+ sourceBounds,
MaskFormat::kA8,
SK_DistanceFieldInset,
strikeToSourceScale,
accepted,
alloc);
- auto glyphVector = GlyphVector::Make(std::move(strike), accepted.get<0>(), alloc);
+ auto glyphVector = GlyphVector::Make(std::move(strikePromise), accepted.get<0>(), alloc);
return alloc->makeUnique<SDFTSubRun>(
runFont.getEdging() == SkFont::Edging::kSubpixelAntiAlias,
@@ -1859,10 +2137,12 @@ SubRunOwner SDFTSubRun::MakeFromBuffer(const SkMatrix&,
int isAntiAliased = buffer.readInt();
SDFTMatrixRange matrixRange = SDFTMatrixRange::MakeFromBuffer(buffer);
auto vertexFiller = TransformedMaskVertexFiller::MakeFromBuffer(buffer, alloc);
- if (!buffer.validate(vertexFiller.has_value())) { return {}; }
+ if (!buffer.validate(vertexFiller.has_value())) { return nullptr; }
auto glyphVector = GlyphVector::MakeFromBuffer(buffer, client, alloc);
- if (!buffer.validate(glyphVector.has_value())) { return {}; }
- if (!buffer.validate(SkCount(glyphVector->glyphs()) == vertexFiller->count())) { return {}; }
+ if (!buffer.validate(glyphVector.has_value())) { return nullptr; }
+ if (!buffer.validate(SkCount(glyphVector->glyphs()) == vertexFiller->count())) {
+ return nullptr;
+ }
return alloc->makeUnique<SDFTSubRun>(useLCD,
isAntiAliased,
matrixRange,
@@ -1938,7 +2218,7 @@ SDFTSubRun::makeAtlasTextOp(const GrClip* clip,
GrPaint grPaint;
SkPMColor4f drawingColor = calculate_colors(sdc, paint, viewMatrix, MaskFormat::kA8,
- &grPaint);
+ sdc->surfaceProps(), &grPaint);
auto [maskType, DFGPFlags, useGammaCorrectDistanceTable] =
calculate_sdf_parameters(*sdc, drawMatrix, fUseLCDText, fAntiAliased);
@@ -1967,6 +2247,17 @@ SDFTSubRun::makeAtlasTextOp(const GrClip* clip,
}
#endif // SK_SUPPORT_GPU
+#ifdef SK_GRAPHITE_ENABLED
+void SDFTSubRun::draw(SkCanvas*,
+ SkPoint drawOrigin,
+ const SkPaint& paint,
+ sk_sp<SkRefCnt> subRunStorage,
+ Device* device) const {
+ // TODO: see makeAtlasTextOp for Geometry set up
+ device->drawAtlasSubRun(this, drawOrigin, paint, std::move(subRunStorage));
+}
+#endif
+
bool SDFTSubRun::canReuse(const SkPaint& paint, const SkMatrix& positionMatrix) const {
return fMatrixRange.matrixInRange(positionMatrix);
}
@@ -2002,6 +2293,33 @@ void SDFTSubRun::fillVertexData(
}
#endif // SK_SUPPORT_GPU
+#if defined(SK_GRAPHITE_ENABLED)
+std::tuple<bool, int>
+SDFTSubRun::regenerateAtlas(int begin, int end, Recorder *recorder) const {
+ return fGlyphs.regenerateAtlas(begin, end, MaskFormat::kA8, SK_DistanceFieldInset,
+ recorder);
+}
+
+std::tuple<Rect, Transform> SDFTSubRun::boundsAndDeviceMatrix(const Transform& localToDevice,
+ SkPoint drawOrigin) const {
+ return {Rect(fVertexFiller.localRect()),
+ localToDevice.preTranslate(drawOrigin.x(), drawOrigin.y())};
+}
+
+void SDFTSubRun::fillVertexData(DrawWriter* dw,
+ int offset, int count,
+ int ssboIndex,
+ SkScalar depth,
+ const skgpu::graphite::Transform& transform) const {
+ fVertexFiller.fillVertexData(dw,
+ offset, count,
+ ssboIndex,
+ fGlyphs.glyphs(),
+ depth,
+ transform);
+}
+#endif
+
int SDFTSubRun::glyphCount() const {
return fVertexFiller.count();
}
@@ -2017,26 +2335,27 @@ const AtlasSubRun* SDFTSubRun::testingOnly_atlasSubRun() const {
template<typename AddSingleMaskFormat>
void add_multi_mask_format(
AddSingleMaskFormat addSingleMaskFormat,
- const SkZip<SkGlyphVariant, SkPoint>& accepted,
+ const SkZip<SkGlyphVariant, SkPoint, SkMask::Format>& accepted,
sk_sp<SkStrike>&& strike) {
if (accepted.empty()) { return; }
- auto glyphSpan = accepted.get<0>();
- const SkGlyph* glyph = glyphSpan[0];
- MaskFormat format = Glyph::FormatFromSkGlyph(glyph->maskFormat());
+ auto maskSpan = accepted.get<2>();
+ MaskFormat format = Glyph::FormatFromSkGlyph(maskSpan[0]);
size_t startIndex = 0;
for (size_t i = 1; i < accepted.size(); i++) {
- glyph = glyphSpan[i];
- MaskFormat nextFormat = Glyph::FormatFromSkGlyph(glyph->maskFormat());
+ MaskFormat nextFormat = Glyph::FormatFromSkGlyph(maskSpan[i]);
if (format != nextFormat) {
- auto glyphsWithSameFormat = accepted.subspan(startIndex, i - startIndex);
+ auto interval = accepted.subspan(startIndex, i - startIndex);
+ // Only pass the packed glyph ids and positions.
+ auto glyphsWithSameFormat = SkMakeZip(interval.get<0>(), interval.get<1>());
// Take a ref on the strike. This should rarely happen.
addSingleMaskFormat(glyphsWithSameFormat, format, sk_sp<SkStrike>(strike));
format = nextFormat;
startIndex = i;
}
}
- auto glyphsWithSameFormat = accepted.last(accepted.size() - startIndex);
+ auto interval = accepted.last(accepted.size() - startIndex);
+ auto glyphsWithSameFormat = SkMakeZip(interval.get<0>(), interval.get<1>());
addSingleMaskFormat(glyphsWithSameFormat, format, std::move(strike));
}
} // namespace
@@ -2133,26 +2452,28 @@ SubRunContainerOwner SubRunContainer::MakeFromBufferInAlloc(SkReadBuffer& buffer
return container;
}
-size_t SubRunContainer::EstimateAllocSize(const SkGlyphRunList& glyphRunList) {
+size_t SubRunContainer::EstimateAllocSize(const GlyphRunList& glyphRunList) {
// The difference in alignment from the per-glyph data to the SubRun;
- constexpr size_t alignDiff = alignof(DirectMaskSubRun) - alignof(DevicePosition);
+ constexpr size_t alignDiff = alignof(DirectMaskSubRun) - alignof(SkPoint);
constexpr size_t vertexDataToSubRunPadding = alignDiff > 0 ? alignDiff : 0;
size_t totalGlyphCount = glyphRunList.totalGlyphCount();
// This is optimized for DirectMaskSubRun which is by far the most common case.
- return totalGlyphCount * sizeof(DevicePosition)
+ return totalGlyphCount * sizeof(SkPoint)
+ GlyphVector::GlyphVectorSize(totalGlyphCount)
+ glyphRunList.runCount() * (sizeof(DirectMaskSubRun) + vertexDataToSubRunPadding)
+ sizeof(SubRunContainer);
}
-std::tuple<bool, SubRunContainerOwner> SubRunContainer::MakeInAlloc(
- const SkGlyphRunList& glyphRunList,
+SubRunContainerOwner SubRunContainer::MakeInAlloc(
+ const GlyphRunList& glyphRunList,
const SkMatrix& positionMatrix,
const SkPaint& runPaint,
SkStrikeDeviceInfo strikeDeviceInfo,
- SkStrikeForGPUCacheInterface* strikeCache,
+ StrikeForGPUCacheInterface* strikeCache,
SubRunAllocator* alloc,
+ SubRunCreationBehavior creationBehavior,
const char* tag) {
+ SkASSERT(alloc != nullptr);
[[maybe_unused]] SkString msg;
if constexpr (kTrace) {
const uint64_t uniqueID = glyphRunList.uniqueID();
@@ -2169,23 +2490,33 @@ std::tuple<bool, SubRunContainerOwner> SubRunContainer::MakeInAlloc(
positionMatrix[3], positionMatrix[4], positionMatrix[5]);
}
+ SubRunContainerOwner container = alloc->makeUnique<SubRunContainer>(positionMatrix);
SkASSERT(strikeDeviceInfo.fSDFTControl != nullptr);
+ // If there is no SDFT description ignore all SubRuns.
if (strikeDeviceInfo.fSDFTControl == nullptr) {
- return {true, nullptr};
- }
-
- SubRunContainerOwner container{nullptr};
- if (alloc != nullptr) {
- container = alloc->makeUnique<SubRunContainer>(positionMatrix);
+ return container;
}
const SkSurfaceProps deviceProps = strikeDeviceInfo.fSurfaceProps;
const SkScalerContextFlags scalerContextFlags = strikeDeviceInfo.fScalerContextFlags;
- const sktext::gpu::SDFTControl SDFTControl = *strikeDeviceInfo.fSDFTControl;
+ const SDFTControl SDFTControl = *strikeDeviceInfo.fSDFTControl;
auto bufferScope = SkSubRunBuffers::EnsureBuffers(glyphRunList);
auto [accepted, rejected] = bufferScope.buffers();
- bool someGlyphExcluded = false;
+ std::vector<SkPackedGlyphID> packedGlyphIDs;
+ SkSpan<SkPoint> positions;
+ // This rearranging of arrays is temporary until the updated buffer system is
+ // in place.
+ auto convertToGlyphIDs = [&](SkZip<SkGlyphVariant, SkPoint> good)
+ -> SkZip<SkPackedGlyphID, SkPoint> {
+ positions = good.get<1>();
+ packedGlyphIDs.resize(positions.size());
+
+ for (auto [packedGlyphID, variant] : SkMakeZip(packedGlyphIDs, good.get<0>())) {
+ packedGlyphID = variant.packedID();
+ }
+ return SkMakeZip(packedGlyphIDs, positions);
+ };
for (auto& glyphRun : glyphRunList) {
rejected->setSource(glyphRun.source());
const SkFont& runFont = glyphRun.font();
@@ -2207,27 +2538,29 @@ std::tuple<bool, SubRunContainerOwner> SubRunContainer::MakeInAlloc(
}
if (!SkScalarNearlyZero(strikeToSourceScale)) {
- SkScopedStrikeForGPU strike = strikeSpec.findOrCreateScopedStrike(strikeCache);
+ ScopedStrikeForGPU strike = strikeSpec.findOrCreateScopedStrike(strikeCache);
accepted->startSource(rejected->source());
if constexpr (kTrace) {
msg.appendf(" glyphs:(x,y):\n %s\n", accepted->dumpInput().c_str());
}
- strike->prepareForSDFTDrawing(accepted, rejected);
+ SkRect sourceBounds = strike->prepareForSDFTDrawing(
+ strikeToSourceScale, accepted, rejected);
rejected->flipRejectsToSource();
- if (container && !accepted->empty()) {
+ if (creationBehavior == kAddSubRuns && !accepted->empty()) {
container->fSubRuns.append(SDFTSubRun::Make(
accepted->accepted(),
runFont,
- strike->getUnderlyingStrike(),
+ strike->strikePromise(),
+ sourceBounds,
strikeToSourceScale,
matrixRange, alloc));
}
}
}
- if (!rejected->source().empty()) {
+ if (!rejected->source().empty() && !SDFTControl.forcePaths()) {
// Process masks including ARGB - this should be the 99.99% case.
// This will handle medium size emoji that are sharing the run with SDFT drawn text.
// If things are too big they will be passed along to the drawing of last resort
@@ -2239,45 +2572,39 @@ std::tuple<bool, SubRunContainerOwner> SubRunContainer::MakeInAlloc(
msg.appendf(" Mask case:\n%s", strikeSpec.dump().c_str());
}
- SkScopedStrikeForGPU strike = strikeSpec.findOrCreateScopedStrike(strikeCache);
+ ScopedStrikeForGPU strike = strikeSpec.findOrCreateScopedStrike(strikeCache);
accepted->startDevicePositioning(
rejected->source(), positionMatrix, strike->roundingSpec());
if constexpr (kTrace) {
msg.appendf(" glyphs:(x,y):\n %s\n", accepted->dumpInput().c_str());
}
- strike->prepareForMaskDrawing(accepted, rejected);
+ // The strikeToSourceScale is 1 because the entire CTM is used to generate the
+ // glyphs. No prescaling is needed.
+ SkRect bounds = strike->prepareForMaskDrawing(
+ 1 /* strikeToSourceScale */, accepted, rejected);
rejected->flipRejectsToSource();
- if (container && !accepted->empty()) {
+ if (creationBehavior == kAddSubRuns && !accepted->empty()) {
auto addGlyphsWithSameFormat =
[&](const SkZip<SkGlyphVariant, SkPoint>& acceptedGlyphsAndLocations,
MaskFormat format,
sk_sp<SkStrike>&& runStrike) {
- SubRunOwner subRun =
- DirectMaskSubRun::Make(acceptedGlyphsAndLocations,
+ container->fSubRuns.append(
+ DirectMaskSubRun::Make(bounds,
+ acceptedGlyphsAndLocations,
container->initialPosition(),
- std::move(runStrike),
+ strike->strikePromise(),
format,
- alloc);
- if (subRun != nullptr) {
- container->fSubRuns.append(std::move(subRun));
- } else {
- someGlyphExcluded |= true;
- }
+ alloc));
};
add_multi_mask_format(addGlyphsWithSameFormat,
- accepted->accepted(),
+ accepted->acceptedWithMaskFormat(),
strike->getUnderlyingStrike());
}
}
}
- // Glyphs are generated in different scales relative to the source space. Masks are drawn
- // in device space, and SDFT and Paths are draw in a fixed constant space. The
- // maxDimensionInSourceSpace is used to calculate the factor from strike space to source
- // space.
- SkScalar maxDimensionInSourceSpace = 0.0;
if (!rejected->source().empty()) {
// Drawable case - handle big things with that have a drawable.
auto [strikeSpec, strikeToSourceScale] =
@@ -2288,7 +2615,7 @@ std::tuple<bool, SubRunContainerOwner> SubRunContainer::MakeInAlloc(
}
if (!SkScalarNearlyZero(strikeToSourceScale)) {
- SkScopedStrikeForGPU strike = strikeSpec.findOrCreateScopedStrike(strikeCache);
+ ScopedStrikeForGPU strike = strikeSpec.findOrCreateScopedStrike(strikeCache);
accepted->startSource(rejected->source());
if constexpr (kTrace) {
@@ -2296,16 +2623,13 @@ std::tuple<bool, SubRunContainerOwner> SubRunContainer::MakeInAlloc(
}
strike->prepareForDrawableDrawing(accepted, rejected);
rejected->flipRejectsToSource();
- auto [minHint, maxHint] = rejected->maxDimensionHint();
- maxDimensionInSourceSpace = SkScalarCeilToScalar(maxHint * strikeToSourceScale);
- if (container && !accepted->empty()) {
- container->fSubRuns.append(
- make_drawable_sub_run<DrawableSubRun>(accepted->accepted(),
- strike->getUnderlyingStrike(),
- strikeToSourceScale,
- strikeSpec.descriptor(),
- alloc));
+ if (creationBehavior == kAddSubRuns && !accepted->empty()) {
+ container->fSubRuns.append(make_drawable_sub_run<DrawableSubRun>(
+ convertToGlyphIDs(accepted->accepted()),
+ strikeToSourceScale,
+ strike->strikePromise(),
+ alloc));
}
}
}
@@ -2319,75 +2643,150 @@ std::tuple<bool, SubRunContainerOwner> SubRunContainer::MakeInAlloc(
}
if (!SkScalarNearlyZero(strikeToSourceScale)) {
- SkScopedStrikeForGPU strike = strikeSpec.findOrCreateScopedStrike(strikeCache);
+ ScopedStrikeForGPU strike = strikeSpec.findOrCreateScopedStrike(strikeCache);
accepted->startSource(rejected->source());
if constexpr (kTrace) {
msg.appendf(" glyphs:(x,y):\n %s\n", accepted->dumpInput().c_str());
}
+
strike->prepareForPathDrawing(accepted, rejected);
rejected->flipRejectsToSource();
- auto [minHint, maxHint] = rejected->maxDimensionHint();
- maxDimensionInSourceSpace = SkScalarCeilToScalar(maxHint * strikeToSourceScale);
-
- if (container && !accepted->empty()) {
- container->fSubRuns.append(PathSubRun::Make(accepted->accepted(),
- has_some_antialiasing(runFont),
- strikeToSourceScale,
- strikeSpec.descriptor(),
- alloc));
+
+ if (creationBehavior == kAddSubRuns && !accepted->empty()) {
+ container->fSubRuns.append(
+ PathSubRun::Make(convertToGlyphIDs(accepted->accepted()),
+ has_some_antialiasing(runFont),
+ strikeToSourceScale,
+ strike->strikePromise(),
+ alloc));
}
}
}
- if (!rejected->source().empty() && maxDimensionInSourceSpace != 0) {
- // Draw of last resort. Scale the bitmap to the screen.
- auto [strikeSpec, strikeToSourceScaleTemp] = SkStrikeSpec::MakeSourceFallback(
- runFont, runPaint, deviceProps,
- scalerContextFlags, maxDimensionInSourceSpace);
+ if (!rejected->source().empty()) {
+ // Drawing of last resort - Scale masks that fit in the atlas to the screen using
+ // bilerp.
- if constexpr (kTrace) {
- msg.appendf("Transformed case:\n%s", strikeSpec.dump().c_str());
+ const SkMatrix* gaugingMatrix = &positionMatrix;
+ if (positionMatrix.hasPerspective()) {
+ // The Scaler can't take perspective matrices, so use I as our best guess.
+ gaugingMatrix = &SkMatrix::I();
+ }
+
+ // Remember, this will be an integer. Reduce to make a one pixel border for the
+ // bilerp padding.
+ static const constexpr SkScalar kMaxBilerpAtlasDimension =
+ SkGlyphDigest::kSkSideTooBigForAtlas - 2;
+
+ // Get the raw glyph IDs to simulate device drawing to figure the maximum device
+ // dimension.
+ const SkSpan<const SkGlyphID> glyphs = rejected->source().get<0>();
+
+ // It could be that this font produces glyphs that won't fit in the atlas. Find the
+ // largest glyph dimension for the glyph run.
+ SkStrikeSpec gaugingStrikeSpec = SkStrikeSpec::MakeTransformMask(
+ runFont, runPaint, deviceProps, scalerContextFlags, *gaugingMatrix);
+ ScopedStrikeForGPU gaugingStrike =
+ gaugingStrikeSpec.findOrCreateScopedStrike(strikeCache);
+
+ // Remember, this will be an integer.
+ const SkScalar originalMaxGlyphDimension =
+ gaugingStrike->findMaximumGlyphDimension(glyphs);
+
+ if (originalMaxGlyphDimension == 0) {
+ // Nothing to draw here. Skip this SubRun.
+ continue;
+ }
+
+ SkScalar strikeToSourceScale = 1;
+ SkFont reducedFont = runFont;
+ if (originalMaxGlyphDimension > kMaxBilerpAtlasDimension) {
+ // For glyphs that won't fit in the atlas, calculating the amount to reduce the
+ // size can't be done using simple ratios. This is because the SkScaler forces
+ // glyph width and height to integer amounts causing the ratio to be too high if
+ // it rounds up. If it does round up, you need to try again to find the maximum
+ // glyph dimensions and scale factor.
+ SkScalar maxGlyphDimension = originalMaxGlyphDimension;
+ SkScalar reductionFactor = kMaxBilerpAtlasDimension / maxGlyphDimension;
+
+ // Find a new reducedFont that produces a maximum glyph dimension that is
+ // <= kMaxBilerpAtlasDimension.
+ do {
+ // Make a smaller font that will hopefully fit in the atlas.
+ reducedFont.setSize(runFont.getSize() * reductionFactor);
+
+ // Create a strike to calculate the new reduced maximum glyph dimension.
+ SkStrikeSpec reducingStrikeSpec = SkStrikeSpec::MakeTransformMask(
+ reducedFont, runPaint, deviceProps, scalerContextFlags, *gaugingMatrix);
+ ScopedStrikeForGPU reducingStrike =
+ reducingStrikeSpec.findOrCreateScopedStrike(strikeCache);
+
+ // Remember, this will be an integer.
+ maxGlyphDimension = reducingStrike->findMaximumGlyphDimension(glyphs);
+ if (maxGlyphDimension == 0) {
+ // Avoid the divide by zero below.
+ goto skipSubRun;
+ }
+
+ // The largest reduction factor allowed for each iteration. Smaller reduction
+ // factors reduce the font size faster.
+ static constexpr SkScalar kMaximumReduction =
+ 1.0f - 1.0f / kMaxBilerpAtlasDimension;
+
+ // Make the reduction smaller by at least kMaximumReduction in case the
+ // maximum glyph dimension is too big.
+ reductionFactor *=
+ std::min(kMaximumReduction, kMaxBilerpAtlasDimension/maxGlyphDimension);
+ } while (maxGlyphDimension > kMaxBilerpAtlasDimension);
+
+ // Calculate the factor to make the maximum dimension of the reduced font be the
+ // same size as the maximum dimension from the original runFont.
+ strikeToSourceScale = originalMaxGlyphDimension / maxGlyphDimension;
}
- // Get around fake binding from structural decomposition. Bad c++.
- auto strikeToSourceScale = strikeToSourceScaleTemp;
if (!SkScalarNearlyZero(strikeToSourceScale)) {
- SkScopedStrikeForGPU strike = strikeSpec.findOrCreateScopedStrike(strikeCache);
+ SkStrikeSpec strikeSpec = SkStrikeSpec::MakeTransformMask(
+ reducedFont, runPaint, deviceProps, scalerContextFlags, SkMatrix::I());
+ if constexpr (kTrace) {
+ msg.appendf("Transformed case:\n%s", strikeSpec.dump().c_str());
+ }
+ ScopedStrikeForGPU strike = strikeSpec.findOrCreateScopedStrike(strikeCache);
accepted->startSource(rejected->source());
if constexpr (kTrace) {
msg.appendf("glyphs:(x,y):\n %s\n", accepted->dumpInput().c_str());
}
- strike->prepareForMaskDrawing(accepted, rejected);
+ SkRect sourceBounds = strike->prepareForMaskDrawing(
+ strikeToSourceScale, accepted, rejected);
rejected->flipRejectsToSource();
SkASSERT(rejected->source().empty());
- if (container && !accepted->empty()) {
+ if (creationBehavior == kAddSubRuns && !accepted->empty()) {
auto addGlyphsWithSameFormat =
[&](const SkZip<SkGlyphVariant, SkPoint>& acceptedGlyphsAndLocations,
MaskFormat format,
sk_sp<SkStrike>&& runStrike) {
- SubRunOwner subRun =
+ container->fSubRuns.append(
TransformedMaskSubRun::Make(acceptedGlyphsAndLocations,
container->initialPosition(),
- std::move(runStrike),
+ strike->strikePromise(),
+ sourceBounds,
strikeToSourceScale,
format,
- alloc);
- if (subRun != nullptr) {
- container->fSubRuns.append(std::move(subRun));
- } else {
- someGlyphExcluded |= true;
- }
+ alloc));
};
add_multi_mask_format(addGlyphsWithSameFormat,
- accepted->accepted(),
+ accepted->acceptedWithMaskFormat(),
strike->getUnderlyingStrike());
}
}
}
+
+ skipSubRun:
+ ;
}
+
if constexpr (kTrace) {
msg.appendf("End glyph run processing");
if (tag != nullptr) {
@@ -2395,7 +2794,7 @@ std::tuple<bool, SubRunContainerOwner> SubRunContainer::MakeInAlloc(
}
SkDebugf("%s\n", msg.c_str());
}
- return {someGlyphExcluded, std::move(container)};
+ return container;
}
#if SK_SUPPORT_GPU
@@ -2412,6 +2811,18 @@ void SubRunContainer::draw(SkCanvas* canvas,
}
#endif // SK_SUPPORT_GPU
+#if defined(SK_GRAPHITE_ENABLED)
+void SubRunContainer::draw(SkCanvas* canvas,
+ SkPoint drawOrigin,
+ const SkPaint& paint,
+ const SkRefCnt* subRunStorage,
+ skgpu::graphite::Device* device) const {
+ for (auto& subRun : fSubRuns) {
+ subRun.draw(canvas, drawOrigin, paint, sk_ref_sp(subRunStorage), device);
+ }
+}
+#endif
+
bool SubRunContainer::canReuse(const SkPaint& paint, const SkMatrix& positionMatrix) const {
for (const SubRun& subRun : fSubRuns) {
if (!subRun.canReuse(paint, positionMatrix)) {
@@ -2420,5 +2831,4 @@ bool SubRunContainer::canReuse(const SkPaint& paint, const SkMatrix& positionMat
}
return true;
}
-
} // namespace sktext::gpu
diff --git a/chromium/third_party/skia/src/text/gpu/SubRunContainer.h b/chromium/third_party/skia/src/text/gpu/SubRunContainer.h
index e391e40aebf..56d04e147ab 100644
--- a/chromium/third_party/skia/src/text/gpu/SubRunContainer.h
+++ b/chromium/third_party/skia/src/text/gpu/SubRunContainer.h
@@ -13,18 +13,20 @@
#include "src/core/SkDevice.h"
#include "src/text/gpu/SubRunAllocator.h"
-class SkGlyphRunList;
class SkMatrix;
class SkMatrixProvider;
class SkPaint;
class SkReadBuffer;
class SkStrikeClient;
-class SkStrikeForGPUCacheInterface;
class SkWriteBuffer;
-namespace sktext::gpu {
-class Glyph;
-class StrikeCache;
+namespace sktext {
+class GlyphRunList;
+class StrikeForGPUCacheInterface;
+ namespace gpu {
+ class Glyph;
+ class StrikeCache;
+ }
}
#if SK_SUPPORT_GPU // Ganesh support
@@ -38,6 +40,22 @@ class GrClip;
namespace skgpu::v1 { class SurfaceDrawContext; }
#endif
+#if defined(SK_GRAPHITE_ENABLED)
+#include "src/gpu/graphite/geom/Rect.h"
+#include "src/gpu/graphite/geom/SubRunData.h"
+#include "src/gpu/graphite/geom/Transform_graphite.h"
+
+namespace skgpu {
+enum class MaskFormat : int;
+}
+
+namespace skgpu::graphite {
+class DrawWriter;
+class Recorder;
+class Renderer;
+}
+#endif
+
namespace sktext::gpu {
// -- AtlasSubRun --------------------------------------------------------------------------------
// AtlasSubRun is the API that AtlasTextOp uses to generate vertex data for drawing.
@@ -84,6 +102,26 @@ public:
int begin, int end, GrMeshDrawTarget* target) const = 0;
#endif
+#if defined(SK_GRAPHITE_ENABLED)
+ virtual std::tuple<bool, int> regenerateAtlas(
+ int begin, int end, skgpu::graphite::Recorder*) const = 0;
+
+ // returns bounds of the stored data and matrix to transform it to device space
+ virtual std::tuple<skgpu::graphite::Rect, skgpu::graphite::Transform> boundsAndDeviceMatrix(
+ const skgpu::graphite::Transform& localToDevice, SkPoint drawOrigin) const = 0;
+
+ virtual const skgpu::graphite::Renderer* renderer() const = 0;
+
+ virtual void fillVertexData(
+ skgpu::graphite::DrawWriter*,
+ int offset, int count,
+ int ssboIndex,
+ SkScalar depth,
+ const skgpu::graphite::Transform& transform) const = 0;
+
+ virtual skgpu::MaskFormat maskFormat() const = 0;
+#endif
+
virtual void testingOnly_packedGlyphIDToGlyph(StrikeCache* cache) const = 0;
};
@@ -105,6 +143,14 @@ public:
sk_sp<SkRefCnt> subRunStorage,
skgpu::v1::SurfaceDrawContext*) const = 0;
#endif
+#if defined(SK_GRAPHITE_ENABLED)
+ // Produce uploads and draws for this subRun
+ virtual void draw(SkCanvas*,
+ SkPoint drawOrigin,
+ const SkPaint&,
+ sk_sp<SkRefCnt> subRunStorage,
+ skgpu::graphite::Device*) const = 0;
+#endif
void flatten(SkWriteBuffer& buffer) const;
static SubRunOwner MakeFromBuffer(const SkMatrix& initialPositionMatrix,
@@ -194,16 +240,20 @@ public:
const SkStrikeClient* client,
SubRunAllocator* alloc);
- static std::tuple<bool, SubRunContainerOwner> MakeInAlloc(
- const SkGlyphRunList& glyphRunList,
+ enum SubRunCreationBehavior {kAddSubRuns, kStrikeCalculationsOnly};
+ // The returned SubRunContainerOwner will never be null. If subRunCreation ==
+ // kStrikeCalculationsOnly, then the returned container will be empty.
+ static SK_WARN_UNUSED_RESULT SubRunContainerOwner MakeInAlloc(
+ const GlyphRunList& glyphRunList,
const SkMatrix& positionMatrix,
const SkPaint& runPaint,
SkStrikeDeviceInfo strikeDeviceInfo,
- SkStrikeForGPUCacheInterface* strikeCache,
+ StrikeForGPUCacheInterface* strikeCache,
sktext::gpu::SubRunAllocator* alloc,
+ SubRunCreationBehavior creationBehavior,
const char* tag);
- static size_t EstimateAllocSize(const SkGlyphRunList& glyphRunList);
+ static size_t EstimateAllocSize(const GlyphRunList& glyphRunList);
#if SK_SUPPORT_GPU
void draw(SkCanvas* canvas,
@@ -214,6 +264,13 @@ public:
const SkRefCnt* subRunStorage,
skgpu::v1::SurfaceDrawContext* sdc) const;
#endif
+#ifdef SK_GRAPHITE_ENABLED
+ void draw(SkCanvas*,
+ SkPoint drawOrigin,
+ const SkPaint&,
+ const SkRefCnt* subRunStorage,
+ skgpu::graphite::Device*) const;
+#endif
const SkMatrix& initialPosition() const { return fInitialPositionMatrix; }
bool isEmpty() const { return fSubRuns.isEmpty(); }
@@ -225,4 +282,5 @@ private:
SubRunList fSubRuns;
};
} // namespace sktext::gpu
+
#endif // sktext_gpu_SubRunContainer_DEFINED
diff --git a/chromium/third_party/skia/src/text/gpu/TextBlob.cpp b/chromium/third_party/skia/src/text/gpu/TextBlob.cpp
index c0f879f29cd..f2682ccf2e1 100644
--- a/chromium/third_party/skia/src/text/gpu/TextBlob.cpp
+++ b/chromium/third_party/skia/src/text/gpu/TextBlob.cpp
@@ -24,7 +24,6 @@
#include "include/private/chromium/SkChromeRemoteGlyphCache.h"
#include "include/private/chromium/Slug.h"
#include "src/core/SkFontPriv.h"
-#include "src/core/SkGlyphRun.h"
#include "src/core/SkMaskFilterBase.h"
#include "src/core/SkMatrixProvider.h"
#include "src/core/SkPaintPriv.h"
@@ -32,13 +31,14 @@
#include "src/core/SkRectPriv.h"
#include "src/core/SkStrikeCache.h"
#include "src/core/SkWriteBuffer.h"
+#include "src/text/GlyphRun.h"
#include "src/text/gpu/SubRunAllocator.h"
#include "src/text/gpu/SubRunContainer.h"
#if SK_SUPPORT_GPU // Ganesh Support
+#include "src/gpu/ganesh/Device_v1.h"
#include "src/gpu/ganesh/GrClip.h"
-#include "src/gpu/ganesh/v1/Device_v1.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#endif
using namespace sktext::gpu;
@@ -103,11 +103,11 @@ public:
~SlugImpl() override = default;
static sk_sp<SlugImpl> Make(const SkMatrixProvider& viewMatrix,
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
const SkPaint& initialPaint,
const SkPaint& drawingPaint,
SkStrikeDeviceInfo strikeDeviceInfo,
- SkStrikeForGPUCacheInterface* strikeCache);
+ sktext::StrikeForGPUCacheInterface* strikeCache);
static sk_sp<Slug> MakeFromBuffer(SkReadBuffer& buffer,
const SkStrikeClient* client);
void doFlatten(SkWriteBuffer& buffer) const override;
@@ -191,11 +191,11 @@ sk_sp<Slug> SlugImpl::MakeFromBuffer(SkReadBuffer& buffer, const SkStrikeClient*
}
sk_sp<SlugImpl> SlugImpl::Make(const SkMatrixProvider& viewMatrix,
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
const SkPaint& initialPaint,
const SkPaint& drawingPaint,
SkStrikeDeviceInfo strikeDeviceInfo,
- SkStrikeForGPUCacheInterface* strikeCache) {
+ sktext::StrikeForGPUCacheInterface* strikeCache) {
size_t subRunSizeHint = SubRunContainer::EstimateAllocSize(glyphRunList);
auto [initializer, _, alloc] =
SubRunAllocator::AllocateClassMemoryAndArena<SlugImpl>(subRunSizeHint);
@@ -203,13 +203,14 @@ sk_sp<SlugImpl> SlugImpl::Make(const SkMatrixProvider& viewMatrix,
const SkMatrix positionMatrix =
position_matrix(viewMatrix.localToDevice(), glyphRunList.origin());
- auto [__, subRuns] = SubRunContainer::MakeInAlloc(glyphRunList,
- positionMatrix,
- drawingPaint,
- strikeDeviceInfo,
- strikeCache,
- &alloc,
- "Make Slug");
+ auto subRuns = SubRunContainer::MakeInAlloc(glyphRunList,
+ positionMatrix,
+ drawingPaint,
+ strikeDeviceInfo,
+ strikeCache,
+ &alloc,
+ SubRunContainer::kAddSubRuns,
+ "Make Slug");
sk_sp<SlugImpl> slug = sk_sp<SlugImpl>(initializer.initialize(
std::move(alloc),
@@ -228,7 +229,7 @@ sk_sp<SlugImpl> SlugImpl::Make(const SkMatrixProvider& viewMatrix,
namespace sktext::gpu {
// -- TextBlob::Key ------------------------------------------------------------------------------
-auto TextBlob::Key::Make(const SkGlyphRunList& glyphRunList,
+auto TextBlob::Key::Make(const GlyphRunList& glyphRunList,
const SkPaint& paint,
const SkMatrix& drawMatrix,
const SkStrikeDeviceInfo& strikeDevice) -> std::tuple<bool, Key> {
@@ -340,28 +341,24 @@ void* TextBlob::operator new(size_t, void* p) { return p; }
TextBlob::~TextBlob() = default;
-sk_sp<TextBlob> TextBlob::Make(const SkGlyphRunList& glyphRunList,
+sk_sp<TextBlob> TextBlob::Make(const GlyphRunList& glyphRunList,
const SkPaint& paint,
const SkMatrix& positionMatrix,
SkStrikeDeviceInfo strikeDeviceInfo,
- SkStrikeForGPUCacheInterface* strikeCache) {
+ StrikeForGPUCacheInterface* strikeCache) {
size_t subRunSizeHint = SubRunContainer::EstimateAllocSize(glyphRunList);
auto [initializer, totalMemoryAllocated, alloc] =
SubRunAllocator::AllocateClassMemoryAndArena<TextBlob>(subRunSizeHint);
- auto [someGlyphExcluded, container] = SubRunContainer::MakeInAlloc(
+ auto container = SubRunContainer::MakeInAlloc(
glyphRunList, positionMatrix, paint,
- strikeDeviceInfo, strikeCache, &alloc, "TextBlob");
+ strikeDeviceInfo, strikeCache, &alloc, SubRunContainer::kAddSubRuns, "TextBlob");
SkColor initialLuminance = SkPaintPriv::ComputeLuminanceColor(paint);
sk_sp<TextBlob> blob = sk_sp<TextBlob>(initializer.initialize(std::move(alloc),
std::move(container),
totalMemoryAllocated,
initialLuminance));
-
- // Be sure to pass the ref to the matrix that the SubRuns will capture.
- blob->fSomeGlyphsExcluded = someGlyphExcluded;
-
return blob;
}
@@ -375,10 +372,11 @@ bool TextBlob::hasPerspective() const {
bool TextBlob::canReuse(const SkPaint& paint, const SkMatrix& positionMatrix) const {
// A singular matrix will create a TextBlob with no SubRuns, but unknown glyphs can
- // also cause empty runs. If there are no subRuns or some glyphs were excluded or perspective,
- // then regenerate when the matrices don't match.
- if ((fSubRuns->isEmpty() || fSomeGlyphsExcluded || hasPerspective()) &&
- fSubRuns->initialPosition() != positionMatrix) {
+ // also cause empty runs. If there are no subRuns or perspective, then regenerate when the
+ // matrices don't match.
+ if ((fSubRuns->isEmpty() || this->hasPerspective()) &&
+ fSubRuns->initialPosition() != positionMatrix)
+ {
return false;
}
@@ -397,15 +395,24 @@ const TextBlob::Key& TextBlob::key() const { return fKey; }
#if SK_SUPPORT_GPU
void TextBlob::draw(SkCanvas* canvas,
- const GrClip* clip,
- const SkMatrixProvider& viewMatrix,
- SkPoint drawOrigin,
- const SkPaint& paint,
- skgpu::v1::SurfaceDrawContext* sdc) {
+ const GrClip* clip,
+ const SkMatrixProvider& viewMatrix,
+ SkPoint drawOrigin,
+ const SkPaint& paint,
+ skgpu::v1::SurfaceDrawContext* sdc) {
fSubRuns->draw(canvas, clip, viewMatrix, drawOrigin, paint, this, sdc);
}
#endif
+#if defined(SK_GRAPHITE_ENABLED)
+void TextBlob::draw(SkCanvas* canvas,
+ SkPoint drawOrigin,
+ const SkPaint& paint,
+ skgpu::graphite::Device* device) {
+ fSubRuns->draw(canvas, drawOrigin, paint, this, device);
+}
+#endif
+
#if GR_TEST_UTILS
struct SubRunContainerPeer {
static const AtlasSubRun* getAtlasSubRun(const SubRunContainer& subRuns) {
@@ -442,7 +449,7 @@ sk_sp<Slug> SkMakeSlugFromBuffer(SkReadBuffer& buffer, const SkStrikeClient* cli
#if SK_SUPPORT_GPU
namespace skgpu::v1 {
sk_sp<Slug>
-Device::convertGlyphRunListToSlug(const SkGlyphRunList& glyphRunList,
+Device::convertGlyphRunListToSlug(const sktext::GlyphRunList& glyphRunList,
const SkPaint& initialPaint,
const SkPaint& drawingPaint) {
return SlugImpl::Make(this->asMatrixProvider(),
@@ -472,11 +479,11 @@ void Device::drawSlug(SkCanvas* canvas, const Slug* slug, const SkPaint& drawing
}
sk_sp<Slug> MakeSlug(const SkMatrixProvider& drawMatrix,
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
const SkPaint& initialPaint,
const SkPaint& drawingPaint,
SkStrikeDeviceInfo strikeDeviceInfo,
- SkStrikeForGPUCacheInterface* strikeCache) {
+ sktext::StrikeForGPUCacheInterface* strikeCache) {
return SlugImpl::Make(
drawMatrix, glyphRunList, initialPaint, drawingPaint, strikeDeviceInfo, strikeCache);
}
diff --git a/chromium/third_party/skia/src/text/gpu/TextBlob.h b/chromium/third_party/skia/src/text/gpu/TextBlob.h
index 068171ad675..a366d22cc91 100644
--- a/chromium/third_party/skia/src/text/gpu/TextBlob.h
+++ b/chromium/third_party/skia/src/text/gpu/TextBlob.h
@@ -17,16 +17,18 @@
#include "src/core/SkTInternalLList.h"
#include "src/text/gpu/SubRunContainer.h"
-class SkGlyphRunList;
class SkMatrixProvider;
class SkStrikeClient;
class SkSurfaceProps;
class SkTextBlob;
class SkTextBlobRunIterator;
-namespace sktext::gpu {
-class Glyph;
-class StrikeCache;
+namespace sktext {
+class GlyphRunList;
+ namespace gpu {
+ class Glyph;
+ class StrikeCache;
+ }
}
#if SK_SUPPORT_GPU // Ganesh support
@@ -60,7 +62,7 @@ public:
// Key is not used as part of a hash map, so the hash is never taken. It's only used in a
// list search using operator =().
struct Key {
- static std::tuple<bool, Key> Make(const SkGlyphRunList& glyphRunList,
+ static std::tuple<bool, Key> Make(const GlyphRunList& glyphRunList,
const SkPaint& paint,
const SkMatrix& drawMatrix,
const SkStrikeDeviceInfo& strikeDevice);
@@ -88,11 +90,11 @@ public:
SK_DECLARE_INTERNAL_LLIST_INTERFACE(TextBlob);
// Make a TextBlob and its sub runs.
- static sk_sp<TextBlob> Make(const SkGlyphRunList& glyphRunList,
+ static sk_sp<TextBlob> Make(const sktext::GlyphRunList& glyphRunList,
const SkPaint& paint,
const SkMatrix& positionMatrix,
SkStrikeDeviceInfo strikeDeviceInfo,
- SkStrikeForGPUCacheInterface* strikeCache);
+ StrikeForGPUCacheInterface* strikeCache);
TextBlob(SubRunAllocator&& alloc,
SubRunContainerOwner subRuns,
@@ -125,6 +127,12 @@ public:
const SkPaint& paint,
skgpu::v1::SurfaceDrawContext* sdc);
#endif
+#if defined(SK_GRAPHITE_ENABLED)
+ void draw(SkCanvas*,
+ SkPoint drawOrigin,
+ const SkPaint& paint,
+ skgpu::graphite::Device* device);
+#endif
const AtlasSubRun* testingOnlyFirstSubRun() const;
private:
@@ -140,18 +148,16 @@ private:
const SkColor fInitialLuminance;
Key fKey;
-
- bool fSomeGlyphsExcluded{false};
};
} // namespace sktext::gpu
namespace skgpu::v1 {
sk_sp<sktext::gpu::Slug> MakeSlug(const SkMatrixProvider& drawMatrix,
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
const SkPaint& initialPaint,
const SkPaint& drawingPaint,
SkStrikeDeviceInfo strikeDeviceInfo,
- SkStrikeForGPUCacheInterface* strikeCache);
+ sktext::StrikeForGPUCacheInterface* strikeCache);
} // namespace skgpu::v1
#endif // sktext_gpu_TextBlob_DEFINED
diff --git a/chromium/third_party/skia/src/text/gpu/TextBlobRedrawCoordinator.cpp b/chromium/third_party/skia/src/text/gpu/TextBlobRedrawCoordinator.cpp
index e5fe72ea2db..c3d5ff374fb 100644
--- a/chromium/third_party/skia/src/text/gpu/TextBlobRedrawCoordinator.cpp
+++ b/chromium/third_party/skia/src/text/gpu/TextBlobRedrawCoordinator.cpp
@@ -7,10 +7,10 @@
#include "src/text/gpu/TextBlobRedrawCoordinator.h"
-#include "src/core/SkGlyphRun.h"
#include "src/core/SkStrikeCache.h"
+#include "src/text/GlyphRun.h"
#if SK_SUPPORT_GPU
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#endif
// This needs to be outside the namespace so we can declare SkMessageBus properly
@@ -32,7 +32,7 @@ TextBlobRedrawCoordinator::TextBlobRedrawCoordinator(uint32_t messageBusID)
void TextBlobRedrawCoordinator::drawGlyphRunList(SkCanvas* canvas,
const GrClip* clip,
const SkMatrixProvider& viewMatrix,
- const SkGlyphRunList& glyphRunList,
+ const GlyphRunList& glyphRunList,
const SkPaint& paint,
SkStrikeDeviceInfo strikeDeviceInfo,
skgpu::v1::SurfaceDrawContext* sdc) {
@@ -43,8 +43,22 @@ void TextBlobRedrawCoordinator::drawGlyphRunList(SkCanvas* canvas,
}
#endif
+#if defined(SK_GRAPHITE_ENABLED)
+void TextBlobRedrawCoordinator::drawGlyphRunList(SkCanvas* canvas,
+ const SkMatrix& viewMatrix,
+ const sktext::GlyphRunList& glyphRunList,
+ const SkPaint& paint,
+ SkStrikeDeviceInfo strikeDeviceInfo,
+ skgpu::graphite::Device* device) {
+ sk_sp<TextBlob> blob = this->findOrCreateBlob(viewMatrix, glyphRunList, paint,
+ strikeDeviceInfo);
+
+ blob->draw(canvas, glyphRunList.origin(), paint, device);
+}
+#endif
+
sk_sp<TextBlob> TextBlobRedrawCoordinator::findOrCreateBlob(const SkMatrixProvider& viewMatrix,
- const SkGlyphRunList& glyphRunList,
+ const GlyphRunList& glyphRunList,
const SkPaint& paint,
SkStrikeDeviceInfo strikeDeviceInfo) {
SkMatrix positionMatrix{viewMatrix.localToDevice()};
@@ -79,7 +93,7 @@ sk_sp<TextBlob> TextBlobRedrawCoordinator::findOrCreateBlob(const SkMatrixProvid
}
sk_sp<TextBlob> TextBlobRedrawCoordinator::addOrReturnExisting(
- const SkGlyphRunList& glyphRunList, sk_sp<TextBlob> blob) {
+ const GlyphRunList& glyphRunList, sk_sp<TextBlob> blob) {
SkAutoSpinlock lock{fSpinLock};
blob = this->internalAdd(std::move(blob));
glyphRunList.temporaryShuntBlobNotifyAddedToCache(fMessageBusID);
diff --git a/chromium/third_party/skia/src/text/gpu/TextBlobRedrawCoordinator.h b/chromium/third_party/skia/src/text/gpu/TextBlobRedrawCoordinator.h
index 4196599da37..4996191a8ad 100644
--- a/chromium/third_party/skia/src/text/gpu/TextBlobRedrawCoordinator.h
+++ b/chromium/third_party/skia/src/text/gpu/TextBlobRedrawCoordinator.h
@@ -36,11 +36,20 @@ public:
void drawGlyphRunList(SkCanvas* canvas,
const GrClip* clip,
const SkMatrixProvider& viewMatrix,
- const SkGlyphRunList& glyphRunList,
+ const GlyphRunList& glyphRunList,
const SkPaint& paint,
SkStrikeDeviceInfo strikeDeviceInfo,
skgpu::v1::SurfaceDrawContext* sdc);
#endif
+#if defined(SK_GRAPHITE_ENABLED)
+ void drawGlyphRunList(SkCanvas* canvas,
+ const SkMatrix& viewMatrix,
+ const GlyphRunList& glyphRunList,
+ const SkPaint& paint,
+ SkStrikeDeviceInfo strikeDeviceInfo,
+ skgpu::graphite::Device* device);
+#endif
+
void freeAll() SK_EXCLUDES(fSpinLock);
struct PurgeBlobMessage {
@@ -84,13 +93,13 @@ private:
};
sk_sp<TextBlob> findOrCreateBlob(const SkMatrixProvider& viewMatrix,
- const SkGlyphRunList& glyphRunList,
+ const GlyphRunList& glyphRunList,
const SkPaint& paint,
SkStrikeDeviceInfo strikeDeviceInfo);
// If not already in the cache, then add it else, return the text blob from the cache.
sk_sp<TextBlob> addOrReturnExisting(
- const SkGlyphRunList& glyphRunList,
+ const GlyphRunList& glyphRunList,
sk_sp<TextBlob> blob) SK_EXCLUDES(fSpinLock);
sk_sp<TextBlob> find(const TextBlob::Key& key) SK_EXCLUDES(fSpinLock);
diff --git a/chromium/third_party/skia/src/utils/BUILD.bazel b/chromium/third_party/skia/src/utils/BUILD.bazel
index ccd6bc24f90..a124b8bf890 100644
--- a/chromium/third_party/skia/src/utils/BUILD.bazel
+++ b/chromium/third_party/skia/src/utils/BUILD.bazel
@@ -1,4 +1,4 @@
-load("//bazel:macros.bzl", "exports_files_legacy", "split_srcs_and_hdrs")
+load("//bazel:macros.bzl", "exports_files_legacy", "selects", "split_srcs_and_hdrs")
licenses(["notice"])
@@ -27,6 +27,7 @@ CORE_FILES = [
"SkFloatToDecimal.cpp",
"SkFloatToDecimal.h",
"SkFloatUtils.h",
+ "SkGaussianColorFilter.cpp",
"SkJSON.h",
"SkJSONWriter.h",
"SkMatrix22.cpp",
@@ -50,7 +51,6 @@ CORE_FILES = [
"SkShadowTessellator.cpp",
"SkShadowTessellator.h",
"SkShadowUtils.cpp",
- "SkShaperJSONWriter.h",
"SkTestCanvas.h",
"SkTextUtils.cpp",
"SkUTF.cpp",
@@ -65,26 +65,43 @@ split_srcs_and_hdrs(
)
filegroup(
+ name = "json_hdrs",
+ srcs = [
+ "SkJSON.h",
+ "SkJSONWriter.h",
+ ],
+ visibility = [
+ "//modules/skottie:__pkg__",
+ ],
+)
+
+filegroup(
name = "json_srcs",
srcs = [
"SkJSON.cpp",
- "SkJSON.h",
"SkJSONWriter.cpp",
- "SkJSONWriter.h",
- "SkShaperJSONWriter.cpp",
- "SkShaperJSONWriter.h",
],
visibility = [
"//modules/skottie:__pkg__",
],
)
+selects.config_setting_group(
+ name = "needs_json",
+ match_any = [
+ "//src/sksl:enable_sksl_tracing_true",
+ ],
+)
+
filegroup(
name = "srcs",
srcs = [
":core_srcs",
] + select({
- "//bazel/common_config_settings:needs_sksl": ["SkShaderUtils.cpp"],
+ "//src/sksl:needs_sksl": ["SkShaderUtils.cpp"],
+ "//conditions:default": [],
+ }) + select({
+ ":needs_json": [":json_srcs"],
"//conditions:default": [],
}),
visibility = ["//src:__pkg__"],
@@ -95,7 +112,10 @@ filegroup(
srcs = [
":core_hdrs",
] + select({
- "//bazel/common_config_settings:needs_sksl": ["SkShaderUtils.h"],
+ "//src/sksl:needs_sksl": ["SkShaderUtils.h"],
+ "//conditions:default": [],
+ }) + select({
+ ":needs_json": [":json_hdrs"],
"//conditions:default": [],
}),
visibility = ["//src:__pkg__"],
diff --git a/chromium/third_party/skia/src/utils/SkAnimCodecPlayer.cpp b/chromium/third_party/skia/src/utils/SkAnimCodecPlayer.cpp
index da6079845b3..f296a4081d9 100644
--- a/chromium/third_party/skia/src/utils/SkAnimCodecPlayer.cpp
+++ b/chromium/third_party/skia/src/utils/SkAnimCodecPlayer.cpp
@@ -24,6 +24,7 @@
#include "src/codec/SkCodecImageGenerator.h"
#include <algorithm>
+#include <cstddef>
#include <memory>
#include <utility>
#include <vector>
diff --git a/chromium/third_party/skia/src/utils/SkBase64.cpp b/chromium/third_party/skia/src/utils/SkBase64.cpp
index e218dd7a43f..4ebb9d7ae27 100644
--- a/chromium/third_party/skia/src/utils/SkBase64.cpp
+++ b/chromium/third_party/skia/src/utils/SkBase64.cpp
@@ -8,6 +8,8 @@
#include "include/utils/SkBase64.h"
+#include <cstdint>
+
#define DecodePad -2
#define EncodePad 64
diff --git a/chromium/third_party/skia/src/utils/SkCanvasStateUtils.cpp b/chromium/third_party/skia/src/utils/SkCanvasStateUtils.cpp
index f35c6074d09..fe881eb2f86 100644
--- a/chromium/third_party/skia/src/utils/SkCanvasStateUtils.cpp
+++ b/chromium/third_party/skia/src/utils/SkCanvasStateUtils.cpp
@@ -22,6 +22,8 @@
#include "src/core/SkWriter32.h"
#include "src/utils/SkCanvasStack.h"
+#include <cstddef>
+#include <cstdint>
#include <utility>
/*
diff --git a/chromium/third_party/skia/src/utils/SkCharToGlyphCache.h b/chromium/third_party/skia/src/utils/SkCharToGlyphCache.h
index 53f3d1cfb19..cd656ff1100 100644
--- a/chromium/third_party/skia/src/utils/SkCharToGlyphCache.h
+++ b/chromium/third_party/skia/src/utils/SkCharToGlyphCache.h
@@ -12,6 +12,8 @@
#include "include/private/SkTDArray.h"
#include "include/private/SkTo.h"
+#include <cstdint>
+
class SkCharToGlyphCache {
public:
SkCharToGlyphCache();
diff --git a/chromium/third_party/skia/src/utils/SkCustomTypeface.cpp b/chromium/third_party/skia/src/utils/SkCustomTypeface.cpp
index 5d3fd56862c..456d6455c0c 100644
--- a/chromium/third_party/skia/src/utils/SkCustomTypeface.cpp
+++ b/chromium/third_party/skia/src/utils/SkCustomTypeface.cpp
@@ -7,15 +7,18 @@
#include "include/utils/SkCustomTypeface.h"
+#include "include/core/SkCanvas.h"
+#include "include/core/SkColor.h"
#include "include/core/SkData.h"
+#include "include/core/SkDrawable.h"
#include "include/core/SkFontArguments.h"
#include "include/core/SkFontMetrics.h"
#include "include/core/SkFontParameters.h"
#include "include/core/SkFontStyle.h"
#include "include/core/SkFontTypes.h"
#include "include/core/SkMatrix.h"
+#include "include/core/SkPaint.h"
#include "include/core/SkPath.h"
-#include "include/core/SkPathTypes.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
@@ -24,17 +27,18 @@
#include "include/core/SkString.h"
#include "include/core/SkTypeface.h"
#include "include/core/SkTypes.h"
-#include "include/private/SkFloatingPoint.h"
+#include "include/private/SkFixed.h"
#include "include/private/SkMalloc.h"
#include "include/private/SkTo.h"
#include "src/core/SkAdvancedTypefaceMetrics.h" // IWYU pragma: keep
-#include "src/core/SkAutoMalloc.h"
#include "src/core/SkGlyph.h"
-#include "src/core/SkPathPriv.h"
+#include "src/core/SkMask.h"
#include "src/core/SkScalerContext.h"
-#include <string.h>
+#include <cstddef>
+#include <cstdint>
#include <memory>
+#include <string>
#include <utility>
#include <vector>
@@ -42,6 +46,10 @@ class SkArenaAlloc;
class SkDescriptor;
class SkFontDescriptor;
+namespace {
+static inline const constexpr bool kSkShowTextBlitCoverage = false;
+}
+
static SkFontMetrics scale_fontmetrics(const SkFontMetrics& src, float sx, float sy) {
SkFontMetrics dst = src;
@@ -76,11 +84,15 @@ private:
friend class SkCustomTypefaceBuilder;
friend class SkUserScalerContext;
- explicit SkUserTypeface(SkFontStyle style) : SkTypeface(style) {}
+ explicit SkUserTypeface(SkFontStyle style, const SkFontMetrics& metrics,
+ std::vector<SkCustomTypefaceBuilder::GlyphRec>&& recs)
+ : SkTypeface(style)
+ , fGlyphRecs(std::move(recs))
+ , fMetrics(metrics)
+ {}
- std::vector<SkPath> fPaths;
- std::vector<float> fAdvances;
- SkFontMetrics fMetrics;
+ const std::vector<SkCustomTypefaceBuilder::GlyphRec> fGlyphRecs;
+ const SkFontMetrics fMetrics;
std::unique_ptr<SkScalerContext> onCreateScalerContext(const SkScalerContextEffects&,
const SkDescriptor* desc) const override;
@@ -100,6 +112,8 @@ private:
// trivial
+ std::unique_ptr<SkStreamAsset> onOpenExistingStream(int*) const override { return nullptr; }
+
sk_sp<SkTypeface> onMakeClone(const SkFontArguments& args) const override {
return sk_ref_sp(this);
}
@@ -122,8 +136,7 @@ private:
size_t onGetTableData(SkFontTableTag, size_t, size_t, void*) const override { return 0; }
int glyphCount() const {
- SkASSERT(fPaths.size() == fAdvances.size());
- return SkToInt(fPaths.size());
+ return SkToInt(fGlyphRecs.size());
}
};
@@ -139,39 +152,48 @@ void SkCustomTypefaceBuilder::setFontStyle(SkFontStyle style) {
fStyle = style;
}
-void SkCustomTypefaceBuilder::setGlyph(SkGlyphID index, float advance, const SkPath& path) {
- SkASSERT(fPaths.size() == fAdvances.size());
- if (index >= fPaths.size()) {
- fPaths.resize(SkToSizeT(index) + 1);
- fAdvances.resize(SkToSizeT(index) + 1);
+SkCustomTypefaceBuilder::GlyphRec& SkCustomTypefaceBuilder::ensureStorage(SkGlyphID index) {
+ if (index >= fGlyphRecs.size()) {
+ fGlyphRecs.resize(SkToSizeT(index) + 1);
}
- fAdvances[index] = advance;
- fPaths[index] = path;
+
+ return fGlyphRecs[index];
}
-sk_sp<SkTypeface> SkCustomTypefaceBuilder::detach() {
- SkASSERT(fPaths.size() == fAdvances.size());
- if (fPaths.empty()) return nullptr;
+void SkCustomTypefaceBuilder::setGlyph(SkGlyphID index, float advance, const SkPath& path) {
+ auto& rec = this->ensureStorage(index);
+ rec.fAdvance = advance;
+ rec.fPath = path;
+ rec.fDrawable = nullptr;
+}
- sk_sp<SkUserTypeface> tf(new SkUserTypeface(fStyle));
- tf->fAdvances = std::move(fAdvances);
- tf->fPaths = std::move(fPaths);
- tf->fMetrics = fMetrics;
+void SkCustomTypefaceBuilder::setGlyph(SkGlyphID index, float advance,
+ sk_sp<SkDrawable> drawable, const SkRect& bounds) {
+ auto& rec = this->ensureStorage(index);
+ rec.fAdvance = advance;
+ rec.fDrawable = std::move(drawable);
+ rec.fBounds = bounds;
+ rec.fPath.reset();
+}
+
+sk_sp<SkTypeface> SkCustomTypefaceBuilder::detach() {
+ if (fGlyphRecs.empty()) return nullptr;
// initially inverted, so that any "union" will overwrite the first time
SkRect bounds = {SK_ScalarMax, SK_ScalarMax, -SK_ScalarMax, -SK_ScalarMax};
- for (const auto& path : tf->fPaths) {
- if (!path.isEmpty()) {
- bounds.join(path.getBounds());
- }
+ for (const auto& rec : fGlyphRecs) {
+ bounds.join(rec.isDrawable()
+ ? rec.fBounds
+ : rec.fPath.getBounds());
}
- tf->fMetrics.fTop = bounds.top();
- tf->fMetrics.fBottom = bounds.bottom();
- tf->fMetrics.fXMin = bounds.left();
- tf->fMetrics.fXMax = bounds.right();
- return std::move(tf);
+ fMetrics.fTop = bounds.top();
+ fMetrics.fBottom = bounds.bottom();
+ fMetrics.fXMin = bounds.left();
+ fMetrics.fXMax = bounds.right();
+
+ return sk_sp<SkUserTypeface>(new SkUserTypeface(fStyle, fMetrics, std::move(fGlyphRecs)));
}
/////////////
@@ -231,26 +253,103 @@ public:
protected:
bool generateAdvance(SkGlyph* glyph) override {
const SkUserTypeface* tf = this->userTF();
- auto advance = fMatrix.mapXY(tf->fAdvances[glyph->getGlyphID()], 0);
+ auto advance = fMatrix.mapXY(tf->fGlyphRecs[glyph->getGlyphID()].fAdvance, 0);
glyph->fAdvanceX = advance.fX;
glyph->fAdvanceY = advance.fY;
return true;
}
- void generateMetrics(SkGlyph* glyph, SkArenaAlloc*) override {
+ void generateMetrics(SkGlyph* glyph, SkArenaAlloc* alloc) override {
glyph->zeroMetrics();
this->generateAdvance(glyph);
- // Always generates from paths, so SkScalerContext::makeGlyph will figure the bounds.
+
+ const auto& rec = this->userTF()->fGlyphRecs[glyph->getGlyphID()];
+ if (rec.isDrawable()) {
+ glyph->fMaskFormat = SkMask::kARGB32_Format;
+
+ SkRect bounds = fMatrix.mapRect(rec.fBounds);
+ bounds.offset(SkFixedToScalar(glyph->getSubXFixed()),
+ SkFixedToScalar(glyph->getSubYFixed()));
+
+ SkIRect ibounds;
+ bounds.roundOut(&ibounds);
+ glyph->fLeft = ibounds.fLeft;
+ glyph->fTop = ibounds.fTop;
+ glyph->fWidth = ibounds.width();
+ glyph->fHeight = ibounds.height();
+
+ // These do not have an outline path.
+ glyph->setPath(alloc, nullptr, false);
+ }
}
- void generateImage(const SkGlyph&) override { SK_ABORT("Should have generated from path."); }
+ void generateImage(const SkGlyph& glyph) override {
+ const auto& rec = this->userTF()->fGlyphRecs[glyph.getGlyphID()];
+ SkASSERTF(rec.isDrawable(), "Only drawable-backed glyphs should reach generateImage.");
+
+ auto canvas = SkCanvas::MakeRasterDirectN32(glyph.fWidth, glyph.fHeight,
+ static_cast<SkPMColor*>(glyph.fImage),
+ glyph.rowBytes());
+ if constexpr (kSkShowTextBlitCoverage) {
+ canvas->clear(0x33FF0000);
+ } else {
+ canvas->clear(SK_ColorTRANSPARENT);
+ }
+
+ canvas->translate(-glyph.fLeft, -glyph.fTop);
+ canvas->translate(SkFixedToScalar(glyph.getSubXFixed()),
+ SkFixedToScalar(glyph.getSubYFixed()));
+ canvas->drawDrawable(rec.fDrawable.get(), &fMatrix);
+ }
bool generatePath(const SkGlyph& glyph, SkPath* path) override {
- this->userTF()->fPaths[glyph.getGlyphID()].transform(fMatrix, path);
+ const auto& rec = this->userTF()->fGlyphRecs[glyph.getGlyphID()];
+
+ SkASSERT(!rec.isDrawable());
+
+ rec.fPath.transform(fMatrix, path);
+
return true;
}
+ sk_sp<SkDrawable> generateDrawable(const SkGlyph& glyph) override {
+ class DrawableMatrixWrapper final : public SkDrawable {
+ public:
+ DrawableMatrixWrapper(sk_sp<SkDrawable> drawable, const SkMatrix& m)
+ : fDrawable(std::move(drawable))
+ , fMatrix(m)
+ {}
+
+ SkRect onGetBounds() override {
+ return fMatrix.mapRect(fDrawable->getBounds());
+ }
+
+ size_t onApproximateBytesUsed() override {
+ return fDrawable->approximateBytesUsed() + sizeof(DrawableMatrixWrapper);
+ }
+
+ void onDraw(SkCanvas* canvas) override {
+ if constexpr (kSkShowTextBlitCoverage) {
+ SkPaint paint;
+ paint.setColor(0x3300FF00);
+ paint.setStyle(SkPaint::kFill_Style);
+ canvas->drawRect(this->onGetBounds(), paint);
+ }
+ canvas->drawDrawable(fDrawable.get(), &fMatrix);
+ }
+ private:
+ const sk_sp<SkDrawable> fDrawable;
+ const SkMatrix fMatrix;
+ };
+
+ const auto& rec = this->userTF()->fGlyphRecs[glyph.getGlyphID()];
+
+ return rec.fDrawable
+ ? sk_make_sp<DrawableMatrixWrapper>(rec.fDrawable, fMatrix)
+ : nullptr;
+ }
+
void generateFontMetrics(SkFontMetrics* metrics) override {
auto [sx, sy] = fMatrix.mapXY(1, 1);
*metrics = scale_fontmetrics(this->userTF()->fMetrics, sx, sy);
@@ -269,75 +368,13 @@ std::unique_ptr<SkScalerContext> SkUserTypeface::onCreateScalerContext(
///////////////////////////////////////////////////////////////////////////////////////////////////
-static void write_scaled_float_to_16(SkWStream* stream, float x, float scale) {
- stream->write16(SkToS16(sk_float_round2int(x * scale)) & 0xFFFF);
-}
-
-enum PVerb {
- kMove,
- kLine,
- kCurve,
- kClose,
-};
-
-static void compress_write(SkWStream* stream, const SkPath& path, int upem) {
- int pCount = 0;
- std::vector<PVerb> verbs;
- for (auto [v, p, w] : SkPathPriv::Iterate(path)) {
- switch (v) {
- default: break;
- case SkPathVerb::kMove: verbs.push_back(kMove); pCount += 1; break;
- case SkPathVerb::kQuad: verbs.push_back(kCurve); pCount += 2; break;
- case SkPathVerb::kLine: verbs.push_back(kLine); pCount += 1; break;
- case SkPathVerb::kClose: verbs.push_back(kClose); break;
- }
- }
-
- int vCount = verbs.size();
-
- stream->write16(upem); // share w/ other paths?
- stream->write16(vCount);
- stream->write16(pCount);
- for (int i = 0; i < (vCount & ~3); i += 4) {
- stream->write8((verbs[i+0]<<6) | (verbs[i+1]<<4) | (verbs[i+2]<<2) | verbs[i+3]);
- }
- if (vCount & 3) {
- uint8_t b = 0;
- int shift = 6;
- for (int i = vCount & ~3; i < vCount; ++i) {
- b |= verbs[i] << shift;
- shift >>= 2;
- }
- stream->write8(b);
- }
- if (vCount & 1) {
- stream->write8(0);
- }
-
- const float scale = (float)upem;
- auto write_pts = [&](const SkPoint pts[], int count) {
- for (int i = 0; i < count; ++i) {
- write_scaled_float_to_16(stream, pts[i].fX, scale);
- write_scaled_float_to_16(stream, pts[i].fY, scale);
- }
- };
-
- for (auto [v, p, w] : SkPathPriv::Iterate(path)) {
- switch (v) {
- default: break;
- case SkPathVerb::kMove: write_pts(&p[0], 1); break;
- case SkPathVerb::kQuad: write_pts(&p[1], 2); break;
- case SkPathVerb::kLine: write_pts(&p[1], 1); break;
- case SkPathVerb::kClose: break;
- }
- }
-}
-
static constexpr int kMaxGlyphCount = 65536;
static constexpr size_t kHeaderSize = 16;
static const char gHeaderString[] = "SkUserTypeface01";
static_assert(sizeof(gHeaderString) == 1 + kHeaderSize, "need header to be 16 bytes");
+enum GlyphType : uint32_t { kPath, kDrawable };
+
std::unique_ptr<SkStreamAsset> SkUserTypeface::onOpenStream(int* ttcIndex) const {
SkDynamicMemoryWStream wstream;
@@ -348,29 +385,25 @@ std::unique_ptr<SkStreamAsset> SkUserTypeface::onOpenStream(int* ttcIndex) const
SkFontStyle style = this->fontStyle();
wstream.write(&style, sizeof(style));
- // just hacking around -- this makes the serialized font 1/2 size
- const bool use_compression = false;
-
wstream.write32(this->glyphCount());
- if (use_compression) {
- for (float a : fAdvances) {
- write_scaled_float_to_16(&wstream, a, 2048);
- }
- } else {
- wstream.write(fAdvances.data(), this->glyphCount() * sizeof(float));
- }
+ for (const auto& rec : fGlyphRecs) {
+ wstream.write32(rec.isDrawable() ? GlyphType::kDrawable : GlyphType::kPath);
- for (const auto& p : fPaths) {
- if (use_compression) {
- compress_write(&wstream, p, 2048);
- } else {
- auto data = p.serialize();
- SkASSERT(SkIsAlign4(data->size()));
- wstream.write(data->data(), data->size());
- }
+ wstream.writeScalar(rec.fAdvance);
+
+ wstream.write(&rec.fBounds, sizeof(rec.fBounds));
+
+ auto data = rec.isDrawable()
+ ? rec.fDrawable->serialize()
+ : rec.fPath.serialize();
+
+ const size_t sz = data->size();
+ SkASSERT(SkIsAlign4(sz));
+ wstream.write(&sz, sizeof(sz));
+ wstream.write(data->data(), sz);
}
-// SkDebugf("%d glyphs, %d bytes\n", fGlyphCount, wstream.bytesWritten());
+
*ttcIndex = 0;
return wstream.detachAsStream();
}
@@ -423,35 +456,52 @@ sk_sp<SkTypeface> SkCustomTypefaceBuilder::Deserialize(SkStream* stream) {
builder.setMetrics(metrics);
builder.setFontStyle(style);
- std::vector<float> advances(glyphCount);
- if (stream->read(advances.data(), glyphCount * sizeof(float)) != glyphCount * sizeof(float)) {
- return nullptr;
- }
+ for (int i = 0; i < glyphCount; ++i) {
+ uint32_t gtype;
+ if (!stream->readU32(&gtype)) {
+ return nullptr;
+ }
- // SkPath can read from a stream, so we have to page the rest into ram
- const size_t offset = stream->getPosition();
- const size_t length = stream->getLength() - offset;
- SkAutoMalloc ram(length);
- char* buffer = (char*)ram.get();
+ float advance;
+ if (!stream->readScalar(&advance)) {
+ return nullptr;
+ }
- if (stream->read(buffer, length) != length) {
- return nullptr;
- }
+ SkRect bounds;
+ if (stream->read(&bounds, sizeof(bounds)) != sizeof(bounds)) {
+ return nullptr;
+ }
- size_t totalUsed = 0;
- for (int i = 0; i < glyphCount; ++i) {
- SkPath path;
- size_t used = path.readFromMemory(buffer + totalUsed, length - totalUsed);
- if (used == 0) {
+ // SkPath and SkDrawable cannot read from a stream, so we have to page them into ram
+ size_t sz;
+ if (stream->read(&sz, sizeof(sz)) != sizeof(sz)) {
+ return nullptr;
+ }
+ auto data = SkData::MakeUninitialized(sz);
+ if (stream->read(data->writable_data(), sz) != sz) {
return nullptr;
}
- builder.setGlyph(i, advances[i], path);
- totalUsed += used;
- SkASSERT(length >= totalUsed);
- }
- // all done, update the stream to only reflect the bytes we needed
- stream->seek(offset + totalUsed);
+ switch (gtype) {
+ case GlyphType::kDrawable: {
+ auto drawable = SkDrawable::Deserialize(data->data(), data->size());
+ if (!drawable) {
+ return nullptr;
+ }
+ builder.setGlyph(i, advance, std::move(drawable), bounds);
+ } break;
+ case GlyphType::kPath: {
+ SkPath path;
+ if (path.readFromMemory(data->data(), data->size()) != data->size()) {
+ return nullptr;
+ }
+
+ builder.setGlyph(i, advance, path);
+ } break;
+ default:
+ return nullptr;
+ }
+ }
arp.markDone();
return builder.detach();
diff --git a/chromium/third_party/skia/src/utils/SkDashPath.cpp b/chromium/third_party/skia/src/utils/SkDashPath.cpp
index 42e841c137b..5bb4ba4982d 100644
--- a/chromium/third_party/skia/src/utils/SkDashPath.cpp
+++ b/chromium/third_party/skia/src/utils/SkDashPath.cpp
@@ -22,6 +22,8 @@
#include <algorithm>
#include <cmath>
+#include <cstdint>
+#include <iterator>
#include <utility>
static inline int is_even(int x) {
@@ -288,7 +290,7 @@ public:
pts[2].set(x1 - fNormal.fX, y1 - fNormal.fY); // lineTo
pts[3].set(x0 - fNormal.fX, y0 - fNormal.fY); // lineTo
- path->addPoly(pts, SK_ARRAY_COUNT(pts), false);
+ path->addPoly(pts, std::size(pts), false);
}
private:
diff --git a/chromium/third_party/skia/src/utils/SkEventTracer.cpp b/chromium/third_party/skia/src/utils/SkEventTracer.cpp
index 5459effc872..d07e567211e 100644
--- a/chromium/third_party/skia/src/utils/SkEventTracer.cpp
+++ b/chromium/third_party/skia/src/utils/SkEventTracer.cpp
@@ -38,6 +38,9 @@ class SkDefaultEventTracer : public SkEventTracer {
static const char* stub = "stub";
return stub;
}
+
+ // The default tracer does not yet support splitting up trace output into sections.
+ void newTracingSection(const char* name) override {}
};
// We prefer gUserTracer if it's been set, otherwise we fall back on a default tracer;
diff --git a/chromium/third_party/skia/src/utils/SkGaussianColorFilter.cpp b/chromium/third_party/skia/src/utils/SkGaussianColorFilter.cpp
new file mode 100644
index 00000000000..4a5ffbbb475
--- /dev/null
+++ b/chromium/third_party/skia/src/utils/SkGaussianColorFilter.cpp
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "include/core/SkColorFilter.h"
+#include "include/core/SkFlattenable.h"
+#include "include/core/SkRefCnt.h"
+#include "include/core/SkTypes.h"
+#include "src/core/SkColorFilterBase.h"
+#include "src/core/SkColorFilterPriv.h"
+#include "src/core/SkEffectPriv.h"
+#include "src/core/SkRasterPipeline.h"
+#include "src/core/SkVM.h"
+
+#if SK_SUPPORT_GPU
+#include "src/gpu/ganesh/GrFragmentProcessor.h"
+
+#include <memory>
+#include <utility>
+
+class GrColorInfo;
+class GrRecordingContext;
+class SkSurfaceProps;
+#endif
+
+class SkArenaAlloc;
+class SkColorInfo;
+class SkReadBuffer;
+class SkWriteBuffer;
+
+#ifdef SK_ENABLE_SKSL
+class SkPipelineDataGatherer;
+#endif
+
+/**
+ * Remaps the input color's alpha to a Gaussian ramp and then outputs premul white using the
+ * remapped alpha.
+ */
+class SkGaussianColorFilter : public SkColorFilterBase {
+public:
+ SkGaussianColorFilter() : SkColorFilterBase() {}
+
+#if SK_SUPPORT_GPU
+ GrFPResult asFragmentProcessor(std::unique_ptr<GrFragmentProcessor> inputFP,
+ GrRecordingContext*,
+ const GrColorInfo&,
+ const SkSurfaceProps&) const override;
+#endif
+
+#ifdef SK_ENABLE_SKSL
+ void addToKey(const SkKeyContext& keyContext,
+ SkPaintParamsKeyBuilder* builder,
+ SkPipelineDataGatherer* gatherer) const override;
+#endif
+
+protected:
+ void flatten(SkWriteBuffer&) const override {}
+ bool onAppendStages(const SkStageRec& rec, bool shaderIsOpaque) const override {
+ rec.fPipeline->append(SkRasterPipeline::gauss_a_to_rgba);
+ return true;
+ }
+
+ skvm::Color onProgram(skvm::Builder* p, skvm::Color c, const SkColorInfo& dst, skvm::Uniforms*,
+ SkArenaAlloc*) const override {
+ // x = 1 - x;
+ // exp(-x * x * 4) - 0.018f;
+ // ... now approximate with quartic
+ //
+ skvm::F32 x = p->splat(-2.26661229133605957031f);
+ x = c.a * x + 2.89795351028442382812f;
+ x = c.a * x + 0.21345567703247070312f;
+ x = c.a * x + 0.15489584207534790039f;
+ x = c.a * x + 0.00030726194381713867f;
+ return {x, x, x, x};
+ }
+
+private:
+ SK_FLATTENABLE_HOOKS(SkGaussianColorFilter)
+};
+
+sk_sp<SkFlattenable> SkGaussianColorFilter::CreateProc(SkReadBuffer&) {
+ return SkColorFilterPriv::MakeGaussian();
+}
+
+#if SK_SUPPORT_GPU
+
+#include "include/effects/SkRuntimeEffect.h"
+#include "src/core/SkRuntimeEffectPriv.h"
+#include "src/gpu/ganesh/effects/GrSkSLFP.h"
+
+GrFPResult SkGaussianColorFilter::asFragmentProcessor(std::unique_ptr<GrFragmentProcessor> inputFP,
+ GrRecordingContext*,
+ const GrColorInfo&,
+ const SkSurfaceProps&) const {
+ static const SkRuntimeEffect* effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForColorFilter,
+ R"(
+ half4 main(half4 inColor) {
+ half factor = 1 - inColor.a;
+ factor = exp(-factor * factor * 4) - 0.018;
+ return half4(factor);
+ }
+ )");
+ SkASSERT(SkRuntimeEffectPriv::SupportsConstantOutputForConstantInput(effect));
+ return GrFPSuccess(GrSkSLFP::Make(effect, "gaussian_fp", std::move(inputFP),
+ GrSkSLFP::OptFlags::kNone));
+}
+#endif
+
+#ifdef SK_ENABLE_SKSL
+
+#include "src/core/SkKeyContext.h"
+#include "src/core/SkKeyHelpers.h"
+#include "src/core/SkPaintParamsKey.h"
+
+void SkGaussianColorFilter::addToKey(const SkKeyContext& keyContext,
+ SkPaintParamsKeyBuilder* builder,
+ SkPipelineDataGatherer* gatherer) const {
+ GaussianColorFilterBlock::BeginBlock(keyContext, builder, gatherer);
+ builder->endBlock();
+}
+
+#endif
+
+sk_sp<SkColorFilter> SkColorFilterPriv::MakeGaussian() {
+ return sk_sp<SkColorFilter>(new SkGaussianColorFilter);
+}
diff --git a/chromium/third_party/skia/src/utils/SkJSON.cpp b/chromium/third_party/skia/src/utils/SkJSON.cpp
index 4ff5cae881a..09c1b96ceb8 100644
--- a/chromium/third_party/skia/src/utils/SkJSON.cpp
+++ b/chromium/third_party/skia/src/utils/SkJSON.cpp
@@ -16,9 +16,10 @@
#include "include/utils/SkParse.h"
#include "src/utils/SkUTF.h"
-#include <stdlib.h>
#include <cmath>
+#include <cstddef>
#include <cstdint>
+#include <cstdlib>
#include <limits>
#include <new>
#include <tuple>
@@ -289,7 +290,7 @@ static inline float pow10(int32_t exp) {
1.e+025f, 1.e+026f, 1.e+027f, 1.e+028f, 1.e+029f, 1.e+030f, 1.e+031f
};
- static constexpr int32_t k_exp_offset = SK_ARRAY_COUNT(g_pow10_table) / 2;
+ static constexpr int32_t k_exp_offset = std::size(g_pow10_table) / 2;
// We only support negative exponents for now.
SkASSERT(exp <= 0);
diff --git a/chromium/third_party/skia/src/utils/SkJSON.h b/chromium/third_party/skia/src/utils/SkJSON.h
index cc5c2b895ff..be395c290b6 100644
--- a/chromium/third_party/skia/src/utils/SkJSON.h
+++ b/chromium/third_party/skia/src/utils/SkJSON.h
@@ -12,6 +12,7 @@
#include "include/private/SkNoncopyable.h"
#include "src/core/SkArenaAlloc.h"
+#include <cstdint>
#include <cstring>
#include <string_view>
diff --git a/chromium/third_party/skia/src/utils/SkJSONWriter.h b/chromium/third_party/skia/src/utils/SkJSONWriter.h
index 8d6b7a60609..3c67e634b0f 100644
--- a/chromium/third_party/skia/src/utils/SkJSONWriter.h
+++ b/chromium/third_party/skia/src/utils/SkJSONWriter.h
@@ -9,11 +9,16 @@
#define SkJSONWriter_DEFINED
#include "include/core/SkStream.h"
+#include "include/core/SkString.h"
#include "include/core/SkTypes.h"
#include "include/private/SkNoncopyable.h"
#include "include/private/SkTArray.h"
+#include "src/utils/SkUTF.h"
-#include <string.h>
+#include <cstddef>
+#include <cstdint>
+#include <string>
+#include <type_traits>
/**
* Lightweight class for writing properly structured JSON data. No random-access, everything must
@@ -168,12 +173,15 @@ public:
* - Between beginArray() and endArray() -or-
* - Between beginObject() and endObject(), after calling appendName()
*/
- void appendString(const char* value) {
+ void appendString(const char* value, size_t size) {
this->beginValue();
this->write("\"", 1);
if (value) {
- while (*value) {
- switch (*value) {
+ char const * const end = value + size;
+ while (value < end) {
+ char const * next = value;
+ SkUnichar u = SkUTF::NextUTF8(&next, end);
+ switch (u) {
case '"': this->write("\\\"", 2); break;
case '\\': this->write("\\\\", 2); break;
case '\b': this->write("\\b", 2); break;
@@ -181,13 +189,41 @@ public:
case '\n': this->write("\\n", 2); break;
case '\r': this->write("\\r", 2); break;
case '\t': this->write("\\t", 2); break;
- default: this->write(value, 1); break;
+ default: {
+ if (u < 0) {
+ next = value + 1;
+ SkString s("\\u");
+ s.appendHex((unsigned char)*value, 4);
+ this->write(s.c_str(), s.size());
+ } else if (u < 0x20) {
+ SkString s("\\u");
+ s.appendHex(u, 4);
+ this->write(s.c_str(), s.size());
+ } else {
+ this->write(value, next - value);
+ }
+ } break;
}
- value++;
+ value = next;
}
}
this->write("\"", 1);
}
+ void appendString(const SkString& value) {
+ this->appendString(value.c_str(), value.size());
+ }
+ // Avoid the non-explicit converting constructor from char*
+ template <class T, std::enable_if_t<std::is_same_v<T,std::string>,bool> = false>
+ void appendString(const T& value) {
+ this->appendString(value.data(), value.size());
+ }
+ template <size_t N> inline void appendNString(char const (&value)[N]) {
+ static_assert(N > 0);
+ this->appendString(value, N-1);
+ }
+ void appendCString(const char* value) {
+ this->appendString(value, value ? strlen(value) : 0);
+ }
void appendPointer(const void* value) { this->beginValue(); this->appendf("\"%p\"", value); }
void appendBool(bool value) {
@@ -215,6 +251,29 @@ public:
void appendHexU32(uint32_t value) { this->beginValue(); this->appendf("\"0x%x\"", value); }
void appendHexU64(uint64_t value);
+ void appendString(const char* name, const char* value, size_t size) {
+ this->appendName(name);
+ this->appendString(value, size);
+ }
+ void appendString(const char* name, const SkString& value) {
+ this->appendName(name);
+ this->appendString(value.c_str(), value.size());
+ }
+ // Avoid the non-explicit converting constructor from char*
+ template <class T, std::enable_if_t<std::is_same_v<T,std::string>,bool> = false>
+ void appendString(const char* name, const T& value) {
+ this->appendName(name);
+ this->appendString(value.data(), value.size());
+ }
+ template <size_t N> inline void appendNString(const char* name, char const (&value)[N]) {
+ static_assert(N > 0);
+ this->appendName(name);
+ this->appendString(value, N-1);
+ }
+ void appendCString(const char* name, const char* value) {
+ this->appendName(name);
+ this->appendString(value, value ? strlen(value) : 0);
+ }
#define DEFINE_NAMED_APPEND(function, type) \
void function(const char* name, type value) { this->appendName(name); this->function(value); }
@@ -222,7 +281,6 @@ public:
* Functions for adding named values of various types. These add a name field, so must be
* called between beginObject() and endObject().
*/
- DEFINE_NAMED_APPEND(appendString, const char *)
DEFINE_NAMED_APPEND(appendPointer, const void *)
DEFINE_NAMED_APPEND(appendBool, bool)
DEFINE_NAMED_APPEND(appendS32, int32_t)
diff --git a/chromium/third_party/skia/src/utils/SkMultiPictureDocument.cpp b/chromium/third_party/skia/src/utils/SkMultiPictureDocument.cpp
index 15118e8f9e6..7bbfcc313a9 100644
--- a/chromium/third_party/skia/src/utils/SkMultiPictureDocument.cpp
+++ b/chromium/third_party/skia/src/utils/SkMultiPictureDocument.cpp
@@ -21,10 +21,12 @@
#include "include/utils/SkNWayCanvas.h"
#include "src/utils/SkMultiPictureDocumentPriv.h"
-#include <limits.h>
-#include <string.h>
#include <algorithm>
+#include <climits>
+#include <cstddef>
+#include <cstdint>
#include <functional>
+#include <string>
/*
File format:
diff --git a/chromium/third_party/skia/src/utils/SkNWayCanvas.cpp b/chromium/third_party/skia/src/utils/SkNWayCanvas.cpp
index 0b29a877c8e..5e19a33ccb6 100644
--- a/chromium/third_party/skia/src/utils/SkNWayCanvas.cpp
+++ b/chromium/third_party/skia/src/utils/SkNWayCanvas.cpp
@@ -26,9 +26,12 @@
#include <utility>
+namespace sktext {
+class GlyphRunList;
+}
+
class SkData;
class SkDrawable;
-class SkGlyphRunList;
class SkImage;
class SkPaint;
class SkPath;
@@ -313,7 +316,7 @@ void SkNWayCanvas::onDrawAtlas2(const SkImage* image, const SkRSXform xform[], c
}
}
-void SkNWayCanvas::onDrawGlyphRunList(const SkGlyphRunList& list,
+void SkNWayCanvas::onDrawGlyphRunList(const sktext::GlyphRunList& list,
const SkPaint &paint) {
Iter iter(fList);
while (iter.next()) {
diff --git a/chromium/third_party/skia/src/utils/SkPaintFilterCanvas.cpp b/chromium/third_party/skia/src/utils/SkPaintFilterCanvas.cpp
index e179f62b342..ba1a8f75b23 100644
--- a/chromium/third_party/skia/src/utils/SkPaintFilterCanvas.cpp
+++ b/chromium/third_party/skia/src/utils/SkPaintFilterCanvas.cpp
@@ -13,18 +13,17 @@
#include "include/core/SkPoint.h"
#include "include/core/SkRect.h"
#include "include/core/SkSurface.h" // IWYU pragma: keep
+#include "include/core/SkSurfaceProps.h"
#include <optional>
class SkData;
class SkDrawable;
-class SkGlyphRunList;
class SkImage;
class SkPath;
class SkPicture;
class SkRRect;
class SkRegion;
-class SkSurfaceProps;
class SkTextBlob;
class SkVertices;
struct SkDrawShadowRec;
@@ -166,8 +165,8 @@ void SkPaintFilterCanvas::onDrawVerticesObject(const SkVertices* vertices,
}
}
-void SkPaintFilterCanvas::onDrawPatch(const SkPoint cubics[], const SkColor colors[],
- const SkPoint texCoords[], SkBlendMode bmode,
+void SkPaintFilterCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
+ const SkPoint texCoords[4], SkBlendMode bmode,
const SkPaint& paint) {
AutoPaintFilter apf(this, paint);
if (apf.shouldDraw()) {
@@ -207,7 +206,8 @@ void SkPaintFilterCanvas::onDrawDrawable(SkDrawable* drawable, const SkMatrix* m
}
}
-void SkPaintFilterCanvas::onDrawGlyphRunList(const SkGlyphRunList& list, const SkPaint& paint) {
+void SkPaintFilterCanvas::onDrawGlyphRunList(
+ const sktext::GlyphRunList& list, const SkPaint& paint) {
AutoPaintFilter apf(this, paint);
if (apf.shouldDraw()) {
this->SkNWayCanvas::onDrawGlyphRunList(list, apf.paint());
@@ -292,6 +292,9 @@ SkImageInfo SkPaintFilterCanvas::onImageInfo() const {
return this->proxy()->imageInfo();
}
-bool SkPaintFilterCanvas::onGetProps(SkSurfaceProps* props) const {
- return this->proxy()->getProps(props);
+bool SkPaintFilterCanvas::onGetProps(SkSurfaceProps* props, bool top) const {
+ if (props) {
+ *props = top ? this->proxy()->getTopProps() : this->proxy()->getBaseProps();
+ }
+ return true;
}
diff --git a/chromium/third_party/skia/src/utils/SkParse.cpp b/chromium/third_party/skia/src/utils/SkParse.cpp
index 40e9e343fd6..71ab615bfab 100644
--- a/chromium/third_party/skia/src/utils/SkParse.cpp
+++ b/chromium/third_party/skia/src/utils/SkParse.cpp
@@ -7,8 +7,8 @@
#include "include/utils/SkParse.h"
-#include <stdlib.h>
-#include <string.h>
+#include <cstdlib>
+#include <string>
static inline bool is_between(int c, int min, int max)
{
@@ -248,12 +248,12 @@ bool SkParse::FindBool(const char str[], bool* value)
static const char* gYes[] = { "yes", "1", "true" };
static const char* gNo[] = { "no", "0", "false" };
- if (lookup_str(str, gYes, SK_ARRAY_COUNT(gYes)))
+ if (lookup_str(str, gYes, std::size(gYes)))
{
if (value) *value = true;
return true;
}
- else if (lookup_str(str, gNo, SK_ARRAY_COUNT(gNo)))
+ else if (lookup_str(str, gNo, std::size(gNo)))
{
if (value) *value = false;
return true;
diff --git a/chromium/third_party/skia/src/utils/SkParseColor.cpp b/chromium/third_party/skia/src/utils/SkParseColor.cpp
index 94c23c32ca3..0101632c565 100644
--- a/chromium/third_party/skia/src/utils/SkParseColor.cpp
+++ b/chromium/third_party/skia/src/utils/SkParseColor.cpp
@@ -4,15 +4,16 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
#include "include/utils/SkParse.h"
#include "include/core/SkColor.h"
#include "include/core/SkTypes.h"
-#include <string.h>
#include <algorithm>
+#include <cstddef>
+#include <cstdint>
#include <iterator>
+#include <string>
static constexpr const char* gColorNames[] = {
"aliceblue",
diff --git a/chromium/third_party/skia/src/utils/SkParsePath.cpp b/chromium/third_party/skia/src/utils/SkParsePath.cpp
index 514161c8d34..75155fa4867 100644
--- a/chromium/third_party/skia/src/utils/SkParsePath.cpp
+++ b/chromium/third_party/skia/src/utils/SkParsePath.cpp
@@ -16,7 +16,7 @@
#include "include/utils/SkParsePath.h"
#include "src/core/SkGeometry.h"
-#include <stdio.h>
+#include <cstdio>
static inline bool is_between(int c, int min, int max) {
return (unsigned)(c - min) <= (unsigned)(max - min);
diff --git a/chromium/third_party/skia/src/utils/SkPatchUtils.cpp b/chromium/third_party/skia/src/utils/SkPatchUtils.cpp
index de6fb28ccf1..a505f27ad62 100644
--- a/chromium/third_party/skia/src/utils/SkPatchUtils.cpp
+++ b/chromium/third_party/skia/src/utils/SkPatchUtils.cpp
@@ -27,8 +27,9 @@
#include "src/core/SkConvertPixels.h"
#include "src/core/SkGeometry.h"
-#include <string.h>
#include <algorithm>
+#include <cstdint>
+#include <string>
namespace {
enum CubicCtrlPts {
diff --git a/chromium/third_party/skia/src/utils/SkPolyUtils.cpp b/chromium/third_party/skia/src/utils/SkPolyUtils.cpp
index 9f08d100476..08a342a6ccf 100644
--- a/chromium/third_party/skia/src/utils/SkPolyUtils.cpp
+++ b/chromium/third_party/skia/src/utils/SkPolyUtils.cpp
@@ -1764,115 +1764,3 @@ bool SkTriangulateSimplePolygon(const SkPoint* polygonVerts, uint16_t* indexMap,
return true;
}
-
-///////////
-
-static double crs(SkVector a, SkVector b) {
- return a.fX * b.fY - a.fY * b.fX;
-}
-
-static int sign(SkScalar v) {
- return v < 0 ? -1 : (v > 0);
-}
-
-struct SignTracker {
- int fSign;
- int fSignChanges;
-
- void reset() {
- fSign = 0;
- fSignChanges = 0;
- }
-
- void init(int s) {
- SkASSERT(fSignChanges == 0);
- SkASSERT(s == 1 || s == -1 || s == 0);
- fSign = s;
- fSignChanges = 1;
- }
-
- void update(int s) {
- if (s) {
- if (fSign != s) {
- fSignChanges += 1;
- fSign = s;
- }
- }
- }
-};
-
-struct ConvexTracker {
- SkVector fFirst, fPrev;
- SignTracker fDSign, fCSign;
- int fVecCounter;
- bool fIsConcave;
-
- ConvexTracker() { this->reset(); }
-
- void reset() {
- fPrev = {0, 0};
- fDSign.reset();
- fCSign.reset();
- fVecCounter = 0;
- fIsConcave = false;
- }
-
- void addVec(SkPoint p1, SkPoint p0) {
- this->addVec(p1 - p0);
- }
- void addVec(SkVector v) {
- if (v.fX == 0 && v.fY == 0) {
- return;
- }
-
- fVecCounter += 1;
- if (fVecCounter == 1) {
- fFirst = fPrev = v;
- fDSign.update(sign(v.fX));
- return;
- }
-
- SkScalar d = v.fX;
- SkScalar c = crs(fPrev, v);
- int sign_c;
- if (c) {
- sign_c = sign(c);
- } else {
- if (d >= 0) {
- sign_c = fCSign.fSign;
- } else {
- sign_c = -fCSign.fSign;
- }
- }
-
- fDSign.update(sign(d));
- fCSign.update(sign_c);
- fPrev = v;
-
- if (fDSign.fSignChanges > 3 || fCSign.fSignChanges > 1) {
- fIsConcave = true;
- }
- }
-
- void finalCross() {
- this->addVec(fFirst);
- }
-};
-
-bool SkIsPolyConvex_experimental(const SkPoint pts[], int count) {
- if (count <= 3) {
- return true;
- }
-
- ConvexTracker tracker;
-
- for (int i = 0; i < count - 1; ++i) {
- tracker.addVec(pts[i + 1], pts[i]);
- if (tracker.fIsConcave) {
- return false;
- }
- }
- tracker.addVec(pts[0], pts[count - 1]);
- tracker.finalCross();
- return !tracker.fIsConcave;
-}
diff --git a/chromium/third_party/skia/src/utils/SkPolyUtils.h b/chromium/third_party/skia/src/utils/SkPolyUtils.h
index 7133d882409..b0a72a8813b 100644
--- a/chromium/third_party/skia/src/utils/SkPolyUtils.h
+++ b/chromium/third_party/skia/src/utils/SkPolyUtils.h
@@ -11,7 +11,7 @@
#include "include/core/SkPoint.h"
#include "include/core/SkScalar.h"
-#include <stdint.h>
+#include <cstdint>
struct SkRect;
template <typename T> class SkTDArray;
@@ -110,7 +110,4 @@ bool SkIsConvexPolygon(const SkPoint* polygonVerts, int polygonSize);
bool SkTriangulateSimplePolygon(const SkPoint* polygonVerts, uint16_t* indexMap, int polygonSize,
SkTDArray<uint16_t>* triangleIndices);
-// Experiment: doesn't handle really big floats (returns false), always returns true for count <= 3
-bool SkIsPolyConvex_experimental(const SkPoint[], int count);
-
#endif
diff --git a/chromium/third_party/skia/src/utils/SkShaderUtils.cpp b/chromium/third_party/skia/src/utils/SkShaderUtils.cpp
index d3faeafd3bd..5eb18de990e 100644
--- a/chromium/third_party/skia/src/utils/SkShaderUtils.cpp
+++ b/chromium/third_party/skia/src/utils/SkShaderUtils.cpp
@@ -12,6 +12,8 @@
#include "include/private/SkTArray.h"
#include "src/sksl/SkSLProgramSettings.h"
+#include <cstddef>
+
namespace SkShaderUtils {
class GLSLPrettyPrint {
diff --git a/chromium/third_party/skia/src/utils/SkShadowTessellator.cpp b/chromium/third_party/skia/src/utils/SkShadowTessellator.cpp
index 2f44cf24be0..ef78ae50b75 100644
--- a/chromium/third_party/skia/src/utils/SkShadowTessellator.cpp
+++ b/chromium/third_party/skia/src/utils/SkShadowTessellator.cpp
@@ -27,6 +27,8 @@
#include "src/utils/SkPolyUtils.h"
#include <algorithm>
+#include <cstdint>
+
#if SK_SUPPORT_GPU
#include "src/gpu/ganesh/geometry/GrPathUtils.h"
diff --git a/chromium/third_party/skia/src/utils/SkShadowUtils.cpp b/chromium/third_party/skia/src/utils/SkShadowUtils.cpp
index e30bae28c17..bf35fb7f346 100644
--- a/chromium/third_party/skia/src/utils/SkShadowUtils.cpp
+++ b/chromium/third_party/skia/src/utils/SkShadowUtils.cpp
@@ -12,7 +12,6 @@
#include "include/core/SkBlurTypes.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColorFilter.h"
-#include "include/core/SkFlattenable.h"
#include "include/core/SkMaskFilter.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"
@@ -27,111 +26,28 @@
#include "include/private/SkTemplates.h"
#include "include/utils/SkRandom.h"
#include "src/core/SkBlurMask.h"
-#include "src/core/SkColorFilterBase.h"
#include "src/core/SkColorFilterPriv.h"
#include "src/core/SkDevice.h"
#include "src/core/SkDrawShadowInfo.h"
-#include "src/core/SkEffectPriv.h"
#include "src/core/SkPathPriv.h"
-#include "src/core/SkRasterPipeline.h"
#include "src/core/SkResourceCache.h"
-#include "src/core/SkVM.h"
#include "src/core/SkVerticesPriv.h"
#include "src/utils/SkShadowTessellator.h"
#if SK_SUPPORT_GPU
-#include "include/effects/SkRuntimeEffect.h"
-#include "src/core/SkRuntimeEffectPriv.h"
-#include "src/gpu/ganesh/GrFragmentProcessor.h"
#include "src/gpu/ganesh/GrStyle.h"
-#include "src/gpu/ganesh/effects/GrSkSLFP.h"
#include "src/gpu/ganesh/geometry/GrStyledShape.h"
-
-class GrColorInfo;
-class GrRecordingContext;
#endif
-#include <string.h>
#include <algorithm>
-#include <cstdint>
+#include <cstddef>
#include <functional>
#include <memory>
#include <new>
+#include <string>
#include <utility>
-class SkArenaAlloc;
-class SkColorInfo;
class SkRRect;
-class SkReadBuffer;
-class SkWriteBuffer;
-
-/**
-* Gaussian color filter -- produces a Gaussian ramp based on the color's B value,
-* then blends with the color's G value.
-* Final result is black with alpha of Gaussian(B)*G.
-* The assumption is that the original color's alpha is 1.
-*/
-class SkGaussianColorFilter : public SkColorFilterBase {
-public:
- SkGaussianColorFilter() : INHERITED() {}
-
-#if SK_SUPPORT_GPU
- GrFPResult asFragmentProcessor(std::unique_ptr<GrFragmentProcessor> inputFP,
- GrRecordingContext*, const GrColorInfo&) const override;
-#endif
-
-protected:
- void flatten(SkWriteBuffer&) const override {}
- bool onAppendStages(const SkStageRec& rec, bool shaderIsOpaque) const override {
- rec.fPipeline->append(SkRasterPipeline::gauss_a_to_rgba);
- return true;
- }
-
- skvm::Color onProgram(skvm::Builder* p, skvm::Color c, const SkColorInfo& dst, skvm::Uniforms*,
- SkArenaAlloc*) const override {
- // x = 1 - x;
- // exp(-x * x * 4) - 0.018f;
- // ... now approximate with quartic
- //
- skvm::F32 x = p->splat(-2.26661229133605957031f);
- x = c.a * x + 2.89795351028442382812f;
- x = c.a * x + 0.21345567703247070312f;
- x = c.a * x + 0.15489584207534790039f;
- x = c.a * x + 0.00030726194381713867f;
- return {x, x, x, x};
- }
-
-private:
- SK_FLATTENABLE_HOOKS(SkGaussianColorFilter)
-
- using INHERITED = SkColorFilterBase;
-};
-
-sk_sp<SkFlattenable> SkGaussianColorFilter::CreateProc(SkReadBuffer&) {
- return SkColorFilterPriv::MakeGaussian();
-}
-
-#if SK_SUPPORT_GPU
-
-GrFPResult SkGaussianColorFilter::asFragmentProcessor(std::unique_ptr<GrFragmentProcessor> inputFP,
- GrRecordingContext*,
- const GrColorInfo&) const {
- static auto effect = SkMakeRuntimeEffect(SkRuntimeEffect::MakeForColorFilter, R"(
- half4 main(half4 inColor) {
- half factor = 1 - inColor.a;
- factor = exp(-factor * factor * 4) - 0.018;
- return half4(factor);
- }
- )");
- SkASSERT(SkRuntimeEffectPriv::SupportsConstantOutputForConstantInput(effect));
- return GrFPSuccess(
- GrSkSLFP::Make(effect, "gaussian_fp", std::move(inputFP), GrSkSLFP::OptFlags::kNone));
-}
-#endif
-
-sk_sp<SkColorFilter> SkColorFilterPriv::MakeGaussian() {
- return sk_sp<SkColorFilter>(new SkGaussianColorFilter);
-}
///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/chromium/third_party/skia/src/utils/SkShaperJSONWriter.cpp b/chromium/third_party/skia/src/utils/SkShaperJSONWriter.cpp
deleted file mode 100644
index fa1a1ff36b8..00000000000
--- a/chromium/third_party/skia/src/utils/SkShaperJSONWriter.cpp
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Copyright 2019 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "src/utils/SkShaperJSONWriter.h"
-
-#include "include/core/SkFont.h"
-#include "include/core/SkSpan.h"
-#include "include/core/SkString.h"
-#include "include/core/SkTypeface.h"
-#include "include/private/SkTo.h"
-#include "src/utils/SkJSONWriter.h"
-#include "src/utils/SkUTF.h"
-
-#include <algorithm>
-#include <cstddef>
-#include <limits>
-#include <string>
-#include <type_traits>
-
-SkShaperJSONWriter::SkShaperJSONWriter(SkJSONWriter* JSONWriter, const char* utf8, size_t size)
- : fJSONWriter{JSONWriter}
- , fUTF8{utf8, size} {}
-
-void SkShaperJSONWriter::beginLine() { }
-
-void SkShaperJSONWriter::runInfo(const SkShaper::RunHandler::RunInfo& info) { }
-
-void SkShaperJSONWriter::commitRunInfo() { }
-
-SkShaper::RunHandler::Buffer
-SkShaperJSONWriter::runBuffer(const SkShaper::RunHandler::RunInfo& info) {
- fGlyphs.resize(info.glyphCount);
- fPositions.resize(info.glyphCount);
- fClusters.resize(info.glyphCount);
- return {fGlyphs.data(), fPositions.data(), nullptr, fClusters.data(), {0, 0}};
-}
-
-static bool is_one_to_one(const char utf8[], size_t utf8Begin, size_t utf8End,
- std::vector<uint32_t>& clusters) {
- size_t lastUtf8Index = utf8End;
-
- auto checkCluster = [&](size_t clusterIndex) {
- if (clusters[clusterIndex] >= lastUtf8Index) {
- return false;
- }
- size_t utf8ClusterSize = lastUtf8Index - clusters[clusterIndex];
- if (SkUTF::CountUTF8(&utf8[clusters[clusterIndex]], utf8ClusterSize) != 1) {
- return false;
- }
- lastUtf8Index = clusters[clusterIndex];
- return true;
- };
-
- if (clusters.front() <= clusters.back()) {
- // left-to-right clusters
- size_t clusterCursor = clusters.size();
- while (clusterCursor > 0) {
- if (!checkCluster(--clusterCursor)) { return false; }
- }
- } else {
- // right-to-left clusters
- size_t clusterCursor = 0;
- while (clusterCursor < clusters.size()) {
- if (!checkCluster(clusterCursor++)) { return false; }
- }
- }
-
- return true;
-}
-
-void SkShaperJSONWriter::commitRunBuffer(const SkShaper::RunHandler::RunInfo& info) {
- fJSONWriter->beginObject("run", true);
-
- // Font name
- SkString fontName;
- info.fFont.getTypeface()->getFamilyName(&fontName);
- fJSONWriter->appendString("font name", fontName.c_str());
-
- // Font size
- fJSONWriter->appendFloat("font size", info.fFont.getSize());
-
- if (info.fBidiLevel > 0) {
- std::string bidiType = info.fBidiLevel % 2 == 0 ? "left-to-right" : "right-to-left";
- std::string bidiOutput = bidiType + " lvl " + std::to_string(info.fBidiLevel);
- fJSONWriter->appendString("BiDi", bidiOutput.c_str());
- }
-
- if (is_one_to_one(fUTF8.c_str(), info.utf8Range.begin(), info.utf8Range.end(), fClusters)) {
- std::string utf8{&fUTF8[info.utf8Range.begin()], info.utf8Range.size()};
- fJSONWriter->appendString("UTF8", utf8.c_str());
-
- fJSONWriter->beginArray("glyphs", false);
- for (auto glyphID : fGlyphs) {
- fJSONWriter->appendU32(glyphID);
- }
- fJSONWriter->endArray();
-
- fJSONWriter->beginArray("clusters", false);
- for (auto cluster : fClusters) {
- fJSONWriter->appendU32(cluster);
- }
- fJSONWriter->endArray();
- } else {
- VisualizeClusters(fUTF8.c_str(),
- info.utf8Range.begin(), info.utf8Range.end(),
- SkMakeSpan(fGlyphs),
- SkMakeSpan(fClusters),
- [this](size_t codePointCount, SkSpan<const char> utf1to1,
- SkSpan<const SkGlyphID> glyph1to1) {
- this->displayMToN(codePointCount, utf1to1, glyph1to1);
- });
- }
-
- if (info.glyphCount > 1) {
- fJSONWriter->beginArray("horizontal positions", false);
- for (auto position : fPositions) {
- fJSONWriter->appendFloat(position.x());
- }
- fJSONWriter->endArray();
- }
-
- fJSONWriter->beginArray("advances", false);
- for (size_t i = 1; i < info.glyphCount; i++) {
- fJSONWriter->appendFloat(fPositions[i].fX - fPositions[i-1].fX);
- }
- SkPoint lastAdvance = info.fAdvance - (fPositions.back() - fPositions.front());
- fJSONWriter->appendFloat(lastAdvance.fX);
- fJSONWriter->endArray();
-
- fJSONWriter->endObject();
-}
-
-void SkShaperJSONWriter::BreakupClusters(size_t utf8Begin, size_t utf8End,
- SkSpan<const uint32_t> clusters,
- const BreakupCluastersCallback& processMToN) {
-
- if (clusters.front() <= clusters.back()) {
- // Handle left-to-right text direction
- size_t glyphStartIndex = 0;
- for (size_t glyphEndIndex = 0; glyphEndIndex < clusters.size(); glyphEndIndex++) {
-
- if (clusters[glyphStartIndex] == clusters[glyphEndIndex]) { continue; }
-
- processMToN(glyphStartIndex, glyphEndIndex,
- clusters[glyphStartIndex], clusters[glyphEndIndex]);
-
- glyphStartIndex = glyphEndIndex;
- }
-
- processMToN(glyphStartIndex, clusters.size(), clusters[glyphStartIndex], utf8End);
-
- } else {
- // Handle right-to-left text direction.
- SkASSERT(clusters.size() >= 2);
- size_t glyphStartIndex = 0;
- uint32_t utf8EndIndex = utf8End;
- for (size_t glyphEndIndex = 0; glyphEndIndex < clusters.size(); glyphEndIndex++) {
-
- if (clusters[glyphStartIndex] == clusters[glyphEndIndex]) { continue; }
-
- processMToN(glyphStartIndex, glyphEndIndex,
- clusters[glyphStartIndex], utf8EndIndex);
-
- utf8EndIndex = clusters[glyphStartIndex];
- glyphStartIndex = glyphEndIndex;
- }
- processMToN(glyphStartIndex, clusters.size(), utf8Begin, clusters[glyphStartIndex-1]);
- }
-}
-
-void SkShaperJSONWriter::VisualizeClusters(const char* utf8, size_t utf8Begin, size_t utf8End,
- SkSpan<const SkGlyphID> glyphIDs,
- SkSpan<const uint32_t> clusters,
- const VisualizeClustersCallback& processMToN) {
-
- size_t glyphRangeStart, glyphRangeEnd;
- uint32_t utf8RangeStart, utf8RangeEnd;
-
- auto resetRanges = [&]() {
- glyphRangeStart = std::numeric_limits<size_t>::max();
- glyphRangeEnd = 0;
- utf8RangeStart = std::numeric_limits<uint32_t>::max();
- utf8RangeEnd = 0;
- };
-
- auto checkRangesAndProcess = [&]() {
- if (glyphRangeStart < glyphRangeEnd) {
- size_t glyphRangeCount = glyphRangeEnd - glyphRangeStart;
- SkSpan<const char> utf8Span{&utf8[utf8RangeStart], utf8RangeEnd - utf8RangeStart};
- SkSpan<const SkGlyphID> glyphSpan{&glyphIDs[glyphRangeStart], glyphRangeCount};
-
- // Glyph count is the same as codepoint count for 1:1.
- processMToN(glyphRangeCount, utf8Span, glyphSpan);
- }
- resetRanges();
- };
-
- auto gatherRuns = [&](size_t glyphStartIndex, size_t glyphEndIndex,
- uint32_t utf8StartIndex, uint32_t utf8EndIndex) {
- int possibleCount = SkUTF::CountUTF8(&utf8[utf8StartIndex], utf8EndIndex - utf8StartIndex);
- if (possibleCount == -1) { return; }
- size_t codePointCount = SkTo<size_t>(possibleCount);
- if (codePointCount == 1 && glyphEndIndex - glyphStartIndex == 1) {
- glyphRangeStart = std::min(glyphRangeStart, glyphStartIndex);
- glyphRangeEnd = std::max(glyphRangeEnd, glyphEndIndex );
- utf8RangeStart = std::min(utf8RangeStart, utf8StartIndex );
- utf8RangeEnd = std::max(utf8RangeEnd, utf8EndIndex );
- } else {
- checkRangesAndProcess();
-
- SkSpan<const char> utf8Span{&utf8[utf8StartIndex], utf8EndIndex - utf8StartIndex};
- SkSpan<const SkGlyphID> glyphSpan{&glyphIDs[glyphStartIndex],
- glyphEndIndex - glyphStartIndex};
-
- processMToN(codePointCount, utf8Span, glyphSpan);
- }
- };
-
- resetRanges();
- BreakupClusters(utf8Begin, utf8End, clusters, gatherRuns);
- checkRangesAndProcess();
-}
-
-void SkShaperJSONWriter::displayMToN(size_t codePointCount,
- SkSpan<const char> utf8,
- SkSpan<const SkGlyphID> glyphIDs) {
- std::string nString = std::to_string(codePointCount);
- std::string mString = std::to_string(glyphIDs.size());
- std::string clusterName = "cluster " + nString + " to " + mString;
- fJSONWriter->beginObject(clusterName.c_str(), true);
- std::string utf8String{utf8.data(), utf8.size()};
- fJSONWriter->appendString("UTF", utf8String.c_str());
- fJSONWriter->beginArray("glyphsIDs", false);
- for (auto glyphID : glyphIDs) {
- fJSONWriter->appendU32(glyphID);
- }
- fJSONWriter->endArray();
- fJSONWriter->endObject();
-}
diff --git a/chromium/third_party/skia/src/utils/SkShaperJSONWriter.h b/chromium/third_party/skia/src/utils/SkShaperJSONWriter.h
deleted file mode 100644
index 5df2224c86d..00000000000
--- a/chromium/third_party/skia/src/utils/SkShaperJSONWriter.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2019 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkShaperJSONWriter_DEFINED
-#define SkShaperJSONWriter_DEFINED
-
-#include "include/core/SkPoint.h"
-#include "include/core/SkTypes.h"
-#include "modules/skshaper/include/SkShaper.h"
-
-#include <cstdint>
-#include <functional>
-#include <string>
-#include <vector>
-
-class SkJSONWriter;
-template <typename T> class SkSpan;
-
-class SkShaperJSONWriter final : public SkShaper::RunHandler {
-public:
- SkShaperJSONWriter(SkJSONWriter* JSONWriter, const char* utf8, size_t size);
-
- void beginLine() override;
- void runInfo(const RunInfo& info) override;
- void commitRunInfo() override;
-
- Buffer runBuffer(const RunInfo& info) override;
-
- void commitRunBuffer(const RunInfo& info) override;
-
- void commitLine() override {}
-
- using BreakupCluastersCallback =
- std::function<void(size_t, size_t, uint32_t, uint32_t)>;
-
- // Break up cluster into a set of ranges for the UTF8, and the glyphIDs.
- static void BreakupClusters(size_t utf8Begin, size_t utf8End,
- SkSpan<const uint32_t> clusters,
- const BreakupCluastersCallback& processMToN);
-
-
- using VisualizeClustersCallback =
- std::function<void(size_t, SkSpan<const char>, SkSpan<const SkGlyphID>)>;
-
- // Gather runs of 1:1 into larger runs, and display M:N as single entries.
- static void VisualizeClusters(const char utf8[],
- size_t utf8Begin, size_t utf8End,
- SkSpan<const SkGlyphID> glyphIDs,
- SkSpan<const uint32_t> clusters,
- const VisualizeClustersCallback& processMToN);
-
-private:
- void displayMToN(size_t codePointCount,
- SkSpan<const char> utf8,
- SkSpan<const SkGlyphID> glyphIDs);
-
- SkJSONWriter* fJSONWriter;
- std::vector<SkGlyphID> fGlyphs;
- std::vector<SkPoint> fPositions;
- std::vector<uint32_t> fClusters;
-
- std::string fUTF8;
-};
-
-#endif // SkShaperJSONWriter_DEFINED
diff --git a/chromium/third_party/skia/src/utils/SkTestCanvas.h b/chromium/third_party/skia/src/utils/SkTestCanvas.h
index 097929faa05..cc27d544f6c 100644
--- a/chromium/third_party/skia/src/utils/SkTestCanvas.h
+++ b/chromium/third_party/skia/src/utils/SkTestCanvas.h
@@ -18,7 +18,7 @@
#include "include/core/SkSize.h"
#include "include/utils/SkNWayCanvas.h"
#include "src/core/SkDevice.h"
-#include "src/core/SkGlyphRun.h"
+#include "src/text/GlyphRun.h"
// You can only make template specializations of SkTestCanvas.
template <typename Key> class SkTestCanvas;
@@ -29,7 +29,8 @@ template <>
class SkTestCanvas<SkSlugTestKey> : public SkCanvas {
public:
SkTestCanvas(SkCanvas* canvas);
- void onDrawGlyphRunList(const SkGlyphRunList& glyphRunList, const SkPaint& paint) override;
+ void onDrawGlyphRunList(
+ const sktext::GlyphRunList& glyphRunList, const SkPaint& paint) override;
};
#endif // SkTestCanvas_DEFINED
diff --git a/chromium/third_party/skia/src/utils/SkUTF.h b/chromium/third_party/skia/src/utils/SkUTF.h
index a437ca11225..0163dd84ad3 100644
--- a/chromium/third_party/skia/src/utils/SkUTF.h
+++ b/chromium/third_party/skia/src/utils/SkUTF.h
@@ -5,6 +5,9 @@
#include "include/core/SkTypes.h"
+#include <cstddef>
+#include <cstdint>
+
typedef int32_t SkUnichar;
namespace SkUTF {
diff --git a/chromium/third_party/skia/src/utils/SkVMVisualizer.cpp b/chromium/third_party/skia/src/utils/SkVMVisualizer.cpp
index 1e4ab4abb1c..7c565a82331 100644
--- a/chromium/third_party/skia/src/utils/SkVMVisualizer.cpp
+++ b/chromium/third_party/skia/src/utils/SkVMVisualizer.cpp
@@ -14,24 +14,10 @@
#include "src/sksl/tracing/SkVMDebugTrace.h"
#endif
-#include <algorithm>
-#include <sstream>
-#include <stdarg.h>
+#include <cstdarg>
#include <string>
#include <utility>
-namespace {
-
-size_t get_addr(const char* str) {
- size_t addr;
- std::istringstream ss(str);
- ss >> std::hex >> addr;
- SkASSERT(!ss.fail());
- return addr;
-}
-
-}
-
namespace skvm::viz {
#if defined(SK_ENABLE_SKSL)
@@ -42,8 +28,6 @@ Visualizer::Visualizer(SkSL::SkVMDebugTrace* debugInfo) : fOutput(nullptr) {}
bool Instruction::operator == (const Instruction& o) const {
return this->kind == o.kind &&
- this->startCode == o.startCode &&
- this->endCode == o.endCode &&
this->instructionIndex == o.instructionIndex &&
this->instruction == o.instruction &&
this->duplicates == o.duplicates;
@@ -64,75 +48,9 @@ uint32_t InstructionHash::operator()(const Instruction& i) const {
return hash;
}
-void Visualizer::parseDisassembler(SkWStream* output, const char* code) {
- if (code == nullptr) {
- fAsmLine = 0;
- return;
- }
- // Read the disassembled code from <_skvm_jit> until
- // the last command that is attached to the byte code
- // We skip all the prelude (main loop organizing and such)
- // generate the main loop running on vector values (keeping hoisted commands in place)
- // and skip the tail loop (which is the same as the main, only on scalar values)
- // We stop after the last byte code.
- SkTArray<SkString> commands;
- SkStrSplit(code, "\n", kStrict_SkStrSplitMode, &commands);
- for (const SkString& line : commands) {
- ++fAsmLine;
- if (line.find("<_skvm_jit>") >= 0) {
- break;
- }
- }
-
- if (fAsmLine < commands.size()) {
- const SkString& line = commands[fAsmLine];
- SkTArray<SkString> tokens;
- SkStrSplit(line.c_str(), "\t", kStrict_SkStrSplitMode, &tokens);
- if (tokens.size() >= 2 && tokens[0].size() > 1) {
- fAsmStart = get_addr(tokens[0].c_str());
- }
- }
-
- fAsmEnd += fAsmStart;
- for (size_t i = fAsmLine; i < commands.size(); ++i) {
- const SkString& line = commands[i];
- SkTArray<SkString> tokens;
- SkStrSplit(line.c_str(), "\t", kStrict_SkStrSplitMode, &tokens);
- size_t addr = 0;
- if (tokens.size() >= 2 && tokens[0].size() > 1) {
- addr = get_addr(tokens[0].c_str());
- }
- if (addr > fAsmEnd) {
- break;
- }
- addr -= fAsmStart;
- if (!fAsm.empty()) {
- MachineCommand& prev = fAsm.back();
- if (prev.command.isEmpty()) {
- int len = addr - prev.address;
- prev.command.printf("{ align %d bytes }", len);
- }
- }
- SkString command;
- for (size_t t = 2; t < tokens.size(); ++t) {
- command += tokens[t];
- }
- fAsm.push_back({addr, tokens[0], command, tokens[1]});
- }
- if (!fAsm.empty()) {
- MachineCommand& prev = fAsm.back();
- if (prev.command.isEmpty()) {
- int len = fInstructions.back().endCode - prev.address;
- prev.command.printf("{ align %d bytes }", len);
- }
- }
- fAsmLine = 0;
-}
-
-void Visualizer::dump(SkWStream* output, const char* code) {
+void Visualizer::dump(SkWStream* output) {
SkDebugfStream stream;
fOutput = output ? output : &stream;
- this->parseDisassembler(output, code);
this->dumpHead();
for (size_t id = 0ul; id < fInstructions.size(); ++id) {
this->dumpInstruction(id);
@@ -170,13 +88,7 @@ void Visualizer::addInstructions(std::vector<skvm::Instruction>& program) {
this->markAsDuplicate(instr.immA, id);
instr = program[instr.immA];
}
- this->addInstruction({
- viz::InstructionFlags::kNormal,
- /*startCode=*/0, /*endCode=0*/0,
- id,
- isDuplicate ? -1 : 0,
- instr
- });
+ this->addInstruction({viz::InstructionFlags::kNormal, id, isDuplicate ? -1 : 0, instr});
}
}
@@ -205,14 +117,6 @@ void Visualizer::finalize(const std::vector<skvm::Instruction>& all,
}
}
-void Visualizer::addMachineCommands(int id, size_t start, size_t end) {
- size_t found = fToDisassembler[id];
- Instruction& instruction = fInstructions[found];
- instruction.startCode = start;
- instruction.endCode = end;
- fAsmEnd = std::max(fAsmEnd, end);
-}
-
SkString Visualizer::V(int reg) const {
if (reg == -1) {
return SkString("{optimized}");
@@ -394,25 +298,6 @@ void Visualizer::dumpInstruction(int id0) const {
case skvm::Op::round: formatA_V(id, "round", x); break;
default: SkASSERT(false);
}
- // Generation
- if ((instruction.kind & InstructionFlags::kDead) == 0) {
- struct Compare
- {
- bool operator() (const MachineCommand& c, std::pair<size_t, size_t> p) const
- { return c.address < p.first; }
- bool operator() (std::pair<size_t, size_t> p, const MachineCommand& c) const
- { return p.second <= c.address; }
- };
-
- std::pair<size_t, size_t> range(instruction.startCode, instruction.endCode);
- auto commands = std::equal_range(fAsm.begin(), fAsm.end(), range, Compare{ });
- for (const MachineCommand* line = commands.first; line != commands.second; ++line) {
- this->writeText("</td></tr>\n<tr class='machine'><td>%s</td><td colspan='2'>%s",
- line->label.c_str(),
- line->command.c_str());
- }
- fAsmLine = commands.second - fAsm.begin();
- }
this->writeText("</td></tr>\n");
}
@@ -431,7 +316,6 @@ void Visualizer::dumpHead() const {
" .source, .source1 { color: darkblue; }\n"
" .mask, .mask1 { color: green; }\n"
" .comments, .comments1 { }\n"
- " .machine, .machine1 { color: lightblue; }\n"
" </style>\n"
" <script>\n"
" function initializeButton(className) {\n"
@@ -448,7 +332,6 @@ void Visualizer::dumpHead() const {
" initializeButton('normal');\n"
" initializeButton('source');\n"
" initializeButton('dead');\n"
- " initializeButton('machine');\n"
" };\n"
" </script>\n"
"</head>\n"
@@ -503,9 +386,6 @@ void Visualizer::dumpHead() const {
" <tr class='dead1'><td></td><td>{dead code} = mul_f32 v1, v18</td>"
"<td><button id='dead' onclick=\"toggle(this, 'dead')\">Hide</button></td>"
"<td>An eliminated \"dead code\" SkVM command</td></tr>\n"
- " <tr class='machine1'><td>{address}</td><td>vmovups (%rsi),%ymm0</td>"
- "<td><button id='machine' onclick=\"toggle(this, 'machine')\">Hide</button></td>"
- "<td>A disassembled machine command generated by SkVM command</td></tr>\n"
" </table>\n"
" <table border = \"0\"style='font-family:\"monospace\"; font-size: 10px;'>\n"
" <caption style='font-family:Roboto;font-size:15px;text-align:left;'>SkVM Code</caption>\n"
diff --git a/chromium/third_party/skia/src/utils/SkVMVisualizer.h b/chromium/third_party/skia/src/utils/SkVMVisualizer.h
index 71086bc81f9..2c482dad7d5 100644
--- a/chromium/third_party/skia/src/utils/SkVMVisualizer.h
+++ b/chromium/third_party/skia/src/utils/SkVMVisualizer.h
@@ -14,6 +14,7 @@
#include "src/core/SkVM.h"
#include <cstddef>
+#include <cstdint>
#include <type_traits>
#include <vector>
@@ -27,18 +28,8 @@ namespace skvm::viz {
kDead = 0x02,
};
- struct MachineCommand {
- size_t address;
- SkString label;
- SkString command;
- SkString extra;
- };
-
struct Instruction {
InstructionFlags kind = InstructionFlags::kNormal;
- // Machine commands range (for disassembling):
- size_t startCode = 0;
- size_t endCode = 0;
int instructionIndex; // index in the actual instructions list
int duplicates = 0; // number of duplicates;
// -1 means it's a duplicate itself; 0 - it does not have dups
@@ -55,7 +46,7 @@ namespace skvm::viz {
public:
explicit Visualizer(SkSL::SkVMDebugTrace* debugInfo);
~Visualizer() = default;
- void dump(SkWStream* output, const char* code);
+ void dump(SkWStream* output);
void markAsDeadCode(std::vector<bool>& live, const std::vector<int>& newIds);
void finalize(const std::vector<skvm::Instruction>& all,
const std::vector<skvm::OptimizedInstruction>& optimized);
@@ -64,10 +55,8 @@ namespace skvm::viz {
++fInstructions[origin].duplicates;
}
void addInstruction(Instruction skvm);
- void addMachineCommands(int id, size_t start, size_t end);
SkString V(int reg) const;
private:
- void parseDisassembler(SkWStream* output, const char* code);
void dumpInstruction(int id) const;
void dumpHead() const;
void dumpTail() const;
@@ -94,10 +83,6 @@ namespace skvm::viz {
SkTArray<Instruction> fInstructions;
SkWStream* fOutput;
SkTHashMap<int, size_t> fToDisassembler;
- SkTArray<MachineCommand> fAsm;
- mutable size_t fAsmLine = 0;
- size_t fAsmStart = 0;
- size_t fAsmEnd = 0;
};
} // namespace skvm::viz
diff --git a/chromium/third_party/skia/src/utils/mac/SkCTFont.cpp b/chromium/third_party/skia/src/utils/mac/SkCTFont.cpp
index 6cd8589639d..49adab4ad11 100644
--- a/chromium/third_party/skia/src/utils/mac/SkCTFont.cpp
+++ b/chromium/third_party/skia/src/utils/mac/SkCTFont.cpp
@@ -229,7 +229,7 @@ SkCTFontSmoothBehavior SkCTFontGetSmoothBehavior() {
colorspace.get(), kBitmapInfoRGB));
SkUniqueCFRef<CFDataRef> data(CFDataCreateWithBytesNoCopy(
- kCFAllocatorDefault, kSpiderSymbol_ttf, SK_ARRAY_COUNT(kSpiderSymbol_ttf),
+ kCFAllocatorDefault, kSpiderSymbol_ttf, std::size(kSpiderSymbol_ttf),
kCFAllocatorNull));
SkUniqueCFRef<CTFontDescriptorRef> desc(
CTFontManagerCreateFontDescriptorFromData(data.get()));
@@ -298,7 +298,7 @@ SkCTFontWeightMapping& SkCTFontGetNSFontWeightMapping() {
SK_KIT_FONT_WEIGHT_PREFIX "FontWeightHeavy",
SK_KIT_FONT_WEIGHT_PREFIX "FontWeightBlack",
};
- static_assert(SK_ARRAY_COUNT(nsFontWeightNames) == 9, "");
+ static_assert(std::size(nsFontWeightNames) == 9, "");
static CGFloat nsFontWeights[11];
static const CGFloat (*selectedNSFontWeights)[11] = &defaultNSFontWeights;
@@ -330,7 +330,7 @@ SkCTFontWeightMapping& SkCTFontGetDataFontWeightMapping() {
static CGFloat dataFontWeights[11];
static SkOnce once;
once([&] {
- constexpr size_t dataSize = SK_ARRAY_COUNT(kSpiderSymbol_ttf);
+ constexpr size_t dataSize = std::size(kSpiderSymbol_ttf);
sk_sp<SkData> data = SkData::MakeWithCopy(kSpiderSymbol_ttf, dataSize);
const SkSFNTHeader* sfntHeader = reinterpret_cast<const SkSFNTHeader*>(data->data());
const SkSFNTHeader::TableDirectoryEntry* tableEntry =
diff --git a/chromium/third_party/skia/src/utils/win/SkWGL_win.cpp b/chromium/third_party/skia/src/utils/win/SkWGL_win.cpp
index 5f1278010d6..8987fbbde99 100644
--- a/chromium/third_party/skia/src/utils/win/SkWGL_win.cpp
+++ b/chromium/third_party/skia/src/utils/win/SkWGL_win.cpp
@@ -393,7 +393,7 @@ static HGLRC create_gl_context(HDC dc, const SkWGLExtensions& extensions,
SK_WGL_CONTEXT_PROFILE_MASK, SK_WGL_CONTEXT_CORE_PROFILE_BIT,
0,
};
- for (size_t v = 0; v < SK_ARRAY_COUNT(kCoreGLVersions) / 2; ++v) {
+ for (size_t v = 0; v < std::size(kCoreGLVersions) / 2; ++v) {
coreProfileAttribs[1] = kCoreGLVersions[2 * v];
coreProfileAttribs[3] = kCoreGLVersions[2 * v + 1];
glrc = extensions.createContextAttribs(dc, shareContext, coreProfileAttribs);
@@ -432,7 +432,7 @@ HGLRC SkCreateWGLContext(HDC dc, int msaaSampleCount, bool deepColor,
int pixelFormatsToTry[] = { -1, -1 };
get_pixel_formats_to_try(dc, extensions, true, msaaSampleCount, deepColor, pixelFormatsToTry);
for (size_t f = 0;
- !set && -1 != pixelFormatsToTry[f] && f < SK_ARRAY_COUNT(pixelFormatsToTry);
+ !set && -1 != pixelFormatsToTry[f] && f < std::size(pixelFormatsToTry);
++f) {
PIXELFORMATDESCRIPTOR pfd;
DescribePixelFormat(dc, pixelFormatsToTry[f], sizeof(pfd), &pfd);
diff --git a/chromium/third_party/skia/src/xml/BUILD.bazel b/chromium/third_party/skia/src/xml/BUILD.bazel
index 69666adff23..fc0080a6618 100644
--- a/chromium/third_party/skia/src/xml/BUILD.bazel
+++ b/chromium/third_party/skia/src/xml/BUILD.bazel
@@ -1,5 +1,37 @@
-load("//bazel:macros.bzl", "exports_files_legacy")
+load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_deps", "split_srcs_and_hdrs")
licenses(["notice"])
exports_files_legacy()
+
+XML_FILES = [
+ "SkDOM.cpp",
+ "SkDOM.h",
+ "SkXMLParser.cpp",
+ "SkXMLParser.h",
+ "SkXMLWriter.cpp",
+ "SkXMLWriter.h",
+]
+
+split_srcs_and_hdrs(
+ name = "xml",
+ files = XML_FILES,
+)
+
+filegroup(
+ name = "srcs",
+ srcs = [":xml_srcs"],
+ visibility = ["//src:__pkg__"],
+)
+
+filegroup(
+ name = "private_hdrs",
+ srcs = [":xml_hdrs"],
+ visibility = ["//src:__pkg__"],
+)
+
+skia_cc_deps(
+ name = "deps",
+ visibility = ["//src:__pkg__"],
+ deps = ["@expat"],
+)
diff --git a/chromium/third_party/skia/src/xml/SkXMLParser.cpp b/chromium/third_party/skia/src/xml/SkXMLParser.cpp
index 7432ae884fe..69e9fc44c05 100644
--- a/chromium/third_party/skia/src/xml/SkXMLParser.cpp
+++ b/chromium/third_party/skia/src/xml/SkXMLParser.cpp
@@ -41,7 +41,7 @@ void SkXMLParserError::getErrorString(SkString* str) const
SkASSERT(str);
SkString temp;
if (fCode != kNoError) {
- if ((unsigned)fCode < SK_ARRAY_COUNT(gErrorStrings))
+ if ((unsigned)fCode < std::size(gErrorStrings))
temp.set(gErrorStrings[fCode - 1]);
temp.append(fNoun);
} else
diff --git a/chromium/third_party/skia/src/xml/SkXMLWriter.cpp b/chromium/third_party/skia/src/xml/SkXMLWriter.cpp
index 4640d73d93b..c1005bf6991 100644
--- a/chromium/third_party/skia/src/xml/SkXMLWriter.cpp
+++ b/chromium/third_party/skia/src/xml/SkXMLWriter.cpp
@@ -95,7 +95,7 @@ static const char* escape_char(char c, char storage[2]) {
};
const char** array = gEscapeChars;
- for (unsigned i = 0; i < SK_ARRAY_COUNT(gEscapeChars); i++) {
+ for (unsigned i = 0; i < std::size(gEscapeChars); i++) {
if (array[i][0] == c) {
return &array[i][1];
}
diff --git a/chromium/third_party/skia/src/xps/SkXPSDevice.cpp b/chromium/third_party/skia/src/xps/SkXPSDevice.cpp
index a79bac27ebe..01f1a215428 100644
--- a/chromium/third_party/skia/src/xps/SkXPSDevice.cpp
+++ b/chromium/third_party/skia/src/xps/SkXPSDevice.cpp
@@ -39,7 +39,6 @@
#include "src/core/SkDraw.h"
#include "src/core/SkEndian.h"
#include "src/core/SkGeometry.h"
-#include "src/core/SkGlyphRun.h"
#include "src/core/SkImagePriv.h"
#include "src/core/SkMaskFilterBase.h"
#include "src/core/SkRasterClip.h"
@@ -50,6 +49,7 @@
#include "src/sfnt/SkSFNTHeader.h"
#include "src/sfnt/SkTTCFHeader.h"
#include "src/shaders/SkShaderBase.h"
+#include "src/text/GlyphRun.h"
#include "src/utils/SkClipStackUtils.h"
#include "src/utils/win/SkHRESULT.h"
#include "src/utils/win/SkIStream.h"
@@ -63,7 +63,7 @@
//Placeholder representation of a GUID from createId.
#define L_GUID_ID L"XXXXXXXXsXXXXsXXXXsXXXXsXXXXXXXXXXXX"
//Length of GUID representation from createId, including nullptr terminator.
-#define GUID_ID_LEN SK_ARRAY_COUNT(L_GUID_ID)
+#define GUID_ID_LEN std::size(L_GUID_ID)
/**
Formats a GUID and places it into buffer.
@@ -170,8 +170,8 @@ HRESULT SkXPSDevice::createXpsThumbnail(IXpsOMPage* page,
SkTScopedComPtr<IOpcPartUri> partUri;
constexpr size_t size = std::max(
- SK_ARRAY_COUNT(L"/Documents/1/Metadata/.png") + sk_digits_in<decltype(pageNum)>(),
- SK_ARRAY_COUNT(L"/Metadata/" L_GUID_ID L".png"));
+ std::size(L"/Documents/1/Metadata/.png") + sk_digits_in<decltype(pageNum)>(),
+ std::size(L"/Metadata/" L_GUID_ID L".png"));
wchar_t buffer[size];
if (pageNum > 0) {
swprintf_s(buffer, size, L"/Documents/1/Metadata/%u.png", pageNum);
@@ -196,7 +196,7 @@ HRESULT SkXPSDevice::createXpsThumbnail(IXpsOMPage* page,
HRESULT SkXPSDevice::createXpsPage(const XPS_SIZE& pageSize,
IXpsOMPage** page) {
constexpr size_t size =
- SK_ARRAY_COUNT(L"/Documents/1/Pages/.fpage")
+ std::size(L"/Documents/1/Pages/.fpage")
+ sk_digits_in<decltype(fCurrentPage)>();
wchar_t buffer[size];
swprintf_s(buffer, size, L"/Documents/1/Pages/%u.fpage",
@@ -638,7 +638,7 @@ HRESULT SkXPSDevice::createXpsImageBrush(
"Could not create stream from png data.");
const size_t size =
- SK_ARRAY_COUNT(L"/Documents/1/Resources/Images/" L_GUID_ID L".png");
+ std::size(L"/Documents/1/Resources/Images/" L_GUID_ID L".png");
wchar_t buffer[size];
wchar_t id[GUID_ID_LEN];
HR(this->createId(id, GUID_ID_LEN));
@@ -1238,7 +1238,7 @@ void SkXPSDevice::internalDrawRect(const SkRect& r,
{ r.fRight, r.fTop },
};
if (!xpsTransformsPath && transformRect) {
- this->localToDevice().mapPoints(points, SK_ARRAY_COUNT(points));
+ this->localToDevice().mapPoints(points, std::size(points));
}
HRV(this->createXpsQuad(points, stroke, fill, &rectFigure));
}
@@ -1758,7 +1758,7 @@ HRESULT SkXPSDevice::CreateTypefaceUse(const SkFont& font,
"Could not create font stream.");
const size_t size =
- SK_ARRAY_COUNT(L"/Resources/Fonts/" L_GUID_ID L".odttf");
+ std::size(L"/Resources/Fonts/" L_GUID_ID L".odttf");
wchar_t buffer[size];
wchar_t id[GUID_ID_LEN];
HR(this->createId(id, GUID_ID_LEN));
@@ -1898,7 +1898,7 @@ static bool text_must_be_pathed(const SkPaint& paint, const SkMatrix& matrix) {
}
void SkXPSDevice::onDrawGlyphRunList(SkCanvas*,
- const SkGlyphRunList& glyphRunList,
+ const sktext::GlyphRunList& glyphRunList,
const SkPaint& initailPaint,
const SkPaint& drawingPaint) {
SkASSERT(!glyphRunList.hasRSXForm());
diff --git a/chromium/third_party/skia/src/xps/SkXPSDevice.h b/chromium/third_party/skia/src/xps/SkXPSDevice.h
index 2c3b702cff6..036b507e7d8 100644
--- a/chromium/third_party/skia/src/xps/SkXPSDevice.h
+++ b/chromium/third_party/skia/src/xps/SkXPSDevice.h
@@ -30,8 +30,9 @@
#include "src/utils/win/SkAutoCoInitialize.h"
#include "src/utils/win/SkTScopedComPtr.h"
-class SkGlyphRunList;
-
+namespace sktext {
+class GlyphRunList;
+}
//#define SK_XPS_USE_DETERMINISTIC_IDS
/** \class SkXPSDevice
@@ -93,7 +94,7 @@ protected:
const SkSamplingOptions&, const SkPaint& paint,
SkCanvas::SrcRectConstraint) override;
void onDrawGlyphRunList(
- SkCanvas*, const SkGlyphRunList&, const SkPaint&, const SkPaint&) override;
+ SkCanvas*, const sktext::GlyphRunList&, const SkPaint&, const SkPaint&) override;
void drawVertices(const SkVertices*, sk_sp<SkBlender>, const SkPaint&, bool) override;
void drawMesh(const SkMesh&, sk_sp<SkBlender>, const SkPaint&) override;
void drawDevice(SkBaseDevice*, const SkSamplingOptions&, const SkPaint&) override;
diff --git a/chromium/third_party/skia/third_party/BUILD.bazel b/chromium/third_party/skia/third_party/BUILD.bazel
deleted file mode 100644
index d1427577ae2..00000000000
--- a/chromium/third_party/skia/third_party/BUILD.bazel
+++ /dev/null
@@ -1,1723 +0,0 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy", "py_binary")
-
-licenses(["notice"])
-
-exports_files_legacy()
-
-FREETYPE_DEFINES = ["FT2_BUILD_LIBRARY"] + select(
- {
- "//bazel/common_config_settings:cpu_wasm": [
- # Use a trimmed down set of options to reduce code size.
- "FT_CONFIG_MODULES_H=<include/freetype-no-type1/ftmodule.h>",
- "FT_CONFIG_OPTIONS_H=<include/freetype-no-type1/ftoption.h>",
- ],
- "//conditions:default": [
- "FT_CONFIG_MODULES_H=<include/freetype-android/ftmodule.h>",
- "FT_CONFIG_OPTIONS_H=<include/freetype-android/ftoption.h>",
- ],
- },
-)
-
-cc_library(
- name = "freetype2",
- srcs = [
- "externals/freetype/include/freetype/internal/autohint.h",
- "externals/freetype/include/freetype/internal/cffotypes.h",
- "externals/freetype/include/freetype/internal/cfftypes.h",
- "externals/freetype/include/freetype/internal/compiler-macros.h",
- "externals/freetype/include/freetype/internal/ftcalc.h",
- "externals/freetype/include/freetype/internal/ftdebug.h",
- "externals/freetype/include/freetype/internal/ftdrv.h",
- "externals/freetype/include/freetype/internal/ftgloadr.h",
- "externals/freetype/include/freetype/internal/fthash.h",
- "externals/freetype/include/freetype/internal/ftmemory.h",
- "externals/freetype/include/freetype/internal/ftmmtypes.h",
- "externals/freetype/include/freetype/internal/ftobjs.h",
- "externals/freetype/include/freetype/internal/ftpsprop.h",
- "externals/freetype/include/freetype/internal/ftrfork.h",
- "externals/freetype/include/freetype/internal/ftserv.h",
- "externals/freetype/include/freetype/internal/ftstream.h",
- "externals/freetype/include/freetype/internal/fttrace.h",
- "externals/freetype/include/freetype/internal/ftvalid.h",
- "externals/freetype/include/freetype/internal/psaux.h",
- "externals/freetype/include/freetype/internal/pshints.h",
- "externals/freetype/include/freetype/internal/services/svbdf.h",
- "externals/freetype/include/freetype/internal/services/svcfftl.h",
- "externals/freetype/include/freetype/internal/services/svcid.h",
- "externals/freetype/include/freetype/internal/services/svfntfmt.h",
- "externals/freetype/include/freetype/internal/services/svgldict.h",
- "externals/freetype/include/freetype/internal/services/svgxval.h",
- "externals/freetype/include/freetype/internal/services/svkern.h",
- "externals/freetype/include/freetype/internal/services/svmetric.h",
- "externals/freetype/include/freetype/internal/services/svmm.h",
- "externals/freetype/include/freetype/internal/services/svotval.h",
- "externals/freetype/include/freetype/internal/services/svpfr.h",
- "externals/freetype/include/freetype/internal/services/svpostnm.h",
- "externals/freetype/include/freetype/internal/services/svprop.h",
- "externals/freetype/include/freetype/internal/services/svpscmap.h",
- "externals/freetype/include/freetype/internal/services/svpsinfo.h",
- "externals/freetype/include/freetype/internal/services/svsfnt.h",
- "externals/freetype/include/freetype/internal/services/svttcmap.h",
- "externals/freetype/include/freetype/internal/services/svtteng.h",
- "externals/freetype/include/freetype/internal/services/svttglyf.h",
- "externals/freetype/include/freetype/internal/services/svwinfnt.h",
- "externals/freetype/include/freetype/internal/sfnt.h",
- "externals/freetype/include/freetype/internal/svginterface.h",
- "externals/freetype/include/freetype/internal/t1types.h",
- "externals/freetype/include/freetype/internal/tttypes.h",
- "externals/freetype/include/freetype/internal/wofftypes.h",
- "externals/freetype/include/freetype/otsvg.h",
- "externals/freetype/include/freetype/t1tables.h",
- "externals/freetype/include/freetype/ttnameid.h",
- "externals/freetype/include/freetype/tttables.h",
- "externals/freetype/include/freetype/tttags.h",
- "externals/freetype/src/autofit/afblue.h",
- "externals/freetype/src/autofit/afcjk.h",
- "externals/freetype/src/autofit/afcover.h",
- "externals/freetype/src/autofit/afdummy.h",
- "externals/freetype/src/autofit/aferrors.h",
- "externals/freetype/src/autofit/afglobal.h",
- "externals/freetype/src/autofit/afhints.h",
- "externals/freetype/src/autofit/afindic.h",
- "externals/freetype/src/autofit/aflatin.h",
- "externals/freetype/src/autofit/afloader.h",
- "externals/freetype/src/autofit/afmodule.h",
- "externals/freetype/src/autofit/afranges.h",
- "externals/freetype/src/autofit/afscript.h",
- "externals/freetype/src/autofit/afshaper.h",
- "externals/freetype/src/autofit/afstyles.h",
- "externals/freetype/src/autofit/aftypes.h",
- "externals/freetype/src/autofit/afws-decl.h",
- "externals/freetype/src/autofit/afws-iter.h",
- "externals/freetype/src/autofit/autofit.c",
- "externals/freetype/src/base/ftbase.c",
- "externals/freetype/src/base/ftbase.h",
- "externals/freetype/src/base/ftbbox.c",
- "externals/freetype/src/base/ftbitmap.c",
- "externals/freetype/src/base/ftdebug.c",
- "externals/freetype/src/base/ftfstype.c",
- "externals/freetype/src/base/ftgasp.c",
- "externals/freetype/src/base/ftglyph.c",
- "externals/freetype/src/base/ftinit.c",
- "externals/freetype/src/base/ftmm.c",
- "externals/freetype/src/base/ftpatent.c",
- "externals/freetype/src/base/ftstroke.c",
- "externals/freetype/src/base/ftsynth.c",
- "externals/freetype/src/base/ftsystem.c",
- "externals/freetype/src/base/fttype1.c",
- "externals/freetype/src/base/ftwinfnt.c",
- "externals/freetype/src/base/md5.h",
- "externals/freetype/src/cff/cff.c",
- "externals/freetype/src/cff/cffcmap.h",
- "externals/freetype/src/cff/cffdrivr.h",
- "externals/freetype/src/cff/cfferrs.h",
- "externals/freetype/src/cff/cffgload.h",
- "externals/freetype/src/cff/cffload.h",
- "externals/freetype/src/cff/cffobjs.h",
- "externals/freetype/src/cff/cffparse.h",
- "externals/freetype/src/cff/cfftoken.h",
- "externals/freetype/src/cid/ciderrs.h",
- "externals/freetype/src/cid/cidgload.h",
- "externals/freetype/src/cid/cidload.h",
- "externals/freetype/src/cid/cidobjs.h",
- "externals/freetype/src/cid/cidparse.h",
- "externals/freetype/src/cid/cidriver.h",
- "externals/freetype/src/cid/cidtoken.h",
- "externals/freetype/src/cid/type1cid.c",
- "externals/freetype/src/gzip/crc32.h",
- "externals/freetype/src/gzip/ftgzip.c",
- "externals/freetype/src/gzip/ftzconf.h",
- "externals/freetype/src/gzip/inffast.h",
- "externals/freetype/src/gzip/inffixed.h",
- "externals/freetype/src/gzip/inflate.h",
- "externals/freetype/src/gzip/inftrees.h",
- "externals/freetype/src/gzip/zlib.h",
- "externals/freetype/src/gzip/zutil.h",
- "externals/freetype/src/psaux/afmparse.h",
- "externals/freetype/src/psaux/cffdecode.h",
- "externals/freetype/src/psaux/psarrst.h",
- "externals/freetype/src/psaux/psaux.c",
- "externals/freetype/src/psaux/psauxerr.h",
- "externals/freetype/src/psaux/psauxmod.h",
- "externals/freetype/src/psaux/psblues.h",
- "externals/freetype/src/psaux/psconv.h",
- "externals/freetype/src/psaux/pserror.h",
- "externals/freetype/src/psaux/psfixed.h",
- "externals/freetype/src/psaux/psfont.h",
- "externals/freetype/src/psaux/psft.h",
- "externals/freetype/src/psaux/psglue.h",
- "externals/freetype/src/psaux/pshints.h",
- "externals/freetype/src/psaux/psintrp.h",
- "externals/freetype/src/psaux/psobjs.h",
- "externals/freetype/src/psaux/psread.h",
- "externals/freetype/src/psaux/psstack.h",
- "externals/freetype/src/psaux/pstypes.h",
- "externals/freetype/src/psaux/t1cmap.h",
- "externals/freetype/src/psaux/t1decode.h",
- "externals/freetype/src/pshinter/pshalgo.h",
- "externals/freetype/src/pshinter/pshglob.h",
- "externals/freetype/src/pshinter/pshinter.c",
- "externals/freetype/src/pshinter/pshmod.h",
- "externals/freetype/src/pshinter/pshnterr.h",
- "externals/freetype/src/pshinter/pshrec.h",
- "externals/freetype/src/psnames/psmodule.h",
- "externals/freetype/src/psnames/psnamerr.h",
- "externals/freetype/src/psnames/psnames.c",
- "externals/freetype/src/psnames/pstables.h",
- "externals/freetype/src/raster/ftmisc.h",
- "externals/freetype/src/raster/ftraster.h",
- "externals/freetype/src/raster/ftrend1.h",
- "externals/freetype/src/raster/raster.c",
- "externals/freetype/src/raster/rasterrs.h",
- "externals/freetype/src/sfnt/pngshim.h",
- "externals/freetype/src/sfnt/sfdriver.h",
- "externals/freetype/src/sfnt/sferrors.h",
- "externals/freetype/src/sfnt/sfnt.c",
- "externals/freetype/src/sfnt/sfobjs.h",
- "externals/freetype/src/sfnt/sfwoff.h",
- "externals/freetype/src/sfnt/sfwoff2.h",
- "externals/freetype/src/sfnt/ttbdf.h",
- "externals/freetype/src/sfnt/ttcmap.h",
- "externals/freetype/src/sfnt/ttcmapc.h",
- "externals/freetype/src/sfnt/ttcolr.h",
- "externals/freetype/src/sfnt/ttcpal.h",
- "externals/freetype/src/sfnt/ttkern.h",
- "externals/freetype/src/sfnt/ttload.h",
- "externals/freetype/src/sfnt/ttmtx.h",
- "externals/freetype/src/sfnt/ttpost.h",
- "externals/freetype/src/sfnt/ttsbit.h",
- "externals/freetype/src/sfnt/woff2tags.h",
- "externals/freetype/src/smooth/ftgrays.h",
- "externals/freetype/src/smooth/ftsmerrs.h",
- "externals/freetype/src/smooth/ftsmooth.h",
- "externals/freetype/src/smooth/smooth.c",
- "externals/freetype/src/svg/ftsvg.h",
- "externals/freetype/src/svg/svg.c",
- "externals/freetype/src/svg/svgtypes.h",
- "externals/freetype/src/truetype/truetype.c",
- "externals/freetype/src/truetype/ttdriver.h",
- "externals/freetype/src/truetype/tterrors.h",
- "externals/freetype/src/truetype/ttgload.h",
- "externals/freetype/src/truetype/ttgxvar.h",
- "externals/freetype/src/truetype/ttinterp.h",
- "externals/freetype/src/truetype/ttobjs.h",
- "externals/freetype/src/truetype/ttpload.h",
- "externals/freetype/src/truetype/ttsubpix.h",
- "externals/freetype/src/type1/t1afm.h",
- "externals/freetype/src/type1/t1driver.h",
- "externals/freetype/src/type1/t1errors.h",
- "externals/freetype/src/type1/t1gload.h",
- "externals/freetype/src/type1/t1load.h",
- "externals/freetype/src/type1/t1objs.h",
- "externals/freetype/src/type1/t1parse.h",
- "externals/freetype/src/type1/t1tokens.h",
- "externals/freetype/src/type1/type1.c",
- "freetype2/include/freetype-android/ftmodule.h",
- "freetype2/include/freetype-android/ftoption.h",
- "freetype2/include/freetype-no-type1/ftmodule.h",
- "freetype2/include/freetype-no-type1/ftoption.h",
- ],
- hdrs = [
- "externals/freetype/include/freetype/config/ftconfig.h",
- "externals/freetype/include/freetype/config/ftheader.h",
- "externals/freetype/include/freetype/config/ftmodule.h",
- "externals/freetype/include/freetype/config/ftoption.h",
- "externals/freetype/include/freetype/config/ftstdlib.h",
- "externals/freetype/include/freetype/config/integer-types.h",
- "externals/freetype/include/freetype/config/mac-support.h",
- "externals/freetype/include/freetype/config/public-macros.h",
- "externals/freetype/include/freetype/freetype.h",
- "externals/freetype/include/freetype/ftadvanc.h",
- "externals/freetype/include/freetype/ftbbox.h",
- "externals/freetype/include/freetype/ftbdf.h",
- "externals/freetype/include/freetype/ftbitmap.h",
- "externals/freetype/include/freetype/ftbzip2.h",
- "externals/freetype/include/freetype/ftcache.h",
- "externals/freetype/include/freetype/ftchapters.h",
- "externals/freetype/include/freetype/ftcid.h",
- "externals/freetype/include/freetype/ftcolor.h",
- "externals/freetype/include/freetype/ftdriver.h",
- "externals/freetype/include/freetype/fterrdef.h",
- "externals/freetype/include/freetype/fterrors.h",
- "externals/freetype/include/freetype/ftfntfmt.h",
- "externals/freetype/include/freetype/ftgasp.h",
- "externals/freetype/include/freetype/ftglyph.h",
- "externals/freetype/include/freetype/ftgxval.h",
- "externals/freetype/include/freetype/ftgzip.h",
- "externals/freetype/include/freetype/ftimage.h",
- "externals/freetype/include/freetype/ftincrem.h",
- "externals/freetype/include/freetype/ftlcdfil.h",
- "externals/freetype/include/freetype/ftlist.h",
- "externals/freetype/include/freetype/ftlogging.h",
- "externals/freetype/include/freetype/ftlzw.h",
- "externals/freetype/include/freetype/ftmac.h",
- "externals/freetype/include/freetype/ftmm.h",
- "externals/freetype/include/freetype/ftmodapi.h",
- "externals/freetype/include/freetype/ftmoderr.h",
- "externals/freetype/include/freetype/ftotval.h",
- "externals/freetype/include/freetype/ftoutln.h",
- "externals/freetype/include/freetype/ftparams.h",
- "externals/freetype/include/freetype/ftpfr.h",
- "externals/freetype/include/freetype/ftrender.h",
- "externals/freetype/include/freetype/ftsizes.h",
- "externals/freetype/include/freetype/ftsnames.h",
- "externals/freetype/include/freetype/ftstroke.h",
- "externals/freetype/include/freetype/ftsynth.h",
- "externals/freetype/include/freetype/ftsystem.h",
- "externals/freetype/include/freetype/fttrigon.h",
- "externals/freetype/include/freetype/fttypes.h",
- "externals/freetype/include/freetype/ftwinfnt.h",
- "externals/freetype/include/freetype/otsvg.h",
- "externals/freetype/include/freetype/t1tables.h",
- "externals/freetype/include/freetype/ttnameid.h",
- "externals/freetype/include/freetype/tttables.h",
- "externals/freetype/include/freetype/tttags.h",
- "externals/freetype/include/ft2build.h",
- ],
- copts = [
- "-isystem third_party/externals/freetype/include",
- "-isystem third_party/freetype2",
- ],
- defines = [
- # Make this define available to any client that has freetype2 as a dep.
- "SK_FREETYPE_MINIMUM_RUNTIME_VERSION=(((FREETYPE_MAJOR)<<24)|((FREETYPE_MINOR)<<16)|((FREETYPE_PATCH)<<8))",
- ],
- local_defines = FREETYPE_DEFINES,
- strip_include_prefix = "externals/freetype/include/",
- # Freetype includes a lot of .c files. We need to make those available for inclusion explicitly.
- textual_hdrs = [
- "externals/freetype/src/autofit/afblue.c",
- "externals/freetype/src/autofit/afcjk.c",
- "externals/freetype/src/autofit/afdummy.c",
- "externals/freetype/src/autofit/afglobal.c",
- "externals/freetype/src/autofit/afhints.c",
- "externals/freetype/src/autofit/afindic.c",
- "externals/freetype/src/autofit/aflatin.c",
- "externals/freetype/src/autofit/afloader.c",
- "externals/freetype/src/autofit/afmodule.c",
- "externals/freetype/src/autofit/afranges.c",
- "externals/freetype/src/autofit/afshaper.c",
- "externals/freetype/src/base/ftadvanc.c",
- "externals/freetype/src/base/ftbase.c",
- "externals/freetype/src/base/ftcalc.c",
- "externals/freetype/src/base/ftcolor.c",
- "externals/freetype/src/base/ftdbgmem.c",
- "externals/freetype/src/base/fterrors.c",
- "externals/freetype/src/base/ftfntfmt.c",
- "externals/freetype/src/base/ftgloadr.c",
- "externals/freetype/src/base/fthash.c",
- "externals/freetype/src/base/ftlcdfil.c",
- "externals/freetype/src/base/ftmac.c",
- "externals/freetype/src/base/ftobjs.c",
- "externals/freetype/src/base/ftoutln.c",
- "externals/freetype/src/base/ftpsprop.c",
- "externals/freetype/src/base/ftrfork.c",
- "externals/freetype/src/base/ftsnames.c",
- "externals/freetype/src/base/ftstream.c",
- "externals/freetype/src/base/fttrigon.c",
- "externals/freetype/src/base/ftutil.c",
- "externals/freetype/src/cff/cffcmap.c",
- "externals/freetype/src/cff/cffdrivr.c",
- "externals/freetype/src/cff/cffgload.c",
- "externals/freetype/src/cff/cffload.c",
- "externals/freetype/src/cff/cffobjs.c",
- "externals/freetype/src/cff/cffparse.c",
- "externals/freetype/src/cid/cidgload.c",
- "externals/freetype/src/cid/cidload.c",
- "externals/freetype/src/cid/cidobjs.c",
- "externals/freetype/src/cid/cidparse.c",
- "externals/freetype/src/cid/cidriver.c",
- "externals/freetype/src/gzip/adler32.c",
- "externals/freetype/src/gzip/crc32.c",
- "externals/freetype/src/gzip/inffast.c",
- "externals/freetype/src/gzip/inflate.c",
- "externals/freetype/src/gzip/inftrees.c",
- "externals/freetype/src/gzip/zutil.c",
- "externals/freetype/src/psaux/afmparse.c",
- "externals/freetype/src/psaux/cffdecode.c",
- "externals/freetype/src/psaux/psarrst.c",
- "externals/freetype/src/psaux/psauxmod.c",
- "externals/freetype/src/psaux/psblues.c",
- "externals/freetype/src/psaux/psconv.c",
- "externals/freetype/src/psaux/pserror.c",
- "externals/freetype/src/psaux/psfont.c",
- "externals/freetype/src/psaux/psft.c",
- "externals/freetype/src/psaux/pshints.c",
- "externals/freetype/src/psaux/psintrp.c",
- "externals/freetype/src/psaux/psobjs.c",
- "externals/freetype/src/psaux/psread.c",
- "externals/freetype/src/psaux/psstack.c",
- "externals/freetype/src/psaux/t1cmap.c",
- "externals/freetype/src/psaux/t1decode.c",
- "externals/freetype/src/pshinter/pshalgo.c",
- "externals/freetype/src/pshinter/pshglob.c",
- "externals/freetype/src/pshinter/pshmod.c",
- "externals/freetype/src/pshinter/pshrec.c",
- "externals/freetype/src/psnames/psmodule.c",
- "externals/freetype/src/raster/ftraster.c",
- "externals/freetype/src/raster/ftrend1.c",
- "externals/freetype/src/sfnt/pngshim.c",
- "externals/freetype/src/sfnt/sfdriver.c",
- "externals/freetype/src/sfnt/sfobjs.c",
- "externals/freetype/src/sfnt/sfwoff.c",
- "externals/freetype/src/sfnt/sfwoff2.c",
- "externals/freetype/src/sfnt/ttbdf.c",
- "externals/freetype/src/sfnt/ttcmap.c",
- "externals/freetype/src/sfnt/ttcolr.c",
- "externals/freetype/src/sfnt/ttcpal.c",
- "externals/freetype/src/sfnt/ttkern.c",
- "externals/freetype/src/sfnt/ttload.c",
- "externals/freetype/src/sfnt/ttmtx.c",
- "externals/freetype/src/sfnt/ttpost.c",
- "externals/freetype/src/sfnt/ttsbit.c",
- "externals/freetype/src/sfnt/ttsvg.c",
- "externals/freetype/src/sfnt/woff2tags.c",
- "externals/freetype/src/smooth/ftgrays.c",
- "externals/freetype/src/smooth/ftsmooth.c",
- "externals/freetype/src/svg/ftsvg.c",
- "externals/freetype/src/truetype/ttdriver.c",
- "externals/freetype/src/truetype/ttgload.c",
- "externals/freetype/src/truetype/ttgxvar.c",
- "externals/freetype/src/truetype/ttinterp.c",
- "externals/freetype/src/truetype/ttobjs.c",
- "externals/freetype/src/truetype/ttpload.c",
- "externals/freetype/src/truetype/ttsubpix.c",
- "externals/freetype/src/type1/t1afm.c",
- "externals/freetype/src/type1/t1driver.c",
- "externals/freetype/src/type1/t1gload.c",
- "externals/freetype/src/type1/t1load.c",
- "externals/freetype/src/type1/t1objs.c",
- "externals/freetype/src/type1/t1parse.c",
- ],
- visibility = ["//:__subpackages__"],
- deps = [
- "@libpng", # TODO(kjlubick) add brotli option
- ],
-)
-
-ICU_HDRS = [
- "externals/icu/source/common/bmpset.h",
- "externals/icu/source/common/brkeng.h",
- "externals/icu/source/common/bytesinkutil.h",
- "externals/icu/source/common/capi_helper.h",
- "externals/icu/source/common/charstr.h",
- "externals/icu/source/common/charstrmap.h",
- "externals/icu/source/common/cmemory.h",
- "externals/icu/source/common/cpputils.h",
- "externals/icu/source/common/cstr.h",
- "externals/icu/source/common/cstring.h",
- "externals/icu/source/common/cwchar.h",
- "externals/icu/source/common/dictbe.h",
- "externals/icu/source/common/dictionarydata.h",
- "externals/icu/source/common/hash.h",
- "externals/icu/source/common/icuplugimp.h",
- "externals/icu/source/common/localeprioritylist.h",
- "externals/icu/source/common/localsvc.h",
- "externals/icu/source/common/locbased.h",
- "externals/icu/source/common/locdistance.h",
- "externals/icu/source/common/loclikelysubtags.h",
- "externals/icu/source/common/locmap.h",
- "externals/icu/source/common/locutil.h",
- "externals/icu/source/common/lsr.h",
- "externals/icu/source/common/messageimpl.h",
- "externals/icu/source/common/msvcres.h",
- "externals/icu/source/common/mutex.h",
- "externals/icu/source/common/norm2_nfc_data.h",
- "externals/icu/source/common/norm2allmodes.h",
- "externals/icu/source/common/normalizer2impl.h",
- "externals/icu/source/common/patternprops.h",
- "externals/icu/source/common/pluralmap.h",
- "externals/icu/source/common/propname.h",
- "externals/icu/source/common/propname_data.h",
- "externals/icu/source/common/propsvec.h",
- "externals/icu/source/common/punycode.h",
- "externals/icu/source/common/putilimp.h",
- "externals/icu/source/common/rbbi_cache.h",
- "externals/icu/source/common/rbbidata.h",
- "externals/icu/source/common/rbbinode.h",
- "externals/icu/source/common/rbbirb.h",
- "externals/icu/source/common/rbbirpt.h",
- "externals/icu/source/common/rbbiscan.h",
- "externals/icu/source/common/rbbisetb.h",
- "externals/icu/source/common/rbbitblb.h",
- "externals/icu/source/common/resource.h",
- "externals/icu/source/common/restrace.h",
- "externals/icu/source/common/ruleiter.h",
- "externals/icu/source/common/serv.h",
- "externals/icu/source/common/servloc.h",
- "externals/icu/source/common/servnotf.h",
- "externals/icu/source/common/sharedobject.h",
- "externals/icu/source/common/sprpimpl.h",
- "externals/icu/source/common/static_unicode_sets.h",
- "externals/icu/source/common/uarrsort.h",
- "externals/icu/source/common/uassert.h",
- "externals/icu/source/common/ubidi_props.h",
- "externals/icu/source/common/ubidi_props_data.h",
- "externals/icu/source/common/ubidiimp.h",
- "externals/icu/source/common/ubrkimpl.h",
- "externals/icu/source/common/ucase.h",
- "externals/icu/source/common/ucase_props_data.h",
- "externals/icu/source/common/ucasemap_imp.h",
- "externals/icu/source/common/uchar_props_data.h",
- "externals/icu/source/common/ucln.h",
- "externals/icu/source/common/ucln_cmn.h",
- "externals/icu/source/common/ucln_imp.h",
- "externals/icu/source/common/ucmndata.h",
- "externals/icu/source/common/ucnv_bld.h",
- "externals/icu/source/common/ucnv_cnv.h",
- "externals/icu/source/common/ucnv_ext.h",
- "externals/icu/source/common/ucnv_imp.h",
- "externals/icu/source/common/ucnv_io.h",
- "externals/icu/source/common/ucnvmbcs.h",
- "externals/icu/source/common/ucol_data.h",
- "externals/icu/source/common/ucol_swp.h",
- "externals/icu/source/common/ucptrie_impl.h",
- "externals/icu/source/common/ucurrimp.h",
- "externals/icu/source/common/udatamem.h",
- "externals/icu/source/common/udataswp.h",
- "externals/icu/source/common/uelement.h",
- "externals/icu/source/common/uenumimp.h",
- "externals/icu/source/common/uhash.h",
- "externals/icu/source/common/uinvchar.h",
- "externals/icu/source/common/ulayout_props.h",
- "externals/icu/source/common/ulist.h",
- "externals/icu/source/common/ulocimp.h",
- "externals/icu/source/common/umapfile.h",
- "externals/icu/source/common/umutex.h",
- "externals/icu/source/common/unicode/appendable.h",
- "externals/icu/source/common/unicode/brkiter.h",
- "externals/icu/source/common/unicode/bytestream.h",
- "externals/icu/source/common/unicode/bytestrie.h",
- "externals/icu/source/common/unicode/bytestriebuilder.h",
- "externals/icu/source/common/unicode/caniter.h",
- "externals/icu/source/common/unicode/casemap.h",
- "externals/icu/source/common/unicode/char16ptr.h",
- "externals/icu/source/common/unicode/chariter.h",
- "externals/icu/source/common/unicode/dbbi.h",
- "externals/icu/source/common/unicode/docmain.h",
- "externals/icu/source/common/unicode/dtintrv.h",
- "externals/icu/source/common/unicode/edits.h",
- "externals/icu/source/common/unicode/enumset.h",
- "externals/icu/source/common/unicode/errorcode.h",
- "externals/icu/source/common/unicode/filteredbrk.h",
- "externals/icu/source/common/unicode/icudataver.h",
- "externals/icu/source/common/unicode/icuplug.h",
- "externals/icu/source/common/unicode/idna.h",
- "externals/icu/source/common/unicode/localebuilder.h",
- "externals/icu/source/common/unicode/localematcher.h",
- "externals/icu/source/common/unicode/localpointer.h",
- "externals/icu/source/common/unicode/locdspnm.h",
- "externals/icu/source/common/unicode/locid.h",
- "externals/icu/source/common/unicode/messagepattern.h",
- "externals/icu/source/common/unicode/normalizer2.h",
- "externals/icu/source/common/unicode/normlzr.h",
- "externals/icu/source/common/unicode/parseerr.h",
- "externals/icu/source/common/unicode/parsepos.h",
- "externals/icu/source/common/unicode/platform.h",
- "externals/icu/source/common/unicode/ptypes.h",
- "externals/icu/source/common/unicode/putil.h",
- "externals/icu/source/common/unicode/rbbi.h",
- "externals/icu/source/common/unicode/rep.h",
- "externals/icu/source/common/unicode/resbund.h",
- "externals/icu/source/common/unicode/schriter.h",
- "externals/icu/source/common/unicode/simpleformatter.h",
- "externals/icu/source/common/unicode/std_string.h",
- "externals/icu/source/common/unicode/strenum.h",
- "externals/icu/source/common/unicode/stringoptions.h",
- "externals/icu/source/common/unicode/stringpiece.h",
- "externals/icu/source/common/unicode/stringtriebuilder.h",
- "externals/icu/source/common/unicode/symtable.h",
- "externals/icu/source/common/unicode/ubidi.h",
- "externals/icu/source/common/unicode/ubiditransform.h",
- "externals/icu/source/common/unicode/ubrk.h",
- "externals/icu/source/common/unicode/ucasemap.h",
- "externals/icu/source/common/unicode/ucat.h",
- "externals/icu/source/common/unicode/uchar.h",
- "externals/icu/source/common/unicode/ucharstrie.h",
- "externals/icu/source/common/unicode/ucharstriebuilder.h",
- "externals/icu/source/common/unicode/uchriter.h",
- "externals/icu/source/common/unicode/uclean.h",
- "externals/icu/source/common/unicode/ucnv.h",
- "externals/icu/source/common/unicode/ucnv_cb.h",
- "externals/icu/source/common/unicode/ucnv_err.h",
- "externals/icu/source/common/unicode/ucnvsel.h",
- "externals/icu/source/common/unicode/uconfig.h",
- "externals/icu/source/common/unicode/ucpmap.h",
- "externals/icu/source/common/unicode/ucptrie.h",
- "externals/icu/source/common/unicode/ucurr.h",
- "externals/icu/source/common/unicode/udata.h",
- "externals/icu/source/common/unicode/udisplaycontext.h",
- "externals/icu/source/common/unicode/uenum.h",
- "externals/icu/source/common/unicode/uidna.h",
- "externals/icu/source/common/unicode/uiter.h",
- "externals/icu/source/common/unicode/uldnames.h",
- "externals/icu/source/common/unicode/uloc.h",
- "externals/icu/source/common/unicode/umachine.h",
- "externals/icu/source/common/unicode/umisc.h",
- "externals/icu/source/common/unicode/umutablecptrie.h",
- "externals/icu/source/common/unicode/unifilt.h",
- "externals/icu/source/common/unicode/unifunct.h",
- "externals/icu/source/common/unicode/unimatch.h",
- "externals/icu/source/common/unicode/uniset.h",
- "externals/icu/source/common/unicode/unistr.h",
- "externals/icu/source/common/unicode/unorm.h",
- "externals/icu/source/common/unicode/unorm2.h",
- "externals/icu/source/common/unicode/uobject.h",
- "externals/icu/source/common/unicode/urename.h",
- "externals/icu/source/common/unicode/urep.h",
- "externals/icu/source/common/unicode/ures.h",
- "externals/icu/source/common/unicode/uscript.h",
- "externals/icu/source/common/unicode/uset.h",
- "externals/icu/source/common/unicode/usetiter.h",
- "externals/icu/source/common/unicode/ushape.h",
- "externals/icu/source/common/unicode/usprep.h",
- "externals/icu/source/common/unicode/ustring.h",
- "externals/icu/source/common/unicode/ustringtrie.h",
- "externals/icu/source/common/unicode/utext.h",
- "externals/icu/source/common/unicode/utf.h",
- "externals/icu/source/common/unicode/utf16.h",
- "externals/icu/source/common/unicode/utf32.h",
- "externals/icu/source/common/unicode/utf8.h",
- "externals/icu/source/common/unicode/utf_old.h",
- "externals/icu/source/common/unicode/utrace.h",
- "externals/icu/source/common/unicode/utypes.h",
- "externals/icu/source/common/unicode/uvernum.h",
- "externals/icu/source/common/unicode/uversion.h",
- "externals/icu/source/common/unifiedcache.h",
- "externals/icu/source/common/uniquecharstr.h",
- "externals/icu/source/common/unisetspan.h",
- "externals/icu/source/common/unistrappender.h",
- "externals/icu/source/common/unormimp.h",
- "externals/icu/source/common/uposixdefs.h",
- "externals/icu/source/common/uprops.h",
- "externals/icu/source/common/uresdata.h",
- "externals/icu/source/common/uresimp.h",
- "externals/icu/source/common/ureslocs.h",
- "externals/icu/source/common/usc_impl.h",
- "externals/icu/source/common/uset_imp.h",
- "externals/icu/source/common/ustr_cnv.h",
- "externals/icu/source/common/ustr_imp.h",
- "externals/icu/source/common/ustrenum.h",
- "externals/icu/source/common/ustrfmt.h",
- "externals/icu/source/common/util.h",
- "externals/icu/source/common/utracimp.h",
- "externals/icu/source/common/utrie.h",
- "externals/icu/source/common/utrie2.h",
- "externals/icu/source/common/utrie2_impl.h",
- "externals/icu/source/common/utypeinfo.h",
- "externals/icu/source/common/uvector.h",
- "externals/icu/source/common/uvectr32.h",
- "externals/icu/source/common/uvectr64.h",
- "externals/icu/source/common/wintz.h",
- "externals/icu/source/i18n/anytrans.h",
- "externals/icu/source/i18n/astro.h",
- "externals/icu/source/i18n/bocsu.h",
- "externals/icu/source/i18n/brktrans.h",
- "externals/icu/source/i18n/buddhcal.h",
- "externals/icu/source/i18n/casetrn.h",
- "externals/icu/source/i18n/cecal.h",
- "externals/icu/source/i18n/chnsecal.h",
- "externals/icu/source/i18n/collation.h",
- "externals/icu/source/i18n/collationbuilder.h",
- "externals/icu/source/i18n/collationcompare.h",
- "externals/icu/source/i18n/collationdata.h",
- "externals/icu/source/i18n/collationdatabuilder.h",
- "externals/icu/source/i18n/collationdatareader.h",
- "externals/icu/source/i18n/collationdatawriter.h",
- "externals/icu/source/i18n/collationfastlatin.h",
- "externals/icu/source/i18n/collationfastlatinbuilder.h",
- "externals/icu/source/i18n/collationfcd.h",
- "externals/icu/source/i18n/collationiterator.h",
- "externals/icu/source/i18n/collationkeys.h",
- "externals/icu/source/i18n/collationroot.h",
- "externals/icu/source/i18n/collationrootelements.h",
- "externals/icu/source/i18n/collationruleparser.h",
- "externals/icu/source/i18n/collationsets.h",
- "externals/icu/source/i18n/collationsettings.h",
- "externals/icu/source/i18n/collationtailoring.h",
- "externals/icu/source/i18n/collationweights.h",
- "externals/icu/source/i18n/collunsafe.h",
- "externals/icu/source/i18n/coptccal.h",
- "externals/icu/source/i18n/cpdtrans.h",
- "externals/icu/source/i18n/csdetect.h",
- "externals/icu/source/i18n/csmatch.h",
- "externals/icu/source/i18n/csr2022.h",
- "externals/icu/source/i18n/csrecog.h",
- "externals/icu/source/i18n/csrmbcs.h",
- "externals/icu/source/i18n/csrsbcs.h",
- "externals/icu/source/i18n/csrucode.h",
- "externals/icu/source/i18n/csrutf8.h",
- "externals/icu/source/i18n/currfmt.h",
- "externals/icu/source/i18n/dangical.h",
- "externals/icu/source/i18n/dayperiodrules.h",
- "externals/icu/source/i18n/decContext.h",
- "externals/icu/source/i18n/decNumber.h",
- "externals/icu/source/i18n/decNumberLocal.h",
- "externals/icu/source/i18n/double-conversion-bignum-dtoa.h",
- "externals/icu/source/i18n/double-conversion-bignum.h",
- "externals/icu/source/i18n/double-conversion-cached-powers.h",
- "externals/icu/source/i18n/double-conversion-diy-fp.h",
- "externals/icu/source/i18n/double-conversion-double-to-string.h",
- "externals/icu/source/i18n/double-conversion-fast-dtoa.h",
- "externals/icu/source/i18n/double-conversion-ieee.h",
- "externals/icu/source/i18n/double-conversion-string-to-double.h",
- "externals/icu/source/i18n/double-conversion-strtod.h",
- "externals/icu/source/i18n/double-conversion-utils.h",
- "externals/icu/source/i18n/double-conversion.h",
- "externals/icu/source/i18n/dt_impl.h",
- "externals/icu/source/i18n/dtitv_impl.h",
- "externals/icu/source/i18n/dtptngen_impl.h",
- "externals/icu/source/i18n/erarules.h",
- "externals/icu/source/i18n/esctrn.h",
- "externals/icu/source/i18n/ethpccal.h",
- "externals/icu/source/i18n/fmtableimp.h",
- "externals/icu/source/i18n/formatted_string_builder.h",
- "externals/icu/source/i18n/formattedval_impl.h",
- "externals/icu/source/i18n/fphdlimp.h",
- "externals/icu/source/i18n/funcrepl.h",
- "externals/icu/source/i18n/gregoimp.h",
- "externals/icu/source/i18n/hebrwcal.h",
- "externals/icu/source/i18n/indiancal.h",
- "externals/icu/source/i18n/inputext.h",
- "externals/icu/source/i18n/islamcal.h",
- "externals/icu/source/i18n/japancal.h",
- "externals/icu/source/i18n/measunit_impl.h",
- "externals/icu/source/i18n/msgfmt_impl.h",
- "externals/icu/source/i18n/name2uni.h",
- "externals/icu/source/i18n/nfrlist.h",
- "externals/icu/source/i18n/nfrs.h",
- "externals/icu/source/i18n/nfrule.h",
- "externals/icu/source/i18n/nfsubs.h",
- "externals/icu/source/i18n/nortrans.h",
- "externals/icu/source/i18n/nultrans.h",
- "externals/icu/source/i18n/number_affixutils.h",
- "externals/icu/source/i18n/number_asformat.h",
- "externals/icu/source/i18n/number_compact.h",
- "externals/icu/source/i18n/number_currencysymbols.h",
- "externals/icu/source/i18n/number_decimalquantity.h",
- "externals/icu/source/i18n/number_decimfmtprops.h",
- "externals/icu/source/i18n/number_decnum.h",
- "externals/icu/source/i18n/number_formatimpl.h",
- "externals/icu/source/i18n/number_longnames.h",
- "externals/icu/source/i18n/number_mapper.h",
- "externals/icu/source/i18n/number_microprops.h",
- "externals/icu/source/i18n/number_modifiers.h",
- "externals/icu/source/i18n/number_multiplier.h",
- "externals/icu/source/i18n/number_patternmodifier.h",
- "externals/icu/source/i18n/number_patternstring.h",
- "externals/icu/source/i18n/number_roundingutils.h",
- "externals/icu/source/i18n/number_scientific.h",
- "externals/icu/source/i18n/number_skeletons.h",
- "externals/icu/source/i18n/number_types.h",
- "externals/icu/source/i18n/number_usageprefs.h",
- "externals/icu/source/i18n/number_utils.h",
- "externals/icu/source/i18n/number_utypes.h",
- "externals/icu/source/i18n/numparse_affixes.h",
- "externals/icu/source/i18n/numparse_compositions.h",
- "externals/icu/source/i18n/numparse_currency.h",
- "externals/icu/source/i18n/numparse_decimal.h",
- "externals/icu/source/i18n/numparse_impl.h",
- "externals/icu/source/i18n/numparse_scientific.h",
- "externals/icu/source/i18n/numparse_symbols.h",
- "externals/icu/source/i18n/numparse_types.h",
- "externals/icu/source/i18n/numparse_utils.h",
- "externals/icu/source/i18n/numparse_validators.h",
- "externals/icu/source/i18n/numrange_impl.h",
- "externals/icu/source/i18n/numsys_impl.h",
- "externals/icu/source/i18n/olsontz.h",
- "externals/icu/source/i18n/persncal.h",
- "externals/icu/source/i18n/pluralranges.h",
- "externals/icu/source/i18n/plurrule_impl.h",
- "externals/icu/source/i18n/quant.h",
- "externals/icu/source/i18n/quantityformatter.h",
- "externals/icu/source/i18n/rbt.h",
- "externals/icu/source/i18n/rbt_data.h",
- "externals/icu/source/i18n/rbt_pars.h",
- "externals/icu/source/i18n/rbt_rule.h",
- "externals/icu/source/i18n/rbt_set.h",
- "externals/icu/source/i18n/regexcmp.h",
- "externals/icu/source/i18n/regexcst.h",
- "externals/icu/source/i18n/regeximp.h",
- "externals/icu/source/i18n/regexst.h",
- "externals/icu/source/i18n/regextxt.h",
- "externals/icu/source/i18n/region_impl.h",
- "externals/icu/source/i18n/reldtfmt.h",
- "externals/icu/source/i18n/remtrans.h",
- "externals/icu/source/i18n/scriptset.h",
- "externals/icu/source/i18n/selfmtimpl.h",
- "externals/icu/source/i18n/sharedbreakiterator.h",
- "externals/icu/source/i18n/sharedcalendar.h",
- "externals/icu/source/i18n/shareddateformatsymbols.h",
- "externals/icu/source/i18n/sharednumberformat.h",
- "externals/icu/source/i18n/sharedpluralrules.h",
- "externals/icu/source/i18n/smpdtfst.h",
- "externals/icu/source/i18n/standardplural.h",
- "externals/icu/source/i18n/string_segment.h",
- "externals/icu/source/i18n/strmatch.h",
- "externals/icu/source/i18n/strrepl.h",
- "externals/icu/source/i18n/taiwncal.h",
- "externals/icu/source/i18n/titletrn.h",
- "externals/icu/source/i18n/tolowtrn.h",
- "externals/icu/source/i18n/toupptrn.h",
- "externals/icu/source/i18n/transreg.h",
- "externals/icu/source/i18n/tridpars.h",
- "externals/icu/source/i18n/tzgnames.h",
- "externals/icu/source/i18n/tznames_impl.h",
- "externals/icu/source/i18n/ucln_in.h",
- "externals/icu/source/i18n/ucol_imp.h",
- "externals/icu/source/i18n/uitercollationiterator.h",
- "externals/icu/source/i18n/umsg_imp.h",
- "externals/icu/source/i18n/unesctrn.h",
- "externals/icu/source/i18n/uni2name.h",
- "externals/icu/source/i18n/unicode/alphaindex.h",
- "externals/icu/source/i18n/unicode/basictz.h",
- "externals/icu/source/i18n/unicode/calendar.h",
- "externals/icu/source/i18n/unicode/choicfmt.h",
- "externals/icu/source/i18n/unicode/coleitr.h",
- "externals/icu/source/i18n/unicode/coll.h",
- "externals/icu/source/i18n/unicode/compactdecimalformat.h",
- "externals/icu/source/i18n/unicode/curramt.h",
- "externals/icu/source/i18n/unicode/currpinf.h",
- "externals/icu/source/i18n/unicode/currunit.h",
- "externals/icu/source/i18n/unicode/datefmt.h",
- "externals/icu/source/i18n/unicode/dcfmtsym.h",
- "externals/icu/source/i18n/unicode/decimfmt.h",
- "externals/icu/source/i18n/unicode/dtfmtsym.h",
- "externals/icu/source/i18n/unicode/dtitvfmt.h",
- "externals/icu/source/i18n/unicode/dtitvinf.h",
- "externals/icu/source/i18n/unicode/dtptngen.h",
- "externals/icu/source/i18n/unicode/dtrule.h",
- "externals/icu/source/i18n/unicode/fieldpos.h",
- "externals/icu/source/i18n/unicode/fmtable.h",
- "externals/icu/source/i18n/unicode/format.h",
- "externals/icu/source/i18n/unicode/formattedvalue.h",
- "externals/icu/source/i18n/unicode/fpositer.h",
- "externals/icu/source/i18n/unicode/gender.h",
- "externals/icu/source/i18n/unicode/gregocal.h",
- "externals/icu/source/i18n/unicode/listformatter.h",
- "externals/icu/source/i18n/unicode/measfmt.h",
- "externals/icu/source/i18n/unicode/measunit.h",
- "externals/icu/source/i18n/unicode/measure.h",
- "externals/icu/source/i18n/unicode/msgfmt.h",
- "externals/icu/source/i18n/unicode/nounit.h",
- "externals/icu/source/i18n/unicode/numberformatter.h",
- "externals/icu/source/i18n/unicode/numberrangeformatter.h",
- "externals/icu/source/i18n/unicode/numfmt.h",
- "externals/icu/source/i18n/unicode/numsys.h",
- "externals/icu/source/i18n/unicode/plurfmt.h",
- "externals/icu/source/i18n/unicode/plurrule.h",
- "externals/icu/source/i18n/unicode/rbnf.h",
- "externals/icu/source/i18n/unicode/rbtz.h",
- "externals/icu/source/i18n/unicode/regex.h",
- "externals/icu/source/i18n/unicode/region.h",
- "externals/icu/source/i18n/unicode/reldatefmt.h",
- "externals/icu/source/i18n/unicode/scientificnumberformatter.h",
- "externals/icu/source/i18n/unicode/search.h",
- "externals/icu/source/i18n/unicode/selfmt.h",
- "externals/icu/source/i18n/unicode/simpletz.h",
- "externals/icu/source/i18n/unicode/smpdtfmt.h",
- "externals/icu/source/i18n/unicode/sortkey.h",
- "externals/icu/source/i18n/unicode/stsearch.h",
- "externals/icu/source/i18n/unicode/tblcoll.h",
- "externals/icu/source/i18n/unicode/timezone.h",
- "externals/icu/source/i18n/unicode/tmunit.h",
- "externals/icu/source/i18n/unicode/tmutamt.h",
- "externals/icu/source/i18n/unicode/tmutfmt.h",
- "externals/icu/source/i18n/unicode/translit.h",
- "externals/icu/source/i18n/unicode/tzfmt.h",
- "externals/icu/source/i18n/unicode/tznames.h",
- "externals/icu/source/i18n/unicode/tzrule.h",
- "externals/icu/source/i18n/unicode/tztrans.h",
- "externals/icu/source/i18n/unicode/ucal.h",
- "externals/icu/source/i18n/unicode/ucol.h",
- "externals/icu/source/i18n/unicode/ucoleitr.h",
- "externals/icu/source/i18n/unicode/ucsdet.h",
- "externals/icu/source/i18n/unicode/udat.h",
- "externals/icu/source/i18n/unicode/udateintervalformat.h",
- "externals/icu/source/i18n/unicode/udatpg.h",
- "externals/icu/source/i18n/unicode/ufieldpositer.h",
- "externals/icu/source/i18n/unicode/uformattable.h",
- "externals/icu/source/i18n/unicode/uformattedvalue.h",
- "externals/icu/source/i18n/unicode/ugender.h",
- "externals/icu/source/i18n/unicode/ulistformatter.h",
- "externals/icu/source/i18n/unicode/ulocdata.h",
- "externals/icu/source/i18n/unicode/umsg.h",
- "externals/icu/source/i18n/unicode/unirepl.h",
- "externals/icu/source/i18n/unicode/unum.h",
- "externals/icu/source/i18n/unicode/unumberformatter.h",
- "externals/icu/source/i18n/unicode/unumberrangeformatter.h",
- "externals/icu/source/i18n/unicode/unumsys.h",
- "externals/icu/source/i18n/unicode/upluralrules.h",
- "externals/icu/source/i18n/unicode/uregex.h",
- "externals/icu/source/i18n/unicode/uregion.h",
- "externals/icu/source/i18n/unicode/ureldatefmt.h",
- "externals/icu/source/i18n/unicode/usearch.h",
- "externals/icu/source/i18n/unicode/uspoof.h",
- "externals/icu/source/i18n/unicode/utmscale.h",
- "externals/icu/source/i18n/unicode/utrans.h",
- "externals/icu/source/i18n/unicode/vtzone.h",
- "externals/icu/source/i18n/units_complexconverter.h",
- "externals/icu/source/i18n/units_converter.h",
- "externals/icu/source/i18n/units_data.h",
- "externals/icu/source/i18n/units_router.h",
- "externals/icu/source/i18n/uspoof_conf.h",
- "externals/icu/source/i18n/uspoof_impl.h",
- "externals/icu/source/i18n/usrchimp.h",
- "externals/icu/source/i18n/utf16collationiterator.h",
- "externals/icu/source/i18n/utf8collationiterator.h",
- "externals/icu/source/i18n/vzone.h",
- "externals/icu/source/i18n/windtfmt.h",
- "externals/icu/source/i18n/winnmfmt.h",
- "externals/icu/source/i18n/wintzimpl.h",
- "externals/icu/source/i18n/zonemeta.h",
- "externals/icu/source/i18n/zrule.h",
- "externals/icu/source/i18n/ztrans.h",
- "icu/SkLoadICU.h",
-]
-
-ICU_SRCS = [
- "externals/icu/source/common/bmpset.cpp",
- "externals/icu/source/common/brkeng.cpp",
- "externals/icu/source/common/brkiter.cpp",
- "externals/icu/source/common/bytesinkutil.cpp",
- "externals/icu/source/common/bytestream.cpp",
- "externals/icu/source/common/bytestrie.cpp",
- "externals/icu/source/common/bytestriebuilder.cpp",
- "externals/icu/source/common/bytestrieiterator.cpp",
- "externals/icu/source/common/caniter.cpp",
- "externals/icu/source/common/characterproperties.cpp",
- "externals/icu/source/common/chariter.cpp",
- "externals/icu/source/common/charstr.cpp",
- "externals/icu/source/common/cmemory.cpp",
- "externals/icu/source/common/cstr.cpp",
- "externals/icu/source/common/cstring.cpp",
- "externals/icu/source/common/cwchar.cpp",
- "externals/icu/source/common/dictbe.cpp",
- "externals/icu/source/common/dictionarydata.cpp",
- "externals/icu/source/common/dtintrv.cpp",
- "externals/icu/source/common/edits.cpp",
- "externals/icu/source/common/errorcode.cpp",
- "externals/icu/source/common/filteredbrk.cpp",
- "externals/icu/source/common/filterednormalizer2.cpp",
- "externals/icu/source/common/icudataver.cpp",
- "externals/icu/source/common/icuplug.cpp",
- "externals/icu/source/common/loadednormalizer2impl.cpp",
- "externals/icu/source/common/localebuilder.cpp",
- "externals/icu/source/common/locavailable.cpp",
- "externals/icu/source/common/locbased.cpp",
- "externals/icu/source/common/locdispnames.cpp",
- "externals/icu/source/common/locdspnm.cpp",
- "externals/icu/source/common/locid.cpp",
- "externals/icu/source/common/loclikely.cpp",
- "externals/icu/source/common/locmap.cpp",
- "externals/icu/source/common/locresdata.cpp",
- "externals/icu/source/common/locutil.cpp",
- "externals/icu/source/common/messagepattern.cpp",
- "externals/icu/source/common/normalizer2.cpp",
- "externals/icu/source/common/normalizer2impl.cpp",
- "externals/icu/source/common/normlzr.cpp",
- "externals/icu/source/common/parsepos.cpp",
- "externals/icu/source/common/patternprops.cpp",
- "externals/icu/source/common/pluralmap.cpp",
- "externals/icu/source/common/propname.cpp",
- "externals/icu/source/common/propsvec.cpp",
- "externals/icu/source/common/punycode.cpp",
- "externals/icu/source/common/putil.cpp",
- "externals/icu/source/common/rbbi.cpp",
- "externals/icu/source/common/rbbi_cache.cpp",
- "externals/icu/source/common/rbbidata.cpp",
- "externals/icu/source/common/rbbinode.cpp",
- "externals/icu/source/common/rbbirb.cpp",
- "externals/icu/source/common/rbbiscan.cpp",
- "externals/icu/source/common/rbbisetb.cpp",
- "externals/icu/source/common/rbbistbl.cpp",
- "externals/icu/source/common/rbbitblb.cpp",
- "externals/icu/source/common/resbund.cpp",
- "externals/icu/source/common/resbund_cnv.cpp",
- "externals/icu/source/common/resource.cpp",
- "externals/icu/source/common/ruleiter.cpp",
- "externals/icu/source/common/schriter.cpp",
- "externals/icu/source/common/serv.cpp",
- "externals/icu/source/common/servlk.cpp",
- "externals/icu/source/common/servlkf.cpp",
- "externals/icu/source/common/servls.cpp",
- "externals/icu/source/common/servnotf.cpp",
- "externals/icu/source/common/servrbf.cpp",
- "externals/icu/source/common/servslkf.cpp",
- "externals/icu/source/common/sharedobject.cpp",
- "externals/icu/source/common/simpleformatter.cpp",
- "externals/icu/source/common/static_unicode_sets.cpp",
- "externals/icu/source/common/stringpiece.cpp",
- "externals/icu/source/common/stringtriebuilder.cpp",
- "externals/icu/source/common/uarrsort.cpp",
- "externals/icu/source/common/ubidi.cpp",
- "externals/icu/source/common/ubidi_props.cpp",
- "externals/icu/source/common/ubidiln.cpp",
- "externals/icu/source/common/ubiditransform.cpp",
- "externals/icu/source/common/ubidiwrt.cpp",
- "externals/icu/source/common/ubrk.cpp",
- "externals/icu/source/common/ucase.cpp",
- "externals/icu/source/common/ucasemap.cpp",
- "externals/icu/source/common/ucasemap_titlecase_brkiter.cpp",
- "externals/icu/source/common/ucat.cpp",
- "externals/icu/source/common/uchar.cpp",
- "externals/icu/source/common/ucharstrie.cpp",
- "externals/icu/source/common/ucharstriebuilder.cpp",
- "externals/icu/source/common/ucharstrieiterator.cpp",
- "externals/icu/source/common/uchriter.cpp",
- "externals/icu/source/common/ucln_cmn.cpp",
- "externals/icu/source/common/ucmndata.cpp",
- "externals/icu/source/common/ucnv.cpp",
- "externals/icu/source/common/ucnv2022.cpp",
- "externals/icu/source/common/ucnv_bld.cpp",
- "externals/icu/source/common/ucnv_cb.cpp",
- "externals/icu/source/common/ucnv_cnv.cpp",
- "externals/icu/source/common/ucnv_ct.cpp",
- "externals/icu/source/common/ucnv_err.cpp",
- "externals/icu/source/common/ucnv_ext.cpp",
- "externals/icu/source/common/ucnv_io.cpp",
- "externals/icu/source/common/ucnv_lmb.cpp",
- "externals/icu/source/common/ucnv_set.cpp",
- "externals/icu/source/common/ucnv_u16.cpp",
- "externals/icu/source/common/ucnv_u32.cpp",
- "externals/icu/source/common/ucnv_u7.cpp",
- "externals/icu/source/common/ucnv_u8.cpp",
- "externals/icu/source/common/ucnvbocu.cpp",
- "externals/icu/source/common/ucnvdisp.cpp",
- "externals/icu/source/common/ucnvhz.cpp",
- "externals/icu/source/common/ucnvisci.cpp",
- "externals/icu/source/common/ucnvlat1.cpp",
- "externals/icu/source/common/ucnvmbcs.cpp",
- "externals/icu/source/common/ucnvscsu.cpp",
- "externals/icu/source/common/ucnvsel.cpp",
- "externals/icu/source/common/ucol_swp.cpp",
- "externals/icu/source/common/ucptrie.cpp",
- "externals/icu/source/common/ucurr.cpp",
- "externals/icu/source/common/udata.cpp",
- "externals/icu/source/common/udatamem.cpp",
- "externals/icu/source/common/udataswp.cpp",
- "externals/icu/source/common/uenum.cpp",
- "externals/icu/source/common/uhash.cpp",
- "externals/icu/source/common/uhash_us.cpp",
- "externals/icu/source/common/uidna.cpp",
- "externals/icu/source/common/uinit.cpp",
- "externals/icu/source/common/uinvchar.cpp",
- "externals/icu/source/common/uiter.cpp",
- "externals/icu/source/common/ulist.cpp",
- "externals/icu/source/common/uloc.cpp",
- "externals/icu/source/common/uloc_keytype.cpp",
- "externals/icu/source/common/uloc_tag.cpp",
- "externals/icu/source/common/umapfile.cpp",
- "externals/icu/source/common/umath.cpp",
- "externals/icu/source/common/umutablecptrie.cpp",
- "externals/icu/source/common/umutex.cpp",
- "externals/icu/source/common/unames.cpp",
- "externals/icu/source/common/unifiedcache.cpp",
- "externals/icu/source/common/unifilt.cpp",
- "externals/icu/source/common/unifunct.cpp",
- "externals/icu/source/common/uniset.cpp",
- "externals/icu/source/common/uniset_closure.cpp",
- "externals/icu/source/common/uniset_props.cpp",
- "externals/icu/source/common/unisetspan.cpp",
- "externals/icu/source/common/unistr.cpp",
- "externals/icu/source/common/unistr_case.cpp",
- "externals/icu/source/common/unistr_case_locale.cpp",
- "externals/icu/source/common/unistr_cnv.cpp",
- "externals/icu/source/common/unistr_props.cpp",
- "externals/icu/source/common/unistr_titlecase_brkiter.cpp",
- "externals/icu/source/common/unorm.cpp",
- "externals/icu/source/common/unormcmp.cpp",
- "externals/icu/source/common/uobject.cpp",
- "externals/icu/source/common/uprops.cpp",
- "externals/icu/source/common/ures_cnv.cpp",
- "externals/icu/source/common/uresbund.cpp",
- "externals/icu/source/common/uresdata.cpp",
- "externals/icu/source/common/usc_impl.cpp",
- "externals/icu/source/common/uscript.cpp",
- "externals/icu/source/common/uscript_props.cpp",
- "externals/icu/source/common/uset.cpp",
- "externals/icu/source/common/uset_props.cpp",
- "externals/icu/source/common/usetiter.cpp",
- "externals/icu/source/common/ushape.cpp",
- "externals/icu/source/common/usprep.cpp",
- "externals/icu/source/common/ustack.cpp",
- "externals/icu/source/common/ustr_cnv.cpp",
- "externals/icu/source/common/ustr_titlecase_brkiter.cpp",
- "externals/icu/source/common/ustr_wcs.cpp",
- "externals/icu/source/common/ustrcase.cpp",
- "externals/icu/source/common/ustrcase_locale.cpp",
- "externals/icu/source/common/ustrenum.cpp",
- "externals/icu/source/common/ustrfmt.cpp",
- "externals/icu/source/common/ustring.cpp",
- "externals/icu/source/common/ustrtrns.cpp",
- "externals/icu/source/common/utext.cpp",
- "externals/icu/source/common/utf_impl.cpp",
- "externals/icu/source/common/util.cpp",
- "externals/icu/source/common/util_props.cpp",
- "externals/icu/source/common/utrace.cpp",
- "externals/icu/source/common/utrie.cpp",
- "externals/icu/source/common/utrie2.cpp",
- "externals/icu/source/common/utrie2_builder.cpp",
- "externals/icu/source/common/utrie_swap.cpp",
- "externals/icu/source/common/uts46.cpp",
- "externals/icu/source/common/utypes.cpp",
- "externals/icu/source/common/uvector.cpp",
- "externals/icu/source/common/uvectr32.cpp",
- "externals/icu/source/common/uvectr64.cpp",
- "externals/icu/source/common/wintz.cpp",
- "externals/icu/source/i18n/alphaindex.cpp",
- "externals/icu/source/i18n/anytrans.cpp",
- "externals/icu/source/i18n/astro.cpp",
- "externals/icu/source/i18n/basictz.cpp",
- "externals/icu/source/i18n/bocsu.cpp",
- "externals/icu/source/i18n/brktrans.cpp",
- "externals/icu/source/i18n/buddhcal.cpp",
- "externals/icu/source/i18n/calendar.cpp",
- "externals/icu/source/i18n/casetrn.cpp",
- "externals/icu/source/i18n/cecal.cpp",
- "externals/icu/source/i18n/chnsecal.cpp",
- "externals/icu/source/i18n/choicfmt.cpp",
- "externals/icu/source/i18n/coleitr.cpp",
- "externals/icu/source/i18n/coll.cpp",
- "externals/icu/source/i18n/collation.cpp",
- "externals/icu/source/i18n/collationbuilder.cpp",
- "externals/icu/source/i18n/collationcompare.cpp",
- "externals/icu/source/i18n/collationdata.cpp",
- "externals/icu/source/i18n/collationdatabuilder.cpp",
- "externals/icu/source/i18n/collationdatareader.cpp",
- "externals/icu/source/i18n/collationdatawriter.cpp",
- "externals/icu/source/i18n/collationfastlatin.cpp",
- "externals/icu/source/i18n/collationfastlatinbuilder.cpp",
- "externals/icu/source/i18n/collationfcd.cpp",
- "externals/icu/source/i18n/collationiterator.cpp",
- "externals/icu/source/i18n/collationkeys.cpp",
- "externals/icu/source/i18n/collationroot.cpp",
- "externals/icu/source/i18n/collationrootelements.cpp",
- "externals/icu/source/i18n/collationruleparser.cpp",
- "externals/icu/source/i18n/collationsets.cpp",
- "externals/icu/source/i18n/collationsettings.cpp",
- "externals/icu/source/i18n/collationtailoring.cpp",
- "externals/icu/source/i18n/collationweights.cpp",
- "externals/icu/source/i18n/compactdecimalformat.cpp",
- "externals/icu/source/i18n/coptccal.cpp",
- "externals/icu/source/i18n/cpdtrans.cpp",
- "externals/icu/source/i18n/csdetect.cpp",
- "externals/icu/source/i18n/csmatch.cpp",
- "externals/icu/source/i18n/csr2022.cpp",
- "externals/icu/source/i18n/csrecog.cpp",
- "externals/icu/source/i18n/csrmbcs.cpp",
- "externals/icu/source/i18n/csrsbcs.cpp",
- "externals/icu/source/i18n/csrucode.cpp",
- "externals/icu/source/i18n/csrutf8.cpp",
- "externals/icu/source/i18n/curramt.cpp",
- "externals/icu/source/i18n/currfmt.cpp",
- "externals/icu/source/i18n/currpinf.cpp",
- "externals/icu/source/i18n/currunit.cpp",
- "externals/icu/source/i18n/dangical.cpp",
- "externals/icu/source/i18n/datefmt.cpp",
- "externals/icu/source/i18n/dayperiodrules.cpp",
- "externals/icu/source/i18n/dcfmtsym.cpp",
- "externals/icu/source/i18n/decContext.cpp",
- "externals/icu/source/i18n/decimfmt.cpp",
- "externals/icu/source/i18n/decNumber.cpp",
- "externals/icu/source/i18n/double-conversion-bignum-dtoa.cpp",
- "externals/icu/source/i18n/double-conversion-bignum.cpp",
- "externals/icu/source/i18n/double-conversion-cached-powers.cpp",
- "externals/icu/source/i18n/double-conversion-fast-dtoa.cpp",
- "externals/icu/source/i18n/double-conversion-strtod.cpp",
- "externals/icu/source/i18n/dtfmtsym.cpp",
- "externals/icu/source/i18n/dtitvfmt.cpp",
- "externals/icu/source/i18n/dtitvinf.cpp",
- "externals/icu/source/i18n/dtptngen.cpp",
- "externals/icu/source/i18n/dtrule.cpp",
- "externals/icu/source/i18n/erarules.cpp",
- "externals/icu/source/i18n/esctrn.cpp",
- "externals/icu/source/i18n/ethpccal.cpp",
- "externals/icu/source/i18n/fmtable.cpp",
- "externals/icu/source/i18n/fmtable_cnv.cpp",
- "externals/icu/source/i18n/format.cpp",
- "externals/icu/source/i18n/fphdlimp.cpp",
- "externals/icu/source/i18n/fpositer.cpp",
- "externals/icu/source/i18n/funcrepl.cpp",
- "externals/icu/source/i18n/gender.cpp",
- "externals/icu/source/i18n/gregocal.cpp",
- "externals/icu/source/i18n/gregoimp.cpp",
- "externals/icu/source/i18n/hebrwcal.cpp",
- "externals/icu/source/i18n/indiancal.cpp",
- "externals/icu/source/i18n/inputext.cpp",
- "externals/icu/source/i18n/islamcal.cpp",
- "externals/icu/source/i18n/japancal.cpp",
- "externals/icu/source/i18n/listformatter.cpp",
- "externals/icu/source/i18n/measfmt.cpp",
- "externals/icu/source/i18n/measunit.cpp",
- "externals/icu/source/i18n/measure.cpp",
- "externals/icu/source/i18n/msgfmt.cpp",
- "externals/icu/source/i18n/name2uni.cpp",
- "externals/icu/source/i18n/nfrs.cpp",
- "externals/icu/source/i18n/nfrule.cpp",
- "externals/icu/source/i18n/nfsubs.cpp",
- "externals/icu/source/i18n/nortrans.cpp",
- "externals/icu/source/i18n/nultrans.cpp",
- "externals/icu/source/i18n/number_affixutils.cpp",
- "externals/icu/source/i18n/number_asformat.cpp",
- "externals/icu/source/i18n/number_capi.cpp",
- "externals/icu/source/i18n/number_compact.cpp",
- "externals/icu/source/i18n/number_currencysymbols.cpp",
- "externals/icu/source/i18n/number_decimalquantity.cpp",
- "externals/icu/source/i18n/number_decimfmtprops.cpp",
- "externals/icu/source/i18n/number_fluent.cpp",
- "externals/icu/source/i18n/number_formatimpl.cpp",
- "externals/icu/source/i18n/number_grouping.cpp",
- "externals/icu/source/i18n/number_integerwidth.cpp",
- "externals/icu/source/i18n/number_longnames.cpp",
- "externals/icu/source/i18n/number_mapper.cpp",
- "externals/icu/source/i18n/number_modifiers.cpp",
- "externals/icu/source/i18n/number_multiplier.cpp",
- "externals/icu/source/i18n/number_notation.cpp",
- "externals/icu/source/i18n/number_padding.cpp",
- "externals/icu/source/i18n/number_patternmodifier.cpp",
- "externals/icu/source/i18n/number_patternstring.cpp",
- "externals/icu/source/i18n/number_rounding.cpp",
- "externals/icu/source/i18n/number_scientific.cpp",
- "externals/icu/source/i18n/number_skeletons.cpp",
- "externals/icu/source/i18n/number_utils.cpp",
- "externals/icu/source/i18n/numfmt.cpp",
- "externals/icu/source/i18n/numparse_affixes.cpp",
- "externals/icu/source/i18n/numparse_compositions.cpp",
- "externals/icu/source/i18n/numparse_currency.cpp",
- "externals/icu/source/i18n/numparse_decimal.cpp",
- "externals/icu/source/i18n/numparse_impl.cpp",
- "externals/icu/source/i18n/numparse_parsednumber.cpp",
- "externals/icu/source/i18n/numparse_scientific.cpp",
- "externals/icu/source/i18n/numparse_symbols.cpp",
- "externals/icu/source/i18n/numparse_validators.cpp",
- "externals/icu/source/i18n/numrange_fluent.cpp",
- "externals/icu/source/i18n/numrange_impl.cpp",
- "externals/icu/source/i18n/numsys.cpp",
- "externals/icu/source/i18n/olsontz.cpp",
- "externals/icu/source/i18n/persncal.cpp",
- "externals/icu/source/i18n/plurfmt.cpp",
- "externals/icu/source/i18n/plurrule.cpp",
- "externals/icu/source/i18n/quant.cpp",
- "externals/icu/source/i18n/quantityformatter.cpp",
- "externals/icu/source/i18n/rbnf.cpp",
- "externals/icu/source/i18n/rbt.cpp",
- "externals/icu/source/i18n/rbt_data.cpp",
- "externals/icu/source/i18n/rbt_pars.cpp",
- "externals/icu/source/i18n/rbt_rule.cpp",
- "externals/icu/source/i18n/rbt_set.cpp",
- "externals/icu/source/i18n/rbtz.cpp",
- "externals/icu/source/i18n/regexcmp.cpp",
- "externals/icu/source/i18n/regeximp.cpp",
- "externals/icu/source/i18n/regexst.cpp",
- "externals/icu/source/i18n/regextxt.cpp",
- "externals/icu/source/i18n/region.cpp",
- "externals/icu/source/i18n/reldatefmt.cpp",
- "externals/icu/source/i18n/reldtfmt.cpp",
- "externals/icu/source/i18n/rematch.cpp",
- "externals/icu/source/i18n/remtrans.cpp",
- "externals/icu/source/i18n/repattrn.cpp",
- "externals/icu/source/i18n/rulebasedcollator.cpp",
- "externals/icu/source/i18n/scientificnumberformatter.cpp",
- "externals/icu/source/i18n/scriptset.cpp",
- "externals/icu/source/i18n/search.cpp",
- "externals/icu/source/i18n/selfmt.cpp",
- "externals/icu/source/i18n/sharedbreakiterator.cpp",
- "externals/icu/source/i18n/simpletz.cpp",
- "externals/icu/source/i18n/smpdtfmt.cpp",
- "externals/icu/source/i18n/smpdtfst.cpp",
- "externals/icu/source/i18n/sortkey.cpp",
- "externals/icu/source/i18n/standardplural.cpp",
- "externals/icu/source/i18n/strmatch.cpp",
- "externals/icu/source/i18n/strrepl.cpp",
- "externals/icu/source/i18n/stsearch.cpp",
- "externals/icu/source/i18n/taiwncal.cpp",
- "externals/icu/source/i18n/timezone.cpp",
- "externals/icu/source/i18n/titletrn.cpp",
- "externals/icu/source/i18n/tmunit.cpp",
- "externals/icu/source/i18n/tmutamt.cpp",
- "externals/icu/source/i18n/tmutfmt.cpp",
- "externals/icu/source/i18n/tolowtrn.cpp",
- "externals/icu/source/i18n/toupptrn.cpp",
- "externals/icu/source/i18n/translit.cpp",
- "externals/icu/source/i18n/transreg.cpp",
- "externals/icu/source/i18n/tridpars.cpp",
- "externals/icu/source/i18n/tzfmt.cpp",
- "externals/icu/source/i18n/tzgnames.cpp",
- "externals/icu/source/i18n/tznames.cpp",
- "externals/icu/source/i18n/tznames_impl.cpp",
- "externals/icu/source/i18n/tzrule.cpp",
- "externals/icu/source/i18n/tztrans.cpp",
- "externals/icu/source/i18n/ucal.cpp",
- "externals/icu/source/i18n/ucln_in.cpp",
- "externals/icu/source/i18n/ucol.cpp",
- "externals/icu/source/i18n/ucol_res.cpp",
- "externals/icu/source/i18n/ucol_sit.cpp",
- "externals/icu/source/i18n/ucoleitr.cpp",
- "externals/icu/source/i18n/ucsdet.cpp",
- "externals/icu/source/i18n/udat.cpp",
- "externals/icu/source/i18n/udateintervalformat.cpp",
- "externals/icu/source/i18n/udatpg.cpp",
- "externals/icu/source/i18n/ufieldpositer.cpp",
- "externals/icu/source/i18n/uitercollationiterator.cpp",
- "externals/icu/source/i18n/ulistformatter.cpp",
- "externals/icu/source/i18n/ulocdata.cpp",
- "externals/icu/source/i18n/umsg.cpp",
- "externals/icu/source/i18n/unesctrn.cpp",
- "externals/icu/source/i18n/uni2name.cpp",
- "externals/icu/source/i18n/unum.cpp",
- "externals/icu/source/i18n/unumsys.cpp",
- "externals/icu/source/i18n/upluralrules.cpp",
- "externals/icu/source/i18n/uregex.cpp",
- "externals/icu/source/i18n/uregexc.cpp",
- "externals/icu/source/i18n/uregion.cpp",
- "externals/icu/source/i18n/usearch.cpp",
- "externals/icu/source/i18n/uspoof.cpp",
- "externals/icu/source/i18n/uspoof_build.cpp",
- "externals/icu/source/i18n/uspoof_conf.cpp",
- "externals/icu/source/i18n/uspoof_impl.cpp",
- "externals/icu/source/i18n/utf16collationiterator.cpp",
- "externals/icu/source/i18n/utf8collationiterator.cpp",
- "externals/icu/source/i18n/utmscale.cpp",
- "externals/icu/source/i18n/utrans.cpp",
- "externals/icu/source/i18n/vtzone.cpp",
- "externals/icu/source/i18n/vzone.cpp",
- "externals/icu/source/i18n/windtfmt.cpp",
- "externals/icu/source/i18n/winnmfmt.cpp",
- "externals/icu/source/i18n/wintzimpl.cpp",
- "externals/icu/source/i18n/zonemeta.cpp",
- "externals/icu/source/i18n/zrule.cpp",
- "externals/icu/source/i18n/ztrans.cpp",
- "externals/icu/source/common/appendable.cpp",
-] + select({
- "@platforms//os:windows": [
- "externals/icu/source/stubdata/stubdata.cpp",
- "icu/SkLoadICU.cpp",
- ],
- "//bazel/common_config_settings:cpu_wasm": ["generated_icu_wasm_dat.cpp"],
- "@platforms//os:android": ["generated_icu_android_dat.S"],
- "@platforms//os:ios": ["generated_icu_ios_dat.S"],
- "//conditions:default": ["generated_icu_common_dat.S"],
-})
-
-cc_library(
- name = "icu",
- srcs = ICU_SRCS,
- hdrs = ICU_HDRS,
- copts = [
- "-Wno-deprecated-declarations",
- "-Wno-unused-but-set-variable",
- "-Wno-unused-function",
- ],
- defines = [
- "U_USING_ICU_NAMESPACE=0",
- "U_DISABLE_RENAMING",
- "SK_USING_THIRD_PARTY_ICU",
- ],
- includes = [
- "externals/icu/source/common",
- "externals/icu/source/i18n",
- "icu",
- ],
- local_defines = [
- # http://userguide.icu-project.org/howtouseicu
- "U_COMMON_IMPLEMENTATION",
- "U_STATIC_IMPLEMENTATION",
- "U_ENABLE_DYLOAD=0",
- "U_I18N_IMPLEMENTATION",
-
- # If we don't set this to zero, ICU will set it to 600,
- # which makes Macs set _POSIX_C_SOURCE=200112L,
- # which makes Macs set __DARWIN_C_LEVEL=_POSIX_C_SOURCE instead of =__DARWIN_C_FULL,
- # which makes <time.h> not expose timespec_get,
- # which makes recent libc++ <ctime> not #include-able with -std=c++17.
- "_XOPEN_SOURCE=0",
- ] + select({
- # Tell ICU that we are a 32 bit platform, otherwise,
- # double-conversion-utils.h doesn't know how to operate.
- "//bazel/common_config_settings:cpu_wasm": ["__i386__"],
- "//conditions:default": [],
- }),
- visibility = ["//:__subpackages__"],
-)
-
-_icu_version_major_num = "69" # defined in source/common/unicode/uvernum.h
-
-genrule(
- name = "create_icu_wasm_data_cpp",
- # For WASM, we use a super stripped down version, the same as what flutter uses.
- srcs = ["externals/icu/flutter/icudtl.dat"],
- outs = ["generated_icu_wasm_dat.cpp"],
- cmd = "$(location :make_data_cpp) " +
- "icudt" + _icu_version_major_num + "_dat " +
- # We need to specify the absolute path from the root
- "third_party/externals/icu/flutter/icudtl.dat " +
- # The $@ means substitute in the one and only output location, which will be located
- # in //bazel-out.
- "$@",
- tools = [":make_data_cpp"],
-)
-
-# We need to make a separate genrule per input because cmd cannot be based on a select()
-genrule(
- name = "create_icu_common_data_asm",
- srcs = ["externals/icu/common/icudtl.dat"],
- outs = ["generated_icu_common_dat.S"],
- cmd = "$(location :make_data_assembly) " +
- # We need to specify the absolute path from the root
- "third_party/externals/icu/common/icudtl.dat " +
- # The $@ means substitute in the one and only output location, which will be located
- # in //bazel-out.
- "$@",
- tools = [":make_data_assembly"],
-)
-
-genrule(
- name = "create_icu_android_data_asm",
- srcs = ["externals/icu/android/icudtl.dat"],
- outs = ["generated_icu_android_dat.S"],
- cmd = "$(location :make_data_assembly) " +
- # We need to specify the absolute path from the root
- "third_party/externals/icu/common/icudtl.dat " +
- # The $@ means substitute in the one and only output location, which will be located
- # in //bazel-out.
- "$@",
- tools = [":make_data_assembly"],
-)
-
-genrule(
- name = "create_icu_ios_data_asm",
- srcs = ["externals/icu/ios/icudtl.dat"],
- outs = ["generated_icu_ios_dat.S"],
- cmd = "$(location :make_data_assembly) " +
- # We need to specify the absolute path from the root
- "third_party/externals/icu/common/icudtl.dat " +
- # The $@ means substitute in the one and only output location, which will be located
- # in //bazel-out.
- "$@",
- tools = [":make_data_assembly"],
-)
-
-py_binary(
- name = "make_data_assembly",
- srcs = ["externals/icu/scripts/make_data_assembly.py"],
-)
-
-py_binary(
- name = "make_data_cpp",
- srcs = ["icu/make_data_cpp.py"],
-)
-
-HARFBUZZ_HDRS = [
- "externals/harfbuzz/src/hb-aat-layout.h",
- "externals/harfbuzz/src/hb-blob.h",
- "externals/harfbuzz/src/hb-buffer.h",
- "externals/harfbuzz/src/hb-common.h",
- "externals/harfbuzz/src/hb-deprecated.h",
- "externals/harfbuzz/src/hb-face.h",
- "externals/harfbuzz/src/hb-font.h",
- "externals/harfbuzz/src/hb-map.h",
- "externals/harfbuzz/src/hb-ot-font.h",
- "externals/harfbuzz/src/hb-ot-layout.h",
- "externals/harfbuzz/src/hb-ot-math.h",
- "externals/harfbuzz/src/hb-ot-metrics.h",
- "externals/harfbuzz/src/hb-ot-shape.h",
- "externals/harfbuzz/src/hb-ot-var.h",
- "externals/harfbuzz/src/hb-ot.h",
- "externals/harfbuzz/src/hb-set.h",
- "externals/harfbuzz/src/hb-shape-plan.h",
- "externals/harfbuzz/src/hb-shape.h",
- "externals/harfbuzz/src/hb-style.h",
- "externals/harfbuzz/src/hb-subset.h",
- "externals/harfbuzz/src/hb-unicode.h",
- "externals/harfbuzz/src/hb-version.h",
- "externals/harfbuzz/src/hb.h",
-]
-
-HARFBUZZ_SRCS = [
- "externals/harfbuzz/src/OT/Layout/GSUB/AlternateSet.hh",
- "externals/harfbuzz/src/OT/Layout/GSUB/AlternateSubst.hh",
- "externals/harfbuzz/src/OT/Layout/GSUB/AlternateSubstFormat1.hh",
- "externals/harfbuzz/src/OT/Layout/GSUB/ChainContextSubst.hh",
- "externals/harfbuzz/src/OT/Layout/GSUB/Common.hh",
- "externals/harfbuzz/src/OT/Layout/GSUB/ContextSubst.hh",
- "externals/harfbuzz/src/OT/Layout/GSUB/ExtensionSubst.hh",
- "externals/harfbuzz/src/OT/Layout/GSUB/GSUB.hh",
- "externals/harfbuzz/src/OT/Layout/GSUB/Ligature.hh",
- "externals/harfbuzz/src/OT/Layout/GSUB/LigatureSet.hh",
- "externals/harfbuzz/src/OT/Layout/GSUB/LigatureSubst.hh",
- "externals/harfbuzz/src/OT/Layout/GSUB/LigatureSubstFormat1.hh",
- "externals/harfbuzz/src/OT/Layout/GSUB/MultipleSubst.hh",
- "externals/harfbuzz/src/OT/Layout/GSUB/MultipleSubstFormat1.hh",
- "externals/harfbuzz/src/OT/Layout/GSUB/ReverseChainSingleSubst.hh",
- "externals/harfbuzz/src/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh",
- "externals/harfbuzz/src/OT/Layout/GSUB/Sequence.hh",
- "externals/harfbuzz/src/OT/Layout/GSUB/SingleSubst.hh",
- "externals/harfbuzz/src/OT/Layout/GSUB/SingleSubstFormat1.hh",
- "externals/harfbuzz/src/OT/Layout/GSUB/SingleSubstFormat2.hh",
- "externals/harfbuzz/src/OT/Layout/GSUB/SubstLookup.hh",
- "externals/harfbuzz/src/OT/Layout/GSUB/SubstLookupSubTable.hh",
- "externals/harfbuzz/src/hb-aat-layout-ankr-table.hh",
- "externals/harfbuzz/src/hb-aat-layout-bsln-table.hh",
- "externals/harfbuzz/src/hb-aat-layout-common.hh",
- "externals/harfbuzz/src/hb-aat-layout-feat-table.hh",
- "externals/harfbuzz/src/hb-aat-layout-just-table.hh",
- "externals/harfbuzz/src/hb-aat-layout-kerx-table.hh",
- "externals/harfbuzz/src/hb-aat-layout-morx-table.hh",
- "externals/harfbuzz/src/hb-aat-layout-opbd-table.hh",
- "externals/harfbuzz/src/hb-aat-layout-trak-table.hh",
- "externals/harfbuzz/src/hb-aat-layout.cc",
- "externals/harfbuzz/src/hb-aat-layout.hh",
- "externals/harfbuzz/src/hb-aat-ltag-table.hh",
- "externals/harfbuzz/src/hb-aat-map.cc",
- "externals/harfbuzz/src/hb-aat-map.hh",
- "externals/harfbuzz/src/hb-aat.h",
- "externals/harfbuzz/src/hb-algs.hh",
- "externals/harfbuzz/src/hb-array.hh",
- "externals/harfbuzz/src/hb-atomic.hh",
- "externals/harfbuzz/src/hb-bimap.hh",
- "externals/harfbuzz/src/hb-bit-page.hh",
- "externals/harfbuzz/src/hb-bit-set-invertible.hh",
- "externals/harfbuzz/src/hb-bit-set.hh",
- "externals/harfbuzz/src/hb-blob.cc",
- "externals/harfbuzz/src/hb-blob.hh",
- "externals/harfbuzz/src/hb-buffer-deserialize-json.hh",
- "externals/harfbuzz/src/hb-buffer-deserialize-text.hh",
- "externals/harfbuzz/src/hb-buffer-serialize.cc",
- "externals/harfbuzz/src/hb-buffer-verify.cc",
- "externals/harfbuzz/src/hb-buffer.cc",
- "externals/harfbuzz/src/hb-buffer.hh",
- "externals/harfbuzz/src/hb-cache.hh",
- "externals/harfbuzz/src/hb-cff-interp-common.hh",
- "externals/harfbuzz/src/hb-cff-interp-cs-common.hh",
- "externals/harfbuzz/src/hb-cff-interp-dict-common.hh",
- "externals/harfbuzz/src/hb-cff1-interp-cs.hh",
- "externals/harfbuzz/src/hb-cff2-interp-cs.hh",
- "externals/harfbuzz/src/hb-common.cc",
- "externals/harfbuzz/src/hb-config.hh",
- "externals/harfbuzz/src/hb-debug.hh",
- "externals/harfbuzz/src/hb-dispatch.hh",
- "externals/harfbuzz/src/hb-draw.cc",
- "externals/harfbuzz/src/hb-draw.h",
- "externals/harfbuzz/src/hb-draw.hh",
- "externals/harfbuzz/src/hb-face.cc",
- "externals/harfbuzz/src/hb-face.hh",
- "externals/harfbuzz/src/hb-font.cc",
- "externals/harfbuzz/src/hb-font.hh",
- "externals/harfbuzz/src/hb-iter.hh",
- "externals/harfbuzz/src/hb-kern.hh",
- "externals/harfbuzz/src/hb-machinery.hh",
- "externals/harfbuzz/src/hb-map.cc",
- "externals/harfbuzz/src/hb-map.hh",
- "externals/harfbuzz/src/hb-meta.hh",
- "externals/harfbuzz/src/hb-ms-feature-ranges.hh",
- "externals/harfbuzz/src/hb-mutex.hh",
- "externals/harfbuzz/src/hb-null.hh",
- "externals/harfbuzz/src/hb-number-parser.hh",
- "externals/harfbuzz/src/hb-number.cc",
- "externals/harfbuzz/src/hb-number.hh",
- "externals/harfbuzz/src/hb-object.hh",
- "externals/harfbuzz/src/hb-open-file.hh",
- "externals/harfbuzz/src/hb-open-type.hh",
- "externals/harfbuzz/src/hb-ot-cff-common.hh",
- "externals/harfbuzz/src/hb-ot-cff1-std-str.hh",
- "externals/harfbuzz/src/hb-ot-cff1-table.cc",
- "externals/harfbuzz/src/hb-ot-cff1-table.hh",
- "externals/harfbuzz/src/hb-ot-cff2-table.cc",
- "externals/harfbuzz/src/hb-ot-cff2-table.hh",
- "externals/harfbuzz/src/hb-ot-cmap-table.hh",
- "externals/harfbuzz/src/hb-ot-color-cbdt-table.hh",
- "externals/harfbuzz/src/hb-ot-color-colr-table.hh",
- "externals/harfbuzz/src/hb-ot-color-colrv1-closure.hh",
- "externals/harfbuzz/src/hb-ot-color-cpal-table.hh",
- "externals/harfbuzz/src/hb-ot-color-sbix-table.hh",
- "externals/harfbuzz/src/hb-ot-color-svg-table.hh",
- "externals/harfbuzz/src/hb-ot-color.cc",
- "externals/harfbuzz/src/hb-ot-color.h",
- "externals/harfbuzz/src/hb-ot-deprecated.h",
- "externals/harfbuzz/src/hb-ot-face-table-list.hh",
- "externals/harfbuzz/src/hb-ot-face.cc",
- "externals/harfbuzz/src/hb-ot-face.hh",
- "externals/harfbuzz/src/hb-ot-font.cc",
- "externals/harfbuzz/src/hb-ot-gasp-table.hh",
- "externals/harfbuzz/src/hb-ot-glyf-table.hh",
- "externals/harfbuzz/src/hb-ot-hdmx-table.hh",
- "externals/harfbuzz/src/hb-ot-head-table.hh",
- "externals/harfbuzz/src/hb-ot-hhea-table.hh",
- "externals/harfbuzz/src/hb-ot-hmtx-table.hh",
- "externals/harfbuzz/src/hb-ot-kern-table.hh",
- "externals/harfbuzz/src/hb-ot-layout-base-table.hh",
- "externals/harfbuzz/src/hb-ot-layout-common.hh",
- "externals/harfbuzz/src/hb-ot-layout-gdef-table.hh",
- "externals/harfbuzz/src/hb-ot-layout-gpos-table.hh",
- "externals/harfbuzz/src/hb-ot-layout-gsub-table.hh",
- "externals/harfbuzz/src/hb-ot-layout-gsubgpos.hh",
- "externals/harfbuzz/src/hb-ot-layout-jstf-table.hh",
- "externals/harfbuzz/src/hb-ot-layout.cc",
- "externals/harfbuzz/src/hb-ot-layout.hh",
- "externals/harfbuzz/src/hb-ot-map.cc",
- "externals/harfbuzz/src/hb-ot-map.hh",
- "externals/harfbuzz/src/hb-ot-math-table.hh",
- "externals/harfbuzz/src/hb-ot-math.cc",
- "externals/harfbuzz/src/hb-ot-maxp-table.hh",
- "externals/harfbuzz/src/hb-ot-meta-table.hh",
- "externals/harfbuzz/src/hb-ot-meta.cc",
- "externals/harfbuzz/src/hb-ot-meta.h",
- "externals/harfbuzz/src/hb-ot-metrics.cc",
- "externals/harfbuzz/src/hb-ot-metrics.hh",
- "externals/harfbuzz/src/hb-ot-name-language-static.hh",
- "externals/harfbuzz/src/hb-ot-name-language.hh",
- "externals/harfbuzz/src/hb-ot-name-table.hh",
- "externals/harfbuzz/src/hb-ot-name.cc",
- "externals/harfbuzz/src/hb-ot-name.h",
- "externals/harfbuzz/src/hb-ot-os2-table.hh",
- "externals/harfbuzz/src/hb-ot-os2-unicode-ranges.hh",
- "externals/harfbuzz/src/hb-ot-post-macroman.hh",
- "externals/harfbuzz/src/hb-ot-post-table-v2subset.hh",
- "externals/harfbuzz/src/hb-ot-post-table.hh",
- "externals/harfbuzz/src/hb-ot-shape-complex-arabic-fallback.hh",
- "externals/harfbuzz/src/hb-ot-shape-complex-arabic-joining-list.hh",
- "externals/harfbuzz/src/hb-ot-shape-complex-arabic-table.hh",
- "externals/harfbuzz/src/hb-ot-shape-complex-arabic.cc",
- "externals/harfbuzz/src/hb-ot-shape-complex-arabic.hh",
- "externals/harfbuzz/src/hb-ot-shape-complex-default.cc",
- "externals/harfbuzz/src/hb-ot-shape-complex-hangul.cc",
- "externals/harfbuzz/src/hb-ot-shape-complex-hebrew.cc",
- "externals/harfbuzz/src/hb-ot-shape-complex-indic-machine.hh",
- "externals/harfbuzz/src/hb-ot-shape-complex-indic-table.cc",
- "externals/harfbuzz/src/hb-ot-shape-complex-indic.cc",
- "externals/harfbuzz/src/hb-ot-shape-complex-indic.hh",
- "externals/harfbuzz/src/hb-ot-shape-complex-khmer-machine.hh",
- "externals/harfbuzz/src/hb-ot-shape-complex-khmer.cc",
- "externals/harfbuzz/src/hb-ot-shape-complex-khmer.hh",
- "externals/harfbuzz/src/hb-ot-shape-complex-myanmar-machine.hh",
- "externals/harfbuzz/src/hb-ot-shape-complex-myanmar.cc",
- "externals/harfbuzz/src/hb-ot-shape-complex-myanmar.hh",
- "externals/harfbuzz/src/hb-ot-shape-complex-syllabic.cc",
- "externals/harfbuzz/src/hb-ot-shape-complex-syllabic.hh",
- "externals/harfbuzz/src/hb-ot-shape-complex-thai.cc",
- "externals/harfbuzz/src/hb-ot-shape-complex-use-machine.hh",
- "externals/harfbuzz/src/hb-ot-shape-complex-use-table.hh",
- "externals/harfbuzz/src/hb-ot-shape-complex-use.cc",
- "externals/harfbuzz/src/hb-ot-shape-complex-vowel-constraints.cc",
- "externals/harfbuzz/src/hb-ot-shape-complex-vowel-constraints.hh",
- "externals/harfbuzz/src/hb-ot-shape-complex.hh",
- "externals/harfbuzz/src/hb-ot-shape-fallback.cc",
- "externals/harfbuzz/src/hb-ot-shape-fallback.hh",
- "externals/harfbuzz/src/hb-ot-shape-normalize.cc",
- "externals/harfbuzz/src/hb-ot-shape-normalize.hh",
- "externals/harfbuzz/src/hb-ot-shape.cc",
- "externals/harfbuzz/src/hb-ot-shape.hh",
- "externals/harfbuzz/src/hb-ot-stat-table.hh",
- "externals/harfbuzz/src/hb-ot-tag-table.hh",
- "externals/harfbuzz/src/hb-ot-tag.cc",
- "externals/harfbuzz/src/hb-ot-var-avar-table.hh",
- "externals/harfbuzz/src/hb-ot-var-common.hh",
- "externals/harfbuzz/src/hb-ot-var-fvar-table.hh",
- "externals/harfbuzz/src/hb-ot-var-gvar-table.hh",
- "externals/harfbuzz/src/hb-ot-var-hvar-table.hh",
- "externals/harfbuzz/src/hb-ot-var-mvar-table.hh",
- "externals/harfbuzz/src/hb-ot-var.cc",
- "externals/harfbuzz/src/hb-ot-vorg-table.hh",
- "externals/harfbuzz/src/hb-pool.hh",
- "externals/harfbuzz/src/hb-priority-queue.hh",
- "externals/harfbuzz/src/hb-repacker.hh",
- "externals/harfbuzz/src/hb-sanitize.hh",
- "externals/harfbuzz/src/hb-serialize.hh",
- "externals/harfbuzz/src/hb-set-digest.hh",
- "externals/harfbuzz/src/hb-set.cc",
- "externals/harfbuzz/src/hb-set.hh",
- "externals/harfbuzz/src/hb-shape-plan.cc",
- "externals/harfbuzz/src/hb-shape-plan.hh",
- "externals/harfbuzz/src/hb-shape.cc",
- "externals/harfbuzz/src/hb-shaper-impl.hh",
- "externals/harfbuzz/src/hb-shaper-list.hh",
- "externals/harfbuzz/src/hb-shaper.cc",
- "externals/harfbuzz/src/hb-shaper.hh",
- "externals/harfbuzz/src/hb-static.cc",
- "externals/harfbuzz/src/hb-string-array.hh",
- "externals/harfbuzz/src/hb-subset-cff-common.cc",
- "externals/harfbuzz/src/hb-subset-cff-common.hh",
- "externals/harfbuzz/src/hb-subset-cff1.cc",
- "externals/harfbuzz/src/hb-subset-cff1.hh",
- "externals/harfbuzz/src/hb-subset-cff2.cc",
- "externals/harfbuzz/src/hb-subset-cff2.hh",
- "externals/harfbuzz/src/hb-subset-input.cc",
- "externals/harfbuzz/src/hb-subset-input.hh",
- "externals/harfbuzz/src/hb-subset-plan.cc",
- "externals/harfbuzz/src/hb-subset-plan.hh",
- "externals/harfbuzz/src/hb-subset-repacker.cc",
- "externals/harfbuzz/src/hb-subset-repacker.h",
- "externals/harfbuzz/src/hb-subset.cc",
- "externals/harfbuzz/src/hb-subset.hh",
- "externals/harfbuzz/src/hb-ucd-table.hh",
- "externals/harfbuzz/src/hb-ucd.cc",
- "externals/harfbuzz/src/hb-unicode-emoji-table.hh",
- "externals/harfbuzz/src/hb-unicode.cc",
- "externals/harfbuzz/src/hb-unicode.hh",
- "externals/harfbuzz/src/hb-utf.hh",
- "externals/harfbuzz/src/hb-vector.hh",
- "externals/harfbuzz/src/hb.hh",
- "harfbuzz/config-override.h",
-]
-
-cc_library(
- name = "harfbuzz",
- srcs = HARFBUZZ_SRCS,
- hdrs = HARFBUZZ_HDRS,
- includes = [
- "externals/harfbuzz/src",
- "harfbuzz",
- ],
- local_defines = [
- "HAVE_OT",
- "HAVE_CONFIG_OVERRIDE_H",
- "HB_NO_FALLBACK_SHAPE",
- "HB_NO_WIN1256",
- ],
- visibility = ["//:__subpackages__"],
-)
-
-cc_library(
- name = "etc1",
- srcs = [
- "etc1/etc1.cpp",
- ],
- hdrs = [
- "etc1/etc1.h",
- ],
- visibility = ["//:__subpackages__"],
-)
-
-cc_library(
- name = "spirv_cross",
- srcs = [
- "externals/spirv-cross/GLSL.std.450.h",
- "externals/spirv-cross/spirv.hpp",
- "externals/spirv-cross/spirv_cfg.cpp",
- "externals/spirv-cross/spirv_cfg.hpp",
- "externals/spirv-cross/spirv_common.hpp",
- "externals/spirv-cross/spirv_cpp.cpp",
- "externals/spirv-cross/spirv_cpp.hpp",
- "externals/spirv-cross/spirv_cross.cpp",
- "externals/spirv-cross/spirv_cross.hpp",
- "externals/spirv-cross/spirv_cross_containers.hpp",
- "externals/spirv-cross/spirv_cross_error_handling.hpp",
- "externals/spirv-cross/spirv_cross_parsed_ir.cpp",
- "externals/spirv-cross/spirv_cross_parsed_ir.hpp",
- "externals/spirv-cross/spirv_glsl.cpp",
- "externals/spirv-cross/spirv_glsl.hpp",
- "externals/spirv-cross/spirv_hlsl.cpp",
- "externals/spirv-cross/spirv_msl.cpp",
- "externals/spirv-cross/spirv_msl.hpp",
- "externals/spirv-cross/spirv_parser.cpp",
- "externals/spirv-cross/spirv_parser.hpp",
- "externals/spirv-cross/spirv_reflect.cpp",
- "externals/spirv-cross/spirv_reflect.hpp",
- ],
- hdrs = [
- "externals/spirv-cross/spirv_hlsl.hpp",
- ],
- defines = ["SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS"],
- visibility = ["//:__subpackages__"],
-)
diff --git a/chromium/third_party/skia/third_party/README b/chromium/third_party/skia/third_party/README
index e549f2ce34b..909ec868505 100644
--- a/chromium/third_party/skia/third_party/README
+++ b/chromium/third_party/skia/third_party/README
@@ -1,7 +1,7 @@
The third_party directory contains a set of dependencies from outside sources
-that are needed to build various components and tools within Skia.
+that are needed to build various components and tools within Skia.
-Some of these dependencies reside within the Skia repo, while others are pulled
+Some of these dependencies reside within the Skia repo, while others are pulled
from other repositories and placed in the third_party/externals directory
during build. These external dependencies are defined in a DEPS file.
@@ -11,3 +11,5 @@ header or file. If the source itself does not include a license header or file,
create a README that refers to reliable documentation of the project's license
terms on the web.
+We, the Skia team, write Bazel rules for these third_party libraries if they do not have their own.
+We maintain these Bazel rules in //bazel/external.
diff --git a/chromium/third_party/skia/third_party/etc1/BUILD.bazel b/chromium/third_party/skia/third_party/etc1/BUILD.bazel
new file mode 100644
index 00000000000..51b7a5578b3
--- /dev/null
+++ b/chromium/third_party/skia/third_party/etc1/BUILD.bazel
@@ -0,0 +1,11 @@
+cc_library(
+ name = "etc1",
+ testonly = True, # Only used for a few gms
+ srcs = [
+ "etc1.cpp",
+ ],
+ hdrs = [
+ "etc1.h",
+ ],
+ visibility = ["//gm:__pkg__"],
+)
diff --git a/chromium/third_party/skia/third_party/freetype2/BUILD.gn b/chromium/third_party/skia/third_party/freetype2/BUILD.gn
index f6c7e9552eb..5a59be0fa13 100644
--- a/chromium/third_party/skia/third_party/freetype2/BUILD.gn
+++ b/chromium/third_party/skia/third_party/freetype2/BUILD.gn
@@ -8,6 +8,8 @@ declare_args() {
skia_use_system_freetype2 =
(is_official_build || !(is_android || sanitize == "MSAN")) &&
!is_fuchsia && !is_wasm
+ skia_system_freetype2_include_path = "/usr/include/freetype2"
+ skia_system_freetype2_lib = "freetype"
skia_use_freetype_woff2 = is_wasm
skia_use_freetype_svg = true
}
@@ -16,8 +18,8 @@ import("../third_party.gni")
if (skia_use_system_freetype2) {
system("freetype2") {
- include_dirs = [ "/usr/include/freetype2" ]
- libs = [ "freetype" ]
+ include_dirs = [ skia_system_freetype2_include_path ]
+ libs = [ skia_system_freetype2_lib ]
}
} else {
third_party("freetype2") {
diff --git a/chromium/third_party/skia/third_party/freetype2/include/README.md b/chromium/third_party/skia/third_party/freetype2/include/README.md
new file mode 100644
index 00000000000..da4454384f6
--- /dev/null
+++ b/chromium/third_party/skia/third_party/freetype2/include/README.md
@@ -0,0 +1 @@
+These files represent configurations of how we build Freetype. \ No newline at end of file
diff --git a/chromium/third_party/skia/third_party/harfbuzz/BUILD.gn b/chromium/third_party/skia/third_party/harfbuzz/BUILD.gn
index 1167ff39c70..6838f738acc 100644
--- a/chromium/third_party/skia/third_party/harfbuzz/BUILD.gn
+++ b/chromium/third_party/skia/third_party/harfbuzz/BUILD.gn
@@ -59,6 +59,81 @@ if (skia_use_system_harfbuzz) {
]
sources = [
+ "$_src/OT/Layout/Common/Coverage.hh",
+ "$_src/OT/Layout/Common/CoverageFormat1.hh",
+ "$_src/OT/Layout/Common/CoverageFormat2.hh",
+ "$_src/OT/Layout/Common/RangeRecord.hh",
+ "$_src/OT/Layout/GPOS/Anchor.hh",
+ "$_src/OT/Layout/GPOS/AnchorFormat1.hh",
+ "$_src/OT/Layout/GPOS/AnchorFormat2.hh",
+ "$_src/OT/Layout/GPOS/AnchorFormat3.hh",
+ "$_src/OT/Layout/GPOS/AnchorMatrix.hh",
+ "$_src/OT/Layout/GPOS/ChainContextPos.hh",
+ "$_src/OT/Layout/GPOS/Common.hh",
+ "$_src/OT/Layout/GPOS/ContextPos.hh",
+ "$_src/OT/Layout/GPOS/CursivePos.hh",
+ "$_src/OT/Layout/GPOS/CursivePosFormat1.hh",
+ "$_src/OT/Layout/GPOS/ExtensionPos.hh",
+ "$_src/OT/Layout/GPOS/GPOS.hh",
+ "$_src/OT/Layout/GPOS/LigatureArray.hh",
+ "$_src/OT/Layout/GPOS/MarkArray.hh",
+ "$_src/OT/Layout/GPOS/MarkBasePos.hh",
+ "$_src/OT/Layout/GPOS/MarkBasePosFormat1.hh",
+ "$_src/OT/Layout/GPOS/MarkLigPos.hh",
+ "$_src/OT/Layout/GPOS/MarkLigPosFormat1.hh",
+ "$_src/OT/Layout/GPOS/MarkMarkPos.hh",
+ "$_src/OT/Layout/GPOS/MarkMarkPosFormat1.hh",
+ "$_src/OT/Layout/GPOS/MarkRecord.hh",
+ "$_src/OT/Layout/GPOS/PairPos.hh",
+ "$_src/OT/Layout/GPOS/PairPosFormat1.hh",
+ "$_src/OT/Layout/GPOS/PairPosFormat2.hh",
+ "$_src/OT/Layout/GPOS/PairSet.hh",
+ "$_src/OT/Layout/GPOS/PairValueRecord.hh",
+ "$_src/OT/Layout/GPOS/PosLookup.hh",
+ "$_src/OT/Layout/GPOS/PosLookupSubTable.hh",
+ "$_src/OT/Layout/GPOS/SinglePos.hh",
+ "$_src/OT/Layout/GPOS/SinglePosFormat1.hh",
+ "$_src/OT/Layout/GPOS/SinglePosFormat2.hh",
+ "$_src/OT/Layout/GPOS/ValueFormat.hh",
+ "$_src/OT/Layout/GSUB/AlternateSet.hh",
+ "$_src/OT/Layout/GSUB/AlternateSubst.hh",
+ "$_src/OT/Layout/GSUB/AlternateSubstFormat1.hh",
+ "$_src/OT/Layout/GSUB/ChainContextSubst.hh",
+ "$_src/OT/Layout/GSUB/Common.hh",
+ "$_src/OT/Layout/GSUB/ContextSubst.hh",
+ "$_src/OT/Layout/GSUB/ExtensionSubst.hh",
+ "$_src/OT/Layout/GSUB/GSUB.hh",
+ "$_src/OT/Layout/GSUB/Ligature.hh",
+ "$_src/OT/Layout/GSUB/LigatureSet.hh",
+ "$_src/OT/Layout/GSUB/LigatureSubst.hh",
+ "$_src/OT/Layout/GSUB/LigatureSubstFormat1.hh",
+ "$_src/OT/Layout/GSUB/MultipleSubst.hh",
+ "$_src/OT/Layout/GSUB/MultipleSubstFormat1.hh",
+ "$_src/OT/Layout/GSUB/ReverseChainSingleSubst.hh",
+ "$_src/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh",
+ "$_src/OT/Layout/GSUB/Sequence.hh",
+ "$_src/OT/Layout/GSUB/SingleSubst.hh",
+ "$_src/OT/Layout/GSUB/SingleSubstFormat1.hh",
+ "$_src/OT/Layout/GSUB/SingleSubstFormat2.hh",
+ "$_src/OT/Layout/GSUB/SubstLookup.hh",
+ "$_src/OT/Layout/GSUB/SubstLookupSubTable.hh",
+ "$_src/OT/Layout/types.hh",
+ "$_src/OT/glyf/CompositeGlyph.hh",
+ "$_src/OT/glyf/Glyph.hh",
+ "$_src/OT/glyf/GlyphHeader.hh",
+ "$_src/OT/glyf/SimpleGlyph.hh",
+ "$_src/OT/glyf/SubsetGlyph.hh",
+ "$_src/OT/glyf/glyf-helpers.hh",
+ "$_src/OT/glyf/glyf.hh",
+ "$_src/OT/glyf/loca.hh",
+ "$_src/OT/glyf/path-builder.hh",
+ "$_src/graph/coverage-graph.hh",
+ "$_src/graph/graph.hh",
+ "$_src/graph/gsubgpos-context.cc",
+ "$_src/graph/gsubgpos-context.hh",
+ "$_src/graph/gsubgpos-graph.hh",
+ "$_src/graph/pairpos-graph.hh",
+ "$_src/graph/serialize.hh",
"$_src/hb-aat-layout-ankr-table.hh",
"$_src/hb-aat-layout-bsln-table.hh",
"$_src/hb-aat-layout-common.hh",
@@ -97,6 +172,7 @@ if (skia_use_system_harfbuzz) {
"$_src/hb-cff2-interp-cs.hh",
"$_src/hb-common.cc",
"$_src/hb-config.hh",
+ "$_src/hb-cplusplus.hh",
"$_src/hb-debug.hh",
"$_src/hb-dispatch.hh",
"$_src/hb-draw.cc",
@@ -177,39 +253,38 @@ if (skia_use_system_harfbuzz) {
"$_src/hb-ot-post-macroman.hh",
"$_src/hb-ot-post-table-v2subset.hh",
"$_src/hb-ot-post-table.hh",
- "$_src/hb-ot-shape-complex-arabic-fallback.hh",
- "$_src/hb-ot-shape-complex-arabic-joining-list.hh",
- "$_src/hb-ot-shape-complex-arabic-table.hh",
- "$_src/hb-ot-shape-complex-arabic.cc",
- "$_src/hb-ot-shape-complex-arabic.hh",
- "$_src/hb-ot-shape-complex-default.cc",
- "$_src/hb-ot-shape-complex-hangul.cc",
- "$_src/hb-ot-shape-complex-hebrew.cc",
- "$_src/hb-ot-shape-complex-indic-machine.hh",
- "$_src/hb-ot-shape-complex-indic-table.cc",
- "$_src/hb-ot-shape-complex-indic.cc",
- "$_src/hb-ot-shape-complex-indic.hh",
- "$_src/hb-ot-shape-complex-khmer-machine.hh",
- "$_src/hb-ot-shape-complex-khmer.cc",
- "$_src/hb-ot-shape-complex-khmer.hh",
- "$_src/hb-ot-shape-complex-myanmar-machine.hh",
- "$_src/hb-ot-shape-complex-myanmar.cc",
- "$_src/hb-ot-shape-complex-myanmar.hh",
- "$_src/hb-ot-shape-complex-syllabic.cc",
- "$_src/hb-ot-shape-complex-syllabic.hh",
- "$_src/hb-ot-shape-complex-thai.cc",
- "$_src/hb-ot-shape-complex-use-machine.hh",
- "$_src/hb-ot-shape-complex-use-table.hh",
- "$_src/hb-ot-shape-complex-use.cc",
- "$_src/hb-ot-shape-complex-vowel-constraints.cc",
- "$_src/hb-ot-shape-complex-vowel-constraints.hh",
- "$_src/hb-ot-shape-complex.hh",
"$_src/hb-ot-shape-fallback.cc",
"$_src/hb-ot-shape-fallback.hh",
"$_src/hb-ot-shape-normalize.cc",
"$_src/hb-ot-shape-normalize.hh",
"$_src/hb-ot-shape.cc",
"$_src/hb-ot-shape.hh",
+ "$_src/hb-ot-shaper-arabic-fallback.hh",
+ "$_src/hb-ot-shaper-arabic-joining-list.hh",
+ "$_src/hb-ot-shaper-arabic-pua.hh",
+ "$_src/hb-ot-shaper-arabic-table.hh",
+ "$_src/hb-ot-shaper-arabic.cc",
+ "$_src/hb-ot-shaper-arabic.hh",
+ "$_src/hb-ot-shaper-default.cc",
+ "$_src/hb-ot-shaper-hangul.cc",
+ "$_src/hb-ot-shaper-hebrew.cc",
+ "$_src/hb-ot-shaper-indic-machine.hh",
+ "$_src/hb-ot-shaper-indic-table.cc",
+ "$_src/hb-ot-shaper-indic.cc",
+ "$_src/hb-ot-shaper-indic.hh",
+ "$_src/hb-ot-shaper-khmer-machine.hh",
+ "$_src/hb-ot-shaper-khmer.cc",
+ "$_src/hb-ot-shaper-myanmar-machine.hh",
+ "$_src/hb-ot-shaper-myanmar.cc",
+ "$_src/hb-ot-shaper-syllabic.cc",
+ "$_src/hb-ot-shaper-syllabic.hh",
+ "$_src/hb-ot-shaper-thai.cc",
+ "$_src/hb-ot-shaper-use-machine.hh",
+ "$_src/hb-ot-shaper-use-table.hh",
+ "$_src/hb-ot-shaper-use.cc",
+ "$_src/hb-ot-shaper-vowel-constraints.cc",
+ "$_src/hb-ot-shaper-vowel-constraints.hh",
+ "$_src/hb-ot-shaper.hh",
"$_src/hb-ot-stat-table.hh",
"$_src/hb-ot-tag-table.hh",
"$_src/hb-ot-tag.cc",
@@ -266,6 +341,8 @@ if (skia_use_system_harfbuzz) {
# The following sources are explicitly not used.
# They are referenced to aid in detecting previously uncategorized files.
unused_sources = [
+ "$_src/harfbuzz-subset.cc",
+ "$_src/harfbuzz.cc",
"$_src/hb-coretext.cc",
"$_src/hb-coretext.h",
"$_src/hb-directwrite.cc",
@@ -284,11 +361,32 @@ if (skia_use_system_harfbuzz) {
"$_src/hb-graphite2.h",
"$_src/hb-icu.cc",
"$_src/hb-icu.h",
- "$_src/hb-ot-shape-complex-arabic-win1256.hh",
+ "$_src/hb-ot-shaper-arabic-win1256.hh",
"$_src/hb-style.cc",
"$_src/hb-style.h",
"$_src/hb-uniscribe.cc",
"$_src/hb-uniscribe.h",
+ "$_src/main.cc",
+ "$_src/test-algs.cc",
+ "$_src/test-array.cc",
+ "$_src/test-bimap.cc",
+ "$_src/test-buffer-serialize.cc",
+ "$_src/test-gpos-size-params.cc",
+ "$_src/test-gsub-would-substitute.cc",
+ "$_src/test-iter.cc",
+ "$_src/test-machinery.cc",
+ "$_src/test-map.cc",
+ "$_src/test-number.cc",
+ "$_src/test-ot-glyphname.cc",
+ "$_src/test-ot-meta.cc",
+ "$_src/test-ot-name.cc",
+ "$_src/test-priority-queue.cc",
+ "$_src/test-repacker.cc",
+ "$_src/test-serialize.cc",
+ "$_src/test-set.cc",
+ "$_src/test-unicode-ranges.cc",
+ "$_src/test-vector.cc",
+ "$_src/test.cc",
]
assert(unused_sources != [])
}
diff --git a/chromium/third_party/skia/third_party/harfbuzz/roll-harfbuzz.sh b/chromium/third_party/skia/third_party/harfbuzz/roll-harfbuzz.sh
index 8826c98b7de..90b39939279 100755
--- a/chromium/third_party/skia/third_party/harfbuzz/roll-harfbuzz.sh
+++ b/chromium/third_party/skia/third_party/harfbuzz/roll-harfbuzz.sh
@@ -41,11 +41,11 @@ check_all_files_are_categorized() {
cd -- "${HB_GIT_DIR}" &&
HB_SOURCE_MISSING=false &&
- find src -type f \( -name "hb-*.cc" -o -name "hb-*.h" -o -name "hb-*.hh" \) | while read HB_SOURCE
+ find src -type f \( -name "*.cc" -o -name "*.h" -o -name "*.hh" \) | while read HB_SOURCE
do
if ! grep -qF "$HB_SOURCE" ${HB_BUILD_DIR_REL}/BUILD.gn; then
if ! ${HB_SOURCE_MISSING}; then
- echo "Is in src/hb-*.{cc,h,hh} but not in BUILD.gn:"
+ echo "Is in src/*.{cc,h,hh} but not in BUILD.gn:"
HB_SOURCE_MISSING=true
fi
echo " \"\$_${HB_SOURCE}\","
diff --git a/chromium/third_party/skia/third_party/libavif/BUILD.gn b/chromium/third_party/skia/third_party/libavif/BUILD.gn
new file mode 100644
index 00000000000..626f39f2a7d
--- /dev/null
+++ b/chromium/third_party/skia/third_party/libavif/BUILD.gn
@@ -0,0 +1,42 @@
+# Copyright 2022 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("../third_party.gni")
+
+third_party("libavif") {
+ deps = [
+ "//third_party/libgav1",
+ "//third_party/libyuv",
+ ]
+
+ public_include_dirs = [
+ ".",
+ "../externals/libavif/include",
+ ]
+
+ include_dirs = [ "../externals/libavif" ]
+
+ defines = [
+ "AVIF_CODEC_LIBGAV1=1",
+ "AVIF_LIBYUV_ENABLED=1",
+ ]
+
+ sources = [
+ "../externals/libavif/src/alpha.c",
+ "../externals/libavif/src/avif.c",
+ "../externals/libavif/src/codec_libgav1.c",
+ "../externals/libavif/src/colr.c",
+ "../externals/libavif/src/diag.c",
+ "../externals/libavif/src/io.c",
+ "../externals/libavif/src/mem.c",
+ "../externals/libavif/src/obu.c",
+ "../externals/libavif/src/rawdata.c",
+ "../externals/libavif/src/read.c",
+ "../externals/libavif/src/reformat.c",
+ "../externals/libavif/src/reformat_libyuv.c",
+ "../externals/libavif/src/scale.c",
+ "../externals/libavif/src/stream.c",
+ "../externals/libavif/src/utils.c",
+ ]
+}
diff --git a/chromium/third_party/skia/third_party/libgav1/BUILD.gn b/chromium/third_party/skia/third_party/libgav1/BUILD.gn
new file mode 100644
index 00000000000..f455e8bd23c
--- /dev/null
+++ b/chromium/third_party/skia/third_party/libgav1/BUILD.gn
@@ -0,0 +1,266 @@
+# Copyright 2022 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("../third_party.gni")
+
+third_party("libgav1") {
+ public_include_dirs = [
+ ".",
+ "../externals/libgav1/src",
+ ]
+
+ include_dirs = [ "../externals/libgav1" ]
+
+ defines = [
+ "LIBGAV1_MAX_BITDEPTH=12",
+ "LIBGAV1_THREADPOOL_USE_STD_MUTEX",
+ "LIBGAV1_ENABLE_LOGGING=0",
+ ]
+
+ sources = [
+ "../externals/libgav1/src/buffer_pool.cc",
+ "../externals/libgav1/src/buffer_pool.h",
+ "../externals/libgav1/src/decoder.cc",
+ "../externals/libgav1/src/decoder_impl.cc",
+ "../externals/libgav1/src/decoder_impl.h",
+ "../externals/libgav1/src/decoder_settings.cc",
+ "../externals/libgav1/src/decoder_state.h",
+ "../externals/libgav1/src/dsp/arm/average_blend_neon.cc",
+ "../externals/libgav1/src/dsp/arm/average_blend_neon.h",
+ "../externals/libgav1/src/dsp/arm/cdef_neon.cc",
+ "../externals/libgav1/src/dsp/arm/cdef_neon.h",
+ "../externals/libgav1/src/dsp/arm/common_neon.h",
+ "../externals/libgav1/src/dsp/arm/convolve_10bit_neon.cc",
+ "../externals/libgav1/src/dsp/arm/convolve_neon.cc",
+ "../externals/libgav1/src/dsp/arm/convolve_neon.h",
+ "../externals/libgav1/src/dsp/arm/distance_weighted_blend_neon.cc",
+ "../externals/libgav1/src/dsp/arm/distance_weighted_blend_neon.h",
+ "../externals/libgav1/src/dsp/arm/film_grain_neon.cc",
+ "../externals/libgav1/src/dsp/arm/film_grain_neon.h",
+ "../externals/libgav1/src/dsp/arm/intra_edge_neon.cc",
+ "../externals/libgav1/src/dsp/arm/intra_edge_neon.h",
+ "../externals/libgav1/src/dsp/arm/intrapred_cfl_neon.cc",
+ "../externals/libgav1/src/dsp/arm/intrapred_cfl_neon.h",
+ "../externals/libgav1/src/dsp/arm/intrapred_directional_neon.cc",
+ "../externals/libgav1/src/dsp/arm/intrapred_directional_neon.h",
+ "../externals/libgav1/src/dsp/arm/intrapred_filter_neon.cc",
+ "../externals/libgav1/src/dsp/arm/intrapred_filter_neon.h",
+ "../externals/libgav1/src/dsp/arm/intrapred_neon.cc",
+ "../externals/libgav1/src/dsp/arm/intrapred_neon.h",
+ "../externals/libgav1/src/dsp/arm/intrapred_smooth_neon.cc",
+ "../externals/libgav1/src/dsp/arm/intrapred_smooth_neon.h",
+ "../externals/libgav1/src/dsp/arm/inverse_transform_10bit_neon.cc",
+ "../externals/libgav1/src/dsp/arm/inverse_transform_neon.cc",
+ "../externals/libgav1/src/dsp/arm/inverse_transform_neon.h",
+ "../externals/libgav1/src/dsp/arm/loop_filter_10bit_neon.cc",
+ "../externals/libgav1/src/dsp/arm/loop_filter_neon.cc",
+ "../externals/libgav1/src/dsp/arm/loop_filter_neon.h",
+ "../externals/libgav1/src/dsp/arm/loop_restoration_10bit_neon.cc",
+ "../externals/libgav1/src/dsp/arm/loop_restoration_neon.cc",
+ "../externals/libgav1/src/dsp/arm/loop_restoration_neon.h",
+ "../externals/libgav1/src/dsp/arm/mask_blend_neon.cc",
+ "../externals/libgav1/src/dsp/arm/mask_blend_neon.h",
+ "../externals/libgav1/src/dsp/arm/motion_field_projection_neon.cc",
+ "../externals/libgav1/src/dsp/arm/motion_field_projection_neon.h",
+ "../externals/libgav1/src/dsp/arm/motion_vector_search_neon.cc",
+ "../externals/libgav1/src/dsp/arm/motion_vector_search_neon.h",
+ "../externals/libgav1/src/dsp/arm/obmc_neon.cc",
+ "../externals/libgav1/src/dsp/arm/obmc_neon.h",
+ "../externals/libgav1/src/dsp/arm/super_res_neon.cc",
+ "../externals/libgav1/src/dsp/arm/super_res_neon.h",
+ "../externals/libgav1/src/dsp/arm/warp_neon.cc",
+ "../externals/libgav1/src/dsp/arm/warp_neon.h",
+ "../externals/libgav1/src/dsp/arm/weight_mask_neon.cc",
+ "../externals/libgav1/src/dsp/arm/weight_mask_neon.h",
+ "../externals/libgav1/src/dsp/average_blend.cc",
+ "../externals/libgav1/src/dsp/average_blend.h",
+ "../externals/libgav1/src/dsp/cdef.cc",
+ "../externals/libgav1/src/dsp/cdef.h",
+ "../externals/libgav1/src/dsp/common.h",
+ "../externals/libgav1/src/dsp/constants.cc",
+ "../externals/libgav1/src/dsp/constants.h",
+ "../externals/libgav1/src/dsp/convolve.cc",
+ "../externals/libgav1/src/dsp/convolve.h",
+ "../externals/libgav1/src/dsp/distance_weighted_blend.cc",
+ "../externals/libgav1/src/dsp/distance_weighted_blend.h",
+ "../externals/libgav1/src/dsp/dsp.cc",
+ "../externals/libgav1/src/dsp/dsp.h",
+ "../externals/libgav1/src/dsp/film_grain.cc",
+ "../externals/libgav1/src/dsp/film_grain.h",
+ "../externals/libgav1/src/dsp/film_grain_common.h",
+ "../externals/libgav1/src/dsp/intra_edge.cc",
+ "../externals/libgav1/src/dsp/intra_edge.h",
+ "../externals/libgav1/src/dsp/intrapred.cc",
+ "../externals/libgav1/src/dsp/intrapred.h",
+ "../externals/libgav1/src/dsp/intrapred_cfl.cc",
+ "../externals/libgav1/src/dsp/intrapred_cfl.h",
+ "../externals/libgav1/src/dsp/intrapred_directional.cc",
+ "../externals/libgav1/src/dsp/intrapred_directional.h",
+ "../externals/libgav1/src/dsp/intrapred_filter.cc",
+ "../externals/libgav1/src/dsp/intrapred_filter.h",
+ "../externals/libgav1/src/dsp/intrapred_smooth.cc",
+ "../externals/libgav1/src/dsp/intrapred_smooth.h",
+ "../externals/libgav1/src/dsp/inverse_transform.cc",
+ "../externals/libgav1/src/dsp/inverse_transform.h",
+ "../externals/libgav1/src/dsp/loop_filter.cc",
+ "../externals/libgav1/src/dsp/loop_filter.h",
+ "../externals/libgav1/src/dsp/loop_restoration.cc",
+ "../externals/libgav1/src/dsp/loop_restoration.h",
+ "../externals/libgav1/src/dsp/mask_blend.cc",
+ "../externals/libgav1/src/dsp/mask_blend.h",
+ "../externals/libgav1/src/dsp/motion_field_projection.cc",
+ "../externals/libgav1/src/dsp/motion_field_projection.h",
+ "../externals/libgav1/src/dsp/motion_vector_search.cc",
+ "../externals/libgav1/src/dsp/motion_vector_search.h",
+ "../externals/libgav1/src/dsp/obmc.cc",
+ "../externals/libgav1/src/dsp/obmc.h",
+ "../externals/libgav1/src/dsp/super_res.cc",
+ "../externals/libgav1/src/dsp/super_res.h",
+ "../externals/libgav1/src/dsp/warp.cc",
+ "../externals/libgav1/src/dsp/warp.h",
+ "../externals/libgav1/src/dsp/weight_mask.cc",
+ "../externals/libgav1/src/dsp/weight_mask.h",
+ "../externals/libgav1/src/dsp/x86/average_blend_sse4.cc",
+ "../externals/libgav1/src/dsp/x86/average_blend_sse4.h",
+ "../externals/libgav1/src/dsp/x86/cdef_avx2.cc",
+ "../externals/libgav1/src/dsp/x86/cdef_avx2.h",
+ "../externals/libgav1/src/dsp/x86/cdef_sse4.cc",
+ "../externals/libgav1/src/dsp/x86/cdef_sse4.h",
+ "../externals/libgav1/src/dsp/x86/common_avx2.h",
+ "../externals/libgav1/src/dsp/x86/common_sse4.h",
+ "../externals/libgav1/src/dsp/x86/convolve_avx2.cc",
+ "../externals/libgav1/src/dsp/x86/convolve_avx2.h",
+ "../externals/libgav1/src/dsp/x86/convolve_sse4.cc",
+ "../externals/libgav1/src/dsp/x86/convolve_sse4.h",
+ "../externals/libgav1/src/dsp/x86/distance_weighted_blend_sse4.cc",
+ "../externals/libgav1/src/dsp/x86/distance_weighted_blend_sse4.h",
+ "../externals/libgav1/src/dsp/x86/film_grain_sse4.cc",
+ "../externals/libgav1/src/dsp/x86/film_grain_sse4.h",
+ "../externals/libgav1/src/dsp/x86/intra_edge_sse4.cc",
+ "../externals/libgav1/src/dsp/x86/intra_edge_sse4.h",
+ "../externals/libgav1/src/dsp/x86/intrapred_cfl_sse4.cc",
+ "../externals/libgav1/src/dsp/x86/intrapred_cfl_sse4.h",
+ "../externals/libgav1/src/dsp/x86/intrapred_directional_sse4.cc",
+ "../externals/libgav1/src/dsp/x86/intrapred_directional_sse4.h",
+ "../externals/libgav1/src/dsp/x86/intrapred_filter_sse4.cc",
+ "../externals/libgav1/src/dsp/x86/intrapred_filter_sse4.h",
+ "../externals/libgav1/src/dsp/x86/intrapred_smooth_sse4.cc",
+ "../externals/libgav1/src/dsp/x86/intrapred_smooth_sse4.h",
+ "../externals/libgav1/src/dsp/x86/intrapred_sse4.cc",
+ "../externals/libgav1/src/dsp/x86/intrapred_sse4.h",
+ "../externals/libgav1/src/dsp/x86/inverse_transform_sse4.cc",
+ "../externals/libgav1/src/dsp/x86/inverse_transform_sse4.h",
+ "../externals/libgav1/src/dsp/x86/loop_filter_sse4.cc",
+ "../externals/libgav1/src/dsp/x86/loop_filter_sse4.h",
+ "../externals/libgav1/src/dsp/x86/loop_restoration_10bit_avx2.cc",
+ "../externals/libgav1/src/dsp/x86/loop_restoration_10bit_sse4.cc",
+ "../externals/libgav1/src/dsp/x86/loop_restoration_avx2.cc",
+ "../externals/libgav1/src/dsp/x86/loop_restoration_avx2.h",
+ "../externals/libgav1/src/dsp/x86/loop_restoration_sse4.cc",
+ "../externals/libgav1/src/dsp/x86/loop_restoration_sse4.h",
+ "../externals/libgav1/src/dsp/x86/mask_blend_sse4.cc",
+ "../externals/libgav1/src/dsp/x86/mask_blend_sse4.h",
+ "../externals/libgav1/src/dsp/x86/motion_field_projection_sse4.cc",
+ "../externals/libgav1/src/dsp/x86/motion_field_projection_sse4.h",
+ "../externals/libgav1/src/dsp/x86/motion_vector_search_sse4.cc",
+ "../externals/libgav1/src/dsp/x86/motion_vector_search_sse4.h",
+ "../externals/libgav1/src/dsp/x86/obmc_sse4.cc",
+ "../externals/libgav1/src/dsp/x86/obmc_sse4.h",
+ "../externals/libgav1/src/dsp/x86/super_res_sse4.cc",
+ "../externals/libgav1/src/dsp/x86/super_res_sse4.h",
+ "../externals/libgav1/src/dsp/x86/transpose_sse4.h",
+ "../externals/libgav1/src/dsp/x86/warp_sse4.cc",
+ "../externals/libgav1/src/dsp/x86/warp_sse4.h",
+ "../externals/libgav1/src/dsp/x86/weight_mask_sse4.cc",
+ "../externals/libgav1/src/dsp/x86/weight_mask_sse4.h",
+ "../externals/libgav1/src/film_grain.cc",
+ "../externals/libgav1/src/film_grain.h",
+ "../externals/libgav1/src/frame_buffer.cc",
+ "../externals/libgav1/src/frame_buffer_utils.h",
+ "../externals/libgav1/src/frame_scratch_buffer.h",
+ "../externals/libgav1/src/gav1/decoder.h",
+ "../externals/libgav1/src/gav1/decoder_buffer.h",
+ "../externals/libgav1/src/gav1/decoder_settings.h",
+ "../externals/libgav1/src/gav1/frame_buffer.h",
+ "../externals/libgav1/src/gav1/status_code.h",
+ "../externals/libgav1/src/gav1/symbol_visibility.h",
+ "../externals/libgav1/src/gav1/version.h",
+ "../externals/libgav1/src/internal_frame_buffer_list.cc",
+ "../externals/libgav1/src/internal_frame_buffer_list.h",
+ "../externals/libgav1/src/loop_restoration_info.cc",
+ "../externals/libgav1/src/loop_restoration_info.h",
+ "../externals/libgav1/src/motion_vector.cc",
+ "../externals/libgav1/src/motion_vector.h",
+ "../externals/libgav1/src/obu_parser.cc",
+ "../externals/libgav1/src/obu_parser.h",
+ "../externals/libgav1/src/post_filter.h",
+ "../externals/libgav1/src/post_filter/cdef.cc",
+ "../externals/libgav1/src/post_filter/deblock.cc",
+ "../externals/libgav1/src/post_filter/loop_restoration.cc",
+ "../externals/libgav1/src/post_filter/post_filter.cc",
+ "../externals/libgav1/src/post_filter/super_res.cc",
+ "../externals/libgav1/src/prediction_mask.cc",
+ "../externals/libgav1/src/prediction_mask.h",
+ "../externals/libgav1/src/quantizer.cc",
+ "../externals/libgav1/src/quantizer.h",
+ "../externals/libgav1/src/reconstruction.cc",
+ "../externals/libgav1/src/reconstruction.h",
+ "../externals/libgav1/src/residual_buffer_pool.cc",
+ "../externals/libgav1/src/residual_buffer_pool.h",
+ "../externals/libgav1/src/status_code.cc",
+ "../externals/libgav1/src/symbol_decoder_context.cc",
+ "../externals/libgav1/src/symbol_decoder_context.h",
+ "../externals/libgav1/src/threading_strategy.cc",
+ "../externals/libgav1/src/threading_strategy.h",
+ "../externals/libgav1/src/tile.h",
+ "../externals/libgav1/src/tile/bitstream/mode_info.cc",
+ "../externals/libgav1/src/tile/bitstream/palette.cc",
+ "../externals/libgav1/src/tile/bitstream/partition.cc",
+ "../externals/libgav1/src/tile/bitstream/transform_size.cc",
+ "../externals/libgav1/src/tile/prediction.cc",
+ "../externals/libgav1/src/tile/tile.cc",
+ "../externals/libgav1/src/tile_scratch_buffer.cc",
+ "../externals/libgav1/src/tile_scratch_buffer.h",
+ "../externals/libgav1/src/utils/array_2d.h",
+ "../externals/libgav1/src/utils/bit_mask_set.h",
+ "../externals/libgav1/src/utils/bit_reader.cc",
+ "../externals/libgav1/src/utils/bit_reader.h",
+ "../externals/libgav1/src/utils/block_parameters_holder.cc",
+ "../externals/libgav1/src/utils/block_parameters_holder.h",
+ "../externals/libgav1/src/utils/blocking_counter.h",
+ "../externals/libgav1/src/utils/common.h",
+ "../externals/libgav1/src/utils/compiler_attributes.h",
+ "../externals/libgav1/src/utils/constants.cc",
+ "../externals/libgav1/src/utils/constants.h",
+ "../externals/libgav1/src/utils/cpu.cc",
+ "../externals/libgav1/src/utils/cpu.h",
+ "../externals/libgav1/src/utils/dynamic_buffer.h",
+ "../externals/libgav1/src/utils/entropy_decoder.cc",
+ "../externals/libgav1/src/utils/entropy_decoder.h",
+ "../externals/libgav1/src/utils/executor.cc",
+ "../externals/libgav1/src/utils/executor.h",
+ "../externals/libgav1/src/utils/logging.cc",
+ "../externals/libgav1/src/utils/logging.h",
+ "../externals/libgav1/src/utils/memory.h",
+ "../externals/libgav1/src/utils/queue.h",
+ "../externals/libgav1/src/utils/raw_bit_reader.cc",
+ "../externals/libgav1/src/utils/raw_bit_reader.h",
+ "../externals/libgav1/src/utils/reference_info.h",
+ "../externals/libgav1/src/utils/segmentation.cc",
+ "../externals/libgav1/src/utils/segmentation.h",
+ "../externals/libgav1/src/utils/segmentation_map.cc",
+ "../externals/libgav1/src/utils/segmentation_map.h",
+ "../externals/libgav1/src/utils/stack.h",
+ "../externals/libgav1/src/utils/threadpool.cc",
+ "../externals/libgav1/src/utils/threadpool.h",
+ "../externals/libgav1/src/utils/types.h",
+ "../externals/libgav1/src/utils/unbounded_queue.h",
+ "../externals/libgav1/src/utils/vector.h",
+ "../externals/libgav1/src/version.cc",
+ "../externals/libgav1/src/warp_prediction.cc",
+ "../externals/libgav1/src/warp_prediction.h",
+ "../externals/libgav1/src/yuv_buffer.cc",
+ "../externals/libgav1/src/yuv_buffer.h",
+ ]
+}
diff --git a/chromium/third_party/skia/third_party/libwebp/BUILD.gn b/chromium/third_party/skia/third_party/libwebp/BUILD.gn
index e9cb7ac989a..bf5ab131916 100644
--- a/chromium/third_party/skia/third_party/libwebp/BUILD.gn
+++ b/chromium/third_party/skia/third_party/libwebp/BUILD.gn
@@ -62,6 +62,12 @@ if (skia_use_system_libwebp) {
configs = [ ":libwebp_defines" ]
sources = [
+ "../externals/libwebp/sharpyuv/sharpyuv.c",
+ "../externals/libwebp/sharpyuv/sharpyuv_csp.c",
+ "../externals/libwebp/sharpyuv/sharpyuv_dsp.c",
+ "../externals/libwebp/sharpyuv/sharpyuv_gamma.c",
+ "../externals/libwebp/sharpyuv/sharpyuv_neon.c",
+ "../externals/libwebp/sharpyuv/sharpyuv_sse2.c",
"../externals/libwebp/src/dec/alpha_dec.c",
"../externals/libwebp/src/dec/buffer_dec.c",
"../externals/libwebp/src/dec/frame_dec.c",
diff --git a/chromium/third_party/skia/third_party/libyuv/BUILD.gn b/chromium/third_party/skia/third_party/libyuv/BUILD.gn
new file mode 100644
index 00000000000..b1589133644
--- /dev/null
+++ b/chromium/third_party/skia/third_party/libyuv/BUILD.gn
@@ -0,0 +1,71 @@
+# Copyright 2022 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("../third_party.gni")
+
+third_party("libyuv") {
+ public_include_dirs = [
+ ".",
+ "../externals/libyuv/include",
+ ]
+
+ include_dirs = [ "../externals/libyuv" ]
+
+ sources = [
+ "../externals/libyuv/source/compare.cc",
+ "../externals/libyuv/source/compare_common.cc",
+ "../externals/libyuv/source/compare_gcc.cc",
+ "../externals/libyuv/source/compare_mmi.cc",
+ "../externals/libyuv/source/compare_msa.cc",
+ "../externals/libyuv/source/compare_neon.cc",
+ "../externals/libyuv/source/compare_neon64.cc",
+ "../externals/libyuv/source/compare_win.cc",
+ "../externals/libyuv/source/convert.cc",
+ "../externals/libyuv/source/convert_argb.cc",
+ "../externals/libyuv/source/convert_from.cc",
+ "../externals/libyuv/source/convert_from_argb.cc",
+ "../externals/libyuv/source/convert_jpeg.cc",
+ "../externals/libyuv/source/convert_to_argb.cc",
+ "../externals/libyuv/source/convert_to_i420.cc",
+ "../externals/libyuv/source/cpu_id.cc",
+ "../externals/libyuv/source/mjpeg_decoder.cc",
+ "../externals/libyuv/source/mjpeg_validate.cc",
+ "../externals/libyuv/source/planar_functions.cc",
+ "../externals/libyuv/source/rotate.cc",
+ "../externals/libyuv/source/rotate_any.cc",
+ "../externals/libyuv/source/rotate_argb.cc",
+ "../externals/libyuv/source/rotate_common.cc",
+ "../externals/libyuv/source/rotate_gcc.cc",
+ "../externals/libyuv/source/rotate_lsx.cc",
+ "../externals/libyuv/source/rotate_mmi.cc",
+ "../externals/libyuv/source/rotate_msa.cc",
+ "../externals/libyuv/source/rotate_neon.cc",
+ "../externals/libyuv/source/rotate_neon64.cc",
+ "../externals/libyuv/source/rotate_win.cc",
+ "../externals/libyuv/source/row_any.cc",
+ "../externals/libyuv/source/row_common.cc",
+ "../externals/libyuv/source/row_gcc.cc",
+ "../externals/libyuv/source/row_lasx.cc",
+ "../externals/libyuv/source/row_lsx.cc",
+ "../externals/libyuv/source/row_mmi.cc",
+ "../externals/libyuv/source/row_msa.cc",
+ "../externals/libyuv/source/row_neon.cc",
+ "../externals/libyuv/source/row_neon64.cc",
+ "../externals/libyuv/source/row_win.cc",
+ "../externals/libyuv/source/scale.cc",
+ "../externals/libyuv/source/scale_any.cc",
+ "../externals/libyuv/source/scale_argb.cc",
+ "../externals/libyuv/source/scale_common.cc",
+ "../externals/libyuv/source/scale_gcc.cc",
+ "../externals/libyuv/source/scale_lsx.cc",
+ "../externals/libyuv/source/scale_mmi.cc",
+ "../externals/libyuv/source/scale_msa.cc",
+ "../externals/libyuv/source/scale_neon.cc",
+ "../externals/libyuv/source/scale_neon64.cc",
+ "../externals/libyuv/source/scale_rgb.cc",
+ "../externals/libyuv/source/scale_uv.cc",
+ "../externals/libyuv/source/scale_win.cc",
+ "../externals/libyuv/source/video_common.cc",
+ ]
+}
diff --git a/chromium/third_party/skia/third_party/perfetto/BUILD.gn b/chromium/third_party/skia/third_party/perfetto/BUILD.gn
new file mode 100644
index 00000000000..1610c85e8da
--- /dev/null
+++ b/chromium/third_party/skia/third_party/perfetto/BUILD.gn
@@ -0,0 +1,17 @@
+# Copyright 2022 Google LLC
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("../third_party.gni")
+
+third_party("perfetto") {
+ public_include_dirs = [
+ ".",
+ "../externals/perfetto/sdk",
+ ]
+ sources = [
+ "../externals/perfetto/sdk/perfetto.cc",
+ "../externals/perfetto/sdk/perfetto.h",
+ ]
+}
diff --git a/chromium/third_party/skia/third_party/rive/BUILD.gn b/chromium/third_party/skia/third_party/rive/BUILD.gn
index 1bdf28560bc..986f1ff0dd9 100644
--- a/chromium/third_party/skia/third_party/rive/BUILD.gn
+++ b/chromium/third_party/skia/third_party/rive/BUILD.gn
@@ -40,6 +40,8 @@ third_party("rive") {
"../externals/rive/src/animation/layer_state.cpp",
"../externals/rive/src/animation/linear_animation.cpp",
"../externals/rive/src/animation/linear_animation_instance.cpp",
+ "../externals/rive/src/animation/listener_action.cpp",
+ "../externals/rive/src/animation/listener_align_target.cpp",
"../externals/rive/src/animation/listener_bool_change.cpp",
"../externals/rive/src/animation/listener_input_change.cpp",
"../externals/rive/src/animation/listener_number_change.cpp",
@@ -55,7 +57,7 @@ third_party("rive") {
"../externals/rive/src/animation/state_machine_input_instance.cpp",
"../externals/rive/src/animation/state_machine_instance.cpp",
"../externals/rive/src/animation/state_machine_layer.cpp",
- "../externals/rive/src/animation/state_machine_listenable.cpp",
+ "../externals/rive/src/animation/state_machine_listener.cpp",
"../externals/rive/src/animation/state_transition.cpp",
"../externals/rive/src/animation/system_state_instance.cpp",
"../externals/rive/src/animation/transition_bool_condition.cpp",
@@ -111,12 +113,16 @@ third_party("rive") {
"../externals/rive/src/generated/animation/keyframe_double_base.cpp",
"../externals/rive/src/generated/animation/keyframe_id_base.cpp",
"../externals/rive/src/generated/animation/linear_animation_base.cpp",
+ "../externals/rive/src/generated/animation/listener_align_target_base.cpp",
"../externals/rive/src/generated/animation/listener_bool_change_base.cpp",
"../externals/rive/src/generated/animation/listener_number_change_base.cpp",
"../externals/rive/src/generated/animation/listener_trigger_change_base.cpp",
+ "../externals/rive/src/generated/animation/nested_bool_base.cpp",
+ "../externals/rive/src/generated/animation/nested_number_base.cpp",
"../externals/rive/src/generated/animation/nested_remap_animation_base.cpp",
"../externals/rive/src/generated/animation/nested_simple_animation_base.cpp",
"../externals/rive/src/generated/animation/nested_state_machine_base.cpp",
+ "../externals/rive/src/generated/animation/nested_trigger_base.cpp",
"../externals/rive/src/generated/animation/state_machine_base.cpp",
"../externals/rive/src/generated/animation/state_machine_bool_base.cpp",
"../externals/rive/src/generated/animation/state_machine_layer_base.cpp",
@@ -185,13 +191,16 @@ third_party("rive") {
"../externals/rive/src/importers/state_transition_importer.cpp",
"../externals/rive/src/layout.cpp",
"../externals/rive/src/math/aabb.cpp",
+ "../externals/rive/src/math/contour_measure.cpp",
"../externals/rive/src/math/hit_test.cpp",
"../externals/rive/src/math/mat2d.cpp",
"../externals/rive/src/math/raw_path.cpp",
+ "../externals/rive/src/math/raw_path_utils.cpp",
"../externals/rive/src/math/vec2d.cpp",
"../externals/rive/src/nested_artboard.cpp",
"../externals/rive/src/node.cpp",
"../externals/rive/src/renderer.cpp",
+ "../externals/rive/src/rive_counter.cpp",
"../externals/rive/src/scene.cpp",
"../externals/rive/src/shapes/clipping_shape.cpp",
"../externals/rive/src/shapes/cubic_asymmetric_vertex.cpp",
@@ -226,6 +235,7 @@ third_party("rive") {
"../externals/rive/src/shapes/straight_vertex.cpp",
"../externals/rive/src/shapes/triangle.cpp",
"../externals/rive/src/shapes/vertex.cpp",
+ "../externals/rive/src/text/line_breaker.cpp",
"../externals/rive/src/transform_component.cpp",
"../externals/rive/src/world_transform_component.cpp",
]
diff --git a/chromium/third_party/skia/third_party/skcms/BUILD.bazel b/chromium/third_party/skia/third_party/skcms/BUILD.bazel
index ba804e89f8f..69666adff23 100644
--- a/chromium/third_party/skia/third_party/skcms/BUILD.bazel
+++ b/chromium/third_party/skia/third_party/skcms/BUILD.bazel
@@ -1,25 +1,5 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy")
+load("//bazel:macros.bzl", "exports_files_legacy")
licenses(["notice"])
exports_files_legacy()
-
-cc_library(
- name = "skcms",
- srcs = [
- "skcms.cc",
- "skcms_internal.h",
- ],
- hdrs = [
- "//include/third_party/skcms:skcms.h",
- ],
- copts = [
- # We cannot use includes because this header is not in this directory.
- "-isystem include/third_party/skcms/",
- ],
- # This header does not compile on its own and is meant to be included from skcms.cc
- textual_hdrs = [
- "src/Transform_inl.h",
- ],
- visibility = ["//:__subpackages__"],
-)
diff --git a/chromium/third_party/skia/third_party/skcms/version.sha1 b/chromium/third_party/skia/third_party/skcms/version.sha1
index c4ef6193308..48fc8087983 100755
--- a/chromium/third_party/skia/third_party/skcms/version.sha1
+++ b/chromium/third_party/skia/third_party/skcms/version.sha1
@@ -1 +1 @@
-9c30a95f0f167ee1513e5a1ea6846b15a010385c
+c2639b59758f405a37877e228ef0716551dfb3db
diff --git a/chromium/third_party/skia/third_party/third_party.gni b/chromium/third_party/skia/third_party/third_party.gni
index 533f314480f..cbcd16cf389 100644
--- a/chromium/third_party/skia/third_party/third_party.gni
+++ b/chromium/third_party/skia/third_party/third_party.gni
@@ -72,9 +72,9 @@ template("third_party") {
configs = []
}
if (is_debug) {
- configs += [ "//gn/skia:optimize" ]
+ configs += [ "../../gn/skia:optimize" ]
}
- configs += [ "//gn/skia:recover_pointer_overflow" ]
+ configs += [ "../../gn/skia:recover_pointer_overflow" ]
# "*" clobbers the current scope; append to existing configs
forward_variables_from(invoker,
@@ -89,10 +89,13 @@ template("third_party") {
public_configs = [ ":" + target_name + "_public" ]
# Warnings are just noise if we're not maintaining the code.
+ if (!defined(cflags)) {
+ cflags = []
+ }
if (is_win) {
- cflags = [ "/w" ]
+ cflags += [ "/w" ]
} else {
- cflags = [ "-w" ]
+ cflags += [ "-w" ]
}
}
}
diff --git a/chromium/third_party/skia/third_party/vulkanmemoryallocator/BUILD.bazel b/chromium/third_party/skia/third_party/vulkanmemoryallocator/BUILD.bazel
index 19efe6fa1ef..c0c56caaf89 100644
--- a/chromium/third_party/skia/third_party/vulkanmemoryallocator/BUILD.bazel
+++ b/chromium/third_party/skia/third_party/vulkanmemoryallocator/BUILD.bazel
@@ -1,10 +1,10 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy")
+load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_library")
licenses(["notice"])
exports_files_legacy()
-cc_library(
+skia_cc_library(
name = "vulkanmemoryallocator",
srcs = [
"GrVulkanMemoryAllocator.cpp",
diff --git a/chromium/third_party/skia/toolchain/BUILD.bazel b/chromium/third_party/skia/toolchain/BUILD.bazel
index 9e99e0f6506..68b858f5be0 100644
--- a/chromium/third_party/skia/toolchain/BUILD.bazel
+++ b/chromium/third_party/skia/toolchain/BUILD.bazel
@@ -1,35 +1,70 @@
load("//bazel:macros.bzl", "exports_files_legacy")
-load("@rules_cc//cc:defs.bzl", "cc_toolchain", "cc_toolchain_suite")
+load("@rules_cc//cc:defs.bzl", "cc_toolchain")
load(":linux_amd64_toolchain_config.bzl", "provide_linux_amd64_toolchain_config")
-load(":mac_m1_toolchain_config.bzl", "provide_mac_m1_toolchain_config")
+load(":mac_toolchain_config.bzl", "provide_mac_toolchain_config")
licenses(["notice"])
exports_files_legacy()
-# https://bazel.build/reference/be/c-cpp#cc_toolchain_suite
-# cc_toolchain_suite will fetch deps for toolchains it will not use, which
-# is why we split up the suites by OS. When attempting to fetch "@clang_linux_amd64//:all_files",
-# a script compiled for linux to extract ar archives will break on other platforms.
-cc_toolchain_suite(
- name = "clang_suite_linux",
- toolchains = {
- # The key is target_cpu|compiler
- # compiler appears to be a string we can choose arbitrarily
- # https://bazel.build/reference/command-line-reference?hl=en#flag--compiler
- "k8|host_is_linux_amd64": ":linux_amd64_host",
- "x86_64|host_is_linux_amd64": ":linux_amd64_host",
- "k8": ":linux_amd64_host",
- },
+# https://bazel.build/docs/toolchains
+# https://bazel.build/reference/be/platform#toolchain
+toolchain(
+ name = "clang_linux_x64_toolchain",
+ # Where should we run this toolchain?
+ exec_compatible_with = [
+ "@platforms//os:linux",
+ "@platforms//cpu:x86_64",
+ # We do not want an extra constraint here related to the hermetic toolchain because
+ # we want the toolchain to run on any Linux x64 machine (and it certainly can).
+ ],
+ # What can this toolchain build?
+ target_compatible_with = [
+ "@platforms//os:linux",
+ "@platforms//cpu:x86_64",
+ # We want to be able to explicitly tell Bazel to use this toolchain, and not the
+ # default one on a user's machine or on the RBE worker. Thus we need an extra constraint
+ # that we can use to differentiate the "stock" C++ toolchain from our hermetic one and
+ # force that use by specifying the target platform.
+ "//bazel/platform:use_hermetic_toolchain",
+ ],
+ toolchain = ":linux_amd64_host",
+ # https://github.com/bazelbuild/rules_cc/blob/8bb0eb5c5ccd96b91753bb112096bb6993d16d13/cc/BUILD#L32-L36
+ toolchain_type = "@rules_cc//cc:toolchain_type",
+)
+
+# Our one mac toolchain can run on either Intel Macs or M1 Macs, however Bazel does not allow you to specify
+# more than one cpu type in exec_compatible_with. Thus, we list the same toolchain twice.
+toolchain(
+ name = "clang_mac_x64_toolchain",
+ exec_compatible_with = [
+ "@platforms//os:macos",
+ "@platforms//cpu:x86_64",
+ ],
+ target_compatible_with = [
+ "@platforms//os:macos",
+ "@platforms//cpu:x86_64",
+ "//bazel/platform:use_hermetic_toolchain",
+ ],
+ toolchain = ":mac_host",
+ # https://github.com/bazelbuild/rules_cc/blob/8bb0eb5c5ccd96b91753bb112096bb6993d16d13/cc/BUILD#L32-L36
+ toolchain_type = "@rules_cc//cc:toolchain_type",
)
-cc_toolchain_suite(
- name = "clang_suite_mac",
- toolchains = {
- "arm64|host_is_mac_m1": ":mac_m1_host",
- "darwin|host_is_mac_m1": ":mac_m1_host",
- "darwin_arm64|host_is_mac_m1": ":mac_m1_host",
- },
+toolchain(
+ name = "clang_mac_arm64_toolchain",
+ exec_compatible_with = [
+ "@platforms//os:macos",
+ "@platforms//cpu:arm64",
+ ],
+ target_compatible_with = [
+ "@platforms//os:macos",
+ "@platforms//cpu:arm64",
+ "//bazel/platform:use_hermetic_toolchain",
+ ],
+ toolchain = ":mac_host",
+ # https://github.com/bazelbuild/rules_cc/blob/8bb0eb5c5ccd96b91753bb112096bb6993d16d13/cc/BUILD#L32-L36
+ toolchain_type = "@rules_cc//cc:toolchain_type",
)
filegroup(name = "not_implemented")
@@ -61,12 +96,26 @@ filegroup(
)
filegroup(
- name = "all_mac_m1_files",
+ name = "archive_mac_files",
srcs = [
"mac_trampolines/ar_trampoline_mac.sh",
+ "@clang_mac//:archive_files",
+ ],
+)
+
+filegroup(
+ name = "compile_mac_files",
+ srcs = [
+ "mac_trampolines/clang_trampoline_mac.sh",
+ "@clang_mac//:compile_files",
+ ],
+)
+
+filegroup(
+ name = "link_mac_files",
+ srcs = [
"mac_trampolines/clang_trampoline_mac.sh",
- "mac_trampolines/lld_trampoline_mac.sh",
- "@clang_mac_m1//:all_files",
+ "@clang_mac//:link_files",
],
)
@@ -74,8 +123,8 @@ provide_linux_amd64_toolchain_config(
name = "linux_amd64_toolchain_config",
)
-provide_mac_m1_toolchain_config(
- name = "mac_m1_toolchain_config",
+provide_mac_toolchain_config(
+ name = "mac_toolchain_config",
)
# https://bazel.build/reference/be/c-cpp#cc_toolchain
@@ -93,14 +142,14 @@ cc_toolchain(
)
cc_toolchain(
- name = "mac_m1_host",
- all_files = ":all_mac_m1_files",
- ar_files = ":all_mac_m1_files",
- compiler_files = ":all_mac_m1_files",
+ name = "mac_host",
+ all_files = ":compile_mac_files", # Apparently also used to compile objc code
+ ar_files = ":archive_mac_files",
+ compiler_files = ":compile_mac_files",
dwp_files = ":not_implemented",
- linker_files = ":all_mac_m1_files",
+ linker_files = ":link_mac_files",
objcopy_files = ":not_implemented",
strip_files = ":not_implemented",
supports_param_files = False,
- toolchain_config = ":mac_m1_toolchain_config",
+ toolchain_config = ":mac_toolchain_config",
)
diff --git a/chromium/third_party/skia/toolchain/download_linux_amd64_toolchain.bzl b/chromium/third_party/skia/toolchain/download_linux_amd64_toolchain.bzl
index 0b8c9241414..b4358fc2b94 100644
--- a/chromium/third_party/skia/toolchain/download_linux_amd64_toolchain.bzl
+++ b/chromium/third_party/skia/toolchain/download_linux_amd64_toolchain.bzl
@@ -13,23 +13,13 @@ resolver) and extracted to
which will act as our sysroot.
"""
+load("//toolchain:utils.bzl", "gcs_mirror_url")
+
# From https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-20.04.tar.xz.sha256
clang_prefix = "clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-20.04/"
clang_sha256 = "2c2fb857af97f41a5032e9ecadf7f78d3eff389a5cd3c9ec620d24f134ceb3c8"
clang_url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-20.04.tar.xz"
-# Files are expected to be in the mirror location named after their sha256 hash. The files should
-# still have their file extension, as some of the Starlark functions sniff the file extension
-# (e.g. download_and_extract). See //bazel/gcs_mirror for an automated way to update this mirror.
-mirror_prefix = "https://storage.googleapis.com/skia-world-readable/bazel/"
-
-# Set this to True to only use the files from the mirror host. This can be used to test the data
-# in the mirrors is not corrupt and publicly accessible.
-# If testing this, you need to delete the download cache, which defaults to
-# ~/.cache/bazel/_bazel_$USER/cache/repos/v1/
-# https://bazel.build/docs/build#repository-cache
-force_test_of_mirrors = False
-
debs_to_install = [
# These three comprise glibc. libc6 has the shared libraries, like libc itself, the math library
# (libm), etc. linux-libc-dev has the header files specific to linux. libc6-dev has the libc
@@ -141,30 +131,34 @@ debs_to_install = [
},
{
# This is a requirement of libllvm13
- # https://packages.debian.org/sid/libz3-4
+ # https://packages.debian.org/sid/libz3-4/download
"sha256": "b415b863678625dee3f3c75bd48b1b9e3b6e11279ebec337904d7f09630d107f",
"url": "https://ftp.debian.org/debian/pool/main/z/z3/libz3-4_4.8.12-1+b1_amd64.deb",
},
+ {
+ # https://packages.debian.org/bullseye/libfontconfig-dev/download
+ "sha256": "7655d4238ee7e6ced13501006d20986cbf9ff08454a4e502d5aa399f83e28876",
+ "url": "https://ftp.debian.org/debian/pool/main/f/fontconfig/libfontconfig-dev_2.13.1-4.2_amd64.deb",
+ },
+ {
+ # https://packages.debian.org/bullseye/libglu1-mesa-dev/download
+ "sha256": "5df6abeedb1f6986cec4b17810ef1a2773a5cd3291544abacc2bf602a9520893",
+ "url": "https://ftp.debian.org/debian/pool/main/libg/libglu/libglu1-mesa-dev_9.0.1-1_amd64.deb",
+ },
]
def _download_and_extract_deb(ctx, deb, sha256, prefix, output = ""):
"""Downloads a debian file and extracts the data into the provided output directory"""
- # https://bazel.build/rules/lib/repository_ctx#download
- # .deb files are also .ar archives.
- ctx.download(
- url = _mirror([deb, mirror_prefix + sha256 + ".deb"]),
- output = "tmp/deb.ar",
+ # https://bazel.build/rules/lib/repository_ctx#download_and_extract
+ # A .deb file has a data.tar.xz and a control.tar.xz, but the important contents
+ # (i.e. the headers or libs) are in the data.tar.xz
+ ctx.download_and_extract(
+ url = gcs_mirror_url(deb, sha256),
+ output = "tmp",
sha256 = sha256,
)
- # https://bazel.build/rules/lib/repository_ctx#execute
- # This uses the statically built binary from the infra repo
- res = ctx.execute(["bin/open_ar", "--input", "tmp/deb.ar", "--output_dir", "tmp"], quiet = False)
- if res.return_code != 0:
- # Run it again to display the error
- fail("Could not open deb.ar from " + deb)
-
# https://bazel.build/rules/lib/repository_ctx#extract
ctx.extract(
archive = "tmp/data.tar.xz",
@@ -176,20 +170,10 @@ def _download_and_extract_deb(ctx, deb, sha256, prefix, output = ""):
ctx.delete("tmp")
def _download_linux_amd64_toolchain_impl(ctx):
- # Workaround for Bazel not yet supporting .ar files
- # See https://skia-review.googlesource.com/c/buildbot/+/524764
- # https://bazel.build/rules/lib/repository_ctx#download
- ctx.download(
- url = mirror_prefix + "open_ar_v1",
- sha256 = "55bb74d9ce5d6fa06e390b2319a410ec595dbb591a3ce650da356efe970f86d3",
- executable = True,
- output = "bin/open_ar",
- )
-
# Download the clang toolchain (the extraction can take a while)
# https://bazel.build/rules/lib/repository_ctx#download_and_extract
ctx.download_and_extract(
- url = _mirror([clang_url, mirror_prefix + clang_sha256 + ".tar.xz"]),
+ url = gcs_mirror_url(clang_url, clang_sha256),
output = "",
stripPrefix = clang_prefix,
sha256 = clang_sha256,
@@ -214,6 +198,8 @@ def _download_linux_amd64_toolchain_impl(ctx):
ctx.file(
"BUILD.bazel",
content = """
+# DO NOT EDIT THIS BAZEL FILE DIRECTLY
+# Generated from ctx.file action in download_linux_amd64_toolchain.bzl
filegroup(
name = "archive_files",
srcs = [
@@ -263,13 +249,6 @@ filegroup(
executable = False,
)
-# If force_test_of_mirrors is set, return a list containing only the second item. This assumes
-# that the given list will have a primary source and a mirror source (precisely two items).
-def _mirror(arr):
- if force_test_of_mirrors:
- return [arr[1]]
- return arr
-
# https://bazel.build/rules/repository_rules
download_linux_amd64_toolchain = repository_rule(
implementation = _download_linux_amd64_toolchain_impl,
diff --git a/chromium/third_party/skia/toolchain/download_mac_m1_toolchain.bzl b/chromium/third_party/skia/toolchain/download_mac_m1_toolchain.bzl
deleted file mode 100644
index 2b61b22180f..00000000000
--- a/chromium/third_party/skia/toolchain/download_mac_m1_toolchain.bzl
+++ /dev/null
@@ -1,79 +0,0 @@
-"""
-This file assembles a toolchain for a Mac M1 host using the Clang Compiler and glibc.
-
-It downloads the necessary headers, executables, and pre-compiled static/shared libraries to
-the external subfolder of the Bazel cache (the same place third party deps are downloaded with
-http_archive or similar functions in WORKSPACE.bazel). These will be able to be used via our
-custom c++ toolchain configuration (see //toolchain/mac_m1_toolchain_config.bzl)
-
-Clang files are downloaded in tars while the rest of the required files are found in the user's local
-Xcode directory (with us acting as the dependency resolver) and extracted (or symlinked) to
- [outputRoot (aka Bazel cache)]/[outputUserRoot]/[outputBase]/external/clang_mac_m1
- (See https://bazel.build/docs/output_directories#layout-diagram)
-which will act as our sysroot.
-"""
-
-# From https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-apple-darwin.tar.xz
-clang_prefix = "clang+llvm-13.0.0-x86_64-apple-darwin"
-clang_sha256 = "d051234eca1db1f5e4bc08c64937c879c7098900f7a0370f3ceb7544816a8b09"
-clang_url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-apple-darwin.tar.xz"
-
-def _download_mac_m1_toolchain_impl(ctx):
- # Download the clang toolchain (the extraction can take a while)
- # https://bazel.build/rules/lib/repository_ctx#download_and_extract
- ctx.download_and_extract(
- url = clang_url,
- output = "",
- stripPrefix = clang_prefix,
- sha256 = clang_sha256,
- )
-
- # Some std library headers use #include_next to include system specific headers, and
- # some skia source files require Xcode headers when compiling, (see SkTypes.h and look
- # for TargetedConditionals.h)) All of these are located in Xcode, stopping the Mac
- # builds from being purely hermetic.
- # For now, we can grab the user's Xcode path by calling xcode-select and create a symlink in
- # our toolchain directory to refer to during compilation.
-
- # https://developer.apple.com/library/archive/technotes/tn2339/_index.html
- res = ctx.execute(["xcode-select", "-p"])
- # https://bazel.build/rules/lib/actions#symlink
- ctx.symlink(
- # from =
- res.stdout.rstrip() + "/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr",
- # to =
- "./symlinks/xcode/MacSDK/usr",
- )
-
- # Create a BUILD.bazel file that makes all the files in this subfolder
- # except for those in the share directory. They are not necessary for building
- # and create a symlink looping error when resolving the filegroup.
- # available for use in rules, i.e. in the toolchain declaration.
- # https://bazel.build/rules/lib/repository_ctx#file
- ctx.file(
- "BUILD.bazel",
- content = """
-# DO NOT EDIT THIS BAZEL FILE DIRECTLY
-# Generated from ctx.file action in download_mac_m1_toolchain.bzl
-filegroup(
- name = "all_files",
- srcs = glob(
- ["**"],
- exclude = [
- "symlinks/xcode/MacSDK/usr/share/**"
- ]),
- visibility = ["//visibility:public"]
-)
-""",
- executable = False,
- )
-
-# https://bazel.build/rules/repository_rules
-download_mac_m1_toolchain = repository_rule(
- implementation = _download_mac_m1_toolchain_impl,
- attrs = {},
- doc = "Downloads clang, and all supporting headers, executables, " +
- "and shared libraries required to build Skia on a Mac M1 host." +
- "Assumes you have xcode located on your device and have" +
- "xcode-select in your $PATH.",
-)
diff --git a/chromium/third_party/skia/toolchain/download_mac_toolchain.bzl b/chromium/third_party/skia/toolchain/download_mac_toolchain.bzl
new file mode 100644
index 00000000000..be855e333dc
--- /dev/null
+++ b/chromium/third_party/skia/toolchain/download_mac_toolchain.bzl
@@ -0,0 +1,140 @@
+"""
+This file assembles a toolchain for a Mac host (either M1 or Intel) using the Clang Compiler
+and a locally-installed XCode.
+
+It downloads the necessary executables and creates symlinks in the external subfolder of the Bazel
+cache (the same place third party deps are downloaded with http_archive or similar functions in
+WORKSPACE.bazel). These will be able to be used via our
+custom c++ toolchain configuration (see //toolchain/mac_toolchain_config.bzl)
+
+The destination folder for these files and symlinks are:
+ [outputRoot (aka Bazel cache)]/[outputUserRoot]/[outputBase]/external/clang_mac
+ (See https://bazel.build/docs/output_directories#layout-diagram)
+"""
+
+load("//toolchain:utils.bzl", "gcs_mirror_url")
+
+# From https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-apple-darwin.tar.xz
+# When updating this, don't forget to use //bazel/gcs_mirror to upload a new version.
+# go run bazel/gcs_mirror/gcs_mirror.go --url [clang_url] --sha256 [clang_sha256]
+clang_prefix = "clang+llvm-13.0.0-x86_64-apple-darwin"
+clang_sha256 = "d051234eca1db1f5e4bc08c64937c879c7098900f7a0370f3ceb7544816a8b09"
+clang_url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-apple-darwin.tar.xz"
+
+def _download_mac_toolchain_impl(ctx):
+ # Download the clang toolchain (the extraction can take a while)
+ # https://bazel.build/rules/lib/repository_ctx#download_and_extract
+ ctx.download_and_extract(
+ url = gcs_mirror_url(clang_url, clang_sha256),
+ output = "",
+ stripPrefix = clang_prefix,
+ sha256 = clang_sha256,
+ )
+
+ # Some std library headers use #include_next to include system specific headers, and
+ # some skia source files require Xcode headers when compiling, (see SkTypes.h and look
+ # for TargetedConditionals.h)) All of these are located in Xcode, stopping the Mac
+ # builds from being purely hermetic.
+ # For now, we can grab the user's Xcode path by calling xcode-select and create a symlink in
+ # our toolchain directory to refer to during compilation.
+
+ # https://developer.apple.com/library/archive/technotes/tn2339/_index.html
+ res = ctx.execute(["xcode-select", "-p"])
+
+ # https://bazel.build/rules/lib/actions#symlink
+ ctx.symlink(
+ # from =
+ res.stdout.rstrip() + "/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr",
+ # to =
+ "./symlinks/xcode/MacSDK/usr",
+ )
+ ctx.symlink(
+ # from =
+ res.stdout.rstrip() + "/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks",
+ # to =
+ "./symlinks/xcode/MacSDK/Frameworks",
+ )
+
+ # Create a BUILD.bazel file that makes the files necessary for compiling,
+ # linking and creating archive files visible to Bazel.
+ # The smaller the globs are, the more performant the sandboxed builds will be.
+ # Additionally, globs that are too wide can pick up infinite symlink loops,
+ # and be difficult to quash: https://github.com/bazelbuild/bazel/issues/13950
+ # https://bazel.build/rules/lib/repository_ctx#file
+ #
+ ctx.file(
+ "BUILD.bazel",
+ content = """
+# DO NOT EDIT THIS BAZEL FILE DIRECTLY
+# Generated from ctx.file action in download_mac_toolchain.bzl
+filegroup(
+ name = "archive_files",
+ srcs = [
+ "bin/llvm-ar",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "compile_files",
+ srcs = [
+ "bin/clang",
+ ] + glob(
+ include = [
+ "include/c++/v1/**",
+ "lib/clang/13.0.0/**",
+ "symlinks/xcode/MacSDK/Frameworks/AppKit.Framework/**",
+ "symlinks/xcode/MacSDK/Frameworks/ApplicationServices.Framework/**",
+ "symlinks/xcode/MacSDK/Frameworks/Carbon.Framework/**",
+ "symlinks/xcode/MacSDK/Frameworks/CFNetwork.Framework/**",
+ "symlinks/xcode/MacSDK/Frameworks/CloudKit.Framework/**",
+ "symlinks/xcode/MacSDK/Frameworks/Cocoa.Framework/**",
+ "symlinks/xcode/MacSDK/Frameworks/ColorSync.Framework/**",
+ "symlinks/xcode/MacSDK/Frameworks/CoreData.Framework/**",
+ "symlinks/xcode/MacSDK/Frameworks/CoreFoundation.Framework/**",
+ "symlinks/xcode/MacSDK/Frameworks/CoreGraphics.Framework/**",
+ "symlinks/xcode/MacSDK/Frameworks/CoreImage.Framework/**",
+ "symlinks/xcode/MacSDK/Frameworks/CoreLocation.Framework/**",
+ "symlinks/xcode/MacSDK/Frameworks/CoreServices.Framework/**",
+ "symlinks/xcode/MacSDK/Frameworks/CoreText.Framework/**",
+ "symlinks/xcode/MacSDK/Frameworks/CoreVideo.Framework/**",
+ "symlinks/xcode/MacSDK/Frameworks/DiskArbitration.Framework/**",
+ "symlinks/xcode/MacSDK/Frameworks/Foundation.Framework/**",
+ "symlinks/xcode/MacSDK/Frameworks/ImageIO.Framework/**",
+ "symlinks/xcode/MacSDK/Frameworks/IOKit.Framework/**",
+ "symlinks/xcode/MacSDK/Frameworks/IOSurface.Framework/**",
+ "symlinks/xcode/MacSDK/Frameworks/Metal.Framework/**",
+ "symlinks/xcode/MacSDK/Frameworks/OpenGL.Framework/**",
+ "symlinks/xcode/MacSDK/Frameworks/QuartzCore.Framework/**",
+ "symlinks/xcode/MacSDK/Frameworks/Security.Framework/**",
+ "symlinks/xcode/MacSDK/usr/include/**",
+ ],
+ allow_empty = False,
+ ),
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "link_files",
+ srcs = [
+ "bin/clang",
+ "bin/ld.lld",
+ "bin/lld",
+ "lib/libc++.a",
+ "lib/libc++abi.a",
+ "lib/libunwind.a",
+ ],
+ visibility = ["//visibility:public"],
+)
+""",
+ executable = False,
+ )
+
+# https://bazel.build/rules/repository_rules
+download_mac_toolchain = repository_rule(
+ implementation = _download_mac_toolchain_impl,
+ attrs = {},
+ doc = "Downloads clang to build Skia with." +
+ "Assumes you have xcode located on your device and have" +
+ "xcode-select in your $PATH.",
+)
diff --git a/chromium/third_party/skia/toolchain/download_toolchains.bzl b/chromium/third_party/skia/toolchain/download_toolchains.bzl
index 436ef89f23c..bde81ed87b3 100644
--- a/chromium/third_party/skia/toolchain/download_toolchains.bzl
+++ b/chromium/third_party/skia/toolchain/download_toolchains.bzl
@@ -3,7 +3,7 @@ This file exports the various toolchains for the hosts that we support building
Supported:
- Linux amd64
- - Mac M1
+ - Mac (one toolchain for both M1 and Intel CPUs)
Planned:
- Windows amd64
@@ -11,14 +11,14 @@ Planned:
"""
load(":download_linux_amd64_toolchain.bzl", "download_linux_amd64_toolchain")
-load(":download_mac_m1_toolchain.bzl", "download_mac_m1_toolchain")
+load(":download_mac_toolchain.bzl", "download_mac_toolchain")
# This key in this dictionary (and thus the name passed into the rule) controls what the subfolder
# will be called in the external directory. It must match what we use in the appropriate
# toolchain_config.bzl file or it will not be able to locate the sysroot to build with.
name_toolchain = {
"clang_linux_amd64": download_linux_amd64_toolchain,
- "clang_mac_m1": download_mac_m1_toolchain,
+ "clang_mac": download_mac_toolchain,
}
def download_toolchains_for_skia(*args):
diff --git a/chromium/third_party/skia/toolchain/linux_amd64_toolchain_config.bzl b/chromium/third_party/skia/toolchain/linux_amd64_toolchain_config.bzl
index e5a39bd8b71..fd66af03607 100644
--- a/chromium/third_party/skia/toolchain/linux_amd64_toolchain_config.bzl
+++ b/chromium/third_party/skia/toolchain/linux_amd64_toolchain_config.bzl
@@ -34,14 +34,12 @@ def _linux_amd64_toolchain_info(ctx):
features += _make_diagnostic_flags()
features += _make_iwyu_flags()
- # https://docs.bazel.build/versions/main/skylark/lib/cc_common.html#create_cc_toolchain_config_info
+ # https://bazel.build/rules/lib/cc_common#create_cc_toolchain_config_info
# Note, this rule is defined in Java code, not Starlark
# https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/starlarkbuildapi/cpp/CcModuleApi.java
return cc_common.create_cc_toolchain_config_info(
ctx = ctx,
features = features,
- abi_libc_version = "unknown",
- abi_version = "unknown",
action_configs = action_configs,
# This is important because the linker will complain if the libc shared libraries are not
# under this directory. Because we extract the libc libraries to
@@ -51,13 +49,12 @@ def _linux_amd64_toolchain_info(ctx):
# is just a text file that refers to "/lib/x86_64-linux-gnu/libc.so.6" and
# "/lib64/ld-linux-x86-64.so.2" which will use the sysroot as the root).
builtin_sysroot = EXTERNAL_TOOLCHAIN,
- compiler = "clang",
- host_system_name = "local",
- target_cpu = "k8",
- # It is unclear if target_libc matters.
- target_libc = "glibc-2.31",
- target_system_name = "local",
- toolchain_identifier = "clang-toolchain",
+ # These are required, but do nothing
+ compiler = "",
+ target_cpu = "",
+ target_libc = "",
+ target_system_name = "",
+ toolchain_identifier = "",
)
provide_linux_amd64_toolchain_config = rule(
@@ -196,7 +193,15 @@ def _make_action_configs():
return action_configs
def _make_default_flags():
- """Here we define the flags for certain actions that are always applied."""
+ """Here we define the flags for certain actions that are always applied.
+
+ For any flag that might be conditionally applied, it should be defined in //bazel/copts.bzl.
+
+ Flags that are set here will be unconditionally applied to everything we compile with
+ this toolchain, even third_party deps.
+ """
+
+ # Note: These values must be kept in sync with those defined in cmake_exporter.go.
cxx_compile_includes = flag_set(
actions = [
ACTION_NAMES.c_compile,
@@ -225,7 +230,7 @@ def _make_default_flags():
],
)
- cpp_compile_includes = flag_set(
+ cpp_compile_flags = flag_set(
actions = [
ACTION_NAMES.cpp_compile,
],
@@ -233,7 +238,6 @@ def _make_default_flags():
flag_group(
flags = [
"-std=c++17",
- "-Wno-psabi", # noisy
],
),
],
@@ -267,7 +271,7 @@ def _make_default_flags():
enabled = True,
flag_sets = [
cxx_compile_includes,
- cpp_compile_includes,
+ cpp_compile_flags,
link_exe_flags,
],
)]
diff --git a/chromium/third_party/skia/toolchain/linux_trampolines/IWYU_mapping.imp b/chromium/third_party/skia/toolchain/linux_trampolines/IWYU_mapping.imp
index dbd33ed02c0..a84bedff61c 100644
--- a/chromium/third_party/skia/toolchain/linux_trampolines/IWYU_mapping.imp
+++ b/chromium/third_party/skia/toolchain/linux_trampolines/IWYU_mapping.imp
@@ -3,6 +3,7 @@
{ include: ["<__algorithm/any_of.h>", "private", "<algorithm>", "public"] },
{ include: ["<__algorithm/copy.h>", "private", "<algorithm>", "public"] },
{ include: ["<__algorithm/copy_n.h>", "private", "<algorithm>", "public"] },
+ { include: ["<__algorithm/count.h>", "private", "<algorithm>", "public"] },
{ include: ["<__algorithm/equal_range.h>", "private", "<algorithm>", "public"] },
{ include: ["<__algorithm/lower_bound.h>", "private", "<algorithm>", "public"] },
{ include: ["<__algorithm/max.h>", "private", "<algorithm>", "public"] },
@@ -12,16 +13,48 @@
{ include: ["<__algorithm/stable_sort.h>", "private", "<algorithm>", "public"] },
{ include: ["<__algorithm/upper_bound.h>", "private", "<algorithm>", "public"] },
+ { symbol: ["INT32_MAX", "public", "<climits>", "public"]},
+
{ symbol: ["abs", "public", "<cmath>", "public"]},
- { symbol: ["uint8_t", "public", "<cstdint>", "public"]},
+ # The first of these is the preferred include, but the others are acceptable.
+ { symbol: ["size_t", "public", "<cstddef>", "public"]},
+ { symbol: ["size_t", "public", "<cstdio>", "public"]},
+ { symbol: ["size_t", "public", "<cstdlib>", "public"]},
+ { symbol: ["size_t", "public", "<cstring>", "public"]},
+ { symbol: ["size_t", "public", "<ctime>", "public"]},
+ { symbol: ["size_t", "public", "<cuchar>", "public"]},
+ { symbol: ["size_t", "public", "<cwchar>", "public"]},
+
{ symbol: ["int8_t", "public", "<cstdint>", "public"]},
+ { symbol: ["int16_t", "public", "<cstdint>", "public"]},
+ { symbol: ["int32_t", "public", "<cstdint>", "public"]},
+ { symbol: ["int64_t", "public", "<cstdint>", "public"]},
+ { symbol: ["uint8_t", "public", "<cstdint>", "public"]},
+ { symbol: ["uint16_t", "public", "<cstdint>", "public"]},
+ { symbol: ["uint32_t", "public", "<cstdint>", "public"]},
+ { symbol: ["uint64_t", "public", "<cstdint>", "public"]},
{ include: ["<__functional/function.h>", "private", "<functional>", "public"] },
{ include: ["<__iterator/access.h>", "private", "<iterator>", "public"] },
{ include: ["<__iterator/distance.h>", "private", "<iterator>", "public"] },
+ # The first of these is the preferred include, but the others are acceptable.
+ { include: ["<__iterator/size.h>", "private", "<array>", "public"] },
+ { include: ["<__iterator/size.h>", "private", "<deque>", "public"] },
+ { include: ["<__iterator/size.h>", "private", "<forward_list>", "public"] },
+ { include: ["<__iterator/size.h>", "private", "<iterator>", "public"] },
+ { include: ["<__iterator/size.h>", "private", "<list>", "public"] },
+ { include: ["<__iterator/size.h>", "private", "<map>", "public"] },
+ { include: ["<__iterator/size.h>", "private", "<regex>", "public"] },
+ { include: ["<__iterator/size.h>", "private", "<set>", "public"] },
+ { include: ["<__iterator/size.h>", "private", "<string>", "public"] },
+ { include: ["<__iterator/size.h>", "private", "<string_view>", "public"] },
+ { include: ["<__iterator/size.h>", "private", "<unordered_map>", "public"] },
+ { include: ["<__iterator/size.h>", "private", "<unordered_set>", "public"] },
+ { include: ["<__iterator/size.h>", "private", "<vector>", "public"] },
+
{ include: ["<__locale>", "private", "<locale>", "public"] },
{ include: ["<__memory/shared_ptr.h>", "private", "<memory>", "public"] },
@@ -29,17 +62,88 @@
{ include: ["<__tree>", "private", "<set>", "public"] },
+ { symbol: ["std::istringstream", "public", "<sstream>", "public"] },
+ { symbol: ["std::ostringstream", "public", "<sstream>", "public"] },
+ { symbol: ["std::stringstream", "public", "<sstream>", "public"] },
+ { symbol: ["std::stringbuf", "public", "<sstream>", "public"] },
+ { symbol: ["std::basic_istringstream", "public", "<sstream>", "public"] },
+ { symbol: ["std::basic_ostringstream", "public", "<sstream>", "public"] },
+ { symbol: ["std::basic_stringstream", "public", "<sstream>", "public"] },
+ { symbol: ["std::basic_stringbuf", "public", "<sstream>", "public"] },
+
{ symbol: ["va_list", "public", "<stdarg.h>", "public"] },
- { include: ["<string.h>", "public", "<string>", "public"] },
{ symbol: ["std::string", "public", "<string>", "public"] },
{ include: ["<__hash_table>", "private", "<unordered_map>", "public"] },
+ { include: ["<__utility/declval.h>", "private", "<utility>", "public"] },
{ include: ["<__utility/forward.h>", "private", "<utility>", "public"] },
{ include: ["<__utility/move.h>", "private", "<utility>", "public"] },
{ include: ["<__utility/swap.h>", "private", "<utility>", "public"] },
{ include: ["<__utility/pair.h>", "private", "<utility>", "public"] },
{ symbol: ["std::__bit_reference", "public", "<vector>", "public"] },
+
+ { include: ["<scripts/pnglibconf.h.prebuilt>", "private", "<pngconf.h>", "public"] },
+
+ # Without these, IWYU won't accept the C++ wrappers and throws
+ # a mysterious "cyclical import" error.
+ # https://github.com/include-what-you-use/include-what-you-use/blob/4c0f39615982c57a9cb313c971c6f45fca1cc1fe/iwyu_include_picker.cc#L573
+ { include: ["<assert.h>", "public", "<cassert>", "public"] },
+ { include: ["<complex.h>", "public", "<ccomplex>", "public"] },
+ { include: ["<ctype.h>", "public", "<cctype>", "public"] },
+ { include: ["<errno.h>", "public", "<cerrno>", "public"] },
+ { include: ["<fenv.h>", "public", "<cfenv>", "public"] },
+ { include: ["<float.h>", "public", "<cfloat>", "public"] },
+ { include: ["<inttypes.h>", "public", "<cinttypes>", "public"] },
+ { include: ["<iso646.h>", "public", "<ciso646>", "public"] },
+ { include: ["<limits.h>", "public", "<climits>", "public"] },
+ { include: ["<locale.h>", "public", "<clocale>", "public"] },
+ { include: ["<math.h>", "public", "<cmath>", "public"] },
+ { include: ["<setjmp.h>", "public", "<csetjmp>", "public"] },
+ { include: ["<signal.h>", "public", "<csignal>", "public"] },
+ { include: ["<stdalign.h>", "public", "<cstdalign>", "public"] },
+ { include: ["<stdarg.h>", "public", "<cstdarg>", "public"] },
+ { include: ["<stdbool.h>", "public", "<cstdbool>", "public"] },
+ { include: ["<stddef.h>", "public", "<cstddef>", "public"] },
+ { include: ["<stdint.h>", "public", "<cstdint>", "public"] },
+ { include: ["<stdio.h>", "public", "<cstdio>", "public"] },
+ { include: ["<stdlib.h>", "public", "<cstdlib>", "public"] },
+ { include: ["<string.h>", "public", "<string>", "public"] },
+ { include: ["<string.h>", "public", "<cstring>", "public"] },
+ { include: ["<tgmath.h>", "public", "<ctgmath>", "public"] },
+ { include: ["<time.h>", "public", "<ctime>", "public"] },
+ { include: ["<uchar.h>", "public", "<cuchar>", "public"] },
+ { include: ["<wchar.h>", "public", "<cwchar>", "public"] },
+ { include: ["<wctype.h>", "public", "<cwctype>", "public"] },
+
+ # From https://github.com/include-what-you-use/include-what-you-use/blob/4c0f39615982c57a9cb313c971c6f45fca1cc1fe/iwyu_include_picker.cc#L327
+ { symbol: ["std::allocator", "private", "<memory>", "public"] },
+ { symbol: ["std::allocator", "private", "<string>", "public"] },
+ { symbol: ["std::allocator", "private", "<vector>", "public"] },
+ { symbol: ["std::allocator", "private", "<map>", "public"] },
+ { symbol: ["std::allocator", "private", "<set>", "public"] },
+ { symbol: ["std::char_traits", "private", "<string>", "public"] },
+ { symbol: ["std::char_traits", "private", "<ostream>", "public"] },
+ { symbol: ["std::char_traits", "private", "<istream>", "public"] },
+
+ { symbol: ["std::time_t", "private", "<ctime>", "public"] },
+ { symbol: ["time_t", "private", "<ctime>", "public"] },
+
+ # We are pretty forgiving with iostream headers. If we specify
+ # any of them, that is generally sufficient.
+ # https://github.com/include-what-you-use/include-what-you-use/blob/4c0f39615982c57a9cb313c971c6f45fca1cc1fe/iwyu_include_picker.cc#L995
+ {include: ["<ios>", "public", "<istream>", "public"] },
+ {include: ["<ios>", "public", "<ostream>", "public"] },
+ {include: ["<iosfwd>", "public", "<ios>", "public"] },
+ {include: ["<iosfwd>", "public", "<streambuf>", "public"] },
+ {include: ["<istream>", "public", "<fstream>", "public"] },
+ {include: ["<istream>", "public", "<iostream>", "public"] },
+ {include: ["<istream>", "public", "<sstream>", "public"] },
+ {include: ["<ostream>", "public", "<fstream>", "public"] },
+ {include: ["<ostream>", "public", "<iostream>", "public"] },
+ {include: ["<ostream>", "public", "<istream>", "public"] },
+ {include: ["<ostream>", "public", "<sstream>", "public"] },
+ {include: ["<streambuf>", "public", "<ios>", "public"] },
]
diff --git a/chromium/third_party/skia/toolchain/linux_trampolines/clang_trampoline_linux.sh b/chromium/third_party/skia/toolchain/linux_trampolines/clang_trampoline_linux.sh
index a8bb9e9d682..109d267fbc0 100755
--- a/chromium/third_party/skia/toolchain/linux_trampolines/clang_trampoline_linux.sh
+++ b/chromium/third_party/skia/toolchain/linux_trampolines/clang_trampoline_linux.sh
@@ -6,6 +6,8 @@
export LD_LIBRARY_PATH="external/clang_linux_amd64/usr/lib/x86_64-linux-gnu:external/clang_linux_amd64/usr/lib/llvm-13/lib"
+set -e
+
# We only want to run include-what-you-use if DSKIA_ENFORCE_IWYU is in the arguments
# passed in (i.e. the "skia_enforce_iwyu" feature is enabled) and we are not linking
# (as detected by the presence of -fuse-ld).
@@ -16,6 +18,9 @@ fi
supported_files_or_dirs=(
"experimental/bazel_test/"
+ "modules/skunicode/"
+ "src/codec/"
+ "src/images/"
"src/sksl/"
"src/svg/"
"src/utils/"
@@ -58,6 +63,7 @@ else
# not consistent with detecting that.
external/clang_linux_amd64/usr/bin/include-what-you-use \
-Xiwyu --keep="include/core/SkTypes.h" \
+ -Xiwyu --no_default_mappings \
-Xiwyu --mapping_file=$MAPPING_FILE $@ 2>/dev/null
# IWYU returns 2 if everything looks good. It returns some other non-zero exit code otherwise.
if [ $? -eq 2 ]; then
@@ -68,6 +74,7 @@ else
# analysis. If we aren't sure why IWYU wants to include something, try changing verbose to 3.
external/clang_linux_amd64/usr/bin/include-what-you-use \
-Xiwyu --keep="include/core/SkTypes.h" \
+ -Xiwyu --no_default_mappings \
-Xiwyu --mapping_file=$MAPPING_FILE -Xiwyu --no_comments \
-Xiwyu --quoted_includes_first -Xiwyu --verbose=3 $@
exit 1 # fail the build
diff --git a/chromium/third_party/skia/toolchain/mac_m1_toolchain_config.bzl b/chromium/third_party/skia/toolchain/mac_m1_toolchain_config.bzl
deleted file mode 100644
index 2c564a7e608..00000000000
--- a/chromium/third_party/skia/toolchain/mac_m1_toolchain_config.bzl
+++ /dev/null
@@ -1,331 +0,0 @@
-"""
-This file specifies a clang toolchain that can run on a Mac host.
-
-Hermetic toolchains still need access to Xcode for sys headers included in Skia's codebase.
-
-See download_mac_m1_toolchain.bzl for more details on the creation of the toolchain.
-
-It uses the usr subfolder of the built toolchain as a sysroot
-
-It follows the example of:
- - lunix_amd64_toolchain_config.bzl
-"""
-
-load(
- "@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
- "action_config",
- "feature",
- "flag_group",
- "flag_set",
- "tool",
- "variable_with_value",
-)
-
-# https://github.com/bazelbuild/bazel/blob/master/tools/build_defs/cc/action_names.bzl
-load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
-
-# The location of the created clang toolchain.
-EXTERNAL_TOOLCHAIN = "external/clang_mac_m1"
-
-# Symlink location.
-# Must be the same as where the symlink points to in download_mac_m1_toolchain.bzl
-XCODE_SYMLINK = EXTERNAL_TOOLCHAIN + "/symlinks/xcode/MacSDK/usr"
-
-def _mac_m1_toolchain_info(ctx):
- action_configs = _make_action_configs()
- features = []
- features += _make_default_flags()
- features += _make_diagnostic_flags()
-
- # https://docs.bazel.build/versions/main/skylark/lib/cc_common.html#create_cc_toolchain_config_info
- # Note, this rule is defined in Java code, not Starlark
- # https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/starlarkbuildapi/cpp/CcModuleApi.java
- return cc_common.create_cc_toolchain_config_info(
- ctx = ctx,
- features = features,
- abi_libc_version = "unknown",
- abi_version = "unknown",
- action_configs = action_configs,
- builtin_sysroot = EXTERNAL_TOOLCHAIN,
- compiler = "clang",
- host_system_name = "local",
- target_cpu = "m1",
- target_system_name = "local",
- # does this matter?
- target_libc = "glibc-2.31",
- toolchain_identifier = "clang-toolchain",
- )
-
-provide_mac_m1_toolchain_config = rule(
- attrs = {},
- provides = [CcToolchainConfigInfo],
- implementation = _mac_m1_toolchain_info,
-)
-
-def _make_action_configs():
- """
- This function sets up the tools needed to perform the various compile/link actions.
-
- Bazel normally restricts us to referring to (and therefore running) executables/scripts
- that are in this directory (That is EXEC_ROOT/toolchain). However, the executables we want
- to run are brought in via WORKSPACE.bazel and are located in EXEC_ROOT/external/clang....
- Therefore, we make use of "trampoline scripts" that will call the binaries from the
- toolchain directory.
-
- These action_configs also let us dynamically specify arguments from the Bazel
- environment if necessary (see cpp_link_static_library_action).
- """
-
- # https://cs.opensource.google/bazel/bazel/+/master:tools/cpp/cc_toolchain_config_lib.bzl;l=435;drc=3b9e6f201a9a3465720aad8712ab7bcdeaf2e5da
- clang_tool = tool(path = "mac_trampolines/clang_trampoline_mac.sh")
- lld_tool = tool(path = "mac_trampolines/lld_trampoline_mac.sh")
- ar_tool = tool(path = "mac_trampolines/ar_trampoline_mac.sh")
-
- # https://cs.opensource.google/bazel/bazel/+/master:tools/cpp/cc_toolchain_config_lib.bzl;l=488;drc=3b9e6f201a9a3465720aad8712ab7bcdeaf2e5da
- assemble_action = action_config(
- action_name = ACTION_NAMES.assemble,
- tools = [clang_tool],
- )
- c_compile_action = action_config(
- action_name = ACTION_NAMES.c_compile,
- tools = [clang_tool],
- )
- cpp_compile_action = action_config(
- action_name = ACTION_NAMES.cpp_compile,
- tools = [clang_tool],
- )
- linkstamp_compile_action = action_config(
- action_name = ACTION_NAMES.linkstamp_compile,
- tools = [clang_tool],
- )
- preprocess_assemble_action = action_config(
- action_name = ACTION_NAMES.preprocess_assemble,
- tools = [clang_tool],
- )
-
- cpp_link_dynamic_library_action = action_config(
- action_name = ACTION_NAMES.cpp_link_dynamic_library,
- tools = [lld_tool],
- )
- cpp_link_executable_action = action_config(
- action_name = ACTION_NAMES.cpp_link_executable,
- # Bazel assumes it is talking to clang when building an executable. There are
- # "-Wl" flags on the command: https://releases.llvm.org/6.0.1/tools/clang/docs/ClangCommandLineReference.html#cmdoption-clang-Wl
- tools = [clang_tool],
- )
- cpp_link_nodeps_dynamic_library_action = action_config(
- action_name = ACTION_NAMES.cpp_link_nodeps_dynamic_library,
- tools = [lld_tool],
- )
-
- # This is the same rule as
- # https://github.com/emscripten-core/emsdk/blob/7f39d100d8cd207094decea907121df72065517e/bazel/emscripten_toolchain/crosstool.bzl#L143
- # By default, there are no flags or libraries passed to the llvm-ar tool, so
- # we need to specify them. The variables mentioned by expand_if_available are defined
- # https://docs.bazel.build/versions/main/cc-toolchain-config-reference.html#cctoolchainconfiginfo-build-variables
- cpp_link_static_library_action = action_config(
- action_name = ACTION_NAMES.cpp_link_static_library,
- flag_sets = [
- flag_set(
- flag_groups = [
- flag_group(
- # https://llvm.org/docs/CommandGuide/llvm-ar.html
- # replace existing files or insert them if they already exist,
- # create the file if it doesn't already exist
- # symbol table should be added
- # Deterministic timestamps should be used
- flags = ["rcsD", "%{output_execpath}"],
- # Despite the name, output_execpath just refers to linker output,
- # e.g. libFoo.a
- expand_if_available = "output_execpath",
- ),
- ],
- ),
- flag_set(
- flag_groups = [
- flag_group(
- iterate_over = "libraries_to_link",
- flag_groups = [
- flag_group(
- flags = ["%{libraries_to_link.name}"],
- expand_if_equal = variable_with_value(
- name = "libraries_to_link.type",
- value = "object_file",
- ),
- ),
- flag_group(
- flags = ["%{libraries_to_link.object_files}"],
- iterate_over = "libraries_to_link.object_files",
- expand_if_equal = variable_with_value(
- name = "libraries_to_link.type",
- value = "object_file_group",
- ),
- ),
- ],
- expand_if_available = "libraries_to_link",
- ),
- ],
- ),
- flag_set(
- flag_groups = [
- flag_group(
- flags = ["@%{linker_param_file}"],
- expand_if_available = "linker_param_file",
- ),
- ],
- ),
- ],
- tools = [ar_tool],
- )
-
- action_configs = [
- assemble_action,
- c_compile_action,
- cpp_compile_action,
- cpp_link_dynamic_library_action,
- cpp_link_executable_action,
- cpp_link_nodeps_dynamic_library_action,
- cpp_link_static_library_action,
- linkstamp_compile_action,
- preprocess_assemble_action,
- ]
- return action_configs
-
-def _make_default_flags():
- """Here we define the flags for certain actions that are always applied."""
- cxx_compile_includes = flag_set(
- actions = [
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ],
- flag_groups = [
- flag_group(
- flags = [
- # THIS ORDER MATTERS GREATLY. If these are in the wrong order, the
- # #include_next directives will fail to find the files, causing a compilation
- # error (or, without -no-canonical-prefixes, a mysterious case where files
- # are included with an absolute path and fail the build).
- "-isystem",
- EXTERNAL_TOOLCHAIN + "/include/c++/v1",
- "-isystem",
- XCODE_SYMLINK + "/include",
- "-isystem",
- EXTERNAL_TOOLCHAIN + "/lib/clang/13.0.0/include",
- # We do not want clang to search in absolute paths for files. This makes
- # Bazel think we are using an outside resource and fail the compile.
- "-no-canonical-prefixes",
- ],
- ),
- ],
- )
-
- cpp_compile_includes = flag_set(
- actions = [
- ACTION_NAMES.cpp_compile,
- ],
- flag_groups = [
- flag_group(
- flags = [
- "-std=c++17",
- "-Wno-psabi", # noisy
- ],
- ),
- ],
- )
-
- link_exe_flags = flag_set(
- actions = [ACTION_NAMES.cpp_link_executable],
- flag_groups = [
- flag_group(
- flags = [
- "-fuse-ld=lld",
- # We chose to use the llvm runtime, not the gcc one because it is already
- # included in the clang binary
- "--rtlib=compiler-rt",
- "-std=c++17",
- # Tell the linker where to look for libraries.
- "-L",
- XCODE_SYMLINK + "/lib",
- # We statically include these libc++ libraries so they do not need to be
- # on a developer's machine (they can be tricky to get).
- EXTERNAL_TOOLCHAIN + "/lib/libc++.a",
- EXTERNAL_TOOLCHAIN + "/lib/libc++abi.a",
- EXTERNAL_TOOLCHAIN + "/lib/libunwind.a",
- # Dynamically Link in the other parts of glibc (not needed in glibc 2.34+)
- "-lpthread",
- "-lm",
- "-ldl",
- ],
- ),
- ],
- )
- return [feature(
- "default_flags",
- enabled = True,
- flag_sets = [
- cxx_compile_includes,
- cpp_compile_includes,
- link_exe_flags,
- ],
- )]
-
-def _make_diagnostic_flags():
- """Here we define the flags that can be turned on via features to yield debug info."""
- cxx_diagnostic = flag_set(
- actions = [
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ],
- flag_groups = [
- flag_group(
- flags = [
- "--trace-includes",
- "-v",
- ],
- ),
- ],
- )
-
- link_diagnostic = flag_set(
- actions = [ACTION_NAMES.cpp_link_executable],
- flag_groups = [
- flag_group(
- flags = [
- "-Wl,--verbose",
- "-v",
- ],
- ),
- ],
- )
-
- link_search_dirs = flag_set(
- actions = [ACTION_NAMES.cpp_link_executable],
- flag_groups = [
- flag_group(
- flags = [
- "--print-search-dirs",
- ],
- ),
- ],
- )
- return [
- # Running a Bazel command with --features diagnostic will cause the compilation and
- # link steps to be more verbose.
- feature(
- "diagnostic",
- enabled = False,
- flag_sets = [
- cxx_diagnostic,
- link_diagnostic,
- ],
- ),
- # Running a Bazel command with --features print_search_dirs will cause the link to fail
- # but directories searched for libraries, etc will be displayed.
- feature(
- "print_search_dirs",
- enabled = False,
- flag_sets = [
- link_search_dirs,
- ],
- ),
- ]
diff --git a/chromium/third_party/skia/toolchain/mac_toolchain_config.bzl b/chromium/third_party/skia/toolchain/mac_toolchain_config.bzl
new file mode 100644
index 00000000000..d4642157695
--- /dev/null
+++ b/chromium/third_party/skia/toolchain/mac_toolchain_config.bzl
@@ -0,0 +1,482 @@
+"""
+This file specifies a clang toolchain that can run on a Mac host (with either M1 or Intel CPU).
+
+Hermetic toolchains still need access to Xcode for sys headers included in Skia's codebase.
+
+See download_mac_toolchain.bzl for more details on the creation of the toolchain.
+
+It uses the usr subfolder of the built toolchain as a sysroot
+
+It follows the example of:
+ - linux_amd64_toolchain_config.bzl
+"""
+
+# https://github.com/bazelbuild/bazel/blob/master/tools/cpp/cc_toolchain_config_lib.bzl
+load(
+ "@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
+ "action_config",
+ "feature",
+ "flag_group",
+ "flag_set",
+ "tool",
+ "variable_with_value",
+)
+
+# https://github.com/bazelbuild/bazel/blob/master/tools/build_defs/cc/action_names.bzl
+load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
+
+# The location of the created clang toolchain.
+EXTERNAL_TOOLCHAIN = "external/clang_mac"
+
+# Root of our symlinks. These symlinks are created in download_mac_toolchain.bzl
+XCODE_SYMLINK = EXTERNAL_TOOLCHAIN + "/symlinks/xcode/MacSDK"
+
+_platform_constraints_to_import = {
+ "@platforms//cpu:arm64": "_arm64_cpu",
+ "@platforms//cpu:x86_64": "_x86_64_cpu",
+}
+
+def _mac_toolchain_info(ctx):
+ action_configs = _make_action_configs()
+ features = []
+ features += _make_default_flags()
+ features += _make_diagnostic_flags()
+ features += _make_target_specific_flags(ctx)
+
+ # https://bazel.build/rules/lib/cc_common#create_cc_toolchain_config_info
+ # Note, this rule is defined in Java code, not Starlark
+ # https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/starlarkbuildapi/cpp/CcModuleApi.java
+ return cc_common.create_cc_toolchain_config_info(
+ ctx = ctx,
+ features = features,
+ action_configs = action_configs,
+ builtin_sysroot = EXTERNAL_TOOLCHAIN,
+ cxx_builtin_include_directories = [
+ # https://stackoverflow.com/a/61419490
+ # "If the compiler has --sysroot support, then these paths should use %sysroot%
+ # rather than the include path"
+ # https://bazel.build/rules/lib/cc_common#create_cc_toolchain_config_info.cxx_builtin_include_directories
+ "%sysroot%/symlinks/xcode/MacSDK/Frameworks/",
+ ],
+ # These are required, but do nothing
+ compiler = "",
+ target_cpu = "",
+ target_libc = "",
+ target_system_name = "",
+ toolchain_identifier = "",
+ )
+
+def _import_platform_constraints():
+ # In order to "import" constraint values so they can be passed in as parameters to
+ # ctx.target_platform_has_constraint(), we need to list them as a default value on a
+ # private attributes. It doesn't really matter what we call these private attributes,
+ # but to make it easier to read elsewhere, we create a mapping between the "official"
+ # name of the constraints and the private name. Then, we can refer to the official name
+ # without having to remember the secondary name.
+ # https://bazel.build/rules/rules#private_attributes_and_implicit_dependencies
+ # https://github.com/bazelbuild/proposals/blob/91579f36031f768bcf68b18a86b8df8b43cc590b/designs/2019-11-11-target-platform-constraints.md
+ rule_attributes = {}
+ for constraint in _platform_constraints_to_import:
+ private_attr = _platform_constraints_to_import[constraint]
+ rule_attributes[private_attr] = attr.label(default = constraint)
+ return rule_attributes
+
+def _has_platform_constraint(ctx, official_constraint_name):
+ # ctx is of type https://bazel.build/rules/lib/ctx
+ # This pattern is from
+ # https://github.com/bazelbuild/proposals/blob/91579f36031f768bcf68b18a86b8df8b43cc590b/designs/2019-11-11-target-platform-constraints.md
+ private_attr = _platform_constraints_to_import[official_constraint_name]
+ constraint = getattr(ctx.attr, private_attr)[platform_common.ConstraintValueInfo]
+ return ctx.target_platform_has_constraint(constraint)
+
+provide_mac_toolchain_config = rule(
+ attrs = _import_platform_constraints(),
+ provides = [CcToolchainConfigInfo],
+ implementation = _mac_toolchain_info,
+)
+
+def _make_action_configs():
+ """
+ This function sets up the tools needed to perform the various compile/link actions.
+
+ Bazel normally restricts us to referring to (and therefore running) executables/scripts
+ that are in this directory (That is EXEC_ROOT/toolchain). However, the executables we want
+ to run are brought in via WORKSPACE.bazel and are located in EXEC_ROOT/external/clang....
+ Therefore, we make use of "trampoline scripts" that will call the binaries from the
+ toolchain directory.
+
+ These action_configs also let us dynamically specify arguments from the Bazel
+ environment if necessary (see cpp_link_static_library_action).
+ """
+
+ # https://cs.opensource.google/bazel/bazel/+/master:tools/cpp/cc_toolchain_config_lib.bzl;l=435;drc=3b9e6f201a9a3465720aad8712ab7bcdeaf2e5da
+ clang_tool = tool(path = "mac_trampolines/clang_trampoline_mac.sh")
+ lld_tool = tool(path = "mac_trampolines/lld_trampoline_mac.sh")
+ ar_tool = tool(path = "mac_trampolines/ar_trampoline_mac.sh")
+
+ # https://cs.opensource.google/bazel/bazel/+/master:tools/cpp/cc_toolchain_config_lib.bzl;l=488;drc=3b9e6f201a9a3465720aad8712ab7bcdeaf2e5da
+ assemble_action = action_config(
+ action_name = ACTION_NAMES.assemble,
+ tools = [clang_tool],
+ )
+ c_compile_action = action_config(
+ action_name = ACTION_NAMES.c_compile,
+ tools = [clang_tool],
+ )
+ cpp_compile_action = action_config(
+ action_name = ACTION_NAMES.cpp_compile,
+ tools = [clang_tool],
+ )
+ objc_compile_action = action_config(
+ action_name = ACTION_NAMES.objc_compile,
+ tools = [clang_tool],
+ )
+ objcpp_compile_action = action_config(
+ action_name = ACTION_NAMES.objcpp_compile,
+ tools = [clang_tool],
+ )
+ linkstamp_compile_action = action_config(
+ action_name = ACTION_NAMES.linkstamp_compile,
+ tools = [clang_tool],
+ )
+ preprocess_assemble_action = action_config(
+ action_name = ACTION_NAMES.preprocess_assemble,
+ tools = [clang_tool],
+ )
+
+ cpp_link_dynamic_library_action = action_config(
+ action_name = ACTION_NAMES.cpp_link_dynamic_library,
+ tools = [lld_tool],
+ )
+ cpp_link_executable_action = action_config(
+ action_name = ACTION_NAMES.cpp_link_executable,
+ # Bazel assumes it is talking to clang when building an executable. There are
+ # "-Wl" flags on the command: https://releases.llvm.org/6.0.1/tools/clang/docs/ClangCommandLineReference.html#cmdoption-clang-Wl
+ tools = [clang_tool],
+ )
+ cpp_link_nodeps_dynamic_library_action = action_config(
+ action_name = ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ tools = [lld_tool],
+ )
+
+ # objc archiver and cpp archiver actions use the same base flags
+ common_archive_flags = [
+ flag_set(
+ flag_groups = [
+ flag_group(
+ # https://llvm.org/docs/CommandGuide/llvm-ar.html
+ # [r]eplace existing files or insert them if they already exist,
+ # [c]reate the file if it doesn't already exist
+ # [s]ymbol table should be added
+ # [D]eterministic timestamps should be used
+ flags = ["rcsD", "%{output_execpath}"],
+ # Despite the name, output_execpath just refers to linker output,
+ # e.g. libFoo.a
+ expand_if_available = "output_execpath",
+ ),
+ ],
+ ),
+ flag_set(
+ flag_groups = [
+ flag_group(
+ iterate_over = "libraries_to_link",
+ flag_groups = [
+ flag_group(
+ flags = ["%{libraries_to_link.name}"],
+ expand_if_equal = variable_with_value(
+ name = "libraries_to_link.type",
+ value = "object_file",
+ ),
+ ),
+ flag_group(
+ flags = ["%{libraries_to_link.object_files}"],
+ iterate_over = "libraries_to_link.object_files",
+ expand_if_equal = variable_with_value(
+ name = "libraries_to_link.type",
+ value = "object_file_group",
+ ),
+ ),
+ ],
+ expand_if_available = "libraries_to_link",
+ ),
+ ],
+ ),
+ flag_set(
+ flag_groups = [
+ flag_group(
+ flags = ["@%{linker_param_file}"],
+ expand_if_available = "linker_param_file",
+ ),
+ ],
+ ),
+ ]
+
+ # This is the same rule as
+ # https://github.com/emscripten-core/emsdk/blob/7f39d100d8cd207094decea907121df72065517e/bazel/emscripten_toolchain/crosstool.bzl#L143
+ # By default, there are no flags or libraries passed to the llvm-ar tool, so
+ # we need to specify them. The variables mentioned by expand_if_available are defined
+ # https://docs.bazel.build/versions/main/cc-toolchain-config-reference.html#cctoolchainconfiginfo-build-variables
+ cpp_link_static_library_action = action_config(
+ action_name = ACTION_NAMES.cpp_link_static_library,
+ flag_sets = common_archive_flags,
+ tools = [ar_tool],
+ )
+
+ objc_archive_action = action_config(
+ action_name = ACTION_NAMES.objc_archive,
+ flag_sets = common_archive_flags,
+ tools = [ar_tool],
+ )
+
+ action_configs = [
+ assemble_action,
+ c_compile_action,
+ cpp_compile_action,
+ cpp_link_dynamic_library_action,
+ cpp_link_executable_action,
+ cpp_link_nodeps_dynamic_library_action,
+ cpp_link_static_library_action,
+ linkstamp_compile_action,
+ objc_archive_action,
+ objc_compile_action,
+ objcpp_compile_action,
+ preprocess_assemble_action,
+ ]
+ return action_configs
+
+# In addition to pointing the c and cpp compile actions to our toolchain, we also need to set objc
+# and objcpp action flags as well. We build .m and .mm files with the objc_library rule, which
+# will use the default toolchain if not specified here.
+# https://docs.bazel.build/versions/3.3.0/be/objective-c.html#objc_library
+#
+# Note: These values must be kept in sync with those defined in cmake_exporter.go.
+def _make_default_flags():
+ """Here we define the flags for certain actions that are always applied.
+
+ For any flag that might be conditionally applied, it should be defined in //bazel/copts.bzl.
+
+ Flags that are set here will be unconditionally applied to everything we compile with
+ this toolchain, even third_party deps.
+
+ """
+ cxx_compile_includes = flag_set(
+ actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ # THIS ORDER MATTERS GREATLY. If these are in the wrong order, the
+ # #include_next directives will fail to find the files, causing a compilation
+ # error (or, without -no-canonical-prefixes, a mysterious case where files
+ # are included with an absolute path and fail the build).
+ "-isystem",
+ EXTERNAL_TOOLCHAIN + "/include/c++/v1",
+ "-isystem",
+ XCODE_SYMLINK + "/usr/include",
+ "-isystem",
+ EXTERNAL_TOOLCHAIN + "/lib/clang/13.0.0/include",
+ # Set the framework path to the Mac SDK framework directory. This has
+ # subfolders like OpenGL.framework
+ # We want -iframework so Clang hides diagnostic warnings from those header
+ # files we include. -F does not hide those.
+ "-iframework",
+ XCODE_SYMLINK + "/Frameworks",
+ # We do not want clang to search in absolute paths for files. This makes
+ # Bazel think we are using an outside resource and fail the compile.
+ "-no-canonical-prefixes",
+ ],
+ ),
+ ],
+ )
+
+ cpp_compile_flags = flag_set(
+ actions = [
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-std=c++17",
+ ],
+ ),
+ ],
+ )
+
+ # copts and --copts appear to not automatically be set
+ # https://bazel.build/docs/cc-toolchain-config-reference#cctoolchainconfiginfo-build-variables
+ # https://github.com/bazelbuild/bazel/blob/5ad4a6126be2bdc53ee7e2457e076c90efe86d56/tools/cpp/cc_toolchain_config_lib.bzl#L200-L209
+ objc_compile_flags = flag_set(
+ actions = [
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ iterate_over = "user_compile_flags",
+ flags = ["%{user_compile_flags}"],
+ ),
+ ],
+ )
+
+ link_exe_flags = flag_set(
+ actions = [ACTION_NAMES.cpp_link_executable],
+ flag_groups = [
+ flag_group(
+ flags = [
+ # lld goes through dynamic library dependencies for dylib and tbh files through
+ # absolute paths (/System/Library/Frameworks). However, the dependencies live in
+ # [Xcode dir]/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks
+ # -Wl tells clang to forward the next flag to the linker.
+ # -syslibroot appends to the beginning of the dylib dependency path.
+ # https://github.com/llvm/llvm-project/blob/d61341768cf0cff7ceeaddecc2f769b5c1b901c4/lld/MachO/InputFiles.cpp#L1418-L1420
+ "-Wl,-syslibroot",
+ "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/",
+ "-fuse-ld=lld",
+ # We chose to use the llvm runtime, not the gcc one because it is already
+ # included in the clang binary
+ "--rtlib=compiler-rt",
+ "-std=c++17",
+ "-lstdc++",
+ ],
+ ),
+ ],
+ )
+
+ return [feature(
+ "default_flags",
+ enabled = True,
+ flag_sets = [
+ cpp_compile_flags,
+ cxx_compile_includes,
+ link_exe_flags,
+ objc_compile_flags,
+ ],
+ )]
+
+def _make_diagnostic_flags():
+ """Here we define the flags that can be turned on via features to yield debug info."""
+ cxx_diagnostic = flag_set(
+ actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "--trace-includes",
+ "-v",
+ ],
+ ),
+ ],
+ )
+
+ link_diagnostic = flag_set(
+ actions = [ACTION_NAMES.cpp_link_executable],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-Wl,--verbose",
+ "-v",
+ ],
+ ),
+ ],
+ )
+
+ link_search_dirs = flag_set(
+ actions = [ACTION_NAMES.cpp_link_executable],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "--print-search-dirs",
+ ],
+ ),
+ ],
+ )
+ return [
+ # Running a Bazel command with --features diagnostic will cause the compilation and
+ # link steps to be more verbose.
+ feature(
+ "diagnostic",
+ enabled = False,
+ flag_sets = [
+ cxx_diagnostic,
+ link_diagnostic,
+ ],
+ ),
+ # Running a Bazel command with --features print_search_dirs will cause the link to fail
+ # but directories searched for libraries, etc will be displayed.
+ feature(
+ "print_search_dirs",
+ enabled = False,
+ flag_sets = [
+ link_search_dirs,
+ ],
+ ),
+ ]
+
+# The parameter is of type https://bazel.build/rules/lib/ctx
+def _make_target_specific_flags(ctx):
+ m1_mac_target = flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "--target=arm64-apple-macos11",
+ ],
+ ),
+ ],
+ )
+ intel_mac_target = flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "--target=x86_64-apple-macos11",
+ ],
+ ),
+ ],
+ )
+
+ target_specific_features = []
+ if _has_platform_constraint(ctx, "@platforms//cpu:arm64"):
+ target_specific_features.append(
+ feature(
+ name = "_m1_mac_target",
+ enabled = True,
+ flag_sets = [m1_mac_target],
+ ),
+ )
+ elif _has_platform_constraint(ctx, "@platforms//cpu:x86_64"):
+ target_specific_features.append(
+ feature(
+ name = "_intel_mac_target",
+ enabled = True,
+ flag_sets = [intel_mac_target],
+ ),
+ )
+
+ return target_specific_features
diff --git a/chromium/third_party/skia/toolchain/mac_trampolines/ar_trampoline_mac.sh b/chromium/third_party/skia/toolchain/mac_trampolines/ar_trampoline_mac.sh
index 3ac75c5de80..57053c9e3b0 100755
--- a/chromium/third_party/skia/toolchain/mac_trampolines/ar_trampoline_mac.sh
+++ b/chromium/third_party/skia/toolchain/mac_trampolines/ar_trampoline_mac.sh
@@ -3,5 +3,4 @@
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-
-external/clang_mac_m1/bin/llvm-ar $@
+external/clang_mac/bin/llvm-ar $@
diff --git a/chromium/third_party/skia/toolchain/mac_trampolines/clang_trampoline_mac.sh b/chromium/third_party/skia/toolchain/mac_trampolines/clang_trampoline_mac.sh
index c0b97f79b0c..f77828d4b4f 100755
--- a/chromium/third_party/skia/toolchain/mac_trampolines/clang_trampoline_mac.sh
+++ b/chromium/third_party/skia/toolchain/mac_trampolines/clang_trampoline_mac.sh
@@ -3,4 +3,4 @@
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-external/clang_mac_m1/bin/clang $@
+external/clang_mac/bin/clang $@
diff --git a/chromium/third_party/skia/toolchain/mac_trampolines/lld_trampoline_mac.sh b/chromium/third_party/skia/toolchain/mac_trampolines/lld_trampoline_mac.sh
index f9f07b73902..e84d607aaa0 100755
--- a/chromium/third_party/skia/toolchain/mac_trampolines/lld_trampoline_mac.sh
+++ b/chromium/third_party/skia/toolchain/mac_trampolines/lld_trampoline_mac.sh
@@ -3,5 +3,4 @@
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-
-external/clang_mac_m1/bin/ld.lld $@
+external/clang_mac/bin/ld.lld $@
diff --git a/chromium/third_party/skia/toolchain/utils.bzl b/chromium/third_party/skia/toolchain/utils.bzl
new file mode 100644
index 00000000000..fd7a4b8600c
--- /dev/null
+++ b/chromium/third_party/skia/toolchain/utils.bzl
@@ -0,0 +1,40 @@
+"""This module provides the gcs_mirror_url macro."""
+
+# Set to True to force the macro to only return the mirror URL.
+_TEST_GCS_MIRROR = False
+
+# Must be kept in sync with the suffixes supported by gcs_mirror (e.g.
+# https://skia.googlesource.com/skia/+/8ad66c2340713234df6b249e793415233337a103/bazel/gcs_mirror/gcs_mirror.go#140).
+_SUPPORTED_SUFFIXES = [".tar.gz", ".tgz", ".tar.xz", ".deb", ".zip"]
+
+_GCS_MIRROR_PREFIX = "https://storage.googleapis.com/skia-world-readable/bazel"
+
+def gcs_mirror_url(url, sha256):
+ """Takes the URL of an external resource and computes its GCS mirror URL.
+
+ We store backup copies of external resources in the skia-world-readable GCS bucket. This macro
+ returns a list with two elements: the original URL, and the mirrored URL.
+
+ Files are expected to be in the mirror location named after their sha256 hash. The files should
+ still have their file extension, as some of the Starlark functions sniff the file extension
+ (e.g. download_and_extract). See //bazel/gcs_mirror for an automated way to update this mirror.
+
+ To mirror a new URL, please use the `gcs_mirror` utility found at
+ https://skia.googlesource.com/skia/+/8ad66c2340713234df6b249e793415233337a103/bazel/gcs_mirror/gcs_mirror.go.
+
+ Args:
+ url: URL of the mirrored resource.
+ sha256: SHA256 hash of the mirrored resource.
+ Returns:
+ A list of the form [original URL, mirror URL].
+ """
+ extension = ""
+ for suffix in _SUPPORTED_SUFFIXES:
+ if url.endswith(suffix):
+ extension = suffix
+ break
+ if extension == "":
+ fail("URL %s has an unsupported suffix." % url)
+
+ mirror_url = "%s/%s%s" % (_GCS_MIRROR_PREFIX, sha256, extension)
+ return [mirror_url] if _TEST_GCS_MIRROR else [url, mirror_url]
diff --git a/chromium/third_party/skia/tools/BUILD.bazel b/chromium/third_party/skia/tools/BUILD.bazel
index b3deba50d0a..ea55b662b94 100644
--- a/chromium/third_party/skia/tools/BUILD.bazel
+++ b/chromium/third_party/skia/tools/BUILD.bazel
@@ -1,10 +1,10 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy", "py_binary")
+load("//bazel:macros.bzl", "exports_files_legacy", "py_binary", "skia_cc_library")
licenses(["notice"])
exports_files_legacy()
-cc_library(
+skia_cc_library(
name = "tool_utils",
testonly = True,
srcs = [
@@ -12,9 +12,11 @@ cc_library(
"ToolUtils.cpp",
"ResourceFactory.h",
"Resources.h",
- "//tools/flags:core_srcs",
+ "//tools/flags",
# TODO(kjlubick, bungeman): We should split out the font stuff into its own set of files
"//tools/fonts:test_font_manager_srcs",
+ "SkMetaData.h",
+ "SkMetaData.cpp",
],
hdrs = [
"ToolUtils.h",
diff --git a/chromium/third_party/skia/tools/CrashHandler.cpp b/chromium/third_party/skia/tools/CrashHandler.cpp
index c498820c39d..694c3d87ddf 100644
--- a/chromium/third_party/skia/tools/CrashHandler.cpp
+++ b/chromium/third_party/skia/tools/CrashHandler.cpp
@@ -9,6 +9,7 @@
#include "src/core/SkLeanWindows.h"
+#include <array> // for std::size
#include <stdlib.h>
#if defined(SK_BUILD_FOR_GOOGLE3)
@@ -101,7 +102,7 @@
backtrace_request();
#else
void* stack[64];
- const int count = backtrace(stack, SK_ARRAY_COUNT(stack));
+ const int count = backtrace(stack, std::size(stack));
char** symbols = backtrace_symbols(stack, count);
SkDebugf("\nSignal %d [%s]:\n", sig, strsignal(sig));
@@ -109,7 +110,7 @@
Dl_info info;
if (dladdr(stack[i], &info) && info.dli_sname) {
char demangled[256];
- size_t len = SK_ARRAY_COUNT(demangled);
+ size_t len = std::size(demangled);
int ok;
abi::__cxa_demangle(info.dli_sname, demangled, &len, &ok);
@@ -170,7 +171,7 @@
static LONG WINAPI handler(EXCEPTION_POINTERS* e) {
const DWORD code = e->ExceptionRecord->ExceptionCode;
SkDebugf("\nCaught exception %lu", code);
- for (size_t i = 0; i < SK_ARRAY_COUNT(kExceptions); i++) {
+ for (size_t i = 0; i < std::size(kExceptions); i++) {
if (kExceptions[i].code == code) {
SkDebugf(" %s", kExceptions[i].name);
}
diff --git a/chromium/third_party/skia/tools/HashAndEncode.cpp b/chromium/third_party/skia/tools/HashAndEncode.cpp
index f436c1bfe00..215437ae231 100644
--- a/chromium/third_party/skia/tools/HashAndEncode.cpp
+++ b/chromium/third_party/skia/tools/HashAndEncode.cpp
@@ -6,7 +6,7 @@
#include "include/core/SkColorSpace.h"
#include "include/core/SkICC.h"
#include "include/core/SkString.h"
-#include "include/third_party/skcms/skcms.h"
+#include "modules/skcms/skcms.h"
#include <png.h>
@@ -159,7 +159,7 @@ bool HashAndEncode::encodePNG(SkWStream* st,
text[1].key = (png_charp)"Description";
text[1].text = (png_charp)description.c_str();
text[1].compression = PNG_TEXT_COMPRESSION_NONE;
- png_set_text(png, info, text, SK_ARRAY_COUNT(text));
+ png_set_text(png, info, text, std::size(text));
png_set_IHDR(png, info, (png_uint_32)fSize.width()
, (png_uint_32)fSize.height()
diff --git a/chromium/third_party/skia/tools/Stats.h b/chromium/third_party/skia/tools/Stats.h
index 9086adf8f79..67dd92a647f 100644
--- a/chromium/third_party/skia/tools/Stats.h
+++ b/chromium/third_party/skia/tools/Stats.h
@@ -62,9 +62,9 @@ struct Stats {
double s = samples[i];
s -= min;
s /= (max - min);
- s *= (SK_ARRAY_COUNT(kBars) - 1);
+ s *= (std::size(kBars) - 1);
const size_t bar = (size_t)(s + 0.5);
- SkASSERT_RELEASE(bar < SK_ARRAY_COUNT(kBars));
+ SkASSERT_RELEASE(bar < std::size(kBars));
plot.append(kBars[bar]);
}
}
diff --git a/chromium/third_party/skia/tools/ToolUtils.cpp b/chromium/third_party/skia/tools/ToolUtils.cpp
index 63683aa83fe..28eb82d02fb 100644
--- a/chromium/third_party/skia/tools/ToolUtils.cpp
+++ b/chromium/third_party/skia/tools/ToolUtils.cpp
@@ -31,6 +31,11 @@
#include <cmath>
#include <cstring>
+#ifdef SK_GRAPHITE_ENABLED
+#include "include/gpu/graphite/ImageProvider.h"
+#include <unordered_map>
+#endif
+
#if defined(SK_ENABLE_SVG)
#include "modules/svg/include/SkSVGDOM.h"
#include "modules/svg/include/SkSVGNode.h"
@@ -544,7 +549,7 @@ sk_sp<SkImage> MakeTextureImage(SkCanvas* canvas, sk_sp<SkImage> orig) {
return orig->makeTextureImage(dContext);
}
-#if SK_GRAPHITE_ENABLED
+#if defined(SK_GRAPHITE_ENABLED)
else if (canvas->recorder()) {
return orig->makeTextureImage(canvas->recorder());
}
@@ -554,4 +559,146 @@ sk_sp<SkImage> MakeTextureImage(SkCanvas* canvas, sk_sp<SkImage> orig) {
}
#endif
+VariationSliders::VariationSliders(SkTypeface* typeface,
+ SkFontArguments::VariationPosition variationPosition) {
+ if (!typeface) {
+ return;
+ }
+
+ int numAxes = typeface->getVariationDesignParameters(nullptr, 0);
+ if (numAxes < 0) {
+ return;
+ }
+
+ std::unique_ptr<SkFontParameters::Variation::Axis[]> copiedAxes =
+ std::make_unique<SkFontParameters::Variation::Axis[]>(numAxes);
+
+ numAxes = typeface->getVariationDesignParameters(copiedAxes.get(), numAxes);
+ if (numAxes < 0) {
+ return;
+ }
+
+ auto argVariationPositionOrDefault = [&variationPosition](SkFourByteTag tag,
+ SkScalar defaultValue) -> SkScalar {
+ for (int i = 0; i < variationPosition.coordinateCount; ++i) {
+ if (variationPosition.coordinates[i].axis == tag) {
+ return variationPosition.coordinates[i].value;
+ }
+ }
+ return defaultValue;
+ };
+
+ fAxisSliders.resize(numAxes);
+ fCoords = std::make_unique<SkFontArguments::VariationPosition::Coordinate[]>(numAxes);
+ for (int i = 0; i < numAxes; ++i) {
+ fAxisSliders[i].axis = copiedAxes[i];
+ fAxisSliders[i].current =
+ argVariationPositionOrDefault(copiedAxes[i].tag, copiedAxes[i].def);
+ fAxisSliders[i].name = tagToString(fAxisSliders[i].axis.tag);
+ fCoords[i] = { fAxisSliders[i].axis.tag, fAxisSliders[i].current };
+ }
+}
+
+/* static */
+SkString VariationSliders::tagToString(SkFourByteTag tag) {
+ char tagAsString[5];
+ tagAsString[4] = 0;
+ tagAsString[0] = (char)(uint8_t)(tag >> 24);
+ tagAsString[1] = (char)(uint8_t)(tag >> 16);
+ tagAsString[2] = (char)(uint8_t)(tag >> 8);
+ tagAsString[3] = (char)(uint8_t)(tag >> 0);
+ return SkString(tagAsString);
+}
+
+bool VariationSliders::writeControls(SkMetaData* controls) {
+ for (size_t i = 0; i < fAxisSliders.size(); ++i) {
+ SkScalar axisVars[kAxisVarsSize];
+
+ axisVars[0] = fAxisSliders[i].current;
+ axisVars[1] = fAxisSliders[i].axis.min;
+ axisVars[2] = fAxisSliders[i].axis.max;
+ controls->setScalars(fAxisSliders[i].name.c_str(), kAxisVarsSize, axisVars);
+ }
+ return true;
+}
+
+void VariationSliders::readControls(const SkMetaData& controls, bool* changed) {
+ for (size_t i = 0; i < fAxisSliders.size(); ++i) {
+ SkScalar axisVars[kAxisVarsSize] = {0};
+ int resultAxisVarsSize = 0;
+ SkASSERT_RELEASE(controls.findScalars(
+ tagToString(fAxisSliders[i].axis.tag).c_str(), &resultAxisVarsSize, axisVars));
+ SkASSERT_RELEASE(resultAxisVarsSize == kAxisVarsSize);
+ if (changed) {
+ *changed |= fAxisSliders[i].current != axisVars[0];
+ }
+ fAxisSliders[i].current = axisVars[0];
+ fCoords[i] = { fAxisSliders[i].axis.tag, fAxisSliders[i].current };
+ }
+}
+
+SkSpan<const SkFontArguments::VariationPosition::Coordinate> VariationSliders::getCoordinates() {
+ return SkSpan<const SkFontArguments::VariationPosition::Coordinate>{fCoords.get(),
+ fAxisSliders.size()};
+}
+
+#ifdef SK_GRAPHITE_ENABLED
+
+// Currently, we give each new Recorder its own ImageProvider. This means we don't have to deal
+// w/ any threading issues.
+// TODO: We should probably have this class generate and report some cache stats
+// TODO: Hook up to listener system?
+// TODO: add testing of a single ImageProvider passed to multiple recorders
+class TestingImageProvider : public skgpu::graphite::ImageProvider {
+public:
+ ~TestingImageProvider() override {}
+
+ sk_sp<SkImage> findOrCreate(skgpu::graphite::Recorder* recorder,
+ const SkImage* image,
+ SkImage::RequiredImageProperties requiredProps) override {
+ if (requiredProps.fMipmapped == skgpu::graphite::Mipmapped::kNo) {
+ // If no mipmaps are required, check to see if we have a mipmapped version anyway -
+ // since it can be used in that case.
+ // TODO: we could get fancy and, if ever a mipmapped key eclipsed a non-mipmapped
+ // key, we could remove the hidden non-mipmapped key/image from the cache.
+ uint64_t mipMappedKey = ((uint64_t)image->uniqueID() << 32) | 0x1;
+ auto result = fCache.find(mipMappedKey);
+ if (result != fCache.end()) {
+ return result->second;
+ }
+ }
+
+ uint64_t key = ((uint64_t)image->uniqueID() << 32) |
+ (requiredProps.fMipmapped == skgpu::graphite::Mipmapped::kYes ? 0x1 : 0x0);
+
+ auto result = fCache.find(key);
+ if (result != fCache.end()) {
+ return result->second;
+ }
+
+ sk_sp<SkImage> newImage = image->makeTextureImage(recorder, requiredProps);
+ if (!newImage) {
+ return nullptr;
+ }
+
+ auto [iter, success] = fCache.insert({ key, newImage });
+ SkASSERT(success);
+
+ return iter->second;
+ }
+
+private:
+ std::unordered_map<uint64_t, sk_sp<SkImage>> fCache;
+};
+
+skgpu::graphite::RecorderOptions CreateTestingRecorderOptions() {
+ skgpu::graphite::RecorderOptions options;
+
+ options.fImageProvider.reset(new TestingImageProvider);
+
+ return options;
+}
+
+#endif // SK_GRAPHITE_ENABLED
+
} // namespace ToolUtils
diff --git a/chromium/third_party/skia/tools/ToolUtils.h b/chromium/third_party/skia/tools/ToolUtils.h
index 188661d2751..a3fbc1a8172 100644
--- a/chromium/third_party/skia/tools/ToolUtils.h
+++ b/chromium/third_party/skia/tools/ToolUtils.h
@@ -20,6 +20,7 @@
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkScalar.h"
+#include "include/core/SkSpan.h"
#include "include/core/SkStream.h"
#include "include/core/SkSurface.h"
#include "include/core/SkTypeface.h"
@@ -28,6 +29,11 @@
#include "include/private/SkTDArray.h"
#include "include/utils/SkRandom.h"
#include "src/core/SkTInternalLList.h"
+#include "tools/SkMetaData.h"
+
+#ifdef SK_GRAPHITE_ENABLED
+#include "include/gpu/graphite/Recorder.h"
+#endif
class SkBitmap;
class SkCanvas;
@@ -224,11 +230,11 @@ public:
#endif
// randomize the array
- static void Shuffle(SkTArray<sk_sp<TopoTestNode>>* graph, SkRandom* rand) {
- for (int i = graph->count() - 1; i > 0; --i) {
+ static void Shuffle(SkSpan<sk_sp<TopoTestNode>> graph, SkRandom* rand) {
+ for (int i = graph.size() - 1; i > 0; --i) {
int swap = rand->nextU() % (i + 1);
- (*graph)[i].swap((*graph)[swap]);
+ graph[i].swap(graph[swap]);
}
}
@@ -304,6 +310,42 @@ void sniff_paths(const char filepath[], std::function<PathSniffCallback>);
sk_sp<SkImage> MakeTextureImage(SkCanvas* canvas, sk_sp<SkImage> orig);
#endif
+// Initialised with a font, this class can be called to setup GM UI with sliders for font
+// variations, and returns a set of variation coordinates that matches what the sliders in the UI
+// are set to. Useful for testing variable font properties, see colrv1.cpp.
+class VariationSliders {
+public:
+ VariationSliders() {}
+
+ VariationSliders(SkTypeface*,
+ SkFontArguments::VariationPosition variationPosition = {nullptr, 0});
+
+ bool writeControls(SkMetaData* controls);
+
+ /* Scans controls for information about the variation axes that the user may have configured.
+ * Optionally pass in a boolean to receive information on whether the axes were updated. */
+ void readControls(const SkMetaData& controls, bool* changed = nullptr);
+
+ SkSpan<const SkFontArguments::VariationPosition::Coordinate> getCoordinates();
+
+ static SkString tagToString(SkFourByteTag tag);
+
+private:
+ struct AxisSlider {
+ SkScalar current;
+ SkFontParameters::Variation::Axis axis;
+ SkString name;
+ };
+
+ std::vector<AxisSlider> fAxisSliders;
+ std::unique_ptr<SkFontArguments::VariationPosition::Coordinate[]> fCoords;
+ static constexpr size_t kAxisVarsSize = 3;
+};
+
+#ifdef SK_GRAPHITE_ENABLED
+skgpu::graphite::RecorderOptions CreateTestingRecorderOptions();
+#endif
+
} // namespace ToolUtils
#endif // ToolUtils_DEFINED
diff --git a/chromium/third_party/skia/tools/android/measure_fps.py b/chromium/third_party/skia/tools/android/measure_fps.py
deleted file mode 100755
index 36b64b81ec2..00000000000
--- a/chromium/third_party/skia/tools/android/measure_fps.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2017 Google Inc.
-#
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-
-from __future__ import print_function
-import optparse
-import re
-import subprocess
-import time
-
-
-def query_surfaceflinger_frame_count():
- parcel = subprocess.Popen("adb shell service call SurfaceFlinger 1013",
- stdout=subprocess.PIPE, stderr=subprocess.PIPE,
- shell=True).communicate()[0]
- if not parcel:
- raise Exception("FAILED: adb shell service call SurfaceFlinger 1013")
-
- framecount = re.search("Result: Parcel\(([a-f0-9]+) ", parcel)
- if not framecount:
- raise Exception("Unexpected result from SurfaceFlinger: " + parcel)
-
- return int(framecount.group(1), 16)
-
-
-def main(interval):
- startframe = query_surfaceflinger_frame_count()
- starttime = time.time()
-
- while True:
- time.sleep(interval)
-
- endframe = query_surfaceflinger_frame_count()
- endtime = time.time()
- fps = (endframe - startframe) / (endtime - starttime)
- print("%.2f" % fps)
-
- startframe = endframe
- starttime = endtime
-
-
-if __name__ == '__main__':
- parser = optparse.OptionParser()
- parser.add_option("-i", "--interval", type="int", default="2",
- help="Number of seconds to count frames.")
- options, args = parser.parse_args()
- main(options.interval)
-
diff --git a/chromium/third_party/skia/tools/debugger/DrawCommand.cpp b/chromium/third_party/skia/tools/debugger/DrawCommand.cpp
index 856ce7b6da3..3bf092fb76f 100644
--- a/chromium/third_party/skia/tools/debugger/DrawCommand.cpp
+++ b/chromium/third_party/skia/tools/debugger/DrawCommand.cpp
@@ -276,7 +276,7 @@ const char* DrawCommand::GetCommandString(OpType type) {
}
void DrawCommand::toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const {
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_COMMAND, this->GetCommandString(fOpType));
+ writer.appendCString(DEBUGCANVAS_ATTRIBUTE_COMMAND, this->GetCommandString(fOpType));
writer.appendBool(DEBUGCANVAS_ATTRIBUTE_VISIBLE, this->isVisible());
}
@@ -385,7 +385,7 @@ void render_shadow(SkCanvas* canvas, const SkPath& path, SkDrawShadowRec rec) {
void apply_paint_blend_mode(const SkPaint& paint, SkJSONWriter& writer) {
const auto mode = paint.getBlendMode_or(SkBlendMode::kSrcOver);
if (mode != SkBlendMode::kSrcOver) {
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_BLENDMODE, SkBlendMode_Name(mode));
+ writer.appendCString(DEBUGCANVAS_ATTRIBUTE_BLENDMODE, SkBlendMode_Name(mode));
}
}
@@ -489,23 +489,23 @@ void DrawCommand::MakeJsonPath(SkJSONWriter& writer, const SkPath& path) {
SkDynamicMemoryWStream wstream;
path.dump(&wstream, false);
auto data = wstream.detachAsData();
- SkString dumpString((char*)data->bytes(), data->size());
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_DUMP, dumpString.c_str());
+ writer.appendString(DEBUGCANVAS_ATTRIBUTE_DUMP,
+ static_cast<const char*>(data->data()), data->size());
switch (path.getFillType()) {
case SkPathFillType::kWinding:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_FILLTYPE, DEBUGCANVAS_FILLTYPE_WINDING);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_FILLTYPE, DEBUGCANVAS_FILLTYPE_WINDING);
break;
case SkPathFillType::kEvenOdd:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_FILLTYPE, DEBUGCANVAS_FILLTYPE_EVENODD);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_FILLTYPE, DEBUGCANVAS_FILLTYPE_EVENODD);
break;
case SkPathFillType::kInverseWinding:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_FILLTYPE,
- DEBUGCANVAS_FILLTYPE_INVERSEWINDING);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_FILLTYPE,
+ DEBUGCANVAS_FILLTYPE_INVERSEWINDING);
break;
case SkPathFillType::kInverseEvenOdd:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_FILLTYPE,
- DEBUGCANVAS_FILLTYPE_INVERSEEVENODD);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_FILLTYPE,
+ DEBUGCANVAS_FILLTYPE_INVERSEEVENODD);
break;
}
writer.beginArray(DEBUGCANVAS_ATTRIBUTE_VERBS);
@@ -514,7 +514,7 @@ void DrawCommand::MakeJsonPath(SkJSONWriter& writer, const SkPath& path) {
SkPath::Verb verb;
while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
if (verb == SkPath::kClose_Verb) {
- writer.appendString(DEBUGCANVAS_VERB_CLOSE);
+ writer.appendNString(DEBUGCANVAS_VERB_CLOSE);
continue;
}
writer.beginObject(); // verb
@@ -630,8 +630,8 @@ void DrawCommand::flatten(const SkFlattenable* flattenable,
buffer.writeToMemory(data);
SkString url =
encode_data(data, buffer.bytesWritten(), "application/octet-stream", urlDataManager);
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_NAME, flattenable->getTypeName());
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_DATA, url.c_str());
+ writer.appendCString(DEBUGCANVAS_ATTRIBUTE_NAME, flattenable->getTypeName());
+ writer.appendString(DEBUGCANVAS_ATTRIBUTE_DATA, url);
writer.beginObject(DEBUGCANVAS_ATTRIBUTE_VALUES);
JsonWriteBuffer jsonBuffer(&writer, &urlDataManager);
@@ -696,8 +696,8 @@ bool DrawCommand::flatten(const SkImage& image,
writer.endObject();
return false;
}
- SkString url = encode_data(encoded->data(), encoded->size(), "image/png", urlDataManager);
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_DATA, url.c_str());
+ SkString url = encode_data(encoded->data(), encoded->size(), "image/png", urlDataManager);
+ writer.appendString(DEBUGCANVAS_ATTRIBUTE_DATA, url);
writer.endObject();
return true;
}
@@ -727,8 +727,8 @@ bool DrawCommand::flatten(const SkBitmap& bitmap,
SkJSONWriter& writer,
UrlDataManager& urlDataManager) {
sk_sp<SkImage> image(bitmap.asImage());
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_COLOR, color_type_name(bitmap.colorType()));
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_ALPHA, alpha_type_name(bitmap.alphaType()));
+ writer.appendCString(DEBUGCANVAS_ATTRIBUTE_COLOR, color_type_name(bitmap.colorType()));
+ writer.appendCString(DEBUGCANVAS_ATTRIBUTE_ALPHA, alpha_type_name(bitmap.alphaType()));
// Image will appear to have no uses, TODO(nifong): provide the user with a useful explanation
bool success = flatten(*image, writer, urlDataManager);
return success;
@@ -739,16 +739,16 @@ static void apply_font_hinting(const SkFont& font, SkJSONWriter& writer) {
if (hinting != SkPaintDefaults_Hinting) {
switch (hinting) {
case SkFontHinting::kNone:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_HINTING, DEBUGCANVAS_HINTING_NONE);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_HINTING, DEBUGCANVAS_HINTING_NONE);
break;
case SkFontHinting::kSlight:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_HINTING, DEBUGCANVAS_HINTING_SLIGHT);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_HINTING, DEBUGCANVAS_HINTING_SLIGHT);
break;
case SkFontHinting::kNormal:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_HINTING, DEBUGCANVAS_HINTING_NORMAL);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_HINTING, DEBUGCANVAS_HINTING_NORMAL);
break;
case SkFontHinting::kFull:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_HINTING, DEBUGCANVAS_HINTING_FULL);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_HINTING, DEBUGCANVAS_HINTING_FULL);
break;
}
}
@@ -757,13 +757,14 @@ static void apply_font_hinting(const SkFont& font, SkJSONWriter& writer) {
static void apply_font_edging(const SkFont& font, SkJSONWriter& writer) {
switch (font.getEdging()) {
case SkFont::Edging::kAlias:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_EDGING, DEBUGCANVAS_EDGING_ALIAS);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_EDGING, DEBUGCANVAS_EDGING_ALIAS);
break;
case SkFont::Edging::kAntiAlias:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_EDGING, DEBUGCANVAS_EDGING_ANTIALIAS);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_EDGING, DEBUGCANVAS_EDGING_ANTIALIAS);
break;
case SkFont::Edging::kSubpixelAntiAlias:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_EDGING, DEBUGCANVAS_EDGING_SUBPIXELANTIALIAS);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_EDGING,
+ DEBUGCANVAS_EDGING_SUBPIXELANTIALIAS);
break;
}
}
@@ -781,11 +782,11 @@ static void apply_paint_style(const SkPaint& paint, SkJSONWriter& writer) {
if (style != SkPaint::kFill_Style) {
switch (style) {
case SkPaint::kStroke_Style: {
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_STYLE, DEBUGCANVAS_STYLE_STROKE);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_STYLE, DEBUGCANVAS_STYLE_STROKE);
break;
}
case SkPaint::kStrokeAndFill_Style: {
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_STYLE, DEBUGCANVAS_STYLE_STROKEANDFILL);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_STYLE, DEBUGCANVAS_STYLE_STROKEANDFILL);
break;
}
default: SkASSERT(false);
@@ -798,13 +799,13 @@ static void apply_paint_cap(const SkPaint& paint, SkJSONWriter& writer) {
if (cap != SkPaint::kDefault_Cap) {
switch (cap) {
case SkPaint::kButt_Cap:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_CAP, DEBUGCANVAS_CAP_BUTT);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_CAP, DEBUGCANVAS_CAP_BUTT);
break;
case SkPaint::kRound_Cap:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_CAP, DEBUGCANVAS_CAP_ROUND);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_CAP, DEBUGCANVAS_CAP_ROUND);
break;
case SkPaint::kSquare_Cap:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_CAP, DEBUGCANVAS_CAP_SQUARE);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_CAP, DEBUGCANVAS_CAP_SQUARE);
break;
default: SkASSERT(false);
}
@@ -816,13 +817,13 @@ static void apply_paint_join(const SkPaint& paint, SkJSONWriter& writer) {
if (join != SkPaint::kDefault_Join) {
switch (join) {
case SkPaint::kMiter_Join:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_STROKEJOIN, DEBUGCANVAS_MITER_JOIN);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_STROKEJOIN, DEBUGCANVAS_MITER_JOIN);
break;
case SkPaint::kRound_Join:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_STROKEJOIN, DEBUGCANVAS_ROUND_JOIN);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_STROKEJOIN, DEBUGCANVAS_ROUND_JOIN);
break;
case SkPaint::kBevel_Join:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_STROKEJOIN, DEBUGCANVAS_BEVEL_JOIN);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_STROKEJOIN, DEBUGCANVAS_BEVEL_JOIN);
break;
default: SkASSERT(false);
}
@@ -840,16 +841,16 @@ static void apply_paint_maskfilter(const SkPaint& paint,
writer.appendFloat(DEBUGCANVAS_ATTRIBUTE_SIGMA, blurRec.fSigma);
switch (blurRec.fStyle) {
case SkBlurStyle::kNormal_SkBlurStyle:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_STYLE, DEBUGCANVAS_BLURSTYLE_NORMAL);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_STYLE, DEBUGCANVAS_BLURSTYLE_NORMAL);
break;
case SkBlurStyle::kSolid_SkBlurStyle:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_STYLE, DEBUGCANVAS_BLURSTYLE_SOLID);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_STYLE, DEBUGCANVAS_BLURSTYLE_SOLID);
break;
case SkBlurStyle::kOuter_SkBlurStyle:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_STYLE, DEBUGCANVAS_BLURSTYLE_OUTER);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_STYLE, DEBUGCANVAS_BLURSTYLE_OUTER);
break;
case SkBlurStyle::kInner_SkBlurStyle:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_STYLE, DEBUGCANVAS_BLURSTYLE_INNER);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_STYLE, DEBUGCANVAS_BLURSTYLE_INNER);
break;
default: SkASSERT(false);
}
@@ -901,7 +902,7 @@ static void apply_font_typeface(const SkFont& font,
buffer.copyTo(data);
SkString url = encode_data(
data, buffer.bytesWritten(), "application/octet-stream", urlDataManager);
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_DATA, url.c_str());
+ writer.appendString(DEBUGCANVAS_ATTRIBUTE_DATA, url);
sk_free(data);
writer.endObject();
}
@@ -1023,7 +1024,7 @@ void ClipPathCommand::toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManage
INHERITED::toJSON(writer, urlDataManager);
writer.appendName(DEBUGCANVAS_ATTRIBUTE_PATH);
MakeJsonPath(writer, fPath);
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_REGIONOP, clipop_name(fOp));
+ writer.appendCString(DEBUGCANVAS_ATTRIBUTE_REGIONOP, clipop_name(fOp));
writer.appendBool(DEBUGCANVAS_ATTRIBUTE_ANTIALIAS, fDoAA);
}
@@ -1039,7 +1040,7 @@ void ClipRegionCommand::toJSON(SkJSONWriter& writer, UrlDataManager& urlDataMana
INHERITED::toJSON(writer, urlDataManager);
writer.appendName(DEBUGCANVAS_ATTRIBUTE_REGION);
MakeJsonRegion(writer, fRegion);
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_REGIONOP, clipop_name(fOp));
+ writer.appendCString(DEBUGCANVAS_ATTRIBUTE_REGIONOP, clipop_name(fOp));
}
ClipRectCommand::ClipRectCommand(const SkRect& rect, SkClipOp op, bool doAA)
@@ -1055,11 +1056,11 @@ void ClipRectCommand::toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManage
INHERITED::toJSON(writer, urlDataManager);
writer.appendName(DEBUGCANVAS_ATTRIBUTE_COORDS);
MakeJsonRect(writer, fRect);
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_REGIONOP, clipop_name(fOp));
+ writer.appendCString(DEBUGCANVAS_ATTRIBUTE_REGIONOP, clipop_name(fOp));
writer.appendBool(DEBUGCANVAS_ATTRIBUTE_ANTIALIAS, fDoAA);
SkString desc;
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, str_append(&desc, fRect)->c_str());
+ writer.appendString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, *str_append(&desc, fRect));
}
ClipRRectCommand::ClipRRectCommand(const SkRRect& rrect, SkClipOp op, bool doAA)
@@ -1080,7 +1081,7 @@ void ClipRRectCommand::toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManag
INHERITED::toJSON(writer, urlDataManager);
writer.appendName(DEBUGCANVAS_ATTRIBUTE_COORDS);
make_json_rrect(writer, fRRect);
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_REGIONOP, clipop_name(fOp));
+ writer.appendCString(DEBUGCANVAS_ATTRIBUTE_REGIONOP, clipop_name(fOp));
writer.appendBool(DEBUGCANVAS_ATTRIBUTE_ANTIALIAS, fDoAA);
}
@@ -1102,7 +1103,7 @@ bool ClipShaderCommand::render(SkCanvas* canvas) const {
void ClipShaderCommand::toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const {
INHERITED::toJSON(writer, urlDataManager);
apply_flattenable(DEBUGCANVAS_ATTRIBUTE_SHADER, fShader.get(), writer, urlDataManager);
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_REGIONOP, clipop_name(fOp));
+ writer.appendCString(DEBUGCANVAS_ATTRIBUTE_REGIONOP, clipop_name(fOp));
}
ResetClipCommand::ResetClipCommand() : INHERITED(kResetClip_OpType) {}
@@ -1119,16 +1120,16 @@ namespace {
void writeMatrixType(SkJSONWriter& writer, const SkMatrix& m) {
switch (m.getType()) {
case SkMatrix::kTranslate_Mask:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, " (translate)");
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, " (translate)");
break;
case SkMatrix::kScale_Mask:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, " (scale)");
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, " (scale)");
break;
case SkMatrix::kAffine_Mask:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, " (rotation or skew)");
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, " (rotation or skew)");
break;
case SkMatrix::kPerspective_Mask:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, " (perspective)");
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, " (perspective)");
break;
default:
break;
@@ -1171,16 +1172,14 @@ void DrawAnnotationCommand::toJSON(SkJSONWriter& writer, UrlDataManager& urlData
writer.appendName(DEBUGCANVAS_ATTRIBUTE_COORDS);
MakeJsonRect(writer, fRect);
- writer.appendString("key", fKey.c_str());
+ writer.appendString("key", fKey);
if (fValue) {
- writer.appendString("value", std::string(
- static_cast<const char*>(fValue->data()), fValue->size()
- ).c_str());
+ writer.appendString("value", static_cast<const char*>(fValue->data()), fValue->size());
}
SkString desc;
str_append(&desc, fRect)->appendf(" %s", fKey.c_str());
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, desc.c_str());
+ writer.appendString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, desc);
}
////
@@ -1234,16 +1233,16 @@ void DrawImageCommand::toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManag
writer.appendS32(DEBUGCANVAS_ATTRIBUTE_HEIGHT, fImage->height());
switch (fImage->alphaType()) {
case kOpaque_SkAlphaType:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_ALPHA, DEBUGCANVAS_ALPHATYPE_OPAQUE);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_ALPHA, DEBUGCANVAS_ALPHATYPE_OPAQUE);
break;
case kPremul_SkAlphaType:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_ALPHA, DEBUGCANVAS_ALPHATYPE_PREMUL);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_ALPHA, DEBUGCANVAS_ALPHATYPE_PREMUL);
break;
case kUnpremul_SkAlphaType:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_ALPHA, DEBUGCANVAS_ALPHATYPE_UNPREMUL);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_ALPHA, DEBUGCANVAS_ALPHATYPE_UNPREMUL);
break;
default:
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_ALPHA, DEBUGCANVAS_ALPHATYPE_UNKNOWN);
+ writer.appendNString(DEBUGCANVAS_ATTRIBUTE_ALPHA, DEBUGCANVAS_ALPHATYPE_UNKNOWN);
break;
}
}
@@ -1291,7 +1290,7 @@ void DrawImageLatticeCommand::toJSON(SkJSONWriter& writer, UrlDataManager& urlDa
}
SkString desc;
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, str_append(&desc, fDst)->c_str());
+ writer.appendString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, *str_append(&desc, fDst));
}
DrawImageRectCommand::DrawImageRectCommand(const SkImage* image,
@@ -1344,7 +1343,7 @@ void DrawImageRectCommand::toJSON(SkJSONWriter& writer, UrlDataManager& urlDataM
}
SkString desc;
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, str_append(&desc, fDst)->c_str());
+ writer.appendString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, *str_append(&desc, fDst));
}
DrawImageRectLayerCommand::DrawImageRectLayerCommand(DebugLayerManager* layerManager,
@@ -1405,7 +1404,7 @@ void DrawImageRectLayerCommand::toJSON(SkJSONWriter& writer, UrlDataManager& url
}
SkString desc;
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, str_append(&desc, fDst)->c_str());
+ writer.appendString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, *str_append(&desc, fDst));
}
DrawOvalCommand::DrawOvalCommand(const SkRect& oval, const SkPaint& paint)
@@ -1646,7 +1645,7 @@ bool DrawPointsCommand::render(SkCanvas* canvas) const {
void DrawPointsCommand::toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const {
INHERITED::toJSON(writer, urlDataManager);
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_MODE, pointmode_name(fMode));
+ writer.appendCString(DEBUGCANVAS_ATTRIBUTE_MODE, pointmode_name(fMode));
writer.beginArray(DEBUGCANVAS_ATTRIBUTE_POINTS);
for (int i = 0; i < fPts.count(); i++) {
MakeJsonPoint(writer, fPts[i]);
@@ -1734,7 +1733,7 @@ void DrawTextBlobCommand::toJSON(SkJSONWriter& writer, UrlDataManager& urlDataMa
SkString desc;
// make the bounds local by applying the x,y
bounds.offset(fXPos, fYPos);
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, str_append(&desc, bounds)->c_str());
+ writer.appendString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, *str_append(&desc, bounds));
}
DrawPatchCommand::DrawPatchCommand(const SkPoint cubics[12],
@@ -1803,7 +1802,7 @@ void DrawRectCommand::toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManage
MakeJsonPaint(writer, fPaint, urlDataManager);
SkString desc;
- writer.appendString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, str_append(&desc, fRect)->c_str());
+ writer.appendString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, *str_append(&desc, fRect));
}
DrawRRectCommand::DrawRRectCommand(const SkRRect& rrect, const SkPaint& paint)
diff --git a/chromium/third_party/skia/tools/debugger/JsonWriteBuffer.cpp b/chromium/third_party/skia/tools/debugger/JsonWriteBuffer.cpp
index fed1d8dd32b..06abe5fbf46 100644
--- a/chromium/third_party/skia/tools/debugger/JsonWriteBuffer.cpp
+++ b/chromium/third_party/skia/tools/debugger/JsonWriteBuffer.cpp
@@ -35,7 +35,7 @@ void JsonWriteBuffer::writePad32(const void* data, size_t size) {
const uint8_t* bytes = reinterpret_cast<const uint8_t*>(data);
for (size_t i = 0; i < size; ++i) {
SkString hexByte = SkStringPrintf("%02x", bytes[i]);
- fWriter->appendString(hexByte.c_str());
+ fWriter->appendString(hexByte);
}
fWriter->endArray();
}
@@ -46,7 +46,7 @@ void JsonWriteBuffer::writeByteArray(const void* data, size_t size) {
const uint8_t* bytes = reinterpret_cast<const uint8_t*>(data);
for (size_t i = 0; i < size; ++i) {
SkString hexByte = SkStringPrintf("%02x", bytes[i]);
- fWriter->appendString(hexByte.c_str());
+ fWriter->appendString(hexByte);
}
fWriter->endArray();
}
@@ -89,9 +89,9 @@ void JsonWriteBuffer::writeUInt(uint32_t value) {
fWriter->appendU32(value);
}
-void JsonWriteBuffer::writeString(const char* value) {
+void JsonWriteBuffer::writeString(std::string_view value) {
this->append("string");
- fWriter->appendString(value);
+ fWriter->appendString(value.data(), value.size());
}
void JsonWriteBuffer::writeFlattenable(const SkFlattenable* flattenable) {
diff --git a/chromium/third_party/skia/tools/debugger/JsonWriteBuffer.h b/chromium/third_party/skia/tools/debugger/JsonWriteBuffer.h
index ba160570d6e..4f460331d51 100644
--- a/chromium/third_party/skia/tools/debugger/JsonWriteBuffer.h
+++ b/chromium/third_party/skia/tools/debugger/JsonWriteBuffer.h
@@ -14,6 +14,8 @@
#include "include/core/SkTypes.h"
#include "src/core/SkWriteBuffer.h"
+#include <string_view>
+
class SkFlattenable;
class SkImage;
class SkJSONWriter;
@@ -43,7 +45,7 @@ public:
void writeInt(int32_t value) override;
void writeIntArray(const int32_t* value, uint32_t count) override;
void writeUInt(uint32_t value) override;
- void writeString(const char* value) override;
+ void writeString(std::string_view value) override;
void writeFlattenable(const SkFlattenable* flattenable) override;
void writeColor(SkColor color) override;
diff --git a/chromium/third_party/skia/tools/flags/BUILD.bazel b/chromium/third_party/skia/tools/flags/BUILD.bazel
index 0172e8e5329..6ca22d1851b 100644
--- a/chromium/third_party/skia/tools/flags/BUILD.bazel
+++ b/chromium/third_party/skia/tools/flags/BUILD.bazel
@@ -5,11 +5,14 @@ licenses(["notice"])
exports_files_legacy()
filegroup(
- name = "core_srcs",
+ name = "flags",
testonly = True,
srcs = [
"CommandLineFlags.cpp",
"CommandLineFlags.h",
],
- visibility = ["//tools:__subpackages__"],
+ visibility = [
+ "//modules/skottie:__pkg__",
+ "//tools:__subpackages__",
+ ],
)
diff --git a/chromium/third_party/skia/tools/flags/CommandLineFlags.cpp b/chromium/third_party/skia/tools/flags/CommandLineFlags.cpp
index 02b93b43a77..bb4d6f5ad59 100644
--- a/chromium/third_party/skia/tools/flags/CommandLineFlags.cpp
+++ b/chromium/third_party/skia/tools/flags/CommandLineFlags.cpp
@@ -76,12 +76,12 @@ static bool string_is_in(const char* target, const char* set[], size_t len) {
*/
static bool parse_bool_arg(const char* string, bool* result) {
static const char* trueValues[] = {"1", "TRUE", "true"};
- if (string_is_in(string, trueValues, SK_ARRAY_COUNT(trueValues))) {
+ if (string_is_in(string, trueValues, std::size(trueValues))) {
*result = true;
return true;
}
static const char* falseValues[] = {"0", "FALSE", "false"};
- if (string_is_in(string, falseValues, SK_ARRAY_COUNT(falseValues))) {
+ if (string_is_in(string, falseValues, std::size(falseValues))) {
*result = false;
return true;
}
diff --git a/chromium/third_party/skia/tools/flags/CommonFlagsConfig.cpp b/chromium/third_party/skia/tools/flags/CommonFlagsConfig.cpp
index fd531d76d2c..f006b5b6ab2 100644
--- a/chromium/third_party/skia/tools/flags/CommonFlagsConfig.cpp
+++ b/chromium/third_party/skia/tools/flags/CommonFlagsConfig.cpp
@@ -232,24 +232,28 @@ SkCommandLineConfig::SkCommandLineConfig(const SkString& tag,
const SkString& backend,
const SkTArray<SkString>& viaParts)
: fTag(tag), fBackend(backend) {
-
- static std::unordered_map<std::string_view, sk_sp<SkColorSpace>> kColorSpaces = {
- // 'narrow' has a gamut narrower than sRGB, and different transfer function.
- { "narrow", SkColorSpace::MakeRGB(SkNamedTransferFn::k2Dot2, gNarrow_toXYZD50) },
- { "srgb", SkColorSpace::MakeSRGB() },
- { "linear", SkColorSpace::MakeSRGBLinear() },
- { "p3", SkColorSpace::MakeRGB(SkNamedTransferFn::kSRGB, SkNamedGamut::kDisplayP3) },
- { "spin", SkColorSpace::MakeSRGB()->makeColorSpin() },
- { "rec2020", SkColorSpace::MakeRGB(SkNamedTransferFn::kRec2020, SkNamedGamut::kRec2020) },
+ static const auto* kColorSpaces = new std::unordered_map<std::string_view, SkColorSpace*>{
+ {"narrow", // 'narrow' has a gamut narrower than sRGB, and different transfer function.
+ SkColorSpace::MakeRGB(SkNamedTransferFn::k2Dot2, gNarrow_toXYZD50).release()},
+ {"srgb",
+ SkColorSpace::MakeSRGB().release()},
+ {"linear",
+ SkColorSpace::MakeSRGBLinear().release()},
+ {"p3",
+ SkColorSpace::MakeRGB(SkNamedTransferFn::kSRGB, SkNamedGamut::kDisplayP3).release()},
+ {"spin",
+ SkColorSpace::MakeSRGB()->makeColorSpin().release()},
+ {"rec2020",
+ SkColorSpace::MakeRGB(SkNamedTransferFn::kRec2020, SkNamedGamut::kRec2020).release()},
};
// Strip off any via parts that refer to color spaces (and remember the last one we see)
for (const SkString& via : viaParts) {
- auto it = kColorSpaces.find(via.c_str());
- if (it == kColorSpaces.end()) {
+ auto it = kColorSpaces->find(via.c_str());
+ if (it == kColorSpaces->end()) {
fViaParts.push_back(via);
} else {
- fColorSpace = it->second;
+ fColorSpace = sk_ref_sp(it->second);
}
}
}
diff --git a/chromium/third_party/skia/tools/fm/fm.cpp b/chromium/third_party/skia/tools/fm/fm.cpp
index 9f893567f20..452a8e6da02 100644
--- a/chromium/third_party/skia/tools/fm/fm.cpp
+++ b/chromium/third_party/skia/tools/fm/fm.cpp
@@ -209,7 +209,7 @@ static void init(Source* source, sk_sp<skottie::Animation> animation) {
// Draw frames in a shuffled order to exercise nonlinear frame progression.
// The film strip will still be in time order, just drawn out of order.
const int order[] = { 4, 0, 3, 1, 2 };
- const int tiles = SK_ARRAY_COUNT(order);
+ const int tiles = std::size(order);
const float dim = 1000.0f / tiles;
const float dt = 1.0f / (tiles*tiles - 1);
diff --git a/chromium/third_party/skia/tools/fonts/TestSVGTypeface.cpp b/chromium/third_party/skia/tools/fonts/TestSVGTypeface.cpp
index 2a044321c5b..8cd046c18d3 100644
--- a/chromium/third_party/skia/tools/fonts/TestSVGTypeface.cpp
+++ b/chromium/third_party/skia/tools/fonts/TestSVGTypeface.cpp
@@ -344,7 +344,7 @@ sk_sp<TestSVGTypeface> TestSVGTypeface::Default() {
return sk_make_sp<DefaultTypeface>("Emoji",
1000,
metrics,
- SkMakeSpan(glyphs),
+ glyphs,
SkFontStyle::Normal());
}
@@ -394,7 +394,7 @@ sk_sp<TestSVGTypeface> TestSVGTypeface::Planets() {
return sk_make_sp<PlanetTypeface>("Planets",
200,
metrics,
- SkMakeSpan(glyphs),
+ glyphs,
SkFontStyle::Normal());
}
diff --git a/chromium/third_party/skia/tools/fonts/create_test_font.cpp b/chromium/third_party/skia/tools/fonts/create_test_font.cpp
index a187aed7c31..b3f67d6873f 100644
--- a/chromium/third_party/skia/tools/fonts/create_test_font.cpp
+++ b/chromium/third_party/skia/tools/fonts/create_test_font.cpp
@@ -254,7 +254,7 @@ static void output_font(sk_sp<SkTypeface> face, const char* identifier, FILE* ou
widthsStr = strip_final(widthsStr);
fprintf(out, "%s\n};\n\n", widthsStr.c_str());
- fprintf(out, "const size_t %sCharCodesCount = SK_ARRAY_COUNT(%sCharCodes);\n\n",
+ fprintf(out, "const size_t %sCharCodesCount = std::size(%sCharCodes);\n\n",
identifier, identifier);
SkFontMetrics metrics;
@@ -403,12 +403,12 @@ int main(int , char * const []) {
};
static constexpr FontFamilyDesc kFamiliesData[] = {
- {"monospace", "Liberation Mono", "LiberationMono", SkMakeSpan(kMonoFonts)},
- {"sans-serif", "Liberation Sans", "LiberationSans", SkMakeSpan(kSansFonts)},
- {"serif", "Liberation Serif", "LiberationSerif", SkMakeSpan(kSerifFonts)},
+ {"monospace", "Liberation Mono", "LiberationMono", kMonoFonts},
+ {"sans-serif", "Liberation Sans", "LiberationSans", kSansFonts},
+ {"serif", "Liberation Serif", "LiberationSerif", kSerifFonts},
};
- static constexpr SkSpan<const FontFamilyDesc> kFamilies(SkMakeSpan(kFamiliesData));
+ static constexpr SkSpan<const FontFamilyDesc> kFamilies(kFamiliesData);
#ifdef SK_BUILD_FOR_UNIX
generate_fonts("/usr/share/fonts/truetype/liberation/", kFamilies);
diff --git a/chromium/third_party/skia/tools/fonts/create_test_font_color.cpp b/chromium/third_party/skia/tools/fonts/create_test_font_color.cpp
index 6b1a0a6bca6..1ba7f9867e3 100644
--- a/chromium/third_party/skia/tools/fonts/create_test_font_color.cpp
+++ b/chromium/third_party/skia/tools/fonts/create_test_font_color.cpp
@@ -45,9 +45,9 @@ int main(int argc, char** argv) {
// But the planet font cannot get very big in the size limited cbdt format.
unsigned small[] = { 8, 16 };
- export_ttx(TestSVGTypeface::Default(), SkString(), SkMakeSpan(usual), SkMakeSpan(usual));
+ export_ttx(TestSVGTypeface::Default(), SkString(), SkSpan(usual), SkSpan(usual));
export_ttx(
- TestSVGTypeface::Planets(), SkString("planet"), SkMakeSpan(small), SkMakeSpan(usual));
+ TestSVGTypeface::Planets(), SkString("planet"), SkSpan(small), SkSpan(usual));
return 0;
}
diff --git a/chromium/third_party/skia/tools/fonts/test_font_monospace.inc b/chromium/third_party/skia/tools/fonts/test_font_monospace.inc
index bb87f93688c..1fe37d0a261 100644
--- a/chromium/third_party/skia/tools/fonts/test_font_monospace.inc
+++ b/chromium/third_party/skia/tools/fonts/test_font_monospace.inc
@@ -1190,7 +1190,7 @@ const SkFixed LiberationMonoNormalWidths[] = {
0x000099a0, 0x000099a0, 0x000099a0, 0x000099a0, 0x000099a0
};
-const size_t LiberationMonoNormalCharCodesCount = SK_ARRAY_COUNT(LiberationMonoNormalCharCodes);
+const size_t LiberationMonoNormalCharCodesCount = std::size(LiberationMonoNormalCharCodes);
const SkFontMetrics LiberationMonoNormalMetrics = {
0x0000000f, -0.83252f, -0.83252f, 0.300293f, 0.300293f, 0, 0.600098f, 0.633301f, -0.0244141f,
@@ -2340,7 +2340,7 @@ const SkFixed LiberationMonoBoldWidths[] = {
0x000099a0, 0x000099a0, 0x000099a0, 0x000099a0, 0x000099a0
};
-const size_t LiberationMonoBoldCharCodesCount = SK_ARRAY_COUNT(LiberationMonoBoldCharCodes);
+const size_t LiberationMonoBoldCharCodesCount = std::size(LiberationMonoBoldCharCodes);
const SkFontMetrics LiberationMonoBoldMetrics = {
0x0000000f, -0.833496f, -0.833496f, 0.300293f, 0.300293f, 0, 0.600098f, 0.641602f, -0.0268555f,
@@ -3606,7 +3606,7 @@ const SkFixed LiberationMonoItalicWidths[] = {
0x000099a0, 0x000099a0, 0x000099a0, 0x000099a0, 0x000099a0
};
-const size_t LiberationMonoItalicCharCodesCount = SK_ARRAY_COUNT(LiberationMonoItalicCharCodes);
+const size_t LiberationMonoItalicCharCodesCount = std::size(LiberationMonoItalicCharCodes);
const SkFontMetrics LiberationMonoItalicMetrics = {
0x0000000f, -0.833496f, -0.833496f, 0.300293f, 0.300293f, 0, 0.600098f, 0.798828f, -0.0942383f,
@@ -4839,7 +4839,7 @@ const SkFixed LiberationMonoBoldItalicWidths[] = {
0x000099a0, 0x000099a0, 0x000099a0, 0x000099a0, 0x000099a0
};
-const size_t LiberationMonoBoldItalicCharCodesCount = SK_ARRAY_COUNT(LiberationMonoBoldItalicCharCodes);
+const size_t LiberationMonoBoldItalicCharCodesCount = std::size(LiberationMonoBoldItalicCharCodes);
const SkFontMetrics LiberationMonoBoldItalicMetrics = {
0x0000000f, -0.83252f, -0.83252f, 0.300293f, 0.300293f, 0, 0.600098f, 0.791992f, -0.0942383f,
diff --git a/chromium/third_party/skia/tools/fonts/test_font_sans_serif.inc b/chromium/third_party/skia/tools/fonts/test_font_sans_serif.inc
index b53da191780..17e1f02bc13 100644
--- a/chromium/third_party/skia/tools/fonts/test_font_sans_serif.inc
+++ b/chromium/third_party/skia/tools/fonts/test_font_sans_serif.inc
@@ -1184,7 +1184,7 @@ const SkFixed LiberationSansNormalWidths[] = {
0x00008000, 0x00005580, 0x00004280, 0x00005580, 0x00009580
};
-const size_t LiberationSansNormalCharCodesCount = SK_ARRAY_COUNT(LiberationSansNormalCharCodes);
+const size_t LiberationSansNormalCharCodesCount = std::size(LiberationSansNormalCharCodes);
const SkFontMetrics LiberationSansNormalMetrics = {
0x0000000f, -0.910156f, -0.905273f, 0.211914f, 0.303223f, 0.0327148f, 0.589355f, 1.25342f,
@@ -2348,7 +2348,7 @@ const SkFixed LiberationSansBoldWidths[] = {
0x00008000, 0x000063a0, 0x000047a0, 0x000063a0, 0x00009580
};
-const size_t LiberationSansBoldCharCodesCount = SK_ARRAY_COUNT(LiberationSansBoldCharCodes);
+const size_t LiberationSansBoldCharCodesCount = std::size(LiberationSansBoldCharCodes);
const SkFontMetrics LiberationSansBoldMetrics = {
0x0000000f, -1.0332f, -0.905273f, 0.211914f, 0.303223f, 0.0327148f, 0.612305f, 1.24609f,
@@ -3589,7 +3589,7 @@ const SkFixed LiberationSansItalicWidths[] = {
0x00008000, 0x00005580, 0x00004280, 0x00005580, 0x00009580
};
-const size_t LiberationSansItalicCharCodesCount = SK_ARRAY_COUNT(LiberationSansItalicCharCodes);
+const size_t LiberationSansItalicCharCodesCount = std::size(LiberationSansItalicCharCodes);
const SkFontMetrics LiberationSansItalicMetrics = {
0x0000000f, -1.01416f, -0.905273f, 0.211914f, 0.303223f, 0.0327148f, 0.590332f, 1.33447f,
@@ -4849,7 +4849,7 @@ const SkFixed LiberationSansBoldItalicWidths[] = {
0x00008000, 0x000063a0, 0x000047a0, 0x000063a0, 0x00009580
};
-const size_t LiberationSansBoldItalicCharCodesCount = SK_ARRAY_COUNT(LiberationSansBoldItalicCharCodes);
+const size_t LiberationSansBoldItalicCharCodesCount = std::size(LiberationSansBoldItalicCharCodes);
const SkFontMetrics LiberationSansBoldItalicMetrics = {
0x0000000f, -1.02979f, -0.905273f, 0.211914f, 0.303223f, 0.0327148f, 0.61377f, 1.3374f,
diff --git a/chromium/third_party/skia/tools/fonts/test_font_serif.inc b/chromium/third_party/skia/tools/fonts/test_font_serif.inc
index 816e0946467..3da47e064b7 100644
--- a/chromium/third_party/skia/tools/fonts/test_font_serif.inc
+++ b/chromium/third_party/skia/tools/fonts/test_font_serif.inc
@@ -1261,7 +1261,7 @@ const SkFixed LiberationSerifNormalWidths[] = {
0x000071a0, 0x00007ae0, 0x00003340, 0x00007ae0, 0x00008a80
};
-const size_t LiberationSerifNormalCharCodesCount = SK_ARRAY_COUNT(LiberationSerifNormalCharCodes);
+const size_t LiberationSerifNormalCharCodesCount = std::size(LiberationSerifNormalCharCodes);
const SkFontMetrics LiberationSerifNormalMetrics = {
0x0000000f, -0.981445f, -0.891113f, 0.216309f, 0.303223f, 0.0424805f, 0.567383f, 1.18359f,
@@ -2511,7 +2511,7 @@ const SkFixed LiberationSerifBoldWidths[] = {
0x000071a0, 0x000064e0, 0x00003860, 0x000064e0, 0x00008520
};
-const size_t LiberationSerifBoldCharCodesCount = SK_ARRAY_COUNT(LiberationSerifBoldCharCodes);
+const size_t LiberationSerifBoldCharCodesCount = std::size(LiberationSerifBoldCharCodes);
const SkFontMetrics LiberationSerifBoldMetrics = {
0x0000000f, -1.00781f, -0.891113f, 0.216309f, 0.303223f, 0.0424805f, 0.59375f, 1.26709f,
@@ -3829,7 +3829,7 @@ const SkFixed LiberationSerifItalicWidths[] = {
0x000063a0, 0x00006660, 0x00004660, 0x00006660, 0x00008a80
};
-const size_t LiberationSerifItalicCharCodesCount = SK_ARRAY_COUNT(LiberationSerifItalicCharCodes);
+const size_t LiberationSerifItalicCharCodesCount = std::size(LiberationSerifItalicCharCodes);
const SkFontMetrics LiberationSerifItalicMetrics = {
0x0000000f, -0.980957f, -0.891113f, 0.216309f, 0.303223f, 0.0424805f, 0.559082f, 1.26465f,
@@ -5141,7 +5141,8 @@ const SkFixed LiberationSerifBoldItalicWidths[] = {
0x000063a0, 0x00005920, 0x00003860, 0x00005920, 0x000091e0
};
-const size_t LiberationSerifBoldItalicCharCodesCount = SK_ARRAY_COUNT(LiberationSerifBoldItalicCharCodes);
+const size_t LiberationSerifBoldItalicCharCodesCount
+ = std::size(LiberationSerifBoldItalicCharCodes);
const SkFontMetrics LiberationSerifBoldItalicMetrics = {
0x0000000f, -0.980957f, -0.891113f, 0.216309f, 0.303223f, 0.0424805f, 0.578125f, 1.32861f,
diff --git a/chromium/third_party/skia/tools/git-sync-deps b/chromium/third_party/skia/tools/git-sync-deps
index b09d17669a9..b85af15305f 100755
--- a/chromium/third_party/skia/tools/git-sync-deps
+++ b/chromium/third_party/skia/tools/git-sync-deps
@@ -94,7 +94,8 @@ def is_git_toplevel(git, directory):
try:
toplevel = subprocess.check_output(
[git, 'rev-parse', '--show-toplevel'], cwd=directory).strip()
- return os.path.realpath(directory) == os.path.realpath(toplevel.decode())
+ return (os.path.normcase(os.path.realpath(directory)) ==
+ os.path.normcase(os.path.realpath(toplevel.decode())))
except subprocess.CalledProcessError:
return False
diff --git a/chromium/third_party/skia/tools/gpu/BUILD.bazel b/chromium/third_party/skia/tools/gpu/BUILD.bazel
new file mode 100644
index 00000000000..14a920f4c9b
--- /dev/null
+++ b/chromium/third_party/skia/tools/gpu/BUILD.bazel
@@ -0,0 +1,51 @@
+load("//bazel:macros.bzl", "exports_files_legacy", "select_multi", "skia_cc_library")
+
+licenses(["notice"])
+
+exports_files_legacy()
+
+skia_cc_library(
+ name = "utils",
+ testonly = True,
+ srcs = [
+ "BackendSurfaceFactory.cpp",
+ "BackendSurfaceFactory.h",
+ "BackendTextureImageFactory.cpp",
+ "BackendTextureImageFactory.h",
+ "FenceSync.h",
+ "FlushFinishTracker.cpp",
+ "FlushFinishTracker.h",
+ "GrContextFactory.cpp",
+ "GrTest.cpp",
+ "ManagedBackendTexture.cpp",
+ "ManagedBackendTexture.h",
+ "MemoryCache.cpp",
+ "MemoryCache.h",
+ "GpuTimer.h",
+ "ProxyUtils.cpp",
+ "ProxyUtils.h",
+ "TestContext.cpp",
+ "TestContext.h",
+ "TestOps.cpp",
+ "TestOps.h",
+ "YUVUtils.cpp",
+ "YUVUtils.h",
+ "//tools/gpu/mock:private_hdrs",
+ "//tools/gpu/mock:srcs",
+ ] + select_multi({
+ "//src/gpu:gl_backend": [
+ "//tools/gpu/gl:private_hdrs",
+ "//tools/gpu/gl:srcs",
+ ],
+ # TODO(kjlubick) Handle other backends
+ }),
+ hdrs = [
+ "GrContextFactory.h",
+ ],
+ visibility = ["//modules/skottie:__pkg__"],
+ deps = ["//:skia_internal"] + select_multi({
+ "//src/gpu:gl_backend": [
+ "//tools/gpu/gl:deps",
+ ],
+ }),
+)
diff --git a/chromium/third_party/skia/tools/gpu/GrTest.cpp b/chromium/third_party/skia/tools/gpu/GrTest.cpp
index 766c62151f5..361715e6359 100644
--- a/chromium/third_party/skia/tools/gpu/GrTest.cpp
+++ b/chromium/third_party/skia/tools/gpu/GrTest.cpp
@@ -24,7 +24,7 @@
#include "src/gpu/ganesh/GrSemaphore.h"
#include "src/gpu/ganesh/GrTexture.h"
#include "src/gpu/ganesh/SkGr.h"
-#include "src/gpu/ganesh/v1/SurfaceDrawContext_v1.h"
+#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/image/SkImage_Gpu.h"
#include "src/text/gpu/StrikeCache.h"
#include "src/text/gpu/TextBlobRedrawCoordinator.h"
@@ -94,7 +94,7 @@ void GrDrawRandomOp(SkRandom* random, skgpu::v1::SurfaceDrawContext* sdc, GrPain
DRAW_OP_TEST_ENTRY(TriangulatingPathOp),
};
- static constexpr size_t kTotal = SK_ARRAY_COUNT(gFactories);
+ static constexpr size_t kTotal = std::size(gFactories);
uint32_t index = random->nextULessThan(static_cast<uint32_t>(kTotal));
auto op = gFactories[index](std::move(paint),
random,
diff --git a/chromium/third_party/skia/tools/gpu/TestContext.cpp b/chromium/third_party/skia/tools/gpu/TestContext.cpp
index c76e157b01e..058e81cd981 100644
--- a/chromium/third_party/skia/tools/gpu/TestContext.cpp
+++ b/chromium/third_party/skia/tools/gpu/TestContext.cpp
@@ -55,7 +55,7 @@ void TestContext::flushAndWaitOnSync(GrDirectContext* context) {
context->flush(flushInfo);
context->submit();
- fCurrentFlushIdx = (fCurrentFlushIdx + 1) % SK_ARRAY_COUNT(fFinishTrackers);
+ fCurrentFlushIdx = (fCurrentFlushIdx + 1) % std::size(fFinishTrackers);
}
void TestContext::testAbandon() {
diff --git a/chromium/third_party/skia/tools/gpu/YUVUtils.cpp b/chromium/third_party/skia/tools/gpu/YUVUtils.cpp
index d049575a3d4..6c1775b070c 100644
--- a/chromium/third_party/skia/tools/gpu/YUVUtils.cpp
+++ b/chromium/third_party/skia/tools/gpu/YUVUtils.cpp
@@ -211,7 +211,7 @@ std::unique_ptr<LazyYUVImage> LazyYUVImage::Make(SkYUVAPixmaps pixmaps,
sk_sp<SkImage> LazyYUVImage::refImage(GrRecordingContext* rContext, Type type) {
if (this->ensureYUVImage(rContext, type)) {
size_t idx = static_cast<size_t>(type);
- SkASSERT(idx < SK_ARRAY_COUNT(fYUVImage));
+ SkASSERT(idx < std::size(fYUVImage));
return fYUVImage[idx];
} else {
return nullptr;
@@ -261,7 +261,7 @@ bool LazyYUVImage::reset(SkYUVAPixmaps pixmaps, GrMipmapped mipmapped, sk_sp<SkC
bool LazyYUVImage::ensureYUVImage(GrRecordingContext* rContext, Type type) {
size_t idx = static_cast<size_t>(type);
- SkASSERT(idx < SK_ARRAY_COUNT(fYUVImage));
+ SkASSERT(idx < std::size(fYUVImage));
if (fYUVImage[idx] && fYUVImage[idx]->isValid(rContext)) {
return true; // Have already made a YUV image valid for this context.
}
diff --git a/chromium/third_party/skia/tools/gpu/gl/BUILD.bazel b/chromium/third_party/skia/tools/gpu/gl/BUILD.bazel
new file mode 100644
index 00000000000..10db3e7f2c5
--- /dev/null
+++ b/chromium/third_party/skia/tools/gpu/gl/BUILD.bazel
@@ -0,0 +1,42 @@
+load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_deps")
+
+licenses(["notice"])
+
+exports_files_legacy()
+
+filegroup(
+ name = "private_hdrs",
+ srcs = [
+ "GLTestContext.h",
+ ],
+ visibility = ["//tools/gpu:__pkg__"],
+)
+
+filegroup(
+ name = "srcs",
+ srcs = [
+ "GLTestContext.cpp",
+ ] + select({
+ "//bazel/common_config_settings:linux_x64": ["//tools/gpu/gl/glx:srcs"],
+ "@platforms//os:android": ["//tools/gpu/gl/egl:srcs"],
+ "@platforms//os:ios": ["//tools/gpu/gl/iOS:srcs"],
+ "@platforms//os:macos": ["//tools/gpu/gl/mac:srcs"],
+ "@platforms//os:windows": ["//tools/gpu/gl/win:srcs"],
+ "//conditions:default": ["//tools/gpu/gl/none:srcs"],
+ }),
+ visibility = ["//tools/gpu:__pkg__"],
+)
+
+skia_cc_deps(
+ name = "deps",
+ visibility = ["//tools/gpu:__pkg__"],
+ deps = select({
+ "//bazel/common_config_settings:linux_x64": ["//tools/gpu/gl/glx:deps"],
+ "@platforms//os:android": ["//tools/gpu/gl/egl:deps"],
+ "@platforms//os:macos": ["//tools/gpu/gl/mac:deps"],
+ "@platforms//os:windows": ["//tools/gpu/gl/win:deps"],
+ "//conditions:default": [],
+ }),
+)
+
+# TODO(kjlubick) skia_objc_deps for iOS support
diff --git a/chromium/third_party/skia/tools/gpu/gl/egl/BUILD.bazel b/chromium/third_party/skia/tools/gpu/gl/egl/BUILD.bazel
new file mode 100644
index 00000000000..a7659a57f19
--- /dev/null
+++ b/chromium/third_party/skia/tools/gpu/gl/egl/BUILD.bazel
@@ -0,0 +1,21 @@
+load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_deps")
+
+licenses(["notice"])
+
+exports_files_legacy()
+
+filegroup(
+ name = "srcs",
+ srcs = [
+ "CreatePlatformGLTestContext_egl.cpp",
+ ],
+ visibility = ["//tools/gpu/gl:__pkg__"],
+)
+
+skia_cc_deps(
+ name = "deps",
+ linkopts = [
+ "-lEGL",
+ ],
+ visibility = ["//tools/gpu/gl:__pkg__"],
+)
diff --git a/chromium/third_party/skia/tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp b/chromium/third_party/skia/tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp
index 8cd7c39deb9..2da38f18016 100644
--- a/chromium/third_party/skia/tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp
+++ b/chromium/third_party/skia/tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp
@@ -83,7 +83,7 @@ EGLGLTestContext::EGLGLTestContext(GrGLStandard forcedGpuAPI, EGLGLTestContext*
kGLES_GrGLStandard,
};
- size_t apiLimit = SK_ARRAY_COUNT(kStandards);
+ size_t apiLimit = std::size(kStandards);
size_t api = 0;
if (forcedGpuAPI == kGL_GrGLStandard) {
apiLimit = 1;
diff --git a/chromium/third_party/skia/tools/gpu/gl/glx/BUILD.bazel b/chromium/third_party/skia/tools/gpu/gl/glx/BUILD.bazel
new file mode 100644
index 00000000000..639d1c04c5e
--- /dev/null
+++ b/chromium/third_party/skia/tools/gpu/gl/glx/BUILD.bazel
@@ -0,0 +1,26 @@
+load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_deps")
+
+licenses(["notice"])
+
+exports_files_legacy()
+
+filegroup(
+ name = "srcs",
+ srcs = [
+ "CreatePlatformGLTestContext_glx.cpp",
+ ],
+ visibility = ["//tools/gpu/gl:__pkg__"],
+)
+
+skia_cc_deps(
+ name = "deps",
+ linkopts = [
+ "-lGL",
+ "-lGLU",
+ "-lX11",
+ "-lxcb", # dep of X11
+ "-lXau", # dep of xcb
+ "-lXdmcp", # dep of xcb
+ ],
+ visibility = ["//tools/gpu/gl:__pkg__"],
+)
diff --git a/chromium/third_party/skia/tools/gpu/gl/iOS/BUILD.bazel b/chromium/third_party/skia/tools/gpu/gl/iOS/BUILD.bazel
new file mode 100644
index 00000000000..99216d03d83
--- /dev/null
+++ b/chromium/third_party/skia/tools/gpu/gl/iOS/BUILD.bazel
@@ -0,0 +1,13 @@
+load("//bazel:macros.bzl", "exports_files_legacy")
+
+licenses(["notice"])
+
+exports_files_legacy()
+
+filegroup(
+ name = "srcs",
+ srcs = [
+ "CreatePlatformGLTestContext_iOS.mm",
+ ],
+ visibility = ["//tools/gpu/gl:__pkg__"],
+)
diff --git a/chromium/third_party/skia/tools/gpu/gl/interface/interface.json5 b/chromium/third_party/skia/tools/gpu/gl/interface/interface.json5
index 9a56e781955..a68990d8248 100644
--- a/chromium/third_party/skia/tools/gpu/gl/interface/interface.json5
+++ b/chromium/third_party/skia/tools/gpu/gl/interface/interface.json5
@@ -511,6 +511,16 @@
},
{
+ "GL": [{"min_version": [3, 1], "ext": "<core>"},
+ {/* else if */ "ext": "GL_ARB_copy_buffer"}],
+ "GLES": [{"min_version": [3, 0], "ext": "<core>"},
+ {/* else if */ "ext": "GL_NV_copy_buffer"}],
+ "WebGL": [{"min_version": [2, 0], "ext": "<core>"},],
+
+ "functions": ["CopyBufferSubData",],
+ },
+
+ {
"GL": [{"ext": "GL_NV_framebuffer_mixed_samples"}],
"GLES": [{"ext": "GL_CHROMIUM_framebuffer_mixed_samples"},
{"ext": "GL_NV_framebuffer_mixed_samples"}],
diff --git a/chromium/third_party/skia/tools/gpu/gl/mac/BUILD.bazel b/chromium/third_party/skia/tools/gpu/gl/mac/BUILD.bazel
new file mode 100644
index 00000000000..4ba8f0e0fad
--- /dev/null
+++ b/chromium/third_party/skia/tools/gpu/gl/mac/BUILD.bazel
@@ -0,0 +1,22 @@
+load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_deps")
+
+licenses(["notice"])
+
+exports_files_legacy()
+
+filegroup(
+ name = "srcs",
+ srcs = [
+ "CreatePlatformGLTestContext_mac.cpp",
+ ],
+ visibility = ["//tools/gpu/gl:__pkg__"],
+)
+
+skia_cc_deps(
+ name = "deps",
+ linkopts = [
+ "-framework",
+ "OpenGL",
+ ],
+ visibility = ["//tools/gpu/gl:__pkg__"],
+)
diff --git a/chromium/third_party/skia/tools/gpu/gl/none/BUILD.bazel b/chromium/third_party/skia/tools/gpu/gl/none/BUILD.bazel
new file mode 100644
index 00000000000..588db732e24
--- /dev/null
+++ b/chromium/third_party/skia/tools/gpu/gl/none/BUILD.bazel
@@ -0,0 +1,13 @@
+load("//bazel:macros.bzl", "exports_files_legacy")
+
+licenses(["notice"])
+
+exports_files_legacy()
+
+filegroup(
+ name = "srcs",
+ srcs = [
+ "CreatePlatformGLTestContext_none.cpp",
+ ],
+ visibility = ["//tools/gpu/gl:__pkg__"],
+)
diff --git a/chromium/third_party/skia/tools/gpu/gl/win/BUILD.bazel b/chromium/third_party/skia/tools/gpu/gl/win/BUILD.bazel
new file mode 100644
index 00000000000..06334204846
--- /dev/null
+++ b/chromium/third_party/skia/tools/gpu/gl/win/BUILD.bazel
@@ -0,0 +1,22 @@
+load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_deps")
+
+licenses(["notice"])
+
+exports_files_legacy()
+
+filegroup(
+ name = "srcs",
+ srcs = [
+ "CreatePlatformGLTestContext_win.cpp",
+ ],
+ visibility = ["//tools/gpu/gl:__pkg__"],
+)
+
+skia_cc_deps(
+ name = "deps",
+ linkopts = [
+ "-lGdi32",
+ "-lOpenGL32", # TODO(kjlubick) This will not work compiling for Windows on arm64
+ ],
+ visibility = ["//tools/gpu/gl:__pkg__"],
+)
diff --git a/chromium/third_party/skia/tools/gpu/mock/BUILD.bazel b/chromium/third_party/skia/tools/gpu/mock/BUILD.bazel
new file mode 100644
index 00000000000..3713ba6e8fe
--- /dev/null
+++ b/chromium/third_party/skia/tools/gpu/mock/BUILD.bazel
@@ -0,0 +1,21 @@
+load("//bazel:macros.bzl", "exports_files_legacy")
+
+licenses(["notice"])
+
+exports_files_legacy()
+
+filegroup(
+ name = "private_hdrs",
+ srcs = [
+ "MockTestContext.h",
+ ],
+ visibility = ["//tools/gpu:__pkg__"],
+)
+
+filegroup(
+ name = "srcs",
+ srcs = [
+ "MockTestContext.cpp",
+ ],
+ visibility = ["//tools/gpu:__pkg__"],
+)
diff --git a/chromium/third_party/skia/tools/gpu/vk/BUILD.bazel b/chromium/third_party/skia/tools/gpu/vk/BUILD.bazel
index c355295c097..8e616657c65 100644
--- a/chromium/third_party/skia/tools/gpu/vk/BUILD.bazel
+++ b/chromium/third_party/skia/tools/gpu/vk/BUILD.bazel
@@ -1,10 +1,10 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy")
+load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_library")
licenses(["notice"])
exports_files_legacy()
-cc_library(
+skia_cc_library(
name = "testutils",
testonly = True,
srcs = [
diff --git a/chromium/third_party/skia/tools/gpu/vk/VkTestUtils.cpp b/chromium/third_party/skia/tools/gpu/vk/VkTestUtils.cpp
index e5cd87998b7..ca8629ba1ce 100644
--- a/chromium/third_party/skia/tools/gpu/vk/VkTestUtils.cpp
+++ b/chromium/third_party/skia/tools/gpu/vk/VkTestUtils.cpp
@@ -25,7 +25,7 @@
#include <algorithm>
-#if defined(SK_BUILD_FOR_UNIX)
+#if defined(__GLIBC__)
#include <execinfo.h>
#endif
#include "include/gpu/vk/GrVkBackendContext.h"
@@ -103,9 +103,9 @@ static int should_include_debug_layer(const char* layerName,
}
static void print_backtrace() {
-#if defined(SK_BUILD_FOR_UNIX)
+#if defined(__GLIBC__)
void* stack[64];
- int count = backtrace(stack, SK_ARRAY_COUNT(stack));
+ int count = backtrace(stack, std::size(stack));
backtrace_symbols_fd(stack, count, 2);
#else
// Please add implementations for other platforms.
@@ -186,7 +186,7 @@ static bool init_instance_extensions_and_layers(PFN_vkGetInstanceProcAddr getIns
}
uint32_t nonPatchVersion = remove_patch_version(specVersion);
- for (size_t i = 0; i < SK_ARRAY_COUNT(kDebugLayerNames); ++i) {
+ for (size_t i = 0; i < std::size(kDebugLayerNames); ++i) {
int idx = should_include_debug_layer(kDebugLayerNames[i], layerCount, layers,
nonPatchVersion);
if (idx != -1) {
@@ -275,7 +275,7 @@ static bool init_device_extensions_and_layers(GrVkGetProc getProc, uint32_t spec
}
uint32_t nonPatchVersion = remove_patch_version(specVersion);
- for (size_t i = 0; i < SK_ARRAY_COUNT(kDebugLayerNames); ++i) {
+ for (size_t i = 0; i < std::size(kDebugLayerNames); ++i) {
int idx = should_include_debug_layer(kDebugLayerNames[i], layerCount, layers,
nonPatchVersion);
if (idx != -1) {
diff --git a/chromium/third_party/skia/tools/graphite/GraphiteTestContext.cpp b/chromium/third_party/skia/tools/graphite/GraphiteTestContext.cpp
index 44ad1fc1562..d6f74865bda 100644
--- a/chromium/third_party/skia/tools/graphite/GraphiteTestContext.cpp
+++ b/chromium/third_party/skia/tools/graphite/GraphiteTestContext.cpp
@@ -43,7 +43,7 @@ void GraphiteTestContext::submitRecordingAndWaitOnSync(skgpu::graphite::Context*
context->submit(skgpu::graphite::SyncToCpu::kNo);
- fCurrentFlushIdx = (fCurrentFlushIdx + 1) % SK_ARRAY_COUNT(fFinishTrackers);
+ fCurrentFlushIdx = (fCurrentFlushIdx + 1) % std::size(fFinishTrackers);
}
} // namespace skiatest::graphite
diff --git a/chromium/third_party/skia/tools/graphite/mtl/MtlTestContext.mm b/chromium/third_party/skia/tools/graphite/mtl/MtlTestContext.mm
index c3c5e53fa17..08d17651fee 100644
--- a/chromium/third_party/skia/tools/graphite/mtl/MtlTestContext.mm
+++ b/chromium/third_party/skia/tools/graphite/mtl/MtlTestContext.mm
@@ -8,6 +8,7 @@
#include "tools/graphite/mtl/GraphiteMtlTestContext.h"
#include "include/gpu/graphite/Context.h"
+#include "include/gpu/graphite/ContextOptions.h"
#include "include/gpu/graphite/mtl/MtlTypes.h"
#ifdef SK_METAL
@@ -48,7 +49,7 @@ std::unique_ptr<GraphiteTestContext> MtlTestContext::Make() {
}
std::unique_ptr<skgpu::graphite::Context> MtlTestContext::makeContext() {
- return skgpu::graphite::Context::MakeMetal(fMtl);
+ return skgpu::graphite::Context::MakeMetal(fMtl, skgpu::graphite::ContextOptions{});
}
} // namespace skiatest::graphite::mtl
diff --git a/chromium/third_party/skia/tools/imgcvt.cpp b/chromium/third_party/skia/tools/imgcvt.cpp
index 5c024f0462a..392a8bfacba 100644
--- a/chromium/third_party/skia/tools/imgcvt.cpp
+++ b/chromium/third_party/skia/tools/imgcvt.cpp
@@ -10,7 +10,7 @@
#include "include/core/SkImage.h"
#include "include/core/SkStream.h"
#include "include/core/SkSurface.h"
-#include "include/third_party/skcms/skcms.h"
+#include "modules/skcms/skcms.h"
#include "src/core/SkColorSpacePriv.h"
static void write_png(const char* path, sk_sp<SkImage> img) {
diff --git a/chromium/third_party/skia/tools/random_parse_path.cpp b/chromium/third_party/skia/tools/random_parse_path.cpp
index 4fce0b2acfc..a58be6ec84f 100644
--- a/chromium/third_party/skia/tools/random_parse_path.cpp
+++ b/chromium/third_party/skia/tools/random_parse_path.cpp
@@ -36,7 +36,7 @@ static void add_white(SkRandom* rand, SkString* atom) {
}
int reps = rand->nextRangeU(0, 2);
for (int rep = 0; rep < reps; ++rep) {
- int index = rand->nextRangeU(0, (int) SK_ARRAY_COUNT(gWhiteSpace) - 1);
+ int index = rand->nextRangeU(0, (int) std::size(gWhiteSpace) - 1);
if (gWhiteSpace[index]) {
atom->append(&gWhiteSpace[index], 1);
}
@@ -67,7 +67,7 @@ static void add_some_white(SkRandom* rand, SkString* atom) {
SkString MakeRandomParsePathPiece(SkRandom* rand) {
SkString atom;
- int legalIndex = rand->nextRangeU(0, (int) SK_ARRAY_COUNT(gLegal) - 1);
+ int legalIndex = rand->nextRangeU(0, (int) std::size(gLegal) - 1);
const Legal& legal = gLegal[legalIndex];
gEasy ? atom.append("\n") : add_white(rand, &atom);
char symbol = legal.fSymbol | (rand->nextBool() ? 0x20 : 0);
diff --git a/chromium/third_party/skia/tools/rewrite_includes.py b/chromium/third_party/skia/tools/rewrite_includes.py
index 980c2ef81dd..f73196f7ef3 100755
--- a/chromium/third_party/skia/tools/rewrite_includes.py
+++ b/chromium/third_party/skia/tools/rewrite_includes.py
@@ -45,6 +45,7 @@ ignorelist = [
'include/third_party/vulkan',
# Some node_modules/ files (used by CanvasKit et al) have c++ code which we should ignore.
'node_modules',
+ 'include/third_party/skcms',
]
assert '/' in [os.sep, os.altsep]
@@ -80,6 +81,7 @@ for file_path in to_rewrite():
if ('/generated/' in file_path or
'tests/sksl/' in file_path or
'third_party/skcms' in file_path or
+ 'modules/skcms' in file_path or
file_path.startswith('bazel/rbe')):
continue
if (file_path.endswith('.h') or
diff --git a/chromium/third_party/skia/tools/run-wasm-gm-tests/run-wasm-gm-tests.html b/chromium/third_party/skia/tools/run-wasm-gm-tests/run-wasm-gm-tests.html
index 56e762ab0fe..0c4bdd83715 100644
--- a/chromium/third_party/skia/tools/run-wasm-gm-tests/run-wasm-gm-tests.html
+++ b/chromium/third_party/skia/tools/run-wasm-gm-tests/run-wasm-gm-tests.html
@@ -243,6 +243,7 @@ array of the test names and what they drew.
// These SkSL tests fail on the Quadro P400s in the Golo
'SkSLCommaSideEffects_GPU',
+ 'SkSLMatrixScalarNoOpFolding_GPU',
'SkSLPreserveSideEffects_GPU',
'SkSLStructFieldNoFolding_GPU',
diff --git a/chromium/third_party/skia/tools/sk_app/BUILD.bazel b/chromium/third_party/skia/tools/sk_app/BUILD.bazel
index 003585af83a..9296f131d8a 100644
--- a/chromium/third_party/skia/tools/sk_app/BUILD.bazel
+++ b/chromium/third_party/skia/tools/sk_app/BUILD.bazel
@@ -1,4 +1,5 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy", "select_multi", "selects")
+load("//bazel:macros.bzl", "exports_files_legacy", "select_multi", "selects", "skia_cc_deps", "skia_cc_library", "skia_objc_library")
+load("//bazel:copts.bzl", "DEFAULT_OBJC_COPTS")
licenses(["notice"])
@@ -7,7 +8,7 @@ exports_files_legacy()
selects.config_setting_group(
name = "dawn_unix",
match_all = [
- "//bazel/common_config_settings:dawn_backend",
+ "//src/gpu:dawn_backend",
"@platforms//os:linux",
],
)
@@ -15,20 +16,28 @@ selects.config_setting_group(
selects.config_setting_group(
name = "gl_unix",
match_all = [
- "//bazel/common_config_settings:gl_backend",
+ "//src/gpu:gl_backend",
"@platforms//os:linux",
],
)
selects.config_setting_group(
+ name = "gl_mac",
+ match_all = [
+ "//src/gpu:gl_backend",
+ "@platforms//os:macos",
+ ],
+)
+
+selects.config_setting_group(
name = "vulkan_unix",
match_all = [
- "//bazel/common_config_settings:vulkan_backend",
+ "//src/gpu:vulkan_backend",
"@platforms//os:linux",
],
)
-cc_library(
+skia_cc_library(
name = "sk_app",
testonly = True,
srcs = [
@@ -37,20 +46,19 @@ cc_library(
"RasterWindowContext.h",
] + select_multi(
{
- "//bazel/common_config_settings:dawn_backend": [
+ "//src/gpu:dawn_backend": [
"DawnWindowContext.h",
"DawnWindowContext.cpp",
],
- "//bazel/common_config_settings:gl_backend": [
+ "//src/gpu:gl_backend": [
"GLWindowContext.cpp",
"GLWindowContext.h",
],
- "//bazel/common_config_settings:vulkan_backend": [
+ "//src/gpu:vulkan_backend": [
"VulkanWindowContext.h",
"VulkanWindowContext.cpp",
],
},
- default = [],
) + select({
"@platforms//os:linux": ["//tools/sk_app/unix:srcs"],
"//conditions:default": [],
@@ -72,3 +80,57 @@ cc_library(
"//conditions:default": [],
}),
)
+
+skia_objc_library(
+ name = "sk_app_objc",
+ testonly = True,
+ srcs = [
+ "Window.cpp",
+ "WindowContext.cpp",
+ "RasterWindowContext.h",
+ ] + select_multi(
+ {
+ "//src/gpu:gl_backend": [
+ "GLWindowContext.cpp",
+ "GLWindowContext.h",
+ ],
+ #TODO dawn and metal backend
+ },
+ ) + select({
+ "@platforms//os:macos": ["//tools/sk_app/mac:srcs"],
+ "//conditions:default": [],
+ # TODO ios support
+ }),
+ hdrs = [
+ "Application.h",
+ "DisplayParams.h",
+ "Window.h",
+ "WindowContext.h",
+ ],
+ copts = DEFAULT_OBJC_COPTS + [
+ "-Wno-deprecated-declarations",
+ "-DGL_SILENCE_DEPRECATION",
+ ],
+ sdk_frameworks = [
+ "QuartzCore",
+ "Cocoa",
+ "Foundation",
+ ],
+ visibility = ["//:__subpackages__"],
+ deps = [
+ ":platform_deps",
+ "//:skia_internal",
+ "//tools/skui",
+ "//tools/timer",
+ ],
+)
+
+skia_cc_deps(
+ name = "platform_deps",
+ testonly = True,
+ visibility = ["//visibility:private"],
+ deps = select({
+ "@platforms//os:macos": ["//tools/sk_app/mac:deps"],
+ "//conditions:default": [],
+ }),
+)
diff --git a/chromium/third_party/skia/tools/sk_app/GraphiteMetalWindowContext.mm b/chromium/third_party/skia/tools/sk_app/GraphiteMetalWindowContext.mm
index 366de746ca7..064e03d524d 100644
--- a/chromium/third_party/skia/tools/sk_app/GraphiteMetalWindowContext.mm
+++ b/chromium/third_party/skia/tools/sk_app/GraphiteMetalWindowContext.mm
@@ -11,11 +11,13 @@
#include "include/gpu/graphite/BackendTexture.h"
#include "include/gpu/graphite/Context.h"
+#include "include/gpu/graphite/ContextOptions.h"
#include "include/gpu/graphite/Recorder.h"
#include "include/gpu/graphite/Recording.h"
#include "include/gpu/graphite/SkStuff.h"
#include "include/gpu/graphite/mtl/MtlBackendContext.h"
#include "include/gpu/graphite/mtl/MtlTypes.h"
+#include "tools/ToolUtils.h"
using sk_app::DisplayParams;
using sk_app::GraphiteMetalWindowContext;
@@ -53,8 +55,9 @@ void GraphiteMetalWindowContext::initializeContext() {
skgpu::graphite::MtlBackendContext backendContext = {};
backendContext.fDevice.retain((skgpu::graphite::MtlHandle)fDevice.get());
backendContext.fQueue.retain((skgpu::graphite::MtlHandle)fQueue.get());
- fGraphiteContext = skgpu::graphite::Context::MakeMetal(backendContext);
- fGraphiteRecorder = fGraphiteContext->makeRecorder();
+ fGraphiteContext = skgpu::graphite::Context::MakeMetal(backendContext,
+ skgpu::graphite::ContextOptions());
+ fGraphiteRecorder = fGraphiteContext->makeRecorder(ToolUtils::CreateTestingRecorderOptions());
// TODO
// if (!fGraphiteContext && fDisplayParams.fMSAASampleCount > 1) {
// fDisplayParams.fMSAASampleCount /= 2;
@@ -104,8 +107,8 @@ void GraphiteMetalWindowContext::swapBuffers() {
skgpu::graphite::InsertRecordingInfo info;
info.fRecording = recording.get();
fGraphiteContext->insertRecording(info);
+ fGraphiteContext->submit(skgpu::graphite::SyncToCpu::kNo);
}
- fGraphiteContext->submit(skgpu::graphite::SyncToCpu::kNo);
id<CAMetalDrawable> currentDrawable = (id<CAMetalDrawable>)fDrawableHandle;
diff --git a/chromium/third_party/skia/tools/sk_app/WindowContext.h b/chromium/third_party/skia/tools/sk_app/WindowContext.h
index 65ab8b9aa4a..e218fecbc5f 100644
--- a/chromium/third_party/skia/tools/sk_app/WindowContext.h
+++ b/chromium/third_party/skia/tools/sk_app/WindowContext.h
@@ -58,7 +58,7 @@ protected:
virtual bool isGpuContext() { return true; }
sk_sp<GrDirectContext> fContext;
-#if SK_GRAPHITE_ENABLED
+#if defined(SK_GRAPHITE_ENABLED)
std::unique_ptr<skgpu::graphite::Context> fGraphiteContext;
std::unique_ptr<skgpu::graphite::Recorder> fGraphiteRecorder;
#endif
diff --git a/chromium/third_party/skia/tools/sk_app/android/main_android.cpp b/chromium/third_party/skia/tools/sk_app/android/main_android.cpp
index 2fc693d6aed..1a0de356f2b 100644
--- a/chromium/third_party/skia/tools/sk_app/android/main_android.cpp
+++ b/chromium/third_party/skia/tools/sk_app/android/main_android.cpp
@@ -33,7 +33,7 @@ void android_main(struct android_app* state) {
// "--atrace",
};
- std::unique_ptr<Application> vkApp(Application::Create(SK_ARRAY_COUNT(gCmdLine),
+ std::unique_ptr<Application> vkApp(Application::Create(std::size(gCmdLine),
const_cast<char**>(gCmdLine),
state));
diff --git a/chromium/third_party/skia/tools/sk_app/android/surface_glue_android.cpp b/chromium/third_party/skia/tools/sk_app/android/surface_glue_android.cpp
index b0642764c24..6f519d71534 100644
--- a/chromium/third_party/skia/tools/sk_app/android/surface_glue_android.cpp
+++ b/chromium/third_party/skia/tools/sk_app/android/surface_glue_android.cpp
@@ -214,7 +214,7 @@ void* SkiaAndroidApp::pthread_main(void* arg) {
// "--atrace",
};
- skiaAndroidApp->fApp = Application::Create(SK_ARRAY_COUNT(gCmdLine),
+ skiaAndroidApp->fApp = Application::Create(std::size(gCmdLine),
const_cast<char**>(gCmdLine),
skiaAndroidApp);
diff --git a/chromium/third_party/skia/tools/sk_app/mac/BUILD.bazel b/chromium/third_party/skia/tools/sk_app/mac/BUILD.bazel
new file mode 100644
index 00000000000..8cfe50cc0bd
--- /dev/null
+++ b/chromium/third_party/skia/tools/sk_app/mac/BUILD.bazel
@@ -0,0 +1,30 @@
+load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_deps")
+
+licenses(["notice"])
+
+exports_files_legacy()
+
+filegroup(
+ name = "srcs",
+ testonly = True,
+ srcs = [
+ "RasterWindowContext_mac.mm",
+ "WindowContextFactory_mac.h",
+ "Window_mac.mm",
+ "Window_mac.h",
+ "main_mac.mm",
+ ] + select({
+ #TODO Metal and Dawn
+ "//src/gpu:gl_backend": ["GLWindowContext_mac.mm"],
+ "//conditions:default": [],
+ }),
+ visibility = ["//tools/sk_app:__pkg__"],
+)
+
+skia_cc_deps(
+ name = "deps",
+ testonly = True,
+ linkopts = [],
+ visibility = ["//tools/sk_app:__pkg__"],
+ deps = ["//tools:tool_utils"],
+)
diff --git a/chromium/third_party/skia/tools/sk_app/mac/Window_mac.mm b/chromium/third_party/skia/tools/sk_app/mac/Window_mac.mm
index 9b948e45202..c8db1fdcbf0 100644
--- a/chromium/third_party/skia/tools/sk_app/mac/Window_mac.mm
+++ b/chromium/third_party/skia/tools/sk_app/mac/Window_mac.mm
@@ -237,7 +237,7 @@ static skui::Key get_key(unsigned short vk) {
{ kVK_ANSI_Z, skui::Key::kZ },
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gPair); i++) {
+ for (size_t i = 0; i < std::size(gPair); i++) {
if (gPair[i].fVK == vk) {
return gPair[i].fKey;
}
diff --git a/chromium/third_party/skia/tools/sk_app/unix/BUILD.bazel b/chromium/third_party/skia/tools/sk_app/unix/BUILD.bazel
index 807431ccbfc..dbad6fa8f1a 100644
--- a/chromium/third_party/skia/tools/sk_app/unix/BUILD.bazel
+++ b/chromium/third_party/skia/tools/sk_app/unix/BUILD.bazel
@@ -1,4 +1,4 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy", "selects")
+load("//bazel:macros.bzl", "exports_files_legacy", "selects", "skia_cc_deps")
licenses(["notice"])
@@ -16,9 +16,9 @@ filegroup(
"keysym2ucs.h",
"main_unix.cpp",
] + select({
- "//bazel/common_config_settings:dawn_backend": ["DawnVulkanWindowContext_unix.cpp"],
- "//bazel/common_config_settings:gl_backend": ["GLWindowContext_unix.cpp"],
- "//bazel/common_config_settings:vulkan_backend": ["VulkanWindowContext_unix.cpp"],
+ "//src/gpu:dawn_backend": ["DawnVulkanWindowContext_unix.cpp"],
+ "//src/gpu:gl_backend": ["GLWindowContext_unix.cpp"],
+ "//src/gpu:vulkan_backend": ["VulkanWindowContext_unix.cpp"],
"//conditions:default": [],
}),
visibility = ["//tools/sk_app:__pkg__"],
@@ -27,12 +27,12 @@ filegroup(
selects.config_setting_group(
name = "dawn_or_vulkan",
match_any = [
- "//bazel/common_config_settings:dawn_backend",
- "//bazel/common_config_settings:vulkan_backend",
+ "//src/gpu:dawn_backend",
+ "//src/gpu:vulkan_backend",
],
)
-cc_library(
+skia_cc_deps(
name = "deps",
testonly = True,
linkopts = [
diff --git a/chromium/third_party/skia/tools/sk_app/unix/Window_unix.cpp b/chromium/third_party/skia/tools/sk_app/unix/Window_unix.cpp
index 2f9351ff1eb..beb69b92a27 100644
--- a/chromium/third_party/skia/tools/sk_app/unix/Window_unix.cpp
+++ b/chromium/third_party/skia/tools/sk_app/unix/Window_unix.cpp
@@ -74,7 +74,7 @@ bool Window_unix::initWindow(Display* display) {
};
SkASSERT(nullptr == fVisualInfo);
if (fRequestedDisplayParams.fMSAASampleCount > 1) {
- static const GLint kChooseFBConifgAttCnt = SK_ARRAY_COUNT(kChooseFBConfigAtt);
+ static const GLint kChooseFBConifgAttCnt = std::size(kChooseFBConfigAtt);
GLint msaaChooseFBConfigAtt[kChooseFBConifgAttCnt + 4];
memcpy(msaaChooseFBConfigAtt, kChooseFBConfigAtt, sizeof(kChooseFBConfigAtt));
SkASSERT(None == msaaChooseFBConfigAtt[kChooseFBConifgAttCnt - 1]);
@@ -88,7 +88,7 @@ bool Window_unix::initWindow(Display* display) {
if (n > 0) {
fVisualInfo = glXGetVisualFromFBConfig(fDisplay, *fFBConfig);
} else {
- static const GLint kChooseVisualAttCnt = SK_ARRAY_COUNT(chooseVisualAtt);
+ static const GLint kChooseVisualAttCnt = std::size(chooseVisualAtt);
GLint msaaChooseVisualAtt[kChooseVisualAttCnt + 4];
memcpy(msaaChooseVisualAtt, chooseVisualAtt, sizeof(chooseVisualAtt));
SkASSERT(None == msaaChooseVisualAtt[kChooseVisualAttCnt - 1]);
@@ -219,7 +219,7 @@ static skui::Key get_key(KeySym keysym) {
{ 'y', skui::Key::kY },
{ 'z', skui::Key::kZ },
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gPair); i++) {
+ for (size_t i = 0; i < std::size(gPair); i++) {
if (gPair[i].fXK == keysym) {
return gPair[i].fKey;
}
@@ -238,7 +238,7 @@ static skui::ModifierKey get_modifiers(const XEvent& event) {
};
skui::ModifierKey modifiers = skui::ModifierKey::kNone;
- for (size_t i = 0; i < SK_ARRAY_COUNT(gModifiers); ++i) {
+ for (size_t i = 0; i < std::size(gModifiers); ++i) {
if (event.xkey.state & gModifiers[i].fXMask) {
modifiers |= gModifiers[i].fSkMask;
}
diff --git a/chromium/third_party/skia/tools/sk_app/win/Window_win.cpp b/chromium/third_party/skia/tools/sk_app/win/Window_win.cpp
index 73dc7deede0..0471c0cf5a4 100644
--- a/chromium/third_party/skia/tools/sk_app/win/Window_win.cpp
+++ b/chromium/third_party/skia/tools/sk_app/win/Window_win.cpp
@@ -152,7 +152,7 @@ static skui::Key get_key(WPARAM vk) {
{ 'Y', skui::Key::kY },
{ 'Z', skui::Key::kZ },
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gPair); i++) {
+ for (size_t i = 0; i < std::size(gPair); i++) {
if (gPair[i].fVK == vk) {
return gPair[i].fKey;
}
diff --git a/chromium/third_party/skia/tools/sk_app/win/main_win.cpp b/chromium/third_party/skia/tools/sk_app/win/main_win.cpp
index a64b07deea5..1119421df10 100644
--- a/chromium/third_party/skia/tools/sk_app/win/main_win.cpp
+++ b/chromium/third_party/skia/tools/sk_app/win/main_win.cpp
@@ -38,7 +38,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCm
char* argv[4096];
int argc = 0;
TCHAR exename[1024], *next;
- int exenameLen = GetModuleFileName(nullptr, exename, SK_ARRAY_COUNT(exename));
+ int exenameLen = GetModuleFileName(nullptr, exename, std::size(exename));
// we're ignoring the possibility that the exe name exceeds the exename buffer
(void)exenameLen;
argv[argc++] = tchar_to_utf8(exename);
diff --git a/chromium/third_party/skia/tools/skiaserve/Request.cpp b/chromium/third_party/skia/tools/skiaserve/Request.cpp
index 613f4715f25..5dcfe15d264 100644
--- a/chromium/third_party/skia/tools/skiaserve/Request.cpp
+++ b/chromium/third_party/skia/tools/skiaserve/Request.cpp
@@ -229,7 +229,7 @@ sk_sp<SkData> Request::getJsonOps() {
SkJSONWriter writer(&stream, SkJSONWriter::Mode::kFast);
writer.beginObject(); // root
- writer.appendString("mode", fGPUEnabled ? "gpu" : "cpu");
+ writer.appendCString("mode", fGPUEnabled ? "gpu" : "cpu");
writer.appendBool("drawGpuOpBounds", fDebugCanvas->getDrawGpuOpBounds());
writer.appendS32("colorMode", fColorMode);
fDebugCanvas->toJSON(writer, fUrlDataManager, canvas);
diff --git a/chromium/third_party/skia/tools/skpbench/README.md b/chromium/third_party/skia/tools/skpbench/README.md
index 60b35de4b1b..7aaf700ba17 100644
--- a/chromium/third_party/skia/tools/skpbench/README.md
+++ b/chromium/third_party/skia/tools/skpbench/README.md
@@ -14,6 +14,7 @@ The to build skia for android are at https://skia.org/user/build#android and rep
Download the Android NDK
```
+./bin/fetch-sk
./bin/sk asset download android_ndk_linux /tmp/ndk
```
diff --git a/chromium/third_party/skia/tools/skpbench/skpbench.cpp b/chromium/third_party/skia/tools/skpbench/skpbench.cpp
index 8020aa4e1b4..d64234da01e 100644
--- a/chromium/third_party/skia/tools/skpbench/skpbench.cpp
+++ b/chromium/third_party/skia/tools/skpbench/skpbench.cpp
@@ -760,6 +760,6 @@ sk_gpu_test::FlushFinishTracker* GpuSync::newFlushTracker(GrDirectContext* conte
// callback on the flush call. The finish callback will unref the tracker when called.
tracker->ref();
- fCurrentFlushIdx = (fCurrentFlushIdx + 1) % SK_ARRAY_COUNT(fFinishTrackers);
+ fCurrentFlushIdx = (fCurrentFlushIdx + 1) % std::size(fFinishTrackers);
return tracker;
}
diff --git a/chromium/third_party/skia/tools/skpinfo.cpp b/chromium/third_party/skia/tools/skpinfo.cpp
index 79dbaf34d02..157eca2d304 100644
--- a/chromium/third_party/skia/tools/skpinfo.cpp
+++ b/chromium/third_party/skia/tools/skpinfo.cpp
@@ -9,8 +9,8 @@
#include "include/core/SkStream.h"
#include "include/private/SkTo.h"
#include "src/core/SkFontDescriptor.h"
-#include "src/core/SkPictureCommon.h"
#include "src/core/SkPictureData.h"
+#include "src/core/SkPicturePriv.h"
#include "tools/flags/CommandLineFlags.h"
static DEFINE_string2(input, i, "", "skp on which to report");
diff --git a/chromium/third_party/skia/tools/skqp/run_skqp_exe b/chromium/third_party/skia/tools/skqp/run_skqp_exe
index c8415a9e2c6..35c6dd6b768 100755
--- a/chromium/third_party/skia/tools/skqp/run_skqp_exe
+++ b/chromium/third_party/skia/tools/skqp/run_skqp_exe
@@ -21,9 +21,6 @@ def skqp(build):
adb('shell', 'rm -rf /data/local/tmp/skqp; mkdir -p /data/local/tmp/skqp/skqp_assets')
- adb('push',
- os.path.join(*'platform_tools/android/apps/skqp/src/main/assets/skqp'.split('/')),
- '/data/local/tmp/skqp/skqp_assets')
adb('push', 'resources', '/data/local/tmp/skqp/skqp_assets')
adb('push', os.path.join(build, 'skqp'), '/data/local/tmp/skqp/skqp')
diff --git a/chromium/third_party/skia/tools/skqp/src/skqp.cpp b/chromium/third_party/skia/tools/skqp/src/skqp.cpp
index 64d88ea9d8c..a0f228e373f 100644
--- a/chromium/third_party/skia/tools/skqp/src/skqp.cpp
+++ b/chromium/third_party/skia/tools/skqp/src/skqp.cpp
@@ -35,7 +35,6 @@
#include <regex>
static constexpr char kUnitTestReportPath[] = "unit_tests.txt";
-static constexpr char kUnitTestsPath[] = "skqp/unittests.txt";
// Kind of like Python's readlines(), but without any allocation.
// Calls `lineFn` on each line.
@@ -53,66 +52,46 @@ static void read_lines(const void* data,
}
}
-namespace {
-
-// Parses the contents of the `skqp/unittests.txt` file.
-// Each line in the exclusion list is a regular expression that matches against test names.
-// Matches indicate tests that should be excluded. Lines may start with # to indicate a comment.
-class ExclusionList {
-public:
- ExclusionList() {}
-
- void initialize(SkQPAssetManager* assetManager, sk_sp<SkData> dat, int enforcedAndroidAPILevel);
-
- bool isExcluded(const std::string& name) const {
- for (const auto& entry : fEntries) {
- if (std::regex_match(name, entry.regexPattern)) {
- return fEnforcedAndroidAPILevel < entry.excludeUntilAndroidAPILevel;
- }
- }
- return false;
- }
-
-private:
- int fEnforcedAndroidAPILevel;
-
- struct ExclusionEntry {
- std::regex regexPattern;
- int excludeUntilAndroidAPILevel;
- };
-
- std::vector<ExclusionEntry> fEntries;
-};
-}
-
// Returns a list of every unit test to be run.
-static std::vector<SkQP::UnitTest> get_unit_tests(const ExclusionList& exclusionList) {
+static std::vector<SkQP::UnitTest> get_unit_tests(int enforcedAndroidAPILevel) {
std::vector<SkQP::UnitTest> unitTests;
for (const skiatest::Test& test : skiatest::TestRegistry::Range()) {
- if (!test.fNeedsGpu) {
- continue;
+ const auto ctsMode = test.fCTSEnforcement.eval(enforcedAndroidAPILevel);
+ if (ctsMode != CtsEnforcement::RunMode::kSkip) {
+ SkASSERTF(test.fNeedsGpu, "Non-GPU test was included in SkQP: %s\n", test.fName);
+ unitTests.push_back(&test);
}
- if (exclusionList.isExcluded(test.fName)) {
- continue;
- }
- unitTests.push_back(&test);
}
auto lt = [](SkQP::UnitTest u, SkQP::UnitTest v) { return strcmp(u->fName, v->fName) < 0; };
std::sort(unitTests.begin(), unitTests.end(), lt);
return unitTests;
}
+/**
+ * SkSL error tests are used by CTS to verify that Android's RuntimeShader API fails when certain
+ * shader programs are compiled. Unlike unit tests these error tests are defined in resource files
+ * not source code. As such, we are unable to mark each test with a CtsEnforcement value. This
+ * list of exclusion rules excludes tests based on their file name so that we can have some form of
+ * control for which Android version an SkSL error test is expected to run.
+ */
+static const std::pair<std::regex, CtsEnforcement> sExclusionRulesForSkSLTests[] = {
+ // disable all ES3 tests until AGSL supports it.
+ {std::regex(".*ES3.*"), CtsEnforcement::kNever}};
+
// Returns a list of every SkSL error test to be run.
static std::vector<SkQP::SkSLErrorTest> get_sksl_error_tests(SkQPAssetManager* assetManager,
- const ExclusionList& exclusionList) {
+ int enforcedAndroidAPILevel) {
std::vector<SkQP::SkSLErrorTest> skslErrorTests;
-
auto iterateFn = [&](const char* directory, const char* extension) {
std::vector<std::string> paths = assetManager->iterateDir(directory, extension);
for (const std::string& path : paths) {
SkString name = SkOSPath::Basename(path.c_str());
- if (exclusionList.isExcluded(name.c_str())) {
- continue;
+ for (auto& exclusionEntry : sExclusionRulesForSkSLTests) {
+ if (std::regex_match(name.c_str(), exclusionEntry.first) &&
+ exclusionEntry.second.eval(enforcedAndroidAPILevel) ==
+ CtsEnforcement::RunMode::kSkip) {
+ continue;
+ }
}
sk_sp<SkData> shaderText = GetResourceAsData(path.c_str());
if (!shaderText) {
@@ -136,142 +115,6 @@ static std::vector<SkQP::SkSLErrorTest> get_sksl_error_tests(SkQPAssetManager* a
return skslErrorTests;
}
-void ExclusionList::initialize(SkQPAssetManager* assetManager,
- sk_sp<SkData> dat,
- int enforcedAndroidAPILevel) {
- fEnforcedAndroidAPILevel = enforcedAndroidAPILevel;
- fEntries = {};
-
- //TODO: explore refactoring this code to collect the test lists only once in SkQP::init
- ExclusionList noExclusions;
- const std::vector<SkQP::UnitTest> unitTestList = get_unit_tests(noExclusions);
- const std::vector<SkQP::SkSLErrorTest> skslTestList = get_sksl_error_tests(assetManager,
- noExclusions);
-
- // function to check whether or not the provided regex matches an existing test
- auto testExists = [&unitTestList, &skslTestList](const std::regex& exclusionRegex) {
- for (const auto& test : unitTestList) {
- if (std::regex_match(std::string(test->fName), exclusionRegex)) {
- return true;
- }
- }
- for (const auto& test : skslTestList) {
- if (std::regex_match(test.name, exclusionRegex)) {
- return true;
- }
- }
- return false;
- };
-
- read_lines(dat->data(), dat->size(), [this, &testExists](std::string_view line) {
- if (!line.empty() && line.back() == '\n') {
- // Strip line endings.
- line.remove_suffix(1);
- }
- // Only add non-empty strings, and ignore comments.
- if (line.empty() || line.front() == '#') {
- return;
- }
-
- std::string_view testName = line;
- int excludeUntilAndroidAPILevel = fEnforcedAndroidAPILevel + 1;
-
- // Check to see if the test has a min Android API level defined
- auto commaLocation = line.find_first_of(',');
- if (commaLocation != std::string::npos) {
- testName = line.substr(0, commaLocation);
- std::string apiString(line.substr(commaLocation + 1));
- excludeUntilAndroidAPILevel = std::stoi(apiString);
- }
-
- const std::string exclusionString(testName);
- const std::regex exclusionRegex(exclusionString);
-
- // Throw an error if there are no unit or sksl tests that match the exclusion
- if (!testExists(exclusionRegex)) {
- SK_ABORT("Exclusion list contains tests not found in the test registry: %s",
- exclusionString.c_str());
- }
-
- fEntries.push_back({exclusionRegex, excludeUntilAndroidAPILevel});
- });
-}
-
-static std::unique_ptr<sk_gpu_test::TestContext> make_test_context(SkQP::SkiaBackend backend) {
- using U = std::unique_ptr<sk_gpu_test::TestContext>;
- switch (backend) {
-// TODO(halcanary): Fuchsia will have SK_SUPPORT_GPU and SK_VULKAN, but *not* SK_GL.
-#ifdef SK_GL
- case SkQP::SkiaBackend::kGL:
- return U(sk_gpu_test::CreatePlatformGLTestContext(kGL_GrGLStandard, nullptr));
- case SkQP::SkiaBackend::kGLES:
- return U(sk_gpu_test::CreatePlatformGLTestContext(kGLES_GrGLStandard, nullptr));
-#endif
-#ifdef SK_VULKAN
- case SkQP::SkiaBackend::kVulkan:
- return U(sk_gpu_test::CreatePlatformVkTestContext(nullptr));
-#endif
- default:
- return nullptr;
- }
-}
-
-static GrContextOptions context_options(skiagm::GM* gm = nullptr) {
- GrContextOptions grContextOptions;
- grContextOptions.fAllowPathMaskCaching = true;
- grContextOptions.fDisableDriverCorrectnessWorkarounds = true;
- if (gm) {
- gm->modifyGrContextOptions(&grContextOptions);
- }
- return grContextOptions;
-}
-
-static std::vector<SkQP::SkiaBackend> get_backends() {
- std::vector<SkQP::SkiaBackend> result;
- SkQP::SkiaBackend backends[] = {
- #ifdef SK_GL
- #ifndef SK_BUILD_FOR_ANDROID
- SkQP::SkiaBackend::kGL, // Used for testing on desktop machines.
- #endif
- SkQP::SkiaBackend::kGLES,
- #endif // SK_GL
- #ifdef SK_VULKAN
- SkQP::SkiaBackend::kVulkan,
- #endif
- };
- for (SkQP::SkiaBackend backend : backends) {
- std::unique_ptr<sk_gpu_test::TestContext> testCtx = make_test_context(backend);
- if (testCtx) {
- testCtx->makeCurrent();
- if (nullptr != testCtx->makeContext(context_options())) {
- result.push_back(backend);
- }
- }
- }
- SkASSERT_RELEASE(result.size() > 0);
- return result;
-}
-
-static void print_backend_info(const char* dstPath,
- const std::vector<SkQP::SkiaBackend>& backends) {
-#ifdef SK_ENABLE_DUMP_GPU
- SkFILEWStream out(dstPath);
- out.writeText("[\n");
- for (SkQP::SkiaBackend backend : backends) {
- if (std::unique_ptr<sk_gpu_test::TestContext> testCtx = make_test_context(backend)) {
- testCtx->makeCurrent();
- if (sk_sp<GrDirectContext> ctx = testCtx->makeContext(context_options())) {
- SkString info = ctx->dump();
- // remove null
- out.write(info.c_str(), info.size());
- out.writeText(",\n");
- }
- }
- }
- out.writeText("]\n");
-#endif
-}
-
////////////////////////////////////////////////////////////////////////////////
TestHarness CurrentTestHarness() {
@@ -293,27 +136,24 @@ void SkQP::init(SkQPAssetManager* assetManager, const char* reportDirectory) {
SkGraphics::Init();
gSkFontMgr_DefaultFactory = &ToolUtils::MakePortableFontMgr;
- int minAndroidAPILevel = 0;
#ifdef SK_BUILD_FOR_ANDROID
- char firstAPIVersionStr[PROP_VALUE_MAX];
- int strLength = __system_property_get("ro.product.first_api_level", firstAPIVersionStr);
- // Defaults to zero since most checks care if it is greater than a specific value. So this will
- // just default to it being less.
- minAndroidAPILevel = (strLength == 0) ? 0 : atoi(firstAPIVersionStr);
-#endif
-
- // Load the exclusion list `skqp/unittests.txt`, if it exists.
- // The list is checked in at platform_tools/android/apps/skqp/src/main/assets/skqp/unittests.txt
- ExclusionList exclusionList;
- if (sk_sp<SkData> dat = assetManager->open(kUnitTestsPath)) {
- exclusionList.initialize(assetManager, dat, minAndroidAPILevel);
+ // ro.vendor.api_level contains the minAPI level based on the order defined in
+ // docs.partner.android.com/gms/building/integrating/extending-os-upgrade-support-windows
+ // 1. board's current api level (for boards that have been upgraded by the SoC vendor)
+ // 2. board's first api level (for devices that initially shipped with an older version)
+ // 3. product's first api level
+ // 4. product's current api level
+ char minAPIVersionStr[PROP_VALUE_MAX];
+ int strLength = __system_property_get("ro.vendor.api_level", minAPIVersionStr);
+ if (strLength != 0) {
+ fEnforcedAndroidAPILevel = atoi(minAPIVersionStr);
}
+#endif
- fUnitTests = get_unit_tests(exclusionList);
- fSkSLErrorTests = get_sksl_error_tests(assetManager, exclusionList);
- fSupportedBackends = get_backends();
+ fUnitTests = get_unit_tests(fEnforcedAndroidAPILevel);
+ fSkSLErrorTests = get_sksl_error_tests(assetManager, fEnforcedAndroidAPILevel);
- print_backend_info((fReportDirectory + "/grdump.txt").c_str(), fSupportedBackends);
+ printBackendInfo((fReportDirectory + "/grdump.txt").c_str());
}
std::vector<std::string> SkQP::executeTest(SkQP::UnitTest test) {
@@ -325,7 +165,10 @@ std::vector<std::string> SkQP::executeTest(SkQP::UnitTest test) {
}
} r;
GrContextOptions options;
- options.fDisableDriverCorrectnessWorkarounds = true;
+ if (test->fCTSEnforcement.eval(fEnforcedAndroidAPILevel) ==
+ CtsEnforcement::RunMode::kRunStrict) {
+ options.fDisableDriverCorrectnessWorkarounds = true;
+ }
if (test->fContextOptionsProc) {
test->fContextOptionsProc(&options);
}
diff --git a/chromium/third_party/skia/tools/skqp/src/skqp.h b/chromium/third_party/skia/tools/skqp/src/skqp.h
index ce6988f0308..8ab22a68035 100644
--- a/chromium/third_party/skia/tools/skqp/src/skqp.h
+++ b/chromium/third_party/skia/tools/skqp/src/skqp.h
@@ -41,11 +41,6 @@ private:
class SkQP {
public:
- enum class SkiaBackend {
- kGL,
- kGLES,
- kVulkan,
- };
using UnitTest = const skiatest::Test*;
struct SkSLErrorTest {
@@ -89,13 +84,17 @@ private:
std::vector<std::string> errors;
};
std::vector<TestResult> fTestResults;
- std::vector<SkiaBackend> fSupportedBackends;
std::string fReportDirectory;
std::vector<UnitTest> fUnitTests;
std::vector<SkSLErrorTest> fSkSLErrorTests;
+ // Defaults to zero since most checks care if it is greater than a specific value. So this will
+ // just default to it being less.
+ int fEnforcedAndroidAPILevel = 0;
+
SkQP(const SkQP&) = delete;
SkQP& operator=(const SkQP&) = delete;
+ void printBackendInfo(const char* dstPath);
};
#endif // skqp_DEFINED
diff --git a/chromium/third_party/skia/tools/skqp/src/skqp_GpuTestProcs.cpp b/chromium/third_party/skia/tools/skqp/src/skqp_GpuTestProcs.cpp
new file mode 100644
index 00000000000..187d165e58c
--- /dev/null
+++ b/chromium/third_party/skia/tools/skqp/src/skqp_GpuTestProcs.cpp
@@ -0,0 +1,179 @@
+/*
+ * Copyright 2022 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "tests/Test.h"
+#include "tools/skqp/src/skqp.h"
+
+#include "include/core/SkStream.h"
+#include "include/gpu/GrDirectContext.h"
+
+#ifdef SK_VULKAN
+#include "tools/gpu/vk/VkTestContext.h"
+#include <mutex>
+#endif
+#ifdef SK_GRAPHITE_ENABLED
+#include "include/gpu/graphite/Context.h"
+#include "tools/graphite/ContextFactory.h"
+#endif
+
+using sk_gpu_test::ContextInfo;
+using sk_gpu_test::GrContextFactory;
+using sk_gpu_test::TestContext;
+
+#ifdef SK_GL
+using sk_gpu_test::GLTestContext;
+#endif
+
+namespace skiatest {
+
+bool IsGLContextType(sk_gpu_test::GrContextFactory::ContextType type) {
+ return GrBackendApi::kOpenGL == GrContextFactory::ContextTypeBackend(type);
+}
+bool IsVulkanContextType(sk_gpu_test::GrContextFactory::ContextType type) {
+ return GrBackendApi::kVulkan == GrContextFactory::ContextTypeBackend(type);
+}
+bool IsRenderingGLContextType(sk_gpu_test::GrContextFactory::ContextType type) {
+ return IsGLContextType(type) && GrContextFactory::IsRenderingContext(type);
+}
+bool IsMockContextType(sk_gpu_test::GrContextFactory::ContextType type) {
+ return type == GrContextFactory::kMock_ContextType;
+}
+
+// These are not supported
+bool IsMetalContextType(sk_gpu_test::GrContextFactory::ContextType type) { return false; }
+bool IsDirect3DContextType(sk_gpu_test::GrContextFactory::ContextType type) { return false; }
+bool IsDawnContextType(sk_gpu_test::GrContextFactory::ContextType type) { return false; }
+
+static bool vk_has_physical_devices() {
+ static bool supported = false;
+#ifdef SK_VULKAN
+ static std::once_flag flag;
+ std::call_once(flag, []() {
+ // We could create a VkInstance and call vkEnumeratePhysicalDevices devices directly, but
+ // CreatePlatformVkTestContext is already configured to do that and will return nullptr if
+ // there are no available devices.
+ std::unique_ptr<TestContext> testCtx(sk_gpu_test::CreatePlatformVkTestContext(nullptr));
+ if (testCtx) {
+ supported = true;
+ }
+ });
+#endif
+ return supported;
+}
+
+#if defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_WIN) || defined(SK_BUILD_FOR_MAC)
+// Used for testing on desktop machines.
+static constexpr auto kNativeGLType = GrContextFactory::kGL_ContextType;
+#else
+static constexpr auto kNativeGLType = GrContextFactory::kGLES_ContextType;
+#endif
+
+#ifdef SK_BUILD_FOR_ANDROID
+static_assert(kNativeGLType == GrContextFactory::kGLES_ContextType, "CTS requires GLES");
+#endif
+
+static bool skip_context(GrContextFactory::ContextType contextType) {
+ // Use "native" instead of explicitly trying both OpenGL and OpenGL ES.
+ if (contextType == GrContextFactory::kGL_ContextType ||
+ contextType == GrContextFactory::kGLES_ContextType) {
+ if (contextType != kNativeGLType) {
+ return true;
+ }
+ }
+
+ // The Android CDD (https://source.android.com/compatibility/12/android-12-cdd.pdf) does not
+ // require Vulkan, but if it enumerates at least one VkPhysicalDevice then it is expected that
+ // Vulkan is supported
+ if (contextType == GrContextFactory::kVulkan_ContextType && !vk_has_physical_devices()) {
+ return true;
+ }
+ return false;
+}
+
+void RunWithGPUTestContexts(GrContextTestFn* test,
+ GrContextTypeFilterFn* contextTypeFilter,
+ Reporter* reporter,
+ const GrContextOptions& options) {
+ for (int typeInt = 0; typeInt < GrContextFactory::kContextTypeCnt; ++typeInt) {
+ GrContextFactory::ContextType contextType = (GrContextFactory::ContextType)typeInt;
+ if (skip_context(contextType)) {
+ continue;
+ }
+
+ // The logic below is intended to mirror the behavior in DMGpuTestProcs.cpp
+ if (contextTypeFilter && !(*contextTypeFilter)(contextType)) {
+ continue;
+ }
+
+ sk_gpu_test::GrContextFactory factory(options);
+ sk_gpu_test::ContextInfo ctxInfo = factory.getContextInfo(contextType);
+
+ ReporterContext ctx(reporter, SkString(GrContextFactory::ContextTypeName(contextType)));
+ if (ctxInfo.directContext()) {
+ ctxInfo.testContext()->makeCurrent();
+ (*test)(reporter, ctxInfo);
+ // Sync so any release/finished procs get called.
+ ctxInfo.directContext()->flushAndSubmit(/*sync*/ true);
+ }
+ }
+}
+
+#ifdef SK_GRAPHITE_ENABLED
+
+namespace graphite {
+
+void RunWithGraphiteTestContexts(GraphiteTestFn* test, Reporter* reporter) { SK_ABORT(); }
+
+} // namespace graphite
+
+#endif // SK_GRAPHITE_ENABLED
+
+} // namespace skiatest
+
+void SkQP::printBackendInfo(const char* dstPath) {
+#ifdef SK_ENABLE_DUMP_GPU
+ SkFILEWStream out(dstPath);
+ out.writeText("[\n");
+
+ GrContextFactory::ContextType contextsToDump[] = {skiatest::kNativeGLType,
+ GrContextFactory::kVulkan_ContextType};
+
+ for (auto contextType : contextsToDump) {
+ std::unique_ptr<TestContext> testCtx;
+ switch (contextType) {
+#ifdef SK_GL
+ case GrContextFactory::kGL_ContextType:
+ testCtx.reset(sk_gpu_test::CreatePlatformGLTestContext(kGL_GrGLStandard, nullptr));
+ break;
+ case GrContextFactory::kGLES_ContextType:
+ testCtx.reset(
+ sk_gpu_test::CreatePlatformGLTestContext(kGLES_GrGLStandard, nullptr));
+ break;
+#endif
+#ifdef SK_VULKAN
+ case GrContextFactory::kVulkan_ContextType:
+ testCtx.reset(sk_gpu_test::CreatePlatformVkTestContext(nullptr));
+ break;
+#endif
+ default: {
+ }
+ }
+
+ if (testCtx) {
+ GrContextOptions options;
+ testCtx->makeCurrent();
+ if (sk_sp<GrDirectContext> ctx = testCtx->makeContext(options)) {
+ SkString info = ctx->dump();
+ // remove null
+ out.write(info.c_str(), info.size());
+ out.writeText(",\n");
+ }
+ }
+ }
+ out.writeText("]\n");
+#endif
+}
diff --git a/chromium/third_party/skia/tools/sksl-precompile/SkSLPrecompile.cpp b/chromium/third_party/skia/tools/sksl-precompile/SkSLPrecompile.cpp
index f375496adcd..0e7841223c4 100644
--- a/chromium/third_party/skia/tools/sksl-precompile/SkSLPrecompile.cpp
+++ b/chromium/third_party/skia/tools/sksl-precompile/SkSLPrecompile.cpp
@@ -16,11 +16,10 @@
#include "src/sksl/SkSLCompiler.h"
#include "src/sksl/SkSLDehydrator.h"
#include "src/sksl/SkSLFileOutputStream.h"
+#include "src/sksl/SkSLProgramSettings.h"
#include "src/sksl/SkSLStringStream.h"
#include "src/sksl/SkSLUtil.h"
-#include "src/sksl/ir/SkSLUnresolvedFunction.h"
#include "src/sksl/ir/SkSLVarDeclarations.h"
-#include "src/utils/SkOSPath.h"
#include "src/utils/SkShaderUtils.h"
#include <fstream>
@@ -49,6 +48,16 @@ enum class ResultCode {
kOutputError = 3,
};
+static std::string base_name(const std::string& path) {
+ size_t slashPos = path.find_last_of("/\\");
+ return path.substr(slashPos == std::string::npos ? 0 : slashPos + 1);
+}
+
+static std::string remove_extension(const std::string& path) {
+ size_t dotPos = path.find_last_of('.');
+ return path.substr(0, dotPos);
+}
+
/**
* Displays a usage banner; used when the command line arguments don't make sense.
*/
@@ -65,7 +74,7 @@ ResultCode processCommand(const std::vector<std::string>& paths) {
return ResultCode::kInputError;
}
- SkSL::Program::Settings settings;
+ SkSL::ProgramSettings settings;
auto standaloneCaps = SkSL::ShaderCapsFactory::Standalone();
const SkSL::ShaderCaps* caps = standaloneCaps.get();
@@ -103,10 +112,7 @@ ResultCode processCommand(const std::vector<std::string>& paths) {
SkSL::Dehydrator dehydrator;
dehydrator.write(*module.fSymbols);
dehydrator.write(module.fElements);
- SkString baseName = SkOSPath::Basename(inputPath.c_str());
- if (int extension = baseName.findLastOf('.'); extension > 0) {
- baseName.resize(extension);
- }
+ std::string baseName = remove_extension(base_name(inputPath));
SkSL::StringStream buffer;
dehydrator.finish(buffer);
@@ -119,7 +125,7 @@ ResultCode processCommand(const std::vector<std::string>& paths) {
printf("error writing '%s'\n", outputPath.c_str());
return ResultCode::kOutputError;
}
- out.printf("static uint8_t SKSL_INCLUDE_%s[] = {", baseName.c_str());
+ out.printf("static constexpr uint8_t SKSL_INCLUDE_%s[] = {", baseName.c_str());
for (size_t i = 0; i < data.length(); ++i) {
out.printf("%s%d,", dehydrator.prefixAtOffset(i), uint8_t(data[i]));
}
diff --git a/chromium/third_party/skia/tools/skslc/Main.cpp b/chromium/third_party/skia/tools/skslc/Main.cpp
index 55de9f71703..2c8e6da5826 100644
--- a/chromium/third_party/skia/tools/skslc/Main.cpp
+++ b/chromium/third_party/skia/tools/skslc/Main.cpp
@@ -19,7 +19,7 @@
#include "src/sksl/SkSLUtil.h"
#include "src/sksl/codegen/SkSLPipelineStageCodeGenerator.h"
#include "src/sksl/codegen/SkSLVMCodeGenerator.h"
-#include "src/sksl/ir/SkSLUnresolvedFunction.h"
+#include "src/sksl/ir/SkSLProgram.h"
#include "src/sksl/ir/SkSLVarDeclarations.h"
#include "src/sksl/tracing/SkVMDebugTrace.h"
#include "src/utils/SkShaderUtils.h"
@@ -33,8 +33,6 @@
#include <stdarg.h>
#include <stdio.h>
-extern bool gSkVMAllowJIT;
-
void SkDebugf(const char format[], ...) {
va_list args;
va_start(args, format);
@@ -88,7 +86,7 @@ static bool consume_suffix(std::string* str, const char suffix[]) {
// /*#pragma settings Default Sharpen*/
// The passed-in Settings object will be updated accordingly. Any number of options can be provided.
static bool detect_shader_settings(const std::string& text,
- SkSL::Program::Settings* settings,
+ SkSL::ProgramSettings* settings,
const SkSL::ShaderCaps** caps,
std::unique_ptr<SkSL::SkVMDebugTrace>* debugTrace) {
using Factory = SkSL::ShaderCapsFactory;
@@ -299,6 +297,8 @@ ResultCode processCommand(const std::vector<std::string>& args) {
kind = SkSL::ProgramKind::kVertex;
} else if (skstd::ends_with(inputPath, ".frag") || skstd::ends_with(inputPath, ".sksl")) {
kind = SkSL::ProgramKind::kFragment;
+ } else if (skstd::ends_with(inputPath, ".compute")) {
+ kind = SkSL::ProgramKind::kCompute;
} else if (skstd::ends_with(inputPath, ".rtb")) {
kind = SkSL::ProgramKind::kRuntimeBlender;
} else if (skstd::ends_with(inputPath, ".rtcf")) {
@@ -319,7 +319,7 @@ ResultCode processCommand(const std::vector<std::string>& args) {
return ResultCode::kInputError;
}
- SkSL::Program::Settings settings;
+ SkSL::ProgramSettings settings;
auto standaloneCaps = SkSL::ShaderCapsFactory::Standalone();
const SkSL::ShaderCaps* caps = standaloneCaps.get();
std::unique_ptr<SkSL::SkVMDebugTrace> debugTrace;
@@ -517,7 +517,6 @@ ResultCode processCommand(const std::vector<std::string>& args) {
settings.fAllowTraceVarInSkVMDebugTrace = false;
SkCpu::CacheRuntimeFeatures();
- gSkVMAllowJIT = true;
return compileProgramForSkVM(
[&](SkSL::Compiler&, SkSL::Program& program, SkSL::OutputStream& out) {
if (!debugTrace) {
@@ -532,16 +531,8 @@ ResultCode processCommand(const std::vector<std::string>& args) {
std::unique_ptr<SkWStream> redirect = as_SkWStream(out);
skvm::Program p = builder.done(
- /*debug_name=*/nullptr, /*allow_jit=*/true, std::move(visualizer));
-#if defined(SKVM_JIT)
- SkDynamicMemoryWStream asmFile;
- p.disassemble(&asmFile);
- auto dumpData = asmFile.detachAsData();
- std::string dumpString(static_cast<const char*>(dumpData->data()),dumpData->size());
- p.visualize(redirect.get(), dumpString.c_str());
-#else
- p.visualize(redirect.get(), nullptr);
-#endif
+ /*debug_name=*/nullptr, /*allow_jit=*/false, std::move(visualizer));
+ p.visualize(redirect.get());
return true;
});
} else {
diff --git a/chromium/third_party/skia/tools/skui/BUILD.bazel b/chromium/third_party/skia/tools/skui/BUILD.bazel
index a2198a4ebad..b1d22bca968 100644
--- a/chromium/third_party/skia/tools/skui/BUILD.bazel
+++ b/chromium/third_party/skia/tools/skui/BUILD.bazel
@@ -1,10 +1,10 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy")
+load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_library")
licenses(["notice"])
exports_files_legacy()
-cc_library(
+skia_cc_library(
name = "skui",
srcs = ["//include/private:SkBitmaskEnum.h"],
hdrs = [
diff --git a/chromium/third_party/skia/tools/timer/BUILD.bazel b/chromium/third_party/skia/tools/timer/BUILD.bazel
index 0c3c412c51c..300678d5bf7 100644
--- a/chromium/third_party/skia/tools/timer/BUILD.bazel
+++ b/chromium/third_party/skia/tools/timer/BUILD.bazel
@@ -1,10 +1,10 @@
-load("//bazel:macros.bzl", "cc_library", "exports_files_legacy")
+load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_library")
licenses(["notice"])
exports_files_legacy()
-cc_library(
+skia_cc_library(
name = "timer",
srcs = [
"TimeUtils.h",
diff --git a/chromium/third_party/skia/tools/trace/ChromeTracingTracer.cpp b/chromium/third_party/skia/tools/trace/ChromeTracingTracer.cpp
index 530c3c346b2..f46df85f47a 100644
--- a/chromium/third_party/skia/tools/trace/ChromeTracingTracer.cpp
+++ b/chromium/third_party/skia/tools/trace/ChromeTracingTracer.cpp
@@ -161,11 +161,11 @@ static void trace_value_to_json(SkJSONWriter* writer,
case TRACE_VALUE_TYPE_INT: writer->appendS64(value.as_int); break;
case TRACE_VALUE_TYPE_DOUBLE: writer->appendDouble(value.as_double); break;
case TRACE_VALUE_TYPE_POINTER: writer->appendPointer(value.as_pointer); break;
- case TRACE_VALUE_TYPE_STRING: writer->appendString(value.as_string); break;
+ case TRACE_VALUE_TYPE_STRING: writer->appendCString(value.as_string); break;
case TRACE_VALUE_TYPE_COPY_STRING:
- writer->appendString(stringTableBase + value.as_uint);
+ writer->appendCString(stringTableBase + value.as_uint);
break;
- default: writer->appendString("<unknown type>"); break;
+ default: writer->appendNString("<unknown type>"); break;
}
}
@@ -208,9 +208,8 @@ static void trace_event_to_json(SkJSONWriter* writer,
writer->beginObject();
- char phaseString[2] = {traceEvent->fPhase, 0};
- writer->appendString("ph", phaseString);
- writer->appendString("name", traceEvent->fName);
+ writer->appendString("ph", &traceEvent->fPhase, 1);
+ writer->appendCString("name", traceEvent->fName);
if (0 != traceEvent->fID) {
// IDs are (almost) always pointers
writer->appendPointer("id", reinterpret_cast<void*>(traceEvent->fID));
@@ -240,7 +239,7 @@ static void trace_event_to_json(SkJSONWriter* writer,
0 != strcmp(*baseTypeResolver->find(traceEvent->fID), traceEvent->fName)) {
// Special handling for snapshots where the name differs from creation.
writer->beginObject("snapshot");
- writer->appendString("base_type", *baseTypeResolver->find(traceEvent->fID));
+ writer->appendCString("base_type", *baseTypeResolver->find(traceEvent->fID));
addedSnapshot = true;
}
diff --git a/chromium/third_party/skia/tools/trace/ChromeTracingTracer.h b/chromium/third_party/skia/tools/trace/ChromeTracingTracer.h
index 56eed3221cf..77657d4e23c 100644
--- a/chromium/third_party/skia/tools/trace/ChromeTracingTracer.h
+++ b/chromium/third_party/skia/tools/trace/ChromeTracingTracer.h
@@ -46,6 +46,9 @@ public:
return fCategories.getCategoryGroupName(categoryEnabledFlag);
}
+ // The Chrome tracer does not yet support splitting up trace output into sections.
+ void newTracingSection(const char* name) override {}
+
private:
void flush();
diff --git a/chromium/third_party/skia/tools/trace/EventTracingPriv.cpp b/chromium/third_party/skia/tools/trace/EventTracingPriv.cpp
index 47a7f524ec1..03e7d810363 100644
--- a/chromium/third_party/skia/tools/trace/EventTracingPriv.cpp
+++ b/chromium/third_party/skia/tools/trace/EventTracingPriv.cpp
@@ -13,12 +13,16 @@
#include "tools/flags/CommandLineFlags.h"
#include "tools/trace/ChromeTracingTracer.h"
#include "tools/trace/SkDebugfTracer.h"
+#if defined(SK_USE_PERFETTO)
+ #include "tools/trace/SkPerfettoTrace.h"
+#endif
static DEFINE_string(trace,
"",
"Log trace events in one of several modes:\n"
" debugf : Show events using SkDebugf\n"
" atrace : Send events to Android ATrace\n"
+ " perfetto : Send events to Perfetto (Linux, Android, and Mac only)\n"
" <filename> : Any other string is interpreted as a filename. Writes\n"
" trace events to specified file as JSON, for viewing\n"
" with chrome://tracing");
@@ -41,7 +45,17 @@ void initializeEventTracingForTools(const char* traceFlag) {
eventTracer = new SkATrace();
} else if (0 == strcmp(traceFlag, "debugf")) {
eventTracer = new SkDebugfTracer();
- } else {
+ } else if (0 == strcmp(traceFlag, "perfetto")) {
+ #if defined(SK_USE_PERFETTO)
+ eventTracer = new SkPerfettoTrace();
+ #else
+ SkDebugf("Perfetto is not enabled (SK_USE_PERFETTO is false). Perfetto tracing will not"
+ "be performed.\nTracing with Perfetto is only enabled for Linux, Android, and"
+ "Mac.\n");
+ return;
+ #endif
+ }
+ else {
eventTracer = new ChromeTracingTracer(traceFlag);
}
diff --git a/chromium/third_party/skia/tools/trace/SkDebugfTracer.cpp b/chromium/third_party/skia/tools/trace/SkDebugfTracer.cpp
index 837e0ed496d..3475adf702a 100644
--- a/chromium/third_party/skia/tools/trace/SkDebugfTracer.cpp
+++ b/chromium/third_party/skia/tools/trace/SkDebugfTracer.cpp
@@ -83,3 +83,7 @@ void SkDebugfTracer::updateTraceEventDuration(const uint8_t* categoryEnabledFlag
fIndent.resize(fIndent.size() - 1);
SkDebugf("[% 2d]%s } %s\n", (int)fIndent.size(), fIndent.c_str(), name);
}
+
+void SkDebugfTracer::newTracingSection(const char* name) {
+ SkDebugf("\n\n- - - New tracing section: %s - - -\n", name);
+}
diff --git a/chromium/third_party/skia/tools/trace/SkDebugfTracer.h b/chromium/third_party/skia/tools/trace/SkDebugfTracer.h
index bd19f51e80f..de688c1097f 100644
--- a/chromium/third_party/skia/tools/trace/SkDebugfTracer.h
+++ b/chromium/third_party/skia/tools/trace/SkDebugfTracer.h
@@ -41,6 +41,8 @@ public:
return fCategories.getCategoryGroupName(categoryEnabledFlag);
}
+ void newTracingSection(const char* name) override;
+
private:
SkString fIndent;
int fCnt = 0;
diff --git a/chromium/third_party/skia/tools/trace/SkPerfettoTrace.cpp b/chromium/third_party/skia/tools/trace/SkPerfettoTrace.cpp
new file mode 100644
index 00000000000..bb28eaceae6
--- /dev/null
+++ b/chromium/third_party/skia/tools/trace/SkPerfettoTrace.cpp
@@ -0,0 +1,354 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "tools/trace/SkPerfettoTrace.h"
+
+#include <fcntl.h>
+#include <fstream>
+#include "src/core/SkTraceEvent.h"
+#include "src/core/SkTraceEventCommon.h"
+#include "tools/flags/CommandLineFlags.h"
+
+PERFETTO_TRACK_EVENT_STATIC_STORAGE();
+
+static DEFINE_string(perfettoOutputDir, "./",
+ "Output directory for perfetto trace file(s).\n"
+ "Note: not the name of the file itself.\n"
+ "Will only have an effect if perfetto tracing is enabled. See --trace.");
+static DEFINE_string(perfettoOutputFileName, "trace",
+ "Output file name (excluding path and file extension) for the perfetto trace"
+ "file.\nNote: When splitting trace files by benchmark (see "
+ "--splitPerfettoTracesByBenchmark), file name will be determined by the "
+ "benchmark name.\n"
+ "Will only have an effect if perfetto tracing is enabled. See --trace.");
+static DEFINE_string(perfettoOutputFileExtension, ".perfetto-trace",
+ "Output file extension for perfetto trace file(s).\n"
+ "Will only have an effect if perfetto tracing is enabled. See --trace.");
+static DEFINE_bool(longPerfettoTrace, false,
+ "Perfetto within Skia is optimized for tracing performance of 'smaller' traces"
+ "(~10 seconds or less). Set this flag to true to optimize for longer tracing"
+ "sessions.\n"
+ "Will only have an effect if perfetto tracing is enabled. See --trace.");
+
+SkPerfettoTrace::SkPerfettoTrace() {
+ fOutputPath = FLAGS_perfettoOutputDir[0];
+ fOutputFileExtension = FLAGS_perfettoOutputFileExtension[0];
+ this->openNewTracingSession(FLAGS_perfettoOutputFileName[0]);
+}
+
+SkPerfettoTrace::~SkPerfettoTrace() {
+ this->closeTracingSession();
+}
+
+void SkPerfettoTrace::openNewTracingSession(const std::string& baseFileName) {
+ perfetto::TracingInitArgs args;
+ /* Store the current tracing session's output file path as a member attribute so it can
+ * be referenced when closing a tracing session (needed for short traces where writing to
+ * the output file occurs at the end of all tracing). */
+ fCurrentSessionFullOutputPath = fOutputPath + baseFileName + fOutputFileExtension;
+
+ /* Enable using only the in-process backend (recording only within the app itself). This is as
+ * opposed to additionally including perfetto::kSystemBackend, which uses a Perfetto daemon. */
+ args.backends |= perfetto::kInProcessBackend;
+
+ if (FLAGS_longPerfettoTrace) {
+ /* Set the shared memory buffer size higher than the default of 256 KB to
+ reduce trace writer packet loss occurrences associated with larger traces. */
+ args.shmem_size_hint_kb = 2000;
+ }
+ perfetto::Tracing::Initialize(args);
+ perfetto::TrackEvent::Register();
+
+ // Set up event tracing configuration.
+ perfetto::protos::gen::TrackEventConfig track_event_cfg;
+ perfetto::TraceConfig cfg;
+
+ /* Set the central memory buffer size - will record up to this amount of data. */
+ cfg.add_buffers()->set_size_kb(32000);
+
+ if (FLAGS_longPerfettoTrace) {
+ /* Enable continuous file writing/"streaming mode" to output trace data throughout the
+ * program instead of one large dump at the end. */
+ cfg.set_write_into_file(true);
+ /* If set to a value other than the default, set how often trace data gets written to the
+ * output file. */
+ cfg.set_file_write_period_ms(5000);
+ /* Force periodic commitment of shared memory buffer pages to the central buffer.
+ * Helps prevent out-of-order event slices with long traces. */
+ cfg.set_flush_period_ms(10000);
+ }
+
+ auto* ds_cfg = cfg.add_data_sources()->mutable_config();
+ ds_cfg->set_name("track_event");
+ ds_cfg->set_track_event_config_raw(track_event_cfg.SerializeAsString());
+
+ // Begin a tracing session.
+ tracingSession = perfetto::Tracing::NewTrace();
+ if (FLAGS_longPerfettoTrace) {
+ fd = open(fCurrentSessionFullOutputPath.c_str(), O_RDWR | O_CREAT | O_TRUNC, 0600);
+ tracingSession->Setup(cfg, fd);
+ } else {
+ tracingSession->Setup(cfg);
+ }
+ tracingSession->StartBlocking();
+}
+
+void SkPerfettoTrace::closeTracingSession() {
+ perfetto::TrackEvent::Flush();
+ tracingSession->StopBlocking();
+ if (!FLAGS_longPerfettoTrace) {
+ std::vector<char> trace_data(tracingSession->ReadTraceBlocking());
+ std::ofstream output;
+ output.open(fCurrentSessionFullOutputPath, std::ios::out | std::ios::binary);
+ output.write(&trace_data[0], trace_data.size());
+ output.close();
+ } else {
+ close(fd);
+ }
+}
+
+SkEventTracer::Handle SkPerfettoTrace::addTraceEvent(char phase,
+ const uint8_t* categoryEnabledFlag,
+ const char* name,
+ uint64_t id,
+ int numArgs,
+ const char** argNames,
+ const uint8_t* argTypes,
+ const uint64_t* argValues,
+ uint8_t flags) {
+ perfetto::DynamicCategory category{ this->getCategoryGroupName(categoryEnabledFlag) };
+ if (TRACE_EVENT_PHASE_COMPLETE == phase ||
+ TRACE_EVENT_PHASE_INSTANT == phase) {
+ switch (numArgs) {
+ case 0: {
+ this->triggerTraceEvent(categoryEnabledFlag, name);
+ break;
+ }
+ case 1: {
+ this->triggerTraceEvent(categoryEnabledFlag, name, argNames[0], argTypes[0],
+ argValues[0]);
+ break;
+ }
+ case 2: {
+ this->triggerTraceEvent(categoryEnabledFlag, name, argNames[0], argTypes[0],
+ argValues[0], argNames[1], argTypes[1], argValues[1]);
+ break;
+ }
+ }
+ } else if (TRACE_EVENT_PHASE_END == phase) {
+ TRACE_EVENT_END(category);
+ }
+
+ if (TRACE_EVENT_PHASE_INSTANT == phase) {
+ TRACE_EVENT_END(category);
+ }
+ return 0;
+}
+
+void SkPerfettoTrace::updateTraceEventDuration(const uint8_t* categoryEnabledFlag,
+ const char* name,
+ SkEventTracer::Handle handle) {
+ // This is only ever called from a scoped trace event, so we will just end the event.
+ perfetto::DynamicCategory category{ this->getCategoryGroupName(categoryEnabledFlag) };
+ TRACE_EVENT_END(category);
+}
+
+const uint8_t* SkPerfettoTrace::getCategoryGroupEnabled(const char* name) {
+ return fCategories.getCategoryGroupEnabled(name);
+}
+
+const char* SkPerfettoTrace::getCategoryGroupName(const uint8_t* categoryEnabledFlag) {
+ return fCategories.getCategoryGroupName(categoryEnabledFlag);
+}
+
+void SkPerfettoTrace::triggerTraceEvent(const uint8_t* categoryEnabledFlag,
+ const char* eventName) {
+ perfetto::DynamicCategory category{ this->getCategoryGroupName(categoryEnabledFlag) };
+ TRACE_EVENT_BEGIN(category, nullptr, [&](perfetto::EventContext ctx) {
+ ctx.event()->set_name(eventName);
+ });
+}
+
+void SkPerfettoTrace::triggerTraceEvent(const uint8_t* categoryEnabledFlag, const char* eventName,
+ const char* arg1Name, const uint8_t& arg1Type,
+ const uint64_t& arg1Val) {
+ perfetto::DynamicCategory category{ this->getCategoryGroupName(categoryEnabledFlag) };
+ skia::tracing_internals::TraceValueUnion value;
+ value.as_uint = arg1Val;
+
+ switch (arg1Type) {
+ case TRACE_VALUE_TYPE_BOOL: {
+ TRACE_EVENT_BEGIN(category, nullptr, arg1Name, value.as_bool,
+ [&](perfetto::EventContext ctx) {
+ ctx.event()->set_name(eventName); });
+ break;
+ }
+ case TRACE_VALUE_TYPE_UINT: {
+ TRACE_EVENT_BEGIN(category, nullptr, arg1Name, value.as_uint,
+ [&](perfetto::EventContext ctx) {
+ ctx.event()->set_name(eventName); });
+ break;
+ }
+ case TRACE_VALUE_TYPE_INT: {
+ TRACE_EVENT_BEGIN(category, nullptr, arg1Name, value.as_int,
+ [&](perfetto::EventContext ctx) {
+ ctx.event()->set_name(eventName); });
+ break;
+ }
+ case TRACE_VALUE_TYPE_DOUBLE: {
+ TRACE_EVENT_BEGIN(category, nullptr, arg1Name, value.as_double,
+ [&](perfetto::EventContext ctx) {
+ ctx.event()->set_name(eventName); });
+ break;
+ }
+ case TRACE_VALUE_TYPE_POINTER: {
+ TRACE_EVENT_BEGIN(category, nullptr, arg1Name, value.as_pointer,
+ [&](perfetto::EventContext ctx) {
+ ctx.event()->set_name(eventName); });
+ break;
+ }
+ case TRACE_VALUE_TYPE_STRING: {
+ TRACE_EVENT_BEGIN(category, nullptr, arg1Name, value.as_string,
+ [&](perfetto::EventContext ctx) {
+ ctx.event()->set_name(eventName); });
+ break;
+ }
+ case TRACE_VALUE_TYPE_COPY_STRING: {
+ TRACE_EVENT_BEGIN(category, nullptr, arg1Name, value.as_string,
+ [&](perfetto::EventContext ctx) {
+ ctx.event()->set_name(eventName); });
+ break;
+ }
+ default: {
+ SkUNREACHABLE;
+ break;
+ }
+ }
+}
+
+namespace {
+/* Define a template to help handle all the possible TRACE_EVENT_BEGIN macro call
+ * combinations with 2 arguments of various types (defined in TraceValueUnion).
+ */
+template <typename T>
+void begin_event_with_second_arg(const char * categoryName, const char* eventName,
+ const char* arg1Name, T arg1Val, const char* arg2Name,
+ const uint8_t& arg2Type, const uint64_t& arg2Val) {
+ perfetto::DynamicCategory category{categoryName};
+ skia::tracing_internals::TraceValueUnion value;
+ value.as_uint = arg2Val;
+
+ switch (arg2Type) {
+ case TRACE_VALUE_TYPE_BOOL: {
+ TRACE_EVENT_BEGIN(category, nullptr, arg1Name, arg1Val, arg2Name, value.as_bool,
+ [&](perfetto::EventContext ctx) {
+ ctx.event()->set_name(eventName); });
+ break;
+ }
+ case TRACE_VALUE_TYPE_UINT: {
+ TRACE_EVENT_BEGIN(category, nullptr, arg1Name, arg1Val, arg2Name, value.as_uint,
+ [&](perfetto::EventContext ctx) {
+ ctx.event()->set_name(eventName); });
+ break;
+ }
+ case TRACE_VALUE_TYPE_INT: {
+ TRACE_EVENT_BEGIN(category, nullptr, arg1Name, arg1Val, arg1Name, value.as_int,
+ [&](perfetto::EventContext ctx) {
+ ctx.event()->set_name(eventName); });
+ break;
+ }
+ case TRACE_VALUE_TYPE_DOUBLE: {
+ TRACE_EVENT_BEGIN(category, nullptr, arg1Name, arg1Val, arg2Name, value.as_double,
+ [&](perfetto::EventContext ctx) {
+ ctx.event()->set_name(eventName); });
+ break;
+ }
+ case TRACE_VALUE_TYPE_POINTER: {
+ TRACE_EVENT_BEGIN(category, nullptr, arg1Name, arg1Val, arg2Name, value.as_pointer,
+ [&](perfetto::EventContext ctx) {
+ ctx.event()->set_name(eventName); });
+ break;
+ }
+ case TRACE_VALUE_TYPE_STRING: {
+ TRACE_EVENT_BEGIN(category, nullptr, arg1Name, arg1Val, arg2Name, value.as_string,
+ [&](perfetto::EventContext ctx) {
+ ctx.event()->set_name(eventName); });
+ break;
+ }
+ case TRACE_VALUE_TYPE_COPY_STRING: {
+ TRACE_EVENT_BEGIN(category, nullptr, arg1Name, arg1Val, arg2Name, value.as_string,
+ [&](perfetto::EventContext ctx) {
+ ctx.event()->set_name(eventName); });
+ break;
+ }
+ default: {
+ SkUNREACHABLE;
+ break;
+ }
+ }
+}
+} // anonymous namespace
+
+void SkPerfettoTrace::triggerTraceEvent(const uint8_t* categoryEnabledFlag,
+ const char* eventName, const char* arg1Name,
+ const uint8_t& arg1Type, const uint64_t& arg1Val,
+ const char* arg2Name, const uint8_t& arg2Type,
+ const uint64_t& arg2Val) {
+
+ const char * category{ this->getCategoryGroupName(categoryEnabledFlag) };
+ skia::tracing_internals::TraceValueUnion value;
+ value.as_uint = arg1Val;
+
+ switch (arg1Type) {
+ case TRACE_VALUE_TYPE_BOOL: {
+ begin_event_with_second_arg(category, eventName, arg1Name, value.as_bool, arg2Name,
+ arg2Type, arg2Val);
+ break;
+ }
+ case TRACE_VALUE_TYPE_UINT: {
+ begin_event_with_second_arg(category, eventName, arg1Name, value.as_uint, arg2Name,
+ arg2Type, arg2Val);
+ break;
+ }
+ case TRACE_VALUE_TYPE_INT: {
+ begin_event_with_second_arg(category, eventName, arg1Name, value.as_int, arg2Name,
+ arg2Type, arg2Val);
+ break;
+ }
+ case TRACE_VALUE_TYPE_DOUBLE: {
+ begin_event_with_second_arg(category, eventName, arg1Name, value.as_double, arg2Name,
+ arg2Type, arg2Val);
+ break;
+ }
+ case TRACE_VALUE_TYPE_POINTER: {
+ begin_event_with_second_arg(category, eventName, arg1Name, value.as_pointer, arg2Name,
+ arg2Type, arg2Val);
+ break;
+ }
+ case TRACE_VALUE_TYPE_STRING: {
+ begin_event_with_second_arg(category, eventName, arg1Name, value.as_string, arg2Name,
+ arg2Type, arg2Val);
+ break;
+ }
+ case TRACE_VALUE_TYPE_COPY_STRING: {
+ begin_event_with_second_arg(category, eventName, arg1Name, value.as_string, arg2Name,
+ arg2Type, arg2Val);
+ break;
+ }
+ default: {
+ SkUNREACHABLE;
+ break;
+ }
+ }
+}
+
+void SkPerfettoTrace::newTracingSection(const char* name) {
+ if (perfetto::Tracing::IsInitialized()) {
+ this->closeTracingSession();
+ }
+ this->openNewTracingSession(name);
+}
diff --git a/chromium/third_party/skia/tools/trace/SkPerfettoTrace.h b/chromium/third_party/skia/tools/trace/SkPerfettoTrace.h
new file mode 100644
index 00000000000..e0e213f4c7c
--- /dev/null
+++ b/chromium/third_party/skia/tools/trace/SkPerfettoTrace.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkPerfettoTrace_DEFINED
+#define SkPerfettoTrace_DEFINED
+
+#include "include/utils/SkEventTracer.h"
+#include "tools/trace/EventTracingPriv.h"
+#include "perfetto.h"
+
+PERFETTO_DEFINE_CATEGORIES();
+
+/**
+ * This class is used to support Perfetto tracing. It hooks into the SkEventTracer system.
+ */
+class SkPerfettoTrace : public SkEventTracer {
+public:
+ SkPerfettoTrace();
+ ~SkPerfettoTrace() override;
+
+ SkEventTracer::Handle addTraceEvent(char phase,
+ const uint8_t* categoryEnabledFlag,
+ const char* name,
+ uint64_t id,
+ int numArgs,
+ const char** argNames,
+ const uint8_t* argTypes,
+ const uint64_t* argValues,
+ uint8_t flags) override;
+
+
+ void updateTraceEventDuration(const uint8_t* categoryEnabledFlag,
+ const char* name,
+ SkEventTracer::Handle handle) override;
+
+ const uint8_t* getCategoryGroupEnabled(const char* name) override;
+
+ const char* getCategoryGroupName(const uint8_t* categoryEnabledFlag) override;
+
+ void newTracingSection(const char* name) override;
+
+private:
+ SkPerfettoTrace(const SkPerfettoTrace&) = delete;
+ SkPerfettoTrace& operator=(const SkPerfettoTrace&) = delete;
+ SkEventTracingCategories fCategories;
+ std::unique_ptr<perfetto::TracingSession> tracingSession;
+ int fd{-1};
+
+ /** Store the perfetto trace file output path, name, and extension separately. This isolation
+ * of name components becomes useful when splitting traces up by sections, where we want to
+ * alter the base file name but keep the trace output path and file extension the same.
+ */
+ std::string fOutputPath;
+ std::string fOutputFileExtension;
+ std::string fCurrentSessionFullOutputPath;
+
+ void openNewTracingSession(const std::string& baseFileName);
+ void closeTracingSession();
+
+ /** Overloaded private methods to initiate a trace event with 0-2 arguments. Perfetto supports
+ * adding an arbitrary number of debug annotations or arguments, but the existing Skia trace
+ * structure only supports 0-2 so that is all we accommodate.
+ */
+ void triggerTraceEvent(const uint8_t* categoryEnabledFlag, const char* eventName);
+ void triggerTraceEvent(const uint8_t* categoryEnabledFlag, const char* eventName,
+ const char* arg1Name, const uint8_t& arg1Type, const uint64_t& arg1Val);
+ void triggerTraceEvent(const uint8_t* categoryEnabledFlag, const char* eventName,
+ const char* arg1Name, const uint8_t& arg1Type, const uint64_t& arg1Val,
+ const char* arg2Name, const uint8_t& arg2Type, const uint64_t& arg2Val);
+};
+
+#endif
diff --git a/chromium/third_party/skia/tools/viewer/SkSLDebuggerSlide.cpp b/chromium/third_party/skia/tools/viewer/SkSLDebuggerSlide.cpp
index 4b2183b88f4..710822fee70 100644
--- a/chromium/third_party/skia/tools/viewer/SkSLDebuggerSlide.cpp
+++ b/chromium/third_party/skia/tools/viewer/SkSLDebuggerSlide.cpp
@@ -34,7 +34,7 @@ void SkSLDebuggerSlide::unload() {
}
void SkSLDebuggerSlide::showLoadTraceGUI() {
- ImGui::InputText("Trace Path", fTraceFile, SK_ARRAY_COUNT(fTraceFile));
+ ImGui::InputText("Trace Path", fTraceFile, std::size(fTraceFile));
bool load = ImGui::Button("Load Debug Trace");
if (load) {
diff --git a/chromium/third_party/skia/tools/viewer/SkSLSlide.cpp b/chromium/third_party/skia/tools/viewer/SkSLSlide.cpp
index 70d12e09d2a..6783f7168b0 100644
--- a/chromium/third_party/skia/tools/viewer/SkSLSlide.cpp
+++ b/chromium/third_party/skia/tools/viewer/SkSLSlide.cpp
@@ -171,17 +171,17 @@ void SkSLSlide::draw(SkCanvas* canvas) {
fMousePos.z = abs(fMousePos.z) * (ImGui::IsMouseDown(0) ? 1 : -1);
fMousePos.w = abs(fMousePos.w) * (ImGui::IsMouseClicked(0) ? 1 : -1);
- for (const auto& v : fEffect->uniforms()) {
+ for (const SkRuntimeEffect::Uniform& v : fEffect->uniforms()) {
char* data = fInputs.get() + v.offset;
- if (v.name.equals("iResolution")) {
+ if (v.name == "iResolution") {
memcpy(data, &fResolution, sizeof(fResolution));
continue;
}
- if (v.name.equals("iTime")) {
+ if (v.name == "iTime") {
memcpy(data, &fSeconds, sizeof(fSeconds));
continue;
}
- if (v.name.equals("iMouse")) {
+ if (v.name == "iMouse") {
memcpy(data, &fMousePos, sizeof(fMousePos));
continue;
}
@@ -193,8 +193,9 @@ void SkSLSlide::draw(SkCanvas* canvas) {
int rows = ((int)v.type - (int)SkRuntimeEffect::Uniform::Type::kFloat) + 1;
float* f = reinterpret_cast<float*>(data);
for (int c = 0; c < v.count; ++c, f += rows) {
- SkString name = v.isArray() ? SkStringPrintf("%s[%d]", v.name.c_str(), c)
- : v.name;
+ SkString name = v.isArray()
+ ? SkStringPrintf("%.*s[%d]", (int)v.name.size(), v.name.data(), c)
+ : SkString(v.name);
ImGui::PushID(c);
ImGui::DragScalarN(name.c_str(), ImGuiDataType_Float, f, rows, 1.0f);
ImGui::PopID();
@@ -210,8 +211,8 @@ void SkSLSlide::draw(SkCanvas* canvas) {
for (int e = 0; e < v.count; ++e) {
for (int c = 0; c < cols; ++c, f += rows) {
SkString name = v.isArray()
- ? SkStringPrintf("%s[%d][%d]", v.name.c_str(), e, c)
- : SkStringPrintf("%s[%d]", v.name.c_str(), c);
+ ? SkStringPrintf("%.*s[%d][%d]", (int)v.name.size(), v.name.data(), e, c)
+ : SkStringPrintf("%.*s[%d]", (int)v.name.size(), v.name.data(), c);
ImGui::DragScalarN(name.c_str(), ImGuiDataType_Float, f, rows, 1.0f);
}
}
@@ -224,8 +225,9 @@ void SkSLSlide::draw(SkCanvas* canvas) {
int rows = ((int)v.type - (int)SkRuntimeEffect::Uniform::Type::kInt) + 1;
int* i = reinterpret_cast<int*>(data);
for (int c = 0; c < v.count; ++c, i += rows) {
- SkString name = v.isArray() ? SkStringPrintf("%s[%d]", v.name.c_str(), c)
- : v.name;
+ SkString name = v.isArray()
+ ? SkStringPrintf("%.*s[%d]", (int)v.name.size(), v.name.data(), c)
+ : SkString(v.name);
ImGui::PushID(c);
ImGui::DragScalarN(name.c_str(), ImGuiDataType_S32, i, rows, 1.0f);
ImGui::PopID();
@@ -235,14 +237,16 @@ void SkSLSlide::draw(SkCanvas* canvas) {
}
}
- for (const auto& c : fEffect->children()) {
- auto curShader =
- std::find_if(fShaders.begin(), fShaders.end(), [tgt = fChildren[c.index]](auto p) {
+ for (const SkRuntimeEffect::Child& c : fEffect->children()) {
+ auto curShader = std::find_if(
+ fShaders.begin(),
+ fShaders.end(),
+ [tgt = fChildren[c.index]](const std::pair<const char*, sk_sp<SkShader>>& p) {
return p.second == tgt;
});
SkASSERT(curShader != fShaders.end());
- if (ImGui::BeginCombo(c.name.c_str(), curShader->first)) {
+ if (ImGui::BeginCombo(std::string(c.name).c_str(), curShader->first)) {
for (const auto& namedShader : fShaders) {
if (ImGui::Selectable(namedShader.first, curShader->second == namedShader.second)) {
fChildren[c.index] = namedShader.second;
diff --git a/chromium/third_party/skia/tools/viewer/Viewer.cpp b/chromium/third_party/skia/tools/viewer/Viewer.cpp
index cd8312c0285..9040c45c343 100644
--- a/chromium/third_party/skia/tools/viewer/Viewer.cpp
+++ b/chromium/third_party/skia/tools/viewer/Viewer.cpp
@@ -19,7 +19,6 @@
#include "include/utils/SkPaintFilterCanvas.h"
#include "src/core/SkAutoPixmapStorage.h"
#include "src/core/SkColorSpacePriv.h"
-#include "src/core/SkGlyphRun.h"
#include "src/core/SkImagePriv.h"
#include "src/core/SkMD5.h"
#include "src/core/SkOSFile.h"
@@ -36,6 +35,7 @@
#include "src/gpu/ganesh/GrPersistentCacheUtils.h"
#include "src/image/SkImage_Base.h"
#include "src/sksl/SkSLCompiler.h"
+#include "src/text/GlyphRun.h"
#include "src/utils/SkJSONWriter.h"
#include "src/utils/SkOSPath.h"
#include "src/utils/SkShaderUtils.h"
@@ -79,7 +79,7 @@
#include "tools/viewer/RiveSlide.h"
#if defined(SK_ENABLE_SVG)
- #include "modules/svg/include/SkSVGOpenTypeSVGDecoder.h"
+#include "modules/svg/include/SkSVGOpenTypeSVGDecoder.h"
#endif
class CapturingShaderErrorHandler : public GrContextOptions::ShaderErrorHandler {
@@ -332,6 +332,8 @@ extern bool gUseSkVMBlitter;
extern bool gSkVMAllowJIT;
extern bool gSkVMJITViaDylib;
+static bool ColrV1VariationsEnabledForTest() { return true; }
+
Viewer::Viewer(int argc, char** argv, void* platformData)
: fCurrentSlide(-1)
, fRefresh(false)
@@ -365,6 +367,7 @@ Viewer::Viewer(int argc, char** argv, void* platformData)
#if defined(SK_ENABLE_SVG)
SkGraphics::SetOpenTypeSVGDecoderFactory(SkSVGOpenTypeSVGDecoder::Make);
#endif
+ SkGraphics::SetVariableColrV1EnabledFunc(ColrV1VariationsEnabledForTest);
gPathRendererNames[GpuPathRenderers::kDefault] = "Default Path Renderers";
gPathRendererNames[GpuPathRenderers::kAtlas] = "Atlas (tessellation)";
@@ -405,6 +408,7 @@ Viewer::Viewer(int argc, char** argv, void* platformData)
GrContextOptions::ShaderCacheStrategy::kSkSL;
displayParams.fGrContextOptions.fShaderErrorHandler = &gShaderErrorHandler;
displayParams.fGrContextOptions.fSuppressPrints = true;
+ displayParams.fGrContextOptions.fSupportBilerpFromGlyphAtlas = true;
if (FLAGS_dmsaa) {
displayParams.fSurfaceProps = SkSurfaceProps(
displayParams.fSurfaceProps.flags() | SkSurfaceProps::kDynamicMSAA_Flag,
@@ -1075,7 +1079,7 @@ void Viewer::updateTitle() {
if (ColorMode::kLegacy != fColorMode) {
int curPrimaries = -1;
- for (size_t i = 0; i < SK_ARRAY_COUNT(gNamedPrimaries); ++i) {
+ for (size_t i = 0; i < std::size(gNamedPrimaries); ++i) {
if (primaries_equal(*gNamedPrimaries[i].fPrimaries, fColorSpacePrimaries)) {
curPrimaries = i;
break;
@@ -1390,7 +1394,8 @@ public:
this->filterTextBlob(paint, blob, &cache), x, y, paint);
}
- void onDrawGlyphRunList(const SkGlyphRunList& glyphRunList, const SkPaint& paint) override {
+ void onDrawGlyphRunList(
+ const sktext::GlyphRunList& glyphRunList, const SkPaint& paint) override {
sk_sp<SkTextBlob> cache;
sk_sp<SkTextBlob> blob = glyphRunList.makeBlob();
this->filterTextBlob(paint, blob.get(), &cache);
@@ -1398,8 +1403,9 @@ public:
this->SkPaintFilterCanvas::onDrawGlyphRunList(glyphRunList, paint);
return;
}
- SkGlyphRunBuilder builder;
- const SkGlyphRunList& filtered = builder.blobToGlyphRunList(*cache, glyphRunList.origin());
+ sktext::GlyphRunBuilder builder;
+ const sktext::GlyphRunList& filtered =
+ builder.blobToGlyphRunList(*cache, glyphRunList.origin());
this->SkPaintFilterCanvas::onDrawGlyphRunList(filtered, paint);
}
@@ -2465,7 +2471,7 @@ void Viewer::drawImGui() {
// Pick from common gamuts:
int primariesIdx = 4; // Default: Custom
- for (size_t i = 0; i < SK_ARRAY_COUNT(gNamedPrimaries); ++i) {
+ for (size_t i = 0; i < std::size(gNamedPrimaries); ++i) {
if (primaries_equal(*gNamedPrimaries[i].fPrimaries, fColorSpacePrimaries)) {
primariesIdx = i;
break;
@@ -2955,8 +2961,8 @@ static void WriteStateObject(SkJSONWriter& writer, const char* name, const char*
OptionsFunc&& optionsFunc) {
writer.beginObject();
{
- writer.appendString(kName , name);
- writer.appendString(kValue, value);
+ writer.appendCString(kName , name);
+ writer.appendCString(kValue, value);
writer.beginArray(kOptions);
{
@@ -2984,7 +2990,7 @@ void Viewer::updateUIState() {
WriteStateObject(writer, kSlideStateName, fSlides[fCurrentSlide]->getName().c_str(),
[this](SkJSONWriter& writer) {
for(const auto& slide : fSlides) {
- writer.appendString(slide->getName().c_str());
+ writer.appendString(slide->getName());
}
});
@@ -2992,7 +2998,7 @@ void Viewer::updateUIState() {
WriteStateObject(writer, kBackendStateName, kBackendTypeStrings[fBackendType],
[](SkJSONWriter& writer) {
for (const auto& str : kBackendTypeStrings) {
- writer.appendString(str);
+ writer.appendCString(str);
}
});
@@ -3017,36 +3023,34 @@ void Viewer::updateUIState() {
[this](SkJSONWriter& writer) {
auto ctx = fWindow->directContext();
if (!ctx) {
- writer.appendString("Software");
+ writer.appendNString("Software");
} else {
- writer.appendString(gPathRendererNames[GpuPathRenderers::kDefault].c_str());
+ writer.appendString(gPathRendererNames[GpuPathRenderers::kDefault]);
#if SK_GPU_V1
if (fWindow->sampleCount() > 1 || FLAGS_dmsaa) {
const auto* caps = ctx->priv().caps();
if (skgpu::v1::AtlasPathRenderer::IsSupported(ctx)) {
- writer.appendString(
- gPathRendererNames[GpuPathRenderers::kAtlas].c_str());
+ writer.appendString(gPathRendererNames[GpuPathRenderers::kAtlas]);
}
if (skgpu::v1::TessellationPathRenderer::IsSupported(*caps)) {
- writer.appendString(
- gPathRendererNames[GpuPathRenderers::kTessellation].c_str());
+ writer.appendString(gPathRendererNames[GpuPathRenderers::kTessellation]);
}
}
#endif
if (1 == fWindow->sampleCount()) {
- writer.appendString(gPathRendererNames[GpuPathRenderers::kSmall].c_str());
+ writer.appendString(gPathRendererNames[GpuPathRenderers::kSmall]);
}
- writer.appendString(gPathRendererNames[GpuPathRenderers::kTriangulating].c_str());
- writer.appendString(gPathRendererNames[GpuPathRenderers::kNone].c_str());
+ writer.appendString(gPathRendererNames[GpuPathRenderers::kTriangulating]);
+ writer.appendString(gPathRendererNames[GpuPathRenderers::kNone]);
}
});
// Softkey state
WriteStateObject(writer, kSoftkeyStateName, kSoftkeyHint,
[this](SkJSONWriter& writer) {
- writer.appendString(kSoftkeyHint);
+ writer.appendNString(kSoftkeyHint);
for (const auto& softkey : fCommands.getCommandsAsSoftkeys()) {
- writer.appendString(softkey.c_str());
+ writer.appendString(softkey);
}
});