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

Side by Side Diff: src/sksl/SkSLContext.h

Issue 2458723002: Revert of Reduced skslc memory consumption (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | src/sksl/SkSLIRGenerator.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SKSL_CONTEXT 8 #ifndef SKSL_CONTEXT
9 #define SKSL_CONTEXT 9 #define SKSL_CONTEXT
10 10
11 #include "ir/SkSLType.h" 11 #include "ir/SkSLType.h"
12 #include "ir/SkSLExpression.h" 12 #include "ir/SkSLExpression.h"
13 13
14 namespace SkSL { 14 namespace SkSL {
15 15
16 /** 16 /**
17 * Contains compiler-wide objects, which currently means the core types. 17 * Contains compiler-wide objects, which currently means the core types.
18 */ 18 */
19 class Context { 19 class Context {
20 public: 20 public:
21 Context() 21 Context()
22 : fInvalid_Type(new Type("<INVALID>")) 22 : fVoid_Type(new Type("void"))
23 , fVoid_Type(new Type("void"))
24 , fDouble_Type(new Type("double", true)) 23 , fDouble_Type(new Type("double", true))
25 , fDVec2_Type(new Type("dvec2", *fDouble_Type, 2)) 24 , fDVec2_Type(new Type("dvec2", *fDouble_Type, 2))
26 , fDVec3_Type(new Type("dvec3", *fDouble_Type, 3)) 25 , fDVec3_Type(new Type("dvec3", *fDouble_Type, 3))
27 , fDVec4_Type(new Type("dvec4", *fDouble_Type, 4)) 26 , fDVec4_Type(new Type("dvec4", *fDouble_Type, 4))
28 , fFloat_Type(new Type("float", true, { fDouble_Type.get() })) 27 , fFloat_Type(new Type("float", true, { fDouble_Type.get() }))
29 , fVec2_Type(new Type("vec2", *fFloat_Type, 2)) 28 , fVec2_Type(new Type("vec2", *fFloat_Type, 2))
30 , fVec3_Type(new Type("vec3", *fFloat_Type, 3)) 29 , fVec3_Type(new Type("vec3", *fFloat_Type, 3))
31 , fVec4_Type(new Type("vec4", *fFloat_Type, 4)) 30 , fVec4_Type(new Type("vec4", *fFloat_Type, 4))
32 , fUInt_Type(new Type("uint", true, { fFloat_Type.get(), fDouble_Type.get() })) 31 , fUInt_Type(new Type("uint", true, { fFloat_Type.get(), fDouble_Type.get() }))
33 , fUVec2_Type(new Type("uvec2", *fUInt_Type, 2)) 32 , fUVec2_Type(new Type("uvec2", *fUInt_Type, 2))
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 fVec4_Type.get() })) 97 fVec4_Type.get() }))
99 , fGenDType_Type(new Type("$genDType", { fDouble_Type.get(), fDVec2_Type.get (), 98 , fGenDType_Type(new Type("$genDType", { fDouble_Type.get(), fDVec2_Type.get (),
100 fDVec3_Type.get(), fDVec4_Type.get( ) })) 99 fDVec3_Type.get(), fDVec4_Type.get( ) }))
101 , fGenIType_Type(new Type("$genIType", { fInt_Type.get(), fIVec2_Type.get(), fIVec3_Type.get(), 100 , fGenIType_Type(new Type("$genIType", { fInt_Type.get(), fIVec2_Type.get(), fIVec3_Type.get(),
102 fIVec4_Type.get() })) 101 fIVec4_Type.get() }))
103 , fGenUType_Type(new Type("$genUType", { fUInt_Type.get(), fUVec2_Type.get() , fUVec3_Type.get(), 102 , fGenUType_Type(new Type("$genUType", { fUInt_Type.get(), fUVec2_Type.get() , fUVec3_Type.get(),
104 fUVec4_Type.get() })) 103 fUVec4_Type.get() }))
105 , fGenBType_Type(new Type("$genBType", { fBool_Type.get(), fBVec2_Type.get() , fBVec3_Type.get(), 104 , fGenBType_Type(new Type("$genBType", { fBool_Type.get(), fBVec2_Type.get() , fBVec3_Type.get(),
106 fBVec4_Type.get() })) 105 fBVec4_Type.get() }))
107 , fMat_Type(new Type("$mat")) 106 , fMat_Type(new Type("$mat"))
108 , fVec_Type(new Type("$vec", { fInvalid_Type.get(), fVec2_Type.get(), fVec3_ Type.get(), 107 , fVec_Type(new Type("$vec", { fVec2_Type.get(), fVec2_Type.get(), fVec3_Typ e.get(),
109 fVec4_Type.get() })) 108 fVec4_Type.get() }))
110 , fGVec_Type(new Type("$gvec")) 109 , fGVec_Type(new Type("$gvec"))
111 , fGVec2_Type(new Type("$gvec2")) 110 , fGVec2_Type(new Type("$gvec2"))
112 , fGVec3_Type(new Type("$gvec3")) 111 , fGVec3_Type(new Type("$gvec3"))
113 , fGVec4_Type(new Type("$gvec4", static_type(*fVec4_Type))) 112 , fGVec4_Type(new Type("$gvec4", static_type(*fVec4_Type)))
114 , fDVec_Type(new Type("$dvec", { fInvalid_Type.get(), fDVec2_Type.get(), fDV ec3_Type.get(), 113 , fDVec_Type(new Type("$dvec"))
115 fDVec4_Type.get() })) 114 , fIVec_Type(new Type("$ivec"))
116 , fIVec_Type(new Type("$ivec", { fInvalid_Type.get(), fIVec2_Type.get(), fIV ec3_Type.get(), 115 , fUVec_Type(new Type("$uvec"))
117 fIVec4_Type.get() })) 116 , fBVec_Type(new Type("$bvec", { fBVec2_Type.get(), fBVec2_Type.get(), fBVec 3_Type.get(),
118 , fUVec_Type(new Type("$uvec", { fInvalid_Type.get(), fUVec2_Type.get(), fUV ec3_Type.get(),
119 fUVec4_Type.get() }))
120 , fBVec_Type(new Type("$bvec", { fInvalid_Type.get(), fBVec2_Type.get(), fBV ec3_Type.get(),
121 fBVec4_Type.get() })) 117 fBVec4_Type.get() }))
118 , fInvalid_Type(new Type("<INVALID>"))
122 , fDefined_Expression(new Defined(*fInvalid_Type)) {} 119 , fDefined_Expression(new Defined(*fInvalid_Type)) {}
123 120
124 static std::vector<const Type*> static_type(const Type& t) { 121 static std::vector<const Type*> static_type(const Type& t) {
125 return { &t, &t, &t, &t }; 122 return { &t, &t, &t, &t };
126 } 123 }
127 124
128 const std::unique_ptr<Type> fInvalid_Type;
129 const std::unique_ptr<Type> fVoid_Type; 125 const std::unique_ptr<Type> fVoid_Type;
130 126
131 const std::unique_ptr<Type> fDouble_Type; 127 const std::unique_ptr<Type> fDouble_Type;
132 const std::unique_ptr<Type> fDVec2_Type; 128 const std::unique_ptr<Type> fDVec2_Type;
133 const std::unique_ptr<Type> fDVec3_Type; 129 const std::unique_ptr<Type> fDVec3_Type;
134 const std::unique_ptr<Type> fDVec4_Type; 130 const std::unique_ptr<Type> fDVec4_Type;
135 131
136 const std::unique_ptr<Type> fFloat_Type; 132 const std::unique_ptr<Type> fFloat_Type;
137 const std::unique_ptr<Type> fVec2_Type; 133 const std::unique_ptr<Type> fVec2_Type;
138 const std::unique_ptr<Type> fVec3_Type; 134 const std::unique_ptr<Type> fVec3_Type;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 const std::unique_ptr<Type> fGVec_Type; 216 const std::unique_ptr<Type> fGVec_Type;
221 const std::unique_ptr<Type> fGVec2_Type; 217 const std::unique_ptr<Type> fGVec2_Type;
222 const std::unique_ptr<Type> fGVec3_Type; 218 const std::unique_ptr<Type> fGVec3_Type;
223 const std::unique_ptr<Type> fGVec4_Type; 219 const std::unique_ptr<Type> fGVec4_Type;
224 const std::unique_ptr<Type> fDVec_Type; 220 const std::unique_ptr<Type> fDVec_Type;
225 const std::unique_ptr<Type> fIVec_Type; 221 const std::unique_ptr<Type> fIVec_Type;
226 const std::unique_ptr<Type> fUVec_Type; 222 const std::unique_ptr<Type> fUVec_Type;
227 223
228 const std::unique_ptr<Type> fBVec_Type; 224 const std::unique_ptr<Type> fBVec_Type;
229 225
226 const std::unique_ptr<Type> fInvalid_Type;
227
230 // dummy expression used to mark that a variable has a value during dataflow analysis (when it 228 // dummy expression used to mark that a variable has a value during dataflow analysis (when it
231 // could have several different values, or the analyzer is otherwise unable to assign it a 229 // could have several different values, or the analyzer is otherwise unable to assign it a
232 // specific expression) 230 // specific expression)
233 const std::unique_ptr<Expression> fDefined_Expression; 231 const std::unique_ptr<Expression> fDefined_Expression;
234 232
235 private: 233 private:
236 class Defined : public Expression { 234 class Defined : public Expression {
237 public: 235 public:
238 Defined(const Type& type) 236 Defined(const Type& type)
239 : INHERITED(Position(), kDefined_Kind, type) {} 237 : INHERITED(Position(), kDefined_Kind, type) {}
240 238
241 virtual std::string description() const override { 239 virtual std::string description() const override {
242 return "<defined>"; 240 return "<defined>";
243 } 241 }
244 242
245 typedef Expression INHERITED; 243 typedef Expression INHERITED;
246 }; 244 };
247 }; 245 };
248 246
249 } // namespace 247 } // namespace
250 248
251 #endif 249 #endif
OLDNEW
« no previous file with comments | « no previous file | src/sksl/SkSLIRGenerator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698