CLI: discover compressed shader packs in archives without SGD5 or header magic #3002

Closed
fuzeofficlal wants to merge 1 commit from upstream-pr/3004 into main
fuzeofficlal commented 2026-11-26 03:09:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T03:09:07Z.


Summary

  • Decouple shader-pack discovery from shader-container indexing in apps/victory/src/prebuild.rs via collect_inputs and find_pack.
  • Keep the existing fast paths first (standalone PS\0\x09 files and SGD5 shader files), and fall back to calling shaderpack::find on remaining DXBC-only shader files and non-shader archive files within MAX_FILE (releasing non-shader file bytes during collection and keeping them out of shader_files).
  • Fixes victory translate --cache --pipelines skipping valid archives whose shader pack lives inside 16-byte-aligned zlib streams without a leading PS\0\x09 header or SGD5 marker.
  • Add 3 synthetic unit tests covering compressed pack-only archives, DXBC-plus-compressed-pack archives without SGD5, fast-path precedence/short-circuiting, and clean None handling without polluting shader_files.

Verification

  • rustfmt --edition 2024 --check apps/victory/src/prebuild.rs: ok.
  • cargo test -p victory --locked: 17 unit tests + 4 integration tests passed.
  • cargo clippy -p victory --locked --all-targets -- -D warnings (default and --all-features): 0 warnings.
  • cargo xtask policy: 191 files ok.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6618639693 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3004). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T03:09:07Z. --- ## Summary - Decouple shader-pack discovery from shader-container indexing in `apps/victory/src/prebuild.rs` via `collect_inputs` and `find_pack`. - Keep the existing fast paths first (standalone `PS\0\x09` files and `SGD5` shader files), and fall back to calling `shaderpack::find` on remaining `DXBC`-only shader files and non-shader archive files within `MAX_FILE` (releasing non-shader file bytes during collection and keeping them out of `shader_files`). - Fixes `victory translate --cache --pipelines` skipping valid archives whose shader pack lives inside 16-byte-aligned zlib streams without a leading `PS\0\x09` header or `SGD5` marker. - Add 3 synthetic unit tests covering compressed pack-only archives, `DXBC`-plus-compressed-pack archives without `SGD5`, fast-path precedence/short-circuiting, and clean `None` handling without polluting `shader_files`. ## Verification - `rustfmt --edition 2024 --check apps/victory/src/prebuild.rs`: ok. - `cargo test -p victory --locked`: 17 unit tests + 4 integration tests passed. - `cargo clippy -p victory --locked --all-targets -- -D warnings` (default and `--all-features`): 0 warnings. - `cargo xtask policy`: 191 files ok.
kotekompotek commented 2026-11-26 05:03:47 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T04:40:23Z.

Review: APPROVED


LGTM — the Inputs split (direct_pack vs shader_files vs deferred other_paths) keeps the fast path cheap while letting the compressed-pack fallback scan only when needed; pack_path Cow threading is consistent.

