Commit graph

10221 commits

Author SHA1 Message Date
Helge Deller e07f106760 testevdev: Fix detection of word size
The check for whether to use a 32- or 64-bit swap for an array of long
values always took the 64-bit path, because <limits.h> wasn't included
and therefore ULONG_MAX wasn't defined. Turn this into a runtime check,
which a reasonable compiler will optimize into a constant.

This fixes testevdev failures on 32-bit big-endian platforms such as hppa
and older powerpc. Little-endian and/or 64-bit platforms are unaffected.

[smcv: Added commit message]
Bug-Debian: https://bugs.debian.org/1021310
Co-authored-by: Simon McVittie <smcv@collabora.com>

(cherry-picked from commit fb32effd15)
2022-10-24 20:04:20 +03:00
Sam Lantinga 88e64108f5 Clarified that GNU sort isn't required, we just need the -V option to be supported
(cherry-picked from commit f687cbd4c6)
2022-10-24 20:04:20 +03:00
Sam Lantinga 1b5bf2ac65 GNU sort isn't available on older macOS and some BSD systems
Don't prevent building entirely, just warn that we won't be able to find dynamic libraries in this case.

Fixes https://github.com/libsdl-org/SDL/pull/6338
(cherry-picked from commit 8c587636dc)
2022-10-24 20:04:20 +03:00
Ozkan Sezer 679d33ab44 updated VS project file
(cherry-picked from commit e3b2830f99)
2022-10-24 20:04:20 +03:00
Ozkan Sezer 9e72ec4ed9 Makefile.w32: no need for the description field, we have a *.res already
(cherry-picked from commit 1b52145bad)
2022-10-24 20:04:20 +03:00
Ozkan Sezer 8104992064 testhaptic: fix watcom "&array may not produce intended result" warning
(cherry-picked from commit d022039529)
2022-10-24 20:04:20 +03:00
Ozkan Sezer 51958da000 loadso, dlsym, SDL_LoadFunction: cleanup the underscored name path.
- strlcpy was passed a wrong buffer length parameter. has worked so
  far by luck.
- use memcpy instead of strlcpy for simplicity.
- 'append' has been a typo: should be 'prepend'.

(cherry-picked from commit 3d415bc5d6)
2022-10-22 20:04:20 +03:00
Ozkan Sezer b435252b29 hidapi, libusb: remove os/2 symbol load hack after os/2 loadso updates
(cherry-picked from commit 65a38a4015)
2022-10-22 20:04:20 +03:00
Ozkan Sezer eb43d57880 os2 loadso improvements:
- SDL_LoadObject: upon failure, strip the .dll extension and retry,
  but only if module name has no path.
- SDL_LoadFunction: upon failure, retry with an underscore prepended,
  e.g. for gcc-built dlls.

(cherry-picked from commit 3f1b5efcca)
2022-10-22 20:04:20 +03:00
Ozkan Sezer 92937ff5e0 os2: fix error message for SDL_LoadObject()
(cherry-picked from commit 4264c0b674)
2022-10-22 20:04:20 +03:00
Anonymous Maarten 36b987dabe cmake: else() does not need an argument 2022-10-20 13:30:37 +02:00
Ryan C. Gordon 266ca2c933 coreaudio: Dispose of AudioQueue before waiting on the thread.
Otherwise the thread might block for a long time (more than 10 seconds!).
It's not clear to me why this happens, or why its safe to do this with a
resource that's still in use, but we have, until recently, always
disposed of the AudioQueue first, so changing back is probably okay.

Also changed the disposal to allow in-flight buffers to reach hardware;
otherwise you lose the last little bit of audio that's already been queued
but not played, which you can hear clearly in the loopwave test program.

Fixes #6377.
(cherry picked from commit e7ab581d79)
2022-10-19 20:29:24 +03:00
Ethan Lee b7e8e6f3b8 wayland: Check for the input handle before checking the keyboard handle
(cherry picked from commit be2cb00066)
2022-10-11 08:31:49 -07:00
Sam Lantinga 30579c8cd7 Don't try to create a semaphore for the mutex implementation if threads are disabled
Fixes https://github.com/libsdl-org/SDL/issues/6344

(cherry picked from commit 17b43b0fdd)
2022-10-10 14:35:30 -07:00
Ozkan Sezer 4726270ead WIN_GetDrawableSize: avoid NULL pointer dereference
Fixes https://github.com/libsdl-org/SDL/issues/6356
2022-10-08 23:01:28 +03:00
Sam Lantinga a1d1946dcb Use DWARF 4 debug information when building using mingw
See this bug for more information:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101377

