Commit Graph

6928 Commits (41d6c80b0710f5a977fb4ccffc5f6833819cebb7)

Author SHA1 Message Date
Ozkan Sezer ae18109a92 SDL_windowsjoystick.c (SDL_CreateDeviceNotification): use L, not TEXT()
cf. bug #5435.
2021-01-04 01:23:50 +03:00
Ozkan Sezer 390fd14f54 SDL_windowswindow.c (SDL_HelperWindowCreate): adjust for ANSI/UNICODE:
change SDL_HelperWindowClassName and SDL_HelperWindowName from WCHAR *
to be const TCHAR*

cf. bug #5435.
2021-01-04 01:23:50 +03:00
Ozkan Sezer 398d2764c7 RAWINPUT_InitWindowsGamingInput: change pNamespace from LPTSTR to PCWSTR
because WindowsCreateStringReference specifically accepts const WCHAR *
- WGI_JoystickInit(): ditto.

cf. bug #5435.
2021-01-04 01:23:50 +03:00
Ozkan Sezer f09e0af7aa SDL_dinputjoystick.c (IsXInputDevice): adjust to be ANSI/UNICODE-agnostic
cf. bug #5435.
2021-01-04 01:23:50 +03:00
Ozkan Sezer ed39f2f3f9 SDL_wasapi_win32.c (WASAPI_PlatformThreadInit): use L instead of TEXT()
because AvSetMmThreadCharacteristicsW specifically accepts WCHAR* input
cf. bug #5435.
2021-01-04 01:23:50 +03:00
Ozkan Sezer 01a2f27679 consistently use TEXT() macro with LoadLibrary() and GetModuleHandle()
cf. bug #5435.
2021-01-04 01:23:50 +03:00
Cameron Gutman 91a831e2d0 Implement SDL_MostSignificantBitIndex32 using MSVC intrinsics 2021-01-03 14:02:55 -06:00
Cameron Gutman 014f507c40 Use specific acquire and release variants of InterlockedExchange on ARM
_InterlockedExchange_rel() is required for correctness on ARM because
the _ReadWriteBarrier() macro is only a compiler memory barrier, not a
hardware memory barrier. Due to ARM's relaxed memory model, this means
the '*lock = 0' write may be observed before the operations inside the
lock, causing possible corruption of data protected by the lock.

_InterlockedExchange_acq() is more efficient on ARM because it avoids an
expensive full memory barrier that _InterlockedExchange() does.
2021-01-03 12:13:40 -06:00
Sam Lantinga 393c8c1f16 Fixed bug 5440 - MacCatalyst build failures
C.W. Betts

I tested building commit http://hg.libsdl.org/SDL/rev/7adf3fdc19f3 on Mac Catalyst and found some issues:

* MTLFeatureSet_iOS_* enums aren't available under Mac Catalyst.
* OpenGL ES is unavailable under Mac Catalyst.
* Some Metal features are available under Catalyst but not iOS, such as displaySyncEnabled.
* Set Metal as the default renderer on Mac Catalyst

Attaching a patch that will make SDL2 build for Mac Catalyst.
2021-01-03 10:32:55 -08:00
Cameron Gutman 115d66e756 Use MSVC _byteswap intrinsics for SDL byteswapping functions
This generates bswap on x86/x64 and rev on ARM
2021-01-02 12:50:01 -06:00
Cameron Gutman 6cbd4417f0 Add a hint for D3D9Ex to avoid having to choose at compile-time 2021-01-02 14:45:15 -06:00
Cameron Gutman 59594a7891 Implement PAUSE_INSTRUCTION() for Windows ARM platforms 2021-01-02 13:43:04 -06:00
Sam Lantinga 6f9e18da2a Fixed bug 5441 - Add support for endianness check on FreeBSD: Fixes endianness checking on at least powerpc64le, maybe also other architectures
VVD

Patch based on patch from FreeBSD port devel/sdl20:
https://svnweb.freebsd.org/ports/head/devel/sdl20/files/patch-include_SDL__endian.h?view=log
2021-01-03 10:18:39 -08:00
Sylvain Becker fea49a3e2f SDL_stretch.c: compilation NEON on Windows 10 2021-01-03 15:24:47 +01:00
Sylvain Becker acccc71f27 Fixed bug 5436 - MSVC 2019 ARM64 build fails to compile SDL_stretch.c 2021-01-02 22:31:44 +01:00
Sam Lantinga 9130f7c377 Updated copyright for 2021 2021-01-02 10:25:38 -08:00
Cameron Gutman 414ddc32c5 Do not wait in GetOverlappedResult() in hid_read_timeout()
This is unsafe because the event is auto-reset, therefore the call to
WaitForSingleObject() resets the event which GetOverlappedResult() will
try to wait on.

