gfx: Quad example doesn't work on OS X
$ cargo run --bin quad --features=metal
Produces a grey window and nothing else
Short info header:
- OS: OS X Sierra 10.12.6 (16G29)
- GPU: Intel Iris Graphics 6100 1536 MB
$git log commit 6c3c1d335778fba3333d395f486a8a032805cec6 Merge: f8b74e2 86c5d35 Author: bors[bot] <bors[bot]@users.noreply.github.com> Date: Wed Jan 9 17:45:47 2019 +0000
examples$ cargo run --bin quad --features=metal
Finished dev [unoptimized + debuginfo] target(s) in 0.20s
Running /Users/andrewl/rust/gfx/target/debug/quad
AdapterInfo { name: “Intel® Iris™ Graphics 6100”, vendor: 0, device: 0, device_type: DiscreteGpu }
Memory types: [MemoryType { properties: DEVICE_LOCAL, heap_index: 0 }, MemoryType { properties: COHERENT | CPU_VISIBLE, heap_index: 1 }, MemoryType { properties: DEVICE_LOCAL | CPU_VISIBLE, heap_index: 1 }, MemoryType { properties: DEVICE_LOCAL | CPU_VISIBLE | CPU_CACHED, heap_index: 1 }]
formats: Some([Bgra8Unorm, Bgra8Srgb, Rgba16Float])
SwapchainConfig { present_mode: Fifo, composite_alpha: Inherit, format: Bgra8Srgb, extent: Extent2D { width: 1024, height: 768 }, image_count: 2, image_layers: 1, image_usage: COLOR_ATTACHMENT }
SwapchainConfig { present_mode: Fifo, composite_alpha: Inherit, format: Bgra8Srgb, extent: Extent2D { width: 1024, height: 768 }, image_count: 2, image_layers: 1, image_usage: COLOR_ATTACHMENT }
SwapchainConfig { present_mode: Fifo, composite_alpha: Inherit, format: Bgra8Srgb, extent: Extent2D { width: 1024, height: 768 }, image_count: 2, image_layers: 1, image_usage: COLOR_ATTACHMENT }
SwapchainConfig { present_mode: Fifo, composite_alpha: Inherit, format: Bgra8Srgb, extent: Extent2D { width: 1024, height: 768 }, image_count: 2, image_layers: 1, image_usage: COLOR_ATTACHMENT }
SwapchainConfig { present_mode: Fifo, composite_alpha: Inherit, format: Bgra8Srgb, extent: Extent2D { width: 1024, height: 768 }, image_count: 2, image_layers: 1, image_usage: COLOR_ATTACHMENT }
[lines keep repeating infinitely]
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 33 (19 by maintainers)
Commits related to this issue
- Merge #2619 2619: [mtl] fixed surface size, better presentation debug messages r=grovesNL a=kvark Fixes Dota in portability Also can help with #2563, but some testing is needed to confirm PR chec... — committed to gfx-rs/gfx by bors[bot] 5 years ago
- Merge #2764 #2788 #2834 #2870 2764: Start turning empty backend into basic mock r=kvark a=omni-viral Few types at a time. PR checklist: - [ ] `make` succeeds (on *nix) - [ ] `make reftests` suc... — committed to gfx-rs/gfx by bors[bot] 5 years ago
- Merge #2788 2788: kdebug_signpost* fns don't exist on macOS 10.11 r=kvark a=datadog23 > Fixes #issue Doesn't fix, but found during https://github.com/gfx-rs/gfx/issues/2563 > PR checklist: > - ... — committed to gfx-rs/gfx by bors[bot] 5 years ago
- Merge #2788 2788: kdebug_signpost* fns don't exist on macOS 10.11 r=compiler a=datadog23 > Fixes #issue Doesn't fix, but found during https://github.com/gfx-rs/gfx/issues/2563 > PR checklist: >... — committed to gfx-rs/gfx by bors[bot] 5 years ago
Okay, I had a bit of a chance to look at this over the last couple of nights. Here’s where I’m at/what I’m seeing.
Disclaimer: I’m a bit ignorant to pretty much all things graphics…so…I might be getting all this wrong. 😅
So I traced back through a typical failure from the logs. When we submit a queue we don’t return a
Result
which doesn’t exactly match up tovkQueueSubmit
. This is where the error first manifests itself. Might consider changinggfx_hal::queue::CommandQueue
’ssubmit
method to return aResult
to catch the error sooner?@buzmeg observed
take_drawable
failing, but I believe this is operating as designed. If there’s no drawable to take then it should bail out. I thinkNone
is always an error because the fence should prevent the race described. I haven’t fully traced that, so take with a grain of salt, but my next observation I think further solidifies this for me.I opened with the initial error happening during queue submission. During queue submission the trace is:
During
next_frame
we’re iterating over the fames in the swapchain looking for a texture received from the call to Metal’stexture
based off the drawable we get on the line above. If we break there we can inspect the swapchain’s frames and the texture we received from thetexture
call to the drawable.Note: I’ve removed everything from the frame except the frame’s texture to make it easier to parse.
As you can tell the texture isn’t anywhere in the swapchain’s frames, and since they don’t match we (silently) fail and move on to presentation. Since we never had a chance to set the drawable of the frame
take_drawable
is going to fail which results in swapchain recreation and the missed render.Interestingly when I inspect this with Xcode’s profiler (just found this, and wowah it’s pretty cool) I see this strange
empty
call to Metal just before every swapchain recreation.So the question I’m asking myself now is, “Why are these textures different?” So I’ll continue from there unless someone has any insights on if I’m mistaken or know the issue given my observations.
@kvark Yeah, I can check – My renderer is a side project for me so I won’t be able to dedicate a normal amount of time to it. I will look into the root cause and see if I can drum something up when I’m working on this. (Mostly nights/weekends)
Re: wgpu-rs examples – they appear to be working as expected. Frame-rate of
shadow
does not look like it’s recreating the swapchain every 3rd frames, and I don’t see any output. Haven’t examined the code, but I’ll look at that tonight.For signposts, the easiest way to proceed would be covering all of them in a new feature (
#[cfg(feature = "signpost")]
that is not default but enabled on CI.Mstange has 10.12
On Thu, Mar 21, 2019, 10:46 PM Dzmitry Malyshau notifications@github.com wrote: