Removed redundant setup code from DSLFunction
This code was written back when most of the function setup was happening in IRGenerator (and therefore not being hit by the DSL, which was creating a function declaration directly). Since then, the Function setup code was moved from IRGenerator into SkSLFunctionDeclaration.cpp, making this copy of it in the DSL redundant. Change-Id: Ide110a4ae7dc8b3182c467ee3a2ca249b07d7e36 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/433159 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
parent
33bf2b56f9
commit
e0531f50e3
@ -34,11 +34,6 @@ void DSLFunction::init(DSLModifiers modifiers, const DSLType& returnType, skstd:
|
||||
|
||||
std::vector<std::unique_ptr<Variable>> paramVars;
|
||||
paramVars.reserve(params.size());
|
||||
bool isMain = name == "main";
|
||||
auto typeIsValidForColor = [&](const SkSL::Type& type) {
|
||||
return type == *DSLWriter::Context().fTypes.fHalf4 ||
|
||||
type == *DSLWriter::Context().fTypes.fFloat4;
|
||||
};
|
||||
for (DSLParameter* param : params) {
|
||||
if (param->fDeclared) {
|
||||
DSLWriter::ReportError("error: parameter has already been used in another function\n");
|
||||
@ -46,18 +41,6 @@ void DSLFunction::init(DSLModifiers modifiers, const DSLType& returnType, skstd:
|
||||
SkASSERT(!param->fInitialValue.valid());
|
||||
SkASSERT(!param->fDeclaration);
|
||||
param->fDeclared = true;
|
||||
if (isMain && DSLWriter::Context().fConfig->isRuntimeEffect()) {
|
||||
const SkSL::Type& type = param->fType.skslType();
|
||||
// We verify that the signature is fully correct later. For now, if this is a runtime
|
||||
// effect of any flavor, a float2 param is supposed to be the coords, and a half4/float
|
||||
// parameter is supposed to be the input or destination color.
|
||||
if (type == *DSLWriter::Context().fTypes.fFloat2) {
|
||||
param->fModifiers.fModifiers.fLayout.fBuiltin = SK_MAIN_COORDS_BUILTIN;
|
||||
} else if (typeIsValidForColor(type)) {
|
||||
// TODO(skia:12257): add support for blender destination color
|
||||
param->fModifiers.fModifiers.fLayout.fBuiltin = SK_INPUT_COLOR_BUILTIN;
|
||||
}
|
||||
}
|
||||
std::unique_ptr<SkSL::Variable> paramVar = DSLWriter::CreateParameterVar(*param);
|
||||
if (!paramVar) {
|
||||
return;
|
||||
@ -69,7 +52,7 @@ void DSLFunction::init(DSLModifiers modifiers, const DSLType& returnType, skstd:
|
||||
*DSLWriter::SymbolTable(),
|
||||
/*offset=*/-1,
|
||||
DSLWriter::Modifiers(modifiers.fModifiers),
|
||||
isMain ? name : DSLWriter::Name(name),
|
||||
name == "main" ? name : DSLWriter::Name(name),
|
||||
std::move(paramVars), &returnType.skslType(),
|
||||
DSLWriter::IsModule());
|
||||
DSLWriter::ReportErrors();
|
||||
|
Loading…
Reference in New Issue
Block a user