Skip to content

Commit

Permalink
android compiles 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
kcking committed Jan 6, 2022
1 parent e672b65 commit 7d7a56a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
6 changes: 3 additions & 3 deletions crates/bevy_openxr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ bevy_xr = { path = "../bevy_xr", version = "0.5.0" }
# other
openxr = { git = "https://github.com/Ralith/openxrs" }
serde = "1"
ash = "0.33"
wgpu = "0.11"
wgpu-hal = { version = "0.11", features = ["vulkan"] }
ash = "0.34"
wgpu = "0.12"
wgpu-hal = { version = "0.12", features = ["vulkan"] }
thiserror = "1.0"
parking_lot = "0.11"

Expand Down
29 changes: 20 additions & 9 deletions crates/bevy_openxr/src/presentation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub fn create_graphics_context(
let device_descriptor = wgpu::DeviceDescriptor::default();

if instance.exts().khr_vulkan_enable2.is_some() {
let vk_entry = unsafe { ash::Entry::new().map_err(Box::new)? };
let vk_entry = unsafe { ash::Entry::new() };

// Vulkan 1.0 constrained by Oculus Go support.
// todo: multiview support will require Vulkan 1.1 or specific extensions
Expand All @@ -52,10 +52,9 @@ pub fn create_graphics_context(
flags |= hal::InstanceFlags::DEBUG;
}

let instance_extensions = <hal::api::Vulkan as hal::Api>::Instance::required_extensions(
&vk_entry, vk_version, flags,
)
.map_err(Box::new)?;
let instance_extensions =
<hal::api::Vulkan as hal::Api>::Instance::required_extensions(&vk_entry, flags)
.map_err(Box::new)?;
let instance_extensions_ptrs = instance_extensions
.iter()
.map(|x| x.as_ptr())
Expand Down Expand Up @@ -86,7 +85,8 @@ pub fn create_graphics_context(
vk_version,
instance_extensions,
flags,
Box::new(instance.clone()),
false, //TODO: is this correct?
Some(Box::new(instance.clone())),
)
.map_err(Box::new)?
};
Expand Down Expand Up @@ -124,9 +124,17 @@ pub fn create_graphics_context(
.map(|x| x.as_ptr())
.collect::<Vec<_>>();

let mut physical_features = hal_exposed_adapter
.adapter
.physical_device_features(&device_extensions, device_descriptor.features);
// TODO: how do we get limits from actual device?
let uab_types = hal::UpdateAfterBindTypes::from_limits(
&device_descriptor.limits,
&vk::PhysicalDeviceLimits::default(),
);

let mut physical_features = hal_exposed_adapter.adapter.physical_device_features(
&device_extensions,
device_descriptor.features,
uab_types,
);

let family_info = vk::DeviceQueueCreateInfo::builder()
.queue_family_index(queue_family_index)
Expand Down Expand Up @@ -159,7 +167,10 @@ pub fn create_graphics_context(
.adapter
.device_from_raw(
vk_device.clone(),
true, // TODO: is this right?
&device_extensions,
device_descriptor.features,
uab_types,
queue_family_index,
queue_index,
)
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_xr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ bevy_utils = { path = "../bevy_utils", version = "0.5.0" }
# other
downcast-rs = "1.2"
serde = "1"
wgpu = "0.11"
wgpu = "0.12"

0 comments on commit 7d7a56a

Please sign in to comment.