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 "GrOptDrawState.h" | 8 #include "GrOptDrawState.h" |
9 | 9 |
10 #include "GrDrawState.h" | 10 #include "GrDrawState.h" |
11 #include "GrDrawTargetCaps.h" | 11 #include "GrDrawTargetCaps.h" |
12 #include "GrGpu.h" | 12 #include "GrGpu.h" |
13 #include "GrProcOptInfo.h" | 13 #include "GrProcOptInfo.h" |
14 | 14 |
15 GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, | 15 GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, |
16 GrGpu* gpu, | 16 const GrDrawTargetCaps& caps, |
17 const ScissorState& scissorState, | 17 const ScissorState& scissorState, |
18 const GrDeviceCoordTexture* dstCopy, | 18 const GrDeviceCoordTexture* dstCopy, |
19 GrGpu::DrawType drawType) { | 19 GrGpu::DrawType drawType) |
20 | 20 : fFinalized(false) { |
| 21 fDrawType = drawType; |
21 GrBlendCoeff optSrcCoeff; | 22 GrBlendCoeff optSrcCoeff; |
22 GrBlendCoeff optDstCoeff; | 23 GrBlendCoeff optDstCoeff; |
23 GrDrawState::BlendOpt blendOpt = drawState.getBlendOpt(false, &optSrcCoeff,
&optDstCoeff); | 24 GrDrawState::BlendOpt blendOpt = drawState.getBlendOpt(false, &optSrcCoeff,
&optDstCoeff); |
24 | 25 |
25 // When path rendering the stencil settings are not always set on the draw s
tate | 26 // When path rendering the stencil settings are not always set on the draw s
tate |
26 // so we must check the draw type. In cases where we will skip drawing we si
mply return a | 27 // so we must check the draw type. In cases where we will skip drawing we si
mply return a |
27 // null GrOptDrawState. | 28 // null GrOptDrawState. |
28 if (GrDrawState::kSkipDraw_BlendOpt == blendOpt && GrGpu::kStencilPath_DrawT
ype != drawType) { | 29 if (GrDrawState::kSkipDraw_BlendOpt == blendOpt && GrGpu::kStencilPath_DrawT
ype != drawType) { |
29 // Set the fields that don't default init and return. The lack of a rend
er target will | 30 // Set the fields that don't default init and return. The lack of a rend
er target will |
30 // indicate that this can be skipped. | 31 // indicate that this can be skipped. |
(...skipping 14 matching lines...) Expand all Loading... |
45 fStencilSettings = drawState.getStencil(); | 46 fStencilSettings = drawState.getStencil(); |
46 fDrawFace = drawState.getDrawFace(); | 47 fDrawFace = drawState.getDrawFace(); |
47 fSrcBlend = optSrcCoeff; | 48 fSrcBlend = optSrcCoeff; |
48 fDstBlend = optDstCoeff; | 49 fDstBlend = optDstCoeff; |
49 | 50 |
50 // TODO move this out of optDrawState | 51 // TODO move this out of optDrawState |
51 if (dstCopy) { | 52 if (dstCopy) { |
52 fDstCopy = *dstCopy; | 53 fDstCopy = *dstCopy; |
53 } | 54 } |
54 | 55 |
55 GrProgramDesc::DescInfo descInfo; | |
56 | |
57 fFlags = 0; | 56 fFlags = 0; |
58 if (drawState.isHWAntialias()) { | 57 if (drawState.isHWAntialias()) { |
59 fFlags |= kHWAA_Flag; | 58 fFlags |= kHWAA_Flag; |
60 } | 59 } |
61 if (drawState.isColorWriteDisabled()) { | 60 if (drawState.isColorWriteDisabled()) { |
62 fFlags |= kDisableColorWrite_Flag; | 61 fFlags |= kDisableColorWrite_Flag; |
63 } | 62 } |
64 if (drawState.isDither()) { | 63 if (drawState.isDither()) { |
65 fFlags |= kDither_Flag; | 64 fFlags |= kDither_Flag; |
66 } | 65 } |
67 | 66 |
68 descInfo.fHasVertexColor = drawState.hasGeometryProcessor() && | 67 fDescInfo.fHasVertexColor = drawState.hasGeometryProcessor() && |
69 drawState.getGeometryProcessor()->hasVertexColor(
); | 68 drawState.getGeometryProcessor()->hasVertexColor
(); |
70 | 69 |
71 descInfo.fHasVertexCoverage = drawState.hasGeometryProcessor() && | 70 fDescInfo.fHasVertexCoverage = drawState.hasGeometryProcessor() && |
72 drawState.getGeometryProcessor()->hasVertexCove
rage(); | 71 drawState.getGeometryProcessor()->hasVertexCo
verage(); |
73 | 72 |
74 bool hasLocalCoords = drawState.hasGeometryProcessor() && | 73 bool hasLocalCoords = drawState.hasGeometryProcessor() && |
75 drawState.getGeometryProcessor()->hasLocalCoords(); | 74 drawState.getGeometryProcessor()->hasLocalCoords(); |
76 | 75 |
77 const GrProcOptInfo& colorPOI = drawState.colorProcInfo(); | 76 const GrProcOptInfo& colorPOI = drawState.colorProcInfo(); |
78 int firstColorStageIdx = colorPOI.firstEffectiveStageIndex(); | 77 int firstColorStageIdx = colorPOI.firstEffectiveStageIndex(); |
79 descInfo.fInputColorIsUsed = colorPOI.inputColorIsUsed(); | 78 fDescInfo.fInputColorIsUsed = colorPOI.inputColorIsUsed(); |
80 fColor = colorPOI.inputColorToEffectiveStage(); | 79 fColor = colorPOI.inputColorToEffectiveStage(); |
81 if (colorPOI.removeVertexAttrib()) { | 80 if (colorPOI.removeVertexAttrib()) { |
82 descInfo.fHasVertexColor = false; | 81 fDescInfo.fHasVertexColor = false; |
83 } | 82 } |
84 | 83 |
85 // TODO: Once we can handle single or four channel input into coverage stage
s then we can use | 84 // TODO: Once we can handle single or four channel input into coverage stage
s then we can use |
86 // drawState's coverageProcInfo (like color above) to set this initial infor
mation. | 85 // drawState's coverageProcInfo (like color above) to set this initial infor
mation. |
87 int firstCoverageStageIdx = 0; | 86 int firstCoverageStageIdx = 0; |
88 descInfo.fInputCoverageIsUsed = true; | 87 fDescInfo.fInputCoverageIsUsed = true; |
89 fCoverage = drawState.getCoverage(); | 88 fCoverage = drawState.getCoverage(); |
90 | 89 |
91 this->adjustProgramForBlendOpt(drawState, blendOpt, &descInfo, &firstColorSt
ageIdx, | 90 this->adjustProgramForBlendOpt(drawState, blendOpt, &firstColorStageIdx, |
92 &firstCoverageStageIdx); | 91 &firstCoverageStageIdx); |
93 | 92 |
94 this->getStageStats(drawState, firstColorStageIdx, firstCoverageStageIdx, ha
sLocalCoords, | 93 this->getStageStats(drawState, firstColorStageIdx, firstCoverageStageIdx, ha
sLocalCoords); |
95 &descInfo); | |
96 | 94 |
97 // Copy GeometryProcesssor from DS or ODS | 95 // Copy GeometryProcesssor from DS or ODS |
98 SkASSERT(GrGpu::IsPathRenderingDrawType(drawType) || | 96 SkASSERT(GrGpu::IsPathRenderingDrawType(drawType) || |
99 GrGpu::kStencilPath_DrawType || | 97 GrGpu::kStencilPath_DrawType || |
100 drawState.hasGeometryProcessor()); | 98 drawState.hasGeometryProcessor()); |
101 fGeometryProcessor.reset(drawState.getGeometryProcessor()); | 99 fGeometryProcessor.reset(drawState.getGeometryProcessor()); |
102 | 100 |
103 // Create XferProcessor from DS's XPFactory | 101 // Create XferProcessor from DS's XPFactory |
104 const GrXferProcessor* xpProcessor = drawState.getXPFactory()->createXferPro
cessor(); | 102 const GrXferProcessor* xpProcessor = drawState.getXPFactory()->createXferPro
cessor(); |
105 fXferProcessor.reset(xpProcessor); | 103 fXferProcessor.reset(xpProcessor); |
106 xpProcessor->unref(); | 104 xpProcessor->unref(); |
107 | 105 |
108 // Copy Stages from DS to ODS | 106 // Copy Stages from DS to ODS |
109 for (int i = firstColorStageIdx; i < drawState.numColorStages(); ++i) { | 107 for (int i = firstColorStageIdx; i < drawState.numColorStages(); ++i) { |
110 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, | 108 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, |
111 GrPendingFragmentStage, | 109 GrPendingFragmentStage, |
112 (drawState.fColorStages[i], hasLocalCoords)); | 110 (drawState.fColorStages[i], hasLocalCoords)); |
113 } | 111 } |
114 fNumColorStages = fFragmentStages.count(); | 112 fNumColorStages = fFragmentStages.count(); |
115 for (int i = firstCoverageStageIdx; i < drawState.numCoverageStages(); ++i)
{ | 113 for (int i = firstCoverageStageIdx; i < drawState.numCoverageStages(); ++i)
{ |
116 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, | 114 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, |
117 GrPendingFragmentStage, | 115 GrPendingFragmentStage, |
118 (drawState.fCoverageStages[i], hasLocalCoords)); | 116 (drawState.fCoverageStages[i], hasLocalCoords)); |
119 } | 117 } |
120 | 118 |
121 this->setOutputStateInfo(drawState, blendOpt, *gpu->caps(), &descInfo); | 119 this->setOutputStateInfo(drawState, blendOpt, caps); |
122 | |
123 // now create a key | |
124 gpu->buildProgramDesc(*this, descInfo, drawType, &fDesc); | |
125 }; | 120 }; |
126 | 121 |
127 void GrOptDrawState::setOutputStateInfo(const GrDrawState& ds, | 122 void GrOptDrawState::setOutputStateInfo(const GrDrawState& ds, |
128 GrDrawState::BlendOpt blendOpt, | 123 GrDrawState::BlendOpt blendOpt, |
129 const GrDrawTargetCaps& caps, | 124 const GrDrawTargetCaps& caps) { |
130 GrProgramDesc::DescInfo* descInfo) { | |
131 // Set this default and then possibly change our mind if there is coverage. | 125 // Set this default and then possibly change our mind if there is coverage. |
132 descInfo->fPrimaryOutputType = GrProgramDesc::kModulate_PrimaryOutputType; | 126 fDescInfo.fPrimaryOutputType = GrProgramDesc::kModulate_PrimaryOutputType; |
133 descInfo->fSecondaryOutputType = GrProgramDesc::kNone_SecondaryOutputType; | 127 fDescInfo.fSecondaryOutputType = GrProgramDesc::kNone_SecondaryOutputType; |
134 | 128 |
135 // Determine whether we should use dual source blending or shader code to ke
ep coverage | 129 // Determine whether we should use dual source blending or shader code to ke
ep coverage |
136 // separate from color. | 130 // separate from color. |
137 bool keepCoverageSeparate = !(GrDrawState::kCoverageAsAlpha_BlendOpt == blen
dOpt || | 131 bool keepCoverageSeparate = !(GrDrawState::kCoverageAsAlpha_BlendOpt == blen
dOpt || |
138 GrDrawState::kEmitCoverage_BlendOpt == blendOp
t); | 132 GrDrawState::kEmitCoverage_BlendOpt == blendOp
t); |
139 if (keepCoverageSeparate && !ds.hasSolidCoverage()) { | 133 if (keepCoverageSeparate && !ds.hasSolidCoverage()) { |
140 if (caps.dualSourceBlendingSupport()) { | 134 if (caps.dualSourceBlendingSupport()) { |
141 if (kZero_GrBlendCoeff == fDstBlend) { | 135 if (kZero_GrBlendCoeff == fDstBlend) { |
142 // write the coverage value to second color | 136 // write the coverage value to second color |
143 descInfo->fSecondaryOutputType = GrProgramDesc::kCoverage_Second
aryOutputType; | 137 fDescInfo.fSecondaryOutputType = GrProgramDesc::kCoverage_Second
aryOutputType; |
144 fDstBlend = (GrBlendCoeff)GrGpu::kIS2C_GrBlendCoeff; | 138 fDstBlend = (GrBlendCoeff)GrGpu::kIS2C_GrBlendCoeff; |
145 } else if (kSA_GrBlendCoeff == fDstBlend) { | 139 } else if (kSA_GrBlendCoeff == fDstBlend) { |
146 // SA dst coeff becomes 1-(1-SA)*coverage when dst is partially
covered. | 140 // SA dst coeff becomes 1-(1-SA)*coverage when dst is partially
covered. |
147 descInfo->fSecondaryOutputType = GrProgramDesc::kCoverageISA_Sec
ondaryOutputType; | 141 fDescInfo.fSecondaryOutputType = GrProgramDesc::kCoverageISA_Sec
ondaryOutputType; |
148 fDstBlend = (GrBlendCoeff)GrGpu::kIS2C_GrBlendCoeff; | 142 fDstBlend = (GrBlendCoeff)GrGpu::kIS2C_GrBlendCoeff; |
149 } else if (kSC_GrBlendCoeff == fDstBlend) { | 143 } else if (kSC_GrBlendCoeff == fDstBlend) { |
150 // SA dst coeff becomes 1-(1-SA)*coverage when dst is partially
covered. | 144 // SA dst coeff becomes 1-(1-SA)*coverage when dst is partially
covered. |
151 descInfo->fSecondaryOutputType = GrProgramDesc::kCoverageISC_Sec
ondaryOutputType; | 145 fDescInfo.fSecondaryOutputType = GrProgramDesc::kCoverageISC_Sec
ondaryOutputType; |
152 fDstBlend = (GrBlendCoeff)GrGpu::kIS2C_GrBlendCoeff; | 146 fDstBlend = (GrBlendCoeff)GrGpu::kIS2C_GrBlendCoeff; |
153 } | 147 } |
154 } else if (descInfo->fReadsDst && | 148 } else if (fDescInfo.fReadsDst && |
155 kOne_GrBlendCoeff == fSrcBlend && | 149 kOne_GrBlendCoeff == fSrcBlend && |
156 kZero_GrBlendCoeff == fDstBlend) { | 150 kZero_GrBlendCoeff == fDstBlend) { |
157 descInfo->fPrimaryOutputType = GrProgramDesc::kCombineWithDst_Primar
yOutputType; | 151 fDescInfo.fPrimaryOutputType = GrProgramDesc::kCombineWithDst_Primar
yOutputType; |
158 } | 152 } |
159 } | 153 } |
160 } | 154 } |
161 | 155 |
162 void GrOptDrawState::adjustProgramForBlendOpt(const GrDrawState& ds, | 156 void GrOptDrawState::adjustProgramForBlendOpt(const GrDrawState& ds, |
163 GrDrawState::BlendOpt blendOpt, | 157 GrDrawState::BlendOpt blendOpt, |
164 GrProgramDesc::DescInfo* descInfo, | |
165 int* firstColorStageIdx, | 158 int* firstColorStageIdx, |
166 int* firstCoverageStageIdx) { | 159 int* firstCoverageStageIdx) { |
167 switch (blendOpt) { | 160 switch (blendOpt) { |
168 case GrDrawState::kNone_BlendOpt: | 161 case GrDrawState::kNone_BlendOpt: |
169 case GrDrawState::kSkipDraw_BlendOpt: | 162 case GrDrawState::kSkipDraw_BlendOpt: |
170 case GrDrawState::kCoverageAsAlpha_BlendOpt: | 163 case GrDrawState::kCoverageAsAlpha_BlendOpt: |
171 break; | 164 break; |
172 case GrDrawState::kEmitCoverage_BlendOpt: | 165 case GrDrawState::kEmitCoverage_BlendOpt: |
173 fColor = 0xffffffff; | 166 fColor = 0xffffffff; |
174 descInfo->fInputColorIsUsed = true; | 167 fDescInfo.fInputColorIsUsed = true; |
175 *firstColorStageIdx = ds.numColorStages(); | 168 *firstColorStageIdx = ds.numColorStages(); |
176 descInfo->fHasVertexColor = false; | 169 fDescInfo.fHasVertexColor = false; |
177 break; | 170 break; |
178 case GrDrawState::kEmitTransBlack_BlendOpt: | 171 case GrDrawState::kEmitTransBlack_BlendOpt: |
179 fColor = 0; | 172 fColor = 0; |
180 fCoverage = 0xff; | 173 fCoverage = 0xff; |
181 descInfo->fInputColorIsUsed = true; | 174 fDescInfo.fInputColorIsUsed = true; |
182 descInfo->fInputCoverageIsUsed = true; | 175 fDescInfo.fInputCoverageIsUsed = true; |
183 *firstColorStageIdx = ds.numColorStages(); | 176 *firstColorStageIdx = ds.numColorStages(); |
184 *firstCoverageStageIdx = ds.numCoverageStages(); | 177 *firstCoverageStageIdx = ds.numCoverageStages(); |
185 descInfo->fHasVertexColor = false; | 178 fDescInfo.fHasVertexColor = false; |
186 descInfo->fHasVertexCoverage = false; | 179 fDescInfo.fHasVertexCoverage = false; |
187 break; | 180 break; |
188 } | 181 } |
189 } | 182 } |
190 | 183 |
191 static void get_stage_stats(const GrFragmentStage& stage, bool* readsDst, bool*
readsFragPosition) { | 184 static void get_stage_stats(const GrFragmentStage& stage, bool* readsDst, bool*
readsFragPosition) { |
192 if (stage.getProcessor()->willReadDstColor()) { | 185 if (stage.getProcessor()->willReadDstColor()) { |
193 *readsDst = true; | 186 *readsDst = true; |
194 } | 187 } |
195 if (stage.getProcessor()->willReadFragmentPosition()) { | 188 if (stage.getProcessor()->willReadFragmentPosition()) { |
196 *readsFragPosition = true; | 189 *readsFragPosition = true; |
197 } | 190 } |
198 } | 191 } |
199 | 192 |
200 void GrOptDrawState::getStageStats(const GrDrawState& ds, int firstColorStageIdx
, | 193 void GrOptDrawState::getStageStats(const GrDrawState& ds, int firstColorStageIdx
, |
201 int firstCoverageStageIdx, bool hasLocalCoord
s, | 194 int firstCoverageStageIdx, bool hasLocalCoord
s) { |
202 GrProgramDesc::DescInfo* descInfo) { | |
203 // We will need a local coord attrib if there is one currently set on the op
tState and we are | 195 // We will need a local coord attrib if there is one currently set on the op
tState and we are |
204 // actually generating some effect code | 196 // actually generating some effect code |
205 descInfo->fRequiresLocalCoordAttrib = hasLocalCoords && | 197 fDescInfo.fRequiresLocalCoordAttrib = hasLocalCoords && |
206 ds.numTotalStages() - firstColorStageIdx - firstCoverageStageIdx > 0; | 198 ds.numTotalStages() - firstColorStageIdx - firstCoverageStageIdx > 0; |
207 | 199 |
208 descInfo->fReadsDst = false; | 200 fDescInfo.fReadsDst = false; |
209 descInfo->fReadsFragPosition = false; | 201 fDescInfo.fReadsFragPosition = false; |
210 | 202 |
211 for (int s = firstColorStageIdx; s < ds.numColorStages(); ++s) { | 203 for (int s = firstColorStageIdx; s < ds.numColorStages(); ++s) { |
212 const GrFragmentStage& stage = ds.getColorStage(s); | 204 const GrFragmentStage& stage = ds.getColorStage(s); |
213 get_stage_stats(stage, &descInfo->fReadsDst, &descInfo->fReadsFragPositi
on); | 205 get_stage_stats(stage, &fDescInfo.fReadsDst, &fDescInfo.fReadsFragPositi
on); |
214 } | 206 } |
215 for (int s = firstCoverageStageIdx; s < ds.numCoverageStages(); ++s) { | 207 for (int s = firstCoverageStageIdx; s < ds.numCoverageStages(); ++s) { |
216 const GrFragmentStage& stage = ds.getCoverageStage(s); | 208 const GrFragmentStage& stage = ds.getCoverageStage(s); |
217 get_stage_stats(stage, &descInfo->fReadsDst, &descInfo->fReadsFragPositi
on); | 209 get_stage_stats(stage, &fDescInfo.fReadsDst, &fDescInfo.fReadsFragPositi
on); |
218 } | 210 } |
219 if (ds.hasGeometryProcessor()) { | 211 if (ds.hasGeometryProcessor()) { |
220 const GrGeometryProcessor& gp = *ds.getGeometryProcessor(); | 212 const GrGeometryProcessor& gp = *ds.getGeometryProcessor(); |
221 descInfo->fReadsFragPosition = descInfo->fReadsFragPosition || gp.willRe
adFragmentPosition(); | 213 fDescInfo.fReadsFragPosition = fDescInfo.fReadsFragPosition || gp.willRe
adFragmentPosition(); |
222 } | 214 } |
223 } | 215 } |
224 | 216 |
| 217 void GrOptDrawState::finalize(GrGpu* gpu) { |
| 218 gpu->buildProgramDesc(*this, fDescInfo, fDrawType, &fDesc); |
| 219 fFinalized = true; |
| 220 } |
| 221 |
225 //////////////////////////////////////////////////////////////////////////////// | 222 //////////////////////////////////////////////////////////////////////////////// |
226 | 223 |
227 bool GrOptDrawState::operator== (const GrOptDrawState& that) const { | 224 bool GrOptDrawState::operator== (const GrOptDrawState& that) const { |
228 if (this->fDesc != that.fDesc) { | 225 if (fDescInfo != that.fDescInfo) { |
229 return false; | 226 return false; |
230 } | 227 } |
231 bool hasVertexColors = this->fDesc.header().fColorInput == GrProgramDesc::kA
ttribute_ColorInput; | 228 |
232 if (!hasVertexColors && this->fColor != that.fColor) { | 229 if (!fDescInfo.fHasVertexColor && this->fColor != that.fColor) { |
233 return false; | 230 return false; |
234 } | 231 } |
235 | 232 |
236 if (this->getRenderTarget() != that.getRenderTarget() || | 233 if (this->getRenderTarget() != that.getRenderTarget() || |
| 234 this->fFragmentStages.count() != that.fFragmentStages.count() || |
| 235 this->fNumColorStages != that.fNumColorStages || |
237 this->fScissorState != that.fScissorState || | 236 this->fScissorState != that.fScissorState || |
238 !this->fViewMatrix.cheapEqualTo(that.fViewMatrix) || | 237 !this->fViewMatrix.cheapEqualTo(that.fViewMatrix) || |
239 this->fSrcBlend != that.fSrcBlend || | 238 this->fSrcBlend != that.fSrcBlend || |
240 this->fDstBlend != that.fDstBlend || | 239 this->fDstBlend != that.fDstBlend || |
| 240 this->fDrawType != that.fDrawType || |
241 this->fBlendConstant != that.fBlendConstant || | 241 this->fBlendConstant != that.fBlendConstant || |
242 this->fFlags != that.fFlags || | 242 this->fFlags != that.fFlags || |
243 this->fStencilSettings != that.fStencilSettings || | 243 this->fStencilSettings != that.fStencilSettings || |
244 this->fDrawFace != that.fDrawFace || | 244 this->fDrawFace != that.fDrawFace || |
245 this->fDstCopy.texture() != that.fDstCopy.texture()) { | 245 this->fDstCopy.texture() != that.fDstCopy.texture()) { |
246 return false; | 246 return false; |
247 } | 247 } |
248 | 248 |
249 bool hasVertexCoverage = | 249 if (!fDescInfo.fHasVertexCoverage && this->fCoverage != that.fCoverage) { |
250 this->fDesc.header().fCoverageInput == GrProgramDesc::kAttribute_Col
orInput; | |
251 if (!hasVertexCoverage && this->fCoverage != that.fCoverage) { | |
252 return false; | 250 return false; |
253 } | 251 } |
254 | 252 |
255 if (this->hasGeometryProcessor()) { | 253 if (this->hasGeometryProcessor()) { |
256 if (!that.hasGeometryProcessor()) { | 254 if (!that.hasGeometryProcessor()) { |
257 return false; | 255 return false; |
258 } else if (!this->getGeometryProcessor()->isEqual(*that.getGeometryProce
ssor())) { | 256 } else if (!this->getGeometryProcessor()->isEqual(*that.getGeometryProce
ssor())) { |
259 return false; | 257 return false; |
260 } | 258 } |
261 } else if (that.hasGeometryProcessor()) { | 259 } else if (that.hasGeometryProcessor()) { |
262 return false; | 260 return false; |
263 } | 261 } |
264 | 262 |
265 // The program desc comparison should have already assured that the stage co
unts match. | 263 // The program desc comparison should have already assured that the stage co
unts match. |
266 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); | 264 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); |
267 for (int i = 0; i < this->numFragmentStages(); i++) { | 265 for (int i = 0; i < this->numFragmentStages(); i++) { |
268 | 266 |
269 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { | 267 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { |
270 return false; | 268 return false; |
271 } | 269 } |
272 } | 270 } |
273 return true; | 271 return true; |
274 } | 272 } |
275 | 273 |
OLD | NEW |