Commit graph

6817 commits

Author SHA1 Message Date
Ryan C. Gordon
e01e33bd00 video: Let video targets optionally decide their default OpenGL configs.
This is necessary because the Raspberry Pi is a strange beast, that believes
it has OpenGL support (through glX?) but generally has GLES2 support.

So when using the raspberry video target, we need to force this to default
to a GLES2 context, or by default SDL_CreateWindow() will fail, deep down
when it tries to load the proper GL library.

Fixes testsprite2 (and basically everything else that wasn't testgles2) when
run on a Raspberry Pi without a X server.

Please note that other targets might also need this filled in, the Raspberry
Pi is just the most prominent and readily-available System-On-A-Chip style
thing on my desk.  :)
2017-09-02 19:35:32 -04:00
Ryan C. Gordon
b4c19f59ef sndio: Patched to compile if SIO_DEVANY isn't defined.
(It isn't in whatever Raspbian is currently shipping.)
2017-09-02 16:41:14 -04:00
Sam Lantinga
0e9e7cd616 Fixed bug 3792 - [KMS/DRM] Wrong GBM format
Romain Tisserand

Using KMS/DRM driver from WIP SDL2.0.6 on Linux/ARM SoC RockChip RK3328 (ARM Mali 450 MP2 GPU).

The current code is using GBM_BO_FORMAT_XRGB8888 as GBM buffer format specifier.

The Mali driver (it has been confirmed some other vendor implementations too) expects GBM_FORMAT_XRGB8888.

The Mesa implementation is actually handling both values as the same, but it's not implemented like this into every gbm.h vendor header.

https://github.com/ideak/mesa/blob/master/src/gbm/backends/dri/gbm_dri.c

So with stock SDL2 on my card (Mali vendor implementation), it does not work, eglCreateWindowSurface fails, and gbm_is_format_supported fails too (with the BO variant).
It runs fine with GBM_FORMAT_XRGB8888.

Here is a link of the gbm.h from Mali user-space driver :

https://github.com/rockchip-linux/libmali/blob/rockchip/include/gbm.h
2017-09-01 12:54:38 -07:00
Ryan C. Gordon
a5187f96e2 x11: Correctly restore previous GL context after sacrificial context is done. 2017-09-01 14:08:09 -04:00
Ryan C. Gordon
736a5a3ed0 x11: don't try to make a NULL GL context current when we already did that. 2017-09-01 14:00:11 -04:00
Ryan C. Gordon
bb79b54f02 x11: Clean up sacrificial GL context code.
Check for failures, restore any previously-current context.
2017-09-01 13:57:40 -04:00
Ryan C. Gordon
6364eeecf2 x11: Make a sacrificial glX context to check for extensions during init.
This is necessary because we need to see if GLES compat extensions exist.

All of this code (including ShouldUseTextureFramebuffer()) should be
revisited after 2.0.6 ships; ideally we don't make throwaway contexts if
we can avoid it...but maybe we can't. I hear Vulkan is pretty cool.

Fixes Bugzilla #3725.

--HG--
extra : amend_source : 77a9461044721501192684414d7dc757e677691f
2017-09-01 13:27:53 -04:00
Alex Szpakowski
4ae6c39788 macOS: Update controller mapping of Steelseries Stratus XL to account for reversed thumbstick y-axis values (bug #3483). 2017-08-31 22:07:28 -03:00
Alex Szpakowski
60f43da150 macOS: Fix menubar items being enabled when they shouldn't be. 2017-08-31 21:34:29 -03:00
Alex Szpakowski
b3d4bde6d0 Code style cleanup in the Cocoa and UIKit vulkan files. 2017-08-31 21:26:13 -03:00
Alex Szpakowski
ef384efe5a macOS: Prevent unwanted native fullscreen (Spaces) toggles when the window is in fullscreen or isn't resizable. Fixes bug #3691. 2017-08-31 21:13:32 -03:00
Sam Lantinga
f3c99e56d3 Fixed bug 3483 - Steelseries Nimbus MFi controller reversed Y-axis analog stick
benjamin.feng

Probable underlying cause: https://bugzilla.libsdl.org/show_bug.cgi?id=3124#c5

"If you download and build the HID Calibrator sample you can see that these are totally legitimate HID devices (except for inverting the Y-axis of joysticks, which is contrary to the HID specification but does make them more compatible with games compiled expecting XBOX controllers)."
2017-08-30 23:30:24 -07:00
Sam Lantinga
3ef9b11d46 Convert tabs to spaces in game controller database entries 2017-08-30 23:02:39 -07:00
Sam Lantinga
26a66653f0 Added some missing render capability flags 2017-08-29 23:14:39 -07:00
Sam Lantinga
1b6d6467db Fixed line breaks in verbose test logging output 2017-08-29 23:12:26 -07:00
Sam Lantinga
6ba1d5eed3 Added some debug messaging for previously unhandled events 2017-08-29 22:52:17 -07:00
Sam Lantinga
78c184a3e0 The dummy video driver check is now covered by explicitly checking for cocoa above. 2017-08-29 22:24:59 -07:00
Sam Lantinga
13fe9240dd Fixed bug 3616 - SDL_GL_CreateContext fails with SDL_GL_CONTEXT_DEBUG_FLAG and ANGLE/GLES 2.0
Colin Barrett

Using the pre-built x86 devel libs from here:
https://www.libsdl.org/release/SDL2-devel-2.0.5-VC.zip

If I have:

SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);

and I'm using ANGLE/(a GL driver that doesn't provide an ES2 context) such that SDL_EGL_CreateContext is called by SDL_GL_CreateContext, I get the error "Could not create EGL context (context attributes are not supported)" and no context is created.

Looking at the code in SDL_EGL_CreateContext - if gl_config.flags is non-zero, it looks like the code in the section guarded with "#ifdef EGL_KHR_create_context" should be executed - but it apparently isn't.

Is it possible this section hasn't been compiled into the pre-built libraries? If I build SDL2.dll myself using the Visual C++ solution (VS2015 Community Update 3) then the call succeeds as I expect
2017-08-29 22:04:43 -07:00
Sam Lantinga
3c1d56a2eb Fixed bug 3719 - Cocoa - Incorrect window size when leaving fullscreen
bastien.bouclet

When exiting a "fullscreen space" on OS X, windows don't go to their defined "windowed mode size", but go back to their previous size.

Steps to reproduce:
1. Create a windowed mode SDL window
2. Toggle it to fullscreen with the SDL_WINDOW_FULLSCREEN_DESKTOP flag
3. While in fullscreen, change the windowed mode size using SDL_SetWindowSize
4. Toggle the window back to windowed mode

Expected result:
- The window has the size specified during step 3.

Actual result:
- The window has the size specified when creating the window in step 1.

Attached is a minimal reproduction test case.
The attached test case works as expected on X11 and Windows.
2017-08-29 21:42:22 -07:00
Ryan C. Gordon
c4eca8c2d6 egl: Cast to size_t, in case platform's NativeDisplayType isn't a pointer.
(fixes compiler warnings on QNX.)
2017-08-29 16:30:49 -04:00
Ryan C. Gordon
fca3874ab4 Fixed a bunch of compiler warnings.
--HG--
extra : rebase_source : a2c94cfaf300f4d9f5b7855489ed05c8e23de9fd
2017-08-29 15:52:49 -04: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
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
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
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
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
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
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
22149e8112 Fixed crash at shutdown if the window couldn't be created 2017-08-27 21:05:18 -07:00
Sam Lantinga
27e5963b8f Added the new Vulkan API functions to exported functions 2017-08-27 20:41:29 -07:00