we now complain if an SkSL program tries to override the default output
Bug: skia: Change-Id: I387ddc3aac0712eb6c0a6ea39e48e5f3d809bc48 Reviewed-on: https://skia-review.googlesource.com/114691 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
parent
ea022cd714
commit
6c94271f55
@ -243,6 +243,12 @@ std::unique_ptr<VarDeclarations> IRGenerator::convertVarDeclarations(const ASTVa
|
||||
return nullptr;
|
||||
}
|
||||
for (const auto& varDecl : decl.fVars) {
|
||||
if (decl.fModifiers.fLayout.fLocation == 0 && decl.fModifiers.fLayout.fIndex == 0 &&
|
||||
(decl.fModifiers.fFlags & Modifiers::kOut_Flag) && fKind == Program::kFragment_Kind &&
|
||||
varDecl.fName != "sk_FragColor") {
|
||||
fErrors.error(decl.fOffset,
|
||||
"out location=0, index=0 is reserved for sk_FragColor");
|
||||
}
|
||||
const Type* type = baseType;
|
||||
std::vector<std::unique_ptr<Expression>> sizes;
|
||||
for (const auto& rawSize : varDecl.fSizes) {
|
||||
|
@ -497,4 +497,9 @@ DEF_TEST(SkSLInterfaceBlockScope, r) {
|
||||
"error: 1: unknown identifier 'x'\n1 error\n");
|
||||
}
|
||||
|
||||
DEF_TEST(SkSLDuplicateOutput, r) {
|
||||
test_failure(r,
|
||||
"layout (location=0, index=0) out half4 duplicateOutput;",
|
||||
"error: 1: out location=0, index=0 is reserved for sk_FragColor\n1 error\n");
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user