Skip to content

shader_ir: preserve disassembly offsets and validation with a UTF-8 BOM - #8405

Open
AGInformatique81 wants to merge 1 commit into
ItsNotRexed:mainfrom
AGInformatique81:fix/shader-ir-utf8-bom
Open

AGInformatique81 wants to merge 1 commit into
ItsNotRexed:mainfrom
AGInformatique81:fix/shader-ir-utf8-bom

Conversation

@AGInformatique81

@AGInformatique81 AGInformatique81 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Change

Accept an optional UTF-8 BOM at the start of a disassembly listing. The parser preserves the header's start and end offsets, and keeps the first instruction in a headerless file. The shared header matcher also accepts the BOM, so the translator still checks the printed instruction bytes against the blob at the correct offsets.

Coordination claim: #8344 (comment)

This overlaps #5827's read-once optimization in the reader. If that change lands first, the raw listing can still be hashed verbatim and decoded as utf-8-sig for parsing.

Testing

  • On main 23060e0 the new reader test loses the header offset and drops the first headerless instruction. The new translator test also fails because a BOM makes it accept a byte mismatch. All three controls pass with this patch, and matching BOM and non-BOM inputs translate identically.
  • The shader IR, stats and printed-encoding suites passed on Windows 11 (CPython 3.15.2) and WSL2 (CPython 3.14.7), 73 tests on each. The 34 additional G-buffer and shader metadata tests passed on Windows.
  • git diff --check and the changed-file no-game-data check passed.

Synthetic inputs, CPU only. No game files or GPU needed. AI-assisted (Codex).

Integration check

Tested the combined reader with #5827 on main dfe4e4a. All 130 selected tests passed on Windows and WSL2, and a source hash check includes the BOM in the raw digest while preserving assembly and other metadata. Details: #5827 (comment)

@morodirule

Copy link
Copy Markdown

Tested 98166db on Arch Linux, Python 3.14.10, CPU only: pass — first Linux check. test_shader_ir 40/40 + printed_encoding 8/8 + parse 3/3 OK. Negative control: base tool → 2+1 BOM failures; restored, green again. No game files. AI-assisted.

@morodirule

Copy link
Copy Markdown

Tested 98166db on Arch Linux, Python 3.14.10, CPU only: pass — first Linux check. test_shader_ir 40/40 + printed_encoding 8/8 + parse 3/3 OK. Negative control: base tool → BOM tests fail; restored, green again. No game files. AI-assisted.

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.

2 participants