Move all types/prototypes from cogl.h -> cogl[1]-context.h

So we can get to the point where cogl.h is merely an aggregation of
header includes for the 1.x api this moves all the function prototypes
and type definitions into a cogl-context.h and a new cogl1-context.h.

Ideally no code internally should ever need to include cogl.h as it just
represents the public facing header for accessing the 1.x api which
should only be used by Clutter.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
Robert Bragg 2012-02-17 21:46:39 +00:00
parent 1022c285c6
commit ee940a3d0d
28 changed files with 1423 additions and 1322 deletions

View File

@ -58,6 +58,7 @@ DISTCLEANFILES += $(pc_files)
# public 1.x api headers
cogl_1_public_h = \
$(srcdir)/cogl1-context.h \
$(srcdir)/cogl-bitmap.h \
$(srcdir)/cogl-color.h \
$(srcdir)/cogl-fixed.h \

View File

@ -43,6 +43,7 @@
#include "cogl-journal-private.h"
#include "cogl-pipeline-opengl-private.h"
#include "cogl-atlas.h"
#include "cogl1-context.h"
#include <stdlib.h>

View File

@ -31,6 +31,11 @@
#ifndef __COGL_ATTRIBUTE_BUFFER_H__
#define __COGL_ATTRIBUTE_BUFFER_H__
/* We forward declare the CoglAttributeBuffer type here to avoid some circular
* dependency issues with the following headers.
*/
typedef struct _CoglAttributeBuffer CoglAttributeBuffer;
#include <cogl/cogl-context.h>
G_BEGIN_DECLS
@ -43,8 +48,6 @@ G_BEGIN_DECLS
* FIXME
*/
typedef struct _CoglAttributeBuffer CoglAttributeBuffer;
/**
* cogl_attribute_buffer_new:
* @context: A #CoglContext

View File

@ -31,6 +31,11 @@
#ifndef __COGL_ATTRIBUTE_H__
#define __COGL_ATTRIBUTE_H__
/* We forward declare the CoglAttribute type here to avoid some circular
* dependency issues with the following headers.
*/
typedef struct _CoglAttribute CoglAttribute;
#include <cogl/cogl-attribute-buffer.h>
#include <cogl/cogl-indices.h>
@ -44,8 +49,6 @@ G_BEGIN_DECLS
* FIXME
*/
typedef struct _CoglAttribute CoglAttribute;
/**
* cogl_attribute_new:
* @attribute_buffer: The #CoglAttributeBuffer containing the actual

View File

@ -37,6 +37,7 @@
#include "cogl-framebuffer-private.h"
#include "cogl-texture-2d-private.h"
#include "cogl-private.h"
#include "cogl1-context.h"
static const CoglBlitMode *_cogl_blit_default_mode = NULL;

View File

@ -45,6 +45,7 @@
#include "cogl-pipeline-opengl-private.h"
#include "cogl-attribute-private.h"
#include "cogl-primitive-private.h"
#include "cogl1-context.h"
#ifndef GL_CLIP_PLANE0
#define GL_CLIP_PLANE0 0x3000

View File

@ -47,6 +47,7 @@
#include "cogl-onscreen-private.h"
#include "cogl2-path.h"
#include "cogl-attribute-private.h"
#include "cogl1-context.h"
#include <string.h>

View File

@ -31,8 +31,16 @@
#ifndef __COGL_CONTEXT_H__
#define __COGL_CONTEXT_H__
/* We forward declare the CoglContext type here to avoid some circular
* dependency issues with the following headers.
*/
typedef struct _CoglContext CoglContext;
#include <cogl/cogl-defines.h>
#include <cogl/cogl-display.h>
#include <cogl/cogl-texture.h>
#include <cogl/cogl-primitive.h>
#include <cogl/cogl-framebuffer.h>
#ifdef COGL_HAS_EGL_PLATFORM_ANDROID_SUPPORT
#include <android/native_window.h>
#endif
@ -62,7 +70,7 @@ G_BEGIN_DECLS
* what state other components have left you with.
*/
typedef struct _CoglContext CoglContext;
#ifdef COGL_ENABLE_EXPERIMENTAL_API
#define COGL_CONTEXT(OBJECT) ((CoglContext *)OBJECT)
@ -150,6 +158,161 @@ cogl_android_set_native_window (ANativeWindow *window);
gboolean
cogl_is_context (void *object);
#endif /* COGL_ENABLE_EXPERIMENTAL_2_0_API */
/* XXX: not guarded by the EXPERIMENTAL_2_0_API defines to avoid
* upsetting glib-mkenums, but this can still be considered implicitly
* experimental since it's only useable with experimental API... */
/**
* CoglFeatureID:
* @COGL_FEATURE_ID_TEXTURE_NPOT_BASIC: The hardware supports non power
* of two textures, but you also need to check the
* %COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP and %COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT
* features to know if the hardware supports npot texture mipmaps
* or repeat modes other than
* %COGL_RENDERER_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE respectively.
* @COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP: Mipmapping is supported in
* conjuntion with non power of two textures.
* @COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT: Repeat modes other than
* %COGL_RENDERER_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE are supported by the
* hardware.
* @COGL_FEATURE_ID_TEXTURE_NPOT: Non power of two textures are supported
* by the hardware. This is a equivalent to the
* %COGL_FEATURE_ID_TEXTURE_NPOT_BASIC, %COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP
* and %COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT features combined.
* @COGL_FEATURE_ID_TEXTURE_RECTANGLE: Support for rectangular
* textures with non-normalized texture coordinates.
* @COGL_FEATURE_ID_TEXTURE_3D: 3D texture support
* @COGL_FEATURE_ID_OFFSCREEN: Offscreen rendering support
* @COGL_FEATURE_ID_OFFSCREEN_MULTISAMPLE: Multisample support for
* offscreen framebuffers
* @COGL_FEATURE_ID_ONSCREEN_MULTIPLE: Multiple onscreen framebuffers
* supported.
* @COGL_FEATURE_ID_GLSL: GLSL support
* @COGL_FEATURE_ID_ARBFP: ARBFP support
* @COGL_FEATURE_ID_UNSIGNED_INT_INDICES: Set if
* %COGL_RENDERER_INDICES_TYPE_UNSIGNED_INT is supported in
* cogl_indices_new().
* @COGL_FEATURE_ID_DEPTH_RANGE: cogl_pipeline_set_depth_range() support
* @COGL_FEATURE_ID_POINT_SPRITE: Whether
* cogl_pipeline_set_layer_point_sprite_coords_enabled() is supported.
* @COGL_FEATURE_ID_MAP_BUFFER_FOR_READ: Whether cogl_buffer_map() is
* supported with CoglBufferAccess including read support.
* @COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE: Whether cogl_buffer_map() is
* supported with CoglBufferAccess including write support.
* @COGL_FEATURE_ID_MIRRORED_REPEAT: Whether
* %COGL_PIPELINE_WRAP_MODE_MIRRORED_REPEAT is supported.
* @COGL_FEATURE_ID_SWAP_BUFFERS_EVENT:
* Available if the window system supports reporting an event
* for swap buffer completions.
*
* All the capabilities that can vary between different GPUs supported
* by Cogl. Applications that depend on any of these features should explicitly
* check for them using cogl_has_feature() or cogl_has_features().
*
* Since: 1.10
*/
typedef enum _CoglFeatureID
{
COGL_FEATURE_ID_TEXTURE_NPOT_BASIC = 1,
COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP,
COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT,
COGL_FEATURE_ID_TEXTURE_NPOT,
COGL_FEATURE_ID_TEXTURE_RECTANGLE,
COGL_FEATURE_ID_TEXTURE_3D,
COGL_FEATURE_ID_GLSL,
COGL_FEATURE_ID_ARBFP,
COGL_FEATURE_ID_OFFSCREEN,
COGL_FEATURE_ID_OFFSCREEN_MULTISAMPLE,
COGL_FEATURE_ID_ONSCREEN_MULTIPLE,
COGL_FEATURE_ID_UNSIGNED_INT_INDICES,
COGL_FEATURE_ID_DEPTH_RANGE,
COGL_FEATURE_ID_POINT_SPRITE,
COGL_FEATURE_ID_MAP_BUFFER_FOR_READ,
COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE,
COGL_FEATURE_ID_MIRRORED_REPEAT,
COGL_FEATURE_ID_SWAP_BUFFERS_EVENT,
/*< private > */
_COGL_N_FEATURE_IDS
} CoglFeatureID;
#ifdef COGL_ENABLE_EXPERIMENTAL_2_0_API
/**
* cogl_has_feature:
* @context: A #CoglContext pointer
* @feature: A #CoglFeatureID
*
* Checks if a given @feature is currently available
*
* Cogl does not aim to be a lowest common denominator API, it aims to
* expose all the interesting features of GPUs to application which
* means applications have some responsibility to explicitly check
* that certain features are available before depending on them.
*
* Returns: %TRUE if the @feature is currently supported or %FALSE if
* not.
*
* Since: 1.10
* Stability: unstable
*/
gboolean
cogl_has_feature (CoglContext *context, CoglFeatureID feature);
/**
* cogl_has_features:
* @context: A #CoglContext pointer
* @...: A 0 terminated list of CoglFeatureID<!-- -->s
*
* Checks if a list of features are all currently available.
*
* This checks all of the listed features using cogl_has_feature() and
* returns %TRUE if all the features are available or %FALSE
* otherwise.
*
* Return value: %TRUE if all the features are available, %FALSE
* otherwise.
*
* Since: 1.10
* Stability: unstable
*/
gboolean
cogl_has_features (CoglContext *context, ...);
/**
* CoglFeatureCallback:
* @feature: A single feature currently supported by Cogl
* @user_data: A private pointer passed to cogl_foreach_feature().
*
* A callback used with cogl_foreach_feature() for enumerating all
* context level features supported by Cogl.
*
* Since: 0.10
* Stability: unstable
*/
typedef void (*CoglFeatureCallback) (CoglFeatureID feature, void *user_data);
/**
* cogl_foreach_feature:
* @context: A #CoglContext pointer
* @callback: A #CoglFeatureCallback called for each supported feature
* @user_data: Private data to pass to the callback
*
* Iterates through all the context level features currently supported
* for a given @context and for each feature @callback is called.
*
* Since: 1.10
* Stability: unstable
*/
void
cogl_foreach_feature (CoglContext *context,
CoglFeatureCallback callback,
void *user_data);
#endif /* COGL_ENABLE_EXPERIMENTAL_2_0_API */
G_END_DECLS
#endif /* __COGL_CONTEXT_H__ */

