From 0bce7eac5375936d9ac6486f13cef94298f8590e Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Tue, 28 Jul 2009 02:02:02 +0100 Subject: [PATCH] Intial Re-layout of the Cogl source code and introduction of a Cogl Winsys As part of an incremental process to have Cogl be a standalone project we want to re-consider how we organise the Cogl source code. Currently this is the structure I'm aiming for: cogl/ cogl/ winsys/ cogl-glx.c cogl-wgl.c driver/ gl/ gles/ os/ ? utils/ cogl-fixed cogl-matrix-stack? cogl-journal? cogl-primitives? pango/ The new winsys component is a starting point for migrating window system code (i.e. x11,glx,wgl,osx,egl etc) from Clutter to Cogl. The utils/ and pango/ directories aren't added by this commit, but they are noted because I plan to add them soon. Overview of the planned structure: * The winsys/ API is the API that binds OpenGL to a specific window system, be that X11 or win32 etc. Example are glx, wgl and egl. Much of the logic under clutter/{glx,osx,win32 etc} should migrate here. * Note there is also the idea of a winsys-base that may represent a window system for which there are multiple winsys APIs. An example of this is x11, since glx and egl may both be used with x11. (currently only Clutter has the idea of a winsys-base) * The driver/ represents a specific varient of OpenGL. Currently we have "gl" representing OpenGL 1.4-2.1 (mostly fixed function) and "gles" representing GLES 1.1 (fixed funciton) and 2.0 (fully shader based) * Everything under cogl/ should fundamentally be supporting access to the GPU. Essentially Cogl's most basic requirement is to provide a nice GPU Graphics API and drawing a line between this and the utility functionality we add to support Clutter should help keep this lean and maintainable. * Code under utils/ as suggested builds on cogl/ adding more convenient APIs or mechanism to optimize special cases. Broadly speaking you can compare cogl/ to OpenGL and utils/ to GLU. * clutter/pango will be moved to clutter/cogl/pango How some of the internal configure.ac/pkg-config terminology has changed: backendextra -> CLUTTER_WINSYS_BASE # e.g. "x11" backendextralib -> CLUTTER_WINSYS_BASE_LIB # e.g. "x11/libclutter-x11.la" clutterbackend -> {CLUTTER,COGL}_WINSYS # e.g. "glx" CLUTTER_FLAVOUR -> {CLUTTER,COGL}_WINSYS clutterbackendlib -> CLUTTER_WINSYS_LIB CLUTTER_COGL -> COGL_DRIVER # e.g. "gl" Note: The CLUTTER_FLAVOUR and CLUTTER_COGL defines are kept for apps As the first thing to take advantage of the new winsys component in Cogl; cogl_get_proc_address() has been moved from cogl/{gl,gles}/cogl.c into cogl/common/cogl.c and this common implementation first trys _cogl_winsys_get_proc_address() but if that fails then it falls back to gmodule. --- Makefile.am | 89 +--------- TODO | 25 --- cogl.pc.in | 15 -- cogl/Makefile.am | 161 ++++++++++++++++++ {common => cogl}/cogl-bitmap-fallback.c | 0 {common => cogl}/cogl-bitmap-pixbuf.c | 0 {common => cogl}/cogl-bitmap-private.h | 0 {common => cogl}/cogl-bitmap.c | 0 cogl-bitmap.h => cogl/cogl-bitmap.h | 0 {common => cogl}/cogl-blend-string.c | 0 {common => cogl}/cogl-blend-string.h | 0 {common => cogl}/cogl-clip-stack.c | 0 {common => cogl}/cogl-clip-stack.h | 0 {common => cogl}/cogl-color.c | 0 cogl-color.h => cogl/cogl-color.h | 0 {common => cogl}/cogl-context.c | 0 {common => cogl}/cogl-context.h | 0 {common => cogl}/cogl-current-matrix.c | 0 {common => cogl}/cogl-current-matrix.h | 0 {common => cogl}/cogl-debug.c | 0 cogl-debug.h => cogl/cogl-debug.h | 0 cogl-deprecated.h => cogl/cogl-deprecated.h | 0 {common => cogl}/cogl-enum-types.c.in | 0 {common => cogl}/cogl-enum-types.h.in | 0 {common => cogl}/cogl-fixed.c | 0 cogl-fixed.h => cogl/cogl-fixed.h | 0 {common => cogl}/cogl-handle.h | 0 {common => cogl}/cogl-internal.h | 0 {common => cogl}/cogl-material-private.h | 0 {common => cogl}/cogl-material.c | 0 cogl-material.h => cogl/cogl-material.h | 0 {common => cogl}/cogl-matrix-stack.c | 0 {common => cogl}/cogl-matrix-stack.h | 3 +- {common => cogl}/cogl-matrix.c | 0 cogl-matrix.h => cogl/cogl-matrix.h | 0 cogl-offscreen.h => cogl/cogl-offscreen.h | 0 cogl-path.h => cogl/cogl-path.h | 0 {common => cogl}/cogl-primitives.c | 0 {common => cogl}/cogl-primitives.h | 6 +- cogl-shader.h => cogl/cogl-shader.h | 0 {common => cogl}/cogl-texture-driver.h | 0 {common => cogl}/cogl-texture-private.h | 0 {common => cogl}/cogl-texture.c | 0 cogl-texture.h => cogl/cogl-texture.h | 0 cogl-types.h => cogl/cogl-types.h | 0 {common => cogl}/cogl-util.c | 0 {common => cogl}/cogl-util.h | 0 {common => cogl}/cogl-vertex-buffer-private.h | 0 {common => cogl}/cogl-vertex-buffer.c | 0 .../cogl-vertex-buffer.h | 0 {common => cogl}/cogl.c | 35 +++- cogl.h.in => cogl/cogl.h.in | 2 +- cogl/cogl.pc.in | 17 ++ cogl/driver/Makefile.am | 7 + cogl/driver/gl/Makefile.am | 39 +++++ {gl => cogl/driver/gl}/cogl-context-driver.c | 0 {gl => cogl/driver/gl}/cogl-context-driver.h | 0 {gl => cogl/driver/gl}/cogl-defines.h.in | 0 {gl => cogl/driver/gl}/cogl-fbo.c | 0 {gl => cogl/driver/gl}/cogl-fbo.h | 0 {gl => cogl/driver/gl}/cogl-primitives.c | 0 {gl => cogl/driver/gl}/cogl-program.c | 0 {gl => cogl/driver/gl}/cogl-program.h | 0 {gl => cogl/driver/gl}/cogl-shader-private.h | 0 {gl => cogl/driver/gl}/cogl-shader.c | 0 {gl => cogl/driver/gl}/cogl-texture-driver.c | 0 {gl => cogl/driver/gl}/cogl.c | 72 -------- cogl/driver/gles/Makefile.am | 62 +++++++ .../driver/gles}/cogl-context-driver.c | 0 .../driver/gles}/cogl-context-driver.h | 0 {gles => cogl/driver/gles}/cogl-defines.h.in | 0 {gles => cogl/driver/gles}/cogl-fbo.c | 0 {gles => cogl/driver/gles}/cogl-fbo.h | 0 .../gles}/cogl-fixed-fragment-shader.glsl | 0 .../gles}/cogl-fixed-vertex-shader.glsl | 0 .../driver/gles}/cogl-gles2-wrapper.c | 0 .../driver/gles}/cogl-gles2-wrapper.h | 0 {gles => cogl/driver/gles}/cogl-primitives.c | 0 {gles => cogl/driver/gles}/cogl-program.c | 0 {gles => cogl/driver/gles}/cogl-program.h | 0 .../driver/gles}/cogl-shader-private.h | 0 {gles => cogl/driver/gles}/cogl-shader.c | 0 .../driver/gles}/cogl-texture-driver.c | 0 {gles => cogl/driver/gles}/cogl-util.c | 0 {gles => cogl/driver/gles}/cogl-util.h | 0 {gles => cogl/driver/gles}/cogl.c | 10 -- {gles => cogl/driver/gles}/stringify.sh | 0 {common => cogl}/stb_image.c | 0 cogl/winsys/Makefile.am | 43 +++++ cogl/winsys/cogl-eglnative.c | 35 ++++ cogl/winsys/cogl-eglx.c | 35 ++++ cogl/winsys/cogl-fruity.c | 35 ++++ cogl/winsys/cogl-glx.c | 78 +++++++++ cogl/winsys/cogl-osx.c | 35 ++++ cogl/winsys/cogl-sdl.c | 35 ++++ cogl/winsys/cogl-win32.c | 35 ++++ cogl/winsys/cogl-winsys.h | 30 ++++ common/Makefile.am | 96 ----------- doc/reference/cogl/Makefile.am | 11 +- 99 files changed, 687 insertions(+), 324 deletions(-) delete mode 100644 TODO delete mode 100644 cogl.pc.in create mode 100644 cogl/Makefile.am rename {common => cogl}/cogl-bitmap-fallback.c (100%) rename {common => cogl}/cogl-bitmap-pixbuf.c (100%) rename {common => cogl}/cogl-bitmap-private.h (100%) rename {common => cogl}/cogl-bitmap.c (100%) rename cogl-bitmap.h => cogl/cogl-bitmap.h (100%) rename {common => cogl}/cogl-blend-string.c (100%) rename {common => cogl}/cogl-blend-string.h (100%) rename {common => cogl}/cogl-clip-stack.c (100%) rename {common => cogl}/cogl-clip-stack.h (100%) rename {common => cogl}/cogl-color.c (100%) rename cogl-color.h => cogl/cogl-color.h (100%) rename {common => cogl}/cogl-context.c (100%) rename {common => cogl}/cogl-context.h (100%) rename {common => cogl}/cogl-current-matrix.c (100%) rename {common => cogl}/cogl-current-matrix.h (100%) rename {common => cogl}/cogl-debug.c (100%) rename cogl-debug.h => cogl/cogl-debug.h (100%) rename cogl-deprecated.h => cogl/cogl-deprecated.h (100%) rename {common => cogl}/cogl-enum-types.c.in (100%) rename {common => cogl}/cogl-enum-types.h.in (100%) rename {common => cogl}/cogl-fixed.c (100%) rename cogl-fixed.h => cogl/cogl-fixed.h (100%) rename {common => cogl}/cogl-handle.h (100%) rename {common => cogl}/cogl-internal.h (100%) rename {common => cogl}/cogl-material-private.h (100%) rename {common => cogl}/cogl-material.c (100%) rename cogl-material.h => cogl/cogl-material.h (100%) rename {common => cogl}/cogl-matrix-stack.c (100%) rename {common => cogl}/cogl-matrix-stack.h (98%) rename {common => cogl}/cogl-matrix.c (100%) rename cogl-matrix.h => cogl/cogl-matrix.h (100%) rename cogl-offscreen.h => cogl/cogl-offscreen.h (100%) rename cogl-path.h => cogl/cogl-path.h (100%) rename {common => cogl}/cogl-primitives.c (100%) rename {common => cogl}/cogl-primitives.h (96%) rename cogl-shader.h => cogl/cogl-shader.h (100%) rename {common => cogl}/cogl-texture-driver.h (100%) rename {common => cogl}/cogl-texture-private.h (100%) rename {common => cogl}/cogl-texture.c (100%) rename cogl-texture.h => cogl/cogl-texture.h (100%) rename cogl-types.h => cogl/cogl-types.h (100%) rename {common => cogl}/cogl-util.c (100%) rename {common => cogl}/cogl-util.h (100%) rename {common => cogl}/cogl-vertex-buffer-private.h (100%) rename {common => cogl}/cogl-vertex-buffer.c (100%) rename cogl-vertex-buffer.h => cogl/cogl-vertex-buffer.h (100%) rename {common => cogl}/cogl.c (97%) rename cogl.h.in => cogl/cogl.h.in (99%) create mode 100644 cogl/cogl.pc.in create mode 100644 cogl/driver/Makefile.am create mode 100644 cogl/driver/gl/Makefile.am rename {gl => cogl/driver/gl}/cogl-context-driver.c (100%) rename {gl => cogl/driver/gl}/cogl-context-driver.h (100%) rename {gl => cogl/driver/gl}/cogl-defines.h.in (100%) rename {gl => cogl/driver/gl}/cogl-fbo.c (100%) rename {gl => cogl/driver/gl}/cogl-fbo.h (100%) rename {gl => cogl/driver/gl}/cogl-primitives.c (100%) rename {gl => cogl/driver/gl}/cogl-program.c (100%) rename {gl => cogl/driver/gl}/cogl-program.h (100%) rename {gl => cogl/driver/gl}/cogl-shader-private.h (100%) rename {gl => cogl/driver/gl}/cogl-shader.c (100%) rename {gl => cogl/driver/gl}/cogl-texture-driver.c (100%) rename {gl => cogl/driver/gl}/cogl.c (89%) create mode 100644 cogl/driver/gles/Makefile.am rename {gles => cogl/driver/gles}/cogl-context-driver.c (100%) rename {gles => cogl/driver/gles}/cogl-context-driver.h (100%) rename {gles => cogl/driver/gles}/cogl-defines.h.in (100%) rename {gles => cogl/driver/gles}/cogl-fbo.c (100%) rename {gles => cogl/driver/gles}/cogl-fbo.h (100%) rename {gles => cogl/driver/gles}/cogl-fixed-fragment-shader.glsl (100%) rename {gles => cogl/driver/gles}/cogl-fixed-vertex-shader.glsl (100%) rename {gles => cogl/driver/gles}/cogl-gles2-wrapper.c (100%) rename {gles => cogl/driver/gles}/cogl-gles2-wrapper.h (100%) rename {gles => cogl/driver/gles}/cogl-primitives.c (100%) rename {gles => cogl/driver/gles}/cogl-program.c (100%) rename {gles => cogl/driver/gles}/cogl-program.h (100%) rename {gles => cogl/driver/gles}/cogl-shader-private.h (100%) rename {gles => cogl/driver/gles}/cogl-shader.c (100%) rename {gles => cogl/driver/gles}/cogl-texture-driver.c (100%) rename {gles => cogl/driver/gles}/cogl-util.c (100%) rename {gles => cogl/driver/gles}/cogl-util.h (100%) rename {gles => cogl/driver/gles}/cogl.c (91%) rename {gles => cogl/driver/gles}/stringify.sh (100%) rename {common => cogl}/stb_image.c (100%) create mode 100644 cogl/winsys/Makefile.am create mode 100644 cogl/winsys/cogl-eglnative.c create mode 100644 cogl/winsys/cogl-eglx.c create mode 100644 cogl/winsys/cogl-fruity.c create mode 100644 cogl/winsys/cogl-glx.c create mode 100644 cogl/winsys/cogl-osx.c create mode 100644 cogl/winsys/cogl-sdl.c create mode 100644 cogl/winsys/cogl-win32.c create mode 100644 cogl/winsys/cogl-winsys.h delete mode 100644 common/Makefile.am diff --git a/Makefile.am b/Makefile.am index 58f762fa1..e13c1b481 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,88 +1 @@ -include $(top_srcdir)/build/autotools/Makefile.am.silent - -NULL = - -SUBDIRS = common $(CLUTTER_COGL) - -BUILT_SOURCES = cogl.h - -EXTRA_DIST = cogl.h.in cogl.pc.in - -DIST_SUBDIRS = common gl gles - -pc_files = \ - cogl-$(CLUTTER_COGL)-$(CLUTTER_API_VERSION).pc \ - cogl-$(CLUTTER_API_VERSION).pc - -cogl-$(CLUTTER_API_VERSION).pc: cogl.pc - $(QUIET_GEN)cp -f $< $(@F) - -cogl-$(CLUTTER_COGL)-$(CLUTTER_API_VERSION).pc: cogl.pc - $(QUIET_GEN)cp -f $< $(@F) - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = $(pc_files) - -CLEANFILES = $(pc_files) - -AM_CPPFLAGS = $(CLUTTER_CFLAGS) $(CLUTTER_DEBUG_CFLAGS) $(MAINTAINER_CFLAGS) - -# COGL installed headers -cogl_headers = \ - $(top_srcdir)/clutter/cogl/cogl-bitmap.h \ - $(top_srcdir)/clutter/cogl/cogl-color.h \ - $(top_srcdir)/clutter/cogl/cogl-debug.h \ - $(top_srcdir)/clutter/cogl/cogl-deprecated.h \ - $(top_srcdir)/clutter/cogl/cogl-fixed.h \ - $(top_srcdir)/clutter/cogl/cogl-material.h \ - $(top_srcdir)/clutter/cogl/cogl-matrix.h \ - $(top_srcdir)/clutter/cogl/cogl-offscreen.h \ - $(top_srcdir)/clutter/cogl/cogl-path.h \ - $(top_srcdir)/clutter/cogl/cogl-shader.h \ - $(top_srcdir)/clutter/cogl/cogl-texture.h \ - $(top_srcdir)/clutter/cogl/cogl-types.h \ - $(top_srcdir)/clutter/cogl/cogl-vertex-buffer.h \ - $(top_builddir)/clutter/cogl/cogl-defines-@CLUTTER_COGL@.h \ - $(top_builddir)/clutter/cogl/cogl-enum-types.h \ - $(top_builddir)/clutter/cogl/cogl.h \ - $(NULL) - -# this is copied in from common/ to make cogl.h work, but we -# need to clean it up ourselves once we're done -DISTCLEANFILES = cogl-enum-types.h - -# HACK - gobject-introspection can't scan a library in another directory -# so we create a libclutter-cogl.la that's just identical to the one -# in the subdir -noinst_LTLIBRARIES = libclutter-cogl.la -libclutter_cogl_la_LIBADD = $(CLUTTER_COGL)/libclutter-cogl-$(CLUTTER_COGL).la -libclutter_cogl_la_SOURCES = $(cogl_headers) - -coglincludedir = $(includedir)/clutter-@CLUTTER_API_VERSION@/cogl -coglinclude_HEADERS = $(cogl_headers) - -if HAVE_INTROSPECTION -Cogl-@CLUTTER_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libclutter-cogl.la - $(QUIET_GEN)$(INTROSPECTION_SCANNER) -v \ - --namespace Cogl --nsversion=@CLUTTER_API_VERSION@ \ - -I$(top_srcdir)/clutter/cogl \ - -I$(top_srcdir)/clutter/cogl/common \ - -I$(top_srcdir)/clutter/cogl/@CLUTTER_COGL@ \ - -I$(top_builddir)/clutter \ - -DCLUTTER_COMPILATION \ - --c-include='cogl/cogl.h' \ - --include=GL-1.0 \ - --include=GObject-2.0 \ - --library=libclutter-cogl.la \ - --libtool="$(top_builddir)/libtool" \ - --pkg gobject-2.0 \ - --output $@ \ - $(cogl_headers) - -BUILT_GIRSOURCES = Cogl-@CLUTTER_API_VERSION@.gir - -girdir = $(datadir)/gir-1.0 -gir_DATA = $(BUILT_GIRSOURCES) - -CLEANFILES += $(BUILT_GIRSOURCES) -endif +SUBDIRS = cogl diff --git a/TODO b/TODO deleted file mode 100644 index e1e5d316c..000000000 --- a/TODO +++ /dev/null @@ -1,25 +0,0 @@ -============================ -Cogl overhaul related tasks: -============================ - -MISC - -- implemenent a 1 to 1 mapping of COGL_FEATURE flags - into CLUTTER_FEATURE flags before combining them - into final clutter flags value (clutter-feature.c) - -TEXTURE - -- cogl_texture_get_data, cogl_texture_set_region in GLES - -- YUV texture format support (multitexturing + shader) - -FBO - -- add stencil, depth and other renderbuffers to fbos - -- cogl_offscreen_new_multisample - -- test cogl_offscreen_blit - -- add "filter" argument to cogl_offscreen_blit diff --git a/cogl.pc.in b/cogl.pc.in deleted file mode 100644 index 87196733b..000000000 --- a/cogl.pc.in +++ /dev/null @@ -1,15 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ -apiversion=@CLUTTER_API_VERSION@ -requires=@CLUTTER_REQUIRES@ -backend=@clutterbackend@ -cogl=@CLUTTER_COGL@ - -Name: COGL -Description: Clutter GL abstraction library (${cogl} backend) -Version: @VERSION@ -Libs: -L${libdir} -lclutter-${backend}-${apiversion} -Cflags: -I${includedir}/clutter-${apiversion} -Requires: ${requires} diff --git a/cogl/Makefile.am b/cogl/Makefile.am new file mode 100644 index 000000000..e9be04ab3 --- /dev/null +++ b/cogl/Makefile.am @@ -0,0 +1,161 @@ +include $(top_srcdir)/build/autotools/Makefile.am.silent + +NULL = + +SUBDIRS = winsys driver + +BUILT_SOURCES = cogl.h + +EXTRA_DIST = cogl.h.in cogl.pc.in + +pc_files = \ + cogl-$(COGL_DRIVER)-$(CLUTTER_API_VERSION).pc \ + cogl-$(CLUTTER_API_VERSION).pc + +cogl-$(CLUTTER_API_VERSION).pc: cogl.pc + $(QUIET_GEN)cp -f $< $(@F) + +cogl-$(COGL_DRIVER)-$(CLUTTER_API_VERSION).pc: cogl.pc + $(QUIET_GEN)cp -f $< $(@F) + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = $(pc_files) + +CLEANFILES = $(pc_files) + +INCLUDES = \ + -I$(top_srcdir) \ + -I$(srcdir) \ + -I$(srcdir)/.. \ + -I$(srcdir)/winsys \ + -I$(srcdir)/driver/$(COGL_DRIVER) \ + -I. \ + -I.. \ + -DG_DISABLE_SINGLE_INCLUDES \ + -DG_LOG_DOMAIN=\"Cogl-Core\" \ + -DCLUTTER_COMPILATION + +cogl_public_h = \ + $(srcdir)/cogl-bitmap.h \ + $(srcdir)/cogl-color.h \ + $(srcdir)/cogl-debug.h \ + $(srcdir)/cogl-fixed.h \ + $(srcdir)/cogl-material.h \ + $(srcdir)/cogl-matrix.h \ + $(srcdir)/cogl-offscreen.h \ + $(srcdir)/cogl-path.h \ + $(srcdir)/cogl-shader.h \ + $(srcdir)/cogl-texture.h \ + $(srcdir)/cogl-types.h \ + $(srcdir)/cogl-vertex-buffer.h \ + cogl.h \ + $(NULL) + +cogl-enum-types.h: stamp-cogl-enum-types.h + @true +stamp-cogl-enum-types.h: $(cogl_public_h) Makefile + $(QUIET_GEN)( $(GLIB_MKENUMS) \ + --template $(srcdir)/cogl-enum-types.h.in \ + $(cogl_public_h) ) > xgen-ceth \ + && (cmp -s xgen-ceth cogl-enum-types.h || cp -f xgen-ceth cogl-enum-types.h) \ + && rm -f xgen-ceth \ + && echo timestamp > $(@F) + +cogl-enum-types.c: cogl-enum-types.h + $(QUIET_GEN)( $(GLIB_MKENUMS) \ + --template $(srcdir)/cogl-enum-types.c.in \ + $(cogl_public_h) ) > xgen-cetc \ + && cp -f xgen-cetc cogl-enum-types.c \ + && rm -f xgen-cetc + +BUILT_SOURCES += cogl-enum-types.h cogl-enum-types.c + +noinst_LTLIBRARIES = libclutter-cogl.la +libclutter_cogl_la_CPPFLAGS = \ + $(CLUTTER_CFLAGS) \ + $(COGL_DEBUG_CFLAGS) \ + $(CLUTTER_DEBUG_CFLAGS) \ + $(MAINTAINER_CFLAGS) +libclutter_cogl_la_LIBADD = \ + -lm $(CLUTTER_LIBS) \ + winsys/libclutter-cogl-winsys.la \ + driver/$(COGL_DRIVER)/libclutter-cogl-driver.la +# os/$(COGL_DRIVER)/libclutter-cogl-os.la +libclutter_cogl_la_SOURCES = \ + cogl-enum-types.h \ + cogl-enum-types.c \ + cogl-handle.h \ + cogl-context.h \ + cogl-context.c \ + cogl-internal.h \ + cogl.c \ + cogl-util.h \ + cogl-util.c \ + cogl-bitmap-private.h \ + cogl-bitmap.c \ + cogl-bitmap-fallback.c \ + cogl-current-matrix.c \ + cogl-current-matrix.h \ + cogl-primitives.h \ + cogl-primitives.c \ + cogl-bitmap-pixbuf.c \ + cogl-clip-stack.h \ + cogl-clip-stack.c \ + cogl-fixed.c \ + cogl-color.c \ + cogl-vertex-buffer-private.h \ + cogl-vertex-buffer.c \ + cogl-matrix.c \ + cogl-matrix-stack.c \ + cogl-matrix-stack.h \ + cogl-material.c \ + cogl-material-private.h \ + cogl-blend-string.c \ + cogl-blend-string.h \ + cogl-debug.c \ + cogl-texture-private.h \ + cogl-texture-driver.h \ + cogl-texture.c \ + $(NULL) + +EXTRA_DIST += stb_image.c cogl-enum-types.h.in cogl-enum-types.c.in +CLEANFILES += stamp-cogl-enum-types.h +DISTCLEANFILES = cogl-enum-types.h cogl-enum-types.c + +# COGL installed headers +cogl_headers = \ + $(cogl_public_h) \ + cogl-deprecated.h \ + cogl-defines-@COGL_DRIVER@.h \ + cogl-enum-types.h \ + $(NULL) + +coglincludedir = $(includedir)/clutter-@CLUTTER_API_VERSION@/cogl +coglinclude_HEADERS = $(cogl_headers) + +if HAVE_INTROSPECTION +Cogl-@CLUTTER_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libclutter-cogl.la + $(QUIET_GEN)$(INTROSPECTION_SCANNER) -v \ + --namespace Cogl --nsversion=@CLUTTER_API_VERSION@ \ + -I$(srcdir) \ + -I$(srcdir)/.. \ + -I$(srcdir)/winsys \ + -I$(srcdir)/driver/@COGL_DRIVER@ \ + -DCLUTTER_COMPILATION \ + --c-include='cogl/cogl.h' \ + --include=GL-1.0 \ + --include=GObject-2.0 \ + --library=libclutter-cogl.la \ + --libtool="$(top_builddir)/libtool" \ + --pkg gobject-2.0 \ + --output $@ \ + $(cogl_headers) + +BUILT_GIRSOURCES = Cogl-@CLUTTER_API_VERSION@.gir + +girdir = $(datadir)/gir-1.0 +gir_DATA = $(BUILT_GIRSOURCES) + +CLEANFILES += $(BUILT_GIRSOURCES) +endif + diff --git a/common/cogl-bitmap-fallback.c b/cogl/cogl-bitmap-fallback.c similarity index 100% rename from common/cogl-bitmap-fallback.c rename to cogl/cogl-bitmap-fallback.c diff --git a/common/cogl-bitmap-pixbuf.c b/cogl/cogl-bitmap-pixbuf.c similarity index 100% rename from common/cogl-bitmap-pixbuf.c rename to cogl/cogl-bitmap-pixbuf.c diff --git a/common/cogl-bitmap-private.h b/cogl/cogl-bitmap-private.h similarity index 100% rename from common/cogl-bitmap-private.h rename to cogl/cogl-bitmap-private.h diff --git a/common/cogl-bitmap.c b/cogl/cogl-bitmap.c similarity index 100% rename from common/cogl-bitmap.c rename to cogl/cogl-bitmap.c diff --git a/cogl-bitmap.h b/cogl/cogl-bitmap.h similarity index 100% rename from cogl-bitmap.h rename to cogl/cogl-bitmap.h diff --git a/common/cogl-blend-string.c b/cogl/cogl-blend-string.c similarity index 100% rename from common/cogl-blend-string.c rename to cogl/cogl-blend-string.c diff --git a/common/cogl-blend-string.h b/cogl/cogl-blend-string.h similarity index 100% rename from common/cogl-blend-string.h rename to cogl/cogl-blend-string.h diff --git a/common/cogl-clip-stack.c b/cogl/cogl-clip-stack.c similarity index 100% rename from common/cogl-clip-stack.c rename to cogl/cogl-clip-stack.c diff --git a/common/cogl-clip-stack.h b/cogl/cogl-clip-stack.h similarity index 100% rename from common/cogl-clip-stack.h rename to cogl/cogl-clip-stack.h diff --git a/common/cogl-color.c b/cogl/cogl-color.c similarity index 100% rename from common/cogl-color.c rename to cogl/cogl-color.c diff --git a/cogl-color.h b/cogl/cogl-color.h similarity index 100% rename from cogl-color.h rename to cogl/cogl-color.h diff --git a/common/cogl-context.c b/cogl/cogl-context.c similarity index 100% rename from common/cogl-context.c rename to cogl/cogl-context.c diff --git a/common/cogl-context.h b/cogl/cogl-context.h similarity index 100% rename from common/cogl-context.h rename to cogl/cogl-context.h diff --git a/common/cogl-current-matrix.c b/cogl/cogl-current-matrix.c similarity index 100% rename from common/cogl-current-matrix.c rename to cogl/cogl-current-matrix.c diff --git a/common/cogl-current-matrix.h b/cogl/cogl-current-matrix.h similarity index 100% rename from common/cogl-current-matrix.h rename to cogl/cogl-current-matrix.h diff --git a/common/cogl-debug.c b/cogl/cogl-debug.c similarity index 100% rename from common/cogl-debug.c rename to cogl/cogl-debug.c diff --git a/cogl-debug.h b/cogl/cogl-debug.h similarity index 100% rename from cogl-debug.h rename to cogl/cogl-debug.h diff --git a/cogl-deprecated.h b/cogl/cogl-deprecated.h similarity index 100% rename from cogl-deprecated.h rename to cogl/cogl-deprecated.h diff --git a/common/cogl-enum-types.c.in b/cogl/cogl-enum-types.c.in similarity index 100% rename from common/cogl-enum-types.c.in rename to cogl/cogl-enum-types.c.in diff --git a/common/cogl-enum-types.h.in b/cogl/cogl-enum-types.h.in similarity index 100% rename from common/cogl-enum-types.h.in rename to cogl/cogl-enum-types.h.in diff --git a/common/cogl-fixed.c b/cogl/cogl-fixed.c similarity index 100% rename from common/cogl-fixed.c rename to cogl/cogl-fixed.c diff --git a/cogl-fixed.h b/cogl/cogl-fixed.h similarity index 100% rename from cogl-fixed.h rename to cogl/cogl-fixed.h diff --git a/common/cogl-handle.h b/cogl/cogl-handle.h similarity index 100% rename from common/cogl-handle.h rename to cogl/cogl-handle.h diff --git a/common/cogl-internal.h b/cogl/cogl-internal.h similarity index 100% rename from common/cogl-internal.h rename to cogl/cogl-internal.h diff --git a/common/cogl-material-private.h b/cogl/cogl-material-private.h similarity index 100% rename from common/cogl-material-private.h rename to cogl/cogl-material-private.h diff --git a/common/cogl-material.c b/cogl/cogl-material.c similarity index 100% rename from common/cogl-material.c rename to cogl/cogl-material.c diff --git a/cogl-material.h b/cogl/cogl-material.h similarity index 100% rename from cogl-material.h rename to cogl/cogl-material.h diff --git a/common/cogl-matrix-stack.c b/cogl/cogl-matrix-stack.c similarity index 100% rename from common/cogl-matrix-stack.c rename to cogl/cogl-matrix-stack.c diff --git a/common/cogl-matrix-stack.h b/cogl/cogl-matrix-stack.h similarity index 98% rename from common/cogl-matrix-stack.h rename to cogl/cogl-matrix-stack.h index c2d0048f5..1762eda95 100644 --- a/common/cogl-matrix-stack.h +++ b/cogl/cogl-matrix-stack.h @@ -27,7 +27,8 @@ #ifndef __COGL_MATRIX_STACK_H #define __COGL_MATRIX_STACK_H -#include +#include "cogl-matrix.h" +#include "cogl.h" /* needed for GLenum */ typedef struct _CoglMatrixStack CoglMatrixStack; diff --git a/common/cogl-matrix.c b/cogl/cogl-matrix.c similarity index 100% rename from common/cogl-matrix.c rename to cogl/cogl-matrix.c diff --git a/cogl-matrix.h b/cogl/cogl-matrix.h similarity index 100% rename from cogl-matrix.h rename to cogl/cogl-matrix.h diff --git a/cogl-offscreen.h b/cogl/cogl-offscreen.h similarity index 100% rename from cogl-offscreen.h rename to cogl/cogl-offscreen.h diff --git a/cogl-path.h b/cogl/cogl-path.h similarity index 100% rename from cogl-path.h rename to cogl/cogl-path.h diff --git a/common/cogl-primitives.c b/cogl/cogl-primitives.c similarity index 100% rename from common/cogl-primitives.c rename to cogl/cogl-primitives.c diff --git a/common/cogl-primitives.h b/cogl/cogl-primitives.h similarity index 96% rename from common/cogl-primitives.h rename to cogl/cogl-primitives.h index dd5a73c8b..c2d76d62a 100644 --- a/common/cogl-primitives.h +++ b/cogl/cogl-primitives.h @@ -37,9 +37,9 @@ struct _floatVec2 struct _CoglPathNode { - GLfloat x; - GLfloat y; - guint path_size; + float x; + float y; + guint path_size; }; struct _CoglBezQuad diff --git a/cogl-shader.h b/cogl/cogl-shader.h similarity index 100% rename from cogl-shader.h rename to cogl/cogl-shader.h diff --git a/common/cogl-texture-driver.h b/cogl/cogl-texture-driver.h similarity index 100% rename from common/cogl-texture-driver.h rename to cogl/cogl-texture-driver.h diff --git a/common/cogl-texture-private.h b/cogl/cogl-texture-private.h similarity index 100% rename from common/cogl-texture-private.h rename to cogl/cogl-texture-private.h diff --git a/common/cogl-texture.c b/cogl/cogl-texture.c similarity index 100% rename from common/cogl-texture.c rename to cogl/cogl-texture.c diff --git a/cogl-texture.h b/cogl/cogl-texture.h similarity index 100% rename from cogl-texture.h rename to cogl/cogl-texture.h diff --git a/cogl-types.h b/cogl/cogl-types.h similarity index 100% rename from cogl-types.h rename to cogl/cogl-types.h diff --git a/common/cogl-util.c b/cogl/cogl-util.c similarity index 100% rename from common/cogl-util.c rename to cogl/cogl-util.c diff --git a/common/cogl-util.h b/cogl/cogl-util.h similarity index 100% rename from common/cogl-util.h rename to cogl/cogl-util.h diff --git a/common/cogl-vertex-buffer-private.h b/cogl/cogl-vertex-buffer-private.h similarity index 100% rename from common/cogl-vertex-buffer-private.h rename to cogl/cogl-vertex-buffer-private.h diff --git a/common/cogl-vertex-buffer.c b/cogl/cogl-vertex-buffer.c similarity index 100% rename from common/cogl-vertex-buffer.c rename to cogl/cogl-vertex-buffer.c diff --git a/cogl-vertex-buffer.h b/cogl/cogl-vertex-buffer.h similarity index 100% rename from cogl-vertex-buffer.h rename to cogl/cogl-vertex-buffer.h diff --git a/common/cogl.c b/cogl/cogl.c similarity index 97% rename from common/cogl.c rename to cogl/cogl.c index 85e937030..e16637e32 100644 --- a/common/cogl.c +++ b/cogl/cogl.c @@ -30,19 +30,14 @@ #include #include #include - -#ifdef HAVE_CLUTTER_GLX -#include -#include - -typedef CoglFuncPtr (*GLXGetProcAddressProc) (const guint8 *procName); -#endif +#include #include "cogl-debug.h" #include "cogl-internal.h" #include "cogl-util.h" #include "cogl-context.h" #include "cogl-material-private.h" +#include "cogl-winsys.h" #if defined (HAVE_COGL_GLES2) || defined (HAVE_COGL_GLES) #include "cogl-gles2-wrapper.h" @@ -88,6 +83,32 @@ cogl_gl_error_to_string (GLenum error_code) } #endif /* COGL_GL_DEBUG */ +CoglFuncPtr +cogl_get_proc_address (const gchar* name) +{ + void *address; + static GModule *module = NULL; + + address = _cogl_winsys_get_proc_address (name); + if (address) + return address; + + /* this should find the right function if the program is linked against a + * library providing it */ + if (module == NULL) + module = g_module_open (NULL, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL); + + if (module) + { + gpointer symbol; + + if (g_module_symbol (module, name, &symbol)) + return symbol; + } + + return NULL; +} + void cogl_clear (const CoglColor *color, gulong buffers) { diff --git a/cogl.h.in b/cogl/cogl.h.in similarity index 99% rename from cogl.h.in rename to cogl/cogl.h.in index 9d3876913..524aec71d 100644 --- a/cogl.h.in +++ b/cogl/cogl.h.in @@ -29,7 +29,7 @@ #define __COGL_H_INSIDE__ -#include +#include #include #include diff --git a/cogl/cogl.pc.in b/cogl/cogl.pc.in new file mode 100644 index 000000000..7975f4f3a --- /dev/null +++ b/cogl/cogl.pc.in @@ -0,0 +1,17 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +apiversion=@CLUTTER_API_VERSION@ +requires=@CLUTTER_REQUIRES@ +backend=@COGL_WINSYS@ #only kept for backward compatability +winsys=@COGL_WINSYS@ +cogl=@COGL_DRIVER@ #only kept for backward compatability +driver=@COGL_DRIVER@ + +Name: COGL +Description: Clutter GL abstraction library (${winsys}/${driver} backend) +Version: @VERSION@ +Libs: -L${libdir} -lclutter-${winsys}-${apiversion} +Cflags: -I${includedir}/clutter-${apiversion} +Requires: ${requires} diff --git a/cogl/driver/Makefile.am b/cogl/driver/Makefile.am new file mode 100644 index 000000000..e39b278ec --- /dev/null +++ b/cogl/driver/Makefile.am @@ -0,0 +1,7 @@ +include $(top_srcdir)/build/autotools/Makefile.am.silent + +NULL = + +SUBDIRS = $(COGL_DRIVER) + +DIST_SUBDIRS = gl gles diff --git a/cogl/driver/gl/Makefile.am b/cogl/driver/gl/Makefile.am new file mode 100644 index 000000000..81a21c90e --- /dev/null +++ b/cogl/driver/gl/Makefile.am @@ -0,0 +1,39 @@ +include $(top_srcdir)/build/autotools/Makefile.am.silent + +NULL = + +INCLUDES = \ + -I$(top_srcdir) \ + -I$(srcdir) \ + -I$(srcdir)/../.. \ + -I$(srcdir)/../../.. \ + -I$(srcdir)/winsys \ + -I$(srcdir)/driver/$(COGL_DRIVER) \ + -I../.. \ + -I../../.. \ + -DG_DISABLE_SINGLE_INCLUDES \ + -DG_LOG_DOMAIN=\"Cogl-Driver\" \ + -DCLUTTER_COMPILATION + +noinst_LTLIBRARIES = libclutter-cogl-driver.la +libclutter_cogl_driver_la_CPPFLAGS = \ + $(CLUTTER_CFLAGS) \ + $(COGL_DEBUG_CFLAGS) \ + $(CLUTTER_DEBUG_CFLAGS) \ + $(MAINTAINER_CFLAGS) +libclutter_cogl_driver_la_SOURCES = \ + cogl.c \ + cogl-primitives.c \ + cogl-texture-driver.c \ + cogl-fbo.h \ + cogl-fbo.c \ + cogl-shader-private.h \ + cogl-shader.c \ + cogl-program.h \ + cogl-program.c \ + cogl-context-driver.h \ + cogl-context-driver.c \ + $(NULL) + +EXTRA_DIST = cogl-defines.h.in + diff --git a/gl/cogl-context-driver.c b/cogl/driver/gl/cogl-context-driver.c similarity index 100% rename from gl/cogl-context-driver.c rename to cogl/driver/gl/cogl-context-driver.c diff --git a/gl/cogl-context-driver.h b/cogl/driver/gl/cogl-context-driver.h similarity index 100% rename from gl/cogl-context-driver.h rename to cogl/driver/gl/cogl-context-driver.h diff --git a/gl/cogl-defines.h.in b/cogl/driver/gl/cogl-defines.h.in similarity index 100% rename from gl/cogl-defines.h.in rename to cogl/driver/gl/cogl-defines.h.in diff --git a/gl/cogl-fbo.c b/cogl/driver/gl/cogl-fbo.c similarity index 100% rename from gl/cogl-fbo.c rename to cogl/driver/gl/cogl-fbo.c diff --git a/gl/cogl-fbo.h b/cogl/driver/gl/cogl-fbo.h similarity index 100% rename from gl/cogl-fbo.h rename to cogl/driver/gl/cogl-fbo.h diff --git a/gl/cogl-primitives.c b/cogl/driver/gl/cogl-primitives.c similarity index 100% rename from gl/cogl-primitives.c rename to cogl/driver/gl/cogl-primitives.c diff --git a/gl/cogl-program.c b/cogl/driver/gl/cogl-program.c similarity index 100% rename from gl/cogl-program.c rename to cogl/driver/gl/cogl-program.c diff --git a/gl/cogl-program.h b/cogl/driver/gl/cogl-program.h similarity index 100% rename from gl/cogl-program.h rename to cogl/driver/gl/cogl-program.h diff --git a/gl/cogl-shader-private.h b/cogl/driver/gl/cogl-shader-private.h similarity index 100% rename from gl/cogl-shader-private.h rename to cogl/driver/gl/cogl-shader-private.h diff --git a/gl/cogl-shader.c b/cogl/driver/gl/cogl-shader.c similarity index 100% rename from gl/cogl-shader.c rename to cogl/driver/gl/cogl-shader.c diff --git a/gl/cogl-texture-driver.c b/cogl/driver/gl/cogl-texture-driver.c similarity index 100% rename from gl/cogl-texture-driver.c rename to cogl/driver/gl/cogl-texture-driver.c diff --git a/gl/cogl.c b/cogl/driver/gl/cogl.c similarity index 89% rename from gl/cogl.c rename to cogl/driver/gl/cogl.c index 841981549..04d3b750a 100644 --- a/gl/cogl.c +++ b/cogl/driver/gl/cogl.c @@ -26,84 +26,12 @@ #endif #include -#include #include "cogl.h" -#ifdef HAVE_CLUTTER_GLX -#include -#include - -typedef CoglFuncPtr (*GLXGetProcAddressProc) (const guint8 *procName); -#endif - #include "cogl-internal.h" #include "cogl-context.h" -CoglFuncPtr -cogl_get_proc_address (const gchar* name) -{ - /* Sucks to ifdef here but not other option..? would be nice to - * split the code up for more reuse (once more backends use this - */ -#if defined(HAVE_CLUTTER_GLX) - static GLXGetProcAddressProc get_proc_func = NULL; - static void *dlhand = NULL; - - if (get_proc_func == NULL && dlhand == NULL) - { - dlhand = dlopen (NULL, RTLD_LAZY); - - if (dlhand) - { - dlerror (); - - get_proc_func = - (GLXGetProcAddressProc) dlsym (dlhand, "glXGetProcAddress"); - - if (dlerror () != NULL) - { - get_proc_func = - (GLXGetProcAddressProc) dlsym (dlhand, "glXGetProcAddressARB"); - } - - if (dlerror () != NULL) - { - get_proc_func = NULL; - g_warning ("failed to bind GLXGetProcAddress " - "or GLXGetProcAddressARB"); - } - } - } - - if (get_proc_func) - return get_proc_func ((unsigned char*) name); - -#elif defined(HAVE_CLUTTER_WIN32) - - return (CoglFuncPtr) wglGetProcAddress ((LPCSTR) name); - -#else /* HAVE_CLUTTER_WIN32 */ - - /* this should find the right function if the program is linked against a - * library providing it */ - static GModule *module = NULL; - if (module == NULL) - module = g_module_open (NULL, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL); - - if (module) - { - gpointer symbol; - - if (g_module_symbol (module, name, &symbol)) - return symbol; - } - -#endif /* HAVE_CLUTTER_WIN32 */ - - return NULL; -} - gboolean cogl_check_extension (const gchar *name, const gchar *ext) { diff --git a/cogl/driver/gles/Makefile.am b/cogl/driver/gles/Makefile.am new file mode 100644 index 000000000..df126c049 --- /dev/null +++ b/cogl/driver/gles/Makefile.am @@ -0,0 +1,62 @@ +include $(top_srcdir)/build/autotools/Makefile.am.silent + +NULL = + +INCLUDES = \ + -I$(top_srcdir) \ + -I$(srcdir) \ + -I$(srcdir)/../.. \ + -I$(srcdir)/../../.. \ + -I$(srcdir)/winsys \ + -I$(srcdir)/driver/$(COGL_DRIVER) \ + -I../.. \ + -I../../.. \ + -DG_DISABLE_SINGLE_INCLUDES \ + -DG_LOG_DOMAIN=\"Cogl-Driver\" \ + -DCLUTTER_COMPILATION + +noinst_LTLIBRARIES = libclutter-cogl-driver.la +libclutter_cogl_driver_la_CPPFLAGS = \ + $(CLUTTER_CFLAGS) \ + $(COGL_DEBUG_CFLAGS) \ + $(CLUTTER_DEBUG_CFLAGS) \ + $(MAINTAINER_CFLAGS) +libclutter_cogl_driver_la_SOURCES = \ + cogl-fbo.h \ + cogl.c \ + cogl-primitives.c \ + cogl-texture-driver.c \ + cogl-fbo.c \ + cogl-context-driver.c \ + cogl-gles2-wrapper.h \ + cogl-program.h \ + cogl-program.c \ + cogl-shader-private.h \ + cogl-shader.c + +if USE_GLES2_WRAPPER +libclutter_cogl_driver_la_SOURCES += \ + cogl-gles2-wrapper.c \ + cogl-fixed-vertex-shader.h \ + cogl-fixed-vertex-shader.c \ + cogl-fixed-fragment-shader.h \ + cogl-fixed-fragment-shader.c +endif + +EXTRA_DIST = \ + cogl-defines.h.in \ + stringify.sh \ + cogl-fixed-vertex-shader.glsl \ + cogl-fixed-fragment-shader.glsl + +BUILT_SOURCES = \ + cogl-fixed-vertex-shader.h \ + cogl-fixed-vertex-shader.c \ + cogl-fixed-fragment-shader.h \ + cogl-fixed-fragment-shader.c + +%.h: $(srcdir)/%.glsl + /bin/sh $(srcdir)/stringify.sh -h $< > $@ +%.c: $(srcdir)/%.glsl + /bin/sh $(srcdir)/stringify.sh $< > $@ + diff --git a/gles/cogl-context-driver.c b/cogl/driver/gles/cogl-context-driver.c similarity index 100% rename from gles/cogl-context-driver.c rename to cogl/driver/gles/cogl-context-driver.c diff --git a/gles/cogl-context-driver.h b/cogl/driver/gles/cogl-context-driver.h similarity index 100% rename from gles/cogl-context-driver.h rename to cogl/driver/gles/cogl-context-driver.h diff --git a/gles/cogl-defines.h.in b/cogl/driver/gles/cogl-defines.h.in similarity index 100% rename from gles/cogl-defines.h.in rename to cogl/driver/gles/cogl-defines.h.in diff --git a/gles/cogl-fbo.c b/cogl/driver/gles/cogl-fbo.c similarity index 100% rename from gles/cogl-fbo.c rename to cogl/driver/gles/cogl-fbo.c diff --git a/gles/cogl-fbo.h b/cogl/driver/gles/cogl-fbo.h similarity index 100% rename from gles/cogl-fbo.h rename to cogl/driver/gles/cogl-fbo.h diff --git a/gles/cogl-fixed-fragment-shader.glsl b/cogl/driver/gles/cogl-fixed-fragment-shader.glsl similarity index 100% rename from gles/cogl-fixed-fragment-shader.glsl rename to cogl/driver/gles/cogl-fixed-fragment-shader.glsl diff --git a/gles/cogl-fixed-vertex-shader.glsl b/cogl/driver/gles/cogl-fixed-vertex-shader.glsl similarity index 100% rename from gles/cogl-fixed-vertex-shader.glsl rename to cogl/driver/gles/cogl-fixed-vertex-shader.glsl diff --git a/gles/cogl-gles2-wrapper.c b/cogl/driver/gles/cogl-gles2-wrapper.c similarity index 100% rename from gles/cogl-gles2-wrapper.c rename to cogl/driver/gles/cogl-gles2-wrapper.c diff --git a/gles/cogl-gles2-wrapper.h b/cogl/driver/gles/cogl-gles2-wrapper.h similarity index 100% rename from gles/cogl-gles2-wrapper.h rename to cogl/driver/gles/cogl-gles2-wrapper.h diff --git a/gles/cogl-primitives.c b/cogl/driver/gles/cogl-primitives.c similarity index 100% rename from gles/cogl-primitives.c rename to cogl/driver/gles/cogl-primitives.c diff --git a/gles/cogl-program.c b/cogl/driver/gles/cogl-program.c similarity index 100% rename from gles/cogl-program.c rename to cogl/driver/gles/cogl-program.c diff --git a/gles/cogl-program.h b/cogl/driver/gles/cogl-program.h similarity index 100% rename from gles/cogl-program.h rename to cogl/driver/gles/cogl-program.h diff --git a/gles/cogl-shader-private.h b/cogl/driver/gles/cogl-shader-private.h similarity index 100% rename from gles/cogl-shader-private.h rename to cogl/driver/gles/cogl-shader-private.h diff --git a/gles/cogl-shader.c b/cogl/driver/gles/cogl-shader.c similarity index 100% rename from gles/cogl-shader.c rename to cogl/driver/gles/cogl-shader.c diff --git a/gles/cogl-texture-driver.c b/cogl/driver/gles/cogl-texture-driver.c similarity index 100% rename from gles/cogl-texture-driver.c rename to cogl/driver/gles/cogl-texture-driver.c diff --git a/gles/cogl-util.c b/cogl/driver/gles/cogl-util.c similarity index 100% rename from gles/cogl-util.c rename to cogl/driver/gles/cogl-util.c diff --git a/gles/cogl-util.h b/cogl/driver/gles/cogl-util.h similarity index 100% rename from gles/cogl-util.h rename to cogl/driver/gles/cogl-util.h diff --git a/gles/cogl.c b/cogl/driver/gles/cogl.c similarity index 91% rename from gles/cogl.c rename to cogl/driver/gles/cogl.c index 0fcf4fc3b..aa7da6ef2 100644 --- a/gles/cogl.c +++ b/cogl/driver/gles/cogl.c @@ -31,17 +31,7 @@ #include "cogl-internal.h" #include "cogl-context.h" -CoglFuncPtr -cogl_get_proc_address (const gchar* name) -{ - return NULL; -} -gboolean -cogl_check_extension (const gchar *name, const gchar *ext) -{ - return FALSE; -} void _cogl_features_init (void) diff --git a/gles/stringify.sh b/cogl/driver/gles/stringify.sh similarity index 100% rename from gles/stringify.sh rename to cogl/driver/gles/stringify.sh diff --git a/common/stb_image.c b/cogl/stb_image.c similarity index 100% rename from common/stb_image.c rename to cogl/stb_image.c diff --git a/cogl/winsys/Makefile.am b/cogl/winsys/Makefile.am new file mode 100644 index 000000000..684da4aec --- /dev/null +++ b/cogl/winsys/Makefile.am @@ -0,0 +1,43 @@ +include $(top_srcdir)/build/autotools/Makefile.am.silent + +NULL = + +INCLUDES = \ + -I$(top_srcdir) \ + -I$(srcdir) \ + -I$(srcdir)/.. \ + -I$(srcdir)/../driver/$(COGL_DRIVER) \ + -I$(srcdir)/../.. \ + -I.. \ + -I../.. \ + -DG_DISABLE_SINGLE_INCLUDES \ + -DG_LOG_DOMAIN=\"Cogl-Winsys\" \ + -DCLUTTER_COMPILATION + +noinst_LTLIBRARIES = libclutter-cogl-winsys.la + +# Automake can't determine the full list if we are using autoconf substitutions +# to specify the files required for libclutter-cogl-winsys +all_winsys_sources = \ + cogl-glx.c \ + cogl-eglx.c \ + cogl-eglnative.c \ + cogl-sdl.c \ + cogl-win32.c \ + cogl-osx.c \ + cogl-winsys.h + $(NULL) + +libclutter_cogl_winsys_la_CPPFLAGS = \ + $(CLUTTER_CFLAGS) \ + $(COGL_DEBUG_CFLAGS) \ + $(CLUTTER_DEBUG_CFLAGS) \ + $(MAINTAINER_CFLAGS) +libclutter_cogl_winsys_la_LIBADD = -lm $(CLUTTER_LIBS) +libclutter_cogl_winsys_la_SOURCES = \ + cogl-@COGL_WINSYS@.h \ + cogl-@COGL_WINSYS@.c \ + $(NULL) + +EXTRA_DIST=$(all_winsys_sources) + diff --git a/cogl/winsys/cogl-eglnative.c b/cogl/winsys/cogl-eglnative.c new file mode 100644 index 000000000..3bf5b0fbb --- /dev/null +++ b/cogl/winsys/cogl-eglnative.c @@ -0,0 +1,35 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl.h" + +CoglFuncPtr +_cogl_winsys_get_proc_address (const char *name) +{ + return NULL; +} + diff --git a/cogl/winsys/cogl-eglx.c b/cogl/winsys/cogl-eglx.c new file mode 100644 index 000000000..3bf5b0fbb --- /dev/null +++ b/cogl/winsys/cogl-eglx.c @@ -0,0 +1,35 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl.h" + +CoglFuncPtr +_cogl_winsys_get_proc_address (const char *name) +{ + return NULL; +} + diff --git a/cogl/winsys/cogl-fruity.c b/cogl/winsys/cogl-fruity.c new file mode 100644 index 000000000..3bf5b0fbb --- /dev/null +++ b/cogl/winsys/cogl-fruity.c @@ -0,0 +1,35 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl.h" + +CoglFuncPtr +_cogl_winsys_get_proc_address (const char *name) +{ + return NULL; +} + diff --git a/cogl/winsys/cogl-glx.c b/cogl/winsys/cogl-glx.c new file mode 100644 index 000000000..fb5131227 --- /dev/null +++ b/cogl/winsys/cogl-glx.c @@ -0,0 +1,78 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl.h" + +#ifdef HAVE_CLUTTER_GLX +#include +#include + +typedef CoglFuncPtr (*GLXGetProcAddressProc) (const GLubyte *procName); +#endif + + +CoglFuncPtr +_cogl_winsys_get_proc_address (const char *name) +{ + static GLXGetProcAddressProc get_proc_func = NULL; + static void *dlhand = NULL; + + if (get_proc_func == NULL && dlhand == NULL) + { + dlhand = dlopen (NULL, RTLD_LAZY); + + if (!dlhand) + { + g_warning ("Failed to dlopen (NULL, RTDL_LAZY): %s", dlerror ()); + return NULL; + } + + dlerror (); + + get_proc_func = + (GLXGetProcAddressProc) dlsym (dlhand, "glXGetProcAddress"); + + if (dlerror () != NULL) + { + get_proc_func = + (GLXGetProcAddressProc) dlsym (dlhand, "glXGetProcAddressARB"); + } + + if (dlerror () != NULL) + { + get_proc_func = NULL; + g_warning ("failed to bind GLXGetProcAddress " + "or GLXGetProcAddressARB"); + } + } + + if (get_proc_func) + return get_proc_func ((GLubyte *) name); + + return NULL; +} + diff --git a/cogl/winsys/cogl-osx.c b/cogl/winsys/cogl-osx.c new file mode 100644 index 000000000..3bf5b0fbb --- /dev/null +++ b/cogl/winsys/cogl-osx.c @@ -0,0 +1,35 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl.h" + +CoglFuncPtr +_cogl_winsys_get_proc_address (const char *name) +{ + return NULL; +} + diff --git a/cogl/winsys/cogl-sdl.c b/cogl/winsys/cogl-sdl.c new file mode 100644 index 000000000..3bf5b0fbb --- /dev/null +++ b/cogl/winsys/cogl-sdl.c @@ -0,0 +1,35 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl.h" + +CoglFuncPtr +_cogl_winsys_get_proc_address (const char *name) +{ + return NULL; +} + diff --git a/cogl/winsys/cogl-win32.c b/cogl/winsys/cogl-win32.c new file mode 100644 index 000000000..8c1ac9cce --- /dev/null +++ b/cogl/winsys/cogl-win32.c @@ -0,0 +1,35 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl.h" + +CoglFuncPtr +_cogl_winsys_get_proc_address (const char *name) +{ + return (CoglFuncPtr) wglGetProcAddress ((LPCSTR) name); +} + diff --git a/cogl/winsys/cogl-winsys.h b/cogl/winsys/cogl-winsys.h new file mode 100644 index 000000000..ab83c29ab --- /dev/null +++ b/cogl/winsys/cogl-winsys.h @@ -0,0 +1,30 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 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. + */ + +#ifndef __COGL_WINSYS_H +#define __COGL_WINSYS_H + +CoglFuncPtr +_cogl_winsys_get_proc_address (const char *name); + +#endif /* __COGL_WINSYS_H */ diff --git a/common/Makefile.am b/common/Makefile.am deleted file mode 100644 index ef1c342f1..000000000 --- a/common/Makefile.am +++ /dev/null @@ -1,96 +0,0 @@ -include $(top_srcdir)/build/autotools/Makefile.am.silent - -NULL = - -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/clutter \ - -I$(top_srcdir)/clutter/cogl \ - -I$(top_srcdir)/clutter/cogl/common \ - -I$(top_srcdir)/clutter/cogl/$(CLUTTER_COGL) \ - -I$(top_builddir)/clutter \ - -I$(top_builddir)/clutter/cogl \ - -DG_DISABLE_SINGLE_INCLUDES \ - -DG_LOG_DOMAIN=\"Cogl-Common\" \ - -DCLUTTER_COMPILATION - -cogl_public_h = \ - $(top_srcdir)/clutter/cogl/cogl-bitmap.h \ - $(top_srcdir)/clutter/cogl/cogl-color.h \ - $(top_srcdir)/clutter/cogl/cogl-debug.h \ - $(top_srcdir)/clutter/cogl/cogl-fixed.h \ - $(top_srcdir)/clutter/cogl/cogl-material.h \ - $(top_srcdir)/clutter/cogl/cogl-matrix.h \ - $(top_srcdir)/clutter/cogl/cogl-offscreen.h \ - $(top_srcdir)/clutter/cogl/cogl-path.h \ - $(top_srcdir)/clutter/cogl/cogl-shader.h \ - $(top_srcdir)/clutter/cogl/cogl-texture.h \ - $(top_srcdir)/clutter/cogl/cogl-types.h \ - $(top_srcdir)/clutter/cogl/cogl-vertex-buffer.h \ - $(top_builddir)/clutter/cogl/cogl.h \ - $(NULL) - -noinst_LTLIBRARIES = libclutter-cogl-common.la - -cogl-enum-types.h: stamp-cogl-enum-types.h - @true -stamp-cogl-enum-types.h: $(cogl_public_h) Makefile - $(QUIET_GEN)( $(GLIB_MKENUMS) \ - --template $(srcdir)/cogl-enum-types.h.in \ - $(cogl_public_h) ) > xgen-ceth \ - && (cmp -s xgen-ceth cogl-enum-types.h || cp -f xgen-ceth cogl-enum-types.h) \ - && cp -f cogl-enum-types.h $(top_builddir)/clutter/cogl/cogl-enum-types.h \ - && rm -f xgen-ceth \ - && echo timestamp > $(@F) - -cogl-enum-types.c: cogl-enum-types.h - $(QUIET_GEN)( $(GLIB_MKENUMS) \ - --template $(srcdir)/cogl-enum-types.c.in \ - $(cogl_public_h) ) > xgen-cetc \ - && cp -f xgen-cetc cogl-enum-types.c \ - && rm -f xgen-cetc - -BUILT_SOURCES = cogl-enum-types.h cogl-enum-types.c - -libclutter_cogl_common_la_CPPFLAGS = $(CLUTTER_CFLAGS) $(COGL_DEBUG_CFLAGS) $(CLUTTER_DEBUG_CFLAGS) $(MAINTAINER_CFLAGS) -libclutter_cogl_common_la_LIBADD = -lm $(CLUTTER_LIBS) -libclutter_cogl_common_la_SOURCES = \ - $(top_builddir)/clutter/cogl/common/cogl-enum-types.h \ - $(top_builddir)/clutter/cogl/common/cogl-enum-types.c \ - cogl-handle.h \ - cogl-context.h \ - cogl-context.c \ - cogl-internal.h \ - cogl.c \ - cogl-util.h \ - cogl-util.c \ - cogl-bitmap-private.h \ - cogl-bitmap.c \ - cogl-bitmap-fallback.c \ - cogl-current-matrix.c \ - cogl-current-matrix.h \ - cogl-primitives.h \ - cogl-primitives.c \ - cogl-bitmap-pixbuf.c \ - cogl-clip-stack.h \ - cogl-clip-stack.c \ - cogl-fixed.c \ - cogl-color.c \ - cogl-vertex-buffer-private.h \ - cogl-vertex-buffer.c \ - cogl-matrix.c \ - cogl-matrix-stack.c \ - cogl-matrix-stack.h \ - cogl-material.c \ - cogl-material-private.h \ - cogl-blend-string.c \ - cogl-blend-string.h \ - cogl-debug.c \ - cogl-texture-private.h \ - cogl-texture-driver.h \ - cogl-texture.c \ - $(NULL) - -EXTRA_DIST = stb_image.c cogl-enum-types.h.in cogl-enum-types.c.in -CLEANFILES = stamp-cogl-enum-types.h -DISTCLEANFILES = cogl-enum-types.h cogl-enum-types.c diff --git a/doc/reference/cogl/Makefile.am b/doc/reference/cogl/Makefile.am index e031b341c..89389e3d7 100644 --- a/doc/reference/cogl/Makefile.am +++ b/doc/reference/cogl/Makefile.am @@ -18,7 +18,7 @@ DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml # gtk-doc will search all .c & .h files beneath here for inline comments # documenting the functions and macros. # e.g. DOC_SOURCE_DIR=../../../gtk -DOC_SOURCE_DIR=../../../clutter/cogl +DOC_SOURCE_DIR=../../../clutter/cogl/cogl # Extra options to pass to gtkdoc-scangobj. Not normally needed. SCANGOBJ_OPTIONS=--type-init-func="g_type_init()" @@ -46,10 +46,9 @@ FIXXREF_OPTIONS=\ # e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h # e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c HFILE_GLOB=\ - $(top_srcdir)/clutter/cogl/*.h \ - $(top_srcdir)/clutter/cogl/common/*.h + $(top_srcdir)/clutter/cogl/cogl/*.h CFILE_GLOB=\ - $(top_srcdir)/clutter/cogl/common/*.c + $(top_srcdir)/clutter/cogl/cogl/*.c # Header files to ignore when scanning. # e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h @@ -90,8 +89,8 @@ expand_content_files = \ # e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) # e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) -INCLUDES=-I$(top_srcdir) -I$(top_srcdir)/clutter $(CLUTTER_CFLAGS) -GTKDOC_LIBS=$(top_builddir)/clutter/libclutter-@CLUTTER_FLAVOUR@-@CLUTTER_API_VERSION@.la $(CLUTTER_LIBS) +INCLUDES=-I$(top_srcdir) -I$(top_srcdir)/clutter -I$(top_srcdir)/clutter/cogl $(CLUTTER_CFLAGS) +GTKDOC_LIBS=$(top_builddir)/clutter/libclutter-@CLUTTER_WINSYS@-@CLUTTER_API_VERSION@.la $(CLUTTER_LIBS) # This includes the standard gtk-doc make rules, copied by gtkdocize. include $(top_srcdir)/gtk-doc.make