This is a step toward making the class less stateful.
Bug: chromium:1172543
Change-Id: I1fbcff53fa823c49dcca757fa970dcebc9a9aa25
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372286
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
The IRGenerator's `convertConstructor` and `coerce` were tied at the
hip--coercion can create a constructor, and creating a constructor can
cause type-coercion. This CL migrates IRGenerator::coerce to
Type::coerceExpression, and migrates IRGenerator::convertConstructor to
Constructor::Make.
Most constructor creation should go through Constructor::Make instead of
make_unique<Constructor> for best results. There are exceptions to this
rule:
- during the Compiler's `optimize` phase, we hold raw pointers to
unique_ptrs of existing expression trees, and are manually tracking
variable usage counts, so adjusting the IR tree should be done with
extreme care. Continue to use make_unique here to avoid any "surprise
improvements."
- the Rehydrator is attempting to recreate an IR tree exactly as it used
to be and doesn't want additional optimization or fixups
There are still Constructor-related optimizations in simplifyExpression
which are not yet implemented in Constructor::Make. These are migrated
to Constructor::Make at http://review.skia.org/371482
Change-Id: I0f3876f932835fc2e347ae95414bc490085f120c
Bug: skia:11342
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/370876
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Clients no longer opt-in for this, so no diffs expected.
Change-Id: I8faa6f08990d877dd16d32a5a5e307948813725f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/370037
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This will help us migrate code out of IRGenerator.
Change-Id: Id9c70cc4577ed41b2fc5ad26f752caea13a56083
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372437
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Change-Id: I218429246da2da3e80fb1823241fdbcf84f0dd30
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372478
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
This reverts commit 0fdcaa5757.
Reason for revert: Fix landed in Android
Original change's description:
> Revert "Remove (unused) gpuType from SkRuntimeEffect::Uniform"
>
> This reverts commit cc80a47566.
>
> Reason for revert: IWYU cleanup broke less IWYU-clean Android,
>
> frameworks/native/libs/renderengine/skia/filters/BlurFilter.cpp:180:17: error: variable has incomplete type 'SkRRect'
> SkRRect roundedRect;
> ^
> external/skia/include/core/SkCanvas.h:58:7: note: forward declaration of 'SkRRect'
> class SkRRect;
>
>
> Original change's description:
> > Remove (unused) gpuType from SkRuntimeEffect::Uniform
> >
> > Also remove some unnecessary includes, then IWYU.
> >
> > Change-Id: I41e88f0e661c59e75cb26e28768801b811fe8ee8
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371140
> > Commit-Queue: Brian Osman <brianosman@google.com>
> > Reviewed-by: John Stiles <johnstiles@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
>
> TBR=bsalomon@google.com,brianosman@google.com,johnstiles@google.com
>
> Change-Id: Id655a6835ebffdb4f5f82474c287c09a69a737df
> No-Tree-Checks: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371941
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>
# Not skipping CQ checks because this is a reland.
Change-Id: I67deaee08f1dfea8d91121b3e665d2e6036b6139
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372216
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
CFBundleCopyResourceURL is expecting a path with no trailing '/', so we
use CFURL to treat the relative path as if it's for a vanilla file and
normalize it.
Also adds in some variable renames to make it more general.
Change-Id: I0db38702cad2b42a32fd4d4516a23cea714a5f50
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372199
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
We're caching the runtime effect, but luma filter
has no uniforms, so we can cache the whole filter.
Change-Id: I7c4b37a35928b9bc804e921f99bb1eccaf13e7a5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372294
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Bug: skia:11230
Change-Id: I8983d160ff0317514572d13aa2a3f1218e15da8e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371959
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
Change-Id: I898fc64d8df625d22750cfe1145ba4b02acdfbb9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372078
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
The indirect tessellator can't combine overlapping, mismatched colors
because the log2 binning draws things out of order. But we can still
chain them together and generate a single long list of indirect draws.
Bug: chromium:1172543
Bug: skia:10419
Change-Id: Id7fc7488411a2a189e24cd7dd692e5c78497f498
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/370197
Reviewed-by: Brian Salomon <bsalomon@google.com>
Only adds color to the hardware tessellator. The indirect tessellator
reorders draws with is log2 binning, so we can't have different
colors.
Bug: chromium:1172543
Bug: skia:10419
Change-Id: I2a3700cd4572e8222002bfb028af05c6ec447708
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369976
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Also deletes the unnecessary old header file.
Bug: skia:11230
Change-Id: Ie7c3926fe635a37e617e5e1fcac7c05eb576bbf1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368617
Reviewed-by: Robert Phillips <robertphillips@google.com>
The SwizzleComponent enum would be useful outside of the DSL. This CL
creates a SkSL::SwizzleComponent namespace and has the DSL inject that
namespace into SkSL::dsl via using-directive. Future CLs will use values
from this enum within SkSL::Swizzle itself.
Users expect that `using namespace SkSL::dsl;` will allow statements
like `Swizzle(var, X, Y)` to work normally without any extra
qualifications, using-declarations or #includes, so this is a little
more involved than forward-declaring an enum would be normally.
Change-Id: Id4e2f109d01e465c315c6278f3d4b87027988c86
Bug: skia:11342
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372018
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Change-Id: I4df18946cdb3d9f1f7833461f913f2df94696821
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372197
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Change-Id: I3cde541ff8eb7239394e825061ed1433806af5c7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372123
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This is a reland of 82a8130654
Original change's description:
> use a linked list for GrAtlasTextOp geometries
>
> Instead of using a GrTBlockList<Geometry> to hold the geometries
> in the op. Allocate them on the RecordTimeAllocator, and
> link them together.
>
> Change-Id: I32af5724e7abeca1ddb6d38b26afbff7919cbc76
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341725
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Herb Derby <herb@google.com>
Change-Id: I526d8b0b06fca13046c065cbc06f0c0e1103ce11
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371996
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This wasn't even referenced by the parser.
Change-Id: Id6246c3909b7f2b499908a742bdd61f4918f023a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372119
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
These were all unused, and only implemented on one backend.
Change-Id: Ibd2fcef1a971e6c1bd9da0784c5d852a60708484
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372117
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Allows us to batch together strokes that have different SkStrokeRecs.
Bug: chromium:1172543
Bug: skia:10419
Change-Id: I11dc01e60bc17a6bb3c3b635f9edb2944a2f2edc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369579
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Change-Id: I885149c73be63c223ac88a697ffe046a7f8384d0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372116
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Bug: skia:11230
Change-Id: I9da638b5e1de50aee9a805547f51e013e55747b4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368598
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This reverts commit 5db699af9d.
Reason for revert: the wrapped color filter now no longer is told that it's in the working format... its asFragmentProcessor() / program() calls will be fed the destination surface's format instead of the working format.
Original change's description:
> split working-format filter into two parts
>
> The old filter represented the whole (xform -> child -> xform) sandwich,
> where this new one represents just one xform, with the factory now using
> Compose() to piece the sandwich together.
>
> This is conceptually simpler, which is nice, and we should also be able
> to use this to replace SkSRGBGammaColorFilter (next CL).
>
> Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
> Change-Id: I6dee3c968329ab74f24e01fcdb82872141cdd496
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371456
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>
TBR=mtklein@google.com,reed@google.com
Change-Id: I2c0daa03dde396a5b2414a8cfe8d3754d6bf6e0c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372076
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Change-Id: Ia7fb5dfc0239ab0fdd3259246b727b7f901dca7b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372017
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
When I adding the new kTransferCpuToGpu enum for vulkanmemory the
persistently mapped property was dropped for those buffers and this adds
this back.
Also we are now using the special DEVICE_LOCAL and HOST_VISIBLE memory
so disable the persistent mapping for those buffers (see deleted comment
and added comment in caps).
Change-Id: I9353b6da5da57b3c8ae1f93cc89c671174a86b84
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371476
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Also deletes unnecessary header and deprecated types
associated with implementation.
Bug: skia:11230
Change-Id: Ibfd7dcf305febae794edfe777fc64efc0559909b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368597
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This reverts commit cc80a47566.
Reason for revert: IWYU cleanup broke less IWYU-clean Android,
frameworks/native/libs/renderengine/skia/filters/BlurFilter.cpp:180:17: error: variable has incomplete type 'SkRRect'
SkRRect roundedRect;
^
external/skia/include/core/SkCanvas.h:58:7: note: forward declaration of 'SkRRect'
class SkRRect;
Original change's description:
> Remove (unused) gpuType from SkRuntimeEffect::Uniform
>
> Also remove some unnecessary includes, then IWYU.
>
> Change-Id: I41e88f0e661c59e75cb26e28768801b811fe8ee8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371140
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com,brianosman@google.com,johnstiles@google.com
Change-Id: Id655a6835ebffdb4f5f82474c287c09a69a737df
No-Tree-Checks: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371941
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This reverts commit 82a8130654.
Reason for revert: I believe this is blocking the Chrome roll
Original change's description:
> use a linked list for GrAtlasTextOp geometries
>
> Instead of using a GrTBlockList<Geometry> to hold the geometries
> in the op. Allocate them on the RecordTimeAllocator, and
> link them together.
>
> Change-Id: I32af5724e7abeca1ddb6d38b26afbff7919cbc76
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341725
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Herb Derby <herb@google.com>
TBR=herb@google.com,robertphillips@google.com
Change-Id: I238f7e91e1b1131c46ad1097371855eda2dbf553
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371956
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Instead of using a GrTBlockList<Geometry> to hold the geometries
in the op. Allocate them on the RecordTimeAllocator, and
link them together.
Change-Id: I32af5724e7abeca1ddb6d38b26afbff7919cbc76
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341725
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Bug: skia:11335
Change-Id: I88c952cbfe2d2c5920e17675da1674928f37b982
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371480
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Bug: skia:11295
Change-Id: Iec11f3f4d26eb5b1c07707b3cedd09096bad80d0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371478
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
The old filter represented the whole (xform -> child -> xform) sandwich,
where this new one represents just one xform, with the factory now using
Compose() to piece the sandwich together.
This is conceptually simpler, which is nice, and we should also be able
to use this to replace SkSRGBGammaColorFilter (next CL).
Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
Change-Id: I6dee3c968329ab74f24e01fcdb82872141cdd496
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371456
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
When coercing a type, we would previously call checkValid() so we could
detect function-references and type-references, so we could get a nicer
error message.
It turns out that we can just do the "is this a type-reference/
function-reference?" check directly inside coerce() and get the same
improved error messages. Since we should be coercing all our values to
the right type, and type/function-references aren't coercible to
anything, this should catch them all. I don't expect any of these
to survive all the way to the end of IR generation.
(In case one of these types does slip through, I've left the error case
in checkValid, but I've also put in an assertion. If the fuzzer can
make that assertion fire, we are probably missing a call to coerce()
somewhere.)
This cleanup is meant to help migrate coerce() out of IRGenerator.
Change-Id: I031809adf439b1766048768b782c57e7f2494006
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371479
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
These classes now read the program configuration from the Context.
Change-Id: I15c95cacebb9836ee8f2162c4f4b7f99d453639c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371396
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Adds trivial name mangling to the .stage output, so we can verify that
it's working in all places (declarations, references, etc). Also added
another global variable whose initializer is - in turn - another global.
Bug: skia:11295
Change-Id: Ic220bfae0a6d1eeeba66ade30d3d781af15c5dea
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371477
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
The only color filter flag is isAlphaUnchanged(), so since alpha is
unchanged through any working format transformation, we can just return
whatever flags the child filter claims.
Add a simple test.
Change-Id: I2ce0300d9db55f953660ed157510070755c4c677
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/370824
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Also remove some unnecessary includes, then IWYU.
Change-Id: I41e88f0e661c59e75cb26e28768801b811fe8ee8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371140
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
During IR generation, this information was previously only accessible
from inside the IRGenerator class. Now anyplace with access to the
Context can look up the program settings or kind.
Moving the ProgramKind inside the ProgramSettings struct would be an
interesting future goal, but this ends up causing significant ripple
effects outside of SkSL and may not be worth untangling. Many of our
callers expect to compile a Vertex, Fragment, and/or Geometry shader all
at once with the same Settings but differing ProgramKind, so perhaps
the distinction between Kind and Settings is relevant and worth
keeping as-is.
Change-Id: I8b3a61510911b4ff309549663f81f3b960bdb0da
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371256
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>