View File

@ -24,6 +24,10 @@
* Robert Bragg <robert@linux.intel.com>
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <cogl.h>
#include <cogl-util.h>
#include <cogl-euler.h>

View File

@ -42,6 +42,8 @@
#include "cogl-pipeline-state-private.h"
#include "cogl-matrix-private.h"
#include "cogl-primitive-private.h"
#include "cogl-offscreen.h"
#include "cogl1-context.h"
#ifndef GL_FRAMEBUFFER
#define GL_FRAMEBUFFER 0x8D40

View File

@ -28,8 +28,6 @@
#ifndef __COGL_FRAMEBUFFER_H
#define __COGL_FRAMEBUFFER_H
#include <cogl/cogl.h>
#include <glib.h>
#ifdef COGL_HAS_WIN32_SUPPORT
@ -40,6 +38,15 @@
#include <wayland-client.h>
#endif /* COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT */
#ifdef COGL_ENABLE_EXPERIMENTAL_2_0_API
#include <cogl/cogl2-path.h>
#else
#include <cogl/cogl-path.h>
#endif
#include <cogl/cogl-pipeline.h>
#include <cogl/cogl-indices.h>
G_BEGIN_DECLS
/**
@ -80,6 +87,8 @@ G_BEGIN_DECLS
* configuration.
*/
typedef struct _CoglFramebuffer CoglFramebuffer;
#ifdef COGL_ENABLE_EXPERIMENTAL_API
#define COGL_FRAMEBUFFER(X) ((CoglFramebuffer *)(X))

