Skip to content

[metal] Use raw-window-metal to do layer creation #6210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Draft
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
3 changes: 3 additions & 0 deletions .deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ skip-tree = [
{ name = "bit-set", version = "0.5.3" },
{ name = "bit-vec", version = "0.6.3" },
{ name = "capacity_builder", version = "0.1.3" },

# Winit 0.30 uses an older objc2
{ name = "objc2-foundation", version = "0.2" },
]
skip = [
# criterion uses an old version
Expand Down
103 changes: 85 additions & 18 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ metal = "0.32.0"
block = "0.1.6"
core-graphics-types = "0.2"
objc = "0.2.5"
raw-window-metal = "1.0"

# Vulkan dependencies
android_system_properties = "0.1.1"
Expand Down
2 changes: 0 additions & 2 deletions examples/features/src/framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,6 @@ async fn start<E: Example>(title: &str) {
&context.device,
&context.queue,
);

window_loop.window.request_redraw();
}
WindowEvent::KeyboardInput {
event:
Expand Down
2 changes: 0 additions & 2 deletions examples/features/src/hello_triangle/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ async fn run(event_loop: EventLoop<()>, window: Window) {
config.width = new_size.width.max(1);
config.height = new_size.height.max(1);
surface.configure(&device, &config);
// On macos the window needs to be redrawn manually after resizing
window.request_redraw();
}
WindowEvent::RedrawRequested => {
let frame = surface
Expand Down
2 changes: 0 additions & 2 deletions examples/features/src/hello_windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ async fn run(event_loop: EventLoop<()>, viewports: Vec<(Arc<Window>, wgpu::Color
// Recreate the swap chain with the new size
if let Some(viewport) = viewports.get_mut(&window_id) {
viewport.resize(&device, new_size);
// On macos the window needs to be redrawn manually after resizing
viewport.desc.window.request_redraw();
}
}
WindowEvent::RedrawRequested => {
Expand Down
2 changes: 0 additions & 2 deletions examples/features/src/uniform_values/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ impl WgpuContext {
self.surface_config.width = new_size.width;
self.surface_config.height = new_size.height;
self.surface.configure(&self.device, &self.surface_config);
self.window.request_redraw();
}
}

Expand Down Expand Up @@ -278,7 +277,6 @@ async fn run(event_loop: EventLoop<()>, window: Arc<Window>) {
WindowEvent::Resized(new_size) => {
let wgpu_context_mut = wgpu_context.as_mut().unwrap();
wgpu_context_mut.resize(new_size);
wgpu_context_mut.window.request_redraw();
}
WindowEvent::RedrawRequested => {
let wgpu_context_ref = wgpu_context.as_ref().unwrap();
Expand Down
7 changes: 6 additions & 1 deletion wgpu-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ unexpected_cfgs = { level = "warn", check-cfg = [
# exclude the Vulkan backend on MacOS unless a separate feature `vulkan-portability` is enabled. In response
# to these features, it enables features of platform specific crates. For example, the `vulkan` feature in wgpu-core
# enables the `vulkan` feature in `wgpu-core-deps-windows-linux-android` which in turn enables the
# `vulkan` feature in `wgpu-hal` _only_ on those platforms. If you enable the `vulkan-portability` feature, it
# `vulkan` feature in `wgpu-hal` _only_ on those platforms. If you enable the `vulkan-portability` feature, it
# will enable the `vulkan` feature in `wgpu-core-deps-apple`. The only way to do this is unfortunately to have
# a separate crate for each platform category that participates in the feature unification.
#
Expand All @@ -82,6 +82,7 @@ metal = [
"dep:metal",
"dep:objc",
"dep:profiling",
"dep:raw-window-metal",
]
vulkan = [
"naga/spv-out",
Expand All @@ -97,6 +98,7 @@ vulkan = [
"dep:log",
"dep:ordered-float",
"dep:profiling",
"dep:raw-window-metal",
"dep:smallvec",
"dep:windows",
"windows/Win32",
Expand Down Expand Up @@ -274,6 +276,9 @@ core-graphics-types = { workspace = true, optional = true }
metal = { workspace = true, optional = true }
objc = { workspace = true, optional = true }

# backend: Metal + Vulkan
raw-window-metal = { workspace = true, optional = true }

#########################
### Platform: Android ###
#########################
Expand Down
Loading
Loading