From 2a8eec93e7fa9fb591ab1caf15607c4ce1d0e817 Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Mon, 6 Jan 2025 23:49:20 +0200 Subject: [PATCH] Update SDL3 --- Source/ThirdParty/SDL/SDL3/SDL_filesystem.h | 18 +++++++++++++- Source/ThirdParty/SDL/SDL3/SDL_hints.h | 15 +++++++++++- Source/ThirdParty/SDL/SDL3/SDL_iostream.h | 2 +- Source/ThirdParty/SDL/SDL3/SDL_keyboard.h | 2 ++ Source/ThirdParty/SDL/SDL3/SDL_metal.h | 4 ++++ Source/ThirdParty/SDL/SDL3/SDL_render.h | 10 +++++++- Source/ThirdParty/SDL/SDL3/SDL_revision.h | 4 ++-- Source/ThirdParty/SDL/SDL3/SDL_stdinc.h | 24 +++++++++++++++---- Source/ThirdParty/SDL/SDL3/SDL_system.h | 8 ++++++- Source/ThirdParty/SDL/SDL3/SDL_tray.h | 6 ++--- .../Tools/Flax.Build/Deps/Dependencies/SDL.cs | 4 ++-- 11 files changed, 80 insertions(+), 17 deletions(-) diff --git a/Source/ThirdParty/SDL/SDL3/SDL_filesystem.h b/Source/ThirdParty/SDL/SDL3/SDL_filesystem.h index 8bc2356e9..1624113a9 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_filesystem.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_filesystem.h @@ -22,7 +22,23 @@ /** * # CategoryFilesystem * - * SDL Filesystem API. + * SDL offers an API for examining and manipulating the system's filesystem. + * This covers most things one would need to do with directories, except for + * actual file I/O (which is covered by [CategoryIOStream](CategoryIOStream) + * and [CategoryAsyncIO](CategoryAsyncIO) instead). + * + * There are functions to answer necessary path questions: + * + * - Where is my app's data? SDL_GetBasePath(). + * - Where can I safely write files? SDL_GetPrefPath(). + * - Where are paths like Downloads, Desktop, Music? SDL_GetUserFolder(). + * - What is this thing at this location? SDL_GetPathInfo(). + * - What items live in this folder? SDL_EnumerateDirectory(). + * - What items live in this folder by wildcard? SDL_GlobDirectory(). + * - What is my current working directory? SDL_GetCurrentDirectory(). + * + * SDL also offers functions to manipulate the directory tree: renaming, + * removing, copying files. */ #ifndef SDL_filesystem_h_ diff --git a/Source/ThirdParty/SDL/SDL3/SDL_hints.h b/Source/ThirdParty/SDL/SDL3/SDL_hints.h index 8f8db4615..263e0a1a2 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_hints.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_hints.h @@ -2635,12 +2635,25 @@ extern "C" { * Specify the OpenGL library to load. * * This hint should be set before creating an OpenGL window or creating an - * OpenGL context. + * OpenGL context. If this hint isn't set, SDL will choose a reasonable + * default. * * \since This hint is available since SDL 3.1.3. */ #define SDL_HINT_OPENGL_LIBRARY "SDL_OPENGL_LIBRARY" +/** + * Specify the EGL library to load. + * + * This hint should be set before creating an OpenGL window or creating an + * OpenGL context. This hint is only considered if SDL is using EGL to manage + * OpenGL contexts. If this hint isn't set, SDL will choose a reasonable + * default. + * + * \since This hint is available since SDL 3.2.0. + */ +#define SDL_HINT_EGL_LIBRARY "SDL_EGL_LIBRARY" + /** * A variable controlling what driver to use for OpenGL ES contexts. * diff --git a/Source/ThirdParty/SDL/SDL3/SDL_iostream.h b/Source/ThirdParty/SDL/SDL3/SDL_iostream.h index b3210e3e8..e0456c7c2 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_iostream.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_iostream.h @@ -25,7 +25,7 @@ * # CategoryIOStream * * SDL provides an abstract interface for reading and writing data streams. It - * offers implementations for files, memory, etc, and the app can provideo + * offers implementations for files, memory, etc, and the app can provide * their own implementations, too. * * SDL_IOStream is not related to the standard C++ iostream class, other than diff --git a/Source/ThirdParty/SDL/SDL3/SDL_keyboard.h b/Source/ThirdParty/SDL/SDL3/SDL_keyboard.h index 0b84a7124..6d3db29d3 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_keyboard.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_keyboard.h @@ -318,6 +318,8 @@ extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *nam * * If the key doesn't have a name, this function returns an empty string (""). * + * Letters will be presented in their uppercase form, if applicable. + * * \param key the desired SDL_Keycode to query. * \returns a UTF-8 encoded string of the key name. * diff --git a/Source/ThirdParty/SDL/SDL3/SDL_metal.h b/Source/ThirdParty/SDL/SDL3/SDL_metal.h index 2d2376839..87d18dbfd 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_metal.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_metal.h @@ -23,6 +23,10 @@ * # CategoryMetal * * Functions to creating Metal layers and views on SDL windows. + * + * This provides some platform-specific glue for Apple platforms. Most macOS + * and iOS apps can use SDL without these functions, but this API they can be + * useful for specific OS-level integration tasks. */ #ifndef SDL_metal_h_ diff --git a/Source/ThirdParty/SDL/SDL3/SDL_render.h b/Source/ThirdParty/SDL/SDL3/SDL_render.h index f356b480a..c69153634 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_render.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_render.h @@ -1498,10 +1498,18 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderCoordinatesToWindow(SDL_Renderer *ren * - The scale (SDL_SetRenderScale) * - The viewport (SDL_SetRenderViewport) * + * Various event types are converted with this function: mouse, touch, pen, + * etc. + * * Touch coordinates are converted from normalized coordinates in the window * to non-normalized rendering coordinates. * - * Once converted, the coordinates may be outside the rendering area. + * Relative mouse coordinates (xrel and yrel event fields) are _also_ + * converted. Applications that do not want these fields converted should use + * SDL_RenderCoordinatesFromWindow() on the specific event fields instead of + * converting the entire event structure. + * + * Once converted, coordinates may be outside the rendering area. * * \param renderer the rendering context. * \param event the event to modify. diff --git a/Source/ThirdParty/SDL/SDL3/SDL_revision.h b/Source/ThirdParty/SDL/SDL3/SDL_revision.h index 1b6c9ce82..45170fc93 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_revision.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_revision.h @@ -31,9 +31,9 @@ /* #undef SDL_VENDOR_INFO */ #ifdef SDL_VENDOR_INFO -#define SDL_REVISION "SDL3-3.1.7-preview-3.1.6-602-g0a5d2f3da2 (" SDL_VENDOR_INFO ")" +#define SDL_REVISION "SDL3-3.1.7-preview-3.1.6-637-g8ec576ddab (" SDL_VENDOR_INFO ")" #else -#define SDL_REVISION "SDL3-3.1.7-preview-3.1.6-602-g0a5d2f3da2" +#define SDL_REVISION "SDL3-3.1.7-preview-3.1.6-637-g8ec576ddab" #endif #endif /* SDL_revision_h_ */ diff --git a/Source/ThirdParty/SDL/SDL3/SDL_stdinc.h b/Source/ThirdParty/SDL/SDL3/SDL_stdinc.h index 72b636174..cd172c425 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_stdinc.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_stdinc.h @@ -22,11 +22,25 @@ /** * # CategoryStdinc * - * This is a general header that includes C language support. It implements a - * subset of the C runtime APIs, but with an `SDL_` prefix. For most common - * use cases, these should behave the same way as their C runtime equivalents, - * but they may differ in how or whether they handle certain edge cases. When - * in doubt, consult the documentation for details. + * SDL provides its own implementation of some of the most important C runtime + * functions. + * + * Using these functions allows an app to have access to common C + * functionality without depending on a specific C runtime (or a C runtime at + * all). More importantly, the SDL implementations work identically across + * platforms, so apps can avoid surprises like snprintf() behaving differently + * between Windows and Linux builds, or itoa() only existing on some + * platforms. + * + * For many of the most common functions, like SDL_memcpy, SDL might just call + * through to the usual C runtime behind the scenes, if it makes sense to do + * so (if it's faster and always available/reliable on a given platform), + * reducing library size and offering the most optimized option. + * + * SDL also offers other C-runtime-adjacent functionality in this header that + * either isn't, strictly speaking, part of any C runtime standards, like + * SDL_crc32() and SDL_reinterpret_cast, etc. It also offers a few better + * options, like SDL_strlcpy(), which functions as a safer form of strcpy(). */ #ifndef SDL_stdinc_h_ diff --git a/Source/ThirdParty/SDL/SDL3/SDL_system.h b/Source/ThirdParty/SDL/SDL3/SDL_system.h index 54fe3d6b2..b59c42016 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_system.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_system.h @@ -22,7 +22,13 @@ /** * # CategorySystem * - * Platform-specific SDL API functions. + * Platform-specific SDL API functions. These are functions that deal with + * needs of specific operating systems, that didn't make sense to offer as + * platform-independent, generic APIs. + * + * Most apps can make do without these functions, but they can be useful for + * integrating with other parts of a specific system, adding platform-specific + * polish to an app, or solving problems that only affect one target. */ #ifndef SDL_system_h_ diff --git a/Source/ThirdParty/SDL/SDL3/SDL_tray.h b/Source/ThirdParty/SDL/SDL3/SDL_tray.h index 01d6bf30f..77f3d0836 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_tray.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_tray.h @@ -228,9 +228,9 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTraySubmenu(SDL_TrayEntry *entr * \param menu The menu to get entries from. * \param size An optional pointer to obtain the number of entries in the * menu. - * \returns the entries within the given menu. The pointer becomes invalid - * when any function that inserts or deletes entries in the menu is - * called. + * \returns a NULL-terminated list of entries within the given menu. The + * pointer becomes invalid when any function that inserts or deletes + * entries in the menu is called. * * \since This function is available since SDL 3.2.0. * diff --git a/Source/Tools/Flax.Build/Deps/Dependencies/SDL.cs b/Source/Tools/Flax.Build/Deps/Dependencies/SDL.cs index 3573acab5..e6a39cbac 100644 --- a/Source/Tools/Flax.Build/Deps/Dependencies/SDL.cs +++ b/Source/Tools/Flax.Build/Deps/Dependencies/SDL.cs @@ -88,8 +88,8 @@ namespace Flax.Deps.Dependencies Path.Combine(root, "include", "SDL3"), }; - CloneGitRepoFastSince(root, "https://github.com/libsdl-org/SDL", new DateTime(2025, 01, 03)); - GitResetToCommit(root, "0a5d2f3da216130f0c701317dd390431fbc557a0"); + CloneGitRepoFastSince(root, "https://github.com/libsdl-org/SDL", new DateTime(2025, 01, 06)); + GitResetToCommit(root, "8ec576ddabdc7edfd68e7a8a3214e84e4026328d"); foreach (var platform in options.Platforms) {