| Flutter Impeller |

Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
impeller::compiler::StructMember Struct Reference

`#include <reflector.h>`

## Public Types
enum class | UnderlyingType { kPadding , kFloat , kOther }

## Public Member Functions
| StructMember (std::string p_type, spirv_cross::SPIRType::BaseType p_base_type, std::string p_name, size_t p_offset, size_t p_size, size_t p_byte_length, std::optional< size_t > p_array_elements, size_t p_element_padding, UnderlyingType p_underlying_type=UnderlyingType::kOther)
| Constructs a new StructMember. More...

## Static Public Member Functions
static std::string | BaseTypeToString (spirv_cross::SPIRType::BaseType type)
static UnderlyingType | DetermineUnderlyingType (spirv_cross::SPIRType::BaseType type)

## Public Attributes
std::string | type
spirv_cross::SPIRType::BaseType | base_type
std::string | name
size_t | offset = 0u
size_t | size = 0u
size_t | byte_length = 0u
std::optional< size_t > | array_elements = std::nullopt
size_t | element_padding = 0u
UnderlyingType | underlying_type = UnderlyingType::kOther

## Detailed Description

Definition at line 25 of file reflector.h.

## Member Enumeration Documentation

## ◆ UnderlyingType

enum impeller::compiler::StructMember::UnderlyingType
| strong

Enumerator
kPadding |
kFloat |
kOther |

Definition at line 28 of file reflector.h.

28 {
29 kPadding,
30 kFloat,
31 kOther,
32 };
impeller::kPadding
constexpr auto kPadding
Definition: typographer_context_skia.cc:48
impeller::kFloat
@ kFloat
Definition: runtime_types.h:25

## Constructor & Destructor Documentation

## ◆ StructMember()

impeller::compiler::StructMember::StructMember | ( | std::string | p_type,
|  | spirv_cross::SPIRType::BaseType | p_base_type,
|  | std::string | p_name,
|  | size_t | p_offset,
|  | size_t | p_size,
|  | size_t | p_byte_length,
|  | std::optional< size_t > | p_array_elements,
|  | size_t | p_element_padding,
|  | UnderlyingType | p_underlying_type = `UnderlyingType::kOther`
| ) |  |
| inline

Constructs a new StructMember.

Parameters

  p_type | The string type name (e.g. "float", "Point", "Matrix").
  p_base_type | The SPIR-V base type.
  p_name | The name of the struct member.
  p_offset | The offset in bytes from the start of the parent struct.
  p_size | The size in bytes of a single element of this type (ignoring padding/stride).
  p_byte_length | The total size in bytes this member occupies in the struct, including all array elements and padding.
  p_array_elements | The number of array elements. For matrices treated as arrays of columns, this includes the column count.
  p_element_padding | The padding in bytes after each array element to satisfy alignment requirements (stride - size).
  p_underlying_type | The underlying type category, used for runtime validation.

Definition at line 140 of file reflector.h.

149 : type(std::move(p_type)),
150 base_type(p_base_type),
151 name(std::move(p_name)),
152 offset(p_offset),
153 size(p_size),
154 byte_length(p_byte_length),
155 array_elements(p_array_elements),
156 element_padding(p_element_padding),
157 underlying_type(DetermineUnderlyingType(p_base_type)) {}
impeller::compiler::StructMember::element_padding
size_t element_padding
Definition: reflector.h:41
impeller::compiler::StructMember::underlying_type
UnderlyingType underlying_type
Definition: reflector.h:42
impeller::compiler::StructMember::type
std::string type
Definition: reflector.h:34
impeller::compiler::StructMember::array_elements
std::optional< size_t > array_elements
Definition: reflector.h:40
impeller::compiler::StructMember::size
size_t size
Definition: reflector.h:38
impeller::compiler::StructMember::offset
size_t offset
Definition: reflector.h:37
impeller::compiler::StructMember::byte_length
size_t byte_length
Definition: reflector.h:39
impeller::compiler::StructMember::DetermineUnderlyingType
static UnderlyingType DetermineUnderlyingType(spirv_cross::SPIRType::BaseType type)
Definition: reflector.h:89
impeller::compiler::StructMember::name
std::string name
Definition: reflector.h:36
impeller::compiler::StructMember::base_type
spirv_cross::SPIRType::BaseType base_type
Definition: reflector.h:35

## Member Function Documentation

## ◆ BaseTypeToString()

static std::string impeller::compiler::StructMember::BaseTypeToString | ( | spirv_cross::SPIRType::BaseType | type | ) |
| inline static

Definition at line 44 of file reflector.h.

44 {
45 using Type = spirv_cross::SPIRType::BaseType;
46 switch (type) {
47 case Type::Void:
48 return "ShaderType::kVoid";
49 case Type::Boolean:
50 return "ShaderType::kBoolean";
51 case Type::SByte:
52 return "ShaderType::kSignedByte";
53 case Type::UByte:
54 return "ShaderType::kUnsignedByte";
55 case Type::Short:
56 return "ShaderType::kSignedShort";
57 case Type::UShort:
58 return "ShaderType::kUnsignedShort";
59 case Type::Int:
60 return "ShaderType::kSignedInt";
61 case Type::UInt:
62 return "ShaderType::kUnsignedInt";
63 case Type::Int64:
64 return "ShaderType::kSignedInt64";
65 case Type::UInt64:
66 return "ShaderType::kUnsignedInt64";
67 case Type::AtomicCounter:
68 return "ShaderType::kAtomicCounter";
69 case Type::Half:
70 return "ShaderType::kHalfFloat";
71 case Type::Float:
72 return "ShaderType::kFloat";
73 case Type::Double:
74 return "ShaderType::kDouble";
75 case Type::Struct:
76 return "ShaderType::kStruct";
77 case Type::Image:
78 return "ShaderType::kImage";
79 case Type::SampledImage:
80 return "ShaderType::kSampledImage";
81 case Type::Sampler:
82 return "ShaderType::kSampler";
83 default:
84 return "ShaderType::kUnknown";
85 }
86 FML_UNREACHABLE();
87 }

References type.

## ◆ DetermineUnderlyingType()

static UnderlyingType impeller::compiler::StructMember::DetermineUnderlyingType | ( | spirv_cross::SPIRType::BaseType | type | ) |
| inline static

Definition at line 89 of file reflector.h.

90 {
91 switch (type) {
92 case spirv_cross::SPIRType::Void:
93 return UnderlyingType::kPadding;
94 case spirv_cross::SPIRType::Float:
95 return UnderlyingType::kFloat;
96 case spirv_cross::SPIRType::Unknown:
97 case spirv_cross::SPIRType::Boolean:
98 case spirv_cross::SPIRType::SByte:
99 case spirv_cross::SPIRType::UByte:
100 case spirv_cross::SPIRType::Short:
101 case spirv_cross::SPIRType::UShort:
102 case spirv_cross::SPIRType::Int:
103 case spirv_cross::SPIRType::UInt:
104 case spirv_cross::SPIRType::Int64:
105 case spirv_cross::SPIRType::UInt64:
106 case spirv_cross::SPIRType::AtomicCounter:
107 case spirv_cross::SPIRType::Half:
108 case spirv_cross::SPIRType::Double:
109 case spirv_cross::SPIRType::Struct:
110 case spirv_cross::SPIRType::Image:
111 case spirv_cross::SPIRType::SampledImage:
112 case spirv_cross::SPIRType::Sampler:
113 case spirv_cross::SPIRType::AccelerationStructure:
114 case spirv_cross::SPIRType::RayQuery:
115 case spirv_cross::SPIRType::ControlPointArray:
116 case spirv_cross::SPIRType::Interpolant:
117 case spirv_cross::SPIRType::Char:
118 default:
119 return UnderlyingType::kOther;
120 }
121 FML_UNREACHABLE();
122 }
impeller::compiler::StructMember::UnderlyingType::kOther
@ kOther
impeller::compiler::StructMember::UnderlyingType::kPadding
@ kPadding
impeller::compiler::StructMember::UnderlyingType::kFloat
@ kFloat

References kFloat, kOther, kPadding, and type.

## Member Data Documentation

## ◆ array_elements

std::optional<size_t> impeller::compiler::StructMember::array_elements = std::nullopt

Definition at line 40 of file reflector.h.

## ◆ base_type

spirv_cross::SPIRType::BaseType impeller::compiler::StructMember::base_type

Definition at line 35 of file reflector.h.

## ◆ byte_length

size_t impeller::compiler::StructMember::byte_length = 0u

Definition at line 39 of file reflector.h.

## ◆ element_padding

size_t impeller::compiler::StructMember::element_padding = 0u

Definition at line 41 of file reflector.h.

## ◆ name

std::string impeller::compiler::StructMember::name

Definition at line 36 of file reflector.h.

## ◆ offset

size_t impeller::compiler::StructMember::offset = 0u

Definition at line 37 of file reflector.h.

## ◆ size

size_t impeller::compiler::StructMember::size = 0u

Definition at line 38 of file reflector.h.

## ◆ type

std::string impeller::compiler::StructMember::type

Definition at line 34 of file reflector.h.

Referenced by BaseTypeToString(), and DetermineUnderlyingType().

## ◆ underlying_type

UnderlyingType impeller::compiler::StructMember::underlying_type = UnderlyingType::kOther

Definition at line 42 of file reflector.h.

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

- impeller/compiler/reflector.h