EGL/OpenGL ES/switching context is slow -
i developing opengl es 2.0 application (using angleproject on windows developement) made of multiple 'frames'.
each frame isolated application should not interfere surrounding frames. frames drawn using opengl es 2.0, code running inside of frame.
my first attempt assign frame buffer each frame. there problem - opengl's internal states changed while 1 frame drawing, , if next frame doesn't comprehensively reset every known opengl state, there possible side effects. defeats requirement each frame should isolated , not affect 1 another.
my next attempt use context per frame. created unique context each frame. i'm using sharing resources, can eglmakecurrent each frame, render each own frame buffer/texture, eglmakecurrent globally, compose each texture final screen.
this great job @ isolating instances, however.. eglmakecurrent very slow. little 4 of them can make take second or more render screen.
what approach can take? there way can either speed context switching, or avoid context switching somehow saving opengl state per frame?
i have suggestion may eliminate overhead of eglmakecurrent while allowing use current approach.
the concept of current eglcontext thread-local. suggest creating contexts in process's master thread, create 1 thread per context, passing 1 context each thread. during each thread's initialization, call eglmakecurrent on context owns, , never call eglmakecurrent again. hopefully, in angle's implementation, thread-local storage contexts implemented efficiently , not have unnecessary synchronization overhead.
Comments
Post a Comment