Add const modifier to initialPreLocal identity matrix.

This makes expressions with `initialPreLocal` eligible for constant
folding. In practice, this doesn't do much today because matrix constant
folding doesn't support no-op-arithmetic elimination, but in a followup,
we could easily simplify `initialPreLocal * foo` --> `foo` when it's the
identity matrix.

Change-Id: I4c6faf2aa550b6b9776dd8a5da9ea5ec06cd8330
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/540316
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
John Stiles 2022-05-13 09:31:06 -04:00 committed by SkCQ
parent f4b4420410
commit f6e31bf1dc

View File

@ -159,7 +159,7 @@ std::string SkShaderInfo::toSkSL() const {
result += "void main() {\n";
if (this->needsLocalCoords()) {
result += "float4x4 initialPreLocal = float4x4(1);\n";
result += "const float4x4 initialPreLocal = float4x4(1);\n";
}
std::string parentPreLocal = "initialPreLocal";