[RFC] Replace the GL dispatch code with libepoxy

Review Request #116072 - Created Feb. 26, 2014 and discarded

Information
Fredrik Höglund
kde-workspace
master
Reviewers
kwin
This review request removes all the manually written GL dispatch code, and
uses libepoxy to resolve GL functions.

An interesting feature of libepoxy is that it doesn't link to libGL, libGLESv2
or libEGL.  Instead it dlopens each library the first time you call an EGL,
GLX or a GL function.  It also provides a single header that contains all
the functions and enumerations for both desktop GL and GLES.

Each GL function resolves itself automatically the first time it's called.
You don't need to call any function to initialize the library. 

Like the kwin code, it's also aware of aliases.  So on desktop GL
glBlitFramebuffer() will try to resolve itself from GL 3.0,
ARB_framebuffer_object and EXT_framebuffer_blit.  On GLES it will try to
resolve itself from GLES 3.0 and NV_framebuffer_blit. 

You will also notice that the only GL library kwin links to is libepoxy.
In theory all the #ifdefs for GLES could be removed and replaced by runtime
checks.

Advantages compared to GLEW:
* Supports core contexts
* Supports EGL
* Supports GLES
* Aware of aliases
* On demand function resolution
* Automatically generated from Khronos XML files
* No need to call an init function

Advantages compared to QOpenGLFunctions:
* Run time choice between EGL/GLX and GLES/desktop GL
* Supports OpenGL 4.4
* Doesn't depend on QOpenGLContext
* Aware of aliases
* Automatically generated from Khronos XML files
* Doesn't have a class for every GL version and every extension
  that must be instantiated to be able to call a function
  provided by that version or extension.

Possible disadvantages:
* Currently doesn't cache the GL version or the extension list, so there
  is a call to glGetString() every time a function is resolved.
* It becomes easier to accidentally use desktop GL functions in GLES paths.

I haven't done much testing, but kwin starts and GL compositing still works.

These commits are also available in a branch in my kde-workspace clone:

http://quickgit.kde.org/?p=clones%2Fkde-workspace%2Ffredrik%2Fkde-workspace.git&a=shortlog&h=6f23b5c2

  

Issues

  • 3
  • 0
  • 0
  • 3
Description From Last Updated
suggestion: move it into the block if(HAVE_X11) and turn it into a required dependency. Martin Flöser Martin Flöser
Could you also add the imported targets and use them instead. Then we can get rid of all the include_directories. ... Martin Flöser Martin Flöser
looks like it could be removed? Martin Flöser Martin Flöser
Martin Flöser
Martin Flöser
Martin Flöser
Fredrik Höglund
Review request changed

Status: Discarded

Loading...