Skip to content

Commit

Permalink
default
Browse files Browse the repository at this point in the history
  • Loading branch information
jupyterkat committed Nov 9, 2024
1 parent 2610f88 commit 5cba402
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
default = ["turf_processing"]
default = ["turf_processing", "katmos"]
zas_hooks = []
turf_processing = []
superconductivity = ["turf_processing"]
Expand Down
3 changes: 2 additions & 1 deletion crates/auxmacros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub fn generate_simd_functions(
fn #func_name(#args_nonmut) #func_return {
// This `unsafe` block is safe because we're testing
// that the `avx2` feature is indeed available on our CPU.
if *crate::SIMD_DETECTED.get_or_init(|| is_x86_feature_detected!("avx2")) {
if *crate::_SIMD_DETECTED.get_or_init(|| is_x86_feature_detected!("avx2")) {
unsafe { #func_ident_simd(#args_typeless) }
} else {
#func_ident_fallback(#args_typeless)
Expand All @@ -103,6 +103,7 @@ pub fn generate_simd_functions(
#func_ident_fallback(#args_typeless)
}

#[inline(always)]
fn #func_ident_fallback(#args) #func_return
#body
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use reaction::react_by_id;
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;

static SIMD_DETECTED: ::std::sync::OnceLock<bool> = ::std::sync::OnceLock::new();
static _SIMD_DETECTED: ::std::sync::OnceLock<bool> = ::std::sync::OnceLock::new();

#[cfg(feature = "tracy")]
#[byondapi::init]
Expand Down
9 changes: 8 additions & 1 deletion src/turfs/katmos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,14 +516,21 @@ fn flood_fill_zones(
let mut border_turfs: std::collections::VecDeque<NodeIndex> = Default::default();
let sender = byond_callback_sender();
let mut total_moles = 0.0_f32;
let mut is_planet = false;
turf_graph.add_node(index_node);
border_turfs.push_back(index_node);
found_turfs.insert(index_turf);
let mut ignore_zone = false;
while let Some(cur_index) = border_turfs.pop_front() {
let cur_turf = arena.get(cur_index).unwrap();
let cur_turf_id = cur_turf.id;

//hard cap for planet atmos because very large open space
if cur_turf.planetary_atmos.is_some() {
is_planet = true;
}
if is_planet && turf_graph.node_count() > equalize_hard_turf_limit {
break;
}
total_moles += cur_turf.total_moles();

for (weight, adj_index, adj_mixture) in arena
Expand Down
3 changes: 3 additions & 0 deletions src/turfs/processing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ fn process_turf(
}

#[cfg_attr(not(target_feature = "avx2"), auxmacros::generate_simd_functions)]
#[cfg_attr(feature = "tracy", tracing::instrument(skip_all))]
fn planet_process(planet_share_ratio: f32) {
with_turf_gases_read(|arena| {
GasArena::with_all_mixtures(|all_mixtures| {
Expand Down Expand Up @@ -221,6 +222,7 @@ fn process_cell(

// Solving the heat equation using a Finite Difference Method, an iterative stencil loop.
#[cfg_attr(not(target_feature = "avx2"), auxmacros::generate_simd_functions)]
#[cfg_attr(feature = "tracy", tracing::instrument(skip_all))]
fn fdm(
(start_time, remaining_time): (&Instant, Duration),
fdm_max_steps: i32,
Expand Down Expand Up @@ -380,6 +382,7 @@ fn post_process_cell<'a>(
// Goes through every turf, checks if it should reset to planet atmos, if it should
// update visuals, if it should react, sends a callback if it should.
#[cfg_attr(not(target_feature = "avx2"), auxmacros::generate_simd_functions)]
#[cfg_attr(feature = "tracy", tracing::instrument(skip_all))]
fn post_process() {
let vis = crate::gas::visibility_copies();
with_turf_gases_read(|arena| {
Expand Down

0 comments on commit 5cba402

Please sign in to comment.