2018-03-22 20:01:57 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "dxbc_chunk_isgn.h"
|
|
|
|
#include "dxbc_decoder.h"
|
|
|
|
#include "dxbc_defs.h"
|
|
|
|
#include "dxbc_names.h"
|
2018-06-23 17:14:35 +02:00
|
|
|
#include "dxbc_modinfo.h"
|
2018-03-22 20:01:57 +01:00
|
|
|
#include "dxbc_util.h"
|
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
|
2018-03-23 01:04:04 +01:00
|
|
|
/**
|
|
|
|
* \brief Info about unordered access views
|
|
|
|
*
|
|
|
|
* Stores whether an UAV is accessed with typed
|
|
|
|
* read or atomic instructions. This information
|
|
|
|
* will be used to generate image types.
|
|
|
|
*/
|
2018-03-22 20:01:57 +01:00
|
|
|
struct DxbcUavInfo {
|
2018-03-23 01:04:04 +01:00
|
|
|
bool accessTypedLoad = false;
|
2018-03-22 20:01:57 +01:00
|
|
|
bool accessAtomicOp = false;
|
|
|
|
};
|
|
|
|
|
2018-03-23 19:48:07 +01:00
|
|
|
/**
|
|
|
|
* \brief Counts cull and clip distances
|
|
|
|
*/
|
|
|
|
struct DxbcClipCullInfo {
|
|
|
|
uint32_t numClipPlanes = 0;
|
|
|
|
uint32_t numCullPlanes = 0;
|
|
|
|
};
|
|
|
|
|
2018-03-23 01:04:04 +01:00
|
|
|
/**
|
|
|
|
* \brief Shader analysis info
|
|
|
|
*/
|
2018-03-22 20:01:57 +01:00
|
|
|
struct DxbcAnalysisInfo {
|
|
|
|
std::array<DxbcUavInfo, 64> uavInfos;
|
2018-03-23 19:48:07 +01:00
|
|
|
|
|
|
|
DxbcClipCullInfo clipCullIn;
|
|
|
|
DxbcClipCullInfo clipCullOut;
|
2018-05-26 17:08:08 +02:00
|
|
|
|
|
|
|
bool usesDerivatives = false;
|
|
|
|
bool usesKill = false;
|
2018-03-22 20:01:57 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \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(
|
2018-06-23 17:14:35 +02:00
|
|
|
const DxbcModuleInfo& moduleInfo,
|
2018-03-23 01:04:04 +01:00
|
|
|
const DxbcProgramVersion& version,
|
2018-03-23 19:48:07 +01:00
|
|
|
const Rc<DxbcIsgn>& isgn,
|
|
|
|
const Rc<DxbcIsgn>& osgn,
|
2018-03-23 01:04:04 +01:00
|
|
|
DxbcAnalysisInfo& analysis);
|
2018-03-22 20:01:57 +01:00
|
|
|
|
|
|
|
~DxbcAnalyzer();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Processes a single instruction
|
|
|
|
* \param [in] ins The instruction
|
|
|
|
*/
|
|
|
|
void processInstruction(
|
|
|
|
const DxbcShaderInstruction& ins);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2018-03-23 19:48:07 +01:00
|
|
|
Rc<DxbcIsgn> m_isgn;
|
|
|
|
Rc<DxbcIsgn> m_osgn;
|
|
|
|
|
2018-03-23 01:04:04 +01:00
|
|
|
DxbcAnalysisInfo* m_analysis = nullptr;
|
2018-03-22 20:01:57 +01:00
|
|
|
|
2018-03-23 19:48:07 +01:00
|
|
|
DxbcClipCullInfo getClipCullInfo(
|
|
|
|
const Rc<DxbcIsgn>& sgn) const;
|
|
|
|
|
2018-03-22 20:01:57 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|