Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Attributes | List of all members
SkSL::LiteralType Class Reference
Inheritance diagram for SkSL::LiteralType:
SkSL::Type SkSL::Symbol SkSL::IRNode SkSL::Poolable

Public Member Functions

 LiteralType (const char *name, const Type &scalarType, int8_t priority)
 
const TypescalarTypeForLiteral () const override
 
int priority () const override
 
int columns () const override
 
int rows () const override
 
NumberKind numberKind () const override
 
int bitWidth () const override
 
double minimumValue () const override
 
double maximumValue () const override
 
bool isScalar () const override
 
bool isLiteral () const override
 
size_t slotCount () const override
 
const TypeslotType (size_t n) const override
 
- Public Member Functions inherited from SkSL::Type
 Type (const Type &other)=delete
 
std::string getArrayName (int arraySize) const
 
template<typename T >
bool is () const
 
template<typename T >
const Tas () const
 
template<typename T >
Tas ()
 
const Typeclone (const Context &context, SymbolTable *symbolTable) const
 
virtual bool isBuiltin () const
 
std::string displayName () const
 
std::string description () const override
 
bool isAllowedInES2 (const Context &context) const
 
virtual bool isAllowedInES2 () const
 
virtual bool isAllowedInUniform (Position *errorPosition=nullptr) const
 
virtual const Typeresolve () const
 
bool matches (const Type &other) const
 
const char * abbreviatedName () const
 
TypeKind typeKind () const
 
virtual NumberKind numberKind () const
 
bool isBoolean () const
 
bool isNumber () const
 
bool isFloat () const
 
bool isSigned () const
 
bool isUnsigned () const
 
bool isInteger () const
 
bool isOpaque () const
 
bool isStorageTexture () const
 
virtual int priority () const
 
bool canCoerceTo (const Type &other, bool allowNarrowing) const
 
CoercionCost coercionCost (const Type &other) const
 
virtual const TypecomponentType () const
 
const TypecolumnType (const Context &context) const
 
virtual const TypetextureType () const
 
virtual int columns () const
 
virtual int rows () const
 
virtual double minimumValue () const
 
virtual double maximumValue () const
 
virtual size_t slotCount () const
 
virtual const TypeslotType (size_t) const
 
virtual SkSpan< const Fieldfields () const
 
virtual SkSpan< const Type *const > coercibleTypes () const
 
virtual SpvDim_ dimensions () const
 
virtual bool isDepth () const
 
virtual bool isArrayedTexture () const
 
bool isVoid () const
 
bool isGeneric () const
 
bool isSampler () const
 
bool isAtomic () const
 
virtual bool isScalar () const
 
virtual bool isLiteral () const
 
virtual const TypescalarTypeForLiteral () const
 
virtual bool isVector () const
 
virtual bool isMatrix () const
 
virtual bool isArray () const
 
virtual bool isUnsizedArray () const
 
virtual bool isStruct () const
 
virtual bool isInterfaceBlock () const
 
bool isEffectChild () const
 
virtual bool isMultisampled () const
 
virtual TextureAccess textureAccess () const
 
bool hasPrecision () const
 
bool highPrecision () const
 
virtual int bitWidth () const
 
virtual bool isOrContainsArray () const
 
virtual bool isOrContainsUnsizedArray () const
 
virtual bool isOrContainsAtomic () const
 
const TypetoCompound (const Context &context, int columns, int rows) const
 
const TypeapplyQualifiers (const Context &context, ModifierFlags *modifierFlags, Position pos) const
 
std::unique_ptr< ExpressioncoerceExpression (std::unique_ptr< Expression > expr, const Context &context) const
 
bool checkForOutOfRangeLiteral (const Context &context, const Expression &expr) const
 
bool checkForOutOfRangeLiteral (const Context &context, double value, Position pos) const
 
bool checkIfUsableInArray (const Context &context, Position arrayPos) const
 
SKSL_INT convertArraySize (const Context &context, Position arrayPos, std::unique_ptr< Expression > size) const
 
SKSL_INT convertArraySize (const Context &context, Position arrayPos, Position sizePos, SKSL_INT size) const
 
- Public Member Functions inherited from SkSL::Symbol
 Symbol (Position pos, Kind kind, std::string_view name, const Type *type=nullptr)
 
 ~Symbol () override
 
std::unique_ptr< Expressioninstantiate (const Context &context, Position pos) const
 
const Typetype () const
 
Kind kind () const
 
std::string_view name () const
 
void setName (std::string_view newName)
 
- 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 Attributes

static constexpr TypeKind kTypeKind = TypeKind::kLiteral
 
- Static Public Attributes inherited from SkSL::Type
static constexpr Kind kIRNodeKind = Kind::kType
 
static constexpr int kMaxAbbrevLength = 3
 
static constexpr int kUnsizedArray = -1
 

Additional Inherited Members

- Public Types inherited from SkSL::Type
enum class  TypeKind : int8_t {
  kArray , kAtomic , kGeneric , kLiteral ,
  kMatrix , kOther , kSampler , kSeparateSampler ,
  kScalar , kStruct , kTexture , kVector ,
  kVoid , kColorFilter , kShader , kBlender
}
 
enum class  NumberKind : int8_t {
  kFloat , kSigned , kUnsigned , kBoolean ,
  kNonnumeric
}
 
enum class  TextureAccess : int8_t { kSample , kRead , kWrite , kReadWrite }
 
- Public Types inherited from SkSL::Symbol
using Kind = SymbolKind
 
- Static Public Member Functions inherited from SkSL::Type
static std::unique_ptr< TypeMakeArrayType (const Context &context, std::string_view name, const Type &componentType, int columns)
 
static std::unique_ptr< TypeMakeAliasType (std::string_view name, const Type &targetType)
 
static std::unique_ptr< TypeMakeGenericType (const char *name, SkSpan< const Type *const > types, const Type *slotType)
 
static std::unique_ptr< TypeMakeLiteralType (const char *name, const Type &scalarType, int8_t priority)
 
static std::unique_ptr< TypeMakeMatrixType (std::string_view name, const char *abbrev, const Type &componentType, int columns, int8_t rows)
 
static std::unique_ptr< TypeMakeSamplerType (const char *name, const Type &textureType)
 
static std::unique_ptr< TypeMakeScalarType (std::string_view name, const char *abbrev, Type::NumberKind numberKind, int8_t priority, int8_t bitWidth)
 
static std::unique_ptr< TypeMakeSpecialType (const char *name, const char *abbrev, Type::TypeKind typeKind)
 
static std::unique_ptr< TypeMakeStructType (const Context &context, Position pos, std::string_view name, skia_private::TArray< Field > fields, bool interfaceBlock=false)
 
static std::unique_ptr< TypeMakeTextureType (const char *name, SpvDim_ dimensions, bool isDepth, bool isArrayedTexture, bool isMultisampled, TextureAccess textureAccess)
 
static std::unique_ptr< TypeMakeVectorType (std::string_view name, const char *abbrev, const Type &componentType, int columns)
 
static std::unique_ptr< TypeMakeAtomicType (std::string_view name, const char *abbrev)
 
- Static Public Member Functions inherited from SkSL::Poolable
static void * operator new (const size_t size)
 
static void operator delete (void *ptr)
 
- Public Attributes inherited from SkSL::IRNode
Position fPosition
 
- Protected Member Functions inherited from SkSL::Type
 Type (std::string_view name, const char *abbrev, TypeKind kind, Position pos=Position())
 
const TypeapplyPrecisionQualifiers (const Context &context, ModifierFlags *modifierFlags, Position pos) const
 
const TypeapplyAccessQualifiers (const Context &context, ModifierFlags *modifierFlags, Position pos) const
 
bool isInRootSymbolTable () const
 
virtual int structNestingDepth () const
 
- Protected Member Functions inherited from SkSL::IRNode
 IRNode (Position position, int kind)
 
- Protected Attributes inherited from SkSL::IRNode
int fKind
 

Detailed Description

Definition at line 256 of file SkSLType.cpp.

Constructor & Destructor Documentation

◆ LiteralType()

SkSL::LiteralType::LiteralType ( const char *  name,
const Type scalarType,
int8_t  priority 
)
inline

Definition at line 260 of file SkSLType.cpp.

261 : INHERITED(name, "L", kTypeKind)
262 , fScalarType(scalarType)
263 , fPriority(priority) {}
int priority() const override
Definition: SkSLType.cpp:269
static constexpr TypeKind kTypeKind
Definition: SkSLType.cpp:258
std::string_view name() const
Definition: SkSLSymbol.h:51

