blob: a43c1d3f1f1bb05761d40c773a2eb6fb54b947cf [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
[email protected]b9363b22010-06-09 22:06:158// 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]b9363b22010-06-09 22:06:1513#include <GL/gl.h>
14#include <GL/glext.h>
[email protected]b040f9d2013-01-19 04:27:0015#include <EGL/egl.h>
16#include <EGL/eglext.h>
avi9c81217b2015-12-24 23:40:0517#include <stdint.h>
18
19#include <string>
[email protected]b9363b22010-06-09 22:06:1520
[email protected]218a5a22010-11-04 19:27:4921#include "base/logging.h"
[email protected]06a1a6922013-07-26 11:51:5222#include "base/threading/thread_local.h"
[email protected]c9e2cbbb2012-05-12 21:17:2723#include "build/build_config.h"
24#include "ui/gl/gl_export.h"
[email protected]b9363b22010-06-09 22:06:1525
26// The standard OpenGL native extension headers are also included.
27#if defined(OS_WIN)
28#include <GL/wglext.h>
[email protected]2ec8df52011-05-25 23:44:5829#elif defined(OS_MACOSX)
30#include <OpenGL/OpenGL.h>
31#elif defined(USE_X11)
[email protected]b9363b22010-06-09 22:06:1532#include <GL/glx.h>
33#include <GL/glxext.h>
[email protected]31c31b2b2011-09-27 18:58:2934
35// Undefine some macros defined by X headers. This is why this file should only
36// be included in .cc files.
37#undef Bool
38#undef None
39#undef Status
[email protected]b9363b22010-06-09 22:06:1540#endif
41
[email protected]cb68eca2013-02-15 07:38:3842
43// GLES2 defines not part of Desktop GL
44// Shader Precision-Specified Types
45#define GL_LOW_FLOAT 0x8DF0
46#define GL_MEDIUM_FLOAT 0x8DF1
47#define GL_HIGH_FLOAT 0x8DF2
48#define GL_LOW_INT 0x8DF3
49#define GL_MEDIUM_INT 0x8DF4
50#define GL_HIGH_INT 0x8DF5
51#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
52#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
53#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
54#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
55#define GL_MAX_VARYING_VECTORS 0x8DFC
56#define GL_SHADER_BINARY_FORMATS 0x8DF8
57#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
58#define GL_SHADER_COMPILER 0x8DFA
59#define GL_RGB565 0x8D62
60#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B
61#define GL_RGB8_OES 0x8051
62#define GL_RGBA8_OES 0x8058
63#define GL_HALF_FLOAT_OES 0x8D61
64
65// GL_OES_EGL_image_external
66#define GL_TEXTURE_EXTERNAL_OES 0x8D65
67#define GL_SAMPLER_EXTERNAL_OES 0x8D66
68#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67
69#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68
70
71// GL_ANGLE_translated_shader_source
72#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0
73
[email protected]cb68eca2013-02-15 07:38:3874#define GL_UNPACK_COLORSPACE_CONVERSION_CHROMIUM 0x9243
[email protected]6eda6822014-04-03 23:00:5075#define GL_BIND_GENERATES_RESOURCE_CHROMIUM 0x9244
[email protected]cb68eca2013-02-15 07:38:3876
[email protected]cb68eca2013-02-15 07:38:3877// GL_ANGLE_pack_reverse_row_order
78#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4
79
80// GL_ANGLE_texture_usage
81#define GL_TEXTURE_USAGE_ANGLE 0x93A2
82#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3
83
84// GL_EXT_texture_storage
85#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F
86#define GL_ALPHA8_EXT 0x803C
87#define GL_LUMINANCE8_EXT 0x8040
88#define GL_LUMINANCE8_ALPHA8_EXT 0x8045
89#define GL_RGBA32F_EXT 0x8814
90#define GL_RGB32F_EXT 0x8815
91#define GL_ALPHA32F_EXT 0x8816
92#define GL_LUMINANCE32F_EXT 0x8818
93#define GL_LUMINANCE_ALPHA32F_EXT 0x8819
94#define GL_RGBA16F_EXT 0x881A
95#define GL_RGB16F_EXT 0x881B
hendrikwbef24f5c2014-12-05 01:01:4296#define GL_RG16F_EXT 0x822F
97#define GL_R16F_EXT 0x822D
[email protected]cb68eca2013-02-15 07:38:3898#define GL_ALPHA16F_EXT 0x881C
99#define GL_LUMINANCE16F_EXT 0x881E
100#define GL_LUMINANCE_ALPHA16F_EXT 0x881F
hendrikwbef24f5c2014-12-05 01:01:42101#define GL_R32F_EXT 0x822E
102#define GL_RG32F_EXT 0x8230
[email protected]cb68eca2013-02-15 07:38:38103#define GL_BGRA8_EXT 0x93A1
104
105// GL_ANGLE_instanced_arrays
106#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE
107
108// GL_EXT_occlusion_query_boolean
109#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F
110#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A
111#define GL_CURRENT_QUERY_EXT 0x8865
112#define GL_QUERY_RESULT_EXT 0x8866
113#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867
114
115// GL_CHROMIUM_command_buffer_query
dongseong.hwang7ce131d42014-11-20 00:02:31116#define GL_COMMANDS_ISSUED_CHROMIUM 0x6004
[email protected]cb68eca2013-02-15 07:38:38117
118/* GL_CHROMIUM_get_error_query */
dongseong.hwang7ce131d42014-11-20 00:02:31119#define GL_GET_ERROR_QUERY_CHROMIUM 0x6003
[email protected]cb68eca2013-02-15 07:38:38120
121/* GL_CHROMIUM_command_buffer_latency_query */
dongseong.hwang7ce131d42014-11-20 00:02:31122#define GL_LATENCY_QUERY_CHROMIUM 0x6007
[email protected]cb68eca2013-02-15 07:38:38123
124/* GL_CHROMIUM_async_pixel_transfers */
dongseong.hwang7ce131d42014-11-20 00:02:31125#define GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM 0x6006
[email protected]cb68eca2013-02-15 07:38:38126
[email protected]6a25ae422014-04-17 23:48:27127// GL_CHROMIUM_sync_query
128#define GL_COMMANDS_COMPLETED_CHROMIUM 0x84F7
129
reveman32115e52014-10-02 19:01:03130// GL_CHROMIUM_gpu_memory_buffer_image
revemaneb0fda22015-10-26 20:27:47131#define GL_READ_WRITE_CHROMIUM 0x78F2
reveman32115e52014-10-02 19:01:03132
emircanf21bee9b2015-04-11 04:58:11133// GL_CHROMIUM_yuv_420_image
134#define GL_RGB_YUV_420_CHROMIUM 0x78FA
135
dcastagnaa93c58151c02015-08-26 22:08:34136// GL_CHROMIUM_ycbcr_422_image
137#define GL_RGB_YCBCR_422_CHROMIUM 0x78FB
138
dcastagnaf0b514c2015-12-04 06:06:14139// GL_CHROMIUM_ycbcr_420v_image
140#define GL_RGB_YCBCR_420V_CHROMIUM 0x78FC
141
[email protected]d286ebbc2014-07-03 17:19:10142// GL_CHROMIUM_schedule_overlay_plane
143#define GL_OVERLAY_TRANSFORM_NONE_CHROMIUM 0x9245
144#define GL_OVERLAY_TRANSFORM_FLIP_HORIZONTAL_CHROMIUM 0x9246
145#define GL_OVERLAY_TRANSFORM_FLIP_VERTICAL_CHROMIUM 0x9247
146#define GL_OVERLAY_TRANSFORM_ROTATE_90_CHROMIUM 0x9248
147#define GL_OVERLAY_TRANSFORM_ROTATE_180_CHROMIUM 0x9249
148#define GL_OVERLAY_TRANSFORM_ROTATE_270_CHROMIUM 0x924A
149
orglofchcad5a6742014-11-07 19:51:12150// GL_CHROMIUM_subscribe_uniforms
151#define GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM 0x924B
152#define GL_MOUSE_POSITION_CHROMIUM 0x924C
153
[email protected]cb68eca2013-02-15 07:38:38154// GL_OES_texure_3D
155#define GL_SAMPLER_3D_OES 0x8B5F
156
157// GL_OES_depth24
158#define GL_DEPTH_COMPONENT24_OES 0x81A6
159
160// GL_OES_depth32
161#define GL_DEPTH_COMPONENT32_OES 0x81A7
162
163// GL_OES_packed_depth_stencil
164#ifndef GL_DEPTH24_STENCIL8_OES
165#define GL_DEPTH24_STENCIL8_OES 0x88F0
166#endif
167
168#ifndef GL_DEPTH24_STENCIL8
169#define GL_DEPTH24_STENCIL8 0x88F0
170#endif
171
172// GL_OES_compressed_ETC1_RGB8_texture
173#define GL_ETC1_RGB8_OES 0x8D64
174
[email protected]8aec81ec2014-04-29 01:04:51175// GL_AMD_compressed_ATC_texture
176#define GL_ATC_RGB_AMD 0x8C92
177#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
178#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
179
180// GL_IMG_texture_compression_pvrtc
181#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
182#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
183#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
184#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
185
[email protected]cb68eca2013-02-15 07:38:38186// GL_OES_vertex_array_object
187#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5
188
189// GL_CHROMIUM_pixel_transfer_buffer_object
190#define GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM 0x78EC
[email protected]de43f082013-04-02 01:16:10191#define GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM 0x78ED
192#define GL_PIXEL_PACK_TRANSFER_BUFFER_BINDING_CHROMIUM 0x78EE
[email protected]cb68eca2013-02-15 07:38:38193#define GL_PIXEL_UNPACK_TRANSFER_BUFFER_BINDING_CHROMIUM 0x78EF
194
195/* GL_EXT_discard_framebuffer */
196#ifndef GL_EXT_discard_framebuffer
197#define GL_COLOR_EXT 0x1800
198#define GL_DEPTH_EXT 0x1801
199#define GL_STENCIL_EXT 0x1802
200#endif
201
bajones2a2ea232014-10-13 21:38:59202// GL_EXT_sRGB
203#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210
204
[email protected]cb68eca2013-02-15 07:38:38205// GL_ARB_get_program_binary
206#define PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
207// GL_OES_get_program_binary
208#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741
209#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE
210#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF
211
[email protected]7d3c36e2013-07-12 14:13:16212#ifndef GL_EXT_multisampled_render_to_texture
213#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
214#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
215#define GL_MAX_SAMPLES_EXT 0x8D57
216#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C
217#endif
218
219#ifndef GL_IMG_multisampled_render_to_texture
220#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133
221#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134
222#define GL_MAX_SAMPLES_IMG 0x9135
223#define GL_TEXTURE_SAMPLES_IMG 0x9136
224#endif
[email protected]cb68eca2013-02-15 07:38:38225
kkinnunen337d59632014-08-26 10:19:57226#ifndef GL_CHROMIUM_path_rendering
kkinnunenb959a8462015-07-14 11:08:34227#define GL_CHROMIUM_path_rendering 1
kkinnunen337d59632014-08-26 10:19:57228// These match the corresponding values in NV_path_rendering
229// extension, eg tokens with CHROMIUM replaced with NV.
230#define GL_PATH_MODELVIEW_MATRIX_CHROMIUM 0x0BA6
231#define GL_PATH_PROJECTION_MATRIX_CHROMIUM 0x0BA7
232#define GL_PATH_MODELVIEW_CHROMIUM 0x1700
233#define GL_PATH_PROJECTION_CHROMIUM 0x1701
kkinnunenb959a8462015-07-14 11:08:34234#define GL_FLAT_CHROMIUM 0x1D00
235#define GL_CLOSE_PATH_CHROMIUM 0x00
236#define GL_MOVE_TO_CHROMIUM 0x02
237#define GL_LINE_TO_CHROMIUM 0x04
238#define GL_QUADRATIC_CURVE_TO_CHROMIUM 0x0A
239#define GL_CUBIC_CURVE_TO_CHROMIUM 0x0C
240#define GL_CONIC_CURVE_TO_CHROMIUM 0x1A
kkinnunenc8b449e1582015-11-02 07:57:51241#define GL_EYE_LINEAR_CHROMIUM 0x2400
242#define GL_OBJECT_LINEAR_CHROMIUM 0x2401
243#define GL_CONSTANT_CHROMIUM 0x8576
kkinnunenb959a8462015-07-14 11:08:34244#define GL_PATH_STROKE_WIDTH_CHROMIUM 0x9075
245#define GL_PATH_END_CAPS_CHROMIUM 0x9076
246#define GL_PATH_JOIN_STYLE_CHROMIUM 0x9079
247#define GL_PATH_MITER_LIMIT_CHROMIUM 0x907a
248#define GL_PATH_STROKE_BOUND_CHROMIUM 0x9086
249#define GL_COUNT_UP_CHROMIUM 0x9088
250#define GL_COUNT_DOWN_CHROMIUM 0x9089
251#define GL_CONVEX_HULL_CHROMIUM 0x908B
252#define GL_BOUNDING_BOX_CHROMIUM 0x908D
kkinnunenfb3f1172015-10-28 08:50:00253#define GL_TRANSLATE_X_CHROMIUM 0x908E
254#define GL_TRANSLATE_Y_CHROMIUM 0x908F
255#define GL_TRANSLATE_2D_CHROMIUM 0x9090
256#define GL_TRANSLATE_3D_CHROMIUM 0x9091
257#define GL_AFFINE_2D_CHROMIUM 0x9092
258#define GL_AFFINE_3D_CHROMIUM 0x9094
259#define GL_TRANSPOSE_AFFINE_2D_CHROMIUM 0x9096
260#define GL_TRANSPOSE_AFFINE_3D_CHROMIUM 0x9098
261#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM 0x909C
kkinnunenb959a8462015-07-14 11:08:34262#define GL_SQUARE_CHROMIUM 0x90a3
263#define GL_ROUND_CHROMIUM 0x90a4
264#define GL_BEVEL_CHROMIUM 0x90a6
265#define GL_MITER_REVERT_CHROMIUM 0x90a7
266#define GL_PATH_STENCIL_FUNC_CHROMIUM 0x90B7
267#define GL_PATH_STENCIL_REF_CHROMIUM 0x90B8
268#define GL_PATH_STENCIL_VALUE_MASK_CHROMIUM 0x90B9
kkinnunen337d59632014-08-26 10:19:57269#endif
270
kkinnunenf26d7382015-12-01 13:34:14271#ifndef GL_EXT_multisample_compatibility
272#define GL_EXT_multisample_compatibility 1
273#define GL_MULTISAMPLE_EXT 0x809D
274#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F
275#endif /* GL_EXT_multisample_compatibility */
276
kkinnunena9d27e72015-12-21 17:23:44277#ifndef GL_CHROMIUM_framebuffer_mixed_samples
278#define GL_CHROMIUM_framebuffer_mixed_samples 1
279#define GL_COVERAGE_MODULATION_CHROMIUM 0x9332
280#endif /* GL_CHROMIUM_framebuffer_mixed_samples */
281
ed9198b422014-10-23 15:01:37282#ifndef GL_KHR_blend_equation_advanced
283#define GL_KHR_blend_equation_advanced 1
284#define GL_COLORBURN_KHR 0x929A
285#define GL_COLORDODGE_KHR 0x9299
286#define GL_DARKEN_KHR 0x9297
287#define GL_DIFFERENCE_KHR 0x929E
288#define GL_EXCLUSION_KHR 0x92A0
289#define GL_HARDLIGHT_KHR 0x929B
290#define GL_HSL_COLOR_KHR 0x92AF
291#define GL_HSL_HUE_KHR 0x92AD
292#define GL_HSL_LUMINOSITY_KHR 0x92B0
293#define GL_HSL_SATURATION_KHR 0x92AE
294#define GL_LIGHTEN_KHR 0x9298
295#define GL_MULTIPLY_KHR 0x9294
296#define GL_OVERLAY_KHR 0x9296
297#define GL_SCREEN_KHR 0x9295
298#define GL_SOFTLIGHT_KHR 0x929C
299#endif /* GL_KHR_blend_equation_advanced */
300
301#ifndef GL_KHR_blend_equation_advanced_coherent
302#define GL_KHR_blend_equation_advanced_coherent 1
303#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285
304#endif /* GL_KHR_blend_equation_advanced_coherent */
305
dyen882e1b72014-09-03 16:36:49306#ifndef GL_EXT_disjoint_timer_query
307#define GL_EXT_disjoint_timer_query 1
308#define GL_QUERY_COUNTER_BITS_EXT 0x8864
309#define GL_TIME_ELAPSED_EXT 0x88BF
310#define GL_TIMESTAMP_EXT 0x8E28
311#define GL_GPU_DISJOINT_EXT 0x8FBB
312#endif
313
oetuaho37cc50e2014-10-31 11:19:20314#ifndef GL_KHR_robustness
315#define GL_KHR_robustness 1
316#define GL_CONTEXT_ROBUST_ACCESS_KHR 0x90F3
317#define GL_LOSE_CONTEXT_ON_RESET_KHR 0x8252
318#define GL_GUILTY_CONTEXT_RESET_KHR 0x8253
319#define GL_INNOCENT_CONTEXT_RESET_KHR 0x8254
320#define GL_UNKNOWN_CONTEXT_RESET_KHR 0x8255
321#define GL_RESET_NOTIFICATION_STRATEGY_KHR 0x8256
322#define GL_NO_RESET_NOTIFICATION_KHR 0x8261
323#define GL_CONTEXT_LOST_KHR 0x0507
324#endif /* GL_KHR_robustness */
325
hendrikw83f2fb52014-12-02 03:30:40326#ifndef GL_EXT_texture_rg
327#define GL_EXT_texture_rg 1
328#define GL_RED_EXT 0x1903
329#define GL_RG_EXT 0x8227
330#define GL_R8_EXT 0x8229
331#define GL_RG8_EXT 0x822B
332#endif /* GL_EXT_texture_rg */
333
kkinnunenc8b449e1582015-11-02 07:57:51334// This is from NV_path_rendering, but the Mesa GL header is not up-to-date with
335// the most recent
336// version of the extension. This definition could be removed once glext.h
337// r27498 or later is
338// imported.
339#ifndef GL_FRAGMENT_INPUT_NV
340#define GL_FRAGMENT_INPUT_NV 0x936D
341#endif
342
kkinnunen8cefb232015-12-04 09:36:31343#ifndef GL_EXT_blend_func_extended
344#define GL_EXT_blend_func_extended 1
345#define GL_SRC_ALPHA_SATURATE_EXT 0x0308
346#define GL_SRC1_ALPHA_EXT 0x8589 // OpenGL 1.5 token value
347#define GL_SRC1_COLOR_EXT 0x88F9
348#define GL_ONE_MINUS_SRC1_COLOR_EXT 0x88FA
349#define GL_ONE_MINUS_SRC1_ALPHA_EXT 0x88FB
350#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT 0x88FC
351#endif /* GL_EXT_blend_func_extended */
352
[email protected]cb68eca2013-02-15 07:38:38353#define GL_GLEXT_PROTOTYPES 1
354
[email protected]b9363b22010-06-09 22:06:15355#if defined(OS_WIN)
356#define GL_BINDING_CALL WINAPI
357#else
358#define GL_BINDING_CALL
359#endif
360
[email protected]218a5a22010-11-04 19:27:49361#define GL_SERVICE_LOG(args) DLOG(INFO) << args;
[email protected]5a83fca2012-04-22 02:05:08362#if defined(NDEBUG)
[email protected]92afb772011-12-09 01:49:56363 #define GL_SERVICE_LOG_CODE_BLOCK(code)
364#else
365 #define GL_SERVICE_LOG_CODE_BLOCK(code) code
366#endif
[email protected]218a5a22010-11-04 19:27:49367
[email protected]b9363b22010-06-09 22:06:15368// Forward declare OSMesa types.
369typedef struct osmesa_context *OSMesaContext;
370typedef void (*OSMESAproc)();
371
[email protected]b9363b22010-06-09 22:06:15372// Forward declare EGL types.
avi739878c2015-12-24 18:06:17373typedef uint64_t EGLuint64CHROMIUM;
[email protected]b9363b22010-06-09 22:06:15374
375#include "gl_bindings_autogen_gl.h"
376#include "gl_bindings_autogen_osmesa.h"
377
378#if defined(OS_WIN)
379#include "gl_bindings_autogen_egl.h"
380#include "gl_bindings_autogen_wgl.h"
[email protected]2ec8df52011-05-25 23:44:58381#elif defined(USE_X11)
[email protected]0bec8e22010-06-21 22:20:02382#include "gl_bindings_autogen_egl.h"
[email protected]b9363b22010-06-09 22:06:15383#include "gl_bindings_autogen_glx.h"
[email protected]efcf20592013-05-24 06:55:56384#elif defined(USE_OZONE)
385#include "gl_bindings_autogen_egl.h"
[email protected]c8e295b2011-11-21 21:24:14386#elif defined(OS_ANDROID)
387#include "gl_bindings_autogen_egl.h"
[email protected]b9363b22010-06-09 22:06:15388#endif
389
390namespace gfx {
391
[email protected]8f1d2aa2013-05-10 23:45:38392struct GL_EXPORT DriverGL {
[email protected]a37d7ff2014-01-17 21:31:00393 void InitializeStaticBindings();
394 void InitializeCustomDynamicBindings(GLContext* context);
[email protected]8f1d2aa2013-05-10 23:45:38395 void InitializeDebugBindings();
[email protected]70c908c2014-01-12 02:09:45396 void InitializeNullDrawBindings();
[email protected]ae967b02014-02-21 21:18:58397 // TODO(danakj): Remove this when all test suites are using null-draw.
398 bool HasInitializedNullDrawBindings();
[email protected]2fc82a92014-02-20 22:52:08399 bool SetNullDrawBindingsEnabled(bool enabled);
[email protected]8f1d2aa2013-05-10 23:45:38400 void ClearBindings();
[email protected]8f1d2aa2013-05-10 23:45:38401
402 ProcsGL fn;
403 ProcsGL orig_fn;
404 ProcsGL debug_fn;
405 ExtensionsGL ext;
[email protected]2fc82a92014-02-20 22:52:08406 bool null_draw_bindings_enabled;
[email protected]8f1d2aa2013-05-10 23:45:38407
408 private:
[email protected]a37d7ff2014-01-17 21:31:00409 void InitializeDynamicBindings(GLContext* context);
[email protected]8f1d2aa2013-05-10 23:45:38410};
411
412struct GL_EXPORT DriverOSMESA {
[email protected]a37d7ff2014-01-17 21:31:00413 void InitializeStaticBindings();
tobiasjsbbda4652015-06-26 23:08:53414 void InitializeExtensionBindings();
[email protected]8f1d2aa2013-05-10 23:45:38415 void InitializeDebugBindings();
416 void ClearBindings();
[email protected]8f1d2aa2013-05-10 23:45:38417
418 ProcsOSMESA fn;
419 ProcsOSMESA debug_fn;
420 ExtensionsOSMESA ext;
sieverse3b17fd52015-01-29 04:00:53421
422 private:
423 static std::string GetPlatformExtensions();
[email protected]8f1d2aa2013-05-10 23:45:38424};
425
426#if defined(OS_WIN)
427struct GL_EXPORT DriverWGL {
[email protected]a37d7ff2014-01-17 21:31:00428 void InitializeStaticBindings();
tobiasjsbbda4652015-06-26 23:08:53429 void InitializeExtensionBindings();
[email protected]8f1d2aa2013-05-10 23:45:38430 void InitializeDebugBindings();
431 void ClearBindings();
[email protected]8f1d2aa2013-05-10 23:45:38432
433 ProcsWGL fn;
434 ProcsWGL debug_fn;
435 ExtensionsWGL ext;
sieverse3b17fd52015-01-29 04:00:53436
437 private:
438 static std::string GetPlatformExtensions();
[email protected]8f1d2aa2013-05-10 23:45:38439};
440#endif
441
[email protected]efcf20592013-05-24 06:55:56442#if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || defined(USE_OZONE)
[email protected]8f1d2aa2013-05-10 23:45:38443struct GL_EXPORT DriverEGL {
[email protected]a37d7ff2014-01-17 21:31:00444 void InitializeStaticBindings();
tobiasjsbbda4652015-06-26 23:08:53445 void InitializeExtensionBindings();
[email protected]8f1d2aa2013-05-10 23:45:38446 void InitializeDebugBindings();
447 void ClearBindings();
[email protected]8f1d2aa2013-05-10 23:45:38448
449 ProcsEGL fn;
450 ProcsEGL debug_fn;
451 ExtensionsEGL ext;
sieverse3b17fd52015-01-29 04:00:53452
sieverse3b17fd52015-01-29 04:00:53453 static std::string GetPlatformExtensions();
jmadillc3cfb9c2015-04-14 21:13:58454 static std::string GetClientExtensions();
[email protected]8f1d2aa2013-05-10 23:45:38455};
456#endif
457
458#if defined(USE_X11)
459struct GL_EXPORT DriverGLX {
[email protected]a37d7ff2014-01-17 21:31:00460 void InitializeStaticBindings();
tobiasjsbbda4652015-06-26 23:08:53461 void InitializeExtensionBindings();
[email protected]8f1d2aa2013-05-10 23:45:38462 void InitializeDebugBindings();
463 void ClearBindings();
[email protected]8f1d2aa2013-05-10 23:45:38464
465 ProcsGLX fn;
466 ProcsGLX debug_fn;
467 ExtensionsGLX ext;
sieverse3b17fd52015-01-29 04:00:53468
469 private:
470 static std::string GetPlatformExtensions();
[email protected]8f1d2aa2013-05-10 23:45:38471};
472#endif
473
[email protected]06a1a6922013-07-26 11:51:52474// This #define is here to support autogenerated code.
475#define g_current_gl_context g_current_gl_context_tls->Get()
476GL_EXPORT extern base::ThreadLocalPointer<GLApi>* g_current_gl_context_tls;
477
[email protected]b97c9082012-10-25 17:21:38478GL_EXPORT extern OSMESAApi* g_current_osmesa_context;
479GL_EXPORT extern DriverGL g_driver_gl;
480GL_EXPORT extern DriverOSMESA g_driver_osmesa;
481
482#if defined(OS_WIN)
483
484GL_EXPORT extern EGLApi* g_current_egl_context;
485GL_EXPORT extern WGLApi* g_current_wgl_context;
486GL_EXPORT extern DriverEGL g_driver_egl;
487GL_EXPORT extern DriverWGL g_driver_wgl;
488
489#elif defined(USE_X11)
490
491GL_EXPORT extern EGLApi* g_current_egl_context;
492GL_EXPORT extern GLXApi* g_current_glx_context;
493GL_EXPORT extern DriverEGL g_driver_egl;
494GL_EXPORT extern DriverGLX g_driver_glx;
495
[email protected]efcf20592013-05-24 06:55:56496#elif defined(USE_OZONE)
497
498GL_EXPORT extern EGLApi* g_current_egl_context;
499GL_EXPORT extern DriverEGL g_driver_egl;
500
[email protected]b97c9082012-10-25 17:21:38501#elif defined(OS_ANDROID)
502
503GL_EXPORT extern EGLApi* g_current_egl_context;
504GL_EXPORT extern DriverEGL g_driver_egl;
505
506#endif
507
[email protected]b9363b22010-06-09 22:06:15508} // namespace gfx
509
[email protected]c9e2cbbb2012-05-12 21:17:27510#endif // UI_GL_GL_BINDINGS_H_