Skip to main content

Module decode

Module decode 

Source
Expand description

The token-level decoder of Shader Model 4 and 5 programs: any stage’s version token, declarations as typed records, and instructions as an opcode, its control bits, its extended tokens and its operands. It decides nothing about which instructions a caller can use: they are all returned, and the caller refuses what it cannot handle. A token it cannot read at all (an operand register type it has no name for, a truncated instruction) is an error naming the word.

Structs§

Declaration
A declaration, typed. word is where it starts.
Decoded
A decoded token stream: its target, declarations and instructions, each in program order.
Index
One index dimension of an operand: a constant, a relative register, or both added.
Instruction
An instruction as stored.
Operand
An instruction’s or declaration’s operand.
RegisterRange
The registers a Shader Model 5.1 declaration binds and their register space (T1[4:7], space=1). Shader Model 5.0 declares each register on its own, in space 0; 5.1 names the resource by an id (the declaration’s slot) and instructions by the id and a register of the range.

Enums§

Declared
A declaration, typed where this reader knows its layout.
ProgramType
The kind of program a version token names.
Register
The kind of register an operand names.
Selection
The components of a register an operand selects.

Functions§

decode
Decode a complete token stream: version token, length, then declarations and instructions to its end.
opcode_name
The name of an opcode in Microsoft’s tokenized program format, or unknown opcode.

Type Aliases§

ReturnCodes
The type of a program’s four return lanes in a resource declaration, as D3D_RETURN_TYPE codes (1 unorm, 2 snorm, 3 sint, 4 uint, 5 float, 6 mixed, 7 double, 8 continued, 9 unused), one nibble per lane.