From 1f8c31b1011869788c14a393d2ae50ea40b63b01 Mon Sep 17 00:00:00 2001 From: Kevin Lubick Date: Mon, 8 Nov 2021 15:26:09 -0500 Subject: [PATCH] [infra] Add initial Bazel rules and files These rules can be used to build our GMs on WASM+WebGL and libskia.a with just the CPU backend (and most other features turned off). This can be done with the following commands: - bazel build //modules/canvaskit:gm-bindings-wasm --gpu_backend=gl_backend --with_gl_standard=webgl_standard - bazel build :skia-core --config clang This pivots slightly from http://review.skia.org/463517 by using config_settings [1] instead of platforms for the optional features that we control. This pivot was suggested in [2] We have BUILD.bazel files in many of the subdirectories that specify filegroups for the appropriate files. In an effort to make //BUILD.bazel more readable, it is the responsibility of these subfolders to deal with conditionally including certain .h or .cpp files. This is done using select statements and config_settings or platform constraints as necessary. For example, src/gpu/BUILD.bazel will different private filegroups for each of the supported gpu backends [3] and a more-visible filegroup called "srcs" that has the right selection of the private files to be used for compilation. An effort has been made to avoid using glob() in our BUILD.bazel files. These file lists were made by using `ls -1` and some regex to add in quotes. We might want to make a helper script to assist with that, if necessary. To specify which options we have, the settings in //bazel/common_config_settings/BUILD.bazel have been redesigned. They make use of a macro `string_flag_with_values` that removes the boilerplate. Patchset 36 shows what the file looks like w/o the macro. The top level BUILD.bazel file will still need to use some logic to handle defines, because local_defines is a list of strings, not a list of labels [4]. Suggested Review Order: - WORKSPACE.bazel to see the new dependencies on the emsdk toolchain and bazel_skylib - bazel/common_config_settings/* to see the few settings defined (we have more to define, see BUILD.gn and //gn/skia.gni for ideas) - BUILD.bazel to see the "skia-core" cc_library rule. See also "gms" and "tests" - modules/canvaskit/BUILD.bazel to see the use of the emscripten "wasm_cc_binary" rule, which depends on the "skia-core", "gms", and "tests" rule. Note that it only builds some of the gms as a proof of concept. - The other BUILD.bazel files. Some of these are not platform or feature dependent (e.g. pathops). Others are (e.g. gpu). - All other files. [1] https://docs.bazel.build/versions/4.2.1/skylark/config.html#user-defined-build-settings [2] https://github.com/emscripten-core/emsdk/pull/920 [3] In this CL, that's just the webgl one. [4] https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.local_defines Change-Id: Ieecf9c106d5e3a6ae97d13d66be06b4b3c207089 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458637 Reviewed-by: Ben Wagner Reviewed-by: Leandro Lovisolo Owners-Override: Kevin Lubick --- .bazelrc | 12 +- BUILD.bazel | 141 ++++++ WORKSPACE.bazel | 30 ++ bazel/common_config_settings/BUILD.bazel | 69 ++- bazel/common_config_settings/defs.bzl | 33 ++ bazel/supported_combinations/BUILD.bazel | 17 - experimental/webgpu-bazel/Makefile | 12 +- experimental/webgpu-bazel/WORKSPACE | 27 -- gm/BUILD.bazel | 21 + include/codec/BUILD.bazel | 11 + include/core/BUILD.bazel | 96 +++- include/effects/BUILD.bazel | 31 ++ include/encode/BUILD.bazel | 11 + include/gpu/BUILD.bazel | 105 +++++ include/pathops/BUILD.bazel | 8 + include/ports/BUILD.bazel | 23 + include/private/BUILD.bazel | 92 ++++ include/sksl/BUILD.bazel | 22 + include/third_party/BUILD.bazel | 22 + include/utils/BUILD.bazel | 31 ++ modules/canvaskit/.gitignore | 1 + modules/canvaskit/BUILD.bazel | 81 ++++ modules/canvaskit/Makefile | 33 ++ modules/canvaskit/wasm_tools/gms.html | 39 ++ src/codec/BUILD.bazel | 51 ++ src/core/BUILD.bazel | 422 +++++++++++++++++ src/effects/BUILD.bazel | 53 +++ src/gpu/BUILD.bazel | 569 +++++++++++++++++++++++ src/image/BUILD.bazel | 46 ++ src/images/BUILD.bazel | 20 + src/opts/BUILD.bazel | 28 ++ src/pathops/BUILD.bazel | 64 +++ src/ports/BUILD.bazel | 46 +- src/sfnt/BUILD.bazel | 36 ++ src/shaders/BUILD.bazel | 42 ++ src/sksl/BUILD.bazel | 215 +++++++++ src/utils/BUILD.bazel | 72 +++ tests/BUILD.bazel | 17 + third_party/BUILD.bazel | 14 + toolchain/BUILD.bazel | 3 + toolchain/clang_toolchain_config.bzl | 3 + tools/BUILD.bazel | 61 +++ 42 files changed, 2641 insertions(+), 89 deletions(-) create mode 100644 bazel/common_config_settings/defs.bzl delete mode 100644 bazel/supported_combinations/BUILD.bazel delete mode 100644 experimental/webgpu-bazel/WORKSPACE create mode 100644 gm/BUILD.bazel create mode 100644 include/codec/BUILD.bazel create mode 100644 include/effects/BUILD.bazel create mode 100644 include/encode/BUILD.bazel create mode 100644 include/gpu/BUILD.bazel create mode 100644 include/pathops/BUILD.bazel create mode 100644 include/ports/BUILD.bazel create mode 100644 include/private/BUILD.bazel create mode 100644 include/sksl/BUILD.bazel create mode 100644 include/third_party/BUILD.bazel create mode 100644 include/utils/BUILD.bazel create mode 100644 modules/canvaskit/BUILD.bazel create mode 100644 modules/canvaskit/wasm_tools/gms.html create mode 100644 src/codec/BUILD.bazel create mode 100644 src/core/BUILD.bazel create mode 100644 src/effects/BUILD.bazel create mode 100644 src/gpu/BUILD.bazel create mode 100644 src/image/BUILD.bazel create mode 100644 src/images/BUILD.bazel create mode 100644 src/opts/BUILD.bazel create mode 100644 src/pathops/BUILD.bazel create mode 100644 src/sfnt/BUILD.bazel create mode 100644 src/shaders/BUILD.bazel create mode 100644 src/sksl/BUILD.bazel create mode 100644 src/utils/BUILD.bazel create mode 100644 tests/BUILD.bazel create mode 100644 tools/BUILD.bazel diff --git a/.bazelrc b/.bazelrc index d8c8d93dd8..0eeba7bccb 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,6 +1,12 @@ build:clang --crosstool_top=//toolchain:clang_suite build:clang --compiler=clang -# Use the default Bazel C++ toolchain to build the tools used during the -# build. -build:clang --host_crosstool_top=@bazel_tools//tools/cpp:toolchain \ No newline at end of file +# Use the default Bazel C++ toolchain to build the tools used during the build. +build:clang --host_crosstool_top=@bazel_tools//tools/cpp:toolchain + +# ============================================================================= +# Alias to build configurations below. This makes configuring things from +# the command line easier. +build --flag_alias=fontmgr=//bazel/common_config_settings:fontmgr +build --flag_alias=gpu_backend=//bazel/common_config_settings:gpu_backend +build --flag_alias=with_gl_standard=//bazel/common_config_settings:with_gl_standard diff --git a/BUILD.bazel b/BUILD.bazel index 6f9158d08c..1458508d12 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,3 +1,8 @@ +package(default_visibility = ["//:__subpackages__"]) + +# https://github.com/bazelbuild/bazel-skylib +load("@bazel_skylib//lib:selects.bzl", "selects") + cc_test( name = "bazel_test", size = "small", @@ -12,3 +17,139 @@ cc_test( "//third_party:musl_compat", ], ) + +CORE_SRCS = [ + "//include/private:hdrs", + "//include/third_party:skcms-hdrs", + "//src/codec:srcs", + "//src/core:srcs", + "//src/image:srcs", + "//src/images:srcs", + "//src/effects:srcs", + "//src/opts:srcs", + "//src/pathops:srcs", + "//src/sfnt:srcs", + "//src/shaders:srcs", + "//src/utils:srcs", + "//third_party:skcms", +] + selects.with_or({ + # https://github.com/bazelbuild/bazel-skylib/blob/main/docs/selects_doc.md#selectswith_or + ("//bazel/common_config_settings:gl_backend", "//bazel/common_config_settings:vulkan_backend"): [ + "//src/gpu:srcs", + "//src/sksl:srcs", + # TODO(kjlubick) should mock be test only? + "//include/private:mock-hdrs", + "//src/gpu:mock-srcs", + ], + "//conditions:default": [], +}) + +CORE_HDRS = [ + "//include/codec:hdrs", + "//include/config:hdrs", + "//include/core:hdrs", + "//include/effects:hdrs", + "//include/encode:hdrs", + "//include/pathops:hdrs", + "//include/ports:hdrs", + "//include/utils:base-hdrs", +] + selects.with_or({ + # https://github.com/bazelbuild/bazel-skylib/blob/main/docs/selects_doc.md#selectswith_or + ("//bazel/common_config_settings:gl_backend", "//bazel/common_config_settings:vulkan_backend"): [ + "//include/sksl:hdrs", + "//include/gpu:hdrs", + # TODO(kjlubick) should mock be test only? + "//include/gpu:mock-hdrs", + ], + "//conditions:default": [], +}) + +# Some of these are documented in SkUserConfig.h +CORE_DEFINES = select({ + "//bazel/common_config_settings:debug_build": [ + "SK_DEBUG", + ], + "//bazel/common_config_settings:release_build": [ + "SK_RELEASE", + ], + "//conditions:default": [ + "SK_RELEASE", + ], +}) + select({ + "//bazel/common_config_settings:gl_backend": [ + "SK_GL", + "SK_SUPPORT_GPU=1", + ], + "//bazel/common_config_settings:vulkan_backend": [ + "SK_VULKAN", + "SK_SUPPORT_GPU=1", + ], + "//conditions:default": [ + "SK_SUPPORT_GPU=0", + ], +}) + select({ + "//bazel/common_config_settings:gl_standard": [ + "SK_ASSUME_GL=1", + ], + "//bazel/common_config_settings:gles_standard": [ + "SK_ASSUME_GL_ES=1", + ], + "//bazel/common_config_settings:webgl_standard": [ + "SK_ASSUME_WEBGL=1", + "SK_USE_WEBGL", + ], + "//conditions:default": [], +}) + +cc_library( + name = "skia-core", + srcs = CORE_SRCS, + hdrs = CORE_HDRS, + local_defines = CORE_DEFINES, + textual_hdrs = ["//src/sksl:txts"], +) + +cc_library( + name = "hash_and_encode", + testonly = True, + srcs = [ + "//tools:cmdline", + "//tools:hash_and_encode", + ], + deps = [ + ":skia-core", + "//third_party:libpng", + ], +) + +cc_library( + name = "gms", + testonly = True, + srcs = [ + "//gm:gms", + "//gm:srcs", + "//tools:srcs", + ], + hdrs = [ + "//gm:hdrs", + ], + textual_hdrs = ["//tools:txts"], + deps = [":skia-core"], +) + +cc_library( + name = "tests", + testonly = True, + srcs = [ + "//tests:srcs", + "//tools:srcs", + ], + hdrs = [ + "//tests:hdrs", + ], + local_defines = [ + "GR_TEST_UTILS", + ], + textual_hdrs = ["//tools:txts"], + deps = [":skia-core"], +) diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index a25979d84f..373920f230 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -1,7 +1,24 @@ workspace(name = "skia") +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("//toolchain:build_toolchain.bzl", "build_cpp_toolchain") +# See https://github.com/emscripten-core/emsdk/tree/85d27a4a2a60d591613a305b14ae438c2bb3ce11/bazel#setup-instructions +http_archive( + name = "emsdk", + sha256 = "457fa96d4d60867743df7f7e241c9852a3eb7fdbf3091eac7a5712ddc0a5221d", + strip_prefix = "emsdk-2.0.32/bazel", + url = "https://github.com/emscripten-core/emsdk/archive/refs/tags/2.0.32.tar.gz", +) + +load("@emsdk//:deps.bzl", emsdk_deps = "deps") + +emsdk_deps() + +load("@emsdk//:emscripten_deps.bzl", emsdk_emscripten_deps = "emscripten_deps") + +emsdk_emscripten_deps(emscripten_version = "2.0.32") + build_cpp_toolchain( # Meant to run on amd64 linux and compile for amd64 linux using musl as the c library. name = "clang_linux_amd64_musl", @@ -13,3 +30,16 @@ build_cpp_toolchain( musl_dev_sha256 = "b017792ad6ba3650b4889238c73cd19c1d6b0e39ca8319cdd3ad9e16374e614e", musl_dev_url = "http://ftp.debian.org/debian/pool/main/m/musl/musl-dev_1.2.2-1_amd64.deb", ) + +http_archive( + name = "bazel_skylib", + sha256 = "c6966ec828da198c5d9adbaa94c05e3a1c7f21bd012a0b29ba8ddbccb2c93b0d", + urls = [ + "https://github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz", + ], +) + +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") + +bazel_skylib_workspace() diff --git a/bazel/common_config_settings/BUILD.bazel b/bazel/common_config_settings/BUILD.bazel index 0964e08f3c..e92a3f5a2e 100644 --- a/bazel/common_config_settings/BUILD.bazel +++ b/bazel/common_config_settings/BUILD.bazel @@ -1,6 +1,8 @@ # @platforms is found at https://github.com/bazelbuild/platforms package(default_visibility = ["//:__subpackages__"]) +load(":defs.bzl", "string_flag_with_values") + config_setting( name = "linux_x64", constraint_values = [ @@ -25,6 +27,16 @@ config_setting( ], ) +config_setting( + name = "debug_build", + values = {"compilation_mode": "dbg"}, +) + +config_setting( + name = "release_build", + values = {"compilation_mode": "opt"}, +) + constraint_value( name = "fuchsia", constraint_setting = "@platforms//os:os", @@ -50,34 +62,43 @@ config_setting( # ============================================================================= # Configurable Skia Features # ============================================================================= -# Below, we define a number of constraint_settings (think enums) and their -# associated constraint values (think enum values). These let us use select -# to turn on or off certain Skia features. Many of these are platform-specific, -# and can be configured as such with the exec_compatible_with. +# 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 +# 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 # -# To actually set the values, you need to create a platform() rule. See -# //bazel/supported_combinations for more. +# 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 # -# https://docs.bazel.build/versions/main/be/platform.html#constraint_setting -constraint_setting( - name = "skdebug_impl", - default_constraint_value = ":stdio_skdebug", + +# TODO(kjlubick) make gpu_backend a multi-string flag when available in Bazel. +# https://docs.bazel.build/versions/main/skylark/config.html#defining-multi-set-string-flags +string_flag_with_values( + flag_name = "gpu_backend", + values = [ + "gl_backend", + "vulkan_backend", + ], ) -# https://docs.bazel.build/versions/main/be/platform.html#constraint_value -constraint_value( - name = "stdio_skdebug", - constraint_setting = ":skdebug_impl", +string_flag_with_values( + flag_name = "with_gl_standard", + values = [ + "gles_standard", + "gl_standard", + "webgl_standard", + ], ) -constraint_value( - name = "win_skdebug", - constraint_setting = ":skdebug_impl", - exec_compatible_with = ["@platforms//os:windows"], -) - -constraint_value( - name = "android_skdebug", - constraint_setting = ":skdebug_impl", - exec_compatible_with = ["@platforms//os:android"], +string_flag_with_values( + default = "empty_fontmgr_factory", + flag_name = "fontmgr_factory", + values = [ + "empty_fontmgr_factory", + "custom_directory_fontmgr_factory", + ], ) diff --git a/bazel/common_config_settings/defs.bzl b/bazel/common_config_settings/defs.bzl new file mode 100644 index 0000000000..f41275da27 --- /dev/null +++ b/bazel/common_config_settings/defs.bzl @@ -0,0 +1,33 @@ +# https://github.com/bazelbuild/bazel-skylib/blob/main/rules/common_settings.bzl +load("@bazel_skylib//rules:common_settings.bzl", "string_flag") + +# string_flag_with_values is a Bazel Macro that defines a flag with the given name and a set +# of valid values for that flag. For each value, a config_setting is defined with the name +# of the value, associated with the created flag. +# This is defined to make the BUILD.bazel file easier to read w/o the boilerplate of defining +# a string_flag rule and n config_settings +# https://docs.bazel.build/versions/main/skylark/macros.html +def string_flag_with_values(flag_name, values, default = ""): + string_flag( + name = flag_name, + # We have to specify a default value, even if that value is empty string. + # https://docs.bazel.build/versions/main/skylark/config.html#instantiating-build-settings + build_setting_default = default, + # If empty string is the default, we need to make sure it is in the list + # of acceptable values. If the default is not empty string, we don't want + # to make empty string a valid value. Having duplicate values in the list + # does not cause any issues, so we can just add the default to achieve + # this affect. + values = values + [default], + ) + + # For each of the values given, we define a config_setting. This allows us to use + # select statements, on the given setting, e.g. referencing + # //bazel/common_config_settings:some_valid_value_for_a_flag + for v in values: + native.config_setting( + name = v, + flag_values = { + ":" + flag_name: v, + }, + ) diff --git a/bazel/supported_combinations/BUILD.bazel b/bazel/supported_combinations/BUILD.bazel deleted file mode 100644 index 214f5d1291..0000000000 --- a/bazel/supported_combinations/BUILD.bazel +++ /dev/null @@ -1,17 +0,0 @@ -# This file contains a set of configurations that are supported. This means these combinations -# of architectures, operating systems, and features should all compile and pass our tests. -# Bazel calls the combinations "Platforms" https://docs.bazel.build/versions/main/platforms.html -# and they all focus on the target environment, that is, where the program using Skia is running. -# Clients are free to define their own platforms with their own combinations of features, -# however, not all combinations will work. -# -# To specify one of these platforms, include it in the command to bazel, e.g. -# bazel build --platforms=//bazel/supported_combinations:linux_x64 [rule] -platform( - name = "linux_x64", - constraint_values = [ - "@platforms//cpu:x86_64", - "@platforms//os:linux", - "//bazel/common_config_settings:stdio_skdebug", - ], -) diff --git a/experimental/webgpu-bazel/Makefile b/experimental/webgpu-bazel/Makefile index 292b667b3d..e0bb608a32 100644 --- a/experimental/webgpu-bazel/Makefile +++ b/experimental/webgpu-bazel/Makefile @@ -1,16 +1,16 @@ release: - bazel build //src:hello-world-wasm --compilation_mode opt + bazel build //experimental/webgpu-bazel/src:hello-world-wasm --compilation_mode opt - rm -rf build/ mkdir build - cp bazel-bin/src/hello-world-wasm/hello-world.js build/hello-world.js - cp bazel-bin/src/hello-world-wasm/hello-world.wasm build/hello-world.wasm + cp ../../bazel-bin/experimental/webgpu-bazel/src/hello-world-wasm/hello-world.js build/hello-world.js + cp ../../bazel-bin/experimental/webgpu-bazel/src/hello-world-wasm/hello-world.wasm build/hello-world.wasm debug: - bazel build //src:hello-world-wasm --compilation_mode dbg + bazel build //experimental/webgpu-bazel/src:hello-world-wasm --compilation_mode dbg - rm -rf build/ mkdir build - cp bazel-bin/src/hello-world-wasm/hello-world.js build/hello-world.js - cp bazel-bin/src/hello-world-wasm/hello-world.wasm build/hello-world.wasm + cp ../../bazel-bin/experimental/webgpu-bazel/src/hello-world-wasm/hello-world.js build/hello-world.js + cp ../../bazel-bin/experimental/webgpu-bazel/src/hello-world-wasm/hello-world.wasm build/hello-world.wasm serve: python3 ../../tools/serve_wasm.py \ No newline at end of file diff --git a/experimental/webgpu-bazel/WORKSPACE b/experimental/webgpu-bazel/WORKSPACE deleted file mode 100644 index bee39dcfbd..0000000000 --- a/experimental/webgpu-bazel/WORKSPACE +++ /dev/null @@ -1,27 +0,0 @@ -workspace(name = "bazel_webgpu_example") - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -# Loading in the emscripten toolchain is documented at https://github.com/emscripten-core/emsdk/tree/3891e7b04bf8cbb3bc62758e9c575ae096a9a518/bazel -# The hash in the http_archive URL corresponds to https://github.com/emscripten-core/emsdk/commit/3891e7b04bf8cbb3bc62758e9c575ae096a9a518 -# AKA the 2.0.31 release. The sha256 sum came from a manual inspection of that archive. -http_archive( - name = "emsdk", - sha256 = "d55e3c73fc4f8d1fecb7aabe548de86bdb55080fe6b12ce593d63b8bade54567", - strip_prefix = "emsdk-3891e7b04bf8cbb3bc62758e9c575ae096a9a518/bazel", - url = "https://github.com/emscripten-core/emsdk/archive/3891e7b04bf8cbb3bc62758e9c575ae096a9a518.tar.gz", -) - -# Working around https://github.com/emscripten-core/emsdk/issues/907 -http_archive( - name = "build_bazel_rules_nodejs", - sha256 = "3635797a96c7bfcd0d265dacd722a07335e64d6ded9834af8d3f1b7ba5a25bba", - urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/4.3.0/rules_nodejs-4.3.0.tar.gz"], -) -# Once the workaround is no longer needed, we should be able to uncomment below -# load("@emsdk//:deps.bzl", emsdk_deps = "deps") -# emsdk_deps() - -load("@emsdk//:emscripten_deps.bzl", emsdk_emscripten_deps = "emscripten_deps") - -emsdk_emscripten_deps(emscripten_version = "2.0.31") diff --git a/gm/BUILD.bazel b/gm/BUILD.bazel new file mode 100644 index 0000000000..60d92892bc --- /dev/null +++ b/gm/BUILD.bazel @@ -0,0 +1,21 @@ +package(default_visibility = ["//:__subpackages__"]) + +filegroup( + name = "hdrs", + srcs = [ + "gm.h", + "verifiers/gmverifier.h", + ], +) + +filegroup( + name = "srcs", + srcs = [ + "gm.cpp", + ], +) + +filegroup( + name = "gms", + srcs = ["dashing.cpp"], +) diff --git a/include/codec/BUILD.bazel b/include/codec/BUILD.bazel new file mode 100644 index 0000000000..9f767fc9ac --- /dev/null +++ b/include/codec/BUILD.bazel @@ -0,0 +1,11 @@ +package(default_visibility = ["//visibility:public"]) + +filegroup( + name = "hdrs", + srcs = [ + "SkAndroidCodec.h", + "SkCodec.h", + "SkCodecAnimation.h", + "SkEncodedOrigin.h", + ], +) diff --git a/include/core/BUILD.bazel b/include/core/BUILD.bazel index 462a6687c5..26e0a22c82 100644 --- a/include/core/BUILD.bazel +++ b/include/core/BUILD.bazel @@ -2,7 +2,97 @@ package(default_visibility = ["//visibility:public"]) filegroup( name = "hdrs", - srcs = glob([ - "*.h", - ]), + srcs = [ + "SkAnnotation.h", + "SkBBHFactory.h", + "SkBitmap.h", + "SkBlendMode.h", + "SkBlender.h", + "SkBlurTypes.h", + "SkCanvas.h", + "SkCanvasVirtualEnforcer.h", + "SkClipOp.h", + "SkColor.h", + "SkColorFilter.h", + "SkColorPriv.h", + "SkColorSpace.h", + "SkContourMeasure.h", + "SkCoverageMode.h", + "SkCubicMap.h", + "SkData.h", + "SkDataTable.h", + "SkDeferredDisplayList.h", + "SkDeferredDisplayListRecorder.h", + "SkDocument.h", + "SkDrawLooper.h", + "SkDrawable.h", + "SkEncodedImageFormat.h", + "SkExecutor.h", + "SkFlattenable.h", + "SkFont.h", + "SkFontArguments.h", + "SkFontMetrics.h", + "SkFontMgr.h", + "SkFontParameters.h", + "SkFontStyle.h", + "SkFontTypes.h", + "SkGraphics.h", + "SkICC.h", + "SkImage.h", + "SkImageEncoder.h", + "SkImageFilter.h", + "SkImageGenerator.h", + "SkImageInfo.h", + "SkM44.h", + "SkMallocPixelRef.h", + "SkMaskFilter.h", + "SkMath.h", + "SkMatrix.h", + "SkMilestone.h", + "SkOverdrawCanvas.h", + "SkPaint.h", + "SkPath.h", + "SkPathBuilder.h", + "SkPathEffect.h", + "SkPathMeasure.h", + "SkPathTypes.h", + "SkPicture.h", + "SkPictureRecorder.h", + "SkPixelRef.h", + "SkPixmap.h", + "SkPngChunkReader.h", + "SkPoint.h", + "SkPoint3.h", + "SkPromiseImageTexture.h", + "SkRRect.h", + "SkRSXform.h", + "SkRasterHandleAllocator.h", + "SkRect.h", + "SkRefCnt.h", + "SkRegion.h", + "SkSamplingOptions.h", + "SkScalar.h", + "SkSerialProcs.h", + "SkShader.h", + "SkSize.h", + "SkSpan.h", + "SkStream.h", + "SkString.h", + "SkStringView.h", + "SkStrokeRec.h", + "SkSurface.h", + "SkSurfaceCharacterization.h", + "SkSurfaceProps.h", + "SkSwizzle.h", + "SkTextBlob.h", + "SkTileMode.h", + "SkTime.h", + "SkTraceMemoryDump.h", + "SkTypeface.h", + "SkTypes.h", + "SkUnPreMultiply.h", + "SkVertices.h", + "SkYUVAInfo.h", + "SkYUVAPixmaps.h", + ], ) diff --git a/include/effects/BUILD.bazel b/include/effects/BUILD.bazel new file mode 100644 index 0000000000..ba83a7b474 --- /dev/null +++ b/include/effects/BUILD.bazel @@ -0,0 +1,31 @@ +package(default_visibility = ["//visibility:public"]) + +filegroup( + name = "hdrs", + srcs = [ + "Sk1DPathEffect.h", + "Sk2DPathEffect.h", + "SkBlenders.h", + "SkBlurDrawLooper.h", + "SkBlurMaskFilter.h", + "SkColorMatrix.h", + "SkColorMatrixFilter.h", + "SkCornerPathEffect.h", + "SkDashPathEffect.h", + "SkDiscretePathEffect.h", + "SkGradientShader.h", + "SkHighContrastFilter.h", + "SkImageFilters.h", + "SkLayerDrawLooper.h", + "SkLumaColorFilter.h", + "SkOpPathEffect.h", + "SkOverdrawColorFilter.h", + "SkPerlinNoiseShader.h", + "SkRuntimeEffect.h", + "SkShaderMaskFilter.h", + "SkStrokeAndFillPathEffect.h", + "SkTableColorFilter.h", + "SkTableMaskFilter.h", + "SkTrimPathEffect.h", + ], +) diff --git a/include/encode/BUILD.bazel b/include/encode/BUILD.bazel new file mode 100644 index 0000000000..baa162137c --- /dev/null +++ b/include/encode/BUILD.bazel @@ -0,0 +1,11 @@ +package(default_visibility = ["//visibility:public"]) + +filegroup( + name = "hdrs", + srcs = [ + "SkEncoder.h", + "SkJpegEncoder.h", + "SkPngEncoder.h", + "SkWebpEncoder.h", + ], +) diff --git a/include/gpu/BUILD.bazel b/include/gpu/BUILD.bazel new file mode 100644 index 0000000000..a1d0d77ba1 --- /dev/null +++ b/include/gpu/BUILD.bazel @@ -0,0 +1,105 @@ +package(default_visibility = ["//visibility:private"]) + +filegroup( + name = "base-hdrs", + srcs = [ + "GrBackendDrawableInfo.h", + "GrBackendSemaphore.h", + "GrBackendSurface.h", + "GrBackendSurfaceMutableState.h", + "GrConfig.h", + "GrContextOptions.h", + "GrContextThreadSafeProxy.h", + "GrDirectContext.h", + "GrDriverBugWorkarounds.h", + "GrDriverBugWorkaroundsAutogen.h", + "GrRecordingContext.h", + "GrSurfaceInfo.h", + "GrTypes.h", + "GrYUVABackendTextures.h", + ], +) + +filegroup( + name = "direct3d-hdrs", + srcs = [ + "d3d/GrD3DBackendContext.h", + "d3d/GrD3DTypes.h", + ], +) + +filegroup( + name = "dawn-hdrs", + srcs = [ + "dawn/GrDawnTypes.h", + ], +) + +filegroup( + name = "gl-hdrs", + srcs = [ + "gl/GrGLAssembleHelpers.h", + "gl/GrGLAssembleInterface.h", + "gl/GrGLConfig.h", + "gl/GrGLConfig_chrome.h", + "gl/GrGLExtensions.h", + "gl/GrGLFunctions.h", + "gl/GrGLInterface.h", + "gl/GrGLTypes.h", + ], +) + +filegroup( + name = "egl-hdrs", + srcs = [ + "gl/egl/GrGLMakeEGLInterface.h", + ], +) + +filegroup( + name = "glx-hdrs", + srcs = [ + "gl/glx/GrGLMakeGLXInterface.h", + ], +) + +filegroup( + name = "mock-hdrs", + srcs = [ + "mock/GrMockTypes.h", + ], + visibility = ["//:__subpackages__"], +) + +filegroup( + name = "metal-hdrs", + srcs = [ + "mtl/GrMtlBackendContext.h", + "mtl/GrMtlTypes.h", + ], +) + +filegroup( + name = "vulkan-hdrs", + srcs = [ + "vk/GrVkBackendContext.h", + "vk/GrVkExtensions.h", + "vk/GrVkMemoryAllocator.h", + "vk/GrVkTypes.h", + "vk/GrVkVulkan.h", + ], +) + +filegroup( + name = "hdrs", + srcs = [ + ":base-hdrs", + ] + select({ + "//bazel/common_config_settings:gl_backend": [":gl-hdrs"], + "//conditions:default": [], + }) + select({ + "//bazel/common_config_settings:vulkan_backend": [":vulkan-hdrs"], + "//conditions:default": [], + }), + visibility = ["//:__subpackages__"], +) diff --git a/include/pathops/BUILD.bazel b/include/pathops/BUILD.bazel new file mode 100644 index 0000000000..3bcf7ed97f --- /dev/null +++ b/include/pathops/BUILD.bazel @@ -0,0 +1,8 @@ +package(default_visibility = ["//visibility:public"]) + +filegroup( + name = "hdrs", + srcs = [ + "SkPathOps.h", + ], +) diff --git a/include/ports/BUILD.bazel b/include/ports/BUILD.bazel new file mode 100644 index 0000000000..372946bdf7 --- /dev/null +++ b/include/ports/BUILD.bazel @@ -0,0 +1,23 @@ +package(default_visibility = ["//visibility:public"]) + +filegroup( + name = "hdrs", + srcs = [ + "SkCFObject.h", + "SkFontConfigInterface.h", + "SkFontMgr_FontConfigInterface.h", + "SkFontMgr_android.h", + "SkFontMgr_directory.h", + "SkFontMgr_empty.h", + "SkFontMgr_fontconfig.h", + "SkFontMgr_fuchsia.h", + "SkFontMgr_indirect.h", + "SkFontMgr_mac_ct.h", + "SkImageGeneratorCG.h", + "SkImageGeneratorNDK.h", + "SkImageGeneratorWIC.h", + "SkRemotableFontMgr.h", + "SkTypeface_mac.h", + "SkTypeface_win.h", + ], +) diff --git a/include/private/BUILD.bazel b/include/private/BUILD.bazel new file mode 100644 index 0000000000..0b1e2eb21e --- /dev/null +++ b/include/private/BUILD.bazel @@ -0,0 +1,92 @@ +package(default_visibility = ["//visibility:private"]) + +# https://github.com/bazelbuild/bazel-skylib +load("@bazel_skylib//lib:selects.bzl", "selects") + +filegroup( + name = "core-hdrs", + srcs = [ + "SkBitmaskEnum.h", + "SkChecksum.h", + "SkColorData.h", + "SkDeque.h", + "SkEncodedInfo.h", + "SkFixed.h", + "SkFloatBits.h", + "SkFloatingPoint.h", + "SkHalf.h", + "SkIDChangeListener.h", + "SkImageInfoPriv.h", + "SkMacros.h", + "SkMalloc.h", + "SkMutex.h", + "SkNoncopyable.h", + "SkNx.h", + "SkNx_neon.h", + "SkNx_sse.h", + "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", + "SkShadowFlags.h", + "SkSpinlock.h", + "SkTArray.h", + "SkTDArray.h", + "SkTFitsIn.h", + "SkTHash.h", + "SkTLogic.h", + "SkTOptional.h", + "SkTPin.h", + "SkTemplates.h", + "SkThreadAnnotations.h", + "SkThreadID.h", + "SkTo.h", + "SkVx.h", + "SkWeakRefCnt.h", + ], +) + +filegroup( + name = "gpu-hdrs", + srcs = [ + "GrContext_Base.h", + "GrD3DTypesMinimal.h", + "GrDawnTypesPriv.h", + "GrGLTypesPriv.h", + "GrImageContext.h", + "GrMtlTypesPriv.h", + "GrResourceKey.h", + "GrSingleOwner.h", + "GrTypesPriv.h", + "GrVkTypesPriv.h", + ], +) + +filegroup( + name = "mock-hdrs", + srcs = ["GrMockTypesPriv.h"], + visibility = ["//:__subpackages__"], +) + +filegroup( + name = "hdrs", + srcs = [":core-hdrs"] + selects.with_or({ + ("//bazel/common_config_settings:gl_backend", "//bazel/common_config_settings:vulkan_backend"): [ + ":gpu-hdrs", + ], + "//conditions:default": [], + }), + visibility = ["//:__subpackages__"], +) diff --git a/include/sksl/BUILD.bazel b/include/sksl/BUILD.bazel new file mode 100644 index 0000000000..556af2357d --- /dev/null +++ b/include/sksl/BUILD.bazel @@ -0,0 +1,22 @@ +package(default_visibility = ["//visibility:public"]) + +filegroup( + name = "hdrs", + srcs = [ + "DSL.h", + "DSLBlock.h", + "DSLCase.h", + "DSLCore.h", + "DSLExpression.h", + "DSLFunction.h", + "DSLLayout.h", + "DSLModifiers.h", + "DSLRuntimeEffects.h", + "DSLStatement.h", + "DSLSymbols.h", + "DSLType.h", + "DSLVar.h", + "DSLWrapper.h", + "SkSLErrorReporter.h", + ], +) diff --git a/include/third_party/BUILD.bazel b/include/third_party/BUILD.bazel new file mode 100644 index 0000000000..4047412e25 --- /dev/null +++ b/include/third_party/BUILD.bazel @@ -0,0 +1,22 @@ +package(default_visibility = ["//:__subpackages__"]) + +filegroup( + name = "skcms-hdrs", + srcs = [ + "skcms/skcms.h", + ], +) + +filegroup( + name = "vulkan-hdrs", + srcs = [ + "vulkan/vulkan/vk_platform.h", + "vulkan/vulkan/vulkan.h", + "vulkan/vulkan/vulkan_android.h", + "vulkan/vulkan/vulkan_core.h", + "vulkan/vulkan/vulkan_ios.h", + "vulkan/vulkan/vulkan_macos.h", + "vulkan/vulkan/vulkan_win32.h", + "vulkan/vulkan/vulkan_xcb.h", + ], +) diff --git a/include/utils/BUILD.bazel b/include/utils/BUILD.bazel new file mode 100644 index 0000000000..81c3f2cdac --- /dev/null +++ b/include/utils/BUILD.bazel @@ -0,0 +1,31 @@ +package(default_visibility = ["//visibility:public"]) + +filegroup( + name = "base-hdrs", + srcs = [ + "SkAnimCodecPlayer.h", + "SkBase64.h", + "SkCamera.h", + "SkCanvasStateUtils.h", + "SkCustomTypeface.h", + "SkEventTracer.h", + "SkNWayCanvas.h", + "SkNoDrawCanvas.h", + "SkNullCanvas.h", + "SkOrderedFontMgr.h", + "SkPaintFilterCanvas.h", + "SkParse.h", + "SkParsePath.h", + "SkRandom.h", + "SkShadowUtils.h", + "SkTextUtils.h", + "SkTraceEventPhase.h", + ], +) + +filegroup( + name = "mac-hdrs", + srcs = [ + "mac/SkCGUtils.h", + ], +) diff --git a/modules/canvaskit/.gitignore b/modules/canvaskit/.gitignore index 1904e8ec20..20e0870a8d 100644 --- a/modules/canvaskit/.gitignore +++ b/modules/canvaskit/.gitignore @@ -1,5 +1,6 @@ package-lock.json fonts/*.cpp coverage/* +build/ # Don't check in this copy. It's just for publishing to npm. npm_build/CHANGELOG.md \ No newline at end of file diff --git a/modules/canvaskit/BUILD.bazel b/modules/canvaskit/BUILD.bazel new file mode 100644 index 0000000000..7b43c1f803 --- /dev/null +++ b/modules/canvaskit/BUILD.bazel @@ -0,0 +1,81 @@ +package(default_visibility = ["//:__subpackages__"]) + +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") +load("@emsdk//emscripten_toolchain:wasm_rules.bzl", "wasm_cc_binary") + +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 + "-sALLOW_MEMORY_GROWTH", + "-sUSE_PTHREADS=0", # Disable pthreads + "-sMODULARIZE", + "-sDISABLE_EXCEPTION_CATCHING", # Disable all exception catching + "-sNODEJS_CATCH_EXIT=0", # We don't have a 'main' so disable exit() catching + "-sWASM", + "-sMAX_WEBGL_VERSION=2", +] + +RELEASE_OPTS = [ + # We disable closure for now, because we need a way to pass in the externs file, + # which does not appear to be exposed on the emscripten toolchain. + # "--closure 1", # Run the closure compiler + "-sASSERTIONS=0", # Turn off assertions +] + +DEBUG_OPTS = [ + "--closure 0", # Do not use closure + "-sASSERTIONS", # Turn on assertions + "-sGL_ASSERTIONS", +] + +GM_OPTS = [ + "-sEXPORT_NAME=InitWasmGMTests", + "--pre-js", + "modules/canvaskit/gm.js", +] + +filegroup( + name = "hdrs", + srcs = [ + "WasmCommon.h", + ], +) + +cc_binary( + name = "gm-bindings", + testonly = True, + srcs = [ + "gm_bindings.cpp", + ":hdrs", + "//gm:gms", # Required for the registry to work + "//src/ports:default_global_init", + "//src/ports:fontmgr", + "//src/ports:malloc", + "//src/ports:skdebug", + "//src/ports:skia_image_generator", + ], + additional_linker_inputs = ["gm.js"], + linkopts = select({ + "//bazel/common_config_settings:debug_build": BASE_LINKOPTS + GM_OPTS + DEBUG_OPTS, + "//bazel/common_config_settings:release_build": BASE_LINKOPTS + GM_OPTS + RELEASE_OPTS, + "//conditions:default": BASE_LINKOPTS + GM_OPTS + RELEASE_OPTS, + }), + local_defines = [ + "SK_GL", + "SK_USE_WEBGL", + ], + # This target won't build successfully on its own because of missing emscripten + # headers etc. Therefore, we hide it from wildcards. + tags = ["manual"], + deps = [ + "//:gms", + "//:hash_and_encode", + "//:tests", + ], +) + +wasm_cc_binary( + name = "gm-bindings-wasm", + testonly = True, + cc_target = ":gm-bindings", +) diff --git a/modules/canvaskit/Makefile b/modules/canvaskit/Makefile index 44e326a751..ebee473864 100644 --- a/modules/canvaskit/Makefile +++ b/modules/canvaskit/Makefile @@ -121,3 +121,36 @@ docker-compile: typecheck: echo "Make sure you've run cd npm_build && npm ci recently" cd npm_build && npm run dtslint + +bazel_gms_sandboxed: + # Because emscripten does a lot of extra work, we need to limit the number of jobs or it + # can overwhelm even a powerful build system. + bazel build :gm-bindings-wasm --compilation_mode opt --cpu=wasm --jobs 8 + - rm -rf build/ + mkdir build + cp ../../bazel-bin/modules/canvaskit/gm-bindings-wasm/gm-bindings.js build/gm-bindings.js + cp ../../bazel-bin/modules/canvaskit/gm-bindings-wasm/gm-bindings.wasm build/gm-bindings.wasm + +bazel_gms_release: + # We use spawn_strategy=local for "everyday" 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://docs.bazel.build/versions/main/user-manual.html#strategy-options + bazel build :gm-bindings-wasm --compilation_mode opt --spawn_strategy=local \ + --gpu_backend=gl_backend --with_gl_standard=webgl_standard + - rm -rf build/ + mkdir build + cp ../../bazel-bin/modules/canvaskit/gm-bindings-wasm/gm-bindings.js build/gm-bindings.js + cp ../../bazel-bin/modules/canvaskit/gm-bindings-wasm/gm-bindings.wasm build/gm-bindings.wasm + +bazel_gms_debug: + # See above note about spawn_strategy + bazel build :gm-bindings-wasm --compilation_mode dbg --spawn_strategy=local \ + --gpu_backend=gl_backend --with_gl_standard=webgl_standard + - rm -rf build/ + mkdir build + cp ../../bazel-bin/modules/canvaskit/gm-bindings-wasm/gm-bindings.js build/gm-bindings.js + cp ../../bazel-bin/modules/canvaskit/gm-bindings-wasm/gm-bindings.wasm build/gm-bindings.wasm diff --git a/modules/canvaskit/wasm_tools/gms.html b/modules/canvaskit/wasm_tools/gms.html new file mode 100644 index 0000000000..0b75ee26d6 --- /dev/null +++ b/modules/canvaskit/wasm_tools/gms.html @@ -0,0 +1,39 @@ + +Testing GMs on WebGL 2 compiled with Bazel + + + + + + +

