diff options
author | Brian Osman <brianosman@google.com> | 2023-02-22 17:24:16 -0500 |
---|---|---|
committer | SkCQ <skcq-be@skia-corp.google.com.iam.gserviceaccount.com> | 2023-02-23 15:49:12 +0000 |
commit | d8918d5b26b799d8b806f6688c6e2a05d85d34a2 (patch) | |
tree | 3ec69b45ac0c4a8ef37157d32db7598d2ee3d648 /src | |
parent | 88338f726819e04b5ddf46f66d50c0c86a486a4f (diff) | |
download | skia-d8918d5b26b799d8b806f6688c6e2a05d85d34a2.tar.gz |
Remove external functions from SkSL
Bug: skia:13667
Change-Id: I6495a123f39d8471c88226e40afab1da6a76631f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/647838
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/sksl/SkSLAnalysis.cpp | 9 | ||||
-rw-r--r-- | src/sksl/SkSLCompiler.cpp | 9 | ||||
-rw-r--r-- | src/sksl/SkSLCompiler.h | 5 | ||||
-rw-r--r-- | src/sksl/SkSLInliner.cpp | 16 | ||||
-rw-r--r-- | src/sksl/SkSLProgramSettings.h | 6 | ||||
-rw-r--r-- | src/sksl/SkSLThreadContext.cpp | 8 | ||||
-rw-r--r-- | src/sksl/analysis/SkSLFinalizationChecks.cpp | 1 | ||||
-rw-r--r-- | src/sksl/analysis/SkSLHasSideEffects.cpp | 2 | ||||
-rw-r--r-- | src/sksl/analysis/SkSLIsConstantExpression.cpp | 2 | ||||
-rw-r--r-- | src/sksl/codegen/SkSLVMCodeGenerator.cpp | 31 | ||||
-rw-r--r-- | src/sksl/ir/BUILD.bazel | 3 | ||||
-rw-r--r-- | src/sksl/ir/SkSLExpression.cpp | 1 | ||||
-rw-r--r-- | src/sksl/ir/SkSLExpression.h | 2 | ||||
-rw-r--r-- | src/sksl/ir/SkSLExternalFunction.h | 59 | ||||
-rw-r--r-- | src/sksl/ir/SkSLExternalFunctionCall.h | 69 | ||||
-rw-r--r-- | src/sksl/ir/SkSLExternalFunctionReference.h | 49 | ||||
-rw-r--r-- | src/sksl/ir/SkSLFunctionCall.cpp | 24 |
17 files changed, 1 insertions, 295 deletions
diff --git a/src/sksl/SkSLAnalysis.cpp b/src/sksl/SkSLAnalysis.cpp index 33382946bc..a7aba3d02c 100644 --- a/src/sksl/SkSLAnalysis.cpp +++ b/src/sksl/SkSLAnalysis.cpp @@ -35,7 +35,6 @@ #include "src/sksl/ir/SkSLDoStatement.h" #include "src/sksl/ir/SkSLExpression.h" #include "src/sksl/ir/SkSLExpressionStatement.h" -#include "src/sksl/ir/SkSLExternalFunctionCall.h" #include "src/sksl/ir/SkSLFieldAccess.h" #include "src/sksl/ir/SkSLForStatement.h" #include "src/sksl/ir/SkSLFunctionCall.h" @@ -539,7 +538,6 @@ bool ProgramVisitor::visit(const Program& program) { template <typename T> bool TProgramVisitor<T>::visitExpression(typename T::Expression& e) { switch (e.kind()) { - case Expression::Kind::kExternalFunctionReference: case Expression::Kind::kFunctionReference: case Expression::Kind::kLiteral: case Expression::Kind::kMethodReference: @@ -578,13 +576,6 @@ template <typename T> bool TProgramVisitor<T>::visitExpression(typename T::Expre } return false; } - case Expression::Kind::kExternalFunctionCall: { - auto& c = e.template as<ExternalFunctionCall>(); - for (auto& arg : c.arguments()) { - if (this->visitExpressionPtr(arg)) { return true; } - } - return false; - } case Expression::Kind::kFieldAccess: return this->visitExpressionPtr(e.template as<FieldAccess>().base()); diff --git a/src/sksl/SkSLCompiler.cpp b/src/sksl/SkSLCompiler.cpp index 8b3dbb0816..bc47e5031b 100644 --- a/src/sksl/SkSLCompiler.cpp +++ b/src/sksl/SkSLCompiler.cpp @@ -26,8 +26,6 @@ #include "src/sksl/SkSLStringStream.h" #include "src/sksl/analysis/SkSLProgramUsage.h" #include "src/sksl/ir/SkSLExpression.h" -#include "src/sksl/ir/SkSLExternalFunction.h" -#include "src/sksl/ir/SkSLExternalFunctionReference.h" #include "src/sksl/ir/SkSLField.h" #include "src/sksl/ir/SkSLFieldAccess.h" #include "src/sksl/ir/SkSLFunctionDeclaration.h" @@ -202,9 +200,6 @@ void Compiler::FinalizeSettings(ProgramSettings* settings, ProgramKind kind) { // For "generic" interpreter programs, leave all functions intact. (The SkVM API supports // calling any function, not just 'main'). settings->fRemoveDeadFunctions = false; - } else { - // Only generic programs (limited to CPU) are able to use external functions. - SkASSERT(!settings->fExternalFunctions); } // Runtime effects always allow narrowing conversions. @@ -287,10 +282,6 @@ std::unique_ptr<Expression> Compiler::convertIdentifier(Position pos, std::strin dsl::DSLType dslType(result->name(), &modifiers, pos); return TypeReference::Convert(*fContext, pos, &dslType.skslType()); } - case Symbol::Kind::kExternal: { - const ExternalFunction* r = &result->as<ExternalFunction>(); - return std::make_unique<ExternalFunctionReference>(pos, r); - } default: SK_ABORT("unsupported symbol type %d\n", (int) result->kind()); } diff --git a/src/sksl/SkSLCompiler.h b/src/sksl/SkSLCompiler.h index eb9e7eb980..382c69609b 100644 --- a/src/sksl/SkSLCompiler.h +++ b/src/sksl/SkSLCompiler.h @@ -129,11 +129,6 @@ public: static void EnableOptimizer(OverrideFlag flag) { sOptimizer = flag; } static void EnableInliner(OverrideFlag flag) { sInliner = flag; } - /** - * If fExternalFunctions is supplied in the settings, those values are registered in the symbol - * table of the Program, but ownership is *not* transferred. It is up to the caller to keep them - * alive. - */ std::unique_ptr<Program> convertProgram(ProgramKind kind, std::string text, ProgramSettings settings); diff --git a/src/sksl/SkSLInliner.cpp b/src/sksl/SkSLInliner.cpp index cc16dd3a27..d90227e3bb 100644 --- a/src/sksl/SkSLInliner.cpp +++ b/src/sksl/SkSLInliner.cpp @@ -36,7 +36,6 @@ #include "src/sksl/ir/SkSLConstructorStruct.h" #include "src/sksl/ir/SkSLDoStatement.h" #include "src/sksl/ir/SkSLExpressionStatement.h" -#include "src/sksl/ir/SkSLExternalFunctionCall.h" #include "src/sksl/ir/SkSLFieldAccess.h" #include "src/sksl/ir/SkSLForStatement.h" #include "src/sksl/ir/SkSLFunctionCall.h" @@ -250,13 +249,6 @@ std::unique_ptr<Expression> Inliner::inlineExpression(Position pos, *ctor.type().clone(symbolTableForExpression), argList(ctor.arguments())); } - case Expression::Kind::kExternalFunctionCall: { - const ExternalFunctionCall& externalCall = expression.as<ExternalFunctionCall>(); - return std::make_unique<ExternalFunctionCall>(pos, &externalCall.function(), - argList(externalCall.arguments())); - } - case Expression::Kind::kExternalFunctionReference: - return expression.clone(); case Expression::Kind::kFieldAccess: { const FieldAccess& f = expression.as<FieldAccess>(); return FieldAccess::Make(*fContext, pos, expr(f.base()), f.fieldIndex(), f.ownerKind()); @@ -789,7 +781,6 @@ public: } switch ((*expr)->kind()) { - case Expression::Kind::kExternalFunctionReference: case Expression::Kind::kFieldAccess: case Expression::Kind::kFunctionReference: case Expression::Kind::kLiteral: @@ -842,13 +833,6 @@ public: } break; } - case Expression::Kind::kExternalFunctionCall: { - ExternalFunctionCall& funcCallExpr = (*expr)->as<ExternalFunctionCall>(); - for (std::unique_ptr<Expression>& arg : funcCallExpr.arguments()) { - this->visitExpression(&arg); - } - break; - } case Expression::Kind::kFunctionCall: { FunctionCall& funcCallExpr = (*expr)->as<FunctionCall>(); for (std::unique_ptr<Expression>& arg : funcCallExpr.arguments()) { diff --git a/src/sksl/SkSLProgramSettings.h b/src/sksl/SkSLProgramSettings.h index c51ccc294a..4492daf630 100644 --- a/src/sksl/SkSLProgramSettings.h +++ b/src/sksl/SkSLProgramSettings.h @@ -16,8 +16,6 @@ namespace SkSL { -class ExternalFunction; - /** * Holds the compiler settings for a program. */ @@ -83,10 +81,6 @@ struct ProgramSettings { // If true, VarDeclaration can be cloned for testing purposes. See VarDeclaration::clone for // more information. bool fAllowVarDeclarationCloneForTesting = false; - // External functions available for use in runtime effects. These values are registered in the - // symbol table of the Program, but ownership is *not* transferred. It is up to the caller to - // keep them alive. - const std::vector<std::unique_ptr<ExternalFunction>>* fExternalFunctions = nullptr; // If true, SPIR-V codegen restricted to a subset supported by Dawn. // TODO(skia:13840, skia:14023): Remove this setting when Skia can use WGSL on Dawn. bool fSPIRVDawnCompatMode = false; diff --git a/src/sksl/SkSLThreadContext.cpp b/src/sksl/SkSLThreadContext.cpp index 3a69b59b33..58d9b40d83 100644 --- a/src/sksl/SkSLThreadContext.cpp +++ b/src/sksl/SkSLThreadContext.cpp @@ -12,7 +12,6 @@ #include "src/sksl/SkSLCompiler.h" #include "src/sksl/SkSLModifiersPool.h" #include "src/sksl/SkSLPool.h" -#include "src/sksl/ir/SkSLExternalFunction.h" #include "src/sksl/ir/SkSLSymbolTable.h" #include <type_traits> @@ -71,13 +70,6 @@ void ThreadContext::setupSymbolTable() { SkSL::SymbolTable& symbolTable = *fCompiler->fSymbolTable; symbolTable.markModuleBoundary(); - - if (fSettings.fExternalFunctions) { - // Add any external values to the new symbol table, so they're only visible to this Program. - for (const std::unique_ptr<ExternalFunction>& ef : *fSettings.fExternalFunctions) { - symbolTable.addWithoutOwnership(ef.get()); - } - } } SkSL::Context& ThreadContext::Context() { diff --git a/src/sksl/analysis/SkSLFinalizationChecks.cpp b/src/sksl/analysis/SkSLFinalizationChecks.cpp index 2cb0bd94fc..f1c0b4cdfa 100644 --- a/src/sksl/analysis/SkSLFinalizationChecks.cpp +++ b/src/sksl/analysis/SkSLFinalizationChecks.cpp @@ -135,7 +135,6 @@ public: } break; } - case Expression::Kind::kExternalFunctionReference: case Expression::Kind::kFunctionReference: case Expression::Kind::kMethodReference: case Expression::Kind::kTypeReference: diff --git a/src/sksl/analysis/SkSLHasSideEffects.cpp b/src/sksl/analysis/SkSLHasSideEffects.cpp index dbb2b149e5..0d328991e0 100644 --- a/src/sksl/analysis/SkSLHasSideEffects.cpp +++ b/src/sksl/analysis/SkSLHasSideEffects.cpp @@ -46,8 +46,6 @@ bool Analysis::HasSideEffects(const Expression& expr) { } break; } - case Expression::Kind::kExternalFunctionCall: - case Expression::Kind::kExternalFunctionReference: case Expression::Kind::kPostfix: return true; diff --git a/src/sksl/analysis/SkSLIsConstantExpression.cpp b/src/sksl/analysis/SkSLIsConstantExpression.cpp index c22fb01625..d0a54d2d4b 100644 --- a/src/sksl/analysis/SkSLIsConstantExpression.cpp +++ b/src/sksl/analysis/SkSLIsConstantExpression.cpp @@ -80,14 +80,12 @@ public: // constant-expressions should result in a constant-expression. SkSL handles this by // optimizing fully-constant function calls into literals in FunctionCall::Make. case Expression::Kind::kFunctionCall: - case Expression::Kind::kExternalFunctionCall: case Expression::Kind::kChildCall: // These shouldn't appear in a valid program at all, and definitely aren't // constant-(index)-expressions. case Expression::Kind::kPoison: case Expression::Kind::kFunctionReference: - case Expression::Kind::kExternalFunctionReference: case Expression::Kind::kMethodReference: case Expression::Kind::kTypeReference: return true; diff --git a/src/sksl/codegen/SkSLVMCodeGenerator.cpp b/src/sksl/codegen/SkSLVMCodeGenerator.cpp index b0639057d6..b18be309a6 100644 --- a/src/sksl/codegen/SkSLVMCodeGenerator.cpp +++ b/src/sksl/codegen/SkSLVMCodeGenerator.cpp @@ -40,8 +40,6 @@ #include "src/sksl/ir/SkSLConstructorSplat.h" #include "src/sksl/ir/SkSLExpression.h" #include "src/sksl/ir/SkSLExpressionStatement.h" -#include "src/sksl/ir/SkSLExternalFunction.h" -#include "src/sksl/ir/SkSLExternalFunctionCall.h" #include "src/sksl/ir/SkSLFieldAccess.h" #include "src/sksl/ir/SkSLForStatement.h" #include "src/sksl/ir/SkSLFunctionCall.h" @@ -301,7 +299,6 @@ private: Value writeConstructorCast(const AnyConstructor& c); Value writeConstructorSplat(const ConstructorSplat& c); Value writeFunctionCall(const FunctionCall& c); - Value writeExternalFunctionCall(const ExternalFunctionCall& c); Value writeFieldAccess(const FieldAccess& expr); Value writeLiteral(const Literal& l); Value writeIndexExpression(const IndexExpression& expr); @@ -1626,31 +1623,6 @@ Value SkVMGenerator::writeFunctionCall(const FunctionCall& call) { return this->getSlotValue(returnSlot, call.type().slotCount()); } -Value SkVMGenerator::writeExternalFunctionCall(const ExternalFunctionCall& c) { - // Evaluate all arguments, gather the results into a contiguous list of F32 - std::vector<skvm::F32> args; - for (const auto& arg : c.arguments()) { - Value v = this->writeExpression(*arg); - for (size_t i = 0; i < v.slots(); ++i) { - args.push_back(f32(v[i])); - } - } - - // Create storage for the return value - size_t nslots = c.type().slotCount(); - std::vector<skvm::F32> result(nslots, fBuilder->splat(0.0f)); - - c.function().call(fBuilder, args.data(), result.data(), this->mask()); - - // Convert from 'vector of F32' to Value - Value resultVal(nslots); - for (size_t i = 0; i < nslots; ++i) { - resultVal[i] = result[i]; - } - - return resultVal; -} - Value SkVMGenerator::writeLiteral(const Literal& l) { if (l.type().isFloat()) { return fBuilder->splat(l.as<Literal>().floatValue()); @@ -1795,8 +1767,6 @@ Value SkVMGenerator::writeExpression(const Expression& e) { return this->writeLiteral(e.as<Literal>()); case Expression::Kind::kFunctionCall: return this->writeFunctionCall(e.as<FunctionCall>()); - case Expression::Kind::kExternalFunctionCall: - return this->writeExternalFunctionCall(e.as<ExternalFunctionCall>()); case Expression::Kind::kPrefix: return this->writePrefixExpression(e.as<PrefixExpression>()); case Expression::Kind::kPostfix: @@ -1805,7 +1775,6 @@ Value SkVMGenerator::writeExpression(const Expression& e) { return this->writeSwizzle(e.as<Swizzle>()); case Expression::Kind::kTernary: return this->writeTernaryExpression(e.as<TernaryExpression>()); - case Expression::Kind::kExternalFunctionReference: default: SkDEBUGFAIL("Unsupported expression"); return {}; diff --git a/src/sksl/ir/BUILD.bazel b/src/sksl/ir/BUILD.bazel index ed62fa9c01..c265b3a199 100644 --- a/src/sksl/ir/BUILD.bazel +++ b/src/sksl/ir/BUILD.bazel @@ -42,9 +42,6 @@ IR_FILES = [ "SkSLExpressionStatement.cpp", "SkSLExpressionStatement.h", "SkSLExtension.h", - "SkSLExternalFunction.h", - "SkSLExternalFunctionCall.h", - "SkSLExternalFunctionReference.h", "SkSLField.h", "SkSLFieldAccess.cpp", "SkSLFieldAccess.h", diff --git a/src/sksl/ir/SkSLExpression.cpp b/src/sksl/ir/SkSLExpression.cpp index 3ad6462469..b6ebb7b0ec 100644 --- a/src/sksl/ir/SkSLExpression.cpp +++ b/src/sksl/ir/SkSLExpression.cpp @@ -21,7 +21,6 @@ std::string Expression::description() const { bool Expression::isIncomplete(const Context& context) const { switch (this->kind()) { case Kind::kFunctionReference: - case Kind::kExternalFunctionReference: context.fErrors->error(fPosition.after(), "expected '(' to begin function call"); return true; diff --git a/src/sksl/ir/SkSLExpression.h b/src/sksl/ir/SkSLExpression.h index 0b4b386099..6336b4a5ef 100644 --- a/src/sksl/ir/SkSLExpression.h +++ b/src/sksl/ir/SkSLExpression.h @@ -47,7 +47,7 @@ public: bool isAnyConstructor() const { static_assert((int)Kind::kConstructorArray - 1 == (int)Kind::kChildCall); - static_assert((int)Kind::kConstructorStruct + 1 == (int)Kind::kExternalFunctionCall); + static_assert((int)Kind::kConstructorStruct + 1 == (int)Kind::kFieldAccess); return this->kind() >= Kind::kConstructorArray && this->kind() <= Kind::kConstructorStruct; } diff --git a/src/sksl/ir/SkSLExternalFunction.h b/src/sksl/ir/SkSLExternalFunction.h deleted file mode 100644 index 7a3fdb5985..0000000000 --- a/src/sksl/ir/SkSLExternalFunction.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2019 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_EXTERNALFUNCTION -#define SKSL_EXTERNALFUNCTION - -#include "include/private/SkSLSymbol.h" -#include "src/core/SkVM.h" - -namespace SkSL { - -class Type; - -class ExternalFunction : public Symbol { -public: - inline static constexpr Kind kIRNodeKind = Kind::kExternal; - - ExternalFunction(const char* name, const Type& type) - : INHERITED(Position(), kIRNodeKind, name, &type) {} - - virtual int callParameterCount() const = 0; - - /** - * Fills in the outTypes array with pointers to the parameter types. outTypes must be able to - * hold callParameterCount() pointers. - */ - virtual void getCallParameterTypes(const Type** outTypes) const = 0; - - virtual void call(skvm::Builder* builder, - skvm::F32* arguments, - skvm::F32* outResult, - skvm::I32 mask) const = 0; - - std::string description() const override { - return "external<" + std::string(this->name()) + ">"; - } - - // Disable IRNode pooling on external function nodes. ExternalFunction node lifetimes are - // controlled by the calling code; we can't guarantee that they will be destroyed before a - // Program is freed. (In fact, it's very unlikely that they would be.) - static void* operator new(const size_t size) { - return ::operator new(size); - } - - static void operator delete(void* ptr) { - ::operator delete(ptr); - } - -private: - using INHERITED = Symbol; -}; - -} // namespace SkSL - -#endif diff --git a/src/sksl/ir/SkSLExternalFunctionCall.h b/src/sksl/ir/SkSLExternalFunctionCall.h deleted file mode 100644 index ddbf79a968..0000000000 --- a/src/sksl/ir/SkSLExternalFunctionCall.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2019 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_EXTERNALFUNCTIONCALL -#define SKSL_EXTERNALFUNCTIONCALL - -#include "include/private/SkSLString.h" -#include "include/private/base/SkTArray.h" -#include "include/sksl/SkSLOperator.h" -#include "src/sksl/ir/SkSLExpression.h" -#include "src/sksl/ir/SkSLExternalFunction.h" -#include "src/sksl/ir/SkSLFunctionDeclaration.h" - -namespace SkSL { - -/** - * An external function invocation. - */ -class ExternalFunctionCall final : public Expression { -public: - inline static constexpr Kind kIRNodeKind = Kind::kExternalFunctionCall; - - ExternalFunctionCall(Position pos, const ExternalFunction* function, ExpressionArray arguments) - : INHERITED(pos, kIRNodeKind, &function->type()) - , fFunction(*function) - , fArguments(std::move(arguments)) {} - - ExpressionArray& arguments() { - return fArguments; - } - - const ExpressionArray& arguments() const { - return fArguments; - } - - const ExternalFunction& function() const { - return fFunction; - } - - std::unique_ptr<Expression> clone(Position pos) const override { - return std::make_unique<ExternalFunctionCall>(pos, &this->function(), - this->arguments().clone()); - } - - std::string description(OperatorPrecedence) const override { - std::string result = std::string(this->function().name()) + "("; - auto separator = SkSL::String::Separator(); - for (const std::unique_ptr<Expression>& arg : this->arguments()) { - result += separator(); - result += arg->description(OperatorPrecedence::kSequence); - } - result += ")"; - return result; - } - -private: - const ExternalFunction& fFunction; - ExpressionArray fArguments; - - using INHERITED = Expression; -}; - -} // namespace SkSL - -#endif diff --git a/src/sksl/ir/SkSLExternalFunctionReference.h b/src/sksl/ir/SkSLExternalFunctionReference.h deleted file mode 100644 index 06e06fc6c7..0000000000 --- a/src/sksl/ir/SkSLExternalFunctionReference.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2019 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_EXTERNALFUNCTIONREFERENCE -#define SKSL_EXTERNALFUNCTIONREFERENCE - -#include "src/sksl/ir/SkSLExpression.h" -#include "src/sksl/ir/SkSLExternalFunction.h" - -namespace SkSL { - -/** - * Represents an identifier referring to an ExternalFunction. This is an intermediate value: - * ExternalFunctionReferences are always eventually replaced by ExternalFunctionCalls in valid - * programs. - */ -class ExternalFunctionReference final : public Expression { -public: - inline static constexpr Kind kIRNodeKind = Kind::kExternalFunctionReference; - - ExternalFunctionReference(Position pos, const ExternalFunction* ef) - : INHERITED(pos, kIRNodeKind, &ef->type()) - , fFunction(*ef) {} - - const ExternalFunction& function() const { - return fFunction; - } - - std::string description(OperatorPrecedence) const override { - return std::string(this->function().name()); - } - - std::unique_ptr<Expression> clone(Position pos) const override { - return std::make_unique<ExternalFunctionReference>(pos, &this->function()); - } - -private: - const ExternalFunction& fFunction; - - using INHERITED = Expression; -}; - -} // namespace SkSL - -#endif diff --git a/src/sksl/ir/SkSLFunctionCall.cpp b/src/sksl/ir/SkSLFunctionCall.cpp index ce8d129757..69df07db9d 100644 --- a/src/sksl/ir/SkSLFunctionCall.cpp +++ b/src/sksl/ir/SkSLFunctionCall.cpp @@ -30,9 +30,6 @@ #include "src/sksl/ir/SkSLChildCall.h" #include "src/sksl/ir/SkSLConstructor.h" #include "src/sksl/ir/SkSLConstructorCompound.h" -#include "src/sksl/ir/SkSLExternalFunction.h" -#include "src/sksl/ir/SkSLExternalFunctionCall.h" -#include "src/sksl/ir/SkSLExternalFunctionReference.h" #include "src/sksl/ir/SkSLFunctionDeclaration.h" #include "src/sksl/ir/SkSLFunctionReference.h" #include "src/sksl/ir/SkSLLiteral.h" @@ -928,27 +925,6 @@ std::unique_ptr<Expression> FunctionCall::Convert(const Context& context, pos, functionValue->as<TypeReference>().value(), std::move(arguments)); - case Expression::Kind::kExternalFunctionReference: { - const ExternalFunction& f = functionValue->as<ExternalFunctionReference>().function(); - int count = f.callParameterCount(); - if (count != (int) arguments.size()) { - context.fErrors->error(pos, - "external function expected " + std::to_string(count) + - " arguments, but found " + std::to_string(arguments.size())); - return nullptr; - } - static constexpr int PARAMETER_MAX = 16; - SkASSERT(count < PARAMETER_MAX); - const Type* types[PARAMETER_MAX]; - f.getCallParameterTypes(types); - for (int i = 0; i < count; ++i) { - arguments[i] = types[i]->coerceExpression(std::move(arguments[i]), context); - if (!arguments[i]) { - return nullptr; - } - } - return std::make_unique<ExternalFunctionCall>(pos, &f, std::move(arguments)); - } case Expression::Kind::kFunctionReference: { const FunctionReference& ref = functionValue->as<FunctionReference>(); const FunctionDeclaration* best = FindBestFunctionForCall(context, ref.overloadChain(), |