diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2018-07-31 09:44:36 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-07-31 15:18:03 +0000 |
commit | 0054311bf3b4f619a631e95d8aa1ea2d4bfd01c6 (patch) | |
tree | a3a48bece53f8a381c2a2e431db08f5055282e4f /src/sksl/SkSLGLSLCodeGenerator.cpp | |
parent | ce3c7bbd0de68fda69903107461738b6afc8a3f4 (diff) |
Re-re-land "added GrSkSLFP and converted DitherEffect to use it"
This reverts commit 6c48e4d11ce80fa5cfef56e13b2d5847fe94a7cc.
Bug: skia:
Change-Id: I7ee78990fc30eec545d1856e59eb6e0573089426
Reviewed-on: https://skia-review.googlesource.com/144348
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/sksl/SkSLGLSLCodeGenerator.cpp')
-rw-r--r-- | src/sksl/SkSLGLSLCodeGenerator.cpp | 61 |
1 files changed, 33 insertions, 28 deletions
diff --git a/src/sksl/SkSLGLSLCodeGenerator.cpp b/src/sksl/SkSLGLSLCodeGenerator.cpp index d08c9135e1..f0c97a319d 100644 --- a/src/sksl/SkSLGLSLCodeGenerator.cpp +++ b/src/sksl/SkSLGLSLCodeGenerator.cpp @@ -887,41 +887,44 @@ void GLSLCodeGenerator::writeSetting(const Setting& s) { } void GLSLCodeGenerator::writeFunction(const FunctionDefinition& f) { - this->writeTypePrecision(f.fDeclaration.fReturnType); - this->writeType(f.fDeclaration.fReturnType); - this->write(" " + f.fDeclaration.fName + "("); - const char* separator = ""; - for (const auto& param : f.fDeclaration.fParameters) { - this->write(separator); - separator = ", "; - this->writeModifiers(param->fModifiers, false); - std::vector<int> sizes; - const Type* type = ¶m->fType; - while (type->kind() == Type::kArray_Kind) { - sizes.push_back(type->columns()); - type = &type->componentType(); - } - this->writeTypePrecision(*type); - this->writeType(*type); - this->write(" " + param->fName); - for (int s : sizes) { - if (s <= 0) { - this->write("[]"); - } else { - this->write("[" + to_string(s) + "]"); + if (fProgramKind != Program::kPipelineStage_Kind) { + this->writeTypePrecision(f.fDeclaration.fReturnType); + this->writeType(f.fDeclaration.fReturnType); + this->write(" " + f.fDeclaration.fName + "("); + const char* separator = ""; + for (const auto& param : f.fDeclaration.fParameters) { + this->write(separator); + separator = ", "; + this->writeModifiers(param->fModifiers, false); + std::vector<int> sizes; + const Type* type = ¶m->fType; + while (type->kind() == Type::kArray_Kind) { + sizes.push_back(type->columns()); + type = &type->componentType(); + } + this->writeTypePrecision(*type); + this->writeType(*type); + this->write(" " + param->fName); + for (int s : sizes) { + if (s <= 0) { + this->write("[]"); + } else { + this->write("[" + to_string(s) + "]"); + } } } + this->writeLine(") {"); + fIndentation++; } - this->writeLine(") {"); - fFunctionHeader = ""; OutputStream* oldOut = fOut; StringStream buffer; fOut = &buffer; - fIndentation++; this->writeStatements(((Block&) *f.fBody).fStatements); - fIndentation--; - this->writeLine("}"); + if (fProgramKind != Program::kPipelineStage_Kind) { + fIndentation--; + this->writeLine("}"); + } fOut = oldOut; this->write(fFunctionHeader); @@ -1316,7 +1319,9 @@ void GLSLCodeGenerator::writeProgramElement(const ProgramElement& e) { bool GLSLCodeGenerator::generateCode() { fProgramKind = fProgram.fKind; - this->writeHeader(); + if (fProgramKind != Program::kPipelineStage_Kind) { + this->writeHeader(); + } if (Program::kGeometry_Kind == fProgramKind && fProgram.fSettings.fCaps->geometryShaderExtensionString()) { this->writeExtension(fProgram.fSettings.fCaps->geometryShaderExtensionString()); |