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

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

Issue 2372773002: Revert of Turned on SkSL->GLSL compiler (Closed)
Patch Set: Created 4 years, 2 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/SkSLCompiler.h ('k') | src/sksl/SkSLContext.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>
11 #include <streambuf> 11 #include <streambuf>
12 12
13 #include "SkSLIRGenerator.h" 13 #include "SkSLIRGenerator.h"
14 #include "SkSLParser.h" 14 #include "SkSLParser.h"
15 #include "SkSLSPIRVCodeGenerator.h" 15 #include "SkSLSPIRVCodeGenerator.h"
16 #include "ir/SkSLExpression.h" 16 #include "ir/SkSLExpression.h"
17 #include "ir/SkSLIntLiteral.h" 17 #include "ir/SkSLIntLiteral.h"
18 #include "ir/SkSLModifiersDeclaration.h"
19 #include "ir/SkSLSymbolTable.h" 18 #include "ir/SkSLSymbolTable.h"
20 #include "ir/SkSLVarDeclaration.h" 19 #include "ir/SkSLVarDeclaration.h"
21 #include "SkMutex.h" 20 #include "SkMutex.h"
22 21
23 #define STRINGIFY(x) #x 22 #define STRINGIFY(x) #x
24 23
25 // include the built-in shader symbols as static strings 24 // include the built-in shader symbols as static strings
26 25
27 static std::string SKSL_INCLUDE = 26 static std::string SKSL_INCLUDE =
28 #include "sksl.include" 27 #include "sksl.include"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 ADD_TYPE(GVec3); 90 ADD_TYPE(GVec3);
92 ADD_TYPE(GVec4); 91 ADD_TYPE(GVec4);
93 ADD_TYPE(DVec); 92 ADD_TYPE(DVec);
94 ADD_TYPE(IVec); 93 ADD_TYPE(IVec);
95 ADD_TYPE(UVec); 94 ADD_TYPE(UVec);
96 ADD_TYPE(BVec); 95 ADD_TYPE(BVec);
97 96
98 ADD_TYPE(Sampler1D); 97 ADD_TYPE(Sampler1D);
99 ADD_TYPE(Sampler2D); 98 ADD_TYPE(Sampler2D);
100 ADD_TYPE(Sampler3D); 99 ADD_TYPE(Sampler3D);
101 ADD_TYPE(SamplerExternalOES);
102 ADD_TYPE(SamplerCube); 100 ADD_TYPE(SamplerCube);
103 ADD_TYPE(Sampler2DRect); 101 ADD_TYPE(Sampler2DRect);
104 ADD_TYPE(Sampler1DArray); 102 ADD_TYPE(Sampler1DArray);
105 ADD_TYPE(Sampler2DArray); 103 ADD_TYPE(Sampler2DArray);
106 ADD_TYPE(SamplerCubeArray); 104 ADD_TYPE(SamplerCubeArray);
107 ADD_TYPE(SamplerBuffer); 105 ADD_TYPE(SamplerBuffer);
108 ADD_TYPE(Sampler2DMS); 106 ADD_TYPE(Sampler2DMS);
109 ADD_TYPE(Sampler2DMSArray); 107 ADD_TYPE(Sampler2DMSArray);
110 108
111 ADD_TYPE(GSampler1D); 109 ADD_TYPE(GSampler1D);
(...skipping 13 matching lines...) Expand all
125 ADD_TYPE(SamplerCubeShadow); 123 ADD_TYPE(SamplerCubeShadow);
126 ADD_TYPE(Sampler2DRectShadow); 124 ADD_TYPE(Sampler2DRectShadow);
127 ADD_TYPE(Sampler1DArrayShadow); 125 ADD_TYPE(Sampler1DArrayShadow);
128 ADD_TYPE(Sampler2DArrayShadow); 126 ADD_TYPE(Sampler2DArrayShadow);
129 ADD_TYPE(SamplerCubeArrayShadow); 127 ADD_TYPE(SamplerCubeArrayShadow);
130 ADD_TYPE(GSampler2DArrayShadow); 128 ADD_TYPE(GSampler2DArrayShadow);
131 ADD_TYPE(GSamplerCubeArrayShadow); 129 ADD_TYPE(GSamplerCubeArrayShadow);
132 130
133 std::vector<std::unique_ptr<ProgramElement>> ignored; 131 std::vector<std::unique_ptr<ProgramElement>> ignored;
134 this->internalConvertProgram(SKSL_INCLUDE, &ignored); 132 this->internalConvertProgram(SKSL_INCLUDE, &ignored);
135 printf("%s", errorText().c_str());
136 ASSERT(!fErrorCount); 133 ASSERT(!fErrorCount);
137 } 134 }
138 135
139 Compiler::~Compiler() { 136 Compiler::~Compiler() {
140 delete fIRGenerator; 137 delete fIRGenerator;
141 } 138 }
142 139
143 void Compiler::internalConvertProgram(std::string text, 140 void Compiler::internalConvertProgram(std::string text,
144 std::vector<std::unique_ptr<ProgramElement >>* result) { 141 std::vector<std::unique_ptr<ProgramElement >>* result) {
145 Parser parser(text, *fTypes, *this); 142 Parser parser(text, *fTypes, *this);
(...skipping 12 matching lines...) Expand all
158 result->push_back(std::move(s)); 155 result->push_back(std::move(s));
159 } 156 }
160 break; 157 break;
161 } 158 }
162 case ASTDeclaration::kFunction_Kind: { 159 case ASTDeclaration::kFunction_Kind: {
163 std::unique_ptr<FunctionDefinition> f = fIRGenerator->convertFun ction( 160 std::unique_ptr<FunctionDefinition> f = fIRGenerator->convertFun ction(
164 ( ASTFunction&) decl); 161 ( ASTFunction&) decl);
165 if (f) { 162 if (f) {
166 result->push_back(std::move(f)); 163 result->push_back(std::move(f));
167 } 164 }
168 break;
169 }
170 case ASTDeclaration::kModifiers_Kind: {
171 std::unique_ptr<ModifiersDeclaration> f = fIRGenerator->convertM odifiersDeclaration(
172 (ASTModifiers Declaration&) decl);
173 if (f) {
174 result->push_back(std::move(f));
175 }
176 break; 165 break;
177 } 166 }
178 case ASTDeclaration::kInterfaceBlock_Kind: { 167 case ASTDeclaration::kInterfaceBlock_Kind: {
179 std::unique_ptr<InterfaceBlock> i = fIRGenerator->convertInterfa ceBlock( 168 std::unique_ptr<InterfaceBlock> i = fIRGenerator->convertInterfa ceBlock(
180 (ASTInt erfaceBlock&) decl); 169 (ASTInt erfaceBlock&) decl);
181 if (i) { 170 if (i) {
182 result->push_back(std::move(i)); 171 result->push_back(std::move(i));
183 } 172 }
184 break; 173 break;
185 } 174 }
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 std::string* out) { 260 std::string* out) {
272 std::stringstream buffer; 261 std::stringstream buffer;
273 bool result = this->toGLSL(kind, text, caps, buffer); 262 bool result = this->toGLSL(kind, text, caps, buffer);
274 if (result) { 263 if (result) {
275 *out = buffer.str(); 264 *out = buffer.str();
276 } 265 }
277 return result; 266 return result;
278 } 267 }
279 268
280 } // namespace 269 } // namespace
OLDNEW
« no previous file with comments | « src/sksl/SkSLCompiler.h ('k') | src/sksl/SkSLContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698