View File

@ -31,6 +31,11 @@
#ifndef __COGL_INDICES_H__
#define __COGL_INDICES_H__
/* We forward declare the CoglIndices type here to avoid some circular
* dependency issues with the following headers.
*/
typedef struct _CoglIndices CoglIndices;
#include <cogl/cogl-index-buffer.h>
G_BEGIN_DECLS
@ -94,8 +99,6 @@ G_BEGIN_DECLS
* for drawing quads as above.
*/
typedef struct _CoglIndices CoglIndices;
CoglIndices *
cogl_indices_new (CoglContext *context,
CoglIndicesType type,

View File

@ -39,6 +39,7 @@
#include "cogl-attribute-private.h"
#include "cogl-point-in-poly-private.h"
#include "cogl-private.h"
#include "cogl1-context.h"
#include <string.h>
#include <gmodule.h>

View File

@ -31,6 +31,7 @@
#include "cogl-onscreen-template-private.h"
#include "cogl-context-private.h"
#include "cogl-object-private.h"
#include "cogl1-context.h"
static void _cogl_onscreen_free (CoglOnscreen *onscreen);

View File

@ -46,6 +46,7 @@
#include "cogl-util.h"
#include "cogl-profile.h"
#include "cogl-depth-state-private.h"
#include "cogl1-context.h"
#include <glib.h>
#include <glib/gprintf.h>

View File

@ -31,6 +31,11 @@
#ifndef __COGL_PRIMITIVE_H__
#define __COGL_PRIMITIVE_H__
/* We forward declare the CoglPrimitive type here to avoid some circular
* dependency issues with the following headers.
*/
typedef struct _CoglPrimitive CoglPrimitive;
#include <cogl/cogl-vertex-buffer.h> /* for CoglVerticesMode */
#include <cogl/cogl-attribute.h>
@ -44,8 +49,6 @@ G_BEGIN_DECLS
* FIXME
*/
typedef struct _CoglPrimitive CoglPrimitive;
/**
* CoglVertexP2:
* @x: The x component of a position attribute

View File

@ -39,6 +39,7 @@
#include "cogl-private.h"
#include "cogl-meta-texture.h"
#include "cogl-framebuffer-private.h"
#include "cogl1-context.h"
#include <string.h>
#include <math.h>

View File

@ -34,6 +34,10 @@
* 3D Maths Primer for Graphics and Game Development ISBN-10: 1556229119
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <cogl.h>
#include <cogl-util.h>
#include <cogl-quaternion.h>

View File

@ -52,6 +52,7 @@
#include "cogl-object-private.h"
#include "cogl-primitives.h"
#include "cogl-framebuffer-private.h"
#include "cogl1-context.h"
#include <string.h>
#include <stdlib.h>

View File

@ -28,6 +28,11 @@
#ifndef __COGL_TEXTURE_H__
#define __COGL_TEXTURE_H__
/* We forward declare the CoglTexture type here to avoid some circular
* dependency issues with the following headers.
*/
typedef struct _CoglTexture CoglTexture;
#include <cogl/cogl-types.h>
#include <cogl/cogl-defines.h>
#if defined (COGL_ENABLE_EXPERIMENTAL_API)
@ -46,7 +51,6 @@ G_BEGIN_DECLS
* loading and manipulating textures.
*/
typedef struct _CoglTexture CoglTexture;
#define COGL_TEXTURE(X) ((CoglTexture *)X)
#define COGL_TEXTURE_MAX_WASTE 127

View File

@ -717,6 +717,34 @@ typedef enum
COGL_WINDING_COUNTER_CLOCKWISE
} CoglWinding;
/**
* CoglBufferBit:
* @COGL_BUFFER_BIT_COLOR: Selects the primary color buffer
* @COGL_BUFFER_BIT_DEPTH: Selects the depth buffer
* @COGL_BUFFER_BIT_STENCIL: Selects the stencil buffer
*
* Types of auxiliary buffers
*
* Since: 1.0
*/
typedef enum {
COGL_BUFFER_BIT_COLOR = 1L<<0,
COGL_BUFFER_BIT_DEPTH = 1L<<1,
COGL_BUFFER_BIT_STENCIL = 1L<<2
} CoglBufferBit;
/**
* CoglReadPixelsFlags:
* @COGL_READ_PIXELS_COLOR_BUFFER: Read from the color buffer
*
* Flags for cogl_read_pixels()
*
* Since: 1.0
*/
typedef enum { /*< prefix=COGL_READ_PIXELS >*/
COGL_READ_PIXELS_COLOR_BUFFER = 1L << 0
} CoglReadPixelsFlags;
G_END_DECLS
#endif /* __COGL_TYPES_H__ */

