compat.dox 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. /*!
  2. @page compat_guide Standards conformance
  3. @tableofcontents
  4. This guide describes the various API extensions used by this version of GLFW.
  5. It lists what are essentially implementation details, but which are nonetheless
  6. vital knowledge for developers intending to deploy their applications on a wide
  7. range of machines.
  8. The information in this guide is not a part of GLFW API, but merely
  9. preconditions for some parts of the library to function on a given machine. Any
  10. part of this information may change in future versions of GLFW and that will not
  11. be considered a breaking API change.
  12. @section compat_x11 X11 extensions, protocols and IPC standards
  13. As GLFW uses Xlib directly, without any intervening toolkit
  14. library, it has sole responsibility for interacting well with the many and
  15. varied window managers in use on Unix-like systems. In order for applications
  16. and window managers to work well together, a number of standards and
  17. conventions have been developed that regulate behavior outside the scope of the
  18. X11 API; most importantly the
  19. [Inter-Client Communication Conventions Manual](https://www.tronche.com/gui/x/icccm/)
  20. (ICCCM) and
  21. [Extended Window Manager Hints](https://standards.freedesktop.org/wm-spec/wm-spec-latest.html)
  22. (EWMH) standards.
  23. GLFW uses the `_MOTIF_WM_HINTS` window property to support borderless windows.
  24. If the running window manager does not support this property, the
  25. `GLFW_DECORATED` hint will have no effect.
  26. GLFW uses the ICCCM `WM_DELETE_WINDOW` protocol to intercept the user
  27. attempting to close the GLFW window. If the running window manager does not
  28. support this protocol, the close callback will never be called.
  29. GLFW uses the EWMH `_NET_WM_PING` protocol, allowing the window manager notify
  30. the user when the application has stopped responding, i.e. when it has ceased to
  31. process events. If the running window manager does not support this protocol,
  32. the user will not be notified if the application locks up.
  33. GLFW uses the EWMH `_NET_WM_STATE_FULLSCREEN` window state to tell the window
  34. manager to make the GLFW window full screen. If the running window manager does
  35. not support this state, full screen windows may not work properly. GLFW has
  36. a fallback code path in case this state is unavailable, but every window manager
  37. behaves slightly differently in this regard.
  38. GLFW uses the EWMH `_NET_WM_BYPASS_COMPOSITOR` window property to tell a
  39. compositing window manager to un-redirect full screen GLFW windows. If the
  40. running window manager uses compositing but does not support this property then
  41. additional copying may be performed for each buffer swap of full screen windows.
  42. GLFW uses the
  43. [clipboard manager protocol](https://www.freedesktop.org/wiki/ClipboardManager/)
  44. to push a clipboard string (i.e. selection) owned by a GLFW window about to be
  45. destroyed to the clipboard manager. If there is no running clipboard manager,
  46. the clipboard string will be unavailable once the window has been destroyed.
  47. GLFW uses the
  48. [X drag-and-drop protocol](https://www.freedesktop.org/wiki/Specifications/XDND/)
  49. to provide file drop events. If the application originating the drag does not
  50. support this protocol, drag and drop will not work.
  51. GLFW uses the XRandR 1.3 extension to provide multi-monitor support. If the
  52. running X server does not support this version of this extension, multi-monitor
  53. support will not function and only a single, desktop-spanning monitor will be
  54. reported.
  55. GLFW uses the XRandR 1.3 and Xf86vidmode extensions to provide gamma ramp
  56. support. If the running X server does not support either or both of these
  57. extensions, gamma ramp support will not function.
  58. GLFW uses the Xkb extension and detectable auto-repeat to provide keyboard
  59. input. If the running X server does not support this extension, a non-Xkb
  60. fallback path is used.
  61. GLFW uses the XInput2 extension to provide raw, non-accelerated mouse motion
  62. when the cursor is disabled. If the running X server does not support this
  63. extension, regular accelerated mouse motion will be used.
  64. GLFW uses both the XRender extension and the compositing manager to support
  65. transparent window framebuffers. If the running X server does not support this
  66. extension or there is no running compositing manager, the
  67. `GLFW_TRANSPARENT_FRAMEBUFFER` framebuffer hint will have no effect.
  68. @section compat_wayland Wayland protocols and IPC standards
  69. As GLFW uses libwayland directly, without any intervening toolkit library, it
  70. has sole responsibility for interacting well with every compositor in use on
  71. Unix-like systems. Most of the features are provided by the core protocol,
  72. while cursor support is provided by the libwayland-cursor helper library, EGL
  73. integration by libwayland-egl, and keyboard handling by
  74. [libxkbcommon](https://xkbcommon.org/). In addition, GLFW uses some protocols
  75. from wayland-protocols to provide additional features if the compositor
  76. supports them.
  77. GLFW uses xkbcommon 0.5.0 to provide compose key support. When it has been
  78. built against an older xkbcommon, the compose key will be disabled even if it
  79. has been configured in the compositor.
  80. GLFW uses the [xdg-shell
  81. protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/xdg-shell/xdg-shell.xml)
  82. to provide better window management. This protocol is part of
  83. wayland-protocols 1.12, and mandatory at build time. If the running compositor
  84. does not support this protocol, the older [wl_shell
  85. interface](https://cgit.freedesktop.org/wayland/wayland/tree/protocol/wayland.xml#n972)
  86. will be used instead. This will result in a worse integration with the
  87. desktop, especially on tiling compositors.
  88. GLFW uses the [relative pointer
  89. protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/relative-pointer/relative-pointer-unstable-v1.xml)
  90. alongside the [pointer constraints
  91. protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml)
  92. to implement disabled cursor. These two protocols are part of
  93. wayland-protocols 1.1, and mandatory at build time. If the running compositor
  94. does not support both of these protocols, disabling the cursor will have no
  95. effect.
  96. GLFW uses the [idle inhibit
  97. protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml)
  98. to prohibit the screensaver from starting. This protocol is part of
  99. wayland-protocols 1.6, and mandatory at build time. If the running compositor
  100. does not support this protocol, the screensaver may start even for full screen
  101. windows.
  102. GLFW uses the [xdg-decoration
  103. protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml)
  104. to request decorations to be drawn around its windows. This protocol is part
  105. of wayland-protocols 1.15, and mandatory at build time. If the running
  106. compositor does not support this protocol, a very simple frame will be drawn by
  107. GLFW itself, using the [viewporter
  108. protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/viewporter/viewporter.xml)
  109. alongside
  110. [subsurfaces](https://cgit.freedesktop.org/wayland/wayland/tree/protocol/wayland.xml#n2598).
  111. This protocol is part of wayland-protocols 1.4, and mandatory at build time.
  112. If the running compositor does not support this protocol either, no decorations
  113. will be drawn around windows.
  114. @section compat_glx GLX extensions
  115. The GLX API is the default API used to create OpenGL contexts on Unix-like
  116. systems using the X Window System.
  117. GLFW uses the GLX 1.3 `GLXFBConfig` functions to enumerate and select framebuffer pixel
  118. formats. If GLX 1.3 is not supported, @ref glfwInit will fail.
  119. GLFW uses the `GLX_MESA_swap_control,` `GLX_EXT_swap_control` and
  120. `GLX_SGI_swap_control` extensions to provide vertical retrace synchronization
  121. (or _vsync_), in that order of preference. Where none of these extension are
  122. available, calling @ref glfwSwapInterval will have no effect.
  123. GLFW uses the `GLX_ARB_multisample` extension to create contexts with
  124. multisampling anti-aliasing. Where this extension is unavailable, the
  125. `GLFW_SAMPLES` hint will have no effect.
  126. GLFW uses the `GLX_ARB_create_context` extension when available, even when
  127. creating OpenGL contexts of version 2.1 and below. Where this extension is
  128. unavailable, the `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR`
  129. hints will only be partially supported, the `GLFW_OPENGL_DEBUG_CONTEXT` hint
  130. will have no effect, and setting the `GLFW_OPENGL_PROFILE` or
  131. `GLFW_OPENGL_FORWARD_COMPAT` hints to `GLFW_TRUE` will cause @ref
  132. glfwCreateWindow to fail.
  133. GLFW uses the `GLX_ARB_create_context_profile` extension to provide support for
  134. context profiles. Where this extension is unavailable, setting the
  135. `GLFW_OPENGL_PROFILE` hint to anything but `GLFW_OPENGL_ANY_PROFILE`, or setting
  136. `GLFW_CLIENT_API` to anything but `GLFW_OPENGL_API` or `GLFW_NO_API` will cause
  137. @ref glfwCreateWindow to fail.
  138. GLFW uses the `GLX_ARB_context_flush_control` extension to provide control over
  139. whether a context is flushed when it is released (made non-current). Where this
  140. extension is unavailable, the `GLFW_CONTEXT_RELEASE_BEHAVIOR` hint will have no
  141. effect and the context will always be flushed when released.
  142. GLFW uses the `GLX_ARB_framebuffer_sRGB` and `GLX_EXT_framebuffer_sRGB`
  143. extensions to provide support for sRGB framebuffers. Where both of these
  144. extensions are unavailable, the `GLFW_SRGB_CAPABLE` hint will have no effect.
  145. @section compat_wgl WGL extensions
  146. The WGL API is used to create OpenGL contexts on Microsoft Windows and other
  147. implementations of the Win32 API, such as Wine.
  148. GLFW uses either the `WGL_EXT_extension_string` or the
  149. `WGL_ARB_extension_string` extension to check for the presence of all other WGL
  150. extensions listed below. If both are available, the EXT one is preferred. If
  151. neither is available, no other extensions are used and many GLFW features
  152. related to context creation will have no effect or cause errors when used.
  153. GLFW uses the `WGL_EXT_swap_control` extension to provide vertical retrace
  154. synchronization (or _vsync_). Where this extension is unavailable, calling @ref
  155. glfwSwapInterval will have no effect.
  156. GLFW uses the `WGL_ARB_pixel_format` and `WGL_ARB_multisample` extensions to
  157. create contexts with multisampling anti-aliasing. Where these extensions are
  158. unavailable, the `GLFW_SAMPLES` hint will have no effect.
  159. GLFW uses the `WGL_ARB_create_context` extension when available, even when
  160. creating OpenGL contexts of version 2.1 and below. Where this extension is
  161. unavailable, the `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR`
  162. hints will only be partially supported, the `GLFW_OPENGL_DEBUG_CONTEXT` hint
  163. will have no effect, and setting the `GLFW_OPENGL_PROFILE` or
  164. `GLFW_OPENGL_FORWARD_COMPAT` hints to `GLFW_TRUE` will cause @ref
  165. glfwCreateWindow to fail.
  166. GLFW uses the `WGL_ARB_create_context_profile` extension to provide support for
  167. context profiles. Where this extension is unavailable, setting the
  168. `GLFW_OPENGL_PROFILE` hint to anything but `GLFW_OPENGL_ANY_PROFILE` will cause
  169. @ref glfwCreateWindow to fail.
  170. GLFW uses the `WGL_ARB_context_flush_control` extension to provide control over
  171. whether a context is flushed when it is released (made non-current). Where this
  172. extension is unavailable, the `GLFW_CONTEXT_RELEASE_BEHAVIOR` hint will have no
  173. effect and the context will always be flushed when released.
  174. GLFW uses the `WGL_ARB_framebuffer_sRGB` and `WGL_EXT_framebuffer_sRGB`
  175. extensions to provide support for sRGB framebuffers. Where both of these
  176. extension are unavailable, the `GLFW_SRGB_CAPABLE` hint will have no effect.
  177. @section compat_osx OpenGL on macOS
  178. Support for OpenGL 3.2 and above was introduced with OS X 10.7 and even then
  179. only forward-compatible, core profile contexts are supported. Support for
  180. OpenGL 4.1 was introduced with OS X 10.9, also limited to forward-compatible,
  181. core profile contexts. There is also still no mechanism for requesting debug
  182. contexts or no-error contexts. Versions of Mac OS X earlier than 10.7 support
  183. at most OpenGL version 2.1.
  184. Because of this, on OS X 10.7 and later, the `GLFW_CONTEXT_VERSION_MAJOR` and
  185. `GLFW_CONTEXT_VERSION_MINOR` hints will cause @ref glfwCreateWindow to fail if
  186. given version 3.0 or 3.1. The `GLFW_OPENGL_FORWARD_COMPAT` hint must be set to
  187. `GLFW_TRUE` and the `GLFW_OPENGL_PROFILE` hint must be set to
  188. `GLFW_OPENGL_CORE_PROFILE` when creating OpenGL 3.2 and later contexts. The
  189. `GLFW_OPENGL_DEBUG_CONTEXT` and `GLFW_CONTEXT_NO_ERROR` hints are ignored.
  190. Also, on Mac OS X 10.6 and below, the `GLFW_CONTEXT_VERSION_MAJOR` and
  191. `GLFW_CONTEXT_VERSION_MINOR` hints will fail if given a version above 2.1,
  192. setting the `GLFW_OPENGL_PROFILE` or `GLFW_OPENGL_FORWARD_COMPAT` hints to
  193. a non-default value will cause @ref glfwCreateWindow to fail and the
  194. `GLFW_OPENGL_DEBUG_CONTEXT` hint is ignored.
  195. @section compat_vulkan Vulkan loader and API
  196. By default, GLFW uses the standard system-wide Vulkan loader to access the
  197. Vulkan API on all platforms except macOS. This is installed by both graphics
  198. drivers and Vulkan SDKs. If either the loader or at least one minimally
  199. functional ICD is missing, @ref glfwVulkanSupported will return `GLFW_FALSE` and
  200. all other Vulkan-related functions will fail with an @ref GLFW_API_UNAVAILABLE
  201. error.
  202. @section compat_wsi Vulkan WSI extensions
  203. The Vulkan WSI extensions are used to create Vulkan surfaces for GLFW windows on
  204. all supported platforms.
  205. GLFW uses the `VK_KHR_surface` and `VK_KHR_win32_surface` extensions to create
  206. surfaces on Microsoft Windows. If any of these extensions are not available,
  207. @ref glfwGetRequiredInstanceExtensions will return an empty list and window
  208. surface creation will fail.
  209. GLFW uses the `VK_KHR_surface` and either the `VK_MVK_macos_surface` or
  210. `VK_EXT_metal_surface` extensions to create surfaces on macOS. If any of these
  211. extensions are not available, @ref glfwGetRequiredInstanceExtensions will
  212. return an empty list and window surface creation will fail.
  213. GLFW uses the `VK_KHR_surface` and either the `VK_KHR_xlib_surface` or
  214. `VK_KHR_xcb_surface` extensions to create surfaces on X11. If `VK_KHR_surface`
  215. or both `VK_KHR_xlib_surface` and `VK_KHR_xcb_surface` are not available, @ref
  216. glfwGetRequiredInstanceExtensions will return an empty list and window surface
  217. creation will fail.
  218. GLFW uses the `VK_KHR_surface` and `VK_KHR_wayland_surface` extensions to create
  219. surfaces on Wayland. If any of these extensions are not available, @ref
  220. glfwGetRequiredInstanceExtensions will return an empty list and window surface
  221. creation will fail.
  222. */