Repository navigation
GPU: the depth twin's converter builds its root signature when the compiler drops it (Wine) - #1872
BastienRodz wants to merge 2 commits into
Conversation
|
@BastienRodz thanks for taking this. Ran With Microsoft's With Wine's own compiler, neither test gets there.
I had said on #1860 that this compiler only drops the attribute ( AI-assisted; tests run on this machine. |
|
@CaravelaLabs Thanks, that's the decisive run: the fallback is needed but not enough, because vkd3d-shader stops at |
|
Moving this to draft: on its own it doesn't fix #1860 for Wine users. Here is what I found with Wine's builtin
So the root-signature fallback here is needed but not sufficient. There seem to be two real options: that heap rework, or building the converter with the shader crate's own DXIL writer so no run-time HLSL compiler is involved (Exorion1er did that for the rectangle expander in #346). I'll leave it in draft until it's clear which one the maintainer prefers. |
catminou4
left a comment
There was a problem hiding this comment.
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
Depth twin converter builds its root signature when needed: lazy root-signature creation — avoids building unused ones.
…ds its root signature when the compiler drops it (Wine) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mercuryVM
left a comment
There was a problem hiding this comment.
Tested 654301a on Windows 11, RTX 5070, MSVC:
cargo test -p victory-gpupasses on the head, apart from the 2 tests that also fail on main on this host.- Merged into our fork: workspace tests and clippy (both configs) clean.
- I didn't run it under Wine.
The fallback is right. It is the same root signature the HLSL declares (RootConstants(num32BitConstants=8, b0), UAV(u0)), version 1.0, used only when CreateRootSignature refuses the blob. That is the case when vkd3d-shader drops the embedded RTS0. On native Windows the blob's own signature is still used, as here.
AI-assisted (Claude Code).
|
Automated triage for the maintainers. Needs rebase. This branch conflicts with Generated by Claude Code |
…mpiler drops it (Wine) `crates/victory-gpu/src/twin.rs` compiles the 16-bit depth twin converter (`cs_5_1`) with `[RootSignature(RS)]` and then calls `device.CreateRootSignature(0, bytes)` on the shader blob itself. Wine's builtin `d3dcompiler_47` (vkd3d-shader, Wine 11.22 in Marvisak#1860) ignores `[RootSignature]` with warning W5302, so `CreateRootSignature` fails with `0x80004005`, `converter()` returns `None`, and 16-bit depth writes through unordered views never reach the depth texture. Try `device.CreateRootSignature(0, bytes)` first so Microsoft's `d3dcompiler_47` path is unchanged. On failure, serialize the same v1.0 `D3D12_ROOT_SIGNATURE_DESC` (param 0: 8 32-bit constants at b0, space 0; param 1: root UAV at u0, space 0; visibility ALL, no flags) with `D3D12SerializeRootSignature`, create the root signature from that blob, and log once at debug level. Also add a unit test that strips `[RootSignature(RS)]` from `SOURCE` and verifies the fallback converter converts 16-bit depth to 24-bit and back on the GPU. Under Wine 10.0 + vkd3d-proton 3.1: - `a_depth_texture_written_through_unordered_views_reads_as_depth` passes with native `d3dcompiler_47=n` before and after; with builtin `d3dcompiler_47=b` it panics in test helper `draw::tests::compile_cs` (`draw.rs:1872`, `0x80004005`) before reaching `twin.rs`, and Wine 10.0's older vkd3d-shader rejects `RWByteAddressBuffer::Load` (`E5005`) during `D3DCompile`. - `converter_falls_back_when_shader_blob_has_no_root_signature` exercises the exact Wine 11.22 no-root-signature blob path and passes under vkd3d-proton 3.1 + `d3dcompiler_47=n`, converting `0x1234` to `0x123412` and `0x800000` to `32768`. Fixes Marvisak#1860. Co-Authored-By: Gemini 4 Neon <noreply@google.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
654301a to
84f428c
Compare
…verter writes since 98c654b Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Note 🤖 Claude Opus 5.5 responding on behalf of @arogan178 On Proton-CachyOS 11.0 (RX 9070 XT, RADV), this PR's fallback isn't reached. Wine's built-in compiler fails on the shader's #2919 adds the other half: structured buffers indexed in words, plus a root signature that is always built in code. It also carries your round-trip test, which passes there with Wine's compiler. You're credited as co-author. |
|
Closing in favour of #2919, which does both halves under Wine: the structured buffer the built-in compiler accepts, plus the root signature built in code. It carries this PR's round-trip test, adapted. That is what this draft was missing: the root signature alone never helped, because Wine's compiler fails on Thanks @arogan178 for taking it the rest of the way and for the co-author credit. |
…ture when the compiler drops it) twin.rs tests: main's prelude-state test and Marvisak#1872's fallback test both kept. Main's converter now writes 32-bit float depth (0x37800080 scale), not 24-bit, so Marvisak#1872's test expects that: 0x1234 as main's float, and float 0.5 back to 32768. It passes with Microsoft's d3dcompiler_47; with Wine's builtin compiler main's new converter source fails D3DCompile (E_FAIL) before the fallback is reached. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous renderer (old upstream base 940d32f) is the first parent and is also kept as the branch renderer-2026-11-25-oldbase; the second parent is the rebuild: fork main (upstream main 63bcca4 + our pull requests) with the renderer stack merged on it: Marvisak#439 (on main: update/439-main's resolution), Marvisak#2309, Marvisak#2167, Marvisak#2118, Marvisak#2311, Marvisak#1722, Marvisak#1751, Marvisak#688, Marvisak#1872, Marvisak#2292, Marvisak#2310, Marvisak#2112 (opt-in), Marvisak#2230 (latch on by default), Marvisak#2389, Marvisak#2088 (small windows opt-in), Marvisak#2099's new head, and tonight's Marvisak#491 journal fixes. Merged upstream since: Marvisak#2143, Marvisak#2162, Marvisak#158, Marvisak#1906, Marvisak#1152; superseded by main: Marvisak#1769, Marvisak#1763, Marvisak#2366. The picture on this base still shows the overlay that plain upstream main shows too; that is being looked into. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16-bit depth written through unordered views reaches the host's depth texture through a compute converter compiled at run time. Wine's and Proton's built-in d3dcompiler_47 refuse it (no methods on byte address buffers) and ignore its RootSignature attribute, so the converter is never made and that depth stays clear (Marvisak#1860). The buffer becomes a structured buffer of uint indexed in words (every offset and pitch is a placed footprint's, a multiple of 4), and the root signature is serialized beside the shader. A test runs the conversion both ways, after Marvisak#1872's. Co-authored-by: BastienRdz <58186763+BastienRodz@users.noreply.github.com>
What's wrong
In #1860, 16-bit depth written through unordered access views never
reaches the host 24-bit depth texture under Wine's builtin
d3dcompiler_47:crates/victory-gpu/src/twin.rscompiles the compute converter(
SOURCE,cs_5_1, with#define RS "RootConstants(num32BitConstants=8, b0), UAV(u0)"and[RootSignature(RS)]) and then callsdevice.CreateRootSignature(0, bytes)on the shader blob itself.d3dcompiler_47(vkd3d-shader, as measured in Wine: 16-bit depth written through unordered views stays clear, because the converter shader does not compile #1860on Wine 11.22) ignores the
[RootSignature]attribute with warningW5302, producing a shader blob without an embedded root signature.CreateRootSignature(0, bytes)then fails with0x80004005(
E_FAIL), soconverter()returnsNoneandTwin::copyskipsconversion, leaving the depth texture clear.
What the fix does
crates/victory-gpu/src/twin.rs,compile()(factored throughcompile_source(source: &str)) still triesdevice.CreateRootSignature(0, bytes)first, leaving the Microsoftd3dcompiler_47path unchanged.CreateRootSignature(0, bytes)fails, it falls back tofallback_root_signature(device), which serializes the matchingD3D12_ROOT_SIGNATURE_DESC(version 1.0,D3D12_ROOT_SIGNATURE_FLAG_NONE,D3D12_SHADER_VISIBILITY_ALL):b0, space 0(
SetComputeRoot32BitConstants(0, 8, ...)),u0, space 0(
SetComputeRootUnorderedAccessView(1, ...)),via
D3D12SerializeRootSignature, creates theID3D12RootSignature,and logs once at
debuglevel (converter()isOnceLock-cached).tracing::warn!message in
converter()is unchanged.twin::tests::converter_falls_back_when_shader_blob_has_no_root_signature,which strips
[RootSignature(RS)]fromSOURCE, compiles it throughcompile_source, and dispatches the fallback converter in bothdirections (16-bit
0x1234→ 24-bit0x123412, and 24-bit0x800000→ 16-bit32768).Tests
twin::tests::converter_falls_back_when_shader_blob_has_no_root_signature(new). It compilesSOURCEwith[RootSignature(RS)]stripped, which gives the same blob Wine's compiler produces afterW5302. On that blob,CreateRootSignaturefails, so the fallback builds the signature, the pipeline is created, and the GPU converts all 16 texels both ways: 16-bit0x1234becomes 24-bit0x123412, and 24-bit0x800000becomes 16-bit32768.windows-latest.draw::tests::a_depth_texture_written_through_unordered_views_reads_as_depthpasses as before with Microsoft's compiler (natived3dcompiler_47under Wine + vkd3d-proton, andwindows-latest).windows-latestwith the upstream CI's commands,victory-gpuhas 79 passed, 0 failed, both tests included: https://github.com/BastienRodz/VIctory/actions/runs/45513753703victory-shader'sgathers_at_a_level_match_the_hardwareandpermutes_read_the_lane_named_and_zero_from_lanes_left_out. They fail the same way onmain70564ae(software adapter on the runner), and Shader tests: a software adapter (a CI runner's) skips what only GPU hardware does #1752 fixes them.-D warningspasses with and without--all-features, and so doescargo xtask policy.Not reproduced exactly: this host's Wine 10.0 has an older vkd3d-shader than #1860's Wine 11.22. It rejects
SOURCEeven earlier (E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'), so the issue's exact path (compile succeeds, signature dropped) could only be reproduced by stripping the attribute, as above. A run on Wine 11.22 + RADV, as in the report, would confirm it end to end.Not tested: an AMD or NVIDIA Windows driver. The Microsoft compiler path is unchanged there.
Fixes #1860.
No game data used. AI-assisted: implemented with Gemini 4 Neon, reviewed and verified with Claude Code.
🤖 Generated with Claude Code