[pr-fix][shaders][lighting][linux-proton] DXC fallback: compile the helper shaders as HLSL 2018 #87
Loading…
Reference in a new issue
No description provided.
Delete branch "jensmonne/Darner:pr/dxc-hv-2018"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Contributor role (optional)
What it changes
When the system's
D3DCompilerefuses one of our helper shaders,hlsl.rscompiles it with DXC. DXC defaults to HLSL 2021, which refuses||,&&and?:on vectors. The helpers are written in the fxc style thatD3DCompileaccepts, 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'sraisethen 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 2018to DXC, the language versionD3DCompilereads. 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 inhlsl.rs, it returns early when nodxcompiler.dllis found.How it was tested
894c238(this branch, on main1a5286a), against1a5286a.cargo xwin, targetx86_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 on1a5286a.cargo xwin clippy --workspace --all-targets --all-features --locked --target x86_64-pc-windows-msvc -- -D warnings: clean on this branch and on1a5286a.hlsl::tests: 4 passed on this branch. With-HV 2018removed, the new test fails:DXC compiles HLSL 2018: Error { code: HRESULT(0x80004005), message: "Call failed." }.ambient::tests::the_passes_compileunder Wine: fails on1a5286a(5 of 5 runs,RAISE: Some(Error { code: HRESULT(0x80004005), message: "Call failed." })), passes on this branch (5 of 5).darner-gpulib test binary under Wine: 1694 passed, 33 failed on1a5286a; 1696 passed, 32 failed on this branch. The failures are the same tests on both, apart fromambient::tests::the_passes_compileabove 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_reachedon this branch,watch::tests::ask_once_by_res_splits_reservations_without_refusalson main).gpudetile.rschange 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'sd3dcompiler_47(60 fps cap, 2 rounds of A/B): median 23.6 against 25.2, 10th percentile 22.4 against 22.4.cargo test --workspace: only thedarner-gpulib tests, under Wine. Gameplay was on an older release with both changes applied, not on this revision alone.Checklist
main.docs/asset-policy.md.Checked for overlap
hlsl.rs; searched open and closed issues and pull requests for DXC, HLSL, dxcompiler and d3dcompiler).