Performance issues with Core Graphics

A user interface toolkit mainly for audio plug-ins (VST, AudioUnit, etc).
bx_joscha
Posts: 25
Joined: Thu Aug 24, 2017 6:21 am

Performance issues with Core Graphics

Postby bx_joscha » Thu Jun 14, 2018 5:59 am

Hello,

since we have updated our VSTGUI code to version 4.6, we encounter massive performance problems on MacOS, also in Cubase. Using the Xcode Graphics Tool Quartz Debug, one can see that all plugins with meters get redrawn completely each frame. Of course, the meters need to get redrawn, but now also the whole frame gets redrawn redundantly. This was not the case with VSTGUI 4.3, which we use for our currently released products.

My problem is that I am having trouble nailing down the problem. Did anyone of you see similar effects using the latest VSTGUI code state?

Regards,

Joscha

bx_joscha
Posts: 25
Joined: Thu Aug 24, 2017 6:21 am

Re: Performance issues with Core Graphics

Postby bx_joscha » Thu Jun 14, 2018 9:37 am

This bug is also reproducible by adjusting a single CControl, for example CKnob. While adjusting a CKnob, the whole window gets redrawn, redundantly.

Arne Scheffler
Posts: 174
Joined: Mon Jun 20, 2016 7:53 am

Re: Performance issues with Core Graphics

Postby Arne Scheffler » Thu Jun 14, 2018 11:46 am

Hi Joscha,
first of all the Quartz Debug tool does not work any longer correctly. It does not show the dirty rectangles which gets redrawn since we render into a CALayer. The switch to CALayer showed significant better performance here, but maybe your use-case is different. You can try to turn off using the CALayer code path and see if it is the reason of your performance problem. Fastest way is to disable the following code in nsviewframe.mm:

Code: Select all

   auto processInfo = [NSProcessInfo processInfo];
   if ([processInfo respondsToSelector:@selector(operatingSystemVersion)])
   {
      auto systemVersion = processInfo.operatingSystemVersion;
      // on Mac OS X 10.11 we activate layer drawing as this fixes a few issues like that only a
      // few parts of a window are updated permanently when scrolling or manipulating a control
      // while other parts are only updated when the malipulation ended, or CNinePartTiledBitmap
      // are drawn incorrectly when scaled.
      if (systemVersion.majorVersion >= 10 && systemVersion.minorVersion > 10)
      {
         [nsView setWantsLayer:YES];
      }
   }



Cheers,
Arne

bx_joscha
Posts: 25
Joined: Thu Aug 24, 2017 6:21 am

Re: Performance issues with Core Graphics

Postby bx_joscha » Fri Jun 15, 2018 5:57 am

Thank you so much, Arne, for your quick reply. This is exactly the code that causes the performance issues. Deleting these lines fixes our bugs. By the way, are you really sure Quartz Debug is not working correctly? I currently assume that it perfectly reveals the problem of the code lines. Our use-case is creating audio plugins for Cubase, etc. We are doing nothing special.

Arne Scheffler
Posts: 174
Joined: Mon Jun 20, 2016 7:53 am

Re: Performance issues with Core Graphics

Postby Arne Scheffler » Fri Jun 15, 2018 7:26 am

Hi,
yes I'm sure that Quartz Debug does not work any longer when using a CALayer.
By the way, you should find a way to make your UI work with the CALayer stuff as this is the way to go. The next macOS version will implicitly set the layer to be active.
On what macOS version did you see this performance issue ?

Cheers,
Arne

bx_joscha
Posts: 25
Joined: Thu Aug 24, 2017 6:21 am

Re: Performance issues with Core Graphics

Postby bx_joscha » Fri Jun 15, 2018 7:28 am

High Sierra.

bx_joscha
Posts: 25
Joined: Thu Aug 24, 2017 6:21 am

Re: Performance issues with Core Graphics

Postby bx_joscha » Fri Jun 15, 2018 7:41 am

This whole thing is really interesting and a strange situation. A few years ago, we discussed that VSTGUI might need a code like that. We thought that using CALayer is the way to go. We encountered massive performance problems. Then, Apple announced a major MacOS UI framework rework that fixed our problems. When I debugged our plugins I could see that Apple managed to move our VSTGUI-based UI's on Core Animation. That was a good thing for our performance. It is really strange and I do not understand, why your code causes this trouble. As you already mentioned, Apple managed to activate CALayer for all UI's, so it should not make any trouble to "want a layer". But anyway, we see a drastic performance lack for large-scale UI's such as bx_console N (https://www.plugin-alliance.com/en/products/bx_console_n.html).


Return to “VSTGUI”

Who is online

Users browsing this forum: No registered users and 0 guests