Fixes https://github.com/libsdl-org/SDL/issues/6139

(cherry picked from commit f18fae4c68)
2022-10-04 16:48:08 -07:00
Sam Lantinga 36524373db Updated version to 2.24.1 for point release
Also merged some updates to test-versioning.sh from main to correctly verify the version
2022-10-04 14:06:15 -07:00
Sam Lantinga 77f3a9cbe8 Only advertise the SDL_PIXELFORMAT_EXTERNAL_OES format if we can build the shader for it
(cherry picked from commit 5bc85d6788)
2022-10-04 12:33:16 -07:00
Sam Lantinga b8dacc37b5 Pretty print shaders for debugging purposes
(cherry picked from commit 2970710b5d)
2022-10-04 12:33:16 -07:00
Sam Lantinga a49a25671d Fixed OpenGL ES shader compilation on Linux
(cherry picked from commit bc57d3e35c)
2022-10-04 12:33:16 -07:00
Sam Lantinga 284cf11778 Fixed uninitialized variable warning
(cherry picked from commit 8a15a738f3)
2022-10-04 12:33:16 -07:00
Sam Lantinga 949addc94e Fixed OpenGLES shaders failing after renderer has been created
Cache all the shaders up front, so we can verify that they won't silently fail at runtime.

If compiling the fragment shaders with the precision hint fails, try again without specifying precision.

Fixes https://github.com/libsdl-org/SDL/issues/6166
Fixes https://github.com/libsdl-org/SDL/issues/6174

(cherry picked from commit b5102a551b)
2022-10-04 12:33:16 -07:00
Amir 23a4b9bdd6 android: fix some compiler warnings
(cherry picked from commit 7f415ce587)
2022-10-04 12:32:10 -07:00
Sam Lantinga ce29ebc3b8 Add GLES2 shader prologue infrastructure. (by @eloj)
There is supposedly an OpenGL ES2 target that does not support precision specifiers. However, the existing logic to detect this is currently broken in two ways:

1) There's a typo of the `#ifdef` as `#if`.
2) Checking for `GL_FRAGMENT_PRECISION_HIGH` can not be the correct way to detect this platform. Other targets, including some desktops, will also not have this defined (for various reasons).

Because some of the shader code is missing precision specifiers, and because a default is ONLY provided if `GL_FRAGMENT_PRECISION_HIGH` is set, these other targets break.

Instead of 'hard-coding' the prologue string into shaders in the C source, use our ability to provide a list of strings to `glShaderSource` instead, leaving the determination to run-time.

This commit closes https://github.com/libsdl-org/SDL/pull/6182

(cherry picked from commit 29f4a5ba0e)
2022-10-04 12:29:27 -07:00
Ryan C. Gordon 0733ef7e3f
build: Fixed some references to renamed test-versioning.sh
(cherry picked from commit f648c000bd)
2022-10-04 15:22:41 -04:00
Ryan C. Gordon d1b2f1ebb5
Moved test/versioning.sh to build-scripts/test-versioning.sh
Reference Issue #6171.

(cherry picked from commit d843d61cc1)
2022-10-04 15:22:33 -04:00
Ryan C. Gordon 15496201c9
build-scripts: Added update-version.sh
Fixes #6171.

(cherry picked from commit 8e14647759)
2022-10-04 15:22:08 -04:00
Anonymous Maarten a23b54b74a cmake+xcode: only create SDL2::SDL2main target when it does not exist again 2022-10-04 21:17:29 +02:00
Ryan C. Gordon b0a2164b2c coreaudio: Possibly fixed another shutdown race condition.
Reference Issue #6159.
(cherry picked from commit e6640ef2d4)
2022-10-02 12:22:20 +03:00
Ozkan Sezer 14bf8237c1 hidapi, libusb: backport read_thread indefinite loop fix from mainstream
Mainstream commit:
5ce9051e2f
(cherry picked from commit 8bcbdc706c)
2022-09-28 18:35:24 +03:00
Ryan C. Gordon cedd8e1138 coreaudio: Remove redundant variable.
(cherry picked from commit f6565c329b)
2022-09-28 17:05:50 +03:00
Ryan C. Gordon d6e939ddb5 coreaudio: Don't crash on shutdown in a race condition.
Fixed #6159.
(cherry picked from commit 411582c710)
2022-09-28 17:01:50 +03:00
Ryan C. Gordon 128c34b839 cocoa: Fix new windows setting SDL_WINDOW_BORDERLESS flag incorrectly.
Fixes #6172.
(cherry picked from commit 57b20e7b9e)
2022-09-27 21:33:40 +03:00
Anonymous Maarten a1026d6368 cmake: use check_symbol_exists to check dlopen + need for dl library
(cherry-picked from commit bfecd78159)
2022-09-27 17:01:01 +03:00
Ozkan Sezer d8b2a165af autotools: revised and silenced esound detection a bit.
(cherry-picked from commit 6b75a592a4)
2022-09-27 17:01:01 +03:00
Simon McVittie 4657d8be0d autotools: Require GNU sort
find_lib() uses sort -V, which is a GNU extension. Users of non-GNU
operating systems should either install GNU coreutils (assumed to
provide a gsort executable), or use the CMake build system.

