I'm writing a shader editor for mobile devices, but since mobile devices are generally slow as shit, it needs some mechanism for gracefully handling the compilation and rendering complex shaders on a background thread, without slowing the rest of the app. In Juce the OpenGLRenderer spins up a new thread already, but if for example I try to compile a super complex shader, the whole app freezes. How can I deal with this? Do I need to create a separate context, share it with the original one, then compile the shader on the new one on a separate thread?
This also applies to the rendering. If the shader it too complex, the whole app slows down. I'd like to somehow throttle the shader render thread so that it doesn't harm the UI, even if that means slower shader rendering. Anything to keep the app responsive at all cost.
Any hints would be most appreciated.