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

Manually merged
github merged 2 commits from github-bot/gh-467 into main 2026-11-28 01:36:54 +00:00 AGit
Owner

@⁠AnastasisKon on GitHub · 2026-11-27 21:31 UTC · original
AnastasisKon:vibe/shader-sources-tests-1705ac → main · +148 −0 · 1 files · 2 commits · merged 2026-11-28 01:34 UTC

What this changes

Refs #469. 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 (#382); 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
**@⁠AnastasisKon** on GitHub · 2026-11-27 21:31 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/467) `AnastasisKon:vibe/shader-sources-tests-1705ac` → `main` · +148 −0 · 1 files · 2 commits · merged 2026-11-28 01:34 UTC ## What this changes Refs #469. 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 (#382); 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
Refs #465. sources() feeds both 'victory shader' and the pre-build; pin its
exact behavior with synthetic bytes (hand-built DXBC header, hand-built
stored-deflate SGD5 record): empty input, a fake magic whose size field
disagrees, raw containers found in order at their offsets with the whole
tail kept, a packed record's label/offset/unpack, and a corrupt record
listed but yielding no bytes.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 21:32:09 +00:00
github manually merged commit 94affd2d2f into main 2026-11-28 01:36:54 +00:00
Author
Owner

@⁠Olima34 on GitHub · 2026-11-28 01:34 UTC · original · approved these changes

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 (#401 #403 #426 #471 #475 #479 #483 #485 #490 #493 #498 #502 #509 #515). 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!

**@⁠Olima34** on GitHub · 2026-11-28 01:34 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/467#pullrequestreview-6094919766) · **approved these changes** 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 (#401 #403 #426 #471 #475 #479 #483 #485 #490 #493 #498 #502 #509 #515). 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!
This discussion has been locked. Commenting is limited to contributors.
No description provided.