Commit Graph

101 Commits

Author SHA1 Message Date
Michael Ludwig
7611b9a863 Manual dawn roll
Change-Id: Id28311d2a7de96edbc8bcd7fa6eadb66223e5278
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/558438
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2022-07-14 14:45:31 +00:00
Michael Ludwig
bde3fb8f37 Manually roll dawn
Change-Id: I2fdbff5c4d58d5eace99abd809b2c9861c629ce4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557356
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2022-07-11 15:45:53 +00:00
Kevin Lubick
e3d341ce20 Add --keep_going to IWYU enforcement
Change-Id: I7108e82d0cabb54964f97e81bebe7aedb97e0a54
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/555416
Reviewed-by: John Stiles <johnstiles@google.com>
2022-07-01 13:03:51 +00:00
Kevin Lubick
a74ebc9bac [bazel] Use exec_tools instead of tools for better RBE compatibility
The tools in genrules [1] correspond to the HOST's version, which
is a problem if we are doing cross-platform builds. In this case,
when I was using my M1 Mac to run on a Linux RBE platform, the
Mac's python binaries (e.g. python3_9_aarch64-apple-darwin/bin/python3)
were being uploaded to RBE and attempted to be used, which resulted
in OSError: [Errno 8] Exec format error because the won't run
on the Linux RBE machine.

Thanks to tjgq@, I learned about exec_tools [2], which will use
the version of the tools for the EXECUTION platform, which
is exactly what we want.

While debugging this, I added a minimal reproduction case in
//experimental/bazel_test and updated the py_tools version
in an effort to diagnose the issue further.

We will need to contribute similar fixes to @spirv_tools

[1] https://bazel.build/reference/be/general#genrule.tools
[2] https://bazel.build/reference/be/general#genrule.exec_tools
Bug: skia:12541
Change-Id: Ib14deb4e326d3103fd08c21e93afe342d751c17a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554518
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
2022-06-30 18:02:35 +00:00
Michael Ludwig
9b88c8b66c Manual dawn roll
Bug: skia:13477
Change-Id: I524e076282e9dde3a8ad5d39c58e6054f684fbf0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554376
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
2022-06-29 15:02:34 +00:00
Kevin Lubick
c7b407553b [bazel] Replace -isystem with -I for copts
MSVC and clang-cl do not recognize -isystem, but do recognize
-I. Thus if those compilers use our rules, we want our copts
to be maximally compatible.

Some of these options didn't seem to do anything, so I removed
them rather than replace them.

Change-Id: I73feb63d5c682a6df646d731b10ca2509e105e6f
Bug: skia:12541, b/237076898
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553878
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
2022-06-28 17:16:42 +00:00
Kevin Lubick
4855152354 [bazel] Add cc_library_with_options
This can let us create versions of skia_public with certain settings
enabled in an easy way (i.e. not requiring clients to set the compile
flags themselves).

Change-Id: I909449c6186f4912ea80dd9d579fcd7cafb4775c
Bug: skia:12541 b/237076898
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553377
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
2022-06-28 13:20:54 +00:00
Michael Ludwig
9d10f64104 Manual dawn roll
Change-Id: Id6efc88e2d048ade8aa2c0e7870c0bc73b1afcf5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553537
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: James Godfrey-Kittle <jamesgk@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: James Godfrey-Kittle <jamesgk@google.com>
2022-06-27 19:09:52 +00:00
Kevin Lubick
86678ed625 [bazel] Add option for SkSVGCanvas (and expat third_party DEP)
Our SVG code depends on our XML code which depends on expat.

See also cl/457481999

Change-Id: I83b61f5d73570d0aa7e851a01ccd019b4b1019e4
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553376
Reviewed-by: Florin Malita <fmalita@google.com>
2022-06-27 15:56:55 +00:00
Kevin Lubick
cc91f7d709 [bazel] Fix toolchains on M1 Mac
These changes are necessary to use the toolchain on both the
M1 Mac and Intel Macs.

This adds a way to detect the host platform and choose different
compile options in the toolchain.

We cannot statically link in libc++.a from the clang zip because
it appears to be x64 only.

Finally, this fixes copts not being passed to objective c libraries.

Known issue:
 - Intel Mac building has an error about the default CC toolchain.

Change-Id: Ie8e5e83dc41513563ac684e70a8a6947b36df445
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/552472
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
2022-06-27 14:02:49 +00:00
Kevin Lubick
530759a6af Manual Dawn Roll
Required https://dawn.googlesource.com/dawn/+/77bf233cef236a094ef845d8f1a31073c2ddd7b9 and
https://dawn.googlesource.com/dawn/+/7223a5e7c9e122179e17f4faab6115e116c7ced3
to land, and for us to update our GN rules appropriately.

Change-Id: I5dad6bbd6e103405de16d7744f0c1c33fae9e0fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/551857
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-06-23 12:39:45 +00:00
Kevin Lubick
c4872ce644 [bazel] Add support for Macs to make Linux RBE builds
The big change here is having the C++ toolchain use
Bazel platforms instead of the C++ specific flags/setup.
In Bazel, platforms are a general purpose way to define
things like os, cpu architecture, etc. We were not using
platforms previously, because the best documentation at
the time focused on the old ways.

However, the old ways were clumsy/difficult when trying
to manage cross-compilation, specifically when trying
to have a Mac host trigger a build on our Linux RBE
system targeting a Linux x64 system. Thus, rather than
keep investing in the legacy system, this CL migrates
us to using platforms where possible.

Suggested background reading to better understand this CL:
 - https://bazel.build/concepts/platforms-intro
 - https://bazel.build/docs/platforms
 - https://bazel.build/docs/toolchains#registering-building-toolchains

