Search code examples
macoscocoaopenglcore-animation

poor performance using layer-backed NSOpenGLView


I'm updating my OS X app to use layer-backed views, so I can have Cocoa views on top of my OpenGL rendering (I haven't added any Cocoa views yet). Without layers, I get 60fps. With layers, less than 15fps. My iOS version, where everything is layer-backed, gets 60fps.

I enabled layer backing thusly:

Interface Builder CA Layers

I also had to set the layer's background color to black to avoid bad compositing (I use OpenGL blending, so the final alpha values in the buffer aren't correct for CA compositing).

According to Instruments, most of the rendering time is spent in CA::Transaction::commit:

Profile

I tried clearing the alpha channel as recommended here, but this seems to be just an alternative to setting the layer's background color to black.

FWIW, here are the settings for my OpenGL view:

Settings

I'm on OS X 10.10 Yosemite.


Solution

  • According to posts on the Apple developer forums, this appears to be a bug in OS X 10.10.