From ca9901867e91cd0be0cc75094ee8ea2fb2767c47 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Sun, 25 Aug 2019 15:32:00 -0400 Subject: vk_shader_compiler: Implement the decompiler in SPIR-V --- src/video_core/shader/ast.h | 22 +++++++++++++++++++++- src/video_core/shader/shader_ir.h | 4 ++++ 2 files changed, 25 insertions(+), 1 deletion(-) (limited to 'src/video_core/shader') diff --git a/src/video_core/shader/ast.h b/src/video_core/shader/ast.h index 07deb58e4..12db336df 100644 --- a/src/video_core/shader/ast.h +++ b/src/video_core/shader/ast.h @@ -205,13 +205,29 @@ public: return nullptr; } - void MarkLabelUnused() const { + void MarkLabelUnused() { auto inner = std::get_if(&data); if (inner) { inner->unused = true; } } + bool IsLabelUnused() const { + auto inner = std::get_if(&data); + if (inner) { + return inner->unused; + } + return true; + } + + u32 GetLabelIndex() const { + auto inner = std::get_if(&data); + if (inner) { + return inner->index; + } + return -1; + } + Expr GetIfCondition() const { auto inner = std::get_if(&data); if (inner) { @@ -336,6 +352,10 @@ public: return variables; } + const std::vector& GetLabels() const { + return labels; + } + private: bool IsBackwardsJump(ASTNode goto_node, ASTNode label_node) const; diff --git a/src/video_core/shader/shader_ir.h b/src/video_core/shader/shader_ir.h index 7a91c9bb6..105981d67 100644 --- a/src/video_core/shader/shader_ir.h +++ b/src/video_core/shader/shader_ir.h @@ -151,6 +151,10 @@ public: return decompiled; } + const ASTManager& GetASTManager() const { + return program_manager; + } + ASTNode GetASTProgram() const { return program_manager.GetProgram(); } -- cgit v1.2.3