Resolves: https://github.com/libsdl-org/SDL/issues/6106
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry-picked from commit 732e1530e3)
2022-09-27 17:01:01 +03:00
Anonymous Maarten c7950bf0c6 cmake: only add -Wl,--undefined=WinMain when building an executable
(cherry-picked from commit 653e433c08)
2022-09-27 14:37:55 +03:00
Sylvain 0f2503cf8a Fixed bug #6287 - SDL_FillRect failed for SDL_Surface with BitsPerPixel == 4
(cherry-picked from commit d71df6448b)
2022-09-27 14:22:32 +03:00
Ozkan Sezer 6ba5f08e5d add missing quotes to the fallback CHECK_OBJC_SOURCE_COMPILES macro
Closes:  https://github.com/libsdl-org/SDL/issues/6268 .
(cherry picked from commit 098a7a043e)
2022-09-21 10:37:40 +03:00
Ozkan Sezer 7bf4ca60f6 autotools: stop using AC_FUNC_MEMCMP and AC_FUNC_STRTOD
Closes:  https://github.com/libsdl-org/SDL/issues/6266 .
(cherry picked from commit db225dec41)
2022-09-20 21:39:10 +03:00
Anonymous Maarten 4d78a6fad4 cmake: only add -Wl,--undefined=WinMain when building an executable
(cherry picked from commit 3b20e0ecef)
2022-09-19 05:02:04 +03:00
Cameron Cawley 59e04dcc0b Fix SDL_PIXELFORMAT_INDEX1LSB test case 2022-09-18 01:29:56 +03:00
Cameron Cawley fa239a2192 Fix incorrect return value in X11_GetPixelFormatFromVisualInfo 2022-09-18 01:29:56 +03:00
Ozkan Sezer 45362dfe31 SDL_windows.h: guard WIN32_LEAN_AND_MEAN and STRICT macro defines.
also define them as 1, instead of empty.
Reference issue: https://github.com/libsdl-org/SDL/issues/6239
(cherry picked from commit 339f7a2f6b)
2022-09-17 17:40:10 +03:00
Ozkan Sezer 0df4d123db SDL_offscreenwindow.c: swap include order of SDL_egl_c.h/SDL_sysvideo.h
Fixes redefinition warnings from windows builds.
Reference issue: https://github.com/libsdl-org/SDL/issues/6239
(cherry picked from commit d86cb8ec9e)
2022-09-17 17:40:07 +03:00
Sam Lantinga ffcf32b4ff Fixed building with libusb not dynamicaly loaded
(cherry-picked from commit 3f89d1704d)
(cherry-picked from commit 4ebf34857a)
(cherry-picked from commit 5767dc710e)
(cherry-picked from commit 9d77945d36)
(cherry-picked from commit 2847696338)
2022-09-12 23:55:56 +03:00
Sam Lantinga 531ddf5eb5 Fixed macOS framework detection in sdl2.m4
Fixes https://github.com/libsdl-org/SDL/issues/6141
(cherry picked from commit 3d516b841a)
2022-09-12 23:28:28 +03:00
Sam Lantinga abac672a2d Fixed crash if there are no devices available
(cherry picked from commit 679582e702)
2022-09-12 21:33:50 +03:00
Ozkan Sezer 782862b95c apply commit d0a3570300 to cmake side too.
(cherry-picked from commit 5b2884cb02)
2022-09-12 20:37:56 +03:00
Ozkan Sezer 525e201728 regenerated configure script.
(cherry-picked from commit d936499670)
2022-09-12 20:37:56 +03:00