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

Side by Side Diff: src/gpu/effects/GrTextureDomain.cpp

Issue 1417123002: Move GrGLShaderVar to GrGLSL (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix gyp Created 5 years, 2 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/effects/GrDistanceFieldGeoProc.cpp ('k') | src/gpu/gl/GrGLGLSL.cpp » ('j') | 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 2012 Google Inc. 2 * Copyright 2012 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 "GrTextureDomain.h" 8 #include "GrTextureDomain.h"
9 #include "GrInvariantOutput.h" 9 #include "GrInvariantOutput.h"
10 #include "GrSimpleTextureEffect.h" 10 #include "GrSimpleTextureEffect.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // may require a gradient calculation inside a conditional block 93 // may require a gradient calculation inside a conditional block
94 // may return undefined results". This appears to be an issue wi th 94 // may return undefined results". This appears to be an issue wi th
95 // the 'any' call since even the simple "result=black; if (any() ) 95 // the 'any' call since even the simple "result=black; if (any() )
96 // result=white;" code fails to compile. 96 // result=white;" code fails to compile.
97 builder->codeAppend("vec4 outside = vec4(0.0, 0.0, 0.0, 0.0);"); 97 builder->codeAppend("vec4 outside = vec4(0.0, 0.0, 0.0, 0.0);");
98 builder->codeAppend("vec4 inside = "); 98 builder->codeAppend("vec4 inside = ");
99 builder->appendTextureLookupAndModulate(inModulateColor, sampler , 99 builder->appendTextureLookupAndModulate(inModulateColor, sampler ,
100 inCoords.c_str()); 100 inCoords.c_str());
101 builder->codeAppend(";"); 101 builder->codeAppend(";");
102 102
103 builder->codeAppend(GrGLShaderVar::PrecisionString(program->glsl Caps(), 103 builder->codeAppend(GrGLSLShaderVar::PrecisionString(program->gl slCaps(),
104 kHigh_GrSLPre cision)); 104 kHigh_GrSLP recision));
105 builder->codeAppendf("float x = (%s).x;", inCoords.c_str()); 105 builder->codeAppendf("float x = (%s).x;", inCoords.c_str());
106 builder->codeAppend(GrGLShaderVar::PrecisionString(program->glsl Caps(), 106 builder->codeAppend(GrGLSLShaderVar::PrecisionString(program->gl slCaps(),
107 kHigh_GrSLPre cision)); 107 kHigh_GrSLP recision));
108 builder->codeAppendf("float y = (%s).y;", inCoords.c_str()); 108 builder->codeAppendf("float y = (%s).y;", inCoords.c_str());
109 109
110 builder->codeAppendf("x = abs(2.0*(x - %s.x)/(%s.z - %s.x) - 1.0 );", 110 builder->codeAppendf("x = abs(2.0*(x - %s.x)/(%s.z - %s.x) - 1.0 );",
111 domain, domain, domain); 111 domain, domain, domain);
112 builder->codeAppendf("y = abs(2.0*(y - %s.y)/(%s.w - %s.y) - 1.0 );", 112 builder->codeAppendf("y = abs(2.0*(y - %s.y)/(%s.w - %s.y) - 1.0 );",
113 domain, domain, domain); 113 domain, domain, domain);
114 builder->codeAppend("float blend = step(1.0, max(x, y));"); 114 builder->codeAppend("float blend = step(1.0, max(x, y));");
115 builder->codeAppendf("%s = mix(inside, outside, blend);", outCol or); 115 builder->codeAppendf("%s = mix(inside, outside, blend);", outCol or);
116 } else { 116 } else {
117 builder->codeAppend("bvec4 outside;\n"); 117 builder->codeAppend("bvec4 outside;\n");
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool() : false; 290 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool() : false;
291 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC oordSet; 291 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC oordSet;
292 return GrTextureDomainEffect::Create( 292 return GrTextureDomainEffect::Create(
293 d->fTextures[texIdx], 293 d->fTextures[texIdx],
294 matrix, 294 matrix,
295 domain, 295 domain,
296 mode, 296 mode,
297 bilerp ? GrTextureParams::kBilerp_FilterMode : GrTextureParams::kNone_Fi lterMode, 297 bilerp ? GrTextureParams::kBilerp_FilterMode : GrTextureParams::kNone_Fi lterMode,
298 coords); 298 coords);
299 } 299 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrDistanceFieldGeoProc.cpp ('k') | src/gpu/gl/GrGLGLSL.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698