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

Side by Side Diff: src/gpu/gl/builders/GrGLProgramBuilder.cpp

Issue 1443743002: Rename some processor functions from GL to GLSL (Closed) Base URL: https://skia.googlesource.com/skia.git@primProcs
Patch Set: nits Created 5 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 | « src/gpu/gl/GrGLProgramDesc.cpp ('k') | src/gpu/glsl/GrGLSLFragmentShaderBuilder.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 2014 Google Inc. 2 * Copyright 2014 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 "GrGLProgramBuilder.h" 8 #include "GrGLProgramBuilder.h"
9 9
10 #include "GrAutoLocaleSetter.h" 10 #include "GrAutoLocaleSetter.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 247
248 fFS.codeAppend("}"); 248 fFS.codeAppend("}");
249 } 249 }
250 250
251 void GrGLProgramBuilder::emitAndInstallProc(const GrFragmentProcessor& fp, 251 void GrGLProgramBuilder::emitAndInstallProc(const GrFragmentProcessor& fp,
252 int index, 252 int index,
253 const char* outColor, 253 const char* outColor,
254 const char* inColor) { 254 const char* inColor) {
255 GrGLInstalledFragProc* ifp = new GrGLInstalledFragProc; 255 GrGLInstalledFragProc* ifp = new GrGLInstalledFragProc;
256 256
257 ifp->fGLProc.reset(fp.createGLInstance()); 257 ifp->fGLProc.reset(fp.createGLSLInstance());
258 258
259 SkSTArray<4, GrGLSLTextureSampler> samplers(fp.numTextures()); 259 SkSTArray<4, GrGLSLTextureSampler> samplers(fp.numTextures());
260 this->emitSamplers(fp, &samplers, ifp); 260 this->emitSamplers(fp, &samplers, ifp);
261 261
262 GrGLSLFragmentProcessor::EmitArgs args(this, 262 GrGLSLFragmentProcessor::EmitArgs args(this,
263 fp, 263 fp,
264 outColor, 264 outColor,
265 inColor, 265 inColor,
266 fOutCoords[index], 266 fOutCoords[index],
267 samplers); 267 samplers);
268 ifp->fGLProc->emitCode(args); 268 ifp->fGLProc->emitCode(args);
269 269
270 // We have to check that effects and the code they emit are consistent, ie i f an effect 270 // We have to check that effects and the code they emit are consistent, ie i f an effect
271 // asks for dst color, then the emit code needs to follow suit 271 // asks for dst color, then the emit code needs to follow suit
272 verify(fp); 272 verify(fp);
273 fFragmentProcessors->fProcs.push_back(ifp); 273 fFragmentProcessors->fProcs.push_back(ifp);
274 } 274 }
275 275
276 void GrGLProgramBuilder::emitAndInstallProc(const GrPrimitiveProcessor& gp, 276 void GrGLProgramBuilder::emitAndInstallProc(const GrPrimitiveProcessor& gp,
277 const char* outColor, 277 const char* outColor,
278 const char* outCoverage) { 278 const char* outCoverage) {
279 SkASSERT(!fGeometryProcessor); 279 SkASSERT(!fGeometryProcessor);
280 fGeometryProcessor = new GrGLInstalledGeoProc; 280 fGeometryProcessor = new GrGLInstalledGeoProc;
281 281
282 fGeometryProcessor->fGLProc.reset(gp.createGLInstance(*fGpu->glCaps().glslCa ps())); 282 fGeometryProcessor->fGLProc.reset(gp.createGLSLInstance(*fGpu->glCaps().glsl Caps()));
283 283
284 SkSTArray<4, GrGLSLTextureSampler> samplers(gp.numTextures()); 284 SkSTArray<4, GrGLSLTextureSampler> samplers(gp.numTextures());
285 this->emitSamplers(gp, &samplers, fGeometryProcessor); 285 this->emitSamplers(gp, &samplers, fGeometryProcessor);
286 286
287 GrGLSLGeometryProcessor::EmitArgs args(this, gp, outColor, outCoverage, samp lers, 287 GrGLSLGeometryProcessor::EmitArgs args(this, gp, outColor, outCoverage, samp lers,
288 fCoordTransforms, &fOutCoords); 288 fCoordTransforms, &fOutCoords);
289 fGeometryProcessor->fGLProc->emitCode(args); 289 fGeometryProcessor->fGLProc->emitCode(args);
290 290
291 // We have to check that effects and the code they emit are consistent, ie i f an effect 291 // We have to check that effects and the code they emit are consistent, ie i f an effect
292 // asks for dst color, then the emit code needs to follow suit 292 // asks for dst color, then the emit code needs to follow suit
293 verify(gp); 293 verify(gp);
294 } 294 }
295 295
296 void GrGLProgramBuilder::emitAndInstallXferProc(const GrXferProcessor& xp, 296 void GrGLProgramBuilder::emitAndInstallXferProc(const GrXferProcessor& xp,
297 const GrGLSLExpr4& colorIn, 297 const GrGLSLExpr4& colorIn,
298 const GrGLSLExpr4& coverageIn) { 298 const GrGLSLExpr4& coverageIn) {
299 // Program builders have a bit of state we need to clear with each effect 299 // Program builders have a bit of state we need to clear with each effect
300 AutoStageAdvance adv(this); 300 AutoStageAdvance adv(this);
301 301
302 SkASSERT(!fXferProcessor); 302 SkASSERT(!fXferProcessor);
303 fXferProcessor = new GrGLInstalledXferProc; 303 fXferProcessor = new GrGLInstalledXferProc;
304 304
305 fXferProcessor->fGLProc.reset(xp.createGLInstance()); 305 fXferProcessor->fGLProc.reset(xp.createGLSLInstance());
306 306
307 // Enable dual source secondary output if we have one 307 // Enable dual source secondary output if we have one
308 if (xp.hasSecondaryOutput()) { 308 if (xp.hasSecondaryOutput()) {
309 fFS.enableSecondaryOutput(); 309 fFS.enableSecondaryOutput();
310 } 310 }
311 311
312 if (this->glslCaps()->mustDeclareFragmentShaderOutput()) { 312 if (this->glslCaps()->mustDeclareFragmentShaderOutput()) {
313 fFS.enableCustomOutput(); 313 fFS.enableCustomOutput();
314 } 314 }
315 315
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 } 536 }
537 537
538 //////////////////////////////////////////////////////////////////////////////// /////////////////// 538 //////////////////////////////////////////////////////////////////////////////// ///////////////////
539 539
540 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { 540 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() {
541 int numProcs = fProcs.count(); 541 int numProcs = fProcs.count();
542 for (int i = 0; i < numProcs; ++i) { 542 for (int i = 0; i < numProcs; ++i) {
543 delete fProcs[i]; 543 delete fProcs[i];
544 } 544 }
545 } 545 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgramDesc.cpp ('k') | src/gpu/glsl/GrGLSLFragmentShaderBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698