Commit Graph

189 Commits

Author SHA1 Message Date
John Stiles
8397365524 Optimize away same-value ternaries.
A ternary of the form `anything ? value : value` can be reduced to a
comma-expression of the form `anything, value`. This seems like a rare
case in real code, but it's easy enough to detect with our existing
toolbox.

The `anything` test-expression will be eliminated from the expression
if it has no side effects, using our existing constant-folding rules
for the comma expression.

Change-Id: I1285b04cd6a08f1bed614aa1aa6f37ea2447de91
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528439
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-04-07 19:37:00 +00:00
Ethan Nicholas
b47a67ab75 Fixed SkSL positioning error with double negation
We were not propagating the position into a double-negated expression,
leading to an assertion failure in PrefixExpression.

Change-Id: I1970ff1a06d9631582626c68e151f12f6b3ef278
Bug: oss-fuzz:46381
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/527507
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2022-04-05 17:10:23 +00:00
John Stiles
674eb326f4 Improve distinct-out-param test cases.
Added new aliasing tests inspired by syoussefi@'s ANGLE changes at
http://go/crrv/c/3561278.

Change-Id: Ifa312faa9503b211b7c09edd2abd5087ead35e5f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/526018
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Arman Uguray <armansito@google.com>
Commit-Queue: Arman Uguray <armansito@google.com>
2022-03-30 18:49:15 +00:00
Arman Uguray
098f9a6785 [sksl][test] Disable SkSLPreserveSideEffects_GPU
This test fails on Nvidia GPUs on OpenGL due to an issue that only
affects GLSL. Disabling this test to reduce developer noise until we
have a way to re-enable it more selectively in dm.

Bug: skia:13034,skia:13035
Change-Id: I60e0d976774bd474676380583af24865e88471c4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/523976
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Arman Uguray <armansito@google.com>
2022-03-23 19:36:54 +00:00
Kevin Lubick
08ece0c9a0 [includes] Enforce IWYU on sksl code
PS1 regenerates the Bazel files. Use it as the base change when
    comparing patchsets.

IWYU seems to do a good job of working with MyFile.cpp and
MyFile.h, but if there is just a MyHeader.h, it doesn't always
seem to throw errors if the includes aren't correct. This was
observed with include/sksl/DSL.h This might be due to the fact
that headers are not compiled on their own, so they are never
sent directly to the IWYU binary.

This change sets enforce_iwyu_on_package() on the all sksl
packages and then fixes the includes until all those checks
are happy. There were a few files that needed fixes outside
of the sksl folder. Examples include:
 - src/gpu/effects/GrConvexPolyEffect.cpp
 - tests/SkSLDSLTest.cpp

To really enforce this, we need to add a CI/CQ job that runs
bazel build //example:hello_world_gl --config=clang \
  --sandbox_base=/dev/shm --features skia_enforce_iwyu

If that failed, a dev could make the changes described in
the logs and/or run the command locally to see those
prescribed fixes.

I had to add several entries to toolchain/IWYU_mapping.imp
in order to fix some private includes and other atypical
choices. I tried adding a rule there to allow inclusion of
SkTypes.h to make sure defines like SK_SUPPORT_GPU, but
could not get it to work for all cases, so I deferred to
using the IWYU pragma: keep (e.g. SkSLPipelineStageCodeGenerator.h)

Change-Id: I4c3e536d8e69ff7ff2d26fe61a525a6c2e80db06
Bug: skia:13052
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/522256
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2022-03-21 12:43:02 +00:00
Arman Uguray
e70f2e0e0f [sksl][test] Add more folding tests for side-effecting expressions
Moved the MatrixFoldingES2.sksl test case for matrix construction with
side-effects into a new PreserveSideEffects.sksl test and added new test
cases for various vector and matrix types and constructors. The new test
is written such that none of its contents should be folded away.

Note: This test does not pass on NVIDIA GPUs when using OpenGL as
discussed in skia:13035. Notably, NONE of the increments are executed on
those GPUs as ALL increment expressions seemingly get subjected to
constant-folding. The test is disabled on NVIDIA GPU bots.

This also means that the remaining MatrixFoldingES2.sksl tests now work
on NVIDIA GPUs when using OpenGL (with the exception of Tegra3 + OpenGL
ES).

