which library should OpenGL ES clients link to?
krh at bitplanet.net
Wed Nov 10 07:06:57 PST 2010
2010/11/10 Jerome Glisse <j.glisse at gmail.com>:
> 2010/11/10 Kristian Høgsberg <krh at bitplanet.net>:
>> On Wed, Nov 10, 2010 at 12:37 AM, Chia-I Wu <olvaffe at gmail.com> wrote:
>>> Hi list,
>>> I am curious which library should, say, gears links to when it is
>>> ported to OpenGL ES 2.0. libGL.so or libGLESv2.so? I'd like to say
>>> libGLESv2, but cairo links to libGL and there is going to be a
>>> conflict: both libraries export _glapi_tls_Dispatch for current
>>> dispatch table. It is not possible to tell which _glapi_tls_Dispatch
>>> eglMakeCurrent will update and which one glDrawArrays will use.
>> Yup, that is a problem. Ideally cairo-gl should support GL and GLES2,
>> maybe even dlopen libGL.so or libGLESv2.so at runtime so we could
>> support both in one cairo build. As it is now, it's just hardcoded
>> full GL support. cairo-gl isn't a core dependency for wayland though,
>> just for the demo clients. Qt, for example, lets you select GL, GLES1
>> or GLES2 at compile time, which is then used for the entire stack.
>> Cairo gl uses glew for looking up extensions, but I think it would
>> make sense to just use a cairo-specific function table that would hold
>> the required core functions as well as the extension functions needed
>> by cairo. That way you can specify the GL dialect at runtime and
>> cairo-gl will open the right .so and lookup the necessary extension
>> functions for that dialect.
>> For the demo clients, it may be nice to move the cairo dependency out
>> of the toytoolkit, but even then, the toy toolkit still has to use
>> libGL, since otherwise it won't work with cairo-gl.
> Side question to this how to pick which GPU to use at runtime ? (i
> haven't looked at how EGL create it's context and how we pick which
> driver to use inside EGL but i guess there is some mecanism and i
> think we should worry about this early as this is an important feature
> for multi-GPU support).
The drm interface in the wayland protocol will send out an event to
tell you which dri device file to open.
More information about the wayland-devel