aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrDrawState.h
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2014-09-05 09:18:51 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-09-05 09:18:51 -0700
commit9b536523cae9787f6b24ed9234c50cdf2710d67e (patch)
treeb7161e0b550240595338f680852f3b935db3480a /src/gpu/GrDrawState.h
parenta1ae66d252edf6da932caed1fe43d11216e56c0e (diff)
Change behavior of GrDS::AutoEffectRestort wrt GPs.
BUG=skia:2889 R=robertphillips@google.com, joshualitt@chromium.org Author: bsalomon@google.com Review URL: https://codereview.chromium.org/545253002
Diffstat (limited to 'src/gpu/GrDrawState.h')
-rw-r--r--src/gpu/GrDrawState.h38
1 files changed, 29 insertions, 9 deletions
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index a1b07de6d6..7b5f150f4c 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -237,14 +237,34 @@ public:
}
/**
- * When this object is destroyed it will remove any effects from the draw state that were added
- * after its constructor.
+ * When this object is destroyed it will remove any color/coverage effects from the draw state
+ * that were added after its constructor.
+ *
+ * This class has strange behavior around geometry processor. If there is a GP on the draw state
+ * it will assert that the GP is not modified until after the destructor of the ARE. If the
+ * draw state has a NULL GP when the ARE is constructed then it will reset it to null in the
+ * destructor.
+ *
+ * TODO: We'd prefer for the ARE to just save and restore the GP. However, this would add
+ * significant complexity to the multi-ref architecture for deferred drawing. Once GrDrawState
+ * and GrOptDrawState are fully separated then GrDrawState will never be in the deferred
+ * execution state and GrOptDrawState always will be (and will be immutable and therefore
+ * unable to have an ARE). At this point we can restore sanity and have the ARE save and restore
+ * the GP.
*/
class AutoRestoreEffects : public ::SkNoncopyable {
public:
- AutoRestoreEffects() : fDrawState(NULL), fColorEffectCnt(0), fCoverageEffectCnt(0) {}
-
- AutoRestoreEffects(GrDrawState* ds) : fDrawState(NULL), fColorEffectCnt(0), fCoverageEffectCnt(0) {
+ AutoRestoreEffects()
+ : fDrawState(NULL)
+ , fOriginalGP(NULL)
+ , fColorEffectCnt(0)
+ , fCoverageEffectCnt(0) {}
+
+ AutoRestoreEffects(GrDrawState* ds)
+ : fDrawState(NULL)
+ , fOriginalGP(NULL)
+ , fColorEffectCnt(0)
+ , fCoverageEffectCnt(0) {
this->set(ds);
}
@@ -255,10 +275,10 @@ public:
bool isSet() const { return NULL != fDrawState; }
private:
- GrDrawState* fDrawState;
- SkAutoTDelete<GrEffectStage> fGeometryProcessor;
- int fColorEffectCnt;
- int fCoverageEffectCnt;
+ GrDrawState* fDrawState;
+ const GrEffect* fOriginalGP;
+ int fColorEffectCnt;
+ int fCoverageEffectCnt;
};
/// @}