blob: 23f62195c21f0f88229a57b6daa0f90407e5400b [file] [log] [blame]
robertphillips76948d42016-05-04 12:47:41 -07001/*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef GrSurfaceProxy_DEFINED
9#define GrSurfaceProxy_DEFINED
10
11#include "GrGpuResource.h"
Robert Phillipsc7635fa2016-10-28 13:25:24 -040012#include "GrSurface.h"
Robert Phillips93f16332016-11-23 19:37:13 -050013
csmartdaltonbf4a8f92016-09-06 10:01:06 -070014#include "SkRect.h"
robertphillips76948d42016-05-04 12:47:41 -070015
Greg Daniel7ef28f32017-04-20 16:41:55 +000016class GrBackendTexture;
Robert Phillips37430132016-11-09 06:50:43 -050017class GrCaps;
Robert Phillipsc589b0b2017-04-17 07:53:07 -040018class GrOpList;
Brian Osman45580d32016-11-23 09:37:01 -050019class GrRenderTargetOpList;
20class GrRenderTargetProxy;
Brian Osman32342f02017-03-04 08:12:46 -050021class GrResourceProvider;
Robert Phillipsd46697a2017-01-25 12:10:37 -050022class GrSurfaceContext;
Robert Phillips757914d2017-01-25 15:48:30 -050023class GrSurfaceProxyPriv;
Brian Osman45580d32016-11-23 09:37:01 -050024class GrTextureOpList;
robertphillips76948d42016-05-04 12:47:41 -070025class GrTextureProxy;
robertphillips76948d42016-05-04 12:47:41 -070026
Robert Phillipsc7635fa2016-10-28 13:25:24 -040027// This class replicates the functionality GrIORef<GrSurface> but tracks the
28// utilitization for later resource allocation (for the deferred case) and
29// forwards on the utilization in the wrapped case
30class GrIORefProxy : public SkNoncopyable {
31public:
32 void ref() const {
33 this->validate();
34
35 ++fRefCnt;
36 if (fTarget) {
37 fTarget->ref();
38 }
39 }
40
41 void unref() const {
42 this->validate();
43
44 if (fTarget) {
45 fTarget->unref();
46 }
47
Robert Phillipsb6deea82017-05-11 14:14:30 -040048 --fRefCnt;
49 this->didRemoveRefOrPendingIO();
Robert Phillipsc7635fa2016-10-28 13:25:24 -040050 }
51
52 void validate() const {
Robert Phillipsb6deea82017-05-11 14:14:30 -040053#ifdef SK_DEBUG
54 SkASSERT(fRefCnt >= 0);
robertphillips1125a032016-11-16 11:17:17 -080055 SkASSERT(fPendingReads >= 0);
56 SkASSERT(fPendingWrites >= 0);
57 SkASSERT(fRefCnt + fPendingReads + fPendingWrites >= 1);
58
59 if (fTarget) {
robertphillips1125a032016-11-16 11:17:17 -080060 // The backing GrSurface can have more refs than the proxy if the proxy
61 // started off wrapping an external resource (that came in with refs).
62 // The GrSurface should never have fewer refs than the proxy however.
63 SkASSERT(fTarget->fRefCnt >= fRefCnt);
Robert Phillipsb6deea82017-05-11 14:14:30 -040064 SkASSERT(fTarget->fPendingReads >= fPendingReads);
65 SkASSERT(fTarget->fPendingWrites >= fPendingWrites);
robertphillips1125a032016-11-16 11:17:17 -080066 }
Robert Phillipsc7635fa2016-10-28 13:25:24 -040067#endif
68 }
69
robertphillips1125a032016-11-16 11:17:17 -080070 int32_t getProxyRefCnt_TestOnly() const;
71 int32_t getBackingRefCnt_TestOnly() const;
72 int32_t getPendingReadCnt_TestOnly() const;
73 int32_t getPendingWriteCnt_TestOnly() const;
74
Brian Salomoncf75b002017-08-16 10:42:09 -040075 void addPendingRead() const {
76 this->validate();
77
78 ++fPendingReads;
79 if (fTarget) {
80 fTarget->addPendingRead();
81 }
82 }
83
84 void completedRead() const {
85 this->validate();
86
87 if (fTarget) {
88 fTarget->completedRead();
89 }
90
91 --fPendingReads;
92 this->didRemoveRefOrPendingIO();
93 }
94
95 void addPendingWrite() const {
96 this->validate();
97
98 ++fPendingWrites;
99 if (fTarget) {
100 fTarget->addPendingWrite();
101 }
102 }
103
104 void completedWrite() const {
105 this->validate();
106
107 if (fTarget) {
108 fTarget->completedWrite();
109 }
110
111 --fPendingWrites;
112 this->didRemoveRefOrPendingIO();
113 }
114
Robert Phillipsc7635fa2016-10-28 13:25:24 -0400115protected:
robertphillips1125a032016-11-16 11:17:17 -0800116 GrIORefProxy() : fTarget(nullptr), fRefCnt(1), fPendingReads(0), fPendingWrites(0) {}
117 GrIORefProxy(sk_sp<GrSurface> surface) : fRefCnt(1), fPendingReads(0), fPendingWrites(0) {
Robert Phillipsc7635fa2016-10-28 13:25:24 -0400118 // Since we're manually forwarding on refs & unrefs we don't want sk_sp doing
119 // anything extra.
120 fTarget = surface.release();
121 }
122 virtual ~GrIORefProxy() {
123 // We don't unref 'fTarget' here since the 'unref' method will already
124 // have forwarded on the unref call that got use here.
125 }
126
robertphillips1125a032016-11-16 11:17:17 -0800127 // This GrIORefProxy was deferred before but has just been instantiated. To
128 // make all the reffing & unreffing work out we now need to transfer any deferred
129 // refs & unrefs to the new GrSurface
130 void transferRefs() {
131 SkASSERT(fTarget);
132
Robert Phillipsf8e25022017-11-08 15:24:31 -0500133 SkASSERT(fTarget->fRefCnt > 0);
Robert Phillips2d9cb572017-11-13 13:38:05 +0000134 fTarget->fRefCnt += (fRefCnt-1); // don't xfer the proxy's creation ref
robertphillips1125a032016-11-16 11:17:17 -0800135 fTarget->fPendingReads += fPendingReads;
136 fTarget->fPendingWrites += fPendingWrites;
robertphillips1125a032016-11-16 11:17:17 -0800137 }
Robert Phillipsc7635fa2016-10-28 13:25:24 -0400138
Robert Phillips757914d2017-01-25 15:48:30 -0500139 bool internalHasPendingIO() const {
140 if (fTarget) {
141 return fTarget->internalHasPendingIO();
142 }
143
144 return SkToBool(fPendingWrites | fPendingReads);
145 }
146
Robert Phillips7ee385e2017-03-30 08:02:11 -0400147 bool internalHasPendingWrite() const {
148 if (fTarget) {
149 return fTarget->internalHasPendingWrite();
150 }
151
152 return SkToBool(fPendingWrites);
153 }
154
Robert Phillipsc7635fa2016-10-28 13:25:24 -0400155 // For deferred proxies this will be null. For wrapped proxies it will point to the
156 // wrapped resource.
157 GrSurface* fTarget;
robertphillips1125a032016-11-16 11:17:17 -0800158
159private:
160 // This class is used to manage conversion of refs to pending reads/writes.
Robert Phillipsb6deea82017-05-11 14:14:30 -0400161 friend class GrSurfaceProxyRef;
robertphillips1125a032016-11-16 11:17:17 -0800162 template <typename, GrIOType> friend class GrPendingIOResource;
163
Robert Phillipsb6deea82017-05-11 14:14:30 -0400164 void didRemoveRefOrPendingIO() const {
165 if (0 == fPendingReads && 0 == fPendingWrites && 0 == fRefCnt) {
166 delete this;
167 }
robertphillips1125a032016-11-16 11:17:17 -0800168 }
169
170 mutable int32_t fRefCnt;
171 mutable int32_t fPendingReads;
172 mutable int32_t fPendingWrites;
Robert Phillipsc7635fa2016-10-28 13:25:24 -0400173};
174
175class GrSurfaceProxy : public GrIORefProxy {
robertphillips76948d42016-05-04 12:47:41 -0700176public:
Robert Phillips066f0202017-07-25 10:16:35 -0400177 static sk_sp<GrSurfaceProxy> MakeWrapped(sk_sp<GrSurface>, GrSurfaceOrigin);
178 static sk_sp<GrTextureProxy> MakeWrapped(sk_sp<GrTexture>, GrSurfaceOrigin);
Robert Phillips37430132016-11-09 06:50:43 -0500179
Robert Phillips26c90e02017-03-14 14:39:29 -0400180 static sk_sp<GrTextureProxy> MakeDeferred(GrResourceProvider*,
Robert Phillips7928e762017-02-28 16:30:28 -0500181 const GrSurfaceDesc&, SkBackingFit,
182 SkBudgeted, uint32_t flags = 0);
Robert Phillips37430132016-11-09 06:50:43 -0500183
Robert Phillips8e8c7552017-07-10 12:06:05 -0400184 /**
185 * Creates a proxy that will be mipmapped.
186 *
187 * @param desc Description of the texture properties.
188 * @param budgeted Does the texture count against the resource cache budget?
189 * @param texels A contiguous array of mipmap levels
190 * @param mipLevelCount The amount of elements in the texels array
191 */
192 static sk_sp<GrTextureProxy> MakeDeferredMipMap(GrResourceProvider*,
193 const GrSurfaceDesc& desc, SkBudgeted budgeted,
Robert Phillips590533f2017-07-11 14:22:35 -0400194 const GrMipLevel texels[], int mipLevelCount,
Robert Phillips8e8c7552017-07-10 12:06:05 -0400195 SkDestinationSurfaceColorMode mipColorMode =
196 SkDestinationSurfaceColorMode::kLegacy);
197
Greg Daniele1da1d92017-10-06 15:59:27 -0400198 /**
199 * Like the call above but there are no texels to upload. A texture proxy is returned that
200 * simply has space allocated for the mips. We will allocated the full amount of mip levels
201 * based on the width and height in the GrSurfaceDesc.
202 */
203 static sk_sp<GrTextureProxy> MakeDeferredMipMap(GrResourceProvider*,
204 const GrSurfaceDesc& desc, SkBudgeted budgeted);
205
206
Robert Phillips37430132016-11-09 06:50:43 -0500207 // TODO: need to refine ownership semantics of 'srcData' if we're in completely
208 // deferred mode
Robert Phillips26c90e02017-03-14 14:39:29 -0400209 static sk_sp<GrTextureProxy> MakeDeferred(GrResourceProvider*,
Robert Phillips37430132016-11-09 06:50:43 -0500210 const GrSurfaceDesc&, SkBudgeted,
211 const void* srcData, size_t rowBytes);
212
Greg Daniel7ef28f32017-04-20 16:41:55 +0000213 static sk_sp<GrTextureProxy> MakeWrappedBackend(GrContext*, GrBackendTexture&, GrSurfaceOrigin);
Robert Phillips26caf892017-01-27 10:58:31 -0500214
robertphillips76948d42016-05-04 12:47:41 -0700215 GrSurfaceOrigin origin() const {
Brian Salomonbb5711a2017-05-17 13:49:59 -0400216 SkASSERT(kTopLeft_GrSurfaceOrigin == fOrigin || kBottomLeft_GrSurfaceOrigin == fOrigin);
217 return fOrigin;
robertphillips76948d42016-05-04 12:47:41 -0700218 }
Brian Salomonbb5711a2017-05-17 13:49:59 -0400219 int width() const { return fWidth; }
220 int height() const { return fHeight; }
Robert Phillipsa108c922017-10-10 10:42:19 -0400221 int worstCaseWidth() const;
222 int worstCaseHeight() const;
Brian Salomonbb5711a2017-05-17 13:49:59 -0400223 GrPixelConfig config() const { return fConfig; }
robertphillips76948d42016-05-04 12:47:41 -0700224
Robert Phillips294870f2016-11-11 12:38:40 -0500225 class UniqueID {
226 public:
Robert Phillips7ee385e2017-03-30 08:02:11 -0400227 static UniqueID InvalidID() {
228 return UniqueID(uint32_t(SK_InvalidUniqueID));
229 }
230
Robert Phillips294870f2016-11-11 12:38:40 -0500231 // wrapped
232 explicit UniqueID(const GrGpuResource::UniqueID& id) : fID(id.asUInt()) { }
233 // deferred
234 UniqueID() : fID(GrGpuResource::CreateUniqueID()) { }
235
236 uint32_t asUInt() const { return fID; }
237
238 bool operator==(const UniqueID& other) const {
239 return fID == other.fID;
240 }
241 bool operator!=(const UniqueID& other) const {
242 return !(*this == other);
243 }
244
Robert Phillips7ee385e2017-03-30 08:02:11 -0400245 void makeInvalid() { fID = SK_InvalidUniqueID; }
Robert Phillips294870f2016-11-11 12:38:40 -0500246 bool isInvalid() const { return SK_InvalidUniqueID == fID; }
247
248 private:
Robert Phillips7ee385e2017-03-30 08:02:11 -0400249 explicit UniqueID(uint32_t id) : fID(id) {}
250
251 uint32_t fID;
Robert Phillips294870f2016-11-11 12:38:40 -0500252 };
253
254 /*
255 * The contract for the uniqueID is:
256 * for wrapped resources:
257 * the uniqueID will match that of the wrapped resource
258 *
259 * for deferred resources:
260 * the uniqueID will be different from the real resource, when it is allocated
261 * the proxy's uniqueID will not change across the instantiate call
262 *
263 * the uniqueIDs of the proxies and the resources draw from the same pool
264 *
265 * What this boils down to is that the uniqueID of a proxy can be used to consistently
266 * track/identify a proxy but should never be used to distinguish between
267 * resources and proxies - beware!
268 */
269 UniqueID uniqueID() const { return fUniqueID; }
robertphillips76948d42016-05-04 12:47:41 -0700270
Robert Phillips159e3c62017-06-19 12:02:00 -0400271 UniqueID underlyingUniqueID() const {
272 if (fTarget) {
273 return UniqueID(fTarget->uniqueID());
274 }
275
276 return fUniqueID;
277 }
278
Robert Phillipseee4d6e2017-06-05 09:26:07 -0400279 virtual bool instantiate(GrResourceProvider* resourceProvider) = 0;
Robert Phillips37430132016-11-09 06:50:43 -0500280
robertphillips76948d42016-05-04 12:47:41 -0700281 /**
robertphillips13a7eee2016-08-31 15:06:24 -0700282 * Helper that gets the width and height of the surface as a bounding rectangle.
283 */
284 SkRect getBoundsRect() const { return SkRect::MakeIWH(this->width(), this->height()); }
Robert Phillips784b7bf2016-12-09 13:35:02 -0500285
robertphillips13a7eee2016-08-31 15:06:24 -0700286 /**
robertphillips76948d42016-05-04 12:47:41 -0700287 * @return the texture proxy associated with the surface proxy, may be NULL.
288 */
289 virtual GrTextureProxy* asTextureProxy() { return nullptr; }
290 virtual const GrTextureProxy* asTextureProxy() const { return nullptr; }
291
292 /**
293 * @return the render target proxy associated with the surface proxy, may be NULL.
294 */
295 virtual GrRenderTargetProxy* asRenderTargetProxy() { return nullptr; }
296 virtual const GrRenderTargetProxy* asRenderTargetProxy() const { return nullptr; }
297
robertphillips13a7eee2016-08-31 15:06:24 -0700298 /**
299 * Does the resource count against the resource budget?
300 */
301 SkBudgeted isBudgeted() const { return fBudgeted; }
302
Robert Phillipsf2361d22016-10-25 14:20:06 -0400303 void setLastOpList(GrOpList* opList);
304 GrOpList* getLastOpList() { return fLastOpList; }
305
Brian Osman45580d32016-11-23 09:37:01 -0500306 GrRenderTargetOpList* getLastRenderTargetOpList();
307 GrTextureOpList* getLastTextureOpList();
308
Robert Phillips8bc06d02016-11-01 17:28:40 -0400309 /**
Robert Phillipsf5442bb2017-04-17 14:18:34 -0400310 * Retrieves the amount of GPU memory that will be or currently is used by this resource
Robert Phillips8bc06d02016-11-01 17:28:40 -0400311 * in bytes. It is approximate since we aren't aware of additional padding or copies made
312 * by the driver.
313 *
314 * @return the amount of GPU memory used in bytes
315 */
316 size_t gpuMemorySize() const {
Brian Salomonbb5711a2017-05-17 13:49:59 -0400317 if (fTarget) {
318 return fTarget->gpuMemorySize();
319 }
Robert Phillips8bc06d02016-11-01 17:28:40 -0400320 if (kInvalidGpuMemorySize == fGpuMemorySize) {
Brian Salomonbb5711a2017-05-17 13:49:59 -0400321 fGpuMemorySize = this->onUninstantiatedGpuMemorySize();
Robert Phillips8bc06d02016-11-01 17:28:40 -0400322 SkASSERT(kInvalidGpuMemorySize != fGpuMemorySize);
323 }
324 return fGpuMemorySize;
325 }
326
Robert Phillipse2f7d182016-12-15 09:23:05 -0500327 // Helper function that creates a temporary SurfaceContext to perform the copy
Robert Phillips0ae6faa2017-03-21 16:22:00 -0400328 // It always returns a kExact-backed proxy bc it is used when converting an SkSpecialImage
Brian Salomon63e79732017-05-15 21:23:13 -0400329 // to an SkImage. The copy is is not a render target and not multisampled.
Greg Daniel65c7f662017-10-30 13:39:09 -0400330 static sk_sp<GrTextureProxy> Copy(GrContext*, GrSurfaceProxy* src, GrMipMapped,
Robert Phillipse2f7d182016-12-15 09:23:05 -0500331 SkIRect srcRect, SkBudgeted);
332
333 // Copy the entire 'src'
Robert Phillips0ae6faa2017-03-21 16:22:00 -0400334 // It always returns a kExact-backed proxy bc it is used in SkGpuDevice::snapSpecial
Greg Daniel65c7f662017-10-30 13:39:09 -0400335 static sk_sp<GrTextureProxy> Copy(GrContext* context, GrSurfaceProxy* src, GrMipMapped,
Robert Phillips63c67462017-02-15 14:19:01 -0500336 SkBudgeted budgeted);
Robert Phillipse2f7d182016-12-15 09:23:05 -0500337
338 // Test-only entry point - should decrease in use as proxies propagate
Robert Phillipsd46697a2017-01-25 12:10:37 -0500339 static sk_sp<GrSurfaceContext> TestCopy(GrContext* context, const GrSurfaceDesc& dstDesc,
340 GrSurfaceProxy* srcProxy);
Robert Phillipse2f7d182016-12-15 09:23:05 -0500341
Robert Phillipseaa86252016-11-08 13:49:39 +0000342 bool isWrapped_ForTesting() const;
343
Brian Osman45580d32016-11-23 09:37:01 -0500344 SkDEBUGCODE(void validate(GrContext*) const;)
345
Robert Phillips757914d2017-01-25 15:48:30 -0500346 // Provides access to functions that aren't part of the public API.
Robert Phillips420c4cf2017-09-28 09:00:45 -0400347 inline GrSurfaceProxyPriv priv();
348 inline const GrSurfaceProxyPriv priv() const;
Robert Phillips757914d2017-01-25 15:48:30 -0500349
robertphillips76948d42016-05-04 12:47:41 -0700350protected:
robertphillips8abb3702016-08-31 14:04:06 -0700351 // Deferred version
Robert Phillipsc787e492017-02-28 11:26:32 -0500352 GrSurfaceProxy(const GrSurfaceDesc& desc, SkBackingFit fit, SkBudgeted budgeted, uint32_t flags)
Brian Salomonbb5711a2017-05-17 13:49:59 -0400353 : fConfig(desc.fConfig)
354 , fWidth(desc.fWidth)
355 , fHeight(desc.fHeight)
356 , fOrigin(desc.fOrigin)
357 , fFit(fit)
358 , fBudgeted(budgeted)
359 , fFlags(flags)
Brian Salomond17b4a62017-05-23 16:53:47 -0400360 , fNeedsClear(SkToBool(desc.fFlags & kPerformInitialClear_GrSurfaceFlag))
Brian Salomonbb5711a2017-05-17 13:49:59 -0400361 , fGpuMemorySize(kInvalidGpuMemorySize)
362 , fLastOpList(nullptr) {
Robert Phillips294870f2016-11-11 12:38:40 -0500363 // Note: this ctor pulls a new uniqueID from the same pool at the GrGpuResources
robertphillips8abb3702016-08-31 14:04:06 -0700364 }
365
366 // Wrapped version
Robert Phillips066f0202017-07-25 10:16:35 -0400367 GrSurfaceProxy(sk_sp<GrSurface> surface, GrSurfaceOrigin origin, SkBackingFit fit);
robertphillips76948d42016-05-04 12:47:41 -0700368
Robert Phillipsf2361d22016-10-25 14:20:06 -0400369 virtual ~GrSurfaceProxy();
370
Robert Phillips757914d2017-01-25 15:48:30 -0500371 friend class GrSurfaceProxyPriv;
372
373 // Methods made available via GrSurfaceProxyPriv
374 bool hasPendingIO() const {
375 return this->internalHasPendingIO();
376 }
377
Robert Phillips7ee385e2017-03-30 08:02:11 -0400378 bool hasPendingWrite() const {
379 return this->internalHasPendingWrite();
380 }
381
Robert Phillips57aa3672017-07-21 11:38:13 -0400382 void computeScratchKey(GrScratchKey*) const;
383
Robert Phillips5af44de2017-07-18 14:49:38 -0400384 virtual sk_sp<GrSurface> createSurface(GrResourceProvider*) const = 0;
385 void assign(sk_sp<GrSurface> surface);
386
Robert Phillips65048132017-08-10 08:44:49 -0400387 sk_sp<GrSurface> createSurfaceImpl(GrResourceProvider*, int sampleCnt, bool needsStencil,
Greg Daniele252f082017-10-23 16:05:23 -0400388 GrSurfaceFlags flags, GrMipMapped mipMapped,
Robert Phillips5af44de2017-07-18 14:49:38 -0400389 SkDestinationSurfaceColorMode mipColorMode) const;
390
Robert Phillips65048132017-08-10 08:44:49 -0400391 bool instantiateImpl(GrResourceProvider* resourceProvider, int sampleCnt, bool needsStencil,
Greg Daniele252f082017-10-23 16:05:23 -0400392 GrSurfaceFlags flags, GrMipMapped mipMapped,
Robert Phillipsae7d3f32017-09-21 08:26:08 -0400393 SkDestinationSurfaceColorMode mipColorMode, const GrUniqueKey*);
Brian Salomonbb5711a2017-05-17 13:49:59 -0400394
395 // For wrapped resources, 'fConfig', 'fWidth', 'fHeight', and 'fOrigin; will always be filled in
396 // from the wrapped resource.
397 GrPixelConfig fConfig;
398 int fWidth;
399 int fHeight;
400 GrSurfaceOrigin fOrigin;
Robert Phillips0ae6faa2017-03-21 16:22:00 -0400401 SkBackingFit fFit; // always exact for wrapped resources
Robert Phillipsb726d582017-03-09 16:36:32 -0500402 mutable SkBudgeted fBudgeted; // set from the backing resource for wrapped resources
403 // mutable bc of SkSurface/SkImage wishy-washiness
Robert Phillipsc787e492017-02-28 11:26:32 -0500404 const uint32_t fFlags;
Robert Phillipsa4c41b32017-03-15 13:02:45 -0400405
Robert Phillips294870f2016-11-11 12:38:40 -0500406 const UniqueID fUniqueID; // set from the backing resource for wrapped resources
robertphillips76948d42016-05-04 12:47:41 -0700407
Robert Phillips8bc06d02016-11-01 17:28:40 -0400408 static const size_t kInvalidGpuMemorySize = ~static_cast<size_t>(0);
Robert Phillips29e52f12016-11-03 10:19:14 -0400409 SkDEBUGCODE(size_t getRawGpuMemorySize_debugOnly() const { return fGpuMemorySize; })
410
411private:
Brian Salomonbb5711a2017-05-17 13:49:59 -0400412 virtual size_t onUninstantiatedGpuMemorySize() const = 0;
Robert Phillips29e52f12016-11-03 10:19:14 -0400413
Brian Salomond17b4a62017-05-23 16:53:47 -0400414 bool fNeedsClear;
415
Robert Phillips8bc06d02016-11-01 17:28:40 -0400416 // This entry is lazily evaluated so, when the proxy wraps a resource, the resource
417 // will be called but, when the proxy is deferred, it will compute the answer itself.
418 // If the proxy computes its own answer that answer is checked (in debug mode) in
419 // the instantiation method.
420 mutable size_t fGpuMemorySize;
421
Robert Phillipsf2361d22016-10-25 14:20:06 -0400422 // The last opList that wrote to or is currently going to write to this surface
Robert Phillipsb6deea82017-05-11 14:14:30 -0400423 // The opList can be closed (e.g., no surface context is currently bound
424 // to this proxy).
Robert Phillipsf2361d22016-10-25 14:20:06 -0400425 // This back-pointer is required so that we can add a dependancy between
426 // the opList used to create the current contents of this surface
427 // and the opList of a destination surface to which this one is being drawn or copied.
Robert Phillips6cdc22c2017-05-11 16:29:14 -0400428 // This pointer is unreffed. OpLists own a ref on their surface proxies.
Robert Phillipsf2361d22016-10-25 14:20:06 -0400429 GrOpList* fLastOpList;
430
Robert Phillipsc7635fa2016-10-28 13:25:24 -0400431 typedef GrIORefProxy INHERITED;
robertphillips76948d42016-05-04 12:47:41 -0700432};
433
434#endif