Bevy integration needs work #10681
Replies: 3 comments
|
Thanks for the report. This is very long and hard to act on. Please include what you expected to happen, what actually happened, exact steps to reproduce (minimal example if possible). Please avoid AI-generated summaries, architecture proposals, or long explanations. A small, reproducible case will help us investigate much faster. |
|
Hi sure, What's happened is I am trying to use Slint with Bevy, however the problem has occurred to me that the methods I've attempted have not yielded proper results. I have looked at the limited demo for rendering Slint as a texture in Bevy, however that has not worked for me. I am wondering wgpu is in a shared instance, yet there is no way to render Bevy to a Slint texture. My report showcases 3 attempts to get Slint and Bevy working together, I even looked at other UI integrations with Bevy to see if I could get it working, however that architecture has failed as well. I am asking that Slint and Bevy have a more official integration, as Slint is way more versatile and customizable than egui or iced. What actually happened in my integration tests is that it only render a blank black screen or Bevy in a native mode without any UI. Treat the report with some respect, it does say what I tried and what is blocking it from working. Steps to reproduce desired results have not yet been discovered. Only steps that do not make a light blub so to speak. This is the demo that is supposed to work for Bevy Slint integration: |
|
Hi, you might want to try one of the other examples that runs slint from within the bevy event loop: https://github.com/slint-ui/slint/tree/master/examples/bevy-hosts-slint-gpu and https://github.com/slint-ui/slint/tree/master/examples/bevy-hosts-slint. |
Uh oh!
There was an error while loading. Please reload this page.
Bug Description
Bevy Integration Needs Work
Issue Title
Slint-Bevy Integration: Skia ICU Conflicts on Windows & Resource Initialization Order
Summary
The Slint UI framework integration with Bevy 0.17 is blocked by multiple issues on Windows:
Option<T>wrappersWhat Was Attempted
Approach 1: Slint-First Architecture with Shared wgpu (FAILED)
Following the official Slint+Bevy example, we attempted to:
Configuration:
Result: Linker errors on Windows due to duplicate ICU symbols from Skia:
Root Cause: Slint's default renderer uses Skia, which bundles ICU. When linking with Bevy (which may also use ICU indirectly), duplicate symbol errors occur. The
rust-lldlinker is stricter about this than MSVC's default linker.Approach 2: FemtoVG Renderer (FAILED)
Attempted to use FemtoVG renderer to avoid Skia:
Result: Same ICU conflicts - FemtoVG still pulls in Skia dependencies.
Approach 3: Software Renderer Overlay (PARTIAL SUCCESS)
Reverted to Bevy-first architecture with Slint software renderer:
Result: Builds successfully, but revealed systemic issues with resource initialization order.
Current Blockers
1. Resource Initialization Order Panics
Many systems in the codebase require
Res<T>orResMut<T>withoutOption<T>wrappers:Affected Systems:
handle_select_draginselect_tool.rshandle_box_selectioninselect_tool.rshandle_spawn_part_eventsinspawn_events.rsapply_ui_actionsinworld_view.rshandle_window_close_requestinslint_ui.rsandmod.rsTemporary Workaround:
2. Slint Rendering Not Implemented
The
SlintUiPlugincurrently only initializes resources but doesn't actually render the Slint UI. The software renderer overlay approach requires:Best Case Scenario: Multi-Threaded Architecture
For optimal performance, the integration should use a multi-threaded approach where Slint and Bevy run in parallel:
Architecture
Performance Benefits
Implementation Requirements
Shared wgpu Resources:
Render-to-Texture:
Async Communication:
Thread Synchronization:
Proposed Solutions
Short-Term (Workaround)
app.set_error_handler(bevy::ecs::error::warn)to prevent panicsOption<Res<T>>patternMedium-Term (Proper Fix)
Option<Res<T>>patternLong-Term (Optimal)
Environment
Related Issues
Files Modified
crates/engine/src/main.rs- Added error handler, reordered pluginscrates/engine/src/ui/slint_ui.rs- Fixed Option wrapperscrates/engine/src/ui/spawn_events.rs- Fixed Option wrapperscrates/engine/src/ui/world_view.rs- Fixed Option wrapperscrates/engine/src/select_tool.rs- Fixed Option wrapperscrates/engine/Cargo.toml- Switched to software renderer.cargo/config.toml- Disabled rust-lld linkerReproducible Code (if applicable)
Environment Details
Product Impact
No response
All reactions