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
+4
-4
@@ -155,7 +155,7 @@ pub fn build_derived_caches(doc: &CadDocument) -> DerivedCaches {
|
||||
// filters that `cache::block_cache::build_defn` already uses for block defns)
|
||||
// and prefer the entity-scan when the header center drifts more than
|
||||
// 10× its own half-span away from the entity centroid.
|
||||
use rayon::prelude::*;
|
||||
use crate::par::prelude::*;
|
||||
|
||||
// Single pass over entities does triple duty: classify cache-kind handle
|
||||
// lists (hatch / image / mesh) AND accumulate per-entity centroids for the
|
||||
@@ -2245,7 +2245,7 @@ impl Scene {
|
||||
};
|
||||
|
||||
// Tessellate in parallel across all available CPU cores.
|
||||
use rayon::prelude::*;
|
||||
use crate::par::prelude::*;
|
||||
let doc = &self.document;
|
||||
// Selection / hover highlight is NOT baked into tessellation. It is
|
||||
// applied per frame in the GPU xray overlay pass from the live
|
||||
@@ -4297,7 +4297,7 @@ impl Scene {
|
||||
})
|
||||
.collect();
|
||||
|
||||
use rayon::prelude::*;
|
||||
use crate::par::prelude::*;
|
||||
self.hatches = entries
|
||||
.into_par_iter()
|
||||
.filter_map(|(handle, kind)| {
|
||||
@@ -4350,7 +4350,7 @@ impl Scene {
|
||||
})
|
||||
.collect();
|
||||
|
||||
use rayon::prelude::*;
|
||||
use crate::par::prelude::*;
|
||||
let facet_res = self.document.header.facet_resolution;
|
||||
let woff = self.world_offset;
|
||||
self.meshes = entries
|
||||
|
||||
Reference in new issue
Block a user