OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #ifndef GrDrawState_DEFINED | 8 #ifndef GrDrawState_DEFINED |
9 #define GrDrawState_DEFINED | 9 #define GrDrawState_DEFINED |
10 | 10 |
11 | 11 #include "GrBatch.h" |
12 #include "GrBlend.h" | 12 #include "GrBlend.h" |
13 #include "GrDrawTargetCaps.h" | 13 #include "GrDrawTargetCaps.h" |
14 #include "GrGeometryProcessor.h" | 14 #include "GrGeometryProcessor.h" |
15 #include "GrGpuResourceRef.h" | 15 #include "GrGpuResourceRef.h" |
16 #include "GrFragmentStage.h" | 16 #include "GrFragmentStage.h" |
17 #include "GrProcOptInfo.h" | 17 #include "GrProcOptInfo.h" |
18 #include "GrRenderTarget.h" | 18 #include "GrRenderTarget.h" |
19 #include "GrStencil.h" | 19 #include "GrStencil.h" |
20 #include "GrXferProcessor.h" | 20 #include "GrXferProcessor.h" |
21 #include "SkMatrix.h" | 21 #include "SkMatrix.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 const GrXPFactory* getXPFactory() const { return fXPFactory.get(); } | 105 const GrXPFactory* getXPFactory() const { return fXPFactory.get(); } |
106 | 106 |
107 const GrFragmentStage& getColorStage(int idx) const { return fColorStages[id x]; } | 107 const GrFragmentStage& getColorStage(int idx) const { return fColorStages[id x]; } |
108 const GrFragmentStage& getCoverageStage(int idx) const { return fCoverageSta ges[idx]; } | 108 const GrFragmentStage& getCoverageStage(int idx) const { return fCoverageSta ges[idx]; } |
109 | 109 |
110 /** | 110 /** |
111 * Checks whether any of the effects will read the dst pixel color. | 111 * Checks whether any of the effects will read the dst pixel color. |
112 * TODO remove when we have an XP | 112 * TODO remove when we have an XP |
113 */ | 113 */ |
114 bool willEffectReadDstColor(const GrPrimitiveProcessor*) const; | 114 bool willEffectReadDstColor(const GrPrimitiveProcessor*) const; |
115 bool willEffectReadDstColor(const GrBatch*) const; | |
115 | 116 |
116 /** | 117 /** |
117 * The xfer processor factory. | 118 * The xfer processor factory. |
118 */ | 119 */ |
119 const GrXPFactory* setXPFactory(const GrXPFactory* xpFactory) { | 120 const GrXPFactory* setXPFactory(const GrXPFactory* xpFactory) { |
120 fXPFactory.reset(SkRef(xpFactory)); | 121 fXPFactory.reset(SkRef(xpFactory)); |
121 return xpFactory; | 122 return xpFactory; |
122 } | 123 } |
123 | 124 |
124 void setPorterDuffXPFactory(SkXfermode::Mode mode) { | 125 void setPorterDuffXPFactory(SkXfermode::Mode mode) { |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
399 | 400 |
400 /// @} | 401 /// @} |
401 | 402 |
402 /////////////////////////////////////////////////////////////////////////// | 403 /////////////////////////////////////////////////////////////////////////// |
403 | 404 |
404 GrDrawState& operator= (const GrDrawState& that); | 405 GrDrawState& operator= (const GrDrawState& that); |
405 | 406 |
406 private: | 407 private: |
407 bool isEqual(const GrDrawState& that, bool explicitLocalCoords) const; | 408 bool isEqual(const GrDrawState& that, bool explicitLocalCoords) const; |
408 | 409 |
410 // TODO delete when we have Batch | |
409 const GrProcOptInfo& colorProcInfo(const GrPrimitiveProcessor* pp) const { | 411 const GrProcOptInfo& colorProcInfo(const GrPrimitiveProcessor* pp) const { |
410 this->calcColorInvariantOutput(pp); | 412 this->calcColorInvariantOutput(pp); |
411 return fColorProcInfo; | 413 return fColorProcInfo; |
412 } | 414 } |
413 | 415 |
414 const GrProcOptInfo& coverageProcInfo(const GrPrimitiveProcessor* pp) const { | 416 const GrProcOptInfo& coverageProcInfo(const GrPrimitiveProcessor* pp) const { |
415 this->calcCoverageInvariantOutput(pp); | 417 this->calcCoverageInvariantOutput(pp); |
416 return fCoverageProcInfo; | 418 return fCoverageProcInfo; |
417 } | 419 } |
418 | 420 |
421 const GrProcOptInfo& colorProcInfo(const GrBatch* batch) const { | |
422 this->calcColorInvariantOutput(batch); | |
423 return fColorProcInfo; | |
424 } | |
425 | |
426 const GrProcOptInfo& coverageProcInfo(const GrBatch* batch) const { | |
427 this->calcCoverageInvariantOutput(batch); | |
428 return fCoverageProcInfo; | |
429 } | |
430 | |
419 /** | 431 /** |
420 * If fColorProcInfoValid is false, function calculates the invariant output for the color | 432 * Primproc variants of the calc functions |
421 * stages and results are stored in fColorProcInfo. | 433 * TODO remove these when batch is everywhere |
422 */ | 434 */ |
423 void calcColorInvariantOutput(const GrPrimitiveProcessor*) const; | 435 void calcColorInvariantOutput(const GrPrimitiveProcessor*) const; |
424 | |
425 /** | |
426 * If fCoverageProcInfoValid is false, function calculates the invariant out put for the coverage | |
427 * stages and results are stored in fCoverageProcInfo. | |
428 */ | |
429 void calcCoverageInvariantOutput(const GrPrimitiveProcessor*) const; | 436 void calcCoverageInvariantOutput(const GrPrimitiveProcessor*) const; |
430 | 437 |
431 /** | 438 /** |
439 * GrBatch provides the initial seed for these loops based off of the batch it starts with | |
bsalomon
2015/01/20 16:14:02
based off of the ... it starts with.
data?
primit
| |
440 */ | |
441 void calcColorInvariantOutput(const GrBatch*) const; | |
442 void calcCoverageInvariantOutput(const GrBatch*) const; | |
443 | |
444 /** | |
432 * If fColorProcInfoValid is false, function calculates the invariant output for the color | 445 * If fColorProcInfoValid is false, function calculates the invariant output for the color |
433 * stages and results are stored in fColorProcInfo. | 446 * stages and results are stored in fColorProcInfo. |
434 */ | 447 */ |
435 void calcColorInvariantOutput(GrColor) const; | 448 void calcColorInvariantOutput(GrColor) const; |
436 | 449 |
437 /** | 450 /** |
438 * If fCoverageProcInfoValid is false, function calculates the invariant out put for the coverage | 451 * If fCoverageProcInfoValid is false, function calculates the invariant out put for the coverage |
439 * stages and results are stored in fCoverageProcInfo. | 452 * stages and results are stored in fCoverageProcInfo. |
440 */ | 453 */ |
441 void calcCoverageInvariantOutput(GrColor) const; | 454 void calcCoverageInvariantOutput(GrColor) const; |
(...skipping 13 matching lines...) Expand all Loading... | |
455 SkAutoTUnref<const GrXPFactory> fXPFactory; | 468 SkAutoTUnref<const GrXPFactory> fXPFactory; |
456 FragmentStageArray fColorStages; | 469 FragmentStageArray fColorStages; |
457 FragmentStageArray fCoverageStages; | 470 FragmentStageArray fCoverageStages; |
458 | 471 |
459 mutable GrProcOptInfo fColorProcInfo; | 472 mutable GrProcOptInfo fColorProcInfo; |
460 mutable GrProcOptInfo fCoverageProcInfo; | 473 mutable GrProcOptInfo fCoverageProcInfo; |
461 mutable bool fColorProcInfoValid; | 474 mutable bool fColorProcInfoValid; |
462 mutable bool fCoverageProcInfoValid; | 475 mutable bool fCoverageProcInfoValid; |
463 mutable GrColor fColorCache; | 476 mutable GrColor fColorCache; |
464 mutable GrColor fCoverageCache; | 477 mutable GrColor fCoverageCache; |
478 // TODO delete when batch is everywhere | |
465 mutable const GrPrimitiveProcessor* fColorPrimProc; | 479 mutable const GrPrimitiveProcessor* fColorPrimProc; |
466 mutable const GrPrimitiveProcessor* fCoveragePrimProc; | 480 mutable const GrPrimitiveProcessor* fCoveragePrimProc; |
481 mutable const GrBatch* fColorBatch; | |
bsalomon
2015/01/20 16:14:02
color and coverage batches?
| |
482 mutable const GrBatch* fCoverageBatch; | |
467 | 483 |
468 friend class GrOptDrawState; | 484 friend class GrOptDrawState; |
469 }; | 485 }; |
470 | 486 |
471 #endif | 487 #endif |
OLD | NEW |