DirectStorage: a request's source and zlib intermediate are not zeroed before they are written over #3607
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!3607
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3607"
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?
@tphira612 on GitHub · 2026-11-30 01:39 UTC · original
perf/dstorage-read-no-zero→main· +90 −4 · 1 files · 1 commits · closed without mergingWhat it changes
Every compressed DirectStorage request zeroed its source buffer, and then the file read wrote every byte of it again. The zlib intermediate (zlib then BCPack) was zeroed too, then cut to what the stream wrote. Every byte was written twice, on the workers that stream textures in.
Scratch::for_overwritetakes a spare buffer as it is and zeroes only a part past what it held before. It is used for those two buffers only:read_intofills it whole, or the request fails and the buffer is never read;inflatewritesnbytes and the buffer is truncated tonbefore BCPack reads it.The buffer of a write to scattered pages stays zeroed, since all of it goes to the pages even when a zlib stream ends short. With
VICTORY_DSTORAGE_BUFFERS=0, or aboveSPARE_MAX, buffers arevec![0; len]as before.How it was tested
a_buffer_to_write_over_is_reused_without_zeroing(same memory reused, only the new part zeroed,zeroed()unchanged) anda_source_read_into_a_reused_buffer_is_the_file(a read into a buffer holding other bytes gives exactly the file). The existing spare-buffer tests pass.cargo test --locked -p victory-hle --lib: 424 passed (main 422, plus the two new ones). The one failure,xmem::tests::a_read_by_range_waits_only_for_a_remapping_that_meets_it, also fails onmainin the full run and passes alone.cargo build --release --locked -p victoryandcargo xtask policy --stagedpass. Clippy adds no warnings tovictory-hle.Pull request closed