gosu 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (204) hide show
  1. checksums.yaml +4 -4
  2. data/dependencies/SDL/include/SDL.h +108 -14
  3. data/dependencies/SDL/include/SDL_assert.h +81 -50
  4. data/dependencies/SDL/include/SDL_atomic.h +135 -35
  5. data/dependencies/SDL/include/SDL_audio.h +960 -355
  6. data/dependencies/SDL/include/SDL_bits.h +11 -6
  7. data/dependencies/SDL/include/SDL_blendmode.h +91 -14
  8. data/dependencies/SDL/include/SDL_clipboard.h +30 -7
  9. data/dependencies/SDL/include/SDL_config.h +277 -27
  10. data/dependencies/SDL/include/SDL_config_android.h +13 -38
  11. data/dependencies/SDL/include/SDL_config_iphoneos.h +21 -62
  12. data/dependencies/SDL/include/SDL_config_macosx.h +23 -92
  13. data/dependencies/SDL/include/SDL_config_minimal.h +1 -4
  14. data/dependencies/SDL/include/SDL_config_pandora.h +15 -22
  15. data/dependencies/SDL/include/SDL_config_psp.h +16 -37
  16. data/dependencies/SDL/include/SDL_config_windows.h +28 -91
  17. data/dependencies/SDL/include/SDL_config_winrt.h +33 -61
  18. data/dependencies/SDL/include/SDL_config_wiz.h +28 -56
  19. data/dependencies/SDL/include/SDL_copying.h +1 -1
  20. data/dependencies/SDL/include/SDL_cpuinfo.h +331 -71
  21. data/dependencies/SDL/include/SDL_egl.h +906 -280
  22. data/dependencies/SDL/include/SDL_endian.h +101 -47
  23. data/dependencies/SDL/include/SDL_error.h +70 -19
  24. data/dependencies/SDL/include/SDL_events.h +387 -79
  25. data/dependencies/SDL/include/SDL_filesystem.h +73 -64
  26. data/dependencies/SDL/include/SDL_gamecontroller.h +585 -125
  27. data/dependencies/SDL/include/SDL_gesture.h +36 -6
  28. data/dependencies/SDL/include/SDL_haptic.h +304 -210
  29. data/dependencies/SDL/include/SDL_hidapi.h +451 -0
  30. data/dependencies/SDL/include/SDL_hints.h +1286 -897
  31. data/dependencies/SDL/include/SDL_joystick.h +577 -130
  32. data/dependencies/SDL/include/SDL_keyboard.h +162 -63
  33. data/dependencies/SDL/include/SDL_keycode.h +7 -5
  34. data/dependencies/SDL/include/SDL_loadso.h +42 -8
  35. data/dependencies/SDL/include/SDL_locale.h +34 -32
  36. data/dependencies/SDL/include/SDL_log.h +212 -19
  37. data/dependencies/SDL/include/SDL_main.h +72 -17
  38. data/dependencies/SDL/include/SDL_messagebox.h +70 -23
  39. data/dependencies/SDL/include/SDL_metal.h +27 -32
  40. data/dependencies/SDL/include/SDL_misc.h +19 -15
  41. data/dependencies/SDL/include/SDL_mouse.h +262 -110
  42. data/dependencies/SDL/include/SDL_mutex.h +286 -66
  43. data/dependencies/SDL/include/SDL_name.h +1 -1
  44. data/dependencies/SDL/include/SDL_opengl.h +1 -1
  45. data/dependencies/SDL/include/SDL_opengles.h +1 -1
  46. data/dependencies/SDL/include/SDL_opengles2.h +2 -2
  47. data/dependencies/SDL/include/SDL_pixels.h +199 -34
  48. data/dependencies/SDL/include/SDL_platform.h +39 -2
  49. data/dependencies/SDL/include/SDL_power.h +23 -10
  50. data/dependencies/SDL/include/SDL_quit.h +1 -1
  51. data/dependencies/SDL/include/SDL_rect.h +78 -28
  52. data/dependencies/SDL/include/SDL_render.h +1204 -472
  53. data/dependencies/SDL/include/SDL_revision.h +2 -2
  54. data/dependencies/SDL/include/SDL_rwops.h +605 -33
  55. data/dependencies/SDL/include/SDL_scancode.h +1 -1
  56. data/dependencies/SDL/include/SDL_sensor.h +76 -42
  57. data/dependencies/SDL/include/SDL_shape.h +38 -27
  58. data/dependencies/SDL/include/SDL_stdinc.h +96 -24
  59. data/dependencies/SDL/include/SDL_surface.h +571 -139
  60. data/dependencies/SDL/include/SDL_system.h +339 -101
  61. data/dependencies/SDL/include/SDL_syswm.h +50 -20
  62. data/dependencies/SDL/include/SDL_test.h +1 -1
  63. data/dependencies/SDL/include/SDL_test_assert.h +2 -2
  64. data/dependencies/SDL/include/SDL_test_common.h +23 -6
  65. data/dependencies/SDL/include/SDL_test_compare.h +1 -1
  66. data/dependencies/SDL/include/SDL_test_crc32.h +1 -1
  67. data/dependencies/SDL/include/SDL_test_font.h +3 -3
  68. data/dependencies/SDL/include/SDL_test_fuzzer.h +28 -26
  69. data/dependencies/SDL/include/SDL_test_harness.h +6 -6
  70. data/dependencies/SDL/include/SDL_test_images.h +1 -1
  71. data/dependencies/SDL/include/SDL_test_log.h +1 -1
  72. data/dependencies/SDL/include/SDL_test_md5.h +1 -1
  73. data/dependencies/SDL/include/SDL_test_memory.h +1 -1
  74. data/dependencies/SDL/include/SDL_test_random.h +2 -2
  75. data/dependencies/SDL/include/SDL_thread.h +226 -128
  76. data/dependencies/SDL/include/SDL_timer.h +129 -22
  77. data/dependencies/SDL/include/SDL_touch.h +48 -8
  78. data/dependencies/SDL/include/SDL_types.h +1 -1
  79. data/dependencies/SDL/include/SDL_version.h +72 -46
  80. data/dependencies/SDL/include/SDL_video.h +1266 -460
  81. data/dependencies/SDL/include/SDL_vulkan.h +100 -161
  82. data/dependencies/SDL/include/begin_code.h +22 -1
  83. data/dependencies/SDL/include/close_code.h +1 -1
  84. data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
  85. data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
  86. data/dependencies/SDL_sound/SDL_sound.c +83 -7
  87. data/dependencies/SDL_sound/SDL_sound.h +4 -4
  88. data/dependencies/SDL_sound/SDL_sound_aiff.c +9 -12
  89. data/dependencies/SDL_sound/SDL_sound_au.c +7 -7
  90. data/dependencies/SDL_sound/SDL_sound_coreaudio.c +3 -3
  91. data/dependencies/SDL_sound/SDL_sound_flac.c +1 -1
  92. data/dependencies/SDL_sound/SDL_sound_internal.h +17 -10
  93. data/dependencies/SDL_sound/SDL_sound_modplug.c +25 -27
  94. data/dependencies/SDL_sound/SDL_sound_mp3.c +5 -17
  95. data/dependencies/SDL_sound/SDL_sound_raw.c +11 -11
  96. data/dependencies/SDL_sound/SDL_sound_shn.c +8 -7
  97. data/dependencies/SDL_sound/SDL_sound_voc.c +6 -4
  98. data/dependencies/SDL_sound/SDL_sound_vorbis.c +6 -11
  99. data/dependencies/SDL_sound/SDL_sound_wav.c +35 -29
  100. data/dependencies/SDL_sound/dr_flac.h +618 -220
  101. data/dependencies/SDL_sound/dr_mp3.h +263 -94
  102. data/dependencies/SDL_sound/libmodplug/fastmix.c +58 -64
  103. data/dependencies/SDL_sound/libmodplug/libmodplug.h +25 -103
  104. data/dependencies/SDL_sound/libmodplug/load_669.c +14 -17
  105. data/dependencies/SDL_sound/libmodplug/load_amf.c +11 -7
  106. data/dependencies/SDL_sound/libmodplug/load_ams.c +65 -22
  107. data/dependencies/SDL_sound/libmodplug/load_dbm.c +8 -4
  108. data/dependencies/SDL_sound/libmodplug/load_dmf.c +55 -25
  109. data/dependencies/SDL_sound/libmodplug/load_far.c +9 -13
  110. data/dependencies/SDL_sound/libmodplug/load_gdm.c +448 -0
  111. data/dependencies/SDL_sound/libmodplug/load_it.c +45 -49
  112. data/dependencies/SDL_sound/libmodplug/load_mdl.c +80 -53
  113. data/dependencies/SDL_sound/libmodplug/load_med.c +20 -12
  114. data/dependencies/SDL_sound/libmodplug/load_mod.c +40 -15
  115. data/dependencies/SDL_sound/libmodplug/load_mt2.c +29 -17
  116. data/dependencies/SDL_sound/libmodplug/load_okt.c +12 -8
  117. data/dependencies/SDL_sound/libmodplug/load_psm.c +101 -78
  118. data/dependencies/SDL_sound/libmodplug/load_ptm.c +18 -17
  119. data/dependencies/SDL_sound/libmodplug/load_s3m.c +9 -7
  120. data/dependencies/SDL_sound/libmodplug/load_stm.c +3 -2
  121. data/dependencies/SDL_sound/libmodplug/load_ult.c +2 -2
  122. data/dependencies/SDL_sound/libmodplug/load_umx.c +315 -35
  123. data/dependencies/SDL_sound/libmodplug/load_xm.c +25 -21
  124. data/dependencies/SDL_sound/libmodplug/mmcmp.c +295 -149
  125. data/dependencies/SDL_sound/libmodplug/modplug.c +7 -123
  126. data/dependencies/SDL_sound/libmodplug/modplug.h +32 -29
  127. data/dependencies/SDL_sound/libmodplug/snd_dsp.c +0 -1
  128. data/dependencies/SDL_sound/libmodplug/snd_flt.c +2 -2
  129. data/dependencies/SDL_sound/libmodplug/snd_fx.c +24 -18
  130. data/dependencies/SDL_sound/libmodplug/sndfile.c +55 -156
  131. data/dependencies/SDL_sound/libmodplug/sndmix.c +7 -12
  132. data/dependencies/SDL_sound/libmodplug/tables.h +10 -15
  133. data/dependencies/SDL_sound/stb_vorbis.h +508 -325
  134. data/dependencies/{al_soft → mojoAL}/AL/al.h +38 -30
  135. data/dependencies/{al_soft → mojoAL}/AL/alc.h +27 -56
  136. data/dependencies/mojoAL/mojoal.c +4594 -0
  137. data/ext/gosu/extconf.rb +29 -30
  138. data/include/Gosu/Audio.hpp +70 -85
  139. data/include/Gosu/Color.hpp +19 -11
  140. data/include/Gosu/Font.hpp +40 -44
  141. data/include/Gosu/Graphics.hpp +58 -71
  142. data/include/Gosu/GraphicsBase.hpp +26 -33
  143. data/include/Gosu/Image.hpp +56 -62
  144. data/include/Gosu/ImageData.hpp +23 -27
  145. data/include/Gosu/Inspection.hpp +1 -4
  146. data/include/Gosu/TextInput.hpp +34 -40
  147. data/include/Gosu/Version.hpp +1 -1
  148. data/include/Gosu/Window.hpp +71 -70
  149. data/lib/SDL2.dll +0 -0
  150. data/lib/gosu/compat.rb +24 -37
  151. data/lib/gosu.rb +2 -2
  152. data/lib64/SDL2.dll +0 -0
  153. data/src/Audio.cpp +86 -86
  154. data/src/AudioFile.hpp +6 -6
  155. data/src/AudioFileAudioToolbox.cpp +1 -1
  156. data/src/AudioFileSDLSound.cpp +1 -1
  157. data/src/AudioImpl.hpp +5 -5
  158. data/src/BitmapIO.cpp +0 -20
  159. data/src/BlockAllocator.cpp +2 -1
  160. data/src/Channel.cpp +22 -20
  161. data/src/Color.cpp +12 -9
  162. data/src/EmptyImageData.hpp +15 -17
  163. data/src/FileUnix.cpp +1 -1
  164. data/src/FileWin.cpp +1 -1
  165. data/src/Font.cpp +48 -53
  166. data/src/Graphics.cpp +135 -143
  167. data/src/Image.cpp +41 -42
  168. data/src/Input.cpp +1 -1
  169. data/src/InputUIKit.cpp +1 -1
  170. data/src/LargeImageData.cpp +108 -101
  171. data/src/LargeImageData.hpp +17 -15
  172. data/src/Log.hpp +6 -6
  173. data/src/Macro.cpp +35 -37
  174. data/src/Macro.hpp +11 -11
  175. data/src/Math.cpp +8 -1
  176. data/src/Resolution.cpp +12 -7
  177. data/src/RubyGosu.cxx +5 -5
  178. data/src/TexChunk.cpp +50 -41
  179. data/src/TexChunk.hpp +22 -22
  180. data/src/Text.cpp +37 -37
  181. data/src/TextBuilder.cpp +60 -57
  182. data/src/TextBuilder.hpp +20 -20
  183. data/src/TextInput.cpp +127 -135
  184. data/src/TrueTypeFont.cpp +107 -107
  185. data/src/TrueTypeFont.hpp +39 -38
  186. data/src/TrueTypeFontApple.cpp +19 -22
  187. data/src/TrueTypeFontUnix.cpp +21 -26
  188. data/src/TrueTypeFontWin.cpp +30 -30
  189. data/src/Window.cpp +95 -86
  190. data/src/WindowUIKit.cpp +46 -49
  191. metadata +7 -17
  192. data/dependencies/SDL/include/SDL_config_os2.h +0 -188
  193. data/dependencies/SDL_sound/libmodplug/load_abc.c +0 -4725
  194. data/dependencies/SDL_sound/libmodplug/load_mid.c +0 -1405
  195. data/dependencies/SDL_sound/libmodplug/load_pat.c +0 -1143
  196. data/dependencies/SDL_sound/libmodplug/load_pat.h +0 -25
  197. data/dependencies/al_soft/AL/alext.h +0 -585
  198. data/dependencies/al_soft/AL/efx-creative.h +0 -3
  199. data/dependencies/al_soft/AL/efx-presets.h +0 -402
  200. data/dependencies/al_soft/AL/efx.h +0 -762
  201. data/dependencies/al_soft/x64/libOpenAL32.dll.a +0 -0
  202. data/dependencies/al_soft/x86/libOpenAL32.dll.a +0 -0
  203. data/lib/OpenAL32.dll +0 -0
  204. data/lib64/OpenAL32.dll +0 -0
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -34,11 +34,20 @@
34
34
  /* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
35
35
  #if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64))
36
36
  #ifdef __clang__
37
- /* Many of the intrinsics SDL uses are not implemented by clang with Visual Studio */
38
- #undef __MMX__
39
- #undef __SSE__
40
- #undef __SSE2__
41
- #else
37
+ /* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version,
38
+ so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */
39
+
40
+ #ifndef __PRFCHWINTRIN_H
41
+ #define __PRFCHWINTRIN_H
42
+
43
+ static __inline__ void __attribute__((__always_inline__, __nodebug__))
44
+ _m_prefetch(void *__P)
45
+ {
46
+ __builtin_prefetch (__P, 0, 3 /* _MM_HINT_T0 */);
47
+ }
48
+
49
+ #endif /* __PRFCHWINTRIN_H */
50
+ #endif /* __clang__ */
42
51
  #include <intrin.h>
