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

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: fix 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..9fd12a7c0291ef5183bd841b2f46c2ad673f4af2 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;
@@ -77,6 +84,8 @@ private:
// Count of deferred executions not yet issued to the 3D API.
mutable int32_t fPendingExecutions;
robertphillips 2014/09/05 19:11:29 Line this up ?
bsalomon 2014/09/05 19:12:43 Done.
+ uint32_t fUniqueID;
+
SkSTArray<4, const GrProgramResource*, true> fProgramResources;
// Only this class can access convertRefToPendingExecution() and completedExecution().
« 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