diff options
Diffstat (limited to 'src/shader_recompiler/frontend/ir')
| -rw-r--r-- | src/shader_recompiler/frontend/ir/ir_emitter.cpp | 4 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/ir_emitter.h | 2 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/modifiers.h | 13 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/opcodes.inc | 3 |
4 files changed, 22 insertions, 0 deletions
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp index ddaa873f2..2fd90303f 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp +++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp | |||
| @@ -82,6 +82,10 @@ void IREmitter::SelectionMerge(Block* merge_block) { | |||
| 82 | Inst(Opcode::SelectionMerge, merge_block); | 82 | Inst(Opcode::SelectionMerge, merge_block); |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | void IREmitter::MemoryBarrier(BarrierInstInfo info) { | ||
| 86 | Inst(Opcode::MemoryBarrier, Flags{info}); | ||
| 87 | } | ||
| 88 | |||
| 85 | void IREmitter::Return() { | 89 | void IREmitter::Return() { |
| 86 | block->SetReturn(); | 90 | block->SetReturn(); |
| 87 | Inst(Opcode::Return); | 91 | Inst(Opcode::Return); |
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.h b/src/shader_recompiler/frontend/ir/ir_emitter.h index 6e04eec7f..5bebf66e3 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.h +++ b/src/shader_recompiler/frontend/ir/ir_emitter.h | |||
| @@ -136,6 +136,8 @@ public: | |||
| 136 | [[nodiscard]] Value Select(const U1& condition, const Value& true_value, | 136 | [[nodiscard]] Value Select(const U1& condition, const Value& true_value, |
| 137 | const Value& false_value); | 137 | const Value& false_value); |
| 138 | 138 | ||
| 139 | [[nodiscard]] void MemoryBarrier(BarrierInstInfo info); | ||
| 140 | |||
| 139 | template <typename Dest, typename Source> | 141 | template <typename Dest, typename Source> |
| 140 | [[nodiscard]] Dest BitCast(const Source& value); | 142 | [[nodiscard]] Dest BitCast(const Source& value); |
| 141 | 143 | ||
diff --git a/src/shader_recompiler/frontend/ir/modifiers.h b/src/shader_recompiler/frontend/ir/modifiers.h index 90078f535..7730c25a9 100644 --- a/src/shader_recompiler/frontend/ir/modifiers.h +++ b/src/shader_recompiler/frontend/ir/modifiers.h | |||
| @@ -25,6 +25,14 @@ enum class FpRounding : u8 { | |||
| 25 | RZ, // Round towards zero | 25 | RZ, // Round towards zero |
| 26 | }; | 26 | }; |
| 27 | 27 | ||
| 28 | enum class MemoryScope : u32 { | ||
| 29 | DontCare, | ||
| 30 | Warp, | ||
| 31 | Workgroup, | ||
| 32 | Device, | ||
| 33 | System | ||
| 34 | }; | ||
| 35 | |||
| 28 | struct FpControl { | 36 | struct FpControl { |
| 29 | bool no_contraction{false}; | 37 | bool no_contraction{false}; |
| 30 | FpRounding rounding{FpRounding::DontCare}; | 38 | FpRounding rounding{FpRounding::DontCare}; |
| @@ -32,6 +40,11 @@ struct FpControl { | |||
| 32 | }; | 40 | }; |
| 33 | static_assert(sizeof(FpControl) <= sizeof(u32)); | 41 | static_assert(sizeof(FpControl) <= sizeof(u32)); |
| 34 | 42 | ||
| 43 | union BarrierInstInfo { | ||
| 44 | u32 raw; | ||
| 45 | BitField<0, 3, MemoryScope> scope; | ||
| 46 | }; | ||
| 47 | |||
| 35 | union TextureInstInfo { | 48 | union TextureInstInfo { |
| 36 | u32 raw; | 49 | u32 raw; |
| 37 | BitField<0, 8, TextureType> type; | 50 | BitField<0, 8, TextureType> type; |
diff --git a/src/shader_recompiler/frontend/ir/opcodes.inc b/src/shader_recompiler/frontend/ir/opcodes.inc index 702372775..d9e0d5471 100644 --- a/src/shader_recompiler/frontend/ir/opcodes.inc +++ b/src/shader_recompiler/frontend/ir/opcodes.inc | |||
| @@ -16,6 +16,9 @@ OPCODE(Return, Void, | |||
| 16 | OPCODE(Unreachable, Void, ) | 16 | OPCODE(Unreachable, Void, ) |
| 17 | OPCODE(DemoteToHelperInvocation, Void, Label, ) | 17 | OPCODE(DemoteToHelperInvocation, Void, Label, ) |
| 18 | 18 | ||
| 19 | // Barriers | ||
| 20 | OPCODE(MemoryBarrier, Void, ) | ||
| 21 | |||
| 19 | // Special operations | 22 | // Special operations |
| 20 | OPCODE(Prologue, Void, ) | 23 | OPCODE(Prologue, Void, ) |
| 21 | OPCODE(Epilogue, Void, ) | 24 | OPCODE(Epilogue, Void, ) |