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

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

Issue 2312233002: refactored SkSL VarDeclaration handling (Closed)
Patch Set: fixed nits Created 4 years, 3 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 | « no previous file | src/sksl/SkSLGLSLCodeGenerator.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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 std::vector<std::unique_ptr<ProgramElement >>* result) { 141 std::vector<std::unique_ptr<ProgramElement >>* result) {
142 Parser parser(text, *fTypes, *this); 142 Parser parser(text, *fTypes, *this);
143 std::vector<std::unique_ptr<ASTDeclaration>> parsed = parser.file(); 143 std::vector<std::unique_ptr<ASTDeclaration>> parsed = parser.file();
144 if (fErrorCount) { 144 if (fErrorCount) {
145 return; 145 return;
146 } 146 }
147 for (size_t i = 0; i < parsed.size(); i++) { 147 for (size_t i = 0; i < parsed.size(); i++) {
148 ASTDeclaration& decl = *parsed[i]; 148 ASTDeclaration& decl = *parsed[i];
149 switch (decl.fKind) { 149 switch (decl.fKind) {
150 case ASTDeclaration::kVar_Kind: { 150 case ASTDeclaration::kVar_Kind: {
151 std::unique_ptr<VarDeclaration> s = fIRGenerator->convertVarDecl aration( 151 std::unique_ptr<VarDeclarations> s = fIRGenerator->convertVarDec larations(
152 (ASTVar Declaration&) decl, 152 (ASTVar Declarations&) decl,
153 Variabl e::kGlobal_Storage); 153 Variabl e::kGlobal_Storage);
154 if (s) { 154 if (s) {
155 result->push_back(std::move(s)); 155 result->push_back(std::move(s));
156 } 156 }
157 break; 157 break;
158 } 158 }
159 case ASTDeclaration::kFunction_Kind: { 159 case ASTDeclaration::kFunction_Kind: {
160 std::unique_ptr<FunctionDefinition> f = fIRGenerator->convertFun ction( 160 std::unique_ptr<FunctionDefinition> f = fIRGenerator->convertFun ction(
161 ( ASTFunction&) decl); 161 ( ASTFunction&) decl);
162 if (f) { 162 if (f) {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 std::string* out) { 260 std::string* out) {
261 std::stringstream buffer; 261 std::stringstream buffer;
262 bool result = this->toGLSL(kind, text, caps, buffer); 262 bool result = this->toGLSL(kind, text, caps, buffer);
263 if (result) { 263 if (result) {
264 *out = buffer.str(); 264 *out = buffer.str();
265 } 265 }
266 return result; 266 return result;
267 } 267 }
268 268
269 } // namespace 269 } // namespace
OLDNEW
« no previous file with comments | « no previous file | src/sksl/SkSLGLSLCodeGenerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698