| Index: include/gpu/GrProgramResource.h
|
| diff --git a/include/gpu/GrProgramResource.h b/include/gpu/GrProgramResource.h
|
| index 61e71ded19876fa35ceb30786fcf2e1882dc19fd..18cf4a70b79997d445841da38395f5e32bd00e99 100644
|
| --- a/include/gpu/GrProgramResource.h
|
| +++ b/include/gpu/GrProgramResource.h
|
| @@ -19,6 +19,8 @@ class GrGpuResource;
|
| */
|
| class GrProgramResource : SkNoncopyable {
|
| public:
|
| + SK_DECLARE_INST_COUNT_ROOT(GrProgramResource);
|
| +
|
| enum IOType {
|
| kRead_IOType,
|
| kWrite_IOType,
|
| @@ -27,21 +29,10 @@ public:
|
| kNone_IOType, // For internal use only, don't specify to constructor or setResource().
|
| };
|
|
|
| - SK_DECLARE_INST_COUNT_ROOT(GrProgramResource);
|
| - GrProgramResource();
|
| -
|
| - /** 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. */
|
| - explicit GrProgramResource(GrGpuResource*, IOType ioType);
|
| -
|
| ~GrProgramResource();
|
|
|
| GrGpuResource* getResource() const { return fResource; }
|
|
|
| - /** 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*, IOType ioType);
|
| -
|
| /** Does this object own a pending read or write on the resource it is wrapping. */
|
| bool ownsPendingIO() const { return fPendingIO; }
|
|
|
| @@ -49,6 +40,17 @@ public:
|
| is called. */
|
| void reset();
|
|
|
| +protected:
|
| + GrProgramResource();
|
| +
|
| + /** 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. */
|
| + GrProgramResource(GrGpuResource*, IOType);
|
| +
|
| + /** 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*, IOType);
|
| +
|
| private:
|
| /** Called by owning GrProgramElement when the program element is first scheduled for
|
| execution. */
|
| @@ -76,4 +78,20 @@ private:
|
| typedef SkNoncopyable INHERITED;
|
| };
|
|
|
| +template <typename T> class GrProgramTResource : public GrProgramResource {
|
| +public:
|
| + GrProgramTResource() {}
|
| +
|
| + /** 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. */
|
| + GrProgramTResource(T* resource, IOType ioType) : GrProgramResource(resource, ioType) {}
|
| +
|
| + T* get() const { return static_cast<T*>(this->getResource()); }
|
| +
|
| + /** 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, IOType ioType) { this->setResource(resource, ioType); }
|
| +};
|
| +
|
| +
|
| #endif
|
|
|