Commit Graph

3142 Commits

Author SHA1 Message Date
John Stiles
bd472a01ed Move runtime-effect dictionary into Graphite ResourceProvider.
Putting the dictionary in the Recorder itself was not very useful; the
recorder is inaccessible throughout the call chain of pipeline setup.
The ResourceProvider, on the other hand, is accessible everywhere we
need it, hangs directly off the Recorder, and has the right lifetime
for our purposes.

Change-Id: I0f494e5890845d73343a71359900598d63b66764
Bug: skia:13405
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/556917
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2022-07-08 20:29:38 +00:00
Aditya Kushwah
cb44bf6246 Label external texture.
Pass an optional label parameter to GrBackendTexture and pass
it to MakeWrapped of GrGLTexture because almost all textures
that are coming clients are things where the client owns the
gl texture and passes it into Skia as a wrapped texture via a
GrBackendTexture.

Bug: chromium:1164111
Change-Id: I4bfddda956c72b53d0070595ef3268ee1a2b747f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/555597
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-07-07 19:20:59 +00:00
Greg Daniel
bf65800589 [Graphite] Store Task Graph on Recording.
Bug: skia:13357
Change-Id: Ib2566e9c38f667368b20f18ed2b1851615602cad
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/548480
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-06-29 20:42:49 +00:00
Robert Phillips
c0cd71d4fd [graphite] Add compile guards to precompile system (take 2)
Bug: skia:13430
Change-Id: I64d6049fec8cc942a8f7c56c01ba292cc8f3835c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554378
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2022-06-29 19:37:15 +00:00
Kevin Lubick
187340c89e Revert "[graphite] Add compile guards to precompile system"
This reverts commit 1da712adda.

Reason for revert: Breaking G3

Original change's description:
> [graphite] Add compile guards to precompile system
>
> Bug: skia:13430
> Change-Id: I6c577b459bc3a699e6c660d21d2b119643fe1f88
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553877
> Reviewed-by: Eric Boren <borenet@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

Bug: skia:13430
Change-Id: I2fd518c9b7950e362e8c27cc74811f840887c7fa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554377
Owners-Override: Kevin Lubick <kjlubick@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-06-29 14:58:21 +00:00
Robert Phillips
1da712adda [graphite] Add compile guards to precompile system
Bug: skia:13430
Change-Id: I6c577b459bc3a699e6c660d21d2b119643fe1f88
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553877
Reviewed-by: Eric Boren <borenet@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-06-29 13:48:45 +00:00
John Stiles
2b7f32a725 Add map from code-snippet ID to runtime-effect in Recorder.
This will keep the runtime effect alive and findable until we are ready
to paint it.

Change-Id: If047dfa8be1376a7a2a092211e0cbbdedfd2faf0
Bug: skia:13405
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553579
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-06-28 21:13:29 +00:00
Greg Daniel
8133080b5c [Graphite] Add a ResourceProvider onto the Context.
The Context is going to have to be able to make some Resources when we
insert a recording onto it. Some examples of this will be discardable
MSAA and Stencil attachments that are shared by all Recordings.

Bug: skia:13357
Change-Id: I9d49f640404176d38416372fd208b591b032d599
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553581
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-06-28 19:16:55 +00:00
Greg Daniel
ab286e8531 [Graphite] Add QueueManager Class.
This CL is mostly moving the queue/command buffer systems off of Gpu and
Context and moving them to the QueueManagerClass.

Bug: skia:13357
Change-Id: I0ee5096c84b1210082745fafd2d38791fd9be52e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549557
Reviewed-by: James Godfrey-Kittle <jamesgk@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-06-28 19:10:19 +00:00
Jim Van Verth
45a6f2c986 [graphite] Set up ContextOptions for text
Bug: skia:13118
Change-Id: I90aee8cff625ad822fa9d62f803a8badbe51925e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/552676
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2022-06-27 16:57:43 +00:00
Brian Salomon
00bead8e63 Add glCopyBufferSubData to GrGLInterface
Will be used in SkMesh buffer update API and likely for unit testing of changes related to Issue 13427.

Bug: skia:13427
Bug: skia:12720

Change-Id: I487ee512d4b8bb61c533c7047bdbffcde9779885
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549570
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2022-06-16 18:12:23 +00:00
John Stiles
a444743005 Remove SK_MAYBE_UNUSED.
[[maybe_unused]] is built in to C++17.

