1
0

gl.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. #ifndef WINAPI
  53. #define WINAPI __stdcall
  54. #endif
  55. #define APIENTRY WINAPI
  56. #endif
  57. #ifndef GLAPIENTRY
  58. #define GLAPIENTRY APIENTRY
  59. #endif
  60. #ifndef EPOXY_CALLSPEC
  61. #define EPOXY_CALLSPEC __stdcall
  62. #endif
  63. #ifndef GLAPI
  64. #define GLAPI extern
  65. #endif
  66. #define KHRONOS_APIENTRY __stdcall
  67. #define KHRONOS_APICALL __declspec(dllimport) __stdcall
  68. #endif /* _WIN32 */
  69. #ifndef APIENTRYP
  70. #define APIENTRYP APIENTRY *
  71. #endif
  72. #ifndef GLAPIENTRYP
  73. #define GLAPIENTRYP GLAPIENTRY *
  74. #endif
  75. EPOXY_BEGIN_DECLS
  76. #include "epoxy/gl_generated.h"
  77. EPOXY_PUBLIC bool epoxy_has_gl_extension(const char *extension);
  78. EPOXY_PUBLIC bool epoxy_is_desktop_gl(void);
  79. EPOXY_PUBLIC int epoxy_gl_version(void);
  80. EPOXY_PUBLIC int epoxy_glsl_version(void);
  81. /*
  82. * the type of the stub function that the failure handler must return;
  83. * this function will be called on subsequent calls to the same bogus
  84. * function name
  85. */
  86. typedef void (*epoxy_resolver_stub_t)(void);
  87. /* the type of the failure handler itself */
  88. typedef epoxy_resolver_stub_t
  89. (*epoxy_resolver_failure_handler_t)(const char *name);
  90. EPOXY_PUBLIC epoxy_resolver_failure_handler_t
  91. epoxy_set_resolver_failure_handler(epoxy_resolver_failure_handler_t handler);
  92. EPOXY_END_DECLS
  93. #endif /* EPOXY_GL_H */