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.
This commit is contained in:
Neil Roberts 2010-06-02 15:16:14 +01:00
parent 3a3d55cd88
commit 811bbba075
5 changed files with 82 additions and 0 deletions

View File

@ -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 \

View File

@ -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);

View File

@ -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 *

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*
*/
#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)
{
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*
*/
#ifndef __COGL_CONTEXT_WINSYS_H
#define __COGL_CONTEXT_WINSYS_H
typedef struct
{
int stub;
} CoglContextWinsys;
#endif /* __COGL_CONTEXT_WINSYS_H */