According to the official document, there is no limit to the number of shared contexts.
But on the Android client, I have an eglContext as a shared context parameter. When calling eglCreateContext
to create more than or equal to 32 eglContexts, it will return EGL_NO_CONTEXT
and the error message is EGL_BAD_ALLOC
.
I try to read the source code to find out the reason, but the eglCreateContext
is implement by gEGLImpl
which is closed source by the gpu vender.
1
According to the official document, there is no limit to the number of shared contexts.
The specification explicitly says that eglCreateContext()
is allowed to fail, and one the possible reasons an EGL function can fail is BAD_ALLOC
, i.e. lack of resources.
There is no documented limit with a number on it, but that’s not the same thing as “there is no limit”. Every system is limited, if only for memory, so never believe that there are no limits when allocating resources …
In either case, yes, the limit is implementation defined and can vary by hardware vendor.
2