Commit Graph

11751 Commits

Author SHA1 Message Date
Olivier Li
93b0629262 Allow callers of SkEventTracer::SetInstance to avoid installing atexit() callback.
Bug: skia:13178

Change-Id: I9505b211e6afa6872ac51837964394f2a1a84916
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/534500
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2022-05-26 20:13:52 +00:00
Ben Wagner
225c8861b7 [pdf] Differentiate text from byte strings.
In PDF there are two different physical encodings of strings (as a
sequence of bytes). There is the literal string encoding which is
delimited by '(' and ') which stores the bytes as-is except for '(',
')', and the escape character '\' (which can introduce octal encoded
bytes). There is also the hex string encoding delimited by '<' and '>'
and the bytes are encoded in hex pairs (with an implicit '0' at the end
for odd length encodings).

The interpretation of these bytes depends on the logical string type of
the dictionary key. There is a base abstract (well, almost abstract
except for legacy purposes) string type. The subtypes of the string type
are `text string`, `ASCII string`, and `byte string`. The `text string`
is logically further subtyped into `PDFDocEncoded string` and `UTF-16BE
with BOM`. In theory any of these logical string types may have its
encoded bytes written out in either of the two physical string
encodings.

In practice for Skia this means there are two types of string to keep
track of, since `ASCII string` and `byte string` can be treated the
same (in this change they are both treated as `byte string`). If the
type is `text string` then the bytes Skia has are interpreted as UTF-8
and may be converted to `UTF-16BE with BOM` or used directly as
`PDFDocEncoded string` if that is valid. If the type is `byte string`
then the bytes Skia has may not be converted and must be written as-is.

This means that when Skia sets a dictionary key to a string value it
must, at the very least, remember if the key's type was `text string`.
This change replaces all `String` methods with `ByteString` and
`TextString` methods and updates all the callers to the correct one
based on the key being written.

With the string handling corrected, the `/ActualText` string is now
emitted with this new common code as well for better output and to
reduce code duplication. A few no longer used public APIs involving
these strings are removed. The documentation for the URI annotation is
updated to reflect reality.

This change outputs `UTF-16BE with BOM` with the hex string encoding
only and does not attempt to fix the literal string encoding which
always escapes bytes > 0x7F. These changes may be attempted in a
separate change.

Bug: chromium:1323159
Change-Id: I00bdd5c90ad1ff2edfb74a9de41424c4eeac5ccb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/543084
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2022-05-24 18:46:42 +00:00
Herb Derby
4c26a927a6 Fix compile error on chrome bots
Change-Id: Ie1d94106a741a9cc51dfd13813f143374392489a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/543516
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2022-05-24 16:08:14 +00:00
Michael Ludwig
0221e79b8b Remove SkNx entirely
Also cleans up the scattered references remaining in the code base
(including in files I thought I got already...).

Change-Id: I7004354b1e9cea9f9d9f45b791d8ab9ce557ba01
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/542647
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-05-24 15:57:57 +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
Herb Derby
163db5205d Ref to initialPositionMatrix on SubRun
Remove the need for the Slug/Blob at SubRun creation. This needed
to combine the SkGlyphRunPainterInterface for Slug and Blob.

Change-Id: I8ba1db4590a5db26d1542d025e5414a2625ad88f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/543082
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2022-05-24 14:46:07 +00:00
Jim Van Verth
791f4bcf3e Fix up Ganesh and Graphite defines.
SK_SUPPORT_GPU needed to be set to 1, and SK_GRAPHITE_ENABLED should
be checked to see if it's defined, not its value.

Change-Id: Ib762c590ceaa570ec98a76558657bbcee672c254
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/543080
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-05-23 20:51:28 +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
Greg Daniel
8fd61eea0d [graphite] Add SkBudgeted field to Resources.
This also adds support for making a Resources unbudgeted state when it
is pulled out of the cache to be used for an SkImage or Surface. It
then puts the resources back as budgeted when returned to the cache.

Bug: skia:12754
Change-Id: I469ace602aa6f5f708b82655e94557ff8ad45a72
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/538046
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-05-23 17:59:54 +00:00
Michael Ludwig
767586b330 Update Sk4px to use skvx instead of SkNx
Adds a saturated_add function that was on SkNx and used in
SkXfermode_opts, but hadn't been ported to skvx yet.

Removes the Sk4px_opts variants and simplifies some of its functions;
many were already defined skvx.

The largest change is that Sk4px does not extend skvx::byte16, since it
used to extend Sk16b. Now it just has a vector as a data type. This
was necessary so that we could define operators that were typed for
Sk4px and Wide w/o conflicting with the free operators that were
defined for the base skvx types.

