2017-10-16 17:50:09 +02:00
|
|
|
#pragma once
|
|
|
|
|
2017-11-13 00:22:52 +01:00
|
|
|
#include "./gen/dxbc_gen_common.h"
|
2017-10-16 17:50:09 +02:00
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
|
|
|
|
/**
|
2017-11-13 00:22:52 +01:00
|
|
|
* \brief DXBC compiler
|
|
|
|
*
|
|
|
|
* Interprets DXBC instructions and generates
|
|
|
|
* SPIR-V code for the appropriate shader type.
|
2017-10-16 17:50:09 +02:00
|
|
|
*/
|
|
|
|
class DxbcCompiler {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2017-11-01 00:01:40 +01:00
|
|
|
DxbcCompiler(
|
2017-11-13 00:22:52 +01:00
|
|
|
const DxbcProgramVersion& version);
|
2017-10-16 17:50:09 +02:00
|
|
|
~DxbcCompiler();
|
|
|
|
|
2017-11-01 00:01:40 +01:00
|
|
|
void processInstruction(
|
2017-11-13 00:22:52 +01:00
|
|
|
const DxbcInstruction& ins);
|
|
|
|
|
2017-11-20 14:03:00 +01:00
|
|
|
SpirvCodeBuffer finalize();
|
2017-10-16 17:50:09 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2017-11-13 00:22:52 +01:00
|
|
|
Rc<DxbcCodeGen> m_gen;
|
|
|
|
|
|
|
|
void dclGlobalFlags(
|
2017-11-16 01:30:17 +01:00
|
|
|
const DxbcInstruction& ins);
|
2017-11-13 00:22:52 +01:00
|
|
|
|
2017-11-13 02:07:13 +01:00
|
|
|
void dclInterfaceVar(
|
2017-11-16 01:30:17 +01:00
|
|
|
const DxbcInstruction& ins);
|
2017-11-13 00:22:52 +01:00
|
|
|
|
|
|
|
void dclTemps(
|
2017-11-16 01:30:17 +01:00
|
|
|
const DxbcInstruction& ins);
|
|
|
|
|
2017-11-17 11:41:56 +01:00
|
|
|
void opAdd(
|
|
|
|
const DxbcInstruction& ins);
|
|
|
|
|
2017-11-16 01:30:17 +01:00
|
|
|
void opMov(
|
|
|
|
const DxbcInstruction& ins);
|
|
|
|
|
|
|
|
void opRet(
|
|
|
|
const DxbcInstruction& ins);
|
|
|
|
|
|
|
|
DxbcComponentMask getDstOperandMask(
|
|
|
|
const DxbcOperand& operand);
|
|
|
|
|
|
|
|
DxbcPointer getTempOperandPtr(
|
|
|
|
const DxbcOperand& operand);
|
|
|
|
|
|
|
|
DxbcPointer getInterfaceOperandPtr(
|
|
|
|
const DxbcOperand& operand);
|
|
|
|
|
|
|
|
DxbcPointer getOperandPtr(
|
|
|
|
const DxbcOperand& operand);
|
|
|
|
|
|
|
|
DxbcValue selectOperandComponents(
|
|
|
|
const DxbcOperandToken& opToken,
|
|
|
|
const DxbcValue& opValue,
|
|
|
|
DxbcComponentMask dstMask);
|
|
|
|
|
|
|
|
DxbcValue applyOperandModifiers(
|
|
|
|
DxbcValue value,
|
|
|
|
DxbcOperandModifiers modifiers);
|
|
|
|
|
2017-11-17 11:41:56 +01:00
|
|
|
DxbcValue applyResultModifiers(
|
|
|
|
DxbcValue value,
|
|
|
|
DxbcOpcodeControl control);
|
|
|
|
|
2017-11-16 01:30:17 +01:00
|
|
|
DxbcValue loadOperand(
|
|
|
|
const DxbcOperand& operand,
|
|
|
|
DxbcComponentMask dstMask,
|
|
|
|
DxbcScalarType dstType);
|
|
|
|
|
|
|
|
void storeOperand(
|
|
|
|
const DxbcOperand& operand,
|
|
|
|
DxbcValue value,
|
|
|
|
DxbcComponentMask mask);
|
2017-10-16 19:53:17 +02:00
|
|
|
|
2017-10-16 17:50:09 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|