Experimental wgpu WebGL backend support
- Added missing `draw_cache_align_4x4` call for `brush_glyph` on wasm32 target - Added WebGL support to `integratio_wgpu` example - Fixed test.yml CI workflow - Removed spir-v shader in `integration_wgpu`; Fixed formatting - Removed redundant `BoxStream` typedef
This commit is contained in:
parent
c75ed37148
commit
bdca20fc4a
21 changed files with 414 additions and 86 deletions
|
|
@ -7,6 +7,37 @@ use iced_futures::BoxStream;
|
|||
|
||||
use std::hash::Hash;
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
mod trait_aliases {
|
||||
use super::*;
|
||||
|
||||
/// Wrapper type
|
||||
pub trait RunnerStream<Message>:
|
||||
Stream<Item = Message> + Send + 'static
|
||||
{
|
||||
}
|
||||
|
||||
impl<T, Message> RunnerStream<Message> for T where
|
||||
T: Stream<Item = Message> + Send + 'static
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
mod trait_aliases {
|
||||
use super::*;
|
||||
|
||||
/// Wrapper type
|
||||
pub trait RunnerStream<Message>: Stream<Item = Message> + 'static {}
|
||||
|
||||
impl<T, Message> RunnerStream<Message> for T where
|
||||
T: Stream<Item = Message> + 'static
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
pub use trait_aliases::RunnerStream;
|
||||
|
||||
/// A request to listen to external events.
|
||||
///
|
||||
/// Besides performing async actions on demand with [`Command`], most
|
||||
|
|
@ -191,7 +222,7 @@ impl<I, S, F, Message> Recipe<Hasher, (Event, event::Status)>
|
|||
where
|
||||
I: Hash + 'static,
|
||||
F: FnOnce(EventStream) -> S,
|
||||
S: Stream<Item = Message> + Send + 'static,
|
||||
S: RunnerStream<Message>,
|
||||
{
|
||||
type Output = Message;
|
||||
|
||||
|
|
@ -203,6 +234,13 @@ where
|
|||
fn stream(self: Box<Self>, input: EventStream) -> BoxStream<Self::Output> {
|
||||
use futures::stream::StreamExt;
|
||||
|
||||
(self.spawn)(input).boxed()
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
{
|
||||
(self.spawn)(input).boxed_local()
|
||||
}
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
(self.spawn)(input).boxed()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue