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:
parent
3a3d55cd88
commit
811bbba075
@ -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 \
|
||||
|
@ -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);
|
||||
|
@ -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 *
|
||||
|
38
clutter/cogl/cogl/winsys/cogl-context-winsys.c
Normal file
38
clutter/cogl/cogl/winsys/cogl-context-winsys.c
Normal 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)
|
||||
{
|
||||
}
|
32
clutter/cogl/cogl/winsys/cogl-context-winsys.h
Normal file
32
clutter/cogl/cogl/winsys/cogl-context-winsys.h
Normal 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 */
|
Loading…
Reference in New Issue
Block a user