| 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.reset(SkNEW_ARGS(GrGeometryStage, (*drawState.getGeom
etryProcessor()))); | 57 fGeometryProcessor.initAndRef(drawState.fGeometryProcessor); |
| 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 fColorStages.reset(&drawState.getColorStage(firstColorStageIdx), | 64 fColorStages.reset(&drawState.getColorStage(firstColorStageIdx), |
| 65 drawState.numColorStages() - firstColorStageIdx); | 65 drawState.numColorStages() - firstColorStageIdx); |
| 66 } else { | 66 } else { |
| 67 fColorStages.reset(); | 67 fColorStages.reset(); |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 301 |
| 302 for (int s = firstColorStageIdx; s < ds.numColorStages(); ++s) { | 302 for (int s = firstColorStageIdx; s < ds.numColorStages(); ++s) { |
| 303 const GrFragmentStage& stage = ds.getColorStage(s); | 303 const GrFragmentStage& stage = ds.getColorStage(s); |
| 304 get_stage_stats(stage, &fReadsDst, &fReadsFragPosition); | 304 get_stage_stats(stage, &fReadsDst, &fReadsFragPosition); |
| 305 } | 305 } |
| 306 for (int s = firstCoverageStageIdx; s < ds.numCoverageStages(); ++s) { | 306 for (int s = firstCoverageStageIdx; s < ds.numCoverageStages(); ++s) { |
| 307 const GrFragmentStage& stage = ds.getCoverageStage(s); | 307 const GrFragmentStage& stage = ds.getCoverageStage(s); |
| 308 get_stage_stats(stage, &fReadsDst, &fReadsFragPosition); | 308 get_stage_stats(stage, &fReadsDst, &fReadsFragPosition); |
| 309 } | 309 } |
| 310 if (ds.hasGeometryProcessor()) { | 310 if (ds.hasGeometryProcessor()) { |
| 311 const GrGeometryStage& stage = *ds.getGeometryProcessor(); | 311 const GrGeometryProcessor& gp = *ds.getGeometryProcessor(); |
| 312 fReadsFragPosition = fReadsFragPosition || stage.getProcessor()->willRea
dFragmentPosition(); | 312 fReadsFragPosition = fReadsFragPosition || gp.willReadFragmentPosition()
; |
| 313 } | 313 } |
| 314 } | 314 } |
| 315 | 315 |
| 316 //////////////////////////////////////////////////////////////////////////////// | 316 //////////////////////////////////////////////////////////////////////////////// |
| 317 | 317 |
| 318 bool GrOptDrawState::operator== (const GrOptDrawState& that) const { | 318 bool GrOptDrawState::operator== (const GrOptDrawState& that) const { |
| 319 return this->isEqual(that); | 319 return this->isEqual(that); |
| 320 } | 320 } |
| 321 | 321 |
| 322 bool GrOptDrawState::isEqual(const GrOptDrawState& that) const { | 322 bool GrOptDrawState::isEqual(const GrOptDrawState& that) const { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 350 | 350 |
| 351 bool usingVertexCoverage = this->hasCoverageVertexAttribute(); | 351 bool usingVertexCoverage = this->hasCoverageVertexAttribute(); |
| 352 if (!usingVertexCoverage && this->fCoverage != that.fCoverage) { | 352 if (!usingVertexCoverage && this->fCoverage != that.fCoverage) { |
| 353 return false; | 353 return false; |
| 354 } | 354 } |
| 355 | 355 |
| 356 bool explicitLocalCoords = this->hasLocalCoordAttribute(); | 356 bool explicitLocalCoords = this->hasLocalCoordAttribute(); |
| 357 if (this->hasGeometryProcessor()) { | 357 if (this->hasGeometryProcessor()) { |
| 358 if (!that.hasGeometryProcessor()) { | 358 if (!that.hasGeometryProcessor()) { |
| 359 return false; | 359 return false; |
| 360 } else if (!GrProcessorStage::AreCompatible(*this->getGeometryProcessor(
), | 360 } else if (!this->getGeometryProcessor()->isEqual(*that.getGeometryProce
ssor())) { |
| 361 *that.getGeometryProcessor()
, | |
| 362 explicitLocalCoords)) { | |
| 363 return false; | 361 return false; |
| 364 } | 362 } |
| 365 } else if (that.hasGeometryProcessor()) { | 363 } else if (that.hasGeometryProcessor()) { |
| 366 return false; | 364 return false; |
| 367 } | 365 } |
| 368 | 366 |
| 369 for (int i = 0; i < this->numColorStages(); i++) { | 367 for (int i = 0; i < this->numColorStages(); i++) { |
| 370 if (!GrProcessorStage::AreCompatible(this->getColorStage(i), that.getCol
orStage(i), | 368 if (!GrFragmentStage::AreCompatible(this->getColorStage(i), that.getColo
rStage(i), |
| 371 explicitLocalCoords)) { | 369 explicitLocalCoords)) { |
| 372 return false; | 370 return false; |
| 373 } | 371 } |
| 374 } | 372 } |
| 375 for (int i = 0; i < this->numCoverageStages(); i++) { | 373 for (int i = 0; i < this->numCoverageStages(); i++) { |
| 376 if (!GrProcessorStage::AreCompatible(this->getCoverageStage(i), that.get
CoverageStage(i), | 374 if (!GrFragmentStage::AreCompatible(this->getCoverageStage(i), that.getC
overageStage(i), |
| 377 explicitLocalCoords)) { | 375 explicitLocalCoords)) { |
| 378 return false; | 376 return false; |
| 379 } | 377 } |
| 380 } | 378 } |
| 381 | 379 |
| 382 SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices, | 380 SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices, |
| 383 that.fFixedFunctionVertexAttribIndices, | 381 that.fFixedFunctionVertexAttribIndices, |
| 384 sizeof(this->fFixedFunctionVertexAttribIndices))); | 382 sizeof(this->fFixedFunctionVertexAttribIndices))); |
| 385 | 383 |
| 386 return true; | 384 return true; |
| 387 } | 385 } |
| 388 | 386 |
| OLD | NEW |