Skip to content

Support for no-std #314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ghost opened this issue Jul 12, 2020 · 13 comments
Open

Support for no-std #314

ghost opened this issue Jul 12, 2020 · 13 comments

Comments

@ghost
Copy link

ghost commented Jul 12, 2020

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?

@ghost
Copy link
Author

ghost commented Jul 12, 2020

Instead of Vec we could use the crate 'smallvec' for no_std.

@Ralith
Copy link
Collaborator

Ralith commented Jul 12, 2020

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.

@MaikKlein
Copy link
Member

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?

@ghost
Copy link
Author

ghost commented Jul 12, 2020

Ok it seems like dynamic function loading is not trivial on no_std.

@Ralith
Copy link
Collaborator

Ralith commented Jul 12, 2020

Dynamic function loading is intrinsic to Vulkan, minimal entry points aside.

@MaikKlein
Copy link
Member

Which "embedded devices" do you want to run vulkan on?

@ghost
Copy link
Author

ghost commented Jul 13, 2020

Dont have anything explicit in mind but I think it would be some device with an RTOS or with a statically linked vulkan driver.

@anyputer
Copy link

Also, CStr is only in libstd. Hopefully Rust gets better null-terminated strings eventually...

@i509VCB
Copy link
Contributor

i509VCB commented Dec 26, 2021

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 core and alloc instead of std for 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.

@Ralith
Copy link
Collaborator

Ralith commented Dec 26, 2021

probably with alloc given we need dynamic function loading

Loading functions does not require alloc.

@i509VCB
Copy link
Contributor

i509VCB commented Dec 26, 2021

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

@i509VCB
Copy link
Contributor

i509VCB commented Jul 3, 2022

To help with this, I am implementing the following clippy lint: rust-lang/rust-clippy#9103

The lint should help us ensure we don't forget any types that could be specified in core or alloc instead.

@i509VCB
Copy link
Contributor

i509VCB commented Aug 17, 2022

Assuming all goes well for 1.64, CStr and CString will be accessible inside of core and alloc respectively: rust-lang/rust#99277

The new clippy lints are also stabilized in 1.64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants