Now this keeps one FBO for each SDL_TEXTUREACCESS_TARGET texture, and doesn't
reuse it. We check if the FBO is "complete" once, at creation time, and
setting a render target merely has to bind the right FBO and never look back.
This simplifies the code and removes a guaranteed pipeline stall when setting
a new render target.
Fixes#15524.
(cherry picked from commit 56e0d052f1)
Some compositors may dispatch this too early, during the initial empty commit, when subsurfaces are attached to a toplevel window, but a buffer has yet to be committed to the parent surface. Don't set the frame callback until the initial empty commit is done, so it will be called when the actual parent surface frame is committed.
(cherry picked from commit e3393e6304)
Some compositors send the frame callback as part of the initial configuration sequence, so the window may already be past the "waiting for frame" state. Ensure that the exposure event is always sent.
(cherry picked from commit 1ac0ae9224)
Under the right conditions, this extension can result is smoother resizing when rendering with OpenGL, however, it is known to cause problems in certain cases, such as when handling presentation externally.
Gate it behind a hint, and disable it by default. Developers can selectively enable it when they verify that they meet the criteria for using it, and that it behaves correctly in their apps/games.
(cherry picked from commit b8545fce54)
If the cursor was created with a temporary surface that was pointing at external memory, then when the cursor is used it might be referencing memory that had already been freed.
(cherry picked from commit f6f4664ed1)
This was added so that the new thread definitely has its threadid set, via
SDL_GetCurrentThreadID(), before SDL_CreatThread returns, but this broke
Emscripten, which can't wait on a newly-created thread, since the thread won't
start until a later mainloop iteration.
Now we have the creating thread set this id in SDL_SYS_CreateThread, where
platform-specific logic can figure out how to calculate the new thread's ID
from the parent thread, without using SDL_GetCurrentThreadID().
Fixes#15509.
(cherry picked from commit 922b872b4f)
Natural scrolling affects both axes, and the compositor may not send the vertical axis orientation if the frame has no vertical scroll motion, so purely horizontal events need to be flagged as inverted as well.
(cherry picked from commit 3ee0439ae5)
controller.vendorName returns a generic name for Xbox controllers ("Controller"), so we have to give them proper names.
(cherry picked from commit c805a4d632)
The code is using `controls.window` before checking if it isn't null.
I found this bug by accident when I tried to run `SDL_ShowSimpleMessageBox`.
It first tried using Wayland with `zenity`, but since I don't have `zenity`, it fallbacked to `X11_ShowMessageBoxImpl`.
For some reason it couldn't create a window, maybe something related to XWayland, so `controls.window` was `NULL`.
(cherry picked from commit e70f1bfc29)
Without this lock, a concurrent call to SDL_ReleaseGPUBuffer, SDL_ReleaseGPUTransferBuffer or SDL_ReleaseGPUTexture can cause one of the arrays to be reallocated while METAL_INTERNAL_PerformPendingDestroys is iterating over it, causing a bad day all around.
(cherry picked from commit 1492911c7d)
Only parse when necessary, which it isn't when opening a file, so this is now
separated from creating the cached AAssetManager object.
(cherry picked from commit 9235ac4efd)
The AAssetManager won't supply this information to us, but it's just a zip
file, so we can read its central directory ourselves. We can still use
AAssetManager for file i/o to the APK's assets, so we don't have to deal with
compression and other zipfile features.
Fixes#15220.
Reference Issue #15347.
(cherry picked from commit bb4332bdc2)
- Add missing SDL_MemoryBarrierRelease() in the generic codepath
- Remove MSVC x86/x64 case which is now identical to the generic codepath
- Fix Solaris barrier to ensure prior stores are visible before unlocking
(cherry picked from commit 95ae0c194e)
On some platforms, SDL_MemoryBarrierRelease() is defined to
SDL_CompilerBarrier(). If SDL_CompilerBarrier() is also defined to
the fallback spinlock acquire/release, then we will infinitely
recurse in SDL_UnlockSpinlock(). Avoid this by not unlocking the
temporary spinlock we create.
(cherry picked from commit 66e98b5598)
If a size change occurs, the sdl2-compat event handler will flush the renderer, which will cause the software renderer to re-acquire a surface that was invalidated due to the size change. However, if the OnWindowPixelSizeChanged handler is called afterward, the invalid flag will be set on the surface, causing presentation to fail.
Check both for a null surface pointer and an invalid surface flag when checking surface validity in the software renderer.
(cherry picked from commit 73fc274ef7)
This way you can always safely use SDL_GetError() in your formatted string:
```c
SDL_SetError("Couldn't open '%s': %s", filename, SDL_GetError());
```
This problem was hidden on platforms that use the dynamic API, because it
would format the new error string to a separate buffer first, to deal with
the varargs entry point.
Fixes#15456.
(cherry picked from commit 559d226fc6)