1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
#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);
}
|