Skip to content

Commit f1b371e

Browse files
committed
Use objc2
1 parent 9eb1b71 commit f1b371e

File tree

11 files changed

+1144
-1003
lines changed

11 files changed

+1144
-1003
lines changed

Cargo.lock

Lines changed: 66 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,13 @@ termcolor = "1.4.1"
187187
#web-sys = { path = "../wasm-bindgen/crates/web-sys" }
188188
#js-sys = { path = "../wasm-bindgen/crates/js-sys" }
189189
#wasm-bindgen = { path = "../wasm-bindgen" }
190+
block2 = { git = "https://github.com/madsmtm/objc2", branch = "metal-wgpu" }
191+
objc2 = { git = "https://github.com/madsmtm/objc2", branch = "metal-wgpu" }
192+
objc2-encode = { git = "https://github.com/madsmtm/objc2", branch = "metal-wgpu" }
193+
objc-sys = { git = "https://github.com/madsmtm/objc2", branch = "metal-wgpu" }
194+
objc2-foundation = { git = "https://github.com/madsmtm/objc2", branch = "metal-wgpu" }
195+
objc2-quartz-core = { git = "https://github.com/madsmtm/objc2", branch = "metal-wgpu" }
196+
objc2-metal = { git = "https://github.com/madsmtm/objc2", branch = "metal-wgpu" }
190197

191198
# Speed up image comparison even in debug builds
192199
[profile.dev.package."nv-flip-sys"]

wgpu-hal/Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ targets = [
3434

3535
[features]
3636
default = ["link"]
37-
metal = ["naga/msl-out", "block"]
37+
metal = ["naga/msl-out"]
3838
vulkan = [
3939
"naga/spv-out",
4040
"ash",
@@ -70,7 +70,7 @@ windows_rs = ["gpu-allocator"]
7070
dxc_shader_compiler = ["hassle-rs"]
7171
renderdoc = ["libloading", "renderdoc-sys"]
7272
fragile-send-sync-non-atomic-wasm = ["wgt/fragile-send-sync-non-atomic-wasm"]
73-
link = ["metal/link"]
73+
link = []
7474
# Panic when running into an out-of-memory error (for debugging purposes).
7575
#
7676
# Only affects the d3d12 and vulkan backends.
@@ -151,13 +151,13 @@ d3d12 = { path = "../d3d12/", version = "0.19.0", optional = true, features = [
151151
"libloading",
152152
] }
153153

154-
[target.'cfg(any(target_os="macos", target_os="ios"))'.dependencies]
155154
# backend: Metal
156-
block = { version = "0.1", optional = true }
157-
158-
metal = { version = "0.27.0", git = "https://github.com/gfx-rs/metal-rs", rev = "ff8fd3d6dc7792852f8a015458d7e6d42d7fb352" }
159-
objc = "0.2.5"
160-
core-graphics-types = "0.1"
155+
[target.'cfg(any(target_os="macos", target_os="ios"))'.dependencies]
156+
objc2 = "0.5.1"
157+
objc2-foundation = { version = "0.2.0", features = ["all"] }
158+
objc2-quartz-core = { version = "0.2.0", features = ["all"] }
159+
objc2-metal = { version = "0.2.0", features = ["all"] }
160+
block2 = "0.5"
161161

162162
[target.'cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))'.dependencies]
163163
wasm-bindgen = "0.2.87"

wgpu-hal/src/gles/egl.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,10 +1245,11 @@ impl crate::Surface for Surface {
12451245
let window_ptr = handle.ns_view.as_ptr();
12461246
#[cfg(target_os = "macos")]
12471247
let window_ptr = {
1248-
use objc::{msg_send, runtime::Object, sel, sel_impl};
1248+
use objc2::msg_send;
1249+
use objc2::runtime::AnyObject;
12491250
// ns_view always have a layer and don't need to verify that it exists.
1250-
let layer: *mut Object =
1251-
msg_send![handle.ns_view.as_ptr() as *mut Object, layer];
1251+
let layer: *mut AnyObject =
1252+
msg_send![handle.ns_view.as_ptr() as *mut AnyObject, layer];
12521253
layer as *mut ffi::c_void
12531254
};
12541255
window_ptr

0 commit comments

Comments
 (0)