Commit Graph

11734 Commits

Author SHA1 Message Date
John Stiles
3dc829746a Eliminate vtable from DSLVar class hierarchy.
The only usage of `virtual` was the `storage()` method. This value is
now stored in a member variable. It is packed next to a bool so it
should be ~zero extra space, versus 8 bytes for a vtable pointer. We
also save cost of a virtual dtor call every time a DSLVar goes away.

Because VariableStorage is not a public type, this required shuffling
some constructors around to live in the cpp instead of the header.

Change-Id: I9fdefc3696d123848fb567029c051b478349cec7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/542139
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-05-19 19:57:19 +00:00
Michael Ludwig
9b59fe655c Convert color data to skvx::float4 from Sk4f
Change-Id: I511f6105537b24953de1533ad7b73d1186afd4fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541060
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2022-05-19 19:45:23 +00:00
Brian Osman
14194828eb Remove SkSL portions of SkCapabilities when SkSL is not enabled
Also fix various compile issues if you try to compile w/o SkSL.

Change-Id: I9a5a176254184a04f4c8af93a8dca958c8c69fee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/542142
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-05-19 19:32:48 +00:00
John Stiles
5fa8655f67 Simplify DSLVar assignment.
It can live in the base class instead of having matching implementations
in each subclass. Also, there didn't seem to be a reason to have a
templated and non-templated version which did the same thing.

Change-Id: I312af9e71561d847580430000fbfae6fa99fe837
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/542140
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2022-05-19 19:03:17 +00:00
John Stiles
a6178be7d1 Require DSL variables to have names.
The DSLVar class hierarchy had many constructor variations to support
the idea of creating DSL variables without explicitly assigning a name
to them. Instead, name-mangling would automatically assign them a name
like `_123_var`. This was designed to make it easlier to write a
complete shader in DSL.

We no longer have DSL name-mangling, or intend to create complete
programs in pure DSL. In the absence of name-mangling, these
constructors aren't useful (every variable would be named `var`).
They have been removed.

Change-Id: If533e479cc04c5a6ced9a7e880dcc56063f29374
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/542138
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2022-05-19 16:57:29 +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
John Stiles
effd0aeccd Reland "Remove DSLWrapper helper class."
This reverts commit 37c03c8d73.

Reason for revert: using vector<> to avoid skia:13339

Original change's description:
> Revert "Remove DSLWrapper helper class."
>
> This reverts commit 3b4f862d05.
>
> Reason for revert: might have caused chromium:1326848
>
> Original change's description:
> > Remove DSLWrapper helper class.
> >
> > Without an `operator=` on our expressions and variables, we no longer
> > need to wrap all our expressions with a helper.
> >
> > Change-Id: I8110079f61c9ad01997f7c4b376db223dc4b6e17
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541063
> > Commit-Queue: John Stiles <johnstiles@google.com>
> > Auto-Submit: John Stiles <johnstiles@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
>
> Change-Id: I7efb3004913f7c85dc551d9740a6b31971de52d2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541736
> Auto-Submit: John Stiles <johnstiles@google.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>

Change-Id: If6dd5d3187a4623ae732335b8215f4350e45cd2b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/542137
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2022-05-19 14:49:56 +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
John Stiles
8ad9c82d30 Remove VarUniformHandle DSL method.
This was only used by DSL fragment processors and is unreferenced.
This removal causes the uniform-handle value in DSLVarBase to become
unreferenced as well.

Change-Id: Ifc89a3dda93f08c40341f654981bbb6593d4fb9f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541745
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-05-19 13:14:42 +00:00
John Stiles
8366527b9b Reland "Remove operator= from DSL expression types."
This reverts commit 4b354dfb5b.

Reason for revert: not responsible for chromium:1326848

