问题
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:
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:
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:
I'm on OS X 10.10 Yosemite.
回答1:
According to posts on the Apple developer forums, this appears to be a bug in OS X 10.10.
来源:https://stackoverflow.com/questions/27464133/poor-performance-using-layer-backed-nsopenglview