diff options
Diffstat (limited to 'gpu/include')
-rw-r--r-- | gpu/include/GrContext.h | 12 | ||||
-rw-r--r-- | gpu/include/GrRenderTarget.h | 24 | ||||
-rw-r--r-- | gpu/include/GrTexture.h | 4 |
3 files changed, 26 insertions, 14 deletions
diff --git a/gpu/include/GrContext.h b/gpu/include/GrContext.h index cb354f853b..b2928f8af2 100644 --- a/gpu/include/GrContext.h +++ b/gpu/include/GrContext.h @@ -21,6 +21,7 @@ class GrIndexBufferAllocPool; class GrInOrderDrawBuffer; class GrResourceEntry; class GrResourceCache; +class GrStencilBuffer; class GrVertexBufferAllocPool; @@ -580,6 +581,17 @@ public: void resetStats(); const GrGpuStats& getStats() const; void printStats() const; + /** + * Stencil buffers add themselves to the cache using + * addAndLockStencilBuffer. When a SB's RT-attachment count + * reaches zero the SB unlocks itself using unlockStencilBuffer and is + * eligible for purging. findStencilBuffer is called to check the cache for + * a SB that matching an RT's criteria. If a match is found that has been + * unlocked (its attachment count has reached 0) then it will be relocked. + */ + GrResourceEntry* addAndLockStencilBuffer(GrStencilBuffer* sb); + void unlockStencilBuffer(GrResourceEntry* sbEntry); + GrStencilBuffer* findStencilBuffer(int width, int height, int sampleCnt); private: // used to keep track of when we need to flush the draw buffer diff --git a/gpu/include/GrRenderTarget.h b/gpu/include/GrRenderTarget.h index 13b1a3acf1..6fa9f0f263 100644 --- a/gpu/include/GrRenderTarget.h +++ b/gpu/include/GrRenderTarget.h @@ -32,8 +32,8 @@ class GrTexture; * that wrap externally created render targets. */ class GrRenderTarget : public GrResource { - public: + /** * @return the width of the rendertarget */ @@ -177,8 +177,7 @@ protected: , fAllocatedWidth(allocatedWidth) , fAllocatedHeight(allocatedHeight) , fConfig(config) - , fSampleCnt(sampleCnt) - { + , fSampleCnt(sampleCnt) { fResolveRect.setLargestInverted(); } @@ -193,17 +192,16 @@ protected: fTexture = NULL; } - GrStencilBuffer* fStencilBuffer; - private: - GrTexture* fTexture; // not ref'ed - int fWidth; - int fHeight; - int fAllocatedWidth; - int fAllocatedHeight; - GrPixelConfig fConfig; - int fSampleCnt; - GrIRect fResolveRect; + GrStencilBuffer* fStencilBuffer; + GrTexture* fTexture; // not ref'ed + int fWidth; + int fHeight; + int fAllocatedWidth; + int fAllocatedHeight; + GrPixelConfig fConfig; + int fSampleCnt; + GrIRect fResolveRect; typedef GrResource INHERITED; }; diff --git a/gpu/include/GrTexture.h b/gpu/include/GrTexture.h index 77f88fa110..5a86b0881b 100644 --- a/gpu/include/GrTexture.h +++ b/gpu/include/GrTexture.h @@ -64,7 +64,9 @@ public: * Approximate number of bytes used by the texture */ virtual size_t sizeInBytes() const { - return fAllocatedWidth * fAllocatedHeight * GrBytesPerPixel(fConfig); + return (size_t) fAllocatedWidth * + fAllocatedHeight * + GrBytesPerPixel(fConfig); } /** |