Compare commits

..
Author SHA1 Message Date
Sam Lantinga a8589a8422 Updated to version 3.2.24 for release 2025-10-02 10:52:32 -07:00
Simon McVittie 0bdaaf6c76 build: Prefix SDL- to revision from REVISION.txt
This makes it possible to get the version number of an unknown SDL binary
from `strings libSDL3.so.0 | grep SDL-`, like we could for SDL 2.

Resolves: https://github.com/libsdl-org/SDL/issues/14114
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 618b7b6c73)
2025-10-02 09:09:03 -07:00
Simon McVittie 390197d3aa build: Prefix version from git with SDL- rather than SDL3-
We can tell it's SDL 3 from the version number and git revision,
so there's no need to duplicate that in the prefix.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit d5b79418f4)
2025-10-02 09:09:03 -07:00
Mathieu Eyraud 9fafba49dc Zero-initialize SDL_GPUDevice
(cherry picked from commit 86da08b0be)
2025-10-01 07:23:41 -07:00
Victor Ilyushchenko 5d47efe7fb Fix Metal 3D texture upload stride calculation
Signed-off-by: Victor Ilyushchenko <alt13ri@gmail.com>
(cherry picked from commit a34d31322c)
2025-09-28 07:32:48 -07:00
Sam Lantinga 824234accc 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

(cherry picked from commit b2188b325d)
2025-09-25 10:41:52 -07:00
Frank Praznik 6519158ae5 wayland: Ignore bogus libdecor content sizes if an unmapped window is suspended
If a client takes a long time to present the first frame after creating the window, a configure event to set the suspended state may arrive with libdecor increasing the content size by the decoration dimensions, which should be ignored.

(cherry picked from commit 9d5d7010de)
2025-09-24 10:36:04 -04:00
Frank Praznik 00718d60d2 x11: Use the pending size for the min/max limits if a resize is in flight
Otherwise, an outdated size may be used, reverting the requested resize operation.

(cherry picked from commit 45480f5fe5)
2025-09-24 10:36:04 -04:00
Sam Lantinga 18c2e179ee 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

(cherry picked from commit 0a50058f7a)
2025-09-23 23:04:41 -07:00
Sam Lantinga 21ae008fc2 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

(cherry picked from commit 221d1f12ea)
2025-09-22 19:16:01 -07:00
Sam Lantinga 97a8bb44e6 The default swap interval on EGL is 1, according to the spec
Fixes https://github.com/libsdl-org/SDL/issues/14014

(cherry picked from commit 137b0b2bee)
2025-09-22 11:28:46 -07:00
Ryan C. Gordon 5d33fce898 wav: Patched to compile on Visual Studio.
(cherry picked from commit 09ee8876b3)
2025-09-22 08:14:33 -07:00
Ryan C. Gordon bb5df96f69 wav: Clamp DATA chunk to size of file if possible.
Prevents a malicious file from malloc'ing multiple gigabytes.

Fixes #10052.

(cherry picked from commit 44e4deab7c)
2025-09-22 08:14:33 -07:00
Brenton Bostick 12b97944f3 fix: Extra parameter(s) for call to 'getCacheDir()'.
(cherry picked from commit 6590a5bc0b)
2025-09-22 07:25:19 -07:00
Brenton Bostick 0f17fbe1ca fix 'SDL_MessageBoxFlags' is not a valid JVM type.
(cherry picked from commit ed7d39b28c)
2025-09-22 07:05:05 -07:00
Sam Lantinga c3480ca99c Use clearPrimaryClip() on Android 9 and newer
Fixes https://github.com/libsdl-org/SDL/issues/8355

(cherry picked from commit 34b09be6a5)
2025-09-21 23:30:57 -07:00
Sam Lantinga 936d94c2ee 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.

(cherry picked from commit bae34c3e34)
2025-09-21 13:58:51 -07:00
Sam Lantinga 6cb55ebd46 Fixed a memory leak in fill_device_info_usage() (thanks @digant73)
Fixes https://github.com/libsdl-org/SDL/issues/13998

(cherry picked from commit 5503fe1c1b)
2025-09-20 09:05:52 -07:00
Andrei Sabalenka 482c5130eb wayland: fix typo in xdg_positioner_set_anchor_rect
(cherry picked from commit bb2b39b8ea)
2025-09-20 08:54:18 -07:00
Anonymous Maarten 066bcc5204 ci: disable ccache on macOS 13 job
(cherry picked from commit 566e7c2379)
2025-09-17 22:06:16 +02:00
ManifoldFR 21baa27bea gpu/vulkan : fix clear value indexing
(cherry picked from commit 8bc4e029bd)
2025-09-16 08:45:56 -07:00
Sora 93fd4a1c80 fix: use productCategory instead of vendorName for joy name for apple driver
(cherry picked from commit 964bedfdd9)
2025-09-15 11:52:21 -07:00
Ozkan Sezer 7135779599 SDL_endian.h: don't add _m_prefetch hack for clang-cl if available as a builtin
Fixes: https://github.com/libsdl-org/SDL/issues/13952 .

(cherry picked from commit 81f2f44843)
2025-09-15 20:10:28 +03:00
Eddy Jansson 62c151d044 wayland: Silence unused variable warning
'vd' and 'd' are only used if SDL_USE_LIBDBUS is set.

(cherry picked from commit 21c9f5304d)
2025-09-15 10:27:51 -04:00
Sam Lantinga 11d38fc23b 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

(cherry picked from commit dac6af4ba6)
2025-09-14 17:31:09 -07:00
Sam Lantinga d027f0ae6e 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

(cherry picked from commit cc3274b6f1)
2025-09-14 15:45:34 -07:00
Nintorch 44290c204e Fix HP Deluxe Webcam KQ246AA detected as joystick
(cherry picked from commit 556ee00fe3)
2025-09-14 15:40:40 -07:00
Sam Lantinga 0b69860af6 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.

(cherry picked from commit 937b7e6aea)
2025-09-14 15:40:06 -07:00
Sam Lantinga e7a1ae0ea5 Clarify why we ignore EINVAL when flushing a file descriptor
(cherry picked from commit a1d3fc1f50)
2025-09-14 15:39:53 -07:00
Sam Lantinga 7af36d6c40 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

(cherry picked from commit e40d337a47)
2025-09-14 12:10:18 -07:00
Sam Lantinga d1ae1163dd 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

(cherry picked from commit 1aba421bd3)
2025-09-14 10:00:40 -07:00
Sam Lantinga b2cf5729b4 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

(cherry picked from commit 78a29d1670)
2025-09-14 08:52:43 -07:00
Sam Lantinga 11b8dd76db Fixed memory leak when using detached threads
Fixes https://github.com/libsdl-org/SDL/issues/13886

(cherry picked from commit ede86a1267)
2025-09-14 08:43:12 -07:00
Frank Praznik 56507a6122 x11: Use the SDL_WindowFlags type instead of Uint32
Uint32 can potentially truncate the flag value, as it is 64 bits in SDL3.

