~elementary-os/ubuntu-package-imports/mutter-bionic

« back to all changes in this revision

Viewing changes to cogl/cogl/driver/gl/cogl-util-gl-private.h

  • Committer: RabbitBot
  • Date: 2018-04-11 14:49:36 UTC
  • Revision ID: rabbitbot@elementary.io-20180411144936-hgymqa9d8d1xfpbh
Initial import, version 3.28.0-2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Cogl
 
3
 *
 
4
 * A Low Level GPU Graphics and Utilities API
 
5
 *
 
6
 * Copyright (C) 2012, 2013 Intel Corporation.
 
7
 *
 
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:
 
15
 *
 
16
 * The above copyright notice and this permission notice shall be
 
17
 * included in all copies or substantial portions of the Software.
 
18
 *
 
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
 
26
 * SOFTWARE.
 
27
 *
 
28
 *
 
29
 * Authors:
 
30
 *  Robert Bragg   <robert@linux.intel.com>
 
31
 */
 
32
 
 
33
#ifndef _COGL_UTIL_GL_PRIVATE_H_
 
34
 
 
35
#include "cogl-types.h"
 
36
#include "cogl-context.h"
 
37
#include "cogl-gl-header.h"
 
38
#include "cogl-texture.h"
 
39
 
 
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
 
43
#endif
 
44
 
 
45
#ifdef COGL_GL_DEBUG
 
46
 
 
47
const char *
 
48
_cogl_gl_error_to_string (GLenum error_code);
 
49
 
 
50
#define GE(ctx, x)                      G_STMT_START {  \
 
51
  GLenum __err;                                         \
 
52
  (ctx)->x;                                             \
 
53
  while ((__err = (ctx)->glGetError ()) != GL_NO_ERROR && __err != GL_CONTEXT_LOST) \
 
54
    {                                                   \
 
55
      g_warning ("%s: GL error (%d): %s\n",             \
 
56
                 G_STRLOC,                              \
 
57
                 __err,                                 \
 
58
                 _cogl_gl_error_to_string (__err));     \
 
59
    }                                   } G_STMT_END
 
60
 
 
61
#define GE_RET(ret, ctx, x)             G_STMT_START {  \
 
62
  GLenum __err;                                         \
 
63
  ret = (ctx)->x;                                       \
 
64
  while ((__err = (ctx)->glGetError ()) != GL_NO_ERROR && __err != GL_CONTEXT_LOST) \
 
65
    {                                                   \
 
66
      g_warning ("%s: GL error (%d): %s\n",             \
 
67
                 G_STRLOC,                              \
 
68
                 __err,                                 \
 
69
                 _cogl_gl_error_to_string (__err));     \
 
70
    }                                   } G_STMT_END
 
71
 
 
72
#else /* !COGL_GL_DEBUG */
 
73
 
 
74
#define GE(ctx, x) ((ctx)->x)
 
75
#define GE_RET(ret, ctx, x) (ret = ((ctx)->x))
 
76
 
 
77
#endif /* COGL_GL_DEBUG */
 
78
 
 
79
GLenum
 
80
_cogl_gl_util_get_error (CoglContext *ctx);
 
81
 
 
82
void
 
83
_cogl_gl_util_clear_gl_errors (CoglContext *ctx);
 
84
 
 
85
CoglBool
 
86
_cogl_gl_util_catch_out_of_memory (CoglContext *ctx, CoglError **error);
 
87
 
 
88
void
 
89
_cogl_gl_util_get_texture_target_string (CoglTextureType texture_type,
 
90
                                         const char **target_string_out,
 
91
                                         const char **swizzle_out);
 
92
 
 
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. */
 
99
CoglBool
 
100
_cogl_gl_util_parse_gl_version (const char *version_string,
 
101
                                int *major_out,
 
102
                                int *minor_out);
 
103
 
 
104
#endif /* _COGL_UTIL_GL_PRIVATE_H_ */