Index: include/gpu/GrProgramElement.h |
diff --git a/include/gpu/GrProgramElement.h b/include/gpu/GrProgramElement.h |
index 6fdc98daa9be963db13a24872a60dbfa85219f98..5f88a2a68f79896cf1880692c8f0659c8d702bd6 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; |