Add const to SkSL layout keys.

This will allow @if statements to work properly with layout(key) values
even with control-flow analysis disabled.

Change-Id: Ib76b8c5553621815decda7fb0eefccb2c82df02b
Bug: skia:11319
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/378416
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
John Stiles 2021-03-02 14:59:41 -05:00
parent bc4a36af7c
commit 46f4497cb6
2 changed files with 2 additions and 2 deletions

View File

@ -48,7 +48,7 @@ public:
kFloat3x3_GrSLType, "invVM");
}
fragBuilder->codeAppendf(
R"SkSL(/* key */ bool highPrecision = %s;
R"SkSL(/* key */ const bool highPrecision = %s;
half xCoverage;
half yCoverage;

View File

@ -243,7 +243,7 @@ struct Layout {
result = "layout (" + result + ")";
}
if (fFlags & kKey_Flag) {
result += "/* key */";
result += "/* key */ const";
}
return result;
}