Fix control.sopp.simm flipping sign in CFG label generation

This used to cause a fatal crash that would prevent Amplitude [CUSA02480] from booting beyond initialization.

A conditional true label would get an address starting with 0xffff...., which wasn't realistic with the given shader.

The multiplication by 4 causes the value to have its MSB set due to the smaller type.
This commit is contained in:
xezrunner 2024-08-20 22:48:28 +02:00
parent c60bfbe2a5
commit 42c4d8353a
1 changed files with 1 additions and 1 deletions

View File

@ -7,7 +7,7 @@
namespace Shader::Gcn {
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;
return target;
}