DirectStorage: a new status array's slots start complete with S_OK #1215

Merged
emirduran707 merged 1 commit from upstream-pr/1224 into main 2026-11-24 15:56:28 +00:00
emirduran707 commented 2026-11-24 13:23:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-24T13:23:21Z.


A new DirectStorage status array started every slot as E_PENDING, so IsComplete(i) was false for a slot that was never enqueued. A title that keeps a ring of status slots, and waits for IsComplete before reusing a slot (its first use included), spins there forever.

Microsoft's Win32 implementation of the console DirectStorage API in Xbox-GDK-Samples (Samples/System/SimpleDirectStorageCombo/DirectStorageWin32/) starts them complete: DirectStorageWin32WrapperStatusArray.cpp has m_completeFlags.resize(capacity, true); m_resultCodes.resize(capacity, HRESULT_FROM_WIN32(S_OK));. Its header says a status entry can be enqueued again once IsComplete() returns true.

factory_create_status_array now starts every slot at S_OK. Enqueuing a status still sets its slot to E_PENDING, so nothing changes after an enqueue. One side effect: EnqueueStatus on a closed queue leaves the slot as it was, which is now complete where before it stayed pending forever.

What is in it

  • crates/xcl/src/hle/dstorage.rs: the initial value; test a_new_status_array_slot_is_complete.

Tested

  • AMD Radeon RX 9060 XT (driver 32.0.31044.16), Ryzen 5 5600, Windows 11 Pro 26300, Rust 1.100.0; tests debug, smoke release
  • cargo test --workspace -- --test-threads=4 on 5bd7cd8: 742 passed, 0 failed, 41 ignored; no SKIPPED GPU tests
  • the new test without the change: assertion failed: status_is_complete(s, 3); with it cargo test -p xcl --lib dstorage passes (15 passed)

Regression run

main:

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: AMD Radeon RX 9060 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1541 (PresentX 1541)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 19650 MB

this PR:

xcl-smoke v1
commit: 5bd7cd8e73129e3cc22e17802a185940bfaf549f
gpu: AMD Radeon RX 9060 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1551 (PresentX 1551)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 19476 MB

Not tested

  • The console's own starting state: it follows Microsoft's Win32 implementation of the console API; neither the PC nor the console documentation states it.
  • A title that waits on a slot it never enqueued; the smoke title's run is a regression check only.
  • NVIDIA and Intel GPUs.

