aboutsummaryrefslogtreecommitdiffhomepage
path: root/gpu/src/GrGpu.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-08-05 15:46:40 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-08-05 15:46:40 +0000
commitedc177df618a61e35d4f07c49d5dcb5de9c7afb1 (patch)
tree350c5d08cf40dcebbceaeebf06d2f9356c02c8cb /gpu/src/GrGpu.cpp
parentc7e6d08fd2a8aa53f6603e145c23e06095b97063 (diff)
Fixes for iOS / Ganesh (consistent fs/vs uni precision decl and don't use stencil-only fbo for clear)
Review URL: http://codereview.appspot.com/4850043/ git-svn-id: http://skia.googlecode.com/svn/trunk@2050 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gpu/src/GrGpu.cpp')
-rw-r--r--gpu/src/GrGpu.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/gpu/src/GrGpu.cpp b/gpu/src/GrGpu.cpp
index be84e270d5..4672cff3f4 100644
--- a/gpu/src/GrGpu.cpp
+++ b/gpu/src/GrGpu.cpp
@@ -156,8 +156,23 @@ GrTexture* GrGpu::createTexture(const GrTextureDesc& desc,
bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) {
// TODO: use a cache of stencil buffers rather than create per-rt.
- return this->createStencilBufferForRenderTarget(rt, rt->width(),
- rt->height());
+ bool ret = this->createStencilBufferForRenderTarget(rt, rt->width(),
+ rt->height());
+ if (ret) {
+ // 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
+ // be correct because it won't be guaranteed to clear the entire
+ // sb.
+ // We used to clear down in the GL subclass using a special purpose
+ // FBO. But iOS doesn't allow a stencil-only FBO. It reports unsupported
+ // FBO status.
+ GrRenderTarget* oldRT = fCurrDrawState.fRenderTarget;
+ fCurrDrawState.fRenderTarget = rt;
+ this->clearStencil();
+ fCurrDrawState.fRenderTarget = oldRT;
+ }
+ return ret;
}
GrRenderTarget* GrGpu::createRenderTargetFrom3DApiState() {