skia2/tests/sksl/folding
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
..
ArrayFolding.glsl Improve index-folding of arrays and matrices. 2021-11-11 18:59:04 +00:00
ArraySizeFolding.glsl Add test for vector constant folding. 2022-01-12 17:23:20 +00:00
AssignmentOps.glsl Performance experiment: disable control-flow analysis. 2021-03-08 19:41:19 +00:00
BoolFolding.glsl Improve constant folding for boolean vectors. 2021-08-24 18:12:12 +00:00
CastFolding.glsl Fold casts of known values at compile time. 2021-05-07 22:04:48 +00:00
FloatFolding.glsl Remove 0/x arithmetic simplification. 2021-08-24 19:18:41 +00:00
IntFoldingES2.glsl Remove 0/x arithmetic simplification. 2021-08-24 19:18:41 +00:00
IntFoldingES3.glsl Revert "Inline functions of the form 'return (expr)' only." 2021-03-15 22:08:48 +00:00
MatrixFoldingES2.glsl Add support for constant folding of matrix-times-matrix. 2022-02-08 14:35:45 +00:00
MatrixFoldingES3.glsl Add support for constant folding of matrix-times-matrix. 2022-02-08 14:35:45 +00:00
Negation.glsl [sksl] Special-case unary negation on matrix types in MSL/SPIR-V 2022-03-01 20:14:46 +00:00
SelfAssignment.glsl Performance experiment: disable control-flow analysis. 2021-03-08 19:41:19 +00:00
ShortCircuitBoolFolding.glsl Remove usage of sqrt() as an optimization barrier in tests. 2021-05-24 17:18:54 +00:00
SwitchCaseFolding.glsl Simplify control flow in switch test to unbreak iOS. 2022-01-13 14:49:06 +00:00
SwizzleFolding.glsl Reland "Optimize away swizzles of constant variables." 2021-04-30 13:12:18 +00:00
VectorScalarFolding.glsl Remove 0/x arithmetic simplification. 2021-08-24 19:18:41 +00:00
VectorVectorFolding.glsl Remove 0/x arithmetic simplification. 2021-08-24 19:18:41 +00:00