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

Manually merged
github merged 1 commit from gh-pr/1224/head into gh-pr/1224/base 2026-11-26 04:47:41 +00:00
Owner

@⁠emirduran707 on GitHub · 2026-11-24 13:23 UTC · original
emirduran707:dstorage-status-slots-start-complete → main · +19 −1 · 1 files · 1 commits · merged 2026-11-24 15:56 UTC

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

**@⁠emirduran707** on GitHub · 2026-11-24 13:23 UTC · [original](https://github.com/xcl-dev/xcl/pull/1224) `emirduran707:dstorage-status-slots-start-complete` → `main` · +19 −1 · 1 files · 1 commits · merged 2026-11-24 15:56 UTC 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)
CreateStatusArray made every slot E_PENDING, so IsComplete(i) was false
for a slot nothing was ever enqueued into. A title that waits for
IsComplete before it reuses a ring slot, including the slot's first use,
waits forever.

ATG's Win32 implementation of the console API (Xbox-GDK-Samples,
Samples/System/SimpleDirectStorageCombo/DirectStorageWin32/
DirectStorageWin32WrapperStatusArray.cpp) starts every slot complete:

    m_completeFlags.resize(capacity, true);
    m_resultCodes.resize(capacity, HRESULT_FROM_WIN32(S_OK));

and its EnqueueStatus marks the slot not complete (`MarkState(index,
false, S_OK)`). dstorage_win32.h says a status entry "can be enqueued
again" once IsComplete() for it returns true.

Slots now start at S_OK. Enqueueing a status still stores E_PENDING
(QueueInner::enqueue), so a slot behaves as before once it is enqueued;
no code or test read a slot that was never enqueued. EnqueueStatus on a
closed queue leaves the slot as it was, which is now complete instead of
pending forever.

The new test creates an array of 4 and checks that slot 3 is complete
with S_OK; it fails without the fix (`status_is_complete(s, 3)`).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:47:41 +00:00
github manually merged commit 5bd7cd8e73 into gh-pr/1224/base 2026-11-26 04:47:41 +00:00
Author
Owner

@⁠dcastell1 on GitHub · 2026-11-24 13:28 UTC · original

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.

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

@⁠thehollowedone on GitHub · 2026-11-24 13:39 UTC · original

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.

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

@⁠DavidM1911 on GitHub · 2026-11-24 13:47 UTC · original

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.

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

@⁠DavidM1911 on GitHub · 2026-11-26 04:05 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 04:05 UTC · [original](https://github.com/xcl-dev/xcl/pull/1224#issuecomment-7182287197) 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 discussion has been locked. Commenting is limited to contributors.
No description provided.