2017-12-13 15:32:54 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "dxbc_enums.h"
|
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
|
|
|
|
constexpr size_t DxbcMaxInterfaceRegs = 32;
|
|
|
|
constexpr size_t DxbcMaxOperandCount = 8;
|
|
|
|
|
2017-12-14 12:53:53 +01:00
|
|
|
/**
|
|
|
|
* \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.
|
|
|
|
*/
|
2017-12-13 15:32:54 +01:00
|
|
|
enum class DxbcOperandKind {
|
|
|
|
DstReg, ///< Destination register
|
|
|
|
SrcReg, ///< Source register
|
|
|
|
Imm32, ///< Constant number
|
|
|
|
};
|
|
|
|
|
2017-12-14 12:53:53 +01:00
|
|
|
/**
|
|
|
|
* \brief Instruction class
|
|
|
|
*
|
|
|
|
* Instructions with a similar format are grouped into
|
|
|
|
* instruction classes in order to make implementing
|
|
|
|
* new instructions easier.
|
|
|
|
*/
|
2017-12-13 15:32:54 +01:00
|
|
|
enum class DxbcInstClass {
|
|
|
|
Declaration, ///< Interface or resource declaration
|
2017-12-19 17:41:23 +01:00
|
|
|
CustomData, ///< Immediate constant buffer
|
2017-12-18 11:53:28 +01:00
|
|
|
ControlFlow, ///< Control flow instructions
|
2017-12-18 16:41:05 +01:00
|
|
|
GeometryEmit, ///< Special geometry shader instructions
|
2017-12-13 15:32:54 +01:00
|
|
|
TextureSample, ///< Texture sampling instruction
|
|
|
|
VectorAlu, ///< Component-wise vector instructions
|
2017-12-17 01:36:41 +01:00
|
|
|
VectorCmov, ///< Component-wise conditional move
|
2017-12-13 15:32:54 +01:00
|
|
|
VectorCmp, ///< Component-wise vector comparison
|
|
|
|
VectorDot, ///< Dot product instruction
|
2017-12-18 16:41:05 +01:00
|
|
|
VectorIdiv, ///< Component-wise integer division
|
2017-12-18 00:28:54 +01:00
|
|
|
VectorImul, ///< Component-wise integer multiplication
|
2017-12-13 16:35:01 +01:00
|
|
|
VectorSinCos, ///< Sine and Cosine instruction
|
2017-12-13 15:32:54 +01:00
|
|
|
Undefined, ///< Instruction code not defined
|
|
|
|
};
|
|
|
|
|
2017-12-14 12:53:53 +01:00
|
|
|
/**
|
|
|
|
* \brief Instruction operand format
|
|
|
|
*
|
|
|
|
* Stores the kind and the expected data type
|
|
|
|
* of an operand. Used when parsing instructions.
|
|
|
|
*/
|
2017-12-13 15:32:54 +01:00
|
|
|
struct DxbcInstOperandFormat {
|
|
|
|
DxbcOperandKind kind;
|
|
|
|
DxbcScalarType type;
|
|
|
|
};
|
|
|
|
|
2017-12-14 12:53:53 +01:00
|
|
|
/**
|
|
|
|
* \brief Instruction format
|
|
|
|
*
|
|
|
|
* Defines the instruction class as well as
|
|
|
|
* the format of the insttruction operands.
|
|
|
|
*/
|
2017-12-13 15:32:54 +01:00
|
|
|
struct DxbcInstFormat {
|
|
|
|
uint32_t operandCount = 0;
|
|
|
|
DxbcInstClass instructionClass = DxbcInstClass::Undefined;
|
|
|
|
DxbcInstOperandFormat operands[DxbcMaxOperandCount];
|
|
|
|
};
|
|
|
|
|
2017-12-14 12:53:53 +01:00
|
|
|
/**
|
|
|
|
* \brief Retrieves instruction format info
|
|
|
|
*
|
|
|
|
* \param [in] opcode The opcode to retrieve
|
|
|
|
* \returns Instruction format info
|
|
|
|
*/
|
2017-12-13 15:32:54 +01:00
|
|
|
DxbcInstFormat dxbcInstructionFormat(DxbcOpcode opcode);
|
|
|
|
|
|
|
|
}
|