1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-18 02:52:10 +01:00

[dxbc] Add analyzer stub

Will be used to gather information for the compiler.
This commit is contained in:
Philip Rebohle 2018-03-22 20:01:57 +01:00
parent 085fd6a959
commit 16caa10697
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
5 changed files with 112 additions and 3 deletions

View File

@ -0,0 +1,22 @@
#include "dxbc_analysis.h"
namespace dxvk {
DxbcAnalyzer::DxbcAnalyzer(
const DxbcOptions& options,
const DxbcProgramVersion& version) {
}
DxbcAnalyzer::~DxbcAnalyzer() {
}
void DxbcAnalyzer::processInstruction(
const DxbcShaderInstruction& ins) {
}
}

51
src/dxbc/dxbc_analysis.h Normal file
View File

@ -0,0 +1,51 @@
#pragma once
#include "dxbc_chunk_isgn.h"
#include "dxbc_decoder.h"
#include "dxbc_defs.h"
#include "dxbc_names.h"
#include "dxbc_options.h"
#include "dxbc_util.h"
namespace dxvk {
struct DxbcUavInfo {
bool accessTypedRead = false;
bool accessAtomicOp = false;
};
struct DxbcAnalysisInfo {
std::array<DxbcUavInfo, 64> uavInfos;
};
/**
* \brief DXBC shader analysis pass
*
* Collects information about the shader itself
* and the resources used by the shader, which
* will later be used by the actual compiler.
*/
class DxbcAnalyzer {
public:
DxbcAnalyzer(
const DxbcOptions& options,
const DxbcProgramVersion& version);
~DxbcAnalyzer();
/**
* \brief Processes a single instruction
* \param [in] ins The instruction
*/
void processInstruction(
const DxbcShaderInstruction& ins);
private:
};
}

View File

@ -1,3 +1,4 @@
#include "dxbc_analysis.h"
#include "dxbc_compiler.h"
#include "dxbc_module.h"
@ -44,12 +45,37 @@ namespace dxvk {
if (m_shexChunk == nullptr)
throw DxvkError("DxbcModule::compile: No SHDR/SHEX chunk");
DxbcCodeSlice slice = m_shexChunk->slice();
DxbcAnalyzer analyzer(options,
m_shexChunk->version());
DxbcCompiler compiler(options,
m_shexChunk->version(),
m_isgnChunk, m_osgnChunk);
this->runAnalyzer(analyzer, m_shexChunk->slice());
this->runCompiler(compiler, m_shexChunk->slice());
return compiler.finalize();
}
void DxbcModule::runAnalyzer(
DxbcAnalyzer& analyzer,
DxbcCodeSlice slice) const {
DxbcDecodeContext decoder;
while (!slice.atEnd()) {
decoder.decodeInstruction(slice);
analyzer.processInstruction(
decoder.getInstruction());
}
}
void DxbcModule::runCompiler(
DxbcCompiler& compiler,
DxbcCodeSlice slice) const {
DxbcDecodeContext decoder;
while (!slice.atEnd()) {
@ -58,8 +84,6 @@ namespace dxvk {
compiler.processInstruction(
decoder.getInstruction());
}
return compiler.finalize();
}
}

View File

@ -14,6 +14,9 @@
namespace dxvk {
class DxbcAnalyzer;
class DxbcCompiler;
/**
* \brief DXBC shader module
*
@ -61,6 +64,14 @@ namespace dxvk {
Rc<DxbcIsgn> m_osgnChunk;
Rc<DxbcShex> m_shexChunk;
void runAnalyzer(
DxbcAnalyzer& analyzer,
DxbcCodeSlice slice) const;
void runCompiler(
DxbcCompiler& compiler,
DxbcCodeSlice slice) const;
};
}

View File

@ -1,4 +1,5 @@
dxbc_src = files([
'dxbc_analysis.cpp',
'dxbc_chunk_isgn.cpp',
'dxbc_chunk_shex.cpp',
'dxbc_common.cpp',