Commit Graph

6605 Commits

Author SHA1 Message Date
Manuel Alfayate Corchete
661bacfe27 [KMS/DRM] Add Vulkan suport to the KMSDRM_LEGACY backend.Minor text spacing tweaks for better readability. Comment out unused function. 2021-01-07 00:47:21 +01:00
Ozkan Sezer
dfb0afe36a fix build after commit 5730b2005da1 2021-01-07 00:41:32 +03:00
Manuel Alfayate Corchete
67e0b1dd4e [KMS/DRM] Rewrite KMSDRM_LEGACY backend to accomodate Vulkan compatibility. Fix several bugs on that backend. 2021-01-06 22:15:26 +01:00
Sylvain Becker
57a5c45372 Fix D3D11 UpdateTextureNV in non fullscreen (bug #5430) 2021-01-05 22:06:51 +01:00
Sylvain Becker
fc61ecb25c Fix software UpdateNVTexture non fullscreen (bug #5430) 2021-01-05 21:54:03 +01:00
Sylvain Becker
204ef3b509 Fix D3D11 UpdateNVTexture (bug #5430) 2021-01-05 20:38:31 +01:00
Sylvain Becker
c0df40e003 Add more SDL_HAVE_YUV defines 2021-01-05 17:39:48 +01:00
Ozkan Sezer
dc0e5de974 Update config.guess and config.sub from mainstream.
Recognizes riscv32be and riscv64be.
2021-01-05 17:10:02 +03:00
Ozkan Sezer
76295cecf3 video/windows: ANSI/UNICODE updates (cf. bug 5435):
- explicitly use UNICODE versions of DrawText, EnumDisplaySettings,
  EnumDisplayDevices, and CreateDC: the underlying structures have
  WCHAR strings.
- change WIN_UpdateDisplayMode and WIN_GetDisplayMode() to accept
  LPCWSTR instead of LPCTSTR for the same reason.
- change WIN_StringToUTF8 and WIN_UTF8ToString to the explicit 'W'
  versions where appropriate.
2021-01-05 15:50:10 +03:00
Ozkan Sezer
265a1cc97a use WIN_StringToUTF8W instead of WIN_StringToUTF8 where needed (#2)
cf. bug #5435.
- SDL_wasapi_win32.c (GetWasapiDeviceName): pwszVal is WCHAR*
- windows/SDL_sysfilesystem.c (SDL_GetBasePath, SDL_GetPrefPath)
- windows/SDL_sysurl.c (SDL_SYS_OpenURL): wurl is WCHAR*
- SDL_windowssensor.c (ConnectSensor): bstr_name is WCHAR*
- windows/SDL_systhread.c (SDL_SYS_SetupThread): strw is WCHAR*
2021-01-05 15:50:02 +03:00
Ozkan Sezer
516042b4d6 ran gendynapi.pl after SDL_UpdateNVTexture addition 2021-01-05 15:15:50 +03:00
Ozkan Sezer
31751bdcce wmmsg.h: constified wmtab 2021-01-05 15:15:37 +03:00
Sylvain Becker
b032504162 Fix unused variable warning on METAL (see bug #5430) 2021-01-05 12:36:34 +01:00
Sylvain Becker
c1eb9ecf99 Add SDL_UpdateNVTexture for META (bug #5430)
(not tested)
2021-01-05 12:29:43 +01:00
Sylvain Becker
73d93dbc38 Fix compilation on Window10 (see bug #5430) 2021-01-05 12:20:02 +01:00
Sylvain Becker
df6b813108 Fix compilation (implicit declaration of function) (see bug #5430) 2021-01-05 12:16:32 +01:00
Sylvain Becker
d1f031c8ee Add SDL_UpdateNVTexture for d3d11 (bug #5430)
(not tested)
2021-01-05 12:08:16 +01:00
Sylvain Becker
f5eba2ccd6 Fixed invalid read in yuv_rgb_sse() (see bug #5430) 2021-01-05 12:00:54 +01:00
Sylvain Becker
be4cfd51c3 Add SDL_UpdateNVTexture() to update NV12/21 Texture (bug #5430)
for renderer software, opengl, and opengles2
2021-01-05 11:56:22 +01:00
Sam Lantinga
d72dbd9883 Fixed detection of the Wooting Two keyboard, which shows up as an Xbox 360 controller 2021-01-04 17:30:28 -08:00
Sam Lantinga
b2a0c712cb Allow setting the player index to -1, which turns off the player LED for PS5 controllers 2021-01-04 12:24:44 -08:00
Sam Lantinga
bf754b52bf Valve contributed code is under the Zlib license 2021-01-04 12:17:24 -08:00
Ozkan Sezer
8cb421b26d SDL_windows_main.c: use new WIN_StringToUTF8W macro 2021-01-04 10:20:10 +03:00
Ozkan Sezer
a594b85031 use WIN_StringToUTF8W macro instead of WIN_StringToUTF8, where needed:
i.e. where the string is known guaranteed to be WCHAR*, in:
- SDL_dinputjoystick.c (WIN_IsXInputDevice): VARIANT->var is BSTR (WCHAR*)
- SDL_rawinputjoystick.c (RAWINPUT_AddDevice): string is WCHAR*
- SDL_windows_gaming_input.c (IEventHandler_CRawGameControllerVtbl_InvokeAdded):
  string is WCHAR*

There should be more of these..
2021-01-04 10:00:30 +03:00
Ozkan Sezer
5b14bbff5f make ANSI/UNICODE versions of WIN??UTF8 macros individually available. 2021-01-04 10:00:10 +03:00
Ozkan Sezer
f2bd861cd7 move SDL_tcsstr definition to core/windows/SDL_windows.h 2021-01-04 08:50:00 +03:00
Ozkan Sezer
f414a43632 simplify Watcom implementation of SDL_MostSignificantBitIndex32() 2021-01-04 03:00:10 +03:00
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