gstaichi 2.1.1rc3__cp310-cp310-macosx_11_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. gstaichi/CHANGELOG.md +4 -0
  2. gstaichi/__init__.py +40 -0
  3. gstaichi/_funcs.py +706 -0
  4. gstaichi/_kernels.py +420 -0
  5. gstaichi/_lib/__init__.py +3 -0
  6. gstaichi/_lib/core/__init__.py +0 -0
  7. gstaichi/_lib/core/gstaichi_python.cpython-310-darwin.so +0 -0
  8. gstaichi/_lib/core/gstaichi_python.pyi +2909 -0
  9. gstaichi/_lib/core/py.typed +0 -0
  10. gstaichi/_lib/runtime/libMoltenVK.dylib +0 -0
  11. gstaichi/_lib/runtime/runtime_arm64.bc +0 -0
  12. gstaichi/_lib/utils.py +243 -0
  13. gstaichi/_logging.py +131 -0
  14. gstaichi/_snode/__init__.py +5 -0
  15. gstaichi/_snode/fields_builder.py +187 -0
  16. gstaichi/_snode/snode_tree.py +34 -0
  17. gstaichi/_test_tools/__init__.py +18 -0
  18. gstaichi/_test_tools/dataclass_test_tools.py +36 -0
  19. gstaichi/_test_tools/load_kernel_string.py +30 -0
  20. gstaichi/_test_tools/textwrap2.py +6 -0
  21. gstaichi/_version.py +1 -0
  22. gstaichi/_version_check.py +100 -0
  23. gstaichi/ad/__init__.py +3 -0
  24. gstaichi/ad/_ad.py +530 -0
  25. gstaichi/algorithms/__init__.py +3 -0
  26. gstaichi/algorithms/_algorithms.py +117 -0
  27. gstaichi/assets/.git +1 -0
  28. gstaichi/assets/Go-Regular.ttf +0 -0
  29. gstaichi/assets/static/imgs/ti_gallery.png +0 -0
  30. gstaichi/examples/lcg_python.py +26 -0
  31. gstaichi/examples/lcg_taichi.py +34 -0
  32. gstaichi/examples/minimal.py +28 -0
  33. gstaichi/experimental.py +16 -0
  34. gstaichi/lang/__init__.py +50 -0
  35. gstaichi/lang/_dataclass_util.py +31 -0
  36. gstaichi/lang/_fast_caching/__init__.py +3 -0
  37. gstaichi/lang/_fast_caching/args_hasher.py +110 -0
  38. gstaichi/lang/_fast_caching/config_hasher.py +30 -0
  39. gstaichi/lang/_fast_caching/fast_caching_types.py +21 -0
  40. gstaichi/lang/_fast_caching/function_hasher.py +57 -0
  41. gstaichi/lang/_fast_caching/hash_utils.py +11 -0
  42. gstaichi/lang/_fast_caching/python_side_cache.py +52 -0
  43. gstaichi/lang/_fast_caching/src_hasher.py +75 -0
  44. gstaichi/lang/_kernel_impl_dataclass.py +212 -0
  45. gstaichi/lang/_ndarray.py +352 -0
  46. gstaichi/lang/_ndrange.py +152 -0
  47. gstaichi/lang/_template_mapper.py +195 -0
  48. gstaichi/lang/_texture.py +172 -0
  49. gstaichi/lang/_wrap_inspect.py +215 -0
  50. gstaichi/lang/any_array.py +99 -0
  51. gstaichi/lang/ast/__init__.py +5 -0
  52. gstaichi/lang/ast/ast_transformer.py +1323 -0
  53. gstaichi/lang/ast/ast_transformer_utils.py +346 -0
  54. gstaichi/lang/ast/ast_transformers/__init__.py +0 -0
  55. gstaichi/lang/ast/ast_transformers/call_transformer.py +324 -0
  56. gstaichi/lang/ast/ast_transformers/function_def_transformer.py +304 -0
  57. gstaichi/lang/ast/checkers.py +106 -0
  58. gstaichi/lang/ast/symbol_resolver.py +57 -0
  59. gstaichi/lang/ast/transform.py +9 -0
  60. gstaichi/lang/common_ops.py +310 -0
  61. gstaichi/lang/exception.py +80 -0
  62. gstaichi/lang/expr.py +180 -0
  63. gstaichi/lang/field.py +428 -0
  64. gstaichi/lang/impl.py +1243 -0
  65. gstaichi/lang/kernel_arguments.py +155 -0
  66. gstaichi/lang/kernel_impl.py +1341 -0
  67. gstaichi/lang/matrix.py +1835 -0
  68. gstaichi/lang/matrix_ops.py +341 -0
  69. gstaichi/lang/matrix_ops_utils.py +190 -0
  70. gstaichi/lang/mesh.py +687 -0
  71. gstaichi/lang/misc.py +782 -0
  72. gstaichi/lang/ops.py +1494 -0
  73. gstaichi/lang/runtime_ops.py +13 -0
  74. gstaichi/lang/shell.py +35 -0
  75. gstaichi/lang/simt/__init__.py +5 -0
  76. gstaichi/lang/simt/block.py +94 -0
  77. gstaichi/lang/simt/grid.py +7 -0
  78. gstaichi/lang/simt/subgroup.py +191 -0
  79. gstaichi/lang/simt/warp.py +96 -0
  80. gstaichi/lang/snode.py +489 -0
  81. gstaichi/lang/source_builder.py +150 -0
  82. gstaichi/lang/struct.py +810 -0
  83. gstaichi/lang/util.py +312 -0
  84. gstaichi/linalg/__init__.py +8 -0
  85. gstaichi/linalg/matrixfree_cg.py +310 -0
  86. gstaichi/linalg/sparse_cg.py +59 -0
  87. gstaichi/linalg/sparse_matrix.py +303 -0
  88. gstaichi/linalg/sparse_solver.py +123 -0
  89. gstaichi/math/__init__.py +11 -0
  90. gstaichi/math/_complex.py +205 -0
  91. gstaichi/math/mathimpl.py +886 -0
  92. gstaichi/profiler/__init__.py +6 -0
  93. gstaichi/profiler/kernel_metrics.py +260 -0
  94. gstaichi/profiler/kernel_profiler.py +586 -0
  95. gstaichi/profiler/memory_profiler.py +15 -0
  96. gstaichi/profiler/scoped_profiler.py +36 -0
  97. gstaichi/sparse/__init__.py +3 -0
  98. gstaichi/sparse/_sparse_grid.py +77 -0
  99. gstaichi/tools/__init__.py +12 -0
  100. gstaichi/tools/diagnose.py +117 -0
  101. gstaichi/tools/np2ply.py +364 -0
  102. gstaichi/tools/vtk.py +38 -0
  103. gstaichi/types/__init__.py +19 -0
  104. gstaichi/types/annotations.py +52 -0
  105. gstaichi/types/compound_types.py +71 -0
  106. gstaichi/types/enums.py +49 -0
  107. gstaichi/types/ndarray_type.py +169 -0
  108. gstaichi/types/primitive_types.py +206 -0
  109. gstaichi/types/quant.py +88 -0
  110. gstaichi/types/texture_type.py +85 -0
  111. gstaichi/types/utils.py +11 -0
  112. gstaichi-2.1.1rc3.data/data/include/GLFW/glfw3.h +6389 -0
  113. gstaichi-2.1.1rc3.data/data/include/GLFW/glfw3native.h +594 -0
  114. gstaichi-2.1.1rc3.data/data/include/spirv-tools/instrument.hpp +268 -0
  115. gstaichi-2.1.1rc3.data/data/include/spirv-tools/libspirv.h +907 -0
  116. gstaichi-2.1.1rc3.data/data/include/spirv-tools/libspirv.hpp +375 -0
  117. gstaichi-2.1.1rc3.data/data/include/spirv-tools/linker.hpp +97 -0
  118. gstaichi-2.1.1rc3.data/data/include/spirv-tools/optimizer.hpp +970 -0
  119. gstaichi-2.1.1rc3.data/data/include/spirv_cross/GLSL.std.450.h +114 -0
  120. gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv.h +2568 -0
  121. gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv.hpp +2579 -0
  122. gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_cfg.hpp +168 -0
  123. gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_common.hpp +1920 -0
  124. gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_cpp.hpp +93 -0
  125. gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_cross.hpp +1171 -0
  126. gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_cross_c.h +1074 -0
  127. gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_cross_containers.hpp +754 -0
  128. gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_cross_error_handling.hpp +94 -0
  129. gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_cross_parsed_ir.hpp +256 -0
  130. gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_cross_util.hpp +37 -0
  131. gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_glsl.hpp +1001 -0
  132. gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_hlsl.hpp +406 -0
  133. gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_msl.hpp +1273 -0
  134. gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_parser.hpp +103 -0
  135. gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_reflect.hpp +91 -0
  136. gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools/SPIRV-ToolsConfig.cmake +5 -0
  137. gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools/SPIRV-ToolsTarget-release.cmake +29 -0
  138. gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools/SPIRV-ToolsTarget.cmake +114 -0
  139. gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-diff/SPIRV-Tools-diffConfig.cmake +5 -0
  140. gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-diff/SPIRV-Tools-diffTargets-release.cmake +19 -0
  141. gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-diff/SPIRV-Tools-diffTargets.cmake +123 -0
  142. gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-link/SPIRV-Tools-linkConfig.cmake +5 -0
  143. gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-link/SPIRV-Tools-linkTargets-release.cmake +19 -0
  144. gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-link/SPIRV-Tools-linkTargets.cmake +123 -0
  145. gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-lint/SPIRV-Tools-lintConfig.cmake +5 -0
  146. gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-lint/SPIRV-Tools-lintTargets-release.cmake +19 -0
  147. gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-lint/SPIRV-Tools-lintTargets.cmake +123 -0
  148. gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-opt/SPIRV-Tools-optConfig.cmake +5 -0
  149. gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-opt/SPIRV-Tools-optTargets-release.cmake +19 -0
  150. gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-opt/SPIRV-Tools-optTargets.cmake +123 -0
  151. gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-reduce/SPIRV-Tools-reduceConfig.cmake +5 -0
  152. gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-reduce/SPIRV-Tools-reduceTarget-release.cmake +19 -0
  153. gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-reduce/SPIRV-Tools-reduceTarget.cmake +123 -0
  154. gstaichi-2.1.1rc3.data/data/lib/cmake/glfw3/glfw3Config.cmake +3 -0
  155. gstaichi-2.1.1rc3.data/data/lib/cmake/glfw3/glfw3ConfigVersion.cmake +65 -0
  156. gstaichi-2.1.1rc3.data/data/lib/cmake/glfw3/glfw3Targets-release.cmake +19 -0
  157. gstaichi-2.1.1rc3.data/data/lib/cmake/glfw3/glfw3Targets.cmake +107 -0
  158. gstaichi-2.1.1rc3.data/data/lib/libSPIRV-Tools-shared.dylib +0 -0
  159. gstaichi-2.1.1rc3.data/data/share/spirv_cross_c/cmake/spirv_cross_cConfig-release.cmake +19 -0
  160. gstaichi-2.1.1rc3.data/data/share/spirv_cross_c/cmake/spirv_cross_cConfig.cmake +123 -0
  161. gstaichi-2.1.1rc3.data/data/share/spirv_cross_core/cmake/spirv_cross_coreConfig-release.cmake +19 -0
  162. gstaichi-2.1.1rc3.data/data/share/spirv_cross_core/cmake/spirv_cross_coreConfig.cmake +106 -0
  163. gstaichi-2.1.1rc3.data/data/share/spirv_cross_cpp/cmake/spirv_cross_cppConfig-release.cmake +19 -0
  164. gstaichi-2.1.1rc3.data/data/share/spirv_cross_cpp/cmake/spirv_cross_cppConfig.cmake +123 -0
  165. gstaichi-2.1.1rc3.data/data/share/spirv_cross_glsl/cmake/spirv_cross_glslConfig-release.cmake +19 -0
  166. gstaichi-2.1.1rc3.data/data/share/spirv_cross_glsl/cmake/spirv_cross_glslConfig.cmake +123 -0
  167. gstaichi-2.1.1rc3.data/data/share/spirv_cross_hlsl/cmake/spirv_cross_hlslConfig-release.cmake +19 -0
  168. gstaichi-2.1.1rc3.data/data/share/spirv_cross_hlsl/cmake/spirv_cross_hlslConfig.cmake +123 -0
  169. gstaichi-2.1.1rc3.data/data/share/spirv_cross_msl/cmake/spirv_cross_mslConfig-release.cmake +19 -0
  170. gstaichi-2.1.1rc3.data/data/share/spirv_cross_msl/cmake/spirv_cross_mslConfig.cmake +123 -0
  171. gstaichi-2.1.1rc3.data/data/share/spirv_cross_reflect/cmake/spirv_cross_reflectConfig-release.cmake +19 -0
  172. gstaichi-2.1.1rc3.data/data/share/spirv_cross_reflect/cmake/spirv_cross_reflectConfig.cmake +106 -0
  173. gstaichi-2.1.1rc3.data/data/share/spirv_cross_util/cmake/spirv_cross_utilConfig-release.cmake +19 -0
  174. gstaichi-2.1.1rc3.data/data/share/spirv_cross_util/cmake/spirv_cross_utilConfig.cmake +123 -0
  175. gstaichi-2.1.1rc3.dist-info/METADATA +106 -0
  176. gstaichi-2.1.1rc3.dist-info/RECORD +179 -0
  177. gstaichi-2.1.1rc3.dist-info/WHEEL +5 -0
  178. gstaichi-2.1.1rc3.dist-info/licenses/LICENSE +201 -0
  179. gstaichi-2.1.1rc3.dist-info/top_level.txt +1 -0
