Adds CoglError api
Although we use GLib internally in Cogl we would rather not leak GLib api through Cogl's own api, except through explicitly namespaced cogl_glib_ / cogl_gtype_ feature apis. One of the benefits we see to not leaking GLib through Cogl's public API is that documentation for Cogl won't need to first introduce the Glib API to newcomers, thus hopefully lowering the barrier to learning Cogl. This patch provides a Cogl specific typedef for reporting runtime errors which by no coincidence matches the typedef for GError exactly. If Cogl is built with --enable-glib (default) then developers can even safely assume that a CoglError is a GError under the hood. This patch also enforces a consistent policy for when NULL is passed as an error argument and an error is thrown. In this case we log the error and abort the application, instead of silently ignoring it. In common cases where nothing has been implemented to handle a particular error and/or where applications are just printing the error and aborting themselves then this saves some typing. This also seems more consistent with language based exceptions which usually cause a program to abort if they are not explicitly caught (which passing a non-NULL error signifies in this case) Since this policy for NULL error pointers is stricter than the standard GError convention, there is a clear note in the documentation to warn developers that are used to using the GError api. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit b068d5ea09ab32c37e8c965fc8582c85d1b2db46) Note: Since we can't change the Cogl 1.x api the patch was changed to not rename _error_quark() functions to be _error_domain() functions and although it's a bit ugly, instead of providing our own CoglError type that's compatible with GError we simply #define CoglError to GError unless Cogl is built with glib disabled. Note: this patch does technically introduce an API break since it drops the cogl_error_get_type() symbol generated by glib-mkenum (Since the CoglError enum was replaced by a CoglSystemError enum) but for now we are assuming that this will not affect anyone currently using the Cogl API. If this does turn out to be a problem in practice then we would be able to fix this my manually copying an implementation of cogl_error_get_type() generated by glib-mkenum into a compatibility source file and we could also define the original COGL_ERROR_ enums for compatibility too. Note: another minor concern with cherry-picking this patch to the 1.14 branch is that an api scanner would be lead to believe that some APIs have changed, and for example the gobject-introspection parser which understands the semantics of GError will not understand the semantics of CoglError. We expect most people that have tried to use gobject-introspection with Cogl already understand though that it is not well suited to generating bindings of the Cogl api anyway and we aren't aware or anyone depending on such bindings for apis involving GErrors. (GnomeShell only makes very-very minimal use of Cogl via the gjs bindings for the cogl_rectangle and cogl_color apis.) The main reason we have cherry-picked this patch to the 1.14 branch even given the above concerns is that without it it would become very awkward for us to cherry-pick other beneficial patches from master.
This commit is contained in:
parent
6a126f2af3
commit
df21e20f65
@ -125,6 +125,7 @@ cogl_experimental_h = \
|
|||||||
$(srcdir)/cogl2-experimental.h \
|
$(srcdir)/cogl2-experimental.h \
|
||||||
$(srcdir)/cogl2-compatibility.h \
|
$(srcdir)/cogl2-compatibility.h \
|
||||||
$(srcdir)/cogl-version.h \
|
$(srcdir)/cogl-version.h \
|
||||||
|
$(srcdir)/cogl-error.h \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
cogl_nodist_experimental_h = \
|
cogl_nodist_experimental_h = \
|
||||||
@ -387,6 +388,8 @@ cogl_sources_c = \
|
|||||||
$(srcdir)/cogl-magazine.c \
|
$(srcdir)/cogl-magazine.c \
|
||||||
$(srcdir)/cogl-gles2-context-private.h \
|
$(srcdir)/cogl-gles2-context-private.h \
|
||||||
$(srcdir)/cogl-gles2-context.c \
|
$(srcdir)/cogl-gles2-context.c \
|
||||||
|
$(srcdir)/cogl-error-private.h \
|
||||||
|
$(srcdir)/cogl-error.c \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
if USE_GLIB
|
if USE_GLIB
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "cogl-bitmap-private.h"
|
#include "cogl-bitmap-private.h"
|
||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-private.h"
|
#include "cogl-private.h"
|
||||||
|
#include "cogl-error-private.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -59,7 +60,7 @@ _cogl_bitmap_get_size_from_file (const char *filename,
|
|||||||
CoglBitmap *
|
CoglBitmap *
|
||||||
_cogl_bitmap_from_file (CoglContext *ctx,
|
_cogl_bitmap_from_file (CoglContext *ctx,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CFURLRef url;
|
CFURLRef url;
|
||||||
CGImageSourceRef image_source;
|
CGImageSourceRef image_source;
|
||||||
@ -83,7 +84,7 @@ _cogl_bitmap_from_file (CoglContext *ctx,
|
|||||||
if (image_source == NULL)
|
if (image_source == NULL)
|
||||||
{
|
{
|
||||||
/* doesn't exist, not readable, etc. */
|
/* doesn't exist, not readable, etc. */
|
||||||
g_set_error_literal (error,
|
_cogl_set_error_literal (error,
|
||||||
COGL_BITMAP_ERROR,
|
COGL_BITMAP_ERROR,
|
||||||
COGL_BITMAP_ERROR_FAILED,
|
COGL_BITMAP_ERROR_FAILED,
|
||||||
g_strerror (save_errno));
|
g_strerror (save_errno));
|
||||||
@ -97,7 +98,7 @@ _cogl_bitmap_from_file (CoglContext *ctx,
|
|||||||
if (type == NULL)
|
if (type == NULL)
|
||||||
{
|
{
|
||||||
CFRelease (image_source);
|
CFRelease (image_source);
|
||||||
g_set_error_literal (error,
|
_cogl_set_error_literal (error,
|
||||||
COGL_BITMAP_ERROR,
|
COGL_BITMAP_ERROR,
|
||||||
COGL_BITMAP_ERROR_UNKNOWN_TYPE,
|
COGL_BITMAP_ERROR_UNKNOWN_TYPE,
|
||||||
"Unknown image type");
|
"Unknown image type");
|
||||||
@ -115,7 +116,7 @@ _cogl_bitmap_from_file (CoglContext *ctx,
|
|||||||
{
|
{
|
||||||
/* incomplete or corrupt */
|
/* incomplete or corrupt */
|
||||||
CFRelease (image);
|
CFRelease (image);
|
||||||
g_set_error_literal (error,
|
_cogl_set_error_literal (error,
|
||||||
COGL_BITMAP_ERROR,
|
COGL_BITMAP_ERROR,
|
||||||
COGL_BITMAP_ERROR_CORRUPT_IMAGE,
|
COGL_BITMAP_ERROR_CORRUPT_IMAGE,
|
||||||
"Image has zero width or height");
|
"Image has zero width or height");
|
||||||
@ -174,7 +175,7 @@ _cogl_bitmap_get_size_from_file (const char *filename,
|
|||||||
CoglBitmap *
|
CoglBitmap *
|
||||||
_cogl_bitmap_from_file (CoglContext *ctx,
|
_cogl_bitmap_from_file (CoglContext *ctx,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
static CoglUserDataKey pixbuf_key;
|
static CoglUserDataKey pixbuf_key;
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
@ -187,11 +188,15 @@ _cogl_bitmap_from_file (CoglContext *ctx,
|
|||||||
int bits_per_sample;
|
int bits_per_sample;
|
||||||
int n_channels;
|
int n_channels;
|
||||||
CoglBitmap *bmp;
|
CoglBitmap *bmp;
|
||||||
|
GError *glib_error = NULL;
|
||||||
|
|
||||||
/* Load from file using GdkPixbuf */
|
/* Load from file using GdkPixbuf */
|
||||||
pixbuf = gdk_pixbuf_new_from_file (filename, error);
|
pixbuf = gdk_pixbuf_new_from_file (filename, &glib_error);
|
||||||
if (pixbuf == NULL)
|
if (pixbuf == NULL)
|
||||||
|
{
|
||||||
|
_cogl_propogate_gerror (error, glib_error);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get pixbuf properties */
|
/* Get pixbuf properties */
|
||||||
has_alpha = gdk_pixbuf_get_has_alpha (pixbuf);
|
has_alpha = gdk_pixbuf_get_has_alpha (pixbuf);
|
||||||
@ -308,7 +313,7 @@ _cogl_bitmap_new_from_stb_pixels (CoglContext *ctx,
|
|||||||
int stb_pixel_format,
|
int stb_pixel_format,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
static CoglUserDataKey bitmap_data_key;
|
static CoglUserDataKey bitmap_data_key;
|
||||||
CoglBitmap *bmp;
|
CoglBitmap *bmp;
|
||||||
@ -317,7 +322,7 @@ _cogl_bitmap_new_from_stb_pixels (CoglContext *ctx,
|
|||||||
|
|
||||||
if (pixels == NULL)
|
if (pixels == NULL)
|
||||||
{
|
{
|
||||||
g_set_error_literal (error,
|
_cogl_set_error_literal (error,
|
||||||
COGL_BITMAP_ERROR,
|
COGL_BITMAP_ERROR,
|
||||||
COGL_BITMAP_ERROR_FAILED,
|
COGL_BITMAP_ERROR_FAILED,
|
||||||
"Failed to load image with stb image library");
|
"Failed to load image with stb image library");
|
||||||
@ -338,7 +343,7 @@ _cogl_bitmap_new_from_stb_pixels (CoglContext *ctx,
|
|||||||
|
|
||||||
if (!pixels)
|
if (!pixels)
|
||||||
{
|
{
|
||||||
g_set_error_literal (error,
|
_cogl_set_error_literal (error,
|
||||||
COGL_BITMAP_ERROR,
|
COGL_BITMAP_ERROR,
|
||||||
COGL_BITMAP_ERROR_FAILED,
|
COGL_BITMAP_ERROR_FAILED,
|
||||||
"Failed to alloc memory to convert "
|
"Failed to alloc memory to convert "
|
||||||
@ -380,7 +385,7 @@ _cogl_bitmap_new_from_stb_pixels (CoglContext *ctx,
|
|||||||
CoglBitmap *
|
CoglBitmap *
|
||||||
_cogl_bitmap_from_file (CoglContext *ctx,
|
_cogl_bitmap_from_file (CoglContext *ctx,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
int stb_pixel_format;
|
int stb_pixel_format;
|
||||||
int width;
|
int width;
|
||||||
@ -401,7 +406,7 @@ CoglBitmap *
|
|||||||
_cogl_android_bitmap_new_from_asset (CoglContext *ctx,
|
_cogl_android_bitmap_new_from_asset (CoglContext *ctx,
|
||||||
AAssetManager *manager,
|
AAssetManager *manager,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
AAsset *asset;
|
AAsset *asset;
|
||||||
const void *data;
|
const void *data;
|
||||||
@ -415,7 +420,7 @@ _cogl_android_bitmap_new_from_asset (CoglContext *ctx,
|
|||||||
asset = AAssetManager_open (manager, filename, AASSET_MODE_BUFFER);
|
asset = AAssetManager_open (manager, filename, AASSET_MODE_BUFFER);
|
||||||
if (!asset)
|
if (!asset)
|
||||||
{
|
{
|
||||||
g_set_error_literal (error,
|
_cogl_set_error_literal (error,
|
||||||
COGL_BITMAP_ERROR,
|
COGL_BITMAP_ERROR,
|
||||||
COGL_BITMAP_ERROR_FAILED,
|
COGL_BITMAP_ERROR_FAILED,
|
||||||
"Failed to open asset");
|
"Failed to open asset");
|
||||||
@ -425,7 +430,7 @@ _cogl_android_bitmap_new_from_asset (CoglContext *ctx,
|
|||||||
data = AAsset_getBuffer (asset);
|
data = AAsset_getBuffer (asset);
|
||||||
if (!data)
|
if (!data)
|
||||||
{
|
{
|
||||||
g_set_error_literal (error,
|
_cogl_set_error_literal (error,
|
||||||
COGL_BITMAP_ERROR,
|
COGL_BITMAP_ERROR,
|
||||||
COGL_BITMAP_ERROR_FAILED,
|
COGL_BITMAP_ERROR_FAILED,
|
||||||
"Failed to ::getBuffer from asset");
|
"Failed to ::getBuffer from asset");
|
||||||
|
@ -109,14 +109,14 @@ _cogl_bitmap_convert_into_bitmap (CoglBitmap *src_bmp,
|
|||||||
CoglBitmap *
|
CoglBitmap *
|
||||||
_cogl_bitmap_from_file (CoglContext *ctx,
|
_cogl_bitmap_from_file (CoglContext *ctx,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
#ifdef COGL_HAS_ANDROID_SUPPORT
|
#ifdef COGL_HAS_ANDROID_SUPPORT
|
||||||
CoglBitmap *
|
CoglBitmap *
|
||||||
_cogl_android_bitmap_new_from_asset (CoglContext *ctx,
|
_cogl_android_bitmap_new_from_asset (CoglContext *ctx,
|
||||||
AAssetManager *manager,
|
AAssetManager *manager,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CoglBool
|
CoglBool
|
||||||
|
@ -225,7 +225,7 @@ _cogl_bitmap_new_shared (CoglBitmap *shared_bmp,
|
|||||||
|
|
||||||
CoglBitmap *
|
CoglBitmap *
|
||||||
cogl_bitmap_new_from_file (const char *filename,
|
cogl_bitmap_new_from_file (const char *filename,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
_COGL_GET_CONTEXT (ctx, NULL);
|
_COGL_GET_CONTEXT (ctx, NULL);
|
||||||
|
|
||||||
@ -298,7 +298,7 @@ CoglBitmap *
|
|||||||
cogl_android_bitmap_new_from_asset (CoglContext *ctx,
|
cogl_android_bitmap_new_from_asset (CoglContext *ctx,
|
||||||
AAssetManager *manager,
|
AAssetManager *manager,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
_COGL_RETURN_VAL_IF_FAIL (ctx != NULL, NULL);
|
_COGL_RETURN_VAL_IF_FAIL (ctx != NULL, NULL);
|
||||||
_COGL_RETURN_VAL_IF_FAIL (manager != NULL, NULL);
|
_COGL_RETURN_VAL_IF_FAIL (manager != NULL, NULL);
|
||||||
@ -349,7 +349,7 @@ cogl_bitmap_get_buffer (CoglBitmap *bitmap)
|
|||||||
return COGL_PIXEL_BUFFER (bitmap->buffer);
|
return COGL_PIXEL_BUFFER (bitmap->buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
GQuark
|
uint32_t
|
||||||
cogl_bitmap_error_quark (void)
|
cogl_bitmap_error_quark (void)
|
||||||
{
|
{
|
||||||
return g_quark_from_static_string ("cogl-bitmap-error-quark");
|
return g_quark_from_static_string ("cogl-bitmap-error-quark");
|
||||||
|
@ -55,7 +55,7 @@ typedef struct _CoglBitmap CoglBitmap;
|
|||||||
/**
|
/**
|
||||||
* cogl_bitmap_new_from_file:
|
* cogl_bitmap_new_from_file:
|
||||||
* @filename: the file to load.
|
* @filename: the file to load.
|
||||||
* @error: a #GError or %NULL.
|
* @error: a #CoglError or %NULL.
|
||||||
*
|
*
|
||||||
* Loads an image file from disk. This function can be safely called from
|
* Loads an image file from disk. This function can be safely called from
|
||||||
* within a thread.
|
* within a thread.
|
||||||
@ -67,7 +67,7 @@ typedef struct _CoglBitmap CoglBitmap;
|
|||||||
*/
|
*/
|
||||||
CoglBitmap *
|
CoglBitmap *
|
||||||
cogl_bitmap_new_from_file (const char *filename,
|
cogl_bitmap_new_from_file (const char *filename,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
#ifdef COGL_HAS_ANDROID_SUPPORT
|
#ifdef COGL_HAS_ANDROID_SUPPORT
|
||||||
/**
|
/**
|
||||||
@ -75,7 +75,7 @@ cogl_bitmap_new_from_file (const char *filename,
|
|||||||
* @context: A #CoglContext
|
* @context: A #CoglContext
|
||||||
* @manager: An Android Asset Manager.
|
* @manager: An Android Asset Manager.
|
||||||
* @filename: The file name for the asset
|
* @filename: The file name for the asset
|
||||||
* @error: A return location for a GError exception.
|
* @error: A return location for a CoglError exception.
|
||||||
*
|
*
|
||||||
* Loads an Android asset into a newly allocated #CoglBitmap.
|
* Loads an Android asset into a newly allocated #CoglBitmap.
|
||||||
*
|
*
|
||||||
@ -88,7 +88,7 @@ CoglBitmap *
|
|||||||
cogl_android_bitmap_new_from_asset (CoglContext *context,
|
cogl_android_bitmap_new_from_asset (CoglContext *context,
|
||||||
AAssetManager *manager,
|
AAssetManager *manager,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (COGL_ENABLE_EXPERIMENTAL_API)
|
#if defined (COGL_ENABLE_EXPERIMENTAL_API)
|
||||||
@ -280,7 +280,7 @@ cogl_is_bitmap (void *object);
|
|||||||
/**
|
/**
|
||||||
* COGL_BITMAP_ERROR:
|
* COGL_BITMAP_ERROR:
|
||||||
*
|
*
|
||||||
* #GError domain for bitmap errors.
|
* #CoglError domain for bitmap errors.
|
||||||
*
|
*
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
*/
|
*/
|
||||||
@ -307,7 +307,7 @@ typedef enum {
|
|||||||
COGL_BITMAP_ERROR_CORRUPT_IMAGE
|
COGL_BITMAP_ERROR_CORRUPT_IMAGE
|
||||||
} CoglBitmapError;
|
} CoglBitmapError;
|
||||||
|
|
||||||
GQuark cogl_bitmap_error_quark (void);
|
uint32_t cogl_bitmap_error_quark (void);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-debug.h"
|
#include "cogl-debug.h"
|
||||||
#include "cogl-blend-string.h"
|
#include "cogl-blend-string.h"
|
||||||
|
#include "cogl-error-private.h"
|
||||||
|
|
||||||
typedef enum _ParserState
|
typedef enum _ParserState
|
||||||
{
|
{
|
||||||
@ -118,7 +119,7 @@ static CoglBlendStringFunctionInfo blend_functions[] = {
|
|||||||
|
|
||||||
#undef DEFINE_FUNCTION
|
#undef DEFINE_FUNCTION
|
||||||
|
|
||||||
GQuark
|
uint32_t
|
||||||
cogl_blend_string_error_quark (void)
|
cogl_blend_string_error_quark (void)
|
||||||
{
|
{
|
||||||
return g_quark_from_static_string ("cogl-blend-string-error-quark");
|
return g_quark_from_static_string ("cogl-blend-string-error-quark");
|
||||||
@ -161,7 +162,7 @@ _cogl_blend_string_split_rgba_statement (CoglBlendStringStatement *statement,
|
|||||||
static CoglBool
|
static CoglBool
|
||||||
validate_tex_combine_statements (CoglBlendStringStatement *statements,
|
validate_tex_combine_statements (CoglBlendStringStatement *statements,
|
||||||
int n_statements,
|
int n_statements,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
const char *error_string;
|
const char *error_string;
|
||||||
@ -190,7 +191,7 @@ validate_tex_combine_statements (CoglBlendStringStatement *statements,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_BLEND_STRING_ERROR,
|
COGL_BLEND_STRING_ERROR,
|
||||||
detail,
|
detail,
|
||||||
"Invalid texture combine string: %s",
|
"Invalid texture combine string: %s",
|
||||||
@ -207,7 +208,7 @@ error:
|
|||||||
static CoglBool
|
static CoglBool
|
||||||
validate_blend_statements (CoglBlendStringStatement *statements,
|
validate_blend_statements (CoglBlendStringStatement *statements,
|
||||||
int n_statements,
|
int n_statements,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
const char *error_string;
|
const char *error_string;
|
||||||
@ -275,7 +276,7 @@ validate_blend_statements (CoglBlendStringStatement *statements,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_BLEND_STRING_ERROR,
|
COGL_BLEND_STRING_ERROR,
|
||||||
detail,
|
detail,
|
||||||
"Invalid blend string: %s",
|
"Invalid blend string: %s",
|
||||||
@ -287,7 +288,7 @@ static CoglBool
|
|||||||
validate_statements_for_context (CoglBlendStringStatement *statements,
|
validate_statements_for_context (CoglBlendStringStatement *statements,
|
||||||
int n_statements,
|
int n_statements,
|
||||||
CoglBlendStringContext context,
|
CoglBlendStringContext context,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
const char *error_string;
|
const char *error_string;
|
||||||
|
|
||||||
@ -313,7 +314,7 @@ validate_statements_for_context (CoglBlendStringStatement *statements,
|
|||||||
return validate_tex_combine_statements (statements, n_statements, error);
|
return validate_tex_combine_statements (statements, n_statements, error);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_BLEND_STRING_ERROR,
|
COGL_BLEND_STRING_ERROR,
|
||||||
COGL_BLEND_STRING_ERROR_INVALID_ERROR,
|
COGL_BLEND_STRING_ERROR_INVALID_ERROR,
|
||||||
"Invalid %s string: %s",
|
"Invalid %s string: %s",
|
||||||
@ -474,7 +475,7 @@ parse_argument (const char *string, /* original user string */
|
|||||||
int current_arg,
|
int current_arg,
|
||||||
CoglBlendStringArgument *arg, /* OUT */
|
CoglBlendStringArgument *arg, /* OUT */
|
||||||
CoglBlendStringContext context,
|
CoglBlendStringContext context,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
const char *p = *ret_p;
|
const char *p = *ret_p;
|
||||||
const char *mark = NULL;
|
const char *mark = NULL;
|
||||||
@ -743,7 +744,7 @@ parse_argument (const char *string, /* original user string */
|
|||||||
error:
|
error:
|
||||||
{
|
{
|
||||||
int offset = p - string;
|
int offset = p - string;
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_BLEND_STRING_ERROR,
|
COGL_BLEND_STRING_ERROR,
|
||||||
COGL_BLEND_STRING_ERROR_ARGUMENT_PARSE_ERROR,
|
COGL_BLEND_STRING_ERROR_ARGUMENT_PARSE_ERROR,
|
||||||
"Syntax error for argument %d at offset %d: %s",
|
"Syntax error for argument %d at offset %d: %s",
|
||||||
@ -764,7 +765,7 @@ int
|
|||||||
_cogl_blend_string_compile (const char *string,
|
_cogl_blend_string_compile (const char *string,
|
||||||
CoglBlendStringContext context,
|
CoglBlendStringContext context,
|
||||||
CoglBlendStringStatement *statements,
|
CoglBlendStringStatement *statements,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
const char *p = string;
|
const char *p = string;
|
||||||
const char *mark = NULL;
|
const char *mark = NULL;
|
||||||
@ -924,7 +925,7 @@ finished:
|
|||||||
error:
|
error:
|
||||||
{
|
{
|
||||||
int offset = p - string;
|
int offset = p - string;
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_BLEND_STRING_ERROR,
|
COGL_BLEND_STRING_ERROR,
|
||||||
COGL_BLEND_STRING_ERROR_PARSE_ERROR,
|
COGL_BLEND_STRING_ERROR_PARSE_ERROR,
|
||||||
"Syntax error at offset %d: %s",
|
"Syntax error at offset %d: %s",
|
||||||
@ -981,7 +982,7 @@ _cogl_blend_string_test (void)
|
|||||||
};
|
};
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
for (i = 0; strings[i].string; i++)
|
for (i = 0; strings[i].string; i++)
|
||||||
{
|
{
|
||||||
CoglBlendStringStatement statements[2];
|
CoglBlendStringStatement statements[2];
|
||||||
@ -994,7 +995,7 @@ _cogl_blend_string_test (void)
|
|||||||
g_print ("Failed to parse string:\n%s\n%s\n",
|
g_print ("Failed to parse string:\n%s\n%s\n",
|
||||||
strings[i].string,
|
strings[i].string,
|
||||||
error->message);
|
error->message);
|
||||||
g_error_free (error);
|
cogl_error_free (error);
|
||||||
error = NULL;
|
error = NULL;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ CoglBool
|
|||||||
_cogl_blend_string_compile (const char *string,
|
_cogl_blend_string_compile (const char *string,
|
||||||
CoglBlendStringContext context,
|
CoglBlendStringContext context,
|
||||||
CoglBlendStringStatement *statements,
|
CoglBlendStringStatement *statements,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_blend_string_split_rgba_statement (CoglBlendStringStatement *statement,
|
_cogl_blend_string_split_rgba_statement (CoglBlendStringStatement *statement,
|
||||||
|
@ -336,7 +336,7 @@ _cogl_context_get_winsys (CoglContext *context);
|
|||||||
* return FALSE and set @error */
|
* return FALSE and set @error */
|
||||||
CoglBool
|
CoglBool
|
||||||
_cogl_context_update_features (CoglContext *context,
|
_cogl_context_update_features (CoglContext *context,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
/* Obtains the context and returns retval if NULL */
|
/* Obtains the context and returns retval if NULL */
|
||||||
#define _COGL_GET_CONTEXT(ctxvar, retval) \
|
#define _COGL_GET_CONTEXT(ctxvar, retval) \
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
#include "cogl1-context.h"
|
#include "cogl1-context.h"
|
||||||
#include "cogl-gpu-info-private.h"
|
#include "cogl-gpu-info-private.h"
|
||||||
#include "cogl-config-private.h"
|
#include "cogl-config-private.h"
|
||||||
|
#include "cogl-error-private.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -124,13 +125,14 @@ _cogl_context_get_winsys (CoglContext *context)
|
|||||||
*/
|
*/
|
||||||
CoglContext *
|
CoglContext *
|
||||||
cogl_context_new (CoglDisplay *display,
|
cogl_context_new (CoglDisplay *display,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglContext *context;
|
CoglContext *context;
|
||||||
GLubyte default_texture_data[] = { 0xff, 0xff, 0xff, 0x0 };
|
GLubyte default_texture_data[] = { 0xff, 0xff, 0xff, 0x0 };
|
||||||
CoglBitmap *default_texture_bitmap;
|
CoglBitmap *default_texture_bitmap;
|
||||||
const CoglWinsysVtable *winsys;
|
const CoglWinsysVtable *winsys;
|
||||||
int i;
|
int i;
|
||||||
|
CoglError *internal_error = NULL;
|
||||||
|
|
||||||
_cogl_init ();
|
_cogl_init ();
|
||||||
|
|
||||||
@ -390,18 +392,26 @@ cogl_context_new (CoglDisplay *display,
|
|||||||
/* internal format */
|
/* internal format */
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||||
NULL);
|
NULL);
|
||||||
/* If 3D or rectangle textures aren't supported then these should
|
|
||||||
just silently return NULL */
|
/* If 3D or rectangle textures aren't supported then these will
|
||||||
|
* return errors that we can simply ignore. */
|
||||||
|
internal_error = NULL;
|
||||||
context->default_gl_texture_3d_tex =
|
context->default_gl_texture_3d_tex =
|
||||||
cogl_texture_3d_new_from_bitmap (default_texture_bitmap,
|
cogl_texture_3d_new_from_bitmap (default_texture_bitmap,
|
||||||
1, /* height */
|
1, /* height */
|
||||||
1, /* depth */
|
1, /* depth */
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||||
NULL);
|
&internal_error);
|
||||||
|
if (internal_error)
|
||||||
|
cogl_error_free (internal_error);
|
||||||
|
|
||||||
|
internal_error = NULL;
|
||||||
context->default_gl_texture_rect_tex =
|
context->default_gl_texture_rect_tex =
|
||||||
cogl_texture_rectangle_new_from_bitmap (default_texture_bitmap,
|
cogl_texture_rectangle_new_from_bitmap (default_texture_bitmap,
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||||
NULL);
|
&internal_error);
|
||||||
|
if (internal_error)
|
||||||
|
cogl_error_free (internal_error);
|
||||||
|
|
||||||
cogl_object_unref (default_texture_bitmap);
|
cogl_object_unref (default_texture_bitmap);
|
||||||
|
|
||||||
@ -532,7 +542,7 @@ _cogl_context_free (CoglContext *context)
|
|||||||
CoglContext *
|
CoglContext *
|
||||||
_cogl_context_get_default (void)
|
_cogl_context_get_default (void)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
/* Create if doesn't exist yet */
|
/* Create if doesn't exist yet */
|
||||||
if (_cogl_context == NULL)
|
if (_cogl_context == NULL)
|
||||||
{
|
{
|
||||||
@ -541,7 +551,7 @@ _cogl_context_get_default (void)
|
|||||||
{
|
{
|
||||||
g_warning ("Failed to create default context: %s",
|
g_warning ("Failed to create default context: %s",
|
||||||
error->message);
|
error->message);
|
||||||
g_error_free (error);
|
cogl_error_free (error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -569,7 +579,7 @@ cogl_egl_context_get_egl_display (CoglContext *context)
|
|||||||
|
|
||||||
CoglBool
|
CoglBool
|
||||||
_cogl_context_update_features (CoglContext *context,
|
_cogl_context_update_features (CoglContext *context,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
return context->driver_vtable->update_features (context, error);
|
return context->driver_vtable->update_features (context, error);
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ G_BEGIN_DECLS
|
|||||||
/**
|
/**
|
||||||
* cogl_context_new:
|
* cogl_context_new:
|
||||||
* @display: A #CoglDisplay pointer
|
* @display: A #CoglDisplay pointer
|
||||||
* @error: A GError return location.
|
* @error: A CoglError return location.
|
||||||
*
|
*
|
||||||
* Creates a new #CoglContext which acts as an application sandbox
|
* Creates a new #CoglContext which acts as an application sandbox
|
||||||
* for any state objects that are allocated.
|
* for any state objects that are allocated.
|
||||||
@ -105,7 +105,7 @@ G_BEGIN_DECLS
|
|||||||
*/
|
*/
|
||||||
CoglContext *
|
CoglContext *
|
||||||
cogl_context_new (CoglDisplay *display,
|
cogl_context_new (CoglDisplay *display,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_context_get_display:
|
* cogl_context_get_display:
|
||||||
|
@ -83,7 +83,7 @@ cogl_display_new (CoglRenderer *renderer,
|
|||||||
CoglOnscreenTemplate *onscreen_template)
|
CoglOnscreenTemplate *onscreen_template)
|
||||||
{
|
{
|
||||||
CoglDisplay *display = g_slice_new0 (CoglDisplay);
|
CoglDisplay *display = g_slice_new0 (CoglDisplay);
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
|
|
||||||
_cogl_init ();
|
_cogl_init ();
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ cogl_display_get_renderer (CoglDisplay *display)
|
|||||||
|
|
||||||
CoglBool
|
CoglBool
|
||||||
cogl_display_setup (CoglDisplay *display,
|
cogl_display_setup (CoglDisplay *display,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
const CoglWinsysVtable *winsys;
|
const CoglWinsysVtable *winsys;
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ cogl_display_get_renderer (CoglDisplay *display);
|
|||||||
/**
|
/**
|
||||||
* cogl_display_setup:
|
* cogl_display_setup:
|
||||||
* @display: a #CoglDisplay
|
* @display: a #CoglDisplay
|
||||||
* @error: return location for a #GError
|
* @error: return location for a #CoglError
|
||||||
*
|
*
|
||||||
* Explicitly sets up the given @display object. Use of this api is
|
* Explicitly sets up the given @display object. Use of this api is
|
||||||
* optional since Cogl will internally setup the display if not done
|
* optional since Cogl will internally setup the display if not done
|
||||||
@ -154,7 +154,7 @@ cogl_display_get_renderer (CoglDisplay *display);
|
|||||||
*/
|
*/
|
||||||
CoglBool
|
CoglBool
|
||||||
cogl_display_setup (CoglDisplay *display,
|
cogl_display_setup (CoglDisplay *display,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT
|
#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT
|
||||||
/**
|
/**
|
||||||
|
@ -46,11 +46,11 @@ struct _CoglDriverVtable
|
|||||||
|
|
||||||
CoglBool
|
CoglBool
|
||||||
(* update_features) (CoglContext *context,
|
(* update_features) (CoglContext *context,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
CoglBool
|
CoglBool
|
||||||
(* offscreen_allocate) (CoglOffscreen *offscreen,
|
(* offscreen_allocate) (CoglOffscreen *offscreen,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
void
|
void
|
||||||
(* offscreen_free) (CoglOffscreen *offscreen);
|
(* offscreen_free) (CoglOffscreen *offscreen);
|
||||||
|
48
cogl/cogl-error-private.h
Normal file
48
cogl/cogl-error-private.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Cogl
|
||||||
|
*
|
||||||
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 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_ERROR_PRIVATE_H__
|
||||||
|
#define __COGL_ERROR_PRIVATE_H__
|
||||||
|
|
||||||
|
#include "cogl-error.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
_cogl_set_error (CoglError **error,
|
||||||
|
uint32_t domain,
|
||||||
|
int code,
|
||||||
|
const char *format,
|
||||||
|
...) G_GNUC_PRINTF (4, 5);
|
||||||
|
|
||||||
|
void
|
||||||
|
_cogl_set_error_literal (CoglError **error,
|
||||||
|
uint32_t domain,
|
||||||
|
int code,
|
||||||
|
const char *message);
|
||||||
|
|
||||||
|
void
|
||||||
|
_cogl_propogate_gerror (CoglError **dest,
|
||||||
|
GError *src);
|
||||||
|
|
||||||
|
#define _cogl_clear_error(X) g_clear_error ((GError **)X)
|
||||||
|
|
||||||
|
#endif /* __COGL_ERROR_PRIVATE_H__ */
|
109
cogl/cogl-error.c
Normal file
109
cogl/cogl-error.c
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
/*
|
||||||
|
* Cogl
|
||||||
|
*
|
||||||
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||||
|
*
|
||||||
|
* Copyright (C) 2011 Intel Corporation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Robert Bragg <robert@linux.intel.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "cogl-types.h"
|
||||||
|
#include "cogl-util.h"
|
||||||
|
#include "cogl-error-private.h"
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
void
|
||||||
|
cogl_error_free (CoglError *error)
|
||||||
|
{
|
||||||
|
g_error_free ((GError *)error);
|
||||||
|
}
|
||||||
|
|
||||||
|
CoglError *
|
||||||
|
cogl_error_copy (CoglError *error)
|
||||||
|
{
|
||||||
|
return (CoglError *)g_error_copy ((GError *)error);
|
||||||
|
}
|
||||||
|
|
||||||
|
CoglBool
|
||||||
|
cogl_error_matches (CoglError *error,
|
||||||
|
uint32_t domain,
|
||||||
|
int code)
|
||||||
|
{
|
||||||
|
return g_error_matches ((GError *)error, domain, code);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define ERROR_OVERWRITTEN_WARNING \
|
||||||
|
"CoglError set over the top of a previous CoglError or " \
|
||||||
|
"uninitialized memory.\nThis indicates a bug in someone's " \
|
||||||
|
"code. You must ensure an error is NULL before it's set.\n" \
|
||||||
|
"The overwriting error message was: %s"
|
||||||
|
|
||||||
|
void
|
||||||
|
_cogl_set_error (CoglError **error,
|
||||||
|
uint32_t domain,
|
||||||
|
int code,
|
||||||
|
const char *format,
|
||||||
|
...)
|
||||||
|
{
|
||||||
|
GError *new;
|
||||||
|
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
va_start (args, format);
|
||||||
|
|
||||||
|
if (error == NULL)
|
||||||
|
{
|
||||||
|
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args);
|
||||||
|
va_end (args);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
new = g_error_new_valist (domain, code, format, args);
|
||||||
|
va_end (args);
|
||||||
|
|
||||||
|
if (*error == NULL)
|
||||||
|
*error = (CoglError *)new;
|
||||||
|
else
|
||||||
|
g_warning (ERROR_OVERWRITTEN_WARNING, new->message);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_cogl_set_error_literal (CoglError **error,
|
||||||
|
uint32_t domain,
|
||||||
|
int code,
|
||||||
|
const char *message)
|
||||||
|
{
|
||||||
|
_cogl_set_error (error, domain, code, "%s", message);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_cogl_propogate_gerror (CoglError **dest,
|
||||||
|
GError *src)
|
||||||
|
{
|
||||||
|
_COGL_RETURN_IF_FAIL (src != NULL);
|
||||||
|
|
||||||
|
_cogl_set_error_literal (dest, src->domain, src->code, src->message);
|
||||||
|
g_error_free (src);
|
||||||
|
}
|
175
cogl/cogl-error.h
Normal file
175
cogl/cogl-error.h
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
/*
|
||||||
|
* Cogl
|
||||||
|
*
|
||||||
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 Intel Corporation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION)
|
||||||
|
#error "Only <cogl/cogl.h> can be included directly."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __COGL_ERROR_H__
|
||||||
|
#define __COGL_ERROR_H__
|
||||||
|
|
||||||
|
#include "cogl-types.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SECTION:cogl-error
|
||||||
|
* @short_description: A way for Cogl to throw exceptions
|
||||||
|
*
|
||||||
|
* As a general rule Cogl shields non-recoverable errors from
|
||||||
|
* developers, such as most heap allocation failures (unless for
|
||||||
|
* exceptionally large resources which we might reasonably expect to
|
||||||
|
* fail) and this reduces the burdon on developers.
|
||||||
|
*
|
||||||
|
* There are some Cogl apis though that can fail for exceptional
|
||||||
|
* reasons that can also potentially be recovered from at runtime
|
||||||
|
* and for these apis we use a standard convention for reporting
|
||||||
|
* runtime recoverable errors.
|
||||||
|
*
|
||||||
|
* As an example if we look at the cogl_context_new() api which
|
||||||
|
* takes an error argument:
|
||||||
|
* |[
|
||||||
|
* CoglContext *
|
||||||
|
* cogl_context_new (CoglDisplay *display, CoglError **error);
|
||||||
|
* ]|
|
||||||
|
*
|
||||||
|
* A caller interested in catching any runtime error when creating a
|
||||||
|
* new #CoglContext would pass the address of a #CoglError pointer
|
||||||
|
* that has first been initialized to %NULL as follows:
|
||||||
|
*
|
||||||
|
* |[
|
||||||
|
* CoglError *error = NULL;
|
||||||
|
* CoglContext *context;
|
||||||
|
*
|
||||||
|
* context = cogl_context_new (NULL, &error);
|
||||||
|
* ]|
|
||||||
|
*
|
||||||
|
* The return status should usually be enough to determine if there
|
||||||
|
* was an error set (in this example we can check if context == %NULL)
|
||||||
|
* but if it's not possible to tell from the function's return status
|
||||||
|
* you can instead look directly at the error pointer which you
|
||||||
|
* initialized to %NULL. In this example we now check the error,
|
||||||
|
* report any error to the user, free the error and then simply
|
||||||
|
* abort without attempting to recover.
|
||||||
|
*
|
||||||
|
* |[
|
||||||
|
* if (context == NULL)
|
||||||
|
* {
|
||||||
|
* fprintf (stderr, "Failed to create a Cogl context: %s\n",
|
||||||
|
* error->message);
|
||||||
|
* cogl_error_free (error);
|
||||||
|
* abort ();
|
||||||
|
* }
|
||||||
|
* ]|
|
||||||
|
*
|
||||||
|
* All Cogl APIs that accept an error argument can also be passed a
|
||||||
|
* %NULL pointer. In this case if an exceptional error condition is hit
|
||||||
|
* then Cogl will simply log the error message and abort the
|
||||||
|
* application. This can be compared to language execeptions where the
|
||||||
|
* developer has not attempted to catch the exception. This means the
|
||||||
|
* above example is essentially redundant because it's what Cogl would
|
||||||
|
* have done automatically and so, similarly, if your application has
|
||||||
|
* no way to recover from a particular error you might just as well
|
||||||
|
* pass a %NULL #CoglError pointer to save a bit of typing.
|
||||||
|
*
|
||||||
|
* <note>If you are used to using the GLib API you will probably
|
||||||
|
* recognize that #CoglError is just like a #GError. In fact if Cogl
|
||||||
|
* has been built with --enable-glib then it is safe to cast a
|
||||||
|
* #CoglError to a #GError.</note>
|
||||||
|
*
|
||||||
|
* <note>An important detail to be aware of if you are used to using
|
||||||
|
* GLib's GError API is that Cogl deviates from the GLib GError
|
||||||
|
* conventions in one noteable way which is that a %NULL error pointer
|
||||||
|
* does not mean you want to ignore the details of an error, it means
|
||||||
|
* you are not trying to catch any exceptional errors the function might
|
||||||
|
* throw which will result in the program aborting with a log message
|
||||||
|
* if an error is thrown.</note>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef COGL_HAS_GLIB_SUPPORT
|
||||||
|
#define CoglError GError
|
||||||
|
#else
|
||||||
|
/**
|
||||||
|
* CoglError:
|
||||||
|
* @domain: A high-level domain identifier for the error
|
||||||
|
* @code: A specific error code within a specified domain
|
||||||
|
* @message: A human readable error message
|
||||||
|
*/
|
||||||
|
typedef struct _CoglError
|
||||||
|
{
|
||||||
|
uint32_t domain;
|
||||||
|
int code;
|
||||||
|
char *message;
|
||||||
|
} CoglError;
|
||||||
|
#endif /* COGL_HAS_GLIB_SUPPORT */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_error_free:
|
||||||
|
* @error: A #CoglError thrown by the Cogl api
|
||||||
|
*
|
||||||
|
* Frees a #CoglError and associated resources.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
cogl_error_free (CoglError *error);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_error_copy:
|
||||||
|
* @error: A #CoglError thrown by the Cogl api
|
||||||
|
*
|
||||||
|
* Makes a copy of @error which can later be freed using
|
||||||
|
* cogl_error_free().
|
||||||
|
*
|
||||||
|
* Return value: A newly allocated #CoglError initialized to match the
|
||||||
|
* contents of @error.
|
||||||
|
*/
|
||||||
|
CoglError *
|
||||||
|
cogl_error_copy (CoglError *error);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_error_matches:
|
||||||
|
* @error: A #CoglError thrown by the Cogl api or %NULL
|
||||||
|
*
|
||||||
|
* Returns %TRUE if error matches domain and code, %FALSE otherwise.
|
||||||
|
* In particular, when error is %NULL, FALSE will be returned.
|
||||||
|
*
|
||||||
|
* Return value: whether the @error corresponds to the given @domain
|
||||||
|
* and @code.
|
||||||
|
*/
|
||||||
|
CoglBool
|
||||||
|
cogl_error_matches (CoglError *error,
|
||||||
|
uint32_t domain,
|
||||||
|
int code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* COGL_GLIB_ERROR:
|
||||||
|
* @COGL_ERROR: A #CoglError thrown by the Cogl api or %NULL
|
||||||
|
*
|
||||||
|
* Simply casts a #CoglError to a #CoglError
|
||||||
|
*
|
||||||
|
* If Cogl is built with GLib support then it can safely be assumed
|
||||||
|
* that a CoglError is a GError and can be used directly with the
|
||||||
|
* GError api.
|
||||||
|
*/
|
||||||
|
#ifdef COGL_HAS_GLIB_SUPPORT
|
||||||
|
#define COGL_GLIB_ERROR(COGL_ERROR) ((CoglError *)COGL_ERROR)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __COGL_ERROR_H__ */
|
@ -49,6 +49,7 @@
|
|||||||
#include "cogl-private.h"
|
#include "cogl-private.h"
|
||||||
#include "cogl-primitives-private.h"
|
#include "cogl-primitives-private.h"
|
||||||
#include "cogl-path-private.h"
|
#include "cogl-path-private.h"
|
||||||
|
#include "cogl-error-private.h"
|
||||||
|
|
||||||
typedef struct _CoglFramebufferStackEntry
|
typedef struct _CoglFramebufferStackEntry
|
||||||
{
|
{
|
||||||
@ -75,7 +76,7 @@ COGL_OBJECT_DEFINE_DEPRECATED_REF_COUNTING (offscreen);
|
|||||||
* abstract class manually.
|
* abstract class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
GQuark
|
uint32_t
|
||||||
cogl_framebuffer_error_quark (void)
|
cogl_framebuffer_error_quark (void)
|
||||||
{
|
{
|
||||||
return g_quark_from_static_string ("cogl-framebuffer-error-quark");
|
return g_quark_from_static_string ("cogl-framebuffer-error-quark");
|
||||||
@ -652,7 +653,7 @@ _cogl_offscreen_free (CoglOffscreen *offscreen)
|
|||||||
|
|
||||||
CoglBool
|
CoglBool
|
||||||
cogl_framebuffer_allocate (CoglFramebuffer *framebuffer,
|
cogl_framebuffer_allocate (CoglFramebuffer *framebuffer,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
|
CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
|
||||||
const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer);
|
const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer);
|
||||||
@ -664,7 +665,7 @@ cogl_framebuffer_allocate (CoglFramebuffer *framebuffer,
|
|||||||
{
|
{
|
||||||
if (framebuffer->config.depth_texture_enabled)
|
if (framebuffer->config.depth_texture_enabled)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_FRAMEBUFFER_ERROR,
|
_cogl_set_error (error, COGL_FRAMEBUFFER_ERROR,
|
||||||
COGL_FRAMEBUFFER_ERROR_ALLOCATE,
|
COGL_FRAMEBUFFER_ERROR_ALLOCATE,
|
||||||
"Can't allocate onscreen framebuffer with a "
|
"Can't allocate onscreen framebuffer with a "
|
||||||
"texture based depth buffer");
|
"texture based depth buffer");
|
||||||
|
@ -98,7 +98,7 @@ typedef struct _CoglFramebuffer CoglFramebuffer;
|
|||||||
/**
|
/**
|
||||||
* cogl_framebuffer_allocate:
|
* cogl_framebuffer_allocate:
|
||||||
* @framebuffer: A #CoglFramebuffer
|
* @framebuffer: A #CoglFramebuffer
|
||||||
* @error: A pointer to a #GError for returning exceptions.
|
* @error: A pointer to a #CoglError for returning exceptions.
|
||||||
*
|
*
|
||||||
* Explicitly allocates a configured #CoglFramebuffer allowing developers to
|
* Explicitly allocates a configured #CoglFramebuffer allowing developers to
|
||||||
* check and handle any errors that might arise from an unsupported
|
* check and handle any errors that might arise from an unsupported
|
||||||
@ -117,7 +117,7 @@ typedef struct _CoglFramebuffer CoglFramebuffer;
|
|||||||
*/
|
*/
|
||||||
CoglBool
|
CoglBool
|
||||||
cogl_framebuffer_allocate (CoglFramebuffer *framebuffer,
|
cogl_framebuffer_allocate (CoglFramebuffer *framebuffer,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_framebuffer_get_width:
|
* cogl_framebuffer_get_width:
|
||||||
@ -1782,7 +1782,7 @@ cogl_get_draw_framebuffer (void);
|
|||||||
/* XXX: Note these are defined outside the COGL_ENABLE_EXPERIMENTAL_API guard since
|
/* XXX: Note these are defined outside the COGL_ENABLE_EXPERIMENTAL_API guard since
|
||||||
* otherwise the glib-mkenums stuff will get upset. */
|
* otherwise the glib-mkenums stuff will get upset. */
|
||||||
|
|
||||||
GQuark
|
uint32_t
|
||||||
cogl_framebuffer_error_quark (void);
|
cogl_framebuffer_error_quark (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include "cogl-swap-chain-private.h"
|
#include "cogl-swap-chain-private.h"
|
||||||
#include "cogl-texture-2d-private.h"
|
#include "cogl-texture-2d-private.h"
|
||||||
#include "cogl-pipeline-opengl-private.h"
|
#include "cogl-pipeline-opengl-private.h"
|
||||||
|
#include "cogl-error-private.h"
|
||||||
|
|
||||||
static void _cogl_gles2_context_free (CoglGLES2Context *gles2_context);
|
static void _cogl_gles2_context_free (CoglGLES2Context *gles2_context);
|
||||||
|
|
||||||
@ -88,7 +89,7 @@ enum {
|
|||||||
RESTORE_FB_FROM_ONSCREEN,
|
RESTORE_FB_FROM_ONSCREEN,
|
||||||
};
|
};
|
||||||
|
|
||||||
GQuark
|
uint32_t
|
||||||
_cogl_gles2_context_error_quark (void)
|
_cogl_gles2_context_error_quark (void)
|
||||||
{
|
{
|
||||||
return g_quark_from_static_string ("cogl-gles2-context-error-quark");
|
return g_quark_from_static_string ("cogl-gles2-context-error-quark");
|
||||||
@ -1556,14 +1557,14 @@ free_texture_object_data (CoglGLES2TextureObjectData *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CoglGLES2Context *
|
CoglGLES2Context *
|
||||||
cogl_gles2_context_new (CoglContext *ctx, GError **error)
|
cogl_gles2_context_new (CoglContext *ctx, CoglError **error)
|
||||||
{
|
{
|
||||||
CoglGLES2Context *gles2_ctx;
|
CoglGLES2Context *gles2_ctx;
|
||||||
const CoglWinsysVtable *winsys;
|
const CoglWinsysVtable *winsys;
|
||||||
|
|
||||||
if (!cogl_has_feature (ctx, COGL_FEATURE_ID_GLES2_CONTEXT))
|
if (!cogl_has_feature (ctx, COGL_FEATURE_ID_GLES2_CONTEXT))
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_GLES2_CONTEXT_ERROR,
|
_cogl_set_error (error, COGL_GLES2_CONTEXT_ERROR,
|
||||||
COGL_GLES2_CONTEXT_ERROR_UNSUPPORTED,
|
COGL_GLES2_CONTEXT_ERROR_UNSUPPORTED,
|
||||||
"Backend doesn't support creating GLES2 contexts");
|
"Backend doesn't support creating GLES2 contexts");
|
||||||
|
|
||||||
@ -1683,11 +1684,11 @@ cogl_gles2_context_get_vtable (CoglGLES2Context *gles2_ctx)
|
|||||||
static CoglGLES2Offscreen *
|
static CoglGLES2Offscreen *
|
||||||
_cogl_gles2_offscreen_allocate (CoglOffscreen *offscreen,
|
_cogl_gles2_offscreen_allocate (CoglOffscreen *offscreen,
|
||||||
CoglGLES2Context *gles2_context,
|
CoglGLES2Context *gles2_context,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (offscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (offscreen);
|
||||||
const CoglWinsysVtable *winsys;
|
const CoglWinsysVtable *winsys;
|
||||||
GError *internal_error = NULL;
|
CoglError *internal_error = NULL;
|
||||||
CoglGLES2Offscreen *gles2_offscreen;
|
CoglGLES2Offscreen *gles2_offscreen;
|
||||||
|
|
||||||
if (!framebuffer->allocated &&
|
if (!framebuffer->allocated &&
|
||||||
@ -1710,8 +1711,8 @@ _cogl_gles2_offscreen_allocate (CoglOffscreen *offscreen,
|
|||||||
{
|
{
|
||||||
winsys->restore_context (framebuffer->context);
|
winsys->restore_context (framebuffer->context);
|
||||||
|
|
||||||
g_error_free (internal_error);
|
cogl_error_free (internal_error);
|
||||||
g_set_error (error, COGL_FRAMEBUFFER_ERROR,
|
_cogl_set_error (error, COGL_FRAMEBUFFER_ERROR,
|
||||||
COGL_FRAMEBUFFER_ERROR_ALLOCATE,
|
COGL_FRAMEBUFFER_ERROR_ALLOCATE,
|
||||||
"Failed to bind gles2 context to create framebuffer");
|
"Failed to bind gles2 context to create framebuffer");
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1732,7 +1733,7 @@ _cogl_gles2_offscreen_allocate (CoglOffscreen *offscreen,
|
|||||||
|
|
||||||
g_slice_free (CoglGLES2Offscreen, gles2_offscreen);
|
g_slice_free (CoglGLES2Offscreen, gles2_offscreen);
|
||||||
|
|
||||||
g_set_error (error, COGL_FRAMEBUFFER_ERROR,
|
_cogl_set_error (error, COGL_FRAMEBUFFER_ERROR,
|
||||||
COGL_FRAMEBUFFER_ERROR_ALLOCATE,
|
COGL_FRAMEBUFFER_ERROR_ALLOCATE,
|
||||||
"Failed to create an OpenGL framebuffer object");
|
"Failed to create an OpenGL framebuffer object");
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1763,10 +1764,10 @@ cogl_push_gles2_context (CoglContext *ctx,
|
|||||||
CoglGLES2Context *gles2_ctx,
|
CoglGLES2Context *gles2_ctx,
|
||||||
CoglFramebuffer *read_buffer,
|
CoglFramebuffer *read_buffer,
|
||||||
CoglFramebuffer *write_buffer,
|
CoglFramebuffer *write_buffer,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
const CoglWinsysVtable *winsys = ctx->display->renderer->winsys_vtable;
|
const CoglWinsysVtable *winsys = ctx->display->renderer->winsys_vtable;
|
||||||
GError *internal_error = NULL;
|
CoglError *internal_error = NULL;
|
||||||
|
|
||||||
_COGL_RETURN_VAL_IF_FAIL (gles2_ctx != NULL, FALSE);
|
_COGL_RETURN_VAL_IF_FAIL (gles2_ctx != NULL, FALSE);
|
||||||
|
|
||||||
@ -1845,8 +1846,8 @@ cogl_push_gles2_context (CoglContext *ctx,
|
|||||||
{
|
{
|
||||||
winsys->restore_context (ctx);
|
winsys->restore_context (ctx);
|
||||||
|
|
||||||
g_error_free (internal_error);
|
cogl_error_free (internal_error);
|
||||||
g_set_error (error, COGL_GLES2_CONTEXT_ERROR,
|
_cogl_set_error (error, COGL_GLES2_CONTEXT_ERROR,
|
||||||
COGL_GLES2_CONTEXT_ERROR_DRIVER,
|
COGL_GLES2_CONTEXT_ERROR_DRIVER,
|
||||||
"Driver failed to make GLES2 context current");
|
"Driver failed to make GLES2 context current");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1930,7 +1931,7 @@ cogl_gles2_texture_2d_new_from_handle (CoglContext *ctx,
|
|||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
return cogl_texture_2d_new_from_foreign (ctx,
|
return cogl_texture_2d_new_from_foreign (ctx,
|
||||||
handle,
|
handle,
|
||||||
|
@ -124,7 +124,7 @@ struct _CoglGLES2Vtable
|
|||||||
#undef COGL_EXT_END
|
#undef COGL_EXT_END
|
||||||
};
|
};
|
||||||
|
|
||||||
GQuark
|
uint32_t
|
||||||
_cogl_gles2_context_error_quark (void);
|
_cogl_gles2_context_error_quark (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -156,7 +156,7 @@ typedef enum { /*< prefix=COGL_GLES2_CONTEXT_ERROR >*/
|
|||||||
/**
|
/**
|
||||||
* cogl_gles2_context_new:
|
* cogl_gles2_context_new:
|
||||||
* @ctx: A #CoglContext
|
* @ctx: A #CoglContext
|
||||||
* @error: A pointer to a #GError for returning exceptions
|
* @error: A pointer to a #CoglError for returning exceptions
|
||||||
*
|
*
|
||||||
* Allocates a new OpenGLES 2.0 context that can be used to render to
|
* Allocates a new OpenGLES 2.0 context that can be used to render to
|
||||||
* #CoglOffscreen framebuffers (Rendering to #CoglOnscreen
|
* #CoglOffscreen framebuffers (Rendering to #CoglOnscreen
|
||||||
@ -183,7 +183,7 @@ typedef enum { /*< prefix=COGL_GLES2_CONTEXT_ERROR >*/
|
|||||||
* Stability: unstable
|
* Stability: unstable
|
||||||
*/
|
*/
|
||||||
CoglGLES2Context *
|
CoglGLES2Context *
|
||||||
cogl_gles2_context_new (CoglContext *ctx, GError **error);
|
cogl_gles2_context_new (CoglContext *ctx, CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_gles2_context_get_vtable:
|
* cogl_gles2_context_get_vtable:
|
||||||
@ -215,7 +215,7 @@ cogl_gles2_context_get_vtable (CoglGLES2Context *gles2_ctx);
|
|||||||
* @write_buffer: A #CoglFramebuffer to access for drawing operations
|
* @write_buffer: A #CoglFramebuffer to access for drawing operations
|
||||||
* such as glDrawArrays. (must be a #CoglOffscreen
|
* such as glDrawArrays. (must be a #CoglOffscreen
|
||||||
* framebuffer currently)
|
* framebuffer currently)
|
||||||
* @error: A pointer to a #GError for returning exceptions
|
* @error: A pointer to a #CoglError for returning exceptions
|
||||||
*
|
*
|
||||||
* Pushes the given @gles2_ctx onto a stack associated with @ctx so
|
* Pushes the given @gles2_ctx onto a stack associated with @ctx so
|
||||||
* that the OpenGLES 2.0 api can be used instead of the Cogl
|
* that the OpenGLES 2.0 api can be used instead of the Cogl
|
||||||
@ -239,7 +239,7 @@ cogl_push_gles2_context (CoglContext *ctx,
|
|||||||
CoglGLES2Context *gles2_ctx,
|
CoglGLES2Context *gles2_ctx,
|
||||||
CoglFramebuffer *read_buffer,
|
CoglFramebuffer *read_buffer,
|
||||||
CoglFramebuffer *write_buffer,
|
CoglFramebuffer *write_buffer,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_pop_gles2_context:
|
* cogl_pop_gles2_context:
|
||||||
@ -306,7 +306,7 @@ cogl_gles2_texture_2d_new_from_handle (CoglContext *ctx,
|
|||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_gles2_texture_get_handle:
|
* cogl_gles2_texture_get_handle:
|
||||||
|
@ -118,7 +118,7 @@ typedef enum _CoglPipelineEvalFlags
|
|||||||
CoglBool
|
CoglBool
|
||||||
_cogl_check_extension (const char *name, const char *ext);
|
_cogl_check_extension (const char *name, const char *ext);
|
||||||
|
|
||||||
GQuark
|
uint32_t
|
||||||
_cogl_driver_error_quark (void);
|
_cogl_driver_error_quark (void);
|
||||||
|
|
||||||
#endif /* __COGL_INTERNAL_H */
|
#endif /* __COGL_INTERNAL_H */
|
||||||
|
@ -192,7 +192,7 @@ cogl_material_set_alpha_test_function (CoglMaterial *material,
|
|||||||
CoglBool
|
CoglBool
|
||||||
cogl_material_set_blend (CoglMaterial *material,
|
cogl_material_set_blend (CoglMaterial *material,
|
||||||
const char *blend_string,
|
const char *blend_string,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
return cogl_pipeline_set_blend (COGL_PIPELINE (material),
|
return cogl_pipeline_set_blend (COGL_PIPELINE (material),
|
||||||
blend_string,
|
blend_string,
|
||||||
@ -252,7 +252,7 @@ CoglBool
|
|||||||
cogl_material_set_layer_combine (CoglMaterial *material,
|
cogl_material_set_layer_combine (CoglMaterial *material,
|
||||||
int layer_index,
|
int layer_index,
|
||||||
const char *blend_string,
|
const char *blend_string,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
return cogl_pipeline_set_layer_combine (COGL_PIPELINE (material),
|
return cogl_pipeline_set_layer_combine (COGL_PIPELINE (material),
|
||||||
layer_index,
|
layer_index,
|
||||||
@ -331,7 +331,7 @@ CoglBool
|
|||||||
cogl_material_set_layer_point_sprite_coords_enabled (CoglMaterial *material,
|
cogl_material_set_layer_point_sprite_coords_enabled (CoglMaterial *material,
|
||||||
int layer_index,
|
int layer_index,
|
||||||
CoglBool enable,
|
CoglBool enable,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglPipeline *pipeline = COGL_PIPELINE (material);
|
CoglPipeline *pipeline = COGL_PIPELINE (material);
|
||||||
return cogl_pipeline_set_layer_point_sprite_coords_enabled (pipeline,
|
return cogl_pipeline_set_layer_point_sprite_coords_enabled (pipeline,
|
||||||
@ -439,7 +439,7 @@ cogl_material_foreach_layer (CoglMaterial *material,
|
|||||||
CoglBool
|
CoglBool
|
||||||
cogl_material_set_depth_state (CoglMaterial *material,
|
cogl_material_set_depth_state (CoglMaterial *material,
|
||||||
const CoglDepthState *state,
|
const CoglDepthState *state,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
return cogl_pipeline_set_depth_state (COGL_PIPELINE (material),
|
return cogl_pipeline_set_depth_state (COGL_PIPELINE (material),
|
||||||
state, error);
|
state, error);
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include <cogl/cogl-types.h>
|
#include <cogl/cogl-types.h>
|
||||||
#include <cogl/cogl-matrix.h>
|
#include <cogl/cogl-matrix.h>
|
||||||
#include <cogl/cogl-depth-state.h>
|
#include <cogl/cogl-depth-state.h>
|
||||||
|
#include <cogl/cogl-error.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
@ -508,7 +509,7 @@ cogl_material_set_alpha_test_function (CoglMaterial *material,
|
|||||||
* @material: A #CoglMaterial object
|
* @material: A #CoglMaterial object
|
||||||
* @blend_string: A <link linkend="cogl-Blend-Strings">Cogl blend string</link>
|
* @blend_string: A <link linkend="cogl-Blend-Strings">Cogl blend string</link>
|
||||||
* describing the desired blend function.
|
* describing the desired blend function.
|
||||||
* @error: return location for a #GError that may report lack of driver
|
* @error: return location for a #CoglError that may report lack of driver
|
||||||
* support if you give separate blend string statements for the alpha
|
* support if you give separate blend string statements for the alpha
|
||||||
* channel and RGB channels since some drivers, or backends such as
|
* channel and RGB channels since some drivers, or backends such as
|
||||||
* GLES 1.1, don't support this feature. May be %NULL, in which case a
|
* GLES 1.1, don't support this feature. May be %NULL, in which case a
|
||||||
@ -590,7 +591,7 @@ cogl_material_set_alpha_test_function (CoglMaterial *material,
|
|||||||
CoglBool
|
CoglBool
|
||||||
cogl_material_set_blend (CoglMaterial *material,
|
cogl_material_set_blend (CoglMaterial *material,
|
||||||
const char *blend_string,
|
const char *blend_string,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_set_blend_constant:
|
* cogl_material_set_blend_constant:
|
||||||
@ -746,7 +747,7 @@ cogl_material_remove_layer (CoglMaterial *material,
|
|||||||
* @layer_index: Specifies the layer you want define a combine function for
|
* @layer_index: Specifies the layer you want define a combine function for
|
||||||
* @blend_string: A <link linkend="cogl-Blend-Strings">Cogl blend string</link>
|
* @blend_string: A <link linkend="cogl-Blend-Strings">Cogl blend string</link>
|
||||||
* describing the desired texture combine function.
|
* describing the desired texture combine function.
|
||||||
* @error: A #GError that may report parse errors or lack of GPU/driver
|
* @error: A #CoglError that may report parse errors or lack of GPU/driver
|
||||||
* support. May be %NULL, in which case a warning will be printed out if an
|
* support. May be %NULL, in which case a warning will be printed out if an
|
||||||
* error is encountered.
|
* error is encountered.
|
||||||
*
|
*
|
||||||
@ -836,7 +837,7 @@ CoglBool
|
|||||||
cogl_material_set_layer_combine (CoglMaterial *material,
|
cogl_material_set_layer_combine (CoglMaterial *material,
|
||||||
int layer_index,
|
int layer_index,
|
||||||
const char *blend_string,
|
const char *blend_string,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_set_layer_combine_constant:
|
* cogl_material_set_layer_combine_constant:
|
||||||
@ -997,7 +998,7 @@ cogl_material_set_layer_filters (CoglMaterial *material,
|
|||||||
* @material: a #CoglHandle to a material.
|
* @material: a #CoglHandle to a material.
|
||||||
* @layer_index: the layer number to change.
|
* @layer_index: the layer number to change.
|
||||||
* @enable: whether to enable point sprite coord generation.
|
* @enable: whether to enable point sprite coord generation.
|
||||||
* @error: A return location for a GError, or NULL to ignore errors.
|
* @error: A return location for a CoglError, or NULL to ignore errors.
|
||||||
*
|
*
|
||||||
* When rendering points, if @enable is %TRUE then the texture
|
* When rendering points, if @enable is %TRUE then the texture
|
||||||
* coordinates for this layer will be replaced with coordinates that
|
* coordinates for this layer will be replaced with coordinates that
|
||||||
@ -1017,7 +1018,7 @@ CoglBool
|
|||||||
cogl_material_set_layer_point_sprite_coords_enabled (CoglMaterial *material,
|
cogl_material_set_layer_point_sprite_coords_enabled (CoglMaterial *material,
|
||||||
int layer_index,
|
int layer_index,
|
||||||
CoglBool enable,
|
CoglBool enable,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_get_layer_point_sprite_coords_enabled:
|
* cogl_material_get_layer_point_sprite_coords_enabled:
|
||||||
@ -1199,7 +1200,7 @@ cogl_material_layer_get_wrap_mode_p (CoglMaterialLayer *layer);
|
|||||||
* cogl_material_set_depth_state:
|
* cogl_material_set_depth_state:
|
||||||
* @material: A #CoglMaterial object
|
* @material: A #CoglMaterial object
|
||||||
* @state: A #CoglDepthState struct
|
* @state: A #CoglDepthState struct
|
||||||
* @error: A #GError to report failures to setup the given @state.
|
* @error: A #CoglError to report failures to setup the given @state.
|
||||||
*
|
*
|
||||||
* This commits all the depth state configured in @state struct to the
|
* This commits all the depth state configured in @state struct to the
|
||||||
* given @material. The configuration values are copied into the
|
* given @material. The configuration values are copied into the
|
||||||
@ -1218,7 +1219,7 @@ cogl_material_layer_get_wrap_mode_p (CoglMaterialLayer *layer);
|
|||||||
CoglBool
|
CoglBool
|
||||||
cogl_material_set_depth_state (CoglMaterial *material,
|
cogl_material_set_depth_state (CoglMaterial *material,
|
||||||
const CoglDepthState *state,
|
const CoglDepthState *state,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_get_depth_state:
|
* cogl_material_get_depth_state:
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "cogl-snippet-private.h"
|
#include "cogl-snippet-private.h"
|
||||||
#include "cogl-texture-private.h"
|
#include "cogl-texture-private.h"
|
||||||
#include "cogl-pipeline-layer-state-private.h"
|
#include "cogl-pipeline-layer-state-private.h"
|
||||||
|
#include "cogl-error-private.h"
|
||||||
|
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#if 0
|
#if 0
|
||||||
@ -734,7 +735,7 @@ CoglBool
|
|||||||
cogl_pipeline_set_layer_point_sprite_coords_enabled (CoglPipeline *pipeline,
|
cogl_pipeline_set_layer_point_sprite_coords_enabled (CoglPipeline *pipeline,
|
||||||
int layer_index,
|
int layer_index,
|
||||||
CoglBool enable,
|
CoglBool enable,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglPipelineLayerState change =
|
CoglPipelineLayerState change =
|
||||||
COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS;
|
COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS;
|
||||||
@ -752,9 +753,11 @@ cogl_pipeline_set_layer_point_sprite_coords_enabled (CoglPipeline *pipeline,
|
|||||||
{
|
{
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_ERROR, COGL_ERROR_UNSUPPORTED,
|
_cogl_set_error (error,
|
||||||
"Point sprite texture coordinates are enabled "
|
COGL_SYSTEM_ERROR,
|
||||||
"for a layer but the GL driver does not support it.");
|
COGL_SYSTEM_ERROR_UNSUPPORTED,
|
||||||
|
"Point sprite texture coordinates are enabled for "
|
||||||
|
"a layer but the GL driver does not support it.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1168,7 +1171,7 @@ CoglBool
|
|||||||
cogl_pipeline_set_layer_combine (CoglPipeline *pipeline,
|
cogl_pipeline_set_layer_combine (CoglPipeline *pipeline,
|
||||||
int layer_index,
|
int layer_index,
|
||||||
const char *combine_description,
|
const char *combine_description,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglPipelineLayerState state = COGL_PIPELINE_LAYER_STATE_COMBINE;
|
CoglPipelineLayerState state = COGL_PIPELINE_LAYER_STATE_COMBINE;
|
||||||
CoglPipelineLayer *authority;
|
CoglPipelineLayer *authority;
|
||||||
@ -1177,7 +1180,6 @@ cogl_pipeline_set_layer_combine (CoglPipeline *pipeline,
|
|||||||
CoglBlendStringStatement split[2];
|
CoglBlendStringStatement split[2];
|
||||||
CoglBlendStringStatement *rgb;
|
CoglBlendStringStatement *rgb;
|
||||||
CoglBlendStringStatement *a;
|
CoglBlendStringStatement *a;
|
||||||
GError *internal_error = NULL;
|
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE);
|
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE);
|
||||||
@ -1198,19 +1200,9 @@ cogl_pipeline_set_layer_combine (CoglPipeline *pipeline,
|
|||||||
_cogl_blend_string_compile (combine_description,
|
_cogl_blend_string_compile (combine_description,
|
||||||
COGL_BLEND_STRING_CONTEXT_TEXTURE_COMBINE,
|
COGL_BLEND_STRING_CONTEXT_TEXTURE_COMBINE,
|
||||||
statements,
|
statements,
|
||||||
&internal_error);
|
error);
|
||||||
if (!count)
|
if (!count)
|
||||||
{
|
|
||||||
if (error)
|
|
||||||
g_propagate_error (error, internal_error);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_warning ("Cannot compile combine description: %s\n",
|
|
||||||
internal_error->message);
|
|
||||||
g_error_free (internal_error);
|
|
||||||
}
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
if (statements[0].mask == COGL_BLEND_STRING_CHANNEL_MASK_RGBA)
|
if (statements[0].mask == COGL_BLEND_STRING_CHANNEL_MASK_RGBA)
|
||||||
{
|
{
|
||||||
|
@ -208,7 +208,7 @@ cogl_pipeline_remove_layer (CoglPipeline *pipeline,
|
|||||||
* @layer_index: Specifies the layer you want define a combine function for
|
* @layer_index: Specifies the layer you want define a combine function for
|
||||||
* @blend_string: A <link linkend="cogl-Blend-Strings">Cogl blend string</link>
|
* @blend_string: A <link linkend="cogl-Blend-Strings">Cogl blend string</link>
|
||||||
* describing the desired texture combine function.
|
* describing the desired texture combine function.
|
||||||
* @error: A #GError that may report parse errors or lack of GPU/driver
|
* @error: A #CoglError that may report parse errors or lack of GPU/driver
|
||||||
* support. May be %NULL, in which case a warning will be printed out if an
|
* support. May be %NULL, in which case a warning will be printed out if an
|
||||||
* error is encountered.
|
* error is encountered.
|
||||||
*
|
*
|
||||||
@ -299,7 +299,7 @@ CoglBool
|
|||||||
cogl_pipeline_set_layer_combine (CoglPipeline *pipeline,
|
cogl_pipeline_set_layer_combine (CoglPipeline *pipeline,
|
||||||
int layer_index,
|
int layer_index,
|
||||||
const char *blend_string,
|
const char *blend_string,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_pipeline_set_layer_combine_constant:
|
* cogl_pipeline_set_layer_combine_constant:
|
||||||
@ -416,7 +416,7 @@ cogl_pipeline_get_layer_mag_filter (CoglPipeline *pipeline,
|
|||||||
* @pipeline: A #CoglPipeline object
|
* @pipeline: A #CoglPipeline object
|
||||||
* @layer_index: the layer number to change.
|
* @layer_index: the layer number to change.
|
||||||
* @enable: whether to enable point sprite coord generation.
|
* @enable: whether to enable point sprite coord generation.
|
||||||
* @error: A return location for a GError, or NULL to ignore errors.
|
* @error: A return location for a CoglError, or NULL to ignore errors.
|
||||||
*
|
*
|
||||||
* When rendering points, if @enable is %TRUE then the texture
|
* When rendering points, if @enable is %TRUE then the texture
|
||||||
* coordinates for this layer will be replaced with coordinates that
|
* coordinates for this layer will be replaced with coordinates that
|
||||||
@ -437,7 +437,7 @@ CoglBool
|
|||||||
cogl_pipeline_set_layer_point_sprite_coords_enabled (CoglPipeline *pipeline,
|
cogl_pipeline_set_layer_point_sprite_coords_enabled (CoglPipeline *pipeline,
|
||||||
int layer_index,
|
int layer_index,
|
||||||
CoglBool enable,
|
CoglBool enable,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_pipeline_get_layer_point_sprite_coords_enabled:
|
* cogl_pipeline_get_layer_point_sprite_coords_enabled:
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "cogl-depth-state-private.h"
|
#include "cogl-depth-state-private.h"
|
||||||
#include "cogl-pipeline-state-private.h"
|
#include "cogl-pipeline-state-private.h"
|
||||||
#include "cogl-snippet-private.h"
|
#include "cogl-snippet-private.h"
|
||||||
|
#include "cogl-error-private.h"
|
||||||
|
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
|
||||||
@ -938,14 +939,13 @@ setup_blend_state (CoglBlendStringStatement *statement,
|
|||||||
CoglBool
|
CoglBool
|
||||||
cogl_pipeline_set_blend (CoglPipeline *pipeline,
|
cogl_pipeline_set_blend (CoglPipeline *pipeline,
|
||||||
const char *blend_description,
|
const char *blend_description,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglPipelineState state = COGL_PIPELINE_STATE_BLEND;
|
CoglPipelineState state = COGL_PIPELINE_STATE_BLEND;
|
||||||
CoglPipeline *authority;
|
CoglPipeline *authority;
|
||||||
CoglBlendStringStatement statements[2];
|
CoglBlendStringStatement statements[2];
|
||||||
CoglBlendStringStatement *rgb;
|
CoglBlendStringStatement *rgb;
|
||||||
CoglBlendStringStatement *a;
|
CoglBlendStringStatement *a;
|
||||||
GError *internal_error = NULL;
|
|
||||||
int count;
|
int count;
|
||||||
CoglPipelineBlendState *blend_state;
|
CoglPipelineBlendState *blend_state;
|
||||||
|
|
||||||
@ -957,19 +957,9 @@ cogl_pipeline_set_blend (CoglPipeline *pipeline,
|
|||||||
_cogl_blend_string_compile (blend_description,
|
_cogl_blend_string_compile (blend_description,
|
||||||
COGL_BLEND_STRING_CONTEXT_BLENDING,
|
COGL_BLEND_STRING_CONTEXT_BLENDING,
|
||||||
statements,
|
statements,
|
||||||
&internal_error);
|
error);
|
||||||
if (!count)
|
if (!count)
|
||||||
{
|
|
||||||
if (error)
|
|
||||||
g_propagate_error (error, internal_error);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_warning ("Cannot compile blend description: %s\n",
|
|
||||||
internal_error->message);
|
|
||||||
g_error_free (internal_error);
|
|
||||||
}
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
if (count == 1)
|
if (count == 1)
|
||||||
rgb = a = statements;
|
rgb = a = statements;
|
||||||
@ -1161,7 +1151,7 @@ cogl_pipeline_set_user_program (CoglPipeline *pipeline,
|
|||||||
CoglBool
|
CoglBool
|
||||||
cogl_pipeline_set_depth_state (CoglPipeline *pipeline,
|
cogl_pipeline_set_depth_state (CoglPipeline *pipeline,
|
||||||
const CoglDepthState *depth_state,
|
const CoglDepthState *depth_state,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglPipelineState state = COGL_PIPELINE_STATE_DEPTH;
|
CoglPipelineState state = COGL_PIPELINE_STATE_DEPTH;
|
||||||
CoglPipeline *authority;
|
CoglPipeline *authority;
|
||||||
@ -1186,9 +1176,9 @@ cogl_pipeline_set_depth_state (CoglPipeline *pipeline,
|
|||||||
(depth_state->range_near != 0 ||
|
(depth_state->range_near != 0 ||
|
||||||
depth_state->range_far != 1))
|
depth_state->range_far != 1))
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_ERROR,
|
COGL_SYSTEM_ERROR,
|
||||||
COGL_ERROR_UNSUPPORTED,
|
COGL_SYSTEM_ERROR_UNSUPPORTED,
|
||||||
"glDepthRange not available on GLES 1");
|
"glDepthRange not available on GLES 1");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -385,7 +385,7 @@ cogl_pipeline_get_alpha_test_reference (CoglPipeline *pipeline);
|
|||||||
* @pipeline: A #CoglPipeline object
|
* @pipeline: A #CoglPipeline object
|
||||||
* @blend_string: A <link linkend="cogl-Blend-Strings">Cogl blend string</link>
|
* @blend_string: A <link linkend="cogl-Blend-Strings">Cogl blend string</link>
|
||||||
* describing the desired blend function.
|
* describing the desired blend function.
|
||||||
* @error: return location for a #GError that may report lack of driver
|
* @error: return location for a #CoglError that may report lack of driver
|
||||||
* support if you give separate blend string statements for the alpha
|
* support if you give separate blend string statements for the alpha
|
||||||
* channel and RGB channels since some drivers, or backends such as
|
* channel and RGB channels since some drivers, or backends such as
|
||||||
* GLES 1.1, don't support this feature. May be %NULL, in which case a
|
* GLES 1.1, don't support this feature. May be %NULL, in which case a
|
||||||
@ -465,7 +465,7 @@ cogl_pipeline_get_alpha_test_reference (CoglPipeline *pipeline);
|
|||||||
CoglBool
|
CoglBool
|
||||||
cogl_pipeline_set_blend (CoglPipeline *pipeline,
|
cogl_pipeline_set_blend (CoglPipeline *pipeline,
|
||||||
const char *blend_string,
|
const char *blend_string,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_pipeline_set_blend_constant:
|
* cogl_pipeline_set_blend_constant:
|
||||||
@ -619,7 +619,7 @@ cogl_pipeline_set_user_program (CoglPipeline *pipeline,
|
|||||||
* cogl_pipeline_set_depth_state:
|
* cogl_pipeline_set_depth_state:
|
||||||
* @pipeline: A #CoglPipeline object
|
* @pipeline: A #CoglPipeline object
|
||||||
* @state: A #CoglDepthState struct
|
* @state: A #CoglDepthState struct
|
||||||
* @error: A #GError to report failures to setup the given @state.
|
* @error: A #CoglError to report failures to setup the given @state.
|
||||||
*
|
*
|
||||||
* This commits all the depth state configured in @state struct to the
|
* This commits all the depth state configured in @state struct to the
|
||||||
* given @pipeline. The configuration values are copied into the
|
* given @pipeline. The configuration values are copied into the
|
||||||
@ -638,7 +638,7 @@ cogl_pipeline_set_user_program (CoglPipeline *pipeline,
|
|||||||
CoglBool
|
CoglBool
|
||||||
cogl_pipeline_set_depth_state (CoglPipeline *pipeline,
|
cogl_pipeline_set_depth_state (CoglPipeline *pipeline,
|
||||||
const CoglDepthState *state,
|
const CoglDepthState *state,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_pipeline_get_depth_state
|
* cogl_pipeline_get_depth_state
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
#include "cogl-winsys-private.h"
|
#include "cogl-winsys-private.h"
|
||||||
#include "cogl-winsys-stub-private.h"
|
#include "cogl-winsys-stub-private.h"
|
||||||
#include "cogl-config-private.h"
|
#include "cogl-config-private.h"
|
||||||
|
#include "cogl-error-private.h"
|
||||||
|
|
||||||
#ifdef COGL_HAS_EGL_PLATFORM_XLIB_SUPPORT
|
#ifdef COGL_HAS_EGL_PLATFORM_XLIB_SUPPORT
|
||||||
#include "cogl-winsys-egl-x11-private.h"
|
#include "cogl-winsys-egl-x11-private.h"
|
||||||
@ -129,7 +130,7 @@ typedef struct _CoglNativeFilterClosure
|
|||||||
void *data;
|
void *data;
|
||||||
} CoglNativeFilterClosure;
|
} CoglNativeFilterClosure;
|
||||||
|
|
||||||
GQuark
|
uint32_t
|
||||||
cogl_renderer_error_quark (void)
|
cogl_renderer_error_quark (void)
|
||||||
{
|
{
|
||||||
return g_quark_from_static_string ("cogl-renderer-error-quark");
|
return g_quark_from_static_string ("cogl-renderer-error-quark");
|
||||||
@ -225,7 +226,7 @@ cogl_xlib_renderer_set_event_retrieval_enabled (CoglRenderer *renderer,
|
|||||||
CoglBool
|
CoglBool
|
||||||
cogl_renderer_check_onscreen_template (CoglRenderer *renderer,
|
cogl_renderer_check_onscreen_template (CoglRenderer *renderer,
|
||||||
CoglOnscreenTemplate *onscreen_template,
|
CoglOnscreenTemplate *onscreen_template,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglDisplay *display;
|
CoglDisplay *display;
|
||||||
|
|
||||||
@ -246,7 +247,7 @@ cogl_renderer_check_onscreen_template (CoglRenderer *renderer,
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_renderer_choose_driver (CoglRenderer *renderer,
|
_cogl_renderer_choose_driver (CoglRenderer *renderer,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
const char *driver_name = g_getenv ("COGL_DRIVER");
|
const char *driver_name = g_getenv ("COGL_DRIVER");
|
||||||
const char *libgl_name;
|
const char *libgl_name;
|
||||||
@ -307,7 +308,7 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_DRIVER_ERROR,
|
COGL_DRIVER_ERROR,
|
||||||
COGL_DRIVER_ERROR_NO_SUITABLE_DRIVER_FOUND,
|
COGL_DRIVER_ERROR_NO_SUITABLE_DRIVER_FOUND,
|
||||||
"No suitable driver found");
|
"No suitable driver found");
|
||||||
@ -318,7 +319,7 @@ found:
|
|||||||
if (support_gles2_constraint &&
|
if (support_gles2_constraint &&
|
||||||
renderer->driver != COGL_DRIVER_GLES2)
|
renderer->driver != COGL_DRIVER_GLES2)
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_RENDERER_ERROR,
|
COGL_RENDERER_ERROR,
|
||||||
COGL_RENDERER_ERROR_BAD_CONSTRAINT,
|
COGL_RENDERER_ERROR_BAD_CONSTRAINT,
|
||||||
"No suitable driver found");
|
"No suitable driver found");
|
||||||
@ -332,7 +333,7 @@ found:
|
|||||||
|
|
||||||
if (renderer->libgl_module == NULL)
|
if (renderer->libgl_module == NULL)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_DRIVER_ERROR,
|
_cogl_set_error (error, COGL_DRIVER_ERROR,
|
||||||
COGL_DRIVER_ERROR_FAILED_TO_LOAD_LIBRARY,
|
COGL_DRIVER_ERROR_FAILED_TO_LOAD_LIBRARY,
|
||||||
"Failed to dynamically open the GL library \"%s\"",
|
"Failed to dynamically open the GL library \"%s\"",
|
||||||
libgl_name);
|
libgl_name);
|
||||||
@ -368,7 +369,7 @@ found:
|
|||||||
/* Final connection API */
|
/* Final connection API */
|
||||||
|
|
||||||
CoglBool
|
CoglBool
|
||||||
cogl_renderer_connect (CoglRenderer *renderer, GError **error)
|
cogl_renderer_connect (CoglRenderer *renderer, CoglError **error)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
GString *error_message;
|
GString *error_message;
|
||||||
@ -387,7 +388,7 @@ cogl_renderer_connect (CoglRenderer *renderer, GError **error)
|
|||||||
for (i = 0; i < G_N_ELEMENTS (_cogl_winsys_vtable_getters); i++)
|
for (i = 0; i < G_N_ELEMENTS (_cogl_winsys_vtable_getters); i++)
|
||||||
{
|
{
|
||||||
const CoglWinsysVtable *winsys = _cogl_winsys_vtable_getters[i]();
|
const CoglWinsysVtable *winsys = _cogl_winsys_vtable_getters[i]();
|
||||||
GError *tmp_error = NULL;
|
CoglError *tmp_error = NULL;
|
||||||
GList *l;
|
GList *l;
|
||||||
CoglBool skip_due_to_constraints = FALSE;
|
CoglBool skip_due_to_constraints = FALSE;
|
||||||
|
|
||||||
@ -430,7 +431,7 @@ cogl_renderer_connect (CoglRenderer *renderer, GError **error)
|
|||||||
{
|
{
|
||||||
g_string_append_c (error_message, '\n');
|
g_string_append_c (error_message, '\n');
|
||||||
g_string_append (error_message, tmp_error->message);
|
g_string_append (error_message, tmp_error->message);
|
||||||
g_error_free (tmp_error);
|
cogl_error_free (tmp_error);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -444,14 +445,14 @@ cogl_renderer_connect (CoglRenderer *renderer, GError **error)
|
|||||||
{
|
{
|
||||||
if (constraints_failed)
|
if (constraints_failed)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_RENDERER_ERROR,
|
_cogl_set_error (error, COGL_RENDERER_ERROR,
|
||||||
COGL_RENDERER_ERROR_BAD_CONSTRAINT,
|
COGL_RENDERER_ERROR_BAD_CONSTRAINT,
|
||||||
"Failed to connected to any renderer due to constraints");
|
"Failed to connected to any renderer due to constraints");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer->winsys_vtable = NULL;
|
renderer->winsys_vtable = NULL;
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"Failed to connected to any renderer: %s",
|
"Failed to connected to any renderer: %s",
|
||||||
error_message->str);
|
error_message->str);
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include <cogl/cogl-types.h>
|
#include <cogl/cogl-types.h>
|
||||||
#include <cogl/cogl-onscreen-template.h>
|
#include <cogl/cogl-onscreen-template.h>
|
||||||
|
#include <cogl/cogl-error.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
@ -75,7 +76,7 @@ G_BEGIN_DECLS
|
|||||||
*/
|
*/
|
||||||
#define COGL_RENDERER_ERROR cogl_renderer_error_quark ()
|
#define COGL_RENDERER_ERROR cogl_renderer_error_quark ()
|
||||||
|
|
||||||
GQuark
|
uint32_t
|
||||||
cogl_renderer_error_quark (void);
|
cogl_renderer_error_quark (void);
|
||||||
|
|
||||||
typedef struct _CoglRenderer CoglRenderer;
|
typedef struct _CoglRenderer CoglRenderer;
|
||||||
@ -220,7 +221,7 @@ cogl_renderer_get_n_fragment_texture_units (CoglRenderer *renderer);
|
|||||||
* cogl_renderer_check_onscreen_template:
|
* cogl_renderer_check_onscreen_template:
|
||||||
* @renderer: A #CoglRenderer
|
* @renderer: A #CoglRenderer
|
||||||
* @onscreen_template: A #CoglOnscreenTemplate
|
* @onscreen_template: A #CoglOnscreenTemplate
|
||||||
* @error: A pointer to a #GError for reporting exceptions
|
* @error: A pointer to a #CoglError for reporting exceptions
|
||||||
*
|
*
|
||||||
* Tests if a given @onscreen_template can be supported with the given
|
* Tests if a given @onscreen_template can be supported with the given
|
||||||
* @renderer.
|
* @renderer.
|
||||||
@ -233,14 +234,14 @@ cogl_renderer_get_n_fragment_texture_units (CoglRenderer *renderer);
|
|||||||
CoglBool
|
CoglBool
|
||||||
cogl_renderer_check_onscreen_template (CoglRenderer *renderer,
|
cogl_renderer_check_onscreen_template (CoglRenderer *renderer,
|
||||||
CoglOnscreenTemplate *onscreen_template,
|
CoglOnscreenTemplate *onscreen_template,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
/* Final connection API */
|
/* Final connection API */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_renderer_connect:
|
* cogl_renderer_connect:
|
||||||
* @renderer: An unconnected #CoglRenderer
|
* @renderer: An unconnected #CoglRenderer
|
||||||
* @error a pointer to a #GError for reporting exceptions
|
* @error a pointer to a #CoglError for reporting exceptions
|
||||||
*
|
*
|
||||||
* Connects the configured @renderer. Renderer connection isn't a
|
* Connects the configured @renderer. Renderer connection isn't a
|
||||||
* very active process, it basically just means validating that
|
* very active process, it basically just means validating that
|
||||||
@ -253,7 +254,7 @@ cogl_renderer_check_onscreen_template (CoglRenderer *renderer,
|
|||||||
* Stability: unstable
|
* Stability: unstable
|
||||||
*/
|
*/
|
||||||
CoglBool
|
CoglBool
|
||||||
cogl_renderer_connect (CoglRenderer *renderer, GError **error);
|
cogl_renderer_connect (CoglRenderer *renderer, CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CoglRendererConstraint:
|
* CoglRendererConstraint:
|
||||||
|
@ -46,7 +46,7 @@ cogl_sdl_renderer_get_event_type (CoglRenderer *renderer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CoglContext *
|
CoglContext *
|
||||||
cogl_sdl_context_new (int type, GError **error)
|
cogl_sdl_context_new (int type, CoglError **error)
|
||||||
{
|
{
|
||||||
CoglRenderer *renderer = cogl_renderer_new ();
|
CoglRenderer *renderer = cogl_renderer_new ();
|
||||||
CoglDisplay *display;
|
CoglDisplay *display;
|
||||||
|
@ -56,7 +56,7 @@ G_BEGIN_DECLS
|
|||||||
* this:
|
* this:
|
||||||
* |[
|
* |[
|
||||||
* MyAppData data;
|
* MyAppData data;
|
||||||
* GError *error = NULL;
|
* CoglError *error = NULL;
|
||||||
*
|
*
|
||||||
* data.ctx = cogl_sdl_context_new (SDL_USEREVENT, &error);
|
* data.ctx = cogl_sdl_context_new (SDL_USEREVENT, &error);
|
||||||
* if (!data.ctx)
|
* if (!data.ctx)
|
||||||
@ -99,7 +99,7 @@ G_BEGIN_DECLS
|
|||||||
* cogl_sdl_context_new:
|
* cogl_sdl_context_new:
|
||||||
* @type: An SDL user event type between %SDL_USEREVENT and
|
* @type: An SDL user event type between %SDL_USEREVENT and
|
||||||
* %SDL_NUMEVENTS - %1
|
* %SDL_NUMEVENTS - %1
|
||||||
* @error: A GError return location.
|
* @error: A CoglError return location.
|
||||||
*
|
*
|
||||||
* This is a convenience function for creating a new #CoglContext for
|
* This is a convenience function for creating a new #CoglContext for
|
||||||
* use with SDL and specifying what SDL user event type Cogl can use
|
* use with SDL and specifying what SDL user event type Cogl can use
|
||||||
@ -132,7 +132,7 @@ G_BEGIN_DECLS
|
|||||||
* Stability: unstable
|
* Stability: unstable
|
||||||
*/
|
*/
|
||||||
CoglContext *
|
CoglContext *
|
||||||
cogl_sdl_context_new (int type, GError **error);
|
cogl_sdl_context_new (int type, CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_sdl_renderer_set_event_type:
|
* cogl_sdl_renderer_set_event_type:
|
||||||
|
@ -67,7 +67,7 @@ _cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
|
|||||||
int height,
|
int height,
|
||||||
CoglPixelFormat format,
|
CoglPixelFormat format,
|
||||||
EGLImageKHR image,
|
EGLImageKHR image,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include "cogl-journal-private.h"
|
#include "cogl-journal-private.h"
|
||||||
#include "cogl-pipeline-opengl-private.h"
|
#include "cogl-pipeline-opengl-private.h"
|
||||||
#include "cogl-primitive-texture.h"
|
#include "cogl-primitive-texture.h"
|
||||||
|
#include "cogl-error-private.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -752,7 +753,7 @@ _cogl_texture_2d_sliced_slices_create (CoglContext *ctx,
|
|||||||
|
|
||||||
for (x = 0; x < n_x_slices; ++x)
|
for (x = 0; x < n_x_slices; ++x)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
x_span = &g_array_index (tex_2ds->slice_x_spans, CoglSpan, x);
|
x_span = &g_array_index (tex_2ds->slice_x_spans, CoglSpan, x);
|
||||||
|
|
||||||
COGL_NOTE (SLICING, "CREATE SLICE (%d,%d)\tsize (%d,%d)",
|
COGL_NOTE (SLICING, "CREATE SLICE (%d,%d)\tsize (%d,%d)",
|
||||||
@ -766,7 +767,7 @@ _cogl_texture_2d_sliced_slices_create (CoglContext *ctx,
|
|||||||
if (!slice_textures[y * n_x_slices + x])
|
if (!slice_textures[y * n_x_slices + x])
|
||||||
{
|
{
|
||||||
g_array_set_size (tex_2ds->slice_textures, y * n_x_slices + x);
|
g_array_set_size (tex_2ds->slice_textures, y * n_x_slices + x);
|
||||||
g_error_free (error);
|
cogl_error_free (error);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -843,7 +844,7 @@ cogl_texture_2d_sliced_new_with_size (CoglContext *ctx,
|
|||||||
unsigned int height,
|
unsigned int height,
|
||||||
int max_waste,
|
int max_waste,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglTexture2DSliced *tex_2ds;
|
CoglTexture2DSliced *tex_2ds;
|
||||||
|
|
||||||
@ -862,9 +863,9 @@ cogl_texture_2d_sliced_new_with_size (CoglContext *ctx,
|
|||||||
internal_format))
|
internal_format))
|
||||||
{
|
{
|
||||||
_cogl_texture_2d_sliced_free (tex_2ds);
|
_cogl_texture_2d_sliced_free (tex_2ds);
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_ERROR,
|
COGL_SYSTEM_ERROR,
|
||||||
COGL_ERROR_NO_MEMORY,
|
COGL_SYSTEM_ERROR_NO_MEMORY,
|
||||||
"Not enough memory to allocate texture slices");
|
"Not enough memory to allocate texture slices");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ typedef struct _CoglTexture2DSliced CoglTexture2DSliced;
|
|||||||
* are allowed in the non-power-of-two textures before
|
* are allowed in the non-power-of-two textures before
|
||||||
* they must be sliced to reduce the amount of waste.
|
* they must be sliced to reduce the amount of waste.
|
||||||
* @internal_format: The format of the texture
|
* @internal_format: The format of the texture
|
||||||
* @error: A #GError for exceptions.
|
* @error: A #CoglError for exceptions.
|
||||||
*
|
*
|
||||||
* Creates a #CoglTexture2DSliced that may internally be comprised of
|
* Creates a #CoglTexture2DSliced that may internally be comprised of
|
||||||
* 1 or more #CoglTexture2D textures with power-of-two sizes.
|
* 1 or more #CoglTexture2D textures with power-of-two sizes.
|
||||||
@ -97,7 +97,7 @@ cogl_texture_2d_sliced_new_with_size (CoglContext *ctx,
|
|||||||
unsigned int height,
|
unsigned int height,
|
||||||
int max_waste,
|
int max_waste,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_is_texture_2d_sliced:
|
* cogl_is_texture_2d_sliced:
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "cogl-journal-private.h"
|
#include "cogl-journal-private.h"
|
||||||
#include "cogl-pipeline-opengl-private.h"
|
#include "cogl-pipeline-opengl-private.h"
|
||||||
#include "cogl-framebuffer-private.h"
|
#include "cogl-framebuffer-private.h"
|
||||||
|
#include "cogl-error-private.h"
|
||||||
#ifdef COGL_HAS_EGL_SUPPORT
|
#ifdef COGL_HAS_EGL_SUPPORT
|
||||||
#include "cogl-winsys-egl-private.h"
|
#include "cogl-winsys-egl-private.h"
|
||||||
#endif
|
#endif
|
||||||
@ -183,7 +184,7 @@ cogl_texture_2d_new_with_size (CoglContext *ctx,
|
|||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglTexture2D *tex_2d;
|
CoglTexture2D *tex_2d;
|
||||||
GLenum gl_intformat;
|
GLenum gl_intformat;
|
||||||
@ -196,7 +197,7 @@ cogl_texture_2d_new_with_size (CoglContext *ctx,
|
|||||||
|
|
||||||
if (!_cogl_texture_2d_can_create (ctx, width, height, internal_format))
|
if (!_cogl_texture_2d_can_create (ctx, width, height, internal_format))
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_TEXTURE_ERROR,
|
_cogl_set_error (error, COGL_TEXTURE_ERROR,
|
||||||
COGL_TEXTURE_ERROR_SIZE,
|
COGL_TEXTURE_ERROR_SIZE,
|
||||||
"Failed to create texture 2d due to size/format"
|
"Failed to create texture 2d due to size/format"
|
||||||
" constraints");
|
" constraints");
|
||||||
@ -226,7 +227,7 @@ cogl_texture_2d_new_with_size (CoglContext *ctx,
|
|||||||
CoglTexture2D *
|
CoglTexture2D *
|
||||||
cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp,
|
cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglTexture2D *tex_2d;
|
CoglTexture2D *tex_2d;
|
||||||
CoglBitmap *dst_bmp;
|
CoglBitmap *dst_bmp;
|
||||||
@ -249,7 +250,7 @@ cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp,
|
|||||||
cogl_bitmap_get_height (bmp),
|
cogl_bitmap_get_height (bmp),
|
||||||
internal_format))
|
internal_format))
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_TEXTURE_ERROR,
|
_cogl_set_error (error, COGL_TEXTURE_ERROR,
|
||||||
COGL_TEXTURE_ERROR_SIZE,
|
COGL_TEXTURE_ERROR_SIZE,
|
||||||
"Failed to create texture 2d due to size/format"
|
"Failed to create texture 2d due to size/format"
|
||||||
" constraints");
|
" constraints");
|
||||||
@ -264,7 +265,7 @@ cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp,
|
|||||||
&gl_format,
|
&gl_format,
|
||||||
&gl_type)) == NULL)
|
&gl_type)) == NULL)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_TEXTURE_ERROR,
|
_cogl_set_error (error, COGL_TEXTURE_ERROR,
|
||||||
COGL_TEXTURE_ERROR_FORMAT,
|
COGL_TEXTURE_ERROR_FORMAT,
|
||||||
"Failed to prepare texture upload due to format");
|
"Failed to prepare texture upload due to format");
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -315,7 +316,7 @@ cogl_texture_2d_new_from_data (CoglContext *ctx,
|
|||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
int rowstride,
|
int rowstride,
|
||||||
const uint8_t *data,
|
const uint8_t *data,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglBitmap *bmp;
|
CoglBitmap *bmp;
|
||||||
CoglTexture2D *tex_2d;
|
CoglTexture2D *tex_2d;
|
||||||
@ -349,7 +350,7 @@ cogl_texture_2d_new_from_foreign (CoglContext *ctx,
|
|||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
CoglPixelFormat format,
|
CoglPixelFormat format,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
/* NOTE: width, height and internal format are not queriable
|
/* NOTE: width, height and internal format are not queriable
|
||||||
* in GLES, hence such a function prototype.
|
* in GLES, hence such a function prototype.
|
||||||
@ -365,9 +366,9 @@ cogl_texture_2d_new_from_foreign (CoglContext *ctx,
|
|||||||
|
|
||||||
if (!ctx->texture_driver->allows_foreign_gl_target (ctx, GL_TEXTURE_2D))
|
if (!ctx->texture_driver->allows_foreign_gl_target (ctx, GL_TEXTURE_2D))
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_ERROR,
|
COGL_SYSTEM_ERROR,
|
||||||
COGL_ERROR_UNSUPPORTED,
|
COGL_SYSTEM_ERROR_UNSUPPORTED,
|
||||||
"Foreign GL_TEXTURE_2D textures are not "
|
"Foreign GL_TEXTURE_2D textures are not "
|
||||||
"supported by your system");
|
"supported by your system");
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -381,9 +382,9 @@ cogl_texture_2d_new_from_foreign (CoglContext *ctx,
|
|||||||
_cogl_bind_gl_texture_transient (GL_TEXTURE_2D, gl_handle, TRUE);
|
_cogl_bind_gl_texture_transient (GL_TEXTURE_2D, gl_handle, TRUE);
|
||||||
if (ctx->glGetError () != GL_NO_ERROR)
|
if (ctx->glGetError () != GL_NO_ERROR)
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_ERROR,
|
COGL_SYSTEM_ERROR,
|
||||||
COGL_ERROR_UNSUPPORTED,
|
COGL_SYSTEM_ERROR_UNSUPPORTED,
|
||||||
"Failed to bind foreign GL_TEXTURE_2D texture");
|
"Failed to bind foreign GL_TEXTURE_2D texture");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -414,9 +415,9 @@ cogl_texture_2d_new_from_foreign (CoglContext *ctx,
|
|||||||
gl_int_format,
|
gl_int_format,
|
||||||
&format))
|
&format))
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_ERROR,
|
COGL_SYSTEM_ERROR,
|
||||||
COGL_ERROR_UNSUPPORTED,
|
COGL_SYSTEM_ERROR_UNSUPPORTED,
|
||||||
"Unsupported internal format for foreign texture");
|
"Unsupported internal format for foreign texture");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -446,9 +447,9 @@ cogl_texture_2d_new_from_foreign (CoglContext *ctx,
|
|||||||
/* Compressed texture images not supported */
|
/* Compressed texture images not supported */
|
||||||
if (gl_compressed == GL_TRUE)
|
if (gl_compressed == GL_TRUE)
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_ERROR,
|
COGL_SYSTEM_ERROR,
|
||||||
COGL_ERROR_UNSUPPORTED,
|
COGL_SYSTEM_ERROR_UNSUPPORTED,
|
||||||
"Compressed foreign textures aren't currently supported");
|
"Compressed foreign textures aren't currently supported");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -496,7 +497,7 @@ _cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
|
|||||||
int height,
|
int height,
|
||||||
CoglPixelFormat format,
|
CoglPixelFormat format,
|
||||||
EGLImageKHR image,
|
EGLImageKHR image,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglTexture2D *tex_2d;
|
CoglTexture2D *tex_2d;
|
||||||
GLenum gl_error;
|
GLenum gl_error;
|
||||||
@ -523,10 +524,11 @@ _cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
|
|||||||
ctx->glEGLImageTargetTexture2D (GL_TEXTURE_2D, image);
|
ctx->glEGLImageTargetTexture2D (GL_TEXTURE_2D, image);
|
||||||
if (ctx->glGetError () != GL_NO_ERROR)
|
if (ctx->glGetError () != GL_NO_ERROR)
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_TEXTURE_ERROR,
|
COGL_TEXTURE_ERROR,
|
||||||
COGL_TEXTURE_ERROR_BAD_PARAMETER,
|
COGL_TEXTURE_ERROR_BAD_PARAMETER,
|
||||||
"Could not create a CoglTexture2D from a given EGLImage");
|
"Could not create a CoglTexture2D from a given "
|
||||||
|
"EGLImage");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,7 +540,7 @@ _cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
|
|||||||
CoglTexture2D *
|
CoglTexture2D *
|
||||||
cogl_wayland_texture_2d_new_from_buffer (CoglContext *ctx,
|
cogl_wayland_texture_2d_new_from_buffer (CoglContext *ctx,
|
||||||
struct wl_buffer *buffer,
|
struct wl_buffer *buffer,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
if (wl_buffer_is_shm (buffer))
|
if (wl_buffer_is_shm (buffer))
|
||||||
{
|
{
|
||||||
|
@ -75,7 +75,7 @@ cogl_is_texture_2d (void *object);
|
|||||||
* @width: Width of the texture to allocate
|
* @width: Width of the texture to allocate
|
||||||
* @height: Height of the texture to allocate
|
* @height: Height of the texture to allocate
|
||||||
* @internal_format: The format of the texture
|
* @internal_format: The format of the texture
|
||||||
* @error: A #GError for exceptions
|
* @error: A #CoglError for exceptions
|
||||||
*
|
*
|
||||||
* Allocates a low-level #CoglTexture2D texture that your GPU can
|
* Allocates a low-level #CoglTexture2D texture that your GPU can
|
||||||
* texture from directly. This is unlike sliced textures for example
|
* texture from directly. This is unlike sliced textures for example
|
||||||
@ -100,7 +100,7 @@ cogl_texture_2d_new_with_size (CoglContext *ctx,
|
|||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_texture_2d_new_from_data:
|
* cogl_texture_2d_new_from_data:
|
||||||
@ -120,7 +120,7 @@ cogl_texture_2d_new_with_size (CoglContext *ctx,
|
|||||||
* scanlines in @data. A value of 0 will make Cogl automatically
|
* scanlines in @data. A value of 0 will make Cogl automatically
|
||||||
* calculate @rowstride from @width and @format.
|
* calculate @rowstride from @width and @format.
|
||||||
* @data: pointer the memory region where the source buffer resides
|
* @data: pointer the memory region where the source buffer resides
|
||||||
* @error: A #GError for exceptions
|
* @error: A #CoglError for exceptions
|
||||||
*
|
*
|
||||||
* Creates a new #CoglTexture2D texture based on data residing in memory.
|
* Creates a new #CoglTexture2D texture based on data residing in memory.
|
||||||
* These are unlike sliced textures for example which may be comprised
|
* These are unlike sliced textures for example which may be comprised
|
||||||
@ -147,7 +147,7 @@ cogl_texture_2d_new_from_data (CoglContext *ctx,
|
|||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
int rowstride,
|
int rowstride,
|
||||||
const uint8_t *data,
|
const uint8_t *data,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_texture_2d_new_from_bitmap:
|
* cogl_texture_2d_new_from_bitmap:
|
||||||
@ -160,7 +160,7 @@ cogl_texture_2d_new_from_data (CoglContext *ctx,
|
|||||||
* is if you have non-premultiplied source data and are going to adjust
|
* is if you have non-premultiplied source data and are going to adjust
|
||||||
* the blend mode (see cogl_pipeline_set_blend()) or use the data for
|
* the blend mode (see cogl_pipeline_set_blend()) or use the data for
|
||||||
* something other than straight blending.
|
* something other than straight blending.
|
||||||
* @error: A #GError for exceptions
|
* @error: A #CoglError for exceptions
|
||||||
*
|
*
|
||||||
* Creates a new #CoglTexture2D texture based on data residing in a
|
* Creates a new #CoglTexture2D texture based on data residing in a
|
||||||
* bitmap. These are unlike sliced textures for example which may be
|
* bitmap. These are unlike sliced textures for example which may be
|
||||||
@ -184,7 +184,7 @@ cogl_texture_2d_new_from_data (CoglContext *ctx,
|
|||||||
CoglTexture2D *
|
CoglTexture2D *
|
||||||
cogl_texture_2d_new_from_bitmap (CoglBitmap *bitmap,
|
cogl_texture_2d_new_from_bitmap (CoglBitmap *bitmap,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -194,7 +194,7 @@ cogl_texture_2d_new_from_bitmap (CoglBitmap *bitmap,
|
|||||||
* @width: Width of the foreign GL texture
|
* @width: Width of the foreign GL texture
|
||||||
* @height: Height of the foreign GL texture
|
* @height: Height of the foreign GL texture
|
||||||
* @internal_format: The format of the texture
|
* @internal_format: The format of the texture
|
||||||
* @error: A #GError for exceptions
|
* @error: A #CoglError for exceptions
|
||||||
*
|
*
|
||||||
* Wraps an existing GL_TEXTURE_2D texture object as a #CoglTexture2D.
|
* Wraps an existing GL_TEXTURE_2D texture object as a #CoglTexture2D.
|
||||||
* This can be used for integrating Cogl with software using OpenGL
|
* This can be used for integrating Cogl with software using OpenGL
|
||||||
@ -217,7 +217,7 @@ cogl_texture_2d_new_from_foreign (CoglContext *ctx,
|
|||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
CoglPixelFormat format,
|
CoglPixelFormat format,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "cogl-journal-private.h"
|
#include "cogl-journal-private.h"
|
||||||
#include "cogl-pipeline-private.h"
|
#include "cogl-pipeline-private.h"
|
||||||
#include "cogl-pipeline-opengl-private.h"
|
#include "cogl-pipeline-opengl-private.h"
|
||||||
|
#include "cogl-error-private.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@ -145,7 +146,7 @@ _cogl_texture_3d_can_create (CoglContext *ctx,
|
|||||||
int height,
|
int height,
|
||||||
int depth,
|
int depth,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
GLenum gl_intformat;
|
GLenum gl_intformat;
|
||||||
GLenum gl_type;
|
GLenum gl_type;
|
||||||
@ -153,9 +154,9 @@ _cogl_texture_3d_can_create (CoglContext *ctx,
|
|||||||
/* This should only happen on GLES */
|
/* This should only happen on GLES */
|
||||||
if (!cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_3D))
|
if (!cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_3D))
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_ERROR,
|
COGL_SYSTEM_ERROR,
|
||||||
COGL_ERROR_UNSUPPORTED,
|
COGL_SYSTEM_ERROR_UNSUPPORTED,
|
||||||
"3D textures are not supported by the GPU");
|
"3D textures are not supported by the GPU");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -167,9 +168,9 @@ _cogl_texture_3d_can_create (CoglContext *ctx,
|
|||||||
!_cogl_util_is_pot (height) ||
|
!_cogl_util_is_pot (height) ||
|
||||||
!_cogl_util_is_pot (depth)))
|
!_cogl_util_is_pot (depth)))
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_ERROR,
|
COGL_SYSTEM_ERROR,
|
||||||
COGL_ERROR_UNSUPPORTED,
|
COGL_SYSTEM_ERROR_UNSUPPORTED,
|
||||||
"A non-power-of-two size was requested but this is not "
|
"A non-power-of-two size was requested but this is not "
|
||||||
"supported by the GPU");
|
"supported by the GPU");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -190,9 +191,9 @@ _cogl_texture_3d_can_create (CoglContext *ctx,
|
|||||||
height,
|
height,
|
||||||
depth))
|
depth))
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_ERROR,
|
COGL_SYSTEM_ERROR,
|
||||||
COGL_ERROR_UNSUPPORTED,
|
COGL_SYSTEM_ERROR_UNSUPPORTED,
|
||||||
"The requested dimensions are not supported by the GPU");
|
"The requested dimensions are not supported by the GPU");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -206,7 +207,7 @@ cogl_texture_3d_new_with_size (CoglContext *ctx,
|
|||||||
int height,
|
int height,
|
||||||
int depth,
|
int depth,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglTexture3D *tex_3d;
|
CoglTexture3D *tex_3d;
|
||||||
GLenum gl_intformat;
|
GLenum gl_intformat;
|
||||||
@ -248,7 +249,7 @@ cogl_texture_3d_new_from_bitmap (CoglBitmap *bmp,
|
|||||||
unsigned int height,
|
unsigned int height,
|
||||||
unsigned int depth,
|
unsigned int depth,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglTexture3D *tex_3d;
|
CoglTexture3D *tex_3d;
|
||||||
CoglBitmap *dst_bmp;
|
CoglBitmap *dst_bmp;
|
||||||
@ -283,7 +284,7 @@ cogl_texture_3d_new_from_bitmap (CoglBitmap *bmp,
|
|||||||
|
|
||||||
if (dst_bmp == NULL)
|
if (dst_bmp == NULL)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_BITMAP_ERROR, COGL_BITMAP_ERROR_FAILED,
|
_cogl_set_error (error, COGL_BITMAP_ERROR, COGL_BITMAP_ERROR_FAILED,
|
||||||
"Bitmap conversion failed");
|
"Bitmap conversion failed");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -337,13 +338,13 @@ cogl_texture_3d_new_from_data (CoglContext *context,
|
|||||||
int rowstride,
|
int rowstride,
|
||||||
int image_stride,
|
int image_stride,
|
||||||
const uint8_t *data,
|
const uint8_t *data,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglBitmap *bitmap;
|
CoglBitmap *bitmap;
|
||||||
CoglTexture3D *ret;
|
CoglTexture3D *ret;
|
||||||
|
|
||||||
/* These are considered a programmer errors so we won't set a
|
/* These are considered a programmer errors so we won't set a
|
||||||
GError. It would be nice if this was a _COGL_RETURN_IF_FAIL but the
|
CoglError. It would be nice if this was a _COGL_RETURN_IF_FAIL but the
|
||||||
rest of Cogl isn't using that */
|
rest of Cogl isn't using that */
|
||||||
if (format == COGL_PIXEL_FORMAT_ANY)
|
if (format == COGL_PIXEL_FORMAT_ANY)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -57,12 +57,12 @@ typedef struct _CoglTexture3D CoglTexture3D;
|
|||||||
* @depth: depth of the texture in pixels.
|
* @depth: depth of the texture in pixels.
|
||||||
* @internal_format: the #CoglPixelFormat to use for the GPU
|
* @internal_format: the #CoglPixelFormat to use for the GPU
|
||||||
* storage of the texture.
|
* storage of the texture.
|
||||||
* @error: A GError return location.
|
* @error: A CoglError return location.
|
||||||
*
|
*
|
||||||
* Creates a new Cogl 3D texture with the specified dimensions and
|
* Creates a new Cogl 3D texture with the specified dimensions and
|
||||||
* pixel format.
|
* pixel format.
|
||||||
*
|
*
|
||||||
* Note that this function will throw a #GError if
|
* Note that this function will throw a #CoglError if
|
||||||
* %COGL_FEATURE_TEXTURE_3D is not advertised. It can also fail if the
|
* %COGL_FEATURE_TEXTURE_3D is not advertised. It can also fail if the
|
||||||
* requested dimensions are not supported by the GPU.
|
* requested dimensions are not supported by the GPU.
|
||||||
*
|
*
|
||||||
@ -78,7 +78,7 @@ cogl_texture_3d_new_with_size (CoglContext *context,
|
|||||||
int height,
|
int height,
|
||||||
int depth,
|
int depth,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_texture_3d_new_from_data:
|
* cogl_texture_3d_new_from_data:
|
||||||
@ -103,13 +103,13 @@ cogl_texture_3d_new_with_size (CoglContext *context,
|
|||||||
* rows. Alternatively 0 can be passed to infer the @image_stride
|
* rows. Alternatively 0 can be passed to infer the @image_stride
|
||||||
* from the @height.
|
* from the @height.
|
||||||
* @data: pointer the memory region where the source buffer resides
|
* @data: pointer the memory region where the source buffer resides
|
||||||
* @error: A GError return location.
|
* @error: A CoglError return location.
|
||||||
*
|
*
|
||||||
* Creates a new 3D texture and initializes it with @data. The data is
|
* Creates a new 3D texture and initializes it with @data. The data is
|
||||||
* assumed to be packed array of @depth images. There can be padding
|
* assumed to be packed array of @depth images. There can be padding
|
||||||
* between the images using @image_stride.
|
* between the images using @image_stride.
|
||||||
*
|
*
|
||||||
* Note that this function will throw a #GError if
|
* Note that this function will throw a #CoglError if
|
||||||
* %COGL_FEATURE_TEXTURE_3D is not advertised. It can also fail if the
|
* %COGL_FEATURE_TEXTURE_3D is not advertised. It can also fail if the
|
||||||
* requested dimensions are not supported by the GPU.
|
* requested dimensions are not supported by the GPU.
|
||||||
*
|
*
|
||||||
@ -129,7 +129,7 @@ cogl_texture_3d_new_from_data (CoglContext *context,
|
|||||||
int rowstride,
|
int rowstride,
|
||||||
int image_stride,
|
int image_stride,
|
||||||
const uint8_t *data,
|
const uint8_t *data,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_texture_3d_new_from_bitmap:
|
* cogl_texture_3d_new_from_bitmap:
|
||||||
@ -144,7 +144,7 @@ cogl_texture_3d_new_from_data (CoglContext *context,
|
|||||||
* is if you have non-premultiplied source data and are going to adjust
|
* is if you have non-premultiplied source data and are going to adjust
|
||||||
* the blend mode (see cogl_pipeline_set_blend()) or use the data for
|
* the blend mode (see cogl_pipeline_set_blend()) or use the data for
|
||||||
* something other than straight blending.
|
* something other than straight blending.
|
||||||
* @error: A GError return location.
|
* @error: A CoglError return location.
|
||||||
*
|
*
|
||||||
* Creates a new 3D texture and initializes it with the images in
|
* Creates a new 3D texture and initializes it with the images in
|
||||||
* @bitmap. The images are assumed to be packed together after one
|
* @bitmap. The images are assumed to be packed together after one
|
||||||
@ -163,7 +163,7 @@ cogl_texture_3d_new_from_bitmap (CoglBitmap *bitmap,
|
|||||||
unsigned int height,
|
unsigned int height,
|
||||||
unsigned int depth,
|
unsigned int depth,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_is_texture_3d:
|
* cogl_is_texture_3d:
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "cogl-object-private.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-journal-private.h"
|
#include "cogl-journal-private.h"
|
||||||
#include "cogl-pipeline-opengl-private.h"
|
#include "cogl-pipeline-opengl-private.h"
|
||||||
|
#include "cogl-error-private.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@ -112,7 +113,7 @@ _cogl_texture_rectangle_can_create (CoglContext *ctx,
|
|||||||
unsigned int width,
|
unsigned int width,
|
||||||
unsigned int height,
|
unsigned int height,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
GLenum gl_intformat;
|
GLenum gl_intformat;
|
||||||
GLenum gl_format;
|
GLenum gl_format;
|
||||||
@ -120,7 +121,7 @@ _cogl_texture_rectangle_can_create (CoglContext *ctx,
|
|||||||
|
|
||||||
if (!cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_RECTANGLE))
|
if (!cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_RECTANGLE))
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_TEXTURE_ERROR,
|
COGL_TEXTURE_ERROR,
|
||||||
COGL_TEXTURE_ERROR_TYPE,
|
COGL_TEXTURE_ERROR_TYPE,
|
||||||
"The CoglTextureRectangle feature isn't available");
|
"The CoglTextureRectangle feature isn't available");
|
||||||
@ -142,7 +143,7 @@ _cogl_texture_rectangle_can_create (CoglContext *ctx,
|
|||||||
width,
|
width,
|
||||||
height))
|
height))
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_TEXTURE_ERROR,
|
COGL_TEXTURE_ERROR,
|
||||||
COGL_TEXTURE_ERROR_SIZE,
|
COGL_TEXTURE_ERROR_SIZE,
|
||||||
"The requested texture size + format is unsupported");
|
"The requested texture size + format is unsupported");
|
||||||
@ -192,7 +193,7 @@ cogl_texture_rectangle_new_with_size (CoglContext *ctx,
|
|||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglTextureRectangle *tex_rect;
|
CoglTextureRectangle *tex_rect;
|
||||||
GLenum gl_intformat;
|
GLenum gl_intformat;
|
||||||
@ -234,7 +235,7 @@ cogl_texture_rectangle_new_with_size (CoglContext *ctx,
|
|||||||
CoglTextureRectangle *
|
CoglTextureRectangle *
|
||||||
cogl_texture_rectangle_new_from_bitmap (CoglBitmap *bmp,
|
cogl_texture_rectangle_new_from_bitmap (CoglBitmap *bmp,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglTextureRectangle *tex_rect;
|
CoglTextureRectangle *tex_rect;
|
||||||
CoglBitmap *dst_bmp;
|
CoglBitmap *dst_bmp;
|
||||||
@ -299,7 +300,7 @@ cogl_texture_rectangle_new_from_foreign (CoglContext *ctx,
|
|||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
CoglPixelFormat format,
|
CoglPixelFormat format,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
/* NOTE: width, height and internal format are not queriable
|
/* NOTE: width, height and internal format are not queriable
|
||||||
* in GLES, hence such a function prototype.
|
* in GLES, hence such a function prototype.
|
||||||
@ -316,9 +317,9 @@ cogl_texture_rectangle_new_from_foreign (CoglContext *ctx,
|
|||||||
if (!ctx->texture_driver->allows_foreign_gl_target (ctx,
|
if (!ctx->texture_driver->allows_foreign_gl_target (ctx,
|
||||||
GL_TEXTURE_RECTANGLE_ARB))
|
GL_TEXTURE_RECTANGLE_ARB))
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_ERROR,
|
COGL_SYSTEM_ERROR,
|
||||||
COGL_ERROR_UNSUPPORTED,
|
COGL_SYSTEM_ERROR_UNSUPPORTED,
|
||||||
"Foreign GL_TEXTURE_RECTANGLE textures are not "
|
"Foreign GL_TEXTURE_RECTANGLE textures are not "
|
||||||
"supported by your system");
|
"supported by your system");
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -331,9 +332,9 @@ cogl_texture_rectangle_new_from_foreign (CoglContext *ctx,
|
|||||||
_cogl_bind_gl_texture_transient (GL_TEXTURE_RECTANGLE_ARB, gl_handle, TRUE);
|
_cogl_bind_gl_texture_transient (GL_TEXTURE_RECTANGLE_ARB, gl_handle, TRUE);
|
||||||
if (ctx->glGetError () != GL_NO_ERROR)
|
if (ctx->glGetError () != GL_NO_ERROR)
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_ERROR,
|
COGL_SYSTEM_ERROR,
|
||||||
COGL_ERROR_UNSUPPORTED,
|
COGL_SYSTEM_ERROR_UNSUPPORTED,
|
||||||
"Failed to bind foreign GL_TEXTURE_RECTANGLE texture");
|
"Failed to bind foreign GL_TEXTURE_RECTANGLE texture");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -361,9 +362,9 @@ cogl_texture_rectangle_new_from_foreign (CoglContext *ctx,
|
|||||||
gl_int_format,
|
gl_int_format,
|
||||||
&format))
|
&format))
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_ERROR,
|
COGL_SYSTEM_ERROR,
|
||||||
COGL_ERROR_UNSUPPORTED,
|
COGL_SYSTEM_ERROR_UNSUPPORTED,
|
||||||
"Unsupported internal format for foreign texture");
|
"Unsupported internal format for foreign texture");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -393,9 +394,9 @@ cogl_texture_rectangle_new_from_foreign (CoglContext *ctx,
|
|||||||
/* Compressed texture images not supported */
|
/* Compressed texture images not supported */
|
||||||
if (gl_compressed == GL_TRUE)
|
if (gl_compressed == GL_TRUE)
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_ERROR,
|
COGL_SYSTEM_ERROR,
|
||||||
COGL_ERROR_UNSUPPORTED,
|
COGL_SYSTEM_ERROR_UNSUPPORTED,
|
||||||
"Compressed foreign textures aren't currently supported");
|
"Compressed foreign textures aren't currently supported");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ cogl_is_texture_rectangle (void *object);
|
|||||||
* @width: The texture width to allocate
|
* @width: The texture width to allocate
|
||||||
* @height: The texture height to allocate
|
* @height: The texture height to allocate
|
||||||
* @internal_format: The desired internal texture format
|
* @internal_format: The desired internal texture format
|
||||||
* @error: An optional GError pointer for reporting exceptions
|
* @error: An optional CoglError pointer for reporting exceptions
|
||||||
*
|
*
|
||||||
* Allocates a new #CoglTextureRectangle texture with a given @width, @height
|
* Allocates a new #CoglTextureRectangle texture with a given @width, @height
|
||||||
* and @internal_format. This texture is a low-level texture that
|
* and @internal_format. This texture is a low-level texture that
|
||||||
@ -114,14 +114,14 @@ cogl_texture_rectangle_new_with_size (CoglContext *ctx,
|
|||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_texture_rectangle_new_from_bitmap:
|
* cogl_texture_rectangle_new_from_bitmap:
|
||||||
* @bitmap: A #CoglBitmap
|
* @bitmap: A #CoglBitmap
|
||||||
* @internal_format: the #CoglPixelFormat to use for the GPU storage of the
|
* @internal_format: the #CoglPixelFormat to use for the GPU storage of the
|
||||||
* texture
|
* texture
|
||||||
* @error: A return location for a GError or %NULL
|
* @error: A return location for a CoglError or %NULL
|
||||||
*
|
*
|
||||||
* Allocates a new #CoglTextureRectangle texture which will be
|
* Allocates a new #CoglTextureRectangle texture which will be
|
||||||
* initialized with the pixel data from @bitmap. Internally the data
|
* initialized with the pixel data from @bitmap. Internally the data
|
||||||
@ -152,7 +152,7 @@ cogl_texture_rectangle_new_with_size (CoglContext *ctx,
|
|||||||
CoglTextureRectangle *
|
CoglTextureRectangle *
|
||||||
cogl_texture_rectangle_new_from_bitmap (CoglBitmap *bitmap,
|
cogl_texture_rectangle_new_from_bitmap (CoglBitmap *bitmap,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_texture_rectangle_new_from_foreign:
|
* cogl_texture_rectangle_new_from_foreign:
|
||||||
@ -161,7 +161,7 @@ cogl_texture_rectangle_new_from_bitmap (CoglBitmap *bitmap,
|
|||||||
* @width: Width of the foreign GL texture
|
* @width: Width of the foreign GL texture
|
||||||
* @height: Height of the foreign GL texture
|
* @height: Height of the foreign GL texture
|
||||||
* @internal_format: The format of the texture
|
* @internal_format: The format of the texture
|
||||||
* @error: A #GError for exceptions
|
* @error: A #CoglError for exceptions
|
||||||
*
|
*
|
||||||
* Wraps an existing GL_TEXTURE_RECTANGLE texture object as a
|
* Wraps an existing GL_TEXTURE_RECTANGLE texture object as a
|
||||||
* #CoglTextureRectangle. This can be used for integrating Cogl with
|
* #CoglTextureRectangle. This can be used for integrating Cogl with
|
||||||
@ -197,7 +197,7 @@ cogl_texture_rectangle_new_from_foreign (CoglContext *ctx,
|
|||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
CoglPixelFormat format,
|
CoglPixelFormat format,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
GQuark
|
uint32_t
|
||||||
cogl_texture_error_quark (void)
|
cogl_texture_error_quark (void)
|
||||||
{
|
{
|
||||||
return g_quark_from_static_string ("cogl-texture-error-quark");
|
return g_quark_from_static_string ("cogl-texture-error-quark");
|
||||||
@ -446,7 +446,7 @@ CoglTexture *
|
|||||||
cogl_texture_new_from_file (const char *filename,
|
cogl_texture_new_from_file (const char *filename,
|
||||||
CoglTextureFlags flags,
|
CoglTextureFlags flags,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglBitmap *bmp;
|
CoglBitmap *bmp;
|
||||||
CoglTexture *texture = NULL;
|
CoglTexture *texture = NULL;
|
||||||
|
@ -58,7 +58,7 @@ G_BEGIN_DECLS
|
|||||||
/**
|
/**
|
||||||
* COGL_TEXTURE_ERROR:
|
* COGL_TEXTURE_ERROR:
|
||||||
*
|
*
|
||||||
* #GError domain for texture errors.
|
* #CoglError domain for texture errors.
|
||||||
*
|
*
|
||||||
* Since: 2.0
|
* Since: 2.0
|
||||||
* Stability: Unstable
|
* Stability: Unstable
|
||||||
@ -100,7 +100,7 @@ typedef enum {
|
|||||||
COGL_TEXTURE_TYPE_RECTANGLE
|
COGL_TEXTURE_TYPE_RECTANGLE
|
||||||
} CoglTextureType;
|
} CoglTextureType;
|
||||||
|
|
||||||
GQuark cogl_texture_error_quark (void);
|
uint32_t cogl_texture_error_quark (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_texture_new_with_size:
|
* cogl_texture_new_with_size:
|
||||||
@ -134,7 +134,7 @@ cogl_texture_new_with_size (unsigned int width,
|
|||||||
* have non-premultiplied source data and are going to adjust the blend
|
* have non-premultiplied source data and are going to adjust the blend
|
||||||
* mode (see cogl_material_set_blend()) or use the data for something
|
* mode (see cogl_material_set_blend()) or use the data for something
|
||||||
* other than straight blending.
|
* other than straight blending.
|
||||||
* @error: return location for a #GError or %NULL
|
* @error: return location for a #CoglError or %NULL
|
||||||
*
|
*
|
||||||
* Creates a #CoglTexture from an image file.
|
* Creates a #CoglTexture from an image file.
|
||||||
*
|
*
|
||||||
@ -146,7 +146,7 @@ CoglTexture *
|
|||||||
cogl_texture_new_from_file (const char *filename,
|
cogl_texture_new_from_file (const char *filename,
|
||||||
CoglTextureFlags flags,
|
CoglTextureFlags flags,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_texture_new_from_data:
|
* cogl_texture_new_from_data:
|
||||||
|
@ -566,7 +566,7 @@ typedef enum {
|
|||||||
/**
|
/**
|
||||||
* COGL_BLEND_STRING_ERROR:
|
* COGL_BLEND_STRING_ERROR:
|
||||||
*
|
*
|
||||||
* #GError domain for blend string parser errors
|
* #CoglError domain for blend string parser errors
|
||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
@ -591,28 +591,28 @@ typedef enum { /*< prefix=COGL_BLEND_STRING_ERROR >*/
|
|||||||
COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR
|
COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR
|
||||||
} CoglBlendStringError;
|
} CoglBlendStringError;
|
||||||
|
|
||||||
GQuark
|
uint32_t
|
||||||
cogl_blend_string_error_quark (void);
|
cogl_blend_string_error_quark (void);
|
||||||
|
|
||||||
#define COGL_ERROR (_cogl_error_quark ())
|
#define COGL_SYSTEM_ERROR (_cogl_system_error_quark ())
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CoglError:
|
* CoglSystemError:
|
||||||
* @COGL_ERROR_UNSUPPORTED: You tried to use a feature or
|
* @COGL_SYSTEM_ERROR_UNSUPPORTED: You tried to use a feature or
|
||||||
* configuration not currently available.
|
* configuration not currently available.
|
||||||
* @COGL_ERROR_NO_MEMORY: You tried to allocate a resource
|
* @COGL_SYSTEM_ERROR_NO_MEMORY: You tried to allocate a resource
|
||||||
* such as a texture and there wasn't enough memory.
|
* such as a texture and there wasn't enough memory.
|
||||||
*
|
*
|
||||||
* Error enumeration for Cogl
|
* Error enumeration for Cogl
|
||||||
*
|
*
|
||||||
* The @COGL_ERROR_UNSUPPORTED error can be thrown for a variety of
|
* The @COGL_SYSTEM_ERROR_UNSUPPORTED error can be thrown for a
|
||||||
* reasons. For example:
|
* variety of reasons. For example:
|
||||||
*
|
*
|
||||||
* <itemizedlist>
|
* <itemizedlist>
|
||||||
* <listitem><para>You've tried to use a feature that is not
|
* <listitem><para>You've tried to use a feature that is not
|
||||||
* advertised by cogl_get_features(). This could happen if you create
|
* advertised by cogl_has_feature(). This could happen if you create
|
||||||
* a 2d texture with a non-power-of-two size when
|
* a 2d texture with a non-power-of-two size when
|
||||||
* %COGL_FEATURE_TEXTURE_NPOT is not advertised.</para></listitem>
|
* %COGL_FEATURE_ID_TEXTURE_NPOT is not advertised.</para></listitem>
|
||||||
* <listitem><para>The GPU can not handle the configuration you have
|
* <listitem><para>The GPU can not handle the configuration you have
|
||||||
* requested. An example might be if you try to use too many texture
|
* requested. An example might be if you try to use too many texture
|
||||||
* layers in a single #CoglPipeline</para></listitem>
|
* layers in a single #CoglPipeline</para></listitem>
|
||||||
@ -627,12 +627,12 @@ cogl_blend_string_error_quark (void);
|
|||||||
* Stability: unstable
|
* Stability: unstable
|
||||||
*/
|
*/
|
||||||
typedef enum { /*< prefix=COGL_ERROR >*/
|
typedef enum { /*< prefix=COGL_ERROR >*/
|
||||||
COGL_ERROR_UNSUPPORTED,
|
COGL_SYSTEM_ERROR_UNSUPPORTED,
|
||||||
COGL_ERROR_NO_MEMORY
|
COGL_SYSTEM_ERROR_NO_MEMORY
|
||||||
} CoglError;
|
} CoglSystemError;
|
||||||
|
|
||||||
GQuark
|
uint32_t
|
||||||
_cogl_error_quark (void);
|
_cogl_system_error_quark (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CoglAttributeType:
|
* CoglAttributeType:
|
||||||
|
@ -54,7 +54,7 @@ cogl_wayland_display_set_compositor_display (CoglDisplay *display,
|
|||||||
* cogl_wayland_texture_2d_new_from_buffer:
|
* cogl_wayland_texture_2d_new_from_buffer:
|
||||||
* @ctx: A #CoglContext
|
* @ctx: A #CoglContext
|
||||||
* @buffer: A Wayland buffer
|
* @buffer: A Wayland buffer
|
||||||
* @error: A #GError for exceptions
|
* @error: A #CoglError for exceptions
|
||||||
*
|
*
|
||||||
* Uploads the given Wayland @buffer to a #CoglTexture2D.
|
* Uploads the given Wayland @buffer to a #CoglTexture2D.
|
||||||
*
|
*
|
||||||
@ -77,7 +77,7 @@ cogl_wayland_display_set_compositor_display (CoglDisplay *display,
|
|||||||
CoglTexture2D *
|
CoglTexture2D *
|
||||||
cogl_wayland_texture_2d_new_from_buffer (CoglContext *ctx,
|
cogl_wayland_texture_2d_new_from_buffer (CoglContext *ctx,
|
||||||
struct wl_buffer *buffer,
|
struct wl_buffer *buffer,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ typedef struct _CoglXlibRenderer
|
|||||||
} CoglXlibRenderer;
|
} CoglXlibRenderer;
|
||||||
|
|
||||||
CoglBool
|
CoglBool
|
||||||
_cogl_xlib_renderer_connect (CoglRenderer *renderer, GError **error);
|
_cogl_xlib_renderer_connect (CoglRenderer *renderer, CoglError **error);
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_xlib_renderer_disconnect (CoglRenderer *renderer);
|
_cogl_xlib_renderer_disconnect (CoglRenderer *renderer);
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "cogl-xlib-renderer-private.h"
|
#include "cogl-xlib-renderer-private.h"
|
||||||
#include "cogl-x11-renderer-private.h"
|
#include "cogl-x11-renderer-private.h"
|
||||||
#include "cogl-winsys-private.h"
|
#include "cogl-winsys-private.h"
|
||||||
|
#include "cogl-error-private.h"
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/extensions/Xdamage.h>
|
#include <X11/extensions/Xdamage.h>
|
||||||
@ -164,7 +165,7 @@ _cogl_xlib_renderer_untrap_errors (CoglRenderer *renderer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Display *
|
static Display *
|
||||||
assert_xlib_display (CoglRenderer *renderer, GError **error)
|
assert_xlib_display (CoglRenderer *renderer, CoglError **error)
|
||||||
{
|
{
|
||||||
Display *xdpy = cogl_xlib_renderer_get_foreign_display (renderer);
|
Display *xdpy = cogl_xlib_renderer_get_foreign_display (renderer);
|
||||||
CoglXlibRenderer *xlib_renderer = _cogl_xlib_renderer_get_data (renderer);
|
CoglXlibRenderer *xlib_renderer = _cogl_xlib_renderer_get_data (renderer);
|
||||||
@ -179,7 +180,7 @@ assert_xlib_display (CoglRenderer *renderer, GError **error)
|
|||||||
xdpy = XOpenDisplay (_cogl_x11_display_name);
|
xdpy = XOpenDisplay (_cogl_x11_display_name);
|
||||||
if (xdpy == NULL)
|
if (xdpy == NULL)
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_RENDERER_ERROR,
|
COGL_RENDERER_ERROR,
|
||||||
COGL_RENDERER_ERROR_XLIB_DISPLAY_OPEN,
|
COGL_RENDERER_ERROR_XLIB_DISPLAY_OPEN,
|
||||||
"Failed to open X Display %s", _cogl_x11_display_name);
|
"Failed to open X Display %s", _cogl_x11_display_name);
|
||||||
@ -191,7 +192,7 @@ assert_xlib_display (CoglRenderer *renderer, GError **error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CoglBool
|
CoglBool
|
||||||
_cogl_xlib_renderer_connect (CoglRenderer *renderer, GError **error)
|
_cogl_xlib_renderer_connect (CoglRenderer *renderer, CoglError **error)
|
||||||
{
|
{
|
||||||
CoglXlibRenderer *xlib_renderer =
|
CoglXlibRenderer *xlib_renderer =
|
||||||
_cogl_xlib_renderer_get_data (renderer);
|
_cogl_xlib_renderer_get_data (renderer);
|
||||||
|
@ -559,7 +559,7 @@ cogl_set_projection_matrix (CoglMatrix *matrix)
|
|||||||
cogl_framebuffer_set_projection_matrix (cogl_get_draw_framebuffer (), matrix);
|
cogl_framebuffer_set_projection_matrix (cogl_get_draw_framebuffer (), matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
GQuark
|
uint32_t
|
||||||
_cogl_driver_error_quark (void)
|
_cogl_driver_error_quark (void)
|
||||||
{
|
{
|
||||||
return g_quark_from_static_string ("cogl-driver-error-quark");
|
return g_quark_from_static_string ("cogl-driver-error-quark");
|
||||||
@ -784,10 +784,10 @@ _cogl_transform_point (const CoglMatrix *matrix_mv,
|
|||||||
#undef VIEWPORT_TRANSFORM_X
|
#undef VIEWPORT_TRANSFORM_X
|
||||||
#undef VIEWPORT_TRANSFORM_Y
|
#undef VIEWPORT_TRANSFORM_Y
|
||||||
|
|
||||||
GQuark
|
uint32_t
|
||||||
_cogl_error_quark (void)
|
_cogl_system_error_quark (void)
|
||||||
{
|
{
|
||||||
return g_quark_from_static_string ("cogl-error-quark");
|
return g_quark_from_static_string ("cogl-system-error-quark");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cogl/cogl-defines.h>
|
#include <cogl/cogl-defines.h>
|
||||||
|
#include <cogl/cogl-error.h>
|
||||||
|
|
||||||
#include <cogl/cogl-object.h>
|
#include <cogl/cogl-object.h>
|
||||||
#include <cogl/cogl1-context.h>
|
#include <cogl/cogl1-context.h>
|
||||||
|
@ -37,7 +37,7 @@ cogl_attribute_type_get_type
|
|||||||
cogl_begin_gl
|
cogl_begin_gl
|
||||||
|
|
||||||
cogl_bitmap_error_get_type
|
cogl_bitmap_error_get_type
|
||||||
cogl_bitmap_error_quark
|
cogl_bitmap_error_domain
|
||||||
cogl_bitmap_get_buffer
|
cogl_bitmap_get_buffer
|
||||||
cogl_bitmap_get_format
|
cogl_bitmap_get_format
|
||||||
cogl_bitmap_get_height
|
cogl_bitmap_get_height
|
||||||
@ -49,7 +49,7 @@ cogl_bitmap_new_from_file
|
|||||||
cogl_bitmap_new_from_buffer
|
cogl_bitmap_new_from_buffer
|
||||||
cogl_bitmap_new_with_size
|
cogl_bitmap_new_with_size
|
||||||
cogl_blend_string_error_get_type
|
cogl_blend_string_error_get_type
|
||||||
cogl_blend_string_error_quark
|
cogl_blend_string_error_domain
|
||||||
|
|
||||||
cogl_buffer_bit_get_type
|
cogl_buffer_bit_get_type
|
||||||
cogl_buffer_get_size
|
cogl_buffer_get_size
|
||||||
@ -216,7 +216,7 @@ cogl_framebuffer_draw_rectangle
|
|||||||
cogl_framebuffer_draw_rectangles
|
cogl_framebuffer_draw_rectangles
|
||||||
cogl_framebuffer_draw_textured_rectangle
|
cogl_framebuffer_draw_textured_rectangle
|
||||||
cogl_framebuffer_draw_textured_rectangles
|
cogl_framebuffer_draw_textured_rectangles
|
||||||
cogl_framebuffer_error_quark
|
cogl_framebuffer_error_domain
|
||||||
cogl_framebuffer_fill_path
|
cogl_framebuffer_fill_path
|
||||||
cogl_framebuffer_finish
|
cogl_framebuffer_finish
|
||||||
cogl_framebuffer_frustum
|
cogl_framebuffer_frustum
|
||||||
@ -695,7 +695,7 @@ cogl_renderer_connect
|
|||||||
cogl_renderer_get_driver
|
cogl_renderer_get_driver
|
||||||
cogl_renderer_get_n_fragment_texture_units
|
cogl_renderer_get_n_fragment_texture_units
|
||||||
cogl_renderer_error_get_type
|
cogl_renderer_error_get_type
|
||||||
cogl_renderer_error_quark
|
cogl_renderer_error_domain
|
||||||
cogl_renderer_get_winsys_id
|
cogl_renderer_get_winsys_id
|
||||||
cogl_renderer_new
|
cogl_renderer_new
|
||||||
cogl_renderer_remove_constraint
|
cogl_renderer_remove_constraint
|
||||||
@ -766,7 +766,7 @@ cogl_swap_chain_new
|
|||||||
cogl_swap_chain_set_has_alpha
|
cogl_swap_chain_set_has_alpha
|
||||||
cogl_swap_chain_set_length
|
cogl_swap_chain_set_length
|
||||||
|
|
||||||
cogl_texture_error_quark
|
cogl_texture_error_domain
|
||||||
cogl_texture_flags_get_type
|
cogl_texture_flags_get_type
|
||||||
cogl_texture_get_data
|
cogl_texture_get_data
|
||||||
cogl_texture_get_format
|
cogl_texture_get_format
|
||||||
@ -783,7 +783,7 @@ cogl_texture_new_from_foreign
|
|||||||
cogl_texture_new_from_sub_texture
|
cogl_texture_new_from_sub_texture
|
||||||
cogl_texture_new_with_size
|
cogl_texture_new_with_size
|
||||||
#ifdef COGL_HAS_X11
|
#ifdef COGL_HAS_X11
|
||||||
cogl_texture_pixmap_x11_error_quark
|
cogl_texture_pixmap_x11_error_domain
|
||||||
cogl_texture_pixmap_x11_is_using_tfp_extension
|
cogl_texture_pixmap_x11_is_using_tfp_extension
|
||||||
cogl_texture_pixmap_x11_new
|
cogl_texture_pixmap_x11_new
|
||||||
cogl_texture_pixmap_x11_set_damage_object
|
cogl_texture_pixmap_x11_set_damage_object
|
||||||
@ -908,7 +908,7 @@ _cogl_atlas_texture_new_from_bitmap
|
|||||||
_cogl_atlas_texture_new_with_size
|
_cogl_atlas_texture_new_with_size
|
||||||
_cogl_atlas_texture_remove_reorganize_callback
|
_cogl_atlas_texture_remove_reorganize_callback
|
||||||
_cogl_context_get_default
|
_cogl_context_get_default
|
||||||
_cogl_error_quark
|
_cogl_system_error_domain
|
||||||
_cogl_texture_associate_framebuffer
|
_cogl_texture_associate_framebuffer
|
||||||
_cogl_texture_can_hardware_repeat
|
_cogl_texture_can_hardware_repeat
|
||||||
_cogl_texture_determine_internal_format
|
_cogl_texture_determine_internal_format
|
||||||
|
@ -57,7 +57,7 @@ cogl_texture_3d_error_quark (void);
|
|||||||
|
|
||||||
CoglBool
|
CoglBool
|
||||||
cogl_index_buffer_allocate (CoglIndexBuffer *indices,
|
cogl_index_buffer_allocate (CoglIndexBuffer *indices,
|
||||||
GError *error);
|
CoglError *error);
|
||||||
|
|
||||||
CoglBool
|
CoglBool
|
||||||
cogl_is_journal (void *object);
|
cogl_is_journal (void *object);
|
||||||
@ -97,7 +97,7 @@ cogl_texture_3d_error_quark (void)
|
|||||||
|
|
||||||
CoglBool
|
CoglBool
|
||||||
cogl_index_buffer_allocate (CoglIndexBuffer *indices,
|
cogl_index_buffer_allocate (CoglIndexBuffer *indices,
|
||||||
GError *error)
|
CoglError *error)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
CoglBool
|
CoglBool
|
||||||
_cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
|
_cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_offscreen_gl_free (CoglOffscreen *offscreen);
|
_cogl_offscreen_gl_free (CoglOffscreen *offscreen);
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-framebuffer-private.h"
|
#include "cogl-framebuffer-private.h"
|
||||||
#include "cogl-framebuffer-gl-private.h"
|
#include "cogl-framebuffer-gl-private.h"
|
||||||
|
#include "cogl-error-private.h"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
@ -692,7 +693,7 @@ _cogl_framebuffer_try_creating_gl_fbo (CoglContext *ctx,
|
|||||||
|
|
||||||
CoglBool
|
CoglBool
|
||||||
_cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
|
_cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *fb = COGL_FRAMEBUFFER (offscreen);
|
CoglFramebuffer *fb = COGL_FRAMEBUFFER (offscreen);
|
||||||
CoglContext *ctx = fb->context;
|
CoglContext *ctx = fb->context;
|
||||||
@ -711,7 +712,7 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
|
|||||||
_cogl_texture_associate_framebuffer (offscreen->depth_texture, fb);
|
_cogl_texture_associate_framebuffer (offscreen->depth_texture, fb);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_FRAMEBUFFER_ERROR,
|
_cogl_set_error (error, COGL_FRAMEBUFFER_ERROR,
|
||||||
COGL_FRAMEBUFFER_ERROR_ALLOCATE,
|
COGL_FRAMEBUFFER_ERROR_ALLOCATE,
|
||||||
"Failed to allocate depth texture for framebuffer");
|
"Failed to allocate depth texture for framebuffer");
|
||||||
}
|
}
|
||||||
@ -824,7 +825,7 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_FRAMEBUFFER_ERROR,
|
_cogl_set_error (error, COGL_FRAMEBUFFER_ERROR,
|
||||||
COGL_FRAMEBUFFER_ERROR_ALLOCATE,
|
COGL_FRAMEBUFFER_ERROR_ALLOCATE,
|
||||||
"Failed to create an OpenGL framebuffer object");
|
"Failed to create an OpenGL framebuffer object");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "cogl-feature-private.h"
|
#include "cogl-feature-private.h"
|
||||||
#include "cogl-renderer-private.h"
|
#include "cogl-renderer-private.h"
|
||||||
#include "cogl-framebuffer-gl-private.h"
|
#include "cogl-framebuffer-gl-private.h"
|
||||||
|
#include "cogl-error-private.h"
|
||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_driver_pixel_format_from_gl_internal (CoglContext *context,
|
_cogl_driver_pixel_format_from_gl_internal (CoglContext *context,
|
||||||
@ -276,14 +277,14 @@ _cogl_get_gl_version (CoglContext *ctx,
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
check_gl_version (CoglContext *ctx,
|
check_gl_version (CoglContext *ctx,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
int major, minor;
|
int major, minor;
|
||||||
const char *gl_extensions;
|
const char *gl_extensions;
|
||||||
|
|
||||||
if (!_cogl_get_gl_version (ctx, &major, &minor))
|
if (!_cogl_get_gl_version (ctx, &major, &minor))
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_DRIVER_ERROR,
|
COGL_DRIVER_ERROR,
|
||||||
COGL_DRIVER_ERROR_UNKNOWN_VERSION,
|
COGL_DRIVER_ERROR_UNKNOWN_VERSION,
|
||||||
"The OpenGL version could not be determined");
|
"The OpenGL version could not be determined");
|
||||||
@ -300,7 +301,7 @@ check_gl_version (CoglContext *ctx,
|
|||||||
extension */
|
extension */
|
||||||
if (!_cogl_check_extension ("GL_ARB_multitexture", gl_extensions))
|
if (!_cogl_check_extension ("GL_ARB_multitexture", gl_extensions))
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_DRIVER_ERROR,
|
COGL_DRIVER_ERROR,
|
||||||
COGL_DRIVER_ERROR_INVALID_VERSION,
|
COGL_DRIVER_ERROR_INVALID_VERSION,
|
||||||
"The OpenGL driver is missing "
|
"The OpenGL driver is missing "
|
||||||
@ -311,7 +312,7 @@ check_gl_version (CoglContext *ctx,
|
|||||||
/* OpenGL 1.2 is required */
|
/* OpenGL 1.2 is required */
|
||||||
if (!COGL_CHECK_GL_VERSION (major, minor, 1, 2))
|
if (!COGL_CHECK_GL_VERSION (major, minor, 1, 2))
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_DRIVER_ERROR,
|
COGL_DRIVER_ERROR,
|
||||||
COGL_DRIVER_ERROR_INVALID_VERSION,
|
COGL_DRIVER_ERROR_INVALID_VERSION,
|
||||||
"The OpenGL version of your driver (%i.%i) "
|
"The OpenGL version of your driver (%i.%i) "
|
||||||
@ -325,7 +326,7 @@ check_gl_version (CoglContext *ctx,
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_driver_update_features (CoglContext *ctx,
|
_cogl_driver_update_features (CoglContext *ctx,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglPrivateFeatureFlags private_flags = 0;
|
CoglPrivateFeatureFlags private_flags = 0;
|
||||||
CoglFeatureFlags flags = 0;
|
CoglFeatureFlags flags = 0;
|
||||||
|
@ -184,7 +184,7 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_driver_update_features (CoglContext *context,
|
_cogl_driver_update_features (CoglContext *context,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglPrivateFeatureFlags private_flags = 0;
|
CoglPrivateFeatureFlags private_flags = 0;
|
||||||
CoglFeatureFlags flags = 0;
|
CoglFeatureFlags flags = 0;
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
#include "cogl-winsys-private.h"
|
#include "cogl-winsys-private.h"
|
||||||
#include "cogl-pipeline-opengl-private.h"
|
#include "cogl-pipeline-opengl-private.h"
|
||||||
#include "cogl-xlib.h"
|
#include "cogl-xlib.h"
|
||||||
|
#include "cogl-error-private.h"
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
@ -64,7 +65,7 @@ COGL_TEXTURE_DEFINE (TexturePixmapX11, texture_pixmap_x11);
|
|||||||
|
|
||||||
static const CoglTextureVtable cogl_texture_pixmap_x11_vtable;
|
static const CoglTextureVtable cogl_texture_pixmap_x11_vtable;
|
||||||
|
|
||||||
GQuark
|
uint32_t
|
||||||
cogl_texture_pixmap_x11_error_quark (void)
|
cogl_texture_pixmap_x11_error_quark (void)
|
||||||
{
|
{
|
||||||
return g_quark_from_static_string ("cogl-texture-pixmap-error-quark");
|
return g_quark_from_static_string ("cogl-texture-pixmap-error-quark");
|
||||||
@ -273,7 +274,7 @@ CoglTexturePixmapX11 *
|
|||||||
cogl_texture_pixmap_x11_new (CoglContext *ctxt,
|
cogl_texture_pixmap_x11_new (CoglContext *ctxt,
|
||||||
uint32_t pixmap,
|
uint32_t pixmap,
|
||||||
CoglBool automatic_updates,
|
CoglBool automatic_updates,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglTexturePixmapX11 *tex_pixmap = g_new (CoglTexturePixmapX11, 1);
|
CoglTexturePixmapX11 *tex_pixmap = g_new (CoglTexturePixmapX11, 1);
|
||||||
Display *display = cogl_xlib_get_display ();
|
Display *display = cogl_xlib_get_display ();
|
||||||
@ -300,7 +301,7 @@ cogl_texture_pixmap_x11_new (CoglContext *ctxt,
|
|||||||
&pixmap_border_width, &tex_pixmap->depth))
|
&pixmap_border_width, &tex_pixmap->depth))
|
||||||
{
|
{
|
||||||
g_free (tex_pixmap);
|
g_free (tex_pixmap);
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_TEXTURE_PIXMAP_X11_ERROR,
|
COGL_TEXTURE_PIXMAP_X11_ERROR,
|
||||||
COGL_TEXTURE_PIXMAP_X11_ERROR_X11,
|
COGL_TEXTURE_PIXMAP_X11_ERROR_X11,
|
||||||
"Unable to query pixmap size");
|
"Unable to query pixmap size");
|
||||||
@ -312,7 +313,7 @@ cogl_texture_pixmap_x11_new (CoglContext *ctxt,
|
|||||||
if (!XGetWindowAttributes (display, pixmap_root_window, &window_attributes))
|
if (!XGetWindowAttributes (display, pixmap_root_window, &window_attributes))
|
||||||
{
|
{
|
||||||
g_free (tex_pixmap);
|
g_free (tex_pixmap);
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_TEXTURE_PIXMAP_X11_ERROR,
|
COGL_TEXTURE_PIXMAP_X11_ERROR,
|
||||||
COGL_TEXTURE_PIXMAP_X11_ERROR_X11,
|
COGL_TEXTURE_PIXMAP_X11_ERROR_X11,
|
||||||
"Unable to query root window attributes");
|
"Unable to query root window attributes");
|
||||||
|
@ -59,7 +59,7 @@ typedef enum
|
|||||||
/**
|
/**
|
||||||
* COGL_TEXTURE_PIXMAP_X11_ERROR:
|
* COGL_TEXTURE_PIXMAP_X11_ERROR:
|
||||||
*
|
*
|
||||||
* #GError domain for texture-pixmap-x11 errors.
|
* #CoglError domain for texture-pixmap-x11 errors.
|
||||||
*
|
*
|
||||||
* Since: 1.10
|
* Since: 1.10
|
||||||
*/
|
*/
|
||||||
@ -78,7 +78,7 @@ typedef enum {
|
|||||||
COGL_TEXTURE_PIXMAP_X11_ERROR_X11,
|
COGL_TEXTURE_PIXMAP_X11_ERROR_X11,
|
||||||
} CoglTexturePixmapX11Error;
|
} CoglTexturePixmapX11Error;
|
||||||
|
|
||||||
GQuark cogl_texture_pixmap_x11_error_quark (void);
|
uint32_t cogl_texture_pixmap_x11_error_quark (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_texture_pixmap_x11_new:
|
* cogl_texture_pixmap_x11_new:
|
||||||
@ -86,7 +86,7 @@ GQuark cogl_texture_pixmap_x11_error_quark (void);
|
|||||||
* @pixmap: A X11 pixmap ID
|
* @pixmap: A X11 pixmap ID
|
||||||
* @automatic_updates: Whether to automatically copy the contents of
|
* @automatic_updates: Whether to automatically copy the contents of
|
||||||
* the pixmap to the texture.
|
* the pixmap to the texture.
|
||||||
* @error: A #GError for exceptions
|
* @error: A #CoglError for exceptions
|
||||||
*
|
*
|
||||||
* Creates a texture that contains the contents of @pixmap. If
|
* Creates a texture that contains the contents of @pixmap. If
|
||||||
* @automatic_updates is %TRUE then Cogl will attempt to listen for
|
* @automatic_updates is %TRUE then Cogl will attempt to listen for
|
||||||
@ -102,7 +102,7 @@ CoglTexturePixmapX11 *
|
|||||||
cogl_texture_pixmap_x11_new (CoglContext *context,
|
cogl_texture_pixmap_x11_new (CoglContext *context,
|
||||||
uint32_t pixmap,
|
uint32_t pixmap,
|
||||||
CoglBool automatic_updates,
|
CoglBool automatic_updates,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_texture_pixmap_x11_update_area:
|
* cogl_texture_pixmap_x11_update_area:
|
||||||
|
@ -69,7 +69,7 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglRendererEGL *egl_renderer;
|
CoglRendererEGL *egl_renderer;
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ error:
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_egl_context_created (CoglDisplay *display,
|
_cogl_winsys_egl_context_created (CoglDisplay *display,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglRenderer *renderer = display->renderer;
|
CoglRenderer *renderer = display->renderer;
|
||||||
CoglRendererEGL *egl_renderer = renderer->winsys;
|
CoglRendererEGL *egl_renderer = renderer->winsys;
|
||||||
@ -154,7 +154,7 @@ _cogl_winsys_egl_context_created (CoglDisplay *display,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||||
"%s", error_message);
|
"%s", error_message);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -162,7 +162,7 @@ _cogl_winsys_egl_context_created (CoglDisplay *display,
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_egl_display_setup (CoglDisplay *display,
|
_cogl_winsys_egl_display_setup (CoglDisplay *display,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglDisplayEGL *egl_display = display->winsys;
|
CoglDisplayEGL *egl_display = display->winsys;
|
||||||
CoglDisplayAndroid *android_display;
|
CoglDisplayAndroid *android_display;
|
||||||
@ -184,7 +184,7 @@ _cogl_winsys_egl_display_destroy (CoglDisplay *display)
|
|||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
|
_cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
|
||||||
EGLConfig egl_config,
|
EGLConfig egl_config,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||||
CoglContext *context = framebuffer->context;
|
CoglContext *context = framebuffer->context;
|
||||||
@ -195,7 +195,7 @@ _cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
|
|||||||
|
|
||||||
if (android_display->have_onscreen)
|
if (android_display->have_onscreen)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
||||||
"EGL platform only supports a single onscreen window");
|
"EGL platform only supports a single onscreen window");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -67,7 +67,7 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglRendererEGL *egl_renderer;
|
CoglRendererEGL *egl_renderer;
|
||||||
CoglRendererGDL *gdl_renderer;
|
CoglRendererGDL *gdl_renderer;
|
||||||
@ -91,7 +91,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
|||||||
rc = gdl_init (NULL);
|
rc = gdl_init (NULL);
|
||||||
if (rc != GDL_SUCCESS)
|
if (rc != GDL_SUCCESS)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"GDL initialize failed. %s",
|
"GDL initialize failed. %s",
|
||||||
gdl_get_error_string (rc));
|
gdl_get_error_string (rc));
|
||||||
@ -101,7 +101,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
|||||||
rc = gdl_get_display_info (GDL_DISPLAY_ID_0, &gdl_display_info);
|
rc = gdl_get_display_info (GDL_DISPLAY_ID_0, &gdl_display_info);
|
||||||
if (rc != GDL_SUCCESS)
|
if (rc != GDL_SUCCESS)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"GDL failed to get display information: %s",
|
"GDL failed to get display information: %s",
|
||||||
gdl_get_error_string (rc));
|
gdl_get_error_string (rc));
|
||||||
@ -120,7 +120,7 @@ error:
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_egl_context_created (CoglDisplay *display,
|
_cogl_winsys_egl_context_created (CoglDisplay *display,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglRenderer *renderer = display->renderer;
|
CoglRenderer *renderer = display->renderer;
|
||||||
CoglRendererEGL *egl_renderer = renderer->winsys;
|
CoglRendererEGL *egl_renderer = renderer->winsys;
|
||||||
@ -162,14 +162,14 @@ _cogl_winsys_egl_context_created (CoglDisplay *display,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||||
"%s", error_message);
|
"%s", error_message);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
gdl_plane_init (CoglDisplay *display, GError **error)
|
gdl_plane_init (CoglDisplay *display, CoglError **error)
|
||||||
{
|
{
|
||||||
CoglBool ret = TRUE;
|
CoglBool ret = TRUE;
|
||||||
gdl_color_space_t colorSpace = GDL_COLOR_SPACE_RGB;
|
gdl_color_space_t colorSpace = GDL_COLOR_SPACE_RGB;
|
||||||
@ -180,7 +180,7 @@ gdl_plane_init (CoglDisplay *display, GError **error)
|
|||||||
|
|
||||||
if (!display->gdl_plane)
|
if (!display->gdl_plane)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
_cogl_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||||
"No GDL plane specified with "
|
"No GDL plane specified with "
|
||||||
"cogl_gdl_display_set_plane");
|
"cogl_gdl_display_set_plane");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -189,7 +189,7 @@ gdl_plane_init (CoglDisplay *display, GError **error)
|
|||||||
rc = gdl_init (NULL);
|
rc = gdl_init (NULL);
|
||||||
if (rc != GDL_SUCCESS)
|
if (rc != GDL_SUCCESS)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
_cogl_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||||
"GDL initialize failed. %s", gdl_get_error_string (rc));
|
"GDL initialize failed. %s", gdl_get_error_string (rc));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -197,7 +197,7 @@ gdl_plane_init (CoglDisplay *display, GError **error)
|
|||||||
rc = gdl_get_display_info (GDL_DISPLAY_ID_0, &display_info);
|
rc = gdl_get_display_info (GDL_DISPLAY_ID_0, &display_info);
|
||||||
if (rc != GDL_SUCCESS)
|
if (rc != GDL_SUCCESS)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
_cogl_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||||
"GDL failed to get display infomation: %s",
|
"GDL failed to get display infomation: %s",
|
||||||
gdl_get_error_string (rc));
|
gdl_get_error_string (rc));
|
||||||
gdl_close ();
|
gdl_close ();
|
||||||
@ -243,7 +243,7 @@ gdl_plane_init (CoglDisplay *display, GError **error)
|
|||||||
|
|
||||||
if (rc != GDL_SUCCESS)
|
if (rc != GDL_SUCCESS)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
_cogl_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||||
"GDL configuration failed: %s.", gdl_get_error_string (rc));
|
"GDL configuration failed: %s.", gdl_get_error_string (rc));
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
}
|
}
|
||||||
@ -255,7 +255,7 @@ gdl_plane_init (CoglDisplay *display, GError **error)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_egl_display_setup (CoglDisplay *display,
|
_cogl_winsys_egl_display_setup (CoglDisplay *display,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglDisplayEGL *egl_display = display->winsys;
|
CoglDisplayEGL *egl_display = display->winsys;
|
||||||
CoglDisplayGDL *gdl_display;
|
CoglDisplayGDL *gdl_display;
|
||||||
@ -294,7 +294,7 @@ _cogl_winsys_egl_cleanup_context (CoglDisplay *display)
|
|||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
|
_cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
|
||||||
EGLConfig egl_config,
|
EGLConfig egl_config,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||||
CoglContext *context = framebuffer->context;
|
CoglContext *context = framebuffer->context;
|
||||||
@ -305,7 +305,7 @@ _cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
|
|||||||
|
|
||||||
if (gdl_display->have_onscreen)
|
if (gdl_display->have_onscreen)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
||||||
"EGL platform only supports a single onscreen window");
|
"EGL platform only supports a single onscreen window");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
#include "cogl-kms-renderer.h"
|
#include "cogl-kms-renderer.h"
|
||||||
#include "cogl-kms-display.h"
|
#include "cogl-kms-display.h"
|
||||||
#include "cogl-version.h"
|
#include "cogl-version.h"
|
||||||
|
#include "cogl-error-private.h"
|
||||||
|
|
||||||
static const CoglWinsysEGLVtable _cogl_winsys_egl_vtable;
|
static const CoglWinsysEGLVtable _cogl_winsys_egl_vtable;
|
||||||
|
|
||||||
@ -115,7 +116,7 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglRendererEGL *egl_renderer;
|
CoglRendererEGL *egl_renderer;
|
||||||
CoglRendererKMS *kms_renderer;
|
CoglRendererKMS *kms_renderer;
|
||||||
@ -131,7 +132,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
|||||||
if (kms_renderer->fd < 0)
|
if (kms_renderer->fd < 0)
|
||||||
{
|
{
|
||||||
/* Probably permissions error */
|
/* Probably permissions error */
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"Couldn't open %s", device_name);
|
"Couldn't open %s", device_name);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -140,7 +141,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
|||||||
kms_renderer->gbm = gbm_create_device (kms_renderer->fd);
|
kms_renderer->gbm = gbm_create_device (kms_renderer->fd);
|
||||||
if (kms_renderer->gbm == NULL)
|
if (kms_renderer->gbm == NULL)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"Couldn't create gbm device");
|
"Couldn't create gbm device");
|
||||||
goto close_fd;
|
goto close_fd;
|
||||||
@ -149,7 +150,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
|||||||
egl_renderer->edpy = eglGetDisplay ((EGLNativeDisplayType)kms_renderer->gbm);
|
egl_renderer->edpy = eglGetDisplay ((EGLNativeDisplayType)kms_renderer->gbm);
|
||||||
if (egl_renderer->edpy == EGL_NO_DISPLAY)
|
if (egl_renderer->edpy == EGL_NO_DISPLAY)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"Couldn't get eglDisplay");
|
"Couldn't get eglDisplay");
|
||||||
goto destroy_gbm_device;
|
goto destroy_gbm_device;
|
||||||
@ -264,7 +265,7 @@ find_output (int _index,
|
|||||||
drmModeRes *resources,
|
drmModeRes *resources,
|
||||||
int *excluded_connectors,
|
int *excluded_connectors,
|
||||||
int n_excluded_connectors,
|
int n_excluded_connectors,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
char *connector_env_name = g_strdup_printf ("COGL_KMS_CONNECTOR%d", _index);
|
char *connector_env_name = g_strdup_printf ("COGL_KMS_CONNECTOR%d", _index);
|
||||||
char *mode_env_name;
|
char *mode_env_name;
|
||||||
@ -288,7 +289,7 @@ find_output (int _index,
|
|||||||
excluded_connectors, n_excluded_connectors);
|
excluded_connectors, n_excluded_connectors);
|
||||||
if (connector == NULL)
|
if (connector == NULL)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"No currently active connector found");
|
"No currently active connector found");
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -340,7 +341,7 @@ find_output (int _index,
|
|||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
g_free (mode_env_name);
|
g_free (mode_env_name);
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"COGL_KMS_CONNECTOR%d_MODE of %s could not be found",
|
"COGL_KMS_CONNECTOR%d_MODE of %s could not be found",
|
||||||
_index, name);
|
_index, name);
|
||||||
@ -384,7 +385,7 @@ setup_crtc_modes (CoglDisplay *display, int fb_id)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_egl_display_setup (CoglDisplay *display,
|
_cogl_winsys_egl_display_setup (CoglDisplay *display,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglDisplayEGL *egl_display = display->winsys;
|
CoglDisplayEGL *egl_display = display->winsys;
|
||||||
CoglDisplayKMS *kms_display;
|
CoglDisplayKMS *kms_display;
|
||||||
@ -400,7 +401,7 @@ _cogl_winsys_egl_display_setup (CoglDisplay *display,
|
|||||||
resources = drmModeGetResources (kms_renderer->fd);
|
resources = drmModeGetResources (kms_renderer->fd);
|
||||||
if (!resources)
|
if (!resources)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"drmModeGetResources failed");
|
"drmModeGetResources failed");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -440,7 +441,7 @@ _cogl_winsys_egl_display_setup (CoglDisplay *display,
|
|||||||
&output0->mode,
|
&output0->mode,
|
||||||
&output1->mode))
|
&output1->mode))
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"Failed to find matching modes for mirroring");
|
"Failed to find matching modes for mirroring");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -508,7 +509,7 @@ _cogl_winsys_egl_display_destroy (CoglDisplay *display)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_egl_context_created (CoglDisplay *display,
|
_cogl_winsys_egl_context_created (CoglDisplay *display,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglDisplayEGL *egl_display = display->winsys;
|
CoglDisplayEGL *egl_display = display->winsys;
|
||||||
CoglDisplayKMS *kms_display = egl_display->platform;
|
CoglDisplayKMS *kms_display = egl_display->platform;
|
||||||
@ -522,7 +523,7 @@ _cogl_winsys_egl_context_created (CoglDisplay *display,
|
|||||||
GBM_BO_USE_RENDERING);
|
GBM_BO_USE_RENDERING);
|
||||||
if (!kms_display->dummy_gbm_surface)
|
if (!kms_display->dummy_gbm_surface)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||||
"Failed to create dummy GBM surface");
|
"Failed to create dummy GBM surface");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -535,7 +536,7 @@ _cogl_winsys_egl_context_created (CoglDisplay *display,
|
|||||||
NULL);
|
NULL);
|
||||||
if (egl_display->dummy_surface == EGL_NO_SURFACE)
|
if (egl_display->dummy_surface == EGL_NO_SURFACE)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||||
"Failed to create dummy EGL surface");
|
"Failed to create dummy EGL surface");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -546,7 +547,7 @@ _cogl_winsys_egl_context_created (CoglDisplay *display,
|
|||||||
egl_display->dummy_surface,
|
egl_display->dummy_surface,
|
||||||
egl_display->egl_context))
|
egl_display->egl_context))
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||||
"Failed to make context current");
|
"Failed to make context current");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -749,7 +750,7 @@ _cogl_winsys_onscreen_swap_buffers (CoglOnscreen *onscreen)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_egl_context_init (CoglContext *context,
|
_cogl_winsys_egl_context_init (CoglContext *context,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
COGL_FLAGS_SET (context->features,
|
COGL_FLAGS_SET (context->features,
|
||||||
COGL_FEATURE_ID_SWAP_BUFFERS_EVENT, TRUE);
|
COGL_FEATURE_ID_SWAP_BUFFERS_EVENT, TRUE);
|
||||||
@ -762,7 +763,7 @@ _cogl_winsys_egl_context_init (CoglContext *context,
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
_cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||||
CoglContext *context = framebuffer->context;
|
CoglContext *context = framebuffer->context;
|
||||||
@ -793,7 +794,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
|||||||
|
|
||||||
if (!kms_onscreen->surface)
|
if (!kms_onscreen->surface)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
||||||
"Failed to allocate surface");
|
"Failed to allocate surface");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -806,7 +807,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
|||||||
NULL);
|
NULL);
|
||||||
if (egl_onscreen->egl_surface == EGL_NO_SURFACE)
|
if (egl_onscreen->egl_surface == EGL_NO_SURFACE)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
||||||
"Failed to allocate surface");
|
"Failed to allocate surface");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -56,7 +56,7 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglRendererEGL *egl_renderer;
|
CoglRendererEGL *egl_renderer;
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ error:
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_egl_context_created (CoglDisplay *display,
|
_cogl_winsys_egl_context_created (CoglDisplay *display,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglRenderer *renderer = display->renderer;
|
CoglRenderer *renderer = display->renderer;
|
||||||
CoglRendererEGL *egl_renderer = renderer->winsys;
|
CoglRendererEGL *egl_renderer = renderer->winsys;
|
||||||
@ -120,7 +120,7 @@ _cogl_winsys_egl_context_created (CoglDisplay *display,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||||
"%s", error_message);
|
"%s", error_message);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -128,7 +128,7 @@ _cogl_winsys_egl_context_created (CoglDisplay *display,
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_egl_display_setup (CoglDisplay *display,
|
_cogl_winsys_egl_display_setup (CoglDisplay *display,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglDisplayEGL *egl_display = display->winsys;
|
CoglDisplayEGL *egl_display = display->winsys;
|
||||||
CoglDisplayNull *null_display;
|
CoglDisplayNull *null_display;
|
||||||
@ -164,7 +164,7 @@ _cogl_winsys_egl_cleanup_context (CoglDisplay *display)
|
|||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
|
_cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
|
||||||
EGLConfig egl_config,
|
EGLConfig egl_config,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||||
CoglContext *context = framebuffer->context;
|
CoglContext *context = framebuffer->context;
|
||||||
@ -175,7 +175,7 @@ _cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
|
|||||||
|
|
||||||
if (null_display->have_onscreen)
|
if (null_display->have_onscreen)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
||||||
"EGL platform only supports a single onscreen window");
|
"EGL platform only supports a single onscreen window");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -34,19 +34,19 @@ typedef struct _CoglWinsysEGLVtable
|
|||||||
{
|
{
|
||||||
CoglBool
|
CoglBool
|
||||||
(* display_setup) (CoglDisplay *display,
|
(* display_setup) (CoglDisplay *display,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
void
|
void
|
||||||
(* display_destroy) (CoglDisplay *display);
|
(* display_destroy) (CoglDisplay *display);
|
||||||
|
|
||||||
CoglBool
|
CoglBool
|
||||||
(* context_created) (CoglDisplay *display,
|
(* context_created) (CoglDisplay *display,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
void
|
void
|
||||||
(* cleanup_context) (CoglDisplay *display);
|
(* cleanup_context) (CoglDisplay *display);
|
||||||
|
|
||||||
CoglBool
|
CoglBool
|
||||||
(* context_init) (CoglContext *context, GError **error);
|
(* context_init) (CoglContext *context, CoglError **error);
|
||||||
|
|
||||||
void
|
void
|
||||||
(* context_deinit) (CoglContext *context);
|
(* context_deinit) (CoglContext *context);
|
||||||
@ -54,7 +54,7 @@ typedef struct _CoglWinsysEGLVtable
|
|||||||
CoglBool
|
CoglBool
|
||||||
(* onscreen_init) (CoglOnscreen *onscreen,
|
(* onscreen_init) (CoglOnscreen *onscreen,
|
||||||
EGLConfig config,
|
EGLConfig config,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
void
|
void
|
||||||
(* onscreen_deinit) (CoglOnscreen *onscreen);
|
(* onscreen_deinit) (CoglOnscreen *onscreen);
|
||||||
|
|
||||||
@ -159,6 +159,6 @@ _cogl_egl_destroy_image (CoglContext *ctx,
|
|||||||
|
|
||||||
CoglBool
|
CoglBool
|
||||||
_cogl_winsys_egl_renderer_connect_common (CoglRenderer *renderer,
|
_cogl_winsys_egl_renderer_connect_common (CoglRenderer *renderer,
|
||||||
GError **error);
|
CoglError **error);
|
||||||
|
|
||||||
#endif /* __COGL_WINSYS_EGL_PRIVATE_H */
|
#endif /* __COGL_WINSYS_EGL_PRIVATE_H */
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "cogl-renderer-private.h"
|
#include "cogl-renderer-private.h"
|
||||||
#include "cogl-onscreen-private.h"
|
#include "cogl-onscreen-private.h"
|
||||||
#include "cogl-wayland-renderer.h"
|
#include "cogl-wayland-renderer.h"
|
||||||
|
#include "cogl-error-private.h"
|
||||||
|
|
||||||
static const CoglWinsysEGLVtable _cogl_winsys_egl_vtable;
|
static const CoglWinsysEGLVtable _cogl_winsys_egl_vtable;
|
||||||
|
|
||||||
@ -108,7 +109,7 @@ static const struct wl_registry_listener registry_listener = {
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglRendererEGL *egl_renderer;
|
CoglRendererEGL *egl_renderer;
|
||||||
CoglRendererWayland *wayland_renderer;
|
CoglRendererWayland *wayland_renderer;
|
||||||
@ -144,7 +145,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
|||||||
wayland_renderer->wayland_display = wl_display_connect (NULL);
|
wayland_renderer->wayland_display = wl_display_connect (NULL);
|
||||||
if (!wayland_renderer->wayland_display)
|
if (!wayland_renderer->wayland_display)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"Failed to connect wayland display");
|
"Failed to connect wayland display");
|
||||||
goto error;
|
goto error;
|
||||||
@ -183,7 +184,7 @@ error:
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_egl_display_setup (CoglDisplay *display,
|
_cogl_winsys_egl_display_setup (CoglDisplay *display,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglDisplayEGL *egl_display = display->winsys;
|
CoglDisplayEGL *egl_display = display->winsys;
|
||||||
CoglDisplayWayland *wayland_display;
|
CoglDisplayWayland *wayland_display;
|
||||||
@ -204,7 +205,7 @@ _cogl_winsys_egl_display_destroy (CoglDisplay *display)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_egl_context_created (CoglDisplay *display,
|
_cogl_winsys_egl_context_created (CoglDisplay *display,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglRenderer *renderer = display->renderer;
|
CoglRenderer *renderer = display->renderer;
|
||||||
CoglRendererEGL *egl_renderer = renderer->winsys;
|
CoglRendererEGL *egl_renderer = renderer->winsys;
|
||||||
@ -255,7 +256,7 @@ _cogl_winsys_egl_context_created (CoglDisplay *display,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||||
"%s", error_message);
|
"%s", error_message);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -290,7 +291,7 @@ _cogl_winsys_egl_cleanup_context (CoglDisplay *display)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_egl_context_init (CoglContext *context,
|
_cogl_winsys_egl_context_init (CoglContext *context,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
context->feature_flags |= COGL_FEATURE_ONSCREEN_MULTIPLE;
|
context->feature_flags |= COGL_FEATURE_ONSCREEN_MULTIPLE;
|
||||||
COGL_FLAGS_SET (context->features,
|
COGL_FLAGS_SET (context->features,
|
||||||
@ -305,7 +306,7 @@ _cogl_winsys_egl_context_init (CoglContext *context,
|
|||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
|
_cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
|
||||||
EGLConfig egl_config,
|
EGLConfig egl_config,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
|
CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
|
||||||
CoglOnscreenWayland *wayland_onscreen;
|
CoglOnscreenWayland *wayland_onscreen;
|
||||||
@ -322,7 +323,7 @@ _cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
|
|||||||
wl_compositor_create_surface (wayland_renderer->wayland_compositor);
|
wl_compositor_create_surface (wayland_renderer->wayland_compositor);
|
||||||
if (!wayland_onscreen->wayland_surface)
|
if (!wayland_onscreen->wayland_surface)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
||||||
"Error while creating wayland surface for CoglOnscreen");
|
"Error while creating wayland surface for CoglOnscreen");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -338,7 +339,7 @@ _cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
|
|||||||
cogl_framebuffer_get_height (framebuffer));
|
cogl_framebuffer_get_height (framebuffer));
|
||||||
if (!wayland_onscreen->wayland_egl_native_window)
|
if (!wayland_onscreen->wayland_egl_native_window)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
||||||
"Error while creating wayland egl native window "
|
"Error while creating wayland egl native window "
|
||||||
"for CoglOnscreen");
|
"for CoglOnscreen");
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
|
|
||||||
#include "cogl-texture-pixmap-x11-private.h"
|
#include "cogl-texture-pixmap-x11-private.h"
|
||||||
#include "cogl-texture-2d-private.h"
|
#include "cogl-texture-2d-private.h"
|
||||||
|
#include "cogl-error-private.h"
|
||||||
|
|
||||||
#define COGL_ONSCREEN_X11_EVENT_MASK StructureNotifyMask
|
#define COGL_ONSCREEN_X11_EVENT_MASK StructureNotifyMask
|
||||||
|
|
||||||
@ -194,7 +195,7 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglRendererEGL *egl_renderer;
|
CoglRendererEGL *egl_renderer;
|
||||||
CoglXlibRenderer *xlib_renderer;
|
CoglXlibRenderer *xlib_renderer;
|
||||||
@ -223,7 +224,7 @@ error:
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_egl_display_setup (CoglDisplay *display,
|
_cogl_winsys_egl_display_setup (CoglDisplay *display,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglDisplayEGL *egl_display = display->winsys;
|
CoglDisplayEGL *egl_display = display->winsys;
|
||||||
CoglDisplayXlib *xlib_display;
|
CoglDisplayXlib *xlib_display;
|
||||||
@ -244,7 +245,7 @@ _cogl_winsys_egl_display_destroy (CoglDisplay *display)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_egl_context_init (CoglContext *context,
|
_cogl_winsys_egl_context_init (CoglContext *context,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
cogl_xlib_renderer_add_filter (context->display->renderer,
|
cogl_xlib_renderer_add_filter (context->display->renderer,
|
||||||
event_filter_cb,
|
event_filter_cb,
|
||||||
@ -271,7 +272,7 @@ _cogl_winsys_egl_context_deinit (CoglContext *context)
|
|||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
|
_cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
|
||||||
EGLConfig egl_config,
|
EGLConfig egl_config,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||||
CoglContext *context = framebuffer->context;
|
CoglContext *context = framebuffer->context;
|
||||||
@ -312,7 +313,7 @@ _cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
|
|||||||
char message[1000];
|
char message[1000];
|
||||||
XGetErrorText (xlib_renderer->xdpy, xerror,
|
XGetErrorText (xlib_renderer->xdpy, xerror,
|
||||||
message, sizeof (message));
|
message, sizeof (message));
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
||||||
"Unable to query geometry of foreign "
|
"Unable to query geometry of foreign "
|
||||||
"xid 0x%08lX: %s",
|
"xid 0x%08lX: %s",
|
||||||
@ -347,7 +348,7 @@ _cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
|
|||||||
xvisinfo = get_visual_info (display, egl_config);
|
xvisinfo = get_visual_info (display, egl_config);
|
||||||
if (xvisinfo == NULL)
|
if (xvisinfo == NULL)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
||||||
"Unable to retrieve the X11 visual of context's "
|
"Unable to retrieve the X11 visual of context's "
|
||||||
"fbconfig");
|
"fbconfig");
|
||||||
@ -389,7 +390,7 @@ _cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
|
|||||||
char message[1000];
|
char message[1000];
|
||||||
XGetErrorText (xlib_renderer->xdpy, xerror,
|
XGetErrorText (xlib_renderer->xdpy, xerror,
|
||||||
message, sizeof (message));
|
message, sizeof (message));
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
||||||
"X error while creating Window for CoglOnscreen: %s",
|
"X error while creating Window for CoglOnscreen: %s",
|
||||||
message);
|
message);
|
||||||
@ -510,7 +511,7 @@ _cogl_winsys_onscreen_x11_get_window_xid (CoglOnscreen *onscreen)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_egl_context_created (CoglDisplay *display,
|
_cogl_winsys_egl_context_created (CoglDisplay *display,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglRenderer *renderer = display->renderer;
|
CoglRenderer *renderer = display->renderer;
|
||||||
CoglDisplayEGL *egl_display = display->winsys;
|
CoglDisplayEGL *egl_display = display->winsys;
|
||||||
@ -575,7 +576,7 @@ _cogl_winsys_egl_context_created (CoglDisplay *display,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||||
"%s", error_message);
|
"%s", error_message);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include "cogl-renderer-private.h"
|
#include "cogl-renderer-private.h"
|
||||||
#include "cogl-onscreen-template-private.h"
|
#include "cogl-onscreen-template-private.h"
|
||||||
#include "cogl-gles2-context-private.h"
|
#include "cogl-gles2-context-private.h"
|
||||||
|
#include "cogl-error-private.h"
|
||||||
|
|
||||||
#include "cogl-private.h"
|
#include "cogl-private.h"
|
||||||
|
|
||||||
@ -168,7 +169,7 @@ check_egl_extensions (CoglRenderer *renderer)
|
|||||||
|
|
||||||
CoglBool
|
CoglBool
|
||||||
_cogl_winsys_egl_renderer_connect_common (CoglRenderer *renderer,
|
_cogl_winsys_egl_renderer_connect_common (CoglRenderer *renderer,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglRendererEGL *egl_renderer = renderer->winsys;
|
CoglRendererEGL *egl_renderer = renderer->winsys;
|
||||||
|
|
||||||
@ -176,7 +177,7 @@ _cogl_winsys_egl_renderer_connect_common (CoglRenderer *renderer,
|
|||||||
&egl_renderer->egl_version_major,
|
&egl_renderer->egl_version_major,
|
||||||
&egl_renderer->egl_version_minor))
|
&egl_renderer->egl_version_minor))
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"Couldn't initialize EGL");
|
"Couldn't initialize EGL");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -189,7 +190,7 @@ _cogl_winsys_egl_renderer_connect_common (CoglRenderer *renderer,
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
/* This function must be overridden by a platform winsys */
|
/* This function must be overridden by a platform winsys */
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
@ -256,7 +257,7 @@ egl_attributes_from_framebuffer_config (CoglDisplay *display,
|
|||||||
static CoglBool
|
static CoglBool
|
||||||
try_create_context (CoglDisplay *display,
|
try_create_context (CoglDisplay *display,
|
||||||
CoglBool with_stencil_buffer,
|
CoglBool with_stencil_buffer,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglRenderer *renderer = display->renderer;
|
CoglRenderer *renderer = display->renderer;
|
||||||
CoglDisplayEGL *egl_display = display->winsys;
|
CoglDisplayEGL *egl_display = display->winsys;
|
||||||
@ -319,7 +320,7 @@ try_create_context (CoglDisplay *display,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||||
"%s", error_message);
|
"%s", error_message);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -373,7 +374,7 @@ cleanup_context (CoglDisplay *display)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
create_context (CoglDisplay *display, GError **error)
|
create_context (CoglDisplay *display, CoglError **error)
|
||||||
{
|
{
|
||||||
CoglDisplayEGL *egl_display = display->winsys;
|
CoglDisplayEGL *egl_display = display->winsys;
|
||||||
|
|
||||||
@ -390,7 +391,7 @@ create_context (CoglDisplay *display, GError **error)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_clear_error (error);
|
_cogl_clear_error (error);
|
||||||
cleanup_context (display);
|
cleanup_context (display);
|
||||||
egl_display->stencil_disabled = TRUE;
|
egl_display->stencil_disabled = TRUE;
|
||||||
return try_create_context (display, FALSE, error);
|
return try_create_context (display, FALSE, error);
|
||||||
@ -416,7 +417,7 @@ _cogl_winsys_display_destroy (CoglDisplay *display)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_display_setup (CoglDisplay *display,
|
_cogl_winsys_display_setup (CoglDisplay *display,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglDisplayEGL *egl_display;
|
CoglDisplayEGL *egl_display;
|
||||||
CoglRenderer *renderer = display->renderer;
|
CoglRenderer *renderer = display->renderer;
|
||||||
@ -455,7 +456,7 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_context_init (CoglContext *context, GError **error)
|
_cogl_winsys_context_init (CoglContext *context, CoglError **error)
|
||||||
{
|
{
|
||||||
CoglRenderer *renderer = context->display->renderer;
|
CoglRenderer *renderer = context->display->renderer;
|
||||||
CoglDisplayEGL *egl_display = context->display->winsys;
|
CoglDisplayEGL *egl_display = context->display->winsys;
|
||||||
@ -514,7 +515,7 @@ typedef struct _CoglGLES2ContextEGL
|
|||||||
} CoglGLES2ContextEGL;
|
} CoglGLES2ContextEGL;
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
_cogl_winsys_context_create_gles2_context (CoglContext *ctx, GError **error)
|
_cogl_winsys_context_create_gles2_context (CoglContext *ctx, CoglError **error)
|
||||||
{
|
{
|
||||||
CoglRendererEGL *egl_renderer = ctx->display->renderer->winsys;
|
CoglRendererEGL *egl_renderer = ctx->display->renderer->winsys;
|
||||||
CoglDisplayEGL *egl_display = ctx->display->winsys;
|
CoglDisplayEGL *egl_display = ctx->display->winsys;
|
||||||
@ -531,7 +532,7 @@ _cogl_winsys_context_create_gles2_context (CoglContext *ctx, GError **error)
|
|||||||
attribs);
|
attribs);
|
||||||
if (egl_context == EGL_NO_CONTEXT)
|
if (egl_context == EGL_NO_CONTEXT)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_GLES2_CONTEXT,
|
COGL_WINSYS_ERROR_CREATE_GLES2_CONTEXT,
|
||||||
"%s", get_error_string ());
|
"%s", get_error_string ());
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -557,7 +558,7 @@ _cogl_winsys_destroy_gles2_context (CoglGLES2Context *gles2_ctx)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
_cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||||
CoglContext *context = framebuffer->context;
|
CoglContext *context = framebuffer->context;
|
||||||
@ -585,7 +586,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
|||||||
&config_count);
|
&config_count);
|
||||||
if (status != EGL_TRUE || config_count == 0)
|
if (status != EGL_TRUE || config_count == 0)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
||||||
"Failed to find a suitable EGL configuration");
|
"Failed to find a suitable EGL configuration");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -779,7 +780,7 @@ _cogl_winsys_save_context (CoglContext *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_set_gles2_context (CoglGLES2Context *gles2_ctx, GError **error)
|
_cogl_winsys_set_gles2_context (CoglGLES2Context *gles2_ctx, CoglError **error)
|
||||||
{
|
{
|
||||||
CoglContext *ctx = gles2_ctx->context;
|
CoglContext *ctx = gles2_ctx->context;
|
||||||
CoglDisplayEGL *egl_display = ctx->display->winsys;
|
CoglDisplayEGL *egl_display = ctx->display->winsys;
|
||||||
@ -798,7 +799,7 @@ _cogl_winsys_set_gles2_context (CoglGLES2Context *gles2_ctx, GError **error)
|
|||||||
|
|
||||||
if (!status)
|
if (!status)
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
_cogl_set_error (error,
|
||||||
COGL_WINSYS_ERROR,
|
COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_MAKE_CURRENT,
|
COGL_WINSYS_ERROR_MAKE_CURRENT,
|
||||||
"Failed to make gles2 context current");
|
"Failed to make gles2 context current");
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
#include "cogl-xlib-renderer.h"
|
#include "cogl-xlib-renderer.h"
|
||||||
#include "cogl-util.h"
|
#include "cogl-util.h"
|
||||||
#include "cogl-winsys-glx-private.h"
|
#include "cogl-winsys-glx-private.h"
|
||||||
|
#include "cogl-error-private.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -261,7 +262,7 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
resolve_core_glx_functions (CoglRenderer *renderer,
|
resolve_core_glx_functions (CoglRenderer *renderer,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglGLXRenderer *glx_renderer;
|
CoglGLXRenderer *glx_renderer;
|
||||||
|
|
||||||
@ -306,7 +307,7 @@ resolve_core_glx_functions (CoglRenderer *renderer,
|
|||||||
!g_module_symbol (glx_renderer->libgl_module, "glXGetProcAddressARB",
|
!g_module_symbol (glx_renderer->libgl_module, "glXGetProcAddressARB",
|
||||||
(void **) &glx_renderer->glXGetProcAddress)))
|
(void **) &glx_renderer->glXGetProcAddress)))
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"Failed to resolve required GLX symbol");
|
"Failed to resolve required GLX symbol");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -317,7 +318,7 @@ resolve_core_glx_functions (CoglRenderer *renderer,
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglGLXRenderer *glx_renderer;
|
CoglGLXRenderer *glx_renderer;
|
||||||
CoglXlibRenderer *xlib_renderer;
|
CoglXlibRenderer *xlib_renderer;
|
||||||
@ -332,7 +333,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
|||||||
|
|
||||||
if (renderer->driver != COGL_DRIVER_GL)
|
if (renderer->driver != COGL_DRIVER_GL)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"GLX Backend can only be used in conjunction with OpenGL");
|
"GLX Backend can only be used in conjunction with OpenGL");
|
||||||
goto error;
|
goto error;
|
||||||
@ -343,7 +344,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
|||||||
|
|
||||||
if (glx_renderer->libgl_module == NULL)
|
if (glx_renderer->libgl_module == NULL)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"Failed to dynamically open the OpenGL library");
|
"Failed to dynamically open the OpenGL library");
|
||||||
goto error;
|
goto error;
|
||||||
@ -356,7 +357,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
|||||||
&glx_renderer->glx_error_base,
|
&glx_renderer->glx_error_base,
|
||||||
&glx_renderer->glx_event_base))
|
&glx_renderer->glx_event_base))
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"XServer appears to lack required GLX support");
|
"XServer appears to lack required GLX support");
|
||||||
goto error;
|
goto error;
|
||||||
@ -370,7 +371,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
|||||||
&glx_renderer->glx_minor)
|
&glx_renderer->glx_minor)
|
||||||
|| !(glx_renderer->glx_major == 1 && glx_renderer->glx_minor >= 2))
|
|| !(glx_renderer->glx_major == 1 && glx_renderer->glx_minor >= 2))
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"XServer appears to lack required GLX 1.2 support");
|
"XServer appears to lack required GLX 1.2 support");
|
||||||
goto error;
|
goto error;
|
||||||
@ -386,7 +387,7 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
update_winsys_features (CoglContext *context, GError **error)
|
update_winsys_features (CoglContext *context, CoglError **error)
|
||||||
{
|
{
|
||||||
CoglGLXDisplay *glx_display = context->display->winsys;
|
CoglGLXDisplay *glx_display = context->display->winsys;
|
||||||
CoglXlibRenderer *xlib_renderer =
|
CoglXlibRenderer *xlib_renderer =
|
||||||
@ -540,7 +541,7 @@ static CoglBool
|
|||||||
find_fbconfig (CoglDisplay *display,
|
find_fbconfig (CoglDisplay *display,
|
||||||
CoglFramebufferConfig *config,
|
CoglFramebufferConfig *config,
|
||||||
GLXFBConfig *config_ret,
|
GLXFBConfig *config_ret,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglXlibRenderer *xlib_renderer =
|
CoglXlibRenderer *xlib_renderer =
|
||||||
_cogl_xlib_renderer_get_data (display->renderer);
|
_cogl_xlib_renderer_get_data (display->renderer);
|
||||||
@ -559,7 +560,7 @@ find_fbconfig (CoglDisplay *display,
|
|||||||
&n_configs);
|
&n_configs);
|
||||||
if (!configs || n_configs == 0)
|
if (!configs || n_configs == 0)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||||
"Failed to find any compatible fbconfigs");
|
"Failed to find any compatible fbconfigs");
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
@ -589,7 +590,7 @@ find_fbconfig (CoglDisplay *display,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||||
"Unable to find fbconfig with rgba visual");
|
"Unable to find fbconfig with rgba visual");
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
@ -607,7 +608,7 @@ done:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
create_context (CoglDisplay *display, GError **error)
|
create_context (CoglDisplay *display, CoglError **error)
|
||||||
{
|
{
|
||||||
CoglGLXDisplay *glx_display = display->winsys;
|
CoglGLXDisplay *glx_display = display->winsys;
|
||||||
CoglXlibRenderer *xlib_renderer =
|
CoglXlibRenderer *xlib_renderer =
|
||||||
@ -616,7 +617,7 @@ create_context (CoglDisplay *display, GError **error)
|
|||||||
CoglBool support_transparent_windows =
|
CoglBool support_transparent_windows =
|
||||||
display->onscreen_template->config.swap_chain->has_alpha;
|
display->onscreen_template->config.swap_chain->has_alpha;
|
||||||
GLXFBConfig config;
|
GLXFBConfig config;
|
||||||
GError *fbconfig_error = NULL;
|
CoglError *fbconfig_error = NULL;
|
||||||
XSetWindowAttributes attrs;
|
XSetWindowAttributes attrs;
|
||||||
XVisualInfo *xvisinfo;
|
XVisualInfo *xvisinfo;
|
||||||
GLXDrawable dummy_drawable;
|
GLXDrawable dummy_drawable;
|
||||||
@ -629,11 +630,11 @@ create_context (CoglDisplay *display, GError **error)
|
|||||||
&fbconfig_error);
|
&fbconfig_error);
|
||||||
if (!glx_display->found_fbconfig)
|
if (!glx_display->found_fbconfig)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||||
"Unable to find suitable fbconfig for the GLX context: %s",
|
"Unable to find suitable fbconfig for the GLX context: %s",
|
||||||
fbconfig_error->message);
|
fbconfig_error->message);
|
||||||
g_error_free (fbconfig_error);
|
cogl_error_free (fbconfig_error);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -651,7 +652,7 @@ create_context (CoglDisplay *display, GError **error)
|
|||||||
True);
|
True);
|
||||||
if (glx_display->glx_context == NULL)
|
if (glx_display->glx_context == NULL)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||||
"Unable to create suitable GL context");
|
"Unable to create suitable GL context");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -672,7 +673,7 @@ create_context (CoglDisplay *display, GError **error)
|
|||||||
config);
|
config);
|
||||||
if (xvisinfo == NULL)
|
if (xvisinfo == NULL)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||||
"Unable to retrieve the X11 visual");
|
"Unable to retrieve the X11 visual");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -727,7 +728,7 @@ create_context (CoglDisplay *display, GError **error)
|
|||||||
|
|
||||||
if (_cogl_xlib_renderer_untrap_errors (display->renderer, &old_state))
|
if (_cogl_xlib_renderer_untrap_errors (display->renderer, &old_state))
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||||
"Unable to select the newly created GLX context");
|
"Unable to select the newly created GLX context");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -774,7 +775,7 @@ _cogl_winsys_display_destroy (CoglDisplay *display)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_display_setup (CoglDisplay *display,
|
_cogl_winsys_display_setup (CoglDisplay *display,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglGLXDisplay *glx_display;
|
CoglGLXDisplay *glx_display;
|
||||||
int i;
|
int i;
|
||||||
@ -798,7 +799,7 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_context_init (CoglContext *context, GError **error)
|
_cogl_winsys_context_init (CoglContext *context, CoglError **error)
|
||||||
{
|
{
|
||||||
context->winsys = g_new0 (CoglContextGLX, 1);
|
context->winsys = g_new0 (CoglContextGLX, 1);
|
||||||
|
|
||||||
@ -819,7 +820,7 @@ _cogl_winsys_context_deinit (CoglContext *context)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
_cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||||
CoglContext *context = framebuffer->context;
|
CoglContext *context = framebuffer->context;
|
||||||
@ -832,7 +833,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
|||||||
CoglOnscreenXlib *xlib_onscreen;
|
CoglOnscreenXlib *xlib_onscreen;
|
||||||
CoglOnscreenGLX *glx_onscreen;
|
CoglOnscreenGLX *glx_onscreen;
|
||||||
GLXFBConfig fbconfig;
|
GLXFBConfig fbconfig;
|
||||||
GError *fbconfig_error = NULL;
|
CoglError *fbconfig_error = NULL;
|
||||||
|
|
||||||
_COGL_RETURN_VAL_IF_FAIL (glx_display->glx_context, FALSE);
|
_COGL_RETURN_VAL_IF_FAIL (glx_display->glx_context, FALSE);
|
||||||
|
|
||||||
@ -840,11 +841,11 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
|||||||
&fbconfig,
|
&fbconfig,
|
||||||
&fbconfig_error))
|
&fbconfig_error))
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||||
"Unable to find suitable fbconfig for the GLX context: %s",
|
"Unable to find suitable fbconfig for the GLX context: %s",
|
||||||
fbconfig_error->message);
|
fbconfig_error->message);
|
||||||
g_error_free (fbconfig_error);
|
cogl_error_free (fbconfig_error);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -888,7 +889,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
|||||||
{
|
{
|
||||||
char message[1000];
|
char message[1000];
|
||||||
XGetErrorText (xlib_renderer->xdpy, xerror, message, sizeof(message));
|
XGetErrorText (xlib_renderer->xdpy, xerror, message, sizeof(message));
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
||||||
"Unable to query geometry of foreign xid 0x%08lX: %s",
|
"Unable to query geometry of foreign xid 0x%08lX: %s",
|
||||||
xwin, message);
|
xwin, message);
|
||||||
@ -922,7 +923,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
|||||||
fbconfig);
|
fbconfig);
|
||||||
if (xvisinfo == NULL)
|
if (xvisinfo == NULL)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
||||||
"Unable to retrieve the X11 visual of context's "
|
"Unable to retrieve the X11 visual of context's "
|
||||||
"fbconfig");
|
"fbconfig");
|
||||||
@ -961,7 +962,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
|||||||
char message[1000];
|
char message[1000];
|
||||||
XGetErrorText (xlib_renderer->xdpy, xerror,
|
XGetErrorText (xlib_renderer->xdpy, xerror,
|
||||||
message, sizeof (message));
|
message, sizeof (message));
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
||||||
"X error while creating Window for CoglOnscreen: %s",
|
"X error while creating Window for CoglOnscreen: %s",
|
||||||
message);
|
message);
|
||||||
@ -1113,7 +1114,7 @@ _cogl_winsys_onscreen_bind (CoglOnscreen *onscreen)
|
|||||||
|
|
||||||
XSync (xlib_renderer->xdpy, False);
|
XSync (xlib_renderer->xdpy, False);
|
||||||
|
|
||||||
/* FIXME: We should be reporting a GError here
|
/* FIXME: We should be reporting a CoglError here
|
||||||
*/
|
*/
|
||||||
if (_cogl_xlib_renderer_untrap_errors (context->display->renderer,
|
if (_cogl_xlib_renderer_untrap_errors (context->display->renderer,
|
||||||
&old_state))
|
&old_state))
|
||||||
@ -1917,7 +1918,7 @@ _cogl_winsys_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap,
|
|||||||
if (glx_tex_pixmap->glx_tex == NULL)
|
if (glx_tex_pixmap->glx_tex == NULL)
|
||||||
{
|
{
|
||||||
CoglPixelFormat texture_format;
|
CoglPixelFormat texture_format;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
|
|
||||||
texture_format = (tex_pixmap->depth >= 32 ?
|
texture_format = (tex_pixmap->depth >= 32 ?
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE :
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE :
|
||||||
@ -1940,7 +1941,7 @@ _cogl_winsys_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap,
|
|||||||
COGL_NOTE (TEXTURE_PIXMAP, "Falling back for %p because a "
|
COGL_NOTE (TEXTURE_PIXMAP, "Falling back for %p because a "
|
||||||
"texture rectangle could not be created: %s",
|
"texture rectangle could not be created: %s",
|
||||||
tex_pixmap, error->message);
|
tex_pixmap, error->message);
|
||||||
g_error_free (error);
|
cogl_error_free (error);
|
||||||
free_glx_pixmap (ctx, glx_tex_pixmap);
|
free_glx_pixmap (ctx, glx_tex_pixmap);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
#include "cogl-poll.h"
|
#include "cogl-poll.h"
|
||||||
|
|
||||||
GQuark
|
uint32_t
|
||||||
_cogl_winsys_error_quark (void);
|
_cogl_winsys_error_quark (void);
|
||||||
|
|
||||||
#define COGL_WINSYS_ERROR (_cogl_winsys_error_quark ())
|
#define COGL_WINSYS_ERROR (_cogl_winsys_error_quark ())
|
||||||
@ -78,28 +78,28 @@ typedef struct _CoglWinsysVtable
|
|||||||
CoglBool in_core);
|
CoglBool in_core);
|
||||||
|
|
||||||
CoglBool
|
CoglBool
|
||||||
(*renderer_connect) (CoglRenderer *renderer, GError **error);
|
(*renderer_connect) (CoglRenderer *renderer, CoglError **error);
|
||||||
|
|
||||||
void
|
void
|
||||||
(*renderer_disconnect) (CoglRenderer *renderer);
|
(*renderer_disconnect) (CoglRenderer *renderer);
|
||||||
|
|
||||||
CoglBool
|
CoglBool
|
||||||
(*display_setup) (CoglDisplay *display, GError **error);
|
(*display_setup) (CoglDisplay *display, CoglError **error);
|
||||||
|
|
||||||
void
|
void
|
||||||
(*display_destroy) (CoglDisplay *display);
|
(*display_destroy) (CoglDisplay *display);
|
||||||
|
|
||||||
CoglBool
|
CoglBool
|
||||||
(*context_init) (CoglContext *context, GError **error);
|
(*context_init) (CoglContext *context, CoglError **error);
|
||||||
|
|
||||||
void
|
void
|
||||||
(*context_deinit) (CoglContext *context);
|
(*context_deinit) (CoglContext *context);
|
||||||
|
|
||||||
void *
|
void *
|
||||||
(*context_create_gles2_context) (CoglContext *ctx, GError **error);
|
(*context_create_gles2_context) (CoglContext *ctx, CoglError **error);
|
||||||
|
|
||||||
CoglBool
|
CoglBool
|
||||||
(*onscreen_init) (CoglOnscreen *onscreen, GError **error);
|
(*onscreen_init) (CoglOnscreen *onscreen, CoglError **error);
|
||||||
|
|
||||||
void
|
void
|
||||||
(*onscreen_deinit) (CoglOnscreen *onscreen);
|
(*onscreen_deinit) (CoglOnscreen *onscreen);
|
||||||
@ -176,7 +176,7 @@ typedef struct _CoglWinsysVtable
|
|||||||
(*save_context) (CoglContext *ctx);
|
(*save_context) (CoglContext *ctx);
|
||||||
|
|
||||||
CoglBool
|
CoglBool
|
||||||
(*set_gles2_context) (CoglGLES2Context *gles2_ctx, GError **error);
|
(*set_gles2_context) (CoglGLES2Context *gles2_ctx, CoglError **error);
|
||||||
|
|
||||||
void
|
void
|
||||||
(*restore_context) (CoglContext *ctx);
|
(*restore_context) (CoglContext *ctx);
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-onscreen-private.h"
|
#include "cogl-onscreen-private.h"
|
||||||
#include "cogl-winsys-sdl-private.h"
|
#include "cogl-winsys-sdl-private.h"
|
||||||
|
#include "cogl-error-private.h"
|
||||||
|
|
||||||
typedef struct _CoglRendererSdl
|
typedef struct _CoglRendererSdl
|
||||||
{
|
{
|
||||||
@ -84,12 +85,12 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
#ifndef COGL_HAS_SDL_GLES_SUPPORT
|
#ifndef COGL_HAS_SDL_GLES_SUPPORT
|
||||||
if (renderer->driver != COGL_DRIVER_GL)
|
if (renderer->driver != COGL_DRIVER_GL)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"The SDL winsys only supports the GL driver");
|
"The SDL winsys only supports the GL driver");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -98,7 +99,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
|||||||
|
|
||||||
if (SDL_Init (SDL_INIT_VIDEO) == -1)
|
if (SDL_Init (SDL_INIT_VIDEO) == -1)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"SDL_Init failed: %s",
|
"SDL_Init failed: %s",
|
||||||
SDL_GetError ());
|
SDL_GetError ());
|
||||||
@ -144,7 +145,7 @@ set_gl_attribs_from_framebuffer_config (CoglFramebufferConfig *config)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_display_setup (CoglDisplay *display,
|
_cogl_winsys_display_setup (CoglDisplay *display,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglDisplaySdl *sdl_display;
|
CoglDisplaySdl *sdl_display;
|
||||||
|
|
||||||
@ -189,7 +190,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
|
|||||||
|
|
||||||
if (sdl_display->surface == NULL)
|
if (sdl_display->surface == NULL)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"SDL_SetVideoMode failed: %s",
|
"SDL_SetVideoMode failed: %s",
|
||||||
SDL_GetError ());
|
SDL_GetError ());
|
||||||
@ -237,7 +238,7 @@ sdl_event_filter_cb (SDL_Event *event, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_context_init (CoglContext *context, GError **error)
|
_cogl_winsys_context_init (CoglContext *context, CoglError **error)
|
||||||
{
|
{
|
||||||
CoglRenderer *renderer = context->display->renderer;
|
CoglRenderer *renderer = context->display->renderer;
|
||||||
|
|
||||||
@ -274,7 +275,7 @@ _cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
_cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||||
CoglContext *context = framebuffer->context;
|
CoglContext *context = framebuffer->context;
|
||||||
@ -284,7 +285,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
|||||||
|
|
||||||
if (sdl_display->onscreen)
|
if (sdl_display->onscreen)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
||||||
"SDL winsys only supports a single onscreen window");
|
"SDL winsys only supports a single onscreen window");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -303,7 +304,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
|||||||
|
|
||||||
if (sdl_display->surface == NULL)
|
if (sdl_display->surface == NULL)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
||||||
"SDL_SetVideoMode failed: %s",
|
"SDL_SetVideoMode failed: %s",
|
||||||
SDL_GetError ());
|
SDL_GetError ());
|
||||||
|
@ -86,11 +86,11 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
if (SDL_VideoInit (NULL) < 0)
|
if (SDL_VideoInit (NULL) < 0)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"SDL_Init failed: %s",
|
"SDL_Init failed: %s",
|
||||||
SDL_GetError ());
|
SDL_GetError ());
|
||||||
@ -140,7 +140,7 @@ set_gl_attribs_from_framebuffer_config (CoglFramebufferConfig *config)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_display_setup (CoglDisplay *display,
|
_cogl_winsys_display_setup (CoglDisplay *display,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglDisplaySdl2 *sdl_display;
|
CoglDisplaySdl2 *sdl_display;
|
||||||
const char * (* get_string_func) (GLenum name);
|
const char * (* get_string_func) (GLenum name);
|
||||||
@ -167,7 +167,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
|
|||||||
SDL_WINDOW_HIDDEN);
|
SDL_WINDOW_HIDDEN);
|
||||||
if (sdl_display->dummy_window == NULL)
|
if (sdl_display->dummy_window == NULL)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"SDL_CreateWindow failed: %s",
|
"SDL_CreateWindow failed: %s",
|
||||||
SDL_GetError ());
|
SDL_GetError ());
|
||||||
@ -178,7 +178,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
|
|||||||
|
|
||||||
if (sdl_display->context == NULL)
|
if (sdl_display->context == NULL)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"SDL_GL_CreateContext failed: %s",
|
"SDL_GL_CreateContext failed: %s",
|
||||||
SDL_GetError ());
|
SDL_GetError ());
|
||||||
@ -199,7 +199,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
|
|||||||
* it's normal GL */
|
* it's normal GL */
|
||||||
if (!g_ascii_isdigit (gl_version[0]))
|
if (!g_ascii_isdigit (gl_version[0]))
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"The GL driver was requested but SDL is using GLES");
|
"The GL driver was requested but SDL is using GLES");
|
||||||
goto error;
|
goto error;
|
||||||
@ -209,7 +209,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
|
|||||||
case COGL_DRIVER_GLES2:
|
case COGL_DRIVER_GLES2:
|
||||||
if (!g_str_has_prefix (gl_version, "OpenGL ES 2"))
|
if (!g_str_has_prefix (gl_version, "OpenGL ES 2"))
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"The GLES2 driver was requested but SDL is "
|
"The GLES2 driver was requested but SDL is "
|
||||||
"not using GLES2");
|
"not using GLES2");
|
||||||
@ -220,7 +220,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
|
|||||||
case COGL_DRIVER_GLES1:
|
case COGL_DRIVER_GLES1:
|
||||||
if (!g_str_has_prefix (gl_version, "OpenGL ES 1"))
|
if (!g_str_has_prefix (gl_version, "OpenGL ES 1"))
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
"The GLES1 driver was requested but SDL is "
|
"The GLES1 driver was requested but SDL is "
|
||||||
"not using GLES1");
|
"not using GLES1");
|
||||||
@ -240,7 +240,7 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_context_init (CoglContext *context, GError **error)
|
_cogl_winsys_context_init (CoglContext *context, CoglError **error)
|
||||||
{
|
{
|
||||||
CoglRenderer *renderer = context->display->renderer;
|
CoglRenderer *renderer = context->display->renderer;
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ _cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
_cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||||
CoglOnscreenSdl2 *sdl_onscreen;
|
CoglOnscreenSdl2 *sdl_onscreen;
|
||||||
@ -339,7 +339,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
|||||||
|
|
||||||
if (window == NULL)
|
if (window == NULL)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
||||||
"SDL_CreateWindow failed: %s",
|
"SDL_CreateWindow failed: %s",
|
||||||
SDL_GetError ());
|
SDL_GetError ());
|
||||||
|
@ -76,7 +76,7 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
renderer->winsys = &_cogl_winsys_stub_dummy_ptr;
|
renderer->winsys = &_cogl_winsys_stub_dummy_ptr;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -90,14 +90,14 @@ _cogl_winsys_display_destroy (CoglDisplay *display)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_display_setup (CoglDisplay *display,
|
_cogl_winsys_display_setup (CoglDisplay *display,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
display->winsys = &_cogl_winsys_stub_dummy_ptr;
|
display->winsys = &_cogl_winsys_stub_dummy_ptr;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_context_init (CoglContext *context, GError **error)
|
_cogl_winsys_context_init (CoglContext *context, CoglError **error)
|
||||||
{
|
{
|
||||||
context->winsys = &_cogl_winsys_stub_dummy_ptr;
|
context->winsys = &_cogl_winsys_stub_dummy_ptr;
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ _cogl_winsys_context_deinit (CoglContext *context)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
_cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,7 @@ win32_event_filter_cb (MSG *msg, void *data)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
renderer->winsys = g_slice_new0 (CoglRendererWgl);
|
renderer->winsys = g_slice_new0 (CoglRendererWgl);
|
||||||
|
|
||||||
@ -372,7 +372,7 @@ choose_pixel_format (CoglFramebufferConfig *config,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
create_window_class (CoglDisplay *display, GError **error)
|
create_window_class (CoglDisplay *display, CoglError **error)
|
||||||
{
|
{
|
||||||
CoglDisplayWgl *wgl_display = display->winsys;
|
CoglDisplayWgl *wgl_display = display->winsys;
|
||||||
char *class_name_ascii, *src;
|
char *class_name_ascii, *src;
|
||||||
@ -415,7 +415,7 @@ create_window_class (CoglDisplay *display, GError **error)
|
|||||||
|
|
||||||
if (wgl_display->window_class == 0)
|
if (wgl_display->window_class == 0)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||||
"Unable to register window class");
|
"Unable to register window class");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -425,7 +425,7 @@ create_window_class (CoglDisplay *display, GError **error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
create_context (CoglDisplay *display, GError **error)
|
create_context (CoglDisplay *display, CoglError **error)
|
||||||
{
|
{
|
||||||
CoglDisplayWgl *wgl_display = display->winsys;
|
CoglDisplayWgl *wgl_display = display->winsys;
|
||||||
|
|
||||||
@ -451,7 +451,7 @@ create_context (CoglDisplay *display, GError **error)
|
|||||||
|
|
||||||
if (wgl_display->dummy_hwnd == NULL)
|
if (wgl_display->dummy_hwnd == NULL)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||||
"Unable to create dummy window");
|
"Unable to create dummy window");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -470,7 +470,7 @@ create_context (CoglDisplay *display, GError **error)
|
|||||||
|
|
||||||
if (pf == 0 || !SetPixelFormat (wgl_display->dummy_dc, pf, &pfd))
|
if (pf == 0 || !SetPixelFormat (wgl_display->dummy_dc, pf, &pfd))
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||||
"Unable to find suitable GL pixel format");
|
"Unable to find suitable GL pixel format");
|
||||||
ReleaseDC (wgl_display->dummy_hwnd, wgl_display->dummy_dc);
|
ReleaseDC (wgl_display->dummy_hwnd, wgl_display->dummy_dc);
|
||||||
@ -485,7 +485,7 @@ create_context (CoglDisplay *display, GError **error)
|
|||||||
|
|
||||||
if (wgl_display->wgl_context == NULL)
|
if (wgl_display->wgl_context == NULL)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||||
"Unable to create suitable GL context");
|
"Unable to create suitable GL context");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -529,7 +529,7 @@ _cogl_winsys_display_destroy (CoglDisplay *display)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_display_setup (CoglDisplay *display,
|
_cogl_winsys_display_setup (CoglDisplay *display,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglDisplayWgl *wgl_display;
|
CoglDisplayWgl *wgl_display;
|
||||||
|
|
||||||
@ -587,7 +587,7 @@ get_wgl_extensions_string (HDC dc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
update_winsys_features (CoglContext *context, GError **error)
|
update_winsys_features (CoglContext *context, CoglError **error)
|
||||||
{
|
{
|
||||||
CoglDisplayWgl *wgl_display = context->display->winsys;
|
CoglDisplayWgl *wgl_display = context->display->winsys;
|
||||||
CoglRendererWgl *wgl_renderer = context->display->renderer->winsys;
|
CoglRendererWgl *wgl_renderer = context->display->renderer->winsys;
|
||||||
@ -633,7 +633,7 @@ update_winsys_features (CoglContext *context, GError **error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_context_init (CoglContext *context, GError **error)
|
_cogl_winsys_context_init (CoglContext *context, CoglError **error)
|
||||||
{
|
{
|
||||||
CoglContextWgl *wgl_context;
|
CoglContextWgl *wgl_context;
|
||||||
|
|
||||||
@ -733,7 +733,7 @@ _cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
|
|||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
_cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
||||||
GError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||||
CoglContext *context = framebuffer->context;
|
CoglContext *context = framebuffer->context;
|
||||||
@ -789,7 +789,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
|||||||
|
|
||||||
if (hwnd == NULL)
|
if (hwnd == NULL)
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
||||||
"Unable to create window");
|
"Unable to create window");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -814,7 +814,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
|
|||||||
|
|
||||||
if (pf == 0 || !SetPixelFormat (wgl_onscreen->client_dc, pf, &pfd))
|
if (pf == 0 || !SetPixelFormat (wgl_onscreen->client_dc, pf, &pfd))
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
COGL_WINSYS_ERROR_CREATE_ONSCREEN,
|
||||||
"Error setting pixel format on the window");
|
"Error setting pixel format on the window");
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#include <gmodule.h>
|
#include <gmodule.h>
|
||||||
|
|
||||||
GQuark
|
uint32_t
|
||||||
_cogl_winsys_error_quark (void)
|
_cogl_winsys_error_quark (void)
|
||||||
{
|
{
|
||||||
return g_quark_from_static_string ("cogl-winsys-error-quark");
|
return g_quark_from_static_string ("cogl-winsys-error-quark");
|
||||||
|
@ -62,6 +62,7 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<xi:include href="xml/cogl-object.xml"/>
|
<xi:include href="xml/cogl-object.xml"/>
|
||||||
|
<xi:include href="xml/cogl-error.xml"/>
|
||||||
<xi:include href="xml/cogl-context.xml"/>
|
<xi:include href="xml/cogl-context.xml"/>
|
||||||
<xi:include href="xml/cogl-poll.xml"/>
|
<xi:include href="xml/cogl-poll.xml"/>
|
||||||
|
|
||||||
|
@ -10,6 +10,16 @@ cogl_object_get_user_data
|
|||||||
cogl_object_set_user_data
|
cogl_object_set_user_data
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
|
<SECTION>
|
||||||
|
<FILE>cogl-error</FILE>
|
||||||
|
<TITLE>Exception handling</TITLE>
|
||||||
|
CoglError
|
||||||
|
cogl_error_matches
|
||||||
|
cogl_error_free
|
||||||
|
cogl_error_copy
|
||||||
|
COGL_GLIB_ERROR
|
||||||
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
<FILE>cogl-renderer</FILE>
|
<FILE>cogl-renderer</FILE>
|
||||||
<TITLE>CoglRenderer: Connect to a backend renderer</TITLE>
|
<TITLE>CoglRenderer: Connect to a backend renderer</TITLE>
|
||||||
@ -691,7 +701,7 @@ cogl_pipeline_add_layer_snippet
|
|||||||
|
|
||||||
<SUBSECTION Private>
|
<SUBSECTION Private>
|
||||||
cogl_blend_string_error_get_type
|
cogl_blend_string_error_get_type
|
||||||
cogl_blend_string_error_quark
|
cogl_blend_string_error_domain
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
|
@ -40,7 +40,7 @@ typedef struct
|
|||||||
static int test_init (TestData* data)
|
static int test_init (TestData* data)
|
||||||
{
|
{
|
||||||
CoglOnscreen *onscreen;
|
CoglOnscreen *onscreen;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
CoglVertexP2C4 triangle_vertices[] = {
|
CoglVertexP2C4 triangle_vertices[] = {
|
||||||
{0, 0.7, 0xff, 0x00, 0x00, 0x80},
|
{0, 0.7, 0xff, 0x00, 0x00, 0x80},
|
||||||
{-0.7, -0.7, 0x00, 0xff, 0x00, 0xff},
|
{-0.7, -0.7, 0x00, 0xff, 0x00, 0xff},
|
||||||
|
@ -144,7 +144,7 @@ main (int argc, char **argv)
|
|||||||
CoglContext *ctx;
|
CoglContext *ctx;
|
||||||
CoglOnscreen *onscreen;
|
CoglOnscreen *onscreen;
|
||||||
CoglFramebuffer *fb;
|
CoglFramebuffer *fb;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
Data data;
|
Data data;
|
||||||
PangoRectangle hello_label_size;
|
PangoRectangle hello_label_size;
|
||||||
float fovy, aspect, z_near, z_2d, z_far;
|
float fovy, aspect, z_near, z_2d, z_far;
|
||||||
|
@ -23,7 +23,7 @@ static gboolean
|
|||||||
paint_cb (void *user_data)
|
paint_cb (void *user_data)
|
||||||
{
|
{
|
||||||
Data *data = user_data;
|
Data *data = user_data;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
const CoglGLES2Vtable *gles2 = data->gles2_vtable;
|
const CoglGLES2Vtable *gles2 = data->gles2_vtable;
|
||||||
|
|
||||||
/* Draw scene with GLES2 */
|
/* Draw scene with GLES2 */
|
||||||
@ -71,7 +71,7 @@ main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
Data data;
|
Data data;
|
||||||
CoglOnscreen *onscreen;
|
CoglOnscreen *onscreen;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
CoglVertexP2C4 triangle_vertices[] = {
|
CoglVertexP2C4 triangle_vertices[] = {
|
||||||
{0, 0.7, 0xff, 0x00, 0x00, 0x80},
|
{0, 0.7, 0xff, 0x00, 0x00, 0x80},
|
||||||
{-0.7, -0.7, 0x00, 0xff, 0x00, 0xff},
|
{-0.7, -0.7, 0x00, 0xff, 0x00, 0xff},
|
||||||
|
@ -560,7 +560,7 @@ paint_cb (void *user_data)
|
|||||||
Data *data = user_data;
|
Data *data = user_data;
|
||||||
double elapsed = g_timer_elapsed (data->timer, NULL);
|
double elapsed = g_timer_elapsed (data->timer, NULL);
|
||||||
double dt = elapsed - data->last_elapsed;
|
double dt = elapsed - data->last_elapsed;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
|
|
||||||
/* Draw scene with GLES2 */
|
/* Draw scene with GLES2 */
|
||||||
if (!cogl_push_gles2_context (data->ctx,
|
if (!cogl_push_gles2_context (data->ctx,
|
||||||
@ -755,7 +755,7 @@ main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
Data data;
|
Data data;
|
||||||
CoglOnscreen *onscreen;
|
CoglOnscreen *onscreen;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
GSource *cogl_source;
|
GSource *cogl_source;
|
||||||
GMainLoop *loop;
|
GMainLoop *loop;
|
||||||
CoglRenderer *renderer;
|
CoglRenderer *renderer;
|
||||||
|
@ -40,7 +40,7 @@ main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
Data data;
|
Data data;
|
||||||
CoglOnscreen *onscreen;
|
CoglOnscreen *onscreen;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
CoglVertexP2C4 triangle_vertices[] = {
|
CoglVertexP2C4 triangle_vertices[] = {
|
||||||
{0, 0.7, 0xff, 0x00, 0x00, 0x80},
|
{0, 0.7, 0xff, 0x00, 0x00, 0x80},
|
||||||
{-0.7, -0.7, 0x00, 0xff, 0x00, 0xff},
|
{-0.7, -0.7, 0x00, 0xff, 0x00, 0xff},
|
||||||
|
@ -170,7 +170,7 @@ main (int argc, char **argv)
|
|||||||
CoglRenderer *renderer;
|
CoglRenderer *renderer;
|
||||||
CoglDisplay *display;
|
CoglDisplay *display;
|
||||||
CoglContext *ctx;
|
CoglContext *ctx;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
CoglWinsysID winsys_id;
|
CoglWinsysID winsys_id;
|
||||||
const char *winsys_name;
|
const char *winsys_name;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ main (int argc, char **argv)
|
|||||||
CoglContext *ctx;
|
CoglContext *ctx;
|
||||||
CoglOnscreen *onscreen;
|
CoglOnscreen *onscreen;
|
||||||
CoglFramebuffer *fb;
|
CoglFramebuffer *fb;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
CoglVertexP2C4 triangle_vertices[] = {
|
CoglVertexP2C4 triangle_vertices[] = {
|
||||||
{0, 0.7, 0xff, 0x00, 0x00, 0x80},
|
{0, 0.7, 0xff, 0x00, 0x00, 0x80},
|
||||||
{-0.7, -0.7, 0x00, 0xff, 0x00, 0xff},
|
{-0.7, -0.7, 0x00, 0xff, 0x00, 0xff},
|
||||||
@ -49,7 +49,7 @@ main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
fprintf (stderr, "Failed to allocate 4x msaa offscreen framebuffer, "
|
fprintf (stderr, "Failed to allocate 4x msaa offscreen framebuffer, "
|
||||||
"disabling msaa for onscreen rendering: %s\n", error->message);
|
"disabling msaa for onscreen rendering: %s\n", error->message);
|
||||||
g_error_free (error);
|
cogl_error_free (error);
|
||||||
cogl_framebuffer_set_samples_per_pixel (fb, 0);
|
cogl_framebuffer_set_samples_per_pixel (fb, 0);
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
@ -70,7 +70,7 @@ main (int argc, char **argv)
|
|||||||
cogl_framebuffer_set_samples_per_pixel (offscreen_fb, 4);
|
cogl_framebuffer_set_samples_per_pixel (offscreen_fb, 4);
|
||||||
if (!cogl_framebuffer_allocate (offscreen_fb, &error))
|
if (!cogl_framebuffer_allocate (offscreen_fb, &error))
|
||||||
{
|
{
|
||||||
g_error_free (error);
|
cogl_error_free (error);
|
||||||
error = NULL;
|
error = NULL;
|
||||||
fprintf (stderr, "Failed to allocate 4x msaa offscreen framebuffer, "
|
fprintf (stderr, "Failed to allocate 4x msaa offscreen framebuffer, "
|
||||||
"disabling msaa for offscreen rendering");
|
"disabling msaa for offscreen rendering");
|
||||||
|
@ -68,7 +68,7 @@ main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
CoglContext *ctx;
|
CoglContext *ctx;
|
||||||
CoglOnscreen *onscreen;
|
CoglOnscreen *onscreen;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
CoglVertexP2C4 triangle_vertices[] = {
|
CoglVertexP2C4 triangle_vertices[] = {
|
||||||
{0, 0.7, 0xff, 0x00, 0x00, 0x80},
|
{0, 0.7, 0xff, 0x00, 0x00, 0x80},
|
||||||
{-0.7, -0.7, 0x00, 0xff, 0x00, 0xff},
|
{-0.7, -0.7, 0x00, 0xff, 0x00, 0xff},
|
||||||
|
@ -77,7 +77,7 @@ main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
CoglContext *ctx;
|
CoglContext *ctx;
|
||||||
CoglOnscreen *onscreen;
|
CoglOnscreen *onscreen;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
CoglVertexP2C4 triangle_vertices[] = {
|
CoglVertexP2C4 triangle_vertices[] = {
|
||||||
{0, 0.7, 0xff, 0x00, 0x00, 0x80},
|
{0, 0.7, 0xff, 0x00, 0x00, 0x80},
|
||||||
{-0.7, -0.7, 0x00, 0xff, 0x00, 0xff},
|
{-0.7, -0.7, 0x00, 0xff, 0x00, 0xff},
|
||||||
|
@ -53,7 +53,7 @@ main (int argc, char **argv)
|
|||||||
CoglOnscreen *onscreen;
|
CoglOnscreen *onscreen;
|
||||||
CoglFramebuffer *fb;
|
CoglFramebuffer *fb;
|
||||||
CoglPipeline *pipeline;
|
CoglPipeline *pipeline;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
uint32_t visual;
|
uint32_t visual;
|
||||||
XVisualInfo template, *xvisinfo;
|
XVisualInfo template, *xvisinfo;
|
||||||
int visinfos_count;
|
int visinfos_count;
|
||||||
|
@ -49,7 +49,7 @@ main (int argc, char **argv)
|
|||||||
CoglContext *ctx;
|
CoglContext *ctx;
|
||||||
CoglOnscreen *onscreen;
|
CoglOnscreen *onscreen;
|
||||||
CoglFramebuffer *fb;
|
CoglFramebuffer *fb;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
uint32_t visual;
|
uint32_t visual;
|
||||||
XVisualInfo template, *xvisinfo;
|
XVisualInfo template, *xvisinfo;
|
||||||
int visinfos_count;
|
int visinfos_count;
|
||||||
|
@ -299,7 +299,7 @@ cogland_surface_attach_buffer (struct wl_client *wayland_client,
|
|||||||
|
|
||||||
if (!buffer->texture)
|
if (!buffer->texture)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
|
|
||||||
buffer->texture =
|
buffer->texture =
|
||||||
cogl_wayland_texture_2d_new_from_buffer (compositor->cogl_context,
|
cogl_wayland_texture_2d_new_from_buffer (compositor->cogl_context,
|
||||||
@ -453,7 +453,7 @@ cogland_compositor_create_output (CoglandCompositor *compositor,
|
|||||||
{
|
{
|
||||||
CoglandOutput *output = g_slice_new0 (CoglandOutput);
|
CoglandOutput *output = g_slice_new0 (CoglandOutput);
|
||||||
CoglFramebuffer *fb;
|
CoglFramebuffer *fb;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
CoglandMode *mode;
|
CoglandMode *mode;
|
||||||
|
|
||||||
output->x = x;
|
output->x = x;
|
||||||
@ -694,7 +694,7 @@ main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
CoglandCompositor compositor;
|
CoglandCompositor compositor;
|
||||||
GMainLoop *loop;
|
GMainLoop *loop;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
CoglVertexP2C4 triangle_vertices[] = {
|
CoglVertexP2C4 triangle_vertices[] = {
|
||||||
{0, 0.7, 0xff, 0x00, 0x00, 0x80},
|
{0, 0.7, 0xff, 0x00, 0x00, 0x80},
|
||||||
{-0.7, -0.7, 0x00, 0xff, 0x00, 0xff},
|
{-0.7, -0.7, 0x00, 0xff, 0x00, 0xff},
|
||||||
|
@ -55,7 +55,7 @@ test_blend (TestState *state,
|
|||||||
CoglHandle material;
|
CoglHandle material;
|
||||||
CoglPipeline *pipeline;
|
CoglPipeline *pipeline;
|
||||||
CoglBool status;
|
CoglBool status;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
int y_off;
|
int y_off;
|
||||||
int x_off;
|
int x_off;
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ test_tex_combine (TestState *state,
|
|||||||
|
|
||||||
CoglHandle material;
|
CoglHandle material;
|
||||||
CoglBool status;
|
CoglBool status;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
int y_off;
|
int y_off;
|
||||||
int x_off;
|
int x_off;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ test_push_pop_single_context (void)
|
|||||||
CoglPipeline *pipeline;
|
CoglPipeline *pipeline;
|
||||||
CoglGLES2Context *gles2_ctx;
|
CoglGLES2Context *gles2_ctx;
|
||||||
const CoglGLES2Vtable *gles2;
|
const CoglGLES2Vtable *gles2;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
|
|
||||||
offscreen_texture = COGL_TEXTURE (
|
offscreen_texture = COGL_TEXTURE (
|
||||||
cogl_texture_2d_new_with_size (ctx,
|
cogl_texture_2d_new_with_size (ctx,
|
||||||
@ -146,7 +146,7 @@ create_gles2_context (CoglTexture **offscreen_texture,
|
|||||||
CoglGLES2Context **gles2_ctx,
|
CoglGLES2Context **gles2_ctx,
|
||||||
const CoglGLES2Vtable **gles2)
|
const CoglGLES2Vtable **gles2)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
|
|
||||||
*offscreen_texture = COGL_TEXTURE (
|
*offscreen_texture = COGL_TEXTURE (
|
||||||
cogl_texture_2d_new_with_size (ctx,
|
cogl_texture_2d_new_with_size (ctx,
|
||||||
@ -179,7 +179,7 @@ test_push_pop_multi_context (void)
|
|||||||
CoglPipeline *pipeline1;
|
CoglPipeline *pipeline1;
|
||||||
CoglGLES2Context *gles2_ctx1;
|
CoglGLES2Context *gles2_ctx1;
|
||||||
const CoglGLES2Vtable *gles21;
|
const CoglGLES2Vtable *gles21;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
|
|
||||||
create_gles2_context (&offscreen_texture0,
|
create_gles2_context (&offscreen_texture0,
|
||||||
&offscreen0,
|
&offscreen0,
|
||||||
@ -278,7 +278,7 @@ test_gles2_read_pixels (void)
|
|||||||
CoglPipeline *pipeline;
|
CoglPipeline *pipeline;
|
||||||
CoglGLES2Context *gles2_ctx;
|
CoglGLES2Context *gles2_ctx;
|
||||||
const CoglGLES2Vtable *gles2;
|
const CoglGLES2Vtable *gles2;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
GLubyte pixel[3];
|
GLubyte pixel[3];
|
||||||
GLuint fbo_handle;
|
GLuint fbo_handle;
|
||||||
|
|
||||||
@ -684,7 +684,7 @@ test_gles2_context_fbo (void)
|
|||||||
CoglPipeline *pipeline;
|
CoglPipeline *pipeline;
|
||||||
CoglGLES2Context *gles2_ctx;
|
CoglGLES2Context *gles2_ctx;
|
||||||
GLuint program;
|
GLuint program;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
|
|
||||||
create_gles2_context (&offscreen_texture,
|
create_gles2_context (&offscreen_texture,
|
||||||
&offscreen,
|
&offscreen,
|
||||||
@ -814,7 +814,7 @@ test_gles2_context_copy_tex_image (void)
|
|||||||
CoglPipeline *pipeline;
|
CoglPipeline *pipeline;
|
||||||
CoglGLES2Context *gles2_ctx;
|
CoglGLES2Context *gles2_ctx;
|
||||||
const CoglGLES2Vtable *gles2;
|
const CoglGLES2Vtable *gles2;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
GLuint tex;
|
GLuint tex;
|
||||||
GLint tex_uniform_location;
|
GLint tex_uniform_location;
|
||||||
GLint pos_location;
|
GLint pos_location;
|
||||||
|
@ -30,7 +30,7 @@ paint_legacy (TestState *state)
|
|||||||
CoglHandle material = cogl_material_new ();
|
CoglHandle material = cogl_material_new ();
|
||||||
CoglTexture *tex;
|
CoglTexture *tex;
|
||||||
CoglColor color;
|
CoglColor color;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
CoglHandle shader, program;
|
CoglHandle shader, program;
|
||||||
|
|
||||||
cogl_color_init_from_4ub (&color, 0, 0, 0, 255);
|
cogl_color_init_from_4ub (&color, 0, 0, 0, 255);
|
||||||
@ -100,7 +100,7 @@ paint (TestState *state)
|
|||||||
CoglPipeline *pipeline = cogl_pipeline_new (ctx);
|
CoglPipeline *pipeline = cogl_pipeline_new (ctx);
|
||||||
CoglTexture *tex;
|
CoglTexture *tex;
|
||||||
CoglColor color;
|
CoglColor color;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
CoglHandle shader, program;
|
CoglHandle shader, program;
|
||||||
|
|
||||||
cogl_color_init_from_4ub (&color, 0, 0, 0, 255);
|
cogl_color_init_from_4ub (&color, 0, 0, 0, 255);
|
||||||
|
@ -104,7 +104,7 @@ on_paint (ClutterActor *actor, TestState *state)
|
|||||||
CoglHandle tex0, tex1;
|
CoglHandle tex0, tex1;
|
||||||
CoglHandle material;
|
CoglHandle material;
|
||||||
CoglBool status;
|
CoglBool status;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
float tex_coords[] = {
|
float tex_coords[] = {
|
||||||
0, 0, 0.5, 0.5, /* tex0 */
|
0, 0, 0.5, 0.5, /* tex0 */
|
||||||
0.5, 0.5, 1, 1 /* tex1 */
|
0.5, 0.5, 1, 1 /* tex1 */
|
||||||
|
@ -54,7 +54,7 @@ paint (TestState *state)
|
|||||||
CoglTexture *tex0, *tex1;
|
CoglTexture *tex0, *tex1;
|
||||||
CoglPipeline *pipeline;
|
CoglPipeline *pipeline;
|
||||||
CoglMatrix matrix;
|
CoglMatrix matrix;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
|
|
||||||
cogl_framebuffer_orthographic (fb,
|
cogl_framebuffer_orthographic (fb,
|
||||||
0, 0,
|
0, 0,
|
||||||
|
@ -24,7 +24,7 @@ do_test (CoglBool check_orientation)
|
|||||||
int fb_width = cogl_framebuffer_get_width (fb);
|
int fb_width = cogl_framebuffer_get_width (fb);
|
||||||
int fb_height = cogl_framebuffer_get_height (fb);
|
int fb_height = cogl_framebuffer_get_height (fb);
|
||||||
CoglPrimitive *prim;
|
CoglPrimitive *prim;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
CoglTexture2D *tex_2d;
|
CoglTexture2D *tex_2d;
|
||||||
CoglPipeline *pipeline, *solid_pipeline;
|
CoglPipeline *pipeline, *solid_pipeline;
|
||||||
CoglBool res;
|
CoglBool res;
|
||||||
|
@ -31,7 +31,6 @@ create_source (TestState *state)
|
|||||||
int dx, dy;
|
int dx, dy;
|
||||||
uint8_t *data = g_malloc (SOURCE_SIZE * SOURCE_SIZE * 4);
|
uint8_t *data = g_malloc (SOURCE_SIZE * SOURCE_SIZE * 4);
|
||||||
CoglTexture2D *tex;
|
CoglTexture2D *tex;
|
||||||
GError *error = NULL;
|
|
||||||
|
|
||||||
/* Create a texture with a different coloured rectangle at each
|
/* Create a texture with a different coloured rectangle at each
|
||||||
corner */
|
corner */
|
||||||
@ -61,8 +60,7 @@ create_source (TestState *state)
|
|||||||
COGL_PIXEL_FORMAT_ANY,
|
COGL_PIXEL_FORMAT_ANY,
|
||||||
SOURCE_SIZE * 4,
|
SOURCE_SIZE * 4,
|
||||||
data,
|
data,
|
||||||
&error);
|
NULL);
|
||||||
g_assert_no_error (error);
|
|
||||||
return tex;
|
return tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +70,6 @@ create_test_texture (TestState *state)
|
|||||||
CoglTexture2D *tex;
|
CoglTexture2D *tex;
|
||||||
uint8_t *data = g_malloc (256 * 256 * 4), *p = data;
|
uint8_t *data = g_malloc (256 * 256 * 4), *p = data;
|
||||||
int x, y;
|
int x, y;
|
||||||
GError *error = NULL;
|
|
||||||
|
|
||||||
/* Create a texture that is 256x256 where the red component ranges
|
/* Create a texture that is 256x256 where the red component ranges
|
||||||
from 0->255 along the x axis and the green component ranges from
|
from 0->255 along the x axis and the green component ranges from
|
||||||
@ -93,9 +90,7 @@ create_test_texture (TestState *state)
|
|||||||
COGL_PIXEL_FORMAT_ANY,
|
COGL_PIXEL_FORMAT_ANY,
|
||||||
256 * 4,
|
256 * 4,
|
||||||
data,
|
data,
|
||||||
&error);
|
NULL);
|
||||||
g_assert_no_error (error);
|
|
||||||
|
|
||||||
g_free (data);
|
g_free (data);
|
||||||
|
|
||||||
return tex;
|
return tex;
|
||||||
|
@ -24,7 +24,7 @@ create_texture_3d (CoglContext *context)
|
|||||||
uint8_t *data = g_malloc (TEX_IMAGE_STRIDE * TEX_DEPTH);
|
uint8_t *data = g_malloc (TEX_IMAGE_STRIDE * TEX_DEPTH);
|
||||||
uint8_t *p = data;
|
uint8_t *p = data;
|
||||||
CoglTexture3D *tex;
|
CoglTexture3D *tex;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
|
|
||||||
for (z = 0; z < TEX_DEPTH; z++)
|
for (z = 0; z < TEX_DEPTH; z++)
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,7 @@ void
|
|||||||
test_utils_init (TestFlags flags)
|
test_utils_init (TestFlags flags)
|
||||||
{
|
{
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
GError *error = NULL;
|
CoglError *error = NULL;
|
||||||
CoglOnscreen *onscreen = NULL;
|
CoglOnscreen *onscreen = NULL;
|
||||||
CoglDisplay *display;
|
CoglDisplay *display;
|
||||||
CoglRenderer *renderer;
|
CoglRenderer *renderer;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user