Flutter Impeller
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, std::optional< std::string > p_float_type=std::nullopt, size_t p_vec_size=0u, size_t p_columns=0u, 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
 
std::optional< std::string > float_type = std::nullopt
 
size_t vec_size = 0u
 
size_t columns = 0u
 
UnderlyingType underlying_type = UnderlyingType::kOther
 

Detailed Description

Definition at line 25 of file reflector.h.

Member Enumeration Documentation

◆ UnderlyingType

Enumerator
kPadding 
kFloat 
kOther 

Definition at line 28 of file reflector.h.

28  {
29  kPadding,
30  kFloat,
31  kOther,
32  };
constexpr auto kPadding

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,
std::optional< std::string >  p_float_type = std::nullopt,
size_t  p_vec_size = 0u,
size_t  p_columns = 0u,
UnderlyingType  p_underlying_type = UnderlyingType::kOther 
)
inline

Constructs a new StructMember.

Parameters
p_typeThe string type name (e.g. "float", "Point", "Matrix").
p_base_typeThe SPIR-V base type.
p_nameThe name of the struct member.
p_offsetThe offset in bytes from the start of the parent struct.
p_sizeThe size in bytes of a single element of this type (ignoring padding/stride).
p_byte_lengthThe total size in bytes this member occupies in the struct, including all array elements and padding.
p_array_elementsThe number of array elements. For matrices treated as arrays of columns, this includes the column count.
p_element_paddingThe padding in bytes after each array element to satisfy alignment requirements (stride - size).
p_float_typeThe float type of the member.
p_vec_sizeThe component count of a single column (vector length for non-matrix types, row count for matrices). 0 if not applicable.
p_columnsThe number of columns. 1 for scalars and vectors; N for an NxN matrix. 0 if not applicable.
p_underlying_typeThe underlying type category, used for runtime validation.

Definition at line 154 of file reflector.h.

166  : type(std::move(p_type)),
167  base_type(p_base_type),
168  name(std::move(p_name)),
169  offset(p_offset),
170  size(p_size),
171  byte_length(p_byte_length),
172  array_elements(p_array_elements),
173  element_padding(p_element_padding),
174  float_type(std::move(p_float_type)),
175  vec_size(p_vec_size),
176  columns(p_columns),
UnderlyingType underlying_type
Definition: reflector.h:50
std::optional< size_t > array_elements
Definition: reflector.h:40
std::optional< std::string > float_type
Definition: reflector.h:42
static UnderlyingType DetermineUnderlyingType(spirv_cross::SPIRType::BaseType type)
Definition: reflector.h:97
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)
inlinestatic

Definition at line 52 of file reflector.h.

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

References type.

◆ DetermineUnderlyingType()

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

Definition at line 97 of file reflector.h.

98  {
99  switch (type) {
100  case spirv_cross::SPIRType::Void:
102  case spirv_cross::SPIRType::Float:
103  return UnderlyingType::kFloat;
104  case spirv_cross::SPIRType::Unknown:
105  case spirv_cross::SPIRType::Boolean:
106  case spirv_cross::SPIRType::SByte:
107  case spirv_cross::SPIRType::UByte:
108  case spirv_cross::SPIRType::Short:
109  case spirv_cross::SPIRType::UShort:
110  case spirv_cross::SPIRType::Int:
111  case spirv_cross::SPIRType::UInt:
112  case spirv_cross::SPIRType::Int64:
113  case spirv_cross::SPIRType::UInt64:
114  case spirv_cross::SPIRType::AtomicCounter:
115  case spirv_cross::SPIRType::Half:
116  case spirv_cross::SPIRType::Double:
117  case spirv_cross::SPIRType::Struct:
118  case spirv_cross::SPIRType::Image:
119  case spirv_cross::SPIRType::SampledImage:
120  case spirv_cross::SPIRType::Sampler:
121  case spirv_cross::SPIRType::AccelerationStructure:
122  case spirv_cross::SPIRType::RayQuery:
123  case spirv_cross::SPIRType::ControlPointArray:
124  case spirv_cross::SPIRType::Interpolant:
125  case spirv_cross::SPIRType::Char:
126  default:
127  return UnderlyingType::kOther;
128  }
129  FML_UNREACHABLE();
130  }

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.

◆ columns

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

Definition at line 49 of file reflector.h.

◆ element_padding

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

Definition at line 41 of file reflector.h.

◆ float_type

std::optional<std::string> impeller::compiler::StructMember::float_type = std::nullopt

Definition at line 42 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 50 of file reflector.h.

◆ vec_size

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

Definition at line 47 of file reflector.h.


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