diff options
Diffstat (limited to 'src/shader_recompiler/frontend/ir/value.cpp')
| -rw-r--r-- | src/shader_recompiler/frontend/ir/value.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/shader_recompiler/frontend/ir/value.cpp b/src/shader_recompiler/frontend/ir/value.cpp index 1e974e88c..59a9b10dc 100644 --- a/src/shader_recompiler/frontend/ir/value.cpp +++ b/src/shader_recompiler/frontend/ir/value.cpp | |||
| @@ -91,26 +91,41 @@ IR::Attribute Value::Attribute() const { | |||
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | bool Value::U1() const { | 93 | bool Value::U1() const { |
| 94 | if (IsIdentity()) { | ||
| 95 | return inst->Arg(0).U1(); | ||
| 96 | } | ||
| 94 | ValidateAccess(Type::U1); | 97 | ValidateAccess(Type::U1); |
| 95 | return imm_u1; | 98 | return imm_u1; |
| 96 | } | 99 | } |
| 97 | 100 | ||
| 98 | u8 Value::U8() const { | 101 | u8 Value::U8() const { |
| 102 | if (IsIdentity()) { | ||
| 103 | return inst->Arg(0).U8(); | ||
| 104 | } | ||
| 99 | ValidateAccess(Type::U8); | 105 | ValidateAccess(Type::U8); |
| 100 | return imm_u8; | 106 | return imm_u8; |
| 101 | } | 107 | } |
| 102 | 108 | ||
| 103 | u16 Value::U16() const { | 109 | u16 Value::U16() const { |
| 110 | if (IsIdentity()) { | ||
| 111 | return inst->Arg(0).U16(); | ||
| 112 | } | ||
| 104 | ValidateAccess(Type::U16); | 113 | ValidateAccess(Type::U16); |
| 105 | return imm_u16; | 114 | return imm_u16; |
| 106 | } | 115 | } |
| 107 | 116 | ||
| 108 | u32 Value::U32() const { | 117 | u32 Value::U32() const { |
| 118 | if (IsIdentity()) { | ||
| 119 | return inst->Arg(0).U32(); | ||
| 120 | } | ||
| 109 | ValidateAccess(Type::U32); | 121 | ValidateAccess(Type::U32); |
| 110 | return imm_u32; | 122 | return imm_u32; |
| 111 | } | 123 | } |
| 112 | 124 | ||
| 113 | u64 Value::U64() const { | 125 | u64 Value::U64() const { |
| 126 | if (IsIdentity()) { | ||
| 127 | return inst->Arg(0).U64(); | ||
| 128 | } | ||
| 114 | ValidateAccess(Type::U64); | 129 | ValidateAccess(Type::U64); |
| 115 | return imm_u64; | 130 | return imm_u64; |
| 116 | } | 131 | } |
| @@ -142,8 +157,6 @@ bool Value::operator==(const Value& other) const { | |||
| 142 | return imm_u32 == other.imm_u32; | 157 | return imm_u32 == other.imm_u32; |
| 143 | case Type::U64: | 158 | case Type::U64: |
| 144 | return imm_u64 == other.imm_u64; | 159 | return imm_u64 == other.imm_u64; |
| 145 | case Type::ZSCO: | ||
| 146 | throw NotImplementedException("ZSCO comparison"); | ||
| 147 | } | 160 | } |
| 148 | throw LogicError("Invalid type {}", type); | 161 | throw LogicError("Invalid type {}", type); |
| 149 | } | 162 | } |