Chromium Code Reviews| Index: src/gpu/GrOptDrawState.cpp |
| diff --git a/src/gpu/GrOptDrawState.cpp b/src/gpu/GrOptDrawState.cpp |
| index c1d28c9591b52a39a91ecd0332c900e974c98b14..be2a6bc7e484937e14d0a44dc8e06ed9742a93d9 100644 |
| --- a/src/gpu/GrOptDrawState.cpp |
| +++ b/src/gpu/GrOptDrawState.cpp |
| @@ -41,6 +41,7 @@ GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, |
| this->copyEffectiveCoverageStages(drawState); |
| this->adjustFromBlendOpts(); |
| this->remapEffectStagesVAIndices(); |
| + this->getStageStats(); |
| }; |
| void GrOptDrawState::initializeVAIndexMap() { |
| @@ -213,6 +214,34 @@ void GrOptDrawState::copyEffectiveCoverageStages(const GrDrawState& ds) { |
| } |
| } |
| +static void get_stage_stats(const GrEffectStage& stage, bool* readsDst, |
| + bool* readsFragPosition, bool* requiresVertexShader) { |
| + if (stage.getEffect()->willReadDstColor()) { |
| + *readsDst = true; |
| + } |
| + if (stage.getEffect()->willReadFragmentPosition()) { |
| + *readsFragPosition = true; |
| + } |
| + if (stage.getEffect()->requiresVertexShader()) { |
|
bsalomon
2014/09/05 15:27:54
this is going away... reqVS will be equivalent to
|
| + *requiresVertexShader = true; |
| + } |
| +} |
| + |
| +void GrOptDrawState::getStageStats() { |
| + fReadsDst = false; |
| + fReadsFragPosition = false; |
| + fRequiresVertexShader = false; |
| + |
| + for (int s = 0; s < this->numColorStages(); ++s) { |
| + const GrEffectStage& stage = this->getColorStage(s); |
| + get_stage_stats(stage, &fReadsDst, &fReadsFragPosition, &fRequiresVertexShader); |
| + } |
| + for (int s = 0; s < this->numCoverageStages(); ++s) { |
| + const GrEffectStage& stage = this->getCoverageStage(s); |
| + get_stage_stats(stage, &fReadsDst, &fReadsFragPosition, &fRequiresVertexShader); |
| + } |
| +} |
| + |
| bool GrOptDrawState::operator== (const GrOptDrawState& that) const { |
| return this->isEqual(that); |
| } |