55 Commits

Author SHA1 Message Date
Cameron Gutman 66e98b5598 atomic: Fix infinite recursion in SDL_CompilerBarrier() fallback
On some platforms, SDL_MemoryBarrierRelease() is defined to
SDL_CompilerBarrier(). If SDL_CompilerBarrier() is also defined to
the fallback spinlock acquire/release, then we will infinitely
recurse in SDL_UnlockSpinlock(). Avoid this by not unlocking the
temporary spinlock we create.
2026-04-27 14:30:18 -04:00
Cameron Gutman d5acd7f123 atomic: Use __atomic_signal_fence() for SDL_CompilerBarrier()
This is the (slightly) more standard way to accomplish it.
2026-04-26 22:03:34 -05:00
Cameron Gutman 2c4c8172d7 atomic: Fix memory barriers on MSVC ARM64 2026-04-24 20:12:26 -05:00
Cameron Gutman f2206974b0 atomic: Use DMB ISHLD for aarch64 acquire barrier
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
This is a little more efficient than a DMB ISH and matches what
GCC, Clang, and MSVC generate for a C++11 acquire fence.
2026-04-23 21:01:36 -05:00
Cameron Gutman 2858a32723 atomic: Use __atomic_thread_fence() when available
This avoids requiring inline assembly for each architecture.

It also fixes some weakly ordered architectures which lacked
said inline assembly (RISC-V, MIPS, LoongArch, etc) and were
thus disasterously broken.
2026-04-23 18:53:08 -05:00
Sam Lantinga 5f086e7623 Updated copyright for 2026 2026-01-01 09:40:08 -08:00
SDL Wiki Bot 943d0f67ba Sync SDL3 wiki -> header
[ci skip]
2025-08-27 13:46:21 +00:00
Sam Lantinga 42f634ff7a Added SDL_AddAtomicU32()
Fixes https://github.com/libsdl-org/SDL/issues/13496
2025-08-27 06:44:51 -07:00
SDL Wiki Bot 11dbff246f Sync SDL3 wiki -> header
[ci skip]
2025-01-28 19:01:16 +00:00
Ryan C. Gordon 7a5604cf0c Sync SDL3 wiki -> headers. 2025-01-21 13:12:25 -05:00
Sam Lantinga f2074d7af3 Updated copyright for 2025 2025-01-01 07:45:52 -08:00
SDL Wiki Bot 56cf8d8dc9 Sync SDL3 wiki -> header
[ci skip]
2024-12-22 07:09:56 +00:00
Ryan C. Gordon f0fad41f2c include: Filled in all remaining missing documentation! 2024-12-22 01:58:13 -05:00
Maia 97ddc9adf2 Fix outdated references to SDL symbols in docs. Fixes #11503 2024-11-22 15:52:31 -05:00
Ryan C. Gordon 10e52e1899 docs: Added more '\threadsafety` tags.
Reference Issue #7140.
2024-10-24 14:37:23 -04:00
Ryan C. Gordon 1c1706a00b fnsince: update \since policy for documentation.
Everything in SDL3 up to the ABI lock is reported as available since 3.1.3.
Everything else will be reported as since 3.2.0 (what will be the first
official release).

Also ran a Perl script over the headers to change everything to 3.1.3 that
wasn't an API function, since fnsince.pl can't manage those. If there's a
macro or datatype that has snuck in that needs to be 3.2.0 instead, we'll
have to manually fix it up, but it shouldn't be a big deal in any case.

Reference PR #11304.
2024-10-23 12:22:43 -04:00
Petar Popovic 4392233007 Removed tabs from headers 2024-09-21 10:39:53 -07:00
SDL Wiki Bot 026d3c2306 Sync SDL3 wiki -> header 2024-09-18 15:33:11 +00:00
Sam Lantinga a90ad3b0e2 Removed SDL_bool in favor of plain bool
We require stdbool.h in the build environment, so we might as well use the plain bool type.

If your environment doesn't have stdbool.h, this simple replacement will suffice:
typedef signed char bool;
2024-09-18 08:32:30 -07:00
SDL Wiki Bot 8481d1a12b Sync SDL3 wiki -> header 2024-09-17 15:54:09 +00:00
Sam Lantinga d0edf68774 Added Uint32 versions of the atomic functions 2024-09-17 08:53:27 -07:00
Sam Lantinga 8d223b3037 Renamed atomic functions to match SDL 3.0 naming convention
This will also allow us to cleanly add atomic operations for other types in the future.
2024-09-17 08:53:27 -07:00
Sam Lantinga cf1d8e2dfd Renamed SDL_AtomicSetPtr() and SDL_AtomicGetPtr()
Fixes https://github.com/libsdl-org/SDL/issues/10601
2024-08-31 07:46:28 -07:00
Sam Lantinga 637e9700dd Standardize placement of '*' in function declarations
Implemented using these sed commands on the headers:
sed -E -i'' '/SDLCALL|;/ s,([a-z])\* ,\1 *,g' *
sed -E -i'' 's,(\(.*[^\*])\* ([a-z])(.*\)),\1*\2\3,g' *
sed -E -i'' 's,\*const,* const,g' *
sed -E -i'' 's,\*SDLCALL,* SDLCALL,g' *
sed -E -i'' 's,void\(,void (,g' *
git checkout *gl*
2024-07-19 12:22:03 -07:00
Ryan C. Gordon 51902d4ac5 Updated headers with latest wikiheaders tweaks. 2024-06-14 02:09:55 -04:00
SDL Wiki Bot 983544a53e Sync SDL3 wiki -> header 2024-05-22 00:41:09 +00:00
Sam Lantinga 6f2621438a Renamed DECLSPEC to SDL_DECLSPEC 2024-05-17 17:09:09 -07:00
Ryan C. Gordon 5e6d85b8f0 wikiheaders: bridge wiki Category docs to the headers!
Did an initial cleanup on the headers and wrote a few pieces of documentation,
but this needs more work to fill out the documentation.
2024-05-16 11:48:23 -04:00
SDL Wiki Bot ceeefb0512 Sync SDL3 wiki -> header 2024-04-24 20:43:29 +00:00
Ryan C. Gordon cdb3cea76d SDL_atomic.h: Documentation updates. 2024-04-24 16:42:16 -04:00
SDL Wiki Bot 59c332e569 Sync SDL3 wiki -> header 2024-04-14 05:35:26 +00:00
Ryan C. Gordon 041de0c2eb include: Some documentation improvements. 2024-04-14 01:33:56 -04:00
Ryan C. Gordon 0df988389c include: Add \since to all documentation that was missing it. 2024-04-11 13:34:29 -04:00
SDL Wiki Bot b2239cb7ba Sync SDL3 wiki -> header 2024-04-10 19:59:14 +00:00
Ryan C. Gordon 557f26e6f0 include: Fixed up some more documentation. 2024-04-10 15:58:28 -04:00
Sam Lantinga d8a54cd4f8 Updated "see also" references to be more consistent
Fixes https://github.com/libsdl-org/SDL/issues/9282
2024-03-17 12:28:11 -07:00
Tolik708 2a775cad6f Named typedef-ed structs Gave name to structs that were defined like anonymous struct with name given by typedef. Example 'typedef struct {...} Foo;' -> 'typedef struct Foo {...} Foo;' 2024-03-10 09:04:18 -07:00
Anonymous Maarten 31d133db40 Define SDL_PLATFORM_* macros instead of underscored ones (#8875) 2024-01-24 01:40:51 +00:00
Sam Lantinga a2665f54c8 Updated the atomic API for SDL 3.0 naming conventions
Fixes https://github.com/libsdl-org/SDL/issues/7388
2024-01-18 04:41:34 -08:00
J. Neuschäfer 139a0931a3 Fix memory barriers on ARMv5
The ARM926EJ-S Technical Reference Manual states:

> You can only access CP15 registers with MRC and MCR instructions in a
> privileged mode. CDP, LDC, STC, MCRR, and MRRC instructions, and unprivileged
> MRC or MCR instructions to CP15 cause the Undefined instruction exception to
> be taken.

Furthermore, `MCR p15, 0, <Rd>, c7, c10, 5` (later called Data Memory Barrier)
is not specified for the ARM926. Thus, SDL should not use these cache
instructions on ARMv5.
2024-01-05 09:00:47 -08:00
Sam Lantinga 5b3ee51c6c Updated copyright for 2024 2024-01-01 13:15:26 -08:00
Ryan C. Gordon c53843a961 docs: Remove Doxygen \brief tags.
Doxygen and the wiki bridge don't need them; they'll both just use the first
line/sentence instead.

Fixes #8446.
2023-11-06 10:26:06 -05:00
Anonymous Maarten 8105f1d5b5 SDL_atomic.h: __ARM_ARCH is not always defined for an arm platform
e.g. riscos toolchain
2023-07-22 15:55:48 -04:00
David Demelier d0c4849d0b Rename SDL_atomic_t to SDL_AtomicInt 2023-03-09 09:00:09 -08:00
Anonymous Maarten 549cedfa88 include: add \brief to includes 2023-02-19 10:01:33 -08:00
Sylvain 81c94a165c Add \since docs where missing and resets some to 3.0.0
- remove a \returns
2023-02-12 20:43:11 +01:00
Jiří Malák 54540a82a0 SDL_atomic.h: Update SDL_CPUPauseInstruction for Watcom. (#7157)
Appropriate CPU directive can be used in #pragma aux so that it is not
necessary to hardcode instruction bytes.

(cherry picked from commit 507fc462db)
2023-01-26 17:01:56 +03:00
David Carlier b379c910d4 SDL_CPUPauseInstruction RISCV-64 version proposal. 2023-01-22 13:58:59 -08:00
Sam Lantinga fde78d12f2 Updated copyright for 2023 2023-01-09 09:41:41 -08:00
Sam Lantinga dbd4b88abc Generally removed generally 2023-01-09 09:04:05 -08:00