Repository navigation
Conversation
The argument clamp and the depth conversion were compiled at first use by the system's HLSL compiler. Under Wine and Proton that is Wine's own, which compiles neither (no `RWByteAddressBuffer.Load`; `[RootSignature]` is ignored), so indirect execution was dropped and 16-bit depth written through unordered views never reached the depth texture, with only a warning in the log. Their HLSL moves to `src/shaders/`, and a build script compiles it when the build runs on Windows for Windows, with the same compiler, profile and flags as before. The binary then needs no HLSL compiler where it runs, and a shader that does not compile fails the build. A cross build compiles them at first use as before; under Wine a failure now says how to fix it. `crate::hlsl` makes both pipelines. New tests: each shader makes a pipeline, and the build's programs are byte for byte what the system's compiler makes at first use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090, Rust 1.98.1 MSVC):
victory-gpubuild.rscompiledshaders/clamp.hlslandshaders/depth.hlslcleanly viaD3DCompileon Windowscargo test -p victory-gpu --lib indirect::— 5 passed, 0 failed on RTX 5090cargo clippy -p victory-gpu --all-targets— 0 warningscargo xtask policy— ok (187 files ok)
Clean build-time compilation of the internal HLSL compute shaders on Windows replacing raw bytecode blobs. Looks great.
AI-assisted (Gemini 4 Neon).
|
Triage verdict — Keep the Windows prebuild, preserve the cross-build fallback work ( Evidence
Checks and limits
Next step
This verification was AI-assisted. |
|
Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at AI-assisted (Claude Code). |
|
I checked the production executable requested above at
If the distribution goal includes removing that direct DLL dependency, the existing |
|
Thanks for the triage. On the next steps: Build condition. The shaders are embedded only when the build script runs on a Windows host with the MSVC toolchain ( Compiler DLL at startup. That isn't part of the claim. A built #1279. I agree it's complementary. It makes the clamp's source build with Wine's compiler, which also covers cross builds at first use. This PR embeds the clamp and the depth conversion in Windows-built binaries. Both change |
catminou4
left a comment
There was a problem hiding this comment.
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
Compute shaders compiled by the build on Windows — build-time shader compilation step; check the compile happens once and the blobs are cached, not per-run.
|
Automated triage for the maintainers. This pull request no longer merges cleanly into Generated by Claude Code |
What
Two of VIctory's own compute shaders run in the game: the indirect-argument clamp (
indirect.rs) and the 16-bit depth conversion (twin.rs). Both are compiled at first use withD3DCompile. Under Wine and Proton that call goes to Wine's own HLSL compiler (vkd3d-shader), which compiles neither:clamp,depth:E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'[RootSignature]attribute is ignored (W5302), so even a shader it does compile has no root signature forCreateRootSignatureThe result on Linux is a silent black world. Indirect execution is dropped ("no argument clamp"), and 16-bit depth written through unordered views never reaches the depth texture. The only workaround is installing Microsoft's
d3dcompiler_47into the prefix.Change
crates/victory-gpu/src/shaders/{clamp,depth}.hlsl.crates/victory-gpu/build.rscompiles everysrc/shaders/*.hlslwhen the build runs on Windows for Windows. It uses the system'sd3dcompiler_47.dllthroughraw-dylib, with no new dependencies, and the same entry point, profile (cs_5_1) and flags as at runtime.OUT_DIRand is embedded withinclude_bytes!. Nothing compiled enters the repository, andcargo xtask policypasses.cargo build, instead of failing at first use in the game.crate::hlslmodule makes both pipelines. It uses the embedded bytecode when there is some, and otherwise compiles at first use as before. That covers cross builds, where a build script can't run Microsoft's compiler.d3dcompiler_47.bindless,memory,draw,pipeline::library) are untouched.On Windows the runtime behaviour is unchanged: the same bytecode, made at build time instead of first use.
When the shaders are embedded
cfg(all(windows, target_env = "msvc"))inbuild.rs), and the target OS is Windows. That's the documented build. The bytecode comes from that machine'sd3dcompiler_47.dll.windows-gnuhost. These compile at first use, as before.d3dcompiler_47.dll. The binary still importsD3DCompilefor the first-use path. Windows ships that DLL, and Wine and Proton always provide their own, so the import always resolves. What changes is that a non-working compiler (Wine's) no longer costs the two pipelines.Tests
hlsl::tests::our_shaders_make_pipelines: both shaders make a pipeline.hlsl::tests::prebuilt_shaders_are_what_the_system_compiler_makes: the build's bytecode is byte-identical to whatD3DCompilemakes at runtime. I checked locally thatd3dcompiler_47output is deterministic and doesn't depend on the source name.I ran these on Linux: Wine 11.22 with vkd3d-proton master on RADV, an RX 9070 XT. A Linux build can't run the Windows build-script path, so I compiled
build.rsitself for Windows and ran it under Wine with Microsoft'sd3dcompiler_47. It wrote both.dxbcfiles, 3,096 and 3,656 bytes, the same as a runtime compile. With Wine's compiler swapped in, it fails the build, as intended. Results:our_shaders_make_pipelinesprebuilt_…_compiler_makesd3dcompiler_47cargo clippy --workspace --all-targets [--all-features] -- -D warningsis clean, and the new files are rustfmt-clean. Thevictory-gpuandvictory-shadertests under Wine matchmainplus the new tests. CI onwindows-latestexercises the build-script path.🤖 Generated with Claude Code