Bug: skia:13035, skia:11919
Change-Id: I561bb62fe2b6b814ba80fbc492d3885bbcd6b65b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/518278
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Arman Uguray <armansito@google.com>
2022-03-10 18:06:12 +00:00
John Stiles
c5ca065411 Add CurrestTestHarness helper method.
This lets us differentiate SkQP from other testing harnesses (like DM or
Viewer) at runtime.

This allows us to change strictness or deactivate tests when SkQP is
running. Previously we had a macro SK_BUILD_FOR_SKQP for this, but this
did not work on a local skqp binary; it only activated when compiling
for Android.

Change-Id: I7334e04ea1eddda783a5d2f26699edd20828f81a
Bug: skia:13037
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/518939
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-03-10 18:05:28 +00:00
John Stiles
07e0a0abd3 Honor SkQP flag when running SkSL tests.
The Android builds of SkQP will conditionally exclude any tests that are
not flagged with `SkQP`.

Note that local builds of the C++ skqp binary do not actually set
SK_BUILD_FOR_SKQP. This flag is set by gn_to_bp. So local skqp binaries
will continue to run these tests. A possible fix for this limitation
has been written in the followup CL: http://review.skia.org/518939

Change-Id: I879650d165c5931693b14102586bae2c9e45dd43
Bug: skia:13037
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/518936
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2022-03-10 15:16:23 +00:00
John Stiles
7f9a95ab66 Restructure SkSLTest to use test flags instead of multiple macros.
At this CL, we should run exactly the same tests as before; the only
difference is that we enable and disable tests via SkSLTestFlags instead
of using different SKSL_TEST_xxxxxx macros for different test types.

There is an inert flag for SkQP; this will be implemented in a followup
CL.

The SKSL_TEST block now extends past 100 characters in some spots
because it was, overall, a lot easier to read and edit tabular data in
a tabular format than with inconsistent formatting and line wrapping.

Change-Id: Ic90f88b10c6e59357275b471e6e86e53e611f101
Bug: skia:13037
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/518138
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Arman Uguray <armansito@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-03-09 18:01:52 +00:00
Arman Uguray
5f16ed4c58 [sksl] Special-case unary negation on matrix types in MSL/SPIR-V
MSL does not support the unary "-" operator on matrix types. Similarly
the SPIR-V OpFNegate/OpSNegate operations only work on scalar and vector
type.

* An expression such as "-<mat>" is now transformed to "-1.0 * <mat>" when
generating MSL.
* The same expression now generates a component-wise negation in SPIR-V,
matching what glslang outputs for GLSL.
* A unary "+" is now treated as NOP for MSL, matching the SPIR-V backend.
An expression such as "+<expr>" is now evaluated as "<expr>".
* The shared/Negation.sksl has been moved to folding/ as much of its
contents exercise constant-folding of comparison expressions.
* The shared/UnaryPositiveNegative.sksl test has been extended to
exercise scalar and matrix types.

NOTE: The SPIR-V backend changes have caused a minor re-ordering of SSA
IDs generated when writing out a prefix-expression. The affected gold
files have been updated.

Bug: skia:12627, skia:12992
Change-Id: Iec5cdafc591aed7e49b3b52bda42a02661380bab
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/513976
Auto-Submit: Arman Uguray <armansito@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Arman Uguray <armansito@google.com>
2022-03-01 20:14:46 +00:00
Ethan Nicholas
7b662215f9 Fixed SkSL dFdy rehydrate test
dFdy wasn't working due to the DSL never having been started.

Bug: skia:12985
Change-Id: Ic58018e3dec3e9df15c2e784f8732ee99e793353
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/513938
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2022-03-01 16:33:48 +00:00
Arman Uguray
557f2795f2 [sksl][tests] Enable CLONE and REHYDRATE tests for GPU/ES3 cases
These tests were not being run for ES3-only GPU and non-strict-ES2 CPU
tests. CLONE and REHYDRATE variants are now generated for all test
declarations.

