[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 | |||||
markdittmer | 6e70beb8 | 2016-05-02 05:40:47 | [diff] [blame] | 13 | // 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] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 21 | #include <GL/gl.h> |
22 | #include <GL/glext.h> | ||||
[email protected] | b040f9d | 2013-01-19 04:27:00 | [diff] [blame] | 23 | #include <EGL/egl.h> |
24 | #include <EGL/eglext.h> | ||||
avi | 9c81217b | 2015-12-24 23:40:05 | [diff] [blame] | 25 | #include <stdint.h> |
26 | |||||
27 | #include <string> | ||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 28 | |
[email protected] | 218a5a2 | 2010-11-04 19:27:49 | [diff] [blame] | 29 | #include "base/logging.h" |
[email protected] | 06a1a692 | 2013-07-26 11:51:52 | [diff] [blame] | 30 | #include "base/threading/thread_local.h" |
[email protected] | c9e2cbbb | 2012-05-12 21:17:27 | [diff] [blame] | 31 | #include "build/build_config.h" |
32 | #include "ui/gl/gl_export.h" | ||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 33 | |
34 | // The standard OpenGL native extension headers are also included. | ||||
35 | #if defined(OS_WIN) | ||||
36 | #include <GL/wglext.h> | ||||
[email protected] | 2ec8df5 | 2011-05-25 23:44:58 | [diff] [blame] | 37 | #elif defined(OS_MACOSX) |
38 | #include <OpenGL/OpenGL.h> | ||||
kylechar | e1872ee | 2016-04-25 15:00:47 | [diff] [blame] | 39 | #elif defined(USE_GLX) |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 40 | #include <GL/glx.h> |
41 | #include <GL/glxext.h> | ||||
markdittmer | 276736a | 2016-05-09 20:13:23 | [diff] [blame] | 42 | #endif |
[email protected] | 31c31b2b | 2011-09-27 18:58:29 | [diff] [blame] | 43 | |
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] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 49 | |
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 50 | |
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] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 82 | #define GL_UNPACK_COLORSPACE_CONVERSION_CHROMIUM 0x9243 |
[email protected] | 6eda682 | 2014-04-03 23:00:50 | [diff] [blame] | 83 | #define GL_BIND_GENERATES_RESOURCE_CHROMIUM 0x9244 |
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 84 | |
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 85 | // 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 | ||||
hendrikw | bef24f5c | 2014-12-05 01:01:42 | [diff] [blame] | 101 | #define GL_RG16F_EXT 0x822F |
102 | #define GL_R16F_EXT 0x822D | ||||
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 103 | #define GL_ALPHA16F_EXT 0x881C |
104 | #define GL_LUMINANCE16F_EXT 0x881E | ||||
105 | #define GL_LUMINANCE_ALPHA16F_EXT 0x881F | ||||
hendrikw | bef24f5c | 2014-12-05 01:01:42 | [diff] [blame] | 106 | #define GL_R32F_EXT 0x822E |
107 | #define GL_RG32F_EXT 0x8230 | ||||
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 108 | #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.hwang | 7ce131d4 | 2014-11-20 00:02:31 | [diff] [blame] | 121 | #define GL_COMMANDS_ISSUED_CHROMIUM 0x6004 |
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 122 | |
123 | /* GL_CHROMIUM_get_error_query */ | ||||
dongseong.hwang | 7ce131d4 | 2014-11-20 00:02:31 | [diff] [blame] | 124 | #define GL_GET_ERROR_QUERY_CHROMIUM 0x6003 |
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 125 | |
126 | /* GL_CHROMIUM_command_buffer_latency_query */ | ||||
dongseong.hwang | 7ce131d4 | 2014-11-20 00:02:31 | [diff] [blame] | 127 | #define GL_LATENCY_QUERY_CHROMIUM 0x6007 |
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 128 | |
129 | /* GL_CHROMIUM_async_pixel_transfers */ | ||||
dongseong.hwang | 7ce131d4 | 2014-11-20 00:02:31 | [diff] [blame] | 130 | #define GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM 0x6006 |
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 131 | |
[email protected] | 6a25ae42 | 2014-04-17 23:48:27 | [diff] [blame] | 132 | // GL_CHROMIUM_sync_query |
133 | #define GL_COMMANDS_COMPLETED_CHROMIUM 0x84F7 | ||||
134 | |||||
reveman | 32115e5 | 2014-10-02 19:01:03 | [diff] [blame] | 135 | // GL_CHROMIUM_gpu_memory_buffer_image |
reveman | eb0fda2 | 2015-10-26 20:27:47 | [diff] [blame] | 136 | #define GL_READ_WRITE_CHROMIUM 0x78F2 |
reveman | 32115e5 | 2014-10-02 19:01:03 | [diff] [blame] | 137 | |
emircan | f21bee9b | 2015-04-11 04:58:11 | [diff] [blame] | 138 | // GL_CHROMIUM_yuv_420_image |
139 | #define GL_RGB_YUV_420_CHROMIUM 0x78FA | ||||
140 | |||||
dcastagna | a93c58151c0 | 2015-08-26 22:08:34 | [diff] [blame] | 141 | // GL_CHROMIUM_ycbcr_422_image |
142 | #define GL_RGB_YCBCR_422_CHROMIUM 0x78FB | ||||
143 | |||||
dcastagna | f0b514c | 2015-12-04 06:06:14 | [diff] [blame] | 144 | // GL_CHROMIUM_ycbcr_420v_image |
145 | #define GL_RGB_YCBCR_420V_CHROMIUM 0x78FC | ||||
146 | |||||
[email protected] | d286ebbc | 2014-07-03 17:19:10 | [diff] [blame] | 147 | // 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 | |||||
orglofch | cad5a674 | 2014-11-07 19:51:12 | [diff] [blame] | 155 | // GL_CHROMIUM_subscribe_uniforms |
156 | #define GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM 0x924B | ||||
157 | #define GL_MOUSE_POSITION_CHROMIUM 0x924C | ||||
158 | |||||
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 159 | // 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] | 8aec81ec | 2014-04-29 01:04:51 | [diff] [blame] | 180 | // 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] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 191 | // 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] | de43f08 | 2013-04-02 01:16:10 | [diff] [blame] | 196 | #define GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM 0x78ED |
197 | #define GL_PIXEL_PACK_TRANSFER_BUFFER_BINDING_CHROMIUM 0x78EE | ||||
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 198 | #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 | |||||
bajones | 2a2ea23 | 2014-10-13 21:38:59 | [diff] [blame] | 207 | // GL_EXT_sRGB |
208 | #define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210 | ||||
209 | |||||
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 210 | // 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] | 7d3c36e | 2013-07-12 14:13:16 | [diff] [blame] | 217 | #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] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 230 | |
kkinnunen | 337d5963 | 2014-08-26 10:19:57 | [diff] [blame] | 231 | #ifndef GL_CHROMIUM_path_rendering |
kkinnunen | b959a846 | 2015-07-14 11:08:34 | [diff] [blame] | 232 | #define GL_CHROMIUM_path_rendering 1 |
kkinnunen | 337d5963 | 2014-08-26 10:19:57 | [diff] [blame] | 233 | // 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 | ||||
kkinnunen | b959a846 | 2015-07-14 11:08:34 | [diff] [blame] | 239 | #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 | ||||
kkinnunen | c8b449e158 | 2015-11-02 07:57:51 | [diff] [blame] | 246 | #define GL_EYE_LINEAR_CHROMIUM 0x2400 |
247 | #define GL_OBJECT_LINEAR_CHROMIUM 0x2401 | ||||
248 | #define GL_CONSTANT_CHROMIUM 0x8576 | ||||
kkinnunen | b959a846 | 2015-07-14 11:08:34 | [diff] [blame] | 249 | #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 | ||||
kkinnunen | fb3f117 | 2015-10-28 08:50:00 | [diff] [blame] | 258 | #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 | ||||
kkinnunen | b959a846 | 2015-07-14 11:08:34 | [diff] [blame] | 267 | #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 | ||||
kkinnunen | 337d5963 | 2014-08-26 10:19:57 | [diff] [blame] | 274 | #endif |
275 | |||||
kkinnunen | f26d738 | 2015-12-01 13:34:14 | [diff] [blame] | 276 | #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 | |||||
kkinnunen | a9d27e7 | 2015-12-21 17:23:44 | [diff] [blame] | 282 | #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 | |||||
ed | 9198b42 | 2014-10-23 15:01:37 | [diff] [blame] | 287 | #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 | |||||
dyen | 882e1b7 | 2014-09-03 16:36:49 | [diff] [blame] | 311 | #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 | |||||
oetuaho | 37cc50e | 2014-10-31 11:19:20 | [diff] [blame] | 319 | #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 | |||||
hendrikw | 83f2fb5 | 2014-12-02 03:30:40 | [diff] [blame] | 331 | #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 | |||||
kkinnunen | c8b449e158 | 2015-11-02 07:57:51 | [diff] [blame] | 339 | // 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 | |||||
kkinnunen | 8cefb23 | 2015-12-04 09:36:31 | [diff] [blame] | 348 | #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] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 358 | #define GL_GLEXT_PROTOTYPES 1 |
359 | |||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 360 | #if defined(OS_WIN) |
361 | #define GL_BINDING_CALL WINAPI | ||||
362 | #else | ||||
363 | #define GL_BINDING_CALL | ||||
364 | #endif | ||||
365 | |||||
[email protected] | 218a5a2 | 2010-11-04 19:27:49 | [diff] [blame] | 366 | #define GL_SERVICE_LOG(args) DLOG(INFO) << args; |
[email protected] | 5a83fca | 2012-04-22 02:05:08 | [diff] [blame] | 367 | #if defined(NDEBUG) |
[email protected] | 92afb77 | 2011-12-09 01:49:56 | [diff] [blame] | 368 | #define GL_SERVICE_LOG_CODE_BLOCK(code) |
369 | #else | ||||
370 | #define GL_SERVICE_LOG_CODE_BLOCK(code) code | ||||
371 | #endif | ||||
[email protected] | 218a5a2 | 2010-11-04 19:27:49 | [diff] [blame] | 372 | |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 373 | // Forward declare OSMesa types. |
374 | typedef struct osmesa_context *OSMesaContext; | ||||
375 | typedef void (*OSMESAproc)(); | ||||
376 | |||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 377 | // Forward declare EGL types. |
avi | 739878c | 2015-12-24 18:06:17 | [diff] [blame] | 378 | typedef uint64_t EGLuint64CHROMIUM; |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 379 | |
380 | #include "gl_bindings_autogen_gl.h" | ||||
381 | #include "gl_bindings_autogen_osmesa.h" | ||||
382 | |||||
kylechar | e1872ee | 2016-04-25 15:00:47 | [diff] [blame] | 383 | #if defined(USE_EGL) |
384 | #include "gl_bindings_autogen_egl.h" | ||||
385 | #endif | ||||
386 | |||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 387 | #if defined(OS_WIN) |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 388 | #include "gl_bindings_autogen_wgl.h" |
kylechar | e1872ee | 2016-04-25 15:00:47 | [diff] [blame] | 389 | #endif |
390 | |||||
391 | #if defined(USE_GLX) | ||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 392 | #include "gl_bindings_autogen_glx.h" |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 393 | #endif |
394 | |||||
kylechar | 7a46384 | 2016-05-26 14:46:12 | [diff] [blame^] | 395 | namespace gl { |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 396 | |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 397 | struct GL_EXPORT DriverGL { |
[email protected] | a37d7ff | 2014-01-17 21:31:00 | [diff] [blame] | 398 | void InitializeStaticBindings(); |
399 | void InitializeCustomDynamicBindings(GLContext* context); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 400 | void InitializeDebugBindings(); |
[email protected] | 70c908c | 2014-01-12 02:09:45 | [diff] [blame] | 401 | void InitializeNullDrawBindings(); |
[email protected] | ae967b0 | 2014-02-21 21:18:58 | [diff] [blame] | 402 | // TODO(danakj): Remove this when all test suites are using null-draw. |
403 | bool HasInitializedNullDrawBindings(); | ||||
[email protected] | 2fc82a9 | 2014-02-20 22:52:08 | [diff] [blame] | 404 | bool SetNullDrawBindingsEnabled(bool enabled); |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 405 | void ClearBindings(); |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 406 | |
407 | ProcsGL fn; | ||||
408 | ProcsGL orig_fn; | ||||
409 | ProcsGL debug_fn; | ||||
410 | ExtensionsGL ext; | ||||
[email protected] | 2fc82a9 | 2014-02-20 22:52:08 | [diff] [blame] | 411 | bool null_draw_bindings_enabled; |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 412 | |
413 | private: | ||||
[email protected] | a37d7ff | 2014-01-17 21:31:00 | [diff] [blame] | 414 | void InitializeDynamicBindings(GLContext* context); |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 415 | }; |
416 | |||||
417 | struct GL_EXPORT DriverOSMESA { | ||||
[email protected] | a37d7ff | 2014-01-17 21:31:00 | [diff] [blame] | 418 | void InitializeStaticBindings(); |
tobiasjs | bbda465 | 2015-06-26 23:08:53 | [diff] [blame] | 419 | void InitializeExtensionBindings(); |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 420 | void InitializeDebugBindings(); |
421 | void ClearBindings(); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 422 | |
423 | ProcsOSMESA fn; | ||||
424 | ProcsOSMESA debug_fn; | ||||
425 | ExtensionsOSMESA ext; | ||||
sievers | e3b17fd5 | 2015-01-29 04:00:53 | [diff] [blame] | 426 | |
427 | private: | ||||
428 | static std::string GetPlatformExtensions(); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 429 | }; |
430 | |||||
431 | #if defined(OS_WIN) | ||||
432 | struct GL_EXPORT DriverWGL { | ||||
[email protected] | a37d7ff | 2014-01-17 21:31:00 | [diff] [blame] | 433 | void InitializeStaticBindings(); |
tobiasjs | bbda465 | 2015-06-26 23:08:53 | [diff] [blame] | 434 | void InitializeExtensionBindings(); |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 435 | void InitializeDebugBindings(); |
436 | void ClearBindings(); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 437 | |
438 | ProcsWGL fn; | ||||
439 | ProcsWGL debug_fn; | ||||
440 | ExtensionsWGL ext; | ||||
sievers | e3b17fd5 | 2015-01-29 04:00:53 | [diff] [blame] | 441 | |
442 | private: | ||||
443 | static std::string GetPlatformExtensions(); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 444 | }; |
445 | #endif | ||||
446 | |||||
kylechar | e1872ee | 2016-04-25 15:00:47 | [diff] [blame] | 447 | #if defined(USE_EGL) |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 448 | struct GL_EXPORT DriverEGL { |
[email protected] | a37d7ff | 2014-01-17 21:31:00 | [diff] [blame] | 449 | void InitializeStaticBindings(); |
tobiasjs | bbda465 | 2015-06-26 23:08:53 | [diff] [blame] | 450 | void InitializeExtensionBindings(); |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 451 | void InitializeDebugBindings(); |
452 | void ClearBindings(); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 453 | |
454 | ProcsEGL fn; | ||||
455 | ProcsEGL debug_fn; | ||||
456 | ExtensionsEGL ext; | ||||
sievers | e3b17fd5 | 2015-01-29 04:00:53 | [diff] [blame] | 457 | |
sievers | e3b17fd5 | 2015-01-29 04:00:53 | [diff] [blame] | 458 | static std::string GetPlatformExtensions(); |
jmadill | c3cfb9c | 2015-04-14 21:13:58 | [diff] [blame] | 459 | static std::string GetClientExtensions(); |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 460 | }; |
461 | #endif | ||||
462 | |||||
kylechar | e1872ee | 2016-04-25 15:00:47 | [diff] [blame] | 463 | #if defined(USE_GLX) |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 464 | struct GL_EXPORT DriverGLX { |
[email protected] | a37d7ff | 2014-01-17 21:31:00 | [diff] [blame] | 465 | void InitializeStaticBindings(); |
tobiasjs | bbda465 | 2015-06-26 23:08:53 | [diff] [blame] | 466 | void InitializeExtensionBindings(); |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 467 | void InitializeDebugBindings(); |
468 | void ClearBindings(); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 469 | |
470 | ProcsGLX fn; | ||||
471 | ProcsGLX debug_fn; | ||||
472 | ExtensionsGLX ext; | ||||
sievers | e3b17fd5 | 2015-01-29 04:00:53 | [diff] [blame] | 473 | |
474 | private: | ||||
475 | static std::string GetPlatformExtensions(); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 476 | }; |
477 | #endif | ||||
478 | |||||
[email protected] | 06a1a692 | 2013-07-26 11:51:52 | [diff] [blame] | 479 | // This #define is here to support autogenerated code. |
480 | #define g_current_gl_context g_current_gl_context_tls->Get() | ||||
481 | GL_EXPORT extern base::ThreadLocalPointer<GLApi>* g_current_gl_context_tls; | ||||
482 | |||||
[email protected] | b97c908 | 2012-10-25 17:21:38 | [diff] [blame] | 483 | GL_EXPORT extern OSMESAApi* g_current_osmesa_context; |
484 | GL_EXPORT extern DriverGL g_driver_gl; | ||||
485 | GL_EXPORT extern DriverOSMESA g_driver_osmesa; | ||||
486 | |||||
kylechar | e1872ee | 2016-04-25 15:00:47 | [diff] [blame] | 487 | #if defined(USE_EGL) |
488 | GL_EXPORT extern EGLApi* g_current_egl_context; | ||||
489 | GL_EXPORT extern DriverEGL g_driver_egl; | ||||
490 | #endif | ||||
491 | |||||
[email protected] | b97c908 | 2012-10-25 17:21:38 | [diff] [blame] | 492 | #if defined(OS_WIN) |
[email protected] | b97c908 | 2012-10-25 17:21:38 | [diff] [blame] | 493 | GL_EXPORT extern WGLApi* g_current_wgl_context; |
[email protected] | b97c908 | 2012-10-25 17:21:38 | [diff] [blame] | 494 | GL_EXPORT extern DriverWGL g_driver_wgl; |
kylechar | e1872ee | 2016-04-25 15:00:47 | [diff] [blame] | 495 | #endif |
[email protected] | b97c908 | 2012-10-25 17:21:38 | [diff] [blame] | 496 | |
kylechar | e1872ee | 2016-04-25 15:00:47 | [diff] [blame] | 497 | #if defined(USE_GLX) |
[email protected] | b97c908 | 2012-10-25 17:21:38 | [diff] [blame] | 498 | GL_EXPORT extern GLXApi* g_current_glx_context; |
[email protected] | b97c908 | 2012-10-25 17:21:38 | [diff] [blame] | 499 | GL_EXPORT extern DriverGLX g_driver_glx; |
[email protected] | b97c908 | 2012-10-25 17:21:38 | [diff] [blame] | 500 | #endif |
501 | |||||
kylechar | 7a46384 | 2016-05-26 14:46:12 | [diff] [blame^] | 502 | } // namespace gl |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 503 | |
[email protected] | c9e2cbbb | 2012-05-12 21:17:27 | [diff] [blame] | 504 | #endif // UI_GL_GL_BINDINGS_H_ |