Flutter Engine
The Flutter Engine
Classes | Public Member Functions | List of all members
skgpu::graphite::ShaderCodeDictionary Class Reference

#include <ShaderCodeDictionary.h>

Public Member Functions

 ShaderCodeDictionary ()
 
UniquePaintParamsID findOrCreate (PaintParamsKeyBuilder *) SK_EXCLUDES(fSpinLock)
 
PaintParamsKey lookup (UniquePaintParamsID) const SK_EXCLUDES(fSpinLock)
 
SkString idToString (UniquePaintParamsID id) const
 
SkSpan< const UniformgetUniforms (BuiltInCodeSnippetID) const
 
SkEnumBitMask< SnippetRequirementFlagsgetSnippetRequirementFlags (BuiltInCodeSnippetID id) const
 
const ShaderSnippetgetEntry (int codeSnippetID) const SK_EXCLUDES(fSpinLock)
 
const ShaderSnippetgetEntry (BuiltInCodeSnippetID codeSnippetID) const SK_EXCLUDES(fSpinLock)
 
int findOrCreateRuntimeEffectSnippet (const SkRuntimeEffect *effect)
 

Detailed Description

Definition at line 246 of file ShaderCodeDictionary.h.

Constructor & Destructor Documentation

◆ ShaderCodeDictionary()

skgpu::graphite::ShaderCodeDictionary::ShaderCodeDictionary ( )

Definition at line 1703 of file ShaderCodeDictionary.cpp.