AI use

  • Claude Code with Claude Opus 5.5: found the problem, wrote the change, the test and this description; I reviewed the diff and ran the tests and smoke runs above.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:6582768747 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1224). Originally posted by [emirduran707](https://github.com/emirduran707) on 2026-11-24T13:23:21Z. --- A new DirectStorage status array started every slot as `E_PENDING`, so `IsComplete(i)` was false for a slot that was never enqueued. A title that keeps a ring of status slots, and waits for `IsComplete` before reusing a slot (its first use included), spins there forever. Microsoft's Win32 implementation of the console DirectStorage API in Xbox-GDK-Samples (`Samples/System/SimpleDirectStorageCombo/DirectStorageWin32/`) starts them complete: `DirectStorageWin32WrapperStatusArray.cpp` has `m_completeFlags.resize(capacity, true); m_resultCodes.resize(capacity, HRESULT_FROM_WIN32(S_OK));`. Its header says a status entry can be enqueued again once `IsComplete()` returns true. `factory_create_status_array` now starts every slot at `S_OK`. Enqueuing a status still sets its slot to `E_PENDING`, so nothing changes after an enqueue. One side effect: `EnqueueStatus` on a closed queue leaves the slot as it was, which is now complete where before it stayed pending forever. **What is in it** - `crates/xcl/src/hle/dstorage.rs`: the initial value; test `a_new_status_array_slot_is_complete`. **Tested** - AMD Radeon RX 9060 XT (driver 32.0.31044.16), Ryzen 5 5600, Windows 11 Pro 26300, Rust 1.100.0; tests debug, smoke release - `cargo test --workspace -- --test-threads=4` on 5bd7cd8: 742 passed, 0 failed, 41 ignored; no SKIPPED GPU tests - the new test without the change: `assertion failed: status_is_complete(s, 3)`; with it `cargo test -p xcl --lib dstorage` passes (15 passed) **Regression run** main: ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: AMD Radeon RX 9060 XT title: retail-title seconds: 60 exit: 0x0 frames shown: 1541 (PresentX 1541) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 19650 MB ``` this PR: ``` xcl-smoke v1 commit: 5bd7cd8e73129e3cc22e17802a185940bfaf549f gpu: AMD Radeon RX 9060 XT title: retail-title seconds: 60 exit: 0x0 frames shown: 1551 (PresentX 1551) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 19476 MB ``` **Not tested** - The console's own starting state: it follows Microsoft's Win32 implementation of the console API; neither the PC nor the console documentation states it. - A title that waits on a slot it never enqueued; the smoke title's run is a regression check only. - NVIDIA and Intel GPUs. **AI use** - Claude Code with Claude Opus 5.5: found the problem, wrote the change, the test and this description; I reviewed the diff and ran the tests and smoke runs above. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
dcastell1 commented 2026-11-24 14:06:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by dcastell1 on 2026-11-24T13:28:28Z.


Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on main@47efa2e (baseline 741 passed, 0 failed, 41 ignored on this box):

patch -p1 < this PR            # clean, no fuzz
cargo test --workspace -- --test-threads=4
742 passed; 0 failed; 41 ignored   (exit 0)

One more than the baseline; a new status array's slots starting complete is covered and green.

Tree restored afterwards (full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.

<!-- greyfinch-sync:ivall/xcl:comment:7132880828 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1224#issuecomment-7132880828). Originally posted by [dcastell1](https://github.com/dcastell1) on 2026-11-24T13:28:28Z. --- Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on `main@47efa2e` (baseline **741 passed, 0 failed, 41 ignored** on this box): ``` patch -p1 < this PR # clean, no fuzz cargo test --workspace -- --test-threads=4 742 passed; 0 failed; 41 ignored (exit 0) ``` One more than the baseline; a new status array's slots starting complete is covered and green. Tree restored afterwards (full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.
thehollowedone commented 2026-11-24 14:06:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-24T13:39:01Z.


Independent DirectStorage slot-reuse check on 5bd7cd8, Windows 11 build 26300, Rust 1.99.1 MSVC, debug.

Both fresh slots reported complete with S_OK. On slot 0, a mismatched copy size moved the slot through E_PENDING to E_DESTINATION_SIZE. Reusing that slot for a valid copy moved it through E_PENDING to S_OK and copied exactly the four requested bytes. Slot 1 stayed complete with S_OK. Restoring only the old initializer reproduced the first-use failure: both fresh slots reported E_PENDING.

All 16 focused DirectStorage tests passed at the PR head, including the additional synthetic fixture. No retail run. AI-assisted. Codex (GPT-6, exact variant unavailable) wrote and ran the scratch fixture and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7133135447 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1224#issuecomment-7133135447). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-11-24T13:39:01Z. --- Independent DirectStorage slot-reuse check on [`5bd7cd8`](https://github.com/ivall/xcl/commit/5bd7cd8e73129e3cc22e17802a185940bfaf549f), Windows 11 build 26300, Rust 1.99.1 MSVC, debug. Both fresh slots reported complete with `S_OK`. On slot 0, a mismatched copy size moved the slot through `E_PENDING` to `E_DESTINATION_SIZE`. Reusing that slot for a valid copy moved it through `E_PENDING` to `S_OK` and copied exactly the four requested bytes. Slot 1 stayed complete with `S_OK`. Restoring only the old initializer reproduced the first-use failure: both fresh slots reported `E_PENDING`. All 16 focused DirectStorage tests passed at the PR head, including the additional synthetic fixture. No retail run. AI-assisted. Codex (GPT-6, exact variant unavailable) wrote and ran the scratch fixture and drafted this report.
DavidM1911 commented 2026-11-24 14:06:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T13:47:16Z.


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

  • cargo test -p xcl --lib dstorage: 15 passed, 0 failed.

Note: the full d3d12x lib filter currently aborts with 0xc0000005 on unmodified main too (pre-existing, unrelated to this PR); the PR's own tests were run by name and pass.

<!-- greyfinch-sync:ivall/xcl:comment:7133336249 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1224#issuecomment-7133336249). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T13:47:16Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - cargo test -p xcl --lib dstorage: 15 passed, 0 failed. Note: the full `d3d12x` lib filter currently aborts with 0xc0000005 on unmodified `main` too (pre-existing, unrelated to this PR); the PR's own tests were run by name and pass.
upstream-sync closed this pull request 2026-11-24 16:06:03 +00:00
DavidM1911 commented 2026-11-26 04:07:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T04:05:36Z.


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:7182287197 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1224#issuecomment-7182287197). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T04:05:36Z. --- 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
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!1215
No description provided.