Skip to main content

Module psv

Module psv 

Source
Expand description

The pipeline state validation (PSV0) part of a Shader Model 6 program container: the runtime information, resource records and signature elements a pipeline is validated against, which the validator writes from the program’s own metadata. Little-endian.

u32 runtime-info size (24, 36, 48, 52 or 56), then the runtime info
u32 resource count; when it is not zero, u32 record size (16 or 24), then the records
then, where the runtime info is 36 bytes or more:
u32 string-table size, then the table
u32 semantic-index count, then the indices (u32 each)
u32 element size (16) when there are any input, output or patch-constant elements, then the input, the output and
  the patch-constant elements
the rest: the input-to-output dependency tables, as words

The runtime info is 16 bytes whose meaning depends on the stage, the lowest and highest wave lane counts (u32 each), then from 36 bytes the stage (u8), the uses-view-id flag (u8), a u16 (a geometry program’s largest output vertex count; in the low byte a hull or domain program’s patch-constant vector count), the input, output and patch-constant element counts (u8 each), the input vector count (u8) and four output vector counts (u8 each), from 48 bytes the thread group size (three u32), at 52 bytes the offset of the entry point’s name in the string table, and at 56 bytes the group-shared memory a compute, mesh or amplification program uses (u32). The stage-dependent 16 bytes are: vertex, whether an SV_Position output exists (word 3); pixel, whether it writes depth (byte 0) and whether it shades per sample (byte 1); hull, the input and output control point counts, the domain and the output primitive; domain, the input control point count; geometry, the input primitive, the output topology, the output stream mask and whether it writes a position. The record sizes follow the validator that wrote the part: validator 1.0 writes a 24-byte runtime info, which ends at the wave lane counts, and its part ends with the resource records; 1.5 writes a 36-byte runtime info and 16-byte resource records, 1.6 writes 48 and 24, and 1.10 writes 52 and 24 (the 16-byte records have no kind or flags). The 56-byte runtime info is the fourth version of the layout in dxc’s source (PSVRuntimeInfo4). The reader reads these five sizes only.

Every field above was checked against the metadata of the same program in the stock containers of skate. (19,240 with a PSV0 part, validator 1.10) and Elden Ring (46,002; 10 with validator 1.5, 45,992 with 1.6): the layout consumes each part to its last byte, and the stage, the thread group, the resource ranges, the elements’ name, semantic indices, size, kind, interpolation and placement, the vector counts and the stage unions equal what crate::reflection reads from the metadata. The dependency tables are kept as stored words; the part’s remainder after the elements is as long as the vectors state (the input vectors’ components times the words of the output vectors’ components).

Structs§

Element
A signature element record (16 bytes).
Psv
A PSV0 part.
Resource
A resource record.
RuntimeInfo
The runtime information of a PSV0 part.
StageSignature
The runtime info’s bytes 24 to 35 (dxc’s PSVRuntimeInfo1): the stage and the counts of the signatures the part’s tables hold.

Functions§

part
The PSV0 part of a container’s directory, if it has one (a library has none; it has runtime data, crate::rdat).
read
Reads the PSV0 part data. Anything outside the layout above (a runtime info or record of another size, a table past the part’s end, a remainder that is not whole words) is an error naming the bit.