From 10e23caea3106be125acea10a637789e5a15c728 Mon Sep 17 00:00:00 2001 From: bsalomon Date: Tue, 25 Nov 2014 05:52:06 -0800 Subject: Use scratch keys for stencil buffers. BUG=skia:2889 Committed: https://skia.googlesource.com/skia/+/91175f19664a62851da4ca4e0984a7c7c45b258f Review URL: https://codereview.chromium.org/747043004 --- src/gpu/GrGpu.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/gpu/GrGpu.cpp') diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp index 2bda594b9a..6b742c4cc3 100644 --- a/src/gpu/GrGpu.cpp +++ b/src/gpu/GrGpu.cpp @@ -13,14 +13,12 @@ #include "GrContext.h" #include "GrDrawTargetCaps.h" #include "GrIndexBuffer.h" +#include "GrResourceCache2.h" #include "GrStencilBuffer.h" #include "GrVertexBuffer.h" //////////////////////////////////////////////////////////////////////////////// -#define DEBUG_INVAL_BUFFER 0xdeadcafe -#define DEBUG_INVAL_START_IDX -1 - GrGpu::GrGpu(GrContext* context) : fResetTimestamp(kExpiredTimestamp+1) , fResetBits(kAll_GrBackendState) @@ -78,8 +76,9 @@ GrTexture* GrGpu::createTexture(const GrSurfaceDesc& desc, bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) { SkASSERT(NULL == rt->getStencilBuffer()); - SkAutoTUnref sb( - this->getContext()->findAndRefStencilBuffer(rt->width(), rt->height(), rt->numSamples())); + GrResourceKey sbKey = GrStencilBuffer::ComputeKey(rt->width(), rt->height(), rt->numSamples()); + SkAutoTUnref sb(static_cast( + this->getContext()->getResourceCache2()->findAndRefScratchResource(sbKey))); if (sb) { rt->setStencilBuffer(sb); bool attached = this->attachStencilBufferToRenderTarget(sb, rt); -- cgit v1.2.3