Original change's description:
> Revert "Remove operator= from DSL expression types."
>
> This reverts commit b143520625.
>
> Reason for revert: might have caused chromium:1326848
>
> Original change's description:
> > Remove operator= from DSL expression types.
> >
> > This means that in raw DSL code, `foo = bar` will need to be written as
> > `foo.assign(bar)`. This is admittedly slightly less convenient. However,
> > in practice, raw DSL code is very rare, and in fact we only had one
> > use-case for operator= across all of our code. This change will allow us
> > to simplify the DSL parser by eliminating the `DSLWrapper` helper class,
> > which was only needed because we overloaded `operator=`.
> >
> > Change-Id: I4fbc39b2c1443fc26a761d424c52e3b9b59169eb
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541062
> > Commit-Queue: John Stiles <johnstiles@google.com>
> > Auto-Submit: John Stiles <johnstiles@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
>
> Change-Id: I7c7e032c465aba004ba78fd69650c8037e019861
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541737
> Auto-Submit: John Stiles <johnstiles@google.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>

Change-Id: I0814f87e360b5574d4a06764bbfa747c49820774
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/542136
Commit-Queue: John Stiles <johnstiles@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-05-19 13:05:55 +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
John Stiles
e76f507164 Remove variable-declared flags from DSLVarBase.
The DSLVarBase `fDeclared` field was used to track whether a variable
was created with `Var`, but never declared with a matching `Declare`, in
a hand-authored DSL program. This was expected to be a common source of
slip-ups in hand-authored DSL, so we tracked it and printed a handy
error message if `Declare` was ever missing. However, this complicated
testing, because in tiny test snippets we _do_ want the ability to
create variables without necessarily declaring them. So, we had a
separate program setting to disable enforcement for test code.

For programs created in DSLParser, tracking this state is unnecessary;
the parser won't ever forget to declare variables.

Since hand-authored DSL programs are no longer expected to be
commonplace, we can remove the state tracking and the associated
ProgramSettings field entirely.

Change-Id: I32b28f8a2ca6591d3da80cd974fff8101f5a4be8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541638
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-05-18 15:54:42 +00:00
John Stiles
d35e9151bc Remove automatic name mangling from DSL.
This feature is always disabled when DSLParser is used. Name mangling
was only useful when compiling hand-authored DSL code that explicitly
declared two variables with the same name in separate scopes. In
practice, as long as we aren't declaring complete programs in DSL form,
we don't need this.

Change-Id: Icad921eb86365b3b114ff1872b1c40c41470a4b4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541637
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2022-05-18 15:54:42 +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
John Stiles
91e4c7847e Remove C++14 workaround code.
We no longer support compiling in C++14, so we don't need these
workarounds anymore.

Change-Id: Idec5a90e98c242928182f4b32dd47459be8ca47f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541075
Reviewed-by: Arman Uguray <armansito@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Arman Uguray <armansito@google.com>
2022-05-18 13:53:00 +00:00
John Stiles
4b354dfb5b Revert "Remove operator= from DSL expression types."
This reverts commit b143520625.

Reason for revert: might have caused chromium:1326848

Original change's description:
> Remove operator= from DSL expression types.
>
> This means that in raw DSL code, `foo = bar` will need to be written as
> `foo.assign(bar)`. This is admittedly slightly less convenient. However,
> in practice, raw DSL code is very rare, and in fact we only had one
> use-case for operator= across all of our code. This change will allow us
> to simplify the DSL parser by eliminating the `DSLWrapper` helper class,
> which was only needed because we overloaded `operator=`.
>
> Change-Id: I4fbc39b2c1443fc26a761d424c52e3b9b59169eb
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541062
> Commit-Queue: John Stiles <johnstiles@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

Change-Id: I7c7e032c465aba004ba78fd69650c8037e019861
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541737
Auto-Submit: John Stiles <johnstiles@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-05-18 13:22:08 +00:00
John Stiles
37c03c8d73 Revert "Remove DSLWrapper helper class."
This reverts commit 3b4f862d05.

Reason for revert: might have caused chromium:1326848

