Moves all EGL code down from Clutter to Cogl

As was recently done for the GLX window system code, this commit moves
the EGL window system code down from the Clutter backend code into a
Cogl winsys.

Note: currently the cogl/configure.ac is hard coded to only build the GLX
winsys so currently this is only available when building Cogl as part
of Clutter.
This commit is contained in:
Robert Bragg 2011-02-25 00:31:41 +00:00
parent 8399f5e61c
commit d5d11f1878
6 changed files with 1134 additions and 13 deletions

View File

@ -332,18 +332,15 @@ cogl_sources_c += \
endif
if SUPPORT_EGL_PLATFORM_POWERVR_X11
cogl_sources_c += \
$(srcdir)/winsys/cogl-winsys-egl.c \
$(srcdir)/winsys/cogl-winsys-stub.c
$(srcdir)/winsys/cogl-winsys-egl.c
endif
if SUPPORT_EGL_PLATFORM_POWERVR_NULL
cogl_sources_c += \
$(srcdir)/winsys/cogl-winsys-egl.c \
$(srcdir)/winsys/cogl-winsys-stub.c
$(srcdir)/winsys/cogl-winsys-egl.c
endif
if SUPPORT_EGL_PLATFORM_POWERVR_GDL
cogl_sources_c += \
$(srcdir)/winsys/cogl-winsys-egl.c \
$(srcdir)/winsys/cogl-winsys-stub.c
$(srcdir)/winsys/cogl-winsys-egl.c
endif
if SUPPORT_WIN32
cogl_sources_c += \

View File

@ -475,3 +475,12 @@ cogl_set_default_context (CoglContext *context)
cogl_object_unref (_context);
_context = context;
}
#ifdef COGL_HAS_EGL_SUPPORT
EGLDisplay
cogl_context_egl_get_egl_display (CoglContext *context)
{
return _cogl_winsys_context_egl_get_egl_display (context);
}
#endif

View File

@ -33,6 +33,17 @@
#include <cogl/cogl-display.h>
#ifdef COGL_HAS_EGL_SUPPORT
#ifdef COGL_HAS_GLES1
#include <GLES/gl.h>
#include <GLES/egl.h>
#else
#include <EGL/egl.h>
#define NativeDisplayType EGLNativeDisplayType
#define NativeWindowType EGLNativeWindowType
#endif
#endif
G_BEGIN_DECLS
/**
@ -61,6 +72,12 @@ cogl_context_new (CoglDisplay *display,
void
cogl_set_default_context (CoglContext *context);
#ifdef COGL_HAS_EGL_SUPPORT
#define cogl_context_egl_get_egl_display cogl_context_egl_get_egl_display_EXP
EGLDisplay
cogl_context_egl_get_egl_display (CoglContext *context);
#endif
G_END_DECLS
#endif /* __COGL_CONTEXT_H__ */

View File

@ -0,0 +1,57 @@
/*
* 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/>.
*
*
*/
/* This can be included multiple times with different definitions for
* the COGL_WINSYS_FEATURE_* functions.
*/
/* Macro prototypes:
* COGL_WINSYS_FEATURE_BEGIN (name, namespaces, extension_names,
* implied_public_feature_flags,
* implied_private_feature_flags,
* implied_winsys_feature)
* COGL_WINSYS_FEATURE_FUNCTION (return_type, function_name,
* (arguments))
* ...
* COGL_WINSYS_FEATURE_END ()
*
* Note: You can list multiple namespace and extension names if the
* corresponding _FEATURE_FUNCTIONS have the same semantics accross
* the different extension variants.
*
* XXX: NB: Don't add a trailing semicolon when using these macros
*/
COGL_WINSYS_FEATURE_BEGIN (swap_region,
"NOK\0",
"swap_region\0",
0,
0,
COGL_WINSYS_FEATURE_SWAP_REGION)
COGL_WINSYS_FEATURE_FUNCTION (EGLBoolean, eglSwapBuffersRegion,
(EGLDisplay dpy,
EGLSurface surface,
EGLint numRects,
const EGLint *rects))
COGL_WINSYS_FEATURE_END ()

File diff suppressed because it is too large Load Diff

View File

@ -71,6 +71,11 @@ _cogl_winsys_context_init (CoglContext *context, GError **error);
void
_cogl_winsys_context_deinit (CoglContext *context);
#ifdef COGL_HAS_EGL_SUPPORT
EGLDisplay
_cogl_winsys_context_egl_get_egl_display (CoglContext *context);
#endif
gboolean
_cogl_winsys_has_feature (CoglWinsysFeature feature);