shaders: delegate directory input to shaders.rpf and guard against OOM #1328
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1338"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by Ivankiosan on 2026-11-24T14:58:48Z.
When running
xcl shaders <path>on a game installation directory (such asD:\aa\xbox),collect_filespreviously traversed the whole directory tree, queuing multi-gigabyte archives (levels.rpf76 GB,anim.rpf4.4 GB) intoInput::Files.Input::getthen attemptedstd::fs::readon those archives, causing an immediate panic (memory allocation of 4294967296 bytes failed) before any shader analysis could begin.What is in it
shaders::run: ifpathis a directory containingshaders.rpf, automatically delegates execution toshaders.rpf.collect_files: ignores non-shader extensions (exe,dll,xvd,xml,pri,png,bat) and skips files larger than 512 MiB.Input::get: checks file size withstd::fs::metadatabefore callingstd::fs::read, returningNoneif the file exceeds 512 MiB to guard against OOM.collect_files_filters_non_shader_extensionsverifying non-shader file filtering.Tested
rustc 1.99.1 (58cf8f9c3 2026-10-13)/ MSVC 14.51.cargo test -p xcl --lib shaders: all 6 passed, 0 failed.xcl shaders "D:\aa\xbox" --top 5completes in 6.2 s on the full retail package (26,503 shaders, 44,422,713 RDNA2 instructions) without OOM.Not tested
shaders.rpf.Regression run
main:
PR head:
AI use
std::fs::readOOM panic on large game archives duringxcl shaders <dir>, implementedshaders.rpfdelegation and file size guards, authored unit test, and verified GPU smoke regression.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T15:05:51Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: 708 passed, 0 failed, 21 ignored.Thanks!
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T15:11:06Z.
Full-suite run, since this PR has no test report yet. Tested exact head
9c9e2ca(on its base930e8b4).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.collect_files_filters_non_shader_extensions.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored, no skips.Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T15:56:05Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib -- --test-threads=1: all passed, 0 failed, 21 ignored. (Parallel runs intermittently abort with 0xc0000005 — same harness flake seen on unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by itsSio on 2026-11-25T09:29:54Z.
Tested
Independent check for #1607 on clean #1338 head
9c9e2ca5251d23224e267f8b3f1a913e88ffdbdf(no local merge). Both systems: Windows 11 Pro 26200, x64 MSVC, unoptimized dev/test.cargo build --workspace --lockedexited 0 on both;cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --nocaptureproduced:32.0.16.108832.0.16.1088Both skipped native-wave64 cases
gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware. The RTX 2080 SUPER also skippedtest_title_draws_with_a_root_signature_under_the_debug_layeranduploads_start_from_each_subresources_state(no D3D12 debug layer).collect_files_filters_non_shader_extensionspassed in both full runs.On both PCs,
xcl shadersexited 0 on each of two synthetic directory fixtures: a directory with a 64-byte syntheticshaders.rpfselected that pack instead of the loose neighbor; a directory without a pack kept one small candidate and excluded a dummy.exeand a sparse file of logical size 512 MiB + 1 byte.The RTX 2080 SUPER suite exited 101. The four failing tests and their logged errors were:
placed_title_textures_share_vram_and_preserve_pixels:cubemap extra_pages must be reused at same vatransitions_apply_when_their_list_is_submittedandd32s8_targets_take_their_own_size_of_video_memory:PoisonErrormove_with_locked_overlay_source_preserves_destination:move should succeed after the source handle closesI retested each in its own process on both GPUs at the clean head and its parent
930e8b49c1c2ec683d22c724a398b39111cd0e56usingcargo test -p xcl --lib --locked <fully-qualified-test> -- --exact --test-threads=1 --nocapture. Each of the 16 invocations had 1 passed / 0 failed / 0 ignored / 0 skipped. The failures did not reproduce in isolation; the parallel suite result above remains red, and this comparison does not establish whether the failures reproduce in the parent's parallel suite.Not tested
Retail titles or archives, release mode, an intentional allocation failure on the parent, or a full parallel parent suite.
AI use
Ran via Samaritan:
openai/gpt-6.2-sol): ran the recorded verification, recovered the saved logs, checked the results and drafted this report. The full model-selection history before the interrupted turn could not be verified.Imported from ivall/xcl. Originally posted by S1m0ne1997 on 2026-11-25T14:50:57Z.
Test report for
9c9e2ca5251d23224e267f8b3f1a913e88ffdbdf(this PR's head), for #1607.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09)x86_64-pc-windows-msvc, debug.cargo build --workspace, thencargo test --workspace -- --test-threads=4at the head: 752 passed, 0 failed, 41 ignored.gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu_wave32_program_in_wave64_hardware(no wave64).Regression run (retail title,
scripts/smoke.ps1 -Seconds 60, release;mainbuilt from the commit in its block, this PR from its head with no changes tocrates/, both run with thescripts/smoke.ps1ofmain, which hashes the name of the game folder)main:
this PR:
Not tested
AI use: Claude Code with Claude Opus 5.5 ran the build, the suite and the regression run and wrote this report at my request.
Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-28T22:30:05Z.
A data point for this PR, from current
main(7db2f391):xcl shaders <title folder> --measure-pso <hash>on a newer retail title reached 72,771 MB of process commit before translation began, for two different records, and was stopped by a guard. The title's largest archive is 72,627 MB:record_by_hashreads every collected file whole to hash it. The folder has a 393 MBshaders.rpf, so theshaders.rpfredirect here alone would have avoided it.The PR now conflicts with
mainincrates/xcl/src/shaders.rs(runand the surrounding code moved since9c9e2ca5). I made the equivalent redirect locally onmainto confirm the cause (unit test only; I could not run the rebuilt binary on the title), and will not open a duplicate.Hardware: RTX 3060 12 GB (581.80), i9-14900KF, Windows 11 26200. Claude Code, Claude Opus 5.5 (found the cause, wrote this comment).
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:28:11Z.
Triage (#1607) – head
9c9e2caNo open or merged PR changes how
xcl shaderstreats a folder. On main,runstill sends a folder tocollect_filesand never looks forshaders.rpf.The 512 MB check runs twice, in
collect_filesand inInput::get; once is enough. The extension skip list (exe,dll,xvd,xml,pri,png,bat) is ad hoc. The commit subject should use theShaders:area. The branch conflicts with main.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.