Skip to content

Ignore unaligned terminator bytes in shader fallback disassembly - #3024

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
Vonsek:codex/shader-disasm-aligned-endpgm
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
Vonsek:codex/shader-disasm-aligned-endpgm

Conversation

@Vonsek

@Vonsek Vonsek commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: aligned fallback terminator

What and why

When the code offset is unavailable, the disassembler starts from the first s_endpgm byte pattern. A pattern straddling two dwords can give a clean-looking listing with the real shader missing. Restrict the fallback search to dword-aligned matches.

Tested

AI-assisted (Codex).

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. Inapplicable to the fallback scan.

A terminator byte pattern spanning metadata words can look like a clean one-instruction shader. Search for a dword-aligned instruction before decoding the fallback range.
@kotorvr

kotorvr commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested 6f898a6 on Windows 11 (Python 3.13.7, CPU only, no game files): pass

  • python -I tests/test_shader_disasm.py at the head: 15 tests, OK.
  • Same test file on the merge base 1628210 (tools/shader_disasm.py from main): 1 failure, test_fallback_scan_ignores_unaligned_endpgm (code 0x101..0x105 (scan) instead of ..0x110), so the new test covers the fix.
  • code_range() called directly on the head with blobs that have no header range: empty blob and a truncated 3-byte pattern give no range; a pattern only at offset 1 gives no range; offset 1 followed by one at offset 8 gives end 12; a pattern at offset 0 gives end 4; an aligned pattern at offset 4 preceded by its own first two bytes at offset 2 gives end 8.

Not run: a real llvm-mc (none on this machine; the suite uses its stand-in). AI-assisted check (Claude Code).

@ItsNotRexed
ItsNotRexed merged commit 853bbd0 into ItsNotRexed:main Nov 22, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants