aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu/GrProgramElement.h
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2014-09-05 12:23:12 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-09-05 12:23:12 -0700
commit52e9d63f7110ac691609660342cdab32082a4235 (patch)
treefa7bf3b7a534588d99bf049fb3b8cc4d20cd15ff /include/gpu/GrProgramElement.h
parent5a80be22418176a2d15b0d3bd33215e28b516b24 (diff)
Don't take a ref on GP in AutoEffectRestore.
BUG=skia:2889 R=joshualitt@chromium.org, robertphillips@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/546043002
Diffstat (limited to 'include/gpu/GrProgramElement.h')
-rw-r--r--include/gpu/GrProgramElement.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/gpu/GrProgramElement.h b/include/gpu/GrProgramElement.h
index 6fdc98daa9..5f88a2a68f 100644
--- a/include/gpu/GrProgramElement.h
+++ b/include/gpu/GrProgramElement.h
@@ -49,6 +49,11 @@ public:
}
}
+ /**
+ * Gets an id that is unique for this GrProgramElement object. This will never return 0.
+ */
+ uint32_t getUniqueID() const { return fUniqueID; }
+
void validate() const {
#ifdef SK_DEBUG
SkASSERT(fRefCnt >= 0);
@@ -58,7 +63,7 @@ public:
}
protected:
- GrProgramElement() : fRefCnt(1), fPendingExecutions(0) {}
+ GrProgramElement() : fRefCnt(1), fPendingExecutions(0), fUniqueID(CreateUniqueID()) {}
/** Subclasses registers their resources using this function. It is assumed the GrProgramResouce
is and will remain owned by the subclass and this function will retain a raw ptr. Once a
@@ -69,6 +74,8 @@ protected:
}
private:
+ static uint32_t CreateUniqueID();
+
void convertRefToPendingExecution() const;
void completedExecution() const;
@@ -76,6 +83,7 @@ private:
mutable int32_t fRefCnt;
// Count of deferred executions not yet issued to the 3D API.
mutable int32_t fPendingExecutions;
+ uint32_t fUniqueID;
SkSTArray<4, const GrProgramResource*, true> fProgramResources;