Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 80bff5b

Browse files
rphilliSkia Commit-Bot
authored andcommitted
Remove GrProxyPendingIO
Change-Id: I9cf40f0518673206c6304e3f386dd75c9a44f269 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235865 Reviewed-by: Greg Daniel <[email protected]> Commit-Queue: Robert Phillips <[email protected]>
1 parent 362a1e0 commit 80bff5b

File tree

6 files changed

+18
-54
lines changed

6 files changed

+18
-54
lines changed

src/gpu/GrPendingIOResource.h

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,6 @@
1313
#include "include/private/SkNoncopyable.h"
1414
#include "src/gpu/GrSurfaceProxy.h"
1515

16-
class GrProxyPendingIO : SkNoncopyable {
17-
public:
18-
GrProxyPendingIO() = default;
19-
GrProxyPendingIO(GrSurfaceProxy* resource) { this->reset(resource); }
20-
~GrProxyPendingIO() { this->reset(nullptr); }
21-
22-
void reset(GrSurfaceProxy* resource = nullptr) {
23-
if (resource == fResource) {
24-
return;
25-
}
26-
27-
if (fResource) {
28-
fResource->unref();
29-
}
30-
31-
fResource = resource;
32-
if (fResource) {
33-
fResource->ref();
34-
}
35-
}
36-
37-
explicit operator bool() const { return SkToBool(fResource); }
38-
39-
GrSurfaceProxy* get() const { return fResource; }
40-
GrSurfaceProxy* operator->() const { return fResource; }
41-
42-
private:
43-
bool operator==(const GrProxyPendingIO& other) const = delete;
44-
45-
GrSurfaceProxy* fResource = nullptr;
46-
};
47-
4816
/**
4917
* Helper for owning a pending read, write, read-write on a GrGpuResource. It never owns a regular
5018
* ref.

src/gpu/GrPipeline.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ GrPipeline::GrPipeline(const InitArgs& args,
4242
if (args.fDstProxy.proxy()) {
4343
SkASSERT(args.fDstProxy.proxy()->isInstantiated());
4444

45-
fDstTextureProxy.reset(args.fDstProxy.proxy());
45+
fDstTextureProxy = args.fDstProxy.refProxy();
4646
fDstTextureOffset = args.fDstProxy.offset();
4747
}
4848

@@ -75,7 +75,7 @@ GrPipeline::GrPipeline(const InitArgs& args,
7575
}
7676

7777
GrXferBarrierType GrPipeline::xferBarrierType(GrTexture* texture, const GrCaps& caps) const {
78-
if (fDstTextureProxy.get() && fDstTextureProxy.get()->peekTexture() == texture) {
78+
if (fDstTextureProxy && fDstTextureProxy->peekTexture() == texture) {
7979
return kTexture_GrXferBarrierType;
8080
}
8181
return this->getXferProcessor().xferBarrierType(caps);

src/gpu/GrPipeline.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class GrPipeline {
142142
*offset = fDstTextureOffset;
143143
}
144144

145-
return fDstTextureProxy ? fDstTextureProxy->asTextureProxy() : nullptr;
145+
return fDstTextureProxy.get();
146146
}
147147

148148
GrTexture* peekDstTexture(SkIPoint* offset = nullptr) const {
@@ -218,7 +218,7 @@ class GrPipeline {
218218

219219
using FragmentProcessorArray = SkAutoSTArray<8, std::unique_ptr<const GrFragmentProcessor>>;
220220

221-
GrProxyPendingIO fDstTextureProxy;
221+
sk_sp<GrTextureProxy> fDstTextureProxy;
222222
SkIPoint fDstTextureOffset;
223223
GrWindowRectsState fWindowRectsState;
224224
const GrUserStencilSettings* fUserStencilSettings;

src/gpu/GrXferProcessor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class GrXferProcessor : public GrProcessor, public GrNonAtomicRef<GrXferProcesso
8787
void setOffset(int ox, int oy) { fOffset.set(ox, oy); }
8888

8989
GrTextureProxy* proxy() const { return fProxy.get(); }
90+
sk_sp<GrTextureProxy> refProxy() const { return fProxy; }
9091

9192
void setProxy(sk_sp<GrTextureProxy> proxy) {
9293
fProxy = std::move(proxy);

src/gpu/ops/GrCopySurfaceOp.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ class GrCopySurfaceOp final : public GrOp {
4949
GrCopySurfaceOp(GrSurfaceProxy* src, GrSurfaceProxy* dst, const SkIRect& srcRect,
5050
const SkIPoint& dstPoint)
5151
: INHERITED(ClassID())
52-
, fSrc(src)
53-
, fDst(dst)
52+
, fSrc(sk_ref_sp(src))
53+
, fDst(sk_ref_sp(dst))
5454
, fSrcRect(srcRect)
5555
, fDstPoint(dstPoint) {
5656
SkRect bounds =
@@ -72,10 +72,10 @@ class GrCopySurfaceOp final : public GrOp {
7272

7373
void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
7474

75-
GrProxyPendingIO fSrc;
76-
GrProxyPendingIO fDst;
77-
SkIRect fSrcRect;
78-
SkIPoint fDstPoint;
75+
sk_sp<GrSurfaceProxy> fSrc;
76+
sk_sp<GrSurfaceProxy> fDst;
77+
SkIRect fSrcRect;
78+
SkIPoint fDstPoint;
7979

8080
typedef GrOp INHERITED;
8181
};

tests/ProxyRefTest.cpp

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
6262
GrResourceProvider* resourceProvider = ctxInfo.grContext()->priv().resourceProvider();
6363

6464
for (auto make : { make_deferred, make_wrapped }) {
65-
// Pending IO ref
65+
// An extra ref
6666
{
6767
sk_sp<GrTextureProxy> proxy((*make)(ctxInfo.grContext()));
68-
if (proxy.get()) {
69-
GrProxyPendingIO pendingIO(proxy.get());
68+
if (proxy) {
69+
sk_sp<GrTextureProxy> extraRef(proxy);
7070

7171
int backingRefs = proxy->isInstantiated() ? 1 : -1;
7272

@@ -103,23 +103,18 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
103103
// Continue using (reffing) proxy after instantiation
104104
{
105105
sk_sp<GrTextureProxy> proxy((*make)(ctxInfo.grContext()));
106-
if (proxy.get()) {
107-
proxy->ref();
108-
109-
GrProxyPendingIO pendingIO(proxy.get());
106+
if (proxy) {
107+
sk_sp<GrTextureProxy> firstExtraRef(proxy);
110108

111109
int backingRefs = proxy->isInstantiated() ? 1 : -1;
112110

113-
check_refs(reporter, proxy.get(), 3, backingRefs);
111+
check_refs(reporter, proxy.get(), 2, backingRefs);
114112

115113
proxy->instantiate(resourceProvider);
116114

117-
check_refs(reporter, proxy.get(), 3, 1);
118-
119-
proxy->unref();
120115
check_refs(reporter, proxy.get(), 2, 1);
121116

122-
GrProxyPendingIO secondPendingIO(proxy.get());
117+
sk_sp<GrTextureProxy> secondExtraRef(proxy);
123118
check_refs(reporter, proxy.get(), 3, 1);
124119
}
125120
check_refs(reporter, proxy.get(), 1, 1);

0 commit comments

Comments
 (0)