43
52
  #ifndef _WIN64
44
53
  #ifndef __MMX__
@@ -54,9 +63,14 @@
54
63
  #ifndef __SSE2__
55
64
  #define __SSE2__
56
65
  #endif
57
- #endif /* __clang__ */
66
+ #ifndef __SSE3__
67
+ #define __SSE3__
68
+ #endif
58
69
  #elif defined(__MINGW64_VERSION_MAJOR)
59
70
  #include <intrin.h>
71
+ #if !defined(SDL_DISABLE_ARM_NEON_H) && defined(__ARM_NEON)
72
+ # include <arm_neon.h>
73
+ #endif
60
74
  #else
61
75
  /* altivec.h redefining bool causes a number of problems, see bugs 3993 and 4392, so you need to explicitly define SDL_ENABLE_ALTIVEC_H to have it included. */
62
76
  #if defined(HAVE_ALTIVEC_H) && defined(__ALTIVEC__) && !defined(__APPLE_ALTIVEC__) && defined(SDL_ENABLE_ALTIVEC_H)
@@ -79,6 +93,8 @@
79
93
  # endif
80
94
  # endif
81
95
  #endif
96
+ #endif /* compiler version */
97
+
82
98
  #if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H)
83
99
  #include <mm3dnow.h>
84
100
  #endif
@@ -98,7 +114,6 @@
98
114
  #include <pmmintrin.h>
99
115
  #endif
100
116
  #endif /* HAVE_IMMINTRIN_H */
101
- #endif /* compiler version */
102
117
 
103
118
  #include "begin_code.h"
104
119
  /* Set up for C function definitions, even when using C++ */
@@ -114,136 +129,370 @@ extern "C" {
114
129
  #define SDL_CACHELINE_SIZE 128
115
130
 
116
131
  /**
117
- * This function returns the number of CPU cores available.
132
+ * Get the number of CPU cores available.
133
+ *
134
+ * \returns the total number of logical CPU cores. On CPUs that include
135
+ * technologies such as hyperthreading, the number of logical cores
136
+ * may be more than the number of physical cores.
137
+ *
138
+ * \since This function is available since SDL 2.0.0.
118
139
  */
119
140
  extern DECLSPEC int SDLCALL SDL_GetCPUCount(void);
120
141
 
121
142
  /**
122
- * This function returns the L1 cache line size of the CPU
143
+ * Determine the L1 cache line size of the CPU.
144
+ *
145
+ * This is useful for determining multi-threaded structure padding or SIMD
146
+ * prefetch sizes.
147
+ *
148
+ * \returns the L1 cache line size of the CPU, in bytes.
123
149
  *
124
- * This is useful for determining multi-threaded structure padding
125
- * or SIMD prefetch sizes.
150
+ * \since This function is available since SDL 2.0.0.
126
151
  */
127
152
  extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void);
