OLD | NEW |
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // call) causes the compilation error "Calls to any function tha
t | 95 // call) causes the compilation error "Calls to any function tha
t |
96 // may require a gradient calculation inside a conditional block | 96 // may require a gradient calculation inside a conditional block |
97 // may return undefined results". This appears to be an issue wi
th | 97 // may return undefined results". This appears to be an issue wi
th |
98 // the 'any' call since even the simple "result=black; if (any()
) | 98 // the 'any' call since even the simple "result=black; if (any()
) |
99 // result=white;" code fails to compile. | 99 // result=white;" code fails to compile. |
100 builder->codeAppend("vec4 outside = vec4(0.0, 0.0, 0.0, 0.0);"); | 100 builder->codeAppend("vec4 outside = vec4(0.0, 0.0, 0.0, 0.0);"); |
101 builder->codeAppend("vec4 inside = "); | 101 builder->codeAppend("vec4 inside = "); |
102 builder->appendTextureLookupAndModulate(inModulateColor, sampler
, | 102 builder->appendTextureLookupAndModulate(inModulateColor, sampler
, |
103 inCoords.c_str()); | 103 inCoords.c_str()); |
104 builder->codeAppend(";"); | 104 builder->codeAppend(";"); |
105 | 105 |
106 builder->codeAppend(GrGLSLShaderVar::PrecisionString(glslCaps, | 106 builder->codeAppend(GrGLSLShaderVar::PrecisionString(glslCaps, |
107 kHigh_GrSLP
recision)); | 107 kHigh_GrSLP
recision)); |
108 builder->codeAppendf("float x = (%s).x;", inCoords.c_str()); | 108 builder->codeAppendf("float x = (%s).x;", inCoords.c_str()); |
109 builder->codeAppend(GrGLSLShaderVar::PrecisionString(glslCaps, | 109 builder->codeAppend(GrGLSLShaderVar::PrecisionString(glslCaps, |
110 kHigh_GrSLP
recision)); | 110 kHigh_GrSLP
recision)); |
111 builder->codeAppendf("float y = (%s).y;", inCoords.c_str()); | 111 builder->codeAppendf("float y = (%s).y;", inCoords.c_str()); |
112 | 112 |
113 builder->codeAppendf("x = abs(2.0*(x - %s.x)/(%s.z - %s.x) - 1.0
);", | 113 builder->codeAppendf("x = abs(2.0*(x - %s.x)/(%s.z - %s.x) - 1.0
);", |
114 domain, domain, domain); | 114 domain, domain, domain); |
115 builder->codeAppendf("y = abs(2.0*(y - %s.y)/(%s.w - %s.y) - 1.0
);", | 115 builder->codeAppendf("y = abs(2.0*(y - %s.y)/(%s.w - %s.y) - 1.0
);", |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool()
: false; | 294 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool()
: false; |
295 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC
oordSet; | 295 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC
oordSet; |
296 return GrTextureDomainEffect::Create( | 296 return GrTextureDomainEffect::Create( |
297 d->fTextures[texIdx], | 297 d->fTextures[texIdx], |
298 matrix, | 298 matrix, |
299 domain, | 299 domain, |
300 mode, | 300 mode, |
301 bilerp ? GrTextureParams::kBilerp_FilterMode : GrTextureParams::kNone_Fi
lterMode, | 301 bilerp ? GrTextureParams::kBilerp_FilterMode : GrTextureParams::kNone_Fi
lterMode, |
302 coords); | 302 coords); |
303 } | 303 } |
OLD | NEW |