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

Open
NuraadGit wants to merge 1 commit from upstream-pr/24 into main
NuraadGit commented 2026-11-24 20:22:37 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by NuraadGit on 2026-11-24T20:22:37Z.


The fix I described in #5, as a PR on 1684989. The same change is Marvisak/VIctory#1640 (the code is the same there).

A constant buffer view of more than 65,536 bytes removes the host device (0x887A0001). The size from the title's descriptor went to CreateConstantBufferView as it was. The heap keeps old contents in slots the title doesn't use, and a view is made for each. In two runs on an RTX 2080 that ended that way, the last 64 views (your the host device went while buffer views of the heap were made list) included constant buffer views of 969,472 and 896,256 bytes. This caps them at 64 KiB, which is all a shader can index.

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 ("a view of 969472 bytes"); with it, it passes. cargo test -p victory-gpu --lib on an RTX 2080: 111 passed, 1 ignored. cargo clippy -p victory-gpu --all-targets --locked -- -D warnings: clean.

Not shown: I haven't run the title with this yet, and a third run with the same removal had no oversized view in its list, so it may not be the only cause. A probe on the same card shows that a view not on a 256-byte address, or of a size that isn't a multiple of 256, also removes the device; make already guards against both.

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

<!-- greyfinch-sync:fxceless/victory-fork:issue:6590675197 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/24). Originally posted by [NuraadGit](https://github.com/NuraadGit) on 2026-11-24T20:22:37Z. --- The fix I described in #5, as a PR on `1684989`. The same change is Marvisak/VIctory#1640 (the code is the same there). A constant buffer view of more than 65,536 bytes removes the host device (`0x887A0001`). The size from the title's descriptor went to `CreateConstantBufferView` as it was. The heap keeps old contents in slots the title doesn't use, and a view is made for each. In two runs on an RTX 2080 that ended that way, the last 64 views (your `the host device went while buffer views of the heap were made` list) included constant buffer views of 969,472 and 896,256 bytes. This caps them at 64 KiB, which is all a shader can index. **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 ("a view of 969472 bytes"); with it, it passes. `cargo test -p victory-gpu --lib` on an RTX 2080: 111 passed, 1 ignored. `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings`: clean. **Not shown:** I haven't run the title with this yet, and a third run with the same removal had no oversized view in its list, so it may not be the only cause. A probe on the same card shows that a view not on a 256-byte address, or of a size that isn't a multiple of 256, also removes the device; `make` already guards against both. AI-assisted (Claude Code); counts and log lines only, nothing from the game attached.
chatgpt-codex-connector[bot commented 2026-11-24 21:30:39 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T20:22:47Z.


Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T20:24:32.214968Z 1d2f476 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7143455524 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/24#issuecomment-7143455524). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T20:22:47Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"1d2f4763029c3e488cfeafada1d9e1d8aa3a3dbc","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T20:24:32.214968Z">2026-11-24T20:24:32.214968Z</relative-time> | `1d2f476` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
rafaconvaitis commented 2026-11-24 21:30:40 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by rafaconvaitis on 2026-11-24T20:45:31Z.


Independent Windows 11 result on an RTX 4070 (driver 32.0.16.1664), Series X mode, pinned 578d459 with local adapter selection and test input. One run reached the lit prologue and later reported DXGI_ERROR_INVALID_CALL (0x887A0001) during the buffer-view mirror pass. The last 64 sampled views included an aligned CBV of 1,228,032 bytes. At removal, 105,231 submissions had started and finished, with no submission in flight. The sample does not identify which creation call triggered removal.

In a synthetic D3D12 WARP probe with the debug layer, the same aligned, 1,228,032-byte backing allocation left the device at S_OK with a 65,536-byte view. Asking for a 1,228,032-byte view produced message 650 and 0x887A0001 before any GPU submission. That corroborates the API failure at the observed size. A separate 30m56s run without this PR reached controllable gameplay and had neither device removal nor message 650. I have not tested the cap from this PR in the title. The in-title trigger remains unconfirmed.

AI-assisted capture and log analysis. No title data attached.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7144016878 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/24#issuecomment-7144016878). Originally posted by [rafaconvaitis](https://github.com/rafaconvaitis) on 2026-11-24T20:45:31Z. --- Independent Windows 11 result on an RTX 4070 (driver 32.0.16.1664), Series X mode, pinned `578d459` with local adapter selection and test input. One run reached the lit prologue and later reported `DXGI_ERROR_INVALID_CALL` (`0x887A0001`) during the buffer-view mirror pass. The last 64 sampled views included an aligned CBV of 1,228,032 bytes. At removal, 105,231 submissions had started and finished, with no submission in flight. The sample does not identify which creation call triggered removal. In a synthetic D3D12 WARP probe with the debug layer, the same aligned, 1,228,032-byte backing allocation left the device at `S_OK` with a 65,536-byte view. Asking for a 1,228,032-byte view produced message 650 and `0x887A0001` before any GPU submission. That corroborates the API failure at the observed size. A separate 30m56s run without this PR reached controllable gameplay and had neither device removal nor message 650. I have not tested the cap from this PR in the title. The in-title trigger remains unconfirmed. AI-assisted capture and log analysis. No title data attached.
NuraadGit commented 2026-11-24 21:30:40 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by NuraadGit on 2026-11-24T20:50:35Z.


In-title result for this, on an RTX 2080 (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 Marvisak/VIctory#1640) 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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7144129713 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/24#issuecomment-7144129713). Originally posted by [NuraadGit](https://github.com/NuraadGit) on 2026-11-24T20:50:35Z. --- In-title result for this, on an RTX 2080 (`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 Marvisak/VIctory#1640) 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.
adriaespii commented 2026-11-24 21:30:42 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by adriaespii on 2026-11-24T21:04:10Z.


Independent test run on commit 1d2f476 (AMD RDNA4):

  • Hardware: AMD Radeon RX 9070 (driver 32.0.32015.7029), AMD Ryzen 5 7600, Windows 11 Pro, Rust 1.98.1 (x86_64-pc-windows-msvc)
  • cargo clippy --workspace --all-targets -- -D warnings: 0 warnings
  • cargo test --workspace: 497 passed, 0 failed, 7 ignored (victory-gpu: 111 passed, 0 failed, 1 ignored; victory-shader: 210 passed, 0 failed, 2 ignored)
  • Not tested: live game run (no game files on this machine)

AI use: Antigravity (Gemini 4 Neon) ran clippy/tests locally and wrote this report.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7144433612 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/24#issuecomment-7144433612). Originally posted by [adriaespii](https://github.com/adriaespii) on 2026-11-24T21:04:10Z. --- Independent test run on commit `1d2f476` (AMD RDNA4): - **Hardware:** AMD Radeon RX 9070 (driver 32.0.32015.7029), AMD Ryzen 5 7600, Windows 11 Pro, Rust 1.98.1 (`x86_64-pc-windows-msvc`) - `cargo clippy --workspace --all-targets -- -D warnings`: 0 warnings - `cargo test --workspace`: 497 passed, 0 failed, 7 ignored (`victory-gpu`: 111 passed, 0 failed, 1 ignored; `victory-shader`: 210 passed, 0 failed, 2 ignored) - **Not tested:** live game run (no game files on this machine) *AI use: Antigravity (Gemini 4 Neon) ran clippy/tests locally and wrote this report.*
arminkhaleghirod commented 2026-11-24 21:30:43 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by arminkhaleghirod on 2026-11-24T21:18:14Z.


Ran the game with this (1d2f476) on an RTX 4080, Windows 11, Series X profile, default settings. 5.5 min from boot into the opening cutscene. No device loss, no 0x887A0001. 0.7–1.8 fps in the cutscene.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7144750716 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/24#issuecomment-7144750716). Originally posted by [arminkhaleghirod](https://github.com/arminkhaleghirod) on 2026-11-24T21:18:14Z. --- Ran the game with this (1d2f476) on an RTX 4080, Windows 11, Series X profile, default settings. 5.5 min from boot into the opening cutscene. No device loss, no `0x887A0001`. 0.7–1.8 fps in the cutscene.
Aminou973 commented 2026-11-24 23:09:34 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Aminou973 on 2026-11-24T22:20:53Z.


Confirmed on an RTX 3080 10 GB (Windows 11, driver 621.14). Without this change the device is removed with INVALID_CALL at frames 2,498 and 3,387 (debug layer: CreateConstantBufferView: Size of 2785536 exceeds maximum constant buffer view size). With the same clamp there is no removal over 3,400–4,400 frames and the prologue renders (details in #72). AI-assisted.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7146117283 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/24#issuecomment-7146117283). Originally posted by [Aminou973](https://github.com/Aminou973) on 2026-11-24T22:20:53Z. --- Confirmed on an RTX 3080 10 GB (Windows 11, driver 621.14). Without this change the device is removed with `INVALID_CALL` at frames 2,498 and 3,387 (debug layer: `CreateConstantBufferView: Size of 2785536 exceeds maximum constant buffer view size`). With the same clamp there is no removal over 3,400–4,400 frames and the prologue renders (details in #72). AI-assisted.
ericomeehan commented 2026-11-25 00:10:07 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by ericomeehan on 2026-11-24T23:28:11Z.


The evidence in this thread is unusually strong: four cards with before/after runs, and the debug layer naming the oversized view, so the cause looks settled.

One small test thing: in an_oversized_constant_buffer_view_leaves_the_device_alive, the three constant_bytes asserts come after the let Some(host) = host() else { return; } early return, so on a machine without a GPU (CI runners, for one) the test passes without checking the rounding at all. A separate CPU-only test for constant_bytes (480 → 512, 64 KiB → 64 KiB, u32::MAX → 64 KiB) would get those checked everywhere. The same applies to the port in Marvisak/VIctory#1640.

Written with an AI assistant (Claude).

<!-- greyfinch-sync:fxceless/victory-fork:comment:7147435298 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/24#issuecomment-7147435298). Originally posted by [ericomeehan](https://github.com/ericomeehan) on 2026-11-24T23:28:11Z. --- The evidence in this thread is unusually strong: four cards with before/after runs, and the debug layer naming the oversized view, so the cause looks settled. One small test thing: in `an_oversized_constant_buffer_view_leaves_the_device_alive`, the three `constant_bytes` asserts come after the `let Some(host) = host() else { return; }` early return, so on a machine without a GPU (CI runners, for one) the test passes without checking the rounding at all. A separate CPU-only test for `constant_bytes` (480 → 512, 64 KiB → 64 KiB, `u32::MAX` → 64 KiB) would get those checked everywhere. The same applies to the port in Marvisak/VIctory#1640. Written with an AI assistant (Claude).
tippythetaidum commented 2026-11-25 12:07:04 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by tippythetaidum on 2026-11-25T11:52:38Z.


Test report on current main (f85101b), RTX 5080 16 GB, driver 621.14, Windows 11, Series X profile, diagnostics build, default settings (so the relay is on).

Without this change, f85101b loses the device at world entry here: 2 runs of 2.

Run Tree Result
A f85101b device removed (0x887A0001) 2 min 1 s after launch, as the opening cutscene starts; "the host device went while buffer views of the heap were made"
B f85101b, VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_DRED=1 device removed 2 min 10 s after launch; the debug layer's last message before RemoveDevice is the one below
C f85101b + this PR's commit cherry-picked (applies clean) full 11 min (stopped by my timeout), 80,000+ submissions, 4,037 frames, 0 device removals, through the opening cutscene into the prison interior

Run B, the two lines in order:

D3D12: ID3D12Device::CreateConstantBufferView: Size of 1406720 exceeds maximum constant buffer view size of 65536. id=650 severity=1
D3D12: ID3D12Device::RemoveDevice: Device removal has been triggered for the following reason (DXGI_ERROR_INVALID_CALL: ...). id=232 severity=1

Note for anyone reading run A's kind of log: the list of the last 64 views in the "buffer views of the heap were made" error did not contain the oversized view (its largest Constant was 480 bytes), so that list alone can miss the cause; the debug layer names it.

an_oversized_constant_buffer_view_leaves_the_device_alive passes on this card with the commit on f85101b.

Not shown: runs A and C each ran once at default settings. All three trees also carried a local diagnostics-only counter of mine (it reads the lists' copy steps and does not touch descriptor views). Frame rate in run C's last five minutes: median 4.6 fps in 5-second readings (diagnostics build).

AI-assisted (Claude Code): runs, log reading and this text. Counts and log lines only, nothing from the game attached.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7161622144 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/24#issuecomment-7161622144). Originally posted by [tippythetaidum](https://github.com/tippythetaidum) on 2026-11-25T11:52:38Z. --- Test report on current `main` (`f85101b`), RTX 5080 16 GB, driver 621.14, Windows 11, Series X profile, diagnostics build, default settings (so the relay is on). **Without this change, `f85101b` loses the device at world entry here: 2 runs of 2.** | Run | Tree | Result | |---|---|---| | A | `f85101b` | device removed (`0x887A0001`) 2 min 1 s after launch, as the opening cutscene starts; "the host device went while buffer views of the heap were made" | | B | `f85101b`, `VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_DRED=1` | device removed 2 min 10 s after launch; the debug layer's last message before `RemoveDevice` is the one below | | C | `f85101b` + this PR's commit cherry-picked (applies clean) | full 11 min (stopped by my timeout), 80,000+ submissions, 4,037 frames, **0 device removals**, through the opening cutscene into the prison interior | Run B, the two lines in order: ``` D3D12: ID3D12Device::CreateConstantBufferView: Size of 1406720 exceeds maximum constant buffer view size of 65536. id=650 severity=1 D3D12: ID3D12Device::RemoveDevice: Device removal has been triggered for the following reason (DXGI_ERROR_INVALID_CALL: ...). id=232 severity=1 ``` Note for anyone reading run A's kind of log: the list of the last 64 views in the "buffer views of the heap were made" error did not contain the oversized view (its largest `Constant` was 480 bytes), so that list alone can miss the cause; the debug layer names it. `an_oversized_constant_buffer_view_leaves_the_device_alive` passes on this card with the commit on `f85101b`. Not shown: runs A and C each ran once at default settings. All three trees also carried a local diagnostics-only counter of mine (it reads the lists' copy steps and does not touch descriptor views). Frame rate in run C's last five minutes: median 4.6 fps in 5-second readings (diagnostics build). AI-assisted (Claude Code): runs, log reading and this text. Counts and log lines only, nothing from the game attached.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/24:upstream-pr/24'
git switch 'upstream-pr/24'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/24'
git switch 'upstream-pr/24'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/24'
git switch 'upstream-pr/24'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/24'
git switch 'main'
git merge --squash 'upstream-pr/24'
git switch 'main'
git merge --ff-only 'upstream-pr/24'
git switch 'main'
git merge 'upstream-pr/24'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
fxceless/victory-fork!24
No description provided.