128
153
 
129
154
  /**
130
- * This function returns true if the CPU has the RDTSC instruction.
155
+ * Determine whether the CPU has the RDTSC instruction.
156
+ *
157
+ * This always returns false on CPUs that aren't using Intel instruction sets.
158
+ *
159
+ * \returns SDL_TRUE if the CPU has the RDTSC instruction or SDL_FALSE if not.
160
+ *
161
+ * \since This function is available since SDL 2.0.0.
162
+ *
163
+ * \sa SDL_Has3DNow
164
+ * \sa SDL_HasAltiVec
165
+ * \sa SDL_HasAVX
166
+ * \sa SDL_HasAVX2
167
+ * \sa SDL_HasMMX
168
+ * \sa SDL_HasSSE
169
+ * \sa SDL_HasSSE2
170
+ * \sa SDL_HasSSE3
171
+ * \sa SDL_HasSSE41
172
+ * \sa SDL_HasSSE42
131
173
  */
132
174
  extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
133
175
 
134
176
  /**
135
- * This function returns true if the CPU has AltiVec features.
177
+ * Determine whether the CPU has AltiVec features.
178
+ *
179
+ * This always returns false on CPUs that aren't using PowerPC instruction
180
+ * sets.
181
+ *
182
+ * \returns SDL_TRUE if the CPU has AltiVec features or SDL_FALSE if not.
183
+ *
184
+ * \since This function is available since SDL 2.0.0.
185
+ *
186
+ * \sa SDL_Has3DNow
187
+ * \sa SDL_HasAVX
188
+ * \sa SDL_HasAVX2
189
+ * \sa SDL_HasMMX
190
+ * \sa SDL_HasRDTSC
191
+ * \sa SDL_HasSSE
192
+ * \sa SDL_HasSSE2
193
+ * \sa SDL_HasSSE3
194
+ * \sa SDL_HasSSE41
195
+ * \sa SDL_HasSSE42
136
196
  */