The hermetic toolchain itself is not changing in this CL
(and likely does not need to), only how we tell Bazel
about it (i.e. registering it) and how Bazel decides
to use it (i.e. resolving toolchains).

Here is my understanding of how platforms and toolchains
interact (supported by some evidence from [1][2])
 - Bazel needs to resolve platforms for the Host, Execution,
   and Target.
   - If not specified via flags, these are the machine from
     which Bazel is invoked, aka "@local_config_platform//:host".
   - With this CL, the Host could be a Mac laptop, the Execution
     platform is our Linux RBE pool, and the Target is "a Linux
     system with a x64 CPU"
 - To specify the Host, that is, describe to Bazel the
   capabilities of the system it is running on, one can
   set --host_platform [3] with a label pointing to a platform()
   containing the appropriate settings. Tip: have this
   platform inherit from @local_config_platform//:host
   so it can add to any of the constraint_settings and
   constraint_values that Bazel deduces automatically.
 - To specify the Target platform(s), that is, the system
   on which a final output resides and can execute, one
   can set the --platforms flag with a label referencing
   a platform().
 - Bazel will then choose an execution platform to fulfill
   that request. Bazel will look through a list of available
   platforms, which can be augmented* with the
   --extra_execution_platforms. Platforms specified by this
   flag will be considered higher than the default platforms!
 - Having selected the appropriate platforms, Bazel now
   needs to select a toolchain to actually run the actions
   of the appropriate type.
 - Bazel looks through the list of available toolchains
   and finds one that "matches" the Execution and the Target
   platform. This means, the toolchain's exec_compatible_with
   is a strict subset of the Execution platform and
   the toolchain's target_compatible_with is a strict subset
   of the Target platform. To register toolchains* (i.e. add
   them to the resolution list), we use --extra_toolchains.
   Once Bazel finds a match, it stops looking.
   Using --toolchain_resolution_debug=".*" makes Bazel log
   how it is resolving these toolchains and what execution
   platform it picked.

* We can also register execution platforms and toolchains in
  WORKSPACE.bazel [4], but the flags come with higher priority
  and that made resolution a bit tricky. Also, when we want
  to conditionally add them (e.g. --config=linux_rbe), we
  cannot remove them conditionally in the WORKSPACE.bazel file.

The above resolution flow directly necessitated the changes
in this CL.

Example usage of the new configs and platforms:

    # Can be run on a x64 Linux host and uses the hermetic toolchain.
    bazel build //:skia_public

    # Can be run on Mac or Linux and uses the Linux RBE system along
    # with the hermetic toolchain to compile a binary for Linux x64.
    bazel build //:skia_public --config=linux_rbe --config=for_linux_x64

    # Shorthand for above
    bazel build //:skia_public --config=for_linux_x64_with_rbe

Notice we don't have to type out --config=clang_linux anymore!
That was due to me reading the Bazel docs more carefully and
realizing we can set options for *all* Bazel build commands.

