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

Side by Side Diff: src/sksl/ir/SkSLVariable.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/ir/SkSLVarDeclarationStatement.h ('k') | src/sksl/ir/SkSLVariableReference.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_VARIABLE
9 #define SKSL_VARIABLE
10
11 #include "SkSLModifiers.h"
12 #include "SkSLPosition.h"
13 #include "SkSLSymbol.h"
14 #include "SkSLType.h"
15
16 namespace SkSL {
17
18 /**
19 * Represents a variable, whether local, global, or a function parameter. This r epresents the
20 * variable itself (the storage location), which is shared between all VariableR eferences which
21 * read or write that storage location.
22 */
23 struct Variable : public Symbol {
24 enum Storage {
25 kGlobal_Storage,
26 kLocal_Storage,
27 kParameter_Storage
28 };
29
30 Variable(Position position, Modifiers modifiers, std::string name, std::shar ed_ptr<Type> type,
31 Storage storage)
32 : INHERITED(position, kVariable_Kind, std::move(name))
33 , fModifiers(modifiers)
34 , fType(type)
35 , fStorage(storage)
36 , fIsReadFrom(false)
37 , fIsWrittenTo(false) {}
38
39 virtual std::string description() const override {
40 return fModifiers.description() + fType->fName + " " + fName;
41 }
42
43 const Modifiers fModifiers;
44 const std::string fValue;
45 const std::shared_ptr<Type> fType;
46 const Storage fStorage;
47
48 mutable bool fIsReadFrom;
49 mutable bool fIsWrittenTo;
50
51 typedef Symbol INHERITED;
52 };
53
54 } // namespace SkSL
55
56 namespace std {
57 template <>
58 struct hash<SkSL::Variable> {
59 public :
60 size_t operator()(const SkSL::Variable &var) const{
61 return hash<std::string>()(var.fName) ^ hash<std::string>()(var.fTyp e->description());
62 }
63 };
64 } // namespace std
65
66 #endif
OLDNEW
« no previous file with comments | « src/sksl/ir/SkSLVarDeclarationStatement.h ('k') | src/sksl/ir/SkSLVariableReference.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698