hle/dstorage: return exact DirectStorage HRESULTs and isolate per-worker file handles #4363
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!4363
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4362"
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?
@TheOriginalF on GitHub · 2026-11-30 19:20 UTC · original
TheOriginalF:fix/dstorage-error-codes-and-worker-handles→main· +157 −27 · 1 files · 1 commits · closed without mergingWhat it changes
Improves DirectStorage error fidelity, option validation, and worker handle isolation in
crates/victory-hle/src/modules/dstorage.rs:E_DSTORAGE_*HRESULTs instead of generic error codes.SWIZZLE_MODE,SOURCE_PHYSICAL_PAGES, andRESERVED_OPTIONS.WORKER_INDEX(integrated withIo::Windows/read_owned_at) to prevent concurrent DirectStorage workers from interfering on shared file handles.How it was tested
--console series-s --execute), no DLSS / no frame generation, default software RT path,cache-paretobaseline.log(84bd61e2, 503.0 s): 119 DirectStorage info events, 0 errorsall-prs.log(combined branch over84bd61e2, 430.5 s): 119 DirectStorage info events, 0 errors, clean asset streaming across gameplay and cutscenes — no regressionscargo testpassed for the crates it touches: yes (dstorage::— 39 passed, 0 failed, 10 ignored;cargo clippy— 0 new warnings;xtask policy --staged— ok)Checked for overlap
dstorage.rsfor different issues; no overlapping HRESULT/per-worker handle PR found)@babuakhil on GitHub · 2026-11-30 19:31 UTC · original
Checked on Windows 11 (Rust 1.98.1, pinned), applied on current
main(e1251c31); cherry-picks cleanly.cargo test -p victory-hle --lib dstoragegives 39 passed, 0 failed, 10 ignored, two runs out of two, and Clippy reports nothing indstorage.rs. Not tested in the game.A few things I'd look at before this goes in:
1. The per-worker handles already exist on
main.this_thread()is only called fromFiles::read_at, and in a runexecuteis only called fromwork(), so the only threads that ever take a number are thedstorage {i}workers. They get 0, 1, 2… in the order they first read, andothershasavailable_parallelism()slots, at least as many asoff_the_frames_cores()workers. A throwaway test on plainmain(not part of this PR): 8 threads reading one file throughFiles::open_for_testopened 8 handles, one per thread, with bothIo::HandlesandIo::Windows(16 slots on this machine). SoWORKER_INDEXdoesn't change which handle a worker gets in a normal run. It also adds a new way to collide: a non-worker reader (a test, or a future inline path) still numbers itself withthis_thread()from 0 and can land on workeri's handle, whichmainwould not do. If there's a case wheremain's workers did share a handle, it would help to describe it.2. The six
E_DSTORAGE_*values. I couldn't find a public copy ofdstorageerr.hto check0x8924_0007,_000C,_000E,_0031,_0032and_0035against (the NuGet package carries it, but I didn't take it apart). Since these are now what the title receives, and the game run in the description had 0 DirectStorage errors, none of these paths ran in the game. Could you add where the values come from? One point is worth checking in particular: the console's GDK header may not use the PC SDK's numbers.3. Bits 5–20 now say "invalid".
mainrefuses a request with any of bits 5–20 set asE_NOTIMPL("we don't do this"). With this PR it'sE_DSTORAGE_INVALID_SWIZZLE_MODE, which tells the title its request was wrong, although a nonzero swizzle mode may well be valid on the console and only unimplemented here. Bit 23 keepsE_NOTIMPLfor exactly that reason, so the two cases end up inconsistent.4. Overlap with #3387. #3387's
note_damaged_archivetestshr != INVALID_DATA, and this PR removesINVALID_DATA(zlib failures becomeE_DSTORAGE_ZLIB_BAD_HEADERor_BAD_DATA). Whichever lands second will need its check adjusted, or #3387's message will not compile, or will never fire. This PR's newinflateheader test is also the same RFC 1950 check as #3387'sstarts_a_zlib_stream.@TheOriginalF on GitHub · 2026-11-30 21:10 UTC · original
Thanks for the detailed review and for testing this on
main, @babuakhil!Good catches across the board:
main'sthis_thread()already isolates per-worker handles withoutWORKER_INDEX(and avoids colliding with non-worker threads).E_NOTIMPLfor unimplemented swizzle mode bits5..=20is cleaner and more consistent with bit23.INVALID_DATA.Closing this PR to keep the queue clean.
Pull request closed