| OLD | NEW |
| 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 GrGLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); |
| 19 | 19 |
| 20 // We don't think any shaders actually output negative coverage, but jus
t as a safety check | 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 | 21 // for floating point precision errors we compare with <= here |
| 22 fsBuilder->codeAppendf("if (all(lessThanEqual(%s, vec4(0)))) {" | 22 fsBuilder->codeAppendf("if (all(lessThanEqual(%s, vec4(0)))) {" |
| 23 " discard;" | 23 " discard;" |
| 24 "}", args.fInputCoverage); | 24 "}", args.fInputCoverage); |
| 25 const char* dstColor = fsBuilder->dstColor(); | 25 const char* dstColor = fsBuilder->dstColor(); |
| 26 | 26 |
| 27 const char* dstCopyTopLeftName; | 27 const char* dstCopyTopLeftName; |
| 28 const char* dstCopyCoordScaleName; | 28 const char* dstCopyCoordScaleName; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } else { | 65 } else { |
| 66 SkASSERT(!fDstCopyScaleUni.isValid()); | 66 SkASSERT(!fDstCopyScaleUni.isValid()); |
| 67 } | 67 } |
| 68 } else { | 68 } else { |
| 69 SkASSERT(!fDstCopyTopLeftUni.isValid()); | 69 SkASSERT(!fDstCopyTopLeftUni.isValid()); |
| 70 SkASSERT(!fDstCopyScaleUni.isValid()); | 70 SkASSERT(!fDstCopyScaleUni.isValid()); |
| 71 } | 71 } |
| 72 this->onSetData(pdm, xp); | 72 this->onSetData(pdm, xp); |
| 73 } | 73 } |
| 74 | 74 |
| OLD | NEW |