Disallow initializers on uniform variables
Bug: skia:11335 Change-Id: I88c952cbfe2d2c5920e17675da1674928f37b982 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371480 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
5e603c3a46
commit
2fe67f9680
@ -175,6 +175,7 @@ sksl_error_tests = [
|
||||
"/sksl/errors/UndeclaredFunction.sksl",
|
||||
"/sksl/errors/UndefinedFunction.sksl",
|
||||
"/sksl/errors/UndefinedSymbol.sksl",
|
||||
"/sksl/errors/UniformVarWithInitializerExpression.sksl",
|
||||
"/sksl/errors/UnknownDivideByZero.sksl",
|
||||
"/sksl/errors/Unreachable.sksl",
|
||||
"/sksl/errors/UnsupportedGLSLIdentifiers.sksl",
|
||||
|
@ -1,5 +1,5 @@
|
||||
uniform float uf = 1;
|
||||
uniform int ui = 1;
|
||||
uniform float uf;
|
||||
uniform int ui;
|
||||
const float cf = 1;
|
||||
const int ci = 1;
|
||||
int i = 1;
|
||||
|
@ -0,0 +1,3 @@
|
||||
uniform float x = 1;
|
||||
float y;
|
||||
uniform float z = y = 1;
|
@ -472,6 +472,10 @@ std::unique_ptr<Statement> IRGenerator::convertVarDeclaration(int offset,
|
||||
this->errorReporter().error(value->fOffset,
|
||||
"'in' variables cannot use initializer expressions");
|
||||
}
|
||||
if (modifiers.fFlags & Modifiers::kUniform_Flag) {
|
||||
this->errorReporter().error(value->fOffset,
|
||||
"'uniform' variables cannot use initializer expressions");
|
||||
}
|
||||
value = this->coerce(std::move(value), *type);
|
||||
if (!value) {
|
||||
return {};
|
||||
|
@ -0,0 +1,5 @@
|
||||
### Compilation failed:
|
||||
|
||||
error: 1: 'uniform' variables cannot use initializer expressions
|
||||
error: 3: 'uniform' variables cannot use initializer expressions
|
||||
2 errors
|
Loading…
Reference in New Issue
Block a user