137
197
  extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
138
198
 
139
199
  /**
140
- * This function returns true if the CPU has MMX features.
200
+ * Determine whether the CPU has MMX features.
201
+ *
202
+ * This always returns false on CPUs that aren't using Intel instruction sets.
203
+ *
204
+ * \returns SDL_TRUE if the CPU has MMX features or SDL_FALSE if not.
205
+ *
206
+ * \since This function is available since SDL 2.0.0.
207
+ *
208
+ * \sa SDL_Has3DNow
209
+ * \sa SDL_HasAltiVec
210
+ * \sa SDL_HasAVX
211
+ * \sa SDL_HasAVX2
212
+ * \sa SDL_HasRDTSC
213
+ * \sa SDL_HasSSE
214
+ * \sa SDL_HasSSE2
215
+ * \sa SDL_HasSSE3
216
+ * \sa SDL_HasSSE41
217
+ * \sa SDL_HasSSE42
141
218
  */
142
219
  extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
143
220
 
144
221
  /**
145
- * This function returns true if the CPU has 3DNow! features.
222
+ * Determine whether the CPU has 3DNow! features.
223
+ *
224
+ * This always returns false on CPUs that aren't using AMD instruction sets.
225
+ *
226
+ * \returns SDL_TRUE if the CPU has 3DNow! features or SDL_FALSE if not.
227
+ *
228
+ * \since This function is available since SDL 2.0.0.
229
+ *
230
+ * \sa SDL_HasAltiVec
231
+ * \sa SDL_HasAVX
232
+ * \sa SDL_HasAVX2
233
+ * \sa SDL_HasMMX
234
+ * \sa SDL_HasRDTSC
235
+ * \sa SDL_HasSSE
236
+ * \sa SDL_HasSSE2
237
+ * \sa SDL_HasSSE3
238
+ * \sa SDL_HasSSE41
239
+ * \sa SDL_HasSSE42
146
240
  */
147
241
  extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
148
242
 
149
243
  /**
150
- * This function returns true if the CPU has SSE features.
244
+ * Determine whether the CPU has SSE features.
245
+ *
246
+ * This always returns false on CPUs that aren't using Intel instruction sets.
247
+ *
248
+ * \returns SDL_TRUE if the CPU has SSE features or SDL_FALSE if not.
249
+ *
250
+ * \since This function is available since SDL 2.0.0.
251
+ *
252
+ * \sa SDL_Has3DNow
253
+ * \sa SDL_HasAltiVec
254
+ * \sa SDL_HasAVX
255
+ * \sa SDL_HasAVX2
256
+ * \sa SDL_HasMMX
257
+ * \sa SDL_HasRDTSC
258
+ * \sa SDL_HasSSE2
259
+ * \sa SDL_HasSSE3
260
+ * \sa SDL_HasSSE41
261
+ * \sa SDL_HasSSE42
151
262
  */
152
263
  extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
153
264
 
154
265
  /**
155
- * This function returns true if the CPU has SSE2 features.
266
+ * Determine whether the CPU has SSE2 features.
267
+ *
268
+ * This always returns false on CPUs that aren't using Intel instruction sets.
269
+ *
270
+ * \returns SDL_TRUE if the CPU has SSE2 features or SDL_FALSE if not.
271
+ *
272
+ * \since This function is available since SDL 2.0.0.
273
+ *
274
+ * \sa SDL_Has3DNow
275
+ * \sa SDL_HasAltiVec
276
+ * \sa SDL_HasAVX
277
+ * \sa SDL_HasAVX2
278
+ * \sa SDL_HasMMX
279
+ * \sa SDL_HasRDTSC
280
+ * \sa SDL_HasSSE
281
+ * \sa SDL_HasSSE3
282
+ * \sa SDL_HasSSE41
283
+ * \sa SDL_HasSSE42
156
284
  */
157
285
  extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);
158
286
 
159
287
  /**
160
- * This function returns true if the CPU has SSE3 features.
288
+ * Determine whether the CPU has SSE3 features.
289
+ *
290
+ * This always returns false on CPUs that aren't using Intel instruction sets.
291
+ *
292
+ * \returns SDL_TRUE if the CPU has SSE3 features or SDL_FALSE if not.
293
+ *
294
+ * \since This function is available since SDL 2.0.0.
295
+ *
296
+ * \sa SDL_Has3DNow
297
+ * \sa SDL_HasAltiVec
298
+ * \sa SDL_HasAVX
299
+ * \sa SDL_HasAVX2
300
+ * \sa SDL_HasMMX
301
+ * \sa SDL_HasRDTSC
302
+ * \sa SDL_HasSSE
303
+ * \sa SDL_HasSSE2
304
+ * \sa SDL_HasSSE41
305
+ * \sa SDL_HasSSE42
161
306
  */
