blob: 205db6e9320913bc02bf9eb877c83fbf2018a50d [file] [log] [blame]
ethannicholasb3058bd2016-07-01 08:22:01 -07001/*
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"
ethannicholasd598f792016-07-25 10:08:54 -070015#include "SkSLSymbolTable.h"
ethannicholasb3058bd2016-07-01 08:22:01 -070016
17namespace SkSL {
18
19/**
20 * Represents a fully-digested program, ready for code generation.
21 */
22struct Program {
23 enum Kind {
24 kFragment_Kind,
25 kVertex_Kind
26 };
27
jvanverth9df16b52016-10-11 10:03:56 -070028 Program(Kind kind, std::vector<std::unique_ptr<ProgramElement>> elements,
ethannicholasd598f792016-07-25 10:08:54 -070029 std::shared_ptr<SymbolTable> symbols)
ethannicholasb3058bd2016-07-01 08:22:01 -070030 : fKind(kind)
ethannicholasd598f792016-07-25 10:08:54 -070031 , fElements(std::move(elements))
32 , fSymbols(symbols) {}
ethannicholasb3058bd2016-07-01 08:22:01 -070033
34 Kind fKind;
jvanverth9df16b52016-10-11 10:03:56 -070035
ethannicholasb3058bd2016-07-01 08:22:01 -070036 std::vector<std::unique_ptr<ProgramElement>> fElements;
ethannicholasd598f792016-07-25 10:08:54 -070037 std::shared_ptr<SymbolTable> fSymbols;
ethannicholasb3058bd2016-07-01 08:22:01 -070038};
39
40} // namespace
41
42#endif