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

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

Issue 778453002: Remove backend factories (Closed) Base URL: https://skia.googlesource.com/skia.git@unichoice
Patch Set: more clang warnings Created 6 years 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') | tests/GLProgramsTest.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 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 #include "gl/GrGLProgram.h" 9 #include "gl/GrGLProgram.h"
10 #include "gl/GrGLSLPrettyPrint.h" 10 #include "gl/GrGLSLPrettyPrint.h"
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 329
330 fFS.codeAppend("}"); 330 fFS.codeAppend("}");
331 } 331 }
332 332
333 void GrGLProgramBuilder::emitAndInstallProc(const GrPendingFragmentStage& fs, 333 void GrGLProgramBuilder::emitAndInstallProc(const GrPendingFragmentStage& fs,
334 const char* outColor, 334 const char* outColor,
335 const char* inColor) { 335 const char* inColor) {
336 GrGLInstalledFragProc* ifp = SkNEW(GrGLInstalledFragProc); 336 GrGLInstalledFragProc* ifp = SkNEW(GrGLInstalledFragProc);
337 337
338 const GrFragmentProcessor& fp = *fs.getProcessor(); 338 const GrFragmentProcessor& fp = *fs.getProcessor();
339 ifp->fGLProc.reset(fp.getFactory().createGLInstance(fp)); 339 ifp->fGLProc.reset(fp.createGLInstance());
340 340
341 SkSTArray<4, GrGLProcessor::TextureSampler> samplers(fp.numTextures()); 341 SkSTArray<4, GrGLProcessor::TextureSampler> samplers(fp.numTextures());
342 this->emitSamplers(fp, &samplers, ifp); 342 this->emitSamplers(fp, &samplers, ifp);
343 343
344 // Fragment processors can have coord transforms 344 // Fragment processors can have coord transforms
345 SkSTArray<2, GrGLProcessor::TransformedCoords> coords(fp.numTransforms()); 345 SkSTArray<2, GrGLProcessor::TransformedCoords> coords(fp.numTransforms());
346 this->emitTransforms(fs, &coords, ifp); 346 this->emitTransforms(fs, &coords, ifp);
347 347
348 ifp->fGLProc->emitCode(this, fp, outColor, inColor, coords, samplers); 348 ifp->fGLProc->emitCode(this, fp, outColor, inColor, coords, samplers);
349 349
350 // We have to check that effects and the code they emit are consistent, ie i f an effect 350 // We have to check that effects and the code they emit are consistent, ie i f an effect
351 // asks for dst color, then the emit code needs to follow suit 351 // asks for dst color, then the emit code needs to follow suit
352 verify(fp); 352 verify(fp);
353 fFragmentProcessors->fProcs.push_back(ifp); 353 fFragmentProcessors->fProcs.push_back(ifp);
354 } 354 }
355 355
356 void GrGLProgramBuilder::emitAndInstallProc(const GrGeometryProcessor& gp, 356 void GrGLProgramBuilder::emitAndInstallProc(const GrGeometryProcessor& gp,
357 const char* outColor, 357 const char* outColor,
358 const char* outCoverage) { 358 const char* outCoverage) {
359 SkASSERT(!fGeometryProcessor); 359 SkASSERT(!fGeometryProcessor);
360 fGeometryProcessor = SkNEW(GrGLInstalledGeoProc); 360 fGeometryProcessor = SkNEW(GrGLInstalledGeoProc);
361 361
362 const GrBatchTracker& bt = fOptState.getBatchTracker(); 362 const GrBatchTracker& bt = fOptState.getBatchTracker();
363 fGeometryProcessor->fGLProc.reset(gp.getFactory().createGLInstance(gp, bt)); 363 fGeometryProcessor->fGLProc.reset(gp.createGLInstance(bt));
364 364
365 SkSTArray<4, GrGLProcessor::TextureSampler> samplers(gp.numTextures()); 365 SkSTArray<4, GrGLProcessor::TextureSampler> samplers(gp.numTextures());
366 this->emitSamplers(gp, &samplers, fGeometryProcessor); 366 this->emitSamplers(gp, &samplers, fGeometryProcessor);
367 367
368 GrGLGeometryProcessor::EmitArgs args(this, gp, bt, outColor, outCoverage, sa mplers); 368 GrGLGeometryProcessor::EmitArgs args(this, gp, bt, outColor, outCoverage, sa mplers);
369 fGeometryProcessor->fGLProc->emitCode(args); 369 fGeometryProcessor->fGLProc->emitCode(args);
370 370
371 // We have to check that effects and the code they emit are consistent, ie i f an effect 371 // We have to check that effects and the code they emit are consistent, ie i f an effect
372 // asks for dst color, then the emit code needs to follow suit 372 // asks for dst color, then the emit code needs to follow suit
373 verify(gp); 373 verify(gp);
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 } 549 }
550 550
551 //////////////////////////////////////////////////////////////////////////////// /////////////////// 551 //////////////////////////////////////////////////////////////////////////////// ///////////////////
552 552
553 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { 553 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() {
554 int numProcs = fProcs.count(); 554 int numProcs = fProcs.count();
555 for (int e = 0; e < numProcs; ++e) { 555 for (int e = 0; e < numProcs; ++e) {
556 SkDELETE(fProcs[e]); 556 SkDELETE(fProcs[e]);
557 } 557 }
558 } 558 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgramDesc.cpp ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698