1703 {
1704 // The 0th index is reserved as invalid
1705 fIDToPaintKey.push_back(PaintParamsKey::Invalid());
1706
1707 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kError] = {
1708 "Error",
1709 { }, // no uniforms
1711 { }, // no samplers
1712 kErrorName,
1713 GenerateDefaultExpression,
1714 GenerateDefaultPreamble,
1716 };
1717 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kPriorOutput] = {
1718 "PassthroughShader",
1719 { }, // no uniforms
1721 { }, // no samplers
1722 kPassthroughShaderName,
1723 GenerateDefaultExpression,
1724 GenerateDefaultPreamble,
1726 };
1727 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kSolidColorShader] = {
1728 "SolidColor",
1729 SkSpan(kSolidShaderUniforms),
1731 { }, // no samplers
1732 kSolidShaderName,
1733 GenerateDefaultExpression,
1734 GenerateDefaultPreamble,
1736 };
1737 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kRGBPaintColor] = {
1738 "RGBPaintColor",
1739 SkSpan(kPaintColorUniforms),
1741 { }, // no samplers
1742 kRGBPaintColorName,
1743 GenerateDefaultExpression,
1744 GenerateDefaultPreamble,
1746 };
1747 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kAlphaOnlyPaintColor] = {
1748 "AlphaOnlyPaintColor",
1749 SkSpan(kPaintColorUniforms),
1751 { }, // no samplers
1752 kAlphaOnlyPaintColorName,
1753 GenerateDefaultExpression,
1754 GenerateDefaultPreamble,
1756 };
1757 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kLinearGradientShader4] = {
1758 "LinearGradient4",
1759 SkSpan(kLinearGradientUniforms4),
1761 { }, // no samplers
1762 kLinearGradient4Name,
1763 GenerateDefaultExpression,
1764 GenerateDefaultPreamble,
1766 };
1767 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kLinearGradientShader8] = {
1768 "LinearGradient8",
1769 SkSpan(kLinearGradientUniforms8),
1771 { }, // no samplers
1772 kLinearGradient8Name,
1773 GenerateDefaultExpression,
1774 GenerateDefaultPreamble,
1776 };
1778 "LinearGradientTexture",
1779 SkSpan(kLinearGradientUniformsTexture),
1781 SkSpan(kTextureGradientTexturesAndSamplers),
1782 kLinearGradientTextureName,
1783 GenerateDefaultExpression,
1784 GenerateDefaultPreamble,
1786 };
1787 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kLinearGradientShaderBuffer] = {
1788 "LinearGradientBuffer",
1789 SkSpan(kLinearGradientUniformsBuffer),
1791 { }, // no samplers
1792 kLinearGradientBufferName,
1793 GenerateDefaultExpression,
1794 GenerateDefaultPreamble,
1796 };
1797 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kRadialGradientShader4] = {
1798 "RadialGradient4",
1799 SkSpan(kRadialGradientUniforms4),
1801 { }, // no samplers
1802 kRadialGradient4Name,
1803 GenerateDefaultExpression,
1804 GenerateDefaultPreamble,
1806 };
1807 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kRadialGradientShader8] = {
1808 "RadialGradient8",
1809 SkSpan(kRadialGradientUniforms8),
1811 { }, // no samplers
1812 kRadialGradient8Name,
1813 GenerateDefaultExpression,
1814 GenerateDefaultPreamble,
1816 };
1818 "RadialGradientTexture",
1819 SkSpan(kRadialGradientUniformsTexture),
1821 SkSpan(kTextureGradientTexturesAndSamplers),
1822 kRadialGradientTextureName,
1823 GenerateDefaultExpression,
1824 GenerateDefaultPreamble,
1826 };
1827 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kRadialGradientShaderBuffer] = {
1828 "RadialGradientBuffer",
1829 SkSpan(kRadialGradientUniformsBuffer),
1831 { }, // no samplers
1832 kRadialGradientBufferName,
1833 GenerateDefaultExpression,
1834 GenerateDefaultPreamble,
1836 };
1837 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kSweepGradientShader4] = {
1838 "SweepGradient4",
1839 SkSpan(kSweepGradientUniforms4),
1841 { }, // no samplers
1842 kSweepGradient4Name,
1843 GenerateDefaultExpression,
1844 GenerateDefaultPreamble,
1846 };
1847 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kSweepGradientShader8] = {
1848 "SweepGradient8",
1849 SkSpan(kSweepGradientUniforms8),
1851 { }, // no samplers
1852 kSweepGradient8Name,
1853 GenerateDefaultExpression,
1854 GenerateDefaultPreamble,
1856 };
1857 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kSweepGradientShaderTexture] = {
1858 "SweepGradientTexture",
1859 SkSpan(kSweepGradientUniformsTexture),
1861 SkSpan(kTextureGradientTexturesAndSamplers),
1862 kSweepGradientTextureName,
1863 GenerateDefaultExpression,
1864 GenerateDefaultPreamble,
1866 };
1867 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kSweepGradientShaderBuffer] = {
1868 "SweepGradientBuffer",
1869 SkSpan(kSweepGradientUniformsBuffer),
1871 { }, // no samplers
1872 kSweepGradientBufferName,
1873 GenerateDefaultExpression,
1874 GenerateDefaultPreamble,
1876 };
1877 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kConicalGradientShader4] = {
1878 "ConicalGradient4",
1879 SkSpan(kConicalGradientUniforms4),
1881 { }, // no samplers
1882 kConicalGradient4Name,
1883 GenerateDefaultExpression,
1884 GenerateDefaultPreamble,
1886 };
1887 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kConicalGradientShader8] = {
1888 "ConicalGradient8",
1889 SkSpan(kConicalGradientUniforms8),
1891 { }, // no samplers
1892 kConicalGradient8Name,
1893 GenerateDefaultExpression,
1894 GenerateDefaultPreamble,
1896 };
1898 "ConicalGradientTexture",
1899 SkSpan(kConicalGradientUniformsTexture),
1901 SkSpan(kTextureGradientTexturesAndSamplers),
1902 kConicalGradientTextureName,
1903 GenerateDefaultExpression,
1904 GenerateDefaultPreamble,
1906 };
1908 "ConicalGradientBuffer",
1909 SkSpan(kConicalGradientUniformsBuffer),
1911 { }, // no samplers
1912 kConicalGradientBufferName,
1913 GenerateDefaultExpression,
1914 GenerateDefaultPreamble,
1916 };
1917 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kLocalMatrixShader] = {
1918 "LocalMatrixShader",
1919 SkSpan(kLocalMatrixShaderUniforms),
1921 { }, // no samplers
1922 kLocalMatrixShaderName,
1923 GenerateDefaultExpression,
1924 GenerateLocalMatrixPreamble,
1925 kNumLocalMatrixShaderChildren
1926 };
1927 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kImageShader] = {
1928 "ImageShader",
1929 SkSpan(kImageShaderUniforms),
1931 SkSpan(kISTexturesAndSamplers),
1932 kImageShaderName,
1933 GenerateDefaultExpression,
1934 GenerateDefaultPreamble,
1936 };
1937 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kCubicImageShader] = {
1938 "CubicImageShader",
1939 SkSpan(kCubicImageShaderUniforms),
1941 SkSpan(kISTexturesAndSamplers),
1942 kCubicImageShaderName,
1943 GenerateDefaultExpression,
1944 GenerateDefaultPreamble,
1946 };
1947 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kHWImageShader] = {
1948 "HardwareImageShader",
1949 SkSpan(kHWImageShaderUniforms),
1951 SkSpan(kISTexturesAndSamplers),
1952 kHWImageShaderName,
1953 GenerateDefaultExpression,
1954 GenerateDefaultPreamble,
1956 };
1957 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kYUVImageShader] = {
1958 "YUVImageShader",
1959 SkSpan(kYUVImageShaderUniforms),
1961 SkSpan(kYUVISTexturesAndSamplers),
1962 kYUVImageShaderName,
1963 GenerateDefaultExpression,
1964 GenerateDefaultPreamble,
1966 };
1967 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kCubicYUVImageShader] = {
1968 "CubicYUVImageShader",
1969 SkSpan(kCubicYUVImageShaderUniforms),
1971 SkSpan(kYUVISTexturesAndSamplers),
1972 kCubicYUVImageShaderName,
1973 GenerateDefaultExpression,
1974 GenerateDefaultPreamble,
1976 };
1977 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kHWYUVImageShader] = {
1978 "HWYUVImageShader",
1979 SkSpan(kHWYUVImageShaderUniforms),
1981 SkSpan(kYUVISTexturesAndSamplers),
1982 kHWYUVImageShaderName,
1983 GenerateDefaultExpression,
1984 GenerateDefaultPreamble,
1986 };
1987 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kCoordClampShader] = {
1988 "CoordClampShader",
1989 SkSpan(kCoordClampShaderUniforms),
1991 { }, // no samplers
1992 kCoordClampShaderName,
1993 GenerateDefaultExpression,
1994 GenerateCoordClampPreamble,
1995 kNumCoordClampShaderChildren
1996 };
1997 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kDitherShader] = {
1998 "DitherShader",
1999 SkSpan(kDitherShaderUniforms),
2001 SkSpan(kDitherTexturesAndSamplers),
2002 kDitherShaderName,
2003 GenerateDefaultExpression,
2004 GenerateDefaultPreamble,
2006 };
2007 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kPerlinNoiseShader] = {
2008 "PerlinNoiseShader",
2009 SkSpan(kPerlinNoiseShaderUniforms),
2011 SkSpan(kPerlinNoiseShaderTexturesAndSamplers),
2012 kPerlinNoiseShaderName,
2013 GenerateDefaultExpression,
2014 GenerateDefaultPreamble,
2016 };
2017 // SkColorFilter snippets
2018 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kMatrixColorFilter] = {
2019 "MatrixColorFilter",
2020 SkSpan(kMatrixColorFilterUniforms),
2022 { }, // no samplers
2023 kMatrixColorFilterName,
2024 GenerateDefaultExpression,
2025 GenerateDefaultPreamble,
2027 };
2028 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kTableColorFilter] = {
2029 "TableColorFilter",
2030 { }, // no uniforms
2032 SkSpan(kTableColorFilterTexturesAndSamplers),
2033 kTableColorFilterName,
2034 GenerateDefaultExpression,
2035 GenerateDefaultPreamble,
2037 };
2038 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kGaussianColorFilter] = {
2039 "GaussianColorFilter",
2040 { }, // no uniforms
2042 { }, // no samplers
2043 kGaussianColorFilterName,
2044 GenerateDefaultExpression,
2045 GenerateDefaultPreamble,
2047 };
2048 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kColorSpaceXformColorFilter] = {
2049 "ColorSpaceTransform",
2050 SkSpan(kColorSpaceTransformUniforms),
2052 { }, // no samplers
2053 kColorSpaceTransformName,
2054 GenerateDefaultExpression,
2055 GenerateDefaultPreamble,
2057 };
2058
2059 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kBlendShader] = {
2060 "BlendShader",
2061 { }, // no uniforms
2063 { }, // no samplers
2064 "BlendShader",
2065 GenerateDefaultExpression,
2066 GenerateBlendShaderPreamble,
2067 kNumBlendShaderChildren
2068 };
2069 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kCoeffBlender] = {
2070 "CoeffBlender",
2071 SkSpan(CoeffBlendderUniforms),
2073 { }, // no samplers
2074 kCoeffBlenderName,
2075 GenerateDefaultExpression,
2076 GenerateDefaultPreamble,
2078 };
2079 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kBlendModeBlender] = {
2080 "BlendModeBlender",
2081 SkSpan(kBlendModeBlenderUniforms),
2083 { }, // no samplers
2084 kBlendModeBlenderName,
2085 GenerateDefaultExpression,
2086 GenerateDefaultPreamble,
2088 };
2089
2090 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kPrimitiveColor] = {
2091 "PrimitiveColor",
2092 { }, // no uniforms
2094 { }, // no samplers
2095 "primitive color", // no static sksl
2096 GeneratePrimitiveColorExpression,
2097 GenerateDefaultPreamble,
2099 };
2100
2101 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kDstReadSample] = {
2102 "DstReadSample",
2103 SkSpan(kDstReadSampleUniforms),
2105 SkSpan(kDstReadSampleTexturesAndSamplers),
2106 "InitSurfaceColor",
2107 GenerateDstReadSampleExpression,
2108 GenerateDstReadSamplePreamble,
2110 };
2111 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kDstReadFetch] = {
2112 "DstReadFetch",
2113 { }, // no uniforms
2115 { }, // no samplers
2116 "InitSurfaceColor",
2117 GenerateDstReadFetchExpression,
2118 GenerateDstReadFetchPreamble,
2120 };
2121
2122 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kClipShader] = {
2123 "ClipShader",
2124 { }, // no uniforms
2126 { }, // no samplers
2127 "clip shader", // no static sksl
2128 GenerateClipShaderExpression,
2129 GenerateClipShaderPreamble,
2130 kNumClipShaderChildren
2131 };
2132
2133 fBuiltInCodeSnippets[(int) BuiltInCodeSnippetID::kCompose] = {
2134 "Compose",
2135 { }, // no uniforms
2137 { }, // no samplers
2138 kComposeName,
2139 GenerateDefaultExpression,
2140 GenerateNestedChildrenPreamble,
2141 kNumComposeChildren
2142 };
2143
2144 // Fixed-function blend mode snippets are all the same, their functionality is entirely defined
2145 // by their unique code snippet IDs.
2146 for (int i = 0; i <= (int) SkBlendMode::kLastCoeffMode; ++i) {
2147 int ffBlendModeID = kFixedFunctionBlendModeIDOffset + i;
2148 fBuiltInCodeSnippets[ffBlendModeID] = {
2149 SkBlendMode_Name(static_cast<SkBlendMode>(i)),
2150 { }, // no uniforms
2153 { }, // no samplers
2154 skgpu::BlendFuncName(static_cast<SkBlendMode>(i)),
2155 GenerateDefaultExpression,
2156 GenerateDefaultPreamble,
2158 };
2159 }
2160}
SK_API const char * SkBlendMode_Name(SkBlendMode blendMode)
SkBlendMode
Definition: SkBlendMode.h:38
@ kLastCoeffMode
last porter duff blend mode
SkSpan(Container &&) -> SkSpan< std::remove_pointer_t< decltype(std::data(std::declval< Container >()))> >
static constexpr PaintParamsKey Invalid()
static constexpr int kFixedFunctionBlendModeIDOffset
static constexpr int kNoChildren
const char * BlendFuncName(SkBlendMode mode)
Definition: Blend.cpp:18