@@ -0,0 +1,594 @@
1
+ /*************************************************************************
2
+ * GLFW 3.4 - www.glfw.org
3
+ * A library for OpenGL, window and input
4
+ *------------------------------------------------------------------------
5
+ * Copyright (c) 2002-2006 Marcus Geelnard
6
+ * Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
7
+ *
8
+ * This software is provided 'as-is', without any express or implied
9
+ * warranty. In no event will the authors be held liable for any damages
10
+ * arising from the use of this software.
11
+ *
12
+ * Permission is granted to anyone to use this software for any purpose,
13
+ * including commercial applications, and to alter it and redistribute it
14
+ * freely, subject to the following restrictions:
15
+ *
16
+ * 1. The origin of this software must not be misrepresented; you must not
17
+ * claim that you wrote the original software. If you use this software
18
+ * in a product, an acknowledgment in the product documentation would
19
+ * be appreciated but is not required.
20
+ *
21
+ * 2. Altered source versions must be plainly marked as such, and must not
22
+ * be misrepresented as being the original software.
23
+ *
24
+ * 3. This notice may not be removed or altered from any source
25
+ * distribution.
26
+ *
27
+ *************************************************************************/
28
+
29
+ #ifndef _glfw3_native_h_
30
+ #define _glfw3_native_h_
31
+
32
+ #ifdef __cplusplus
33
+ extern "C" {
34
+ #endif
35
+
36
+
37
+ /*************************************************************************
38
+ * Doxygen documentation
39
+ *************************************************************************/
40
+
41
+ /*! @file glfw3native.h
42
+ * @brief The header of the native access functions.
43
+ *
44
+ * This is the header file of the native access functions. See @ref native for
45
+ * more information.
46
+ */
47
+ /*! @defgroup native Native access
48
+ * @brief Functions related to accessing native handles.
49
+ *
50
+ * **By using the native access functions you assert that you know what you're
51
+ * doing and how to fix problems caused by using them. If you don't, you
52
+ * shouldn't be using them.**
53
+ *
54
+ * Before the inclusion of @ref glfw3native.h, you may define zero or more
55
+ * window system API macro and zero or more context creation API macros.
56
+ *
57
+ * The chosen backends must match those the library was compiled for. Failure
58
+ * to do this will cause a link-time error.
59
+ *
60
+ * The available window API macros are:
61
+ * * `GLFW_EXPOSE_NATIVE_WIN32`
62
+ * * `GLFW_EXPOSE_NATIVE_COCOA`
63
+ * * `GLFW_EXPOSE_NATIVE_X11`
64
+ * * `GLFW_EXPOSE_NATIVE_WAYLAND`
65
+ *
66
+ * The available context API macros are:
67
+ * * `GLFW_EXPOSE_NATIVE_WGL`
68
+ * * `GLFW_EXPOSE_NATIVE_NSGL`
69
+ * * `GLFW_EXPOSE_NATIVE_GLX`
70
+ * * `GLFW_EXPOSE_NATIVE_EGL`
71
+ * * `GLFW_EXPOSE_NATIVE_OSMESA`
72
+ *
73
+ * These macros select which of the native access functions that are declared
74
+ * and which platform-specific headers to include. It is then up your (by
75
+ * definition platform-specific) code to handle which of these should be
76
+ * defined.
77
+ */
78
+
79
+
80
+ /*************************************************************************
81
+ * System headers and types
82
+ *************************************************************************/
83
+
84
+ #if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL)
85
+ // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
86
+ // example to allow applications to correctly declare a GL_KHR_debug callback)
87
+ // but windows.h assumes no one will define APIENTRY before it does
88
+ #if defined(GLFW_APIENTRY_DEFINED)
89
+ #undef APIENTRY
90
+ #undef GLFW_APIENTRY_DEFINED
91
+ #endif
92
+ #include <windows.h>
93
+ #elif defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL)
94
+ #if defined(__OBJC__)
95
+ #import <Cocoa/Cocoa.h>
96
+ #else
97
+ #include <ApplicationServices/ApplicationServices.h>
98
+ typedef void* id;
99
+ #endif
100
+ #elif defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX)
101
+ #include <X11/Xlib.h>
102
+ #include <X11/extensions/Xrandr.h>
103
+ #elif defined(GLFW_EXPOSE_NATIVE_WAYLAND)
104
+ #include <wayland-client.h>
105
+ #endif
106
+
107
+ #if defined(GLFW_EXPOSE_NATIVE_WGL)
108
+ /* WGL is declared by windows.h */
109
+ #endif
110
+ #if defined(GLFW_EXPOSE_NATIVE_NSGL)
111
+ /* NSGL is declared by Cocoa.h */
112
+ #endif
113
+ #if defined(GLFW_EXPOSE_NATIVE_GLX)
114
+ #include <GL/glx.h>
115
+ #endif
116
+ #if defined(GLFW_EXPOSE_NATIVE_EGL)
117
+ #include <EGL/egl.h>
118
+ #endif
119
+ #if defined(GLFW_EXPOSE_NATIVE_OSMESA)
120
+ #include <GL/osmesa.h>
121
+ #endif
122
+
123
+
124
+ /*************************************************************************
125
+ * Functions
126
+ *************************************************************************/
127
+
128
+ #if defined(GLFW_EXPOSE_NATIVE_WIN32)
129
+ /*! @brief Returns the adapter device name of the specified monitor.
130
+ *
131
+ * @return The UTF-8 encoded adapter device name (for example `\\.\DISPLAY1`)
132
+ * of the specified monitor, or `NULL` if an [error](@ref error_handling)
133
+ * occurred.
134
+ *
135
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
136
+ *
137
+ * @thread_safety This function may be called from any thread. Access is not
138
+ * synchronized.
139
+ *
140
+ * @since Added in version 3.1.
141
+ *
142
+ * @ingroup native
143
+ */
144
+ GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
145
+
146
+ /*! @brief Returns the display device name of the specified monitor.
147
+ *
148
+ * @return The UTF-8 encoded display device name (for example
149
+ * `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an
150
+ * [error](@ref error_handling) occurred.
151
+ *
152
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
153
+ *
154
+ * @thread_safety This function may be called from any thread. Access is not
155
+ * synchronized.
156
+ *
157
+ * @since Added in version 3.1.
158
+ *
159
+ * @ingroup native
160
+ */
161
+ GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
162
+
163
+ /*! @brief Returns the `HWND` of the specified window.
164
+ *
165
+ * @return The `HWND` of the specified window, or `NULL` if an
166
+ * [error](@ref error_handling) occurred.
167
+ *
168
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
169
+ *
170
+ * @remark The `HDC` associated with the window can be queried with the
171
+ * [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
172
+ * function.
173
+ * @code
174
+ * HDC dc = GetDC(glfwGetWin32Window(window));
175
+ * @endcode
176
+ * This DC is private and does not need to be released.
177
+ *
178
+ * @thread_safety This function may be called from any thread. Access is not
179
+ * synchronized.
180
+ *
181
+ * @since Added in version 3.0.
182
+ *
183
+ * @ingroup native
184
+ */
185
+ GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
186
+ #endif
187
+
188
+ #if defined(GLFW_EXPOSE_NATIVE_WGL)
189
+ /*! @brief Returns the `HGLRC` of the specified window.
190
+ *
191
+ * @return The `HGLRC` of the specified window, or `NULL` if an
192
+ * [error](@ref error_handling) occurred.
193
+ *
194
+ * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
195
+ * GLFW_NOT_INITIALIZED.
196
+ *
197
+ * @remark The `HDC` associated with the window can be queried with the
198
+ * [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
199
+ * function.
200
+ * @code
201
+ * HDC dc = GetDC(glfwGetWin32Window(window));
202
+ * @endcode
203
+ * This DC is private and does not need to be released.
204
+ *
205
+ * @thread_safety This function may be called from any thread. Access is not
206
+ * synchronized.
207
+ *
208
+ * @since Added in version 3.0.
209
+ *
210
+ * @ingroup native
211
+ */
212
+ GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
213
+ #endif
214
+
215
+ #if defined(GLFW_EXPOSE_NATIVE_COCOA)
216
+ /*! @brief Returns the `CGDirectDisplayID` of the specified monitor.
217
+ *
218
+ * @return The `CGDirectDisplayID` of the specified monitor, or
219
+ * `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred.
220
+ *
221
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
222
+ *
223
+ * @thread_safety This function may be called from any thread. Access is not
224
+ * synchronized.
225
+ *
226
+ * @since Added in version 3.1.
227
+ *
228
+ * @ingroup native
229
+ */
230
+ GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
231
+
232
+ /*! @brief Returns the `NSWindow` of the specified window.
233
+ *
234
+ * @return The `NSWindow` of the specified window, or `nil` if an
235
+ * [error](@ref error_handling) occurred.
236
+ *
237
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
238
+ *
239
+ * @thread_safety This function may be called from any thread. Access is not
240
+ * synchronized.
241
+ *
242
+ * @since Added in version 3.0.
243
+ *
244
+ * @ingroup native
245
+ */
246
+ GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
247
+ #endif
248
+
249
+ #if defined(GLFW_EXPOSE_NATIVE_NSGL)
250
+ /*! @brief Returns the `NSOpenGLContext` of the specified window.
251
+ *
252
+ * @return The `NSOpenGLContext` of the specified window, or `nil` if an
253
+ * [error](@ref error_handling) occurred.
254
+ *
255
+ * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
256
+ * GLFW_NOT_INITIALIZED.
257
+ *
258
+ * @thread_safety This function may be called from any thread. Access is not
259
+ * synchronized.
260
+ *
261
+ * @since Added in version 3.0.
262
+ *
263
+ * @ingroup native
264
+ */
265
+ GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
266
+ #endif
267
+
268
+ #if defined(GLFW_EXPOSE_NATIVE_X11)
269
+ /*! @brief Returns the `Display` used by GLFW.
270
+ *
271
+ * @return The `Display` used by GLFW, or `NULL` if an
272
+ * [error](@ref error_handling) occurred.
273
+ *
274
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
275
+ *
276
+ * @thread_safety This function may be called from any thread. Access is not
277
+ * synchronized.
278
+ *
279
+ * @since Added in version 3.0.
280
+ *
281
+ * @ingroup native
282
+ */
283
+ GLFWAPI Display* glfwGetX11Display(void);
284
+
285
+ /*! @brief Returns the `RRCrtc` of the specified monitor.
286
+ *
287
+ * @return The `RRCrtc` of the specified monitor, or `None` if an
288
+ * [error](@ref error_handling) occurred.
289
+ *
290
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
291
+ *
292
+ * @thread_safety This function may be called from any thread. Access is not
293
+ * synchronized.
294
+ *
295
+ * @since Added in version 3.1.
296
+ *
297
+ * @ingroup native
298
+ */
299
+ GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
300
+
301
+ /*! @brief Returns the `RROutput` of the specified monitor.
302
+ *
303
+ * @return The `RROutput` of the specified monitor, or `None` if an
304
+ * [error](@ref error_handling) occurred.
305
+ *
306
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
307
+ *
308
+ * @thread_safety This function may be called from any thread. Access is not
309
+ * synchronized.
310
+ *
311
+ * @since Added in version 3.1.
312
+ *
313
+ * @ingroup native
314
+ */
315
+ GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
316
+
317
+ /*! @brief Returns the `Window` of the specified window.
318
+ *
319
+ * @return The `Window` of the specified window, or `None` if an
320
+ * [error](@ref error_handling) occurred.
321
+ *
322
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
323
+ *
324
+ * @thread_safety This function may be called from any thread. Access is not
325
+ * synchronized.
326
+ *
327
+ * @since Added in version 3.0.
328
+ *
329
+ * @ingroup native
330
+ */
331
+ GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
332
+
333
+ /*! @brief Sets the current primary selection to the specified string.
334
+ *
335
+ * @param[in] string A UTF-8 encoded string.
336
+ *
337
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
338
+ * GLFW_PLATFORM_ERROR.
339
+ *
340
+ * @pointer_lifetime The specified string is copied before this function
341
+ * returns.
342
+ *
343
+ * @thread_safety This function must only be called from the main thread.
344
+ *
345
+ * @sa @ref clipboard
346
+ * @sa glfwGetX11SelectionString
347
+ * @sa glfwSetClipboardString
348
+ *
349
+ * @since Added in version 3.3.
350
+ *
351
+ * @ingroup native
352
+ */
353
+ GLFWAPI void glfwSetX11SelectionString(const char* string);
354
+
355
+ /*! @brief Returns the contents of the current primary selection as a string.
356
+ *
357
+ * If the selection is empty or if its contents cannot be converted, `NULL`
358
+ * is returned and a @ref GLFW_FORMAT_UNAVAILABLE error is generated.
359
+ *
360
+ * @return The contents of the selection as a UTF-8 encoded string, or `NULL`
361
+ * if an [error](@ref error_handling) occurred.
362
+ *
363
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
364
+ * GLFW_PLATFORM_ERROR.
365
+ *
366
+ * @pointer_lifetime The returned string is allocated and freed by GLFW. You
367
+ * should not free it yourself. It is valid until the next call to @ref
368
+ * glfwGetX11SelectionString or @ref glfwSetX11SelectionString, or until the
369
+ * library is terminated.
370
+ *
371
+ * @thread_safety This function must only be called from the main thread.
372
+ *
373
+ * @sa @ref clipboard
374
+ * @sa glfwSetX11SelectionString
375
+ * @sa glfwGetClipboardString
376
+ *
377
+ * @since Added in version 3.3.
378
+ *
379
+ * @ingroup native
380
+ */
381
+ GLFWAPI const char* glfwGetX11SelectionString(void);
382
+ #endif
383
+
384
+ #if defined(GLFW_EXPOSE_NATIVE_GLX)
385
+ /*! @brief Returns the `GLXContext` of the specified window.
386
+ *
387
+ * @return The `GLXContext` of the specified window, or `NULL` if an
388
+ * [error](@ref error_handling) occurred.
389
+ *
390
+ * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
391
+ * GLFW_NOT_INITIALIZED.
392
+ *
393
+ * @thread_safety This function may be called from any thread. Access is not
394
+ * synchronized.
395
+ *
396
+ * @since Added in version 3.0.
397
+ *
398
+ * @ingroup native
399
+ */
400
+ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
401
+
402
+ /*! @brief Returns the `GLXWindow` of the specified window.
403
+ *
404
+ * @return The `GLXWindow` of the specified window, or `None` if an
405
+ * [error](@ref error_handling) occurred.
406
+ *
407
+ * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
408
+ * GLFW_NOT_INITIALIZED.
409
+ *
410
+ * @thread_safety This function may be called from any thread. Access is not
411
+ * synchronized.
412
+ *
413
+ * @since Added in version 3.2.
414
+ *
415
+ * @ingroup native
416
+ */
417
+ GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
418
+ #endif
419
+
420
+ #if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
421
+ /*! @brief Returns the `struct wl_display*` used by GLFW.
422
+ *
423
+ * @return The `struct wl_display*` used by GLFW, or `NULL` if an
424
+ * [error](@ref error_handling) occurred.
425
+ *
426
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
427
+ *
428
+ * @thread_safety This function may be called from any thread. Access is not
429
+ * synchronized.
430
+ *
431
+ * @since Added in version 3.2.
432
+ *
433
+ * @ingroup native
434
+ */
435
+ GLFWAPI struct wl_display* glfwGetWaylandDisplay(void);
436
+
437
+ /*! @brief Returns the `struct wl_output*` of the specified monitor.
438
+ *
439
+ * @return The `struct wl_output*` of the specified monitor, or `NULL` if an
440
+ * [error](@ref error_handling) occurred.
441
+ *
442
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
443
+ *
444
+ * @thread_safety This function may be called from any thread. Access is not
445
+ * synchronized.
446
+ *
447
+ * @since Added in version 3.2.
448
+ *
449
+ * @ingroup native
450
+ */
451
+ GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
452
+
453
+ /*! @brief Returns the main `struct wl_surface*` of the specified window.
454
+ *
455
+ * @return The main `struct wl_surface*` of the specified window, or `NULL` if
456
+ * an [error](@ref error_handling) occurred.
457
+ *
458
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
459
+ *
460
+ * @thread_safety This function may be called from any thread. Access is not
461
+ * synchronized.
462
+ *
463
+ * @since Added in version 3.2.
464
+ *
465
+ * @ingroup native
466
+ */
467
+ GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window);
468
+ #endif
469
+
470
+ #if defined(GLFW_EXPOSE_NATIVE_EGL)
471
+ /*! @brief Returns the `EGLDisplay` used by GLFW.
472
+ *
473
+ * @return The `EGLDisplay` used by GLFW, or `EGL_NO_DISPLAY` if an
474
+ * [error](@ref error_handling) occurred.
475
+ *
476
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
477
+ *
478
+ * @thread_safety This function may be called from any thread. Access is not
479
+ * synchronized.
480
+ *
481
+ * @since Added in version 3.0.
482
+ *
483
+ * @ingroup native
484
+ */
485
+ GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
486
+
487
+ /*! @brief Returns the `EGLContext` of the specified window.
488
+ *
489
+ * @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an
490
+ * [error](@ref error_handling) occurred.
491
+ *
492
+ * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
493
+ * GLFW_NOT_INITIALIZED.
494
+ *
495
+ * @thread_safety This function may be called from any thread. Access is not
496
+ * synchronized.
497
+ *
498
+ * @since Added in version 3.0.
499
+ *
500
+ * @ingroup native
501
+ */
502
+ GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
503
+
504
+ /*! @brief Returns the `EGLSurface` of the specified window.
505
+ *
506
+ * @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an
507
+ * [error](@ref error_handling) occurred.
508
+ *
509
+ * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
510
+ * GLFW_NOT_INITIALIZED.
511
+ *
512
+ * @thread_safety This function may be called from any thread. Access is not
513
+ * synchronized.
514
+ *
515
+ * @since Added in version 3.0.
516
+ *
517
+ * @ingroup native
518
+ */
519
+ GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
520
+ #endif
521
+
522
+ #if defined(GLFW_EXPOSE_NATIVE_OSMESA)
523
+ /*! @brief Retrieves the color buffer associated with the specified window.
524
+ *
525
+ * @param[in] window The window whose color buffer to retrieve.
526
+ * @param[out] width Where to store the width of the color buffer, or `NULL`.
527
+ * @param[out] height Where to store the height of the color buffer, or `NULL`.
528
+ * @param[out] format Where to store the OSMesa pixel format of the color
529
+ * buffer, or `NULL`.
530
+ * @param[out] buffer Where to store the address of the color buffer, or
531
+ * `NULL`.
532
+ * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
533
+ * [error](@ref error_handling) occurred.
534
+ *
535
+ * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
536
+ * GLFW_NOT_INITIALIZED.
537
+ *
538
+ * @thread_safety This function may be called from any thread. Access is not
539
+ * synchronized.
540
+ *
541
+ * @since Added in version 3.3.
542
+ *
543
+ * @ingroup native
544
+ */
545
+ GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* window, int* width, int* height, int* format, void** buffer);
546
+
547
+ /*! @brief Retrieves the depth buffer associated with the specified window.
548
+ *
549
+ * @param[in] window The window whose depth buffer to retrieve.
550
+ * @param[out] width Where to store the width of the depth buffer, or `NULL`.
551
+ * @param[out] height Where to store the height of the depth buffer, or `NULL`.
552
+ * @param[out] bytesPerValue Where to store the number of bytes per depth
553
+ * buffer element, or `NULL`.
554
+ * @param[out] buffer Where to store the address of the depth buffer, or
555
+ * `NULL`.
556
+ * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
557
+ * [error](@ref error_handling) occurred.
558
+ *
559
+ * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
560
+ * GLFW_NOT_INITIALIZED.
561
+ *
562
+ * @thread_safety This function may be called from any thread. Access is not
563
+ * synchronized.
564
+ *
565
+ * @since Added in version 3.3.
566
+ *
567
+ * @ingroup native
568
+ */
569
+ GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* window, int* width, int* height, int* bytesPerValue, void** buffer);
570
+
571
+ /*! @brief Returns the `OSMesaContext` of the specified window.
572
+ *
573
+ * @return The `OSMesaContext` of the specified window, or `NULL` if an
574
+ * [error](@ref error_handling) occurred.
575
+ *
576
+ * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
577
+ * GLFW_NOT_INITIALIZED.
578
+ *
579
+ * @thread_safety This function may be called from any thread. Access is not
580
+ * synchronized.
581
+ *
582
+ * @since Added in version 3.3.
583
+ *
584
+ * @ingroup native
585
+ */
586
+ GLFWAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* window);
587
+ #endif
588
+
589
+ #ifdef __cplusplus
590
+ }
591
+ #endif
592
+
593
+ #endif /* _glfw3_native_h_ */
594
+