View File

@ -24,6 +24,10 @@
* Robert Bragg <robert@linux.intel.com>
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <cogl.h>
#include <cogl-util.h>
#include <cogl-vector.h>

View File

@ -108,6 +108,7 @@
#include "cogl-primitives.h"
#include "cogl-framebuffer-private.h"
#include "cogl-journal-private.h"
#include "cogl1-context.h"
#define PAD_FOR_ALIGNMENT(VAR, TYPE_SIZE) \
(VAR = TYPE_SIZE + ((VAR - 1) & ~(TYPE_SIZE - 1)))

View File

@ -50,6 +50,7 @@
#include "cogl-renderer-private.h"
#include "cogl-config-private.h"
#include "cogl-private.h"
#include "cogl1-context.h"
#ifndef GL_PACK_INVERT_MESA
#define GL_PACK_INVERT_MESA 0x8758

File diff suppressed because it is too large Load Diff

1167
cogl/cogl1-context.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -44,6 +44,7 @@
#include "cogl-primitives-private.h"
#include "cogl-private.h"
#include "cogl-attribute-private.h"
#include "cogl1-context.h"
#include "tesselator/tesselator.h"
#include <string.h>

View File

@ -95,7 +95,6 @@ IGNORE_HFILES=\
cogl-vertex-buffer-private.h \
cogl-blend-string.h \
cogl-clip-stack.h \
cogl-context.h \
cogl-debug.h \
cogl-defines.h \
cogl-deprecated.h \