gl.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * Copyright © 2013 Intel Corporation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice (including the next
  12. * paragraph) shall be included in all copies or substantial portions of the
  13. * Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  18. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  21. * IN THE SOFTWARE.
  22. */
  23. /** @file gl.h
  24. *
  25. * Provides an implementation of a GL dispatch layer using either
  26. * global function pointers or a hidden vtable.
  27. *
  28. * You should include `<epoxy/gl.h>` instead of `<GL/gl.h>` and `<GL/glext.h>`.
  29. */
  30. #ifndef EPOXY_GL_H
  31. #define EPOXY_GL_H
  32. #include "epoxy/common.h"
  33. #if defined(__gl_h_) || defined(__glext_h_)
  34. #error epoxy/gl.h must be included before (or in place of) GL/gl.h
  35. #else
  36. #define __gl_h_
  37. #define __glext_h_
  38. #endif
  39. #define KHRONOS_SUPPORT_INT64 1
  40. #define KHRONOS_SUPPORT_FLOAT 1
  41. #define KHRONOS_APIATTRIBUTES
  42. #ifndef _WIN32
  43. /* APIENTRY and GLAPIENTRY are not used on Linux or Mac. */
  44. #define APIENTRY
  45. #define GLAPIENTRY
  46. #define EPOXY_CALLSPEC
  47. #define GLAPI
  48. #define KHRONOS_APIENTRY
  49. #define KHRONOS_APICALL
  50. #else
  51. #ifndef APIENTRY
  52. #define APIENTRY __stdcall
  53. #endif
  54. #ifndef GLAPIENTRY
  55. #define GLAPIENTRY APIENTRY
  56. #endif
  57. #ifndef EPOXY_CALLSPEC
  58. #define EPOXY_CALLSPEC __stdcall
  59. #endif
  60. #ifndef GLAPI
  61. #define GLAPI extern
  62. #endif
  63. #define KHRONOS_APIENTRY __stdcall
  64. #define KHRONOS_APICALL __declspec(dllimport) __stdcall
  65. #endif /* _WIN32 */
  66. #ifndef APIENTRYP
  67. #define APIENTRYP APIENTRY *
  68. #endif
  69. #ifndef GLAPIENTRYP
  70. #define GLAPIENTRYP GLAPIENTRY *
  71. #endif
  72. EPOXY_BEGIN_DECLS
  73. #include "epoxy/gl_generated.h"
  74. EPOXY_PUBLIC bool epoxy_has_gl_extension(const char *extension);
  75. EPOXY_PUBLIC bool epoxy_is_desktop_gl(void);
  76. EPOXY_PUBLIC int epoxy_gl_version(void);
  77. EPOXY_PUBLIC int epoxy_glsl_version(void);
  78. /*
  79. * the type of the stub function that the failure handler must return;
  80. * this function will be called on subsequent calls to the same bogus
  81. * function name
  82. */
  83. typedef void (*epoxy_resolver_stub_t)(void);
  84. /* the type of the failure handler itself */
  85. typedef epoxy_resolver_stub_t
  86. (*epoxy_resolver_failure_handler_t)(const char *name);
  87. EPOXY_PUBLIC epoxy_resolver_failure_handler_t
  88. epoxy_set_resolver_failure_handler(epoxy_resolver_failure_handler_t handler);
  89. EPOXY_END_DECLS
  90. #endif /* EPOXY_GL_H */