Commit graph

10324 commits

Author SHA1 Message Date
Alex Szpakowski
584e9b8cf6 iOS: fix build 2018-01-01 19:40:29 -04:00
Alex Szpakowski
ab9047d439 metal: Use sampler state objects instead of shader-declared samplers for linear vs nearest filtering.
This avoids a ton of shader duplication once multiple shaders that use samplers are added (e.g. the currently missing YUV shaders).
2018-01-01 19:37:16 -04:00
Alex Szpakowski
f6752e16ff metal: Add support for custom blend modes. 2018-01-01 18:06:27 -04:00
Alex Szpakowski
857571199f metal: implement SDL_RenderCopyEx, and fix a memory leak in SDL_CreateTexture. 2017-12-31 21:06:16 -04:00
Alex Szpakowski
56b4f2c655 metal: Use the existing cocoa code for creating a Metal view on macOS. Fixes the renderer size when the window is resized. 2017-12-31 15:30:08 -04:00
Alex Szpakowski
ac386a6a17 macOS: Fix MoltenVK Metal view resizing, and allow the metal view to be used without vulkan. 2017-12-31 15:21:25 -04:00
Ryan C. Gordon
877b4d55f3 winrt: Add mmdevapi.lib dependency to WinRT8.1 builds, for WASAPI support. 2017-12-31 03:51:17 -05:00
Ryan C. Gordon
176e3ba105 winrt: workaround for pre-UWP builds.
There's probably a better way to do this for legacy platforms, though.
2017-12-31 03:36:54 -05:00
Ryan C. Gordon
752cd6649a windows: Use WaitForSingleObjectEx() always
This is available since Windows XP, so it's safe to use always, not just in
a WinRT ifdef.
2017-12-31 03:35:41 -05:00
Ryan C. Gordon
65ac88f6df wasapi: Patched to compile on non-UWP WinRT builds. 2017-12-31 03:34:16 -05:00
Ryan C. Gordon
9e11bde509 winrt: Disabled Windows Phone 8.0 builds.
It lacks APIs we need for WASAPI and probably no one will miss it. 8.1 is
still supported.
2017-12-31 03:17:18 -05:00
Ryan C. Gordon
5330756d55 winrt: bumped SDL's shipping version number in winrtbuild.ps1 2017-12-31 03:13:33 -05:00
Alex Szpakowski
3668dd8ac9 metal: Respect the vsync flag on macOS 10.13+. 2017-12-30 22:39:55 -04:00
Alex Szpakowski
0d72a31759 metal: use a projection matrix instead of manually transforming vertices into clip space on the CPU. 2017-12-30 20:32:22 -04:00
Alex Szpakowski
94f975ceac metal: only 4 (instead of 5) vertices are needed to draw rectangles and textures, and only 3 (instead of 5) vertices are needed to cover the screen for the 'full-screen quad' when clearing. 2017-12-30 18:48:07 -04:00
Ryan C. Gordon
e4884ccd2e xcode: Add Metal and QuartCore to everything as a weak_framework.
--HG--
extra : amend_source : 351d631ed41aae1f7a0ff8f8875958abf9b99808
2017-12-30 14:40:39 -05:00
Alex Szpakowski
7a58568a49 macOS: Make sure the desktop's display mode is always in SDL's list of display modes. 2017-12-29 22:13:40 -04:00
Sam Lantinga
59ea3b0b37 Fixed bug 4001 - Android, prevent error message box to crash
Sylvain

Prevent the error message box to crash after being clicked.
Because of "SDLActivity.mSingleton.finish();"
2017-12-19 11:19:10 -08:00
Sam Lantinga
b94ab49142 Fixed bug 4000 - SDL2 on raspberry: mouse displayed at 0,0 after SDL_ShowCursor
Laurent Merckx

I have a problem with the SDL_ShowCursor method on Raspberry.

Depending on the context, my application hides or show the mouse cursor with SDL_ShowCursor.
But when calling SDL_ShowCursor(true), the cursor is displayed at 0,0 (and not at last position).

After debugging sources by myself, it seems that the problem is in SDL_rpimouse.c - RPI_ShowCursor:

vc_dispmanx_rect_set( &dst_rect, 0, 0, curdata->w, curdata->h);
should be
vc_dispmanx_rect_set( &dst_rect, mouse->x, mouse->y, curdata->w, curdata->h);

For me, it solves the problem.
2017-12-19 11:17:37 -08:00
Sam Lantinga
603ab1d8b2 Fixed bug 4003 - HAVE_POLL undefined in SDL_poll.c, making it impossible to use.
tomwardio

HAVE_POLL is correctly defined in SDL_config.h when running configure. However, in the only place where it's used, it's undefined at the start of the file.
2017-12-19 11:14:06 -08:00
Sam Lantinga
8e756fcf3e Fixed bug 4004 - iOS: don't hide keyboard on RETURN
Dominik Reichardt

