Module spv

Source
Expand description

Frontend for SPIR-V (Standard Portable Intermediate Representation).

§ID lookups

Our IR links to everything with Handle, while SPIR-V uses IDs. In order to keep track of the associations, the parser has many lookup tables. There map spv::Word into a specific IR handle, plus potentially a bit of extra info, such as the related SPIR-V type ID. TODO: would be nice to find ways that avoid looking up as much

§Inputs/Outputs

We create a private variable for each input/output. The relevant inputs are populated at the start of an entry point. The outputs are saved at the end.

The function associated with an entry point is wrapped in another function, such that we can handle any Return statements without problems.

§Row-major matrices

We don’t handle them natively, since the IR only expects column majority. Instead, we detect when such matrix is accessed in the OpAccessChain, and we generate a parallel expression that loads the value, but transposed. This value then gets used instead of OpLoad result later on.

Modules§

convert 🔒
error 🔒
function 🔒
image 🔒
null 🔒

Structs§

BlockContext 🔒
Fragments of Naga IR, to be assembled into Statements once data flow is resolved.
Body 🔒
An intermediate representation of a Naga Block.
Decoration 🔒
DecorationFlags 🔒
EntryPoint 🔒
Frontend
Instruction
LookupConstant 🔒
LookupExpression 🔒
Information about SPIR-V result ids, stored in Frontend::lookup_expression.
LookupFunction 🔒
LookupFunctionType 🔒
LookupMember 🔒
LookupType 🔒
LookupVariable 🔒
Options
PhiExpression 🔒

Enums§

BodyFragment 🔒
An intermediate representation of a Naga Statement.
Constant 🔒
Error
ExtendedClass 🔒
LookupLoadOverride 🔒
Majority 🔒
MergeBlockInformation 🔒
ModuleState
SignAnchor 🔒
Variable 🔒

Constants§

SUPPORTED_CAPABILITIES
SUPPORTED_EXTENSIONS
SUPPORTED_EXT_SETS

Traits§

LookupHelper 🔒

Functions§

is_parent 🔒
Helper function to check if child is in the scope of parent
make_index_literal 🔒
parse_u8_slice
resolve_constant 🔒

Type Aliases§

BodyIndex 🔒
An index into the BlockContext::bodies table.
MemberIndex 🔒