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

Unified Diff: include/gpu/GrProgramElement.h

Issue 546043002: Don't take a ref on GP in AutoEffectRestore. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comment 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
« no previous file with comments | « include/gpu/GrGpuResource.h ('k') | src/gpu/GrDrawState.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « include/gpu/GrGpuResource.h ('k') | src/gpu/GrDrawState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698