Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ Bottom level categories:

- Allow parsing shaders which make use of `SPV_KHR_non_semantic_info` for debug info. Also removes `naga::front::spv::SUPPORTED_EXT_SETS`. By @inner-daemons in #8827.

### Changes

#### Metal

- Use autogenerated `objc2` bindings internally, which should resolve a lot of leaks and unsoundness. By @madsmtm in [#5641](https://github.com/gfx-rs/wgpu/pull/5641).

### Bug Fixes

#### General
Expand Down
92 changes: 22 additions & 70 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 53 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,59 @@ which = "8"
xshell = "0.2.2"

# Metal dependencies
metal = "0.33"
block = "0.1.6"
core-graphics-types = "0.2"
objc = "0.2.5"
block2 = "0.6.2"
objc2 = "0.6.3"
objc2-core-foundation = { version = "0.3.2", default-features = false, features = [
"std",
"CFCGTypes",
] }
objc2-foundation = { version = "0.3.2", default-features = false, features = [
"std",
"NSError",
"NSProcessInfo",
"NSRange",
"NSString",
] }
objc2-metal = { version = "0.3.2", default-features = false, features = [
"std",
"block2",
"MTLAllocation",
"MTLBlitCommandEncoder",
"MTLBlitPass",
"MTLBuffer",
"MTLCaptureManager",
"MTLCaptureScope",
"MTLCommandBuffer",
"MTLCommandEncoder",
"MTLCommandQueue",
"MTLComputeCommandEncoder",
"MTLComputePass",
"MTLComputePipeline",
"MTLCounters",
"MTLDepthStencil",
"MTLDevice",
"MTLDrawable",
"MTLEvent",
"MTLLibrary",
"MTLPipeline",
"MTLPixelFormat",
"MTLRenderCommandEncoder",
"MTLRenderPass",
"MTLRenderPipeline",
"MTLResource",
"MTLSampler",
"MTLStageInputOutputDescriptor",
"MTLTexture",
"MTLTypes",
"MTLVertexDescriptor",
] }
objc2-quartz-core = { version = "0.3.2", default-features = false, features = [
"std",
"objc2-core-foundation",
"CALayer",
"CAMetalLayer",
"objc2-metal",
] }
raw-window-metal = "1.0"

# Vulkan dependencies
Expand Down
29 changes: 16 additions & 13 deletions wgpu-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ rust-version = "1.82.0"
[package.metadata.docs.rs]
# Ideally we would enable all the features.
#
# However, the metal features fail to be documented because the docs.rs runner cross-compiling under
# x86_64-unknown-linux-gnu and metal-rs cannot compile in that environment at the moment. The same applies
# for the dx12 feature.
features = ["vulkan", "gles", "renderdoc"]
# However, the dx12 features fail to be documented because the docs.rs runner cross-compiling under
# x86_64-unknown-linux-gnu cannot compile in that environment at the moment.
features = ["metal", "vulkan", "gles", "renderdoc"]
rustdoc-args = ["--cfg", "docsrs"]
targets = [
"x86_64-unknown-linux-gnu",
Expand Down Expand Up @@ -75,13 +74,15 @@ metal = [
# Metal is only available on Apple platforms, therefore request MSL output also only if we target an Apple platform.
"naga/msl-out",
"dep:arrayvec",
"dep:block",
"dep:core-graphics-types",
"dep:block2",
"dep:hashbrown",
"dep:libc",
"dep:log",
"dep:metal",
"dep:objc",
"dep:objc2",
"dep:objc2-core-foundation",
"dep:objc2-foundation",
"dep:objc2-metal",
"dep:objc2-quartz-core",
"dep:parking_lot",
"dep:profiling",
"dep:smallvec",
Expand Down Expand Up @@ -120,7 +121,7 @@ gles = [
"dep:libloading",
"dep:log",
"dep:ndk-sys",
"dep:objc",
"dep:objc2",
"dep:parking_lot",
"dep:profiling",
"dep:wasm-bindgen",
Expand Down Expand Up @@ -281,10 +282,12 @@ mach-dxcompiler-rs = { workspace = true, optional = true }

[target.'cfg(target_vendor = "apple")'.dependencies]
# Backend: Metal
block = { workspace = true, optional = true }
core-graphics-types = { workspace = true, optional = true }
metal = { workspace = true, optional = true }
objc = { workspace = true, optional = true }
block2 = { workspace = true, optional = true }
objc2 = { workspace = true, optional = true }
objc2-core-foundation = { workspace = true, optional = true }
objc2-foundation = { workspace = true, optional = true }
objc2-metal = { workspace = true, optional = true }
objc2-quartz-core = { workspace = true, optional = true }

# backend: Metal + Vulkan
raw-window-metal = { workspace = true, optional = true }
Expand Down
7 changes: 4 additions & 3 deletions wgpu-hal/src/gles/egl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1253,10 +1253,11 @@ impl crate::Surface for Surface {
let window_ptr = handle.ns_view.as_ptr();
#[cfg(target_os = "macos")]
let window_ptr = {
use objc::{msg_send, runtime::Object, sel, sel_impl};
use objc2::msg_send;
use objc2::runtime::AnyObject;
// ns_view always have a layer and don't need to verify that it exists.
let layer: *mut Object =
msg_send![handle.ns_view.as_ptr().cast::<Object>(), layer];
let layer: *mut AnyObject =
msg_send![handle.ns_view.as_ptr().cast::<AnyObject>(), layer];
layer.cast::<ffi::c_void>()
};
window_ptr
Expand Down
Loading
Loading