Bounded, typed intermediate representation for the supported WGSL frontend profile. More...
#include <array>#include <concepts>#include <cstdint>#include <limits>#include <string_view>#include "donner/base/Utils.h"Classes | |
| struct | donner::gpu::shader::wgsl::SourceSpan |
| A half-open byte range in the WGSL input. More... | |
| struct | donner::gpu::shader::wgsl::NameRef |
| A module-owned identifier spelling. More... | |
| struct | donner::gpu::shader::wgsl::Type |
| A resolved scalar, vector, structure, or resource type. More... | |
| struct | donner::gpu::shader::wgsl::InterfaceDecoration |
| A scalar/vector leaf in an entry-point interface. More... | |
| struct | donner::gpu::shader::wgsl::StructMember |
| Storage layout of one structure member. More... | |
| struct | donner::gpu::shader::wgsl::Struct |
| One declared structure and its computed uniform layout. More... | |
| struct | donner::gpu::shader::wgsl::Binding |
| One module-scope resource binding. More... | |
| struct | donner::gpu::shader::wgsl::Symbol |
| One resolved identifier declaration. More... | |
| struct | donner::gpu::shader::wgsl::Expression |
| One typed expression node. Operands are in source order. More... | |
| struct | donner::gpu::shader::wgsl::Statement |
| One typed statement node. The next link preserves lexical statement order. More... | |
| struct | donner::gpu::shader::wgsl::InterfaceVariable |
| A flattened scalar/vector input or output of one entry point. More... | |
| struct | donner::gpu::shader::wgsl::Function |
| One declared function. More... | |
| struct | donner::gpu::shader::wgsl::FoldedConstant |
| An outermost constant f32 or abstract-float expression the parser folded. The WGSL projection spells its value exactly in place of the authored source, so a browser receives the value the native projections carry rather than evaluating the expression with WGSL's looser accuracy. More... | |
| struct | donner::gpu::shader::wgsl::ModuleLimits |
| Fixed capacities for one frontend module. More... | |
| struct | donner::gpu::shader::wgsl::Module |
| A complete, immutable-on-success frontend module backed by fixed arenas. More... | |
Namespaces | |
| namespace | donner |
| Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css. | |
Typedefs | |
| using | donner::gpu::shader::wgsl::ArenaId = uint16_t |
| Identifier for an item stored in one of Module's arenas. | |
Enumerations | |
| enum class | donner::gpu::shader::wgsl::StorageTextureFormat : uint8_t { Rgba32Float , Rgba8Unorm } |
| Storage format accepted by the frontend profile. More... | |
| enum class | donner::gpu::shader::wgsl::TypeKind : uint8_t { Void , Bool , I32 , U32 , F32 , AbstractInt , AbstractFloat , Struct , Matrix , Array , Sampler , SampledTexture2d , StorageTexture2d , Pointer } |
| Kind of a resolved WGSL value type. More... | |
| enum class | donner::gpu::shader::wgsl::BuiltinValue : uint8_t { None , GlobalInvocationId , VertexIndex , Position , InstanceIndex } |
| Builtin value supported by a shader entry interface. | |
| enum class | donner::gpu::shader::wgsl::BindingKind : uint8_t { Uniform , ReadOnlyStorage , Sampler , SampledTexture , StorageTexture } |
| Module-scope resource binding kind. More... | |
| enum class | donner::gpu::shader::wgsl::SymbolKind : uint8_t { Constant , Binding , Parameter , Let , Var } |
| Scope category of one resolved name. More... | |
| enum class | donner::gpu::shader::wgsl::UnaryOp : uint8_t { Negate , Not } |
| Unary operator represented by Expression::payload. More... | |
| enum class | donner::gpu::shader::wgsl::BinaryOp : uint8_t { BitAnd = 13 , ShiftLeft = 14 , ShiftRight = 15 , Add = 0 , Sub , Mul , Div , Mod , Lt , Le , Gt , Ge , Eq , Ne , And , Or } |
| Binary operator represented by Expression::payload. More... | |
| enum class | donner::gpu::shader::wgsl::Builtin : uint8_t { All , Abs , Max , Round , Sqrt , Dot , Length , Normalize , Saturate , Fract , Fwidth , Any , Clamp , Select , Min , Ceil , Exp , TextureLoad , TextureDimensions , TextureStore , Floor , Sign , Sin , Cos , Pow , Mix , TextureSample , TextureSampleLevel } |
| Builtins accepted by the frontend profile. More... | |
| enum class | donner::gpu::shader::wgsl::ExpressionKind : uint8_t { Zero , Literal , Symbol , Unary , Binary , Member , Swizzle , Construct , Convert , BuiltinCall , FunctionCall , Index , AddressOf , Deref } |
| Kind of a typed expression node. More... | |
| enum class | donner::gpu::shader::wgsl::StatementKind : uint8_t { Declaration , Assign , If , For , Return , TextureStore , Break , Continue , Discard , Switch , Case , Call , Loop , While } |
| Kind of a typed statement node. More... | |
| enum class | donner::gpu::shader::wgsl::Stage : uint8_t { None , Compute , Vertex , Fragment } |
| Pipeline stage associated with a function. More... | |
Functions | |
| constexpr std::array< ArenaId, kMaxExpressionOperands > | donner::gpu::shader::wgsl::Operands (std::same_as< ArenaId > auto... ids) |
Builds an expression operand array, filling every slot past ids with donner::gpu::shader::wgsl::kInvalidArenaId. | |
Variables | |
| constexpr ArenaId | donner::gpu::shader::wgsl::kInvalidArenaId = std::numeric_limits<ArenaId>::max() |
| Invalid arena identifier. | |
| constexpr uint8_t | donner::gpu::shader::wgsl::kMaxExpressionOperands = 8 |
| Maximum call arity and expression operands. | |
| constexpr std::array< ArenaId, kMaxExpressionOperands > | donner::gpu::shader::wgsl::kUnsetOperands |
| Operand array with every slot set to donner::gpu::shader::wgsl::kInvalidArenaId. | |
Bounded, typed intermediate representation for the supported WGSL frontend profile.
|
strong |
Binary operator represented by Expression::payload.
|
strong |
|
strong |
Builtins accepted by the frontend profile.
|
strong |
Kind of a typed expression node.
| Enumerator | |
|---|---|
| Zero | Zero initialization of a constructible value. |
| Literal | A scalar literal; payload holds IEEE or integer bits. |
| Symbol | A resolved Symbol; payload is its arena identifier. |
| Unary | A UnaryOp and one operand. |
| Binary | A BinaryOp and two operands. |
| Member | A structure member; payload is its StructMember identifier. |
| Swizzle | Vector swizzle; payload encodes lane indices. |
| Construct | Vector construction. |
| Convert | Explicit scalar or vector conversion. |
| BuiltinCall | A Builtin call. |
| FunctionCall | A declared Function call; payload is its arena identifier. |
| Index | Fixed-array access with base and index operands. |
| AddressOf | &localVar; yields a function-address-space pointer. |
| Deref | *pointer; yields the pointee as an assignable value. |
|
strong |
|
strong |
Kind of a typed statement node.
|
strong |
|
strong |
|
strong |
Kind of a resolved WGSL value type.
|
strong |
|
constexpr |
Builds an expression operand array, filling every slot past ids with donner::gpu::shader::wgsl::kInvalidArenaId.
Zero is a valid arena identifier, so an unset slot left value-initialized would alias expression zero. Every operand array is built here so no call site has to spell the sentinel once per slot.
| ids | Operand arena identifiers in source order. |
|
inlineconstexpr |
Operand array with every slot set to donner::gpu::shader::wgsl::kInvalidArenaId.