From 1d81c67b7b4a2ae05fc20bd6e8fc0b9691238df9 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Fri, 23 Oct 2026 12:13:58 +0200 Subject: [PATCH] Build naga once for the game, its tests and its examples horizon-client's dev-dependency on naga added the hlsl-out feature for the gfx.rs test that translates every shader for DirectX 12. With resolver 2 a dev-dependency's features apply only to tests and examples, so Cargo kept two builds of naga, wgpu-hal, wgpu-core, wgpu, horizon-shaderpack and the horizon-client lib, and rebuilt them on the first example or test after a game build. Measured on the Mac mini (cargo build of the game, then one example): the example took 37.3 s and recompiled that whole stack before, 1.2 s and only its own crate after; the target dir is 1 GB smaller (4.9 to 3.9 GB). The game binary is the same size: nothing calls the HLSL writer, so the linker drops it. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/Cargo.toml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/horizon-client/Cargo.toml b/crates/horizon-client/Cargo.toml index 48e2e57d4..cd5d86fe7 100644 --- a/crates/horizon-client/Cargo.toml +++ b/crates/horizon-client/Cargo.toml @@ -30,7 +30,9 @@ serde = { version = "1", features = ["derive"] } serde_json = { version = "1.0.151", features = ["raw_value"] } # Shader packs: pack.toml, and WGSL checked before it reaches wgpu. toml = "1.1" -naga = { version = "30.0.1", features = ["wgsl-in"] } +# hlsl-out: the gfx.rs tests translate every shader as wgpu's DirectX 12 backend does. A normal feature, +# not a dev-dependency's, so builds, tests and examples share one build of naga, wgpu and this crate. +naga = { version = "30.0.1", features = ["wgsl-in", "hlsl-out"] } # Java (OptiFine/Iris) shader packs, translated to WGSL. horizon-shaderpack = { path = "../horizon-shaderpack" } # Sound (ALSA on Linux); the `audio` feature. @@ -81,7 +83,3 @@ rng-trace = ["horizon-core/rng-trace"] [lints] workspace = true - -[dev-dependencies] -# Every WGSL shader translated as wgpu's DirectX 12 backend does (gfx.rs tests). -naga = { version = "30.0.1", features = ["wgsl-in", "hlsl-out"] }