mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 20:51:29 +11:00
make it work on mac/metal
This commit is contained in:
parent
9626eaa19b
commit
af55dbfa4e
|
@ -133,7 +133,7 @@ struct Helpers {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MtlInstance {
|
impl MtlInstance {
|
||||||
pub fn new(window_handle: Option<&dyn HasRawWindowHandle>) -> Result<MtlInstance, Error> {
|
pub fn new() -> Result<MtlInstance, Error> {
|
||||||
Ok(MtlInstance)
|
Ok(MtlInstance)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,10 +142,7 @@ impl MtlInstance {
|
||||||
window_handle: &dyn HasRawWindowHandle,
|
window_handle: &dyn HasRawWindowHandle,
|
||||||
) -> Result<MtlSurface, Error> {
|
) -> Result<MtlSurface, Error> {
|
||||||
if let RawWindowHandle::MacOS(handle) = window_handle.raw_window_handle() {
|
if let RawWindowHandle::MacOS(handle) = window_handle.raw_window_handle() {
|
||||||
Ok(Self::make_surface(
|
Ok(Self::make_surface(handle.ns_view as id, handle.ns_window as id).unwrap())
|
||||||
handle.ns_view as id,
|
|
||||||
handle.ns_window as id,
|
|
||||||
))
|
|
||||||
} else {
|
} else {
|
||||||
Err("can't create surface for window handle".into())
|
Err("can't create surface for window handle".into())
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,7 +183,7 @@ impl Instance {
|
||||||
mux_match! { self;
|
mux_match! { self;
|
||||||
Instance::Vk(i) => i.device(true).map(Device::Vk),
|
Instance::Vk(i) => i.device(true).map(Device::Vk),
|
||||||
Instance::Dx12(i) => i.device().map(Device::Dx12),
|
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),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue