From 36c57dfb4fe9bbaca436942d5eaa75b142ba251d Mon Sep 17 00:00:00 2001 From: kkinnunen Date: Tue, 27 Jan 2015 00:30:18 -0800 Subject: Make stencil buffers uncached for uncached render target textures Make new stencil buffers of uncached render target textures not affect the cache budgets. This is consistent with render buffer storage of uncached render target textures. Affects only newly created stencil buffers. An uncached render target might still receive a cached stencil buffer if such is available from cache. BUG=skia:3119 BUG=skia:3301 Review URL: https://codereview.chromium.org/859013002 --- src/gpu/GrStencilBuffer.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/gpu/GrStencilBuffer.h') diff --git a/src/gpu/GrStencilBuffer.h b/src/gpu/GrStencilBuffer.h index 883a982ac4..43d2114581 100644 --- a/src/gpu/GrStencilBuffer.h +++ b/src/gpu/GrStencilBuffer.h @@ -50,16 +50,18 @@ public: static void ComputeKey(int width, int height, int sampleCnt, GrScratchKey* key); protected: - GrStencilBuffer(GrGpu* gpu, int width, int height, int bits, int sampleCnt) - : GrGpuResource(gpu, kCached_LifeCycle) + GrStencilBuffer(GrGpu* gpu, LifeCycle lifeCycle, int width, int height, int bits, int sampleCnt) + : GrGpuResource(gpu, lifeCycle) , fWidth(width) , fHeight(height) , fBits(bits) , fSampleCnt(sampleCnt) , fLastClipStackGenID(SkClipStack::kInvalidGenID) { - GrScratchKey key; - ComputeKey(width, height, sampleCnt, &key); - this->setScratchKey(key); + if (kCached_LifeCycle == lifeCycle) { + GrScratchKey key; + ComputeKey(width, height, sampleCnt, &key); + this->setScratchKey(key); + } fLastClipStackRect.setEmpty(); } -- cgit v1.2.3