From 811bbba0751d76f742c9db11d07a227ff4d21848 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Wed, 2 Jun 2010 15:16:14 +0100 Subject: [PATCH] cogl: Add a struct for winsys-specific data to CoglContext This creates a separate struct to store the fields of the context that are specific to the winsys. This is all stored in one file but ideally this could work more like the CoglContextDriver struct and have a different header for each winsys. --- clutter/cogl/cogl/Makefile.am | 2 ++ clutter/cogl/cogl/cogl-context.c | 8 ++++++ clutter/cogl/cogl/cogl-context.h | 2 ++ clutter/cogl/cogl/winsys/cogl-context-winsys.c | 38 ++++++++++++++++++++++++++ clutter/cogl/cogl/winsys/cogl-context-winsys.h | 32 ++++++++++++++++++++++ 5 files changed, 82 insertions(+) create mode 100644 clutter/cogl/cogl/winsys/cogl-context-winsys.c create mode 100644 clutter/cogl/cogl/winsys/cogl-context-winsys.h diff --git a/clutter/cogl/cogl/Makefile.am b/clutter/cogl/cogl/Makefile.am index 618d7be..8acdd7f 100644 --- a/clutter/cogl/cogl/Makefile.am +++ b/clutter/cogl/cogl/Makefile.am @@ -75,6 +75,8 @@ cogl_public_h = \ cogl_sources_c = \ $(srcdir)/winsys/cogl-winsys.h \ + $(srcdir)/winsys/cogl-context-winsys.h \ + $(srcdir)/winsys/cogl-context-winsys.c \ $(srcdir)/cogl-handle.h \ $(srcdir)/cogl-context.h \ $(srcdir)/cogl-context.c \ diff --git a/clutter/cogl/cogl/cogl-context.c b/clutter/cogl/cogl/cogl-context.c index 2933ed7..b3cfdb0 100644 --- a/clutter/cogl/cogl/cogl-context.c +++ b/clutter/cogl/cogl/cogl-context.c @@ -43,6 +43,10 @@ extern void _cogl_create_context_driver (CoglContext *context); +extern void +_cogl_create_context_winsys (CoglContext *context); +extern void +_cogl_destroy_context_winsys (CoglContext *context); static CoglContext *_context = NULL; static gboolean gl_is_indirect = FALSE; @@ -72,6 +76,8 @@ cogl_create_context (void) _cogl_create_context_driver (_context); _cogl_features_init (); + _cogl_create_context_winsys (_context); + _cogl_material_init_default_material (); _cogl_material_init_default_layers (); @@ -209,6 +215,8 @@ _cogl_destroy_context (void) if (_context == NULL) return; + _cogl_destroy_context_winsys (_context); + _cogl_destroy_texture_units (); _cogl_free_framebuffer_stack (_context->framebuffer_stack); diff --git a/clutter/cogl/cogl/cogl-context.h b/clutter/cogl/cogl/cogl-context.h index 1ed1499..83c8bfd 100644 --- a/clutter/cogl/cogl/cogl-context.h +++ b/clutter/cogl/cogl/cogl-context.h @@ -26,6 +26,7 @@ #include "cogl-internal.h" #include "cogl-context-driver.h" +#include "cogl-context-winsys.h" #include "cogl-primitives.h" #include "cogl-clip-stack.h" #include "cogl-matrix-stack.h" @@ -167,6 +168,7 @@ typedef struct GSList *texture_types; CoglContextDriver drv; + CoglContextWinsys winsys; } CoglContext; CoglContext * diff --git a/clutter/cogl/cogl/winsys/cogl-context-winsys.c b/clutter/cogl/cogl/winsys/cogl-context-winsys.c new file mode 100644 index 0000000..91402e7 --- /dev/null +++ b/clutter/cogl/cogl/winsys/cogl-context-winsys.c @@ -0,0 +1,38 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 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.h" + +void +_cogl_create_context_winsys (CoglContext *context) +{ +} + +void +_cogl_destroy_context_winsys (CoglContext *context) +{ +} diff --git a/clutter/cogl/cogl/winsys/cogl-context-winsys.h b/clutter/cogl/cogl/winsys/cogl-context-winsys.h new file mode 100644 index 0000000..c67ee34 --- /dev/null +++ b/clutter/cogl/cogl/winsys/cogl-context-winsys.h @@ -0,0 +1,32 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 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_WINSYS_H +#define __COGL_CONTEXT_WINSYS_H + +typedef struct +{ + int stub; +} CoglContextWinsys; + +#endif /* __COGL_CONTEXT_WINSYS_H */ -- 2.7.4