CALayer bounds updated ahead of NSWindow frame when rendered to from separate thread
Originator: | torarnv | ||
Number: | rdar://41517629 | Date Originated: | June 27 2018 |
Status: | Open | Resolved: | |
Product: | macOS + SDK | Product Version: | 10.13 |
Classification: | Bug | Reproducible: | Always |
Area: Core Graphics Summary: When enabling layer-backed mode for a NSOpenGLView, and rendering to it from a separate thread, eg. a display-link callback, you may end up in a situation where during window resize the CALayer bounds seem to be updated ahead of the NSWindow frame: https://www.youtube.com/watch?v=vqwgtxCqvx4 Steps to Reproduce: 1. Download https://developer.apple.com/library/archive/samplecode/GLEssentials 2. Add to awakeFromNib: self.wantsLayer = YES; self.layer.borderColor = [NSColor cyanColor].CGColor; self.layer.borderWidth = 1; Expected Results: Resizing the window behaves the same as with non-layer-backed mode; the layer follows the window frame. Actual Results: The layer bounds are updated ahead of the window frame. Version/Build: macOS 10.13.4
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
Using NSScreenDisableUpdates as a workaround is possible, but windowWillResize: is not a good enough signal
https://codereview.qt-project.org/#/c/252659/
Minimal testcase
https://gist.github.com/torarnv/077591297538a955bd24500102eac834