| OLD | NEW |
| 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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 fGeometryProcessor->fGLProc.reset(gp.getFactory().createGLInstance(gp)); |
| 363 fGeometryProcessor->fGLProc.reset(gp.getFactory().createGLInstance(gp, bt)); | |
| 364 | 363 |
| 365 SkSTArray<4, GrGLProcessor::TextureSampler> samplers(gp.numTextures()); | 364 SkSTArray<4, GrGLProcessor::TextureSampler> samplers(gp.numTextures()); |
| 366 this->emitSamplers(gp, &samplers, fGeometryProcessor); | 365 this->emitSamplers(gp, &samplers, fGeometryProcessor); |
| 367 | 366 |
| 368 GrGLGeometryProcessor::EmitArgs args(this, gp, bt, outColor, outCoverage, sa
mplers); | 367 GrGLGeometryProcessor::EmitArgs args(this, gp, outColor, outCoverage, sample
rs); |
| 369 fGeometryProcessor->fGLProc->emitCode(args); | 368 fGeometryProcessor->fGLProc->emitCode(args); |
| 370 | 369 |
| 371 // We have to check that effects and the code they emit are consistent, ie i
f an effect | 370 // 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 | 371 // asks for dst color, then the emit code needs to follow suit |
| 373 verify(gp); | 372 verify(gp); |
| 374 } | 373 } |
| 375 | 374 |
| 376 void GrGLProgramBuilder::verify(const GrGeometryProcessor& gp) { | 375 void GrGLProgramBuilder::verify(const GrGeometryProcessor& gp) { |
| 377 SkASSERT(fFS.hasReadFragmentPosition() == gp.willReadFragmentPosition()); | 376 SkASSERT(fFS.hasReadFragmentPosition() == gp.willReadFragmentPosition()); |
| 378 } | 377 } |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 } | 548 } |
| 550 | 549 |
| 551 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 550 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 552 | 551 |
| 553 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { | 552 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { |
| 554 int numProcs = fProcs.count(); | 553 int numProcs = fProcs.count(); |
| 555 for (int e = 0; e < numProcs; ++e) { | 554 for (int e = 0; e < numProcs; ++e) { |
| 556 SkDELETE(fProcs[e]); | 555 SkDELETE(fProcs[e]); |
| 557 } | 556 } |
| 558 } | 557 } |
| OLD | NEW |