From d241867c7b443e7de6bc3c93f6eccadd9d91fd24 Mon Sep 17 00:00:00 2001 From: "Daniel R." <47796739+polybiusproxy@users.noreply.github.com> Date: Sat, 24 Aug 2024 23:18:04 +0200 Subject: [PATCH 1/5] shader_recompiler/frontend: implement V_NOP --- src/shader_recompiler/frontend/translate/vector_alu.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/shader_recompiler/frontend/translate/vector_alu.cpp b/src/shader_recompiler/frontend/translate/vector_alu.cpp index 1bbc3c162..1b49999a6 100644 --- a/src/shader_recompiler/frontend/translate/vector_alu.cpp +++ b/src/shader_recompiler/frontend/translate/vector_alu.cpp @@ -305,6 +305,9 @@ void Translator::EmitVectorAlu(const GcnInst& inst) { return V_MBCNT_U32_B32(true, inst); case Opcode::V_MBCNT_HI_U32_B32: return V_MBCNT_U32_B32(false, inst); + + case Opcode::V_NOP: + return; default: LogMissingOpcode(inst); } From 5691838eca048826edd64a3d11fca9141160609d Mon Sep 17 00:00:00 2001 From: Daniel R <47796739+polybiusproxy@users.noreply.github.com> Date: Sun, 25 Aug 2024 13:17:24 +0200 Subject: [PATCH 2/5] shader_recompiler/frontend: fix V_NOP instruction format --- src/shader_recompiler/frontend/format.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/shader_recompiler/frontend/format.cpp b/src/shader_recompiler/frontend/format.cpp index 8df3ac364..9c4be07b9 100644 --- a/src/shader_recompiler/frontend/format.cpp +++ b/src/shader_recompiler/frontend/format.cpp @@ -1786,8 +1786,7 @@ constexpr std::array InstructionFormatVOP3 = {{ constexpr std::array InstructionFormatVOP1 = {{ // 0 = V_NOP - {InstClass::VectorMisc, InstCategory::VectorALU, 0, 1, ScalarType::Undefined, - ScalarType::Undefined}, + {InstClass::VectorMisc, InstCategory::VectorALU, 0, 1, ScalarType::Any, ScalarType::Any}, // 1 = V_MOV_B32 {InstClass::VectorRegMov, InstCategory::VectorALU, 1, 1, ScalarType::Uint32, ScalarType::Uint32}, From ba140b968063eac7f10524b251a1ffe1f73bc279 Mon Sep 17 00:00:00 2001 From: Daniel R <47796739+polybiusproxy@users.noreply.github.com> Date: Sun, 25 Aug 2024 13:17:59 +0200 Subject: [PATCH 3/5] shader_recompiler/frontend: add information on instruction format assert --- src/shader_recompiler/frontend/decode.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/shader_recompiler/frontend/decode.cpp b/src/shader_recompiler/frontend/decode.cpp index b5c02d747..dda984d57 100644 --- a/src/shader_recompiler/frontend/decode.cpp +++ b/src/shader_recompiler/frontend/decode.cpp @@ -5,6 +5,10 @@ #include "common/assert.h" #include "shader_recompiler/frontend/decode.h" +#define MAGIC_ENUM_RANGE_MIN 0 +#define MAGIC_ENUM_RANGE_MAX 1515 +#include "magic_enum.hpp" + namespace Shader::Gcn { namespace bit { @@ -253,7 +257,9 @@ void GcnDecodeContext::updateInstructionMeta(InstEncoding encoding) { ASSERT_MSG(instFormat.src_type != ScalarType::Undefined && instFormat.dst_type != ScalarType::Undefined, - "TODO: Instruction format table not complete, please fix it manually."); + "Instruction format table incomplete for opcode {} ({}, encoding = {})", + magic_enum::enum_name(m_instruction.opcode), u32(m_instruction.opcode), + magic_enum::enum_name(encoding)); m_instruction.inst_class = instFormat.inst_class; m_instruction.category = instFormat.inst_category; From 977371e7e1888c18f3adc4e77d78421784178c38 Mon Sep 17 00:00:00 2001 From: "Daniel R." <47796739+polybiusproxy@users.noreply.github.com> Date: Sun, 25 Aug 2024 14:06:41 +0200 Subject: [PATCH 4/5] shader_recompiler/frontend: fix `IMAGE_GATHER4_C_LZ` format --- src/shader_recompiler/frontend/format.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shader_recompiler/frontend/format.cpp b/src/shader_recompiler/frontend/format.cpp index 9c4be07b9..36b447b38 100644 --- a/src/shader_recompiler/frontend/format.cpp +++ b/src/shader_recompiler/frontend/format.cpp @@ -3602,8 +3602,8 @@ constexpr std::array InstructionFormatMIMG = {{ {InstClass::VectorMemImgSmp, InstCategory::VectorMemory, 4, 1, ScalarType::Undefined, ScalarType::Undefined}, // 79 = IMAGE_GATHER4_C_LZ - {InstClass::VectorMemImgSmp, InstCategory::VectorMemory, 4, 1, ScalarType::Undefined, - ScalarType::Undefined}, + {InstClass::VectorMemImgSmp, InstCategory::VectorMemory, 4, 1, ScalarType::Uint32, + ScalarType::Uint32}, // 80 = IMAGE_GATHER4_O {InstClass::VectorMemImgSmp, InstCategory::VectorMemory, 4, 1, ScalarType::Undefined, ScalarType::Undefined}, From 3a8a666df0235cfe2b3204d7012f852eddcf92ee Mon Sep 17 00:00:00 2001 From: Daniel R <47796739+polybiusproxy@users.noreply.github.com> Date: Sun, 25 Aug 2024 19:53:45 +0200 Subject: [PATCH 5/5] shader_recompiler/frontend: fix `IMAGE_SAMPLE_CD` format * Seen on Dark Souls --- src/shader_recompiler/frontend/decode.cpp | 2 -- src/shader_recompiler/frontend/format.cpp | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/shader_recompiler/frontend/decode.cpp b/src/shader_recompiler/frontend/decode.cpp index dda984d57..4452b4fda 100644 --- a/src/shader_recompiler/frontend/decode.cpp +++ b/src/shader_recompiler/frontend/decode.cpp @@ -5,8 +5,6 @@ #include "common/assert.h" #include "shader_recompiler/frontend/decode.h" -#define MAGIC_ENUM_RANGE_MIN 0 -#define MAGIC_ENUM_RANGE_MAX 1515 #include "magic_enum.hpp" namespace Shader::Gcn { diff --git a/src/shader_recompiler/frontend/format.cpp b/src/shader_recompiler/frontend/format.cpp index 36b447b38..34bd618cc 100644 --- a/src/shader_recompiler/frontend/format.cpp +++ b/src/shader_recompiler/frontend/format.cpp @@ -3655,8 +3655,8 @@ constexpr std::array InstructionFormatMIMG = {{ {}, {}, // 104 = IMAGE_SAMPLE_CD - {InstClass::VectorMemImgSmp, InstCategory::VectorMemory, 4, 1, ScalarType::Undefined, - ScalarType::Undefined}, + {InstClass::VectorMemImgSmp, InstCategory::VectorMemory, 4, 1, ScalarType::Float32, + ScalarType::Float32}, // 105 = IMAGE_SAMPLE_CD_CL {InstClass::VectorMemImgSmp, InstCategory::VectorMemory, 4, 1, ScalarType::Undefined, ScalarType::Undefined},