4 ms·
two questions: How big is the part of the engine that uses 'unsafe' Rust? What systems are to be multithreaded on release? Like Rendering, Physics etc.
by SleepyMyroslav 4y ago
two questions:
How big is the part of the engine that uses 'unsafe' Rust?
What systems are to be multithreaded on release? Like Rendering, Physics etc.
- _cart 4y agoBevy ECS has a good chunk of `unsafe` as we're doing granular parallel data access that the Rust compiler cannot reason about. Anything related to low-level system api bindings (Vulkan, audio, etc) is inherently unsafe. But basically all "engine logic" (like our actual renderer logic, scenes, assets, etc) is written in safe Rust. We only use unsafe if we _absolutely need to_ and give it a lot of scrutiny. Impossible to avoid it entirely in the engine space though! The engine is very threaded in general. We do pipelined rendering so the next frame's logic is computed while the current frame is rendering, we multithread expensive potentially high-entity tasks like animation and transform propagation, all ECS systems run in parallel (which includes the renderer systems), etc. We'll use whatever cores you give us!