2017-10-16 17:50:09 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "dxbc_chunk_shex.h"
|
2017-10-18 10:36:47 +02:00
|
|
|
|
|
|
|
#include "../spirv/gen/spirv_gen_capability.h"
|
2017-10-21 17:58:58 +02:00
|
|
|
#include "../spirv/gen/spirv_gen_constant.h"
|
|
|
|
#include "../spirv/gen/spirv_gen_debuginfo.h"
|
|
|
|
#include "../spirv/gen/spirv_gen_decoration.h"
|
2017-10-18 10:36:47 +02:00
|
|
|
#include "../spirv/gen/spirv_gen_entrypoint.h"
|
|
|
|
#include "../spirv/gen/spirv_gen_typeinfo.h"
|
2017-10-21 17:58:58 +02:00
|
|
|
#include "../spirv/gen/spirv_gen_variable.h"
|
2017-10-16 17:50:09 +02:00
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \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-21 17:58:58 +02:00
|
|
|
bool processInstruction(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-18 10:36:47 +02:00
|
|
|
SpirvIdCounter m_counter;
|
2017-10-16 19:53:17 +02:00
|
|
|
|
2017-10-18 10:36:47 +02:00
|
|
|
SpirvCapabilities m_spvCapabilities;
|
|
|
|
SpirvEntryPoint m_spvEntryPoints;
|
2017-10-21 17:58:58 +02:00
|
|
|
SpirvDebugInfo m_spvDebugInfo;
|
|
|
|
SpirvDecorations m_spvDecorations;
|
2017-10-18 10:36:47 +02:00
|
|
|
SpirvTypeInfo m_spvTypeInfo;
|
2017-10-21 17:58:58 +02:00
|
|
|
SpirvConstants m_spvConstants;
|
|
|
|
SpirvVariables m_spvVariables;
|
2017-10-18 10:36:47 +02:00
|
|
|
SpirvCodeBuffer m_spvCode;
|
2017-10-16 19:53:17 +02:00
|
|
|
|
2017-10-21 17:58:58 +02:00
|
|
|
uint32_t m_entryPointId = 0;
|
|
|
|
|
2017-10-18 09:50:30 +02:00
|
|
|
void declareCapabilities();
|
|
|
|
void declareMemoryModel();
|
2017-10-16 19:53:17 +02:00
|
|
|
|
2017-10-16 17:50:09 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|