Compare commits

...
Author SHA1 Message Date
Ryan C. Gordon bcdb3eddcc WhatsNew.txt: Moved some missing entries over to the release-3.2.x branch.
Fixes #14622.
2025-12-08 11:08:04 -05:00
Qiu Qiang 057634d069 Fix loop variable bug in V4L2 camera format enumeration
(cherry picked from commit 19988c5faa)
2025-12-07 14:12:03 -08:00
LuncyBloont eb5eb4a33d Fix crash in UploadToTexture() on DX12.
(cherry picked from commit ab67be7e5a)
2025-12-05 11:47:02 -08:00
Eddy Jansson df145a9649 log: Fix unlikely out-of-bounds issue.
In the unlikely case that the overflow check should fail,
the else clause would switch to the truncated stack message
without updating the len variable. This would contain the
return value from vsnprintf(), meaning it could point beyond
the buffer.

The subsequent code which trims NL and CR from the buffer,
would then read -- and possibly write -- out-of-bounds.

To fix this, we split the two joint conditions into separate
if-clauses, and adjust the len variable in the case where we
know the message buffer was truncated.

(cherry picked from commit 2cb9a4fcc1)
2025-12-04 13:20:34 -08:00
cosmonaut b8618dd405 GPU: Remove erroneous buffer usage flag from defrag process
(cherry picked from commit aae2f74ae6)
2025-12-03 15:03:53 -08:00
Simon McVittie ddb497e815 testver: Assert that SDL_GetRevision() starts with SDL-
https://github.com/libsdl-org/SDL/issues/14575

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 65ef4df6d4)
2025-12-03 08:51:53 -08:00
Simon McVittie 6a42180dbf build-scripts: Include SDL- prefix in SDL_REVISION when built from tarball
https://github.com/libsdl-org/SDL/issues/14575

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit cc681ffeda)
2025-12-03 08:51:52 -08:00
Anonymous Maarten 223a3dc461 release: verify SDL_REVISION contains SDL-
(cherry picked from commit 3313cb9c4b)
2025-12-03 08:51:52 -08:00
Toast 13373ef501 Added Keychron V5 System Control to the controller blacklist
(cherry picked from commit 1dea7c801b)
2025-12-03 07:15:22 -08:00
Sam Lantinga a7de0d9a3e Updated to version 3.2.29 for development 2025-12-02 13:02:25 -08:00
Sam Lantinga 7f3ae3d574 Updated to version 3.2.28 for release 2025-12-02 07:47:05 -08:00
Cameron Gutman 80f82acdf8 quit: don't call signal() if we're using sigaction()
At best, this is a no-op.

At worst, it might:
 - Clobber a signal handler someone registered after us
 - Overwrite the signal mask or flags
 - Cause unregistration to fail (sigaction() isn't guaranteed to return the exact pointer passed to signal())

(cherry picked from commit 6d99204a82)
2025-12-01 19:47:32 -06:00
Sam Lantinga 78146bb14c Correct the sensor axis ordering with the Linux Nintendo driver
Fixes https://github.com/libsdl-org/SDL/issues/14552

(cherry picked from commit 5e9163592f)
2025-11-30 11:37:34 -08:00
Amelia Clarke c61f97dbce events: fix SDL_PeepEvents() returning 0 on error
Signed-off-by: Amelia Clarke <selene@perilune.dev>
(cherry picked from commit defd7895da)
2025-11-28 07:42:09 -08:00
Anonymous Maarten c823f837c0 ci: bump macos-13 to macos-14
macos-13 image is getting retired in December 2025

(backported from commit 7a26bee6ee)
2025-11-26 17:25:50 +03:00
Anonymous Maarten f8252fcc91 JNI_Unload must return the JNI version needed by the native library
(cherry picked from commit eda8d1d842)
2025-11-26 14:05:37 +01:00
Ryan C. Gordon 98ed8b98b1 blit: Check MSVC's _M_ARM64 define in addition to __aarch64__.
Reference Issue #14519.

(cherry picked from commit 4e79d2ad64)
2025-11-25 14:41:57 -08:00
Ryan C. Gordon 5f5a73a8f6 blit: Check MSVC's _M_ARM64 define in addition to __aarch64__.
Reference Issue #14519.

(cherry picked from commit 7f0d0d0046)
2025-11-25 14:41:49 -08:00
Ryan C. Gordon 50be2a7e56 blit: Change ifdefs on NEON functions that use an aarch64-specific opcode.
Fixes #14519.

(cherry picked from commit 15f98b2a61)
2025-11-25 14:41:07 -08:00
Ethan Lee 4fdbac7207 video: Explicitly call DestroyWindowTexture when destroying a window.
This prevents some recursion issues with hashtables, as described in #14499.
2025-11-24 01:25:38 -05:00
Sam Lantinga 8199076878 vulkan gpu: set the sample count for depth prepass
Fixes https://github.com/libsdl-org/SDL/issues/14500

(cherry picked from commit 1fc093491a)
2025-11-22 07:54:21 -08:00
Susko3 c49de41ef3 Fix WM_SYSKEYDOWN not being trapped by IME message handling
This would cause Alt + <something> not being trapped if handled by the system IME.

(cherry picked from commit 2ef005afe5)
2025-11-19 13:40:19 -08:00
Sam Lantinga ad5681c45b Fixed crash in the vulkan renderer when the window is minimized
There's more work to do here in other cases where we can't recreate the swap chain, but this fixes the common minimize case.

Fixes https://github.com/libsdl-org/SDL/issues/14434

(cherry picked from commit 0ae3d7b0b0)
2025-11-14 12:35:42 -08:00
Sam Lantinga daf76f1ff6 Restored the original OpenBSD Xbox 360 controller mapping
(cherry picked from commit 90242312fe)
2025-11-14 07:20:17 -08:00
Sam Lantinga cdff4b2bb5 Completed removing predefined Xbox 360 mappings for Linux
Also removed them for OpenBSD, since it's not clear which ones, if any, are needed.

(cherry picked from commit b305534edc)
2025-11-14 07:20:17 -08:00
Dave Wickham d3a1a97db8 Re-add deleted gamepad mappings to the OpenBSD-specific section
(cherry picked from commit f6c3af9c8c)
2025-11-14 07:20:16 -08:00
Dave Wickham 962464629d Remove special-case Xbox 360 wireless controller mappings
Fixes https://github.com/libsdl-org/SDL/issues/14324

(cherry picked from commit 0c4c4cfd16)
2025-11-14 07:20:16 -08:00
Sam Lantinga 3291c2e560 Check for wine_get_version() to detect Wine/Proton
If this application is being run under Wine but Steam doesn't know that, Steam won't set STEAM_COMPAT_PROTON. So we'll use wine_get_version() to detect that we're running under Wine instead.

(cherry picked from commit e2e8f86076)
2025-11-12 22:30:48 -08:00
Sam Lantinga b797a84b5d Don't check SteamVirtualGamepadInfo when running as Wine
Wine will ignore the Steam Virtual Gamepad if it looks like it has the original (blocked) controller VID/PID.

Fixes https://github.com/libsdl-org/SDL/issues/14410

(cherry picked from commit 493bc621e4)
2025-11-12 22:30:48 -08:00
Marcin Serwin 45b0460019 Don't divide by zero in slow blitter
Other blitters seem to handle zero width/height destinations correctly.

Signed-off-by: Marcin Serwin <marcin@serwin.dev>
(cherry picked from commit 53ee410d7a)
2025-11-09 07:26:37 -08:00
Chris Genova 5d0919855e D3D12 GPU: Prevent reading out of bounds when uploading textures.
When the upload needs realignment, a new buffer is created to do the
upload, and the source data is copied to the new buffer. This commit
fixes the issue where the memcopy can read off the end of the source
buffer since it is reading based on destination pitch instead of source
pitch.

(cherry picked from commit 6a01d6e7d3)
2025-11-07 17:50:25 -08:00
Sam Lantinga 6d2d283954 Fixed blitting bitmaps with a non-zero x offset
Also added basic testautomation coverage of bitmap blits

Fixes https://github.com/libsdl-org/sdl2-compat/issues/546

(cherry picked from commit a2ed1a4197)
2025-11-06 22:49:17 -08:00
Frank Praznik 49db06b604 x11: Only correct placement for border offset on the initial window mapping
Correcting it when it is subsequently hidden and re-mapped will cause the position to be double offset by the size of the borders.

(cherry picked from commit a71b2f0a93)
2025-11-06 19:35:51 -05:00
yuanhecai 85012b6074 loongarch: add SDL_FillSurfaceRect4LSX opt
(cherry picked from commit dc5b136930)
2025-11-06 07:29:51 -08:00
yuanhecai 14271c72f3 loongarch: add Blit8888to8888PixelAlphaSwizzleLSX opt
(cherry picked from commit 0b1eb4c841)
2025-11-06 07:29:50 -08:00
Sam Lantinga d73922e407 Validate SPI read command in the Nintendo Switch HIDAPI driver
(cherry picked from commit c94da8977d)
2025-11-05 17:35:02 -08:00
Sam Lantinga c8d23a5f01 Fixed unaligned access in the Nintendo Switch HIDAPI driver
(cherry picked from commit 9a1745f2c8)
2025-11-05 17:08:50 -08:00
Yevgen Abramov 4d8c8cdeda Fix V4L2 frame rate numerator comparison in SDL3 camera
Signed-off-by: Yevgen Abramov <eabramov84@gmail.com>
(cherry picked from commit b09b557fc6)
2025-11-05 10:56:25 -08:00
Anonymous Maarten 148d8c4995 release: don't download pre-release dependencies + strict version parsing
(cherry picked from commit 0da649eb72)
2025-11-04 18:00:48 +01:00
Sam Lantinga 4ae517e24e Removed redundant wait at shutdown in the ALSA audio driver
(cherry picked from commit 97e2951875)
2025-11-02 18:30:35 -08:00
Sam Lantinga 1fd4703907 Save a copy of the D3D12 semantic string
Fixes https://github.com/libsdl-org/SDL/issues/14383

(cherry picked from commit 4db63e323e)
2025-11-02 18:11:23 -08:00
Anonymous Maarten 024221d448 release: sync scripts with main branch
[ci skip]
2025-11-03 00:11:55 +01:00
Sam Lantinga bfe046b60f Clamp the audio drain delay to 100 ms
Fixes https://github.com/libsdl-org/SDL/issues/9829

(cherry picked from commit 0882623092)
2025-11-02 11:16:13 -08:00
Sam Lantinga 1bfa90cb1f Fixed the paddle mapping for Steam Controllers
Fixes https://github.com/libsdl-org/SDL/issues/14380

(cherry picked from commit 3336aa95f1)
2025-11-02 10:07:42 -08:00
bleeqer 0c2e3308a5 Fix NULL pointer dereference in SDL_GlobStorageDirectory
(cherry picked from commit fc6f97f162)
2025-11-02 08:56:14 -08:00
Sam Lantinga 11fc77b704 Fixed the right touchpad calculation for the BLE Steam Controller
Fixes https://github.com/libsdl-org/SDL/issues/14368

(cherry picked from commit eb87a36940)
2025-11-02 08:31:59 -08:00
Arkadiusz Hiler 28af0d58c6 pulseaudio: Match channel map to SDL's chosen order
pa_channel_map_init_auto() with PA_CHANNEL_MAP_WAVEEX does the wrong
thing as it just takes the lest significant bits of
WAVEFORMATEXTENSIBLE's dwChannelMask in order. This doesn't match SDL's
chosen channel ordering.

The implementation here mirrors what we do for PipeWire.

(cherry picked from commit 0d2f081d41)
2025-10-30 13:33:46 -07:00
Sam Lantinga bca544448f Updated to version 3.2.27 for development 2025-10-30 10:18:08 -07:00
Sam Lantinga badbf8da4e Added some missing changes from main for the Android release build 2025-10-30 09:52:18 -07:00
Sam Lantinga b140291cd0 Updated to version 3.2.26 for release 2025-10-30 09:10:42 -07:00
Sam Lantinga 70b12c1b1b Check to see if joysticks are actually initialized in SDL_UpdateJoysticks()
Fixes https://github.com/libsdl-org/SDL/issues/14362

(cherry picked from commit c21b7f8cb8)
2025-10-30 08:54:53 -07:00
Simon McVittie 2bbd74b4b6 wayland: Fix compile with libdecor 0.2 and SDL_WAYLAND_LIBDECOR_SHARED=OFF
libdecor 0.3, which changes the signature of libdecor_new and
libdecor_decorate to use a const pointer to the interface struct, has
not yet been released. In the latest release, libdecor 0.2.4, the
interface struct is a mutable pointer.

This doesn't affect typical upstream builds with
SDL_WAYLAND_LIBDECOR_SHARED=ON, in which case we're casting a pointer
returned by dlsym(); but Linux distributions that want tighter control
over dependencies often prefer to link them in the normal way, in which
case the build will fail if the signature doesn't match.

Fixes: 33834360 "wayland: Fix libdecor incompatible pointer types"
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 8b64dd67d2)
2025-10-30 07:14:49 -07:00
Sam Lantinga add176e538 Make sure we don't allocate a TLS ID clobbering an application defined one
Fixes https://github.com/libsdl-org/SDL/issues/14359

(cherry picked from commit d9ca0457b5)
2025-10-29 14:06:11 -07:00
Sam Lantinga 86384afbcf Fixed the right shoulder button on the 8BitDo Pro 3
(cherry picked from commit cecf4b0d4e)
2025-10-28 14:55:36 -07:00
Sam Lantinga 328f833d51 Added a Linux mapping for the 8BitDo Pro 3
(cherry picked from commit 78f9cb44c3)
2025-10-28 14:14:00 -07:00
Frank Praznik a002a6313e wayland: Fix libdecor incompatible pointer types
(cherry picked from commit 3383436068)
2025-10-28 13:43:46 -04:00
Sam Lantinga 4fc5405f16 Fixed trying to grab the mouse when losing keyboard focus
Fixes https://github.com/libsdl-org/SDL/issues/14350

(cherry picked from commit 2d14a237dc)
2025-10-28 08:20:17 -07:00
Albin Johansson 16d9f7316f Use cast operators in headers to avoid warnings
This avoids compiler warnings when consuming the
headers from C++.

(cherry picked from commit 7381a2b072)
2025-10-25 20:11:48 -07:00
Sam Lantinga 95977f41b7 Perform full rectangle intersection for empty rects
If we don't do that, we leave the x and y values uninitialized.

Fixes https://github.com/libsdl-org/sdl12-compat/issues/365

(cherry picked from commit ffd0ca4391)
2025-10-25 13:50:32 -07:00
DONGGEUN YOO 3302162ede Fix uninitialized length in X11_GetClipboardData causing test failures (#14322)
(cherry picked from commit 093fbfd867)
2025-10-25 07:42:24 -07:00
Sam Lantinga 29f857fed6 Removed SDL_FILE from source code
(cherry picked from commit a402af506c)
2025-10-22 11:11:31 -07:00
Sam Lantinga 492ed877ea Removed __FILE__ from source code
(cherry picked from commit f79ede100b)
2025-10-22 10:49:31 -07:00
Sam Lantinga b1959ecf23 Be more selective when blacklisting controller touchpads
On Android, the PS4 controller is called "Wireless Controller Touchpad"
Fixes https://github.com/libsdl-org/SDL/issues/14294

(cherry picked from commit 999f782ad3)
2025-10-22 10:45:34 -07:00
Anonymous Maarten 928454cbfe cmake: fix typo
INTERFACE_COMPILE_COMPILE_OPTIONS -> INTERFACE_COMPILE_OPTIONS

(cherry picked from commit c5b0187fc9)
2025-10-22 19:01:17 +02:00
Katelyn Gadd 36b306a36c If VULKAN_Submit fails during VULKAN_INTERNAL_CreateTexture, destroy the texture and return NULL
(cherry picked from commit 9479ac039c)
2025-10-20 16:24:32 -07:00
Sylvain 92570af7d3 Fixed bug #14233 - Android fix Android_WaitActiveAndLockActivity() to make sure Android_Paused state is refreshed
(cherry picked from commit e4c60c05bf)
2025-10-19 07:44:15 -07:00
Peter0x44 5a9050aea3 Make D3D math functions static inline to reduce likelihood of linking conflicts
Convert SDL_d3dmath.c functions to static inline in SDL_d3dmath.h to make
it less likely to conflict when static linking SDL. raylib's SDL backend
does not work with a "normal" upstream binary static link. It has these
errors:

/usr/bin/ld: /usr/local/lib64/libSDL3.a(SDL_d3dmath.c.o): in function `MatrixIdentity':
SDL/src/render/SDL_d3dmath.c:35: multiple definition of `MatrixIdentity'; CMakeFiles/raylib.dir/rcore.c.o:rcore.c:(.text+0x18470): first defined here
/usr/bin/ld: /usr/local/lib64/libSDL3.a(SDL_d3dmath.c.o): in function `MatrixMultiply':
SDL/src/render/SDL_d3dmath.c:44: multiple definition of `MatrixMultiply'; CMakeFiles/raylib.dir/rcore.c.o:rcore.c:(.text+0x18540): first defined here
collect2: error: ld returned 1 exit status

It works if these functions aren't emitted, (i.e.
!SDL_VIDEO_RENDER_D3D(11|12|GPU|VULKAN)

Or, if SDL is not linked static. Which I know is preferred anyway.

In raylib's case, it doesn't use this code anyway so it's not a problem
to build it yourself with them disabled. But it's a minor hassle to be
incompatible with static linking libraries from upstream.

I can't see any good reason for these functions to not be static inline
already, so I just put them in the header and deleted the .c.

Raylib's conflicting case is a library with a public function exposed to
users. But SDL's case is not.

- Moved all matrix functions from SDL_d3dmath.c to SDL_d3dmath.h as static inline
- Removed SDL_d3dmath.c from all project files (Visual Studio and Xcode)
- Functions affected: MatrixIdentity, MatrixMultiply, MatrixScaling,
  MatrixTranslation, MatrixRotationX, MatrixRotationY, MatrixRotationZ

(cherry picked from commit 705ced8cf5)
2025-10-14 16:58:04 -07:00
Oleksandr Manenko 3d9f4c3328 Fix thread safety attributes for TryLock functions
Changed SDL_TRY_ACQUIRE and SDL_TRY_ACQUIRE_SHARED success value
from 0 to true for functions that now return bool instead of int.
This fixes false positives/negatives in Clang's thread safety analysis.

(cherry picked from commit 901173aee6)
2025-10-14 12:47:58 -07:00
Sam Lantinga 04ceb2d4a0 Only pass UIPress from game controllers and remotes if the're not open
Fixes https://github.com/libsdl-org/SDL/issues/14080

(cherry picked from commit f844f3e10b)
2025-10-14 12:44:23 -07:00
Sam Lantinga e6987e2452 Fixed emulated touch on Android
This also fixes laser pointer input on Meta Quest headsets

(cherry picked from commit 712ce16469)
2025-10-14 08:40:58 -07:00
Sam Lantinga 4cd6df1997 Added the 8BitDo Ultimate 2C Wireless Controller to the Xbox controller list
Fixes https://github.com/libsdl-org/SDL/issues/14127

(cherry picked from commit 98944ecd0c)
2025-10-13 18:48:05 -07:00
Evan Hemsley 9163913305 GPU: Correctly recycle D3D12 descriptor heaps (#14234)
(cherry picked from commit 20206b8e66)
2025-10-13 13:00:38 -07:00
cosmonaut b3f4ba0725 GPU: Validate that buffer size is at least 4 bytes
(cherry picked from commit b067dfa345)
2025-10-13 11:07:22 -07:00
Brenton Bostick 354bda8dde fill-in missing DeleteLocalRef calls
(cherry picked from commit e584d2a8a9)
2025-10-13 09:28:44 -07:00
Sam Lantinga 8ccbfdf368 Added support for the ZENAIM ARCADE CONTROLLER
(cherry picked from commit 831ec4dc6c)
2025-10-13 08:56:34 -07:00
DominusExult 19b646849c Adding dSYMs (DWARF debug symbols) to the xcFramework.
Needed to generate debug symbols for both release and debug builds and explicitly set the format so all arches actually generate the dSYMs.
This allows distributing an SDL3 app to the AppStore without the need to generate the dSYMs via script when using either the xcFramework or embedding the SDL3 Xcode project.
Fixes #13573

(cherry picked from commit 98c03c644a)
2025-10-13 08:35:25 -07:00
Sam Lantinga 48a83d69cc Corrected texture colors on PS2 (thanks @Trinth!)
Fixes https://github.com/libsdl-org/SDL/issues/12395

(cherry picked from commit 1ed093ad8b)
2025-10-12 09:21:49 -07:00
Gustaf Alhäll ec682cc794 Fix SDL_SetRelativeMouseMode failing with software framebuffer on Haiku
(cherry picked from commit 2c63bc7315)
2025-10-11 09:03:01 -07:00
SDL Wiki Bot d2d655b41f Sync SDL3 wiki -> header
[ci skip]

(cherry picked from commit add18e52c8)
2025-10-09 12:23:30 -07:00
Sam Lantinga d6021b7d89 Only call clipboard callbacks with mime types they expect
Also clarified that returning NULL from a callback sends zero length data to the receiver, which should be able to handle that.

Fixes https://github.com/libsdl-org/SDL/issues/9586

(cherry picked from commit 23e3cbec20)
2025-10-09 12:23:30 -07:00
Sam Lantinga 8dcb6db823 Only return current clipboard data under X11
Fixes https://github.com/libsdl-org/SDL/issues/10192

(cherry picked from commit 9cf7cdf23a)
2025-10-09 12:23:30 -07:00
Sam Lantinga d0cfcf10bb Fixed crash getting clipboard data processing clipboard events on X11
SDL_PumpEvents() was freeing the temporary memory in the clipboard event, so if the application was iterating over the mime types in the event and retrieving the clipboard data, it would crash after the first entry.

(cherry picked from commit 3c0a6c32d4)
2025-10-09 12:23:30 -07:00
Edu Garcia dd791f6838 Fix SDL GPU D3D12 Descriptor Heap leak
When descriptor leaks overflow, the D3D12 SDL GPU renderer fetches more from the pool, but never returns them, which eventually causes an "out of memory" crash.

(cherry picked from commit c74b406a4c)
2025-10-09 08:45:42 -07:00
Sylvain 988714beb9 Fixed bug #14173 - Android / SDL_Renderer Vulkan : going background / foreground produces a black screen.
need to recreate the swap chain + send SDL_EVENT_RENDER_DEVICE_RESET event

(cherry picked from commit 2a96997e90)
2025-10-09 08:41:00 -07:00
Sam Lantinga 78756540cb Recreate the Vulkan GPU swap chain when resuming on Android
Fixes https://github.com/libsdl-org/SDL/issues/12957

(cherry picked from commit 2a92a3c9c5)
2025-10-08 21:09:34 -07:00
Sam Lantinga 205b5c9f44 Ignore invalid width/height in setOrientationBis()
(cherry picked from commit 6f4993ddee)
2025-10-08 20:15:33 -07:00
Sam Lantinga bca30aafed Ignore VK_SUBOPTIMAL_KHR on the Android platform
This is returned whenever the device has been rotated, and can be safely ignored.

Fixes https://github.com/libsdl-org/SDL/issues/12950

(cherry picked from commit 00ffddece8)
2025-10-08 20:04:13 -07:00
Sam Lantinga 840d5c16d2 Temporarily disabled texture binding validation
There are some advanced use cases that trip over this, so temporarily disabling the validation pending further review.

Reference: https://github.com/libsdl-org/SDL/issues/13871
(cherry picked from commit a2a60f75c7)
2025-10-08 19:53:05 -07:00
Sam Lantinga 25b9a686b0 Added the Wooting 60HE keyboard to the controller blacklist
(cherry picked from commit d4b684311e)
2025-10-08 16:06:41 -07:00
Sam Lantinga 54c2f2c3f7 Only call WIN_RoUninitialize() if WIN_RoInitialize() succeeded
Fixes https://github.com/libsdl-org/SDL/issues/14178

(cherry picked from commit 7914bdb7ea)
2025-10-08 13:16:16 -07:00
Sylvain b9cf5f08db Fixed bug #13306 - workaround for android issue "java.lang.NullPointerException android.view.View.onResolvePointerIcon"
(cherry picked from commit 10885f4b7e)
2025-10-08 08:05:36 -07:00
Ozkan Sezer c7a36fa3c9 ci: bump cross-platform-actions.
(cherry picked from commit 97c1df66a8)
2025-10-07 14:28:04 +03:00
Sam Lantinga 73ca5f53e7 Don't treat the Moonlander MK1 Keyboard as a controller
Fixes http://github.com/mgba-emu/mgba/issues/3606

(cherry picked from commit 69791ccad0)
2025-10-06 16:52:36 -07:00
Sam Lantinga 2be2fb4918 Fixed build 2025-10-04 10:28:57 -04:00
Anonymous Maarten fec1dd4a8b release: don't cache ndk + verify arm64 alignment
(cherry picked from commit f4039d0132)
2025-10-03 23:55:13 +02:00
Sam Lantinga 2a3a8f736c Fixed destination coordinates when using scale with the software renderer
Fixes https://github.com/libsdl-org/SDL/issues/14051

(cherry picked from commit d333044462)
2025-10-03 13:58:57 -07:00
Anonymous Maarten d3aff13aa3 cmake: use correct suffix in PkgConfigHelper
(cherry picked from commit 0bbfbf5b37)
2025-10-03 21:03:50 +02:00
Nintorch 54fb312a2c Add blacklist words for gamepad names
(cherry picked from commit 6e6dc500b5)
2025-10-03 09:45:31 -07:00
nmlgc 20aa0ad1c5 testautomation: Test SDL_snprintf() for doubles >LLONG_MAX and <ULLONG_MAX
The uclibc version of SDL_snprintf() is currently limited to values
<ULLONG_MAX due to the `unsigned long long` cast in SDL_PrintFloat(),
but it makes sense to at least ensure that it does support the full
unsigned 64-bit range. This also covers the one defined case where a
32-bit MSVC build can't assume that _ftoul2_legacy() == _ftol2().

(cherry picked from commit 8824eace93)
2025-10-03 07:22:59 -07:00
nmlgc ff667d35f2 SDL_mslibc: Implement _ftoul2_legacy()
cl.exe versions ≥v19.41 call this builtin for double → uint64_t
conversions on x86. SDL currently needs such conversions in:

* MainCallbackRateHintChanged()
* SDL_PrintFloat()
* WIN_ApplyWindowProgress()

This seems enough to justify implementing this function rather than
trying to work around it, as it was done in sdl12-compat:

	https://github.com/libsdl-org/sdl12-compat/issues/352

This implementation was taken from ReactOS:

	https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f637e6b809adb5e0ae420ef4f80c73b19172a2e7

Passes the stdlib testautomation, and also matches the behavior of
Microsoft's 64-bit libc for the currently implementation-defined case
of calling SDL_PrintFloat() with values >SDL_MAX_UINT64.

(cherry picked from commit f39e49a3dd)
2025-10-03 07:22:59 -07:00
nmlgc ff9599fb7e build: Fix typo in SDL_uclibc target name for 32-bit Windows
(cherry picked from commit 7916af9910)
2025-10-03 07:22:59 -07:00
mccakit 0448f20394 replace script with flags
(cherry picked from commit f6e711c377)
2025-10-02 16:01:17 -07:00
mccakit db07924104 static release build fix
(cherry picked from commit 2e4bc73916)
2025-10-02 16:01:17 -07:00
mccakit e60acdc477 android symbol export for release builds
(cherry picked from commit fe92d0a7bd)
2025-10-02 16:01:17 -07:00
Sam Lantinga d69f658835 Make sure the current resolution is in the fullscreen mode list
Custom resolutions don't enumerate normally, but make sure the current resolution is in the mode list.

Fixes https://github.com/libsdl-org/SDL/issues/11551

(cherry picked from commit b1c2dd8433)
2025-10-02 16:01:17 -07:00
Sam Lantinga 3eb9328d3e Updated to version 3.2.25 for development 2025-10-02 11:36:07 -07:00
Sam Lantinga a8589a8422 Updated to version 3.2.24 for release 2025-10-02 10:52:32 -07:00
Simon McVittie 0bdaaf6c76 build: Prefix SDL- to revision from REVISION.txt
This makes it possible to get the version number of an unknown SDL binary
from `strings libSDL3.so.0 | grep SDL-`, like we could for SDL 2.

Resolves: https://github.com/libsdl-org/SDL/issues/14114
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 618b7b6c73)
2025-10-02 09:09:03 -07:00
Simon McVittie 390197d3aa build: Prefix version from git with SDL- rather than SDL3-
We can tell it's SDL 3 from the version number and git revision,
so there's no need to duplicate that in the prefix.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit d5b79418f4)
2025-10-02 09:09:03 -07:00
Mathieu Eyraud 9fafba49dc Zero-initialize SDL_GPUDevice
(cherry picked from commit 86da08b0be)
2025-10-01 07:23:41 -07:00
Victor Ilyushchenko 5d47efe7fb Fix Metal 3D texture upload stride calculation
Signed-off-by: Victor Ilyushchenko <alt13ri@gmail.com>
(cherry picked from commit a34d31322c)
2025-09-28 07:32:48 -07:00
Sam Lantinga 824234accc Fixed HIDAPI controller disconnect reading on multiple threads
If multiple threads are calling SDL_UpdateJoysticks(), then an overlapped read can be initiated on one thread (read_pending set to true) and GetOverlappedResult() called on another thread. This results in ERROR_OPERATION_ABORTED. This is harmless so we shouldn't return an error in this case, we'll just retry the read on the next call.

Fixes https://github.com/libsdl-org/SDL/issues/14033

(cherry picked from commit b2188b325d)
2025-09-25 10:41:52 -07:00
Frank Praznik 6519158ae5 wayland: Ignore bogus libdecor content sizes if an unmapped window is suspended
If a client takes a long time to present the first frame after creating the window, a configure event to set the suspended state may arrive with libdecor increasing the content size by the decoration dimensions, which should be ignored.

(cherry picked from commit 9d5d7010de)
2025-09-24 10:36:04 -04:00
Frank Praznik 00718d60d2 x11: Use the pending size for the min/max limits if a resize is in flight
Otherwise, an outdated size may be used, reverting the requested resize operation.

(cherry picked from commit 45480f5fe5)
2025-09-24 10:36:04 -04:00
Sam Lantinga 18c2e179ee Use the real window position on macOS
On newer MacBooks, the fullscreen window might be placed below the camera notch, so use the actual window position

Fixes https://github.com/libsdl-org/SDL/issues/10441

(cherry picked from commit 0a50058f7a)
2025-09-23 23:04:41 -07:00
Sam Lantinga 21ae008fc2 Use an empty bitmap for the blank cursor on macOS
Some macOS installations seem to have trouble decoding the GIF we were using

Fixes https://github.com/libsdl-org/SDL/issues/14012

(cherry picked from commit 221d1f12ea)
2025-09-22 19:16:01 -07:00
Sam Lantinga 97a8bb44e6 The default swap interval on EGL is 1, according to the spec
Fixes https://github.com/libsdl-org/SDL/issues/14014

(cherry picked from commit 137b0b2bee)
2025-09-22 11:28:46 -07:00
Ryan C. Gordon 5d33fce898 wav: Patched to compile on Visual Studio.
(cherry picked from commit 09ee8876b3)
2025-09-22 08:14:33 -07:00
Ryan C. Gordon bb5df96f69 wav: Clamp DATA chunk to size of file if possible.
Prevents a malicious file from malloc'ing multiple gigabytes.

Fixes #10052.

(cherry picked from commit 44e4deab7c)
2025-09-22 08:14:33 -07:00
Brenton Bostick 12b97944f3 fix: Extra parameter(s) for call to 'getCacheDir()'.
(cherry picked from commit 6590a5bc0b)
2025-09-22 07:25:19 -07:00
Brenton Bostick 0f17fbe1ca fix 'SDL_MessageBoxFlags' is not a valid JVM type.
(cherry picked from commit ed7d39b28c)
2025-09-22 07:05:05 -07:00
Sam Lantinga c3480ca99c Use clearPrimaryClip() on Android 9 and newer
Fixes https://github.com/libsdl-org/SDL/issues/8355

(cherry picked from commit 34b09be6a5)
2025-09-21 23:30:57 -07:00
Sam Lantinga 936d94c2ee Fixed SDL_RunOnMainThread() on Android
If the application is waiting in SDL_WaitEvent(), we still need to run event loop maintenance in between calls to Android_PumpEvents().

Fixes the testautomation events_mainThreadCallbacks() test on Android.

(cherry picked from commit bae34c3e34)
2025-09-21 13:58:51 -07:00
Sam Lantinga 6cb55ebd46 Fixed a memory leak in fill_device_info_usage() (thanks @digant73)
Fixes https://github.com/libsdl-org/SDL/issues/13998

(cherry picked from commit 5503fe1c1b)
2025-09-20 09:05:52 -07:00
Andrei Sabalenka 482c5130eb wayland: fix typo in xdg_positioner_set_anchor_rect
(cherry picked from commit bb2b39b8ea)
2025-09-20 08:54:18 -07:00
Anonymous Maarten 066bcc5204 ci: disable ccache on macOS 13 job
(cherry picked from commit 566e7c2379)
2025-09-17 22:06:16 +02:00
ManifoldFR 21baa27bea gpu/vulkan : fix clear value indexing
(cherry picked from commit 8bc4e029bd)
2025-09-16 08:45:56 -07:00
Sora 93fd4a1c80 fix: use productCategory instead of vendorName for joy name for apple driver
(cherry picked from commit 964bedfdd9)
2025-09-15 11:52:21 -07:00
Ozkan Sezer 7135779599 SDL_endian.h: don't add _m_prefetch hack for clang-cl if available as a builtin
Fixes: https://github.com/libsdl-org/SDL/issues/13952 .

(cherry picked from commit 81f2f44843)
2025-09-15 20:10:28 +03:00
Eddy Jansson 62c151d044 wayland: Silence unused variable warning
'vd' and 'd' are only used if SDL_USE_LIBDBUS is set.

(cherry picked from commit 21c9f5304d)
2025-09-15 10:27:51 -04:00
Sam Lantinga 11d38fc23b Only use a transparent cursor on Windows when connected via RDP
VMware relies on the cursor being set to NULL to optimize relative mouse motion for games.

We should also revisit whether current RDP works better with a NULL cursor or a transparent cursor.

Fixes https://github.com/libsdl-org/SDL/issues/13700

(cherry picked from commit dac6af4ba6)
2025-09-14 17:31:09 -07:00
Sam Lantinga d027f0ae6e Remove Windows 32-bit ARM build from CI
This architecture is deprecated and is now failing with:
Windows SDK 10.0.22621.0 : 'C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um' not found or was incomplete

Fixes https://github.com/libsdl-org/SDL/issues/13949

(cherry picked from commit cc3274b6f1)
2025-09-14 15:45:34 -07:00
Nintorch 44290c204e Fix HP Deluxe Webcam KQ246AA detected as joystick
(cherry picked from commit 556ee00fe3)
2025-09-14 15:40:40 -07:00
Sam Lantinga 0b69860af6 Fixed testprocess on 32-bit Windows
Previously the test would kill the child process while it was in the process of initializing (loading DLLs, etc) and this would cause the test to fail.

(cherry picked from commit 937b7e6aea)
2025-09-14 15:40:06 -07:00
Sam Lantinga e7a1ae0ea5 Clarify why we ignore EINVAL when flushing a file descriptor
(cherry picked from commit a1d3fc1f50)
2025-09-14 15:39:53 -07:00
Sam Lantinga 7af36d6c40 Ignore errors flushing output on POSIX pipes
Fixes https://github.com/libsdl-org/SDL/issues/13116
Fixes https://github.com/libsdl-org/SDL/issues/13412

(cherry picked from commit e40d337a47)
2025-09-14 12:10:18 -07:00
Sam Lantinga d1ae1163dd Wait briefly after enabling effects on DualSense controller
The rumble motors apparently take a short time to power up after enabling enhanced mode.

Fixes https://github.com/libsdl-org/SDL/issues/13909

(cherry picked from commit 1aba421bd3)
2025-09-14 10:00:40 -07:00
Sam Lantinga b2cf5729b4 Disable Windows.Gaming.Input by default
The functionality is already covered by XInput and DirectInput, and Microsoft is recommending GameInput going forward.

Fixes https://github.com/libsdl-org/SDL/issues/13000

(cherry picked from commit 78a29d1670)
2025-09-14 08:52:43 -07:00
Sam Lantinga 11b8dd76db Fixed memory leak when using detached threads
Fixes https://github.com/libsdl-org/SDL/issues/13886

(cherry picked from commit ede86a1267)
2025-09-14 08:43:12 -07:00
Frank Praznik 56507a6122 x11: Use the SDL_WindowFlags type instead of Uint32
Uint32 can potentially truncate the flag value, as it is 64 bits in SDL3.

(cherry picked from commit 4561be89a5)
2025-09-13 15:45:43 -04:00
Evan Hemsley 8d4324cba2 GPU: Bump MAX_COLOR_TARGET_BINDINGS to 8 (#13937)
(cherry picked from commit fe314a1b8a)
2025-09-12 13:38:58 -07:00
Jaan Soulier 35408a2126 Fix reallocation of GPU renderer vertex buffer
(cherry picked from commit ed6a72a7fd)
2025-09-09 20:28:32 -07:00
Sam Lantinga e5b9dfd181 Fixed setting SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER
(cherry picked from commit b7dba970e1)
2025-09-09 17:35:03 -07:00
eafton e8a5d07e5e X11: Check for invalid opcodes in SHM error handler
(cherry picked from commit b59d6d49c3)
2025-09-09 10:59:58 -07:00
Luis Caceres 8c1daf0caf gpu/vulkan: Move dereference after null check
(cherry picked from commit 03d0c2ad74)
2025-09-08 09:50:09 -07:00
Sam Lantinga ad2b211f75 Fixed pitch and chroma issues with the Vulkan planar YUV texture update functions
Fixes https://github.com/libsdl-org/SDL/issues/13734

(cherry picked from commit 466f93aee1)
2025-09-07 10:19:59 -07:00
Sam Lantinga 414ae344af Fixed rumble strength on DualSense Edge and Bluetooth connected controllers
Fixes https://github.com/libsdl-org/SDL/issues/13771

(cherry picked from commit 25d9096d41)
2025-09-06 11:53:55 -07:00
Adrian 71af2c020c Set preferredFrameRateRange in main callbacks CADisplayLink
(cherry picked from commit 01e6aceffc)
2025-09-06 10:13:44 -07:00
Aleksey Melekh e755f50072 xbox: fix build
(cherry picked from commit 129c97f610)
2025-09-05 09:20:34 -07:00
Sam Lantinga a0b8275e9c Fixed the perspective matrix calculation (thanks @KonkolyTamas!)
Fixes https://github.com/libsdl-org/SDL/issues/13867

(cherry picked from commit ea1a769322)
2025-09-04 06:07:28 -07:00
Cameron Cawley ea362839b1 Remove unused PSP source files
(cherry picked from commit 42f571ea4b)
2025-09-03 15:20:00 -07:00
Sam Lantinga e7dd5d841b Don't set SDL_SURFACE_LOCK_NEEDED until a surface is RLE encoded
Reference https://github.com/libsdl-org/sdl2-compat/issues/476

(cherry picked from commit 437d78499c)
2025-09-02 21:32:17 -07:00
Sam Lantinga 5594d03da0 Leave letterbox borders set to the frame clear color
Fixes https://github.com/libsdl-org/sdl2-compat/issues/483

(cherry picked from commit fbbc29159a)
2025-09-02 20:14:56 -07:00
Sam Lantinga f2ae66b64f Set the texture scale and address mode when creating a texture
Fixes https://github.com/libsdl-org/sdl2-compat/issues/506

(cherry picked from commit ef19c72015)
2025-09-02 19:46:28 -07:00
Anonymous Maarten 393d99338f cmake: make SDL_CPU_xxx variable visible when using CMAKE_OSX_ARCHITECTURES
(cherry picked from commit ebb52973e1)
2025-09-02 23:00:10 +03:00
Ozkan Sezer 4d88280931 cmake: simd detection clean-up for Apple multi-arch configs.
(cherry picked from commit 83bb0f9105)
2025-09-02 22:35:32 +03:00
Anonymous Maarten e8cc359b5e cmake: use 'TargetConditionals.h' on Apple for SIMD tests
(cherry picked from commit e15e2808f2)
2025-09-02 22:35:20 +03:00
Anonymous Maarten 3b4a198655 cmake: use APPLE in dep_option
expands to <nothing> on e.g. Windows, which will be interpreted as true by cmake_dependent_option.

(cherry picked from commit 1e7d3b51de)
2025-09-02 22:35:02 +03:00
Ethan Lee 03dd1520a3 gpu: VK_KHR_get_physical_device_properties2 can be optional
(cherry picked from commit 689049f8ec)
2025-09-02 09:53:59 -07:00
Sam Lantinga a6fd74fa3b Fix crash when enumerating Steam Controllers
Closes https://github.com/libsdl-org/SDL/pull/13746
2025-09-02 08:42:16 -07:00
Sam Lantinga 03b36bac94 Updated to version 3.2.23 for development 2025-09-01 15:12:43 -07:00
Sam Lantinga a96677bdf6 Updated to version 3.2.22 for release 2025-09-01 14:40:32 -07:00
Ryan C. Gordon 67f89d0a2b openslES: Patched to compile.
(whoops.)

(cherry picked from commit 7323104f97)
2025-09-01 11:10:33 -04:00
Ryan C. Gordon f6de8877ec openslES: OpenSL ES on Android only supports two formats, limit to that.
(Three with the floating point extension, which we use.)

This is according to:

https://developer.android.com/ndk/guides/audio/opensl/opensl-for-android

Previously, this would accept a request for Sint8 or Sint32 and disaster
would ensue.

Fixes #13779.

(cherry picked from commit 0b2a003a35)
2025-09-01 10:31:05 -04:00
Ozkan Sezer 7c189b1f17 cmake: revert commit 5d1bbd9 and change sse4.2 test
clang doesn't support -mcrc32 until version 14.0, therefore drop -mcrc32
use in sse 4.2 test, and change it to check _mm_cmpgt_epi64() instead of
_mm_crc32_u32(). without this, sse4.2 check was failing with clang <= 13

Fixes https://github.com/libsdl-org/SDL/pull/12223

(cherry picked from commit 875653658a)
2025-08-31 03:20:40 +03:00
Sam Lantinga a7947080c0 Fixed warnings building with Visual Studio
(cherry picked from commit 7c8df4ea52)
2025-08-30 10:16:11 -07:00
Sam Lantinga 08c82a3781 Fixed build
(cherry picked from commit 3cf2350f21)
2025-08-30 10:15:48 -07:00
Jordan Saunders 589aea50c2 Fix two uninitialized variables
Found when running in valgrind looking at another issue.

- RenderPass' depth_stencil_target
    Tripped in SDL_BindGPUFragmentSamplers when not binding a DS target

- VulkanCommandBuffer's swapchainRequested
    Tripped in VULKAN_Submit for the end transition barrier when
    creating an image. The field is only reset when reused, not on first
    use

(cherry picked from commit 265236d952)
2025-08-30 06:05:43 -07:00
Ozkan Sezer 72acd7c9df CI: add OpenBSD workflow
(cherry picked from commit c0e5fd55d2)
2025-08-30 14:22:24 +03:00
Frank Praznik 1a70d1158e fs: Fix OpenBSD path retrieval
Set the path start pointer to point to a valid string.

(cherry picked from commit fdfde42db1)
2025-08-30 14:21:24 +03:00
Frank Praznik ae915c6516 wayland: Add a sigtimedwait() implementation for OpenBSD
sigtimedwait() is an optional part of POSIX.1-2001, and OpenBSD doesn't implement it. Add a replacement implementation based on https://comp.unix.programmer.narkive.com/rEDH0sPT/sigtimedwait-implementation

(cherry picked from commit 1049426a76)
2025-08-30 14:21:00 +03:00
Xander 54d573332e Add SDL_SENSOR_COUNT to SDL_SensorType
(cherry picked from commit dc7a3a1219)
2025-08-29 07:31:25 -07:00
Matthew Zavislak 0204a69f6b Add elf alignment check for Android artifacts (#13818)
(cherry picked from commit 4f11feb708)
2025-08-28 16:31:25 -07:00
Susko3 b2689ff76a Avoid checking for HAVE_POSIX_SPAWN on Android
This makes the CMake build closer to SDL_build_config_android.h
as both will now use SDL_PROCESS_DUMMY.

(cherry picked from commit cd21bbe796)
2025-08-28 04:10:16 -07:00
Ozkan Sezer 611940fb80 cmake: fall back to -Wconversion if -Wfloat-conversion isn't available
... during checks for valid isinf/isinff/isnan/isnanf macros.

(cherry picked from commit 98bed62259)
2025-08-27 22:20:37 +03:00
Nintorch 16c0329a2a Add Emscripten joystick rumble support
Adds support for Emscripten (Web) joystick rumble support via EM_ASM_INT macros and HTML5's Gamepad API.

(cherry picked from commit 1fbed16cb0)
2025-08-25 12:59:15 -07:00
Nintorch 2743716132 Allow Android to ignore unnecessary joysticks
Previously, SDL_ShouldIgnoreJoystick wasn't being called for Android, and fingerprint sensors were recognized as joysticks.

(cherry picked from commit 1af7dfb0a7)
2025-08-25 11:23:34 -07:00
Colin Kinloch a744eee993 testffmpeg: avutil queue family version check
The `AVVulkanDeviceQueueFamily` struct was introduced by libavutil
59.34.100

(cherry picked from commit 81920b5db7)
2025-08-25 11:10:31 -07:00
Evan Hemsley 0e24267eb5 gpu: D3D12 only requires feature level 11_0 with Resource Binding Tier 2. (#13782)
We previously thought this wasn't possible because constant buffer offsets and
partial updates were unavailable, but we were reading the wrong table - this is
only the case for D3D11...

https://learn.microsoft.com/en-us/windows/win32/direct3d11/overviews-direct3d-11-devices-downlevel-intro

... while 12 doesn't list this feature at all:

https://learn.microsoft.com/en-us/windows/win32/direct3d12/hardware-feature-levels

We double checked and Jesse Natalie confirmed that this feature is required for
D3D12 even for 11_0 drivers. (Thanks Jesse!)

Additionally, D3D12 requires that UAVs are accessible from all shader stages,
meaning Tier 2 is enough to support the number of UAVs we need. Tier 1 could be
a property to lower the requirements, but that can be done later.
2025-08-22 14:07:58 -07:00
Wilson Jallet f4d6043aa4 GPU: Fix Vulkan indexing error for resolve attachment refs (#13768)
(cherry picked from commit 03b14f5211)
2025-08-19 12:13:23 -07:00
Petar Popovic 9fb9bd31a3 emscripten tests: fix warning: uninitialized variable
(cherry picked from commit 45feacf608)
2025-08-13 17:01:31 -07:00
ChaseKnowlden c3828bb0a3 Keep MSVC Flags Consistent across CMake runs
(cherry picked from commit 10478c59db)
2025-08-12 19:39:44 -07:00
Sam Lantinga 40371f0907 Support the "ambient" value for SDL_HINT_AUDIO_CATEGORY
Fixes https://github.com/libsdl-org/SDL/issues/13732

(cherry picked from commit 4725213eef)
2025-08-12 09:54:43 -07:00
Sylvain 94f9434564 Fixed bug #13493: Assertion failure at SDL_AddTouch with Android API 28
Java touch id should be -1 because it's reserved for internal SDL
synthetic events.
It should also not be 0, because this is SDL invalid value.

(cherry picked from commit 970c0bfe96)
2025-08-12 09:44:04 -07:00
Chase Knowlden bfaf247d30 Update NDK version to 28 (#13729)
* Update NDK version to 28 and add 16kb page size linker flags to x86_64

* Remove Android Linker Options

16kb page size is now the default since NDK r28c

* Update Android CI to use NDK 28

(cherry picked from commit 6e422e5ff2)
2025-08-12 07:46:27 -07:00
Beyley Cardellio 2287c43b59 GPU: Hold submit lock before waiting for device idle
(cherry picked from commit e699f3dca1)
2025-08-10 07:22:19 -07:00
Petar Popovic 15cc0f5f91 linux/SDL_syshaptic.c:SDL_SYS_HapticStopAll(): Fix return on error
(cherry picked from commit 43f3991398)
2025-08-09 09:28:02 -07:00
Anonymous Maarten 68e0108b1c release: build aarch64 libraries with 16kiB page size
[ci skip]

(cherry picked from commit 7017fbaa8e)
2025-08-09 05:23:43 +02:00
Mohamed Shazan 7b3796bc39 SDL_TriggerBreakpoint() will default to __debugbreak() on MinGW toolchain on windows
(cherry picked from commit f4c124e4bf)
2025-08-08 16:21:15 -07:00
Petar Popovic b5bc6d2cc4 SDL_SendJoystickVirtualSensorDataInner(): Fix max_sensor_events increment
(cherry picked from commit d9c20cfd0a)
2025-08-08 12:52:03 -07:00
Petar Popovic 0d1d4ea1f9 SDL_SetRenderDrawBlendMode(): Remove redundant param check
(cherry picked from commit b63c32e790)
2025-08-08 14:06:27 -04:00
Pino Toscano 1a48f897f2 ime: fcitx: use SDL_GetExeName() in GetAppName()
Use the existing SDL_GetExeName(), available for all the UNIX
platforms, in the internal GetAppName(); this has few advantanges:
- SDL_GetExeName() (and SDL_GetAppID() that builds on top of it) are
  used in various places already; since it caches the executable name,
  this may remove one extra read of the application name
- SDL_GetExeName() has a non-dummy implementation in more OSes than
  GetAppName(), thus providing a small improvement for this IME

As drive-by change: since SDL_GetExeName() provides a constant string,
there is no more need to allocate a new string in GetAppName(), which
is used as constant string anyway. Hence, return a constant string in
GetAppName() too.

(cherry picked from commit 248bcf6b29)
2025-08-07 13:58:27 -07:00
Simon McVittie 2b42789de6 Fix some typos detected by Debian's lintian QA tool
I assume the demoninator is a typo, rather than an indication that
someone has been playing too much Doom :-)

Signed-off-by: Simon McVittie <smcv@collabora.com>

(cherry picked from commit d83503f80e)
2025-08-07 13:55:44 -07:00
Simon McVittie b9c1da10ba hints: Rephrase documentation to improve grammar
"This thing allows to do something" is not really grammatically correct.
The closest rephrasing would be "allows one to do something" or "allows
the user to do something", but I think the passive voice reads more
naturally here.

Detected by Debian's lintian QA tool.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 40b941c826)
2025-08-07 13:55:44 -07:00
cosmonaut 56f5a76696 GPU: Fix uninitialized value in Vulkan command buffer structure
(cherry picked from commit fe6b2161bf)
2025-08-07 13:42:16 -07:00
Sam Lantinga c7e8977e60 Revert "Support Google Play 16 KB Page Size Requirement (#13470)"
This reverts commit edef6e66e9

If you need to support the Google Play 16 kiB page size requirement, the recommendation is to use NDK r28c or newer, which automatically aligns binaries correctly.
2025-08-07 11:41:43 -07:00
Pino Toscano e6ba3612db SDL_endian.h: extend Linux way for GNU libc
The currently used way to determine the endianness (i.e. include
<endian.h> and use the __BYTE_ORDER macro) is provided in general by
GNU libc. Thus, extend that to any platform/OS based on GNU libc.

(cherry picked from commit 561c99ee11)
2025-08-06 16:13:44 -07:00
Frank Praznik 5e77fb314c win32: Use the current flags to determine if NCCALCSIZE is required
SDL_GetWindowFlags() also ORs in pending flags, whereas the current state is needed here, particularly when creating/showing a window.

(cherry picked from commit cd0c660dea)
2025-08-05 18:49:41 -04:00
Frank Praznik 1a2841deb1 win32: Use STYLE_BORDERLESS when showing a pending fullscreen window
In addition to hiding the border on bordered windows that will immediately become fullscreen, The combination of flags used in STYLE_BORDERLESS_WINDOWED will still show the borders on borderless windows if the initial window size exactly matches the desktop, so STYLE_BORDERLESS must be used instead.

(cherry picked from commit 90a023007f)
2025-08-05 15:59:06 -04:00
Mathieu Eyraud 688637eca8 Fix condition for setting HDR properties
(cherry picked from commit a05aca51ec)
2025-08-05 09:26:12 -07:00
Frank Praznik 85d1d70ca1 cocoa: Wait for fullscreen spaces transitions to complete if switching to an exclusive mode
If attempting to switch to an exclusive mode while a fullscreen spaces transition is active, wait until the transition is complete before trying to apply the changes, or the window can wind up in a weird, broken state if a mode switch occurs while in a fullscreen space.

(cherry picked from commit f44a98729c)
2025-08-05 12:17:01 -04:00
Frank Praznik 09356c709a Revert "cocoa: Don't re-enter a fullscreen space if leaving to enter an exclusive mode"
This reverts commit 07b9e86d02.

It turns out that the problem is elsewhere, related to needing to block mode changes until spaces transitions are complete.
2025-08-04 23:51:47 -04:00
Frank Praznik 07b9e86d02 cocoa: Don't re-enter a fullscreen space if leaving to enter an exclusive mode
Doing so can leave the window in a weird, offset state.

(cherry picked from commit ee8f2861e7)
2025-08-04 22:16:22 -04:00
Sam Lantinga 8e46e5d8b4 Updated to version 3.2.21 for development 2025-08-04 11:54:34 -07:00
Sam Lantinga 96292a5b46 Updated to version 3.2.20 for release 2025-08-04 09:58:55 -07:00
Petar Popovic ffa618c00b SDL_LoadWAV_IO(): On error, set *audio_buf to NULL and *audio_len to 0
(cherry picked from commit 23e08f7807)
2025-08-03 13:44:37 -04:00
Petar Popovic 291b9b3c82 SDL_enabled_assert(): Use NULL istead of 0 to explicity initialize the pointer members of SDL_AssertData
(cherry picked from commit faf3bd9991)
2025-08-03 13:36:14 -04:00
Frank Praznik ec45117f0f x11: Filter mouse wheel events from "Master" devices
Discard wheel events from "Master" devices to avoid duplicates, as wheel events are stateless and can't be deduplicated.

(cherry picked from commit 51ce3f8c8d)
2025-08-02 18:57:44 -04:00
Frank Praznik 0d7aff9c56 GPU: Vulkan backend flags command buffer for cleanup when swapchain is requested
When skipping presentation due to the window being hidden, presentDataCount is not incremented on the command buffer, and subsequently the submitted command buffers will not be cleaned up as long as the window is hidden. This results in a lag spike when showing the window due to all previously submitted command buffers suddenly being cleaned up at once, and lag at shutdown due to an equivalent number of fences needing to be destroyed.

Instead of relying on presentDataCount to determine whether a command buffer should be cleaned up, use a flag, which is set under the appropriate circumstances.

(cherry picked from commit 42463569d5)
2025-08-02 09:24:21 -07:00
Petar Popovic d31b239288 Fix double-free warning in src/hidapi/linux/hid.c
(cherry picked from commit ae5ce258cf)
2025-08-02 07:09:12 -07:00
capehill b1cadf0e99 Fix SDL_BlitSurfaceScaled crash
SDL_BlitSurfaceScaled could crash when passed large coordinates, due
to final_dst.w or final_dst.h getting negative values.

(cherry picked from commit 1c5c3b1479)
2025-08-01 09:22:38 -07:00
Frank Praznik c1f67585e6 wayland: Cleanup an outdated conditional and comment
There may have been a reason for not attaching a null buffer when destroying a popup at some point in the past, but that is unnecessary now, as is the comment about ShowWindow crashing, as ShowWindow assures that a null buffer is attached before (re)creating the window.

(cherry picked from commit 550d95e04f)
2025-08-01 10:40:32 -04:00
A1029384756 93988e28c0 wayland: reorder surface destruction to avoid premature blanking
(cherry picked from commit 9034375d2f)
2025-08-01 10:40:32 -04:00
Matthew Zavislak edef6e66e9 Support Google Play 16 KB Page Size Requirement (#13470)
- See: https://developer.android.com/guide/practices/page-sizes#update-packaging
- Also, make min API uniform at 21 (from 16 and 23 in a few places)

(cherry picked from commit dc2c83c383)
2025-07-31 16:21:02 -07:00
Petar Popovic e3f47809c4 Fix potential memory leak in SDL_render_gles2.c
(cherry picked from commit 09221820f6)
2025-07-31 16:19:10 -07:00
cosmonaut f759e7ac59 GPU: Bail out of aquiring Vulkan swapchain if window is hidden
(cherry picked from commit c5edf4bd5b)
2025-07-31 16:03:19 -07:00
Frank Praznik 544eb2c5a9 wayland: Adjust popup adjoining check
The previous calculation could result in a window whose original position was positioned exactly corner-to-corner with the parent not being adjusted to be adjoining, and thus subject to spurious closure.

(cherry picked from commit b0cdb7143f)
2025-07-31 12:13:54 -04:00
Cheney Wang 30e3eba20a GPU: Fix wrong Vulkan swapchain size when retrying acquire
(cherry picked from commit d8ac51859e)
2025-07-30 15:35:23 -07:00
Wouter Wijsman f0e85a2a9c psp: fix audio not playing
(cherry picked from commit 3d1a28ccf2)
2025-07-30 13:11:23 -07:00
Thaddeus Crews 106af5b46a Define relevant macros when LACKS_ERRNO_H is true
(cherry picked from commit 3195980b49)
2025-07-30 09:11:22 -07:00
Stefan Schlosser 522716ed90 SDL_getenv.c: fix dynamic loading of environ symbol on FreeBSD
The current implementation uses the returned address of the `dlsym` function
directly to load the `environ` symbol. But this function doesn't return the
address to the symbol itself, instead it returns the address to the location
where the actual address is stored, i.e. it's an additional indirection.
Consequently, the implementation fails to load and process the environment
variables successfully.

One example where this error shows up is in the `Dialog API`: in an `X11`
environment, the `zenity` driver requires access to the user's `DISPLAY` and
`XAUTHORITY` environment variables. Because these variables aren't transfered
to the `zenity` process, no dialogs are shown. This can be exercised in the
`test/testdialog.c` testprogram.

The fix changes the indirection level of the `dlsym` call from `char **` to
`char ***`, does a `NULL`-check in case the call failed, and returns the
dereferenced actual adress to the `environ` symbol.

(cherry picked from commit 10458f2cac)
2025-07-30 07:06:54 -07:00
Evan Hemsley a65fbb0211 GPU: Fix incorrect block size when D3D12 uniform buffer is rotated (#13469)
(cherry picked from commit 07af4b237b)
2025-07-29 15:51:58 -07:00
Petar Popovic 46ec859bd1 Fix two use-after-free warnings
(cherry picked from commit f27dbb22f0)
2025-07-29 12:29:34 -07:00
Xen 2a7aa4eae4 Update SDL_clipboard.h
Typo fixes and a small addition to SDL_SetClipboardData about mime_type list usage clarity.

(cherry picked from commit b3ba1c159e)
2025-07-28 11:59:34 -07:00
Dan Andrus c31ddf021e Check NSWindow::isVisible before sending SDL_WINDOWEVENT_RESTORED during Cocoa_WindowListener::windowDidResize
(cherry picked from commit 30f0aeb26a)
2025-07-28 14:47:45 -04:00
Shootfast eaa2a8239f Fixed typo in SDL_scancode.h
The backslash/vertical line key is between the left shift and "Z" key on ISO keyboards

(cherry picked from commit 507ee033cc)
2025-07-27 19:58:45 -07:00
Brenton Bostick d313ecb737 Fix warning on Android arm-v7
Building SDL for armeabi-v7a gives this warning:
```
SDL/src/audio/SDL_audiotypecvt.c:541:14: warning: '#pragma FENV_ACCESS' is not supported on this target - ignored [-Wignored-pragmas]
  541 | #pragma STDC FENV_ACCESS ON
```

(cherry picked from commit ed4de7aeed)
2025-07-27 08:16:21 -07:00
Petar Popovic 64b2af0340 SDL_gpu.c: Fixed deref-before-check warning
(cherry picked from commit 6a5af95364)
2025-07-26 12:08:57 -07:00
Anonymous Maarten 58d0702948 ci+n3ds: avoid apt-get package manager
- use Unix Makefiles (with parallelization) CMake generator
- use binutils strings binary from devkitpro

(cherry picked from commit e6d200e51c)
2025-07-26 16:06:36 +02:00
Sam Lantinga 707717e94b Reverted: Added Steam Virtual Gamepad support to the GameInput driver
This version of SDL doesn't support newer GameInput versions required for this feature.
2025-07-24 14:00:20 -07:00
Sam Lantinga a140bba55a Fixed building with GameInput v1.0
(cherry picked from commit e5d57d8ad6)
2025-07-24 10:52:28 -07:00
Sam Lantinga f4ddacacd0 Fixed building with GameInput v1.0
(cherry picked from commit 0ee0fe1572)
2025-07-24 10:43:05 -07:00
Sam Lantinga ebba656bdb Added Steam Virtual Gamepad support to the GameInput driver
(cherry picked from commit 66dad9c21f)
2025-07-24 10:38:02 -07:00
Sam Lantinga b78c61d67a Fixed double SDL_EVENT_GAMEPAD_ADDED for controllers with automatic gamepad mappings
(cherry picked from commit 6babade758)
2025-07-24 10:38:02 -07:00
L zard 4210aa61e1 build_config_windows: define HAVE_STDARG/STDDEF_H outside of
condition.
They are defined in both `#if HAVE_LIBC` and its `#else` anyway.
[sdl-ci-filter msvc-*]

(cherry picked from commit ea995b1694)
2025-07-21 14:45:19 -07:00
L zard d8a345d924 build_config_windows: fix HAVE_VSSCANF defined regardless of MSVC version.
[sdl-ci-filter msvc-*]

(cherry picked from commit a977a11fa6)
2025-07-21 14:45:19 -07:00
Acclution b8dc9767da GPU: Fix Vulkan compute uniform descriptor not being marked as set (#13389)
(cherry picked from commit 8bd29f7ca3)
2025-07-18 15:30:05 -07:00
BurntRanch 1ab01b9367 Clarify SDL_GPUVertexBufferDescription.pitch comment (#13381)
(cherry picked from commit ee6d8f78f4)
2025-07-17 08:55:04 -07:00
Sam Lantinga ee371ff740 Fixed crash if a clipboard event was sent with video uninitialized
This can happen if you're using SDL on Android without using the video subsystem.

(cherry picked from commit 855d28e97a)
2025-07-17 08:48:00 -07:00
Evan Hemsley ef58dd77ca GPU: Clean up properties in SDL_ReleaseGPUTexture (#13378) 2025-07-17 00:23:52 -07:00
Ryan C. Gordon e6a7121904 audio: Binding an SDL_AudioStream will set missing formats.
It _must_ have the format set for the opposite side from the device (so
playback needs the src format set, and recording needs the dst format set),
since the stream gets mangled by the device thread if not. So if it has never
been set (stream created with NULL audiospec), just set it to match the device.
If the stream is just meant to buffer and not convert, this is desired
behavior, even if it didn't also fix a bug.

Binding the audio stream will always set the device side's format, as usual;
this does not need to be set by the caller at all.

Fixes #13363.

(cherry picked from commit f2ae6503c0)
2025-07-15 06:44:12 -04:00
Sam Lantinga a6ed8ab59d Updated to version 3.2.19 for development 2025-07-14 11:44:22 -07:00
Sam Lantinga bd40d0ded1 Removed the Mayflash GameCube adapter from the PS3 controller list
(cherry picked from commit 277f91c317)
2025-07-14 11:30:46 -07:00
160 changed files with 2490 additions and 1091 deletions

No files matched your search

+29 -13
View File
@@ -20,7 +20,6 @@ class AppleArch(Enum):
class MsvcArch(Enum):
X86 = "x86"
X64 = "x64"
Arm32 = "arm"
Arm64 = "arm64"
@@ -31,7 +30,9 @@ class JobOs(Enum):
Ubuntu22_04 = "ubuntu-22.04"
Ubuntu24_04 = "ubuntu-24.04"
Ubuntu24_04_arm = "ubuntu-24.04-arm"
Macos13 = "macos-13"
Macos14 = "macos-14" # macOS Sonoma (2023)
Macos15 = "macos-15" # macOS Sequoia (2024)
Macos26 = "macos-26" # macOS Tahoe (2025)
class SdlPlatform(Enum):
@@ -54,6 +55,7 @@ class SdlPlatform(Enum):
Riscos = "riscos"
FreeBSD = "freebsd"
NetBSD = "netbsd"
OpenBSD = "openbsd"
class Msys2Platform(Enum):
@@ -108,7 +110,6 @@ JOB_SPECS = {
"msvc-x86": JobSpec(name="Windows (MSVC, x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x86", msvc_arch=MsvcArch.X86, msvc_project="VisualC/SDL.sln", ),
"msvc-clang-x64": JobSpec(name="Windows (MSVC, clang-cl x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x64", msvc_arch=MsvcArch.X64, clang_cl=True, ),
"msvc-clang-x86": JobSpec(name="Windows (MSVC, clang-cl x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x86", msvc_arch=MsvcArch.X86, clang_cl=True, ),
"msvc-arm32": JobSpec(name="Windows (MSVC, ARM)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm32", msvc_arch=MsvcArch.Arm32, ),
"msvc-arm64": JobSpec(name="Windows (MSVC, ARM64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm64", msvc_arch=MsvcArch.Arm64, ),
"msvc-gdk-x64": JobSpec(name="GDK (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-GDK", msvc_arch=MsvcArch.X64, msvc_project="VisualC-GDK/SDL.sln", gdk=True, no_cmake=True, ),
"ubuntu-22.04": JobSpec(name="Ubuntu 22.04", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04", ),
@@ -116,7 +117,7 @@ JOB_SPECS = {
"steamrt-sniper": JobSpec(name="Steam Linux Runtime (Sniper)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Linux, artifact="SDL-slrsniper", container="registry.gitlab.steamos.cloud/steamrt/sniper/sdk:beta", ),
"ubuntu-intel-icx": JobSpec(name="Ubuntu 22.04 (Intel oneAPI)", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04-oneapi", intel=IntelCompiler.Icx, ),
"ubuntu-intel-icc": JobSpec(name="Ubuntu 22.04 (Intel Compiler)", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04-icc", intel=IntelCompiler.Icc, ),
"macos-framework-x64": JobSpec(name="MacOS (Framework) (x64)", os=JobOs.Macos13, platform=SdlPlatform.MacOS, artifact="SDL-macos-framework", apple_framework=True, apple_archs={AppleArch.Aarch64, AppleArch.X86_64, }, xcode=True, ),
"macos-framework-x64": JobSpec(name="MacOS (Framework) (x64)", os=JobOs.Macos14, platform=SdlPlatform.MacOS, artifact="SDL-macos-framework", apple_framework=True, apple_archs={AppleArch.Aarch64, AppleArch.X86_64, }, xcode=True, ),
"macos-framework-arm64": JobSpec(name="MacOS (Framework) (arm64)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact=None, apple_framework=True, apple_archs={AppleArch.Aarch64, AppleArch.X86_64, }, ),
"macos-gnu-arm64": JobSpec(name="MacOS (GNU prefix)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact="SDL-macos-arm64-gnu", apple_framework=False, apple_archs={AppleArch.Aarch64, }, ),
"ios": JobSpec(name="iOS (CMake & xcode)", os=JobOs.MacosLatest, platform=SdlPlatform.Ios, artifact="SDL-ios-arm64", xcode=True, ),
@@ -137,6 +138,7 @@ JOB_SPECS = {
"vita-pvr": JobSpec(name="Sony PlayStation Vita (GLES w/ PVR_PSP2)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Vita, artifact="SDL-vita-pvr", container="vitasdk/vitasdk:latest", vita_gles=VitaGLES.Pvr, ),
"riscos": JobSpec(name="RISC OS", os=JobOs.UbuntuLatest, platform=SdlPlatform.Riscos, artifact="SDL-riscos", container="riscosdotinfo/riscos-gccsdk-4.7:latest", ),
"netbsd": JobSpec(name="NetBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.NetBSD, artifact="SDL-netbsd-x64", ),
"openbsd": JobSpec(name="OpenBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.OpenBSD, artifact="SDL-openbsd-x64", ),
"freebsd": JobSpec(name="FreeBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.FreeBSD, artifact="SDL-freebsd-x64", ),
}
@@ -174,6 +176,7 @@ class JobDetails:
brew_packages: list[str] = dataclasses.field(default_factory=list)
cmake_toolchain_file: str = ""
cmake_arguments: list[str] = dataclasses.field(default_factory=list)
cmake_generator: str = "Ninja"
cmake_build_arguments: list[str] = dataclasses.field(default_factory=list)
clang_tidy: bool = True
cppflags: list[str] = dataclasses.field(default_factory=list)
@@ -222,6 +225,7 @@ class JobDetails:
check_sources: bool = False
setup_python: bool = False
pypi_packages: list[str] = dataclasses.field(default_factory=list)
binutils_strings: str = "strings"
def to_workflow(self, enable_artifacts: bool) -> dict[str, str|bool]:
data = {
@@ -255,6 +259,7 @@ class JobDetails:
"cflags": my_shlex_join(self.cppflags + self.cflags),
"cxxflags": my_shlex_join(self.cppflags + self.cxxflags),
"ldflags": my_shlex_join(self.ldflags),
"cmake-generator": self.cmake_generator,
"cmake-toolchain-file": self.cmake_toolchain_file,
"clang-tidy": self.clang_tidy,
"cmake-arguments": my_shlex_join(self.cmake_arguments),
@@ -289,6 +294,7 @@ class JobDetails:
"check-sources": self.check_sources,
"setup-python": self.setup_python,
"pypi-packages": my_shlex_join(self.pypi_packages),
"binutils-strings": self.binutils_strings,
}
return {k: v for k, v in data.items() if v != ""}
@@ -403,10 +409,6 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
job.msvc_vcvars_arch = "x64_x86"
case MsvcArch.X64:
job.msvc_vcvars_arch = "x64"
case MsvcArch.Arm32:
job.msvc_vcvars_arch = "x64_arm"
job.msvc_vcvars_sdk = "10.0.22621.0" # 10.0.26100.0 dropped ARM32 um and ucrt libraries
job.run_tests = False
case MsvcArch.Arm64:
job.msvc_vcvars_arch = "x64_arm64"
job.run_tests = False
@@ -514,9 +516,10 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
job.ccache = True
job.apt_packages = []
job.brew_packages.extend((
"ccache",
"ninja",
))
if job.ccache:
job.brew_packages.append("ccache")
if job.clang_tidy:
job.brew_packages.append("llvm")
if spec.xcode:
@@ -550,6 +553,10 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
"testmultiaudio-apk",
"testsprite-apk",
]
# -fPIC is required after updating NDK from 21 to 28
job.cflags.append("-fPIC")
job.cxxflags.append("-fPIC")
case SdlPlatform.Emscripten:
job.clang_tidy = False # clang-tidy does not understand -gsource-map
job.shared = False
@@ -675,13 +682,16 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
job.shared_lib = SharedLibType.SO_0
job.static_lib = StaticLibType.A
case SdlPlatform.N3ds:
job.ccache = True
job.cmake_generator = "Unix Makefiles"
job.cmake_build_arguments.append("-j$(nproc)")
job.ccache = False
job.shared = False
job.apt_packages = ["ccache", "ninja-build", "binutils"]
job.apt_packages = []
job.clang_tidy = False
job.run_tests = False
job.cc_from_cmake = True
job.cmake_toolchain_file = "${DEVKITPRO}/cmake/3DS.cmake"
job.binutils_strings = "/opt/devkitpro/devkitARM/bin/arm-none-eabi-strings"
job.static_lib = StaticLibType.A
case SdlPlatform.Msys2:
job.ccache = True
@@ -713,7 +723,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
))
job.cmake_toolchain_file = "/home/riscos/env/toolchain-riscos.cmake"
job.static_lib = StaticLibType.A
case SdlPlatform.FreeBSD | SdlPlatform.NetBSD:
case SdlPlatform.FreeBSD | SdlPlatform.NetBSD | SdlPlatform.OpenBSD:
job.cpactions = True
job.no_cmake = True
job.run_tests = False
@@ -723,7 +733,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
match spec.platform:
case SdlPlatform.FreeBSD:
job.cpactions_os = "freebsd"
job.cpactions_version = "14.2"
job.cpactions_version = "14.3"
job.cpactions_arch = "x86-64"
job.cpactions_setup_cmd = "sudo pkg update"
job.cpactions_install_cmd = "sudo pkg install -y cmake ninja pkgconf libXcursor libXext libXinerama libXi libXfixes libXrandr libXScrnSaver libXxf86vm wayland wayland-protocols libxkbcommon mesa-libs libglvnd evdev-proto libinotify alsa-lib jackit pipewire pulseaudio sndio dbus zh-fcitx ibus libudev-devd"
@@ -737,6 +747,12 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
job.cpactions_arch = "x86-64"
job.cpactions_setup_cmd = "export PATH=\"/usr/pkg/sbin:/usr/pkg/bin:/sbin:$PATH\"; export PKG_CONFIG_PATH=\"/usr/pkg/lib/pkgconfig\";export PKG_PATH=\"https://cdn.netBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r|cut -f \"1 2\" -d.)/All/\";echo \"PKG_PATH=$PKG_PATH\";echo \"uname -a -> \"$(uname -a)\"\";sudo -E sysctl -w security.pax.aslr.enabled=0;sudo -E sysctl -w security.pax.aslr.global=0;sudo -E pkgin clean;sudo -E pkgin update"
job.cpactions_install_cmd = "sudo -E pkgin -y install cmake dbus pkgconf ninja-build pulseaudio libxkbcommon wayland wayland-protocols libinotify libusb1"
case SdlPlatform.OpenBSD:
job.cpactions_os = "openbsd"
job.cpactions_version = "7.7"
job.cpactions_arch = "x86-64"
job.cpactions_setup_cmd = "sudo pkg_add -u"
job.cpactions_install_cmd = "sudo pkg_add cmake ninja pkgconf wayland wayland-protocols libxkbcommon libinotify pulseaudio dbus ibus"
case _:
raise ValueError(f"Unsupported platform={spec.platform}")
+15 -7
View File
@@ -75,8 +75,8 @@ jobs:
if: ${{ matrix.platform.android-ndk }}
id: setup-ndk
with:
local-cache: true
ndk-version: r21e
local-cache: false
ndk-version: r28c
- name: 'Configure Android NDK variables'
if: ${{ matrix.platform.android-ndk }}
shell: sh
@@ -201,7 +201,7 @@ jobs:
#shell: ${{ matrix.platform.shell }}
run: |
${{ matrix.platform.source-cmd }}
${{ matrix.platform.cmake-config-emulator }} cmake -S . -B build -GNinja \
${{ matrix.platform.cmake-config-emulator }} cmake -S . -B build -G "${{ matrix.platform.cmake-generator }}" \
-Wdeprecated -Wdev -Werror \
${{ matrix.platform.cmake-toolchain-file != '' && format('-DCMAKE_TOOLCHAIN_FILE={0}', matrix.platform.cmake-toolchain-file) || '' }} \
-DSDL_WERROR=${{ matrix.platform.werror }} \
@@ -232,9 +232,9 @@ jobs:
run: |
echo "This should show us the SDL_REVISION"
echo "Shared library:"
${{ (matrix.platform.shared-lib && format('strings build/{0} | grep "Github Workflow"', matrix.platform.shared-lib)) || 'echo "<Shared library not supported by platform>"' }}
${{ (matrix.platform.shared-lib && format('{0} build/{1} | grep "Github Workflow"', matrix.platform.binutils-strings, matrix.platform.shared-lib)) || 'echo "<Shared library not supported by platform>"' }}
echo "Static library:"
${{ (matrix.platform.static-lib && format('strings build/{0} | grep "Github Workflow"', matrix.platform.static-lib)) || 'echo "<Static library not supported by platform>"' }}
${{ (matrix.platform.static-lib && format('{0} build/{1} | grep "Github Workflow"', matrix.platform.binutils-strings, matrix.platform.static-lib)) || 'echo "<Static library not supported by platform>"' }}
- name: 'Run build-time tests (CMake)'
id: tests
if: ${{ !matrix.platform.no-cmake && matrix.platform.run-tests }}
@@ -321,7 +321,7 @@ jobs:
- name: 'Build (cross-platform-actions, BSD)'
id: cpactions
if: ${{ matrix.platform.cpactions }}
uses: cross-platform-actions/action@v0.27.0
uses: cross-platform-actions/action@v0.29.0
with:
operating_system: '${{ matrix.platform.cpactions-os }}'
architecture: '${{ matrix.platform.cpactions-arch }}'
@@ -406,6 +406,14 @@ jobs:
build-scripts/test-versioning.sh
python build-scripts/check_android_jni.py
python build-scripts/check_stdlib_usage.py
- name: 'Verify alignment of Android test apks'
if: ${{ matrix.platform.android-ndk && !matrix.platform.no-cmake }}
run: |
find ./ -iname '*.apk' | xargs -L1 ./build-scripts/check_elf_alignment.sh
- name: 'Verify alignment of Android .so files'
if: ${{ matrix.platform.android-ndk && !matrix.platform.no-cmake }}
run: |
find ./ -iname '*.so' | xargs -L1 ./build-scripts/check_elf_alignment.sh
- name: 'Upload binary package'
uses: actions/upload-artifact@v4
if: ${{ always() && matrix.platform.artifact != '' && (steps.package.outcome == 'success' || steps.cpactions.outcome == 'success') && (matrix.platform.enable-artifacts || steps.tests.outcome == 'failure') }}
@@ -428,4 +436,4 @@ jobs:
with:
if-no-files-found: error
name: '${{ matrix.platform.artifact }}-apks'
path: build/test/*.apk
path: build/test/*.apk
+71 -4
View File
@@ -95,9 +95,17 @@ jobs:
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev
- name: 'CMake (configure + build + tests + examples)'
run: |
set -e
cmake -S ${{ steps.tar.outputs.path }} -B /tmp/build -DSDL_TEST_LIBRARY=TRUE -DSDL_TESTS=TRUE -DSDL_EXAMPLES=TRUE
cmake --build /tmp/build --verbose
ctest --test-dir /tmp/build --no-tests=error --output-on-failure
- name: 'Verify SDL_REVISION contains SDL-'
run: |
set -e
if test "x$(strings /tmp/build/libSDL3.so.0 | grep SDL- | wc -l)" != x1; then
echo "SDL- string not found: must be present in SDL_REVISION"
exit 1
fi
dmg:
needs: [src]
@@ -204,10 +212,22 @@ jobs:
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
-DCMAKE_SYSTEM_NAME=iOS \
-DCMAKE_OSX_ARCHITECTURES="arm64" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-Werror=dev \
-B build_ios
cmake --build build_ios --config Release --verbose
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
-DTEST_FULL=FALSE \
-DTEST_STATIC=FALSE \
-DTEST_TEST=FALSE \
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}/SDL3.xcframework/ios-arm64" \
-DCMAKE_SYSTEM_NAME=iOS \
-DCMAKE_OSX_ARCHITECTURES="arm64" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-Werror=dev \
-B build_ios2
cmake --build build_ios2 --config Release --verbose
- name: 'CMake (configure + build) tvOS'
run: |
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
@@ -217,10 +237,22 @@ jobs:
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
-DCMAKE_SYSTEM_NAME=tvOS \
-DCMAKE_OSX_ARCHITECTURES="arm64" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-Werror=dev \
-B build_tvos
cmake --build build_tvos --config Release --verbose
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
-DTEST_FULL=FALSE \
-DTEST_STATIC=FALSE \
-DTEST_TEST=FALSE \
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}/SDL3.xcframework/tvos-arm64" \
-DCMAKE_SYSTEM_NAME=tvOS \
-DCMAKE_OSX_ARCHITECTURES="arm64" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-Werror=dev \
-B build_tvos2
cmake --build build_tvos2 --config Release --verbose
- name: 'CMake (configure + build) iOS simulator'
run: |
sysroot=$(xcodebuild -version -sdk iphonesimulator Path)
@@ -237,6 +269,19 @@ jobs:
-Werror=dev \
-B build_ios_simulator
cmake --build build_ios_simulator --config Release --verbose
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
-DTEST_FULL=FALSE \
-DTEST_STATIC=FALSE \
-DTEST_TEST=FALSE \
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}/SDL3.xcframework/ios-arm64_x86_64-simulator" \
-DCMAKE_SYSTEM_NAME=iOS \
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
-DCMAKE_OSX_SYSROOT="${sysroot}" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-Werror=dev \
-B build_ios_simulator2
cmake --build build_ios_simulator2 --config Release --verbose
- name: 'CMake (configure + build) tvOS simulator'
run: |
sysroot=$(xcodebuild -version -sdk appletvsimulator Path)
@@ -254,6 +299,19 @@ jobs:
-B build_tvos_simulator
cmake --build build_tvos_simulator --config Release --verbose
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
-DTEST_FULL=FALSE \
-DTEST_STATIC=FALSE \
-DTEST_TEST=FALSE \
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}/SDL3.xcframework/tvos-arm64_x86_64-simulator" \
-DCMAKE_SYSTEM_NAME=tvOS \
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
-DCMAKE_OSX_SYSROOT="${sysroot}" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-Werror=dev \
-B build_tvos_simulator2
cmake --build build_tvos_simulator2 --config Release --verbose
msvc:
needs: [src]
runs-on: windows-2025
@@ -532,10 +590,11 @@ jobs:
with:
sparse-checkout: 'build-scripts/build-release.py'
- name: 'Setup Android NDK'
id: setup-ndk
uses: nttld/setup-ndk@v1
with:
local-cache: true
ndk-version: r21e
local-cache: false
ndk-version: r28c
- name: 'Setup Java JDK'
uses: actions/setup-java@v4
with:
@@ -561,6 +620,8 @@ jobs:
run: |
python build-scripts/build-release.py \
--actions android \
--android-api 21 \
--android-ndk-home "${{ steps.setup-ndk.outputs.ndk-path }}" \
--commit ${{ inputs.commit }} \
--root "${{ steps.tar.outputs.path }}" \
--github \
@@ -607,8 +668,14 @@ jobs:
python "${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}.aar" -o /tmp/SDL3-android
echo "prefix=/tmp/SDL3-android" >>$GITHUB_OUTPUT
echo "sdl3-aar=/tmp/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}.aar" >>$GITHUB_OUTPUT
- name: 'Verify alignment of libSDL3.so (arm64-v8a/x86_64)'
run: |
set -e
${{ steps.src.outputs.path }}/build-scripts/check_elf_alignment.sh ${{ steps.sdk.outputs.prefix }}/lib/arm64-v8a/libSDL3.so
${{ steps.src.outputs.path }}/build-scripts/check_elf_alignment.sh ${{ steps.sdk.outputs.prefix }}/lib/x86_64/libSDL3.so
- name: 'CMake (configure + build) x86, x64, arm32, arm64'
run: |
set -e
android_abis="x86 x86_64 armeabi-v7a arm64-v8a"
for android_abi in ${android_abis}; do
echo "Configuring ${android_abi}..."
+86 -69
View File
@@ -5,7 +5,7 @@ if(NOT DEFINED CMAKE_BUILD_TYPE)
endif()
# See docs/release_checklist.md
project(SDL3 LANGUAGES C VERSION "3.2.18")
project(SDL3 LANGUAGES C VERSION "3.2.29")
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(SDL3_MAINPROJECT ON)
@@ -79,6 +79,12 @@ include("${SDL3_SOURCE_DIR}/cmake/PreseedEmscriptenCache.cmake")
SDL_DetectCompiler()
SDL_DetectTargetCPUArchitectures(SDL_CPUS)
if(APPLE AND CMAKE_OSX_ARCHITECTURES)
list(LENGTH CMAKE_OSX_ARCHITECTURES _num_arches)
if(_num_arches GREATER 1)
set(APPLE_MULTIARCH TRUE)
endif()
endif()
# Increment this if there is an incompatible change - but if that happens,
# we should rename the library from SDL3 to SDL4, at which point this would
@@ -183,29 +189,6 @@ if(MSVC)
set(SDL_RELOCATABLE_DEFAULT ON)
endif()
if(MSVC)
if(NOT SDL_LIBC)
# Make sure /RTC1 is disabled, otherwise it will use functions from the CRT
foreach(flag_var
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
string(REGEX REPLACE "/RTC(su|[1su])" "" ${flag_var} "${${flag_var}}")
endforeach(flag_var)
set(CMAKE_MSVC_RUNTIME_CHECKS "")
endif()
if(MSVC_CLANG)
# clang-cl treats /W4 as '-Wall -Wextra' -- we don't need -Wextra
foreach(flag_var
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
string(REGEX REPLACE "/W4" "/W3" ${flag_var} "${${flag_var}}")
endforeach(flag_var)
endif()
endif()
set(SDL_SHARED_DEFAULT ON)
set(SDL_STATIC_DEFAULT ON)
@@ -373,7 +356,7 @@ dep_option(SDL_WASAPI "Use the Windows WASAPI audio driver" ON "WIN
dep_option(SDL_RENDER_D3D "Enable the Direct3D 9 render driver" ON "SDL_RENDER;SDL_DIRECTX" OFF)
dep_option(SDL_RENDER_D3D11 "Enable the Direct3D 11 render driver" ON "SDL_RENDER;SDL_DIRECTX" OFF)
dep_option(SDL_RENDER_D3D12 "Enable the Direct3D 12 render driver" ON "SDL_RENDER;SDL_DIRECTX" OFF)
dep_option(SDL_RENDER_METAL "Enable the Metal render driver" ON "SDL_RENDER;${APPLE}" OFF)
dep_option(SDL_RENDER_METAL "Enable the Metal render driver" ON "SDL_RENDER;APPLE" OFF)
dep_option(SDL_RENDER_GPU "Enable the SDL_GPU render driver" ON "SDL_RENDER;SDL_GPU" OFF)
dep_option(SDL_VIVANTE "Use Vivante EGL video driver" ON "${UNIX_SYS};SDL_CPU_ARM32" OFF)
dep_option(SDL_VULKAN "Enable Vulkan support" ON "SDL_VIDEO;ANDROID OR APPLE OR LINUX OR FREEBSD OR WINDOWS" OFF)
@@ -424,6 +407,29 @@ if(SDL_PRESEED)
SDL_Preseed_CMakeCache()
endif()
if(MSVC)
if(NOT SDL_LIBC)
# Make sure /RTC1 is disabled, otherwise it will use functions from the CRT
foreach(flag_var
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
string(REGEX REPLACE "/RTC(su|[1su])" "" ${flag_var} "${${flag_var}}")
endforeach(flag_var)
set(CMAKE_MSVC_RUNTIME_CHECKS "")
endif()
if(MSVC_CLANG)
# clang-cl treats /W4 as '-Wall -Wextra' -- we don't need -Wextra
foreach(flag_var
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
string(REGEX REPLACE "/W4" "/W3" ${flag_var} "${${flag_var}}")
endforeach(flag_var)
endif()
endif()
if(SDL_SHARED)
add_library(SDL3-shared SHARED)
add_library(SDL3::SDL3-shared ALIAS SDL3-shared)
@@ -658,7 +664,7 @@ if(SDL_ASSEMBLY)
if(USE_GCC OR USE_CLANG OR USE_INTELCC)
string(APPEND CMAKE_REQUIRED_FLAGS " -mmmx")
endif()
check_c_source_compiles("
check_x86_source_compiles([==[
#include <mmintrin.h>
void ints_add(int *dest, int *a, int *b, unsigned size) {
for (; size >= 2; size -= 2, dest += 2, a += 2, b += 2) {
@@ -668,7 +674,7 @@ if(SDL_ASSEMBLY)
int main(int argc, char *argv[]) {
ints_add((int*)0, (int*)0, (int*)0, 0);
return 0;
}" COMPILER_SUPPORTS_MMX)
}]==] COMPILER_SUPPORTS_MMX)
cmake_pop_check_state()
if(COMPILER_SUPPORTS_MMX)
set(HAVE_MMX TRUE)
@@ -679,7 +685,7 @@ if(SDL_ASSEMBLY)
if(USE_GCC OR USE_CLANG OR USE_INTELCC)
string(APPEND CMAKE_REQUIRED_FLAGS " -msse")
endif()
check_c_source_compiles("
check_x86_source_compiles([==[
#include <xmmintrin.h>
void floats_add(float *dest, float *a, float *b, unsigned size) {
for (; size >= 4; size -= 4, dest += 4, a += 4, b += 4) {
@@ -689,7 +695,7 @@ if(SDL_ASSEMBLY)
int main(int argc, char **argv) {
floats_add((float*)0, (float*)0, (float*)0, 0);
return 0;
}" COMPILER_SUPPORTS_SSE)
}]==] COMPILER_SUPPORTS_SSE)
cmake_pop_check_state()
if(COMPILER_SUPPORTS_SSE)
set(HAVE_SSE TRUE)
@@ -700,7 +706,7 @@ if(SDL_ASSEMBLY)
if(USE_GCC OR USE_CLANG OR USE_INTELCC)
string(APPEND CMAKE_REQUIRED_FLAGS " -msse2")
endif()
check_c_source_compiles("
check_x86_source_compiles([==[
#include <emmintrin.h>
void doubles_add(double *dest, double *a, double *b, unsigned size) {
for (; size >= 4; size -= 4, dest += 4, a += 4, b += 4) {
@@ -710,7 +716,7 @@ if(SDL_ASSEMBLY)
int main(int argc, char **argv) {
doubles_add((double*)0, (double*)0, (double*)0, 0);
return 0;
}" COMPILER_SUPPORTS_SSE2)
}]==] COMPILER_SUPPORTS_SSE2)
cmake_pop_check_state()
if(COMPILER_SUPPORTS_SSE2)
set(HAVE_SSE2 TRUE)
@@ -721,7 +727,7 @@ if(SDL_ASSEMBLY)
if(USE_GCC OR USE_CLANG OR USE_INTELCC)
string(APPEND CMAKE_REQUIRED_FLAGS " -msse3")
endif()
check_c_source_compiles("
check_x86_source_compiles([==[
#include <pmmintrin.h>
void ints_add(int *dest, int *a, int *b, unsigned size) {
for (; size >= 4; size -= 4, dest += 4, a += 4, b += 4) {
@@ -731,7 +737,7 @@ if(SDL_ASSEMBLY)
int main(int argc, char **argv) {
ints_add((int*)0, (int*)0, (int*)0, 0);
return 0;
}" COMPILER_SUPPORTS_SSE3)
}]==] COMPILER_SUPPORTS_SSE3)
cmake_pop_check_state()
if(COMPILER_SUPPORTS_SSE3)
set(HAVE_SSE3 TRUE)
@@ -742,7 +748,7 @@ if(SDL_ASSEMBLY)
if(USE_GCC OR USE_CLANG OR USE_INTELCC)
string(APPEND CMAKE_REQUIRED_FLAGS " -msse4.1")
endif()
check_c_source_compiles("
check_x86_source_compiles([==[
#include <smmintrin.h>
void ints_mul(int *dest, int *a, int *b, unsigned size) {
for (; size >= 4; size -= 4, dest += 4, a += 4, b += 4) {
@@ -752,7 +758,7 @@ if(SDL_ASSEMBLY)
int main(int argc, char **argv) {
ints_mul((int*)0, (int*)0, (int*)0, 0);
return 0;
}" COMPILER_SUPPORTS_SSE4_1)
}]==] COMPILER_SUPPORTS_SSE4_1)
cmake_pop_check_state()
if(COMPILER_SUPPORTS_SSE4_1)
set(HAVE_SSE4_1 TRUE)
@@ -761,21 +767,16 @@ if(SDL_ASSEMBLY)
if(SDL_SSE4_2)
cmake_push_check_state()
if(USE_GCC OR USE_CLANG OR USE_INTELCC)
string(APPEND CMAKE_REQUIRED_FLAGS " -msse4.2 -mcrc32")
string(APPEND CMAKE_REQUIRED_FLAGS " -msse4.2")
endif()
check_c_source_compiles("
check_x86_source_compiles([==[
#include <nmmintrin.h>
unsigned calc_crc32c(const char *text, unsigned len) {
unsigned crc32c = ~0;
for (; len >= 4; len -= 4, text += 4) {
crc32c = (unsigned)_mm_crc32_u32(crc32c, *(unsigned*)text);
}
return crc32c;
}
__m128i bitmask;
char data[16];
int main(int argc, char **argv) {
calc_crc32c(\"SDL_SSE4\",8);
bitmask = _mm_cmpgt_epi64(_mm_set1_epi64x(0), _mm_loadu_si128((void*)data));
return 0;
}" COMPILER_SUPPORTS_SSE4_2)
}]==] COMPILER_SUPPORTS_SSE4_2)
cmake_pop_check_state()
if(COMPILER_SUPPORTS_SSE4_2)
set(HAVE_SSE4_2 TRUE)
@@ -786,7 +787,7 @@ if(SDL_ASSEMBLY)
if(USE_GCC OR USE_CLANG OR USE_INTELCC)
string(APPEND CMAKE_REQUIRED_FLAGS " -mavx")
endif()
check_c_source_compiles("
check_x86_source_compiles([==[
#include <immintrin.h>
void floats_add(float *dest, float *a, float *b, unsigned size) {
for (; size >= 8; size -= 8, dest += 8, a += 8, b += 8) {
@@ -796,7 +797,7 @@ if(SDL_ASSEMBLY)
int main(int argc, char **argv) {
floats_add((float*)0, (float*)0, (float*)0, 0);
return 0;
}" COMPILER_SUPPORTS_AVX)
}]==] COMPILER_SUPPORTS_AVX)
cmake_pop_check_state()
if(COMPILER_SUPPORTS_AVX)
set(HAVE_AVX TRUE)
@@ -807,7 +808,7 @@ if(SDL_ASSEMBLY)
if(USE_GCC OR USE_CLANG OR USE_INTELCC)
string(APPEND CMAKE_REQUIRED_FLAGS " -mavx2")
endif()
check_c_source_compiles("
check_x86_source_compiles([==[
#include <immintrin.h>
void ints_add(int *dest, int *a, int *b, unsigned size) {
for (; size >= 8; size -= 8, dest += 8, a += 8, b += 8) {
@@ -817,7 +818,7 @@ if(SDL_ASSEMBLY)
int main(int argc, char **argv) {
ints_add((int*)0, (int*)0, (int*)0, 0);
return 0;
}" COMPILER_SUPPORTS_AVX2)
}]==] COMPILER_SUPPORTS_AVX2)
cmake_pop_check_state()
if(COMPILER_SUPPORTS_AVX2)
set(HAVE_AVX2 TRUE)
@@ -828,7 +829,7 @@ if(SDL_ASSEMBLY)
if(USE_GCC OR USE_CLANG OR USE_INTELCC)
string(APPEND CMAKE_REQUIRED_FLAGS " -mavx512f")
endif()
check_c_source_compiles("
check_x86_source_compiles([==[
#include <immintrin.h>
void floats_add(float *dest, float *a, float *b, unsigned size) {
for (; size >= 16; size -= 16, dest += 16, a += 16, b += 16) {
@@ -838,7 +839,7 @@ if(SDL_ASSEMBLY)
int main(int argc, char **argv) {
floats_add((float*)0, (float*)0, (float*)0, 0);
return 0;
}" COMPILER_SUPPORTS_AVX512F)
}]==] COMPILER_SUPPORTS_AVX512F)
cmake_pop_check_state()
if(COMPILER_SUPPORTS_AVX512F)
set(HAVE_AVX512F TRUE)
@@ -846,18 +847,17 @@ if(SDL_ASSEMBLY)
endif()
if(SDL_ARMNEON)
check_c_source_compiles("
#include <arm_neon.h>
void floats_add(float *dest, float *a, float *b, unsigned size) {
for (; size >= 4; size -= 4, dest += 4, a += 4, b += 4) {
vst1q_f32(dest, vaddq_f32(vld1q_f32(a), vld1q_f32(b)));
}
check_arm_source_compiles([==[
#include <arm_neon.h>
void floats_add(float *dest, float *a, float *b, unsigned size) {
for (; size >= 4; size -= 4, dest += 4, a += 4, b += 4) {
vst1q_f32(dest, vaddq_f32(vld1q_f32(a), vld1q_f32(b)));
}
int main(int argc, char *argv[]) {
floats_add((float*)0, (float*)0, (float*)0, 0);
return 0;
}" COMPILER_SUPPORTS_ARMNEON)
}
int main(int argc, char *argv[]) {
floats_add((float*)0, (float*)0, (float*)0, 0);
return 0;
}]==] COMPILER_SUPPORTS_ARMNEON)
if(COMPILER_SUPPORTS_ARMNEON)
set(HAVE_ARMNEON TRUE)
endif()
@@ -898,7 +898,17 @@ if(SDL_ASSEMBLY)
cmake_pop_check_state()
if(COMPILER_SUPPORTS_LSX AND HAVE_LSXINTRIN_H)
set_property(SOURCE "${SDL3_SOURCE_DIR}/src/video/yuv2rgb/yuv_rgb_lsx.c" APPEND PROPERTY COMPILE_OPTIONS "-mlsx")
set_property(SOURCE
"${SDL3_SOURCE_DIR}/src/video/yuv2rgb/yuv_rgb_lsx.c"
"${SDL3_SOURCE_DIR}/src/video/SDL_blit_A.c"
"${SDL3_SOURCE_DIR}/src/video/SDL_fillrect.c"
APPEND PROPERTY COMPILE_OPTIONS "-mlsx")
set_property(SOURCE
"${SDL3_SOURCE_DIR}/src/video/yuv2rgb/yuv_rgb_lsx.c"
"${SDL3_SOURCE_DIR}/src/video/SDL_blit_A.c"
"${SDL3_SOURCE_DIR}/src/video/SDL_fillrect.c"
PROPERTY SKIP_PRECOMPILE_HEADERS 1)
set(HAVE_LSX TRUE)
endif()
endif()
@@ -1060,8 +1070,10 @@ if(SDL_LIBC)
cmake_push_check_state()
if(MSVC)
string(APPEND CMAKE_REQUIRED_FLAGS " -we4244 -WX") # 'conversion' conversion from 'type1' to 'type2', possible loss of data
else()
elseif(HAVE_GCC_WFLOAT_CONVERSION)
string(APPEND CMAKE_REQUIRED_FLAGS " -Wfloat-conversion -Werror")
else()
string(APPEND CMAKE_REQUIRED_FLAGS " -Wconversion -Werror")
endif()
foreach(math_fn isinf isnan)
string(TOUPPER "${math_fn}" MATH_FN)
@@ -1099,6 +1111,7 @@ if(SDL_LIBC)
check_symbol_exists(gethostname "unistd.h" HAVE_GETHOSTNAME)
check_symbol_exists(getpagesize "unistd.h" HAVE_GETPAGESIZE)
check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION)
check_symbol_exists(sigtimedwait "signal.h" HAVE_SIGTIMEDWAIT)
check_symbol_exists(setjmp "setjmp.h" HAVE_SETJMP)
check_symbol_exists(nanosleep "time.h" HAVE_NANOSLEEP)
check_symbol_exists(gmtime_r "time.h" HAVE_GMTIME_R)
@@ -1486,6 +1499,9 @@ if(ANDROID)
endif()
endif()
endif()
if(TARGET SDL3-static)
target_link_options(SDL3-static INTERFACE "-Wl,-u,JNI_OnLoad")
endif()
elseif(EMSCRIPTEN)
# Hide noisy warnings that intend to aid mostly during initial stages of porting a new
@@ -1911,7 +1927,7 @@ elseif(WINDOWS)
target_compile_options(SDL_uclibc PRIVATE $<$<COMPILE_LANGUAGE:C,CXX>:/GS-> $<$<COMPILE_LANGUAGE:C,CXX>:/Gs1048576>)
if(SDL_CPU_X86)
target_compile_options(SDL3-shared PRIVATE "/arch:SSE")
target_compile_options(SDL3-SDL_uclibc PRIVATE "/arch:SSE")
target_compile_options(SDL_uclibc PRIVATE "/arch:SSE")
endif()
endif()
@@ -2960,7 +2976,7 @@ if(WINDOWS)
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/process/windows/*.c")
set(SDL_PROCESS_WINDOWS 1)
set(HAVE_SDL_PROCESS TRUE)
else()
elseif(NOT ANDROID)
check_c_source_compiles("
#include <spawn.h>
#include <unistd.h>
@@ -3150,14 +3166,15 @@ endforeach()
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/REVISION.txt")
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/REVISION.txt" revisions)
list(GET revisions 0 revisions_0)
string(STRIP "${revisions_0}" SDL_REVISION)
string(STRIP "${revisions_0}" revisions_0_stripped)
set(SDL_REVISION "SDL-${revisions_0_stripped}")
else()
set(SDL_REVISION "" CACHE STRING "Custom SDL revision (only used when REVISION.txt does not exist)")
endif()
if(NOT SDL_REVISION)
# If SDL_REVISION is not overrided, use git to describe
git_describe(SDL_REVISION_GIT)
set(SDL_REVISION "SDL3-${SDL3_VERSION}-${SDL_REVISION_GIT}")
set(SDL_REVISION "SDL-${SDL3_VERSION}-${SDL_REVISION_GIT}")
endif()
execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory "${SDL3_BINARY_DIR}/include-revision/SDL3")
-1
View File
@@ -781,7 +781,6 @@
<ClCompile Include="..\..\src\render\opengl\SDL_shaders_gl.c" />
<ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c" />
<ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c" />
<ClCompile Include="..\..\src\render\SDL_d3dmath.c" />
<ClCompile Include="..\..\src\render\SDL_render.c" />
<ClCompile Include="..\..\src\render\SDL_render_unsupported.c" />
<ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
-1
View File
@@ -108,7 +108,6 @@
<ClCompile Include="..\..\src\render\opengl\SDL_shaders_gl.c" />
<ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c" />
<ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c" />
<ClCompile Include="..\..\src\render\SDL_d3dmath.c" />
<ClCompile Include="..\..\src\render\SDL_render.c" />
<ClCompile Include="..\..\src\render\SDL_render_unsupported.c" />
<ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
-1
View File
@@ -627,7 +627,6 @@
<ClCompile Include="..\..\src\render\opengl\SDL_shaders_gl.c" />
<ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c" />
<ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c" />
<ClCompile Include="..\..\src\render\SDL_d3dmath.c" />
<ClCompile Include="..\..\src\render\SDL_render.c" />
<ClCompile Include="..\..\src\render\SDL_render_unsupported.c" />
<ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
-1
View File
@@ -1460,7 +1460,6 @@
<ClCompile Include="..\..\src\sensor\windows\SDL_windowssensor.c">
<Filter>sensor\windows</Filter>
</ClCompile>
<ClCompile Include="..\..\src\render\SDL_d3dmath.c">
<Filter>render</Filter>
</ClCompile>
<ClCompile Include="..\..\src\render\SDL_render.c">
+11
View File
@@ -1,6 +1,17 @@
This is a list of major changes in SDL's version history.
---------------------------------------------------------------------------
3.2.22:
---------------------------------------------------------------------------
* SDL_HINT_JOYSTICK_WGI is disabled by default
---------------------------------------------------------------------------
3.2.16:
---------------------------------------------------------------------------
* SDL_HINT_JOYSTICK_RAWINPUT is disabled by default
---------------------------------------------------------------------------
3.2.10:
---------------------------------------------------------------------------
+2 -2
View File
@@ -19,10 +19,10 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.2.18</string>
<string>3.2.29</string>
<key>CFBundleSignature</key>
<string>SDLX</string>
<key>CFBundleVersion</key>
<string>3.2.18</string>
<string>3.2.29</string>
</dict>
</plist>
+9 -9
View File
@@ -292,7 +292,6 @@
A7D8BA2523E2514400DCD162 /* SDL_drawpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A8FC23E2514000DCD162 /* SDL_drawpoint.c */; };
A7D8BA2B23E2514400DCD162 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A8FD23E2514000DCD162 /* SDL_blendfillrect.c */; };
A7D8BA3123E2514400DCD162 /* SDL_rotate.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A8FE23E2514000DCD162 /* SDL_rotate.h */; };
A7D8BA3723E2514400DCD162 /* SDL_d3dmath.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A8FF23E2514000DCD162 /* SDL_d3dmath.c */; };
A7D8BA4923E2514400DCD162 /* SDL_render_gles2.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A90423E2514000DCD162 /* SDL_render_gles2.c */; };
A7D8BA4F23E2514400DCD162 /* SDL_shaders_gles2.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A90523E2514000DCD162 /* SDL_shaders_gles2.h */; };
A7D8BA5523E2514400DCD162 /* SDL_gles2funcs.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A90623E2514000DCD162 /* SDL_gles2funcs.h */; };
@@ -869,7 +868,6 @@
A7D8A8FC23E2514000DCD162 /* SDL_drawpoint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_drawpoint.c; sourceTree = "<group>"; };
A7D8A8FD23E2514000DCD162 /* SDL_blendfillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendfillrect.c; sourceTree = "<group>"; };
A7D8A8FE23E2514000DCD162 /* SDL_rotate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_rotate.h; sourceTree = "<group>"; };
A7D8A8FF23E2514000DCD162 /* SDL_d3dmath.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_d3dmath.c; sourceTree = "<group>"; };
A7D8A90423E2514000DCD162 /* SDL_render_gles2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_render_gles2.c; sourceTree = "<group>"; };
A7D8A90523E2514000DCD162 /* SDL_shaders_gles2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_shaders_gles2.h; sourceTree = "<group>"; };
A7D8A90623E2514000DCD162 /* SDL_gles2funcs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gles2funcs.h; sourceTree = "<group>"; };
@@ -2135,7 +2133,6 @@
A7D8A90C23E2514000DCD162 /* opengl */,
A7D8A90323E2514000DCD162 /* opengles2 */,
A7D8A8EF23E2514000DCD162 /* software */,
A7D8A8FF23E2514000DCD162 /* SDL_d3dmath.c */,
A7D8A8DC23E2514000DCD162 /* SDL_d3dmath.h */,
A7D8A8DB23E2514000DCD162 /* SDL_render.c */,
E4F7981D2AD8D86A00669F54 /* SDL_render_unsupported.c */,
@@ -2833,7 +2830,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Build an xcframework with both device and simulator files for all platforms.\n# Adapted from an answer in\n# https://developer.apple.com/forums/thread/666335?answerId=685927022#685927022\n\nif [ \"$XCODE_VERSION_ACTUAL\" -lt 1100 ]\nthen\n echo \"error: Building an xcframework requires Xcode 11 minimum.\"\n exit 1\nfi\n\nFRAMEWORK_NAME=\"SDL3\"\nPROJECT_NAME=\"SDL\"\nSCHEME=\"SDL3\"\n\nMACOS_ARCHIVE_PATH=\"${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-macosx.xcarchive\"\nIOS_SIMULATOR_ARCHIVE_PATH=\"${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-iphonesimulator.xcarchive\"\nIOS_DEVICE_ARCHIVE_PATH=\"${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-iphoneos.xcarchive\"\nTVOS_SIMULATOR_ARCHIVE_PATH=\"${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-appletvsimulator.xcarchive\"\nTVOS_DEVICE_ARCHIVE_PATH=\"${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-appletvos.xcarchive\"\n\nOUTPUT_DIR=\"./build/\"\n\n# macOS\nxcodebuild archive \\\n ONLY_ACTIVE_ARCH=NO \\\n -scheme \"${SCHEME}\" \\\n -project \"${PROJECT_NAME}.xcodeproj\" \\\n -archivePath ${MACOS_ARCHIVE_PATH} \\\n -destination 'generic/platform=macOS,name=Any Mac' \\\n BUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n SKIP_INSTALL=NO || exit $?\n \n# iOS simulator\nxcodebuild archive \\\n ONLY_ACTIVE_ARCH=NO \\\n -scheme \"${SCHEME}\" \\\n -project \"${PROJECT_NAME}.xcodeproj\" \\\n -archivePath ${IOS_SIMULATOR_ARCHIVE_PATH} \\\n -destination 'generic/platform=iOS Simulator' \\\n BUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n SKIP_INSTALL=NO || exit $?\n\n# iOS device\nxcodebuild archive \\\n -scheme \"${SCHEME}\" \\\n -project \"${PROJECT_NAME}.xcodeproj\" \\\n -archivePath ${IOS_DEVICE_ARCHIVE_PATH} \\\n -destination 'generic/platform=iOS' \\\n BUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n SKIP_INSTALL=NO || exit $?\n\n# tvOS simulator\nxcodebuild archive \\\n ONLY_ACTIVE_ARCH=NO \\\n -scheme \"${SCHEME}\" \\\n -project \"${PROJECT_NAME}.xcodeproj\" \\\n -archivePath ${TVOS_SIMULATOR_ARCHIVE_PATH} \\\n -destination 'generic/platform=tvOS Simulator' \\\n BUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n SKIP_INSTALL=NO || exit $?\n\n# tvOS device\nxcodebuild archive \\\n -scheme \"${SCHEME}\" \\\n -project \"${PROJECT_NAME}.xcodeproj\" \\\n -archivePath ${TVOS_DEVICE_ARCHIVE_PATH} \\\n -destination 'generic/platform=tvOS' \\\n BUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n SKIP_INSTALL=NO || exit $?\n\n# Clean-up any existing instance of this xcframework from the Products directory\nrm -rf \"${OUTPUT_DIR}${FRAMEWORK_NAME}.xcframework\"\n\n# Create final xcframework\nxcodebuild -create-xcframework \\\n -framework \"${MACOS_ARCHIVE_PATH}\"/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n -framework \"${IOS_DEVICE_ARCHIVE_PATH}\"/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n -framework \"${IOS_SIMULATOR_ARCHIVE_PATH}\"/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n -framework \"${TVOS_DEVICE_ARCHIVE_PATH}\"/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n -framework \"${TVOS_SIMULATOR_ARCHIVE_PATH}\"/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n -output ${OUTPUT_DIR}/${FRAMEWORK_NAME}.xcframework\n\n# Ensure git doesn't pick up on our Products folder. \nrm -rf ${OUTPUT_DIR}/.gitignore\necho \"*\" >> ${OUTPUT_DIR}/.gitignore\n";
shellScript = "# Build an xcframework with both device and simulator files for all platforms.\n# Adapted from an answer in\n# https://developer.apple.com/forums/thread/666335?answerId=685927022#685927022\n\nif [ \"$XCODE_VERSION_ACTUAL\" -lt 1100 ]\nthen\n echo \"error: Building an xcframework requires Xcode 11 minimum.\"\n exit 1\nfi\n\nFRAMEWORK_NAME=\"SDL3\"\nPROJECT_NAME=\"SDL\"\nSCHEME=\"SDL3\"\n\nMACOS_ARCHIVE_PATH=\"${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-macosx.xcarchive\"\nIOS_SIMULATOR_ARCHIVE_PATH=\"${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-iphonesimulator.xcarchive\"\nIOS_DEVICE_ARCHIVE_PATH=\"${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-iphoneos.xcarchive\"\nTVOS_SIMULATOR_ARCHIVE_PATH=\"${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-appletvsimulator.xcarchive\"\nTVOS_DEVICE_ARCHIVE_PATH=\"${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-appletvos.xcarchive\"\n\nOUTPUT_DIR=\"./build/\"\n\n# macOS\nxcodebuild archive \\\n ONLY_ACTIVE_ARCH=NO \\\n -scheme \"${SCHEME}\" \\\n -project \"${PROJECT_NAME}.xcodeproj\" \\\n -archivePath ${MACOS_ARCHIVE_PATH} \\\n -destination 'generic/platform=macOS,name=Any Mac' \\\n BUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n SKIP_INSTALL=NO || exit $?\n \n# iOS simulator\nxcodebuild archive \\\n ONLY_ACTIVE_ARCH=NO \\\n -scheme \"${SCHEME}\" \\\n -project \"${PROJECT_NAME}.xcodeproj\" \\\n -archivePath ${IOS_SIMULATOR_ARCHIVE_PATH} \\\n -destination 'generic/platform=iOS Simulator' \\\n BUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n SKIP_INSTALL=NO || exit $?\n\n# iOS device\nxcodebuild archive \\\n -scheme \"${SCHEME}\" \\\n -project \"${PROJECT_NAME}.xcodeproj\" \\\n -archivePath ${IOS_DEVICE_ARCHIVE_PATH} \\\n -destination 'generic/platform=iOS' \\\n BUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n SKIP_INSTALL=NO || exit $?\n\n# tvOS simulator\nxcodebuild archive \\\n ONLY_ACTIVE_ARCH=NO \\\n -scheme \"${SCHEME}\" \\\n -project \"${PROJECT_NAME}.xcodeproj\" \\\n -archivePath ${TVOS_SIMULATOR_ARCHIVE_PATH} \\\n -destination 'generic/platform=tvOS Simulator' \\\n BUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n SKIP_INSTALL=NO || exit $?\n\n# tvOS device\nxcodebuild archive \\\n -scheme \"${SCHEME}\" \\\n -project \"${PROJECT_NAME}.xcodeproj\" \\\n -archivePath ${TVOS_DEVICE_ARCHIVE_PATH} \\\n -destination 'generic/platform=tvOS' \\\n BUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n SKIP_INSTALL=NO || exit $?\n\n# Clean-up any existing instance of this xcframework from the Products directory\nrm -rf \"${OUTPUT_DIR}${FRAMEWORK_NAME}.xcframework\"\n\n# Create final xcframework\nxcodebuild -create-xcframework \\\n -framework \"${MACOS_ARCHIVE_PATH}\"/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n -debug-symbols \"${MACOS_ARCHIVE_PATH}\"/dSYMs/$FRAMEWORK_NAME.framework.dSYM \\\n -framework \"${IOS_DEVICE_ARCHIVE_PATH}\"/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n -debug-symbols \"${IOS_DEVICE_ARCHIVE_PATH}\"/dSYMs/$FRAMEWORK_NAME.framework.dSYM \\\n -framework \"${IOS_SIMULATOR_ARCHIVE_PATH}\"/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n -debug-symbols \"${IOS_SIMULATOR_ARCHIVE_PATH}\"/dSYMs/$FRAMEWORK_NAME.framework.dSYM \\\n -framework \"${TVOS_DEVICE_ARCHIVE_PATH}\"/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n -debug-symbols \"${TVOS_DEVICE_ARCHIVE_PATH}\"/dSYMs/$FRAMEWORK_NAME.framework.dSYM \\\n -framework \"${TVOS_SIMULATOR_ARCHIVE_PATH}\"/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n -debug-symbols \"${TVOS_SIMULATOR_ARCHIVE_PATH}\"/dSYMs/$FRAMEWORK_NAME.framework.dSYM \\\n -output ${OUTPUT_DIR}/${FRAMEWORK_NAME}.xcframework\n\n# Ensure git doesn't pick up on our Products folder. \nrm -rf ${OUTPUT_DIR}/.gitignore\necho \"*\" >> ${OUTPUT_DIR}/.gitignore\n";
};
/* End PBXShellScriptBuildPhase section */
@@ -2903,7 +2900,6 @@
A7D8BBE723E2574800DCD162 /* SDL_uikitviewcontroller.m in Sources */,
A7D8ADF223E2514100DCD162 /* SDL_blit_A.c in Sources */,
A7D8BBDD23E2574800DCD162 /* SDL_uikitmodes.m in Sources */,
A7D8BA3723E2514400DCD162 /* SDL_d3dmath.c in Sources */,
F3A9AE9C2C8A13C100AAC390 /* SDL_pipeline_gpu.c in Sources */,
75E0915A241EA924004729E1 /* SDL_virtualjoystick.c in Sources */,
F338A11A2D1B37E4007CDFDF /* SDL_tray.c in Sources */,
@@ -3086,7 +3082,7 @@
CLANG_ENABLE_OBJC_ARC = YES;
DEPLOYMENT_POSTPROCESSING = YES;
DYLIB_COMPATIBILITY_VERSION = 201.0.0;
DYLIB_CURRENT_VERSION = 201.18.0;
DYLIB_CURRENT_VERSION = 201.29.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_ALTIVEC_EXTENSIONS = YES;
@@ -3121,7 +3117,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 3.2.18;
MARKETING_VERSION = 3.2.29;
OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)";
PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3;
PRODUCT_NAME = SDL3;
@@ -3138,6 +3134,8 @@
baseConfigurationReference = F3F7BE3B2CBD79D200C984AF /* config.xcconfig */;
buildSettings = {
CLANG_LINK_OBJC_RUNTIME = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
OTHER_LDFLAGS = "-liconv";
SUPPORTS_MACCATALYST = YES;
};
@@ -3150,7 +3148,7 @@
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
DYLIB_COMPATIBILITY_VERSION = 201.0.0;
DYLIB_CURRENT_VERSION = 201.18.0;
DYLIB_CURRENT_VERSION = 201.29.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@@ -3182,7 +3180,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 3.2.18;
MARKETING_VERSION = 3.2.29;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)";
PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3;
@@ -3200,6 +3198,8 @@
baseConfigurationReference = F3F7BE3B2CBD79D200C984AF /* config.xcconfig */;
buildSettings = {
CLANG_LINK_OBJC_RUNTIME = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
OTHER_LDFLAGS = "-liconv";
SUPPORTS_MACCATALYST = YES;
};
+1 -1
View File
@@ -1,4 +1,4 @@
Title SDL 3.2.18
Title SDL 3.2.29
Version 1
Description SDL Library for macOS (http://www.libsdl.org)
DefaultLocation /Library/Frameworks
@@ -1,8 +1,9 @@
# SDL3 CMake configuration file:
# This file is meant to be placed in Resources/CMake of a SDL3 framework
# This file is meant to be placed in Resources/CMake of a SDL3 framework for macOS,
# or in the CMake directory of a SDL3 framework for iOS / tvOS / visionOS.
# INTERFACE_LINK_OPTIONS needs CMake 3.12
cmake_minimum_required(VERSION 3.12)
cmake_minimum_required(VERSION 3.12...4.0)
include(FeatureSummary)
set_package_properties(SDL3 PROPERTIES
@@ -31,16 +32,31 @@ endmacro()
set(SDL3_FOUND TRUE)
# Compute the installation prefix relative to this file.
set(_sdl3_framework_path "${CMAKE_CURRENT_LIST_DIR}") # > /SDL3.framework/Resources/CMake/
get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" REALPATH) # > /SDL3.framework/Versions/Current/Resources/CMake
get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" REALPATH) # > /SDL3.framework/Versions/A/Resources/CMake/
get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" PATH) # > /SDL3.framework/Versions/A/Resources/
get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" PATH) # > /SDL3.framework/Versions/A/
get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" PATH) # > /SDL3.framework/Versions/
get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" PATH) # > /SDL3.framework/
get_filename_component(_sdl3_framework_parent_path "${_sdl3_framework_path}" PATH) # > /
# Compute the installation prefix relative to this file:
# search upwards for the .framework directory
set(_current_path "${CMAKE_CURRENT_LIST_DIR}")
get_filename_component(_current_path "${_current_path}" REALPATH)
set(_sdl3_framework_path "")
while(NOT _sdl3_framework_path)
if(IS_DIRECTORY "${_current_path}" AND "${_current_path}" MATCHES "/SDL3\\.framework$")
set(_sdl3_framework_path "${_current_path}")
break()
endif()
get_filename_component(_next_current_path "${_current_path}" DIRECTORY)
if("${_current_path}" STREQUAL "${_next_current_path}")
break()
endif()
set(_current_path "${_next_current_path}")
endwhile()
unset(_current_path)
unset(_next_current_path)
if(NOT _sdl3_framework_path)
message(FATAL_ERROR "Could not find SDL3.framework root from ${CMAKE_CURRENT_LIST_DIR}")
endif()
get_filename_component(_sdl3_framework_parent_path "${_sdl3_framework_path}" PATH)
# All targets are created, even when some might not be requested though COMPONENTS.
# This is done for compatibility with CMake generated SDL3-target.cmake files.
@@ -1,16 +1,26 @@
# based on the files generated by CMake's write_basic_package_version_file
# SDL CMake version configuration file:
# This file is meant to be placed in Resources/CMake of a SDL3 framework
# This file is meant to be placed in Resources/CMake of a SDL3 framework for macOS,
# or in the CMake directory of a SDL3 framework for iOS / tvOS / visionOS.
cmake_minimum_required(VERSION 3.12)
cmake_minimum_required(VERSION 3.12...4.0)
if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../../Headers/SDL_version.h")
message(AUTHOR_WARNING "Could not find SDL_version.h. This script is meant to be placed in the Resources/CMake directory of SDL2.framework")
# Find SDL_version.h
set(_sdl_version_h_path "")
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/../../Headers/SDL_version.h")
set(_sdl_version_h_path "${CMAKE_CURRENT_LIST_DIR}/../../Headers/SDL_version.h")
elseif(EXISTS "${CMAKE_CURRENT_LIST_DIR}/../Headers/SDL_version.h")
set(_sdl_version_h_path "${CMAKE_CURRENT_LIST_DIR}/../Headers/SDL_version.h")
endif()
if(NOT _sdl_version_h_path)
message(AUTHOR_WARNING "Could not find SDL_version.h. This script is meant to be placed in the Resources/CMake directory or the CMake directory of SDL3.framework.")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
return()
endif()
file(READ "${CMAKE_CURRENT_LIST_DIR}/../../Headers/SDL_version.h" _sdl_version_h)
file(READ "${_sdl_version_h_path}" _sdl_version_h)
string(REGEX MATCH "#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)" _sdl_major_re "${_sdl_version_h}")
set(_sdl_major "${CMAKE_MATCH_1}")
string(REGEX MATCH "#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)" _sdl_minor_re "${_sdl_version_h}")
@@ -21,9 +31,12 @@ if(_sdl_major_re AND _sdl_minor_re AND _sdl_micro_re)
set(PACKAGE_VERSION "${_sdl_major}.${_sdl_minor}.${_sdl_micro}")
else()
message(AUTHOR_WARNING "Could not extract version from SDL_version.h.")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
return()
endif()
unset(_sdl_version_h)
unset(_sdl_version_h_path)
unset(_sdl_major_re)
unset(_sdl_major)
unset(_sdl_minor_re)
@@ -16,6 +16,7 @@ set(_sdl3_version_h "${_sdl3_framework}/Headers/SDL_version.h")
if(NOT EXISTS "${_sdl3_version_h}")
message(AUTHOR_WARNING "Cannot not find ${_sdl3_framework}. This script is meant to be placed in share/cmake/SDL3, next to SDL3.xcframework")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
return()
endif()
@@ -36,6 +37,7 @@ if(_sdl_major_re AND _sdl_minor_re AND _sdl_micro_re)
set(PACKAGE_VERSION "${_sdl_major}.${_sdl_minor}.${_sdl_micro}")
else()
message(AUTHOR_WARNING "Could not extract version from SDL_version.h.")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
return()
endif()
+1 -1
View File
@@ -7,4 +7,4 @@
APP_ABI := armeabi-v7a arm64-v8a x86 x86_64
# Min runtime API level
APP_PLATFORM=android-16
APP_PLATFORM=android-21
@@ -61,7 +61,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
private static final String TAG = "SDL";
private static final int SDL_MAJOR_VERSION = 3;
private static final int SDL_MINOR_VERSION = 2;
private static final int SDL_MICRO_VERSION = 18;
private static final int SDL_MICRO_VERSION = 29;
/*
// Display InputType.SOURCE/CLASS of events and devices
//
@@ -1128,6 +1128,11 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
int orientation_landscape = -1;
int orientation_portrait = -1;
if (w <= 1 || h <= 1) {
// Invalid width/height, ignore this request
return;
}
/* If set, hint "explicitly controls which UI orientations are allowed". */
if (hint.contains("LandscapeRight") && hint.contains("LandscapeLeft")) {
orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE;
@@ -2196,7 +2201,11 @@ class SDLClipboardHandler implements
}
public boolean clipboardHasText() {
return mClipMgr.hasPrimaryClip();
if (Build.VERSION.SDK_INT >= 28 /* Android 9 (P) */) {
return mClipMgr.hasPrimaryClip();
} else {
return mClipMgr.hasText();
}
}
public String clipboardGetText() {
@@ -2214,10 +2223,19 @@ class SDLClipboardHandler implements
}
public void clipboardSetText(String string) {
mClipMgr.removePrimaryClipChangedListener(this);
ClipData clip = ClipData.newPlainText(null, string);
mClipMgr.setPrimaryClip(clip);
mClipMgr.addPrimaryClipChangedListener(this);
mClipMgr.removePrimaryClipChangedListener(this);
if (string.isEmpty()) {
if (Build.VERSION.SDK_INT >= 28 /* Android 9 (P) */) {
mClipMgr.clearPrimaryClip();
} else {
ClipData clip = ClipData.newPlainText(null, "");
mClipMgr.setPrimaryClip(clip);
}
} else {
ClipData clip = ClipData.newPlainText(null, string);
mClipMgr.setPrimaryClip(clip);
}
mClipMgr.addPrimaryClipChangedListener(this);
}
@Override
@@ -15,6 +15,7 @@ import android.view.Display;
import android.view.InputDevice;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.PointerIcon;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
@@ -362,6 +363,16 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
}
}
// Prevent android internal NullPointerException (https://github.com/libsdl-org/SDL/issues/13306)
@Override
public PointerIcon onResolvePointerIcon(MotionEvent event, int pointerIndex) {
try {
return super.onResolvePointerIcon(event, pointerIndex);
} catch (NullPointerException e) {
return null;
}
}
// Captured pointer events for API 26.
public boolean onCapturedPointerEvent(MotionEvent event)
{
+11 -6
View File
@@ -542,6 +542,7 @@ class AndroidApiVersion:
def __repr__(self) -> str:
return f"<{self.name} ({'.'.join(str(v) for v in self.ints)})>"
ANDROID_ABI_EXTRA_LINK_OPTIONS = {}
class Releaser:
def __init__(self, release_info: dict, commit: str, revision: str, root: Path, dist_path: Path, section_printer: SectionPrinter, executer: Executer, cmake_generator: str, deps_path: Path, overwrite: bool, github: bool, fast: bool):
@@ -1013,6 +1014,7 @@ class Releaser:
android_devel_file_tree = ArchiveFileTree()
for android_abi in android_abis:
extra_link_options = ANDROID_ABI_EXTRA_LINK_OPTIONS.get(android_abi, "")
with self.section_printer.group(f"Building for Android {android_api} {android_abi}"):
build_dir = self.root / "build-android" / f"{android_abi}-build"
install_dir = self.root / "install-android" / f"{android_abi}-install"
@@ -1023,8 +1025,12 @@ class Releaser:
"cmake",
"-S", str(self.root),
"-B", str(build_dir),
f'''-DCMAKE_C_FLAGS="-ffile-prefix-map={self.root}=/src/{self.project}"''',
f'''-DCMAKE_CXX_FLAGS="-ffile-prefix-map={self.root}=/src/{self.project}"''',
# NDK 21e does not support -ffile-prefix-map
# f'''-DCMAKE_C_FLAGS="-ffile-prefix-map={self.root}=/src/{self.project}"''',
# f'''-DCMAKE_CXX_FLAGS="-ffile-prefix-map={self.root}=/src/{self.project}"''',
f"-DANDROID_USE_LEGACY_TOOLCHAIN=0",
f"-DCMAKE_EXE_LINKER_FLAGS={extra_link_options}",
f"-DCMAKE_SHARED_LINKER_FLAGS={extra_link_options}",
f"-DCMAKE_TOOLCHAIN_FILE={cmake_toolchain_file}",
f"-DCMAKE_PREFIX_PATH={str(android_deps_path)}",
f"-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH",
@@ -1121,8 +1127,7 @@ class Releaser:
for dep, depinfo in self.release_info.get("dependencies", {}).items():
startswith = depinfo["startswith"]
dep_repo = depinfo["repo"]
# FIXME: dropped "--exclude-pre-releases"
dep_string_data = self.executer.check_output(["gh", "-R", dep_repo, "release", "list", "--exclude-drafts", "--json", "name,createdAt,tagName", "--jq", f'[.[]|select(.name|startswith("{startswith}"))]|max_by(.createdAt)']).strip()
dep_string_data = self.executer.check_output(["gh", "-R", dep_repo, "release", "list", "--exclude-drafts", "--exclude-pre-releases", "--json", "name,createdAt,tagName", "--jq", f'[.[]|select(.name|startswith("{startswith}"))]|max_by(.createdAt)']).strip()
dep_data = json.loads(dep_string_data)
dep_tag = dep_data["tagName"]
dep_version = dep_data["name"]
@@ -1512,7 +1517,7 @@ def main(argv=None) -> int:
if args.android_home is None or not Path(args.android_home).is_dir():
parser.error("Invalid $ANDROID_HOME or --android-home: must be a directory containing the Android SDK")
if args.android_ndk_home is None or not Path(args.android_ndk_home).is_dir():
parser.error("Invalid $ANDROID_NDK_HOME or --android_ndk_home: must be a directory containing the Android NDK")
parser.error("Invalid $ANDROID_NDK_HOME or --android-ndk-home: must be a directory containing the Android NDK")
if args.android_api is None:
with section_printer.group("Detect Android APIS"):
args.android_api = releaser._detect_android_api(android_home=args.android_home)
@@ -1530,7 +1535,7 @@ def main(argv=None) -> int:
parser.error("Invalid --android-api, and/or could not be detected")
android_api_path = Path(args.android_home) / f"platforms/{args.android_api.name}"
if not android_api_path.is_dir():
parser.error(f"Android API directory does not exist ({android_api_path})")
logger.warning(f"Android API directory does not exist ({android_api_path})")
with section_printer.group("Android arguments"):
print(f"android_home = {args.android_home}")
print(f"android_ndk_home = {args.android_ndk_home}")
+127
View File
@@ -0,0 +1,127 @@
#!/bin/bash
progname="${0##*/}"
progname="${progname%.sh}"
# usage: check_elf_alignment.sh [path to *.so files|path to *.apk]
cleanup_trap() {
if [ -n "${tmp}" -a -d "${tmp}" ]; then
rm -rf ${tmp}
fi
exit $1
}
usage() {
echo "Host side script to check the ELF alignment of shared libraries."
echo "Shared libraries are reported ALIGNED when their ELF regions are"
echo "16 KB or 64 KB aligned. Otherwise they are reported as UNALIGNED."
echo
echo "Usage: ${progname} [input-path|input-APK|input-APEX]"
}
if [ ${#} -ne 1 ]; then
usage
exit
fi
case ${1} in
--help | -h | -\?)
usage
exit
;;
*)
dir="${1}"
;;
esac
if ! [ -f "${dir}" -o -d "${dir}" ]; then
echo "Invalid file: ${dir}" >&2
exit 1
fi
if [[ "${dir}" == *.apk ]]; then
trap 'cleanup_trap' EXIT
echo
echo "Recursively analyzing $dir"
echo
if { zipalign --help 2>&1 | grep -q "\-P <pagesize_kb>"; }; then
echo "=== APK zip-alignment ==="
zipalign -v -c -P 16 4 "${dir}" | egrep 'lib/arm64-v8a|lib/x86_64|Verification'
echo "========================="
else
echo "NOTICE: Zip alignment check requires build-tools version 35.0.0-rc3 or higher."
echo " You can install the latest build-tools by running the below command"
echo " and updating your \$PATH:"
echo
echo " sdkmanager \"build-tools;35.0.0-rc3\""
fi
dir_filename=$(basename "${dir}")
tmp=$(mktemp -d -t "${dir_filename%.apk}_out_XXXXX")
unzip "${dir}" lib/* -d "${tmp}" >/dev/null 2>&1
dir="${tmp}"
fi
if [[ "${dir}" == *.apex ]]; then
trap 'cleanup_trap' EXIT
echo
echo "Recursively analyzing $dir"
echo
dir_filename=$(basename "${dir}")
tmp=$(mktemp -d -t "${dir_filename%.apex}_out_XXXXX")
deapexer extract "${dir}" "${tmp}" || { echo "Failed to deapex." && exit 1; }
dir="${tmp}"
fi
RED="\e[31m"
GREEN="\e[32m"
ENDCOLOR="\e[0m"
unaligned_libs=()
unaligned_critical_libs=()
echo
echo "=== ELF alignment ==="
matches="$(find "${dir}" -type f)"
IFS=$'\n'
for match in $matches; do
# We could recursively call this script or rewrite it to though.
[[ "${match}" == *".apk" ]] && echo "WARNING: doesn't recursively inspect .apk file: ${match}"
[[ "${match}" == *".apex" ]] && echo "WARNING: doesn't recursively inspect .apex file: ${match}"
[[ $(file "${match}") == *"ELF"* ]] || continue
res="$(objdump -p "${match}" | grep LOAD | awk '{ print $NF }' | head -1)"
if [[ $res =~ 2\*\*(1[4-9]|[2-9][0-9]|[1-9][0-9]{2,}) ]]; then
echo -e "${match}: ${GREEN}ALIGNED${ENDCOLOR} ($res)"
else
unaligned_libs+=("${match}")
# Check if this is a critical architecture (arm64-v8a or x86_64)
if [[ "${match}" == *"arm64-v8a"* ]] || [[ "${match}" == *"x86_64"* ]]; then
unaligned_critical_libs+=("${match}")
echo -e "${match}: ${RED}UNALIGNED${ENDCOLOR} ($res)"
else
echo -e "${match}: UNALIGNED ($res)"
fi
fi
done
if [ ${#unaligned_libs[@]} -gt 0 ]; then
echo -e "Found ${#unaligned_libs[@]} unaligned libs (only arm64-v8a/x86_64 libs need to be aligned).${ENDCOLOR}"
fi
echo "====================="
# Exit with appropriate code: 1 if critical unaligned libs found, 0 otherwise
if [ ${#unaligned_critical_libs[@]} -gt 0 ]; then
echo -e "${RED}Found ${#unaligned_critical_libs[@]} critical unaligned libs.${ENDCOLOR}"
exit 1
else
echo -e "${GREEN}ELF Verification Successful${ENDCOLOR}"
exit 0
fi
@@ -33,9 +33,9 @@
#cmakedefine SDL_VENDOR_INFO "@SDL_VENDOR_INFO@"
#if defined(SDL_VENDOR_INFO)
#define SDL_REVISION "@<@PROJECT_REVISION@>@ (" SDL_VENDOR_INFO ")"
#define SDL_REVISION "SDL-@<@PROJECT_REVISION@>@ (" SDL_VENDOR_INFO ")"
#else
#define SDL_REVISION "@<@PROJECT_REVISION@>@"
#define SDL_REVISION "SDL-@<@PROJECT_REVISION@>@"
#endif
#endif /* SDL_revision_h_ */
@@ -48,9 +48,9 @@
*/
#define SDL_REVISION "Some arbitrary string decided at SDL build time"
#elif defined(SDL_VENDOR_INFO)
#define SDL_REVISION "@<@PROJECT_REVISION@>@ (" SDL_VENDOR_INFO ")"
#define SDL_REVISION "SDL-@<@PROJECT_REVISION@>@ (" SDL_VENDOR_INFO ")"
#else
#define SDL_REVISION "@<@PROJECT_REVISION@>@"
#define SDL_REVISION "SDL-@<@PROJECT_REVISION@>@"
#endif
#endif /* SDL_revision_h_ */
+1 -1
View File
@@ -183,7 +183,7 @@
],
"api-minimum": 21,
"api-target": 35,
"ndk-minimum": 21,
"ndk-minimum": 28,
"aar-files": {
"": [
"android-project/app/proguard-rules.pro:proguard.txt",
-21
View File
@@ -1,21 +0,0 @@
#!/bin/sh
#
# libtool assumes that the compiler can handle the -fPIC flag
# This isn't always true (for example, nasm can't handle it)
command=""
while [ $# -gt 0 ]; do
case "$1" in
-?PIC)
# Ignore -fPIC and -DPIC options
;;
-fno-common)
# Ignore -fPIC and -DPIC options
;;
*)
command="$command $1"
;;
esac
shift
done
echo $command
exec $command
+10 -5
View File
@@ -1,16 +1,21 @@
# Helper for Find modules
function(get_flags_from_pkg_config _library _pc_prefix _out_prefix)
if("${_library}" MATCHES "${CMAKE_STATIC_LIBRARY_SUFFIX}$")
set(_cflags ${_pc_prefix}_STATIC_CFLAGS_OTHER)
set(_link_libraries ${_pc_prefix}_STATIC_LIBRARIES)
set(_link_options ${_pc_prefix}_STATIC_LDFLAGS_OTHER)
set(_library_dirs ${_pc_prefix}_STATIC_LIBRARY_DIRS)
if(MINGW)
set(re_shared_suffix ".dll.a$")
else()
set(re_shared_suffix "${CMAKE_SHARED_LIBRARY_SUFFIX}$")
endif()
if("${_library}" MATCHES "${re_shared_suffix}")
set(_cflags ${_pc_prefix}_CFLAGS_OTHER)
set(_link_libraries ${_pc_prefix}_LIBRARIES)
set(_link_options ${_pc_prefix}_LDFLAGS_OTHER)
set(_library_dirs ${_pc_prefix}_LIBRARY_DIRS)
else()
set(_cflags ${_pc_prefix}_STATIC_CFLAGS_OTHER)
set(_link_libraries ${_pc_prefix}_STATIC_LIBRARIES)
set(_link_options ${_pc_prefix}_STATIC_LDFLAGS_OTHER)
set(_library_dirs ${_pc_prefix}_STATIC_LIBRARY_DIRS)
endif()
# The *_LIBRARIES lists always start with the library itself
+60
View File
@@ -160,3 +160,63 @@ function(SDL_AddCommonCompilerFlags TARGET)
endif()
endif()
endfunction()
function(check_x86_source_compiles BODY VAR)
if(ARGN)
message(FATAL_ERROR "Unknown arguments: ${ARGN}")
endif()
if(APPLE_MULTIARCH AND (SDL_CPU_X86 OR SDL_CPU_X64))
set(test_conditional 1)
else()
set(test_conditional 0)
endif()
check_c_source_compiles("
#if ${test_conditional}
# if defined(__i386__) || defined(__x86_64__)
# define test_enabled 1
# else
# define test_enabled 0 /* feign success in Apple multi-arch configs */
# endif
#else /* test normally */
# define test_enabled 1
#endif
#if test_enabled
${BODY}
#else
int main(int argc, char *argv[]) {
(void)argc;
(void)argv;
return 0;
}
#endif" ${VAR})
endfunction()
function(check_arm_source_compiles BODY VAR)
if(ARGN)
message(FATAL_ERROR "Unknown arguments: ${ARGN}")
endif()
if(APPLE_MULTIARCH AND (SDL_CPU_ARM32 OR SDL_CPU_ARM64))
set(test_conditional 1)
else()
set(test_conditional 0)
endif()
check_c_source_compiles("
#if ${test_conditional}
# if defined(__arm__) || defined(__aarch64__)
# define test_enabled 1
# else
# define test_enabled 0 /* feign success in Apple multi-arch configs */
# endif
#else /* test normally */
# define test_enabled 1
#endif
#if test_enabled
${BODY}
#else
int main(int argc, char *argv[]) {
(void)argc;
(void)argv;
return 0;
}
#endif" ${VAR})
endfunction()
+3 -3
View File
@@ -4,15 +4,15 @@ function(SDL_DetectTargetCPUArchitectures DETECTED_ARCHS)
if(APPLE AND CMAKE_OSX_ARCHITECTURES)
foreach(known_arch IN LISTS known_archs)
set(SDL_CPU_${known_arch} "0")
set(SDL_CPU_${known_arch} "0" PARENT_SCOPE)
endforeach()
set(detected_archs)
foreach(osx_arch IN LISTS CMAKE_OSX_ARCHITECTURES)
if(osx_arch STREQUAL "x86_64")
set(SDL_CPU_X64 "1")
set(SDL_CPU_X64 "1" PARENT_SCOPE)
list(APPEND detected_archs "X64")
elseif(osx_arch STREQUAL "arm64")
set(SDL_CPU_ARM64 "1")
set(SDL_CPU_ARM64 "1" PARENT_SCOPE)
list(APPEND detected_archs "ARM64")
endif()
endforeach()
+1 -1
View File
@@ -131,7 +131,7 @@ function(sdl_compile_options)
target_compile_options(SDL3-static ${visibility} ${escaped_opts})
endif()
if(NOT ARGS_NO_EXPORT AND (ARGS_PUBLIC OR ARGS_INTERFACE))
set_property(TARGET SDL3-collector APPEND PROPERTY INTERFACE_COMPILE_COMPILE_OPTIONS "${ARGS_UNPARSED_ARGUMENTS}")
set_property(TARGET SDL3-collector APPEND PROPERTY INTERFACE_COMPILE_OPTIONS "${ARGS_UNPARSED_ARGUMENTS}")
endif()
endfunction()
+1 -1
View File
@@ -20,7 +20,7 @@
*/
/**
* Main include header for the SDL library, version 3.2.18
* Main include header for the SDL library, version 3.2.29
*
* It is almost always best to include just this one header instead of
* picking out individual headers included here. There are exceptions to
+2 -2
View File
@@ -126,7 +126,7 @@ extern "C" {
*/
#define SDL_TriggerBreakpoint() TriggerABreakpointInAPlatformSpecificManner
#elif defined(_MSC_VER) && _MSC_VER >= 1310
#elif defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER >= 1310)
/* Don't include intrin.h here because it contains C++ code */
extern void __cdecl __debugbreak(void);
#define SDL_TriggerBreakpoint() __debugbreak()
@@ -362,7 +362,7 @@ extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *
#define SDL_enabled_assert(condition) \
do { \
while ( !(condition) ) { \
static struct SDL_AssertData sdl_assert_data = { 0, 0, #condition, 0, 0, 0, 0 }; \
static struct SDL_AssertData sdl_assert_data = { false, 0, #condition, NULL, 0, NULL, NULL }; \
const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
continue; /* go again. */ \
+4 -1
View File
@@ -942,7 +942,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID devid);
* Binding a stream to a device will set its output format for playback
* devices, and its input format for recording devices, so they match the
* device's settings. The caller is welcome to change the other end of the
* stream's format at any time with SDL_SetAudioStreamFormat().
* stream's format at any time with SDL_SetAudioStreamFormat(). If the other
* end of the stream's format has never been set (the audio stream was created
* with a NULL audio spec), this function will set it to match the device
* end's format.
*
* \param devid an audio device to bind a stream to.
* \param streams an array of audio streams to bind.
+1 -1
View File
@@ -119,7 +119,7 @@ typedef struct SDL_CameraSpec
int width; /**< Frame width */
int height; /**< Frame height */
int framerate_numerator; /**< Frame rate numerator ((num / denom) == FPS, (denom / num) == duration in seconds) */
int framerate_denominator; /**< Frame rate demoninator ((num / denom) == FPS, (denom / num) == duration in seconds) */
int framerate_denominator; /**< Frame rate denominator ((num / denom) == FPS, (denom / num) == duration in seconds) */
} SDL_CameraSpec;
/**
+16 -17
View File
@@ -106,7 +106,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetClipboardText(const char *text);
/**
* Get UTF-8 text from the clipboard.
*
* This functions returns an empty string if there was not enough memory left
* This function returns an empty string if there is not enough memory left
* for a copy of the clipboard's content.
*
* \returns the clipboard text on success or an empty string on failure; call
@@ -155,7 +155,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetPrimarySelectionText(const char *text);
/**
* Get UTF-8 text from the primary selection.
*
* This functions returns an empty string if there was not enough memory left
* This function returns an empty string if there is not enough memory left
* for a copy of the primary selection's content.
*
* \returns the primary selection text on success or an empty string on
@@ -194,15 +194,14 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasPrimarySelectionText(void);
* clipboard is cleared or new data is set. The clipboard is automatically
* cleared in SDL_Quit().
*
* \param userdata a pointer to provided user data.
* \param userdata a pointer to the provided user data.
* \param mime_type the requested mime-type.
* \param size a pointer filled in with the length of the returned data.
* \returns a pointer to the data for the provided mime-type. Returning NULL
* or setting length to 0 will cause no data to be sent to the
* "receiver". It is up to the receiver to handle this. Essentially
* returning no data is more or less undefined behavior and may cause
* breakage in receiving applications. The returned data will not be
* freed so it needs to be retained and dealt with internally.
* or setting the length to 0 will cause zero length data to be sent
* to the "receiver", which should be able to handle this. The
* returned data will not be freed, so it needs to be retained and
* dealt with internally.
*
* \since This function is available since SDL 3.2.0.
*
@@ -211,10 +210,10 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasPrimarySelectionText(void);
typedef const void *(SDLCALL *SDL_ClipboardDataCallback)(void *userdata, const char *mime_type, size_t *size);
/**
* Callback function that will be called when the clipboard is cleared, or new
* Callback function that will be called when the clipboard is cleared, or when new
* data is set.
*
* \param userdata a pointer to provided user data.
* \param userdata a pointer to the provided user data.
*
* \since This function is available since SDL 3.2.0.
*
@@ -231,7 +230,7 @@ typedef void (SDLCALL *SDL_ClipboardCleanupCallback)(void *userdata);
* respond with the data for the requested mime-type.
*
* The size of text data does not include any terminator, and the text does
* not need to be null terminated (e.g. you can directly copy a portion of a
* not need to be null-terminated (e.g., you can directly copy a portion of a
* document).
*
* \param callback a function pointer to the function that provides the
@@ -239,7 +238,7 @@ typedef void (SDLCALL *SDL_ClipboardCleanupCallback)(void *userdata);
* \param cleanup a function pointer to the function that cleans up the
* clipboard data.
* \param userdata an opaque pointer that will be forwarded to the callbacks.
* \param mime_types a list of mime-types that are being offered.
* \param mime_types a list of mime-types that are being offered. SDL copies the given list.
* \param num_mime_types the number of mime-types in the mime_types list.
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
@@ -269,10 +268,10 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetClipboardData(SDL_ClipboardDataCallback
extern SDL_DECLSPEC bool SDLCALL SDL_ClearClipboardData(void);
/**
* Get the data from clipboard for a given mime type.
* Get the data from the clipboard for a given mime type.
*
* The size of text data does not include the terminator, but the text is
* guaranteed to be null terminated.
* guaranteed to be null-terminated.
*
* \param mime_type the mime type to read from the clipboard.
* \param size a pointer filled in with the length of the returned data.
@@ -292,8 +291,8 @@ extern SDL_DECLSPEC void * SDLCALL SDL_GetClipboardData(const char *mime_type, s
/**
* Query whether there is data in the clipboard for the provided mime type.
*
* \param mime_type the mime type to check for data for.
* \returns true if there exists data in clipboard for the provided mime type,
* \param mime_type the mime type to check for data.
* \returns true if data exists in the clipboard for the provided mime type,
* false if it does not.
*
* \threadsafety This function should only be called on the main thread.
@@ -310,7 +309,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasClipboardData(const char *mime_type);
*
* \param num_mime_types a pointer filled with the number of mime types, may
* be NULL.
* \returns a null terminated array of strings with mime types, or NULL on
* \returns a null-terminated array of strings with mime types, or NULL on
* failure; call SDL_GetError() for more information. This should be
* freed with SDL_free() when it is no longer needed.
*
+2 -2
View File
@@ -46,7 +46,7 @@
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
/* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version,
so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */
#ifdef __clang__
#if defined(__clang__) && !SDL_HAS_BUILTIN(_m_prefetch)
#ifndef __PRFCHWINTRIN_H
#define __PRFCHWINTRIN_H
static __inline__ void __attribute__((__always_inline__, __nodebug__))
@@ -128,7 +128,7 @@ _m_prefetch(void *__P)
* \sa SDL_BIG_ENDIAN
*/
#define SDL_BYTEORDER SDL_LIL_ENDIAN___or_maybe___SDL_BIG_ENDIAN
#elif defined(SDL_PLATFORM_LINUX)
#elif defined(SDL_PLATFORM_LINUX) || defined(__GLIBC__)
#include <endian.h>
#define SDL_BYTEORDER __BYTE_ORDER
#elif defined(SDL_PLATFORM_SOLARIS)
+1 -1
View File
@@ -1043,7 +1043,7 @@ typedef union SDL_Event
} SDL_Event;
/* Make sure we haven't broken binary compatibility */
SDL_COMPILE_TIME_ASSERT(SDL_Event, sizeof(SDL_Event) == sizeof(((SDL_Event *)NULL)->padding));
SDL_COMPILE_TIME_ASSERT(SDL_Event, sizeof(SDL_Event) == sizeof((SDL_static_cast(SDL_Event *, NULL))->padding));
/* Function prototypes */
+5 -5
View File
@@ -224,8 +224,8 @@
* - `drawIndirectFirstInstance`
*
* **D3D12:** Supported on Windows 10 or newer, Xbox One (GDK), and Xbox
* Series X|S (GDK). Requires a GPU that supports DirectX 12 Feature Level
* 11_1.
* Series X|S (GDK). Requires a GPU that supports DirectX 12 Feature Level 11_0 and
* Resource Binding Tier 2 or above.
*
* **Metal:** Supported on macOS 10.14+ and iOS/tvOS 13.0+. Hardware
* requirements vary by operating system:
@@ -1091,7 +1091,7 @@ typedef enum SDL_GPUCompareOp
SDL_GPU_COMPAREOP_LESS_OR_EQUAL, /**< The comparison evaluates reference <= test. */
SDL_GPU_COMPAREOP_GREATER, /**< The comparison evaluates reference > test. */
SDL_GPU_COMPAREOP_NOT_EQUAL, /**< The comparison evaluates reference != test. */
SDL_GPU_COMPAREOP_GREATER_OR_EQUAL, /**< The comparison evalutes reference >= test. */
SDL_GPU_COMPAREOP_GREATER_OR_EQUAL, /**< The comparison evaluates reference >= test. */
SDL_GPU_COMPAREOP_ALWAYS /**< The comparison always evaluates true. */
} SDL_GPUCompareOp;
@@ -1549,7 +1549,7 @@ typedef struct SDL_GPUSamplerCreateInfo
typedef struct SDL_GPUVertexBufferDescription
{
Uint32 slot; /**< The binding slot of the vertex buffer. */
Uint32 pitch; /**< The byte pitch between consecutive elements of the vertex buffer. */
Uint32 pitch; /**< The size of a single element + the offset between elements. */
SDL_GPUVertexInputRate input_rate; /**< Whether attribute addressing is a function of the vertex index or instance index. */
Uint32 instance_step_rate; /**< Reserved for future use. Must be set to 0. */
} SDL_GPUVertexBufferDescription;
@@ -2648,7 +2648,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_InsertGPUDebugLabel(
const char *text);
/**
* Begins a debug group with an arbitary name.
* Begins a debug group with an arbitrary name.
*
* Used for denoting groups of calls when viewing the command buffer
* callstream in a graphics debugging tool.
+3 -3
View File
@@ -595,7 +595,7 @@ extern "C" {
* A variable that limits what CPU features are available.
*
* By default, SDL marks all features the current CPU supports as available.
* This hint allows to limit these to a subset.
* This hint allows the enabled features to be limited to a subset.
*
* When the hint is unset, or empty, SDL will enable all detected CPU
* features.
@@ -2126,8 +2126,8 @@ extern "C" {
*
* The variable can be set to the following values:
*
* - "0": WGI is not used.
* - "1": WGI is used. (default)
* - "0": WGI is not used. (default)
* - "1": WGI is used.
*
* This hint should be set before SDL is initialized.
*
+4 -2
View File
@@ -280,12 +280,14 @@ _m_prefetch(void *__P)
* \sa SDL_TARGETING
*/
#define SDL_HAS_TARGET_ATTRIBS
#elif defined(__loongarch64) && defined(__GNUC__) && (__GNUC__ >= 15)
/* LoongArch requires GCC 15+ for target attribute support */
# define SDL_HAS_TARGET_ATTRIBS
#elif defined(__clang__) && defined(__has_attribute)
# if __has_attribute(target)
# define SDL_HAS_TARGET_ATTRIBS
# endif
#elif defined(__GNUC__) && (__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) /* gcc >= 4.9 */
#elif defined(__GNUC__) && !defined(__loongarch64) && (__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) /* gcc >= 4.9 */
# define SDL_HAS_TARGET_ATTRIBS
#elif defined(__ICC) && __ICC >= 1600
# define SDL_HAS_TARGET_ATTRIBS
+3 -3
View File
@@ -360,7 +360,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LockMutex(SDL_Mutex *mutex) SDL_ACQUIRE(mut
* \sa SDL_LockMutex
* \sa SDL_UnlockMutex
*/
extern SDL_DECLSPEC bool SDLCALL SDL_TryLockMutex(SDL_Mutex *mutex) SDL_TRY_ACQUIRE(0, mutex);
extern SDL_DECLSPEC bool SDLCALL SDL_TryLockMutex(SDL_Mutex *mutex) SDL_TRY_ACQUIRE(true, mutex);
/**
* Unlock the mutex.
@@ -559,7 +559,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LockRWLockForWriting(SDL_RWLock *rwlock) SD
* \sa SDL_TryLockRWLockForWriting
* \sa SDL_UnlockRWLock
*/
extern SDL_DECLSPEC bool SDLCALL SDL_TryLockRWLockForReading(SDL_RWLock *rwlock) SDL_TRY_ACQUIRE_SHARED(0, rwlock);
extern SDL_DECLSPEC bool SDLCALL SDL_TryLockRWLockForReading(SDL_RWLock *rwlock) SDL_TRY_ACQUIRE_SHARED(true, rwlock);
/**
* Try to lock a read/write lock _for writing_ without blocking.
@@ -589,7 +589,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_TryLockRWLockForReading(SDL_RWLock *rwlock)
* \sa SDL_TryLockRWLockForReading
* \sa SDL_UnlockRWLock
*/
extern SDL_DECLSPEC bool SDLCALL SDL_TryLockRWLockForWriting(SDL_RWLock *rwlock) SDL_TRY_ACQUIRE(0, rwlock);
extern SDL_DECLSPEC bool SDLCALL SDL_TryLockRWLockForWriting(SDL_RWLock *rwlock) SDL_TRY_ACQUIRE(true, rwlock);
/**
* Unlock the read/write lock.
+4 -4
View File
@@ -125,10 +125,10 @@ typedef struct SDL_FRect
*/
SDL_FORCE_INLINE void SDL_RectToFRect(const SDL_Rect *rect, SDL_FRect *frect)
{
frect->x = (float)rect->x;
frect->y = (float)rect->y;
frect->w = (float)rect->w;
frect->h = (float)rect->h;
frect->x = SDL_static_cast(float, rect->x);
frect->y = SDL_static_cast(float, rect->y);
frect->w = SDL_static_cast(float, rect->w);
frect->h = SDL_static_cast(float, rect->h);
}
/**
+1 -1
View File
@@ -2612,7 +2612,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderDebugText(SDL_Renderer *renderer, flo
* Draw debug text to an SDL_Renderer.
*
* This function will render a printf()-style format string to a renderer.
* Note that this is a convinence function for debugging, with severe
* Note that this is a convenience function for debugging, with severe
* limitations, and is not intended to be used for production apps and games.
*
* For the full list of limitations and other useful information, see
+1 -1
View File
@@ -208,7 +208,7 @@ typedef enum SDL_Scancode
SDL_SCANCODE_NONUSBACKSLASH = 100, /**< This is the additional key that ISO
* keyboards have over ANSI ones,
* located between left shift and Y.
* located between left shift and Z.
* Produces GRAVE ACCENT and TILDE in a
* US or UK Mac layout, REVERSE SOLIDUS
* (backslash) and VERTICAL LINE in a
+2 -1
View File
@@ -138,7 +138,8 @@ typedef enum SDL_SensorType
SDL_SENSOR_ACCEL_L, /**< Accelerometer for left Joy-Con controller and Wii nunchuk */
SDL_SENSOR_GYRO_L, /**< Gyroscope for left Joy-Con controller */
SDL_SENSOR_ACCEL_R, /**< Accelerometer for right Joy-Con controller */
SDL_SENSOR_GYRO_R /**< Gyroscope for right Joy-Con controller */
SDL_SENSOR_GYRO_R, /**< Gyroscope for right Joy-Con controller */
SDL_SENSOR_COUNT
} SDL_SensorType;
+13 -13
View File
@@ -1164,7 +1164,7 @@ typedef struct SDL_alignment_test
void *b;
} SDL_alignment_test;
SDL_COMPILE_TIME_ASSERT(struct_alignment, sizeof(SDL_alignment_test) == (2 * sizeof(void *)));
SDL_COMPILE_TIME_ASSERT(two_s_complement, (int)~(int)0 == (int)(-1));
SDL_COMPILE_TIME_ASSERT(two_s_complement, SDL_static_cast(int, ~SDL_static_cast(int, 0)) == SDL_static_cast(int, -1));
#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
/** \endcond */
@@ -3426,7 +3426,7 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_utf8strnlen(const char *str, size_t bytes
* Convert an integer into a string.
*
* This requires a radix to specified for string format. Specifying 10
* produces a decimal number, 16 hexidecimal, etc. Must be in the range of 2
* produces a decimal number, 16 hexadecimal, etc. Must be in the range of 2
* to 36.
*
* Note that this function will overflow a buffer if `str` is not large enough
@@ -3454,7 +3454,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_itoa(int value, char *str, int radix);
* Convert an unsigned integer into a string.
*
* This requires a radix to specified for string format. Specifying 10
* produces a decimal number, 16 hexidecimal, etc. Must be in the range of 2
* produces a decimal number, 16 hexadecimal, etc. Must be in the range of 2
* to 36.
*
* Note that this function will overflow a buffer if `str` is not large enough
@@ -3482,7 +3482,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_uitoa(unsigned int value, char *str, int
* Convert a long integer into a string.
*
* This requires a radix to specified for string format. Specifying 10
* produces a decimal number, 16 hexidecimal, etc. Must be in the range of 2
* produces a decimal number, 16 hexadecimal, etc. Must be in the range of 2
* to 36.
*
* Note that this function will overflow a buffer if `str` is not large enough
@@ -3510,7 +3510,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_ltoa(long value, char *str, int radix);
* Convert an unsigned long integer into a string.
*
* This requires a radix to specified for string format. Specifying 10
* produces a decimal number, 16 hexidecimal, etc. Must be in the range of 2
* produces a decimal number, 16 hexadecimal, etc. Must be in the range of 2
* to 36.
*
* Note that this function will overflow a buffer if `str` is not large enough
@@ -3540,7 +3540,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_ultoa(unsigned long value, char *str, int
* Convert a long long integer into a string.
*
* This requires a radix to specified for string format. Specifying 10
* produces a decimal number, 16 hexidecimal, etc. Must be in the range of 2
* produces a decimal number, 16 hexadecimal, etc. Must be in the range of 2
* to 36.
*
* Note that this function will overflow a buffer if `str` is not large enough
@@ -3568,7 +3568,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_lltoa(long long value, char *str, int rad
* Convert an unsigned long long integer into a string.
*
* This requires a radix to specified for string format. Specifying 10
* produces a decimal number, 16 hexidecimal, etc. Must be in the range of 2
* produces a decimal number, 16 hexadecimal, etc. Must be in the range of 2
* to 36.
*
* Note that this function will overflow a buffer if `str` is not large enough
@@ -3923,7 +3923,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str
extern SDL_DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen);
/**
* Searches a string for the first occurence of any character contained in a
* Searches a string for the first occurrence of any character contained in a
* breakset, and returns a pointer from the string to that character.
*
* \param str The null-terminated string to be searched. Must not be NULL, and
@@ -3931,7 +3931,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *st
* \param breakset A null-terminated string containing the list of characters
* to look for. Must not be NULL, and must not overlap with
* `str`.
* \returns A pointer to the location, in str, of the first occurence of a
* \returns A pointer to the location, in str, of the first occurrence of a
* character present in the breakset, or NULL if none is found.
*
* \threadsafety It is safe to call this function from any thread.
@@ -5821,7 +5821,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
* This function converts text between encodings, reading from and writing to
* a buffer.
*
* It returns the number of succesful conversions on success. On error,
* It returns the number of successful conversions on success. On error,
* SDL_ICONV_E2BIG is returned when the output buffer is too small, or
* SDL_ICONV_EILSEQ is returned when an invalid input sequence is encountered,
* or SDL_ICONV_EINVAL is returned when an incomplete input sequence is
@@ -5921,7 +5921,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode,
*
* \since This macro is available since SDL 3.2.0.
*/
#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1)
#define SDL_iconv_utf8_ucs2(S) SDL_reinterpret_cast(Uint16 *, SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1))
/**
* Convert a UTF-8 string to UCS-4.
@@ -5935,7 +5935,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode,
*
* \since This macro is available since SDL 3.2.0.
*/
#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1)
#define SDL_iconv_utf8_ucs4(S) SDL_reinterpret_cast(Uint32 *, SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1))
/**
* Convert a wchar_t string to UTF-8.
@@ -5949,7 +5949,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode,
*
* \since This macro is available since SDL 3.2.0.
*/
#define SDL_iconv_wchar_utf8(S) SDL_iconv_string("UTF-8", "WCHAR_T", (char *)S, (SDL_wcslen(S)+1)*sizeof(wchar_t))
#define SDL_iconv_wchar_utf8(S) SDL_iconv_string("UTF-8", "WCHAR_T", SDL_reinterpret_cast(const char *, S), (SDL_wcslen(S)+1)*sizeof(wchar_t))
/* force builds using Clang's static analysis tools to use literal C runtime
+1 -1
View File
@@ -62,7 +62,7 @@ extern "C" {
*
* \since This macro is available since SDL 3.2.0.
*/
#define SDL_MICRO_VERSION 18
#define SDL_MICRO_VERSION 29
/**
* This macro turns the version numbers into a numeric value.
+1 -1
View File
@@ -1473,7 +1473,7 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetWindowParent(SDL_Window *window)
* - `SDL_PROP_WINDOW_COCOA_WINDOW_POINTER`: the `(__unsafe_unretained)`
* NSWindow associated with the window
* - `SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER`: the NSInteger tag
* assocated with metal views on the window
* associated with metal views on the window
*
* On OpenVR:
*
@@ -174,6 +174,7 @@
#cmakedefine HAVE_MEMFD_CREATE 1
#cmakedefine HAVE_POSIX_FALLOCATE 1
#cmakedefine HAVE_SIGACTION 1
#cmakedefine HAVE_SIGTIMEDWAIT 1
#cmakedefine HAVE_SA_SIGACTION 1
#cmakedefine HAVE_ST_MTIM 1
#cmakedefine HAVE_SETJMP 1
@@ -111,6 +111,9 @@ typedef unsigned int uintptr_t;
# define SDL_DISABLE_AVX 1
#endif
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
/* This can be disabled to avoid C runtime dependencies and manifest requirements */
#ifndef HAVE_LIBC
#define HAVE_LIBC 1
@@ -122,8 +125,6 @@ typedef unsigned int uintptr_t;
#define HAVE_LIMITS_H 1
#define HAVE_MATH_H 1
#define HAVE_SIGNAL_H 1
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
#define HAVE_STDIO_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
@@ -153,7 +154,6 @@ typedef unsigned int uintptr_t;
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE_STRPBRK 1
#define HAVE_VSSCANF 1
#define HAVE_VSNPRINTF 1
#define HAVE_ACOS 1
#define HAVE_ASIN 1
@@ -211,10 +211,7 @@ typedef unsigned int uintptr_t;
#if _MSC_VER >= 1400
#define HAVE__FSEEKI64 1
#endif
#endif /* _MSC_VER */
#else
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
#endif /* _MSC_VER */
#endif
/* Enable various audio drivers */
+14 -8
View File
@@ -597,15 +597,21 @@ void SDL_LogMessageV(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_S
}
// If message truncated, allocate and re-render
if (len >= sizeof(stack_buf) && SDL_size_add_check_overflow(len, 1, &len_plus_term)) {
// Allocate exactly what we need, including the zero-terminator
message = (char *)SDL_malloc(len_plus_term);
if (!message) {
return;
if (len >= sizeof(stack_buf)) {
if (SDL_size_add_check_overflow(len, 1, &len_plus_term)) {
// Allocate exactly what we need, including the zero-terminator
message = (char *)SDL_malloc(len_plus_term);
if (!message) {
return;
}
va_copy(aq, ap);
len = SDL_vsnprintf(message, len_plus_term, fmt, aq);
va_end(aq);
} else {
// Allocation would overflow, use truncated message
message = stack_buf;
len = sizeof(stack_buf);
}
va_copy(aq, ap);
len = SDL_vsnprintf(message, len_plus_term, fmt, aq);
va_end(aq);
} else {
message = stack_buf;
}
+19 -5
View File
@@ -1153,7 +1153,10 @@ bool SDL_PlaybackAudioThreadIterate(SDL_AudioDevice *device)
// We should have updated this elsewhere if the format changed!
SDL_assert(SDL_AudioSpecsEqual(&stream->dst_spec, &device->spec, NULL, NULL));
SDL_assert(stream->src_spec.format != SDL_AUDIO_UNKNOWN);
const int br = SDL_GetAtomicInt(&logdev->paused) ? 0 : SDL_GetAudioStreamDataAdjustGain(stream, device_buffer, buffer_size, logdev->gain);
if (br < 0) { // Probably OOM. Kill the audio device; the whole thing is likely dying soon anyhow.
failed = true;
SDL_memset(device_buffer, device->silence_value, buffer_size); // just supply silence to the device before we die.
@@ -1195,6 +1198,8 @@ bool SDL_PlaybackAudioThreadIterate(SDL_AudioDevice *device)
// We should have updated this elsewhere if the format changed!
SDL_assert(SDL_AudioSpecsEqual(&stream->dst_spec, &outspec, NULL, NULL));
SDL_assert(stream->src_spec.format != SDL_AUDIO_UNKNOWN);
/* this will hold a lock on `stream` while getting. We don't explicitly lock the streams
for iterating here because the binding linked list can only change while the device lock is held.
(we _do_ lock the stream during binding/unbinding to make sure that two threads can't try to bind
@@ -1249,7 +1254,11 @@ void SDL_PlaybackAudioThreadShutdown(SDL_AudioDevice *device)
const int frames = device->buffer_size / SDL_AUDIO_FRAMESIZE(device->spec);
// Wait for the audio to drain if device didn't die.
if (!SDL_GetAtomicInt(&device->zombie)) {
SDL_Delay(((frames * 1000) / device->spec.freq) * 2);
int delay = ((frames * 1000) / device->spec.freq) * 2;
if (delay > 100) {
delay = 100;
}
SDL_Delay(delay);
}
current_audio.impl.ThreadDeinit(device);
SDL_AudioThreadFinalize(device);
@@ -1330,6 +1339,7 @@ bool SDL_RecordingAudioThreadIterate(SDL_AudioDevice *device)
SDL_assert(stream->src_spec.format == ((logdev->postmix || (logdev->gain != 1.0f)) ? SDL_AUDIO_F32 : device->spec.format));
SDL_assert(stream->src_spec.channels == device->spec.channels);
SDL_assert(stream->src_spec.freq == device->spec.freq);
SDL_assert(stream->dst_spec.format != SDL_AUDIO_UNKNOWN);
void *final_buf = output_buffer;
@@ -1975,10 +1985,6 @@ bool SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream * const *stre
} else if (logdev->simplified) {
result = SDL_SetError("Cannot change stream bindings on device opened with SDL_OpenAudioDeviceStream");
} else {
// !!! FIXME: We'll set the device's side's format below, but maybe we should refuse to bind a stream if the app's side doesn't have a format set yet.
// !!! FIXME: Actually, why do we allow there to be an invalid format, again?
// make sure start of list is sane.
SDL_assert(!logdev->bound_streams || (logdev->bound_streams->prev_binding == NULL));
@@ -2013,9 +2019,17 @@ bool SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream * const *stre
if (result) {
// Now that everything is verified, chain everything together.
const bool recording = device->recording;
for (int i = 0; i < num_streams; i++) {
SDL_AudioStream *stream = streams[i];
if (stream) { // shouldn't be NULL, but just in case...
// if the stream never had its non-device-end format set, just set it to the device end's format.
if (recording && (stream->dst_spec.format == SDL_AUDIO_UNKNOWN)) {
SDL_copyp(&stream->dst_spec, &device->spec);
} else if (!recording && (stream->src_spec.format == SDL_AUDIO_UNKNOWN)) {
SDL_copyp(&stream->src_spec, &device->spec);
}
stream->bound_device = logdev;
stream->prev_binding = NULL;
stream->next_binding = logdev->bound_streams;
+4
View File
@@ -537,8 +537,10 @@ static void SDL_TARGETING("ssse3") SDL_Convert_Swap32_SSSE3(Uint32* dst, const U
// behavior. However, the compiler support for this pragma is bad.
#if defined(__clang__)
#if __clang_major__ >= 12
#if defined(__aarch64__)
#pragma STDC FENV_ACCESS ON
#endif
#endif
#elif defined(_MSC_VER)
#pragma fenv_access (on)
#elif defined(__GNUC__)
@@ -814,8 +816,10 @@ static void SDL_Convert_Swap32_NEON(Uint32* dst, const Uint32* src, int num_samp
#if defined(__clang__)
#if __clang_major__ >= 12
#if defined(__aarch64__)
#pragma STDC FENV_ACCESS DEFAULT
#endif
#endif
#elif defined(_MSC_VER)
#pragma fenv_access (off)
#elif defined(__GNUC__)
+11 -2
View File
@@ -1775,6 +1775,7 @@ static bool WaveLoad(SDL_IOStream *src, WaveFile *file, SDL_AudioSpec *spec, Uin
int result;
Uint32 chunkcount = 0;
Uint32 chunkcountlimit = 10000;
const Sint64 flen = SDL_GetIOSize(src); // this might be -1 if the IOStream can't determine the total size.
const char *hint;
Sint64 RIFFstart, RIFFend, lastchunkpos;
bool RIFFlengthknown = false;
@@ -1883,6 +1884,14 @@ static bool WaveLoad(SDL_IOStream *src, WaveFile *file, SDL_AudioSpec *spec, Uin
fmtchunk = *chunk;
}
} else if (chunk->fourcc == DATA) {
/* If the data chunk is bigger than the file, it might be corrupt
or the file is truncated. Try to recover by clamping the file
size. This also means a malicious file can't allocate 4 gigabytes
for the chunks without actually supplying a 4 gigabyte file. */
if ((flen > 0) && ((chunk->position + chunk->length) > flen)) {
chunk->length = (Uint32) (flen - chunk->position);
}
/* Only use the first data chunk. Handling the wavl list madness
* may require a different approach.
*/
@@ -2114,8 +2123,8 @@ bool SDL_LoadWAV_IO(SDL_IOStream *src, bool closeio, SDL_AudioSpec *spec, Uint8
result = WaveLoad(src, &file, spec, audio_buf, audio_len);
if (!result) {
SDL_free(*audio_buf);
audio_buf = NULL;
audio_len = 0;
*audio_buf = NULL;
*audio_len = 0;
}
// Cleanup
-2
View File
@@ -461,8 +461,6 @@ static void ALSA_CloseDevice(SDL_AudioDevice *device)
{
if (device->hidden) {
if (device->hidden->pcm) {
// Wait for the submitted audio to drain. ALSA_snd_pcm_drop() can hang, so don't use that.
SDL_Delay(((device->sample_frames * 1000) / device->spec.freq) * 2);
ALSA_snd_pcm_close(device->hidden->pcm);
}
SDL_free(device->hidden->mixbuf);
+2 -1
View File
@@ -420,7 +420,8 @@ static bool UpdateAudioSession(SDL_AudioDevice *device, bool open, bool allow_pl
hint = SDL_GetHint(SDL_HINT_AUDIO_CATEGORY);
if (hint) {
if (SDL_strcasecmp(hint, "AVAudioSessionCategoryAmbient") == 0) {
if (SDL_strcasecmp(hint, "AVAudioSessionCategoryAmbient") == 0 ||
SDL_strcasecmp(hint, "ambient") == 0) {
category = AVAudioSessionCategoryAmbient;
} else if (SDL_strcasecmp(hint, "AVAudioSessionCategorySoloAmbient") == 0) {
category = AVAudioSessionCategorySoloAmbient;
+13 -8
View File
@@ -426,28 +426,33 @@ static void OPENSLES_DestroyPCMPlayer(SDL_AudioDevice *device)
static bool OPENSLES_CreatePCMPlayer(SDL_AudioDevice *device)
{
/* If we want to add floating point audio support (requires API level 21)
it can be done as described here:
https://developer.android.com/ndk/guides/audio/opensl/android-extensions.html#floating-point
*/
/* according to https://developer.android.com/ndk/guides/audio/opensl/opensl-for-android,
Android's OpenSL ES only supports Uint8 and _littleendian_ Sint16.
(and float32, with an extension we use, below.) */
if (SDL_GetAndroidSDKVersion() >= 21) {
const SDL_AudioFormat *closefmts = SDL_ClosestAudioFormats(device->spec.format);
SDL_AudioFormat test_format;
while ((test_format = *(closefmts++)) != 0) {
if (SDL_AUDIO_ISSIGNED(test_format)) {
switch (test_format) {
case SDL_AUDIO_U8:
case SDL_AUDIO_S16LE:
case SDL_AUDIO_F32:
break;
default:
continue;
}
break;
}
if (!test_format) {
// Didn't find a compatible format :
LOGI("No compatible audio format, using signed 16-bit audio");
test_format = SDL_AUDIO_S16;
LOGI("No compatible audio format, using signed 16-bit LE audio");
test_format = SDL_AUDIO_S16LE;
}
device->spec.format = test_format;
} else {
// Just go with signed 16-bit audio as it's the most compatible
device->spec.format = SDL_AUDIO_S16;
device->spec.format = SDL_AUDIO_S16LE;
}
// Update the fragment size as size in bytes
+1 -1
View File
@@ -114,7 +114,7 @@ static bool PSPAUDIO_PlayDevice(SDL_AudioDevice *device, const Uint8 *buffer, in
} else {
rc = sceAudioOutputPannedBlocking(device->hidden->channel, PSP_AUDIO_VOLUME_MAX, PSP_AUDIO_VOLUME_MAX, (void *) buffer);
}
return (rc == 0);
return (rc >= 0);
}
static bool PSPAUDIO_WaitDevice(SDL_AudioDevice *device)
+67 -3
View File
@@ -595,6 +595,71 @@ static void PulseStreamStateChangeCallback(pa_stream *stream, void *userdata)
PULSEAUDIO_pa_threaded_mainloop_signal(pulseaudio_threaded_mainloop, 0); // just signal any waiting code, it can look up the details.
}
// Channel maps that match the order in SDL_Audio.h
static const pa_channel_position_t Pulse_map_1[] = { PA_CHANNEL_POSITION_MONO };
static const pa_channel_position_t Pulse_map_2[] = { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT };
static const pa_channel_position_t Pulse_map_3[] = { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT,
PA_CHANNEL_POSITION_LFE };
static const pa_channel_position_t Pulse_map_4[] = { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT,
PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT };
static const pa_channel_position_t Pulse_map_5[] = { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT,
PA_CHANNEL_POSITION_LFE,
PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT };
static const pa_channel_position_t Pulse_map_6[] = { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT,
PA_CHANNEL_POSITION_FRONT_CENTER, PA_CHANNEL_POSITION_LFE,
PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT };
static const pa_channel_position_t Pulse_map_7[] = { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT,
PA_CHANNEL_POSITION_FRONT_CENTER, PA_CHANNEL_POSITION_LFE,
PA_CHANNEL_POSITION_REAR_CENTER,
PA_CHANNEL_POSITION_SIDE_LEFT, PA_CHANNEL_POSITION_SIDE_RIGHT };
static const pa_channel_position_t Pulse_map_8[] = { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT,
PA_CHANNEL_POSITION_FRONT_CENTER, PA_CHANNEL_POSITION_LFE,
PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT,
PA_CHANNEL_POSITION_SIDE_LEFT, PA_CHANNEL_POSITION_SIDE_RIGHT };
#define COPY_CHANNEL_MAP(c) SDL_memcpy(pacmap->map, Pulse_map_##c, sizeof(Pulse_map_##c))
static void PulseCreateChannelMap(pa_channel_map *pacmap, uint8_t channels)
{
SDL_assert(channels <= PA_CHANNELS_MAX);
pacmap->channels = channels;
switch (channels) {
case 1:
COPY_CHANNEL_MAP(1);
break;
case 2:
COPY_CHANNEL_MAP(2);
break;
case 3:
COPY_CHANNEL_MAP(3);
break;
case 4:
COPY_CHANNEL_MAP(4);
break;
case 5:
COPY_CHANNEL_MAP(5);
break;
case 6:
COPY_CHANNEL_MAP(6);
break;
case 7:
COPY_CHANNEL_MAP(7);
break;
case 8:
COPY_CHANNEL_MAP(8);
break;
}
}
static bool PULSEAUDIO_OpenDevice(SDL_AudioDevice *device)
{
const bool recording = device->recording;
@@ -683,9 +748,8 @@ static bool PULSEAUDIO_OpenDevice(SDL_AudioDevice *device)
PULSEAUDIO_pa_threaded_mainloop_lock(pulseaudio_threaded_mainloop);
const char *name = SDL_GetHint(SDL_HINT_AUDIO_DEVICE_STREAM_NAME);
// The SDL ALSA output hints us that we use Windows' channel mapping
// https://bugzilla.libsdl.org/show_bug.cgi?id=110
PULSEAUDIO_pa_channel_map_init_auto(&pacmap, device->spec.channels, PA_CHANNEL_MAP_WAVEEX);
PulseCreateChannelMap(&pacmap, device->spec.channels);
h->stream = PULSEAUDIO_pa_stream_new(
pulseaudio_context,
+1 -1
View File
@@ -814,7 +814,7 @@ static void ANDROIDCAMERA_Deinitialize(void)
static bool ANDROIDCAMERA_Init(SDL_CameraDriverImpl *impl)
{
// !!! FIXME: slide this off into a subroutine
// system libraries are in android-24 and later; we currently target android-16 and later, so check if they exist at runtime.
// system libraries are in android-24 and later; we currently target android-21 and later, so check if they exist at runtime.
void *libcamera2 = dlopen("libcamera2ndk.so", RTLD_NOW | RTLD_LOCAL);
if (!libcamera2) {
SDL_Log("CAMERA: libcamera2ndk.so can't be loaded: %s", dlerror());
+2 -2
View File
@@ -570,7 +570,7 @@ static bool V4L2_OpenDevice(SDL_Camera *device, const SDL_CameraSpec *spec)
setfps.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (xioctl(fd, VIDIOC_G_PARM, &setfps) == 0) {
if ( (setfps.parm.capture.timeperframe.denominator != spec->framerate_numerator) ||
(setfps.parm.capture.timeperframe.numerator = spec->framerate_denominator) ) {
(setfps.parm.capture.timeperframe.numerator != spec->framerate_denominator) ) {
setfps.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
setfps.parm.capture.timeperframe.numerator = spec->framerate_denominator;
setfps.parm.capture.timeperframe.denominator = spec->framerate_numerator;
@@ -796,7 +796,7 @@ static void MaybeAddDevice(const char *path)
const int stepw = (int) frmsizeenum.stepwise.step_width;
const int steph = (int) frmsizeenum.stepwise.step_height;
for (int w = minw; w <= maxw; w += stepw) {
for (int h = minh; w <= maxh; w += steph) {
for (int h = minh; h <= maxh; h += steph) {
#if DEBUG_CAMERA
SDL_Log("CAMERA: * Has %s size %dx%d", (frmsizeenum.type == V4L2_FRMSIZE_TYPE_STEPWISE) ? "stepwise" : "continuous", w, h);
#endif
+1 -2
View File
@@ -207,7 +207,6 @@ Sint32 JNI_OnLoad(void *vm, void *reserved)
{
(void)vm;
(void)reserved;
SDL_Unsupported();
return -1; // JNI_ERR
return 0x00010004; // JNI_VERSION_1_4
}
#endif
+11 -3
View File
@@ -1080,7 +1080,8 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeAddTouch)(
{
const char *utfname = (*env)->GetStringUTFChars(env, name, NULL);
SDL_AddTouch((SDL_TouchID)touchId, SDL_TOUCH_DEVICE_DIRECT, utfname);
SDL_AddTouch(Android_ConvertJavaTouchID(touchId),
SDL_TOUCH_DEVICE_DIRECT, utfname);
(*env)->ReleaseStringUTFChars(env, name, utfname);
}
@@ -1728,18 +1729,24 @@ static bool Android_JNI_ExceptionOccurred(bool silent)
exceptionName = (jstring)(*env)->CallObjectMethod(env, exceptionClass, mid);
exceptionNameUTF8 = (*env)->GetStringUTFChars(env, exceptionName, 0);
(*env)->DeleteLocalRef(env, classClass);
mid = (*env)->GetMethodID(env, exceptionClass, "getMessage", "()Ljava/lang/String;");
exceptionMessage = (jstring)(*env)->CallObjectMethod(env, exception, mid);
(*env)->DeleteLocalRef(env, exceptionClass);
if (exceptionMessage != NULL) {
const char *exceptionMessageUTF8 = (*env)->GetStringUTFChars(env, exceptionMessage, 0);
SDL_SetError("%s: %s", exceptionNameUTF8, exceptionMessageUTF8);
(*env)->ReleaseStringUTFChars(env, exceptionMessage, exceptionMessageUTF8);
(*env)->DeleteLocalRef(env, exceptionMessage);
} else {
SDL_SetError("%s", exceptionNameUTF8);
}
(*env)->ReleaseStringUTFChars(env, exceptionName, exceptionNameUTF8);
(*env)->DeleteLocalRef(env, exceptionName);
}
return true;
@@ -2163,7 +2170,7 @@ bool Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *b
mid = (*env)->GetMethodID(env, clazz,
"messageboxShowMessageBox", "(ILjava/lang/String;Ljava/lang/String;[I[I[Ljava/lang/String;[I)I");
*buttonID = (*env)->CallIntMethod(env, context, mid,
messageboxdata->flags,
(jint)messageboxdata->flags,
title,
message,
button_flags,
@@ -2417,7 +2424,7 @@ const char *SDL_GetAndroidCachePath(void)
// fileObj = context.getExternalFilesDir();
mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context),
"getCacheDir", "()Ljava/io/File;");
fileObject = (*env)->CallObjectMethod(env, context, mid, NULL);
fileObject = (*env)->CallObjectMethod(env, context, mid);
if (!fileObject) {
SDL_SetError("Couldn't get cache directory");
LocalReferenceHolder_Cleanup(&refs);
@@ -2767,6 +2774,7 @@ bool Android_JNI_OpenFileDialog(
if (filters) {
jclass stringClass = (*env)->FindClass(env, "java/lang/String");
filtersArray = (*env)->NewObjectArray(env, nfilters, stringClass, NULL);
(*env)->DeleteLocalRef(env, stringClass);
// Convert to string
for (int i = 0; i < nfilters; i++) {
+7 -26
View File
@@ -25,6 +25,7 @@
#include "SDL_fcitx.h"
#include "../../video/SDL_sysvideo.h"
#include "../../events/SDL_keyboard_c.h"
#include "../../core/unix/SDL_appid.h"
#include "SDL_dbus.h"
#ifdef SDL_VIDEO_DRIVER_X11
@@ -53,32 +54,14 @@ typedef struct FcitxClient
static FcitxClient fcitx_client;
static char *GetAppName(void)
static const char *GetAppName(void)
{
#if defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_FREEBSD)
char *spot;
char procfile[1024];
char linkfile[1024];
int linksize;
#ifdef SDL_PLATFORM_LINUX
(void)SDL_snprintf(procfile, sizeof(procfile), "/proc/%d/exe", getpid());
#elif defined(SDL_PLATFORM_FREEBSD)
(void)SDL_snprintf(procfile, sizeof(procfile), "/proc/%d/file", getpid());
#endif
linksize = readlink(procfile, linkfile, sizeof(linkfile) - 1);
if (linksize > 0) {
linkfile[linksize] = '\0';
spot = SDL_strrchr(linkfile, '/');
if (spot) {
return SDL_strdup(spot + 1);
} else {
return SDL_strdup(linkfile);
}
const char *exe_name = SDL_GetExeName();
if (exe_name) {
return exe_name;
}
#endif // SDL_PLATFORM_LINUX || SDL_PLATFORM_FREEBSD
return SDL_strdup("SDL_App");
return "SDL_App";
}
static size_t Fcitx_GetPreeditString(SDL_DBusContext *dbus,
@@ -281,7 +264,7 @@ static bool FcitxCreateInputContext(SDL_DBusContext *dbus, const char *appname,
static bool FcitxClientCreateIC(FcitxClient *client)
{
char *appname = GetAppName();
const char *appname = GetAppName();
char *ic_path = NULL;
SDL_DBusContext *dbus = client->dbus;
@@ -290,8 +273,6 @@ static bool FcitxClientCreateIC(FcitxClient *client)
ic_path = NULL; // just in case.
}
SDL_free(appname);
if (ic_path) {
SDL_free(client->ic_path);
client->ic_path = SDL_strdup(ic_path);
+18
View File
@@ -270,6 +270,24 @@ static BOOL IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WO
return result;
#endif
BOOL WIN_IsWine(void)
{
static bool checked;
static bool is_wine;
if (!checked) {
HMODULE ntdll = LoadLibrary(TEXT("ntdll.dll"));
if (ntdll) {
if (GetProcAddress(ntdll, "wine_get_version") != NULL) {
is_wine = true;
}
FreeLibrary(ntdll);
}
checked = true;
}
return is_wine;
}
// this is the oldest thing we run on (and we may lose support for this in SDL3 at any time!),
// so there's no "OrGreater" as that would always be TRUE. The other functions are here to
// ask "can we support a specific feature?" but this function is here to ask "do we need to do
+3
View File
@@ -133,6 +133,9 @@ extern void WIN_CoUninitialize(void);
extern HRESULT WIN_RoInitialize(void);
extern void WIN_RoUninitialize(void);
// Returns true if we're running on Wine
extern BOOL WIN_IsWine(void);
// Returns true if we're running on Windows XP (any service pack). DOES NOT CHECK XP "OR GREATER"!
extern BOOL WIN_IsWindowsXP(void);
+4 -4
View File
@@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,2,18,0
PRODUCTVERSION 3,2,18,0
FILEVERSION 3,2,29,0
PRODUCTVERSION 3,2,29,0
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x40004L
@@ -23,12 +23,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "SDL\0"
VALUE "FileVersion", "3, 2, 18, 0\0"
VALUE "FileVersion", "3, 2, 29, 0\0"
VALUE "InternalName", "SDL\0"
VALUE "LegalCopyright", "Copyright (C) 2025 Sam Lantinga\0"
VALUE "OriginalFilename", "SDL3.dll\0"
VALUE "ProductName", "Simple DirectMedia Layer\0"
VALUE "ProductVersion", "3, 2, 18, 0\0"
VALUE "ProductVersion", "3, 2, 29, 0\0"
END
END
BLOCK "VarFileInfo"
+4 -1
View File
@@ -1108,7 +1108,8 @@ static int SDL_PeepEventsInternal(SDL_Event *events, int numevents, SDL_EventAct
if (action == SDL_ADDEVENT) {
if (!events) {
SDL_UnlockMutex(SDL_EventQ.lock);
return SDL_InvalidParamError("events");
SDL_InvalidParamError("events");
return -1;
}
for (i = 0; i < numevents; ++i) {
used += SDL_AddEvent(&events[i]);
@@ -1646,6 +1647,8 @@ bool SDL_WaitEventTimeoutNS(SDL_Event *event, Sint64 timeoutNS)
#ifdef SDL_PLATFORM_ANDROID
for (;;) {
SDL_PumpEventsInternal(true);
if (SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_EVENT_FIRST, SDL_EVENT_LAST) > 0) {
return true;
}
+12 -12
View File
@@ -333,6 +333,18 @@ bool SDL_SetKeyboardFocus(SDL_Window *window)
}
}
// See if the current window has lost focus
if (keyboard->focus && keyboard->focus != window) {
SDL_SendWindowEvent(keyboard->focus, SDL_EVENT_WINDOW_FOCUS_LOST, 0, 0);
// Ensures IME compositions are committed
if (SDL_TextInputActive(keyboard->focus)) {
if (video && video->StopTextInput) {
video->StopTextInput(video, keyboard->focus);
}
}
}
if (keyboard->focus && !window) {
// We won't get anymore keyboard messages, so reset keyboard state
SDL_ResetKeyboard();
@@ -351,18 +363,6 @@ bool SDL_SetKeyboardFocus(SDL_Window *window)
}
}
// See if the current window has lost focus
if (keyboard->focus && keyboard->focus != window) {
SDL_SendWindowEvent(keyboard->focus, SDL_EVENT_WINDOW_FOCUS_LOST, 0, 0);
// Ensures IME compositions are committed
if (SDL_TextInputActive(keyboard->focus)) {
if (video && video->StopTextInput) {
video->StopTextInput(video, keyboard->focus);
}
}
}
keyboard->focus = window;
if (keyboard->focus) {
+3 -1
View File
@@ -46,8 +46,10 @@ static bool send_foregrounding_pending = false;
static void SDL_HandleSIG(int sig)
{
// Reset the signal handler
#ifndef HAVE_SIGACTION
// Reset the signal handler if it was installed with signal()
(void)signal(sig, SDL_HandleSIG);
#endif
// Send a quit event next time the event loop pumps.
// We can't send it in signal handler; SDL_malloc() might be interrupted!
+4 -3
View File
@@ -77,9 +77,6 @@ bool SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent, int data
}
SDL_assert(SDL_ObjectValid(window, SDL_OBJECT_TYPE_WINDOW));
if (window->is_destroying && windowevent != SDL_EVENT_WINDOW_DESTROYED) {
return false;
}
switch (windowevent) {
case SDL_EVENT_WINDOW_SHOWN:
if (!(window->flags & SDL_WINDOW_HIDDEN)) {
@@ -212,6 +209,10 @@ bool SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent, int data
break;
}
if (window->is_destroying && windowevent != SDL_EVENT_WINDOW_DESTROYED) {
return false;
}
// Post the event, if desired
SDL_Event event;
event.type = windowevent;
+2 -2
View File
@@ -78,7 +78,7 @@ static char *search_path_for_binary(const char *bin)
char *envr;
size_t alloc_size;
char *exe = NULL;
char *start = envr;
char *start;
char *ptr;
if (!envr_real) {
@@ -86,7 +86,7 @@ static char *search_path_for_binary(const char *bin)
return NULL;
}
envr = SDL_strdup(envr_real);
start = envr = SDL_strdup(envr_real);
if (!envr) {
return NULL;
}
+19 -3
View File
@@ -61,6 +61,10 @@
return; \
}
#if 0
// The below validation is too aggressive, since there are advanced situations
// where this is legal. This is being temporarily disabled for further review.
// See: https://github.com/libsdl-org/SDL/issues/13871
#define CHECK_SAMPLER_TEXTURES \
RenderPass *rp = (RenderPass *)render_pass; \
for (Uint32 color_target_index = 0; color_target_index < rp->num_color_targets; color_target_index += 1) { \
@@ -92,6 +96,10 @@
SDL_assert_release(!"Texture cannot be simultaneously bound as a depth stencil target and a storage texture!"); \
} \
}
#else
#define CHECK_SAMPLER_TEXTURES
#define CHECK_STORAGE_TEXTURES
#endif
#define CHECK_GRAPHICS_PIPELINE_BOUND \
if (!((RenderPass *)render_pass)->graphics_pipeline) { \
@@ -1312,6 +1320,12 @@ SDL_GPUBuffer *SDL_CreateGPUBuffer(
return NULL;
}
if (device->debug_mode) {
if (createinfo->size < 4) {
SDL_assert_release(!"Cannot create a buffer with size less than 4 bytes!");
}
}
const char *debugName = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING, NULL);
return device->CreateBuffer(
@@ -1785,6 +1799,8 @@ SDL_GPURenderPass *SDL_BeginGPURenderPass(
commandBufferHeader->render_pass.num_color_targets = num_color_targets;
if (depth_stencil_target_info != NULL) {
commandBufferHeader->render_pass.depth_stencil_target = depth_stencil_target_info->texture;
} else {
commandBufferHeader->render_pass.depth_stencil_target = NULL;
}
}
@@ -2248,14 +2264,14 @@ void SDL_DrawGPUIndexedPrimitivesIndirect(
void SDL_EndGPURenderPass(
SDL_GPURenderPass *render_pass)
{
CommandBufferCommonHeader *commandBufferCommonHeader;
commandBufferCommonHeader = (CommandBufferCommonHeader *)RENDERPASS_COMMAND_BUFFER;
if (render_pass == NULL) {
SDL_InvalidParamError("render_pass");
return;
}
CommandBufferCommonHeader *commandBufferCommonHeader;
commandBufferCommonHeader = (CommandBufferCommonHeader *)RENDERPASS_COMMAND_BUFFER;
if (RENDERPASS_DEVICE->debug_mode) {
CHECK_RENDERPASS
}
+1 -1
View File
@@ -35,7 +35,7 @@
#define UNIFORM_BUFFER_SIZE 32768
#define MAX_VERTEX_BUFFERS 16
#define MAX_VERTEX_ATTRIBUTES 16
#define MAX_COLOR_TARGET_BINDINGS 4
#define MAX_COLOR_TARGET_BINDINGS 8
#define MAX_PRESENT_COUNT 16
#define MAX_FRAMES_IN_FLIGHT 3
+100 -25
View File
@@ -109,8 +109,8 @@
#define DXGI_GET_DEBUG_INTERFACE_FUNC "DXGIGetDebugInterface"
#define D3D12_GET_DEBUG_INTERFACE_FUNC "D3D12GetDebugInterface"
#define WINDOW_PROPERTY_DATA "SDL_GPUD3D12WindowPropertyData"
#define D3D_FEATURE_LEVEL_CHOICE D3D_FEATURE_LEVEL_11_1
#define D3D_FEATURE_LEVEL_CHOICE_STR "11_1"
#define D3D_FEATURE_LEVEL_CHOICE D3D_FEATURE_LEVEL_11_0
#define D3D_FEATURE_LEVEL_CHOICE_STR "11_0"
#define MAX_ROOT_SIGNATURE_PARAMETERS 64
#define D3D12_FENCE_UNSIGNALED_VALUE 0
#define D3D12_FENCE_SIGNAL_VALUE 1
@@ -876,7 +876,7 @@ struct D3D12Renderer
SDL_SharedObject *d3d12_dll;
ID3D12Device *device;
PFN_D3D12_SERIALIZE_ROOT_SIGNATURE D3D12SerializeRootSignature_func;
const char *semantic;
char *semantic;
SDL_iconv_t iconv;
ID3D12CommandQueue *commandQueue;
@@ -991,6 +991,10 @@ struct D3D12CommandBuffer
// Set at acquire time
D3D12DescriptorHeap *gpuDescriptorHeaps[D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER + 1];
D3D12DescriptorHeap **usedDescriptorHeaps;
Uint32 usedDescriptorHeapCount;
Uint32 usedDescriptorHeapCapacity;
D3D12UniformBuffer **usedUniformBuffers;
Uint32 usedUniformBufferCount;
Uint32 usedUniformBufferCapacity;
@@ -1194,7 +1198,6 @@ struct D3D12UniformBuffer
D3D12Buffer *buffer;
Uint32 writeOffset;
Uint32 drawOffset;
Uint32 currentBlockSize;
};
// Forward function declarations
@@ -1441,6 +1444,8 @@ static void D3D12_INTERNAL_ReleaseTextureContainer(
container->textures[i]);
}
SDL_DestroyProperties(container->header.info.props);
// Containers are just client handles, so we can destroy immediately
if (container->debugName) {
SDL_free(container->debugName);
@@ -1587,6 +1592,7 @@ static void D3D12_INTERNAL_DestroyCommandBuffer(D3D12CommandBuffer *commandBuffe
SDL_free(commandBuffer->usedSamplers);
SDL_free(commandBuffer->usedGraphicsPipelines);
SDL_free(commandBuffer->usedComputePipelines);
SDL_free(commandBuffer->usedDescriptorHeaps);
SDL_free(commandBuffer->usedUniformBuffers);
SDL_free(commandBuffer->textureDownloads);
SDL_free(commandBuffer);
@@ -1733,6 +1739,7 @@ static void D3D12_INTERNAL_DestroyRenderer(D3D12Renderer *renderer)
SDL_DestroyMutex(renderer->windowLock);
SDL_DestroyMutex(renderer->fenceLock);
SDL_DestroyMutex(renderer->disposeLock);
SDL_free(renderer->semantic);
SDL_free(renderer);
}
@@ -2283,6 +2290,28 @@ static bool D3D12_INTERNAL_ExpandStagingDescriptorPool(
return true;
}
static void D3D12_INTERNAL_TrackGPUDescriptorHeap(
D3D12CommandBuffer *commandBuffer,
D3D12DescriptorHeap *descriptorHeap)
{
Uint32 i;
for (i = 0; i < commandBuffer->usedDescriptorHeapCount; i += 1) {
if (commandBuffer->usedDescriptorHeaps[i] == descriptorHeap) {
return;
}
}
if (commandBuffer->usedDescriptorHeapCount == commandBuffer->usedDescriptorHeapCapacity) {
commandBuffer->usedDescriptorHeapCapacity += 1;
commandBuffer->usedDescriptorHeaps = (D3D12DescriptorHeap **)SDL_realloc(
commandBuffer->usedDescriptorHeaps,
commandBuffer->usedDescriptorHeapCapacity * sizeof(D3D12DescriptorHeap *));
}
commandBuffer->usedDescriptorHeaps[commandBuffer->usedDescriptorHeapCount] = descriptorHeap;
commandBuffer->usedDescriptorHeapCount += 1;
}
static D3D12DescriptorHeap *D3D12_INTERNAL_AcquireGPUDescriptorHeapFromPool(
D3D12CommandBuffer *commandBuffer,
D3D12_DESCRIPTOR_HEAP_TYPE descriptorHeapType)
@@ -2304,6 +2333,7 @@ static D3D12DescriptorHeap *D3D12_INTERNAL_AcquireGPUDescriptorHeapFromPool(
}
SDL_UnlockMutex(pool->lock);
D3D12_INTERNAL_TrackGPUDescriptorHeap(commandBuffer, result);
return result;
}
@@ -4496,7 +4526,6 @@ static D3D12UniformBuffer *D3D12_INTERNAL_AcquireUniformBufferFromPool(
SDL_UnlockMutex(renderer->acquireUniformBufferLock);
uniformBuffer->currentBlockSize = 0;
uniformBuffer->drawOffset = 0;
uniformBuffer->writeOffset = 0;
@@ -4535,6 +4564,7 @@ static void D3D12_INTERNAL_PushUniformData(
Uint32 length)
{
D3D12UniformBuffer *uniformBuffer;
Uint32 blockSize;
if (shaderStage == SDL_GPU_SHADERSTAGE_VERTEX) {
if (commandBuffer->vertexUniformBuffers[slotIndex] == NULL) {
@@ -4559,13 +4589,13 @@ static void D3D12_INTERNAL_PushUniformData(
return;
}
uniformBuffer->currentBlockSize =
blockSize =
D3D12_INTERNAL_Align(
length,
256);
// If there is no more room, acquire a new uniform buffer
if (uniformBuffer->writeOffset + uniformBuffer->currentBlockSize >= UNIFORM_BUFFER_SIZE) {
if (uniformBuffer->writeOffset + blockSize >= UNIFORM_BUFFER_SIZE) {
ID3D12Resource_Unmap(
uniformBuffer->buffer->handle,
0,
@@ -4595,7 +4625,7 @@ static void D3D12_INTERNAL_PushUniformData(
data,
length);
uniformBuffer->writeOffset += uniformBuffer->currentBlockSize;
uniformBuffer->writeOffset += blockSize;
if (shaderStage == SDL_GPU_SHADERSTAGE_VERTEX) {
commandBuffer->needVertexUniformBufferBind[slotIndex] = true;
@@ -5854,6 +5884,7 @@ static void D3D12_UploadToTexture(
Uint32 alignedRowPitch;
Uint32 rowsPerSlice = source->rows_per_layer;
Uint32 bytesPerSlice;
Uint32 alignedBytesPerSlice;
bool needsRealignment;
bool needsPlacementCopy;
@@ -5891,10 +5922,13 @@ static void D3D12_UploadToTexture(
bytesPerSlice = rowsPerSlice * rowPitch;
alignedRowPitch = D3D12_INTERNAL_Align(rowPitch, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT);
alignedRowPitch = BytesPerRow(destination->w, textureContainer->header.info.format);
alignedRowPitch = D3D12_INTERNAL_Align(alignedRowPitch, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT);
needsRealignment = rowsPerSlice != destination->h || rowPitch != alignedRowPitch;
needsPlacementCopy = source->offset % D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT != 0;
alignedBytesPerSlice = alignedRowPitch * destination->h;
sourceLocation.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT;
sourceLocation.PlacedFootprint.Footprint.Format = SDLToD3D12_TextureFormat[textureContainer->header.info.format];
sourceLocation.PlacedFootprint.Footprint.RowPitch = alignedRowPitch;
@@ -5919,22 +5953,25 @@ static void D3D12_UploadToTexture(
for (Uint32 sliceIndex = 0; sliceIndex < destination->d; sliceIndex += 1) {
// copy row count minus one to avoid overread
for (Uint32 rowIndex = 0; rowIndex < rowsPerSlice - 1; rowIndex += 1) {
for (Uint32 rowIndex = 0; rowIndex < destination->h - 1; rowIndex += 1) {
SDL_memcpy(
temporaryBuffer->mapPointer + (sliceIndex * rowsPerSlice) + (rowIndex * alignedRowPitch),
temporaryBuffer->mapPointer + (sliceIndex * alignedBytesPerSlice) + (rowIndex * alignedRowPitch),
transferBufferContainer->activeBuffer->mapPointer + source->offset + (sliceIndex * bytesPerSlice) + (rowIndex * rowPitch),
alignedRowPitch);
}
Uint32 offset = source->offset + (sliceIndex * bytesPerSlice) + ((rowsPerSlice - 1) * rowPitch);
Uint32 offset = source->offset + (sliceIndex * bytesPerSlice) + ((destination->h - 1) * rowPitch);
SDL_memcpy(
temporaryBuffer->mapPointer + (sliceIndex * rowsPerSlice) + ((rowsPerSlice - 1) * alignedRowPitch),
temporaryBuffer->mapPointer + (sliceIndex * alignedBytesPerSlice) + ((destination->h - 1) * alignedRowPitch),
transferBufferContainer->activeBuffer->mapPointer + offset,
SDL_min(alignedRowPitch, transferBufferContainer->size - offset));
sourceLocation.PlacedFootprint.Footprint.Width = destination->w;
sourceLocation.PlacedFootprint.Footprint.Height = rowsPerSlice;
sourceLocation.PlacedFootprint.Footprint.Height = destination->h;
sourceLocation.PlacedFootprint.Footprint.Depth = 1;
sourceLocation.PlacedFootprint.Offset = (sliceIndex * bytesPerSlice);
sourceLocation.PlacedFootprint.Offset = (sliceIndex * alignedBytesPerSlice);
ID3D12GraphicsCommandList_CopyTextureRegion(
d3d12CommandBuffer->graphicsCommandList,
@@ -5971,7 +6008,7 @@ static void D3D12_UploadToTexture(
sourceLocation.PlacedFootprint.Offset = 0;
sourceLocation.PlacedFootprint.Footprint.Width = destination->w;
sourceLocation.PlacedFootprint.Footprint.Height = destination->h;
sourceLocation.PlacedFootprint.Footprint.Depth = 1;
sourceLocation.PlacedFootprint.Footprint.Depth = destination->d;
ID3D12GraphicsCommandList_CopyTextureRegion(
d3d12CommandBuffer->graphicsCommandList,
@@ -7279,6 +7316,11 @@ static bool D3D12_INTERNAL_AllocateCommandBuffer(
commandBuffer->usedComputePipelines = (D3D12ComputePipeline **)SDL_calloc(
commandBuffer->usedComputePipelineCapacity, sizeof(D3D12ComputePipeline *));
commandBuffer->usedDescriptorHeapCapacity = 4;
commandBuffer->usedDescriptorHeapCount = 0;
commandBuffer->usedDescriptorHeaps = (D3D12DescriptorHeap **)SDL_calloc(
commandBuffer->usedDescriptorHeapCapacity, sizeof(D3D12DescriptorHeap *));
commandBuffer->usedUniformBufferCapacity = 4;
commandBuffer->usedUniformBufferCount = 0;
commandBuffer->usedUniformBuffers = (D3D12UniformBuffer **)SDL_calloc(
@@ -7700,13 +7742,13 @@ static bool D3D12_INTERNAL_CleanCommandBuffer(
NULL);
CHECK_D3D12_ERROR_AND_RETURN("Could not reset command list", false);
// Return descriptor heaps to pool
D3D12_INTERNAL_ReturnGPUDescriptorHeapToPool(
renderer,
commandBuffer->gpuDescriptorHeaps[D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV]);
D3D12_INTERNAL_ReturnGPUDescriptorHeapToPool(
renderer,
commandBuffer->gpuDescriptorHeaps[D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER]);
// Return descriptor heaps to pool, pools own their own locks
for (i = 0; i < commandBuffer->usedDescriptorHeapCount; i += 1) {
D3D12_INTERNAL_ReturnGPUDescriptorHeapToPool(
renderer,
commandBuffer->usedDescriptorHeaps[i]);
}
commandBuffer->usedDescriptorHeapCount = 0;
commandBuffer->gpuDescriptorHeaps[D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV] = NULL;
commandBuffer->gpuDescriptorHeaps[D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER] = NULL;
@@ -8352,6 +8394,7 @@ static bool D3D12_PrepareDriver(SDL_VideoDevice *_this)
IDXGIFactory4 *factory4;
IDXGIFactory6 *factory6;
IDXGIAdapter1 *adapter;
bool supports_64UAVs = false;
// Can we load D3D12?
@@ -8440,12 +8483,39 @@ static bool D3D12_PrepareDriver(SDL_VideoDevice *_this)
return false;
}
SDL_COMPILE_TIME_ASSERT(featurelevel, D3D_FEATURE_LEVEL_CHOICE < D3D_FEATURE_LEVEL_11_1);
// Check feature level 11_1 first, guarantees 64+ UAVs unlike 11_0 Tier1
res = D3D12CreateDeviceFunc(
(IUnknown *)adapter,
D3D_FEATURE_LEVEL_CHOICE,
D3D_FEATURE_LEVEL_11_1,
D3D_GUID(D3D_IID_ID3D12Device),
(void **)&device);
if (SUCCEEDED(res)) {
supports_64UAVs = true;
} else {
res = D3D12CreateDeviceFunc(
(IUnknown *)adapter,
D3D_FEATURE_LEVEL_CHOICE,
D3D_GUID(D3D_IID_ID3D12Device),
(void **)&device);
if (SUCCEEDED(res)) {
D3D12_FEATURE_DATA_D3D12_OPTIONS featureOptions;
SDL_zero(featureOptions);
res = ID3D12Device_CheckFeatureSupport(
device,
D3D12_FEATURE_D3D12_OPTIONS,
&featureOptions,
sizeof(featureOptions));
if (SUCCEEDED(res) && featureOptions.ResourceBindingTier >= D3D12_RESOURCE_BINDING_TIER_2) {
supports_64UAVs = true;
}
}
}
if (SUCCEEDED(res)) {
ID3D12Device_Release(device);
}
@@ -8455,6 +8525,11 @@ static bool D3D12_PrepareDriver(SDL_VideoDevice *_this)
SDL_UnloadObject(d3d12Dll);
SDL_UnloadObject(dxgiDll);
if (!supports_64UAVs) {
SDL_LogWarn(SDL_LOG_CATEGORY_GPU, "D3D12: Tier 2 Resource binding is not supported");
return false;
}
if (FAILED(res)) {
SDL_LogWarn(SDL_LOG_CATEGORY_GPU, "D3D12: Could not create D3D12Device with feature level " D3D_FEATURE_LEVEL_CHOICE_STR);
return false;
@@ -9145,7 +9220,7 @@ static SDL_GPUDevice *D3D12_CreateDevice(bool debugMode, bool preferLowPower, SD
renderer->debug_mode = debugMode;
renderer->allowedFramesInFlight = 2;
renderer->semantic = SDL_GetStringProperty(props, SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING, "TEXCOORD");
renderer->semantic = SDL_strdup(SDL_GetStringProperty(props, SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING, "TEXCOORD"));
// Blit resources
D3D12_INTERNAL_InitBlitResources(renderer);
+3 -1
View File
@@ -888,6 +888,7 @@ static void METAL_INTERNAL_DestroyTextureContainer(
container->textures[i]->handle = nil;
SDL_free(container->textures[i]);
}
SDL_DestroyProperties(container->header.info.props);
if (container->debugName != NULL) {
SDL_free(container->debugName);
}
@@ -1777,7 +1778,8 @@ static void METAL_UploadToTexture(
copyFromBuffer:bufferContainer->activeBuffer->handle
sourceOffset:source->offset
sourceBytesPerRow:BytesPerRow(destination->w, textureContainer->header.info.format)
sourceBytesPerImage:SDL_CalculateGPUTextureFormatSize(textureContainer->header.info.format, destination->w, destination->h, destination->d)
// sourceBytesPerImage expects the stride between 2D images (slices) of a 3D texture, not the size of the entire region
sourceBytesPerImage:SDL_CalculateGPUTextureFormatSize(textureContainer->header.info.format, destination->w, destination->h, 1)
sourceSize:MTLSizeMake(destination->w, destination->h, destination->d)
toTexture:metalTexture->handle
destinationSlice:destination->layer
+104 -37
View File
@@ -1108,6 +1108,7 @@ typedef struct VulkanCommandBuffer
VulkanFenceHandle *inFlightFence;
bool autoReleaseFence;
bool swapchainRequested;
bool isDefrag; // Whether this CB was created for defragging
} VulkanCommandBuffer;
@@ -1142,6 +1143,7 @@ struct VulkanRenderer
VulkanExtensions supports;
bool supportsDebugUtils;
bool supportsColorspace;
bool supportsPhysicalDeviceProperties2;
bool supportsFillModeNonSolid;
bool supportsMultiDrawIndirect;
@@ -1277,13 +1279,20 @@ static inline const char *VkErrorMessages(VkResult code)
#undef ERR_TO_STR
}
#define SET_ERROR_AND_RETURN(fmt, msg, ret) \
#define SET_ERROR(fmt, msg) \
do { \
if (renderer->debugMode) { \
SDL_LogError(SDL_LOG_CATEGORY_GPU, fmt, msg); \
} \
SDL_SetError((fmt), (msg)); \
return ret; \
} while (0)
#define SET_STRING_ERROR(msg) SET_ERROR("%s", msg)
#define SET_ERROR_AND_RETURN(fmt, msg, ret) \
do { \
SET_ERROR(fmt, msg); \
return ret; \
} while (0)
#define SET_STRING_ERROR_AND_RETURN(msg, ret) SET_ERROR_AND_RETURN("%s", msg, ret)
@@ -5884,7 +5893,10 @@ static VulkanTexture *VULKAN_INTERNAL_CreateTexture(
VULKAN_TEXTURE_USAGE_MODE_UNINITIALIZED,
texture);
VULKAN_INTERNAL_TrackTexture(barrierCommandBuffer, texture);
VULKAN_Submit((SDL_GPUCommandBuffer *)barrierCommandBuffer);
if (!VULKAN_Submit((SDL_GPUCommandBuffer *)barrierCommandBuffer)) {
VULKAN_INTERNAL_DestroyTexture(renderer, texture);
return NULL;
}
}
return texture;
@@ -6081,7 +6093,6 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
colorAttachmentReferences[colorAttachmentReferenceCount].layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
attachmentDescriptionCount += 1;
colorAttachmentReferenceCount += 1;
if (colorTargetInfos[i].store_op == SDL_GPU_STOREOP_RESOLVE || colorTargetInfos[i].store_op == SDL_GPU_STOREOP_RESOLVE_AND_STORE) {
VulkanTextureContainer *resolveContainer = (VulkanTextureContainer *)colorTargetInfos[i].resolve_texture;
@@ -6096,12 +6107,16 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
attachmentDescriptions[attachmentDescriptionCount].initialLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
attachmentDescriptions[attachmentDescriptionCount].finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
resolveReferences[resolveReferenceCount].attachment = attachmentDescriptionCount;
resolveReferences[resolveReferenceCount].layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
resolveReferences[colorAttachmentReferenceCount].attachment = attachmentDescriptionCount;
resolveReferences[colorAttachmentReferenceCount].layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
attachmentDescriptionCount += 1;
resolveReferenceCount += 1;
} else {
resolveReferences[colorAttachmentReferenceCount].attachment = VK_ATTACHMENT_UNUSED;
}
colorAttachmentReferenceCount += 1;
}
subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
@@ -6951,6 +6966,8 @@ static void VULKAN_ReleaseTexture(
VULKAN_INTERNAL_ReleaseTexture(renderer, vulkanTextureContainer->textures[i]);
}
SDL_DestroyProperties(vulkanTextureContainer->header.info.props);
// Containers are just client handles, so we can destroy immediately
if (vulkanTextureContainer->debugName != NULL) {
SDL_free(vulkanTextureContainer->debugName);
@@ -7152,6 +7169,8 @@ static VkRenderPass VULKAN_INTERNAL_FetchRenderPass(
key.sampleCount = VK_SAMPLE_COUNT_1_BIT;
if (numColorTargets > 0) {
key.sampleCount = SDLToVK_SampleCount[((VulkanTextureContainer *)colorTargetInfos[0].texture)->header.info.sample_count];
} else if (numColorTargets == 0 && depthStencilTargetInfo != NULL) {
key.sampleCount = SDLToVK_SampleCount[((VulkanTextureContainer *)depthStencilTargetInfo->texture)->header.info.sample_count];
}
key.numColorTargets = numColorTargets;
@@ -7896,15 +7915,17 @@ static void VULKAN_BeginRenderPass(
clearValues = SDL_stack_alloc(VkClearValue, clearCount);
for (i = 0; i < totalColorAttachmentCount; i += 1) {
clearValues[i].color.float32[0] = colorTargetInfos[i].clear_color.r;
clearValues[i].color.float32[1] = colorTargetInfos[i].clear_color.g;
clearValues[i].color.float32[2] = colorTargetInfos[i].clear_color.b;
clearValues[i].color.float32[3] = colorTargetInfos[i].clear_color.a;
int clearIndex = 0;
for (i = 0; i < numColorTargets; i += 1) {
clearValues[clearIndex].color.float32[0] = colorTargetInfos[i].clear_color.r;
clearValues[clearIndex].color.float32[1] = colorTargetInfos[i].clear_color.g;
clearValues[clearIndex].color.float32[2] = colorTargetInfos[i].clear_color.b;
clearValues[clearIndex].color.float32[3] = colorTargetInfos[i].clear_color.a;
clearIndex += 1;
if (colorTargetInfos[i].store_op == SDL_GPU_STOREOP_RESOLVE || colorTargetInfos[i].store_op == SDL_GPU_STOREOP_RESOLVE_AND_STORE) {
// Skip over the resolve texture, we're not clearing it
i += 1;
clearIndex += 1;
}
}
@@ -8592,7 +8613,7 @@ static void VULKAN_INTERNAL_BindComputeDescriptorSets(
dynamicOffsetCount,
dynamicOffsets);
commandBuffer->needNewVertexUniformOffsets = false;
commandBuffer->needNewComputeUniformOffsets = false;
}
static void VULKAN_DispatchCompute(
@@ -9395,6 +9416,8 @@ static bool VULKAN_INTERNAL_AllocateCommandBuffer(
commandBuffer->usedUniformBuffers = SDL_malloc(
commandBuffer->usedUniformBufferCapacity * sizeof(VulkanUniformBuffer *));
commandBuffer->swapchainRequested = false;
// Pool it!
vulkanCommandPool->inactiveCommandBuffers[vulkanCommandPool->inactiveCommandBufferCount] = commandBuffer;
@@ -9505,7 +9528,8 @@ static SDL_GPUCommandBuffer *VULKAN_AcquireCommandBuffer(
VulkanCommandBuffer *commandBuffer =
VULKAN_INTERNAL_GetInactiveCommandBufferFromPool(renderer, threadID);
commandBuffer->descriptorSetCache = VULKAN_INTERNAL_AcquireDescriptorSetCache(renderer);
DescriptorSetCache *descriptorSetCache =
VULKAN_INTERNAL_AcquireDescriptorSetCache(renderer);
SDL_UnlockMutex(renderer->acquireCommandBufferLock);
@@ -9513,6 +9537,8 @@ static SDL_GPUCommandBuffer *VULKAN_AcquireCommandBuffer(
return NULL;
}
commandBuffer->descriptorSetCache = descriptorSetCache;
// Reset state
commandBuffer->currentComputePipeline = NULL;
@@ -9577,6 +9603,7 @@ static SDL_GPUCommandBuffer *VULKAN_AcquireCommandBuffer(
commandBuffer->autoReleaseFence = true;
commandBuffer->swapchainRequested = false;
commandBuffer->isDefrag = 0;
/* Reset the command buffer here to avoid resets being called
@@ -9663,6 +9690,13 @@ static bool VULKAN_INTERNAL_OnWindowResize(void *userdata, SDL_Event *e)
data->swapchainCreateHeight = e->window.data2;
}
#ifdef SDL_PLATFORM_ANDROID
if (e->type == SDL_EVENT_DID_ENTER_BACKGROUND) {
data = VULKAN_INTERNAL_FetchWindowData(w);
data->needsSwapchainRecreate = true;
}
#endif
return true;
}
@@ -9925,6 +9959,14 @@ static bool VULKAN_INTERNAL_AcquireSwapchainTexture(
SET_STRING_ERROR_AND_RETURN("Cannot acquire a swapchain texture from an unclaimed window!", false);
}
// The command buffer is flagged for cleanup when the swapchain is requested as a cleanup timing mechanism
vulkanCommandBuffer->swapchainRequested = true;
if (window->flags & SDL_WINDOW_HIDDEN) {
// Edge case, texture is filled in with NULL but not an error
return true;
}
// If window data marked as needing swapchain recreate, try to recreate
if (windowData->needsSwapchainRecreate) {
Uint32 recreateSwapchainResult = VULKAN_INTERNAL_RecreateSwapchain(renderer, windowData);
@@ -9942,13 +9984,6 @@ static bool VULKAN_INTERNAL_AcquireSwapchainTexture(
}
}
if (swapchainTextureWidth) {
*swapchainTextureWidth = windowData->width;
}
if (swapchainTextureHeight) {
*swapchainTextureHeight = windowData->height;
}
if (windowData->inFlightFences[windowData->frameCounter] != NULL) {
if (block) {
// If we are blocking, just wait for the fence!
@@ -10000,6 +10035,14 @@ static bool VULKAN_INTERNAL_AcquireSwapchainTexture(
}
}
if (swapchainTextureWidth) {
*swapchainTextureWidth = windowData->width;
}
if (swapchainTextureHeight) {
*swapchainTextureHeight = windowData->height;
}
swapchainTextureContainer = &windowData->textureContainers[swapchainImageIndex];
// We need a special execution dependency with pWaitDstStageMask or image transition can start before acquire finishes
@@ -10377,6 +10420,7 @@ static void VULKAN_INTERNAL_CleanCommandBuffer(
commandBuffer->presentDataCount = 0;
commandBuffer->waitSemaphoreCount = 0;
commandBuffer->signalSemaphoreCount = 0;
commandBuffer->swapchainRequested = false;
// Reset defrag state
@@ -10474,11 +10518,18 @@ static bool VULKAN_Wait(
VkResult result;
Sint32 i;
SDL_LockMutex(renderer->submitLock);
result = renderer->vkDeviceWaitIdle(renderer->logicalDevice);
CHECK_VULKAN_ERROR_AND_RETURN(result, vkDeviceWaitIdle, false);
SDL_LockMutex(renderer->submitLock);
if (result != VK_SUCCESS) {
if (renderer->debugMode) {
SDL_LogError(SDL_LOG_CATEGORY_GPU, "%s %s", "vkDeviceWaitIdle", VkErrorMessages(result));
}
SDL_SetError("%s %s", "vkDeviceWaitIdle", VkErrorMessages(result));
SDL_UnlockMutex(renderer->submitLock);
return false;
}
for (i = renderer->submittedCommandBufferCount - 1; i >= 0; i -= 1) {
commandBuffer = renderer->submittedCommandBuffers[i];
@@ -10533,7 +10584,7 @@ static bool VULKAN_Submit(
VulkanTextureSubresource *swapchainTextureSubresource;
VulkanMemorySubAllocator *allocator;
bool performCleanups =
(renderer->claimedWindowCount > 0 && vulkanCommandBuffer->presentDataCount > 0) ||
(renderer->claimedWindowCount > 0 && vulkanCommandBuffer->swapchainRequested) ||
renderer->claimedWindowCount == 0;
SDL_LockMutex(renderer->submitLock);
@@ -10625,7 +10676,13 @@ static bool VULKAN_Submit(
presentData->windowData->inFlightFences[presentData->windowData->frameCounter] = (SDL_GPUFence*)vulkanCommandBuffer->inFlightFence;
(void)SDL_AtomicIncRef(&vulkanCommandBuffer->inFlightFence->referenceCount);
if (presentResult == VK_SUBOPTIMAL_KHR || presentResult == VK_ERROR_OUT_OF_DATE_KHR) {
// On the Android platform, VK_SUBOPTIMAL_KHR is returned whenever the device is rotated. We'll just ignore this for now.
#ifndef SDL_PLATFORM_ANDROID
if (presentResult == VK_SUBOPTIMAL_KHR) {
presentData->windowData->needsSwapchainRecreate = true;
}
#endif
if (presentResult == VK_ERROR_OUT_OF_DATE_KHR) {
presentData->windowData->needsSwapchainRecreate = true;
}
} else {
@@ -10730,8 +10787,6 @@ static bool VULKAN_INTERNAL_DefragmentMemory(
VulkanMemoryUsedRegion *currentRegion = allocation->usedRegions[i];
if (currentRegion->isBuffer && !currentRegion->vulkanBuffer->markedForDestroy) {
currentRegion->vulkanBuffer->usage |= VK_BUFFER_USAGE_TRANSFER_DST_BIT;
VulkanBuffer *newBuffer = VULKAN_INTERNAL_CreateBuffer(
renderer,
currentRegion->vulkanBuffer->size,
@@ -11003,7 +11058,8 @@ static Uint8 VULKAN_INTERNAL_CheckInstanceExtensions(
const char **requiredExtensions,
Uint32 requiredExtensionsLength,
bool *supportsDebugUtils,
bool *supportsColorspace)
bool *supportsColorspace,
bool *supportsPhysicalDeviceProperties2)
{
Uint32 extensionCount, i;
VkExtensionProperties *availableExtensions;
@@ -11042,6 +11098,12 @@ static Uint8 VULKAN_INTERNAL_CheckInstanceExtensions(
availableExtensions,
extensionCount);
// Only needed for KHR_driver_properties!
*supportsPhysicalDeviceProperties2 = SupportsInstanceExtension(
VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME,
availableExtensions,
extensionCount);
SDL_free(availableExtensions);
return allExtensionsSupported;
}
@@ -11152,10 +11214,6 @@ static Uint8 VULKAN_INTERNAL_CreateInstance(VulkanRenderer *renderer)
instanceExtensionCount + 4);
SDL_memcpy((void *)instanceExtensionNames, originalInstanceExtensionNames, instanceExtensionCount * sizeof(const char *));
// Core since 1.1
instanceExtensionNames[instanceExtensionCount++] =
VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME;
#ifdef SDL_PLATFORM_APPLE
instanceExtensionNames[instanceExtensionCount++] =
VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME;
@@ -11166,7 +11224,8 @@ static Uint8 VULKAN_INTERNAL_CreateInstance(VulkanRenderer *renderer)
instanceExtensionNames,
instanceExtensionCount,
&renderer->supportsDebugUtils,
&renderer->supportsColorspace)) {
&renderer->supportsColorspace,
&renderer->supportsPhysicalDeviceProperties2)) {
SDL_stack_free((char *)instanceExtensionNames);
SET_STRING_ERROR_AND_RETURN("Required Vulkan instance extensions not supported", false);
}
@@ -11188,6 +11247,12 @@ static Uint8 VULKAN_INTERNAL_CreateInstance(VulkanRenderer *renderer)
VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME;
}
if (renderer->supportsPhysicalDeviceProperties2) {
// Append KHR_physical_device_properties2 extension
instanceExtensionNames[instanceExtensionCount++] =
VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME;
}
createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
createInfo.pNext = NULL;
createInfo.flags = createFlags;
@@ -11694,9 +11759,10 @@ static SDL_GPUDevice *VULKAN_CreateDevice(bool debugMode, bool preferLowPower, S
renderer->allowedFramesInFlight = 2;
if (!VULKAN_INTERNAL_PrepareVulkan(renderer)) {
SET_STRING_ERROR("Failed to initialize Vulkan!");
SDL_free(renderer);
SDL_Vulkan_UnloadLibrary();
SET_STRING_ERROR_AND_RETURN("Failed to initialize Vulkan!", NULL);
return NULL;
}
SDL_LogInfo(SDL_LOG_CATEGORY_GPU, "SDL_GPU Driver: Vulkan");
@@ -11722,13 +11788,14 @@ static SDL_GPUDevice *VULKAN_CreateDevice(bool debugMode, bool preferLowPower, S
if (!VULKAN_INTERNAL_CreateLogicalDevice(
renderer)) {
SET_STRING_ERROR("Failed to create logical device!");
SDL_free(renderer);
SDL_Vulkan_UnloadLibrary();
SET_STRING_ERROR_AND_RETURN("Failed to create logical device!", NULL);
return NULL;
}
// FIXME: just move this into this function
result = (SDL_GPUDevice *)SDL_malloc(sizeof(SDL_GPUDevice));
result = (SDL_GPUDevice *)SDL_calloc(1, sizeof(SDL_GPUDevice));
ASSIGN_DRIVER(VULKAN)
result->driverData = (SDL_GPURenderer *)renderer;
+2 -3
View File
@@ -1117,13 +1117,12 @@ bool SDL_SYS_HapticResume(SDL_Haptic *haptic)
*/
bool SDL_SYS_HapticStopAll(SDL_Haptic *haptic)
{
int i, ret;
int i;
// Linux does not support this natively so we have to loop.
for (i = 0; i < haptic->neffects; i++) {
if (haptic->effects[i].hweffect != NULL) {
ret = SDL_SYS_HapticStopEffect(haptic, &haptic->effects[i]);
if (ret < 0) {
if (!SDL_SYS_HapticStopEffect(haptic, &haptic->effects[i])) {
return SDL_SetError("Haptic: Error while trying to stop all playing effects.");
}
}
+20 -18
View File
@@ -260,19 +260,19 @@ static int get_usage(uint8_t *report_descriptor, size_t size,
}
if (key_cmd == 0x4) {
*usage_page = get_bytes(report_descriptor, size, data_len, i);
*usage_page = (unsigned short)get_bytes(report_descriptor, size, data_len, i);
usage_page_found = 1;
//printf("Usage Page: %x\n", (uint32_t)*usage_page);
}
if (key_cmd == 0x8) {
if (data_len == 4) { /* Usages 5.5 / Usage Page 6.2.2.7 */
*usage_page = get_bytes(report_descriptor, size, 2, i + 2);
*usage_page = (unsigned short)get_bytes(report_descriptor, size, 2, i + 2);
usage_page_found = 1;
*usage = get_bytes(report_descriptor, size, 2, i);
*usage = (unsigned short)get_bytes(report_descriptor, size, 2, i);
usage_found = 1;
}
else {
*usage = get_bytes(report_descriptor, size, data_len, i);
*usage = (unsigned short)get_bytes(report_descriptor, size, data_len, i);
usage_found = 1;
}
//printf("Usage: %x\n", (uint32_t)*usage);
@@ -640,7 +640,7 @@ static int hid_get_report_descriptor_libusb(libusb_device_handle *handle, int in
/* Get the HID Report Descriptor.
See USB HID Specification, section 7.1.1
*/
int res = libusb_control_transfer(handle, LIBUSB_ENDPOINT_IN|LIBUSB_RECIPIENT_INTERFACE, LIBUSB_REQUEST_GET_DESCRIPTOR, (LIBUSB_DT_REPORT << 8), interface_num, tmp, expected_report_descriptor_size, 5000);
int res = libusb_control_transfer(handle, LIBUSB_ENDPOINT_IN|LIBUSB_RECIPIENT_INTERFACE, LIBUSB_REQUEST_GET_DESCRIPTOR, (LIBUSB_DT_REPORT << 8), (uint16_t)interface_num, tmp, expected_report_descriptor_size, 5000);
if (res >= 0) {
if (res > (int)buf_size)
res = (int)buf_size;
@@ -671,6 +671,8 @@ static void fill_device_info_usage(struct hid_device_info *cur_dev, libusb_devic
cur_dev->usage_page = page;
cur_dev->usage = usage;
free(hid_report_descriptor);
}
#ifdef INVASIVE_GET_USAGE
@@ -1191,7 +1193,7 @@ static void *read_thread(void *param)
dev->transfer = libusb_alloc_transfer(0);
libusb_fill_interrupt_transfer(dev->transfer,
dev->device_handle,
dev->input_endpoint,
(unsigned char)dev->input_endpoint,
buf,
(int) length,
read_callback,
@@ -1610,8 +1612,8 @@ int HID_API_EXPORT hid_write(hid_device *dev, const unsigned char *data, size_t
res = libusb_control_transfer(dev->device_handle,
LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE|LIBUSB_ENDPOINT_OUT,
0x09/*HID Set_Report*/,
(2/*HID output*/ << 8) | report_number,
dev->interface,
(uint16_t)((2/*HID output*/ << 8) | report_number),
(uint16_t)dev->interface,
(unsigned char *)data, (uint16_t)length,
1000/*timeout millis*/);
@@ -1627,7 +1629,7 @@ int HID_API_EXPORT hid_write(hid_device *dev, const unsigned char *data, size_t
/* Use the interrupt out endpoint */
int actual_length;
res = libusb_interrupt_transfer(dev->device_handle,
dev->output_endpoint,
(unsigned char)dev->output_endpoint,
(unsigned char*)data,
(int) length,
&actual_length, 1000);
@@ -1776,8 +1778,8 @@ int HID_API_EXPORT hid_send_feature_report(hid_device *dev, const unsigned char
res = libusb_control_transfer(dev->device_handle,
LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE|LIBUSB_ENDPOINT_OUT,
0x09/*HID set_report*/,
(3/*HID feature*/ << 8) | report_number,
dev->interface,
(uint16_t)((3/*HID feature*/ << 8) | report_number),
(uint16_t)dev->interface,
(unsigned char *)data, (uint16_t)length,
1000/*timeout millis*/);
@@ -1807,8 +1809,8 @@ int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data,
res = libusb_control_transfer(dev->device_handle,
LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE|LIBUSB_ENDPOINT_IN,
0x01/*HID get_report*/,
(3/*HID feature*/ << 8) | report_number,
dev->interface,
(uint16_t)((3/*HID feature*/ << 8) | report_number),
(uint16_t)dev->interface,
(unsigned char *)data, (uint16_t)length,
1000/*timeout millis*/);
@@ -1837,8 +1839,8 @@ int HID_API_EXPORT HID_API_CALL hid_get_input_report(hid_device *dev, unsigned c
res = libusb_control_transfer(dev->device_handle,
LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE|LIBUSB_ENDPOINT_IN,
0x01/*HID get_report*/,
(1/*HID Input*/ << 8) | report_number,
dev->interface,
(uint16_t)((1/*HID Input*/ << 8) | report_number),
(uint16_t)dev->interface,
(unsigned char *)data, (uint16_t)length,
1000/*timeout millis*/);
@@ -1930,7 +1932,7 @@ int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *dev, int string_index
{
wchar_t *str;
str = get_usb_string(dev->device_handle, string_index);
str = get_usb_string(dev->device_handle, (uint8_t)string_index);
if (str) {
wcsncpy(string, str, maxlen);
string[maxlen-1] = L'\0';
@@ -2118,7 +2120,7 @@ uint16_t get_usb_code_for_current_locale(void)
/* Chop off the encoding part, and make it lower case. */
ptr = search_string;
while (*ptr) {
*ptr = tolower(*ptr);
*ptr = (char)tolower(*ptr);
if (*ptr == '.') {
*ptr = '\0';
break;
@@ -2139,7 +2141,7 @@ uint16_t get_usb_code_for_current_locale(void)
/* Chop off the variant. Chop it off at the '_'. */
ptr = search_string;
while (*ptr) {
*ptr = tolower(*ptr);
*ptr = (char)tolower(*ptr);
if (*ptr == '_') {
*ptr = '\0';
break;
+1 -1
View File
@@ -134,7 +134,6 @@ static wchar_t *utf8_to_wchar_t(const char *utf8)
* Use register_error_str(NULL) to free the error message completely. */
static void register_error_str(wchar_t **error_str, const char *msg)
{
free(*error_str);
#ifdef HIDAPI_USING_SDL_RUNTIME
/* Thread-safe error handling */
if (msg) {
@@ -143,6 +142,7 @@ static void register_error_str(wchar_t **error_str, const char *msg)
SDL_ClearError();
}
#else
free(*error_str);
*error_str = utf8_to_wchar_t(msg);
#endif
}
+5
View File
@@ -1399,6 +1399,11 @@ int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char
}
}
if (!res) {
if (GetLastError() == ERROR_OPERATION_ABORTED) {
/* The read request was issued on another thread.
This is harmless, so just ignore it. */
return 0;
}
register_winapi_error(dev, L"hid_read_timeout/GetOverlappedResult");
}
+2 -1
View File
@@ -455,7 +455,8 @@ static bool SDLCALL fd_flush(void *userdata, SDL_IOStatus *status)
result = SDL_fdatasync(iodata->fd);
} while (result < 0 && errno == EINTR);
if (result < 0) {
// We get EINVAL when flushing a pipe, just make that a no-op
if (result < 0 && errno != EINVAL) {
return SDL_SetError("Error flushing datastream: %s", strerror(errno));
}
return true;
+75 -38
View File
@@ -32,10 +32,11 @@
#include "hidapi/SDL_hidapi_nintendo.h"
#include "../events/SDL_events_c.h"
#ifdef SDL_PLATFORM_ANDROID
#ifdef SDL_PLATFORM_WIN32
#include "../core/windows/SDL_windows.h"
#endif
// Many gamepads turn the center button into an instantaneous button press
#define SDL_MINIMUM_GUIDE_BUTTON_DELAY_MS 250
@@ -149,6 +150,51 @@ static SDL_vidpid_list SDL_ignored_gamepads = {
false
};
/*
List of words in gamepad names that indicate that the gamepad should not be detected.
See also `initial_blacklist_devices` in SDL_joystick.c
*/
enum SDL_GamepadBlacklistWordsPosition {
GAMEPAD_BLACKLIST_BEGIN,
GAMEPAD_BLACKLIST_END,
GAMEPAD_BLACKLIST_ANYWHERE,
};
struct SDL_GamepadBlacklistWords {
const char* str;
enum SDL_GamepadBlacklistWordsPosition pos;
};
static const struct SDL_GamepadBlacklistWords SDL_gamepad_blacklist_words[] = {
#ifdef SDL_PLATFORM_LINUX
{" Motion Sensors", GAMEPAD_BLACKLIST_END}, // Don't treat the PS3 and PS4 motion controls as a separate gamepad
{" IMU", GAMEPAD_BLACKLIST_END}, // Don't treat the Nintendo IMU as a separate gamepad
{" Touchpad", GAMEPAD_BLACKLIST_END}, // "Sony Interactive Entertainment DualSense Wireless Controller Touchpad"
// Don't treat the Wii extension controls as a separate gamepad
{" Accelerometer", GAMEPAD_BLACKLIST_END},
{" IR", GAMEPAD_BLACKLIST_END},
{" Motion Plus", GAMEPAD_BLACKLIST_END},
{" Nunchuk", GAMEPAD_BLACKLIST_END},
#endif
// The Google Pixel fingerprint sensor, as well as other fingerprint sensors, reports itself as a joystick
{"uinput-", GAMEPAD_BLACKLIST_BEGIN},
{"Synaptics ", GAMEPAD_BLACKLIST_ANYWHERE}, // "Synaptics TM2768-001", "SynPS/2 Synaptics TouchPad"
{"Trackpad", GAMEPAD_BLACKLIST_ANYWHERE},
{"Clickpad", GAMEPAD_BLACKLIST_ANYWHERE},
// "PG-90215 Keyboard", "Usb Keyboard Usb Keyboard Consumer Control", "Framework Laptop 16 Keyboard Module - ISO System Control"
{" Keyboard", GAMEPAD_BLACKLIST_ANYWHERE},
{" Laptop ", GAMEPAD_BLACKLIST_ANYWHERE}, // "Framework Laptop 16 Numpad Module System Control"
{"Mouse ", GAMEPAD_BLACKLIST_BEGIN}, // "Mouse passthrough"
{" Pen", GAMEPAD_BLACKLIST_END}, // "Wacom One by Wacom S Pen"
{" Finger", GAMEPAD_BLACKLIST_END}, // "Wacom HID 495F Finger"
{" LED ", GAMEPAD_BLACKLIST_ANYWHERE}, // "ASRock LED Controller"
{" Thelio ", GAMEPAD_BLACKLIST_ANYWHERE}, // "System76 Thelio Io 2"
};
static GamepadMapping_t *SDL_PrivateAddMappingForGUID(SDL_GUID jGUID, const char *mappingString, bool *existing, SDL_GamepadMappingPriority priority);
static void SDL_PrivateLoadButtonMapping(SDL_Gamepad *gamepad, GamepadMapping_t *pGamepadMapping);
static GamepadMapping_t *SDL_PrivateGetGamepadMapping(SDL_JoystickID instance_id, bool create_mapping);
@@ -311,7 +357,7 @@ void SDL_PrivateGamepadAdded(SDL_JoystickID instance_id)
{
SDL_Event event;
if (!SDL_gamepads_initialized) {
if (!SDL_gamepads_initialized || SDL_IsJoystickBeingAdded()) {
return;
}
@@ -777,7 +823,7 @@ static GamepadMapping_t *SDL_CreateMappingForHIDAPIGamepad(SDL_GUID guid)
if (SDL_IsJoystickSteamController(vendor, product)) {
// Steam controllers have 2 back paddle buttons
SDL_strlcat(mapping_string, "paddle1:b12,paddle2:b11,", sizeof(mapping_string));
SDL_strlcat(mapping_string, "paddle1:b11,paddle2:b12,", sizeof(mapping_string));
} else if (SDL_IsJoystickNintendoSwitchPro(vendor, product) ||
SDL_IsJoystickNintendoSwitchProInputOnly(vendor, product)) {
// Nintendo Switch Pro controllers have a screenshot button
@@ -1729,17 +1775,6 @@ static GamepadMapping_t *SDL_PrivateGetGamepadMappingForNameAndGUID(const char *
SDL_AssertJoysticksLocked();
mapping = SDL_PrivateGetGamepadMappingForGUID(guid, false);
#ifdef SDL_PLATFORM_LINUX
if (!mapping && name) {
if (SDL_strstr(name, "Xbox 360 Wireless Receiver")) {
// The Linux driver xpad.c maps the wireless dpad to buttons
bool existing;
mapping = SDL_PrivateAddMappingForGUID(guid,
"none,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
&existing, SDL_GAMEPAD_MAPPING_PRIORITY_DEFAULT);
}
}
#endif // SDL_PLATFORM_LINUX
return mapping;
}
@@ -2665,35 +2700,37 @@ bool SDL_IsGamepad(SDL_JoystickID instance_id)
*/
bool SDL_ShouldIgnoreGamepad(Uint16 vendor_id, Uint16 product_id, Uint16 version, const char *name)
{
#ifdef SDL_PLATFORM_LINUX
if (SDL_endswith(name, " Motion Sensors")) {
// Don't treat the PS3 and PS4 motion controls as a separate gamepad
return true;
}
if (SDL_strncmp(name, "Nintendo ", 9) == 0 && SDL_strstr(name, " IMU") != NULL) {
// Don't treat the Nintendo IMU as a separate gamepad
return true;
}
if (SDL_endswith(name, " Accelerometer") ||
SDL_endswith(name, " IR") ||
SDL_endswith(name, " Motion Plus") ||
SDL_endswith(name, " Nunchuk")) {
// Don't treat the Wii extension controls as a separate gamepad
return true;
}
#endif
int i;
for (i = 0; i < SDL_arraysize(SDL_gamepad_blacklist_words); i++) {
const struct SDL_GamepadBlacklistWords *blacklist_word = &SDL_gamepad_blacklist_words[i];
if (name && SDL_strcmp(name, "uinput-fpc") == 0) {
// The Google Pixel fingerprint sensor reports itself as a joystick
return true;
switch (blacklist_word->pos) {
case GAMEPAD_BLACKLIST_BEGIN:
if (SDL_startswith(name, blacklist_word->str)) {
return true;
}
break;
case GAMEPAD_BLACKLIST_END:
if (SDL_endswith(name, blacklist_word->str)) {
return true;
}
break;
case GAMEPAD_BLACKLIST_ANYWHERE:
if (SDL_strstr(name, blacklist_word->str) != NULL) {
return true;
}
break;
}
}
#ifdef SDL_PLATFORM_WIN32
if (SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", false) &&
SDL_GetHintBoolean("STEAM_COMPAT_PROTON", false)) {
// We are launched by Steam and running under Proton
WIN_IsWine()) {
// We are launched by Steam and running under Proton or Wine
// We can't tell whether this controller is a Steam Virtual Gamepad,
// so assume that Proton is doing the appropriate filtering of controllers
// so assume that is doing the appropriate filtering of controllers
// and anything we see here is fine to use.
return false;
}
+4 -12
View File
@@ -339,6 +339,7 @@ static const char *s_GamepadMappings[] = {
"03000000172700004431000000000000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a7,rightx:a2,righty:a5,start:b11,x:b3,y:b4,",
"03000000c0160000e105000000000000,Xin-Mo Dual Arcade,crc:2246,a:b1,b:b2,back:b9,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,rightshoulder:b4,righttrigger:b5,start:b8,x:b0,y:b3,", /* Ultimate Atari Fight Stick */
"03000000790000004f18000000000000,ZD-T Android,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
"03000000073500000400000000000000,ZENAIM ARCADE CONTROLLER,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,",
"03000000120c0000101e000000000000,ZEROPLUS P4 Wired Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
"03000000d81d00000f00000000000000,iBUFFALO BSGP1204 Series,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
"03000000d81d00001000000000000000,iBUFFALO BSGP1204P Series,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
@@ -481,6 +482,7 @@ static const char *s_GamepadMappings[] = {
"030000005e040000fd02000003090000,Xbox Wireless Controller,a:b0,b:b1,back:b16,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
"03000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,",
"03000000c0160000e105000000040000,Xin-Mo Dual Arcade,crc:82d5,a:b2,b:b4,back:b18,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,rightshoulder:b8,righttrigger:b10,start:b16,x:b0,y:b6,", /* Ultimate Atari Fight Stick */
"03000000073500000400000000010000,ZENAIM ARCADE CONTROLLER,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,",
"03000000120c0000100e000000010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
"03000000120c0000101e000000010000,ZEROPLUS P4 Wired Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
"03000000830500006020000000010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
@@ -502,6 +504,7 @@ static const char *s_GamepadMappings[] = {
"06000000c82d00000020000006010000,8BitDo Pro 2 Wired Controller for Xbox,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
"03000000c82d00000660000011010000,8BitDo Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
"05000000c82d00000660000000010000,8BitDo Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
"03000000c82d00000960000011010000,8BitDo Pro 3,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,paddle1:b17,paddle2:b16,paddle3:b2,paddle4:b5,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
"05000000c82d00000061000000010000,8BitDo SF30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
"05000000102800000900000000010000,8BitDo SFC30 Gamepad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
"05000000c82d00003028000000010000,8BitDo SFC30 Gamepad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
@@ -537,7 +540,6 @@ static const char *s_GamepadMappings[] = {
"03000000503200000210000000000000,Atari Game Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a4,rightx:a2,righty:a3,start:b8,x:b2,y:b3,",
"05000000503200000210000000000000,Atari Game Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b2,",
"05000000503200000210000000000000128804098,Atari Game Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b2,",
"030000005e0400008e02000047010000,Atari Xbox 360 Game Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
"03000000c62400001b89000011010000,BDA MOGA XP5-X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
"03000000d62000002a79000011010000,BDA PS4 Fightpad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
"03000000120c0000f70e000011010000,Brook Universal Fighting Board,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:,lefty:,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:,righty:,start:b9,x:b0,y:b3,",
@@ -627,8 +629,6 @@ static const char *s_GamepadMappings[] = {
"03000000790000004418000010010000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,",
"03000000780000000600000010010000,Microntek USB Joystick,a:b2,b:b1,back:b8,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,",
"030000005e0400000e00000000010000,Microsoft SideWinder,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,rightshoulder:b7,start:b8,x:b3,y:b4,",
"030000005e0400008e02000004010000,Microsoft X-Box 360 pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
"030000005e0400008e02000062230000,Microsoft X-Box 360 pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
"030000005e040000d102000003020000,Microsoft X-Box One pad v2,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
"030000005e040000d102000001010000,Microsoft X-Box One pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
"030000005e0400008502000000010000,Microsoft X-Box pad (Japan),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,",
@@ -743,8 +743,6 @@ static const char *s_GamepadMappings[] = {
"03000000f025000021c1000010010000,ShanWan Gioteck PS3 Wired Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
"03000000632500002305000010010000,ShanWan USB Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
"03000000250900000500000000010000,Sony PS2 pad with SmartJoy adapter,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,",
"030000005e0400008e02000020200000,SpeedLink XEOX Pro Analog Gamepad pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
"030000005e0400008e02000073050000,Speedlink TORID Wireless Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
"03000000de2800000112000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
"03000000de2800000112000011010000,Steam Controller,a:b2,b:b3,back:b10,dpdown:+a5,dpleft:-a4,dpright:+a4,dpup:-a5,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,paddle1:b15,paddle2:b16,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a3,start:b11,x:b4,y:b5,",
"03000000de2800000211000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
@@ -781,20 +779,14 @@ static const char *s_GamepadMappings[] = {
"030000006f0e00000702000011010000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
"030000000d0f0000ab01000011010000,Wireless HORIPAD For Steam,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc2:b2,misc3:b16,misc4:b17,paddle1:b19,paddle2:b18,paddle3:b15,paddle4:b5,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
"050000000d0f00009601000091000000,Wireless HORIPAD For Steam,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc2:b2,misc3:b16,misc4:b17,paddle1:b19,paddle2:b18,paddle3:b15,paddle4:b5,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
"030000005e0400008e02000010010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
"030000005e0400008e02000014010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
"030000005e0400001907000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
"030000005e0400009102000007010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
"030000005e040000a102000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
"030000005e040000a102000007010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
"03000000450c00002043000010010000,XEOX Gamepad SL-6556-BK,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
"0000000058626f782033363020576900,Xbox 360 Wireless Controller,a:b0,b:b1,back:b14,dpdown:b11,dpleft:b12,dpright:b13,dpup:b10,guide:b7,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b2,y:b3,",
"030000005e040000a102000014010000,Xbox 360 Wireless Receiver (XBOX),a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
"0000000058626f782047616d65706100,Xbox Gamepad (userspace driver),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,",
"050000005e040000e002000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
"050000005e040000fd02000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,guide:b16,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
"05000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,",
"03000000c0160000e105000010010000,Xin-Mo Dual Arcade,crc:82d5,a:b1,b:b2,back:b9,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,rightshoulder:b4,righttrigger:b5,start:b8,x:b0,y:b3,", /* Ultimate Atari Fight Stick */
"03000000073500000400000011010000,ZENAIM ARCADE CONTROLLER,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,",
"03000000120c0000100e000011010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
"03000000120c0000101e000011010000,ZEROPLUS P4 Wired Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
"03000000120c0000182e000011010000,ZEROPLUS P4 Wired Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+11 -2
View File
@@ -273,11 +273,16 @@ static Uint32 initial_blacklist_devices[] = {
MAKE_VIDPID(0x04d9, 0x8009), // OBINLB USB-HID Keyboard (Anne Pro II)
MAKE_VIDPID(0x04d9, 0xa292), // OBINLB USB-HID Keyboard (Anne Pro II)
MAKE_VIDPID(0x04d9, 0xa293), // OBINLB USB-HID Keyboard (Anne Pro II)
MAKE_VIDPID(0x04f2, 0xa13c), // HP Deluxe Webcam KQ246AA
MAKE_VIDPID(0x1532, 0x0266), // Razer Huntsman V2 Analog, non-functional DInput device
MAKE_VIDPID(0x1532, 0x0282), // Razer Huntsman Mini Analog, non-functional DInput device
MAKE_VIDPID(0x26ce, 0x01a2), // ASRock LED Controller
MAKE_VIDPID(0x20d6, 0x0002), // PowerA Enhanced Wireless Controller for Nintendo Switch (charging port only)
MAKE_VIDPID(0x31e3, 0x1310), // Wooting 60HE (ARM)
MAKE_VIDPID(0x3297, 0x1969), // Moonlander MK1 Keyboard
MAKE_VIDPID(0x3434, 0x0211), // Keychron K1 Pro System Control
MAKE_VIDPID(0x3434, 0x0353), // Keychron V5 System Control
MAKE_VIDPID(0x3434, 0xd030), // Keychron Link
};
static SDL_vidpid_list blacklist_devices = {
SDL_HINT_JOYSTICK_BLACKLIST_DEVICES, 0, 0, NULL,
@@ -2143,6 +2148,7 @@ void SDL_PrivateJoystickAdded(SDL_JoystickID instance_id)
SDL_JoystickDriver *driver;
int device_index;
int player_index = -1;
bool is_gamepad;
SDL_AssertJoysticksLocked();
@@ -2177,9 +2183,12 @@ void SDL_PrivateJoystickAdded(SDL_JoystickID instance_id)
}
}
// This might create an automatic gamepad mapping, so wait to send the event
is_gamepad = SDL_IsGamepad(instance_id);
SDL_joystick_being_added = false;
if (SDL_IsGamepad(instance_id)) {
if (is_gamepad) {
SDL_PrivateGamepadAdded(instance_id);
}
}
@@ -2495,7 +2504,7 @@ void SDL_UpdateJoysticks(void)
Uint64 now;
SDL_Joystick *joystick;
if (!SDL_WasInit(SDL_INIT_JOYSTICK)) {
if (!SDL_joysticks_initialized) {
return;
}
+12
View File
@@ -23,6 +23,9 @@
#include "SDL_joystick_c.h"
#include "SDL_steam_virtual_gamepad.h"
#ifdef SDL_PLATFORM_LINUX
#include "../core/unix/SDL_appid.h"
#endif
#ifdef SDL_PLATFORM_WIN32
#include "../core/windows/SDL_windows.h"
#else
@@ -134,6 +137,15 @@ void SDL_InitSteamVirtualGamepadInfo(void)
file = SDL_GetHint(SDL_HINT_STEAM_VIRTUAL_GAMEPAD_INFO_FILE);
if (file && *file) {
#ifdef SDL_PLATFORM_LINUX
// Older versions of Wine will blacklist the Steam Virtual Gamepad if
// it appears to have the real controller's VID/PID, so ignore this.
const char *exe = SDL_GetExeName();
if (exe && SDL_strcmp(exe, "wine64-preloader") == 0) {
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "Wine launched by Steam, ignoring %s", SDL_HINT_STEAM_VIRTUAL_GAMEPAD_INFO_FILE);
return;
}
#endif
SDL_steam_virtual_gamepad_info_file = SDL_strdup(file);
}
SDL_UpdateSteamVirtualGamepadInfo();
+4
View File
@@ -328,6 +328,10 @@ void Android_AddJoystick(int device_id, const char *name, const char *desc, int
goto done;
}
if (SDL_ShouldIgnoreJoystick(vendor_id, product_id, 0, name)) {
goto done;
}
#ifdef DEBUG_JOYSTICK
SDL_Log("Joystick: %s, descriptor %s, vendor = 0x%.4x, product = 0x%.4x, %d axes, %d hats", name, desc, vendor_id, product_id, naxes, nhats);
#endif
+8 -2
View File
@@ -300,8 +300,14 @@ static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
* struct, and ARC doesn't work with structs. */
device->controller = (__bridge GCController *)CFBridgingRetain(controller);
if (controller.vendorName) {
name = controller.vendorName.UTF8String;
if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) {
if (controller.productCategory) {
name = controller.productCategory.UTF8String;
}
} else {
if (controller.vendorName) {
name = controller.vendorName.UTF8String;
}
}
if (!name) {
+2 -2
View File
@@ -21,7 +21,6 @@
static const ControllerDescription_t arrControllers[] = {
{ MAKE_CONTROLLER_ID( 0x0079, 0x181a ), k_eControllerType_PS3Controller, NULL }, // Venom Arcade Stick
{ MAKE_CONTROLLER_ID( 0x0079, 0x1844 ), k_eControllerType_PS3Controller, NULL }, // From SDL
{ MAKE_CONTROLLER_ID( 0x044f, 0xb315 ), k_eControllerType_PS3Controller, NULL }, // Firestorm Dual Analog 3
{ MAKE_CONTROLLER_ID( 0x044f, 0xd007 ), k_eControllerType_PS3Controller, NULL }, // Thrustmaster wireless 3-1
{ MAKE_CONTROLLER_ID( 0x046d, 0xcad1 ), k_eControllerType_PS3Controller, NULL }, // Logitech Chillstream
@@ -436,7 +435,8 @@ static const ControllerDescription_t arrControllers[] = {
{ MAKE_CONTROLLER_ID( 0x24c6, 0x592a ), k_eControllerType_XBoxOneController, NULL }, // BDA XB1 Spectra Pro
{ MAKE_CONTROLLER_ID( 0x24c6, 0x791a ), k_eControllerType_XBoxOneController, NULL }, // PowerA Fusion Fight Pad
{ MAKE_CONTROLLER_ID( 0x2dc8, 0x2002 ), k_eControllerType_XBoxOneController, NULL }, // 8BitDo Ultimate Wired Controller for Xbox
{ MAKE_CONTROLLER_ID( 0x2dc8, 0x3106 ), k_eControllerType_XBoxOneController, NULL }, // 8Bitdo Ultimate Wired Controller. Windows, Android, Switch.
{ MAKE_CONTROLLER_ID( 0x2dc8, 0x3106 ), k_eControllerType_XBoxOneController, NULL }, // 8BitDo Ultimate Wired Controller. Windows, Android, Switch.
{ MAKE_CONTROLLER_ID( 0x2dc8, 0x310a ), k_eControllerType_XBoxOneController, NULL }, // 8BitDo Ultimate 2C Wireless Controller
{ MAKE_CONTROLLER_ID( 0x2e24, 0x0652 ), k_eControllerType_XBoxOneController, NULL }, // Hyperkin Duke
{ MAKE_CONTROLLER_ID( 0x2e24, 0x1618 ), k_eControllerType_XBoxOneController, NULL }, // Hyperkin Duke
{ MAKE_CONTROLLER_ID( 0x2e24, 0x1688 ), k_eControllerType_XBoxOneController, NULL }, // Hyperkin X91
+40 -1
View File
@@ -305,6 +305,7 @@ static SDL_JoystickID EMSCRIPTEN_JoystickGetDeviceInstanceID(int device_index)
static bool EMSCRIPTEN_JoystickOpen(SDL_Joystick *joystick, int device_index)
{
SDL_joylist_item *item = JoystickByDeviceIndex(device_index);
bool rumble_available = false;
if (!item) {
return SDL_SetError("No such device");
@@ -323,6 +324,22 @@ static bool EMSCRIPTEN_JoystickOpen(SDL_Joystick *joystick, int device_index)
joystick->nbuttons = item->nbuttons;
joystick->naxes = item->naxes;
rumble_available = EM_ASM_INT({
let gamepads = navigator['getGamepads']();
if (!gamepads) {
return 0;
}
let gamepad = gamepads[$0];
if (!gamepad || !gamepad['vibrationActuator']) {
return 0;
}
return 1;
}, item->index);
if (rumble_available) {
SDL_SetBooleanProperty(SDL_GetJoystickProperties(joystick), SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN, true);
}
return true;
}
@@ -390,7 +407,29 @@ static SDL_GUID EMSCRIPTEN_JoystickGetDeviceGUID(int device_index)
static bool EMSCRIPTEN_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
{
return SDL_Unsupported();
SDL_joylist_item *item = (SDL_joylist_item *)joystick->hwdata;
// clang-format off
bool result = EM_ASM_INT({
let gamepads = navigator['getGamepads']();
if (!gamepads) {
return 0;
}
let gamepad = gamepads[$0];
if (!gamepad || !gamepad['vibrationActuator']) {
return 0;
}
gamepad['vibrationActuator']['playEffect']('dual-rumble', {
'startDelay': 0,
'duration': 3000,
'weakMagnitude': $1 / 0xFFFF,
'strongMagnitude': $2 / 0xFFFF,
});
return 1;
}, item->index, low_frequency_rumble, high_frequency_rumble);
return result;
}
static bool EMSCRIPTEN_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble)
+18 -6
View File
@@ -251,6 +251,7 @@ typedef struct
Uint64 last_packet;
int player_index;
bool player_lights;
bool enhanced_rumble;
Uint8 rumble_left;
Uint8 rumble_right;
bool color_set;
@@ -432,6 +433,14 @@ static bool HIDAPI_DriverPS5_InitDevice(SDL_HIDAPI_Device *device)
}
}
if (device->vendor_id == USB_VENDOR_SONY) {
if (device->product_id == USB_PRODUCT_SONY_DS5_EDGE ||
ctx->firmware_version == 0 || // Assume that it's updated firmware over Bluetooth
ctx->firmware_version >= 0x0224) {
ctx->enhanced_rumble = true;
}
}
// Get the device capabilities
if (device->vendor_id == USB_VENDOR_SONY) {
ctx->sensors_supported = true;
@@ -684,17 +693,17 @@ static bool HIDAPI_DriverPS5_UpdateEffects(SDL_DriverPS5_Context *ctx, int effec
if (ctx->vibration_supported) {
if (ctx->rumble_left || ctx->rumble_right) {
if (ctx->firmware_version < 0x0224) {
if (ctx->enhanced_rumble) {
effects.ucEnableBits3 |= 0x04; // Enable improved rumble emulation on 2.24 firmware and newer
effects.ucRumbleLeft = ctx->rumble_left;
effects.ucRumbleRight = ctx->rumble_right;
} else {
effects.ucEnableBits1 |= 0x01; // Enable rumble emulation
// Shift to reduce effective rumble strength to match Xbox controllers
effects.ucRumbleLeft = ctx->rumble_left >> 1;
effects.ucRumbleRight = ctx->rumble_right >> 1;
} else {
effects.ucEnableBits3 |= 0x04; // Enable improved rumble emulation on 2.24 firmware and newer
effects.ucRumbleLeft = ctx->rumble_left;
effects.ucRumbleRight = ctx->rumble_right;
}
effects.ucEnableBits1 |= 0x02; // Disable audio haptics
} else {
@@ -1038,6 +1047,9 @@ static bool HIDAPI_DriverPS5_InternalSendJoystickEffect(SDL_DriverPS5_Context *c
if (!ctx->enhanced_mode) {
if (application_usage) {
HIDAPI_DriverPS5_UpdateEnhancedModeOnApplicationUsage(ctx);
// Wait briefly before sending additional effects
SDL_Delay(10);
}
if (!ctx->enhanced_mode) {
+1 -1
View File
@@ -28,7 +28,7 @@
#ifdef SDL_THREAD_SAFETY_ANALYSIS
extern SDL_Mutex *SDL_HIDAPI_rumble_lock;
#endif
bool SDL_HIDAPI_LockRumble(void) SDL_TRY_ACQUIRE(0, SDL_HIDAPI_rumble_lock);
bool SDL_HIDAPI_LockRumble(void) SDL_TRY_ACQUIRE(true, SDL_HIDAPI_rumble_lock);
bool SDL_HIDAPI_GetPendingRumbleLocked(SDL_HIDAPI_Device *device, Uint8 **data, int **size, int *maximum_size);
int SDL_HIDAPI_SendRumbleAndUnlock(SDL_HIDAPI_Device *device, const Uint8 *data, int size) SDL_RELEASE(SDL_HIDAPI_rumble_lock);
typedef void (*SDL_HIDAPI_RumbleSentCallback)(void *userdata);
+23 -16
View File
@@ -706,13 +706,6 @@ static void RotatePad(int *pX, int *pY, float flAngleInRad)
*pX = (int)(SDL_cosf(flAngleInRad) * origX - SDL_sinf(flAngleInRad) * origY);
*pY = (int)(SDL_sinf(flAngleInRad) * origX + SDL_cosf(flAngleInRad) * origY);
}
static void RotatePadShort(short *pX, short *pY, float flAngleInRad)
{
int origX = *pX, origY = *pY;
*pX = (short)(SDL_cosf(flAngleInRad) * origX - SDL_sinf(flAngleInRad) * origY);
*pY = (short)(SDL_sinf(flAngleInRad) * origX + SDL_cosf(flAngleInRad) * origY);
}
//---------------------------------------------------------------------------
// Format the first part of the state packet
@@ -836,9 +829,16 @@ static void FormatStatePacketUntilGyro(SteamControllerStateInternal_t *pState, V
//---------------------------------------------------------------------------
static bool UpdateBLESteamControllerState(const uint8_t *pData, int nDataSize, SteamControllerStateInternal_t *pState)
{
const float flRotationAngle = 0.261799f;
int nLeftPadX;
int nLeftPadY;
int nRightPadX;
int nRightPadY;
int nPadOffset;
uint32_t ucOptionDataMask;
// 15 degrees in rad
const float flRotationAngle = 0.261799f;
pState->unPacketNum++;
ucOptionDataMask = (*pData++ & 0xF0);
ucOptionDataMask |= (uint32_t)(*pData++) << 8;
@@ -867,7 +867,6 @@ static bool UpdateBLESteamControllerState(const uint8_t *pData, int nDataSize, S
}
if (ucOptionDataMask & k_EBLELeftTrackpadChunk) {
int nLength = sizeof(pState->sLeftPadX) + sizeof(pState->sLeftPadY);
int nPadOffset;
SDL_memcpy(&pState->sLeftPadX, pData, nLength);
if (pState->ulButtons & STEAM_LEFTPAD_FINGERDOWN_MASK) {
nPadOffset = 1000;
@@ -875,14 +874,15 @@ static bool UpdateBLESteamControllerState(const uint8_t *pData, int nDataSize, S
nPadOffset = 0;
}
RotatePadShort(&pState->sLeftPadX, &pState->sLeftPadY, -flRotationAngle);
pState->sLeftPadX = (short)clamp(pState->sLeftPadX + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pState->sLeftPadY = (short)clamp(pState->sLeftPadY + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
nLeftPadX = pState->sLeftPadX;
nLeftPadY = pState->sLeftPadY;
RotatePad(&nLeftPadX, &nLeftPadY, -flRotationAngle);
pState->sLeftPadX = (short)clamp(nLeftPadX + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pState->sLeftPadY = (short)clamp(nLeftPadY + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pData += nLength;
}
if (ucOptionDataMask & k_EBLERightTrackpadChunk) {
int nLength = sizeof(pState->sRightPadX) + sizeof(pState->sRightPadY);
int nPadOffset = 0;
SDL_memcpy(&pState->sRightPadX, pData, nLength);
@@ -892,9 +892,11 @@ static bool UpdateBLESteamControllerState(const uint8_t *pData, int nDataSize, S
nPadOffset = 0;
}
RotatePadShort(&pState->sRightPadX, &pState->sRightPadY, flRotationAngle);
pState->sRightPadX = (short)clamp(pState->sRightPadX + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pState->sRightPadY = (short)clamp(pState->sRightPadY + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
nRightPadX = pState->sRightPadX;
nRightPadY = pState->sRightPadY;
RotatePad(&nRightPadX, &nRightPadY, flRotationAngle);
pState->sRightPadX = (short)clamp(nRightPadX + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pState->sRightPadY = (short)clamp(nRightPadY + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pData += nLength;
}
if (ucOptionDataMask & k_EBLEIMUAccelChunk) {
@@ -1038,6 +1040,11 @@ static bool HIDAPI_DriverSteam_IsSupportedDevice(SDL_HIDAPI_Device *device, cons
return false;
}
if (!device) {
// Might be supported by this driver, enumerate and find out
return true;
}
if (device->is_bluetooth) {
return true;
}
+50 -36
View File
@@ -159,20 +159,21 @@ typedef struct
Uint8 ucVibrationCode;
} SwitchControllerStatePacket_t;
typedef struct
{
Sint16 sAccelX;
Sint16 sAccelY;
Sint16 sAccelZ;
Sint16 sGyroX;
Sint16 sGyroY;
Sint16 sGyroZ;
} SwitchControllerIMUState_t;
typedef struct
{
SwitchControllerStatePacket_t controllerState;
struct
{
Sint16 sAccelX;
Sint16 sAccelY;
Sint16 sAccelZ;
Sint16 sGyroX;
Sint16 sGyroY;
Sint16 sGyroZ;
} imuState[3];
SwitchControllerIMUState_t imuState[3];
} SwitchStatePacket_t;
typedef struct
@@ -388,7 +389,7 @@ static int WriteOutput(SDL_DriverSwitch_Context *ctx, const Uint8 *data, int siz
#endif // SWITCH_SYNCHRONOUS_WRITES
}
static SwitchSubcommandInputPacket_t *ReadSubcommandReply(SDL_DriverSwitch_Context *ctx, ESwitchSubcommandIDs expectedID)
static SwitchSubcommandInputPacket_t *ReadSubcommandReply(SDL_DriverSwitch_Context *ctx, ESwitchSubcommandIDs expectedID, const Uint8 *pBuf, Uint8 ucLen)
{
// Average response time for messages is ~30ms
Uint64 endTicks = SDL_GetTicks() + 100;
@@ -398,9 +399,17 @@ static SwitchSubcommandInputPacket_t *ReadSubcommandReply(SDL_DriverSwitch_Conte
if (nRead > 0) {
if (ctx->m_rgucReadBuffer[0] == k_eSwitchInputReportIDs_SubcommandReply) {
SwitchSubcommandInputPacket_t *reply = (SwitchSubcommandInputPacket_t *)&ctx->m_rgucReadBuffer[1];
if (reply->ucSubcommandID == expectedID && (reply->ucSubcommandAck & 0x80)) {
return reply;
if (reply->ucSubcommandID != expectedID || !(reply->ucSubcommandAck & 0x80)) {
continue;
}
if (reply->ucSubcommandID == k_eSwitchSubcommandIDs_SPIFlashRead) {
SDL_assert(ucLen == sizeof(reply->spiReadData.opData));
if (SDL_memcmp(&reply->spiReadData.opData, pBuf, ucLen) != 0) {
// This was a reply for another SPI read command
continue;
}
}
return reply;
}
} else {
SDL_Delay(1);
@@ -487,7 +496,7 @@ static bool WriteSubcommand(SDL_DriverSwitch_Context *ctx, ESwitchSubcommandIDs
continue;
}
reply = ReadSubcommandReply(ctx, ucCommandID);
reply = ReadSubcommandReply(ctx, ucCommandID, pBuf, ucLen);
}
if (ppReply) {
@@ -2589,9 +2598,14 @@ static void HandleFullControllerState(SDL_Joystick *joystick, SDL_DriverSwitch_C
SDL_SendJoystickPowerInfo(joystick, state, percent);
if (ctx->m_bReportSensors) {
bool bHasSensorData = (packet->imuState[0].sAccelZ != 0 ||
packet->imuState[0].sAccelY != 0 ||
packet->imuState[0].sAccelX != 0);
// Need to copy the imuState to an aligned variable
SwitchControllerIMUState_t imuState[3];
SDL_assert(sizeof(imuState) == sizeof(packet->imuState));
SDL_memcpy(imuState, packet->imuState, sizeof(imuState));
bool bHasSensorData = (imuState[0].sAccelZ != 0 ||
imuState[0].sAccelY != 0 ||
imuState[0].sAccelX != 0);
if (bHasSensorData) {
const Uint32 IMU_UPDATE_RATE_SAMPLE_FREQUENCY = 1000;
Uint64 sensor_timestamp[3];
@@ -2620,37 +2634,37 @@ static void HandleFullControllerState(SDL_Joystick *joystick, SDL_DriverSwitch_C
if (!ctx->device->parent ||
ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight) {
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO, sensor_timestamp[0], &packet->imuState[2].sGyroX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL, sensor_timestamp[0], &packet->imuState[2].sAccelX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO, sensor_timestamp[0], &imuState[2].sGyroX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL, sensor_timestamp[0], &imuState[2].sAccelX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO, sensor_timestamp[1], &packet->imuState[1].sGyroX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL, sensor_timestamp[1], &packet->imuState[1].sAccelX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO, sensor_timestamp[1], &imuState[1].sGyroX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL, sensor_timestamp[1], &imuState[1].sAccelX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO, sensor_timestamp[2], &packet->imuState[0].sGyroX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL, sensor_timestamp[2], &packet->imuState[0].sAccelX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO, sensor_timestamp[2], &imuState[0].sGyroX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL, sensor_timestamp[2], &imuState[0].sAccelX);
}
if (ctx->device->parent &&
ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConLeft) {
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO_L, sensor_timestamp[0], &packet->imuState[2].sGyroX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL_L, sensor_timestamp[0], &packet->imuState[2].sAccelX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO_L, sensor_timestamp[0], &imuState[2].sGyroX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL_L, sensor_timestamp[0], &imuState[2].sAccelX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO_L, sensor_timestamp[1], &packet->imuState[1].sGyroX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL_L, sensor_timestamp[1], &packet->imuState[1].sAccelX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO_L, sensor_timestamp[1], &imuState[1].sGyroX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL_L, sensor_timestamp[1], &imuState[1].sAccelX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO_L, sensor_timestamp[2], &packet->imuState[0].sGyroX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL_L, sensor_timestamp[2], &packet->imuState[0].sAccelX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO_L, sensor_timestamp[2], &imuState[0].sGyroX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL_L, sensor_timestamp[2], &imuState[0].sAccelX);
}
if (ctx->device->parent &&
ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight) {
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO_R, sensor_timestamp[0], &packet->imuState[2].sGyroX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL_R, sensor_timestamp[0], &packet->imuState[2].sAccelX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO_R, sensor_timestamp[0], &imuState[2].sGyroX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL_R, sensor_timestamp[0], &imuState[2].sAccelX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO_R, sensor_timestamp[1], &packet->imuState[1].sGyroX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL_R, sensor_timestamp[1], &packet->imuState[1].sAccelX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO_R, sensor_timestamp[1], &imuState[1].sGyroX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL_R, sensor_timestamp[1], &imuState[1].sAccelX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO_R, sensor_timestamp[2], &packet->imuState[0].sGyroX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL_R, sensor_timestamp[2], &packet->imuState[0].sAccelX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO_R, sensor_timestamp[2], &imuState[0].sGyroX);
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL_R, sensor_timestamp[2], &imuState[0].sAccelX);
}
} else if (ctx->m_bHasSensorData) {
+31 -6
View File
@@ -150,6 +150,8 @@ typedef struct SDL_joylist_item
{
SDL_JoystickID device_instance;
char *path; // "/dev/input/event2" or whatever
Uint16 vendor;
Uint16 product;
char *name; // "SideWinder 3D Pro" or whatever
SDL_GUID guid;
dev_t devnum;
@@ -486,6 +488,8 @@ static void MaybeAddDevice(const char *path)
item->devnum = sb.st_rdev;
item->steam_virtual_gamepad_slot = -1;
item->path = SDL_strdup(path);
item->vendor = vendor;
item->product = product;
item->name = name;
item->guid = guid;
@@ -1844,6 +1848,20 @@ static void PollAllValues(Uint64 timestamp, SDL_Joystick *joystick)
// Joyballs are relative input, so there's no poll state. Events only!
}
static void CorrectSensorData(struct joystick_hwdata *hwdata, float *values, float *data)
{
if (hwdata->item->vendor == USB_VENDOR_NINTENDO) {
// The Nintendo driver uses a different axis order than SDL
data[0] = -values[1];
data[1] = values[2];
data[2] = -values[0];
} else {
data[0] = values[0];
data[1] = values[1];
data[2] = values[2];
}
}
static void PollAllSensors(Uint64 timestamp, SDL_Joystick *joystick)
{
struct input_absinfo absinfo;
@@ -1854,27 +1872,31 @@ static void PollAllSensors(Uint64 timestamp, SDL_Joystick *joystick)
SDL_assert(joystick->hwdata->fd_sensor >= 0);
if (joystick->hwdata->has_gyro) {
float data[3] = {0.0f, 0.0f, 0.0f};
float values[3] = {0.0f, 0.0f, 0.0f};
for (i = 0; i < 3; i++) {
if (ioctl(joystick->hwdata->fd_sensor, EVIOCGABS(ABS_RX + i), &absinfo) >= 0) {
data[i] = absinfo.value * (SDL_PI_F / 180.f) / joystick->hwdata->gyro_scale[i];
values[i] = absinfo.value * (SDL_PI_F / 180.f) / joystick->hwdata->gyro_scale[i];
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick : Re-read Gyro (axis %d) val= %f", i, data[i]);
#endif
}
}
float data[3];
CorrectSensorData(joystick->hwdata, values, data);
SDL_SendJoystickSensor(timestamp, joystick, SDL_SENSOR_GYRO, SDL_US_TO_NS(joystick->hwdata->sensor_tick), data, 3);
}
if (joystick->hwdata->has_accelerometer) {
float data[3] = {0.0f, 0.0f, 0.0f};
float values[3] = {0.0f, 0.0f, 0.0f};
for (i = 0; i < 3; i++) {
if (ioctl(joystick->hwdata->fd_sensor, EVIOCGABS(ABS_X + i), &absinfo) >= 0) {
data[i] = absinfo.value * SDL_STANDARD_GRAVITY / joystick->hwdata->accelerometer_scale[i];
values[i] = absinfo.value * SDL_STANDARD_GRAVITY / joystick->hwdata->accelerometer_scale[i];
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick : Re-read Accelerometer (axis %d) val= %f", i, data[i]);
#endif
}
}
float data[3];
CorrectSensorData(joystick->hwdata, values, data);
SDL_SendJoystickSensor(timestamp, joystick, SDL_SENSOR_ACCEL, SDL_US_TO_NS(joystick->hwdata->sensor_tick), data, 3);
}
}
@@ -2058,12 +2080,15 @@ static void HandleInputEvents(SDL_Joystick *joystick)
PollAllSensors(SDL_GetTicksNS(), joystick); // try to sync up to current state now
} else {
Uint64 timestamp = SDL_EVDEV_GetEventTimestamp(event);
float data[3];
CorrectSensorData(joystick->hwdata, joystick->hwdata->gyro_data, data);
SDL_SendJoystickSensor(timestamp, joystick, SDL_SENSOR_GYRO,
SDL_US_TO_NS(joystick->hwdata->sensor_tick),
joystick->hwdata->gyro_data, 3);
data, 3);
CorrectSensorData(joystick->hwdata, joystick->hwdata->accel_data, data);
SDL_SendJoystickSensor(timestamp, joystick, SDL_SENSOR_ACCEL,
SDL_US_TO_NS(joystick->hwdata->sensor_tick),
joystick->hwdata->accel_data, 3);
data, 3);
}
break;
default:
+1 -1
View File
@@ -471,7 +471,7 @@ bool SDL_SendJoystickVirtualSensorDataInner(SDL_Joystick *joystick, SDL_SensorTy
return false;
}
hwdata->sensor_events = sensor_events;
hwdata->max_sensor_events = hwdata->max_sensor_events;
hwdata->max_sensor_events = new_max_sensor_events;
}
VirtualSensorEvent *event = &hwdata->sensor_events[hwdata->num_sensor_events++];
@@ -69,6 +69,7 @@ typedef PCWSTR(WINAPI *WindowsGetStringRawBuffer_t)(HSTRING string, UINT32 *leng
static struct
{
bool ro_initialized;
CoIncrementMTAUsage_t CoIncrementMTAUsage;
RoGetActivationFactory_t RoGetActivationFactory;
WindowsCreateStringReference_t WindowsCreateStringReference;
@@ -585,13 +586,14 @@ static bool WGI_JoystickInit(void)
{
HRESULT hr;
if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_WGI, true)) {
if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_WGI, false)) {
return true;
}
if (FAILED(WIN_RoInitialize())) {
return SDL_SetError("RoInitialize() failed");
}
wgi.ro_initialized = true;
#define RESOLVE(x) wgi.x = (x##_t)WIN_LoadComBaseFunction(#x); if (!wgi.x) return WIN_SetError("GetProcAddress failed for " #x);
RESOLVE(CoIncrementMTAUsage);
@@ -1002,7 +1004,9 @@ static void WGI_JoystickQuit(void)
__x_ABI_CWindows_CGaming_CInput_CIRawGameControllerStatics_Release(wgi.controller_statics);
}
WIN_RoUninitialize();
if (wgi.ro_initialized) {
WIN_RoUninitialize();
}
SDL_zero(wgi);
}
+11
View File
@@ -43,6 +43,17 @@ static SDLIosMainCallbacksDisplayLink *globalDisplayLink;
{
if ((self = [super init])) {
self.displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(appIteration:)];
// Enable high refresh rates on iOS
// To enable this on phones, you should add the following line to Info.plist:
// <key>CADisableMinimumFrameDurationOnPhone</key> <true/>
// If main callbacks are used then this CADisplayLink will affect framerate, not one in SDL_uikitviewcontroller.
if (@available(iOS 15.0, tvOS 15.0, *)) {
const SDL_DisplayMode *mode = SDL_GetDesktopDisplayMode(SDL_GetPrimaryDisplay());
if (mode && mode->refresh_rate > 60.0f) {
int frame_rate = (int)mode->refresh_rate;
self.displayLink.preferredFrameRateRange = CAFrameRateRangeMake((frame_rate * 2) / 3, frame_rate, frame_rate);
}
}
[self.displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
}
return self;
-135
View File
@@ -1,135 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "SDL_internal.h"
#if defined(SDL_VIDEO_RENDER_D3D) || \
defined(SDL_VIDEO_RENDER_D3D11) || \
defined(SDL_VIDEO_RENDER_D3D12) || \
defined(SDL_VIDEO_RENDER_VULKAN)
#include "SDL_d3dmath.h"
// Direct3D matrix math functions
Float4X4 MatrixIdentity(void)
{
Float4X4 m;
SDL_zero(m);
m.v._11 = 1.0f;
m.v._22 = 1.0f;
m.v._33 = 1.0f;
m.v._44 = 1.0f;
return m;
}
Float4X4 MatrixMultiply(Float4X4 M1, Float4X4 M2)
{
Float4X4 m;
m.v._11 = M1.v._11 * M2.v._11 + M1.v._12 * M2.v._21 + M1.v._13 * M2.v._31 + M1.v._14 * M2.v._41;
m.v._12 = M1.v._11 * M2.v._12 + M1.v._12 * M2.v._22 + M1.v._13 * M2.v._32 + M1.v._14 * M2.v._42;
m.v._13 = M1.v._11 * M2.v._13 + M1.v._12 * M2.v._23 + M1.v._13 * M2.v._33 + M1.v._14 * M2.v._43;
m.v._14 = M1.v._11 * M2.v._14 + M1.v._12 * M2.v._24 + M1.v._13 * M2.v._34 + M1.v._14 * M2.v._44;
m.v._21 = M1.v._21 * M2.v._11 + M1.v._22 * M2.v._21 + M1.v._23 * M2.v._31 + M1.v._24 * M2.v._41;
m.v._22 = M1.v._21 * M2.v._12 + M1.v._22 * M2.v._22 + M1.v._23 * M2.v._32 + M1.v._24 * M2.v._42;
m.v._23 = M1.v._21 * M2.v._13 + M1.v._22 * M2.v._23 + M1.v._23 * M2.v._33 + M1.v._24 * M2.v._43;
m.v._24 = M1.v._21 * M2.v._14 + M1.v._22 * M2.v._24 + M1.v._23 * M2.v._34 + M1.v._24 * M2.v._44;
m.v._31 = M1.v._31 * M2.v._11 + M1.v._32 * M2.v._21 + M1.v._33 * M2.v._31 + M1.v._34 * M2.v._41;
m.v._32 = M1.v._31 * M2.v._12 + M1.v._32 * M2.v._22 + M1.v._33 * M2.v._32 + M1.v._34 * M2.v._42;
m.v._33 = M1.v._31 * M2.v._13 + M1.v._32 * M2.v._23 + M1.v._33 * M2.v._33 + M1.v._34 * M2.v._43;
m.v._34 = M1.v._31 * M2.v._14 + M1.v._32 * M2.v._24 + M1.v._33 * M2.v._34 + M1.v._34 * M2.v._44;
m.v._41 = M1.v._41 * M2.v._11 + M1.v._42 * M2.v._21 + M1.v._43 * M2.v._31 + M1.v._44 * M2.v._41;
m.v._42 = M1.v._41 * M2.v._12 + M1.v._42 * M2.v._22 + M1.v._43 * M2.v._32 + M1.v._44 * M2.v._42;
m.v._43 = M1.v._41 * M2.v._13 + M1.v._42 * M2.v._23 + M1.v._43 * M2.v._33 + M1.v._44 * M2.v._43;
m.v._44 = M1.v._41 * M2.v._14 + M1.v._42 * M2.v._24 + M1.v._43 * M2.v._34 + M1.v._44 * M2.v._44;
return m;
}
Float4X4 MatrixScaling(float x, float y, float z)
{
Float4X4 m;
SDL_zero(m);
m.v._11 = x;
m.v._22 = y;
m.v._33 = z;
m.v._44 = 1.0f;
return m;
}
Float4X4 MatrixTranslation(float x, float y, float z)
{
Float4X4 m;
SDL_zero(m);
m.v._11 = 1.0f;
m.v._22 = 1.0f;
m.v._33 = 1.0f;
m.v._44 = 1.0f;
m.v._41 = x;
m.v._42 = y;
m.v._43 = z;
return m;
}
Float4X4 MatrixRotationX(float r)
{
float sinR = SDL_sinf(r);
float cosR = SDL_cosf(r);
Float4X4 m;
SDL_zero(m);
m.v._11 = 1.0f;
m.v._22 = cosR;
m.v._23 = sinR;
m.v._32 = -sinR;
m.v._33 = cosR;
m.v._44 = 1.0f;
return m;
}
Float4X4 MatrixRotationY(float r)
{
float sinR = SDL_sinf(r);
float cosR = SDL_cosf(r);
Float4X4 m;
SDL_zero(m);
m.v._11 = cosR;
m.v._13 = -sinR;
m.v._22 = 1.0f;
m.v._31 = sinR;
m.v._33 = cosR;
m.v._44 = 1.0f;
return m;
}
Float4X4 MatrixRotationZ(float r)
{
float sinR = SDL_sinf(r);
float cosR = SDL_cosf(r);
Float4X4 m;
SDL_zero(m);
m.v._11 = cosR;
m.v._12 = sinR;
m.v._21 = -sinR;
m.v._22 = cosR;
m.v._33 = 1.0f;
m.v._44 = 1.0f;
return m;
}
#endif // SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12 || SDL_VIDEO_RENDER_VULKAN
+102 -7
View File
@@ -69,13 +69,108 @@ typedef struct
};
} Float4X4;
extern Float4X4 MatrixIdentity(void);
extern Float4X4 MatrixMultiply(Float4X4 M1, Float4X4 M2);
extern Float4X4 MatrixScaling(float x, float y, float z);
extern Float4X4 MatrixTranslation(float x, float y, float z);
extern Float4X4 MatrixRotationX(float r);
extern Float4X4 MatrixRotationY(float r);
extern Float4X4 MatrixRotationZ(float r);
static inline Float4X4 MatrixIdentity(void)
{
Float4X4 m;
SDL_zero(m);
m.v._11 = 1.0f;
m.v._22 = 1.0f;
m.v._33 = 1.0f;
m.v._44 = 1.0f;
return m;
}
static inline Float4X4 MatrixMultiply(Float4X4 M1, Float4X4 M2)
{
Float4X4 m;
m.v._11 = M1.v._11 * M2.v._11 + M1.v._12 * M2.v._21 + M1.v._13 * M2.v._31 + M1.v._14 * M2.v._41;
m.v._12 = M1.v._11 * M2.v._12 + M1.v._12 * M2.v._22 + M1.v._13 * M2.v._32 + M1.v._14 * M2.v._42;
m.v._13 = M1.v._11 * M2.v._13 + M1.v._12 * M2.v._23 + M1.v._13 * M2.v._33 + M1.v._14 * M2.v._43;
m.v._14 = M1.v._11 * M2.v._14 + M1.v._12 * M2.v._24 + M1.v._13 * M2.v._34 + M1.v._14 * M2.v._44;
m.v._21 = M1.v._21 * M2.v._11 + M1.v._22 * M2.v._21 + M1.v._23 * M2.v._31 + M1.v._24 * M2.v._41;
m.v._22 = M1.v._21 * M2.v._12 + M1.v._22 * M2.v._22 + M1.v._23 * M2.v._32 + M1.v._24 * M2.v._42;
m.v._23 = M1.v._21 * M2.v._13 + M1.v._22 * M2.v._23 + M1.v._23 * M2.v._33 + M1.v._24 * M2.v._43;
m.v._24 = M1.v._21 * M2.v._14 + M1.v._22 * M2.v._24 + M1.v._23 * M2.v._34 + M1.v._24 * M2.v._44;
m.v._31 = M1.v._31 * M2.v._11 + M1.v._32 * M2.v._21 + M1.v._33 * M2.v._31 + M1.v._34 * M2.v._41;
m.v._32 = M1.v._31 * M2.v._12 + M1.v._32 * M2.v._22 + M1.v._33 * M2.v._32 + M1.v._34 * M2.v._42;
m.v._33 = M1.v._31 * M2.v._13 + M1.v._32 * M2.v._23 + M1.v._33 * M2.v._33 + M1.v._34 * M2.v._43;
m.v._34 = M1.v._31 * M2.v._14 + M1.v._32 * M2.v._24 + M1.v._33 * M2.v._34 + M1.v._34 * M2.v._44;
m.v._41 = M1.v._41 * M2.v._11 + M1.v._42 * M2.v._21 + M1.v._43 * M2.v._31 + M1.v._44 * M2.v._41;
m.v._42 = M1.v._41 * M2.v._12 + M1.v._42 * M2.v._22 + M1.v._43 * M2.v._32 + M1.v._44 * M2.v._42;
m.v._43 = M1.v._41 * M2.v._13 + M1.v._42 * M2.v._23 + M1.v._43 * M2.v._33 + M1.v._44 * M2.v._43;
m.v._44 = M1.v._41 * M2.v._14 + M1.v._42 * M2.v._24 + M1.v._43 * M2.v._34 + M1.v._44 * M2.v._44;
return m;
}
static inline Float4X4 MatrixScaling(float x, float y, float z)
{
Float4X4 m;
SDL_zero(m);
m.v._11 = x;
m.v._22 = y;
m.v._33 = z;
m.v._44 = 1.0f;
return m;
}
static inline Float4X4 MatrixTranslation(float x, float y, float z)
{
Float4X4 m;
SDL_zero(m);
m.v._11 = 1.0f;
m.v._22 = 1.0f;
m.v._33 = 1.0f;
m.v._44 = 1.0f;
m.v._41 = x;
m.v._42 = y;
m.v._43 = z;
return m;
}
static inline Float4X4 MatrixRotationX(float r)
{
float sinR = SDL_sinf(r);
float cosR = SDL_cosf(r);
Float4X4 m;
SDL_zero(m);
m.v._11 = 1.0f;
m.v._22 = cosR;
m.v._23 = sinR;
m.v._32 = -sinR;
m.v._33 = cosR;
m.v._44 = 1.0f;
return m;
}
static inline Float4X4 MatrixRotationY(float r)
{
float sinR = SDL_sinf(r);
float cosR = SDL_cosf(r);
Float4X4 m;
SDL_zero(m);
m.v._11 = cosR;
m.v._13 = -sinR;
m.v._22 = 1.0f;
m.v._31 = sinR;
m.v._33 = cosR;
m.v._44 = 1.0f;
return m;
}
static inline Float4X4 MatrixRotationZ(float r)
{
float sinR = SDL_sinf(r);
float cosR = SDL_cosf(r);
Float4X4 m;
SDL_zero(m);
m.v._11 = cosR;
m.v._12 = sinR;
m.v._21 = -sinR;
m.v._22 = cosR;
m.v._33 = 1.0f;
m.v._44 = 1.0f;
return m;
}
// Ends C function definitions when using C++
#ifdef __cplusplus
-94
View File
@@ -2737,94 +2737,6 @@ bool SDL_GetRenderLogicalPresentationRect(SDL_Renderer *renderer, SDL_FRect *rec
return true;
}
static void SDL_RenderLogicalBorders(SDL_Renderer *renderer, const SDL_FRect *dst)
{
const SDL_RenderViewState *view = renderer->view;
if (dst->x > 0.0f || dst->y > 0.0f) {
SDL_BlendMode saved_blend_mode = renderer->blendMode;
SDL_FColor saved_color = renderer->color;
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE);
SDL_SetRenderDrawColorFloat(renderer, 0.0f, 0.0f, 0.0f, 1.0f);
if (dst->x > 0.0f) {
SDL_FRect rect;
rect.x = 0.0f;
rect.y = 0.0f;
rect.w = dst->x;
rect.h = (float)view->pixel_h;
SDL_RenderFillRect(renderer, &rect);
rect.x = dst->x + dst->w;
rect.w = (float)view->pixel_w - rect.x;
SDL_RenderFillRect(renderer, &rect);
}
if (dst->y > 0.0f) {
SDL_FRect rect;
rect.x = 0.0f;
rect.y = 0.0f;
rect.w = (float)view->pixel_w;
rect.h = dst->y;
SDL_RenderFillRect(renderer, &rect);
rect.y = dst->y + dst->h;
rect.h = (float)view->pixel_h - rect.y;
SDL_RenderFillRect(renderer, &rect);
}
SDL_SetRenderDrawBlendMode(renderer, saved_blend_mode);
SDL_SetRenderDrawColorFloat(renderer, saved_color.r, saved_color.g, saved_color.b, saved_color.a);
}
}
static void SDL_RenderLogicalPresentation(SDL_Renderer *renderer)
{
SDL_assert(renderer->view == &renderer->main_view);
SDL_RenderViewState *view = &renderer->main_view;
const SDL_RendererLogicalPresentation mode = view->logical_presentation_mode;
if (mode == SDL_LOGICAL_PRESENTATION_LETTERBOX) {
// save off some state we're going to trample.
const int logical_w = view->logical_w;
const int logical_h = view->logical_h;
const float scale_x = view->scale.x;
const float scale_y = view->scale.y;
const bool clipping_enabled = view->clipping_enabled;
SDL_Rect orig_viewport, orig_cliprect;
const SDL_FRect logical_dst_rect = view->logical_dst_rect;
SDL_copyp(&orig_viewport, &view->viewport);
if (clipping_enabled) {
SDL_copyp(&orig_cliprect, &view->clip_rect);
}
// trample some state.
SDL_SetRenderLogicalPresentation(renderer, logical_w, logical_h, SDL_LOGICAL_PRESENTATION_DISABLED);
SDL_SetRenderViewport(renderer, NULL);
if (clipping_enabled) {
SDL_SetRenderClipRect(renderer, NULL);
}
SDL_SetRenderScale(renderer, 1.0f, 1.0f);
// draw the borders.
SDL_RenderLogicalBorders(renderer, &logical_dst_rect);
// now set everything back.
view->logical_presentation_mode = mode;
SDL_SetRenderViewport(renderer, &orig_viewport);
if (clipping_enabled) {
SDL_SetRenderClipRect(renderer, &orig_cliprect);
}
SDL_SetRenderScale(renderer, scale_x, scale_y);
SDL_SetRenderLogicalPresentation(renderer, logical_w, logical_h, mode);
}
}
static bool SDL_RenderVectorFromWindow(SDL_Renderer *renderer, float window_dx, float window_dy, float *dx, float *dy)
{
// Convert from window coordinates to pixels within the window
@@ -3306,10 +3218,6 @@ bool SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode)
return SDL_InvalidParamError("blendMode");
}
if (blendMode == SDL_BLENDMODE_INVALID) {
return SDL_InvalidParamError("blendMode");
}
if (!IsSupportedBlendMode(renderer, blendMode)) {
return SDL_Unsupported();
}
@@ -5140,8 +5048,6 @@ bool SDL_RenderPresent(SDL_Renderer *renderer)
SDL_SetRenderTarget(renderer, NULL);
}
SDL_RenderLogicalPresentation(renderer);
if (renderer->transparent_window) {
SDL_RenderApplyWindowShape(renderer);
}
+2
View File
@@ -620,6 +620,8 @@ static bool InitVertexBuffer(GPU_RenderData *data, Uint32 size)
return false;
}
data->vertices.buffer_size = size;
return true;
}
Loaded 100 of 160 files, more files were not shown because too many files have changed in this diff. Show more