diff options
Diffstat (limited to 'src/libs/dxvk-native-1.9.2a/src/dxbc/dxbc_analysis.h')
-rw-r--r-- | src/libs/dxvk-native-1.9.2a/src/dxbc/dxbc_analysis.h | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/src/libs/dxvk-native-1.9.2a/src/dxbc/dxbc_analysis.h b/src/libs/dxvk-native-1.9.2a/src/dxbc/dxbc_analysis.h new file mode 100644 index 00000000..1c09cc9c --- /dev/null +++ b/src/libs/dxvk-native-1.9.2a/src/dxbc/dxbc_analysis.h @@ -0,0 +1,87 @@ +#pragma once + +#include "dxbc_chunk_isgn.h" +#include "dxbc_decoder.h" +#include "dxbc_defs.h" +#include "dxbc_names.h" +#include "dxbc_modinfo.h" +#include "dxbc_util.h" + +namespace dxvk { + + /** + * \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. + */ + struct DxbcUavInfo { + bool accessTypedLoad = false; + bool accessAtomicOp = false; + VkAccessFlags accessFlags = 0; + }; + + /** + * \brief Counts cull and clip distances + */ + struct DxbcClipCullInfo { + uint32_t numClipPlanes = 0; + uint32_t numCullPlanes = 0; + }; + + /** + * \brief Shader analysis info + */ + struct DxbcAnalysisInfo { + std::array<DxbcUavInfo, 64> uavInfos; + + DxbcClipCullInfo clipCullIn; + DxbcClipCullInfo clipCullOut; + + bool usesDerivatives = false; + bool usesKill = false; + }; + + /** + * \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 DxbcModuleInfo& moduleInfo, + const DxbcProgramInfo& programInfo, + const Rc<DxbcIsgn>& isgn, + const Rc<DxbcIsgn>& osgn, + const Rc<DxbcIsgn>& psgn, + DxbcAnalysisInfo& analysis); + + ~DxbcAnalyzer(); + + /** + * \brief Processes a single instruction + * \param [in] ins The instruction + */ + void processInstruction( + const DxbcShaderInstruction& ins); + + private: + + Rc<DxbcIsgn> m_isgn; + Rc<DxbcIsgn> m_osgn; + Rc<DxbcIsgn> m_psgn; + + DxbcAnalysisInfo* m_analysis = nullptr; + + DxbcClipCullInfo getClipCullInfo( + const Rc<DxbcIsgn>& sgn) const; + + }; + +} |