162
307
  extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void);
163
308
 
164
309
  /**
165
- * This function returns true if the CPU has SSE4.1 features.
310
+ * Determine whether the CPU has SSE4.1 features.
311
+ *
312
+ * This always returns false on CPUs that aren't using Intel instruction sets.
313
+ *
314
+ * \returns SDL_TRUE if the CPU has SSE4.1 features or SDL_FALSE if not.
315
+ *
316
+ * \since This function is available since SDL 2.0.0.
317
+ *
318
+ * \sa SDL_Has3DNow
319
+ * \sa SDL_HasAltiVec
320
+ * \sa SDL_HasAVX
321
+ * \sa SDL_HasAVX2
322
+ * \sa SDL_HasMMX
323
+ * \sa SDL_HasRDTSC
324
+ * \sa SDL_HasSSE
325
+ * \sa SDL_HasSSE2
326
+ * \sa SDL_HasSSE3
327
+ * \sa SDL_HasSSE42
166
328
  */
167
329
  extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE41(void);
168
330
 
169
331
  /**
170
- * This function returns true if the CPU has SSE4.2 features.
332
+ * Determine whether the CPU has SSE4.2 features.
333
+ *
334
+ * This always returns false on CPUs that aren't using Intel instruction sets.
335
+ *
336
+ * \returns SDL_TRUE if the CPU has SSE4.2 features or SDL_FALSE if not.
337
+ *
338
+ * \since This function is available since SDL 2.0.0.
339
+ *
340
+ * \sa SDL_Has3DNow
341
+ * \sa SDL_HasAltiVec
342
+ * \sa SDL_HasAVX
343
+ * \sa SDL_HasAVX2
344
+ * \sa SDL_HasMMX
345
+ * \sa SDL_HasRDTSC
346
+ * \sa SDL_HasSSE
347
+ * \sa SDL_HasSSE2
348
+ * \sa SDL_HasSSE3
349
+ * \sa SDL_HasSSE41
171
350
  */
172
351
  extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void);
173
352
 
174
353
  /**
175
- * This function returns true if the CPU has AVX features.
354
+ * Determine whether the CPU has AVX features.
355
+ *
356
+ * This always returns false on CPUs that aren't using Intel instruction sets.
357
+ *
358
+ * \returns SDL_TRUE if the CPU has AVX features or SDL_FALSE if not.
359
+ *
360
+ * \since This function is available since SDL 2.0.2.
361
+ *
362
+ * \sa SDL_Has3DNow
363
+ * \sa SDL_HasAltiVec
364
+ * \sa SDL_HasAVX2
365
+ * \sa SDL_HasMMX
366
+ * \sa SDL_HasRDTSC
367
+ * \sa SDL_HasSSE
368
+ * \sa SDL_HasSSE2
369
+ * \sa SDL_HasSSE3
370
+ * \sa SDL_HasSSE41
371
+ * \sa SDL_HasSSE42
176
372
  */
177
373
  extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void);
178
374
 
179
375
  /**
180
- * This function returns true if the CPU has AVX2 features.
376
+ * Determine whether the CPU has AVX2 features.
377
+ *
378
+ * This always returns false on CPUs that aren't using Intel instruction sets.
379
+ *
380
+ * \returns SDL_TRUE if the CPU has AVX2 features or SDL_FALSE if not.
381
+ *
382
+ * \since This function is available since SDL 2.0.4.
383
+ *
384
+ * \sa SDL_Has3DNow
385
+ * \sa SDL_HasAltiVec
386
+ * \sa SDL_HasAVX
387
+ * \sa SDL_HasMMX
388
+ * \sa SDL_HasRDTSC
389
+ * \sa SDL_HasSSE
390
+ * \sa SDL_HasSSE2
391
+ * \sa SDL_HasSSE3
392
+ * \sa SDL_HasSSE41
393
+ * \sa SDL_HasSSE42
181
394
  */
182
395
  extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void);
183
396
 
184
397
  /**
185
- * This function returns true if the CPU has AVX-512F (foundation) features.
398
+ * Determine whether the CPU has AVX-512F (foundation) features.
399
+ *
400
+ * This always returns false on CPUs that aren't using Intel instruction sets.
401
+ *
402
+ * \returns SDL_TRUE if the CPU has AVX-512F features or SDL_FALSE if not.
403
+ *
404
+ * \since This function is available since SDL 2.0.9.
405
+ *
406
+ * \sa SDL_HasAVX
186
407
  */
187
408
  extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void);
188
409
 
