skia2/tests/sksl
John Stiles 6ee5d9e3c9 Improve index-folding of arrays and matrices.
Yesterday's implementation was close but I realized later that it wasn't
quite ideal.
- Array index-folding was gated on `isCompileTimeConstant`, which is too
  strict. The real limitation is `hasSideEffects`. If an array contains
  a side-effecting expression, we should leave it alone. Otherwise it
  is safe to pluck out an element from the array and toss the rest.
- Matrix index-folding was gated on `getConstantSubexpression` for the
  extracted elements, but did not check the other elements at all. This
  was too lenient; we now only proceed to the folding step if
  `hasSideEffects` returns false.

I added some tests to verify the final behavior and also discovered a
small related issue. Diagonal matrices were not substituting literals
in for constant-values, which inhibited folding as well and would break
constant-expression evaluation. This is now fixed.

Change-Id: Idda32fd8643c1f32ba21475251cd4d4dd7cea94c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470396
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:59:04 +00:00
..
blend Reland "Add support for half-precision types in Metal." 2021-10-30 14:33:52 +00:00
errors Add tests for matrix constant-expressions. 2021-11-10 20:59:36 +00:00
folding Improve index-folding of arrays and matrices. 2021-11-11 18:59:04 +00:00
glsl Report an error if sk_LastFragColor is referenced without fbFetchSupport 2021-09-15 15:41:49 +00:00
inliner Add tests for inlining functions with out/inout params. 2021-11-11 18:46:21 +00:00
intrinsics Add support for clamp($genUType, ...) in SkSL. 2021-11-11 18:43:42 +00:00
metal Reland "Add support for half-precision types in Metal." 2021-10-30 14:33:52 +00:00
runtime Add trace opcodes for function entry/exit. 2021-11-09 16:35:02 +00:00
runtime_errors Report incomplete expression-statements as errors. 2021-11-09 22:10:18 +00:00
shared Optimize indexing into an array with a constant-expression. 2021-11-10 19:43:58 +00:00
spirv Fix parsing error with SPIR-V negating a uint. 2021-08-25 17:52:50 +00:00
workarounds Remove the "in blend modes randomly fail for all zero vec" workaround 2021-10-21 16:54:51 +00:00
README.txt Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00

This directory contains skslc-compiled output from matching source files
in the /resources/sksl/ directory.