Description
This is a tracking issue for progress on a no_std
compatible subset of Bevy
. The tasks are ordered roughly in sequence (bevy_app
can't be no_std
until bevy_ecs
is for example).
Core Tasks
These tasks must be completed for a no_std
Bevy to become usable at all.
Prerequisites ✅
bevy_ptr
✅
Done prior to initiative.
bevy_utils
✅
Provide an appropriate Instant
type which can be controlled by the user in no_std
contexts, or avoid its use. Move web-time
into wasm32
-only dependencies (doesn't need to exist outside web anyway!). Make thread_local
optional.
Done!
bevy_tasks
🚧
Awaiting merge.
bevy_macro_utils
✅
Update derive_label
to use Box
from alloc
(requires wrapping the quoted impl
in a const _: () = { ... }
so that extern crate alloc
wont conflict with the outer namespace).
Done!
bevy_ecs
🚧
- Remove
petgraph
frombevy_ecs
#15519 - Remove
thiserror
frombevy_ecs
#15774 - Add
std
/alloc
features
Blocked on bevy_tasks
.
bevy_app
- Remove
thiserror
frombevy_app
#15779 - Add
std
/alloc
features
Blocked on bevy_ecs
.
bevy_core
Blocked on bevy_app
.
bevy_internal
/ bevy
- Thread
std
/alloc
features from sub-crates through to the finalbevy
crate.
Blocked on bevy_core
.
CI 🚧
- Add
compile-check-no-std
Command to CI Tool #15843 - Once the other core tasks are completed, a
no_std
example should be created and tested in CI as well.
Bonus Features
These tasks aren't strictly required, but should be completed to close the gap between no_std
and std
Bevy. The more functionality we can provide in no_std
, the more the community can develop for it.
bevy_asset
Reliance on filesystem operations will make this interesting, but a lot of the asset functionality exists outside of files and folders (processing, etc.). It's reasonable to consider that a no_std
platform could have a custom AssetSource
(and accompanying AssetReader
/Writer
/etc.).
bevy_color
Blocked on bevy_math
.
Would need to feature-gate the wgpu
and encase
integration, but otherwise perfectly manageable.
bevy_derive
Should work as-is, but need to test.
bevy_diagnostic
Blocked on bevy_core
.
bevy_hierarchy
Blocked on bevy_core
.
bevy_image
Blocked on bevy_asset
. Would also require some substantial feature-gating to isolate out the no_std
compatible subset.
bevy_input
Blocked on bevy_core
.
bevy_log
Blocked on bevy_ecs
.
bevy_math
🚧
Awaiting merge.
bevy_mesh
Blocked on bevy_image
, bevy_transform
, and hexasphere
. hexasphere
would need upstream changes, but on a first-glance looks like to could be no_std
.
bevy_mikktspace
✅
Done!
bevy_reflect
🚧
Awaiting merge.
bevy_remote
Blocked on bevy_hierarchy
and a design. Currently built around networking, but could support serial commands instead, and would make debugging on embedded much easier too.
bevy_scene
Blocked on bevy_hierarchy
and bevy_asset
.
bevy_state
Blocked on bevy_hierarchy
.
bevy_time
Blocked on bevy_ecs
, but also needs some design work, since Instant
is a part of std
and not core
. Providing an unsafe
method for manually updating Time
's based on a Duration
would be sufficient.
bevy_transform
Blocked on bevy_hierarchy
.
Not Planned
These crates can't be ported to no_std
because they are highly platform specific. If you see something on this list that could be ported, please let me know!
bevy_a11y
⚠
This crate is blocked on AccessKit's lack of no_std
support. There may be value is having accessibility features in a no_std
environment, but the ecosystem doesn't seem to have this as a priority.
bevy_animation
⚠
Blocked by bevy_render
.
- Remove
thiserror
frombevy_animation
#15780 - Replace
petgraph
with ano_std
compatible alternative.
Currently only using the DiGraph
type with no edge data and only a single node type AnimationGraphNode
(and a serializable alternate SerializedAnimationGraphNode
).
bevy_audio
⚠
Currently undergoing a major re-write so this is subject to change. I suspect even with the re-write no_std
support would be blocked on a fundamental dependency such as cpal
. Like rendering, audio is very platform dependent so there likely isn't a viable API Bevy could provide that would be simultaneously feature-rich enough for use on common platforms (PC, etc.) while being low-level enough for no_std
ones too.
bevy_core_pipeline
⚠
Blocked by bevy_render
.
bevy_dev_tools
⚠
Blocked by bevy_render
.
bevy_dylib
⚠
Unfamiliar with the dynamic linking this crate provides. I don't see any reason why it couldn't be supported in no_std
, but I would definitely require an SME to assist with getting it working.
bevy_encase_derive
⚠
Exclusively used with encase
, which is a part of the rendering side of Bevy.
bevy_gilrs
⚠
Built around gilrs
which does not currently have any no_std
support. There might be a way to upstream no_std
support by relying on something like SDL
, but I'm not familiar enough with the project to make a fair assessment on the viability here.
bevy_gizmos
⚠
Blocked by bevy_render
.
bevy_gltf
⚠
Blocked by bevy_render
. It may make sense to find a way to break this dependency, since gLTF
can be used independently of wgpu
(e.g., with a user-created OpenGL renderer backend), but this would need an SME for sure.
bevy_pbr
⚠
Blocked by bevy_render
and wgpu
. Without support for WGSL shaders there's no real point in having this crate supported in no_std
.
bevy_render
⚠
Massive crate very deeply integrated with wgpu
, which is not just std
reliant, but also platform dependent too. I don't think it will ever make sense to have a no_std
bevy_render
. Maybe could have value in splitting out some abstractions, but I don't know.
bevy_sprite
⚠
Blocked on bevy_render
.
bevy_text
⚠
Blocked on bevy_render
.
bevy_ui
⚠
Blocked on bevy_render
.
bevy_window
⚠
Currently blocked on bevy_a11y
, but could be made no_std
compatible if that was feature-gated.
bevy_winit
⚠
Blocked on winit
. Likely couldn't be made no_std
upstream either since it's entirely platform dependent.
General Notes
thiserror
thiserror
is currently not available in a no_std
form due to its use of the ::std::error::Error
path for Error
(which it continues to use for MSRV backwards compatibility). There is a PR to add no_std
support to thiserror
which preserves that MSRV requirement, but it's unclear if/when that will be merged and released.
One alternative is to link against the PR instead of the published version of thiserror
:
thiserror = {
git = "https://github.com/quartiq/thiserror",
rev = "515bd36da54dbc346250026ddc349c88851e4bb1",
default-features = false,
}
Another alternative is to switch to using derive_more
. This would require adding explicit calls to derive(From, Display)
as well, which adds to the noise. Additionally, it isn't already in the dependency tree, so its inclusion may be contentious.
Due to delays in thiserror
's no_std
support, we have decided to use derive_more
.
Platform Support
Being no_std
is necessary for certain platforms, but it is not always sufficient. Below is a table of platforms that I have tested:
Name | Target | Builds | Notes |
---|---|---|---|
UEFI | x86_64-unknown-uefi |
Runs | Boots on emulated and real hardware, supported by the uefi crate. |
GameBoy Advance | thumbv4t-none-eabi |
Partially | The platform does not support all atomic operations (e.g., CAS), which Bevy directly and transiently relies on. Moving from tracing to log , and using portable_atomics is sufficient to make this platform compile. |
Nintendo Switch | aarch64-nintendo-switch-freestanding |
Compiles | I cannot test the binary produced by cargo nx on real hardware or an emulator to confirm it actually works. |
PlayStation One | mipsel-sony-psx |
Partially | The platform does not support all atomic operations (e.g., CAS), which Bevy directly and transiently relies on. Moving from tracing to log , and using portable_atomics is sufficient to make this platform compile. |
MSP430 | msp430-none-elf |
No | This platform is 16-bit, which breaks too many assumptions made by dependencies like zerocopy . |
Playdate | thumbv7em-none-eabihf |
Runs | Runs but requires a patch to fixedbitset to disabled SIMD. Could potentially be fixed from within Bevy without the patch though. |
I have a prototype of no_std
compatible Bevy available on this branch. It's not being actively maintained, as it is a proof of concept for upstream no_std
support (use at your own risk, etc.). However, if anyone has a particular platform they'd like to use Bevy on, please feel free to test using this branch and let me know what kind of compatibility you have. In general:
- You must be able to compile a Rust project for this platform. (I hope this goes without saying!)
- You must have
alloc
andcore
available. - Your platform must support Atomic CAS (hoping to relax this in the future!)
- Only the
bevy_app
,bevy_ecs
,bevy_utils
, andbevy_tasks
are compatible in this branch, and must be imported directly (e.g., you can'tuse bevy;
, insteaduse bevy_app;
). Additionally, you must disable default features forno_std
compatibility. - Your platform must be 32-bit or higher due to safety concerns in
bevy_ecs
. For further information, see [Merged by Bors] - Fail to compile on 16-bit platforms #4736.