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 // asks for dst color, then the emit code needs to follow suit | 352 // asks for dst color, then the emit code needs to follow suit |
353 verify(xp); | 353 verify(xp); |
354 fFS.codeAppend("}"); | 354 fFS.codeAppend("}"); |
355 } | 355 } |
356 | 356 |
357 void GrGLProgramBuilder::verify(const GrPrimitiveProcessor& gp) { | 357 void GrGLProgramBuilder::verify(const GrPrimitiveProcessor& gp) { |
358 SkASSERT(fFS.hasReadFragmentPosition() == gp.willReadFragmentPosition()); | 358 SkASSERT(fFS.hasReadFragmentPosition() == gp.willReadFragmentPosition()); |
359 } | 359 } |
360 | 360 |
361 void GrGLProgramBuilder::verify(const GrXferProcessor& xp) { | 361 void GrGLProgramBuilder::verify(const GrXferProcessor& xp) { |
362 // TODO: Once will readDst is only xp enable this assert and remove it from
the | 362 SkASSERT(fFS.hasReadDstColor() == xp.willReadDstColor()); |
363 // FragmentProcessor verify() | |
364 //SkASSERT(fFS.hasReadDstColor() == xp.willReadDstColor()); | |
365 } | 363 } |
366 | 364 |
367 void GrGLProgramBuilder::verify(const GrFragmentProcessor& fp) { | 365 void GrGLProgramBuilder::verify(const GrFragmentProcessor& fp) { |
368 SkASSERT(fFS.hasReadFragmentPosition() == fp.willReadFragmentPosition()); | 366 SkASSERT(fFS.hasReadFragmentPosition() == fp.willReadFragmentPosition()); |
369 SkASSERT(fFS.hasReadDstColor() == fp.willReadDstColor()); | |
370 } | 367 } |
371 | 368 |
372 template <class Proc> | 369 template <class Proc> |
373 void GrGLProgramBuilder::emitSamplers(const GrProcessor& processor, | 370 void GrGLProgramBuilder::emitSamplers(const GrProcessor& processor, |
374 GrGLProcessor::TextureSamplerArray* outSam
plers, | 371 GrGLProcessor::TextureSamplerArray* outSam
plers, |
375 GrGLInstalledProc<Proc>* ip) { | 372 GrGLInstalledProc<Proc>* ip) { |
376 int numTextures = processor.numTextures(); | 373 int numTextures = processor.numTextures(); |
377 ip->fSamplers.push_back_n(numTextures); | 374 ip->fSamplers.push_back_n(numTextures); |
378 SkString name; | 375 SkString name; |
379 for (int t = 0; t < numTextures; ++t) { | 376 for (int t = 0; t < numTextures; ++t) { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 } | 495 } |
499 | 496 |
500 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 497 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
501 | 498 |
502 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { | 499 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { |
503 int numProcs = fProcs.count(); | 500 int numProcs = fProcs.count(); |
504 for (int e = 0; e < numProcs; ++e) { | 501 for (int e = 0; e < numProcs; ++e) { |
505 SkDELETE(fProcs[e]); | 502 SkDELETE(fProcs[e]); |
506 } | 503 } |
507 } | 504 } |
OLD | NEW |