code:
#include "dxbc_defs.h"

namespace dxvk {

  const std::array<DxbcInstFormat, 218> g_instructionFormats = {{
    /* Add                                  */
    { 3, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* And                                  */
    { 3, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* Break                                */
    { 0, DxbcInstClass::ControlFlow },
    /* Breakc                               */
    { 1, DxbcInstClass::ControlFlow, {
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* Call                                 */
    { 1, DxbcInstClass::ControlFlow, {
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* Callc                                */
    { 2, DxbcInstClass::ControlFlow, {
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* Case                                 */
    { 1, DxbcInstClass::ControlFlow, {
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* Continue                             */
    { 0, DxbcInstClass::ControlFlow },
    /* Continuec                            */
    { 1, DxbcInstClass::ControlFlow, {
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* Cut                                  */
    { 0, DxbcInstClass::GeometryEmit },
    /* Default                              */
    { 0, DxbcInstClass::ControlFlow },
    /* DerivRtx                             */
    { 2, DxbcInstClass::VectorDeriv, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* DerivRty                             */
    { 2, DxbcInstClass::VectorDeriv, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Discard                              */
    { 1, DxbcInstClass::ControlFlow, {
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* Div                                  */
    { 3, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Dp2                                  */
    { 3, DxbcInstClass::VectorDot, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Dp3                                  */
    { 3, DxbcInstClass::VectorDot, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Dp4                                  */
    { 3, DxbcInstClass::VectorDot, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Else                                 */
    { 0, DxbcInstClass::ControlFlow },
    /* Emit                                 */
    { 0, DxbcInstClass::GeometryEmit },
    /* EmitThenCut                          */
    { 0, DxbcInstClass::GeometryEmit },
    /* EndIf                                */
    { 0, DxbcInstClass::ControlFlow },
    /* EndLoop                              */
    { 0, DxbcInstClass::ControlFlow },
    /* EndSwitch                            */
    { 0, DxbcInstClass::ControlFlow },
    /* Eq                                   */
    { 3, DxbcInstClass::VectorCmp, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Exp                                  */
    { 2, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Frc                                  */
    { 2, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* FtoI                                 */
    { 2, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Sint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* FtoU                                 */
    { 2, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Ge                                   */
    { 3, DxbcInstClass::VectorCmp, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* IAdd                                 */
    { 3, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
    } },
    /* If                                   */
    { 1, DxbcInstClass::ControlFlow, {
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* IEq                                  */
    { 3, DxbcInstClass::VectorCmp, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
    } },
    /* IGe                                  */
    { 3, DxbcInstClass::VectorCmp, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
    } },
    /* ILt                                  */
    { 3, DxbcInstClass::VectorCmp, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
    } },
    /* IMad                                 */
    { 4, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
    } },
    /* IMax                                 */
    { 3, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
    } },
    /* IMin                                 */
    { 3, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
    } },
    /* IMul                                 */
    { 4, DxbcInstClass::VectorImul, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::DstReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
    } },
    /* INe                                  */
    { 3, DxbcInstClass::VectorCmp, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
    } },
    /* INeg                                 */
    { 2, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
    } },
    /* IShl                                 */
    { 3, DxbcInstClass::VectorShift, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* IShr                                 */
    { 3, DxbcInstClass::VectorShift, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* ItoF                                 */
    { 2, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32  },
    } },
    /* Label                                */
    { 1, DxbcInstClass::ControlFlow, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
    } },
    /* Ld                                   */
    { 3, DxbcInstClass::TextureFetch, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* LdMs                                 */
    { 4, DxbcInstClass::TextureFetch, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32  },
    } },
    /* Log                                  */
    { 2, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Loop                                 */
    { 0, DxbcInstClass::ControlFlow },
    /* Lt                                   */
    { 3, DxbcInstClass::VectorCmp, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Mad                                  */
    { 4, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Min                                  */
    { 3, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Max                                  */
    { 3, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* CustomData                           */
    { 0, DxbcInstClass::CustomData },
    /* Mov                                  */
    { 2, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Movc                                 */
    { 4, DxbcInstClass::VectorCmov, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Mul                                  */
    { 3, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Ne                                   */
    { 3, DxbcInstClass::VectorCmp, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Nop                                  */
    { 0, DxbcInstClass::NoOperation },
    /* Not                                  */
    { 2, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* Or                                   */
    { 3, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* ResInfo                              */
    { 3, DxbcInstClass::TextureQuery, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Ret                                  */
    { 0, DxbcInstClass::ControlFlow },
    /* Retc                                 */
    { 1, DxbcInstClass::ControlFlow, {
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* RoundNe                              */
    { 2, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* RoundNi                              */
    { 2, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* RoundPi                              */
    { 2, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* RoundZ                               */
    { 2, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Rsq                                  */
    { 2, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Sample                               */
    { 4, DxbcInstClass::TextureSample, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* SampleC                              */
    { 5, DxbcInstClass::TextureSample, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* SampleClz                            */
    { 5, DxbcInstClass::TextureSample, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* SampleL                              */
    { 5, DxbcInstClass::TextureSample, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* SampleD                              */
    { 6, DxbcInstClass::TextureSample, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* SampleB                              */
    { 5, DxbcInstClass::TextureSample, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Sqrt                                 */
    { 2, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Switch                               */
    { 1, DxbcInstClass::ControlFlow, {
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* SinCos                               */
    { 3, DxbcInstClass::VectorSinCos, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* UDiv                                 */
    { 4, DxbcInstClass::VectorIdiv, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* ULt                                  */
    { 3, DxbcInstClass::VectorCmp, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* UGe                                  */
    { 3, DxbcInstClass::VectorCmp, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* UMul                                 */
    { 4, DxbcInstClass::VectorImul, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* UMad                                 */
    { 4, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* UMax                                 */
    { 3, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* UMin                                 */
    { 3, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* UShr                                 */
    { 3, DxbcInstClass::VectorShift, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* UtoF                                 */
    { 2, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32  },
    } },
    /* Xor                                  */
    { 3, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* DclResource                          */
    { 2, DxbcInstClass::Declaration, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::Imm32,  DxbcScalarType::Uint32  },
    } },
    /* DclConstantBuffer                    */
    { 1, DxbcInstClass::Declaration, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
    } },
    /* DclSampler                           */
    { 1, DxbcInstClass::Declaration, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
    } },
    /* DclIndexRange                        */
    { 2, DxbcInstClass::Declaration, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::Imm32,  DxbcScalarType::Uint32  },
    } },
    /* DclGsOutputPrimitiveTopology         */
    { 0, DxbcInstClass::Declaration },
    /* DclGsInputPrimitive                  */
    { 0, DxbcInstClass::Declaration },
    /* DclMaxOutputVertexCount              */
    { 1, DxbcInstClass::Declaration, {
      { DxbcOperandKind::Imm32,  DxbcScalarType::Uint32 },
    } },
    /* DclInput                             */
    { 1, DxbcInstClass::Declaration, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
    } },
    /* DclInputSgv                          */
    { 2, DxbcInstClass::Declaration, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::Imm32,  DxbcScalarType::Uint32  },
    } },
    /* DclInputSiv                          */
    { 2, DxbcInstClass::Declaration, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::Imm32,  DxbcScalarType::Uint32  },
    } },
    /* DclInputPs                           */
    { 1, DxbcInstClass::Declaration, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
    } },
    /* DclInputPsSgv                        */
    { 2, DxbcInstClass::Declaration, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::Imm32,  DxbcScalarType::Uint32  },
    } },
    /* DclInputPsSiv                        */
    { 2, DxbcInstClass::Declaration, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::Imm32,  DxbcScalarType::Uint32  },
    } },
    /* DclOutput                            */
    { 1, DxbcInstClass::Declaration, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
    } },
    /* DclOutputSgv                         */
    { 2, DxbcInstClass::Declaration, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::Imm32,  DxbcScalarType::Uint32  },
    } },
    /* DclOutputSiv                         */
    { 2, DxbcInstClass::Declaration, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::Imm32,  DxbcScalarType::Uint32  },
    } },
    /* DclTemps                             */
    { 1, DxbcInstClass::Declaration, {
      { DxbcOperandKind::Imm32, DxbcScalarType::Uint32 },
    } },
    /* DclIndexableTemp                     */
    { 3, DxbcInstClass::Declaration, {
      { DxbcOperandKind::Imm32, DxbcScalarType::Uint32 },
      { DxbcOperandKind::Imm32, DxbcScalarType::Uint32 },
      { DxbcOperandKind::Imm32, DxbcScalarType::Uint32 },
    } },
    /* DclGlobalFlags                       */
    { 0, DxbcInstClass::Declaration },
    /* Reserved0                            */
    { 0, DxbcInstClass::Undefined },
    /* Lod                                  */
    { 4, DxbcInstClass::TextureQueryLod, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Gather4                              */
    { 4, DxbcInstClass::TextureGather, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* SamplePos                            */
    { 3, DxbcInstClass::TextureQueryMsPos, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32  },
    } },
    /* SampleInfo                           */
    { 2, DxbcInstClass::TextureQueryMs, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Reserved1                            */
    { },
    /* HsDecls                              */
    { 0, DxbcInstClass::HullShaderPhase },
    /* HsControlPointPhase                  */
    { 0, DxbcInstClass::HullShaderPhase },
    /* HsForkPhase                          */
    { 0, DxbcInstClass::HullShaderPhase },
    /* HsJoinPhase                          */
    { 0, DxbcInstClass::HullShaderPhase },
    /* EmitStream                           */
    { 1, DxbcInstClass::GeometryEmit, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32  },
    } },
    /* CutStream                            */
    { 1, DxbcInstClass::GeometryEmit, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32  },
    } },
    /* EmitThenCutStream                    */
    { 1, DxbcInstClass::GeometryEmit, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32  },
    } },
    /* InterfaceCall                        */
    { },
    /* BufInfo                              */
    { 2, DxbcInstClass::BufferQuery, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32  },
    } },
    /* DerivRtxCoarse                       */
    { 2, DxbcInstClass::VectorDeriv, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* DerivRtxFine                         */
    { 2, DxbcInstClass::VectorDeriv, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* DerivRtyCoarse                       */
    { 2, DxbcInstClass::VectorDeriv, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* DerivRtyFine                         */
    { 2, DxbcInstClass::VectorDeriv, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Gather4C                             */
    { 5, DxbcInstClass::TextureGather, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Gather4Po                            */
    { 5, DxbcInstClass::TextureGather, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Gather4PoC                           */
    { 6, DxbcInstClass::TextureGather, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* Rcp                                  */
    { 2, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* F32toF16                             */
    { 2, DxbcInstClass::ConvertFloat16, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* F16toF32                             */
    { 2, DxbcInstClass::ConvertFloat16, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32  },
    } },
    /* UAddc                                */
    { },
    /* USubb                                */
    { },
    /* CountBits                            */
    { 2, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* FirstBitHi                           */
    { 2, DxbcInstClass::BitScan, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* FirstBitLo                           */
    { 2, DxbcInstClass::BitScan, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* FirstBitShi                          */
    { 2, DxbcInstClass::BitScan, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* UBfe                                 */
    { 4, DxbcInstClass::BitExtract, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* IBfe                                 */
    { 4, DxbcInstClass::BitExtract, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
    } },
    /* Bfi                                  */
    { 5, DxbcInstClass::BitInsert, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* BfRev                                */
    { 2, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* Swapc                                */
    { 5, DxbcInstClass::VectorCmov, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* DclStream                            */
    { 1, DxbcInstClass::Declaration, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32  },
    } },
    /* DclFunctionBody                      */
    { },
    /* DclFunctionTable                     */
    { },
    /* DclInterface                         */
    { },
    /* DclInputControlPointCount            */
    { 0, DxbcInstClass::Declaration },
    /* DclOutputControlPointCount           */
    { 0, DxbcInstClass::Declaration },
    /* DclTessDomain                        */
    { 0, DxbcInstClass::Declaration },
    /* DclTessPartitioning                  */
    { 0, DxbcInstClass::Declaration },
    /* DclTessOutputPrimitive               */
    { 0, DxbcInstClass::Declaration },
    /* DclHsMaxTessFactor                   */
    { 1, DxbcInstClass::Declaration, {
      { DxbcOperandKind::Imm32, DxbcScalarType::Float32 },
    } },
    /* DclHsForkPhaseInstanceCount          */
    { 1, DxbcInstClass::HullShaderInstCnt, {
      { DxbcOperandKind::Imm32, DxbcScalarType::Uint32 },
    } },
    /* DclHsJoinPhaseInstanceCount          */
    { 1, DxbcInstClass::HullShaderInstCnt, {
      { DxbcOperandKind::Imm32, DxbcScalarType::Uint32 },
    } },
    /* DclThreadGroup                       */
    { 3, DxbcInstClass::Declaration, {
      { DxbcOperandKind::Imm32, DxbcScalarType::Uint32 },
      { DxbcOperandKind::Imm32, DxbcScalarType::Uint32 },
      { DxbcOperandKind::Imm32, DxbcScalarType::Uint32 },
    } },
    /* DclUavTyped                          */
    { 2, DxbcInstClass::Declaration, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::Imm32,  DxbcScalarType::Uint32  },
    } },
    /* DclUavRaw                            */
    { 1, DxbcInstClass::Declaration, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
    } },
    /* DclUavStructured                     */
    { 2, DxbcInstClass::Declaration, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::Imm32,  DxbcScalarType::Uint32  },
    } },
    /* DclThreadGroupSharedMemoryRaw        */
    { 2, DxbcInstClass::Declaration, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::Imm32,  DxbcScalarType::Uint32  },
    } },
    /* DclThreadGroupSharedMemoryStructured */
    { 3, DxbcInstClass::Declaration, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::Imm32,  DxbcScalarType::Uint32  },
      { DxbcOperandKind::Imm32,  DxbcScalarType::Uint32  },
    } },
    /* DclResourceRaw                       */
    { 1, DxbcInstClass::Declaration, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
    } },
    /* DclResourceStructured                */
    { 2, DxbcInstClass::Declaration, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::Imm32,  DxbcScalarType::Uint32  },
    } },
    /* LdUavTyped                           */
    { 3, DxbcInstClass::TypedUavLoad, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32  },
    } },
    /* StoreUavTyped                        */
    { 3, DxbcInstClass::TypedUavStore, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* LdRaw                                */
    { 3, DxbcInstClass::BufferLoad, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* StoreRaw                             */
    { 3, DxbcInstClass::BufferStore, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* LdStructured                         */
    { 4, DxbcInstClass::BufferLoad, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* StoreStructured                      */
    { 4, DxbcInstClass::BufferStore, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* AtomicAnd                            */
    { 3, DxbcInstClass::Atomic, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* AtomicOr                             */
    { 3, DxbcInstClass::Atomic, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* AtomicXor                            */
    { 3, DxbcInstClass::Atomic, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* AtomicCmpStore                       */
    { 4, DxbcInstClass::Atomic, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* AtomicIAdd                           */
    { 3, DxbcInstClass::Atomic, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* AtomicIMax                           */
    { 3, DxbcInstClass::Atomic, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
    } },
    /* AtomicIMin                           */
    { 3, DxbcInstClass::Atomic, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
    } },
    /* AtomicUMax                           */
    { 3, DxbcInstClass::Atomic, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* AtomicUMin                           */
    { 3, DxbcInstClass::Atomic, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* ImmAtomicAlloc                       */
    { 2, DxbcInstClass::AtomicCounter, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
    } },
    /* ImmAtomicConsume                     */
    { 2, DxbcInstClass::AtomicCounter, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
    } },
    /* ImmAtomicIAdd                        */
    { 4, DxbcInstClass::Atomic, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* ImmAtomicAnd                         */
    { 4, DxbcInstClass::Atomic, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* ImmAtomicOr                          */
    { 4, DxbcInstClass::Atomic, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* ImmAtomicXor                         */
    { 4, DxbcInstClass::Atomic, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* ImmAtomicExch                        */
    { 4, DxbcInstClass::Atomic, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* ImmAtomicCmpExch                     */
    { 5, DxbcInstClass::Atomic, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* ImmAtomicIMax                        */
    { 4, DxbcInstClass::Atomic, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::DstReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
    } },
    /* ImmAtomicIMin                        */
    { 4, DxbcInstClass::Atomic, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::DstReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
    } },
    /* ImmAtomicUMax                        */
    { 4, DxbcInstClass::Atomic, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* ImmAtomicUMin                        */
    { 4, DxbcInstClass::Atomic, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* Sync                                 */
    { 0, DxbcInstClass::Barrier },
    /* DAdd                                 */
    { 3, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float64 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
    } },
    /* DMax                                 */
    { 3, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float64 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
    } },
    /* DMin                                 */
    { 3, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float64 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
    } },
    /* DMul                                 */
    { 3, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float64 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
    } },
    /* DEq                                  */
    { 3, DxbcInstClass::VectorCmp, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
    } },
    /* DGe                                  */
    { 3, DxbcInstClass::VectorCmp, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
    } },
    /* DLt                                  */
    { 3, DxbcInstClass::VectorCmp, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
    } },
    /* DNe                                  */
    { 3, DxbcInstClass::VectorCmp, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
    } },
    /* DMov                                 */
    { 2, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float64 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
    } },
    /* DMovc                                */
    { 4, DxbcInstClass::VectorCmov, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float64 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
    } },
    /* DtoF                                 */
    { 2, DxbcInstClass::ConvertFloat64, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
    } },
    /* FtoD                                 */
    { 2, DxbcInstClass::ConvertFloat64, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float64 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* EvalSnapped                          */
    { 3, DxbcInstClass::Interpolate, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* EvalSampleIndex                      */
    { 3, DxbcInstClass::Interpolate, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32  },
    } },
    /* EvalCentroid                         */
    { 2, DxbcInstClass::Interpolate, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
    } },
    /* DclGsInstanceCount                   */
    { 1, DxbcInstClass::Declaration, {
      { DxbcOperandKind::Imm32, DxbcScalarType::Uint32 },
    } },
    /* Abort                                */
    { },
    /* DebugBreak                           */
    { },
    /* ReservedBegin11_1                    */
    { },
    /* DDiv                                 */
    { 3, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float64 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
    } },
    /* DFma                                 */
    { 4, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float64 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
    } },
    /* DRcp                                 */
    { 2, DxbcInstClass::VectorAlu, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float64 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
    } },
    /* Msad                                 */
    { 4, DxbcInstClass::VectorMsad, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
    } },
    /* DtoI                                 */
    { 2, DxbcInstClass::ConvertFloat64, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Sint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
    } },
    /* DtoU                                 */
    { 2, DxbcInstClass::ConvertFloat64, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Uint32  },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Float64 },
    } },
    /* ItoD                                 */
    { 2, DxbcInstClass::ConvertFloat64, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float64 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Sint32  },
    } },
    /* UtoD                                 */
    { 2, DxbcInstClass::ConvertFloat64, {
      { DxbcOperandKind::DstReg, DxbcScalarType::Float64 },
      { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32  },
    } },
  }};

  DxbcInstFormat dxbcInstructionFormat(DxbcOpcode opcode) {
    const uint32_t idx = static_cast<uint32_t>(opcode);

    return (idx < g_instructionFormats.size())
      ? g_instructionFormats.at(idx)
      : DxbcInstFormat();
  }

}


code:
#pragma once

#include "dxbc_enums.h"

namespace dxvk {

  constexpr size_t DxbcMaxInterfaceRegs = 32;
  constexpr size_t DxbcMaxOperandCount  = 8;

  /**
   * \brief Operand kind
   *
   * In the instruction format definition, this specified
   * whether an operand uses an actual operand token, or
   * whether it is stored as an immediate value.
   */
  enum class DxbcOperandKind {
    DstReg, ///< Destination register
    SrcReg, ///< Source register
    Imm32,  ///< Constant number
  };

  /**
   * \brief Instruction class
   *
   * Instructions with a similar format are grouped into
   * instruction classes in order to make implementing
   * new instructions easier.
   */
  enum class DxbcInstClass {
    Declaration,        ///< Interface or resource declaration
    CustomData,         ///< Immediate constant buffer
    ControlFlow,        ///< Control flow instructions
    GeometryEmit,       ///< Special geometry shader instructions
    Atomic,             ///< Atomic operations
    AtomicCounter,      ///< Atomic counter operations
    Barrier,            ///< Execution or memory barrier
    BitExtract,         ///< Bit field extract operations
    BitInsert,          ///< Bit field insert operations
    BitScan,            ///< Bit scan operations
    BufferQuery,        ///< Buffer query instruction
    BufferLoad,         ///< Structured or raw buffer load
    BufferStore,        ///< Structured or raw buffer store
    ConvertFloat16,     ///< 16-bit float packing/unpacking
    ConvertFloat64,     ///< 64-bit float conversion
    HullShaderPhase,    ///< Hull shader phase declaration
    HullShaderInstCnt,  ///< Hull shader phase instance count
    Interpolate,        ///< Input attribute interpolation
    NoOperation,        ///< The most useful instruction class
    TextureQuery,       ///< Texture query instruction
    TextureQueryLod,    ///< Texture LOD query instruction
    TextureQueryMs,     ///< Multisample texture query
    TextureQueryMsPos,  ///< Sample position query
    TextureFetch,       ///< Texture fetch instruction
    TextureGather,      ///< Texture gather instruction
    TextureSample,      ///< Texture sampling instruction
    TypedUavLoad,       ///< Typed UAV load
    TypedUavStore,      ///< Typed UAV store
    VectorAlu,          ///< Component-wise vector instructions
    VectorCmov,         ///< Component-wise conditional move
    VectorCmp,          ///< Component-wise vector comparison
    VectorDeriv,        ///< Vector derivatives
    VectorDot,          ///< Dot product instruction
    VectorIdiv,         ///< Component-wise integer division
    VectorImul,         ///< Component-wise integer multiplication
    VectorMsad,         ///< Component-wise sum of absolute difference
    VectorShift,        ///< Bit shift operations on vectors
    VectorSinCos,       ///< Sine and Cosine instruction
    Undefined,          ///< Instruction code not defined
  };

  /**
   * \brief Instruction operand format
   *
   * Stores the kind and the expected data type
   * of an operand. Used when parsing instructions.
   */
  struct DxbcInstOperandFormat {
    DxbcOperandKind kind;
    DxbcScalarType  type;
  };

  /**
   * \brief Instruction format
   *
   * Defines the instruction class as well as
   * the format of the insttruction operands.
   */
  struct DxbcInstFormat {
    uint32_t              operandCount      = 0;
    DxbcInstClass         instructionClass  = DxbcInstClass::Undefined;
    DxbcInstOperandFormat operands[DxbcMaxOperandCount];
  };

  /**
   * \brief Retrieves instruction format info
   *
   * \param [in] opcode The opcode to retrieve
   * \returns Instruction format info
   */
  DxbcInstFormat dxbcInstructionFormat(DxbcOpcode opcode);

}

repo_name: orochi/dxvk


code:
#pragma once

#include "dxbc_include.h"

namespace dxvk {

  /**
   * \brief Instruction code listing
   */
  enum class DxbcOpcode : uint32_t {
    Add                                  = 0,
    And                                  = 1,
    Break                                = 2,
    Breakc                               = 3,
    Call                                 = 4,
    Callc                                = 5,
    Case                                 = 6,
    Continue                             = 7,
    Continuec                            = 8,
    Cut                                  = 9,
    Default                              = 10,
    DerivRtx                             = 11,
    DerivRty                             = 12,
    Discard                              = 13,
    Div                                  = 14,
    Dp2                                  = 15,
    Dp3                                  = 16,
    Dp4                                  = 17,
    Else                                 = 18,
    Emit                                 = 19,
    EmitThenCut                          = 20,
    EndIf                                = 21,
    EndLoop                              = 22,
    EndSwitch                            = 23,
    Eq                                   = 24,
    Exp                                  = 25,
    Frc                                  = 26,
    FtoI                                 = 27,
    FtoU                                 = 28,
    Ge                                   = 29,
    IAdd                                 = 30,
    If                                   = 31,
    IEq                                  = 32,
    IGe                                  = 33,
    ILt                                  = 34,
    IMad                                 = 35,
    IMax                                 = 36,
    IMin                                 = 37,
    IMul                                 = 38,
    INe                                  = 39,
    INeg                                 = 40,
    IShl                                 = 41,
    IShr                                 = 42,
    ItoF                                 = 43,
    Label                                = 44,
    Ld                                   = 45,
    LdMs                                 = 46,
    Log                                  = 47,
    Loop                                 = 48,
    Lt                                   = 49,
    Mad                                  = 50,
    Min                                  = 51,
    Max                                  = 52,
    CustomData                           = 53,
    Mov                                  = 54,
    Movc                                 = 55,
    Mul                                  = 56,
    Ne                                   = 57,
    Nop                                  = 58,
    Not                                  = 59,
    Or                                   = 60,
    ResInfo                              = 61,
    Ret                                  = 62,
    Retc                                 = 63,
    RoundNe                              = 64,
    RoundNi                              = 65,
    RoundPi                              = 66,
    RoundZ                               = 67,
    Rsq                                  = 68,
    Sample                               = 69,
    SampleC                              = 70,
    SampleClz                            = 71,
    SampleL                              = 72,
    SampleD                              = 73,
    SampleB                              = 74,
    Sqrt                                 = 75,
    Switch                               = 76,
    SinCos                               = 77,
    UDiv                                 = 78,
    ULt                                  = 79,
    UGe                                  = 80,
    UMul                                 = 81,
    UMad                                 = 82,
    UMax                                 = 83,
    UMin                                 = 84,
    UShr                                 = 85,
    UtoF                                 = 86,
    Xor                                  = 87,
    DclResource                          = 88,
    DclConstantBuffer                    = 89,
    DclSampler                           = 90,
    DclIndexRange                        = 91,
    DclGsOutputPrimitiveTopology         = 92,
    DclGsInputPrimitive                  = 93,
    DclMaxOutputVertexCount              = 94,
    DclInput                             = 95,
    DclInputSgv                          = 96,
    DclInputSiv                          = 97,
    DclInputPs                           = 98,
    DclInputPsSgv                        = 99,
    DclInputPsSiv                        = 100,
    DclOutput                            = 101,
    DclOutputSgv                         = 102,
    DclOutputSiv                         = 103,
    DclTemps                             = 104,
    DclIndexableTemp                     = 105,
    DclGlobalFlags                       = 106,
    Reserved0                            = 107,
    Lod                                  = 108,
    Gather4                              = 109,
    SamplePos                            = 110,
    SampleInfo                           = 111,
    Reserved1                            = 112,
    HsDecls                              = 113,
    HsControlPointPhase                  = 114,
    HsForkPhase                          = 115,
    HsJoinPhase                          = 116,
    EmitStream                           = 117,
    CutStream                            = 118,
    EmitThenCutStream                    = 119,
    InterfaceCall                        = 120,
    BufInfo                              = 121,
    DerivRtxCoarse                       = 122,
    DerivRtxFine                         = 123,
    DerivRtyCoarse                       = 124,
    DerivRtyFine                         = 125,
    Gather4C                             = 126,
    Gather4Po                            = 127,
    Gather4PoC                           = 128,
    Rcp                                  = 129,
    F32toF16                             = 130,
    F16toF32                             = 131,
    UAddc                                = 132,
    USubb                                = 133,
    CountBits                            = 134,
    FirstBitHi                           = 135,
    FirstBitLo                           = 136,
    FirstBitShi                          = 137,
    UBfe                                 = 138,
    IBfe                                 = 139,
    Bfi                                  = 140,
    BfRev                                = 141,
    Swapc                                = 142,
    DclStream                            = 143,
    DclFunctionBody                      = 144,
    DclFunctionTable                     = 145,
    DclInterface                         = 146,
    DclInputControlPointCount            = 147,
    DclOutputControlPointCount           = 148,
    DclTessDomain                        = 149,
    DclTessPartitioning                  = 150,
    DclTessOutputPrimitive               = 151,
    DclHsMaxTessFactor                   = 152,
    DclHsForkPhaseInstanceCount          = 153,
    DclHsJoinPhaseInstanceCount          = 154,
    DclThreadGroup                       = 155,
    DclUavTyped                          = 156,
    DclUavRaw                            = 157,
    DclUavStructured                     = 158,
    DclThreadGroupSharedMemoryRaw        = 159,
    DclThreadGroupSharedMemoryStructured = 160,
    DclResourceRaw                       = 161,
    DclResourceStructured                = 162,
    LdUavTyped                           = 163,
    StoreUavTyped                        = 164,
    LdRaw                                = 165,
    StoreRaw                             = 166,
    LdStructured                         = 167,
    StoreStructured                      = 168,
    AtomicAnd                            = 169,
    AtomicOr                             = 170,
    AtomicXor                            = 171,
    AtomicCmpStore                       = 172,
    AtomicIAdd                           = 173,
    AtomicIMax                           = 174,
    AtomicIMin                           = 175,
    AtomicUMax                           = 176,
    AtomicUMin                           = 177,
    ImmAtomicAlloc                       = 178,
    ImmAtomicConsume                     = 179,
    ImmAtomicIAdd                        = 180,
    ImmAtomicAnd                         = 181,
    ImmAtomicOr                          = 182,
    ImmAtomicXor                         = 183,
    ImmAtomicExch                        = 184,
    ImmAtomicCmpExch                     = 185,
    ImmAtomicIMax                        = 186,
    ImmAtomicIMin                        = 187,
    ImmAtomicUMax                        = 188,
    ImmAtomicUMin                        = 189,
    Sync                                 = 190,
    DAdd                                 = 191,
    DMax                                 = 192,
    DMin                                 = 193,
    DMul                                 = 194,
    DEq                                  = 195,
    DGe                                  = 196,
    DLt                                  = 197,
    DNe                                  = 198,
    DMov                                 = 199,
    DMovc                                = 200,
    DtoF                                 = 201,
    FtoD                                 = 202,
    EvalSnapped                          = 203,
    EvalSampleIndex                      = 204,
    EvalCentroid                         = 205,
    DclGsInstanceCount                   = 206,
    Abort                                = 207,
    DebugBreak                           = 208,
    ReservedBegin11_1                    = 209,
    DDiv                                 = 210,
    DFma                                 = 211,
    DRcp                                 = 212,
    Msad                                 = 213,
    DtoI                                 = 214,
    DtoU                                 = 215,
    ItoD                                 = 216,
    UtoD                                 = 217,
  };

  /**
   * \brief Extended opcode
   */
  enum class DxbcExtOpcode : uint32_t {
    Empty                                = 0,
    SampleControls                       = 1,
    ResourceDim                          = 2,
    ResourceReturnType                   = 3,
  };

  /**
   * \brief Operand type
   *
   * Selects the 'register file' from which
   * to retrieve an operand's value.
   */
  enum class DxbcOperandType : uint32_t {
    Temp                    = 0,
    Input                   = 1,
    Output                  = 2,
    IndexableTemp           = 3,
    Imm32                   = 4,
    Imm64                   = 5,
    Sampler                 = 6,
    Resource                = 7,
    ConstantBuffer          = 8,
    ImmediateConstantBuffer = 9,
    Label                   = 10,
    InputPrimitiveId        = 11,
    OutputDepth             = 12,
    Null                    = 13,
    Rasterizer              = 14,
    OutputCoverageMask      = 15,
    Stream                  = 16,
    FunctionBody            = 17,
    FunctionTable           = 18,
    Interface               = 19,
    FunctionInput           = 20,
    FunctionOutput          = 21,
    OutputControlPointId    = 22,
    InputForkInstanceId     = 23,
    InputJoinInstanceId     = 24,
    InputControlPoint       = 25,
    OutputControlPoint      = 26,
    InputPatchConstant      = 27,
    InputDomainPoint        = 28,
    ThisPointer             = 29,
    UnorderedAccessView     = 30,
    ThreadGroupSharedMemory = 31,
    InputThreadId           = 32,
    InputThreadGroupId      = 33,
    InputThreadIdInGroup    = 34,
    InputCoverageMask       = 35,
    InputThreadIndexInGroup = 36,
    InputGsInstanceId       = 37,
    OutputDepthGe           = 38,
    OutputDepthLe           = 39,
    CycleCounter            = 40,
    OutputStencilRef        = 41,
  };

  /**
   * \brief Number of components
   *
   * Used by operands to determine whether the
   * operand has one, four or zero components.
   */
  enum class DxbcComponentCount : uint32_t {
    Component0 = 0,
    Component1 = 1,
    Component4 = 2,
  };

  /**
   * \brief Component selection mode
   *
   * When an operand has four components, the
   * component selection mode deterines which
   * components are used for the operation.
   */
  enum class DxbcRegMode : uint32_t {
    Mask    = 0,
    Swizzle = 1,
    Select1 = 2,
  };

  /**
   * \brief Index representation
   *
   * Determines how an operand
   * register index is stored.
   */
  enum class DxbcOperandIndexRepresentation : uint32_t {
    Imm32             = 0,
    Imm64             = 1,
    Relative          = 2,
    Imm32Relative     = 3,
    Imm64Relative     = 4,
  };

  /**
   * \brief Extended operand type
   */
  enum class DxbcOperandExt : uint32_t {
    OperandModifier   = 1,
  };

  /**
   * \brief Resource dimension
   * The type of a resource.
   */
  enum class DxbcResourceDim : uint32_t {
    Unknown           = 0,
    Buffer            = 1,
    Texture1D         = 2,
    Texture2D         = 3,
    Texture2DMs       = 4,
    Texture3D         = 5,
    TextureCube       = 6,
    Texture1DArr      = 7,
    Texture2DArr      = 8,
    Texture2DMsArr    = 9,
    TextureCubeArr    = 10,
    RawBuffer         = 11,
    StructuredBuffer  = 12,
  };

  /**
   * \brief Resource return type
   * Data type for resource read ops.
   */
  enum class DxbcResourceReturnType : uint32_t {
    Unorm             = 1,
    Snorm             = 2,
    Sint              = 3,
    Uint              = 4,
    Float             = 5,
    Mixed             = 6,  /// ?
    Double            = 7,
    Continued         = 8,  /// ?
    Unused            = 9,  /// ?
  };

  /**
   * \brief Register component type
   * Data type of a register component.
   */
  enum class DxbcRegisterComponentType : uint32_t {
    Unknown           = 0,
    Uint32            = 1,
    Sint32            = 2,
    Float32           = 3,
  };

  /**
   * \brief Instruction return type
   */
  enum class DxbcInstructionReturnType : uint32_t {
    Float             = 0,
    Uint              = 1,
  };

  enum class DxbcSystemValue : uint32_t {
    None                          = 0,
    Position                      = 1,
    ClipDistance                  = 2,
    CullDistance                  = 3,
    RenderTargetId                = 4,
    ViewportId                    = 5,
    VertexId                      = 6,
    PrimitiveId                   = 7,
    InstanceId                    = 8,
    IsFrontFace                   = 9,
    SampleIndex                   = 10,
    FinalQuadUeq0EdgeTessFactor   = 11,
    FinalQuadVeq0EdgeTessFactor   = 12,
    FinalQuadUeq1EdgeTessFactor   = 13,
    FinalQuadVeq1EdgeTessFactor   = 14,
    FinalQuadUInsideTessFactor    = 15,
    FinalQuadVInsideTessFactor    = 16,
    FinalTriUeq0EdgeTessFactor    = 17,
    FinalTriVeq0EdgeTessFactor    = 18,
    FinalTriWeq0EdgeTessFactor    = 19,
    FinalTriInsideTessFactor      = 20,
    FinalLineDetailTessFactor     = 21,
    FinalLineDensityTessFactor    = 22,
    Target                        = 64,
    Depth                         = 65,
    Coverage                      = 66,
    DepthGe                       = 67,
    DepthLe                       = 68
  };

  enum class DxbcInterpolationMode : uint32_t {
    Undefined                   = 0,
    Constant                    = 1,
    Linear                      = 2,
    LinearCentroid              = 3,
    LinearNoPerspective         = 4,
    LinearNoPerspectiveCentroid = 5,
    LinearSample                = 6,
    LinearNoPerspectiveSample   = 7,
  };

  enum class DxbcGlobalFlag : uint32_t {
    RefactoringAllowed    = 0,
    DoublePrecision       = 1,
    EarlyFragmentTests    = 2,
    RawStructuredBuffers  = 3,
  };

  using DxbcGlobalFlags = Flags<DxbcGlobalFlag>;

  enum class DxbcZeroTest : uint32_t {
    TestZ   = 0,
    TestNz  = 1,
  };

  enum class DxbcResinfoType : uint32_t {
    Float     = 0,
    RcpFloat  = 1,
    Uint      = 2,
  };

  enum class DxbcSyncFlag : uint32_t {
    ThreadsInGroup                = 0,
    ThreadGroupSharedMemory       = 1,
    UavMemoryGroup                = 2,
    UavMemoryGlobal               = 3,
  };

  using DxbcSyncFlags = Flags<DxbcSyncFlag>;

  /**
   * \brief Geometry shader input primitive
   */
  enum class DxbcPrimitive : uint32_t {
    Undefined         =  0,
    Point             =  1,
    Line              =  2,
    Triangle          =  3,
    LineAdj           =  6,
    TriangleAdj       =  7,
    Patch1            =  8,
    Patch2            =  9,
    Patch3            = 10,
    Patch4            = 11,
    Patch5            = 12,
    Patch6            = 13,
    Patch7            = 14,
    Patch8            = 15,
    Patch9            = 16,
    Patch10           = 17,
    Patch11           = 18,
    Patch12           = 19,
    Patch13           = 20,
    Patch14           = 21,
    Patch15           = 22,
    Patch16           = 23,
    Patch17           = 24,
    Patch18           = 25,
    Patch19           = 26,
    Patch20           = 27,
    Patch21           = 28,
    Patch22           = 29,
    Patch23           = 30,
    Patch24           = 31,
    Patch25           = 32,
    Patch26           = 33,
    Patch27           = 34,
    Patch28           = 35,
    Patch29           = 36,
    Patch30           = 37,
    Patch31           = 38,
    Patch32           = 39,
  };

  /**
   * \brief Geometry shader output topology
   */
  enum class DxbcPrimitiveTopology : uint32_t {
    Undefined         = 0,
    PointList         = 1,
    LineList          = 2,
    LineStrip         = 3,
    TriangleList      = 4,
    TriangleStrip     = 5,
    LineListAdj       = 10,
    LineStripAdj      = 11,
    TriangleListAdj   = 12,
    TriangleStripAdj  = 13,
  };

  /**
   * \brief Sampler operation mode
   */
  enum class DxbcSamplerMode : uint32_t {
    Default           = 0,
    Comparison        = 1,
    Mono              = 2,
  };

  /**
   * \brief Scalar value type
   *
   * Enumerates possible register component
   * types. Scalar types are represented as
   * a one-component vector type.
   */
  enum class DxbcScalarType : uint32_t {
    Uint32    = 0,
    Uint64    = 1,
    Sint32    = 2,
    Sint64    = 3,
    Float32   = 4,
    Float64   = 5,
    Bool      = 6,
  };

  /**
   * \brief Tessellator domain
   */
  enum class DxbcTessDomain : uint32_t {
    Undefined     = 0,
    Isolines      = 1,
    Triangles     = 2,
    Quads         = 3,
  };

  /**
   * \brief Tessellator partitioning
   */
  enum class DxbcTessPartitioning : uint32_t {
    Undefined     = 0,
    Integer       = 1,
    Pow2          = 2,
    FractOdd      = 3,
    FractEven     = 4,
  };

  /**
   * \brief UAV definition flags
   */
  enum class DxbcUavFlag : uint32_t {
    GloballyCoherent = 0,
  };

  using DxbcUavFlags = Flags<DxbcUavFlag>;

  /**
   * \brief Tessellator output primitive
   */
  enum class DxbcTessOutputPrimitive : uint32_t {
    Undefined     = 0,
    Point         = 1,
    Line          = 2,
    TriangleCw    = 3,
    TriangleCcw   = 4,
  };

  /**
   * \brief Custom data class
   *
   * Stores which type of custom data is
   * referenced by the instruction.
   */
  enum class DxbcCustomDataClass : uint32_t {
    Comment       = 0,
    DebugInfo     = 1,
    Opaque        = 2,
    ImmConstBuf   = 3,
  };

  enum class DxbcResourceType : uint32_t {
    Typed      = 0,
    Raw        = 1,
    Structured = 2,
  };

  enum class DxbcConstantBufferAccessType : uint32_t {
    StaticallyIndexed = 0,
    DynamicallyIndexed = 1,
  };

}


code:
#include "dxbc_header.h"

namespace dxvk {

  DxbcHeader::DxbcHeader(DxbcReader& reader) {
    // FourCC at the start of the file, must be 'DXBC'
    DxbcTag fourcc = reader.readTag();

    if (fourcc != "DXBC")
      throw DxvkError("DxbcHeader::DxbcHeader: Invalid fourcc, expected 'DXBC'");

    // Stuff we don't actually need to store
    reader.skip(4 * sizeof(uint32_t)); // Check sum
    reader.skip(1 * sizeof(uint32_t)); // Constant 1
    reader.skip(1 * sizeof(uint32_t)); // Bytecode length

    // Number of chunks in the file
    uint32_t chunkCount = reader.readu32();

    // Chunk offsets are stored immediately after
    for (uint32_t i = 0; i < chunkCount; i++)
      m_chunkOffsets.push_back(reader.readu32());
  }

  DxbcHeader::~DxbcHeader() {

  }

}


code:
#pragma once

#include <vector>

#include "dxbc_reader.h"

namespace dxvk {

  /**
   * \brief DXBC header
   *
   * Stores information about the shader file itself
   * and the data chunks stored inside the file.
   */
  class DxbcHeader {

  public:

    DxbcHeader(DxbcReader& reader);
    ~DxbcHeader();

    /**
     * \brief Number of chunks
     * \returns Chunk count
     */
    uint32_t numChunks() const {
      return m_chunkOffsets.size();
    }

    /**
     * \brief Chunk offset
     *
     * Retrieves the offset of a chunk, in
     * bytes, from the start of the file.
     * \param [in] chunkId Chunk index
     * \returns Byte offset of that chunk
     */
    uint32_t chunkOffset(uint32_t chunkId) const {
      return m_chunkOffsets.at(chunkId);
    }

  private:

    std::vector<uint32_t> m_chunkOffsets;

  };

}


code:
#pragma once

#include "../dxvk/dxvk_shader.h"

#include "../util/com/com_guid.h"
#include "../util/com/com_object.h"
#include "../util/com/com_pointer.h"

#include "../util/log/log.h"
#include "../util/log/log_debug.h"

#include "../util/rc/util_rc.h"
#include "../util/rc/util_rc_ptr.h"

#include "../util/util_bit.h"
#include "../util/util_enum.h"
#include "../util/util_error.h"
#include "../util/util_string.h"


code:
#pragma once

#include "dxbc_options.h"

namespace dxvk {

  /**
   * \brief Tessellation info
   *
   * Stores the maximum tessellation factor
   * to export from tessellation shaders.
   */
  struct DxbcTessInfo {
    float maxTessFactor;
  };

  /**
   * \brief Xfb capture entry
   *
   * Stores an output variable to capture,
   * as well as the buffer to write it to.
   */
  struct DxbcXfbEntry {
    const char* semanticName;
    uint32_t    semanticIndex;
    uint32_t    componentIndex;
    uint32_t    componentCount;
    uint32_t    streamId;
    uint32_t    bufferId;
    uint32_t    offset;
  };

  /**
   * \brief Xfb info
   *
   * Stores capture entries and output buffer
   * strides. This structure must only be
   * defined if \c entryCount is non-zero.
   */
  struct DxbcXfbInfo {
    uint32_t      entryCount;
    DxbcXfbEntry  entries[128];
    uint32_t      strides[4];
    int32_t       rasterizedStream;
  };

  /**
   * \brief Shader module info
   *
   * Stores information which may affect shader compilation.
   * This data can be supplied by the client API implementation.
   */
  struct DxbcModuleInfo {
    DxbcOptions   options;
    DxbcTessInfo* tess;
    DxbcXfbInfo*  xfb;
  };

}


code:
#include "dxbc_analysis.h"
#include "dxbc_compiler.h"
#include "dxbc_module.h"

namespace dxvk {

  DxbcModule::DxbcModule(DxbcReader& reader)
  : m_header(reader) {
    for (uint32_t i = 0; i < m_header.numChunks(); i++) {

      // The chunk tag is stored at the beginning of each chunk
      auto chunkReader = reader.clone(m_header.chunkOffset(i));
      auto tag         = chunkReader.readTag();

      // The chunk size follows right after the four-character
      // code. This does not include the eight bytes that are
      // consumed by the FourCC and chunk length entry.
      auto chunkLength = chunkReader.readu32();

      chunkReader = chunkReader.clone(8);
      chunkReader = chunkReader.resize(chunkLength);

      if ((tag == "SHDR") || (tag == "SHEX"))
        m_shexChunk = new DxbcShex(chunkReader);

      if ((tag == "ISGN") || (tag == "ISG1"))
        m_isgnChunk = new DxbcIsgn(chunkReader, tag);

      if ((tag == "OSGN") || (tag == "OSG5") || (tag == "OSG1"))
        m_osgnChunk = new DxbcIsgn(chunkReader, tag);

      if ((tag == "PCSG") || (tag == "PSG1"))
        m_psgnChunk = new DxbcIsgn(chunkReader, tag);
    }
  }

  DxbcModule::~DxbcModule() {

  }

  Rc<DxvkShader> DxbcModule::compile(
    const DxbcModuleInfo& moduleInfo,
    const std::string&    fileName) const {
    if (m_shexChunk == nullptr)
      throw DxvkError("DxbcModule::compile: No SHDR/SHEX chunk");

    DxbcAnalysisInfo analysisInfo;

    DxbcAnalyzer analyzer(moduleInfo,
      m_shexChunk->programInfo(),
      m_isgnChunk, m_osgnChunk,
      m_psgnChunk, analysisInfo);

    this->runAnalyzer(analyzer, m_shexChunk->slice());

    DxbcCompiler compiler(
      fileName, moduleInfo,
      m_shexChunk->programInfo(),
      m_isgnChunk, m_osgnChunk,
      m_psgnChunk, analysisInfo);

    this->runCompiler(compiler, m_shexChunk->slice());

    return compiler.finalize();
  }

  Rc<DxvkShader> DxbcModule::compilePassthroughShader(
    const DxbcModuleInfo& moduleInfo,
    const std::string&    fileName) const {
    if (m_shexChunk == nullptr)
      throw DxvkError("DxbcModule::compile: No SHDR/SHEX chunk");

    DxbcAnalysisInfo analysisInfo;

    DxbcCompiler compiler(
      fileName, moduleInfo,
      DxbcProgramType::GeometryShader,
      m_osgnChunk, m_osgnChunk,
      m_psgnChunk, analysisInfo);

    compiler.processXfbPassthrough();
    return compiler.finalize();
  }

  void DxbcModule::runAnalyzer(
          DxbcAnalyzer&       analyzer,
          DxbcCodeSlice       slice) const {
    DxbcDecodeContext decoder;

    while (!slice.atEnd()) {
      decoder.decodeInstruction(slice);

      analyzer.processInstruction(
        decoder.getInstruction());
    }
  }

  void DxbcModule::runCompiler(
          DxbcCompiler&       compiler,
          DxbcCodeSlice       slice) const {
    DxbcDecodeContext decoder;

    while (!slice.atEnd()) {
      decoder.decodeInstruction(slice);

      compiler.processInstruction(
        decoder.getInstruction());
    }
  }

}


code:
#pragma once

#include "../dxvk/dxvk_shader.h"

#include "dxbc_chunk_isgn.h"
#include "dxbc_chunk_shex.h"
#include "dxbc_header.h"
#include "dxbc_modinfo.h"
#include "dxbc_reader.h"

// References used for figuring out DXBC:
// - https://github.com/tgjones/slimshader-cpp
// - Wine

namespace dxvk {

  class DxbcAnalyzer;
  class DxbcCompiler;

  /**
   * \brief DXBC shader module
   *
   * Reads the DXBC byte code and extracts information
   * about the resource bindings and the instruction
   * stream. A module can then be compiled to SPIR-V.
   */
  class DxbcModule {

  public:

    DxbcModule(DxbcReader& reader);
    ~DxbcModule();

    /**
     * \brief Shader type
     * \returns Shader type
     */
    DxbcProgramInfo programInfo() const {
      return m_shexChunk->programInfo();
    }

    /**
     * \brief Input and output signature chunks
     *
     * Parts of the D3D11 API need access to the
     * input or output signature of the shader.
     */
    Rc<DxbcIsgn> isgn() const { return m_isgnChunk; }
    Rc<DxbcIsgn> osgn() const { return m_osgnChunk; }

    /**
     * \brief Compiles DXBC shader to SPIR-V module
     *
     * \param [in] moduleInfo DXBC module info
     * \param [in] fileName File name, will be added to
     *        the compiled SPIR-V for debugging purposes.
     * \returns The compiled shader object
     */
    Rc<DxvkShader> compile(
      const DxbcModuleInfo& moduleInfo,
      const std::string&    fileName) const;

    /**
     * \brief Compiles a pass-through geometry shader
     *
     * Applications can pass a vertex shader to create
     * a geometry shader with stream output. In this
     * case, we have to create a passthrough geometry
     * shader, which operates in point to point mode.
     * \param [in] moduleInfo DXBC module info
     * \param [in] fileName SPIR-V shader name
     */
    Rc<DxvkShader> compilePassthroughShader(
      const DxbcModuleInfo& moduleInfo,
      const std::string&    fileName) const;

  private:

    DxbcHeader   m_header;

    Rc<DxbcIsgn> m_isgnChunk;
    Rc<DxbcIsgn> m_osgnChunk;
    Rc<DxbcIsgn> m_psgnChunk;
    Rc<DxbcShex> m_shexChunk;

    void runAnalyzer(
            DxbcAnalyzer&       analyzer,
            DxbcCodeSlice       slice) const;

    void runCompiler(
            DxbcCompiler&       compiler,
            DxbcCodeSlice       slice) const;

  };

}


code:
#include "dxbc_names.h"

namespace dxvk {

  std::ostream& operator << (std::ostream& os, DxbcOpcode e) {
    switch (e) {
      ENUM_NAME(DxbcOpcode::Add);
      ENUM_NAME(DxbcOpcode::And);
      ENUM_NAME(DxbcOpcode::Break);
      ENUM_NAME(DxbcOpcode::Breakc);
      ENUM_NAME(DxbcOpcode::Call);
      ENUM_NAME(DxbcOpcode::Callc);
      ENUM_NAME(DxbcOpcode::Case);
      ENUM_NAME(DxbcOpcode::Continue);
      ENUM_NAME(DxbcOpcode::Continuec);
      ENUM_NAME(DxbcOpcode::Cut);
      ENUM_NAME(DxbcOpcode::Default);
      ENUM_NAME(DxbcOpcode::DerivRtx);
      ENUM_NAME(DxbcOpcode::DerivRty);
      ENUM_NAME(DxbcOpcode::Discard);
      ENUM_NAME(DxbcOpcode::Div);
      ENUM_NAME(DxbcOpcode::Dp2);
      ENUM_NAME(DxbcOpcode::Dp3);
      ENUM_NAME(DxbcOpcode::Dp4);
      ENUM_NAME(DxbcOpcode::Else);
      ENUM_NAME(DxbcOpcode::Emit);
      ENUM_NAME(DxbcOpcode::EmitThenCut);
      ENUM_NAME(DxbcOpcode::EndIf);
      ENUM_NAME(DxbcOpcode::EndLoop);
      ENUM_NAME(DxbcOpcode::EndSwitch);
      ENUM_NAME(DxbcOpcode::Eq);
      ENUM_NAME(DxbcOpcode::Exp);
      ENUM_NAME(DxbcOpcode::Frc);
      ENUM_NAME(DxbcOpcode::FtoI);
      ENUM_NAME(DxbcOpcode::FtoU);
      ENUM_NAME(DxbcOpcode::Ge);
      ENUM_NAME(DxbcOpcode::IAdd);
      ENUM_NAME(DxbcOpcode::If);
      ENUM_NAME(DxbcOpcode::IEq);
      ENUM_NAME(DxbcOpcode::IGe);
      ENUM_NAME(DxbcOpcode::ILt);
      ENUM_NAME(DxbcOpcode::IMad);
      ENUM_NAME(DxbcOpcode::IMax);
      ENUM_NAME(DxbcOpcode::IMin);
      ENUM_NAME(DxbcOpcode::IMul);
      ENUM_NAME(DxbcOpcode::INe);
      ENUM_NAME(DxbcOpcode::INeg);
      ENUM_NAME(DxbcOpcode::IShl);
      ENUM_NAME(DxbcOpcode::IShr);
      ENUM_NAME(DxbcOpcode::ItoF);
      ENUM_NAME(DxbcOpcode::Label);
      ENUM_NAME(DxbcOpcode::Ld);
      ENUM_NAME(DxbcOpcode::LdMs);
      ENUM_NAME(DxbcOpcode::Log);
      ENUM_NAME(DxbcOpcode::Loop);
      ENUM_NAME(DxbcOpcode::Lt);
      ENUM_NAME(DxbcOpcode::Mad);
      ENUM_NAME(DxbcOpcode::Min);
      ENUM_NAME(DxbcOpcode::Max);
      ENUM_NAME(DxbcOpcode::CustomData);
      ENUM_NAME(DxbcOpcode::Mov);
      ENUM_NAME(DxbcOpcode::Movc);
      ENUM_NAME(DxbcOpcode::Mul);
      ENUM_NAME(DxbcOpcode::Ne);
      ENUM_NAME(DxbcOpcode::Nop);
      ENUM_NAME(DxbcOpcode::Not);
      ENUM_NAME(DxbcOpcode::Or);
      ENUM_NAME(DxbcOpcode::ResInfo);
      ENUM_NAME(DxbcOpcode::Ret);
      ENUM_NAME(DxbcOpcode::Retc);
      ENUM_NAME(DxbcOpcode::RoundNe);
      ENUM_NAME(DxbcOpcode::RoundNi);
      ENUM_NAME(DxbcOpcode::RoundPi);
      ENUM_NAME(DxbcOpcode::RoundZ);
      ENUM_NAME(DxbcOpcode::Rsq);
      ENUM_NAME(DxbcOpcode::Sample);
      ENUM_NAME(DxbcOpcode::SampleC);
      ENUM_NAME(DxbcOpcode::SampleClz);
      ENUM_NAME(DxbcOpcode::SampleL);
      ENUM_NAME(DxbcOpcode::SampleD);
      ENUM_NAME(DxbcOpcode::SampleB);
      ENUM_NAME(DxbcOpcode::Sqrt);
      ENUM_NAME(DxbcOpcode::Switch);
      ENUM_NAME(DxbcOpcode::SinCos);
      ENUM_NAME(DxbcOpcode::UDiv);
      ENUM_NAME(DxbcOpcode::ULt);
      ENUM_NAME(DxbcOpcode::UGe);
      ENUM_NAME(DxbcOpcode::UMul);
      ENUM_NAME(DxbcOpcode::UMad);
      ENUM_NAME(DxbcOpcode::UMax);
      ENUM_NAME(DxbcOpcode::UMin);
      ENUM_NAME(DxbcOpcode::UShr);
      ENUM_NAME(DxbcOpcode::UtoF);
      ENUM_NAME(DxbcOpcode::Xor);
      ENUM_NAME(DxbcOpcode::DclResource);
      ENUM_NAME(DxbcOpcode::DclConstantBuffer);
      ENUM_NAME(DxbcOpcode::DclSampler);
      ENUM_NAME(DxbcOpcode::DclIndexRange);
      ENUM_NAME(DxbcOpcode::DclGsOutputPrimitiveTopology);
      ENUM_NAME(DxbcOpcode::DclGsInputPrimitive);
      ENUM_NAME(DxbcOpcode::DclMaxOutputVertexCount);
      ENUM_NAME(DxbcOpcode::DclInput);
      ENUM_NAME(DxbcOpcode::DclInputSgv);
      ENUM_NAME(DxbcOpcode::DclInputSiv);
      ENUM_NAME(DxbcOpcode::DclInputPs);
      ENUM_NAME(DxbcOpcode::DclInputPsSgv);
      ENUM_NAME(DxbcOpcode::DclInputPsSiv);
      ENUM_NAME(DxbcOpcode::DclOutput);
      ENUM_NAME(DxbcOpcode::DclOutputSgv);
      ENUM_NAME(DxbcOpcode::DclOutputSiv);
      ENUM_NAME(DxbcOpcode::DclTemps);
      ENUM_NAME(DxbcOpcode::DclIndexableTemp);
      ENUM_NAME(DxbcOpcode::DclGlobalFlags);
      ENUM_NAME(DxbcOpcode::Reserved0);
      ENUM_NAME(DxbcOpcode::Lod);
      ENUM_NAME(DxbcOpcode::Gather4);
      ENUM_NAME(DxbcOpcode::SamplePos);
      ENUM_NAME(DxbcOpcode::SampleInfo);
      ENUM_NAME(DxbcOpcode::Reserved1);
      ENUM_NAME(DxbcOpcode::HsDecls);
      ENUM_NAME(DxbcOpcode::HsControlPointPhase);
      ENUM_NAME(DxbcOpcode::HsForkPhase);
      ENUM_NAME(DxbcOpcode::HsJoinPhase);
      ENUM_NAME(DxbcOpcode::EmitStream);
      ENUM_NAME(DxbcOpcode::CutStream);
      ENUM_NAME(DxbcOpcode::EmitThenCutStream);
      ENUM_NAME(DxbcOpcode::InterfaceCall);
      ENUM_NAME(DxbcOpcode::BufInfo);
      ENUM_NAME(DxbcOpcode::DerivRtxCoarse);
      ENUM_NAME(DxbcOpcode::DerivRtxFine);
      ENUM_NAME(DxbcOpcode::DerivRtyCoarse);
      ENUM_NAME(DxbcOpcode::DerivRtyFine);
      ENUM_NAME(DxbcOpcode::Gather4C);
      ENUM_NAME(DxbcOpcode::Gather4Po);
      ENUM_NAME(DxbcOpcode::Gather4PoC);
      ENUM_NAME(DxbcOpcode::Rcp);
      ENUM_NAME(DxbcOpcode::F32toF16);
      ENUM_NAME(DxbcOpcode::F16toF32);
      ENUM_NAME(DxbcOpcode::UAddc);
      ENUM_NAME(DxbcOpcode::USubb);
      ENUM_NAME(DxbcOpcode::CountBits);
      ENUM_NAME(DxbcOpcode::FirstBitHi);
      ENUM_NAME(DxbcOpcode::FirstBitLo);
      ENUM_NAME(DxbcOpcode::FirstBitShi);
      ENUM_NAME(DxbcOpcode::UBfe);
      ENUM_NAME(DxbcOpcode::IBfe);
      ENUM_NAME(DxbcOpcode::Bfi);
      ENUM_NAME(DxbcOpcode::BfRev);
      ENUM_NAME(DxbcOpcode::Swapc);
      ENUM_NAME(DxbcOpcode::DclStream);
      ENUM_NAME(DxbcOpcode::DclFunctionBody);
      ENUM_NAME(DxbcOpcode::DclFunctionTable);
      ENUM_NAME(DxbcOpcode::DclInterface);
      ENUM_NAME(DxbcOpcode::DclInputControlPointCount);
      ENUM_NAME(DxbcOpcode::DclOutputControlPointCount);
      ENUM_NAME(DxbcOpcode::DclTessDomain);
      ENUM_NAME(DxbcOpcode::DclTessPartitioning);
      ENUM_NAME(DxbcOpcode::DclTessOutputPrimitive);
      ENUM_NAME(DxbcOpcode::DclHsMaxTessFactor);
      ENUM_NAME(DxbcOpcode::DclHsForkPhaseInstanceCount);
      ENUM_NAME(DxbcOpcode::DclHsJoinPhaseInstanceCount);
      ENUM_NAME(DxbcOpcode::DclThreadGroup);
      ENUM_NAME(DxbcOpcode::DclUavTyped);
      ENUM_NAME(DxbcOpcode::DclUavRaw);
      ENUM_NAME(DxbcOpcode::DclUavStructured);
      ENUM_NAME(DxbcOpcode::DclThreadGroupSharedMemoryRaw);
      ENUM_NAME(DxbcOpcode::DclThreadGroupSharedMemoryStructured);
      ENUM_NAME(DxbcOpcode::DclResourceRaw);
      ENUM_NAME(DxbcOpcode::DclResourceStructured);
      ENUM_NAME(DxbcOpcode::LdUavTyped);
      ENUM_NAME(DxbcOpcode::StoreUavTyped);
      ENUM_NAME(DxbcOpcode::LdRaw);
      ENUM_NAME(DxbcOpcode::StoreRaw);
      ENUM_NAME(DxbcOpcode::LdStructured);
      ENUM_NAME(DxbcOpcode::StoreStructured);
      ENUM_NAME(DxbcOpcode::AtomicAnd);
      ENUM_NAME(DxbcOpcode::AtomicOr);
      ENUM_NAME(DxbcOpcode::AtomicXor);
      ENUM_NAME(DxbcOpcode::AtomicCmpStore);
      ENUM_NAME(DxbcOpcode::AtomicIAdd);
      ENUM_NAME(DxbcOpcode::AtomicIMax);
      ENUM_NAME(DxbcOpcode::AtomicIMin);
      ENUM_NAME(DxbcOpcode::AtomicUMax);
      ENUM_NAME(DxbcOpcode::AtomicUMin);
      ENUM_NAME(DxbcOpcode::ImmAtomicAlloc);
      ENUM_NAME(DxbcOpcode::ImmAtomicConsume);
      ENUM_NAME(DxbcOpcode::ImmAtomicIAdd);
      ENUM_NAME(DxbcOpcode::ImmAtomicAnd);
      ENUM_NAME(DxbcOpcode::ImmAtomicOr);
      ENUM_NAME(DxbcOpcode::ImmAtomicXor);
      ENUM_NAME(DxbcOpcode::ImmAtomicExch);
      ENUM_NAME(DxbcOpcode::ImmAtomicCmpExch);
      ENUM_NAME(DxbcOpcode::ImmAtomicIMax);
      ENUM_NAME(DxbcOpcode::ImmAtomicIMin);
      ENUM_NAME(DxbcOpcode::ImmAtomicUMax);
      ENUM_NAME(DxbcOpcode::ImmAtomicUMin);
      ENUM_NAME(DxbcOpcode::Sync);
      ENUM_NAME(DxbcOpcode::DAdd);
      ENUM_NAME(DxbcOpcode::DMax);
      ENUM_NAME(DxbcOpcode::DMin);
      ENUM_NAME(DxbcOpcode::DMul);
      ENUM_NAME(DxbcOpcode::DEq);
      ENUM_NAME(DxbcOpcode::DGe);
      ENUM_NAME(DxbcOpcode::DLt);
      ENUM_NAME(DxbcOpcode::DNe);
      ENUM_NAME(DxbcOpcode::DMov);
      ENUM_NAME(DxbcOpcode::DMovc);
      ENUM_NAME(DxbcOpcode::DtoF);
      ENUM_NAME(DxbcOpcode::FtoD);
      ENUM_NAME(DxbcOpcode::EvalSnapped);
      ENUM_NAME(DxbcOpcode::EvalSampleIndex);
      ENUM_NAME(DxbcOpcode::EvalCentroid);
      ENUM_NAME(DxbcOpcode::DclGsInstanceCount);
      ENUM_DEFAULT(e);
    }
  }

  std::ostream& operator << (std::ostream& os, DxbcExtOpcode e) {
    switch (e) {
      ENUM_NAME(DxbcExtOpcode::Empty);
      ENUM_NAME(DxbcExtOpcode::SampleControls);
      ENUM_NAME(DxbcExtOpcode::ResourceDim);
      ENUM_NAME(DxbcExtOpcode::ResourceReturnType);
      ENUM_DEFAULT(e);
    }
  }

  std::ostream& operator << (std::ostream& os, DxbcOperandType e) {
    switch (e) {
      ENUM_NAME(DxbcOperandType::Temp);
      ENUM_NAME(DxbcOperandType::Input);
      ENUM_NAME(DxbcOperandType::Output);
      ENUM_NAME(DxbcOperandType::IndexableTemp);
      ENUM_NAME(DxbcOperandType::Imm32);
      ENUM_NAME(DxbcOperandType::Imm64);
      ENUM_NAME(DxbcOperandType::Sampler);
      ENUM_NAME(DxbcOperandType::Resource);
      ENUM_NAME(DxbcOperandType::ConstantBuffer);
      ENUM_NAME(DxbcOperandType::ImmediateConstantBuffer);
      ENUM_NAME(DxbcOperandType::Label);
      ENUM_NAME(DxbcOperandType::InputPrimitiveId);
      ENUM_NAME(DxbcOperandType::OutputDepth);
      ENUM_NAME(DxbcOperandType::Null);
      ENUM_NAME(DxbcOperandType::Rasterizer);
      ENUM_NAME(DxbcOperandType::OutputCoverageMask);
      ENUM_NAME(DxbcOperandType::Stream);
      ENUM_NAME(DxbcOperandType::FunctionBody);
      ENUM_NAME(DxbcOperandType::FunctionTable);
      ENUM_NAME(DxbcOperandType::Interface);
      ENUM_NAME(DxbcOperandType::FunctionInput);
      ENUM_NAME(DxbcOperandType::FunctionOutput);
      ENUM_NAME(DxbcOperandType::OutputControlPointId);
      ENUM_NAME(DxbcOperandType::InputForkInstanceId);
      ENUM_NAME(DxbcOperandType::InputJoinInstanceId);
      ENUM_NAME(DxbcOperandType::InputControlPoint);
      ENUM_NAME(DxbcOperandType::OutputControlPoint);
      ENUM_NAME(DxbcOperandType::InputPatchConstant);
      ENUM_NAME(DxbcOperandType::InputDomainPoint);
      ENUM_NAME(DxbcOperandType::ThisPointer);
      ENUM_NAME(DxbcOperandType::UnorderedAccessView);
      ENUM_NAME(DxbcOperandType::ThreadGroupSharedMemory);
      ENUM_NAME(DxbcOperandType::InputThreadId);
      ENUM_NAME(DxbcOperandType::InputThreadGroupId);
      ENUM_NAME(DxbcOperandType::InputThreadIdInGroup);
      ENUM_NAME(DxbcOperandType::InputCoverageMask);
      ENUM_NAME(DxbcOperandType::InputThreadIndexInGroup);
      ENUM_NAME(DxbcOperandType::InputGsInstanceId);
      ENUM_NAME(DxbcOperandType::OutputDepthGe);
      ENUM_NAME(DxbcOperandType::OutputDepthLe);
      ENUM_NAME(DxbcOperandType::CycleCounter);
      ENUM_DEFAULT(e);
    }
  }

  std::ostream& operator << (std::ostream& os, dxvk::DxbcOperandExt e) {
    switch (e) {
      ENUM_NAME(DxbcOperandExt::OperandModifier);
      ENUM_DEFAULT(e);
    }
  }

  std::ostream& operator << (std::ostream& os, DxbcComponentCount e) {
    switch (e) {
      ENUM_NAME(DxbcComponentCount::Component0);
      ENUM_NAME(DxbcComponentCount::Component1);
      ENUM_NAME(DxbcComponentCount::Component4);
      ENUM_DEFAULT(e);
    }
  }

  std::ostream& operator << (std::ostream& os, DxbcRegMode e) {
    switch (e) {
      ENUM_NAME(DxbcRegMode::Mask);
      ENUM_NAME(DxbcRegMode::Swizzle);
      ENUM_NAME(DxbcRegMode::Select1);
      ENUM_DEFAULT(e);
    }
  }

  std::ostream& operator << (std::ostream& os, DxbcOperandIndexRepresentation e) {
    switch (e) {
      ENUM_NAME(DxbcOperandIndexRepresentation::Imm32);
      ENUM_NAME(DxbcOperandIndexRepresentation::Imm64);
      ENUM_NAME(DxbcOperandIndexRepresentation::Relative);
      ENUM_NAME(DxbcOperandIndexRepresentation::Imm32Relative);
      ENUM_NAME(DxbcOperandIndexRepresentation::Imm64Relative);
      ENUM_DEFAULT(e);
    }
  }

  std::ostream& operator << (std::ostream& os, DxbcResourceDim e) {
    switch (e) {
      ENUM_NAME(DxbcResourceDim::Unknown);
      ENUM_NAME(DxbcResourceDim::Buffer);
      ENUM_NAME(DxbcResourceDim::Texture1D);
      ENUM_NAME(DxbcResourceDim::Texture2D);
      ENUM_NAME(DxbcResourceDim::Texture2DMs);
      ENUM_NAME(DxbcResourceDim::Texture3D);
      ENUM_NAME(DxbcResourceDim::TextureCube);
      ENUM_NAME(DxbcResourceDim::Texture1DArr);
      ENUM_NAME(DxbcResourceDim::Texture2DArr);
      ENUM_NAME(DxbcResourceDim::Texture2DMsArr);
      ENUM_NAME(DxbcResourceDim::TextureCubeArr);
      ENUM_NAME(DxbcResourceDim::RawBuffer);
      ENUM_NAME(DxbcResourceDim::StructuredBuffer);
      ENUM_DEFAULT(e);
    }
  }

  std::ostream& operator << (std::ostream& os, DxbcResourceReturnType e) {
    switch (e) {
      ENUM_NAME(DxbcResourceReturnType::Unorm);
      ENUM_NAME(DxbcResourceReturnType::Snorm);
      ENUM_NAME(DxbcResourceReturnType::Sint);
      ENUM_NAME(DxbcResourceReturnType::Uint);
      ENUM_NAME(DxbcResourceReturnType::Float);
      ENUM_NAME(DxbcResourceReturnType::Mixed);
      ENUM_NAME(DxbcResourceReturnType::Double);
      ENUM_NAME(DxbcResourceReturnType::Continued);
      ENUM_NAME(DxbcResourceReturnType::Unused);
      ENUM_DEFAULT(e);
    }
  }

  std::ostream& operator << (std::ostream& os, DxbcRegisterComponentType e) {
    switch (e) {
      ENUM_NAME(DxbcRegisterComponentType::Unknown);
      ENUM_NAME(DxbcRegisterComponentType::Uint32);
      ENUM_NAME(DxbcRegisterComponentType::Sint32);
      ENUM_NAME(DxbcRegisterComponentType::Float32);
      ENUM_DEFAULT(e);
    }
  }

  std::ostream& operator << (std::ostream& os, DxbcInstructionReturnType e) {
    switch (e) {
      ENUM_NAME(DxbcInstructionReturnType::Float);
      ENUM_NAME(DxbcInstructionReturnType::Uint);
      ENUM_DEFAULT(e);
    }
  }

  std::ostream& operator << (std::ostream& os, DxbcSystemValue e) {
    switch (e) {
      ENUM_NAME(DxbcSystemValue::None);
      ENUM_NAME(DxbcSystemValue::Position);
      ENUM_NAME(DxbcSystemValue::ClipDistance);
      ENUM_NAME(DxbcSystemValue::CullDistance);
      ENUM_NAME(DxbcSystemValue::RenderTargetId);
      ENUM_NAME(DxbcSystemValue::ViewportId);
      ENUM_NAME(DxbcSystemValue::VertexId);
      ENUM_NAME(DxbcSystemValue::PrimitiveId);
      ENUM_NAME(DxbcSystemValue::InstanceId);
      ENUM_NAME(DxbcSystemValue::IsFrontFace);
      ENUM_NAME(DxbcSystemValue::SampleIndex);
      ENUM_NAME(DxbcSystemValue::FinalQuadUeq0EdgeTessFactor);
      ENUM_NAME(DxbcSystemValue::FinalQuadVeq0EdgeTessFactor);
      ENUM_NAME(DxbcSystemValue::FinalQuadUeq1EdgeTessFactor);
      ENUM_NAME(DxbcSystemValue::FinalQuadVeq1EdgeTessFactor);
      ENUM_NAME(DxbcSystemValue::FinalQuadUInsideTessFactor);
      ENUM_NAME(DxbcSystemValue::FinalQuadVInsideTessFactor);
      ENUM_NAME(DxbcSystemValue::FinalTriUeq0EdgeTessFactor);
      ENUM_NAME(DxbcSystemValue::FinalTriVeq0EdgeTessFactor);
      ENUM_NAME(DxbcSystemValue::FinalTriWeq0EdgeTessFactor);
      ENUM_NAME(DxbcSystemValue::FinalTriInsideTessFactor);
      ENUM_NAME(DxbcSystemValue::FinalLineDetailTessFactor);
      ENUM_NAME(DxbcSystemValue::FinalLineDensityTessFactor);
      ENUM_NAME(DxbcSystemValue::Target);
      ENUM_NAME(DxbcSystemValue::Depth);
      ENUM_NAME(DxbcSystemValue::Coverage);
      ENUM_NAME(DxbcSystemValue::DepthGe);
      ENUM_NAME(DxbcSystemValue::DepthLe);
      ENUM_DEFAULT(e);
    }
  }

  std::ostream& operator << (std::ostream& os, dxvk::DxbcProgramType e) {
    switch (e) {
      ENUM_NAME(DxbcProgramType::PixelShader);
      ENUM_NAME(DxbcProgramType::VertexShader);
      ENUM_NAME(DxbcProgramType::GeometryShader);
      ENUM_NAME(DxbcProgramType::HullShader);
      ENUM_NAME(DxbcProgramType::DomainShader);
      ENUM_NAME(DxbcProgramType::ComputeShader);
      ENUM_DEFAULT(e);
    }
  }

  std::ostream& operator << (std::ostream& os, dxvk::DxbcCustomDataClass e) {
    switch (e) {
      ENUM_NAME(DxbcCustomDataClass::Comment);
      ENUM_NAME(DxbcCustomDataClass::DebugInfo);
      ENUM_NAME(DxbcCustomDataClass::Opaque);
      ENUM_NAME(DxbcCustomDataClass::ImmConstBuf);
      ENUM_DEFAULT(e);
    }
  }

  std::ostream& operator << (std::ostream& os, dxvk::DxbcScalarType e) {
    switch (e) {
      ENUM_NAME(DxbcScalarType::Uint32);
      ENUM_NAME(DxbcScalarType::Uint64);
      ENUM_NAME(DxbcScalarType::Sint32);
      ENUM_NAME(DxbcScalarType::Sint64);
      ENUM_NAME(DxbcScalarType::Float32);
      ENUM_NAME(DxbcScalarType::Float64);
      ENUM_NAME(DxbcScalarType::Bool);
      ENUM_DEFAULT(e);
    }
  }

} //namespace dxvk


code:
#pragma once

#include <ostream>

#include "dxbc_common.h"
#include "dxbc_enums.h"

namespace dxvk {

  std::ostream& operator << (std::ostream& os, DxbcOpcode e);
  std::ostream& operator << (std::ostream& os, DxbcExtOpcode e);
  std::ostream& operator << (std::ostream& os, DxbcOperandType e);
  std::ostream& operator << (std::ostream& os, DxbcOperandExt e);
  std::ostream& operator << (std::ostream& os, DxbcComponentCount e);
  std::ostream& operator << (std::ostream& os, DxbcRegMode e);
  std::ostream& operator << (std::ostream& os, DxbcOperandIndexRepresentation e);
  std::ostream& operator << (std::ostream& os, DxbcResourceDim e);
  std::ostream& operator << (std::ostream& os, DxbcResourceReturnType e);
  std::ostream& operator << (std::ostream& os, DxbcRegisterComponentType e);
  std::ostream& operator << (std::ostream& os, DxbcInstructionReturnType e);
  std::ostream& operator << (std::ostream& os, DxbcSystemValue e);
  std::ostream& operator << (std::ostream& os, DxbcProgramType e);
  std::ostream& operator << (std::ostream& os, DxbcCustomDataClass e);
  std::ostream& operator << (std::ostream& os, DxbcScalarType e);

} // namespace dxvk