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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 verify(fp); | 358 verify(fp); |
359 fFragmentProcessors->fProcs.push_back(ifp); | 359 fFragmentProcessors->fProcs.push_back(ifp); |
360 } | 360 } |
361 | 361 |
362 void GrGLProgramBuilder::emitAndInstallProc(const GrGeometryProcessor& gp, | 362 void GrGLProgramBuilder::emitAndInstallProc(const GrGeometryProcessor& gp, |
363 const char* outColor, | 363 const char* outColor, |
364 const char* outCoverage) { | 364 const char* outCoverage) { |
365 SkASSERT(!fGeometryProcessor); | 365 SkASSERT(!fGeometryProcessor); |
366 fGeometryProcessor = SkNEW(GrGLInstalledGeoProc); | 366 fGeometryProcessor = SkNEW(GrGLInstalledGeoProc); |
367 | 367 |
368 fGeometryProcessor->fGLProc.reset(gp.getFactory().createGLInstance(gp)); | 368 const GrBatchTracker& bt = fOptState.getBatchTracker(); |
| 369 fGeometryProcessor->fGLProc.reset(gp.getFactory().createGLInstance(gp, bt)); |
369 | 370 |
370 SkSTArray<4, GrGLProcessor::TextureSampler> samplers(gp.numTextures()); | 371 SkSTArray<4, GrGLProcessor::TextureSampler> samplers(gp.numTextures()); |
371 this->emitSamplers(gp, &samplers, fGeometryProcessor); | 372 this->emitSamplers(gp, &samplers, fGeometryProcessor); |
372 | 373 |
373 GrGLGeometryProcessor::EmitArgs args(this, gp, outColor, outCoverage, sample
rs); | 374 GrGLGeometryProcessor::EmitArgs args(this, gp, bt, outColor, outCoverage, sa
mplers); |
374 fGeometryProcessor->fGLProc->emitCode(args); | 375 fGeometryProcessor->fGLProc->emitCode(args); |
375 | 376 |
376 // We have to check that effects and the code they emit are consistent, ie i
f an effect | 377 // We have to check that effects and the code they emit are consistent, ie i
f an effect |
377 // asks for dst color, then the emit code needs to follow suit | 378 // asks for dst color, then the emit code needs to follow suit |
378 verify(gp); | 379 verify(gp); |
379 } | 380 } |
380 | 381 |
381 void GrGLProgramBuilder::verify(const GrGeometryProcessor& gp) { | 382 void GrGLProgramBuilder::verify(const GrGeometryProcessor& gp) { |
382 SkASSERT(fFS.hasReadFragmentPosition() == gp.willReadFragmentPosition()); | 383 SkASSERT(fFS.hasReadFragmentPosition() == gp.willReadFragmentPosition()); |
383 } | 384 } |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 } | 555 } |
555 | 556 |
556 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 557 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
557 | 558 |
558 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { | 559 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { |
559 int numProcs = fProcs.count(); | 560 int numProcs = fProcs.count(); |
560 for (int e = 0; e < numProcs; ++e) { | 561 for (int e = 0; e < numProcs; ++e) { |
561 SkDELETE(fProcs[e]); | 562 SkDELETE(fProcs[e]); |
562 } | 563 } |
563 } | 564 } |
OLD | NEW |