D3D12.X: unbind vertex buffer slots when views is null #1151

Open
WTactic wants to merge 1 commit from upstream-pr/1160 into main
WTactic commented 2026-11-24 12:41:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by WTactic on 2026-11-24T12:41:54Z.


When IASetVertexBuffers was called with views == NULL, the call was forwarded to the native command list, but the list's tracked bindings (vertex_buffers and vertex_titles) retained the old views. Later state restores (restore_bindings) would then resurrect the unbound vertex buffers.

Purge unbound slots (start..start + n) from both vertex_buffers and vertex_titles on null view arrays, and remove slots whose view has a zero location or size. Add a unit test verifying unbinding and that restore_bindings does not replay cleared slots.

What is in it

  • crates/xcl/src/hle/d3d12x/list_x.rs: purge unbound vertex buffer slots on null views or zero sizes, and unit test null_vertex_buffer_unbinds_slots_and_does_not_restore_them.

Tested

  • Hardware: NVIDIA GeForce RTX 4090, Intel Core i9-10850K @ 3.60 GHz, Windows 11 x64 (26200), rustc 1.97.1, release/debug
  • cargo test -p xcl --lib null_vertex_buffer_unbinds_slots_and_does_not_restore_them: 1 passed, 0 failed

Regression run
main (1d027e5):

xcl-smoke v1
commit: 1d027e5c76c9a86a7ee2ca1cc677edf0be95d331
gpu: NVIDIA GeForce RTX 4090
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1529 (PresentX 1529)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15898 MB

PR (54ece90):

xcl-smoke v1
commit: 54ece908197afede4bf0d0d79379c3e6e5eecf33
gpu: NVIDIA GeForce RTX 4090
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1582 (PresentX 1583)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17253 MB

Not tested

  • AMD RDNA GPU adapter.

AI use

  • Gemini 4 Hydrogen + custom harness: traced vertex buffer binding persistence, implemented slot cleanup, wrote unit test, and regression verified.
