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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 const char* outColor, | 306 const char* outColor, |
307 const char* inColor) { | 307 const char* inColor) { |
308 SkASSERT(!fGeometryProcessor); | 308 SkASSERT(!fGeometryProcessor); |
309 fGeometryProcessor = SkNEW(GrGLInstalledGeoProc); | 309 fGeometryProcessor = SkNEW(GrGLInstalledGeoProc); |
310 | 310 |
311 fGeometryProcessor->fGLProc.reset(gp.getFactory().createGLInstance(gp)); | 311 fGeometryProcessor->fGLProc.reset(gp.getFactory().createGLInstance(gp)); |
312 | 312 |
313 SkSTArray<4, GrGLProcessor::TextureSampler> samplers(gp.numTextures()); | 313 SkSTArray<4, GrGLProcessor::TextureSampler> samplers(gp.numTextures()); |
314 this->emitSamplers(gp, &samplers, fGeometryProcessor); | 314 this->emitSamplers(gp, &samplers, fGeometryProcessor); |
315 | 315 |
316 SkSTArray<2, GrGLProcessor::TransformedCoords> coords; | 316 GrGLGeometryProcessor::EmitArgs args(this, gp, key, outColor, inColor, sampl
ers); |
317 | 317 fGeometryProcessor->fGLProc->emitCode(args); |
318 // TODO remove coords from emit code signature, probably best to use a struc
t here so these | |
319 // updates are less painful | |
320 fGeometryProcessor->fGLProc->emitCode(this, gp, key, outColor, inColor, coor
ds, samplers); | |
321 | 318 |
322 // We have to check that effects and the code they emit are consistent, ie i
f an effect | 319 // We have to check that effects and the code they emit are consistent, ie i
f an effect |
323 // asks for dst color, then the emit code needs to follow suit | 320 // asks for dst color, then the emit code needs to follow suit |
324 verify(gp); | 321 verify(gp); |
325 } | 322 } |
326 | 323 |
327 void GrGLProgramBuilder::verify(const GrGeometryProcessor& gp) { | 324 void GrGLProgramBuilder::verify(const GrGeometryProcessor& gp) { |
328 SkASSERT(fFS.hasReadFragmentPosition() == gp.willReadFragmentPosition()); | 325 SkASSERT(fFS.hasReadFragmentPosition() == gp.willReadFragmentPosition()); |
329 } | 326 } |
330 | 327 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 } | 503 } |
507 | 504 |
508 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 505 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
509 | 506 |
510 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { | 507 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { |
511 int numProcs = fProcs.count(); | 508 int numProcs = fProcs.count(); |
512 for (int e = 0; e < numProcs; ++e) { | 509 for (int e = 0; e < numProcs; ++e) { |
513 SkDELETE(fProcs[e]); | 510 SkDELETE(fProcs[e]); |
514 } | 511 } |
515 } | 512 } |
OLD | NEW |