diff --git a/.cargo/config b/.cargo/config index c694936e59..fb33634f34 100644 --- a/.cargo/config +++ b/.cargo/config @@ -24,6 +24,7 @@ tracy-test-server = "run --bin veloren-server-cli --no-default-features --featur # voxygen test-voxygen = "run --bin veloren-voxygen --no-default-features --features simd,egui-ui,shaderc-from-source" tracy-voxygen = "run --bin veloren-voxygen --no-default-features --features tracy,simd,egui-ui,shaderc-from-source --profile no_overflow" +tracy-voxygen-releasedebuginfo = "run --bin veloren-voxygen --no-default-features --features tracy,simd,egui-ui,shaderc-from-source,singleplayer --profile releasedebuginfo" dbg-voxygen = "run --bin veloren-voxygen --profile debuginfo" # misc swarm = "run --bin swarm --features client/bin_bot,client/tick_network --" diff --git a/Cargo.lock b/Cargo.lock index 9af16dfb50..37495a4083 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4054,9 +4054,9 @@ dependencies = [ [[package]] name = "packed_simd_2" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "defdcfef86dcc44ad208f71d9ff4ce28df6537a4e0d6b0e8e845cb8ca10059a6" +checksum = "a1914cd452d8fccd6f9db48147b29fd4ae05bea9dc5d9ad578509f72415de282" dependencies = [ "cfg-if 1.0.0", "libm 0.1.4", @@ -7566,7 +7566,7 @@ dependencies = [ [[package]] name = "wgpu" version = "0.8.0" -source = "git+https://github.com/gfx-rs/wgpu.git?rev=a92b8549a8e2cb9dac781bafc5ed32828f3caf46#a92b8549a8e2cb9dac781bafc5ed32828f3caf46" +source = "git+https://github.com/pythonesque/wgpu.git?rev=b30d573c9aca0787f4ff7aba8bb0db7f823b7064#b30d573c9aca0787f4ff7aba8bb0db7f823b7064" dependencies = [ "arrayvec 0.5.2", "js-sys", @@ -7586,7 +7586,7 @@ dependencies = [ [[package]] name = "wgpu-core" version = "0.8.0" -source = "git+https://github.com/gfx-rs/wgpu.git?rev=a92b8549a8e2cb9dac781bafc5ed32828f3caf46#a92b8549a8e2cb9dac781bafc5ed32828f3caf46" +source = "git+https://github.com/pythonesque/wgpu.git?rev=b30d573c9aca0787f4ff7aba8bb0db7f823b7064#b30d573c9aca0787f4ff7aba8bb0db7f823b7064" dependencies = [ "arrayvec 0.5.2", "bitflags", @@ -7626,7 +7626,7 @@ dependencies = [ [[package]] name = "wgpu-types" version = "0.8.0" -source = "git+https://github.com/gfx-rs/wgpu.git?rev=a92b8549a8e2cb9dac781bafc5ed32828f3caf46#a92b8549a8e2cb9dac781bafc5ed32828f3caf46" +source = "git+https://github.com/pythonesque/wgpu.git?rev=b30d573c9aca0787f4ff7aba8bb0db7f823b7064#b30d573c9aca0787f4ff7aba8bb0db7f823b7064" dependencies = [ "bitflags", "serde", diff --git a/Cargo.toml b/Cargo.toml index fec9ce5a35..aacb5b1af0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -122,7 +122,8 @@ nativeBuildInputs = ["pkg-config"] [patch.crates-io] vek = { git = "https://github.com/yoanlcq/vek.git", rev = "84d5cb65841d46599a986c5477341bea4456be26" } # patch wgpu so we can use wgpu-profiler crate -wgpu = { git = "https://github.com/gfx-rs/wgpu.git", rev = "a92b8549a8e2cb9dac781bafc5ed32828f3caf46" } +# wgpu = { git = "https://github.com/gfx-rs/wgpu.git", rev = "a92b8549a8e2cb9dac781bafc5ed32828f3caf46" } +wgpu = { git = "https://github.com/pythonesque/wgpu.git", rev = "b30d573c9aca0787f4ff7aba8bb0db7f823b7064" } # # use the latest fixes in naga (remove when updates trickle down to wgpu-rs) # naga = { git = "https://github.com/gfx-rs/naga.git", rev = "3a0f0144112ff621dd7f731bf455adf6cab19164" } diff --git a/common/state/src/state.rs b/common/state/src/state.rs index 4e03335988..5b84c2e87c 100644 --- a/common/state/src/state.rs +++ b/common/state/src/state.rs @@ -108,15 +108,16 @@ impl State { GameMode::Singleplayer => "sp", }; + let num_cpu = num_cpus::get(); let thread_pool = Arc::new( ThreadPoolBuilder::new() - .num_threads(num_cpus::get().max(common::consts::MIN_RECOMMENDED_RAYON_THREADS)) + .num_threads(num_cpu.max(common::consts::MIN_RECOMMENDED_RAYON_THREADS)) .thread_name(move |i| format!("rayon-{}-{}", thread_name_infix, i)) .build() .unwrap(), ); Self { - ecs: Self::setup_ecs_world(game_mode, &thread_pool), + ecs: Self::setup_ecs_world(game_mode, num_cpu as u64, &thread_pool), thread_pool, } } @@ -124,7 +125,7 @@ impl State { /// Creates ecs world and registers all the common components and resources // TODO: Split up registering into server and client (e.g. move // EventBus to the server) - fn setup_ecs_world(game_mode: GameMode, thread_pool: &Arc) -> specs::World { + fn setup_ecs_world(game_mode: GameMode, num_cpu: u64, thread_pool: &Arc) -> specs::World { let mut ecs = specs::World::new(); // Uids for sync ecs.register_sync_marker(); @@ -223,7 +224,6 @@ impl State { ecs.insert(common::CachedSpatialGrid::default()); ecs.insert(EntitiesDiedLastTick::default()); - let num_cpu = num_cpus::get() as u64; let slow_limit = (num_cpu / 2 + num_cpu / 4).max(1); tracing::trace!(?slow_limit, "Slow Thread limit"); ecs.insert(SlowJobPool::new( diff --git a/rust-toolchain b/rust-toolchain index f6f9b5b6c6..e22800a26e 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2022-04-25 +nightly-2022-08-18 diff --git a/voxygen/src/mesh/terrain.rs b/voxygen/src/mesh/terrain.rs index eb84c54aa1..7d5b6c107c 100644 --- a/voxygen/src/mesh/terrain.rs +++ b/voxygen/src/mesh/terrain.rs @@ -36,7 +36,7 @@ pub const MAX_LIGHT_DIST: i32 = SUNLIGHT as i32; /// Working around lack of existential types. /// /// See [https://github.com/rust-lang/rust/issues/42940] -type CalcLightFn = impl Fn(Vec3) -> f32 + 'static + Send + Sync; +// type CalcLightFn/**/ = impl Fn(Vec3) -> f32 + 'static + Send + Sync; #[inline(always)] /* #[allow(unsafe_code)] */ @@ -83,7 +83,7 @@ fn calc_light<'a, lit_blocks: I, flat: &'a Vec, (w, h, d): (i32, i32, i32) -) -> CalcLightFn { +) -> impl Fn(Vec3) -> f32 + 'static + Send + Sync/*CalcLightFn*//**/ { span!(_guard, "calc_light"); const UNKNOWN: u8 = 255; const OPAQUE: u8 = 254; diff --git a/voxygen/src/scene/terrain.rs b/voxygen/src/scene/terrain.rs index b126195db2..7ca91db039 100644 --- a/voxygen/src/scene/terrain.rs +++ b/voxygen/src/scene/terrain.rs @@ -633,7 +633,7 @@ impl SpriteRenderContext { } }); - let init = core::lazy::OnceCell::new(); + let init = core::cell::OnceCell::new(); let mut join_handle = Some(join_handle); let mut closure = move |renderer: &mut Renderer| { // The second unwrap can only fail if the sprite meshing thread panics, which diff --git a/world/Cargo.toml b/world/Cargo.toml index 43b620c21d..81df9994c7 100644 --- a/world/Cargo.toml +++ b/world/Cargo.toml @@ -39,7 +39,7 @@ tracing = { version = "0.1", default-features = false } rand = "0.8" rand_chacha = "0.3" arr_macro = "0.1.2" -packed_simd = { package = "packed_simd_2", version = "0.3.5", optional = true } +packed_simd = { package = "packed_simd_2", version = "0.3.8", optional = true } rayon = "1.5" serde = { version = "1.0.110", features = ["derive"] } ron = { version = "0.7", default-features = false } diff --git a/world/src/column/mod.rs b/world/src/column/mod.rs index fa0a7de28a..7e6b53b23c 100644 --- a/world/src/column/mod.rs +++ b/world/src/column/mod.rs @@ -18,7 +18,7 @@ use noise::NoiseFn; use serde::Deserialize; use std::{ ops::{Add, Div, Mul, Sub}, - simd::StdFloat, + simd::{SimdInt, SimdFloat, StdFloat}, }; use tracing::error; use vek::*; @@ -318,7 +318,7 @@ impl SplineGen2D { let secant = |b, c| c - b; let parabola = |a, c| (c - a) * half; let slope = |s_a: Simd, s_b: Simd, p_b: Simd| { - (s_a.signum() + s_b.signum()) * (s_a.abs().min(s_b.abs()).min(p_b.abs() * half)) + (s_a.signum() + s_b.signum()) * (s_a.abs().simd_min(s_b.abs()).simd_min(p_b.abs() * half)) }; // Compute secants. diff --git a/world/src/site2/gen.rs b/world/src/site2/gen.rs index fa083b8339..5a02abbb3c 100644 --- a/world/src/site2/gen.rs +++ b/world/src/site2/gen.rs @@ -23,7 +23,7 @@ use num::cast::AsPrimitive; use std::{ cell::RefCell, hash::BuildHasherDefault, - simd::StdFloat, + simd::{SimdInt, StdFloat}, }; use vek::*;