GPU: constant buffer views of at most 64 KiB #1639
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1640"
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 Marvisak/VIctory. Originally posted by NuraadGit on 2026-11-24T20:18:00Z.
A constant buffer view larger than 65,536 bytes removes the host device (
0x887A0001, "the application made a call that is invalid"). The size the title's descriptor holds went toCreateConstantBufferViewas it was, rounded up to 256. This caps it at 64 KiB, which is all a shader can index.Where such sizes come from. The title's view heap keeps old contents in slots it doesn't use, and the host makes a view for each. In two runs on an RTX 2080 that ended in
0x887A0001, the 64 views made just before the removal included constant buffer views of 969,472 and 896,256 bytes, at addresses that look like leftovers (0x7fe8…).Measured on an RTX 2080 (driver 616.56, Windows 11). One view per process, then
GetDeviceRemovedReason:Test.
an_oversized_constant_buffer_view_leaves_the_device_alivemakes both sizes throughmakeand one throughconstant_at, and checks the device after each. Without the cap it fails at the first one ("a view of 969472 bytes"); with it, it passes.cargo test -p victory-gpu --lib: 51 passed, 1 ignored.cargo clippy -p victory-gpu --all-targets --locked -- -D warnings: clean. Onffe310e.What this doesn't show.
d279e69and7b0f736), which has the same code here. I haven't runmainin the title with and without this change.AI-assisted (Claude Code); counts and log lines only, nothing from the game attached.
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T20:26:20Z.
Review: APPROVED
Verified locally merged onto
origin/main(Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC):cargo test -p victory-gpu— 51 passed, 0 failed (1 ignored) on both RTX 5090 hardware andVICTORY_D3D12_WARP=1(includingan_oversized_constant_buffer_view_leaves_the_device_alive)cargo clippy -p victory-gpu --all-targets— 0 warningscargo xtask policy— okClean clamping of CBV
SizeInBytesto the D3D12 64 KiB maximum so oversized CBVs do not trigger device removal. Looks good.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by NuraadGit on 2026-11-24T20:50:33Z.
In-title result for the cap, on an RTX 2080 (fxceless/victory-gta6
7b0f736+ this change + a diagnostics-only present log, no loop limit, Series X profile).0x7fe8ba580000. The line is logged once per run, so later ones would not show.0x887A0001about 5 to 6.5 minutes after launch, two of them with a view like this among the 64 made last. The probe in the description shows that making one removes the device.It is one session, so it shows that such a view does turn up in the title and that the device stays, not how often the old build would have ended.
AI-assisted (Claude Code); counts and log lines only, nothing from the game attached.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T21:41:52Z.
Review: COMMENTED
Static review only: Windows-only code (D3D12/windows_sys/Win32/HLE) — nothing compiles or runs on macOS; source review of the diff.
CBV SizeInBytes is capped: constant_bytes = min(size, 64 KiB).next_multiple_of(256) — the host removes the device for larger views, and the title's heap holds such sizes in slots it does not use. The Windows test uses a real device and checks GetDeviceRemovedReason stays Ok across oversized views (969_472 and 896_256 bytes). Note the cap interacts with #1629's 256-byte padding — both compose since padding applies after the cap. Windows-only.
Imported from Marvisak/VIctory. Originally posted by NuraadGit on 2026-11-24T23:42:03Z.
Closing this. Since today's push to
main, nothing creates a D3D12 constant buffer view:git grep CreateConstantBufferViewfinds nothing incrates/victory-gpu. Constant views (View::Constant) are now read through raw buffer views over the host copies, so the 64 KiBSizeInByteslimit this PR capped can't be hit any more. The branch also conflicts withmainnow.The fix still matters on fxceless/victory-fork, which does create constant buffer views: fxceless/victory-fork#24. If a later change brings real CBVs back here, I'll reopen this.
Thanks @DenRakEiw for the review and the testing.
Pull request closed