Skip to content

Commit 56b8bed

Browse files
committed
Update vendored SDL2 headers to version 2.32.10
1 parent 33b01e2 commit 56b8bed

Some content is hidden

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

94 files changed

+11559
-6076
lines changed

libs/sdl2/include/SDL.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Simple DirectMedia Layer
3-
Copyright (C) 1997-2022 Sam Lantinga <[email protected]>
3+
Copyright (C) 1997-2025 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,7 +25,6 @@
2525
* Main include header for the SDL library
2626
*/
2727

28-
2928
#ifndef SDL_h_
3029
#define SDL_h_
3130

@@ -70,6 +69,8 @@
7069
extern "C" {
7170
#endif
7271

72+
/* WIKI CATEGORY: Init */
73+
7374
/* As of version 0.5, SDL is loaded dynamically into the application */
7475

7576
/**
@@ -130,7 +131,7 @@ extern "C" {
130131
* call SDL_Quit() to force shutdown). If a subsystem is already loaded then
131132
* this call will increase the ref-count and return.
132133
*
133-
* \param flags subsystem initialization flags
134+
* \param flags subsystem initialization flags.
134135
* \returns 0 on success or a negative error code on failure; call
135136
* SDL_GetError() for more information.
136137
*

libs/sdl2/include/SDL_assert.h

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Simple DirectMedia Layer
3-
Copyright (C) 1997-2022 Sam Lantinga <[email protected]>
3+
Copyright (C) 1997-2025 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
@@ -55,10 +55,14 @@ assert can have unique static variables associated with it.
5555
#define SDL_TriggerBreakpoint() __builtin_debugtrap()
5656
#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) )
5757
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
58+
#elif (defined(__GNUC__) || defined(__clang__)) && defined(__riscv)
59+
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "ebreak\n\t" )
5860
#elif ( defined(__APPLE__) && (defined(__arm64__) || defined(__aarch64__)) ) /* this might work on other ARM targets, but this is a known quantity... */
5961
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #22\n\t" )
6062
#elif defined(__APPLE__) && defined(__arm__)
6163
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "bkpt #22\n\t" )
64+
#elif defined(_WIN32) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__arm64__) || defined(__aarch64__)) )
65+
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #0xF000\n\t" )
6266
#elif defined(__386__) && defined(__WATCOMC__)
6367
#define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
6468
#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
@@ -125,12 +129,10 @@ typedef struct SDL_AssertData
125129
const struct SDL_AssertData *next;
126130
} SDL_AssertData;
127131

128-
#if (SDL_ASSERT_LEVEL > 0)
129-
130132
/* Never call this directly. Use the SDL_assert* macros. */
131133
extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
132-
const char *,
133-
const char *, int)
134+
const char *,
135+
const char *, int)
134136
#if defined(__clang__)
135137
#if __has_feature(attribute_analyzer_noreturn)
136138
/* this tells Clang's static analysis that we're a custom assert function,
@@ -151,9 +153,7 @@ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
151153
#define SDL_enabled_assert(condition) \
152154
do { \
153155
while ( !(condition) ) { \
154-
static struct SDL_AssertData sdl_assert_data = { \
155-
0, 0, #condition, 0, 0, 0, 0 \
156-
}; \
156+
static struct SDL_AssertData sdl_assert_data = { 0, 0, #condition, NULL, 0, NULL, NULL }; \
157157
const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
158158
if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
159159
continue; /* go again. */ \
@@ -164,8 +164,6 @@ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
164164
} \
165165
} while (SDL_NULL_WHILE_LOOP_CONDITION)
166166

167-
#endif /* enabled assertions support code */
168-
169167
/* Enable various levels of assertions. */
170168
#if SDL_ASSERT_LEVEL == 0 /* assertions disabled */
171169
# define SDL_assert(condition) SDL_disabled_assert(condition)
@@ -195,8 +193,8 @@ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
195193
* A callback that fires when an SDL assertion fails.
196194
*
197195
* \param data a pointer to the SDL_AssertData structure corresponding to the
198-
* current assertion
199-
* \param userdata what was passed as `userdata` to SDL_SetAssertionHandler()
196+
* current assertion.
197+
* \param userdata what was passed as `userdata` to SDL_SetAssertionHandler().
200198
* \returns an SDL_AssertState value indicating how to handle the failure.
201199
*/
202200
typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
@@ -216,8 +214,8 @@ typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
216214
* This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
217215
*
218216
* \param handler the SDL_AssertionHandler function to call when an assertion
219-
* fails or NULL for the default handler
220-
* \param userdata a pointer that is passed to `handler`
217+
* fails or NULL for the default handler.
218+
* \param userdata a pointer that is passed to `handler`.
221219
*
222220
* \since This function is available since SDL 2.0.0.
223221
*
@@ -258,7 +256,7 @@ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetDefaultAssertionHandler(void
258256
* data, it is safe to pass a NULL pointer to this function to ignore it.
259257
*
260258
* \param puserdata pointer which is filled with the "userdata" pointer that
261-
* was passed to SDL_SetAssertionHandler()
259+
* was passed to SDL_SetAssertionHandler().
262260
* \returns the SDL_AssertionHandler that is called when an assert triggers.
263261
*
264262
* \since This function is available since SDL 2.0.2.

libs/sdl2/include/SDL_atomic.h

Lines changed: 42 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Simple DirectMedia Layer
3-
Copyright (C) 1997-2022 Sam Lantinga <[email protected]>
3+
Copyright (C) 1997-2025 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
@@ -20,38 +20,29 @@
2020
*/
2121

2222
/**
23-
* \file SDL_atomic.h
23+
* # CategoryAtomic
2424
*
2525
* Atomic operations.
2626
*
27-
* IMPORTANT:
28-
* If you are not an expert in concurrent lockless programming, you should
29-
* only be using the atomic lock and reference counting functions in this
30-
* file. In all other cases you should be protecting your data structures
31-
* with full mutexes.
27+
* IMPORTANT: If you are not an expert in concurrent lockless programming, you
28+
* should not be using any functions in this file. You should be protecting
29+
* your data structures with full mutexes instead.
3230
*
33-
* The list of "safe" functions to use are:
34-
* SDL_AtomicLock()
35-
* SDL_AtomicUnlock()
36-
* SDL_AtomicIncRef()
37-
* SDL_AtomicDecRef()
31+
* ***Seriously, here be dragons!***
3832
*
39-
* Seriously, here be dragons!
40-
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^
41-
*
42-
* You can find out a little more about lockless programming and the
43-
* subtle issues that can arise here:
44-
* http://msdn.microsoft.com/en-us/library/ee418650%28v=vs.85%29.aspx
33+
* You can find out a little more about lockless programming and the subtle
34+
* issues that can arise here:
35+
* https://learn.microsoft.com/en-us/windows/win32/dxtecharts/lockless-programming
4536
*
4637
* There's also lots of good information here:
47-
* http://www.1024cores.net/home/lock-free-algorithms
48-
* http://preshing.com/
4938
*
50-
* These operations may or may not actually be implemented using
51-
* processor specific atomic operations. When possible they are
52-
* implemented as true processor specific atomic operations. When that
53-
* is not possible the are implemented using locks that *do* use the
54-
* available atomic operations.
39+
* - https://www.1024cores.net/home/lock-free-algorithms
40+
* - https://preshing.com/
41+
*
42+
* These operations may or may not actually be implemented using processor
43+
* specific atomic operations. When possible they are implemented as true
44+
* processor specific atomic operations. When that is not possible the are
45+
* implemented using locks that *do* use the available atomic operations.
5546
*
5647
* All of the atomic operations that modify memory are full memory barriers.
5748
*/
@@ -94,7 +85,7 @@ typedef int SDL_SpinLock;
9485
* ***Please note that spinlocks are dangerous if you don't know what you're
9586
* doing. Please be careful using any sort of spinlock!***
9687
*
97-
* \param lock a pointer to a lock variable
88+
* \param lock a pointer to a lock variable.
9889
* \returns SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already
9990
* held.
10091
*
@@ -111,7 +102,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock);
111102
* ***Please note that spinlocks are dangerous if you don't know what you're
112103
* doing. Please be careful using any sort of spinlock!***
113104
*
114-
* \param lock a pointer to a lock variable
105+
* \param lock a pointer to a lock variable.
115106
*
116107
* \since This function is available since SDL 2.0.0.
117108
*
@@ -128,7 +119,7 @@ extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock);
128119
* ***Please note that spinlocks are dangerous if you don't know what you're
129120
* doing. Please be careful using any sort of spinlock!***
130121
*
131-
* \param lock a pointer to a lock variable
122+
* \param lock a pointer to a lock variable.
132123
*
133124
* \since This function is available since SDL 2.0.0.
134125
*
@@ -209,7 +200,7 @@ typedef void (*SDL_KernelMemoryBarrierFunc)();
209200
#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__) || defined(__ARM_ARCH_8A__)
210201
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
211202
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
212-
#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__)
203+
#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__)
213204
#ifdef __thumb__
214205
/* The mcr instruction isn't available in thumb mode, use real functions */
215206
#define SDL_MEMORY_BARRIER_USES_FUNCTION
@@ -240,7 +231,7 @@ typedef void (*SDL_KernelMemoryBarrierFunc)();
240231
/* "REP NOP" is PAUSE, coded for tools that don't know it by that name. */
241232
#if (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))
242233
#define SDL_CPUPauseInstruction() __asm__ __volatile__("pause\n") /* Some assemblers can't do REP NOP, so go with PAUSE. */
243-
#elif (defined(__arm__) && __ARM_ARCH >= 7) || defined(__aarch64__)
234+
#elif (defined(__arm__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7) || defined(__aarch64__)
244235
#define SDL_CPUPauseInstruction() __asm__ __volatile__("yield" ::: "memory")
245236
#elif (defined(__powerpc__) || defined(__powerpc64__))
246237
#define SDL_CPUPauseInstruction() __asm__ __volatile__("or 27,27,27");
@@ -249,29 +240,31 @@ typedef void (*SDL_KernelMemoryBarrierFunc)();
249240
#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64))
250241
#define SDL_CPUPauseInstruction() __yield()
251242
#elif defined(__WATCOMC__) && defined(__386__)
252-
/* watcom assembler rejects PAUSE if CPU < i686, and it refuses REP NOP as an invalid combination. Hardcode the bytes. */
253243
extern __inline void SDL_CPUPauseInstruction(void);
254-
#pragma aux SDL_CPUPauseInstruction = "db 0f3h,90h"
244+
#pragma aux SDL_CPUPauseInstruction = ".686p" ".xmm2" "pause"
255245
#else
256246
#define SDL_CPUPauseInstruction()
257247
#endif
258248

259249

260250
/**
261-
* \brief A type representing an atomic integer value. It is a struct
262-
* so people don't accidentally use numeric operations on it.
251+
* A type representing an atomic integer value.
252+
*
253+
* It is a struct so people don't accidentally use numeric operations on it.
263254
*/
264-
typedef struct { int value; } SDL_atomic_t;
255+
typedef struct SDL_atomic_t {
256+
int value;
257+
} SDL_atomic_t;
265258

266259
/**
267260
* Set an atomic variable to a new value if it is currently an old value.
268261
*
269262
* ***Note: If you don't know what this function is for, you shouldn't use
270263
* it!***
271264
*
272-
* \param a a pointer to an SDL_atomic_t variable to be modified
273-
* \param oldval the old value
274-
* \param newval the new value
265+
* \param a a pointer to an SDL_atomic_t variable to be modified.
266+
* \param oldval the old value.
267+
* \param newval the new value.
275268
* \returns SDL_TRUE if the atomic variable was set, SDL_FALSE otherwise.
276269
*
277270
* \since This function is available since SDL 2.0.0.
@@ -290,8 +283,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int
290283
* ***Note: If you don't know what this function is for, you shouldn't use
291284
* it!***
292285
*
293-
* \param a a pointer to an SDL_atomic_t variable to be modified
294-
* \param v the desired value
286+
* \param a a pointer to an SDL_atomic_t variable to be modified.
287+
* \param v the desired value.
295288
* \returns the previous value of the atomic variable.
296289
*
297290
* \since This function is available since SDL 2.0.2.
@@ -306,7 +299,7 @@ extern DECLSPEC int SDLCALL SDL_AtomicSet(SDL_atomic_t *a, int v);
306299
* ***Note: If you don't know what this function is for, you shouldn't use
307300
* it!***
308301
*
309-
* \param a a pointer to an SDL_atomic_t variable
302+
* \param a a pointer to an SDL_atomic_t variable.
310303
* \returns the current value of an atomic variable.
311304
*
312305
* \since This function is available since SDL 2.0.2.
@@ -323,8 +316,8 @@ extern DECLSPEC int SDLCALL SDL_AtomicGet(SDL_atomic_t *a);
323316
* ***Note: If you don't know what this function is for, you shouldn't use
324317
* it!***
325318
*
326-
* \param a a pointer to an SDL_atomic_t variable to be modified
327-
* \param v the desired value to add
319+
* \param a a pointer to an SDL_atomic_t variable to be modified.
320+
* \param v the desired value to add.
328321
* \returns the previous value of the atomic variable.
329322
*
330323
* \since This function is available since SDL 2.0.2.
@@ -357,9 +350,9 @@ extern DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_atomic_t *a, int v);
357350
* ***Note: If you don't know what this function is for, you shouldn't use
358351
* it!***
359352
*
360-
* \param a a pointer to a pointer
361-
* \param oldval the old pointer value
362-
* \param newval the new pointer value
353+
* \param a a pointer to a pointer.
354+
* \param oldval the old pointer value.
355+
* \param newval the new pointer value.
363356
* \returns SDL_TRUE if the pointer was set, SDL_FALSE otherwise.
364357
*
365358
* \since This function is available since SDL 2.0.0.
@@ -376,8 +369,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void **a, void *oldval, void *
376369
* ***Note: If you don't know what this function is for, you shouldn't use
377370
* it!***
378371
*
379-
* \param a a pointer to a pointer
380-
* \param v the desired pointer value
372+
* \param a a pointer to a pointer.
373+
* \param v the desired pointer value.
381374
* \returns the previous value of the pointer.
382375
*
383376
* \since This function is available since SDL 2.0.2.
@@ -393,7 +386,7 @@ extern DECLSPEC void* SDLCALL SDL_AtomicSetPtr(void **a, void* v);
393386
* ***Note: If you don't know what this function is for, you shouldn't use
394387
* it!***
395388
*
396-
* \param a a pointer to a pointer
389+
* \param a a pointer to a pointer.
397390
* \returns the current value of a pointer.
398391
*
399392
* \since This function is available since SDL 2.0.2.

0 commit comments

Comments
 (0)