| Index: include/gpu/GrGpuResourceRef.h
|
| diff --git a/include/gpu/GrGpuResourceRef.h b/include/gpu/GrGpuResourceRef.h
|
| index 4511adce6823523a69e25d3fd25233285dff66d6..a282672de714c390e95cbaa48c5c22519607f341 100644
|
| --- a/include/gpu/GrGpuResourceRef.h
|
| +++ b/include/gpu/GrGpuResourceRef.h
|
| @@ -39,6 +39,11 @@ public:
|
| ~GrGpuResourceRef();
|
|
|
| GrGpuResource* getResource() const { return fResource; }
|
| + GrGpuResource* getDst() const {
|
| + SkASSERT(fIOType == kRead_GrIOType || fIOType == kRW_GrIOType);
|
| + SkASSERT(fDst);
|
| + return fDst;
|
| + }
|
|
|
| /** Does this object own a pending read or write on the resource it is wrapping. */
|
| bool ownsPendingIO() const { return fPendingIO; }
|
| @@ -52,11 +57,11 @@ protected:
|
|
|
| /** Adopts a ref from the caller. ioType expresses what type of IO operations will be marked as
|
| pending on the resource when markPendingIO is called. */
|
| - GrGpuResourceRef(GrGpuResource*, GrIOType);
|
| + GrGpuResourceRef(GrGpuResource*, GrIOType, GrGpuResource* dst);
|
|
|
| /** Adopts a ref from the caller. ioType expresses what type of IO operations will be marked as
|
| pending on the resource when markPendingIO is called. */
|
| - void setResource(GrGpuResource*, GrIOType);
|
| + void setResource(GrGpuResource*, GrIOType, GrGpuResource* dst);
|
|
|
| private:
|
| /** Called by owning GrProgramElement when the program element is first scheduled for
|
| @@ -81,6 +86,7 @@ private:
|
| mutable bool fOwnRef;
|
| mutable bool fPendingIO;
|
| GrIOType fIOType;
|
| + GrGpuResource* fDst;
|
|
|
| typedef SkNoncopyable INHERITED;
|
| };
|
| @@ -100,7 +106,7 @@ public:
|
|
|
| /** Adopts a ref from the caller. ioType expresses what type of IO operations will be marked as
|
| pending on the resource when markPendingIO is called. */
|
| - void set(T* resource, GrIOType ioType) { this->setResource(resource, ioType); }
|
| + void set(T* resource, GrIOType ioType, T* dst) { this->setResource(resource, ioType, dst); }
|
|
|
| private:
|
| typedef GrGpuResourceRef INHERITED;
|
| @@ -111,7 +117,7 @@ template<> class GrTGpuResourceRef<GrTexture> : public GrGpuResourceRef {
|
| public:
|
| GrTGpuResourceRef() {}
|
|
|
| - GrTGpuResourceRef(GrTexture* texture, GrIOType ioType) : INHERITED(texture, ioType) { }
|
| + GrTGpuResourceRef(GrTexture* texture, GrIOType ioType, GrRenderTarget* dst) : INHERITED(texture, ioType, dst) { }
|
|
|
| GrTexture* get() const {
|
| GrSurface* surface = static_cast<GrSurface*>(this->getResource());
|
| @@ -122,7 +128,7 @@ public:
|
| }
|
| }
|
|
|
| - void set(GrTexture* texture, GrIOType ioType) { this->setResource(texture, ioType); }
|
| + void set(GrTexture* texture, GrIOType ioType, GrRenderTarget* dst) { this->setResource(texture, ioType, dst); }
|
|
|
| private:
|
| typedef GrGpuResourceRef INHERITED;
|
| @@ -132,7 +138,7 @@ template<> class GrTGpuResourceRef<GrRenderTarget> : public GrGpuResourceRef {
|
| public:
|
| GrTGpuResourceRef() {}
|
|
|
| - GrTGpuResourceRef(GrRenderTarget* rt, GrIOType ioType) : INHERITED(rt, ioType) { }
|
| + GrTGpuResourceRef(GrRenderTarget* rt, GrIOType ioType, GrRenderTarget* dst) : INHERITED(rt, ioType, dst) { }
|
|
|
| GrRenderTarget* get() const {
|
| GrSurface* surface = static_cast<GrSurface*>(this->getResource());
|
| @@ -143,7 +149,7 @@ public:
|
| }
|
| }
|
|
|
| - void set(GrRenderTarget* rt, GrIOType ioType) { this->setResource(rt, ioType); }
|
| + void set(GrRenderTarget* rt, GrIOType ioType, GrRenderTarget* dst) { this->setResource(rt, ioType, dst); }
|
|
|
| private:
|
| typedef GrGpuResourceRef INHERITED;
|
| @@ -155,21 +161,21 @@ private:
|
| */
|
| template <typename T, GrIOType IO_TYPE> class GrPendingIOResource : SkNoncopyable {
|
| public:
|
| - GrPendingIOResource(T* resource = NULL) : fResource(NULL) {
|
| - this->reset(resource);
|
| + GrPendingIOResource(T* resource = NULL, GrGpuResource* dst = NULL) : fResource(NULL) {
|
| + this->reset(resource, dst);
|
| }
|
|
|
| - void reset(T* resource) {
|
| + void reset(T* resource, GrGpuResource* dst) {
|
| if (resource) {
|
| switch (IO_TYPE) {
|
| case kRead_GrIOType:
|
| - resource->addPendingRead();
|
| + resource->addPendingRead(dst);
|
| break;
|
| case kWrite_GrIOType:
|
| resource->addPendingWrite();
|
| break;
|
| case kRW_GrIOType:
|
| - resource->addPendingRead();
|
| + resource->addPendingRead(dst);
|
| resource->addPendingWrite();
|
| break;
|
| }
|
|
|