cogl: Make it easier to add checks for GL extensions
authorNeil Roberts <neil@linux.intel.com>
Tue, 17 Nov 2009 13:52:40 +0000 (13:52 +0000)
committerNeil Roberts <neil@linux.intel.com>
Tue, 17 Nov 2009 15:11:26 +0000 (15:11 +0000)
commit91cde78a7023d728ebb33c73684fc3702ad87963
tree9e86c425c80f81424540b229e6d9cab392a602bb
parent4734b7be418274cf00390c805b472b9493100157
cogl: Make it easier to add checks for GL extensions

Previously if you need to depend on a new GL feature you had to:

- Add typedefs for all of the functions in cogl-defines.h.in

- Add function pointers for each of the functions in
  cogl-context-driver.h

- Add an initializer for the function pointers in
  cogl-context-driver.c

- Add a check for the extension and all of the functions in
  cogl_features_init. If the extension is available under multiple
  names then you have to duplicate the checks.

This is quite tedious and error prone. This patch moves all of the
features and their functions into a list of macro invocations in
cogl-feature-functions.h. The macros can be redefined to implement all
of the above tasks from the same header.

The features are described in a struct with a pointer to a table of
functions. A new function takes the feature description from this
struct and checks for its availability. The feature can take a list of
extension names with a list of alternate namespaces (such as "EXT" or
"ARB"). It can also detect the feature from a particular version of
GL.

The typedefs are now gone and instead the function pointer in the Cogl
context just directly contains the type.

Some of the functions in the context were previously declared with the
'ARB' extension. This has been removed so that now all the functions
have no suffix. This makes more sense when the extension could
potentially be merged into GL core as well.
17 files changed:
clutter/cogl/cogl/Makefile.am
clutter/cogl/cogl/cogl-feature-private.c [new file with mode: 0644]
clutter/cogl/cogl/cogl-feature-private.h [new file with mode: 0644]
clutter/cogl/cogl/cogl-journal.c
clutter/cogl/cogl/cogl-vertex-buffer.c
clutter/cogl/cogl/driver/gl/cogl-context-driver.c
clutter/cogl/cogl/driver/gl/cogl-context-driver.h
clutter/cogl/cogl/driver/gl/cogl-defines.h.in
clutter/cogl/cogl/driver/gl/cogl-feature-functions.h [new file with mode: 0644]
clutter/cogl/cogl/driver/gl/cogl-program.c
clutter/cogl/cogl/driver/gl/cogl-shader.c
clutter/cogl/cogl/driver/gl/cogl.c
clutter/cogl/cogl/driver/gles/cogl-context-driver.c
clutter/cogl/cogl/driver/gles/cogl-context-driver.h
clutter/cogl/cogl/driver/gles/cogl-defines.h.in
clutter/cogl/cogl/driver/gles/cogl-feature-functions.h [new file with mode: 0644]
clutter/cogl/cogl/driver/gles/cogl.c