[pr-fix][shaders][linux-proton] Texture detile shader: compile it through the hlsl.rs fallback #133

Manually merged
TrustNo1 merged 0 commits from jensmonne/Darner:pr/detile-dxc-fallback into main 2026-12-04 02:14:04 +00:00
Contributor

Contributor role (optional)

  • Fluxer ID: 1577631603876691968

What it changes

gpudetile::make calls D3DCompile itself, so the texture detile shader is the one compute helper that skips the fallback in hlsl.rs. Under Wine/Proton without Microsoft's d3dcompiler_47.dll, Wine's own compiler takes the shader but leaves out its [RootSignature], CreateRootSignature then fails with E_FAIL, and detiler() logs "the detile shader could not be made; textures are detiled on the PC". So DARNER_GPU_DETILE=1 has no effect there.

This compiles it with hlsl::compile_compute, like flicker.rs and indirect.rs. That function already notices a missing root signature and then compiles with DXC. The error text the old code logged is still logged, by compile_compute. On Windows nothing changes: the system's compiler takes the shader, as before.

One side effect: record_preludes (host.rs) records preludes one after another whenever detiler() is Some and a job has uploads, even with DARNER_GPU_DETILE unset. With this change, Wine without Microsoft's compiler behaves there as Windows already does. Before, the missing detiler let those preludes record in parallel. I did not measure the effect on frame rate.

How it was tested

  • Tested revision: e83730e (this branch, on main 57dea7f), against 57dea7f.
  • 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, vkd3d-proton and DXVK DLLs, 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 57dea7f.
    • cargo xwin clippy --workspace --all-targets --all-features --locked --target x86_64-pc-windows-msvc -- -D warnings: clean on this branch and on 57dea7f.
    • The existing gpudetile::tests::the_card_detiles_as_the_cpu_does does not run under Wine ("no software adapter: not run", there is no WARP), so it passes on both revisions without checking anything.
    • A temporary test, not part of this PR, that calls gpudetile::make on the default adapter (RTX 5080 through vkd3d-proton) under Wine with Wine's own d3dcompiler_47: Err(HRESULT(0x80004005) "Call failed.") on 57dea7f (3 of 3 runs), Ok on this branch (3 of 3). With Microsoft's d3dcompiler_47.dll next to the test binary: Ok on both revisions (2 of 2 each).
    • The whole darner-gpu lib test binary under Wine: 1716 passed, 24 failed on 57dea7f; 1715 passed, 25 failed on this branch. The failures are the same tests on both, apart from watch::tests::ask_once_by_res_splits_reservations_without_refusals, which passed 5 of 5 alone on both revisions.
    • cargo xtask policy on this branch: "asset policy: 553 files ok".
    • Of the three gates: 1 and 2 were run (the two clippy commands above); gate 3, cargo test --workspace, was not.
  • Gameplay, kept apart from the tests above: v2026.12.03.01 (bd0de0c) with this change applied, plus my local Linux patches that are not part of this PR. RTX 5080, NVIDIA 620.73, Proton Experimental 11.0-20261123b, Series X profile, 2560x1440, DLSS Super Resolution at the quality scale, frame generation off, uncapped. A scripted run from the same save: menus, a 150-second walk, then standing; one run each, about 6 minutes in the world:
    • Wine's own compiler, DARNER_GPU_DETILE=1: the log shows "texture detile: the system's HLSL compiler refused it (its code holds no root signature: the compiler left out [RootSignature]); trying DXC", then "texture detile: compiled by DXC" and "title textures are detiled on the card". The card detiled 16.1 textures a frame in 53.9 dispatches on average. Median 3.4 fps, 10th percentile 2.4.
    • Wine's own compiler, DARNER_GPU_DETILE unset: median 23.8 fps, 10th percentile 22.0.
    • Microsoft's d3dcompiler_47, DARNER_GPU_DETILE=1 (this change plays no part): median 3.3 fps, 10th percentile 2.5.
    • So with this change, detiling on the card works under Wine as it does with Microsoft's compiler. On this setup it is about seven times slower than detiling on the PC with either compiler; that slowdown does not come from this change.
  • Shader wave sizes tested: not applicable (an HLSL helper, not the translator).
  • Coverage gaps: not run on Windows, and not cargo test --workspace: only the darner-gpu lib tests, under Wine. The game runs are one each, on a release with other local patches, not on this revision alone. The frame-rate effect of the serial preludes above was not measured separately.

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: #57 also changes gpudetile.rs, one line in a test helper (a different change); the two merge without conflict. No other open pull request changes gpudetile.rs or hlsl.rs; searched open and closed issues and pull requests for gpudetile, D3DCompile, dxcompiler and d3dcompiler.
## Contributor role (optional) - Fluxer ID: 1577631603876691968 ## What it changes `gpudetile::make` calls `D3DCompile` itself, so the texture detile shader is the one compute helper that skips the fallback in `hlsl.rs`. Under Wine/Proton without Microsoft's `d3dcompiler_47.dll`, Wine's own compiler takes the shader but leaves out its `[RootSignature]`, `CreateRootSignature` then fails with `E_FAIL`, and `detiler()` logs "the detile shader could not be made; textures are detiled on the PC". So `DARNER_GPU_DETILE=1` has no effect there. This compiles it with `hlsl::compile_compute`, like `flicker.rs` and `indirect.rs`. That function already notices a missing root signature and then compiles with DXC. The error text the old code logged is still logged, by `compile_compute`. On Windows nothing changes: the system's compiler takes the shader, as before. One side effect: `record_preludes` (`host.rs`) records preludes one after another whenever `detiler()` is `Some` and a job has uploads, even with `DARNER_GPU_DETILE` unset. With this change, Wine without Microsoft's compiler behaves there as Windows already does. Before, the missing detiler let those preludes record in parallel. I did not measure the effect on frame rate. ## How it was tested - Tested revision: e83730e (this branch, on main 57dea7f), against 57dea7f. - 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, vkd3d-proton and DXVK DLLs, 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 57dea7f. - `cargo xwin clippy --workspace --all-targets --all-features --locked --target x86_64-pc-windows-msvc -- -D warnings`: clean on this branch and on 57dea7f. - The existing `gpudetile::tests::the_card_detiles_as_the_cpu_does` does not run under Wine ("no software adapter: not run", there is no WARP), so it passes on both revisions without checking anything. - A temporary test, not part of this PR, that calls `gpudetile::make` on the default adapter (RTX 5080 through vkd3d-proton) under Wine with Wine's own `d3dcompiler_47`: `Err(HRESULT(0x80004005) "Call failed.")` on 57dea7f (3 of 3 runs), `Ok` on this branch (3 of 3). With Microsoft's `d3dcompiler_47.dll` next to the test binary: `Ok` on both revisions (2 of 2 each). - The whole `darner-gpu` lib test binary under Wine: 1716 passed, 24 failed on 57dea7f; 1715 passed, 25 failed on this branch. The failures are the same tests on both, apart from `watch::tests::ask_once_by_res_splits_reservations_without_refusals`, which passed 5 of 5 alone on both revisions. - `cargo xtask policy` on this branch: "asset policy: 553 files ok". - Of the three gates: 1 and 2 were run (the two clippy commands above); gate 3, `cargo test --workspace`, was not. - Gameplay, kept apart from the tests above: v2026.12.03.01 (bd0de0c) with this change applied, plus my local Linux patches that are not part of this PR. RTX 5080, NVIDIA 620.73, Proton Experimental 11.0-20261123b, Series X profile, 2560x1440, DLSS Super Resolution at the quality scale, frame generation off, uncapped. A scripted run from the same save: menus, a 150-second walk, then standing; one run each, about 6 minutes in the world: - Wine's own compiler, `DARNER_GPU_DETILE=1`: the log shows "texture detile: the system's HLSL compiler refused it (its code holds no root signature: the compiler left out [RootSignature]); trying DXC", then "texture detile: compiled by DXC" and "title textures are detiled on the card". The card detiled 16.1 textures a frame in 53.9 dispatches on average. Median 3.4 fps, 10th percentile 2.4. - Wine's own compiler, `DARNER_GPU_DETILE` unset: median 23.8 fps, 10th percentile 22.0. - Microsoft's `d3dcompiler_47`, `DARNER_GPU_DETILE=1` (this change plays no part): median 3.3 fps, 10th percentile 2.5. - So with this change, detiling on the card works under Wine as it does with Microsoft's compiler. On this setup it is about seven times slower than detiling on the PC with either compiler; that slowdown does not come from this change. - Shader wave sizes tested: not applicable (an HLSL helper, not the translator). - Coverage gaps: not run on Windows, and not `cargo test --workspace`: only the `darner-gpu` lib tests, under Wine. The game runs are one each, on a release with other local patches, not on this revision alone. The frame-rate effect of the serial preludes above was not measured separately. ## 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: #57 also changes `gpudetile.rs`, one line in a test helper (a different change); the two merge without conflict. No other open pull request changes `gpudetile.rs` or `hlsl.rs`; searched open and closed issues and pull requests for gpudetile, D3DCompile, dxcompiler and d3dcompiler.
First-time contributor

