2009-04-27 10:48:12 -04:00
|
|
|
/*
|
|
|
|
* Cogl
|
2009-03-09 13:06:22 -04:00
|
|
|
*
|
2014-02-21 20:28:54 -05:00
|
|
|
* A Low Level GPU Graphics and Utilities API
|
2008-10-30 13:57:41 -04:00
|
|
|
*
|
2009-04-27 10:48:12 -04:00
|
|
|
* Copyright (C) 2008,2009 Intel Corporation.
|
2008-10-30 13:57:41 -04:00
|
|
|
*
|
2014-02-21 20:28:54 -05:00
|
|
|
* Permission is hereby granted, free of charge, to any person
|
|
|
|
* obtaining a copy of this software and associated documentation
|
|
|
|
* files (the "Software"), to deal in the Software without
|
|
|
|
* restriction, including without limitation the rights to use, copy,
|
|
|
|
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
|
|
* of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
2008-10-30 13:57:41 -04:00
|
|
|
*
|
2014-02-21 20:28:54 -05:00
|
|
|
* The above copyright notice and this permission notice shall be
|
|
|
|
* included in all copies or substantial portions of the Software.
|
2008-10-30 13:57:41 -04:00
|
|
|
*
|
2014-02-21 20:28:54 -05:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
|
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
2010-03-01 07:56:10 -05:00
|
|
|
*
|
|
|
|
*
|
2008-10-30 13:57:41 -04:00
|
|
|
*/
|
|
|
|
|
2012-06-20 13:49:08 -04:00
|
|
|
#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION)
|
2008-10-30 13:25:00 -04:00
|
|
|
#error "Only <cogl/cogl.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __COGL_TYPES_H__
|
|
|
|
#define __COGL_TYPES_H__
|
|
|
|
|
2012-04-23 09:12:02 -04:00
|
|
|
#include <stdint.h>
|
2012-11-22 13:01:10 -05:00
|
|
|
#include <stddef.h>
|
2008-10-30 13:25:00 -04:00
|
|
|
|
2010-11-05 08:28:33 -04:00
|
|
|
#include <cogl/cogl-defines.h>
|
|
|
|
|
2012-11-22 13:01:10 -05:00
|
|
|
#ifdef COGL_HAS_GTYPE_SUPPORT
|
|
|
|
#include <glib-object.h>
|
|
|
|
#endif /* COGL_HAS_GTYPE_SUPPORT */
|
|
|
|
|
|
|
|
/* Guard C code in headers, while including them from C++ */
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#define COGL_BEGIN_DECLS extern "C" {
|
|
|
|
#define COGL_END_DECLS }
|
|
|
|
#else
|
|
|
|
#define COGL_BEGIN_DECLS
|
|
|
|
#define COGL_END_DECLS
|
|
|
|
#endif
|
|
|
|
|
|
|
|
COGL_BEGIN_DECLS
|
2008-10-30 13:25:00 -04:00
|
|
|
|
2012-12-31 11:08:12 -05:00
|
|
|
/**
|
|
|
|
* SECTION:cogl-types
|
|
|
|
* @short_description: Types used throughout the library
|
|
|
|
*
|
|
|
|
* General types used by various Cogl functions.
|
|
|
|
*/
|
|
|
|
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 16:56:40 -04:00
|
|
|
/**
|
|
|
|
* CoglBool:
|
|
|
|
*
|
|
|
|
* A boolean data type used throughout the Cogl C api. This should be
|
|
|
|
* used in conjunction with the %TRUE and %FALSE macro defines for
|
|
|
|
* setting and testing boolean values.
|
|
|
|
*
|
|
|
|
* Since: 2.0
|
|
|
|
* Stability: stable
|
|
|
|
*/
|
|
|
|
typedef int CoglBool;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TRUE:
|
|
|
|
*
|
|
|
|
* A constant to be used with #CoglBool types to indicate a boolean in
|
|
|
|
* the "true" state.
|
|
|
|
*
|
|
|
|
* Since: 2.0
|
|
|
|
* Stability: stable
|
|
|
|
*/
|
|
|
|
#ifndef TRUE
|
|
|
|
#define TRUE 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2012-12-31 12:22:14 -05:00
|
|
|
* FALSE:
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 16:56:40 -04:00
|
|
|
*
|
|
|
|
* A constant to be used with #CoglBool types to indicate a boolean in
|
|
|
|
* the "false" state.
|
|
|
|
*
|
|
|
|
* Since: 2.0
|
|
|
|
* Stability: stable
|
|
|
|
*/
|
|
|
|
#ifndef FALSE
|
|
|
|
#define FALSE 0
|
|
|
|
#endif
|
|
|
|
|
2012-11-22 13:01:10 -05:00
|
|
|
#if __GNUC__ >= 4
|
|
|
|
#define COGL_GNUC_NULL_TERMINATED __attribute__((__sentinel__))
|
|
|
|
#else
|
|
|
|
#define COGL_GNUC_NULL_TERMINATED
|
|
|
|
#endif
|
|
|
|
|
2013-07-03 12:06:23 -04:00
|
|
|
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) && \
|
|
|
|
!defined (COGL_COMPILATION)
|
2012-11-22 13:01:10 -05:00
|
|
|
#define COGL_GNUC_DEPRECATED \
|
|
|
|
__attribute__((__deprecated__))
|
|
|
|
#else
|
|
|
|
#define COGL_GNUC_DEPRECATED
|
|
|
|
#endif /* __GNUC__ */
|
|
|
|
|
2010-04-01 15:06:30 -04:00
|
|
|
/* Some structures are meant to be opaque but they have public
|
|
|
|
definitions because we want the size to be public so they can be
|
|
|
|
allocated on the stack. This macro is used to ensure that users
|
|
|
|
don't accidentally access private members */
|
2012-06-20 13:49:08 -04:00
|
|
|
#ifdef COGL_COMPILATION
|
2010-04-01 15:06:30 -04:00
|
|
|
#define COGL_PRIVATE(x) x
|
|
|
|
#else
|
|
|
|
#define COGL_PRIVATE(x) private_member_ ## x
|
|
|
|
#endif
|
|
|
|
|
2011-05-13 12:30:08 -04:00
|
|
|
/* To help catch accidental changes to public structs that should
|
|
|
|
* be stack allocated we use this macro to compile time assert that
|
|
|
|
* a struct size is as expected.
|
|
|
|
*/
|
|
|
|
#define COGL_STRUCT_SIZE_ASSERT(TYPE, SIZE) \
|
|
|
|
typedef struct { \
|
|
|
|
char compile_time_assert_ ## TYPE ## _size[ \
|
|
|
|
(sizeof (TYPE) == (SIZE)) ? 1 : -1]; \
|
|
|
|
} _ ## TYPE ## SizeCheck
|
|
|
|
|
2008-10-30 13:25:00 -04:00
|
|
|
/**
|
|
|
|
* CoglHandle:
|
|
|
|
*
|
|
|
|
* Type used for storing references to cogl objects, the CoglHandle is
|
|
|
|
* a fully opaque type without any public data members.
|
|
|
|
*/
|
2012-04-16 09:14:10 -04:00
|
|
|
typedef void * CoglHandle;
|
2008-10-30 13:25:00 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* COGL_INVALID_HANDLE:
|
|
|
|
*
|
|
|
|
* A COGL handle that is not valid, used for unitialized handles as well as
|
|
|
|
* error conditions.
|
|
|
|
*/
|
|
|
|
#define COGL_INVALID_HANDLE NULL
|
|
|
|
|
2012-11-22 13:01:10 -05:00
|
|
|
#ifdef COGL_HAS_GTYPE_SUPPORT
|
|
|
|
|
2009-02-19 07:02:42 -05:00
|
|
|
#define COGL_TYPE_HANDLE (cogl_handle_get_type ())
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-09 20:57:32 -05:00
|
|
|
GType
|
|
|
|
cogl_handle_get_type (void) G_GNUC_CONST;
|
2009-02-19 07:02:42 -05:00
|
|
|
|
2012-11-22 13:01:10 -05:00
|
|
|
#endif /* COGL_HAS_GTYPE_SUPPORT */
|
|
|
|
|
2009-07-20 07:49:35 -04:00
|
|
|
/**
|
|
|
|
* cogl_handle_ref:
|
|
|
|
* @handle: a #CoglHandle
|
|
|
|
*
|
|
|
|
* Increases the reference count of @handle by 1
|
|
|
|
*
|
2010-09-06 11:11:46 -04:00
|
|
|
* Return value: (transfer none): the handle, with its reference count increased
|
2009-07-20 07:49:35 -04:00
|
|
|
*/
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-09 20:57:32 -05:00
|
|
|
CoglHandle
|
|
|
|
cogl_handle_ref (CoglHandle handle);
|
2009-07-20 07:49:35 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_handle_unref:
|
|
|
|
* @handle: a #CoglHandle
|
|
|
|
*
|
|
|
|
* Drecreases the reference count of @handle by 1; if the reference
|
|
|
|
* count reaches 0, the resources allocated by @handle will be freed
|
|
|
|
*/
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-09 20:57:32 -05:00
|
|
|
void
|
2010-06-05 16:05:23 -04:00
|
|
|
cogl_handle_unref (CoglHandle handle);
|
2009-02-19 07:02:42 -05:00
|
|
|
|
2008-10-30 13:25:00 -04:00
|
|
|
/**
|
|
|
|
* CoglFuncPtr:
|
|
|
|
*
|
|
|
|
* The type used by cogl for function pointers, note that this type
|
|
|
|
* is used as a generic catch-all cast for function pointers and the
|
|
|
|
* actual arguments and return type may be different.
|
|
|
|
*/
|
|
|
|
typedef void (* CoglFuncPtr) (void);
|
|
|
|
|
2010-02-24 20:40:29 -05:00
|
|
|
/* We forward declare this in cogl-types to avoid circular dependencies
|
|
|
|
* between cogl-matrix.h, cogl-euler.h and cogl-quaterion.h */
|
|
|
|
typedef struct _CoglMatrix CoglMatrix;
|
|
|
|
|
2010-02-24 20:40:29 -05:00
|
|
|
/* Same as above we forward declared CoglQuaternion to avoid
|
|
|
|
* circular dependencies. */
|
|
|
|
typedef struct _CoglQuaternion CoglQuaternion;
|
|
|
|
|
|
|
|
/* Same as above we forward declared CoglEuler to avoid
|
|
|
|
* circular dependencies. */
|
|
|
|
typedef struct _CoglEuler CoglEuler;
|
|
|
|
|
2008-10-30 13:25:00 -04:00
|
|
|
/**
|
|
|
|
* CoglFixed:
|
|
|
|
*
|
|
|
|
* Fixed point number using a (16.16) notation.
|
|
|
|
*/
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 16:56:40 -04:00
|
|
|
typedef int32_t CoglFixed;
|
2008-10-30 13:25:00 -04:00
|
|
|
|
2009-03-09 13:06:22 -04:00
|
|
|
#define COGL_TYPE_FIXED (cogl_fixed_get_type ())
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-09 20:57:32 -05:00
|
|
|
GType
|
|
|
|
cogl_fixed_get_type (void) G_GNUC_CONST;
|
2009-03-09 13:06:22 -04:00
|
|
|
|
2008-10-30 13:25:00 -04:00
|
|
|
/**
|
|
|
|
* CoglAngle:
|
|
|
|
*
|
|
|
|
* Integer representation of an angle such that 1024 corresponds to
|
|
|
|
* full circle (i.e., 2 * pi).
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 16:56:40 -04:00
|
|
|
typedef int32_t CoglAngle;
|
2008-10-30 13:25:00 -04:00
|
|
|
|
|
|
|
typedef struct _CoglColor CoglColor;
|
|
|
|
typedef struct _CoglTextureVertex CoglTextureVertex;
|
|
|
|
|
|
|
|
/* Enum declarations */
|
|
|
|
|
|
|
|
#define COGL_A_BIT (1 << 4)
|
|
|
|
#define COGL_BGR_BIT (1 << 5)
|
|
|
|
#define COGL_AFIRST_BIT (1 << 6)
|
|
|
|
#define COGL_PREMULT_BIT (1 << 7)
|
2012-05-23 13:19:29 -04:00
|
|
|
#define COGL_DEPTH_BIT (1 << 8)
|
|
|
|
#define COGL_STENCIL_BIT (1 << 9)
|
2008-10-30 13:25:00 -04:00
|
|
|
|
2012-02-11 13:19:04 -05:00
|
|
|
/* XXX: Notes to those adding new formats here...
|
|
|
|
*
|
|
|
|
* First this diagram outlines how we allocate the 32bits of a
|
|
|
|
* CoglPixelFormat currently...
|
|
|
|
*
|
2012-05-23 13:19:29 -04:00
|
|
|
* 6 bits for flags
|
|
|
|
* |-----|
|
2012-02-11 13:19:04 -05:00
|
|
|
* enum unused 4 bits for the bytes-per-pixel
|
|
|
|
* and component alignment info
|
2012-05-23 13:19:29 -04:00
|
|
|
* |------| |-------------| |--|
|
|
|
|
* 00000000 xxxxxxxx xxxxxxSD PFBA0000
|
|
|
|
* ^ stencil
|
|
|
|
* ^ depth
|
2012-02-11 13:19:04 -05:00
|
|
|
* ^ premult
|
|
|
|
* ^ alpha first
|
|
|
|
* ^ bgr order
|
|
|
|
* ^ has alpha
|
|
|
|
*
|
|
|
|
* The most awkward part about the formats is how we use the last 4
|
|
|
|
* bits to encode the bytes per pixel and component alignment
|
|
|
|
* information. Ideally we should have had 3 bits for the bpp and a
|
|
|
|
* flag for alignment but we didn't plan for that in advance so we
|
|
|
|
* instead use a small lookup table to query the bpp and whether the
|
|
|
|
* components are byte aligned or not.
|
|
|
|
*
|
|
|
|
* The mapping is the following (see discussion on bug #660188):
|
|
|
|
*
|
|
|
|
* 0 = undefined
|
|
|
|
* 1, 8 = 1 bpp (e.g. A_8, G_8)
|
|
|
|
* 2 = 3 bpp, aligned (e.g. 888)
|
|
|
|
* 3 = 4 bpp, aligned (e.g. 8888)
|
|
|
|
* 4-6 = 2 bpp, not aligned (e.g. 565, 4444, 5551)
|
|
|
|
* 7 = YUV: undefined bpp, undefined alignment
|
|
|
|
* 9 = 2 bpp, aligned
|
2012-05-23 13:19:29 -04:00
|
|
|
* 10 = depth, aligned (8, 16, 24, 32, 32f)
|
2012-02-11 13:19:04 -05:00
|
|
|
* 11 = undefined
|
|
|
|
* 12 = 3 bpp, not aligned
|
|
|
|
* 13 = 4 bpp, not aligned (e.g. 2101010)
|
|
|
|
* 14-15 = undefined
|
|
|
|
*
|
|
|
|
* Note: the gap at 10-11 is just because we wanted to maintain that
|
|
|
|
* all non-aligned formats have the third bit set in case that's
|
|
|
|
* useful later.
|
|
|
|
*
|
|
|
|
* Since we don't want to waste bits adding more and more flags, we'd
|
|
|
|
* like to see most new pixel formats that can't be represented
|
|
|
|
* uniquely with the existing flags in the least significant byte
|
|
|
|
* simply be enumerated with sequential values in the most significant
|
|
|
|
* enum byte.
|
|
|
|
*
|
|
|
|
* Note: Cogl avoids exposing any padded XRGB or RGBX formats and
|
|
|
|
* instead we leave it up to applications to decided whether they
|
|
|
|
* consider the A component as padding or valid data. We shouldn't
|
|
|
|
* change this policy without good reasoning.
|
|
|
|
*
|
|
|
|
* So to add a new format:
|
|
|
|
* 1) Use the mapping table above to figure out what to but in
|
|
|
|
* the lowest nibble.
|
|
|
|
* 2) OR in the COGL_PREMULT_BIT, COGL_AFIRST_BIT, COGL_A_BIT and
|
|
|
|
* COGL_BGR_BIT flags as appropriate.
|
|
|
|
* 3) If the result is not yet unique then also combine with an
|
|
|
|
* increment of the last sequence number in the most significant
|
|
|
|
* byte.
|
|
|
|
*
|
|
|
|
* The last sequence number used was 0 (i.e. no formats currently need
|
|
|
|
* a sequence number)
|
|
|
|
* Update this note whenever a new sequence number is used.
|
|
|
|
*/
|
2008-10-30 13:25:00 -04:00
|
|
|
/**
|
|
|
|
* CoglPixelFormat:
|
2009-01-09 09:26:35 -05:00
|
|
|
* @COGL_PIXEL_FORMAT_ANY: Any format
|
|
|
|
* @COGL_PIXEL_FORMAT_A_8: 8 bits alpha mask
|
2014-01-14 10:52:45 -05:00
|
|
|
* @COGL_PIXEL_FORMAT_RG_88: RG, 16 bits. Note that red-green textures
|
|
|
|
* are only available if %COGL_FEATURE_ID_TEXTURE_RG is advertised.
|
|
|
|
* See cogl_texture_set_components() for details.
|
2009-01-09 09:26:35 -05:00
|
|
|
* @COGL_PIXEL_FORMAT_RGB_565: RGB, 16 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_RGBA_4444: RGBA, 16 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_RGBA_5551: RGBA, 16 bits
|
2010-01-27 07:06:22 -05:00
|
|
|
* @COGL_PIXEL_FORMAT_YUV: Not currently supported
|
|
|
|
* @COGL_PIXEL_FORMAT_G_8: Single luminance component
|
2009-01-09 09:26:35 -05:00
|
|
|
* @COGL_PIXEL_FORMAT_RGB_888: RGB, 24 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_BGR_888: BGR, 24 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_RGBA_8888: RGBA, 32 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_BGRA_8888: BGRA, 32 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_ARGB_8888: ARGB, 32 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_ABGR_8888: ABGR, 32 bits
|
2011-11-21 18:39:49 -05:00
|
|
|
* @COGL_PIXEL_FORMAT_RGBA_1010102 : RGBA, 32 bits, 10 bpc
|
|
|
|
* @COGL_PIXEL_FORMAT_BGRA_1010102 : BGRA, 32 bits, 10 bpc
|
|
|
|
* @COGL_PIXEL_FORMAT_ARGB_2101010 : ARGB, 32 bits, 10 bpc
|
|
|
|
* @COGL_PIXEL_FORMAT_ABGR_2101010 : ABGR, 32 bits, 10 bpc
|
2009-01-09 09:26:35 -05:00
|
|
|
* @COGL_PIXEL_FORMAT_RGBA_8888_PRE: Premultiplied RGBA, 32 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_BGRA_8888_PRE: Premultiplied BGRA, 32 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_ARGB_8888_PRE: Premultiplied ARGB, 32 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_ABGR_8888_PRE: Premultiplied ABGR, 32 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_RGBA_4444_PRE: Premultiplied RGBA, 16 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_RGBA_5551_PRE: Premultiplied RGBA, 16 bits
|
2011-11-21 18:39:49 -05:00
|
|
|
* @COGL_PIXEL_FORMAT_RGBA_1010102_PRE: Premultiplied RGBA, 32 bits, 10 bpc
|
|
|
|
* @COGL_PIXEL_FORMAT_BGRA_1010102_PRE: Premultiplied BGRA, 32 bits, 10 bpc
|
|
|
|
* @COGL_PIXEL_FORMAT_ARGB_2101010_PRE: Premultiplied ARGB, 32 bits, 10 bpc
|
|
|
|
* @COGL_PIXEL_FORMAT_ABGR_2101010_PRE: Premultiplied ABGR, 32 bits, 10 bpc
|
2008-10-30 13:25:00 -04:00
|
|
|
*
|
2012-02-11 13:19:04 -05:00
|
|
|
* Pixel formats used by Cogl. For the formats with a byte per
|
2010-01-27 07:06:22 -05:00
|
|
|
* component, the order of the components specify the order in
|
|
|
|
* increasing memory addresses. So for example
|
|
|
|
* %COGL_PIXEL_FORMAT_RGB_888 would have the red component in the
|
|
|
|
* lowest address, green in the next address and blue after that
|
2012-02-11 13:19:04 -05:00
|
|
|
* regardless of the endianness of the system.
|
|
|
|
*
|
|
|
|
* For the formats with non byte aligned components the component
|
|
|
|
* order specifies the order within a 16-bit or 32-bit number from
|
|
|
|
* most significant bit to least significant. So for
|
|
|
|
* %COGL_PIXEL_FORMAT_RGB_565, the red component would be in bits
|
|
|
|
* 11-15, the green component would be in 6-11 and the blue component
|
|
|
|
* would be in 1-5. Therefore the order in memory depends on the
|
|
|
|
* endianness of the system.
|
2010-01-27 07:06:22 -05:00
|
|
|
*
|
|
|
|
* When uploading a texture %COGL_PIXEL_FORMAT_ANY can be used as the
|
|
|
|
* internal format. Cogl will try to pick the best format to use
|
|
|
|
* internally and convert the texture data if necessary.
|
2009-01-09 09:26:35 -05:00
|
|
|
*
|
|
|
|
* Since: 0.8
|
2008-10-30 13:25:00 -04:00
|
|
|
*/
|
2009-05-29 07:31:47 -04:00
|
|
|
typedef enum { /*< prefix=COGL_PIXEL_FORMAT >*/
|
2008-10-30 13:25:00 -04:00
|
|
|
COGL_PIXEL_FORMAT_ANY = 0,
|
|
|
|
COGL_PIXEL_FORMAT_A_8 = 1 | COGL_A_BIT,
|
|
|
|
|
|
|
|
COGL_PIXEL_FORMAT_RGB_565 = 4,
|
|
|
|
COGL_PIXEL_FORMAT_RGBA_4444 = 5 | COGL_A_BIT,
|
|
|
|
COGL_PIXEL_FORMAT_RGBA_5551 = 6 | COGL_A_BIT,
|
|
|
|
COGL_PIXEL_FORMAT_YUV = 7,
|
|
|
|
COGL_PIXEL_FORMAT_G_8 = 8,
|
2009-04-27 10:48:12 -04:00
|
|
|
|
2014-01-14 10:52:45 -05:00
|
|
|
COGL_PIXEL_FORMAT_RG_88 = 9,
|
|
|
|
|
2012-02-17 15:24:14 -05:00
|
|
|
COGL_PIXEL_FORMAT_RGB_888 = 2,
|
|
|
|
COGL_PIXEL_FORMAT_BGR_888 = (2 | COGL_BGR_BIT),
|
2009-05-29 07:31:47 -04:00
|
|
|
|
2012-02-17 15:24:14 -05:00
|
|
|
COGL_PIXEL_FORMAT_RGBA_8888 = (3 | COGL_A_BIT),
|
|
|
|
COGL_PIXEL_FORMAT_BGRA_8888 = (3 | COGL_A_BIT | COGL_BGR_BIT),
|
|
|
|
COGL_PIXEL_FORMAT_ARGB_8888 = (3 | COGL_A_BIT | COGL_AFIRST_BIT),
|
|
|
|
COGL_PIXEL_FORMAT_ABGR_8888 = (3 | COGL_A_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
|
2009-05-29 07:31:47 -04:00
|
|
|
|
2011-11-21 18:39:49 -05:00
|
|
|
COGL_PIXEL_FORMAT_RGBA_1010102 = (13 | COGL_A_BIT),
|
|
|
|
COGL_PIXEL_FORMAT_BGRA_1010102 = (13 | COGL_A_BIT | COGL_BGR_BIT),
|
|
|
|
COGL_PIXEL_FORMAT_ARGB_2101010 = (13 | COGL_A_BIT | COGL_AFIRST_BIT),
|
|
|
|
COGL_PIXEL_FORMAT_ABGR_2101010 = (13 | COGL_A_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
|
|
|
|
|
2012-02-17 15:24:14 -05:00
|
|
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT),
|
|
|
|
COGL_PIXEL_FORMAT_BGRA_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT),
|
|
|
|
COGL_PIXEL_FORMAT_ARGB_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_AFIRST_BIT),
|
|
|
|
COGL_PIXEL_FORMAT_ABGR_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
|
2009-05-29 07:31:47 -04:00
|
|
|
COGL_PIXEL_FORMAT_RGBA_4444_PRE = (COGL_PIXEL_FORMAT_RGBA_4444 | COGL_A_BIT | COGL_PREMULT_BIT),
|
2011-11-21 18:39:49 -05:00
|
|
|
COGL_PIXEL_FORMAT_RGBA_5551_PRE = (COGL_PIXEL_FORMAT_RGBA_5551 | COGL_A_BIT | COGL_PREMULT_BIT),
|
|
|
|
|
|
|
|
COGL_PIXEL_FORMAT_RGBA_1010102_PRE = (COGL_PIXEL_FORMAT_RGBA_1010102 | COGL_PREMULT_BIT),
|
|
|
|
COGL_PIXEL_FORMAT_BGRA_1010102_PRE = (COGL_PIXEL_FORMAT_BGRA_1010102 | COGL_PREMULT_BIT),
|
|
|
|
COGL_PIXEL_FORMAT_ARGB_2101010_PRE = (COGL_PIXEL_FORMAT_ARGB_2101010 | COGL_PREMULT_BIT),
|
2012-05-23 13:19:29 -04:00
|
|
|
COGL_PIXEL_FORMAT_ABGR_2101010_PRE = (COGL_PIXEL_FORMAT_ABGR_2101010 | COGL_PREMULT_BIT),
|
|
|
|
|
|
|
|
COGL_PIXEL_FORMAT_DEPTH_16 = (9 | COGL_DEPTH_BIT),
|
|
|
|
COGL_PIXEL_FORMAT_DEPTH_32 = (3 | COGL_DEPTH_BIT),
|
|
|
|
|
|
|
|
COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8 = (3 | COGL_DEPTH_BIT | COGL_STENCIL_BIT)
|
2008-10-30 13:25:00 -04:00
|
|
|
} CoglPixelFormat;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* CoglFeatureFlags:
|
2009-01-09 09:26:35 -05:00
|
|
|
* @COGL_FEATURE_TEXTURE_RECTANGLE: ARB_texture_rectangle support
|
2010-07-05 21:01:24 -04:00
|
|
|
* @COGL_FEATURE_TEXTURE_NPOT: Non power of two textures are supported
|
|
|
|
* by the hardware. This is a equivalent to the
|
|
|
|
* %COGL_FEATURE_TEXTURE_NPOT_BASIC, %COGL_FEATURE_TEXTURE_NPOT_MIPMAP
|
|
|
|
* and %COGL_FEATURE_TEXTURE_NPOT_REPEAT features combined.
|
2009-01-09 09:26:35 -05:00
|
|
|
* @COGL_FEATURE_TEXTURE_YUV: ycbcr conversion support
|
|
|
|
* @COGL_FEATURE_TEXTURE_READ_PIXELS: glReadPixels() support
|
|
|
|
* @COGL_FEATURE_SHADERS_GLSL: GLSL support
|
2010-08-05 05:59:03 -04:00
|
|
|
* @COGL_FEATURE_SHADERS_ARBFP: ARBFP support
|
2009-01-09 09:26:35 -05:00
|
|
|
* @COGL_FEATURE_OFFSCREEN: FBO support
|
|
|
|
* @COGL_FEATURE_OFFSCREEN_MULTISAMPLE: Multisample support on FBOs
|
|
|
|
* @COGL_FEATURE_OFFSCREEN_BLIT: Blit support on FBOs
|
|
|
|
* @COGL_FEATURE_FOUR_CLIP_PLANES: At least 4 clip planes available
|
|
|
|
* @COGL_FEATURE_STENCIL_BUFFER: Stencil buffer support
|
|
|
|
* @COGL_FEATURE_VBOS: VBO support
|
2010-02-02 07:59:51 -05:00
|
|
|
* @COGL_FEATURE_PBOS: PBO support
|
2010-02-23 09:45:44 -05:00
|
|
|
* @COGL_FEATURE_UNSIGNED_INT_INDICES: Set if
|
|
|
|
* %COGL_INDICES_TYPE_UNSIGNED_INT is supported in
|
|
|
|
* cogl_vertex_buffer_indices_new().
|
2010-05-26 06:33:32 -04:00
|
|
|
* @COGL_FEATURE_DEPTH_RANGE: cogl_material_set_depth_range() support
|
2010-07-05 21:01:24 -04:00
|
|
|
* @COGL_FEATURE_TEXTURE_NPOT_BASIC: The hardware supports non power
|
|
|
|
* of two textures, but you also need to check the
|
|
|
|
* %COGL_FEATURE_TEXTURE_NPOT_MIPMAP and %COGL_FEATURE_TEXTURE_NPOT_REPEAT
|
|
|
|
* features to know if the hardware supports npot texture mipmaps
|
|
|
|
* or repeat modes other than
|
2010-10-27 13:54:57 -04:00
|
|
|
* %COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE respectively.
|
2010-07-05 21:01:24 -04:00
|
|
|
* @COGL_FEATURE_TEXTURE_NPOT_MIPMAP: Mipmapping is supported in
|
|
|
|
* conjuntion with non power of two textures.
|
|
|
|
* @COGL_FEATURE_TEXTURE_NPOT_REPEAT: Repeat modes other than
|
2010-10-27 13:54:57 -04:00
|
|
|
* %COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE are supported by the
|
2010-07-05 21:01:24 -04:00
|
|
|
* hardware.
|
2010-03-22 09:33:55 -04:00
|
|
|
* @COGL_FEATURE_POINT_SPRITE: Whether
|
|
|
|
* cogl_material_set_layer_point_sprite_coords_enabled() is supported.
|
2010-07-01 17:04:59 -04:00
|
|
|
* @COGL_FEATURE_TEXTURE_3D: 3D texture support
|
2011-01-13 10:54:50 -05:00
|
|
|
* @COGL_FEATURE_MAP_BUFFER_FOR_READ: Whether cogl_buffer_map() is
|
|
|
|
* supported with CoglBufferAccess including read support.
|
|
|
|
* @COGL_FEATURE_MAP_BUFFER_FOR_WRITE: Whether cogl_buffer_map() is
|
|
|
|
* supported with CoglBufferAccess including write support.
|
2012-05-23 13:19:29 -04:00
|
|
|
* @COGL_FEATURE_DEPTH_TEXTURE: Whether #CoglFramebuffer support rendering the
|
|
|
|
* depth buffer to a texture.
|
2008-10-30 13:25:00 -04:00
|
|
|
*
|
|
|
|
* Flags for the supported features.
|
2009-01-09 09:26:35 -05:00
|
|
|
*
|
|
|
|
* Since: 0.8
|
2008-10-30 13:25:00 -04:00
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
COGL_FEATURE_TEXTURE_RECTANGLE = (1 << 1),
|
|
|
|
COGL_FEATURE_TEXTURE_NPOT = (1 << 2),
|
|
|
|
COGL_FEATURE_TEXTURE_YUV = (1 << 3),
|
|
|
|
COGL_FEATURE_TEXTURE_READ_PIXELS = (1 << 4),
|
|
|
|
COGL_FEATURE_SHADERS_GLSL = (1 << 5),
|
|
|
|
COGL_FEATURE_OFFSCREEN = (1 << 6),
|
|
|
|
COGL_FEATURE_OFFSCREEN_MULTISAMPLE = (1 << 7),
|
|
|
|
COGL_FEATURE_OFFSCREEN_BLIT = (1 << 8),
|
|
|
|
COGL_FEATURE_FOUR_CLIP_PLANES = (1 << 9),
|
2008-11-10 13:53:14 -05:00
|
|
|
COGL_FEATURE_STENCIL_BUFFER = (1 << 10),
|
2010-02-02 07:59:51 -05:00
|
|
|
COGL_FEATURE_VBOS = (1 << 11),
|
2010-02-23 09:45:44 -05:00
|
|
|
COGL_FEATURE_PBOS = (1 << 12),
|
2010-05-26 06:33:32 -04:00
|
|
|
COGL_FEATURE_UNSIGNED_INT_INDICES = (1 << 13),
|
2010-07-05 21:01:24 -04:00
|
|
|
COGL_FEATURE_DEPTH_RANGE = (1 << 14),
|
|
|
|
COGL_FEATURE_TEXTURE_NPOT_BASIC = (1 << 15),
|
|
|
|
COGL_FEATURE_TEXTURE_NPOT_MIPMAP = (1 << 16),
|
2010-03-22 09:33:55 -04:00
|
|
|
COGL_FEATURE_TEXTURE_NPOT_REPEAT = (1 << 17),
|
2010-07-01 17:04:59 -04:00
|
|
|
COGL_FEATURE_POINT_SPRITE = (1 << 18),
|
2010-08-05 05:59:03 -04:00
|
|
|
COGL_FEATURE_TEXTURE_3D = (1 << 19),
|
2011-01-13 10:54:50 -05:00
|
|
|
COGL_FEATURE_SHADERS_ARBFP = (1 << 20),
|
|
|
|
COGL_FEATURE_MAP_BUFFER_FOR_READ = (1 << 21),
|
2010-11-05 08:28:33 -04:00
|
|
|
COGL_FEATURE_MAP_BUFFER_FOR_WRITE = (1 << 22),
|
2012-05-23 13:19:29 -04:00
|
|
|
COGL_FEATURE_ONSCREEN_MULTIPLE = (1 << 23),
|
|
|
|
COGL_FEATURE_DEPTH_TEXTURE = (1 << 24)
|
2008-10-30 13:25:00 -04:00
|
|
|
} CoglFeatureFlags;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* CoglBufferTarget:
|
2009-01-09 09:26:35 -05:00
|
|
|
* @COGL_WINDOW_BUFFER: FIXME
|
|
|
|
* @COGL_OFFSCREEN_BUFFER: FIXME
|
2008-10-30 13:25:00 -04:00
|
|
|
*
|
2009-01-09 09:26:35 -05:00
|
|
|
* Target flags for FBOs.
|
2008-10-30 13:25:00 -04:00
|
|
|
*
|
2009-01-09 09:26:35 -05:00
|
|
|
* Since: 0.8
|
2008-10-30 13:25:00 -04:00
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
COGL_WINDOW_BUFFER = (1 << 1),
|
2009-04-30 17:19:43 -04:00
|
|
|
COGL_OFFSCREEN_BUFFER = (1 << 2)
|
2008-10-30 13:25:00 -04:00
|
|
|
} CoglBufferTarget;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* CoglColor:
|
2012-12-30 14:45:11 -05:00
|
|
|
* @red: amount of red
|
|
|
|
* @green: amount of green
|
|
|
|
* @blue: amount of green
|
|
|
|
* @alpha: alpha
|
2008-10-30 13:25:00 -04:00
|
|
|
*
|
|
|
|
* A structure for holding a color definition. The contents of
|
|
|
|
* the CoglColor structure are private and should never by accessed
|
|
|
|
* directly.
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
|
|
|
struct _CoglColor
|
|
|
|
{
|
|
|
|
/*< private >*/
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 16:56:40 -04:00
|
|
|
uint8_t COGL_PRIVATE (red);
|
|
|
|
uint8_t COGL_PRIVATE (green);
|
|
|
|
uint8_t COGL_PRIVATE (blue);
|
2008-10-30 13:25:00 -04:00
|
|
|
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 16:56:40 -04:00
|
|
|
uint8_t COGL_PRIVATE (alpha);
|
2009-01-27 06:01:23 -05:00
|
|
|
|
|
|
|
/* padding in case we want to change to floats at
|
|
|
|
* some point */
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 16:56:40 -04:00
|
|
|
uint32_t COGL_PRIVATE (padding0);
|
|
|
|
uint32_t COGL_PRIVATE (padding1);
|
|
|
|
uint32_t COGL_PRIVATE (padding2);
|
2008-10-30 13:25:00 -04:00
|
|
|
};
|
2011-05-13 12:30:08 -04:00
|
|
|
COGL_STRUCT_SIZE_ASSERT (CoglColor, 16);
|
2008-10-30 13:25:00 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* CoglTextureVertex:
|
|
|
|
* @x: Model x-coordinate
|
|
|
|
* @y: Model y-coordinate
|
|
|
|
* @z: Model z-coordinate
|
|
|
|
* @tx: Texture x-coordinate
|
|
|
|
* @ty: Texture y-coordinate
|
|
|
|
* @color: The color to use at this vertex. This is ignored if
|
2009-08-18 06:11:29 -04:00
|
|
|
* use_color is %FALSE when calling cogl_polygon()
|
2008-10-30 13:25:00 -04:00
|
|
|
*
|
2009-08-18 06:11:29 -04:00
|
|
|
* Used to specify vertex information when calling cogl_polygon()
|
2008-10-30 13:25:00 -04:00
|
|
|
*/
|
|
|
|
struct _CoglTextureVertex
|
|
|
|
{
|
2009-01-20 11:20:54 -05:00
|
|
|
float x, y, z;
|
|
|
|
float tx, ty;
|
2009-08-18 06:11:29 -04:00
|
|
|
|
2008-10-30 13:25:00 -04:00
|
|
|
CoglColor color;
|
|
|
|
};
|
2011-05-13 12:30:08 -04:00
|
|
|
COGL_STRUCT_SIZE_ASSERT (CoglTextureVertex, 36);
|
2008-10-30 13:25:00 -04:00
|
|
|
|
2009-01-18 09:51:19 -05:00
|
|
|
/**
|
|
|
|
* CoglTextureFlags:
|
|
|
|
* @COGL_TEXTURE_NONE: No flags specified
|
2009-06-04 11:04:57 -04:00
|
|
|
* @COGL_TEXTURE_NO_AUTO_MIPMAP: Disables the automatic generation of
|
|
|
|
* the mipmap pyramid from the base level image whenever it is
|
|
|
|
* updated. The mipmaps are only generated when the texture is
|
|
|
|
* rendered with a mipmap filter so it should be free to leave out
|
2010-02-09 09:41:37 -05:00
|
|
|
* this flag when using other filtering modes
|
[cogl] Remove max_waste argument from Texture ctors
The CoglTexture constructors expose the "max-waste" argument for
controlling the maximum amount of wasted areas for slicing or,
if set to -1, disables slicing.
Slicing is really relevant only for large images that are never
repeated, so it's a useful feature only in controlled use cases.
Specifying the amount of wasted area is, on the other hand, just
a way to mess up this feature; 99% the times, you either pull this
number out of thin air, hoping it's right, or you try to do the
right thing and you choose the wrong number anyway.
Instead, we can use the CoglTextureFlags to control whether the
texture should not be sliced (useful for Clutter-GST and for the
texture-from-pixmap actors) and provide a reasonable value for
enabling the slicing ourself. At some point, we might even
provide a way to change the default at compile time or at run time,
for particular platforms.
Since max_waste is gone, the :tile-waste property of ClutterTexture
becomes read-only, and it proxies the cogl_texture_get_max_waste()
function.
Inside Clutter, the only cases where the max_waste argument was
not set to -1 are in the Pango glyph cache (which is a POT texture
anyway) and inside the test cases where we want to force slicing;
for the latter we can create larger textures that will be bigger than
the threshold we set.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Signed-off-by: Robert Bragg <robert@linux.intel.com>
Signed-off-by: Neil Roberts <neil@linux.intel.com>
2009-05-23 14:18:18 -04:00
|
|
|
* @COGL_TEXTURE_NO_SLICING: Disables the slicing of the texture
|
2010-02-09 09:41:37 -05:00
|
|
|
* @COGL_TEXTURE_NO_ATLAS: Disables the insertion of the texture inside
|
|
|
|
* the texture atlas used by Cogl
|
2009-01-18 09:51:19 -05:00
|
|
|
*
|
|
|
|
* Flags to pass to the cogl_texture_new_* family of functions.
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
|
|
|
typedef enum {
|
2009-06-04 11:04:57 -04:00
|
|
|
COGL_TEXTURE_NONE = 0,
|
|
|
|
COGL_TEXTURE_NO_AUTO_MIPMAP = 1 << 0,
|
2009-12-04 08:06:32 -05:00
|
|
|
COGL_TEXTURE_NO_SLICING = 1 << 1,
|
|
|
|
COGL_TEXTURE_NO_ATLAS = 1 << 2
|
2009-01-18 09:51:19 -05:00
|
|
|
} CoglTextureFlags;
|
|
|
|
|
2009-03-09 13:06:22 -04:00
|
|
|
/**
|
|
|
|
* CoglFogMode:
|
|
|
|
* @COGL_FOG_MODE_LINEAR: Calculates the fog blend factor as:
|
|
|
|
* |[
|
|
|
|
* f = end - eye_distance / end - start
|
|
|
|
* ]|
|
|
|
|
* @COGL_FOG_MODE_EXPONENTIAL: Calculates the fog blend factor as:
|
|
|
|
* |[
|
|
|
|
* f = e ^ -(density * eye_distance)
|
|
|
|
* ]|
|
|
|
|
* @COGL_FOG_MODE_EXPONENTIAL_SQUARED: Calculates the fog blend factor as:
|
|
|
|
* |[
|
|
|
|
* f = e ^ -(density * eye_distance)^2
|
|
|
|
* ]|
|
|
|
|
*
|
|
|
|
* The fog mode determines the equation used to calculate the fogging blend
|
|
|
|
* factor while fogging is enabled. The simplest %COGL_FOG_MODE_LINEAR mode
|
|
|
|
* determines f as:
|
|
|
|
*
|
|
|
|
* |[
|
|
|
|
* f = end - eye_distance / end - start
|
|
|
|
* ]|
|
|
|
|
*
|
|
|
|
* Where eye_distance is the distance of the current fragment in eye
|
|
|
|
* coordinates from the origin.
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
2009-05-29 07:31:47 -04:00
|
|
|
typedef enum {
|
2009-03-09 13:06:22 -04:00
|
|
|
COGL_FOG_MODE_LINEAR,
|
|
|
|
COGL_FOG_MODE_EXPONENTIAL,
|
|
|
|
COGL_FOG_MODE_EXPONENTIAL_SQUARED
|
|
|
|
} CoglFogMode;
|
|
|
|
|
2010-02-09 09:41:37 -05:00
|
|
|
/**
|
|
|
|
* COGL_BLEND_STRING_ERROR:
|
|
|
|
*
|
2012-08-31 14:28:27 -04:00
|
|
|
* #CoglError domain for blend string parser errors
|
2010-02-09 09:41:37 -05:00
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
2009-07-20 07:47:53 -04:00
|
|
|
#define COGL_BLEND_STRING_ERROR (cogl_blend_string_error_quark ())
|
|
|
|
|
2010-02-09 09:41:37 -05:00
|
|
|
/**
|
|
|
|
* CoglBlendStringError:
|
|
|
|
* @COGL_BLEND_STRING_ERROR_PARSE_ERROR: Generic parse error
|
|
|
|
* @COGL_BLEND_STRING_ERROR_ARGUMENT_PARSE_ERROR: Argument parse error
|
|
|
|
* @COGL_BLEND_STRING_ERROR_INVALID_ERROR: Internal parser error
|
|
|
|
* @COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR: Blend string not
|
|
|
|
* supported by the GPU
|
|
|
|
*
|
|
|
|
* Error enumeration for the blend strings parser
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
2009-07-20 07:47:53 -04:00
|
|
|
typedef enum { /*< prefix=COGL_BLEND_STRING_ERROR >*/
|
|
|
|
COGL_BLEND_STRING_ERROR_PARSE_ERROR,
|
|
|
|
COGL_BLEND_STRING_ERROR_ARGUMENT_PARSE_ERROR,
|
|
|
|
COGL_BLEND_STRING_ERROR_INVALID_ERROR,
|
|
|
|
COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR
|
|
|
|
} CoglBlendStringError;
|
|
|
|
|
2012-08-31 14:28:27 -04:00
|
|
|
uint32_t
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-09 20:57:32 -05:00
|
|
|
cogl_blend_string_error_quark (void);
|
2009-07-20 07:47:53 -04:00
|
|
|
|
2012-08-31 14:28:27 -04:00
|
|
|
#define COGL_SYSTEM_ERROR (_cogl_system_error_quark ())
|
2010-05-26 06:33:32 -04:00
|
|
|
|
|
|
|
/**
|
2012-08-31 14:28:27 -04:00
|
|
|
* CoglSystemError:
|
|
|
|
* @COGL_SYSTEM_ERROR_UNSUPPORTED: You tried to use a feature or
|
2010-07-13 07:59:24 -04:00
|
|
|
* configuration not currently available.
|
2012-08-31 14:28:27 -04:00
|
|
|
* @COGL_SYSTEM_ERROR_NO_MEMORY: You tried to allocate a resource
|
2011-10-08 06:53:20 -04:00
|
|
|
* such as a texture and there wasn't enough memory.
|
2010-05-26 06:33:32 -04:00
|
|
|
*
|
|
|
|
* Error enumeration for Cogl
|
|
|
|
*
|
2012-08-31 14:28:27 -04:00
|
|
|
* The @COGL_SYSTEM_ERROR_UNSUPPORTED error can be thrown for a
|
|
|
|
* variety of reasons. For example:
|
2010-07-13 07:59:24 -04:00
|
|
|
*
|
|
|
|
* <itemizedlist>
|
|
|
|
* <listitem><para>You've tried to use a feature that is not
|
2012-08-31 14:28:27 -04:00
|
|
|
* advertised by cogl_has_feature(). This could happen if you create
|
2011-10-08 06:53:20 -04:00
|
|
|
* a 2d texture with a non-power-of-two size when
|
2012-08-31 14:28:27 -04:00
|
|
|
* %COGL_FEATURE_ID_TEXTURE_NPOT is not advertised.</para></listitem>
|
2010-07-13 07:59:24 -04:00
|
|
|
* <listitem><para>The GPU can not handle the configuration you have
|
|
|
|
* requested. An example might be if you try to use too many texture
|
2010-10-27 13:54:57 -04:00
|
|
|
* layers in a single #CoglPipeline</para></listitem>
|
2010-07-13 07:59:24 -04:00
|
|
|
* <listitem><para>The driver does not support some
|
|
|
|
* configuration.</para></listiem>
|
|
|
|
* </itemizedlist>
|
|
|
|
*
|
2010-05-26 06:33:32 -04:00
|
|
|
* Currently this is only used by Cogl API marked as experimental so
|
|
|
|
* this enum should also be considered experimental.
|
|
|
|
*
|
|
|
|
* Since: 1.4
|
2011-10-08 06:53:20 -04:00
|
|
|
* Stability: unstable
|
2010-05-26 06:33:32 -04:00
|
|
|
*/
|
|
|
|
typedef enum { /*< prefix=COGL_ERROR >*/
|
2012-08-31 14:28:27 -04:00
|
|
|
COGL_SYSTEM_ERROR_UNSUPPORTED,
|
|
|
|
COGL_SYSTEM_ERROR_NO_MEMORY
|
|
|
|
} CoglSystemError;
|
2010-05-26 06:33:32 -04:00
|
|
|
|
2012-08-31 14:28:27 -04:00
|
|
|
uint32_t
|
|
|
|
_cogl_system_error_quark (void);
|
2010-05-26 06:33:32 -04:00
|
|
|
|
2011-01-20 14:31:53 -05:00
|
|
|
/**
|
|
|
|
* CoglAttributeType:
|
|
|
|
* @COGL_ATTRIBUTE_TYPE_BYTE: Data is the same size of a byte
|
|
|
|
* @COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE: Data is the same size of an
|
|
|
|
* unsigned byte
|
|
|
|
* @COGL_ATTRIBUTE_TYPE_SHORT: Data is the same size of a short integer
|
|
|
|
* @COGL_ATTRIBUTE_TYPE_UNSIGNED_SHORT: Data is the same size of
|
|
|
|
* an unsigned short integer
|
|
|
|
* @COGL_ATTRIBUTE_TYPE_FLOAT: Data is the same size of a float
|
|
|
|
*
|
|
|
|
* Data types for the components of a vertex attribute.
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
COGL_ATTRIBUTE_TYPE_BYTE = 0x1400,
|
|
|
|
COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE = 0x1401,
|
|
|
|
COGL_ATTRIBUTE_TYPE_SHORT = 0x1402,
|
|
|
|
COGL_ATTRIBUTE_TYPE_UNSIGNED_SHORT = 0x1403,
|
|
|
|
COGL_ATTRIBUTE_TYPE_FLOAT = 0x1406
|
|
|
|
} CoglAttributeType;
|
|
|
|
|
2010-10-12 07:53:44 -04:00
|
|
|
/**
|
|
|
|
* CoglIndicesType:
|
|
|
|
* @COGL_INDICES_TYPE_UNSIGNED_BYTE: Your indices are unsigned bytes
|
|
|
|
* @COGL_INDICES_TYPE_UNSIGNED_SHORT: Your indices are unsigned shorts
|
|
|
|
* @COGL_INDICES_TYPE_UNSIGNED_INT: Your indices are unsigned ints
|
|
|
|
*
|
|
|
|
* You should aim to use the smallest data type that gives you enough
|
|
|
|
* range, since it reduces the size of your index array and can help
|
|
|
|
* reduce the demand on memory bandwidth.
|
|
|
|
*
|
|
|
|
* Note that %COGL_INDICES_TYPE_UNSIGNED_INT is only supported if the
|
2012-12-31 18:26:11 -05:00
|
|
|
* %COGL_FEATURE_ID_UNSIGNED_INT_INDICES feature is available. This
|
2010-10-12 07:53:44 -04:00
|
|
|
* should always be available on OpenGL but on OpenGL ES it will only
|
|
|
|
* be available if the GL_OES_element_index_uint extension is
|
|
|
|
* advertized.
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
COGL_INDICES_TYPE_UNSIGNED_BYTE,
|
|
|
|
COGL_INDICES_TYPE_UNSIGNED_SHORT,
|
|
|
|
COGL_INDICES_TYPE_UNSIGNED_INT
|
|
|
|
} CoglIndicesType;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* CoglVerticesMode:
|
2012-12-31 17:08:44 -05:00
|
|
|
* @COGL_VERTICES_MODE_POINTS: FIXME, equivalent to
|
|
|
|
* <constant>GL_POINTS</constant>
|
|
|
|
* @COGL_VERTICES_MODE_LINES: FIXME, equivalent to <constant>GL_LINES</constant>
|
|
|
|
* @COGL_VERTICES_MODE_LINE_LOOP: FIXME, equivalent to
|
|
|
|
* <constant>GL_LINE_LOOP</constant>
|
|
|
|
* @COGL_VERTICES_MODE_LINE_STRIP: FIXME, equivalent to
|
|
|
|
* <constant>GL_LINE_STRIP</constant>
|
|
|
|
* @COGL_VERTICES_MODE_TRIANGLES: FIXME, equivalent to
|
|
|
|
* <constant>GL_TRIANGLES</constant>
|
|
|
|
* @COGL_VERTICES_MODE_TRIANGLE_STRIP: FIXME, equivalent to
|
|
|
|
* <constant>GL_TRIANGLE_STRIP</constant>
|
|
|
|
* @COGL_VERTICES_MODE_TRIANGLE_FAN: FIXME, equivalent to <constant>GL_TRIANGLE_FAN</constant>
|
2010-10-12 07:53:44 -04:00
|
|
|
*
|
|
|
|
* Different ways of interpreting vertices when drawing.
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
COGL_VERTICES_MODE_POINTS = 0x0000,
|
|
|
|
COGL_VERTICES_MODE_LINES = 0x0001,
|
|
|
|
COGL_VERTICES_MODE_LINE_LOOP = 0x0002,
|
|
|
|
COGL_VERTICES_MODE_LINE_STRIP = 0x0003,
|
|
|
|
COGL_VERTICES_MODE_TRIANGLES = 0x0004,
|
|
|
|
COGL_VERTICES_MODE_TRIANGLE_STRIP = 0x0005,
|
|
|
|
COGL_VERTICES_MODE_TRIANGLE_FAN = 0x0006
|
|
|
|
} CoglVerticesMode;
|
|
|
|
|
|
|
|
/* NB: The above definitions are taken from gl.h equivalents */
|
|
|
|
|
2010-10-27 13:54:57 -04:00
|
|
|
|
|
|
|
/* XXX: should this be CoglMaterialDepthTestFunction?
|
|
|
|
* It makes it very verbose but would be consistent with
|
|
|
|
* CoglMaterialWrapMode */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* CoglDepthTestFunction:
|
|
|
|
* @COGL_DEPTH_TEST_FUNCTION_NEVER: Never passes.
|
|
|
|
* @COGL_DEPTH_TEST_FUNCTION_LESS: Passes if the fragment's depth
|
|
|
|
* value is less than the value currently in the depth buffer.
|
|
|
|
* @COGL_DEPTH_TEST_FUNCTION_EQUAL: Passes if the fragment's depth
|
|
|
|
* value is equal to the value currently in the depth buffer.
|
|
|
|
* @COGL_DEPTH_TEST_FUNCTION_LEQUAL: Passes if the fragment's depth
|
|
|
|
* value is less or equal to the value currently in the depth buffer.
|
|
|
|
* @COGL_DEPTH_TEST_FUNCTION_GREATER: Passes if the fragment's depth
|
|
|
|
* value is greater than the value currently in the depth buffer.
|
|
|
|
* @COGL_DEPTH_TEST_FUNCTION_NOTEQUAL: Passes if the fragment's depth
|
|
|
|
* value is not equal to the value currently in the depth buffer.
|
|
|
|
* @COGL_DEPTH_TEST_FUNCTION_GEQUAL: Passes if the fragment's depth
|
|
|
|
* value greater than or equal to the value currently in the depth buffer.
|
|
|
|
* @COGL_DEPTH_TEST_FUNCTION_ALWAYS: Always passes.
|
|
|
|
*
|
|
|
|
* When using depth testing one of these functions is used to compare
|
|
|
|
* the depth of an incoming fragment against the depth value currently
|
|
|
|
* stored in the depth buffer. The function is changed using
|
2012-12-31 09:58:31 -05:00
|
|
|
* cogl_depth_state_set_test_function().
|
2010-10-27 13:54:57 -04:00
|
|
|
*
|
|
|
|
* The test is only done when depth testing is explicitly enabled. (See
|
2012-12-31 09:58:31 -05:00
|
|
|
* cogl_depth_state_set_test_enabled())
|
2010-10-27 13:54:57 -04:00
|
|
|
*/
|
2012-12-31 09:58:31 -05:00
|
|
|
typedef enum {
|
2010-10-27 13:54:57 -04:00
|
|
|
COGL_DEPTH_TEST_FUNCTION_NEVER = 0x0200,
|
|
|
|
COGL_DEPTH_TEST_FUNCTION_LESS = 0x0201,
|
|
|
|
COGL_DEPTH_TEST_FUNCTION_EQUAL = 0x0202,
|
|
|
|
COGL_DEPTH_TEST_FUNCTION_LEQUAL = 0x0203,
|
|
|
|
COGL_DEPTH_TEST_FUNCTION_GREATER = 0x0204,
|
|
|
|
COGL_DEPTH_TEST_FUNCTION_NOTEQUAL = 0x0205,
|
|
|
|
COGL_DEPTH_TEST_FUNCTION_GEQUAL = 0x0206,
|
|
|
|
COGL_DEPTH_TEST_FUNCTION_ALWAYS = 0x0207
|
|
|
|
} CoglDepthTestFunction;
|
|
|
|
/* NB: The above definitions are taken from gl.h equivalents */
|
|
|
|
|
2010-11-05 08:28:33 -04:00
|
|
|
typedef enum { /*< prefix=COGL_RENDERER_ERROR >*/
|
2012-04-26 07:18:56 -04:00
|
|
|
COGL_RENDERER_ERROR_XLIB_DISPLAY_OPEN,
|
|
|
|
COGL_RENDERER_ERROR_BAD_CONSTRAINT
|
2010-11-05 08:28:33 -04:00
|
|
|
} CoglRendererError;
|
|
|
|
|
2012-12-31 12:45:50 -05:00
|
|
|
/**
|
2011-04-13 11:41:41 -04:00
|
|
|
* CoglFilterReturn:
|
|
|
|
* @COGL_FILTER_CONTINUE: The event was not handled, continues the
|
|
|
|
* processing
|
|
|
|
* @COGL_FILTER_REMOVE: Remove the event, stops the processing
|
2010-11-05 08:28:33 -04:00
|
|
|
*
|
2012-12-31 18:26:11 -05:00
|
|
|
* Return values for the #CoglXlibFilterFunc and #CoglWin32FilterFunc functions.
|
2010-11-05 08:28:33 -04:00
|
|
|
*
|
|
|
|
* Stability: Unstable
|
|
|
|
*/
|
2011-04-13 11:41:41 -04:00
|
|
|
typedef enum _CoglFilterReturn { /*< prefix=COGL_FILTER >*/
|
|
|
|
COGL_FILTER_CONTINUE,
|
|
|
|
COGL_FILTER_REMOVE
|
|
|
|
} CoglFilterReturn;
|
2010-11-05 08:28:33 -04:00
|
|
|
|
|
|
|
typedef enum _CoglWinsysFeature
|
|
|
|
{
|
|
|
|
/* Available if the window system can support multiple onscreen
|
|
|
|
* framebuffers at the same time. */
|
|
|
|
COGL_WINSYS_FEATURE_MULTIPLE_ONSCREEN,
|
|
|
|
|
|
|
|
/* Available if onscreen framebuffer swaps can be automatically
|
|
|
|
* throttled to the vblank frequency. */
|
|
|
|
COGL_WINSYS_FEATURE_SWAP_THROTTLE,
|
|
|
|
|
|
|
|
/* Available if its possible to query a counter that
|
|
|
|
* increments at each vblank. */
|
|
|
|
COGL_WINSYS_FEATURE_VBLANK_COUNTER,
|
|
|
|
|
|
|
|
/* Available if its possible to wait until the next vertical
|
|
|
|
* blank period */
|
|
|
|
COGL_WINSYS_FEATURE_VBLANK_WAIT,
|
|
|
|
|
|
|
|
/* Available if the window system supports mapping native
|
|
|
|
* pixmaps to textures. */
|
|
|
|
COGL_WINSYS_FEATURE_TEXTURE_FROM_PIXMAP,
|
|
|
|
|
|
|
|
/* Available if the window system supports reporting an event
|
|
|
|
* for swap buffer completions. */
|
|
|
|
COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT,
|
|
|
|
|
|
|
|
/* Available if it's possible to swap a list of sub rectangles
|
|
|
|
* from the back buffer to the front buffer */
|
|
|
|
COGL_WINSYS_FEATURE_SWAP_REGION,
|
|
|
|
|
|
|
|
/* Available if swap_region requests can be automatically throttled
|
|
|
|
* to the vblank frequency. */
|
2011-04-15 10:39:14 -04:00
|
|
|
COGL_WINSYS_FEATURE_SWAP_REGION_THROTTLE,
|
|
|
|
|
2011-09-17 18:46:07 -04:00
|
|
|
/* Available if the swap region implementation won't tear and thus
|
|
|
|
* only needs to be throttled to the framerate */
|
|
|
|
COGL_WINSYS_FEATURE_SWAP_REGION_SYNCHRONIZED,
|
|
|
|
|
2012-12-14 17:26:30 -05:00
|
|
|
/* Avaiable if the age of the back buffer can be queried */
|
|
|
|
COGL_WINSYS_FEATURE_BUFFER_AGE,
|
|
|
|
|
2012-11-12 11:58:10 -05:00
|
|
|
/* Avaiable if the winsys directly handles _SYNC and _COMPLETE events */
|
|
|
|
COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT,
|
|
|
|
|
2011-04-15 10:39:14 -04:00
|
|
|
COGL_WINSYS_FEATURE_N_FEATURES
|
2010-11-05 08:28:33 -04:00
|
|
|
} CoglWinsysFeature;
|
|
|
|
|
2011-07-10 21:27:54 -04:00
|
|
|
/**
|
|
|
|
* CoglColorMask:
|
|
|
|
* @COGL_COLOR_MASK_NONE: None of the color channels are masked
|
|
|
|
* @COGL_COLOR_MASK_RED: Masks the red color channel
|
|
|
|
* @COGL_COLOR_MASK_GREEN: Masks the green color channel
|
|
|
|
* @COGL_COLOR_MASK_BLUE: Masks the blue color channel
|
|
|
|
* @COGL_COLOR_MASK_ALPHA: Masks the alpha color channel
|
|
|
|
* @COGL_COLOR_MASK_ALL: All of the color channels are masked
|
|
|
|
*
|
|
|
|
* Defines a bit mask of color channels. This can be used with
|
|
|
|
* cogl_pipeline_set_color_mask() for example to define which color
|
|
|
|
* channels should be written to the current framebuffer when
|
|
|
|
* drawing something.
|
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
COGL_COLOR_MASK_NONE = 0,
|
|
|
|
COGL_COLOR_MASK_RED = 1L<<0,
|
|
|
|
COGL_COLOR_MASK_GREEN = 1L<<1,
|
|
|
|
COGL_COLOR_MASK_BLUE = 1L<<2,
|
|
|
|
COGL_COLOR_MASK_ALPHA = 1L<<3,
|
|
|
|
/* XXX: glib-mkenums is a perl script that can't cope if we split
|
|
|
|
* this onto multiple lines! *sigh* */
|
|
|
|
COGL_COLOR_MASK_ALL = (COGL_COLOR_MASK_RED | COGL_COLOR_MASK_GREEN | COGL_COLOR_MASK_BLUE | COGL_COLOR_MASK_ALPHA)
|
|
|
|
} CoglColorMask;
|
|
|
|
|
2011-11-08 08:58:33 -05:00
|
|
|
/**
|
|
|
|
* CoglWinding:
|
|
|
|
* @COGL_WINDING_CLOCKWISE: Vertices are in a clockwise order
|
|
|
|
* @COGL_WINDING_COUNTER_CLOCKWISE: Vertices are in a counter-clockwise order
|
|
|
|
*
|
|
|
|
* Enum used to represent the two directions of rotation. This can be
|
|
|
|
* used to set the front face for culling by calling
|
|
|
|
* cogl_pipeline_set_front_face_winding().
|
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
COGL_WINDING_CLOCKWISE,
|
|
|
|
COGL_WINDING_COUNTER_CLOCKWISE
|
|
|
|
} CoglWinding;
|
|
|
|
|
2012-02-17 16:46:39 -05:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*
|
2012-12-31 18:26:11 -05:00
|
|
|
* Flags for cogl_framebuffer_read_pixels_into_bitmap()
|
2012-02-17 16:46:39 -05:00
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
|
|
|
typedef enum { /*< prefix=COGL_READ_PIXELS >*/
|
|
|
|
COGL_READ_PIXELS_COLOR_BUFFER = 1L << 0
|
|
|
|
} CoglReadPixelsFlags;
|
|
|
|
|
2012-11-22 13:01:10 -05:00
|
|
|
COGL_END_DECLS
|
2008-10-30 13:25:00 -04:00
|
|
|
|
|
|
|
#endif /* __COGL_TYPES_H__ */
|