diff options
| author | 2015-08-16 11:51:21 +0200 | |
|---|---|---|
| committer | 2015-08-16 15:54:30 +0200 | |
| commit | 638e47c04dca31c3434f88fccef8cc61315b6adf (patch) | |
| tree | 5201fd9d4f318b04d5b0049fc79747656f27813e /src | |
| parent | Build fix for Debug configurations. (diff) | |
| download | yuzu-638e47c04dca31c3434f88fccef8cc61315b6adf.tar.gz yuzu-638e47c04dca31c3434f88fccef8cc61315b6adf.tar.xz yuzu-638e47c04dca31c3434f88fccef8cc61315b6adf.zip | |
Shader: implement EX2 and LG2 in interpreter
Diffstat (limited to 'src')
| -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) { | |||
| 334 | Record<DebugDataRecord::CMP_RESULT>(state.debug, iteration, state.conditional_code); | 334 | Record<DebugDataRecord::CMP_RESULT>(state.debug, iteration, state.conditional_code); |
| 335 | break; | 335 | break; |
| 336 | 336 | ||
| 337 | case OpCode::Id::EX2: | ||
| 338 | { | ||
| 339 | Record<DebugDataRecord::SRC1>(state.debug, iteration, src1); | ||
| 340 | Record<DebugDataRecord::DEST_IN>(state.debug, iteration, dest); | ||
| 341 | |||
| 342 | // EX2 only takes first component exp2 and writes it to all dest components | ||
| 343 | float24 ex2_res = float24::FromFloat32(std::exp2(src1[0].ToFloat32())); | ||
| 344 | for (int i = 0; i < 4; ++i) { | ||
| 345 | if (!swizzle.DestComponentEnabled(i)) | ||
| 346 | continue; | ||
| 347 | |||
| 348 | dest[i] = ex2_res; | ||
| 349 | } | ||
| 350 | |||
| 351 | Record<DebugDataRecord::DEST_OUT>(state.debug, iteration, dest); | ||
| 352 | break; | ||
| 353 | } | ||
| 354 | |||
| 355 | case OpCode::Id::LG2: | ||
| 356 | { | ||
| 357 | Record<DebugDataRecord::SRC1>(state.debug, iteration, src1); | ||
| 358 | Record<DebugDataRecord::DEST_IN>(state.debug, iteration, dest); | ||
| 359 | |||
| 360 | // LG2 only takes the first component log2 and writes it to all dest components | ||
| 361 | float24 lg2_res = float24::FromFloat32(std::log2(src1[0].ToFloat32())); | ||
| 362 | for (int i = 0; i < 4; ++i) { | ||
| 363 | if (!swizzle.DestComponentEnabled(i)) | ||
| 364 | continue; | ||
| 365 | |||
| 366 | dest[i] = lg2_res; | ||
| 367 | } | ||
| 368 | |||
| 369 | Record<DebugDataRecord::DEST_OUT>(state.debug, iteration, dest); | ||
| 370 | break; | ||
| 371 | } | ||
| 372 | |||
| 337 | default: | 373 | default: |
| 338 | LOG_ERROR(HW_GPU, "Unhandled arithmetic instruction: 0x%02x (%s): 0x%08x", | 374 | LOG_ERROR(HW_GPU, "Unhandled arithmetic instruction: 0x%02x (%s): 0x%08x", |
| 339 | (int)instr.opcode.Value().EffectiveOpCode(), instr.opcode.Value().GetInfo().name, instr.hex); | 375 | (int)instr.opcode.Value().EffectiveOpCode(), instr.opcode.Value().GetInfo().name, instr.hex); |