diff options
author | robertphillips <robertphillips@google.com> | 2016-08-31 14:04:06 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-31 14:04:06 -0700 |
commit | 8abb370aca280516f4861c6c942ec453aad018fa (patch) | |
tree | b7e1c12fab48df526ba92763add2aca80806d554 /include/private/GrSurfaceProxy.h | |
parent | bde96c6263112de755a2573f6f5f02703386f328 (diff) |
Have GrSurfaceProxys and GrGpuResources draw from the same pool of unique ids
The idea here is that, for wrapped Proxy objects, we want the uniqueID to reflect that of the wrapped object. For this to work the IDs for the non-wrapped versions can't conflict with GrGpuResource's pool of IDs.
Split off of: https://codereview.chromium.org/2215323003/ (Start using RenderTargetProxy (omnibus))
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2301523003
Review-Url: https://codereview.chromium.org/2301523003
Diffstat (limited to 'include/private/GrSurfaceProxy.h')
-rw-r--r-- | include/private/GrSurfaceProxy.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/include/private/GrSurfaceProxy.h b/include/private/GrSurfaceProxy.h index 01c52675a4..ad2ea91973 100644 --- a/include/private/GrSurfaceProxy.h +++ b/include/private/GrSurfaceProxy.h @@ -41,11 +41,21 @@ public: virtual const GrRenderTargetProxy* asRenderTargetProxy() const { return nullptr; } protected: + // Deferred version GrSurfaceProxy(const GrSurfaceDesc& desc, SkBackingFit fit, SkBudgeted budgeted) : fDesc(desc) , fFit(fit) , fBudgeted(budgeted) - , fUniqueID(CreateUniqueID()) { + , fUniqueID(GrGpuResource::CreateUniqueID()) { + } + + // Wrapped version + GrSurfaceProxy(const GrSurfaceDesc& desc, SkBackingFit fit, + SkBudgeted budgeted, uint32_t uniqueID) + : fDesc(desc) + , fFit(fit) + , fBudgeted(budgeted) + , fUniqueID(uniqueID) { } virtual ~GrSurfaceProxy() {} @@ -54,10 +64,9 @@ protected: const GrSurfaceDesc fDesc; const SkBackingFit fFit; // always exact for wrapped resources const SkBudgeted fBudgeted; // set from the backing resource for wrapped resources - const uint32_t fUniqueID; + const uint32_t fUniqueID; // set from the backing resource for wrapped resources private: - static uint32_t CreateUniqueID(); // See comment in GrGpuResource.h. void notifyAllCntsAreZero(CntType) const { delete this; } |