Ensure that Bevy works using Meta XR Simulator in macOS when using a patched MoltenVK's SPIRV-Cross.

This commit is contained in:
Pedro Diaz
2025-01-14 23:25:11 +01:00
parent 53f1a552fb
commit b40f788a41
2 changed files with 13 additions and 9 deletions

View File

@@ -40,19 +40,18 @@ impl Plugin for OxrPassthroughPlugin {
pub fn insert_passthrough(world: &mut World) { pub fn insert_passthrough(world: &mut World) {
let session = world.resource::<OxrSession>(); let session = world.resource::<OxrSession>();
let (passthrough, passthrough_layer) = create_passthrough( if let Ok((passthrough, passthrough_layer)) = create_passthrough(
session, session,
openxr::PassthroughFlagsFB::IS_RUNNING_AT_CREATION, openxr::PassthroughFlagsFB::IS_RUNNING_AT_CREATION,
openxr::PassthroughLayerPurposeFB::RECONSTRUCTION, openxr::PassthroughLayerPurposeFB::RECONSTRUCTION,
) ) {
.unwrap();
world world
.resource_mut::<OxrRenderLayers>() .resource_mut::<OxrRenderLayers>()
.insert(0, Box::new(PassthroughLayer)); .insert(0, Box::new(PassthroughLayer));
world.insert_resource(passthrough); world.insert_resource(passthrough);
world.insert_resource(passthrough_layer); world.insert_resource(passthrough_layer);
} }
}
pub fn resume_passthrough( pub fn resume_passthrough(
passthrough: Res<OxrPassthrough>, passthrough: Res<OxrPassthrough>,

View File

@@ -115,10 +115,15 @@ unsafe impl GraphicsExt for openxr::Vulkan {
<Vulkan as Api>::Instance::desired_extensions(&vk_entry, VK_TARGET_VERSION_ASH, flags)?; <Vulkan as Api>::Instance::desired_extensions(&vk_entry, VK_TARGET_VERSION_ASH, flags)?;
let device_extensions = [ let device_extensions = [
ash::khr::swapchain::NAME, ash::khr::swapchain::NAME,
#[cfg(target_os = "android")]
ash::khr::draw_indirect_count::NAME, ash::khr::draw_indirect_count::NAME,
ash::khr::timeline_semaphore::NAME, ash::khr::timeline_semaphore::NAME,
ash::khr::imageless_framebuffer::NAME, ash::khr::imageless_framebuffer::NAME,
ash::khr::image_format_list::NAME, ash::khr::image_format_list::NAME,
#[cfg(target_os = "macos")]
ash::khr::portability_subset::NAME,
#[cfg(target_os = "macos")]
ash::ext::metal_objects::NAME,
]; ];
let vk_instance = unsafe { let vk_instance = unsafe {