[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 | |||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 13 | #include <GL/gl.h> |
14 | #include <GL/glext.h> | ||||
[email protected] | b040f9d | 2013-01-19 04:27:00 | [diff] [blame] | 15 | #include <EGL/egl.h> |
16 | #include <EGL/eglext.h> | ||||
avi | 9c81217b | 2015-12-24 23:40:05 | [diff] [blame^] | 17 | #include <stdint.h> |
18 | |||||
19 | #include <string> | ||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 20 | |
[email protected] | 218a5a2 | 2010-11-04 19:27:49 | [diff] [blame] | 21 | #include "base/logging.h" |
[email protected] | 06a1a692 | 2013-07-26 11:51:52 | [diff] [blame] | 22 | #include "base/threading/thread_local.h" |
[email protected] | c9e2cbbb | 2012-05-12 21:17:27 | [diff] [blame] | 23 | #include "build/build_config.h" |
24 | #include "ui/gl/gl_export.h" | ||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 25 | |
26 | // The standard OpenGL native extension headers are also included. | ||||
27 | #if defined(OS_WIN) | ||||
28 | #include <GL/wglext.h> | ||||
[email protected] | 2ec8df5 | 2011-05-25 23:44:58 | [diff] [blame] | 29 | #elif defined(OS_MACOSX) |
30 | #include <OpenGL/OpenGL.h> | ||||
31 | #elif defined(USE_X11) | ||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 32 | #include <GL/glx.h> |
33 | #include <GL/glxext.h> | ||||
[email protected] | 31c31b2b | 2011-09-27 18:58:29 | [diff] [blame] | 34 | |
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] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 40 | #endif |
41 | |||||
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 42 | |
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] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 74 | #define GL_UNPACK_COLORSPACE_CONVERSION_CHROMIUM 0x9243 |
[email protected] | 6eda682 | 2014-04-03 23:00:50 | [diff] [blame] | 75 | #define GL_BIND_GENERATES_RESOURCE_CHROMIUM 0x9244 |
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 76 | |
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 77 | // 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 | ||||
hendrikw | bef24f5c | 2014-12-05 01:01:42 | [diff] [blame] | 96 | #define GL_RG16F_EXT 0x822F |
97 | #define GL_R16F_EXT 0x822D | ||||
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 98 | #define GL_ALPHA16F_EXT 0x881C |
99 | #define GL_LUMINANCE16F_EXT 0x881E | ||||
100 | #define GL_LUMINANCE_ALPHA16F_EXT 0x881F | ||||
hendrikw | bef24f5c | 2014-12-05 01:01:42 | [diff] [blame] | 101 | #define GL_R32F_EXT 0x822E |
102 | #define GL_RG32F_EXT 0x8230 | ||||
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 103 | #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.hwang | 7ce131d4 | 2014-11-20 00:02:31 | [diff] [blame] | 116 | #define GL_COMMANDS_ISSUED_CHROMIUM 0x6004 |
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 117 | |
118 | /* GL_CHROMIUM_get_error_query */ | ||||
dongseong.hwang | 7ce131d4 | 2014-11-20 00:02:31 | [diff] [blame] | 119 | #define GL_GET_ERROR_QUERY_CHROMIUM 0x6003 |
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 120 | |
121 | /* GL_CHROMIUM_command_buffer_latency_query */ | ||||
dongseong.hwang | 7ce131d4 | 2014-11-20 00:02:31 | [diff] [blame] | 122 | #define GL_LATENCY_QUERY_CHROMIUM 0x6007 |
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 123 | |
124 | /* GL_CHROMIUM_async_pixel_transfers */ | ||||
dongseong.hwang | 7ce131d4 | 2014-11-20 00:02:31 | [diff] [blame] | 125 | #define GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM 0x6006 |
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 126 | |
[email protected] | 6a25ae42 | 2014-04-17 23:48:27 | [diff] [blame] | 127 | // GL_CHROMIUM_sync_query |
128 | #define GL_COMMANDS_COMPLETED_CHROMIUM 0x84F7 | ||||
129 | |||||
reveman | 32115e5 | 2014-10-02 19:01:03 | [diff] [blame] | 130 | // GL_CHROMIUM_gpu_memory_buffer_image |
reveman | eb0fda2 | 2015-10-26 20:27:47 | [diff] [blame] | 131 | #define GL_READ_WRITE_CHROMIUM 0x78F2 |
reveman | 32115e5 | 2014-10-02 19:01:03 | [diff] [blame] | 132 | |
emircan | f21bee9b | 2015-04-11 04:58:11 | [diff] [blame] | 133 | // GL_CHROMIUM_yuv_420_image |
134 | #define GL_RGB_YUV_420_CHROMIUM 0x78FA | ||||
135 | |||||
dcastagna | a93c58151c0 | 2015-08-26 22:08:34 | [diff] [blame] | 136 | // GL_CHROMIUM_ycbcr_422_image |
137 | #define GL_RGB_YCBCR_422_CHROMIUM 0x78FB | ||||
138 | |||||
dcastagna | f0b514c | 2015-12-04 06:06:14 | [diff] [blame] | 139 | // GL_CHROMIUM_ycbcr_420v_image |
140 | #define GL_RGB_YCBCR_420V_CHROMIUM 0x78FC | ||||
141 | |||||
[email protected] | d286ebbc | 2014-07-03 17:19:10 | [diff] [blame] | 142 | // 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 | |||||
orglofch | cad5a674 | 2014-11-07 19:51:12 | [diff] [blame] | 150 | // GL_CHROMIUM_subscribe_uniforms |
151 | #define GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM 0x924B | ||||
152 | #define GL_MOUSE_POSITION_CHROMIUM 0x924C | ||||
153 | |||||
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 154 | // 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] | 8aec81ec | 2014-04-29 01:04:51 | [diff] [blame] | 175 | // 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] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 186 | // 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] | de43f08 | 2013-04-02 01:16:10 | [diff] [blame] | 191 | #define GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM 0x78ED |
192 | #define GL_PIXEL_PACK_TRANSFER_BUFFER_BINDING_CHROMIUM 0x78EE | ||||
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 193 | #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 | |||||
bajones | 2a2ea23 | 2014-10-13 21:38:59 | [diff] [blame] | 202 | // GL_EXT_sRGB |
203 | #define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210 | ||||
204 | |||||
[email protected] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 205 | // 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] | 7d3c36e | 2013-07-12 14:13:16 | [diff] [blame] | 212 | #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] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 225 | |
kkinnunen | 337d5963 | 2014-08-26 10:19:57 | [diff] [blame] | 226 | #ifndef GL_CHROMIUM_path_rendering |
kkinnunen | b959a846 | 2015-07-14 11:08:34 | [diff] [blame] | 227 | #define GL_CHROMIUM_path_rendering 1 |
kkinnunen | 337d5963 | 2014-08-26 10:19:57 | [diff] [blame] | 228 | // 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 | ||||
kkinnunen | b959a846 | 2015-07-14 11:08:34 | [diff] [blame] | 234 | #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 | ||||
kkinnunen | c8b449e158 | 2015-11-02 07:57:51 | [diff] [blame] | 241 | #define GL_EYE_LINEAR_CHROMIUM 0x2400 |
242 | #define GL_OBJECT_LINEAR_CHROMIUM 0x2401 | ||||
243 | #define GL_CONSTANT_CHROMIUM 0x8576 | ||||
kkinnunen | b959a846 | 2015-07-14 11:08:34 | [diff] [blame] | 244 | #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 | ||||
kkinnunen | fb3f117 | 2015-10-28 08:50:00 | [diff] [blame] | 253 | #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 | ||||
kkinnunen | b959a846 | 2015-07-14 11:08:34 | [diff] [blame] | 262 | #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 | ||||
kkinnunen | 337d5963 | 2014-08-26 10:19:57 | [diff] [blame] | 269 | #endif |
270 | |||||
kkinnunen | f26d738 | 2015-12-01 13:34:14 | [diff] [blame] | 271 | #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 | |||||
kkinnunen | a9d27e7 | 2015-12-21 17:23:44 | [diff] [blame] | 277 | #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 | |||||
ed | 9198b42 | 2014-10-23 15:01:37 | [diff] [blame] | 282 | #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 | |||||
dyen | 882e1b7 | 2014-09-03 16:36:49 | [diff] [blame] | 306 | #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 | |||||
oetuaho | 37cc50e | 2014-10-31 11:19:20 | [diff] [blame] | 314 | #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 | |||||
hendrikw | 83f2fb5 | 2014-12-02 03:30:40 | [diff] [blame] | 326 | #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 | |||||
kkinnunen | c8b449e158 | 2015-11-02 07:57:51 | [diff] [blame] | 334 | // 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 | |||||
kkinnunen | 8cefb23 | 2015-12-04 09:36:31 | [diff] [blame] | 343 | #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] | cb68eca | 2013-02-15 07:38:38 | [diff] [blame] | 353 | #define GL_GLEXT_PROTOTYPES 1 |
354 | |||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 355 | #if defined(OS_WIN) |
356 | #define GL_BINDING_CALL WINAPI | ||||
357 | #else | ||||
358 | #define GL_BINDING_CALL | ||||
359 | #endif | ||||
360 | |||||
[email protected] | 218a5a2 | 2010-11-04 19:27:49 | [diff] [blame] | 361 | #define GL_SERVICE_LOG(args) DLOG(INFO) << args; |
[email protected] | 5a83fca | 2012-04-22 02:05:08 | [diff] [blame] | 362 | #if defined(NDEBUG) |
[email protected] | 92afb77 | 2011-12-09 01:49:56 | [diff] [blame] | 363 | #define GL_SERVICE_LOG_CODE_BLOCK(code) |
364 | #else | ||||
365 | #define GL_SERVICE_LOG_CODE_BLOCK(code) code | ||||
366 | #endif | ||||
[email protected] | 218a5a2 | 2010-11-04 19:27:49 | [diff] [blame] | 367 | |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 368 | // Forward declare OSMesa types. |
369 | typedef struct osmesa_context *OSMesaContext; | ||||
370 | typedef void (*OSMESAproc)(); | ||||
371 | |||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 372 | // Forward declare EGL types. |
avi | 739878c | 2015-12-24 18:06:17 | [diff] [blame] | 373 | typedef uint64_t EGLuint64CHROMIUM; |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 374 | |
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] | 2ec8df5 | 2011-05-25 23:44:58 | [diff] [blame] | 381 | #elif defined(USE_X11) |
[email protected] | 0bec8e2 | 2010-06-21 22:20:02 | [diff] [blame] | 382 | #include "gl_bindings_autogen_egl.h" |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 383 | #include "gl_bindings_autogen_glx.h" |
[email protected] | efcf2059 | 2013-05-24 06:55:56 | [diff] [blame] | 384 | #elif defined(USE_OZONE) |
385 | #include "gl_bindings_autogen_egl.h" | ||||
[email protected] | c8e295b | 2011-11-21 21:24:14 | [diff] [blame] | 386 | #elif defined(OS_ANDROID) |
387 | #include "gl_bindings_autogen_egl.h" | ||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 388 | #endif |
389 | |||||
390 | namespace gfx { | ||||
391 | |||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 392 | struct GL_EXPORT DriverGL { |
[email protected] | a37d7ff | 2014-01-17 21:31:00 | [diff] [blame] | 393 | void InitializeStaticBindings(); |
394 | void InitializeCustomDynamicBindings(GLContext* context); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 395 | void InitializeDebugBindings(); |
[email protected] | 70c908c | 2014-01-12 02:09:45 | [diff] [blame] | 396 | void InitializeNullDrawBindings(); |
[email protected] | ae967b0 | 2014-02-21 21:18:58 | [diff] [blame] | 397 | // TODO(danakj): Remove this when all test suites are using null-draw. |
398 | bool HasInitializedNullDrawBindings(); | ||||
[email protected] | 2fc82a9 | 2014-02-20 22:52:08 | [diff] [blame] | 399 | bool SetNullDrawBindingsEnabled(bool enabled); |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 400 | void ClearBindings(); |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 401 | |
402 | ProcsGL fn; | ||||
403 | ProcsGL orig_fn; | ||||
404 | ProcsGL debug_fn; | ||||
405 | ExtensionsGL ext; | ||||
[email protected] | 2fc82a9 | 2014-02-20 22:52:08 | [diff] [blame] | 406 | bool null_draw_bindings_enabled; |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 407 | |
408 | private: | ||||
[email protected] | a37d7ff | 2014-01-17 21:31:00 | [diff] [blame] | 409 | void InitializeDynamicBindings(GLContext* context); |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 410 | }; |
411 | |||||
412 | struct GL_EXPORT DriverOSMESA { | ||||
[email protected] | a37d7ff | 2014-01-17 21:31:00 | [diff] [blame] | 413 | void InitializeStaticBindings(); |
tobiasjs | bbda465 | 2015-06-26 23:08:53 | [diff] [blame] | 414 | void InitializeExtensionBindings(); |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 415 | void InitializeDebugBindings(); |
416 | void ClearBindings(); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 417 | |
418 | ProcsOSMESA fn; | ||||
419 | ProcsOSMESA debug_fn; | ||||
420 | ExtensionsOSMESA ext; | ||||
sievers | e3b17fd5 | 2015-01-29 04:00:53 | [diff] [blame] | 421 | |
422 | private: | ||||
423 | static std::string GetPlatformExtensions(); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 424 | }; |
425 | |||||
426 | #if defined(OS_WIN) | ||||
427 | struct GL_EXPORT DriverWGL { | ||||
[email protected] | a37d7ff | 2014-01-17 21:31:00 | [diff] [blame] | 428 | void InitializeStaticBindings(); |
tobiasjs | bbda465 | 2015-06-26 23:08:53 | [diff] [blame] | 429 | void InitializeExtensionBindings(); |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 430 | void InitializeDebugBindings(); |
431 | void ClearBindings(); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 432 | |
433 | ProcsWGL fn; | ||||
434 | ProcsWGL debug_fn; | ||||
435 | ExtensionsWGL ext; | ||||
sievers | e3b17fd5 | 2015-01-29 04:00:53 | [diff] [blame] | 436 | |
437 | private: | ||||
438 | static std::string GetPlatformExtensions(); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 439 | }; |
440 | #endif | ||||
441 | |||||
[email protected] | efcf2059 | 2013-05-24 06:55:56 | [diff] [blame] | 442 | #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || defined(USE_OZONE) |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 443 | struct GL_EXPORT DriverEGL { |
[email protected] | a37d7ff | 2014-01-17 21:31:00 | [diff] [blame] | 444 | void InitializeStaticBindings(); |
tobiasjs | bbda465 | 2015-06-26 23:08:53 | [diff] [blame] | 445 | void InitializeExtensionBindings(); |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 446 | void InitializeDebugBindings(); |
447 | void ClearBindings(); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 448 | |
449 | ProcsEGL fn; | ||||
450 | ProcsEGL debug_fn; | ||||
451 | ExtensionsEGL ext; | ||||
sievers | e3b17fd5 | 2015-01-29 04:00:53 | [diff] [blame] | 452 | |
sievers | e3b17fd5 | 2015-01-29 04:00:53 | [diff] [blame] | 453 | static std::string GetPlatformExtensions(); |
jmadill | c3cfb9c | 2015-04-14 21:13:58 | [diff] [blame] | 454 | static std::string GetClientExtensions(); |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 455 | }; |
456 | #endif | ||||
457 | |||||
458 | #if defined(USE_X11) | ||||
459 | struct GL_EXPORT DriverGLX { | ||||
[email protected] | a37d7ff | 2014-01-17 21:31:00 | [diff] [blame] | 460 | void InitializeStaticBindings(); |
tobiasjs | bbda465 | 2015-06-26 23:08:53 | [diff] [blame] | 461 | void InitializeExtensionBindings(); |
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 462 | void InitializeDebugBindings(); |
463 | void ClearBindings(); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 464 | |
465 | ProcsGLX fn; | ||||
466 | ProcsGLX debug_fn; | ||||
467 | ExtensionsGLX ext; | ||||
sievers | e3b17fd5 | 2015-01-29 04:00:53 | [diff] [blame] | 468 | |
469 | private: | ||||
470 | static std::string GetPlatformExtensions(); | ||||
[email protected] | 8f1d2aa | 2013-05-10 23:45:38 | [diff] [blame] | 471 | }; |
472 | #endif | ||||
473 | |||||
[email protected] | 06a1a692 | 2013-07-26 11:51:52 | [diff] [blame] | 474 | // This #define is here to support autogenerated code. |
475 | #define g_current_gl_context g_current_gl_context_tls->Get() | ||||
476 | GL_EXPORT extern base::ThreadLocalPointer<GLApi>* g_current_gl_context_tls; | ||||
477 | |||||
[email protected] | b97c908 | 2012-10-25 17:21:38 | [diff] [blame] | 478 | GL_EXPORT extern OSMESAApi* g_current_osmesa_context; |
479 | GL_EXPORT extern DriverGL g_driver_gl; | ||||
480 | GL_EXPORT extern DriverOSMESA g_driver_osmesa; | ||||
481 | |||||
482 | #if defined(OS_WIN) | ||||
483 | |||||
484 | GL_EXPORT extern EGLApi* g_current_egl_context; | ||||
485 | GL_EXPORT extern WGLApi* g_current_wgl_context; | ||||
486 | GL_EXPORT extern DriverEGL g_driver_egl; | ||||
487 | GL_EXPORT extern DriverWGL g_driver_wgl; | ||||
488 | |||||
489 | #elif defined(USE_X11) | ||||
490 | |||||
491 | GL_EXPORT extern EGLApi* g_current_egl_context; | ||||
492 | GL_EXPORT extern GLXApi* g_current_glx_context; | ||||
493 | GL_EXPORT extern DriverEGL g_driver_egl; | ||||
494 | GL_EXPORT extern DriverGLX g_driver_glx; | ||||
495 | |||||
[email protected] | efcf2059 | 2013-05-24 06:55:56 | [diff] [blame] | 496 | #elif defined(USE_OZONE) |
497 | |||||
498 | GL_EXPORT extern EGLApi* g_current_egl_context; | ||||
499 | GL_EXPORT extern DriverEGL g_driver_egl; | ||||
500 | |||||
[email protected] | b97c908 | 2012-10-25 17:21:38 | [diff] [blame] | 501 | #elif defined(OS_ANDROID) |
502 | |||||
503 | GL_EXPORT extern EGLApi* g_current_egl_context; | ||||
504 | GL_EXPORT extern DriverEGL g_driver_egl; | ||||
505 | |||||
506 | #endif | ||||
507 | |||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 508 | } // namespace gfx |
509 | |||||
[email protected] | c9e2cbbb | 2012-05-12 21:17:27 | [diff] [blame] | 510 | #endif // UI_GL_GL_BINDINGS_H_ |