As discussed in 2012 the iOS onscreen keyboard hides when you hit RETURN (see https://discourse.libsdl.org/t/on-screen-keyboard-change/19216).
IMO this is a bad idea to not be able to influence this behavior and just recently this was fixed for Android by adding the hint SDL_HINT_ANDROID_RETURN_HIDES_IME in changeset 11768	0f2fb9ec6ad6.
2017-12-19 10:57:21 -08:00
Sam Lantinga
61322e904c Fixed bug 4005 - Android, SDL_IsGameController() crashes is index is out of range
Sylvain

On Android, if you give an invalid index to SDL_IsGameController(), it will crash in SDL_SYS_IsDPAD_DeviceIndex().
2017-12-19 10:48:29 -08:00
Sam Lantinga
6e62d312ea Fixed default Android D-PAD mapping so the back button is treated as B 2017-12-16 10:40:47 -08:00
Sam Lantinga
c251324f2f Fixed handling of the Apple TV remote buttons
The menu button on the remote is the back button
2017-12-16 10:40:45 -08:00
Sam Lantinga
7bb51d1142 Added support for the ASUS TV500BG Android gamepad 2017-12-16 10:40:43 -08:00
Sam Lantinga
047df473a4 Added Android build script for SDL 2017-12-16 10:40:41 -08:00
Ryan C. Gordon
eeb5c074b1 wasapi: switched to event-driven interface.
This reduces latency and improves battery life.

--HG--
extra : rebase_source : 94378e202c98258e9b59c454a8c81fe11470b956
2017-12-13 14:35:55 -05:00
Ryan C. Gordon
161fc4aa6e windows: Fixed a comment.
--HG--
extra : rebase_source : 94621aac2da4199e3f79fb63c3bfd8db49d63a4e
2017-12-12 22:25:39 -05:00
Sam Lantinga
46339ac88b Moved deployment target values to project settings 2017-12-12 22:30:21 -08:00
Sam Lantinga
1872077ebd Parameterized the All (target platform) build target scripts so they can be used in other projects 2017-12-12 21:59:39 -08:00
Sam Lantinga
44e7397995 Fixed bug 3992 - SDL_GetColorKey doesn't set error message
Luke A. Guest

SDL_GetColorKey does not set an error message on failure. The current source just returns -1.

The documentation https://wiki.libsdl.org/SDL_GetColorKey?highlight=%28%5CbCategoryAPI%5Cb%29%7C%28SDLFunctionTemplate%29 says to call SDL_GetError but that is useless in this case.
2017-12-12 16:37:23 -08:00
Sam Lantinga
35623271c9 Fixed bug 3981 - Inverted logic bug in SDL_renderer "overscan" feature
Eric wing

There is a tiny bug in the new overscan code for the SDL_renderer.

In SDL_renderer.c, line 1265, the if check for SDL_strcasecmp with "direct3d" needs to be inverted.

Instead of:
if(SDL_strcasecmp("direct3d", SDL_GetCurrentVideoDriver())) {

It should be:
if(0 == SDL_strcasecmp("direct3d", SDL_GetCurrentVideoDriver())) {

This bug causes the "overscan" mode to pretty much be completely ignored in all cases and all things remain letterboxed (as before the feature).
2017-12-12 16:34:16 -08:00
Sam Lantinga
308b7a6719 Fixed bug 3993 - altivec.h include in SDL_cpuinfo.h breaks compilation with -std=c++11
bastien.bouclet

According to this GCC bug report, altivec.h requires building with the gnu extensions: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78263.

As an application developer, I don't want SDL to force me to enable the gnu extensions.
2017-12-12 16:25:43 -08:00
Sam Lantinga
814d3d5cb9 Fixed bug 3996 - Corrupted or over-released critical section on SDL_Quit (SDL_event_watchers_lock)
Andrew

This likely comes down to an additional 'unlock' being called before destroying it, without a matching 'lock'.
2017-12-12 16:10:20 -08:00
Sam Lantinga
63b451412b Add the ability to set SDL to handle Return as 'hide IME' on Android softkeyboard. (thanks Rachel!) 2017-12-12 12:52:23 -08:00
Sam Lantinga
9827268cfa Added support for Android video textures 2017-12-12 12:52:17 -08:00
Sam Lantinga
1e762408f2 Merged latest changes from rel/streaming_client 2017-12-12 12:52:09 -08:00
Sam Lantinga
f54dfe1db9 Renamed Xcode build targets so it's easier to copy files out of build directories on the command line
Also enabled bitcode, which is needed for App Store builds
2017-12-12 12:14:55 -08:00
Sam Lantinga
6f4390917e Added SDL_uikitmetalview.m to the tvOS project 2017-12-12 11:29:00 -08:00
Sam Lantinga
eb219e2a04 Fixed bug 3999 - Build failed when try to build with configure script for Android 2017-12-11 14:44:34 -08:00
Sam Lantinga
aef30f74b7 Check for immintrin.h before using it in SDL_cpuinfo.h 2017-12-11 12:00:12 -08:00
Sam Lantinga
fb4a93f4a6 Fixed Windows gcc build 2017-12-11 11:47:52 -08:00
Sam Lantinga
df9ab55151 The newer compilers generate the property boilerplate automatically 2017-12-11 11:34:53 -08:00
Sam Lantinga
945f36aba6 Fixed Mac OS X build 2017-12-11 11:02:51 -08:00
Sam Lantinga
adbccd304f Workaround for bug 3931 - spurious SDL_MOUSEMOTION events with SDL_HINT_MOUSE_RELATIVE_MODE_WARP 1 since Windows 10 Fall Creators update
Elisée Maurer

The attached minimal program sets the SDL_HINT_MOUSE_RELATIVE_MODE_WARP to 1, enables relative mouse mode then logs all SDL_MOUSEMOTION xrel values as they happen.

When moving the mouse exclusively to the right:

 * On a Windows 10 installation before Fall Creators update (for instance, Version	10.0.15063 Build 15063), only positive values are reported, as expected
 * On a Windows 10 installation after Fall Creators update (for instance, Version 10.0.16299 Update 16299), a mix of positive and negative values are reported.

3 different people have reproduced this bug and have confirmed it started to happen after the Fall Creators update was installed. It happens with SDL 2.0.7 as well as latest default branch as of today.

It seems like some obscure (maybe unintended) Windows behavior change? Haven't been able to pin it down more yet.

(To force-upgrade a Windows installation to the Fall Creators update, you can use the update assistant at https://www.microsoft.com/en-us/software-download/windows10)

Eric Wasylishen

Broken GetCursorPos / SetCursorPos based games on Win 10 fall creators are not limited to SDL.. I just tested winquake.exe (original 1997 exe) and it now has "jumps" in the mouse input if you try to look around in a circle. It uses GetCursorPos/SetCursorPos by default. Switching WinQuake to use directinput (-dinput flag) seems to get rid of the jumps.

Daniel Gibson

A friend tested on Win10 1607 (which is before the Fall Creators Update) and the  the bug doesn't occur there, so the regression that SetCursorPos() doesn't reliably generate mouse events was indeed introduced with that update.
I even reproduced it in a minimal WinAPI-only application (https://gist.github.com/DanielGibson/b5b033c67b9137f0280af9fc53352c68), the weird thing is that if you don't do anything each "frame" (i.e. the mainloop only polls the events and does nothing else), there are a lot of mouse events with the coordinates you passed to SetCursorPos(), but when sleeping for 10ms in each iteration of the mainloop, those events basically don't happen anymore. Which is bad, because in games the each iteration of the mainloop usually takes 16ms..

I have a patch now that I find acceptable.
It checks for the windows version with RtlGetVersion() (ff561910.aspx) and only if it's >= Win10 build 16299, enables the workaround.
All code is in video/windows/SDL_windowsevents.c
and the workaround is, that for each WM_MOUSEMOVE event, "if(isWin10FCUorNewer && mouseID != SDL_TOUCH_MOUSEID && mouse->relative_mode_warp)", an addition mouse move event is generated with the coordinates of the center of the screen
(SDL_SendMouseMotion(data->window, mouseID, 0, center_x, center_y);) - which is exactly what would happen if windows generated those reliably itself.
This will cause SDL_PrivateSendMouseMotion() to set mouse->last_x = center_x; and mouse->last_y = center_y; so the next mouse relative mouse event will be calculated correctly.

If Microsoft ever fixes this bug, the IsWin10FCUorNewer() function would have to
be adjusted to also check for a maximum version, so the workaround is then disabled again.
2017-12-10 09:17:33 -08:00
Sam Lantinga
b18d1fb786 Added SDL_WinRTGetDeviceFamily() to find out what type of device your application is running on (thanks Daniel Knobe!) 2017-12-10 09:10:02 -08:00
Sam Lantinga
259b102bf5 Added the Metal framework to several iOS tests 2017-12-10 09:09:27 -08:00
Sam Lantinga
be1dbd6b8f Backed out using pixel texture coordinates, it had weird visual side effects 2017-12-09 19:48:38 -08:00
Sam Lantinga
85a77617ea Fixed normalized coordinates when the viewport is set 2017-12-09 19:41:08 -08:00
Sam Lantinga
b70fcb5dcb Added support for linear sampling and pixel coordinates in the metal renderer 2017-12-09 15:00:41 -08:00