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.
This commit is contained in:
parent
f2f346e110
commit
f95602f152
49 changed files with 303 additions and 290 deletions
|
@ -374,8 +374,8 @@ std::string ASTManager::Print() const {
|
|||
return printer.GetResult();
|
||||
}
|
||||
|
||||
ASTManager::ASTManager(bool full_decompile, bool disable_else_derivation)
|
||||
: full_decompile{full_decompile}, disable_else_derivation{disable_else_derivation} {};
|
||||
ASTManager::ASTManager(bool do_full_decompile, bool disable_else_derivation_)
|
||||
: full_decompile{do_full_decompile}, disable_else_derivation{disable_else_derivation_} {}
|
||||
|
||||
ASTManager::~ASTManager() {
|
||||
Clear();
|
||||
|
|
|
@ -76,7 +76,7 @@ public:
|
|||
|
||||
class ASTIfThen {
|
||||
public:
|
||||
explicit ASTIfThen(Expr condition) : condition{std::move(condition)} {}
|
||||
explicit ASTIfThen(Expr condition_) : condition{std::move(condition_)} {}
|
||||
Expr condition;
|
||||
ASTZipper nodes{};
|
||||
};
|
||||
|
@ -88,63 +88,68 @@ public:
|
|||
|
||||
class ASTBlockEncoded {
|
||||
public:
|
||||
explicit ASTBlockEncoded(u32 start, u32 end) : start{start}, end{end} {}
|
||||
explicit ASTBlockEncoded(u32 start_, u32 _) : start{start_}, end{_} {}
|
||||
u32 start;
|
||||
u32 end;
|
||||
};
|
||||
|
||||
class ASTBlockDecoded {
|
||||
public:
|
||||
explicit ASTBlockDecoded(NodeBlock&& new_nodes) : nodes(std::move(new_nodes)) {}
|
||||
explicit ASTBlockDecoded(NodeBlock&& new_nodes_) : nodes(std::move(new_nodes_)) {}
|
||||
NodeBlock nodes;
|
||||
};
|
||||
|
||||
class ASTVarSet {
|
||||
public:
|
||||
explicit ASTVarSet(u32 index, Expr condition) : index{index}, condition{std::move(condition)} {}
|
||||
explicit ASTVarSet(u32 index_, Expr condition_)
|
||||
: index{index_}, condition{std::move(condition_)} {}
|
||||
|
||||
u32 index;
|
||||
Expr condition;
|
||||
};
|
||||
|
||||
class ASTLabel {
|
||||
public:
|
||||
explicit ASTLabel(u32 index) : index{index} {}
|
||||
explicit ASTLabel(u32 index_) : index{index_} {}
|
||||
u32 index;
|
||||
bool unused{};
|
||||
};
|
||||
|
||||
class ASTGoto {
|
||||
public:
|
||||
explicit ASTGoto(Expr condition, u32 label) : condition{std::move(condition)}, label{label} {}
|
||||
explicit ASTGoto(Expr condition_, u32 label_)
|
||||
: condition{std::move(condition_)}, label{label_} {}
|
||||
|
||||
Expr condition;
|
||||
u32 label;
|
||||
};
|
||||
|
||||
class ASTDoWhile {
|
||||
public:
|
||||
explicit ASTDoWhile(Expr condition) : condition{std::move(condition)} {}
|
||||
explicit ASTDoWhile(Expr condition_) : condition{std::move(condition_)} {}
|
||||
Expr condition;
|
||||
ASTZipper nodes{};
|
||||
};
|
||||
|
||||
class ASTReturn {
|
||||
public:
|
||||
explicit ASTReturn(Expr condition, bool kills)
|
||||
: condition{std::move(condition)}, kills{kills} {}
|
||||
explicit ASTReturn(Expr condition_, bool kills_)
|
||||
: condition{std::move(condition_)}, kills{kills_} {}
|
||||
|
||||
Expr condition;
|
||||
bool kills;
|
||||
};
|
||||
|
||||
class ASTBreak {
|
||||
public:
|
||||
explicit ASTBreak(Expr condition) : condition{std::move(condition)} {}
|
||||
explicit ASTBreak(Expr condition_) : condition{std::move(condition_)} {}
|
||||
Expr condition;
|
||||
};
|
||||
|
||||
class ASTBase {
|
||||
public:
|
||||
explicit ASTBase(ASTNode parent, ASTData data)
|
||||
: data{std::move(data)}, parent{std::move(parent)} {}
|
||||
explicit ASTBase(ASTNode parent_, ASTData data_)
|
||||
: data{std::move(data_)}, parent{std::move(parent_)} {}
|
||||
|
||||
template <class U, class... Args>
|
||||
static ASTNode Make(ASTNode parent, Args&&... args) {
|
||||
|
@ -300,7 +305,7 @@ private:
|
|||
|
||||
class ASTManager final {
|
||||
public:
|
||||
ASTManager(bool full_decompile, bool disable_else_derivation);
|
||||
explicit ASTManager(bool do_full_decompile, bool disable_else_derivation_);
|
||||
~ASTManager();
|
||||
|
||||
ASTManager(const ASTManager& o) = delete;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace VideoCommon::Shader {
|
||||
|
||||
AsyncShaders::AsyncShaders(Core::Frontend::EmuWindow& emu_window) : emu_window(emu_window) {}
|
||||
AsyncShaders::AsyncShaders(Core::Frontend::EmuWindow& emu_window_) : emu_window(emu_window_) {}
|
||||
|
||||
AsyncShaders::~AsyncShaders() {
|
||||
KillWorkers();
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
Tegra::Engines::ShaderType shader_type;
|
||||
};
|
||||
|
||||
explicit AsyncShaders(Core::Frontend::EmuWindow& emu_window);
|
||||
explicit AsyncShaders(Core::Frontend::EmuWindow& emu_window_);
|
||||
~AsyncShaders();
|
||||
|
||||
/// Start up shader worker threads
|
||||
|
|
|
@ -66,8 +66,8 @@ struct BlockInfo {
|
|||
};
|
||||
|
||||
struct CFGRebuildState {
|
||||
explicit CFGRebuildState(const ProgramCode& program_code, u32 start, Registry& registry)
|
||||
: program_code{program_code}, registry{registry}, start{start} {}
|
||||
explicit CFGRebuildState(const ProgramCode& program_code_, u32 start_, Registry& registry_)
|
||||
: program_code{program_code_}, registry{registry_}, start{start_} {}
|
||||
|
||||
const ProgramCode& program_code;
|
||||
Registry& registry;
|
||||
|
|
|
@ -42,10 +42,10 @@ struct Condition {
|
|||
class SingleBranch {
|
||||
public:
|
||||
SingleBranch() = default;
|
||||
SingleBranch(Condition condition, s32 address, bool kill, bool is_sync, bool is_brk,
|
||||
bool ignore)
|
||||
: condition{condition}, address{address}, kill{kill}, is_sync{is_sync}, is_brk{is_brk},
|
||||
ignore{ignore} {}
|
||||
explicit SingleBranch(Condition condition_, s32 address_, bool kill_, bool is_sync_,
|
||||
bool is_brk_, bool ignore_)
|
||||
: condition{condition_}, address{address_}, kill{kill_}, is_sync{is_sync_}, is_brk{is_brk_},
|
||||
ignore{ignore_} {}
|
||||
|
||||
bool operator==(const SingleBranch& b) const {
|
||||
return std::tie(condition, address, kill, is_sync, is_brk, ignore) ==
|
||||
|
@ -65,15 +65,15 @@ public:
|
|||
};
|
||||
|
||||
struct CaseBranch {
|
||||
CaseBranch(u32 cmp_value, u32 address) : cmp_value{cmp_value}, address{address} {}
|
||||
explicit CaseBranch(u32 cmp_value_, u32 address_) : cmp_value{cmp_value_}, address{address_} {}
|
||||
u32 cmp_value;
|
||||
u32 address;
|
||||
};
|
||||
|
||||
class MultiBranch {
|
||||
public:
|
||||
MultiBranch(u32 gpr, std::vector<CaseBranch>&& branches)
|
||||
: gpr{gpr}, branches{std::move(branches)} {}
|
||||
explicit MultiBranch(u32 gpr_, std::vector<CaseBranch>&& branches_)
|
||||
: gpr{gpr_}, branches{std::move(branches_)} {}
|
||||
|
||||
u32 gpr{};
|
||||
std::vector<CaseBranch> branches{};
|
||||
|
|
|
@ -66,7 +66,7 @@ std::optional<u32> TryDeduceSamplerSize(const Sampler& sampler_to_deduce,
|
|||
|
||||
class ASTDecoder {
|
||||
public:
|
||||
ASTDecoder(ShaderIR& ir) : ir(ir) {}
|
||||
explicit ASTDecoder(ShaderIR& ir_) : ir(ir_) {}
|
||||
|
||||
void operator()(ASTProgram& ast) {
|
||||
ASTNode current = ast.nodes.GetFirst();
|
||||
|
|
|
@ -258,7 +258,7 @@ u32 ShaderIR::DecodeArithmeticInteger(NodeBlock& bb, u32 pc) {
|
|||
case OpCode::Id::LEA_IMM:
|
||||
case OpCode::Id::LEA_RZ:
|
||||
case OpCode::Id::LEA_HI: {
|
||||
auto [op_a, op_b, op_c] = [&]() -> std::tuple<Node, Node, Node> {
|
||||
auto [op_a_, op_b_, op_c_] = [&]() -> std::tuple<Node, Node, Node> {
|
||||
switch (opcode->get().GetId()) {
|
||||
case OpCode::Id::LEA_R2: {
|
||||
return {GetRegister(instr.gpr20), GetRegister(instr.gpr39),
|
||||
|
@ -294,8 +294,9 @@ u32 ShaderIR::DecodeArithmeticInteger(NodeBlock& bb, u32 pc) {
|
|||
UNIMPLEMENTED_IF_MSG(instr.lea.pred48 != static_cast<u64>(Pred::UnusedIndex),
|
||||
"Unhandled LEA Predicate");
|
||||
|
||||
Node value = Operation(OperationCode::ILogicalShiftLeft, std::move(op_a), std::move(op_c));
|
||||
value = Operation(OperationCode::IAdd, std::move(op_b), std::move(value));
|
||||
Node value =
|
||||
Operation(OperationCode::ILogicalShiftLeft, std::move(op_a_), std::move(op_c_));
|
||||
value = Operation(OperationCode::IAdd, std::move(op_b_), std::move(value));
|
||||
SetRegister(bb, instr.gpr0, std::move(value));
|
||||
|
||||
break;
|
||||
|
|
|
@ -76,7 +76,7 @@ public:
|
|||
|
||||
class ExprPredicate final {
|
||||
public:
|
||||
explicit ExprPredicate(u32 predicate) : predicate{predicate} {}
|
||||
explicit ExprPredicate(u32 predicate_) : predicate{predicate_} {}
|
||||
|
||||
bool operator==(const ExprPredicate& b) const {
|
||||
return predicate == b.predicate;
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
|
||||
class ExprCondCode final {
|
||||
public:
|
||||
explicit ExprCondCode(ConditionCode cc) : cc{cc} {}
|
||||
explicit ExprCondCode(ConditionCode condition_code) : cc{condition_code} {}
|
||||
|
||||
bool operator==(const ExprCondCode& b) const {
|
||||
return cc == b.cc;
|
||||
|
@ -121,7 +121,7 @@ public:
|
|||
|
||||
class ExprGprEqual final {
|
||||
public:
|
||||
ExprGprEqual(u32 gpr, u32 value) : gpr{gpr}, value{value} {}
|
||||
explicit ExprGprEqual(u32 gpr_, u32 value_) : gpr{gpr_}, value{value_} {}
|
||||
|
||||
bool operator==(const ExprGprEqual& b) const {
|
||||
return gpr == b.gpr && value == b.value;
|
||||
|
|
|
@ -290,18 +290,18 @@ struct Sampler {
|
|||
is_buffer{is_buffer_}, is_indexed{is_indexed_} {}
|
||||
|
||||
/// Separate sampler constructor
|
||||
constexpr explicit Sampler(u32 index_, std::pair<u32, u32> offsets, std::pair<u32, u32> buffers,
|
||||
Tegra::Shader::TextureType type, bool is_array_, bool is_shadow_,
|
||||
bool is_buffer_)
|
||||
: index{index_}, offset{offsets.first}, secondary_offset{offsets.second},
|
||||
buffer{buffers.first}, secondary_buffer{buffers.second}, type{type}, is_array{is_array_},
|
||||
is_shadow{is_shadow_}, is_buffer{is_buffer_}, is_separated{true} {}
|
||||
constexpr explicit Sampler(u32 index_, std::pair<u32, u32> offsets_,
|
||||
std::pair<u32, u32> buffers_, Tegra::Shader::TextureType type_,
|
||||
bool is_array_, bool is_shadow_, bool is_buffer_)
|
||||
: index{index_}, offset{offsets_.first}, secondary_offset{offsets_.second},
|
||||
buffer{buffers_.first}, secondary_buffer{buffers_.second}, type{type_},
|
||||
is_array{is_array_}, is_shadow{is_shadow_}, is_buffer{is_buffer_}, is_separated{true} {}
|
||||
|
||||
/// Bindless samplers constructor
|
||||
constexpr explicit Sampler(u32 index_, u32 offset_, u32 buffer_,
|
||||
Tegra::Shader::TextureType type, bool is_array_, bool is_shadow_,
|
||||
Tegra::Shader::TextureType type_, bool is_array_, bool is_shadow_,
|
||||
bool is_buffer_, bool is_indexed_)
|
||||
: index{index_}, offset{offset_}, buffer{buffer_}, type{type}, is_array{is_array_},
|
||||
: index{index_}, offset{offset_}, buffer{buffer_}, type{type_}, is_array{is_array_},
|
||||
is_shadow{is_shadow_}, is_buffer{is_buffer_}, is_bindless{true}, is_indexed{is_indexed_} {
|
||||
}
|
||||
|
||||
|
|
|
@ -25,9 +25,10 @@ using Tegra::Shader::PredCondition;
|
|||
using Tegra::Shader::PredOperation;
|
||||
using Tegra::Shader::Register;
|
||||
|
||||
ShaderIR::ShaderIR(const ProgramCode& program_code, u32 main_offset, CompilerSettings settings,
|
||||
Registry& registry)
|
||||
: program_code{program_code}, main_offset{main_offset}, settings{settings}, registry{registry} {
|
||||
ShaderIR::ShaderIR(const ProgramCode& program_code_, u32 main_offset_, CompilerSettings settings_,
|
||||
Registry& registry_)
|
||||
: program_code{program_code_}, main_offset{main_offset_}, settings{settings_}, registry{
|
||||
registry_} {
|
||||
Decode();
|
||||
PostDecode();
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ struct ShaderBlock;
|
|||
constexpr u32 MAX_PROGRAM_LENGTH = 0x1000;
|
||||
|
||||
struct ConstBuffer {
|
||||
constexpr explicit ConstBuffer(u32 max_offset, bool is_indirect)
|
||||
: max_offset{max_offset}, is_indirect{is_indirect} {}
|
||||
constexpr explicit ConstBuffer(u32 max_offset_, bool is_indirect_)
|
||||
: max_offset{max_offset_}, is_indirect{is_indirect_} {}
|
||||
|
||||
constexpr ConstBuffer() = default;
|
||||
|
||||
|
@ -66,8 +66,8 @@ struct GlobalMemoryUsage {
|
|||
|
||||
class ShaderIR final {
|
||||
public:
|
||||
explicit ShaderIR(const ProgramCode& program_code, u32 main_offset, CompilerSettings settings,
|
||||
Registry& registry);
|
||||
explicit ShaderIR(const ProgramCode& program_code_, u32 main_offset_,
|
||||
CompilerSettings settings_, Registry& registry_);
|
||||
~ShaderIR();
|
||||
|
||||
const std::map<u32, NodeBlock>& GetBasicBlocks() const {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue