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

Unified Diff: src/gpu/GrGpu.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: spelling 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
« no previous file with comments | « src/gpu/GrGpu.h ('k') | src/gpu/GrRenderTarget.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrGpu.cpp
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index e1b8ed5c8522b54a84df49bbe31fc4b7835fc9a3..96728f3ba80d16950b34225840061b0bc04de32d 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -16,6 +16,7 @@
#include "GrPathRendering.h"
#include "GrPipeline.h"
#include "GrResourceCache.h"
+#include "GrResourceProvider.h"
#include "GrRenderTargetPriv.h"
#include "GrStencilAttachment.h"
#include "GrSurfacePriv.h"
@@ -134,48 +135,6 @@ GrTexture* GrGpu::createTexture(const GrSurfaceDesc& origDesc, bool budgeted,
return tex;
}
-bool GrGpu::attachStencilAttachmentToRenderTarget(GrRenderTarget* rt) {
- SkASSERT(nullptr == rt->renderTargetPriv().getStencilAttachment());
- GrUniqueKey sbKey;
-
- int width = rt->width();
- int height = rt->height();
-#if 0
- if (this->caps()->oversizedStencilSupport()) {
- width = SkNextPow2(width);
- height = SkNextPow2(height);
- }
-#endif
-
- GrStencilAttachment::ComputeSharedStencilAttachmentKey(width, height,
- rt->numStencilSamples(), &sbKey);
- SkAutoTUnref<GrStencilAttachment> sb(static_cast<GrStencilAttachment*>(
- this->getContext()->getResourceCache()->findAndRefUniqueResource(sbKey)));
- if (sb) {
- if (this->attachStencilAttachmentToRenderTarget(sb, rt)) {
- rt->renderTargetPriv().didAttachStencilAttachment(sb);
- return true;
- }
- return false;
- }
- if (this->createStencilAttachmentForRenderTarget(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
- // 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.
- this->clearStencil(rt);
- GrStencilAttachment* sb = rt->renderTargetPriv().getStencilAttachment();
- sb->resourcePriv().setUniqueKey(sbKey);
- return true;
- } else {
- return false;
- }
-}
-
GrTexture* GrGpu::wrapBackendTexture(const GrBackendTextureDesc& desc, GrWrapOwnership ownership) {
this->handleDirtyContext();
GrTexture* tex = this->onWrapBackendTexture(desc, ownership);
@@ -184,7 +143,7 @@ GrTexture* GrGpu::wrapBackendTexture(const GrBackendTextureDesc& desc, GrWrapOwn
}
// TODO: defer this and attach dynamically
GrRenderTarget* tgt = tex->asRenderTarget();
- if (tgt && !this->attachStencilAttachmentToRenderTarget(tgt)) {
+ if (tgt && !fContext->resourceProvider()->attachStencilAttachment(tgt)) {
tex->unref();
return nullptr;
} else {
« no previous file with comments | « src/gpu/GrGpu.h ('k') | src/gpu/GrRenderTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698