blob: 09b40ce731ef83f4131af3751ceb50656e83dc78 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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
|