GPU: constant buffer views of at most 64 KiB #1640

Closed
github-bot wants to merge 1 commit from gh-pr/1640/head into gh-pr/1640/base
Owner

@⁠NuraadGit on GitHub · 2026-11-24 20:18 UTC · original
NuraadGit:gpu/constant-view-64k → main · +40 −2 · 1 files · 1 commits · closed without merging

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 to CreateConstantBufferView as 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:

View Device
256 bytes stays
969,472 bytes removed
not on a 256-byte address removed
size not a multiple of 256 removed
256 bytes at an address of no buffer stays

Test. an_oversized_constant_buffer_view_leaves_the_device_alive makes both sizes through make and one through constant_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. On ffe310e.

What this doesn't show.

  • The two runs were on fxceless/victory-gta6 (d279e69 and 7b0f736), which has the same code here. I haven't run main in the title with and without this change.
  • A third run with the same removal reason had no oversized view in its list of 64, so this may not be the only cause.
  • Zero-sized views are left as they are: #1629 handles those and touches the same two lines. Either can be rebased onto the other.

AI-assisted (Claude Code); counts and log lines only, nothing from the game attached.

**@⁠NuraadGit** on GitHub · 2026-11-24 20:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/1640) `NuraadGit:gpu/constant-view-64k` → `main` · +40 −2 · 1 files · 1 commits · closed without merging 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 to `CreateConstantBufferView` as 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`: | View | Device | |---|---| | 256 bytes | stays | | 969,472 bytes | removed | | not on a 256-byte address | removed | | size not a multiple of 256 | removed | | 256 bytes at an address of no buffer | stays | **Test.** `an_oversized_constant_buffer_view_leaves_the_device_alive` makes both sizes through `make` and one through `constant_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. On `ffe310e`. **What this doesn't show.** - The two runs were on fxceless/victory-gta6 (d279e69 and 7b0f736), which has the same code here. I haven't run `main` in the title with and without this change. - A third run with the same removal reason had no oversized view in its list of 64, so this may not be the only cause. - Zero-sized views are left as they are: #1629 handles those and touches the same two lines. Either can be rebased onto the other. AI-assisted (Claude Code); counts and log lines only, nothing from the game attached.
The host removes the device for a constant buffer view of more than 65,536
bytes. The title's view heap holds larger sizes in slots it does not use,
and the size went to the host as it was.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:39:25 +00:00
github-bot closed this pull request 2026-11-26 04:39:25 +00:00
Author
Owner

@⁠NuraadGit on GitHub · 2026-11-24 20:50 UTC · original

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).

  • One session of 17 min 42 s (frame 3,822), ended by me, with 0 device removals.
  • 3 min 15 s in, the cap cut a view of 955,136 bytes at 0x7fe8ba580000. The line is logged once per run, so later ones would not show.
  • Before this change, three runs here ended in 0x887A0001 about 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.

**@⁠NuraadGit** on GitHub · 2026-11-24 20:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/1640#issuecomment-7144129207) 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). - One session of 17 min 42 s (frame 3,822), ended by me, with 0 device removals. - 3 min 15 s in, the cap cut a view of 955,136 bytes at `0x7fe8ba580000`. The line is logged once per run, so later ones would not show. - Before this change, three runs here ended in `0x887A0001` about 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.
Author
Owner

@⁠NuraadGit on GitHub · 2026-11-24 23:42 UTC · original

Closing this. Since today's push to main, nothing creates a D3D12 constant buffer view: git grep CreateConstantBufferView finds nothing in crates/victory-gpu. Constant views (View::Constant) are now read through raw buffer views over the host copies, so the 64 KiB SizeInBytes limit this PR capped can't be hit any more. The branch also conflicts with main now.

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.

**@⁠NuraadGit** on GitHub · 2026-11-24 23:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/1640#issuecomment-7147697462) Closing this. Since today's push to `main`, nothing creates a D3D12 constant buffer view: `git grep CreateConstantBufferView` finds nothing in `crates/victory-gpu`. Constant views (`View::Constant`) are now read through raw buffer views over the host copies, so the 64 KiB `SizeInBytes` limit this PR capped can't be hit any more. The branch also conflicts with `main` now. 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

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1640
No description provided.