Make dioxus-native work on iOS simulator (#4876)
* Make dioxus-native work on iOS simulator Signed-off-by: Nico Burns <nico@nicoburns.com> * Bump dioxus-native to v0.7.1 Signed-off-by: Nico Burns <nico@nicoburns.com> * Update package version to use workspace versioning --------- Signed-off-by: Nico Burns <nico@nicoburns.com> Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
1 parent
41f68582e9
commit
d61848609f
5 files changed
+513
-66
No files matched your search
Generated
+491
-63
File diff suppressed because it is too large.
Load diff
+2
-1
@@ -222,8 +222,9 @@ blitz-html = { version = "0.2" }
|
||||
blitz-paint = { version = "0.2" }
|
||||
blitz-traits = { version = "0.2" }
|
||||
blitz-shell = { version = "0.2", default-features = false }
|
||||
anyrender = { version = "0.6", default-features = false }
|
||||
anyrender = { version = "0.6.2", default-features = false }
|
||||
anyrender_vello = { version = "0.6", default-features = false }
|
||||
anyrender_vello_cpu = { version = "0.8", default-features = false }
|
||||
wgpu_context = { version = "0.1", default-features = false }
|
||||
wgpu = { version = "26.0" }
|
||||
vello = "0.6"
|
||||
|
||||
@@ -56,5 +56,8 @@ tracing = { workspace = true, optional = true }
|
||||
rustc-hash = { workspace = true }
|
||||
futures-util = { workspace = true }
|
||||
|
||||
[target.'cfg(all(target_os = "ios", target_abi = "sim"))'.dependencies]
|
||||
anyrender_vello_cpu = { workspace = true, features = ["pixels_window_renderer"]}
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
@@ -6,9 +6,16 @@ use anyrender::WindowRenderer;
|
||||
|
||||
pub use anyrender_vello::{
|
||||
wgpu::{Features, Limits},
|
||||
CustomPaintSource, VelloRendererOptions, VelloWindowRenderer as InnerRenderer,
|
||||
CustomPaintSource, VelloRendererOptions,
|
||||
};
|
||||
|
||||
#[cfg(not(all(target_os = "ios", target_abi = "sim")))]
|
||||
pub use anyrender_vello::VelloWindowRenderer as InnerRenderer;
|
||||
|
||||
#[cfg(all(target_os = "ios", target_abi = "sim"))]
|
||||
pub use anyrender_vello_cpu::VelloCpuWindowRenderer as InnerRenderer;
|
||||
|
||||
#[cfg(not(all(target_os = "ios", target_abi = "sim")))]
|
||||
pub fn use_wgpu<T: CustomPaintSource>(create_source: impl FnOnce() -> T) -> u64 {
|
||||
use dioxus_core::{consume_context, use_hook_with_cleanup};
|
||||
|
||||
@@ -44,6 +51,7 @@ impl DioxusNativeWindowRenderer {
|
||||
Self::with_inner_renderer(vello_renderer)
|
||||
}
|
||||
|
||||
#[cfg(not(all(target_os = "ios", target_abi = "sim")))]
|
||||
pub fn with_features_and_limits(features: Option<Features>, limits: Option<Limits>) -> Self {
|
||||
let vello_renderer = InnerRenderer::with_options(VelloRendererOptions {
|
||||
features,
|
||||
@@ -60,6 +68,7 @@ impl DioxusNativeWindowRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(all(target_os = "ios", target_abi = "sim")))]
|
||||
impl DioxusNativeWindowRenderer {
|
||||
pub fn register_custom_paint_source(&self, source: Box<dyn CustomPaintSource>) -> u64 {
|
||||
self.inner.borrow_mut().register_custom_paint_source(source)
|
||||
|
||||
@@ -21,7 +21,10 @@ pub use dioxus_native_dom::*;
|
||||
pub use anyrender_vello::{CustomPaintCtx, CustomPaintSource, DeviceHandle, TextureHandle};
|
||||
use assets::DioxusNativeNetProvider;
|
||||
pub use dioxus_application::{DioxusNativeApplication, DioxusNativeEvent};
|
||||
pub use dioxus_renderer::{use_wgpu, DioxusNativeWindowRenderer, Features, Limits};
|
||||
pub use dioxus_renderer::{DioxusNativeWindowRenderer, Features, Limits};
|
||||
|
||||
#[cfg(not(all(target_os = "ios", target_abi = "sim")))]
|
||||
pub use dioxus_renderer::use_wgpu;
|
||||
|
||||
use blitz_shell::{create_default_event_loop, BlitzShellEvent, Config, WindowConfig};
|
||||
use dioxus_core::{ComponentFunction, Element, VirtualDom};
|
||||
@@ -135,7 +138,10 @@ pub fn launch_cfg_with_props<P: Clone + 'static, M: 'static>(
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
#[cfg(not(all(target_os = "ios", target_abi = "sim")))]
|
||||
let renderer = DioxusNativeWindowRenderer::with_features_and_limits(features, limits);
|
||||
#[cfg(all(target_os = "ios", target_abi = "sim"))]
|
||||
let renderer = DioxusNativeWindowRenderer::new();
|
||||
let config = WindowConfig::with_attributes(
|
||||
Box::new(doc) as _,
|
||||
renderer.clone(),
|
||||
|
||||
Reference in new issue
Block a user