Support for no-std
Can this crate be changed in a way that it supports no-std(as Vulkan explicitly supports embedded devices) or does it depend on std exclusive stuff?
Instead of Vec<T> we could use the crate 'smallvec' for no_std.
Vec is available via the alloc crate in no_std. You could cfg out the high level wrappers if you want no-alloc support as well.
I haven't looked at no_std at all yet. ash also fetches all the function pointers at runtime, is that a problem for embedded devices?
Ok it seems like dynamic function loading is not trivial on no_std.
Dynamic function loading is intrinsic to Vulkan, minimal entry points aside.
Which "embedded devices" do you want to run vulkan on?
Dont have anything explicit in mind but I think it would be some device with an RTOS or with a statically linked vulkan driver.
Also, CStr is only in libstd. Hopefully Rust gets better null-terminated strings eventually...
I do have some interest in this, there are few things I can think of to make moving towards being no_std capable (probably with alloc given we need dynamic function loading):
- Make the generator generate types using
coreandallocinstead ofstdfor imports where possible. This is a change that can be made without any api changes. - Regarding CStr(ing) we either need to hope those are moved to liballoc/libc/libcore or make ash depend on https://crates.io/crates/cstr_core when no_std is used.
I imagine there is more than those two things involved with no_std support.
probably with alloc given we need dynamic function loading
Loading functions does not require alloc.
probably with alloc given we need dynamic function loading
Loading functions does not require alloc.
Well I guess I am mistaken there.
I could make some pull requests to do some of the type import stuff for core and alloc if desired
To help with this, I am implementing the following clippy lint: https://github.com/rust-lang/rust-clippy/pull/9103
The lint should help us ensure we don't forget any types that could be specified in core or alloc instead.
Assuming all goes well for 1.64, CStr and CString will be accessible inside of core and alloc respectively: https://github.com/rust-lang/rust/pull/99277
The new clippy lints are also stabilized in 1.64