Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
SkSL::ModifierFlags Class Reference

#include <SkSLModifierFlags.h>

Inheritance diagram for SkSL::ModifierFlags:
SkEnumBitMask< SkSL::ModifierFlag >

Public Member Functions

 ModifierFlags (SkEnumBitMask< SkSL::ModifierFlag > that)
 
std::string description () const
 
std::string paddedDescription () const
 
bool checkPermittedFlags (const Context &context, Position pos, ModifierFlags permittedModifierFlags) const
 
bool isConst () const
 
bool isUniform () const
 
bool isReadOnly () const
 
bool isWriteOnly () const
 
bool isBuffer () const
 
bool isPixelLocal () const
 
bool isWorkgroup () const
 
bool isExport () const
 
bool isES3 () const
 
bool isPure () const
 
bool isInline () const
 
bool isNoInline () const
 
- Public Member Functions inherited from SkEnumBitMask< SkSL::ModifierFlag >
SK_ALWAYS_INLINE constexpr SkEnumBitMask (SkSL::ModifierFlag e)
 
SK_ALWAYS_INLINE constexpr operator bool () const
 
SK_ALWAYS_INLINE constexpr int value () const
 
SK_ALWAYS_INLINE constexpr bool operator== (SkEnumBitMask m) const
 
SK_ALWAYS_INLINE constexpr bool operator!= (SkEnumBitMask m) const
 
SK_ALWAYS_INLINE constexpr SkEnumBitMask operator| (SkEnumBitMask m) const
 
SK_ALWAYS_INLINE constexpr SkEnumBitMask operator& (SkEnumBitMask m) const
 
SK_ALWAYS_INLINE constexpr SkEnumBitMask operator^ (SkEnumBitMask m) const
 
SK_ALWAYS_INLINE constexpr SkEnumBitMask operator~ () const
 
SK_ALWAYS_INLINE SkEnumBitMaskoperator|= (SkEnumBitMask m)
 
SK_ALWAYS_INLINE SkEnumBitMaskoperator&= (SkEnumBitMask m)
 
SK_ALWAYS_INLINE SkEnumBitMaskoperator^= (SkEnumBitMask m)
 

Detailed Description

Definition at line 53 of file SkSLModifierFlags.h.

Constructor & Destructor Documentation

◆ ModifierFlags()

SkSL::ModifierFlags::ModifierFlags ( SkEnumBitMask< SkSL::ModifierFlag that)
inline

Member Function Documentation

◆ checkPermittedFlags()

bool SkSL::ModifierFlags::checkPermittedFlags ( const Context context,
Position  pos,
ModifierFlags  permittedModifierFlags 
) const

Verifies that only permitted modifier flags are included. Reports errors and returns false in the event of a violation.

Definition at line 96 of file SkSLModifierFlags.cpp.

98 {
99 static constexpr struct { ModifierFlag flag; const char* name; } kModifierFlags[] = {
100 { ModifierFlag::kConst, "const" },
101 { ModifierFlag::kIn, "in" },
102 { ModifierFlag::kOut, "out" },
103 { ModifierFlag::kUniform, "uniform" },
104 { ModifierFlag::kFlat, "flat" },
105 { ModifierFlag::kNoPerspective, "noperspective" },
106 { ModifierFlag::kPure, "$pure" },
107 { ModifierFlag::kInline, "inline" },
108 { ModifierFlag::kNoInline, "noinline" },
109 { ModifierFlag::kHighp, "highp" },
110 { ModifierFlag::kMediump, "mediump" },
111 { ModifierFlag::kLowp, "lowp" },
112 { ModifierFlag::kExport, "$export" },
113 { ModifierFlag::kES3, "$es3" },
114 { ModifierFlag::kWorkgroup, "workgroup" },
115 { ModifierFlag::kReadOnly, "readonly" },
116 { ModifierFlag::kWriteOnly, "writeonly" },
117 { ModifierFlag::kBuffer, "buffer" },
118 { ModifierFlag::kPixelLocal, "pixel_local" },
119 };
120
121 bool success = true;
122 ModifierFlags modifierFlags = *this;
123 for (const auto& f : kModifierFlags) {
124 if (modifierFlags & f.flag) {
125 if (!(permittedModifierFlags & f.flag)) {
126 context.fErrors->error(pos, "'" + std::string(f.name) + "' is not permitted here");
127 success = false;
128 }
129 modifierFlags &= ~f.flag;
130 }
131 }
132 SkASSERT(modifierFlags == ModifierFlag::kNone);
133
134 return success;
135}
SkPoint pos
#define SkASSERT(cond)
Definition: SkAssert.h:116
ModifierFlags(SkEnumBitMask< SkSL::ModifierFlag > that)
FlutterSemanticsFlag flag
ModifierFlag
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

◆ description()

std::string SkSL::ModifierFlags::description ( ) const

Definition at line 88 of file SkSLModifierFlags.cpp.

88 {
89 std::string s = this->paddedDescription();
90 if (!s.empty()) {
91 s.pop_back();
92 }
93 return s;
94}
std::string paddedDescription() const
struct MyStruct s

◆ isBuffer()

bool SkSL::ModifierFlags::isBuffer ( ) const
inline

