Add a new statement type 'InlineMarker' to indicate inlined functions.
This will be leveraged in followup CLs to avoid recursive inlining death spirals. Change-Id: Icf99c88c4acaaa766e0dc0971830329e24d70509 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315861 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
This commit is contained in:
parent
db16c4845f
commit
98c1f820d2
@ -71,6 +71,7 @@ skia_sksl_sources = [
|
||||
"$_src/sksl/ir/SkSLIRNode.h",
|
||||
"$_src/sksl/ir/SkSLIfStatement.h",
|
||||
"$_src/sksl/ir/SkSLIndexExpression.h",
|
||||
"$_src/sksl/ir/SkSLInlineMarker.h",
|
||||
"$_src/sksl/ir/SkSLIntLiteral.h",
|
||||
"$_src/sksl/ir/SkSLInterfaceBlock.h",
|
||||
"$_src/sksl/ir/SkSLLayout.h",
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "src/sksl/ir/SkSLFunctionCall.h"
|
||||
#include "src/sksl/ir/SkSLFunctionReference.h"
|
||||
#include "src/sksl/ir/SkSLIndexExpression.h"
|
||||
#include "src/sksl/ir/SkSLInlineMarker.h"
|
||||
#include "src/sksl/ir/SkSLIntLiteral.h"
|
||||
#include "src/sksl/ir/SkSLNullLiteral.h"
|
||||
#include "src/sksl/ir/SkSLPostfixExpression.h"
|
||||
@ -308,6 +309,7 @@ bool ProgramVisitor::visitStatement(const Statement& s) {
|
||||
case Statement::Kind::kBreak:
|
||||
case Statement::Kind::kContinue:
|
||||
case Statement::Kind::kDiscard:
|
||||
case Statement::Kind::kInlineMarker:
|
||||
case Statement::Kind::kNop:
|
||||
// Leaf statements just return false
|
||||
return false;
|
||||
|
@ -1805,8 +1805,6 @@ void ByteCodeGenerator::writeStatement(const Statement& s) {
|
||||
case Statement::Kind::kIf:
|
||||
this->writeIfStatement(s.as<IfStatement>());
|
||||
break;
|
||||
case Statement::Kind::kNop:
|
||||
break;
|
||||
case Statement::Kind::kReturn:
|
||||
this->writeReturnStatement(s.as<ReturnStatement>());
|
||||
break;
|
||||
@ -1819,6 +1817,9 @@ void ByteCodeGenerator::writeStatement(const Statement& s) {
|
||||
case Statement::Kind::kWhile:
|
||||
this->writeWhileStatement(s.as<WhileStatement>());
|
||||
break;
|
||||
case Statement::Kind::kInlineMarker:
|
||||
case Statement::Kind::kNop:
|
||||
break;
|
||||
default:
|
||||
SkASSERT(false);
|
||||
}
|
||||
|
@ -672,6 +672,7 @@ void CFGGenerator::addStatement(CFG& cfg, std::unique_ptr<Statement>* s) {
|
||||
cfg.fCurrent = switchExit;
|
||||
break;
|
||||
}
|
||||
case Statement::Kind::kInlineMarker:
|
||||
case Statement::Kind::kNop:
|
||||
break;
|
||||
default:
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "src/sksl/ir/SkSLFunctionDefinition.h"
|
||||
#include "src/sksl/ir/SkSLIfStatement.h"
|
||||
#include "src/sksl/ir/SkSLIndexExpression.h"
|
||||
#include "src/sksl/ir/SkSLInlineMarker.h"
|
||||
#include "src/sksl/ir/SkSLIntLiteral.h"
|
||||
#include "src/sksl/ir/SkSLInterfaceBlock.h"
|
||||
#include "src/sksl/ir/SkSLNullLiteral.h"
|
||||
@ -441,6 +442,12 @@ void Dehydrator::write(const Statement* s) {
|
||||
this->write(i.fIfFalse.get());
|
||||
break;
|
||||
}
|
||||
case Statement::Kind::kInlineMarker: {
|
||||
const InlineMarker& i = s->as<InlineMarker>();
|
||||
this->writeU8(Rehydrator::kInlineMarker_Command);
|
||||
this->writeId(i.fFuncDecl);
|
||||
break;
|
||||
}
|
||||
case Statement::Kind::kNop:
|
||||
SkASSERT(false);
|
||||
break;
|
||||
|
@ -1499,6 +1499,7 @@ void GLSLCodeGenerator::writeStatement(const Statement& s) {
|
||||
case Statement::Kind::kDiscard:
|
||||
this->write("discard;");
|
||||
break;
|
||||
case Statement::Kind::kInlineMarker:
|
||||
case Statement::Kind::kNop:
|
||||
this->write(";");
|
||||
break;
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "src/sksl/ir/SkSLFunctionReference.h"
|
||||
#include "src/sksl/ir/SkSLIfStatement.h"
|
||||
#include "src/sksl/ir/SkSLIndexExpression.h"
|
||||
#include "src/sksl/ir/SkSLInlineMarker.h"
|
||||
#include "src/sksl/ir/SkSLIntLiteral.h"
|
||||
#include "src/sksl/ir/SkSLInterfaceBlock.h"
|
||||
#include "src/sksl/ir/SkSLLayout.h"
|
||||
@ -332,6 +333,7 @@ std::unique_ptr<Statement> Inliner::inlineStatement(int offset,
|
||||
return std::make_unique<IfStatement>(offset, i.fIsStatic, expr(i.fTest),
|
||||
stmt(i.fIfTrue), stmt(i.fIfFalse));
|
||||
}
|
||||
case Statement::Kind::kInlineMarker:
|
||||
case Statement::Kind::kNop:
|
||||
return statement.clone();
|
||||
case Statement::Kind::kReturn: {
|
||||
@ -442,7 +444,15 @@ Inliner::InlinedCall Inliner::inlineCall(FunctionCall* call,
|
||||
std::vector<std::unique_ptr<Statement>>{},
|
||||
/*symbols=*/nullptr,
|
||||
/*isScope=*/false);
|
||||
|
||||
std::vector<std::unique_ptr<Statement>>& inlinedBody = inlinedCall.fInlinedBody->fStatements;
|
||||
inlinedBody.reserve(1 + // Inline marker
|
||||
1 + // Result variable
|
||||
arguments.size() + // Function arguments (passing in)
|
||||
arguments.size() + // Function arguments (copy out-parameters back)
|
||||
1); // Inlined code (either as a Block or do-while loop)
|
||||
|
||||
inlinedBody.push_back(std::make_unique<InlineMarker>(call->fFunction));
|
||||
|
||||
auto makeInlineVar = [&](const String& baseName, const Type& type, Modifiers modifiers,
|
||||
std::unique_ptr<Expression>* initialValue) -> const Variable* {
|
||||
|
@ -1283,6 +1283,7 @@ void MetalCodeGenerator::writeStatement(const Statement& s) {
|
||||
case Statement::Kind::kDiscard:
|
||||
this->write("discard_fragment();");
|
||||
break;
|
||||
case Statement::Kind::kInlineMarker:
|
||||
case Statement::Kind::kNop:
|
||||
this->write(";");
|
||||
break;
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "src/sksl/ir/SkSLFunctionDefinition.h"
|
||||
#include "src/sksl/ir/SkSLIfStatement.h"
|
||||
#include "src/sksl/ir/SkSLIndexExpression.h"
|
||||
#include "src/sksl/ir/SkSLInlineMarker.h"
|
||||
#include "src/sksl/ir/SkSLIntLiteral.h"
|
||||
#include "src/sksl/ir/SkSLInterfaceBlock.h"
|
||||
#include "src/sksl/ir/SkSLPostfixExpression.h"
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "src/sksl/ir/SkSLFunctionDefinition.h"
|
||||
#include "src/sksl/ir/SkSLIfStatement.h"
|
||||
#include "src/sksl/ir/SkSLIndexExpression.h"
|
||||
#include "src/sksl/ir/SkSLInlineMarker.h"
|
||||
#include "src/sksl/ir/SkSLIntLiteral.h"
|
||||
#include "src/sksl/ir/SkSLInterfaceBlock.h"
|
||||
#include "src/sksl/ir/SkSLModifiers.h"
|
||||
@ -377,6 +378,11 @@ std::unique_ptr<Statement> Rehydrator::statement() {
|
||||
std::move(ifTrue),
|
||||
std::move(ifFalse)));
|
||||
}
|
||||
case Rehydrator::kInlineMarker_Command: {
|
||||
const FunctionDeclaration* funcDecl = this->symbolRef<FunctionDeclaration>(
|
||||
Symbol::Kind::kFunctionDeclaration);
|
||||
return std::make_unique<InlineMarker>(*funcDecl);
|
||||
}
|
||||
case Rehydrator::kReturn_Command: {
|
||||
std::unique_ptr<Expression> expr = this->expression();
|
||||
if (expr) {
|
||||
|
@ -85,6 +85,8 @@ public:
|
||||
kIf_Command,
|
||||
// Expression base, Expression index
|
||||
kIndex_Command,
|
||||
// FunctionDeclaration function
|
||||
kInlineMarker_Command,
|
||||
// Variable* var, String typeName, String instanceName, uint8 sizeCount, Expression[] sizes
|
||||
kInterfaceBlock_Command,
|
||||
// int32 value
|
||||
|
@ -2864,6 +2864,7 @@ void SPIRVCodeGenerator::writeVarDeclarations(const VarDeclarations& decl, Outpu
|
||||
|
||||
void SPIRVCodeGenerator::writeStatement(const Statement& s, OutputStream& out) {
|
||||
switch (s.kind()) {
|
||||
case Statement::Kind::kInlineMarker:
|
||||
case Statement::Kind::kNop:
|
||||
break;
|
||||
case Statement::Kind::kBlock:
|
||||
|
@ -1,2 +1,2 @@
|
||||
static constexpr size_t SKSL_INCLUDE_sksl_fp_LENGTH = 1658;
|
||||
static uint8_t SKSL_INCLUDE_sksl_fp[1658] = {120,1,14,71,114,67,108,105,112,69,100,103,101,84,121,112,101,12,80,77,67,111,110,118,101,114,115,105,111,110,12,115,107,95,70,114,97,103,67,111,111,114,100,6,102,108,111,97,116,52,5,102,108,111,97,116,15,115,107,95,67,108,105,112,68,105,115,116,97,110,99,101,3,105,110,116,13,115,107,95,83,97,109,112,108,101,77,97,115,107,15,103,108,95,76,97,115,116,70,114,97,103,68,97,116,97,16,103,108,95,76,97,115,116,70,114,97,103,67,111,108,111,114,5,104,97,108,102,52,19,103,108,95,76,97,115,116,70,114,97,103,67,111,108,111,114,65,82,77,24,103,108,95,83,101,99,111,110,100,97,114,121,70,114,97,103,67,111,108,111,114,69,88,84,11,115,107,95,79,117,116,67,111,108,111,114,8,115,107,95,87,105,100,116,104,4,104,97,108,102,9,115,107,95,72,101,105,103,104,116,2,102,112,17,102,114,97,103,109,101,110,116,80,114,111,99,101,115,115,111,114,6,115,97,109,112,108,101,9,116,114,97,110,115,102,111,114,109,8,102,108,111,97,116,51,120,51,6,99,111,111,114,100,115,6,102,108,111,97,116,50,5,105,110,112,117,116,9,116,114,97,110,115,102,114,111,109,7,107,70,105,108,108,66,87,7,107,70,105,108,108,65,65,14,107,73,110,118,101,114,115,101,70,105,108,108,66,87,14,107,73,110,118,101,114,115,101,70,105,108,108,65,65,5,107,76,97,115,116,9,107,84,111,80,114,101,109,117,108,11,107,84,111,85,110,112,114,101,109,117,108,16,107,80,77,67,111,110,118,101,114,115,105,111,110,67,110,116,40,70,0,14,1,0,2,0,14,2,0,17,0,44,3,0,28,5,15,0,2,30,0,41,4,0,43,0,0,0,5,0,41,6,0,50,0,1,44,7,0,28,5,3,0,0,56,0,39,5,0,0,0,8,0,41,9,0,72,0,1,44,10,0,28,5,20,0,4,76,0,39,8,0,0,0,11,0,39,4,0,1,44,12,0,28,5,15,39,0,90,0,39,11,0,0,44,13,0,28,5,15,39,0,106,0,41,14,0,123,0,0,44,15,0,28,5,15,39,0,129,0,39,14,0,0,44,16,0,28,5,15,39,0,149,0,39,14,0,0,44,17,0,28,5,20,39,4,174,0,39,14,0,0,44,18,0,28,5,27,39,0,186,0,41,19,0,195,0,0,44,20,0,28,5,28,39,0,200,0,39,19,0,0,44,21,0,9,210,0,41,22,0,213,0,3,22,23,0,9,231,0,1,21,0,39,14,0,44,24,0,9,210,0,39,22,0,3,44,25,0,9,238,0,41,26,0,248,0,3,43,27,0,2,39,23,0,22,28,0,9,231,0,2,24,0,25,0,39,14,0,39,28,0,44,29,0,9,210,0,39,22,0,3,44,30,0,9,1,1,41,31,0,8,1,3,43,32,0,3,39,23,0,39,28,0,22,33,0,9,231,0,2,29,0,30,0,39,14,0,39,33,0,44,34,0,9,210,0,39,22,0,3,44,35,0,9,15,1,39,14,0,3,43,36,0,4,39,23,0,39,28,0,39,33,0,22,37,0,9,231,0,2,34,0,35,0,39,14,0,39,37,0,44,38,0,9,210,0,39,22,0,3,44,39,0,9,15,1,39,14,0,3,44,40,0,9,238,0,39,26,0,3,43,41,0,5,39,23,0,39,28,0,39,33,0,39,37,0,22,42,0,9,231,0,3,38,0,39,0,40,0,39,14,0,39,42,0,44,43,0,9,210,0,39,22,0,3,44,44,0,9,15,1,39,14,0,3,44,45,0,9,1,1,39,31,0,3,43,46,0,6,39,23,0,39,28,0,39,33,0,39,37,0,39,42,0,22,47,0,9,231,0,3,43,0,44,0,45,0,39,14,0,39,47,0,30,48,0,39,22,0,44,49,0,9,210,0,39,48,0,3,43,50,0,7,39,23,0,39,28,0,39,33,0,39,37,0,39,42,0,39,47,0,22,51,0,9,231,0,1,49,0,39,14,0,39,51,0,30,52,0,39,22,0,44,53,0,9,210,0,39,52,0,3,44,54,0,9,238,0,39,26,0,3,43,55,0,8,39,23,0,39,28,0,39,33,0,39,37,0,39,42,0,39,47,0,39,51,0,22,56,0,9,231,0,2,53,0,54,0,39,14,0,39,56,0,30,57,0,39,22,0,44,58,0,9,210,0,39,57,0,3,44,59,0,9,1,1,39,31,0,3,43,60,0,9,39,23,0,39,28,0,39,33,0,39,37,0,39,42,0,39,47,0,39,51,0,39,56,0,22,61,0,9,231,0,2,58,0,59,0,39,14,0,39,61,0,30,62,0,39,22,0,44,63,0,9,210,0,39,62,0,3,44,64,0,9,15,1,39,14,0,3,43,65,0,10,39,23,0,39,28,0,39,33,0,39,37,0,39,42,0,39,47,0,39,51,0,39,56,0,39,61,0,22,66,0,9,231,0,2,63,0,64,0,39,14,0,39,66,0,30,67,0,39,22,0,44,68,0,9,210,0,39,67,0,3,44,69,0,9,15,1,39,14,0,3,44,70,0,9,21,1,39,26,0,3,43,71,0,11,39,23,0,39,28,0,39,33,0,39,37,0,39,42,0,39,47,0,39,51,0,39,56,0,39,61,0,39,66,0,22,72,0,9,231,0,3,68,0,69,0,70,0,39,14,0,39,72,0,30,73,0,39,22,0,44,74,0,9,210,0,39,73,0,3,44,75,0,9,15,1,39,14,0,3,44,76,0,9,1,1,39,31,0,3,43,77,0,12,39,23,0,39,28,0,39,33,0,39,37,0,39,42,0,39,47,0,39,51,0,39,56,0,39,61,0,39,66,0,39,72,0,22,78,0,9,231,0,3,74,0,75,0,76,0,39,14,0,39,78,0,13,0,2,0,0,0,17,0,1,0,106,0,9,0,129,0,10,0,90,0,8,0,149,0,11,0,231,0,68,0,56,0,4,0,30,0,2,0,200,0,14,0,174,0,12,0,76,0,6,0,186,0,13,0,12,12,13,2,0,40,5,0,44,79,0,28,8,1,31,1,39,1,0,0,44,80,0,28,8,1,39,1,39,1,0,0,44,81,0,28,8,1,47,1,39,1,0,0,44,82,0,28,8,1,62,1,39,1,0,0,44,83,0,28,8,1,77,1,39,1,0,0,5,0,39,1,1,0,31,1,0,0,62,1,3,0,47,1,2,0,77,1,4,0,0,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,3,0,0,0,13,17,0,40,3,0,44,84,0,28,8,1,83,1,39,2,0,0,44,85,0,28,8,1,93,1,39,2,0,0,44,86,0,28,8,1,105,1,39,2,0,0,3,0,105,1,2,0,83,1,0,0,93,1,1,0,0,0,0,0,1,0,0,0,2,0,0,0,46,39,4,0,1,45,3,0,0,48,46,39,6,0,1,45,7,0,1,26,1,0,0,0,48,46,39,9,0,1,45,10,0,1,26,1,0,0,0,48,46,39,4,0,1,45,12,0,1,26,1,0,0,0,48,46,39,14,0,1,45,13,0,0,48,46,39,14,0,1,45,15,0,0,48,46,39,14,0,1,45,16,0,0,48,46,39,14,0,1,45,17,0,0,48,46,39,19,0,1,45,18,0,0,48,46,39,19,0,1,45,20,0,0,48,};
|
||||
static uint8_t SKSL_INCLUDE_sksl_fp[1658] = {120,1,14,71,114,67,108,105,112,69,100,103,101,84,121,112,101,12,80,77,67,111,110,118,101,114,115,105,111,110,12,115,107,95,70,114,97,103,67,111,111,114,100,6,102,108,111,97,116,52,5,102,108,111,97,116,15,115,107,95,67,108,105,112,68,105,115,116,97,110,99,101,3,105,110,116,13,115,107,95,83,97,109,112,108,101,77,97,115,107,15,103,108,95,76,97,115,116,70,114,97,103,68,97,116,97,16,103,108,95,76,97,115,116,70,114,97,103,67,111,108,111,114,5,104,97,108,102,52,19,103,108,95,76,97,115,116,70,114,97,103,67,111,108,111,114,65,82,77,24,103,108,95,83,101,99,111,110,100,97,114,121,70,114,97,103,67,111,108,111,114,69,88,84,11,115,107,95,79,117,116,67,111,108,111,114,8,115,107,95,87,105,100,116,104,4,104,97,108,102,9,115,107,95,72,101,105,103,104,116,2,102,112,17,102,114,97,103,109,101,110,116,80,114,111,99,101,115,115,111,114,6,115,97,109,112,108,101,9,116,114,97,110,115,102,111,114,109,8,102,108,111,97,116,51,120,51,6,99,111,111,114,100,115,6,102,108,111,97,116,50,5,105,110,112,117,116,9,116,114,97,110,115,102,114,111,109,7,107,70,105,108,108,66,87,7,107,70,105,108,108,65,65,14,107,73,110,118,101,114,115,101,70,105,108,108,66,87,14,107,73,110,118,101,114,115,101,70,105,108,108,65,65,5,107,76,97,115,116,9,107,84,111,80,114,101,109,117,108,11,107,84,111,85,110,112,114,101,109,117,108,16,107,80,77,67,111,110,118,101,114,115,105,111,110,67,110,116,41,70,0,14,1,0,2,0,14,2,0,17,0,45,3,0,29,5,15,0,2,30,0,42,4,0,43,0,0,0,5,0,42,6,0,50,0,1,45,7,0,29,5,3,0,0,56,0,40,5,0,0,0,8,0,42,9,0,72,0,1,45,10,0,29,5,20,0,4,76,0,40,8,0,0,0,11,0,40,4,0,1,45,12,0,29,5,15,39,0,90,0,40,11,0,0,45,13,0,29,5,15,39,0,106,0,42,14,0,123,0,0,45,15,0,29,5,15,39,0,129,0,40,14,0,0,45,16,0,29,5,15,39,0,149,0,40,14,0,0,45,17,0,29,5,20,39,4,174,0,40,14,0,0,45,18,0,29,5,27,39,0,186,0,42,19,0,195,0,0,45,20,0,29,5,28,39,0,200,0,40,19,0,0,45,21,0,9,210,0,42,22,0,213,0,3,22,23,0,9,231,0,1,21,0,40,14,0,45,24,0,9,210,0,40,22,0,3,45,25,0,9,238,0,42,26,0,248,0,3,44,27,0,2,40,23,0,22,28,0,9,231,0,2,24,0,25,0,40,14,0,40,28,0,45,29,0,9,210,0,40,22,0,3,45,30,0,9,1,1,42,31,0,8,1,3,44,32,0,3,40,23,0,40,28,0,22,33,0,9,231,0,2,29,0,30,0,40,14,0,40,33,0,45,34,0,9,210,0,40,22,0,3,45,35,0,9,15,1,40,14,0,3,44,36,0,4,40,23,0,40,28,0,40,33,0,22,37,0,9,231,0,2,34,0,35,0,40,14,0,40,37,0,45,38,0,9,210,0,40,22,0,3,45,39,0,9,15,1,40,14,0,3,45,40,0,9,238,0,40,26,0,3,44,41,0,5,40,23,0,40,28,0,40,33,0,40,37,0,22,42,0,9,231,0,3,38,0,39,0,40,0,40,14,0,40,42,0,45,43,0,9,210,0,40,22,0,3,45,44,0,9,15,1,40,14,0,3,45,45,0,9,1,1,40,31,0,3,44,46,0,6,40,23,0,40,28,0,40,33,0,40,37,0,40,42,0,22,47,0,9,231,0,3,43,0,44,0,45,0,40,14,0,40,47,0,31,48,0,40,22,0,45,49,0,9,210,0,40,48,0,3,44,50,0,7,40,23,0,40,28,0,40,33,0,40,37,0,40,42,0,40,47,0,22,51,0,9,231,0,1,49,0,40,14,0,40,51,0,31,52,0,40,22,0,45,53,0,9,210,0,40,52,0,3,45,54,0,9,238,0,40,26,0,3,44,55,0,8,40,23,0,40,28,0,40,33,0,40,37,0,40,42,0,40,47,0,40,51,0,22,56,0,9,231,0,2,53,0,54,0,40,14,0,40,56,0,31,57,0,40,22,0,45,58,0,9,210,0,40,57,0,3,45,59,0,9,1,1,40,31,0,3,44,60,0,9,40,23,0,40,28,0,40,33,0,40,37,0,40,42,0,40,47,0,40,51,0,40,56,0,22,61,0,9,231,0,2,58,0,59,0,40,14,0,40,61,0,31,62,0,40,22,0,45,63,0,9,210,0,40,62,0,3,45,64,0,9,15,1,40,14,0,3,44,65,0,10,40,23,0,40,28,0,40,33,0,40,37,0,40,42,0,40,47,0,40,51,0,40,56,0,40,61,0,22,66,0,9,231,0,2,63,0,64,0,40,14,0,40,66,0,31,67,0,40,22,0,45,68,0,9,210,0,40,67,0,3,45,69,0,9,15,1,40,14,0,3,45,70,0,9,21,1,40,26,0,3,44,71,0,11,40,23,0,40,28,0,40,33,0,40,37,0,40,42,0,40,47,0,40,51,0,40,56,0,40,61,0,40,66,0,22,72,0,9,231,0,3,68,0,69,0,70,0,40,14,0,40,72,0,31,73,0,40,22,0,45,74,0,9,210,0,40,73,0,3,45,75,0,9,15,1,40,14,0,3,45,76,0,9,1,1,40,31,0,3,44,77,0,12,40,23,0,40,28,0,40,33,0,40,37,0,40,42,0,40,47,0,40,51,0,40,56,0,40,61,0,40,66,0,40,72,0,22,78,0,9,231,0,3,74,0,75,0,76,0,40,14,0,40,78,0,13,0,2,0,0,0,17,0,1,0,106,0,9,0,129,0,10,0,90,0,8,0,149,0,11,0,231,0,68,0,56,0,4,0,30,0,2,0,200,0,14,0,174,0,12,0,76,0,6,0,186,0,13,0,12,12,13,2,0,41,5,0,45,79,0,29,8,1,31,1,40,1,0,0,45,80,0,29,8,1,39,1,40,1,0,0,45,81,0,29,8,1,47,1,40,1,0,0,45,82,0,29,8,1,62,1,40,1,0,0,45,83,0,29,8,1,77,1,40,1,0,0,5,0,39,1,1,0,31,1,0,0,62,1,3,0,47,1,2,0,77,1,4,0,0,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,3,0,0,0,13,17,0,41,3,0,45,84,0,29,8,1,83,1,40,2,0,0,45,85,0,29,8,1,93,1,40,2,0,0,45,86,0,29,8,1,105,1,40,2,0,0,3,0,105,1,2,0,83,1,0,0,93,1,1,0,0,0,0,0,1,0,0,0,2,0,0,0,47,40,4,0,1,46,3,0,0,49,47,40,6,0,1,46,7,0,1,27,1,0,0,0,49,47,40,9,0,1,46,10,0,1,27,1,0,0,0,49,47,40,4,0,1,46,12,0,1,27,1,0,0,0,49,47,40,14,0,1,46,13,0,0,49,47,40,14,0,1,46,15,0,0,49,47,40,14,0,1,46,16,0,0,49,47,40,14,0,1,46,17,0,0,49,47,40,19,0,1,46,18,0,0,49,47,40,19,0,1,46,20,0,0,49,};
|
||||
|
@ -1,2 +1,2 @@
|
||||
static constexpr size_t SKSL_INCLUDE_sksl_frag_LENGTH = 481;
|
||||
static uint8_t SKSL_INCLUDE_sksl_frag[481] = {164,0,12,115,107,95,70,114,97,103,67,111,111,114,100,6,102,108,111,97,116,52,12,115,107,95,67,108,111,99,107,119,105,115,101,4,98,111,111,108,5,102,108,111,97,116,15,115,107,95,67,108,105,112,68,105,115,116,97,110,99,101,3,105,110,116,13,115,107,95,83,97,109,112,108,101,77,97,115,107,24,103,108,95,83,101,99,111,110,100,97,114,121,70,114,97,103,67,111,108,111,114,69,88,84,5,104,97,108,102,52,0,12,115,107,95,70,114,97,103,67,111,108,111,114,16,115,107,95,76,97,115,116,70,114,97,103,67,111,108,111,114,8,115,107,95,87,105,100,116,104,4,104,97,108,102,9,115,107,95,72,101,105,103,104,116,40,11,0,44,1,0,28,5,15,0,2,2,0,41,2,0,15,0,0,44,3,0,28,5,17,0,2,22,0,41,4,0,35,0,0,0,5,0,41,6,0,40,0,1,44,7,0,28,5,3,0,0,46,0,39,5,0,0,0,8,0,41,9,0,62,0,1,44,10,0,28,5,20,0,4,66,0,39,8,0,0,44,11,0,28,5,15,39,4,80,0,41,12,0,105,0,0,44,13,0,28,27,0,0,0,0,0,255,255,0,255,17,39,255,255,255,255,255,111,0,111,0,0,0,4,112,0,39,12,0,0,44,14,0,28,5,24,39,0,125,0,39,12,0,0,44,15,0,28,5,27,39,0,142,0,41,16,0,151,0,0,44,17,0,28,5,28,39,0,156,0,39,16,0,0,9,0,80,0,6,0,46,0,3,0,22,0,1,0,112,0,7,0,2,0,0,0,156,0,10,0,125,0,8,0,66,0,5,0,142,0,9,0,12,9,46,39,2,0,1,45,1,0,0,48,46,39,4,0,1,45,3,0,0,48,46,39,6,0,1,45,7,0,1,26,1,0,0,0,48,46,39,9,0,1,45,10,0,1,26,1,0,0,0,48,46,39,12,0,1,45,11,0,0,48,46,39,12,0,1,45,13,0,0,48,46,39,12,0,1,45,14,0,0,48,46,39,16,0,1,45,15,0,0,48,46,39,16,0,1,45,17,0,0,48,};
|
||||
static uint8_t SKSL_INCLUDE_sksl_frag[481] = {164,0,12,115,107,95,70,114,97,103,67,111,111,114,100,6,102,108,111,97,116,52,12,115,107,95,67,108,111,99,107,119,105,115,101,4,98,111,111,108,5,102,108,111,97,116,15,115,107,95,67,108,105,112,68,105,115,116,97,110,99,101,3,105,110,116,13,115,107,95,83,97,109,112,108,101,77,97,115,107,24,103,108,95,83,101,99,111,110,100,97,114,121,70,114,97,103,67,111,108,111,114,69,88,84,5,104,97,108,102,52,0,12,115,107,95,70,114,97,103,67,111,108,111,114,16,115,107,95,76,97,115,116,70,114,97,103,67,111,108,111,114,8,115,107,95,87,105,100,116,104,4,104,97,108,102,9,115,107,95,72,101,105,103,104,116,41,11,0,45,1,0,29,5,15,0,2,2,0,42,2,0,15,0,0,45,3,0,29,5,17,0,2,22,0,42,4,0,35,0,0,0,5,0,42,6,0,40,0,1,45,7,0,29,5,3,0,0,46,0,40,5,0,0,0,8,0,42,9,0,62,0,1,45,10,0,29,5,20,0,4,66,0,40,8,0,0,45,11,0,29,5,15,39,4,80,0,42,12,0,105,0,0,45,13,0,29,28,0,0,0,0,0,255,255,0,255,17,39,255,255,255,255,255,111,0,111,0,0,0,4,112,0,40,12,0,0,45,14,0,29,5,24,39,0,125,0,40,12,0,0,45,15,0,29,5,27,39,0,142,0,42,16,0,151,0,0,45,17,0,29,5,28,39,0,156,0,40,16,0,0,9,0,80,0,6,0,46,0,3,0,22,0,1,0,112,0,7,0,2,0,0,0,156,0,10,0,125,0,8,0,66,0,5,0,142,0,9,0,12,9,47,40,2,0,1,46,1,0,0,49,47,40,4,0,1,46,3,0,0,49,47,40,6,0,1,46,7,0,1,27,1,0,0,0,49,47,40,9,0,1,46,10,0,1,27,1,0,0,0,49,47,40,12,0,1,46,11,0,0,49,47,40,12,0,1,46,13,0,0,49,47,40,12,0,1,46,14,0,0,49,47,40,16,0,1,46,15,0,0,49,47,40,16,0,1,46,17,0,0,49,};
|
||||
|
@ -1,2 +1,2 @@
|
||||
static constexpr size_t SKSL_INCLUDE_sksl_geom_LENGTH = 474;
|
||||
static uint8_t SKSL_INCLUDE_sksl_geom[474] = {166,0,12,115,107,95,80,101,114,86,101,114,116,101,120,11,115,107,95,80,111,115,105,116,105,111,110,6,102,108,111,97,116,52,12,115,107,95,80,111,105,110,116,83,105,122,101,5,102,108,111,97,116,15,115,107,95,67,108,105,112,68,105,115,116,97,110,99,101,5,115,107,95,105,110,15,115,107,95,73,110,118,111,99,97,116,105,111,110,73,68,3,105,110,116,6,115,116,114,101,97,109,16,69,109,105,116,83,116,114,101,97,109,86,101,114,116,101,120,4,118,111,105,100,18,69,110,100,83,116,114,101,97,109,80,114,105,109,105,116,105,118,101,10,69,109,105,116,86,101,114,116,101,120,12,69,110,100,80,114,105,109,105,116,105,118,101,0,40,14,0,36,1,0,2,0,3,28,5,0,0,0,15,0,41,2,0,27,0,28,5,1,0,0,34,0,41,3,0,47,0,28,5,3,0,0,53,0,0,4,0,39,3,0,1,44,5,0,28,5,18,39,2,69,0,0,6,0,39,1,0,1,0,36,7,0,2,0,3,28,5,0,0,0,15,0,39,2,0,28,5,1,0,0,34,0,39,3,0,28,5,3,0,0,53,0,0,8,0,39,3,0,1,44,9,0,28,5,23,39,4,2,0,39,7,0,0,16,9,0,0,16,9,0,1,16,9,0,2,44,10,0,28,5,8,0,2,75,0,41,11,0,91,0,0,44,12,0,9,95,0,39,11,0,3,22,13,0,29,8,0,16,0,0,102,0,1,12,0,41,14,0,119,0,44,15,0,9,95,0,39,11,0,3,22,16,0,29,8,0,16,0,0,124,0,1,15,0,39,14,0,22,17,0,29,8,0,16,0,0,143,0,0,39,14,0,22,18,0,29,8,0,16,0,0,154,0,0,39,14,0,9,0,102,0,9,0,143,0,12,0,154,0,13,0,124,0,11,0,53,0,6,0,75,0,7,0,34,0,5,0,15,0,4,0,69,0,1,0,12,3,25,39,5,0,2,0,69,0,1,26,1,0,0,0,25,39,9,0,2,0,167,0,0,46,39,11,0,1,45,10,0,0,48,};
|
||||
static uint8_t SKSL_INCLUDE_sksl_geom[474] = {166,0,12,115,107,95,80,101,114,86,101,114,116,101,120,11,115,107,95,80,111,115,105,116,105,111,110,6,102,108,111,97,116,52,12,115,107,95,80,111,105,110,116,83,105,122,101,5,102,108,111,97,116,15,115,107,95,67,108,105,112,68,105,115,116,97,110,99,101,5,115,107,95,105,110,15,115,107,95,73,110,118,111,99,97,116,105,111,110,73,68,3,105,110,116,6,115,116,114,101,97,109,16,69,109,105,116,83,116,114,101,97,109,86,101,114,116,101,120,4,118,111,105,100,18,69,110,100,83,116,114,101,97,109,80,114,105,109,105,116,105,118,101,10,69,109,105,116,86,101,114,116,101,120,12,69,110,100,80,114,105,109,105,116,105,118,101,0,41,14,0,37,1,0,2,0,3,29,5,0,0,0,15,0,42,2,0,27,0,29,5,1,0,0,34,0,42,3,0,47,0,29,5,3,0,0,53,0,0,4,0,40,3,0,1,45,5,0,29,5,18,39,2,69,0,0,6,0,40,1,0,1,0,37,7,0,2,0,3,29,5,0,0,0,15,0,40,2,0,29,5,1,0,0,34,0,40,3,0,29,5,3,0,0,53,0,0,8,0,40,3,0,1,45,9,0,29,5,23,39,4,2,0,40,7,0,0,16,9,0,0,16,9,0,1,16,9,0,2,45,10,0,29,5,8,0,2,75,0,42,11,0,91,0,0,45,12,0,9,95,0,40,11,0,3,22,13,0,30,8,0,16,0,0,102,0,1,12,0,42,14,0,119,0,45,15,0,9,95,0,40,11,0,3,22,16,0,30,8,0,16,0,0,124,0,1,15,0,40,14,0,22,17,0,30,8,0,16,0,0,143,0,0,40,14,0,22,18,0,30,8,0,16,0,0,154,0,0,40,14,0,9,0,102,0,9,0,143,0,12,0,154,0,13,0,124,0,11,0,53,0,6,0,75,0,7,0,34,0,5,0,15,0,4,0,69,0,1,0,12,3,26,40,5,0,2,0,69,0,1,27,1,0,0,0,26,40,9,0,2,0,167,0,0,47,40,11,0,1,46,10,0,0,49,};
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,2 +1,2 @@
|
||||
static constexpr size_t SKSL_INCLUDE_sksl_pipeline_LENGTH = 251;
|
||||
static uint8_t SKSL_INCLUDE_sksl_pipeline[251] = {87,0,12,115,107,95,70,114,97,103,67,111,111,114,100,6,102,108,111,97,116,52,2,102,112,17,102,114,97,103,109,101,110,116,80,114,111,99,101,115,115,111,114,6,115,97,109,112,108,101,5,104,97,108,102,52,6,99,111,111,114,100,115,6,102,108,111,97,116,50,9,116,114,97,110,115,102,111,114,109,8,102,108,111,97,116,51,120,51,40,11,0,44,1,0,28,5,15,0,0,2,0,41,2,0,15,0,0,44,3,0,9,22,0,41,4,0,25,0,3,22,5,0,9,43,0,1,3,0,41,6,0,50,0,44,7,0,9,22,0,39,4,0,3,44,8,0,9,56,0,41,9,0,63,0,3,43,10,0,2,39,5,0,22,11,0,9,43,0,2,7,0,8,0,39,6,0,39,11,0,44,12,0,9,22,0,39,4,0,3,44,13,0,9,70,0,41,14,0,80,0,3,43,15,0,3,39,5,0,39,11,0,22,16,0,9,43,0,2,12,0,13,0,39,6,0,39,16,0,2,0,43,0,9,0,2,0,0,0,12,1,46,39,2,0,1,45,1,0,0,48,};
|
||||
static uint8_t SKSL_INCLUDE_sksl_pipeline[251] = {87,0,12,115,107,95,70,114,97,103,67,111,111,114,100,6,102,108,111,97,116,52,2,102,112,17,102,114,97,103,109,101,110,116,80,114,111,99,101,115,115,111,114,6,115,97,109,112,108,101,5,104,97,108,102,52,6,99,111,111,114,100,115,6,102,108,111,97,116,50,9,116,114,97,110,115,102,111,114,109,8,102,108,111,97,116,51,120,51,41,11,0,45,1,0,29,5,15,0,0,2,0,42,2,0,15,0,0,45,3,0,9,22,0,42,4,0,25,0,3,22,5,0,9,43,0,1,3,0,42,6,0,50,0,45,7,0,9,22,0,40,4,0,3,45,8,0,9,56,0,42,9,0,63,0,3,44,10,0,2,40,5,0,22,11,0,9,43,0,2,7,0,8,0,40,6,0,40,11,0,45,12,0,9,22,0,40,4,0,3,45,13,0,9,70,0,42,14,0,80,0,3,44,15,0,3,40,5,0,40,11,0,22,16,0,9,43,0,2,12,0,13,0,40,6,0,40,16,0,2,0,43,0,9,0,2,0,0,0,12,1,47,40,2,0,1,46,1,0,0,49,};
|
||||
|
@ -1,2 +1,2 @@
|
||||
static constexpr size_t SKSL_INCLUDE_sksl_vert_LENGTH = 254;
|
||||
static uint8_t SKSL_INCLUDE_sksl_vert[254] = {98,0,12,115,107,95,80,101,114,86,101,114,116,101,120,11,115,107,95,80,111,115,105,116,105,111,110,6,102,108,111,97,116,52,12,115,107,95,80,111,105,110,116,83,105,122,101,5,102,108,111,97,116,15,115,107,95,67,108,105,112,68,105,115,116,97,110,99,101,11,115,107,95,86,101,114,116,101,120,73,68,3,105,110,116,13,115,107,95,73,110,115,116,97,110,99,101,73,68,0,40,7,0,36,1,0,2,0,3,28,5,0,0,0,15,0,41,2,0,27,0,28,5,1,0,0,34,0,41,3,0,47,0,28,5,3,0,0,53,0,0,4,0,39,3,0,1,44,5,0,28,8,4,2,0,39,1,0,0,16,5,0,0,16,5,0,1,16,5,0,2,44,6,0,28,5,42,0,2,69,0,41,7,0,81,0,0,44,8,0,28,5,43,0,2,85,0,39,7,0,0,5,0,53,0,4,0,85,0,6,0,34,0,3,0,15,0,2,0,69,0,5,0,12,3,25,39,5,0,2,0,99,0,0,46,39,7,0,1,45,6,0,0,48,46,39,7,0,1,45,8,0,0,48,};
|
||||
static uint8_t SKSL_INCLUDE_sksl_vert[254] = {98,0,12,115,107,95,80,101,114,86,101,114,116,101,120,11,115,107,95,80,111,115,105,116,105,111,110,6,102,108,111,97,116,52,12,115,107,95,80,111,105,110,116,83,105,122,101,5,102,108,111,97,116,15,115,107,95,67,108,105,112,68,105,115,116,97,110,99,101,11,115,107,95,86,101,114,116,101,120,73,68,3,105,110,116,13,115,107,95,73,110,115,116,97,110,99,101,73,68,0,41,7,0,37,1,0,2,0,3,29,5,0,0,0,15,0,42,2,0,27,0,29,5,1,0,0,34,0,42,3,0,47,0,29,5,3,0,0,53,0,0,4,0,40,3,0,1,45,5,0,29,8,4,2,0,40,1,0,0,16,5,0,0,16,5,0,1,16,5,0,2,45,6,0,29,5,42,0,2,69,0,42,7,0,81,0,0,45,8,0,29,5,43,0,2,85,0,40,7,0,0,5,0,53,0,4,0,85,0,6,0,34,0,3,0,15,0,2,0,69,0,5,0,12,3,26,40,5,0,2,0,99,0,0,47,40,7,0,1,46,6,0,0,49,47,40,7,0,1,46,8,0,0,49,};
|
||||
|
45
src/sksl/ir/SkSLInlineMarker.h
Normal file
45
src/sksl/ir/SkSLInlineMarker.h
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright 2020 Google LLC
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef SKSL_INLINEMARKER
|
||||
#define SKSL_INLINEMARKER
|
||||
|
||||
#include "src/sksl/ir/SkSLFunctionDeclaration.h"
|
||||
#include "src/sksl/ir/SkSLStatement.h"
|
||||
#include "src/sksl/ir/SkSLSymbolTable.h"
|
||||
|
||||
namespace SkSL {
|
||||
|
||||
/**
|
||||
* A no-op statement that indicates that a function was inlined here. This is necessary to detect
|
||||
* and prevent runaway infinite recursion. This node doesn't directly generate code.
|
||||
*/
|
||||
struct InlineMarker : public Statement {
|
||||
static constexpr Kind kStatementKind = Kind::kInlineMarker;
|
||||
|
||||
InlineMarker(const FunctionDeclaration& funcDecl)
|
||||
: INHERITED(-1, kStatementKind), fFuncDecl(&funcDecl) {}
|
||||
|
||||
bool isEmpty() const override {
|
||||
return true;
|
||||
}
|
||||
|
||||
String description() const override {
|
||||
return String("/* inlined: ") + fFuncDecl->fName + String(" */");
|
||||
}
|
||||
|
||||
std::unique_ptr<Statement> clone() const override {
|
||||
return std::make_unique<InlineMarker>(*fFuncDecl);
|
||||
}
|
||||
|
||||
const FunctionDeclaration* fFuncDecl;
|
||||
using INHERITED = Statement;
|
||||
};
|
||||
|
||||
} // namespace SkSL
|
||||
|
||||
#endif
|
@ -26,6 +26,7 @@ struct Statement : public IRNode {
|
||||
kExpression,
|
||||
kFor,
|
||||
kIf,
|
||||
kInlineMarker,
|
||||
kNop,
|
||||
kReturn,
|
||||
kSwitch,
|
||||
|
Loading…
Reference in New Issue
Block a user