app: pin shader::sources (SGD5 records and the raw DXBC scan) with unit tests #467

Merged
AnastasisKon merged 2 commits from upstream-pr/467 into main 2026-11-28 01:34:49 +00:00
AnastasisKon commented 2026-11-27 21:31:00 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-27T21:31:00Z.


What this changes

Refs #465. One change: unit tests for apps/victory/src/shader.rs's sources(), the function behind victory shader and the pre-build. No production code changes.

Pinned behavior, with synthetic bytes only (a hand-built DXBC header, a hand-built stored-deflate SGD5 record — no game data, no new dependencies):

  • input without magic yields nothing; a DXBC magic whose size field disagrees with the data is skipped, while a valid container after a fake magic is still found;
  • every raw container in a file is found, in offset order, and a raw source keeps the whole tail from the magic (Container::parse bounds it by the size field) with the @0x… label;
  • an SGD5 record found by the marker scan is listed as Packed first, labeled with offset and name, and unpacks to its container; the raw scan also finds the container inside the stored payload;
  • a corrupt record (reserved deflate block type) is still listed, but bytes() returns None.

How it was tested

  • cargo test -p victory — 13 lib tests pass, including the 5 new shader::sources_tests; integration tests pass (run on the arm64 host, toolchain 1.98.1)
  • cargo test -p victory-hle -p xtask — pass (144 + 2 native-probe + 6 xtask); cargo test -p victory-gpu — 402 passed, 10 failed, all ten pre-existing dlopen libmetalirconverter.dylib failures on this Mac without Apple's Metal Shader Converter (#379); CI runs that suite on Windows
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings — pass
  • cargo xtask policy — pass (398 files ok)
  • Ran the game: not needed (test-only change)

Checklist

  • No game files, game code, disassembly listings or SDK files are included (synthetic bytes only)
  • Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md — n/a, no behaviour change
  • New diagnostics are behind a VICTORY_* variable and documented — n/a, none added
<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:5533334913 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/467). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-27T21:31:00Z. --- ## What this changes Refs #465. One change: unit tests for `apps/victory/src/shader.rs`'s `sources()`, the function behind `victory shader` and the pre-build. No production code changes. Pinned behavior, with synthetic bytes only (a hand-built DXBC header, a hand-built stored-deflate SGD5 record — no game data, no new dependencies): - input without magic yields nothing; a `DXBC` magic whose size field disagrees with the data is skipped, while a valid container after a fake magic is still found; - every raw container in a file is found, in offset order, and a raw source keeps the whole tail from the magic (`Container::parse` bounds it by the size field) with the `@0x…` label; - an SGD5 record found by the marker scan is listed as `Packed` first, labeled with offset and name, and unpacks to its container; the raw scan also finds the container inside the stored payload; - a corrupt record (reserved deflate block type) is still listed, but `bytes()` returns `None`. ## How it was tested - [x] `cargo test -p victory` — 13 lib tests pass, including the 5 new `shader::sources_tests`; integration tests pass (run on the arm64 host, toolchain 1.98.1) - [x] `cargo test -p victory-hle -p xtask` — pass (144 + 2 native-probe + 6 xtask); `cargo test -p victory-gpu` — 402 passed, 10 failed, all ten pre-existing `dlopen libmetalirconverter.dylib` failures on this Mac without Apple's Metal Shader Converter (#379); CI runs that suite on Windows - [x] `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings` — pass - [x] `cargo xtask policy` — pass (398 files ok) - [x] Ran the game: not needed (test-only change) ## Checklist - [x] No game files, game code, disassembly listings or SDK files are included (synthetic bytes only) - [x] Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md — n/a, no behaviour change - [x] New diagnostics are behind a `VICTORY_*` variable and documented — n/a, none added
Olima34 commented 2026-11-28 01:34:46 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-28T01:34:46Z.

Review: APPROVED


Check report (helping the maintainer clear the queue):

  • CI: check and macos-scripts green on the current head.
  • Read: the whole diff (tests only). It pins shader::sources: raw DXBC scan, SGD5 records, fake magics, corrupt records. All inputs are synthetic.
  • Local check: current main (226645f9) merged with this PR and the other test/docs/tools PRs we're landing in this batch (#397 #399 #422 #467 #471 #475 #479 #481 #486 #489 #494 #498 #505 #511). On it, the victory-gpu (arm64), victory-shader, victory-backend, victory-metal and victory tests pass, as do the macOS script tests (rustup-path.sh, run-summary-compare.sh, run-summary.sh --self-test), Windows clippy (-D warnings) and cargo xtask policy. One victory-gpu run in four failed main's own multi_mip_array_and_placed_depth_twins_preserve_all_subresources_and_remirror_immediately. That test also flakes on main alone, so it isn't from this batch.
  • Not checked: no game run (the maintainer asked us to work on GitHub only).

Thanks @AnastasisKon!

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:review:6094919766 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/467#pullrequestreview-6094919766). Originally posted by [Olima34](https://github.com/Olima34) on 2026-11-28T01:34:46Z. **Review:** APPROVED --- Check report (helping the maintainer clear the queue): - **CI:** `check` and `macos-scripts` green on the current head. - **Read:** the whole diff (tests only). It pins `shader::sources`: raw DXBC scan, SGD5 records, fake magics, corrupt records. All inputs are synthetic. - **Local check:** current main (226645f9) merged with this PR and the other test/docs/tools PRs we're landing in this batch (#397 #399 #422 #467 #471 #475 #479 #481 #486 #489 #494 #498 #505 #511). On it, the `victory-gpu` (arm64), `victory-shader`, `victory-backend`, `victory-metal` and `victory` tests pass, as do the macOS script tests (`rustup-path.sh`, `run-summary-compare.sh`, `run-summary.sh --self-test`), Windows clippy (`-D warnings`) and `cargo xtask policy`. One `victory-gpu` run in four failed main's own `multi_mip_array_and_placed_depth_twins_preserve_all_subresources_and_remirror_immediately`. That test also flakes on main alone, so it isn't from this batch. - **Not checked:** no game run (the maintainer asked us to work on GitHub only). Thanks @AnastasisKon!
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
LakshanSivakumar/Native-Victory-macOS!467
No description provided.