diff options
author | 2015-02-20 06:58:13 -0800 | |
---|---|---|
committer | 2015-02-20 06:58:14 -0800 | |
commit | d08ea5fdae990ee7829e3755abddfab9740eab99 (patch) | |
tree | 2c21b24822b5018c6d5ee7c902d987616ef7a60d /src/gpu/GrGpu.cpp | |
parent | 04e4d08556750ff6be4576a4cd4925964c63376f (diff) |
Round stencil buffers dims up to next pow2 when allowed
Review URL: https://codereview.chromium.org/937303002
Diffstat (limited to 'src/gpu/GrGpu.cpp')
-rw-r--r-- | src/gpu/GrGpu.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp index 27fed3c582..d22399f81c 100644 --- a/src/gpu/GrGpu.cpp +++ b/src/gpu/GrGpu.cpp @@ -87,8 +87,15 @@ GrTexture* GrGpu::createTexture(const GrSurfaceDesc& desc, bool budgeted, bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) { SkASSERT(NULL == rt->getStencilBuffer()); GrUniqueKey sbKey; - GrStencilBuffer::ComputeSharedStencilBufferKey(rt->width(), rt->height(), rt->numSamples(), - &sbKey); + + int width = rt->width(); + int height = rt->height(); + if (this->caps()->oversizedStencilSupport()) { + width = SkNextPow2(width); + height = SkNextPow2(height); + } + + GrStencilBuffer::ComputeSharedStencilBufferKey(width, height, rt->numSamples(), &sbKey); SkAutoTUnref<GrStencilBuffer> sb(static_cast<GrStencilBuffer*>( this->getContext()->getResourceCache()->findAndRefUniqueResource(sbKey))); if (sb) { @@ -99,7 +106,7 @@ bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) { } return attached; } - if (this->createStencilBufferForRenderTarget(rt, rt->width(), rt->height())) { + if (this->createStencilBufferForRenderTarget(rt, width, height)) { // Right now we're clearing the stencil buffer here after it is // attached to an RT for the first time. When we start matching // stencil buffers with smaller color targets this will no longer |