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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 this->computeEffectiveCoverageStages(drawState, &firstCoverageStageIdx); | 47 this->computeEffectiveCoverageStages(drawState, &firstCoverageStageIdx); |
48 this->adjustFromBlendOpts(drawState, &firstColorStageIdx, &firstCoverageStag
eIdx, | 48 this->adjustFromBlendOpts(drawState, &firstColorStageIdx, &firstCoverageStag
eIdx, |
49 &fixedFunctionVAToRemove); | 49 &fixedFunctionVAToRemove); |
50 // Should not be setting any more FFVA to be removed at this point | 50 // Should not be setting any more FFVA to be removed at this point |
51 this->removeFixedFunctionVertexAttribs(fixedFunctionVAToRemove); | 51 this->removeFixedFunctionVertexAttribs(fixedFunctionVAToRemove); |
52 this->getStageStats(drawState, firstColorStageIdx, firstCoverageStageIdx); | 52 this->getStageStats(drawState, firstColorStageIdx, firstCoverageStageIdx); |
53 this->setOutputStateInfo(drawState, caps, firstCoverageStageIdx, &separateCo
verageFromColor); | 53 this->setOutputStateInfo(drawState, caps, firstCoverageStageIdx, &separateCo
verageFromColor); |
54 | 54 |
55 // Copy GeometryProcesssor from DS or ODS | 55 // Copy GeometryProcesssor from DS or ODS |
56 if (drawState.hasGeometryProcessor()) { | 56 if (drawState.hasGeometryProcessor()) { |
57 fGeometryProcessor.initAndRef(drawState.fGeometryProcessor); | 57 fGeometryProcessor.reset(SkNEW_ARGS(GrGeometryStage, (*drawState.getGeom
etryProcessor()))); |
58 } else { | 58 } else { |
59 fGeometryProcessor.reset(NULL); | 59 fGeometryProcessor.reset(NULL); |
60 } | 60 } |
61 | 61 |
62 // Copy Color Stages from DS to ODS | 62 // Copy Color Stages from DS to ODS |
63 if (firstColorStageIdx < drawState.numColorStages()) { | 63 if (firstColorStageIdx < drawState.numColorStages()) { |
64 fFragmentStages.reset(&drawState.getColorStage(firstColorStageIdx), | 64 fFragmentStages.reset(&drawState.getColorStage(firstColorStageIdx), |
65 drawState.numColorStages() - firstColorStageIdx); | 65 drawState.numColorStages() - firstColorStageIdx); |
66 } else { | 66 } else { |
67 fFragmentStages.reset(); | 67 fFragmentStages.reset(); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 298 |
299 for (int s = firstColorStageIdx; s < ds.numColorStages(); ++s) { | 299 for (int s = firstColorStageIdx; s < ds.numColorStages(); ++s) { |
300 const GrFragmentStage& stage = ds.getColorStage(s); | 300 const GrFragmentStage& stage = ds.getColorStage(s); |
301 get_stage_stats(stage, &fReadsDst, &fReadsFragPosition); | 301 get_stage_stats(stage, &fReadsDst, &fReadsFragPosition); |
302 } | 302 } |
303 for (int s = firstCoverageStageIdx; s < ds.numCoverageStages(); ++s) { | 303 for (int s = firstCoverageStageIdx; s < ds.numCoverageStages(); ++s) { |
304 const GrFragmentStage& stage = ds.getCoverageStage(s); | 304 const GrFragmentStage& stage = ds.getCoverageStage(s); |
305 get_stage_stats(stage, &fReadsDst, &fReadsFragPosition); | 305 get_stage_stats(stage, &fReadsDst, &fReadsFragPosition); |
306 } | 306 } |
307 if (ds.hasGeometryProcessor()) { | 307 if (ds.hasGeometryProcessor()) { |
308 const GrGeometryProcessor& gp = *ds.getGeometryProcessor(); | 308 const GrGeometryStage& stage = *ds.getGeometryProcessor(); |
309 fReadsFragPosition = fReadsFragPosition || gp.willReadFragmentPosition()
; | 309 fReadsFragPosition = fReadsFragPosition || stage.getProcessor()->willRea
dFragmentPosition(); |
310 } | 310 } |
311 } | 311 } |
312 | 312 |
313 //////////////////////////////////////////////////////////////////////////////// | 313 //////////////////////////////////////////////////////////////////////////////// |
314 | 314 |
315 bool GrOptDrawState::operator== (const GrOptDrawState& that) const { | 315 bool GrOptDrawState::operator== (const GrOptDrawState& that) const { |
316 return this->isEqual(that); | 316 return this->isEqual(that); |
317 } | 317 } |
318 | 318 |
319 bool GrOptDrawState::isEqual(const GrOptDrawState& that) const { | 319 bool GrOptDrawState::isEqual(const GrOptDrawState& that) const { |
(...skipping 27 matching lines...) Expand all Loading... |
347 | 347 |
348 bool usingVertexCoverage = this->hasCoverageVertexAttribute(); | 348 bool usingVertexCoverage = this->hasCoverageVertexAttribute(); |
349 if (!usingVertexCoverage && this->fCoverage != that.fCoverage) { | 349 if (!usingVertexCoverage && this->fCoverage != that.fCoverage) { |
350 return false; | 350 return false; |
351 } | 351 } |
352 | 352 |
353 bool explicitLocalCoords = this->hasLocalCoordAttribute(); | 353 bool explicitLocalCoords = this->hasLocalCoordAttribute(); |
354 if (this->hasGeometryProcessor()) { | 354 if (this->hasGeometryProcessor()) { |
355 if (!that.hasGeometryProcessor()) { | 355 if (!that.hasGeometryProcessor()) { |
356 return false; | 356 return false; |
357 } else if (!this->getGeometryProcessor()->isEqual(*that.getGeometryProce
ssor())) { | 357 } else if (!GrProcessorStage::AreCompatible(*this->getGeometryProcessor(
), |
| 358 *that.getGeometryProcessor()
, |
| 359 explicitLocalCoords)) { |
358 return false; | 360 return false; |
359 } | 361 } |
360 } else if (that.hasGeometryProcessor()) { | 362 } else if (that.hasGeometryProcessor()) { |
361 return false; | 363 return false; |
362 } | 364 } |
363 | 365 |
364 for (int i = 0; i < this->numFragmentStages(); i++) { | 366 for (int i = 0; i < this->numFragmentStages(); i++) { |
365 if (!GrFragmentStage::AreCompatible(this->getFragmentStage(i), that.getF
ragmentStage(i), | 367 if (!GrProcessorStage::AreCompatible(this->getFragmentStage(i), that.get
FragmentStage(i), |
366 explicitLocalCoords)) { | 368 explicitLocalCoords)) { |
367 return false; | 369 return false; |
368 } | 370 } |
369 } | 371 } |
370 | 372 |
371 SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices, | 373 SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices, |
372 that.fFixedFunctionVertexAttribIndices, | 374 that.fFixedFunctionVertexAttribIndices, |
373 sizeof(this->fFixedFunctionVertexAttribIndices))); | 375 sizeof(this->fFixedFunctionVertexAttribIndices))); |
374 | 376 |
375 return true; | 377 return true; |
376 } | 378 } |
377 | 379 |
OLD | NEW |