Even though the overlapped operation is guaranteed to be completed at
the point we call GetOverlappedResult(), it will still wait on the event
handle for a short time to trigger the reset for auto-reset events. This
amounts to roughly a 100 ms sleep each time GetOverlappedResult() is called
for a completed I/O with a non-signalled event.

In the context of HIDAPI, this extra sleep means that callers that loop
on hid_read_timeout() with timeout=0 will loop forever, since the 100 ms
sleep each iteration ensures ReadFile() will always have new data.
2021-01-01 17:34:07 -06:00
Sam Lantinga 963c9495d3 Fixed bug 5431 - SDL_Metal_GetDrawableSize is inaccurate for high dpi displays if a Metal view has not already been created
Caleb Cornett

For a window created with SDL_WINDOW_ALLOW_HIGHDPI, SDL_GL_GetDrawableSize will return the high-dpi drawable size even before any GL context creation happens. But SDL_Metal_GetDrawableSize will return the size of the window if the Metal view has not been created. This is confusing and inconsistent behavior.

An easy way to test this is to build testgl2 and testvulkan on macOS with the SDL_WINDOW_ALLOW_HIGHDPI flag enabled during window creation. The GL2 program will report a drawable size of 2x window width and 2x window height, while the Vulkan program will report the window size.

This patch addresses the issue by falling back to using the content view dimensions if no Metal view exists in the window. (The code for this was taken directly from Cocoa_GL_GetDrawableSize.) With this change, the testvulkan behavior matches that of testgl2.

Note that I haven't tested for this issue on UIKit. It's possible a similar change will need to be made there too.
2021-01-02 10:11:08 -08:00
Sam Lantinga d25eff6505 Fixed bug 5429 - spinlock implements PAUSE_INSTRUCTION for PPC platforms
David Carlier

