Use different classes for client side arrays and GPU buffer objects.
GrBuffer is a base class for GrGpuBuffer and GrCpuBuffer. GrGpuBuffer is a
GrGpuResource and the others are not. This allows GrCpuBuffers to exist
outside of the GrGpuResourceCache.
Also removes flags from GrResourceProvider buffer factory function. The
only flag still in use was kRequireGpuMemory. Now CPU buffers are made
without using GrResourceProvider.
Change-Id: I82670d1316e28fd6331ca36b26c8c4ead33846f9
Reviewed-on: https://skia-review.googlesource.com/c/188823
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/include/gpu/GrGpuResource.h b/include/gpu/GrGpuResource.h
index 0215e2b..af4d357 100644
--- a/include/gpu/GrGpuResource.h
+++ b/include/gpu/GrGpuResource.h
@@ -93,7 +93,6 @@
bool internalHasUniqueRef() const { return fRefCnt == 1; }
private:
- friend class GrIORefProxy; // needs to forward on wrapped IO calls
// This is for a unit test.
template <typename T>
friend void testingOnly_getIORefCnts(const T*, int* refCnt, int* readCnt, int* writeCnt);
@@ -120,7 +119,6 @@
this->didRemoveRefOrPendingIO(kPendingWrite_CntType);
}
-private:
void didRemoveRefOrPendingIO(CntType cntTypeRemoved) const {
if (0 == fPendingReads && 0 == fPendingWrites && 0 == fRefCnt) {
static_cast<const DERIVED*>(this)->notifyAllCntsAreZero(cntTypeRemoved);
@@ -131,6 +129,7 @@
mutable int32_t fPendingReads;
mutable int32_t fPendingWrites;
+ friend class GrIORefProxy; // needs to forward on wrapped IO calls
friend class GrResourceCache; // to check IO ref counts.
template <typename, GrIOType> friend class GrPendingIOResource;