diff options
Diffstat (limited to 'src/shader_recompiler/frontend/ir')
| -rw-r--r-- | src/shader_recompiler/frontend/ir/ir_emitter.cpp | 22 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/ir_emitter.h | 3 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/opcodes.inc | 8 |
3 files changed, 31 insertions, 2 deletions
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp index ae3354c66..33819dd36 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp +++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp | |||
| @@ -112,7 +112,27 @@ void IREmitter::SetPred(IR::Pred pred, const U1& value) { | |||
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | U32 IREmitter::GetCbuf(const U32& binding, const U32& byte_offset) { | 114 | U32 IREmitter::GetCbuf(const U32& binding, const U32& byte_offset) { |
| 115 | return Inst<U32>(Opcode::GetCbuf, binding, byte_offset); | 115 | return Inst<U32>(Opcode::GetCbufU32, binding, byte_offset); |
| 116 | } | ||
| 117 | |||
| 118 | UAny IREmitter::GetCbuf(const U32& binding, const U32& byte_offset, size_t bitsize, | ||
| 119 | bool is_signed) { | ||
| 120 | switch (bitsize) { | ||
| 121 | case 8: | ||
| 122 | return Inst<U32>(is_signed ? Opcode::GetCbufS8 : Opcode::GetCbufU8, binding, byte_offset); | ||
| 123 | case 16: | ||
| 124 | return Inst<U32>(is_signed ? Opcode::GetCbufS16 : Opcode::GetCbufU16, binding, byte_offset); | ||
| 125 | case 32: | ||
| 126 | return Inst<U32>(Opcode::GetCbufU32, binding, byte_offset); | ||
| 127 | case 64: | ||
| 128 | return Inst<U64>(Opcode::GetCbufU64, binding, byte_offset); | ||
| 129 | default: | ||
| 130 | throw InvalidArgument("Invalid bit size {}", bitsize); | ||
| 131 | } | ||
| 132 | } | ||
| 133 | |||
| 134 | F32 IREmitter::GetFloatCbuf(const U32& binding, const U32& byte_offset) { | ||
| 135 | return Inst<F32>(Opcode::GetCbufF32, binding, byte_offset); | ||
| 116 | } | 136 | } |
| 117 | 137 | ||
| 118 | U1 IREmitter::GetZFlag() { | 138 | U1 IREmitter::GetZFlag() { |
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.h b/src/shader_recompiler/frontend/ir/ir_emitter.h index cb2a7710a..e4d110540 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.h +++ b/src/shader_recompiler/frontend/ir/ir_emitter.h | |||
| @@ -47,6 +47,9 @@ public: | |||
| 47 | void SetGotoVariable(u32 id, const U1& value); | 47 | void SetGotoVariable(u32 id, const U1& value); |
| 48 | 48 | ||
| 49 | [[nodiscard]] U32 GetCbuf(const U32& binding, const U32& byte_offset); | 49 | [[nodiscard]] U32 GetCbuf(const U32& binding, const U32& byte_offset); |
| 50 | [[nodiscard]] UAny GetCbuf(const U32& binding, const U32& byte_offset, size_t bitsize, | ||
| 51 | bool is_signed); | ||
| 52 | [[nodiscard]] F32 GetFloatCbuf(const U32& binding, const U32& byte_offset); | ||
| 50 | 53 | ||
| 51 | [[nodiscard]] U1 GetZFlag(); | 54 | [[nodiscard]] U1 GetZFlag(); |
| 52 | [[nodiscard]] U1 GetSFlag(); | 55 | [[nodiscard]] U1 GetSFlag(); |
diff --git a/src/shader_recompiler/frontend/ir/opcodes.inc b/src/shader_recompiler/frontend/ir/opcodes.inc index aa011fab1..64bd495ed 100644 --- a/src/shader_recompiler/frontend/ir/opcodes.inc +++ b/src/shader_recompiler/frontend/ir/opcodes.inc | |||
| @@ -21,7 +21,13 @@ OPCODE(GetPred, U1, Pred | |||
| 21 | OPCODE(SetPred, Void, Pred, U1, ) | 21 | OPCODE(SetPred, Void, Pred, U1, ) |
| 22 | OPCODE(GetGotoVariable, U1, U32, ) | 22 | OPCODE(GetGotoVariable, U1, U32, ) |
| 23 | OPCODE(SetGotoVariable, Void, U32, U1, ) | 23 | OPCODE(SetGotoVariable, Void, U32, U1, ) |
| 24 | OPCODE(GetCbuf, U32, U32, U32, ) | 24 | OPCODE(GetCbufU8, U32, U32, U32, ) |
| 25 | OPCODE(GetCbufS8, U32, U32, U32, ) | ||
| 26 | OPCODE(GetCbufU16, U32, U32, U32, ) | ||
| 27 | OPCODE(GetCbufS16, U32, U32, U32, ) | ||
| 28 | OPCODE(GetCbufU32, U32, U32, U32, ) | ||
| 29 | OPCODE(GetCbufF32, F32, U32, U32, ) | ||
| 30 | OPCODE(GetCbufU64, U64, U32, U32, ) | ||
| 25 | OPCODE(GetAttribute, U32, Attribute, ) | 31 | OPCODE(GetAttribute, U32, Attribute, ) |
| 26 | OPCODE(SetAttribute, Void, Attribute, U32, ) | 32 | OPCODE(SetAttribute, Void, Attribute, U32, ) |
| 27 | OPCODE(GetAttributeIndexed, U32, U32, ) | 33 | OPCODE(GetAttributeIndexed, U32, U32, ) |