(cherry picked from commit 4561be89a5)
2025-09-13 15:45:43 -04:00
Evan Hemsley 8d4324cba2 GPU: Bump MAX_COLOR_TARGET_BINDINGS to 8 (#13937)
(cherry picked from commit fe314a1b8a)
2025-09-12 13:38:58 -07:00
Jaan Soulier 35408a2126 Fix reallocation of GPU renderer vertex buffer
(cherry picked from commit ed6a72a7fd)
2025-09-09 20:28:32 -07:00
Sam Lantinga e5b9dfd181 Fixed setting SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER
(cherry picked from commit b7dba970e1)
2025-09-09 17:35:03 -07:00
eafton e8a5d07e5e X11: Check for invalid opcodes in SHM error handler
(cherry picked from commit b59d6d49c3)
2025-09-09 10:59:58 -07:00
Luis Caceres 8c1daf0caf gpu/vulkan: Move dereference after null check
(cherry picked from commit 03d0c2ad74)
2025-09-08 09:50:09 -07:00
Sam Lantinga ad2b211f75 Fixed pitch and chroma issues with the Vulkan planar YUV texture update functions
Fixes https://github.com/libsdl-org/SDL/issues/13734

(cherry picked from commit 466f93aee1)
2025-09-07 10:19:59 -07:00
Sam Lantinga 414ae344af Fixed rumble strength on DualSense Edge and Bluetooth connected controllers
Fixes https://github.com/libsdl-org/SDL/issues/13771

(cherry picked from commit 25d9096d41)
2025-09-06 11:53:55 -07:00
Adrian 71af2c020c Set preferredFrameRateRange in main callbacks CADisplayLink
(cherry picked from commit 01e6aceffc)
2025-09-06 10:13:44 -07:00
Aleksey Melekh e755f50072 xbox: fix build
(cherry picked from commit 129c97f610)
2025-09-05 09:20:34 -07:00
Sam Lantinga a0b8275e9c Fixed the perspective matrix calculation (thanks @KonkolyTamas!)
Fixes https://github.com/libsdl-org/SDL/issues/13867

(cherry picked from commit ea1a769322)
2025-09-04 06:07:28 -07:00
Cameron Cawley ea362839b1 Remove unused PSP source files
(cherry picked from commit 42f571ea4b)
2025-09-03 15:20:00 -07:00
Sam Lantinga e7dd5d841b Don't set SDL_SURFACE_LOCK_NEEDED until a surface is RLE encoded
Reference https://github.com/libsdl-org/sdl2-compat/issues/476

(cherry picked from commit 437d78499c)
2025-09-02 21:32:17 -07:00
Sam Lantinga 5594d03da0 Leave letterbox borders set to the frame clear color
Fixes https://github.com/libsdl-org/sdl2-compat/issues/483

(cherry picked from commit fbbc29159a)
2025-09-02 20:14:56 -07:00
Sam Lantinga f2ae66b64f Set the texture scale and address mode when creating a texture
Fixes https://github.com/libsdl-org/sdl2-compat/issues/506

(cherry picked from commit ef19c72015)
2025-09-02 19:46:28 -07:00
Anonymous Maarten 393d99338f cmake: make SDL_CPU_xxx variable visible when using CMAKE_OSX_ARCHITECTURES
(cherry picked from commit ebb52973e1)
2025-09-02 23:00:10 +03:00
Ozkan Sezer 4d88280931 cmake: simd detection clean-up for Apple multi-arch configs.
(cherry picked from commit 83bb0f9105)
2025-09-02 22:35:32 +03:00
Anonymous Maarten e8cc359b5e cmake: use 'TargetConditionals.h' on Apple for SIMD tests
(cherry picked from commit e15e2808f2)
2025-09-02 22:35:20 +03:00
Anonymous Maarten 3b4a198655 cmake: use APPLE in dep_option
expands to <nothing> on e.g. Windows, which will be interpreted as true by cmake_dependent_option.

(cherry picked from commit 1e7d3b51de)
2025-09-02 22:35:02 +03:00
Ethan Lee 03dd1520a3 gpu: VK_KHR_get_physical_device_properties2 can be optional
(cherry picked from commit 689049f8ec)
2025-09-02 09:53:59 -07:00
Sam Lantinga a6fd74fa3b Fix crash when enumerating Steam Controllers
Closes https://github.com/libsdl-org/SDL/pull/13746
2025-09-02 08:42:16 -07:00
Sam Lantinga 03b36bac94 Updated to version 3.2.23 for development 2025-09-01 15:12:43 -07:00
53 changed files with 395 additions and 332 deletions

No files matched your search

+4 -7
View File
@@ -20,7 +20,6 @@ class AppleArch(Enum):
class MsvcArch(Enum): class MsvcArch(Enum):
X86 = "x86" X86 = "x86"
X64 = "x64" X64 = "x64"
Arm32 = "arm"
Arm64 = "arm64" Arm64 = "arm64"
@@ -109,7 +108,6 @@ JOB_SPECS = {
"msvc-x86": JobSpec(name="Windows (MSVC, x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x86", msvc_arch=MsvcArch.X86, msvc_project="VisualC/SDL.sln", ), "msvc-x86": JobSpec(name="Windows (MSVC, x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x86", msvc_arch=MsvcArch.X86, msvc_project="VisualC/SDL.sln", ),
"msvc-clang-x64": JobSpec(name="Windows (MSVC, clang-cl x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x64", msvc_arch=MsvcArch.X64, clang_cl=True, ), "msvc-clang-x64": JobSpec(name="Windows (MSVC, clang-cl x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x64", msvc_arch=MsvcArch.X64, clang_cl=True, ),
"msvc-clang-x86": JobSpec(name="Windows (MSVC, clang-cl x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x86", msvc_arch=MsvcArch.X86, clang_cl=True, ), "msvc-clang-x86": JobSpec(name="Windows (MSVC, clang-cl x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x86", msvc_arch=MsvcArch.X86, clang_cl=True, ),
"msvc-arm32": JobSpec(name="Windows (MSVC, ARM)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm32", msvc_arch=MsvcArch.Arm32, ),
"msvc-arm64": JobSpec(name="Windows (MSVC, ARM64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm64", msvc_arch=MsvcArch.Arm64, ), "msvc-arm64": JobSpec(name="Windows (MSVC, ARM64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm64", msvc_arch=MsvcArch.Arm64, ),
"msvc-gdk-x64": JobSpec(name="GDK (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-GDK", msvc_arch=MsvcArch.X64, msvc_project="VisualC-GDK/SDL.sln", gdk=True, no_cmake=True, ), "msvc-gdk-x64": JobSpec(name="GDK (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-GDK", msvc_arch=MsvcArch.X64, msvc_project="VisualC-GDK/SDL.sln", gdk=True, no_cmake=True, ),
"ubuntu-22.04": JobSpec(name="Ubuntu 22.04", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04", ), "ubuntu-22.04": JobSpec(name="Ubuntu 22.04", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04", ),
@@ -409,10 +407,6 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
job.msvc_vcvars_arch = "x64_x86" job.msvc_vcvars_arch = "x64_x86"
case MsvcArch.X64: case MsvcArch.X64:
job.msvc_vcvars_arch = "x64" job.msvc_vcvars_arch = "x64"
case MsvcArch.Arm32:
job.msvc_vcvars_arch = "x64_arm"
job.msvc_vcvars_sdk = "10.0.22621.0" # 10.0.26100.0 dropped ARM32 um and ucrt libraries
job.run_tests = False
case MsvcArch.Arm64: case MsvcArch.Arm64:
job.msvc_vcvars_arch = "x64_arm64" job.msvc_vcvars_arch = "x64_arm64"
job.run_tests = False job.run_tests = False
@@ -518,11 +512,14 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
job.shared_lib = SharedLibType.DYLIB job.shared_lib = SharedLibType.DYLIB
job.static_lib = StaticLibType.A job.static_lib = StaticLibType.A
job.ccache = True job.ccache = True
if spec.os == JobOs.Macos13:
job.ccache = False
job.apt_packages = [] job.apt_packages = []
job.brew_packages.extend(( job.brew_packages.extend((
"ccache",
"ninja", "ninja",
)) ))
if job.ccache:
job.brew_packages.append("ccache")
if job.clang_tidy: if job.clang_tidy:
job.brew_packages.append("llvm") job.brew_packages.append("llvm")
if spec.xcode: if spec.xcode:
+39 -33
View File
@@ -5,7 +5,7 @@ if(NOT DEFINED CMAKE_BUILD_TYPE)
endif() endif()
# See docs/release_checklist.md # See docs/release_checklist.md
project(SDL3 LANGUAGES C VERSION "3.2.22") project(SDL3 LANGUAGES C VERSION "3.2.24")
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(SDL3_MAINPROJECT ON) set(SDL3_MAINPROJECT ON)
@@ -79,6 +79,12 @@ include("${SDL3_SOURCE_DIR}/cmake/PreseedEmscriptenCache.cmake")
SDL_DetectCompiler() SDL_DetectCompiler()
SDL_DetectTargetCPUArchitectures(SDL_CPUS) SDL_DetectTargetCPUArchitectures(SDL_CPUS)
if(APPLE AND CMAKE_OSX_ARCHITECTURES)
list(LENGTH CMAKE_OSX_ARCHITECTURES _num_arches)
if(_num_arches GREATER 1)
set(APPLE_MULTIARCH TRUE)
endif()
endif()
# Increment this if there is an incompatible change - but if that happens, # Increment this if there is an incompatible change - but if that happens,
# we should rename the library from SDL3 to SDL4, at which point this would # we should rename the library from SDL3 to SDL4, at which point this would
@@ -350,7 +356,7 @@ dep_option(SDL_WASAPI "Use the Windows WASAPI audio driver" ON "WIN
dep_option(SDL_RENDER_D3D "Enable the Direct3D 9 render driver" ON "SDL_RENDER;SDL_DIRECTX" OFF) dep_option(SDL_RENDER_D3D "Enable the Direct3D 9 render driver" ON "SDL_RENDER;SDL_DIRECTX" OFF)
dep_option(SDL_RENDER_D3D11 "Enable the Direct3D 11 render driver" ON "SDL_RENDER;SDL_DIRECTX" OFF) dep_option(SDL_RENDER_D3D11 "Enable the Direct3D 11 render driver" ON "SDL_RENDER;SDL_DIRECTX" OFF)
dep_option(SDL_RENDER_D3D12 "Enable the Direct3D 12 render driver" ON "SDL_RENDER;SDL_DIRECTX" OFF) dep_option(SDL_RENDER_D3D12 "Enable the Direct3D 12 render driver" ON "SDL_RENDER;SDL_DIRECTX" OFF)
dep_option(SDL_RENDER_METAL "Enable the Metal render driver" ON "SDL_RENDER;${APPLE}" OFF) dep_option(SDL_RENDER_METAL "Enable the Metal render driver" ON "SDL_RENDER;APPLE" OFF)
dep_option(SDL_RENDER_GPU "Enable the SDL_GPU render driver" ON "SDL_RENDER;SDL_GPU" OFF) dep_option(SDL_RENDER_GPU "Enable the SDL_GPU render driver" ON "SDL_RENDER;SDL_GPU" OFF)
dep_option(SDL_VIVANTE "Use Vivante EGL video driver" ON "${UNIX_SYS};SDL_CPU_ARM32" OFF) dep_option(SDL_VIVANTE "Use Vivante EGL video driver" ON "${UNIX_SYS};SDL_CPU_ARM32" OFF)
dep_option(SDL_VULKAN "Enable Vulkan support" ON "SDL_VIDEO;ANDROID OR APPLE OR LINUX OR FREEBSD OR WINDOWS" OFF) dep_option(SDL_VULKAN "Enable Vulkan support" ON "SDL_VIDEO;ANDROID OR APPLE OR LINUX OR FREEBSD OR WINDOWS" OFF)
@@ -658,7 +664,7 @@ if(SDL_ASSEMBLY)
if(USE_GCC OR USE_CLANG OR USE_INTELCC) if(USE_GCC OR USE_CLANG OR USE_INTELCC)
string(APPEND CMAKE_REQUIRED_FLAGS " -mmmx") string(APPEND CMAKE_REQUIRED_FLAGS " -mmmx")
endif() endif()
check_c_source_compiles(" check_x86_source_compiles([==[
#include <mmintrin.h> #include <mmintrin.h>
void ints_add(int *dest, int *a, int *b, unsigned size) { void ints_add(int *dest, int *a, int *b, unsigned size) {
for (; size >= 2; size -= 2, dest += 2, a += 2, b += 2) { for (; size >= 2; size -= 2, dest += 2, a += 2, b += 2) {
@@ -668,7 +674,7 @@ if(SDL_ASSEMBLY)
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
ints_add((int*)0, (int*)0, (int*)0, 0); ints_add((int*)0, (int*)0, (int*)0, 0);
return 0; return 0;
}" COMPILER_SUPPORTS_MMX) }]==] COMPILER_SUPPORTS_MMX)
cmake_pop_check_state() cmake_pop_check_state()
if(COMPILER_SUPPORTS_MMX) if(COMPILER_SUPPORTS_MMX)
set(HAVE_MMX TRUE) set(HAVE_MMX TRUE)
@@ -679,7 +685,7 @@ if(SDL_ASSEMBLY)
if(USE_GCC OR USE_CLANG OR USE_INTELCC) if(USE_GCC OR USE_CLANG OR USE_INTELCC)
string(APPEND CMAKE_REQUIRED_FLAGS " -msse") string(APPEND CMAKE_REQUIRED_FLAGS " -msse")
endif() endif()
check_c_source_compiles(" check_x86_source_compiles([==[
#include <xmmintrin.h> #include <xmmintrin.h>
void floats_add(float *dest, float *a, float *b, unsigned size) { void floats_add(float *dest, float *a, float *b, unsigned size) {
for (; size >= 4; size -= 4, dest += 4, a += 4, b += 4) { for (; size >= 4; size -= 4, dest += 4, a += 4, b += 4) {
@@ -689,7 +695,7 @@ if(SDL_ASSEMBLY)
int main(int argc, char **argv) { int main(int argc, char **argv) {
floats_add((float*)0, (float*)0, (float*)0, 0); floats_add((float*)0, (float*)0, (float*)0, 0);
return 0; return 0;
}" COMPILER_SUPPORTS_SSE) }]==] COMPILER_SUPPORTS_SSE)
cmake_pop_check_state() cmake_pop_check_state()
if(COMPILER_SUPPORTS_SSE) if(COMPILER_SUPPORTS_SSE)
set(HAVE_SSE TRUE) set(HAVE_SSE TRUE)
@@ -700,7 +706,7 @@ if(SDL_ASSEMBLY)
if(USE_GCC OR USE_CLANG OR USE_INTELCC) if(USE_GCC OR USE_CLANG OR USE_INTELCC)
string(APPEND CMAKE_REQUIRED_FLAGS " -msse2") string(APPEND CMAKE_REQUIRED_FLAGS " -msse2")
endif() endif()
check_c_source_compiles(" check_x86_source_compiles([==[
#include <emmintrin.h> #include <emmintrin.h>
void doubles_add(double *dest, double *a, double *b, unsigned size) { void doubles_add(double *dest, double *a, double *b, unsigned size) {
for (; size >= 4; size -= 4, dest += 4, a += 4, b += 4) { for (; size >= 4; size -= 4, dest += 4, a += 4, b += 4) {
@@ -710,7 +716,7 @@ if(SDL_ASSEMBLY)
int main(int argc, char **argv) { int main(int argc, char **argv) {
doubles_add((double*)0, (double*)0, (double*)0, 0); doubles_add((double*)0, (double*)0, (double*)0, 0);
return 0; return 0;
}" COMPILER_SUPPORTS_SSE2) }]==] COMPILER_SUPPORTS_SSE2)
cmake_pop_check_state() cmake_pop_check_state()
if(COMPILER_SUPPORTS_SSE2) if(COMPILER_SUPPORTS_SSE2)
set(HAVE_SSE2 TRUE) set(HAVE_SSE2 TRUE)
@@ -721,7 +727,7 @@ if(SDL_ASSEMBLY)
if(USE_GCC OR USE_CLANG OR USE_INTELCC) if(USE_GCC OR USE_CLANG OR USE_INTELCC)
string(APPEND CMAKE_REQUIRED_FLAGS " -msse3") string(APPEND CMAKE_REQUIRED_FLAGS " -msse3")
endif() endif()
check_c_source_compiles(" check_x86_source_compiles([==[
#include <pmmintrin.h> #include <pmmintrin.h>
void ints_add(int *dest, int *a, int *b, unsigned size) { void ints_add(int *dest, int *a, int *b, unsigned size) {
for (; size >= 4; size -= 4, dest += 4, a += 4, b += 4) { for (; size >= 4; size -= 4, dest += 4, a += 4, b += 4) {
@@ -731,7 +737,7 @@ if(SDL_ASSEMBLY)
int main(int argc, char **argv) { int main(int argc, char **argv) {
ints_add((int*)0, (int*)0, (int*)0, 0); ints_add((int*)0, (int*)0, (int*)0, 0);
return 0; return 0;
}" COMPILER_SUPPORTS_SSE3) }]==] COMPILER_SUPPORTS_SSE3)
cmake_pop_check_state() cmake_pop_check_state()
if(COMPILER_SUPPORTS_SSE3) if(COMPILER_SUPPORTS_SSE3)
set(HAVE_SSE3 TRUE) set(HAVE_SSE3 TRUE)
@@ -742,7 +748,7 @@ if(SDL_ASSEMBLY)
if(USE_GCC OR USE_CLANG OR USE_INTELCC) if(USE_GCC OR USE_CLANG OR USE_INTELCC)
string(APPEND CMAKE_REQUIRED_FLAGS " -msse4.1") string(APPEND CMAKE_REQUIRED_FLAGS " -msse4.1")
endif() endif()
check_c_source_compiles(" check_x86_source_compiles([==[
#include <smmintrin.h> #include <smmintrin.h>
void ints_mul(int *dest, int *a, int *b, unsigned size) { void ints_mul(int *dest, int *a, int *b, unsigned size) {
for (; size >= 4; size -= 4, dest += 4, a += 4, b += 4) { for (; size >= 4; size -= 4, dest += 4, a += 4, b += 4) {
@@ -752,7 +758,7 @@ if(SDL_ASSEMBLY)
int main(int argc, char **argv) { int main(int argc, char **argv) {
ints_mul((int*)0, (int*)0, (int*)0, 0); ints_mul((int*)0, (int*)0, (int*)0, 0);
return 0; return 0;
}" COMPILER_SUPPORTS_SSE4_1) }]==] COMPILER_SUPPORTS_SSE4_1)
cmake_pop_check_state() cmake_pop_check_state()
if(COMPILER_SUPPORTS_SSE4_1) if(COMPILER_SUPPORTS_SSE4_1)
set(HAVE_SSE4_1 TRUE) set(HAVE_SSE4_1 TRUE)
@@ -763,14 +769,14 @@ if(SDL_ASSEMBLY)
if(USE_GCC OR USE_CLANG OR USE_INTELCC) if(USE_GCC OR USE_CLANG OR USE_INTELCC)
string(APPEND CMAKE_REQUIRED_FLAGS " -msse4.2") string(APPEND CMAKE_REQUIRED_FLAGS " -msse4.2")
endif() endif()
check_c_source_compiles(" check_x86_source_compiles([==[
#include <nmmintrin.h> #include <nmmintrin.h>
__m128i bitmask; __m128i bitmask;
char data[16]; char data[16];
int main(int argc, char **argv) { int main(int argc, char **argv) {
bitmask = _mm_cmpgt_epi64(_mm_set1_epi64x(0), _mm_loadu_si128((void*)data)); bitmask = _mm_cmpgt_epi64(_mm_set1_epi64x(0), _mm_loadu_si128((void*)data));
return 0; return 0;
}" COMPILER_SUPPORTS_SSE4_2) }]==] COMPILER_SUPPORTS_SSE4_2)
cmake_pop_check_state() cmake_pop_check_state()
if(COMPILER_SUPPORTS_SSE4_2) if(COMPILER_SUPPORTS_SSE4_2)
set(HAVE_SSE4_2 TRUE) set(HAVE_SSE4_2 TRUE)
@@ -781,7 +787,7 @@ if(SDL_ASSEMBLY)
if(USE_GCC OR USE_CLANG OR USE_INTELCC) if(USE_GCC OR USE_CLANG OR USE_INTELCC)
string(APPEND CMAKE_REQUIRED_FLAGS " -mavx") string(APPEND CMAKE_REQUIRED_FLAGS " -mavx")
endif() endif()
check_c_source_compiles(" check_x86_source_compiles([==[
#include <immintrin.h> #include <immintrin.h>
void floats_add(float *dest, float *a, float *b, unsigned size) { void floats_add(float *dest, float *a, float *b, unsigned size) {
for (; size >= 8; size -= 8, dest += 8, a += 8, b += 8) { for (; size >= 8; size -= 8, dest += 8, a += 8, b += 8) {
@@ -791,7 +797,7 @@ if(SDL_ASSEMBLY)
int main(int argc, char **argv) { int main(int argc, char **argv) {
floats_add((float*)0, (float*)0, (float*)0, 0); floats_add((float*)0, (float*)0, (float*)0, 0);
return 0; return 0;
}" COMPILER_SUPPORTS_AVX) }]==] COMPILER_SUPPORTS_AVX)
cmake_pop_check_state() cmake_pop_check_state()
if(COMPILER_SUPPORTS_AVX) if(COMPILER_SUPPORTS_AVX)
set(HAVE_AVX TRUE) set(HAVE_AVX TRUE)
@@ -802,7 +808,7 @@ if(SDL_ASSEMBLY)
if(USE_GCC OR USE_CLANG OR USE_INTELCC) if(USE_GCC OR USE_CLANG OR USE_INTELCC)
string(APPEND CMAKE_REQUIRED_FLAGS " -mavx2") string(APPEND CMAKE_REQUIRED_FLAGS " -mavx2")
endif() endif()
check_c_source_compiles(" check_x86_source_compiles([==[
#include <immintrin.h> #include <immintrin.h>
void ints_add(int *dest, int *a, int *b, unsigned size) { void ints_add(int *dest, int *a, int *b, unsigned size) {
for (; size >= 8; size -= 8, dest += 8, a += 8, b += 8) { for (; size >= 8; size -= 8, dest += 8, a += 8, b += 8) {
@@ -812,7 +818,7 @@ if(SDL_ASSEMBLY)
int main(int argc, char **argv) { int main(int argc, char **argv) {
ints_add((int*)0, (int*)0, (int*)0, 0); ints_add((int*)0, (int*)0, (int*)0, 0);
return 0; return 0;
}" COMPILER_SUPPORTS_AVX2) }]==] COMPILER_SUPPORTS_AVX2)
cmake_pop_check_state() cmake_pop_check_state()
if(COMPILER_SUPPORTS_AVX2) if(COMPILER_SUPPORTS_AVX2)
set(HAVE_AVX2 TRUE) set(HAVE_AVX2 TRUE)
@@ -823,7 +829,7 @@ if(SDL_ASSEMBLY)
if(USE_GCC OR USE_CLANG OR USE_INTELCC) if(USE_GCC OR USE_CLANG OR USE_INTELCC)
string(APPEND CMAKE_REQUIRED_FLAGS " -mavx512f") string(APPEND CMAKE_REQUIRED_FLAGS " -mavx512f")
endif() endif()
check_c_source_compiles(" check_x86_source_compiles([==[
#include <immintrin.h> #include <immintrin.h>
void floats_add(float *dest, float *a, float *b, unsigned size) { void floats_add(float *dest, float *a, float *b, unsigned size) {
for (; size >= 16; size -= 16, dest += 16, a += 16, b += 16) { for (; size >= 16; size -= 16, dest += 16, a += 16, b += 16) {
@@ -833,7 +839,7 @@ if(SDL_ASSEMBLY)
int main(int argc, char **argv) { int main(int argc, char **argv) {
floats_add((float*)0, (float*)0, (float*)0, 0); floats_add((float*)0, (float*)0, (float*)0, 0);
return 0; return 0;
}" COMPILER_SUPPORTS_AVX512F) }]==] COMPILER_SUPPORTS_AVX512F)
cmake_pop_check_state() cmake_pop_check_state()
if(COMPILER_SUPPORTS_AVX512F) if(COMPILER_SUPPORTS_AVX512F)
set(HAVE_AVX512F TRUE) set(HAVE_AVX512F TRUE)
@@ -841,18 +847,17 @@ if(SDL_ASSEMBLY)
endif() endif()
if(SDL_ARMNEON) if(SDL_ARMNEON)
check_c_source_compiles(" check_arm_source_compiles([==[
#include <arm_neon.h> #include <arm_neon.h>
void floats_add(float *dest, float *a, float *b, unsigned size) { void floats_add(float *dest, float *a, float *b, unsigned size) {
for (; size >= 4; size -= 4, dest += 4, a += 4, b += 4) { for (; size >= 4; size -= 4, dest += 4, a += 4, b += 4) {
vst1q_f32(dest, vaddq_f32(vld1q_f32(a), vld1q_f32(b))); vst1q_f32(dest, vaddq_f32(vld1q_f32(a), vld1q_f32(b)));
}
} }
int main(int argc, char *argv[]) { }
floats_add((float*)0, (float*)0, (float*)0, 0); int main(int argc, char *argv[]) {
return 0; floats_add((float*)0, (float*)0, (float*)0, 0);
}" COMPILER_SUPPORTS_ARMNEON) return 0;
}]==] COMPILER_SUPPORTS_ARMNEON)
if(COMPILER_SUPPORTS_ARMNEON) if(COMPILER_SUPPORTS_ARMNEON)
set(HAVE_ARMNEON TRUE) set(HAVE_ARMNEON TRUE)
endif() endif()
@@ -3148,14 +3153,15 @@ endforeach()
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/REVISION.txt") if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/REVISION.txt")
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/REVISION.txt" revisions) file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/REVISION.txt" revisions)
list(GET revisions 0 revisions_0) list(GET revisions 0 revisions_0)
string(STRIP "${revisions_0}" SDL_REVISION) string(STRIP "${revisions_0}" revisions_0_stripped)
set(SDL_REVISION "SDL-${revisions_0_stripped}")
else() else()
set(SDL_REVISION "" CACHE STRING "Custom SDL revision (only used when REVISION.txt does not exist)") set(SDL_REVISION "" CACHE STRING "Custom SDL revision (only used when REVISION.txt does not exist)")
endif() endif()
if(NOT SDL_REVISION) if(NOT SDL_REVISION)
# If SDL_REVISION is not overrided, use git to describe # If SDL_REVISION is not overrided, use git to describe
git_describe(SDL_REVISION_GIT) git_describe(SDL_REVISION_GIT)
set(SDL_REVISION "SDL3-${SDL3_VERSION}-${SDL_REVISION_GIT}") set(SDL_REVISION "SDL-${SDL3_VERSION}-${SDL_REVISION_GIT}")
endif() endif()
execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory "${SDL3_BINARY_DIR}/include-revision/SDL3") execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory "${SDL3_BINARY_DIR}/include-revision/SDL3")
+2 -2
View File
@@ -19,10 +19,10 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>3.2.22</string> <string>3.2.24</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>SDLX</string> <string>SDLX</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>3.2.22</string> <string>3.2.24</string>
</dict> </dict>
</plist> </plist>
+4 -4
View File
@@ -3086,7 +3086,7 @@
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
DEPLOYMENT_POSTPROCESSING = YES; DEPLOYMENT_POSTPROCESSING = YES;
DYLIB_COMPATIBILITY_VERSION = 201.0.0; DYLIB_COMPATIBILITY_VERSION = 201.0.0;
DYLIB_CURRENT_VERSION = 201.22.0; DYLIB_CURRENT_VERSION = 201.24.0;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_ALTIVEC_EXTENSIONS = YES; GCC_ALTIVEC_EXTENSIONS = YES;
@@ -3121,7 +3121,7 @@
"@loader_path/Frameworks", "@loader_path/Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 10.13; MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 3.2.22; MARKETING_VERSION = 3.2.24;
OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)"; OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)";
PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3;
PRODUCT_NAME = SDL3; PRODUCT_NAME = SDL3;
@@ -3150,7 +3150,7 @@
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
DYLIB_COMPATIBILITY_VERSION = 201.0.0; DYLIB_COMPATIBILITY_VERSION = 201.0.0;
DYLIB_CURRENT_VERSION = 201.22.0; DYLIB_CURRENT_VERSION = 201.24.0;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES; ENABLE_TESTABILITY = YES;
@@ -3182,7 +3182,7 @@
"@loader_path/Frameworks", "@loader_path/Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 10.13; MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 3.2.22; MARKETING_VERSION = 3.2.24;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)"; OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)";
PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3;
+1 -1
View File
@@ -1,4 +1,4 @@
Title SDL 3.2.22 Title SDL 3.2.24
Version 1 Version 1
Description SDL Library for macOS (http://www.libsdl.org) Description SDL Library for macOS (http://www.libsdl.org)
DefaultLocation /Library/Frameworks DefaultLocation /Library/Frameworks
@@ -61,7 +61,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
private static final String TAG = "SDL"; private static final String TAG = "SDL";
private static final int SDL_MAJOR_VERSION = 3; private static final int SDL_MAJOR_VERSION = 3;
private static final int SDL_MINOR_VERSION = 2; private static final int SDL_MINOR_VERSION = 2;
private static final int SDL_MICRO_VERSION = 22; private static final int SDL_MICRO_VERSION = 24;
/* /*
// Display InputType.SOURCE/CLASS of events and devices // Display InputType.SOURCE/CLASS of events and devices
// //
@@ -2196,7 +2196,11 @@ class SDLClipboardHandler implements
} }
public boolean clipboardHasText() { public boolean clipboardHasText() {
return mClipMgr.hasPrimaryClip(); if (Build.VERSION.SDK_INT >= 28 /* Android 9 (P) */) {
return mClipMgr.hasPrimaryClip();
} else {
return mClipMgr.hasText();
}
} }
public String clipboardGetText() { public String clipboardGetText() {
@@ -2214,10 +2218,19 @@ class SDLClipboardHandler implements
} }
public void clipboardSetText(String string) { public void clipboardSetText(String string) {
mClipMgr.removePrimaryClipChangedListener(this); mClipMgr.removePrimaryClipChangedListener(this);
ClipData clip = ClipData.newPlainText(null, string); if (string.isEmpty()) {
mClipMgr.setPrimaryClip(clip); if (Build.VERSION.SDK_INT >= 28 /* Android 9 (P) */) {
mClipMgr.addPrimaryClipChangedListener(this); mClipMgr.clearPrimaryClip();
} else {
ClipData clip = ClipData.newPlainText(null, "");
mClipMgr.setPrimaryClip(clip);
}
} else {
ClipData clip = ClipData.newPlainText(null, string);
mClipMgr.setPrimaryClip(clip);
}
mClipMgr.addPrimaryClipChangedListener(this);
} }
@Override @Override
+60
View File
@@ -160,3 +160,63 @@ function(SDL_AddCommonCompilerFlags TARGET)
endif() endif()
endif() endif()
endfunction() endfunction()
function(check_x86_source_compiles BODY VAR)
if(ARGN)
message(FATAL_ERROR "Unknown arguments: ${ARGN}")
endif()
if(APPLE_MULTIARCH AND (SDL_CPU_X86 OR SDL_CPU_X64))
set(test_conditional 1)
else()
set(test_conditional 0)
endif()
check_c_source_compiles("
#if ${test_conditional}
# if defined(__i386__) || defined(__x86_64__)
# define test_enabled 1
# else
# define test_enabled 0 /* feign success in Apple multi-arch configs */
# endif
#else /* test normally */
# define test_enabled 1
#endif
#if test_enabled
${BODY}
#else
int main(int argc, char *argv[]) {
(void)argc;
(void)argv;
return 0;
}
#endif" ${VAR})
endfunction()
function(check_arm_source_compiles BODY VAR)
if(ARGN)
message(FATAL_ERROR "Unknown arguments: ${ARGN}")
endif()
if(APPLE_MULTIARCH AND (SDL_CPU_ARM32 OR SDL_CPU_ARM64))
set(test_conditional 1)
else()
set(test_conditional 0)
endif()
check_c_source_compiles("
#if ${test_conditional}
# if defined(__arm__) || defined(__aarch64__)
# define test_enabled 1
# else
# define test_enabled 0 /* feign success in Apple multi-arch configs */
# endif
#else /* test normally */
# define test_enabled 1
#endif
#if test_enabled
${BODY}
#else
int main(int argc, char *argv[]) {
(void)argc;
(void)argv;
return 0;
}
#endif" ${VAR})
endfunction()
+3 -3
View File
@@ -4,15 +4,15 @@ function(SDL_DetectTargetCPUArchitectures DETECTED_ARCHS)
if(APPLE AND CMAKE_OSX_ARCHITECTURES) if(APPLE AND CMAKE_OSX_ARCHITECTURES)
foreach(known_arch IN LISTS known_archs) foreach(known_arch IN LISTS known_archs)
set(SDL_CPU_${known_arch} "0") set(SDL_CPU_${known_arch} "0" PARENT_SCOPE)
endforeach() endforeach()
set(detected_archs) set(detected_archs)
foreach(osx_arch IN LISTS CMAKE_OSX_ARCHITECTURES) foreach(osx_arch IN LISTS CMAKE_OSX_ARCHITECTURES)
if(osx_arch STREQUAL "x86_64") if(osx_arch STREQUAL "x86_64")
set(SDL_CPU_X64 "1") set(SDL_CPU_X64 "1" PARENT_SCOPE)
list(APPEND detected_archs "X64") list(APPEND detected_archs "X64")
elseif(osx_arch STREQUAL "arm64") elseif(osx_arch STREQUAL "arm64")
set(SDL_CPU_ARM64 "1") set(SDL_CPU_ARM64 "1" PARENT_SCOPE)
list(APPEND detected_archs "ARM64") list(APPEND detected_archs "ARM64")
endif() endif()
endforeach() endforeach()
+1 -1
View File
@@ -20,7 +20,7 @@
*/ */
/** /**
* Main include header for the SDL library, version 3.2.22 * Main include header for the SDL library, version 3.2.24
* *
* It is almost always best to include just this one header instead of * It is almost always best to include just this one header instead of
* picking out individual headers included here. There are exceptions to * picking out individual headers included here. There are exceptions to
+1 -1
View File
@@ -46,7 +46,7 @@
#if defined(_MSC_VER) && (_MSC_VER >= 1400) #if defined(_MSC_VER) && (_MSC_VER >= 1400)
/* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version, /* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version,
so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */ so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */
#ifdef __clang__ #if defined(__clang__) && !SDL_HAS_BUILTIN(_m_prefetch)
#ifndef __PRFCHWINTRIN_H #ifndef __PRFCHWINTRIN_H
#define __PRFCHWINTRIN_H #define __PRFCHWINTRIN_H
static __inline__ void __attribute__((__always_inline__, __nodebug__)) static __inline__ void __attribute__((__always_inline__, __nodebug__))
+2 -2
View File
@@ -2126,8 +2126,8 @@ extern "C" {
* *
* The variable can be set to the following values: * The variable can be set to the following values:
* *
* - "0": WGI is not used. * - "0": WGI is not used. (default)
* - "1": WGI is used. (default) * - "1": WGI is used.
* *
* This hint should be set before SDL is initialized. * This hint should be set before SDL is initialized.
* *
+1 -1
View File
@@ -62,7 +62,7 @@ extern "C" {
* *
* \since This macro is available since SDL 3.2.0. * \since This macro is available since SDL 3.2.0.
*/ */
#define SDL_MICRO_VERSION 22 #define SDL_MICRO_VERSION 24
/** /**
* This macro turns the version numbers into a numeric value. * This macro turns the version numbers into a numeric value.
+9
View File
@@ -1775,6 +1775,7 @@ static bool WaveLoad(SDL_IOStream *src, WaveFile *file, SDL_AudioSpec *spec, Uin
int result; int result;
Uint32 chunkcount = 0; Uint32 chunkcount = 0;
Uint32 chunkcountlimit = 10000; Uint32 chunkcountlimit = 10000;
const Sint64 flen = SDL_GetIOSize(src); // this might be -1 if the IOStream can't determine the total size.
const char *hint; const char *hint;
Sint64 RIFFstart, RIFFend, lastchunkpos; Sint64 RIFFstart, RIFFend, lastchunkpos;
bool RIFFlengthknown = false; bool RIFFlengthknown = false;
@@ -1883,6 +1884,14 @@ static bool WaveLoad(SDL_IOStream *src, WaveFile *file, SDL_AudioSpec *spec, Uin
fmtchunk = *chunk; fmtchunk = *chunk;
} }
} else if (chunk->fourcc == DATA) { } else if (chunk->fourcc == DATA) {
/* If the data chunk is bigger than the file, it might be corrupt
or the file is truncated. Try to recover by clamping the file
size. This also means a malicious file can't allocate 4 gigabytes
for the chunks without actually supplying a 4 gigabyte file. */
if ((flen > 0) && ((chunk->position + chunk->length) > flen)) {
chunk->length = (Uint32) (flen - chunk->position);
}
/* Only use the first data chunk. Handling the wavl list madness /* Only use the first data chunk. Handling the wavl list madness
* may require a different approach. * may require a different approach.
*/ */
+2 -2
View File
@@ -2164,7 +2164,7 @@ bool Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *b
mid = (*env)->GetMethodID(env, clazz, mid = (*env)->GetMethodID(env, clazz,
"messageboxShowMessageBox", "(ILjava/lang/String;Ljava/lang/String;[I[I[Ljava/lang/String;[I)I"); "messageboxShowMessageBox", "(ILjava/lang/String;Ljava/lang/String;[I[I[Ljava/lang/String;[I)I");
*buttonID = (*env)->CallIntMethod(env, context, mid, *buttonID = (*env)->CallIntMethod(env, context, mid,
messageboxdata->flags, (jint)messageboxdata->flags,
title, title,
message, message,
button_flags, button_flags,
@@ -2418,7 +2418,7 @@ const char *SDL_GetAndroidCachePath(void)
// fileObj = context.getExternalFilesDir(); // fileObj = context.getExternalFilesDir();
mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context), mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context),
"getCacheDir", "()Ljava/io/File;"); "getCacheDir", "()Ljava/io/File;");
fileObject = (*env)->CallObjectMethod(env, context, mid, NULL); fileObject = (*env)->CallObjectMethod(env, context, mid);
if (!fileObject) { if (!fileObject) {
SDL_SetError("Couldn't get cache directory"); SDL_SetError("Couldn't get cache directory");
LocalReferenceHolder_Cleanup(&refs); LocalReferenceHolder_Cleanup(&refs);
+4 -4
View File
@@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,2,22,0 FILEVERSION 3,2,24,0
PRODUCTVERSION 3,2,22,0 PRODUCTVERSION 3,2,24,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L FILEFLAGS 0x0L
FILEOS 0x40004L FILEOS 0x40004L
@@ -23,12 +23,12 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "\0" VALUE "CompanyName", "\0"
VALUE "FileDescription", "SDL\0" VALUE "FileDescription", "SDL\0"
VALUE "FileVersion", "3, 2, 22, 0\0" VALUE "FileVersion", "3, 2, 24, 0\0"
VALUE "InternalName", "SDL\0" VALUE "InternalName", "SDL\0"
VALUE "LegalCopyright", "Copyright (C) 2025 Sam Lantinga\0" VALUE "LegalCopyright", "Copyright (C) 2025 Sam Lantinga\0"
VALUE "OriginalFilename", "SDL3.dll\0" VALUE "OriginalFilename", "SDL3.dll\0"
VALUE "ProductName", "Simple DirectMedia Layer\0" VALUE "ProductName", "Simple DirectMedia Layer\0"
VALUE "ProductVersion", "3, 2, 22, 0\0" VALUE "ProductVersion", "3, 2, 24, 0\0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"
+2
View File
@@ -1646,6 +1646,8 @@ bool SDL_WaitEventTimeoutNS(SDL_Event *event, Sint64 timeoutNS)
#ifdef SDL_PLATFORM_ANDROID #ifdef SDL_PLATFORM_ANDROID
for (;;) { for (;;) {
SDL_PumpEventsInternal(true);
if (SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_EVENT_FIRST, SDL_EVENT_LAST) > 0) { if (SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_EVENT_FIRST, SDL_EVENT_LAST) > 0) {
return true; return true;
} }
+1 -1
View File
@@ -35,7 +35,7 @@
#define UNIFORM_BUFFER_SIZE 32768 #define UNIFORM_BUFFER_SIZE 32768
#define MAX_VERTEX_BUFFERS 16 #define MAX_VERTEX_BUFFERS 16
#define MAX_VERTEX_ATTRIBUTES 16 #define MAX_VERTEX_ATTRIBUTES 16
#define MAX_COLOR_TARGET_BINDINGS 4 #define MAX_COLOR_TARGET_BINDINGS 8
#define MAX_PRESENT_COUNT 16 #define MAX_PRESENT_COUNT 16
#define MAX_FRAMES_IN_FLIGHT 3 #define MAX_FRAMES_IN_FLIGHT 3
+2 -1
View File
@@ -1778,7 +1778,8 @@ static void METAL_UploadToTexture(
copyFromBuffer:bufferContainer->activeBuffer->handle copyFromBuffer:bufferContainer->activeBuffer->handle
sourceOffset:source->offset sourceOffset:source->offset
sourceBytesPerRow:BytesPerRow(destination->w, textureContainer->header.info.format) sourceBytesPerRow:BytesPerRow(destination->w, textureContainer->header.info.format)
sourceBytesPerImage:SDL_CalculateGPUTextureFormatSize(textureContainer->header.info.format, destination->w, destination->h, destination->d) // sourceBytesPerImage expects the stride between 2D images (slices) of a 3D texture, not the size of the entire region
sourceBytesPerImage:SDL_CalculateGPUTextureFormatSize(textureContainer->header.info.format, destination->w, destination->h, 1)
sourceSize:MTLSizeMake(destination->w, destination->h, destination->d) sourceSize:MTLSizeMake(destination->w, destination->h, destination->d)
toTexture:metalTexture->handle toTexture:metalTexture->handle
destinationSlice:destination->layer destinationSlice:destination->layer
+30 -14
View File
@@ -1143,6 +1143,7 @@ struct VulkanRenderer
VulkanExtensions supports; VulkanExtensions supports;
bool supportsDebugUtils; bool supportsDebugUtils;
bool supportsColorspace; bool supportsColorspace;
bool supportsPhysicalDeviceProperties2;
bool supportsFillModeNonSolid; bool supportsFillModeNonSolid;
bool supportsMultiDrawIndirect; bool supportsMultiDrawIndirect;
@@ -7909,15 +7910,17 @@ static void VULKAN_BeginRenderPass(
clearValues = SDL_stack_alloc(VkClearValue, clearCount); clearValues = SDL_stack_alloc(VkClearValue, clearCount);
for (i = 0; i < totalColorAttachmentCount; i += 1) { int clearIndex = 0;
clearValues[i].color.float32[0] = colorTargetInfos[i].clear_color.r; for (i = 0; i < numColorTargets; i += 1) {
clearValues[i].color.float32[1] = colorTargetInfos[i].clear_color.g; clearValues[clearIndex].color.float32[0] = colorTargetInfos[i].clear_color.r;
clearValues[i].color.float32[2] = colorTargetInfos[i].clear_color.b; clearValues[clearIndex].color.float32[1] = colorTargetInfos[i].clear_color.g;
clearValues[i].color.float32[3] = colorTargetInfos[i].clear_color.a; clearValues[clearIndex].color.float32[2] = colorTargetInfos[i].clear_color.b;
clearValues[clearIndex].color.float32[3] = colorTargetInfos[i].clear_color.a;
clearIndex += 1;
if (colorTargetInfos[i].store_op == SDL_GPU_STOREOP_RESOLVE || colorTargetInfos[i].store_op == SDL_GPU_STOREOP_RESOLVE_AND_STORE) { if (colorTargetInfos[i].store_op == SDL_GPU_STOREOP_RESOLVE || colorTargetInfos[i].store_op == SDL_GPU_STOREOP_RESOLVE_AND_STORE) {
// Skip over the resolve texture, we're not clearing it // Skip over the resolve texture, we're not clearing it
i += 1; clearIndex += 1;
} }
} }
@@ -9520,7 +9523,8 @@ static SDL_GPUCommandBuffer *VULKAN_AcquireCommandBuffer(
VulkanCommandBuffer *commandBuffer = VulkanCommandBuffer *commandBuffer =
VULKAN_INTERNAL_GetInactiveCommandBufferFromPool(renderer, threadID); VULKAN_INTERNAL_GetInactiveCommandBufferFromPool(renderer, threadID);
commandBuffer->descriptorSetCache = VULKAN_INTERNAL_AcquireDescriptorSetCache(renderer); DescriptorSetCache *descriptorSetCache =
VULKAN_INTERNAL_AcquireDescriptorSetCache(renderer);
SDL_UnlockMutex(renderer->acquireCommandBufferLock); SDL_UnlockMutex(renderer->acquireCommandBufferLock);
@@ -9528,6 +9532,8 @@ static SDL_GPUCommandBuffer *VULKAN_AcquireCommandBuffer(
return NULL; return NULL;
} }
commandBuffer->descriptorSetCache = descriptorSetCache;
// Reset state // Reset state
commandBuffer->currentComputePipeline = NULL; commandBuffer->currentComputePipeline = NULL;
@@ -11036,7 +11042,8 @@ static Uint8 VULKAN_INTERNAL_CheckInstanceExtensions(
const char **requiredExtensions, const char **requiredExtensions,
Uint32 requiredExtensionsLength, Uint32 requiredExtensionsLength,
bool *supportsDebugUtils, bool *supportsDebugUtils,
bool *supportsColorspace) bool *supportsColorspace,
bool *supportsPhysicalDeviceProperties2)
{ {
Uint32 extensionCount, i; Uint32 extensionCount, i;
VkExtensionProperties *availableExtensions; VkExtensionProperties *availableExtensions;
@@ -11075,6 +11082,12 @@ static Uint8 VULKAN_INTERNAL_CheckInstanceExtensions(
availableExtensions, availableExtensions,
extensionCount); extensionCount);
// Only needed for KHR_driver_properties!
*supportsPhysicalDeviceProperties2 = SupportsInstanceExtension(
VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME,
availableExtensions,
extensionCount);
SDL_free(availableExtensions); SDL_free(availableExtensions);
return allExtensionsSupported; return allExtensionsSupported;
} }
@@ -11185,10 +11198,6 @@ static Uint8 VULKAN_INTERNAL_CreateInstance(VulkanRenderer *renderer)
instanceExtensionCount + 4); instanceExtensionCount + 4);
SDL_memcpy((void *)instanceExtensionNames, originalInstanceExtensionNames, instanceExtensionCount * sizeof(const char *)); SDL_memcpy((void *)instanceExtensionNames, originalInstanceExtensionNames, instanceExtensionCount * sizeof(const char *));
// Core since 1.1
instanceExtensionNames[instanceExtensionCount++] =
VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME;
#ifdef SDL_PLATFORM_APPLE #ifdef SDL_PLATFORM_APPLE
instanceExtensionNames[instanceExtensionCount++] = instanceExtensionNames[instanceExtensionCount++] =
VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME; VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME;
@@ -11199,7 +11208,8 @@ static Uint8 VULKAN_INTERNAL_CreateInstance(VulkanRenderer *renderer)
instanceExtensionNames, instanceExtensionNames,
instanceExtensionCount, instanceExtensionCount,
&renderer->supportsDebugUtils, &renderer->supportsDebugUtils,
&renderer->supportsColorspace)) { &renderer->supportsColorspace,
&renderer->supportsPhysicalDeviceProperties2)) {
SDL_stack_free((char *)instanceExtensionNames); SDL_stack_free((char *)instanceExtensionNames);
SET_STRING_ERROR_AND_RETURN("Required Vulkan instance extensions not supported", false); SET_STRING_ERROR_AND_RETURN("Required Vulkan instance extensions not supported", false);
} }
@@ -11221,6 +11231,12 @@ static Uint8 VULKAN_INTERNAL_CreateInstance(VulkanRenderer *renderer)
VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME; VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME;
} }
if (renderer->supportsPhysicalDeviceProperties2) {
// Append KHR_physical_device_properties2 extension
instanceExtensionNames[instanceExtensionCount++] =
VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME;
}
createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
createInfo.pNext = NULL; createInfo.pNext = NULL;
createInfo.flags = createFlags; createInfo.flags = createFlags;
@@ -11763,7 +11779,7 @@ static SDL_GPUDevice *VULKAN_CreateDevice(bool debugMode, bool preferLowPower, S
} }
// FIXME: just move this into this function // FIXME: just move this into this function
result = (SDL_GPUDevice *)SDL_malloc(sizeof(SDL_GPUDevice)); result = (SDL_GPUDevice *)SDL_calloc(1, sizeof(SDL_GPUDevice));
ASSIGN_DRIVER(VULKAN) ASSIGN_DRIVER(VULKAN)
result->driverData = (SDL_GPURenderer *)renderer; result->driverData = (SDL_GPURenderer *)renderer;
+2
View File
@@ -671,6 +671,8 @@ static void fill_device_info_usage(struct hid_device_info *cur_dev, libusb_devic
cur_dev->usage_page = page; cur_dev->usage_page = page;
cur_dev->usage = usage; cur_dev->usage = usage;
free(hid_report_descriptor);
} }
#ifdef INVASIVE_GET_USAGE #ifdef INVASIVE_GET_USAGE
+5
View File
@@ -1399,6 +1399,11 @@ int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char
} }
} }
if (!res) { if (!res) {
if (GetLastError() == ERROR_OPERATION_ABORTED) {
/* The read request was issued on another thread.
This is harmless, so just ignore it. */
return 0;
}
register_winapi_error(dev, L"hid_read_timeout/GetOverlappedResult"); register_winapi_error(dev, L"hid_read_timeout/GetOverlappedResult");
} }
+2 -1
View File
@@ -455,7 +455,8 @@ static bool SDLCALL fd_flush(void *userdata, SDL_IOStatus *status)
result = SDL_fdatasync(iodata->fd); result = SDL_fdatasync(iodata->fd);
} while (result < 0 && errno == EINTR); } while (result < 0 && errno == EINTR);
if (result < 0) { // We get EINVAL when flushing a pipe, just make that a no-op
if (result < 0 && errno != EINVAL) {
return SDL_SetError("Error flushing datastream: %s", strerror(errno)); return SDL_SetError("Error flushing datastream: %s", strerror(errno));
} }
return true; return true;
+1
View File
@@ -278,6 +278,7 @@ static Uint32 initial_blacklist_devices[] = {
MAKE_VIDPID(0x26ce, 0x01a2), // ASRock LED Controller MAKE_VIDPID(0x26ce, 0x01a2), // ASRock LED Controller
MAKE_VIDPID(0x20d6, 0x0002), // PowerA Enhanced Wireless Controller for Nintendo Switch (charging port only) MAKE_VIDPID(0x20d6, 0x0002), // PowerA Enhanced Wireless Controller for Nintendo Switch (charging port only)
MAKE_VIDPID(0x3434, 0x0211), // Keychron K1 Pro System Control MAKE_VIDPID(0x3434, 0x0211), // Keychron K1 Pro System Control
MAKE_VIDPID(0x04f2, 0xa13c), // HP Deluxe Webcam KQ246AA
}; };
static SDL_vidpid_list blacklist_devices = { static SDL_vidpid_list blacklist_devices = {
SDL_HINT_JOYSTICK_BLACKLIST_DEVICES, 0, 0, NULL, SDL_HINT_JOYSTICK_BLACKLIST_DEVICES, 0, 0, NULL,
+8 -2
View File
@@ -300,8 +300,14 @@ static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
* struct, and ARC doesn't work with structs. */ * struct, and ARC doesn't work with structs. */
device->controller = (__bridge GCController *)CFBridgingRetain(controller); device->controller = (__bridge GCController *)CFBridgingRetain(controller);
if (controller.vendorName) { if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) {
name = controller.vendorName.UTF8String; if (controller.productCategory) {
name = controller.productCategory.UTF8String;
}
} else {
if (controller.vendorName) {
name = controller.vendorName.UTF8String;
}
} }
if (!name) { if (!name) {
+18 -6
View File
@@ -251,6 +251,7 @@ typedef struct
Uint64 last_packet; Uint64 last_packet;
int player_index; int player_index;
bool player_lights; bool player_lights;
bool enhanced_rumble;
Uint8 rumble_left; Uint8 rumble_left;
Uint8 rumble_right; Uint8 rumble_right;
bool color_set; bool color_set;
@@ -432,6 +433,14 @@ static bool HIDAPI_DriverPS5_InitDevice(SDL_HIDAPI_Device *device)
} }
} }
if (device->vendor_id == USB_VENDOR_SONY) {
if (device->product_id == USB_PRODUCT_SONY_DS5_EDGE ||
ctx->firmware_version == 0 || // Assume that it's updated firmware over Bluetooth
ctx->firmware_version >= 0x0224) {
ctx->enhanced_rumble = true;
}
}
// Get the device capabilities // Get the device capabilities
if (device->vendor_id == USB_VENDOR_SONY) { if (device->vendor_id == USB_VENDOR_SONY) {
ctx->sensors_supported = true; ctx->sensors_supported = true;
@@ -684,17 +693,17 @@ static bool HIDAPI_DriverPS5_UpdateEffects(SDL_DriverPS5_Context *ctx, int effec
if (ctx->vibration_supported) { if (ctx->vibration_supported) {
if (ctx->rumble_left || ctx->rumble_right) { if (ctx->rumble_left || ctx->rumble_right) {
if (ctx->firmware_version < 0x0224) { if (ctx->enhanced_rumble) {
effects.ucEnableBits3 |= 0x04; // Enable improved rumble emulation on 2.24 firmware and newer
effects.ucRumbleLeft = ctx->rumble_left;
effects.ucRumbleRight = ctx->rumble_right;
} else {
effects.ucEnableBits1 |= 0x01; // Enable rumble emulation effects.ucEnableBits1 |= 0x01; // Enable rumble emulation
// Shift to reduce effective rumble strength to match Xbox controllers // Shift to reduce effective rumble strength to match Xbox controllers
effects.ucRumbleLeft = ctx->rumble_left >> 1; effects.ucRumbleLeft = ctx->rumble_left >> 1;
effects.ucRumbleRight = ctx->rumble_right >> 1; effects.ucRumbleRight = ctx->rumble_right >> 1;
} else {
effects.ucEnableBits3 |= 0x04; // Enable improved rumble emulation on 2.24 firmware and newer
effects.ucRumbleLeft = ctx->rumble_left;
effects.ucRumbleRight = ctx->rumble_right;
} }
effects.ucEnableBits1 |= 0x02; // Disable audio haptics effects.ucEnableBits1 |= 0x02; // Disable audio haptics
} else { } else {
@@ -1038,6 +1047,9 @@ static bool HIDAPI_DriverPS5_InternalSendJoystickEffect(SDL_DriverPS5_Context *c
if (!ctx->enhanced_mode) { if (!ctx->enhanced_mode) {
if (application_usage) { if (application_usage) {
HIDAPI_DriverPS5_UpdateEnhancedModeOnApplicationUsage(ctx); HIDAPI_DriverPS5_UpdateEnhancedModeOnApplicationUsage(ctx);
// Wait briefly before sending additional effects
SDL_Delay(10);
} }
if (!ctx->enhanced_mode) { if (!ctx->enhanced_mode) {
+5
View File
@@ -1038,6 +1038,11 @@ static bool HIDAPI_DriverSteam_IsSupportedDevice(SDL_HIDAPI_Device *device, cons
return false; return false;
} }
if (!device) {
// Might be supported by this driver, enumerate and find out
return true;
}
if (device->is_bluetooth) { if (device->is_bluetooth) {
return true; return true;
} }
@@ -585,7 +585,7 @@ static bool WGI_JoystickInit(void)
{ {
HRESULT hr; HRESULT hr;
if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_WGI, true)) { if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_WGI, false)) {
return true; return true;
} }
+11
View File
@@ -43,6 +43,17 @@ static SDLIosMainCallbacksDisplayLink *globalDisplayLink;
{ {
if ((self = [super init])) { if ((self = [super init])) {
self.displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(appIteration:)]; self.displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(appIteration:)];
// Enable high refresh rates on iOS
// To enable this on phones, you should add the following line to Info.plist:
// <key>CADisableMinimumFrameDurationOnPhone</key> <true/>
// If main callbacks are used then this CADisplayLink will affect framerate, not one in SDL_uikitviewcontroller.
if (@available(iOS 15.0, tvOS 15.0, *)) {
const SDL_DisplayMode *mode = SDL_GetDesktopDisplayMode(SDL_GetPrimaryDisplay());
if (mode && mode->refresh_rate > 60.0f) {
int frame_rate = (int)mode->refresh_rate;
self.displayLink.preferredFrameRateRange = CAFrameRateRangeMake((frame_rate * 2) / 3, frame_rate, frame_rate);
}
}
[self.displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [self.displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
} }
return self; return self;
-90
View File
@@ -2737,94 +2737,6 @@ bool SDL_GetRenderLogicalPresentationRect(SDL_Renderer *renderer, SDL_FRect *rec
return true; return true;
} }
static void SDL_RenderLogicalBorders(SDL_Renderer *renderer, const SDL_FRect *dst)
{
const SDL_RenderViewState *view = renderer->view;
if (dst->x > 0.0f || dst->y > 0.0f) {
SDL_BlendMode saved_blend_mode = renderer->blendMode;
SDL_FColor saved_color = renderer->color;
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE);
SDL_SetRenderDrawColorFloat(renderer, 0.0f, 0.0f, 0.0f, 1.0f);
if (dst->x > 0.0f) {
SDL_FRect rect;
rect.x = 0.0f;
rect.y = 0.0f;
rect.w = dst->x;
rect.h = (float)view->pixel_h;
SDL_RenderFillRect(renderer, &rect);
rect.x = dst->x + dst->w;
rect.w = (float)view->pixel_w - rect.x;
SDL_RenderFillRect(renderer, &rect);
}
if (dst->y > 0.0f) {
SDL_FRect rect;
rect.x = 0.0f;
rect.y = 0.0f;
rect.w = (float)view->pixel_w;
rect.h = dst->y;
SDL_RenderFillRect(renderer, &rect);
rect.y = dst->y + dst->h;
rect.h = (float)view->pixel_h - rect.y;
SDL_RenderFillRect(renderer, &rect);
}
SDL_SetRenderDrawBlendMode(renderer, saved_blend_mode);
SDL_SetRenderDrawColorFloat(renderer, saved_color.r, saved_color.g, saved_color.b, saved_color.a);
}
}
static void SDL_RenderLogicalPresentation(SDL_Renderer *renderer)
{
SDL_assert(renderer->view == &renderer->main_view);
SDL_RenderViewState *view = &renderer->main_view;
const SDL_RendererLogicalPresentation mode = view->logical_presentation_mode;
if (mode == SDL_LOGICAL_PRESENTATION_LETTERBOX) {
// save off some state we're going to trample.
const int logical_w = view->logical_w;
const int logical_h = view->logical_h;
const float scale_x = view->scale.x;
const float scale_y = view->scale.y;
const bool clipping_enabled = view->clipping_enabled;
SDL_Rect orig_viewport, orig_cliprect;
const SDL_FRect logical_dst_rect = view->logical_dst_rect;
SDL_copyp(&orig_viewport, &view->viewport);
if (clipping_enabled) {
SDL_copyp(&orig_cliprect, &view->clip_rect);
}
// trample some state.
SDL_SetRenderLogicalPresentation(renderer, logical_w, logical_h, SDL_LOGICAL_PRESENTATION_DISABLED);
SDL_SetRenderViewport(renderer, NULL);
if (clipping_enabled) {
SDL_SetRenderClipRect(renderer, NULL);
}
SDL_SetRenderScale(renderer, 1.0f, 1.0f);
// draw the borders.
SDL_RenderLogicalBorders(renderer, &logical_dst_rect);
// now set everything back.
view->logical_presentation_mode = mode;
SDL_SetRenderViewport(renderer, &orig_viewport);
if (clipping_enabled) {
SDL_SetRenderClipRect(renderer, &orig_cliprect);
}
SDL_SetRenderScale(renderer, scale_x, scale_y);
SDL_SetRenderLogicalPresentation(renderer, logical_w, logical_h, mode);
}
}
static bool SDL_RenderVectorFromWindow(SDL_Renderer *renderer, float window_dx, float window_dy, float *dx, float *dy) static bool SDL_RenderVectorFromWindow(SDL_Renderer *renderer, float window_dx, float window_dy, float *dx, float *dy)
{ {
// Convert from window coordinates to pixels within the window // Convert from window coordinates to pixels within the window
@@ -5136,8 +5048,6 @@ bool SDL_RenderPresent(SDL_Renderer *renderer)
SDL_SetRenderTarget(renderer, NULL); SDL_SetRenderTarget(renderer, NULL);
} }
SDL_RenderLogicalPresentation(renderer);
if (renderer->transparent_window) { if (renderer->transparent_window) {
SDL_RenderApplyWindowShape(renderer); SDL_RenderApplyWindowShape(renderer);
} }
+2
View File
@@ -620,6 +620,8 @@ static bool InitVertexBuffer(GPU_RenderData *data, Uint32 size)
return false; return false;
} }
data->vertices.buffer_size = size;
return true; return true;
} }
+48 -37
View File
@@ -439,6 +439,40 @@ static bool convert_format(Uint32 pixel_format, GLint *internalFormat, GLenum *f
return true; return true;
} }
static bool SetTextureScaleMode(GL_RenderData *data, GLenum textype, SDL_ScaleMode scaleMode)
{
switch (scaleMode) {
case SDL_SCALEMODE_NEAREST:
data->glTexParameteri(textype, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
data->glTexParameteri(textype, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
break;
case SDL_SCALEMODE_LINEAR:
data->glTexParameteri(textype, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
data->glTexParameteri(textype, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
break;
default:
return SDL_SetError("Unknown texture scale mode: %d", scaleMode);
}
return true;
}
static bool SetTextureAddressMode(GL_RenderData *data, GLenum textype, SDL_TextureAddressMode addressMode)
{
switch (addressMode) {
case SDL_TEXTURE_ADDRESS_CLAMP:
data->glTexParameteri(textype, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
data->glTexParameteri(textype, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
break;
case SDL_TEXTURE_ADDRESS_WRAP:
data->glTexParameteri(textype, GL_TEXTURE_WRAP_S, GL_REPEAT);
data->glTexParameteri(textype, GL_TEXTURE_WRAP_T, GL_REPEAT);
break;
default:
return SDL_SetError("Unknown texture address mode: %d", addressMode);
}
return true;
}
static bool GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_PropertiesID create_props) static bool GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_PropertiesID create_props)
{ {
GL_RenderData *renderdata = (GL_RenderData *)renderer->internal; GL_RenderData *renderdata = (GL_RenderData *)renderer->internal;
@@ -535,10 +569,12 @@ static bool GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_P
data->format = format; data->format = format;
data->formattype = type; data->formattype = type;
data->texture_scale_mode = SDL_SCALEMODE_INVALID; data->texture_scale_mode = texture->scaleMode;
data->texture_address_mode = SDL_TEXTURE_ADDRESS_INVALID; data->texture_address_mode = SDL_TEXTURE_ADDRESS_CLAMP;
renderdata->glEnable(textype); renderdata->glEnable(textype);
renderdata->glBindTexture(textype, data->texture); renderdata->glBindTexture(textype, data->texture);
SetTextureScaleMode(renderdata, textype, data->texture_scale_mode);
SetTextureAddressMode(renderdata, textype, data->texture_address_mode);
#ifdef SDL_PLATFORM_MACOS #ifdef SDL_PLATFORM_MACOS
#ifndef GL_TEXTURE_STORAGE_HINT_APPLE #ifndef GL_TEXTURE_STORAGE_HINT_APPLE
#define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC #define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC
@@ -570,10 +606,11 @@ static bool GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_P
renderdata->glTexImage2D(textype, 0, internalFormat, texture_w, renderdata->glTexImage2D(textype, 0, internalFormat, texture_w,
texture_h, 0, format, type, NULL); texture_h, 0, format, type, NULL);
} }
renderdata->glDisable(textype);
if (!GL_CheckError("glTexImage2D()", renderer)) { if (!GL_CheckError("glTexImage2D()", renderer)) {
return false; return false;
} }
SetTextureScaleMode(renderdata, textype, data->texture_scale_mode);
SetTextureAddressMode(renderdata, textype, data->texture_address_mode);
#ifdef SDL_HAVE_YUV #ifdef SDL_HAVE_YUV
if (texture->format == SDL_PIXELFORMAT_YV12 || if (texture->format == SDL_PIXELFORMAT_YV12 ||
@@ -596,11 +633,15 @@ static bool GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_P
renderdata->glBindTexture(textype, data->utexture); renderdata->glBindTexture(textype, data->utexture);
renderdata->glTexImage2D(textype, 0, internalFormat, (texture_w + 1) / 2, renderdata->glTexImage2D(textype, 0, internalFormat, (texture_w + 1) / 2,
(texture_h + 1) / 2, 0, format, type, NULL); (texture_h + 1) / 2, 0, format, type, NULL);
SetTextureScaleMode(renderdata, textype, data->texture_scale_mode);
SetTextureAddressMode(renderdata, textype, data->texture_address_mode);
SDL_SetNumberProperty(props, SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER, data->utexture); SDL_SetNumberProperty(props, SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER, data->utexture);
renderdata->glBindTexture(textype, data->vtexture); renderdata->glBindTexture(textype, data->vtexture);
renderdata->glTexImage2D(textype, 0, internalFormat, (texture_w + 1) / 2, renderdata->glTexImage2D(textype, 0, internalFormat, (texture_w + 1) / 2,
(texture_h + 1) / 2, 0, format, type, NULL); (texture_h + 1) / 2, 0, format, type, NULL);
SetTextureScaleMode(renderdata, textype, data->texture_scale_mode);
SetTextureAddressMode(renderdata, textype, data->texture_address_mode);
SDL_SetNumberProperty(props, SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER, data->vtexture); SDL_SetNumberProperty(props, SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER, data->vtexture);
} }
@@ -617,6 +658,8 @@ static bool GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_P
renderdata->glBindTexture(textype, data->utexture); renderdata->glBindTexture(textype, data->utexture);
renderdata->glTexImage2D(textype, 0, GL_LUMINANCE_ALPHA, (texture_w + 1) / 2, renderdata->glTexImage2D(textype, 0, GL_LUMINANCE_ALPHA, (texture_w + 1) / 2,
(texture_h + 1) / 2, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, NULL); (texture_h + 1) / 2, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, NULL);
SetTextureScaleMode(renderdata, textype, data->texture_scale_mode);
SetTextureAddressMode(renderdata, textype, data->texture_address_mode);
SDL_SetNumberProperty(props, SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER, data->utexture); SDL_SetNumberProperty(props, SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER, data->utexture);
} }
#endif #endif
@@ -651,6 +694,8 @@ static bool GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_P
} }
#endif // SDL_HAVE_YUV #endif // SDL_HAVE_YUV
renderdata->glDisable(textype);
return GL_CheckError("", renderer); return GL_CheckError("", renderer);
} }
@@ -1074,40 +1119,6 @@ static bool SetDrawState(GL_RenderData *data, const SDL_RenderCommand *cmd, cons
return true; return true;
} }
static bool SetTextureScaleMode(GL_RenderData *data, GLenum textype, SDL_ScaleMode scaleMode)
{
switch (scaleMode) {
case SDL_SCALEMODE_NEAREST:
data->glTexParameteri(textype, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
data->glTexParameteri(textype, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
break;
case SDL_SCALEMODE_LINEAR:
data->glTexParameteri(textype, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
data->glTexParameteri(textype, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
break;
default:
return SDL_SetError("Unknown texture scale mode: %d", scaleMode);
}
return true;
}
static bool SetTextureAddressMode(GL_RenderData *data, GLenum textype, SDL_TextureAddressMode addressMode)
{
switch (addressMode) {
case SDL_TEXTURE_ADDRESS_CLAMP:
data->glTexParameteri(textype, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
data->glTexParameteri(textype, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
break;
case SDL_TEXTURE_ADDRESS_WRAP:
data->glTexParameteri(textype, GL_TEXTURE_WRAP_S, GL_REPEAT);
data->glTexParameteri(textype, GL_TEXTURE_WRAP_T, GL_REPEAT);
break;
default:
return SDL_SetError("Unknown texture address mode: %d", addressMode);
}
return true;
}
static bool SetCopyState(GL_RenderData *data, const SDL_RenderCommand *cmd) static bool SetCopyState(GL_RenderData *data, const SDL_RenderCommand *cmd)
{ {
SDL_Texture *texture = cmd->data.draw.texture; SDL_Texture *texture = cmd->data.draw.texture;
+15 -2
View File
@@ -1616,8 +1616,8 @@ static bool GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SD
data->texture_u = 0; data->texture_u = 0;
data->texture_v = 0; data->texture_v = 0;
#endif #endif
data->texture_scale_mode = SDL_SCALEMODE_INVALID; data->texture_scale_mode = texture->scaleMode;
data->texture_address_mode = SDL_TEXTURE_ADDRESS_INVALID; data->texture_address_mode = SDL_TEXTURE_ADDRESS_CLAMP;
// Allocate a blob for image renderdata // Allocate a blob for image renderdata
if (texture->access == SDL_TEXTUREACCESS_STREAMING) { if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
@@ -1659,6 +1659,13 @@ static bool GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SD
renderdata->glActiveTexture(GL_TEXTURE2); renderdata->glActiveTexture(GL_TEXTURE2);
renderdata->glBindTexture(data->texture_type, data->texture_v); renderdata->glBindTexture(data->texture_type, data->texture_v);
renderdata->glTexImage2D(data->texture_type, 0, format, (texture->w + 1) / 2, (texture->h + 1) / 2, 0, format, type, NULL); renderdata->glTexImage2D(data->texture_type, 0, format, (texture->w + 1) / 2, (texture->h + 1) / 2, 0, format, type, NULL);
if (!GL_CheckError("glTexImage2D()", renderer)) {
SDL_free(data->pixel_data);
SDL_free(data);
return false;
}
SetTextureScaleMode(renderdata, data->texture_type, data->texture_scale_mode);
SetTextureAddressMode(renderdata, data->texture_type, data->texture_address_mode);
SDL_SetNumberProperty(SDL_GetTextureProperties(texture), SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER, data->texture_v); SDL_SetNumberProperty(SDL_GetTextureProperties(texture), SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER, data->texture_v);
data->texture_u = (GLuint)SDL_GetNumberProperty(create_props, SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER, 0); data->texture_u = (GLuint)SDL_GetNumberProperty(create_props, SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER, 0);
@@ -1680,6 +1687,8 @@ static bool GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SD
SDL_free(data); SDL_free(data);
return false; return false;
} }
SetTextureScaleMode(renderdata, data->texture_type, data->texture_scale_mode);
SetTextureAddressMode(renderdata, data->texture_type, data->texture_address_mode);
SDL_SetNumberProperty(SDL_GetTextureProperties(texture), SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER, data->texture_u); SDL_SetNumberProperty(SDL_GetTextureProperties(texture), SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER, data->texture_u);
if (!SDL_GetYCbCRtoRGBConversionMatrix(texture->colorspace, texture->w, texture->h, 8)) { if (!SDL_GetYCbCRtoRGBConversionMatrix(texture->colorspace, texture->w, texture->h, 8)) {
@@ -1707,6 +1716,8 @@ static bool GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SD
SDL_free(data); SDL_free(data);
return false; return false;
} }
SetTextureScaleMode(renderdata, data->texture_type, data->texture_scale_mode);
SetTextureAddressMode(renderdata, data->texture_type, data->texture_address_mode);
SDL_SetNumberProperty(SDL_GetTextureProperties(texture), SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER, data->texture_u); SDL_SetNumberProperty(SDL_GetTextureProperties(texture), SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER, data->texture_u);
if (!SDL_GetYCbCRtoRGBConversionMatrix(texture->colorspace, texture->w, texture->h, 8)) { if (!SDL_GetYCbCRtoRGBConversionMatrix(texture->colorspace, texture->w, texture->h, 8)) {
@@ -1737,6 +1748,8 @@ static bool GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SD
return false; return false;
} }
} }
SetTextureScaleMode(renderdata, data->texture_type, data->texture_scale_mode);
SetTextureAddressMode(renderdata, data->texture_type, data->texture_address_mode);
SDL_SetNumberProperty(SDL_GetTextureProperties(texture), SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER, data->texture); SDL_SetNumberProperty(SDL_GetTextureProperties(texture), SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER, data->texture);
SDL_SetNumberProperty(SDL_GetTextureProperties(texture), SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER, data->texture_type); SDL_SetNumberProperty(SDL_GetTextureProperties(texture), SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER, data->texture_type);
+23 -10
View File
@@ -421,7 +421,7 @@ static int VULKAN_VkFormatGetNumPlanes(VkFormat vkFormat)
} }
} }
static VkDeviceSize VULKAN_GetBytesPerPixel(VkFormat vkFormat) static VkDeviceSize VULKAN_GetBytesPerPixel(VkFormat vkFormat, int plane)
{ {
switch (vkFormat) { switch (vkFormat) {
case VK_FORMAT_R8_UNORM: case VK_FORMAT_R8_UNORM:
@@ -436,6 +436,10 @@ static VkDeviceSize VULKAN_GetBytesPerPixel(VkFormat vkFormat)
return 4; return 4;
case VK_FORMAT_R16G16B16A16_SFLOAT: case VK_FORMAT_R16G16B16A16_SFLOAT:
return 8; return 8;
case VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM:
return 1;
case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM:
return (plane == 0) ? 1 : 2;
default: default:
return 4; return 4;
} }
@@ -2738,7 +2742,7 @@ static bool VULKAN_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, S
} }
SDL_PropertiesID props = SDL_GetTextureProperties(texture); SDL_PropertiesID props = SDL_GetTextureProperties(texture);
SDL_SetNumberProperty(props, SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER, (Sint64)textureData->mainImage.image); SDL_SetNumberProperty(props, SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER, (Sint64)textureData->mainImage.image);
if (texture->access == SDL_TEXTUREACCESS_TARGET) { if (texture->access == SDL_TEXTUREACCESS_TARGET) {
result = VULKAN_CreateFramebuffersAndRenderPasses(renderer, result = VULKAN_CreateFramebuffersAndRenderPasses(renderer,
@@ -2811,7 +2815,7 @@ static void VULKAN_DestroyTexture(SDL_Renderer *renderer,
static bool VULKAN_UpdateTextureInternal(VULKAN_RenderData *rendererData, VkImage image, VkFormat format, int plane, int x, int y, int w, int h, const void *pixels, int pitch, VkImageLayout *imageLayout) static bool VULKAN_UpdateTextureInternal(VULKAN_RenderData *rendererData, VkImage image, VkFormat format, int plane, int x, int y, int w, int h, const void *pixels, int pitch, VkImageLayout *imageLayout)
{ {
VkDeviceSize pixelSize = VULKAN_GetBytesPerPixel(format); VkDeviceSize pixelSize = VULKAN_GetBytesPerPixel(format, plane);
VkDeviceSize length = w * pixelSize; VkDeviceSize length = w * pixelSize;
VkDeviceSize uploadBufferSize = length * h; VkDeviceSize uploadBufferSize = length * h;
const Uint8 *src; const Uint8 *src;
@@ -2964,11 +2968,20 @@ static bool VULKAN_UpdateTextureYUV(SDL_Renderer *renderer, SDL_Texture *texture
if (!VULKAN_UpdateTextureInternal(rendererData, textureData->mainImage.image, textureData->mainImage.format, 0, rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch, &textureData->mainImage.imageLayout)) { if (!VULKAN_UpdateTextureInternal(rendererData, textureData->mainImage.image, textureData->mainImage.format, 0, rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch, &textureData->mainImage.imageLayout)) {
return false; return false;
} }
if (!VULKAN_UpdateTextureInternal(rendererData, textureData->mainImage.image, textureData->mainImage.format, 1, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Uplane, Upitch, &textureData->mainImage.imageLayout)) { if (texture->format == SDL_PIXELFORMAT_YV12) {
return false; if (!VULKAN_UpdateTextureInternal(rendererData, textureData->mainImage.image, textureData->mainImage.format, 1, rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, Vplane, Vpitch, &textureData->mainImage.imageLayout)) {
} return false;
if (!VULKAN_UpdateTextureInternal(rendererData, textureData->mainImage.image, textureData->mainImage.format, 2, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Vplane, Vpitch, &textureData->mainImage.imageLayout)) { }
return false; if (!VULKAN_UpdateTextureInternal(rendererData, textureData->mainImage.image, textureData->mainImage.format, 2, rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, Uplane, Upitch, &textureData->mainImage.imageLayout)) {
return false;
}
} else {
if (!VULKAN_UpdateTextureInternal(rendererData, textureData->mainImage.image, textureData->mainImage.format, 1, rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, Uplane, Upitch, &textureData->mainImage.imageLayout)) {
return false;
}
if (!VULKAN_UpdateTextureInternal(rendererData, textureData->mainImage.image, textureData->mainImage.format, 2, rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, Vplane, Vpitch, &textureData->mainImage.imageLayout)) {
return false;
}
} }
return true; return true;
} }
@@ -3010,7 +3023,7 @@ static bool VULKAN_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
return SDL_SetError("texture is already locked"); return SDL_SetError("texture is already locked");
} }
VkDeviceSize pixelSize = VULKAN_GetBytesPerPixel(textureData->mainImage.format); VkDeviceSize pixelSize = VULKAN_GetBytesPerPixel(textureData->mainImage.format, 0);
VkDeviceSize length = rect->w * pixelSize; VkDeviceSize length = rect->w * pixelSize;
VkDeviceSize stagingBufferSize = length * rect->h; VkDeviceSize stagingBufferSize = length * rect->h;
rc = VULKAN_AllocateBuffer(rendererData, rc = VULKAN_AllocateBuffer(rendererData,
@@ -3999,7 +4012,7 @@ static SDL_Surface* VULKAN_RenderReadPixels(SDL_Renderer *renderer, const SDL_Re
vkFormat = rendererData->surfaceFormat.format; vkFormat = rendererData->surfaceFormat.format;
} }
pixelSize = VULKAN_GetBytesPerPixel(vkFormat); pixelSize = VULKAN_GetBytesPerPixel(vkFormat, 0);
length = rect->w * pixelSize; length = rect->w * pixelSize;
readbackBufferSize = length * rect->h; readbackBufferSize = length * rect->h;
if (VULKAN_AllocateBuffer(rendererData, readbackBufferSize, if (VULKAN_AllocateBuffer(rendererData, readbackBufferSize,
+3 -4
View File
@@ -333,7 +333,7 @@ void SDL_RunThread(SDL_Thread *thread)
// Mark us as ready to be joined (or detached) // Mark us as ready to be joined (or detached)
if (!SDL_CompareAndSwapAtomicInt(&thread->state, SDL_THREAD_ALIVE, SDL_THREAD_COMPLETE)) { if (!SDL_CompareAndSwapAtomicInt(&thread->state, SDL_THREAD_ALIVE, SDL_THREAD_COMPLETE)) {
// Clean up if something already detached us. // Clean up if something already detached us.
if (SDL_GetThreadState(thread) == SDL_THREAD_DETACHED) { if (SDL_GetAtomicInt(&thread->state) == SDL_THREAD_DETACHED) {
SDL_free(thread->name); // Can't free later, we've already cleaned up TLS SDL_free(thread->name); // Can't free later, we've already cleaned up TLS
SDL_free(thread); SDL_free(thread);
} }
@@ -487,11 +487,10 @@ void SDL_DetachThread(SDL_Thread *thread)
return; return;
} }
// The thread may vanish at any time, it's no longer valid
SDL_SetObjectValid(thread, SDL_OBJECT_TYPE_THREAD, false);
// Grab dibs if the state is alive+joinable. // Grab dibs if the state is alive+joinable.
if (SDL_CompareAndSwapAtomicInt(&thread->state, SDL_THREAD_ALIVE, SDL_THREAD_DETACHED)) { if (SDL_CompareAndSwapAtomicInt(&thread->state, SDL_THREAD_ALIVE, SDL_THREAD_DETACHED)) {
// The thread may vanish at any time, it's no longer valid
SDL_SetObjectValid(thread, SDL_OBJECT_TYPE_THREAD, false);
SDL_SYS_DetachThread(thread); SDL_SYS_DetachThread(thread);
} else { } else {
// all other states are pretty final, see where we landed. // all other states are pretty final, see where we landed.
+4 -2
View File
@@ -1434,6 +1434,7 @@ bool SDL_RLESurface(SDL_Surface *surface)
// The surface is now accelerated // The surface is now accelerated
surface->internal_flags |= SDL_INTERNAL_SURFACE_RLEACCEL; surface->internal_flags |= SDL_INTERNAL_SURFACE_RLEACCEL;
SDL_UpdateSurfaceLockFlag(surface);
return true; return true;
} }
@@ -1565,11 +1566,12 @@ void SDL_UnRLESurface(SDL_Surface *surface, bool recode)
} }
} }
} }
surface->map.info.flags &= surface->map.info.flags &= ~(SDL_COPY_RLE_COLORKEY | SDL_COPY_RLE_ALPHAKEY);
~(SDL_COPY_RLE_COLORKEY | SDL_COPY_RLE_ALPHAKEY);
SDL_free(surface->map.data); SDL_free(surface->map.data);
surface->map.data = NULL; surface->map.data = NULL;
SDL_UpdateSurfaceLockFlag(surface);
} }
} }
+1 -1
View File
@@ -191,7 +191,7 @@ bool SDL_CalculateBlit(SDL_Surface *surface, SDL_Surface *dst)
#ifdef SDL_HAVE_RLE #ifdef SDL_HAVE_RLE
// Clean everything out to start // Clean everything out to start
if (surface->flags & SDL_INTERNAL_SURFACE_RLEACCEL) { if (surface->internal_flags & SDL_INTERNAL_SURFACE_RLEACCEL) {
SDL_UnRLESurface(surface, true); SDL_UnRLESurface(surface, true);
} }
#endif #endif
+2 -1
View File
@@ -1078,7 +1078,8 @@ SDL_GLContext SDL_EGL_CreateContext(SDL_VideoDevice *_this, EGLSurface egl_surfa
return NULL; return NULL;
} }
_this->egl_data->egl_swapinterval = 0; // The default swap interval is 1, according to the spec
_this->egl_data->egl_swapinterval = 1;
if (!SDL_EGL_MakeCurrent(_this, egl_surface, (SDL_GLContext)egl_context)) { if (!SDL_EGL_MakeCurrent(_this, egl_surface, (SDL_GLContext)egl_context)) {
// Delete the context // Delete the context
+2 -2
View File
@@ -49,7 +49,7 @@ bool SDL_SurfaceValid(SDL_Surface *surface)
void SDL_UpdateSurfaceLockFlag(SDL_Surface *surface) void SDL_UpdateSurfaceLockFlag(SDL_Surface *surface)
{ {
if (SDL_SurfaceHasRLE(surface)) { if (surface->internal_flags & SDL_INTERNAL_SURFACE_RLEACCEL) {
surface->flags |= SDL_SURFACE_LOCK_NEEDED; surface->flags |= SDL_SURFACE_LOCK_NEEDED;
} else { } else {
surface->flags &= ~SDL_SURFACE_LOCK_NEEDED; surface->flags &= ~SDL_SURFACE_LOCK_NEEDED;
@@ -611,7 +611,6 @@ bool SDL_SetSurfaceRLE(SDL_Surface *surface, bool enabled)
if (surface->map.info.flags != flags) { if (surface->map.info.flags != flags) {
SDL_InvalidateMap(&surface->map); SDL_InvalidateMap(&surface->map);
} }
SDL_UpdateSurfaceLockFlag(surface);
return true; return true;
} }
@@ -1751,6 +1750,7 @@ bool SDL_LockSurface(SDL_Surface *surface)
if (surface->internal_flags & SDL_INTERNAL_SURFACE_RLEACCEL) { if (surface->internal_flags & SDL_INTERNAL_SURFACE_RLEACCEL) {
SDL_UnRLESurface(surface, true); SDL_UnRLESurface(surface, true);
surface->internal_flags |= SDL_INTERNAL_SURFACE_RLEACCEL; // save accel'd state surface->internal_flags |= SDL_INTERNAL_SURFACE_RLEACCEL; // save accel'd state
SDL_UpdateSurfaceLockFlag(surface);
} }
#endif #endif
} }
+7 -1
View File
@@ -2924,8 +2924,14 @@ bool SDL_GetWindowPosition(SDL_Window *window, int *x, int *y)
{ {
CHECK_WINDOW_MAGIC(window, false); CHECK_WINDOW_MAGIC(window, false);
#ifdef SDL_PLATFORM_MACOS
// On newer MacBooks, the fullscreen window might be placed below the camera notch, so use the actual window position
bool use_display_origin = false;
#else
// Fullscreen windows are always at their display's origin // Fullscreen windows are always at their display's origin
if (window->flags & SDL_WINDOW_FULLSCREEN) { bool use_display_origin = ((window->flags & SDL_WINDOW_FULLSCREEN) != 0);
#endif
if (use_display_origin) {
SDL_DisplayID displayID; SDL_DisplayID displayID;
if (x) { if (x) {
+13 -12
View File
@@ -44,19 +44,20 @@
{ {
static NSCursor *invisibleCursor = NULL; static NSCursor *invisibleCursor = NULL;
if (!invisibleCursor) { if (!invisibleCursor) {
// RAW 16x16 transparent GIF const int size = 32;
static unsigned char cursorBytes[] = { NSImage *cursorImage = [[NSImage alloc] initWithSize:NSMakeSize(size, size)];
0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x10, 0x00, 0x10, 0x00, 0x80, NSBitmapImageRep *imgrep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0xF9, 0x04, pixelsWide:size
0x01, 0x00, 0x00, 0x01, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x10, pixelsHigh:size
0x00, 0x10, 0x00, 0x00, 0x02, 0x0E, 0x8C, 0x8F, 0xA9, 0xCB, 0xED, bitsPerSample:8
0x0F, 0xA3, 0x9C, 0xB4, 0xDA, 0x8B, 0xB3, 0x3E, 0x05, 0x00, 0x3B samplesPerPixel:4
}; hasAlpha:YES
isPlanar:NO
colorSpaceName:NSDeviceRGBColorSpace
bytesPerRow:(size * 4)
bitsPerPixel:32];
[cursorImage addRepresentation:imgrep];
NSData *cursorData = [NSData dataWithBytesNoCopy:&cursorBytes[0]
length:sizeof(cursorBytes)
freeWhenDone:NO];
NSImage *cursorImage = [[NSImage alloc] initWithData:cursorData];
invisibleCursor = [[NSCursor alloc] initWithImage:cursorImage invisibleCursor = [[NSCursor alloc] initWithImage:cursorImage
hotSpot:NSZeroPoint]; hotSpot:NSZeroPoint];
} }
-37
View File
@@ -1,37 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "SDL_internal.h"
#ifdef SDL_VIDEO_DRIVER_PSP
#include <stdio.h>
#include "../../events/SDL_events_c.h"
#include "SDL_pspmouse_c.h"
// The implementation dependent data for the window manager cursor
struct WMcursor
{
int unused;
};
#endif // SDL_VIDEO_DRIVER_PSP
-24
View File
@@ -1,24 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "SDL_pspvideo.h"
// Functions to be exported
+4 -3
View File
@@ -971,8 +971,6 @@ void Wayland_RecreateCursors(void)
void Wayland_InitMouse(void) void Wayland_InitMouse(void)
{ {
SDL_Mouse *mouse = SDL_GetMouse(); SDL_Mouse *mouse = SDL_GetMouse();
SDL_VideoDevice *vd = SDL_GetVideoDevice();
SDL_VideoData *d = vd->internal;
mouse->CreateCursor = Wayland_CreateCursor; mouse->CreateCursor = Wayland_CreateCursor;
mouse->CreateSystemCursor = Wayland_CreateSystemCursor; mouse->CreateSystemCursor = Wayland_CreateSystemCursor;
@@ -1021,7 +1019,10 @@ void Wayland_InitMouse(void)
} }
#ifdef SDL_USE_LIBDBUS #ifdef SDL_USE_LIBDBUS
/* The DBus cursor properties are only needed when manually loading themes and cursors. SDL_VideoDevice *vd = SDL_GetVideoDevice();
SDL_VideoData *d = vd->internal;
/* The D-Bus cursor properties are only needed when manually loading themes and system cursors.
* If the cursor shape protocol is present, the compositor will handle it internally. * If the cursor shape protocol is present, the compositor will handle it internally.
*/ */
if (!d->cursor_shape_manager) { if (!d->cursor_shape_manager) {
+7 -2
View File
@@ -1295,8 +1295,13 @@ static void decoration_frame_configure(struct libdecor_frame *frame,
} else { } else {
/* Don't apply the supplied dimensions if they haven't changed from the last configuration /* Don't apply the supplied dimensions if they haven't changed from the last configuration
* event, or a newer size set programmatically can be overwritten by old data. * event, or a newer size set programmatically can be overwritten by old data.
*
* If a client takes a long time to present the first frame after creating the window, a
* configure event to set the suspended state may arrive with the content size increased
* by the decoration dimensions, which should also be ignored.
*/ */
if (width != wind->last_configure.width || height != wind->last_configure.height) { if ((width != wind->last_configure.width || height != wind->last_configure.height) &&
!(wind->shell_surface_status == WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_FRAME && wind->suspended != suspended)) {
wind->requested.logical_width = width; wind->requested.logical_width = width;
wind->requested.logical_height = height; wind->requested.logical_height = height;
@@ -1895,7 +1900,7 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
// Set up the positioner for the popup and configure the constraints // Set up the positioner for the popup and configure the constraints
data->shell_surface.xdg.popup.xdg_positioner = xdg_wm_base_create_positioner(c->shell.xdg); data->shell_surface.xdg.popup.xdg_positioner = xdg_wm_base_create_positioner(c->shell.xdg);
xdg_positioner_set_anchor(data->shell_surface.xdg.popup.xdg_positioner, XDG_POSITIONER_ANCHOR_TOP_LEFT); xdg_positioner_set_anchor(data->shell_surface.xdg.popup.xdg_positioner, XDG_POSITIONER_ANCHOR_TOP_LEFT);
xdg_positioner_set_anchor_rect(data->shell_surface.xdg.popup.xdg_positioner, 0, 0, parent->internal->current.logical_width, parent->internal->current.logical_width); xdg_positioner_set_anchor_rect(data->shell_surface.xdg.popup.xdg_positioner, 0, 0, parent->internal->current.logical_width, parent->internal->current.logical_height);
const Uint32 constraint = window->constrain_popup ? (XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_X | XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_Y) : XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_NONE; const Uint32 constraint = window->constrain_popup ? (XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_X | XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_Y) : XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_NONE;
xdg_positioner_set_constraint_adjustment(data->shell_surface.xdg.popup.xdg_positioner, constraint); xdg_positioner_set_constraint_adjustment(data->shell_surface.xdg.popup.xdg_positioner, constraint);
+4 -1
View File
@@ -443,7 +443,10 @@ error:
static bool WIN_ShowCursor(SDL_Cursor *cursor) static bool WIN_ShowCursor(SDL_Cursor *cursor)
{ {
if (!cursor) { if (!cursor) {
cursor = SDL_blank_cursor; if (GetSystemMetrics(SM_REMOTESESSION)) {
// Use a blank cursor so we continue to get relative motion over RDP
cursor = SDL_blank_cursor;
}
} }
if (cursor) { if (cursor) {
if (cursor->internal->surface) { if (cursor->internal->surface) {
+2
View File
@@ -747,8 +747,10 @@ bool WIN_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Properties
return false; return false;
} }
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
// Ensure that the IME isn't active on the new window until explicitly requested. // Ensure that the IME isn't active on the new window until explicitly requested.
WIN_StopTextInput(_this, window); WIN_StopTextInput(_this, window);
#endif
// Inform Windows of the frame change so we can respond to WM_NCCALCSIZE // Inform Windows of the frame change so we can respond to WM_NCCALCSIZE
SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE); SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE);
+1 -1
View File
@@ -1514,7 +1514,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
* expected by SDL and its clients. Defer emitting the size/move events until the corresponding * expected by SDL and its clients. Defer emitting the size/move events until the corresponding
* PropertyNotify arrives for consistency. * PropertyNotify arrives for consistency.
*/ */
const Uint32 changed = X11_GetNetWMState(_this, data->window, xevent->xproperty.window) ^ data->window->flags; const SDL_WindowFlags changed = X11_GetNetWMState(_this, data->window, xevent->xproperty.window) ^ data->window->flags;
if (changed & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_MAXIMIZED)) { if (changed & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_MAXIMIZED)) {
SDL_copyp(&data->pending_xconfigure, &xevent->xconfigure); SDL_copyp(&data->pending_xconfigure, &xevent->xconfigure);
data->emit_size_move_after_property_notify = true; data->emit_size_move_after_property_notify = true;
+1 -1
View File
@@ -33,7 +33,7 @@ static int shm_error;
static int (*X_handler)(Display *, XErrorEvent *) = NULL; static int (*X_handler)(Display *, XErrorEvent *) = NULL;
static int shm_errhandler(Display *d, XErrorEvent *e) static int shm_errhandler(Display *d, XErrorEvent *e)
{ {
if (e->error_code == BadAccess) { if (e->error_code == BadAccess || e->error_code == BadRequest) {
shm_error = True; shm_error = True;
return 0; return 0;
} }
+8 -3
View File
@@ -283,7 +283,7 @@ static void X11_SetKeyboardFocus(SDL_Window *window, bool set_active_focus)
} }
} }
Uint32 X11_GetNetWMState(SDL_VideoDevice *_this, SDL_Window *window, Window xwindow) SDL_WindowFlags X11_GetNetWMState(SDL_VideoDevice *_this, SDL_Window *window, Window xwindow)
{ {
SDL_VideoData *videodata = _this->internal; SDL_VideoData *videodata = _this->internal;
Display *display = videodata->display; Display *display = videodata->display;
@@ -1226,8 +1226,13 @@ void X11_SetWindowMinMax(SDL_Window *window, bool use_current)
} else { } else {
// Set the min/max to the same values to make the window non-resizable // Set the min/max to the same values to make the window non-resizable
sizehints->flags |= PMinSize | PMaxSize; sizehints->flags |= PMinSize | PMaxSize;
sizehints->min_width = sizehints->max_width = use_current ? data->window->floating.w : window->windowed.w; if (use_current) {
sizehints->min_height = sizehints->max_height = use_current ? data->window->floating.h : window->windowed.h; sizehints->min_width = sizehints->max_width = window->last_size_pending ? window->pending.w : data->window->floating.w;
sizehints->min_height = sizehints->max_height = window->last_size_pending ? window->pending.h : data->window->floating.h;
} else {
sizehints->min_width = sizehints->max_width = window->last_size_pending ? window->pending.w : data->window->windowed.w;
sizehints->min_height = sizehints->max_height = window->last_size_pending ? window->pending.h : data->window->windowed.h;
}
} }
X11_XSetWMNormalHints(display, data->xwindow, sizehints); X11_XSetWMNormalHints(display, data->xwindow, sizehints);
+1 -1
View File
@@ -128,7 +128,7 @@ struct SDL_WindowData
}; };
extern void X11_SetNetWMState(SDL_VideoDevice *_this, Window xwindow, SDL_WindowFlags flags); extern void X11_SetNetWMState(SDL_VideoDevice *_this, Window xwindow, SDL_WindowFlags flags);
extern Uint32 X11_GetNetWMState(SDL_VideoDevice *_this, SDL_Window *window, Window xwindow); extern SDL_WindowFlags X11_GetNetWMState(SDL_VideoDevice *_this, SDL_Window *window, Window xwindow);
extern bool X11_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props); extern bool X11_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props);
extern char *X11_GetWindowTitle(SDL_VideoDevice *_this, Window xwindow); extern char *X11_GetWindowTitle(SDL_VideoDevice *_this, Window xwindow);
+1 -1
View File
@@ -179,7 +179,7 @@ perspective_matrix(float fovy, float aspect, float znear, float zfar, float *r)
int i; int i;
float f; float f;
f = 1.0f / SDL_tanf(fovy * 0.5f); f = 1.0f / SDL_tanf((fovy / 180.0f) * SDL_PI_F * 0.5f);
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
r[i] = 0.0; r[i] = 0.0;
+1 -1
View File
@@ -133,7 +133,7 @@ perspective_matrix(float fovy, float aspect, float znear, float zfar, float *r)
int i; int i;
float f; float f;
f = 1.0f/SDL_tanf(fovy * 0.5f); f = 1.0f/SDL_tanf((fovy / 180.0f) * SDL_PI_F * 0.5f);
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
r[i] = 0.0; r[i] = 0.0;
+5 -2
View File
@@ -367,8 +367,11 @@ static int SDLCALL process_testKill(void *arg)
result = SDL_WaitProcess(process, false, &exit_code); result = SDL_WaitProcess(process, false, &exit_code);
SDLTest_AssertCheck(result == false, "Process should not have exited yet"); SDLTest_AssertCheck(result == false, "Process should not have exited yet");
SDLTest_AssertPass("About to call SDL_KillProcess(false)"); /* Wait for the child process to finish initializing */
result = SDL_KillProcess(process, false); SDL_Delay(500);
SDLTest_AssertPass("About to call SDL_KillProcess(true)");
result = SDL_KillProcess(process, true);
SDLTest_AssertCheck(result == true, "Process should have exited"); SDLTest_AssertCheck(result == true, "Process should have exited");
exit_code = 0; exit_code = 0;