forked from 1b-agent/opencadstudio-upstream
feat(wasm): sequential rayon shim for the web build
wasm32 has no threads, so rayon's global pool would panic at runtime. Add `crate::par::prelude`: native re-exports `rayon::prelude`, wasm provides sequential `std`-iterator equivalents (par_iter / into_par_iter / flat_map_iter over slices, Vec, HashMap, HashSet). All call sites now `use crate::par::prelude::*;` instead of rayon directly. - wire_gpu's rayon `reduce` (2-arg, no std equivalent) is cfg-split to a sequential flat_map concat on wasm. - rayon moves to a non-wasm target dependency. Native still runs in parallel; all 75 tests pass. wasm bin compiles. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
157d54a4d4
commit
9ca19a9db8
8 files changed
+96
-10
No files matched your search
Vendored
+2
-2
@@ -125,7 +125,7 @@ impl BlockCache {
|
||||
/// because their entities are emitted as top-level wires, not via the
|
||||
/// cache.
|
||||
pub fn build(doc: &CadDocument, anno_scale: f32, bg_color: [f32; 4]) -> Self {
|
||||
use rayon::prelude::*;
|
||||
use crate::par::prelude::*;
|
||||
let mut cache = Self::new();
|
||||
let referenced = collect_referenced_blocks(doc);
|
||||
// Each defn is built independently: nested INSERTs are stored as
|
||||
@@ -151,7 +151,7 @@ impl BlockCache {
|
||||
/// called in. Cycle guard: a self-referential block keeps an empty AABB
|
||||
/// (will fail every frustum test → not emitted, which is correct).
|
||||
fn compute_block_aabbs(&mut self, names: &[String]) {
|
||||
use rayon::prelude::*;
|
||||
use crate::par::prelude::*;
|
||||
// Phase 1 (parallel, read-only): each defn's union AABB is resolved
|
||||
// by `defn_aabb_recursive`, which only *reads* `self.defns` (the map
|
||||
// is fully built by now). There's no memoization, so a defn shared by
|
||||
|
||||
Reference in new issue
Block a user