Commit Graph
100 Commits
Author SHA1 Message Date
Ryan C. Gordon e191bc8491 audio: Simplified GetFirstAudioFormat/GetNextAudioFormat.
Now it just returns an iterable array and needs no global state.
2023-05-03 22:37:23 -04:00
Ryan C. Gordon e474047ff8 rwlock: Added SDL_rwlock API for shared locks. 2023-04-27 21:54:02 -04:00
Ryan C. Gordon 776820526b windows: Use InitializeSRWLock explicitly.
The docs say you should, if not statically initializing an SRWLOCK--which
we aren't--but in practice this is probably just being pedantic.

Still, better (thread) safe than sorry!
2023-04-27 21:54:02 -04:00
Ryan C. Gordon 70a501d8ec winrt: Don't reference generic Condition Variables at all.
It always has the SRWLOCK implementation available to it, so let the
linker throw away the generic version if possible.
2023-04-27 21:54:02 -04:00
Ryan C. Gordon 736f9fb9b9 mutex: Fixed typos in documentation 2023-04-27 21:54:02 -04:00
Ryan C. Gordon e5a6c24c82 audio: Redesigned audio conversion code for SDL3.
- SDL_AudioCVT is gone, even internally.
- libsamplerate is gone (I suspect our resampler is finally Good Enough).
- Cleanups and improvements to audio conversion interfaces.
- SDL_AudioStream can change its input/output format/rate/channels on the fly!
2023-04-27 18:35:15 -04:00
Ryan C. Gordon 586004e52a wikiheaders.pl: Manpages shouldn't use .BI sections, it looks bad.
Reference Issue #7514.
2023-03-21 22:23:06 -07:00
Ryan C. Gordon 1b81ececd3 wikiheaders.pl: Fixed uninitialized value warning when run without arguments. 2023-03-21 21:57:12 -07:00
Ryan C. Gordon d898dbfe50 render: Make sure logical_target is bound when presenting.
Fixes black screen on macOS.

Fixes #7320.
2023-03-08 22:57:29 -05:00
Ryan C. Gordon 8b9a938413 dataqueue: Make thread safe.
Each data queue gets its own mutex and each function obtains it.

Fixes #7390.
2023-03-02 16:35:16 -05:00
Ryan C. Gordon f833e005e1 dataqueue: Removed non-public SDL_ReserveSpaceInDataQueue function
This wasn't used, and it was just asking for trouble.
2023-03-02 16:09:23 -05:00
Ryan C. Gordon f48d0cc164 audio: Remove AUDIO_U16* support.
It wasn't heavily used, and you can't use memset to silence a U16 buffer.

Fixes #7380.
2023-03-01 10:26:01 -05:00
Ryan C. Gordon 5d3234d8ae docs: Removed bogus file from wiki bridge.
That was fixed to not do that again by https://github.com/libsdl-org/ghwikipp/commit/7e429a13d385e448dd2efaf014e5aaddb6eff66b
2023-02-28 13:39:43 -05:00
Ryan C. Gordon 5585a4ac72 Renamed CONTRIBUTING.md to README-contributing.md
This lets the wiki bridge pick it up.
2023-02-28 12:38:31 -05:00
Ryan C. Gordon 7b9b20e684 docs: Deleting a bogus file to see if wiki bridge rebuilds it. 2023-02-28 12:31:11 -05:00
Ryan C. Gordon 99c38268cd wikiheaders: Sort pages before listing them in README/FrontPage.md. 2023-02-28 12:28:10 -05:00
Ryan C. Gordon 7745c9b3ae wikiheaders: Use Windows endlines in the source, Unix in the wiki. 2023-02-28 12:28:10 -05:00
Ryan C. Gordon 6d1e14b792 wikiheaders: ignore wiki's README/FrontPage.md 2023-02-28 11:55:19 -05:00
Ryan C. Gordon 2506676f34 wikiheaders: Bridge README files in the docs directory to wiki.
Fixes #6026.
2023-02-28 11:45:47 -05:00
Ryan C. Gordon a479633455 wikiheaders: fixed wikilinks in Markdown code sections. 2023-02-27 23:08:19 -05:00
Ryan C. Gordon 9f8425a7a9 include: Fixed wiki formatting that got mangled into the headers. 2023-02-26 21:47:17 -05:00
Ryan C. Gordon 5b0351a672 wikiheaders: Fix wikilinks inside code sections a little. Not perfect yet. 2023-02-24 14:29:36 -05:00
Ryan C. Gordon 0598ecc150 Sync wiki -> headers. 2023-02-24 11:49:41 -05:00
Ryan C. Gordon d748a454a8 wikiheaders: fixed see-also conversion 2023-02-24 11:45:43 -05:00
Ryan C. Gordon 5ff49955ab wikibridge: Fixes for manpage generation from Markdown format. 2023-02-24 10:21:54 -05:00
Ryan C. Gordon 936a51d5cc wikiheaders: Work to make the wiki exist primarily in Markdown format.
This adds a means to mass-convert the whole wiki to Markdown as a one-time
operation, and then some fixes to make --copy-to-headers correctly deal with
Markdown-formatted wiki pages.
2023-02-24 09:07:09 -05:00
Ryan C. Gordon 1e5e8e2fda resampler: Work at double precision on x86-64 machines.
We get audio artifacts if we don't work at the higher precision, but
this is painful on CPUs that have to use a software fallback for this,
so for now (that is, until we have a better solution), get better output
on amd64 chips, where the cost is less painful.
2023-02-21 13:00:20 -05:00
Ryan C. Gordon 357bc8ca5c resampler: correctly save off left padding.
I don't know if we ever actually hit this in practice, but if this isn't
replacing the whole buffer, it needs to slide the end of the existing padding
over to the start before adding in the new data.
2023-02-21 13:00:19 -05:00
Ryan C. Gordon 077725d0e3 wikiheaders: Fixed SDL2 wiki link. 2023-01-26 14:50:52 -05:00
Ryan C. Gordon 5f8b53820a wikiheaders: Link to the SDL2 wiki in the preamble.
Fixes #6568.
2023-01-26 14:45:58 -05:00
Ryan C. Gordon 726d6f9422 wikiheaders: Allow markdown in the wikipreamble string.
Reference Issue #6568.
2023-01-26 14:45:57 -05:00
Ryan C. Gordon 79cca812cb include: make SDL_RenderPresent thread safety notes less verbose.
Reference Issue #7140.
2023-01-25 13:15:34 -05:00
Ryan C. Gordon 197340ea1c Sync wiki -> headers. 2023-01-25 13:01:40 -05:00
Ryan C. Gordon 01cba48d18 wikiheaders: Add a \threadsafety tag to document threading details.
Reference Issue #7140.
2023-01-25 12:59:25 -05:00
Ryan C. Gordon e3bada6fbd wikiheaders: We never updated the config when we moved to include/SDL3. :O 2023-01-24 19:42:36 -05:00
Ryan C. Gordon 87c8e2b942 README-migration: Added backticks to avoid markdown highlighting. 2022-12-31 01:12:10 -05:00
Ryan C. Gordon 138f632b59 include: Add a comment about reserving a bit for sdl2-compat. 2022-12-29 13:34:53 -05:00
Ryan C. Gordon 1cf2b566af cpu: Removed 3DNow! support and SDL_Has3DNow().
Reference Issue #6636.
2022-12-23 09:30:56 -08:00
Ryan C. Gordon 7a5a1b16ce events: Make sure new display events don't overlap with sdl2-compat.
Reference PR #6867.
2022-12-22 11:47:54 -05:00
Ryan C. Gordon 3197632347 include: Renamed begin_code.h and close_code.h to have SDL_ prefixes.
Fixes #6864.
2022-12-22 11:39:26 -05:00
Ryan C. Gordon c9887c5c72 include: Split out functions in SDL.h to SDL_init.h.
SDL.h now exists solely as a header that includes everything else, instead
of one that forces you to include everything else when you just want the
declaration for SDL_Init().

Fixes #6840.
2022-12-22 01:05:10 -05:00
Ryan C. Gordon 182806e39f docs: Updated migration notes for SDL_RWops. 2022-12-22 00:55:54 -05:00
Ryan C. Gordon 78725dc0cd include: Fixed a C++-style single line comment.
Reference Issue #6838.
2022-12-17 23:52:33 -05:00
Ryan C. Gordon d927befcd7 docs: Just adjusting some link text. 2022-12-17 13:06:44 -05:00
Ryan C. Gordon 7b25f04476 README-migration.md: Point to the SDL_gesture repository. 2022-12-17 13:05:00 -05:00
Ryan C. Gordon 3b5780ba0a README-migration.md: Updated stdio RWops example code for new API. 2022-12-17 13:05:00 -05:00
Ryan C. Gordon c637031294 rwops: Fixed another Windows build failure. 2022-12-15 00:16:02 -05:00
Ryan C. Gordon 4075748e41 rwops: Removed unused variable in Windows-specific code. 2022-12-15 00:09:32 -05:00
Ryan C. Gordon 83559503c4 test: patched to compile. 2022-12-14 23:25:09 -05:00
Ryan C. Gordon 72c1f73bc5 rwops: Make read and write work like POSIX, not stdio.
This simplifies some things, clarifies some things, and also allows
for the possibility of RWops that offer non-blocking i/o (although
none of the current built-in ones do, intentionally, we could add this
later if we choose, or people could provide things like network socket
RWops implementations now, etc.

Fixes #6729.
2022-12-14 15:47:13 -05:00
Ryan C. Gordon 5a2d0b69c8 render: Remove SDL_GetRenderDriverInfo and change SDL_CreateRenderer.
Fixes #6625.
2022-12-13 23:27:35 -05:00
Ryan C. Gordon a76053352c gesture: Removed the gesture API from SDL3.
Fixes #6758.
2022-12-13 14:54:37 -05:00
Ryan C. Gordon 12486e144b wasapi: Fixed incorrect assertions.
Fixes #6795.
2022-12-12 16:07:48 -05:00
Ryan C. Gordon 16f8dfcef9 docs: Note that you don't need to free SDL_GetDefaultCursor's results.
Reference Issue #6777.
2022-12-09 22:08:40 -05:00
Ryan C. Gordon 7ca0d15d64 events: Changed SDL_GetEventState from a macro to a function.
Fixes #6773.
2022-12-08 00:08:51 -05:00
Ryan C. Gordon a3225ae6de dynapi: Abstract out the environment variable name. 2022-11-29 14:13:07 -05:00
Ryan C. Gordon fa5adcafd5 cocoa: Patched to compile on macOS SDK < 10.10.
Fixes #6586.
2022-11-26 13:57:45 -05:00
Ryan C. Gordon 80c1ddbe97 dynapi: Bumped dynapi version to 2, so SDL2 libs don't conflict. 2022-11-26 09:49:18 -05:00
Ryan C. Gordon 712457ec28 Merge pull request #6321 from Daft-Freak/no-ie
Delete emscripten CanvasPixelArray (IE10/11) support
2022-11-23 14:03:35 -05:00
Ryan C. Gordon 040a17a50f Merge pull request #6317 from tycho/wip/angle-egl
EGL: fixes for better ANGLE support
2022-11-23 14:02:15 -05:00
Ryan C. Gordon dcd9e21966 Merge branch 'main' into wip/angle-egl 2022-11-23 14:01:17 -05:00
Ryan C. Gordon 3983c98ece Merge branch 'main' into no-ie 2022-11-23 13:46:27 -05:00
Ryan C. Gordon a5e9d9bd7e Merge pull request #6142 from Daft-Freak/em-webgl-selector-hint
emscripten: use webgl APIs directly and add canvas selector hint
2022-11-23 13:23:15 -05:00
Ryan C. Gordon c2f26087c8 Merge branch 'main' into em-webgl-selector-hint 2022-11-23 13:22:23 -05:00
Ryan C. Gordon 4c39dd5c72 Testing the wiki, disregard this commit. 2022-11-22 18:12:08 -05:00
Ryan C. Gordon 8b18b09027 fnsince.pl: Make this work with SDL3. 2022-11-22 17:39:56 -05:00
Ryan C. Gordon b33000448e .wikiheaders-options: Add a warning that SDL3 is WIP. 2022-11-22 13:49:03 -05:00
Ryan C. Gordon 94f19d974d .wikiheader-options: Whoops, this isn't SDL_mixer. :) 2022-11-22 12:48:33 -05:00
Ryan C. Gordon a1702d463c ibus: Try to use org.freedesktop.portal.IBus first if available.
This should fix apps that want ibus support inside sandboxed environments
like FlatPak or Snaps.

Fixes #4706.
2022-11-16 23:39:41 -05:00
Ryan C. Gordon bb0b8adacc mac: Fix handling of deprecated symbol.
This needs to check what our deployment target is, not what SDK
is available, since this is a linker symbol and not an enum
value or whatever.

Also removed a copy/paste error that mentioned CoreAudio in
the haptic subsystem.

Fixes #6534.
2022-11-16 22:04:04 -05:00
Ryan C. Gordon 389ffab733 Code style fixes, etc.
Reference PR #6345.
2022-11-16 12:53:48 -05:00
Ryan C. Gordon 7ebdae5dc9 cocoa: Fix OpenGL deprecation warning. 2022-11-16 11:45:41 -05:00
Ryan C. Gordon 7c760f7f79 cocoa: Update CVDisplayLink timing when screen changes.
This handles both the window moving to a new display and
changing the current display's refresh rate in System
Preferences

Reference Issue #4918.
2022-11-16 11:35:27 -05:00
Ryan C. Gordon 1fd66cc890 Revert "cocoa: Backed out CVDisplayLink code for macOS vsync."
This reverts commit 04b50f6c6b.

It turns out OpenGL vsync has broken again in macOS 12, so
we're reintroducing our CVDisplayLink code to deal with it,
again.

Reference Issue #4918.
2022-11-16 11:34:25 -05:00
Ryan C. Gordon 9d67686a5b haptic: Deal with deprecated macOS symbol. 2022-11-16 10:08:40 -05:00
Ryan C. Gordon 6801d676c0 Revert "pulseaudio: Only use PA_STREAM_ADJUST_LATENCY if buffer isn't super small."
This reverts commit d8b1ef42ae.

This turned out to be unnecessary (it was a problem on the user's system,
not an SDL bug).

Reference Issue #6121.
2022-11-16 09:53:37 -05:00
Ryan C. Gordon d8b1ef42ae pulseaudio: Only use PA_STREAM_ADJUST_LATENCY if buffer isn't super small.
Fixes #6121.
2022-11-15 22:44:31 -05:00
Ryan C. Gordon 44d7b8b91d egl: Check for a NULL pointer in SDL_EGL_GetProcAddress.
This happens on kmsdrm if you try to GetProcAddress before creating
a window.

Fixes #5399.
2022-11-15 13:59:24 -05:00
Ryan C. Gordon 85aa9b8b6f wasapi: Favor the system resampler again, for now.
Reference Issue #5538.
2022-11-11 13:48:11 -05:00
Ryan C. Gordon 1008cc8e5f video: Add some braces to match SDL coding style. 2022-11-09 12:55:27 -05:00
Ryan C. Gordon b0dc6709b9 coreaudio: Don't use deprecated kAudioObjectPropertyElementMaster symbol.
Fixes #6449.
2022-11-07 14:26:48 -05:00
Ryan C. Gordon 78f97108f9 audio: Avoid accumulation errors in resampler.
Fixes #6391.
2022-11-05 10:39:35 -04:00
Ryan C. Gordon b9e1d1b4de events: Rename SDL_SendKeyboardKeyComplete to SDL_SendKeyboardKeyAndKeycode.+ 2022-10-28 16:19:00 -04:00
Ryan C. Gordon 9221548114 emscripten: Make an attempt at correct keyboard scancode/keycodes.
This uses a newer browser API to get physical scancodes, but still
uses the (deprecated) event field that we were already using for
scancodes, but for keycodes instead now, which appears to be more
accurate.

Since keyboard layout isn't (generally) available to web apps, this
adds an internal interface to send key events with both scancode
and keycode to SDL's internals, instead of sending just scancodes and
expecting SDL to use its own keymap to generate keycodes.

Future work in this area would be to use the keyboard layout APIs
on browsers that support them, which would allow us to use SDL's
usual keymap code and not rely on a deprecated browser API, but
until we get there, this patch gives significantly more correct
results than we would have before.

Fixes #2098.
2022-10-28 16:19:00 -04:00
Ryan C. Gordon 0ddec7e421 docs: Add notes about Emscripten audio quirks.
Fixes #6385.
2022-10-28 16:08:23 -04:00
Ryan C. Gordon 9e8d2f3948 video: Don't use texture framebuffer on Windows Subsystem for Linux.
Reference Issue #6333.
2022-10-27 13:54:53 -04:00
Ryan C. Gordon 41d38c0f64 shape: More robust handling of failure cases in CreateShaper. 2022-10-26 13:57:49 -04:00
Ryan C. Gordon c8d20f96ba shape: Free platform-specific shaped window data.
Fixes #2128.
2022-10-26 13:57:49 -04:00
Ryan C. Gordon 98dfc9296a build-scripts/fnsince.pl: Deal with new point-release system.
This ignores 2.x.1 (etc) releases, which prevents it from thinking
the next official non-point-release version is 2.26.1, when it
should be 2.26.0, because it saw the "latest" release is 2.24.1.

This fixes the wiki ending up with imaginary version numbers for
the "this function is available since SDL 2.x.y" sections.

Fixes #6343.
2022-10-25 14:03:32 -04:00
Ryan C. Gordon e7ab581d79 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.
2022-10-19 09:14:16 -04:00
Ryan C. Gordon 2d7816e358 dynapi: Disable support for API call logging by default.
We can manually enable it if necessary, but it bloats the library to
leave it on just in case.

Fixes #6381.
2022-10-12 09:59:31 -04:00
Ryan C. Gordon 17322e2be6 dynapi: Optionally log every call into the SDL API.
This will only log things going through dynapi, which means it won't
do anything if dynapi is disabled for a given build, but also things
that call the `*_REAL` version of an API won't log either (which is
to say, if an internal piece of SDL calls a public API, it won't log
it, but if an application calls that same entry point, it will).

