Add explicit GrSurfaceProxy flag to skip explicit resource allocation (take 2)
This approach eliminates a lot of edge cases where ops (e.g., the SmallPathOp) are treating their proxies in a special manner (i.e., just holding a raw ref and never adding pendingIO). Given that the atlas managers are managing the lifetime of the proxies there is no reason for the GrResourceAllocator to be aware of them.
Pulled out of:
https://skia-review.googlesource.com/c/skia/+/208227 (Implement alternate method for determining recycle-ability of allocated GrSurfaces)
Change-Id: I0a8d3c2d56036d568b6d49ddc78c32761642d1c8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209419
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrSurfaceProxyPriv.h b/src/gpu/GrSurfaceProxyPriv.h
index ef8fe19..34ca7a1 100644
--- a/src/gpu/GrSurfaceProxyPriv.h
+++ b/src/gpu/GrSurfaceProxyPriv.h
@@ -23,6 +23,8 @@
// depends on the read and write refs (So this method can validly return 0).
int32_t getProxyRefCnt() const { return fProxy->getProxyRefCnt(); }
+ int32_t getTotalRefs() const { return fProxy->getTotalRefs(); }
+
void computeScratchKey(GrScratchKey* key) const { return fProxy->computeScratchKey(key); }
// Create a GrSurface-derived class that meets the requirements (i.e, desc, renderability)
@@ -58,6 +60,9 @@
static bool SK_WARN_UNUSED_RESULT AttachStencilIfNeeded(GrResourceProvider*, GrSurface*,
bool needsStencil);
+ bool ignoredByResourceAllocator() const { return fProxy->ignoredByResourceAllocator(); }
+ void setIgnoredByResourceAllocator() { fProxy->setIgnoredByResourceAllocator(); }
+
private:
explicit GrSurfaceProxyPriv(GrSurfaceProxy* proxy) : fProxy(proxy) {}
GrSurfaceProxyPriv(const GrSurfaceProxyPriv&) {} // unimpl