Original change's description:
> Remove DSLWrapper helper class.
>
> Without an `operator=` on our expressions and variables, we no longer
> need to wrap all our expressions with a helper.
>
> Change-Id: I8110079f61c9ad01997f7c4b376db223dc4b6e17
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541063
> Commit-Queue: John Stiles <johnstiles@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

Change-Id: I7efb3004913f7c85dc551d9740a6b31971de52d2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541736
Auto-Submit: John Stiles <johnstiles@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-05-18 13:21:07 +00:00
Michael Ludwig
11c0ca2833 [graphite] Use scalar constructor in Rect::Infinite
Change-Id: I38d16569a9270ac359d3c3ba4eb1045e805f7638
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541419
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
2022-05-17 20:03:24 +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
Michael Ludwig
5c08e3c357 Standardize on skvx aliases, plus clean-up
This adds aliases like skvx::float2, float4, etc. to SkVx.h and goes
through existing usages of SkVx to standardize on those aliases, or
refer to the full name directly.

In particular, this lets us clean up the equivalent aliases in
src/gpu/tessellate, src/gpu/graphite/VectorTypes and src/gpu/ganesh/GrVx

Where possible, I switched to using skvx::Foo directly and leveraged
auto to make it less redundant. Headers always used the full type
except for PatchWriter.h and Rect.h because of the number of their
usages. In this case, the alias is scoped to private so it can't leak.

This is prep to migrate older code that is still using SkNx and its
aliases like Sk4f to SkVx as well.

Change-Id: I9dd104e83cf17c2b88995a047cfd2e2b0fe6fac2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541058
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-05-17 18:04:55 +00:00
Brian Osman
c2d42fe243 Add #version directive to SkSL
ProgramSettings now has a fRequiredVersion, based on the #version
directive (if any). There is plenty more to do, and this is an
intermediate state where the "fEnforceES2Restrictions" bool still
exists. Eventually, that will go away, or change into a check between
the required version and the SkCapabilities supplied (also in
ProgramSettings).

As a proof-of-concept, this migrates some use-cases to insert the new
version directive, and unlock ES3 features in some tests and benches.

Bug: skia:11209
Change-Id: I964975931039588d7a302bfedd09246e3d4a79d2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/540037
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-05-17 15:42:31 +00:00
John Stiles
3b4f862d05 Remove DSLWrapper helper class.
Without an `operator=` on our expressions and variables, we no longer
need to wrap all our expressions with a helper.

Change-Id: I8110079f61c9ad01997f7c4b376db223dc4b6e17
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541063
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2022-05-17 13:38:48 +00:00
John Stiles
b143520625 Remove operator= from DSL expression types.
This means that in raw DSL code, `foo = bar` will need to be written as
`foo.assign(bar)`. This is admittedly slightly less convenient. However,
in practice, raw DSL code is very rare, and in fact we only had one
use-case for operator= across all of our code. This change will allow us
to simplify the DSL parser by eliminating the `DSLWrapper` helper class,
which was only needed because we overloaded `operator=`.

Change-Id: I4fbc39b2c1443fc26a761d424c52e3b9b59169eb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541062
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2022-05-17 13:38:27 +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
John Stiles
40bd208dcc Remove DSL runtime effect support.
DSL runtime effects were unused outside of test code.

Change-Id: I561afc533c7c204183968aff0b9c4389b0587114
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/540917
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2022-05-16 20:04:43 +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
Robert Phillips
5bde3f4b2f Add kSkBlendModeCount
I keep bumping into the need for this

