Repository navigation
Conversation
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>
fuzeofficlal
left a comment
There was a problem hiding this comment.
Verified head 13f215d5 cleanly on origin/main (63bcca43) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + D3D12 WARP + VICTORY_D3D12_DEBUG=1).
Code & Equivalence Review
- Replacing inline
[RootSignature(RS)]andRWByteAddressBufferwith explicitD3D12SerializeRootSignature(D3D_ROOT_SIGNATURE_VERSION_1_0:b08 constants +u0UAV table) andRWStructuredBuffer<uint>preserves exact word addressing because placed footprint offsets (at16/at32, 512 B aligned), pitches (256 B aligned), and 2-texel thread pairs (x * 2= 4 B aligned) are all 4-byte aligned. - 16-bit depth (
D16_UNORM<->D32_FLOAT) round-trip encoding (0x37800080andsaturate * 65535.0 + 0.5, plus odd-width high-half zeroing) matches bit-for-bit, andD32/D24S8continue taking thesame == truecopy path.
Local Verification (--features diagnostics, VICTORY_D3D12_DEBUG=1)
- RTX 5090 & WARP:
twin::tests+draw::tests23/23 passed on both adapters (including newthe_converter_turns_16_bit_depth_into_float_and_back), zero debug-layer errors. cargo clippy --locked -p victory-gpu --tests -- -D warnings(default and--features diagnostics) &cargo xtask policy(191 files ok): clean.
Looks clean and ready to merge.
|
Windows 11 / NVIDIA test run, head Setup: Windows 11 Home build 26300, RTX 5080, NVIDIA 621.40, rustc 1.98.1 MSVC, VS 2022 Build Tools, Windows SDK 10.0.26100 (
Not run: the retail title, clippy, and other crates. AI-assisted (Claude Code) |
kotekompotek
left a comment
There was a problem hiding this comment.
Verified the same conversion as #2913 applied to the depth converter: byte offsets divided to word indices (/4, b+4 -> b+1), structured uint buffer via root descriptor, root signature built beside the shader. The saturate/round u16 path is untouched. LGTM.
|
Automated triage for the maintainers. Merge candidate. The 16-bit depth converter in CI: passing. Generated by Claude Code |
Dukestar69
left a comment
There was a problem hiding this comment.
Tested locally merged onto origin/main (63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP):
- Diff review: Replacing
RWByteAddressBufferwithRWStructuredBuffer<uint>(using 4-byte-aligned word indices) and serializing the root signature explicitly viaD3D12SerializeRootSignaturecleanly avoids Wine FXC limitations while preserving exact 16-bit depth conversion semantics. cargo test -p victory-gpu twin::tests -- --test-threads=1(RTX 5090 & WARP): 3 passed, 0 failed on both (includingthe_converter_turns_16_bit_depth_into_float_and_back).cargo test -p victory-gpu a_depth_texture_written_through_unordered_views_reads_as_depth -- --test-threads=1(RTX 5090 & WARP): 1 passed, 0 failed on both.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
…lds too From Marvisak/VIctory#2919 (opened by arogan178; original commits and authors kept). Not yet merged upstream. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both were HLSL compiled at first use with D3DCompile. Under Wine that is vkd3d-shader's compiler, which refuses them (no methods on RWByteAddressBuffer, [RootSignature] ignored), so indirect execution was dropped and 16-bit depth written through unordered views never reached the depth texture. The rewrites in Marvisak#2913, Marvisak#2919 and Marvisak#2969 still need a Wine of 11.22 or later. victory-shader now writes both programs itself with its DXIL builder (emit::argument_clamp, emit::depth_conversion), the same algorithm and clamps as the HLSL, and victory-gpu makes their root signatures in code (own.rs). No shader compiler runs, whatever the Wine version. Tests: every_word_of_each_kind checks each word the clamp writes for every record kind; depth_converts_both_ways runs the conversion both ways on a buffer, with no compiler for the test either; our_programs_validate runs both through the DXIL validator where the SDK has one. Under Wine 10 and vkd3d-proton 3.1 the 7 indirect tests and the new depth test pass (6 indirect tests failed before), and the two draw tests that read converted depth pass with a native compiler for their own shaders. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Under Wine and Proton, 16-bit depth that the title writes through unordered views never reaches the host's depth texture (#1860). It is moved by a compute converter compiled at run time. Wine's built-in
d3dcompiler_47(vkd3d-shader) refuses it, because it has noLoad/Storeon byte address buffers, and it ignores theRootSignatureattribute. The converter is never made.#1872 serializes the root signature when the compiler drops it. That is half of it: with Proton-CachyOS 11.0's compiler the shader still fails on
buf.Load, and #1872's own test fails there too. This PR does both halves, the way #2913 does for the indirect clamp:uint, indexed in words. Every offset and pitch comes from a placed footprint: offsets are 512-byte aligned, row pitches 256.The conversion itself is unchanged. A new test runs it both ways on a 3-wide surface, with a distinct value per texel and a sentinel in each row's padding. It is adapted from #1872's test.
Fixes #1860. Supersedes #1872.
Proof
victory-gputests cross-built forx86_64-pc-windows-msvc, run under Proton-CachyOS 11.0 with vkd3d-proton 3.2.0 on an RX 9070 XT (RADV):main's shader swapped back in, it fails because the converter is never built. With the odd-width tail guard removed, it fails on the padding sentinel.d3dcompiler_4710.0.26100: the new test passes. The whole suite has the same 3 failures asmain. They are vkd3d-proton issues fixed by GPU: the host pipeline library works under Wine (null blob for an empty library) #1722 and GPU: castable formats the host has #2101.cargo clippy -p victory-gpu --all-targets --target x86_64-pc-windows-msvc -- -D warnings, with and without--all-features, is clean. CI runs the Windows tests.Reviewed with sol-loop: 1 round with GPT-6.2 Sol. Sol verdict: approved (its one nit, a stronger test fixture, is in).