+ + + + + + + \ No newline at end of file diff --git a/src/codec/BUILD.bazel b/src/codec/BUILD.bazel new file mode 100644 index 0000000000..15b2cf3111 --- /dev/null +++ b/src/codec/BUILD.bazel @@ -0,0 +1,51 @@ +package(default_visibility = ["//visibility:private"]) + +filegroup( + name = "core-srcs", + srcs = [ + "SkCodec.cpp", + "SkCodecImageGenerator.cpp", + "SkCodecImageGenerator.h", + "SkCodecPriv.h", + "SkColorTable.cpp", + "SkColorTable.h", + "SkFrameHolder.h", + "SkMaskSwizzler.cpp", + "SkMaskSwizzler.h", + "SkMasks.cpp", + "SkMasks.h", + "SkSampler.cpp", + "SkSampler.h", + "SkSwizzler.cpp", + "SkSwizzler.h", + ], +) + +filegroup( + name = "bmp-srcs", + srcs = [ + "SkBmpBaseCodec.cpp", + "SkBmpBaseCodec.h", + "SkBmpCodec.cpp", + "SkBmpCodec.h", + "SkBmpMaskCodec.cpp", + "SkBmpMaskCodec.h", + "SkBmpRLECodec.cpp", + "SkBmpRLECodec.h", + "SkBmpStandardCodec.cpp", + "SkBmpStandardCodec.h", + "SkWbmpCodec.cpp", + "SkWbmpCodec.h", + ], +) + +# TODO(kjlubick) add selects here to allow opting in or out of various codecs. + +filegroup( + name = "srcs", + srcs = [ + ":bmp-srcs", + ":core-srcs", + ], + visibility = ["//:__subpackages__"], +) diff --git a/src/core/BUILD.bazel b/src/core/BUILD.bazel new file mode 100644 index 0000000000..0d5b476ab7 --- /dev/null +++ b/src/core/BUILD.bazel @@ -0,0 +1,422 @@ +package(default_visibility = ["//visibility:private"]) + +# https://github.com/bazelbuild/bazel-skylib +load("@bazel_skylib//lib:selects.bzl", "selects") + +filegroup( + name = "core-srcs", + srcs = [ + "Sk4px.h", + "SkAAClip.cpp", + "SkAAClip.h", + "SkASAN.h", + "SkATrace.cpp", + "SkATrace.h", + "SkAdvancedTypefaceMetrics.h", + "SkAlphaRuns.cpp", + "SkAnalyticEdge.cpp", + "SkAnalyticEdge.h", + "SkAnnotation.cpp", + "SkAnnotationKeys.h", + "SkAntiRun.h", + "SkArenaAlloc.cpp", + "SkArenaAlloc.h", + "SkArenaAllocList.h", + "SkAutoBlitterChoose.h", + "SkAutoMalloc.h", + "SkAutoPixmapStorage.cpp", + "SkAutoPixmapStorage.h", + "SkBBHFactory.cpp", + "SkBigPicture.cpp", + "SkBigPicture.h", + "SkBitmap.cpp", + "SkBitmapCache.cpp", + "SkBitmapCache.h", + "SkBitmapDevice.cpp", + "SkBitmapDevice.h", + "SkBitmapProcState.cpp", + "SkBitmapProcState.h", + "SkBitmapProcState_matrixProcs.cpp", + "SkBlendMode.cpp", + "SkBlendModeBlender.cpp", + "SkBlendModeBlender.h", + "SkBlendModePriv.h", + "SkBlenderBase.h", + "SkBlitBWMaskTemplate.h", + "SkBlitRow.h", + "SkBlitRow_D32.cpp", + "SkBlitter.cpp", + "SkBlitter.h", + "SkBlitter_A8.cpp", + "SkBlitter_ARGB32.cpp", + "SkBlitter_RGB565.cpp", + "SkBlitter_Sprite.cpp", + "SkBlockAllocator.cpp", + "SkBlockAllocator.h", + "SkBlurMF.cpp", + "SkBlurMask.cpp", + "SkBlurMask.h", + "SkBuffer.cpp", + "SkBuffer.h", + "SkCachedData.cpp", + "SkCachedData.h", + "SkCanvas.cpp", + "SkCanvasPriv.cpp", + "SkCanvasPriv.h", + "SkClipStack.cpp", + "SkClipStack.h", + "SkClipStackDevice.cpp", + "SkClipStackDevice.h", + "SkColor.cpp", + "SkColorFilter.cpp", + "SkColorFilterBase.h", + "SkColorFilterPriv.h", + "SkColorFilter_Matrix.cpp", + "SkColorFilter_Matrix.h", + "SkColorSpace.cpp", + "SkColorSpacePriv.h", + "SkColorSpaceXformSteps.cpp", + "SkColorSpaceXformSteps.h", + "SkCompressedDataUtils.cpp", + "SkCompressedDataUtils.h", + "SkContourMeasure.cpp", + "SkConvertPixels.cpp", + "SkConvertPixels.h", + "SkCoreBlitters.h", + "SkCpu.cpp", + "SkCpu.h", + "SkCubicClipper.cpp", + "SkCubicClipper.h", + "SkCubicMap.cpp", + "SkCubicSolver.h", + "SkData.cpp", + "SkDataTable.cpp", + "SkDebug.cpp", + "SkDeferredDisplayList.cpp", + "SkDeferredDisplayListPriv.h", + "SkDeferredDisplayListRecorder.cpp", + "SkDeque.cpp", + "SkDescriptor.cpp", + "SkDescriptor.h", + "SkDevice.cpp", + "SkDevice.h", + "SkDiscardableMemory.h", + "SkDistanceFieldGen.cpp", + "SkDistanceFieldGen.h", + "SkDocument.cpp", + "SkDraw.cpp", + "SkDraw.h", + "SkDrawLooper.cpp", + "SkDrawProcs.h", + "SkDrawShadowInfo.cpp", + "SkDrawShadowInfo.h", + "SkDraw_atlas.cpp", + "SkDraw_text.cpp", + "SkDraw_vertices.cpp", + "SkDrawable.cpp", + "SkEdge.cpp", + "SkEdge.h", + "SkEdgeBuilder.cpp", + "SkEdgeBuilder.h", + "SkEdgeClipper.cpp", + "SkEdgeClipper.h", + "SkEffectPriv.h", + "SkEndian.h", + "SkEnumerate.h", + "SkExecutor.cpp", + "SkFDot6.h", + "SkFixed15.h", + "SkFlattenable.cpp", + "SkFont.cpp", + "SkFontDescriptor.cpp", + "SkFontDescriptor.h", + "SkFontMgr.cpp", + "SkFontMgrPriv.h", + "SkFontPriv.h", + "SkFontStream.cpp", + "SkFontStream.h", + "SkFont_serial.cpp", + "SkFuzzLogging.h", + "SkGaussFilter.cpp", + "SkGaussFilter.h", + "SkGeometry.cpp", + "SkGeometry.h", + "SkGlobalInitialization_core.cpp", + "SkGlyph.cpp", + "SkGlyph.h", + "SkGlyphBuffer.cpp", + "SkGlyphBuffer.h", + "SkGlyphRun.cpp", + "SkGlyphRun.h", + "SkGlyphRunPainter.cpp", + "SkGlyphRunPainter.h", + "SkGpuBlurUtils.cpp", + "SkGpuBlurUtils.h", + "SkGraphics.cpp", + "SkHalf.cpp", + "SkICC.cpp", + "SkICCPriv.h", + "SkIDChangeListener.cpp", + "SkIPoint16.h", + "SkImageFilter.cpp", + "SkImageFilterCache.cpp", + "SkImageFilterCache.h", + "SkImageFilterTypes.cpp", + "SkImageFilterTypes.h", + "SkImageFilter_Base.h", + "SkImageGenerator.cpp", + "SkImageInfo.cpp", + "SkImagePriv.h", + "SkLRUCache.h", + "SkLatticeIter.cpp", + "SkLatticeIter.h", + "SkLeanWindows.h", + "SkLineClipper.cpp", + "SkLineClipper.h", + "SkLocalMatrixImageFilter.cpp", + "SkLocalMatrixImageFilter.h", + "SkM44.cpp", + "SkMD5.cpp", + "SkMD5.h", + "SkMSAN.h", + "SkMalloc.cpp", + "SkMallocPixelRef.cpp", + "SkMarkerStack.cpp", + "SkMarkerStack.h", + "SkMask.cpp", + "SkMask.h", + "SkMaskBlurFilter.cpp", + "SkMaskBlurFilter.h", + "SkMaskCache.cpp", + "SkMaskCache.h", + "SkMaskFilter.cpp", + "SkMaskFilterBase.h", + "SkMaskGamma.cpp", + "SkMaskGamma.h", + "SkMath.cpp", + "SkMathPriv.h", + "SkMatrix.cpp", + "SkMatrixImageFilter.cpp", + "SkMatrixImageFilter.h", + "SkMatrixInvert.cpp", + "SkMatrixInvert.h", + "SkMatrixPriv.h", + "SkMatrixProvider.h", + "SkMatrixUtils.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", + "SkOpts.h", + "SkOpts_erms.cpp", + "SkOrderedReadBuffer.h", + "SkOverdrawCanvas.cpp", + "SkPaint.cpp", + "SkPaintDefaults.h", + "SkPaintPriv.cpp", + "SkPaintPriv.h", + "SkPath.cpp", + "SkPathBuilder.cpp", + "SkPathEffect.cpp", + "SkPathEffectBase.h", + "SkPathMakers.h", + "SkPathMeasure.cpp", + "SkPathMeasurePriv.h", + "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", + "SkPixelRef.cpp", + "SkPixelRefPriv.h", + "SkPixmap.cpp", + "SkPixmapPriv.h", + "SkPoint.cpp", + "SkPoint3.cpp", + "SkPointPriv.h", + "SkPromiseImageTexture.cpp", + "SkPtrRecorder.cpp", + "SkPtrRecorder.h", + "SkQuadClipper.cpp", + "SkQuadClipper.h", + "SkRRect.cpp", + "SkRRectPriv.h", + "SkRTree.cpp", + "SkRTree.h", + "SkRasterClip.cpp", + "SkRasterClip.h", + "SkRasterClipStack.h", + "SkRasterPipeline.cpp", + "SkRasterPipeline.h", + "SkRasterPipelineBlitter.cpp", + "SkReadBuffer.cpp", + "SkReadBuffer.h", + "SkRecord.cpp", + "SkRecord.h", + "SkRecordDraw.cpp", + "SkRecordDraw.h", + "SkRecordOpts.cpp", + "SkRecordOpts.h", + "SkRecordPattern.h", + "SkRecordedDrawable.cpp", + "SkRecordedDrawable.h", + "SkRecorder.cpp", + "SkRecorder.h", + "SkRecords.cpp", + "SkRecords.h", + "SkRect.cpp", + "SkRectPriv.h", + "SkRegion.cpp", + "SkRegionPriv.h", + "SkRegion_path.cpp", + "SkRemoteGlyphCache.cpp", + "SkRemoteGlyphCache.h", + "SkResourceCache.cpp", + "SkResourceCache.h", + "SkRuntimeEffectPriv.h", + "SkSafeMath.h", + "SkSafeRange.h", + "SkSamplingPriv.h", + "SkScalar.cpp", + "SkScaleToSides.h", + "SkScalerCache.cpp", + "SkScalerCache.h", + "SkScalerContext.cpp", + "SkScalerContext.h", + "SkScan.cpp", + "SkScan.h", + "SkScanPriv.h", + "SkScan_AAAPath.cpp", + "SkScan_AntiPath.cpp", + "SkScan_Antihair.cpp", + "SkScan_Hairline.cpp", + "SkScan_Path.cpp", + "SkScopeExit.h", + "SkSemaphore.cpp", + "SkSharedMutex.cpp", + "SkSharedMutex.h", + "SkSpecialImage.cpp", + "SkSpecialImage.h", + "SkSpecialSurface.cpp", + "SkSpecialSurface.h", + "SkSpinlock.cpp", + "SkSpriteBlitter.h", + "SkSpriteBlitter_ARGB32.cpp", + "SkSpriteBlitter_RGB565.cpp", + "SkStream.cpp", + "SkStreamPriv.h", + "SkStrikeCache.cpp", + "SkStrikeCache.h", + "SkStrikeForGPU.cpp", + "SkStrikeForGPU.h", + "SkStrikeSpec.cpp", + "SkStrikeSpec.h", + "SkString.cpp", + "SkStringUtils.cpp", + "SkStringUtils.h", + "SkStringView.cpp", + "SkStroke.cpp", + "SkStroke.h", + "SkStrokeRec.cpp", + "SkStrokerPriv.cpp", + "SkStrokerPriv.h", + "SkSurfaceCharacterization.cpp", + "SkSurfacePriv.h", + "SkSwizzle.cpp", + "SkTBlockList.h", + "SkTDPQueue.h", + "SkTDynamicHash.h", + "SkTInternalLList.h", + "SkTLazy.h", + "SkTMultiMap.h", + "SkTSearch.cpp", + "SkTSearch.h", + "SkTSort.h", + "SkTaskGroup.cpp", + "SkTaskGroup.h", + "SkTextBlob.cpp", + "SkTextBlobPriv.h", + "SkTextBlobTrace.cpp", + "SkTextBlobTrace.h", + "SkTextFormatParams.h", + "SkThreadID.cpp", + "SkTime.cpp", + "SkTraceEvent.h", + "SkTraceEventCommon.h", + "SkTypeface.cpp", + "SkTypefaceCache.cpp", + "SkTypefaceCache.h", + "SkTypeface_remote.cpp", + "SkTypeface_remote.h", + "SkUnPreMultiply.cpp", + "SkUtils.cpp", + "SkUtils.h", + "SkUtilsArm.cpp", + "SkVM.cpp", + "SkVM.h", + "SkVMBlitter.cpp", + "SkVMBlitter.h", + "SkVM_fwd.h", + "SkValidationUtils.h", + "SkVertState.cpp", + "SkVertState.h", + "SkVertices.cpp", + "SkVerticesPriv.h", + "SkVptr.h", + "SkWriteBuffer.cpp", + "SkWriteBuffer.h", + "SkWritePixelsRec.h", + "SkWriter32.cpp", + "SkWriter32.h", + "SkXfermode.cpp", + "SkXfermodeInterpretation.cpp", + "SkXfermodeInterpretation.h", + "SkXfermodePriv.h", + "SkYUVAInfo.cpp", + "SkYUVAInfoLocation.h", + "SkYUVAPixmaps.cpp", + "SkYUVMath.cpp", + "SkYUVMath.h", + "SkYUVPlanesCache.cpp", + "SkYUVPlanesCache.h", + "SkZip.h", + ], +) + +filegroup( + name = "sksl-srcs", + srcs = [ + "SkRuntimeEffect.cpp", + ], +) + +filegroup( + name = "srcs", + srcs = [":core-srcs"] + selects.with_or({ + ("//bazel/common_config_settings:gl_backend", "//bazel/common_config_settings:vulkan_backend"): [ + ":sksl-srcs", + ], + "//conditions:default": [], + }), + visibility = ["//:__subpackages__"], +) diff --git a/src/effects/BUILD.bazel b/src/effects/BUILD.bazel new file mode 100644 index 0000000000..62ed2e70d2 --- /dev/null +++ b/src/effects/BUILD.bazel @@ -0,0 +1,53 @@ +package(default_visibility = ["//:__subpackages__"]) + +filegroup( + name = "srcs", + srcs = [ + "Sk1DPathEffect.cpp", + "Sk2DPathEffect.cpp", + "SkBlenders.cpp", + "SkColorMatrix.cpp", + "SkColorMatrixFilter.cpp", + "SkCornerPathEffect.cpp", + "SkDashImpl.h", + "SkDashPathEffect.cpp", + "SkDiscretePathEffect.cpp", + "SkEmbossMask.cpp", + "SkEmbossMask.h", + "SkEmbossMaskFilter.cpp", + "SkEmbossMaskFilter.h", + "SkHighContrastFilter.cpp", + "SkLayerDrawLooper.cpp", + "SkLumaColorFilter.cpp", + "SkOpPE.h", + "SkOpPathEffect.cpp", + "SkOverdrawColorFilter.cpp", + "SkShaderMaskFilter.cpp", + "SkTableColorFilter.cpp", + "SkTableMaskFilter.cpp", + "SkTrimPE.h", + "SkTrimPathEffect.cpp", + "imagefilters/SkAlphaThresholdImageFilter.cpp", + "imagefilters/SkArithmeticImageFilter.cpp", + "imagefilters/SkBlendImageFilter.cpp", + "imagefilters/SkBlurImageFilter.cpp", + "imagefilters/SkColorFilterImageFilter.cpp", + "imagefilters/SkComposeImageFilter.cpp", + "imagefilters/SkCropImageFilter.cpp", + "imagefilters/SkCropImageFilter.h", + "imagefilters/SkDisplacementMapImageFilter.cpp", + "imagefilters/SkDropShadowImageFilter.cpp", + "imagefilters/SkImageImageFilter.cpp", + "imagefilters/SkLightingImageFilter.cpp", + "imagefilters/SkMagnifierImageFilter.cpp", + "imagefilters/SkMatrixConvolutionImageFilter.cpp", + "imagefilters/SkMergeImageFilter.cpp", + "imagefilters/SkMorphologyImageFilter.cpp", + "imagefilters/SkOffsetImageFilter.cpp", + "imagefilters/SkPictureImageFilter.cpp", + "imagefilters/SkRuntimeImageFilter.cpp", + "imagefilters/SkRuntimeImageFilter.h", + "imagefilters/SkShaderImageFilter.cpp", + "imagefilters/SkTileImageFilter.cpp", + ], +) diff --git a/src/gpu/BUILD.bazel b/src/gpu/BUILD.bazel new file mode 100644 index 0000000000..778f3d7670 --- /dev/null +++ b/src/gpu/BUILD.bazel @@ -0,0 +1,569 @@ +package(default_visibility = ["//visibility:private"]) + +filegroup( + name = "core-srcs", + srcs = [ + "BaseDevice.cpp", + "BaseDevice.h", + "BufferWriter.h", + "GrAHardwareBufferImageGenerator.cpp", + "GrAHardwareBufferImageGenerator.h", + "GrAHardwareBufferUtils.cpp", + "GrAHardwareBufferUtils.h", + "GrAppliedClip.h", + "GrAttachment.cpp", + "GrAttachment.h", + "GrAuditTrail.cpp", + "GrAuditTrail.h", + "GrAutoLocaleSetter.h", + "GrBackendSemaphore.cpp", + "GrBackendSurface.cpp", + "GrBackendSurfaceMutableState.cpp", + "GrBackendSurfaceMutableStateImpl.h", + "GrBackendTextureImageGenerator.cpp", + "GrBackendTextureImageGenerator.h", + "GrBackendUtils.cpp", + "GrBackendUtils.h", + "GrBaseContextPriv.h", + "GrBlend.h", + "GrBlurUtils.cpp", + "GrBlurUtils.h", + "GrBuffer.h", + "GrBufferAllocPool.cpp", + "GrBufferAllocPool.h", + "GrCaps.cpp", + "GrCaps.h", + "GrClientMappedBufferManager.cpp", + "GrClientMappedBufferManager.h", + "GrClip.h", + "GrColor.h", + "GrColorInfo.cpp", + "GrColorInfo.h", + "GrColorSpaceXform.cpp", + "GrColorSpaceXform.h", + "GrContextThreadSafeProxy.cpp", + "GrContextThreadSafeProxyPriv.h", + "GrContext_Base.cpp", + "GrCopyRenderTask.cpp", + "GrCopyRenderTask.h", + "GrCpuBuffer.h", + "GrDDLContext.cpp", + "GrDDLTask.cpp", + "GrDDLTask.h", + "GrDataUtils.cpp", + "GrDataUtils.h", + "GrDefaultGeoProcFactory.cpp", + "GrDefaultGeoProcFactory.h", + "GrDeferredProxyUploader.h", + "GrDeferredUpload.h", + "GrDirectContext.cpp", + "GrDirectContextPriv.cpp", + "GrDirectContextPriv.h", + "GrDistanceFieldGenFromVector.cpp", + "GrDistanceFieldGenFromVector.h", + "GrDrawIndirectCommand.h", + "GrDrawOpAtlas.cpp", + "GrDrawOpAtlas.h", + "GrDrawOpTest.cpp", + "GrDrawOpTest.h", + "GrDrawingManager.cpp", + "GrDrawingManager.h", + "GrDriverBugWorkarounds.cpp", + "GrDstProxyView.h", + "GrDynamicAtlas.cpp", + "GrDynamicAtlas.h", + "GrEagerVertexAllocator.cpp", + "GrEagerVertexAllocator.h", + "GrFPArgs.h", + "GrFinishCallbacks.cpp", + "GrFinishCallbacks.h", + "GrFixedClip.cpp", + "GrFixedClip.h", + "GrFragmentProcessor.cpp", + "GrFragmentProcessor.h", + "GrGeometryProcessor.cpp", + "GrGeometryProcessor.h", + "GrGlyph.h", + "GrGpu.cpp", + "GrGpu.h", + "GrGpuBuffer.cpp", + "GrGpuBuffer.h", + "GrGpuResource.cpp", + "GrGpuResource.h", + "GrGpuResourceCacheAccess.h", + "GrGpuResourcePriv.h", + "GrHashMapWithCache.h", + "GrImageContext.cpp", + "GrImageContextPriv.h", + "GrImageInfo.h", + "GrManagedResource.cpp", + "GrManagedResource.h", + "GrMemoryPool.cpp", + "GrMemoryPool.h", + "GrMeshDrawTarget.cpp", + "GrMeshDrawTarget.h", + "GrNativeRect.h", + "GrNonAtomicRef.h", + "GrOnFlushResourceProvider.cpp", + "GrOnFlushResourceProvider.h", + "GrOpFlushState.cpp", + "GrOpFlushState.h", + "GrOpsRenderPass.cpp", + "GrOpsRenderPass.h", + "GrOpsTypes.h", + "GrPaint.cpp", + "GrPaint.h", + "GrPersistentCacheUtils.cpp", + "GrPersistentCacheUtils.h", + "GrPipeline.cpp", + "GrPipeline.h", + "GrPixmap.h", + "GrProcessor.cpp", + "GrProcessor.h", + "GrProcessorAnalysis.cpp", + "GrProcessorAnalysis.h", + "GrProcessorSet.cpp", + "GrProcessorSet.h", + "GrProcessorUnitTest.cpp", + "GrProcessorUnitTest.h", + "GrProgramDesc.cpp", + "GrProgramDesc.h", + "GrProgramInfo.cpp", + "GrProgramInfo.h", + "GrProxyProvider.cpp", + "GrProxyProvider.h", + "GrRecordingContext.cpp", + "GrRecordingContextPriv.cpp", + "GrRecordingContextPriv.h", + "GrRectanizer.h", + "GrRectanizerPow2.cpp", + "GrRectanizerPow2.h", + "GrRectanizerSkyline.cpp", + "GrRectanizerSkyline.h", + "GrRefCnt.h", + "GrRenderTarget.cpp", + "GrRenderTarget.h", + "GrRenderTargetContext.h", + "GrRenderTargetProxy.cpp", + "GrRenderTargetProxy.h", + "GrRenderTask.cpp", + "GrRenderTask.h", + "GrRenderTaskCluster.cpp", + "GrRenderTaskCluster.h", + "GrResourceAllocator.cpp", + "GrResourceAllocator.h", + "GrResourceCache.cpp", + "GrResourceCache.h", + "GrResourceHandle.h", + "GrResourceProvider.cpp", + "GrResourceProvider.h", + "GrResourceProviderPriv.h", + "GrRingBuffer.cpp", + "GrRingBuffer.h", + "GrSPIRVUniformHandler.cpp", + "GrSPIRVUniformHandler.h", + "GrSPIRVVaryingHandler.cpp", + "GrSPIRVVaryingHandler.h", + "GrSWMaskHelper.cpp", + "GrSWMaskHelper.h", + "GrSamplerState.h", + "GrScissorState.h", + "GrSemaphore.h", + "GrShaderCaps.cpp", + "GrShaderCaps.h", + "GrShaderUtils.cpp", + "GrShaderUtils.h", + "GrShaderVar.cpp", + "GrShaderVar.h", + "GrSimpleMesh.h", + "GrStagingBufferManager.cpp", + "GrStagingBufferManager.h", + "GrStencilSettings.cpp", + "GrStencilSettings.h", + "GrStyle.cpp", + "GrStyle.h", + "GrSubRunAllocator.cpp", + "GrSubRunAllocator.h", + "GrSurface.cpp", + "GrSurface.h", + "GrSurfaceInfo.cpp", + "GrSurfaceProxy.cpp", + "GrSurfaceProxy.h", + "GrSurfaceProxyPriv.h", + "GrSurfaceProxyView.h", + "GrSwizzle.cpp", + "GrSwizzle.h", + "GrTTopoSort.h", + "GrTestUtils.cpp", + "GrTestUtils.h", + "GrTexture.cpp", + "GrTexture.h", + "GrTextureProxy.cpp", + "GrTextureProxy.h", + "GrTextureProxyCacheAccess.h", + "GrTextureProxyPriv.h", + "GrTextureRenderTargetProxy.cpp", + "GrTextureRenderTargetProxy.h", + "GrTextureResolveManager.h", + "GrTextureResolveRenderTask.cpp", + "GrTextureResolveRenderTask.h", + "GrThreadSafeCache.cpp", + "GrThreadSafeCache.h", + "GrThreadSafePipelineBuilder.cpp", + "GrThreadSafePipelineBuilder.h", + "GrTracing.h", + "GrTransferFromRenderTask.cpp", + "GrTransferFromRenderTask.h", + "GrUniformDataManager.cpp", + "GrUniformDataManager.h", + "GrUserStencilSettings.h", + "GrUtil.cpp", + "GrUtil.h", + "GrVertexChunkArray.cpp", + "GrVertexChunkArray.h", + "GrVx.h", + "GrWaitRenderTask.cpp", + "GrWaitRenderTask.h", + "GrWindowRectangles.h", + "GrWindowRectsState.h", + "GrWritePixelsRenderTask.cpp", + "GrWritePixelsRenderTask.h", + "GrXferProcessor.cpp", + "GrXferProcessor.h", + "GrYUVABackendTextures.cpp", + "GrYUVATextureProxies.cpp", + "GrYUVATextureProxies.h", + "SkGr.cpp", + "SkGr.h", + "SurfaceContext.cpp", + "SurfaceContext.h", + "SurfaceFillContext.cpp", + "SurfaceFillContext.h", + "effects/GrAtlasedShaderHelpers.h", + "effects/GrBezierEffect.cpp", + "effects/GrBezierEffect.h", + "effects/GrBicubicEffect.cpp", + "effects/GrBicubicEffect.h", + "effects/GrBitmapTextGeoProc.cpp", + "effects/GrBitmapTextGeoProc.h", + "effects/GrBlendFragmentProcessor.cpp", + "effects/GrBlendFragmentProcessor.h", + "effects/GrConvexPolyEffect.cpp", + "effects/GrConvexPolyEffect.h", + "effects/GrCoverageSetOpXP.cpp", + "effects/GrCoverageSetOpXP.h", + "effects/GrCustomXfermode.cpp", + "effects/GrCustomXfermode.h", + "effects/GrDisableColorXP.cpp", + "effects/GrDisableColorXP.h", + "effects/GrDistanceFieldGeoProc.cpp", + "effects/GrDistanceFieldGeoProc.h", + "effects/GrGaussianConvolutionFragmentProcessor.cpp", + "effects/GrGaussianConvolutionFragmentProcessor.h", + "effects/GrMatrixConvolutionEffect.cpp", + "effects/GrMatrixConvolutionEffect.h", + "effects/GrMatrixEffect.cpp", + "effects/GrMatrixEffect.h", + "effects/GrModulateAtlasCoverageEffect.cpp", + "effects/GrModulateAtlasCoverageEffect.h", + "effects/GrOvalEffect.cpp", + "effects/GrOvalEffect.h", + "effects/GrPorterDuffXferProcessor.cpp", + "effects/GrPorterDuffXferProcessor.h", + "effects/GrRRectEffect.cpp", + "effects/GrRRectEffect.h", + "effects/GrShadowGeoProc.cpp", + "effects/GrShadowGeoProc.h", + "effects/GrSkSLFP.cpp", + "effects/GrSkSLFP.h", + "effects/GrTextureEffect.cpp", + "effects/GrTextureEffect.h", + "effects/GrYUVtoRGBEffect.cpp", + "effects/GrYUVtoRGBEffect.h", + "geometry/GrAAConvexTessellator.cpp", + "geometry/GrAAConvexTessellator.h", + "geometry/GrAATriangulator.cpp", + "geometry/GrAATriangulator.h", + "geometry/GrInnerFanTriangulator.h", + "geometry/GrPathUtils.cpp", + "geometry/GrPathUtils.h", + "geometry/GrQuad.cpp", + "geometry/GrQuad.h", + "geometry/GrQuadBuffer.h", + "geometry/GrQuadUtils.cpp", + "geometry/GrQuadUtils.h", + "geometry/GrRect.h", + "geometry/GrShape.cpp", + "geometry/GrShape.h", + "geometry/GrStyledShape.cpp", + "geometry/GrStyledShape.h", + "geometry/GrTriangulator.cpp", + "geometry/GrTriangulator.h", + "gradients/GrGradientBitmapCache.cpp", + "gradients/GrGradientBitmapCache.h", + "gradients/GrGradientShader.cpp", + "gradients/GrGradientShader.h", + "ops/AAConvexPathRenderer.cpp", + "ops/AAConvexPathRenderer.h", + "ops/AAHairLinePathRenderer.cpp", + "ops/AAHairLinePathRenderer.h", + "ops/AALinearizingConvexPathRenderer.cpp", + "ops/AALinearizingConvexPathRenderer.h", + "ops/AtlasInstancedHelper.cpp", + "ops/AtlasInstancedHelper.h", + "ops/AtlasPathRenderer.cpp", + "ops/AtlasPathRenderer.h", + "ops/AtlasRenderTask.cpp", + "ops/AtlasRenderTask.h", + "ops/AtlasTextOp.cpp", + "ops/AtlasTextOp.h", + "ops/ClearOp.cpp", + "ops/ClearOp.h", + "ops/DashLinePathRenderer.cpp", + "ops/DashLinePathRenderer.h", + "ops/DashOp.cpp", + "ops/DashOp.h", + "ops/DefaultPathRenderer.cpp", + "ops/DefaultPathRenderer.h", + "ops/DrawAtlasOp.cpp", + "ops/DrawAtlasOp.h", + "ops/DrawAtlasPathOp.cpp", + "ops/DrawAtlasPathOp.h", + "ops/DrawVerticesOp.cpp", + "ops/DrawVerticesOp.h", + "ops/DrawableOp.cpp", + "ops/DrawableOp.h", + "ops/FillPathFlags.h", + "ops/FillRRectOp.cpp", + "ops/FillRRectOp.h", + "ops/FillRectOp.cpp", + "ops/FillRectOp.h", + "ops/GrDrawOp.h", + "ops/GrMeshDrawOp.cpp", + "ops/GrMeshDrawOp.h", + "ops/GrOp.cpp", + "ops/GrOp.h", + "ops/GrOvalOpFactory.cpp", + "ops/GrOvalOpFactory.h", + "ops/GrPathStencilSettings.h", + "ops/GrSimpleMeshDrawOpHelper.cpp", + "ops/GrSimpleMeshDrawOpHelper.h", + "ops/GrSimpleMeshDrawOpHelperWithStencil.cpp", + "ops/GrSimpleMeshDrawOpHelperWithStencil.h", + "ops/LatticeOp.cpp", + "ops/LatticeOp.h", + "ops/OpsTask.cpp", + "ops/OpsTask.h", + "ops/PathInnerTriangulateOp.cpp", + "ops/PathInnerTriangulateOp.h", + "ops/PathStencilCoverOp.cpp", + "ops/PathStencilCoverOp.h", + "ops/PathTessellateOp.cpp", + "ops/PathTessellateOp.h", + "ops/QuadPerEdgeAA.cpp", + "ops/QuadPerEdgeAA.h", + "ops/RegionOp.cpp", + "ops/RegionOp.h", + "ops/ShadowRRectOp.cpp", + "ops/ShadowRRectOp.h", + "ops/SmallPathAtlasMgr.cpp", + "ops/SmallPathAtlasMgr.h", + "ops/SmallPathRenderer.cpp", + "ops/SmallPathRenderer.h", + "ops/SmallPathShapeData.cpp", + "ops/SmallPathShapeData.h", + "ops/SoftwarePathRenderer.cpp", + "ops/SoftwarePathRenderer.h", + "ops/StrokeRectOp.cpp", + "ops/StrokeRectOp.h", + "ops/StrokeTessellateOp.cpp", + "ops/StrokeTessellateOp.h", + "ops/TessellationPathRenderer.cpp", + "ops/TessellationPathRenderer.h", + "ops/TextureOp.cpp", + "ops/TextureOp.h", + "ops/TriangulatingPathRenderer.cpp", + "ops/TriangulatingPathRenderer.h", + "tessellate/AffineMatrix.h", + "tessellate/CullTest.h", + "tessellate/MiddleOutPolygonTriangulator.h", + "tessellate/PatchWriter.cpp", + "tessellate/PatchWriter.h", + "tessellate/PathCurveTessellator.cpp", + "tessellate/PathCurveTessellator.h", + "tessellate/PathTessellator.h", + "tessellate/PathWedgeTessellator.cpp", + "tessellate/PathWedgeTessellator.h", + "tessellate/StrokeFixedCountTessellator.cpp", + "tessellate/StrokeFixedCountTessellator.h", + "tessellate/StrokeHardwareTessellator.cpp", + "tessellate/StrokeHardwareTessellator.h", + "tessellate/StrokeIterator.h", + "tessellate/StrokeTessellator.h", + "tessellate/Tessellation.cpp", + "tessellate/Tessellation.h", + "tessellate/WangsFormula.h", + "tessellate/shaders/GrPathTessellationShader.cpp", + "tessellate/shaders/GrPathTessellationShader.h", + "tessellate/shaders/GrPathTessellationShader_Hardware.cpp", + "tessellate/shaders/GrPathTessellationShader_MiddleOut.cpp", + "tessellate/shaders/GrStrokeTessellationShader.cpp", + "tessellate/shaders/GrStrokeTessellationShader.h", + "tessellate/shaders/GrStrokeTessellationShader_HardwareImpl.cpp", + "tessellate/shaders/GrStrokeTessellationShader_InstancedImpl.cpp", + "tessellate/shaders/GrTessellationShader.cpp", + "tessellate/shaders/GrTessellationShader.h", + "text/GrAtlasManager.cpp", + "text/GrAtlasManager.h", + "text/GrDistanceFieldAdjustTable.cpp", + "text/GrDistanceFieldAdjustTable.h", + "text/GrSDFMaskFilter.cpp", + "text/GrSDFMaskFilter.h", + "text/GrSDFTControl.cpp", + "text/GrSDFTControl.h", + "text/GrStrikeCache.cpp", + "text/GrStrikeCache.h", + "text/GrTextBlob.cpp", + "text/GrTextBlob.h", + "text/GrTextBlobCache.cpp", + "text/GrTextBlobCache.h", + ], +) + +filegroup( + name = "gl-srcs", + srcs = [ + "gl/GrGLAssembleGLESInterfaceAutogen.cpp", + "gl/GrGLAssembleGLInterfaceAutogen.cpp", + "gl/GrGLAssembleHelpers.cpp", + "gl/GrGLAssembleInterface.cpp", + "gl/GrGLAssembleWebGLInterfaceAutogen.cpp", + "gl/GrGLAttachment.cpp", + "gl/GrGLAttachment.h", + "gl/GrGLBuffer.cpp", + "gl/GrGLBuffer.h", + "gl/GrGLCaps.cpp", + "gl/GrGLCaps.h", + "gl/GrGLContext.cpp", + "gl/GrGLContext.h", + "gl/GrGLDefines.h", + "gl/GrGLExtensions.cpp", + "gl/GrGLGLSL.cpp", + "gl/GrGLGLSL.h", + "gl/GrGLGpu.cpp", + "gl/GrGLGpu.h", + "gl/GrGLGpuProgramCache.cpp", + "gl/GrGLInterfaceAutogen.cpp", + "gl/GrGLOpsRenderPass.cpp", + "gl/GrGLOpsRenderPass.h", + "gl/GrGLProgram.cpp", + "gl/GrGLProgram.h", + "gl/GrGLProgramDataManager.cpp", + "gl/GrGLProgramDataManager.h", + "gl/GrGLRenderTarget.cpp", + "gl/GrGLRenderTarget.h", + "gl/GrGLSemaphore.cpp", + "gl/GrGLSemaphore.h", + "gl/GrGLTexture.cpp", + "gl/GrGLTexture.h", + "gl/GrGLTextureRenderTarget.cpp", + "gl/GrGLTextureRenderTarget.h", + "gl/GrGLTypesPriv.cpp", + "gl/GrGLUniformHandler.cpp", + "gl/GrGLUniformHandler.h", + "gl/GrGLUtil.cpp", + "gl/GrGLUtil.h", + "gl/GrGLVaryingHandler.h", + "gl/GrGLVertexArray.cpp", + "gl/GrGLVertexArray.h", + "gl/builders/GrGLProgramBuilder.cpp", + "gl/builders/GrGLProgramBuilder.h", + "gl/builders/GrGLShaderStringBuilder.cpp", + "gl/builders/GrGLShaderStringBuilder.h", + "glsl/GrGLSL.cpp", + "glsl/GrGLSL.h", + "glsl/GrGLSLBlend.cpp", + "glsl/GrGLSLBlend.h", + "glsl/GrGLSLColorSpaceXformHelper.h", + "glsl/GrGLSLFragmentShaderBuilder.cpp", + "glsl/GrGLSLFragmentShaderBuilder.h", + "glsl/GrGLSLProgramBuilder.cpp", + "glsl/GrGLSLProgramBuilder.h", + "glsl/GrGLSLProgramDataManager.cpp", + "glsl/GrGLSLProgramDataManager.h", + "glsl/GrGLSLShaderBuilder.cpp", + "glsl/GrGLSLShaderBuilder.h", + "glsl/GrGLSLUniformHandler.cpp", + "glsl/GrGLSLUniformHandler.h", + "glsl/GrGLSLVarying.cpp", + "glsl/GrGLSLVarying.h", + "glsl/GrGLSLVertexGeoBuilder.cpp", + "glsl/GrGLSLVertexGeoBuilder.h", + ], +) + +filegroup( + name = "v1-srcs", + srcs = [ + "v1/ClipStack.cpp", + "v1/ClipStack.h", + "v1/Device.cpp", + "v1/Device_drawTexture.cpp", + "v1/Device_v1.h", + "v1/PathRenderer.cpp", + "v1/PathRenderer.h", + "v1/PathRendererChain.cpp", + "v1/PathRendererChain.h", + "v1/StencilClip.h", + "v1/StencilMaskHelper.cpp", + "v1/StencilMaskHelper.h", + "v1/SurfaceDrawContext.cpp", + "v1/SurfaceDrawContext_v1.h", + "v1/SurfaceFillContext_v1.cpp", + "v1/SurfaceFillContext_v1.h", + ], +) + +filegroup( + name = "webgl-srcs", + srcs = [ + "gl/webgl/GrGLMakeNativeInterface_webgl.cpp", + ], +) + +filegroup( + name = "srcs", + srcs = [":core-srcs"] + select({ + "//bazel/common_config_settings:gl_backend": [ + ":gl-srcs", + ":v1-srcs", + ], + "//conditions:default": [], + }) + select({ + "//bazel/common_config_settings:webgl_standard": [":webgl-srcs"], + "//conditions:default": [], + }), + visibility = ["//:__subpackages__"], +) + +########################################################################## +# Test only srcs/headers below + +filegroup( + name = "mock-srcs", + srcs = [ + "mock/GrMockAttachment.h", + "mock/GrMockBuffer.h", + "mock/GrMockCaps.cpp", + "mock/GrMockCaps.h", + "mock/GrMockGpu.cpp", + "mock/GrMockGpu.h", + "mock/GrMockOpTarget.h", + "mock/GrMockOpsRenderPass.h", + "mock/GrMockRenderTask.h", + "mock/GrMockSurfaceProxy.h", + "mock/GrMockTexture.h", + "mock/GrMockTypes.cpp", + ], + visibility = ["//:__subpackages__"], +) diff --git a/src/image/BUILD.bazel b/src/image/BUILD.bazel new file mode 100644 index 0000000000..b3a26c09ff --- /dev/null +++ b/src/image/BUILD.bazel @@ -0,0 +1,46 @@ +package(default_visibility = ["//visibility:private"]) + +# https://github.com/bazelbuild/bazel-skylib +load("@bazel_skylib//lib:selects.bzl", "selects") + +filegroup( + name = "core-srcs", + srcs = [ + "SkImage.cpp", + "SkImage_Base.h", + "SkImage_Lazy.cpp", + "SkImage_Lazy.h", + "SkImage_Raster.cpp", + "SkReadPixelsRec.h", + "SkRescaleAndReadPixels.cpp", + "SkRescaleAndReadPixels.h", + "SkSurface.cpp", + "SkSurface_Base.h", + "SkSurface_Raster.cpp", + ], +) + +filegroup( + name = "gpu-srcs", + srcs = [ + "SkImage_Gpu.cpp", + "SkImage_Gpu.h", + "SkImage_GpuBase.cpp", + "SkImage_GpuBase.h", + "SkImage_GpuYUVA.cpp", + "SkImage_GpuYUVA.h", + "SkSurface_Gpu.cpp", + "SkSurface_Gpu.h", + ], +) + +filegroup( + name = "srcs", + srcs = [":core-srcs"] + selects.with_or({ + ("//bazel/common_config_settings:gl_backend", "//bazel/common_config_settings:vulkan_backend"): [ + ":gpu-srcs", + ], + "//conditions:default": [], + }), + visibility = ["//:__subpackages__"], +) diff --git a/src/images/BUILD.bazel b/src/images/BUILD.bazel new file mode 100644 index 0000000000..27ec5faee1 --- /dev/null +++ b/src/images/BUILD.bazel @@ -0,0 +1,20 @@ +package(default_visibility = ["//visibility:private"]) + +filegroup( + name = "core-srcs", + srcs = [ + "SkImageEncoder.cpp", + "SkImageEncoderFns.h", + "SkImageEncoderPriv.h", + ], +) + +# TODO(kjlubick) add selects here to allow opting in or out of various codecs. + +filegroup( + name = "srcs", + srcs = [ + ":core-srcs", + ], + visibility = ["//:__subpackages__"], +) diff --git a/src/opts/BUILD.bazel b/src/opts/BUILD.bazel new file mode 100644 index 0000000000..18c00ffc09 --- /dev/null +++ b/src/opts/BUILD.bazel @@ -0,0 +1,28 @@ +package(default_visibility = ["//:__subpackages__"]) + +# TODO(kjlubick) make these sources and headers dependent on target platform, as necessary + +filegroup( + name = "srcs", + srcs = [ + "Sk4px_NEON.h", + "Sk4px_SSE2.h", + "Sk4px_none.h", + "SkBitmapProcState_opts.h", + "SkBlitMask_opts.h", + "SkBlitRow_opts.h", + "SkChecksum_opts.h", + "SkOpts_avx.cpp", + "SkOpts_crc32.cpp", + "SkOpts_hsw.cpp", + "SkOpts_skx.cpp", + "SkOpts_sse41.cpp", + "SkOpts_sse42.cpp", + "SkOpts_ssse3.cpp", + "SkRasterPipeline_opts.h", + "SkSwizzler_opts.h", + "SkUtils_opts.h", + "SkVM_opts.h", + "SkXfermode_opts.h", + ], +) diff --git a/src/pathops/BUILD.bazel b/src/pathops/BUILD.bazel new file mode 100644 index 0000000000..4d3c23593b --- /dev/null +++ b/src/pathops/BUILD.bazel @@ -0,0 +1,64 @@ +package(default_visibility = ["//:__subpackages__"]) + +filegroup( + name = "srcs", + srcs = [ + "SkAddIntersections.cpp", + "SkAddIntersections.h", + "SkDConicLineIntersection.cpp", + "SkDCubicLineIntersection.cpp", + "SkDCubicToQuads.cpp", + "SkDLineIntersection.cpp", + "SkDQuadLineIntersection.cpp", + "SkIntersectionHelper.h", + "SkIntersections.cpp", + "SkIntersections.h", + "SkLineParameters.h", + "SkOpAngle.cpp", + "SkOpAngle.h", + "SkOpBuilder.cpp", + "SkOpCoincidence.cpp", + "SkOpCoincidence.h", + "SkOpContour.cpp", + "SkOpContour.h", + "SkOpCubicHull.cpp", + "SkOpEdgeBuilder.cpp", + "SkOpEdgeBuilder.h", + "SkOpSegment.cpp", + "SkOpSegment.h", + "SkOpSpan.cpp", + "SkOpSpan.h", + "SkPathOpsAsWinding.cpp", + "SkPathOpsBounds.h", + "SkPathOpsCommon.cpp", + "SkPathOpsCommon.h", + "SkPathOpsConic.cpp", + "SkPathOpsConic.h", + "SkPathOpsCubic.cpp", + "SkPathOpsCubic.h", + "SkPathOpsCurve.cpp", + "SkPathOpsCurve.h", + "SkPathOpsDebug.cpp", + "SkPathOpsDebug.h", + "SkPathOpsLine.cpp", + "SkPathOpsLine.h", + "SkPathOpsOp.cpp", + "SkPathOpsPoint.h", + "SkPathOpsQuad.cpp", + "SkPathOpsQuad.h", + "SkPathOpsRect.cpp", + "SkPathOpsRect.h", + "SkPathOpsSimplify.cpp", + "SkPathOpsTCurve.h", + "SkPathOpsTSect.cpp", + "SkPathOpsTSect.h", + "SkPathOpsTightBounds.cpp", + "SkPathOpsTypes.cpp", + "SkPathOpsTypes.h", + "SkPathOpsWinding.cpp", + "SkPathWriter.cpp", + "SkPathWriter.h", + "SkReduceOrder.cpp", + "SkReduceOrder.h", + ], +) diff --git a/src/ports/BUILD.bazel b/src/ports/BUILD.bazel index 3ce27ce22c..e76ae36cc2 100644 --- a/src/ports/BUILD.bazel +++ b/src/ports/BUILD.bazel @@ -1,16 +1,44 @@ package(default_visibility = ["//:__subpackages__"]) +filegroup( + name = "fontmgr", + srcs = select({ + "//bazel/common_config_settings:empty_fontmgr_factory": [ + "SkFontMgr_empty_factory.cpp", + ], + "//bazel/common_config_settings:custom_directory_fontmgr_factory": [ + "SkFontMgr_directory.h", + "SkFontMgr_custom_directory.cpp", + ], + }), +) + +filegroup( + name = "malloc", + srcs = [ + "SkMemory_malloc.cpp", + ], +) + filegroup( name = "skdebug", srcs = select({ - "//bazel/common_config_settings:stdio_skdebug": [ - "SkDebug_stdio.cpp", - ], - "//bazel/common_config_settings:win_skdebug": [ - "SkDebug_win.cpp", - ], - "//bazel/common_config_settings:android_skdebug": [ - "SkDebug_android.cpp", - ], + "@platforms//os:windows": ["SkDebug_win.cpp"], + "@platforms//os:android": ["SkDebug_android.cpp"], + "//conditions:default": ["SkDebug_stdio.cpp"], }), ) + +filegroup( + name = "default_global_init", + srcs = [ + "SkGlobalInitialization_default.cpp", + ], +) + +filegroup( + name = "skia_image_generator", + srcs = [ + "SkImageGenerator_skia.cpp", + ], +) diff --git a/src/sfnt/BUILD.bazel b/src/sfnt/BUILD.bazel new file mode 100644 index 0000000000..09596e4d41 --- /dev/null +++ b/src/sfnt/BUILD.bazel @@ -0,0 +1,36 @@ +package(default_visibility = ["//:__subpackages__"]) + +filegroup( + name = "srcs", + srcs = [ + "SkIBMFamilyClass.h", + "SkOTTableTypes.h", + "SkOTTable_EBDT.h", + "SkOTTable_EBLC.h", + "SkOTTable_EBSC.h", + "SkOTTable_OS_2.h", + "SkOTTable_OS_2_V0.h", + "SkOTTable_OS_2_V1.h", + "SkOTTable_OS_2_V2.h", + "SkOTTable_OS_2_V3.h", + "SkOTTable_OS_2_V4.h", + "SkOTTable_OS_2_VA.h", + "SkOTTable_fvar.h", + "SkOTTable_gasp.h", + "SkOTTable_glyf.h", + "SkOTTable_head.h", + "SkOTTable_hhea.h", + "SkOTTable_loca.h", + "SkOTTable_maxp.h", + "SkOTTable_maxp_CFF.h", + "SkOTTable_maxp_TT.h", + "SkOTTable_name.cpp", + "SkOTTable_name.h", + "SkOTTable_post.h", + "SkOTUtils.cpp", + "SkOTUtils.h", + "SkPanose.h", + "SkSFNTHeader.h", + "SkTTCFHeader.h", + ], +) diff --git a/src/shaders/BUILD.bazel b/src/shaders/BUILD.bazel new file mode 100644 index 0000000000..85342f7dda --- /dev/null +++ b/src/shaders/BUILD.bazel @@ -0,0 +1,42 @@ +package(default_visibility = ["//:__subpackages__"]) + +filegroup( + name = "srcs", + srcs = [ + "SkBitmapProcShader.cpp", + "SkBitmapProcShader.h", + "SkColorFilterShader.cpp", + "SkColorFilterShader.h", + "SkColorShader.cpp", + "SkColorShader.h", + "SkComposeShader.cpp", + "SkComposeShader.h", + "SkEmptyShader.h", + "SkImageShader.cpp", + "SkImageShader.h", + "SkLocalMatrixShader.cpp", + "SkLocalMatrixShader.h", + "SkPerlinNoiseShader.cpp", + "SkPictureShader.cpp", + "SkPictureShader.h", + "SkShader.cpp", + "SkShaderBase.h", + "SkTransformShader.cpp", + "SkTransformShader.h", + "gradients/Sk4fGradientBase.cpp", + "gradients/Sk4fGradientBase.h", + "gradients/Sk4fGradientPriv.h", + "gradients/Sk4fLinearGradient.cpp", + "gradients/Sk4fLinearGradient.h", + "gradients/SkGradientShader.cpp", + "gradients/SkGradientShaderPriv.h", + "gradients/SkLinearGradient.cpp", + "gradients/SkLinearGradient.h", + "gradients/SkRadialGradient.cpp", + "gradients/SkRadialGradient.h", + "gradients/SkSweepGradient.cpp", + "gradients/SkSweepGradient.h", + "gradients/SkTwoPointConicalGradient.cpp", + "gradients/SkTwoPointConicalGradient.h", + ], +) diff --git a/src/sksl/BUILD.bazel b/src/sksl/BUILD.bazel new file mode 100644 index 0000000000..ca46fa6a54 --- /dev/null +++ b/src/sksl/BUILD.bazel @@ -0,0 +1,215 @@ +package(default_visibility = ["//:__subpackages__"]) + +filegroup( + name = "srcs", + srcs = [ + "GLSL.std.450.h", + "SkSLAnalysis.cpp", + "SkSLAnalysis.h", + "SkSLBuiltinTypes.cpp", + "SkSLBuiltinTypes.h", + "SkSLCompiler.cpp", + "SkSLCompiler.h", + "SkSLConstantFolder.cpp", + "SkSLConstantFolder.h", + "SkSLContext.cpp", + "SkSLContext.h", + "SkSLDSLParser.cpp", + "SkSLDSLParser.h", + "SkSLDehydrator.cpp", + "SkSLDehydrator.h", + "SkSLErrorReporter.cpp", + "SkSLFileOutputStream.h", + "SkSLInliner.cpp", + "SkSLInliner.h", + "SkSLIntrinsicList.h", + "SkSLIntrinsicMap.cpp", + "SkSLIntrinsicMap.h", + "SkSLLexer.cpp", + "SkSLLexer.h", + "SkSLMangler.cpp", + "SkSLMangler.h", + "SkSLMemoryLayout.h", + "SkSLMemoryPool.h", + "SkSLModifiersPool.h", + "SkSLOperators.cpp", + "SkSLOperators.h", + "SkSLOutputStream.cpp", + "SkSLOutputStream.h", + "SkSLParsedModule.h", + "SkSLPool.cpp", + "SkSLPool.h", + "SkSLProgramSettings.h", + "SkSLRehydrator.cpp", + "SkSLRehydrator.h", + "SkSLSampleUsage.cpp", + "SkSLString.cpp", + "SkSLStringStream.h", + "SkSLThreadContext.cpp", + "SkSLThreadContext.h", + "SkSLUtil.cpp", + "SkSLUtil.h", + "analysis/SkSLCanExitWithoutReturningValue.cpp", + "analysis/SkSLCheckProgramUnrolledSize.cpp", + "analysis/SkSLGetLoopUnrollInfo.cpp", + "analysis/SkSLIsConstantExpression.cpp", + "analysis/SkSLProgramUsage.cpp", + "analysis/SkSLProgramVisitor.h", + "analysis/SkSLSwitchCaseContainsExit.cpp", + "codegen/SkSLCodeGenerator.h", + "codegen/SkSLGLSLCodeGenerator.cpp", + "codegen/SkSLGLSLCodeGenerator.h", + "codegen/SkSLMetalCodeGenerator.cpp", + "codegen/SkSLMetalCodeGenerator.h", + "codegen/SkSLPipelineStageCodeGenerator.cpp", + "codegen/SkSLPipelineStageCodeGenerator.h", + "codegen/SkSLSPIRVCodeGenerator.cpp", + "codegen/SkSLSPIRVCodeGenerator.h", + "codegen/SkSLSPIRVtoHLSL.cpp", + "codegen/SkSLSPIRVtoHLSL.h", + "codegen/SkSLVMCodeGenerator.cpp", + "codegen/SkSLVMCodeGenerator.h", + "dsl/DSLBlock.cpp", + "dsl/DSLCase.cpp", + "dsl/DSLCore.cpp", + "dsl/DSLExpression.cpp", + "dsl/DSLFunction.cpp", + "dsl/DSLLayout.cpp", + "dsl/DSLRuntimeEffects.cpp", + "dsl/DSLStatement.cpp", + "dsl/DSLSymbols.cpp", + "dsl/DSLType.cpp", + "dsl/DSLVar.cpp", + "dsl/priv/DSLFPs.cpp", + "dsl/priv/DSLFPs.h", + "dsl/priv/DSLWriter.cpp", + "dsl/priv/DSLWriter.h", + "dsl/priv/DSL_priv.h", + "ir/SkSLBinaryExpression.cpp", + "ir/SkSLBinaryExpression.h", + "ir/SkSLBlock.cpp", + "ir/SkSLBlock.h", + "ir/SkSLBreakStatement.h", + "ir/SkSLChildCall.cpp", + "ir/SkSLChildCall.h", + "ir/SkSLCodeStringExpression.h", + "ir/SkSLConstructor.cpp", + "ir/SkSLConstructor.h", + "ir/SkSLConstructorArray.cpp", + "ir/SkSLConstructorArray.h", + "ir/SkSLConstructorArrayCast.cpp", + "ir/SkSLConstructorArrayCast.h", + "ir/SkSLConstructorCompound.cpp", + "ir/SkSLConstructorCompound.h", + "ir/SkSLConstructorCompoundCast.cpp", + "ir/SkSLConstructorCompoundCast.h", + "ir/SkSLConstructorDiagonalMatrix.cpp", + "ir/SkSLConstructorDiagonalMatrix.h", + "ir/SkSLConstructorMatrixResize.cpp", + "ir/SkSLConstructorMatrixResize.h", + "ir/SkSLConstructorScalarCast.cpp", + "ir/SkSLConstructorScalarCast.h", + "ir/SkSLConstructorSplat.cpp", + "ir/SkSLConstructorSplat.h", + "ir/SkSLConstructorStruct.cpp", + "ir/SkSLConstructorStruct.h", + "ir/SkSLContinueStatement.h", + "ir/SkSLDiscardStatement.h", + "ir/SkSLDoStatement.cpp", + "ir/SkSLDoStatement.h", + "ir/SkSLExpression.h", + "ir/SkSLExpressionStatement.cpp", + "ir/SkSLExpressionStatement.h", + "ir/SkSLExtension.h", + "ir/SkSLExternalFunction.h", + "ir/SkSLExternalFunctionCall.h", + "ir/SkSLExternalFunctionReference.h", + "ir/SkSLField.h", + "ir/SkSLFieldAccess.cpp", + "ir/SkSLFieldAccess.h", + "ir/SkSLForStatement.cpp", + "ir/SkSLForStatement.h", + "ir/SkSLFunctionCall.cpp", + "ir/SkSLFunctionCall.h", + "ir/SkSLFunctionDeclaration.cpp", + "ir/SkSLFunctionDeclaration.h", + "ir/SkSLFunctionDefinition.cpp", + "ir/SkSLFunctionDefinition.h", + "ir/SkSLFunctionPrototype.h", + "ir/SkSLFunctionReference.h", + "ir/SkSLIfStatement.cpp", + "ir/SkSLIfStatement.h", + "ir/SkSLIndexExpression.cpp", + "ir/SkSLIndexExpression.h", + "ir/SkSLInlineMarker.h", + "ir/SkSLInterfaceBlock.h", + "ir/SkSLLiteral.h", + "ir/SkSLMethodReference.h", + "ir/SkSLModifiers.cpp", + "ir/SkSLModifiersDeclaration.h", + "ir/SkSLNop.h", + "ir/SkSLPoison.h", + "ir/SkSLPostfixExpression.cpp", + "ir/SkSLPostfixExpression.h", + "ir/SkSLPrefixExpression.cpp", + "ir/SkSLPrefixExpression.h", + "ir/SkSLProgram.h", + "ir/SkSLReturnStatement.h", + "ir/SkSLSetting.cpp", + "ir/SkSLSetting.h", + "ir/SkSLStructDefinition.h", + "ir/SkSLSwitchCase.h", + "ir/SkSLSwitchStatement.cpp", + "ir/SkSLSwitchStatement.h", + "ir/SkSLSwizzle.cpp", + "ir/SkSLSwizzle.h", + "ir/SkSLSymbolAlias.h", + "ir/SkSLSymbolTable.cpp", + "ir/SkSLSymbolTable.h", + "ir/SkSLTernaryExpression.cpp", + "ir/SkSLTernaryExpression.h", + "ir/SkSLType.cpp", + "ir/SkSLType.h", + "ir/SkSLTypeReference.cpp", + "ir/SkSLTypeReference.h", + "ir/SkSLUnresolvedFunction.h", + "ir/SkSLVarDeclarations.cpp", + "ir/SkSLVarDeclarations.h", + "ir/SkSLVariable.cpp", + "ir/SkSLVariable.h", + "ir/SkSLVariableReference.cpp", + "ir/SkSLVariableReference.h", + "lex/DFA.h", + "lex/DFAState.h", + "lex/LexUtil.h", + "lex/NFA.cpp", + "lex/NFA.h", + "lex/NFAState.h", + "lex/NFAtoDFA.h", + "lex/RegexNode.cpp", + "lex/RegexNode.h", + "lex/RegexParser.cpp", + "lex/RegexParser.h", + "lex/TransitionTable.cpp", + "lex/TransitionTable.h", + "spirv.h", + "transform/SkSLBuiltinVariableScanner.cpp", + "transform/SkSLEliminateDeadFunctions.cpp", + "transform/SkSLEliminateDeadGlobalVariables.cpp", + "transform/SkSLEliminateDeadLocalVariables.cpp", + "transform/SkSLEliminateUnreachableCode.cpp", + "transform/SkSLProgramWriter.h", + "transform/SkSLTransform.h", + ], +) + +filegroup( + name = "txts", + srcs = [ + "generated/sksl_frag.dehydrated.sksl", + "generated/sksl_gpu.dehydrated.sksl", + "generated/sksl_public.dehydrated.sksl", + "generated/sksl_rt_shader.dehydrated.sksl", + "generated/sksl_vert.dehydrated.sksl", + ], +) diff --git a/src/utils/BUILD.bazel b/src/utils/BUILD.bazel new file mode 100644 index 0000000000..3b20c1300e --- /dev/null +++ b/src/utils/BUILD.bazel @@ -0,0 +1,72 @@ +package(default_visibility = ["//visibility:private"]) + +filegroup( + name = "core-srcs", + srcs = [ + "SkAnimCodecPlayer.cpp", + "SkBase64.cpp", + "SkBitSet.h", + "SkCallableTraits.h", + "SkCamera.cpp", + "SkCanvasStack.cpp", + "SkCanvasStack.h", + "SkCanvasStateUtils.cpp", + "SkCharToGlyphCache.cpp", + "SkCharToGlyphCache.h", + "SkClipStackUtils.cpp", + "SkClipStackUtils.h", + "SkCustomTypeface.cpp", + "SkDashPath.cpp", + "SkDashPathPriv.h", + "SkEventTracer.cpp", + "SkFloatToDecimal.cpp", + "SkFloatToDecimal.h", + "SkFloatUtils.h", + "SkMatrix22.cpp", + "SkMatrix22.h", + "SkMultiPictureDocument.cpp", + "SkMultiPictureDocument.h", + "SkMultiPictureDocumentPriv.h", + "SkNWayCanvas.cpp", + "SkNullCanvas.cpp", + "SkOSPath.cpp", + "SkOSPath.h", + "SkOrderedFontMgr.cpp", + "SkPaintFilterCanvas.cpp", + "SkParse.cpp", + "SkParseColor.cpp", + "SkParsePath.cpp", + "SkPatchUtils.cpp", + "SkPatchUtils.h", + "SkPolyUtils.cpp", + "SkPolyUtils.h", + "SkShadowTessellator.cpp", + "SkShadowTessellator.h", + "SkShadowUtils.cpp", + "SkTextUtils.cpp", + "SkUTF.cpp", + "SkUTF.h", + ], +) + +filegroup( + name = "json-srcs", + srcs = [ + "SkJSON.cpp", + "SkJSON.h", + "SkJSONWriter.cpp", + "SkJSONWriter.h", + "SkShaperJSONWriter.cpp", + "SkShaperJSONWriter.h", + ], +) + +# TODO(kjlubick) add selects here to allow opting in or out of things like JSON + +filegroup( + name = "srcs", + srcs = [ + ":core-srcs", + ], + visibility = ["//:__subpackages__"], +) diff --git a/tests/BUILD.bazel b/tests/BUILD.bazel new file mode 100644 index 0000000000..7bb01c6485 --- /dev/null +++ b/tests/BUILD.bazel @@ -0,0 +1,17 @@ +package(default_visibility = ["//:__subpackages__"]) + +filegroup( + name = "hdrs", + srcs = [ + "Test.h", + "TestUtils.h", + ], +) + +filegroup( + name = "srcs", + srcs = [ + "Test.cpp", + "TestUtils.cpp", + ], +) diff --git a/third_party/BUILD.bazel b/third_party/BUILD.bazel index 190f2c93a0..842f16bb54 100644 --- a/third_party/BUILD.bazel +++ b/third_party/BUILD.bazel @@ -2,6 +2,20 @@ load("@rules_cc//cc:defs.bzl", "cc_library") package(default_visibility = ["//:__subpackages__"]) +cc_library( + name = "skcms", + srcs = [ + "skcms/skcms.cc", + "skcms/skcms_internal.h", + "skcms/src/Transform_inl.h", + ], + hdrs = [ + "//include/third_party:skcms-hdrs", + ], + # needed because skcms.cc just does include skcms.h + strip_include_prefix = "//include/third_party/skcms/", +) + LIBPNG_SRCS = [ "externals/libpng/png.c", "externals/libpng/pngconf.h", diff --git a/toolchain/BUILD.bazel b/toolchain/BUILD.bazel index 2fbd621761..0aaa05c76d 100644 --- a/toolchain/BUILD.bazel +++ b/toolchain/BUILD.bazel @@ -3,10 +3,13 @@ load(":clang_toolchain_config.bzl", "provide_clang_toolchain_config") package(default_visibility = ["//visibility:public"]) +# https://docs.bazel.build/versions/main/be/c-cpp.html#cc_toolchain_suite cc_toolchain_suite( name = "clang_suite", toolchains = { + # The key is target_cpu|compiler "k8|clang": ":clang_toolchain", + "x86_64|clang": ":clang_toolchain", }, ) diff --git a/toolchain/clang_toolchain_config.bzl b/toolchain/clang_toolchain_config.bzl index 6f3a89ee96..d90c623a01 100644 --- a/toolchain/clang_toolchain_config.bzl +++ b/toolchain/clang_toolchain_config.bzl @@ -218,7 +218,10 @@ def _make_default_flags(): flag_groups = [ flag_group( flags = [ + # http://g/skia-staff/bhPPBV4YdeU/5oyG5GRgBQAJ "-std=c++14", + "-Wno-c++17-extensions", + "-Wno-psabi", # noisy # This define allows libc++ to work with musl. They were discovered by # trying to compile without them, reading errors and source code, e.g. # https://github.com/llvm/llvm-project/blob/f4c1258d5633fcf06385ff3fd1f4bf57ab971964/libcxx/include/__locale#L513 diff --git a/tools/BUILD.bazel b/tools/BUILD.bazel new file mode 100644 index 0000000000..3fed8a1c4f --- /dev/null +++ b/tools/BUILD.bazel @@ -0,0 +1,61 @@ +package(default_visibility = ["//:__subpackages__"]) + +filegroup( + name = "cmdline", + srcs = [ + "flags/CommandLineFlags.cpp", + "flags/CommandLineFlags.h", + ], +) + +filegroup( + name = "srcs", + testonly = True, + srcs = [ + "Registry.h", + "ResourceFactory.h", + "Resources.cpp", + "Resources.h", + "ToolUtils.cpp", + "ToolUtils.h", + "flags/CommandLineFlags.cpp", + "flags/CommandLineFlags.h", + "fonts/TestFontMgr.cpp", + "fonts/TestFontMgr.h", + "fonts/TestTypeface.cpp", + "fonts/TestTypeface.h", + "fonts/ToolUtilsFont.cpp", + "gpu/FenceSync.h", + "gpu/FlushFinishTracker.cpp", + "gpu/FlushFinishTracker.h", + "gpu/GpuTimer.h", + "gpu/GrContextFactory.cpp", + "gpu/GrContextFactory.h", + "gpu/TestContext.cpp", + "gpu/TestContext.h", + "gpu/gl/GLTestContext.cpp", + "gpu/gl/GLTestContext.h", + "gpu/gl/command_buffer/GLTestContext_command_buffer.h", + "gpu/mock/MockTestContext.h", + ], +) + +filegroup( + name = "txts", + testonly = True, + srcs = [ + "fonts/test_font_index.inc", + "fonts/test_font_monospace.inc", + "fonts/test_font_sans_serif.inc", + "fonts/test_font_serif.inc", + ], +) + +filegroup( + name = "hash_and_encode", + testonly = True, + srcs = [ + "HashAndEncode.cpp", + "HashAndEncode.h", + ], +)