Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
SkSL::IRHelpers Struct Reference

#include <SkSLIRHelpers.h>

Public Member Functions

 IRHelpers (const Context &c)
 
std::unique_ptr< ExpressionRef (const Variable *var) const
 
std::unique_ptr< ExpressionField (const Variable *var, int idx) const
 
std::unique_ptr< ExpressionSwizzle (std::unique_ptr< Expression > base, ComponentArray c) const
 
std::unique_ptr< ExpressionIndex (std::unique_ptr< Expression > base, std::unique_ptr< Expression > idx) const
 
std::unique_ptr< ExpressionBinary (std::unique_ptr< Expression > l, Operator op, std::unique_ptr< Expression > r) const
 
std::unique_ptr< ExpressionMul (std::unique_ptr< Expression > l, std::unique_ptr< Expression > r) const
 
std::unique_ptr< ExpressionAdd (std::unique_ptr< Expression > l, std::unique_ptr< Expression > r) const
 
std::unique_ptr< ExpressionFloat (float value) const
 
std::unique_ptr< ExpressionInt (int value) const
 
std::unique_ptr< ExpressionCtorXYZW (std::unique_ptr< Expression > xy, std::unique_ptr< Expression > z, std::unique_ptr< Expression > w) const
 
std::unique_ptr< StatementAssign (std::unique_ptr< Expression > l, std::unique_ptr< Expression > r) const
 

Static Public Member Functions

static std::unique_ptr< ExpressionLoadFloatBuffer (const Context &context, const SkSL::ShaderCaps &shaderCaps, Position position, std::unique_ptr< Expression > idx)
 

Public Attributes

const ContextfContext
 

Detailed Description

Definition at line 39 of file SkSLIRHelpers.h.

Constructor & Destructor Documentation

◆ IRHelpers()

SkSL::IRHelpers::IRHelpers ( const Context c)
inline

Definition at line 40 of file SkSLIRHelpers.h.

40: fContext(c) {}
const Context & fContext

Member Function Documentation

◆ Add()

std::unique_ptr< Expression > SkSL::IRHelpers::Add ( std::unique_ptr< Expression l,
std::unique_ptr< Expression r 
) const
inline

Definition at line 78 of file SkSLIRHelpers.h.

79 {
80 return Binary(std::move(l), OperatorKind::PLUS, std::move(r));
81 }
std::unique_ptr< Expression > Binary(std::unique_ptr< Expression > l, Operator op, std::unique_ptr< Expression > r) const
Definition: SkSLIRHelpers.h:66

◆ Assign()

std::unique_ptr< Statement > SkSL::IRHelpers::Assign ( std::unique_ptr< Expression l,
std::unique_ptr< Expression r 
) const
inline

Definition at line 102 of file SkSLIRHelpers.h.

103 {
106 Binary(std::move(l), OperatorKind::EQ, std::move(r)));
107 }
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
static std::unique_ptr< Statement > Make(const Context &context, std::unique_ptr< Expression > expr)
bool UpdateVariableRefKind(Expression *expr, VariableRefKind kind, ErrorReporter *errors=nullptr)

◆ Binary()

std::unique_ptr< Expression > SkSL::IRHelpers::Binary ( std::unique_ptr< Expression l,
Operator  op,
std::unique_ptr< Expression r 
) const
inline

Definition at line 66 of file SkSLIRHelpers.h.

68 {
69 Position pos = l->fPosition.rangeThrough(r->fPosition);
70 return BinaryExpression::Make(fContext, pos, std::move(l), op, std::move(r));
71 }
SkPoint pos
static std::unique_ptr< Expression > Make(const Context &context, Position pos, std::unique_ptr< Expression > left, Operator op, std::unique_ptr< Expression > right)

◆ CtorXYZW()

std::unique_ptr< Expression > SkSL::IRHelpers::CtorXYZW ( std::unique_ptr< Expression xy,
std::unique_ptr< Expression z,
std::unique_ptr< Expression w 
) const
inline

Definition at line 91 of file SkSLIRHelpers.h.

93 {
94 ExpressionArray args;
95 args.push_back(std::move(xy));
96 args.push_back(std::move(z));
97 args.push_back(std::move(w));
99 std::move(args));
100 }
const std::unique_ptr< Type > fFloat4
static std::unique_ptr< Expression > Make(const Context &context, Position pos, const Type &type, ExpressionArray args)
const BuiltinTypes & fTypes
Definition: SkSLContext.h:30
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
SkScalar w

◆ Field()

std::unique_ptr< Expression > SkSL::IRHelpers::Field ( const Variable var,
int  idx 
) const
inline

Definition at line 50 of file SkSLIRHelpers.h.

