The publisher splash (title idx0) rendered FLAT in ours while canary samples
a texture: ours never decoded the logo's textured pixel shader
(E59B2B3D, a `tfetch2D` sprite) even though our guest IM_LOADs the exact same
microcode canary does (verified byte-identical against the Wine oracle). The
shader was misparsed as flat. Three coupled bugs in the ucode decoder, all
off vs canary `gpu/ucode.h`:
1. CF opcode table was off-by-one (`control_flow.rs`): mapped opcode 0→Exec
and 1→Exit, but Xenos has 0=kNop, 1=kExec, 2=kExecEnd, 3..6/13..14 the
cond-exec variants, 7/8 loop, 9/10 call/return, 11 condjmp, 12 alloc,
15 mark-vs-fetch-done. So a real `kExec` clause was read as a terminal
`Exit`, truncating the CF block and dropping every instruction (incl. the
`tfetch`) after it. Added Nop/MarkVsFetchDone variants; parse now ends on
an END-bit exec clause.
2. exec/loop `address` is an absolute instruction-triple index from shader
dword 0, but indexed our post-CF `instructions` slice directly
(`ucode/mod.rs`). Rebase addresses by the CF triple count so `address*3`
lands on the right instruction.
3. Fetch instruction bitfields were wrong (`ucode/fetch.rs`): `const_index`
read from bit 5 (actually `src_reg`) instead of bit 20, and texture
`dimension` from dword1 instead of dword2 bit14. The logo's `tfetch ..,tf0`
was read as `tf1`, whose empty fetch-constant failed to decode → no
texture. Also the `sequence` fetch/ALU bit is bit[0] of each pair, not
bit[1] (`shader_metrics.rs`, `translator.rs`, `xenos_interp.wgsl`).
Result (--gpu-inline, deterministic 2x): the active PS's `tfetch_slots` now
resolves slot 0, the tf0 fetch-constant decodes (fmt K8888), and
`gpu.texture.decode` fires (137x at -n 50M; texture_cache_entries 0→1, the
only golden field that changed — all draw/swap counts unchanged). The same
fixes correct the WGSL uber-shader's fetch/CF walk for the threaded/--ui path.
Added a regression test that parses the real E59B2B3D microcode and asserts a
tfetch slot is found. Golden re-baselined (texture_cache_entries 0→1).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>