Change-Id: I69384f7d590c163fd6244bdc64cc5e48450fecd4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/540171
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2022-05-13 18:56:38 +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
Eric Boren
860c40fee5 Update Skia milestone to 104
Change-Id: Iafd9cf15ac3c42bda7fa6b6857a82dc2eae6d234
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/540296
Reviewed-by: Heather Miller <hcm@google.com>
Commit-Queue: Eric Boren <borenet@google.com>
Commit-Queue: Heather Miller <hcm@google.com>
2022-05-13 14:21:17 +00:00
John Stiles
d259c5e4a2 Run SkSL unit tests with optimizations disabled.
We were already running unit tests twice--once with inlining on, and
once with inlining off, but always with optimization on. Now, the two
passes are instead "inliner + optimizer both on" and "inliner +
optimizer both off". (Testing the full 2x2 matrix of possibilities seems
like overkill.)

Change-Id: I73fb0932877c7b953c1f2e122125e5e7781a8582
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/539396
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-05-11 14:38:07 +00:00
Herb Derby
add4004be5 Extract the CPU code of SkGlyphRunPainter called SkGlyphRunPainterCPU
Simplify the fields used by each, and simplify the CTORs in
the original SkGlyphRunPainter.

TODO: come up with a better no gpu method. Eventually, this
should be pure Sk. There is no need for GPU to make and
serialize a slug only to draw them.

Change-Id: I446fe0c285ae778a14b30e09c8a2cff3cd1a56c1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/538896
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-05-10 16:54:33 +00:00
Brian Salomon
f7082cb9fa Rename SkCustomMesh to SkMesh
Also rename associated files, types, functions, etc.

Bug: skia:12720
Change-Id: Ibebb4e7071fa19c5a81cd36d567c96a42cd824f3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/538040
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2022-05-09 13:36:21 +00:00
Brian Salomon
4cf577899c Add support for GPU-backed buffers to SkCustomMesh.
The client passes a GrDirectContext* when creating a vertex or index
buffer. The data is copied to a GPU accessible buffer object
and the client gets a Skia object that may only be used with the GrDirectContext. The GPU backend draws directly from the buffer, thereby
avoiding the per-draw copy cost.

The underlying Ganesh object is freed in a thread-safe manner using an
existing message bus to perform a delayed unref in GrResourceCache.

Bug: skia:12720
Change-Id: If2578fbbf094874967a294a095b3bc5d7616d73a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/527918
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2022-05-06 00:13:57 +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
Michael Ludwig
e8968dce7a Remove HW tess info from GrProgramInfo and related types
Bug: skia:13263
Change-Id: I2289895e49d32664653165b8c1e29968edd3e0a2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/533700
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2022-05-04 20:26:12 +00:00
Brian Salomon
60f2da5d15 Add buffer API to SkCustomMesh.
SkCustomMesh is a class with factory functions. Vertex and index
data are stored in buffer objects rather than raw pointers. User can
provide offsets into the buffers.

Currently the buffers are always CPU backend and are uploaded to the
GPU on each draw. However, buffer the creation API takes a
GrDirectContext which in the future will be used to create a GPU-backed
buffer specific to the passed context.

Bug: skia:12720
Change-Id: If1bb8110f0f2f219b030f9682ab844f1f2207d9f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/527917
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2022-05-04 16:29:27 +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
Ben Wagner
e54df3563d Explicitly cast ints in SkSTArray.
The compiler can complain about these signed to unsigned conversions.
Explicitly cast them in initWithPreallocatedStorage to match the way
this is already done in init [0].

[0] 311b648013 "pack SkTArray"

Change-Id: I0f723094fd356f9c5971b35998c4ecd59c09332f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/536099
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2022-05-02 20:48:30 +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
fe01e985a7 Reland "Reland "[includes] Remove SkColorSpace include from SkImageInfo""
This is a reland of commit 00de8cc000

New client fixes:
 - http://cl/445903108