Change-Id: I5e49d0801878fd9fbca62ab28080aa856e33ca79
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/550500
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2022-06-16 16:52:53 +00:00
Jim Van Verth
8e96c9db78 [graphite] Hook in more of the text drawing interface
Bug: skia:13118
Change-Id: Icaf2b0914ce7943f57e1ab23e7778d1dcb811cc4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/548781
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-06-14 15:55:11 +00:00
Jim Van Verth
56e6286317 [graphite] Add ContextOptions
Bug: skia:13118
Change-Id: I0d6e0a9f542680456d3de82a32376722c5b9cd1d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549097
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-06-14 15:39:21 +00:00
Jim Van Verth
265b53bc76 [graphite] Add DrawAtlas and AtlasManager
Bug: skia:13118
Change-Id: I06d3f899b60ac2cf8d48a46da6097a15c5d40024
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/543923
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2022-06-14 12:54:20 +00:00
Robert Phillips
c42960d4f2 [graphite] Split out CombinationBuilder tests
Bug: skia:12701
Change-Id: Ibf7b4ac280eb853e3f5d786bd188ae0ac208609b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545367
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-06-03 20:06:44 +00:00
Robert Phillips
6e0a205f80 [graphite] Expand capabilities of SkCombinationsBuilder
This CL adds the ability to add child combinations to the top-level
combinations added to the builder.

Bug: skia:12701
Change-Id: Ibe182c631bb9811d82e314ba58823b1708058165
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/542299
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-06-03 13:29:50 +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
8d69d04579 [bazel] Add fixes for G3
Mostly, this adds placeholder BUILD.bazel files corresponding to files
used in public.bzl

The exception is src/ports/BUILD.bazel, which adds an explicit
link command for dl, needed for dlopen etc.

Bug: skia:12541
Change-Id: Id3801a4c718cec37bc2aa3920a8d810f8a80a373
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545359
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-05-31 19:50:47 +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
Jim Van Verth
a25aeff052 Move GrTextBlobRedrawCoordinator to sktext:gpu namespace.
Also makes SDFMaskFilter available.

Bug: skia:13118
Change-Id: I27ca3ed85a057267387841be5dad10d8e6c7f7bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/543079
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2022-05-24 15:36:34 +00:00
Robert Phillips
dfabbfc0e3 [graphite] Add SkCombinationBuilder.h
This is cleanup left over from a prior CL's review. We will want to
use the combination builder outside of graphite.

This CL is mainly just moving stuff around except for the addition
of the SkCombinationBuilder.buildCombinations method and CreateKey
more accessible outside of Graphite.

Bug: skia:12701
Change-Id: If2cae6fcff5670e488bc14473b7b1d2f9b1fecd7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/543196
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-05-23 20:26:17 +00:00
Jim Van Verth
e55e01640b [graphite] Move Slug to gpu shared
Bug: skia:13118
Change-Id: Id4afcfeeb9a5b44a0e2cb24b70c76a81ec5daaea
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/542300
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-05-20 19:42:03 +00:00
Robert Phillips
b2e3f57866 [graphite] Pull the ShaderType enum out of the ShaderCombo
The ShaderType enum seems like it will persist while the ShaderCombo will not.

Bug: skia:12701
Change-Id: Idf9ed89a50bac46b93a81da3e814207c83b3a1ea
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541723
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2022-05-20 14:48:11 +00:00
Robert Phillips
16f1505498 [graphite] Remove DepthStencilOnly handling
I believe this was only needed during the sprint, before we had
RenderSteps.

Bug: skia:12701
Change-Id: I4945fc69f9c1cd419b8c3143b6638e4769761ff9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541976
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2022-05-19 15:16:37 +00:00
Robert Phillips
dce2889681 [graphite] Add a CombinationBuilder
This also makes the PaintCombinations object opaque to the user.

The eventual goal is to have all the bits of the combination allocated
in the builder's arena.

Bug: skia:12701
Change-Id: I9de8ab1fb6a340cee84c2bd437ddd9b0aa3ed6ea
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541222
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-05-19 14:28:59 +00:00
Brian Osman
b7d4cebf08 Make GrCaps and graphite::Caps derive from SkCapabilities
Move allocation of Caps::fShaderCaps to the base class,
and add a finishInitialization method, like GrCaps.

