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

Side by Side Diff: src/gpu/glsl/GrGLSLXferProcessor.cpp

Issue 1684063006: Add GrShaderFlags enum (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Bit->Flag Created 4 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 | « src/gpu/glsl/GrGLSLUniformHandler.h ('k') | 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 "glsl/GrGLSLXferProcessor.h" 8 #include "glsl/GrGLSLXferProcessor.h"
9 9
10 #include "GrXferProcessor.h" 10 #include "GrXferProcessor.h"
(...skipping 18 matching lines...) Expand all
29 // We don't think any shaders actually output negative coverage, but just as a safety 29 // We don't think any shaders actually output negative coverage, but just as a safety
30 // check for floating point precision errors we compare with <= here 30 // check for floating point precision errors we compare with <= here
31 fragBuilder->codeAppendf("if (all(lessThanEqual(%s, vec4(0)))) {" 31 fragBuilder->codeAppendf("if (all(lessThanEqual(%s, vec4(0)))) {"
32 " discard;" 32 " discard;"
33 "}", args.fInputCoverage); 33 "}", args.fInputCoverage);
34 } 34 }
35 35
36 const char* dstTopLeftName; 36 const char* dstTopLeftName;
37 const char* dstCoordScaleName; 37 const char* dstCoordScaleName;
38 38
39 fDstTopLeftUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragm ent_Visibility, 39 fDstTopLeftUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
40 kVec2f_GrSLType, 40 kVec2f_GrSLType,
41 kDefault_GrSLPrecision, 41 kDefault_GrSLPrecision,
42 "DstTextureUpperLeft", 42 "DstTextureUpperLeft",
43 &dstTopLeftName); 43 &dstTopLeftName);
44 fDstScaleUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragmen t_Visibility, 44 fDstScaleUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
45 kVec2f_GrSLType, 45 kVec2f_GrSLType,
46 kDefault_GrSLPrecision, 46 kDefault_GrSLPrecision,
47 "DstTextureCoordScale", 47 "DstTextureCoordScale",
48 &dstCoordScaleName); 48 &dstCoordScaleName);
49 const char* fragPos = fragBuilder->fragmentPosition(); 49 const char* fragPos = fragBuilder->fragmentPosition();
50 50
51 fragBuilder->codeAppend("// Read color from copy of the destination.\n") ; 51 fragBuilder->codeAppend("// Read color from copy of the destination.\n") ;
52 fragBuilder->codeAppendf("vec2 _dstTexCoord = (%s.xy - %s) * %s;", 52 fragBuilder->codeAppendf("vec2 _dstTexCoord = (%s.xy - %s) * %s;",
53 fragPos, dstTopLeftName, dstCoordScaleName); 53 fragPos, dstTopLeftName, dstCoordScaleName);
54 54
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 fragBuilder->codeAppendf("%s *= %s;", outColor, srcCoverage); 99 fragBuilder->codeAppendf("%s *= %s;", outColor, srcCoverage);
100 fragBuilder->codeAppendf("%s = %s;", outColorSecondary, srcCoverage) ; 100 fragBuilder->codeAppendf("%s = %s;", outColorSecondary, srcCoverage) ;
101 } else { 101 } else {
102 fragBuilder->codeAppendf("%s = vec4(1.0);", outColorSecondary); 102 fragBuilder->codeAppendf("%s = vec4(1.0);", outColorSecondary);
103 } 103 }
104 } else if (srcCoverage) { 104 } else if (srcCoverage) {
105 fragBuilder->codeAppendf("%s = %s * %s + (vec4(1.0) - %s) * %s;", 105 fragBuilder->codeAppendf("%s = %s * %s + (vec4(1.0) - %s) * %s;",
106 outColor, srcCoverage, outColor, srcCoverage, d stColor); 106 outColor, srcCoverage, outColor, srcCoverage, d stColor);
107 } 107 }
108 } 108 }
OLDNEW
« no previous file with comments | « src/gpu/glsl/GrGLSLUniformHandler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698