summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2020-11-20 02:13:45 -0500
committerGravatar Lioncash2020-11-20 02:13:45 -0500
commit56ecafc2045dbaa1887f70da94e9e6baad576e1f (patch)
tree01b02626e9eb19a94d9dfcfdd80aa44c39666472 /src
parentMerge pull request #4936 from lioncash/page (diff)
downloadyuzu-56ecafc2045dbaa1887f70da94e9e6baad576e1f.tar.gz
yuzu-56ecafc2045dbaa1887f70da94e9e6baad576e1f.tar.xz
yuzu-56ecafc2045dbaa1887f70da94e9e6baad576e1f.zip
shader_bytecode: Eliminate variable shadowing
Diffstat (limited to 'src')
-rw-r--r--src/video_core/engines/shader_bytecode.h32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h
index a3c05d1b0..1640207a7 100644
--- a/src/video_core/engines/shader_bytecode.h
+++ b/src/video_core/engines/shader_bytecode.h
@@ -32,7 +32,7 @@ struct Register {
32 32
33 constexpr Register() = default; 33 constexpr Register() = default;
34 34
35 constexpr Register(u64 value) : value(value) {} 35 constexpr Register(u64 value_) : value(value_) {}
36 36
37 constexpr operator u64() const { 37 constexpr operator u64() const {
38 return value; 38 return value;
@@ -75,7 +75,7 @@ enum class AttributeSize : u64 {
75union Attribute { 75union Attribute {
76 Attribute() = default; 76 Attribute() = default;
77 77
78 constexpr explicit Attribute(u64 value) : value(value) {} 78 constexpr explicit Attribute(u64 value_) : value(value_) {}
79 79
80 enum class Index : u64 { 80 enum class Index : u64 {
81 LayerViewportPointSize = 6, 81 LayerViewportPointSize = 6,
@@ -124,7 +124,7 @@ union Attribute {
124union Sampler { 124union Sampler {
125 Sampler() = default; 125 Sampler() = default;
126 126
127 constexpr explicit Sampler(u64 value) : value(value) {} 127 constexpr explicit Sampler(u64 value_) : value(value_) {}
128 128
129 enum class Index : u64 { 129 enum class Index : u64 {
130 Sampler_0 = 8, 130 Sampler_0 = 8,
@@ -137,7 +137,7 @@ union Sampler {
137union Image { 137union Image {
138 Image() = default; 138 Image() = default;
139 139
140 constexpr explicit Image(u64 value) : value{value} {} 140 constexpr explicit Image(u64 value_) : value{value_} {}
141 141
142 BitField<36, 13, u64> index; 142 BitField<36, 13, u64> index;
143 u64 value; 143 u64 value;
@@ -658,7 +658,7 @@ union Instruction {
658 return *this; 658 return *this;
659 } 659 }
660 660
661 constexpr Instruction(u64 value) : value{value} {} 661 constexpr Instruction(u64 value_) : value{value_} {}
662 constexpr Instruction(const Instruction& instr) : value(instr.value) {} 662 constexpr Instruction(const Instruction& instr) : value(instr.value) {}
663 663
664 constexpr bool Bit(u64 offset) const { 664 constexpr bool Bit(u64 offset) const {
@@ -1624,12 +1624,13 @@ union Instruction {
1624 1624
1625 s32 GetBranchTarget() const { 1625 s32 GetBranchTarget() const {
1626 // Sign extend the branch target offset 1626 // Sign extend the branch target offset
1627 u32 mask = 1U << (24 - 1); 1627 const auto mask = 1U << (24 - 1);
1628 u32 value = static_cast<u32>(target); 1628 const auto target_value = static_cast<u32>(target);
1629 constexpr auto instruction_size = static_cast<s32>(sizeof(Instruction));
1630
1629 // The branch offset is relative to the next instruction and is stored in bytes, so 1631 // The branch offset is relative to the next instruction and is stored in bytes, so
1630 // divide it by the size of an instruction and add 1 to it. 1632 // divide it by the size of an instruction and add 1 to it.
1631 return static_cast<s32>((value ^ mask) - mask) / static_cast<s32>(sizeof(Instruction)) + 1633 return static_cast<s32>((target_value ^ mask) - mask) / instruction_size + 1;
1632 1;
1633 } 1634 }
1634 } bra; 1635 } bra;
1635 1636
@@ -1639,12 +1640,13 @@ union Instruction {
1639 1640
1640 s32 GetBranchExtend() const { 1641 s32 GetBranchExtend() const {
1641 // Sign extend the branch target offset 1642 // Sign extend the branch target offset
1642 u32 mask = 1U << (24 - 1); 1643 const auto mask = 1U << (24 - 1);
1643 u32 value = static_cast<u32>(target); 1644 const auto target_value = static_cast<u32>(target);
1645 constexpr auto instruction_size = static_cast<s32>(sizeof(Instruction));
1646
1644 // The branch offset is relative to the next instruction and is stored in bytes, so 1647 // The branch offset is relative to the next instruction and is stored in bytes, so
1645 // divide it by the size of an instruction and add 1 to it. 1648 // divide it by the size of an instruction and add 1 to it.
1646 return static_cast<s32>((value ^ mask) - mask) / static_cast<s32>(sizeof(Instruction)) + 1649 return static_cast<s32>((target_value ^ mask) - mask) / instruction_size + 1;
1647 1;
1648 } 1650 }
1649 } brx; 1651 } brx;
1650 1652
@@ -2004,8 +2006,8 @@ public:
2004 2006
2005 class Matcher { 2007 class Matcher {
2006 public: 2008 public:
2007 constexpr Matcher(const char* const name, u16 mask, u16 expected, Id id, Type type) 2009 constexpr Matcher(const char* const name_, u16 mask_, u16 expected_, Id id_, Type type_)
2008 : name{name}, mask{mask}, expected{expected}, id{id}, type{type} {} 2010 : name{name_}, mask{mask_}, expected{expected_}, id{id_}, type{type_} {}
2009 2011
2010 constexpr const char* GetName() const { 2012 constexpr const char* GetName() const {
2011 return name; 2013 return name;