Commit graph

10435 commits

Author SHA1 Message Date
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
Sam Lantinga
ab67a90256 Fixed compiler warning 2017-12-09 13:05:56 -08:00
Sam Lantinga
60e8a20b88 Fixed pixel positioning and size for the Metal renderer 2017-12-09 12:58:41 -08:00
Ryan C. Gordon
5da972e7ff metal: fixed render target support.
--HG--
extra : rebase_source : 0d438b9eca6be9264b9f005beba23bdee94eb884
2017-12-09 03:28:23 -05:00
Ryan C. Gordon
32d7f91409 metal: Added some comments and FIXMEs.
--HG--
extra : rebase_source : 6a5b3bcfbb43cc34b72d646617c09af26f16632e
2017-12-09 03:27:52 -05:00
Ryan C. Gordon
74a52b465d audio: fixed typo in Doxygen comment.
--HG--
extra : rebase_source : daf1f903439d66b9e81d35831fb72960ced55111
2017-12-09 03:24:01 -05:00
Sam Lantinga
e938e315b8 Removed duplicate entry for SDL_wasapi.h 2017-12-08 16:12:53 -08:00
Ryan C. Gordon
9d117dde2b metal: Cleaned up some reference count politics.
--HG--
extra : rebase_source : 96d3ab1460cf610112d7fcbfc056c6a9faec3455
2017-12-08 18:26:26 -05:00
Ryan C. Gordon
c18637e736 hints: Add "metal" to the list of SDL_RENDER_DRIVER hints.
--HG--
extra : rebase_source : f474551b0c211cb7dbd5ee610692c728b24b701a
2017-12-08 17:43:57 -05:00
Sam Lantinga
f16b7e735b Added SDL_RenderGetMetalLayer() and SDL_RenderGetMetalCommandEncoder() 2017-12-08 14:30:10 -08:00
Sam Lantinga
021f7dab32 Fixed Metal renderer memory leak 2017-12-08 13:20:20 -08:00
Ryan C. Gordon
122fb6329f metal: Don't check if Metal is available if targeting modern macOS versions.
--HG--
extra : rebase_source : f007831a3ff9aebb17ec3529e6fee4c3ad63d0b1
2017-12-08 14:03:36 -05:00
Sam Lantinga
f9a5278047 Minor cleanup 2017-12-08 12:02:23 -08:00
Sam Lantinga
d8cb066822 Fixed minor memory leak in the Metal renderer 2017-12-08 11:35:19 -08:00
Sam Lantinga
644fefb7ac Added check for failure of D3D_ActivateRenderer() 2017-12-08 11:34:32 -08:00
Sam Lantinga
507ab36373 Fixed compiler warning 2017-12-08 11:33:27 -08:00
Sam Lantinga
2abcf193b5 Fixed bug 1878 - Scaled texture draws with filtering produce wrapping artifacts.
Yuri K. Schlesner

When using texture filtering, there are filtering artifacts visible on the edges of scaled textures, where the texture filtering pulls in texels from the other side of the texture. Using clamping texture modes wouldn't completely fix this since source rectangles don't need to cover the whole texture. (See screenshot attached in next post.)

The opengl driver uses clamping on textures and so avoid this at least in the cases where the source rect is the whole texture. The direct3d driver does not and so has problems in every case. I'm not sure if it can actually completely be fixed, but at least enabling clamping for direct3d would be one step in the right direction.
2017-12-08 11:09:05 -08:00
Ryan C. Gordon
6e1c6946b9 configure: List Metal in video drivers.
--HG--
extra : rebase_source : f5a3e33689d899707204aafed145cdf4ba0c389e
2017-12-08 00:49:35 -05:00
Sam Lantinga
bb8d2413ee Defer getting the next drawable until we actually start rendering
This works better for games where there may be a bunch of simulation logic that needs to be run before the next rendering pass, and prevents blocking if the next drawable is busy.
2017-12-08 08:58:02 -08:00
Sam Lantinga
577d7d42ff Fixed runtime errors on iOS 2017-12-07 18:08:51 -08:00
Sam Lantinga
7e4560664b Fixed building for simulators or older iOS SDKs 2017-12-07 17:47:01 -08:00
Sam Lantinga
40be7cbc97 Fixed compiling Metal renderer on iOS 2017-12-07 17:12:03 -08:00
Sam Lantinga
6fc4a1cdb8 Added iOS and OSX versions of the Metal shaders 2017-12-07 16:08:47 -08:00
Sam Lantinga
9167983c42 Enable building the Metal renderer by default, and weak link the Metal framework so the SDL library is safe to use on older Macs
Also generate iOS versions of the Metal shaders
2017-12-07 16:08:09 -08:00
Ryan C. Gordon
e1fb05694a Initial shot at a renderer target for Apple's Metal API.
This isn't complete, but is enough to run testsprite2. It's currently
Mac-only; with a little work to figure out how to properly glue in a Metal
layer to a UIView, this will likely work on iOS, too.

This is only wired up to the configure script right now, and disabled by
default. CMake and Xcode still need their bits filled in as appropriate.
2016-04-21 03:16:44 -04:00
Sam Lantinga
fe18e7a263 The Metal view is a full SDL_uikitview to support multi-touch 2017-12-07 09:35:28 -08:00
Ryan C. Gordon
52fe36d1db cocoa: Added two missing files from hg changeset bc7ca7cfa6ca.
Fixes Bugzilla #3975.
2017-12-06 16:37:55 -05:00
Ryan C. Gordon
1745441419 audio: Port WASAPI to WinRT, remove XAudio2 backend.
XAudio2 doesn't have capture support, so WASAPI was to replace it; the holdout
was WinRT, which still needed it as its primary audio target until the WASAPI
code code be made to work.

The support matrix now looks like:

WinXP: directsound by default, winmm as a fallback for buggy drivers.
Vista+: WASAPI (directsound and winmm as fallbacks for debugging).
WinRT: WASAPI

--HG--
extra : amend_source : a28a9a9fbb09c4c25df05fa0a754fce0bee62335
extra : histedit_source : e5727ceb1a5db5806ce02534d8ffe4892eb6f5d9
2017-12-06 12:24:32 -05:00
Ryan C. Gordon
8b08b7b07b winrt: Patched to compile on Ryan's workstation. :)
I'm not sure why I needed this, but it appears to fix the build on VS2015 here.

--HG--
extra : histedit_source : e4022c72f88f23afe4ab15164ac46e1a71a22ebb
2017-12-06 13:48:51 -05:00
Sam Lantinga
acf393af0d Fixed bug 3974 - Fix SDL_WarpMouseInWindow on both KMSDRM and RaspberryPi drivers
Manuel Alfayate Corchete

This patch fixes SDL_WarpMouseInWindow() in both the KMSDRM and Raspberry Pi graphic backends.
2017-12-04 20:37:01 -08:00
Sam Lantinga
34553b8de0 Fixed bug 3975 - Add GLES2 support for macOS via ANGLE library
Andrey

Seems latest google angle library successfully built & tested under macOS'es.

https://github.com/google/angle

We need to use GLES2 to implement true cross-platform code.
2017-12-04 20:35:01 -08:00
Sam Lantinga
860acadf69 Removed spurious debug output 2017-12-04 20:26:09 -08:00
Olli Kallioinen
aea84272a5 Fixed SDL_Log not working on windows if the output is being redirected. 2017-12-04 19:28:03 +02:00
Sam Lantinga
a5b3e11d5c Fixed typos (thanks Martin!) 2017-12-04 20:21:52 -08:00
Sam Lantinga
de2314ec6b Fixed name of eglCreatePbufferSurface function 2017-12-03 20:27:08 -08:00
Sam Lantinga
cabb4b1035 Fixed bug 3945 - Add eglCreatePbufferSurface function
tomwardio

Proposed patch loads eglCreatePbufferSurface in same manner as other 1.1 functors. This allows custom video drivers to create pbuffer surfaces.
2017-12-03 20:25:55 -08:00
Sam Lantinga
abea243f22 Non-resizable windows need to have their window rect set to the client rect 2017-11-28 18:31:18 -08:00
Sam Lantinga
21571e1012 Use the included Khronos headers on Android so we can create Core OpenGL contexts when building with older SDK 2017-11-27 15:07:07 -08:00
Sam Lantinga
2f30c13333 Fixed bug 3980 - Fix for KMSDRM driver where cursor would not be shown on some gfx hardware because of unsupported cursor size
Manuel Alfayate Corchete

This fixes a problem with KMSDRM on some graphics hardware where only bigger cursor sizes are supported, such as current Intel gfx. (The kernel-side driver is what limits this: had to look for failing IOCTLs...)
That caused SDL_SetCursor() to fail silently, and we were left with a missing cursor without further explanation.
With this patch, different "standard" sizes are tried and a bigger one is used (with an intermediate and clean buffer only used to write the new cursor to the BO where it will live after) if we get, let's say, 16x16 which is pretty common but our hardware does not support that.
2017-11-24 12:03:28 -08:00
Sam Lantinga
bc8014e1db Fixed bug 3979 - Failed to link with "multiple definition of `scalbln'" error on both MinGW and MinGW-w64 by CMake
Vitaly Novichkov

Once I ran build of my codecs collection on AppVeyor where my CMake script downloads latest SDL2 from HG repo, failed to link because of math functions conflict:

https://ci.appveyor.com/project/Wohlstand/audiocodecs/build/1.0.44
The revision is b94292eebb5c

There are both vanilla MinGW and MinGW-w64 are failed to build.


```
[100%] Linking C shared library libSDL2.dll
c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../libmingwex.a(scalbn.o):(.text+0x0): multiple definition of `scalbln'
CMakeFiles\SDL2.dir/objects.a(s_scalbn.c.obj):C:/projects/audiocodecs/build-MinGW-Release-Win32/external/SDL2/src/SDL2HG/src/libm/s_scalbn.c:30: first defined here
2017-11-24 03:01:07 -08:00