Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Unified Diff: src/gpu/GrOptDrawState.cpp

Issue 545693004: Calculate stage stats in GrOptDrawState (Closed) Base URL: https://skia.googlesource.com/skia.git@connectOpt2
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}

Powered by Google App Engine
This is Rietveld 408576698