Move all of the GL function pointers directly to CoglContext
Instead of storing all of the feature function pointers in the driver specific data of the CoglContext they are now all stored directly in CoglContext. There is a single header containing the description of the functions which gets included by cogl-context.h. There is a single function in cogl-feature-private.c to check for all of these functions. The name of the function pointer variables have been changed from ctx->drv.pf_glWhatever to just ctx->glWhatever. The feature flags that get set when an extension is available are now separated from the table of extensions. This is necessary because different extensions can mean different things on GLES and GL. For example, having access to glMapBuffer implies read and write support on GL but only write support on GLES. The flags are instead set in the driver specific init function by checking whether the function pointers were successfully resolved. _cogl_feature_check has been changed to assume the feature is supported if any of the listed extensions are available instead of requiring all of them. This makes it more convenient to specify alternate names for the extension. Nothing else had previously listed more than one name for an extension so this shouldn't cause any problems.
This commit is contained in:
@ -50,19 +50,17 @@
|
||||
*/
|
||||
|
||||
#ifdef HAVE_COGL_GL
|
||||
#define glActiveTexture ctx->drv.pf_glActiveTexture
|
||||
#define glClientActiveTexture ctx->drv.pf_glClientActiveTexture
|
||||
#define glBlendFuncSeparate ctx->drv.pf_glBlendFuncSeparate
|
||||
#define glBlendEquation ctx->drv.pf_glBlendEquation
|
||||
#define glBlendColor ctx->drv.pf_glBlendColor
|
||||
#define glBlendEquationSeparate ctx->drv.pf_glBlendEquationSeparate
|
||||
#define glActiveTexture ctx->glActiveTexture
|
||||
#define glClientActiveTexture ctx->glClientActiveTexture
|
||||
#define glBlendEquation ctx->glBlendEquation
|
||||
#define glBlendColor ctx->glBlendColor
|
||||
|
||||
#define glProgramString ctx->drv.pf_glProgramString
|
||||
#define glBindProgram ctx->drv.pf_glBindProgram
|
||||
#define glDeletePrograms ctx->drv.pf_glDeletePrograms
|
||||
#define glGenPrograms ctx->drv.pf_glGenPrograms
|
||||
#define glProgramLocalParameter4fv ctx->drv.pf_glProgramLocalParameter4fv
|
||||
#define glUseProgram ctx->drv.pf_glUseProgram
|
||||
#define glProgramString ctx->glProgramString
|
||||
#define glBindProgram ctx->glBindProgram
|
||||
#define glDeletePrograms ctx->glDeletePrograms
|
||||
#define glGenPrograms ctx->glGenPrograms
|
||||
#define glProgramLocalParameter4fv ctx->glProgramLocalParameter4fv
|
||||
#define glUseProgram ctx->glUseProgram
|
||||
#endif
|
||||
|
||||
/* These aren't defined in the GLES headers */
|
||||
@ -519,9 +517,9 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state (
|
||||
#elif defined (HAVE_COGL_GL)
|
||||
gboolean have_blend_equation_seperate = FALSE;
|
||||
gboolean have_blend_func_separate = FALSE;
|
||||
if (ctx->drv.pf_glBlendEquationSeparate) /* Only GL 2.0 + */
|
||||
if (ctx->glBlendEquationSeparate) /* Only GL 2.0 + */
|
||||
have_blend_equation_seperate = TRUE;
|
||||
if (ctx->drv.pf_glBlendFuncSeparate) /* Only GL 1.4 + */
|
||||
if (ctx->glBlendFuncSeparate) /* Only GL 1.4 + */
|
||||
have_blend_func_separate = TRUE;
|
||||
#endif
|
||||
|
||||
@ -546,8 +544,8 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state (
|
||||
|
||||
if (have_blend_equation_seperate &&
|
||||
blend_state->blend_equation_rgb != blend_state->blend_equation_alpha)
|
||||
GE (glBlendEquationSeparate (blend_state->blend_equation_rgb,
|
||||
blend_state->blend_equation_alpha));
|
||||
GE (ctx->glBlendEquationSeparate (blend_state->blend_equation_rgb,
|
||||
blend_state->blend_equation_alpha));
|
||||
else
|
||||
GE (glBlendEquation (blend_state->blend_equation_rgb));
|
||||
|
||||
@ -555,10 +553,10 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state (
|
||||
(blend_state->blend_src_factor_rgb != blend_state->blend_src_factor_alpha ||
|
||||
(blend_state->blend_src_factor_rgb !=
|
||||
blend_state->blend_src_factor_alpha)))
|
||||
GE (glBlendFuncSeparate (blend_state->blend_src_factor_rgb,
|
||||
blend_state->blend_dst_factor_rgb,
|
||||
blend_state->blend_src_factor_alpha,
|
||||
blend_state->blend_dst_factor_alpha));
|
||||
GE (ctx->glBlendFuncSeparate (blend_state->blend_src_factor_rgb,
|
||||
blend_state->blend_dst_factor_rgb,
|
||||
blend_state->blend_src_factor_alpha,
|
||||
blend_state->blend_dst_factor_alpha));
|
||||
else
|
||||
#endif
|
||||
GE (glBlendFunc (blend_state->blend_src_factor_rgb,
|
||||
|
Reference in New Issue
Block a user