Commit Graph

12353 Commits

Author SHA1 Message Date
Ryan C. Gordon
ef1d4ed1bf windows: Allow OpenGL ES creation without EGL, if the WGL supports it.
Note that this should work with GLES1, don't let the "es2" in
WGL_EXT_create_context_es2_profile fool you.

Fixes #13056.
2025-10-09 13:07:57 -04:00
Edu Garcia
c74b406a4c 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.
2025-10-09 08:45:18 -07:00
Sylvain
2a96997e90 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
2025-10-09 08:40:42 -07:00
eafton
2c0094ead6 X11TK: Flip the positioning of the UI if the locale is RTL (#14183) 2025-10-09 07:48:10 -07:00
Ryan C. Gordon
09bd8e8a5a camera: Fix Emscripten builds when using -sASYNCIFY.
Thanks to user pancakeswya on GitHub for the patch!

Fixes #13934.
2025-10-09 09:54:48 -04: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
Roman Fomin
c86cfb0156 Disable D3D feature levels below 11.0 for the D3D11 renderer 2025-10-08 21:10:08 -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
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
Ryan C. Gordon
808a3f573f egl: Better attempt at retrying surface creation w/o EGL_EXT_present_opaque.
Fixes #13094.
2025-10-08 21:42:56 -04: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
Dima Volynets
e4f24ff7ae MacOS: Added hint to control update of the metal layer's drawable size (#14053) 2025-10-08 10:52:01 -07:00
eafton
98eaa05a9f Fix for #13094 2025-10-08 10:45:04 -07:00
krizej
8bba24757d x11: request available clipboard mime-types on video init 2025-10-08 10:30:04 -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
ROllerozxa
f43577bbb5 Fix compiling Metal renderer with SDL_LEAN_AND_MEAN 2025-10-07 16:20:59 -07:00
Frank Praznik
ce4af658ba events: Periodically poll tray events on *nix platforms
Tray events on *nix platforms usually run over DBus, and the events subsequently aren't delivered via the window event queue. As a result, SDL_WaitEvent() won't unblock when tray events arrive, particularly if there is no currently active window.

Wake up periodically to poll when tray items are active to avoid blocking the delivery and processing of tray events.
2025-10-07 12:32:12 -04: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
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
nmlgc
8df057fafc iostream: Properly support the "x" mode for SDL_IOFromFile()
The "x" mode for `fopen()` (open file only if it doesn't exist) used to
be a glibc-exclusive extension, but was later standardized in C11, and
is now also implemented as part of every other widely-used libc:

	* musl: https://git.musl-libc.org/cgit/musl/tree/src/stdio/__fmodeflags.c?id=0ccaf0572e9cccda2cced0f7ee659af4c1c6679a
	* Android Bionic / OpenBSD: 731631f300/libc/upstream-openbsd/lib/libc/stdio/flags.c (86)
	* Apple / FreeBSD: 63976b830a/stdio/FreeBSD/flags.c (L91-L92)

As a result, "x" has already been working on all our automatically
tested platforms that implement `SDL_IOFromFile()` via `fopen()`. So
all we'd be missing for proper support is a Windows implementation
using `CREATE_NEW`, and the documentation that this mode exists and is
intended to work.
2025-10-06 13:23:42 -07:00
Sam Lantinga
87e3250518 Add a note that OpenVR overlays assume unpremultiplied alpha by default 2025-10-06 11:58:21 -07:00
Frank Praznik
ce1175724a win32: Don't overwrite a programmatically set window size with old data
While in a modal loop, the size in WM_WINDOWPOSCHANGING/WM_WINDOWPOSCHANGED may only be updated if the window is being resized interactively. Set the SWP_NOSIZE flag if the size hasn't changed from the last move/size event, or a size set programmatically may end up being overwritten by old size data.
2025-10-06 14:44:41 -04:00
Sam Lantinga
b92557c0b7 Made error message consistent between SDL_SetSurfacePalette() and SDL_SetTexturePalette() 2025-10-06 09:22:34 -07:00
Cameron Cawley
ab06784318 Check the availability of GL_BGRA before use 2025-10-06 08:58:45 -07:00
Cameron Cawley
12cee1cf46 Use the correct pixel formats for OpenGL on big endian 2025-10-06 08:58:45 -07:00
Sam Lantinga
941b0a8ea4 Added support for external GPU textures to the GPU renderer 2025-10-06 07:31:00 -07:00
definability
4d9295ef1e Fixed building with SDL_LEAN_AND_MEAN
Fixes https://github.com/libsdl-org/SDL/issues/14151
2025-10-05 17:36:11 -07:00
Adrian
6d47d8dff1 Always convert window to Vulkan window on SDL_Vulkan_CreateSurface (#14143) 2025-10-05 09:59:24 -07:00
Ozkan Sezer
3723913969 SDL_zenitymessagebox.c: Add exit code checking.
Fixes https://github.com/libsdl-org/SDL/issues/14140
Closes https://github.com/libsdl-org/SDL/pull/14146

Co-authored-by: eafton <blox2000@protonmail.com>
2025-10-05 12:28:39 +03:00
Ozkan Sezer
6c3cc3587d zenity dialog: make sure that --modal --attach switches are supported.
Reference issue: https://github.com/libsdl-org/SDL/issues/14140
2025-10-05 12:21:14 +03:00
eafton
87f9a0e106 X11TK: Add more checks to the Xrandr code path to avoid errors 2025-10-05 03:10:25 +03:00
HTuanPhong
2638537f92 Fix vulkan gpu resize lag on windows 2025-10-04 15:22:28 -07:00
Sam Lantinga
134b47730b Added support for linear and pixel art scaling for palettized textures 2025-10-04 15:12:08 -07:00
Anonymous Maarten
e1fde46a6a Include SDL_internal.h before checking HAVE_FRIBIDI_H
This happened to work because of precompiled headers
2025-10-04 21:25:45 +02:00