Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
SkSL::ModifiersDeclaration Class Referencefinal

#include <SkSLModifiersDeclaration.h>

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

Public Member Functions

 ModifiersDeclaration (Position pos, const Layout &layout, ModifierFlags flags)
 
const Layoutlayout () const
 
ModifierFlags modifierFlags () 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 ()
 
virtual std::string description () const =0
 
 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< ModifiersDeclarationConvert (const Context &context, const Modifiers &modifiers)
 
static std::unique_ptr< ModifiersDeclarationMake (const Context &context, const Modifiers &modifiers)
 
- 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::kModifiers
 

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

A declaration that consists only of modifiers, e.g.:

layout(blend_support_all_equations) out;

Definition at line 30 of file SkSLModifiersDeclaration.h.

Constructor & Destructor Documentation

◆ ModifiersDeclaration()

SkSL::ModifiersDeclaration::ModifiersDeclaration ( Position  pos,
const Layout layout,
ModifierFlags  flags 
)
inline

Definition at line 34 of file SkSLModifiersDeclaration.h.

35 : INHERITED(pos, kIRNodeKind)
36 , fLayout(layout)
37 , fFlags(flags) {}
SkPoint pos
FlutterSemanticsFlag flags

Member Function Documentation

◆ Convert()

std::unique_ptr< ModifiersDeclaration > SkSL::ModifiersDeclaration::Convert ( const Context context,
const Modifiers modifiers 
)
static

Definition at line 23 of file SkSLModifiersDeclaration.cpp.

24 {
25 SkSL::ProgramKind kind = context.fConfig->fKind;
28 context.fErrors->error(modifiers.fPosition,
29 "layout qualifiers are not allowed in this kind of program");
30 return nullptr;
31 }
32
33 if (modifiers.fLayout.fLocalSizeX >= 0 ||
34 modifiers.fLayout.fLocalSizeY >= 0 ||
35 modifiers.fLayout.fLocalSizeZ >= 0) {
36 if (modifiers.fLayout.fLocalSizeX == 0 ||
37 modifiers.fLayout.fLocalSizeY == 0 ||
38 modifiers.fLayout.fLocalSizeZ == 0) {
39 context.fErrors->error(modifiers.fPosition, "local size qualifiers cannot be zero");
40 return nullptr;
41 }
43 context.fErrors->error(
44 modifiers.fPosition,
45 "local size layout qualifiers are only allowed in a compute program");
46 return nullptr;
47 }
48 if (modifiers.fFlags != ModifierFlag::kIn) {
49 context.fErrors->error(
50 modifiers.fPosition,
51 "local size layout qualifiers must be defined using an 'in' declaration");
52 return nullptr;
53 }
54 }
55
56 return ModifiersDeclaration::Make(context, modifiers);
57}
static std::unique_ptr< ModifiersDeclaration > Make(const Context &context, const Modifiers &modifiers)
static bool IsVertex(ProgramKind kind)
static bool IsFragment(ProgramKind kind)
static bool IsCompute(ProgramKind kind)

◆ description()

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

Implements SkSL::IRNode.

Definition at line 53 of file SkSLModifiersDeclaration.h.

53 {
54 return fLayout.paddedDescription() + fFlags.description() + ';';
55 }
std::string description() const
std::string paddedDescription() const

◆ layout()

const Layout & SkSL::ModifiersDeclaration::layout ( ) const
inline

Definition at line 45 of file SkSLModifiersDeclaration.h.

45 {
46 return fLayout;
47 }

◆ Make()

std::unique_ptr< ModifiersDeclaration > SkSL::ModifiersDeclaration::Make ( const Context context,
const Modifiers modifiers 
)
static

Definition at line 59 of file SkSLModifiersDeclaration.cpp.

60 {
61 [[maybe_unused]] SkSL::ProgramKind kind = context.fConfig->fKind;
64
65 return std::make_unique<ModifiersDeclaration>(modifiers.fPosition,
66 modifiers.fLayout,
67 modifiers.fFlags);
68}
#define SkASSERT(cond)
Definition: SkAssert.h:116

◆ modifierFlags()

ModifierFlags SkSL::ModifiersDeclaration::modifierFlags ( ) const
inline

Definition at line 49 of file SkSLModifiersDeclaration.h.

49 {
50 return fFlags;
51 }

Member Data Documentation

◆ kIRNodeKind

constexpr Kind SkSL::ModifiersDeclaration::kIRNodeKind = Kind::kModifiers
inlinestaticconstexpr

Definition at line 32 of file SkSLModifiersDeclaration.h.


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