# JUCE 7: Trying to use JUCE\_COREGRAPHICS\_RENDER\_WITH\_MULTIPLE\_PAINT\_CALLS=1

**URL:** <https://forum.juce.com/t/juce-7-trying-to-use-juce-coregraphics-render-with-multiple-paint-calls-1/52142>\
**Category:** MacOSX and iOS\
**Created:** [July 8, 2022, 10:08pm UTC](https://forum.juce.com/t/juce-7-trying-to-use-juce-coregraphics-render-with-multiple-paint-calls-1/52142 "2022-07-08T22:08:47Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![stephenk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/stephenk/32/15198_2.png) [@stephenk](https://forum.juce.com/u/stephenk)\
**Post date:** [July 8, 2022, 10:08pm UTC](https://forum.juce.com/t/juce-7-trying-to-use-juce-coregraphics-render-with-multiple-paint-calls-1/52142/1 "2022-07-08T22:08:47Z")

</div>

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**

 ![menu2](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/e/ea272b0fae94d05087fd58320c0bc71740d6e819.png)

**JUCE\_COREGRAPHICS\_RENDER\_WITH\_MULTIPLE\_PAINT\_CALLS=0 (normal)**

 ![menu1](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/7/75ce6649e42d1ac8c3992df613759a8082a877fe.png)

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [July 12, 2022, 10:26am UTC](https://forum.juce.com/t/juce-7-trying-to-use-juce-coregraphics-render-with-multiple-paint-calls-1/52142/2 "2022-07-12T10:26:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stephenk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/stephenk/32/15198_2.png) [@stephenk](https://forum.juce.com/u/stephenk)\
**Post date:** [July 12, 2022, 7:46pm UTC](https://forum.juce.com/t/juce-7-trying-to-use-juce-coregraphics-render-with-multiple-paint-calls-1/52142/3 "2022-07-12T19:46:57Z")

</div>

@t0m - here you go:

[MetalMenuTest.zip](https://forum.juce.com/uploads/short-url/7zDlBQELCBeRVkCBDYVJZvoB3TX.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:

 ![menu3](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/a/a01aed427765dd71e30208856205a551890aea67.png)

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:

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

```

Thanks for looking into this.

---

<div class="post-metadata">

**Author:** ![ArborealAudio](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@ArborealAudio](https://forum.juce.com/u/ArborealAudio)\
**Post date:** [July 12, 2022, 11:36pm UTC](https://forum.juce.com/t/juce-7-trying-to-use-juce-coregraphics-render-with-multiple-paint-calls-1/52142/4 "2022-07-12T23:36:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [July 14, 2022, 9:28am UTC](https://forum.juce.com/t/juce-7-trying-to-use-juce-coregraphics-render-with-multiple-paint-calls-1/52142/5 "2022-07-14T09:28:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stephenk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/stephenk/32/15198_2.png) [@stephenk](https://forum.juce.com/u/stephenk)\
**Post date:** [July 14, 2022, 1:32pm UTC](https://forum.juce.com/t/juce-7-trying-to-use-juce-coregraphics-render-with-multiple-paint-calls-1/52142/6 "2022-07-14T13:32:52Z")

</div>

Thanks, Tom.

---

<div class="post-metadata">

**Author:** ![stephenk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/stephenk/32/15198_2.png) [@stephenk](https://forum.juce.com/u/stephenk)\
**Post date:** [August 5, 2022, 2:58am UTC](https://forum.juce.com/t/juce-7-trying-to-use-juce-coregraphics-render-with-multiple-paint-calls-1/52142/7 "2022-08-05T02:58:54Z")

</div>

Any update on this? Thanks!

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [August 5, 2022, 7:42am UTC](https://forum.juce.com/t/juce-7-trying-to-use-juce-coregraphics-render-with-multiple-paint-calls-1/52142/8 "2022-08-05T07:42:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [August 5, 2022, 2:52pm UTC](https://forum.juce.com/t/juce-7-trying-to-use-juce-coregraphics-render-with-multiple-paint-calls-1/52142/9 "2022-08-05T14:52:09Z")

</div>

> <https://github.com/juce-framework/JUCE/commit/61fd8827e17fb22190e260c2091c0460fbecfb05>
