blob: 453437ad349ea42bc996500d5832e13a740dd4b5 [file] [log] [blame]
[email protected]328ce55f2012-04-07 00:33:041// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]b9363b22010-06-09 22:06:152// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]c9e2cbbb2012-05-12 21:17:275#ifndef UI_GL_GL_BINDINGS_H_
6#define UI_GL_GL_BINDINGS_H_
[email protected]c9e2cbbb2012-05-12 21:17:277
sieverse3b17fd52015-01-29 04:00:538#include <string>
9
[email protected]b9363b22010-06-09 22:06:1510// Includes the platform independent and platform dependent GL headers.
11// Only include this in cc files. It pulls in system headers, including
12// the X11 headers on linux, which define all kinds of macros that are
13// liable to cause conflicts.
14
[email protected]b9363b22010-06-09 22:06:1515#include <GL/gl.h>
16#include <GL/glext.h>
[email protected]b040f9d2013-01-19 04:27:0017#include <EGL/egl.h>
18#include <EGL/eglext.h>
[email protected]b9363b22010-06-09 22:06:1519
[email protected]218a5a22010-11-04 19:27:4920#include "base/logging.h"
[email protected]06a1a6922013-07-26 11:51:5221#include "base/threading/thread_local.h"
[email protected]c9e2cbbb2012-05-12 21:17:2722#include "build/build_config.h"
23#include "ui/gl/gl_export.h"
[email protected]b9363b22010-06-09 22:06:1524
25// The standard OpenGL native extension headers are also included.
26#if defined(OS_WIN)
27#include <GL/wglext.h>
[email protected]2ec8df52011-05-25 23:44:5828#elif defined(OS_MACOSX)
29#include <OpenGL/OpenGL.h>
30#elif defined(USE_X11)
[email protected]b9363b22010-06-09 22:06:1531#include <GL/glx.h>
32#include <GL/glxext.h>
[email protected]31c31b2b2011-09-27 18:58:2933
34// Undefine some macros defined by X headers. This is why this file should only
35// be included in .cc files.
36#undef Bool
37#undef None
38#undef Status
[email protected]b9363b22010-06-09 22:06:1539#endif
40
[email protected]cb68eca2013-02-15 07:38:3841
42// GLES2 defines not part of Desktop GL
43// Shader Precision-Specified Types
44#define GL_LOW_FLOAT 0x8DF0
45#define GL_MEDIUM_FLOAT 0x8DF1
46#define GL_HIGH_FLOAT 0x8DF2
47#define GL_LOW_INT 0x8DF3
48#define GL_MEDIUM_INT 0x8DF4
49#define GL_HIGH_INT 0x8DF5
50#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
51#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
52#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
53#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
54#define GL_MAX_VARYING_VECTORS 0x8DFC
55#define GL_SHADER_BINARY_FORMATS 0x8DF8
56#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
57#define GL_SHADER_COMPILER 0x8DFA
58#define GL_RGB565 0x8D62
59#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B
60#define GL_RGB8_OES 0x8051
61#define GL_RGBA8_OES 0x8058
62#define GL_HALF_FLOAT_OES 0x8D61
63
64// GL_OES_EGL_image_external
65#define GL_TEXTURE_EXTERNAL_OES 0x8D65
66#define GL_SAMPLER_EXTERNAL_OES 0x8D66
67#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67
68#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68
69
70// GL_ANGLE_translated_shader_source
71#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0
72
[email protected]cb68eca2013-02-15 07:38:3873#define GL_UNPACK_COLORSPACE_CONVERSION_CHROMIUM 0x9243
[email protected]6eda6822014-04-03 23:00:5074#define GL_BIND_GENERATES_RESOURCE_CHROMIUM 0x9244
[email protected]cb68eca2013-02-15 07:38:3875
[email protected]cb68eca2013-02-15 07:38:3876// GL_ANGLE_pack_reverse_row_order
77#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4
78
79// GL_ANGLE_texture_usage
80#define GL_TEXTURE_USAGE_ANGLE 0x93A2
81#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3
82
83// GL_EXT_texture_storage
84#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F
85#define GL_ALPHA8_EXT 0x803C
86#define GL_LUMINANCE8_EXT 0x8040
87#define GL_LUMINANCE8_ALPHA8_EXT 0x8045
88#define GL_RGBA32F_EXT 0x8814
89#define GL_RGB32F_EXT 0x8815
90#define GL_ALPHA32F_EXT 0x8816
91#define GL_LUMINANCE32F_EXT 0x8818
92#define GL_LUMINANCE_ALPHA32F_EXT 0x8819
93#define GL_RGBA16F_EXT 0x881A
94#define GL_RGB16F_EXT 0x881B
hendrikwbef24f5c2014-12-05 01:01:4295#define GL_RG16F_EXT 0x822F
96#define GL_R16F_EXT 0x822D
[email protected]cb68eca2013-02-15 07:38:3897#define GL_ALPHA16F_EXT 0x881C
98#define GL_LUMINANCE16F_EXT 0x881E
99#define GL_LUMINANCE_ALPHA16F_EXT 0x881F
hendrikwbef24f5c2014-12-05 01:01:42100#define GL_R32F_EXT 0x822E
101#define GL_RG32F_EXT 0x8230
[email protected]cb68eca2013-02-15 07:38:38102#define GL_BGRA8_EXT 0x93A1
103
104// GL_ANGLE_instanced_arrays
105#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE
106
107// GL_EXT_occlusion_query_boolean
108#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F
109#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A
110#define GL_CURRENT_QUERY_EXT 0x8865
111#define GL_QUERY_RESULT_EXT 0x8866
112#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867
113
114// GL_CHROMIUM_command_buffer_query
dongseong.hwang7ce131d42014-11-20 00:02:31115#define GL_COMMANDS_ISSUED_CHROMIUM 0x6004
[email protected]cb68eca2013-02-15 07:38:38116
117/* GL_CHROMIUM_get_error_query */
dongseong.hwang7ce131d42014-11-20 00:02:31118#define GL_GET_ERROR_QUERY_CHROMIUM 0x6003
[email protected]cb68eca2013-02-15 07:38:38119
120/* GL_CHROMIUM_command_buffer_latency_query */
dongseong.hwang7ce131d42014-11-20 00:02:31121#define GL_LATENCY_QUERY_CHROMIUM 0x6007
[email protected]cb68eca2013-02-15 07:38:38122
123/* GL_CHROMIUM_async_pixel_transfers */
dongseong.hwang7ce131d42014-11-20 00:02:31124#define GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM 0x6006
[email protected]cb68eca2013-02-15 07:38:38125
[email protected]6a25ae422014-04-17 23:48:27126// GL_CHROMIUM_sync_query
127#define GL_COMMANDS_COMPLETED_CHROMIUM 0x84F7
128
reveman32115e52014-10-02 19:01:03129// GL_CHROMIUM_gpu_memory_buffer_image
revemaneb0fda22015-10-26 20:27:47130#define GL_READ_WRITE_CHROMIUM 0x78F2
reveman32115e52014-10-02 19:01:03131
emircanf21bee9b2015-04-11 04:58:11132// GL_CHROMIUM_yuv_420_image
133#define GL_RGB_YUV_420_CHROMIUM 0x78FA
134
dcastagnaa93c58151c02015-08-26 22:08:34135// GL_CHROMIUM_ycbcr_422_image
136#define GL_RGB_YCBCR_422_CHROMIUM 0x78FB
137
[email protected]d286ebbc2014-07-03 17:19:10138// 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
orglofchcad5a6742014-11-07 19:51:12146// GL_CHROMIUM_subscribe_uniforms
147#define GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM 0x924B
148#define GL_MOUSE_POSITION_CHROMIUM 0x924C
149
[email protected]cb68eca2013-02-15 07:38:38150// GL_OES_texure_3D
151#define GL_SAMPLER_3D_OES 0x8B5F
152
153// GL_OES_depth24
154#define GL_DEPTH_COMPONENT24_OES 0x81A6
155
156// GL_OES_depth32
157#define GL_DEPTH_COMPONENT32_OES 0x81A7
158
159// GL_OES_packed_depth_stencil
160#ifndef GL_DEPTH24_STENCIL8_OES
161#define GL_DEPTH24_STENCIL8_OES 0x88F0
162#endif
163
164#ifndef GL_DEPTH24_STENCIL8
165#define GL_DEPTH24_STENCIL8 0x88F0
166#endif
167
168// GL_OES_compressed_ETC1_RGB8_texture
169#define GL_ETC1_RGB8_OES 0x8D64
170
[email protected]8aec81ec2014-04-29 01:04:51171// GL_AMD_compressed_ATC_texture
172#define GL_ATC_RGB_AMD 0x8C92
173#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
174#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
175
176// GL_IMG_texture_compression_pvrtc
177#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
178#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
179#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
180#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
181
[email protected]cb68eca2013-02-15 07:38:38182// GL_OES_vertex_array_object
183#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5
184
185// GL_CHROMIUM_pixel_transfer_buffer_object
186#define GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM 0x78EC
[email protected]de43f082013-04-02 01:16:10187#define GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM 0x78ED
188#define GL_PIXEL_PACK_TRANSFER_BUFFER_BINDING_CHROMIUM 0x78EE
[email protected]cb68eca2013-02-15 07:38:38189#define GL_PIXEL_UNPACK_TRANSFER_BUFFER_BINDING_CHROMIUM 0x78EF
190
191/* GL_EXT_discard_framebuffer */
192#ifndef GL_EXT_discard_framebuffer
193#define GL_COLOR_EXT 0x1800
194#define GL_DEPTH_EXT 0x1801
195#define GL_STENCIL_EXT 0x1802
196#endif
197
bajones2a2ea232014-10-13 21:38:59198// GL_EXT_sRGB
199#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210
200
[email protected]cb68eca2013-02-15 07:38:38201// GL_ARB_get_program_binary
202#define PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
203// GL_OES_get_program_binary
204#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741
205#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE
206#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF
207
[email protected]7d3c36e2013-07-12 14:13:16208#ifndef GL_EXT_multisampled_render_to_texture
209#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
210#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
211#define GL_MAX_SAMPLES_EXT 0x8D57
212#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C
213#endif
214
215#ifndef GL_IMG_multisampled_render_to_texture
216#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133
217#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134
218#define GL_MAX_SAMPLES_IMG 0x9135
219#define GL_TEXTURE_SAMPLES_IMG 0x9136
220#endif
[email protected]cb68eca2013-02-15 07:38:38221
kkinnunen337d59632014-08-26 10:19:57222#ifndef GL_CHROMIUM_path_rendering
kkinnunenb959a8462015-07-14 11:08:34223#define GL_CHROMIUM_path_rendering 1
kkinnunen337d59632014-08-26 10:19:57224// These match the corresponding values in NV_path_rendering
225// extension, eg tokens with CHROMIUM replaced with NV.
226#define GL_PATH_MODELVIEW_MATRIX_CHROMIUM 0x0BA6
227#define GL_PATH_PROJECTION_MATRIX_CHROMIUM 0x0BA7
228#define GL_PATH_MODELVIEW_CHROMIUM 0x1700
229#define GL_PATH_PROJECTION_CHROMIUM 0x1701
kkinnunenb959a8462015-07-14 11:08:34230#define GL_FLAT_CHROMIUM 0x1D00
231#define GL_CLOSE_PATH_CHROMIUM 0x00
232#define GL_MOVE_TO_CHROMIUM 0x02
233#define GL_LINE_TO_CHROMIUM 0x04
234#define GL_QUADRATIC_CURVE_TO_CHROMIUM 0x0A
235#define GL_CUBIC_CURVE_TO_CHROMIUM 0x0C
236#define GL_CONIC_CURVE_TO_CHROMIUM 0x1A
kkinnunenc8b449e1582015-11-02 07:57:51237#define GL_EYE_LINEAR_CHROMIUM 0x2400
238#define GL_OBJECT_LINEAR_CHROMIUM 0x2401
239#define GL_CONSTANT_CHROMIUM 0x8576
kkinnunenb959a8462015-07-14 11:08:34240#define GL_PATH_STROKE_WIDTH_CHROMIUM 0x9075
241#define GL_PATH_END_CAPS_CHROMIUM 0x9076
242#define GL_PATH_JOIN_STYLE_CHROMIUM 0x9079
243#define GL_PATH_MITER_LIMIT_CHROMIUM 0x907a
244#define GL_PATH_STROKE_BOUND_CHROMIUM 0x9086
245#define GL_COUNT_UP_CHROMIUM 0x9088
246#define GL_COUNT_DOWN_CHROMIUM 0x9089
247#define GL_CONVEX_HULL_CHROMIUM 0x908B
248#define GL_BOUNDING_BOX_CHROMIUM 0x908D
kkinnunenfb3f1172015-10-28 08:50:00249#define GL_TRANSLATE_X_CHROMIUM 0x908E
250#define GL_TRANSLATE_Y_CHROMIUM 0x908F
251#define GL_TRANSLATE_2D_CHROMIUM 0x9090
252#define GL_TRANSLATE_3D_CHROMIUM 0x9091
253#define GL_AFFINE_2D_CHROMIUM 0x9092
254#define GL_AFFINE_3D_CHROMIUM 0x9094
255#define GL_TRANSPOSE_AFFINE_2D_CHROMIUM 0x9096
256#define GL_TRANSPOSE_AFFINE_3D_CHROMIUM 0x9098
257#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM 0x909C
kkinnunenb959a8462015-07-14 11:08:34258#define GL_SQUARE_CHROMIUM 0x90a3
259#define GL_ROUND_CHROMIUM 0x90a4
260#define GL_BEVEL_CHROMIUM 0x90a6
261#define GL_MITER_REVERT_CHROMIUM 0x90a7
262#define GL_PATH_STENCIL_FUNC_CHROMIUM 0x90B7
263#define GL_PATH_STENCIL_REF_CHROMIUM 0x90B8
264#define GL_PATH_STENCIL_VALUE_MASK_CHROMIUM 0x90B9
kkinnunen337d59632014-08-26 10:19:57265#endif
266
ed9198b422014-10-23 15:01:37267#ifndef GL_KHR_blend_equation_advanced
268#define GL_KHR_blend_equation_advanced 1
269#define GL_COLORBURN_KHR 0x929A
270#define GL_COLORDODGE_KHR 0x9299
271#define GL_DARKEN_KHR 0x9297
272#define GL_DIFFERENCE_KHR 0x929E
273#define GL_EXCLUSION_KHR 0x92A0
274#define GL_HARDLIGHT_KHR 0x929B
275#define GL_HSL_COLOR_KHR 0x92AF
276#define GL_HSL_HUE_KHR 0x92AD
277#define GL_HSL_LUMINOSITY_KHR 0x92B0
278#define GL_HSL_SATURATION_KHR 0x92AE
279#define GL_LIGHTEN_KHR 0x9298
280#define GL_MULTIPLY_KHR 0x9294
281#define GL_OVERLAY_KHR 0x9296
282#define GL_SCREEN_KHR 0x9295
283#define GL_SOFTLIGHT_KHR 0x929C
284#endif /* GL_KHR_blend_equation_advanced */
285
286#ifndef GL_KHR_blend_equation_advanced_coherent
287#define GL_KHR_blend_equation_advanced_coherent 1
288#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285
289#endif /* GL_KHR_blend_equation_advanced_coherent */
290
dyen882e1b72014-09-03 16:36:49291#ifndef GL_EXT_disjoint_timer_query
292#define GL_EXT_disjoint_timer_query 1
293#define GL_QUERY_COUNTER_BITS_EXT 0x8864
294#define GL_TIME_ELAPSED_EXT 0x88BF
295#define GL_TIMESTAMP_EXT 0x8E28
296#define GL_GPU_DISJOINT_EXT 0x8FBB
297#endif
298
oetuaho37cc50e2014-10-31 11:19:20299#ifndef GL_KHR_robustness
300#define GL_KHR_robustness 1
301#define GL_CONTEXT_ROBUST_ACCESS_KHR 0x90F3
302#define GL_LOSE_CONTEXT_ON_RESET_KHR 0x8252
303#define GL_GUILTY_CONTEXT_RESET_KHR 0x8253
304#define GL_INNOCENT_CONTEXT_RESET_KHR 0x8254
305#define GL_UNKNOWN_CONTEXT_RESET_KHR 0x8255
306#define GL_RESET_NOTIFICATION_STRATEGY_KHR 0x8256
307#define GL_NO_RESET_NOTIFICATION_KHR 0x8261
308#define GL_CONTEXT_LOST_KHR 0x0507
309#endif /* GL_KHR_robustness */
310
hendrikw83f2fb52014-12-02 03:30:40311#ifndef GL_EXT_texture_rg
312#define GL_EXT_texture_rg 1
313#define GL_RED_EXT 0x1903
314#define GL_RG_EXT 0x8227
315#define GL_R8_EXT 0x8229
316#define GL_RG8_EXT 0x822B
317#endif /* GL_EXT_texture_rg */
318
kkinnunenc8b449e1582015-11-02 07:57:51319// This is from NV_path_rendering, but the Mesa GL header is not up-to-date with
320// the most recent
321// version of the extension. This definition could be removed once glext.h
322// r27498 or later is
323// imported.
324#ifndef GL_FRAGMENT_INPUT_NV
325#define GL_FRAGMENT_INPUT_NV 0x936D
326#endif
327
[email protected]cb68eca2013-02-15 07:38:38328#define GL_GLEXT_PROTOTYPES 1
329
[email protected]b9363b22010-06-09 22:06:15330#if defined(OS_WIN)
331#define GL_BINDING_CALL WINAPI
332#else
333#define GL_BINDING_CALL
334#endif
335
[email protected]218a5a22010-11-04 19:27:49336#define GL_SERVICE_LOG(args) DLOG(INFO) << args;
[email protected]5a83fca2012-04-22 02:05:08337#if defined(NDEBUG)
[email protected]92afb772011-12-09 01:49:56338 #define GL_SERVICE_LOG_CODE_BLOCK(code)
339#else
340 #define GL_SERVICE_LOG_CODE_BLOCK(code) code
341#endif
[email protected]218a5a22010-11-04 19:27:49342
[email protected]b9363b22010-06-09 22:06:15343// Forward declare OSMesa types.
344typedef struct osmesa_context *OSMesaContext;
345typedef void (*OSMESAproc)();
346
[email protected]b9363b22010-06-09 22:06:15347// Forward declare EGL types.
[email protected]83f48ae2013-01-14 14:12:53348typedef uint64 EGLuint64CHROMIUM;
[email protected]b9363b22010-06-09 22:06:15349
350#include "gl_bindings_autogen_gl.h"
351#include "gl_bindings_autogen_osmesa.h"
352
353#if defined(OS_WIN)
354#include "gl_bindings_autogen_egl.h"
355#include "gl_bindings_autogen_wgl.h"
[email protected]2ec8df52011-05-25 23:44:58356#elif defined(USE_X11)
[email protected]0bec8e22010-06-21 22:20:02357#include "gl_bindings_autogen_egl.h"
[email protected]b9363b22010-06-09 22:06:15358#include "gl_bindings_autogen_glx.h"
[email protected]efcf20592013-05-24 06:55:56359#elif defined(USE_OZONE)
360#include "gl_bindings_autogen_egl.h"
[email protected]c8e295b2011-11-21 21:24:14361#elif defined(OS_ANDROID)
362#include "gl_bindings_autogen_egl.h"
[email protected]b9363b22010-06-09 22:06:15363#endif
364
365namespace gfx {
366
[email protected]8f1d2aa2013-05-10 23:45:38367struct GL_EXPORT DriverGL {
[email protected]a37d7ff2014-01-17 21:31:00368 void InitializeStaticBindings();
369 void InitializeCustomDynamicBindings(GLContext* context);
[email protected]8f1d2aa2013-05-10 23:45:38370 void InitializeDebugBindings();
[email protected]70c908c2014-01-12 02:09:45371 void InitializeNullDrawBindings();
[email protected]ae967b02014-02-21 21:18:58372 // TODO(danakj): Remove this when all test suites are using null-draw.
373 bool HasInitializedNullDrawBindings();
[email protected]2fc82a92014-02-20 22:52:08374 bool SetNullDrawBindingsEnabled(bool enabled);
[email protected]8f1d2aa2013-05-10 23:45:38375 void ClearBindings();
[email protected]8f1d2aa2013-05-10 23:45:38376
377 ProcsGL fn;
378 ProcsGL orig_fn;
379 ProcsGL debug_fn;
380 ExtensionsGL ext;
[email protected]2fc82a92014-02-20 22:52:08381 bool null_draw_bindings_enabled;
[email protected]8f1d2aa2013-05-10 23:45:38382
383 private:
[email protected]a37d7ff2014-01-17 21:31:00384 void InitializeDynamicBindings(GLContext* context);
[email protected]8f1d2aa2013-05-10 23:45:38385};
386
387struct GL_EXPORT DriverOSMESA {
[email protected]a37d7ff2014-01-17 21:31:00388 void InitializeStaticBindings();
tobiasjsbbda4652015-06-26 23:08:53389 void InitializeExtensionBindings();
[email protected]8f1d2aa2013-05-10 23:45:38390 void InitializeDebugBindings();
391 void ClearBindings();
[email protected]8f1d2aa2013-05-10 23:45:38392
393 ProcsOSMESA fn;
394 ProcsOSMESA debug_fn;
395 ExtensionsOSMESA ext;
sieverse3b17fd52015-01-29 04:00:53396
397 private:
398 static std::string GetPlatformExtensions();
[email protected]8f1d2aa2013-05-10 23:45:38399};
400
401#if defined(OS_WIN)
402struct GL_EXPORT DriverWGL {
[email protected]a37d7ff2014-01-17 21:31:00403 void InitializeStaticBindings();
tobiasjsbbda4652015-06-26 23:08:53404 void InitializeExtensionBindings();
[email protected]8f1d2aa2013-05-10 23:45:38405 void InitializeDebugBindings();
406 void ClearBindings();
[email protected]8f1d2aa2013-05-10 23:45:38407
408 ProcsWGL fn;
409 ProcsWGL debug_fn;
410 ExtensionsWGL ext;
sieverse3b17fd52015-01-29 04:00:53411
412 private:
413 static std::string GetPlatformExtensions();
[email protected]8f1d2aa2013-05-10 23:45:38414};
415#endif
416
[email protected]efcf20592013-05-24 06:55:56417#if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || defined(USE_OZONE)
[email protected]8f1d2aa2013-05-10 23:45:38418struct GL_EXPORT DriverEGL {
[email protected]a37d7ff2014-01-17 21:31:00419 void InitializeStaticBindings();
tobiasjsbbda4652015-06-26 23:08:53420 void InitializeExtensionBindings();
[email protected]8f1d2aa2013-05-10 23:45:38421 void InitializeDebugBindings();
422 void ClearBindings();
[email protected]8f1d2aa2013-05-10 23:45:38423
424 ProcsEGL fn;
425 ProcsEGL debug_fn;
426 ExtensionsEGL ext;
sieverse3b17fd52015-01-29 04:00:53427
sieverse3b17fd52015-01-29 04:00:53428 static std::string GetPlatformExtensions();
jmadillc3cfb9c2015-04-14 21:13:58429 static std::string GetClientExtensions();
[email protected]8f1d2aa2013-05-10 23:45:38430};
431#endif
432
433#if defined(USE_X11)
434struct GL_EXPORT DriverGLX {
[email protected]a37d7ff2014-01-17 21:31:00435 void InitializeStaticBindings();
tobiasjsbbda4652015-06-26 23:08:53436 void InitializeExtensionBindings();
[email protected]8f1d2aa2013-05-10 23:45:38437 void InitializeDebugBindings();
438 void ClearBindings();
[email protected]8f1d2aa2013-05-10 23:45:38439
440 ProcsGLX fn;
441 ProcsGLX debug_fn;
442 ExtensionsGLX ext;
sieverse3b17fd52015-01-29 04:00:53443
444 private:
445 static std::string GetPlatformExtensions();
[email protected]8f1d2aa2013-05-10 23:45:38446};
447#endif
448
[email protected]06a1a6922013-07-26 11:51:52449// This #define is here to support autogenerated code.
450#define g_current_gl_context g_current_gl_context_tls->Get()
451GL_EXPORT extern base::ThreadLocalPointer<GLApi>* g_current_gl_context_tls;
452
[email protected]b97c9082012-10-25 17:21:38453GL_EXPORT extern OSMESAApi* g_current_osmesa_context;
454GL_EXPORT extern DriverGL g_driver_gl;
455GL_EXPORT extern DriverOSMESA g_driver_osmesa;
456
457#if defined(OS_WIN)
458
459GL_EXPORT extern EGLApi* g_current_egl_context;
460GL_EXPORT extern WGLApi* g_current_wgl_context;
461GL_EXPORT extern DriverEGL g_driver_egl;
462GL_EXPORT extern DriverWGL g_driver_wgl;
463
464#elif defined(USE_X11)
465
466GL_EXPORT extern EGLApi* g_current_egl_context;
467GL_EXPORT extern GLXApi* g_current_glx_context;
468GL_EXPORT extern DriverEGL g_driver_egl;
469GL_EXPORT extern DriverGLX g_driver_glx;
470
[email protected]efcf20592013-05-24 06:55:56471#elif defined(USE_OZONE)
472
473GL_EXPORT extern EGLApi* g_current_egl_context;
474GL_EXPORT extern DriverEGL g_driver_egl;
475
[email protected]b97c9082012-10-25 17:21:38476#elif defined(OS_ANDROID)
477
478GL_EXPORT extern EGLApi* g_current_egl_context;
479GL_EXPORT extern DriverEGL g_driver_egl;
480
481#endif
482
[email protected]b9363b22010-06-09 22:06:15483} // namespace gfx
484
[email protected]c9e2cbbb2012-05-12 21:17:27485#endif // UI_GL_GL_BINDINGS_H_