Two weeks ago I migrated a project from JUCE 6.1.6 to JUCE 7.0.1. Now on MacOS Sierra 10.12.6 with a GeForceGTX 675 Mx, 1024MB a tester recognized that the OpenGL support fails. In Ableton Live 10.1 one instance of our plugin works. When opening a second instance while having both visible, both UIs are no longer being painted but still react to mouse events. When trying to close one of the UIs the host will become unresponsive and must be shut down by “Force Quit”. After disabling OpenGL in our plugin everything works fine again. Switching back to JUCE 6.1.6 works, too.
Now I added an OpenGLContext to the NoiseGateTutorial-Example build with JUCE 7.0.1. The tester added several instances of this modified NoiseGateTutorial-Plugin and the UIs freezes again.
The instance needed to be added by selecting all and duplicating all several times.
JUCE team, is this something you will address very soon? Or will we have to roll back to JUCE 6?
Hi JUCE team, I want to stress this again: JUCE 7 is unusable with OpenGL if old macOS versions matter.
After adding OpenGL to your NoiseGateTutorial example, and adding a couple of instances of it on macOS Sierra 10.12.6, the plugin UI freezes, while it works perfectly fine with JUCE 6.
Is this anything you will address?
Yes, we’re working on it.
Thanks! Do you have any vague timeline? Just asking, because the issue is holding back a plugin update for us… (we could downgrade to JUCE 6 for the time being, but that’d add some extra work).
I have a change that appears to fix the issue, but it involves a significant change to JUCE’s OpenGL threading, so it will require detailed reviewing. The team is very busy at the moment so I can’t make any promises about release timelines. I would hope that the change would be merged in the next fortnight, but that assumes that no further issues are discovered during review/testing.
Thanks for your reply!
The threading update has now been merged:
I’ve only been able to test this change on a remote machine (I don’t have a mac running 10.12 or 10.13), so please test it out yourself and let us know if you discover any new issues.
Thank you so much! We’ll test it next week.
Amazing - we’ve tested it on Sierra 10.12.6 with Live, Cubase and Pro Tools, and it worked all fine!
Nice to see that you added the debug message callback. One thing though.
It continuously triggers an assertion right now. Default context, no custom code.
OpenGL DBG message: Buffer detailed info: Buffer object 1 (bound to GL_ELEMENT_ARRAY_BUFFER_ARB, usage hint is GL_STATIC_DRAW) will use VIDEO memory as the source for buffer object operations.
Useless notification that gets shown on every static draw buffer.
Probably better to only assert on debug messages of
type == GL_DEBUG_TYPE_ERROR
severity == GL_DEBUG_SEVERITY_HIGH
The other types like GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR, can be reported silently with DBG().
This is now fixed on develop:
The problem has occured again in a different guise:
Now I added an OpenGLContext to the NoiseGateTutorial-Example build with JUCE 7.0.4. The tester added several instances of .vst and .vst3 of this modified NoiseGateTutorial-Plugin and the UIs freeze again. The instance needed to be added by selecting all and duplicating all several times.
Using only the same kind of plugin (like only .vst) the problem does not appear. Only the mix provokes the problem.
The tester has this setup:
Ableton Live 10.1, MacOS Sierra 10.12.6 with a GeForceGTX 675 Mx, 1024MB
The tester gave me more insight into the problem:
We develop several plugins. Our tester uses two of them in one Ableton Live session (call them A and B). A and B use OpenGL by attaching an OpenGLContext to the main UI compoment and both are VST2 plugins. Starting A and B and opening their UIs the freeze beginns with no other plugins involved.
Additionally he recognized this:
He starts A and B and the UIs are coming up. Just a moment before the UI-freeze sometimes he sees that the window of plugin A shows content of plugin B with right scaling for plugin A window.
Are A and B definitely both using a recent version of JUCE (7.0.4 or newer)?
Of course both plugins are created with JUCE 7.0.4
Thanks for your patience. It looks like the previous ‘fix’ didn’t go far enough - although multiple instances of the same plugin could coexist, the deadlock will still trigger as soon as a single process tries to swap GL buffers from multiple threads simultaneously. When loading a VST2 and VST3 of the same plugin, each format got its own GL thread, and those threads could end up swapping buffers simultaneously.
I’ve now pushed a change that moves the buffer-swapping onto the main thread for the older, problematic versions of macOS. I’ve tested on macOS10.12 and 10.13, and I don’t see the deadlock any more on those platforms.
Please try updating and let me know if the problem is still present. Note that you might still see issues when running versions of plugins built with an older JUCE version alongside plugins built with the latest version. To avoid deadlocking on older platforms, you’ll need to make sure that all loaded JUCE/OpenGL plugins are using the most recent JUCE version.
Thank your for this clarification! So does this mean that our plugins could result in deadlocks when built with the latest JUCE version and the user is running another plugin from another developer running with an older JUCE 7 version?
And that we won’t run into the deadlocks when we are using JUCE 6?
It depends on your build settings for the JUCE 6 plugins.
The problem described in this thread affects all versions of JUCE (to my knowledge) before this commit that were using layer-backed views. This option could be enabled using the old
JUCE_COREGRAPHICS_DRAW_ASYNC preprocessor flag.
If your JUCE 6 plugins were using this flag, they’ll be affected by this bug. If they weren’t, then I believe they should be safe.
As layer-backed views are the default in JUCE 7, the majority of JUCE 7 plugins using OpenGL are likely to be affected by this bug. Unfortunately, this might make it difficult to coexist with plugins from other manufacturers, until all plugins have been updated.