blob: 5218a5f73fe778cb0b9470464f30d94974fc99a7 [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
markdittmer6e70beb82016-05-02 05:40:4713// GL headers may include inttypes.h and so we need to ensure that
14// __STDC_FORMAT_MACROS is defined in order for //base/format_macros.h to
15// function correctly. See comment and #error message in //base/format_macros.h
16// for details.
17#if defined(OS_POSIX) && !defined(__STDC_FORMAT_MACROS)
18#define __STDC_FORMAT_MACROS
19#endif
20
[email protected]b9363b22010-06-09 22:06:1521#include <GL/gl.h>
22#include <GL/glext.h>
[email protected]b040f9d2013-01-19 04:27:0023#include <EGL/egl.h>
24#include <EGL/eglext.h>
avi9c81217b2015-12-24 23:40:0525#include <stdint.h>
26
27#include <string>
[email protected]b9363b22010-06-09 22:06:1528
[email protected]218a5a22010-11-04 19:27:4929#include "base/logging.h"
[email protected]06a1a6922013-07-26 11:51:5230#include "base/threading/thread_local.h"
[email protected]c9e2cbbb2012-05-12 21:17:2731#include "build/build_config.h"
32#include "ui/gl/gl_export.h"
[email protected]b9363b22010-06-09 22:06:1533
34// The standard OpenGL native extension headers are also included.
35#if defined(OS_WIN)
36#include <GL/wglext.h>
[email protected]2ec8df52011-05-25 23:44:5837#elif defined(OS_MACOSX)
38#include <OpenGL/OpenGL.h>
kylechare1872ee2016-04-25 15:00:4739#elif defined(USE_GLX)
[email protected]b9363b22010-06-09 22:06:1540#include <GL/glx.h>
41#include <GL/glxext.h>
markdittmer276736a2016-05-09 20:13:2342#endif
[email protected]31c31b2b2011-09-27 18:58:2943
44// Undefine some macros defined by X headers. This is why this file should only
45// be included in .cc files.
46#undef Bool
47#undef None
48#undef Status
[email protected]b9363b22010-06-09 22:06:1549
[email protected]cb68eca2013-02-15 07:38:3850
51// GLES2 defines not part of Desktop GL
52// Shader Precision-Specified Types
53#define GL_LOW_FLOAT 0x8DF0
54#define GL_MEDIUM_FLOAT 0x8DF1
55#define GL_HIGH_FLOAT 0x8DF2
56#define GL_LOW_INT 0x8DF3
57#define GL_MEDIUM_INT 0x8DF4
58#define GL_HIGH_INT 0x8DF5
59#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
60#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
61#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
62#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
63#define GL_MAX_VARYING_VECTORS 0x8DFC
64#define GL_SHADER_BINARY_FORMATS 0x8DF8
65#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
66#define GL_SHADER_COMPILER 0x8DFA
67#define GL_RGB565 0x8D62
68#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B
69#define GL_RGB8_OES 0x8051
70#define GL_RGBA8_OES 0x8058
71#define GL_HALF_FLOAT_OES 0x8D61
72
73// GL_OES_EGL_image_external
74#define GL_TEXTURE_EXTERNAL_OES 0x8D65
75#define GL_SAMPLER_EXTERNAL_OES 0x8D66
76#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67
77#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68
78
79// GL_ANGLE_translated_shader_source
80#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0
81
[email protected]cb68eca2013-02-15 07:38:3882#define GL_UNPACK_COLORSPACE_CONVERSION_CHROMIUM 0x9243
[email protected]6eda6822014-04-03 23:00:5083#define GL_BIND_GENERATES_RESOURCE_CHROMIUM 0x9244
[email protected]cb68eca2013-02-15 07:38:3884
[email protected]cb68eca2013-02-15 07:38:3885// GL_ANGLE_texture_usage
86#define GL_TEXTURE_USAGE_ANGLE 0x93A2
87#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3
88
89// GL_EXT_texture_storage
90#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F
91#define GL_ALPHA8_EXT 0x803C
92#define GL_LUMINANCE8_EXT 0x8040
93#define GL_LUMINANCE8_ALPHA8_EXT 0x8045
94#define GL_RGBA32F_EXT 0x8814
95#define GL_RGB32F_EXT 0x8815
96#define GL_ALPHA32F_EXT 0x8816
97#define GL_LUMINANCE32F_EXT 0x8818
98#define GL_LUMINANCE_ALPHA32F_EXT 0x8819
99#define GL_RGBA16F_EXT 0x881A
100#define GL_RGB16F_EXT 0x881B
hendrikwbef24f5c2014-12-05 01:01:42101#define GL_RG16F_EXT 0x822F
102#define GL_R16F_EXT 0x822D
[email protected]cb68eca2013-02-15 07:38:38103#define GL_ALPHA16F_EXT 0x881C
104#define GL_LUMINANCE16F_EXT 0x881E
105#define GL_LUMINANCE_ALPHA16F_EXT 0x881F
hendrikwbef24f5c2014-12-05 01:01:42106#define GL_R32F_EXT 0x822E
107#define GL_RG32F_EXT 0x8230
[email protected]cb68eca2013-02-15 07:38:38108#define GL_BGRA8_EXT 0x93A1
109
110// GL_ANGLE_instanced_arrays
111#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE
112
113// GL_EXT_occlusion_query_boolean
114#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F
115#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A
116#define GL_CURRENT_QUERY_EXT 0x8865
117#define GL_QUERY_RESULT_EXT 0x8866
118#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867
119
120// GL_CHROMIUM_command_buffer_query
dongseong.hwang7ce131d42014-11-20 00:02:31121#define GL_COMMANDS_ISSUED_CHROMIUM 0x6004
[email protected]cb68eca2013-02-15 07:38:38122
123/* GL_CHROMIUM_get_error_query */
dongseong.hwang7ce131d42014-11-20 00:02:31124#define GL_GET_ERROR_QUERY_CHROMIUM 0x6003
[email protected]cb68eca2013-02-15 07:38:38125
126/* GL_CHROMIUM_command_buffer_latency_query */
dongseong.hwang7ce131d42014-11-20 00:02:31127#define GL_LATENCY_QUERY_CHROMIUM 0x6007
[email protected]cb68eca2013-02-15 07:38:38128
129/* GL_CHROMIUM_async_pixel_transfers */
dongseong.hwang7ce131d42014-11-20 00:02:31130#define GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM 0x6006
[email protected]cb68eca2013-02-15 07:38:38131
[email protected]6a25ae422014-04-17 23:48:27132// GL_CHROMIUM_sync_query
133#define GL_COMMANDS_COMPLETED_CHROMIUM 0x84F7
134
reveman32115e52014-10-02 19:01:03135// GL_CHROMIUM_gpu_memory_buffer_image
revemaneb0fda22015-10-26 20:27:47136#define GL_READ_WRITE_CHROMIUM 0x78F2
reveman32115e52014-10-02 19:01:03137
emircanf21bee9b2015-04-11 04:58:11138// GL_CHROMIUM_yuv_420_image
139#define GL_RGB_YUV_420_CHROMIUM 0x78FA
140
dcastagnaa93c58151c02015-08-26 22:08:34141// GL_CHROMIUM_ycbcr_422_image
142#define GL_RGB_YCBCR_422_CHROMIUM 0x78FB
143
dcastagnaf0b514c2015-12-04 06:06:14144// GL_CHROMIUM_ycbcr_420v_image
145#define GL_RGB_YCBCR_420V_CHROMIUM 0x78FC
146
[email protected]d286ebbc2014-07-03 17:19:10147// GL_CHROMIUM_schedule_overlay_plane
148#define GL_OVERLAY_TRANSFORM_NONE_CHROMIUM 0x9245
149#define GL_OVERLAY_TRANSFORM_FLIP_HORIZONTAL_CHROMIUM 0x9246
150#define GL_OVERLAY_TRANSFORM_FLIP_VERTICAL_CHROMIUM 0x9247
151#define GL_OVERLAY_TRANSFORM_ROTATE_90_CHROMIUM 0x9248
152#define GL_OVERLAY_TRANSFORM_ROTATE_180_CHROMIUM 0x9249
153#define GL_OVERLAY_TRANSFORM_ROTATE_270_CHROMIUM 0x924A
154
orglofchcad5a6742014-11-07 19:51:12155// GL_CHROMIUM_subscribe_uniforms
156#define GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM 0x924B
157#define GL_MOUSE_POSITION_CHROMIUM 0x924C
158
[email protected]cb68eca2013-02-15 07:38:38159// GL_OES_texure_3D
160#define GL_SAMPLER_3D_OES 0x8B5F
161
162// GL_OES_depth24
163#define GL_DEPTH_COMPONENT24_OES 0x81A6
164
165// GL_OES_depth32
166#define GL_DEPTH_COMPONENT32_OES 0x81A7
167
168// GL_OES_packed_depth_stencil
169#ifndef GL_DEPTH24_STENCIL8_OES
170#define GL_DEPTH24_STENCIL8_OES 0x88F0
171#endif
172
173#ifndef GL_DEPTH24_STENCIL8
174#define GL_DEPTH24_STENCIL8 0x88F0
175#endif
176
177// GL_OES_compressed_ETC1_RGB8_texture
178#define GL_ETC1_RGB8_OES 0x8D64
179
[email protected]8aec81ec2014-04-29 01:04:51180// GL_AMD_compressed_ATC_texture
181#define GL_ATC_RGB_AMD 0x8C92
182#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
183#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
184
185// GL_IMG_texture_compression_pvrtc
186#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
187#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
188#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
189#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
190
[email protected]cb68eca2013-02-15 07:38:38191// GL_OES_vertex_array_object
192#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5
193
194// GL_CHROMIUM_pixel_transfer_buffer_object
195#define GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM 0x78EC
[email protected]de43f082013-04-02 01:16:10196#define GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM 0x78ED
197#define GL_PIXEL_PACK_TRANSFER_BUFFER_BINDING_CHROMIUM 0x78EE
[email protected]cb68eca2013-02-15 07:38:38198#define GL_PIXEL_UNPACK_TRANSFER_BUFFER_BINDING_CHROMIUM 0x78EF
199
200/* GL_EXT_discard_framebuffer */
201#ifndef GL_EXT_discard_framebuffer
202#define GL_COLOR_EXT 0x1800
203#define GL_DEPTH_EXT 0x1801
204#define GL_STENCIL_EXT 0x1802
205#endif
206
bajones2a2ea232014-10-13 21:38:59207// GL_EXT_sRGB
208#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210
209
[email protected]cb68eca2013-02-15 07:38:38210// GL_ARB_get_program_binary
211#define PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
212// GL_OES_get_program_binary
213#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741
214#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE
215#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF
216
[email protected]7d3c36e2013-07-12 14:13:16217#ifndef GL_EXT_multisampled_render_to_texture
218#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
219#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
220#define GL_MAX_SAMPLES_EXT 0x8D57
221#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C
222#endif
223
224#ifndef GL_IMG_multisampled_render_to_texture
225#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133
226#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134
227#define GL_MAX_SAMPLES_IMG 0x9135
228#define GL_TEXTURE_SAMPLES_IMG 0x9136
229#endif
[email protected]cb68eca2013-02-15 07:38:38230
kkinnunen337d59632014-08-26 10:19:57231#ifndef GL_CHROMIUM_path_rendering
kkinnunenb959a8462015-07-14 11:08:34232#define GL_CHROMIUM_path_rendering 1
kkinnunen337d59632014-08-26 10:19:57233// These match the corresponding values in NV_path_rendering
234// extension, eg tokens with CHROMIUM replaced with NV.
235#define GL_PATH_MODELVIEW_MATRIX_CHROMIUM 0x0BA6
236#define GL_PATH_PROJECTION_MATRIX_CHROMIUM 0x0BA7
237#define GL_PATH_MODELVIEW_CHROMIUM 0x1700
238#define GL_PATH_PROJECTION_CHROMIUM 0x1701
kkinnunenb959a8462015-07-14 11:08:34239#define GL_FLAT_CHROMIUM 0x1D00
240#define GL_CLOSE_PATH_CHROMIUM 0x00
241#define GL_MOVE_TO_CHROMIUM 0x02
242#define GL_LINE_TO_CHROMIUM 0x04
243#define GL_QUADRATIC_CURVE_TO_CHROMIUM 0x0A
244#define GL_CUBIC_CURVE_TO_CHROMIUM 0x0C
245#define GL_CONIC_CURVE_TO_CHROMIUM 0x1A
kkinnunenc8b449e1582015-11-02 07:57:51246#define GL_EYE_LINEAR_CHROMIUM 0x2400
247#define GL_OBJECT_LINEAR_CHROMIUM 0x2401
248#define GL_CONSTANT_CHROMIUM 0x8576
kkinnunenb959a8462015-07-14 11:08:34249#define GL_PATH_STROKE_WIDTH_CHROMIUM 0x9075
250#define GL_PATH_END_CAPS_CHROMIUM 0x9076
251#define GL_PATH_JOIN_STYLE_CHROMIUM 0x9079
252#define GL_PATH_MITER_LIMIT_CHROMIUM 0x907a
253#define GL_PATH_STROKE_BOUND_CHROMIUM 0x9086
254#define GL_COUNT_UP_CHROMIUM 0x9088
255#define GL_COUNT_DOWN_CHROMIUM 0x9089
256#define GL_CONVEX_HULL_CHROMIUM 0x908B
257#define GL_BOUNDING_BOX_CHROMIUM 0x908D
kkinnunenfb3f1172015-10-28 08:50:00258#define GL_TRANSLATE_X_CHROMIUM 0x908E
259#define GL_TRANSLATE_Y_CHROMIUM 0x908F
260#define GL_TRANSLATE_2D_CHROMIUM 0x9090
261#define GL_TRANSLATE_3D_CHROMIUM 0x9091
262#define GL_AFFINE_2D_CHROMIUM 0x9092
263#define GL_AFFINE_3D_CHROMIUM 0x9094
264#define GL_TRANSPOSE_AFFINE_2D_CHROMIUM 0x9096
265#define GL_TRANSPOSE_AFFINE_3D_CHROMIUM 0x9098
266#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM 0x909C
kkinnunenb959a8462015-07-14 11:08:34267#define GL_SQUARE_CHROMIUM 0x90a3
268#define GL_ROUND_CHROMIUM 0x90a4
269#define GL_BEVEL_CHROMIUM 0x90a6
270#define GL_MITER_REVERT_CHROMIUM 0x90a7
271#define GL_PATH_STENCIL_FUNC_CHROMIUM 0x90B7
272#define GL_PATH_STENCIL_REF_CHROMIUM 0x90B8
273#define GL_PATH_STENCIL_VALUE_MASK_CHROMIUM 0x90B9
kkinnunen337d59632014-08-26 10:19:57274#endif
275
kkinnunenf26d7382015-12-01 13:34:14276#ifndef GL_EXT_multisample_compatibility
277#define GL_EXT_multisample_compatibility 1
278#define GL_MULTISAMPLE_EXT 0x809D
279#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F
280#endif /* GL_EXT_multisample_compatibility */
281
kkinnunena9d27e72015-12-21 17:23:44282#ifndef GL_CHROMIUM_framebuffer_mixed_samples
283#define GL_CHROMIUM_framebuffer_mixed_samples 1
284#define GL_COVERAGE_MODULATION_CHROMIUM 0x9332
285#endif /* GL_CHROMIUM_framebuffer_mixed_samples */
286
ed9198b422014-10-23 15:01:37287#ifndef GL_KHR_blend_equation_advanced
288#define GL_KHR_blend_equation_advanced 1
289#define GL_COLORBURN_KHR 0x929A
290#define GL_COLORDODGE_KHR 0x9299
291#define GL_DARKEN_KHR 0x9297
292#define GL_DIFFERENCE_KHR 0x929E
293#define GL_EXCLUSION_KHR 0x92A0
294#define GL_HARDLIGHT_KHR 0x929B
295#define GL_HSL_COLOR_KHR 0x92AF
296#define GL_HSL_HUE_KHR 0x92AD
297#define GL_HSL_LUMINOSITY_KHR 0x92B0
298#define GL_HSL_SATURATION_KHR 0x92AE
299#define GL_LIGHTEN_KHR 0x9298
300#define GL_MULTIPLY_KHR 0x9294
301#define GL_OVERLAY_KHR 0x9296
302#define GL_SCREEN_KHR 0x9295
303#define GL_SOFTLIGHT_KHR 0x929C
304#endif /* GL_KHR_blend_equation_advanced */
305
306#ifndef GL_KHR_blend_equation_advanced_coherent
307#define GL_KHR_blend_equation_advanced_coherent 1
308#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285
309#endif /* GL_KHR_blend_equation_advanced_coherent */
310
dyen882e1b72014-09-03 16:36:49311#ifndef GL_EXT_disjoint_timer_query
312#define GL_EXT_disjoint_timer_query 1
313#define GL_QUERY_COUNTER_BITS_EXT 0x8864
314#define GL_TIME_ELAPSED_EXT 0x88BF
315#define GL_TIMESTAMP_EXT 0x8E28
316#define GL_GPU_DISJOINT_EXT 0x8FBB
317#endif
318
oetuaho37cc50e2014-10-31 11:19:20319#ifndef GL_KHR_robustness
320#define GL_KHR_robustness 1
321#define GL_CONTEXT_ROBUST_ACCESS_KHR 0x90F3
322#define GL_LOSE_CONTEXT_ON_RESET_KHR 0x8252
323#define GL_GUILTY_CONTEXT_RESET_KHR 0x8253
324#define GL_INNOCENT_CONTEXT_RESET_KHR 0x8254
325#define GL_UNKNOWN_CONTEXT_RESET_KHR 0x8255
326#define GL_RESET_NOTIFICATION_STRATEGY_KHR 0x8256
327#define GL_NO_RESET_NOTIFICATION_KHR 0x8261
328#define GL_CONTEXT_LOST_KHR 0x0507
329#endif /* GL_KHR_robustness */
330
hendrikw83f2fb52014-12-02 03:30:40331#ifndef GL_EXT_texture_rg
332#define GL_EXT_texture_rg 1
333#define GL_RED_EXT 0x1903
334#define GL_RG_EXT 0x8227
335#define GL_R8_EXT 0x8229
336#define GL_RG8_EXT 0x822B
337#endif /* GL_EXT_texture_rg */
338
kkinnunenc8b449e1582015-11-02 07:57:51339// This is from NV_path_rendering, but the Mesa GL header is not up-to-date with
340// the most recent
341// version of the extension. This definition could be removed once glext.h
342// r27498 or later is
343// imported.
344#ifndef GL_FRAGMENT_INPUT_NV
345#define GL_FRAGMENT_INPUT_NV 0x936D
346#endif
347
kkinnunen8cefb232015-12-04 09:36:31348#ifndef GL_EXT_blend_func_extended
349#define GL_EXT_blend_func_extended 1
350#define GL_SRC_ALPHA_SATURATE_EXT 0x0308
351#define GL_SRC1_ALPHA_EXT 0x8589 // OpenGL 1.5 token value
352#define GL_SRC1_COLOR_EXT 0x88F9
353#define GL_ONE_MINUS_SRC1_COLOR_EXT 0x88FA
354#define GL_ONE_MINUS_SRC1_ALPHA_EXT 0x88FB
355#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT 0x88FC
356#endif /* GL_EXT_blend_func_extended */
357
[email protected]cb68eca2013-02-15 07:38:38358#define GL_GLEXT_PROTOTYPES 1
359
[email protected]b9363b22010-06-09 22:06:15360#if defined(OS_WIN)
361#define GL_BINDING_CALL WINAPI
362#else
363#define GL_BINDING_CALL
364#endif
365
[email protected]218a5a22010-11-04 19:27:49366#define GL_SERVICE_LOG(args) DLOG(INFO) << args;
[email protected]5a83fca2012-04-22 02:05:08367#if defined(NDEBUG)
[email protected]92afb772011-12-09 01:49:56368 #define GL_SERVICE_LOG_CODE_BLOCK(code)
369#else
370 #define GL_SERVICE_LOG_CODE_BLOCK(code) code
371#endif
[email protected]218a5a22010-11-04 19:27:49372
[email protected]b9363b22010-06-09 22:06:15373// Forward declare OSMesa types.
374typedef struct osmesa_context *OSMesaContext;
375typedef void (*OSMESAproc)();
376
[email protected]b9363b22010-06-09 22:06:15377// Forward declare EGL types.
avi739878c2015-12-24 18:06:17378typedef uint64_t EGLuint64CHROMIUM;
[email protected]b9363b22010-06-09 22:06:15379
380#include "gl_bindings_autogen_gl.h"
381#include "gl_bindings_autogen_osmesa.h"
382
kylechare1872ee2016-04-25 15:00:47383#if defined(USE_EGL)
384#include "gl_bindings_autogen_egl.h"
385#endif
386
[email protected]b9363b22010-06-09 22:06:15387#if defined(OS_WIN)
[email protected]b9363b22010-06-09 22:06:15388#include "gl_bindings_autogen_wgl.h"
kylechare1872ee2016-04-25 15:00:47389#endif
390
391#if defined(USE_GLX)
[email protected]b9363b22010-06-09 22:06:15392#include "gl_bindings_autogen_glx.h"
[email protected]b9363b22010-06-09 22:06:15393#endif
394
kylechar7a463842016-05-26 14:46:12395namespace gl {
[email protected]b9363b22010-06-09 22:06:15396
[email protected]8f1d2aa2013-05-10 23:45:38397struct GL_EXPORT DriverGL {
[email protected]a37d7ff2014-01-17 21:31:00398 void InitializeStaticBindings();
399 void InitializeCustomDynamicBindings(GLContext* context);
[email protected]8f1d2aa2013-05-10 23:45:38400 void InitializeDebugBindings();
[email protected]70c908c2014-01-12 02:09:45401 void InitializeNullDrawBindings();
[email protected]ae967b02014-02-21 21:18:58402 // TODO(danakj): Remove this when all test suites are using null-draw.
403 bool HasInitializedNullDrawBindings();
[email protected]2fc82a92014-02-20 22:52:08404 bool SetNullDrawBindingsEnabled(bool enabled);
[email protected]8f1d2aa2013-05-10 23:45:38405 void ClearBindings();
[email protected]8f1d2aa2013-05-10 23:45:38406
407 ProcsGL fn;
408 ProcsGL orig_fn;
409 ProcsGL debug_fn;
410 ExtensionsGL ext;
[email protected]2fc82a92014-02-20 22:52:08411 bool null_draw_bindings_enabled;
[email protected]8f1d2aa2013-05-10 23:45:38412
413 private:
[email protected]a37d7ff2014-01-17 21:31:00414 void InitializeDynamicBindings(GLContext* context);
[email protected]8f1d2aa2013-05-10 23:45:38415};
416
417struct GL_EXPORT DriverOSMESA {
[email protected]a37d7ff2014-01-17 21:31:00418 void InitializeStaticBindings();
tobiasjsbbda4652015-06-26 23:08:53419 void InitializeExtensionBindings();
[email protected]8f1d2aa2013-05-10 23:45:38420 void InitializeDebugBindings();
421 void ClearBindings();
[email protected]8f1d2aa2013-05-10 23:45:38422
423 ProcsOSMESA fn;
424 ProcsOSMESA debug_fn;
425 ExtensionsOSMESA ext;
sieverse3b17fd52015-01-29 04:00:53426
427 private:
428 static std::string GetPlatformExtensions();
[email protected]8f1d2aa2013-05-10 23:45:38429};
430
431#if defined(OS_WIN)
432struct GL_EXPORT DriverWGL {
[email protected]a37d7ff2014-01-17 21:31:00433 void InitializeStaticBindings();
tobiasjsbbda4652015-06-26 23:08:53434 void InitializeExtensionBindings();
[email protected]8f1d2aa2013-05-10 23:45:38435 void InitializeDebugBindings();
436 void ClearBindings();
[email protected]8f1d2aa2013-05-10 23:45:38437
438 ProcsWGL fn;
439 ProcsWGL debug_fn;
440 ExtensionsWGL ext;
sieverse3b17fd52015-01-29 04:00:53441
442 private:
443 static std::string GetPlatformExtensions();
[email protected]8f1d2aa2013-05-10 23:45:38444};
445#endif
446
kylechare1872ee2016-04-25 15:00:47447#if defined(USE_EGL)
[email protected]8f1d2aa2013-05-10 23:45:38448struct GL_EXPORT DriverEGL {
[email protected]a37d7ff2014-01-17 21:31:00449 void InitializeStaticBindings();
tobiasjsbbda4652015-06-26 23:08:53450 void InitializeExtensionBindings();
[email protected]8f1d2aa2013-05-10 23:45:38451 void InitializeDebugBindings();
452 void ClearBindings();
[email protected]8f1d2aa2013-05-10 23:45:38453
454 ProcsEGL fn;
455 ProcsEGL debug_fn;
456 ExtensionsEGL ext;
sieverse3b17fd52015-01-29 04:00:53457
sieverse3b17fd52015-01-29 04:00:53458 static std::string GetPlatformExtensions();
jmadillc3cfb9c2015-04-14 21:13:58459 static std::string GetClientExtensions();
[email protected]8f1d2aa2013-05-10 23:45:38460};
461#endif
462
kylechare1872ee2016-04-25 15:00:47463#if defined(USE_GLX)
[email protected]8f1d2aa2013-05-10 23:45:38464struct GL_EXPORT DriverGLX {
[email protected]a37d7ff2014-01-17 21:31:00465 void InitializeStaticBindings();
tobiasjsbbda4652015-06-26 23:08:53466 void InitializeExtensionBindings();
[email protected]8f1d2aa2013-05-10 23:45:38467 void InitializeDebugBindings();
468 void ClearBindings();
[email protected]8f1d2aa2013-05-10 23:45:38469
470 ProcsGLX fn;
471 ProcsGLX debug_fn;
472 ExtensionsGLX ext;
sieverse3b17fd52015-01-29 04:00:53473
474 private:
475 static std::string GetPlatformExtensions();
[email protected]8f1d2aa2013-05-10 23:45:38476};
477#endif
478
[email protected]06a1a6922013-07-26 11:51:52479// This #define is here to support autogenerated code.
480#define g_current_gl_context g_current_gl_context_tls->Get()
481GL_EXPORT extern base::ThreadLocalPointer<GLApi>* g_current_gl_context_tls;
482
[email protected]b97c9082012-10-25 17:21:38483GL_EXPORT extern OSMESAApi* g_current_osmesa_context;
484GL_EXPORT extern DriverGL g_driver_gl;
485GL_EXPORT extern DriverOSMESA g_driver_osmesa;
486
kylechare1872ee2016-04-25 15:00:47487#if defined(USE_EGL)
488GL_EXPORT extern EGLApi* g_current_egl_context;
489GL_EXPORT extern DriverEGL g_driver_egl;
490#endif
491
[email protected]b97c9082012-10-25 17:21:38492#if defined(OS_WIN)
[email protected]b97c9082012-10-25 17:21:38493GL_EXPORT extern WGLApi* g_current_wgl_context;
[email protected]b97c9082012-10-25 17:21:38494GL_EXPORT extern DriverWGL g_driver_wgl;
kylechare1872ee2016-04-25 15:00:47495#endif
[email protected]b97c9082012-10-25 17:21:38496
kylechare1872ee2016-04-25 15:00:47497#if defined(USE_GLX)
[email protected]b97c9082012-10-25 17:21:38498GL_EXPORT extern GLXApi* g_current_glx_context;
[email protected]b97c9082012-10-25 17:21:38499GL_EXPORT extern DriverGLX g_driver_glx;
[email protected]b97c9082012-10-25 17:21:38500#endif
501
kylechar7a463842016-05-26 14:46:12502} // namespace gl
[email protected]b9363b22010-06-09 22:06:15503
[email protected]c9e2cbbb2012-05-12 21:17:27504#endif // UI_GL_GL_BINDINGS_H_