diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2018-06-18 14:14:13 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-18 18:40:58 +0000 |
commit | dfbfc738a9edfff7a9804253175e380c230f3d21 (patch) | |
tree | 974f1093a905e07601ffff34d04d2e8ed70e6fc4 /src/sksl/SkSLPipelineStageCodeGenerator.h | |
parent | b831ea22960c684b65f8ead76efe24059d119086 (diff) |
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>
Diffstat (limited to 'src/sksl/SkSLPipelineStageCodeGenerator.h')
-rw-r--r-- | src/sksl/SkSLPipelineStageCodeGenerator.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/sksl/SkSLPipelineStageCodeGenerator.h b/src/sksl/SkSLPipelineStageCodeGenerator.h new file mode 100644 index 0000000000..09b40ce731 --- /dev/null +++ b/src/sksl/SkSLPipelineStageCodeGenerator.h @@ -0,0 +1,65 @@ +/* + * Copyright 2017 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef SKSL_PIPELINESTAGECODEGENERATOR +#define SKSL_PIPELINESTAGECODEGENERATOR + +#include "SkSLGLSLCodeGenerator.h" +#include "SkSLSectionAndParameterHelper.h" + +#include <set> + +namespace SkSL { + +class PipelineStageCodeGenerator : public GLSLCodeGenerator { +public: + PipelineStageCodeGenerator(const Context* context, const Program* program, + ErrorReporter* errors, OutputStream* out, + std::vector<Compiler::FormatArg>* outFormatArgs); + +private: + void writef(const char* s, va_list va) SKSL_PRINTF_LIKE(2, 0); + + void writef(const char* s, ...) SKSL_PRINTF_LIKE(2, 3); + + bool writeSection(const char* name, const char* prefix = ""); + + void writeHeader() override; + + bool usesPrecisionModifiers() const override; + + String getTypeName(const Type& type) override; + + void writeBinaryExpression(const BinaryExpression& b, Precedence parentPrecedence) override; + + void writeIntLiteral(const IntLiteral& i) override; + + void writeVariableReference(const VariableReference& ref) override; + + void writeIfStatement(const IfStatement& s) override; + + void writeSwitchStatement(const SwitchStatement& s) override; + + void writeFunction(const FunctionDefinition& f) override; + + void writeProgramElement(const ProgramElement& p) override; + + bool writeEmitCode(std::vector<const Variable*>& uniforms); + + String fName; + String fFullName; + SectionAndParameterHelper fSectionAndParameterHelper; + String fExtraEmitCodeCode; + std::set<int> fWrittenTransformedCoords; + std::vector<Compiler::FormatArg>* fFormatArgs; + + typedef GLSLCodeGenerator INHERITED; +}; + +} + +#endif |