From b89fc407d78867119074ffc9c98eb0d0806be6a8 Mon Sep 17 00:00:00 2001 From: David Marcec Date: Sat, 1 Sep 2018 18:45:14 +1000 Subject: [PATCH 1/3] Added FFMA asserts --- src/video_core/engines/shader_bytecode.h | 4 ++++ src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h index 3e4efbe0c8..f17a24843e 100644 --- a/src/video_core/engines/shader_bytecode.h +++ b/src/video_core/engines/shader_bytecode.h @@ -399,8 +399,12 @@ union Instruction { } flow; union { + BitField<47, 1, u64> cc; BitField<48, 1, u64> negate_b; BitField<49, 1, u64> negate_c; + BitField<50, 1, u64> saturate; + BitField<51, 2, u64> tab5980_1; + BitField<53, 2, u64> tab5980_0; } ffma; 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..88b4e43241 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -1436,6 +1436,13 @@ private: std::string op_b = instr.ffma.negate_b ? "-" : ""; std::string op_c = instr.ffma.negate_c ? "-" : ""; + ASSERT_MSG(instr.ffma.saturate == 0, "FFMA Saturate not implemented"); + ASSERT_MSG(instr.ffma.cc == 0, "FFMA cc not implemented"); + ASSERT_MSG(instr.ffma.tab5980_0 == 0, "FFMA tab5980_0({}) not implemented", + instr.ffma.tab5980_0.Value()); + ASSERT_MSG(instr.ffma.tab5980_1 == 0, "FFMA tab5980_1({}) not implemented", + instr.ffma.tab5980_1.Value()); + switch (opcode->GetId()) { case OpCode::Id::FFMA_CR: { op_b += regs.GetUniform(instr.cbuf34.index, instr.cbuf34.offset, From 2bc6abb9a17cdf914c0a2462aec524bace195b13 Mon Sep 17 00:00:00 2001 From: David Marcec Date: Sat, 1 Sep 2018 19:15:03 +1000 Subject: [PATCH 2/3] Changed tab5980_0 default from 0 -> 1 --- src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 88b4e43241..1d1ddb39b7 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -1438,8 +1438,8 @@ private: ASSERT_MSG(instr.ffma.saturate == 0, "FFMA Saturate not implemented"); ASSERT_MSG(instr.ffma.cc == 0, "FFMA cc not implemented"); - ASSERT_MSG(instr.ffma.tab5980_0 == 0, "FFMA tab5980_0({}) not implemented", - instr.ffma.tab5980_0.Value()); + ASSERT_MSG(instr.ffma.tab5980_0 == 1, "FFMA tab5980_0({}) not implemented", + instr.ffma.tab5980_0.Value()); // Seems to be 1 by default based on SMO ASSERT_MSG(instr.ffma.tab5980_1 == 0, "FFMA tab5980_1({}) not implemented", instr.ffma.tab5980_1.Value()); From 2edab4e840a09a65ca6ac61d83c26aea6899e81e Mon Sep 17 00:00:00 2001 From: David Marcec Date: Sat, 1 Sep 2018 19:29:20 +1000 Subject: [PATCH 3/3] Removed saturate assert Saturate already implemented --- 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 f17a24843e..6eeb3381b9 100644 --- a/src/video_core/engines/shader_bytecode.h +++ b/src/video_core/engines/shader_bytecode.h @@ -402,7 +402,6 @@ union Instruction { BitField<47, 1, u64> cc; BitField<48, 1, u64> negate_b; BitField<49, 1, u64> negate_c; - BitField<50, 1, u64> saturate; BitField<51, 2, u64> tab5980_1; BitField<53, 2, u64> tab5980_0; } ffma; diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 1d1ddb39b7..974798a989 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -1436,7 +1436,6 @@ private: std::string op_b = instr.ffma.negate_b ? "-" : ""; std::string op_c = instr.ffma.negate_c ? "-" : ""; - ASSERT_MSG(instr.ffma.saturate == 0, "FFMA Saturate not implemented"); ASSERT_MSG(instr.ffma.cc == 0, "FFMA cc not implemented"); ASSERT_MSG(instr.ffma.tab5980_0 == 1, "FFMA tab5980_0({}) not implemented", instr.ffma.tab5980_0.Value()); // Seems to be 1 by default based on SMO