From 825ccc9359b8f95c572755577473829f88ebf409 Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Thu, 7 Mar 2024 17:46:37 +0000 Subject: [PATCH] SDL2: Update to 2.30.1. --- SDL2/CMakeLists.txt | 2 +- SDL2/Makefile.os2 | 2 +- SDL2/Makefile.w32 | 2 +- SDL2/SDL2.spec | 2 +- SDL2/VERSION.txt | 2 +- SDL2/Xcode/SDL/Info-Framework.plist | 4 +- SDL2/Xcode/SDL/SDL.xcodeproj/project.pbxproj | 12 +-- SDL2/Xcode/SDL/pkg-support/SDL.info | 2 +- .../main/java/org/libsdl/app/SDLActivity.java | 2 +- SDL2/configure | 2 +- SDL2/configure.ac | 2 +- SDL2/include/SDL_revision.h | 4 +- SDL2/include/SDL_version.h | 2 +- SDL2/src/SDL_internal.h | 80 ++++++++++++++++ SDL2/src/audio/SDL_audiotypecvt.c | 4 +- SDL2/src/core/windows/SDL_windows.h | 12 +-- SDL2/src/core/windows/SDL_xinput.h | 6 +- SDL2/src/core/winrt/SDL_winrtapp_direct3d.cpp | 4 +- SDL2/src/joystick/SDL_gamecontroller.c | 14 +-- SDL2/src/joystick/SDL_gamecontrollerdb.h | 1 + SDL2/src/joystick/SDL_joystick.c | 1 + SDL2/src/joystick/SDL_steam_virtual_gamepad.c | 1 + SDL2/src/joystick/iphoneos/SDL_mfijoystick.m | 34 +++++-- .../src/joystick/iphoneos/SDL_mfijoystick_c.h | 7 +- .../src/joystick/windows/SDL_xinputjoystick.c | 4 +- SDL2/src/main/windows/version.rc | 8 +- SDL2/src/render/SDL_d3dmath.c | 4 +- SDL2/src/render/SDL_d3dmath.h | 4 +- SDL2/src/render/SDL_render.c | 42 ++++++--- SDL2/src/render/direct3d/SDL_render_d3d.c | 11 ++- SDL2/src/render/direct3d/SDL_shaders_d3d.c | 4 +- SDL2/src/render/direct3d11/SDL_render_d3d11.c | 9 +- .../render/direct3d11/SDL_render_winrt.cpp | 4 +- SDL2/src/render/direct3d11/SDL_render_winrt.h | 4 +- .../src/render/direct3d11/SDL_shaders_d3d11.c | 4 +- SDL2/src/render/direct3d12/SDL_render_d3d12.c | 9 +- .../direct3d12/SDL_render_d3d12_xbox.cpp | 2 +- .../src/render/direct3d12/SDL_shaders_d3d12.c | 4 +- .../direct3d12/SDL_shaders_d3d12_xboxone.cpp | 4 +- .../SDL_shaders_d3d12_xboxseries.cpp | 4 +- SDL2/src/render/metal/SDL_render_metal.m | 4 +- SDL2/src/render/opengl/SDL_render_gl.c | 5 +- SDL2/src/render/opengl/SDL_shaders_gl.c | 4 +- SDL2/src/render/opengles/SDL_render_gles.c | 4 +- SDL2/src/render/opengles2/SDL_render_gles2.c | 5 +- SDL2/src/render/opengles2/SDL_shaders_gles2.c | 4 +- SDL2/src/render/opengles2/SDL_shaders_gles2.h | 2 +- SDL2/src/render/ps2/SDL_render_ps2.c | 3 +- SDL2/src/render/psp/SDL_render_psp.c | 3 +- SDL2/src/render/software/SDL_blendfillrect.c | 4 +- SDL2/src/render/software/SDL_blendline.c | 4 +- SDL2/src/render/software/SDL_blendpoint.c | 4 +- SDL2/src/render/software/SDL_drawline.c | 4 +- SDL2/src/render/software/SDL_drawpoint.c | 4 +- SDL2/src/render/software/SDL_render_sw.c | 4 +- SDL2/src/render/software/SDL_rotate.c | 4 +- SDL2/src/render/software/SDL_triangle.c | 4 +- SDL2/src/render/vitagxm/SDL_render_vita_gxm.c | 3 +- .../vitagxm/SDL_render_vita_gxm_memory.c | 2 +- .../vitagxm/SDL_render_vita_gxm_tools.c | 2 +- SDL2/src/video/SDL_sysvideo.h | 5 + SDL2/src/video/SDL_video.c | 89 ++++++++++++++++++ SDL2/src/video/android/SDL_androidevents.c | 10 +- SDL2/src/video/android/SDL_androidkeyboard.c | 11 +++ SDL2/src/video/android/SDL_androidkeyboard.h | 1 + .../video/emscripten/SDL_emscriptenmouse.c | 44 +-------- .../video/emscripten/SDL_emscriptenvideo.c | 1 + SDL2/src/video/khronos/vulkan/vulkan_metal.h | 26 ++++-- SDL2/src/video/vita/SDL_vitamessagebox.c | 4 +- SDL2/src/video/wayland/SDL_waylandevents.c | 28 ++++++ SDL2/src/video/wayland/SDL_waylandmouse.c | 85 +++++++++-------- SDL2/src/video/wayland/SDL_waylandvideo.c | 17 +--- SDL2/src/video/wayland/SDL_waylandwindow.c | 7 ++ SDL2/src/video/windows/SDL_windowsevents.c | 5 +- SDL2/src/video/windows/SDL_windowskeyboard.c | 4 +- SDL2/src/video/windows/SDL_windowsopengl.c | 8 +- SDL2/src/video/x11/SDL_x11mouse.c | 93 ++++++++----------- SDL2/src/video/x11/SDL_x11sym.h | 1 + SDL2/test/testautomation_math.c | 16 ++-- SDL2/test/testautomation_surface.c | 2 + 80 files changed, 525 insertions(+), 330 deletions(-) diff --git a/SDL2/CMakeLists.txt b/SDL2/CMakeLists.txt index 7f146a54..0db9cba6 100644 --- a/SDL2/CMakeLists.txt +++ b/SDL2/CMakeLists.txt @@ -87,7 +87,7 @@ endif() # See docs/release_checklist.md set(SDL_MAJOR_VERSION 2) set(SDL_MINOR_VERSION 30) -set(SDL_MICRO_VERSION 0) +set(SDL_MICRO_VERSION 1) set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}") # Set defaults preventing destination file conflicts diff --git a/SDL2/Makefile.os2 b/SDL2/Makefile.os2 index afd5f448..0617137f 100644 --- a/SDL2/Makefile.os2 +++ b/SDL2/Makefile.os2 @@ -15,7 +15,7 @@ LIBNAME = SDL2 MAJOR_VERSION = 2 MINOR_VERSION = 30 -MICRO_VERSION = 0 +MICRO_VERSION = 1 VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) DESCRIPTION = Simple DirectMedia Layer 2 diff --git a/SDL2/Makefile.w32 b/SDL2/Makefile.w32 index bd28c078..6739b6d8 100644 --- a/SDL2/Makefile.w32 +++ b/SDL2/Makefile.w32 @@ -6,7 +6,7 @@ LIBNAME = SDL2 MAJOR_VERSION = 2 MINOR_VERSION = 30 -MICRO_VERSION = 0 +MICRO_VERSION = 1 VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) LIBHOME = . diff --git a/SDL2/SDL2.spec b/SDL2/SDL2.spec index e7be9d64..a1c84eee 100644 --- a/SDL2/SDL2.spec +++ b/SDL2/SDL2.spec @@ -1,6 +1,6 @@ Summary: Simple DirectMedia Layer Name: SDL2 -Version: 2.30.0 +Version: 2.30.1 Release: 2 Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz URL: http://www.libsdl.org/ diff --git a/SDL2/VERSION.txt b/SDL2/VERSION.txt index 4426dd62..4da2e8bb 100644 --- a/SDL2/VERSION.txt +++ b/SDL2/VERSION.txt @@ -1 +1 @@ -release-2.30.0-0-g859844eae +release-2.30.1-0-g5adbf3765 diff --git a/SDL2/Xcode/SDL/Info-Framework.plist b/SDL2/Xcode/SDL/Info-Framework.plist index ca0cfc5d..7700c327 100644 --- a/SDL2/Xcode/SDL/Info-Framework.plist +++ b/SDL2/Xcode/SDL/Info-Framework.plist @@ -19,10 +19,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.30.0 + 2.30.1 CFBundleSignature SDLX CFBundleVersion - 2.30.0 + 2.30.1 diff --git a/SDL2/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/SDL2/Xcode/SDL/SDL.xcodeproj/project.pbxproj index d90b5304..64afe879 100644 --- a/SDL2/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/SDL2/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -9769,7 +9769,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEPLOYMENT_POSTPROCESSING = YES; DYLIB_COMPATIBILITY_VERSION = 3001.0.0; - DYLIB_CURRENT_VERSION = 3001.0.0; + DYLIB_CURRENT_VERSION = 3001.1.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_ALTIVEC_EXTENSIONS = YES; @@ -9810,7 +9810,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_LINK_OBJC_RUNTIME = NO; - MARKETING_VERSION = 2.30.0; + MARKETING_VERSION = 2.30.1; OTHER_LDFLAGS = "-liconv"; }; name = Release; @@ -9854,7 +9854,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; DEBUG_INFORMATION_FORMAT = dwarf; DYLIB_COMPATIBILITY_VERSION = 3001.0.0; - DYLIB_CURRENT_VERSION = 3001.0.0; + DYLIB_CURRENT_VERSION = 3001.1.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -9896,7 +9896,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_LINK_OBJC_RUNTIME = NO; - MARKETING_VERSION = 2.30.0; + MARKETING_VERSION = 2.30.1; OTHER_LDFLAGS = "-liconv"; }; name = Debug; @@ -10103,7 +10103,7 @@ DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 3001.0.0; - DYLIB_CURRENT_VERSION = 3001.0.0; + DYLIB_CURRENT_VERSION = 3001.1.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; @@ -10155,7 +10155,7 @@ DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 3001.0.0; - DYLIB_CURRENT_VERSION = 3001.0.0; + DYLIB_CURRENT_VERSION = 3001.1.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu11; diff --git a/SDL2/Xcode/SDL/pkg-support/SDL.info b/SDL2/Xcode/SDL/pkg-support/SDL.info index e55d3dfe..13f6d9c4 100644 --- a/SDL2/Xcode/SDL/pkg-support/SDL.info +++ b/SDL2/Xcode/SDL/pkg-support/SDL.info @@ -1,4 +1,4 @@ -Title SDL 2.30.0 +Title SDL 2.30.1 Version 1 Description SDL Library for Mac OS X (http://www.libsdl.org) DefaultLocation /Library/Frameworks diff --git a/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index 60d07613..fd5a056e 100644 --- a/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -61,7 +61,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh private static final String TAG = "SDL"; private static final int SDL_MAJOR_VERSION = 2; private static final int SDL_MINOR_VERSION = 30; - private static final int SDL_MICRO_VERSION = 0; + private static final int SDL_MICRO_VERSION = 1; /* // Display InputType.SOURCE/CLASS of events and devices // diff --git a/SDL2/configure b/SDL2/configure index 61b67116..940e034f 100755 --- a/SDL2/configure +++ b/SDL2/configure @@ -3510,7 +3510,7 @@ orig_CFLAGS="$CFLAGS" # See docs/release_checklist.md SDL_MAJOR_VERSION=2 SDL_MINOR_VERSION=30 -SDL_MICRO_VERSION=0 +SDL_MICRO_VERSION=1 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION` diff --git a/SDL2/configure.ac b/SDL2/configure.ac index 56087fb6..9f2097a8 100644 --- a/SDL2/configure.ac +++ b/SDL2/configure.ac @@ -13,7 +13,7 @@ dnl Set various version strings - taken gratefully from the GTk sources # See docs/release_checklist.md SDL_MAJOR_VERSION=2 SDL_MINOR_VERSION=30 -SDL_MICRO_VERSION=0 +SDL_MICRO_VERSION=1 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION` diff --git a/SDL2/include/SDL_revision.h b/SDL2/include/SDL_revision.h index ee42f842..30d7e9b4 100644 --- a/SDL2/include/SDL_revision.h +++ b/SDL2/include/SDL_revision.h @@ -1,7 +1,7 @@ /* Generated by updaterev.sh, do not edit */ #ifdef SDL_VENDOR_INFO -#define SDL_REVISION "SDL-release-2.30.0-0-g859844eae (" SDL_VENDOR_INFO ")" +#define SDL_REVISION "SDL-release-2.30.1-0-g5adbf3765 (" SDL_VENDOR_INFO ")" #else -#define SDL_REVISION "SDL-release-2.30.0-0-g859844eae" +#define SDL_REVISION "SDL-release-2.30.1-0-g5adbf3765" #endif #define SDL_REVISION_NUMBER 0 diff --git a/SDL2/include/SDL_version.h b/SDL2/include/SDL_version.h index 02143ff7..6b66df90 100644 --- a/SDL2/include/SDL_version.h +++ b/SDL2/include/SDL_version.h @@ -59,7 +59,7 @@ typedef struct SDL_version */ #define SDL_MAJOR_VERSION 2 #define SDL_MINOR_VERSION 30 -#define SDL_PATCHLEVEL 0 +#define SDL_PATCHLEVEL 1 /** * Macro to determine SDL version program was compiled against. diff --git a/SDL2/src/SDL_internal.h b/SDL2/src/SDL_internal.h index c2f8b80c..b193edef 100644 --- a/SDL2/src/SDL_internal.h +++ b/SDL2/src/SDL_internal.h @@ -125,6 +125,86 @@ #define SDL_HAVE_YUV !SDL_LEAN_AND_MEAN #endif +#ifndef SDL_RENDER_DISABLED +/* define the not defined ones as 0 */ +#ifndef SDL_VIDEO_RENDER_D3D +#define SDL_VIDEO_RENDER_D3D 0 +#endif +#ifndef SDL_VIDEO_RENDER_D3D11 +#define SDL_VIDEO_RENDER_D3D11 0 +#endif +#ifndef SDL_VIDEO_RENDER_D3D12 +#define SDL_VIDEO_RENDER_D3D12 0 +#endif +#ifndef SDL_VIDEO_RENDER_METAL +#define SDL_VIDEO_RENDER_METAL 0 +#endif +#ifndef SDL_VIDEO_RENDER_OGL +#define SDL_VIDEO_RENDER_OGL 0 +#endif +#ifndef SDL_VIDEO_RENDER_OGL_ES +#define SDL_VIDEO_RENDER_OGL_ES 0 +#endif +#ifndef SDL_VIDEO_RENDER_OGL_ES2 +#define SDL_VIDEO_RENDER_OGL_ES2 0 +#endif +#ifndef SDL_VIDEO_RENDER_DIRECTFB +#define SDL_VIDEO_RENDER_DIRECTFB 0 +#endif +#ifndef SDL_VIDEO_RENDER_PS2 +#define SDL_VIDEO_RENDER_PS2 0 +#endif +#ifndef SDL_VIDEO_RENDER_PSP +#define SDL_VIDEO_RENDER_PSP 0 +#endif +#ifndef SDL_VIDEO_RENDER_VITA_GXM +#define SDL_VIDEO_RENDER_VITA_GXM 0 +#endif +#else /* define all as 0 */ +#undef SDL_VIDEO_RENDER_SW +#define SDL_VIDEO_RENDER_SW 0 +#undef SDL_VIDEO_RENDER_D3D +#define SDL_VIDEO_RENDER_D3D 0 +#undef SDL_VIDEO_RENDER_D3D11 +#define SDL_VIDEO_RENDER_D3D11 0 +#undef SDL_VIDEO_RENDER_D3D12 +#define SDL_VIDEO_RENDER_D3D12 0 +#undef SDL_VIDEO_RENDER_METAL +#define SDL_VIDEO_RENDER_METAL 0 +#undef SDL_VIDEO_RENDER_OGL +#define SDL_VIDEO_RENDER_OGL 0 +#undef SDL_VIDEO_RENDER_OGL_ES +#define SDL_VIDEO_RENDER_OGL_ES 0 +#undef SDL_VIDEO_RENDER_OGL_ES2 +#define SDL_VIDEO_RENDER_OGL_ES2 0 +#undef SDL_VIDEO_RENDER_DIRECTFB +#define SDL_VIDEO_RENDER_DIRECTFB 0 +#undef SDL_VIDEO_RENDER_PS2 +#define SDL_VIDEO_RENDER_PS2 0 +#undef SDL_VIDEO_RENDER_PSP +#define SDL_VIDEO_RENDER_PSP 0 +#undef SDL_VIDEO_RENDER_VITA_GXM +#define SDL_VIDEO_RENDER_VITA_GXM 0 +#endif /* SDL_RENDER_DISABLED */ + +#define SDL_HAS_RENDER_DRIVER \ + (SDL_VIDEO_RENDER_SW | \ + SDL_VIDEO_RENDER_D3D | \ + SDL_VIDEO_RENDER_D3D11 | \ + SDL_VIDEO_RENDER_D3D12 | \ + SDL_VIDEO_RENDER_METAL | \ + SDL_VIDEO_RENDER_OGL | \ + SDL_VIDEO_RENDER_OGL_ES | \ + SDL_VIDEO_RENDER_OGL_ES2 | \ + SDL_VIDEO_RENDER_DIRECTFB | \ + SDL_VIDEO_RENDER_PS2 | \ + SDL_VIDEO_RENDER_PSP | \ + SDL_VIDEO_RENDER_VITA_GXM) + +#if !defined(SDL_RENDER_DISABLED) && !SDL_HAS_RENDER_DRIVER +#error SDL_RENDER enabled without any backend drivers. +#endif + #include "SDL_assert.h" #include "SDL_log.h" diff --git a/SDL2/src/audio/SDL_audiotypecvt.c b/SDL2/src/audio/SDL_audiotypecvt.c index 53c8ffe6..221bfbb8 100644 --- a/SDL2/src/audio/SDL_audiotypecvt.c +++ b/SDL2/src/audio/SDL_audiotypecvt.c @@ -125,7 +125,7 @@ static void SDLCALL SDL_Convert_U8_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFor static void SDLCALL SDL_Convert_S16_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) { - const int num_samples = cvt->len_cvt; + const int num_samples = cvt->len_cvt / sizeof(Sint16); const Sint16 *src = (const Sint16 *)cvt->buf; float *dst = (float *)cvt->buf; int i; @@ -350,7 +350,7 @@ static void SDLCALL SDL_Convert_S8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioForma i -= 16; { - const __m128i bytes = _mm_xor_si128(_mm_loadu_si128((const __m128i *)&src[i-16]), flipper); + const __m128i bytes = _mm_xor_si128(_mm_loadu_si128((const __m128i *)&src[i]), flipper); const __m128i shorts1 = _mm_unpacklo_epi8(bytes, zero); const __m128i shorts2 = _mm_unpackhi_epi8(bytes, zero); diff --git a/SDL2/src/core/windows/SDL_windows.h b/SDL2/src/core/windows/SDL_windows.h index 852fdb00..2bd6257d 100644 --- a/SDL2/src/core/windows/SDL_windows.h +++ b/SDL2/src/core/windows/SDL_windows.h @@ -36,7 +36,7 @@ #endif #undef WINVER #undef _WIN32_WINNT -#if defined(SDL_VIDEO_RENDER_D3D12) +#if SDL_VIDEO_RENDER_D3D12 #define _WIN32_WINNT 0xA00 /* For D3D12, 0xA00 is required */ #elif defined(HAVE_SHELLSCALINGAPI_H) #define _WIN32_WINNT 0x603 /* For DPI support */ @@ -92,16 +92,6 @@ #include #include /* for REFIID with broken mingw.org headers */ -/* Older Visual C++ headers don't have the Win64-compatible typedefs... */ -#if defined(_MSC_VER) && (_MSC_VER <= 1200) -#ifndef DWORD_PTR -#define DWORD_PTR DWORD -#endif -#ifndef LONG_PTR -#define LONG_PTR LONG -#endif -#endif - #include "SDL_rect.h" /* Routines to convert from UTF8 to native Windows text */ diff --git a/SDL2/src/core/windows/SDL_xinput.h b/SDL2/src/core/windows/SDL_xinput.h index 396afcde..efdb8628 100644 --- a/SDL2/src/core/windows/SDL_xinput.h +++ b/SDL2/src/core/windows/SDL_xinput.h @@ -212,7 +212,7 @@ typedef struct #endif /* HAVE_XINPUT_H */ /* This struct is not defined in XInput headers. */ -typedef struct _XINPUT_CAPABILITIES_EX +typedef struct { XINPUT_CAPABILITIES Capabilities; WORD VendorId; @@ -220,7 +220,7 @@ typedef struct _XINPUT_CAPABILITIES_EX WORD ProductVersion; WORD unk1; DWORD unk2; -} XINPUT_CAPABILITIES_EX, *PXINPUT_CAPABILITIES_EX; +} SDL_XINPUT_CAPABILITIES_EX; /* Forward decl's for XInput API's we load dynamically and use if available */ typedef DWORD(WINAPI *XInputGetState_t)( @@ -244,7 +244,7 @@ typedef DWORD(WINAPI *XInputGetCapabilitiesEx_t)( DWORD dwReserved, /* [in] Must be 1 */ DWORD dwUserIndex, /* [in] Index of the gamer associated with the device */ DWORD dwFlags, /* [in] Input flags that identify the device type */ - XINPUT_CAPABILITIES_EX *pCapabilitiesEx /* [out] Receives the capabilities */ + SDL_XINPUT_CAPABILITIES_EX *pCapabilitiesEx /* [out] Receives the capabilities */ ); typedef DWORD(WINAPI *XInputGetBatteryInformation_t)( diff --git a/SDL2/src/core/winrt/SDL_winrtapp_direct3d.cpp b/SDL2/src/core/winrt/SDL_winrtapp_direct3d.cpp index 2cf7b405..0115c5da 100644 --- a/SDL2/src/core/winrt/SDL_winrtapp_direct3d.cpp +++ b/SDL2/src/core/winrt/SDL_winrtapp_direct3d.cpp @@ -58,7 +58,7 @@ extern "C" { #include "SDL_winrtapp_common.h" #include "SDL_winrtapp_direct3d.h" -#if defined(SDL_VIDEO_RENDER_D3D11) && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_D3D11 /* Calling IDXGIDevice3::Trim on the active Direct3D 11.x device is necessary * when Windows 8.1 apps are about to get suspended. */ @@ -622,7 +622,7 @@ void SDL_WinRTApp::OnSuspending(Platform::Object ^ sender, SuspendingEventArgs ^ // Let the Direct3D 11 renderer prepare for the app to be backgrounded. // This is necessary for Windows 8.1, possibly elsewhere in the future. // More details at: http://msdn.microsoft.com/en-us/library/windows/apps/Hh994929.aspx -#if defined(SDL_VIDEO_RENDER_D3D11) && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_D3D11 if (WINRT_GlobalSDLWindow) { SDL_Renderer *renderer = SDL_GetRenderer(WINRT_GlobalSDLWindow); if (renderer && (SDL_strcmp(renderer->info.name, "direct3d11") == 0)) { diff --git a/SDL2/src/joystick/SDL_gamecontroller.c b/SDL2/src/joystick/SDL_gamecontroller.c index bce36ab1..bbb7f799 100644 --- a/SDL2/src/joystick/SDL_gamecontroller.c +++ b/SDL2/src/joystick/SDL_gamecontroller.c @@ -3259,10 +3259,11 @@ const char *SDL_GameControllerGetAppleSFSymbolsNameForButton(SDL_GameController } SDL_UnlockJoysticks(); - return retval; -#else - return NULL; + if (retval && *retval) { + return retval; + } #endif + return NULL; } const char *SDL_GameControllerGetAppleSFSymbolsNameForAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis) @@ -3279,10 +3280,11 @@ const char *SDL_GameControllerGetAppleSFSymbolsNameForAxis(SDL_GameController *g } SDL_UnlockJoysticks(); - return retval; -#else - return NULL; + if (retval && *retval) { + return retval; + } #endif + return NULL; } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/joystick/SDL_gamecontrollerdb.h b/SDL2/src/joystick/SDL_gamecontrollerdb.h index 4f20d03e..9f2ddd09 100644 --- a/SDL2/src/joystick/SDL_gamecontrollerdb.h +++ b/SDL2/src/joystick/SDL_gamecontrollerdb.h @@ -317,6 +317,7 @@ static const char *s_ControllerMappings[] = { "03000000a30600002106000000000000,Saitek PS1000,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,", "03000000a306000020f6000000000000,Saitek PS2700,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,", "03000000300f00001101000000000000,Saitek Rumble Pad,a:b2,b:b3,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,", + "03000000790000000600000000000000,Sanwa Supply JY-P76USV,crc:20f0,+leftx:+a0,+rightx:+a2,+righty:a4,-leftx:-a0,-lefty:-a1,-rightx:-a2,-righty:-a4,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,lefty:+a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b2,y:b3,", "0300000000050000289b000000000000,Saturn_Adapter_2.0,a:b1,b:b2,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b0,y:b3,", "030000009b2800000500000000000000,Saturn_Adapter_2.0,a:b1,b:b2,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b0,y:b3,", "030000008f0e00000800000000000000,SpeedLink Strike FX,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", diff --git a/SDL2/src/joystick/SDL_joystick.c b/SDL2/src/joystick/SDL_joystick.c index b0915afa..1dbef620 100644 --- a/SDL2/src/joystick/SDL_joystick.c +++ b/SDL2/src/joystick/SDL_joystick.c @@ -381,6 +381,7 @@ static Uint32 initial_wheel_devices[] = { MAKE_VIDPID(0x0eb7, 0x038e), /* Fanatec ClubSport Wheel Base V1 */ MAKE_VIDPID(0x0eb7, 0x0e03), /* Fanatec CSL Elite Wheel Base */ MAKE_VIDPID(0x11ff, 0x0511), /* DragonRise Inc. Wired Wheel (initial mode) (also known as PXN V900 (PS3), Superdrive SV-750, or a Genesis Seaborg 400) */ + MAKE_VIDPID(0x1209, 0xffb0), /* Generic FFBoard OpenFFBoard universal forcefeedback wheel */ MAKE_VIDPID(0x2433, 0xf300), /* Asetek SimSports Invicta Wheelbase */ MAKE_VIDPID(0x2433, 0xf301), /* Asetek SimSports Forte Wheelbase */ MAKE_VIDPID(0x2433, 0xf303), /* Asetek SimSports La Prima Wheelbase */ diff --git a/SDL2/src/joystick/SDL_steam_virtual_gamepad.c b/SDL2/src/joystick/SDL_steam_virtual_gamepad.c index c382b991..4e5255d0 100644 --- a/SDL2/src/joystick/SDL_steam_virtual_gamepad.c +++ b/SDL2/src/joystick/SDL_steam_virtual_gamepad.c @@ -221,6 +221,7 @@ SDL_bool SDL_UpdateSteamVirtualGamepadInfo(void) if (slot >= 0) { AddVirtualGamepadInfo(slot, &info); } + SDL_free(info.name); SDL_free(data); SDL_steam_virtual_gamepad_info_file_mtime = mtime; diff --git a/SDL2/src/joystick/iphoneos/SDL_mfijoystick.m b/SDL2/src/joystick/iphoneos/SDL_mfijoystick.m index 5fac495b..28ddca72 100644 --- a/SDL2/src/joystick/iphoneos/SDL_mfijoystick.m +++ b/SDL2/src/joystick/iphoneos/SDL_mfijoystick.m @@ -247,6 +247,7 @@ static void CheckControllerSiriRemote(GCController *controller, int *is_siri_rem *is_siri_remote = 0; } +#ifdef ENABLE_PHYSICAL_INPUT_PROFILE static BOOL ElementAlreadyHandled(SDL_JoystickDeviceItem *device, NSString *element, NSDictionary *elements) { if ([element isEqualToString:@"Left Thumbstick Left"] || @@ -345,6 +346,7 @@ static BOOL ElementAlreadyHandled(SDL_JoystickDeviceItem *device, NSString *elem } return FALSE; } +#endif /* ENABLE_PHYSICAL_INPUT_PROFILE */ static BOOL IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controller) { @@ -378,6 +380,7 @@ static BOOL IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle NSLog(@"Product name: %@\n", controller.vendorName); NSLog(@"Product category: %@\n", controller.productCategory); NSLog(@"Elements available:\n"); +#ifdef ENABLE_PHYSICAL_INPUT_PROFILE if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { NSDictionary *elements = controller.physicalInputProfile.elements; for (id key in controller.physicalInputProfile.buttons) { @@ -390,6 +393,7 @@ static BOOL IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle NSLog(@"\tHat: %@\n", key); } } +#endif #endif device->is_xbox = IsControllerXbox(controller); @@ -506,7 +510,7 @@ static BOOL IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle NSDictionary *elements = controller.physicalInputProfile.elements; /* Provide both axes and analog buttons as SDL axes */ - device->axes = [[[elements allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)] + NSArray *axes = [[[elements allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)] filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id object, NSDictionary *bindings) { GCControllerElement *element; @@ -523,8 +527,7 @@ static BOOL IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle } return NO; }]]; - device->naxes = (int)device->axes.count; - device->buttons = [[[elements allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)] + NSArray *buttons = [[[elements allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)] filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id object, NSDictionary *bindings) { GCControllerElement *element; @@ -538,7 +541,12 @@ static BOOL IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle } return NO; }]]; - device->nbuttons = (int)device->buttons.count; + /* Explicitly retain the arrays because SDL_JoystickDeviceItem is a + * struct, and ARC doesn't work with structs. */ + device->naxes = (int)axes.count; + device->axes = (__bridge NSArray *)CFBridgingRetain(axes); + device->nbuttons = (int)buttons.count; + device->buttons = (__bridge NSArray *)CFBridgingRetain(buttons); subtype = 4; #ifdef DEBUG_CONTROLLER_PROFILE @@ -775,13 +783,20 @@ static void IOS_AddJoystickDevice(GCController *controller, SDL_bool acceleromet #ifdef SDL_JOYSTICK_MFI @autoreleasepool { + /* These were explicitly retained in the struct, so they should be explicitly released before freeing the struct. */ if (device->controller) { - /* The controller was explicitly retained in the struct, so it - * should be explicitly released before freeing the struct. */ GCController *controller = CFBridgingRelease((__bridge CFTypeRef)(device->controller)); controller.controllerPausedHandler = nil; device->controller = nil; } + if (device->axes) { + CFRelease((__bridge CFTypeRef)device->axes); + device->axes = nil; + } + if (device->buttons) { + CFRelease((__bridge CFTypeRef)device->buttons); + device->buttons = nil; + } } #endif /* SDL_JOYSTICK_MFI */ @@ -1109,7 +1124,7 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick) Uint8 hatstate = SDL_HAT_CENTERED; int i; -#ifdef DEBUG_CONTROLLER_STATE +#if defined(DEBUG_CONTROLLER_STATE) && defined(ENABLE_PHYSICAL_INPUT_PROFILE) if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { if (controller.physicalInputProfile) { for (id key in controller.physicalInputProfile.buttons) { @@ -1136,6 +1151,7 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick) } #endif /* DEBUG_CONTROLLER_STATE */ +#ifdef ENABLE_PHYSICAL_INPUT_PROFILE if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { NSDictionary *elements = controller.physicalInputProfile.elements; NSDictionary *buttons = controller.physicalInputProfile.buttons; @@ -1162,7 +1178,9 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick) } SDL_PrivateJoystickButton(joystick, button++, value); } - } else if (controller.extendedGamepad) { + } else +#endif + if (controller.extendedGamepad) { SDL_bool isstack; GCExtendedGamepad *gamepad = controller.extendedGamepad; diff --git a/SDL2/src/joystick/iphoneos/SDL_mfijoystick_c.h b/SDL2/src/joystick/iphoneos/SDL_mfijoystick_c.h index bfb108bb..84a4e71a 100644 --- a/SDL2/src/joystick/iphoneos/SDL_mfijoystick_c.h +++ b/SDL2/src/joystick/iphoneos/SDL_mfijoystick_c.h @@ -26,7 +26,8 @@ #include "SDL_stdinc.h" #include "../SDL_sysjoystick.h" -#include +#import +#import @class GCController; @@ -59,8 +60,8 @@ typedef struct joystick_hwdata SDL_bool is_backbone_one; int is_siri_remote; - NSArray *axes; - NSArray *buttons; + NSArray __unsafe_unretained *axes; + NSArray __unsafe_unretained *buttons; SDL_bool has_dualshock_touchpad; SDL_bool has_xbox_paddles; diff --git a/SDL2/src/joystick/windows/SDL_xinputjoystick.c b/SDL2/src/joystick/windows/SDL_xinputjoystick.c index 3a2e912c..1ae7fb48 100644 --- a/SDL2/src/joystick/windows/SDL_xinputjoystick.c +++ b/SDL2/src/joystick/windows/SDL_xinputjoystick.c @@ -117,7 +117,7 @@ static const char *GetXInputName(const Uint8 userid, BYTE SubType) static SDL_bool GetXInputDeviceInfo(Uint8 userid, Uint16 *pVID, Uint16 *pPID, Uint16 *pVersion) { - XINPUT_CAPABILITIES_EX capabilities; + SDL_XINPUT_CAPABILITIES_EX capabilities; if (!XINPUTGETCAPABILITIESEX || XINPUTGETCAPABILITIESEX(1, userid, 0, &capabilities) != ERROR_SUCCESS) { return SDL_FALSE; @@ -143,7 +143,7 @@ static SDL_bool GetXInputDeviceInfo(Uint8 userid, Uint16 *pVID, Uint16 *pPID, Ui int SDL_XINPUT_GetSteamVirtualGamepadSlot(Uint8 userid) { - XINPUT_CAPABILITIES_EX capabilities; + SDL_XINPUT_CAPABILITIES_EX capabilities; if (XINPUTGETCAPABILITIESEX && XINPUTGETCAPABILITIESEX(1, userid, 0, &capabilities) == ERROR_SUCCESS && diff --git a/SDL2/src/main/windows/version.rc b/SDL2/src/main/windows/version.rc index 556048b0..21f80686 100644 --- a/SDL2/src/main/windows/version.rc +++ b/SDL2/src/main/windows/version.rc @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,30,0,0 - PRODUCTVERSION 2,30,0,0 + FILEVERSION 2,30,1,0 + PRODUCTVERSION 2,30,1,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "2, 30, 0, 0\0" + VALUE "FileVersion", "2, 30, 1, 0\0" VALUE "InternalName", "SDL\0" VALUE "LegalCopyright", "Copyright (C) 2024 Sam Lantinga\0" VALUE "OriginalFilename", "SDL2.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" - VALUE "ProductVersion", "2, 30, 0, 0\0" + VALUE "ProductVersion", "2, 30, 1, 0\0" END END BLOCK "VarFileInfo" diff --git a/SDL2/src/render/SDL_d3dmath.c b/SDL2/src/render/SDL_d3dmath.c index ad3af1ef..021b8c2e 100644 --- a/SDL2/src/render/SDL_d3dmath.c +++ b/SDL2/src/render/SDL_d3dmath.c @@ -20,7 +20,7 @@ */ #include "../SDL_internal.h" -#if (defined(SDL_VIDEO_RENDER_D3D) || defined(SDL_VIDEO_RENDER_D3D11) || defined(SDL_VIDEO_RENDER_D3D12)) && !defined(SDL_RENDER_DISABLED) +#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) #include "SDL_stdinc.h" #include "SDL_d3dmath.h" @@ -130,6 +130,6 @@ Float4X4 MatrixRotationZ(float r) return m; } -#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED */ +#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/render/SDL_d3dmath.h b/SDL2/src/render/SDL_d3dmath.h index ba486f9a..9ef2f53e 100644 --- a/SDL2/src/render/SDL_d3dmath.h +++ b/SDL2/src/render/SDL_d3dmath.h @@ -20,7 +20,7 @@ */ #include "../SDL_internal.h" -#if (defined(SDL_VIDEO_RENDER_D3D) || defined(SDL_VIDEO_RENDER_D3D11) || defined(SDL_VIDEO_RENDER_D3D12)) && !defined(SDL_RENDER_DISABLED) +#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus @@ -78,6 +78,6 @@ Float4X4 MatrixRotationZ(float r); } #endif -#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED */ +#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/render/SDL_render.c b/SDL2/src/render/SDL_render.c index 39dcadb3..f7fcc52c 100644 --- a/SDL2/src/render/SDL_render.c +++ b/SDL2/src/render/SDL_render.c @@ -91,37 +91,37 @@ this should probably be removed at some point in the future. --ryan. */ #ifndef SDL_RENDER_DISABLED static const SDL_RenderDriver *render_drivers[] = { -#ifdef SDL_VIDEO_RENDER_D3D +#if SDL_VIDEO_RENDER_D3D &D3D_RenderDriver, #endif -#ifdef SDL_VIDEO_RENDER_D3D11 +#if SDL_VIDEO_RENDER_D3D11 &D3D11_RenderDriver, #endif -#ifdef SDL_VIDEO_RENDER_D3D12 +#if SDL_VIDEO_RENDER_D3D12 &D3D12_RenderDriver, #endif -#ifdef SDL_VIDEO_RENDER_METAL +#if SDL_VIDEO_RENDER_METAL &METAL_RenderDriver, #endif -#ifdef SDL_VIDEO_RENDER_OGL +#if SDL_VIDEO_RENDER_OGL &GL_RenderDriver, #endif -#ifdef SDL_VIDEO_RENDER_OGL_ES2 +#if SDL_VIDEO_RENDER_OGL_ES2 &GLES2_RenderDriver, #endif -#ifdef SDL_VIDEO_RENDER_OGL_ES +#if SDL_VIDEO_RENDER_OGL_ES &GLES_RenderDriver, #endif -#ifdef SDL_VIDEO_RENDER_DIRECTFB +#if SDL_VIDEO_RENDER_DIRECTFB &DirectFB_RenderDriver, #endif -#ifdef SDL_VIDEO_RENDER_PS2 +#if SDL_VIDEO_RENDER_PS2 &PS2_RenderDriver, #endif -#ifdef SDL_VIDEO_RENDER_PSP +#if SDL_VIDEO_RENDER_PSP &PSP_RenderDriver, #endif -#ifdef SDL_VIDEO_RENDER_VITA_GXM +#if SDL_VIDEO_RENDER_VITA_GXM &VITA_GXM_RenderDriver, #endif #if SDL_VIDEO_RENDER_SW @@ -799,6 +799,20 @@ static int SDLCALL SDL_RendererEventWatch(void *userdata, SDL_Event *event) event->button.y = (int)(event->button.y / (scale.y * renderer->dpi_scale.y)); } } + } else if (event->type == SDL_MOUSEWHEEL) { + SDL_Window *window = SDL_GetWindowFromID(event->wheel.windowID); + if (window == renderer->window) { + int logical_w, logical_h; + SDL_DRect viewport; + SDL_FPoint scale; + GetWindowViewportValues(renderer, &logical_w, &logical_h, &viewport, &scale); + if (logical_w) { + event->wheel.mouseX -= (int)(viewport.x * renderer->dpi_scale.x); + event->wheel.mouseY -= (int)(viewport.y * renderer->dpi_scale.y); + event->wheel.mouseX = (int)(event->wheel.mouseX / (scale.x * renderer->dpi_scale.x)); + event->wheel.mouseY = (int)(event->wheel.mouseY / (scale.y * renderer->dpi_scale.y)); + } + } } else if (event->type == SDL_FINGERDOWN || event->type == SDL_FINGERUP || event->type == SDL_FINGERMOTION) { @@ -1108,7 +1122,7 @@ SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags) SDL_Renderer *SDL_CreateSoftwareRenderer(SDL_Surface *surface) { -#if !defined(SDL_RENDER_DISABLED) && SDL_VIDEO_RENDER_SW +#if SDL_VIDEO_RENDER_SW SDL_Renderer *renderer; renderer = SW_CreateRendererForSurface(surface); @@ -1451,7 +1465,7 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s SDL_UpdateTexture(texture, NULL, surface->pixels, surface->pitch); } -#ifdef SDL_VIDEO_RENDER_DIRECTFB +#if SDL_VIDEO_RENDER_DIRECTFB /* DirectFB allows palette format for textures. * Copy SDL_Surface palette to the texture */ if (SDL_ISPIXELFORMAT_INDEXED(format)) { @@ -2284,7 +2298,7 @@ static int UpdateLogicalSize(SDL_Renderer *renderer, SDL_bool flush_viewport_cmd hint = SDL_GetHint(SDL_HINT_RENDER_LOGICAL_SIZE_MODE); if (hint && (*hint == '1' || SDL_strcasecmp(hint, "overscan") == 0)) { -#ifdef SDL_VIDEO_RENDER_D3D +#if SDL_VIDEO_RENDER_D3D SDL_bool overscan_supported = SDL_TRUE; /* Unfortunately, Direct3D 9 doesn't support negative viewport numbers which the overscan implementation relies on. diff --git a/SDL2/src/render/direct3d/SDL_render_d3d.c b/SDL2/src/render/direct3d/SDL_render_d3d.c index 07e854f9..f117bd66 100644 --- a/SDL2/src/render/direct3d/SDL_render_d3d.c +++ b/SDL2/src/render/direct3d/SDL_render_d3d.c @@ -23,7 +23,7 @@ #include "SDL_render.h" #include "SDL_system.h" -#if defined(SDL_VIDEO_RENDER_D3D) && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_D3D #include "../../core/windows/SDL_windows.h" @@ -34,7 +34,7 @@ #include "../SDL_d3dmath.h" #include "../../video/windows/SDL_windowsvideo.h" -#ifdef SDL_VIDEO_RENDER_D3D +#if SDL_VIDEO_RENDER_D3D #define D3D_DEBUG_INFO #include #endif @@ -1170,6 +1170,7 @@ static int D3D_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, v if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof(cmd->data.viewport.rect)) != 0) { SDL_copyp(viewport, &cmd->data.viewport.rect); data->drawstate.viewport_dirty = SDL_TRUE; + data->drawstate.cliprect_dirty = SDL_TRUE; } break; } @@ -1731,7 +1732,7 @@ SDL_RenderDriver D3D_RenderDriver = { 0, 0 } }; -#endif /* SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_D3D */ #if defined(__WIN32__) || defined(__WINGDK__) /* This function needs to always exist on Windows, for the Dynamic API. */ @@ -1739,7 +1740,7 @@ IDirect3DDevice9 *SDL_RenderGetD3D9Device(SDL_Renderer *renderer) { IDirect3DDevice9 *device = NULL; -#if defined(SDL_VIDEO_RENDER_D3D) && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_D3D D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata; /* Make sure that this is a D3D renderer */ @@ -1752,7 +1753,7 @@ IDirect3DDevice9 *SDL_RenderGetD3D9Device(SDL_Renderer *renderer) if (device) { IDirect3DDevice9_AddRef(device); } -#endif /* SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_D3D */ return device; } diff --git a/SDL2/src/render/direct3d/SDL_shaders_d3d.c b/SDL2/src/render/direct3d/SDL_shaders_d3d.c index 1f3184f6..2f55d80c 100644 --- a/SDL2/src/render/direct3d/SDL_shaders_d3d.c +++ b/SDL2/src/render/direct3d/SDL_shaders_d3d.c @@ -23,7 +23,7 @@ #include "SDL_render.h" #include "SDL_system.h" -#if defined(SDL_VIDEO_RENDER_D3D) && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_D3D #include "../../core/windows/SDL_windows.h" @@ -268,6 +268,6 @@ HRESULT D3D9_CreatePixelShader(IDirect3DDevice9 *d3dDevice, D3D9_Shader shader, return IDirect3DDevice9_CreatePixelShader(d3dDevice, D3D9_shaders[shader], pixelShader); } -#endif /* SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_D3D */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/render/direct3d11/SDL_render_d3d11.c b/SDL2/src/render/direct3d11/SDL_render_d3d11.c index 748a8c76..8249256f 100644 --- a/SDL2/src/render/direct3d11/SDL_render_d3d11.c +++ b/SDL2/src/render/direct3d11/SDL_render_d3d11.c @@ -23,7 +23,7 @@ #include "SDL_render.h" #include "SDL_system.h" -#if defined(SDL_VIDEO_RENDER_D3D11) && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_D3D11 #define COBJMACROS #include "../../core/windows/SDL_windows.h" @@ -2047,6 +2047,7 @@ static int D3D11_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof(cmd->data.viewport.rect)) != 0) { SDL_copyp(viewport, &cmd->data.viewport.rect); rendererData->viewportDirty = SDL_TRUE; + rendererData->cliprectDirty = SDL_TRUE; } break; } @@ -2415,7 +2416,7 @@ SDL_RenderDriver D3D11_RenderDriver = { } }; -#endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_D3D11 */ #if defined(__WIN32__) || defined(__WINGDK__) /* This function needs to always exist on Windows, for the Dynamic API. */ @@ -2423,7 +2424,7 @@ ID3D11Device *SDL_RenderGetD3D11Device(SDL_Renderer *renderer) { ID3D11Device *device = NULL; -#if defined(SDL_VIDEO_RENDER_D3D11) && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_D3D11 D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata; /* Make sure that this is a D3D renderer */ @@ -2436,7 +2437,7 @@ ID3D11Device *SDL_RenderGetD3D11Device(SDL_Renderer *renderer) if (device) { ID3D11Device_AddRef(device); } -#endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_D3D11 */ return device; } diff --git a/SDL2/src/render/direct3d11/SDL_render_winrt.cpp b/SDL2/src/render/direct3d11/SDL_render_winrt.cpp index 8ab6a7af..0ed7addb 100644 --- a/SDL2/src/render/direct3d11/SDL_render_winrt.cpp +++ b/SDL2/src/render/direct3d11/SDL_render_winrt.cpp @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if defined(SDL_VIDEO_RENDER_D3D11) && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_D3D11 #include "SDL_syswm.h" #include "../../video/winrt/SDL_winrtvideo_cpp.h" @@ -109,6 +109,6 @@ D3D11_GetCurrentRotation() return DXGI_MODE_ROTATION_IDENTITY; } -#endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_D3D11 */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/render/direct3d11/SDL_render_winrt.h b/SDL2/src/render/direct3d11/SDL_render_winrt.h index cf0c4316..dd9a1763 100644 --- a/SDL2/src/render/direct3d11/SDL_render_winrt.h +++ b/SDL2/src/render/direct3d11/SDL_render_winrt.h @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if defined(SDL_VIDEO_RENDER_D3D11) && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_D3D11 #include "SDL_render.h" @@ -35,6 +35,6 @@ DXGI_MODE_ROTATION D3D11_GetCurrentRotation(); } #endif -#endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_D3D11 */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/render/direct3d11/SDL_shaders_d3d11.c b/SDL2/src/render/direct3d11/SDL_shaders_d3d11.c index 0bda02b5..5f3a9a41 100644 --- a/SDL2/src/render/direct3d11/SDL_shaders_d3d11.c +++ b/SDL2/src/render/direct3d11/SDL_shaders_d3d11.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if defined(SDL_VIDEO_RENDER_D3D11) && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_D3D11 #include "SDL_stdinc.h" @@ -1949,6 +1949,6 @@ int D3D11_CreatePixelShader(ID3D11Device1 *d3dDevice, D3D11_Shader shader, ID3D1 return 0; } -#endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_D3D11 */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/render/direct3d12/SDL_render_d3d12.c b/SDL2/src/render/direct3d12/SDL_render_d3d12.c index 6cf34db2..04c065cc 100644 --- a/SDL2/src/render/direct3d12/SDL_render_d3d12.c +++ b/SDL2/src/render/direct3d12/SDL_render_d3d12.c @@ -23,7 +23,7 @@ #include "SDL_render.h" #include "SDL_system.h" -#if defined(SDL_VIDEO_RENDER_D3D12) && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_D3D12 #define SDL_D3D12_NUM_BUFFERS 2 #define SDL_D3D12_NUM_VERTEX_BUFFERS 256 @@ -2608,6 +2608,7 @@ static int D3D12_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof(cmd->data.viewport.rect)) != 0) { SDL_copyp(viewport, &cmd->data.viewport.rect); rendererData->viewportDirty = SDL_TRUE; + rendererData->cliprectDirty = SDL_TRUE; } break; } @@ -3055,7 +3056,7 @@ SDL_RenderDriver D3D12_RenderDriver = { } #endif -#endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_D3D12 */ #if defined(__WIN32__) || defined(__GDK__) #ifdef __cplusplus @@ -3067,7 +3068,7 @@ extern "C" { ID3D12Device *device = NULL; -#if defined(SDL_VIDEO_RENDER_D3D12) && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_D3D12 D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata; /* Make sure that this is a D3D renderer */ @@ -3080,7 +3081,7 @@ extern "C" if (device) { D3D_CALL(device, AddRef); } -#endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_D3D12 */ return device; } diff --git a/SDL2/src/render/direct3d12/SDL_render_d3d12_xbox.cpp b/SDL2/src/render/direct3d12/SDL_render_d3d12_xbox.cpp index 0c460556..7b598c01 100644 --- a/SDL2/src/render/direct3d12/SDL_render_d3d12_xbox.cpp +++ b/SDL2/src/render/direct3d12/SDL_render_d3d12_xbox.cpp @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && (defined(__XBOXONE__) || defined(__XBOXSERIES__)) +#if SDL_VIDEO_RENDER_D3D12 && (defined(__XBOXONE__) || defined(__XBOXSERIES__)) #include "SDL_render_d3d12_xbox.h" #include "../../core/windows/SDL_windows.h" #include diff --git a/SDL2/src/render/direct3d12/SDL_shaders_d3d12.c b/SDL2/src/render/direct3d12/SDL_shaders_d3d12.c index 188f0e7d..29862d46 100644 --- a/SDL2/src/render/direct3d12/SDL_shaders_d3d12.c +++ b/SDL2/src/render/direct3d12/SDL_shaders_d3d12.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if defined(SDL_VIDEO_RENDER_D3D12) && !defined(SDL_RENDER_DISABLED) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) +#if SDL_VIDEO_RENDER_D3D12 && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_stdinc.h" @@ -6934,6 +6934,6 @@ void D3D12_GetRootSignatureData(D3D12_RootSignature rootSig, D3D12_SHADER_BYTECO outBytecode->BytecodeLength = D3D12_rootsigs[rootSig].rs_shader_size; } -#endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) */ +#endif /* SDL_VIDEO_RENDER_D3D12 && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp b/SDL2/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp index 456c4db7..cc5c84f2 100644 --- a/SDL2/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp +++ b/SDL2/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXONE__) +#if SDL_VIDEO_RENDER_D3D12 && defined(__XBOXONE__) #include @@ -139,6 +139,6 @@ D3D12_GetRootSignatureData(D3D12_RootSignature rootSig, D3D12_SHADER_BYTECODE *o outBytecode->BytecodeLength = D3D12_rootsigs[rootSig].rs_shader_size; } -#endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXONE__) */ +#endif /* SDL_VIDEO_RENDER_D3D12 && defined(__XBOXONE__) */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp b/SDL2/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp index 2fc8349b..f1e40631 100644 --- a/SDL2/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp +++ b/SDL2/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXSERIES__) +#if SDL_VIDEO_RENDER_D3D12 && defined(__XBOXSERIES__) #include @@ -139,6 +139,6 @@ D3D12_GetRootSignatureData(D3D12_RootSignature rootSig, D3D12_SHADER_BYTECODE *o outBytecode->BytecodeLength = D3D12_rootsigs[rootSig].rs_shader_size; } -#endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXSERIES__) */ +#endif /* SDL_VIDEO_RENDER_D3D12 && defined(__XBOXSERIES__) */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/render/metal/SDL_render_metal.m b/SDL2/src/render/metal/SDL_render_metal.m index be207e46..ee6b8820 100644 --- a/SDL2/src/render/metal/SDL_render_metal.m +++ b/SDL2/src/render/metal/SDL_render_metal.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if defined(SDL_VIDEO_RENDER_METAL) && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_METAL #include "SDL_hints.h" #include "SDL_syswm.h" @@ -1896,6 +1896,6 @@ in case we want to use it later (recreating the renderer) } }; -#endif /* SDL_VIDEO_RENDER_METAL && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_METAL */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/render/opengl/SDL_render_gl.c b/SDL2/src/render/opengl/SDL_render_gl.c index c3bd0e60..9c266191 100644 --- a/SDL2/src/render/opengl/SDL_render_gl.c +++ b/SDL2/src/render/opengl/SDL_render_gl.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if defined(SDL_VIDEO_RENDER_OGL) && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_OGL #include "SDL_hints.h" #include "../../video/SDL_sysvideo.h" /* For SDL_GL_SwapWindowWithResult */ #include "SDL_opengl.h" @@ -1224,6 +1224,7 @@ static int GL_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof(cmd->data.viewport.rect)) != 0) { SDL_copyp(viewport, &cmd->data.viewport.rect); data->drawstate.viewport_dirty = SDL_TRUE; + data->drawstate.cliprect_dirty = SDL_TRUE; } break; } @@ -1969,6 +1970,6 @@ SDL_RenderDriver GL_RenderDriver = { 0 } }; -#endif /* SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_OGL */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/render/opengl/SDL_shaders_gl.c b/SDL2/src/render/opengl/SDL_shaders_gl.c index 10906a54..e24a36af 100644 --- a/SDL2/src/render/opengl/SDL_shaders_gl.c +++ b/SDL2/src/render/opengl/SDL_shaders_gl.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if defined(SDL_VIDEO_RENDER_OGL) && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_OGL #include "SDL_stdinc.h" #include "SDL_opengl.h" @@ -577,6 +577,6 @@ void GL_DestroyShaderContext(GL_ShaderContext *ctx) SDL_free(ctx); } -#endif /* SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_OGL */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/render/opengles/SDL_render_gles.c b/SDL2/src/render/opengles/SDL_render_gles.c index e0cb1f19..9906b46d 100644 --- a/SDL2/src/render/opengles/SDL_render_gles.c +++ b/SDL2/src/render/opengles/SDL_render_gles.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if defined(SDL_VIDEO_RENDER_OGL_ES) && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_OGL_ES #include "SDL_hints.h" #include "../../video/SDL_sysvideo.h" /* For SDL_GL_SwapWindowWithResult */ @@ -1215,6 +1215,6 @@ SDL_RenderDriver GLES_RenderDriver = { 0 } }; -#endif /* SDL_VIDEO_RENDER_OGL_ES && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_OGL_ES */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/render/opengles2/SDL_render_gles2.c b/SDL2/src/render/opengles2/SDL_render_gles2.c index 81d91bce..43aebda0 100644 --- a/SDL2/src/render/opengles2/SDL_render_gles2.c +++ b/SDL2/src/render/opengles2/SDL_render_gles2.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if defined(SDL_VIDEO_RENDER_OGL_ES2) && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_OGL_ES2 #include "SDL_hints.h" #include "../../video/SDL_sysvideo.h" /* For SDL_GL_SwapWindowWithResult */ @@ -1216,6 +1216,7 @@ static int GLES2_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof(cmd->data.viewport.rect)) != 0) { SDL_copyp(viewport, &cmd->data.viewport.rect); data->drawstate.viewport_dirty = SDL_TRUE; + data->drawstate.cliprect_dirty = SDL_TRUE; } break; } @@ -2244,6 +2245,6 @@ SDL_RenderDriver GLES2_RenderDriver = { 0 } }; -#endif /* SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_OGL_ES2 */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/render/opengles2/SDL_shaders_gles2.c b/SDL2/src/render/opengles2/SDL_shaders_gles2.c index cbb216bc..9a434f40 100644 --- a/SDL2/src/render/opengles2/SDL_shaders_gles2.c +++ b/SDL2/src/render/opengles2/SDL_shaders_gles2.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if defined(SDL_VIDEO_RENDER_OGL_ES2) && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_OGL_ES2 #include "SDL_hints.h" #include "SDL_video.h" @@ -444,6 +444,6 @@ const char *GLES2_GetShader(GLES2_ShaderType type) } } -#endif /* SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_OGL_ES2 */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/render/opengles2/SDL_shaders_gles2.h b/SDL2/src/render/opengles2/SDL_shaders_gles2.h index f05d15a0..0be234f3 100644 --- a/SDL2/src/render/opengles2/SDL_shaders_gles2.h +++ b/SDL2/src/render/opengles2/SDL_shaders_gles2.h @@ -23,7 +23,7 @@ #ifndef SDL_shaders_gles2_h_ #define SDL_shaders_gles2_h_ -#if defined(SDL_VIDEO_RENDER_OGL_ES2) +#if SDL_VIDEO_RENDER_OGL_ES2 typedef enum { diff --git a/SDL2/src/render/ps2/SDL_render_ps2.c b/SDL2/src/render/ps2/SDL_render_ps2.c index f45ea9eb..ec17323c 100644 --- a/SDL2/src/render/ps2/SDL_render_ps2.c +++ b/SDL2/src/render/ps2/SDL_render_ps2.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#ifdef SDL_VIDEO_RENDER_PS2 +#if SDL_VIDEO_RENDER_PS2 #include "../SDL_sysrender.h" #include "SDL_hints.h" @@ -477,6 +477,7 @@ static int PS2_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, v case SDL_RENDERCMD_SETVIEWPORT: { PS2_RenderSetViewPort(renderer, cmd); + /* FIXME: We need to update the clip rect too, see https://github.com/libsdl-org/SDL/issues/9094 */ break; } case SDL_RENDERCMD_SETCLIPRECT: diff --git a/SDL2/src/render/psp/SDL_render_psp.c b/SDL2/src/render/psp/SDL_render_psp.c index eaccb528..47fab82c 100644 --- a/SDL2/src/render/psp/SDL_render_psp.c +++ b/SDL2/src/render/psp/SDL_render_psp.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#ifdef SDL_VIDEO_RENDER_PSP +#if SDL_VIDEO_RENDER_PSP #include "SDL_hints.h" #include "../SDL_sysrender.h" @@ -1053,6 +1053,7 @@ static int PSP_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, v sceGuOffset(2048 - (viewport->w >> 1), 2048 - (viewport->h >> 1)); sceGuViewport(2048, 2048, viewport->w, viewport->h); sceGuScissor(viewport->x, viewport->y, viewport->w, viewport->h); + /* FIXME: We need to update the clip rect too, see https://github.com/libsdl-org/SDL/issues/9094 */ break; } diff --git a/SDL2/src/render/software/SDL_blendfillrect.c b/SDL2/src/render/software/SDL_blendfillrect.c index e0bd7fae..2026cb88 100644 --- a/SDL2/src/render/software/SDL_blendfillrect.c +++ b/SDL2/src/render/software/SDL_blendfillrect.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_SW #include "SDL_draw.h" #include "SDL_blendfillrect.h" @@ -343,6 +343,6 @@ int SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count, return status; } -#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_SW */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/render/software/SDL_blendline.c b/SDL2/src/render/software/SDL_blendline.c index e5054689..19e2cdb0 100644 --- a/SDL2/src/render/software/SDL_blendline.c +++ b/SDL2/src/render/software/SDL_blendline.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_SW #include "SDL_draw.h" #include "SDL_blendline.h" @@ -859,6 +859,6 @@ int SDL_BlendLines(SDL_Surface *dst, const SDL_Point *points, int count, return 0; } -#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_SW */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/render/software/SDL_blendpoint.c b/SDL2/src/render/software/SDL_blendpoint.c index 874a99ab..c3803711 100644 --- a/SDL2/src/render/software/SDL_blendpoint.c +++ b/SDL2/src/render/software/SDL_blendpoint.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_SW #include "SDL_draw.h" #include "SDL_blendpoint.h" @@ -348,6 +348,6 @@ int SDL_BlendPoints(SDL_Surface *dst, const SDL_Point *points, int count, return status; } -#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_SW */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/render/software/SDL_drawline.c b/SDL2/src/render/software/SDL_drawline.c index 085b5db3..e164a8f0 100644 --- a/SDL2/src/render/software/SDL_drawline.c +++ b/SDL2/src/render/software/SDL_drawline.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_SW #include "SDL_draw.h" #include "SDL_drawline.h" @@ -197,6 +197,6 @@ int SDL_DrawLines(SDL_Surface *dst, const SDL_Point *points, int count, return 0; } -#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_SW */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/render/software/SDL_drawpoint.c b/SDL2/src/render/software/SDL_drawpoint.c index dd4ef9fe..16bb9fac 100644 --- a/SDL2/src/render/software/SDL_drawpoint.c +++ b/SDL2/src/render/software/SDL_drawpoint.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_SW #include "SDL_draw.h" #include "SDL_drawpoint.h" @@ -106,6 +106,6 @@ int SDL_DrawPoints(SDL_Surface *dst, const SDL_Point *points, int count, return 0; } -#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_SW */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/render/software/SDL_render_sw.c b/SDL2/src/render/software/SDL_render_sw.c index 7aa45715..b7843340 100644 --- a/SDL2/src/render/software/SDL_render_sw.c +++ b/SDL2/src/render/software/SDL_render_sw.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_SW #include "../SDL_sysrender.h" #include "SDL_render_sw_c.h" @@ -1093,6 +1093,6 @@ SDL_RenderDriver SW_RenderDriver = { 0} }; -#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_SW */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/render/software/SDL_rotate.c b/SDL2/src/render/software/SDL_rotate.c index d9faca4d..d29b92d6 100644 --- a/SDL2/src/render/software/SDL_rotate.c +++ b/SDL2/src/render/software/SDL_rotate.c @@ -30,7 +30,7 @@ Andreas Schiffler -- aschiffler at ferzkopp dot net */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_SW #if defined(__WIN32__) || defined(__GDK__) #include "../../core/windows/SDL_windows.h" @@ -617,4 +617,4 @@ SDL_Surface *SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, in return rz_dst; } -#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_SW */ diff --git a/SDL2/src/render/software/SDL_triangle.c b/SDL2/src/render/software/SDL_triangle.c index 31588b99..f6af3dca 100644 --- a/SDL2/src/render/software/SDL_triangle.c +++ b/SDL2/src/render/software/SDL_triangle.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED) +#if SDL_VIDEO_RENDER_SW #include @@ -935,6 +935,6 @@ static void SDL_BlitTriangle_Slow(SDL_BlitInfo *info, TRIANGLE_END_LOOP } -#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_SW */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/render/vitagxm/SDL_render_vita_gxm.c b/SDL2/src/render/vitagxm/SDL_render_vita_gxm.c index be853485..7d808590 100644 --- a/SDL2/src/render/vitagxm/SDL_render_vita_gxm.c +++ b/SDL2/src/render/vitagxm/SDL_render_vita_gxm.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#ifdef SDL_VIDEO_RENDER_VITA_GXM +#if SDL_VIDEO_RENDER_VITA_GXM #include "SDL_hints.h" #include "../SDL_sysrender.h" @@ -956,6 +956,7 @@ static int VITA_GXM_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *c if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof(cmd->data.viewport.rect)) != 0) { SDL_copyp(viewport, &cmd->data.viewport.rect); data->drawstate.viewport_dirty = SDL_TRUE; + data->drawstate.cliprect_dirty = SDL_TRUE; } break; } diff --git a/SDL2/src/render/vitagxm/SDL_render_vita_gxm_memory.c b/SDL2/src/render/vitagxm/SDL_render_vita_gxm_memory.c index ac55b8d0..86e33115 100644 --- a/SDL2/src/render/vitagxm/SDL_render_vita_gxm_memory.c +++ b/SDL2/src/render/vitagxm/SDL_render_vita_gxm_memory.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#ifdef SDL_VIDEO_RENDER_VITA_GXM +#if SDL_VIDEO_RENDER_VITA_GXM #include "SDL_render_vita_gxm_memory.h" diff --git a/SDL2/src/render/vitagxm/SDL_render_vita_gxm_tools.c b/SDL2/src/render/vitagxm/SDL_render_vita_gxm_tools.c index 2d226466..2c38441d 100644 --- a/SDL2/src/render/vitagxm/SDL_render_vita_gxm_tools.c +++ b/SDL2/src/render/vitagxm/SDL_render_vita_gxm_tools.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#ifdef SDL_VIDEO_RENDER_VITA_GXM +#if SDL_VIDEO_RENDER_VITA_GXM #include "SDL_hints.h" #include "../SDL_sysrender.h" diff --git a/SDL2/src/video/SDL_sysvideo.h b/SDL2/src/video/SDL_sysvideo.h index 7dfbe327..344efec4 100644 --- a/SDL2/src/video/SDL_sysvideo.h +++ b/SDL2/src/video/SDL_sysvideo.h @@ -24,6 +24,7 @@ #define SDL_sysvideo_h_ #include "SDL_messagebox.h" +#include "SDL_mouse.h" #include "SDL_shape.h" #include "SDL_thread.h" #include "SDL_metal.h" @@ -529,6 +530,10 @@ extern int SDL_GetPointDisplayIndex(const SDL_Point *point); extern int SDL_GL_SwapWindowWithResult(SDL_Window *window); +#if defined(SDL_VIDEO_DRIVER_X11) || defined(SDL_VIDEO_DRIVER_WAYLAND) || defined(SDL_VIDEO_DRIVER_EMSCRIPTEN) +const char *SDL_GetCSSCursorName(SDL_SystemCursor id, const char **fallback_name); +#endif + #endif /* SDL_sysvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/video/SDL_video.c b/SDL2/src/video/SDL_video.c index 2ad82faf..ee723a57 100644 --- a/SDL2/src/video/SDL_video.c +++ b/SDL2/src/video/SDL_video.c @@ -4780,4 +4780,93 @@ void SDL_Metal_GetDrawableSize(SDL_Window *window, int *w, int *h) } } +#if defined(SDL_VIDEO_DRIVER_X11) || defined(SDL_VIDEO_DRIVER_WAYLAND) || defined(SDL_VIDEO_DRIVER_EMSCRIPTEN) +const char *SDL_GetCSSCursorName(SDL_SystemCursor id, const char **fallback_name) +{ + /* Reference: https://www.w3.org/TR/css-ui-4/#cursor */ + /* Also in: https://www.freedesktop.org/wiki/Specifications/cursor-spec/ */ + switch (id) { + case SDL_SYSTEM_CURSOR_ARROW: + return "default"; + + case SDL_SYSTEM_CURSOR_IBEAM: + return "text"; + + case SDL_SYSTEM_CURSOR_WAIT: + return "wait"; + + case SDL_SYSTEM_CURSOR_CROSSHAIR: + return "crosshair"; + + case SDL_SYSTEM_CURSOR_WAITARROW: + return "progress"; + + case SDL_SYSTEM_CURSOR_SIZENWSE: + if (fallback_name) { + /* only a single arrow */ + *fallback_name = "nw-resize"; + } + return "nwse-resize"; + + case SDL_SYSTEM_CURSOR_SIZENESW: + if (fallback_name) { + /* only a single arrow */ + *fallback_name = "ne-resize"; + } + return "nesw-resize"; + + case SDL_SYSTEM_CURSOR_SIZEWE: + if (fallback_name) { + *fallback_name = "col-resize"; + } + return "ew-resize"; + + case SDL_SYSTEM_CURSOR_SIZENS: + if (fallback_name) { + *fallback_name = "row-resize"; + } + return "ns-resize"; + + case SDL_SYSTEM_CURSOR_SIZEALL: + return "all-scroll"; + + case SDL_SYSTEM_CURSOR_NO: + return "not-allowed"; + + case SDL_SYSTEM_CURSOR_HAND: + return "pointer"; + +#if 0 + case SDL_SYSTEM_CURSOR_WINDOW_TOPLEFT: + return "nw-resize"; + + case SDL_SYSTEM_CURSOR_WINDOW_TOP: + return "n-resize"; + + case SDL_SYSTEM_CURSOR_WINDOW_TOPRIGHT: + return "ne-resize"; + + case SDL_SYSTEM_CURSOR_WINDOW_RIGHT: + return "e-resize"; + + case SDL_SYSTEM_CURSOR_WINDOW_BOTTOMRIGHT: + return "se-resize"; + + case SDL_SYSTEM_CURSOR_WINDOW_BOTTOM: + return "s-resize"; + + case SDL_SYSTEM_CURSOR_WINDOW_BOTTOMLEFT: + return "sw-resize"; + + case SDL_SYSTEM_CURSOR_WINDOW_LEFT: + return "w-resize"; +#endif + + default: + SDL_assert(0); + return "default"; + } +} +#endif + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/SDL2/src/video/android/SDL_androidevents.c b/SDL2/src/video/android/SDL_androidevents.c index cbb3b02e..d125c92b 100644 --- a/SDL2/src/video/android/SDL_androidevents.c +++ b/SDL2/src/video/android/SDL_androidevents.c @@ -150,10 +150,7 @@ void Android_PumpEvents_Blocking(_THIS) #endif /* Make sure SW Keyboard is restored when an app becomes foreground */ - if (SDL_IsTextInputActive() && - SDL_GetHintBoolean(SDL_HINT_ENABLE_SCREEN_KEYBOARD, SDL_TRUE)) { - Android_ShowScreenKeyboard(_this, Android_Window); /* Only showTextInput */ - } + Android_RestoreScreenKeyboardOnResume(_this, Android_Window); } } else { if (videodata->isPausing || SDL_SemTryWait(Android_PauseSem) == 0) { @@ -235,10 +232,7 @@ void Android_PumpEvents_NonBlocking(_THIS) #endif /* Make sure SW Keyboard is restored when an app becomes foreground */ - if (SDL_IsTextInputActive() && - SDL_GetHintBoolean(SDL_HINT_ENABLE_SCREEN_KEYBOARD, SDL_TRUE)) { - Android_ShowScreenKeyboard(_this, Android_Window); /* Only showTextInput */ - } + Android_RestoreScreenKeyboardOnResume(_this, Android_Window); } } else { if (videodata->isPausing || SDL_SemTryWait(Android_PauseSem) == 0) { diff --git a/SDL2/src/video/android/SDL_androidkeyboard.c b/SDL2/src/video/android/SDL_androidkeyboard.c index 13b05633..b55de029 100644 --- a/SDL2/src/video/android/SDL_androidkeyboard.c +++ b/SDL2/src/video/android/SDL_androidkeyboard.c @@ -313,6 +313,8 @@ static SDL_Scancode Android_Keycodes[] = { SDL_SCANCODE_PASTE, /* AKEYCODE_PASTE */ }; +static SDL_bool SDL_screen_keyboard_shown; + static SDL_Scancode TranslateKeycode(int keycode) { SDL_Scancode scancode = SDL_SCANCODE_UNKNOWN; @@ -345,11 +347,20 @@ void Android_ShowScreenKeyboard(_THIS, SDL_Window *window) { SDL_VideoData *videodata = _this->driverdata; Android_JNI_ShowScreenKeyboard(&videodata->textRect); + SDL_screen_keyboard_shown = SDL_TRUE; } void Android_HideScreenKeyboard(_THIS, SDL_Window *window) { Android_JNI_HideScreenKeyboard(); + SDL_screen_keyboard_shown = SDL_FALSE; +} + +void Android_RestoreScreenKeyboardOnResume(_THIS, SDL_Window *window) +{ + if (SDL_screen_keyboard_shown) { + Android_ShowScreenKeyboard(_this, window); + } } SDL_bool Android_IsScreenKeyboardShown(_THIS, SDL_Window *window) diff --git a/SDL2/src/video/android/SDL_androidkeyboard.h b/SDL2/src/video/android/SDL_androidkeyboard.h index 1124b4a9..4081ac67 100644 --- a/SDL2/src/video/android/SDL_androidkeyboard.h +++ b/SDL2/src/video/android/SDL_androidkeyboard.h @@ -28,6 +28,7 @@ extern int Android_OnKeyUp(int keycode); extern SDL_bool Android_HasScreenKeyboardSupport(_THIS); extern void Android_ShowScreenKeyboard(_THIS, SDL_Window *window); extern void Android_HideScreenKeyboard(_THIS, SDL_Window *window); +extern void Android_RestoreScreenKeyboardOnResume(_THIS, SDL_Window *window); extern SDL_bool Android_IsScreenKeyboardShown(_THIS, SDL_Window *window); extern void Android_SetTextInputRect(_THIS, const SDL_Rect *rect); diff --git a/SDL2/src/video/emscripten/SDL_emscriptenmouse.c b/SDL2/src/video/emscripten/SDL_emscriptenmouse.c index cdf83de6..d189e539 100644 --- a/SDL2/src/video/emscripten/SDL_emscriptenmouse.c +++ b/SDL2/src/video/emscripten/SDL_emscriptenmouse.c @@ -141,49 +141,7 @@ static SDL_Cursor *Emscripten_CreateCursor(SDL_Surface *surface, int hot_x, int static SDL_Cursor *Emscripten_CreateSystemCursor(SDL_SystemCursor id) { - const char *cursor_name = NULL; - - switch (id) { - case SDL_SYSTEM_CURSOR_ARROW: - cursor_name = "default"; - break; - case SDL_SYSTEM_CURSOR_IBEAM: - cursor_name = "text"; - break; - case SDL_SYSTEM_CURSOR_WAIT: - cursor_name = "wait"; - break; - case SDL_SYSTEM_CURSOR_CROSSHAIR: - cursor_name = "crosshair"; - break; - case SDL_SYSTEM_CURSOR_WAITARROW: - cursor_name = "progress"; - break; - case SDL_SYSTEM_CURSOR_SIZENWSE: - cursor_name = "nwse-resize"; - break; - case SDL_SYSTEM_CURSOR_SIZENESW: - cursor_name = "nesw-resize"; - break; - case SDL_SYSTEM_CURSOR_SIZEWE: - cursor_name = "ew-resize"; - break; - case SDL_SYSTEM_CURSOR_SIZENS: - cursor_name = "ns-resize"; - break; - case SDL_SYSTEM_CURSOR_SIZEALL: - cursor_name = "move"; - break; - case SDL_SYSTEM_CURSOR_NO: - cursor_name = "not-allowed"; - break; - case SDL_SYSTEM_CURSOR_HAND: - cursor_name = "pointer"; - break; - default: - SDL_assert(0); - return NULL; - } + const char *cursor_name = SDL_GetCSSCursorName(id, NULL); return Emscripten_CreateCursorFromString(cursor_name, SDL_FALSE); } diff --git a/SDL2/src/video/emscripten/SDL_emscriptenvideo.c b/SDL2/src/video/emscripten/SDL_emscriptenvideo.c index e713e5b7..6319f927 100644 --- a/SDL2/src/video/emscripten/SDL_emscriptenvideo.c +++ b/SDL2/src/video/emscripten/SDL_emscriptenvideo.c @@ -342,6 +342,7 @@ static void Emscripten_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoD SDL_bool is_desktop_fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP; int res; + SDL_zero(strategy); strategy.scaleMode = is_desktop_fullscreen ? EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH : EMSCRIPTEN_FULLSCREEN_SCALE_ASPECT; if (!is_desktop_fullscreen) { diff --git a/SDL2/src/video/khronos/vulkan/vulkan_metal.h b/SDL2/src/video/khronos/vulkan/vulkan_metal.h index e6f7bf7a..badb4507 100644 --- a/SDL2/src/video/khronos/vulkan/vulkan_metal.h +++ b/SDL2/src/video/khronos/vulkan/vulkan_metal.h @@ -27,6 +27,14 @@ extern "C" { typedef void CAMetalLayer; #endif +#define SDL_UNSAFE_UNRETAINED +#if defined(__OBJC__) && defined(__has_feature) +#if __has_feature(objc_arc) +#undef SDL_UNSAFE_UNRETAINED +#define SDL_UNSAFE_UNRETAINED __unsafe_unretained +#endif +#endif + #define VK_EXT_METAL_SURFACE_SPEC_VERSION 1 #define VK_EXT_METAL_SURFACE_EXTENSION_NAME "VK_EXT_metal_surface" typedef VkFlags VkMetalSurfaceCreateFlagsEXT; @@ -34,7 +42,7 @@ typedef struct VkMetalSurfaceCreateInfoEXT { VkStructureType sType; const void* pNext; VkMetalSurfaceCreateFlagsEXT flags; - const CAMetalLayer* pLayer; + const CAMetalLayer SDL_UNSAFE_UNRETAINED *pLayer; } VkMetalSurfaceCreateInfoEXT; typedef VkResult (VKAPI_PTR *PFN_vkCreateMetalSurfaceEXT)(VkInstance instance, const VkMetalSurfaceCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); @@ -113,27 +121,27 @@ typedef struct VkExportMetalObjectsInfoEXT { typedef struct VkExportMetalDeviceInfoEXT { VkStructureType sType; const void* pNext; - MTLDevice_id mtlDevice; + MTLDevice_id SDL_UNSAFE_UNRETAINED mtlDevice; } VkExportMetalDeviceInfoEXT; typedef struct VkExportMetalCommandQueueInfoEXT { VkStructureType sType; const void* pNext; VkQueue queue; - MTLCommandQueue_id mtlCommandQueue; + MTLCommandQueue_id SDL_UNSAFE_UNRETAINED mtlCommandQueue; } VkExportMetalCommandQueueInfoEXT; typedef struct VkExportMetalBufferInfoEXT { VkStructureType sType; const void* pNext; VkDeviceMemory memory; - MTLBuffer_id mtlBuffer; + MTLBuffer_id SDL_UNSAFE_UNRETAINED mtlBuffer; } VkExportMetalBufferInfoEXT; typedef struct VkImportMetalBufferInfoEXT { VkStructureType sType; const void* pNext; - MTLBuffer_id mtlBuffer; + MTLBuffer_id SDL_UNSAFE_UNRETAINED mtlBuffer; } VkImportMetalBufferInfoEXT; typedef struct VkExportMetalTextureInfoEXT { @@ -143,14 +151,14 @@ typedef struct VkExportMetalTextureInfoEXT { VkImageView imageView; VkBufferView bufferView; VkImageAspectFlagBits plane; - MTLTexture_id mtlTexture; + MTLTexture_id SDL_UNSAFE_UNRETAINED mtlTexture; } VkExportMetalTextureInfoEXT; typedef struct VkImportMetalTextureInfoEXT { VkStructureType sType; const void* pNext; VkImageAspectFlagBits plane; - MTLTexture_id mtlTexture; + MTLTexture_id SDL_UNSAFE_UNRETAINED mtlTexture; } VkImportMetalTextureInfoEXT; typedef struct VkExportMetalIOSurfaceInfoEXT { @@ -171,13 +179,13 @@ typedef struct VkExportMetalSharedEventInfoEXT { const void* pNext; VkSemaphore semaphore; VkEvent event; - MTLSharedEvent_id mtlSharedEvent; + MTLSharedEvent_id SDL_UNSAFE_UNRETAINED mtlSharedEvent; } VkExportMetalSharedEventInfoEXT; typedef struct VkImportMetalSharedEventInfoEXT { VkStructureType sType; const void* pNext; - MTLSharedEvent_id mtlSharedEvent; + MTLSharedEvent_id SDL_UNSAFE_UNRETAINED mtlSharedEvent; } VkImportMetalSharedEventInfoEXT; typedef void (VKAPI_PTR *PFN_vkExportMetalObjectsEXT)(VkDevice device, VkExportMetalObjectsInfoEXT* pMetalObjectsInfo); diff --git a/SDL2/src/video/vita/SDL_vitamessagebox.c b/SDL2/src/video/vita/SDL_vitamessagebox.c index dc57d28b..6811748c 100644 --- a/SDL2/src/video/vita/SDL_vitamessagebox.c +++ b/SDL2/src/video/vita/SDL_vitamessagebox.c @@ -26,13 +26,13 @@ #include "SDL_vitamessagebox.h" #include -#ifdef SDL_VIDEO_RENDER_VITA_GXM +#if SDL_VIDEO_RENDER_VITA_GXM #include "../../render/vitagxm/SDL_render_vita_gxm_tools.h" #endif /* SDL_VIDEO_RENDER_VITA_GXM */ int VITA_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) { -#ifdef SDL_VIDEO_RENDER_VITA_GXM +#if SDL_VIDEO_RENDER_VITA_GXM SceMsgDialogParam param; SceMsgDialogUserMessageParam msgParam; SceMsgDialogButtonsParam buttonParam; diff --git a/SDL2/src/video/wayland/SDL_waylandevents.c b/SDL2/src/video/wayland/SDL_waylandevents.c index a8382812..a5105a2f 100644 --- a/SDL2/src/video/wayland/SDL_waylandevents.c +++ b/SDL2/src/video/wayland/SDL_waylandevents.c @@ -994,6 +994,13 @@ static void keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, return; } + if (input->xkb.keymap != NULL) { + /* if there's already a keymap loaded, throw it away rather than leaking it before + * parsing the new one + */ + WAYLAND_xkb_keymap_unref(input->xkb.keymap); + input->xkb.keymap = NULL; + } input->xkb.keymap = WAYLAND_xkb_keymap_new_from_string(input->display->xkb_context, map_str, XKB_KEYMAP_FORMAT_TEXT_V1, @@ -1016,6 +1023,13 @@ static void keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, input->xkb.idx_caps = 1 << GET_MOD_INDEX(CAPS); #undef GET_MOD_INDEX + if (input->xkb.state != NULL) { + /* if there's already a state, throw it away rather than leaking it before + * trying to create a new one with the new keymap. + */ + WAYLAND_xkb_state_unref(input->xkb.state); + input->xkb.state = NULL; + } input->xkb.state = WAYLAND_xkb_state_new(input->xkb.keymap); if (!input->xkb.state) { SDL_SetError("failed to create XKB state\n"); @@ -1061,10 +1075,18 @@ static void keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, } /* Set up XKB compose table */ + if (input->xkb.compose_table != NULL) { + WAYLAND_xkb_compose_table_unref(input->xkb.compose_table); + input->xkb.compose_table = NULL; + } input->xkb.compose_table = WAYLAND_xkb_compose_table_new_from_locale(input->display->xkb_context, locale, XKB_COMPOSE_COMPILE_NO_FLAGS); if (input->xkb.compose_table) { /* Set up XKB compose state */ + if (input->xkb.compose_state != NULL) { + WAYLAND_xkb_compose_state_unref(input->xkb.compose_state); + input->xkb.compose_state = NULL; + } input->xkb.compose_state = WAYLAND_xkb_compose_state_new(input->xkb.compose_table, XKB_COMPOSE_STATE_NO_FLAGS); if (!input->xkb.compose_state) { @@ -1299,6 +1321,12 @@ static void keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard, Wayland_Keymap keymap; const uint32_t modstate = (mods_depressed | mods_latched | mods_locked); + if (input->xkb.state == NULL) { + /* if we get a modifier notification before the keymap, there's nothing we can do with the information + */ + return; + } + WAYLAND_xkb_state_update_mask(input->xkb.state, mods_depressed, mods_latched, mods_locked, 0, 0, group); diff --git a/SDL2/src/video/wayland/SDL_waylandmouse.c b/SDL2/src/video/wayland/SDL_waylandmouse.c index 4abc654c..59570e22 100644 --- a/SDL2/src/video/wayland/SDL_waylandmouse.c +++ b/SDL2/src/video/wayland/SDL_waylandmouse.c @@ -156,10 +156,35 @@ static SDL_bool wayland_dbus_read_cursor_theme(char **theme) #endif + +static const char *GetLegacyCursorName(SDL_SystemCursor system_cursor) +{ + switch (system_cursor) { + case SDL_SYSTEM_CURSOR_ARROW: return "left_ptr"; + case SDL_SYSTEM_CURSOR_IBEAM: return "xterm"; + case SDL_SYSTEM_CURSOR_WAIT: return "watch"; + case SDL_SYSTEM_CURSOR_CROSSHAIR: return "tcross"; + case SDL_SYSTEM_CURSOR_WAITARROW: return "watch"; + case SDL_SYSTEM_CURSOR_SIZENWSE: return "top_left_corner"; + case SDL_SYSTEM_CURSOR_SIZENESW: return "top_right_corner"; + case SDL_SYSTEM_CURSOR_SIZEWE: return "sb_h_double_arrow"; + case SDL_SYSTEM_CURSOR_SIZENS: return "sb_v_double_arrow"; + case SDL_SYSTEM_CURSOR_SIZEALL: return "fleur"; + case SDL_SYSTEM_CURSOR_NO: return "pirate"; + case SDL_SYSTEM_CURSOR_HAND: return "hand2"; + case SDL_NUM_SYSTEM_CURSORS: break; /* so the compiler might notice if an enum value is missing here. */ + } + + SDL_assert(0); + return NULL; +} + static SDL_bool wayland_get_system_cursor(SDL_VideoData *vdata, Wayland_CursorData *cdata, float *scale) { struct wl_cursor_theme *theme = NULL; struct wl_cursor *cursor; + const char *cssname = NULL; + const char *fallback_name = NULL; char *xcursor_size; int size = 0; @@ -231,54 +256,28 @@ static SDL_bool wayland_get_system_cursor(SDL_VideoData *vdata, Wayland_CursorDa } /* Next, find the cursor from the theme... */ - switch (cdata->system_cursor) { - case SDL_SYSTEM_CURSOR_ARROW: - cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "left_ptr"); - break; - case SDL_SYSTEM_CURSOR_IBEAM: - cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "xterm"); - break; - case SDL_SYSTEM_CURSOR_WAIT: - cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "watch"); - break; - case SDL_SYSTEM_CURSOR_CROSSHAIR: - cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "tcross"); - break; - case SDL_SYSTEM_CURSOR_WAITARROW: - cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "watch"); - break; - case SDL_SYSTEM_CURSOR_SIZENWSE: - cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "top_left_corner"); - break; - case SDL_SYSTEM_CURSOR_SIZENESW: - cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "top_right_corner"); - break; - case SDL_SYSTEM_CURSOR_SIZEWE: - cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "sb_h_double_arrow"); - break; - case SDL_SYSTEM_CURSOR_SIZENS: - cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "sb_v_double_arrow"); - break; - case SDL_SYSTEM_CURSOR_SIZEALL: - cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "fleur"); - break; - case SDL_SYSTEM_CURSOR_NO: - cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "pirate"); - break; - case SDL_SYSTEM_CURSOR_HAND: - cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "hand2"); - break; - default: - SDL_assert(0); - return SDL_FALSE; + cssname = SDL_GetCSSCursorName(cdata->system_cursor, &fallback_name); + + cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, cssname); + if (!cursor && fallback_name) { + cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, fallback_name); + } + + /* try the legacy name if the fancy new CSS name doesn't work... */ + if (!cursor) { + cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, GetLegacyCursorName(cdata->system_cursor)); } /* Fallback to the default cursor if the chosen one wasn't found */ + if (!cursor) { + cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "default"); + } + /* Try the old X11 name as a last resort */ if (!cursor) { cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "left_ptr"); - if (!cursor) { - return SDL_FALSE; - } + } + if (!cursor) { + return SDL_FALSE; } /* ... Set the cursor data, finally. */ diff --git a/SDL2/src/video/wayland/SDL_waylandvideo.c b/SDL2/src/video/wayland/SDL_waylandvideo.c index 2cae4717..9b593cc9 100644 --- a/SDL2/src/video/wayland/SDL_waylandvideo.c +++ b/SDL2/src/video/wayland/SDL_waylandvideo.c @@ -478,17 +478,8 @@ static void display_handle_geometry(void *data, { SDL_WaylandOutputData *driverdata = data; - SDL_VideoDisplay *display; - int i; if (driverdata->wl_output_done_count) { - /* Clear the wl_output ref so Reset doesn't free it */ - display = SDL_GetDisplay(driverdata->index); - for (i = 0; i < display->num_display_modes; i += 1) { - display->display_modes[i].driverdata = NULL; - } - - /* Okay, now it's safe to reset */ SDL_ResetDisplayModes(driverdata->index); /* The display has officially started over. */ @@ -600,7 +591,6 @@ static void display_handle_done(void *data, native_mode.h = driverdata->native_height; } native_mode.refresh_rate = (int)SDL_round(driverdata->refresh / 1000.0); /* mHz to Hz */ - native_mode.driverdata = driverdata->output; /* The scaled desktop mode */ SDL_zero(desktop_mode); @@ -622,7 +612,6 @@ static void display_handle_done(void *data, desktop_mode.h = driverdata->width; } desktop_mode.refresh_rate = (int)SDL_round(driverdata->refresh / 1000.0); /* mHz to Hz */ - desktop_mode.driverdata = driverdata->output; /* * The native display mode is only exposed separately from the desktop size if the @@ -1014,7 +1003,7 @@ static int Wayland_GetDisplayDPI(_THIS, SDL_VideoDisplay *sdl_display, float *dd static void Wayland_VideoCleanup(_THIS) { SDL_VideoData *data = _this->driverdata; - int i, j; + int i; Wayland_QuitWin(data); Wayland_FiniMouse(data); @@ -1030,10 +1019,6 @@ static void Wayland_VideoCleanup(_THIS) SDL_free(display->driverdata); display->driverdata = NULL; - for (j = display->num_display_modes; j--;) { - display->display_modes[j].driverdata = NULL; - } - display->desktop_mode.driverdata = NULL; SDL_DelVideoDisplay(i); } data->output_list = NULL; diff --git a/SDL2/src/video/wayland/SDL_waylandwindow.c b/SDL2/src/video/wayland/SDL_waylandwindow.c index 08df3638..483ec192 100644 --- a/SDL2/src/video/wayland/SDL_waylandwindow.c +++ b/SDL2/src/video/wayland/SDL_waylandwindow.c @@ -1994,6 +1994,13 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) c = _this->driverdata; window->driverdata = data; + if (!(window->flags & SDL_WINDOW_VULKAN)) { + if (!(window->flags & SDL_WINDOW_OPENGL)) { + SDL_GL_LoadLibrary(NULL); + window->flags |= SDL_WINDOW_OPENGL; + } + } + if (window->x == SDL_WINDOWPOS_UNDEFINED) { window->x = 0; } diff --git a/SDL2/src/video/windows/SDL_windowsevents.c b/SDL2/src/video/windows/SDL_windowsevents.c index ca1b9bbc..8e05c414 100644 --- a/SDL2/src/video/windows/SDL_windowsevents.c +++ b/SDL2/src/video/windows/SDL_windowsevents.c @@ -1803,7 +1803,10 @@ void SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata) int WIN_WaitEventTimeout(_THIS, int timeout) { if (g_WindowsEnableMessageLoop) { - if (MsgWaitForMultipleObjects(0, NULL, FALSE, (DWORD)timeout, QS_ALLINPUT)) { + DWORD dwMilliseconds, ret; + dwMilliseconds = timeout < 0 ? INFINITE : (DWORD)timeout; + ret = MsgWaitForMultipleObjects(0, NULL, FALSE, dwMilliseconds, QS_ALLINPUT); + if (ret == WAIT_OBJECT_0) { return 1; } else { return 0; diff --git a/SDL2/src/video/windows/SDL_windowskeyboard.c b/SDL2/src/video/windows/SDL_windowskeyboard.c index c325242f..1ae4fe00 100644 --- a/SDL2/src/video/windows/SDL_windowskeyboard.c +++ b/SDL2/src/video/windows/SDL_windowskeyboard.c @@ -1321,9 +1321,9 @@ STDMETHODIMP IPPASink_QueryInterface(TSFSink *sink, REFIID riid, PVOID *ppv) STDMETHODIMP IPPASink_OnActivated(TSFSink *sink, DWORD dwProfileType, LANGID langid, REFCLSID clsid, REFGUID catid, REFGUID guidProfile, HKL hkl, DWORD dwFlags) { - static const GUID TF_PROFILE_DAYI = { 0x037B2C25, 0x480C, 0x4D7F, { 0xB0, 0x27, 0xD6, 0xCA, 0x6B, 0x69, 0x78, 0x8A } }; + static const GUID SDL_TF_PROFILE_DAYI = { 0x037B2C25, 0x480C, 0x4D7F, { 0xB0, 0x27, 0xD6, 0xCA, 0x6B, 0x69, 0x78, 0x8A } }; SDL_VideoData *videodata = (SDL_VideoData *)sink->data; - videodata->ime_candlistindexbase = WIN_IsEqualGUID(&TF_PROFILE_DAYI, guidProfile) ? 0 : 1; + videodata->ime_candlistindexbase = WIN_IsEqualGUID(&SDL_TF_PROFILE_DAYI, guidProfile) ? 0 : 1; if (WIN_IsEqualIID(catid, &GUID_TFCAT_TIP_KEYBOARD) && (dwFlags & TF_IPSINK_FLAG_ACTIVE)) { IME_InputLangChanged((SDL_VideoData *)sink->data); } diff --git a/SDL2/src/video/windows/SDL_windowsopengl.c b/SDL2/src/video/windows/SDL_windowsopengl.c index 803b6a08..ba505f1e 100644 --- a/SDL2/src/video/windows/SDL_windowsopengl.c +++ b/SDL2/src/video/windows/SDL_windowsopengl.c @@ -549,11 +549,11 @@ static int WIN_GL_ChoosePixelFormatARB(_THIS, int *iAttribs, float *fAttribs) _this->gl_data->wglChoosePixelFormatARB(hdc, iAttribs, fAttribs, 1, &pixel_format, &matching); - } - /* Check whether we actually got an SRGB capable buffer */ - _this->gl_data->wglGetPixelFormatAttribivARB(hdc, pixel_format, 0, 1, &qAttrib, &srgb); - _this->gl_config.framebuffer_srgb_capable = srgb; + /* Check whether we actually got an SRGB capable buffer */ + _this->gl_data->wglGetPixelFormatAttribivARB(hdc, pixel_format, 0, 1, &qAttrib, &srgb); + _this->gl_config.framebuffer_srgb_capable = srgb; + } _this->gl_data->wglMakeCurrent(hdc, NULL); _this->gl_data->wglDeleteContext(hglrc); diff --git a/SDL2/src/video/x11/SDL_x11mouse.c b/SDL2/src/video/x11/SDL_x11mouse.c index 6d2a4630..beb69417 100644 --- a/SDL2/src/video/x11/SDL_x11mouse.c +++ b/SDL2/src/video/x11/SDL_x11mouse.c @@ -220,64 +220,53 @@ static SDL_Cursor *X11_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) return cursor; } -static SDL_Cursor *X11_CreateSystemCursor(SDL_SystemCursor id) +static unsigned int GetLegacySystemCursorShape(SDL_SystemCursor id) { - SDL_Cursor *cursor; - unsigned int shape; - switch (id) { - default: - SDL_assert(0); - return NULL; - /* X Font Cursors reference: */ - /* http://tronche.com/gui/x/xlib/appendix/b/ */ - case SDL_SYSTEM_CURSOR_ARROW: - shape = XC_left_ptr; - break; - case SDL_SYSTEM_CURSOR_IBEAM: - shape = XC_xterm; - break; - case SDL_SYSTEM_CURSOR_WAIT: - shape = XC_watch; - break; - case SDL_SYSTEM_CURSOR_CROSSHAIR: - shape = XC_tcross; - break; - case SDL_SYSTEM_CURSOR_WAITARROW: - shape = XC_watch; - break; - case SDL_SYSTEM_CURSOR_SIZENWSE: - shape = XC_top_left_corner; - break; - case SDL_SYSTEM_CURSOR_SIZENESW: - shape = XC_top_right_corner; - break; - case SDL_SYSTEM_CURSOR_SIZEWE: - shape = XC_sb_h_double_arrow; - break; - case SDL_SYSTEM_CURSOR_SIZENS: - shape = XC_sb_v_double_arrow; - break; - case SDL_SYSTEM_CURSOR_SIZEALL: - shape = XC_fleur; - break; - case SDL_SYSTEM_CURSOR_NO: - shape = XC_pirate; - break; - case SDL_SYSTEM_CURSOR_HAND: - shape = XC_hand2; - break; + /* X Font Cursors reference: */ + /* http://tronche.com/gui/x/xlib/appendix/b/ */ + case SDL_SYSTEM_CURSOR_ARROW: return XC_left_ptr; + case SDL_SYSTEM_CURSOR_IBEAM: return XC_xterm; + case SDL_SYSTEM_CURSOR_WAIT: return XC_watch; + case SDL_SYSTEM_CURSOR_CROSSHAIR: return XC_tcross; + case SDL_SYSTEM_CURSOR_WAITARROW: return XC_watch; + case SDL_SYSTEM_CURSOR_SIZENWSE: return XC_top_left_corner; + case SDL_SYSTEM_CURSOR_SIZENESW: return XC_top_right_corner; + case SDL_SYSTEM_CURSOR_SIZEWE: return XC_sb_h_double_arrow; + case SDL_SYSTEM_CURSOR_SIZENS: return XC_sb_v_double_arrow; + case SDL_SYSTEM_CURSOR_SIZEALL: return XC_fleur; + case SDL_SYSTEM_CURSOR_NO: return XC_pirate; + case SDL_SYSTEM_CURSOR_HAND: return XC_hand2; + case SDL_NUM_SYSTEM_CURSORS: break; /* so the compiler might notice if an enum value is missing here. */ } - cursor = SDL_calloc(1, sizeof(*cursor)); - if (cursor) { - Cursor x11_cursor; + SDL_assert(0); + return 0; +} - x11_cursor = X11_XCreateFontCursor(GetDisplay(), shape); +static SDL_Cursor *X11_CreateSystemCursor(SDL_SystemCursor id) +{ + SDL_Cursor *cursor = NULL; + Display *dpy = GetDisplay(); + Cursor x11_cursor = None; - cursor->driverdata = (void *)(uintptr_t)x11_cursor; - } else { - SDL_OutOfMemory(); +#ifdef SDL_VIDEO_DRIVER_X11_XCURSOR + if (SDL_X11_HAVE_XCURSOR) { + x11_cursor = X11_XcursorLibraryLoadCursor(dpy, SDL_GetCSSCursorName(id, NULL)); + } +#endif + + if (x11_cursor == None) { + x11_cursor = X11_XCreateFontCursor(dpy, GetLegacySystemCursorShape(id)); + } + + if (x11_cursor != None) { + cursor = SDL_calloc(1, sizeof(*cursor)); + if (!cursor) { + SDL_OutOfMemory(); + } else { + cursor->driverdata = (void *)(uintptr_t)x11_cursor; + } } return cursor; diff --git a/SDL2/src/video/x11/SDL_x11sym.h b/SDL2/src/video/x11/SDL_x11sym.h index 9de95e45..450c07eb 100644 --- a/SDL2/src/video/x11/SDL_x11sym.h +++ b/SDL2/src/video/x11/SDL_x11sym.h @@ -253,6 +253,7 @@ SDL_X11_MODULE(XCURSOR) SDL_X11_SYM(XcursorImage*,XcursorImageCreate,(int a,int b),(a,b),return) SDL_X11_SYM(void,XcursorImageDestroy,(XcursorImage *a),(a),) SDL_X11_SYM(Cursor,XcursorImageLoadCursor,(Display *a,const XcursorImage *b),(a,b),return) +SDL_X11_SYM(Cursor,XcursorLibraryLoadCursor,(Display *a, const char *b),(a,b),return) #endif /* Xdbe support */ diff --git a/SDL2/test/testautomation_math.c b/SDL2/test/testautomation_math.c index ef9b40b3..314d8ba7 100644 --- a/SDL2/test/testautomation_math.c +++ b/SDL2/test/testautomation_math.c @@ -82,7 +82,7 @@ helper_dtod(const char *func_name, d_to_d_func func, Uint32 i; for (i = 0; i < cases_size; i++) { const double result = func(cases[i].input); - SDLTest_AssertCheck((result - cases[i].expected) < FLT_EPSILON, + SDLTest_AssertCheck(SDL_fabs(result - cases[i].expected) < FLT_EPSILON, "%s(%f), expected %f, got %f", func_name, cases[i].input, @@ -117,11 +117,10 @@ helper_dtod_inexact(const char *func_name, d_to_d_func func, max_err = -max_err; } SDLTest_AssertCheck(diff <= max_err, - "%s(%f), expected [%f,%f], got %f", + "%s(%f), expected %f +/- %g, got %f", func_name, cases[i].input, - cases[i].expected - EPSILON, - cases[i].expected + EPSILON, + cases[i].expected, max_err, result); } @@ -182,11 +181,10 @@ helper_ddtod_inexact(const char *func_name, dd_to_d_func func, } SDLTest_AssertCheck(diff <= max_err, - "%s(%f,%f), expected [%f,%f], got %f", + "%s(%f,%f), expected %f +/- %g, got %f", func_name, cases[i].x_input, cases[i].y_input, - cases[i].expected - EPSILON, - cases[i].expected + EPSILON, + cases[i].expected, max_err, result); } @@ -1114,7 +1112,7 @@ exp_regularCases(void *args) { 112.89, 10653788283588960962604279261058893737879589093376.0 }, { 539.483, 1970107755334319939701129934673541628417235942656909222826926175622435588279443011110464355295725187195188154768877850257012251677751742837992843520967922303961718983154427294786640886286983037548604937796221048661733679844353544028160.0 }, }; - return helper_dtod("Exp", SDL_exp, regular_cases, SDL_arraysize(regular_cases)); + return helper_dtod_inexact("Exp", SDL_exp, regular_cases, SDL_arraysize(regular_cases)); } /* SDL_log tests functions */ @@ -1161,7 +1159,7 @@ log_baseCases(void *args) 1.0, 0.0, result); result = SDL_log(EULER); - SDLTest_AssertCheck((result - 1.) < FLT_EPSILON, + SDLTest_AssertCheck(SDL_fabs(result - 1.) < FLT_EPSILON, "Log(%f), expected %f, got %f", EULER, 1.0, result); diff --git a/SDL2/test/testautomation_surface.c b/SDL2/test/testautomation_surface.c index fcc4bc14..e86704a6 100644 --- a/SDL2/test/testautomation_surface.c +++ b/SDL2/test/testautomation_surface.c @@ -346,7 +346,9 @@ int surface_testCompleteSurfaceConversion(void *arg) SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGRA8888, +#if 0 /* We aren't testing HDR10 colorspace conversion */ SDL_PIXELFORMAT_ARGB2101010, +#endif }; SDL_Surface *face = NULL, *cvt1, *cvt2, *final; SDL_PixelFormat *fmt1, *fmt2;