-
Notifications
You must be signed in to change notification settings - Fork 501
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
macOS Metal: validation layer error about MTKView texture lifetime when app window is obscured #762
Comments
...it works when using the vanilla Maybe MTKView expects that a command buffer with 'retained references' is used, and otherwise the lifetime management gets messed up? Does MTKView have a configurable 'pipeline depth'? |
...in any case, sokol_gfx.h should probably have a config flag for whether |
Random thought: maybe use two command buffers? One with unretained references for 'regular rendering', and one with retained references for commands that use swapchain resources.That way the swapchain textures would be kept alive for as long as needed, but regular commands wouldn't have the refcounting overhead... |
Some things to try out via Twitter (https://twitter.com/Alecazam123/status/1603445616234745856)
|
Creates a second command buffer with retained references which only holds the presentDrawable command and is enqueued after the regular command buffer (which uses unretained references). This makes sure that the drawable remains alive as long as needed by the external swapchain implementation. Fixes a (new?) Metal validation layer error which happens when the app window becomes fully obscured. See #762 for details.
Ok, sokol_gfx.h now uses a second MTLCommandBuffer created with retained references which only holds the presentDrawable command and which is scheduled after the regular command buffer (which still uses unretained references). This appears to fix the problem. Fix is in commit: 9cba653 |
Repro:
After a little while (sometimes under 1 second, sometimes longer) the sample crashes inside
[MTKView currentRenderPassDescriptor]
(called from within_sg_mtl_begin_pass
) with a Metal validation layer error (see below).More details:
The text was updated successfully, but these errors were encountered: