| Index: include/gpu/GrGpuResource.h
|
| diff --git a/include/gpu/GrGpuResource.h b/include/gpu/GrGpuResource.h
|
| index 8103959984b14ccf5a7fde91783b5a8120eda178..27d911852a33412c52d2e005575d5ebf7d0b1956 100644
|
| --- a/include/gpu/GrGpuResource.h
|
| +++ b/include/gpu/GrGpuResource.h
|
| @@ -139,35 +139,6 @@ private:
|
| */
|
| class SK_API GrGpuResource : public GrIORef<GrGpuResource> {
|
| public:
|
| -
|
| -
|
| - enum LifeCycle {
|
| - /**
|
| - * The resource is cached and owned by Skia. Resources with this status may be kept alive
|
| - * by the cache as either scratch or unique resources even when there are no refs to them.
|
| - * The cache may release them whenever there are no refs.
|
| - */
|
| - kCached_LifeCycle,
|
| -
|
| - /**
|
| - * The resource is uncached. As soon as there are no more refs to it, it is released. Under
|
| - * the hood the cache may opaquely recycle it as a cached resource.
|
| - */
|
| - kUncached_LifeCycle,
|
| -
|
| - /**
|
| - * Similar to uncached, but Skia does not manage the lifetime of the underlying backend
|
| - * 3D API object(s). The client is responsible for freeing those. Used to inject client-
|
| - * created GPU resources into Skia (e.g. to render to a client-created texture).
|
| - */
|
| - kBorrowed_LifeCycle,
|
| -
|
| - /**
|
| - * An external resource with ownership transfered into Skia. Skia will free the resource.
|
| - */
|
| - kAdopted_LifeCycle,
|
| - };
|
| -
|
| /**
|
| * Tests whether a object has been abandoned or released. All objects will
|
| * be in this state after their creating GrContext is destroyed or has
|
| @@ -190,11 +161,14 @@ public:
|
| GrContext* getContext();
|
|
|
| /**
|
| - * Retrieves the amount of GPU memory used by this resource in bytes. It is
|
| + * Retrieves the amount of GPU memory used by Skia through this resource in bytes. It is
|
| * approximate since we aren't aware of additional padding or copies made
|
| * by the driver.
|
| *
|
| - * @return the amount of GPU memory used in bytes
|
| + * If the resource refers to external backend objects, does not count the size of
|
| + * those objects.
|
| + *
|
| + * @return the amount of GPU memory used in bytes by Skia
|
| */
|
| size_t gpuMemorySize() const {
|
| if (kInvalidGpuMemorySize == fGpuMemorySize) {
|
| @@ -265,7 +239,7 @@ protected:
|
| // initialized (i.e. not in a base class constructor).
|
| void registerWithCache();
|
|
|
| - GrGpuResource(GrGpu*, LifeCycle);
|
| + GrGpuResource(GrGpu*, SkBudgeted);
|
| virtual ~GrGpuResource();
|
|
|
| GrGpu* getGpu() const { return fGpu; }
|
| @@ -277,12 +251,9 @@ protected:
|
| backend API calls should be made. */
|
| virtual void onAbandon() { }
|
|
|
| - bool shouldFreeResources() const { return fLifeCycle != kBorrowed_LifeCycle; }
|
| -
|
| - bool isExternal() const {
|
| - return GrGpuResource::kAdopted_LifeCycle == fLifeCycle ||
|
| - GrGpuResource::kBorrowed_LifeCycle == fLifeCycle;
|
| - }
|
| + /** Overridden to indicate whether the object references externally allocated backend API
|
| + * resources. */
|
| + virtual bool refsWrappedResources() const = 0;
|
|
|
| /**
|
| * This entry point should be called whenever gpuMemorySize() should report a different size.
|
| @@ -340,8 +311,7 @@ private:
|
| // is destroyed. Those calls set will this to NULL.
|
| GrGpu* fGpu;
|
| mutable size_t fGpuMemorySize;
|
| -
|
| - LifeCycle fLifeCycle;
|
| + SkBudgeted fBudgeted;
|
| const uint32_t fUniqueID;
|
|
|
| SkAutoTUnref<const SkData> fData;
|
|
|