summaryrefslogtreecommitdiff
path: root/include/yagl_types.h
blob: 58cc4e61f23deb321386a366c639871bd872f28d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
 * YaGL
 *
 * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Contact :
 * Stanislav Vorobiov <s.vorobiov@samsung.com>
 * Jinhyung Jo <jinhyung.jo@samsung.com>
 * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * Contributors:
 * - S-Core Co., Ltd
 *
 */

#ifndef _YAGL_TYPES_H_
#define _YAGL_TYPES_H_

#include <stdint.h>
#include <stddef.h>
#include <inttypes.h>

#if defined(__i386) || defined(_M_IX86)
#define YAGL_LITTLE_ENDIAN
#elif defined(__x86_64) || defined(_M_X64) || defined(_M_IA64)
#define YAGL_LITTLE_ENDIAN
#elif defined(__arm__)
#define YAGL_LITTLE_ENDIAN
#else
#error Unknown architecture
#endif

#if defined(__x86_64) || defined(_M_X64) || defined(_M_IA64) || defined(__LP64__)
#define YAGL_64
#else
#define YAGL_32
#endif

#if !defined(YAGL_64) && !defined(YAGL_32)
#error 32 or 64 bit mode must be set
#endif

typedef enum
{
    yagl_render_type_offscreen = 1,
    yagl_render_type_onscreen = 2,
} yagl_render_type;

typedef enum
{
    yagl_api_id_egl = 1,
    yagl_api_id_gles = 2,
} yagl_api_id;

typedef enum
{
    yagl_client_api_ogl = (1 << 0),
    yagl_client_api_gles1 = (1 << 1),
    yagl_client_api_gles2 = (1 << 2),
    yagl_client_api_gles3 = (1 << 3),
    yagl_client_api_ovg = (1 << 4)
} yagl_client_api;

typedef enum
{
    /* OpenGL 2.1 or OpenGL >= 3.1 compatibility. */
    yagl_gl_2 = 0,
    /* OpenGL >= 3.1 core. */
    yagl_gl_3_1 = 1,
    /* OpenGL >= 3.1 core, GL_ARB_ES3_compatibility support. */
    yagl_gl_3_1_es3 = 2,
    /* OpenGL >= 3.2 core, no GL_ARB_ES3_compatibility support. */
    yagl_gl_3_2 = 3
} yagl_gl_version;

typedef uint32_t yagl_host_handle;
typedef uint32_t yagl_winsys_id;
typedef uint32_t yagl_object_name;

#define yagl_offsetof(type, member) ((size_t)&((type*)0)->member)

#define yagl_containerof(ptr, type, member) ((type*)((char*)(ptr) - yagl_offsetof(type, member)))

#ifndef INT2VOIDP
#define INT2VOIDP(i) ((void*)((uintptr_t)(i)))
#endif
#ifndef VOIDP2INT
#define VOIDP2INT(p) ((uintptr_t)(p))
#endif


#endif