Change-Id: I8ce14bd50f175d0bae66d9593b68a42fab701f93
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/513056
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Arman Uguray <armansito@google.com>
2022-02-25 23:21:10 +00:00
Arman Uguray
9c30ad1f72 [sksl][tests] Restore SKSL_TEST_CPU_ES3 CPU-only behavior
The SKSL_TEST_CPU_ES3 has been misinterpreted to mean that the tests
should run on "SkVM and OpenGL" while it was originally meant for tests
that were explicitly disabled on GPU backends.

* This macro is now called "SKSL_TEST_CPU_NO_STRICT_ES2" and the comments
reflect the fact that the tests are meant for CPU-only.

* Removed the infra bot exceptions for the matrix constructor tests as
they are now restricted to run only on CPU.

Bug: skia:12970
Change-Id: I46dcec51ef6998f6a8a7b4610c39560da1e59057
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/512578
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Arman Uguray <armansito@google.com>
2022-02-24 22:32:12 +00:00
Brian Osman
cd189e8a1d Remove default/deprecated arguments to makeShader calls
Bug: skia:12643
Change-Id: I37e1718a20283dfb814c85260257d57bac2b7b34
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506211
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
2022-02-09 20:41:23 +00:00
John Stiles
f7db39f59d Run difficult matrix-constructor test on non-ES2 GPUs.
ES2-only GPUs are a lost cause here, but a newer GPU should be able to
construct a matrix from a mix of scalars and vectors in any order.

Change-Id: If9ca5d348cd18b9791c4ee8298f141f6c0edd2c2
Bug: skia:12858
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505796
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-02-08 20:12:16 +00:00
Ethan Nicholas
b86ab9d097 Improved symbol handling in whole-program serialization
Previously, a dehydrated SkSL program would include all symbols, even
module builtins. The rehydration API also required a vector of shared
elements, which made the API essentially impossible to use outside of
the very artificial situation in our test cases, where we retained the
original program so we could simply grab the elements from it. We
obviously cannot rely on the original program still being around in
order to successfully rehydrate it.

This CL eliminates the parent symbol tables, referring to module
builtins by name instead. This reduces the size of a small dehydrated
program by roughly 95%. We also encode the shared elements directly
into the output, which both simplifies the API and makes it work in
real-world cases.

Change-Id: I8e5dddf9316fe0886e6b97e7d29638fff8f9f499
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505816
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2022-02-08 19:33:52 +00:00
John Stiles
4d6f603241 Eliminate unused function.
This was blocking the Android roll: http://screen/9937JW7waCFer64

Change-Id: I89a88ff5a28e077fb302b5c803d0e4829de35103
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504416
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-02-04 14:57:17 +00:00
John Stiles
9c63e63771 Add missing intrinsic tests for abs/max/min(genIType), clamp(genType)
GPUs that failed continued to fail when I put in error bars like
`distance(a, b) <= 0.001`, so they're just disabled entirely now.
Presumably their results are very busted.

Change-Id: I0f1b80f661563a20630740f8cfb6ef69f2a47934
Bug: skia:11209, skia:12858
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503817
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-02-04 14:42:17 +00:00
Ethan Nicholas
744116876e Improved whole-program dehydration and rehydration
This adds a Dehydrator.write(Program) to mirror the Rehydrator's
program() method and simplifies the API.

Change-Id: I1b6d6b722d0ce8e6a292132522f806e43d49ce85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502704
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2022-02-03 21:49:16 +00:00
Ethan Nicholas
abddff3e11 Re-land "Added tests for sksl clone() on our test corpus".
This reverts commit 63a4d65e16.

Change-Id: Ibd17331d518cf1ac95a310e505ee5b0f6495905e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/501318
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2022-02-03 21:01:48 +00:00
John Stiles
9cce961d3b Revert "Add missing mix(genIType, genIType, genBType) to sksl_public."
This reverts commit d33334d44e.

Reason for revert: this isn't available in ES3! Only 4.5.
http://screen/9VstoY9RQkufqm3

Original change's description:
> Add missing mix(genIType, genIType, genBType) to sksl_public.
>
> Change-Id: I8d4816f726196e6f4a5fbb0940b5dd1b2d7db7f5
> Bug: skia:11209
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503821
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>

