From 2e5b4a5b81d92909ad90e554c57c94b7c3f82f57 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. --- cogl/Makefile.am | 2 ++ cogl/cogl-context.c | 8 +++++++ cogl/cogl-context.h | 2 ++ cogl/winsys/cogl-context-winsys.c | 38 +++++++++++++++++++++++++++++++ cogl/winsys/cogl-context-winsys.h | 32 ++++++++++++++++++++++++++ 5 files changed, 82 insertions(+) create mode 100644 cogl/winsys/cogl-context-winsys.c create mode 100644 cogl/winsys/cogl-context-winsys.h diff --git a/cogl/Makefile.am b/cogl/Makefile.am index 618d7be4b..8acdd7f25 100644 --- a/cogl/Makefile.am +++ b/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/cogl/cogl-context.c b/cogl/cogl-context.c index 2933ed7d7..b3cfdb042 100644 --- a/cogl/cogl-context.c +++ b/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/cogl/cogl-context.h b/cogl/cogl-context.h index 1ed1499d9..83c8bfd6c 100644 --- a/cogl/cogl-context.h +++ b/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/cogl/winsys/cogl-context-winsys.c b/cogl/winsys/cogl-context-winsys.c new file mode 100644 index 000000000..91402e7ba --- /dev/null +++ b/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/cogl/winsys/cogl-context-winsys.h b/cogl/winsys/cogl-context-winsys.h new file mode 100644 index 000000000..c67ee3453 --- /dev/null +++ b/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 */