| Index: src/gpu/GrOptDrawState.cpp
|
| diff --git a/src/gpu/GrOptDrawState.cpp b/src/gpu/GrOptDrawState.cpp
|
| index 5f352966b8a3441d5faf603c6234788dc2e23db6..40a9509201e4b60a11bc9cdb5cf79bc508e1738e 100644
|
| --- a/src/gpu/GrOptDrawState.cpp
|
| +++ b/src/gpu/GrOptDrawState.cpp
|
| @@ -44,6 +44,7 @@ GrOptDrawState::GrOptDrawState(const GrDrawState& drawState,
|
| this->copyEffectiveColorStages(drawState);
|
| this->copyEffectiveCoverageStages(drawState);
|
| this->adjustFromBlendOpts();
|
| + this->getStageStats();
|
| };
|
|
|
| void GrOptDrawState::adjustFromBlendOpts() {
|
| @@ -179,6 +180,44 @@ 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()) {
|
| + *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);
|
| + }
|
| + // TODO: Once non Geom Processors can't be vertex effects we can remove this assert
|
| + SkASSERT(!fRequiresVertexShader);
|
| + if (this->hasGeometryProcessor()) {
|
| + const GrEffectStage& stage = *this->getGeometryProcessor();
|
| + get_stage_stats(stage, &fReadsDst, &fReadsFragPosition, &fRequiresVertexShader);
|
| + SkASSERT(fRequiresVertexShader);
|
| + }
|
| + // TODO: Once we have actually separate GP's from other effects we can just set
|
| + // fRequiresVertexShader to be hasGeometryProcessor (or actaully just drop the bool all
|
| + // together and just check for GP when needed.
|
| + SkASSERT(this->hasGeometryProcessor() == fRequiresVertexShader);
|
| +}
|
| +
|
| bool GrOptDrawState::operator== (const GrOptDrawState& that) const {
|
| return this->isEqual(that);
|
| }
|
|
|