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

Open
github-bot wants to merge 1 commit from github-bot/gh-1160 into main AGit
Owner

@⁠WTactic on GitHub · 2026-11-24 12:41 UTC · original
WTactic:fix/vertex-buffer-null-unbind → main · +120 −2 · 1 files · 1 commits · open

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.
**@⁠WTactic** on GitHub · 2026-11-24 12:41 UTC · [original](https://github.com/xcl-dev/xcl/pull/1160) `WTactic:fix/vertex-buffer-null-unbind` → `main` · +120 −2 · 1 files · 1 commits · open 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.
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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:45:35 +00:00
Author
Owner

@⁠Anon64 on GitHub · 2026-11-24 12:52 UTC · original

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.

**@⁠Anon64** on GitHub · 2026-11-24 12:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/1160#issuecomment-7132037055) 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.
Author
Owner

@⁠bjarngard on GitHub · 2026-11-24 13:48 UTC · original

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.

**@⁠bjarngard** on GitHub · 2026-11-24 13:48 UTC · [original](https://github.com/xcl-dev/xcl/pull/1160#issuecomment-7133355971) 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.
Author
Owner

@⁠JoaoPauluu on GitHub · 2026-11-24 14:21 UTC · original

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.
**@⁠JoaoPauluu** on GitHub · 2026-11-24 14:21 UTC · [original](https://github.com/xcl-dev/xcl/pull/1160#issuecomment-7134241708) 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.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 08:02 UTC · original

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** on GitHub · 2026-11-25 08:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/1160#issuecomment-7156531470) 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!
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 03:52 UTC · original

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

**@⁠DavidM1911** on GitHub · 2026-11-26 03:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/1160#issuecomment-7182099873) 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
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1160/head:github-bot/gh-1160'
git switch 'github-bot/gh-1160'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1160'
git switch 'github-bot/gh-1160'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1160'
git switch 'github-bot/gh-1160'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1160'
git switch 'main'
git merge --squash 'github-bot/gh-1160'
git switch 'main'
git merge --ff-only 'github-bot/gh-1160'
git switch 'main'
git merge 'github-bot/gh-1160'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.