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 "GrRODrawState.h" | 8 #include "GrRODrawState.h" |
9 #include "GrDrawTargetCaps.h" | 9 #include "GrDrawTargetCaps.h" |
10 | 10 |
11 //////////////////////////////////////////////////////////////////////////////// | 11 //////////////////////////////////////////////////////////////////////////////// |
12 | 12 |
13 bool GrRODrawState::isEqual(const GrRODrawState& that) const { | 13 bool GrRODrawState::isEqual(const GrRODrawState& that) const { |
14 bool usingVertexColors = this->hasColorVertexAttribute(); | 14 bool usingVertexColors = this->hasColorVertexAttribute(); |
15 if (!usingVertexColors && this->fColor != that.fColor) { | 15 if (!usingVertexColors && this->fColor != that.fColor) { |
16 return false; | 16 return false; |
17 } | 17 } |
18 | 18 |
19 if (this->fRenderTarget.get() != that.fRenderTarget.get() || | 19 if (this->fRenderTarget.get() != that.fRenderTarget.get() || |
20 this->fColorStages.count() != that.fColorStages.count() || | 20 this->fColorStages.count() != that.fColorStages.count() || |
21 this->fCoverageStages.count() != that.fCoverageStages.count() || | 21 this->fCoverageStages.count() != that.fCoverageStages.count() || |
22 !this->fViewMatrix.cheapEqualTo(that.fViewMatrix) || | 22 !this->fViewMatrix.cheapEqualTo(that.fViewMatrix) || |
23 this->fSrcBlend != that.fSrcBlend || | 23 this->fSrcBlend != that.fSrcBlend || |
24 this->fDstBlend != that.fDstBlend || | 24 this->fDstBlend != that.fDstBlend || |
25 this->fBlendConstant != that.fBlendConstant || | 25 this->fBlendConstant != that.fBlendConstant || |
26 this->fFlagBits != that.fFlagBits || | 26 this->fFlagBits != that.fFlagBits || |
27 this->fVACount != that.fVACount || | 27 this->fVACount != that.fVACount || |
28 this->fVAStride != that.fVAStride || | |
29 memcmp(this->fVAPtr, that.fVAPtr, this->fVACount * sizeof(GrVertexAttrib
)) || | 28 memcmp(this->fVAPtr, that.fVAPtr, this->fVACount * sizeof(GrVertexAttrib
)) || |
30 this->fStencilSettings != that.fStencilSettings || | 29 this->fStencilSettings != that.fStencilSettings || |
31 this->fDrawFace != that.fDrawFace) { | 30 this->fDrawFace != that.fDrawFace) { |
32 return false; | 31 return false; |
33 } | 32 } |
34 | 33 |
35 bool usingVertexCoverage = this->hasCoverageVertexAttribute(); | 34 bool usingVertexCoverage = this->hasCoverageVertexAttribute(); |
36 if (!usingVertexCoverage && this->fCoverage != that.fCoverage) { | 35 if (!usingVertexCoverage && this->fCoverage != that.fCoverage) { |
37 return false; | 36 return false; |
38 } | 37 } |
39 | 38 |
40 bool explicitLocalCoords = this->hasLocalCoordAttribute(); | 39 bool explicitLocalCoords = this->hasLocalCoordAttribute(); |
41 for (int i = 0; i < this->numColorStages(); i++) { | 40 for (int i = 0; i < this->numColorStages(); i++) { |
42 if (!GrEffectStage::AreCompatible(this->getColorStage(i), that.getColorS
tage(i), | 41 if (!GrEffectStage::AreCompatible(this->getColorStage(i), that.getColorS
tage(i), |
43 explicitLocalCoords)) { | 42 explicitLocalCoords)) { |
44 return false; | 43 return false; |
45 } | 44 } |
46 } | 45 } |
47 for (int i = 0; i < this->numCoverageStages(); i++) { | 46 for (int i = 0; i < this->numCoverageStages(); i++) { |
48 if (!GrEffectStage::AreCompatible(this->getCoverageStage(i), that.getCov
erageStage(i), | 47 if (!GrEffectStage::AreCompatible(this->getCoverageStage(i), that.getCov
erageStage(i), |
49 explicitLocalCoords)) { | 48 explicitLocalCoords)) { |
50 return false; | 49 return false; |
51 } | 50 } |
52 } | 51 } |
53 | 52 |
| 53 SkASSERT(this->fVertexSize == that.fVertexSize); |
54 SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices, | 54 SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices, |
55 that.fFixedFunctionVertexAttribIndices, | 55 that.fFixedFunctionVertexAttribIndices, |
56 sizeof(this->fFixedFunctionVertexAttribIndices))); | 56 sizeof(this->fFixedFunctionVertexAttribIndices))); |
57 | 57 |
58 return true; | 58 return true; |
59 } | 59 } |
60 | 60 |
61 //////////////////////////////////////////////////////////////////////////////// | 61 //////////////////////////////////////////////////////////////////////////////// |
62 | 62 |
63 bool GrRODrawState::validateVertexAttribs() const { | 63 bool GrRODrawState::validateVertexAttribs() const { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 find that only 1, ISA, and ISC produce the correct destination when applied
to S' and D. | 158 find that only 1, ISA, and ISC produce the correct destination when applied
to S' and D. |
159 Also, if we're directly rendering coverage (isCoverageDrawing) then coverag
e is treated as | 159 Also, if we're directly rendering coverage (isCoverageDrawing) then coverag
e is treated as |
160 color by definition. | 160 color by definition. |
161 */ | 161 */ |
162 return kOne_GrBlendCoeff == fDstBlend || | 162 return kOne_GrBlendCoeff == fDstBlend || |
163 kISA_GrBlendCoeff == fDstBlend || | 163 kISA_GrBlendCoeff == fDstBlend || |
164 kISC_GrBlendCoeff == fDstBlend || | 164 kISC_GrBlendCoeff == fDstBlend || |
165 this->isCoverageDrawing(); | 165 this->isCoverageDrawing(); |
166 } | 166 } |
167 | 167 |
OLD | NEW |