JUCE 7: Trying to use JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS=1

I have some audio meter displays (refreshing on Timers) that are causing large unnecessary rects to be repainted (on Mac). So I wanted to try the JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS to see if it provided any benefit.

Mac 10.14.6 Mojave.
JUCE 7.0.0

According to the release notes for JUCE 7, this should be within the specs for using this feature.

Projucer MacOS DeploymentTarget = default - does this matter? (I tried setting it to 10.14; didn’t make a difference).

So I added JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS=1 to my Preprocessor definitions in my Projucer Project, and tried it.

It does indeed use less CPU when it is displaying the meters. However, all of my ComboBox popup menus are whacked, like this:

JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS=1

JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS=0 (normal)

Can you reproduce the issue in any of the projects bundled with JUCE? Otherwise, can you provide a minimal project that displays the behaviour?

@t0m - here you go:

MetalMenuTest.zip (12.0 KB)

It’s related to scaling the enclosing component with an AffineTransform. The example has a comboBox that sets the scaling of the component that it lives inside. At 100%, the popup is normal. At other magnifications, the popup is whacked:

I’m also managing to hit an assert (Line #93 juce_mac_CGMetalRendered.cpp drawRectangleList() ) while playing around with this, although not consistently and I’m not sure what triggers it. Usually when clicking on the comboBox shortly after launch:

         if (gpuTexture == nullptr)
        {
            jassertfalse;
            return false;
        }

Thanks for looking into this.

1 Like

I’ve also had issues both with ComboBox resizing and the gpuTexture assert (usually when the UI is closed) but I was too shy to post anything…

Using an M1 Mac running Monterey 12.4 for reference.

1 Like

We’re looking at this, but it’s peak holiday season in the JUCE team so things are much slower than usual.

1 Like

Thanks, Tom.

Any update on this? Thanks!

We have a fix lined up, it’s just waiting for review and testing. It should be public either later today or Monday.

1 Like