Index: src/gpu/gl/GrGLXferProcessor.cpp |
diff --git a/src/gpu/gl/GrGLXferProcessor.cpp b/src/gpu/gl/GrGLXferProcessor.cpp |
index 4aac11d3354c53533e0ec128f1be55488078dd1b..b7bf3019b5921c3c5aca4d0aa2234f1a96f7f94f 100644 |
--- a/src/gpu/gl/GrGLXferProcessor.cpp |
+++ b/src/gpu/gl/GrGLXferProcessor.cpp |
@@ -16,6 +16,12 @@ void GrGLXferProcessor::emitCode(const EmitArgs& args) { |
bool topDown = kTopLeft_GrSurfaceOrigin == args.fXP.getDstCopyTexture()->origin(); |
GrGLFPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); |
+ |
+ // We don't think any shaders actually output negative coverage, but just as a safety check |
+ // for floating point precision errors we compare with <= here |
+ fsBuilder->codeAppendf("if (all(lessThanEqual(%s, vec4(0)))) {" |
+ " discard;" |
+ "}", args.fInputCoverage); |
const char* dstColor = fsBuilder->dstColor(); |
const char* dstCopyTopLeftName; |