Tested #133 on Windows at commit e83730e: cargo build --release --locked -p darner succeeds (5m32s). darner-gpu: hlsl:: tests 4 passed; gpudetile::tests::the_card_detiles_as_the_cpu_does passed on WARP.

On Windows the system compiler takes the detile shader first, so a normal run does not exercise the changed fallback. With a local, uncommitted patch forcing the DXC path (system compiler skipped, DARNER_DXC pointing at the Windows SDK's dxcompiler.dll), the same detile test passes: the card detile is byte-identical to the CPU detile compiled through DXC.

darner translate <dump>: exit 0 on the PR and on main (57dea7f); summary lines identical (26,599 containers, 26,180/26,180 programs, 2,762/2,763 compute DXIL, same pre-existing CS_TraceShadowRays warning).

Not tested: game launch, Linux/Proton.

Drafted with AI assistance (OpenCode).

Tested #133 on Windows at commit e83730e: `cargo build --release --locked -p darner` succeeds (5m32s). darner-gpu: `hlsl::` tests 4 passed; `gpudetile::tests::the_card_detiles_as_the_cpu_does` passed on WARP. On Windows the system compiler takes the detile shader first, so a normal run does not exercise the changed fallback. With a local, uncommitted patch forcing the DXC path (system compiler skipped, `DARNER_DXC` pointing at the Windows SDK's dxcompiler.dll), the same detile test passes: the card detile is byte-identical to the CPU detile compiled through DXC. `darner translate <dump>`: exit 0 on the PR and on main (57dea7f); summary lines identical (26,599 containers, 26,180/26,180 programs, 2,762/2,763 compute DXIL, same pre-existing CS_TraceShadowRays warning). Not tested: game launch, Linux/Proton. Drafted with AI assistance (OpenCode).
TrustNo1 manually merged commit 7a1b103484 into main 2026-12-04 02:14:04 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
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!133
No description provided.