<!-- greyfinch-sync:Marvisak/VIctory:review:6068633875 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3004#pullrequestreview-6068633875). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-26T04:40:23Z. **Review:** APPROVED --- LGTM — the Inputs split (direct_pack vs shader_files vs deferred other_paths) keeps the fast path cheap while letting the compressed-pack fallback scan only when needed; pack_path Cow threading is consistent.
futurepro62 commented 2026-11-26 05:04:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-26T04:35:36Z.


Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head 025b12d (on its base 63bcca4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), dxil.dll from Windows SDK 10.0.26100 (the loader's default), debug.
  • cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 869 passed, 0 failed, 10 ignored.
  • The new tests ran and passed: finds_compressed_pack_only_archive_without_polluting_shader_files, finds_compressed_pack_in_dxbc_archive_without_sgd5_magic, prefers_direct_magic_and_sgd5_fast_paths_and_returns_none_when_absent.
  • --skip leaves out tests that fail on main 63bcca4 on this card too, not because of this PR: heap_direct_texture_reads_mark_their_heap_index ends the victory-shader test process with 0xc0000005 (#2571), so without the skip the rest of that crate never reports; dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and the two stride_tests hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); gathers_at_a_level_match_the_hardware fails on lane 0 (#1744).

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7182729911 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3004#issuecomment-7182729911). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-26T04:35:36Z. --- Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head `025b12d` (on its base `63bcca4`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), `dxil.dll` from Windows SDK 10.0.26100 (the loader's default), debug. - `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware`: **869 passed, 0 failed, 10 ignored**. - The new tests ran and passed: `finds_compressed_pack_only_archive_without_polluting_shader_files`, `finds_compressed_pack_in_dxbc_archive_without_sgd5_magic`, `prefers_direct_magic_and_sgd5_fast_paths_and_returns_none_when_absent`. - `--skip` leaves out tests that fail on main `63bcca4` on this card too, not because of this PR: `heap_direct_texture_reads_mark_their_heap_index` ends the `victory-shader` test process with `0xc0000005` (#2571), so without the skip the rest of that crate never reports; `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and the two `stride_tests` hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); `gathers_at_a_level_match_the_hardware` fails on lane 0 (#1744). **Not tested** - AMD (the tests take the default adapter), a release build, the title (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Marvisak commented 2026-11-26 06:03:48 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T05:45:36Z.


Automated triage for the maintainers.

Verdict: needs work. The refactor in apps/victory/src/prebuild.rs (collect_inputs, find_pack) looks right as written. shaderpack::find (victory-game/src/shaderpack.rs) already inflates a pack stored as 16-byte-aligned zlib streams, so this PR only widens which files run hands to it: DXBC-only shader files, and then any other file under MAX_FILE that is re-read and scanned.

What's missing is evidence that this case exists. main looks for the pack in files that start with PS\0\x09 or are SGD5, because, as the removed comment says, it ships beside the shader databases. The PR doesn't show a real install where the pack sits in a file without either marker. The tests build synthetic archives (RPF_NO_MAGIC_HDR plus a stored zlib stream) and only show that the new search finds what they plant. If no real layout needs it, the fallback adds a second read and a zlib scan of every unrelated file whenever the pack is missing, which is the case where run should just print "no shader pack" and stop.

To change the verdict, describe a real case where victory translate --cache --pipelines reported no shader pack on a valid install (file layout only, no game data) and this PR found it.

CI: passing (check).


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7183779737 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3004#issuecomment-7183779737). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-26T05:45:36Z. --- <!-- victory-triage v1 head=025b12db97092fdb8d75147cd6afd52054220872 verdict=needs-work at=2026-11-26T05:45:23Z --> Automated triage for the maintainers. **Verdict: needs work.** The refactor in `apps/victory/src/prebuild.rs` (`collect_inputs`, `find_pack`) looks right as written. `shaderpack::find` (`victory-game/src/shaderpack.rs`) already inflates a pack stored as 16-byte-aligned zlib streams, so this PR only widens which files `run` hands to it: DXBC-only shader files, and then any other file under `MAX_FILE` that is re-read and scanned. What's missing is evidence that this case exists. `main` looks for the pack in files that start with `PS\0\x09` or are SGD5, because, as the removed comment says, it ships beside the shader databases. The PR doesn't show a real install where the pack sits in a file without either marker. The tests build synthetic archives (`RPF_NO_MAGIC_HDR` plus a stored zlib stream) and only show that the new search finds what they plant. If no real layout needs it, the fallback adds a second read and a zlib scan of every unrelated file whenever the pack is missing, which is the case where `run` should just print "no shader pack" and stop. To change the verdict, describe a real case where `victory translate --cache --pipelines` reported no shader pack on a valid install (file layout only, no game data) and this PR found it. CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
upstream-sync closed this pull request 2026-11-26 07:01:03 +00:00
fuzeofficlal commented 2026-11-26 07:01:43 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T06:09:08Z.


Fair point from triage — I do not have a real install layout where the shader pack lives outside a PS\0\x09 file or an SGD5 archive, and scanning unrelated files on a missing-pack run adds unnecessary I/O. Closing to keep the queue clean; happy to revisit if a real install layout needs it.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7184141994 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3004#issuecomment-7184141994). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T06:09:08Z. --- Fair point from triage — I do not have a real install layout where the shader pack lives outside a `PS\0\x09` file or an `SGD5` archive, and scanning unrelated files on a missing-pack run adds unnecessary I/O. Closing to keep the queue clean; happy to revisit if a real install layout needs it.

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!3002
No description provided.