2017-10-16 17:50:09 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "dxbc_chunk_shex.h"
|
2017-10-18 10:36:47 +02:00
|
|
|
|
2017-10-26 15:40:39 +02:00
|
|
|
#include "../spirv/spirv_module.h"
|
2017-10-16 17:50:09 +02:00
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
|
2017-10-26 16:32:10 +02:00
|
|
|
struct DxbcRegTypeR {
|
|
|
|
uint32_t varType;
|
|
|
|
uint32_t ptrType;
|
|
|
|
uint32_t varId;
|
|
|
|
};
|
|
|
|
|
2017-10-16 17:50:09 +02:00
|
|
|
/**
|
|
|
|
* \brief DXBC to SPIR-V compiler
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
class DxbcCompiler {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
DxbcCompiler(DxbcProgramVersion version);
|
|
|
|
~DxbcCompiler();
|
|
|
|
|
2017-10-21 17:58:58 +02:00
|
|
|
DxbcCompiler (DxbcCompiler&&) = delete;
|
|
|
|
DxbcCompiler& operator = (DxbcCompiler&&) = delete;
|
|
|
|
|
2017-10-16 17:50:09 +02:00
|
|
|
/**
|
|
|
|
* \brief Processes a single instruction
|
2017-10-21 17:58:58 +02:00
|
|
|
*
|
2017-10-16 17:50:09 +02:00
|
|
|
* \param [in] ins The instruction
|
2017-10-21 17:58:58 +02:00
|
|
|
* \returns \c true on success
|
2017-10-16 17:50:09 +02:00
|
|
|
*/
|
2017-10-25 13:49:13 +02:00
|
|
|
bool processInstruction(
|
|
|
|
const DxbcInstruction& ins);
|
2017-10-16 17:50:09 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Creates actual shader object
|
|
|
|
*
|
|
|
|
* Combines all information gatherd during the
|
|
|
|
* shader compilation into one shader object.
|
|
|
|
*/
|
|
|
|
Rc<DxvkShader> finalize();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2017-10-16 19:53:17 +02:00
|
|
|
DxbcProgramVersion m_version;
|
2017-10-26 15:40:39 +02:00
|
|
|
SpirvModule m_module;
|
2017-10-16 19:53:17 +02:00
|
|
|
|
2017-10-26 16:32:10 +02:00
|
|
|
std::vector<DxbcRegTypeR> m_rRegs;
|
|
|
|
|
2017-10-21 17:58:58 +02:00
|
|
|
uint32_t m_entryPointId = 0;
|
|
|
|
|
2017-10-26 16:32:10 +02:00
|
|
|
uint32_t m_typeVoid = 0;
|
|
|
|
uint32_t m_typeFunction = 0;
|
|
|
|
|
2017-10-18 09:50:30 +02:00
|
|
|
void declareCapabilities();
|
|
|
|
void declareMemoryModel();
|
2017-10-16 19:53:17 +02:00
|
|
|
|
2017-10-26 16:32:10 +02:00
|
|
|
void dclTemps(uint32_t n);
|
|
|
|
|
2017-10-16 17:50:09 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|