Commit Graph
100 Commits
Author SHA1 Message Date
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
Sam Lantinga a864dcac25 Added support for using the GPU renderer as an offscreen renderer
SDL_CreateGPURenderer() now allows passing in an existing GPU device and passing in a NULL window to create an offscreen renderer.

Also renamed SDL_SetRenderGPUState() to SDL_SetGPURenderState().
2025-10-01 23:32:18 -07:00
Sam Lantinga 8d7cd3c6c2 Fixed line endings 2025-10-01 14:01:59 -07:00
Sam Lantinga 33c849d030 Always enable object validation when checking is explicitly enabled 2025-10-01 13:53:19 -07:00
Sam Lantinga f66e4d0a43 Enable full object validation by default
Full object validation was always done before this hint and there are a number of shipping products that relied on this, so don't change it by default.
2025-10-01 12:46:33 -07:00
Sam Lantinga 9735c45db6 Added an advanced shader for the GPU renderer
This allows us to support YUV colorspaces and HDR in the GPU renderer.

Fixes https://github.com/libsdl-org/SDL/issues/11281
Fixes https://github.com/libsdl-org/SDL/issues/11282
2025-10-01 07:17:55 -07:00
Sam Lantinga fe3b399b7e Added support for P010 pixel format in SDL_UpdateNVTexture() 2025-10-01 07:17:55 -07:00
Sam Lantinga 548063e578 Fixed pixel shader for palettized textures using pixelart scaling 2025-10-01 07:17:55 -07:00
Sam Lantinga 224b4917a3 testpalette: added a --renderer command line option 2025-10-01 07:17:55 -07:00
Sam Lantinga 8a5f9a3837 Removed validate_feature_indirect_draw_first_instance_disabled (thanks @rabbit-ecl!)
It was incorrectly checking the direct draw functions instead of checking indirect draw buffers.
2025-09-30 11:36:29 -07:00
Sam Lantinga baed512453 Fixed building tests on visionOS 2025-09-29 13:28:00 -07:00
Sam Lantinga 15f1cb4c98 Added GPU API support on visionOS
You must set SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN to false on this platform, since setDepthClipMode is not supported on Apple headsets (as of visionOS 2.3) and clipping is the default.
2025-09-29 13:28:00 -07:00
Sam Lantinga 2809ce9389 Set enable_depth_clip to true by default if SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN is false 2025-09-29 13:28:00 -07:00
Sam Lantinga f61e271e11 Generalize and validate optional GPU feature properties
Fixes https://github.com/libsdl-org/SDL/issues/13139
Fixes https://github.com/libsdl-org/SDL/issues/13138
2025-09-29 12:42:47 -07:00
Sam Lantinga 37410908c7 Fixed building on visionOS 2025-09-29 12:17:48 -07:00
Sam Lantinga 595f7b7ed9 Revert "Fixed Vulkan validation error"
This reverts commit b82b1f416f.

