Wine: the indirect argument clamp does not compile with Wine's HLSL compiler, so every indirect execution is dropped (fix on a branch) #909

Open
opened 2026-11-26 04:14:08 +00:00 by github-bot · 3 comments
Owner

@⁠Mumogg on GitHub · 2026-11-24 13:55 UTC · original

Pull requests are limited to collaborators right now, so this is offered as a branch; a collaborator is welcome to open a PR from it.

Problem

Under Wine, every indirect execution is dropped. The clamp of indirect arguments (crates/victory-gpu/src/indirect.rs) is HLSL compiled at run time with D3DCompile, and Wine's d3dcompiler_47 (vkd3d-shader's HLSL compiler) refuses it:

WARN victory_gpu::indirect: argument clamp: clamp:19:27: E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'.

indirect::bound then returns false for every record and execute_indirect reports not bounded (no clamp, or arguments not 4-byte aligned). In the world that is most of the frame: in one run here, per world frame on average, 1,449 mesh dispatches (kind 10), 776 dispatches (kind 2), 285 draws (kind 0) and 79 indexed draws (kind 1) were dropped for that reason alone. I found no issue or PR that mentions it; anyone testing under Wine or Proton with the builtin compiler has it.

Wine's compiler has a second gap that the first one hides: it ignores the RootSignature attribute (W5302: Ignoring unknown attribute "RootSignature"), so the compiled blob has no RTS0 part and CreateRootSignature from the shader bytes would fail next.

Change

One file, the clamp only:

  • args and budget are RWStructuredBuffer<uint> instead of RWByteAddressBuffer, indexed in words. bound already refuses addresses and strides that are not multiples of 4, so the same words are read and written. A root descriptor can be a structured buffer.
  • The root signature (4 root constants at b0, root UAVs u0 and u1) is serialized with D3D12SerializeVersionedRootSignature beside the shader, as pipeline/host.rs does for its own, instead of being read from the shader blob.
  • The bounds, the budget and the InterlockedAdd on it are unchanged.

Testing