This form of 'or' provides a hint that performance
will probably be improved if shared resources dedicated
to the executing processor are released for use by other
processors
2021-01-02 10:06:22 -08:00
Sam Lantinga f0b6c78733 Fixed Windows XP compatibility with recent hidapi commit 2021-01-02 09:58:08 -08:00
Sylvain Becker 3edf337d66 Simplify RenderGetViewportSize 2021-01-02 17:29:34 +01:00
Sylvain Becker 2af765da11 SDL_RenderGetViewportF: only need the size of viewport (see bug #5424) 2021-01-02 17:18:13 +01:00
Sylvain Becker 41597249e8 SDL_RenderGetViewportF: remove debug messages 2021-01-02 16:15:22 +01:00
Sylvain Becker 8c48c4238a Add SDL_RenderGetViewportF: fix lost of precision while scaling (see bug #5424) 2021-01-02 16:12:30 +01:00
Sylvain Becker c005267fb1 SDL_BlitScaled: better and safer fix clipping bug #2687
And re-use SDL_round(), since it's been re-added
(remove in https://hg.libsdl.org/SDL/rev/34043108b7e4 )
2021-01-02 09:38:19 +01:00
Sylvain Becker 2127ed2574 SDL_SoftStretch: add a check for input pixel format
and function re-naming
2021-01-02 09:28:16 +01:00
Ozkan Sezer b5f0483cb3 fix permissions 2021-01-01 22:30:28 +03:00
Sam Lantinga ab55ec4850 Fix use-after-free SBH corruption due to overlapped ReadFile in hidapi not being canceled for all threads before device close
- hidapi already called CancelIo on hid_close but that only cancels pending IO for the current thread. Controller read/writes originate from multiple
  threads (serialized, but on a different thread nonetheless) but device destruction was always done on the main device thread which left any
  pending overlapped reads still running after hidapi's internal read buffer is deallocated leading to intermittent free list corruption.
2021-01-01 11:12:41 -08:00
Sam Lantinga 480c1f9fef Make sure we're not starving report reads when there's lots of rumble 2021-01-01 11:12:36 -08:00
Sam Lantinga 223af86c62 Added SDL_RenderGetD3D11Device() to get access to the device associated with the D3D11 renderer 2021-01-01 11:12:30 -08:00
Sam Lantinga 5f0b2a7f54 Fixed resource leak with D3D11 NV12 textures 2021-01-01 11:12:22 -08:00
Manuel Alfayate Corchete 21003b7db2 [KMS/DRM] Small refactoring on the SwapWindow function. 2020-12-31 14:31:29 +01:00
Manuel Alfayate Corchete e1fb969b76 [KMS/DRM] Correct comments about last bugfix. 2020-12-31 01:40:15 +01:00
Manuel Alfayate Corchete e34caa9779 [KMS/DRM] Correct EGL/GL library loading on window creation, thus saving window re-creation. 2020-12-31 01:31:57 +01:00
Sylvain Becker d81fe9239f SDL_BlitScaled: remove un needed -1 +1 offset in calculation 2020-12-30 22:03:32 +01:00
Ozkan Sezer 8476df3e31 SDL_mixer.c: remove calls to non-existing m68k asm code. 2020-12-30 23:55:10 +03:00
Ozkan Sezer 5b2e011e6d SDL_endian.h: minor fixes from SDL-1.2 branch
( forward-port of changesets 3909:6832b00d3594 and 5657:529d23724144 )
2020-12-30 23:55:02 +03:00
Sam Lantinga 5aba082703 Build SDL for Mac hardware when targeting iOS 2020-12-30 11:38:51 -08:00
Sylvain Becker 590a5469ed Fixed bug 5424 - Renderer doesn't use entirely the viewport when scaling is used
Viewport/Clip dimensions are calculated usingg SDL_ceil whereas all renders use SDL_floor
2020-12-30 16:12:14 +01:00
Ozkan Sezer a88071deb5 configure.ac: directfb dynamic loading support updates:
put back sed on find_lib result, remove debug messages,
fix directfb_lib report to user.
2020-12-30 15:55:00 +03:00
Ozkan Sezer f24cc903a2 remove CFLAGS save/restores from dbus.h and ibus.h header checks.
CPPFLAGS is what AC_CHECK_HEADER needs.
2020-12-30 15:53:56 +03:00
Ozkan Sezer 88eaf356a7 minor update to test/acinclude.m4 (pkg.m4) 2020-12-30 15:53:20 +03:00
Ozkan Sezer 92edee2324 SDL_config_android.h: update SIZEOF_VOIDP define to respect __LP64__ 2020-12-30 01:28:02 +03:00
Ozkan Sezer 7c105f12d5 updates to SDL_config_os2.h 2020-12-30 01:21:10 +03:00
Ozkan Sezer 1cdc1d4890 SDL_config.h.cmake, SDL_config.h.in: update for SIZEOF_VOIDP define 2020-12-30 01:00:24 +03:00
Ozkan Sezer 9fc139dfb5 SDL_config_windows.h: add missing HAVE_STRTOULL along side HAVE_STRTOLL 2020-12-30 01:00:24 +03:00
Ozkan Sezer b76b81b0e4 SDL_config.h.cmake, SDL_config.h.in: add os/2 driver defines
in case autofoo or cmake is used for it some day..
2020-12-30 01:00:24 +03:00
Ozkan Sezer 8a32ee24db removed MSVC strtok_s use from SDL_strtokr().
no other ??_s are used elsewhere in SDL_stdinc. besides, C11 has a
strtok_s with a different signature.
2020-12-30 01:00:24 +03:00
Sam Lantinga 0684572ccc Added a hint to control whether the player LEDs should be lit to indicate which player is associated with a PS5 controller. 2020-12-29 12:13:10 -08:00
Ozkan Sezer 6116ccf035 fix configure warnings when checking dbus/dbus.h and ibus-1.0/ibus.h
.. by adding DBUS_CFLAGS and IBUS_CFLAGS to CPPFLAGS:

configure: WARNING: dbus/dbus.h: accepted by the compiler, rejected by the preprocessor!
configure: WARNING: dbus/dbus.h: proceeding with the compiler's result
configure: WARNING: ibus-1.0/ibus.h: accepted by the compiler, rejected by the preprocessor!
configure: WARNING: ibus-1.0/ibus.h: proceeding with the compiler's result
2020-12-29 21:20:28 +03:00