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

Unified Diff: src/gpu/gl/GrGLGpu.cpp

Issue 938383004: Dynamically create stencil buffer when needed. (Closed) Base URL: https://skia.googlesource.com/skia.git@bigstencil
Patch Set: Actually save file before uploading Created 5 years, 10 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/effects/GrConfigConversionEffect.cpp ('k') | src/gpu/gl/GrGLRenderTarget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLGpu.cpp
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index ef4423ba6be17d7a1004eb886948a2fdf24ba650..8710931301eae53fc39b2d930ece9f04301d7e5a 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -11,6 +11,7 @@
#include "GrGLTextureRenderTarget.h"
#include "GrGpuResourcePriv.h"
#include "GrPipeline.h"
+#include "GrRenderTargetPriv.h"
#include "GrSurfacePriv.h"
#include "GrTemplates.h"
#include "GrTexturePriv.h"
@@ -454,7 +455,7 @@ GrRenderTarget* GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTargetDe
desc.fHeight,
desc.fSampleCnt,
format));
- tgt->setStencilBuffer(sb);
+ tgt->renderTargetPriv().didAttachStencilBuffer(sb);
sb->unref();
}
return tgt;
@@ -1175,7 +1176,7 @@ bool GrGLGpu::createStencilBufferForRenderTarget(GrRenderTarget* rt, int width,
(this, sbDesc, width, height, samples, format)));
if (this->attachStencilBufferToRenderTarget(sb, rt)) {
fLastSuccessfulStencilFmtIdx = sIdx;
- rt->setStencilBuffer(sb);
+ rt->renderTargetPriv().didAttachStencilBuffer(sb);
return true;
}
// Remove the scratch key from this resource so we don't grab it from the cache ever
@@ -1195,7 +1196,7 @@ bool GrGLGpu::attachStencilBufferToRenderTarget(GrStencilBuffer* sb, GrRenderTar
GrGLuint fbo = glrt->renderFBOID();
if (NULL == sb) {
- if (rt->getStencilBuffer()) {
+ if (rt->renderTargetPriv().getStencilBuffer()) {
GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER,
GR_GL_STENCIL_ATTACHMENT,
GR_GL_RENDERBUFFER, 0));
@@ -1570,10 +1571,11 @@ void GrGLGpu::clearStencil(GrRenderTarget* target) {
void GrGLGpu::onClearStencilClip(GrRenderTarget* target, const SkIRect& rect, bool insideClip) {
SkASSERT(target);
+ GrStencilBuffer* sb = target->renderTargetPriv().getStencilBuffer();
// this should only be called internally when we know we have a
// stencil buffer.
- SkASSERT(target->getStencilBuffer());
- GrGLint stencilBitCount = target->getStencilBuffer()->bits();
+ SkASSERT(sb);
+ GrGLint stencilBitCount = sb->bits();
#if 0
SkASSERT(stencilBitCount > 0);
GrGLint clipStencilMask = (1 << (stencilBitCount - 1));
@@ -2560,7 +2562,7 @@ bool GrGLGpu::initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc)
// then we set up for that, otherwise fail.
if (this->caps()->isConfigRenderable(kBGRA_8888_GrPixelConfig, false)) {
desc->fOrigin = kDefault_GrSurfaceOrigin;
- desc->fFlags = kRenderTarget_GrSurfaceFlag | kNoStencil_GrSurfaceFlag;
+ desc->fFlags = kRenderTarget_GrSurfaceFlag;
desc->fConfig = kBGRA_8888_GrPixelConfig;
return true;
}
@@ -2576,7 +2578,7 @@ bool GrGLGpu::initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc)
// fail.
if (this->caps()->isConfigRenderable(src->config(), false)) {
desc->fOrigin = kDefault_GrSurfaceOrigin;
- desc->fFlags = kRenderTarget_GrSurfaceFlag | kNoStencil_GrSurfaceFlag;
+ desc->fFlags = kRenderTarget_GrSurfaceFlag;
desc->fConfig = src->config();
return true;
}
« no previous file with comments | « src/gpu/effects/GrConfigConversionEffect.cpp ('k') | src/gpu/gl/GrGLRenderTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698