Vixen
dd8b0a81

Raven · guide

Compiling a shader

The four phases a `.rvn` goes through — parse, bind, lower, generate — the handful of types a host touches to drive them, where each phase's diagnostics come from, and why a permutation value or a compose binding makes a separate compilation rather than a flag.

Edit this page on GitHub

Documents

Next

  • Reading a shader's reflection — What the compiler can tell a host about a shader it produced — descriptor sets, vertex inputs, fragment outputs, push constants, specialisation constants, permutations and value parameters — plus the std140/std430 layout rules a uniform block's offsets come from.
  • Compiled artefacts — The two things the compiler writes — `.rvnfx`, one shader compiled for one target and one permutation, and `.rvnlib`, a library a later compilation binds and links against — what is in each container, and why both carry a version a reader refuses rather than guesses at.
  • The target-independent IR — The model every back end consumes and none of them may look behind — a structured body over SSA values, storage reached only through an access chain, a deliberately small type system, and a verifier that runs before a back end ever sees a module.
  • The Raven symbol model — What binding produces — the entity hierarchy a tool asks questions of, why type identity is by reference for the intrinsics and structural for the seven constructed shapes, how generics are read through a substitution rather than instantiated, and why this model is deliberately richer than the IR the back ends see.
  • The Raven syntax tree — What parsing produces — a Roslyn-shaped tree generated from one grammar file, why the node classes are not written by hand, how an edit reparses only the members it touched, and the two traps that come with reuse and with a language whose newline ends a statement.