mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
Add temporary cogl-clutter.h to aid splitting out Cogl
This gives us a way to clearly track the internal Cogl API that Clutter depends on. The aim is to split Cogl out from Clutter into a standalone 3D graphics API and eventually we want to get rid of any private interfaces for Clutter so its useful to have a handle on that task. Actually it's not as bad as I was expecting though.
This commit is contained in:
parent
8557bc3d26
commit
532b563439
@ -465,7 +465,7 @@ _clutter_backend_ensure_context (ClutterBackend *backend,
|
|||||||
|
|
||||||
clutter_actor_get_size (CLUTTER_ACTOR (stage), &width, &height);
|
clutter_actor_get_size (CLUTTER_ACTOR (stage), &width, &height);
|
||||||
|
|
||||||
_cogl_onscreen_clutter_backend_set_size (width, height);
|
cogl_onscreen_clutter_backend_set_size (width, height);
|
||||||
|
|
||||||
/* Eventually we will have a separate CoglFramebuffer for
|
/* Eventually we will have a separate CoglFramebuffer for
|
||||||
* each stage and each one will track private projection
|
* each stage and each one will track private projection
|
||||||
|
@ -373,7 +373,7 @@ clutter_stage_allocate (ClutterActor *self,
|
|||||||
* window has a chance to update the window size based on the
|
* window has a chance to update the window size based on the
|
||||||
* allocation. */
|
* allocation. */
|
||||||
_clutter_stage_window_get_geometry (priv->impl, &geom);
|
_clutter_stage_window_get_geometry (priv->impl, &geom);
|
||||||
_cogl_onscreen_clutter_backend_set_size (geom.width, geom.height);
|
cogl_onscreen_clutter_backend_set_size (geom.width, geom.height);
|
||||||
|
|
||||||
clutter_actor_get_allocation_geometry (self, &geom);
|
clutter_actor_get_allocation_geometry (self, &geom);
|
||||||
if (geom.width != prev_geom.width || geom.height != prev_geom.height)
|
if (geom.width != prev_geom.width || geom.height != prev_geom.height)
|
||||||
|
@ -78,6 +78,7 @@ cogl_public_h = \
|
|||||||
$(srcdir)/cogl-attribute.h \
|
$(srcdir)/cogl-attribute.h \
|
||||||
$(srcdir)/cogl-primitive.h \
|
$(srcdir)/cogl-primitive.h \
|
||||||
$(srcdir)/cogl-clip-state.h \
|
$(srcdir)/cogl-clip-state.h \
|
||||||
|
$(srcdir)/cogl-clutter.h \
|
||||||
$(srcdir)/cogl.h \
|
$(srcdir)/cogl.h \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
@ -271,8 +272,9 @@ cogl_sources_c = \
|
|||||||
$(srcdir)/cogl-shader-private.h \
|
$(srcdir)/cogl-shader-private.h \
|
||||||
$(srcdir)/cogl-shader.c \
|
$(srcdir)/cogl-shader.c \
|
||||||
$(srcdir)/cogl-gtype-private.h \
|
$(srcdir)/cogl-gtype-private.h \
|
||||||
$(srcdir)/cogl-point-in-poly-private.h \
|
$(srcdir)/cogl-point-in-poly-private.h \
|
||||||
$(srcdir)/cogl-point-in-poly.c \
|
$(srcdir)/cogl-point-in-poly.c \
|
||||||
|
$(srcdir)/cogl-clutter.c \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
if SUPPORT_XLIB
|
if SUPPORT_XLIB
|
||||||
|
59
clutter/cogl/cogl/cogl-clutter.c
Normal file
59
clutter/cogl/cogl/cogl-clutter.c
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Cogl
|
||||||
|
*
|
||||||
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||||
|
*
|
||||||
|
* Copyright (C) 2011 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, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Robert Bragg <robert@linux.intel.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
#include "cogl.h"
|
||||||
|
#include "cogl-types.h"
|
||||||
|
#include "cogl-private.h"
|
||||||
|
#include "cogl-context-private.h"
|
||||||
|
#include "cogl-winsys-private.h"
|
||||||
|
#include "cogl-framebuffer-private.h"
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
cogl_clutter_check_extension (const char *name, const char *ext)
|
||||||
|
{
|
||||||
|
return _cogl_check_extension (name, ext);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cogl_onscreen_clutter_backend_set_size (int width, int height)
|
||||||
|
{
|
||||||
|
CoglFramebuffer *framebuffer;
|
||||||
|
|
||||||
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||||
|
|
||||||
|
if (!ctx->stub_winsys)
|
||||||
|
return;
|
||||||
|
|
||||||
|
framebuffer = COGL_FRAMEBUFFER (ctx->window_buffer);
|
||||||
|
|
||||||
|
_cogl_framebuffer_winsys_update_size (framebuffer, width, height);
|
||||||
|
}
|
47
clutter/cogl/cogl/cogl-clutter.h
Normal file
47
clutter/cogl/cogl/cogl-clutter.h
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Cogl
|
||||||
|
*
|
||||||
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||||
|
*
|
||||||
|
* Copyright (C) 2011 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, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||||
|
#error "Only <cogl/cogl.h> can be included directly."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __COGL_CLUTTER_H__
|
||||||
|
#define __COGL_CLUTTER_H__
|
||||||
|
|
||||||
|
#ifdef COGL_HAS_XLIB
|
||||||
|
#include <X11/Xutil.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define cogl_clutter_check_extension cogl_clutter_check_extension_CLUTTER
|
||||||
|
gboolean
|
||||||
|
cogl_clutter_check_extension (const char *name, const char *ext);
|
||||||
|
|
||||||
|
#define cogl_onscreen_clutter_backend_set_size cogl_onscreen_clutter_backend_set_size_CLUTTER
|
||||||
|
void
|
||||||
|
cogl_onscreen_clutter_backend_set_size (int width, int height);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __COGL_CLUTTER_H__ */
|
@ -113,6 +113,10 @@ typedef struct _CoglOnscreen
|
|||||||
void
|
void
|
||||||
_cogl_framebuffer_state_init (void);
|
_cogl_framebuffer_state_init (void);
|
||||||
|
|
||||||
|
void
|
||||||
|
_cogl_framebuffer_winsys_update_size (CoglFramebuffer *framebuffer,
|
||||||
|
int width, int height);
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_clear4f (unsigned long buffers,
|
_cogl_clear4f (unsigned long buffers,
|
||||||
float red,
|
float red,
|
||||||
|
@ -989,13 +989,10 @@ _cogl_onscreen_free (CoglOnscreen *onscreen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_onscreen_clutter_backend_set_size (int width, int height)
|
_cogl_framebuffer_winsys_update_size (CoglFramebuffer *framebuffer,
|
||||||
|
int width, int height)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer;
|
CoglContext *ctx = framebuffer->context;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
|
||||||
|
|
||||||
framebuffer = COGL_FRAMEBUFFER (ctx->window_buffer);
|
|
||||||
|
|
||||||
if (framebuffer->width == width && framebuffer->height == height)
|
if (framebuffer->width == width && framebuffer->height == height)
|
||||||
return;
|
return;
|
||||||
|
@ -26,6 +26,9 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
_cogl_check_extension (const char *name, const char *ext);
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_clear (const CoglColor *color, unsigned long buffers);
|
_cogl_clear (const CoglColor *color, unsigned long buffers);
|
||||||
|
|
||||||
|
@ -1277,9 +1277,6 @@ _cogl_check_driver_valid (GError **error);
|
|||||||
GQuark
|
GQuark
|
||||||
_cogl_driver_error_quark (void);
|
_cogl_driver_error_quark (void);
|
||||||
|
|
||||||
void
|
|
||||||
_cogl_onscreen_clutter_backend_set_size (int width, int height);
|
|
||||||
|
|
||||||
#ifdef COGL_ENABLE_EXPERIMENTAL_API
|
#ifdef COGL_ENABLE_EXPERIMENTAL_API
|
||||||
#define cogl_get_draw_framebuffer cogl_get_draw_framebuffer_EXP
|
#define cogl_get_draw_framebuffer cogl_get_draw_framebuffer_EXP
|
||||||
CoglFramebuffer *
|
CoglFramebuffer *
|
||||||
|
@ -690,7 +690,7 @@ clutter_backend_egl_get_features (ClutterBackend *backend)
|
|||||||
|
|
||||||
egl_extensions = eglQueryString (backend_egl->edpy, EGL_EXTENSIONS);
|
egl_extensions = eglQueryString (backend_egl->edpy, EGL_EXTENSIONS);
|
||||||
|
|
||||||
if (_cogl_check_extension ("EGL_NOK_swap_region", egl_extensions))
|
if (cogl_clutter_check_extension ("EGL_NOK_swap_region", egl_extensions))
|
||||||
{
|
{
|
||||||
CLUTTER_NOTE (BACKEND,
|
CLUTTER_NOTE (BACKEND,
|
||||||
"Using EGL_NOK_swap_region for sub_buffer copies");
|
"Using EGL_NOK_swap_region for sub_buffer copies");
|
||||||
@ -704,7 +704,7 @@ clutter_backend_egl_get_features (ClutterBackend *backend)
|
|||||||
|
|
||||||
#if 0 /* XXX need GL_ARB_draw_buffers */
|
#if 0 /* XXX need GL_ARB_draw_buffers */
|
||||||
if (!backend_egl->swap_buffers_region &&
|
if (!backend_egl->swap_buffers_region &&
|
||||||
_cogl_check_extension ("GL_EXT_framebuffer_blit", gl_extensions))
|
cogl_clutter_check_extension ("GL_EXT_framebuffer_blit", gl_extensions))
|
||||||
{
|
{
|
||||||
CLUTTER_NOTE (BACKEND,
|
CLUTTER_NOTE (BACKEND,
|
||||||
"Using glBlitFramebuffer fallback for sub_buffer copies");
|
"Using glBlitFramebuffer fallback for sub_buffer copies");
|
||||||
|
@ -228,9 +228,9 @@ try_enable_drm (ClutterBackendWayland *backend_wayland, GError **error)
|
|||||||
glexts = glGetString(GL_EXTENSIONS);
|
glexts = glGetString(GL_EXTENSIONS);
|
||||||
exts = eglQueryString (backend_wayland->edpy, EGL_EXTENSIONS);
|
exts = eglQueryString (backend_wayland->edpy, EGL_EXTENSIONS);
|
||||||
|
|
||||||
if (!_cogl_check_extension ("EGL_KHR_image_base", exts) ||
|
if (!cogl_clutter_check_extension ("EGL_KHR_image_base", exts) ||
|
||||||
!_cogl_check_extension ("EGL_MESA_drm_image", exts) ||
|
!cogl_clutter_check_extension ("EGL_MESA_drm_image", exts) ||
|
||||||
!_cogl_check_extension ("GL_OES_EGL_image", glexts))
|
!cogl_clutter_check_extension ("GL_OES_EGL_image", glexts))
|
||||||
{
|
{
|
||||||
g_set_error (error, CLUTTER_INIT_ERROR,
|
g_set_error (error, CLUTTER_INIT_ERROR,
|
||||||
CLUTTER_INIT_ERROR_BACKEND,
|
CLUTTER_INIT_ERROR_BACKEND,
|
||||||
@ -456,7 +456,7 @@ clutter_backend_wayland_create_context (ClutterBackend *backend,
|
|||||||
#endif
|
#endif
|
||||||
egl_extensions = eglQueryString (backend_wayland->edpy, EGL_EXTENSIONS);
|
egl_extensions = eglQueryString (backend_wayland->edpy, EGL_EXTENSIONS);
|
||||||
|
|
||||||
if (!_cogl_check_extension (_COGL_SURFACELESS_EXTENSION, egl_extensions))
|
if (!cogl_clutter_check_extension (_COGL_SURFACELESS_EXTENSION, egl_extensions))
|
||||||
{
|
{
|
||||||
g_debug("Could not find the " _COGL_SURFACELESS_EXTENSION
|
g_debug("Could not find the " _COGL_SURFACELESS_EXTENSION
|
||||||
" extension; falling back to binding a dummy surface");
|
" extension; falling back to binding a dummy surface");
|
||||||
|
@ -227,7 +227,7 @@ clutter_backend_win32_get_features (ClutterBackend *backend)
|
|||||||
for the swap control extension */
|
for the swap control extension */
|
||||||
if (getenv ("__GL_SYNC_TO_VBLANK") || check_vblank_env ("default"))
|
if (getenv ("__GL_SYNC_TO_VBLANK") || check_vblank_env ("default"))
|
||||||
CLUTTER_NOTE (BACKEND, "vblank sync: left at default at user request");
|
CLUTTER_NOTE (BACKEND, "vblank sync: left at default at user request");
|
||||||
else if (_cogl_check_extension ("WGL_EXT_swap_control", extensions)
|
else if (cogl_clutter_check_extension ("WGL_EXT_swap_control", extensions)
|
||||||
&& (swap_interval = (SwapIntervalProc)
|
&& (swap_interval = (SwapIntervalProc)
|
||||||
cogl_get_proc_address ("wglSwapIntervalEXT")))
|
cogl_get_proc_address ("wglSwapIntervalEXT")))
|
||||||
{
|
{
|
||||||
|
@ -915,7 +915,7 @@ clutter_stage_x11_translate_event (ClutterEventTranslator *translator,
|
|||||||
|
|
||||||
/* Queue a relayout - we want glViewport to be called
|
/* Queue a relayout - we want glViewport to be called
|
||||||
* with the correct values, and this is done in ClutterStage
|
* with the correct values, and this is done in ClutterStage
|
||||||
* via _cogl_onscreen_clutter_backend_set_size ().
|
* via cogl_onscreen_clutter_backend_set_size ().
|
||||||
*
|
*
|
||||||
* We queue a relayout, because if this ConfigureNotify is
|
* We queue a relayout, because if this ConfigureNotify is
|
||||||
* in response to a size we set in the application, the
|
* in response to a size we set in the application, the
|
||||||
|
Loading…
Reference in New Issue
Block a user