Definition at line 74 of file SkSLModifierFlags.h.

74{ return SkToBool(*this & ModifierFlag::kBuffer); }
static constexpr bool SkToBool(const T &x)
Definition: SkTo.h:35

◆ isConst()

bool SkSL::ModifierFlags::isConst ( ) const
inline

Definition at line 70 of file SkSLModifierFlags.h.

70{ return SkToBool(*this & ModifierFlag::kConst); }

◆ isES3()

bool SkSL::ModifierFlags::isES3 ( ) const
inline

Definition at line 78 of file SkSLModifierFlags.h.

78{ return SkToBool(*this & ModifierFlag::kES3); }

◆ isExport()

bool SkSL::ModifierFlags::isExport ( ) const
inline

Definition at line 77 of file SkSLModifierFlags.h.

77{ return SkToBool(*this & ModifierFlag::kExport); }

◆ isInline()

bool SkSL::ModifierFlags::isInline ( ) const
inline

Definition at line 80 of file SkSLModifierFlags.h.

80{ return SkToBool(*this & ModifierFlag::kInline); }

◆ isNoInline()

bool SkSL::ModifierFlags::isNoInline ( ) const
inline

Definition at line 81 of file SkSLModifierFlags.h.

81{ return SkToBool(*this & ModifierFlag::kNoInline); }

◆ isPixelLocal()

bool SkSL::ModifierFlags::isPixelLocal ( ) const
inline

Definition at line 75 of file SkSLModifierFlags.h.

75{ return SkToBool(*this & ModifierFlag::kPixelLocal); }

◆ isPure()

bool SkSL::ModifierFlags::isPure ( ) const
inline

Definition at line 79 of file SkSLModifierFlags.h.

79{ return SkToBool(*this & ModifierFlag::kPure); }

◆ isReadOnly()

bool SkSL::ModifierFlags::isReadOnly ( ) const
inline

Definition at line 72 of file SkSLModifierFlags.h.

72{ return SkToBool(*this & ModifierFlag::kReadOnly); }

◆ isUniform()

bool SkSL::ModifierFlags::isUniform ( ) const
inline

Definition at line 71 of file SkSLModifierFlags.h.

71{ return SkToBool(*this & ModifierFlag::kUniform); }

◆ isWorkgroup()

bool SkSL::ModifierFlags::isWorkgroup ( ) const
inline

Definition at line 76 of file SkSLModifierFlags.h.

76{ return SkToBool(*this & ModifierFlag::kWorkgroup); }

◆ isWriteOnly()

bool SkSL::ModifierFlags::isWriteOnly ( ) const
inline

Definition at line 73 of file SkSLModifierFlags.h.

73{ return SkToBool(*this & ModifierFlag::kWriteOnly); }

◆ paddedDescription()

std::string SkSL::ModifierFlags::paddedDescription ( ) const

Definition at line 17 of file SkSLModifierFlags.cpp.

17 {
18 // SkSL extensions
19 std::string result;
20 if (*this & ModifierFlag::kExport) {
21 result += "$export ";
22 }
23 if (*this & ModifierFlag::kES3) {
24 result += "$es3 ";
25 }
26 if (*this & ModifierFlag::kPure) {
27 result += "$pure ";
28 }
29 if (*this & ModifierFlag::kInline) {
30 result += "inline ";
31 }
32 if (*this & ModifierFlag::kNoInline) {
33 result += "noinline ";
34 }
35
36 // Real GLSL qualifiers (must be specified in order in GLSL 4.1 and below)
37 if (*this & ModifierFlag::kFlat) {
38 result += "flat ";
39 }
40 if (*this & ModifierFlag::kNoPerspective) {
41 result += "noperspective ";
42 }
43 if (*this & ModifierFlag::kConst) {
44 result += "const ";
45 }
46 if (*this & ModifierFlag::kUniform) {
47 result += "uniform ";
48 }
49 if ((*this & ModifierFlag::kIn) && (*this & ModifierFlag::kOut)) {
50 result += "inout ";
51 } else if (*this & ModifierFlag::kIn) {
52 result += "in ";
53 } else if (*this & ModifierFlag::kOut) {
54 result += "out ";
55 }
56 if (*this & ModifierFlag::kHighp) {
57 result += "highp ";
58 }
59 if (*this & ModifierFlag::kMediump) {
60 result += "mediump ";
61 }
62 if (*this & ModifierFlag::kLowp) {
63 result += "lowp ";
64 }
65 if (*this & ModifierFlag::kReadOnly) {
66 result += "readonly ";
67 }
68 if (*this & ModifierFlag::kWriteOnly) {
69 result += "writeonly ";
70 }
71 if (*this & ModifierFlag::kBuffer) {
72 result += "buffer ";
73 }
74
75 // We're using non-GLSL names for these.
76 if (*this & ModifierFlag::kPixelLocal) {
77 // Roughly equivalent to `__pixel_localEXT`.
78 result += "pixel_local ";
79 }
80 if (*this & ModifierFlag::kWorkgroup) {
81 // Equivalent to `shared`.
82 result += "workgroup ";
83 }
84
85 return result;
86}
GAsyncResult * result

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