Current Limitations:
 - Targets which require a py_binary (e.g. Dawn's genrules)
   will not work on RBE when cross compiling because the
   python runtime we download is for the host machine, not
   the executor. This means //example:hello_world_dawn does
   not work on Mac when cross-compiling via linux_rbe.
 - Mac M1 linking not quite working with SkOpts settings.
   Probably need to set -target [5]

Suggested Review order:
 - toolchain/BUILD.bazel Notice how we do away with
   cc_toolchain_suite for toolchain. These have the same
   role: giving Bazel the information about where a toolchain
   can run. The platforms one is more expressive (IMO), allowing
   us to say both where to run the toolchain and what it can
   make. In order to more easily force the use of our hermetic
   toolchain, but also allow the hermetic toolchain to be used
   on RBE, we specify "use_hermetic_toolchain" only on the target,
   because the RBE image does not have the hermetic toolchain
   on it by default (but can certainly run it).
 - bazel/platform/BUILD.bazel to see the custom constraint_setting
   and corresponding constraint_value. The names for both of these
   are completely arbitrary - they do not need to have any deeper
   meaning or relation to any file or Docker image or system or
   any other constraints. Think of the constraint_setting as
   an Enum and the constraint_value being the one and only member.
   We need to pass around a constant value, not a type, so we
   need to provide the constraint_value (e.g. in toolchain/BUILD.bazel)
   but not a constraint_setting. However we need a
   constraint_setting declared so we can make a constraint_value
   of that "type".
   Notice the platform declared here - it allows us to force
   Bazel to use the hermetic toolchain because of the extra
   constraint_value.
 - .bazelrc I set a few flags that will be on for all
   bazel build commands. Importantly, this causes the C++
   build logic to use platforms and not the old, bespoke way.
   I also found a way to avoid using the local toolchain on
   the host, which will hopefully lead to clearer errors
   if platforms are mis-specified instead of odd compile
   errors because the host toolchain is too old or something.
   There are also a few RBE settings tweaked to be a bit
   more modern, as well the new shorthands for specifying
   target platforms (e.g. for_linux_x64).
 - bazel/buildrc where we have to turn off the platforms
   logic for emscripten https://github.com/emscripten-core/emsdk/issues/984
 - bazel/rbe/BUILD.bazel for a fix in the platform description
   that makes it work on Mac.
 - Notice that _m1 has been removed from the mac-related toolchain
   files because the same toolchain should work on both
   architectures.
 - All other changes in any order.

[1] https://bazel.build/docs/toolchains#debugging-toolchains
[2] https://bazel.build/docs/toolchains#toolchain-resolution
[3] https://bazel.build/reference/command-line-reference
[4] https://bazel.build/docs/toolchains#registering-building-toolchains
[5] 17dc3f16fc/gn/skia/BUILD.gn (L258-L271)
Change-Id: I515c114099d659639a808f74e47d489a68b7af62
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549737
Reviewed-by: Erik Rose <erikrose@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
2022-06-23 12:00:43 +00:00
Kevin Lubick
1c15b9fe30 [Bazel] Fix sksl defines
Without this define, I was seeing a compile error in SkKeyHelpers.cpp

Change-Id: I4d4a804f11fdd67e69bac4c7a6d0d686bebd8922
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/552076
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-06-21 20:54:11 +00:00
Jorge Betancourt
c327d1054a reland "set up GL sample app to build through Bazel Mac toolchain"
https://skia-review.googlesource.com/c/skia/+/549897

G3 error fixed with:
https://critique.corp.google.com/cl/456234733

Introduces tracking bug:
https://bugs.chromium.org/p/skia/issues/detail?id=13452

Suggested review order.
1) tools/sk_app/* and src/gpu/ganesh/*
sets up the actual target to be built by the toolchain
2) toolchain/* and .bazelrc
changes to the mac hermetic toolchain, including support for framework dependencies, objc compilation, and dynamic lib dependency resolution

Change-Id: Id31e0adb134d385cbb4af6818f2c25c4fdae9598
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/551881
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
2022-06-21 19:22:16 +00:00
Nicolette Prevost
29dffe9ba4 Reland "Add Perfetto library (gn & bazel) and bare-bones SkPerfTrace class"
This reverts commit d78d52a86f.

That reason this CL was reverted in the first place is that it broke the Android roller - perfetto.h could not be located.
We now disable the use of perfetto for Android in the gn_to_bp.py script, so the roller should be good to go.

Reason for revert: Relanding

Original change's description:
> Revert "Add Perfetto library (gn & bazel) and bare-bones SkPerfTrace class"
>
> This reverts commit bfc9b94840.
>
> Reason for revert: new dependency causing Android build error
>
> Original change's description:
> > Add Perfetto library (gn & bazel) and bare-bones SkPerfTrace class
> >
> > First incremental step to incorporating Perfetto tracing into Skia, more CLs to follow
> >
> > NOTE: The presubmit check is failing. This appears to be due to the known issue where the presubmit check bugs out if the DEPS file is edited, which it was on this CL (modified to include Perfetto).
> >
> > Bug: skia:13303
> > Change-Id: I908be0392b520e8da14b34588b842bf6d955bd93
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/543081
> > Reviewed-by: Greg Daniel <egdaniel@google.com>
> > Commit-Queue: Nicolette Prevost <nicolettep@google.com>
>
> Bug: skia:13303
> Change-Id: Ia2b883bbab1f8fb4f3914b63104a39240cc60e86
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/544239
> Reviewed-by: Tyler Denniston <tdenniston@google.com>
> Auto-Submit: Tyler Denniston <tdenniston@google.com>
> Reviewed-by: Nicolette Prevost <nicolettep@google.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Tyler Denniston <tdenniston@google.com>

Bug: skia:13303
Change-Id: Ibd369b9c8c0e69fc9615fc05cf588ee4440c8ed5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/544244
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Nicolette Prevost <nicolettep@google.com>
2022-06-15 16:35:05 +00:00
Kevin Lubick
91f158c825 Manual roll of Dawn
gpu_info.json was moved

Change-Id: Ica01030b6d081e440264398590f895cc79ada072
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549056
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2022-06-10 15:19:33 +00:00
Kevin Lubick
94f90622eb Manual Dawn Roll
We decided to be ok with an empty version because caching
shader compilations is not that much overhead compared to
the rest of the backends that just have to redo them.

Change-Id: I995b3c75a7e723a1188184f8753450634fa0b629
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/548356
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2022-06-08 18:17:28 +00:00
Kevin Lubick
69a60e6dc0 [includes] Enforce IWYU on several directories
These four directories had IWYU enforced previously and
that enforcement was turned back on:
  - src/sksl/
  - src/utils/
  - src/svg/
  - tools/debugger/

It was discovered that src/sksl/ir had been missed with the
previous IWYU enforcement, so many files needed updating
(see https://skia-review.googlesource.com/c/skia/+/547256).

We do not currently include src/svg/ or tools/debugger/ in
any Bazel builds, so that enforcement has not been tested
with the new system. When we add in builds that use those
packages, we may need to update includes.

Suggested Review order:
 - clang_trampoline_linux.sh to see list expanded
 - bazel/Makefile to see convenient target for testing this
   locally (follow-up CL will have a CI job for this).

Change-Id: Ifef1659ccd1a0e6c862b82102576a06296a6b42e
Bug: skia:12541 skia:13052
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546608
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-06-06 14:29:47 +00:00
Kevin Lubick
590d3cc8f7 [bazel] Re-implement IWYU enforcement
Instead of having a feature that a subpackage cc_library
would set (because the subpackage cc_libraries went away in
review.skia.org/543977), we now have a list of directories
for which all descendent files will have IWYU run on them.

As before, we have an overarching feature "skia_enforce_iwyu"
that enables this check because of the extra compilation
overhead it incurs.

We have decided to enforce IWYU on debug builds instead of
release builds because we have some code (e.g. that in
SkDEBUGCODE or SkASSERT) which is only compiled and executed
in a debug build, but we don't want to have
#if defined(SK_DEBUG)
all over the place. We make the assumption that the includes
needed to compile in debug mode are the superset of the
includes necessary for release and other modes.

Change-Id: I10254fcc162627c20eb89959e06417effa3cc396
Bug: skia:12541 skia:13052
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546607
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-06-06 14:29:47 +00:00
Kevin Lubick
1e5eab37e1 Manually Roll Dawn from 232abaefc35d to c3c3bf538f07 (10 revisions)
https://dawn.googlesource.com/dawn.git/+log/232abaefc35d..c3c3bf538f07

2022-06-03 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll SwiftShader from ee0d0b41a626 to 19e3080dfe86 (8 revisions)
2022-06-03 dsinclair@chromium.org Add parsing of shorter stage attributes.
2022-06-03 enga@chromium.org Rename CachedBlob -> Blob; move to own file
2022-06-03 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll ANGLE from 67a8c19843a1 to bbf67e2e41d8 (4 revisions)
2022-06-02 yunchao.he@intel.com Rename GetMipLevelSize
2022-06-02 shrekshao@google.com Pipeline cache D3D12 backend impl
2022-06-02 bclayton@google.com tint: Add builtin tests for arguments passed by var
2022-06-02 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll SwiftShader from 1bf3ae22a00d to ee0d0b41a626 (1 revision)
2022-06-02 cwallez@chromium.org Remove wgpu::ExternalTextureDescriptor::colorSpace
2022-06-02 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll ANGLE from b03f278925c6 to 67a8c19843a1 (12 revisions)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/dawn-skia-autoroll
Please CC lokokung@google.com on the revert to ensure that a human
is aware of the problem.
Change-Id: I05e3c2c8a4a28ce4501f6639115c5148f9558a12
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546606
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2022-06-03 13:53:38 +00:00
Leandro Lovisolo
6a00ee05ff [gcs_mirror] Add support for URLs ending with ".tgz".
This was necessary to mirror https://binaries.cockroachdb.com/cockroach-v21.1.9.linux-amd64.tgz in https://skia-review.googlesource.com/c/buildbot/+/546543.

Bug: skia:13293
Change-Id: Ib6d5db6864bd82f51321a44d5f15410d37d92ff7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546541
Auto-Submit: Leandro Lovisolo <lovisolo@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2022-06-03 11:51:43 +00:00
Kevin Lubick
455addeff6 [bazel] Add 4 CI jobs, 1 CQ job to test Bazel builds
Needed to fix the Dawn and Harfbuzz Bazel rules.

Change-Id: I21f63c970bdc972b97e42ef85d82d7f478bd45e2
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545721
Reviewed-by: Eric Boren <borenet@google.com>
2022-06-02 12:36:28 +00:00
Kevin Lubick
ee62fad9a4 [bazel] Add "skia_internal" target that exposes private API for tests/tools.
Organization v3.5, if we are keeping track :)

This splits the "srcs" filegroup into "srcs" and "private_hdrs",
and renames "hdrs" to "public_hdrs".

To assist with the split, I created the macro split_srcs_and_hdrs.
Rather than keep two separate lists of header and source files,
I figured it would be easiest, at least for the common case,
to keep one list of files and then have a for loop split them
apart. I've tried to be consistent with having the list
of files be named with a _FILES suffix - maybe we can use this
as a marker to generate .gni files in the future?

Suggested review order:
 - //bazel/macros.bzl. Note this needs a corresponding
   G3 change (http://cl/452279799) as well. The exports_files_legacy
   change is the better approach to something I manually
   handled yesterday when fixing the G3 roll.
 - //BUILD.bazel to see the new target skia_internal and
   the previous skia_core renamed to skia_public.
 - //src/core/BUILD.bazel to see a typical usage of
   split_srcs_and_hdrs.
 - //include/... to see the change to public_hdrs and
   private_hdrs
 - //src/... to see many more usages of split_srcs_and_hdrs
 - //tools/... to see changes to skia_internal where
   appropriate.
 - Everything else. Note that //modules/... might also need
   to be built with skia_internal instead of skia_public,
   but we can fix that up later, if necessary.

Change-Id: Ie1cc969455d97b029b2d77faa222c4a9bad70671
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545716
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2022-06-02 11:23:50 +00:00
Kevin Lubick
61f0ea4f7a [bazel] Move remaining codec build rules to //bazel/external
There are no functional changes to the rules, just a relocation.

Change-Id: I90af5ec792fc54ce2978b0bbb1afd2c932e183b4
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545719
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-06-01 19:12:14 +00:00
Kevin Lubick
3aed21ce0e [bazel] Fix Dawn rules (new generated files)
Corresponding Dawn change: https://dawn-review.googlesource.com/c/dawn/+/90962

Change-Id: Ib9d2163c7874b7fb9fb5ab88de6d96a133c4ecbd
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545718
Reviewed-by: Arman Uguray <armansito@google.com>
2022-06-01 18:02:30 +00:00
Kevin Lubick
97caefd055 [bazel] Move zlib and libpng out of //third_party/BUILD.bazel
I had to copy some config_settings out of //bazel/common_config_settings
because these are now treated as separate entities and cannot
see that file.

For libpng, note that we use a genrule to create the
pnglibconf.h instead of pointing to one somewhere else.
This ended up being easier than other things I tried.

Another approach would be to not depend on the version
in third_party/externals, but to clone it via
new_git_repository [1] and apply a patch that creates
the configuration file.

[1] https://bazel.build/rules/lib/repo/git#new_git_repository

Bug: skia:12541
Change-Id: I9a284775dc0f2bdabb145518d5f0803c74fb99fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545368
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-06-01 12:19:01 +00:00
Kevin Lubick
c123b5a93d [bazel] Add rules for CanvasKit and dependent modules
This may look like a lot, but //modules/canvaskit/BUILD.bazel
is nearly identical to how it was with gazelle:
162dfca340/modules/canvaskit/BUILD.bazel

I removed the "wasm_gm_tests" targets from it, because they
had bitrotted slightly and fixing them is its own task.

CanvasKit depends on Skottie and Particles, which depend on
the SkParagraph, SkShaper, SkUnicode, and SkResources modules.

I've structured the BUILD.bazel files in the //modules directory
in a similar fashion as the "hierarchical filegroup"
introduced in https://skia-review.googlesource.com/c/skia/+/543977

Suggested Review Order
 - //modules/skottie/...
 - //modules/skparagraph/...
 - all other modules.
 - Note that modules/canvaskit/go/gold_test_env/BUILD.bazel is
   generated from gazelle, because we like how gazelle handles
   golang files and deps.
 - All other files in any order.

Change-Id: I0aa9e6f81dba2c00f15cae7b19fe49a2027dcf1d
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/544676
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2022-05-31 14:14:54 +00:00
Kevin Lubick
5810c7ad0b [bazel] Add new rules for various tools
This adds or fixes rules to build three binaries that previously
had Bazel support.

How we build skslc with Bazel differs from GN in a large way:
GN has a small set of C++ files [1] it compiles in, but with
Bazel that was too hard/clumsy to pipe through (and get the
headers to work well). So, I just had skslc depend on
//:skia_core for simplicity. skslc did need to include something
in //src, so I made a special filegroup for it. For more
complex executables that need more headers from //src, we
should probably make a "src_hdrs" filegroup or something
to expose those. That or a skia_for_tests cc_library that
has all headers as "public".

[1] https://github.com/google/skia/blob/main/gn/sksl.gni#L235
Change-Id: Ie1382e982228059369886f4bfef4947f686b11b5
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/544637
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-05-31 14:14:54 +00:00
Kevin Lubick
956704b387 [bazel] Get GPU examples working
This adds targets which test our Dawn, GL, and Vulkan backends.

It follows the hierarchical filegroup pattern, as
outlined in https://skia-review.googlesource.com/c/skia/+/543977

Suggested Review order:
 - tools/sk_app/BUILD.bazel. For many things in tools, I anticipate
   they will depend on //:skia_core and other //tools targets.
   sk_app shows this off, as well how to make the target
   specific to a given platform and pull in the proper native code.
   I'm trying out setting test_only = True, to see if we can
   partition Skia's tests and helpers from the actual Skia library.
 - other changes to //tools/, especially looking at sk_app's
   dependencies.
 - //example/BUILD.bazel. This uses the cc_binary_with_flags which
   existed previously [1] to make it so people don't have to
   specify all the flags for a given binary and can build it as is.
   These targets nows how up in //bazel/Makefile
 - //include/... and //src/..., where some typos from previous
   CLs were fixed and rules expanded.
 - Misc changes to .cpp files to remove unnecessary includes
   that were assuming the GL backend was being compiled in.
 - All other changes

[1] 162dfca340/bazel/cc_binary_with_flags.bzl
Change-Id: Ieacec464d44368cad0da0890c7dc85a6c0b900c9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/544317
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2022-05-31 14:14:54 +00:00
Kevin Lubick
2c65579aad [bazel] Add in hierarchical filegroup Bazel rules.
The primary goal of this organization structure is to keep
our top level BUILD.bazel file short, with as little logic
as feasible. The logic required to control which files to
include, which third_party deps are needed, what system libraries
should be linked again, etc, should be in the BUILD.bazel
file best should be as close to the affected files as feasible.

In essence, we use filegroup() rules to bubble up the files
needed to build Skia (all as one big cc_library call) and
cc_library rules to bubble up the other components needed to build.

For example, //src/ports/SkFontHost_FreeType.cpp needs FreeType,
but only if we are compiling Skia with that type of font
support. With the new organization structure in this CL,
//src/ports/BUILD.bazel should have the logic that determines
if the cpp file should be included in the build of Skia and
if it is, that the Skia build should depend on //third_party:freetype2

Another example is //src/gpu/ganesh/BUILD.bazel, which
chooses which of the dawn, gl, vulkan, etc backend sources,
and the associated dependencies to include in the build.
It does not specify what those are, but delegates to the
BUILD.bazel files in the subdirectories housing the
backend-specific code.

The structure guidelines for BUILD.bazel files are as follows:
 - Have a filegroup() called "hdrs" (for public headers) or
   "srcs" (for private headers and all .cpp files) that is
   visible to the parent directory. This should list the
   files from the containing directory to include in the
   build.
   See //include/core/BUILD.bazel and //src/effects/BUILD.bazel
   as examples.
 - filegroup() rules can list a child directory's "hdrs"
   or "srcs" in their "srcs" attributes, but should not contain
   select statements pertaining to child directory files.
   See //include/gpu/BUILD.bazel and //src/gpu/ganesh/BUILD.bazel
   as examples.
 - May have a cc_library() called "deps". This can specify
   dependencies, cc_opts, and linkopts, but not srcs or hdrs. [1]
   See //src/codec/BUILD.bazel as an example. These should
   be visible to the parent directory.
 - "hdrs", "srcs", and "deps" for the primary Skia build
   (currently called "skia_core") should bubble up through
   //include/BUILD.bazel and //src/BUILD.bazel, one directory
   at a time.

This CL demonstrates a very basic build of Skia with many features
turned off (CPU only, no fonts, no codecs). Follow-on CLs will
add to these rules as more targets are supported. See bazel/Makefile
for the builds that work with just this CL.

Suggested Review Order:
 - //BUILD.bazel to see the very small skia_core rule which
   delegates all the logic down stack. Note that it has a
   dependency on //bazel:defines_from_flags which will set
   all the defines listed there when compiling all the
   .cpp and .h files in skia_core *and* anything that depends
   on skia_core, but *not* //src:deps.
 - //include/BUILD.bazel and other BUILD.bazel files in the
   subdirectories of that folder. Note that the filegroups in
   //include/private/... are called "srcs" to be similar to
   how Bazel wants "private headers" to be in the "srcs" of
   cc_library, cc_binary, etc. and only public headers are
   to be in "hdrs" [2].
 - //src/BUILD.bazel and other BUILD.bazel files in the
   subdirectories of that folder. //src/gpu/ganesh/...
   will be filled in for dawn, vulkan, and GL in the next CL.
 - //PRESUBMIT.py, which adds a check that runs buildifier [3]
   on modified BUILD.bazel files to make sure they stay
   consistently formatted.
 - //bazel/... to see the new option I added to make sksl
   opt-in or opt-out, so one could build Skia with sksl,
   but not with a gpu backend.
 - Misc .h and .cpp files, whose includes were removed if
   unnecessary or #ifdef'd out to make the minimal build
   work without GPU or SkSL includes.
 - //bazel/Makefile to see the builds that work with this CL.

[1] Setting srcs or hdrs is error-prone at best, because those
   files will be compiled with a different set of defines than
   the rest of skia_core, because they wouldn't depend on
   //bazel:defines_from_flags.
[2] https://bazel.build/reference/be/c-cpp#cc_library.hdrs
[3] https://github.com/bazelbuild/buildtools/releases
Change-Id: I5e0e3ae01ad42d672506d5aad1239f2512188191
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/543977
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-05-31 14:14:54 +00:00
Kevin Lubick
4511c7b7fb [bazel] Delete gazelle-based BUILD.bazel files
gazelle ended up being more liability than asset for our C++ rules.

It required devs to manually run the command frequently (and was
easy to forget until the CQ failed). The fact that we still had to
edit the source files (e.g. the "srcs" cc_libraries) meant that
the mixture between generated and hand-written caused some
tension (see include/third_party/vulkan for a good example).

The combination of gazelle and our IWYU enforcement added several
bits of churn without any real benefit. The generated rules
also didn't help identify cases where we were not keeping tight
boundaries (e.g. non-gpu code and gpu code).

Identifying third_party deps automatically ended up being trickier
than anticipated (see the deleted //third_party/file_map_for_bazel.json)

Using the "maximum set of dependencies" worked ok, but ended up
increasing build time unnecessarily. For example, compiling
CanvasKit for WebGL always needed to compile Dawn because
SkSLCompiler.cpp sometimes needs to include tint/tint.h.

Follow-up CLs will rebuild the BUILD.bazel rules without gazelle.

Note to Reviewers:
 - The only file worth manually reviewing here is bazel/Makefile.

Change-Id: I36d6fc3747487fabaf699690780c95f1f6765770
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/543976
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-05-31 14:14:54 +00:00
Kevin Lubick
0582a9e619 [bazel] Document need for --cc_output_directory_tag
Change-Id: Ia47d3a3e9c23b63b1651dc1f638d917b3c302911
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/544636
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Kevin Lubick <kjlubick@google.com>
2022-05-31 12:56:26 +00:00
Ian Prest
72c7c37737 Fix bazel makefile on Windows
The `make -C bazel generate` command doesn't function properly on
Windows builders because Windows uses backslashes as the path separator.

Fortunately, adding quotes around the path is enough to concince
Windows to run the executable, allowing the `generate` target to
complete successfully, and doing so doesn't impact Linux builders.

Bug: skia:13366
Change-Id: I50c461635b70cc59cd6e79bf17a6945c80df1986
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/544756
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-05-31 12:20:41 +00:00
Kevin Lubick
27d842a14c Manual roll of dawn
Change-Id: Ic6c4e6d4cec11c7ea0053d260f5022b6978ace4a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/544396
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
2022-05-26 18:09:26 +00:00
Tyler Denniston
d78d52a86f Revert "Add Perfetto library (gn & bazel) and bare-bones SkPerfTrace class"
This reverts commit bfc9b94840.

Reason for revert: new dependency causing Android build error

Original change's description:
> Add Perfetto library (gn & bazel) and bare-bones SkPerfTrace class
>
> First incremental step to incorporating Perfetto tracing into Skia, more CLs to follow
>
> NOTE: The presubmit check is failing. This appears to be due to the known issue where the presubmit check bugs out if the DEPS file is edited, which it was on this CL (modified to include Perfetto).
>
> Bug: skia:13303
> Change-Id: I908be0392b520e8da14b34588b842bf6d955bd93
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/543081
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Nicolette Prevost <nicolettep@google.com>

Bug: skia:13303
Change-Id: Ia2b883bbab1f8fb4f3914b63104a39240cc60e86
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/544239
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Auto-Submit: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Nicolette Prevost <nicolettep@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2022-05-26 16:21:27 +00:00
Nicolette Prevost
bfc9b94840 Add Perfetto library (gn & bazel) and bare-bones SkPerfTrace class
First incremental step to incorporating Perfetto tracing into Skia, more CLs to follow

NOTE: The presubmit check is failing. This appears to be due to the known issue where the presubmit check bugs out if the DEPS file is edited, which it was on this CL (modified to include Perfetto).

Bug: skia:13303
Change-Id: I908be0392b520e8da14b34588b842bf6d955bd93
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/543081
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Nicolette Prevost <nicolettep@google.com>
2022-05-25 14:50:57 +00:00
Michael Ludwig
230c535dfe Manual dawn roll
Change-Id: Ib4f2ae63ceee424eb93d098c7cd65e6ea8ac92f7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/543056
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2022-05-23 16:22:20 +00:00
Brian Salomon
6ba1e8dd95 Manual Dawn roll from 34d2d1ba0273 to 4bdded68d58d (34 revisions)
https://dawn.googlesource.com/dawn.git/+log/34d2d1ba0273..4bdded68d58d

2022-05-19 zhaoming.jiang@intel.com Dawn: vertex buffer never OOB with zero stride count draw/Indexed
2022-05-19 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll ANGLE from 4dc9c79e0cf7 to d3eb61d4a054 (15 revisions)
2022-05-18 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll SwiftShader from 89eb09307fbc to 2933d3126969 (2 revisions)
2022-05-18 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll vulkan-deps from b190c10e0804 to b0e4ff85c2aa (4 revisions)
2022-05-18 bclayton@google.com tint: Refactor Extensions / Enables.
2022-05-18 bclayton@google.com tint: Implement abstract-numeric overload resolution
2022-05-18 amaiorano@google.com tint: Fix use-after-free
2022-05-18 bclayton@google.com tint: intrinsics.def Support [[precedence]] decoration
2022-05-18 cwallez@chromium.org Temporarily mark requestDevice_limits as failing.
2022-05-18 cwallez@chromium.org Directly enable -Wglobal-constructors
2022-05-18 amaiorano@google.com tint: Validate that sampled texture type must be f32, i32, or u32
2022-05-18 enga@chromium.org Fix multiple device leaks in dawn_end2end_tests and dawn_unittests
2022-05-18 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll ANGLE from 93c0c90db873 to 4dc9c79e0cf7 (4 revisions)
2022-05-18 cwallez@chromium.org Remove expectations for passing WebGPU CTS tests
2022-05-18 bclayton@google.com expectations.txt: Remove rules for passing tests
2022-05-18 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll vulkan-deps from 5d184f5765ff to b190c10e0804 (3 revisions)
2022-05-18 bclayton@google.com tint: Add sem::Type::ConversionRank()
2022-05-18 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll SwiftShader from 80de201a2a13 to 89eb09307fbc (2 revisions)
2022-05-17 bclayton@google.com tint: IntrinsicTable: Rename open/closed -> template
2022-05-17 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll ANGLE from 807c94ea85e0 to 93c0c90db873 (7 revisions)
2022-05-17 bclayton@google.com tint: Simplify sem::Constant::Scalar
2022-05-17 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll vulkan-deps from c37d1e2ab98c to 5d184f5765ff (4 revisions)
2022-05-17 bclayton@google.com tint: Cleanup of IntrinsicTable
2022-05-17 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll SwiftShader from 4011ab35f3d8 to 80de201a2a13 (1 revision)
2022-05-17 amaiorano@google.com gitignore /build-*
2022-05-17 amaiorano@google.com tint: limit expression depth to avoid stack overflow in backends
2022-05-17 cwallez@chromium.org Roll third_party/webgpu-cts/ bf5409992..e518bfe8a (3 commits)
2022-05-17 bclayton@google.com Kokoro: Log disk utilization in status message
2022-05-17 cwallez@chromium.org Only checkout our own clang-tidy if in standalone builds
2022-05-17 jrprice@google.com tint: Fix edge for CallSiteRequiredToBeUniform
2022-05-17 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll ANGLE from 36f5e6ce5508 to 807c94ea85e0 (6 revisions)
2022-05-17 kainino@chromium.org Reland "[chromium-style] Adding constructors and destructors."
2022-05-17 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll vulkan-deps from b5c0eec3336c to c37d1e2ab98c (1 revision)
2022-05-17 kainino@chromium.org Enable -Wglobal-constructors for dawn/native

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/dawn-skia-autoroll
Please CC cwallez@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Dawn: https://bugs.chromium.org/p/dawn/issues/entry
To file a bug in Skia: https://bugs.chromium.org/p/skia/issues/entry

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Cq-Include-Trybots: skia/skia.primary:Build-Debian10-Clang-x86_64-Debug-Dawn
Bug: None
Change-Id: If19992616124865e608440fbb37cfd37fb58af75
Tbr: cwallez@google.com
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/542143
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2022-05-19 20:56:01 +00:00
Brian Salomon
54190a59b3 Manual Dawn roll from ab9757036bd6 to 34d2d1ba0273
https://dawn.googlesource.com/dawn.git/+log/ab9757036bd6..34d2d1ba0273

Change-Id: I887b36df9383c4b2da8bf17e61d775eecefbb84e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541738
Commit-Queue: Arman Uguray <armansito@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Arman Uguray <armansito@google.com>
2022-05-18 17:07:32 +00:00
Arman Uguray
c1504658a7 [sksl][wgsl] Enable WGSL validation using Tint
- Introduced the SK_ENABLE_WGSL_VALIDATION macro which is currently only
  enabled when skslc gets compiled when using the `skia_compile_sksl_tests`
  setting.
- SkSLCompiler::toWGSL now validates its output using Tint's WGSL reader
  structures based on conditionally compiled code depending on the
  SK_ENABLE_WGSL_VALIDATION flag.
- Fixed `warning: use of deprecated language feature: struct members should be separated with commas"
  warnings that were generated for HelloWorld.wgsl.

Bug: skia:13092
Change-Id: Ib894457030004966221faf82f61360e390b95e22
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/537802
Commit-Queue: Arman Uguray <armansito@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2022-05-17 18:25:01 +00:00
Kevin Lubick
16fa353926 [bazel] Move third party BUILD.bazel files to bazel/external
See also http://cl/449188526

Change-Id: Idb775cd955c82f16c79a61bb3d417c2c92f88a88
Bug: skia:12541, skia:13323
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541217
Reviewed-by: Ravi Mistry <rmistry@google.com>
2022-05-17 12:13:49 +00:00
Kevin Lubick
c4abee5e38 Revert "[bazel] Run gazelle only on the files that changed"
This reverts commit 5c6bf4f692.

Reason for revert: git diff does not work well with deleted files

Original change's description:
> [bazel] Run gazelle only on the files that changed
>
> With this change, make generate takes 1.8 seconds instead of
> 7.9 seconds.
>
> We still have generate_force to run on everything.
>
> Change-Id: I6d57031adbe38a7f25a59570baea89970eea024f
> Bug: skia:12541
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/540740
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>

Bug: skia:12541
Change-Id: I47c23adf09bbc6324817e166f7ab33eb16f4bf61
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/540743
Reviewed-by: John Stiles <johnstiles@google.com>
2022-05-16 15:41:39 +00:00
Kevin Lubick
5c6bf4f692 [bazel] Run gazelle only on the files that changed
With this change, make generate takes 1.8 seconds instead of
7.9 seconds.

We still have generate_force to run on everything.

Change-Id: I6d57031adbe38a7f25a59570baea89970eea024f
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/540740
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2022-05-16 14:18:20 +00:00
Kevin Lubick
24f0b884c0 [bazel] Move Dawn BUILD.bazel to third_party/bazel
Rather than having a monolithic third_party/BUILD.bazel, this moves
our Dawn rules to their own subdirectory and makes it callable via
@dawn instead of //third_party/dawn.

This will help with the G3 roll and make our rules more organized in
general.

This also rolls Dawn
Roll Dawn from ab9757036bd6 to e831fb61046b (22 revisions)

https://dawn.googlesource.com/dawn.git/+log/ab9757036bd6..e831fb61046b

Suggested Review Order:
 - WORKSPACE.bazel, where we define @dawn and its deps
   (@vulkan_headers and @vulkan_tools). I initially thought
   I needed to define all of Dawn's deps in the workspace_file_content
   for new_local_repository, but that WORKSPACE file is
   ignored when building Skia rules.
 - third_party/dawn/BUILD.bazel, the contents of which were copied
   from //third_party/BUILD.bazel and modified largely via
   find-and-replace to point to files relative to
   //third_party/externals/dawn. One exception is the cpu_wasm
   config_setting because @dawn isn't able to see Skia's
   //bazel/macros.bzl.
 - All other files

Change-Id: Ib2d7bc972ef00b6b68370ce5c2839ffb70ed9a2f
Bug: skia:12541, skia:13211
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/538638
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-05-16 14:06:59 +00:00
Kevin Lubick
3413ca474b [infra] Add BazelBuild task to build CanvasKit on the CI with Bazel
For additional context, see "Codifying Certain Build Options"
and "Building on the CI" in the design doc go/skia-bazel

Suggested review order:
 - builder_name_schema.json to see the three required and
   one optional part of BazelBuild jobs.
 - jobs.json to see one new BazelBuild job added. In an
   ideal world, this job would have been named
   BazelBuild-//modules/canvaskit:canvaskit_wasm-debug-linux_x64
   but Buildbucket (?) requires jobs match the regex
   ^[a-zA-Z0-9\\-_.\\(\\) ]{1,128}$
   so we use spaces instead of slashes or colons.
 - gen_tasks_logic.go; noting the makeBazelLabel function
   expands most of the spaces to / and the last one to a
   colon to make a single-target label. If there are three
   dots, then it is a multi-target label, and we do not
   need to add a colon.
 - bazel_build.go; This is a very simple task driver, and
   I do not anticipate getting too much more complex.
   The place where we decide which args to augment
   a build with depend on the host platform and thus
   should be set in gen_tasks_logic.go.
 - bazel/buildrc to see some initial configurations set,
   one of which, "debug", is used by the new job.
   The "release" version of CanvasKit probably works on
   3.1.10 which had a bugfix, but we are still on
   3.1.9
 - .bazelrc to see a rename of the linux-rbe config to
   linux_rbe (our configs should have no dashes if
   we want to specify them verbatim in our Job names).
   It also imports the Skia-specified build configs
   from //bazel/buildrc and supports the user-specified
   //bazel/user/buildrc file if it exists.
 - All other files in any order.

Change-Id: Ib954dd6045100eadcbbf4ffee0888f6fbce65fa7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/537797
Reviewed-by: Eric Boren <borenet@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
2022-05-06 17:54:08 +00:00
Brian Osman
38d4fdebbb Remove all CommandBuffer support code
Bug: skia:13040
Change-Id: I1749f21162ea400a8b8fb00ed52e6024eb658d52
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/537082
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-05-04 20:19:17 +00:00
Kevin Lubick
c2f47190c1 [bazel] Add location for G3 define
Change-Id: I7811e0e70e4959be8caa1cab9e4f1fa3421d72d1
Bug: skia:13211
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/536596
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
2022-05-03 14:22:33 +00:00
Kevin Lubick
46eaab3959 [bazel] Add shims to help translation into G3
Ran the following commands:
find -name "BUILD.bazel" -exec sed -i -e '1iload("//bazel:macros.bzl", "cc_library", "exports_files_legacy")\nexports_files_legacy()' {} +
buildifier --lint=fix --mode=fix -r .

This had the effect of making sure we can export all of our
files in G3 (until we no longer have legacy targets) and
making all of our cc_libraries shim-able.

bazel/macros.bzl has the human-contributed changes, the rest
were mechanical.

Change-Id: I8e24e30e74b038cfd072cdbe4078bfd1d213dd46
Bug: skia:13211
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/535359
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-04-29 19:27:54 +00:00
Kevin Lubick
88c15aeb94 [includes] Enforce IWYU on //example
Change-Id: I26136f1a3960eafd6e48c733c16ca35d20534df6
Bug: skia:13052
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/535395
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-04-29 15:39:33 +00:00
Kevin Lubick
0b6cef82dc [bazel] Point to vk_mem_alloc from DEPS
To make it easier to use the G3 version of this dep,
we make a reference to it in the WORKSPACE.bazel, so
we can refer to this external dep with the @ notation.

I would like to do this for all of our third party
deps, but one at a time.

Change-Id: I03e0beca124225e0faf1232278dae641da8a3e4d
Bug: skia:13240, skia:13211
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/535358
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2022-04-29 12:45:56 +00:00