diff --git a/Cargo.lock b/Cargo.lock index 8173bd49f8..2a5202b40f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -995,7 +995,7 @@ dependencies = [ [[package]] name = "metal" version = "0.23.1" -source = "git+https://github.com/gfx-rs/metal-rs?rev=a357159#a35715916fec38bbc08a510ecf7d115edc500c72" +source = "git+https://github.com/gfx-rs/metal-rs?rev=1aaa903#1aaa9033a22b2af7ff8cae2ed412a4733799c3d3" dependencies = [ "bitflags", "block", diff --git a/wgpu-hal/Cargo.toml b/wgpu-hal/Cargo.toml index 3022696a04..714031bbdf 100644 --- a/wgpu-hal/Cargo.toml +++ b/wgpu-hal/Cargo.toml @@ -79,7 +79,7 @@ winapi = { version = "0.3", features = ["libloaderapi", "windef", "winuser", "dc native = { package = "d3d12", git = "https://github.com/gfx-rs/d3d12-rs.git", rev = "ffe5e261da0a6cb85332b82ab310abd2a7e849f6", features = ["libloading"], optional = true } [target.'cfg(any(target_os="macos", target_os="ios"))'.dependencies] -mtl = { package = "metal", git = "https://github.com/gfx-rs/metal-rs", rev = "a357159" } +mtl = { package = "metal", git = "https://github.com/gfx-rs/metal-rs", rev = "1aaa903" } objc = "0.2.5" core-graphics-types = "0.1" diff --git a/wgpu-hal/src/metal/command.rs b/wgpu-hal/src/metal/command.rs index e7a0642b89..77f3cbfb1b 100644 --- a/wgpu-hal/src/metal/command.rs +++ b/wgpu-hal/src/metal/command.rs @@ -39,13 +39,15 @@ impl super::CommandEncoder { } } - fn enter_any(&mut self) -> &mtl::CommandEncoderRef { + fn enter_any(&mut self) -> Option<&mtl::CommandEncoderRef> { if let Some(ref encoder) = self.state.render { - encoder + Some(encoder) } else if let Some(ref encoder) = self.state.compute { - encoder + Some(encoder) + } else if let Some(ref encoder) = self.state.blit { + Some(encoder) } else { - self.enter_blit() + None } } @@ -627,13 +629,23 @@ impl crate::CommandEncoder for super::CommandEncoder { } unsafe fn insert_debug_marker(&mut self, label: &str) { - self.enter_any().insert_debug_signpost(label); + if let Some(encoder) = self.enter_any() { + encoder.insert_debug_signpost(label); + } } unsafe fn begin_debug_marker(&mut self, group_label: &str) { - self.enter_any().push_debug_group(group_label); + if let Some(encoder) = self.enter_any() { + encoder.push_debug_group(group_label); + } else if let Some(ref buf) = self.raw_cmd_buf { + buf.push_debug_group(group_label); + } } unsafe fn end_debug_marker(&mut self) { - self.enter_any().pop_debug_group(); + if let Some(encoder) = self.enter_any() { + encoder.pop_debug_group(); + } else if let Some(ref buf) = self.raw_cmd_buf { + buf.pop_debug_group(); + } } unsafe fn set_render_pipeline(&mut self, pipeline: &super::RenderPipeline) {