diff options
Diffstat (limited to 'src/gpu/gl')
-rw-r--r-- | src/gpu/gl/GrGLPath.h | 6 | ||||
-rw-r--r-- | src/gpu/gl/GrGLPathRange.h | 4 | ||||
-rw-r--r-- | src/gpu/gl/GrGLRenderTarget.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGLRenderTarget.h | 7 | ||||
-rw-r--r-- | src/gpu/gl/GrGLStencilBuffer.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGLStencilBuffer.h | 4 | ||||
-rw-r--r-- | src/gpu/gl/GrGLTextureRenderTarget.h | 12 | ||||
-rw-r--r-- | src/gpu/gl/GrGLVertexArray.h | 4 |
8 files changed, 23 insertions, 18 deletions
diff --git a/src/gpu/gl/GrGLPath.h b/src/gpu/gl/GrGLPath.h index 935a2e24ad..b8bd8ad1a4 100644 --- a/src/gpu/gl/GrGLPath.h +++ b/src/gpu/gl/GrGLPath.h @@ -30,15 +30,15 @@ public: GrGLPath(GrGpuGL* gpu, const SkPath& path, const SkStrokeRec& stroke); virtual ~GrGLPath(); GrGLuint pathID() const { return fPathID; } - // TODO: Figure out how to get an approximate size of the path in Gpu - // memory. - virtual size_t gpuMemorySize() const SK_OVERRIDE { return 100; } protected: virtual void onRelease() SK_OVERRIDE; virtual void onAbandon() SK_OVERRIDE; private: + // TODO: Figure out how to get an approximate size of the path in Gpu memory. + virtual size_t onGpuMemorySize() const SK_OVERRIDE { return 100; } + GrGLuint fPathID; typedef GrPath INHERITED; diff --git a/src/gpu/gl/GrGLPathRange.h b/src/gpu/gl/GrGLPathRange.h index f21ce3a7c9..440ffbc0c9 100644 --- a/src/gpu/gl/GrGLPathRange.h +++ b/src/gpu/gl/GrGLPathRange.h @@ -43,8 +43,6 @@ public: GrGLuint basePathID() const { return fBasePathID; } - virtual size_t gpuMemorySize() const SK_OVERRIDE { return fGpuMemorySize; } - protected: virtual void onInitPath(int index, const SkPath&) const; @@ -52,6 +50,8 @@ protected: virtual void onAbandon() SK_OVERRIDE; private: + virtual size_t onGpuMemorySize() const SK_OVERRIDE { return fGpuMemorySize; } + GrGLuint fBasePathID; mutable size_t fGpuMemorySize; diff --git a/src/gpu/gl/GrGLRenderTarget.cpp b/src/gpu/gl/GrGLRenderTarget.cpp index 8482ecdc6c..98813beb2c 100644 --- a/src/gpu/gl/GrGLRenderTarget.cpp +++ b/src/gpu/gl/GrGLRenderTarget.cpp @@ -45,7 +45,7 @@ void GrGLRenderTarget::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) { } } -size_t GrGLRenderTarget::gpuMemorySize() const { +size_t GrGLRenderTarget::onGpuMemorySize() const { SkASSERT(kUnknown_GrPixelConfig != fDesc.fConfig); SkASSERT(!GrPixelConfigIsCompressed(fDesc.fConfig)); size_t colorBytes = GrBytesPerPixel(fDesc.fConfig); diff --git a/src/gpu/gl/GrGLRenderTarget.h b/src/gpu/gl/GrGLRenderTarget.h index 0f041600ee..b81bbed4b2 100644 --- a/src/gpu/gl/GrGLRenderTarget.h +++ b/src/gpu/gl/GrGLRenderTarget.h @@ -58,8 +58,6 @@ public: } } - virtual size_t gpuMemorySize() const SK_OVERRIDE; - protected: // The public constructor registers this object with the cache. However, only the most derived // class should register with the cache. This constructor does not do the registration and @@ -72,6 +70,9 @@ protected: virtual void onAbandon() SK_OVERRIDE; virtual void onRelease() SK_OVERRIDE; + // In protected because subclass GrGLTextureRenderTarget calls this version. + virtual size_t onGpuMemorySize() const SK_OVERRIDE; + private: GrGLuint fRTFBOID; GrGLuint fTexFBOID; @@ -82,7 +83,7 @@ private: // we want the rendering to be at top left (GL has origin in bottom left) GrGLIRect fViewport; - // gpuMemorySize() needs to know what how many color values are owned per pixel. However, + // onGpuMemorySize() needs to know what how many color values are owned per pixel. However, // abandon and release zero out the IDs and the cache needs to know the size even after those // actions. uint8_t fColorValuesPerPixel; diff --git a/src/gpu/gl/GrGLStencilBuffer.cpp b/src/gpu/gl/GrGLStencilBuffer.cpp index abcb3c4ba0..fd14ea01f2 100644 --- a/src/gpu/gl/GrGLStencilBuffer.cpp +++ b/src/gpu/gl/GrGLStencilBuffer.cpp @@ -13,7 +13,7 @@ GrGLStencilBuffer::~GrGLStencilBuffer() { this->release(); } -size_t GrGLStencilBuffer::gpuMemorySize() const { +size_t GrGLStencilBuffer::onGpuMemorySize() const { uint64_t size = this->width(); size *= this->height(); size *= fFormat.fTotalBits; diff --git a/src/gpu/gl/GrGLStencilBuffer.h b/src/gpu/gl/GrGLStencilBuffer.h index 024890ddd7..53777e40c7 100644 --- a/src/gpu/gl/GrGLStencilBuffer.h +++ b/src/gpu/gl/GrGLStencilBuffer.h @@ -37,8 +37,6 @@ public: virtual ~GrGLStencilBuffer(); - virtual size_t gpuMemorySize() const SK_OVERRIDE; - GrGLuint renderbufferID() const { return fRenderbufferID; } @@ -51,6 +49,8 @@ protected: virtual void onAbandon() SK_OVERRIDE; private: + virtual size_t onGpuMemorySize() const SK_OVERRIDE; + Format fFormat; // may be zero for external SBs associated with external RTs // (we don't require the client to give us the id, just tell diff --git a/src/gpu/gl/GrGLTextureRenderTarget.h b/src/gpu/gl/GrGLTextureRenderTarget.h index 55da28f6b8..06080a8a36 100644 --- a/src/gpu/gl/GrGLTextureRenderTarget.h +++ b/src/gpu/gl/GrGLTextureRenderTarget.h @@ -31,14 +31,11 @@ public: : GrSurface(gpu, texIDDesc.fIsWrapped, desc) , GrGLTexture(gpu, desc, texIDDesc, GrGLTexture::kDerived) , GrGLRenderTarget(gpu, desc, rtIDDesc, GrGLRenderTarget::kDerived) { - this->registerWithCache(); + this->registerWithCache(); } virtual ~GrGLTextureRenderTarget() { this->release(); } - // GrGLRenderTarget accounts for the texture's memory and any MSAA renderbuffer's memory. - virtual size_t gpuMemorySize() const SK_OVERRIDE { return GrGLRenderTarget::gpuMemorySize(); } - protected: virtual void onAbandon() SK_OVERRIDE { GrGLRenderTarget::onAbandon(); @@ -49,6 +46,13 @@ protected: GrGLRenderTarget::onRelease(); GrGLTexture::onRelease(); } + +private: + // GrGLRenderTarget accounts for the texture's memory and any MSAA renderbuffer's memory. + virtual size_t onGpuMemorySize() const SK_OVERRIDE { + return GrGLRenderTarget::onGpuMemorySize(); + } + }; #ifdef SK_BUILD_FOR_WIN diff --git a/src/gpu/gl/GrGLVertexArray.h b/src/gpu/gl/GrGLVertexArray.h index 96e90bc81f..e5032a9ea0 100644 --- a/src/gpu/gl/GrGLVertexArray.h +++ b/src/gpu/gl/GrGLVertexArray.h @@ -159,9 +159,9 @@ public: void invalidateCachedState(); - virtual size_t gpuMemorySize() const SK_OVERRIDE { return 0; } - protected: + virtual size_t onGpuMemorySize() const SK_OVERRIDE { return 0; } + virtual void onAbandon() SK_OVERRIDE; virtual void onRelease() SK_OVERRIDE; |