From 0b822795afd672b7589dc2dfdfb48fa1555c5fdd Mon Sep 17 00:00:00 2001 From: John Stiles Date: Tue, 4 May 2021 17:41:53 -0400 Subject: [PATCH] Remove the ModifiersPool argument to FunctionDeclaration::Convert. The modifier pool is in the Context now and doesn't need to be passed separately. Change-Id: I92388ebfd4dfd69360455efa1b1e2558c512a950 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404341 Auto-Submit: John Stiles Commit-Queue: Ethan Nicholas Reviewed-by: Ethan Nicholas --- src/sksl/SkSLIRGenerator.cpp | 1 - src/sksl/dsl/DSLFunction.cpp | 2 +- src/sksl/ir/SkSLFunctionDeclaration.cpp | 10 +++++----- src/sksl/ir/SkSLFunctionDeclaration.h | 1 - 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/sksl/SkSLIRGenerator.cpp b/src/sksl/SkSLIRGenerator.cpp index 822d2a5c07..4cf5f08387 100644 --- a/src/sksl/SkSLIRGenerator.cpp +++ b/src/sksl/SkSLIRGenerator.cpp @@ -1010,7 +1010,6 @@ void IRGenerator::convertFunction(const ASTNode& f) { const FunctionDeclaration* decl = FunctionDeclaration::Convert( fContext, *fSymbolTable, - this->modifiersPool(), f.fOffset, this->modifiersPool().add(declModifiers), funcData.fName, diff --git a/src/sksl/dsl/DSLFunction.cpp b/src/sksl/dsl/DSLFunction.cpp index b27cab37a9..8b4937a031 100644 --- a/src/sksl/dsl/DSLFunction.cpp +++ b/src/sksl/dsl/DSLFunction.cpp @@ -66,7 +66,7 @@ void DSLFunction::init(const DSLType& returnType, const char* name, } fDecl = SkSL::FunctionDeclaration::Convert(DSLWriter::Context(), *DSLWriter::SymbolTable(), - *DSLWriter::Context().fModifiersPool, /*offset=*/-1, + /*offset=*/-1, DSLWriter::Modifiers(SkSL::Modifiers()), isMain ? name : DSLWriter::Name(name), std::move(paramVars), fReturnType, diff --git a/src/sksl/ir/SkSLFunctionDeclaration.cpp b/src/sksl/ir/SkSLFunctionDeclaration.cpp index 56c73cfca1..801e3c526b 100644 --- a/src/sksl/ir/SkSLFunctionDeclaration.cpp +++ b/src/sksl/ir/SkSLFunctionDeclaration.cpp @@ -47,7 +47,7 @@ static bool check_return_type(const Context& context, int offset, const Type& re return true; } -static bool check_parameters(const Context& context, ModifiersPool& modifiersPool, +static bool check_parameters(const Context& context, std::vector>& parameters, bool isMain, bool isBuiltin) { auto typeIsValidForColor = [&](const Type& type) { @@ -83,7 +83,7 @@ static bool check_parameters(const Context& context, ModifiersPool& modifiersPoo m.fLayout.fBuiltin = SK_INPUT_COLOR_BUILTIN; } if (m.fLayout.fBuiltin) { - param->setModifiers(modifiersPool.add(m)); + param->setModifiers(context.fModifiersPool->add(m)); } } if (isMain && (kind == ProgramKind::kFragment)) { @@ -92,7 +92,7 @@ static bool check_parameters(const Context& context, ModifiersPool& modifiersPoo // coords parameter. We turn it into sk_FragCoord. if (type == *context.fTypes.fFloat2) { m.fLayout.fBuiltin = SK_FRAGCOORD_BUILTIN; - param->setModifiers(modifiersPool.add(m)); + param->setModifiers(context.fModifiersPool->add(m)); } } } @@ -267,7 +267,7 @@ static bool find_existing_declaration(const Context& context, SymbolTable& symbo } const FunctionDeclaration* FunctionDeclaration::Convert(const Context& context, - SymbolTable& symbols, ModifiersPool& modifiersPool, int offset, const Modifiers* modifiers, + SymbolTable& symbols, int offset, const Modifiers* modifiers, StringFragment name, std::vector> parameters, const Type* returnType, bool isBuiltin) { bool isMain = (name == "main"); @@ -275,7 +275,7 @@ const FunctionDeclaration* FunctionDeclaration::Convert(const Context& context, const FunctionDeclaration* decl = nullptr; if (!check_modifiers(context, offset, *modifiers) || !check_return_type(context, offset, *returnType, isBuiltin) || - !check_parameters(context, modifiersPool, parameters, isMain, isBuiltin) || + !check_parameters(context, parameters, isMain, isBuiltin) || (isMain && !check_main_signature(context, offset, *returnType, parameters, isBuiltin)) || !find_existing_declaration(context, symbols, offset, name, parameters, returnType, isBuiltin, &decl)) { diff --git a/src/sksl/ir/SkSLFunctionDeclaration.h b/src/sksl/ir/SkSLFunctionDeclaration.h index da3b4e6ad8..01733723fe 100644 --- a/src/sksl/ir/SkSLFunctionDeclaration.h +++ b/src/sksl/ir/SkSLFunctionDeclaration.h @@ -41,7 +41,6 @@ public: static const FunctionDeclaration* Convert(const Context& context, SymbolTable& symbols, - ModifiersPool& modifiersPool, int offset, const Modifiers* modifiers, StringFragment name,