summaryrefslogtreecommitdiff
path: root/src/video_core/shader
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2019-08-25 15:32:00 -0400
committerGravatar FernandoS272019-10-04 18:52:51 -0400
commitca9901867e91cd0be0cc75094ee8ea2fb2767c47 (patch)
tree1d46ef166d33459447a006f3da3dd663fab4fcaa /src/video_core/shader
parentShader_IR: mark labels as unused for partial decompile. (diff)
downloadyuzu-ca9901867e91cd0be0cc75094ee8ea2fb2767c47.tar.gz
yuzu-ca9901867e91cd0be0cc75094ee8ea2fb2767c47.tar.xz
yuzu-ca9901867e91cd0be0cc75094ee8ea2fb2767c47.zip
vk_shader_compiler: Implement the decompiler in SPIR-V
Diffstat (limited to 'src/video_core/shader')
-rw-r--r--src/video_core/shader/ast.h22
-rw-r--r--src/video_core/shader/shader_ir.h4
2 files changed, 25 insertions, 1 deletions
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:
205 return nullptr; 205 return nullptr;
206 } 206 }
207 207
208 void MarkLabelUnused() const { 208 void MarkLabelUnused() {
209 auto inner = std::get_if<ASTLabel>(&data); 209 auto inner = std::get_if<ASTLabel>(&data);
210 if (inner) { 210 if (inner) {
211 inner->unused = true; 211 inner->unused = true;
212 } 212 }
213 } 213 }
214 214
215 bool IsLabelUnused() const {
216 auto inner = std::get_if<ASTLabel>(&data);
217 if (inner) {
218 return inner->unused;
219 }
220 return true;
221 }
222
223 u32 GetLabelIndex() const {
224 auto inner = std::get_if<ASTLabel>(&data);
225 if (inner) {
226 return inner->index;
227 }
228 return -1;
229 }
230
215 Expr GetIfCondition() const { 231 Expr GetIfCondition() const {
216 auto inner = std::get_if<ASTIfThen>(&data); 232 auto inner = std::get_if<ASTIfThen>(&data);
217 if (inner) { 233 if (inner) {
@@ -336,6 +352,10 @@ public:
336 return variables; 352 return variables;
337 } 353 }
338 354
355 const std::vector<ASTNode>& GetLabels() const {
356 return labels;
357 }
358
339private: 359private:
340 bool IsBackwardsJump(ASTNode goto_node, ASTNode label_node) const; 360 bool IsBackwardsJump(ASTNode goto_node, ASTNode label_node) const;
341 361
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:
151 return decompiled; 151 return decompiled;
152 } 152 }
153 153
154 const ASTManager& GetASTManager() const {
155 return program_manager;
156 }
157
154 ASTNode GetASTProgram() const { 158 ASTNode GetASTProgram() const {
155 return program_manager.GetProgram(); 159 return program_manager.GetProgram();
156 } 160 }