Bug: skia:11209
Change-Id: Iad4e95ca89b79066d3a1be42605b4338b542638f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503831
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>
2022-02-03 20:44:11 +00:00
John Stiles
d33334d44e Add missing mix(genIType, genIType, genBType) to sksl_public.
Change-Id: I8d4816f726196e6f4a5fbb0940b5dd1b2d7db7f5
Bug: skia:11209
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503821
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2022-02-03 20:19:48 +00:00
Brian Osman
bd712d3f97 In SkSL tests, don't force opaque output
Requires tweaking one inliner test to avoid an Intel driver bug (on
ANGLE).

Bug: chromium:709351
Cq-Do-Not-Cancel-Tryjobs: true
Change-Id: I08fac938396d6b90805ba9650c7a520af888bc12
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503819
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-02-03 17:25:35 +00:00
John Stiles
d4fff483dd Implement Metal polyfill for sign(genIType).
This uses nested selects to compute `(x > 0) ? 1 : (x < 0) ? -1 : 0`.

Change-Id: I1a87fc8506767bb0a9dd77ba2193b330e0a4d0a2
Bug: skia:12898, skia:11209
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503486
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-02-03 15:21:03 +00:00
John Stiles
a3b11365b4 Update RecursiveComparison tests to run on GPU.
These tests are not guaranteed to pass in ES2 (as ES2 specifically does
not require NaN to be implemented), so they are now run in GPU+ES3 and
on the CPU.

Change-Id: Ica78e15a06b3b00b651c5fabd0decf751853a83f
Bug: skia:12858
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/501238
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-02-02 19:39:00 +00:00
Ethan Nicholas
ff94e373a3 Re-land "Added SkSL dehydrate / rehydrate test"
This reverts commit 07d229c795.

Change-Id: I403020f05f2ca17b94b35dcaa6cc35514f7a0cdf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502313
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2022-02-01 16:31:09 +00:00
John Stiles
07d229c795 Revert "Added SkSL dehydrate / rehydrate test"
This reverts commit ded2548179.

Reason for revert: Windows breakage on tree

Original change's description:
> Added SkSL dehydrate / rehydrate test
>
> Test that we can dehydrate and then rehydrate every program in our test
> corpus without altering them.
>
> Change-Id: I2286fcb691176b3fbbe1d6515279d03867555647
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/501436
> Reviewed-by: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>

Change-Id: I2dcee0b36e7e316c4ed0889141cf38c2d1508653
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502311
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>
2022-02-01 14:50:07 +00:00
Ethan Nicholas
ded2548179 Added SkSL dehydrate / rehydrate test
Test that we can dehydrate and then rehydrate every program in our test
corpus without altering them.

Change-Id: I2286fcb691176b3fbbe1d6515279d03867555647
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/501436
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2022-02-01 14:12:47 +00:00
John Stiles
0f6baf469d Update CommaSideEffects test to run on GPU.
Change-Id: Ia218fb2249abd479db9d27527b965fd0b8ad3367
Bug: skia:12858
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/501276
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2022-01-31 21:35:13 +00:00
John Stiles
c3d8062555 Fix up SkSL test on Wembley.
Test "InlinerHonorsGLSLOutParamSemantics" was failing on Wembley devices
and is now disabled on that GPU.

Also, it turns out that the inliner has ignored functions with out
params for a long time now, but our test names haven't been updated to
account for this. So, did some additional cleanup:
- "InlinerHonorsGLSLOutParamSemantics" (the test in question) has been
  moved to shared/ and renamed to "OutParamsAreDistinct."
- Removed test "OutParamsNoInline" as it is functionally the same as
  "OutParams".

Change-Id: I1431ed197b9216cb482eee4f5e4eb2579a5303f7
Bug: skia:12858
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502303
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-01-31 21:17:40 +00:00
John Stiles
a6489dbb30 Update additional OutParams tests to run on the GPU.
Change-Id: If0ecc3c1080b8e44f17dbb34ff6cc1d66794ae0b
Bug: skia:11052, skia:11919, skia:12858
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/501843
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2022-01-31 16:15:33 +00:00
John Stiles
15fd5e99f4 Update out-param semantics in SPIR-V.
Removed a special case from `writeFunctionCallArgument` which avoided
using a scratch variable for out params; now we always use the scratch
variable and copy it back to the original variable at the end.

