[pr-fix][shaders][lighting][linux-proton] DXC fallback: compile the helper shaders as HLSL 2018 #87

Manually merged
TrustNo1 merged 1 commit from jensmonne/Darner:pr/dxc-hv-2018 into main 2026-12-03 20:19:30 +00:00
Contributor

Contributor role (optional)

  • Fluxer ID: 1577631603876691968

What it changes

When the system's D3DCompile refuses one of our helper shaders, hlsl.rs compiles it with DXC. DXC defaults to HLSL 2021, which refuses ||, && and ?: on vectors. The helpers are written in the fxc style that D3DCompile accepts, so some of them failed in DXC as well.

This happens under Wine/Proton without Microsoft's d3dcompiler_47.dll: Wine's own compiler refuses the raw-buffer helpers and sends them to DXC. The ambient light's raise then failed in DXC with "operands for short-circuiting logical binary operator must be scalar", so the whole ambient stand-in was off.

This passes -HV 2018 to DXC, the language version D3DCompile reads. On Windows nothing changes: the system's compiler takes every helper and DXC is never asked.

A new test, dxc_takes_vector_logic_as_d3dcompile_does, compiles a small synthetic shader that uses || and ?: on vectors with DXC. Like the other tests in hlsl.rs, it returns early when no dxcompiler.dll is found.

How it was tested

  • Tested revision: 894c238 (this branch, on main 1a5286a), against 1a5286a.
  • Commands and results (cross-built on Linux with cargo xwin, target x86_64-pc-windows-msvc, rustc 1.98.1; tests run under Proton Experimental 11.0-20261123b's Wine with DXC from Microsoft's DirectXShaderCompiler release):
    • cargo xwin clippy --workspace --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings: clean on this branch and on 1a5286a.
    • cargo xwin clippy --workspace --all-targets --all-features --locked --target x86_64-pc-windows-msvc -- -D warnings: clean on this branch and on 1a5286a.
    • hlsl:: tests: 4 passed on this branch. With -HV 2018 removed, the new test fails: DXC compiles HLSL 2018: Error { code: HRESULT(0x80004005), message: "Call failed." }.
    • The existing ambient::tests::the_passes_compile under Wine: fails on 1a5286a (5 of 5 runs, RAISE: Some(Error { code: HRESULT(0x80004005), message: "Call failed." })), passes on this branch (5 of 5).
    • The whole darner-gpu lib test binary under Wine: 1694 passed, 33 failed on 1a5286a; 1696 passed, 32 failed on this branch. The failures are the same tests on both, apart from ambient::tests::the_passes_compile above and two tests that failed once each in a full run and passed 5 of 5 alone on both revisions (fence::tests::a_null_event_blocks_until_the_value_is_reached on this branch, watch::tests::ask_once_by_res_splits_reservations_without_refusals on main).
  • Gameplay: RTX 5080, NVIDIA 620.73, Proton Experimental 11.0-20261123b, Series X profile, 1440p. On 2026-12-01, on v2026.11.30.03 with this change and the gpudetile.rs change from a separate pull request applied: before, the ambient stand-in was off as described above; after, all 18 helpers that Wine's compiler refused were compiled by DXC, and nothing was black in a watched run. Frame rate, Wine's compiler plus DXC against Microsoft's d3dcompiler_47 (60 fps cap, 2 rounds of A/B): median 23.6 against 25.2, 10th percentile 22.4 against 22.4.
  • Shader wave sizes tested: not applicable (HLSL helpers, not the translator).
  • Coverage gaps: not run on Windows, and not cargo test --workspace: only the darner-gpu lib tests, under Wine. Gameplay was on an older release with both changes applied, not on this revision alone.

Checklist

  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: none found (no open pull request changes hlsl.rs; searched open and closed issues and pull requests for DXC, HLSL, dxcompiler and d3dcompiler).
## Contributor role (optional) - Fluxer ID: 1577631603876691968 ## What it changes When the system's `D3DCompile` refuses one of our helper shaders, `hlsl.rs` compiles it with DXC. DXC defaults to HLSL 2021, which refuses `||`, `&&` and `?:` on vectors. The helpers are written in the fxc style that `D3DCompile` accepts, so some of them failed in DXC as well. This happens under Wine/Proton without Microsoft's `d3dcompiler_47.dll`: Wine's own compiler refuses the raw-buffer helpers and sends them to DXC. The ambient light's `raise` then failed in DXC with "operands for short-circuiting logical binary operator must be scalar", so the whole ambient stand-in was off. This passes `-HV 2018` to DXC, the language version `D3DCompile` reads. On Windows nothing changes: the system's compiler takes every helper and DXC is never asked. A new test, `dxc_takes_vector_logic_as_d3dcompile_does`, compiles a small synthetic shader that uses `||` and `?:` on vectors with DXC. Like the other tests in `hlsl.rs`, it returns early when no `dxcompiler.dll` is found. ## How it was tested - Tested revision: 894c238 (this branch, on main 1a5286a), against 1a5286a. - Commands and results (cross-built on Linux with `cargo xwin`, target `x86_64-pc-windows-msvc`, rustc 1.98.1; tests run under Proton Experimental 11.0-20261123b's Wine with DXC from Microsoft's DirectXShaderCompiler release): - `cargo xwin clippy --workspace --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings`: clean on this branch and on 1a5286a. - `cargo xwin clippy --workspace --all-targets --all-features --locked --target x86_64-pc-windows-msvc -- -D warnings`: clean on this branch and on 1a5286a. - `hlsl::` tests: 4 passed on this branch. With `-HV 2018` removed, the new test fails: `DXC compiles HLSL 2018: Error { code: HRESULT(0x80004005), message: "Call failed." }`. - The existing `ambient::tests::the_passes_compile` under Wine: fails on 1a5286a (5 of 5 runs, `RAISE: Some(Error { code: HRESULT(0x80004005), message: "Call failed." })`), passes on this branch (5 of 5). - The whole `darner-gpu` lib test binary under Wine: 1694 passed, 33 failed on 1a5286a; 1696 passed, 32 failed on this branch. The failures are the same tests on both, apart from `ambient::tests::the_passes_compile` above and two tests that failed once each in a full run and passed 5 of 5 alone on both revisions (`fence::tests::a_null_event_blocks_until_the_value_is_reached` on this branch, `watch::tests::ask_once_by_res_splits_reservations_without_refusals` on main). - Gameplay: RTX 5080, NVIDIA 620.73, Proton Experimental 11.0-20261123b, Series X profile, 1440p. On 2026-12-01, on v2026.11.30.03 with this change and the `gpudetile.rs` change from a separate pull request applied: before, the ambient stand-in was off as described above; after, all 18 helpers that Wine's compiler refused were compiled by DXC, and nothing was black in a watched run. Frame rate, Wine's compiler plus DXC against Microsoft's `d3dcompiler_47` (60 fps cap, 2 rounds of A/B): median 23.6 against 25.2, 10th percentile 22.4 against 22.4. - Shader wave sizes tested: not applicable (HLSL helpers, not the translator). - Coverage gaps: not run on Windows, and not `cargo test --workspace`: only the `darner-gpu` lib tests, under Wine. Gameplay was on an older release with both changes applied, not on this revision alone. ## Checklist - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: none found (no open pull request changes `hlsl.rs`; searched open and closed issues and pull requests for DXC, HLSL, dxcompiler and d3dcompiler).
TrustNo1 manually merged commit 8a02e6f836 into main 2026-12-03 20:19:30 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
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
TrustNo1/Darner!87
No description provided.