Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
SkSL::Extension Class Referencefinal

#include <SkSLExtension.h>

Inheritance diagram for SkSL::Extension:
SkSL::ProgramElement SkSL::IRNode SkSL::Poolable

Public Member Functions

 Extension (Position pos, std::string_view name)
 
std::string_view name () const
 
std::string description () const override
 
- Public Member Functions inherited from SkSL::ProgramElement
 ProgramElement (Position pos, Kind kind)
 
Kind kind () const
 
- Public Member Functions inherited from SkSL::IRNode
virtual ~IRNode ()
 
 IRNode (const IRNode &)=delete
 
IRNodeoperator= (const IRNode &)=delete
 
Position position () const
 
void setPosition (Position p)
 
template<typename T >
bool is () const
 
template<typename T >
const Tas () const
 
template<typename T >
Tas ()
 

Static Public Member Functions

static std::unique_ptr< ExtensionConvert (const Context &context, Position pos, std::string_view name, std::string_view behaviorText)
 
static std::unique_ptr< ExtensionMake (const Context &context, Position pos, std::string_view name)
 
- Static Public Member Functions inherited from SkSL::Poolable
static void * operator new (const size_t size)
 
static void operator delete (void *ptr)
 

Static Public Attributes

static constexpr Kind kIRNodeKind = Kind::kExtension
 

Additional Inherited Members

- Public Types inherited from SkSL::ProgramElement
using Kind = ProgramElementKind
 
- Public Attributes inherited from SkSL::IRNode
Position fPosition
 
- Protected Member Functions inherited from SkSL::IRNode
 IRNode (Position position, int kind)
 
- Protected Attributes inherited from SkSL::IRNode
int fKind
 

Detailed Description

#extension <name> : enable

Definition at line 26 of file SkSLExtension.h.

Constructor & Destructor Documentation

◆ Extension()

SkSL::Extension::Extension ( Position  pos,
std::string_view  name 
)
inline

Definition at line 30 of file SkSLExtension.h.

31 : INHERITED(pos, kIRNodeKind)
32 , fName(name) {}
SkPoint pos
static constexpr Kind kIRNodeKind
std::string_view name() const

Member Function Documentation

◆ Convert()

std::unique_ptr< Extension > Extension::Convert ( const Context context,
Position  pos,
std::string_view  name,
std::string_view  behaviorText 
)
static

Definition at line 17 of file SkSLExtension.cpp.

20 {
21 if (ProgramConfig::IsRuntimeEffect(context.fConfig->fKind)) {
22 // Runtime Effects do not allow any #extensions.
23 context.fErrors->error(pos, "unsupported directive '#extension'");
24 return nullptr;
25 }
26 if (behaviorText == "disable") {
27 // We allow `#extension <name> : disable`, but it is a no-op.
28 return nullptr;
29 }
30 if (behaviorText != "require" && behaviorText != "enable" && behaviorText != "warn") {
31 context.fErrors->error(pos, "expected 'require', 'enable', 'warn', or 'disable'");
32 return nullptr;
33 }
34 // We don't currently do anything different between `require`, `enable`, and `warn`.
35 return Extension::Make(context, pos, name);
36}
static std::unique_ptr< Extension > Make(const Context &context, Position pos, std::string_view name)
static bool IsRuntimeEffect(ProgramKind kind)

◆ description()

std::string SkSL::Extension::description ( ) const
inlineoverridevirtual

Implements SkSL::IRNode.

Definition at line 50 of file SkSLExtension.h.

50 {
51 return "#extension " + std::string(this->name()) + " : enable";
52 }

◆ Make()

std::unique_ptr< Extension > Extension::Make ( const Context context,
Position  pos,
std::string_view  name 
)
static

Definition at line 38 of file SkSLExtension.cpp.

40 {
41 SkASSERT(!ProgramConfig::IsRuntimeEffect(context.fConfig->fKind));
42 return std::make_unique<SkSL::Extension>(pos, name);
43}
#define SkASSERT(cond)
Definition SkAssert.h:116

◆ name()

std::string_view SkSL::Extension::name ( ) const
inline

Definition at line 34 of file SkSLExtension.h.

34 {
35 return fName;
36 }

Member Data Documentation

◆ kIRNodeKind

constexpr Kind SkSL::Extension::kIRNodeKind = Kind::kExtension
inlinestaticconstexpr

Definition at line 28 of file SkSLExtension.h.


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