Commit Graph

22580 Commits

Author SHA1 Message Date
Frank Praznik
4d9cd86775 x11: Move the xinput2 device info to the xinput2 source file
It was declared in the mouse header, but is not actually needed there aside from cleanup, which can be moved to the xinput2 quit function.
2026-09-12 10:51:33 -04:00
Sylvain
73cd5b2bbb Android: only register java HIDAPI methods if SDL_HIDAPI is enabled 2026-09-12 07:22:41 +02:00
Brad Smith
5723590ffc fs: Follow up to the initial getexecpath() support
- Add missing CMake piece
- Fix logic to quiet warning
2026-09-12 01:14:22 -04:00
Sam Lantinga
ea3963f01a Try to just recreate the surface and swap chain when being restored on Android
A full device lost + restore takes about 300ms on my Google Pixel Fold running Android 17, where just recreating the swap chain only takes about 8 ms.
2026-09-11 17:05:55 -07:00
Sam Lantinga
0cb26f9f6d Only draw if state was set successfully in the Vulkan renderer
This can fail if there is drawing queued when the device is reset and all textures are freed. This also fixes a crash when that happens.
2026-09-11 17:05:55 -07:00
Sam Lantinga
0aa28e2629 Fixed using the wrong format when using a render target on Vulkan 2026-09-11 17:05:55 -07:00
Sam Lantinga
0628d5c603 Fixed Vulkan validation error when creating a swapchain on Android 2026-09-11 17:05:55 -07:00
Sam Lantinga
5e2f8adce9 Don't try to save and restore EGL context on Vulkan windows on Android 2026-09-11 17:05:55 -07:00
Sam Lantinga
982333a48d Added support for using Android hardware buffers with the Vulkan renderer 2026-09-11 17:05:55 -07:00
Sam Lantinga
4b40cff5d4 Cache the Vulkan YUV conversion pipeline
This is very slow on some mobile devices and is a small win on desktop devices as well.
2026-09-11 17:05:55 -07:00
Ryan C. Gordon
68655e9772 kmsdrm: Instead of demanding ARGB8888, try to find a supported surface format.
Fixes #16136.
2026-09-10 23:47:24 -04:00
Anders Jenbo
015489c672 Probe joystick directly 2026-09-10 22:50:29 -04:00
Anonymous Maarten
321801ac08 check_stdlib_usage: add --no-exclude and check printf 2026-09-10 23:42:14 +02:00
Anonymous Maarten
d61bdd3324 Use SDL_snprintf instead of snprintf 2026-09-10 23:42:14 +02:00
Anonymous Maarten
3a3ebba89c haiku: Don't print screen dimensions when going full screen 2026-09-10 23:42:14 +02:00
Anonymous Maarten
a50e8a6985 Remove debug print utility functions 2026-09-10 23:42:14 +02:00
Anonymous Maarten
667eeb1a7e Use SDL_wcslen in vendored gameinput.cpp 2026-09-10 23:42:14 +02:00
Anonymous Maarten
bfd81a0da4 Replace debug printf's with SDL_Log 2026-09-10 23:42:14 +02:00
Sam Lantinga
04b2fb8046 Make sure the palette is no longer in use before freeing it in the Vulkan renderer
Fixes https://github.com/libsdl-org/SDL/issues/16283
2026-09-10 13:03:31 -07:00
Sam Lantinga
e05eb27f2c Use the surface palette directly for the texture in SDL_CreateTextureFromSurface()
This is a better fix for https://github.com/libsdl-org/SDL/issues/16227. It also allows you to create a whole set of indexed textures from surfaces that share a single palette and then modify that palette to change all textures.
2026-09-10 13:03:31 -07:00
Sam Lantinga
0f5a7cbd2c testyuv: verify the YUV surface locking path
Also implemented YUV surface locking for Vulkan
2026-09-10 13:03:31 -07:00
Sam Lantinga
3df2b1a2a7 Fixed Vulkan validation error in SDL_RenderReadPixels()
Validation Error: [ VUID-VkImageMemoryBarrier-oldLayout-01212 ] | MessageID = 0xff795e16
  vkCmdPipelineBarrier(): pImageMemoryBarriers[0].newLayout (VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL) is not compatible with VkImage 0x2160000000216 usage flags VK_IMAGE_USAGE_2_TRANSFER_DST_BIT_KHR|VK_IMAGE_USAGE_2_COLOR_ATTACHMENT_BIT_KHR.
  The Vulkan spec states: If layouts are not ignored, oldLayout or newLayout is VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL then image must have been created with the VK_IMAGE_USAGE_TRANSFER_SRC_BIT usage flag set (https://docs.vulkan.org/spec/latest/chapters/synchronization.html#VUID-VkImageMemoryBarrier-oldLayout-01212)
2026-09-10 13:03:31 -07:00
Sam Lantinga
15c9ab245f The simple shader is only for HDR10 RGB textures
The use case for this is 2D render target overlays on HDR10 output. In this case we've already done the conversion to the output colorspace and we just want to get the pixels on the screen as fast as possible. Video frames still need YUV conversion, so they shouldn't go through this output path.
2026-09-10 13:03:31 -07:00
Sam Lantinga
21f4bc47b6 Remove SDL_HAVE_YUV checks from render drivers
This doesn't actually save much code size and complicates the drivers a fair bit.

Upside is that you'll now be able to build SDL without software YUV support and still be able to play videos with hardware acceleration enabled.
2026-09-10 13:03:31 -07:00
Brad Smith
b7606be372 fs: Use getexecpath() on OpenBSD for GetExePath(). 2026-09-10 14:13:36 -04:00
x0r
ce85ee87f6 DOS: yield audio thread even when the ring buffer has space 2026-09-10 12:01:35 -04:00
Frank Praznik
b88e540783 x11: Rescan the relative valuators on XI_DeviceChanged
XI_DeviceChanged can have a reason of XISlaveSwitch, which indicates that the valuators need to be updated for the specified device.
2026-09-10 11:53:54 -04:00
Ryan C. Gordon
d66e2d0cbd cocoa: Added SDL_HINT_MAC_USE_GCMOUSE.
Reference Issue #16241.
2026-09-10 09:51:10 -04:00
Sam Lantinga
fe2bca9748 Fixed YUV size and pitch calculations 2026-09-09 14:31:22 -07:00
Frank Praznik
9adf3ff6d3 x11: Don't suppress slave mouse buttons when lacking keyboard focus
The window may not have keyboard focus when using remote control tools, so drop the keyboard focus requirement. Tested not to regress clickthrough suppression.
2026-09-09 13:40:12 -04:00
Sam Lantinga
a55e059f84 Set the texture palette before setting pixel data
This is a better fix for https://github.com/libsdl-org/SDL/issues/16227.

The original problem was that the newly created texture didn't have any palette, so when the surface data was set, colors couldn't be mapped to pixel index values. The old fix temporarily set the texture palette to the surface palette, copied the surface data, and then set the texture palette to a copy of the surface palette. This caused Vulkan validation errors because we were deleting the original palette which was still referenced by the active command buffer. Instead, we'll create the palette that we want the texture to have to start with, then copy the surface data once that's set.
2026-09-09 10:21:23 -07:00
Sam Lantinga
8f9738372c Added SDL_PIXELFORMAT_I0FL 2026-09-09 10:21:23 -07:00
Sam Lantinga
b39f0a2f08 Rename SDL_PIXELFORMAT_P408 and SDL_PIXELFORMAT_P416 to SDL_PIXELFORMAT_I444 and SDL_PIXELFORMAT_I4FL
By convention, PNNN YUV formats are bi-planar, and SDL was using them to refer to 3 plane YUV formats.

These have been replaced with I444 and I4FL, which are the most standard FOURCC values for these that I could find.
Reference: https://github.com/videolan/vlc/blob/master/src/misc/fourcc_list.h
2026-09-09 10:21:23 -07:00
Tim Stahlhut
e33401c681 Cygwin: Use SDL_windowsdialog
Add "OR CYGWIN" to "WINDOWS" guards
Add "AND NOT CYGWIN" to "UNIX" guards

[sdl-ci-filter cygwin]
[sdl-ci-filter msys2-*]
[sdl-ci-filter msvc-*]
[sdl-ci-filter ngage]
2026-09-09 06:29:23 -07:00
Anonymous Maarten
f9abf9e843 pre-mingw-w64 MinGW toolchains don't ship with a intrin.h header 2026-09-09 03:18:41 +02:00
JustinChou
8f8ed757bc Modified points.c example from i++ to ++i for performance reasons and a good starting point for beginners to develop good habits. 2026-09-08 14:59:14 -07:00
Frank Praznik
aa5bffa6d3 wayland: Don't use a stale scaling factor
The output integer scale may not be re-sent if the display geometry changed, but the scale factor didn't. Cache and restore it on the integer path, to prevent an old value from being used, and possibly rounded to zero if the old value was less than 1.0.
2026-09-08 15:42:22 -04:00
Frank Praznik
184a070c5f Remove uses of stpcpy()
This function was only standardized in POSIX.1-2008, is not part of any ISO C standard, and is generally considered unsafe. Use SDL_strlcpy() instead.
2026-09-08 14:29:55 -04:00
Frank Praznik
f48fa604b0 x11: Clear the internal selection data when updating the clipboard
Clear the internal X11 clipboard selection data when updating the clipboard during SelectionNotify events, as it is invalid after the update. Otherwise, an out-of-date SelectionRequest can end up attempting to read the invalid data, and cause a crash.
2026-09-08 13:17:01 -04:00
Frank Praznik
84cd92d705 wayland: Avoid dereferencing a nil data offer
Pass the data device to the selection offer update functions instead of pulling it from the offer, as the offer may be nil.
2026-09-08 11:25:52 -04:00
Frank Praznik
25f4af8fcf x11: Handle XTranslateCoordinates failing during a reparenting operation
XTranslateCoordinates can generate a BadWindow error if called during a racy reparenting operation, so a non-fatal error handler is required.
2026-09-08 10:48:37 -04:00
Ethan Lee
6083940ef4 Add support for the Xbox 360 "Big Button" wireless receiver 2026-09-07 17:30:01 -04:00
muzikbike
42ad5c9955 Split System Request from Print Screen in XF86 as well 2026-09-06 09:43:02 -07:00
Frank Praznik
7e8a850246 x11: Register IM destruction/instantiation callbacks
Register callbacks to listen for IM destruction and instantiation to handle the IME shutting down and restarting during runtime.
2026-09-06 11:52:28 -04:00
Anonymous Maarten
c1ef7793c7 cmake: detect lld-link cli argument errors 2026-09-04 22:55:31 +02:00
Ryan C. Gordon
ea74d3b018 metal: Clear bogus pointer if we fail to get a new drawable.
Reference Issue #16232.
2026-09-04 15:55:40 -04:00
Sylvain
f034d594a8 Fix android build with SDK 37.2: Allow dots in platform directory names and use CMake version comparison 2026-09-04 20:00:49 +02:00
SDL Wiki Bot
d4410b9a7c Sync SDL3 wiki -> header
[ci skip]
2026-09-03 15:57:27 +00:00
muzikbike
dfcc6dee02 Change XF86 scancodes2 to match Linux
Should fix #16164
2026-09-03 07:19:33 -07:00
William Horvath
f443c429c6 d3d12: Read the fence in SubmitAndAcquireFence while submitLock is held
Once the lock is released, another thread can clean up the completed
command buffer, return it to the pool and resubmit it with a different
fence before we read d3d12CommandBuffer->inFlightFence, handing the
caller a fence it doesn't own (or NULL).
2026-09-02 13:03:04 -07:00