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