aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrGpu.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2014-11-24 07:05:15 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-11-24 07:05:15 -0800
commit91175f19664a62851da4ca4e0984a7c7c45b258f (patch)
tree33d518c4804c733e825bccf94c749fd78cd3203e /src/gpu/GrGpu.cpp
parent52e74c6d848931e12d2ba634abc0aae881cd3be1 (diff)
Use scratch keys for stencil buffers.
Diffstat (limited to 'src/gpu/GrGpu.cpp')
-rw-r--r--src/gpu/GrGpu.cpp9
1 files changed, 4 insertions, 5 deletions
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<GrStencilBuffer> sb(
- this->getContext()->findAndRefStencilBuffer(rt->width(), rt->height(), rt->numSamples()));
+ GrResourceKey sbKey = GrStencilBuffer::ComputeKey(rt->width(), rt->height(), rt->numSamples());
+ SkAutoTUnref<GrStencilBuffer> sb(static_cast<GrStencilBuffer*>(
+ this->getContext()->getResourceCache2()->findAndRefScratchResource(sbKey)));
if (sb) {
rt->setStencilBuffer(sb);
bool attached = this->attachStencilBufferToRenderTarget(sb, rt);