diff options
author | vbuzinov <vbuzinov@nvidia.com> | 2015-08-21 05:24:24 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-21 05:24:24 -0700 |
commit | c5d58f07aa6f4c47337d769e0e2e69c79669f91a (patch) | |
tree | 99ba4e7dcff71d9db479386f61d10ab4148a2488 /src | |
parent | 499ababa52f3ac4fccf957979713abe58be1584a (diff) |
Use stencil ops that don't issue writes whenever possible
Minimize the number of stencil writes by using GL_KEEP whenever possible.
This can positively affect the HW performance of the stencil test.
BUG=skia:3952
Review URL: https://codereview.chromium.org/1288923005
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/GrStencilAndCoverPathRenderer.cpp | 4 | ||||
-rw-r--r-- | src/gpu/GrStencilAndCoverTextContext.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGLGpu.cpp | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/gpu/GrStencilAndCoverPathRenderer.cpp b/src/gpu/GrStencilAndCoverPathRenderer.cpp index f871c3da73..6cd982c515 100644 --- a/src/gpu/GrStencilAndCoverPathRenderer.cpp +++ b/src/gpu/GrStencilAndCoverPathRenderer.cpp @@ -102,7 +102,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) { if (path.isInverseFillType()) { GR_STATIC_CONST_SAME_STENCIL(kInvertedStencilPass, - kZero_StencilOp, + kKeep_StencilOp, kZero_StencilOp, // We know our rect will hit pixels outside the clip and the user bits will be 0 // outside the clip. So we can't just fill where the user bits are 0. We also need to @@ -141,7 +141,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) { } else { GR_STATIC_CONST_SAME_STENCIL(kStencilPass, kZero_StencilOp, - kZero_StencilOp, + kKeep_StencilOp, kNotEqual_StencilFunc, 0xffff, 0x0000, diff --git a/src/gpu/GrStencilAndCoverTextContext.cpp b/src/gpu/GrStencilAndCoverTextContext.cpp index 980a494eaf..554038fc32 100644 --- a/src/gpu/GrStencilAndCoverTextContext.cpp +++ b/src/gpu/GrStencilAndCoverTextContext.cpp @@ -435,7 +435,7 @@ void GrStencilAndCoverTextContext::flush() { GR_STATIC_CONST_SAME_STENCIL(kStencilPass, kZero_StencilOp, - kZero_StencilOp, + kKeep_StencilOp, kNotEqual_StencilFunc, 0xffff, 0x0000, diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index c88b0b2ea4..e48ddf26ff 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -2118,11 +2118,11 @@ void set_gl_stencil(const GrGLInterface* gl, // supported. GR_GL_CALL(gl, StencilFunc(glFunc, ref, mask)); GR_GL_CALL(gl, StencilMask(writeMask)); - GR_GL_CALL(gl, StencilOp(glFailOp, glPassOp, glPassOp)); + GR_GL_CALL(gl, StencilOp(glFailOp, GR_GL_KEEP, glPassOp)); } else { GR_GL_CALL(gl, StencilFuncSeparate(glFace, glFunc, ref, mask)); GR_GL_CALL(gl, StencilMaskSeparate(glFace, writeMask)); - GR_GL_CALL(gl, StencilOpSeparate(glFace, glFailOp, glPassOp, glPassOp)); + GR_GL_CALL(gl, StencilOpSeparate(glFace, glFailOp, GR_GL_KEEP, glPassOp)); } } } |