Home > Back-end >  How do I disable Core Animation compositor in my Metal iOS (iPadOS) App
How do I disable Core Animation compositor in my Metal iOS (iPadOS) App

Time:07-13

I have 3 questions relating to something from Apple WWDC 2015, more precisely Session 610, "Metal performance optimisation techniques", slide 125 (or minute 33:56 in the video), to be found at WWDC 2015, Session 610, Metal performance optimization techniques (slide 125, Drawable Surfaces)

It says there about the drawables (CAMetalDrawable) that they may be used by (3rd bullet) "Core Animation (IF COMPOSITING ENABLED)".

So "if compositing enabled" is a thing, that suggests that the compositor can be DISABLED as well (?).

I want to see if it makes sense for me to disable the compositor in my App for performance reasons. My App is an iOS (iPadOS actually) Metal (Swift) App and I want to control the entire* screen. Indeed, I have just one single view in the entire App, an MTKView, which covers the entire screen at all times).

*If the device uses split mode in multitasking (so the screen is shared between mine and another App), I of course only control my 'half' of the screen.

My questions:

  1. How can I DISABLE the compositor?

  2. About the 'status bar' in the top of the screen (with time, data, battery icons): Is it a necessary condition to hide it to achieve the DISABLING of the compositor? Or what do I have to do about it in case it affects the disabling?

  3. If the device uses split mode in multitasking, the compositor can not be disabled or can it?

Any pointers to (Apple) documentation about this topic would also be useful!

Thank you very much for help!

CodePudding user response:

The compositor is there to basically compose different screen elements from OS and different applications together, while maintaining color management, HDR, all that jazz. The only time you don't need the compositor is when you are "fullscreen", meaning that you have a layer that's fullscreen.

CAMetalLayer can have two "modes": direct and composited. Direct means that display hardware basically takes whatever you wrote into the texture and shows it on screen. Composited means that compositor uses the drawable to "composite" it into a bigger full screen view. You can see which mode the CAMetalLayer is in by using Metal HUD in Xcode 14 beta.

With that said,

  1. You can't disable the compositor. The OS decides if the CAMetalLayer you have is direct
  2. I'm not sure, but it probably is. Status bar is drawn by other parts of OS so it would need to get the output from status bar and your app into a single picture, which is compositing.
  3. Same here.
  • Related