diff options
| author | LagoLunatic <LagoLunatic@users.noreply.github.com> | 2024-06-24 23:21:48 -0400 |
|---|---|---|
| committer | LagoLunatic <LagoLunatic@users.noreply.github.com> | 2024-06-24 23:21:48 -0400 |
| commit | 93a883fabffc23dcac75405bfb8f3df8042f9878 (patch) | |
| tree | 3ecfa261b2a7d116663629a64fa81eda71e53e5c /src/JSystem | |
| parent | f9d40ebad822d9d873e05f0fbe52990dc538179e (diff) | |
Document an obscure bug in J3DGDSetTexCoordScale2
Diffstat (limited to 'src/JSystem')
| -rw-r--r-- | src/JSystem/J3DGraphBase/J3DGD.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/JSystem/J3DGraphBase/J3DGD.cpp b/src/JSystem/J3DGraphBase/J3DGD.cpp index 98561513..5fc3ae45 100644 --- a/src/JSystem/J3DGraphBase/J3DGD.cpp +++ b/src/JSystem/J3DGraphBase/J3DGD.cpp @@ -278,6 +278,9 @@ void J3DGDSetTexCoordGen(GXTexGenType type, GXTexGenSrc src) { void J3DGDSetTexCoordScale2(GXTexCoordID id, u16 scaleS, u8 biasS, u8 wrapS, u16 scaleT, u8 biasT, u8 wrapT) { GDOverflowCheck(15); J3DGDWriteBPCmd(0xFE03FFFF); + // Bug: When id is GX_TEXCOORD_NULL (0xFF), the calculation below winds up producing the wrong + // BP register ID. Instead of a SU_SSIZE and SU_TSIZE register, it effectively negatively + // overflows to the previous registers: RAS1_TREF6 and RAS1_TREF7, potentially corrupting them. J3DGDWriteBPCmd((scaleS - 1) | (biasS << 16) | (wrapS << 17) | (0x30 + id * 2) << 24); J3DGDWriteBPCmd((scaleT - 1) | (biasT << 16) | (wrapT << 17) | (0x31 + id * 2) << 24); } |
