summaryrefslogtreecommitdiff
path: root/src/video_core/shader
diff options
context:
space:
mode:
authorGravatar Lioncash2020-12-05 11:40:14 -0500
committerGravatar Lioncash2020-12-05 16:02:23 -0500
commitf95602f15207851b849c57e2a2dd313a087b2493 (patch)
treeed6122ab0a30de177acb2a59dffc8109232870ec /src/video_core/shader
parentMerge pull request #5133 from lioncash/video-shadow2 (diff)
downloadyuzu-f95602f15207851b849c57e2a2dd313a087b2493.tar.gz
yuzu-f95602f15207851b849c57e2a2dd313a087b2493.tar.xz
yuzu-f95602f15207851b849c57e2a2dd313a087b2493.zip
video_core: Resolve more variable shadowing scenarios pt.3
Cleans out the rest of the occurrences of variable shadowing and makes any further occurrences of shadowing compiler errors.
Diffstat (limited to 'src/video_core/shader')
-rw-r--r--src/video_core/shader/ast.cpp4
-rw-r--r--src/video_core/shader/ast.h31
-rw-r--r--src/video_core/shader/async_shaders.cpp2
-rw-r--r--src/video_core/shader/async_shaders.h2
-rw-r--r--src/video_core/shader/control_flow.cpp4
-rw-r--r--src/video_core/shader/control_flow.h14
-rw-r--r--src/video_core/shader/decode.cpp2
-rw-r--r--src/video_core/shader/decode/arithmetic_integer.cpp7
-rw-r--r--src/video_core/shader/expr.h6
-rw-r--r--src/video_core/shader/node.h16
-rw-r--r--src/video_core/shader/shader_ir.cpp7
-rw-r--r--src/video_core/shader/shader_ir.h8
12 files changed, 55 insertions, 48 deletions
diff --git a/src/video_core/shader/ast.cpp b/src/video_core/shader/ast.cpp
index 3f96d9076..cc2dbe36c 100644
--- a/src/video_core/shader/ast.cpp
+++ b/src/video_core/shader/ast.cpp
@@ -374,8 +374,8 @@ std::string ASTManager::Print() const {
374 return printer.GetResult(); 374 return printer.GetResult();
375} 375}
376 376
377ASTManager::ASTManager(bool full_decompile, bool disable_else_derivation) 377ASTManager::ASTManager(bool do_full_decompile, bool disable_else_derivation_)
378 : full_decompile{full_decompile}, disable_else_derivation{disable_else_derivation} {}; 378 : full_decompile{do_full_decompile}, disable_else_derivation{disable_else_derivation_} {}
379 379
380ASTManager::~ASTManager() { 380ASTManager::~ASTManager() {
381 Clear(); 381 Clear();
diff --git a/src/video_core/shader/ast.h b/src/video_core/shader/ast.h
index 8e5a22ab3..dc49b369e 100644
--- a/src/video_core/shader/ast.h
+++ b/src/video_core/shader/ast.h
@@ -76,7 +76,7 @@ public:
76 76
77class ASTIfThen { 77class ASTIfThen {
78public: 78public:
79 explicit ASTIfThen(Expr condition) : condition{std::move(condition)} {} 79 explicit ASTIfThen(Expr condition_) : condition{std::move(condition_)} {}
80 Expr condition; 80 Expr condition;
81 ASTZipper nodes{}; 81 ASTZipper nodes{};
82}; 82};
@@ -88,63 +88,68 @@ public:
88 88
89class ASTBlockEncoded { 89class ASTBlockEncoded {
90public: 90public:
91 explicit ASTBlockEncoded(u32 start, u32 end) : start{start}, end{end} {} 91 explicit ASTBlockEncoded(u32 start_, u32 _) : start{start_}, end{_} {}
92 u32 start; 92 u32 start;
93 u32 end; 93 u32 end;
94}; 94};
95 95
96class ASTBlockDecoded { 96class ASTBlockDecoded {
97public: 97public:
98 explicit ASTBlockDecoded(NodeBlock&& new_nodes) : nodes(std::move(new_nodes)) {} 98 explicit ASTBlockDecoded(NodeBlock&& new_nodes_) : nodes(std::move(new_nodes_)) {}
99 NodeBlock nodes; 99 NodeBlock nodes;
100}; 100};
101 101
102class ASTVarSet { 102class ASTVarSet {
103public: 103public:
104 explicit ASTVarSet(u32 index, Expr condition) : index{index}, condition{std::move(condition)} {} 104 explicit ASTVarSet(u32 index_, Expr condition_)
105 : index{index_}, condition{std::move(condition_)} {}
106
105 u32 index; 107 u32 index;
106 Expr condition; 108 Expr condition;
107}; 109};
108 110
109class ASTLabel { 111class ASTLabel {
110public: 112public:
111 explicit ASTLabel(u32 index) : index{index} {} 113 explicit ASTLabel(u32 index_) : index{index_} {}
112 u32 index; 114 u32 index;
113 bool unused{}; 115 bool unused{};
114}; 116};
115 117
116class ASTGoto { 118class ASTGoto {
117public: 119public:
118 explicit ASTGoto(Expr condition, u32 label) : condition{std::move(condition)}, label{label} {} 120 explicit ASTGoto(Expr condition_, u32 label_)
121 : condition{std::move(condition_)}, label{label_} {}
122
119 Expr condition; 123 Expr condition;
120 u32 label; 124 u32 label;
121}; 125};
122 126
123class ASTDoWhile { 127class ASTDoWhile {
124public: 128public:
125 explicit ASTDoWhile(Expr condition) : condition{std::move(condition)} {} 129 explicit ASTDoWhile(Expr condition_) : condition{std::move(condition_)} {}
126 Expr condition; 130 Expr condition;
127 ASTZipper nodes{}; 131 ASTZipper nodes{};
128}; 132};
129 133
130class ASTReturn { 134class ASTReturn {
131public: 135public:
132 explicit ASTReturn(Expr condition, bool kills) 136 explicit ASTReturn(Expr condition_, bool kills_)
133 : condition{std::move(condition)}, kills{kills} {} 137 : condition{std::move(condition_)}, kills{kills_} {}
138
134 Expr condition; 139 Expr condition;
135 bool kills; 140 bool kills;
136}; 141};
137 142
138class ASTBreak { 143class ASTBreak {
139public: 144public:
140 explicit ASTBreak(Expr condition) : condition{std::move(condition)} {} 145 explicit ASTBreak(Expr condition_) : condition{std::move(condition_)} {}
141 Expr condition; 146 Expr condition;
142}; 147};
143 148
144class ASTBase { 149class ASTBase {
145public: 150public:
146 explicit ASTBase(ASTNode parent, ASTData data) 151 explicit ASTBase(ASTNode parent_, ASTData data_)
147 : data{std::move(data)}, parent{std::move(parent)} {} 152 : data{std::move(data_)}, parent{std::move(parent_)} {}
148 153
149 template <class U, class... Args> 154 template <class U, class... Args>
150 static ASTNode Make(ASTNode parent, Args&&... args) { 155 static ASTNode Make(ASTNode parent, Args&&... args) {
@@ -300,7 +305,7 @@ private:
300 305
301class ASTManager final { 306class ASTManager final {
302public: 307public:
303 ASTManager(bool full_decompile, bool disable_else_derivation); 308 explicit ASTManager(bool do_full_decompile, bool disable_else_derivation_);
304 ~ASTManager(); 309 ~ASTManager();
305 310
306 ASTManager(const ASTManager& o) = delete; 311 ASTManager(const ASTManager& o) = delete;
diff --git a/src/video_core/shader/async_shaders.cpp b/src/video_core/shader/async_shaders.cpp
index 6920afdf2..78245473c 100644
--- a/src/video_core/shader/async_shaders.cpp
+++ b/src/video_core/shader/async_shaders.cpp
@@ -13,7 +13,7 @@
13 13
14namespace VideoCommon::Shader { 14namespace VideoCommon::Shader {
15 15
16AsyncShaders::AsyncShaders(Core::Frontend::EmuWindow& emu_window) : emu_window(emu_window) {} 16AsyncShaders::AsyncShaders(Core::Frontend::EmuWindow& emu_window_) : emu_window(emu_window_) {}
17 17
18AsyncShaders::~AsyncShaders() { 18AsyncShaders::~AsyncShaders() {
19 KillWorkers(); 19 KillWorkers();
diff --git a/src/video_core/shader/async_shaders.h b/src/video_core/shader/async_shaders.h
index 7a99e1dc5..5a7216019 100644
--- a/src/video_core/shader/async_shaders.h
+++ b/src/video_core/shader/async_shaders.h
@@ -66,7 +66,7 @@ public:
66 Tegra::Engines::ShaderType shader_type; 66 Tegra::Engines::ShaderType shader_type;
67 }; 67 };
68 68
69 explicit AsyncShaders(Core::Frontend::EmuWindow& emu_window); 69 explicit AsyncShaders(Core::Frontend::EmuWindow& emu_window_);
70 ~AsyncShaders(); 70 ~AsyncShaders();
71 71
72 /// Start up shader worker threads 72 /// Start up shader worker threads
diff --git a/src/video_core/shader/control_flow.cpp b/src/video_core/shader/control_flow.cpp
index d656e0668..9120bf705 100644
--- a/src/video_core/shader/control_flow.cpp
+++ b/src/video_core/shader/control_flow.cpp
@@ -66,8 +66,8 @@ struct BlockInfo {
66}; 66};
67 67
68struct CFGRebuildState { 68struct CFGRebuildState {
69 explicit CFGRebuildState(const ProgramCode& program_code, u32 start, Registry& registry) 69 explicit CFGRebuildState(const ProgramCode& program_code_, u32 start_, Registry& registry_)
70 : program_code{program_code}, registry{registry}, start{start} {} 70 : program_code{program_code_}, registry{registry_}, start{start_} {}
71 71
72 const ProgramCode& program_code; 72 const ProgramCode& program_code;
73 Registry& registry; 73 Registry& registry;
diff --git a/src/video_core/shader/control_flow.h b/src/video_core/shader/control_flow.h
index 62a3510d8..37bf96492 100644
--- a/src/video_core/shader/control_flow.h
+++ b/src/video_core/shader/control_flow.h
@@ -42,10 +42,10 @@ struct Condition {
42class SingleBranch { 42class SingleBranch {
43public: 43public:
44 SingleBranch() = default; 44 SingleBranch() = default;
45 SingleBranch(Condition condition, s32 address, bool kill, bool is_sync, bool is_brk, 45 explicit SingleBranch(Condition condition_, s32 address_, bool kill_, bool is_sync_,
46 bool ignore) 46 bool is_brk_, bool ignore_)
47 : condition{condition}, address{address}, kill{kill}, is_sync{is_sync}, is_brk{is_brk}, 47 : condition{condition_}, address{address_}, kill{kill_}, is_sync{is_sync_}, is_brk{is_brk_},
48 ignore{ignore} {} 48 ignore{ignore_} {}
49 49
50 bool operator==(const SingleBranch& b) const { 50 bool operator==(const SingleBranch& b) const {
51 return std::tie(condition, address, kill, is_sync, is_brk, ignore) == 51 return std::tie(condition, address, kill, is_sync, is_brk, ignore) ==
@@ -65,15 +65,15 @@ public:
65}; 65};
66 66
67struct CaseBranch { 67struct CaseBranch {
68 CaseBranch(u32 cmp_value, u32 address) : cmp_value{cmp_value}, address{address} {} 68 explicit CaseBranch(u32 cmp_value_, u32 address_) : cmp_value{cmp_value_}, address{address_} {}
69 u32 cmp_value; 69 u32 cmp_value;
70 u32 address; 70 u32 address;
71}; 71};
72 72
73class MultiBranch { 73class MultiBranch {
74public: 74public:
75 MultiBranch(u32 gpr, std::vector<CaseBranch>&& branches) 75 explicit MultiBranch(u32 gpr_, std::vector<CaseBranch>&& branches_)
76 : gpr{gpr}, branches{std::move(branches)} {} 76 : gpr{gpr_}, branches{std::move(branches_)} {}
77 77
78 u32 gpr{}; 78 u32 gpr{};
79 std::vector<CaseBranch> branches{}; 79 std::vector<CaseBranch> branches{};
diff --git a/src/video_core/shader/decode.cpp b/src/video_core/shader/decode.cpp
index eeac328a6..c8f4da6df 100644
--- a/src/video_core/shader/decode.cpp
+++ b/src/video_core/shader/decode.cpp
@@ -66,7 +66,7 @@ std::optional<u32> TryDeduceSamplerSize(const Sampler& sampler_to_deduce,
66 66
67class ASTDecoder { 67class ASTDecoder {
68public: 68public:
69 ASTDecoder(ShaderIR& ir) : ir(ir) {} 69 explicit ASTDecoder(ShaderIR& ir_) : ir(ir_) {}
70 70
71 void operator()(ASTProgram& ast) { 71 void operator()(ASTProgram& ast) {
72 ASTNode current = ast.nodes.GetFirst(); 72 ASTNode current = ast.nodes.GetFirst();
diff --git a/src/video_core/shader/decode/arithmetic_integer.cpp b/src/video_core/shader/decode/arithmetic_integer.cpp
index 73155966f..f32c3134b 100644
--- a/src/video_core/shader/decode/arithmetic_integer.cpp
+++ b/src/video_core/shader/decode/arithmetic_integer.cpp
@@ -258,7 +258,7 @@ u32 ShaderIR::DecodeArithmeticInteger(NodeBlock& bb, u32 pc) {
258 case OpCode::Id::LEA_IMM: 258 case OpCode::Id::LEA_IMM:
259 case OpCode::Id::LEA_RZ: 259 case OpCode::Id::LEA_RZ:
260 case OpCode::Id::LEA_HI: { 260 case OpCode::Id::LEA_HI: {
261 auto [op_a, op_b, op_c] = [&]() -> std::tuple<Node, Node, Node> { 261 auto [op_a_, op_b_, op_c_] = [&]() -> std::tuple<Node, Node, Node> {
262 switch (opcode->get().GetId()) { 262 switch (opcode->get().GetId()) {
263 case OpCode::Id::LEA_R2: { 263 case OpCode::Id::LEA_R2: {
264 return {GetRegister(instr.gpr20), GetRegister(instr.gpr39), 264 return {GetRegister(instr.gpr20), GetRegister(instr.gpr39),
@@ -294,8 +294,9 @@ u32 ShaderIR::DecodeArithmeticInteger(NodeBlock& bb, u32 pc) {
294 UNIMPLEMENTED_IF_MSG(instr.lea.pred48 != static_cast<u64>(Pred::UnusedIndex), 294 UNIMPLEMENTED_IF_MSG(instr.lea.pred48 != static_cast<u64>(Pred::UnusedIndex),
295 "Unhandled LEA Predicate"); 295 "Unhandled LEA Predicate");
296 296
297 Node value = Operation(OperationCode::ILogicalShiftLeft, std::move(op_a), std::move(op_c)); 297 Node value =
298 value = Operation(OperationCode::IAdd, std::move(op_b), std::move(value)); 298 Operation(OperationCode::ILogicalShiftLeft, std::move(op_a_), std::move(op_c_));
299 value = Operation(OperationCode::IAdd, std::move(op_b_), std::move(value));
299 SetRegister(bb, instr.gpr0, std::move(value)); 300 SetRegister(bb, instr.gpr0, std::move(value));
300 301
301 break; 302 break;
diff --git a/src/video_core/shader/expr.h b/src/video_core/shader/expr.h
index 4e8264367..cda284c72 100644
--- a/src/video_core/shader/expr.h
+++ b/src/video_core/shader/expr.h
@@ -76,7 +76,7 @@ public:
76 76
77class ExprPredicate final { 77class ExprPredicate final {
78public: 78public:
79 explicit ExprPredicate(u32 predicate) : predicate{predicate} {} 79 explicit ExprPredicate(u32 predicate_) : predicate{predicate_} {}
80 80
81 bool operator==(const ExprPredicate& b) const { 81 bool operator==(const ExprPredicate& b) const {
82 return predicate == b.predicate; 82 return predicate == b.predicate;
@@ -91,7 +91,7 @@ public:
91 91
92class ExprCondCode final { 92class ExprCondCode final {
93public: 93public:
94 explicit ExprCondCode(ConditionCode cc) : cc{cc} {} 94 explicit ExprCondCode(ConditionCode condition_code) : cc{condition_code} {}
95 95
96 bool operator==(const ExprCondCode& b) const { 96 bool operator==(const ExprCondCode& b) const {
97 return cc == b.cc; 97 return cc == b.cc;
@@ -121,7 +121,7 @@ public:
121 121
122class ExprGprEqual final { 122class ExprGprEqual final {
123public: 123public:
124 ExprGprEqual(u32 gpr, u32 value) : gpr{gpr}, value{value} {} 124 explicit ExprGprEqual(u32 gpr_, u32 value_) : gpr{gpr_}, value{value_} {}
125 125
126 bool operator==(const ExprGprEqual& b) const { 126 bool operator==(const ExprGprEqual& b) const {
127 return gpr == b.gpr && value == b.value; 127 return gpr == b.gpr && value == b.value;
diff --git a/src/video_core/shader/node.h b/src/video_core/shader/node.h
index a1e2c4d8e..8db9e1de7 100644
--- a/src/video_core/shader/node.h
+++ b/src/video_core/shader/node.h
@@ -290,18 +290,18 @@ struct Sampler {
290 is_buffer{is_buffer_}, is_indexed{is_indexed_} {} 290 is_buffer{is_buffer_}, is_indexed{is_indexed_} {}
291 291
292 /// Separate sampler constructor 292 /// Separate sampler constructor
293 constexpr explicit Sampler(u32 index_, std::pair<u32, u32> offsets, std::pair<u32, u32> buffers, 293 constexpr explicit Sampler(u32 index_, std::pair<u32, u32> offsets_,
294 Tegra::Shader::TextureType type, bool is_array_, bool is_shadow_, 294 std::pair<u32, u32> buffers_, Tegra::Shader::TextureType type_,
295 bool is_buffer_) 295 bool is_array_, bool is_shadow_, bool is_buffer_)
296 : index{index_}, offset{offsets.first}, secondary_offset{offsets.second}, 296 : index{index_}, offset{offsets_.first}, secondary_offset{offsets_.second},
297 buffer{buffers.first}, secondary_buffer{buffers.second}, type{type}, is_array{is_array_}, 297 buffer{buffers_.first}, secondary_buffer{buffers_.second}, type{type_},
298 is_shadow{is_shadow_}, is_buffer{is_buffer_}, is_separated{true} {} 298 is_array{is_array_}, is_shadow{is_shadow_}, is_buffer{is_buffer_}, is_separated{true} {}
299 299
300 /// Bindless samplers constructor 300 /// Bindless samplers constructor
301 constexpr explicit Sampler(u32 index_, u32 offset_, u32 buffer_, 301 constexpr explicit Sampler(u32 index_, u32 offset_, u32 buffer_,
302 Tegra::Shader::TextureType type, bool is_array_, bool is_shadow_, 302 Tegra::Shader::TextureType type_, bool is_array_, bool is_shadow_,
303 bool is_buffer_, bool is_indexed_) 303 bool is_buffer_, bool is_indexed_)
304 : index{index_}, offset{offset_}, buffer{buffer_}, type{type}, is_array{is_array_}, 304 : index{index_}, offset{offset_}, buffer{buffer_}, type{type_}, is_array{is_array_},
305 is_shadow{is_shadow_}, is_buffer{is_buffer_}, is_bindless{true}, is_indexed{is_indexed_} { 305 is_shadow{is_shadow_}, is_buffer{is_buffer_}, is_bindless{true}, is_indexed{is_indexed_} {
306 } 306 }
307 307
diff --git a/src/video_core/shader/shader_ir.cpp b/src/video_core/shader/shader_ir.cpp
index 29d794b34..879088a27 100644
--- a/src/video_core/shader/shader_ir.cpp
+++ b/src/video_core/shader/shader_ir.cpp
@@ -25,9 +25,10 @@ using Tegra::Shader::PredCondition;
25using Tegra::Shader::PredOperation; 25using Tegra::Shader::PredOperation;
26using Tegra::Shader::Register; 26using Tegra::Shader::Register;
27 27
28ShaderIR::ShaderIR(const ProgramCode& program_code, u32 main_offset, CompilerSettings settings, 28ShaderIR::ShaderIR(const ProgramCode& program_code_, u32 main_offset_, CompilerSettings settings_,
29 Registry& registry) 29 Registry& registry_)
30 : program_code{program_code}, main_offset{main_offset}, settings{settings}, registry{registry} { 30 : program_code{program_code_}, main_offset{main_offset_}, settings{settings_}, registry{
31 registry_} {
31 Decode(); 32 Decode();
32 PostDecode(); 33 PostDecode();
33} 34}
diff --git a/src/video_core/shader/shader_ir.h b/src/video_core/shader/shader_ir.h
index 3a98b2104..6aae14e34 100644
--- a/src/video_core/shader/shader_ir.h
+++ b/src/video_core/shader/shader_ir.h
@@ -29,8 +29,8 @@ struct ShaderBlock;
29constexpr u32 MAX_PROGRAM_LENGTH = 0x1000; 29constexpr u32 MAX_PROGRAM_LENGTH = 0x1000;
30 30
31struct ConstBuffer { 31struct ConstBuffer {
32 constexpr explicit ConstBuffer(u32 max_offset, bool is_indirect) 32 constexpr explicit ConstBuffer(u32 max_offset_, bool is_indirect_)
33 : max_offset{max_offset}, is_indirect{is_indirect} {} 33 : max_offset{max_offset_}, is_indirect{is_indirect_} {}
34 34
35 constexpr ConstBuffer() = default; 35 constexpr ConstBuffer() = default;
36 36
@@ -66,8 +66,8 @@ struct GlobalMemoryUsage {
66 66
67class ShaderIR final { 67class ShaderIR final {
68public: 68public:
69 explicit ShaderIR(const ProgramCode& program_code, u32 main_offset, CompilerSettings settings, 69 explicit ShaderIR(const ProgramCode& program_code_, u32 main_offset_,
70 Registry& registry); 70 CompilerSettings settings_, Registry& registry_);
71 ~ShaderIR(); 71 ~ShaderIR();
72 72
73 const std::map<u32, NodeBlock>& GetBasicBlocks() const { 73 const std::map<u32, NodeBlock>& GetBasicBlocks() const {