Bug:1172796
Change-Id: Ifc03709a0f978b4dec6c8f7ea2c721c860167abb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/366337
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This adds a new version of emitFunction that operates directly on an
SkSL::FunctionDeclaration, which saves us the trouble of mapping the
return and parameter types back to the corresponding GrSLType.
It's also a pre-requisite for supporting functions that return or accept
types that can't be mapped like this (eg, structs or enums).
Bug: skia:10939, skia:11246
Change-Id: Ib5d2fb80a983efbf70fe8ce5ac3ba1d769e44d07
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361562
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Also add a unit test that the vectorized version equals the reference
implementation.
Bug: skia:10419
Change-Id: I4d165fd45532e9ec468565d0637fb769b51f5fcd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345122
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Now there is only one op to tessellate a stroke, and it creates its
own GrStrokeIndirectTessellator or GrStrokeHardwareTessellator
internally. This will allow us to dynamically switch into hardware
tessellation when we need to batch strokes that have different
parameters or colors.
Bug: chromium:1172543
Bug: skia:10419
Change-Id: I3cddb855fdbb9ab018785584497c843e3e31b75e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/366056
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This is enforced by ANGLE in Strict ES2 mode; we need to enforce it as
well.
Change-Id: I6e2f547ad8e0ce817742cf84659764cf6bce38b9
Bug: skia:11270
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/366339
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>
I think this was the rough idea? I'm a little fuzzy
on the SkMatrixProvider overloads that concat... I
really don't have a head for matrix transforms.
Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
Bug: skia:11260
Change-Id: I6eb8e4397da035d17fe6b96e5c5494dce0483e26
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365520
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
This reverts commit 38df4c8470.
Reason for revert: updated ArrayTypes test for ES2 compatibility
Original change's description:
> Revert "Improve support for arrays in Metal."
>
> This reverts commit dd904af566.
>
> Reason for revert: breaks ANGLE
>
> Original change's description:
> > Improve support for arrays in Metal.
> >
> > Arrays in Metal now use the `array<T, N>` type instead of the C-style
> > `T[N]` type. This gives them semantics much more in line with GLSL,
> > so they can be initialized and assigned like GLSL arrays.
> >
> > This allows the ArrayTypes and Assignment tests to pass, so they have
> > been added to our dm SkSL tests. (ArrayConstructors also passes, but
> > is not ES2-compliant so it is not enabled.)
> >
> > Change-Id: Id1028311963084befd0e044e11e223af6a064dda
> > Bug: skia:10761, skia:10760, skia:11022, skia:10939
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365699
> > Commit-Queue: John Stiles <johnstiles@google.com>
> > Auto-Submit: John Stiles <johnstiles@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
>
> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com
>
> Change-Id: If6a18dea7d6a45fa7836e9129bf81c2e536f07e3
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10761
> Bug: skia:10760
> Bug: skia:11022
> Bug: skia:10939
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365976
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com
Bug: skia:10761
Bug: skia:10760
Bug: skia:11022
Bug: skia:10939
Change-Id: Ia1c4917f5d3c41162d282b3093814d861707ad30
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/366144
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Takes more care when chopping to make sure cusps are detected and
handled correctly.
Bug: skia:10419
Change-Id: I11f1c31534b3266155e9b47eb0daa5bd676fe2a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365817
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Change-Id: I93e90da7762c379486fd1a329ebf984e93578c69
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364917
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Bug: skia:11226
Change-Id: Ia6a0e86722bc718e6827c0da8ee5035d90a2deb9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365536
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Check that the calculation of the tmp buffer size will not
overflow an int.
Bug=skia:27758
Change-Id: Ie1def7a4bf81f04e3231bfc1bd590f24ba3f5f7f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365487
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This is a reland of fa87f9c7b9
Went back to original approach of checking isFramebufferOnly outside
GrCopyRenderTask::Make().
Original change's description:
> Add backend texture and backend render target versions snapshot GMs
>
> GPU may behave differently depending on whether the SkSurface backing
> store is wrapped and whether it is a texture or not.
>
> Bug: skia:11208
> Change-Id: I5e9921d56c0840cfe34ed2926a55be7460409b23
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364639
> Reviewed-by: Adlai Holler <adlai@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
Bug: skia:11208
Change-Id: I7af6078e904fdd772b97ad3a27e26cab577fc6a3
Cq-Include-Trybots: luci.skia.skia.primary:Test-Ubuntu18-Clang-Golo-GPU-QuadroP400-x86_64-Debug-All-PreAbandonGpuContext
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365702
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Change-Id: Ibb48d30b9c0d80db3bf7b92d8c4a60bd9ce6839d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365696
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This reverts commit dd904af566.
Reason for revert: breaks ANGLE
Original change's description:
> Improve support for arrays in Metal.
>
> Arrays in Metal now use the `array<T, N>` type instead of the C-style
> `T[N]` type. This gives them semantics much more in line with GLSL,
> so they can be initialized and assigned like GLSL arrays.
>
> This allows the ArrayTypes and Assignment tests to pass, so they have
> been added to our dm SkSL tests. (ArrayConstructors also passes, but
> is not ES2-compliant so it is not enabled.)
>
> Change-Id: Id1028311963084befd0e044e11e223af6a064dda
> Bug: skia:10761, skia:10760, skia:11022, skia:10939
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365699
> Commit-Queue: John Stiles <johnstiles@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com
Change-Id: If6a18dea7d6a45fa7836e9129bf81c2e536f07e3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10761
Bug: skia:10760
Bug: skia:11022
Bug: skia:10939
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365976
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
asView may fail in makeTextureImage.
Bug: skia:11208
Change-Id: I31090f8e05aad5cf0d530b31cfac328d3b9ed292
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365700
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Change-Id: I37b7688b660ff4840cfb2bb5ddd348c1ba684fe6
Bug: skia:5039
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365488
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Arrays in Metal now use the `array<T, N>` type instead of the C-style
`T[N]` type. This gives them semantics much more in line with GLSL,
so they can be initialized and assigned like GLSL arrays.
This allows the ArrayTypes and Assignment tests to pass, so they have
been added to our dm SkSL tests. (ArrayConstructors also passes, but
is not ES2-compliant so it is not enabled.)
Change-Id: Id1028311963084befd0e044e11e223af6a064dda
Bug: skia:10761, skia:10760, skia:11022, skia:10939
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365699
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
We now catch this error at IR generation time; previously we'd send it
to the driver (where it would fail to compile).
Change-Id: I45890214ffa164be1c0f359320f942bc4dc479ca
Bug: skia:11265
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365697
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Change-Id: I10184e60617f65a513980e5389f226f2ebe3eb46
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365656
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Add type size so we can check that the UWA failures are
happening on the size boundaries between direct and
SDF, and SDF small to SDF medium.
Bug=skia:11241
Change-Id: I7d0823ab1fb4c9c8db13ba884a2b2454ba4bf210
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365636
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This uncovered a bug in Metal code generation of `matX *= matY` which is
now fixed. (It was emitting the helper function more than once.)
Change-Id: I0aeb0efe7ab5fbf5592a8ca6f4f5b50354d3d7f4
Bug: skia:11262
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365489
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>
This reverts commit fa87f9c7b9.
Reason for revert: assert on n5x/n7
Original change's description:
> Add backend texture and backend render target versions snapshot GMs
>
> GPU may behave differently depending on whether the SkSurface backing
> store is wrapped and whether it is a texture or not.
>
> Bug: skia:11208
> Change-Id: I5e9921d56c0840cfe34ed2926a55be7460409b23
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364639
> Reviewed-by: Adlai Holler <adlai@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
Change-Id: Id1488586e2d17cdce35f95ea6aa9b2bffd9218d0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11208
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365698
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Adds in methods that allow us to set push constants through
the command buffer.
Change-Id: I8c238d2e46d92d128d91d87f7225bca099e9117a
Bug: skia:5039
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364856
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This reverts commit 30b355a49e.
Reason for revert: relanding with fix
Original change's description:
> Revert "Remove gpu buffer reads from default path renderer."
>
> This reverts commit 64241b8edb.
>
> Reason for revert: hitting new assert on starting point
>
> Original change's description:
> > Remove gpu buffer reads from default path renderer.
> >
> > I don't actually expect to see much perf gain from this one because the
> > reads happen when we've run out of space in our vertex buffer and need
> > a new allocation. So they happen pretty rarely.
> >
> > Change-Id: Iabe2e7cebf363659180409075a1a7fc6c03d0a22
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364618
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > Reviewed-by: Chris Dalton <csmartdalton@google.com>
>
> TBR=egdaniel@google.com,csmartdalton@google.com
>
> Change-Id: I4c160ee692222f7c64cc63db2044fdc958eae551
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365482
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,csmartdalton@google.com
# Not skipping CQ checks because this is a reland.
Change-Id: I97d613ca9adef0d425cc5ab22923d95297ca0afe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365486
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
separate pass.
This makes things easier for the DSL, which allows us to create
nodes without knowing whether they're going to be valid until they
are inserted. Moving these checks into a separate pass allows the
DSL to use the same error handling and type coercion as the normal
code path.
Change-Id: I9c26bd7a15a6c819df39a2214fdeab47ed6d8ee4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362496
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: Ethan Nicholas <ethannicholas@google.com>
Make SkImage_Gpu and SkImage_GpuYUVA have their own implementations
rather than sharing one in SkImage_GpuBase.
New function takes a GrImageTexGenPolicy to enable caller to
force a new texture to be made and choose it's budgeting status rather
than receive a cached view or a view owned by the image.
It also communicates any color type changes when converting a non-
texture image to a texture.
Bug: skia:11208
Change-Id: I6b389442bf9752276a83b21021070e3190610cd7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361356
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This allows us to control the inline threshold of runtime effects in a
thread-safe way.
The new Make API now returns a struct, for readability; the old Make API
continues to return a tuple.
The old Make function is deprecated and subject to removal. You can
migrate to the new API by passing a default-constructed Options struct.
In this case there will be no difference in behavior.
Change-Id: Ic62d6f294f596d0a61095e35a87ccdbbe0b1cf93
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363785
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
GPU may behave differently depending on whether the SkSurface backing
store is wrapped and whether it is a texture or not.
Bug: skia:11208
Change-Id: I5e9921d56c0840cfe34ed2926a55be7460409b23
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364639
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Our unreachable-code analysis contained a one-off workaround to ignore
the `false` expression in `do {...} while (false)`, because this
construct was synthesized by the inliner. However, the inliner no longer
generates do-while loops, and we have BasicBlock::fAllowUnreachable to
flag blocks as potentially-not-reachable. So this check no longer added
value, and removing it doesn't affect any tests.
Change-Id: Idb94be2497d9ead377531b5d5e961d279940fc88
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365477
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>
This reverts commit 64241b8edb.
Reason for revert: hitting new assert on starting point
Original change's description:
> Remove gpu buffer reads from default path renderer.
>
> I don't actually expect to see much perf gain from this one because the
> reads happen when we've run out of space in our vertex buffer and need
> a new allocation. So they happen pretty rarely.
>
> Change-Id: Iabe2e7cebf363659180409075a1a7fc6c03d0a22
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364618
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Chris Dalton <csmartdalton@google.com>
TBR=egdaniel@google.com,csmartdalton@google.com
Change-Id: I4c160ee692222f7c64cc63db2044fdc958eae551
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365482
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
I don't actually expect to see much perf gain from this one because the
reads happen when we've run out of space in our vertex buffer and need
a new allocation. So they happen pretty rarely.
Change-Id: Iabe2e7cebf363659180409075a1a7fc6c03d0a22
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364618
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Change-Id: Idf3f95ce3d0467c8273c627227c2e6bb16d04614
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364837
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
The goal here is remove the need for all the specialized vulkan buffer
subclasses and to not have the new class use GrVkResources for tracking
lifetime on command buffers.
This CL just makes the new class and it is not actually used by anything
yet.
Bug: skia:11226
Change-Id: I5f8d8d112af773ba1e8da17e07e75f6f4100e927
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364617
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Change-Id: Idb2f6a3131824ffe29275fe669b5c1688867d448
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364620
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Existing call sites have been converted to the SK_ABORT macro.
The sksl_abort() function is no longer referenced and has been removed.
Change-Id: Idf94ce2523e37b62ce87b60afc5d121b9ad29627
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364858
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Change-Id: I4b11aaa8299a4aa2753097c26936e0176189f1db
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364641
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>
ABORT will be tackled in a followup CL since, unlike the others, it is
heavily used.
Change-Id: I96c092b6c07a3311cf8467b960b8f5e32c2074cb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364640
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>
For now we simplify every stroke at the beginning of drawShape*, but in
the future we will give the tessellator a chance to claim stroked shapes
before simplifying the stroke.
Bug: chromium:1172543
Change-Id: Ie90c20a1d342661b9006b16ab1fdad3ebe290ba3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362798
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
DSLStatement contained an unnecessary import of SkSLIRNode.h and
referenced SkSL::Expression without declaring it.
Change-Id: I88391276a1c3cd10430ee4c6c63f3e2093e338b4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364603
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This is just a few miscellaneous buffer changes to make future changes
around switching buffer classes cleaner.
Bug: skia:11226
Change-Id: Icba3b9b5b357956d78f95398cdce9e8733080028
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364616
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This is an experiment to try and get better/different/earlier crashes on
two Android devices that appear to have driver memory corruption bugs.
Bug chromium:1147008, chromium:1164271
Change-Id: I163e045c4b0ec46e89891c24f3c10f7031e7e8db
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364601
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Going to use this to enable some possible workarounds and investigatory
CLs for chromium crash bugs.
Bug: chromium:1147008, chromium:1164271
Change-Id: Ia7b23765d3ab14edf64d823b8a8adf1622b8ac62
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364600
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This will be used by the DSL.
Change-Id: Iadc5d06fd463b08cf6edf954f03aaf8ffa1fa56b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364578
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Bug: skia:7650
Change-Id: Ia16f169efdb6be2ce381b9ab3b7f6fcecda26312
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363799
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Mike Reed <reed@google.com>
In theory, any class could be participate in our pool by subclassing
from Poolable. In practice, IRNode already serves as a good foundational
base class, but this gives us a cleaner division of responsibility.
Change-Id: I17e99caf08bce89bb4d089bf0157106001d5db46
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364118
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>
Bug: chromium:1172543
Change-Id: I442919070a70ed97d93cc66db81be3a67d615203
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362796
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Bug: chromium:1172543
Change-Id: I1f9c06c96e9ec41098fe27d7cdf3438055c8feb4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362797
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
These are basic vector types, required by GLSL ES2, but we could not
create helper functions using them because they were missing from our
GrSLType enum. (This also prevented Runtime Effects from using these
types in helper functions.)
Change-Id: I78c328499e8ed90cb29c641b90ee59460a5a45de
Bug: skia:11246
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364036
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Currently non of the backends are directly holding ownership of the new
sk_sp, but in follow on CLs will start having the buffers be tracked
on the command buffer via these refs.
Bug: skia:11232
Change-Id: I894f1672868061636286569d999dbe97456342a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364016
Reviewed-by: Brian Salomon <bsalomon@google.com>
We already had this trick for scalar integers, this extends it to
integer vectors. As with prior work in this area, it would be better to
detect this case and produce an error, but now we at least produce
consistent and well-defined results (rather than undefined signed
integer overflow).
Bug: skia:10932
Bug: oss-fuzz:29494
Change-Id: I45526fe96b6ea42c0e88b9862f6961b316810321
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363962
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Previously this would report success but may have rounded the
rowbytes down to a multiple of bpp prior to writing the dst.
On GPU it could trigger an assert in a debug build.
Bug: chromium:1163061
Change-Id: I19709f4cdb71139732998a4dd2e14476099f0ba8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363782
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Reed <reed@google.com>
This reverts commit 864465765b.
Reason for revert: fix: check tiling before call refView()
Original change's description:
> Revert "Remove SkImage_Base::refPinnedImage(), use refView() instead."
>
> This reverts commit 9f899ac9ed.
>
> Reason for revert: broke ios bot?
>
> Original change's description:
> > Remove SkImage_Base::refPinnedImage(), use refView() instead.
> >
> > Also use refView() for lazy/raster images as well rather than creating
> > a GrTextureProducer class outside the image.
> >
> > Bug: skia:11208
> >
> > Change-Id: Iee628c337bc1b4cfcccd78eaba98589757bb55ab
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360980
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
>
> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
>
> Change-Id: Iab4851f5cefdca853e16c030ec67238c55c69aa2
> Cq-Include-Trybots: luci.skia.skia.primary:Test-iOS-Clang-iPhone6-GPU-PowerVRGX6450-arm64-Release-All-Metal
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361838
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
# Not skipping CQ checks because this is a reland.
Change-Id: Ib0405bd99a3875a40f6f75b9e785e073ba48605d
Cq-Include-Trybots: luci.skia.skia.primary:Canary-Android
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362036
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Every GPU API defines things this way, but C++ does not (until C++20).
Forcing the shift-as-unsigned prevents UBSAN warnings.
Bug: oss-fuzz:29093
Change-Id: Ie82e25c46e28446ffc42a40172ca6b272bf1c362
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363937
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
The equivalent functionality is available in
include/effects/SkImageFilters.h via SkImageFilters::MatrixTransform.
Bug: skia:11230
Change-Id: I77b78d508d653a32c913a7599f1004ab634e3e6d
Docs-Preview: https://skia.org/?cl=361497
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361497
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Trying to make its results scale-independent. Otherwise we can propagate
convexity in path.transform() but (if measured) actually have a
different result.
Bug: skia:11227
Change-Id: I874597a58c8c4d670e9d4a357a6a92b60a164291
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360597
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
SkVMCodeGenerator was lacking support for the comma operator entirely;
this has now been implemented.
Change-Id: I9350f54e6ee52764c620116e6dbfe4ca3e9cd47e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363096
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Change-Id: I2c430d424d28de707fb01e05891b14c7a5751504
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363857
Commit-Queue: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
On windows vulkan I am seeing 3x perf gains on svgs and skps that
heavily use convex paths.
Change-Id: I6bb98846809f33cc6033964bfadb082ed225e7f2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362677
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This is a reland of 07d8c0d11c
Original change's description:
> Make GrDirectContext::updateBackendTexture handle pixmaps with non-type row bytes.
>
> Some GL contexts don't support GL_UNPACK_ROW_LENGTH and we must
> copy the src data to a pixmap with tight row bytes.
>
> Bug: chromium:1170392
>
> Change-Id: I4590f20dbc80cb792f30f0059536716cf106f6c3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361717
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
Bug: chromium:1170392
Change-Id: I6fb759c35f86d816b16694b00edaa1116a446d15
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363099
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This reverts commit 07d8c0d11c.
Reason for revert: Looks like failures on PowerVR? (Test-Android-Clang-TecnoSpark3Pro-GPU-PowerVRGE8320-arm-Release-All-Android)
Original change's description:
> Make GrDirectContext::updateBackendTexture handle pixmaps with non-type row bytes.
>
> Some GL contexts don't support GL_UNPACK_ROW_LENGTH and we must
> copy the src data to a pixmap with tight row bytes.
>
> Bug: chromium:1170392
>
> Change-Id: I4590f20dbc80cb792f30f0059536716cf106f6c3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361717
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com,robertphillips@google.com
Change-Id: Ie5791bf19b993d46383c5b837b948584487c0496
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1170392
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363037
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Moves the (SkRect + flags) struct into SkImageFilter_Base with protected
access only. Base constructor and all src/effects/imagefilters Make
functions now take a "const SkRect*" instead. CropRect is still what's
stored and used by filter implementations during filterImage(), but it's
no longer publicly available.
The SkImageFilters factory implementations now can go straight to the
Make functions in src/effects/imagefilters instead of wrapping its
"const SkRect*" in an SkImageFilter::CropRect.
Bug: skia:9296, skia:11230
Change-Id: I2c62f42031910ec405623d4519c8a434cd2b3bdd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361496
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
This reverts commit c48a23d774.
Reason for revert: Possibly breaking some builds on android roll
Original change's description:
> Initial support for DSL FPs
>
> Change-Id: I1abbe881f925ac6db4f7d672a391aadd349a33b5
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361556
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>
TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com
Change-Id: Ia76b24293ab676fbf9e43f470cf3c3d6b96b2d34
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362696
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
I happened to notice this snprintf come up on a profile.
I almost deleted this code and SkPathOpsDebug::MathematicaIze,
but then I realized once I start I'd end up tearing out all
this stuff.
Change-Id: Ifbb996e530990713f544b60a6cd955b219e8766a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362476
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Herb Derby <herb@google.com>
As we start moving backends to tracking resources on command buffers by using
GrGpuResources, we need to make sure we don't release this resources from the
cache during teardown until they have finished on the gpu. Thus this CL adds
a way for the GrDirectContext to tell the GrGpu to finish all outstanding
work.
Bug: skia:11232
Change-Id: I953d89f514ad32f1d2c57279a670b336d7575ffe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361457
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Some GL contexts don't support GL_UNPACK_ROW_LENGTH and we must
copy the src data to a pixmap with tight row bytes.
Bug: chromium:1170392
Change-Id: I4590f20dbc80cb792f30f0059536716cf106f6c3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361717
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This reverts commit 0bad6cf145.
Reason for revert: breaking perf bot!?!?
Original change's description:
> Remove maxTileSize from GrCaps, bleed GMs use max texture size override.
>
> This existed to enable shader-based versions of the old bleed GM that no
> longer exist. It is currently making it harder to simplify image->view
> consolidation without accidentally limiting the testing. This is because
> an attempt to create a texture from a bitmap will succeed if max texture
> size is not overridden by the test.
>
> Bug: skia:11208
> Change-Id: I432d1d2ab66c1e888c9d77583b3c9a9d673e7e8f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360609
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
TBR=bsalomon@google.com,robertphillips@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: skia:11208
Change-Id: Ib8643aec37ac312ac0a2fb834cc3dbf116f7a898
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362099
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Specifically make sure it is true that we only write to static and stream
access buffers once.
Bug: skia:11226
Change-Id: I566a095093e884075bc4bee07ba1101e772e3332
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360476
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This doesn't change any behavior. I just noticed that getLValue already
had all the variable-loading logic, so we could just share the code
instead of implementing it separately.
Change-Id: Ib921a35f4fc531351717db60f8bd086498de4810
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361519
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This reverts commit 9f899ac9ed.
Reason for revert: broke ios bot?
Original change's description:
> Remove SkImage_Base::refPinnedImage(), use refView() instead.
>
> Also use refView() for lazy/raster images as well rather than creating
> a GrTextureProducer class outside the image.
>
> Bug: skia:11208
>
> Change-Id: Iee628c337bc1b4cfcccd78eaba98589757bb55ab
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360980
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
Change-Id: Iab4851f5cefdca853e16c030ec67238c55c69aa2
Cq-Include-Trybots: luci.skia.skia.primary:Test-iOS-Clang-iPhone6-GPU-PowerVRGX6450-arm64-Release-All-Metal
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361838
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Change-Id: Ibe9c2a3fb52b1a18895c1a61bdb296351b989537
Bug: skia:5039
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361456
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Previously, a uniform not wrapped in an interface block would report a
SPIR-V error:
"Variables identified with the Uniform storage class are
used to access transparent buffer backed resources. Such variables must
be typed as OpTypeStruct, or an array of this type..."
Now, the SPIR-V code generator automatically detects such global
variables and synthesizes a struct named _UniformBuffer to hold them.
When these variables are accessed, an OpAccessChain instruction is added
to grab the variable out of the struct.
Change-Id: I5e852d4de01b866c291506cc8cf6eb547f097d66
Bug: skia:11225
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360776
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Change-Id: I2c1c09d07a12e0382633e7e12750a4672f21bbda
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360416
Auto-Submit: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Previously, structs that were defined as part of a variable declaration
would end up declared similarly in the generated code. Now, global
variable declarations that include a struct definition generate two
separate program elements.
Bug: skia:11228
Change-Id: Id7ddde6931fe07a250c2c9c46153879005535fb3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361359
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Also use refView() for lazy/raster images as well rather than creating
a GrTextureProducer class outside the image.
Bug: skia:11208
Change-Id: Iee628c337bc1b4cfcccd78eaba98589757bb55ab
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360980
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This allows interface blocks in Metal to compile even if
`layout(binding=...)` is not specified. It will also be used in SPIR-V
in the followup CL, when an interface block is automatically synthesized
for top-level uniforms.
This CL also reorganizes the unit tests around uniforms a bit.
Change-Id: Ia898c536b454dda6f51677e232a8f6e6c3606022
Bug: skia:11225
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360778
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Simplifies the op to always triangulate the inner fan. We ensure this
will always work by using breadcrumb triangles. Also removes the
fail-on-non-simple mode from GrInnerFanTriangulator since it isn't
being used anymore.
Bug: skia:10419
Change-Id: Idb849712bf2bc4e5ef785bc3f9b8db03119d230e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359565
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Pre-cleanup as I start looking at how structs are parsed and handled in
the IR.
Bug: skia:11228
Change-Id: I6334d1073211cbbdf69ddffa8df420c45fd59fcc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361059
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Change-Id: Ibc995e908e5b4f8d1516e13d56854a4fcf5cc809
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360556
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This existed to enable shader-based versions of the old bleed GM that no
longer exist. It is currently making it harder to simplify image->view
consolidation without accidentally limiting the testing. This is because
an attempt to create a texture from a bitmap will succeed if max texture
size is not overridden by the test.
Bug: skia:11208
Change-Id: I432d1d2ab66c1e888c9d77583b3c9a9d673e7e8f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360609
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This is used to decide when we can keep the convex bit during
path.transform. This new version is much faster than the old,
but can return a false negative if there are multiple contours.
However, the caller now only calls this if the path is known to
be convex, so there should never be multiple contours.
This, along with
https://skia-review.googlesource.com/c/skia/+/359837
make path.transform() approx 2x faster
Bug: skia:11227
Change-Id: Ied7ca97d87b9224a3ecd9b77b22b823964809a52
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359916
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Marks its methods const and lifts the breadcrumb list out into
function arguments. This is one more step toward the final vision
where GrTriangulator just has an allocator and control knobs, and
everything else is functional.
Bug: skia:10419
Change-Id: I77341c045d481da49ebfee06de5dfc7a2a8a07be
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360956
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Bug: skia:9310
Change-Id: I387f0251f05a2b6f2bc5a759f608d5766ed11ce2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357285
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Switch away from views, and add support for simulating
used-proxies. The latter will be used in an upcoming CL.
Bug: skia:10877
Change-Id: I7897516dc53c075a286cce8f31075d8cc93abccf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360604
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Removes a use case of SkImage_Base::view().
This forces a RGBA flattening image which seems like an undesirable
side effect. If clients need the textures backing these image types
we should provide a query for GrYUVABackendTextures instead that
could return the whole set.
Bug: skia:11208
Bug: skia:9570
Change-Id: I085e5212b69fef7a53fb1606aecfb6f7f0e7c740
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360418
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
These have a kind of neat way of encoding the lane index, using the Q
bit to pick the lower or upper 64 bits of the register, then the S bit
to pick the 32-bit lane within those 64 bits. Usually Q=1 distinguishes
a 128-bit op from a Q=0 64-bit op, so its repurposing here is at first
surprising, but actually very fitting.
I'd eventually like load64/128 to use these like this:
Reg tmp0 = alloc_tmp(2),
tmp1 = (Reg)(tmp0+1);
if (scalar) { a->ld24s(tmp0, arg[immA], 0); }
else { a->ld24s(tmp0, arg[immA] ); }
mark_tmp_as_dst(tmp0, tmp1);
where the mechanism to track up to four registers per value and
implement mark_tmp_as_dst(...) for more than one argument is what I'm
still working on.
Change-Id: I944e571de19f65d41f462406ce35f0f2a35bb381
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360700
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Change-Id: I0c343167e63f147f21afee805ea934bd5f161024
Bug: chromium:1170700
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360608
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Part of effort to consolidate access to GPU SkImage texture proxies.
Bug: skia:11208
Change-Id: Icfcf6fea6be6f05220a5ddd1482f88dafe1cbd9d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359836
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Previously, we reimplemented get_storage_class almost verbatim in
writeGlobalVar. A few tiny tweaks allowed this logic to be deduplicated.
Change-Id: I9f7bb24c53f5249ea4e2e87ea8d18ff7b7150ed8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360598
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
SkTHashMap->remove does not like if you try to remove
an entry that isn't in there. In that case, we don't
want to do anything.
Bug: skia:10877
Change-Id: Ib87aac7a132c78915ec18724f847c44c2c3efa80
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360596
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
Change-Id: Ia0bc034a9360c03d74d97923f4a963aaa09fb58e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360577
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>
The old code only handled swizzles as the outermost expression(s) in an
lvalue. The new code removes that restriction, and puts all the logic in
writeStore, which is the only place it needs to exist.
The newly added test asserted before, and now passes.
Bug: skia:11178
Change-Id: I8083d9d478ad4dc993cb963d34a97c10965831b5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358956
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Evaluating either kind of expression now works like all other
expressions - evaluate the inner part, then work with the resulting
values. Added unit tests for both of these that previously failed.
With this change, writeVariableExpression is only used for
VariableReference expressions, so adjust that, too.
Reland now safe, after fix to Value::operator[]
This reverts commit 1ea6d6051e.
Bug: skia:11178
Cq-Include-Trybots: luci.skia.skia.primary:Test-Debian10-GCC-GCE-CPU-AVX2-x86-Debug-All-Docker
Change-Id: I14782fcdfef33a47a46334447c5847976721b21f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359564
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
An upcoming change to SkVMGenerator triggers a gcc-8 x86-only bug. This
change prevents that, by limiting the conversions back and forth from
size_t to int (particularly here, where the original value is also
stored using a bitfield).
Change-Id: Ie7f8f3322dd387b0627ab2b2325ce7d82ce6be39
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359563
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
It's very easy to add intrinsics to the VM generator this way, (and
there are others that can't be written in SkSL itself), so this makes
everything consistent.
Bug: skia:10913
Change-Id: I1fcd0047136459f1f6aee2cf4fd87e875edb7e3d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348879
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This creates a helper function, _entrypoint, which invokes main() and
assigns its result into sk_FragColor. We also make sure to prevent
sk_FragColor from being dead-stripped from the code during IR
generation.
At present this is useful for allowing our SkSL test shaders to compile.
Change-Id: I2d7fab0e1959a77778ffdb18ca569e869bcaeece
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358525
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This lets us use descriptive names like `colorRed` and `colorGreen`
instead of `half4(1,0,0,1)` and `half4(0,1,0,1)`. It also lets us use
actual unknown values instead of synthesizing sorta-kinda-unknowns by
calling sqrt.
Change-Id: I61481c33b7ff42182955777b05cfa5fcc13e0efc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359567
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This allows uniforms to be specified without an explicit `layout(set=N)`
modifier. They will assume a default set value instead.
This turns out to fix a handful of tests in Metal/SPIR-V which were
written with GLSL in mind, or adapted from real generated GLSL code, and
didn't have layout information specified on their uniforms. It will also
make it easier to write SkSL tests using uniforms that can compile
either as a runtime effect or as plain Metal/SPIR-V code.
Change-Id: Id79ec06f278b913a45c09c2e6211195dc98b42c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359838
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
CoreText reports weight on a [-1.0, 1.0] scale with 0 being 'regular'.
Unfortunately the mapping from the [1, 1000] scale more commonly used
is not uniform and also varies between system fonts and fonts created
from data. For system fonts the NSFontWeight values will be used if
available, but there is no corresponding API for fonts created from
data. Previously the values for fonts created from data were hardcoded,
but the values have changed again recently. Directly read these values
by varying the weight in the font data, creating a CTFontDescriptor from
this data, and then using the value reported by CoreText.
Bug: skia:11176
Change-Id: I071e2ff7ac3f676c8395b13aa82dde7a97fdf2ce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358535
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Previously, we would emit nothing at all, but that is not actually
valid if the Block is a child statement (e.g. the body of a loop).
Now we emit braces for empty blocks, even if the block was unscoped.
Change-Id: I456a8d7d306a3e59d85e39f80b9f15fe3347ea19
Bug: skia:11218
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359562
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
This reverts commit 1eea1ea8c1.
Reason for revert: fixed implicit copy cons
Original change's description:
> Revert "Write pixels goes through GrRenderTask system."
>
> This reverts commit 27efe6cb1e.
>
> Reason for revert: wasm compile
>
> Original change's description:
> > Write pixels goes through GrRenderTask system.
> >
> > The specific motivation is to remove some uses of GrResourceProvider
> > making textures with data in lazy callbacks. But it's a general
> > improvement that could allow use cases like writePixels in DDL
> > recordings.
> >
> > Bug: skia:11204
> >
> > Change-Id: Ic55c3f75976a1d3a7d93981e21be75a3053ef069
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356845
> > Reviewed-by: Adlai Holler <adlai@google.com>
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
>
> TBR=bsalomon@google.com,adlai@google.com
>
> Change-Id: I116caf1e4dd9015270b9d4f810bd26e0e30a6497
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:11204
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359559
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com,adlai@google.com
# Not skipping CQ checks because this is a reland.
Bug: skia:11204
Change-Id: I7d8f92415995f03301ffb147500d972e6bd17640
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359561
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Adds a new op, GrPathStencilFillOp, that is a greatly simplified
rewrite of GrPathTessellateOp without inner fan triangulation. This op
is a very simple Redbook method built on tessellation. For now we
leave GrPathTessellateOp as-is. The next CL will change it to do inner
fan triangulation exclusively.
Bug: skia:10419
Change-Id: Ia67f4ab038a541e6454f5bf304ecd3c1d8805427
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357138
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
and add a default implementation of onResetContext (which only the GL backend implements)
Change-Id: I20bb4cd2a60dba3200fc8ef4c9e4fd6a9f54ceef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359497
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Change-Id: I4e771083e90f3c60b61f7ce7c8e6697e7bf7c7e1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358518
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This reverts commit 27efe6cb1e.
Reason for revert: wasm compile
Original change's description:
> Write pixels goes through GrRenderTask system.
>
> The specific motivation is to remove some uses of GrResourceProvider
> making textures with data in lazy callbacks. But it's a general
> improvement that could allow use cases like writePixels in DDL
> recordings.
>
> Bug: skia:11204
>
> Change-Id: Ic55c3f75976a1d3a7d93981e21be75a3053ef069
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356845
> Reviewed-by: Adlai Holler <adlai@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com,adlai@google.com
Change-Id: I116caf1e4dd9015270b9d4f810bd26e0e30a6497
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11204
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359559
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
The specific motivation is to remove some uses of GrResourceProvider
making textures with data in lazy callbacks. But it's a general
improvement that could allow use cases like writePixels in DDL
recordings.
Bug: skia:11204
Change-Id: Ic55c3f75976a1d3a7d93981e21be75a3053ef069
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356845
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
In GLSL and SkSL, control statements don't require explicit braces
around single-statement children. That is, the `match = true` child
statement here doesn't need to be braced.
if (condition) match = true;
Because there are no braces, we never create a Block or a dedicated
SymbolTable here. This is normally not a problem, but the fuzzer
discovered that it can dump things into the symbol table inside a child
statement:
if (condition) int newSymbol;
This becomes problematic because the symbol name now outlives its block.
This means `newSymbol` can be referred to later, which should be illegal
(and can cause the optimizer to blow up since the structure is bogus).
There doesn't seem to be any reason to allow this code to compile; the
user can add an explicit scope here to make it reasonable, and it's
(almost) meaningless to declare a symbol that's instantly going to fall
out of scope. This code is now rejected with an error message.
Change-Id: I44778e5b59652d345b10eecd4c88efbf7d86a5e0
Bug: oss-fuzz:29849
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358960
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
The prior CL 358522 was reverted due to relying on
moving SkArenaAlloc which does not work.
This folds in cleanup CL 358156 also.
Bug: skia:10877
Change-Id: I0a29848f0fccb7d6a8f18d307b9f6b6a0311c83a
Cq-Include-Trybots: luci.skia.skia.primary:Build-Debian10-EMCC-wasm-Release-WasmGMTests
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358527
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Splitting its name in half makes it difficult to find when searching the
codebase, for almost no benefit.
Change-Id: I6f1558558bfc6801c19a12116324c35f42111442
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359136
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
The previous change caused varDeclarations() to sometimes return an
expression-statement. This only made sense in the context of being
called from Parser::statement(). Other places which called
varDeclarations() expect vardecls and nothing else.
Change-Id: I562657cadfa20dcd77b527f2dc43dca0c6bf389f
Bug: oss-fuzz:29845
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358528
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This reverts commit f619079545.
Reason for revert: Some bots unhappy.
Original change's description:
> Fix field access and indexing of complex expressions
>
> Evaluating either kind of expression now works like all other
> expressions - evaluate the inner part, then work with the resulting
> values. Added unit tests for both of these that previously failed.
>
> With this change, writeVariableExpression is only used for
> VariableReference expressions, so adjust that, too.
>
> Bug: skia:11178
> Change-Id: Ia595be473b55f4bb03ec25897f9929835177257c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358529
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
TBR=mtklein@google.com,brianosman@google.com,johnstiles@google.com
Change-Id: I56776139f9164b24b35a93307774e9b12c50054e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11178
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358959
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Part of the larger work to remove drawImage from canvas (and in general
simplify our apis w.r.t. older patterns like skbitmap).
Change-Id: If208927e1d46256519036c42e68aec3d3c809a82
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358836
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Change-Id: I59821d748768d74b251d9339787f193c23e3d4dc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358526
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Ethan Nicholas <ethannicholas@google.com>
Evaluating either kind of expression now works like all other
expressions - evaluate the inner part, then work with the resulting
values. Added unit tests for both of these that previously failed.
With this change, writeVariableExpression is only used for
VariableReference expressions, so adjust that, too.
Bug: skia:11178
Change-Id: Ia595be473b55f4bb03ec25897f9929835177257c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358529
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
There are SkColorTypes (e.g. kBGR_101010x) that don't have Gr equivs.
When a SkPixmap is converted to GrPixmap we will have a kUnknown color
type.
Bug: chromium:1164705
Change-Id: Iefa2c8363582433a531c5501aa251c571b5a6eab
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358521
Auto-Submit: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This reverts commit 3b5b7d1178.
Reason for revert: Arenas cant be moved
Original change's description:
> Merge adjacent GrOpsTasks with same target together
>
> This allows the ops tasks to make one render pass instead of multiple.
> The only case where this merging is needed is as a result of
> reordering (reduceOpsTaskSplitting).
>
> Bug: skia:10877
> Change-Id: Ia967ead6efc43f7d2c1da58f770d3987da690cda
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353656
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>
TBR=egdaniel@google.com,robertphillips@google.com,adlai@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: skia:10877
Change-Id: I6d1813ee1c28bc43dffb0a5f26dba4a5c41c637f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358522
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
This attempt to retain a std::move'd value was inadvertently left in
place in a previous CL. It's harmless, but should have been removed.
Change-Id: I485e0f14d921fe6c87a62520c7478a28e8ce28d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358517
Auto-Submit: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Will be needed for repositionable DDLs.
Change-Id: I6dacf51bd36cfbe1c54a9350987f17a6d18cf3c4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357776
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Allows creation of an image directly from a RTE. Caller provides the
effect input bindings, image info for the image, and optional local
matrix.
The info's alpha type and colorspace are tags for the output image. No
alpha type or color space conversions are applied to the output of RTE.
CPU does not yet support making kUnpremul images.
Bug: chromium:1151490
Change-Id: I69babc9dbbce4431d756cd7a3eef4753e727d6fe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357284
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
For the tessellation op this allows it to use either the record-time
or flush-time allocator instead of making its own.
Bug: skia:10419
Change-Id: Ida13283feffda1976bd8fd221d5be0013a5de990
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356516
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Temporarily puts inner fan triangulation behind a flag so we can
disable it for the atlas. The next CL will do the same thing by
creating an op that doesn't triangulate, but making the functional
change in this CL allows us to triage the diffs ahead of time. It will
also ensure the next CL doesn't introduce any others diffs.
Bug: skia:10419
Change-Id: Ia498957c53e83fe40aa797cadace171902dbf548
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357137
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
We can load into two or four adjacent registers from alloc_tmp(N) and
then simply name the right one as our output, discarding the others.
This still has the major TODO of returning all two/four registers at
once, eliminating the immB selector and the redundant memory traffic.
Expect changes towards support for up to 4 Vals per Op next week.
Change-Id: I94846d15ac59d4018c1c9d136c17833e5091f8cf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357305
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This allows us to write SkSL shaders which are valid both for use as
Runtime Effect, and for compilation with skslc targeting Metal.
Change-Id: I74e125d81865d4092e657a7d9948d2e72054bda5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357777
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>
(and Ternary for good measure)
Change-Id: I4afa121d54ab9ba8d0814693ce53da7cb73ef340
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353626
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Added asserts that verify we don't try to emit the same struct or array
with two different memory layout rules. Some code paths were failing to
inspect the associated variable, leading to incorrect errors about the
attached offsets of members.
Added a test case that triggered that error, and also triggers the new
asserts.
Then, fixed the underlying cause: writing out the struct definition as a
side effect of accessing a member in getLValue().
Bug: skia:11205
Change-Id: I6e5fb76ea918ec9ff10425f2d519ddbc54404b27
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357436
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
This allows the ops tasks to make one render pass instead of multiple.
The only case where this merging is needed is as a result of
reordering (reduceOpsTaskSplitting).
Bug: skia:10877
Change-Id: Ia967ead6efc43f7d2c1da58f770d3987da690cda
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353656
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
1. Removes clamping of spotlight's specular exponent, which is not the
specified behavior of feSpotLight in SVG.
(note: we never clamped a specular lighting effect's
specular exponent/shininess parameter, although SVG 1.1 does clamp
that; that is the client's responsibility).
2. Fixes a bug in the GPU implementation of scale factor for spot lights.
3. Saturate computed lighting color after multiplying with color scale,
instead of just saturating the color scale (allows high intensity
lights to saturate to white which is more reasonable approximation of
an HDR effect stored in an LDR color).
Note: fixes 1 and 2 were originally addressed in https://bugs.chromium.org/p/chromium/issues/detail?id=472849
but the change was reverted for layout failure reasons and it was never
relanded after rebasing.
Note2: most of the layout test rebaselines necessary for chrome are
minor and related to fix 2. The exception is svg/dynamic-updates/SVGFESpecularLightingElement-dom-kernelUnitLength-attr.html
which is the result of fix 3. It took a little digging, but I believe
that fix 3 actually makes that generated SVG more correct (it's original
expected image was "wrong").
In that test, it has a specular constant of 4 (which is a multiplier)
and a shininess of 1 (which makes it practically a "diffuse" specular).
So basically we are multiplying the greenYellow color by 4 for most of
the image that has a normal pointing out of the screen. Firefox renders
a similarly yellow oversaturated appearance instead of clamping to the
base greenYellow.
Reading the feSpecularLighting spec, there is no saturation that is
specified where it had been performed before this change. Instead, all
that is mentioned is that the results of a given filter have to be pinned
to the color channel range (e.g. the last step).
Bug: skia:11007, skia:11057, skia:11153
Change-Id: I82e4a6f1742fecea59816fda75eb931c2a51d3e1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/355496
Reviewed-by: Fredrik Söderquist <fs@opera.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
We now search for a block of N adjacent registers that minimizes the
number of spills, where unspillable registers are counted as if
infinitely expensive.
On arm64, store64 now uses alloc_tmp(2) and st2.4s, and similarly
store128 uses alloc_tmp(4) and st4.4s.
For the purposes of arm64 instructions we could allow the block to wrap
around the register file mod 32, but I figured that probably wasn't
necessary and might be confusing to follow. If we're right on the edge
some day we could circle back.
I'm not sure yet if our register-pair use cases on x86-64 will ever care
that the registers are adjacent, but it doesn't hurt to start that way.
This should behave pretty much the same when N=1 except that we're not
doing any interesting tie-breaking when all registers are occupied. I
left a TODO, but I bet we'll never feel the need to follow up on it.
Change-Id: Ibbdd42858a6daf61401c638435617bfb37d1899c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357300
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This allows us to roll the Parser back to an earlier state if we need
to do so. This includes:
- rewinding the lexer
- restoring the previous Pushback node
- backing out AST nodes
- backing out errors
This functionality is used to back out of parsing a vardecl if we
discover mid-stream that it is actually an expression statement that
coincidentally starts with the name of a type.
Change-Id: Ia5feb45019693931c1e6870e3ff7a5398924c863
Bug: skia:11198
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356997
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
The lexer can be reset to an earlier state simply by overwriting its
offset to a previous position.
Change-Id: I571c7981dbec3c43a894fe599f2e2a167bc380df
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356976
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This should not cause any functional changes, and is just a prerequisite
for upcoming DSL work.
Change-Id: Iea165d3b7ede39ccc9cf5f5d78f623bc883b391e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356816
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Change-Id: Ib150e6d6d3de34a85ce8051eea843ab3b2d7ab75
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356921
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Also cleanup some of the duplicate code in SkRecords
Bug: skia:7650
Change-Id: I4d3167a892c126c19a54002beab25c9a6c96fa5d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357000
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Rather than copying these triangles twice, we can run "pathToPolys"
during onPrePrepare and "polysToTriangles" during onPrepare.
Also adds a benchmark for normal and inner-fan triangulation.
Bug: skia:10419
Change-Id: Id301afde5de11d93ae026e75e42ac03a50867687
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/355177
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This was the last remaining user of ByteCode. The skvm solution
is faster, and lets us delete the ByteCode system.
Testing on 15 instances of sinusoidal_emitter (90k particles):
- ByteCode ~9 ms
- ByteCode (older, optimized): ~5.5 ms
- skvm ~2.1 ms
Change-Id: Ia2e5c9ab2d36c97e59af28a6f989bf212889e439
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356919
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Like _globals, it's not actually necessary to indirect through a
separate pointer at all. The output struct is now passed by reference
and the additional pointer variable is removed.
(Additionally, renamed _skGlobals back to _globals.)
Change-Id: Id089a20cb751cdaedc48462a52da78ee43783611
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/355632
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
I think it makes sense for the class functions to not have internal side
effects. Meaning, you can call pathToPolys and polysToTriangles all you
want without worrying about internal state.
Bug: skia:10419
Change-Id: I5e2136719bbf65a6a8e4c032c1c1326f0a9a98c3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356496
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Replace "pathToTriangles" with "pathToPolys, polysToTriangles". This
will allow the tessellator to do pathToPolys in onPrePrepare and
polysToTriangles in onPrepare.
Don't make countPoints and polysToTriangles virtual. This is a step
toward moving the outer mesh of GrAATriangulator back out of the
class, which seems to match the style better.
Bug: skia:10419
Change-Id: Id6d22dcc2da0af84b9cb46fb36ead4c2e30d5c32
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/355176
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
This GM tests out the GrTextureEffect with non-normalizable textures.
Change-Id: I5b0ffc43241a29d64516d07a4388668f224ffefe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/355676
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
The SPIR-V code generator would sometimes invoke helper functions in an
unsequenced way, causing the output to vary across different compilers
or optimization settings. This CL explicitly sequences these operations,
which should make the output consistent across platforms.
Change-Id: Iaaf75b80e7495768d73dd6afa5b6d03f9cf3f262
Bug: skia:11175
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356844
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>
Just more internal cleanup/reorg, including passing around the (few)
fields we use from paint, rather than an entire paint, in the legacy
shader context. This was motivated (partly) to ensure that we don't
accidentally refer to getFilterQuality() downstream.
Bug: skia:7650
Change-Id: I69031dcb74e02c77bc4d6166fdb377262ae77046
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356842
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
I wrote this looking for places where we treat w differently from z.
None of these are an urgent problem today, but 2) could become one, and
all good to fix if only for consistency.
1) Recycle w's register when it dies in the interpreter.
If we don't recycle w's register slot when w dies, we'll keep
thinking w's alive and keep that slot around in case it's used.
This is only an inefficiency, but nice to avoid when we can.
2) Don't allow spilling w when looking for an unused register.
This is a JIT bug fix, avoiding the possibility of clobbering w with
dst(),x,y,z or a temporary when we need to use it. Doesn't look like
it's happening today, but could sneak in.
3) Allow aliasing w and dst().
This is for completeness, moot today... store128 is the only op using
w and doesn't use dst(), let alone try to alias them.
Change-Id: I1f22e67f8793be018282bc3e793412e1d1abd7a5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356797
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This isn't really how I intended to use these, but we might as well
check if the registers happen to already be lined up how we'd like them.
And it happens quite often... I didn't gather detailed numbers, but both
sides of the "are we lined up?" conditions are being hit lots and lots
of times, in both store64 and store128.
Also rewrote the scalar flow of store128 to mirror store64. The old
code was just fine, but this makes it easier to follow the conditions of
when we can use st4. (This does remind me that we could also use
single-lane st2/st4/ld2/ld4 instructions to handle the scalar paths.)
Change-Id: Id2c94f68e5ea14031f7a23bdc76583dff4a7b65f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356436
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This should be the same amount of work in Assembler::bytes()
with one fewer field to track... might as well!
Change-Id: I54ca919983f11d218255817dbc4db292e7972409
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356796
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
We use our own custom lexer now.
Change-Id: I6a2a408094ba37c2eef7092f5a5caa107938613b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356476
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This simplifies our world and opens the door for more optimization.
Bug: skia:10877
Change-Id: I3c721f12a23bfa73dbdf1e02d9c77d7c6a889aa0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356309
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This is a reland of 97c476ecb7
Original change's description:
> Disable the MSAA atlas mode for CCPR
>
> We have a long term path rendering plan that uses dynamic MSAA instead.
> This CL is a test to see if we can drop support for CCPR now.
>
> Change-Id: I1bff3ca3143a6b453b65a7932a1805c195922805
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354036
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
Change-Id: Ied3390d7df0b01d5e9d565247f5aed0addb5ab8f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356336
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
We were replacing points with the intersection of opposite edges.
Because of the distance tolerance we're using that may fall outside
of the original quad. Detect those cases and use averages of
intersection points instead.
Bug: chromium:1167277
Change-Id: I36b172f19339839bb21c060ddfe8109c184e9327
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356311
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
store64 and store128 will use the st?.4s instructions,
and load64/load128 the ld?.4s. The tricky bit for both
of course is that they load and store more than a single
register, and that those registers need to be adjacent.
Change-Id: I613d06cbcc6e00bfc16b1a2c88412dbbbb1c55ed
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356344
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
The previous implementation assumed that SkSL expressions do not have
side effects and so treated either side of a Boolean expression as
short-circuitable. That is, `foo() && false` and `false && foo()` would
both be optimized to `false`, eliminating the `foo()` call.
We now check for side effects first. An expression like `expr && false`
can only be optimized to `false` if `expr` has no side effects. (If
`expr` does have side effects, the expression is left as-is.)
Change-Id: I473cf026a8afe35d6a8d9518498f2b26d8996e60
Bug: skia:11162
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356357
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>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Additionally, restructure the unit test to return a color (green for
pass, red for fail).
Change-Id: Ib1bb6bd8771c72cc751d8d2c65cc14a693166d4c
Bug: skia:11112
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356301
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>
Change-Id: I81c9a6ddcd65d40ebced18c7cfb1cad51066ba7b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356297
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
No longer used and troublesome to use, so remove.
Change-Id: Idad9dd3325443f7e546465abf551de9784d9f829
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/352512
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
external callers
This should not result in any functional changes.
Change-Id: I5ef0301cf63bee561871c0110fda2692849b53d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356102
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
The inliner can generate slightly tighter code if we avoid creating
helper variables inside a scoped block. This saves one temp variable
copy.
Change-Id: Iea9ecda24fa296eb489166887fd8ab50ec7176e6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/355982
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
No functionality changes, but the new variants of the methods make them
more accessible from upcoming DSL code.
Change-Id: Iaa9f1fab31cb7db00007b00d7d3b88ff5b9696b6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356103
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This exposed a preexisting error: GrGrSLTypesAreSupported.fp used non-
square matrices, which are not actually present in GrSLType. The test
has been updated to use square matrices.
Change-Id: Ib51141cc14a0c3fcd1c3c3abf378f190d457b95f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356077
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
We already had support for &&, ||, ^^ but somehow the common cases of
== and != were not implemented in the constant-folder.
This CL also updates the test to return a green/red color on success or
failure, instead of assigning arbitrary numbers into sk_FragColor that
don't mean anything. The long-term plan is to signal success or failure
of each test by color code; we can display these colors as swatches in a
GM slide for testing purposes.
Change-Id: I0810108b3c6b656a60cd8aa64ceefd765eff0157
Bug: skia:11112
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/355984
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Migrate clients to use drawImage(... sampling)
rather than relying on paint's filter-quality.
This CL just gets started, introducing the build-flag.
Bug: skia:7650
Change-Id: I4afdd964c6f805058afee0a8f3a6887d501ad42b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356076
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
store128() has been lowered into SkVM Ops strangely (two interlocking
64-bit stores) only because of SkVM's limit of three arguments per Op.
With four arguments we can lower store128() in a straightforward way.
Perhaps surprisingly, I've left the implementations of store128 fairly
naive, with narrower stores than having all this data together in one
place allows. I do want to follow up here, but not so much because the
speed of store128 is important, rather more so because getting the tools
in place for idiomatic store128 implementations will lead us down a path
with great knock-on effects for more interesting features.
We'll need four adjacent temporary registers to use the ARM-idiomatic
st2.4s/st4.4s approaches for store64/store128, and the idiomatic x86
implementations need multiple temporary registers too. Once we're able
to manage multiple adjacent registers as a unit, we'll be able to
stretch the idea to things like load64/load128 returning 2 or 4
registers worth of data from a single Op. And the ultimate goal is in
Half-is-fp16 mode, where we'll be able to fill one register with 16-bit
float/int/mask data and spread any 32-bit data across a register pair.
Change-Id: Ieb20d8b7d00e9d806cb27fd30ebfd50ae9317da7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/355936
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
These types are supported by SkSL but were mysteriously absent from
GrSL.
Change-Id: Id3479a23b1ddee0604362ed8c12da0eea7c6fa56
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/355981
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
This clip code will be shared with direct-to-op text drawing
path.
Change-Id: I6744a93cb75b555e91b3b016d5604d3ba81b02fe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/355977
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This reverts commit b7e836cee9.
Change-Id: I3c39a928ba4a9a2863b616f2a500975294b03860
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/355980
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This reverts commit ebf569004f.
Reason for revert: std::clamp is c++17
Original change's description:
> Support indexing by loop variables in SkVMGenerator
>
> Bug: skia:11096
> Change-Id: I25a91bacf1c3455ac67422fb0e59b9b152c2054a
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354667
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>
TBR=mtklein@google.com,brianosman@google.com,johnstiles@google.com
Change-Id: I0590cf7fe626fb59be3381b5e8eb66a9a2a9e8cb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11096
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356056
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This reverts commit f1650efc55.
Reason for revert: fix for cpu/ddl configs
Original change's description:
> Revert "Test all YUVA image factories with different encoded origins."
>
> This reverts commit 2ba80af000.
>
> Reason for revert: new test fails ddl and cpu configs on imggen
>
> Original change's description:
> > Test all YUVA image factories with different encoded origins.
> >
> > Now that SkImage_GpuYUVA stores a GrYUVATextureProxies it supports
> > encoded origins.
> >
> > Modify wacky_yuv_format GMs to use different origins and remove
> > restriction in SkImage::MakeFromYUVAPixmaps.
> >
> > Bug: skia:10632
> > Change-Id: I02477d592b7baba164944d629eeac48223698c10
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353623
> > Reviewed-by: Jim Van Verth <jvanverth@google.com>
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
>
> TBR=jvanverth@google.com,bsalomon@google.com
>
> Change-Id: If909ee4769cc1c74e1682a5e2870ec85a83f65c5
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10632
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354661
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=jvanverth@google.com,bsalomon@google.com
# Not skipping CQ checks because this is a reland.
Bug: skia:10632
Change-Id: Iafe79ab5b3ce0ff9e3a4007e5d8fbc44edded196
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/355630
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Bug: skia:11096
Change-Id: I25a91bacf1c3455ac67422fb0e59b9b152c2054a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354667
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This reduces complexity and will also allow us to add new ops that
take advantage of this same core logic.
Bug: skia:10419
Change-Id: I4ec8717a6d9510dea967d11467eeea0b5b7c7f4c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354296
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
This is a pure refactor, making room for a fourth argument per Op.
I'll use this to make store128 work more naturally, taking all
128 bits of its input at once, rather than spreading across two strided
64-bit stores as done today. I've left this for a second CL because
this refactor on its own seemed error-prone enough.
Change-Id: I704e4f2e165b0bfd0276af921d97bf2cc01e8550
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/355659
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
I've been looking to simplify and expand the kinds of instructions
we can support, and one easy early simplification is to break the
union of regs y,z and immy,immz into separate fields.
To further reinforce how unrelated they are, rename to immA,immB.
With the guaranteed two immediates available, we can simplify the
representation of some ops to use the immediates more naturally.
Change-Id: Iad139b5d77e8464e71f1360d881c1ed2e0957db8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/355658
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Bug: chromium:1162942
Change-Id: Idc1dcb725ff9eae651b84de2fe792b188dcd1c1b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354671
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
`globalStruct` is now named `_skGlobals` and is passed around directly
by reference, with no additional helper variable (`_globals`) at all.
Change-Id: Icc5566d2212afd14a4d43700e89f50bedcc8b45f
Bug: skia:11168
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/355717
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Dug in with instruments and yeah there's substantial work to do here.
Bug: skia:10877
Change-Id: I0f6978e0d16385e09e6017a0532fdcf9ba9a5d0c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/355716
Auto-Submit: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This reverts commit 2ba80af000.
Reason for revert: new test fails ddl and cpu configs on imggen
Original change's description:
> Test all YUVA image factories with different encoded origins.
>
> Now that SkImage_GpuYUVA stores a GrYUVATextureProxies it supports
> encoded origins.
>
> Modify wacky_yuv_format GMs to use different origins and remove
> restriction in SkImage::MakeFromYUVAPixmaps.
>
> Bug: skia:10632
> Change-Id: I02477d592b7baba164944d629eeac48223698c10
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353623
> Reviewed-by: Jim Van Verth <jvanverth@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=jvanverth@google.com,bsalomon@google.com
Change-Id: If909ee4769cc1c74e1682a5e2870ec85a83f65c5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10632
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354661
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Sometimes our cache of convexity is wrong -- still trying to figure out
what do do about that.
Change-Id: Ie36292b87c4d07fc18643cc91f93be00c577b2ca
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/355616
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Reed <reed@google.com>
- Remove unexplained special case where we avoided coercing uints to int
- Replaced the set<int> of case values with SkTHashSet<SKSL_INT>. Should
be faster and more type-correct.
Change-Id: I3286bd50253cc7a1ff6a550dc429bdfebbb8d8c5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354670
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>
The Inliner likes to move function bodies around; after inlining, code
can inadvertently move upwards, above ProgramElements that the code
relies on. We work around this by always emitting functions last.
Change-Id: Ie5486cc3a79a478920342fb9f578d575486fb4cf
Bug: skia:11186
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354669
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This was originally added so that some clients (BitmapFactory,
BitmapRegionDecoder) could ignore exif for backwards compatibility, and
others (ImageDecoder) could respect it.
With the addition of NDK APIs for decoding all frames of an animated
image, hwui/ImageDecoder will handle compositing frames, including
handling the orientation, so it may as well always handle it.
This removes tests for SkAndroidCodec that are no longer applicable.
Android already has tests for most of them.
AndroidCodec_sampledOrientation is recreated in
ag/Ieda439910ae52e609f0710d424503616d99ae5c7.
Change-Id: Ibd280986892176f284895d543f2f50bca22d196b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344763
Commit-Queue: Leon Scroggins <scroggo@google.com>
Auto-Submit: Leon Scroggins <scroggo@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
This enforces an even stricter version of the rules from GLSL ES 1.0
Appendix A, Section 5. Essentially, indices (to arrays, vectors,
matrices) must be made of literals, loop indices, and expressions made
of those two.
Bug: skia:10837
Bug: skia:11096
Change-Id: I437a5ed64da58e24d5991ddbde68859f5214e98b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354665
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
As far as I know, there shouldn't be a way to introduce a struct or enum
other than at global scope; the keywords are not accepted inside a
function body. In fact, I wasn't able to find a way to exercise these
code paths in practice. But we now have concrete assurance that any
possible type can be cloned into a symbol table safely; all Types are
either built-in (available everywhere by design) or are clonable.
Change-Id: I4b006b6cab995b3e598b683736ab9689828629c9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354664
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
The inliner needs to clone Types from one SymbolTable to another when
cloning blocks of code. However, it seems like a poor division of
responsibility for the inliner to need to know how to clone every Type
correctly. It makes more sense for this logic to exist within the Type
class itself.
Change-Id: I4a383d5e22d5084eb35992a0b5c24865d2030282
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354662
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This reverts commit 97c476ecb7.
Reason for revert: tree breakage - Test-Debian10-Clang-GCE-GPU-SwiftShader-x86_64-Debug-All-SwiftShader
Original change's description:
> Disable the MSAA atlas mode for CCPR
>
> We have a long term path rendering plan that uses dynamic MSAA instead.
> This CL is a test to see if we can drop support for CCPR now.
>
> Change-Id: I1bff3ca3143a6b453b65a7932a1805c195922805
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354036
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,csmartdalton@google.com
Change-Id: I9f472807f743b8ddfee92800ee3b62609f2d4717
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354673
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Change-Id: I62755dfcf5c8bb5bd7e0cc742e675aacf4afbb78
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354658
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
We have a long term path rendering plan that uses dynamic MSAA instead.
This CL is a test to see if we can drop support for CCPR now.
Change-Id: I1bff3ca3143a6b453b65a7932a1805c195922805
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354036
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
This CL limits the availability of functions like "MakeLiteralType" and
"MakeScalarType" to the BuiltinTypes class. This allows us to know,
definitively, that whenever we encounter these types, they are part of
the BuiltinTypes class and available anywhere in the program without
needing to be cloned.
The remaining MakeXxxxxxTypes in SkSL::Type are constructed dynamically
and injected into child symbol tables during parse/IR generation. These
types must be treated with special care when being moved or cloned:
- Arrays (MakeArrayType)
- Structs (MakeStructType)
- Enums (MakeEnumType)
Change-Id: I5490d6739c2a5ffdd54195f5a0b9b5be05d07953
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354878
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
No code or functionality changes.
Change-Id: I24317767570ae9ebbfea56f873d98709fb22d8b9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354876
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>
The inliner discovered that when a binary expression is inlined, its
type is not cloned into the destination's SymbolTable. This meant that
when the inlined-from function was later dead-stripped, the type pointer
would become dangling. Did a quick pass over inlineExpression and
inlineStatement and ensured that types are always copied.
Also found that `copy_if_needed` was making a copy of eligible types
each time one was encountered, instead of making one copy and reusing
it. This is fixed as well.
Change-Id: Iee3259ab038dfb04034bf0110af1909ccffec3de
Bug: oss-fuzz:29444
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354219
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Now that SkImage_GpuYUVA stores a GrYUVATextureProxies it supports
encoded origins.
Modify wacky_yuv_format GMs to use different origins and remove
restriction in SkImage::MakeFromYUVAPixmaps.
Bug: skia:10632
Change-Id: I02477d592b7baba164944d629eeac48223698c10
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353623
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Change-Id: I93d580e67cb66d388bd66b280ff229cb79e5b154
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354218
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Unlike TriangulateSimpleInnerPolygons, this new method *always*
succeeds. It works by introducing a concept of "breadcrumb" triangles.
The breadcrumb triangles serve as a glue that erases T-junctions
between the outer curves and inner polygon triangulation.
This CL also introduces a test to verify the breadcrumb triangles
actually guarantee to eliminate T-junctions. It works by cancelling
out shared edges in the combined breadcrumb triangles and inner
triangulation, and then verifying that the resulting edge list is
bit-for-bit identical to the outer edges from the original polygon(s).
Bug: skia:10419
Change-Id: Iea8ee2ca3701697246309dceb90e63279aabdfe4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353536
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Unsized arrays are now allowed in exactly one place: On the declaration
of an interface block. This satisfies the one existing use-case, which
is the gl_in (sk_in) declaration for geometry shaders. There is no other
useful scenario, and most of our backends don't support them anyway.
Several spots were using less strict checks when attaching sizes to
arrays, allowing for zero or negative-sized arrays, so those are all
fixed now.
The existing tests that initialize arrays are still a problem, because
Metal doesn't support that (neither does GLES2). Also, ArrayConstructors
has gone from generating an error in the Vulkan backend, to invalid
SPIR-V.
Bug: skia:11013
Bug: skia:11127
Change-Id: Ib08dfe9aeec96bf605661665d6f166419d27e8bc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353817
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Change-Id: Ia3ac338bef376aa1649569b9ebd3f7feb23ffd52
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353936
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
These were meant to make it easier to pass constants to skvm::Builder,
but I think they've caused more problems than they solve.
This change is pretty much just mechanical, expanding all the existing
combinations of F32/F32a into (more) combinations of F32/float, and same
for I32/I32a/int. In general for an N-ary function we'll end up with
2^N-1 variants (1->1, 2->3, 3->7), requiring at least one I32/F32.
As before, some functions have fewer variants where using a constant
doesn't actually make sense (the condition for select, the denominator
for divide, etc).
Change-Id: Ic7bbd82e7f1452d604479cdde0b3b6a60ffe8b8a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353839
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This better matches GLSL's type coercion behavior.
Change-Id: I73fcfd8a9e57fd4cdb1692074d73ebd8fb788ac2
Bug: skia:11164
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353712
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Literals are still flexible; we still allow `1` to coerce to float.
However, we no longer accept code like `int x = sqrt(2);` or
`int x = 0; float y = x;` without an explicit cast.
Change-Id: Ieb294a4877447e2336252f876e8bc489d1e4a59a
Bug: skia:11164
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353417
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Change-Id: Icd8982d604881effee31cc1392e2717cb112d06d
Bug: skia:11172
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353629
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>
Bug: skia:10680
Change-Id: Ic77f7355866363ef476a93d8da180cf53207fa6d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353707
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
It's not sound to pass undefined (skvm::NA) values into select(),
but this is working today because the F32a argument is 'fixing' it.
The first time through this snippet updating fReturn value,
int i = 0;
for (skvm::Val& slot : currentFunction().fReturnValue) {
slot = select(returnsHere, f32(val[i]), f32(slot)).id;
i++;
}
the call to f32(slot) creates an F32{builder, NA}. We pass that to
select() and that argument's F32a(F32) constructor, resulting in
F32a{builder, NA, 0.0f}. Then when we need that as an F32, we resolve
it as splat(0.0f) because the F32a's id field is NA.
In short, best to remove F32a. :)
Added some SkASSERTs that would have caught this.
Change-Id: I67324cf20ad39ca555e69b9c407f379d14046043
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353838
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
I'm looking to phase out I32a/F32a, and rewriting this expression to
avoid select() makes it easier, making these types unused except in
SkVM.{h,cpp}.
There's no particular reason beyond making that refactor easier to do
this: SkVM can convert select(cond, splat(1), splat(0)) into cond & 1
itself, and once I'm done with removing I32a/F32a, if we prefer select
we should be able to rewrite this back as
dst[i] = skvm::select(i32(src[i]), 1, 0);
Change-Id: I562a112e54fdc2578802db02f6754c64a12798cc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353837
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Previously, `writeVectorConstructor` did not consider boolean types at
all when converting scalars to a different type. Now, this code reuses
the existing logic from `castScalarTo(Float|SignedInt|UnsignedInt)`
which supports Booleans. Added `castScalarToBoolean` to cover going in
the opposite direction.
Change-Id: I5479ab181b9b721db7fbff0bdc01718ce8f9f9b9
Bug: skia:11171
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353625
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Change-Id: I4eda7ffb010f236b39750da6134fb8db6fc26380
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353836
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This revealed a gap in our SPIR-V scalar constructor support;
typecasting a number to bool would lead to an ABORT.
Change-Id: Idac6d7ba34adfd214ed3cad8139e22d7170456f0
Bug: skia:11172
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353628
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Change-Id: Ibb9dca7b8e04485924f6a7d8dd4b17df90d5f320
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353779
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Change-Id: I350a6768ac124362b0d3e0f17e7a026265acf804
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353627
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>