hal/vulkan/spir-v/instructions.lisp
One-time migration from the short-lived structure-definition registry.
No user-held occurrences existed yet: the old instances were definitions
in *INSTRUCTIONS*, so retiring that class binding loses no shader IR.
Define one instruction class in luv's SPIR-V backend vocabulary.
Like SBCL's backend instruction files, this is executable treaty text: definitions create their own IR classes, and repetitive instruction families get a local definer instead of being expanded by hand.
The extended instruction number is a literal, so lowering may write the readable (enum glsl-std-450 f-clamp) form rather than a bare integer.
GLSL.std.450 extended instruction numbers, spelled with this assembler's word conventions. Entries follow actual shader needs, like the opcodes.
Parse one surface form into an inspectable instruction occurrence.
Parse surface forms into a vector of instruction occurrences.
Return the canonical s-expression surface form for instruction.
Assemble surface forms or instruction occurrences into SPIR-V words.
This assembler intentionally recognizes only the vocabulary declared in
instruction classes and *ENUMERANTS*. Result symbols may be referenced before
their definitions.
Write SPIR-V words to pathname in its defined little-endian byte order.
Logical conjunction of tests and raw truth values.
Logical negation of one test or raw truth value.
(instruction-or-class)(instruction ids)((class quantity-class) (superclass closer-mop:standard-class))(instruction-or-class)(instruction-or-class)Test whether two compatible scalars are equal.
Addition over compatible quantities.
(name lambda-list &rest options)(name &body entries)(&body definitions)(&body definitions)Headings, paragraphs, figures and their IDs, mentions, marks.
The inner product of two vectors.
Keyword/value pairs stay together; in body position each pair is a row with keys loosely aligned. A SETF with several pairs is a place/value table: each pair a subgrid row of its two-column box.
The componentwise square root of a raw value.
Compare compatible quantities and produce dimensionless values.
Normalize a dimensionless vector.
(left right)(class)(kind name form)(class values form)(form)(forms)(instruction)(instruction)((call tool-call) stream)(instructions)(&optional (count "12"))Print COUNT fresh figure IDs that no page uses (default 12); never six hex digits, which the reader takes for a colour.
(name ids form)Logical disjunction of tests and raw truth values.
(value)(value form)Test whether one compatible scalar is at most another.
Subtraction or unary negation.
Extract the unsigned bit field (BYTE SIZE POSITION) of one unsigned scalar.
Convert one scalar float or unsigned value to a 32-bit float.
(string form)Multiplication and scalar scaling.
Test whether one compatible scalar is less than another.
(spec value ids form)(specs values ids form)(forms &key (version #x00010000) (generator 0))Assemble surface FORMS or instruction occurrences into SPIR-V words. This assembler intentionally recognizes only the vocabulary declared in instruction classes and *ENUMERANTS*. Result symbols may be referenced before their definitions.
(words pathname)
A deliberately small SPIR-V assembler for shaders luv can execute today.
Result IDs lead their instruction, which makes the data read naturally:
(%float type-float 32) (%x load %float %pointer) (return)
The instruction classes and enumerant table are explicit subsets of the SPIR-V grammar. Growing this file follows actual shader needs rather than importing the entire registry into the Lisp image.