mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-17 17:52:11 +01:00
[dxbc] Add analyzer stub
Will be used to gather information for the compiler.
This commit is contained in:
parent
085fd6a959
commit
16caa10697
22
src/dxbc/dxbc_analysis.cpp
Normal file
22
src/dxbc/dxbc_analysis.cpp
Normal 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
51
src/dxbc/dxbc_analysis.h
Normal 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:
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
};
|
||||
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
dxbc_src = files([
|
||||
'dxbc_analysis.cpp',
|
||||
'dxbc_chunk_isgn.cpp',
|
||||
'dxbc_chunk_shex.cpp',
|
||||
'dxbc_common.cpp',
|
||||
|
Loading…
x
Reference in New Issue
Block a user