<!-- greyfinch-sync:ivall/xcl:issue:5472347954 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1160). Originally posted by [WTactic](https://github.com/WTactic) on 2026-11-24T12:41:54Z. --- When `IASetVertexBuffers` was called with `views == NULL`, the call was forwarded to the native command list, but the list's tracked bindings (`vertex_buffers` and `vertex_titles`) retained the old views. Later state restores (`restore_bindings`) would then resurrect the unbound vertex buffers. Purge unbound slots (`start..start + n`) from both `vertex_buffers` and `vertex_titles` on null view arrays, and remove slots whose view has a zero location or size. Add a unit test verifying unbinding and that `restore_bindings` does not replay cleared slots. **What is in it** - `crates/xcl/src/hle/d3d12x/list_x.rs`: purge unbound vertex buffer slots on null views or zero sizes, and unit test `null_vertex_buffer_unbinds_slots_and_does_not_restore_them`. **Tested** - Hardware: NVIDIA GeForce RTX 4090, Intel Core i9-10850K @ 3.60 GHz, Windows 11 x64 (26200), `rustc 1.97.1`, release/debug - `cargo test -p xcl --lib null_vertex_buffer_unbinds_slots_and_does_not_restore_them`: 1 passed, 0 failed **Regression run** `main` (`1d027e5`): ``` xcl-smoke v1 commit: 1d027e5c76c9a86a7ee2ca1cc677edf0be95d331 gpu: NVIDIA GeForce RTX 4090 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1529 (PresentX 1529) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15898 MB ``` PR (`54ece90`): ``` xcl-smoke v1 commit: 54ece908197afede4bf0d0d79379c3e6e5eecf33 gpu: NVIDIA GeForce RTX 4090 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1582 (PresentX 1583) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 17253 MB ``` **Not tested** - AMD RDNA GPU adapter. **AI use** - Gemini 4 Hydrogen + custom harness: traced vertex buffer binding persistence, implemented slot cleanup, wrote unit test, and regression verified.
Anon64 commented 2026-11-24 13:03:45 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-24T12:52:30Z.


Regression run for this PR: head dccd28e, based on main 47efa2e. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release, XCL_NETWORK=0, A pressed every 4 s from 20 s, scripts/smoke.ps1 on a retail title for 60 s.

Tested

  • cargo test -p xcl --release --lib -- null_vertex_buffer on dccd28e: 1 passed, 0 failed.

main 47efa2e:

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1538 (PresentX 1538)
presents per 2 s (last 3): 57 25 10
device removals: 0
crashes: 0
peak commit: 24595 MB

this PR:

xcl-smoke v1
commit: dccd28e1c46be20d0682e7efd5be3ea35dc1a2bd
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1469 (PresentX 1469)
presents per 2 s (last 3): 25 0 1
device removals: 0
crashes: 0
peak commit: 26247 MB

No device removals or crashes; 96 % of main's frames, 107 % of its peak commit.

Not tested: the whole suite; whether the title reaches the changed path in these 60 s.

Written with Claude Code (Claude Opus 5.5) from runs on this machine.

<!-- greyfinch-sync:ivall/xcl:comment:7132037055 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1160#issuecomment-7132037055). Originally posted by [Anon64](https://github.com/Anon64) on 2026-11-24T12:52:30Z. --- Regression run for this PR: head `dccd28e`, based on `main` `47efa2e`. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release, `XCL_NETWORK=0`, A pressed every 4 s from 20 s, `scripts/smoke.ps1` on a retail title for 60 s. **Tested** - `cargo test -p xcl --release --lib -- null_vertex_buffer` on `dccd28e`: 1 passed, 0 failed. main `47efa2e`: ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1538 (PresentX 1538) presents per 2 s (last 3): 57 25 10 device removals: 0 crashes: 0 peak commit: 24595 MB ``` this PR: ``` xcl-smoke v1 commit: dccd28e1c46be20d0682e7efd5be3ea35dc1a2bd gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1469 (PresentX 1469) presents per 2 s (last 3): 25 0 1 device removals: 0 crashes: 0 peak commit: 26247 MB ``` No device removals or crashes; 96 % of main's frames, 107 % of its peak commit. **Not tested:** the whole suite; whether the title reaches the changed path in these 60 s. Written with Claude Code (Claude Opus 5.5) from runs on this machine.
bjarngard commented 2026-11-24 14:06:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bjarngard on 2026-11-24T13:48:03Z.


Test report for head dccd28e (AMD)

Tested

  • AMD Radeon(TM) Graphics (Ryzen 9 9950X iGPU, RDNA2, native wave64), driver 32.0.21043.5001; Windows 11 build 26300; Rust 1.99.1 MSVC; DXC 1.9.2602.17; debug
  • XCL_ADAPTER=radeon cargo test --workspace --no-fail-fast -- --test-threads=4: 742 passed, 0 failed, 41 ignored, no SKIPPED
  • null_vertex_buffer_unbinds_slots_and_does_not_restore_them passed when run alone on the AMD adapter

Not tested: retail titles (no smoke run), RDNA3/RDNA4.

AI use: the tests were run and this report was written by an AI agent, Claude Code (Claude Opus 5.5), on the hardware above. The numbers are copied from the actual test output.

<!-- greyfinch-sync:ivall/xcl:comment:7133355971 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1160#issuecomment-7133355971). Originally posted by [bjarngard](https://github.com/bjarngard) on 2026-11-24T13:48:03Z. --- Test report for head `dccd28e` (AMD) **Tested** - AMD Radeon(TM) Graphics (Ryzen 9 9950X iGPU, RDNA2, native wave64), driver 32.0.21043.5001; Windows 11 build 26300; Rust 1.99.1 MSVC; DXC 1.9.2602.17; debug - `XCL_ADAPTER=radeon cargo test --workspace --no-fail-fast -- --test-threads=4`: 742 passed, 0 failed, 41 ignored, no SKIPPED - `null_vertex_buffer_unbinds_slots_and_does_not_restore_them` passed when run alone on the AMD adapter **Not tested:** retail titles (no smoke run), RDNA3/RDNA4. **AI use:** the tests were run and this report was written by an AI agent, Claude Code (Claude Opus 5.5), on the hardware above. The numbers are copied from the actual test output.
JoaoPauluu commented 2026-11-24 15:05:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JoaoPauluu on 2026-11-24T14:21:26Z.


A regression run under Wine on Linux, on a retail title.

Tested

  • RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for x86_64-pc-windows-gnu. dccd28e as it is (merge base 47efa2e) and main 47efa2e, no uncommitted changes. Retail title 1.0.2.1, scripts/linux/smoke.sh (#257) for 60 s, no input. Twelve runs in a row, main first and last, other PRs in between.
  • A regression check: I did not check whether GTA VI reaches the changed code in these 60 s.

Regression run

main (first run):

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1384 (PresentX 1384)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

this PR:

xcl-smoke v1
commit: dccd28e1c46be20d0682e7efd5be3ea35dc1a2bd
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1393 (PresentX 1393)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

The last main run: 1425 frames, exit: 0x0, no device removal, no crash. Under Wine, peak commit reads 0 MB, so these blocks do not check memory.

Not tested

  • the test suite on this head; native Windows; AMD.

AI use

  • Claude Code (Claude Opus 5.5) built both commits, ran the runs and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
<!-- greyfinch-sync:ivall/xcl:comment:7134241708 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1160#issuecomment-7134241708). Originally posted by [JoaoPauluu](https://github.com/JoaoPauluu) on 2026-11-24T14:21:26Z. --- A regression run under Wine on Linux, on a retail title. **Tested** - RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for `x86_64-pc-windows-gnu`. `dccd28e` as it is (merge base `47efa2e`) and `main` `47efa2e`, no uncommitted changes. Retail title 1.0.2.1, `scripts/linux/smoke.sh` (#257) for 60 s, no input. Twelve runs in a row, `main` first and last, other PRs in between. - A regression check: I did not check whether GTA VI reaches the changed code in these 60 s. **Regression run** main (first run): ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: NVIDIA GeForce RTX 3060 title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1384 (PresentX 1384) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 0 MB ``` this PR: ``` xcl-smoke v1 commit: dccd28e1c46be20d0682e7efd5be3ea35dc1a2bd gpu: NVIDIA GeForce RTX 3060 title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1393 (PresentX 1393) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 0 MB ``` The last `main` run: 1425 frames, `exit: 0x0`, no device removal, no crash. Under Wine, `peak commit` reads 0 MB, so these blocks do not check memory. **Not tested** - the test suite on this head; native Windows; AMD. **AI use** - Claude Code (Claude Opus 5.5) built both commits, ran the runs and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
DavidM1911 commented 2026-11-25 08:08:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T08:02:11Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7156531470 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1160#issuecomment-7156531470). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T08:02:11Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
DavidM1911 commented 2026-11-26 04:07:44 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T03:52:38Z.


Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

<!-- greyfinch-sync:ivall/xcl:comment:7182099873 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1160#issuecomment-7182099873). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T03:52:38Z. --- Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
github-actions[bot] commented 2026-11-30 08:42:27 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-30T08:42:27Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7273242605 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1160#issuecomment-7273242605). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-30T08:42:27Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 04:57:16 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:57:16Z.


Triage (#1607) – head 54ece90

No open or merged PR makes the same change; main's ia_set_vertex_buffers_x in list_x.rs still returns early on views == NULL without clearing vertex_buffers / vertex_titles, so restore_bindings re-binds slots the title unbound.
One point to check: the zero-view test uses the translated view (after gpu_va / view_bytes), so a real buffer clipped to 0 bytes by view_bytes is now dropped from the restore set instead of being re-bound with size 0. The effect should be the same, but it is a behaviour change.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7301271289 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1160#issuecomment-7301271289). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T04:57:16Z. --- **Triage (#1607)** – head 54ece90 No open or merged PR makes the same change; main's ia_set_vertex_buffers_x in list_x.rs still returns early on views == NULL without clearing vertex_buffers / vertex_titles, so restore_bindings re-binds slots the title unbound. One point to check: the zero-view test uses the translated view (after gpu_va / view_bytes), so a real buffer clipped to 0 bytes by view_bytes is now dropped from the restore set instead of being re-bound with size 0. The effect should be the same, but it is a behaviour change. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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/1160:upstream-pr/1160'
git switch 'upstream-pr/1160'

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/1160'
git switch 'upstream-pr/1160'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1160'
git switch 'upstream-pr/1160'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1160'
git switch 'main'
git merge --squash 'upstream-pr/1160'
git switch 'main'
git merge --ff-only 'upstream-pr/1160'
git switch 'main'
git merge 'upstream-pr/1160'
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
xcl-dev/xcl!1151
No description provided.