Change-Id: I0e446a3fde6d19554943384210bd911f6f9c8cfa
Bug: skia:11052, skia:11919, skia:12858
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/501836
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-01-31 16:07:37 +00:00
John Stiles
47e1ab13fa Update VectorScalarMath test to run on GPU.
This shakes out a few driver issues.

Change-Id: I35041a904fb762a5b933b3e970f2d7a668803dcd
Bug: skia:12858, skia:11919
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/501019
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-01-27 19:13:57 +00:00
John Stiles
885a50684c Update MatrixFoldingES2 test to run on GPU.
This shook out a few driver issues.

Change-Id: If12f11c4b3b562fec402bddce25edf01a8be83b9
Bug: skia:12858, skia:11919
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/500816
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-01-27 18:29:11 +00:00
John Stiles
493a9c0cbc Fix up test SkSLInlineWithInoutArgument.
The test has been moved to shared/, since it's a valid test, but it is
no longer related to inlining, as the inliner no longer attempts to
inline functions with inouts at all.

Also, one function here (outParameterIgnore) actually invoked undefined
behavior and has been removed. According to the GLSL ES2 docs: "If a
function does not write to an out parameter, the value of the actual
parameter is undefined when the function returns." SkVM leaves the value
unchanged, so SKSL_TEST_CPU would pass, but a GPU might clear it (and in
fact, my GPU does).

Change-Id: I77c77ed1354bc980344ec5c406992bd62015f5e5
Bug: skia:11919
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/499752
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2022-01-25 21:33:45 +00:00
John Stiles
3b7fd14ea8 Move matrix-scalar splat tests into MatrixFolding.
Previously, matrix-scalar operations did not actually fold, so the tests
didn't live in folding/. In a followup CL, these will fold.

Bug: skia:12819
Change-Id: I6fdacf89088920719e7666d6c9b05ddffaf6cb6d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/497742
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2022-01-25 17:32:38 +00:00
John Stiles
63a4d65e16 Revert "Added tests for sksl clone() on our test corpus"
This reverts commit 0c9b8bae42.

Reason for revert: breaking bots, apparently due to use-after-free?
Could be a real clone bug...!

http://screen/9NenpjnYNoDU58G

Original change's description:
> Added tests for sksl clone() on our test corpus
>
> Change-Id: I9022a6aa53b039e5aec2ceeb0062d536e5e278c9
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/496601
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>

Change-Id: Ida8978a38ac24081895cd97a62718b6ec94f57c8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/497777
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>
2022-01-21 23:32:12 +00:00
Ethan Nicholas
0c9b8bae42 Added tests for sksl clone() on our test corpus
Change-Id: I9022a6aa53b039e5aec2ceeb0062d536e5e278c9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/496601
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2022-01-21 16:47:51 +00:00
Julia Lavrova
55c215cfb6 Reland "Better Matrix/Scalar testing"
This reverts commit 455e580b9c.

Reason for revert: Fixing the build break

Original change's description:
> Revert "Better Matrix/Scalar testing"
>
> This reverts commit abb611550e.
>
> Reason for revert: Build break
> Original change's description:
> > Better Matrix/Scalar testing
> >
> > Adding tests for matrix math and comparison
> > bug: skia:12681
> >
> > Change-Id: Ia1537ee2e411383749456fd6ff938b7c9a2e1061
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/493416
> > Reviewed-by: John Stiles <johnstiles@google.com>
> > Commit-Queue: Julia Lavrova <jlavrova@google.com>
>
> Change-Id: I70871b4b75c1f10e870dc5e884a42405a80fc0f9
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494816
> Reviewed-by: John Stiles <johnstiles@google.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>

Change-Id: Idef8dbcd6f5a5bbe84d3fd86888e3eab0f0521ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494817
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2022-01-14 19:12:00 +00:00
Julia Lavrova
455e580b9c Revert "Better Matrix/Scalar testing"
This reverts commit abb611550e.

Reason for revert: Build break
Original change's description:
> Better Matrix/Scalar testing
>
> Adding tests for matrix math and comparison
> bug: skia:12681
>
> Change-Id: Ia1537ee2e411383749456fd6ff938b7c9a2e1061
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/493416
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>

Change-Id: I70871b4b75c1f10e870dc5e884a42405a80fc0f9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494816
Reviewed-by: John Stiles <johnstiles@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2022-01-13 18:52:04 +00:00
Julia Lavrova
abb611550e Better Matrix/Scalar testing
Adding tests for matrix math and comparison
bug: skia:12681

