First-upload admission: size View::Shader textures and skip non-texture/placed-buffer slots #1771
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!1771
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1771"
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?
@Luca121 on GitHub · 2026-11-29 00:01 UTC · original
Luca121:pr/first-upload-admission→main· +62 −7 · 2 files · 1 commits · merged 2026-11-29 08:16 UTCWhat it changes
Fixes two bugs in the
heap_texturesfirst-upload admission path (crates/victory-gpu/src/draw.rs) when VRAM is over the room line (!room):Size
View::Shaderfirst uploads accurately (resource::texture_bytes):placed_lenstayed at its initial1u64for title-filledView::Shadertextures (it was only updated forView::Placed), soroom_for_first_upload(memory, reserve)andfirst_upload_reserve(reserve, memory, reserve)charged 1 byte instead of the texture's real footprint.View::Shadertextures bypass both the 5-second first-upload window cap and free-range size checks (including open PRs#1677/#1544).resource::texture_bytes(this)(parallelingplaced_bytes) and setplaced_lenfor title-filledView::Shadertextures.Exclude placed buffers and non-texture slots from
!roomfirst-upload admission:View::Placed(false, resource, desc)withresource[0] != 1(matchingdraw.rs:3309,6386, anddescriptor/host.rs:1855) so placed buffers don't enter the placed-texture mapped-bytes path.is_textureand guardedif !room && is_textureso empty/overwritten/buffer/UAV/CBV slots reaching!roomretire cleanly downstream instead of passingreserve = 1intoroom_for_first_upload, spammingHEAP_TEXTURES_FIRST_FULL, burning therefusedpass-abort cap, or re-holding dead slots viaTold::Held.How it was tested
626Balanced &720Quality), DLSS 2x Frame Generation.736,542room-line admissions (over 10,000 per 5 s withbytes = 1from non-texture/placed-buffer slots and unsizedView::Shadertextures).bytes = 1room-line admissions on non-texture/placed-buffer slots;View::Shadertextures are budgeted by their actualfootprint(&r.desc).size.cargo testpassed for the crates it touches: yes (cargo test --locked -p victory-gpu --lib -- --test-threads=4— 552 passed, 0 failed, including new unit teststexture_bytes_sizes_textures_and_skips_buffers_and_nullandplaced_buffer_is_excluded_from_texture_check).Checked for overlap
#1677/#1544hardenfirst_upload_decisioninresource.rs, whereas this fixesreserve = 1and non-texture admission indraw.rsthat otherwise bypasses those checks).@upipibi on GitHub · 2026-11-29 00:59 UTC · original
Test report for #1771 (head
f0c5d597), merged--no-ffonto mainf9dfb76. Synthetic tests only: no title run, no game files.Setup: RTX 3070, driver 616.56, Windows 11 (10.0.26100), rustc 1.98.1. WARP runs use
VICTORY_D3D12_WARP=1with
--features diagnostics.The PR's tests, 3x on hardware and 3x on WARP: all pass.
resource::tests::texture_bytes_sizes_textures_and_skips_buffers_and_null: 6/6.draw::first_upload_window_tests::placed_buffer_is_excluded_from_texture_check: 6/6.Both are CPU-only.
create_committedgoes throughMemory::for_resource(title memory), and neither test makes aD3D12 device call, so the hardware and WARP runs test the same thing.
Negative controls
E0425: cannot find function texture_bytes. The helper ispart of the fix, so its test cannot run against the old code.
texture_bytesbut reverting thedraw.rschange (theresource[0] != 1guard,is_texture, andplaced_lenforView::Shader): both tests still pass, on hardware and on WARP.placed_buffer_is_excluded_from_texture_checkchecks the existingplaced_byteson a buffer description andthat
1 != 3. It does not exercise the new guard inheap_textures.(a
View::Shadertitle-filled texture under!roomreachingroom_for_first_uploadwith its real size, and aplaced buffer or empty slot not reaching it) would cover the fix itself.
Temporary device probe (not committed). I created title textures through
create_committedand comparedtexture_byteswith the host device'sGetResourceAllocationInfofor the same description. The results were thesame on hardware and on WARP, 3/3 each:
texture_bytesSo the first upload of these textures is now charged its real size instead of 1 byte. The charge is the title's
footprint, which is at or under what the host device allocates: equal for RGBA16F 256x256, under 1% below for the
two large chains, about 10% below for the BC1 chain, and 16 KiB of a 64 KiB allocation for the 64x64 texture (the
host's 64 KiB alignment).
cargo test -p victory-gpu --lib --lockedf9dfb76--features diagnosticsthe table leaves the probe out.)
watch::tests::what_the_kernel_writes_through_is_not_guarded_for_another_view.That test is unrelated to this PR and shares static state with other
watchtests. It passed in the other threefull runs, and 5/5 alone on the PR and 5/5 alone on main.
Not tested: the effect in a title (the admission counts and the room line).
Tested with the help of Claude Code (Claude Opus 5.5).