Commit Graph
100 Commits
Author SHA1 Message Date
Sam Lantinga b31c4b70b3 Updated version and documentation for 3.3.2 preview release 2025-10-23 15:20:26 -07:00
Sam Lantinga 1fa6475c90 Added support for saving indexed PNG images
Fixes https://github.com/libsdl-org/SDL/issues/14303
2025-10-23 12:40:41 -07:00
Sam Lantinga 6d095575e8 Clarify thread-safety information for surface functions 2025-10-23 07:52:48 -07:00
Sam Lantinga e18d63a4e2 Added SDL_RotateSurface()
Fixes https://github.com/libsdl-org/SDL/issues/14269
2025-10-22 17:55:02 -07:00
Sam Lantinga a402af506c Removed SDL_FILE from source code 2025-10-22 10:52:18 -07:00
Sam Lantinga f79ede100b Removed __FILE__ from source code 2025-10-22 10:48:36 -07:00
Sam Lantinga 999f782ad3 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
2025-10-22 10:44:08 -07:00
Sam Lantinga e58648d592 Removed call to ID3D11DeviceContext1_DiscardView() (thanks @pipiwoaini!)
This is unnecessary and can cause issues after a resize or device removal.

Fixes https://github.com/libsdl-org/SDL/issues/14283
2025-10-21 13:01:30 -07:00
Sam Lantinga 9d32e0e881 Fixed data alignment for PNG cursors (thanks @Kontrabant!) 2025-10-21 10:50:09 -07:00
Sam Lantinga af6f517453 Use CreateIconFromResource() for all cursors (#14285)
This allows us to properly adjust the size for DPI scaling and both static and animated cursors have consistent behavior.

Fixes https://github.com/libsdl-org/SDL/issues/14281
2025-10-21 09:38:26 -07:00
Sam Lantinga 0e351efbbc testcustomcursor: set the hotspot to the middle of the cross 2025-10-20 09:48:03 -07:00
Sam Lantinga 2f810e0a5f Copy properties when converting a surface to a new format
This fixes retaining the cursor hotspot when converting cursor frames to SDL_PIXELFORMAT_ARGB8888
2025-10-19 23:51:19 -07:00
Sam Lantinga 23fcf53c53 Treat a single frame animated cursor as a normal color cursor 2025-10-19 23:03:54 -07:00
Sam Lantinga bd86e85249 Added fallback support for animated cursors 2025-10-19 22:53:10 -07:00
Sam Lantinga 0e87ba163f Fixed crash if the animated cursor had a NULL frame 0 2025-10-19 22:53:10 -07:00
Sam Lantinga cae27a0ec7 Set an error if a cursor image is too large 2025-10-19 18:25:05 -07:00
Sam Lantinga b16ad6f10f Allow any init flags to be passed to SDLTest_CommonCreateState() 2025-10-15 21:57:37 -07:00
Sam Lantinga 6109fa6794 The names of joysticks and gamepads are valid after they've been removed 2025-10-15 21:57:37 -07:00
Sam Lantinga f844f3e10b Only pass UIPress from game controllers and remotes if the're not open
Fixes https://github.com/libsdl-org/SDL/issues/14080
2025-10-14 12:43:22 -07:00
Sam Lantinga d819106c65 Try matching gamepad mappings with CRC first
Fixes https://github.com/libsdl-org/SDL/issues/13874
2025-10-14 10:30:03 -07:00
Sam Lantinga 98944ecd0c Added the 8BitDo Ultimate 2C Wireless Controller to the Xbox controller list
Fixes https://github.com/libsdl-org/SDL/issues/14127
2025-10-13 18:46:58 -07:00
Sam Lantinga 23b487ceda Added testyuv to the SDLTest Xcode project 2025-10-13 15:27:13 -07:00
Sam Lantinga 015cc6aa6c Fixed accidentally using INDEX8 textures for RGB24 surfaces 2025-10-13 15:27:13 -07:00
Sam Lantinga 7a49ce71a1 Handle partial OpenGL shader availability
The pixelart shaders are not supported on OpenGL 2.1 (GLSL 130 isn't available)

Fixes the OpenGL renderer on macOS
2025-10-13 15:27:13 -07:00
Sam Lantinga 57cd131b7a testpalette: use SDL_SCALEMODE_NEAREST for single pixel copies 2025-10-13 14:25:09 -07:00
Sam Lantinga a58ae3a94f Added WASAPI support for SDL_HINT_AUDIO_DEVICE_STREAM_ROLE
Also added SDL_HINT_AUDIO_DEVICE_RAW_STREAM

Fixes https://github.com/libsdl-org/SDL/issues/14091
2025-10-13 14:20:19 -07:00
Sam Lantinga 361f7e0873 Fixed power state reporting for the Nintendo Joy-Con Charging Grip 2025-10-13 10:34:22 -07:00
Sam Lantinga 6b5b0ca90a Fixed header include guards 2025-10-13 09:46:15 -07:00
Sam Lantinga 831ec4dc6c Added support for the ZENAIM ARCADE CONTROLLER 2025-10-13 08:56:10 -07:00
Sam Lantinga c7cc7ec9af Be more precise about the layout used when latin_letters is enabled 2025-10-12 21:54:35 -07:00
Sam Lantinga 6e63f255b9 Added a reference to SDL_HINT_KEYCODE_OPTIONS from SDL_Keycode documentation 2025-10-12 21:51:14 -07:00
Sam Lantinga d7ad47e2ca Added SDL_PROP_RENDERER_TEXTURE_WRAPPING_BOOLEAN
Fixes https://github.com/libsdl-org/SDL/issues/13908
2025-10-12 11:15:47 -07:00
Sam Lantinga 513de0f0ec Don't allow SDL_TEXTURE_ADDRESS_WRAP if it's not supported
Fixes https://github.com/libsdl-org/SDL/issues/13908
2025-10-12 10:46:48 -07:00
Sam Lantinga 1ed093ad8b Corrected texture colors on PS2 (thanks @Trinth!)
Fixes https://github.com/libsdl-org/SDL/issues/12395
2025-10-12 09:20:00 -07:00
Sam Lantinga bb7bf28433 Documented environment setup for PS2 development 2025-10-12 09:20:00 -07:00
Sam Lantinga 70eceec77b Replace stb_image_write with miniz for SDL_SavePNG()
Fixes https://github.com/libsdl-org/SDL/issues/14219
2025-10-11 20:32:19 -07:00
Sam Lantinga 480f069cec Copy the palette instead of referencing it when creating a texture
Fixes https://github.com/libsdl-org/SDL/issues/14213
2025-10-11 11:01:15 -07:00
Sam Lantinga 9d635fe641 Flush rendering if a texture palette is in use when destroyed 2025-10-10 17:42:27 -07:00
Sam Lantinga 3fcac8cc44 Added support for CF_DIBV5 and PNG clipboard formats on Windows 2025-10-10 17:42:27 -07:00
Sam Lantinga 9d3dd8f001 testclipboard: make the window resizable
This is handy to see multiple image formats on the clipboard
2025-10-10 17:42:27 -07:00
Sam Lantinga 6f8fbf5cea SDL_EVENT_CLIPBOARD_UPDATE isn't sent when the primary selection changes 2025-10-10 13:27:15 -07:00
Sam Lantinga 692c71a677 The dlopen note functionality is only used on UNIX platforms 2025-10-10 12:47:42 -07:00
Sam Lantinga ee622c570a Made SDL_dlopennote.h a public header 2025-10-10 12:47:42 -07:00
Sam Lantinga 1871b998cd Added SDL_EVENT_SCREEN_KEYBOARD_SHOWN and SDL_EVENT_SCREEN_KEYBOARD_HIDDEN
Fixes https://github.com/libsdl-org/SDL/issues/13049
2025-10-10 10:14:07 -07:00
Sam Lantinga 5441d33c0e testime: toggle text input with a mouse click 2025-10-10 10:14:07 -07:00
Sam Lantinga e1305ec2e2 Updated Xcode project for the switch to png test data 2025-10-10 10:14:07 -07:00
Sam Lantinga 17989940f2 Fixed SDL_BlitSurfaceTiledWithScale() with very small scale (thanks @bleeqer!) 2025-10-10 08:59:27 -07:00
Sam Lantinga 4a00aedd70 Updated .gitignore for png test data 2025-10-10 08:59:27 -07:00
Sam Lantinga 6677fad1c8 Added SDL_EVENT_DISPLAY_USABLE_BOUNDS_CHANGED
Fixes https://github.com/libsdl-org/SDL/issues/12785
2025-10-09 19:15:45 -07:00
Sam Lantinga d92079f2b7 testsprite: only use transparent alpha on transparent windows
Fixes https://github.com/libsdl-org/SDL/issues/14105
2025-10-09 14:32:08 -07:00
Sam Lantinga b5c9a83f65 Display error messages when evdev devices can't be opened
Fixes https://github.com/libsdl-org/SDL/issues/13141
2025-10-09 13:18:56 -07:00
Sam Lantinga 23e3cbec20 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
2025-10-09 12:20:19 -07:00
Sam Lantinga 9cf7cdf23a Only return current clipboard data under X11
Fixes https://github.com/libsdl-org/SDL/issues/10192
2025-10-09 12:20:19 -07:00
Sam Lantinga 3c0a6c32d4 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.
2025-10-09 12:20:19 -07:00
Sam Lantinga 0e7d5620c2 testclipboard: added support for UCS-2 and UCS-4 text
Chrome uses UCS-2 text for text/x-moz-url content
2025-10-09 12:20:19 -07:00
Sam Lantinga ec0e84fc0a testclipboard: support both BMP and PNG clipboard images 2025-10-09 12:20:19 -07:00
Sam Lantinga cf97ca1511 Fixed style 2025-10-09 12:20:19 -07:00
Sam Lantinga a6fc2c4b60 Use ndk r28 by default for 16KB page alignment 2025-10-08 21:34:19 -07:00
Sam Lantinga 5dc65f829f check_android_jni.py: make sure we're using python3 2025-10-08 21:32:30 -07:00
Sam Lantinga 9a6455a526 Disable GameInput for mouse and keyboard by default
We're going to wait for this to get more testing before enabling it by default.

Fixes https://github.com/libsdl-org/SDL/issues/13846
2025-10-08 21:22:22 -07:00
Sam Lantinga 2a92a3c9c5 Recreate the Vulkan GPU swap chain when resuming on Android
Fixes https://github.com/libsdl-org/SDL/issues/12957
2025-10-08 21:06:17 -07:00
Sam Lantinga 6f4993ddee Ignore invalid width/height in setOrientationBis() 2025-10-08 20:14:51 -07:00
Sam Lantinga 00ffddece8 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
2025-10-08 20:02:31 -07:00
Sam Lantinga a2a60f75c7 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
2025-10-08 19:50:48 -07:00
Sam Lantinga 84b0565096 Fixed potential memory leak 2025-10-08 19:44:03 -07:00
Sam Lantinga 3316dde0c2 Improved error information when renderer creation fails
On Android, if you create a window with SDL_WINDOW_OPENGL, you can't create a Vulkan surface. The error message has been improved to reflect this, and the error is propagated back up to the application.

Also added warn level logging if the renderer couldn't be created.
2025-10-08 19:36:19 -07:00
Sam Lantinga edf5f9ec5c Properly upgrade a window to Vulkan when creating a Vulkan renderer 2025-10-08 19:17:11 -07:00
Sam Lantinga d4b684311e Added the Wooting 60HE keyboard to the controller blacklist 2025-10-08 16:06:17 -07:00
Sam Lantinga caa33cb018 Removed InvalidateRect() when moving and resizing
This was added in 2016, presumably to help address the move/resize issues on Windows, which have been since been addressed by the live-resize functionality.

Fixes https://github.com/libsdl-org/SDL/issues/14079
2025-10-08 13:32:19 -07:00
Sam Lantinga 7914bdb7ea Only call WIN_RoUninitialize() if WIN_RoInitialize() succeeded
Fixes https://github.com/libsdl-org/SDL/issues/14178
2025-10-08 13:15:48 -07:00
Sam Lantinga 8830b466d0 Improve handling of surfaces with NULL pixels
Fixes https://github.com/libsdl-org/SDL/issues/14059
2025-10-08 12:40:29 -07:00
Sam Lantinga 244ae39b30 Optimized the 16-bit -> 32-bit SSE pixel conversion
Test code:
---
int main( int argc, char *argv[] )
{
    SDL_Surface *orig = SDL_LoadPNG("testyuv.png");
    SDL_Surface *surf16 = SDL_ConvertSurface(orig, SDL_PIXELFORMAT_RGB565);
    SDL_Surface *surf32 = SDL_ConvertSurface(surf16, SDL_PIXELFORMAT_ARGB8888);

    Uint64 then = SDL_GetTicks();
    for (int i = 0; i < 100000; ++i) {
        SDL_BlitSurface(surf16, NULL, surf32, NULL);
    }
    Uint64 now = SDL_GetTicks();
    SDL_Log("Blit took %d ms\n", (int)(now - then));
    return 0;
}
---

Results on my system:
BlitNtoN: Blit took 34522 ms
Blit_RGB565_32 (3 LUT): Blit took 9316 ms
Blit_RGB565_32 (1 LUT): Blit took 5268 ms
Blit_RGB565_32_SSE41: Blit took 1619 ms
2025-10-07 16:31:14 -07:00
Sam Lantinga 168de63a7a Switched back to a single LUT for 16-bit -> 32-bit pixel conversion
This beats the previous 3-LUT version and even beats SSE on my system.

Test code:
---
int main( int argc, char *argv[] )
{
    SDL_Surface *orig = SDL_LoadPNG("testyuv.png");
    SDL_Surface *surf16 = SDL_ConvertSurface(orig, SDL_PIXELFORMAT_RGB565);
    SDL_Surface *surf32 = SDL_ConvertSurface(surf16, SDL_PIXELFORMAT_ARGB8888);

    Uint64 then = SDL_GetTicks();
    for (int i = 0; i < 100000; ++i) {
        SDL_BlitSurface(surf16, NULL, surf32, NULL);
    }
    Uint64 now = SDL_GetTicks();
    SDL_Log("Blit took %d ms\n", (int)(now - then));
    return 0;
}
---

Results on my system:
BlitNtoN: Blit took 34522 ms
Blit_RGB565_32 (3 LUT): Blit took 9316 ms
Blit_RGB565_32 (1 LUT): Blit took 5268 ms
Blit_RGB565_32_SSE41: Blit took 6399 ms
2025-10-07 16:31:14 -07:00
Sam Lantinga dbd5dd8c75 Ensure 16-bit -> 32-bit conversion is consistent between blitters
The SSE, LUT, and other blitters should have the same results for 16-bit -> 32-bit conversion
2025-10-07 16:31:14 -07:00
Sam Lantinga e9c7cfb165 Revert "Use rounded results for expanding values to 8-bits"
This reverts commit ba5be7af74.

We actually want to use high bits and replicated low bits, to match SIMD value expansion
2025-10-06 23:14:38 -07:00
Sam Lantinga ba5be7af74 Use rounded results for expanding values to 8-bits 2025-10-06 21:28:42 -07:00
Sam Lantinga 1eb42b0dfd Added SSE accelerated RGB565 to 32-bit pixel conversions 2025-10-06 21:28:42 -07:00
Sam Lantinga e4c5b72fd7 video: Fix asserts calling SetWindowProgress{State,Value} when creating popup windows 2025-10-06 17:31:46 -07:00
Sam Lantinga 7877ed1802 Fixed permissions 2025-10-06 17:30:04 -07:00
Sam Lantinga 9f9be1425d Fixed permissions 2025-10-06 17:24:56 -07:00
Sam Lantinga 69791ccad0 Don't treat the Moonlander MK1 Keyboard as a controller
Fixes http://github.com/mgba-emu/mgba/issues/3606
2025-10-06 16:52:03 -07:00
Sam Lantinga bb0d6221c1 Use PNG files for tests and examples
These are much smaller than the previous BMP files

Fixes https://github.com/libsdl-org/SDL/issues/14159
2025-10-06 16:45:53 -07:00
Sam Lantinga 7454302cd0 Fixed 16-bit -> 32-bit blit lookup tables
The lookup tables weren't correct, e.g. 0xFFFF was being translated into 0xFFFFFFEF
2025-10-06 16:45:53 -07:00
Sam Lantinga 73334b6bb4 Added support for loading and saving PNG images using stb_image 2025-10-06 16:45:53 -07:00
Sam Lantinga 87e3250518 Add a note that OpenVR overlays assume unpremultiplied alpha by default 2025-10-06 11:58:21 -07:00
Sam Lantinga b92557c0b7 Made error message consistent between SDL_SetSurfacePalette() and SDL_SetTexturePalette() 2025-10-06 09:22:34 -07:00
Sam Lantinga 941b0a8ea4 Added support for external GPU textures to the GPU renderer 2025-10-06 07:31:00 -07:00
Sam Lantinga 134b47730b Added support for linear and pixel art scaling for palettized textures 2025-10-04 15:12:08 -07:00
Sam Lantinga d832ac5d6f SDL_RenderDebugText() is no longer blurry when scaled 2025-10-04 12:04:07 -07:00
Sam Lantinga f3815ede24 Rebuilt GPU renderer shaders 2025-10-03 19:35:45 -07:00
Sam Lantinga 49d51a0d3c Removed TEXTURETYPE_PALETTE_PIXELART
This doesn't make any sense since the pixel art algorithm uses a box filter to get an average pixel value which isn't possible with indexed textures.
2025-10-03 18:54:07 -07:00
Sam Lantinga ac2c834021 Fixed build 2025-10-03 16:04:45 -07:00
Sam Lantinga 1cda789a37 render: Default to primary display in SDL_CalculateSimulatedVSyncInterval if window is not set
- Fixes previous change to SDL_CreateRendererWithProperties which skipped SDL_CalculateSimulatedVSyncInterval if window was not set.
2025-10-03 16:00:44 -07:00
Sam Lantinga 0cab3521f1 render: Fix asserts from null window usage in SDL_CreateRendererWithProperties 2025-10-03 16:00:41 -07:00
Sam Lantinga 32668c4ddd Palettized textures will always use SDL_SCALEMODE_NEAREST.
Our algorithm for pixel art doesn't work on 8-bit images, needs further investigation.

Fixes https://github.com/libsdl-org/SDL/issues/14129
2025-10-03 14:29:47 -07:00
Sam Lantinga d333044462 Fixed destination coordinates when using scale with the software renderer
Fixes https://github.com/libsdl-org/SDL/issues/14051
2025-10-03 13:58:45 -07:00
Sam Lantinga b7b2e8bc31 Don't change the display of a window until it is mostly on the new one
Fixes https://github.com/libsdl-org/SDL/issues/12665
2025-10-03 12:38:47 -07:00
Sam Lantinga baae2a628d Store the current window display ID on the window 2025-10-03 12:38:47 -07:00
Sam Lantinga b1c2dd8433 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
2025-10-02 15:19:41 -07:00
Sam Lantinga 11a66bd18c Minor cleanup in calls to getContext() 2025-10-02 10:50:10 -07:00