Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: src/sksl/ast/SkSLASTInterfaceBlock.h

Issue 1984363002: initial checkin of SkSL compiler (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: fixed CMake build Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/sksl/ast/SkSLASTIntLiteral.h ('k') | src/sksl/ast/SkSLASTLayout.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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_ASTINTERFACEBLOCK
9 #define SKSL_ASTINTERFACEBLOCK
10
11 #include "SkSLASTVarDeclaration.h"
12
13 namespace SkSL {
14
15 /**
16 * An interface block, as in:
17 *
18 * out gl_PerVertex {
19 * layout(builtin=0) vec4 gl_Position;
20 * layout(builtin=1) float gl_PointSize;
21 * };
22 */
23 struct ASTInterfaceBlock : public ASTDeclaration {
24 // valueName is empty when it was not present in the source
25 ASTInterfaceBlock(Position position,
26 ASTModifiers modifiers,
27 std::string interfaceName,
28 std::string valueName,
29 std::vector<std::unique_ptr<ASTVarDeclaration>> declaratio ns)
30 : INHERITED(position, kInterfaceBlock_Kind)
31 , fModifiers(modifiers)
32 , fInterfaceName(std::move(interfaceName))
33 , fValueName(std::move(valueName))
34 , fDeclarations(std::move(declarations)) {}
35
36 std::string description() const override {
37 std::string result = fModifiers.description() + fInterfaceName + " {\n";
38 for (size_t i = 0; i < fDeclarations.size(); i++) {
39 result += fDeclarations[i]->description() + "\n";
40 }
41 result += "}";
42 if (fValueName.length()) {
43 result += " " + fValueName;
44 }
45 return result + ";";
46 }
47
48 const ASTModifiers fModifiers;
49 const std::string fInterfaceName;
50 const std::string fValueName;
51 const std::vector<std::unique_ptr<ASTVarDeclaration>> fDeclarations;
52
53 typedef ASTDeclaration INHERITED;
54 };
55
56 } // namespace
57
58 #endif
OLDNEW
« no previous file with comments | « src/sksl/ast/SkSLASTIntLiteral.h ('k') | src/sksl/ast/SkSLASTLayout.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698