An immutable shader IR type with deep value equality.
More...
#include "donner/gpu/shader/IrType.h"
|
|
Kind | kind () const |
| | Type category.
|
| ScalarKind | scalarKind () const |
| | Scalar kind of a scalar or vector type.
|
| uint32_t | vectorSize () const |
| | Component count of a vector type (2..4).
|
| const IrType & | elementType () const |
| | Element type of a sized or runtime array.
|
| uint32_t | arrayCount () const |
| | Element count of a sized array.
|
| const RcString & | structName () const |
| | Name of a struct type.
|
| std::span< const Member > | structMembers () const |
| | Members of a struct type.
|
|
bool | isScalar () const |
| | True for bool/i32/u32/f32.
|
|
bool | isVector () const |
| | True for vecN types.
|
|
bool | isNumericScalar () const |
| | True for i32/u32/f32 scalars.
|
|
bool | isNumericVector () const |
| | True for vectors of i32/u32/f32.
|
|
bool | isNumeric () const |
| | True for i32/u32/f32 scalars and their vectors.
|
|
bool | isFloatScalarOrVector () const |
| | True for f32 and vectors of f32.
|
|
bool | isPlainData () const |
| | True for types that can be stored in arrays and structs (everything except runtime arrays, textures, and samplers).
|
| bool | operator== (const IrType &other) const |
| | Deep structural equality.
|
|
std::string | toString () const |
| | Formats this type, e.g. vec2<f32> or array<Band>.
|
|
| static IrType | Scalar (ScalarKind kind) |
| | Scalar type of the given kind.
|
|
static IrType | Bool () |
| | bool type.
|
|
static IrType | I32 () |
| | i32 type.
|
|
static IrType | U32 () |
| | u32 type.
|
|
static IrType | F32 () |
| | f32 type.
|
| static IrType | Vec2 (ScalarKind element) |
| | vec2<element> type.
|
| static IrType | Vec3 (ScalarKind element) |
| | vec3<element> type.
|
| static IrType | Vec4 (ScalarKind element) |
| | vec4<element> type.
|
|
static IrType | Vec2f () |
| | vec2<f32> convenience factory.
|
|
static IrType | Vec3f () |
| | vec3<f32> convenience factory.
|
|
static IrType | Vec4f () |
| | vec4<f32> convenience factory.
|
|
static IrType | Vec2i () |
| | vec2<i32> convenience factory.
|
|
static IrType | Vec2u () |
| | vec2<u32> convenience factory.
|
|
static IrType | Mat4x4f () |
| | mat4x4<f32> type.
|
|
static IrType | Texture2dF32 () |
| | texture_2d<f32> resource type.
|
|
static IrType | SamplerType () |
| | Filtering sampler resource type.
|
| static ShaderResult< IrType > | SizedArray (const IrType &element, uint32_t count, const RcString &label="array") |
| | array<element, count> type.
|
| static ShaderResult< IrType > | RuntimeArray (const IrType &element, const RcString &label="runtimeArray") |
| | array<element> runtime-sized type, usable only as a read-only storage buffer root.
|
| static ShaderResult< IrType > | Struct (const RcString &name, std::vector< Member > members, const RcString &label="struct") |
| | Named struct type.
|
|
| std::ostream & | operator<< (std::ostream &os, const IrType &type) |
| | Ostream output operator.
|
An immutable shader IR type with deep value equality.
Construct through the static factories. Factories that can receive invalid input (arrays, structs) return ShaderResult and fail closed; the fixed factories (scalars, vectors, matrix, resource types) cannot fail.
◆ donner::gpu::shader::IrType::Member
| struct donner::gpu::shader::IrType::Member |
One named member of a struct type.
◆ Kind
Type category.
| Enumerator |
|---|
| Scalar | bool / i32 / u32 / f32.
|
| Vector | vecN<T>, N in 2..4.
|
| Matrix4x4f | mat4x4f (the only matrix type in scope).
|
| SizedArray | array<E, N>.
|
| RuntimeArray | array<E>; storage buffer roots only.
|
| Struct | Named struct with named members.
|
| Texture2dF32 | texture_2d<f32>.
|
| Sampler | Filtering sampler.
|
◆ arrayCount()
| uint32_t donner::gpu::shader::IrType::arrayCount |
( |
| ) |
const |
Element count of a sized array.
- Precondition
- kind() is SizedArray.
◆ elementType()
| const IrType & donner::gpu::shader::IrType::elementType |
( |
| ) |
const |
Element type of a sized or runtime array.
- Precondition
- kind() is SizedArray or RuntimeArray.
◆ operator==()
| bool donner::gpu::shader::IrType::operator== |
( |
const IrType & | other | ) |
const |
Deep structural equality.
- Parameters
-
| other | Type to compare against. |
◆ RuntimeArray()
| ShaderResult< IrType > donner::gpu::shader::IrType::RuntimeArray |
( |
const IrType & | element, |
|
|
const RcString & | label = "runtimeArray" ) |
|
static |
array<element> runtime-sized type, usable only as a read-only storage buffer root.
Fails closed if element is not plain data.
- Parameters
-
| element | Element type. |
| label | Diagnostic label for errors. |
◆ Scalar()
| IrType donner::gpu::shader::IrType::Scalar |
( |
ScalarKind | kind | ) |
|
|
static |
Scalar type of the given kind.
- Parameters
-
◆ scalarKind()
| ScalarKind donner::gpu::shader::IrType::scalarKind |
( |
| ) |
const |
Scalar kind of a scalar or vector type.
- Precondition
- kind() is Scalar or Vector.
◆ SizedArray()
| ShaderResult< IrType > donner::gpu::shader::IrType::SizedArray |
( |
const IrType & | element, |
|
|
uint32_t | count, |
|
|
const RcString & | label = "array" ) |
|
static |
array<element, count> type.
Fails closed if count is zero or element is not plain data (runtime arrays, textures, and samplers cannot be array elements).
- Parameters
-
| element | Element type. |
| count | Element count; must be nonzero. |
| label | Diagnostic label for errors. |
◆ Struct()
Named struct type.
Fails closed on empty member lists, duplicate member names, or member types that are not plain data (runtime arrays are only supported as storage binding roots in this packet, so they cannot be struct members).
- Parameters
-
| name | Struct name. |
| members | Struct members in declaration order. |
| label | Diagnostic label for errors. |
◆ structMembers()
| std::span< const Member > donner::gpu::shader::IrType::structMembers |
( |
| ) |
const |
Members of a struct type.
- Precondition
- kind() is Struct.
◆ structName()
| const RcString & donner::gpu::shader::IrType::structName |
( |
| ) |
const |
Name of a struct type.
- Precondition
- kind() is Struct.
◆ Vec2()
| IrType donner::gpu::shader::IrType::Vec2 |
( |
ScalarKind | element | ) |
|
|
static |
vec2<element> type.
- Parameters
-
| element | Component scalar kind. |
◆ Vec3()
| IrType donner::gpu::shader::IrType::Vec3 |
( |
ScalarKind | element | ) |
|
|
static |
vec3<element> type.
- Parameters
-
| element | Component scalar kind. |
◆ Vec4()
| IrType donner::gpu::shader::IrType::Vec4 |
( |
ScalarKind | element | ) |
|
|
static |
vec4<element> type.
- Parameters
-
| element | Component scalar kind. |
◆ vectorSize()
| uint32_t donner::gpu::shader::IrType::vectorSize |
( |
| ) |
const |
Component count of a vector type (2..4).
- Precondition
- kind() is Vector.
◆ operator<<
| std::ostream & operator<< |
( |
std::ostream & | os, |
|
|
const IrType & | type ) |
|
friend |
Ostream output operator.
- Parameters
-
| os | Output stream. |
| type | Type to output. |
The documentation for this class was generated from the following file: