OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 The Android Open Source Project |
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 "SkLightingImageFilter.h" | 8 #include "SkLightingImageFilter.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 void emitLightColorUniform(GrGLSLFPBuilder*); | 601 void emitLightColorUniform(GrGLSLFPBuilder*); |
602 | 602 |
603 /** | 603 /** |
604 * These two functions are called from GrGLLightingEffect's emitCode() funct
ion. | 604 * These two functions are called from GrGLLightingEffect's emitCode() funct
ion. |
605 * emitSurfaceToLight places an expression in param out that is the vector f
rom the surface to | 605 * emitSurfaceToLight places an expression in param out that is the vector f
rom the surface to |
606 * the light. The expression will be used in the FS. emitLightColor writes a
n expression into | 606 * the light. The expression will be used in the FS. emitLightColor writes a
n expression into |
607 * the FS that is the color of the light. Either function may add functions
and/or uniforms to | 607 * the FS that is the color of the light. Either function may add functions
and/or uniforms to |
608 * the FS. The default of emitLightColor appends the name of the constant li
ght color uniform | 608 * the FS. The default of emitLightColor appends the name of the constant li
ght color uniform |
609 * and so this function only needs to be overridden if the light color varie
s spatially. | 609 * and so this function only needs to be overridden if the light color varie
s spatially. |
610 */ | 610 */ |
611 virtual void emitSurfaceToLight(GrGLSLFPBuilder*, const char* z) = 0; | 611 virtual void emitSurfaceToLight(GrGLSLFPBuilder*, GrGLSLFragmentBuilder*, co
nst char* z) = 0; |
612 virtual void emitLightColor(GrGLSLFPBuilder*, const char *surfaceToLight); | 612 virtual void emitLightColor(GrGLSLFPBuilder*, |
| 613 GrGLSLFragmentBuilder*, |
| 614 const char *surfaceToLight); |
613 | 615 |
614 // This is called from GrGLLightingEffect's setData(). Subclasses of GrGLLig
ht must call | 616 // This is called from GrGLLightingEffect's setData(). Subclasses of GrGLLig
ht must call |
615 // INHERITED::setData(). | 617 // INHERITED::setData(). |
616 virtual void setData(const GrGLSLProgramDataManager&, const SkImageFilterLig
ht* light) const; | 618 virtual void setData(const GrGLSLProgramDataManager&, const SkImageFilterLig
ht* light) const; |
617 | 619 |
618 protected: | 620 protected: |
619 /** | 621 /** |
620 * Gets the constant light color uniform. Subclasses can use this in their e
mitLightColor | 622 * Gets the constant light color uniform. Subclasses can use this in their e
mitLightColor |
621 * function. | 623 * function. |
622 */ | 624 */ |
623 UniformHandle lightColorUni() const { return fColorUni; } | 625 UniformHandle lightColorUni() const { return fColorUni; } |
624 | 626 |
625 private: | 627 private: |
626 UniformHandle fColorUni; | 628 UniformHandle fColorUni; |
627 | 629 |
628 typedef SkRefCnt INHERITED; | 630 typedef SkRefCnt INHERITED; |
629 }; | 631 }; |
630 | 632 |
631 /////////////////////////////////////////////////////////////////////////////// | 633 /////////////////////////////////////////////////////////////////////////////// |
632 | 634 |
633 class GrGLDistantLight : public GrGLLight { | 635 class GrGLDistantLight : public GrGLLight { |
634 public: | 636 public: |
635 virtual ~GrGLDistantLight() {} | 637 virtual ~GrGLDistantLight() {} |
636 void setData(const GrGLSLProgramDataManager&, const SkImageFilterLight* ligh
t) const override; | 638 void setData(const GrGLSLProgramDataManager&, const SkImageFilterLight* ligh
t) const override; |
637 void emitSurfaceToLight(GrGLSLFPBuilder*, const char* z) override; | 639 void emitSurfaceToLight(GrGLSLFPBuilder*, GrGLSLFragmentBuilder*, const char
* z) override; |
638 | 640 |
639 private: | 641 private: |
640 typedef GrGLLight INHERITED; | 642 typedef GrGLLight INHERITED; |
641 UniformHandle fDirectionUni; | 643 UniformHandle fDirectionUni; |
642 }; | 644 }; |
643 | 645 |
644 /////////////////////////////////////////////////////////////////////////////// | 646 /////////////////////////////////////////////////////////////////////////////// |
645 | 647 |
646 class GrGLPointLight : public GrGLLight { | 648 class GrGLPointLight : public GrGLLight { |
647 public: | 649 public: |
648 virtual ~GrGLPointLight() {} | 650 virtual ~GrGLPointLight() {} |
649 void setData(const GrGLSLProgramDataManager&, const SkImageFilterLight* ligh
t) const override; | 651 void setData(const GrGLSLProgramDataManager&, const SkImageFilterLight* ligh
t) const override; |
650 void emitSurfaceToLight(GrGLSLFPBuilder*, const char* z) override; | 652 void emitSurfaceToLight(GrGLSLFPBuilder*, GrGLSLFragmentBuilder*, const char
* z) override; |
651 | 653 |
652 private: | 654 private: |
653 typedef GrGLLight INHERITED; | 655 typedef GrGLLight INHERITED; |
654 UniformHandle fLocationUni; | 656 UniformHandle fLocationUni; |
655 }; | 657 }; |
656 | 658 |
657 /////////////////////////////////////////////////////////////////////////////// | 659 /////////////////////////////////////////////////////////////////////////////// |
658 | 660 |
659 class GrGLSpotLight : public GrGLLight { | 661 class GrGLSpotLight : public GrGLLight { |
660 public: | 662 public: |
661 virtual ~GrGLSpotLight() {} | 663 virtual ~GrGLSpotLight() {} |
662 void setData(const GrGLSLProgramDataManager&, const SkImageFilterLight* ligh
t) const override; | 664 void setData(const GrGLSLProgramDataManager&, const SkImageFilterLight* ligh
t) const override; |
663 void emitSurfaceToLight(GrGLSLFPBuilder*, const char* z) override; | 665 void emitSurfaceToLight(GrGLSLFPBuilder*, GrGLSLFragmentBuilder*, const char
* z) override; |
664 void emitLightColor(GrGLSLFPBuilder*, const char *surfaceToLight) override; | 666 void emitLightColor(GrGLSLFPBuilder*, |
| 667 GrGLSLFragmentBuilder*, |
| 668 const char *surfaceToLight) override; |
665 | 669 |
666 private: | 670 private: |
667 typedef GrGLLight INHERITED; | 671 typedef GrGLLight INHERITED; |
668 | 672 |
669 SkString fLightColorFunc; | 673 SkString fLightColorFunc; |
670 UniformHandle fLocationUni; | 674 UniformHandle fLocationUni; |
671 UniformHandle fExponentUni; | 675 UniformHandle fExponentUni; |
672 UniformHandle fCosOuterConeAngleUni; | 676 UniformHandle fCosOuterConeAngleUni; |
673 UniformHandle fCosInnerConeAngleUni; | 677 UniformHandle fCosInnerConeAngleUni; |
674 UniformHandle fConeScaleUni; | 678 UniformHandle fConeScaleUni; |
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1516 void emitCode(EmitArgs&) override; | 1520 void emitCode(EmitArgs&) override; |
1517 | 1521 |
1518 static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessor
KeyBuilder* b); | 1522 static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessor
KeyBuilder* b); |
1519 | 1523 |
1520 protected: | 1524 protected: |
1521 /** | 1525 /** |
1522 * Subclasses of GrGLLightingEffect must call INHERITED::onSetData(); | 1526 * Subclasses of GrGLLightingEffect must call INHERITED::onSetData(); |
1523 */ | 1527 */ |
1524 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override
; | 1528 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override
; |
1525 | 1529 |
1526 virtual void emitLightFunc(GrGLSLFPBuilder*, SkString* funcName) = 0; | 1530 virtual void emitLightFunc(GrGLSLFPBuilder*, GrGLSLFragmentBuilder*, SkStrin
g* funcName) = 0; |
1527 | 1531 |
1528 private: | 1532 private: |
1529 typedef GrGLSLFragmentProcessor INHERITED; | 1533 typedef GrGLSLFragmentProcessor INHERITED; |
1530 | 1534 |
1531 UniformHandle fImageIncrementUni; | 1535 UniformHandle fImageIncrementUni; |
1532 UniformHandle fSurfaceScaleUni; | 1536 UniformHandle fSurfaceScaleUni; |
1533 GrGLLight* fLight; | 1537 GrGLLight* fLight; |
1534 BoundaryMode fBoundaryMode; | 1538 BoundaryMode fBoundaryMode; |
1535 }; | 1539 }; |
1536 | 1540 |
1537 /////////////////////////////////////////////////////////////////////////////// | 1541 /////////////////////////////////////////////////////////////////////////////// |
1538 | 1542 |
1539 class GrGLDiffuseLightingEffect : public GrGLLightingEffect { | 1543 class GrGLDiffuseLightingEffect : public GrGLLightingEffect { |
1540 public: | 1544 public: |
1541 GrGLDiffuseLightingEffect(const GrProcessor&); | 1545 GrGLDiffuseLightingEffect(const GrProcessor&); |
1542 void emitLightFunc(GrGLSLFPBuilder*, SkString* funcName) override; | 1546 void emitLightFunc(GrGLSLFPBuilder*, GrGLSLFragmentBuilder*, SkString* funcN
ame) override; |
1543 | 1547 |
1544 protected: | 1548 protected: |
1545 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override
; | 1549 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override
; |
1546 | 1550 |
1547 private: | 1551 private: |
1548 typedef GrGLLightingEffect INHERITED; | 1552 typedef GrGLLightingEffect INHERITED; |
1549 | 1553 |
1550 UniformHandle fKDUni; | 1554 UniformHandle fKDUni; |
1551 }; | 1555 }; |
1552 | 1556 |
1553 /////////////////////////////////////////////////////////////////////////////// | 1557 /////////////////////////////////////////////////////////////////////////////// |
1554 | 1558 |
1555 class GrGLSpecularLightingEffect : public GrGLLightingEffect { | 1559 class GrGLSpecularLightingEffect : public GrGLLightingEffect { |
1556 public: | 1560 public: |
1557 GrGLSpecularLightingEffect(const GrProcessor&); | 1561 GrGLSpecularLightingEffect(const GrProcessor&); |
1558 void emitLightFunc(GrGLSLFPBuilder*, SkString* funcName) override; | 1562 void emitLightFunc(GrGLSLFPBuilder*, GrGLSLFragmentBuilder*, SkString* funcN
ame) override; |
1559 | 1563 |
1560 protected: | 1564 protected: |
1561 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override
; | 1565 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override
; |
1562 | 1566 |
1563 private: | 1567 private: |
1564 typedef GrGLLightingEffect INHERITED; | 1568 typedef GrGLLightingEffect INHERITED; |
1565 | 1569 |
1566 UniformHandle fKSUni; | 1570 UniformHandle fKSUni; |
1567 UniformHandle fShininessUni; | 1571 UniformHandle fShininessUni; |
1568 }; | 1572 }; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1652 } | 1656 } |
1653 | 1657 |
1654 void GrGLLightingEffect::emitCode(EmitArgs& args) { | 1658 void GrGLLightingEffect::emitCode(EmitArgs& args) { |
1655 fImageIncrementUni = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragme
nt_Visibility, | 1659 fImageIncrementUni = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragme
nt_Visibility, |
1656 kVec2f_GrSLType, kDefault_GrSLPrec
ision, | 1660 kVec2f_GrSLType, kDefault_GrSLPrec
ision, |
1657 "ImageIncrement"); | 1661 "ImageIncrement"); |
1658 fSurfaceScaleUni = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment
_Visibility, | 1662 fSurfaceScaleUni = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment
_Visibility, |
1659 kFloat_GrSLType, kDefault_GrSLPrecisi
on, | 1663 kFloat_GrSLType, kDefault_GrSLPrecisi
on, |
1660 "SurfaceScale"); | 1664 "SurfaceScale"); |
1661 fLight->emitLightColorUniform(args.fBuilder); | 1665 fLight->emitLightColorUniform(args.fBuilder); |
| 1666 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; |
1662 SkString lightFunc; | 1667 SkString lightFunc; |
1663 this->emitLightFunc(args.fBuilder, &lightFunc); | 1668 this->emitLightFunc(args.fBuilder, fragBuilder, &lightFunc); |
1664 static const GrGLSLShaderVar gSobelArgs[] = { | 1669 static const GrGLSLShaderVar gSobelArgs[] = { |
1665 GrGLSLShaderVar("a", kFloat_GrSLType), | 1670 GrGLSLShaderVar("a", kFloat_GrSLType), |
1666 GrGLSLShaderVar("b", kFloat_GrSLType), | 1671 GrGLSLShaderVar("b", kFloat_GrSLType), |
1667 GrGLSLShaderVar("c", kFloat_GrSLType), | 1672 GrGLSLShaderVar("c", kFloat_GrSLType), |
1668 GrGLSLShaderVar("d", kFloat_GrSLType), | 1673 GrGLSLShaderVar("d", kFloat_GrSLType), |
1669 GrGLSLShaderVar("e", kFloat_GrSLType), | 1674 GrGLSLShaderVar("e", kFloat_GrSLType), |
1670 GrGLSLShaderVar("f", kFloat_GrSLType), | 1675 GrGLSLShaderVar("f", kFloat_GrSLType), |
1671 GrGLSLShaderVar("scale", kFloat_GrSLType), | 1676 GrGLSLShaderVar("scale", kFloat_GrSLType), |
1672 }; | 1677 }; |
1673 SkString sobelFuncName; | 1678 SkString sobelFuncName; |
1674 GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder()
; | 1679 SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0); |
1675 SkString coords2D = fsBuilder->ensureFSCoords2D(args.fCoords, 0); | |
1676 | 1680 |
1677 fsBuilder->emitFunction(kFloat_GrSLType, | 1681 fragBuilder->emitFunction(kFloat_GrSLType, |
1678 "sobel", | 1682 "sobel", |
1679 SK_ARRAY_COUNT(gSobelArgs), | 1683 SK_ARRAY_COUNT(gSobelArgs), |
1680 gSobelArgs, | 1684 gSobelArgs, |
1681 "\treturn (-a + b - 2.0 * c + 2.0 * d -e + f) * scal
e;\n", | 1685 "\treturn (-a + b - 2.0 * c + 2.0 * d -e + f) * sc
ale;\n", |
1682 &sobelFuncName); | 1686 &sobelFuncName); |
1683 static const GrGLSLShaderVar gPointToNormalArgs[] = { | 1687 static const GrGLSLShaderVar gPointToNormalArgs[] = { |
1684 GrGLSLShaderVar("x", kFloat_GrSLType), | 1688 GrGLSLShaderVar("x", kFloat_GrSLType), |
1685 GrGLSLShaderVar("y", kFloat_GrSLType), | 1689 GrGLSLShaderVar("y", kFloat_GrSLType), |
1686 GrGLSLShaderVar("scale", kFloat_GrSLType), | 1690 GrGLSLShaderVar("scale", kFloat_GrSLType), |
1687 }; | 1691 }; |
1688 SkString pointToNormalName; | 1692 SkString pointToNormalName; |
1689 fsBuilder->emitFunction(kVec3f_GrSLType, | 1693 fragBuilder->emitFunction(kVec3f_GrSLType, |
1690 "pointToNormal", | 1694 "pointToNormal", |
1691 SK_ARRAY_COUNT(gPointToNormalArgs), | 1695 SK_ARRAY_COUNT(gPointToNormalArgs), |
1692 gPointToNormalArgs, | 1696 gPointToNormalArgs, |
1693 "\treturn normalize(vec3(-x * scale, -y * scale, 1))
;\n", | 1697 "\treturn normalize(vec3(-x * scale, -y * scale, 1
));\n", |
1694 &pointToNormalName); | 1698 &pointToNormalName); |
1695 | 1699 |
1696 static const GrGLSLShaderVar gInteriorNormalArgs[] = { | 1700 static const GrGLSLShaderVar gInteriorNormalArgs[] = { |
1697 GrGLSLShaderVar("m", kFloat_GrSLType, 9), | 1701 GrGLSLShaderVar("m", kFloat_GrSLType, 9), |
1698 GrGLSLShaderVar("surfaceScale", kFloat_GrSLType), | 1702 GrGLSLShaderVar("surfaceScale", kFloat_GrSLType), |
1699 }; | 1703 }; |
1700 SkString normalBody = emitNormalFunc(fBoundaryMode, | 1704 SkString normalBody = emitNormalFunc(fBoundaryMode, |
1701 pointToNormalName.c_str(), | 1705 pointToNormalName.c_str(), |
1702 sobelFuncName.c_str()); | 1706 sobelFuncName.c_str()); |
1703 SkString normalName; | 1707 SkString normalName; |
1704 fsBuilder->emitFunction(kVec3f_GrSLType, | 1708 fragBuilder->emitFunction(kVec3f_GrSLType, |
1705 "normal", | 1709 "normal", |
1706 SK_ARRAY_COUNT(gInteriorNormalArgs), | 1710 SK_ARRAY_COUNT(gInteriorNormalArgs), |
1707 gInteriorNormalArgs, | 1711 gInteriorNormalArgs, |
1708 normalBody.c_str(), | 1712 normalBody.c_str(), |
1709 &normalName); | 1713 &normalName); |
1710 | 1714 |
1711 fsBuilder->codeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str()); | 1715 fragBuilder->codeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str()); |
1712 fsBuilder->codeAppend("\t\tfloat m[9];\n"); | 1716 fragBuilder->codeAppend("\t\tfloat m[9];\n"); |
1713 | 1717 |
1714 const char* imgInc = args.fBuilder->getUniformCStr(fImageIncrementUni); | 1718 const char* imgInc = args.fBuilder->getUniformCStr(fImageIncrementUni); |
1715 const char* surfScale = args.fBuilder->getUniformCStr(fSurfaceScaleUni); | 1719 const char* surfScale = args.fBuilder->getUniformCStr(fSurfaceScaleUni); |
1716 | 1720 |
1717 int index = 0; | 1721 int index = 0; |
1718 for (int dy = 1; dy >= -1; dy--) { | 1722 for (int dy = 1; dy >= -1; dy--) { |
1719 for (int dx = -1; dx <= 1; dx++) { | 1723 for (int dx = -1; dx <= 1; dx++) { |
1720 SkString texCoords; | 1724 SkString texCoords; |
1721 texCoords.appendf("coord + vec2(%d, %d) * %s", dx, dy, imgInc); | 1725 texCoords.appendf("coord + vec2(%d, %d) * %s", dx, dy, imgInc); |
1722 fsBuilder->codeAppendf("\t\tm[%d] = ", index++); | 1726 fragBuilder->codeAppendf("\t\tm[%d] = ", index++); |
1723 fsBuilder->appendTextureLookup(args.fSamplers[0], texCoords.c_str())
; | 1727 fragBuilder->appendTextureLookup(args.fSamplers[0], texCoords.c_str(
)); |
1724 fsBuilder->codeAppend(".a;\n"); | 1728 fragBuilder->codeAppend(".a;\n"); |
1725 } | 1729 } |
1726 } | 1730 } |
1727 fsBuilder->codeAppend("\t\tvec3 surfaceToLight = "); | 1731 fragBuilder->codeAppend("\t\tvec3 surfaceToLight = "); |
1728 SkString arg; | 1732 SkString arg; |
1729 arg.appendf("%s * m[4]", surfScale); | 1733 arg.appendf("%s * m[4]", surfScale); |
1730 fLight->emitSurfaceToLight(args.fBuilder, arg.c_str()); | 1734 fLight->emitSurfaceToLight(args.fBuilder, fragBuilder, arg.c_str()); |
1731 fsBuilder->codeAppend(";\n"); | 1735 fragBuilder->codeAppend(";\n"); |
1732 fsBuilder->codeAppendf("\t\t%s = %s(%s(m, %s), surfaceToLight, ", | 1736 fragBuilder->codeAppendf("\t\t%s = %s(%s(m, %s), surfaceToLight, ", |
1733 args.fOutputColor, lightFunc.c_str(), normalName.c_st
r(), surfScale); | 1737 args.fOutputColor, lightFunc.c_str(), normalName.c_
str(), surfScale); |
1734 fLight->emitLightColor(args.fBuilder, "surfaceToLight"); | 1738 fLight->emitLightColor(args.fBuilder, fragBuilder, "surfaceToLight"); |
1735 fsBuilder->codeAppend(");\n"); | 1739 fragBuilder->codeAppend(");\n"); |
1736 SkString modulate; | 1740 SkString modulate; |
1737 GrGLSLMulVarBy4f(&modulate, args.fOutputColor, args.fInputColor); | 1741 GrGLSLMulVarBy4f(&modulate, args.fOutputColor, args.fInputColor); |
1738 fsBuilder->codeAppend(modulate.c_str()); | 1742 fragBuilder->codeAppend(modulate.c_str()); |
1739 } | 1743 } |
1740 | 1744 |
1741 void GrGLLightingEffect::GenKey(const GrProcessor& proc, | 1745 void GrGLLightingEffect::GenKey(const GrProcessor& proc, |
1742 const GrGLSLCaps& caps, GrProcessorKeyBuilder* b
) { | 1746 const GrGLSLCaps& caps, GrProcessorKeyBuilder* b
) { |
1743 const GrLightingEffect& lighting = proc.cast<GrLightingEffect>(); | 1747 const GrLightingEffect& lighting = proc.cast<GrLightingEffect>(); |
1744 b->add32(lighting.boundaryMode() << 2 | lighting.light()->type()); | 1748 b->add32(lighting.boundaryMode() << 2 | lighting.light()->type()); |
1745 } | 1749 } |
1746 | 1750 |
1747 void GrGLLightingEffect::onSetData(const GrGLSLProgramDataManager& pdman, | 1751 void GrGLLightingEffect::onSetData(const GrGLSLProgramDataManager& pdman, |
1748 const GrProcessor& proc) { | 1752 const GrProcessor& proc) { |
1749 const GrLightingEffect& lighting = proc.cast<GrLightingEffect>(); | 1753 const GrLightingEffect& lighting = proc.cast<GrLightingEffect>(); |
1750 GrTexture* texture = lighting.texture(0); | 1754 GrTexture* texture = lighting.texture(0); |
1751 float ySign = texture->origin() == kTopLeft_GrSurfaceOrigin ? -1.0f : 1.0f; | 1755 float ySign = texture->origin() == kTopLeft_GrSurfaceOrigin ? -1.0f : 1.0f; |
1752 pdman.set2f(fImageIncrementUni, 1.0f / texture->width(), ySign / texture->he
ight()); | 1756 pdman.set2f(fImageIncrementUni, 1.0f / texture->width(), ySign / texture->he
ight()); |
1753 pdman.set1f(fSurfaceScaleUni, lighting.surfaceScale()); | 1757 pdman.set1f(fSurfaceScaleUni, lighting.surfaceScale()); |
1754 SkAutoTUnref<SkImageFilterLight> transformedLight( | 1758 SkAutoTUnref<SkImageFilterLight> transformedLight( |
1755 lighting.light()->transform(lighting
.filterMatrix())); | 1759 lighting.light()->transform(lighting
.filterMatrix())); |
1756 fLight->setData(pdman, transformedLight); | 1760 fLight->setData(pdman, transformedLight); |
1757 } | 1761 } |
1758 | 1762 |
1759 /////////////////////////////////////////////////////////////////////////////// | 1763 /////////////////////////////////////////////////////////////////////////////// |
1760 | 1764 |
1761 /////////////////////////////////////////////////////////////////////////////// | 1765 /////////////////////////////////////////////////////////////////////////////// |
1762 | 1766 |
1763 GrGLDiffuseLightingEffect::GrGLDiffuseLightingEffect(const GrProcessor& proc) | 1767 GrGLDiffuseLightingEffect::GrGLDiffuseLightingEffect(const GrProcessor& proc) |
1764 : INHERITED(proc) { | 1768 : INHERITED(proc) { |
1765 } | 1769 } |
1766 | 1770 |
1767 void GrGLDiffuseLightingEffect::emitLightFunc(GrGLSLFPBuilder* builder, SkString
* funcName) { | 1771 void GrGLDiffuseLightingEffect::emitLightFunc(GrGLSLFPBuilder* builder, |
| 1772 GrGLSLFragmentBuilder* fragBuilder
, |
| 1773 SkString* funcName) { |
1768 const char* kd; | 1774 const char* kd; |
1769 fKDUni = builder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility, | 1775 fKDUni = builder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility, |
1770 kFloat_GrSLType, kDefault_GrSLPrecision, | 1776 kFloat_GrSLType, kDefault_GrSLPrecision, |
1771 "KD", &kd); | 1777 "KD", &kd); |
1772 | 1778 |
1773 static const GrGLSLShaderVar gLightArgs[] = { | 1779 static const GrGLSLShaderVar gLightArgs[] = { |
1774 GrGLSLShaderVar("normal", kVec3f_GrSLType), | 1780 GrGLSLShaderVar("normal", kVec3f_GrSLType), |
1775 GrGLSLShaderVar("surfaceToLight", kVec3f_GrSLType), | 1781 GrGLSLShaderVar("surfaceToLight", kVec3f_GrSLType), |
1776 GrGLSLShaderVar("lightColor", kVec3f_GrSLType) | 1782 GrGLSLShaderVar("lightColor", kVec3f_GrSLType) |
1777 }; | 1783 }; |
1778 SkString lightBody; | 1784 SkString lightBody; |
1779 lightBody.appendf("\tfloat colorScale = %s * dot(normal, surfaceToLight);\n"
, kd); | 1785 lightBody.appendf("\tfloat colorScale = %s * dot(normal, surfaceToLight);\n"
, kd); |
1780 lightBody.appendf("\treturn vec4(lightColor * clamp(colorScale, 0.0, 1.0), 1
.0);\n"); | 1786 lightBody.appendf("\treturn vec4(lightColor * clamp(colorScale, 0.0, 1.0), 1
.0);\n"); |
1781 builder->getFragmentShaderBuilder()->emitFunction(kVec4f_GrSLType, | 1787 fragBuilder->emitFunction(kVec4f_GrSLType, |
1782 "light", | 1788 "light", |
1783 SK_ARRAY_COUNT(gLightArgs)
, | 1789 SK_ARRAY_COUNT(gLightArgs), |
1784 gLightArgs, | 1790 gLightArgs, |
1785 lightBody.c_str(), | 1791 lightBody.c_str(), |
1786 funcName); | 1792 funcName); |
1787 } | 1793 } |
1788 | 1794 |
1789 void GrGLDiffuseLightingEffect::onSetData(const GrGLSLProgramDataManager& pdman, | 1795 void GrGLDiffuseLightingEffect::onSetData(const GrGLSLProgramDataManager& pdman, |
1790 const GrProcessor& proc) { | 1796 const GrProcessor& proc) { |
1791 INHERITED::onSetData(pdman, proc); | 1797 INHERITED::onSetData(pdman, proc); |
1792 const GrDiffuseLightingEffect& diffuse = proc.cast<GrDiffuseLightingEffect>(
); | 1798 const GrDiffuseLightingEffect& diffuse = proc.cast<GrDiffuseLightingEffect>(
); |
1793 pdman.set1f(fKDUni, diffuse.kd()); | 1799 pdman.set1f(fKDUni, diffuse.kd()); |
1794 } | 1800 } |
1795 | 1801 |
1796 /////////////////////////////////////////////////////////////////////////////// | 1802 /////////////////////////////////////////////////////////////////////////////// |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1839 return GrSpecularLightingEffect::Create(d->fTextures[GrProcessorUnitTest::kA
lphaTextureIdx], | 1845 return GrSpecularLightingEffect::Create(d->fTextures[GrProcessorUnitTest::kA
lphaTextureIdx], |
1840 light, surfaceScale, matrix, ks, shi
niness, mode); | 1846 light, surfaceScale, matrix, ks, shi
niness, mode); |
1841 } | 1847 } |
1842 | 1848 |
1843 /////////////////////////////////////////////////////////////////////////////// | 1849 /////////////////////////////////////////////////////////////////////////////// |
1844 | 1850 |
1845 GrGLSpecularLightingEffect::GrGLSpecularLightingEffect(const GrProcessor& proc) | 1851 GrGLSpecularLightingEffect::GrGLSpecularLightingEffect(const GrProcessor& proc) |
1846 : INHERITED(proc) { | 1852 : INHERITED(proc) { |
1847 } | 1853 } |
1848 | 1854 |
1849 void GrGLSpecularLightingEffect::emitLightFunc(GrGLSLFPBuilder* builder, SkStrin
g* funcName) { | 1855 void GrGLSpecularLightingEffect::emitLightFunc(GrGLSLFPBuilder* builder, |
| 1856 GrGLSLFragmentBuilder* fragBuilde
r, |
| 1857 SkString* funcName) { |
1850 const char* ks; | 1858 const char* ks; |
1851 const char* shininess; | 1859 const char* shininess; |
1852 | 1860 |
1853 fKSUni = builder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility, | 1861 fKSUni = builder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility, |
1854 kFloat_GrSLType, kDefault_GrSLPrecision, "KS",
&ks); | 1862 kFloat_GrSLType, kDefault_GrSLPrecision, "KS",
&ks); |
1855 fShininessUni = builder->addUniform(GrGLSLProgramBuilder::kFragment_Visibili
ty, | 1863 fShininessUni = builder->addUniform(GrGLSLProgramBuilder::kFragment_Visibili
ty, |
1856 kFloat_GrSLType, | 1864 kFloat_GrSLType, |
1857 kDefault_GrSLPrecision, | 1865 kDefault_GrSLPrecision, |
1858 "Shininess", | 1866 "Shininess", |
1859 &shininess); | 1867 &shininess); |
1860 | 1868 |
1861 static const GrGLSLShaderVar gLightArgs[] = { | 1869 static const GrGLSLShaderVar gLightArgs[] = { |
1862 GrGLSLShaderVar("normal", kVec3f_GrSLType), | 1870 GrGLSLShaderVar("normal", kVec3f_GrSLType), |
1863 GrGLSLShaderVar("surfaceToLight", kVec3f_GrSLType), | 1871 GrGLSLShaderVar("surfaceToLight", kVec3f_GrSLType), |
1864 GrGLSLShaderVar("lightColor", kVec3f_GrSLType) | 1872 GrGLSLShaderVar("lightColor", kVec3f_GrSLType) |
1865 }; | 1873 }; |
1866 SkString lightBody; | 1874 SkString lightBody; |
1867 lightBody.appendf("\tvec3 halfDir = vec3(normalize(surfaceToLight + vec3(0,
0, 1)));\n"); | 1875 lightBody.appendf("\tvec3 halfDir = vec3(normalize(surfaceToLight + vec3(0,
0, 1)));\n"); |
1868 lightBody.appendf("\tfloat colorScale = %s * pow(dot(normal, halfDir), %s);\
n", ks, shininess); | 1876 lightBody.appendf("\tfloat colorScale = %s * pow(dot(normal, halfDir), %s);\
n", ks, shininess); |
1869 lightBody.appendf("\tvec3 color = lightColor * clamp(colorScale, 0.0, 1.0);\
n"); | 1877 lightBody.appendf("\tvec3 color = lightColor * clamp(colorScale, 0.0, 1.0);\
n"); |
1870 lightBody.appendf("\treturn vec4(color, max(max(color.r, color.g), color.b))
;\n"); | 1878 lightBody.appendf("\treturn vec4(color, max(max(color.r, color.g), color.b))
;\n"); |
1871 builder->getFragmentShaderBuilder()->emitFunction(kVec4f_GrSLType, | 1879 fragBuilder->emitFunction(kVec4f_GrSLType, |
1872 "light", | 1880 "light", |
1873 SK_ARRAY_COUNT(gLightArgs)
, | 1881 SK_ARRAY_COUNT(gLightArgs), |
1874 gLightArgs, | 1882 gLightArgs, |
1875 lightBody.c_str(), | 1883 lightBody.c_str(), |
1876 funcName); | 1884 funcName); |
1877 } | 1885 } |
1878 | 1886 |
1879 void GrGLSpecularLightingEffect::onSetData(const GrGLSLProgramDataManager& pdman
, | 1887 void GrGLSpecularLightingEffect::onSetData(const GrGLSLProgramDataManager& pdman
, |
1880 const GrProcessor& effect) { | 1888 const GrProcessor& effect) { |
1881 INHERITED::onSetData(pdman, effect); | 1889 INHERITED::onSetData(pdman, effect); |
1882 const GrSpecularLightingEffect& spec = effect.cast<GrSpecularLightingEffect>
(); | 1890 const GrSpecularLightingEffect& spec = effect.cast<GrSpecularLightingEffect>
(); |
1883 pdman.set1f(fKSUni, spec.ks()); | 1891 pdman.set1f(fKSUni, spec.ks()); |
1884 pdman.set1f(fShininessUni, spec.shininess()); | 1892 pdman.set1f(fShininessUni, spec.shininess()); |
1885 } | 1893 } |
1886 | 1894 |
1887 /////////////////////////////////////////////////////////////////////////////// | 1895 /////////////////////////////////////////////////////////////////////////////// |
1888 void GrGLLight::emitLightColorUniform(GrGLSLFPBuilder* builder) { | 1896 void GrGLLight::emitLightColorUniform(GrGLSLFPBuilder* builder) { |
1889 fColorUni = builder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility, | 1897 fColorUni = builder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility, |
1890 kVec3f_GrSLType, kDefault_GrSLPrecision, | 1898 kVec3f_GrSLType, kDefault_GrSLPrecision, |
1891 "LightColor"); | 1899 "LightColor"); |
1892 } | 1900 } |
1893 | 1901 |
1894 void GrGLLight::emitLightColor(GrGLSLFPBuilder* builder, const char *surfaceToLi
ght) { | 1902 void GrGLLight::emitLightColor(GrGLSLFPBuilder* builder, |
1895 builder->getFragmentShaderBuilder()->codeAppend(builder->getUniformCStr(this
->lightColorUni())); | 1903 GrGLSLFragmentBuilder* fragBuilder, |
| 1904 const char *surfaceToLight) { |
| 1905 fragBuilder->codeAppend(builder->getUniformCStr(this->lightColorUni())); |
1896 } | 1906 } |
1897 | 1907 |
1898 void GrGLLight::setData(const GrGLSLProgramDataManager& pdman, | 1908 void GrGLLight::setData(const GrGLSLProgramDataManager& pdman, |
1899 const SkImageFilterLight* light) const { | 1909 const SkImageFilterLight* light) const { |
1900 setUniformPoint3(pdman, fColorUni, | 1910 setUniformPoint3(pdman, fColorUni, |
1901 light->color().makeScale(SkScalarInvert(SkIntToScalar(255))
)); | 1911 light->color().makeScale(SkScalarInvert(SkIntToScalar(255))
)); |
1902 } | 1912 } |
1903 | 1913 |
1904 /////////////////////////////////////////////////////////////////////////////// | 1914 /////////////////////////////////////////////////////////////////////////////// |
1905 | 1915 |
1906 void GrGLDistantLight::setData(const GrGLSLProgramDataManager& pdman, | 1916 void GrGLDistantLight::setData(const GrGLSLProgramDataManager& pdman, |
1907 const SkImageFilterLight* light) const { | 1917 const SkImageFilterLight* light) const { |
1908 INHERITED::setData(pdman, light); | 1918 INHERITED::setData(pdman, light); |
1909 SkASSERT(light->type() == SkImageFilterLight::kDistant_LightType); | 1919 SkASSERT(light->type() == SkImageFilterLight::kDistant_LightType); |
1910 const SkDistantLight* distantLight = static_cast<const SkDistantLight*>(ligh
t); | 1920 const SkDistantLight* distantLight = static_cast<const SkDistantLight*>(ligh
t); |
1911 setUniformNormal3(pdman, fDirectionUni, distantLight->direction()); | 1921 setUniformNormal3(pdman, fDirectionUni, distantLight->direction()); |
1912 } | 1922 } |
1913 | 1923 |
1914 void GrGLDistantLight::emitSurfaceToLight(GrGLSLFPBuilder* builder, const char*
z) { | 1924 void GrGLDistantLight::emitSurfaceToLight(GrGLSLFPBuilder* builder, |
| 1925 GrGLSLFragmentBuilder* fragBuilder, |
| 1926 const char* z) { |
1915 const char* dir; | 1927 const char* dir; |
1916 fDirectionUni = builder->addUniform(GrGLSLProgramBuilder::kFragment_Visibili
ty, | 1928 fDirectionUni = builder->addUniform(GrGLSLProgramBuilder::kFragment_Visibili
ty, |
1917 kVec3f_GrSLType, kDefault_GrSLPrecision, | 1929 kVec3f_GrSLType, kDefault_GrSLPrecision, |
1918 "LightDirection", &dir); | 1930 "LightDirection", &dir); |
1919 builder->getFragmentShaderBuilder()->codeAppend(dir); | 1931 fragBuilder->codeAppend(dir); |
1920 } | 1932 } |
1921 | 1933 |
1922 /////////////////////////////////////////////////////////////////////////////// | 1934 /////////////////////////////////////////////////////////////////////////////// |
1923 | 1935 |
1924 void GrGLPointLight::setData(const GrGLSLProgramDataManager& pdman, | 1936 void GrGLPointLight::setData(const GrGLSLProgramDataManager& pdman, |
1925 const SkImageFilterLight* light) const { | 1937 const SkImageFilterLight* light) const { |
1926 INHERITED::setData(pdman, light); | 1938 INHERITED::setData(pdman, light); |
1927 SkASSERT(light->type() == SkImageFilterLight::kPoint_LightType); | 1939 SkASSERT(light->type() == SkImageFilterLight::kPoint_LightType); |
1928 const SkPointLight* pointLight = static_cast<const SkPointLight*>(light); | 1940 const SkPointLight* pointLight = static_cast<const SkPointLight*>(light); |
1929 setUniformPoint3(pdman, fLocationUni, pointLight->location()); | 1941 setUniformPoint3(pdman, fLocationUni, pointLight->location()); |
1930 } | 1942 } |
1931 | 1943 |
1932 void GrGLPointLight::emitSurfaceToLight(GrGLSLFPBuilder* builder, const char* z)
{ | 1944 void GrGLPointLight::emitSurfaceToLight(GrGLSLFPBuilder* builder, |
| 1945 GrGLSLFragmentBuilder* fragBuilder, |
| 1946 const char* z) { |
1933 const char* loc; | 1947 const char* loc; |
1934 fLocationUni = builder->addUniform(GrGLSLProgramBuilder::kFragment_Visibilit
y, | 1948 fLocationUni = builder->addUniform(GrGLSLProgramBuilder::kFragment_Visibilit
y, |
1935 kVec3f_GrSLType, kDefault_GrSLPrecision, | 1949 kVec3f_GrSLType, kDefault_GrSLPrecision, |
1936 "LightLocation", &loc); | 1950 "LightLocation", &loc); |
1937 GrGLSLFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); | 1951 fragBuilder->codeAppendf("normalize(%s - vec3(%s.xy, %s))", |
1938 fsBuilder->codeAppendf("normalize(%s - vec3(%s.xy, %s))", | 1952 loc, fragBuilder->fragmentPosition(), z); |
1939 loc, fsBuilder->fragmentPosition(), z); | |
1940 } | 1953 } |
1941 | 1954 |
1942 /////////////////////////////////////////////////////////////////////////////// | 1955 /////////////////////////////////////////////////////////////////////////////// |
1943 | 1956 |
1944 void GrGLSpotLight::setData(const GrGLSLProgramDataManager& pdman, | 1957 void GrGLSpotLight::setData(const GrGLSLProgramDataManager& pdman, |
1945 const SkImageFilterLight* light) const { | 1958 const SkImageFilterLight* light) const { |
1946 INHERITED::setData(pdman, light); | 1959 INHERITED::setData(pdman, light); |
1947 SkASSERT(light->type() == SkImageFilterLight::kSpot_LightType); | 1960 SkASSERT(light->type() == SkImageFilterLight::kSpot_LightType); |
1948 const SkSpotLight* spotLight = static_cast<const SkSpotLight *>(light); | 1961 const SkSpotLight* spotLight = static_cast<const SkSpotLight *>(light); |
1949 setUniformPoint3(pdman, fLocationUni, spotLight->location()); | 1962 setUniformPoint3(pdman, fLocationUni, spotLight->location()); |
1950 pdman.set1f(fExponentUni, spotLight->specularExponent()); | 1963 pdman.set1f(fExponentUni, spotLight->specularExponent()); |
1951 pdman.set1f(fCosInnerConeAngleUni, spotLight->cosInnerConeAngle()); | 1964 pdman.set1f(fCosInnerConeAngleUni, spotLight->cosInnerConeAngle()); |
1952 pdman.set1f(fCosOuterConeAngleUni, spotLight->cosOuterConeAngle()); | 1965 pdman.set1f(fCosOuterConeAngleUni, spotLight->cosOuterConeAngle()); |
1953 pdman.set1f(fConeScaleUni, spotLight->coneScale()); | 1966 pdman.set1f(fConeScaleUni, spotLight->coneScale()); |
1954 setUniformNormal3(pdman, fSUni, spotLight->s()); | 1967 setUniformNormal3(pdman, fSUni, spotLight->s()); |
1955 } | 1968 } |
1956 | 1969 |
1957 void GrGLSpotLight::emitSurfaceToLight(GrGLSLFPBuilder* builder, const char* z)
{ | 1970 void GrGLSpotLight::emitSurfaceToLight(GrGLSLFPBuilder* builder, |
| 1971 GrGLSLFragmentBuilder* fragBuilder, |
| 1972 const char* z) { |
1958 const char* location; | 1973 const char* location; |
1959 fLocationUni = builder->addUniform(GrGLSLProgramBuilder::kFragment_Visibilit
y, | 1974 fLocationUni = builder->addUniform(GrGLSLProgramBuilder::kFragment_Visibilit
y, |
1960 kVec3f_GrSLType, kDefault_GrSLPrecision, | 1975 kVec3f_GrSLType, kDefault_GrSLPrecision, |
1961 "LightLocation", &location); | 1976 "LightLocation", &location); |
1962 | 1977 |
1963 GrGLSLFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); | 1978 fragBuilder->codeAppendf("normalize(%s - vec3(%s.xy, %s))", |
1964 fsBuilder->codeAppendf("normalize(%s - vec3(%s.xy, %s))", | 1979 location, fragBuilder->fragmentPosition(), z); |
1965 location, fsBuilder->fragmentPosition(), z); | |
1966 } | 1980 } |
1967 | 1981 |
1968 void GrGLSpotLight::emitLightColor(GrGLSLFPBuilder* builder, | 1982 void GrGLSpotLight::emitLightColor(GrGLSLFPBuilder* builder, |
| 1983 GrGLSLFragmentBuilder* fragBuilder, |
1969 const char *surfaceToLight) { | 1984 const char *surfaceToLight) { |
1970 | 1985 |
1971 const char* color = builder->getUniformCStr(this->lightColorUni()); // creat
ed by parent class. | 1986 const char* color = builder->getUniformCStr(this->lightColorUni()); // creat
ed by parent class. |
1972 | 1987 |
1973 const char* exponent; | 1988 const char* exponent; |
1974 const char* cosInner; | 1989 const char* cosInner; |
1975 const char* cosOuter; | 1990 const char* cosOuter; |
1976 const char* coneScale; | 1991 const char* coneScale; |
1977 const char* s; | 1992 const char* s; |
1978 fExponentUni = builder->addUniform(GrGLSLProgramBuilder::kFragment_Visibilit
y, | 1993 fExponentUni = builder->addUniform(GrGLSLProgramBuilder::kFragment_Visibilit
y, |
(...skipping 18 matching lines...) Expand all Loading... |
1997 lightColorBody.appendf("\tfloat cosAngle = -dot(surfaceToLight, %s);\n", s); | 2012 lightColorBody.appendf("\tfloat cosAngle = -dot(surfaceToLight, %s);\n", s); |
1998 lightColorBody.appendf("\tif (cosAngle < %s) {\n", cosOuter); | 2013 lightColorBody.appendf("\tif (cosAngle < %s) {\n", cosOuter); |
1999 lightColorBody.appendf("\t\treturn vec3(0);\n"); | 2014 lightColorBody.appendf("\t\treturn vec3(0);\n"); |
2000 lightColorBody.appendf("\t}\n"); | 2015 lightColorBody.appendf("\t}\n"); |
2001 lightColorBody.appendf("\tfloat scale = pow(cosAngle, %s);\n", exponent); | 2016 lightColorBody.appendf("\tfloat scale = pow(cosAngle, %s);\n", exponent); |
2002 lightColorBody.appendf("\tif (cosAngle < %s) {\n", cosInner); | 2017 lightColorBody.appendf("\tif (cosAngle < %s) {\n", cosInner); |
2003 lightColorBody.appendf("\t\treturn %s * scale * (cosAngle - %s) * %s;\n", | 2018 lightColorBody.appendf("\t\treturn %s * scale * (cosAngle - %s) * %s;\n", |
2004 color, cosOuter, coneScale); | 2019 color, cosOuter, coneScale); |
2005 lightColorBody.appendf("\t}\n"); | 2020 lightColorBody.appendf("\t}\n"); |
2006 lightColorBody.appendf("\treturn %s;\n", color); | 2021 lightColorBody.appendf("\treturn %s;\n", color); |
2007 GrGLSLFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); | 2022 fragBuilder->emitFunction(kVec3f_GrSLType, |
2008 fsBuilder->emitFunction(kVec3f_GrSLType, | 2023 "lightColor", |
2009 "lightColor", | 2024 SK_ARRAY_COUNT(gLightColorArgs), |
2010 SK_ARRAY_COUNT(gLightColorArgs), | 2025 gLightColorArgs, |
2011 gLightColorArgs, | 2026 lightColorBody.c_str(), |
2012 lightColorBody.c_str(), | 2027 &fLightColorFunc); |
2013 &fLightColorFunc); | |
2014 | 2028 |
2015 fsBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 2029 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
2016 } | 2030 } |
2017 | 2031 |
2018 #endif | 2032 #endif |
2019 | 2033 |
2020 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 2034 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
2021 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 2035 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
2022 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 2036 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
2023 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 2037 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |