fix: validate the host format of texture UAVs #320

Merged
mauroalvare merged 4 commits from upstream-pr/320 into main 2026-11-27 19:38:44 +00:00
mauroalvare commented 2026-11-26 02:49:12 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by mauroalvare on 2026-11-26T02:49:12Z.


Change

descriptor::host::fits in Neptune accepted a D32_FLOAT UAV on a UAV-enabled R32_TYPELESS texture because the two formats belong to the same family. Both tested D3D12 adapters report that D32_FLOAT lacks typed view and store support. The baseline repro stops at the eligibility assertion before submitting the unsupported descriptor to the native API.

Check the device's typed UAV and typed store flags after resolving the actual host view format, including sRGB aliases and target stand-ins. Cache the result per format for the runtime's D3D12 device and route unsupported views to the existing null descriptor fallback. This is in the texture UAV materializer used by the Neptune runtime built by tools/lancer_victory.ps1. D3D12 format support 1 · D3D12 format support 2

The format check adapts the approach from Marvisak/VIctory to Neptune's existing format resolution. The source and licence are recorded in THIRD_PARTY.md and the commit trailers.

Verification

Base c4c93bdc413191a9dc909998d2d53080a3f0c880 and fix 11cc463aeb25d6b79670e963e846e3742c5ad1f7. To reproduce the baseline, add typed_uav_tests.rs and its #[cfg(test)] module declaration from this PR to the base revision. Run from third_party/victory. Leave VICTORY_D3D12_WARP unset for hardware or set it to 1 for WARP.

cargo test --locked --offline -p victory-gpu --lib --features diagnostics descriptor::host::typed_uav_tests::a_texture_uav_requires_a_writable_host_format -- --exact --nocapture --test-threads=1
Adapter Base Fix
GeForce RTX 5070 Ti, driver 621.40 fits=true, test fails fits=false, 1 passed
WARP, Microsoft Basic Render Driver fits=true, test fails fits=false, 1 passed

Both adapters reported D32_FLOAT support1=0x3110b0, support2=0x200. Actual compute readback on the fix returned null UAV read=0x00000000, valid UAV retained=0x13579bdf on both adapters. The targeted runs had no skips.

The B5G5R5A1_UNORM case from VIctory has a different host format on these devices. Neptune already resolves it to R8G8B8A8_UNORM (28) on the 5070 Ti, where the original format lacks typed view and store support. WARP retains B5G5R5A1_UNORM (86), which supports both. The eligibility test passes on the effective format in both cases.

  • cargo build --locked --offline --release -p victory passed.
  • cargo test --locked --offline -p victory-loader --test load_probe reported 2 passed.
  • cargo xtask policy reported asset policy: 200 files ok.
  • cargo test --locked --offline -p victory-gpu --lib --features diagnostics -- --test-threads=1 reported 197 passed, 3 failed, 3 ignored on the fix. The base reported 196 passed, 3 failed, 3 ignored with the new test filtered out. The same assertions failed in spans_say_the_next_start_and_the_lowest_level_viewed, warp_card_fetch_copies_flagged_pieces_to_their_slots, and warp_card_patch_writes_the_masked_bytes_and_no_others.
  • python -m ruff check --select W605,F,E9 PrototypeScarlett tests tools reported All checks passed!.
  • cmake -S runtime -B runtime/build -A x64 and cmake --build runtime/build --config Release --parallel 2 passed.
  • cargo build --release --locked --offline --manifest-path rust/Cargo.toml passed. cargo test --release --locked --offline --manifest-path rust/Cargo.toml reported 12 passed in total.
  • python tools/build_tombox.py built all 10 open-source DLLs from the pinned TomBox revision f89e4106fe8a1728515afa34ceb5097132cadcda.
  • python -m pytest -rs with ANYXBOXX_REQUIRE_RUNTIME=1 on the configured Python 3.13.15 environment reported 1665 passed in 72.88s (0:01:12) with no skips.

Oracle and test data

The test creates a 1×1 texture and uses CheckFeatureSupport as the descriptor eligibility oracle. It then runs a synthetic one-thread compute shader through a valid slot and the null slot from Neptune's descriptor materializer. The readback checks the null read and the retained marker after a write to the null slot. The shader and texture are generated by the test. D3D12 null UAV semantics

Checklist

  • Single change to texture UAV eligibility.
  • Regression fails on the base and passes on the fix.
  • Commands and results recorded above.
  • Synthetic test data and source attribution checked.

AI assistance was used for investigation, implementation, and verification with OpenAI Codex.

<!-- greyfinch-sync:LooperSalty/AnyXboxX:issue:5503087620 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/320). Originally posted by [mauroalvare](https://github.com/mauroalvare) on 2026-11-26T02:49:12Z. --- ## Change `descriptor::host::fits` in Neptune accepted a `D32_FLOAT` UAV on a UAV-enabled `R32_TYPELESS` texture because the two formats belong to the same family. Both tested D3D12 adapters report that `D32_FLOAT` lacks typed view and store support. The baseline repro stops at the eligibility assertion before submitting the unsupported descriptor to the native API. Check the device's typed UAV and typed store flags after resolving the actual host view format, including sRGB aliases and target stand-ins. Cache the result per format for the runtime's D3D12 device and route unsupported views to the existing null descriptor fallback. This is in the texture UAV materializer used by the Neptune runtime built by `tools/lancer_victory.ps1`. [D3D12 format support 1](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ne-d3d12-d3d12_format_support1) · [D3D12 format support 2](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ne-d3d12-d3d12_format_support2) The format check adapts the approach from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/commit/ea488a9f9901e4375c547a57795ae8cb79d577a4) to Neptune's existing format resolution. The source and licence are recorded in `THIRD_PARTY.md` and the commit trailers. ## Verification Base `c4c93bdc413191a9dc909998d2d53080a3f0c880` and fix `11cc463aeb25d6b79670e963e846e3742c5ad1f7`. To reproduce the baseline, add `typed_uav_tests.rs` and its `#[cfg(test)]` module declaration from this PR to the base revision. Run from `third_party/victory`. Leave `VICTORY_D3D12_WARP` unset for hardware or set it to `1` for WARP. ```powershell cargo test --locked --offline -p victory-gpu --lib --features diagnostics descriptor::host::typed_uav_tests::a_texture_uav_requires_a_writable_host_format -- --exact --nocapture --test-threads=1 ``` | Adapter | Base | Fix | | --- | --- | --- | | GeForce RTX 5070 Ti, driver 621.40 | `fits=true`, test fails | `fits=false`, 1 passed | | WARP, Microsoft Basic Render Driver | `fits=true`, test fails | `fits=false`, 1 passed | Both adapters reported `D32_FLOAT support1=0x3110b0, support2=0x200`. Actual compute readback on the fix returned `null UAV read=0x00000000, valid UAV retained=0x13579bdf` on both adapters. The targeted runs had no skips. The `B5G5R5A1_UNORM` case from VIctory has a different host format on these devices. Neptune already resolves it to `R8G8B8A8_UNORM` (28) on the 5070 Ti, where the original format lacks typed view and store support. WARP retains `B5G5R5A1_UNORM` (86), which supports both. The eligibility test passes on the effective format in both cases. - `cargo build --locked --offline --release -p victory` passed. - `cargo test --locked --offline -p victory-loader --test load_probe` reported 2 passed. - `cargo xtask policy` reported `asset policy: 200 files ok`. - `cargo test --locked --offline -p victory-gpu --lib --features diagnostics -- --test-threads=1` reported 197 passed, 3 failed, 3 ignored on the fix. The base reported 196 passed, 3 failed, 3 ignored with the new test filtered out. The same assertions failed in `spans_say_the_next_start_and_the_lowest_level_viewed`, `warp_card_fetch_copies_flagged_pieces_to_their_slots`, and `warp_card_patch_writes_the_masked_bytes_and_no_others`. - `python -m ruff check --select W605,F,E9 PrototypeScarlett tests tools` reported `All checks passed!`. - `cmake -S runtime -B runtime/build -A x64` and `cmake --build runtime/build --config Release --parallel 2` passed. - `cargo build --release --locked --offline --manifest-path rust/Cargo.toml` passed. `cargo test --release --locked --offline --manifest-path rust/Cargo.toml` reported 12 passed in total. - `python tools/build_tombox.py` built all 10 open-source DLLs from the pinned TomBox revision `f89e4106fe8a1728515afa34ceb5097132cadcda`. - `python -m pytest -rs` with `ANYXBOXX_REQUIRE_RUNTIME=1` on the configured Python 3.13.15 environment reported `1665 passed in 72.88s (0:01:12)` with no skips. ## Oracle and test data The test creates a 1×1 texture and uses `CheckFeatureSupport` as the descriptor eligibility oracle. It then runs a synthetic one-thread compute shader through a valid slot and the null slot from Neptune's descriptor materializer. The readback checks the null read and the retained marker after a write to the null slot. The shader and texture are generated by the test. [D3D12 null UAV semantics](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-createunorderedaccessview) ## Checklist - [x] Single change to texture UAV eligibility. - [x] Regression fails on the base and passes on the fix. - [x] Commands and results recorded above. - [x] Synthetic test data and source attribution checked. AI assistance was used for investigation, implementation, and verification with OpenAI Codex.
mauroalvare commented 2026-11-26 18:41:34 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by mauroalvare on 2026-11-26T18:41:34Z.


Rebased and pushed. The source table keeps the credits added on main alongside the typed UAV attribution. GitHub now reports the PR as mergeable.

The texture UAV regression passed on the RTX 5070 Ti and WARP. Both rejected the unsupported writable view and used the existing null UAV fallback. The asset-policy check passed locally.

GitHub Actions for this revision.

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7200746733 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/320#issuecomment-7200746733). Originally posted by [mauroalvare](https://github.com/mauroalvare) on 2026-11-26T18:41:34Z. --- Rebased and pushed. The source table keeps the credits added on main alongside the typed UAV attribution. GitHub now reports the PR as mergeable. The texture UAV regression passed on the RTX 5070 Ti and WARP. Both rejected the unsupported writable view and used the existing null UAV fallback. The asset-policy check passed locally. [GitHub Actions for this revision](https://github.com/LooperSalty/AnyXboxX/actions/runs/45877573533).
LooperSalty commented 2026-11-27 12:24:01 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by LooperSalty on 2026-11-27T12:24:01Z.


Review: descriptor/host.rs typed_uav_store. When host() is None, query returns false and get_or_init caches that false for the format forever. Check host() before the OnceLock and return false without caching when there is no host.

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7218197419 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/320#issuecomment-7218197419). Originally posted by [LooperSalty](https://github.com/LooperSalty) on 2026-11-27T12:24:01Z. --- Review: descriptor/host.rs typed_uav_store. When host() is None, query returns false and get_or_init caches that false for the format forever. Check host() before the OnceLock and return false without caching when there is no host.
mauroalvare commented 2026-11-27 17:02:08 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by mauroalvare on 2026-11-27T17:02:08Z.


Moved the host-device check ahead of the per-format OnceLock. A missing host now returns before the cache is consulted or initialized. The D3D12 typed-UAV regression ran on the RTX 5070 Ti and passed.

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7223951467 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/320#issuecomment-7223951467). Originally posted by [mauroalvare](https://github.com/mauroalvare) on 2026-11-27T17:02:08Z. --- Moved the host-device check ahead of the per-format `OnceLock`. A missing host now returns before the cache is consulted or initialized. The D3D12 typed-UAV regression ran on the RTX 5070 Ti and passed.
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
LooperSalty/AnyXboxX!320
No description provided.