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.
This commit is contained in:
@ -150,13 +150,14 @@
|
||||
|
||||
#if defined (HAVE_COGL_GL)
|
||||
|
||||
#define glGenBuffers ctx->drv.pf_glGenBuffersARB
|
||||
#define glBindBuffer ctx->drv.pf_glBindBufferARB
|
||||
#define glBufferData ctx->drv.pf_glBufferDataARB
|
||||
#define glBufferSubData ctx->drv.pf_glBufferSubDataARB
|
||||
#define glDeleteBuffers ctx->drv.pf_glDeleteBuffersARB
|
||||
#define glMapBuffer ctx->drv.pf_glMapBufferARB
|
||||
#define glUnmapBuffer ctx->drv.pf_glUnmapBufferARB
|
||||
#define glGenBuffers ctx->drv.pf_glGenBuffers
|
||||
#define glBindBuffer ctx->drv.pf_glBindBuffer
|
||||
#define glBufferData ctx->drv.pf_glBufferData
|
||||
#define glBufferSubData ctx->drv.pf_glBufferSubData
|
||||
#define glGetBufferSubData ctx->drv.pf_glGetBufferSubData
|
||||
#define glDeleteBuffers ctx->drv.pf_glDeleteBuffers
|
||||
#define glMapBuffer ctx->drv.pf_glMapBuffer
|
||||
#define glUnmapBuffer ctx->drv.pf_glUnmapBuffer
|
||||
#define glActiveTexture ctx->drv.pf_glActiveTexture
|
||||
#define glClientActiveTexture ctx->drv.pf_glClientActiveTexture
|
||||
#ifndef GL_ARRAY_BUFFER
|
||||
@ -175,9 +176,9 @@
|
||||
|
||||
#if defined (HAVE_COGL_GL)
|
||||
|
||||
#define glVertexAttribPointer ctx->drv.pf_glVertexAttribPointerARB
|
||||
#define glEnableVertexAttribArray ctx->drv.pf_glEnableVertexAttribArrayARB
|
||||
#define glDisableVertexAttribArray ctx->drv.pf_glEnableVertexAttribArrayARB
|
||||
#define glVertexAttribPointer ctx->drv.pf_glVertexAttribPointer
|
||||
#define glEnableVertexAttribArray ctx->drv.pf_glEnableVertexAttribArray
|
||||
#define glDisableVertexAttribArray ctx->drv.pf_glEnableVertexAttribArray
|
||||
#define MAY_HAVE_PROGRAMABLE_GL
|
||||
|
||||
#elif defined (HAVE_COGL_GLES2)
|
||||
|
Reference in New Issue
Block a user