GPU: fall back to DXC for indirect compute shaders #233

Open
github-bot wants to merge 2 commits from github-bot/gh-233 into main AGit
Owner

@⁠loyodea on GitHub · 2026-11-26 07:37 UTC · original
loyodea:victory-wine-indirect-compiler → main · +186 −69 · 3 files · 2 commits · open

Related to #183. When FXC fails to compile the indirect clamp or build its pipeline, retry the same HLSL with DXC targeting cs_6_0. A successful FXC pipeline is still used immediately. The fallback checks the application's directory and System32 or an explicit absolute VICTORY_DXC path. The README documents how to supply Microsoft's compiler.

Tested

  • Windows 11 26300, Radeon RX 9060 XT driver 32.0.32029.2010, WARP, Rust 1.100.0 GNU x64, and Microsoft's DXC 1.9.2609.5.
  • cargo test --locked -p victory-gpu -j 4 --lib -- --test-threads=1 --nocapture reported 114 passed, zero failed, and four ignored. One optional depth-bounds mesh check returned early because VICTORY_PC_DXC was unset.
  • Forced FXC rejection exercised the fallback for the actual clamp and synthetic worker. FXC and DXC root-signature payloads matched byte for byte, and both WARP fixtures passed their output checks.
  • A relative DLL path and a missing DLL produced the expected diagnostic. The native FXC clamp still passed with the missing compiler path configured.

Wine, Proton, and retail gameplay remain unverified. The run used original synthetic fixtures. Codex helped implement, review, and test the patch.

**@⁠loyodea** on GitHub · 2026-11-26 07:37 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/233) `loyodea:victory-wine-indirect-compiler` → `main` · +186 −69 · 3 files · 2 commits · open Related to #183. When FXC fails to compile the indirect clamp or build its pipeline, retry the same HLSL with DXC targeting `cs_6_0`. A successful FXC pipeline is still used immediately. The fallback checks the application's directory and System32 or an explicit absolute `VICTORY_DXC` path. The README documents how to supply Microsoft's compiler. **Tested** - Windows 11 26300, Radeon RX 9060 XT driver 32.0.32029.2010, WARP, Rust 1.100.0 GNU x64, and Microsoft's DXC 1.9.2609.5. - `cargo test --locked -p victory-gpu -j 4 --lib -- --test-threads=1 --nocapture` reported 114 passed, zero failed, and four ignored. One optional depth-bounds mesh check returned early because `VICTORY_PC_DXC` was unset. - Forced FXC rejection exercised the fallback for the actual clamp and synthetic worker. FXC and DXC root-signature payloads matched byte for byte, and both WARP fixtures passed their output checks. - A relative DLL path and a missing DLL produced the expected diagnostic. The native FXC clamp still passed with the missing compiler path configured. Wine, Proton, and retail gameplay remain unverified. The run used original synthetic fixtures. Codex helped implement, review, and test the patch.
Preserve the FXC path and retry compilation and pipeline creation with DXC if it fails. Generated WARP fixtures cover the clamp and worker and compare the embedded root signatures. Related to #183.

Co-authored-by: Codex <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 07:43:21 +00:00
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-26 21:41 UTC · original

Tested on Windows 11 26300 with an RX 7900 XT (RDNA3, driver 32.0.32029.2010) and on WARP. Head 8f11b3d, base main 4f62c2a. I did not test Wine or Proton.

Native Windows

  • D3DCompiler_47.dll 10.0.26100.9974 builds the clamp, so the fallback never runs.
  • System32 has no dxcompiler.dll or dxil.dll, only dxilconv.dll. The System32 search finds DXC only if someone copied it there.

DXC versions

I pointed VICTORY_DXC at three builds. Two checks passed with each one: the new test, and a local check on the 7900 XT that builds a root signature and compute pipeline from compile_dxc(SOURCE).

  • Windows SDK 10.0.26100 dxcompiler.dll 1.8.2502.11, next to its dxil.dll.
  • The same DLL copied alone into an empty folder, with no dxil.dll.
  • Vulkan SDK 1.4.363 dxcompiler.dll 1.9.0.5512, which ships without dxil.dll.

The README asks for May 2025 or newer. On native Windows the February 2025 SDK build also worked. I could not check Wine. If Wine needs the newer version, the README could say why.

Tests

  • victory-gpu lib tests: 3 interleaved runs each of base, the PR without VICTORY_DXC, and the PR with VICTORY_DXC. Other jobs were loading the machine. The only failures were frame::tests::waits_end_on_ticks_and_count_frames and watch:: guard-page tests, which are flaky here under load.
    • Base failed in 7 of 9 runs, with the frame:: test and two other watch:: tests.
    • watch::tests::a_view_mapped_beside_a_guarded_one_makes_it_check_again failed only on PR runs. Neither PR touches that code.
  • warp_dxc_fallback_preserves_clamp_and_worker passed in every run with VICTORY_DXC set.
    • With the fallback removed from make_compute_pipeline, it fails in WarpHarness::new.
    • Without VICTORY_DXC it skips and passes, so a plain cargo test does not run the fallback.
  • clippy -p victory-gpu --all-targets: the same 56 warnings on base and on the PR.

Other host shaders

