diff options
| author | 2015-08-19 14:23:53 +0200 | |
|---|---|---|
| committer | 2015-08-19 14:29:39 +0200 | |
| commit | f3e8f42718393b6894b06845321328b59b8a012f (patch) | |
| tree | 2452017afbc89c845a7b492787233eabb90685ad /src | |
| parent | Shader: implement SGE, SGEI in interpreter (diff) | |
| download | yuzu-f3e8f42718393b6894b06845321328b59b8a012f.tar.gz yuzu-f3e8f42718393b6894b06845321328b59b8a012f.tar.xz yuzu-f3e8f42718393b6894b06845321328b59b8a012f.zip | |
Shader: implement SGE, SGEI and SLT in JIT
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/shader/shader_jit_x64.cpp | 48 | ||||
| -rw-r--r-- | src/video_core/shader/shader_jit_x64.h | 3 |
2 files changed, 36 insertions, 15 deletions
diff --git a/src/video_core/shader/shader_jit_x64.cpp b/src/video_core/shader/shader_jit_x64.cpp index e4b8295b3..a1bdd8456 100644 --- a/src/video_core/shader/shader_jit_x64.cpp +++ b/src/video_core/shader/shader_jit_x64.cpp | |||
| @@ -29,8 +29,8 @@ const JitFunction instr_table[64] = { | |||
| 29 | &JitCompiler::Compile_LG2, // lg2 | 29 | &JitCompiler::Compile_LG2, // lg2 |
| 30 | nullptr, // unknown | 30 | nullptr, // unknown |
| 31 | &JitCompiler::Compile_MUL, // mul | 31 | &JitCompiler::Compile_MUL, // mul |
| 32 | nullptr, // lge | 32 | &JitCompiler::Compile_SGE, // sge |
| 33 | nullptr, // slt | 33 | &JitCompiler::Compile_SLT, // slt |
| 34 | &JitCompiler::Compile_FLR, // flr | 34 | &JitCompiler::Compile_FLR, // flr |
| 35 | &JitCompiler::Compile_MAX, // max | 35 | &JitCompiler::Compile_MAX, // max |
| 36 | &JitCompiler::Compile_MIN, // min | 36 | &JitCompiler::Compile_MIN, // min |
| @@ -46,8 +46,8 @@ const JitFunction instr_table[64] = { | |||
| 46 | nullptr, // unknown | 46 | nullptr, // unknown |
| 47 | nullptr, // dphi | 47 | nullptr, // dphi |
| 48 | nullptr, // unknown | 48 | nullptr, // unknown |
| 49 | nullptr, // sgei | 49 | &JitCompiler::Compile_SGE, // sgei |
| 50 | &JitCompiler::Compile_SLTI, // slti | 50 | &JitCompiler::Compile_SLT, // slti |
| 51 | nullptr, // unknown | 51 | nullptr, // unknown |
| 52 | nullptr, // unknown | 52 | nullptr, // unknown |
| 53 | nullptr, // unknown | 53 | nullptr, // unknown |
| @@ -386,6 +386,36 @@ void JitCompiler::Compile_MUL(Instruction instr) { | |||
| 386 | Compile_DestEnable(instr, SRC1); | 386 | Compile_DestEnable(instr, SRC1); |
| 387 | } | 387 | } |
| 388 | 388 | ||
| 389 | void JitCompiler::Compile_SGE(Instruction instr) { | ||
| 390 | if (instr.opcode.Value().EffectiveOpCode() == OpCode::Id::SGEI) { | ||
| 391 | Compile_SwizzleSrc(instr, 1, instr.common.src1i, SRC1); | ||
| 392 | Compile_SwizzleSrc(instr, 2, instr.common.src2i, SRC2); | ||
| 393 | } else { | ||
| 394 | Compile_SwizzleSrc(instr, 1, instr.common.src1, SRC1); | ||
| 395 | Compile_SwizzleSrc(instr, 2, instr.common.src2, SRC2); | ||
| 396 | } | ||
| 397 | |||
| 398 | CMPPS(SRC1, R(SRC2), CMP_NLT); | ||
| 399 | ANDPS(SRC1, R(ONE)); | ||
| 400 | |||
| 401 | Compile_DestEnable(instr, SRC1); | ||
| 402 | } | ||
| 403 | |||
| 404 | void JitCompiler::Compile_SLT(Instruction instr) { | ||
| 405 | if (instr.opcode.Value().EffectiveOpCode() == OpCode::Id::SLTI) { | ||
| 406 | Compile_SwizzleSrc(instr, 1, instr.common.src1i, SRC1); | ||
| 407 | Compile_SwizzleSrc(instr, 2, instr.common.src2i, SRC2); | ||
| 408 | } else { | ||
| 409 | Compile_SwizzleSrc(instr, 1, instr.common.src1, SRC1); | ||
| 410 | Compile_SwizzleSrc(instr, 2, instr.common.src2, SRC2); | ||
| 411 | } | ||
| 412 | |||
| 413 | CMPPS(SRC1, R(SRC2), CMP_LT); | ||
| 414 | ANDPS(SRC1, R(ONE)); | ||
| 415 | |||
| 416 | Compile_DestEnable(instr, SRC1); | ||
| 417 | } | ||
| 418 | |||
| 389 | void JitCompiler::Compile_FLR(Instruction instr) { | 419 | void JitCompiler::Compile_FLR(Instruction instr) { |
| 390 | Compile_SwizzleSrc(instr, 1, instr.common.src1, SRC1); | 420 | Compile_SwizzleSrc(instr, 1, instr.common.src1, SRC1); |
| 391 | 421 | ||
| @@ -463,16 +493,6 @@ void JitCompiler::Compile_MOV(Instruction instr) { | |||
| 463 | Compile_DestEnable(instr, SRC1); | 493 | Compile_DestEnable(instr, SRC1); |
| 464 | } | 494 | } |
| 465 | 495 | ||
| 466 | void JitCompiler::Compile_SLTI(Instruction instr) { | ||
| 467 | Compile_SwizzleSrc(instr, 1, instr.common.src1i, SRC1); | ||
| 468 | Compile_SwizzleSrc(instr, 1, instr.common.src2i, SRC2); | ||
| 469 | |||
| 470 | CMPSS(SRC1, R(SRC2), CMP_LT); | ||
| 471 | ANDPS(SRC1, R(ONE)); | ||
| 472 | |||
| 473 | Compile_DestEnable(instr, SRC1); | ||
| 474 | } | ||
| 475 | |||
| 476 | void JitCompiler::Compile_RCP(Instruction instr) { | 496 | void JitCompiler::Compile_RCP(Instruction instr) { |
| 477 | Compile_SwizzleSrc(instr, 1, instr.common.src1, SRC1); | 497 | Compile_SwizzleSrc(instr, 1, instr.common.src1, SRC1); |
| 478 | 498 | ||
diff --git a/src/video_core/shader/shader_jit_x64.h b/src/video_core/shader/shader_jit_x64.h index a6ae7fbf1..b2aa5293c 100644 --- a/src/video_core/shader/shader_jit_x64.h +++ b/src/video_core/shader/shader_jit_x64.h | |||
| @@ -40,6 +40,8 @@ public: | |||
| 40 | void Compile_EX2(Instruction instr); | 40 | void Compile_EX2(Instruction instr); |
| 41 | void Compile_LG2(Instruction instr); | 41 | void Compile_LG2(Instruction instr); |
| 42 | void Compile_MUL(Instruction instr); | 42 | void Compile_MUL(Instruction instr); |
| 43 | void Compile_SGE(Instruction instr); | ||
| 44 | void Compile_SLT(Instruction instr); | ||
| 43 | void Compile_FLR(Instruction instr); | 45 | void Compile_FLR(Instruction instr); |
| 44 | void Compile_MAX(Instruction instr); | 46 | void Compile_MAX(Instruction instr); |
| 45 | void Compile_MIN(Instruction instr); | 47 | void Compile_MIN(Instruction instr); |
| @@ -47,7 +49,6 @@ public: | |||
| 47 | void Compile_RSQ(Instruction instr); | 49 | void Compile_RSQ(Instruction instr); |
| 48 | void Compile_MOVA(Instruction instr); | 50 | void Compile_MOVA(Instruction instr); |
| 49 | void Compile_MOV(Instruction instr); | 51 | void Compile_MOV(Instruction instr); |
| 50 | void Compile_SLTI(Instruction instr); | ||
| 51 | void Compile_NOP(Instruction instr); | 52 | void Compile_NOP(Instruction instr); |
| 52 | void Compile_END(Instruction instr); | 53 | void Compile_END(Instruction instr); |
| 53 | void Compile_CALL(Instruction instr); | 54 | void Compile_CALL(Instruction instr); |