diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2018-07-19 20:10:37 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-07-19 20:10:46 +0000 |
commit | 6c48e4d11ce80fa5cfef56e13b2d5847fe94a7cc (patch) | |
tree | 57e5d832d16aa9a0447e5102fe9811e39f8403d9 /src/sksl/SkSLIRGenerator.cpp | |
parent | 736db1081b378ac8c167dfbc0322470d28c1cb3e (diff) |
Reland "Revert "added GrSkSLFP and converted DitherEffect to use it""
This reverts commit 97ae0c89025dfd791047f5701e57d58da37c125c.
Reason for revert: Breaking ANGLE.
Original change's description:
> Revert "Revert "added GrSkSLFP and converted DitherEffect to use it""
>
> This reverts commit f2030783094e502fb74221077a5ee7cb41287fe4.
>
> Bug: skia:
> Change-Id: Icaaa8b3ea652a8f126bfbcc788a360493a7ebe3e
> Reviewed-on: https://skia-review.googlesource.com/137391
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com,robertphillips@google.com,ethannicholas@google.com
Change-Id: I65d6d2707fceab0a99121c528d1b848d23e34bfa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/142588
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/sksl/SkSLIRGenerator.cpp')
-rw-r--r-- | src/sksl/SkSLIRGenerator.cpp | 46 |
1 files changed, 11 insertions, 35 deletions
diff --git a/src/sksl/SkSLIRGenerator.cpp b/src/sksl/SkSLIRGenerator.cpp index a793ddd952..ba1476e275 100644 --- a/src/sksl/SkSLIRGenerator.cpp +++ b/src/sksl/SkSLIRGenerator.cpp @@ -143,16 +143,10 @@ static void fill_caps(const SKSL_CAPS_CLASS& caps, void IRGenerator::start(const Program::Settings* settings, std::vector<std::unique_ptr<ProgramElement>>* inherited) { - if (fStarted) { - this->popSymbolTable(); - } fSettings = settings; fCapsMap.clear(); if (settings->fCaps) { fill_caps(*settings->fCaps, &fCapsMap); - } else { - fCapsMap.insert(std::make_pair(String("integerSupport"), - Program::Settings::Value(true))); } this->pushSymbolTable(); fInvocations = -1; @@ -173,6 +167,11 @@ void IRGenerator::start(const Program::Settings* settings, } } +void IRGenerator::finish() { + this->popSymbolTable(); + fSettings = nullptr; +} + std::unique_ptr<Extension> IRGenerator::convertExtension(const ASTExtension& extension) { return std::unique_ptr<Extension>(new Extension(extension.fOffset, extension.fName)); } @@ -682,26 +681,6 @@ void IRGenerator::convertFunction(const ASTFunction& f) { parameters.push_back(var); } - if (f.fName == "main") { - if (fKind == Program::kPipelineStage_Kind) { - bool valid = parameters.size() == 3 && - parameters[0]->fType == *fContext.fInt_Type && - parameters[0]->fModifiers.fFlags == 0 && - parameters[1]->fType == *fContext.fInt_Type && - parameters[1]->fModifiers.fFlags == 0 && - parameters[2]->fType == *fContext.fHalf4_Type && - parameters[2]->fModifiers.fFlags == (Modifiers::kIn_Flag | - Modifiers::kOut_Flag); - if (!valid) { - fErrors.error(f.fOffset, "pipeline stage 'main' must be declared main(int, " - "int, inout half4)"); - return; - } - } else if (parameters.size()) { - fErrors.error(f.fOffset, "shader 'main' must have zero parameters"); - } - } - // find existing declaration const FunctionDeclaration* decl = nullptr; auto entry = (*fSymbolTable)[f.fName]; @@ -772,11 +751,6 @@ void IRGenerator::convertFunction(const ASTFunction& f) { decl->fDefined = true; std::shared_ptr<SymbolTable> old = fSymbolTable; AutoSymbolTable table(this); - if (f.fName == "main" && fKind == Program::kPipelineStage_Kind) { - parameters[0]->fModifiers.fLayout.fBuiltin = SK_MAIN_X_BUILTIN; - parameters[1]->fModifiers.fLayout.fBuiltin = SK_MAIN_Y_BUILTIN; - parameters[2]->fModifiers.fLayout.fBuiltin = SK_OUTCOLOR_BUILTIN; - } for (size_t i = 0; i < parameters.size(); i++) { fSymbolTable->addWithoutOwnership(parameters[i]->fName, decl->fParameters[i]); } @@ -1669,15 +1643,17 @@ std::unique_ptr<Expression> IRGenerator::convertNumberConstructor( } if (type.isFloat() && args.size() == 1 && args[0]->fKind == Expression::kFloatLiteral_Kind) { double value = ((FloatLiteral&) *args[0]).fValue; - return std::unique_ptr<Expression>(new FloatLiteral(offset, value, &type)); + return std::unique_ptr<Expression>(new FloatLiteral(fContext, offset, value, &type)); } if (type.isFloat() && args.size() == 1 && args[0]->fKind == Expression::kIntLiteral_Kind) { int64_t value = ((IntLiteral&) *args[0]).fValue; - return std::unique_ptr<Expression>(new FloatLiteral(offset, (double) value, &type)); + return std::unique_ptr<Expression>(new FloatLiteral(fContext, offset, (double) value, + &type)); } if (args[0]->fKind == Expression::kIntLiteral_Kind && (type == *fContext.fInt_Type || type == *fContext.fUInt_Type)) { - return std::unique_ptr<Expression>(new IntLiteral(offset, + return std::unique_ptr<Expression>(new IntLiteral(fContext, + offset, ((IntLiteral&) *args[0]).fValue, &type)); } @@ -1975,7 +1951,7 @@ std::unique_ptr<Expression> IRGenerator::getCap(int offset, String name) { found->second.literal(fContext, offset))); } -std::unique_ptr<Expression> IRGenerator::getArg(int offset, String name) const { +std::unique_ptr<Expression> IRGenerator::getArg(int offset, String name) { auto found = fSettings->fArgs.find(name); if (found == fSettings->fArgs.end()) { fErrors.error(offset, "unknown argument '" + name + "'"); |