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

Side by Side Diff: src/gpu/gl/GrGLXferProcessor.cpp

Issue 915633002: discard when coverage is <= 0 in XP dst copy (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more cleanup 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gl/GrGLXferProcessor.h" 8 #include "gl/GrGLXferProcessor.h"
9 9
10 #include "GrXferProcessor.h" 10 #include "GrXferProcessor.h"
11 #include "gl/builders/GrGLFragmentShaderBuilder.h" 11 #include "gl/builders/GrGLFragmentShaderBuilder.h"
12 #include "gl/builders/GrGLProgramBuilder.h" 12 #include "gl/builders/GrGLProgramBuilder.h"
13 13
14 void GrGLXferProcessor::emitCode(const EmitArgs& args) { 14 void GrGLXferProcessor::emitCode(const EmitArgs& args) {
15 if (args.fXP.getDstCopyTexture()) { 15 if (args.fXP.getDstCopyTexture()) {
16 bool topDown = kTopLeft_GrSurfaceOrigin == args.fXP.getDstCopyTexture()- >origin(); 16 bool topDown = kTopLeft_GrSurfaceOrigin == args.fXP.getDstCopyTexture()- >origin();
17 17
18 GrGLFPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); 18 GrGLFPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
19
20 // We don't think any shaders actually output negative coverage, but jus t as a safety check
21 // for floating point precision errors we compare with <= here
22 fsBuilder->codeAppendf("if (all(lessThanEqual(%s, vec4(0)))) {"
23 " discard;"
24 "}", args.fInputCoverage);
19 const char* dstColor = fsBuilder->dstColor(); 25 const char* dstColor = fsBuilder->dstColor();
20 26
21 const char* dstCopyTopLeftName; 27 const char* dstCopyTopLeftName;
22 const char* dstCopyCoordScaleName; 28 const char* dstCopyCoordScaleName;
23 29
24 fDstCopyTopLeftUni = args.fPB->addUniform(GrGLProgramBuilder::kFragment_ Visibility, 30 fDstCopyTopLeftUni = args.fPB->addUniform(GrGLProgramBuilder::kFragment_ Visibility,
25 kVec2f_GrSLType, 31 kVec2f_GrSLType,
26 kDefault_GrSLPrecision, 32 kDefault_GrSLPrecision,
27 "DstCopyUpperLeft", 33 "DstCopyUpperLeft",
28 &dstCopyTopLeftName); 34 &dstCopyTopLeftName);
(...skipping 30 matching lines...) Expand all
59 } else { 65 } else {
60 SkASSERT(!fDstCopyScaleUni.isValid()); 66 SkASSERT(!fDstCopyScaleUni.isValid());
61 } 67 }
62 } else { 68 } else {
63 SkASSERT(!fDstCopyTopLeftUni.isValid()); 69 SkASSERT(!fDstCopyTopLeftUni.isValid());
64 SkASSERT(!fDstCopyScaleUni.isValid()); 70 SkASSERT(!fDstCopyScaleUni.isValid());
65 } 71 }
66 this->onSetData(pdm, xp); 72 this->onSetData(pdm, xp);
67 } 73 }
68 74
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698