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

Side by Side Diff: src/sksl/SkSLCompiler.cpp

Issue 2143323003: Revert of SkSL performance improvements (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: 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/gpu/vk/GrVkPipelineStateBuilder.cpp ('k') | src/sksl/SkSLIRGenerator.h » ('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 #include "SkSLCompiler.h" 8 #include "SkSLCompiler.h"
9 9
10 #include <fstream> 10 #include <fstream>
(...skipping 25 matching lines...) Expand all
36 ; 36 ;
37 37
38 namespace SkSL { 38 namespace SkSL {
39 39
40 Compiler::Compiler() 40 Compiler::Compiler()
41 : fErrorCount(0) { 41 : fErrorCount(0) {
42 auto types = std::shared_ptr<SymbolTable>(new SymbolTable(*this)); 42 auto types = std::shared_ptr<SymbolTable>(new SymbolTable(*this));
43 auto symbols = std::shared_ptr<SymbolTable>(new SymbolTable(types, *this)); 43 auto symbols = std::shared_ptr<SymbolTable>(new SymbolTable(types, *this));
44 fIRGenerator = new IRGenerator(symbols, *this); 44 fIRGenerator = new IRGenerator(symbols, *this);
45 fTypes = types; 45 fTypes = types;
46 #define ADD_TYPE(t) types->addWithoutOwnership(k ## t ## _Type->fName, k ## t ## _Type) 46 #define ADD_TYPE(t) types->add(k ## t ## _Type->fName, k ## t ## _Type)
47 ADD_TYPE(Void); 47 ADD_TYPE(Void);
48 ADD_TYPE(Float); 48 ADD_TYPE(Float);
49 ADD_TYPE(Vec2); 49 ADD_TYPE(Vec2);
50 ADD_TYPE(Vec3); 50 ADD_TYPE(Vec3);
51 ADD_TYPE(Vec4); 51 ADD_TYPE(Vec4);
52 ADD_TYPE(Double); 52 ADD_TYPE(Double);
53 ADD_TYPE(DVec2); 53 ADD_TYPE(DVec2);
54 ADD_TYPE(DVec3); 54 ADD_TYPE(DVec3);
55 ADD_TYPE(DVec4); 55 ADD_TYPE(DVec4);
56 ADD_TYPE(Int); 56 ADD_TYPE(Int);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 default: 178 default:
179 ABORT("unsupported declaration: %s\n", decl.description().c_str( )); 179 ABORT("unsupported declaration: %s\n", decl.description().c_str( ));
180 } 180 }
181 } 181 }
182 } 182 }
183 183
184 std::unique_ptr<Program> Compiler::convertProgram(Program::Kind kind, std::strin g text) { 184 std::unique_ptr<Program> Compiler::convertProgram(Program::Kind kind, std::strin g text) {
185 fErrorText = ""; 185 fErrorText = "";
186 fErrorCount = 0; 186 fErrorCount = 0;
187 fIRGenerator->pushSymbolTable(); 187 fIRGenerator->pushSymbolTable();
188 std::vector<std::unique_ptr<ProgramElement>> elements; 188 std::vector<std::unique_ptr<ProgramElement>> result;
189 switch (kind) { 189 switch (kind) {
190 case Program::kVertex_Kind: 190 case Program::kVertex_Kind:
191 this->internalConvertProgram(SKSL_VERT_INCLUDE, &elements); 191 this->internalConvertProgram(SKSL_VERT_INCLUDE, &result);
192 break; 192 break;
193 case Program::kFragment_Kind: 193 case Program::kFragment_Kind:
194 this->internalConvertProgram(SKSL_FRAG_INCLUDE, &elements); 194 this->internalConvertProgram(SKSL_FRAG_INCLUDE, &result);
195 break; 195 break;
196 } 196 }
197 this->internalConvertProgram(text, &elements); 197 this->internalConvertProgram(text, &result);
198 auto result = std::unique_ptr<Program>(new Program(kind, std::move(elements) ,
199 fIRGenerator->fSymbolTabl e));;
200 fIRGenerator->popSymbolTable(); 198 fIRGenerator->popSymbolTable();
201 this->writeErrorCount(); 199 this->writeErrorCount();
202 return result; 200 return std::unique_ptr<Program>(new Program(kind, std::move(result)));;
203 } 201 }
204 202
205 void Compiler::error(Position position, std::string msg) { 203 void Compiler::error(Position position, std::string msg) {
206 fErrorCount++; 204 fErrorCount++;
207 fErrorText += "error: " + position.description() + ": " + msg.c_str() + "\n" ; 205 fErrorText += "error: " + position.description() + ": " + msg.c_str() + "\n" ;
208 } 206 }
209 207
210 std::string Compiler::errorText() { 208 std::string Compiler::errorText() {
211 std::string result = fErrorText; 209 std::string result = fErrorText;
212 return result; 210 return result;
(...skipping 23 matching lines...) Expand all
236 bool Compiler::toSPIRV(Program::Kind kind, std::string text, std::string* out) { 234 bool Compiler::toSPIRV(Program::Kind kind, std::string text, std::string* out) {
237 std::stringstream buffer; 235 std::stringstream buffer;
238 bool result = this->toSPIRV(kind, text, buffer); 236 bool result = this->toSPIRV(kind, text, buffer);
239 if (result) { 237 if (result) {
240 *out = buffer.str(); 238 *out = buffer.str();
241 } 239 }
242 return fErrorCount == 0; 240 return fErrorCount == 0;
243 } 241 }
244 242
245 } // namespace 243 } // namespace
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkPipelineStateBuilder.cpp ('k') | src/sksl/SkSLIRGenerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698