[cairo] [cairo-gl] RFC: Dispatching mechanism for non-standard GL functions

Alexandros Frantzis alexandros.frantzis at linaro.org
Tue Nov 30 05:24:04 PST 2010


Hi all!

In the process of removing GLEW, I have started to implement a
dispatching mechanism in cairo-gl for the GL functions that may have
different names in 1.x, 2.x and ES 2.0 (ARB/EXT etc).

The idea is that each gl_context carries its own dispatch table which is
filled by calling the appropriate *GetProcAddr function (and taking into
account the version and available extensions) when the context is
created. All calls to the contained functions should only be done
through the dispatch table.

The dispatch table is currently embedded in the gl_context struct and
initialized on every creation. However, it may well be a global
per-flavour (glx, egl etc) struct that is lazily initialized only once
and just pointed to by or copied into the gl_context.

The dispatch table approach minimizes the need to have separate code
paths for core 2.0 vs 1.x ARB. For example, I have removed the shader
backend implementation for ARB. Even when using 1.x ARB, the core 2.0
shader path should work fine once the dispatch table has been correctly
set up.

I have attached an early WIP patch for initial review and feedback.
Using the cairo test suite I have found no regressions for GL 2.0 (of
course GL 1.x ARB doesn't work yet).

Thanks,
Alexandros
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gl_dispatch.patch
Type: text/x-diff
Size: 30392 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20101130/adaa2f56/attachment-0001.patch>


More information about the cairo mailing list