Windows: raw twins off 16 bytes only under Wine (fixes device removed, #1) #2

Manually merged
github merged 1 commit from gh-pr/2/head into gh-pr/2/base 2026-12-01 03:06:18 +00:00
Owner

@⁠Gabriel-Ramaldes on GitHub · 2026-11-27 15:54 UTC · original
Gabriel-Ramaldes:windows-raw-twins → main · +20 −2 · 1 files · 1 commits · merged 2026-11-27 16:02 UTC

Fixes #1.

What fails on Windows

Every run on Windows lost the device 49 to 102 s in, with no host list for a state prelude; device removed ... (0x887A0001). That is the error in #1, and it happened with every preset I tried.

The "no host list" part only follows from the removal. A run with VICTORY_D3D12_DEBUG=1 names the call that causes it:

ID3D12Device::CreateShaderResourceView: When creating a RAW Shader Resource View, the offset of the
first element from the start of the buffer must be a multiple of 16 bytes.  Thus, FirstElement
(27890541) must be a multiple of 4 since each element is 4 bytes. id=31 severity=1
ID3D12Device::RemoveDevice: Device removal has been triggered for the following reason
(DXGI_ERROR_INVALID_CALL ...)

That view is an exact raw twin (twin_exact, by % 4 == 0, FirstElement = first + by / 4). vkd3d-proton accepts a raw view on any dword, which is why the fork runs under Proton. Windows' own D3D12 runtime treats it as an illegal call and removes the device.

Change

twin_exact() is now on only under Wine (shadow::on_wine()). On Windows the twin goes the way it went before the exact twins: move_raw if it can, otherwise a null view. One info line in the log says so. Nothing changes under Proton.

On Windows, trees may drop out for single frames where the exact twins fixed that under Proton. That trade is better than losing the device. A later change could give Windows exact twins another way, for example by moving more of them through move_raw.

Tested

The scripted runs pressed Enter at 56 s, with the host pad hidden.

  • Machine: RX 9070 XT, Ryzen 7 3700X, 32 GB, Windows 11 build 26300, Adrenalin 32.0.32029.2010.
  • Build: diag, scripts\play.ps1 as shipped.
Build Settings Result
42b2226 -S70 device lost 79 s in (twice)
42b2226 -S70, frame generation off lost 59 s in
42b2226 default lost 49 s in
42b2226 default, VICTORY_D3D12_DEBUG=1 lost 55 s in, message above
42b2226 -Safe lost 102 s in
42b2226 default, all four VICTORY_PORT_*=0 lost 62 s in
42b2226 default, VICTORY_TWIN_EXACT=0 300 s, no loss
this PR default 300 s, no loss, no 0x887A000x in the log
this PR -S70 (FSR + frame generation) 300 s, no loss

cargo test --locked -p victory-gpu --features diagnostics descriptor: 63 passed.

I did not test this under Proton. The code there takes the same path as before (asked && wine).

🤖 Generated with Claude Code

**@⁠Gabriel-Ramaldes** on GitHub · 2026-11-27 15:54 UTC · [original](https://github.com/Slaktarn700/SlaktarnVI/pull/2) `Gabriel-Ramaldes:windows-raw-twins` → `main` · +20 −2 · 1 files · 1 commits · merged 2026-11-27 16:02 UTC Fixes #1. ## What fails on Windows Every run on Windows lost the device 49 to 102 s in, with `no host list for a state prelude; device removed ... (0x887A0001)`. That is the error in #1, and it happened with every preset I tried. The "no host list" part only follows from the removal. A run with `VICTORY_D3D12_DEBUG=1` names the call that causes it: ``` ID3D12Device::CreateShaderResourceView: When creating a RAW Shader Resource View, the offset of the first element from the start of the buffer must be a multiple of 16 bytes. Thus, FirstElement (27890541) must be a multiple of 4 since each element is 4 bytes. id=31 severity=1 ID3D12Device::RemoveDevice: Device removal has been triggered for the following reason (DXGI_ERROR_INVALID_CALL ...) ``` That view is an exact raw twin (`twin_exact`, `by % 4 == 0`, `FirstElement = first + by / 4`). vkd3d-proton accepts a raw view on any dword, which is why the fork runs under Proton. Windows' own D3D12 runtime treats it as an illegal call and removes the device. ## Change `twin_exact()` is now on only under Wine (`shadow::on_wine()`). On Windows the twin goes the way it went before the exact twins: `move_raw` if it can, otherwise a null view. One info line in the log says so. Nothing changes under Proton. On Windows, trees may drop out for single frames where the exact twins fixed that under Proton. That trade is better than losing the device. A later change could give Windows exact twins another way, for example by moving more of them through `move_raw`. ## Tested The scripted runs pressed Enter at 56 s, with the host pad hidden. - **Machine:** RX 9070 XT, Ryzen 7 3700X, 32 GB, Windows 11 build 26300, Adrenalin 32.0.32029.2010. - **Build:** diag, `scripts\play.ps1` as shipped. | Build | Settings | Result | |---|---|---| | 42b2226 | `-S70` | device lost 79 s in (twice) | | 42b2226 | `-S70`, frame generation off | lost 59 s in | | 42b2226 | default | lost 49 s in | | 42b2226 | default, `VICTORY_D3D12_DEBUG=1` | lost 55 s in, message above | | 42b2226 | `-Safe` | lost 102 s in | | 42b2226 | default, all four `VICTORY_PORT_*=0` | lost 62 s in | | 42b2226 | default, `VICTORY_TWIN_EXACT=0` | 300 s, no loss | | this PR | default | 300 s, no loss, no `0x887A000x` in the log | | this PR | `-S70` (FSR + frame generation) | 300 s, no loss | `cargo test --locked -p victory-gpu --features diagnostics descriptor`: 63 passed. I did not test this under Proton. The code there takes the same path as before (`asked && wine`). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The exact raw twins (VICTORY_TWIN_EXACT, on by default) make a raw SRV
or UAV whose FirstElement is not a multiple of 4. vkd3d-proton takes it;
Windows' own D3D12 does not: the debug layer reports "When creating a RAW
Shader Resource View, the offset of the first element from the start of
the buffer must be a multiple of 16 bytes. Thus, FirstElement (27890541)
must be a multiple of 4", then removes the device with
DXGI_ERROR_INVALID_CALL ("no host list for a state prelude", #1).

On Windows the twin now goes the way it went before the exact twins
(move_raw, else a null view). Under Wine nothing changes.

RX 9070 XT, Ryzen 7 3700X, Windows 11 26300, Adrenalin 32.0.32029, diag:
- before: device lost 49-102 s in, every run (default, -Safe, -S70,
  -S70 without frame generation, the default with the ports off);
- VICTORY_TWIN_EXACT=0 on the old build: 300 s, no loss;
- this change, no switches: default 300 s and -S70 300 s, no loss, no
  0x887A000x in the log.
cargo test -p victory-gpu --features diagnostics descriptor: 63 passed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 03:06:16 +00:00
github manually merged commit 4f6a37582e into gh-pr/2/base 2026-12-01 03:06:18 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.