The renderer should not be enabling depth clamping.
2025-09-29 06:08:27 -07:00
Sam Lantinga b65590159b Each application palette corresponds to one hardware palette
When the application modifies the palette, any textures that use it will automatically be updated.
2025-09-28 22:10:06 -07:00
Sam Lantinga 5d311635cf Added Vulkan support for palettized textures 2025-09-28 22:10:06 -07:00
Sam Lantinga e2fe23ddab Added hardware accelerated support for palettized textures
Supported backends: direct3d, direct3d11, direct3d12, gpu, metal, opengl, opengles2
2025-09-28 22:10:06 -07:00
Sam Lantinga b82b1f416f Fixed Vulkan validation error
VUID-VkPipelineRasterizationStateCreateInfo-depthClampEnable-00782(ERROR / SPEC): msgNum: -316906200 - Validation Error: [ VUID-VkPipelineRasterizationStateCreateInfo-depthClampEnable-00782 ] | MessageID = 0xed1c6528 | vkCreateGraphicsPipelines(): pCreateInfos[0].pRasterizationState->depthClampEnable is VK_TRUE, but the depthClamp feature was not enabled. The Vulkan spec states: If the depthClamp feature is not enabled, depthClampEnable must be VK_FALSE (https://vulkan.lunarg.com/doc/view/1.3.268.0/windows/1.3-extensions/vkspec.html#VUID-VkPipelineRasterizationStateCreateInfo-depthClampEnable-00782)
2025-09-28 22:10:06 -07:00
Sam Lantinga 524ba0a4ad Reduce the size of the D3D12 vertex shader constants
This is needed to add more fragment shader constants in the future as we're already at our 64 size limit
2025-09-28 22:10:06 -07:00
Sam Lantinga 5622eef5a8 Fixed memory leak if requested renderer isn't available 2025-09-28 22:10:06 -07:00
Sam Lantinga 2a01e12d34 Simplify palette code
Each texture gets its own palette, the palette is updated when it is rendered if necessary, rendering is flushed if a texture render is already queued up.

Trying to share palettes and handle the different cases of queued rendering and changing palettes in the middle of the frame ends up being very complicated, so we'll keep it simple for now.
2025-09-28 22:10:06 -07:00
Sam Lantinga 7dcc09986d Test changing the palette for a single texture 2025-09-28 22:10:06 -07:00
Sam Lantinga 264b436dba Fixed changing palettes while rendering is in flight 2025-09-28 22:10:06 -07:00
Sam Lantinga 0b4b254a53 Added support for textures with palettes
Closes https://github.com/libsdl-org/SDL/pull/6192
2025-09-28 22:10:06 -07:00
Sam Lantinga da84d78796 Fixed unknown frees being reported when SDL is built without allocation counts 2025-09-27 23:47:09 -07:00
Sam Lantinga 1d2a482dde testgpurender_effects: use the grayscale algorithm from BT.709 2025-09-26 10:27:10 -07:00
Sam Lantinga 1f73c19a73 Added stub SDL_TimeToDateTime() for N-Gage
Fixes https://github.com/libsdl-org/SDL/issues/14047
2025-09-26 09:37:04 -07:00
Sam Lantinga c39d772a07 Added a workaround for fullscreen mouse position on macOS 26 2025-09-25 15:10:08 -07:00
Sam Lantinga b2188b325d 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
2025-09-25 10:36:14 -07:00
Sam Lantinga 33a74c7548 Fixed typo 2025-09-25 07:31:07 -07:00
Sam Lantinga 0a50058f7a 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
2025-09-23 22:57:21 -07:00
Sam Lantinga fe8c080713 testime: allow enabling/disabling text input on individual windows 2025-09-23 09:59:11 -07:00
Sam Lantinga 221d1f12ea 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
2025-09-22 19:14:38 -07:00
Sam Lantinga 6f3ef22d19 Fixed build warning 2025-09-22 11:27:23 -07:00
Sam Lantinga cece47c64d Fixed iOS build 2025-09-22 11:27:07 -07:00
Sam Lantinga 137b0b2bee The default swap interval on EGL is 1, according to the spec
Fixes https://github.com/libsdl-org/SDL/issues/14014
2025-09-22 10:23:08 -07:00
Sam Lantinga 8a67a8a319 testautomation: fixed video tests on iOS 2025-09-22 10:09:30 -07:00
Sam Lantinga 5d9b9673b9 testautomation: use SDL functions for iostream test setup
This fixes the IOStream tests on iOS, since the current directory isn't writable
2025-09-22 10:09:30 -07:00
Sam Lantinga 9f9952d53a Fixed filesystem operations on iOS
Full paths are used as-is, relative paths are prepended with a writable path, SDL_GetPrefPath("", ""), since the current directory isn't writable.
2025-09-22 10:09:30 -07:00
Sam Lantinga 7563a3e17d Fixed clipboard tests on iOS 2025-09-22 10:09:30 -07:00
Sam Lantinga a662d13f73 Fixed building testautomation on iOS 2025-09-22 10:09:30 -07:00
Sam Lantinga 86203d8312 Document that the joystick and gamepad functions are thread-safe 2025-09-22 08:32:39 -07:00
Sam Lantinga 34b09be6a5 Use clearPrimaryClip() on Android 9 and newer
Fixes https://github.com/libsdl-org/SDL/issues/8355
2025-09-21 23:30:20 -07:00
Sam Lantinga c8f32b67ae testautomation: use the correct return type for clipboard APIs 2025-09-21 23:27:59 -07:00
Sam Lantinga a5b070ba2d Skip render_testLogicalSize() if we didn't get a window of the expected size
We rely on that to validate the results of SDL_GetRenderLogicalPresentationRect()
2025-09-21 20:25:10 -07:00
Sam Lantinga 26dd4e3abb Fixed filesystem operations on Android
Full paths are used as-is, relative paths are prepended with SDL_GetAndroidInternalStoragePath(), and operations fall back to the asset system as appropriate.

This is consistent with the behavior of opening files on Android.
2025-09-21 18:23:34 -07:00
Sam Lantinga 005f10bd97 testautomation: fix video tests on Android
Like emscripten, window positioning and sizing is not supported on Android.
2025-09-21 16:25:51 -07:00
Sam Lantinga bae34c3e34 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.
2025-09-21 13:46:11 -07:00
Sam Lantinga bce2a336d2 Use the default window focus behavior on macOS
We had to work around odd behavior in really old versions of macOS, but the current behavior is great.

Fixes https://github.com/libsdl-org/SDL/issues/3954
2025-09-20 18:57:22 -07:00
Sam Lantinga 400489c157 testcontroller: fixed memory leak 2025-09-20 18:21:26 -07:00
Sam Lantinga 6a9ac1cacd Always poll udev on supported platforms
Fixes https://github.com/libsdl-org/SDL/issues/13995
2025-09-20 11:13:39 -07:00
Sam Lantinga 8eeae5f686 The wayland messagebox should only be used under wayland 2025-09-20 09:06:07 -07:00
Sam Lantinga 5503fe1c1b Fixed a memory leak in fill_device_info_usage() (thanks @digant73)
Fixes https://github.com/libsdl-org/SDL/issues/13998
2025-09-20 09:05:37 -07:00
Sam Lantinga 597ef58966 Use zenity messageboxes by default on X11
This makes messageboxes consistent between X11 and Wayland.
2025-09-20 08:37:51 -07:00
Sam Lantinga 9e0549d8ff Use posix_spawn_file_actions_addchdir_np() on macOS
posix_spawn_file_actions_addchdir() was introduced in macOS 26, but we want to be able to run on systems all the way back to macOS 15
2025-09-19 08:00:03 -07:00
Sam Lantinga f8a1ea021b Fixed crashes when SDL_DISABLE_INVALID_PARAMS is enabled (thanks @AntTheAlchemist!) 2025-09-19 07:43:01 -07:00
Sam Lantinga 0eff3fe558 Fixed double-free when using window surfaces 2025-09-18 20:58:32 -07:00
Sam Lantinga c25a0b046a Make SDL_ObjectValid() inline for performance (thanks @mechakotik!) 2025-09-18 20:58:32 -07:00
Sam Lantinga 25b2d2c821 Use new parameter validation macro 2025-09-18 20:58:32 -07:00
Sam Lantinga ee1c90a358 Improved handling of function parameter validation
SDL supports the following use cases:
 * Normal operation with fast parameter checks (default):
    SDL_SetHint(SDL_HINT_INVALID_PARAM_CHECKS, "1");
 * Object parameters are checked for use-after-free issues:
    SDL_SetHint(SDL_HINT_INVALID_PARAM_CHECKS, "2");
 * Enable full validation, plus assert on invalid parameters:
    #define SDL_ASSERT_INVALID_PARAMS
 * Disable all parameter validation:
    #define SDL_DISABLE_INVALID_PARAMS
2025-09-18 20:58:32 -07:00
Sam Lantinga 49e15904ae Document that SDL_SCALEMODE_PIXELART is available in 3.4.0
Fixes https://github.com/libsdl-org/sdlwiki/issues/856
2025-09-18 20:22:15 -07:00
Sam Lantinga aca9bd02bf Make sure DEBUG is defined for debug configurations 2025-09-16 09:12:33 -07:00
Sam Lantinga dac6af4ba6 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
2025-09-14 17:24:40 -07:00
Sam Lantinga cc3274b6f1 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
2025-09-14 15:45:03 -07:00
Sam Lantinga 30e2fdc5a2 Sort the blacklist entry for the HP Deluxe Webcam KQ246AA 2025-09-14 15:38:47 -07:00
Sam Lantinga 937b7e6aea 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.
2025-09-14 15:09:07 -07:00
Sam Lantinga f8bace9b9b Remove the behavior of warping the mouse on fullscreen transitions
This made sense when switching between a window and an exclusive fullscreen video mode of the same dimensions, but it causes user confusion when the window changes size, and doesn't work well with Wayland. I've gotten this feedback from several sources, so we'll just go ahead and remove this behavior for now.

Fixes https://github.com/libsdl-org/SDL/issues/11577
2025-09-14 13:18:30 -07:00
Sam Lantinga a1d3fc1f50 Clarify why we ignore EINVAL when flushing a file descriptor 2025-09-14 12:11:05 -07:00
Sam Lantinga e40d337a47 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
2025-09-14 12:09:16 -07:00
Sam Lantinga 0f2cb0a3f8 Fixed to match window event order 2025-09-14 11:38:09 -07:00
Sam Lantinga 402fa9434d Updated documentation to reflect that SDL_GetHint() is thread-safe
This was fixed at some point, so this updates the documentation to match.

Fixes https://github.com/libsdl-org/SDL/issues/13932
2025-09-14 11:28:45 -07:00
Sam Lantinga 29e6e07396 Note it is safe to do drawing in response to SDL_EVENT_WINDOW_EXPOSED 2025-09-14 10:19:14 -07:00
Sam Lantinga 1aba421bd3 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
2025-09-14 09:59:01 -07:00
Sam Lantinga f2bdf2a8cc Removed unnecessary Windows version check 2025-09-14 09:01:42 -07:00
Sam Lantinga 78a29d1670 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
2025-09-14 08:47:52 -07:00
Sam Lantinga ede86a1267 Fixed memory leak when using detached threads
Fixes https://github.com/libsdl-org/SDL/issues/13886
2025-09-14 08:42:25 -07:00
Sam Lantinga 113c7e8a58 Fixed delayed text entry for OTP codes on iOS (thanks @pipiwoaini!)
Fixes https://github.com/libsdl-org/SDL/issues/13717
2025-09-14 08:08:13 -07:00
Sam Lantinga c78e279d3c Removed unneeded preprocessor guards 2025-09-13 07:22:30 -07:00
Sam Lantinga 3c627390bb Updated deployment target to VisionOS 1.3 2025-09-12 10:28:44 -07:00
Sam Lantinga e7784b7bf7 Set GPU properties for maximum hardware compatibility
Resolves https://github.com/libsdl-org/SDL/issues/13928
2025-09-11 21:30:58 -07:00
Sam Lantinga 00812d13b0 The names of keyboards and mice are valid after they've been removed
Fixes https://github.com/libsdl-org/SDL/issues/12816
2025-09-11 20:07:55 -07:00
Sam Lantinga 3ddc3f1146 Send events for mice and keyboards detected during initialization
Fixes https://github.com/libsdl-org/SDL/issues/12815
2025-09-11 20:07:55 -07:00
Sam Lantinga 712ce16469 Fixed emulated touch on Android
This also fixes laser pointer input on Meta Quest headsets
2025-09-10 14:44:26 -07:00
Sam Lantinga 035eed351c Added SDL_GetPixelFormatFromGPUTextureFormat() and SDL_GetGPUTextureFormatFromPixelFormat()
Fixes https://github.com/libsdl-org/SDL/issues/13899
2025-09-10 12:08:04 -07:00
Sam Lantinga b7dba970e1 Fixed setting SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER 2025-09-09 17:34:34 -07:00
Sam Lantinga a4b180f515 Added SDL_PROP_TEXTURE_GPU_TEXTURE_POINTER 2025-09-09 17:34:34 -07:00
Sam Lantinga 0f8d062e10 Fixed warning: conversion to 'uint32_t' from 'float' may alter its value 2025-09-08 19:25:41 -07:00
Sam Lantinga df0cc6e98b Make sure we always zero the buffer sent to Steam Controllers
This fixes bad initialization for Steam Controllers with the original firmware
2025-09-08 18:41:17 -07:00