Commit graph

11215 commits

Author SHA1 Message Date
Sam Lantinga
64283b7c0f Add a way to set the context when other activities are active so many SDL API functions still work. 2017-08-28 23:04:47 -07:00
Sam Lantinga
cbfddcec50 Fixed bug 3785 - fix windows build after revision 11382
Ozkan Sezer

fix windows build after revision 11382: commit 2c50e79b19e0 renamed
_SDL_msctf_h to SDL_msctf_h_ . SDL_windowskeyboard.c relies on that
macro, so update it accordingly.
2017-08-28 22:44:48 -07:00
Sam Lantinga
ac8d70a84e We removed QuartzCore link dependency in commit d459d8934897 2017-08-28 22:42:41 -07:00
Sam Lantinga
01bfc6aca9 Fixed Vulkan configure check for Android and added one for Mac OS X 2017-08-28 22:36:45 -07:00
Sam Lantinga
1c487929ed Fixed bug 3786 - building against a Mac OS X SDK < 10.11 fails since the vulkan merge
Ozkan Sezer

Since the Vulkan merge, building against a Mac OS X SDM older than
10.11 fails in SDL_cocoametalview.m because Metal.framework is not
present. There is no conditional compiling in SDL_cocoametalview.m
either, so --disable-video-vulkan doesn't help with anything. (The
configury doesn't check darwin for x86_64 either, but it's another
story.)

I cross-build against 10.8 SDK on linux using clang-3.4.2 and this
is a problem for me.  Will this be fixed?
2017-08-28 22:13:45 -07:00
Sam Lantinga
a86f7e738e Fixed bug 3662 - Error message when using the audio conversion setup without an initialized audio subsystem is a bit vague
Simon Hug

This issue actually raises the question if this API change (requirement of initialized audio subsystem) is breaking backwards compatibility. I don't see the documentation saying it is needed in 2.0.5.
2017-08-28 21:42:39 -07:00
Ryan C. Gordon
70aacb0db9 audio: A whole bunch of improvements to audio conversion (thanks, Solra!).
"Major changes, roughly in order of appearance:

- Use float math everywhere, instead of promoting to double and casting back
all the time.
- Conserve sound energy when downmixing any channel into two other channels.
- Add a QuadToStereo filter. (The previous technique of reusing StereoToMono
never worked, since it assumed an incorrect channel layout for 4.0.)
- Add a 71to51 filter. This removes just under half of the cases the previous
code would silently break in.
- Add a QuadTo51 filter. More silent breakage fixed.
- Add a 51to71 filter, removing another almost-half of the silently broken
cases.
- Add 8 to the list of values SDL_SupportedChannelCount will accept.
- Change SDL_BuildAudioCVT's channel-related logic to handle every case, and
to actually fail if it fails instead of silently corrupting sound data and/or
crashing down the road."

(Note that SDL doesn't otherwise support 7.1 audio yet, but hopefully it will
soon and the 7.1 converters are an important piece of that.  --ryan.)

Fixes Bugzilla #3727.

--HG--
extra : rebase_source : c61476a6434b4cfe1655f5d30332280cb4cd7af9
2017-08-29 00:41:45 -04:00
Ryan C. Gordon
a32e087d07 stdlib: An implementation of SDL_scalbn using ldexp() (thanks, Ozkan!).
Fixes Bugzilla #3767.

--HG--
extra : rebase_source : c8dfcbc036ca99ce20808a33204cd87ae9b3e4d2
2017-08-29 00:36:17 -04:00
Ryan C. Gordon
1641fd7c50 audio: Converting audio samples from int to float was using wrong equation.
Fixes Bugzilla #3775.

--HG--
extra : rebase_source : 960d1ec9d440bca3da46e50e8f14c3139eac756c
2017-08-29 00:02:04 -04:00
Sam Lantinga
8e5f46fa1d Fixed building with an older Mac OS X SDK 2017-08-28 20:52:05 -07:00
Sam Lantinga
ebe9688dd9 Vulkan support on Mac OS X introduces a link time dependency (CAMetalLayer) on 10.11 and newer 2017-08-28 19:32:08 -07:00
Sam Lantinga
a59b14cfcb We don't need the VULKAN_SDK to build SDL with Vulkan support anymore 2017-08-28 19:30:59 -07:00
Sam Lantinga
d2d5ffbe3e Added missing Visual Studio 2010 project for testvulkan 2017-08-28 17:28:09 -07:00
Sam Lantinga
21140a8024 Fixed compile warning 2017-08-28 14:45:19 -07:00
Sam Lantinga
756155d9b9 Added a log message for nativeRunMain() 2017-08-28 14:44:21 -07:00
Sam Lantinga
32a6dbb2ac Allow overriding the main entry point on Android 2017-08-28 14:40:21 -07:00
Sam Lantinga
b223cd8606 Removed the need for libSDL2main.a on Android, and separated JNI initialization out for other integrations 2017-08-28 14:34:15 -07:00
Sam Lantinga
297011fe09 Removed unneeded Vulkan symbol definitions 2017-08-28 13:40:32 -07:00
Sam Lantinga
09b61ab1fd Fixed bug 2361 - [Android] Joysticks do not have unique IDs
David Brady

When I attempted to make a mapping file for Android gamepads, I quickly discovered that most of the ones that I have here show up as the same device (Broadcom Bluetooth HID), meaning that it was impossible to make mappings on Android, since every device looked the same.

This patch will check for the existence of the getDescriptor function added in Jelly Bean, and use it if it's there.  The Android Dashboard says that the majority of Android phones should support this function, and doing it this way will not force us to bump up our API version.
2017-08-28 10:03:39 -07:00
Sam Lantinga
d1c0e570c8 Fixed bug 2277 - Hardware keyboard control key sequences don't get reported
chw

Control key sequences from hardware keyboards (wireless/USB/bluetooth) get not properly reported on Android devices.
The attached patch uses the idea from http://stackoverflow.com/questions/12337117/capture-all-ctrl-under-android to make control key sequences appear as normal SDL_KEYDOWN events instead of cooked text input.
2017-08-28 09:54:16 -07:00
Sam Lantinga
5fe342eefc Fixed 3783 - Default libGL path for directFB on Linux differs from x11 path
Clayton Craft

The default path used by directfb for libGL is different than the default path used by x11 in SDL2:

./src/video/directfb/SDL_DirectFB_opengl.c:
path = "libGL.so";

./src/video/x11/SDL_x11opengl.c:
#define DEFAULT_OPENGL  "libGL.so.1"

On at least one distro (Alpine Linux), libGL.so is not created (or more accurately the symlink to libGL.so.1 is not created). For consistency, the 'path' variable in SDL_DirectFB_opengl.c should patch the DEFAULT_OPENGL in SDL_x11opengl.c ("libGL.so.1")
2017-08-28 09:51:25 -07:00
Sam Lantinga
aa43fb4d66 Fixed bug 3781 - unbalanced #pragma pack(pop) in close_code.h
Ozkan Sezer

Revision 288 (http://hg.libsdl.org/SDL/rev/2f5a6062db86) excluded the
Watcom compiler from forcing 4 byte structure packing in begin_code.h.
However, it missed updating close_code.h, which now has an unbalanced
#pragma pack(pop) if the compiler is Watcom.  The issue seems to have
crawled into SDL2, too.
2017-08-28 09:41:00 -07:00
Sam Lantinga
314e598054 Instantiate the CAMetalLayer so SDL_Vulkan_CreateSurface() doesn't fail
Error message was:
[mvk-info] MoltenVK version 0.18.2. Vulkan version 1.0.51.
[***MoltenVK ERROR***] VK_ERROR_INITIALIZATION_FAILED: On-screen rendering requires a view that is backed by a layer of type CAMetalLayer.
2017-08-28 02:17:29.579 testvulkan[95627:1716939] ERROR: SDL_Vulkan_CreateSurface(): vkCreateMacOSSurfaceMVK failed: VK_ERROR_INITIALIZATION_FAILED
2017-08-28 02:30:41 -07:00
Sam Lantinga
73ca40b566 Fixed WinRT build after changing the header guard preprocessor symbol 2017-08-28 01:59:53 -07:00
Sam Lantinga
0722e9415a Fixed build when Wayland is dynamically loaded 2017-08-28 01:42:18 -07:00
Sam Lantinga
23e5cb1879 Fixed analyzer warning "Call to 'calloc' has an allocation size of 0 bytes" 2017-08-28 00:54:02 -07:00
Sam Lantinga
66ee57e4ca Fixed redefinition of typedef warnings and errors on BSD 2017-08-28 00:51:14 -07:00
Sam Lantinga
56dd9f257b Fixed mingw Windows build, since SDL_vulkan_internal.h includes windows.h 2017-08-28 00:43:14 -07:00
Sam Lantinga
f1e9abdefb Renaming of guard header names to quiet -Wreserved-id-macro 2017-08-28 00:22:23 -07:00
Sam Lantinga
15cb6b4932 Be clear that disabling Vulkan surface support disables the entire SDL Vulkan integration 2017-08-28 00:11:38 -07:00
Sam Lantinga
0d34d231b9 Fixed Android build with Vulkan support 2017-08-27 23:53:09 -07:00
Sam Lantinga
6cd49b2c22 Fixed code style for new Vulkan API functions 2017-08-27 23:39:55 -07:00
Sam Lantinga
9e1b2d83f3 Fixed Android ABI check to match vulkan/vk_platform.h 2017-08-27 23:39:38 -07:00
Sam Lantinga
8da41824a7 Make the androidbuildlibs.sh script executable 2017-08-27 23:31:31 -07:00
Sam Lantinga
eb767f3e1b Fixed typedef redefinition errors when including both SDL_vulkan.h and vulkan.h
You should always include vulkan/vulkan.h first, then include SDL_vulkan.h
2017-08-27 23:13:15 -07:00
Sam Lantinga
288267a066 Fixed Windows warning 2017-08-27 22:36:03 -07:00
Sam Lantinga
20d3636821 Fixed Android build 2017-08-27 22:34:15 -07:00
Sam Lantinga
06cb4018c7 Don't define Vulkan types if vulkan.h has already been included 2017-08-27 22:27:45 -07:00
Sam Lantinga
24c5115ef6 Added Vulkan support to the Visual Studio 2010 solution 2017-08-27 22:20:17 -07:00
Sam Lantinga
ca8b7d1e11 Don't need the Vulkan SDK for the Visual Studio 2008 project anymore 2017-08-27 21:55:31 -07:00
Sam Lantinga
22149e8112 Fixed crash at shutdown if the window couldn't be created 2017-08-27 21:05:18 -07:00
Sam Lantinga
4989a01939 We use the SDL Vulkan headers 2017-08-27 20:41:48 -07:00
Sam Lantinga
27e5963b8f Added the new Vulkan API functions to exported functions 2017-08-27 20:41:29 -07:00
Ryan C. Gordon
f4b87c2bcb vulkan: Include a copy of vulkan.h and vk_platform.h.
Now we can provide Vulkan support in the build even if the build box doesn't
have a Vulkan SDK, since we dynamically link to the library anyhow.

--HG--
extra : rebase_source : f4972489a15b276f65ea65c077172fdcbbe3420a
2017-08-27 23:25:12 -04:00
Sam Lantinga
3db6496688 Use SDL_Vulkan_GetDrawableSize() instead of SDL_GL_GetDrawableSize() 2017-08-27 19:32:08 -07:00
Ryan C. Gordon
a566435db1 vulkan: Initial Vulkan support!
This work was done by Jacob Lifshay and Mark Callow; I'm just merging it
into revision control.

--HG--
extra : rebase_source : cb3bb332146125366b5242c0d7444f44638733d9
extra : amend_source : c72ebb6d3a92efc3fdd085ce3b6d4b1d7f573cc9
2017-08-27 22:15:57 -04:00
Sam Lantinga
0ff15ac41b Fixed bug 3710 - SDL_OpenAudio(desired, obtained) doesn't update desired's size when obtained is NULL
David Ludwig

I've created a new set of patches.  I am happy to create more, if it would help.

One version only copies 'size'.

A second version copies both 'size' and 'silence'.  When looking over the documentation for SDL_OpenAudio in SDL_audio.h, it mentioned that both 'size' and 'silence' were things that SDL_OpenAudio would calculate.

Regarding *both* patches, I did notice that SDL 1.2 appears to have always modified desired's size and silence fields.  The SDL wiki, at https://wiki.libsdl.org/SDL_OpenAudio#Remarks , does note:
2017-08-27 19:10:30 -07:00
Sam Lantinga
b964d759ca Fixed bug 3724 - Allow Angle Static Link
Carlos

We would like to add a switch (define) that allows us to compile Angle statically with SDL. That is, getting rid of the OpenGL DLL. Usually you need OpenGL to be loaded dynamically as DLL because implementation is provided by the system but no need with Angle.

Only 2 files need modification and it shouldn't affect current behaivor:
include/SDL_egl.h and src/video/SDL_egl.c, as in here

https://github.com/native-toolkit/sdl/pull/10/files

The flag name could be SDL_VIDEO_STATIC_ANGLE (instead of NATIVE_TOOLKIT_STATIC_ANGLE) as discussed here https://github.com/native-toolkit/sdl/pull/10

We have tested this with both Windows and UWP, using NME engine (https://github.com/haxenme/nme).

Releated issue: https://bugzilla.libsdl.org/show_bug.cgi?id=1820
2017-08-27 19:05:57 -07:00
Sam Lantinga
7f84fc46a4 Fixed bug 3740 - atexit() in test/testime.c 2017-08-27 19:00:03 -07:00
Sam Lantinga
1bf8d4ca37 SDL_dynapi.c: add missing SDLCALL to macros. 2017-08-27 18:53:30 -07:00