aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu/GrProgramElement.h
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2014-11-19 08:23:49 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-11-19 08:23:49 -0800
commitae59b77612c42ff6b793dc33e3d115e6a5db34cc (patch)
treef3124daeb6c8a0619d60ee09e7cdd3dae47bffdb /include/gpu/GrProgramElement.h
parent78e276889795454891cbba48ab11927968114953 (diff)
Create GrOptDrawState before recording draw in GrInOrderDrawBuffer
Diffstat (limited to 'include/gpu/GrProgramElement.h')
-rw-r--r--include/gpu/GrProgramElement.h35
1 files changed, 30 insertions, 5 deletions
diff --git a/include/gpu/GrProgramElement.h b/include/gpu/GrProgramElement.h
index 2cdd1cc563..e1adcc31f7 100644
--- a/include/gpu/GrProgramElement.h
+++ b/include/gpu/GrProgramElement.h
@@ -35,10 +35,11 @@ public:
}
void ref() const {
+ this->validate();
// Once the ref cnt reaches zero it should never be ref'ed again.
SkASSERT(fRefCnt > 0);
- this->validate();
++fRefCnt;
+ this->validate();
}
void unref() const {
@@ -47,10 +48,12 @@ public:
if (0 == fRefCnt) {
if (0 == fPendingExecutions) {
SkDELETE(this);
+ return;
} else {
this->removeRefs();
}
}
+ this->validate();
}
/**
@@ -80,11 +83,33 @@ protected:
private:
static uint32_t CreateUniqueID();
- void convertRefToPendingExecution() const;
+ void addPendingExecution() const {
+ this->validate();
+ SkASSERT(fRefCnt > 0);
+ if (0 == fPendingExecutions) {
+ this->addPendingIOs();
+ }
+ ++fPendingExecutions;
+ this->validate();
+ }
- void completedExecution() const;
+ void completedExecution() const {
+ this->validate();
+ --fPendingExecutions;
+ if (0 == fPendingExecutions) {
+ if (0 == fRefCnt) {
+ SkDELETE(this);
+ return;
+ } else {
+ this->pendingIOComplete();
+ }
+ }
+ this->validate();
+ }
void removeRefs() const;
+ void addPendingIOs() const;
+ void pendingIOComplete() const;
mutable int32_t fRefCnt;
// Count of deferred executions not yet issued to the 3D API.
@@ -93,8 +118,8 @@ private:
SkSTArray<4, const GrGpuResourceRef*, true> fGpuResources;
- // Only this class can access convertRefToPendingExecution() and completedExecution().
- template <typename T> friend class GrProgramElementRef;
+ // Only this class can access addPendingExecution() and completedExecution().
+ template <typename T> friend class GrPendingProgramElement;
typedef SkNoncopyable INHERITED;
};