GPU: validate committed resource probes without allocating #2840

Open
github-bot wants to merge 4 commits from github-bot/gh-2840 into main AGit
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 21:49 UTC · original
andrewpozdnakov7-jpg:codex2/committed-resource-probe → main · +121 −6 · 2 files · 4 commits · open

A supported CreateCommittedResource call with a null result pointer is a capability check. Today it still calls the title allocator, and its outcome depends on whether an allocation succeeds. Return the existing S_FALSE after shape and layout validation for this case. Ordinary creation still goes through the allocator. D3D12 reference

The same 64-byte buffer fixture uses a synthetic allocator that always refuses. Before the change, ordinary creation correctly returns E_OUTOFMEMORY and the probe makes a second allocator call and returns the same error. With the patch the probe returns S_FALSE with the call count still at one. A zero-size description still returns E_INVALIDARG, and native D3D12 WARP returns S_FALSE for the valid probe.

AI-assisted.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 21:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/2840) `andrewpozdnakov7-jpg:codex2/committed-resource-probe` → `main` · +121 −6 · 2 files · 4 commits · open A supported CreateCommittedResource call with a null result pointer is a capability check. Today it still calls the title allocator, and its outcome depends on whether an allocation succeeds. Return the existing `S_FALSE` after shape and layout validation for this case. Ordinary creation still goes through the allocator. [D3D12 reference](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-createcommittedresource) The same 64-byte buffer fixture uses a synthetic allocator that always refuses. Before the change, ordinary creation correctly returns `E_OUTOFMEMORY` and the probe makes a second allocator call and returns the same error. With the patch the probe returns `S_FALSE` with the call count still at one. A zero-size description still returns `E_INVALIDARG`, and native D3D12 WARP returns `S_FALSE` for the valid probe. AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:15:36 +00:00
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 22:28 UTC · original

Independent Windows verification of exact head 4083b09d98865fb8d76fbf1aa8b52ac09b355232 against main at f3578e3.

cargo test -j 4 --locked -p victory-gpu --features diagnostics --lib -- --nocapture passed 203 tests with one benchmark ignored. Main passed 243 with one benchmark ignored. DXGI confirmed the Microsoft software adapter (VendorId=0x1414, Flags=0x2). The native WARP probe returned S_FALSE for the valid synthetic buffer.

The regression confirmed normal creation returned E_OUTOFMEMORY with one allocator call, a zero-sized probe returned E_INVALIDARG, and a valid null-output probe returned S_FALSE with the call count still at one. Claude’s earlier negative control on the integration branch returned E_OUTOFMEMORY and made a second allocator call when the early return was disabled.

This head merges cleanly into current main and alongside #2837–#2839. Fresh verification and review by Codex (gpt-6.2-sol), with synthetic inputs, both WARP switches set, and Windows SDK dxil.dll.

**@⁠oni-swr** on GitHub · 2026-11-25 22:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/2840#issuecomment-7176409937) Independent Windows verification of exact head `4083b09d98865fb8d76fbf1aa8b52ac09b355232` against `main` at `f3578e3`. `cargo test -j 4 --locked -p victory-gpu --features diagnostics --lib -- --nocapture` passed 203 tests with one benchmark ignored. Main passed 243 with one benchmark ignored. DXGI confirmed the Microsoft software adapter (`VendorId=0x1414`, `Flags=0x2`). The native WARP probe returned `S_FALSE` for the valid synthetic buffer. The regression confirmed normal creation returned `E_OUTOFMEMORY` with one allocator call, a zero-sized probe returned `E_INVALIDARG`, and a valid null-output probe returned `S_FALSE` with the call count still at one. Claude’s earlier negative control on the integration branch returned `E_OUTOFMEMORY` and made a second allocator call when the early return was disabled. This head merges cleanly into current main and alongside #2837–#2839. Fresh verification and review by Codex (`gpt-6.2-sol`), with synthetic inputs, both WARP switches set, and Windows SDK `dxil.dll`.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 22:40 UTC · original

Verified 4083b09d merged onto main (f3578e3) on Windows 11 (RTX 5090 + WARP):

  • Cleanly reuses Memory::layout(info) on the out.is_null() && object::is(iid, &RESOURCE_IIDS) probe path (covering both create_committed and create_committed3), avoiding title allocator calls and shadow/texture registration.
  • resource::tests: 18/18 passed on RTX 5090 (0.43s) and WARP (0.35s); with --features diagnostics, committed_resource_probe_does_not_call_the_allocator also confirmed Native WARP returned S_FALSE for the buffer probe.
  • cargo clippy --locked -p victory-gpu --all-targets (default & --features diagnostics) 0 warnings; cargo xtask policy (190 files ok).
  • Small test nit: the native WARP check inside committed_resource_probe_does_not_call_the_allocator is gated behind #[cfg(all(windows, feature = "diagnostics"))], even though crate::host only requires #[cfg(windows)] — dropping feature = "diagnostics" lets default cargo test -p victory-gpu run it too.

Looks ready to merge.

**@⁠fuzeofficlal** on GitHub · 2026-11-25 22:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/2840#issuecomment-7176653971) Verified `4083b09d` merged onto `main` (`f3578e3`) on Windows 11 (RTX 5090 + WARP): - Cleanly reuses `Memory::layout(info)` on the `out.is_null() && object::is(iid, &RESOURCE_IIDS)` probe path (covering both `create_committed` and `create_committed3`), avoiding title allocator calls and shadow/texture registration. - `resource::tests`: 18/18 passed on RTX 5090 (0.43s) and WARP (0.35s); with `--features diagnostics`, `committed_resource_probe_does_not_call_the_allocator` also confirmed `Native WARP returned S_FALSE for the buffer probe`. - `cargo clippy --locked -p victory-gpu --all-targets` (default & `--features diagnostics`) 0 warnings; `cargo xtask policy` (`190 files ok`). - Small test nit: the native WARP check inside `committed_resource_probe_does_not_call_the_allocator` is gated behind `#[cfg(all(windows, feature = "diagnostics"))]`, even though `crate::host` only requires `#[cfg(windows)]` — dropping `feature = "diagnostics"` lets default `cargo test -p victory-gpu` run it too. Looks ready to merge.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 22:50 UTC · original

Updated in a61debf. The test now opens a native WARP device directly. This lets it run with default features because host() only honors the software-adapter switch with diagnostics enabled.

The native probe returned S_FALSE in both default and diagnostics builds. The guest probe matched it and left the allocator count at one in both runs. All 18 resource tests passed in each build, along with strict GPU Clippy and the staged asset policy.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 22:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/2840#issuecomment-7176842791) Updated in [`a61debf`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/a61debfb688a08ae1d14ce255e7e63411dba0b72). The test now opens a native WARP device directly. This lets it run with default features because `host()` only honors the software-adapter switch with diagnostics enabled. The native probe returned `S_FALSE` in both default and diagnostics builds. The guest probe matched it and left the allocator count at one in both runs. All 18 resource tests passed in each build, along with strict GPU Clippy and the staged asset policy.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 03:21 UTC · original · edited 2026-11-26 07:23 UTC

Automated triage for the maintainers.

Thanks for 4164a90. The test no longer spawns a process. TEST_ALLOCATOR is a #[cfg(test)] thread-local, and the Reset guard clears it on exit. Ordinary builds keep the same allocator path in Memory::for_resource. The change itself is unchanged. A null-out probe of a resource IID in create_committed now returns S_FALSE (or E_INVALIDARG from Memory::layout) without calling the title allocator. The test checks this against native WARP and with an allocator-call count. That resolves the earlier maintainer-decision point.

CI: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 03:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/2840#issuecomment-7181647785) · edited 2026-11-26 07:23 UTC <!-- victory-triage v1 head=4164a90d17b323ab6bcbcd9402b5b3bb2dd74976 verdict=merge-candidate at=2026-11-26T07:23:02Z --> Automated triage for the maintainers. Thanks for `4164a90`. The test no longer spawns a process. `TEST_ALLOCATOR` is a `#[cfg(test)]` thread-local, and the `Reset` guard clears it on exit. Ordinary builds keep the same allocator path in `Memory::for_resource`. The change itself is unchanged. A null-`out` probe of a resource IID in `create_committed` now returns `S_FALSE` (or `E_INVALIDARG` from `Memory::layout`) without calling the title allocator. The test checks this against native WARP and with an allocator-call count. That resolves the earlier maintainer-decision point. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 06:32 UTC · original

Commit 4164a90 runs the probe regression in-process on current main. The refusing allocator is scoped to the test thread and its override is cleared on exit. The test leaves the runtime's allocator registration alone, and ordinary builds use the same allocator and fallback as before.

The real allocation still returns E_OUTOFMEMORY and calls the allocator once. The malformed probe returns E_INVALIDARG. The valid null-output probe returns S_FALSE with the call count still 1. Disabling the probe's early return makes the same fixture return E_OUTOFMEMORY with two calls. The native WARP control returned S_FALSE in both builds, with and without diagnostics. The app-local WARP GPU suite passed 247 tests, 1 ignored. Strict GPU Clippy passed in both modes, and asset policy passed.

Please retain the Git author when moving the test. If folding it into another commit, please add Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 06:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/2840#issuecomment-7184532240) Commit [4164a90](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/4164a90d17b323ab6bcbcd9402b5b3bb2dd74976) runs the probe regression in-process on current `main`. The refusing allocator is scoped to the test thread and its override is cleared on exit. The test leaves the runtime's allocator registration alone, and ordinary builds use the same allocator and fallback as before. The real allocation still returns E_OUTOFMEMORY and calls the allocator once. The malformed probe returns E_INVALIDARG. The valid null-output probe returns S_FALSE with the call count still 1. Disabling the probe's early return makes the same fixture return E_OUTOFMEMORY with two calls. The native WARP control returned S_FALSE in both builds, with and without diagnostics. The app-local WARP GPU suite passed 247 tests, 1 ignored. Strict GPU Clippy passed in both modes, and asset policy passed. Please retain the Git author when moving the test. If folding it into another commit, please add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`.
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 09:28 UTC · original · approved these changes

Verified on RTX 5090 & WARP against origin/main (63bcca4):

  • cargo test -p victory-gpu --lib resource:: -- --test-threads=1: 19/19 passed on RTX 5090 and WARP (including committed_resource_probe_does_not_call_the_allocator).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Cleanly validates CreateCommittedResource null-out probes without calling the allocator.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 09:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/2840#pullrequestreview-6071547839) · **approved these changes** Verified on RTX 5090 & WARP against `origin/main` (`63bcca4`): - `cargo test -p victory-gpu --lib resource:: -- --test-threads=1`: 19/19 passed on RTX 5090 and WARP (including `committed_resource_probe_does_not_call_the_allocator`). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Cleanly validates `CreateCommittedResource` null-out probes without calling the allocator. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 11:05 UTC · original · approved these changes

Verified 4164a90d locally on Windows 11 (RTX 5090 and WARP, with VICTORY_D3D12_DEBUG=1):

  • cargo xtask policy and cargo clippy -p victory-gpu --tests -- -D warnings (default and --all-features): clean.
  • resource::tests::committed_resource_probe_does_not_call_the_allocator --nocapture: passed and confirmed Native WARP returned S_FALSE for the buffer probe along with zero allocator invocations on both invalid (width = 0 -> E_INVALIDARG) and valid (width = 64 -> S_FALSE) null-out probes.
  • resource:: suite: 19/19 passed on RTX 5090 (5/5 parallel rounds to verify thread-local TEST_ALLOCATOR isolation), 19/19 on RTX 5090 + VICTORY_D3D12_DEBUG=1, and 19/19 on WARP + VICTORY_D3D12_DEBUG=1.

Sharing Memory::layout(info) across the probe path, Memory::for_resource, and Memory::new keeps validation consistent across both create_committed and create_committed3, and the thread-local refusing allocator with RAII cleanup is cleanly isolated. Ready to merge.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 11:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/2840#pullrequestreview-6073017775) · **approved these changes** Verified `4164a90d` locally on Windows 11 (RTX 5090 and WARP, with `VICTORY_D3D12_DEBUG=1`): - `cargo xtask policy` and `cargo clippy -p victory-gpu --tests -- -D warnings` (default and `--all-features`): clean. - `resource::tests::committed_resource_probe_does_not_call_the_allocator --nocapture`: passed and confirmed `Native WARP returned S_FALSE for the buffer probe` along with zero allocator invocations on both invalid (`width = 0` -> `E_INVALIDARG`) and valid (`width = 64` -> `S_FALSE`) null-`out` probes. - `resource::` suite: 19/19 passed on RTX 5090 (5/5 parallel rounds to verify thread-local `TEST_ALLOCATOR` isolation), 19/19 on RTX 5090 + `VICTORY_D3D12_DEBUG=1`, and 19/19 on WARP + `VICTORY_D3D12_DEBUG=1`. Sharing `Memory::layout(info)` across the probe path, `Memory::for_resource`, and `Memory::new` keeps validation consistent across both `create_committed` and `create_committed3`, and the thread-local refusing allocator with RAII cleanup is cleanly isolated. Ready to merge.
This pull request can be merged automatically.
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/2840/head:github-bot/gh-2840'
git switch 'github-bot/gh-2840'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2840'
git switch 'github-bot/gh-2840'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2840'
git switch 'github-bot/gh-2840'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2840'
git switch 'main'
git merge --squash 'github-bot/gh-2840'
git switch 'main'
git merge --ff-only 'github-bot/gh-2840'
git switch 'main'
git merge 'github-bot/gh-2840'
git push origin 'main'
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!2840
No description provided.