Shaders: support raw FSSM native program blobs (XDAT kind 0x0c) #3114

Closed
fuzeofficlal wants to merge 1 commit from upstream-pr/3116 into main
fuzeofficlal commented 2026-11-26 08:42:05 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T08:42:05Z.


Summary

  • Extend native_programs in crates/victory-shader/src/native.rs to recognize XDAT entries with kind == 0x0c (KIND_NATIVE_UNPACKED) carrying raw, uncompressed FSSM blobs directly into programs(blob).
  • Preserve existing kind == 0x0d (XBCH zlib-compressed) behavior and skip unknown kinds unchanged.
  • Add synthetic unit tests covering unpacked VS/PS/CS parsing, mixed 0x0c/0x0d/unknown XDAT entries, malformed/truncated FSSM headers, and out-of-bounds XDAT offsets/sizes.

Verification

  • cargo test -p victory-shader --locked -- native::tests::: 17 passed, 0 failed.
  • cargo clippy -p victory-shader --all-targets --locked -- -D warnings: clean.
  • cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings: clean.
  • rustfmt --check --edition 2024 --config skip_children=true crates/victory-shader/src/native.rs: clean.
  • cargo test -p xtask --locked policy::tests::repository_passes_policy: 1 passed, 0 failed.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6622810854 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3116). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T08:42:05Z. --- ## Summary - Extend `native_programs` in `crates/victory-shader/src/native.rs` to recognize `XDAT` entries with `kind == 0x0c` (`KIND_NATIVE_UNPACKED`) carrying raw, uncompressed `FSSM` blobs directly into `programs(blob)`. - Preserve existing `kind == 0x0d` (`XBCH` zlib-compressed) behavior and skip unknown kinds unchanged. - Add synthetic unit tests covering unpacked VS/PS/CS parsing, mixed `0x0c`/`0x0d`/unknown `XDAT` entries, malformed/truncated `FSSM` headers, and out-of-bounds `XDAT` offsets/sizes. ## Verification - `cargo test -p victory-shader --locked -- native::tests::`: 17 passed, 0 failed. - `cargo clippy -p victory-shader --all-targets --locked -- -D warnings`: clean. - `cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings`: clean. - `rustfmt --check --edition 2024 --config skip_children=true crates/victory-shader/src/native.rs`: clean. - `cargo test -p xtask --locked policy::tests::repository_passes_policy`: 1 passed, 0 failed.
Dukestar69 commented 2026-11-26 08:50:38 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T08:50:38Z.

Review: APPROVED


Verified against origin/main (63bcca4):

  • cargo test -p victory-shader --lib native:: -- --test-threads=1: 17/17 passed (including finds_unpacked_programs, reads_mixed_xdat_entries_in_order, rejects_invalid_unpacked_headers, and rejects_out_of_bounds_unpacked_entries).
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Cleanly parses raw FSSM native program blobs (XDAT kind 0x0c) with bounds/header validation.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6070981084 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3116#pullrequestreview-6070981084). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T08:50:38Z. **Review:** APPROVED --- Verified against `origin/main` (`63bcca4`): - `cargo test -p victory-shader --lib native:: -- --test-threads=1`: 17/17 passed (including `finds_unpacked_programs`, `reads_mixed_xdat_entries_in_order`, `rejects_invalid_unpacked_headers`, and `rejects_out_of_bounds_unpacked_entries`). - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Cleanly parses raw FSSM native program blobs (`XDAT` kind `0x0c`) with bounds/header validation. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Marvisak commented 2026-11-26 10:05:04 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T09:19:00Z.


Automated triage for the maintainers.

Needs work: no evidence that the format exists. This makes native_programs (crates/victory-shader/src/native.rs) treat XDAT kind 0x0c as a raw FSSM blob. main knows only kind 0x0d (XBCH-packed) and skips every other kind. The module's layout notes describe what has been observed. This edit removes "as observed in shipped titles" and adds an entry nobody has observed. If the guess is wrong, the change does harm: today a kind 0x0c entry is skipped, but with this PR programs returns Malformed and the whole part fails, including its real 0x0d programs. The tests build only synthetic 0x0c blobs, so they show the parser accepts what the test writes, not that the format is real. To change this verdict, show that kind 0x0c occurs in the title's shader pack, for example a translate --list count of parts with 0x0c entries and what those entries start with. If it does not occur, please close the PR.

CI: check failing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7187773413 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3116#issuecomment-7187773413). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-26T09:19:00Z. --- <!-- victory-triage v1 head=ef15cada969aae1632fc0815f8973be486d2ee35 verdict=needs-work at=2026-11-26T09:19:00Z --> Automated triage for the maintainers. **Needs work: no evidence that the format exists.** This makes `native_programs` (`crates/victory-shader/src/native.rs`) treat XDAT kind 0x0c as a raw FSSM blob. `main` knows only kind 0x0d (XBCH-packed) and skips every other kind. The module's layout notes describe what has been observed. This edit removes "as observed in shipped titles" and adds an entry nobody has observed. If the guess is wrong, the change does harm: today a kind 0x0c entry is skipped, but with this PR `programs` returns `Malformed` and the whole part fails, including its real 0x0d programs. The tests build only synthetic 0x0c blobs, so they show the parser accepts what the test writes, not that the format is real. To change this verdict, show that kind 0x0c occurs in the title's shader pack, for example a `translate --list` count of parts with 0x0c entries and what those entries start with. If it does not occur, please close the PR. CI: `check` failing. --- _Generated by [Claude Code](https://claude.ai/code)_
Venom2054 commented 2026-11-26 10:05:05 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Venom2054 on 2026-11-26T09:26:12Z.


I checked the XDAT entry kinds in one title shader pack. I decompressed the 26,503 DXBC records, deduplicated by the declared DXBC container bytes, and read the entry table in each DXIL part. This gave 25,889 distinct containers, matching the translator’s warm-up count. All 25,889 contained an XDAT table.

XDAT kind Entries
0x07 25,889
0x0c 0
0x0d 26,084
0x12 25,889

Every 0x0d payload started with XBCH. On this pack, no shader would reach the proposed raw-FSSM branch. Other packs or compiler versions could differ.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7187985742 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3116#issuecomment-7187985742). Originally posted by [Venom2054](https://github.com/Venom2054) on 2026-11-26T09:26:12Z. --- I checked the XDAT entry kinds in one title shader pack. I decompressed the 26,503 DXBC records, deduplicated by the declared DXBC container bytes, and read the entry table in each DXIL part. This gave 25,889 distinct containers, matching the translator’s warm-up count. All 25,889 contained an XDAT table. | XDAT kind | Entries | | --- | ---: | | `0x07` | 25,889 | | `0x0c` | 0 | | `0x0d` | 26,084 | | `0x12` | 25,889 | Every `0x0d` payload started with `XBCH`. On this pack, no shader would reach the proposed raw-FSSM branch. Other packs or compiler versions could differ.
fuzeofficlal commented 2026-11-26 16:27:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T16:27:22Z.


Closing per triage feedback and @Venom2054's check showing zero XDAT kind 0x0c entries in real shader packs; happy to revisit if kind 0x0c is ever observed.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7197668726 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3116#issuecomment-7197668726). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T16:27:22Z. --- Closing per triage feedback and @Venom2054's check showing zero XDAT kind `0x0c` entries in real shader packs; happy to revisit if kind `0x0c` is ever observed.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!3114
No description provided.