Reputation: 4627
My app has a few different OpenGL contexts, all using the same set of shaders. At the moment it recompiles, links etc. the shaders multiple times, once for each context. I am trying to speed this up, and came across EAGLSharegroup.
The documentation for EAGLSharegroup says "Currently, the sharegroup manages textures, buffers, framebuffers, and renderbuffers.", but doesn't mention anything about shader and program objects. I'm not sure whether the documentation is out of date, or sharing these objects just doesn't work.
According to an answer on this question, it does work, but I can't find anything else to back that up.
I've tried it and it appears to work on the simulator (haven't tried on a real device yet). Am I experiencing a fluke, or can I rely on this behaviour? I would like to be able to rely on it, but can't find any official documentation that says I can.
Upvotes: 3
Views: 1087
Reputation: 213
It works for me. I compile and link my shader programs on a separate thread, with a separate context. This separate context uses the same sharegroup as my primary context. The shaders work correctly on my main thread using this primary context.
Upvotes: 1
Reputation: 45948
I don't have any iExperience, but if context sharing works like in desktop GL (which I assume), then every resource should be shared, including shaders.
Upvotes: 2