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 "gl/GrGLShaderBuilder.h" | 8 #include "gl/GrGLShaderBuilder.h" |
9 #include "gl/GrGLProgram.h" | 9 #include "gl/GrGLProgram.h" |
10 #include "gl/GrGLUniformHandle.h" | 10 #include "gl/GrGLUniformHandle.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 | 266 |
267 void GrGLShaderBuilder::appendTextureLookupAndModulate( | 267 void GrGLShaderBuilder::appendTextureLookupAndModulate( |
268 ShaderType type, | 268 ShaderType type, |
269 const char* modulation, | 269 const char* modulation, |
270 const GrGLShaderBuilder::TextureSamp
ler& sampler, | 270 const GrGLShaderBuilder::TextureSamp
ler& sampler, |
271 const char* coordName, | 271 const char* coordName, |
272 GrSLType varyingType) { | 272 GrSLType varyingType) { |
273 GrAssert(kFragment_ShaderType == type); | 273 GrAssert(kFragment_ShaderType == type); |
274 SkString lookup; | 274 SkString lookup; |
275 this->appendTextureLookup(&lookup, sampler, coordName, varyingType); | 275 this->appendTextureLookup(&lookup, sampler, coordName, varyingType); |
276 GrGLSLModulate4f(&fFSCode, modulation, lookup.c_str()); | 276 GrGLSLModulatef<4>(&fFSCode, modulation, lookup.c_str()); |
277 } | 277 } |
278 | 278 |
279 GrBackendEffectFactory::EffectKey GrGLShaderBuilder::KeyForTextureAccess( | 279 GrBackendEffectFactory::EffectKey GrGLShaderBuilder::KeyForTextureAccess( |
280 const GrTextureAcces
s& access, | 280 const GrTextureAcces
s& access, |
281 const GrGLCaps& caps
) { | 281 const GrGLCaps& caps
) { |
282 uint32_t configComponentMask = GrPixelConfigComponentMask(access.getTexture(
)->config()); | 282 uint32_t configComponentMask = GrPixelConfigComponentMask(access.getTexture(
)->config()); |
283 if (swizzle_requires_alpha_remapping(caps, configComponentMask, access.swizz
leMask())) { | 283 if (swizzle_requires_alpha_remapping(caps, configComponentMask, access.swizz
leMask())) { |
284 return 1; | 284 return 1; |
285 } else { | 285 } else { |
286 return 0; | 286 return 0; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 | 478 |
479 | 479 |
480 void GrGLShaderBuilder::emitFunction(ShaderType shader, | 480 void GrGLShaderBuilder::emitFunction(ShaderType shader, |
481 GrSLType returnType, | 481 GrSLType returnType, |
482 const char* name, | 482 const char* name, |
483 int argCnt, | 483 int argCnt, |
484 const GrGLShaderVar* args, | 484 const GrGLShaderVar* args, |
485 const char* body, | 485 const char* body, |
486 SkString* outName) { | 486 SkString* outName) { |
487 GrAssert(kFragment_ShaderType == shader); | 487 GrAssert(kFragment_ShaderType == shader); |
488 fFSFunctions.append(GrGLShaderVar::TypeString(returnType)); | 488 fFSFunctions.append(GrGLSLTypeString(returnType)); |
489 if (kNonStageIdx != fCurrentStageIdx) { | 489 if (kNonStageIdx != fCurrentStageIdx) { |
490 outName->printf(" %s_%d", name, fCurrentStageIdx); | 490 outName->printf(" %s_%d", name, fCurrentStageIdx); |
491 } else { | 491 } else { |
492 *outName = name; | 492 *outName = name; |
493 } | 493 } |
494 fFSFunctions.append(*outName); | 494 fFSFunctions.append(*outName); |
495 fFSFunctions.append("("); | 495 fFSFunctions.append("("); |
496 for (int i = 0; i < argCnt; ++i) { | 496 for (int i = 0; i < argCnt; ++i) { |
497 args[i].appendDecl(fCtxInfo, &fFSFunctions); | 497 args[i].appendDecl(fCtxInfo, &fFSFunctions); |
498 if (i < argCnt - 1) { | 498 if (i < argCnt - 1) { |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 for (const AttributePair* attrib = this->getEffectAttributes().begin(); | 648 for (const AttributePair* attrib = this->getEffectAttributes().begin(); |
649 attrib != attribEnd; | 649 attrib != attribEnd; |
650 ++attrib) { | 650 ++attrib) { |
651 if (attrib->fIndex == attributeIndex) { | 651 if (attrib->fIndex == attributeIndex) { |
652 return &attrib->fName; | 652 return &attrib->fName; |
653 } | 653 } |
654 } | 654 } |
655 | 655 |
656 return NULL; | 656 return NULL; |
657 } | 657 } |
OLD | NEW |