lapce / floem

A native Rust UI library with fine-grained reactivity
https://docs.rs/floem
MIT License
2.53k stars 114 forks source link

Ability to Force the Use of wgpu-only Through Feature Flag #123

Open deadash opened 8 months ago

deadash commented 8 months ago

Description:

On riscv64 platforms, we are able to successfully compile and run wgpu. However, due to issues with the compilation of tiny_skia, we are unable to utilize it fully.

Steps to Reproduce:

  1. Clone the repository on a riscv64 machine.
  2. Run the build command specific to wgpu.
  3. Observe that while wgpu compiles successfully, the build fails due to tiny_skia.

Expected Behavior:

The build should succeed and we should be able to run wgpu-only functionality on riscv64.

Actual Behavior:

The build fails due to tiny_skia compilation issues, preventing us from using wgpu-only functionality.

Additional Information:

It would be beneficial to have a feature flag that allows us to force the use of wgpu-only, bypassing the tiny_skia dependency.

Possible Solution:

Introduce a feature flag that when enabled, excludes tiny_skia from the build process, allowing for wgpu-only operation.

deadash commented 8 months ago

Upon investigation, the reason tiny_skia is not usable is that it has a dependency on softbuffer. By default, softbuffer has the following features enabled: ["kms", "x11", "x11-dlopen", "wayland", "wayland-dlopen"].

The kms feature, in turn, depends on drm, which requires the use_bindgen feature to be enabled for successful compilation. This is the root cause of the issue we are facing.

Is there a way to enforce the use of wgpu only, bypassing the problematic tiny_skia dependency, particularly on the riscv64 architecture?

panekj commented 8 months ago

Why can't you just build it with tiny_skia?

panekj commented 8 months ago

This should be fixed once https://github.com/Smithay/drm-rs/pull/176 lands

otherwise adding dependency with bindgen feature fixes that as well

[dependencies]
drm-sys = { version = "*", features = ["use_bindgen"] }
ids1024 commented 8 months ago

Ah, this isn't something I considered when we merged the kms backend in softbuffer.

Using softbuffer with default-features = false to leave out the kms feature would be reasonable. It isn't very useful yet since kms support isn't merged in winit yet (https://github.com/rust-windowing/winit/pull/2795).