[email protected] | 328ce55f | 2012-04-07 00:33:04 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | c9e2cbbb | 2012-05-12 21:17:27 | [diff] [blame] | 5 | #ifndef UI_GL_GL_BINDINGS_H_ |
6 | #define UI_GL_GL_BINDINGS_H_ | ||||
[email protected] | c9e2cbbb | 2012-05-12 21:17:27 | [diff] [blame] | 7 | |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 8 | // Includes the platform independent and platform dependent GL headers. |
9 | // Only include this in cc files. It pulls in system headers, including | ||||
10 | // the X11 headers on linux, which define all kinds of macros that are | ||||
11 | // liable to cause conflicts. | ||||
12 | |||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 13 | #include <GL/gl.h> |
14 | #include <GL/glext.h> | ||||
[email protected] | b040f9d | 2013-01-19 04:27:00 | [diff] [blame] | 15 | #include <EGL/egl.h> |
16 | #include <EGL/eglext.h> | ||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 17 | |
[email protected] | 218a5a2 | 2010-11-04 19:27:49 | [diff] [blame] | 18 | #include "base/logging.h" |
[email protected] | 06a1a692 | 2013-07-26 11:51:52 | [diff] [blame] | 19 | #include "base/threading/thread_local.h" |
[email protected] | c9e2cbbb | 2012-05-12 21:17:27 | [diff] [blame] | 20 | #include "build/build_config.h" |
21 | #include "ui/gl/gl_export.h" | ||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 22 | |
23 | // The standard OpenGL native extension headers are also included. | ||||
24 | #if defined(OS_WIN) | ||||
25 | #include <GL/wglext.h> | ||||
[email protected] | 2ec8df5 | 2011-05-25 23:44:58 | [diff] [blame] | 26 | #elif defined(OS_MACOSX) |
27 | #include <OpenGL/OpenGL.h> | ||||
28 | #elif defined(USE_X11) | ||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 29 | #include <GL/glx.h> |
30 | #include <GL/glxext.h> | ||||
[email protected] | 31c31b2b | 2011-09-27 18:58:29 | [diff] [blame] | 31 | |
32 | // Undefine some macros defined by X headers. This is why this file should only | ||||
33 | // be included in .cc files. | ||||
34 | #undef Bool | ||||
35 | #undef None | ||||
36 | #undef Status | ||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 37 | #endif |
38 | |||||
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 39 | |
40 | // GLES2 defines not part of Desktop GL | ||||
41 | // Shader Precision-Specified Types | ||||
42 | #define GL_LOW_FLOAT 0x8DF0 | ||||
43 | #define GL_MEDIUM_FLOAT 0x8DF1 | ||||
44 | #define GL_HIGH_FLOAT 0x8DF2 | ||||
45 | #define GL_LOW_INT 0x8DF3 | ||||
46 | #define GL_MEDIUM_INT 0x8DF4 | ||||
47 | #define GL_HIGH_INT 0x8DF5 | ||||
48 | #define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A | ||||
49 | #define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B | ||||
50 | #define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD | ||||
51 | #define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB | ||||
52 | #define GL_MAX_VARYING_VECTORS 0x8DFC | ||||
53 | #define GL_SHADER_BINARY_FORMATS 0x8DF8 | ||||
54 | #define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 | ||||
55 | #define GL_SHADER_COMPILER 0x8DFA | ||||
56 | #define GL_RGB565 0x8D62 | ||||
57 | #define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B | ||||
58 | #define GL_RGB8_OES 0x8051 | ||||
59 | #define GL_RGBA8_OES 0x8058 | ||||
60 | #define GL_HALF_FLOAT_OES 0x8D61 | ||||
61 | |||||
62 | // GL_OES_EGL_image_external | ||||
63 | #define GL_TEXTURE_EXTERNAL_OES 0x8D65 | ||||
64 | #define GL_SAMPLER_EXTERNAL_OES 0x8D66 | ||||
65 | #define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67 | ||||
66 | #define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68 | ||||
67 | |||||
68 | // GL_ANGLE_translated_shader_source | ||||
69 | #define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0 | ||||
70 | |||||
71 | // GL_CHROMIUM_flipy | ||||
72 | #define GL_UNPACK_FLIP_Y_CHROMIUM 0x9240 | ||||
73 | |||||
74 | #define GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM 0x9241 | ||||
75 | #define GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM 0x9242 | ||||
76 | #define GL_UNPACK_COLORSPACE_CONVERSION_CHROMIUM 0x9243 | ||||
[email protected] | 6eda682 | 2014-04-03 23:00:50 | [diff] [blame] | 77 | #define GL_BIND_GENERATES_RESOURCE_CHROMIUM 0x9244 |
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 78 | |
79 | // GL_CHROMIUM_gpu_memory_manager | ||||
80 | #define GL_TEXTURE_POOL_CHROMIUM 0x6000 | ||||
81 | #define GL_TEXTURE_POOL_MANAGED_CHROMIUM 0x6001 | ||||
82 | #define GL_TEXTURE_POOL_UNMANAGED_CHROMIUM 0x6002 | ||||
83 | |||||
84 | // GL_ANGLE_pack_reverse_row_order | ||||
85 | #define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4 | ||||
86 | |||||
87 | // GL_ANGLE_texture_usage | ||||
88 | #define GL_TEXTURE_USAGE_ANGLE 0x93A2 | ||||
89 | #define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3 | ||||
90 | |||||
91 | // GL_EXT_texture_storage | ||||
92 | #define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F | ||||
93 | #define GL_ALPHA8_EXT 0x803C | ||||
94 | #define GL_LUMINANCE8_EXT 0x8040 | ||||
95 | #define GL_LUMINANCE8_ALPHA8_EXT 0x8045 | ||||
96 | #define GL_RGBA32F_EXT 0x8814 | ||||
97 | #define GL_RGB32F_EXT 0x8815 | ||||
98 | #define GL_ALPHA32F_EXT 0x8816 | ||||
99 | #define GL_LUMINANCE32F_EXT 0x8818 | ||||
100 | #define GL_LUMINANCE_ALPHA32F_EXT 0x8819 | ||||
101 | #define GL_RGBA16F_EXT 0x881A | ||||
102 | #define GL_RGB16F_EXT 0x881B | ||||
103 | #define GL_ALPHA16F_EXT 0x881C | ||||
104 | #define GL_LUMINANCE16F_EXT 0x881E | ||||
105 | #define GL_LUMINANCE_ALPHA16F_EXT 0x881F | ||||
106 | #define GL_BGRA8_EXT 0x93A1 | ||||
107 | |||||
108 | // GL_ANGLE_instanced_arrays | ||||
109 | #define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE | ||||
110 | |||||
111 | // GL_EXT_occlusion_query_boolean | ||||
112 | #define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F | ||||
113 | #define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A | ||||
114 | #define GL_CURRENT_QUERY_EXT 0x8865 | ||||
115 | #define GL_QUERY_RESULT_EXT 0x8866 | ||||
116 | #define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867 | ||||
117 | |||||
118 | // GL_CHROMIUM_command_buffer_query | ||||
119 | #define GL_COMMANDS_ISSUED_CHROMIUM 0x84F2 | ||||
120 | |||||
121 | /* GL_CHROMIUM_get_error_query */ | ||||
122 | #define GL_GET_ERROR_QUERY_CHROMIUM 0x84F3 | ||||
123 | |||||
124 | /* GL_CHROMIUM_command_buffer_latency_query */ | ||||
125 | #define GL_LATENCY_QUERY_CHROMIUM 0x84F4 | ||||
126 | |||||
127 | /* GL_CHROMIUM_async_pixel_transfers */ | ||||
[email protected] | 5537605d | 2013-08-27 05:22:31 | [diff] [blame] | 128 | #define GL_ASYNC_PIXEL_UNPACK_COMPLETED_CHROMIUM 0x84F5 |
129 | #define GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM 0x84F6 | ||||
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 130 | |
[email protected] | 6a25ae42 | 2014-04-17 23:48:27 | [diff] [blame] | 131 | // GL_CHROMIUM_sync_query |
132 | #define GL_COMMANDS_COMPLETED_CHROMIUM 0x84F7 | ||||
133 | |||||
reveman | 32115e5 | 2014-10-02 19:01:03 | [diff] [blame] | 134 | // GL_CHROMIUM_gpu_memory_buffer_image |
135 | #define GL_MAP_CHROMIUM 0x78F1 | ||||
136 | #define GL_SCANOUT_CHROMIUM 0x78F2 | ||||
137 | |||||
[email protected] | d286ebbc | 2014-07-03 17:19:10 | [diff] [blame] | 138 | // GL_CHROMIUM_schedule_overlay_plane |
139 | #define GL_OVERLAY_TRANSFORM_NONE_CHROMIUM 0x9245 | ||||
140 | #define GL_OVERLAY_TRANSFORM_FLIP_HORIZONTAL_CHROMIUM 0x9246 | ||||
141 | #define GL_OVERLAY_TRANSFORM_FLIP_VERTICAL_CHROMIUM 0x9247 | ||||
142 | #define GL_OVERLAY_TRANSFORM_ROTATE_90_CHROMIUM 0x9248 | ||||
143 | #define GL_OVERLAY_TRANSFORM_ROTATE_180_CHROMIUM 0x9249 | ||||
144 | #define GL_OVERLAY_TRANSFORM_ROTATE_270_CHROMIUM 0x924A | ||||
145 | |||||
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 146 | // GL_OES_texure_3D |
147 | #define GL_SAMPLER_3D_OES 0x8B5F | ||||
148 | |||||
149 | // GL_OES_depth24 | ||||
150 | #define GL_DEPTH_COMPONENT24_OES 0x81A6 | ||||
151 | |||||
152 | // GL_OES_depth32 | ||||
153 | #define GL_DEPTH_COMPONENT32_OES 0x81A7 | ||||
154 | |||||
155 | // GL_OES_packed_depth_stencil | ||||
156 | #ifndef GL_DEPTH24_STENCIL8_OES | ||||
157 | #define GL_DEPTH24_STENCIL8_OES 0x88F0 | ||||
158 | #endif | ||||
159 | |||||
160 | #ifndef GL_DEPTH24_STENCIL8 | ||||
161 | #define GL_DEPTH24_STENCIL8 0x88F0 | ||||
162 | #endif | ||||
163 | |||||
164 | // GL_OES_compressed_ETC1_RGB8_texture | ||||
165 | #define GL_ETC1_RGB8_OES 0x8D64 | ||||
166 | |||||
[email protected] | 8aec81ec | 2014-04-29 01:04:51 | [diff] [blame] | 167 | // GL_AMD_compressed_ATC_texture |
168 | #define GL_ATC_RGB_AMD 0x8C92 | ||||
169 | #define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 | ||||
170 | #define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE | ||||
171 | |||||
172 | // GL_IMG_texture_compression_pvrtc | ||||
173 | #define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 | ||||
174 | #define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 | ||||
175 | #define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 | ||||
176 | #define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 | ||||
177 | |||||
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 178 | // GL_OES_vertex_array_object |
179 | #define GL_VERTEX_ARRAY_BINDING_OES 0x85B5 | ||||
180 | |||||
181 | // GL_CHROMIUM_pixel_transfer_buffer_object | ||||
182 | #define GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM 0x78EC | ||||
[email protected] | de43f08 | 2013-04-02 01:16:10 | [diff] [blame] | 183 | #define GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM 0x78ED |
184 | #define GL_PIXEL_PACK_TRANSFER_BUFFER_BINDING_CHROMIUM 0x78EE | ||||
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 185 | #define GL_PIXEL_UNPACK_TRANSFER_BUFFER_BINDING_CHROMIUM 0x78EF |
186 | |||||
187 | /* GL_EXT_discard_framebuffer */ | ||||
188 | #ifndef GL_EXT_discard_framebuffer | ||||
189 | #define GL_COLOR_EXT 0x1800 | ||||
190 | #define GL_DEPTH_EXT 0x1801 | ||||
191 | #define GL_STENCIL_EXT 0x1802 | ||||
192 | #endif | ||||
193 | |||||
bajones | 2a2ea23 | 2014-10-13 21:38:59 | [diff] [blame] | 194 | // GL_EXT_sRGB |
195 | #define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210 | ||||
196 | |||||
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 197 | // GL_ARB_get_program_binary |
198 | #define PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257 | ||||
199 | // GL_OES_get_program_binary | ||||
200 | #define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 | ||||
201 | #define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE | ||||
202 | #define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF | ||||
203 | |||||
[email protected] | 7d3c36e | 2013-07-12 14:13:16 | [diff] [blame] | 204 | #ifndef GL_EXT_multisampled_render_to_texture |
205 | #define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB | ||||
206 | #define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 | ||||
207 | #define GL_MAX_SAMPLES_EXT 0x8D57 | ||||
208 | #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C | ||||
209 | #endif | ||||
210 | |||||
211 | #ifndef GL_IMG_multisampled_render_to_texture | ||||
212 | #define GL_RENDERBUFFER_SAMPLES_IMG 0x9133 | ||||
213 | #define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134 | ||||
214 | #define GL_MAX_SAMPLES_IMG 0x9135 | ||||
215 | #define GL_TEXTURE_SAMPLES_IMG 0x9136 | ||||
216 | #endif | ||||
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 217 | |
kkinnunen | 337d5963 | 2014-08-26 10:19:57 | [diff] [blame] | 218 | #ifndef GL_CHROMIUM_path_rendering |
219 | // These match the corresponding values in NV_path_rendering | ||||
220 | // extension, eg tokens with CHROMIUM replaced with NV. | ||||
221 | #define GL_PATH_MODELVIEW_MATRIX_CHROMIUM 0x0BA6 | ||||
222 | #define GL_PATH_PROJECTION_MATRIX_CHROMIUM 0x0BA7 | ||||
223 | #define GL_PATH_MODELVIEW_CHROMIUM 0x1700 | ||||
224 | #define GL_PATH_PROJECTION_CHROMIUM 0x1701 | ||||
225 | #endif | ||||
226 | |||||
ed | 9198b42 | 2014-10-23 15:01:37 | [diff] [blame] | 227 | #ifndef GL_KHR_blend_equation_advanced |
228 | #define GL_KHR_blend_equation_advanced 1 | ||||
229 | #define GL_COLORBURN_KHR 0x929A | ||||
230 | #define GL_COLORDODGE_KHR 0x9299 | ||||
231 | #define GL_DARKEN_KHR 0x9297 | ||||
232 | #define GL_DIFFERENCE_KHR 0x929E | ||||
233 | #define GL_EXCLUSION_KHR 0x92A0 | ||||
234 | #define GL_HARDLIGHT_KHR 0x929B | ||||
235 | #define GL_HSL_COLOR_KHR 0x92AF | ||||
236 | #define GL_HSL_HUE_KHR 0x92AD | ||||
237 | #define GL_HSL_LUMINOSITY_KHR 0x92B0 | ||||
238 | #define GL_HSL_SATURATION_KHR 0x92AE | ||||
239 | #define GL_LIGHTEN_KHR 0x9298 | ||||
240 | #define GL_MULTIPLY_KHR 0x9294 | ||||
241 | #define GL_OVERLAY_KHR 0x9296 | ||||
242 | #define GL_SCREEN_KHR 0x9295 | ||||
243 | #define GL_SOFTLIGHT_KHR 0x929C | ||||
244 | #endif /* GL_KHR_blend_equation_advanced */ | ||||
245 | |||||
246 | #ifndef GL_KHR_blend_equation_advanced_coherent | ||||
247 | #define GL_KHR_blend_equation_advanced_coherent 1 | ||||
248 | #define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285 | ||||
249 | #endif /* GL_KHR_blend_equation_advanced_coherent */ | ||||
250 | |||||
dyen | 882e1b7 | 2014-09-03 16:36:49 | [diff] [blame] | 251 | #ifndef GL_EXT_disjoint_timer_query |
252 | #define GL_EXT_disjoint_timer_query 1 | ||||
253 | #define GL_QUERY_COUNTER_BITS_EXT 0x8864 | ||||
254 | #define GL_TIME_ELAPSED_EXT 0x88BF | ||||
255 | #define GL_TIMESTAMP_EXT 0x8E28 | ||||
256 | #define GL_GPU_DISJOINT_EXT 0x8FBB | ||||
257 | #endif | ||||
258 | |||||
oetuaho | 37cc50e | 2014-10-31 11:19:20 | [diff] [blame^] | 259 | #ifndef GL_KHR_robustness |
260 | #define GL_KHR_robustness 1 | ||||
261 | #define GL_CONTEXT_ROBUST_ACCESS_KHR 0x90F3 | ||||
262 | #define GL_LOSE_CONTEXT_ON_RESET_KHR 0x8252 | ||||
263 | #define GL_GUILTY_CONTEXT_RESET_KHR 0x8253 | ||||
264 | #define GL_INNOCENT_CONTEXT_RESET_KHR 0x8254 | ||||
265 | #define GL_UNKNOWN_CONTEXT_RESET_KHR 0x8255 | ||||
266 | #define GL_RESET_NOTIFICATION_STRATEGY_KHR 0x8256 | ||||
267 | #define GL_NO_RESET_NOTIFICATION_KHR 0x8261 | ||||
268 | #define GL_CONTEXT_LOST_KHR 0x0507 | ||||
269 | #endif /* GL_KHR_robustness */ | ||||
270 | |||||
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 271 | #define GL_GLEXT_PROTOTYPES 1 |
272 | |||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 273 | #if defined(OS_WIN) |
274 | #define GL_BINDING_CALL WINAPI | ||||
275 | #else | ||||
276 | #define GL_BINDING_CALL | ||||
277 | #endif | ||||
278 | |||||
[email protected] | 218a5a2 | 2010-11-04 19:27:49 | [diff] [blame] | 279 | #define GL_SERVICE_LOG(args) DLOG(INFO) << args; |
[email protected] | 5a83fca | 2012-04-22 02:05:08 | [diff] [blame] | 280 | #if defined(NDEBUG) |
[email protected] | 92afb77 | 2011-12-09 01:49:56 | [diff] [blame] | 281 | #define GL_SERVICE_LOG_CODE_BLOCK(code) |
282 | #else | ||||
283 | #define GL_SERVICE_LOG_CODE_BLOCK(code) code | ||||
284 | #endif | ||||
[email protected] | 218a5a2 | 2010-11-04 19:27:49 | [diff] [blame] | 285 | |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 286 | // Forward declare OSMesa types. |
287 | typedef struct osmesa_context *OSMesaContext; | ||||
288 | typedef void (*OSMESAproc)(); | ||||
289 | |||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 290 | // Forward declare EGL types. |
[email protected] | 83f48ae | 2013-01-14 14:12:53 | [diff] [blame] | 291 | typedef uint64 EGLuint64CHROMIUM; |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 292 | |
293 | #include "gl_bindings_autogen_gl.h" | ||||
294 | #include "gl_bindings_autogen_osmesa.h" | ||||
295 | |||||
296 | #if defined(OS_WIN) | ||||
297 | #include "gl_bindings_autogen_egl.h" | ||||
298 | #include "gl_bindings_autogen_wgl.h" | ||||
[email protected] | 2ec8df5 | 2011-05-25 23:44:58 | [diff] [blame] | 299 | #elif defined(USE_X11) |
[email protected] | 0bec8e2 | 2010-06-21 22:20:02 | [diff] [blame] | 300 | #include "gl_bindings_autogen_egl.h" |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 301 | #include "gl_bindings_autogen_glx.h" |
[email protected] | efcf2059 | 2013-05-24 06:55:56 | [diff] [blame] | 302 | #elif defined(USE_OZONE) |
303 | #include "gl_bindings_autogen_egl.h" | ||||
[email protected] | c8e295b | 2011-11-21 21:24:14 | [diff] [blame] | 304 | #elif defined(OS_ANDROID) |
305 | #include "gl_bindings_autogen_egl.h" | ||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 306 | #endif |
307 | |||||
308 | namespace gfx { | ||||
309 | |||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 310 | struct GL_EXPORT DriverGL { |
[email protected] | a37d7ff | 2014-01-17 21:31:00 | [diff] [blame] | 311 | void InitializeStaticBindings(); |
312 | void InitializeCustomDynamicBindings(GLContext* context); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 313 | void InitializeDebugBindings(); |
[email protected] | 70c908c | 2014-01-12 02:09:45 | [diff] [blame] | 314 | void InitializeNullDrawBindings(); |
[email protected] | ae967b0 | 2014-02-21 21:18:58 | [diff] [blame] | 315 | // TODO(danakj): Remove this when all test suites are using null-draw. |
316 | bool HasInitializedNullDrawBindings(); | ||||
[email protected] | 2fc82a9 | 2014-02-20 22:52:08 | [diff] [blame] | 317 | bool SetNullDrawBindingsEnabled(bool enabled); |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 318 | void ClearBindings(); |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 319 | |
320 | ProcsGL fn; | ||||
321 | ProcsGL orig_fn; | ||||
322 | ProcsGL debug_fn; | ||||
323 | ExtensionsGL ext; | ||||
[email protected] | 2fc82a9 | 2014-02-20 22:52:08 | [diff] [blame] | 324 | bool null_draw_bindings_enabled; |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 325 | |
326 | private: | ||||
[email protected] | a37d7ff | 2014-01-17 21:31:00 | [diff] [blame] | 327 | void InitializeDynamicBindings(GLContext* context); |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 328 | }; |
329 | |||||
330 | struct GL_EXPORT DriverOSMESA { | ||||
[email protected] | a37d7ff | 2014-01-17 21:31:00 | [diff] [blame] | 331 | void InitializeStaticBindings(); |
332 | void InitializeDynamicBindings(GLContext* context); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 333 | void InitializeDebugBindings(); |
334 | void ClearBindings(); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 335 | |
336 | ProcsOSMESA fn; | ||||
337 | ProcsOSMESA debug_fn; | ||||
338 | ExtensionsOSMESA ext; | ||||
339 | }; | ||||
340 | |||||
341 | #if defined(OS_WIN) | ||||
342 | struct GL_EXPORT DriverWGL { | ||||
[email protected] | a37d7ff | 2014-01-17 21:31:00 | [diff] [blame] | 343 | void InitializeStaticBindings(); |
344 | void InitializeDynamicBindings(GLContext* context); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 345 | void InitializeDebugBindings(); |
346 | void ClearBindings(); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 347 | |
348 | ProcsWGL fn; | ||||
349 | ProcsWGL debug_fn; | ||||
350 | ExtensionsWGL ext; | ||||
351 | }; | ||||
352 | #endif | ||||
353 | |||||
[email protected] | efcf2059 | 2013-05-24 06:55:56 | [diff] [blame] | 354 | #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || defined(USE_OZONE) |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 355 | struct GL_EXPORT DriverEGL { |
[email protected] | a37d7ff | 2014-01-17 21:31:00 | [diff] [blame] | 356 | void InitializeStaticBindings(); |
357 | void InitializeDynamicBindings(GLContext* context); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 358 | void InitializeDebugBindings(); |
359 | void ClearBindings(); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 360 | |
361 | ProcsEGL fn; | ||||
362 | ProcsEGL debug_fn; | ||||
363 | ExtensionsEGL ext; | ||||
364 | }; | ||||
365 | #endif | ||||
366 | |||||
367 | #if defined(USE_X11) | ||||
368 | struct GL_EXPORT DriverGLX { | ||||
[email protected] | a37d7ff | 2014-01-17 21:31:00 | [diff] [blame] | 369 | void InitializeStaticBindings(); |
370 | void InitializeDynamicBindings(GLContext* context); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 371 | void InitializeDebugBindings(); |
372 | void ClearBindings(); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 373 | |
374 | ProcsGLX fn; | ||||
375 | ProcsGLX debug_fn; | ||||
376 | ExtensionsGLX ext; | ||||
377 | }; | ||||
378 | #endif | ||||
379 | |||||
[email protected] | 06a1a692 | 2013-07-26 11:51:52 | [diff] [blame] | 380 | // This #define is here to support autogenerated code. |
381 | #define g_current_gl_context g_current_gl_context_tls->Get() | ||||
382 | GL_EXPORT extern base::ThreadLocalPointer<GLApi>* g_current_gl_context_tls; | ||||
383 | |||||
[email protected] | b97c908 | 2012-10-25 17:21:38 | [diff] [blame] | 384 | GL_EXPORT extern OSMESAApi* g_current_osmesa_context; |
385 | GL_EXPORT extern DriverGL g_driver_gl; | ||||
386 | GL_EXPORT extern DriverOSMESA g_driver_osmesa; | ||||
387 | |||||
388 | #if defined(OS_WIN) | ||||
389 | |||||
390 | GL_EXPORT extern EGLApi* g_current_egl_context; | ||||
391 | GL_EXPORT extern WGLApi* g_current_wgl_context; | ||||
392 | GL_EXPORT extern DriverEGL g_driver_egl; | ||||
393 | GL_EXPORT extern DriverWGL g_driver_wgl; | ||||
394 | |||||
395 | #elif defined(USE_X11) | ||||
396 | |||||
397 | GL_EXPORT extern EGLApi* g_current_egl_context; | ||||
398 | GL_EXPORT extern GLXApi* g_current_glx_context; | ||||
399 | GL_EXPORT extern DriverEGL g_driver_egl; | ||||
400 | GL_EXPORT extern DriverGLX g_driver_glx; | ||||
401 | |||||
[email protected] | efcf2059 | 2013-05-24 06:55:56 | [diff] [blame] | 402 | #elif defined(USE_OZONE) |
403 | |||||
404 | GL_EXPORT extern EGLApi* g_current_egl_context; | ||||
405 | GL_EXPORT extern DriverEGL g_driver_egl; | ||||
406 | |||||
[email protected] | b97c908 | 2012-10-25 17:21:38 | [diff] [blame] | 407 | #elif defined(OS_ANDROID) |
408 | |||||
409 | GL_EXPORT extern EGLApi* g_current_egl_context; | ||||
410 | GL_EXPORT extern DriverEGL g_driver_egl; | ||||
411 | |||||
412 | #endif | ||||
413 | |||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 414 | } // namespace gfx |
415 | |||||
[email protected] | c9e2cbbb | 2012-05-12 21:17:27 | [diff] [blame] | 416 | #endif // UI_GL_GL_BINDINGS_H_ |