| 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 | 9 |
| 10 #include "gl/GrGLGeometryProcessor.h" | 10 #include "gl/GrGLGeometryProcessor.h" |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 verify(fp); | 295 verify(fp); |
| 296 fFragmentProcessors->fProcs.push_back(ifp); | 296 fFragmentProcessors->fProcs.push_back(ifp); |
| 297 } | 297 } |
| 298 | 298 |
| 299 void GrGLProgramBuilder::emitAndInstallProc(const GrPrimitiveProcessor& gp, | 299 void GrGLProgramBuilder::emitAndInstallProc(const GrPrimitiveProcessor& gp, |
| 300 const char* outColor, | 300 const char* outColor, |
| 301 const char* outCoverage) { | 301 const char* outCoverage) { |
| 302 SkASSERT(!fGeometryProcessor); | 302 SkASSERT(!fGeometryProcessor); |
| 303 fGeometryProcessor = new GrGLInstalledGeoProc; | 303 fGeometryProcessor = new GrGLInstalledGeoProc; |
| 304 | 304 |
| 305 const GrBatchTracker& bt = this->batchTracker(); | 305 fGeometryProcessor->fGLProc.reset(gp.createGLInstance(*fGpu->glCaps().glslCa
ps())); |
| 306 fGeometryProcessor->fGLProc.reset(gp.createGLInstance(bt, *fGpu->glCaps().gl
slCaps())); | |
| 307 | 306 |
| 308 SkSTArray<4, GrGLProcessor::TextureSampler> samplers(gp.numTextures()); | 307 SkSTArray<4, GrGLProcessor::TextureSampler> samplers(gp.numTextures()); |
| 309 this->emitSamplers(gp, &samplers, fGeometryProcessor); | 308 this->emitSamplers(gp, &samplers, fGeometryProcessor); |
| 310 | 309 |
| 311 GrGLGeometryProcessor::EmitArgs args(this, gp, bt, outColor, outCoverage, sa
mplers, | 310 GrGLGeometryProcessor::EmitArgs args(this, gp, outColor, outCoverage, sample
rs, |
| 312 fCoordTransforms, &fOutCoords); | 311 fCoordTransforms, &fOutCoords); |
| 313 fGeometryProcessor->fGLProc->emitCode(args); | 312 fGeometryProcessor->fGLProc->emitCode(args); |
| 314 | 313 |
| 315 // We have to check that effects and the code they emit are consistent, ie i
f an effect | 314 // We have to check that effects and the code they emit are consistent, ie i
f an effect |
| 316 // asks for dst color, then the emit code needs to follow suit | 315 // asks for dst color, then the emit code needs to follow suit |
| 317 verify(gp); | 316 verify(gp); |
| 318 } | 317 } |
| 319 | 318 |
| 320 void GrGLProgramBuilder::emitAndInstallXferProc(const GrXferProcessor& xp, | 319 void GrGLProgramBuilder::emitAndInstallXferProc(const GrXferProcessor& xp, |
| 321 const GrGLSLExpr4& colorIn, | 320 const GrGLSLExpr4& colorIn, |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 } | 496 } |
| 498 | 497 |
| 499 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 498 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 500 | 499 |
| 501 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { | 500 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { |
| 502 int numProcs = fProcs.count(); | 501 int numProcs = fProcs.count(); |
| 503 for (int i = 0; i < numProcs; ++i) { | 502 for (int i = 0; i < numProcs; ++i) { |
| 504 delete fProcs[i]; | 503 delete fProcs[i]; |
| 505 } | 504 } |
| 506 } | 505 } |
| OLD | NEW |