mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 08:13:27 +00:00
[Metal] Add a way to create a device and queue from raw resources in wgpu-hal (#3338)
This commit is contained in:
parent
1e27fd4afb
commit
2562f323bb
@ -269,6 +269,9 @@ By @jimblandy in [#3254](https://github.com/gfx-rs/wgpu/pull/3254).
|
||||
- Add `MULTISAMPLE_X2`, `MULTISAMPLE_X4` and `MULTISAMPLE_X8` to `TextureFormatFeatureFlags`. By @39ali in [3140](https://github.com/gfx-rs/wgpu/pull/3140)
|
||||
- Sync `TextureFormat.describe` with the spec. By @teoxoy in [3312](https://github.com/gfx-rs/wgpu/pull/3312)
|
||||
|
||||
#### Metal
|
||||
- Add a way to create `Device` and `Queue` from raw Metal resources in wgpu-hal. By @AdrianEddy in [#3338](https://github.com/gfx-rs/wgpu/pull/3338)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
#### General
|
||||
|
@ -219,6 +219,13 @@ impl super::Device {
|
||||
}
|
||||
}
|
||||
|
||||
pub unsafe fn device_from_raw(raw: mtl::Device, features: wgt::Features) -> super::Device {
|
||||
super::Device {
|
||||
shared: Arc::new(super::AdapterShared::new(raw)),
|
||||
features,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn raw_device(&self) -> &Mutex<mtl::Device> {
|
||||
&self.shared.device
|
||||
}
|
||||
|
@ -286,6 +286,13 @@ pub struct Queue {
|
||||
unsafe impl Send for Queue {}
|
||||
unsafe impl Sync for Queue {}
|
||||
|
||||
impl Queue {
|
||||
pub unsafe fn queue_from_raw(raw: mtl::CommandQueue) -> Self {
|
||||
Self {
|
||||
raw: Arc::new(Mutex::new(raw)),
|
||||
}
|
||||
}
|
||||
}
|
||||
pub struct Device {
|
||||
shared: Arc<AdapterShared>,
|
||||
features: wgt::Features,
|
||||
|
Loading…
Reference in New Issue
Block a user