Wine: 16-bit depth written through unordered views stays clear, because the converter shader does not compile #1860

Open
opened 2026-11-26 04:46:45 +00:00 by github-bot · 5 comments
Owner

@⁠CaravelaLabs on GitHub · 2026-11-24 23:38 UTC · original

On main 70564ae, a 16-bit depth value written through the unordered-access twin does not reach the depth texture when the converter cannot be built. Measured here under Wine 11.22 + vkd3d-proton 3.1 + Mesa 25.2.8, Radeon 8060S (RADV GFX1151). Not the AMD Windows driver. The title was not run.

A 4×4 depth texture got the unordered view, and the twin was created (16-bit plane, 24-bit depth footprint, so a conversion is required). 0x1234 was in every texel of the twin. After the copy toward the depth texture, the depth plane was still 0, not 0x123412 (u * 256 + (u * 255 + 32767) / 65535). The copy reported that it did not convert. Three runs, same numbers. The device was not removed.

Correction: an earlier version of this note said Wine's compiler accepts the converter shader and only warns W5302 about [RootSignature]. That warning was from a shorter shader that only carried the attribute, not from this converter's source. Compiling the converter source with Wine's builtin d3dcompiler_47 fails first, E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer' (buf.Load). The root-signature step is never reached, so the converter is never created, and the copy still runs. The depth side of the scratch buffer was never filled, so the depth texture stays clear. github.com/Marvisak/VIctory@70564ae08c/crates/victory-gpu/src/twin.rs (L484)

With Microsoft's d3dcompiler_47 on the same stack, the project's own a_depth_texture_written_through_unordered_views_reads_as_depth passes (3 of 3). The GPU can convert when the shader compiles and the signature is in the blob. The gap is Wine's compiler, which is what this run, and many Linux players, use by default.

A signature built beside the shader does not cover this on Wine 11.22: the compile fails before that fallback runs. #1872 is that fallback. The run is on that pull request.

#170 is a different shader: the indirect clamp, which does not compile at all.

AI-assisted check, run on this machine.

**@⁠CaravelaLabs** on GitHub · 2026-11-24 23:38 UTC · [original](https://github.com/Marvisak/VIctory/issues/1860) On main `70564ae`, a 16-bit depth value written through the unordered-access twin does not reach the depth texture when the converter cannot be built. Measured here under Wine 11.22 + vkd3d-proton 3.1 + Mesa 25.2.8, Radeon 8060S (RADV GFX1151). Not the AMD Windows driver. The title was not run. A 4×4 depth texture got the unordered view, and the twin was created (16-bit plane, 24-bit depth footprint, so a conversion is required). `0x1234` was in every texel of the twin. After the copy toward the depth texture, the depth plane was still 0, not `0x123412` (`u * 256 + (u * 255 + 32767) / 65535`). The copy reported that it did not convert. Three runs, same numbers. The device was not removed. Correction: an earlier version of this note said Wine's compiler accepts the converter shader and only warns `W5302` about `[RootSignature]`. That warning was from a shorter shader that only carried the attribute, not from this converter's source. Compiling the converter source with Wine's builtin `d3dcompiler_47` fails first, `E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'` (`buf.Load`). The root-signature step is never reached, so the converter is never created, and the copy still runs. The depth side of the scratch buffer was never filled, so the depth texture stays clear. https://github.com/Marvisak/VIctory/blob/70564ae08c82d43df5fad97b08d34628b07b1d9d/crates/victory-gpu/src/twin.rs#L484 With Microsoft's `d3dcompiler_47` on the same stack, the project's own `a_depth_texture_written_through_unordered_views_reads_as_depth` passes (3 of 3). The GPU can convert when the shader compiles and the signature is in the blob. The gap is Wine's compiler, which is what this run, and many Linux players, use by default. A signature built beside the shader does not cover this on Wine 11.22: the compile fails before that fallback runs. #1872 is that fallback. The run is on that pull request. #170 is a different shader: the indirect clamp, which does not compile at all. AI-assisted check, run on this machine.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:46:45 +00:00
Author
Owner

@⁠BastienRodz on GitHub · 2026-11-24 23:43 UTC · original

Taking this. The fix: when the shader blob has no root signature, compile() serializes the converter's RootConstants(8, b0), UAV(u0) with D3D12SerializeRootSignature. The Microsoft compiler path stays as it is. I'll check it against a_depth_texture_written_through_unordered_views_reads_as_depth under Wine + vkd3d-proton with the builtin and the native d3dcompiler_47, then open the PR.

**@⁠BastienRodz** on GitHub · 2026-11-24 23:43 UTC · [original](https://github.com/Marvisak/VIctory/issues/1860#issuecomment-7147730340) Taking this. The fix: when the shader blob has no root signature, `compile()` serializes the converter's `RootConstants(8, b0), UAV(u0)` with `D3D12SerializeRootSignature`. The Microsoft compiler path stays as it is. I'll check it against `a_depth_texture_written_through_unordered_views_reads_as_depth` under Wine + vkd3d-proton with the builtin and the native `d3dcompiler_47`, then open the PR.
Author
Owner

@⁠BastienRodz on GitHub · 2026-11-24 23:56 UTC · original

PR: #1872. @⁠CaravelaLabs, could you run a_depth_texture_written_through_unordered_views_reads_as_depth on its branch with your Wine 11.22 + RADV setup? This host's Wine 10 compiler rejects the shader before it gets to the root-signature step, so I could only check the fallback by compiling with the attribute stripped.

**@⁠BastienRodz** on GitHub · 2026-11-24 23:56 UTC · [original](https://github.com/Marvisak/VIctory/issues/1860#issuecomment-7147966076) PR: #1872. @⁠CaravelaLabs, could you run `a_depth_texture_written_through_unordered_views_reads_as_depth` on its branch with your Wine 11.22 + RADV setup? This host's Wine 10 compiler rejects the shader before it gets to the root-signature step, so I could only check the fallback by compiling with the attribute stripped.
Author
Owner

@⁠CaravelaLabs on GitHub · 2026-11-25 00:08 UTC · original

@⁠BastienRodz ran both tests on 654301a. The result is on #1872.

Short version: with Microsoft's compiler both pass, including your fallback. With Wine 11.22's own compiler the converter source fails first, E5005 on buf.Load, so the fallback is not reached. Same text you saw on Wine 10. I corrected the note above: the W5302 line was from a shorter shader, not this source. Sorry for the bad lead.

**@⁠CaravelaLabs** on GitHub · 2026-11-25 00:08 UTC · [original](https://github.com/Marvisak/VIctory/issues/1860#issuecomment-7148194765) @⁠BastienRodz ran both tests on `654301a`. The result is on #1872. Short version: with Microsoft's compiler both pass, including your fallback. With Wine 11.22's own compiler the converter source fails first, `E5005` on `buf.Load`, so the fallback is not reached. Same text you saw on Wine 10. I corrected the note above: the `W5302` line was from a shorter shader, not this source. Sorry for the bad lead.
Author
Owner

@⁠BastienRodz on GitHub · 2026-11-25 00:28 UTC · original

Status: #1872 is in draft. Wine's compiler rejects every read on RWByteAddressBuffer (Load and all Interlocked*) and every RWStructuredBuffer store, so the root-signature fallback alone can't fix it. Only a typed RWBuffer through a descriptor table works under the builtin compiler, and it means reworking heap binding in draw.rs. Details and the two options are on #1872.

**@⁠BastienRodz** on GitHub · 2026-11-25 00:28 UTC · [original](https://github.com/Marvisak/VIctory/issues/1860#issuecomment-7148548001) Status: #1872 is in draft. Wine's compiler rejects every read on `RWByteAddressBuffer` (`Load` and all `Interlocked*`) and every `RWStructuredBuffer` store, so the root-signature fallback alone can't fix it. Only a typed `RWBuffer` through a descriptor table works under the builtin compiler, and it means reworking heap binding in `draw.rs`. Details and the two options are on #1872.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 12:50 UTC · original

Automated triage for the maintainers.

Confirmed in main (940d32f): compile in crates/victory-gpu/src/twin.rs builds the depth twin's converter at run time with D3DCompile (cs_5_1), from a source that reads RWByteAddressBuffer with buf.Load and carries its root signature as a [RootSignature] attribute. Under Wine's builtin d3dcompiler_47 that source does not compile, so there is no converter and the 16-bit depth written through the unordered view never reaches the depth texture. With Microsoft's d3dcompiler_47 the existing test passes, as reported.

Open PR #1872 (draft) adds the root-signature fallback, but per the last comment Wine's compiler also rejects the buffer reads, so it is not enough on its own; the options are discussed on that PR.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 12:50 UTC · [original](https://github.com/Marvisak/VIctory/issues/1860#issuecomment-7162922567) <!-- victory-issue-triage v1 verdict=confirmed seen=2026-11-25T00:28:34Z at=2026-11-25T12:49:57Z --> Automated triage for the maintainers. Confirmed in `main` (`940d32f`): `compile` in `crates/victory-gpu/src/twin.rs` builds the depth twin's converter at run time with `D3DCompile` (`cs_5_1`), from a source that reads `RWByteAddressBuffer` with `buf.Load` and carries its root signature as a `[RootSignature]` attribute. Under Wine's builtin `d3dcompiler_47` that source does not compile, so there is no converter and the 16-bit depth written through the unordered view never reaches the depth texture. With Microsoft's `d3dcompiler_47` the existing test passes, as reported. Open PR #1872 (draft) adds the root-signature fallback, but per the last comment Wine's compiler also rejects the buffer reads, so it is not enough on its own; the options are discussed on that PR. --- _Generated by [Claude Code](https://claude.ai/code)_
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory#1860
No description provided.