diff --git a/Cargo.lock b/Cargo.lock index 044c8df..419d3fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -589,6 +589,23 @@ dependencies = [ "tracing", ] +[[package]] +name = "bevy-dmabuf" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "321fa0b7c6b02ac16d5f85f1703b9d4a9a50e2ad3f9adae3b52138868a2747e8" +dependencies = [ + "ash", + "bevy", + "color-eyre", + "drm-fourcc", + "serde", + "thiserror 2.0.12", + "tracing", + "wgpu", + "zbus", +] + [[package]] name = "bevy-mesh-text-3d" version = "0.1.0" @@ -1092,7 +1109,7 @@ dependencies = [ [[package]] name = "bevy_mod_openxr" version = "0.3.0" -source = "git+https://github.com/Schmarni-Dev/bevy_openxr?branch=non_default_wait_frame_system#f0fd9a3086f1d898cf8d1a5338a3deae7ef66e2f" +source = "git+https://github.com/Schmarni-Dev/bevy_openxr?branch=vk_exts#a60db3da6cfa48afb3345c3c370fa26578bda341" dependencies = [ "android_system_properties", "ash", @@ -1110,7 +1127,7 @@ dependencies = [ [[package]] name = "bevy_mod_xr" version = "0.3.0" -source = "git+https://github.com/Schmarni-Dev/bevy_openxr?branch=non_default_wait_frame_system#f0fd9a3086f1d898cf8d1a5338a3deae7ef66e2f" +source = "git+https://github.com/Schmarni-Dev/bevy_openxr?branch=vk_exts#a60db3da6cfa48afb3345c3c370fa26578bda341" dependencies = [ "bevy", ] @@ -5350,6 +5367,7 @@ name = "stardust-xr-server" version = "0.45.0" dependencies = [ "bevy", + "bevy-dmabuf", "bevy-mesh-text-3d", "bevy_mod_openxr", "bevy_mod_xr", diff --git a/Cargo.toml b/Cargo.toml index d71d20a..3553245 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,17 +42,9 @@ auto_link_exclude_list = ["libc*", "libdl*", "libpthread*", "ld-linux*"] [profile.dev.package."*"] opt-level = 3 -# [profile.release] -# opt-level = 3 -# debug = "line-tables-only" -# strip = true -# debug-assertions = true -# overflow-checks = false -# lto = "thin" - [patch.crates-io] -bevy_mod_openxr = { git = "https://github.com/Schmarni-Dev/bevy_openxr", branch = "non_default_wait_frame_system" } -bevy_mod_xr = { git = "https://github.com/Schmarni-Dev/bevy_openxr", branch = "non_default_wait_frame_system" } +bevy_mod_openxr = { git = "https://github.com/Schmarni-Dev/bevy_openxr", branch = "vk_exts" } +bevy_mod_xr = { git = "https://github.com/Schmarni-Dev/bevy_openxr", branch = "vk_exts" } bevy_gltf = { git = "https://github.com/Schmarni-Dev/bevy", branch = "gltf_backport" } [dependencies] @@ -114,6 +106,7 @@ bevy_mod_xr = "0.3" bevy_mod_openxr = "0.3" # bevy_sk.git = "https://github.com/MalekiRe/bevy_sk" bevy_sk = { git = "https://github.com/technobaboo/bevy_sk", branch = "stochastic" } +bevy-dmabuf = "0.1.0" # bevy-mesh-text-3d.git = "https://github.com/terhechte/bevy-mesh-text-3d" # use my fork until my pr to use minimal bevy features was merged diff --git a/src/main.rs b/src/main.rs index c8aabf3..a223044 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,12 +28,14 @@ use bevy::render::settings::{Backends, RenderCreation, WgpuSettings}; use bevy::render::{RenderDebugFlags, RenderPlugin}; use bevy::scene::ScenePlugin; use bevy::winit::{WakeUp, WinitPlugin}; +use bevy_dmabuf::import::DmabufImportPlugin; use bevy_mod_openxr::action_set_attaching::OxrActionAttachingPlugin; use bevy_mod_openxr::action_set_syncing::OxrActionSyncingPlugin; use bevy_mod_openxr::add_xr_plugins; use bevy_mod_openxr::exts::OxrExtensions; use bevy_mod_openxr::features::overlay::OxrOverlaySettings; use bevy_mod_openxr::features::passthrough::OxrPassthroughPlugin; +use bevy_mod_openxr::graphics::{GraphicsBackend, OxrManualGraphicsConfig}; use bevy_mod_openxr::init::{OxrInitPlugin, should_run_frame_loop}; use bevy_mod_openxr::reference_space::OxrReferenceSpacePlugin; use bevy_mod_openxr::render::{OxrRenderPlugin, OxrWaitFrameSystem}; @@ -245,6 +247,11 @@ fn bevy_loop( ) -> AppExit { let mut app = App::new(); app.insert_resource(DbusConnection(dbus_connection)); + app.insert_resource(OxrManualGraphicsConfig { + fallback_backend: GraphicsBackend::Vulkan(()), + vk_instance_exts: Vec::new(), + vk_device_exts: bevy_dmabuf::required_device_extensions(), + }); app.add_plugins(AssetPlugin { meta_check: AssetMetaCheck::Never, unapproved_path_mode: UnapprovedPathMode::Allow, @@ -284,7 +291,8 @@ fn bevy_loop( // .add(AnimationPlugin) .add(AudioPlugin::default()) .add(GizmoPlugin) - .add(WindowPlugin::default()); + .add(WindowPlugin::default()) + .add(DmabufImportPlugin); let mut task_pool_plugin = TaskPoolPlugin::default(); // make tokio work let handle = tokio::runtime::Handle::current(); @@ -344,7 +352,8 @@ fn bevy_loop( .disable::() } else { // enable a event - plugins.add(XrSessionPlugin { auto_handle: false }) + plugins = plugins.add(XrSessionPlugin { auto_handle: false }); + bevy_dmabuf::wgpu_init::add_dmabuf_init_plugin(plugins) }); app.add_plugins(bevy_sk::hand::HandPlugin);