blob: df7895eed20c9746326e5232bdd6df027a57caa3 [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"
Antoine Labour20d16202017-09-05 23:05:2932#include "ui/gl/extension_set.h"
[email protected]c9e2cbbb2012-05-12 21:17:2733#include "ui/gl/gl_export.h"
[email protected]b9363b22010-06-09 22:06:1534
35// The standard OpenGL native extension headers are also included.
36#if defined(OS_WIN)
37#include <GL/wglext.h>
[email protected]2ec8df52011-05-25 23:44:5838#elif defined(OS_MACOSX)
39#include <OpenGL/OpenGL.h>
kylechare1872ee2016-04-25 15:00:4740#elif defined(USE_GLX)
[email protected]b9363b22010-06-09 22:06:1541#include <GL/glx.h>
42#include <GL/glxext.h>
markdittmer276736a2016-05-09 20:13:2343#endif
[email protected]31c31b2b2011-09-27 18:58:2944
45// Undefine some macros defined by X headers. This is why this file should only
46// be included in .cc files.
47#undef Bool
48#undef None
49#undef Status
[email protected]b9363b22010-06-09 22:06:1550
[email protected]cb68eca2013-02-15 07:38:3851
52// GLES2 defines not part of Desktop GL
53// Shader Precision-Specified Types
54#define GL_LOW_FLOAT 0x8DF0
55#define GL_MEDIUM_FLOAT 0x8DF1
56#define GL_HIGH_FLOAT 0x8DF2
57#define GL_LOW_INT 0x8DF3
58#define GL_MEDIUM_INT 0x8DF4
59#define GL_HIGH_INT 0x8DF5
60#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
61#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
62#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
63#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
64#define GL_MAX_VARYING_VECTORS 0x8DFC
65#define GL_SHADER_BINARY_FORMATS 0x8DF8
66#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
67#define GL_SHADER_COMPILER 0x8DFA
68#define GL_RGB565 0x8D62
69#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B
70#define GL_RGB8_OES 0x8051
71#define GL_RGBA8_OES 0x8058
72#define GL_HALF_FLOAT_OES 0x8D61
73
74// GL_OES_EGL_image_external
75#define GL_TEXTURE_EXTERNAL_OES 0x8D65
76#define GL_SAMPLER_EXTERNAL_OES 0x8D66
77#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67
78#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68
79
80// GL_ANGLE_translated_shader_source
81#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0
82
[email protected]cb68eca2013-02-15 07:38:3883#define GL_UNPACK_COLORSPACE_CONVERSION_CHROMIUM 0x9243
[email protected]6eda6822014-04-03 23:00:5084#define GL_BIND_GENERATES_RESOURCE_CHROMIUM 0x9244
[email protected]cb68eca2013-02-15 07:38:3885
[email protected]cb68eca2013-02-15 07:38:3886// GL_ANGLE_texture_usage
87#define GL_TEXTURE_USAGE_ANGLE 0x93A2
88#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3
89
90// GL_EXT_texture_storage
91#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F
92#define GL_ALPHA8_EXT 0x803C
93#define GL_LUMINANCE8_EXT 0x8040
94#define GL_LUMINANCE8_ALPHA8_EXT 0x8045
95#define GL_RGBA32F_EXT 0x8814
96#define GL_RGB32F_EXT 0x8815
97#define GL_ALPHA32F_EXT 0x8816
98#define GL_LUMINANCE32F_EXT 0x8818
99#define GL_LUMINANCE_ALPHA32F_EXT 0x8819
100#define GL_RGBA16F_EXT 0x881A
101#define GL_RGB16F_EXT 0x881B
hendrikwbef24f5c2014-12-05 01:01:42102#define GL_RG16F_EXT 0x822F
103#define GL_R16F_EXT 0x822D
[email protected]cb68eca2013-02-15 07:38:38104#define GL_ALPHA16F_EXT 0x881C
105#define GL_LUMINANCE16F_EXT 0x881E
106#define GL_LUMINANCE_ALPHA16F_EXT 0x881F
hendrikwbef24f5c2014-12-05 01:01:42107#define GL_R32F_EXT 0x822E
108#define GL_RG32F_EXT 0x8230
[email protected]cb68eca2013-02-15 07:38:38109#define GL_BGRA8_EXT 0x93A1
110
111// GL_ANGLE_instanced_arrays
112#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE
113
geofflangfd848ca2017-02-23 17:46:49114// GL_ANGLE_client_arrays
115#define GL_CLIENT_ARRAYS_ANGLE 0x93AA
116
geofflangc7fc0722017-03-16 21:48:23117// GL_ANGLE_request_extension
118#define GL_REQUESTABLE_EXTENSIONS_ANGLE 0x93A8
119#define GL_NUM_REQUESTABLE_EXTENSIONS_ANGLE 0x93A8
120
[email protected]cb68eca2013-02-15 07:38:38121// GL_EXT_occlusion_query_boolean
122#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F
123#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A
124#define GL_CURRENT_QUERY_EXT 0x8865
125#define GL_QUERY_RESULT_EXT 0x8866
126#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867
127
revemane2f29f02017-01-20 20:40:30128// GL_ARB_occlusion_query
129#define GL_SAMPLES_PASSED_ARB 0x8914
130
[email protected]cb68eca2013-02-15 07:38:38131// GL_CHROMIUM_command_buffer_query
dongseong.hwang7ce131d42014-11-20 00:02:31132#define GL_COMMANDS_ISSUED_CHROMIUM 0x6004
[email protected]cb68eca2013-02-15 07:38:38133
134/* GL_CHROMIUM_get_error_query */
dongseong.hwang7ce131d42014-11-20 00:02:31135#define GL_GET_ERROR_QUERY_CHROMIUM 0x6003
[email protected]cb68eca2013-02-15 07:38:38136
137/* GL_CHROMIUM_command_buffer_latency_query */
dongseong.hwang7ce131d42014-11-20 00:02:31138#define GL_LATENCY_QUERY_CHROMIUM 0x6007
[email protected]cb68eca2013-02-15 07:38:38139
140/* GL_CHROMIUM_async_pixel_transfers */
dongseong.hwang7ce131d42014-11-20 00:02:31141#define GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM 0x6006
[email protected]cb68eca2013-02-15 07:38:38142
[email protected]6a25ae422014-04-17 23:48:27143// GL_CHROMIUM_sync_query
144#define GL_COMMANDS_COMPLETED_CHROMIUM 0x84F7
145
dcastagnacbea4262016-06-08 00:26:02146// GL_CHROMIUM_ycrcb_420_image
147#define GL_RGB_YCRCB_420_CHROMIUM 0x78FA
emircanf21bee9b2015-04-11 04:58:11148
dcastagnaa93c58151c02015-08-26 22:08:34149// GL_CHROMIUM_ycbcr_422_image
150#define GL_RGB_YCBCR_422_CHROMIUM 0x78FB
151
dcastagnaf0b514c2015-12-04 06:06:14152// GL_CHROMIUM_ycbcr_420v_image
153#define GL_RGB_YCBCR_420V_CHROMIUM 0x78FC
154
[email protected]d286ebbc2014-07-03 17:19:10155// GL_CHROMIUM_schedule_overlay_plane
156#define GL_OVERLAY_TRANSFORM_NONE_CHROMIUM 0x9245
157#define GL_OVERLAY_TRANSFORM_FLIP_HORIZONTAL_CHROMIUM 0x9246
158#define GL_OVERLAY_TRANSFORM_FLIP_VERTICAL_CHROMIUM 0x9247
159#define GL_OVERLAY_TRANSFORM_ROTATE_90_CHROMIUM 0x9248
160#define GL_OVERLAY_TRANSFORM_ROTATE_180_CHROMIUM 0x9249
161#define GL_OVERLAY_TRANSFORM_ROTATE_270_CHROMIUM 0x924A
162
orglofchcad5a6742014-11-07 19:51:12163// GL_CHROMIUM_subscribe_uniforms
164#define GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM 0x924B
165#define GL_MOUSE_POSITION_CHROMIUM 0x924C
166
Alexis Hetua18538f2017-07-21 23:47:13167// GL_CHROMIUM_texture_filtering_hint
168#define GL_TEXTURE_FILTERING_HINT_CHROMIUM 0x8AF0
169
Christopher Cameron624c11c2017-07-26 05:17:13170// GL_CHROMIUM_resize
171#define GL_COLOR_SPACE_UNSPECIFIED_CHROMIUM 0x8AF1
172#define GL_COLOR_SPACE_SCRGB_LINEAR_CHROMIUM 0x8AF2
173#define GL_COLOR_SPACE_SRGB_CHROMIUM 0x8AF3
174#define GL_COLOR_SPACE_DISPLAY_P3_CHROMIUM 0x8AF4
175
[email protected]cb68eca2013-02-15 07:38:38176// GL_OES_texure_3D
177#define GL_SAMPLER_3D_OES 0x8B5F
178
179// GL_OES_depth24
180#define GL_DEPTH_COMPONENT24_OES 0x81A6
181
182// GL_OES_depth32
183#define GL_DEPTH_COMPONENT32_OES 0x81A7
184
185// GL_OES_packed_depth_stencil
186#ifndef GL_DEPTH24_STENCIL8_OES
187#define GL_DEPTH24_STENCIL8_OES 0x88F0
188#endif
189
190#ifndef GL_DEPTH24_STENCIL8
191#define GL_DEPTH24_STENCIL8 0x88F0
192#endif
193
194// GL_OES_compressed_ETC1_RGB8_texture
195#define GL_ETC1_RGB8_OES 0x8D64
196
[email protected]8aec81ec2014-04-29 01:04:51197// GL_AMD_compressed_ATC_texture
198#define GL_ATC_RGB_AMD 0x8C92
199#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
200#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
201
202// GL_IMG_texture_compression_pvrtc
203#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
204#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
205#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
206#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
207
[email protected]cb68eca2013-02-15 07:38:38208// GL_OES_vertex_array_object
209#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5
210
211// GL_CHROMIUM_pixel_transfer_buffer_object
212#define GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM 0x78EC
[email protected]de43f082013-04-02 01:16:10213#define GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM 0x78ED
214#define GL_PIXEL_PACK_TRANSFER_BUFFER_BINDING_CHROMIUM 0x78EE
[email protected]cb68eca2013-02-15 07:38:38215#define GL_PIXEL_UNPACK_TRANSFER_BUFFER_BINDING_CHROMIUM 0x78EF
216
217/* GL_EXT_discard_framebuffer */
218#ifndef GL_EXT_discard_framebuffer
219#define GL_COLOR_EXT 0x1800
220#define GL_DEPTH_EXT 0x1801
221#define GL_STENCIL_EXT 0x1802
222#endif
223
bajones2a2ea232014-10-13 21:38:59224// GL_EXT_sRGB
225#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210
226
[email protected]cb68eca2013-02-15 07:38:38227// GL_ARB_get_program_binary
228#define PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
229// GL_OES_get_program_binary
230#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741
231#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE
232#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF
233
[email protected]7d3c36e2013-07-12 14:13:16234#ifndef GL_EXT_multisampled_render_to_texture
235#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
236#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
237#define GL_MAX_SAMPLES_EXT 0x8D57
238#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C
239#endif
240
241#ifndef GL_IMG_multisampled_render_to_texture
242#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133
243#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134
244#define GL_MAX_SAMPLES_IMG 0x9135
245#define GL_TEXTURE_SAMPLES_IMG 0x9136
246#endif
[email protected]cb68eca2013-02-15 07:38:38247
kkinnunen337d59632014-08-26 10:19:57248#ifndef GL_CHROMIUM_path_rendering
kkinnunenb959a8462015-07-14 11:08:34249#define GL_CHROMIUM_path_rendering 1
kkinnunen337d59632014-08-26 10:19:57250// These match the corresponding values in NV_path_rendering
251// extension, eg tokens with CHROMIUM replaced with NV.
252#define GL_PATH_MODELVIEW_MATRIX_CHROMIUM 0x0BA6
253#define GL_PATH_PROJECTION_MATRIX_CHROMIUM 0x0BA7
254#define GL_PATH_MODELVIEW_CHROMIUM 0x1700
255#define GL_PATH_PROJECTION_CHROMIUM 0x1701
kkinnunenb959a8462015-07-14 11:08:34256#define GL_FLAT_CHROMIUM 0x1D00
257#define GL_CLOSE_PATH_CHROMIUM 0x00
258#define GL_MOVE_TO_CHROMIUM 0x02
259#define GL_LINE_TO_CHROMIUM 0x04
260#define GL_QUADRATIC_CURVE_TO_CHROMIUM 0x0A
261#define GL_CUBIC_CURVE_TO_CHROMIUM 0x0C
262#define GL_CONIC_CURVE_TO_CHROMIUM 0x1A
kkinnunenc8b449e1582015-11-02 07:57:51263#define GL_EYE_LINEAR_CHROMIUM 0x2400
264#define GL_OBJECT_LINEAR_CHROMIUM 0x2401
265#define GL_CONSTANT_CHROMIUM 0x8576
kkinnunenb959a8462015-07-14 11:08:34266#define GL_PATH_STROKE_WIDTH_CHROMIUM 0x9075
267#define GL_PATH_END_CAPS_CHROMIUM 0x9076
268#define GL_PATH_JOIN_STYLE_CHROMIUM 0x9079
269#define GL_PATH_MITER_LIMIT_CHROMIUM 0x907a
270#define GL_PATH_STROKE_BOUND_CHROMIUM 0x9086
271#define GL_COUNT_UP_CHROMIUM 0x9088
272#define GL_COUNT_DOWN_CHROMIUM 0x9089
273#define GL_CONVEX_HULL_CHROMIUM 0x908B
274#define GL_BOUNDING_BOX_CHROMIUM 0x908D
kkinnunenfb3f1172015-10-28 08:50:00275#define GL_TRANSLATE_X_CHROMIUM 0x908E
276#define GL_TRANSLATE_Y_CHROMIUM 0x908F
277#define GL_TRANSLATE_2D_CHROMIUM 0x9090
278#define GL_TRANSLATE_3D_CHROMIUM 0x9091
279#define GL_AFFINE_2D_CHROMIUM 0x9092
280#define GL_AFFINE_3D_CHROMIUM 0x9094
281#define GL_TRANSPOSE_AFFINE_2D_CHROMIUM 0x9096
282#define GL_TRANSPOSE_AFFINE_3D_CHROMIUM 0x9098
283#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM 0x909C
kkinnunenb959a8462015-07-14 11:08:34284#define GL_SQUARE_CHROMIUM 0x90a3
285#define GL_ROUND_CHROMIUM 0x90a4
286#define GL_BEVEL_CHROMIUM 0x90a6
287#define GL_MITER_REVERT_CHROMIUM 0x90a7
288#define GL_PATH_STENCIL_FUNC_CHROMIUM 0x90B7
289#define GL_PATH_STENCIL_REF_CHROMIUM 0x90B8
290#define GL_PATH_STENCIL_VALUE_MASK_CHROMIUM 0x90B9
kkinnunen337d59632014-08-26 10:19:57291#endif
292
kkinnunenf26d7382015-12-01 13:34:14293#ifndef GL_EXT_multisample_compatibility
294#define GL_EXT_multisample_compatibility 1
295#define GL_MULTISAMPLE_EXT 0x809D
296#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F
297#endif /* GL_EXT_multisample_compatibility */
298
kkinnunena9d27e72015-12-21 17:23:44299#ifndef GL_CHROMIUM_framebuffer_mixed_samples
300#define GL_CHROMIUM_framebuffer_mixed_samples 1
301#define GL_COVERAGE_MODULATION_CHROMIUM 0x9332
302#endif /* GL_CHROMIUM_framebuffer_mixed_samples */
303
ed9198b422014-10-23 15:01:37304#ifndef GL_KHR_blend_equation_advanced
305#define GL_KHR_blend_equation_advanced 1
306#define GL_COLORBURN_KHR 0x929A
307#define GL_COLORDODGE_KHR 0x9299
308#define GL_DARKEN_KHR 0x9297
309#define GL_DIFFERENCE_KHR 0x929E
310#define GL_EXCLUSION_KHR 0x92A0
311#define GL_HARDLIGHT_KHR 0x929B
312#define GL_HSL_COLOR_KHR 0x92AF
313#define GL_HSL_HUE_KHR 0x92AD
314#define GL_HSL_LUMINOSITY_KHR 0x92B0
315#define GL_HSL_SATURATION_KHR 0x92AE
316#define GL_LIGHTEN_KHR 0x9298
317#define GL_MULTIPLY_KHR 0x9294
318#define GL_OVERLAY_KHR 0x9296
319#define GL_SCREEN_KHR 0x9295
320#define GL_SOFTLIGHT_KHR 0x929C
321#endif /* GL_KHR_blend_equation_advanced */
322
323#ifndef GL_KHR_blend_equation_advanced_coherent
324#define GL_KHR_blend_equation_advanced_coherent 1
325#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285
326#endif /* GL_KHR_blend_equation_advanced_coherent */
327
dyen882e1b72014-09-03 16:36:49328#ifndef GL_EXT_disjoint_timer_query
329#define GL_EXT_disjoint_timer_query 1
330#define GL_QUERY_COUNTER_BITS_EXT 0x8864
331#define GL_TIME_ELAPSED_EXT 0x88BF
332#define GL_TIMESTAMP_EXT 0x8E28
333#define GL_GPU_DISJOINT_EXT 0x8FBB
334#endif
335
oetuaho37cc50e2014-10-31 11:19:20336#ifndef GL_KHR_robustness
337#define GL_KHR_robustness 1
338#define GL_CONTEXT_ROBUST_ACCESS_KHR 0x90F3
339#define GL_LOSE_CONTEXT_ON_RESET_KHR 0x8252
340#define GL_GUILTY_CONTEXT_RESET_KHR 0x8253
341#define GL_INNOCENT_CONTEXT_RESET_KHR 0x8254
342#define GL_UNKNOWN_CONTEXT_RESET_KHR 0x8255
343#define GL_RESET_NOTIFICATION_STRATEGY_KHR 0x8256
344#define GL_NO_RESET_NOTIFICATION_KHR 0x8261
345#define GL_CONTEXT_LOST_KHR 0x0507
346#endif /* GL_KHR_robustness */
347
aleksandar.stojiljkovic10751e12017-04-28 07:55:09348#ifndef GL_EXT_texture_norm16
349#define GL_EXT_texture_norm16 1
350#define GL_R16_EXT 0x822A
351#define GL_RG16_EXT 0x822C
352#define GL_RGBA16_EXT 0x805B
353#define GL_RGB16_EXT 0x8054
354#define GL_RGB16_SNORM_EXT 0x8F9A
355#endif /* GL_EXT_texture_norm16 */
356
hendrikw83f2fb52014-12-02 03:30:40357#ifndef GL_EXT_texture_rg
358#define GL_EXT_texture_rg 1
359#define GL_RED_EXT 0x1903
360#define GL_RG_EXT 0x8227
361#define GL_R8_EXT 0x8229
362#define GL_RG8_EXT 0x822B
363#endif /* GL_EXT_texture_rg */
364
thakis3e861de2016-06-14 14:24:01365// This is from NV_path_rendering, but the Mesa GL header is not up to date with
kkinnunenc8b449e1582015-11-02 07:57:51366// the most recent
367// version of the extension. This definition could be removed once glext.h
368// r27498 or later is
369// imported.
370#ifndef GL_FRAGMENT_INPUT_NV
371#define GL_FRAGMENT_INPUT_NV 0x936D
372#endif
373
kkinnunen8cefb232015-12-04 09:36:31374#ifndef GL_EXT_blend_func_extended
375#define GL_EXT_blend_func_extended 1
376#define GL_SRC_ALPHA_SATURATE_EXT 0x0308
377#define GL_SRC1_ALPHA_EXT 0x8589 // OpenGL 1.5 token value
378#define GL_SRC1_COLOR_EXT 0x88F9
379#define GL_ONE_MINUS_SRC1_COLOR_EXT 0x88FA
380#define GL_ONE_MINUS_SRC1_ALPHA_EXT 0x88FB
381#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT 0x88FC
382#endif /* GL_EXT_blend_func_extended */
383
[email protected]cb68eca2013-02-15 07:38:38384#define GL_GLEXT_PROTOTYPES 1
385
[email protected]b9363b22010-06-09 22:06:15386#if defined(OS_WIN)
387#define GL_BINDING_CALL WINAPI
388#else
389#define GL_BINDING_CALL
390#endif
391
[email protected]218a5a22010-11-04 19:27:49392#define GL_SERVICE_LOG(args) DLOG(INFO) << args;
[email protected]5a83fca2012-04-22 02:05:08393#if defined(NDEBUG)
[email protected]92afb772011-12-09 01:49:56394 #define GL_SERVICE_LOG_CODE_BLOCK(code)
395#else
396 #define GL_SERVICE_LOG_CODE_BLOCK(code) code
397#endif
[email protected]218a5a22010-11-04 19:27:49398
[email protected]b9363b22010-06-09 22:06:15399// Forward declare OSMesa types.
400typedef struct osmesa_context *OSMesaContext;
401typedef void (*OSMESAproc)();
402
[email protected]b9363b22010-06-09 22:06:15403// Forward declare EGL types.
avi739878c2015-12-24 18:06:17404typedef uint64_t EGLuint64CHROMIUM;
[email protected]b9363b22010-06-09 22:06:15405
406#include "gl_bindings_autogen_gl.h"
407#include "gl_bindings_autogen_osmesa.h"
408
kylechare1872ee2016-04-25 15:00:47409#if defined(USE_EGL)
410#include "gl_bindings_autogen_egl.h"
411#endif
412
[email protected]b9363b22010-06-09 22:06:15413#if defined(OS_WIN)
[email protected]b9363b22010-06-09 22:06:15414#include "gl_bindings_autogen_wgl.h"
kylechare1872ee2016-04-25 15:00:47415#endif
416
417#if defined(USE_GLX)
[email protected]b9363b22010-06-09 22:06:15418#include "gl_bindings_autogen_glx.h"
[email protected]b9363b22010-06-09 22:06:15419#endif
420
kylechar7a463842016-05-26 14:46:12421namespace gl {
[email protected]b9363b22010-06-09 22:06:15422
Geoff Langceb64f72017-01-30 17:02:53423struct GLVersionInfo;
424
[email protected]8f1d2aa2013-05-10 23:45:38425struct GL_EXPORT DriverGL {
[email protected]a37d7ff2014-01-17 21:31:00426 void InitializeStaticBindings();
Geoff Langceb64f72017-01-30 17:02:53427 void InitializeDynamicBindings(const GLVersionInfo* ver,
Antoine Labour20d16202017-09-05 23:05:29428 const ExtensionSet& extensions);
[email protected]8f1d2aa2013-05-10 23:45:38429 void ClearBindings();
[email protected]8f1d2aa2013-05-10 23:45:38430
431 ProcsGL fn;
[email protected]8f1d2aa2013-05-10 23:45:38432 ExtensionsGL ext;
Geoff Langceb64f72017-01-30 17:02:53433};
[email protected]8f1d2aa2013-05-10 23:45:38434
Geoff Langceb64f72017-01-30 17:02:53435struct GL_EXPORT CurrentGL {
436 GLApi* Api = nullptr;
437 DriverGL* Driver = nullptr;
438 const GLVersionInfo* Version = nullptr;
[email protected]8f1d2aa2013-05-10 23:45:38439};
440
441struct GL_EXPORT DriverOSMESA {
[email protected]a37d7ff2014-01-17 21:31:00442 void InitializeStaticBindings();
tobiasjsbbda4652015-06-26 23:08:53443 void InitializeExtensionBindings();
[email protected]8f1d2aa2013-05-10 23:45:38444 void ClearBindings();
[email protected]8f1d2aa2013-05-10 23:45:38445
446 ProcsOSMESA fn;
[email protected]8f1d2aa2013-05-10 23:45:38447 ExtensionsOSMESA ext;
sieverse3b17fd52015-01-29 04:00:53448
449 private:
450 static std::string GetPlatformExtensions();
[email protected]8f1d2aa2013-05-10 23:45:38451};
452
453#if defined(OS_WIN)
454struct GL_EXPORT DriverWGL {
[email protected]a37d7ff2014-01-17 21:31:00455 void InitializeStaticBindings();
tobiasjsbbda4652015-06-26 23:08:53456 void InitializeExtensionBindings();
[email protected]8f1d2aa2013-05-10 23:45:38457 void ClearBindings();
[email protected]8f1d2aa2013-05-10 23:45:38458
459 ProcsWGL fn;
[email protected]8f1d2aa2013-05-10 23:45:38460 ExtensionsWGL ext;
sieverse3b17fd52015-01-29 04:00:53461
462 private:
463 static std::string GetPlatformExtensions();
[email protected]8f1d2aa2013-05-10 23:45:38464};
465#endif
466
kylechare1872ee2016-04-25 15:00:47467#if defined(USE_EGL)
[email protected]8f1d2aa2013-05-10 23:45:38468struct GL_EXPORT DriverEGL {
[email protected]a37d7ff2014-01-17 21:31:00469 void InitializeStaticBindings();
kylechar7dd36fe2016-07-20 19:44:06470 void InitializeClientExtensionBindings();
tobiasjsbbda4652015-06-26 23:08:53471 void InitializeExtensionBindings();
[email protected]8f1d2aa2013-05-10 23:45:38472 void ClearBindings();
Zhenyao Mo9fc174c2017-08-24 01:06:42473 void UpdateConditionalExtensionBindings();
[email protected]8f1d2aa2013-05-10 23:45:38474
475 ProcsEGL fn;
[email protected]8f1d2aa2013-05-10 23:45:38476 ExtensionsEGL ext;
sieverse3b17fd52015-01-29 04:00:53477
sieverse3b17fd52015-01-29 04:00:53478 static std::string GetPlatformExtensions();
jmadillc3cfb9c2015-04-14 21:13:58479 static std::string GetClientExtensions();
[email protected]8f1d2aa2013-05-10 23:45:38480};
481#endif
482
kylechare1872ee2016-04-25 15:00:47483#if defined(USE_GLX)
[email protected]8f1d2aa2013-05-10 23:45:38484struct GL_EXPORT DriverGLX {
[email protected]a37d7ff2014-01-17 21:31:00485 void InitializeStaticBindings();
tobiasjsbbda4652015-06-26 23:08:53486 void InitializeExtensionBindings();
[email protected]8f1d2aa2013-05-10 23:45:38487 void ClearBindings();
[email protected]8f1d2aa2013-05-10 23:45:38488
489 ProcsGLX fn;
[email protected]8f1d2aa2013-05-10 23:45:38490 ExtensionsGLX ext;
sieverse3b17fd52015-01-29 04:00:53491
492 private:
493 static std::string GetPlatformExtensions();
[email protected]8f1d2aa2013-05-10 23:45:38494};
495#endif
496
[email protected]06a1a6922013-07-26 11:51:52497// This #define is here to support autogenerated code.
Geoff Langceb64f72017-01-30 17:02:53498#define g_current_gl_context g_current_gl_context_tls->Get()->Api
499#define g_current_gl_driver g_current_gl_context_tls->Get()->Driver
500#define g_current_gl_version g_current_gl_context_tls->Get()->Version
501GL_EXPORT extern base::ThreadLocalPointer<CurrentGL>* g_current_gl_context_tls;
[email protected]06a1a6922013-07-26 11:51:52502
[email protected]b97c9082012-10-25 17:21:38503GL_EXPORT extern OSMESAApi* g_current_osmesa_context;
[email protected]b97c9082012-10-25 17:21:38504GL_EXPORT extern DriverOSMESA g_driver_osmesa;
505
kylechare1872ee2016-04-25 15:00:47506#if defined(USE_EGL)
507GL_EXPORT extern EGLApi* g_current_egl_context;
508GL_EXPORT extern DriverEGL g_driver_egl;
509#endif
510
[email protected]b97c9082012-10-25 17:21:38511#if defined(OS_WIN)
[email protected]b97c9082012-10-25 17:21:38512GL_EXPORT extern WGLApi* g_current_wgl_context;
[email protected]b97c9082012-10-25 17:21:38513GL_EXPORT extern DriverWGL g_driver_wgl;
kylechare1872ee2016-04-25 15:00:47514#endif
[email protected]b97c9082012-10-25 17:21:38515
kylechare1872ee2016-04-25 15:00:47516#if defined(USE_GLX)
[email protected]b97c9082012-10-25 17:21:38517GL_EXPORT extern GLXApi* g_current_glx_context;
[email protected]b97c9082012-10-25 17:21:38518GL_EXPORT extern DriverGLX g_driver_glx;
[email protected]b97c9082012-10-25 17:21:38519#endif
520
kylechar7a463842016-05-26 14:46:12521} // namespace gl
[email protected]b9363b22010-06-09 22:06:15522
[email protected]c9e2cbbb2012-05-12 21:17:27523#endif // UI_GL_GL_BINDINGS_H_