Repository navigation
Wine/Proton: build the title's helper shaders with dxc when available - #7
Open
DaemonSimon wants to merge 1 commit into
Open
DaemonSimon wants to merge 1 commit into
DaemonSimon wants to merge 1 commit into
Conversation
The argument clamp, the card compare and the depth plane pass compile their HLSL at first use with D3DCompile. Wine's D3DCompile (vkd3d-shader) builds none of them: E5005 "Method 'InterlockedMax'/'Load' not defined on RWByteAddressBuffer" for the compute shaders, and the plane pixel shaders come out without a root signature. Indirect execution is then dropped and the depth planes stay unchanged, so the world is black and empty. The sources move to crates/victory-gpu/src/shaders/*.hlsl (embedded with include_str!, unchanged apart from the plane entry points, now `main`). A new build.rs compiles them with dxc to DXIL in OUT_DIR when dxc is available (DXC environment variable, else PATH) and embeds the result. At run time the embedded DXIL is used when D3DCompile fails or, for the plane shaders, gives no usable root signature. Without dxc nothing changes. No compiled file enters the repository. AI-assisted (Claude Code). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The title's helper shaders (argument clamp in
indirect.rs, card compare and depth plane pass inhost.rs) move tocrates/victory-gpu/src/shaders/*.hlsl, embedded withinclude_str!(unchanged, except that the plane entry points are nowmain). A newcrates/victory-gpu/build.rscompiles them withdxc(DXCenvironment variable, elsedxcon thePATH) to DXIL inOUT_DIR(cs_6_0/vs_6_0/ps_6_0, entrymain,-rootsig-define RSwhere the source definesRS) and embeds the result withinclude_bytes!. Withoutdxcthe embedded files are empty and behaviour is as before (D3DCompileat first use). A README paragraph (Wine / Proton / Linux) explains the step.At run time the embedded DXIL is used when
D3DCompilefails, or, for the plane shaders, when it gives no usable root signature.Why
Wine's
D3DCompile(vkd3d-shader) does not build these shaders:E5005: Method 'InterlockedMax' / 'Load' is not defined on type 'RWByteAddressBuffer'for the compute shaders, and the plane pixel shaders come out without a root signature. Consequence on Wine: about 5,000 indirect draws per frame are dropped ("no argument clamp"), the depth planes stay unchanged, and the world is black and empty.Same idea as Marvisak/VIctory#2093 (shaders compiled by the build, nothing compiled in the repository), but with
dxc, so it also works for the Linux cross build, where Microsoft'sd3dcompiler_47is not available to a build script.No compiled file is committed (
cargo xtask policypasses: 177 files ok).Tested (one machine; no Windows test)
RX 9070 XT, Wine 11, Linux, cross build (
x86_64-pc-windows-msvc, xwin SDK, dxc 1.10 from nixpkgs):cargo check -p victory-gpu --target x86_64-pc-windows-msvc: ok with and withoutdxc.dxcbuilds has the sizes of the DXIL I had been testing with by hand (clamp 5,360, plane-steps 3,612, plane-floats 3,552 bytes).Not tested: Windows (the
D3DCompilepath is unchanged there; the DXIL is only a fallback), a build on Windows withdxcinstalled, the unit tests under Wine, a run of this branch without the follow-up. That the world is empty without this change is what I see on this machine, not a measured comparison in this PR.Note: with the card compare working under Wine, card buffers (on by default) are really used there; before they fell back, because the shader did not compile. See the follow-up PR for the cost of that pass.
AI-assisted (Claude Code).
🤖 Generated with Claude Code