Change-Id: I8c667ba86f662ccf07ad85aa32e78abfc0a8c7ae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/542645
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-05-23 17:41:53 +00:00
Tyler Denniston
193c16380f Revert "Eliminate DSLPossibleExpression."
This reverts commit f2d000328f.

Reason for revert: breaking google3 roll

Original change's description:
> Eliminate DSLPossibleExpression.
>
> The Possible(Expression|Statement) classes were added at
> http://review.skia.org/375069. These classes were responsible for
> capturing `__builtin_FILE()` and `__builtin_LINE()` when an
> expression or statement was added to a hand-authored DSL program. This
> allowed errors to be reported on the C++ file/line where they were
> encountered. This was a good feature to have, when the plan was to
> author the majority of SkSL code via DSL.
>
> Later, IRNode positions were converted from an integer line number to
> SkSL Positions at http://review.skia.org/518137. This gave us range
> tracking, but at a high memory cost (16 bytes per IRNode, versus four
> bytes when we tracked line numbers only).
>
> Positions were reduced to 8 bytes at http://review.skia.org/521005 by
> removing the filename, which was only used for hand-authored DSL. (The
> size was pared all the way back to 4 bytes at
> http://review.skia.org/533699 by packing the data more efficiently.)
>
> __builtin_FILE/LINE capturing was removed entirely at
> http://review.skia.org/528366; the filename was discarded anyway and
> the line number didn't have a range and wasn't very meaningful without
> a filename. Also, it didn't matter very much since we no longer intended
> to hand-craft our programs in DSL.
>
> At this stage, DSLPossibleExpression stopped adding value and simply
> served to move Expressions around.
>
> Change-Id: I29ac33e08dcc1804cc0619c1e8856ba28ebcc51d
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/542145
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>

Change-Id: I33badbdcce8760200246bf50e4932d42721ea952
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/543078
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Owners-Override: Kevin Lubick <kjlubick@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2022-05-23 15:04:00 +00:00
Michael Ludwig
8e870728db Update filters to use skvx instead of SkNx
Change-Id: I1a5490f546a3cb046c64b114a30be991d2d9f2cc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541064
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-05-23 14:38:11 +00:00
John Stiles
f2d000328f Eliminate DSLPossibleExpression.
The Possible(Expression|Statement) classes were added at
http://review.skia.org/375069. These classes were responsible for
capturing `__builtin_FILE()` and `__builtin_LINE()` when an
expression or statement was added to a hand-authored DSL program. This
allowed errors to be reported on the C++ file/line where they were
encountered. This was a good feature to have, when the plan was to
author the majority of SkSL code via DSL.

Later, IRNode positions were converted from an integer line number to
SkSL Positions at http://review.skia.org/518137. This gave us range
tracking, but at a high memory cost (16 bytes per IRNode, versus four
bytes when we tracked line numbers only).

Positions were reduced to 8 bytes at http://review.skia.org/521005 by
removing the filename, which was only used for hand-authored DSL. (The
size was pared all the way back to 4 bytes at
http://review.skia.org/533699 by packing the data more efficiently.)

__builtin_FILE/LINE capturing was removed entirely at
http://review.skia.org/528366; the filename was discarded anyway and
the line number didn't have a range and wasn't very meaningful without
a filename. Also, it didn't matter very much since we no longer intended
to hand-craft our programs in DSL.

At this stage, DSLPossibleExpression stopped adding value and simply
served to move Expressions around.

Change-Id: I29ac33e08dcc1804cc0619c1e8856ba28ebcc51d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/542145
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2022-05-23 13:56:41 +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
Michael Ludwig
4621ef2a8a Improve skvx::any() and all() intrinsics
Removes specializations for all() on AVX2 and SSE 4.1, which give the
wrong results if the ints didn't have all bits set (inconsistent with
other platforms and non-SIMD). Added a unit test that checks this case.

The mirror specializations for any() on AVX2 and SSE 4.1 are actually
valid, so added those, and added a 2 instruction specialization for
SSE for any() and all(). This is what clang-trunk produces on -O3, but
ToT clang struggles to vectorize it.

Also adds specializations for NEON for any() and all(), since even
clang-trunk was struggling to vectorize it automatically. In
particular, this will help skgpu::graphite::Rect's implementations of
intersect and contains, which use any/all to get a final boolean value.
In the Instruments app, I had see Rect's intersection as a hotspot
on the Mac M1, and this vectorization helps a bit.

Also takes the opportunity to remove fake C++14 constexpr for a
real constexpr.

Change-Id: Ib142e305ae5615056a777424e379b6da82d44f0c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/542296
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2022-05-20 00:50:59 +00:00
Aaron Krajeski
1a7fb782ae Make float color versions of SkBitmap::clear
Bug: skia:13329
Change-Id: I9992cd5149e50f9a998af712984a82e5d952d58b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541936
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2022-05-19 23:25:06 +00:00
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