From 6f8ed9508dd1f7e104349bcf76acdf40da996e4c Mon Sep 17 00:00:00 2001 From: David Marcec Date: Sat, 1 Sep 2018 19:05:10 +1000 Subject: [PATCH 1/2] Added FMUL asserts --- src/video_core/engines/shader_bytecode.h | 5 +++++ .../renderer_opengl/gl_shader_decompiler.cpp | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h index 3e4efbe0c8..f079921317 100644 --- a/src/video_core/engines/shader_bytecode.h +++ b/src/video_core/engines/shader_bytecode.h @@ -332,7 +332,12 @@ union Instruction { } ipa; union { + BitField<39, 2, u64> tab5cb8_2; + BitField<41, 3, u64> tab5c68_1; + BitField<44, 2, u64> tab5c68_0; + BitField<47, 1, u64> cc; BitField<48, 1, u64> negate_b; + BitField<50, 1, u64> saturate; } fmul; union { diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 391c92d479..f33e8d70f0 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -1038,6 +1038,16 @@ private: case OpCode::Id::FMUL_R: case OpCode::Id::FMUL_IMM: { // FMUL does not have 'abs' bits and only the second operand has a 'neg' bit. + ASSERT_MSG(instr.fmul.tab5cb8_2 == 0, "FMUL tab5cb8_2({}) is not implemented", + instr.fmul.tab5cb8_2.Value()); + ASSERT_MSG(instr.fmul.tab5c68_1 == 0, "FMUL tab5cb8_1({}) is not implemented", + instr.fmul.tab5c68_1.Value()); + ASSERT_MSG(instr.fmul.tab5c68_0 == 1, "FMUL tab5cb8_0({}) is not implemented", + instr.fmul.tab5c68_0 + .Value()); // SMO typical sends 1 here which seems to be the default + ASSERT_MSG(instr.fmul.cc == 0, "FMUL cc is not implemented"); + ASSERT_MSG(instr.fmul.saturate == 0, "FMUL saturate is not implemented"); + op_b = GetOperandAbsNeg(op_b, false, instr.fmul.negate_b); regs.SetRegisterToFloat(instr.gpr0, 0, op_a + " * " + op_b, 1, 1, instr.alu.saturate_d); From 60754b472888b9eb3f69f57978512503d61b3915 Mon Sep 17 00:00:00 2001 From: David Marcec Date: Sat, 1 Sep 2018 19:33:32 +1000 Subject: [PATCH 2/2] Removed saturate assert Unneeded as we already implement it --- src/video_core/engines/shader_bytecode.h | 1 - src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h index f079921317..c8052a612c 100644 --- a/src/video_core/engines/shader_bytecode.h +++ b/src/video_core/engines/shader_bytecode.h @@ -337,7 +337,6 @@ union Instruction { BitField<44, 2, u64> tab5c68_0; BitField<47, 1, u64> cc; BitField<48, 1, u64> negate_b; - BitField<50, 1, u64> saturate; } fmul; union { diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index f33e8d70f0..866afc7b57 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -1046,7 +1046,6 @@ private: instr.fmul.tab5c68_0 .Value()); // SMO typical sends 1 here which seems to be the default ASSERT_MSG(instr.fmul.cc == 0, "FMUL cc is not implemented"); - ASSERT_MSG(instr.fmul.saturate == 0, "FMUL saturate is not implemented"); op_b = GetOperandAbsNeg(op_b, false, instr.fmul.negate_b); regs.SetRegisterToFloat(instr.gpr0, 0, op_a + " * " + op_b, 1, 1,