diff options
| author | bunnei <bunneidev@gmail.com> | 2015-08-18 19:42:32 -0400 |
|---|---|---|
| committer | bunnei <bunneidev@gmail.com> | 2015-08-18 19:42:32 -0400 |
| commit | 026379ed55cfd03cddfa0ae366432b395c81f1ac (patch) | |
| tree | 52201d264c2b4acbeb85ee3b45f0c8520cfbb140 /src/video_core/shader/shader_interpreter.cpp | |
| parent | ef7eb8bc4c2b761a5dc6623156694be057e7a416 (diff) | |
| parent | 7d3a6016d64eea0e523fe35bb61070a0268900f7 (diff) | |
Merge pull request #1037 from aroulin/shader-ex2-lg2
Shader: Implement EX2 and LG2 in interpreter/JIT
Diffstat (limited to 'src/video_core/shader/shader_interpreter.cpp')
| -rw-r--r-- | src/video_core/shader/shader_interpreter.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/video_core/shader/shader_interpreter.cpp b/src/video_core/shader/shader_interpreter.cpp index e14de0768..646171a19 100644 --- a/src/video_core/shader/shader_interpreter.cpp +++ b/src/video_core/shader/shader_interpreter.cpp @@ -334,6 +334,42 @@ void RunInterpreter(UnitState<Debug>& state) { Record<DebugDataRecord::CMP_RESULT>(state.debug, iteration, state.conditional_code); break; + case OpCode::Id::EX2: + { + Record<DebugDataRecord::SRC1>(state.debug, iteration, src1); + Record<DebugDataRecord::DEST_IN>(state.debug, iteration, dest); + + // EX2 only takes first component exp2 and writes it to all dest components + float24 ex2_res = float24::FromFloat32(std::exp2(src1[0].ToFloat32())); + for (int i = 0; i < 4; ++i) { + if (!swizzle.DestComponentEnabled(i)) + continue; + + dest[i] = ex2_res; + } + + Record<DebugDataRecord::DEST_OUT>(state.debug, iteration, dest); + break; + } + + case OpCode::Id::LG2: + { + Record<DebugDataRecord::SRC1>(state.debug, iteration, src1); + Record<DebugDataRecord::DEST_IN>(state.debug, iteration, dest); + + // LG2 only takes the first component log2 and writes it to all dest components + float24 lg2_res = float24::FromFloat32(std::log2(src1[0].ToFloat32())); + for (int i = 0; i < 4; ++i) { + if (!swizzle.DestComponentEnabled(i)) + continue; + + dest[i] = lg2_res; + } + + Record<DebugDataRecord::DEST_OUT>(state.debug, iteration, dest); + break; + } + default: LOG_ERROR(HW_GPU, "Unhandled arithmetic instruction: 0x%02x (%s): 0x%08x", (int)instr.opcode.Value().EffectiveOpCode(), instr.opcode.Value().GetInfo().name, instr.hex); |