Change-Id: Ia1537ee2e411383749456fd6ff938b7c9a2e1061
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/493416
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2022-01-13 15:35:12 +00:00
John Stiles
8522bf910a Add test for switch-case folding.
Change-Id: I3dabd77890a73ea054bb57d466a6ed8273eae3e8
Bug: skia:12811
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494196
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-01-12 22:24:55 +00:00
John Stiles
f604efbeb4 Add support for anonymous function parameters in SkSL.
Anonymous function parameters are now automatically assigned a name,
"_skAnonymousParamN", where N is the parameter index.

Change-Id: I87adcd51ed025c76ae2b333317f21b523a4632b4
Bug: skia:12769
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/489538
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-12-28 20:47:05 +00:00
Julia Lavrova
4388f16262 Fixing comparison for structs and arrays
Recursive comparison with tests

Bug: skia:12642
Change-Id: I344812a26f9af7b8a904c6faf6319df86ce57d03
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472997
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-12-06 20:46:41 +00:00
John Stiles
d7c3b21b79 Revert "Enable various switch tests in ES2 mode."
This reverts commit ffe365eb4d.

Reason for revert: crash inside IntelHD405 Vulkan driver
http://screen/6ugVDdjJpqDkxX6

Original change's description:
> Enable various switch tests in ES2 mode.
>
> switch is no longer an ES3-specific feature.
>
> Change-Id: Ic878a77268e517e17699c2e35a37da6b0a7765dd
> Bug: skia:12450
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452320
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

Bug: skia:12450
Change-Id: Id6f32a084f1bc7b2b3a1e5fb0b82d2011e4ba780
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/479059
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>
2021-12-02 19:03:11 +00:00
John Stiles
ffe365eb4d Enable various switch tests in ES2 mode.
switch is no longer an ES3-specific feature.

Change-Id: Ic878a77268e517e17699c2e35a37da6b0a7765dd
Bug: skia:12450
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452320
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-12-02 17:17:43 +00:00
Brian Osman
41e7df4fec Disable matrix constructor tests
Given how badly these fail (even on recent NVIDIA drivers), I'm prepared
to ignore the conformance suite on this one and just disallow this in
SkSL. For now, this disables these tests so that they don't crash for
anyone running an NV GPU.

Bug: skia:12443
Change-Id: I990eaa47acf0e23f4f0b6e90e136712d837b7f6d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/477477
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-11-30 18:08:57 +00:00
John Stiles
1991780081 Update LoopFloat/LoopInt tests to reduce hoisting.
Previously, none of our `runtime` tests relied on the input coordinate
in any way, so all of the logic was hoisted above the main loop in every
test. This CL adds an artificial reliance on the input coordinate so
that we have at least some SkVM tests with real code in the main loop.
This lets us see debug trace instructions interleaved with real code.

The input coordinate is clamped against a known uniform value
(`colorGreen` always contains 0101) so that the final test output
remains consistent in practice.

Additionally, I noticed that this test was only enabled in ES3, but
it doesn't seem to have anything ES3-specific in it, so it's now
enabled across the board.

Change-Id: Ie82f40b1060edb6071e300040ac59fb7d27094b0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470397
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-11-12 13:45:59 +00:00
John Stiles
107ea94139 Add support for clamp($genUType, ...) in SkSL.
We never used it internally, but the shaders used by Filament rely on
it. It doesn't exist in ES2 so this doesn't affect Runtime Effects.

Change-Id: Idb2afb15ff160b950ad02101bf6381a5d5c56468
Bug: skia:12635, skia:11209
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470156
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-11-11 18:43:42 +00:00
John Stiles
293bb46b2d Enable more ES3-specific SkSL tests.
Updated ReturnsValueOnEveryPathES3 to remove overlap with the ES2 tests,
and fixed some broken cases. Disabled the ReturnValueOnEveryPathES3 test
on Intel + Windows because switch statements on Intel + Windows are
pretty broken.

Change-Id: Id93e8af1ef7bf11fd74ef12a464c77d56cc032a0
Bug: skia:11209, skia:12465
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/467078
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-11-03 14:02:05 +00:00