make it work on mac/metal

This commit is contained in:
Chad Brokaw 2022-07-14 14:52:44 -04:00
parent 9626eaa19b
commit af55dbfa4e
2 changed files with 3 additions and 6 deletions

View file

@ -133,7 +133,7 @@ struct Helpers {
}
impl MtlInstance {
pub fn new(window_handle: Option<&dyn HasRawWindowHandle>) -> Result<MtlInstance, Error> {
pub fn new() -> Result<MtlInstance, Error> {
Ok(MtlInstance)
}
@ -142,10 +142,7 @@ impl MtlInstance {
window_handle: &dyn HasRawWindowHandle,
) -> Result<MtlSurface, Error> {
if let RawWindowHandle::MacOS(handle) = window_handle.raw_window_handle() {
Ok(Self::make_surface(
handle.ns_view as id,
handle.ns_window as id,
))
Ok(Self::make_surface(handle.ns_view as id, handle.ns_window as id).unwrap())
} else {
Err("can't create surface for window handle".into())
}

View file

@ -183,7 +183,7 @@ impl Instance {
mux_match! { self;
Instance::Vk(i) => i.device(true).map(Device::Vk),
Instance::Dx12(i) => i.device().map(Device::Dx12),
Instance::Mtl(i) => i.device(surface.map(Surface::mtl)).map(Device::Mtl),
Instance::Mtl(i) => i.device().map(Device::Mtl),
}
}