aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2016-11-14 19:29:24 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-14 19:29:39 +0000
commitf27bab207aebca467c04ccc89d18c9f198a0d762 (patch)
treecc70654332db1e20238d739239e446efef09b48c /include
parentbfebe22ed54d1e3a00888292f10ed8b9714135d3 (diff)
Revert "Add IORef capability to GrSurfaceProxy objects"
This reverts commit 286b96f876953c94c178e3abbeb4eab186ad1fef. Reason for revert: Failure on Mac Mini: FAILURE: ../../../tests/ProxyRefTest.cpp:59 proxy->getPendingWriteCnt_TestOnly() == expectedNumWrites ../../../tests/ProxyRefTest.cpp:64: fatal error: "assert(proxy->getPendingWriteCnt_TestOnly() == expectedNumWrites)" Original change's description: > Add IORef capability to GrSurfaceProxy objects > > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4734 > > Change-Id: If10fbe555e9fa3331bfa01065028e1afe82adb78 > Reviewed-on: https://skia-review.googlesource.com/4734 > Commit-Queue: Robert Phillips <robertphillips@google.com> > Reviewed-by: Brian Salomon <bsalomon@google.com> > TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I5e1c201e027d4e9687b01f28a418b1884d3f9ece Reviewed-on: https://skia-review.googlesource.com/4776 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/gpu/GrGpuResource.h2
-rw-r--r--include/private/GrSurfaceProxy.h91
2 files changed, 6 insertions, 87 deletions
diff --git a/include/gpu/GrGpuResource.h b/include/gpu/GrGpuResource.h
index 29d33df4bd..4597464f02 100644
--- a/include/gpu/GrGpuResource.h
+++ b/include/gpu/GrGpuResource.h
@@ -93,8 +93,6 @@ protected:
bool internalHasRef() const { return SkToBool(fRefCnt); }
private:
- friend class GrIORefProxy; // needs to forward on wrapped IO calls
-
void addPendingRead() const {
this->validate();
++fPendingReads;
diff --git a/include/private/GrSurfaceProxy.h b/include/private/GrSurfaceProxy.h
index 3273f65f55..dd5ece1e2c 100644
--- a/include/private/GrSurfaceProxy.h
+++ b/include/private/GrSurfaceProxy.h
@@ -50,29 +50,13 @@ public:
void validate() const {
#ifdef SK_DEBUG
- SkASSERT(fRefCnt >= 1);
- SkASSERT(fPendingReads >= 0);
- SkASSERT(fPendingWrites >= 0);
- SkASSERT(fRefCnt + fPendingReads + fPendingWrites >= 1);
-
- if (fTarget) {
- SkASSERT(!fPendingReads && !fPendingWrites);
- // The backing GrSurface can have more refs than the proxy if the proxy
- // started off wrapping an external resource (that came in with refs).
- // The GrSurface should never have fewer refs than the proxy however.
- SkASSERT(fTarget->fRefCnt >= fRefCnt);
- }
+ SkASSERT(fRefCnt >= 0);
#endif
}
- int32_t getProxyRefCnt_TestOnly() const;
- int32_t getBackingRefCnt_TestOnly() const;
- int32_t getPendingReadCnt_TestOnly() const;
- int32_t getPendingWriteCnt_TestOnly() const;
-
protected:
- GrIORefProxy() : fTarget(nullptr), fRefCnt(1), fPendingReads(0), fPendingWrites(0) {}
- GrIORefProxy(sk_sp<GrSurface> surface) : fRefCnt(1), fPendingReads(0), fPendingWrites(0) {
+ GrIORefProxy() : fRefCnt(1), fTarget(nullptr) {}
+ GrIORefProxy(sk_sp<GrSurface> surface) : fRefCnt(1) {
// Since we're manually forwarding on refs & unrefs we don't want sk_sp doing
// anything extra.
fTarget = surface.release();
@@ -82,76 +66,13 @@ protected:
// have forwarded on the unref call that got use here.
}
- // This GrIORefProxy was deferred before but has just been instantiated. To
- // make all the reffing & unreffing work out we now need to transfer any deferred
- // refs & unrefs to the new GrSurface
- void transferRefs() {
- SkASSERT(fTarget);
-
- fTarget->fRefCnt += fRefCnt;
- fTarget->fPendingReads += fPendingReads;
- fTarget->fPendingWrites += fPendingWrites;
-
- fPendingReads = 0;
- fPendingWrites = 0;
- }
+ // TODO: add the IO ref counts. Although if we can delay shader creation to flush time
+ // we may not even need to do that.
+ mutable int32_t fRefCnt;
// For deferred proxies this will be null. For wrapped proxies it will point to the
// wrapped resource.
GrSurface* fTarget;
-
-private:
- // This class is used to manage conversion of refs to pending reads/writes.
- friend class GrGpuResourceRef;
- template <typename, GrIOType> friend class GrPendingIOResource;
-
- void addPendingRead() const {
- this->validate();
-
- if (fTarget) {
- fTarget->addPendingRead();
- return;
- }
-
- ++fPendingReads;
- }
-
- void completedRead() const {
- this->validate();
-
- if (fTarget) {
- fTarget->completedRead();
- return;
- }
-
- SkFAIL("How was the read completed if the Proxy hasn't been instantiated?");
- }
-
- void addPendingWrite() const {
- this->validate();
-
- if (fTarget) {
- fTarget->addPendingWrite();
- return;
- }
-
- ++fPendingWrites;
- }
-
- void completedWrite() const {
- this->validate();
-
- if (fTarget) {
- fTarget->completedWrite();
- return;
- }
-
- SkFAIL("How was the write completed if the Proxy hasn't been instantiated?");
- }
-
- mutable int32_t fRefCnt;
- mutable int32_t fPendingReads;
- mutable int32_t fPendingWrites;
};
class GrSurfaceProxy : public GrIORefProxy {