This commit is contained in:
Sebastian Kassai 2024-08-20 17:47:22 -04:00 committed by GitHub
commit 8e27c24801
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 23 additions and 4 deletions

View File

@ -425,6 +425,14 @@ spv::ImageFormat GetFormat(const AmdGpu::Image& image) {
image.GetNumberFmt() == AmdGpu::NumberFormat::Unorm) { image.GetNumberFmt() == AmdGpu::NumberFormat::Unorm) {
return spv::ImageFormat::Rgba8; 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 && if (image.GetDataFmt() == AmdGpu::DataFormat::Format8_8_8_8 &&
image.GetNumberFmt() == AmdGpu::NumberFormat::Uint) { image.GetNumberFmt() == AmdGpu::NumberFormat::Uint) {
return spv::ImageFormat::Rgba8ui; return spv::ImageFormat::Rgba8ui;

View File

@ -7,7 +7,7 @@
namespace Shader::Gcn { namespace Shader::Gcn {
u32 GcnInst::BranchTarget(u32 pc) const { u32 GcnInst::BranchTarget(u32 pc) const {
const s16 simm = static_cast<s16>(control.sopp.simm * 4); const s32 simm = static_cast<s32>(control.sopp.simm) * 4;
const u32 target = pc + simm + 4; const u32 target = pc + simm + 4;
return target; return target;
} }

View File

@ -162,18 +162,22 @@ void Translator::S_BARRIER() {
ir.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) { 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])); SetDst(inst.dst[0], GetSrc(inst.src[0]));
} }
void Translator::V_READLANE_B32(const GcnInst& inst) { 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])); SetDst(inst.dst[0], GetSrc(inst.src[0]));
} }
void Translator::V_WRITELANE_B32(const GcnInst& inst) { 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])); SetDst(inst.dst[0], GetSrc(inst.src[0]));
} }

View File

@ -327,6 +327,13 @@ std::unique_ptr<ComputePipeline> PipelineCache::CreateComputePipeline() {
MakeShaderInfo(Shader::Stage::Compute, cs_pgm.user_data, liverpool->regs); MakeShaderInfo(Shader::Stage::Compute, cs_pgm.user_data, liverpool->regs);
info.pgm_base = cs_pgm.Address<uintptr_t>(); info.pgm_base = cs_pgm.Address<uintptr_t>();
info.pgm_hash = compute_key; info.pgm_hash = compute_key;
// TEMP: for Amplitude 2016:
// Skip broken shader with V_MOVREL... instructions:
if (compute_key == 0xc7f34c4f) {
return nullptr;
}
auto program = auto program =
Shader::TranslateProgram(inst_pool, block_pool, code, std::move(info), profile); Shader::TranslateProgram(inst_pool, block_pool, code, std::move(info), profile);