Neither this PR nor #243 covers these. I only read them; I did not run them under Wine.

  • rects.rs expands rectangle lists for indirect draws. Its doc comment says it is compiled "like the argument clamp". It calls Load and Load4 on RWByteAddressBuffer. #183 shows Wine's compiler rejecting Load on that type. If the compile fails, the log says "indirect rectangle draws dropped". So under Wine, indirect rectangle-list draws may still be lost with this PR.
  • card.rs CARD_COMPARE_HLSL calls Load4 on an RWByteAddressBuffer, and card buffers are on by default. I did not check what happens when it fails to compile.
  • I passed rects.rs SOURCE and card.rs CARD_COMPARE_HLSL through this PR's compile_dxc and pipeline_from_shader. Both compile with the SDK DXC. Their RTS0 matches FXC byte for byte. Both pipelines build on the 7900 XT. make_compute_pipeline should work for rects.rs as it is, since it has the same { root, pso } shape.
  • ambient.rs calls GetDimensions on an RWTexture2D<uint>. YaBulochka reported Wine rejecting that method on RWTexture2D<float4> in #183. I did not check this one.

Compared with #243

The two PRs change the same lines in indirect.rs and conflict.

  • #243 calls LoadLibraryW("dxcompiler.dll"), which uses the default search order. On this machine it loaded C:\VulkanSDK\1.4.363.0\Bin\dxcompiler.dll from PATH. This PR searches only the executable's folder and System32, or the absolute VICTORY_DXC path.
  • #243 falls back only when D3DCompile fails. This PR also falls back when root signature or pipeline creation fails. That also covers a Wine compiler that builds the shader but writes no root signature, as #183 describes.
  • With #243's arguments the RTS0 also matches FXC, and the root signature builds on the 7900 XT.
  • #243 has no test.
**@⁠adrianmjim** on GitHub · 2026-11-26 21:41 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/233#issuecomment-7203975722) Tested on Windows 11 26300 with an RX 7900 XT (RDNA3, driver 32.0.32029.2010) and on WARP. Head 8f11b3d, base main 4f62c2a. I did not test Wine or Proton. **Native Windows** - `D3DCompiler_47.dll` 10.0.26100.9974 builds the clamp, so the fallback never runs. - System32 has no `dxcompiler.dll` or `dxil.dll`, only `dxilconv.dll`. The System32 search finds DXC only if someone copied it there. **DXC versions** I pointed `VICTORY_DXC` at three builds. Two checks passed with each one: the new test, and a local check on the 7900 XT that builds a root signature and compute pipeline from `compile_dxc(SOURCE)`. - Windows SDK 10.0.26100 `dxcompiler.dll` 1.8.2502.11, next to its `dxil.dll`. - The same DLL copied alone into an empty folder, with no `dxil.dll`. - Vulkan SDK 1.4.363 `dxcompiler.dll` 1.9.0.5512, which ships without `dxil.dll`. The README asks for May 2025 or newer. On native Windows the February 2025 SDK build also worked. I could not check Wine. If Wine needs the newer version, the README could say why. **Tests** - victory-gpu lib tests: 3 interleaved runs each of base, the PR without `VICTORY_DXC`, and the PR with `VICTORY_DXC`. Other jobs were loading the machine. The only failures were `frame::tests::waits_end_on_ticks_and_count_frames` and `watch::` guard-page tests, which are flaky here under load. - Base failed in 7 of 9 runs, with the `frame::` test and two other `watch::` tests. - `watch::tests::a_view_mapped_beside_a_guarded_one_makes_it_check_again` failed only on PR runs. Neither PR touches that code. - `warp_dxc_fallback_preserves_clamp_and_worker` passed in every run with `VICTORY_DXC` set. - With the fallback removed from `make_compute_pipeline`, it fails in `WarpHarness::new`. - Without `VICTORY_DXC` it skips and passes, so a plain `cargo test` does not run the fallback. - clippy `-p victory-gpu --all-targets`: the same 56 warnings on base and on the PR. **Other host shaders** Neither this PR nor #243 covers these. I only read them; I did not run them under Wine. - `rects.rs` expands rectangle lists for indirect draws. Its doc comment says it is compiled "like the argument clamp". It calls `Load` and `Load4` on `RWByteAddressBuffer`. #183 shows Wine's compiler rejecting `Load` on that type. If the compile fails, the log says "indirect rectangle draws dropped". So under Wine, indirect rectangle-list draws may still be lost with this PR. - `card.rs` `CARD_COMPARE_HLSL` calls `Load4` on an `RWByteAddressBuffer`, and card buffers are on by default. I did not check what happens when it fails to compile. - I passed `rects.rs` `SOURCE` and `card.rs` `CARD_COMPARE_HLSL` through this PR's `compile_dxc` and `pipeline_from_shader`. Both compile with the SDK DXC. Their RTS0 matches FXC byte for byte. Both pipelines build on the 7900 XT. `make_compute_pipeline` should work for `rects.rs` as it is, since it has the same `{ root, pso }` shape. - `ambient.rs` calls `GetDimensions` on an `RWTexture2D<uint>`. YaBulochka reported Wine rejecting that method on `RWTexture2D<float4>` in #183. I did not check this one. **Compared with #243** The two PRs change the same lines in `indirect.rs` and conflict. - #243 calls `LoadLibraryW("dxcompiler.dll")`, which uses the default search order. On this machine it loaded `C:\VulkanSDK\1.4.363.0\Bin\dxcompiler.dll` from PATH. This PR searches only the executable's folder and System32, or the absolute `VICTORY_DXC` path. - #243 falls back only when `D3DCompile` fails. This PR also falls back when root signature or pipeline creation fails. That also covers a Wine compiler that builds the shader but writes no root signature, as #183 describes. - With #243's arguments the RTS0 also matches FXC, and the root signature builds on the 7900 XT. - #243 has no test.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/233/head:github-bot/gh-233'
git switch 'github-bot/gh-233'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-233'
git switch 'github-bot/gh-233'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-233'
git switch 'github-bot/gh-233'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-233'
git switch 'main'
git merge --squash 'github-bot/gh-233'
git switch 'main'
git merge --ff-only 'github-bot/gh-233'
git switch 'main'
git merge 'github-bot/gh-233'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.