diff options
| author | 2021-04-12 03:48:15 -0300 | |
|---|---|---|
| committer | 2021-07-22 21:51:27 -0400 | |
| commit | a6cef71cc0b03f929f1bc97152b302562f46bc53 (patch) | |
| tree | b6be5bddb79c93233f6081a930634345c353dec2 /src/shader_recompiler/frontend/maxwell | |
| parent | internal_stage_buffer_entry_read: Remove pragma optimize off (diff) | |
| download | yuzu-a6cef71cc0b03f929f1bc97152b302562f46bc53.tar.gz yuzu-a6cef71cc0b03f929f1bc97152b302562f46bc53.tar.xz yuzu-a6cef71cc0b03f929f1bc97152b302562f46bc53.zip | |
shader: Implement OUT
Diffstat (limited to 'src/shader_recompiler/frontend/maxwell')
3 files changed, 47 insertions, 17 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_attribute.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_attribute.cpp index f629e7167..79293bd6b 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_attribute.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_attribute.cpp | |||
| @@ -64,7 +64,7 @@ void TranslatorVisitor::ALD(u64 insn) { | |||
| 64 | BitField<8, 8, IR::Reg> index_reg; | 64 | BitField<8, 8, IR::Reg> index_reg; |
| 65 | BitField<20, 10, u64> absolute_offset; | 65 | BitField<20, 10, u64> absolute_offset; |
| 66 | BitField<20, 11, s64> relative_offset; | 66 | BitField<20, 11, s64> relative_offset; |
| 67 | BitField<39, 8, IR::Reg> stream_reg; | 67 | BitField<39, 8, IR::Reg> array_reg; |
| 68 | BitField<32, 1, u64> o; | 68 | BitField<32, 1, u64> o; |
| 69 | BitField<31, 1, u64> patch; | 69 | BitField<31, 1, u64> patch; |
| 70 | BitField<47, 2, Size> size; | 70 | BitField<47, 2, Size> size; |
| @@ -100,16 +100,13 @@ void TranslatorVisitor::AST(u64 insn) { | |||
| 100 | BitField<20, 10, u64> absolute_offset; | 100 | BitField<20, 10, u64> absolute_offset; |
| 101 | BitField<20, 11, s64> relative_offset; | 101 | BitField<20, 11, s64> relative_offset; |
| 102 | BitField<31, 1, u64> patch; | 102 | BitField<31, 1, u64> patch; |
| 103 | BitField<39, 8, IR::Reg> stream_reg; | 103 | BitField<39, 8, IR::Reg> array_reg; |
| 104 | BitField<47, 2, Size> size; | 104 | BitField<47, 2, Size> size; |
| 105 | } const ast{insn}; | 105 | } const ast{insn}; |
| 106 | 106 | ||
| 107 | if (ast.patch != 0) { | 107 | if (ast.patch != 0) { |
| 108 | throw NotImplementedException("P"); | 108 | throw NotImplementedException("P"); |
| 109 | } | 109 | } |
| 110 | if (ast.stream_reg != IR::Reg::RZ) { | ||
| 111 | throw NotImplementedException("Stream store"); | ||
| 112 | } | ||
| 113 | if (ast.index_reg != IR::Reg::RZ) { | 110 | if (ast.index_reg != IR::Reg::RZ) { |
| 114 | throw NotImplementedException("Indexed store"); | 111 | throw NotImplementedException("Indexed store"); |
| 115 | } | 112 | } |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp index 694bdfccb..a45d1e4be 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp | |||
| @@ -169,18 +169,6 @@ void TranslatorVisitor::NOP(u64) { | |||
| 169 | // NOP is No-Op. | 169 | // NOP is No-Op. |
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | void TranslatorVisitor::OUT_reg(u64) { | ||
| 173 | ThrowNotImplemented(Opcode::OUT_reg); | ||
| 174 | } | ||
| 175 | |||
| 176 | void TranslatorVisitor::OUT_cbuf(u64) { | ||
| 177 | ThrowNotImplemented(Opcode::OUT_cbuf); | ||
| 178 | } | ||
| 179 | |||
| 180 | void TranslatorVisitor::OUT_imm(u64) { | ||
| 181 | ThrowNotImplemented(Opcode::OUT_imm); | ||
| 182 | } | ||
| 183 | |||
| 184 | void TranslatorVisitor::PBK() { | 172 | void TranslatorVisitor::PBK() { |
| 185 | // PBK is a no-op | 173 | // PBK is a no-op |
| 186 | } | 174 | } |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/output_geometry.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/output_geometry.cpp new file mode 100644 index 000000000..01cfad88d --- /dev/null +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/output_geometry.cpp | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | // Copyright 2021 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "common/bit_field.h" | ||
| 6 | #include "common/common_types.h" | ||
| 7 | #include "shader_recompiler/frontend/maxwell/translate/impl/impl.h" | ||
| 8 | |||
| 9 | namespace Shader::Maxwell { | ||
| 10 | namespace { | ||
| 11 | void OUT(TranslatorVisitor& v, u64 insn, IR::U32 stream_index) { | ||
| 12 | union { | ||
| 13 | u64 raw; | ||
| 14 | BitField<0, 8, IR::Reg> dest_reg; | ||
| 15 | BitField<8, 8, IR::Reg> output_reg; // Not needed on host | ||
| 16 | BitField<39, 1, u64> emit; | ||
| 17 | BitField<40, 1, u64> cut; | ||
| 18 | } const out{insn}; | ||
| 19 | |||
| 20 | stream_index = v.ir.BitwiseAnd(stream_index, v.ir.Imm32(0b11)); | ||
| 21 | |||
| 22 | if (out.emit != 0) { | ||
| 23 | v.ir.EmitVertex(stream_index); | ||
| 24 | } | ||
| 25 | if (out.cut != 0) { | ||
| 26 | v.ir.EndPrimitive(stream_index); | ||
| 27 | } | ||
| 28 | // Host doesn't need the output register, but we can write to it to avoid undefined reads | ||
| 29 | v.X(out.dest_reg, v.ir.Imm32(0)); | ||
| 30 | } | ||
| 31 | } // Anonymous namespace | ||
| 32 | |||
| 33 | void TranslatorVisitor::OUT_reg(u64 insn) { | ||
| 34 | OUT(*this, insn, GetReg20(insn)); | ||
| 35 | } | ||
| 36 | |||
| 37 | void TranslatorVisitor::OUT_cbuf(u64 insn) { | ||
| 38 | OUT(*this, insn, GetCbuf(insn)); | ||
| 39 | } | ||
| 40 | |||
| 41 | void TranslatorVisitor::OUT_imm(u64 insn) { | ||
| 42 | OUT(*this, insn, GetImm20(insn)); | ||
| 43 | } | ||
| 44 | |||
| 45 | } // namespace Shader::Maxwell | ||