From ece821820d58c5210a74a6ac114f35ceaa38b935 Mon Sep 17 00:00:00 2001 From: xezrunner <8061077+xezrunner@users.noreply.github.com> Date: Tue, 20 Aug 2024 22:55:15 +0200 Subject: [PATCH] Temporary workarounds for Amplitude 2016 --- .../backend/spirv/spirv_emit_context.cpp | 8 ++++++++ .../frontend/translate/data_share.cpp | 10 +++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp b/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp index d61e108f..0e236c6f 100644 --- a/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp +++ b/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp @@ -425,6 +425,14 @@ spv::ImageFormat GetFormat(const AmdGpu::Image& image) { image.GetNumberFmt() == AmdGpu::NumberFormat::Unorm) { return spv::ImageFormat::Rgba8; } + if (image.GetDataFmt() == AmdGpu::DataFormat::Format8_8_8_8 && + image.GetNumberFmt() == AmdGpu::NumberFormat::Srgb) { + // TEMP: for Amplitude 2016 + // The game requests a Format8_8_8_8 SRGB image format. + // Interpreting it as R16Snorm makes the game draw with no major color deviations. + // What should the SRGB format be? + return spv::ImageFormat::R16Snorm; + } if (image.GetDataFmt() == AmdGpu::DataFormat::Format8_8_8_8 && image.GetNumberFmt() == AmdGpu::NumberFormat::Uint) { return spv::ImageFormat::Rgba8ui; diff --git a/src/shader_recompiler/frontend/translate/data_share.cpp b/src/shader_recompiler/frontend/translate/data_share.cpp index b7b5aa13..d0f70c76 100644 --- a/src/shader_recompiler/frontend/translate/data_share.cpp +++ b/src/shader_recompiler/frontend/translate/data_share.cpp @@ -162,18 +162,22 @@ void Translator::S_BARRIER() { ir.Barrier(); } +// TEMP: for Amplitude 2016 +// These are "warp instructions" and are stubbed to work outside of compute shaders. +// The game makes use of them and works fine when the assertions are removed. + void Translator::V_READFIRSTLANE_B32(const GcnInst& inst) { - ASSERT(info.stage != Stage::Compute); + //ASSERT(info.stage != Stage::Compute); SetDst(inst.dst[0], GetSrc(inst.src[0])); } void Translator::V_READLANE_B32(const GcnInst& inst) { - ASSERT(info.stage != Stage::Compute); + //ASSERT(info.stage != Stage::Compute); SetDst(inst.dst[0], GetSrc(inst.src[0])); } void Translator::V_WRITELANE_B32(const GcnInst& inst) { - ASSERT(info.stage != Stage::Compute); + //ASSERT(info.stage != Stage::Compute); SetDst(inst.dst[0], GetSrc(inst.src[0])); }