Member Function Documentation

◆ findOrCreate()

UniquePaintParamsID skgpu::graphite::ShaderCodeDictionary::findOrCreate ( PaintParamsKeyBuilder builder)

Definition at line 516 of file ShaderCodeDictionary.cpp.

516 {
517 AutoLockBuilderAsKey keyView{builder};
518 if (!keyView->isValid()) {
520 }
521
522 SkAutoSpinlock lock{fSpinLock};
523
524 UniquePaintParamsID* existingEntry = fPaintKeyToID.find(*keyView);
525 if (existingEntry) {
526 SkASSERT(fIDToPaintKey[(*existingEntry).asUInt()] == *keyView);
527 return *existingEntry;
528 }
529
530 // Detach from the builder and copy into the arena
531 PaintParamsKey key = keyView->clone(&fArena);
532 UniquePaintParamsID newID{SkTo<uint32_t>(fIDToPaintKey.size())};
533
534 fPaintKeyToID.set(key, newID);
535 fIDToPaintKey.push_back(key);
536 return newID;
537}
#define SkASSERT(cond)
Definition: SkAssert.h:116
static UniquePaintParamsID InvalidID()

◆ findOrCreateRuntimeEffectSnippet()

int skgpu::graphite::ShaderCodeDictionary::findOrCreateRuntimeEffectSnippet ( const SkRuntimeEffect effect)

