Skip to content

Support no_std where possible (specifically for wasm32v1-none) #6826

Open
@Dinnerbone

Description

@Dinnerbone

Is your feature request related to a problem? Please describe.
naga, wgpu and related crates should have std as a (default) feature, specifically for wasm32v1-none support.

Describe the solution you'd like
There's a hope to get the wasm ecosystem slowly shifting from wasm32-unknown-unknown to wasm32v1-none, which is hopefully stabilizing in rust 1.84. This is primarily because wasm32-unknown-unknown is something of a moving target and can change the browser requirements at will, which we recently discovered when older Safari stopped working 😅

The main differences between wasm32v1-none and wasm32-unknown-unknown are:

  • It does not enable any wasm features by default (which means it won't arbitrarily break browser compatibility with rust updates)
  • It has no std (as opposed to a stubbed pseudo-std)

Unfortunately, no_std is both a blessing and a curse: it's neat to get things using core/alloc where possible, but it sucks that the majority of the ecosystem needs churn to make this viable.

I've done a quick investigation and I think it's plausible to get at least web working in no_std, but potentially other platforms too. wgpu-types is the easiest to get no_std, it only needs it for one specific dx12 config. naga is possibly the second easiest crate, but it requires some work in dependencies. wgpu-core and wgpu-hal will need more work mostly surrounding the use of mutexes.

Describe alternatives you've considered
We could just not, but that means it's impossible to allow users of wgpu to have any control over which browsers they support.
We can also limit this to a specific set of features, there's no real need today for DX12 and no_std, for example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help requiredWe need community help to make this happen.platform: wasmIssues with webassemblytype: enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions