JUCE7 CGMetalLayerRenderer asserts on resize

I’ve tried to run a project with the newer metal based CG.

With the following:

JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS

I can easily reproduce the following assert once in a while during window resizing.

[MTLDebugTexture setPurgeableState:]:704: failed assertion `Set Purgeable Stage Validation
Cannot set purgeability state to volatile while resource is in use by a command buffer.

Happens on TextureDeleter struct.

This is with MBP M1 Pro.

I’ll try to reproduce with the demo projects and update once/if I’m able also to see same behaviour with JUCE examples.

Ok, I’m able to reproduce this also with the AudioDemoPlugin.

I guess it’s related to some component hierarchy since AnimationDemo won’t reproduce this.

It’s indeed only reproduced with JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS turned on.

1 Like

Is this in standalone or in a host? If the latter, which host and plug-in format?

I’m reproducing this in the standalone build of the AudioDemoPlugin (wrapping to a standalone app/running directly from xcode and just resizing) with the multiple paint calls. (only with it turned it)

Thank you. I’ve reproduced the problem.

2 Likes

Hi thanks for looking at this.
Even with this commit:

The AudioDemoPlugin now does not reproduce the issue but my project does.
Do you have any idea how I can debug this better on my end?

The MTLTexture object doesn’t give me much hints and the stack seems to be now the same as it was (but only happens in my project) instead of the sample plugin.

While my code is fully open-source, it has a lot of component layers stacked on each other so it might explain why I’m still able to reproduce this and also why it might be wiser to make a smaller example for reproducing this.

We have a fix being testing at the moment. If all goes well it should be available today or tomorrow.

1 Like

Thank you for reporting.

1 Like

Thanks. this indeed fix it also in my scenario.