We had all the moving parts in place, but had neglected to check
`simplify_constant_equality` for structs. It worked for structs that
boiled down to the same expression tree, but not for mismatched structs.
Comparison of known structs should be allowed in a constant-expression.
Change-Id: I3a52abf4530d1fe25d17eb482c1e29b5b8e03cf6
Bug: skia:13387
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/547444
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
This is necessary for proper constant-folding, and can help us generate
better code. Most examples are pretty contrived, but a realistic benefit
can be found in inlined code (see TrivialArgumentsInlineDirectly.glsl).
Change-Id: I86aac9d48a70ae35a15109fd0b04400ae39a3b47
Bug: skia:13387
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/547277
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
This reverts commit 3ba37e1d38.
Reason for revert: disabled test on Win+Intel/Android+Adreno6xx GPUs
(skia:13393)
Broke out non-folding tests to a separate test due to failures on
Quadro/RTX3060. (skia:13395)
Original change's description:
> Revert "Add unit test covering struct field folding."
>
> This reverts commit 0cbba91940.
>
> Reason for revert: returns red on Adreno and Intel
>
> Original change's description:
> > Add unit test covering struct field folding.
> >
> > At present, we don't try to optimize away `myStruct.myField` accesses
> > even when `myStruct` is known or constant, so the output from the test
> > is not too impressive.
> >
> > Change-Id: I563559e5cdc6c2669d69ec78ad8ca09d3be02a68
> > Bug: skia:13387
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/547276
> > Auto-Submit: John Stiles <johnstiles@google.com>
> > Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> > Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> > Commit-Queue: John Stiles <johnstiles@google.com>
>
> Bug: skia:13387
> Change-Id: I2e651ddb82fac08cdc16fa8b77696cdd314e805f
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/547438
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Change-Id: Ic86ff6b1034363d1343793f94e3ba707adb2fcc3
Bug: skia:13387, skia:13393, skia:13395
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/547439
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
These values are always bool, so we can eliminate several levels of
indirection.
Change-Id: I074e9bd7a8f984776f4c710f640d761dee4258c2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546862
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Bug: skia:12703
Change-Id: I6949fb2de3213c770756a3be21c1d47387a40e10
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545238
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This reverts commit 0cbba91940.
Reason for revert: returns red on Adreno and Intel
Original change's description:
> Add unit test covering struct field folding.
>
> At present, we don't try to optimize away `myStruct.myField` accesses
> even when `myStruct` is known or constant, so the output from the test
> is not too impressive.
>
> Change-Id: I563559e5cdc6c2669d69ec78ad8ca09d3be02a68
> Bug: skia:13387
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/547276
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
Bug: skia:13387
Change-Id: I2e651ddb82fac08cdc16fa8b77696cdd314e805f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/547438
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Change-Id: I6dab23fbd4d663e4031e3c6f568471f266f26936
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/547016
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Changes landed like ships in the night.
Change-Id: I8b6ce125ff95f60c35c2e6e40b49b43b2c42eb10
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/547258
Reviewed-by: Ravi Mistry <rmistry@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
This removes the previous task driver dedicated to enforcing
IWYU and adds individual jobs for the binaries we want to
test. This aligns with the current plan of organizing our
Bazel CI jobs - going wide where possible.
Change-Id: I8b163957e34e594c1a80d7b9e6b63c64a277bef1
Bug: skia:12541 skia:13052
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/547019
Reviewed-by: Eric Boren <borenet@google.com>
These four directories had IWYU enforced previously and
that enforcement was turned back on:
- src/sksl/
- src/utils/
- src/svg/
- tools/debugger/
It was discovered that src/sksl/ir had been missed with the
previous IWYU enforcement, so many files needed updating
(see https://skia-review.googlesource.com/c/skia/+/547256).
We do not currently include src/svg/ or tools/debugger/ in
any Bazel builds, so that enforcement has not been tested
with the new system. When we add in builds that use those
packages, we may need to update includes.
Suggested Review order:
- clang_trampoline_linux.sh to see list expanded
- bazel/Makefile to see convenient target for testing this
locally (follow-up CL will have a CI job for this).
Change-Id: Ifef1659ccd1a0e6c862b82102576a06296a6b42e
Bug: skia:12541 skia:13052
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546608
Reviewed-by: Ben Wagner <bungeman@google.com>
Instead of having a feature that a subpackage cc_library
would set (because the subpackage cc_libraries went away in
review.skia.org/543977), we now have a list of directories
for which all descendent files will have IWYU run on them.
As before, we have an overarching feature "skia_enforce_iwyu"
that enables this check because of the extra compilation
overhead it incurs.
We have decided to enforce IWYU on debug builds instead of
release builds because we have some code (e.g. that in
SkDEBUGCODE or SkASSERT) which is only compiled and executed
in a debug build, but we don't want to have
#if defined(SK_DEBUG)
all over the place. We make the assumption that the includes
needed to compile in debug mode are the superset of the
includes necessary for release and other modes.
Change-Id: I10254fcc162627c20eb89959e06417effa3cc396
Bug: skia:12541 skia:13052
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546607
Reviewed-by: Ben Wagner <bungeman@google.com>
We need to make sure we have the required chroma sampling options for the
format.
Bug: skia:12820, skia:13265
Change-Id: I6e0d0f9b50a5730ecbe5de2626bf1d1ee1051d7a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546861
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This was not referenced anywhere. Previously, it was called from
IsTrivialExpression, but that has since been rewritten.
Change-Id: I925565778e4964b52ac905e95b44931b8868f647
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/547278
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
At present, we don't try to optimize away `myStruct.myField` accesses
even when `myStruct` is known or constant, so the output from the test
is not too impressive.
Change-Id: I563559e5cdc6c2669d69ec78ad8ca09d3be02a68
Bug: skia:13387
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/547276
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
"canUseAnyFunction" was totally unused. All of the others that I removed
are only used from C++ code to control higher level logic (not within
shaders). A few of the remainders don't have sk_Caps references today,
but adding usage seems plausible.
Change-Id: I196f7d8abacde9dc6903d792cd18b58a34dc19f3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546858
Reviewed-by: Arman Uguray <armansito@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Change-Id: I964ac2d7d2f1e9d10b0216deb6572b28a26da0fc
Bug: skia:13052
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/547256
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
This lets us test non-constant array indexing and array ctors (which ES2
doesn't allow at all).
I also added some cast-related tests to the non-ES3 test which were
accidentally missed the first time around.
Change-Id: Ib03aa53f57702141a8852154d584a31ab75f96e8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/547017
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Eventually we'll move the addCommands call on Task to happen from the
Context. However, things like instantiation of proxies still needs to
happen on the Recorder.
Bug: skia:13357
Change-Id: I905a83e735164b7b82e7ffa916c535b0cd234594
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546857
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Test cases were added for matrix-resize-ctor, diagonal-matrix-ctor and
struct-ctor. These were originally absent because the original trivial-
expression code did not distinguish between each individual ctor type.
Unfortunately, array-ctor is not included because ES2 does not support
array-ctors.
Comments were added to make it a bit easier to understand why some cases
are trivial but others are not. In some cases, the compiler applies
relevant transformations that might not be apparent at first glance--
e.g. unary + is eliminated so that case is still trivial.
Change-Id: Ie6756fc01736d28035f3965ae18f3482bd030871
Bug: skia:13378
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546864
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Arman Uguray <armansito@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Change-Id: I8bb64cb2e337ec4646da38d11f80e83a13670c59
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546866
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Bug: skia:12720
Change-Id: I7a222771da5fb46b773b7785b06682dcd92b01a2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546859
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Bug: skia:12701
Change-Id: Ibf7b4ac280eb853e3f5d786bd188ae0ac208609b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545367
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This reverts commit 5270322b46.
Change-Id: If594d04dc657126dce48d69dcc67d1a5e3b0cc8a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546856
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This code was originally written before our constructor IR types were
split apart, so its treatment of constructors was pretty simplistic. The
new code handles each type of constructor separately, and makes better
decisions as a result.
Compound constructors are now only considered to be trivial when they
are compile-time constants; this causes vector<->matrix conversion
constructors to be detected as non-trivial.
Change-Id: I534fcf69f5d5f43ac705d68ae00f97fce8496c2a
Bug: skia:13378
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546555
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
SkMesh now takes SkData that contains the uniform values.
Change-Id: I286e7559ba692ce15925a54f59c2e829b6b5448f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546096
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
GrSPIRVUniformHandler and GrVkUniformHandler had special-case handling
of float2x2 matrices, but neglected to put in the same handling for
half2x2 matrices (which are identical at the uniform level).
There are likely to be deeper issues here, but this is a step in the
right direction compared to where we were.
Bug: skia:13380
Change-Id: I035f707d1f3831c0057934fe16b2f96ea4847578
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546550
Reviewed-by: Arman Uguray <armansito@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This version dodges skia:13380 by reordering the list of uniforms.
Disabled on Win10 with older Intel GPUs due to crashes when performing
vector/matrix casts in GLSL.
Change-Id: If053908fd1a6921257e5af0abdce1ff69a03297f
Bug: skia:13378, skia:12179
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546551
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Bug: skia:12701
Change-Id: I88a12b776cf9b14d0c0a94ae777b85d9592696a7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/544318
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This reverts commit 9583759bbd.
Reason for revert: MSAN failure
Original change's description:
> Restored unsized array support to SkSL
>
> This is a prerequisite for compute shaders. As of this CL, there isn't
> yet a way to use unsized arrays, as it is a compute-only feature and
> compute shaders are coming in a followup CL, but this adds the basic
> framework and error tests.
>
> Change-Id: I390c0961e324dd474474563bf9a8f6b34c9552a9
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/538900
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Change-Id: Id10b48ef24c0e6219b65b0a201d13fea9632620f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546552
Auto-Submit: Brian Osman <brianosman@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
This reverts commit c18fb9c8a2.
Reason for revert: Red on the tree.
Original change's description:
> Add test demonstrating that matrix/vector casts are considered trivial.
>
> These casts are not particularly lightweight Metal (they invoke a helper
> function) so they are going to be marked as non-trivial in a followup
> CL.
>
> Change-Id: Ic88e6b3889f6d4f4751d7ebfc740229b7530930b
> Bug: skia:13378, skia:13380
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546417
> Reviewed-by: Arman Uguray <armansito@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
Bug: skia:13378, skia:13380
Change-Id: Iee60fcc0d9d56912268777a9fa4d2aa18154f157
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546548
Auto-Submit: Brian Osman <brianosman@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bug: skia:12701
Change-Id: I4209a4741a957a4dc60ad6669fc164a2d5993676
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545720
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
These casts are not particularly lightweight Metal (they invoke a helper
function) so they are going to be marked as non-trivial in a followup
CL.
Change-Id: Ic88e6b3889f6d4f4751d7ebfc740229b7530930b
Bug: skia:13378, skia:13380
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546417
Reviewed-by: Arman Uguray <armansito@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
This is a prerequisite for compute shaders. As of this CL, there isn't
yet a way to use unsized arrays, as it is a compute-only feature and
compute shaders are coming in a followup CL, but this adds the basic
framework and error tests.
Change-Id: I390c0961e324dd474474563bf9a8f6b34c9552a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/538900
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This CL adds the ability to add child combinations to the top-level
combinations added to the builder.
Bug: skia:12701
Change-Id: Ibe182c631bb9811d82e314ba58823b1708058165
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/542299
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
The job had been removed from jobs.json previously. We no
longer intend to generate Bazel files using gazelle, which
is what this checked.
Change-Id: I1bcf98deae3831a18b9a70e4f0a295eb3f2785b8
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546137
Reviewed-by: Eric Boren <borenet@google.com>
Reviewed-by: Ravi Mistry <rmistry@google.com>