summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader/shader_jit_x64_compiler.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2017-09-08 05:02:59 +0200
committerGitHub <noreply@github.com>2017-09-08 05:02:59 +0200
commit11baa40d75d8a479bd738a05e91bba6f09856fe5 (patch)
tree2a7affcefd22d5332970c7a28a04c139aa9a6654 /src/video_core/shader/shader_jit_x64_compiler.cpp
parentMerge pull request #2918 from jroweboy/remove-debug (diff)
parentpica/command_processor: build geometry pipeline and run geometry shader (diff)
downloadyuzu-11baa40d75d8a479bd738a05e91bba6f09856fe5.tar
yuzu-11baa40d75d8a479bd738a05e91bba6f09856fe5.tar.gz
yuzu-11baa40d75d8a479bd738a05e91bba6f09856fe5.tar.bz2
yuzu-11baa40d75d8a479bd738a05e91bba6f09856fe5.tar.lz
yuzu-11baa40d75d8a479bd738a05e91bba6f09856fe5.tar.xz
yuzu-11baa40d75d8a479bd738a05e91bba6f09856fe5.tar.zst
yuzu-11baa40d75d8a479bd738a05e91bba6f09856fe5.zip
Diffstat (limited to 'src/video_core/shader/shader_jit_x64_compiler.cpp')
-rw-r--r--src/video_core/shader/shader_jit_x64_compiler.cpp49
1 files changed, 47 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] = {
&JitShader::Compile_IF, // ifu
&JitShader::Compile_IF, // ifc
&JitShader::Compile_LOOP, // loop
- nullptr, // emit
- nullptr, // sete
+ &JitShader::Compile_EMIT, // emit
+ &JitShader::Compile_SETE, // sete
&JitShader::Compile_JMP, // jmpc
&JitShader::Compile_JMP, // jmpu
&JitShader::Compile_CMP, // cmp
@@ -772,6 +772,51 @@ void JitShader::Compile_JMP(Instruction instr) {
}
}
+static void Emit(GSEmitter* emitter, Math::Vec4<float24> (*output)[16]) {
+ emitter->Emit(*output);
+}
+
+void JitShader::Compile_EMIT(Instruction instr) {
+ Label have_emitter, end;
+ mov(rax, qword[STATE + offsetof(UnitState, emitter_ptr)]);
+ test(rax, rax);
+ jnz(have_emitter);
+
+ ABI_PushRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0);
+ mov(ABI_PARAM1, reinterpret_cast<size_t>("Execute EMIT on VS"));
+ CallFarFunction(*this, LogCritical);
+ ABI_PopRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0);
+ jmp(end);
+
+ L(have_emitter);
+ ABI_PushRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0);
+ mov(ABI_PARAM1, rax);
+ mov(ABI_PARAM2, STATE);
+ add(ABI_PARAM2, static_cast<Xbyak::uint32>(offsetof(UnitState, registers.output)));
+ CallFarFunction(*this, Emit);
+ ABI_PopRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0);
+ L(end);
+}
+
+void JitShader::Compile_SETE(Instruction instr) {
+ Label have_emitter, end;
+ mov(rax, qword[STATE + offsetof(UnitState, emitter_ptr)]);
+ test(rax, rax);
+ jnz(have_emitter);
+
+ ABI_PushRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0);
+ mov(ABI_PARAM1, reinterpret_cast<size_t>("Execute SETEMIT on VS"));
+ CallFarFunction(*this, LogCritical);
+ ABI_PopRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0);
+ jmp(end);
+
+ L(have_emitter);
+ mov(byte[rax + offsetof(GSEmitter, vertex_id)], instr.setemit.vertex_id);
+ mov(byte[rax + offsetof(GSEmitter, prim_emit)], instr.setemit.prim_emit);
+ mov(byte[rax + offsetof(GSEmitter, winding)], instr.setemit.winding);
+ L(end);
+}
+
void JitShader::Compile_Block(unsigned end) {
while (program_counter < end) {
Compile_NextInstr();