ethannicholas | b3058bd | 2016-07-01 08:22:01 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 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_PROGRAM |
| 9 | #define SKSL_PROGRAM |
| 10 | |
| 11 | #include <vector> |
| 12 | #include <memory> |
| 13 | |
| 14 | #include "SkSLProgramElement.h" |
ethannicholas | d598f79 | 2016-07-25 10:08:54 -0700 | [diff] [blame] | 15 | #include "SkSLSymbolTable.h" |
ethannicholas | b3058bd | 2016-07-01 08:22:01 -0700 | [diff] [blame] | 16 | |
| 17 | namespace SkSL { |
| 18 | |
| 19 | /** |
| 20 | * Represents a fully-digested program, ready for code generation. |
| 21 | */ |
| 22 | struct Program { |
| 23 | enum Kind { |
| 24 | kFragment_Kind, |
| 25 | kVertex_Kind |
| 26 | }; |
| 27 | |
jvanverth | 9df16b5 | 2016-10-11 10:03:56 -0700 | [diff] [blame^] | 28 | Program(Kind kind, std::vector<std::unique_ptr<ProgramElement>> elements, |
ethannicholas | d598f79 | 2016-07-25 10:08:54 -0700 | [diff] [blame] | 29 | std::shared_ptr<SymbolTable> symbols) |
ethannicholas | b3058bd | 2016-07-01 08:22:01 -0700 | [diff] [blame] | 30 | : fKind(kind) |
ethannicholas | d598f79 | 2016-07-25 10:08:54 -0700 | [diff] [blame] | 31 | , fElements(std::move(elements)) |
| 32 | , fSymbols(symbols) {} |
ethannicholas | b3058bd | 2016-07-01 08:22:01 -0700 | [diff] [blame] | 33 | |
| 34 | Kind fKind; |
jvanverth | 9df16b5 | 2016-10-11 10:03:56 -0700 | [diff] [blame^] | 35 | |
ethannicholas | b3058bd | 2016-07-01 08:22:01 -0700 | [diff] [blame] | 36 | std::vector<std::unique_ptr<ProgramElement>> fElements; |
ethannicholas | d598f79 | 2016-07-25 10:08:54 -0700 | [diff] [blame] | 37 | std::shared_ptr<SymbolTable> fSymbols; |
ethannicholas | b3058bd | 2016-07-01 08:22:01 -0700 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | } // namespace |
| 41 | |
| 42 | #endif |