This change is a wash for tests that could fit inside the previous
hard-coded pool (512 nodes) and appears to be a 5% improvement for
sksl_large. Larger programs would hypothetically show an even more
significant improvement.
When SK_SUPPORT_GPU is disabled, we disable pooling entirely and fall
back to the system allocator. This is necessary because SkSL can exist
without Ganesh (such as in the wasm+CanvasKit build).
Nanobench: http://screen/4xJEzdGducRxGeq
Change-Id: I71dc702a84ab5c163673e35ec651003d7d45dacd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330219
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This provides the optimizer with hints so that it can avoid virtual
calls in scenarios where the type is known.
(The ExternalValue leaf class is excluded from this change; unlike
most IRNodes, it is meant to be subclassed.)
Change-Id: I68ff3e2336cb478bcc546c9fe3640719a01d8ea7
Bug: skia:10886
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330223
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Herb Derby <herb@google.com>
This is trying to dynamically set the array bounds for sk_in, based on
the primitive type. However, the sizes() field of the interface block
isn't even used for that - it's done with similar logic in
writeInterfaceBlock. Also, this was using the wrong size for several
primitive types.
Bug: skia:7733
Change-Id: Ic0925b51d86dcaea718373bb16d633cc2cd3398f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330222
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Now that GrOps no longer needs a GrMemoryPool to be
deleted, just pass down the the SkArenaAlloc instead
of both the GrMemoryPool and SkArenaAlloc.
The alloc is only used for two ops, but we pass it
to all the ops most of which don't use it.
Change-Id: I873efcdfe44b446f2ac5089ea8425dff257e318c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330118
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Herb Derby <herb@google.com>
With variable width stroke, there is a curious case where both sides
need an inner or an outer join, instead of the fixed width case where
each side will have opposite join types. This improves the miter join
logic to treat the "left" and "right" sides separately.
There is still work to be done for joins, it's still too easy to create
weirdness.
Also improved debugging messages for degenerate cases instead of
silently swallowing the errors.
Change-Id: I4b6819e200138b39409b874a492b920d78f6a588
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330155
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
This reverts commit 292f7777da.
Reason for revert: Oddly this is causing issues in vulkan chrome linux with specific window managers, see crbug.com/1141831
Original change's description:
> In Vk don't set dynamic blend constant on Pipeline if we don't use it.
>
> We already don't call the dynamic update for the blend constant if it's
> not used. This change makes it so we don't even tell the VkPipeline
> to have support for a dynamic blend constant. This allows the driver
> to make the pipline objects slightly more optimal.
>
> Change-Id: Ib7ea4e0ec7eeb8e7c1cf165d426ee863fa0a3a00
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329036
> Reviewed-by: Jim Van Verth <jvanverth@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,jvanverth@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: Id8b74889b87c6402982fd4c8dcda3a5876005890
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330218
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This doesn't change any behavior; it just exposes existing code that
previously could only run at ~GrMemoryPool time. Now you can report
leaks on a memory pool without actually destroying it.
Change-Id: I35bf6c7d886827031cce0e2b045775207062c121
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330217
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
We were getting lucky with intersect in that the tested shaders always
ended up multiplying by the input alpha at the end. This adds a
dedicated GM that tests the difference op for clip shaders, across
a variety of shape types.
Bug: skia:10879
Change-Id: I45fdaad27f05ae7a74dbdc79eece2e9688806568
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330123
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This reverts commit 375721d7bb.
Some manual edits needed due to time elapsed.
Bug: chromium:1141332, skia:10566
Change-Id: Iadb15d3f5334d9eed4e7053e9c19d75a0bbeb9de
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330196
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
To make this possible, the logic for maintaining a pool of a given node
size has been split into a separate `Subpool` class. We now have two
Subpool objects in the PoolData class; they are always adjacent in
memory, and we can still identify a pooled node just as easily by
verifying that the pointer address is within the range of one of our
Subpools. (Identifying which subpool requires one extra check.)
This change will allow us to pool a handful of larger allocations, which
will benefit almost every program since a handful of variables and
functions are universally necessary, even in simple code.
For now, the chosen size of a large node is just a guess (2x the small
node size); this can be adjusted easily once we have a better idea of
the expected sizes for our larger IRNodes, but for now this successfully
catches a significant number of allocations in `sksl_medium` and
`sksl_large`.
Change-Id: I08fb9c55c02162d4b56e72ff4e0923f2cf258651
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330124
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
I left in the ability to swap between using % arc length versus dividing
t evenly up across path segments so we can easily visually compare the
effect.
Change-Id: Id83792aa9e22fd5464e956092bac0baec389ffed
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330103
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
This is a reland of 22ef2257c8
This reland fixes an issue with ExternalValue nodes on 32-bit builds;
these should never be pooled, because we can't control their lifetimes.
Original change's description:
> Update the SkSL pool interface to take an allocation size.
>
> Since our end goal no longer has all IRNodes ending up as the exact same
> size in memory, it makes sense for the allocator function to take in a
> desired size. This also opens the door to separate "small" and "large"
> pools, if we want to add pooling support for large but semi-common
> things like Variables.
>
> Change-Id: If3dbe31588adeedede327c5967c344a19507b6fa
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329961
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>
Change-Id: If701ae4a5e18b66d4138bc09c9c8dc1a60579c90
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330105
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
I switched GrOps from using GrOpMemoryPool to
GrMemoryPool, but I forgot to switch over the
GrOp::Owner. Make sure the GrOp::Owner works for
both new/delete and GrMemoryPool.
In addition, convert one last unique_ptr<GrOp> to
GrOp::Owner.
Change-Id: I660ad77bee0f060f263ff2ed07974afb83063441
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330097
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Currently only works properly when filling rects, since that is the only
node that implements bounds computation with this CL.
Summary of changes:
- Scale gradient coords by object bounds when units are
kObjectBoundingBox.
- Make fGradientUnits protected instead of private.
- Change default value of fGradientUnits to kObjectBoundingBox, which
is the default according to the spec.
- Change SkSVGNode::onObjectBoundingBox to take a full render context
instead of length context.
- Implement bounds computation for SkSVGRect, SkSVGContainer and
SkSVGUse.
Bug: skia:10842
Change-Id: I2e999985e67644e50da7f681fde190bcf4823eec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329223
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
libcutils is now available as a shared library for host builds as well as Android builds.
Change-Id: Ief5625522933e9c261843436622b391e1eb7abe0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329976
Reviewed-by: Leon Scroggins <scroggo@google.com>
Auto-Submit: Jerome Gaillard <jgaillard@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
This reverts commit 22ef2257c8.
Reason for revert: mysterious tree breakage
Original change's description:
> Update the SkSL pool interface to take an allocation size.
>
> Since our end goal no longer has all IRNodes ending up as the exact same
> size in memory, it makes sense for the allocator function to take in a
> desired size. This also opens the door to separate "small" and "large"
> pools, if we want to add pooling support for large but semi-common
> things like Variables.
>
> Change-Id: If3dbe31588adeedede327c5967c344a19507b6fa
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329961
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>
TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com
Change-Id: I346948aeb407dc6e6e84835f68d0353e4869ddf7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329965
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Change-Id: I93fdeaa3ea6be73619f82859bb53aa88fae3262b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329962
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Since our end goal no longer has all IRNodes ending up as the exact same
size in memory, it makes sense for the allocator function to take in a
desired size. This also opens the door to separate "small" and "large"
pools, if we want to add pooling support for large but semi-common
things like Variables.
Change-Id: If3dbe31588adeedede327c5967c344a19507b6fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329961
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
When the test expression has a side-effect, but both the true and else
blocks are empty, the optimizer moves the test out to a standalone
ExpressionStatement. Updating the usage in that situation involves
traversing an IfStatement with no test.
Bug: oss-fuzz:26666
Change-Id: I2fb4004f2401784402040345df49a7d42e4aab5e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329960
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
There's no functional change here; it's just using a slightly higher-
level abstraction to pass the same payload.
Change-Id: Ife7efa038db5d6dbde5decae2be79ad9db877aba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329782
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This uma stat can allow us to look a few different things. First we can
look at the distribution of render passes per submit (including mean,
median, ect.). Additionally we can do things like sum the total number
of renderpasses from all submits and divide by the total number of
frames (Compositing.Display.DrawToSwapUs::TotalCount) to get the
average number of render passes per frame and not just submit.
Technically under the hood the ENUMERATION and LINEAR_EXACT macros will
do the same thing and we could just use ENUMERATION here. However to
match how chrome uses their UMA macros it is more correct to use the
LINEAR_EXACT since we aren't counting enum values. Chromes macros
actually have static asserts the values are or are not enums, but the
skia implementations do not.
Includes some minor updates to names to match chromes UMA macro values.
This still requires the chrome implementation of the new macro.
Bug: skia:10871
Change-Id: Idbc4d2fc649bbdefd0952a002c3327cb700b552b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329776
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
GLSL requires that functions are declared before first use. In most
cases, we avoid the requirement for explicit prototypes by this by
strategically ordering our functions within the emitted code, but an FP
file might reference its helper functions in any order or have helper
functions that cross-invoke each other, so prototypes should be emitted.
Change-Id: I3b9e9c9ec4bd5be90b4f71f8165af45364facf30
Bug: skia:10872
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329781
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This is necessary to support function calls in FP files properly; in
some cases, functions can be referenced before they have been emitted,
and we need to be able to name them.
This CL resolves the remaining errors in GrRecursion.cpp. There are
still additional errors in GrNestedCall.cpp that will be fixed in
followup CLs.
Change-Id: Iec98ef02ea6a98a9945a4e0e3cfa3537dff01305
Bug: skia:10684, skia:10872
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329676
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
We've given up on Abseil, and these warnings are annoying:
... libtool: warning same member name (libabsl.escaping.o) ...
Bug: skia:10165
Change-Id: I144573206174cbe9b48fce8e86ed22eb4a4e29b3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329937
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Change-Id: I7a07790a7991bc3ec0f9ebfe4ff28e88f00ec0a7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329936
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This backs off a bit on the "stuff everything into IRNode" push, moving
the data of the big nodes back into them and significantly cutting the
size of IRNode. This isn't a complete revert of the changes to these
nodes - now that all of the fields have been hidden behind accessor
methods, it's merely an implementation detail where the data actually
lives, so these changes are much smaller and more targeted.
Change-Id: I84c770245f26dfe36651d0f482543505bd7f71ef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329629
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Removes unused code, including utilities for dealing with KLM
functionals for the implicit cubic function. The implicit has proven
to not be a very good tool for rendering cubics.
Change-Id: I577b50a9eb296c52dc0101a20394480a4a008654
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329440
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Adds an SkChopCubicAt overload that performs two chops at once in
SIMD. Also updates SkChopCubicAt to accept T values of 0 and 1. This
has been the source of bugs in the past.
Bug: skia:10419
Change-Id: Ic8a482a69192fb1685f3766411cbdceed830f9b7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327436
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
and flush out some non-substantive changes; namely:
whitespace changes
tweak what is stored in TessInfo
change createMesh to be CreateMesh
Bug: 1108408
Change-Id: Ife9a0e500b9f51db597350b0257b20efece03bdc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329633
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Introduce three calls on GrOp: Make, MakeWithExtraMemory,
and MakeWithProcessorSet. Instead of returning
unique_ptr<GrOp>, they return a type of GrOp::OpOwner.
GrOp::OpOwner safely deletes the op when it goes out
of scope for either new/delete or GrOpMemoryPool
allocations.
In order to make the code easier to refactor, I
eliminated MakeArg from the helpers.
Change-Id: Icfd697906f3147a8734575d08bd7195e7517383a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323778
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Previously, the generated name was passed back in a SkString-pointer
output parameter. Directly returning the SkString simplified nearly
every call site, and made none of them worse.
Change-Id: Ied57adcf8fb087a301641adad437d8a68f8d3297
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329622
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Previously, there was no way to look at the key (beyond the
DisplayString used in the tree), so for complex key types, this is
better.
No-Try: true
Change-Id: I44b44192dde13b3264f7e5114bf0bf933a4cdd97
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329632
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Previously, we'd just emit functions with `%s` in their function bodies.
Also, the fFormatArgs wouldn't get cleaned up, so subsequent code would
fill in the wrong format arguments in each place.
There are still problems with function calls (`sample` is broken;
function names are accessed before they've been declared or initialized)
but this is a step in the right direction.
Bug: skia:10684
Change-Id: I7399a71d44ebba5049703484ec9933dffbe8e2b9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329417
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
The major difference in computing the join geometry is just that we must
use normal and radius information from the approximated offsets, instead
of the input geometry. All that effectively means is that we need to
stroke the next segment prior to being able to add a join with the
previous segment.
Change-Id: I44d9015cf534deeae27db3c3faab965aee3e930b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329618
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Automatically computed once IR generation is complete, and then used
throughout optimization and inlining, and the backend generators.
Optimization and inlining are reworked to keep the data up-to-date as
they edit the IR.
Bug: skia:10589
Change-Id: Iaded42d8157732dd6fe05f74c5b7bb8366916635
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/328382
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>