| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 builder->appendTextureLookupAndModulate(inModulateColor, sampler, | 80 builder->appendTextureLookupAndModulate(inModulateColor, sampler, |
| 81 clampedCoords.c_str()); | 81 clampedCoords.c_str()); |
| 82 builder->codeAppend(";"); | 82 builder->codeAppend(";"); |
| 83 break; | 83 break; |
| 84 } | 84 } |
| 85 case kDecal_Mode: { | 85 case kDecal_Mode: { |
| 86 // Add a block since we're going to declare variables. | 86 // Add a block since we're going to declare variables. |
| 87 GrGLShaderBuilder::ShaderBlock block(builder); | 87 GrGLShaderBuilder::ShaderBlock block(builder); |
| 88 | 88 |
| 89 const char* domain = fDomainName.c_str(); | 89 const char* domain = fDomainName.c_str(); |
| 90 if (!program->glslCaps()->canUseAnyFunctionInShader()) { | 90 if (kImagination_GrGLVendor == program->ctxInfo().vendor()) { |
| 91 // On the NexusS and GalaxyNexus, the other path (with the 'any' | 91 // On the NexusS and GalaxyNexus, the other path (with the 'any' |
| 92 // call) causes the compilation error "Calls to any function tha
t | 92 // call) causes the compilation error "Calls to any function tha
t |
| 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()); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |