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

Open
opened 2026-11-24 23:38:23 +00:00 by CaravelaLabs · 5 comments
CaravelaLabs commented 2026-11-24 23:38:23 +00:00 (Migrated from github.com)
Contributor

Imported from Marvisak/VIctory. Originally posted by CaravelaLabs on 2026-11-24T23:38:23Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6593648878 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/1860). Originally posted by [CaravelaLabs](https://github.com/CaravelaLabs) on 2026-11-24T23:38:23Z. --- 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.
BastienRodz commented 2026-11-25 00:06:52 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-24T23:43:51Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7147730340 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/1860#issuecomment-7147730340). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-24T23:43:51Z. --- 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 commented 2026-11-25 00:06:53 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-24T23:56:41Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7147966076 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/1860#issuecomment-7147966076). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-24T23:56:41Z. --- 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.
upstream-sync changed title from [GH #1860] Wine: 16-bit depth written through unordered views stays clear, because the converter's root signature is not in the blob to [GH #1860] Wine: 16-bit depth written through unordered views stays clear, because the converter shader does not compile 2026-11-25 01:07:17 +00:00
CaravelaLabs commented 2026-11-25 01:07:34 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by CaravelaLabs on 2026-11-25T00:08:41Z.


@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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148194765 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/1860#issuecomment-7148194765). Originally posted by [CaravelaLabs](https://github.com/CaravelaLabs) on 2026-11-25T00:08:41Z. --- @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.
BastienRodz commented 2026-11-25 01:07:52 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-25T00:28:34Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148548001 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/1860#issuecomment-7148548001). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-25T00:28:34Z. --- 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.
Marvisak commented 2026-11-25 13:03:00 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T12:50:07Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7162922567 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/1860#issuecomment-7162922567). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T12:50:07Z. --- <!-- 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)_
Sign in to join this conversation.
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
Marvisak/VIctory#1858
No description provided.