Skip to content

Commit b32d1fc

Browse files
committed
Update bundled SDL2 headers to version 2.0.6
1 parent e3d70f6 commit b32d1fc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+5359
-7065
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ os:
88
- linux
99
- osx
1010
install:
11-
- wget https://www.libsdl.org/release/SDL2-2.0.5.tar.gz -O sdl2.tar.gz
11+
- wget https://www.libsdl.org/release/SDL2-2.0.6.tar.gz -O sdl2.tar.gz
1212
- tar xzf sdl2.tar.gz
1313
- pushd SDL2-* && ./configure && make && sudo make install && popd
1414
- wget -q https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.14.tar.gz

examples/game-of-life.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ mod game_of_life {
115115
}
116116
}
117117

118-
fn dummy_texture<'a>(canvas: &mut Canvas<Window>, texture_creator: &'a TextureCreator<WindowContext>) -> (Texture, Texture) {
118+
fn dummy_texture<'a>(canvas: &mut Canvas<Window>, texture_creator: &'a TextureCreator<WindowContext>) -> (Texture<'a>, Texture<'a>) {
119119
enum TextureColor {
120120
Yellow,
121121
White,

examples/resource-manager.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ fn main() {
7070
}
7171
}
7272

73-
type TextureManager<'l, T> = ResourceManager<'l, String, Texture, TextureCreator<T>>;
73+
type TextureManager<'l, T> = ResourceManager<'l, String, Texture<'l>, TextureCreator<T>>;
7474
type FontManager<'l> = ResourceManager<'l, FontDetails, Font<'l, 'static>, Sdl2TtfContext>;
7575

7676
// Generic struct to cache any resource loaded by a ResourceLoader
@@ -113,7 +113,7 @@ impl<'l, K, R, L> ResourceManager<'l, K, R, L>
113113
}
114114

115115
// TextureCreator knows how to load Textures
116-
impl<'l, T> ResourceLoader<'l, Texture> for TextureCreator<T> {
116+
impl<'l, T> ResourceLoader<'l, Texture<'l>> for TextureCreator<T> {
117117
type Args = str;
118118
fn load(&'l self, path: &str) -> Result<Texture, String> {
119119
println!("LOADED A TEXTURE");

sdl2-sys/SDL2-2.0.5/include/SDL_blendmode.h

Lines changed: 0 additions & 63 deletions
This file was deleted.

sdl2-sys/SDL2-2.0.5/include/SDL_revision.h

Lines changed: 0 additions & 2 deletions
This file was deleted.

sdl2-sys/SDL2-2.0.5/include/SDL.h renamed to sdl2-sys/SDL2-2.0.6/include/SDL.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Simple DirectMedia Layer
3-
Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
3+
Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
44
55
This software is provided 'as-is', without any express or implied
66
warranty. In no event will the authors be held liable for any damages
@@ -26,8 +26,8 @@
2626
*/
2727

2828

29-
#ifndef _SDL_H
30-
#define _SDL_H
29+
#ifndef SDL_h_
30+
#define SDL_h_
3131

3232
#include "SDL_main.h"
3333
#include "SDL_stdinc.h"
@@ -40,17 +40,18 @@
4040
#include "SDL_error.h"
4141
#include "SDL_events.h"
4242
#include "SDL_filesystem.h"
43-
#include "SDL_joystick.h"
4443
#include "SDL_gamecontroller.h"
4544
#include "SDL_haptic.h"
4645
#include "SDL_hints.h"
46+
#include "SDL_joystick.h"
4747
#include "SDL_loadso.h"
4848
#include "SDL_log.h"
4949
#include "SDL_messagebox.h"
5050
#include "SDL_mutex.h"
5151
#include "SDL_power.h"
5252
#include "SDL_render.h"
5353
#include "SDL_rwops.h"
54+
#include "SDL_shape.h"
5455
#include "SDL_system.h"
5556
#include "SDL_thread.h"
5657
#include "SDL_timer.h"
@@ -127,6 +128,6 @@ extern DECLSPEC void SDLCALL SDL_Quit(void);
127128
#endif
128129
#include "close_code.h"
129130

130-
#endif /* _SDL_H */
131+
#endif /* SDL_h_ */
131132

132133
/* vi: set ts=4 sw=4 expandtab: */

sdl2-sys/SDL2-2.0.5/include/SDL_assert.h renamed to sdl2-sys/SDL2-2.0.6/include/SDL_assert.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Simple DirectMedia Layer
3-
Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
3+
Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
44
55
This software is provided 'as-is', without any express or implied
66
warranty. In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
1919
3. This notice may not be removed or altered from any source distribution.
2020
*/
2121

22-
#ifndef _SDL_assert_h
23-
#define _SDL_assert_h
22+
#ifndef SDL_assert_h_
23+
#define SDL_assert_h_
2424

2525
#include "SDL_config.h"
2626

@@ -51,9 +51,11 @@ assert can have unique static variables associated with it.
5151
/* Don't include intrin.h here because it contains C++ code */
5252
extern void __cdecl __debugbreak(void);
5353
#define SDL_TriggerBreakpoint() __debugbreak()
54-
#elif (!defined(__NACL__) && defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))
54+
#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) )
5555
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
56-
#elif defined(HAVE_SIGNAL_H)
56+
#elif defined(__386__) && defined(__WATCOMC__)
57+
#define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
58+
#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
5759
#include <signal.h>
5860
#define SDL_TriggerBreakpoint() raise(SIGTRAP)
5961
#else
@@ -63,7 +65,7 @@ assert can have unique static variables associated with it.
6365

6466
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
6567
# define SDL_FUNCTION __func__
66-
#elif ((__GNUC__ >= 2) || defined(_MSC_VER))
68+
#elif ((__GNUC__ >= 2) || defined(_MSC_VER) || defined (__WATCOMC__))
6769
# define SDL_FUNCTION __FUNCTION__
6870
#else
6971
# define SDL_FUNCTION "???"
@@ -201,7 +203,7 @@ typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
201203
*
202204
* This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
203205
*
204-
* \return SDL_AssertState value of how to handle the assertion failure.
206+
* Return SDL_AssertState value of how to handle the assertion failure.
205207
*
206208
* \param handler Callback function, called when an assertion fails.
207209
* \param userdata A pointer passed to the callback as-is.
@@ -250,7 +252,7 @@ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puse
250252
* <code>
251253
* const SDL_AssertData *item = SDL_GetAssertionReport();
252254
* while (item) {
253-
* printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n",
255+
* printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n",
254256
* item->condition, item->function, item->filename,
255257
* item->linenum, item->trigger_count,
256258
* item->always_ignore ? "yes" : "no");
@@ -284,6 +286,6 @@ extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
284286
#endif
285287
#include "close_code.h"
286288

287-
#endif /* _SDL_assert_h */
289+
#endif /* SDL_assert_h_ */
288290

289291
/* vi: set ts=4 sw=4 expandtab: */

sdl2-sys/SDL2-2.0.5/include/SDL_atomic.h renamed to sdl2-sys/SDL2-2.0.6/include/SDL_atomic.h

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Simple DirectMedia Layer
3-
Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
3+
Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
44
55
This software is provided 'as-is', without any express or implied
66
warranty. In no event will the authors be held liable for any damages
@@ -56,8 +56,8 @@
5656
* All of the atomic operations that modify memory are full memory barriers.
5757
*/
5858

59-
#ifndef _SDL_atomic_h_
60-
#define _SDL_atomic_h_
59+
#ifndef SDL_atomic_h_
60+
#define SDL_atomic_h_
6161

6262
#include "SDL_stdinc.h"
6363
#include "SDL_platform.h"
@@ -118,13 +118,16 @@ extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
118118
* The compiler barrier prevents the compiler from reordering
119119
* reads and writes to globally visible variables across the call.
120120
*/
121-
#if defined(_MSC_VER) && (_MSC_VER > 1200)
121+
#if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__)
122122
void _ReadWriteBarrier(void);
123123
#pragma intrinsic(_ReadWriteBarrier)
124124
#define SDL_CompilerBarrier() _ReadWriteBarrier()
125125
#elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
126126
/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
127127
#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
128+
#elif defined(__WATCOMC__)
129+
extern _inline void SDL_CompilerBarrier (void);
130+
#pragma aux SDL_CompilerBarrier = "" parm [] modify exact [];
128131
#else
129132
#define SDL_CompilerBarrier() \
130133
{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
@@ -149,18 +152,21 @@ void _ReadWriteBarrier(void);
149152
* For more information on these semantics, take a look at the blog post:
150153
* http://preshing.com/20120913/acquire-and-release-semantics
151154
*/
155+
extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void);
156+
extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
157+
152158
#if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
153159
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory")
154160
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory")
155161
#elif defined(__GNUC__) && defined(__arm__)
156162
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__)
157163
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
158164
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
159-
#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)
165+
#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_5TE__)
160166
#ifdef __thumb__
161167
/* The mcr instruction isn't available in thumb mode, use real functions */
162-
extern DECLSPEC void SDLCALL SDL_MemoryBarrierRelease();
163-
extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquire();
168+
#define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction()
169+
#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction()
164170
#else
165171
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
166172
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
@@ -263,6 +269,6 @@ extern DECLSPEC void* SDLCALL SDL_AtomicGetPtr(void **a);
263269

264270
#include "close_code.h"
265271

266-
#endif /* _SDL_atomic_h_ */
272+
#endif /* SDL_atomic_h_ */
267273

268274
/* vi: set ts=4 sw=4 expandtab: */

sdl2-sys/SDL2-2.0.5/include/SDL_audio.h renamed to sdl2-sys/SDL2-2.0.6/include/SDL_audio.h

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Simple DirectMedia Layer
3-
Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
3+
Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
44
55
This software is provided 'as-is', without any express or implied
66
warranty. In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
2525
* Access to the raw audio mixing buffer for the SDL library.
2626
*/
2727

28-
#ifndef _SDL_audio_h
29-
#define _SDL_audio_h
28+
#ifndef SDL_audio_h_
29+
#define SDL_audio_h_
3030

3131
#include "SDL_stdinc.h"
3232
#include "SDL_error.h"
@@ -171,7 +171,7 @@ typedef struct SDL_AudioSpec
171171
SDL_AudioFormat format; /**< Audio data format */
172172
Uint8 channels; /**< Number of channels: 1 mono, 2 stereo */
173173
Uint8 silence; /**< Audio buffer silence value (calculated) */
174-
Uint16 samples; /**< Audio buffer size in samples (power of 2) */
174+
Uint16 samples; /**< Audio buffer size in sample FRAMES (total samples divided by channel count) */
175175
Uint16 padding; /**< Necessary for some compile environments */
176176
Uint32 size; /**< Audio buffer size in bytes (calculated) */
177177
SDL_AudioCallback callback; /**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). */
@@ -184,7 +184,23 @@ typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt,
184184
SDL_AudioFormat format);
185185

186186
/**
187-
* A structure to hold a set of audio conversion filters and buffers.
187+
* \brief Upper limit of filters in SDL_AudioCVT
188+
*
189+
* The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is
190+
* currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers,
191+
* one of which is the terminating NULL pointer.
192+
*/
193+
#define SDL_AUDIOCVT_MAX_FILTERS 9
194+
195+
/**
196+
* \struct SDL_AudioCVT
197+
* \brief A structure to hold a set of audio conversion filters and buffers.
198+
*
199+
* Note that various parts of the conversion pipeline can take advantage
200+
* of SIMD operations (like SSE2, for example). SDL_AudioCVT doesn't require
201+
* you to pass it aligned data, but can possibly run much faster if you
202+
* set both its (buf) field to a pointer that is aligned to 16 bytes, and its
203+
* (len) field to something that's a multiple of 16, if possible.
188204
*/
189205
#ifdef __GNUC__
190206
/* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't
@@ -208,7 +224,7 @@ typedef struct SDL_AudioCVT
208224
int len_cvt; /**< Length of converted audio buffer */
209225
int len_mult; /**< buffer must be len*len_mult big */
210226
double len_ratio; /**< Given len, final size is len*len_ratio */
211-
SDL_AudioFilter filters[10]; /**< Filter list */
227+
SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS + 1]; /**< NULL-terminated list of filter functions */
212228
int filter_index; /**< Current audio conversion function */
213229
} SDL_AUDIOCVT_PACKED SDL_AudioCVT;
214230

@@ -434,10 +450,10 @@ extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf);
434450
* This function takes a source format and rate and a destination format
435451
* and rate, and initializes the \c cvt structure with information needed
436452
* by SDL_ConvertAudio() to convert a buffer of audio data from one format
437-
* to the other.
453+
* to the other. An unsupported format causes an error and -1 will be returned.
438454
*
439-
* \return -1 if the format conversion is not supported, 0 if there's
440-
* no conversion needed, or 1 if the audio filter is set up.
455+
* \return 0 if no conversion is needed, 1 if the audio filter is set up,
456+
* or -1 on error.
441457
*/
442458
extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
443459
SDL_AudioFormat src_format,
@@ -456,6 +472,8 @@ extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
456472
* The data conversion may expand the size of the audio data, so the buffer
457473
* \c cvt->buf should be allocated after the \c cvt structure is initialized by
458474
* SDL_BuildAudioCVT(), and should be \c cvt->len*cvt->len_mult bytes long.
475+
*
476+
* \return 0 on success or -1 if \c cvt->buf is NULL.
459477
*/
460478
extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt);
461479

@@ -667,6 +685,6 @@ extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev);
667685
#endif
668686
#include "close_code.h"
669687

670-
#endif /* _SDL_audio_h */
688+
#endif /* SDL_audio_h_ */
671689

672690
/* vi: set ts=4 sw=4 expandtab: */

0 commit comments

Comments
 (0)