Wine/vkd3d-proton: the built-in shaders' ladder that renders the world on Linux #338

Open
GustawMatuszewski wants to merge 1 commit from upstream-pr/338 into main
GustawMatuszewski commented 2026-11-26 17:30:40 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by GustawMatuszewski on 2026-11-26T17:30:40Z.


What this is

Five fixes that make this tree's built-in shaders and pipelines work under Wine + vkd3d-proton, and with them the world renders on Linux. Before them the 3D world was black: the same symptoms as the "black screen" reports on Windows hosts whose view heap is capped (issue #3081's "before" row), but reached a different way — every built-in pipeline failed to build, so the indirect argument clamp and the ambient light were dead and every world indirect dispatch was dropped.

Tested on one machine: RX 9060 XT 16 GB, RADV (Mesa), GE-Proton 11.14 (wine 11.0 + vkd3d-proton), Series X profile, commit c9c932c + this branch. The operator watched the world render on the display. No game files, code only.

The ladder, in the order each rung was hit

# Failure under Wine Fix
1 E5005: Method 'InterlockedAdd' is not defined on type 'RWByteAddressBuffer' (the ambient's stats) the stats writes are gated behind #ifdef STATS; the light itself is untouched
2 E5005: Method 'InterlockedOr'/'InterlockedMax'/'InterlockedCompareExchange' … (the argument clamp's budget) the same words are addressed through an RWStructuredBuffer<uint> view and the free-function InterlockedOr/Max/Add/CompareExchange form
3 E5005: Function "isnan"/"isinf" (the ambient) c != c / the same check written out
4 E5017: … Unhandled attribute 'allow_uav_condition' the attribute is removed (it is a hint only)
5 CreateRootSignature(<the whole compiled blob>) returns E_FAIL — the host rejects wine's embedded root signature, exactly as it rejects it for any built-in pipeline new rootstring.rs reads each source's own #define RS "…", builds the D3D12_ROOT_SIGNATURE_DESC and serializes it with D3D12SerializeRootSignature — the path the title's own signatures already take

Rung 5 is the one that mattered most: it is the same 12 call sites, and every built-in pipeline (both clamps, the ambient, the composer, the host's plane pipelines, the card compare, awake, send, upcheck, the light probe, in-place, the replay merge) fell with it.

Measured, before and after (RX 9060 XT, RADV)

before after
no argument clamp: indirect execution dropped every run 0
no stand-in for the indirect light every run 0
indirect mesh dispatches: … groups asked per frame 0 (always) 7 219 – 14 393
world draws/frame 134–429 with 544 dropped 2 737 with 0 dropped by the clamp
what the screen showed black from the first frame the world, lit, with its interface

Notes for reviewers

  • Rung 1 and 3 touch ambient.rs only inside the diagnostic stats block and one NaN/Inf guard; the lighting math is unchanged.
  • Rung 2 keeps the budget in the same memory, words 0..5, so the Rust side (root UAV by address) needs no change.
  • Rung 4 only drops an attribute; wine's compiler is the only one that rejects it.
  • Rung 5 is generic: it builds every built-in signature from the same RS string the HLSL already carries, so the two cannot drift.
  • Wine's d3dcompiler is still the compiler for these sources; the ladder removes every construct it rejects today, not the compiler.

The rest of what this port needed on Linux — a CPU-side overflow view heap for the slots past a capped host's heap, the 2020 DirectStorage queue slots, and a plain copy mode that only copies committed pages — is in wip/all on my fork if any of it is wanted here.

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:5514557867 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/338). Originally posted by [GustawMatuszewski](https://github.com/GustawMatuszewski) on 2026-11-26T17:30:40Z. --- ## What this is Five fixes that make this tree's **built-in shaders and pipelines work under Wine + vkd3d-proton**, and with them the world renders on Linux. Before them the 3D world was black: the same symptoms as the "black screen" reports on Windows hosts whose view heap is capped (issue #3081's "before" row), but reached a different way — every built-in pipeline failed to build, so the indirect argument clamp and the ambient light were dead and every world indirect dispatch was dropped. Tested on one machine: **RX 9060 XT 16 GB, RADV (Mesa), GE-Proton 11.14 (wine 11.0 + vkd3d-proton), Series X profile**, commit `c9c932c` + this branch. The operator watched the world render on the display. No game files, code only. ## The ladder, in the order each rung was hit | # | Failure under Wine | Fix | |---|---|---| | 1 | `E5005: Method 'InterlockedAdd' is not defined on type 'RWByteAddressBuffer'` (the ambient's stats) | the stats writes are gated behind `#ifdef STATS`; the light itself is untouched | | 2 | `E5005: Method 'InterlockedOr'/'InterlockedMax'/'InterlockedCompareExchange' …` (the argument clamp's budget) | the same words are addressed through an `RWStructuredBuffer<uint>` view and the free-function `InterlockedOr/Max/Add/CompareExchange` form | | 3 | `E5005: Function "isnan"/"isinf"` (the ambient) | `c != c` / the same check written out | | 4 | `E5017: … Unhandled attribute 'allow_uav_condition'` | the attribute is removed (it is a hint only) | | 5 | **`CreateRootSignature(<the whole compiled blob>)` returns `E_FAIL`** — the host rejects wine's embedded root signature, exactly as it rejects it for any built-in pipeline | new `rootstring.rs` reads each source's own `#define RS "…"`, builds the `D3D12_ROOT_SIGNATURE_DESC` and serializes it with `D3D12SerializeRootSignature` — the path the title's own signatures already take | Rung 5 is the one that mattered most: it is the same 12 call sites, and every built-in pipeline (both clamps, the ambient, the composer, the host's plane pipelines, the card compare, awake, send, upcheck, the light probe, in-place, the replay merge) fell with it. ## Measured, before and after (RX 9060 XT, RADV) | | before | after | |---|---|---| | `no argument clamp: indirect execution dropped` | every run | **0** | | `no stand-in for the indirect light` | every run | **0** | | `indirect mesh dispatches: … groups asked per frame` | **0** (always) | **7 219 – 14 393** | | world draws/frame | 134–429 with 544 dropped | 2 737 with 0 dropped by the clamp | | what the screen showed | black from the first frame | the world, lit, with its interface | ## Notes for reviewers - Rung 1 and 3 touch `ambient.rs` only inside the diagnostic stats block and one NaN/Inf guard; the lighting math is unchanged. - Rung 2 keeps the budget in the same memory, words 0..5, so the Rust side (root UAV by address) needs no change. - Rung 4 only drops an attribute; wine's compiler is the only one that rejects it. - Rung 5 is generic: it builds every built-in signature from the same `RS` string the HLSL already carries, so the two cannot drift. - Wine's `d3dcompiler` is still the compiler for these sources; the ladder removes every construct it rejects today, not the compiler. The rest of what this port needed on Linux — a CPU-side overflow view heap for the slots past a capped host's heap, the 2020 DirectStorage queue slots, and a plain copy mode that only copies committed pages — is in `wip/all` on my fork if any of it is wanted here.
ArturoWolff commented 2026-11-26 20:57:28 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by ArturoWolff on 2026-11-26T20:57:28Z.


Independent NVIDIA/Proton qualification of this patch, and one remaining compositor parser fix.

I compared the exact direct parent c9c932cbcc38defd8f1683d62dd298187f565031, the authored head a8c28bac2f265d829a386c569c839f5e5a0e5b5e, and that same head with a one-line correction in rootstring.rs. Hardware: RTX 4060 8 GiB, 16 GiB system RAM, GE-Proton 11-14 (Wine 11.0 Staging, vkd3d-proton 3.2.0 build 71cae091b06571e, NVIDIA 620.73.04). Actual loader log confirms builtin d3dcompiler_47.dll in all three arms. Separate Windows Cargo targets, identical cloned starting prefixes, initially empty per-arm driver-cache directories, identical DLLs and graphics settings. A private virtual X server provided DXGI initialization only. No game assets, title execution, display capture, input, or feature reductions.

Focused ordinary D3D12 check Parent PR head Head + correction
Explicit serialized-root compute control pass pass pass
Six ambient pipeline constructors fail pass pass
Two depth-plane pipeline constructors fail pass pass
Single/batch indirect clamp constructors fail pass pass
Production root path + numeric compute dispatch fail pass pass
Compositor constructor fail fail pass
Existing premultiplied-plane numeric test, hardware required not run not run pass
Focused suite 1/6 5/6 7/7
Windows test-process exit 101 101 0

The compiler probes independently separate compilation from signature extraction. Parent: 8/13 entry-point/profile probes compiled; the other five hit the isnan or RWByteAddressBuffer atomic-method errors described here. PR head: 13/13 compiled. Every successful builtin compilation still warned W5302: Ignoring unknown attribute "RootSignature"; D3DGetBlobPart(D3D_BLOB_ROOT_SIGNATURE) returned 0x80004005, zero signature bytes, and using the entire compiled blob as a root signature also returned 0x80004005. The new explicit serialization path restores the named constructor groups and real compute execution despite this. All five successful smoke dispatches/readbacks matched 16 transformed u32s plus four untouched sentinel words (400 bytes in total), with an independent CPU oracle and a completed fence.

Remaining failure in the authored head: Composer::new returned Err with HRESULT 0x00000000 (Error::empty()), not a working pipeline. compose.rs declares filter=FILTER_MIN_MAG_MIP_LINEAR, but rootstring.rs::filter does not recognize that token. I added only this match arm to the production code:

"FILTER_MIN_MAG_MIP_LINEAR" => D3D12_FILTER_MIN_MAG_MIP_LINEAR,

The corrected constructor passes. I also ran the existing compose::tests::composes_scaled_premultiplied_plane_on_gpu with a test-only wrapper requiring the actual RTX 4060, so a no-device skip cannot pass the qualification. The 3x1 output is [127, 0, 0, 255, 64, 127, 0, 255, 0, 0, 255, 255] versus its existing expectation [128, 0, 0, 255, 64, 128, 0, 255, 0, 0, 255, 255]. All 12 channels satisfy the existing ±1 tolerance. The same filter spelling also occurs in an ignored diagnostic test in indirect.rs; I did not run that test. I recommend adding the match arm and keeping the compositor regression as a required hardware check. Returning a failing HRESULT for parser refusal would also make future missing-token errors less misleading.

All three cross-builds succeeded (cargo test --profile diag -p victory-gpu --lib --features diagnostics --no-run --locked --offline --target x86_64-pc-windows-gnullvm). The focused tests ran serially with fresh prefixes; their exits above are assertion-test outcomes, not title crashes. External host-memory guard 512 MiB, no restrictive memory/swap cgroup caps, no host OOM kills or detected kernel GPU faults. This is NVIDIA corroboration of the ordinary built-in compiler/signature compatibility changes, not verification of the reported lit world, AMD/native Windows behavior, the complete set of built-ins, retail FPS, or gameplay.

AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Sol Max).

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7203242348 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/338#issuecomment-7203242348). Originally posted by [ArturoWolff](https://github.com/ArturoWolff) on 2026-11-26T20:57:28Z. --- Independent NVIDIA/Proton qualification of this patch, and one remaining compositor parser fix. I compared the exact direct parent `c9c932cbcc38defd8f1683d62dd298187f565031`, the authored head `a8c28bac2f265d829a386c569c839f5e5a0e5b5e`, and that same head with a one-line correction in `rootstring.rs`. Hardware: RTX 4060 8 GiB, 16 GiB system RAM, GE-Proton 11-14 (Wine 11.0 Staging, vkd3d-proton 3.2.0 build `71cae091b06571e`, NVIDIA 620.73.04). Actual loader log confirms builtin `d3dcompiler_47.dll` in all three arms. Separate Windows Cargo targets, identical cloned starting prefixes, initially empty per-arm driver-cache directories, identical DLLs and graphics settings. A private virtual X server provided DXGI initialization only. No game assets, title execution, display capture, input, or feature reductions. | Focused ordinary D3D12 check | Parent | PR head | Head + correction | |---|---|---|---| | Explicit serialized-root compute control | pass | pass | pass | | Six ambient pipeline constructors | fail | pass | pass | | Two depth-plane pipeline constructors | fail | pass | pass | | Single/batch indirect clamp constructors | fail | pass | pass | | Production root path + numeric compute dispatch | fail | pass | pass | | Compositor constructor | fail | fail | pass | | Existing premultiplied-plane numeric test, hardware required | not run | not run | pass | | Focused suite | 1/6 | 5/6 | 7/7 | | Windows test-process exit | 101 | 101 | 0 | The compiler probes independently separate compilation from signature extraction. Parent: 8/13 entry-point/profile probes compiled; the other five hit the `isnan` or `RWByteAddressBuffer` atomic-method errors described here. PR head: 13/13 compiled. Every successful builtin compilation still warned `W5302: Ignoring unknown attribute "RootSignature"`; `D3DGetBlobPart(D3D_BLOB_ROOT_SIGNATURE)` returned `0x80004005`, zero signature bytes, and using the entire compiled blob as a root signature also returned `0x80004005`. The new explicit serialization path restores the named constructor groups and real compute execution despite this. All five successful smoke dispatches/readbacks matched 16 transformed u32s plus four untouched sentinel words (400 bytes in total), with an independent CPU oracle and a completed fence. **Remaining failure in the authored head:** `Composer::new` returned `Err` with HRESULT `0x00000000` (`Error::empty()`), not a working pipeline. `compose.rs` declares `filter=FILTER_MIN_MAG_MIP_LINEAR`, but `rootstring.rs::filter` does not recognize that token. I added only this match arm to the production code: ```rust "FILTER_MIN_MAG_MIP_LINEAR" => D3D12_FILTER_MIN_MAG_MIP_LINEAR, ``` The corrected constructor passes. I also ran the existing `compose::tests::composes_scaled_premultiplied_plane_on_gpu` with a test-only wrapper requiring the actual RTX 4060, so a no-device skip cannot pass the qualification. The 3x1 output is `[127, 0, 0, 255, 64, 127, 0, 255, 0, 0, 255, 255]` versus its existing expectation `[128, 0, 0, 255, 64, 128, 0, 255, 0, 0, 255, 255]`. All 12 channels satisfy the existing ±1 tolerance. The same filter spelling also occurs in an ignored diagnostic test in `indirect.rs`; I did not run that test. I recommend adding the match arm and keeping the compositor regression as a required hardware check. Returning a failing HRESULT for parser refusal would also make future missing-token errors less misleading. All three cross-builds succeeded (`cargo test --profile diag -p victory-gpu --lib --features diagnostics --no-run --locked --offline --target x86_64-pc-windows-gnullvm`). The focused tests ran serially with fresh prefixes; their exits above are assertion-test outcomes, not title crashes. External host-memory guard 512 MiB, no restrictive memory/swap cgroup caps, no host OOM kills or detected kernel GPU faults. This is NVIDIA corroboration of the ordinary built-in compiler/signature compatibility changes, not verification of the reported lit world, AMD/native Windows behavior, the complete set of built-ins, retail FPS, or gameplay. AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Sol Max).
Tymon3310 commented 2026-11-27 00:20:17 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by Tymon3310 on 2026-11-27T00:20:17Z.


The rootstring parser is missing FILTER_MIN_MAG_MIP_LINEAR, one of the most common filters.

On Belobug's a-publier (4eb6cfd + this commit cherry-picked), the two-plane composer's root signature (compose.rs: StaticSampler(s0, filter=FILTER_MIN_MAG_MIP_LINEAR, ...)) is refused with the RS is of a word not understood. Composer::new then fails every frame (two-plane composer not made; showing base plane only), so under Proton the intro video, menus and loading screens are all black while the audio plays.

One line in filter() fixes it:

"FILTER_MIN_MAG_MIP_LINEAR" => D3D12_FILTER_MIN_MAG_MIP_LINEAR,

Tested on an RX 6800 XT (RADV, Mesa 26.3.1), proton-cachyos 11.0 and GDK-Proton 11-7: with it, the composer is made and everything renders. I checked every other #define RS in crates/victory-gpu/src against the parser, and nothing else is missing.

AI-assisted (Claude Code). No game files.

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7206376272 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/338#issuecomment-7206376272). Originally posted by [Tymon3310](https://github.com/Tymon3310) on 2026-11-27T00:20:17Z. --- The `rootstring` parser is missing `FILTER_MIN_MAG_MIP_LINEAR`, one of the most common filters. On Belobug's `a-publier` (4eb6cfd + this commit cherry-picked), the two-plane composer's root signature (`compose.rs`: `StaticSampler(s0, filter=FILTER_MIN_MAG_MIP_LINEAR, ...)`) is refused with `the RS is of a word not understood`. `Composer::new` then fails every frame (`two-plane composer not made; showing base plane only`), so under Proton the intro video, menus and loading screens are all black while the audio plays. One line in `filter()` fixes it: ```rust "FILTER_MIN_MAG_MIP_LINEAR" => D3D12_FILTER_MIN_MAG_MIP_LINEAR, ``` Tested on an RX 6800 XT (RADV, Mesa 26.3.1), proton-cachyos 11.0 and GDK-Proton 11-7: with it, the composer is made and everything renders. I checked every other `#define RS` in `crates/victory-gpu/src` against the parser, and nothing else is missing. AI-assisted (Claude Code). No game files.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/338:upstream-pr/338'
git switch 'upstream-pr/338'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/338'
git switch 'upstream-pr/338'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/338'
git switch 'upstream-pr/338'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/338'
git switch 'main'
git merge --squash 'upstream-pr/338'
git switch 'main'
git merge --ff-only 'upstream-pr/338'
git switch 'main'
git merge 'upstream-pr/338'
git push origin 'main'
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
avatarmanz/VIctory-7900XTX!338
No description provided.