From 2e7cf2f6cf5fd1caf574b9799553f67710395047 Mon Sep 17 00:00:00 2001 From: aroulin Date: Fri, 21 Aug 2015 10:51:41 +0200 Subject: Shader: implement DPH/DPHI in interpreter Tests revealed that the component with w=1 is SRC1 and not SRC2, it is now fixed on 3dbrew. --- src/video_core/shader/shader_interpreter.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/video_core/shader/shader_interpreter.cpp b/src/video_core/shader/shader_interpreter.cpp index 063cc38f0..6b83d2c1c 100644 --- a/src/video_core/shader/shader_interpreter.cpp +++ b/src/video_core/shader/shader_interpreter.cpp @@ -197,12 +197,19 @@ void RunInterpreter(UnitState& state) { case OpCode::Id::DP3: case OpCode::Id::DP4: + case OpCode::Id::DPH: + case OpCode::Id::DPHI: { Record(state.debug, iteration, src1); Record(state.debug, iteration, src2); Record(state.debug, iteration, dest); + + OpCode::Id opcode = instr.opcode.Value().EffectiveOpCode(); + if (opcode == OpCode::Id::DPH || opcode == OpCode::Id::DPHI) + src1[3] = float24::FromFloat32(1.0f); + float24 dot = float24::FromFloat32(0.f); - int num_components = (instr.opcode.Value() == OpCode::Id::DP3) ? 3 : 4; + int num_components = (opcode == OpCode::Id::DP3) ? 3 : 4; for (int i = 0; i < num_components; ++i) dot = dot + src1[i] * src2[i]; -- cgit v1.2.3