189
410
  /**
190
- * This function returns true if the CPU has ARM SIMD (ARMv6) features.
411
+ * Determine whether the CPU has ARM SIMD (ARMv6) features.
412
+ *
413
+ * This is different from ARM NEON, which is a different instruction set.
414
+ *
415
+ * This always returns false on CPUs that aren't using ARM instruction sets.
416
+ *
417
+ * \returns SDL_TRUE if the CPU has ARM SIMD features or SDL_FALSE if not.
418
+ *
419
+ * \since This function is available since SDL 2.0.12.
420
+ *
421
+ * \sa SDL_HasNEON
191
422
  */
192
423
  extern DECLSPEC SDL_bool SDLCALL SDL_HasARMSIMD(void);
193
424
 
194
425
  /**
195
- * This function returns true if the CPU has NEON (ARM SIMD) features.
426
+ * Determine whether the CPU has NEON (ARM SIMD) features.
427
+ *
428
+ * This always returns false on CPUs that aren't using ARM instruction sets.
429
+ *
430
+ * \returns SDL_TRUE if the CPU has ARM NEON features or SDL_FALSE if not.
431
+ *
432
+ * \since This function is available since SDL 2.0.6.
196
433
  */
197
434
  extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void);
198
435
 
199
436
  /**
200
- * This function returns the amount of RAM configured in the system, in MB.
437
+ * Get the amount of RAM configured in the system.
438
+ *
439
+ * \returns the amount of RAM configured in the system in MB.
440
+ *
441
+ * \since This function is available since SDL 2.0.1.
201
442
  */
202
443
  extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void);
203
444
 
204
445
  /**
205
- * \brief Report the alignment this system needs for SIMD allocations.
446
+ * Report the alignment this system needs for SIMD allocations.
206
447
  *
207
448
  * This will return the minimum number of bytes to which a pointer must be
208
- * aligned to be compatible with SIMD instructions on the current machine.
209
- * For example, if the machine supports SSE only, it will return 16, but if
210
- * it supports AVX-512F, it'll return 64 (etc). This only reports values for
211
- * instruction sets SDL knows about, so if your SDL build doesn't have
212
- * SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and
213
- * not 64 for the AVX-512 instructions that exist but SDL doesn't know about.
214
- * Plan accordingly.
449
+ * aligned to be compatible with SIMD instructions on the current machine. For
450
+ * example, if the machine supports SSE only, it will return 16, but if it
451
+ * supports AVX-512F, it'll return 64 (etc). This only reports values for
452
+ * instruction sets SDL knows about, so if your SDL build doesn't have
453
+ * SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and
454
+ * not 64 for the AVX-512 instructions that exist but SDL doesn't know about.
455
+ * Plan accordingly.
456
+ *
457
+ * \returns the alignment in bytes needed for available, known SIMD
458
+ * instructions.
459
+ *
460
+ * \since This function is available since SDL 2.0.10.
215
461
  */
216
462
  extern DECLSPEC size_t SDLCALL SDL_SIMDGetAlignment(void);
217
463
 