Member Function Documentation

◆ bitWidth()

int SkSL::LiteralType::bitWidth ( ) const
inlineoverridevirtual

Reimplemented from SkSL::Type.

Definition at line 285 of file SkSLType.cpp.

285 {
286 return fScalarType.bitWidth();
287 }
virtual int bitWidth() const
Definition: SkSLType.h:574

◆ columns()

int SkSL::LiteralType::columns ( ) const
inlineoverridevirtual

For matrices and vectors, returns the number of columns (e.g. both mat3 and float3 return 3). For scalars, returns 1. For arrays, returns either the size of the array (if known) or -1. For all other types, causes an assertion failure.

Reimplemented from SkSL::Type.

Definition at line 273 of file SkSLType.cpp.

273 {
274 return 1;
275 }

◆ isLiteral()

bool SkSL::LiteralType::isLiteral ( ) const
inlineoverridevirtual

Reimplemented from SkSL::Type.

Definition at line 301 of file SkSLType.cpp.

301 {
302 return true;
303 }

◆ isScalar()

bool SkSL::LiteralType::isScalar ( ) const
inlineoverridevirtual

Reimplemented from SkSL::Type.

Definition at line 297 of file SkSLType.cpp.

297 {
298 return true;
299 }

◆ maximumValue()

double SkSL::LiteralType::maximumValue ( ) const
inlineoverridevirtual

Reimplemented from SkSL::Type.

Definition at line 293 of file SkSLType.cpp.

293 {
294 return fScalarType.maximumValue();
295 }
virtual double maximumValue() const
Definition: SkSLType.h:449

◆ minimumValue()

double SkSL::LiteralType::minimumValue ( ) const
inlineoverridevirtual

Returns the minimum value that can fit in the type.

Reimplemented from SkSL::Type.

Definition at line 289 of file SkSLType.cpp.

289 {
290 return fScalarType.minimumValue();
291 }
virtual double minimumValue() const
Definition: SkSLType.h:444

◆ numberKind()

NumberKind SkSL::LiteralType::numberKind ( ) const
inlineoverridevirtual

Returns the NumberKind of this type (always kNonnumeric for non-scalar values).

Reimplemented from SkSL::Type.

Definition at line 281 of file SkSLType.cpp.

281 {
282 return fScalarType.numberKind();
283 }
virtual NumberKind numberKind() const
Definition: SkSLType.h:290

◆ priority()

int SkSL::LiteralType::priority ( ) const
inlineoverridevirtual

Returns the "priority" of a number type, in order of float > half > int > short. When operating on two number types, the result is the higher-priority type.

Reimplemented from SkSL::Type.

Definition at line 269 of file SkSLType.cpp.

269 {
270 return fPriority;
271 }

◆ rows()

int SkSL::LiteralType::rows ( ) const
inlineoverridevirtual

For matrices, returns the number of rows (e.g. mat2x4 returns 4). For vectors and scalars, returns 1. For all other types, causes an assertion failure.

Reimplemented from SkSL::Type.

Definition at line 277 of file SkSLType.cpp.

277 {
278 return 1;
279 }

◆ scalarTypeForLiteral()

const Type & SkSL::LiteralType::scalarTypeForLiteral ( ) const
inlineoverridevirtual

Reimplemented from SkSL::Type.

Definition at line 265 of file SkSLType.cpp.

265 {
266 return fScalarType;
267 }

◆ slotCount()

size_t SkSL::LiteralType::slotCount ( ) const
inlineoverridevirtual

Returns the number of scalars needed to hold this type.

Reimplemented from SkSL::Type.

Definition at line 305 of file SkSLType.cpp.

305 {
306 return 1;
307 }

◆ slotType()

const Type & SkSL::LiteralType::slotType ( size_t  ) const
inlineoverridevirtual

Returns the type of the value in the nth slot. For scalar, vector and matrix types, should always match componentType().

Reimplemented from SkSL::Type.

Definition at line 309 of file SkSLType.cpp.

309 {
310 SkASSERT(n == 0);
311 return fScalarType;
312 }
#define SkASSERT(cond)
Definition: SkAssert.h:116

Member Data Documentation

◆ kTypeKind

constexpr TypeKind SkSL::LiteralType::kTypeKind = TypeKind::kLiteral
inlinestaticconstexpr

Definition at line 258 of file SkSLType.cpp.


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