1/*
2 * Copyright 2017 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SKSL_PIPELINESTAGECODEGENERATOR
9#define SKSL_PIPELINESTAGECODEGENERATOR
10
11#include "src/sksl/SkSLGLSLCodeGenerator.h"
12
13#if !defined(SKSL_STANDALONE) && SK_SUPPORT_GPU
14
15namespace SkSL {
16
17class PipelineStageCodeGenerator : public GLSLCodeGenerator {
18public:
19 PipelineStageCodeGenerator(const Context* context, const Program* program,
20 ErrorReporter* errors, OutputStream* out,
21 PipelineStageArgs* outArgs);
22
23private:
24 void writeHeader() override;
25
26 bool usesPrecisionModifiers() const override;
27
28 String getTypeName(const Type& type) override;
29
30 void writeBinaryExpression(const BinaryExpression& b, Precedence parentPrecedence) override;
31
32 void writeFunctionCall(const FunctionCall& c) override;
33
34 void writeIntLiteral(const IntLiteral& i) override;
35
36 void writeVariableReference(const VariableReference& ref) override;
37
38 void writeIfStatement(const IfStatement& s) override;
39
40 void writeSwitchStatement(const SwitchStatement& s) override;
41
42 void writeFunction(const FunctionDefinition& f) override;
43
44 void writeProgramElement(const ProgramElement& p) override;
45
46 PipelineStageArgs* fArgs;
47
48 typedef GLSLCodeGenerator INHERITED;
49};
50
51}
52
53#endif
54
55#endif
56