218
464
  /**
219
- * \brief Allocate memory in a SIMD-friendly way.
465
+ * Allocate memory in a SIMD-friendly way.
220
466
  *
221
467
  * This will allocate a block of memory that is suitable for use with SIMD
222
- * instructions. Specifically, it will be properly aligned and padded for
223
- * the system's supported vector instructions.
468
+ * instructions. Specifically, it will be properly aligned and padded for the
469
+ * system's supported vector instructions.
224
470
  *
225
- * The memory returned will be padded such that it is safe to read or write
226
- * an incomplete vector at the end of the memory block. This can be useful
227
- * so you don't have to drop back to a scalar fallback at the end of your
228
- * SIMD processing loop to deal with the final elements without overflowing
229
- * the allocated buffer.
471
+ * The memory returned will be padded such that it is safe to read or write an
472
+ * incomplete vector at the end of the memory block. This can be useful so you
473
+ * don't have to drop back to a scalar fallback at the end of your SIMD
474
+ * processing loop to deal with the final elements without overflowing the
475
+ * allocated buffer.
230
476
  *
231
- * You must free this memory with SDL_FreeSIMD(), not free() or SDL_free()
232
- * or delete[], etc.
477
+ * You must free this memory with SDL_FreeSIMD(), not free() or SDL_free() or
478
+ * delete[], etc.
233
479
  *
234
- * Note that SDL will only deal with SIMD instruction sets it is aware of;
235
- * for example, SDL 2.0.8 knows that SSE wants 16-byte vectors
236
- * (SDL_HasSSE()), and AVX2 wants 32 bytes (SDL_HasAVX2()), but doesn't
237
- * know that AVX-512 wants 64. To be clear: if you can't decide to use an
238
- * instruction set with an SDL_Has*() function, don't use that instruction
239
- * set with memory allocated through here.
480
+ * Note that SDL will only deal with SIMD instruction sets it is aware of; for
481
+ * example, SDL 2.0.8 knows that SSE wants 16-byte vectors (SDL_HasSSE()), and
482
+ * AVX2 wants 32 bytes (SDL_HasAVX2()), but doesn't know that AVX-512 wants
483
+ * 64. To be clear: if you can't decide to use an instruction set with an
484
+ * SDL_Has*() function, don't use that instruction set with memory allocated
485
+ * through here.
240
486
  *
241
487
  * SDL_AllocSIMD(0) will return a non-NULL pointer, assuming the system isn't
242
- * out of memory.
488
+ * out of memory, but you are not allowed to dereference it (because you only
489
+ * own zero bytes of that buffer).
243
490
  *
244
- * \param len The length, in bytes, of the block to allocated. The actual
245
- * allocated block might be larger due to padding, etc.
246
- * \return Pointer to newly-allocated block, NULL if out of memory.
491
+ * \param len The length, in bytes, of the block to allocate. The actual
492
+ * allocated block might be larger due to padding, etc.
493
+ * \returns a pointer to the newly-allocated block, NULL if out of memory.
494
+ *
495
+ * \since This function is available since SDL 2.0.10.
247
496
  *
248
497
  * \sa SDL_SIMDAlignment
249
498
  * \sa SDL_SIMDRealloc
@@ -252,20 +501,22 @@ extern DECLSPEC size_t SDLCALL SDL_SIMDGetAlignment(void);
252
501
  extern DECLSPEC void * SDLCALL SDL_SIMDAlloc(const size_t len);
253
502
 
254
503
  /**
255
- * \brief Reallocate memory obtained from SDL_SIMDAlloc
504
+ * Reallocate memory obtained from SDL_SIMDAlloc
256
505
  *
257
506
  * It is not valid to use this function on a pointer from anything but
258
- * SDL_SIMDAlloc(). It can't be used on pointers from malloc, realloc,
259
- * SDL_malloc, memalign, new[], etc.
260
- *
261
- * \param mem The pointer obtained from SDL_SIMDAlloc. This function also
262
- * accepts NULL, at which point this function is the same as
263
- * calling SDL_realloc with a NULL pointer.
264
- * \param len The length, in bytes, of the block to allocated. The actual
265
- * allocated block might be larger due to padding, etc. Passing 0
266
- * will return a non-NULL pointer, assuming the system isn't out of
267
- * memory.
268
- * \return Pointer to newly-reallocated block, NULL if out of memory.
507
+ * SDL_SIMDAlloc(). It can't be used on pointers from malloc, realloc,
508
+ * SDL_malloc, memalign, new[], etc.
509
+ *
510
+ * \param mem The pointer obtained from SDL_SIMDAlloc. This function also
511
+ * accepts NULL, at which point this function is the same as
512
+ * calling SDL_SIMDAlloc with a NULL pointer.
513
+ * \param len The length, in bytes, of the block to allocated. The actual
514
+ * allocated block might be larger due to padding, etc. Passing 0
515
+ * will return a non-NULL pointer, assuming the system isn't out of
516
+ * memory.
517
+ * \returns a pointer to the newly-reallocated block, NULL if out of memory.
518
+ *
519
+ * \since This function is available since SDL 2.0.14.
269
520
  *
270
521
  * \sa SDL_SIMDAlignment
271
522
  * \sa SDL_SIMDAlloc
@@ -274,20 +525,29 @@ extern DECLSPEC void * SDLCALL SDL_SIMDAlloc(const size_t len);
274
525
  extern DECLSPEC void * SDLCALL SDL_SIMDRealloc(void *mem, const size_t len);
275
526
 
276
527
  /**
277
- * \brief Deallocate memory obtained from SDL_SIMDAlloc
528
+ * Deallocate memory obtained from SDL_SIMDAlloc
278
529
  *
279
530
  * It is not valid to use this function on a pointer from anything but
280
- * SDL_SIMDAlloc(). It can't be used on pointers from malloc, realloc,
281
- * SDL_malloc, memalign, new[], etc.
531
+ * SDL_SIMDAlloc() or SDL_SIMDRealloc(). It can't be used on pointers from
532
+ * malloc, realloc, SDL_malloc, memalign, new[], etc.
282
533
  *
283
534
  * However, SDL_SIMDFree(NULL) is a legal no-op.
284
535
  *
536
+ * The memory pointed to by `ptr` is no longer valid for access upon return,
537
+ * and may be returned to the system or reused by a future allocation. The
538
+ * pointer passed to this function is no longer safe to dereference once this
539
+ * function returns, and should be discarded.
540
+ *
541
+ * \param ptr The pointer, returned from SDL_SIMDAlloc or SDL_SIMDRealloc, to
542
+ * deallocate. NULL is a legal no-op.
543
+ *
544
+ * \since This function is available since SDL 2.0.10.
545
+ *
285
546
  * \sa SDL_SIMDAlloc
286
547
  * \sa SDL_SIMDRealloc
287
548
  */
288
549
  extern DECLSPEC void SDLCALL SDL_SIMDFree(void *ptr);
289
550
 
290
- /* vi: set ts=4 sw=4 expandtab: */
291
551
  /* Ends C function definitions when using C++ */
292
552
  #ifdef __cplusplus
293
553
  }