Change-Id: I5353a03afea29390be3cce1fb371374532f5af3c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541073
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2022-05-18 20:25:25 +00:00
Robert Phillips
6b0e8256aa [graphite] Begin mutating PaintCombo to be more encapsulated
The end goal for the PaintCombo is that it is opaque to the user and
generated via a CombinationBuilder object.

Bug: skia:12701
Change-Id: I0ca6fb52207e85c444f2ddbcb43f7cf90bcafb34
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/540746
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-05-18 15:39:19 +00:00
Robert Phillips
cb3009126d [graphite] Add entry point for registering SkBlenders w/ the Context
This just adds the API. Additional work will be required to actually
create an SkShaderSnippet for the runtime effect.

The SkBlenderID will be used in the combination system to specify the
Blender runtime effect as a combination candidate.

Bug: skia:12701
Change-Id: I524a2fa7a00ece6d9422891bcbc82ce0237679e3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/540170
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-05-17 19:34:15 +00:00
Brian Osman
3cbb13a93b Reland "Add SkCapabilities object"
This is a reland of commit 69fecd6c2d

Original change's description:
> Add SkCapabilities object
>
> This describes the capabilities of a particular Skia rendering context
> (GPU context, or the CPU backend). At the moment, it only contains the
> supported SkSL version (with a new enum added to specify the current
> value as "100" and a new ES3 value as "300".
>
> SkCapabilities can not be retrieved from an SkCanvas - the client must
> have a concrete way of knowing what their destination device that will
> do the actual rendering is (GrCaps or SkSurface).
>
> This CL doesn't make use of the SkCapabilities yet, that's coming in
> follow-up CLs that alter the SkSL compiler and SkRuntimeEffect API.
>
> Bug: skia:11209
> Change-Id: I4e9fd21ff7ffd79f1926c5c2eb34e10b3af4bc9b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/537876
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>

Bug: skia:11209
Change-Id: If76343a8a536ade25f6b3d80e0885c7bc47d2adf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/540919
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-05-17 13:15:06 +00:00
Brian Osman
88a51fea63 Revert "Add SkCapabilities object"
This reverts commit 69fecd6c2d.

Reason for revert: Why do we even bother separating include from src?

Original change's description:
> Add SkCapabilities object
>
> This describes the capabilities of a particular Skia rendering context
> (GPU context, or the CPU backend). At the moment, it only contains the
> supported SkSL version (with a new enum added to specify the current
> value as "100" and a new ES3 value as "300".
>
> SkCapabilities can not be retrieved from an SkCanvas - the client must
> have a concrete way of knowing what their destination device that will
> do the actual rendering is (GrCaps or SkSurface).
>
> This CL doesn't make use of the SkCapabilities yet, that's coming in
> follow-up CLs that alter the SkSL compiler and SkRuntimeEffect API.
>
> Bug: skia:11209
> Change-Id: I4e9fd21ff7ffd79f1926c5c2eb34e10b3af4bc9b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/537876
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>

Bug: skia:11209
Change-Id: I3bc843b0abf154dbaecb209b251f80741757bf70
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/540858
Commit-Queue: Brian Osman <brianosman@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-05-16 16:32:03 +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
Brian Osman
69fecd6c2d Add SkCapabilities object
This describes the capabilities of a particular Skia rendering context
(GPU context, or the CPU backend). At the moment, it only contains the
supported SkSL version (with a new enum added to specify the current
value as "100" and a new ES3 value as "300".

SkCapabilities can not be retrieved from an SkCanvas - the client must
have a concrete way of knowing what their destination device that will
do the actual rendering is (GrCaps or SkSurface).

This CL doesn't make use of the SkCapabilities yet, that's coming in
follow-up CLs that alter the SkSL compiler and SkRuntimeEffect API.

Bug: skia:11209
Change-Id: I4e9fd21ff7ffd79f1926c5c2eb34e10b3af4bc9b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/537876
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2022-05-13 16:31:20 +00:00
Robert Phillips
5a56530bf4 Handle allocation failure in the flush-time preFlush callback
In general, we drop the entire flush when we detect an allocation
failure. This CL makes an allocation failure in the flush-time preFlush
call also drop the entire flush.

Bug: 1320964
Change-Id: Idd2e24fbf5d2083c4fec8de7ccd028897a239b33
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/536837
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-05-05 20:30:59 +00:00
Jim Van Verth
35e1ca4b3b Move more GPU text classes to sktext::gpu namespace.
Moves GlyphVector, TextStrike, StrikeCache, and SubRunAllocator.

Bug: skia:13118
Change-Id: Ifa4957b5cff280f44606dc62bfd30f6a03063c07
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/536102
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-05-05 16:10:24 +00:00
Brian Salomon
f327ef899d Fixup GrDriverBugWorkaroundsAutogen.h
Bug: chromium:1319451
Change-Id: Ibd0187c4d80fa64f2d9eb3aa61da04857ecb9db9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/536836
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2022-05-03 20:20:26 +00:00
Kevin Lubick
c3a448ec61 [bazel] Put licenses() after legacy_exports
G3 prefers license() first.

This was done mechanically with a big find/replace

Change-Id: I8c33c7bc10a6bec42e966cad81c259954e841811
Bug: skia:13211
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/535898
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-05-02 15:04: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
James Godfrey-Kittle
f9c89a443d [graphite] Add UploadBufferManager class.
This class manages and suballocates buffers used to upload textures. It
maintains a reusable, suballocated buffer for small allocations, and
creates dedicated buffers for any allocation larger than its set
reusable buffer size.

Change-Id: If7877faed870afbc85635ae47553000fa3487aba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/534941
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: James Godfrey-Kittle <jamesgk@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2022-04-28 20:59:14 +00:00
Michael Ludwig
a6eaac0595 Disable experimental HW tessellation
This should make it so the HW tessellation path renderers are never
used; it will always select the atlas or direct fixed-count renderers
instead. This CL will give us a good indication of what visual diffs
to expect, layout tests to rebase, and any performance regressions.

If those are acceptable, then we can proceed with the rest of the code
removal.

Bug: skia:13263
Change-Id: I273bb231461932047768c1c7233ae4291483bc95
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/533810
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2022-04-27 13:34:09 +00:00
Brian Salomon
2386d3e7d6 mipMapped -> mipmapped
Change-Id: Ib9d4e23159724825dacb7d37ceabfd2aff68f58a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/530681
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-04-18 14:26:19 +00:00
Greg Daniel
bd73e796d7 [graphite] Enable MSAA.
Bug: skia:13212
Change-Id: I8fc8bcd01181fcfb9955119984afa4bfbb1f73e5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529756
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-04-15 17:03:51 +00:00
Kevin Lubick
83cee23c98 [bazel] Run buildifier on BUILD.bazel files
buildifier --lint=fix -r .

Change-Id: I6a41858270d20137978f8271c8f6160b51120777
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529751
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-04-14 18:13:43 +00:00
Kevin Lubick
b98328a27b [bazel] Add license to all our BUILD.bazel files
find -name "BUILD.bazel" -exec sed -i -e '1i licenses(["notice"])\n' {} +

Change-Id: Ie48f163b7d8d6ede9ba5f952e87232dd5c9fa8e6
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529808
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-04-13 19:50:29 +00:00
Robert Phillips
59ba27bc6a Move Ganesh specific headers into include/private/gpu/ganesh
Change-Id: Ia799cdff5288efe5d5d53e8d8f77cf32f3343371
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529131
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-04-12 17:30:07 +00:00
Robert Phillips
cd692a6bb0 [graphite] Finally, allocate uniform data in an arena
Bug: skia:12701
Change-Id: Ib02db7160599d3c15a01597c746ce5131f2998e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/526298
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-04-11 19:17:20 +00:00
Jim Van Verth
42f710f3fa Reland "[graphite] Move Graphite into Skia base directories."
This is a reland of commit ae5e846047

Original change's description:
> [graphite] Move Graphite into Skia base directories.
>
> Change-Id: Ie0fb74f3766a8b33387c145bd1151344c25808cb
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528708
> Reviewed-by: Kevin Lubick <kjlubick@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

Change-Id: Ia575fd49206ad0b665a6a9153317e738bb321446
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529059
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-04-11 18:37:20 +00:00
Jim Van Verth
ab4d4ae9e2 Revert "[graphite] Move Graphite into Skia base directories."
This reverts commit ae5e846047.

Reason for revert: Breaking Google3

Original change's description:
> [graphite] Move Graphite into Skia base directories.
>
> Change-Id: Ie0fb74f3766a8b33387c145bd1151344c25808cb
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528708
> Reviewed-by: Kevin Lubick <kjlubick@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

Change-Id: Ia57992a22c42b17216b40fd29452865f957fb802
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528653
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-04-09 01:02:26 +00:00