diff --git a/README.md b/README.md index 24ef2291..b3380976 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,10 @@ To build the project with natives for your platform run ./gradlew build ``` in the project root directory. - +### macOS +Blaze4D now (mostly) works on macOS! Building and running follows the same steps as on Windows or Linux. +The only difference is that you need to set the `VK_INSTANCE_LAYERS` environment variable to `VK_LAYER_KHRONOS_synchronization2` because moltenVK doesn't natively support it. +### Running To run the game with the mod use any of the 3 run targets: - `./gradlew runClient` - `./gradlew runClientWithValidation` - Enables validation layers diff --git a/core/natives/src/device/init.rs b/core/natives/src/device/init.rs index 268f4a1d..19e8f570 100644 --- a/core/natives/src/device/init.rs +++ b/core/natives/src/device/init.rs @@ -4,6 +4,7 @@ use std::os::raw::c_char; use std::sync::Arc; use ash::vk; +use ash::vk::{DeviceCreateFlags, PhysicalDeviceFeatures2, PhysicalDevicePortabilitySubsetFeaturesKHR}; use bumpalo::Bump; use vk_profiles_rs::{vp, VulkanProfiles}; @@ -97,8 +98,13 @@ pub fn create_device(config: DeviceCreateConfig, instance: Arc) ); } - let device_create_info = device_create_info.queue_create_infos(queue_create_infos.as_slice()); - + let mut portability_subset_features = PhysicalDevicePortabilitySubsetFeaturesKHR::default(); + #[cfg(target_os = "macos")] { + let mut dummy_features = PhysicalDeviceFeatures2::builder().push_next(&mut portability_subset_features); + unsafe {instance.vk().get_physical_device_features2(physical_device, &mut dummy_features);} + } + let device_create_info = device_create_info.queue_create_infos(queue_create_infos.as_slice()) + .push_next(&mut portability_subset_features); let mut flags = vp::DeviceCreateFlagBits::MERGE_EXTENSIONS | vp::DeviceCreateFlagBits::OVERRIDE_FEATURES; if config.disable_robustness { flags |= vp::DeviceCreateFlagBits::DISABLE_ROBUST_ACCESS; @@ -374,6 +380,15 @@ fn configure_device(device: &mut DeviceConfigurator) -> Result Result = debug_messengers.iter().map(|messenger| {