diff --git a/clutter/cogl/cogl/Makefile.am b/clutter/cogl/cogl/Makefile.am index e697d6e46..9f6a837dc 100644 --- a/clutter/cogl/cogl/Makefile.am +++ b/clutter/cogl/cogl/Makefile.am @@ -92,8 +92,6 @@ cogl_driver_sources = if COGL_DRIVER_GL cogl_driver_sources += \ - $(srcdir)/driver/gl/cogl-context-driver-gl.c \ - $(srcdir)/driver/gl/cogl-context-driver-gl.h \ $(srcdir)/driver/gl/cogl-feature-functions-gl.h \ $(srcdir)/driver/gl/cogl-gl.c \ $(srcdir)/driver/gl/cogl-texture-driver-gl.c \ @@ -102,8 +100,6 @@ endif if COGL_DRIVER_GLES cogl_driver_sources += \ - $(srcdir)/driver/gles/cogl-context-driver-gles.c \ - $(srcdir)/driver/gles/cogl-context-driver-gles.h \ $(srcdir)/driver/gles/cogl-feature-functions-gles.h \ $(srcdir)/driver/gles/cogl-gles.c \ $(srcdir)/driver/gles/cogl-texture-driver-gles.c \ diff --git a/clutter/cogl/cogl/cogl-context.c b/clutter/cogl/cogl/cogl-context.c index aaefd6ef9..00f4eaf8e 100644 --- a/clutter/cogl/cogl/cogl-context.c +++ b/clutter/cogl/cogl/cogl-context.c @@ -146,10 +146,8 @@ cogl_context_new (CoglDisplay *display) context->buffer_types = NULL; /* Initialise the driver specific state */ - /* TODO: combine these two into one function */ - _cogl_create_context_driver (context); - _cogl_features_init (); - _cogl_init_feature_overrides (_context); + _cogl_gl_context_init (context); + _cogl_init_feature_overrides (context); _cogl_create_context_winsys (context); diff --git a/clutter/cogl/cogl/driver/gl/cogl-context-driver-gl.c b/clutter/cogl/cogl/driver/gl/cogl-context-driver-gl.c deleted file mode 100644 index b830306e3..000000000 --- a/clutter/cogl/cogl/driver/gl/cogl-context-driver-gl.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Cogl - * - * An object oriented GL/GLES Abstraction/Utility Layer - * - * Copyright (C) 2007,2008,2009 Intel Corporation. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - * - * - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "cogl-context-private.h" - -#define COGL_FEATURE_BEGIN(a, b, c, d, e, f, g) -#define COGL_FEATURE_FUNCTION(ret, name, args) \ - _context->drv.pf_ ## name = NULL; -#define COGL_FEATURE_END() - -void -_cogl_create_context_driver (CoglContext *_context) -{ - #include "cogl-feature-functions-gl.h" -} diff --git a/clutter/cogl/cogl/driver/gl/cogl-context-driver-gl.h b/clutter/cogl/cogl/driver/gl/cogl-context-driver-gl.h deleted file mode 100644 index 2d8e52138..000000000 --- a/clutter/cogl/cogl/driver/gl/cogl-context-driver-gl.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Cogl - * - * An object oriented GL/GLES Abstraction/Utility Layer - * - * Copyright (C) 2007,2008,2009 Intel Corporation. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - * - * - */ - -#ifndef __COGL_CONTEXT_DRIVER_H -#define __COGL_CONTEXT_DRIVER_H - -#include "cogl.h" - -#ifndef APIENTRY -#define APIENTRY -#endif - -#define COGL_FEATURE_BEGIN(a, b, c, d, e, f, g) - -#define COGL_FEATURE_FUNCTION(ret, name, args) \ - ret (APIENTRY * pf_ ## name) args; - -#define COGL_FEATURE_END() - -typedef struct _CoglContextDriver -{ - /* This defines a list of function pointers */ -#include "cogl-feature-functions-gl.h" - - GLint gl_max_program_temoraries_arb; -} CoglContextDriver; - -#undef COGL_FEATURE_BEGIN -#undef COGL_FEATURE_FUNCTION -#undef COGL_FEATURE_END - -#endif /* __COGL_CONTEXT_DRIVER_H */ - diff --git a/clutter/cogl/cogl/driver/gl/cogl-gl.c b/clutter/cogl/cogl/driver/gl/cogl-gl.c index 48088b360..b26f230a4 100644 --- a/clutter/cogl/cogl/driver/gl/cogl-gl.c +++ b/clutter/cogl/cogl/driver/gl/cogl-gl.c @@ -173,25 +173,39 @@ static const CoglFeatureData cogl_feature_data[] = #include "cogl-feature-functions-gl.h" }; -void -_cogl_features_init (void) -{ - CoglFeatureFlags flags = 0; - CoglFeatureFlagsPrivate flags_private = 0; - const char *gl_extensions; - GLint max_clip_planes = 0; - GLint num_stencil_bits = 0; - int gl_major = 0, gl_minor = 0; - int i; +#undef COGL_FEATURE_BEGIN +#define COGL_FEATURE_BEGIN(a, b, c, d, e, f, g) +#undef COGL_FEATURE_FUNCTION +#define COGL_FEATURE_FUNCTION(ret, name, args) \ + context->drv.pf_ ## name = NULL; +#undef COGL_FEATURE_END +#define COGL_FEATURE_END() - _COGL_GET_CONTEXT (ctx, NO_RETVAL); +static void +initialize_context_driver (CoglContext *context) +{ + #include "cogl-feature-functions-gl.h" +} + +void +_cogl_gl_context_init (CoglContext *context) +{ + CoglFeatureFlags flags = 0; + CoglFeatureFlagsPrivate flags_private = 0; + const char *gl_extensions; + int max_clip_planes = 0; + int num_stencil_bits = 0; + int gl_major = 0, gl_minor = 0; + int i; + + initialize_context_driver (context); _cogl_get_gl_version (&gl_major, &gl_minor); flags = (COGL_FEATURE_TEXTURE_READ_PIXELS | COGL_FEATURE_UNSIGNED_INT_INDICES); - gl_extensions = (const char*) glGetString (GL_EXTENSIONS); + gl_extensions = (const char *)glGetString (GL_EXTENSIONS); if (COGL_CHECK_GL_VERSION (gl_major, gl_minor, 2, 0) || _cogl_check_extension ("GL_ARB_texture_non_power_of_two", gl_extensions)) @@ -231,6 +245,6 @@ _cogl_features_init (void) } /* Cache features */ - ctx->feature_flags = flags; - ctx->feature_flags_private = flags_private; + context->feature_flags = flags; + context->feature_flags_private = flags_private; } diff --git a/clutter/cogl/cogl/driver/gles/cogl-context-driver-gles.c b/clutter/cogl/cogl/driver/gles/cogl-context-driver-gles.c deleted file mode 100644 index fd5c96f65..000000000 --- a/clutter/cogl/cogl/driver/gles/cogl-context-driver-gles.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Cogl - * - * An object oriented GL/GLES Abstraction/Utility Layer - * - * Copyright (C) 2007,2008,2009 Intel Corporation. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - * - * - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "cogl-context-private.h" - -#define COGL_FEATURE_BEGIN(a, b, c, d, e, f, g) -#define COGL_FEATURE_FUNCTION(ret, name, args) \ - _context->drv.pf_ ## name = NULL; -#define COGL_FEATURE_END() - -void -_cogl_create_context_driver (CoglContext *_context) -{ - #include "cogl-feature-functions-gles.h" -} - diff --git a/clutter/cogl/cogl/driver/gles/cogl-context-driver-gles.h b/clutter/cogl/cogl/driver/gles/cogl-context-driver-gles.h deleted file mode 100644 index ca3b1d4b1..000000000 --- a/clutter/cogl/cogl/driver/gles/cogl-context-driver-gles.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Cogl - * - * An object oriented GL/GLES Abstraction/Utility Layer - * - * Copyright (C) 2007,2008,2009 Intel Corporation. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - * - * - */ - -#ifndef __COGL_CONTEXT_DRIVER_H -#define __COGL_CONTEXT_DRIVER_H - -#include "cogl.h" - -#ifndef APIENTRY -#define APIENTRY -#endif - -#define COGL_FEATURE_BEGIN(a, b, c, d, e, f, g) - -#define COGL_FEATURE_FUNCTION(ret, name, args) \ - ret (APIENTRY * pf_ ## name) args; - -#define COGL_FEATURE_END() - -typedef struct _CoglContextDriver -{ - /* This defines a list of function pointers */ -#include "cogl-feature-functions-gles.h" - -} CoglContextDriver; - -#undef COGL_FEATURE_BEGIN -#undef COGL_FEATURE_FUNCTION -#undef COGL_FEATURE_END - -#endif /* __COGL_CONTEXT_DRIVER_H */ - diff --git a/clutter/cogl/cogl/driver/gles/cogl-gles.c b/clutter/cogl/cogl/driver/gles/cogl-gles.c index b2eaa8067..304e53788 100644 --- a/clutter/cogl/cogl/driver/gles/cogl-gles.c +++ b/clutter/cogl/cogl/driver/gles/cogl-gles.c @@ -70,18 +70,32 @@ static const CoglFeatureData cogl_feature_data[] = #include "cogl-feature-functions-gles.h" }; +#undef COGL_FEATURE_BEGIN +#define COGL_FEATURE_BEGIN(a, b, c, d, e, f, g) +#undef COGL_FEATURE_FUNCTION +#define COGL_FEATURE_FUNCTION(ret, name, args) \ + _context->drv.pf_ ## name = NULL; +#undef COGL_FEATURE_END +#define COGL_FEATURE_END() + +static void +initialize_context_driver (CoglContext *context) +{ + #include "cogl-feature-functions-gles.h" +} + void -_cogl_features_init (void) +_cogl_gl_context_init (CoglContext *context) { CoglFeatureFlags flags = 0; #ifndef HAVE_COGL_GLES2 - int max_clip_planes = 0; + int max_clip_planes = 0; #endif - GLint num_stencil_bits = 0; - const char *gl_extensions; - int i; + int num_stencil_bits = 0; + const char *gl_extensions; + int i; - _COGL_GET_CONTEXT (ctx, NO_RETVAL); + initialize_context_driver (context); gl_extensions = (const char*) glGetString (GL_EXTENSIONS); @@ -115,6 +129,6 @@ _cogl_features_init (void) flags |= COGL_FEATURE_POINT_SPRITE; /* Cache features */ - ctx->feature_flags = flags; + context->feature_flags = flags; }