50 {
51 return FieldAccess::Make(fContext, Position(), Ref(var), idx,
52 FieldAccess::OwnerKind::kAnonymousInterfaceBlock);
53 }
static std::unique_ptr< Expression > Make(const Context &context, Position pos, std::unique_ptr< Expression > base, int fieldIndex, OwnerKind ownerKind=OwnerKind::kDefault)
std::unique_ptr< Expression > Ref(const Variable *var) const
Definition: SkSLIRHelpers.h:46

◆ Float()

std::unique_ptr< Expression > SkSL::IRHelpers::Float ( float  value) const
inline

Definition at line 83 of file SkSLIRHelpers.h.

83 {
84 return Literal::MakeFloat(Position(), value, fContext.fTypes.fFloat.get());
85 }
const std::unique_ptr< Type > fFloat
static std::unique_ptr< Literal > MakeFloat(const Context &context, Position pos, float value)
Definition: SkSLLiteral.h:43
uint8_t value

◆ Index()

std::unique_ptr< Expression > SkSL::IRHelpers::Index ( std::unique_ptr< Expression base,
std::unique_ptr< Expression idx 
) const
inline

Definition at line 60 of file SkSLIRHelpers.h.

61 {
62 Position pos = base->fPosition.rangeThrough(idx->fPosition);
63 return IndexExpression::Make(fContext, pos, std::move(base), std::move(idx));
64 }
static std::unique_ptr< Expression > Make(const Context &context, Position pos, std::unique_ptr< Expression > base, std::unique_ptr< Expression > index)

◆ Int()

std::unique_ptr< Expression > SkSL::IRHelpers::Int ( int  value) const
inline

Definition at line 87 of file SkSLIRHelpers.h.

87 {
88 return Literal::MakeInt(Position(), value, fContext.fTypes.fInt.get());
89 }
const std::unique_ptr< Type > fInt
static std::unique_ptr< Literal > MakeInt(const Context &context, Position pos, SKSL_INT value)
Definition: SkSLLiteral.h:54

◆ LoadFloatBuffer()

static std::unique_ptr< Expression > SkSL::IRHelpers::LoadFloatBuffer ( const Context context,
const SkSL::ShaderCaps shaderCaps,
Position  position,
std::unique_ptr< Expression idx 
)
inlinestatic

Definition at line 109 of file SkSLIRHelpers.h.

112 {
113 SkASSERT(shaderCaps.fFloatBufferArrayName != nullptr);
114
115 const Symbol* floatBufferArraySymbol =
116 context.fSymbolTable->find(shaderCaps.fFloatBufferArrayName);
117 SkASSERT(floatBufferArraySymbol->is<FieldSymbol>());
118
119 const FieldSymbol& floatBufferArrayField = floatBufferArraySymbol->as<FieldSymbol>();
120 auto floatBufferArrayAccess = std::make_unique<FieldAccess>(
121 position,
122 std::make_unique<VariableReference>(
123 position,
124 &floatBufferArrayField.owner(),
126 ),
127 floatBufferArrayField.fieldIndex(),
129
131 context,
132 position,
133 std::move(floatBufferArrayAccess),
134 std::move(idx));
135 }
#define SkASSERT(cond)
Definition: SkAssert.h:116
const char * fFloatBufferArrayName
Definition: SkSLUtil.h:160

◆ Mul()

std::unique_ptr< Expression > SkSL::IRHelpers::Mul ( std::unique_ptr< Expression l,
std::unique_ptr< Expression r 
) const
inline

Definition at line 73 of file SkSLIRHelpers.h.

74 {
75 return Binary(std::move(l), OperatorKind::STAR, std::move(r));
76 }

◆ Ref()

std::unique_ptr< Expression > SkSL::IRHelpers::Ref ( const Variable var) const
inline

Definition at line 46 of file SkSLIRHelpers.h.

46 {
47 return VariableReference::Make(Position(), var);
48 }
static std::unique_ptr< Expression > Make(Position pos, const Variable *variable, RefKind refKind=RefKind::kRead)

◆ Swizzle()

std::unique_ptr< Expression > SkSL::IRHelpers::Swizzle ( std::unique_ptr< Expression base,
ComponentArray  c 
) const
inline

Definition at line 55 of file SkSLIRHelpers.h.

55 {
56 Position pos = base->fPosition;
57 return Swizzle::Make(fContext, pos, std::move(base), std::move(c));
58 }
static std::unique_ptr< Expression > Make(const Context &context, Position pos, std::unique_ptr< Expression > expr, ComponentArray inComponents)

Member Data Documentation

◆ fContext

const Context& SkSL::IRHelpers::fContext

Definition at line 137 of file SkSLIRHelpers.h.


The documentation for this struct was generated from the following file: