4
* A Low Level GPU Graphics and Utilities API
6
* Copyright (C) 2012, 2013 Intel Corporation.
8
* Permission is hereby granted, free of charge, to any person
9
* obtaining a copy of this software and associated documentation
10
* files (the "Software"), to deal in the Software without
11
* restriction, including without limitation the rights to use, copy,
12
* modify, merge, publish, distribute, sublicense, and/or sell copies
13
* of the Software, and to permit persons to whom the Software is
14
* furnished to do so, subject to the following conditions:
16
* The above copyright notice and this permission notice shall be
17
* included in all copies or substantial portions of the Software.
19
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
23
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
24
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
* Robert Bragg <robert@linux.intel.com>
33
#ifndef _COGL_UTIL_GL_PRIVATE_H_
35
#include "cogl-types.h"
36
#include "cogl-context.h"
37
#include "cogl-gl-header.h"
38
#include "cogl-texture.h"
40
/* In OpenGL ES context, GL_CONTEXT_LOST has a _KHR prefix */
41
#ifndef GL_CONTEXT_LOST
42
#define GL_CONTEXT_LOST GL_CONTEXT_LOST_KHR
48
_cogl_gl_error_to_string (GLenum error_code);
50
#define GE(ctx, x) G_STMT_START { \
53
while ((__err = (ctx)->glGetError ()) != GL_NO_ERROR && __err != GL_CONTEXT_LOST) \
55
g_warning ("%s: GL error (%d): %s\n", \
58
_cogl_gl_error_to_string (__err)); \
61
#define GE_RET(ret, ctx, x) G_STMT_START { \
64
while ((__err = (ctx)->glGetError ()) != GL_NO_ERROR && __err != GL_CONTEXT_LOST) \
66
g_warning ("%s: GL error (%d): %s\n", \
69
_cogl_gl_error_to_string (__err)); \
72
#else /* !COGL_GL_DEBUG */
74
#define GE(ctx, x) ((ctx)->x)
75
#define GE_RET(ret, ctx, x) (ret = ((ctx)->x))
77
#endif /* COGL_GL_DEBUG */
80
_cogl_gl_util_get_error (CoglContext *ctx);
83
_cogl_gl_util_clear_gl_errors (CoglContext *ctx);
86
_cogl_gl_util_catch_out_of_memory (CoglContext *ctx, CoglError **error);
89
_cogl_gl_util_get_texture_target_string (CoglTextureType texture_type,
90
const char **target_string_out,
91
const char **swizzle_out);
93
/* Parses a GL version number stored in a string. @version_string must
94
* point to the beginning of the version number (ie, it can't point to
95
* the "OpenGL ES" part on GLES). The version number can be followed
96
* by the end of the string, a space or a full stop. Anything else
97
* will be treated as invalid. Returns TRUE and sets major_out and
98
* minor_out if it is succesfully parsed or FALSE otherwise. */
100
_cogl_gl_util_parse_gl_version (const char *version_string,
104
#endif /* _COGL_UTIL_GL_PRIVATE_H_ */