Stop discarding in frag shader when coverage is zero and stencil writes are enabled
This fixes the corruption in the NVPR images here:
http://108.170.217.252:10117/builders/Test-Win8-ShuttleA-GTX660-x86-Debug/builds/251/steps/CompareGMs/logs/stdio
caused by:
https://skia.googlesource.com/skia.git/+/65ee5f424cb4dabd453268902c00086605d77c1d
The stencil path step writes inside and outside the clip when the clip is implemented by
a coverage effect. The path cover step then doesn't write outside of the clip because the FS
discards. This leaves stencil values outside of the clip non-zero which messed up subsequent
path or clip draws to those samples.
R=robertphillips@google.com
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/154623002
git-svn-id: http://skia.googlecode.com/svn/trunk@13320 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/gl/GrGLProgramDesc.cpp b/src/gpu/gl/GrGLProgramDesc.cpp
index 381461a..b6029fe 100644
--- a/src/gpu/gl/GrGLProgramDesc.cpp
+++ b/src/gpu/gl/GrGLProgramDesc.cpp
@@ -215,8 +215,7 @@
// Here we deal with whether/how we handle color and coverage separately.
- // Set these defaults and then possibly change our mind if there is coverage.
- header->fDiscardIfZeroCoverage = false;
+ // Set this default and then possibly change our mind if there is coverage.
header->fCoverageOutput = kModulate_CoverageOutput;
// If we do have coverage determine whether it matters.
@@ -224,12 +223,6 @@
if (!drawState.isCoverageDrawing() && !skipCoverage &&
(drawState.numCoverageStages() > 0 || requiresCoverageAttrib)) {
- // If we're stenciling then we want to discard samples that have zero coverage
- if (drawState.getStencil().doesWrite()) {
- header->fDiscardIfZeroCoverage = true;
- separateCoverageFromColor = true;
- }
-
if (gpu->caps()->dualSourceBlendingSupport() &&
!(blendOpts & (GrDrawState::kEmitCoverage_BlendOptFlag |
GrDrawState::kCoverageAsAlpha_BlendOptFlag))) {