Definition at line 1639 of file ShaderCodeDictionary.cpp.

1639 {
1641 if (effect->allowShader()) {
1643 }
1644 if (effect->allowBlender()) {
1646 }
1647
1648 SkAutoSpinlock lock{fSpinLock};
1649
1650 if (int stableKey = SkRuntimeEffectPriv::StableKey(*effect)) {
1653
1654 int index = stableKey - kSkiaKnownRuntimeEffectsStart;
1655
1656 if (!fKnownRuntimeEffectCodeSnippets[index].fExpressionGenerator) {
1657 const char* name = get_known_rte_name(static_cast<StableKey>(stableKey));
1658 fKnownRuntimeEffectCodeSnippets[index] = ShaderSnippet(
1659 name,
1660 this->convertUniforms(effect),
1661 snippetFlags,
1662 /* texturesAndSamplers= */ {},
1663 name,
1664 GenerateRuntimeShaderExpression,
1665 GenerateRuntimeShaderPreamble,
1666 (int)effect->children().size());
1667 }
1668
1669 return stableKey;
1670 }
1671
1672 // Use the combination of {SkSL program hash, uniform size} as our key.
1673 // In the unfortunate event of a hash collision, at least we'll have the right amount of
1674 // uniform data available.
1675 RuntimeEffectKey key;
1676 key.fHash = SkRuntimeEffectPriv::Hash(*effect);
1677 key.fUniformSize = effect->uniformSize();
1678
1679 int32_t* existingCodeSnippetID = fRuntimeEffectMap.find(key);
1680 if (existingCodeSnippetID) {
1681 return *existingCodeSnippetID;
1682 }
1683
1684 // TODO: the memory for user-defined entries could go in the dictionary's arena but that
1685 // would have to be a thread safe allocation since the arena also stores entries for
1686 // 'fHash' and 'fEntryVector'
1687 fUserDefinedCodeSnippets.push_back(
1688 std::make_unique<ShaderSnippet>("RuntimeEffect",
1689 this->convertUniforms(effect),
1690 snippetFlags,
1691 /* texturesAndSamplers= */SkSpan<const TextureAndSampler>(),
1693 GenerateRuntimeShaderExpression,
1694 GenerateRuntimeShaderPreamble,
1695 (int)effect->children().size()));
1696
1697 int newCodeSnippetID = kUnknownRuntimeEffectIDStart + fUserDefinedCodeSnippets.size() - 1;
1698
1699 fRuntimeEffectMap.set(key, newCodeSnippetID);
1700 return newCodeSnippetID;
1701}
static uint32_t StableKey(const SkRuntimeEffect &effect)
static uint32_t Hash(const SkRuntimeEffect &effect)
size_t uniformSize() const
SkSpan< const Child > children() const
bool allowBlender() const
bool allowShader() const
static constexpr int kUnknownRuntimeEffectIDStart
static constexpr int kSkiaKnownRuntimeEffectsStart
static const int kStableKeyCnt
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
static constexpr char kRuntimeShaderName[]

