Stdlib RwLock in wgpu, update rust-toolchain to some extent.

This commit is contained in:
Joshua Yanovski 2022-08-18 18:49:44 -07:00
parent 6adfa6680f
commit 9863670169
10 changed files with 20 additions and 18 deletions

View File

@ -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 --"

10
Cargo.lock generated
View File

@ -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",

View File

@ -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" }

View File

@ -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<ServerEvent> to the server)
fn setup_ecs_world(game_mode: GameMode, thread_pool: &Arc<ThreadPool>) -> specs::World {
fn setup_ecs_world(game_mode: GameMode, num_cpu: u64, thread_pool: &Arc<ThreadPool>) -> 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(

View File

@ -1 +1 @@
nightly-2022-04-25
nightly-2022-08-18

View File

@ -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<V, I> = impl Fn(Vec3<i32>) -> f32 + 'static + Send + Sync;
// type CalcLightFn/*<V, I>*/ = impl Fn(Vec3<i32>) -> f32 + 'static + Send + Sync;
#[inline(always)]
/* #[allow(unsafe_code)] */
@ -83,7 +83,7 @@ fn calc_light<'a,
lit_blocks: I,
flat: &'a Vec<Block>,
(w, h, d): (i32, i32, i32)
) -> CalcLightFn<V, I> {
) -> impl Fn(Vec3<i32>) -> f32 + 'static + Send + Sync/*CalcLightFn*//*<V, I>*/ {
span!(_guard, "calc_light");
const UNKNOWN: u8 = 255;
const OPAQUE: u8 = 254;

View File

@ -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

View File

@ -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 }

View File

@ -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<Sampler> SplineGen2D<Sampler> {
let secant = |b, c| c - b;
let parabola = |a, c| (c - a) * half;
let slope = |s_a: Simd<f32, 4>, s_b: Simd<f32, 4>, p_b: Simd<f32, 4>| {
(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.

View File

@ -23,7 +23,7 @@ use num::cast::AsPrimitive;
use std::{
cell::RefCell,
hash::BuildHasherDefault,
simd::StdFloat,
simd::{SimdInt, StdFloat},
};
use vek::*;