aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/SkSLIRGenerator.cpp
diff options
context:
space:
mode:
authorGravatar Kevin Lubick <kjlubick@google.com>2018-06-19 12:04:18 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-19 12:23:21 +0000
commitf2030783094e502fb74221077a5ee7cb41287fe4 (patch)
tree7716875c2aaf120f213bb916300bf9482d260d0c /src/sksl/SkSLIRGenerator.cpp
parentfb3beb0591aed9fd6bf349eb5d08e0e485bcff08 (diff)
Revert "added GrSkSLFP and converted DitherEffect to use it"
This reverts commit dfbfc738a9edfff7a9804253175e380c230f3d21. Reason for revert: Seems to be breaking DDL/ASAN bots Original change's description: > added GrSkSLFP and converted DitherEffect to use it > > Bug: skia: > Change-Id: I84b71165eab1712355f3c7669cee2d33d259f3df > Reviewed-on: https://skia-review.googlesource.com/124504 > Commit-Queue: Ethan Nicholas <ethannicholas@google.com> > Reviewed-by: Brian Salomon <bsalomon@google.com> TBR=bsalomon@google.com,ethannicholas@google.com Change-Id: Ic4c3978aaba0391f2f8bb1316a456e3821a3a2f2 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/135700 Commit-Queue: Kevin Lubick <kjlubick@google.com> Reviewed-by: Kevin Lubick <kjlubick@google.com>
Diffstat (limited to 'src/sksl/SkSLIRGenerator.cpp')
-rw-r--r--src/sksl/SkSLIRGenerator.cpp46
1 files changed, 11 insertions, 35 deletions
diff --git a/src/sksl/SkSLIRGenerator.cpp b/src/sksl/SkSLIRGenerator.cpp
index 144708bbae..5a54b07333 100644
--- a/src/sksl/SkSLIRGenerator.cpp
+++ b/src/sksl/SkSLIRGenerator.cpp
@@ -144,16 +144,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;
@@ -174,6 +168,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));
}
@@ -683,26 +682,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];
@@ -773,11 +752,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]);
}
@@ -1670,15 +1644,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));
}
@@ -1976,7 +1952,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 + "'");