1 /* cairo - a vector graphics library with display and print output
3 * Copyright © 2010 Linaro Limited
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.
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
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/
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.
29 * Alexandros Frantzis <alexandros.frantzis@linaro.org>
32 #ifndef CAIRO_GL_DISPATCH_PRIVATE_H
33 #define CAIRO_GL_DISPATCH_PRIVATE_H
35 #include "cairo-gl-private.h"
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;
45 typedef struct _cairo_gl_dispatch_entry {
46 const char *name[CAIRO_GL_DISPATCH_NAME_COUNT];
48 } cairo_gl_dispatch_entry_t;
50 #define DISPATCH_ENTRY_CORE(name) { { "gl"#name, "gl"#name"", "gl"#name }, \
51 offsetof(cairo_gl_dispatch_t, name) }
53 #define DISPATCH_ENTRY_ARB(name) { { "gl"#name, "gl"#name"ARB", "gl"#name }, \
54 offsetof(cairo_gl_dispatch_t, name) }
55 #define DISPATCH_ENTRY_EXT(name) { { "gl"#name, "gl"#name"EXT", "gl"#name }, \
56 offsetof(cairo_gl_dispatch_t, name) }
57 #define DISPATCH_ENTRY_ARB_OES(name) { { "gl"#name, "gl"#name"ARB", "gl"#name"OES" }, \
58 offsetof(cairo_gl_dispatch_t, name) }
59 #define DISPATCH_ENTRY_ES_ANGLE_EXT_IMG(name) { { "gl"#name"ANGLE", "gl"#name"EXT", "gl"#name"IMG" }, \
60 offsetof(cairo_gl_dispatch_t, name) }
61 #define DISPATCH_ENTRY_ANGLE_IMG(name) { { "gl"#name, "gl"#name"ANGLE", "gl"#name"IMG" }, \
62 offsetof(cairo_gl_dispatch_t, name) }
63 #define DISPATCH_ENTRY_EXT_IMG(name) { { "gl"#name, "gl"#name"EXT", "gl"#name"IMG" }, \
64 offsetof(cairo_gl_dispatch_t, name) }
65 #define DISPATCH_ENTRY_CUSTOM(name, name2) { { "gl"#name, "gl"#name2, "gl"#name }, \
66 offsetof(cairo_gl_dispatch_t, name)}
67 #define DISPATCH_ENTRY_EXT_ANGLE(name) { { "gl"#name, "gl"#name"EXT", "gl"#name"ANGLE" }, \
68 offsetof(cairo_gl_dispatch_t, name) }
69 #define DISPATCH_ENTRY_LAST { { NULL, NULL, NULL }, 0 }
71 cairo_private cairo_gl_dispatch_entry_t dispatch_core_entries[] = {
72 DISPATCH_ENTRY_CORE (ActiveTexture),
73 DISPATCH_ENTRY_CORE (BindTexture),
74 DISPATCH_ENTRY_CORE (BlendFunc),
75 DISPATCH_ENTRY_CORE (BlendFuncSeparate),
76 DISPATCH_ENTRY_CORE (Clear),
77 DISPATCH_ENTRY_CORE (ClearColor),
78 DISPATCH_ENTRY_CORE (ClearStencil),
79 DISPATCH_ENTRY_CORE (ColorMask),
80 DISPATCH_ENTRY_CORE (DeleteTextures),
81 DISPATCH_ENTRY_CORE (Disable),
82 DISPATCH_ENTRY_CORE (DrawArrays),
83 DISPATCH_ENTRY_CORE (DrawElements),
84 DISPATCH_ENTRY_CORE (Enable),
85 DISPATCH_ENTRY_CORE (Flush),
86 DISPATCH_ENTRY_CORE (GenTextures),
87 DISPATCH_ENTRY_CORE (GetBooleanv),
88 DISPATCH_ENTRY_CORE (GetError),
89 DISPATCH_ENTRY_CORE (GetFloatv),
90 DISPATCH_ENTRY_CORE (GetIntegerv),
91 DISPATCH_ENTRY_CORE (GetString),
92 DISPATCH_ENTRY_CORE (PixelStorei),
93 DISPATCH_ENTRY_CORE (ReadPixels),
94 DISPATCH_ENTRY_CORE (Scissor),
95 DISPATCH_ENTRY_CORE (StencilFunc),
96 DISPATCH_ENTRY_CORE (StencilMask),
97 DISPATCH_ENTRY_CORE (StencilOp),
98 DISPATCH_ENTRY_CORE (TexSubImage2D),
99 DISPATCH_ENTRY_CORE (TexImage2D),
100 DISPATCH_ENTRY_CORE (TexParameteri),
101 #if defined(CAIRO_HAS_GL_SURFACE) || defined(CAIRO_HAS_EVASGL_SURFACE)
102 DISPATCH_ENTRY_CORE (DrawBuffer),
103 DISPATCH_ENTRY_CORE (ReadBuffer),
105 DISPATCH_ENTRY_CORE (DepthMask),
106 DISPATCH_ENTRY_CORE (Viewport),
110 cairo_private cairo_gl_dispatch_entry_t dispatch_buffers_entries[] = {
111 DISPATCH_ENTRY_ARB (GenBuffers),
112 DISPATCH_ENTRY_ARB (BindBuffer),
113 DISPATCH_ENTRY_ARB (BufferData),
114 DISPATCH_ENTRY_ARB_OES (MapBuffer),
115 DISPATCH_ENTRY_ARB_OES (UnmapBuffer),
119 cairo_private cairo_gl_dispatch_entry_t dispatch_shaders_entries[] = {
121 DISPATCH_ENTRY_CUSTOM (CreateShader, CreateShaderObjectARB),
122 DISPATCH_ENTRY_ARB (ShaderSource),
123 DISPATCH_ENTRY_ARB (CompileShader),
124 DISPATCH_ENTRY_CUSTOM (GetShaderiv, GetObjectParameterivARB),
125 DISPATCH_ENTRY_CUSTOM (GetShaderInfoLog, GetInfoLogARB),
126 DISPATCH_ENTRY_CUSTOM (DeleteShader, DeleteObjectARB),
129 DISPATCH_ENTRY_CUSTOM (CreateProgram, CreateProgramObjectARB),
130 DISPATCH_ENTRY_CUSTOM (AttachShader, AttachObjectARB),
131 DISPATCH_ENTRY_CUSTOM (DeleteProgram, DeleteObjectARB),
132 DISPATCH_ENTRY_ARB (LinkProgram),
133 DISPATCH_ENTRY_CUSTOM (UseProgram, UseProgramObjectARB),
134 DISPATCH_ENTRY_CUSTOM (GetProgramiv, GetObjectParameterivARB),
135 DISPATCH_ENTRY_CUSTOM (GetProgramInfoLog, GetInfoLogARB),
138 DISPATCH_ENTRY_ARB (GetUniformLocation),
139 DISPATCH_ENTRY_ARB (Uniform1f),
140 DISPATCH_ENTRY_ARB (Uniform2f),
141 DISPATCH_ENTRY_ARB (Uniform3f),
142 DISPATCH_ENTRY_ARB (Uniform4f),
143 DISPATCH_ENTRY_ARB (Uniform1fv),
144 DISPATCH_ENTRY_ARB (UniformMatrix3fv),
145 DISPATCH_ENTRY_ARB (UniformMatrix4fv),
146 DISPATCH_ENTRY_ARB (Uniform1i),
149 DISPATCH_ENTRY_ARB (BindAttribLocation),
150 DISPATCH_ENTRY_ARB (VertexAttribPointer),
151 DISPATCH_ENTRY_ARB (EnableVertexAttribArray),
152 DISPATCH_ENTRY_ARB (DisableVertexAttribArray),
157 cairo_private cairo_gl_dispatch_entry_t dispatch_fbo_entries[] = {
158 DISPATCH_ENTRY_EXT (GenFramebuffers),
159 DISPATCH_ENTRY_EXT (BindFramebuffer),
160 DISPATCH_ENTRY_EXT (FramebufferTexture2D),
161 DISPATCH_ENTRY_EXT (CheckFramebufferStatus),
162 DISPATCH_ENTRY_EXT (DeleteFramebuffers),
163 DISPATCH_ENTRY_EXT (GenRenderbuffers),
164 DISPATCH_ENTRY_EXT (BindRenderbuffer),
165 DISPATCH_ENTRY_EXT (RenderbufferStorage),
166 DISPATCH_ENTRY_EXT (FramebufferRenderbuffer),
167 DISPATCH_ENTRY_EXT (DeleteRenderbuffers),
171 cairo_private cairo_gl_dispatch_entry_t dispatch_multisampling_entries[] = {
172 #if CAIRO_HAS_GLESV2_SURFACE
173 DISPATCH_ENTRY_ES_ANGLE_EXT_IMG (BlitFramebuffer),
174 DISPATCH_ENTRY_ES_ANGLE_EXT_IMG (RenderbufferStorageMultisample),
175 DISPATCH_ENTRY_ES_ANGLE_EXT_IMG (FramebufferTexture2DMultisample),
176 #elif CAIRO_HAS_EVASGL_SURFACE
177 DISPATCH_ENTRY_ES_ANGLE_EXT_IMG (BlitFramebuffer),
178 DISPATCH_ENTRY_ES_ANGLE_EXT_IMG (RenderbufferStorageMultisample),
179 DISPATCH_ENTRY_ES_ANGLE_EXT_IMG (FramebufferTexture2DMultisample),
181 DISPATCH_ENTRY_EXT_IMG (BlitFramebuffer),
182 DISPATCH_ENTRY_EXT_IMG (RenderbufferStorageMultisample),
183 DISPATCH_ENTRY_EXT_IMG (FramebufferTexture2DMultisample),
185 DISPATCH_ENTRY_EXT_IMG (BlitFramebuffer),
186 DISPATCH_ENTRY_EXT_IMG (RenderbufferStorageMultisample),
187 DISPATCH_ENTRY_EXT_IMG (FramebufferTexture2DMultisample),
192 #endif /* CAIRO_GL_DISPATCH_PRIVATE_H */