gcn: MIMG lowering passes TFE/R128/LWE bits through, but RDNA2 reinterprets them as D16/A16/reserved #114
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator#114
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Trwthh on GitHub · 2026-11-22 10:23 UTC · original
Bug
In
crates/tombox-xshader/src/gcn.rs:388-391, the GCN MIMG→RDNA2 conversion only clears bit 14 (DA) and injects the dim field. All other control bits are passed through verbatim:Problem
GCN GFX7 and RDNA2 have different bit semantics at the same positions:
If a GCN shader sets:
Fix
After clearing DA and writing dim, also clear bits 15, 16, and 17, and handle TFE/R128 appropriately (TFE needs an extra VGPR for the status; R128 affects return width; both are uncommon in Xbox One shaders but valid).
Impact
Medium. TFE and LWE are rare in real shaders, but R128 is used by cubemap samplers on some titles. Any Trackmania or future Xbox One title shader that sets one of these bits will produce silently wrong texture loads.
@omonkeyz on GitHub · 2026-11-22 14:05 UTC · original
Fix details:
d585b945(batch commit). The bit table in the report does not match RDNA2: R128, TFE and LWE sit at the same dword-0 bits 15/16/17 on GFX7 and on RDNA2. D16 and A16 are dword-1 bits 31/30 (our decoder reads D16 there), and SLC is bit 25. So the lowering never turned TFE into D16 or R128 into A16. But the translator did ignore all three bits. Now both the GFX7->RDNA2 lowering (gcn.rs) and the RDNA2 emitter (emit_mimg) refuse them with a named error. None of the 3515 cached title shaders sets any of them, so no current title changes. Implementing them is tracked in docs/BLOCKERS.md. Tests: mimg_r128_tfe_lwe_are_refused_instead_of_passed_through and image_ops_with_status_or_r128_bits_are_refused. Thanks.