Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Unified Diff: src/gpu/GrRenderTarget.cpp

Issue 1333383002: Move some of the adding stencil attachment logic of Gpu and into Render Target. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrRenderTarget.cpp
diff --git a/src/gpu/GrRenderTarget.cpp b/src/gpu/GrRenderTarget.cpp
index 5cb34e849aa1ed601fe908d7c201066aa554198d..0a362de6e90305a5bf24e21524bdced72a6ffcd0 100644
--- a/src/gpu/GrRenderTarget.cpp
+++ b/src/gpu/GrRenderTarget.cpp
@@ -72,12 +72,29 @@ void GrRenderTargetPriv::didAttachStencilAttachment(GrStencilAttachment* stencil
SkRefCnt_SafeAssign(fRenderTarget->fStencilAttachment, stencilAttachment);
}
-GrStencilAttachment* GrRenderTargetPriv::attachStencilAttachment() const {
+GrStencilAttachment* GrRenderTargetPriv::attachStencilAttachment() {
if (fRenderTarget->fStencilAttachment) {
return fRenderTarget->fStencilAttachment;
}
if (!fRenderTarget->wasDestroyed() && fRenderTarget->canAttemptStencilAttachment()) {
- fRenderTarget->getGpu()->attachStencilAttachmentToRenderTarget(fRenderTarget);
+ bool newStencil = fRenderTarget->getGpu()->getStencilAttachment(
+ fRenderTarget, &fRenderTarget->fStencilAttachment);
jvanverth1 2015/09/14 18:35:07 Indent to (, or at least further over.
+ if (!fRenderTarget->completeStencilAttachment()) {
+ SkSafeSetNull(fRenderTarget->fStencilAttachment);
+ } else {
+ if (newStencil) {
+ // Right now we're clearing the stencil attachment 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.
+ fRenderTarget->getGpu()->clearStencil(fRenderTarget);
+ }
+ }
}
return fRenderTarget->fStencilAttachment;
}
+
« no previous file with comments | « src/gpu/GrGpu.cpp ('k') | src/gpu/GrRenderTargetPriv.h » ('j') | src/gpu/gl/GrGLGpu.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698