◆ getEntry() [1/2]

const ShaderSnippet * skgpu::graphite::ShaderCodeDictionary::getEntry ( BuiltInCodeSnippetID  codeSnippetID) const
inline

Definition at line 272 of file ShaderCodeDictionary.h.

272 {
273 return this->getEntry(SkTo<int>(codeSnippetID));
274 }
const ShaderSnippet * getEntry(int codeSnippetID) const SK_EXCLUDES(fSpinLock)

◆ getEntry() [2/2]

const ShaderSnippet * skgpu::graphite::ShaderCodeDictionary::getEntry ( int  codeSnippetID) const

Definition at line 553 of file ShaderCodeDictionary.cpp.

553 {
554 if (codeSnippetID < 0) {
555 return nullptr;
556 }
557
558 if (codeSnippetID < kBuiltInCodeSnippetIDCount) {
559 return &fBuiltInCodeSnippets[codeSnippetID];
560 }
561
562 SkAutoSpinlock lock{fSpinLock};
563
564 if (codeSnippetID >= kSkiaKnownRuntimeEffectsStart &&
566 int knownRTECodeSnippetID = codeSnippetID - kSkiaKnownRuntimeEffectsStart;
567
568 // TODO(b/238759147): if the snippet hasn't been initialized, get the SkRuntimeEffect and
569 // initialize it here
570 SkASSERT(fKnownRuntimeEffectCodeSnippets[knownRTECodeSnippetID].fPreambleGenerator);
571 return &fKnownRuntimeEffectCodeSnippets[knownRTECodeSnippetID];
572 }
573
574 // TODO(b/238759147): handle Android and chrome known runtime effects
575
576 if (codeSnippetID >= kUnknownRuntimeEffectIDStart) {
577 int userDefinedCodeSnippetID = codeSnippetID - kUnknownRuntimeEffectIDStart;
578 if (userDefinedCodeSnippetID < SkTo<int>(fUserDefinedCodeSnippets.size())) {
579 return fUserDefinedCodeSnippets[userDefinedCodeSnippetID].get();
580 }
581 }
582
583 return nullptr;
584}
static constexpr int kBuiltInCodeSnippetIDCount

