The SkM44::RectToRect function matches the semantics of
SkMatrix::RectToRect(kFill_ScaleToFit). No other ScaleToFit variants are
ported over to SkM44.
skottie uses some instances of kCenter_ScaleToFit so that functionality
may need to be added in the future (in SkM44 or in skottie). There are
no current usages of the kStart and kEnd_ScaleToFit semantics.
The SkM44::mapRect() function is implemented to correspond to the
SkMatrix::mapRect() that returns the mapped rect (instead of modifying a
pointer) and always has ApplyPerspectiveClip::kYes. This was chosen to
keep its behavior simple and because perspective clipping is almost
always the right thing to do. In the new implementation there is no
longer a performance cliff to worry about (see below). For the timebeing
mapRect is hidden behind SkMatrixPriv::MapRect().
Performance:
I added benchmarks for mapRect() on SkM44 and SkMatrix that use the same
matrices to get a fair comparison on their different specializations.
SkMatrix has a very efficient mapRect when it's scale+translate or
simpler, then another impl. for affine matrices, and then falls back to
SkPath clipping when there's perspective. On the other hand, SkM44 only
has 2 modes: affine and perspective.
On my desktop, with a Ryzen 9 3900X, here are the times for 100,000 calls
to mapRect for different types of matrices:
SkMatrix SkM44
scale+translate 0.35 ms 0.42 ms
rotate 1.70 ms 0.42 ms
perspective 63.90 ms 0.66 ms
clipped-perspective 138.0 ms 0.96 ms
To summarize, the SkM44::mapRect is almost as fast as the s+t specialization
in SkMatrix, but for all non-perspective matrices. For perspective matrices
it's only 2x slower than that specialization when no vertices are clipped,
and still almost 2x faster than the affine specialization when vertices are
clipped (and 100x faster than falling back to SkPath).
Given that, there's the open question of whether or not keeping an affine
specialization is worth it for SkM44's code size.
Bug: skia:11720
Change-Id: I6771956729ed64f3b287a9de503513375c9f42a0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402957
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
We were relying on a compile thing for this check which isn't really
right. We probably got away with it since the only bad gpu was Mali
400 and that probably never compiled with vulkan enabled. But still we'd
end up in weird cases were a different backend would change how it
worked here depending on if vulkan happen to also be compiled or not.
Change-Id: Ie06519e110cd7eb92384bce4ec3d8211cfc92488
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404917
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Change-Id: Ibb1c563fccae980ad23fac7c41bc5dc91a9925c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404876
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Eric Boren <borenet@google.com>
This adds support for mipmap generation in the simplest case:
* power-of-two
* non-sRGB
* not BGR
The mipmaps are generated with a compute shader that reads from a SRV
of one miplevel and then writes to a UAV at miplevel+1. Miplevel+1 is
then transitioned to a resource state that can be read from, and the
process continues for miplevel+1 and miplevel+2, etc.
Change-Id: Id467d0e56d5408559d3cacec1514f1b43d76d640
Bug: skia:10446
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/392917
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
A constructor like `float3(five)` is not a compile-time constant, so we
miss optimization opportunities like folding. Constant variables inside
splat constructors are now replaced when optimization is on, so this
would optimize down to `float3(5.0)` and be eligible for folding.
Change-Id: I4bf6f52a48ef733e6b24791d02687081194ef488
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404676
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Previously, a failure in converting a parameter while creating a
function would result in an assertion failure. This fixes it to be a
non-fatal error.
Change-Id: I7a526eff9696847f70f0de78e71e7c23488c1254
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404339
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Change-Id: I5309005146b8121528ad23589fa64cc6bf286aee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402578
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Now that the fixed count stroke tessellator has landed, these should
hopefully not regress performance.
Bug: skia:11138
Bug: skia:11139
Change-Id: I1a7d756e2a8a55f9ad4aaed716e4816b342b3b4f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404398
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
A constructor like `float2(one, two)` is not a compile-time constant, so
we miss optimization opportunities like folding. Constant variables
inside compound constructors are now replaced when optimization is on,
so this would optimize down to `float2(1.0, 2.0)` and be eligible for
folding.
Change-Id: I80dd421f61d4eed21278805e2dc26d198a678e52
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404657
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
This handles the case where a filter effect input is StrokePaint or
FillPaint, but the referencing element has a 'none' paint specified
(explicitly or via parsing error, as in the original bug report).
Bug: skia:11213
Change-Id: Ie710a9fc5ccb3c24014735e01c70a0ba42c7a99d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404696
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
This reverts commit a2335098a6.
Reason for revert: it was not breaking chrome roll
Original change's description:
> Revert "Do reordering & memory budgeting after onFlushCB"
>
> This reverts commit 566cf465fc.
>
> Reason for revert: I think this one is the cause
>
> Original change's description:
> > Do reordering & memory budgeting after onFlushCB
> >
> > This allows the CCPR atlas manager to setup its atlas before
> > we do any memory budgeting. That way the atlas size is known.
> >
> > Bug: skia:10877
> > Change-Id: I9d73df29d1e8412b714b00dbf2ebff47025d3e3e
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/403857
> > Commit-Queue: Robert Phillips <robertphillips@google.com>
> > Auto-Submit: Adlai Holler <adlai@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
>
> TBR=robertphillips@google.com,adlai@google.com
>
> Change-Id: Iaf13f8abb060c52df4a6a10ba45896a0a26bc662
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10877
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404476
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>
# Not skipping CQ checks because this is a reland.
Bug: skia:10877
Change-Id: Iec2956bfcd828ad2e329f6d5c6a0732e55341919
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404777
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
The modifier pool is in the Context now and doesn't need to be passed
separately.
Change-Id: I92388ebfd4dfd69360455efa1b1e2558c512a950
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404341
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
This reverts commit 048b5a2967.
Reason for revert: Okay feeling confident this guess is right about who is breaking chrome roll.
Original change's description:
> Transform verts using nonsquare matrices when available.
>
> We were previously doing a square-matrix multiply then discarding one
> third of the result; now, when available, we just get the result we need
> via a non-square multiply.
>
> Change-Id: Ie13ae6f2c7f23e3a4c1f2c4eeb6361a97cdccf67
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/403079
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com,brianosman@google.com,johnstiles@google.com
Change-Id: I5e1026def7e7ade019c2543b6f30387bec1bc004
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404596
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This reverts commit 566cf465fc.
Reason for revert: I think this one is the cause
Original change's description:
> Do reordering & memory budgeting after onFlushCB
>
> This allows the CCPR atlas manager to setup its atlas before
> we do any memory budgeting. That way the atlas size is known.
>
> Bug: skia:10877
> Change-Id: I9d73df29d1e8412b714b00dbf2ebff47025d3e3e
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/403857
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Auto-Submit: Adlai Holler <adlai@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
TBR=robertphillips@google.com,adlai@google.com
Change-Id: Iaf13f8abb060c52df4a6a10ba45896a0a26bc662
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10877
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404476
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
libjpeg-turbo recently released 2.1, and Chromium is now using that
version. Update tests to use the same to verify everything works as
expected.
Update BUILD.gn
Change-Id: I751fb376b4a532d740122f8a4acd0100c42f984e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402276
Commit-Queue: Leon Scroggins <scroggo@google.com>
Auto-Submit: Leon Scroggins <scroggo@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
There's no benefit to isolating each module's modifier pool from each
other. It's simpler and more efficient to lump all the modules'
modifiers into one shared pool which (like the modules themselves)
exists as long as the Compiler does.
Change-Id: I8335a410e788d2c5142b820407beddf5c2663eef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404336
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
The IRGenerator no longer owns the pool of modifiers; they are now
available to any function that has a Context.
Change-Id: I4f2f37ae5e06966bed00107b0483b42b07a454d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404237
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
The Serialization_Typeface and FontMgr_AliasNames tests sometimes fail
on macOS 10.13 and 10.15.7 bots. This is likely fixed on macOS 11,
however in the interest of investigation there should be some attempt at
discovering if the retrieved fonts are actually different and which ones
were retrieved. Improve the reports with additional information about
the typefaces in question.
Change-Id: I0e4354eacf91be1ae98838569e4da9f964dc2ac8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404338
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This removes the templated versions of these operators. This should help
the case where clients would get compiler errors in their code with
errors claiming failed matches to these ganesh operators. The errors were
correct, but would be confusing for clients to see. Now with this change
the various operators are defined for specific types so a client shouldn't
get errors for their own enums anymore.
Bug: chromium:1204688
Change-Id: Ie3450834da7734a161af303ca6c8f458dd173513
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/403596
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This is in preparation for reusing the image loading + aspect ratio
mapping for <feImage>.
Change-Id: I53dcf904476aae386f672488379201524855a703
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404217
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Somewhat subtle, but we were improperly handling the override of the
default subregion via the 'width' and 'height' <fe*> attributes.
Simple example: when specifying 'x' but not 'width', previously we
would use the overridden x (subregion.fLeft = boundaries.fLeft;), but
were not updating subregion.fRight based on the new fLeft value.
Bug: skia:10841
Change-Id: I309de4f0cf50a413ea6a0e7605926a3eb6cd94e2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404205
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
This breaks up the giant IRGenerator::convertFunction method into more-
manageable chunks, moves the functionality into FunctionDeclaration,
and funnels the DSL through it so it receives the same error checking.
Change-Id: Icf2ac650ab3d5276d8c0134062a4e7e220f9bf32
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402778
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
SkGpuDevice still needs to separately ref the context as
GrSurfaceContext has a bare GrRecordingContext pointer. However, it
doesn't need to be separately specified.
Also rm unused SkSpecialSurface_Gpu() width/height params.
Change-Id: Ia24bbce2a85e21277aff2c1c9e1fd37a29246a6e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404236
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This will be used by the upcoming DSLParser, which needs to be able to
put DSLExpression and DSLVar into containers such as std::vector and
std::optional.
Change-Id: I8d367cfd0b3a852a368c69a5b3be6c0eaa41d74a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404156
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
A followup CL also applies this to Pixel5.
Bug: skia:10877
Change-Id: I2344bb1be75c94ed6960f4b13206c8b517f98613
Cq-Include-Trybots: luci.skia.skia.primary:Test-Android-Clang-Pixel4-GPU-Adreno640-arm64-Debug-All-Android_API30,Perf-Android-Clang-Pixel4XL-GPU-Adreno640-arm64-Release-All-Android,Perf-Android-Clang-Pixel4XL-GPU-Adreno640-arm64-Release-All-Android_Vulkan,Test-Android-Clang-Pixel4-GPU-Adreno640-arm64-Debug-All-Android_Vulkan,Test-Android-Clang-Pixel4XL-GPU-Adreno640-arm64-Debug-All-Android,Test-Android-Clang-Pixel4XL-GPU-Adreno640-arm64-Debug-All-Android_Vulkan
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/403636
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
These types had no tests, have never been used, and GLSL doesn't support
byte types.
Change-Id: Id423e3e4790be7f443acc88bce5497470c7d3fd4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404219
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
CCPR atlasing now handles merged tasks correctly so they can work
together happily again.
Bug: skia:10877, skia:11731
Change-Id: Id15c8fc3ed0560150f5c373651f5c583239f3e09
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404136
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Adds aliasing barriers, a texture copy convenience routine, and
subresource support in texture resource state transitions. Also
some minor formatting cleanup.
Change-Id: Ic8ba504350a3f954a21d24a214d9cceb3f5fc44d
Bug: skia:10446
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/403600
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This is a first step towards moving the ModifiersPool out of the
IRGenerator and into the Context.
Change-Id: I8000923f32a9e3cc1878a09464680884b950e513
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404216
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
This allows the CCPR atlas manager to setup its atlas before
we do any memory budgeting. That way the atlas size is known.
Bug: skia:10877
Change-Id: I9d73df29d1e8412b714b00dbf2ebff47025d3e3e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/403857
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
If they are not maintained, then the merge leaves links to
deleted RenderTarget nodes. This creates confusion while
trying to debug.
Change-Id: I9d98a4ed2887573ddc5dfa2bae1bb22d30879c5a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402641
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
We were previously doing a square-matrix multiply then discarding one
third of the result; now, when available, we just get the result we need
via a non-square multiply.
Change-Id: Ie13ae6f2c7f23e3a4c1f2c4eeb6361a97cdccf67
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/403079
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This simplifies our world a lot, especially when reordering/merging
ops tasks. As noted in the comments, this assumes a full flush every
time but the successor – which is coming soon – won't rely on that.
Bug: skia:10877, skia:11948
Change-Id: I1843e80dfee8d7a868c6db4bae94bcd2cbfb5b78
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/403856
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Now that the fixed count stroke tessellator has landed, these should
hopefully not regress performance.
Bug: skia:11138
Bug: skia:11139
Change-Id: Ifdcd817705d394ea6d0f932711ed725a66a7fc91
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/403956
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Bug: skia:11945
Change-Id: I1a8b167c320108392c2a168ad88a92c36b34459f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404118
Commit-Queue: Ravi Mistry <rmistry@google.com>
Reviewed-by: Eric Boren <borenet@google.com>