Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: ui/gl/gl_bindings.h

Issue 1061733002: Remove windows/mac/ios specific code from //ui (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: fix default try set Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gl/gl.gyp ('k') | ui/gl/gl_bindings.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_GL_GL_BINDINGS_H_ 5 #ifndef UI_GL_GL_BINDINGS_H_
6 #define UI_GL_GL_BINDINGS_H_ 6 #define UI_GL_GL_BINDINGS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 // Includes the platform independent and platform dependent GL headers. 10 // Includes the platform independent and platform dependent GL headers.
11 // Only include this in cc files. It pulls in system headers, including 11 // Only include this in cc files. It pulls in system headers, including
12 // the X11 headers on linux, which define all kinds of macros that are 12 // the X11 headers on linux, which define all kinds of macros that are
13 // liable to cause conflicts. 13 // liable to cause conflicts.
14 14
15 #include <GL/gl.h> 15 #include <GL/gl.h>
16 #include <GL/glext.h> 16 #include <GL/glext.h>
17 #include <EGL/egl.h> 17 #include <EGL/egl.h>
18 #include <EGL/eglext.h> 18 #include <EGL/eglext.h>
19 19
20 #include "base/logging.h" 20 #include "base/logging.h"
21 #include "base/threading/thread_local.h" 21 #include "base/threading/thread_local.h"
22 #include "build/build_config.h" 22 #include "build/build_config.h"
23 #include "ui/gl/gl_export.h" 23 #include "ui/gl/gl_export.h"
24 24
25 // The standard OpenGL native extension headers are also included. 25 // The standard OpenGL native extension headers are also included.
26 #if defined(OS_WIN) 26 #if defined(USE_X11)
27 #include <GL/wglext.h>
28 #elif defined(OS_MACOSX)
29 #include <OpenGL/OpenGL.h>
30 #elif defined(USE_X11)
31 #include <GL/glx.h> 27 #include <GL/glx.h>
32 #include <GL/glxext.h> 28 #include <GL/glxext.h>
33 29
34 // Undefine some macros defined by X headers. This is why this file should only 30 // Undefine some macros defined by X headers. This is why this file should only
35 // be included in .cc files. 31 // be included in .cc files.
36 #undef Bool 32 #undef Bool
37 #undef None 33 #undef None
38 #undef Status 34 #undef Status
39 #endif 35 #endif
40 36
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 #ifndef GL_EXT_texture_rg 277 #ifndef GL_EXT_texture_rg
282 #define GL_EXT_texture_rg 1 278 #define GL_EXT_texture_rg 1
283 #define GL_RED_EXT 0x1903 279 #define GL_RED_EXT 0x1903
284 #define GL_RG_EXT 0x8227 280 #define GL_RG_EXT 0x8227
285 #define GL_R8_EXT 0x8229 281 #define GL_R8_EXT 0x8229
286 #define GL_RG8_EXT 0x822B 282 #define GL_RG8_EXT 0x822B
287 #endif /* GL_EXT_texture_rg */ 283 #endif /* GL_EXT_texture_rg */
288 284
289 #define GL_GLEXT_PROTOTYPES 1 285 #define GL_GLEXT_PROTOTYPES 1
290 286
291 #if defined(OS_WIN)
292 #define GL_BINDING_CALL WINAPI
293 #else
294 #define GL_BINDING_CALL 287 #define GL_BINDING_CALL
295 #endif
296 288
297 #define GL_SERVICE_LOG(args) DLOG(INFO) << args; 289 #define GL_SERVICE_LOG(args) DLOG(INFO) << args;
298 #if defined(NDEBUG) 290 #if defined(NDEBUG)
299 #define GL_SERVICE_LOG_CODE_BLOCK(code) 291 #define GL_SERVICE_LOG_CODE_BLOCK(code)
300 #else 292 #else
301 #define GL_SERVICE_LOG_CODE_BLOCK(code) code 293 #define GL_SERVICE_LOG_CODE_BLOCK(code) code
302 #endif 294 #endif
303 295
304 // Forward declare OSMesa types. 296 // Forward declare OSMesa types.
305 typedef struct osmesa_context *OSMesaContext; 297 typedef struct osmesa_context *OSMesaContext;
306 typedef void (*OSMESAproc)(); 298 typedef void (*OSMESAproc)();
307 299
308 // Forward declare EGL types. 300 // Forward declare EGL types.
309 typedef uint64 EGLuint64CHROMIUM; 301 typedef uint64 EGLuint64CHROMIUM;
310 302
311 #include "gl_bindings_autogen_gl.h" 303 #include "gl_bindings_autogen_gl.h"
312 #include "gl_bindings_autogen_osmesa.h" 304 #include "gl_bindings_autogen_osmesa.h"
313 305
314 #if defined(OS_WIN) 306 #if defined(USE_X11)
315 #include "gl_bindings_autogen_egl.h"
316 #include "gl_bindings_autogen_wgl.h"
317 #elif defined(USE_X11)
318 #include "gl_bindings_autogen_egl.h" 307 #include "gl_bindings_autogen_egl.h"
319 #include "gl_bindings_autogen_glx.h" 308 #include "gl_bindings_autogen_glx.h"
320 #elif defined(USE_OZONE) 309 #elif defined(USE_OZONE)
321 #include "gl_bindings_autogen_egl.h" 310 #include "gl_bindings_autogen_egl.h"
322 #elif defined(OS_ANDROID) 311 #elif defined(OS_ANDROID)
323 #include "gl_bindings_autogen_egl.h" 312 #include "gl_bindings_autogen_egl.h"
324 #endif 313 #endif
325 314
326 namespace gfx { 315 namespace gfx {
327 316
(...skipping 23 matching lines...) Expand all
351 void ClearBindings(); 340 void ClearBindings();
352 341
353 ProcsOSMESA fn; 342 ProcsOSMESA fn;
354 ProcsOSMESA debug_fn; 343 ProcsOSMESA debug_fn;
355 ExtensionsOSMESA ext; 344 ExtensionsOSMESA ext;
356 345
357 private: 346 private:
358 static std::string GetPlatformExtensions(); 347 static std::string GetPlatformExtensions();
359 }; 348 };
360 349
361 #if defined(OS_WIN)
362 struct GL_EXPORT DriverWGL {
363 void InitializeStaticBindings();
364 void InitializeDebugBindings();
365 void ClearBindings();
366
367 ProcsWGL fn;
368 ProcsWGL debug_fn;
369 ExtensionsWGL ext;
370
371 private:
372 static std::string GetPlatformExtensions();
373 };
374 #endif
375
376 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || defined(USE_OZ ONE)
377 struct GL_EXPORT DriverEGL { 350 struct GL_EXPORT DriverEGL {
378 void InitializeStaticBindings(); 351 void InitializeStaticBindings();
379 void InitializeDebugBindings(); 352 void InitializeDebugBindings();
380 void ClearBindings(); 353 void ClearBindings();
381 354
382 ProcsEGL fn; 355 ProcsEGL fn;
383 ProcsEGL debug_fn; 356 ProcsEGL debug_fn;
384 ExtensionsEGL ext; 357 ExtensionsEGL ext;
385 358
386 private: 359 private:
387 static std::string GetPlatformExtensions(); 360 static std::string GetPlatformExtensions();
388 }; 361 };
389 #endif
390 362
391 #if defined(USE_X11) 363 #if defined(USE_X11)
392 struct GL_EXPORT DriverGLX { 364 struct GL_EXPORT DriverGLX {
393 void InitializeStaticBindings(); 365 void InitializeStaticBindings();
394 void InitializeDebugBindings(); 366 void InitializeDebugBindings();
395 void ClearBindings(); 367 void ClearBindings();
396 368
397 ProcsGLX fn; 369 ProcsGLX fn;
398 ProcsGLX debug_fn; 370 ProcsGLX debug_fn;
399 ExtensionsGLX ext; 371 ExtensionsGLX ext;
400 372
401 private: 373 private:
402 static std::string GetPlatformExtensions(); 374 static std::string GetPlatformExtensions();
403 }; 375 };
404 #endif 376 #endif
405 377
406 // This #define is here to support autogenerated code. 378 // This #define is here to support autogenerated code.
407 #define g_current_gl_context g_current_gl_context_tls->Get() 379 #define g_current_gl_context g_current_gl_context_tls->Get()
408 GL_EXPORT extern base::ThreadLocalPointer<GLApi>* g_current_gl_context_tls; 380 GL_EXPORT extern base::ThreadLocalPointer<GLApi>* g_current_gl_context_tls;
409 381
410 GL_EXPORT extern OSMESAApi* g_current_osmesa_context; 382 GL_EXPORT extern OSMESAApi* g_current_osmesa_context;
411 GL_EXPORT extern DriverGL g_driver_gl; 383 GL_EXPORT extern DriverGL g_driver_gl;
412 GL_EXPORT extern DriverOSMESA g_driver_osmesa; 384 GL_EXPORT extern DriverOSMESA g_driver_osmesa;
413 385
414 #if defined(OS_WIN) 386 #if defined(USE_X11)
415
416 GL_EXPORT extern EGLApi* g_current_egl_context;
417 GL_EXPORT extern WGLApi* g_current_wgl_context;
418 GL_EXPORT extern DriverEGL g_driver_egl;
419 GL_EXPORT extern DriverWGL g_driver_wgl;
420
421 #elif defined(USE_X11)
422 387
423 GL_EXPORT extern EGLApi* g_current_egl_context; 388 GL_EXPORT extern EGLApi* g_current_egl_context;
424 GL_EXPORT extern GLXApi* g_current_glx_context; 389 GL_EXPORT extern GLXApi* g_current_glx_context;
425 GL_EXPORT extern DriverEGL g_driver_egl; 390 GL_EXPORT extern DriverEGL g_driver_egl;
426 GL_EXPORT extern DriverGLX g_driver_glx; 391 GL_EXPORT extern DriverGLX g_driver_glx;
427 392
428 #elif defined(USE_OZONE) 393 #elif defined(USE_OZONE)
429 394
430 GL_EXPORT extern EGLApi* g_current_egl_context; 395 GL_EXPORT extern EGLApi* g_current_egl_context;
431 GL_EXPORT extern DriverEGL g_driver_egl; 396 GL_EXPORT extern DriverEGL g_driver_egl;
432 397
433 #elif defined(OS_ANDROID) 398 #elif defined(OS_ANDROID)
434 399
435 GL_EXPORT extern EGLApi* g_current_egl_context; 400 GL_EXPORT extern EGLApi* g_current_egl_context;
436 GL_EXPORT extern DriverEGL g_driver_egl; 401 GL_EXPORT extern DriverEGL g_driver_egl;
437 402
438 #endif 403 #endif
439 404
440 } // namespace gfx 405 } // namespace gfx
441 406
442 #endif // UI_GL_GL_BINDINGS_H_ 407 #endif // UI_GL_GL_BINDINGS_H_
OLDNEW
« no previous file with comments | « ui/gl/gl.gyp ('k') | ui/gl/gl_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698