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" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 inout.fColor = 0xFF << GrColor_SHIFT_A; | 180 inout.fColor = 0xFF << GrColor_SHIFT_A; |
181 inout.fValidFlags = kA_GrColorComponentFlag; | 181 inout.fValidFlags = kA_GrColorComponentFlag; |
182 } else { | 182 } else { |
183 inout.fValidFlags = 0; | 183 inout.fValidFlags = 0; |
184 // not strictly necessary but we get false alarms from tools about u
ninit. | 184 // not strictly necessary but we get false alarms from tools about u
ninit. |
185 inout.fColor = 0; | 185 inout.fColor = 0; |
186 } | 186 } |
187 } | 187 } |
188 | 188 |
189 for (int i = 0; i < ds.numColorStages(); ++i) { | 189 for (int i = 0; i < ds.numColorStages(); ++i) { |
190 const GrFragmentProcessor* fp = ds.getColorStage(i).getFragmentProcessor
(); | 190 const GrFragmentProcessor* fp = ds.getColorStage(i).getProcessor(); |
191 if (!fp->willUseInputColor()) { | 191 if (!fp->willUseInputColor()) { |
192 firstColorStage = i; | 192 firstColorStage = i; |
193 fInputColorIsUsed = false; | 193 fInputColorIsUsed = false; |
194 } | 194 } |
195 fp->computeInvariantOutput(&inout); | 195 fp->computeInvariantOutput(&inout); |
196 if (kRGBA_GrColorComponentFlags == inout.fValidFlags) { | 196 if (kRGBA_GrColorComponentFlags == inout.fValidFlags) { |
197 firstColorStage = i + 1; | 197 firstColorStage = i + 1; |
198 fColor = inout.fColor; | 198 fColor = inout.fColor; |
199 fInputColorIsUsed = true; | 199 fInputColorIsUsed = true; |
200 this->removeFixedFunctionVertexAttribs(0x1 << kColor_GrVertexAttribB
inding); | 200 this->removeFixedFunctionVertexAttribs(0x1 << kColor_GrVertexAttribB
inding); |
(...skipping 27 matching lines...) Expand all Loading... |
228 #endif | 228 #endif |
229 if (ds.numCoverageStages() > 0) { | 229 if (ds.numCoverageStages() > 0) { |
230 fCoverageStages.reset(&ds.getCoverageStage(firstCoverageStage), | 230 fCoverageStages.reset(&ds.getCoverageStage(firstCoverageStage), |
231 ds.numCoverageStages() - firstCoverageStage); | 231 ds.numCoverageStages() - firstCoverageStage); |
232 } else { | 232 } else { |
233 fCoverageStages.reset(); | 233 fCoverageStages.reset(); |
234 } | 234 } |
235 } | 235 } |
236 | 236 |
237 static void get_stage_stats(const GrFragmentStage& stage, bool* readsDst, bool*
readsFragPosition) { | 237 static void get_stage_stats(const GrFragmentStage& stage, bool* readsDst, bool*
readsFragPosition) { |
238 if (stage.getFragmentProcessor()->willReadDstColor()) { | 238 if (stage.getProcessor()->willReadDstColor()) { |
239 *readsDst = true; | 239 *readsDst = true; |
240 } | 240 } |
241 if (stage.getFragmentProcessor()->willReadFragmentPosition()) { | 241 if (stage.getProcessor()->willReadFragmentPosition()) { |
242 *readsFragPosition = true; | 242 *readsFragPosition = true; |
243 } | 243 } |
244 } | 244 } |
245 | 245 |
246 void GrOptDrawState::getStageStats() { | 246 void GrOptDrawState::getStageStats() { |
247 // We will need a local coord attrib if there is one currently set on the op
tState and we are | 247 // We will need a local coord attrib if there is one currently set on the op
tState and we are |
248 // actually generating some effect code | 248 // actually generating some effect code |
249 fRequiresLocalCoordAttrib = this->hasLocalCoordAttribute() && this->numTotal
Stages() > 0; | 249 fRequiresLocalCoordAttrib = this->hasLocalCoordAttribute() && this->numTotal
Stages() > 0; |
250 | 250 |
251 fReadsDst = false; | 251 fReadsDst = false; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 } | 331 } |
332 } | 332 } |
333 | 333 |
334 SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices, | 334 SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices, |
335 that.fFixedFunctionVertexAttribIndices, | 335 that.fFixedFunctionVertexAttribIndices, |
336 sizeof(this->fFixedFunctionVertexAttribIndices))); | 336 sizeof(this->fFixedFunctionVertexAttribIndices))); |
337 | 337 |
338 return true; | 338 return true; |
339 } | 339 } |
340 | 340 |
OLD | NEW |