0c5dc390044176fcbb5d7b15005800be1be89f5f
[framework/graphics/cairo.git] / src / cairo-gl-dispatch-private.h
1 /* cairo - a vector graphics library with display and print output
2  *
3  * Copyright © 2010 Linaro Limited
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it either under the terms of the GNU Lesser General Public
7  * License version 2.1 as published by the Free Software Foundation
8  * (the "LGPL") or, at your option, under the terms of the Mozilla
9  * Public License Version 1.1 (the "MPL"). If you do not alter this
10  * notice, a recipient may use your version of this file under either
11  * the MPL or the LGPL.
12  *
13  * You should have received a copy of the LGPL along with this library
14  * in the file COPYING-LGPL-2.1; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
16  * You should have received a copy of the MPL along with this library
17  * in the file COPYING-MPL-1.1
18  *
19  * The contents of this file are subject to the Mozilla Public License
20  * Version 1.1 (the "License"); you may not use this file except in
21  * compliance with the License. You may obtain a copy of the License at
22  * http://www.mozilla.org/MPL/
23  *
24  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
25  * OF ANY KIND, either express or implied. See the LGPL or the MPL for
26  * the specific language governing rights and limitations.
27  *
28  * Contributor(s):
29  *      Alexandros Frantzis <alexandros.frantzis@linaro.org>
30  */
31
32 #ifndef CAIRO_GL_DISPATCH_PRIVATE_H
33 #define CAIRO_GL_DISPATCH_PRIVATE_H
34
35 #include "cairo-gl-private.h"
36 #include <stddef.h>
37
38 typedef enum _cairo_gl_dispatch_name {
39     CAIRO_GL_DISPATCH_NAME_CORE,
40     CAIRO_GL_DISPATCH_NAME_EXT,
41     CAIRO_GL_DISPATCH_NAME_ES,
42     CAIRO_GL_DISPATCH_NAME_COUNT
43 } cairo_gl_dispatch_name_t;
44
45 typedef struct _cairo_gl_dispatch_entry {
46     const char *name[CAIRO_GL_DISPATCH_NAME_COUNT];
47     size_t offset;
48 } cairo_gl_dispatch_entry_t;
49
50 #define DISPATCH_ENTRY_ARB(name) { { "gl"#name, "gl"#name"ARB", "gl"#name }, \
51                                    offsetof(cairo_gl_dispatch_t, name) }
52 #define DISPATCH_ENTRY_EXT(name) { { "gl"#name, "gl"#name"EXT", "gl"#name }, \
53                                    offsetof(cairo_gl_dispatch_t, name) }
54 #define DISPATCH_ENTRY_ARB_OES(name) { { "gl"#name, "gl"#name"ARB", "gl"#name"OES" }, \
55                                        offsetof(cairo_gl_dispatch_t, name) }
56 #define DISPATCH_ENTRY_EXT_EXT(name) { { "gl"#name, "gl"#name"EXT", "gl"#name"EXT" }, \
57                                        offsetof(cairo_gl_dispatch_t, name) }
58 #define DISPATCH_ENTRY_CUSTOM(name, name2) { { "gl"#name, "gl"#name2, "gl"#name }, \
59                                              offsetof(cairo_gl_dispatch_t, name)}
60 #define DISPATCH_ENTRY_LAST { { NULL, NULL, NULL }, 0 }
61
62 cairo_private cairo_gl_dispatch_entry_t dispatch_buffers_entries[] = {
63     DISPATCH_ENTRY_ARB     (GenBuffers),
64     DISPATCH_ENTRY_ARB     (BindBuffer),
65     DISPATCH_ENTRY_ARB     (BufferData),
66     DISPATCH_ENTRY_ARB_OES (MapBuffer),
67     DISPATCH_ENTRY_ARB_OES (UnmapBuffer),
68     DISPATCH_ENTRY_LAST
69 };
70
71 cairo_private cairo_gl_dispatch_entry_t dispatch_shaders_entries[] = {
72     /* Shaders */
73     DISPATCH_ENTRY_CUSTOM (CreateShader, CreateShaderObjectARB),
74     DISPATCH_ENTRY_ARB    (ShaderSource),
75     DISPATCH_ENTRY_ARB    (CompileShader),
76     DISPATCH_ENTRY_CUSTOM (GetShaderiv, GetObjectParameterivARB),
77     DISPATCH_ENTRY_CUSTOM (GetShaderInfoLog, GetInfoLogARB),
78     DISPATCH_ENTRY_CUSTOM (DeleteShader, DeleteObjectARB),
79
80     /* Programs */
81     DISPATCH_ENTRY_CUSTOM (CreateProgram, CreateProgramObjectARB),
82     DISPATCH_ENTRY_CUSTOM (AttachShader, AttachObjectARB),
83     DISPATCH_ENTRY_CUSTOM (DeleteProgram, DeleteObjectARB),
84     DISPATCH_ENTRY_ARB    (LinkProgram),
85     DISPATCH_ENTRY_CUSTOM (UseProgram, UseProgramObjectARB),
86     DISPATCH_ENTRY_CUSTOM (GetProgramiv, GetObjectParameterivARB),
87     DISPATCH_ENTRY_CUSTOM (GetProgramInfoLog, GetInfoLogARB),
88
89     /* Uniforms */
90     DISPATCH_ENTRY_ARB (GetUniformLocation),
91     DISPATCH_ENTRY_ARB (Uniform1f),
92     DISPATCH_ENTRY_ARB (Uniform2f),
93     DISPATCH_ENTRY_ARB (Uniform3f),
94     DISPATCH_ENTRY_ARB (Uniform4f),
95     DISPATCH_ENTRY_ARB (UniformMatrix3fv),
96     DISPATCH_ENTRY_ARB (UniformMatrix4fv),
97     DISPATCH_ENTRY_ARB (Uniform1i),
98
99     /* Attributes */
100     DISPATCH_ENTRY_ARB (BindAttribLocation),
101     DISPATCH_ENTRY_ARB (VertexAttribPointer),
102     DISPATCH_ENTRY_ARB (EnableVertexAttribArray),
103     DISPATCH_ENTRY_ARB (DisableVertexAttribArray),
104
105     DISPATCH_ENTRY_LAST
106 };
107
108 cairo_private cairo_gl_dispatch_entry_t dispatch_fbo_entries[] = {
109     DISPATCH_ENTRY_EXT (GenFramebuffers),
110     DISPATCH_ENTRY_EXT (BindFramebuffer),
111     DISPATCH_ENTRY_EXT (FramebufferTexture2D),
112     DISPATCH_ENTRY_EXT (CheckFramebufferStatus),
113     DISPATCH_ENTRY_EXT (DeleteFramebuffers),
114     DISPATCH_ENTRY_EXT (GenRenderbuffers),
115     DISPATCH_ENTRY_EXT (BindRenderbuffer),
116     DISPATCH_ENTRY_EXT (RenderbufferStorage),
117     DISPATCH_ENTRY_EXT (FramebufferRenderbuffer),
118     DISPATCH_ENTRY_EXT (DeleteRenderbuffers),
119     DISPATCH_ENTRY_EXT (BlitFramebuffer),
120     DISPATCH_ENTRY_EXT_EXT (RenderbufferStorageMultisample),
121     DISPATCH_ENTRY_EXT_EXT (FramebufferTexture2DMultisample),
122     DISPATCH_ENTRY_LAST
123 };
124
125 #endif /* CAIRO_GL_DISPATCH_PRIVATE_H */