Since this just inserts a different function pointer, unless you
explicitly request this at runtime, it won't add any overhead, and,
of course, the entire thing can be turned off with a single #define
so it doesn't even add extra unused code to the shared library if
the kill switch is flipped.
2022-10-10 13:17:07 -04:00
Ryan C. Gordon 321ca1091d opengles2: Texture names are GLuint, not GLenum. 2022-10-03 12:00:38 -04:00
Ryan C. Gordon 01c5554f0e opengles2: SDL_GL_BindTexture() should bind all YUV textures.
This matches what the non-GLES OpenGL renderer does.

Fixes #6070.
2022-10-03 11:57:10 -04:00
Ryan C. Gordon e6640ef2d4 coreaudio: Possibly fixed another shutdown race condition.
Reference Issue #6159.
2022-09-30 14:53:49 -04:00
Ryan C. Gordon 1b895912a2 docs: Note the lowest supported Emscripten version.
Reference Issue #6304.
2022-09-30 14:23:54 -04:00
Ryan C. Gordon a97d2e6958 GitHub Actions: bump Emscripten version used to build to 2.0.31.
Reference PR #6304.
2022-09-30 10:47:13 -04:00
Ryan C. Gordon 508cc225a7 Update README.md 2022-09-28 10:17:39 -04:00
Ryan C. Gordon f648c000bd build: Fixed some references to renamed test-versioning.sh 2022-09-28 09:37:21 -04:00
Ryan C. Gordon f6565c329b coreaudio: Remove redundant variable. 2022-09-28 09:27:45 -04:00