diff options
Diffstat (limited to '')
| -rw-r--r-- | src/video_core/shader/shader_jit_x64_compiler.cpp | 49 | ||||
| -rw-r--r-- | src/video_core/shader/shader_jit_x64_compiler.h | 2 |
2 files changed, 49 insertions, 2 deletions
diff --git a/src/video_core/shader/shader_jit_x64_compiler.cpp b/src/video_core/shader/shader_jit_x64_compiler.cpp index 42a57aab1..1b31623bd 100644 --- a/src/video_core/shader/shader_jit_x64_compiler.cpp +++ b/src/video_core/shader/shader_jit_x64_compiler.cpp | |||
| @@ -75,8 +75,8 @@ const JitFunction instr_table[64] = { | |||
| 75 | &JitShader::Compile_IF, // ifu | 75 | &JitShader::Compile_IF, // ifu |
| 76 | &JitShader::Compile_IF, // ifc | 76 | &JitShader::Compile_IF, // ifc |
| 77 | &JitShader::Compile_LOOP, // loop | 77 | &JitShader::Compile_LOOP, // loop |
| 78 | nullptr, // emit | 78 | &JitShader::Compile_EMIT, // emit |
| 79 | nullptr, // sete | 79 | &JitShader::Compile_SETE, // sete |
| 80 | &JitShader::Compile_JMP, // jmpc | 80 | &JitShader::Compile_JMP, // jmpc |
| 81 | &JitShader::Compile_JMP, // jmpu | 81 | &JitShader::Compile_JMP, // jmpu |
| 82 | &JitShader::Compile_CMP, // cmp | 82 | &JitShader::Compile_CMP, // cmp |
| @@ -772,6 +772,51 @@ void JitShader::Compile_JMP(Instruction instr) { | |||
| 772 | } | 772 | } |
| 773 | } | 773 | } |
| 774 | 774 | ||
| 775 | static void Emit(GSEmitter* emitter, Math::Vec4<float24> (*output)[16]) { | ||
| 776 | emitter->Emit(*output); | ||
| 777 | } | ||
| 778 | |||
| 779 | void JitShader::Compile_EMIT(Instruction instr) { | ||
| 780 | Label have_emitter, end; | ||
| 781 | mov(rax, qword[STATE + offsetof(UnitState, emitter_ptr)]); | ||
| 782 | test(rax, rax); | ||
| 783 | jnz(have_emitter); | ||
| 784 | |||
| 785 | ABI_PushRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0); | ||
| 786 | mov(ABI_PARAM1, reinterpret_cast<size_t>("Execute EMIT on VS")); | ||
| 787 | CallFarFunction(*this, LogCritical); | ||
| 788 | ABI_PopRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0); | ||
| 789 | jmp(end); | ||
| 790 | |||
| 791 | L(have_emitter); | ||
| 792 | ABI_PushRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0); | ||
| 793 | mov(ABI_PARAM1, rax); | ||
| 794 | mov(ABI_PARAM2, STATE); | ||
| 795 | add(ABI_PARAM2, static_cast<Xbyak::uint32>(offsetof(UnitState, registers.output))); | ||
| 796 | CallFarFunction(*this, Emit); | ||
| 797 | ABI_PopRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0); | ||
| 798 | L(end); | ||
| 799 | } | ||
| 800 | |||
| 801 | void JitShader::Compile_SETE(Instruction instr) { | ||
| 802 | Label have_emitter, end; | ||
| 803 | mov(rax, qword[STATE + offsetof(UnitState, emitter_ptr)]); | ||
| 804 | test(rax, rax); | ||
| 805 | jnz(have_emitter); | ||
| 806 | |||
| 807 | ABI_PushRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0); | ||
| 808 | mov(ABI_PARAM1, reinterpret_cast<size_t>("Execute SETEMIT on VS")); | ||
| 809 | CallFarFunction(*this, LogCritical); | ||
| 810 | ABI_PopRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0); | ||
| 811 | jmp(end); | ||
| 812 | |||
| 813 | L(have_emitter); | ||
| 814 | mov(byte[rax + offsetof(GSEmitter, vertex_id)], instr.setemit.vertex_id); | ||
| 815 | mov(byte[rax + offsetof(GSEmitter, prim_emit)], instr.setemit.prim_emit); | ||
| 816 | mov(byte[rax + offsetof(GSEmitter, winding)], instr.setemit.winding); | ||
| 817 | L(end); | ||
| 818 | } | ||
| 819 | |||
| 775 | void JitShader::Compile_Block(unsigned end) { | 820 | void JitShader::Compile_Block(unsigned end) { |
| 776 | while (program_counter < end) { | 821 | while (program_counter < end) { |
| 777 | Compile_NextInstr(); | 822 | Compile_NextInstr(); |
diff --git a/src/video_core/shader/shader_jit_x64_compiler.h b/src/video_core/shader/shader_jit_x64_compiler.h index 31af0ca48..4aee56b1d 100644 --- a/src/video_core/shader/shader_jit_x64_compiler.h +++ b/src/video_core/shader/shader_jit_x64_compiler.h | |||
| @@ -66,6 +66,8 @@ public: | |||
| 66 | void Compile_JMP(Instruction instr); | 66 | void Compile_JMP(Instruction instr); |
| 67 | void Compile_CMP(Instruction instr); | 67 | void Compile_CMP(Instruction instr); |
| 68 | void Compile_MAD(Instruction instr); | 68 | void Compile_MAD(Instruction instr); |
| 69 | void Compile_EMIT(Instruction instr); | ||
| 70 | void Compile_SETE(Instruction instr); | ||
| 69 | 71 | ||
| 70 | private: | 72 | private: |
| 71 | void Compile_Block(unsigned end); | 73 | void Compile_Block(unsigned end); |