Original change's description:
> Reland "[includes] Remove SkColorSpace include from SkImageInfo"
>
> This is a reland of commit 2151fa37fa
>
> New client fixes:
>  - https://crrev.com/c/3616345
>
> Original change's description:
> > [includes] Remove SkColorSpace include from SkImageInfo
> >
> > See also https://skia-review.googlesource.com/c/skia/+/525639
> >
> > This should be landed when clients have been fixed.
> >  - https://github.com/flutter/engine/pull/32532
> >  - https://github.com/flutter/engine/pull/32382
> >  - http://cl/438808657
> >  - http://cl/438803822
> >  - http://cl/438807456
> >  - http://cl/438808026
> >  - http://cl/438821192
> >  - https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17542295
> >
> > Change-Id: I04beeb2e2b6132c40508c98f4f281981dadbb0d4
> > Bug: skia:13052
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/526416
> > Commit-Queue: Kevin Lubick <kjlubick@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
>
> Canary-Chromium-CL: 3616345
> Bug: skia:13052
> Change-Id: I670d3d0d0bab2a86559d9a1184cb36ef008196f3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/535357
> Reviewed-by: Brian Salomon <bsalomon@google.com>

Bug: skia:13052
Change-Id: Ibb931dde3f0846609df35d2897989eff0499b7f9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/535896
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2022-05-02 13:33:21 +00:00
Brian Osman
05dd660fee Revert "Reland "[includes] Remove SkColorSpace include from SkImageInfo""
This reverts commit 00de8cc000.

Reason for revert: G3 Breakage?

Original change's description:
> Reland "[includes] Remove SkColorSpace include from SkImageInfo"
>
> This is a reland of commit 2151fa37fa
>
> New client fixes:
>  - https://crrev.com/c/3616345
>
> Original change's description:
> > [includes] Remove SkColorSpace include from SkImageInfo
> >
> > See also https://skia-review.googlesource.com/c/skia/+/525639
> >
> > This should be landed when clients have been fixed.
> >  - https://github.com/flutter/engine/pull/32532
> >  - https://github.com/flutter/engine/pull/32382
> >  - http://cl/438808657
> >  - http://cl/438803822
> >  - http://cl/438807456
> >  - http://cl/438808026
> >  - http://cl/438821192
> >  - https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17542295
> >
> > Change-Id: I04beeb2e2b6132c40508c98f4f281981dadbb0d4
> > Bug: skia:13052
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/526416
> > Commit-Queue: Kevin Lubick <kjlubick@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
>
> Canary-Chromium-CL: 3616345
> Bug: skia:13052
> Change-Id: I670d3d0d0bab2a86559d9a1184cb36ef008196f3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/535357
> Reviewed-by: Brian Salomon <bsalomon@google.com>

Bug: skia:13052
Change-Id: Ie2d036f0bfcdb481c4227a6d567e38d527c81168
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/535202
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-04-29 22:17:12 +00:00
Brian Salomon
c8ee7b1384 Reland "Reland "Add anisotropic option to SkSamplingOptions.""
This is a reland of commit e6f23f98de

Original change's description:
> Reland "Add anisotropic option to SkSamplingOptions."
>
> This is a reland of commit 9be2d572d4
>
> Original change's description:
> > Add anisotropic option to SkSamplingOptions.
> >
> > Implement on GPU.
> >
> > Bug: skia:13036
> > Change-Id: I35d760596c4f8faaec27fccf284b70802fcf3f9b
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/524757
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Reviewed-by: Michael Ludwig <michaelludwig@google.com>
>
> Bug: skia:13036
> Change-Id: I3e411aae389dc880ce32bba78852705059fb88b0
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/535197
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: skia:13036
Change-Id: Icb2513cea6c4ec4cec934f78c66071081c232960
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/535437
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2022-04-29 19:28:52 +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
John Stiles
59c906795c Remove InlineMarker IR node.
This node was only used to detect recursion while inlining. We no longer
need to do this, because we disallow recursion in all programs.

The removal of one IRNode per inlined function actually allows for
slightly more aggressive inlining, since we restrict inlining based on
IRNode consumption. This allows the "ExponentialGrowth" tests to inline
a bit more deeply than before.