◆ getSnippetRequirementFlags()

SkEnumBitMask< SnippetRequirementFlags > skgpu::graphite::ShaderCodeDictionary::getSnippetRequirementFlags ( BuiltInCodeSnippetID  id) const
inline

Definition at line 259 of file ShaderCodeDictionary.h.

260 {
261 return fBuiltInCodeSnippets[(int) id].fSnippetRequirementFlags;
262 }

◆ getUniforms()

SkSpan< const Uniform > skgpu::graphite::ShaderCodeDictionary::getUniforms ( BuiltInCodeSnippetID  id) const

Definition at line 549 of file ShaderCodeDictionary.cpp.

549 {
550 return fBuiltInCodeSnippets[(int) id].fUniforms;
551}

◆ idToString()

SkString skgpu::graphite::ShaderCodeDictionary::idToString ( UniquePaintParamsID  id) const
inline

Definition at line 254 of file ShaderCodeDictionary.h.

254 {
255 return this->lookup(id).toString(this, /*includeData=*/false);
256 }
SkString toString(const ShaderCodeDictionary *dict, bool includeData) const
PaintParamsKey lookup(UniquePaintParamsID) const SK_EXCLUDES(fSpinLock)

◆ lookup()

PaintParamsKey skgpu::graphite::ShaderCodeDictionary::lookup ( UniquePaintParamsID  codeID) const

Definition at line 539 of file ShaderCodeDictionary.cpp.

539 {
540 if (!codeID.isValid()) {
542 }
543
544 SkAutoSpinlock lock{fSpinLock};
545 SkASSERT(codeID.asUInt() < SkTo<uint32_t>(fIDToPaintKey.size()));
546 return fIDToPaintKey[codeID.asUInt()];
547}

The documentation for this class was generated from the following files: