summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp
diff options
context:
space:
mode:
authorGravatar ameerj2021-08-23 20:00:11 -0400
committerGravatar ameerj2021-08-30 11:46:24 -0400
commit4fda7f1c821e1000210b1dfdf1074795b1aa9d96 (patch)
tree1bc899e56f66fa8c6a9ebe6fbade73c2dc3ddd4a /src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp
parentstructured_control_flow: Add DemoteCombinationPass (diff)
downloadyuzu-4fda7f1c821e1000210b1dfdf1074795b1aa9d96.tar.gz
yuzu-4fda7f1c821e1000210b1dfdf1074795b1aa9d96.tar.xz
yuzu-4fda7f1c821e1000210b1dfdf1074795b1aa9d96.zip
structured_control_flow: Conditionally invoke demote reorder pass
This is only needed on select drivers when a fragment shader discards/demotes.
Diffstat (limited to 'src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp')
-rw-r--r--src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp b/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp
index f124dc8c0..77d1cd0fc 100644
--- a/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp
+++ b/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp
@@ -20,6 +20,7 @@
20#include "shader_recompiler/frontend/maxwell/decode.h" 20#include "shader_recompiler/frontend/maxwell/decode.h"
21#include "shader_recompiler/frontend/maxwell/structured_control_flow.h" 21#include "shader_recompiler/frontend/maxwell/structured_control_flow.h"
22#include "shader_recompiler/frontend/maxwell/translate/translate.h" 22#include "shader_recompiler/frontend/maxwell/translate/translate.h"
23#include "shader_recompiler/host_translate_info.h"
23#include "shader_recompiler/object_pool.h" 24#include "shader_recompiler/object_pool.h"
24 25
25namespace Shader::Maxwell { 26namespace Shader::Maxwell {
@@ -652,7 +653,7 @@ class TranslatePass {
652public: 653public:
653 TranslatePass(ObjectPool<IR::Inst>& inst_pool_, ObjectPool<IR::Block>& block_pool_, 654 TranslatePass(ObjectPool<IR::Inst>& inst_pool_, ObjectPool<IR::Block>& block_pool_,
654 ObjectPool<Statement>& stmt_pool_, Environment& env_, Statement& root_stmt, 655 ObjectPool<Statement>& stmt_pool_, Environment& env_, Statement& root_stmt,
655 IR::AbstractSyntaxList& syntax_list_) 656 IR::AbstractSyntaxList& syntax_list_, const HostTranslateInfo& host_info)
656 : stmt_pool{stmt_pool_}, inst_pool{inst_pool_}, block_pool{block_pool_}, env{env_}, 657 : stmt_pool{stmt_pool_}, inst_pool{inst_pool_}, block_pool{block_pool_}, env{env_},
657 syntax_list{syntax_list_} { 658 syntax_list{syntax_list_} {
658 Visit(root_stmt, nullptr, nullptr); 659 Visit(root_stmt, nullptr, nullptr);
@@ -660,7 +661,7 @@ public:
660 IR::Block& first_block{*syntax_list.front().data.block}; 661 IR::Block& first_block{*syntax_list.front().data.block};
661 IR::IREmitter ir(first_block, first_block.begin()); 662 IR::IREmitter ir(first_block, first_block.begin());
662 ir.Prologue(); 663 ir.Prologue();
663 if (uses_demote_to_helper) { 664 if (uses_demote_to_helper && host_info.needs_demote_reorder) {
664 DemoteCombinationPass(); 665 DemoteCombinationPass();
665 } 666 }
666 } 667 }
@@ -977,12 +978,13 @@ private:
977} // Anonymous namespace 978} // Anonymous namespace
978 979
979IR::AbstractSyntaxList BuildASL(ObjectPool<IR::Inst>& inst_pool, ObjectPool<IR::Block>& block_pool, 980IR::AbstractSyntaxList BuildASL(ObjectPool<IR::Inst>& inst_pool, ObjectPool<IR::Block>& block_pool,
980 Environment& env, Flow::CFG& cfg) { 981 Environment& env, Flow::CFG& cfg,
982 const HostTranslateInfo& host_info) {
981 ObjectPool<Statement> stmt_pool{64}; 983 ObjectPool<Statement> stmt_pool{64};
982 GotoPass goto_pass{cfg, stmt_pool}; 984 GotoPass goto_pass{cfg, stmt_pool};
983 Statement& root{goto_pass.RootStatement()}; 985 Statement& root{goto_pass.RootStatement()};
984 IR::AbstractSyntaxList syntax_list; 986 IR::AbstractSyntaxList syntax_list;
985 TranslatePass{inst_pool, block_pool, stmt_pool, env, root, syntax_list}; 987 TranslatePass{inst_pool, block_pool, stmt_pool, env, root, syntax_list, host_info};
986 return syntax_list; 988 return syntax_list;
987} 989}
988 990