Change-Id: I894dbb1ca3096bb785b67facb01cc9c630f694c4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/534780
Reviewed-by: Arman Uguray <armansito@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-04-29 17:40:58 +00:00
Kevin Lubick
00de8cc000 Reland "[includes] Remove SkColorSpace include from SkImageInfo"
This is a reland of commit 2151fa37fa

New client fixes:
 - https://crrev.com/c/3616345

Original change's description:
> [includes] Remove SkColorSpace include from SkImageInfo
>
> See also https://skia-review.googlesource.com/c/skia/+/525639
>
> This should be landed when clients have been fixed.
>  - https://github.com/flutter/engine/pull/32532
>  - https://github.com/flutter/engine/pull/32382
>  - http://cl/438808657
>  - http://cl/438803822
>  - http://cl/438807456
>  - http://cl/438808026
>  - http://cl/438821192
>  - https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17542295
>
> Change-Id: I04beeb2e2b6132c40508c98f4f281981dadbb0d4
> Bug: skia:13052
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/526416
> Commit-Queue: Kevin Lubick <kjlubick@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

Canary-Chromium-CL: 3616345
Bug: skia:13052
Change-Id: I670d3d0d0bab2a86559d9a1184cb36ef008196f3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/535357
Reviewed-by: Brian Salomon <bsalomon@google.com>
2022-04-29 14:56:15 +00:00
Brian Salomon
022334eaa7 Revert "Reland "Add anisotropic option to SkSamplingOptions.""
This reverts commit e6f23f98de.

Reason for revert: skps busted

Original change's description:
> Reland "Add anisotropic option to SkSamplingOptions."
>
> This is a reland of commit 9be2d572d4
>
> Original change's description:
> > Add anisotropic option to SkSamplingOptions.
> >
> > Implement on GPU.
> >
> > Bug: skia:13036
> > Change-Id: I35d760596c4f8faaec27fccf284b70802fcf3f9b
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/524757
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Reviewed-by: Michael Ludwig <michaelludwig@google.com>
>
> Bug: skia:13036
> Change-Id: I3e411aae389dc880ce32bba78852705059fb88b0
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/535197
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: skia:13036
Change-Id: I583704990e4690ddd86923468c8cb742c1a819c2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/535402
Auto-Submit: Brian Salomon <bsalomon@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-04-29 14:35:04 +00:00
Brian Salomon
e6f23f98de Reland "Add anisotropic option to SkSamplingOptions."
This is a reland of commit 9be2d572d4

Original change's description:
> Add anisotropic option to SkSamplingOptions.
>
> Implement on GPU.
>
> Bug: skia:13036
> Change-Id: I35d760596c4f8faaec27fccf284b70802fcf3f9b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/524757
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>

Bug: skia:13036
Change-Id: I3e411aae389dc880ce32bba78852705059fb88b0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/535197
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2022-04-29 14:18:22 +00:00
Kevin Lubick
cadb3a33e1 Revert "[includes] Remove SkColorSpace include from SkImageInfo"
This reverts commit 2151fa37fa.

Reason for revert: Breaking Chrome

Original change's description:
> [includes] Remove SkColorSpace include from SkImageInfo
>
> See also https://skia-review.googlesource.com/c/skia/+/525639
>
> This should be landed when clients have been fixed.
>  - https://github.com/flutter/engine/pull/32532
>  - https://github.com/flutter/engine/pull/32382
>  - http://cl/438808657
>  - http://cl/438803822
>  - http://cl/438807456
>  - http://cl/438808026
>  - http://cl/438821192
>  - https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17542295
>
> Change-Id: I04beeb2e2b6132c40508c98f4f281981dadbb0d4
> Bug: skia:13052
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/526416
> Commit-Queue: Kevin Lubick <kjlubick@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

Bug: skia:13052
Change-Id: I8a9108a333eebefdfa864c757d8c395a6b59335c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/535296
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Kevin Lubick <kjlubick@google.com>
2022-04-28 22:56:15 +00:00