diff options
author | bunnei <bunneidev@gmail.com> | 2019-07-11 23:36:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-11 23:36:23 +0200 |
commit | bb67091c774611ce2be1aa461438be3989601e59 (patch) | |
tree | 58e29bd5d7114019a48a62ffadb8076d73627bee /src/video_core/shader/shader_ir.h | |
parent | Merge pull request #2717 from SciresM/unmirror_memory (diff) | |
parent | shader_ir: Add comments on missing instruction. (diff) | |
download | yuzu-bb67091c774611ce2be1aa461438be3989601e59.tar yuzu-bb67091c774611ce2be1aa461438be3989601e59.tar.gz yuzu-bb67091c774611ce2be1aa461438be3989601e59.tar.bz2 yuzu-bb67091c774611ce2be1aa461438be3989601e59.tar.lz yuzu-bb67091c774611ce2be1aa461438be3989601e59.tar.xz yuzu-bb67091c774611ce2be1aa461438be3989601e59.tar.zst yuzu-bb67091c774611ce2be1aa461438be3989601e59.zip |
Diffstat (limited to 'src/video_core/shader/shader_ir.h')
-rw-r--r-- | src/video_core/shader/shader_ir.h | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/video_core/shader/shader_ir.h b/src/video_core/shader/shader_ir.h index e22548208..6145f0a70 100644 --- a/src/video_core/shader/shader_ir.h +++ b/src/video_core/shader/shader_ir.h @@ -22,18 +22,12 @@ namespace VideoCommon::Shader { +struct ShaderBlock; + using ProgramCode = std::vector<u64>; constexpr u32 MAX_PROGRAM_LENGTH = 0x1000; -/// Describes the behaviour of code path of a given entry point and a return point. -enum class ExitMethod { - Undetermined, ///< Internal value. Only occur when analyzing JMP loop. - AlwaysReturn, ///< All code paths reach the return point. - Conditional, ///< Code path reaches the return point or an END instruction conditionally. - AlwaysEnd, ///< All code paths reach a END instruction. -}; - class ConstBuffer { public: explicit ConstBuffer(u32 max_offset, bool is_indirect) @@ -73,7 +67,7 @@ struct GlobalMemoryUsage { class ShaderIR final { public: - explicit ShaderIR(const ProgramCode& program_code, u32 main_offset); + explicit ShaderIR(const ProgramCode& program_code, u32 main_offset, std::size_t size); ~ShaderIR(); const std::map<u32, NodeBlock>& GetBasicBlocks() const { @@ -129,12 +123,20 @@ public: return header; } + bool IsFlowStackDisabled() const { + return disable_flow_stack; + } + + u32 ConvertAddressToNvidiaSpace(const u32 address) const { + return (address - main_offset) * sizeof(Tegra::Shader::Instruction); + } + private: void Decode(); - ExitMethod Scan(u32 begin, u32 end, std::set<u32>& labels); - NodeBlock DecodeRange(u32 begin, u32 end); + void DecodeRangeInner(NodeBlock& bb, u32 begin, u32 end); + void InsertControlFlow(NodeBlock& bb, const ShaderBlock& block); /** * Decodes a single instruction from Tegra to IR. @@ -326,10 +328,11 @@ private: const ProgramCode& program_code; const u32 main_offset; + const std::size_t program_size; + bool disable_flow_stack{}; u32 coverage_begin{}; u32 coverage_end{}; - std::map<std::pair<u32, u32>, ExitMethod> exit_method_map; std::map<u32, NodeBlock> basic_blocks; NodeBlock global_code; |