summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend/ir
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/frontend/ir')
-rw-r--r--src/shader_recompiler/frontend/ir/ir_emitter.cpp22
-rw-r--r--src/shader_recompiler/frontend/ir/ir_emitter.h3
-rw-r--r--src/shader_recompiler/frontend/ir/opcodes.inc8
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
114U32 IREmitter::GetCbuf(const U32& binding, const U32& byte_offset) { 114U32 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
118UAny 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
134F32 IREmitter::GetFloatCbuf(const U32& binding, const U32& byte_offset) {
135 return Inst<F32>(Opcode::GetCbufF32, binding, byte_offset);
116} 136}
117 137
118U1 IREmitter::GetZFlag() { 138U1 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
21OPCODE(SetPred, Void, Pred, U1, ) 21OPCODE(SetPred, Void, Pred, U1, )
22OPCODE(GetGotoVariable, U1, U32, ) 22OPCODE(GetGotoVariable, U1, U32, )
23OPCODE(SetGotoVariable, Void, U32, U1, ) 23OPCODE(SetGotoVariable, Void, U32, U1, )
24OPCODE(GetCbuf, U32, U32, U32, ) 24OPCODE(GetCbufU8, U32, U32, U32, )
25OPCODE(GetCbufS8, U32, U32, U32, )
26OPCODE(GetCbufU16, U32, U32, U32, )
27OPCODE(GetCbufS16, U32, U32, U32, )
28OPCODE(GetCbufU32, U32, U32, U32, )
29OPCODE(GetCbufF32, F32, U32, U32, )
30OPCODE(GetCbufU64, U64, U32, U32, )
25OPCODE(GetAttribute, U32, Attribute, ) 31OPCODE(GetAttribute, U32, Attribute, )
26OPCODE(SetAttribute, Void, Attribute, U32, ) 32OPCODE(SetAttribute, Void, Attribute, U32, )
27OPCODE(GetAttributeIndexed, U32, U32, ) 33OPCODE(GetAttributeIndexed, U32, U32, )