RTX 5070 Ti, driver 615.78.08, Nobara 44, Wine 11.21 Staging, vkd3d-proton and DXVK dxgi.dll from GE-Proton11-14, diag build cross-compiled on Linux, Series X 1.0.2.1, network off.

  • The new source compiles with D3DCompile (cs_5_1) from both Wine's builtin d3dcompiler_47 and Microsoft's (a small test program, run under Wine with and without the native DLL). The old source compiles only with Microsoft's.
  • In the title (tree: ffe310e + #454 #177 #259 #233 #646 #578 + the #783 fallback), one 450 s run each:
old clamp, Wine's compiler old clamp, Microsoft's d3dcompiler_47.dll beside the exe this change, Wine's compiler
argument clamp warning yes no no
not bounded drops every indirect record none none
host pipelines created in the run 618 1,063 782

With the clamp in place the next reasons for dropped indirect work are pipelines still being made, wave64 mesh programs refused by #578 on this 32-lane host, and shaders that do not translate.

  • cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings (target x86_64-pc-windows-msvc) is clean.

Not tested: native Windows (the pipeline is created through vkd3d-proton in all three columns, so D3D12's own check of a structured-buffer root UAV against this shader is not exercised), AMD, cargo test (the existing argument_clamp_builds test covers this path on a machine with a GPU), and the clamped values themselves beyond the title running with them.

A workaround without this change: put Microsoft's d3dcompiler_47.dll next to victory.exe and add d3dcompiler_47=n to WINEDLLOVERRIDES.

AI-assisted (Claude Code): it found the cause from the logs, wrote the change and this text, and ran the tests on the machine above. No game data attached.

**@⁠Mumogg** on GitHub · 2026-11-24 13:55 UTC · [original](https://github.com/Marvisak/VIctory/issues/909) Pull requests are limited to collaborators right now, so this is offered as a branch; a collaborator is welcome to open a PR from it. - Branch: https://github.com/Mumogg/VIctory/tree/gpu/indirect-clamp-wine (one commit, `f2a71ac`, on `main` `ffe310e`, one file) - Compare: https://github.com/Marvisak/VIctory/compare/main...Mumogg:VIctory:gpu/indirect-clamp-wine ### Problem Under Wine, every indirect execution is dropped. The clamp of indirect arguments (`crates/victory-gpu/src/indirect.rs`) is HLSL compiled at run time with `D3DCompile`, and Wine's `d3dcompiler_47` (vkd3d-shader's HLSL compiler) refuses it: ``` WARN victory_gpu::indirect: argument clamp: clamp:19:27: E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'. ``` `indirect::bound` then returns false for every record and `execute_indirect` reports `not bounded (no clamp, or arguments not 4-byte aligned)`. In the world that is most of the frame: in one run here, per world frame on average, 1,449 mesh dispatches (kind 10), 776 dispatches (kind 2), 285 draws (kind 0) and 79 indexed draws (kind 1) were dropped for that reason alone. I found no issue or PR that mentions it; anyone testing under Wine or Proton with the builtin compiler has it. Wine's compiler has a second gap that the first one hides: it ignores the `RootSignature` attribute (`W5302: Ignoring unknown attribute "RootSignature"`), so the compiled blob has no `RTS0` part and `CreateRootSignature` from the shader bytes would fail next. ### Change One file, the clamp only: - `args` and `budget` are `RWStructuredBuffer<uint>` instead of `RWByteAddressBuffer`, indexed in words. `bound` already refuses addresses and strides that are not multiples of 4, so the same words are read and written. A root descriptor can be a structured buffer. - The root signature (4 root constants at b0, root UAVs u0 and u1) is serialized with `D3D12SerializeVersionedRootSignature` beside the shader, as `pipeline/host.rs` does for its own, instead of being read from the shader blob. - The bounds, the budget and the `InterlockedAdd` on it are unchanged. ### Testing RTX 5070 Ti, driver 615.78.08, Nobara 44, Wine 11.21 Staging, vkd3d-proton and DXVK `dxgi.dll` from GE-Proton11-14, diag build cross-compiled on Linux, Series X 1.0.2.1, network off. - The new source compiles with `D3DCompile` (`cs_5_1`) from both Wine's builtin `d3dcompiler_47` and Microsoft's (a small test program, run under Wine with and without the native DLL). The old source compiles only with Microsoft's. - In the title (tree: `ffe310e` + #454 #177 #259 #233 #646 #578 + the #783 fallback), one 450 s run each: | | old clamp, Wine's compiler | old clamp, Microsoft's `d3dcompiler_47.dll` beside the exe | this change, Wine's compiler | |---|---|---|---| | `argument clamp` warning | yes | no | no | | `not bounded` drops | every indirect record | none | none | | host pipelines created in the run | 618 | 1,063 | 782 | With the clamp in place the next reasons for dropped indirect work are pipelines still being made, wave64 mesh programs refused by #578 on this 32-lane host, and shaders that do not translate. - `cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings` (target `x86_64-pc-windows-msvc`) is clean. **Not tested:** native Windows (the pipeline is created through vkd3d-proton in all three columns, so D3D12's own check of a structured-buffer root UAV against this shader is not exercised), AMD, `cargo test` (the existing `argument_clamp_builds` test covers this path on a machine with a GPU), and the clamped values themselves beyond the title running with them. A workaround without this change: put Microsoft's `d3dcompiler_47.dll` next to `victory.exe` and add `d3dcompiler_47=n` to `WINEDLLOVERRIDES`. AI-assisted (Claude Code): it found the cause from the logs, wrote the change and this text, and ran the tests on the machine above. No game data attached.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:14:08 +00:00
Author
Owner

@⁠MichaelSmithAI on GitHub · 2026-11-24 13:58 UTC · original · edited 2026-11-24 14:06 UTC

The numerical clamp comparison passed. On an RTX 4090 under Wine/GE 3.2, f2a71ac produced the expected words with Wine’s builtin compiler and Microsoft D3DCompiler. The same fixture on a main-based port of #190, which supplies precompiled DXIL, returned the identical buffer. This covers draw, indexed draw, mesh, accepted and rejected compute records, and padding at a 32-byte stride. The final indexed draw also exercised the budget consumed by earlier records.

Only the clamp executed.

On native Windows 10, andrewpozdnakov7-jpg verified pipeline creation on f2a71ac using D3D12 WARP and the system D3DCompiler. On 4dd4cfc both focused tests passed, including the final comparison of all output and padding words. The full diagnostics suite had 54 passes and one ignored test. Counter saturation remains untested. Native WARP result The test-only follow-up is available against the author branch.

**@⁠MichaelSmithAI** on GitHub · 2026-11-24 13:58 UTC · [original](https://github.com/Marvisak/VIctory/issues/909#issuecomment-7133641863) · edited 2026-11-24 14:06 UTC The numerical clamp comparison passed. On an RTX 4090 under Wine/GE 3.2, f2a71ac produced the expected words with Wine’s builtin compiler and Microsoft D3DCompiler. The same fixture on a main-based port of [#190](https://git.gtahub.st/github/Marvisak--VIctory/pulls/190), which supplies precompiled DXIL, returned the identical buffer. This covers draw, indexed draw, mesh, accepted and rejected compute records, and padding at a 32-byte stride. The final indexed draw also exercised the budget consumed by earlier records. Only the clamp executed. On native Windows 10, andrewpozdnakov7-jpg verified pipeline creation on f2a71ac using D3D12 WARP and the system D3DCompiler. On 4dd4cfc both focused tests passed, including the final comparison of all output and padding words. The full diagnostics suite had 54 passes and one ignored test. Counter saturation remains untested. [Native WARP result](https://github.com/Mumogg/VIctory/pull/1#issuecomment-7133747571) The [test-only follow-up](https://github.com/Mumogg/VIctory/pull/1) is available against the author branch.
Author
Owner

@⁠Mumogg on GitHub · 2026-11-24 17:05 UTC · original

Now that outside PRs are open again, this is PR #1279 (same commit, f2a71ac), with the two verifications from this thread quoted in its description. Thanks for both. (AI-assisted, Claude Code.)

**@⁠Mumogg** on GitHub · 2026-11-24 17:05 UTC · [original](https://github.com/Marvisak/VIctory/issues/909#issuecomment-7138659340) Now that outside PRs are open again, this is PR #1279 (same commit, `f2a71ac`), with the two verifications from this thread quoted in its description. Thanks for both. (AI-assisted, Claude Code.)
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 06:51 UTC · original

Automated triage for the maintainers.

This is the same defect as #170, which is confirmed and still open: make() in crates/victory-gpu/src/indirect.rs compiles the clamp with D3DCompile, Wine's compiler refuses RWByteAddressBuffer.Load, and every indirect execution is dropped. Your fix is now PR #1279, which is already named there. Proposed for closing as a duplicate of #170: it will be closed in 48 hours unless the reporter replies or a maintainer removes the label.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 06:51 UTC · [original](https://github.com/Marvisak/VIctory/issues/909#issuecomment-7155223934) <!-- victory-issue-triage v1 verdict=proposed-close seen=2026-11-24T17:05:03Z at=2026-11-25T06:51:03Z --> Automated triage for the maintainers. This is the same defect as #170, which is confirmed and still open: `make()` in `crates/victory-gpu/src/indirect.rs` compiles the clamp with `D3DCompile`, Wine's compiler refuses `RWByteAddressBuffer.Load`, and every indirect execution is dropped. Your fix is now PR #1279, which is already named there. Proposed for closing as a duplicate of #170: it will be closed in 48 hours unless the reporter replies or a maintainer removes the label. --- _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#909
No description provided.