Compare commits

..
Author SHA1 Message Date
Sam Lantinga 2fa1e7258a Updated to version 3.2.2 for release 2025-02-01 17:01:45 -08:00
Em c922762791 proposed fix: set curr_src.h is to bottom_height before drawing bottom edges / corners in SDL_RenderTexture9Grid, to avoid issue where inadvertently using top height if the npatch existed on a larger texture than the drawn edge would cause too many pixels to be included in the bottom part of the render. 2025-02-01 16:09:08 -08:00
Sam Lantinga 235022fe2f Fixed error C2059: syntax error: '}'
Fixes https://github.com/libsdl-org/SDL/issues/12155
2025-02-01 15:32:58 -08:00
John Kvalevog dc13a6ae95 SDL_SaveBMP_IO: Write bitmap header v5 values
bV4CSType was changed to LCS_sRGB to work with Preview on macOS.

Fixes: #11903
2025-02-01 11:10:24 -08:00
SDL Wiki Bot fe6bd8e9bf Sync SDL3 wiki -> header
[ci skip]
2025-02-01 10:40:21 +00:00
Sam Lantinga bc3264130d Fixed mouse motion events while the mouse is grabbed
When the mouse is grabbed, the X server sends mouse events only to the grabbing client, and XInput2 events for the master device are not delivered.

We should consider using the window mouse rect confinement instead of a true X server grab for SDL mouse grab functionality.
2025-01-31 23:45:09 -08:00
Sam Lantinga 69d361dee1 Ignore SDL_HINT_RENDER_DRIVER set to software when creating a window surface
We handled the case where software was in a list of render drivers, but not when the hint was set to exactly "software".

Fixes https://github.com/libsdl-org/sdl2-compat/issues/266
2025-01-31 15:49:58 -08:00
Evan Hemsley 70a239210e GPU: Describe "readonly storage" images as sampled images on Vulkan backend (#12149) 2025-01-31 15:07:33 -08:00
Sam Lantinga 4c6d949e6d wayland: make sure the desktop mode is in the fullscreen mode list
Fixes https://github.com/libsdl-org/SDL/issues/12079
2025-01-31 14:53:40 -08:00
Sam Lantinga ab5cb707a6 Fixed enabling call logging 2025-01-31 14:22:29 -08:00
Sam Lantinga 16f8122a0d Keep the simplest mapping of scancode + modifer for a given keycode
Fixes https://github.com/libsdl-org/sdl2-compat/issues/259
2025-01-31 12:07:08 -08:00
Timothee Besset 6beda34215 do not build camera drivers if camera support is disabled 2025-01-31 10:24:54 -08:00
Frank Praznik 0825d07a43 wayland: Don't send size events while the window is hidden
Some clients don't expect this, and it can cause issues, particularly if events are emitted while creating a hidden window.
2025-01-31 12:40:07 -05:00
Evan HemsleyandCaleb Cornett 8e766c9252 GPU: Resource binding state shadowing (#12138)
---------

Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com>
2025-01-31 08:34:10 -08:00
SDL Wiki Bot 43924ec873 Sync SDL3 wiki -> header
[ci skip]
2025-01-31 01:04:48 +00:00
SDL Wiki Bot 8c2682a219 Sync SDL3 wiki -> header
[ci skip]
2025-01-31 00:56:29 +00:00
Ozkan Sezer e4fcc7b6e7 gpu/vulkan/SDL_gpu_vulkan.c: fix type redefinition error
src/gpu/vulkan/SDL_gpu_vulkan.c:763: error: redefinition of typedef 'VulkanUniformBuffer'
src/gpu/vulkan/SDL_gpu_vulkan.c:482: note: previous declaration of 'VulkanUniformBuffer' was here
2025-01-31 02:50:00 +03:00
John Alanbrook 14edb21aec check for backslashes as well as the forward slash 2025-01-30 12:41:48 -08:00
SDL Wiki Bot 50b8c6cdfb Sync SDL3 wiki -> header
[ci skip]
2025-01-30 19:31:13 +00:00
Ryan C. Gordon 943c4abcb4 pipewire: Report correct device default formats instead of hardcoding Float32.
The comment in the source wasn't true; PipeWire doesn't _have_ to work in
float format. It presumably does if it has to mix, but if a game is the only
thing making noise on the system--a common scenario--then it might be able to
pass, say, Sint16 data straight through to the hardware without conversion.

Fixes #12129.
2025-01-30 02:46:56 -05:00
Aki 943579a545 Fix inverted pen Y tilt on macOS and add tilt display to example
- Negate tilt.y in Cocoa pen handling to correct inverted Y tilt axis
- Update drawing example to display X/Y tilt values for visualization
- see https://github.com/qt/qtbase/blob/0f128fd7c5a9ee721d1e631743f6eb61d927cf3b/src/plugins/platforms/cocoa/qnsview_tablet.mm#L63
- see https://source.chromium.org/chromium/chromium/src/+/main:components/input/web_input_event_builders_mac.mm;drc=0af5ffa1e4cc4cc4f818725f8fee93ec57855e4b;l=421
2025-01-29 22:09:02 -08:00
Petar Popovic 31364477f2 Rename parameter of type SDL_CameraID from devid to instance_id 2025-01-29 17:49:53 -08:00
Petar Popovic 36758d70c9 Rename parameters of type SDL_AudioDeviceID from dev to devid 2025-01-29 14:44:08 -08:00
Seth Anderson 2abc7735a4 Free XIDeviceInfo in X11_MaybeAddPenByDeviceID 2025-01-29 10:55:49 -08:00
Sam Lantinga 8298d60e4a Dynamically load CreateWaitableTimerExW and SetWaitableTimerEx
These functions are not available on Windows XP
2025-01-29 05:40:49 -08:00
Sam Lantinga 409f3ade88 Removed SDF test program
There's a much better example of SDF support in testgputext in SDL_ttf
2025-01-29 04:15:27 -08:00
Sam Lantinga 4176e188bf Enable testgles2 on all platforms
We use SDL's headers so we're not dependent on system OpenGL header availability.
2025-01-29 04:03:31 -08:00
Timothee Besset cf249b0cb2 fix -Wformat problem in 32 bit builds 2025-01-28 16:57:25 -08:00
SDL Wiki Bot 11dbff246f Sync SDL3 wiki -> header
[ci skip]
2025-01-28 19:01:16 +00:00
Ryan C. Gordon ccd5fcef12 audio: Fix potential NULL dereference in AudioStream gain adjustment.
You can end up with a NULL scratch buffer, which is otherwise not needed on
this path, then ConvertAudio will end up needing that scratch space to move
to float32 to apply gain.

Fixes #12091.
(I assume.)
2025-01-28 13:14:25 -05:00
Frank Praznik 48f5550651 wayland: Don't send keyboard and mouse added events during initialization
Only send them when a device is added post-initialization, as is done on other platforms.
2025-01-28 13:02:29 -05:00
Sam Lantinga 2a946e91bc android: updated release build SDK to match documented requirements 2025-01-28 06:03:37 -08:00
Sam Lantinga 44edbf7137 Use templates for the package support files
This makes them more easy to reuse in other projects.
2025-01-28 06:03:37 -08:00
Adam Kewley 1c008d8ed0 Change DBUS introspection timer from INFINITE -> DEFAULT when introspecting available dialog services 2025-01-28 05:13:35 -08:00
Carl Åstholm c21bc48a70 Fix undefined behavior in SDL_windowsmouse.c
This fix prevents C undefined behavior from being invoked on Windows
if the user's configured cursor speed is below 6.
2025-01-28 05:12:16 -08:00
Sam Lantinga 1c7cc60286 Skip IsRegularFileOrPipe() check on Emscripten
The sandbox guarantees that this will be true.

Fixes https://github.com/libsdl-org/SDL/issues/12108
2025-01-27 22:25:12 -08:00
Ryan C. Gordon 8f958953f1 audio: Fix audio stream gain going wrong in certain scenarios.
Fixes #12091.
2025-01-27 20:20:17 -05:00
Ryan C. Gordon 3b3af7105b audio: Fix a minor code style thing. 2025-01-27 20:20:17 -05:00
mausimus 725ee7665c Documentation: fixed typos around floats precision 2025-01-27 14:12:24 -05:00
Petar Popovic 6f098a920e Avoid a crash when a tray without a menu is clicked on Windows. 2025-01-26 23:27:28 -08:00
Ryan C. Gordon 09f900f66e audio: Remove resampling limits.
Audio streams used to accept audio with a src or dest frequency between
4000Hz and 384000Hz. It was arbitrary (or perhaps a relic of older
resampler revisions), and testing shows unnecessary, so remove it.

Fixes #12098.
2025-01-27 01:13:54 -05:00
Sam Lantinga 5f8e0ebf58 Fixed memory leak at shutdown 2025-01-26 19:30:29 -08:00
Cameron Gutman 913e0a5e53 SDL_migration.cocci: handle more renamed event fields 2025-01-25 23:50:44 -06:00
Cameron Gutman 628130ec8f SDL_migration.cocci: fix incorrect SDL3 API name 2025-01-25 23:50:04 -06:00
SDL Wiki Bot fa8c0f0552 Sync SDL3 wiki -> header
[ci skip]
2025-01-26 03:57:15 +00:00
SDL Wiki Bot 17c4bdd754 Sync SDL3 wiki -> header
[ci skip]
2025-01-24 21:19:18 +00:00
SDL Wiki Bot ad8a09000f Sync SDL3 wiki -> header
[ci skip]
2025-01-24 20:06:31 +00:00
cosmonaut 8df17c97d1 GPU: Add notes about shader resource requirements to documentation 2025-01-24 12:04:00 -08:00
Anonymous Maarten 303fd5ed5a release: rename resources/cmake -> resources/CMake in dmg 2025-01-24 20:08:25 +01:00
Anonymous Maarten fdf33f9047 xcode+cmake: Use SDL3.framework/SDL3 as IMPORTED_LOCATION
Not adding /SDL3 causes CMake to no longer set the RUNPATh on
binaries in the build directory.
It also breaks compatibility with CMake versions older then 3.28.

reverts c56a3f60fe (xcode+cmake: use SDL3.framework folder as IMPORTED_LOCATION)
reverts ad3c7b92f8 (xcode+cmake: use SDL3.framework folder as IMPORTED_LOCATION)
2025-01-24 20:07:51 +01:00
Ryan C. Gordon cb3d6dc467 .wikiheaders-options: Removed wikipreamble setting.
Reference https://github.com/libsdl-org/sdlwiki/issues/713.
2025-01-24 01:53:51 -05:00
SDL Wiki Bot 84c4ff2f10 Sync SDL3 wiki -> header
[ci skip]
2025-01-24 04:47:03 +00:00
nightmareci 2e381a717f Fix possible integer overflow of size + 1 2025-01-23 15:57:23 -08:00
SDL Wiki Bot 129ebc77b9 Sync SDL3 wiki -> header
[ci skip]
2025-01-23 23:20:22 +00:00
Petar Popovic a336b62d8b Remove newlines from error messages 2025-01-23 11:45:04 -08:00
Frank Praznik d0ae093681 x11: Don't force position windows with an undefined position
An undefined position means that the window manager can handle placement, so SDL shouldn't override that by forcing a position when showing a window.

Allows for removing a fair bit of now-unnecessary code as well.
2025-01-23 14:36:26 -05:00
hspir404 72a3eae0da Fix buffer overrun in ConvertAudio with different src/dst channel count
- Source or destination format also has to not be F32 to trigger bug
2025-01-23 13:52:31 -05:00
Petar Popovic 983cfe8b1c Remove even more newlines from log messages 2025-01-23 09:32:50 -08:00
nightmareci 718034f5fa Remove newlines from log messages 2025-01-22 20:25:04 -08:00
Sam Lantinga 17625e20df Removed redundant step in Visual Studio instructions 2025-01-22 13:26:11 -08:00
Sam Lantinga c806c271c5 Tweaked emscripten introduction 2025-01-22 13:05:44 -08:00
Sam Lantinga 74536243dd Emscripten works well using the normal CMake workflow 2025-01-22 12:56:32 -08:00
Anonymous Maarten 98c447802f ci: bump to NetBSD 10.1 2025-01-22 19:39:17 +01:00
nightmareci a437dbc7e3 Improve log documentation 2025-01-22 10:37:54 -08:00
SDL Wiki Bot 1c21a72bda Sync SDL3 wiki -> header
[ci skip]
2025-01-22 17:20:25 +00:00
Susko3 73fc2b03a3 Copy pen handling code from SDLSurface to SDLControllerManager 2025-01-21 21:33:11 -08:00
Sam Lantinga 6f3d0b3cdb Fixed build when using an older Xcode SDK
Fixes https://github.com/libsdl-org/SDL/issues/12048
2025-01-21 18:17:02 -08:00
Anonymous Maarten cb3cc28809 emscripten: pass --no-sandbox to the chrome web driver
This fixes running the Emscripten tests on Ubuntu 24.04.
2025-01-22 02:48:32 +01:00
SDL Wiki Bot df3cfbc797 Sync SDL3 wiki -> header
[ci skip]
2025-01-21 23:08:39 +00:00
cosmonaut 799093799a GPU: Note buffer alignment requirements 2025-01-21 15:07:34 -08:00
SDL Wiki Bot 5bf077f1f1 Sync SDL3 wiki -> header
[ci skip]
2025-01-21 23:04:33 +00:00
SDL Wiki Bot 5d6a780453 Sync SDL3 wiki -> header
[ci skip]
2025-01-21 23:00:08 +00:00
Sam Lantinga 77b520e93e Updated to version 3.2.1 for development 2025-01-21 14:02:06 -08:00
Klayism bb3c5b4f3a Fix multiple occurences of typo "an simple" to "a simple" 2025-01-21 14:00:54 -08:00
Anonymous Maarten efa6e7aece android: add style to test apk's 2025-01-21 20:20:17 +01:00
204 changed files with 2186 additions and 2450 deletions

No files matched your search

+9 -3
View File
@@ -129,7 +129,7 @@ JOB_SPECS = {
"android-cmake-lean": JobSpec(name="Android (CMake, lean)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact="SDL-lean-android-arm64", android_abi="arm64-v8a", android_arch="aarch64", android_platform=23, lean=True, ),
"android-mk": JobSpec(name="Android (Android.mk)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact=None, no_cmake=True, android_mk=True, ),
"android-gradle": JobSpec(name="Android (Gradle)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact=None, no_cmake=True, android_gradle=True, ),
"emscripten": JobSpec(name="Emscripten", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Emscripten, artifact="SDL-emscripten", ),
"emscripten": JobSpec(name="Emscripten", os=JobOs.UbuntuLatest, platform=SdlPlatform.Emscripten, artifact="SDL-emscripten", ),
"haiku": JobSpec(name="Haiku", os=JobOs.UbuntuLatest, platform=SdlPlatform.Haiku, artifact="SDL-haiku-x64", container="ghcr.io/haiku/cross-compiler:x86_64-r1beta5", ),
"loongarch64": JobSpec(name="LoongArch64", os=JobOs.UbuntuLatest, platform=SdlPlatform.LoongArch64, artifact="SDL-loongarch64", ),
"n3ds": JobSpec(name="Nintendo 3DS", os=JobOs.UbuntuLatest, platform=SdlPlatform.N3ds, artifact="SDL-n3ds", container="devkitpro/devkitarm:latest", ),
@@ -223,6 +223,8 @@ class JobDetails:
cpactions_install_cmd: str = ""
setup_vita_gles_type: str = ""
check_sources: bool = False
setup_python: bool = False
pypi_packages: list[str] = dataclasses.field(default_factory=list)
def to_workflow(self, enable_artifacts: bool) -> dict[str, str|bool]:
data = {
@@ -287,6 +289,8 @@ class JobDetails:
"setup-vita-gles-type": self.setup_vita_gles_type,
"setup-gdk-folder": self.setup_gdk_folder,
"check-sources": self.check_sources,
"setup-python": self.setup_python,
"pypi-packages": my_shlex_join(self.pypi_packages),
}
return {k: v for k, v in data.items() if v != ""}
@@ -541,7 +545,6 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
job.cmake_config_emulator = "emcmake"
job.cmake_build_type = "Debug"
job.test_pkg_config = False
job.apt_packages.append("python3-selenium")
job.cmake_arguments.extend((
"-DSDLTEST_BROWSER=chrome",
"-DSDLTEST_TIMEOUT_MULTIPLIER=4",
@@ -561,6 +564,8 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
"chromedriver --version",
))
job.static_lib = StaticLibType.A
job.setup_python = True
job.pypi_packages.append("selenium")
case SdlPlatform.Ps2:
build_parallel = False
job.shared = False
@@ -704,7 +709,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
))
case SdlPlatform.NetBSD:
job.cpactions_os = "netbsd"
job.cpactions_version = "10.0"
job.cpactions_version = "10.1"
job.cpactions_arch = "x86-64"
job.cpactions_setup_cmd = "export PATH=\"/usr/pkg/sbin:/usr/pkg/bin:/sbin:$PATH\"; export PKG_CONFIG_PATH=\"/usr/pkg/lib/pkgconfig\";export PKG_PATH=\"https://cdn.netBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r|cut -f \"1 2\" -d.)/All/\";echo \"PKG_PATH=$PKG_PATH\";echo \"uname -a -> \"$(uname -a)\"\";sudo -E sysctl -w security.pax.aslr.enabled=0;sudo -E sysctl -w security.pax.aslr.global=0;sudo -E pkgin clean;sudo -E pkgin update"
job.cpactions_install_cmd = "sudo -E pkgin -y install cmake dbus pkgconf ninja-build pulseaudio libxkbcommon wayland wayland-protocols libinotify libusb1"
@@ -713,6 +718,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
if "ubuntu" in spec.name.lower():
job.check_sources = True
job.setup_python = True
if not build_parallel:
job.cmake_build_arguments.append("-j1")
+10 -6
View File
@@ -133,6 +133,15 @@ jobs:
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
brew update
brew install ${{ matrix.platform.brew-packages }}
- name: 'Setup Python'
uses: 'actions/setup-python@main'
if: ${{ matrix.platform.setup-python }}
with:
python-version: '3.x'
- name: 'Install PyPI packages'
if: ${{ matrix.platform.pypi-packages != '' }}
run: |
python -m pip install --user ${{ matrix.platform.pypi-packages }}
- name: 'Set up GLES for VITA' # Must be after apk
if: ${{ matrix.platform.setup-vita-gles-type != '' }}
uses: ./.github/actions/setup-vita-gles
@@ -281,7 +290,7 @@ jobs:
- name: 'Build (cross-platform-actions, BSD)'
id: cpactions
if: ${{ matrix.platform.cpactions }}
uses: cross-platform-actions/action@v0.26.0
uses: cross-platform-actions/action@v0.27.0
with:
operating_system: '${{ matrix.platform.cpactions-os }}'
architecture: '${{ matrix.platform.cpactions-arch }}'
@@ -348,11 +357,6 @@ jobs:
if: ${{ matrix.platform.xcode-sdk != '' }}
run: |
xcodebuild -project Xcode/SDL/SDL.xcodeproj -target SDL3 -configuration Release -sdk ${{ matrix.platform.xcode-sdk }} clean build
- name: 'Setup Python'
uses: 'actions/setup-python@main'
if: ${{ matrix.platform.check-sources }}
with:
python-version: '3.x'
- name: 'Check Sources'
if: ${{ matrix.platform.check-sources }}
run: |
+1 -1
View File
@@ -14,7 +14,7 @@ projecturl = https://libsdl.org/
wikiurl = https://wiki.libsdl.org
bugreporturl = https://github.com/libsdl-org/sdlwiki/issues/new
warn_about_missing = 0
wikipreamble = (This is the documentation for SDL3, which is the current stable version. [SDL2](https://wiki.libsdl.org/SDL2/) was the previous version!)
#wikipreamble = (This is the documentation for SDL3, which is the current stable version. [SDL2](https://wiki.libsdl.org/SDL2/) was the previous version!)
wikiheaderfiletext = Defined in [<SDL3/%fname%>](https://github.com/libsdl-org/SDL/blob/main/include/SDL3/%fname%)
manpageheaderfiletext = Defined in SDL3/%fname%
+1 -1
View File
@@ -5,7 +5,7 @@ if(NOT DEFINED CMAKE_BUILD_TYPE)
endif()
# See docs/release_checklist.md
project(SDL3 LANGUAGES C VERSION "3.2.0")
project(SDL3 LANGUAGES C VERSION "3.2.2")
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(SDL3_MAINPROJECT ON)
+6 -6
View File
@@ -198,7 +198,7 @@ LoadSprite(const char *file)
return -1;
}
if (!SDL_SetTextureBlendMode(sprites[i], blendMode)) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s\n", SDL_GetError());
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s", SDL_GetError());
SDL_DestroyTexture(sprites[i]);
return -1;
}
@@ -405,7 +405,7 @@ main(int argc, char *argv[])
sprites =
(SDL_Texture **) SDL_malloc(state->num_windows * sizeof(*sprites));
if (!sprites) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!");
quit(2);
}
for (i = 0; i < state->num_windows; ++i) {
@@ -420,13 +420,13 @@ main(int argc, char *argv[])
soundname = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav");
if (!soundname) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError());
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s", SDL_GetError());
quit(1);
}
/* Load the wave file into memory */
if (!SDL_LoadWAV(soundname, &wave.spec, &wave.sound, &wave.soundlen)) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", soundname, SDL_GetError());
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", soundname, SDL_GetError());
quit(1);
}
@@ -436,11 +436,11 @@ main(int argc, char *argv[])
SDL_Log("%i: %s", i, SDL_GetAudioDriver(i));
}
SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
SDL_Log("Using audio driver: %s", SDL_GetCurrentAudioDriver());
stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &wave.spec, NULL, NULL);
if (!stream) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create audio stream: %s\n", SDL_GetError());
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create audio stream: %s", SDL_GetError());
return -1;
}
SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(stream));
+2 -2
View File
@@ -19,10 +19,10 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.2.0</string>
<string>3.2.2</string>
<key>CFBundleSignature</key>
<string>SDLX</string>
<key>CFBundleVersion</key>
<string>3.2.0</string>
<string>3.2.2</string>
</dict>
</plist>
+4 -4
View File
@@ -3062,7 +3062,7 @@
CLANG_ENABLE_OBJC_ARC = YES;
DEPLOYMENT_POSTPROCESSING = YES;
DYLIB_COMPATIBILITY_VERSION = 201.0.0;
DYLIB_CURRENT_VERSION = 201.0.0;
DYLIB_CURRENT_VERSION = 201.2.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_ALTIVEC_EXTENSIONS = YES;
@@ -3097,7 +3097,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 3.2.0;
MARKETING_VERSION = 3.2.2;
OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)";
PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3;
PRODUCT_NAME = SDL3;
@@ -3126,7 +3126,7 @@
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
DYLIB_COMPATIBILITY_VERSION = 201.0.0;
DYLIB_CURRENT_VERSION = 201.0.0;
DYLIB_CURRENT_VERSION = 201.2.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@@ -3158,7 +3158,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 3.2.0;
MARKETING_VERSION = 3.2.2;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)";
PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3;
+1 -1
View File
@@ -1,4 +1,4 @@
Title SDL 3.2.0
Title SDL 3.2.2
Version 1
Description SDL Library for macOS (http://www.libsdl.org)
DefaultLocation /Library/Frameworks
@@ -59,7 +59,7 @@ if(NOT TARGET SDL3::SDL3-shared)
set_target_properties(SDL3::SDL3-shared
PROPERTIES
FRAMEWORK "TRUE"
IMPORTED_LOCATION "${_sdl3_framework_path}"
IMPORTED_LOCATION "${_sdl3_framework_path}/SDL3"
INTERFACE_LINK_LIBRARIES "SDL3::Headers"
COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED"
INTERFACE_SDL3_SHARED "ON"
@@ -112,7 +112,7 @@ if(NOT TARGET SDL3::SDL3-shared)
set_target_properties(SDL3::SDL3-shared
PROPERTIES
FRAMEWORK "TRUE"
IMPORTED_LOCATION "${_sdl3_framework_path}"
IMPORTED_LOCATION "${_sdl3_framework_path}/SDL3"
INTERFACE_LINK_LIBRARIES "SDL3::Headers"
)
endif()
@@ -60,7 +60,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
private static final String TAG = "SDL";
private static final int SDL_MAJOR_VERSION = 3;
private static final int SDL_MINOR_VERSION = 2;
private static final int SDL_MICRO_VERSION = 0;
private static final int SDL_MICRO_VERSION = 2;
/*
// Display InputType.SOURCE/CLASS of events and devices
//
@@ -705,9 +705,14 @@ class SDLGenericMotionListener_API14 implements View.OnGenericMotionListener {
x = event.getX(i);
y = event.getY(i);
float p = event.getPressure(i);
if (p > 1.0f) {
// may be larger than 1.0f on some devices
// see the documentation of getPressure(i)
p = 1.0f;
}
// BUTTON_STYLUS_PRIMARY is 2^5, so shift by 4
int buttons = event.getButtonState() >> 4;
// BUTTON_STYLUS_PRIMARY is 2^5, so shift by 4, and apply SDL_PEN_INPUT_DOWN/SDL_PEN_INPUT_ERASER_TIP
int buttons = (event.getButtonState() >> 4) | (1 << (toolType == MotionEvent.TOOL_TYPE_STYLUS ? 0 : 30));
SDLActivity.onNativePen(event.getPointerId(i), buttons, action, x, y, p);
consumed = true;
+97 -2
View File
@@ -1136,12 +1136,12 @@ typedef SDL_GameControllerButton, SDL_GamepadButton;
@@
@@
- SDL_GameControllerGetNumTouchpadFingers
+ SDL_GetGamepadNumTouchpadFingers
+ SDL_GetNumGamepadTouchpadFingers
(...)
@@
@@
- SDL_GameControllerGetNumTouchpads
+ SDL_GetGamepadNumTouchpads
+ SDL_GetNumGamepadTouchpads
(...)
@@
@@
@@ -1491,6 +1491,51 @@ typedef SDL_GameControllerButton, SDL_GamepadButton;
+ SDL_TextInputShown
(...)
@@
SDL_Event e1;
@@
- e1.key.keysym.mod
+ e1.key.mod
@@
SDL_Event *e1;
@@
- e1->key.keysym.mod
+ e1->key.mod
@@
SDL_KeyboardEvent *e1;
@@
- e1->keysym.mod
+ e1->mod
@@
SDL_Event e1;
@@
- e1.key.keysym.sym
+ e1.key.key
@@
SDL_Event *e1;
@@
- e1->key.keysym.sym
+ e1->key.key
@@
SDL_KeyboardEvent *e1;
@@
- e1->keysym.sym
+ e1->key
@@
SDL_Event e1;
@@
- e1.key.keysym.scancode
+ e1.key.scancode
@@
SDL_Event *e1;
@@
- e1->key.keysym.scancode
+ e1->key.scancode
@@
SDL_KeyboardEvent *e1;
@@
- e1->keysym.scancode
+ e1->scancode
@@
@@
- KMOD_ALT
+ SDL_KMOD_ALT
@@ -2443,6 +2488,11 @@ SDL_Event *e1;
- e1->wheel.mouseX
+ e1->wheel.mouse_x
@@
SDL_MouseWheelEvent *e1;
@@
- e1->mouseX
+ e1->mouse_x
@@
SDL_Event e1;
@@
- e1.wheel.mouseY
@@ -2453,6 +2503,41 @@ SDL_Event *e1;
- e1->wheel.mouseY
+ e1->wheel.mouse_y
@@
SDL_MouseWheelEvent *e1;
@@
- e1->mouseY
+ e1->mouse_y
@@
SDL_Event e1;
@@
- e1.wheel.preciseX
+ e1.wheel.x
@@
SDL_Event *e1;
@@
- e1->wheel.preciseX
+ e1->wheel.x
@@
SDL_MouseWheelEvent *e1;
@@
- e1->preciseX
+ e1->x
@@
SDL_Event e1;
@@
- e1.wheel.preciseY
+ e1.wheel.y
@@
SDL_Event *e1;
@@
- e1->wheel.preciseY
+ e1->wheel.y
@@
SDL_MouseWheelEvent *e1;
@@
- e1->preciseY
+ e1->y
@@
SDL_Event e1;
@@
- e1.tfinger.touchId
@@ -2463,6 +2548,11 @@ SDL_Event *e1;
- e1->tfinger.touchId
+ e1->tfinger.touchID
@@
SDL_TouchFingerEvent *e1;
@@
- e1->touchId
+ e1->touchID
@@
SDL_Event e1;
@@
- e1.tfinger.fingerId
@@ -2473,6 +2563,11 @@ SDL_Event *e1;
- e1->tfinger.fingerId
+ e1->tfinger.fingerID
@@
SDL_TouchFingerEvent *e1;
@@
- e1->fingerId
+ e1->fingerID
@@
expression e1, e2, e3, e4;
@@
- SDL_CreateWindow(e1, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, e2, e3, e4)
@@ -1,7 +1,7 @@
# Using this package
This package contains SDL built for the Android platform.
This package contains @<@PROJECT_NAME@>@ built for the Android platform.
## Gradle integration
@@ -59,7 +59,7 @@ Add `--help` for a list of all available options.
An API reference, tutorials, and additional documentation is available at:
https://wiki.libsdl.org/SDL3
https://wiki.libsdl.org/@<@PROJECT_NAME@>@
# Example code
@@ -1,19 +1,19 @@
# Using this package
This package contains SDL built for the mingw-w64 toolchain.
This package contains @<@PROJECT_NAME@>@ built for the mingw-w64 toolchain.
The files for 32-bit architecture are in i686-w64-mingw32
The files for 64-bit architecture are in x86_64-w64-mingw32
You can install them to another location, just type `make` for help.
To use this package, point your include path at _arch_/include and your library path at _arch_/lib, link with the SDL3 library and copy _arch_/bin/SDL3.dll next to your executable.
To use this package, point your include path at _arch_/include and your library path at _arch_/lib, link with the @<@PROJECT_NAME@>@ library and copy _arch_/bin/@<@PROJECT_NAME@>@.dll next to your executable.
e.g.
```sh
gcc -o hello.exe hello.c -Ix86_64-w64-mingw32/include -Lx86_64-w64-mingw32/lib -lSDL3
cp x86_64-w64-mingw32/bin/SDL3.dll .
gcc -o hello.exe hello.c -Ix86_64-w64-mingw32/include -Lx86_64-w64-mingw32/lib -l@<@PROJECT_NAME@>@
cp x86_64-w64-mingw32/bin/@<@PROJECT_NAME@>@.dll .
./hello.exe
```
@@ -21,7 +21,7 @@ cp x86_64-w64-mingw32/bin/SDL3.dll .
An API reference, tutorials, and additional documentation is available at:
https://wiki.libsdl.org/SDL3
https://wiki.libsdl.org/@<@PROJECT_NAME@>@
# Example code
@@ -1,19 +1,19 @@
# Using this package
This package contains SDL built for Visual Studio.
This package contains @<@PROJECT_NAME@>@ built for Visual Studio.
To use this package, edit your project properties:
- Add the include directory to "VC++ Directories" -> "Include Directories"
- Add the lib/_arch_ directory to "VC++ Directories" -> "Library Directories"
- Add SDL3.lib to Linker -> Input -> "Additional Dependencies"
- Copy lib/_arch_/SDL3.dll to your project directory.
- Add @<@PROJECT_NAME@>@.lib to Linker -> Input -> "Additional Dependencies"
- Copy lib/_arch_/@<@PROJECT_NAME@>@.dll to your project directory.
# Documentation
An API reference, tutorials, and additional documentation is available at:
https://wiki.libsdl.org/SDL3
https://wiki.libsdl.org/@<@PROJECT_NAME@>@
# Example code
+4 -4
View File
@@ -45,7 +45,7 @@
},
"files": {
"": [
"build-scripts/pkg-support/mingw/INSTALL.md",
"build-scripts/pkg-support/mingw/INSTALL.md.in:INSTALL.md",
"build-scripts/pkg-support/mingw/Makefile",
"LICENSE.txt",
"README.md"
@@ -117,7 +117,7 @@
},
"files-devel": {
"": [
"build-scripts/pkg-support/msvc/INSTALL.md",
"build-scripts/pkg-support/msvc/INSTALL.md.in:INSTALL.md",
"LICENSE.txt",
"README.md"
],
@@ -181,8 +181,8 @@
"x86",
"x86_64"
],
"api-minimum": 19,
"api-target": 29,
"api-minimum": 21,
"api-target": 35,
"ndk-minimum": 21,
"aar-files": {
"": [
+1 -1
View File
@@ -6,7 +6,7 @@ int main(int argc, char *argv[])
{
SDL_SetMainReady();
if (!SDL_Init(0)) {
SDL_Log("Could not initialize SDL: %s\n", SDL_GetError());
SDL_Log("Could not initialize SDL: %s", SDL_GetError());
return 1;
}
SDL_Delay(100);
+2 -2
View File
@@ -6,12 +6,12 @@ int main(int argc, char *argv[])
SDL_Window *window = NULL;
SDL_Surface *screenSurface = NULL;
if (!SDL_Init(SDL_INIT_VIDEO)) {
SDL_Log("Could not initialize SDL: %s\n", SDL_GetError());
SDL_Log("Could not initialize SDL: %s", SDL_GetError());
return 1;
}
window = SDL_CreateWindow("Hello SDL", 640, 480, 0);
if (!window) {
SDL_Log("could not create window: %s\n", SDL_GetError());
SDL_Log("could not create window: %s", SDL_GetError());
return 1;
}
screenSurface = SDL_GetWindowSurface(window);
+1 -1
View File
@@ -18,7 +18,7 @@ int MYLIBRARY_EXPORT mylibrary_work(void);
int mylibrary_init(void) {
SDL_SetMainReady();
if (!SDL_Init(0)) {
SDL_Log("Could not initialize SDL: %s\n", SDL_GetError());
SDL_Log("Could not initialize SDL: %s", SDL_GetError());
return 1;
}
return 0;
+30 -18
View File
@@ -1,35 +1,47 @@
# Introduction to SDL with Emscripten
The easiest way to use SDL is to include it as a subproject in your project.
We'll start by creating a simple project to build and run [hello.c](hello.c)
First, you should have the Emscripten SDK installed from:
https://emscripten.org/docs/getting_started/downloads.html
We'll start by creating a simple project to build and run [hello.c](hello.c)
Create the file CMakeLists.txt
```cmake
cmake_minimum_required(VERSION 3.16)
project(hello)
## Building SDL
# set the output directory for built objects.
# This makes sure that the dynamic library goes into the build directory automatically.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$<CONFIGURATION>")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$<CONFIGURATION>")
Once you have a command line interface with the Emscripten SDK set up and you've changed directory to the SDL directory, you can build SDL like this:
# This assumes the SDL source is available in vendored/SDL
add_subdirectory(vendored/SDL EXCLUDE_FROM_ALL)
# on Web targets, we need CMake to generate a HTML webpage.
if(EMSCRIPTEN)
set(CMAKE_EXECUTABLE_SUFFIX ".html" CACHE INTERNAL "")
endif()
# Create your game executable target as usual
add_executable(hello WIN32 hello.c)
# Link to the actual SDL3 library.
target_link_libraries(hello PRIVATE SDL3::SDL3)
```
Build:
```sh
mkdir hello
cd hello
emcmake cmake ..
emcmake cmake -S . -B build
cd build
emmake make
```
## Building your app
In this case we'll just run a simple command to compile our source with the SDL library we just built:
```sh
emcc -o index.html ../docs/hello.c -I../include -L. -lSDL3
```
## Running your app
You can now run your app by pointing a webserver at your build directory and connecting a web browser to it.
## More information
You can now run your app by pointing a webserver at your build directory and connecting a web browser to it, opening hello.html
A more complete example is available at:
+1 -2
View File
@@ -8,8 +8,7 @@ We'll start by creating a simple project to build and run [hello.c](hello.c)
- Create a new project in Visual Studio, using the C++ Empty Project template
- Add hello.c to the Source Files
- Right click the solution, select add an existing project, navigate to VisualC/SDL and add SDL.vcxproj
- Select your main project and go to Project -> Project Dependencies and select SDL3
- Select your main project and go to Project -> Properties, set the filter at the top to "All Configurations" and "All Platforms", select VC++ Directories and add the SDL include directory to "Include Directories"
- Select your main project and go to Project -> Add Reference and select SDL3
- Select your main project and go to Project -> Properties, set the filter at the top to "All Configurations" and "All Platforms", select VC++ Directories and add the SDL include directory to "Include Directories"
- Build and run!
+6 -6
View File
@@ -193,7 +193,7 @@ Rather than iterating over audio devices using a device index, there are new fun
if (devices) {
for (i = 0; i < num_devices; ++i) {
SDL_AudioDeviceID instance_id = devices[i];
SDL_Log("AudioDevice %" SDL_PRIu32 ": %s\n", instance_id, SDL_GetAudioDeviceName(instance_id));
SDL_Log("AudioDevice %" SDL_PRIu32 ": %s", instance_id, SDL_GetAudioDeviceName(instance_id));
}
SDL_free(devices);
}
@@ -749,7 +749,7 @@ Rather than iterating over haptic devices using device index, there is a new fun
if (haptics) {
for (i = 0; i < num_haptics; ++i) {
SDL_HapticID instance_id = haptics[i];
SDL_Log("Haptic %" SDL_PRIu32 ": %s\n", instance_id, SDL_GetHapticNameForID(instance_id));
SDL_Log("Haptic %" SDL_PRIu32 ": %s", instance_id, SDL_GetHapticNameForID(instance_id));
}
SDL_free(haptics);
}
@@ -917,7 +917,7 @@ Rather than iterating over joysticks using device index, there is a new function
const char *name = SDL_GetJoystickNameForID(instance_id);
const char *path = SDL_GetJoystickPathForID(instance_id);
SDL_Log("Joystick %" SDL_PRIu32 ": %s%s%s VID 0x%.4x, PID 0x%.4x\n",
SDL_Log("Joystick %" SDL_PRIu32 ": %s%s%s VID 0x%.4x, PID 0x%.4x",
instance_id, name ? name : "Unknown", path ? ", " : "", path ? path : "", SDL_GetJoystickVendorForID(instance_id), SDL_GetJoystickProductForID(instance_id));
}
SDL_free(joysticks);
@@ -1696,7 +1696,7 @@ Rather than iterating over sensors using device index, there is a new function S
SDL_SensorID *sensors = SDL_GetSensors(&num_sensors);
if (sensors) {
for (i = 0; i < num_sensors; ++i) {
SDL_Log("Sensor %" SDL_PRIu32 ": %s, type %d, platform type %d\n",
SDL_Log("Sensor %" SDL_PRIu32 ": %s, type %d, platform type %d",
sensors[i],
SDL_GetSensorNameForID(sensors[i]),
SDL_GetSensorTypeForID(sensors[i]),
@@ -2121,7 +2121,7 @@ Rather than iterating over displays using display index, there is a new function
SDL_DisplayID instance_id = displays[i];
const char *name = SDL_GetDisplayName(instance_id);
SDL_Log("Display %" SDL_PRIu32 ": %s\n", instance_id, name ? name : "Unknown");
SDL_Log("Display %" SDL_PRIu32 ": %s", instance_id, name ? name : "Unknown");
}
SDL_free(displays);
}
@@ -2167,7 +2167,7 @@ Rather than iterating over display modes using an index, there is a new function
if (modes) {
for (i = 0; i < num_modes; ++i) {
SDL_DisplayMode *mode = modes[i];
SDL_Log("Display %" SDL_PRIu32 " mode %d: %dx%d@%gx %gHz\n",
SDL_Log("Display %" SDL_PRIu32 " mode %d: %dx%d@%gx %gHz",
display, i, mode->w, mode->h, mode->pixel_density, mode->refresh_rate);
}
SDL_free(modes);
+1 -1
View File
@@ -21,7 +21,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
{
/* Create the window */
if (!SDL_CreateWindowAndRenderer("Hello World", 800, 600, SDL_WINDOW_FULLSCREEN, &window, &renderer)) {
SDL_Log("Couldn't create window and renderer: %s\n", SDL_GetError());
SDL_Log("Couldn't create window and renderer: %s", SDL_GetError());
return SDL_APP_FAILURE;
}
return SDL_APP_CONTINUE;
+1 -1
View File
@@ -1,5 +1,5 @@
If you're running this in a web browser, you need to click the window before you'll hear anything!
This example code creates an simple audio stream for playing sound, and
This example code creates a simple audio stream for playing sound, and
generates a sine wave sound effect for it to play as time goes on. This is the
simplest way to get up and running with procedural sound.
@@ -1,5 +1,5 @@
/*
* This example code creates an simple audio stream for playing sound, and
* This example code creates a simple audio stream for playing sound, and
* generates a sine wave sound effect for it to play as time goes on. This
* is the simplest way to get up and running with procedural sound.
*
@@ -1,5 +1,5 @@
If you're running this in a web browser, you need to click the window before you'll hear anything!
This example code creates an simple audio stream for playing sound, and
This example code creates a simple audio stream for playing sound, and
generates a sine wave sound effect for it to play as time goes on. Unlike
the previous example, this uses a callback to generate sound.
@@ -1,5 +1,5 @@
/*
* This example code creates an simple audio stream for playing sound, and
* This example code creates a simple audio stream for playing sound, and
* generates a sine wave sound effect for it to play as time goes on. Unlike
* the previous example, this uses a callback to generate sound.
*
+1 -1
View File
@@ -1,5 +1,5 @@
If you're running this in a web browser, you need to click the window before you'll hear anything!
This example code creates an simple audio stream for playing sound, and
This example code creates a simple audio stream for playing sound, and
loads a .wav file that is pushed through the stream in a loop.
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* This example code creates an simple audio stream for playing sound, and
* This example code creates a simple audio stream for playing sound, and
* loads a .wav file that is pushed through the stream in a loop.
*
* This code is public domain. Feel free to use it for any purpose!
@@ -19,6 +19,8 @@ static SDL_Texture *render_target = NULL;
static float pressure = 0.0f;
static float previous_touch_x = -1.0f;
static float previous_touch_y = -1.0f;
static float tilt_x = 0.0f;
static float tilt_y = 0.0f;
/* This function runs once at startup. */
SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
@@ -84,6 +86,10 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
} else if (event->type == SDL_EVENT_PEN_AXIS) {
if (event->paxis.axis == SDL_PEN_AXIS_PRESSURE) {
pressure = event->paxis.value; /* remember new pressure for later draws. */
} else if(event->paxis.axis == SDL_PEN_AXIS_XTILT) {
tilt_x = event->paxis.value;
} else if(event->paxis.axis == SDL_PEN_AXIS_YTILT) {
tilt_y = event->paxis.value;
}
}
@@ -93,11 +99,15 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
/* This function runs once per frame, and is the heart of the program. */
SDL_AppResult SDL_AppIterate(void *appstate)
{
char debug_text[1024];
/* make sure we're drawing to the window and not the render target */
SDL_SetRenderTarget(renderer, NULL);
SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
SDL_RenderClear(renderer); /* just in case. */
SDL_RenderTexture(renderer, render_target, NULL, NULL);
SDL_snprintf(debug_text, sizeof(debug_text), "Tilt: %f %f", tilt_x, tilt_y);
SDL_RenderDebugText(renderer, 0, 8, debug_text);
SDL_RenderPresent(renderer);
return SDL_APP_CONTINUE; /* carry on with the program! */
}
+1 -1
View File
@@ -20,7 +20,7 @@
*/
/**
* Main include header for the SDL library, version 3.2.0
* Main include header for the SDL library, version 3.2.2
*
* It is almost always best to include just this one header instead of
* picking out individual headers included here. There are exceptions to
+1 -1
View File
@@ -498,7 +498,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_AddAtomicInt(SDL_AtomicInt *a, int v);
*
* ***Note: If you don't know what this macro is for, you shouldn't use it!***
*
* \param a a pointer to an SDL_AtomicInt to increment.
* \param a a pointer to an SDL_AtomicInt to decrement.
* \returns true if the variable reached zero after decrementing, false
* otherwise.
*
+9 -6
View File
@@ -781,7 +781,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_IsAudioDevicePlayback(SDL_AudioDeviceID dev
* Physical devices can not be paused or unpaused, only logical devices
* created through SDL_OpenAudioDevice() can be.
*
* \param dev a device opened by SDL_OpenAudioDevice().
* \param devid a device opened by SDL_OpenAudioDevice().
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
@@ -792,7 +792,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_IsAudioDevicePlayback(SDL_AudioDeviceID dev
* \sa SDL_ResumeAudioDevice
* \sa SDL_AudioDevicePaused
*/
extern SDL_DECLSPEC bool SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
extern SDL_DECLSPEC bool SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID devid);
/**
* Use this function to unpause audio playback on a specified device.
@@ -809,7 +809,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
* Physical devices can not be paused or unpaused, only logical devices
* created through SDL_OpenAudioDevice() can be.
*
* \param dev a device opened by SDL_OpenAudioDevice().
* \param devid a device opened by SDL_OpenAudioDevice().
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
@@ -820,7 +820,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
* \sa SDL_AudioDevicePaused
* \sa SDL_PauseAudioDevice
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID dev);
extern SDL_DECLSPEC bool SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID devid);
/**
* Use this function to query if an audio device is paused.
@@ -832,7 +832,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID dev);
* created through SDL_OpenAudioDevice() can be. Physical and invalid device
* IDs will report themselves as unpaused here.
*
* \param dev a device opened by SDL_OpenAudioDevice().
* \param devid a device opened by SDL_OpenAudioDevice().
* \returns true if device is valid and paused, false otherwise.
*
* \threadsafety It is safe to call this function from any thread.
@@ -842,7 +842,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID dev);
* \sa SDL_PauseAudioDevice
* \sa SDL_ResumeAudioDevice
*/
extern SDL_DECLSPEC bool SDLCALL SDL_AudioDevicePaused(SDL_AudioDeviceID dev);
extern SDL_DECLSPEC bool SDLCALL SDL_AudioDevicePaused(SDL_AudioDeviceID devid);
/**
* Get the gain of an audio device.
@@ -1583,6 +1583,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PauseAudioStreamDevice(SDL_AudioStream *str
* previously been paused. Once unpaused, any bound audio streams will begin
* to progress again, and audio can be generated.
*
* Remember, SDL_OpenAudioDeviceStream opens device in a paused state, so this
* function call is required for audio playback to begin on such device.
*
* \param stream the audio stream associated with the audio device to resume.
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
+2 -2
View File
@@ -239,7 +239,7 @@ extern SDL_DECLSPEC SDL_CameraID * SDLCALL SDL_GetCameras(int *count);
* there _is_ a camera until the user has given you permission to check
* through a scary warning popup.
*
* \param devid the camera device instance ID to query.
* \param instance_id the camera device instance ID.
* \param count a pointer filled in with the number of elements in the list,
* may be NULL.
* \returns a NULL terminated array of pointers to SDL_CameraSpec or NULL on
@@ -254,7 +254,7 @@ extern SDL_DECLSPEC SDL_CameraID * SDLCALL SDL_GetCameras(int *count);
* \sa SDL_GetCameras
* \sa SDL_OpenCamera
*/
extern SDL_DECLSPEC SDL_CameraSpec ** SDLCALL SDL_GetCameraSupportedFormats(SDL_CameraID devid, int *count);
extern SDL_DECLSPEC SDL_CameraSpec ** SDLCALL SDL_GetCameraSupportedFormats(SDL_CameraID instance_id, int *count);
/**
* Get the human-readable device name for a camera.
+1 -1
View File
@@ -29,7 +29,7 @@
* "joysticks" now are actually console-style gamepads. So SDL provides the
* gamepad API on top of the lower-level joystick functionality.
*
* The difference betweena joystick and a gamepad is that a gamepad tells you
* The difference between a joystick and a gamepad is that a gamepad tells you
* _where_ a button or axis is on the device. You don't speak to gamepads in
* terms of arbitrary numbers like "button 3" or "axis 2" but in standard
* locations: the d-pad, the shoulder buttons, triggers, A/B/X/Y (or
+72 -2
View File
@@ -130,7 +130,8 @@
* It is optimal for apps to pre-compile the shader formats they might use,
* but for ease of use SDL provides a separate project,
* [SDL_shadercross](https://github.com/libsdl-org/SDL_shadercross)
* , for performing runtime shader cross-compilation.
* , for performing runtime shader cross-compilation. It also has a CLI
* interface for offline precompilation as well.
*
* This is an extremely quick overview that leaves out several important
* details. Already, though, one can see that GPU programming can be quite
@@ -888,6 +889,10 @@ typedef enum SDL_GPUCubeMapFace
* Unlike textures, READ | WRITE can be used for simultaneous read-write
* usage. The same data synchronization concerns as textures apply.
*
* If you use a STORAGE flag, the data in the buffer must respect std140
* layout conventions. In practical terms this means you must ensure that vec3
* and vec4 fields are 16-byte aligned.
*
* \since This datatype is available since SDL 3.2.0.
*
* \sa SDL_CreateGPUBuffer
@@ -1809,6 +1814,7 @@ typedef struct SDL_GPUGraphicsPipelineTargetInfo
* \since This struct is available since SDL 3.2.0.
*
* \sa SDL_CreateGPUGraphicsPipeline
* \sa SDL_GPUShader
* \sa SDL_GPUVertexInputState
* \sa SDL_GPUPrimitiveType
* \sa SDL_GPURasterizerState
@@ -1836,6 +1842,7 @@ typedef struct SDL_GPUGraphicsPipelineCreateInfo
* \since This struct is available since SDL 3.2.0.
*
* \sa SDL_CreateGPUComputePipeline
* \sa SDL_GPUShaderFormat
*/
typedef struct SDL_GPUComputePipelineCreateInfo
{
@@ -2490,6 +2497,10 @@ extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_CreateGPUTexture(
* Note that certain combinations of usage flags are invalid. For example, a
* buffer cannot have both the VERTEX and INDEX flags.
*
* If you use a STORAGE flag, the data in the buffer must respect std140
* layout conventions. In practical terms this means you must ensure that vec3
* and vec4 fields are 16-byte aligned.
*
* For better understanding of underlying concepts and memory management with
* SDL GPU API, you may refer
* [this blog post](https://moonside.games/posts/sdl-gpu-concepts-cycling/)
@@ -2792,6 +2803,10 @@ extern SDL_DECLSPEC SDL_GPUCommandBuffer *SDLCALL SDL_AcquireGPUCommandBuffer(
*
* Subsequent draw calls will use this uniform data.
*
* The data being pushed must respect std140 layout conventions. In practical
* terms this means you must ensure that vec3 and vec4 fields are 16-byte
* aligned.
*
* \param command_buffer a command buffer.
* \param slot_index the vertex uniform slot to push data to.
* \param data client data to write.
@@ -2810,6 +2825,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_PushGPUVertexUniformData(
*
* Subsequent draw calls will use this uniform data.
*
* The data being pushed must respect std140 layout conventions. In practical
* terms this means you must ensure that vec3 and vec4 fields are 16-byte
* aligned.
*
* \param command_buffer a command buffer.
* \param slot_index the fragment uniform slot to push data to.
* \param data client data to write.
@@ -2828,6 +2847,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_PushGPUFragmentUniformData(
*
* Subsequent draw calls will use this uniform data.
*
* The data being pushed must respect std140 layout conventions. In practical
* terms this means you must ensure that vec3 and vec4 fields are 16-byte
* aligned.
*
* \param command_buffer a command buffer.
* \param slot_index the uniform slot to push data to.
* \param data client data to write.
@@ -2978,6 +3001,9 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUIndexBuffer(
*
* The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER.
*
* Be sure your shader is set up according to the requirements documented in
* SDL_CreateGPUShader().
*
* \param render_pass a render pass handle.
* \param first_slot the vertex sampler slot to begin binding from.
* \param texture_sampler_bindings an array of texture-sampler binding
@@ -2986,6 +3012,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUIndexBuffer(
* array.
*
* \since This function is available since SDL 3.2.0.
*
* \sa SDL_CreateGPUShader
*/
extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexSamplers(
SDL_GPURenderPass *render_pass,
@@ -2999,12 +3027,17 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexSamplers(
* These textures must have been created with
* SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ.
*
* Be sure your shader is set up according to the requirements documented in
* SDL_CreateGPUShader().
*
* \param render_pass a render pass handle.
* \param first_slot the vertex storage texture slot to begin binding from.
* \param storage_textures an array of storage textures.
* \param num_bindings the number of storage texture to bind from the array.
*
* \since This function is available since SDL 3.2.0.
*
* \sa SDL_CreateGPUShader
*/
extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexStorageTextures(
SDL_GPURenderPass *render_pass,
@@ -3018,12 +3051,17 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexStorageTextures(
* These buffers must have been created with
* SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ.
*
* Be sure your shader is set up according to the requirements documented in
* SDL_CreateGPUShader().
*
* \param render_pass a render pass handle.
* \param first_slot the vertex storage buffer slot to begin binding from.
* \param storage_buffers an array of buffers.
* \param num_bindings the number of buffers to bind from the array.
*
* \since This function is available since SDL 3.2.0.
*
* \sa SDL_CreateGPUShader
*/
extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexStorageBuffers(
SDL_GPURenderPass *render_pass,
@@ -3036,6 +3074,9 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexStorageBuffers(
*
* The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER.
*
* Be sure your shader is set up according to the requirements documented in
* SDL_CreateGPUShader().
*
* \param render_pass a render pass handle.
* \param first_slot the fragment sampler slot to begin binding from.
* \param texture_sampler_bindings an array of texture-sampler binding
@@ -3044,6 +3085,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexStorageBuffers(
* array.
*
* \since This function is available since SDL 3.2.0.
*
* \sa SDL_CreateGPUShader
*/
extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentSamplers(
SDL_GPURenderPass *render_pass,
@@ -3057,12 +3100,17 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentSamplers(
* These textures must have been created with
* SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ.
*
* Be sure your shader is set up according to the requirements documented in
* SDL_CreateGPUShader().
*
* \param render_pass a render pass handle.
* \param first_slot the fragment storage texture slot to begin binding from.
* \param storage_textures an array of storage textures.
* \param num_bindings the number of storage textures to bind from the array.
*
* \since This function is available since SDL 3.2.0.
*
* \sa SDL_CreateGPUShader
*/
extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentStorageTextures(
SDL_GPURenderPass *render_pass,
@@ -3076,12 +3124,17 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentStorageTextures(
* These buffers must have been created with
* SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ.
*
* Be sure your shader is set up according to the requirements documented in
* SDL_CreateGPUShader().
*
* \param render_pass a render pass handle.
* \param first_slot the fragment storage buffer slot to begin binding from.
* \param storage_buffers an array of storage buffers.
* \param num_bindings the number of storage buffers to bind from the array.
*
* \since This function is available since SDL 3.2.0.
*
* \sa SDL_CreateGPUShader
*/
extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentStorageBuffers(
SDL_GPURenderPass *render_pass,
@@ -3269,6 +3322,9 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputePipeline(
*
* The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER.
*
* Be sure your shader is set up according to the requirements documented in
* SDL_CreateGPUShader().
*
* \param compute_pass a compute pass handle.
* \param first_slot the compute sampler slot to begin binding from.
* \param texture_sampler_bindings an array of texture-sampler binding
@@ -3277,6 +3333,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputePipeline(
* array.
*
* \since This function is available since SDL 3.2.0.
*
* \sa SDL_CreateGPUShader
*/
extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeSamplers(
SDL_GPUComputePass *compute_pass,
@@ -3290,12 +3348,17 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeSamplers(
* These textures must have been created with
* SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ.
*
* Be sure your shader is set up according to the requirements documented in
* SDL_CreateGPUShader().
*
* \param compute_pass a compute pass handle.
* \param first_slot the compute storage texture slot to begin binding from.
* \param storage_textures an array of storage textures.
* \param num_bindings the number of storage textures to bind from the array.
*
* \since This function is available since SDL 3.2.0.
*
* \sa SDL_CreateGPUShader
*/
extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeStorageTextures(
SDL_GPUComputePass *compute_pass,
@@ -3309,12 +3372,17 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeStorageTextures(
* These buffers must have been created with
* SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ.
*
* Be sure your shader is set up according to the requirements documented in
* SDL_CreateGPUShader().
*
* \param compute_pass a compute pass handle.
* \param first_slot the compute storage buffer slot to begin binding from.
* \param storage_buffers an array of storage buffer binding structs.
* \param num_bindings the number of storage buffers to bind from the array.
*
* \since This function is available since SDL 3.2.0.
*
* \sa SDL_CreateGPUShader
*/
extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeStorageBuffers(
SDL_GPUComputePass *compute_pass,
@@ -3389,7 +3457,9 @@ extern SDL_DECLSPEC void SDLCALL SDL_EndGPUComputePass(
/**
* Maps a transfer buffer into application address space.
*
* You must unmap the transfer buffer before encoding upload commands.
* You must unmap the transfer buffer before encoding upload commands. The
* memory is owned by the graphics driver - do NOT call SDL_free() on the
* returned pointer.
*
* \param device a GPU context.
* \param transfer_buffer a transfer buffer.
+9
View File
@@ -56,6 +56,15 @@
* - Windows: debug output stream
* - Android: log output
* - Others: standard error output (stderr)
*
* You don't need to have a newline (`\n`) on the end of messages, the
* functions will do that for you. For consistent behavior cross-platform, you
* shouldn't have any newlines in messages, such as to log multiple lines in
* one call; unusual platform-specific behavior can be observed in such usage.
* Do one log call per line instead, with no newlines in messages.
*
* Each log call is atomic, so you won't see log messages cut off one another
* when logging from multiple threads.
*/
#ifndef SDL_log_h_
+2 -2
View File
@@ -173,13 +173,13 @@ typedef enum SDL_ProcessIO
* standard input when `SDL_PROP_PROCESS_CREATE_STDIN_NUMBER` is set to
* `SDL_PROCESS_STDIO_REDIRECT`.
* - `SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER`: an SDL_ProcessIO value
* describing where standard output for the process goes go, defaults to
* describing where standard output for the process goes to, defaults to
* `SDL_PROCESS_STDIO_INHERITED`.
* - `SDL_PROP_PROCESS_CREATE_STDOUT_POINTER`: an SDL_IOStream pointer used
* for standard output when `SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER` is set
* to `SDL_PROCESS_STDIO_REDIRECT`.
* - `SDL_PROP_PROCESS_CREATE_STDERR_NUMBER`: an SDL_ProcessIO value
* describing where standard error for the process goes go, defaults to
* describing where standard error for the process goes to, defaults to
* `SDL_PROCESS_STDIO_INHERITED`.
* - `SDL_PROP_PROCESS_CREATE_STDERR_POINTER`: an SDL_IOStream pointer used
* for standard error when `SDL_PROP_PROCESS_CREATE_STDERR_NUMBER` is set to
+14 -14
View File
@@ -4701,7 +4701,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_atan2(double y, double x);
*
* \since This function is available since SDL 3.2.0.
*
* \sa SDL_atan2f
* \sa SDL_atan2
* \sa SDL_atan
* \sa SDL_tan
*/
@@ -4810,7 +4810,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_copysign(double x, double y);
*
* \since This function is available since SDL 3.2.0.
*
* \sa SDL_copysignf
* \sa SDL_copysign
* \sa SDL_fabsf
*/
extern SDL_DECLSPEC float SDLCALL SDL_copysignf(float x, float y);
@@ -4943,7 +4943,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_expf(float x);
* Range: `0 <= y <= INF`
*
* This function operates on double-precision floating point values, use
* SDL_copysignf for single-precision floats.
* SDL_fabsf for single-precision floats.
*
* \param x floating point value to use as the magnitude.
* \returns the absolute value of `x`.
@@ -4964,7 +4964,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_fabs(double x);
* Range: `0 <= y <= INF`
*
* This function operates on single-precision floating point values, use
* SDL_copysignf for double-precision floats.
* SDL_fabs for double-precision floats.
*
* \param x floating point value to use as the magnitude.
* \returns the absolute value of `x`.
@@ -5016,7 +5016,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_floor(double x);
* Range: `-INF <= y <= INF`, y integer
*
* This function operates on single-precision floating point values, use
* SDL_floorf for double-precision floats.
* SDL_floor for double-precision floats.
*
* \param x floating point value.
* \returns the floor of `x`.
@@ -5073,7 +5073,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_trunc(double x);
* Range: `-INF <= y <= INF`, y integer
*
* This function operates on single-precision floating point values, use
* SDL_truncf for double-precision floats.
* SDL_trunc for double-precision floats.
*
* \param x floating point value.
* \returns `x` truncated to an integer.
@@ -5131,7 +5131,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_fmod(double x, double y);
* Range: `-y <= z <= y`
*
* This function operates on single-precision floating point values, use
* SDL_fmod for single-precision floats.
* SDL_fmod for double-precision floats.
*
* \param x the numerator.
* \param y the denominator. Must not be 0.
@@ -5409,7 +5409,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_pow(double x, double y);
* instead.
*
* This function operates on single-precision floating point values, use
* SDL_powf for double-precision floats.
* SDL_pow for double-precision floats.
*
* This function may use a different approximation across different versions,
* platforms and configurations. i.e, it can return a different value given
@@ -5469,8 +5469,8 @@ extern SDL_DECLSPEC double SDLCALL SDL_round(double x);
*
* Range: `-INF <= y <= INF`, y integer
*
* This function operates on double-precision floating point values, use
* SDL_roundf for single-precision floats. To get the result as an integer
* This function operates on single-precision floating point values, use
* SDL_round for double-precision floats. To get the result as an integer
* type, use SDL_lroundf.
*
* \param x floating point value.
@@ -5499,7 +5499,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_roundf(float x);
* Range: `MIN_LONG <= y <= MAX_LONG`
*
* This function operates on double-precision floating point values, use
* SDL_lround for single-precision floats. To get the result as a
* SDL_lroundf for single-precision floats. To get the result as a
* floating-point type, use SDL_round.
*
* \param x floating point value.
@@ -5528,8 +5528,8 @@ extern SDL_DECLSPEC long SDLCALL SDL_lround(double x);
* Range: `MIN_LONG <= y <= MAX_LONG`
*
* This function operates on single-precision floating point values, use
* SDL_lroundf for double-precision floats. To get the result as a
* floating-point type, use SDL_roundf,
* SDL_lround for double-precision floats. To get the result as a
* floating-point type, use SDL_roundf.
*
* \param x floating point value.
* \returns the nearest integer to `x`.
@@ -5742,7 +5742,7 @@ extern SDL_DECLSPEC double SDLCALL SDL_tan(double x);
* Range: `-INF <= y <= INF`
*
* This function operates on single-precision floating point values, use
* SDL_tanf for double-precision floats.
* SDL_tan for double-precision floats.
*
* This function may use a different approximation across different versions,
* platforms and configurations. i.e, it can return a different value given
+2 -2
View File
@@ -636,10 +636,10 @@ extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetStorageSpaceRemaining(SDL_Storage *sto
* Enumerate a directory tree, filtered by pattern, and return a list.
*
* Files are filtered out if they don't match the string in `pattern`, which
* may contain wildcard characters '*' (match everything) and '?' (match one
* may contain wildcard characters `*` (match everything) and `?` (match one
* character). If pattern is NULL, no filtering is done and all results are
* returned. Subdirectories are permitted, and are specified with a path
* separator of '/'. Wildcard characters '*' and '?' never match a path
* separator of '/'. Wildcard characters `*` and `?` never match a path
* separator.
*
* `flags` may be set to SDL_GLOB_CASEINSENSITIVE to make the pattern matching
+1 -1
View File
@@ -62,7 +62,7 @@ extern "C" {
*
* \since This macro is available since SDL 3.2.0.
*/
#define SDL_MICRO_VERSION 0
#define SDL_MICRO_VERSION 2
/**
* This macro turns the version numbers into a numeric value.
+6 -6
View File
@@ -766,25 +766,25 @@ static void SDLCALL SDL_DumpPropertiesCallback(void *userdata, SDL_PropertiesID
{
switch (SDL_GetPropertyType(props, name)) {
case SDL_PROPERTY_TYPE_POINTER:
SDL_Log("%s: %p\n", name, SDL_GetPointerProperty(props, name, NULL));
SDL_Log("%s: %p", name, SDL_GetPointerProperty(props, name, NULL));
break;
case SDL_PROPERTY_TYPE_STRING:
SDL_Log("%s: \"%s\"\n", name, SDL_GetStringProperty(props, name, ""));
SDL_Log("%s: \"%s\"", name, SDL_GetStringProperty(props, name, ""));
break;
case SDL_PROPERTY_TYPE_NUMBER:
{
Sint64 value = SDL_GetNumberProperty(props, name, 0);
SDL_Log("%s: %" SDL_PRIs64 " (%" SDL_PRIx64 ")\n", name, value, value);
SDL_Log("%s: %" SDL_PRIs64 " (%" SDL_PRIx64 ")", name, value, value);
}
break;
case SDL_PROPERTY_TYPE_FLOAT:
SDL_Log("%s: %g\n", name, SDL_GetFloatProperty(props, name, 0.0f));
SDL_Log("%s: %g", name, SDL_GetFloatProperty(props, name, 0.0f));
break;
case SDL_PROPERTY_TYPE_BOOLEAN:
SDL_Log("%s: %s\n", name, SDL_GetBooleanProperty(props, name, false) ? "true" : "false");
SDL_Log("%s: %s", name, SDL_GetBooleanProperty(props, name, false) ? "true" : "false");
break;
default:
SDL_Log("%s UNKNOWN TYPE\n", name);
SDL_Log("%s UNKNOWN TYPE", name);
break;
}
}
+1 -1
View File
@@ -240,7 +240,7 @@ void SDL_SetObjectsInvalid(void)
type = "unknown object";
break;
}
SDL_Log("Leaked %s (%p)\n", type, object);
SDL_Log("Leaked %s (%p)", type, object);
}
SDL_assert(SDL_HashTableEmpty(SDL_objects));
+6 -14
View File
@@ -237,7 +237,7 @@ static void SwizzleAudio(const int num_frames, void *dst, const void *src, int c
void ConvertAudio(int num_frames,
const void *src, SDL_AudioFormat src_format, int src_channels, const int *src_map,
void *dst, SDL_AudioFormat dst_format, int dst_channels, const int *dst_map,
void* scratch, float gain)
void *scratch, float gain)
{
SDL_assert(src != NULL);
SDL_assert(dst != NULL);
@@ -325,7 +325,7 @@ void ConvertAudio(int num_frames,
// Gain adjustment
if (gain != 1.0f) {
float *buf = (float *)(dstconvert ? scratch : dst);
float *buf = (float *)((channelconvert || dstconvert) ? scratch : dst);
const int total_samples = num_frames * src_channels;
if (src == buf) {
for (int i = 0; i < total_samples; i++) {
@@ -558,9 +558,9 @@ bool SDL_SetAudioStreamFormat(SDL_AudioStream *stream, const SDL_AudioSpec *src_
return SDL_InvalidParamError("stream");
}
// Picked mostly arbitrarily.
static const int min_freq = 4000;
static const int max_freq = 384000;
// note that while we've removed the maximum frequency checks, SDL _will_
// fail to resample to extremely high sample rates correctly. Really high,
// like 196608000Hz. File a bug. :P
if (src_spec) {
if (!SDL_IsSupportedAudioFormat(src_spec->format)) {
@@ -569,10 +569,6 @@ bool SDL_SetAudioStreamFormat(SDL_AudioStream *stream, const SDL_AudioSpec *src_
return SDL_InvalidParamError("src_spec->channels");
} else if (src_spec->freq <= 0) {
return SDL_InvalidParamError("src_spec->freq");
} else if (src_spec->freq < min_freq) {
return SDL_SetError("Source rate is too low");
} else if (src_spec->freq > max_freq) {
return SDL_SetError("Source rate is too high");
}
}
@@ -583,10 +579,6 @@ bool SDL_SetAudioStreamFormat(SDL_AudioStream *stream, const SDL_AudioSpec *src_
return SDL_InvalidParamError("dst_spec->channels");
} else if (dst_spec->freq <= 0) {
return SDL_InvalidParamError("dst_spec->freq");
} else if (dst_spec->freq < min_freq) {
return SDL_SetError("Destination rate is too low");
} else if (dst_spec->freq > max_freq) {
return SDL_SetError("Destination rate is too high");
}
}
@@ -1030,7 +1022,7 @@ static bool GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int o
Uint8* work_buffer = NULL;
// Ensure we have enough scratch space for any conversions
if ((src_format != dst_format) || (src_channels != dst_channels)) {
if ((src_format != dst_format) || (src_channels != dst_channels) || (gain != 1.0f)) {
work_buffer = EnsureAudioStreamWorkBufferSize(stream, output_frames * max_frame_size);
if (!work_buffer) {
+1 -1
View File
@@ -548,7 +548,7 @@ const Uint8 *SDL_ReadFromAudioQueue(SDL_AudioQueue *queue,
size_t dst_present_bytes = present_frames * dst_frame_size;
size_t dst_future_bytes = future_frames * dst_frame_size;
bool convert = (src_format != dst_format) || (src_channels != dst_channels);
const bool convert = (src_format != dst_format) || (src_channels != dst_channels) || (gain != 1.0f);
if (convert && !dst) {
// The user didn't ask for the data to be copied, but we need to convert it, so store it in the scratch buffer
+1 -1
View File
@@ -28,7 +28,7 @@
#define DEBUG_AUDIO_CONVERT 0
#if DEBUG_AUDIO_CONVERT
#define LOG_DEBUG_AUDIO_CONVERT(from, to) SDL_Log("SDL_AUDIO_CONVERT: Converting %s to %s.\n", from, to);
#define LOG_DEBUG_AUDIO_CONVERT(from, to) SDL_Log("SDL_AUDIO_CONVERT: Converting %s to %s.", from, to);
#else
#define LOG_DEBUG_AUDIO_CONVERT(from, to)
#endif
+6 -6
View File
@@ -102,7 +102,7 @@ static aaudio_data_callback_result_t AAUDIO_dataCallback(AAudioStream *stream, v
size_t end = (offset + size) % hidden->mixbuf_bytes;
SDL_assert(size <= hidden->mixbuf_bytes);
//LOGI("Recorded %zu frames, %zu available, %zu max (%zu written, %zu read)\n", callback_bytes / framesize, available_bytes / framesize, hidden->mixbuf_bytes / framesize, hidden->callback_bytes / framesize, hidden->processed_bytes / framesize);
//LOGI("Recorded %zu frames, %zu available, %zu max (%zu written, %zu read)", callback_bytes / framesize, available_bytes / framesize, hidden->mixbuf_bytes / framesize, hidden->callback_bytes / framesize, hidden->processed_bytes / framesize);
if (offset <= end) {
SDL_memcpy(&hidden->mixbuf[offset], input, size);
@@ -116,7 +116,7 @@ static aaudio_data_callback_result_t AAUDIO_dataCallback(AAudioStream *stream, v
hidden->callback_bytes += size;
if (size < callback_bytes) {
LOGI("Audio recording overflow, dropped %zu frames\n", (callback_bytes - size) / framesize);
LOGI("Audio recording overflow, dropped %zu frames", (callback_bytes - size) / framesize);
}
} else {
Uint8 *output = (Uint8 *)audioData;
@@ -126,7 +126,7 @@ static aaudio_data_callback_result_t AAUDIO_dataCallback(AAudioStream *stream, v
size_t end = (offset + size) % hidden->mixbuf_bytes;
SDL_assert(size <= hidden->mixbuf_bytes);
//LOGI("Playing %zu frames, %zu available, %zu max (%zu written, %zu read)\n", callback_bytes / framesize, available_bytes / framesize, hidden->mixbuf_bytes / framesize, hidden->processed_bytes / framesize, hidden->callback_bytes / framesize);
//LOGI("Playing %zu frames, %zu available, %zu max (%zu written, %zu read)", callback_bytes / framesize, available_bytes / framesize, hidden->mixbuf_bytes / framesize, hidden->processed_bytes / framesize, hidden->callback_bytes / framesize);
SDL_MemoryBarrierAcquire();
if (offset <= end) {
@@ -139,7 +139,7 @@ static aaudio_data_callback_result_t AAUDIO_dataCallback(AAudioStream *stream, v
hidden->callback_bytes += size;
if (size < callback_bytes) {
LOGI("Audio playback underflow, missed %zu frames\n", (callback_bytes - size) / framesize);
LOGI("Audio playback underflow, missed %zu frames", (callback_bytes - size) / framesize);
SDL_memset(&output[size], device->silence_value, (callback_bytes - size));
}
}
@@ -315,10 +315,10 @@ static bool BuildAAudioStream(SDL_AudioDevice *device)
ctx.AAudioStreamBuilder_setDataCallback(builder, AAUDIO_dataCallback, device);
// Some devices have flat sounding audio when low latency mode is enabled, but this is a better experience for most people
if (SDL_GetHintBoolean(SDL_HINT_ANDROID_LOW_LATENCY_AUDIO, true)) {
SDL_Log("Low latency audio enabled\n");
SDL_Log("Low latency audio enabled");
ctx.AAudioStreamBuilder_setPerformanceMode(builder, AAUDIO_PERFORMANCE_MODE_LOW_LATENCY);
} else {
SDL_Log("Low latency audio disabled\n");
SDL_Log("Low latency audio disabled");
}
LOGI("AAudio Try to open %u hz %s %u channels samples %u",
+3 -3
View File
@@ -923,7 +923,7 @@ static int ALSA_pcm_cfg_hw_chans_n_scan(struct ALSA_pcm_cfg_ctx *ctx, unsigned i
return CHANS_N_NOT_CONFIGURED;
}
LOGDEBUG("target chans_n is %u\n", target_chans_n);
LOGDEBUG("target chans_n is %u", target_chans_n);
int status = ALSA_snd_pcm_hw_params_any(ctx->device->hidden->pcm, ctx->hwparams);
if (status < 0) {
@@ -1050,7 +1050,7 @@ static int ALSA_pcm_cfg_hw_chans_n_scan(struct ALSA_pcm_cfg_ctx *ctx, unsigned i
static bool ALSA_pcm_cfg_hw(struct ALSA_pcm_cfg_ctx *ctx)
{
LOGDEBUG("target chans_n, equal or above requested chans_n mode\n");
LOGDEBUG("target chans_n, equal or above requested chans_n mode");
int status = ALSA_pcm_cfg_hw_chans_n_scan(ctx, CHANS_N_SCAN_MODE__EQUAL_OR_ABOVE_REQUESTED_CHANS_N);
if (status < 0) { // something went too wrong
return false;
@@ -1059,7 +1059,7 @@ static bool ALSA_pcm_cfg_hw(struct ALSA_pcm_cfg_ctx *ctx)
}
// Here, status == CHANS_N_NOT_CONFIGURED
LOGDEBUG("target chans_n, below requested chans_n mode\n");
LOGDEBUG("target chans_n, below requested chans_n mode");
status = ALSA_pcm_cfg_hw_chans_n_scan(ctx, CHANS_N_SCAN_MODE__BELOW_REQUESTED_CHANS_N);
if (status < 0) { // something went too wrong
return false;
+3 -3
View File
@@ -31,7 +31,7 @@
#if DEBUG_COREAUDIO
#define CHECK_RESULT(msg) \
if (result != noErr) { \
SDL_Log("COREAUDIO: Got error %d from '%s'!\n", (int)result, msg); \
SDL_Log("COREAUDIO: Got error %d from '%s'!", (int)result, msg); \
return SDL_SetError("CoreAudio error (%s): %d", msg, (int)result); \
}
#else
@@ -224,7 +224,7 @@ static void RefreshPhysicalDevices(void)
name[len] = '\0';
#if DEBUG_COREAUDIO
SDL_Log("COREAUDIO: Found %s device #%d: '%s' (devid %d)\n", ((recording) ? "recording" : "playback"), (int)i, name, (int)dev);
SDL_Log("COREAUDIO: Found %s device #%d: '%s' (devid %d)", ((recording) ? "recording" : "playback"), (int)i, name, (int)dev);
#endif
SDLCoreAudioHandle *newhandle = (SDLCoreAudioHandle *) SDL_calloc(1, sizeof (*newhandle));
if (newhandle) {
@@ -834,7 +834,7 @@ static bool PrepareAudioQueue(SDL_AudioDevice *device)
}
#if DEBUG_COREAUDIO
SDL_Log("COREAUDIO: numAudioBuffers == %d\n", numAudioBuffers);
SDL_Log("COREAUDIO: numAudioBuffers == %d", numAudioBuffers);
#endif
for (int i = 0; i < numAudioBuffers; i++) {
+1 -1
View File
@@ -136,7 +136,7 @@ static bool DISKAUDIO_OpenDevice(SDL_AudioDevice *device)
}
SDL_LogCritical(SDL_LOG_CATEGORY_AUDIO, "You are using the SDL disk i/o audio driver!");
SDL_LogCritical(SDL_LOG_CATEGORY_AUDIO, " %s file [%s].\n", recording ? "Reading from" : "Writing to", fname);
SDL_LogCritical(SDL_LOG_CATEGORY_AUDIO, " %s file [%s].", recording ? "Reading from" : "Writing to", fname);
return true; // We're ready to rock and roll. :-)
}
+31 -1
View File
@@ -513,6 +513,25 @@ static bool get_int_param(const struct spa_pod *param, Uint32 key, int *val)
return false;
}
static SDL_AudioFormat SPAFormatToSDL(enum spa_audio_format spafmt)
{
switch (spafmt) {
#define CHECKFMT(spa,sdl) case SPA_AUDIO_FORMAT_##spa: return SDL_AUDIO_##sdl
CHECKFMT(U8, U8);
CHECKFMT(S8, S8);
CHECKFMT(S16_LE, S16LE);
CHECKFMT(S16_BE, S16BE);
CHECKFMT(S32_LE, S32LE);
CHECKFMT(S32_BE, S32BE);
CHECKFMT(F32_LE, F32LE);
CHECKFMT(F32_BE, F32BE);
#undef CHECKFMT
default: break;
}
return SDL_AUDIO_UNKNOWN;
}
// Interface node callbacks
static void node_event_info(void *object, const struct pw_node_info *info)
{
@@ -541,6 +560,15 @@ static void node_event_param(void *object, int seq, uint32_t id, uint32_t index,
struct node_object *node = object;
struct io_node *io = node->userdata;
if ((id == SPA_PARAM_Format) && (io->spec.format == SDL_AUDIO_UNKNOWN)) {
struct spa_audio_info_raw info;
SDL_zero(info);
if (spa_format_audio_raw_parse(param, &info) == 0) {
//SDL_Log("Sink Format: %d, Rate: %d Hz, Channels: %d", info.format, info.rate, info.channels);
io->spec.format = SPAFormatToSDL(info.format);
}
}
// Get the default frequency
if (io->spec.freq == 0) {
get_range_param(param, SPA_FORMAT_AUDIO_rate, &io->spec.freq, NULL, NULL);
@@ -672,7 +700,9 @@ static void registry_event_global_callback(void *object, uint32_t id, uint32_t p
// Begin setting the node properties
io->id = id;
io->recording = recording;
io->spec.format = SDL_AUDIO_F32; // Pipewire uses floats internally, other formats require conversion.
if (io->spec.format == SDL_AUDIO_UNKNOWN) {
io->spec.format = SDL_AUDIO_S16; // we'll go conservative here if for some reason the format isn't known.
}
io->name = io->buf;
io->path = io->buf + desc_buffer_len;
SDL_strlcpy(io->buf, node_desc, desc_buffer_len);
+2
View File
@@ -32,6 +32,7 @@
// Available camera drivers
static const CameraBootStrap *const bootstrap[] = {
#ifndef SDL_CAMERA_DISABLED
#ifdef SDL_CAMERA_DRIVER_V4L2
&V4L2_bootstrap,
#endif
@@ -55,6 +56,7 @@ static const CameraBootStrap *const bootstrap[] = {
#endif
#ifdef SDL_CAMERA_DRIVER_DUMMY
&DUMMYCAMERA_bootstrap,
#endif
#endif
NULL
};
+4 -4
View File
@@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,2,0,0
PRODUCTVERSION 3,2,0,0
FILEVERSION 3,2,2,0
PRODUCTVERSION 3,2,2,0
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x40004L
@@ -23,12 +23,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "SDL\0"
VALUE "FileVersion", "3, 2, 0, 0\0"
VALUE "FileVersion", "3, 2, 2, 0\0"
VALUE "InternalName", "SDL\0"
VALUE "LegalCopyright", "Copyright (C) 2025 Sam Lantinga\0"
VALUE "OriginalFilename", "SDL3.dll\0"
VALUE "ProductName", "Simple DirectMedia Layer\0"
VALUE "ProductVersion", "3, 2, 0, 0\0"
VALUE "ProductVersion", "3, 2, 2, 0\0"
END
END
BLOCK "VarFileInfo"
+1 -1
View File
@@ -497,7 +497,7 @@ bool SDL_Portal_detect(void)
goto done;
}
reply = dbus->connection_send_with_reply_and_block(dbus->session_conn, msg, DBUS_TIMEOUT_INFINITE, NULL);
reply = dbus->connection_send_with_reply_and_block(dbus->session_conn, msg, DBUS_TIMEOUT_USE_DEFAULT, NULL);
dbus->message_unref(msg);
if (!reply) {
goto done;
+24
View File
@@ -309,6 +309,30 @@ static size_t SDLCALL SDL_IOprintf_LOGSDLCALLS(SDL_IOStream *context, SDL_PRINTF
va_end(ap);
return result;
}
static bool SDLCALL SDL_RenderDebugTextFormat_LOGSDLCALLS(SDL_Renderer *renderer, float x, float y, SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
{
char buf[128], *str = buf;
int result;
va_list ap;
SDL_Log_REAL("SDL3CALL SDL_RenderDebugTextFormat");
va_start(ap, fmt);
result = jump_table.SDL_vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
if (result >= 0 && (size_t)result >= sizeof(buf)) {
str = NULL;
va_start(ap, fmt);
result = SDL_vasprintf_REAL(&str, fmt, ap);
va_end(ap);
}
bool retval = false;
if (result >= 0) {
retval = SDL_RenderDebugTextFormat_REAL(renderer, x, y, "%s", str);
}
if (str != buf) {
jump_table.SDL_free(str);
}
return retval;
}
static void SDLCALL SDL_Log_LOGSDLCALLS(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
{
va_list ap;
+1 -1
View File
@@ -847,7 +847,7 @@ void SDL_StopEventLoop(void)
SDL_EventQ.active = false;
if (report && SDL_atoi(report)) {
SDL_Log("SDL EVENT QUEUE: Maximum events in-flight: %d\n",
SDL_Log("SDL EVENT QUEUE: Maximum events in-flight: %d",
SDL_EventQ.max_events_seen);
}
+2 -2
View File
@@ -220,7 +220,7 @@ void SDL_ResetKeyboard(void)
int scancode;
#ifdef DEBUG_KEYBOARD
SDL_Log("Resetting keyboard\n");
SDL_Log("Resetting keyboard");
#endif
for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_SCANCODE_COUNT; ++scancode) {
if (keyboard->keystate[scancode]) {
@@ -517,7 +517,7 @@ static bool SDL_SendKeyboardKeyInternal(Uint64 timestamp, Uint32 flags, SDL_Keyb
const Uint8 source = flags & KEYBOARD_SOURCE_MASK;
#ifdef DEBUG_KEYBOARD
SDL_Log("The '%s' key has been %s\n", SDL_GetScancodeName(scancode), down ? "pressed" : "released");
SDL_Log("The '%s' key has been %s", SDL_GetScancodeName(scancode), down ? "pressed" : "released");
#endif
// Figure out what type of event this is
+22 -6
View File
@@ -72,20 +72,36 @@ void SDL_SetKeymapEntry(SDL_Keymap *keymap, SDL_Scancode scancode, SDL_Keymod mo
return;
}
if (keycode == SDL_GetKeymapKeycode(keymap, scancode, modstate)) {
modstate = NormalizeModifierStateForKeymap(modstate);
Uint32 key = ((Uint32)modstate << 16) | scancode;
const void *value;
if (SDL_FindInHashTable(keymap->scancode_to_keycode, (void *)(uintptr_t)key, &value)) {
SDL_Keycode existing_keycode = (SDL_Keycode)(uintptr_t)value;
if (existing_keycode == keycode) {
// We already have this mapping
return;
}
Uint32 key = ((Uint32)NormalizeModifierStateForKeymap(modstate) << 16) | scancode;
const void *value;
if (SDL_FindInHashTable(keymap->scancode_to_keycode, (void *)(uintptr_t)key, &value)) {
// Changing the mapping, need to remove the existing entry from the keymap
SDL_RemoveFromHashTable(keymap->scancode_to_keycode, (void *)(uintptr_t)key);
SDL_RemoveFromHashTable(keymap->keycode_to_scancode, value);
}
SDL_InsertIntoHashTable(keymap->scancode_to_keycode, (void *)(uintptr_t)key, (void *)(uintptr_t)keycode);
bool update_keycode = true;
if (SDL_FindInHashTable(keymap->keycode_to_scancode, (void *)(uintptr_t)keycode, &value)) {
Uint32 existing_value = (Uint32)(uintptr_t)value;
SDL_Keymod existing_modstate = (SDL_Keymod)(existing_value >> 16);
// Keep the simplest combination of scancode and modifiers to generate this keycode
if (existing_modstate <= modstate) {
update_keycode = false;
} else {
SDL_RemoveFromHashTable(keymap->keycode_to_scancode, (void *)(uintptr_t)keycode);
}
}
if (update_keycode) {
SDL_InsertIntoHashTable(keymap->keycode_to_scancode, (void *)(uintptr_t)keycode, (void *)(uintptr_t)key);
}
}
SDL_Keycode SDL_GetKeymapKeycode(SDL_Keymap *keymap, SDL_Scancode scancode, SDL_Keymod modstate)
+3 -3
View File
@@ -605,7 +605,7 @@ static bool SDL_UpdateMouseFocus(SDL_Window *window, float x, float y, Uint32 bu
if (!inWindow) {
if (window == mouse->focus) {
#ifdef DEBUG_MOUSE
SDL_Log("Mouse left window, synthesizing move & focus lost event\n");
SDL_Log("Mouse left window, synthesizing move & focus lost event");
#endif
if (send_mouse_motion) {
SDL_PrivateSendMouseMotion(0, window, SDL_GLOBAL_MOUSE_ID, false, x, y);
@@ -617,7 +617,7 @@ static bool SDL_UpdateMouseFocus(SDL_Window *window, float x, float y, Uint32 bu
if (window != mouse->focus) {
#ifdef DEBUG_MOUSE
SDL_Log("Mouse entered window, synthesizing focus gain & move event\n");
SDL_Log("Mouse entered window, synthesizing focus gain & move event");
#endif
SDL_SetMouseFocus(window);
if (send_mouse_motion) {
@@ -740,7 +740,7 @@ static void SDL_PrivateSendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL
if (mouse->has_position && xrel == 0.0f && yrel == 0.0f) { // Drop events that don't change state
#ifdef DEBUG_MOUSE
SDL_Log("Mouse event didn't change state - dropped!\n");
SDL_Log("Mouse event didn't change state - dropped!");
#endif
return;
}
+6 -1
View File
@@ -109,9 +109,14 @@ bool SDL_InitPen(void)
void SDL_QuitPen(void)
{
SDL_DestroyRWLock(pen_device_rwlock);
pen_device_rwlock = 0;
pen_device_rwlock = NULL;
if (pen_devices) {
for (int i = pen_device_count; i--; ) {
SDL_free(pen_devices[i].name);
}
SDL_free(pen_devices);
pen_devices = NULL;
}
pen_device_count = 0;
pen_touching = 0;
}
+3 -3
View File
@@ -363,16 +363,16 @@ char **SDL_InternalGlobDirectory(const char *path, const char *pattern, SDL_Glob
return NULL;
}
// if path ends with any '/', chop them off, so we don't confuse the pattern matcher later.
// if path ends with any slash, chop them off, so we don't confuse the pattern matcher later.
char *pathcpy = NULL;
size_t pathlen = SDL_strlen(path);
if ((pathlen > 1) && (path[pathlen-1] == '/')) {
if ((pathlen > 1) && ((path[pathlen-1] == '/') || (path[pathlen-1] == '\\'))) {
pathcpy = SDL_strdup(path);
if (!pathcpy) {
return NULL;
}
char *ptr = &pathcpy[pathlen-1];
while ((ptr >= pathcpy) && (*ptr == '/')) {
while ((ptr >= pathcpy) && ((*ptr == '/') || (*ptr == '\\'))) {
*(ptr--) = '\0';
}
path = pathcpy;
+1 -1
View File
@@ -92,7 +92,7 @@ char *SDL_SYS_GetPrefPath(const char *org, const char *app)
static bool shown = false;
if (!shown) {
shown = true;
SDL_LogCritical(SDL_LOG_CATEGORY_SYSTEM, "tvOS does not have persistent local storage! Use iCloud storage if you want your data to persist between sessions.\n");
SDL_LogCritical(SDL_LOG_CATEGORY_SYSTEM, "tvOS does not have persistent local storage! Use iCloud storage if you want your data to persist between sessions.");
}
}
+64 -35
View File
@@ -4552,15 +4552,18 @@ static void D3D12_BindVertexBuffers(
for (Uint32 i = 0; i < numBindings; i += 1) {
D3D12Buffer *currentBuffer = ((D3D12BufferContainer *)bindings[i].buffer)->activeBuffer;
if (d3d12CommandBuffer->vertexBuffers[firstSlot + i] != currentBuffer || d3d12CommandBuffer->vertexBufferOffsets[firstSlot + i] != bindings[i].offset) {
D3D12_INTERNAL_TrackBuffer(d3d12CommandBuffer, currentBuffer);
d3d12CommandBuffer->vertexBuffers[firstSlot + i] = currentBuffer;
d3d12CommandBuffer->vertexBufferOffsets[firstSlot + i] = bindings[i].offset;
D3D12_INTERNAL_TrackBuffer(d3d12CommandBuffer, currentBuffer);
d3d12CommandBuffer->needVertexBufferBind = true;
}
}
d3d12CommandBuffer->vertexBufferCount =
SDL_max(d3d12CommandBuffer->vertexBufferCount, firstSlot + numBindings);
d3d12CommandBuffer->needVertexBufferBind = true;
}
static void D3D12_BindIndexBuffer(
@@ -4596,19 +4599,24 @@ static void D3D12_BindVertexSamplers(
D3D12TextureContainer *container = (D3D12TextureContainer *)textureSamplerBindings[i].texture;
D3D12Sampler *sampler = (D3D12Sampler *)textureSamplerBindings[i].sampler;
D3D12_INTERNAL_TrackTexture(
d3d12CommandBuffer,
container->activeTexture);
if (d3d12CommandBuffer->vertexSamplers[firstSlot + i] != sampler) {
D3D12_INTERNAL_TrackSampler(
d3d12CommandBuffer,
sampler);
d3d12CommandBuffer->vertexSamplers[firstSlot + i] = sampler;
d3d12CommandBuffer->vertexSamplerTextures[firstSlot + i] = container->activeTexture;
d3d12CommandBuffer->needVertexSamplerBind = true;
}
if (d3d12CommandBuffer->vertexSamplerTextures[firstSlot + i] != container->activeTexture) {
D3D12_INTERNAL_TrackTexture(
d3d12CommandBuffer,
container->activeTexture);
d3d12CommandBuffer->vertexSamplerTextures[firstSlot + i] = container->activeTexture;
d3d12CommandBuffer->needVertexSamplerBind = true;
}
}
}
static void D3D12_BindVertexStorageTextures(
@@ -4623,12 +4631,13 @@ static void D3D12_BindVertexStorageTextures(
D3D12TextureContainer *container = (D3D12TextureContainer *)storageTextures[i];
D3D12Texture *texture = container->activeTexture;
if (d3d12CommandBuffer->vertexStorageTextures[firstSlot + i] != texture) {
D3D12_INTERNAL_TrackTexture(d3d12CommandBuffer, texture);
d3d12CommandBuffer->vertexStorageTextures[firstSlot + i] = texture;
}
d3d12CommandBuffer->needVertexStorageTextureBind = true;
}
}
}
static void D3D12_BindVertexStorageBuffers(
@@ -4641,15 +4650,15 @@ static void D3D12_BindVertexStorageBuffers(
for (Uint32 i = 0; i < numBindings; i += 1) {
D3D12BufferContainer *container = (D3D12BufferContainer *)storageBuffers[i];
if (d3d12CommandBuffer->vertexStorageBuffers[firstSlot + i] != container->activeBuffer) {
D3D12_INTERNAL_TrackBuffer(
d3d12CommandBuffer,
container->activeBuffer);
d3d12CommandBuffer->vertexStorageBuffers[firstSlot + i] = container->activeBuffer;
}
d3d12CommandBuffer->needVertexStorageBufferBind = true;
}
}
}
static void D3D12_BindFragmentSamplers(
@@ -4664,19 +4673,24 @@ static void D3D12_BindFragmentSamplers(
D3D12TextureContainer *container = (D3D12TextureContainer *)textureSamplerBindings[i].texture;
D3D12Sampler *sampler = (D3D12Sampler *)textureSamplerBindings[i].sampler;
D3D12_INTERNAL_TrackTexture(
d3d12CommandBuffer,
container->activeTexture);
if (d3d12CommandBuffer->fragmentSamplers[firstSlot + i] != sampler) {
D3D12_INTERNAL_TrackSampler(
d3d12CommandBuffer,
sampler);
d3d12CommandBuffer->fragmentSamplers[firstSlot + i] = sampler;
d3d12CommandBuffer->fragmentSamplerTextures[firstSlot + i] = container->activeTexture;
d3d12CommandBuffer->needFragmentSamplerBind = true;
}
if (d3d12CommandBuffer->fragmentSamplerTextures[firstSlot + i] != container->activeTexture) {
D3D12_INTERNAL_TrackTexture(
d3d12CommandBuffer,
container->activeTexture);
d3d12CommandBuffer->fragmentSamplerTextures[firstSlot + i] = container->activeTexture;
d3d12CommandBuffer->needFragmentSamplerBind = true;
}
}
}
static void D3D12_BindFragmentStorageTextures(
@@ -4691,12 +4705,13 @@ static void D3D12_BindFragmentStorageTextures(
D3D12TextureContainer *container = (D3D12TextureContainer *)storageTextures[i];
D3D12Texture *texture = container->activeTexture;
if (d3d12CommandBuffer->fragmentStorageTextures[firstSlot + i] != texture) {
D3D12_INTERNAL_TrackTexture(d3d12CommandBuffer, texture);
d3d12CommandBuffer->fragmentStorageTextures[firstSlot + i] = texture;
}
d3d12CommandBuffer->needFragmentStorageTextureBind = true;
}
}
}
static void D3D12_BindFragmentStorageBuffers(
@@ -4710,14 +4725,15 @@ static void D3D12_BindFragmentStorageBuffers(
for (Uint32 i = 0; i < numBindings; i += 1) {
D3D12BufferContainer *container = (D3D12BufferContainer *)storageBuffers[i];
if (d3d12CommandBuffer->fragmentStorageBuffers[firstSlot + i] != container->activeBuffer) {
D3D12_INTERNAL_TrackBuffer(
d3d12CommandBuffer,
container->activeBuffer);
d3d12CommandBuffer->fragmentStorageBuffers[firstSlot + i] = container->activeBuffer;
}
d3d12CommandBuffer->needFragmentStorageBufferBind = true;
}
}
}
static void D3D12_PushVertexUniformData(
@@ -5330,20 +5346,26 @@ static void D3D12_BindComputeSamplers(
for (Uint32 i = 0; i < numBindings; i += 1) {
D3D12TextureContainer *container = (D3D12TextureContainer *)textureSamplerBindings[i].texture;
D3D12Sampler *sampler = (D3D12Sampler *)textureSamplerBindings[i].sampler;
if (d3d12CommandBuffer->computeSamplers[firstSlot + i] != sampler) {
D3D12_INTERNAL_TrackSampler(
d3d12CommandBuffer,
(D3D12Sampler *)textureSamplerBindings[i].sampler);
d3d12CommandBuffer->computeSamplers[firstSlot + i] = (D3D12Sampler *)textureSamplerBindings[i].sampler;
d3d12CommandBuffer->needComputeSamplerBind = true;
}
if (d3d12CommandBuffer->computeSamplerTextures[firstSlot + i] != container->activeTexture) {
D3D12_INTERNAL_TrackTexture(
d3d12CommandBuffer,
container->activeTexture);
d3d12CommandBuffer->computeSamplerTextures[firstSlot + i] = container->activeTexture;
d3d12CommandBuffer->computeSamplers[firstSlot + i] = (D3D12Sampler *)textureSamplerBindings[i].sampler;
}
d3d12CommandBuffer->needComputeSamplerBind = true;
}
}
}
static void D3D12_BindComputeStorageTextures(
@@ -5355,6 +5377,10 @@ static void D3D12_BindComputeStorageTextures(
D3D12CommandBuffer *d3d12CommandBuffer = (D3D12CommandBuffer *)commandBuffer;
for (Uint32 i = 0; i < numBindings; i += 1) {
D3D12TextureContainer *container = (D3D12TextureContainer *)storageTextures[i];
if (d3d12CommandBuffer->computeReadOnlyStorageTextures[firstSlot + i] != container->activeTexture) {
/* If a different texture was in this slot, transition it back to its default usage */
if (d3d12CommandBuffer->computeReadOnlyStorageTextures[firstSlot + i] != NULL) {
D3D12_INTERNAL_TextureTransitionToDefaultUsage(
d3d12CommandBuffer,
@@ -5362,9 +5388,7 @@ static void D3D12_BindComputeStorageTextures(
d3d12CommandBuffer->computeReadOnlyStorageTextures[firstSlot + i]);
}
D3D12TextureContainer *container = (D3D12TextureContainer *)storageTextures[i];
d3d12CommandBuffer->computeReadOnlyStorageTextures[firstSlot + i] = container->activeTexture;
/* Then transition the new texture and prepare it for binding */
D3D12_INTERNAL_TextureTransitionFromDefaultUsage(
d3d12CommandBuffer,
D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE,
@@ -5373,9 +5397,11 @@ static void D3D12_BindComputeStorageTextures(
D3D12_INTERNAL_TrackTexture(
d3d12CommandBuffer,
container->activeTexture);
}
d3d12CommandBuffer->computeReadOnlyStorageTextures[firstSlot + i] = container->activeTexture;
d3d12CommandBuffer->needComputeReadOnlyStorageTextureBind = true;
}
}
}
static void D3D12_BindComputeStorageBuffers(
@@ -5387,6 +5413,11 @@ static void D3D12_BindComputeStorageBuffers(
D3D12CommandBuffer *d3d12CommandBuffer = (D3D12CommandBuffer *)commandBuffer;
for (Uint32 i = 0; i < numBindings; i += 1) {
D3D12BufferContainer *container = (D3D12BufferContainer *)storageBuffers[i];
D3D12Buffer *buffer = container->activeBuffer;
if (d3d12CommandBuffer->computeReadOnlyStorageBuffers[firstSlot + i] != buffer) {
/* If a different buffer was in this slot, transition it back to its default usage */
if (d3d12CommandBuffer->computeReadOnlyStorageBuffers[firstSlot + i] != NULL) {
D3D12_INTERNAL_BufferTransitionToDefaultUsage(
d3d12CommandBuffer,
@@ -5394,11 +5425,7 @@ static void D3D12_BindComputeStorageBuffers(
d3d12CommandBuffer->computeReadOnlyStorageBuffers[firstSlot + i]);
}
D3D12BufferContainer *container = (D3D12BufferContainer *)storageBuffers[i];
D3D12Buffer *buffer = container->activeBuffer;
d3d12CommandBuffer->computeReadOnlyStorageBuffers[firstSlot + i] = buffer;
/* Then transition the new buffer and prepare it for binding */
D3D12_INTERNAL_BufferTransitionFromDefaultUsage(
d3d12CommandBuffer,
D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE,
@@ -5407,9 +5434,11 @@ static void D3D12_BindComputeStorageBuffers(
D3D12_INTERNAL_TrackBuffer(
d3d12CommandBuffer,
buffer);
}
d3d12CommandBuffer->computeReadOnlyStorageBuffers[firstSlot + i] = buffer;
d3d12CommandBuffer->needComputeReadOnlyStorageBufferBind = true;
}
}
}
static void D3D12_PushComputeUniformData(
+188 -115
View File
@@ -567,30 +567,37 @@ typedef struct MetalCommandBuffer
MetalComputePipeline *compute_pipeline;
// Resource slot state
bool needVertexBufferBind;
bool needVertexSamplerBind;
bool needVertexStorageTextureBind;
bool needVertexStorageBufferBind;
bool needVertexUniformBind;
bool needVertexUniformBufferBind[MAX_UNIFORM_BUFFERS_PER_STAGE];
bool needFragmentSamplerBind;
bool needFragmentStorageTextureBind;
bool needFragmentStorageBufferBind;
bool needFragmentUniformBind;
bool needFragmentUniformBufferBind[MAX_UNIFORM_BUFFERS_PER_STAGE];
bool needComputeSamplerBind;
bool needComputeTextureBind;
bool needComputeBufferBind;
bool needComputeUniformBind;
bool needComputeReadOnlyStorageTextureBind;
bool needComputeReadOnlyStorageBufferBind;
bool needComputeUniformBufferBind[MAX_UNIFORM_BUFFERS_PER_STAGE];
id<MTLBuffer> vertexBuffers[MAX_VERTEX_BUFFERS];
Uint32 vertexBufferOffsets[MAX_VERTEX_BUFFERS];
Uint32 vertexBufferCount;
id<MTLSamplerState> vertexSamplers[MAX_TEXTURE_SAMPLERS_PER_STAGE];
id<MTLTexture> vertexTextures[MAX_TEXTURE_SAMPLERS_PER_STAGE];
id<MTLTexture> vertexStorageTextures[MAX_STORAGE_TEXTURES_PER_STAGE];
id<MTLBuffer> vertexStorageBuffers[MAX_STORAGE_BUFFERS_PER_STAGE];
MetalUniformBuffer *vertexUniformBuffers[MAX_UNIFORM_BUFFERS_PER_STAGE];
id<MTLSamplerState> fragmentSamplers[MAX_TEXTURE_SAMPLERS_PER_STAGE];
id<MTLTexture> fragmentTextures[MAX_TEXTURE_SAMPLERS_PER_STAGE];
id<MTLTexture> fragmentStorageTextures[MAX_STORAGE_TEXTURES_PER_STAGE];
id<MTLBuffer> fragmentStorageBuffers[MAX_STORAGE_BUFFERS_PER_STAGE];
MetalUniformBuffer *fragmentUniformBuffers[MAX_UNIFORM_BUFFERS_PER_STAGE];
id<MTLTexture> computeSamplerTextures[MAX_TEXTURE_SAMPLERS_PER_STAGE];
id<MTLSamplerState> computeSamplers[MAX_TEXTURE_SAMPLERS_PER_STAGE];
@@ -598,10 +605,6 @@ typedef struct MetalCommandBuffer
id<MTLBuffer> computeReadOnlyBuffers[MAX_STORAGE_BUFFERS_PER_STAGE];
id<MTLTexture> computeReadWriteTextures[MAX_COMPUTE_WRITE_TEXTURES];
id<MTLBuffer> computeReadWriteBuffers[MAX_COMPUTE_WRITE_BUFFERS];
// Uniform buffers
MetalUniformBuffer *vertexUniformBuffers[MAX_UNIFORM_BUFFERS_PER_STAGE];
MetalUniformBuffer *fragmentUniformBuffers[MAX_UNIFORM_BUFFERS_PER_STAGE];
MetalUniformBuffer *computeUniformBuffers[MAX_UNIFORM_BUFFERS_PER_STAGE];
MetalUniformBuffer **usedUniformBuffers;
@@ -2130,20 +2133,6 @@ static SDL_GPUCommandBuffer *METAL_AcquireCommandBuffer(
commandBuffer->computeUniformBuffers[i] = NULL;
}
// FIXME: Do we actually need to set this?
commandBuffer->needVertexSamplerBind = true;
commandBuffer->needVertexStorageTextureBind = true;
commandBuffer->needVertexStorageBufferBind = true;
commandBuffer->needVertexUniformBind = true;
commandBuffer->needFragmentSamplerBind = true;
commandBuffer->needFragmentStorageTextureBind = true;
commandBuffer->needFragmentStorageBufferBind = true;
commandBuffer->needFragmentUniformBind = true;
commandBuffer->needComputeSamplerBind = true;
commandBuffer->needComputeBufferBind = true;
commandBuffer->needComputeTextureBind = true;
commandBuffer->needComputeUniformBind = true;
commandBuffer->autoReleaseFence = true;
SDL_UnlockMutex(renderer->acquireCommandBufferLock);
@@ -2397,73 +2386,71 @@ static void METAL_BindGraphicsPipeline(
{
@autoreleasepool {
MetalCommandBuffer *metalCommandBuffer = (MetalCommandBuffer *)commandBuffer;
MetalGraphicsPipeline *metalGraphicsPipeline = (MetalGraphicsPipeline *)graphicsPipeline;
SDL_GPURasterizerState *rast = &metalGraphicsPipeline->rasterizerState;
MetalGraphicsPipeline *pipeline = (MetalGraphicsPipeline *)graphicsPipeline;
SDL_GPURasterizerState *rast = &pipeline->rasterizerState;
Uint32 i;
metalCommandBuffer->graphics_pipeline = metalGraphicsPipeline;
metalCommandBuffer->graphics_pipeline = pipeline;
[metalCommandBuffer->renderEncoder setRenderPipelineState:metalGraphicsPipeline->handle];
[metalCommandBuffer->renderEncoder setRenderPipelineState:pipeline->handle];
// Apply rasterizer state
[metalCommandBuffer->renderEncoder setTriangleFillMode:SDLToMetal_PolygonMode[metalGraphicsPipeline->rasterizerState.fill_mode]];
[metalCommandBuffer->renderEncoder setCullMode:SDLToMetal_CullMode[metalGraphicsPipeline->rasterizerState.cull_mode]];
[metalCommandBuffer->renderEncoder setFrontFacingWinding:SDLToMetal_FrontFace[metalGraphicsPipeline->rasterizerState.front_face]];
[metalCommandBuffer->renderEncoder setDepthClipMode:SDLToMetal_DepthClipMode(metalGraphicsPipeline->rasterizerState.enable_depth_clip)];
[metalCommandBuffer->renderEncoder setTriangleFillMode:SDLToMetal_PolygonMode[pipeline->rasterizerState.fill_mode]];
[metalCommandBuffer->renderEncoder setCullMode:SDLToMetal_CullMode[pipeline->rasterizerState.cull_mode]];
[metalCommandBuffer->renderEncoder setFrontFacingWinding:SDLToMetal_FrontFace[pipeline->rasterizerState.front_face]];
[metalCommandBuffer->renderEncoder setDepthClipMode:SDLToMetal_DepthClipMode(pipeline->rasterizerState.enable_depth_clip)];
[metalCommandBuffer->renderEncoder
setDepthBias:((rast->enable_depth_bias) ? rast->depth_bias_constant_factor : 0)
slopeScale:((rast->enable_depth_bias) ? rast->depth_bias_slope_factor : 0)
clamp:((rast->enable_depth_bias) ? rast->depth_bias_clamp : 0)];
// Apply depth-stencil state
if (metalGraphicsPipeline->depth_stencil_state != NULL) {
if (pipeline->depth_stencil_state != NULL) {
[metalCommandBuffer->renderEncoder
setDepthStencilState:metalGraphicsPipeline->depth_stencil_state];
setDepthStencilState:pipeline->depth_stencil_state];
}
for (Uint32 i = 0; i < metalGraphicsPipeline->vertexUniformBufferCount; i += 1) {
for (i = 0; i < MAX_UNIFORM_BUFFERS_PER_STAGE; i += 1) {
metalCommandBuffer->needVertexUniformBufferBind[i] = true;
metalCommandBuffer->needFragmentUniformBufferBind[i] = true;
}
for (i = 0; i < pipeline->vertexUniformBufferCount; i += 1) {
if (metalCommandBuffer->vertexUniformBuffers[i] == NULL) {
metalCommandBuffer->vertexUniformBuffers[i] = METAL_INTERNAL_AcquireUniformBufferFromPool(
metalCommandBuffer);
}
}
for (Uint32 i = 0; i < metalGraphicsPipeline->fragmentUniformBufferCount; i += 1) {
for (i = 0; i < pipeline->fragmentUniformBufferCount; i += 1) {
if (metalCommandBuffer->fragmentUniformBuffers[i] == NULL) {
metalCommandBuffer->fragmentUniformBuffers[i] = METAL_INTERNAL_AcquireUniformBufferFromPool(
metalCommandBuffer);
}
}
metalCommandBuffer->needVertexUniformBind = true;
metalCommandBuffer->needFragmentUniformBind = true;
}
}
static void METAL_BindVertexBuffers(
SDL_GPUCommandBuffer *commandBuffer,
Uint32 firstBinding,
Uint32 firstSlot,
const SDL_GPUBufferBinding *bindings,
Uint32 numBindings)
{
@autoreleasepool {
MetalCommandBuffer *metalCommandBuffer = (MetalCommandBuffer *)commandBuffer;
id<MTLBuffer> metalBuffers[MAX_VERTEX_BUFFERS];
NSUInteger bufferOffsets[MAX_VERTEX_BUFFERS];
NSRange range = NSMakeRange(METAL_FIRST_VERTEX_BUFFER_SLOT + firstBinding, numBindings);
if (range.length == 0) {
return;
}
for (Uint32 i = 0; i < numBindings; i += 1) {
MetalBuffer *currentBuffer = ((MetalBufferContainer *)bindings[i].buffer)->activeBuffer;
metalBuffers[firstBinding + i] = currentBuffer->handle;
bufferOffsets[firstBinding + i] = bindings[i].offset;
if (metalCommandBuffer->vertexBuffers[firstSlot + i] != currentBuffer->handle || metalCommandBuffer->vertexBufferOffsets[firstSlot + i] != bindings[i].offset) {
metalCommandBuffer->vertexBuffers[firstSlot + i] = currentBuffer->handle;
metalCommandBuffer->vertexBufferOffsets[firstSlot + i] = bindings[i].offset;
metalCommandBuffer->needVertexBufferBind = true;
METAL_INTERNAL_TrackBuffer(metalCommandBuffer, currentBuffer);
}
[metalCommandBuffer->renderEncoder setVertexBuffers:metalBuffers offsets:bufferOffsets withRange:range];
}
metalCommandBuffer->vertexBufferCount =
SDL_max(metalCommandBuffer->vertexBufferCount, firstSlot + numBindings);
}
static void METAL_BindIndexBuffer(
@@ -2487,22 +2474,28 @@ static void METAL_BindVertexSamplers(
{
MetalCommandBuffer *metalCommandBuffer = (MetalCommandBuffer *)commandBuffer;
MetalTextureContainer *textureContainer;
MetalSampler *sampler;
for (Uint32 i = 0; i < numBindings; i += 1) {
textureContainer = (MetalTextureContainer *)textureSamplerBindings[i].texture;
sampler = (MetalSampler *)textureSamplerBindings[i].sampler;
if (metalCommandBuffer->vertexSamplers[firstSlot + i] != sampler->handle) {
metalCommandBuffer->vertexSamplers[firstSlot + i] = sampler->handle;
metalCommandBuffer->needVertexSamplerBind = true;
}
if (metalCommandBuffer->vertexTextures[firstSlot + i] != textureContainer->activeTexture->handle) {
METAL_INTERNAL_TrackTexture(
metalCommandBuffer,
textureContainer->activeTexture);
metalCommandBuffer->vertexSamplers[firstSlot + i] =
((MetalSampler *)textureSamplerBindings[i].sampler)->handle;
metalCommandBuffer->vertexTextures[firstSlot + i] =
textureContainer->activeTexture->handle;
}
metalCommandBuffer->needVertexSamplerBind = true;
}
}
}
static void METAL_BindVertexStorageTextures(
@@ -2517,15 +2510,17 @@ static void METAL_BindVertexStorageTextures(
for (Uint32 i = 0; i < numBindings; i += 1) {
textureContainer = (MetalTextureContainer *)storageTextures[i];
if (metalCommandBuffer->vertexStorageTextures[firstSlot + i] != textureContainer->activeTexture->handle) {
METAL_INTERNAL_TrackTexture(
metalCommandBuffer,
textureContainer->activeTexture);
metalCommandBuffer->vertexStorageTextures[firstSlot + i] =
textureContainer->activeTexture->handle;
}
metalCommandBuffer->needVertexStorageTextureBind = true;
}
}
}
static void METAL_BindVertexStorageBuffers(
@@ -2540,15 +2535,17 @@ static void METAL_BindVertexStorageBuffers(
for (Uint32 i = 0; i < numBindings; i += 1) {
bufferContainer = (MetalBufferContainer *)storageBuffers[i];
if (metalCommandBuffer->vertexStorageBuffers[firstSlot + i] != bufferContainer->activeBuffer->handle) {
METAL_INTERNAL_TrackBuffer(
metalCommandBuffer,
bufferContainer->activeBuffer);
metalCommandBuffer->vertexStorageBuffers[firstSlot + i] =
bufferContainer->activeBuffer->handle;
}
metalCommandBuffer->needVertexStorageBufferBind = true;
}
}
}
static void METAL_BindFragmentSamplers(
@@ -2559,22 +2556,28 @@ static void METAL_BindFragmentSamplers(
{
MetalCommandBuffer *metalCommandBuffer = (MetalCommandBuffer *)commandBuffer;
MetalTextureContainer *textureContainer;
MetalSampler *sampler;
for (Uint32 i = 0; i < numBindings; i += 1) {
textureContainer = (MetalTextureContainer *)textureSamplerBindings[i].texture;
sampler = (MetalSampler *)textureSamplerBindings[i].sampler;
if (metalCommandBuffer->fragmentSamplers[firstSlot + i] != sampler->handle) {
metalCommandBuffer->fragmentSamplers[firstSlot + i] = sampler->handle;
metalCommandBuffer->needFragmentSamplerBind = true;
}
if (metalCommandBuffer->fragmentTextures[firstSlot + i] != textureContainer->activeTexture->handle) {
METAL_INTERNAL_TrackTexture(
metalCommandBuffer,
textureContainer->activeTexture);
metalCommandBuffer->fragmentSamplers[firstSlot + i] =
((MetalSampler *)textureSamplerBindings[i].sampler)->handle;
metalCommandBuffer->fragmentTextures[firstSlot + i] =
textureContainer->activeTexture->handle;
}
metalCommandBuffer->needFragmentSamplerBind = true;
}
}
}
static void METAL_BindFragmentStorageTextures(
@@ -2589,15 +2592,17 @@ static void METAL_BindFragmentStorageTextures(
for (Uint32 i = 0; i < numBindings; i += 1) {
textureContainer = (MetalTextureContainer *)storageTextures[i];
if (metalCommandBuffer->fragmentStorageTextures[firstSlot + i] != textureContainer->activeTexture->handle) {
METAL_INTERNAL_TrackTexture(
metalCommandBuffer,
textureContainer->activeTexture);
metalCommandBuffer->fragmentStorageTextures[firstSlot + i] =
textureContainer->activeTexture->handle;
}
metalCommandBuffer->needFragmentStorageTextureBind = true;
}
}
}
static void METAL_BindFragmentStorageBuffers(
@@ -2612,15 +2617,17 @@ static void METAL_BindFragmentStorageBuffers(
for (Uint32 i = 0; i < numBindings; i += 1) {
bufferContainer = (MetalBufferContainer *)storageBuffers[i];
if (metalCommandBuffer->fragmentStorageBuffers[firstSlot + i] != bufferContainer->activeBuffer->handle) {
METAL_INTERNAL_TrackBuffer(
metalCommandBuffer,
bufferContainer->activeBuffer);
metalCommandBuffer->fragmentStorageBuffers[firstSlot + i] =
bufferContainer->activeBuffer->handle;
}
metalCommandBuffer->needFragmentStorageBufferBind = true;
}
}
}
// This function assumes that it's called from within an autorelease pool
@@ -2630,85 +2637,115 @@ static void METAL_INTERNAL_BindGraphicsResources(
MetalGraphicsPipeline *graphicsPipeline = commandBuffer->graphics_pipeline;
NSUInteger offsets[MAX_STORAGE_BUFFERS_PER_STAGE] = { 0 };
// Vertex Buffers
if (commandBuffer->needVertexBufferBind) {
id<MTLBuffer> metalBuffers[MAX_VERTEX_BUFFERS];
NSUInteger bufferOffsets[MAX_VERTEX_BUFFERS];
NSRange range = NSMakeRange(METAL_FIRST_VERTEX_BUFFER_SLOT, commandBuffer->vertexBufferCount);
for (Uint32 i = 0; i < commandBuffer->vertexBufferCount; i += 1) {
metalBuffers[i] = commandBuffer->vertexBuffers[i];
bufferOffsets[i] = commandBuffer->vertexBufferOffsets[i];
}
[commandBuffer->renderEncoder setVertexBuffers:metalBuffers offsets:bufferOffsets withRange:range];
commandBuffer->needVertexBufferBind = false;
}
// Vertex Samplers+Textures
if (graphicsPipeline->vertexSamplerCount > 0 && commandBuffer->needVertexSamplerBind) {
if (commandBuffer->needVertexSamplerBind) {
if (graphicsPipeline->vertexSamplerCount > 0) {
[commandBuffer->renderEncoder setVertexSamplerStates:commandBuffer->vertexSamplers
withRange:NSMakeRange(0, graphicsPipeline->vertexSamplerCount)];
[commandBuffer->renderEncoder setVertexTextures:commandBuffer->vertexTextures
withRange:NSMakeRange(0, graphicsPipeline->vertexSamplerCount)];
}
commandBuffer->needVertexSamplerBind = false;
}
// Vertex Storage Textures
if (graphicsPipeline->vertexStorageTextureCount > 0 && commandBuffer->needVertexStorageTextureBind) {
if (commandBuffer->needVertexStorageTextureBind) {
if (graphicsPipeline->vertexStorageTextureCount > 0) {
[commandBuffer->renderEncoder setVertexTextures:commandBuffer->vertexStorageTextures
withRange:NSMakeRange(graphicsPipeline->vertexSamplerCount,
graphicsPipeline->vertexStorageTextureCount)];
}
commandBuffer->needVertexStorageTextureBind = false;
}
// Vertex Storage Buffers
if (graphicsPipeline->vertexStorageBufferCount > 0 && commandBuffer->needVertexStorageBufferBind) {
if (commandBuffer->needVertexStorageBufferBind) {
if (graphicsPipeline->vertexStorageBufferCount > 0) {
[commandBuffer->renderEncoder setVertexBuffers:commandBuffer->vertexStorageBuffers
offsets:offsets
withRange:NSMakeRange(graphicsPipeline->vertexUniformBufferCount,
graphicsPipeline->vertexStorageBufferCount)];
}
commandBuffer->needVertexStorageBufferBind = false;
}
// Vertex Uniform Buffers
if (graphicsPipeline->vertexUniformBufferCount > 0 && commandBuffer->needVertexUniformBind) {
for (Uint32 i = 0; i < graphicsPipeline->vertexUniformBufferCount; i += 1) {
if (commandBuffer->needVertexUniformBufferBind[i]) {
if (graphicsPipeline->vertexUniformBufferCount > i) {
[commandBuffer->renderEncoder
setVertexBuffer:commandBuffer->vertexUniformBuffers[i]->handle
offset:commandBuffer->vertexUniformBuffers[i]->drawOffset
atIndex:i];
}
commandBuffer->needVertexUniformBind = false;
commandBuffer->needVertexUniformBufferBind[i] = false;
}
}
// Fragment Samplers+Textures
if (graphicsPipeline->fragmentSamplerCount > 0 && commandBuffer->needFragmentSamplerBind) {
if (commandBuffer->needFragmentSamplerBind) {
if (graphicsPipeline->fragmentSamplerCount > 0) {
[commandBuffer->renderEncoder setFragmentSamplerStates:commandBuffer->fragmentSamplers
withRange:NSMakeRange(0, graphicsPipeline->fragmentSamplerCount)];
[commandBuffer->renderEncoder setFragmentTextures:commandBuffer->fragmentTextures
withRange:NSMakeRange(0, graphicsPipeline->fragmentSamplerCount)];
}
commandBuffer->needFragmentSamplerBind = false;
}
// Fragment Storage Textures
if (graphicsPipeline->fragmentStorageTextureCount > 0 && commandBuffer->needFragmentStorageTextureBind) {
if (commandBuffer->needFragmentStorageTextureBind) {
if (graphicsPipeline->fragmentStorageTextureCount > 0) {
[commandBuffer->renderEncoder setFragmentTextures:commandBuffer->fragmentStorageTextures
withRange:NSMakeRange(graphicsPipeline->fragmentSamplerCount,
graphicsPipeline->fragmentStorageTextureCount)];
}
commandBuffer->needFragmentStorageTextureBind = false;
}
// Fragment Storage Buffers
if (graphicsPipeline->fragmentStorageBufferCount > 0 && commandBuffer->needFragmentStorageBufferBind) {
if (commandBuffer->needFragmentStorageBufferBind) {
if (graphicsPipeline->fragmentStorageBufferCount > 0) {
[commandBuffer->renderEncoder setFragmentBuffers:commandBuffer->fragmentStorageBuffers
offsets:offsets
withRange:NSMakeRange(graphicsPipeline->fragmentUniformBufferCount,
graphicsPipeline->fragmentStorageBufferCount)];
}
commandBuffer->needFragmentStorageBufferBind = false;
}
// Fragment Uniform Buffers
if (graphicsPipeline->fragmentUniformBufferCount > 0 && commandBuffer->needFragmentUniformBind) {
for (Uint32 i = 0; i < graphicsPipeline->fragmentUniformBufferCount; i += 1) {
if (commandBuffer->needFragmentUniformBufferBind[i]) {
if (graphicsPipeline->fragmentUniformBufferCount > i) {
[commandBuffer->renderEncoder
setFragmentBuffer:commandBuffer->fragmentUniformBuffers[i]->handle
offset:commandBuffer->fragmentUniformBuffers[i]->drawOffset
atIndex:i];
}
commandBuffer->needFragmentUniformBind = false;
commandBuffer->needFragmentUniformBufferBind[i] = false;
}
}
}
@@ -2720,7 +2757,6 @@ static void METAL_INTERNAL_BindComputeResources(
NSUInteger offsets[MAX_STORAGE_BUFFERS_PER_STAGE] = { 0 };
if (commandBuffer->needComputeSamplerBind) {
// Bind sampler textures
if (computePipeline->numSamplers > 0) {
[commandBuffer->computeEncoder setTextures:commandBuffer->computeSamplerTextures
withRange:NSMakeRange(0, computePipeline->numSamplers)];
@@ -2730,54 +2766,36 @@ static void METAL_INTERNAL_BindComputeResources(
commandBuffer->needComputeSamplerBind = false;
}
if (commandBuffer->needComputeTextureBind) {
// Bind read-only textures
if (commandBuffer->needComputeReadOnlyStorageTextureBind) {
if (computePipeline->numReadonlyStorageTextures > 0) {
[commandBuffer->computeEncoder setTextures:commandBuffer->computeReadOnlyTextures
withRange:NSMakeRange(
computePipeline->numSamplers,
computePipeline->numReadonlyStorageTextures)];
}
// Bind write-only textures
if (computePipeline->numReadWriteStorageTextures > 0) {
[commandBuffer->computeEncoder setTextures:commandBuffer->computeReadWriteTextures
withRange:NSMakeRange(
computePipeline->numSamplers + computePipeline->numReadonlyStorageTextures,
computePipeline->numReadWriteStorageTextures)];
}
commandBuffer->needComputeTextureBind = false;
commandBuffer->needComputeReadOnlyStorageTextureBind = false;
}
if (commandBuffer->needComputeBufferBind) {
// Bind read-only buffers
if (commandBuffer->needComputeReadOnlyStorageBufferBind) {
if (computePipeline->numReadonlyStorageBuffers > 0) {
[commandBuffer->computeEncoder setBuffers:commandBuffer->computeReadOnlyBuffers
offsets:offsets
withRange:NSMakeRange(computePipeline->numUniformBuffers,
computePipeline->numReadonlyStorageBuffers)];
}
// Bind write-only buffers
if (computePipeline->numReadWriteStorageBuffers > 0) {
[commandBuffer->computeEncoder setBuffers:commandBuffer->computeReadWriteBuffers
offsets:offsets
withRange:NSMakeRange(
computePipeline->numUniformBuffers +
computePipeline->numReadonlyStorageBuffers,
computePipeline->numReadWriteStorageBuffers)];
}
commandBuffer->needComputeBufferBind = false;
commandBuffer->needComputeReadOnlyStorageBufferBind = false;
}
if (commandBuffer->needComputeUniformBind) {
for (Uint32 i = 0; i < computePipeline->numUniformBuffers; i += 1) {
for (Uint32 i = 0; i < MAX_UNIFORM_BUFFERS_PER_STAGE; i += 1) {
if (commandBuffer->needComputeUniformBufferBind[i]) {
if (computePipeline->numUniformBuffers > i) {
[commandBuffer->computeEncoder
setBuffer:commandBuffer->computeUniformBuffers[i]->handle
offset:commandBuffer->computeUniformBuffers[i]->drawOffset
atIndex:i];
}
commandBuffer->needComputeUniformBind = false;
}
commandBuffer->needComputeUniformBufferBind[i] = false;
}
}
@@ -2892,6 +2910,11 @@ static void METAL_EndRenderPass(
[metalCommandBuffer->renderEncoder endEncoding];
metalCommandBuffer->renderEncoder = nil;
for (Uint32 i = 0; i < MAX_VERTEX_BUFFERS; i += 1) {
metalCommandBuffer->vertexBuffers[i] = nil;
metalCommandBuffer->vertexBufferOffsets[i] = 0;
metalCommandBuffer->vertexBufferCount = 0;
}
for (Uint32 i = 0; i < MAX_TEXTURE_SAMPLERS_PER_STAGE; i += 1) {
metalCommandBuffer->vertexSamplers[i] = nil;
metalCommandBuffer->vertexTextures[i] = nil;
@@ -2976,11 +2999,11 @@ static void METAL_INTERNAL_PushUniformData(
metalUniformBuffer->writeOffset += alignedDataLength;
if (shaderStage == SDL_GPU_SHADERSTAGE_VERTEX) {
metalCommandBuffer->needVertexUniformBind = true;
metalCommandBuffer->needVertexUniformBufferBind[slotIndex] = true;
} else if (shaderStage == SDL_GPU_SHADERSTAGE_FRAGMENT) {
metalCommandBuffer->needFragmentUniformBind = true;
metalCommandBuffer->needFragmentUniformBufferBind[slotIndex] = true;
} else if (shaderStage == SDL_GPU_SHADERSTAGE_COMPUTE) {
metalCommandBuffer->needComputeUniformBind = true;
metalCommandBuffer->needComputeUniformBufferBind[slotIndex] = true;
} else {
SDL_LogError(SDL_LOG_CATEGORY_GPU, "Unrecognized shader stage!");
}
@@ -3078,7 +3101,6 @@ static void METAL_BeginComputePass(
slices:NSMakeRange(storageTextureBindings[i].layer, 1)];
metalCommandBuffer->computeReadWriteTextures[i] = textureView;
metalCommandBuffer->needComputeTextureBind = true;
}
for (Uint32 i = 0; i < numStorageBufferBindings; i += 1) {
@@ -3094,7 +3116,6 @@ static void METAL_BeginComputePass(
buffer);
metalCommandBuffer->computeReadWriteBuffers[i] = buffer->handle;
metalCommandBuffer->needComputeBufferBind = true;
}
}
}
@@ -3111,6 +3132,10 @@ static void METAL_BindComputePipeline(
[metalCommandBuffer->computeEncoder setComputePipelineState:pipeline->handle];
for (Uint32 i = 0; i < MAX_UNIFORM_BUFFERS_PER_STAGE; i += 1) {
metalCommandBuffer->needComputeUniformBufferBind[i] = true;
}
for (Uint32 i = 0; i < pipeline->numUniformBuffers; i += 1) {
if (metalCommandBuffer->computeUniformBuffers[i] == NULL) {
metalCommandBuffer->computeUniformBuffers[i] = METAL_INTERNAL_AcquireUniformBufferFromPool(
@@ -3118,7 +3143,24 @@ static void METAL_BindComputePipeline(
}
}
metalCommandBuffer->needComputeUniformBind = true;
// Bind write-only resources
if (pipeline->numReadWriteStorageTextures > 0) {
[metalCommandBuffer->computeEncoder setTextures:metalCommandBuffer->computeReadWriteTextures
withRange:NSMakeRange(
pipeline->numSamplers +
pipeline->numReadonlyStorageTextures,
pipeline->numReadWriteStorageTextures)];
}
NSUInteger offsets[MAX_COMPUTE_WRITE_BUFFERS] = { 0 };
if (pipeline->numReadWriteStorageBuffers > 0) {
[metalCommandBuffer->computeEncoder setBuffers:metalCommandBuffer->computeReadWriteBuffers
offsets:offsets
withRange:NSMakeRange(
pipeline->numUniformBuffers +
pipeline->numReadonlyStorageBuffers,
pipeline->numReadWriteStorageBuffers)];
}
}
}
@@ -3130,22 +3172,28 @@ static void METAL_BindComputeSamplers(
{
MetalCommandBuffer *metalCommandBuffer = (MetalCommandBuffer *)commandBuffer;
MetalTextureContainer *textureContainer;
MetalSampler *sampler;
for (Uint32 i = 0; i < numBindings; i += 1) {
textureContainer = (MetalTextureContainer *)textureSamplerBindings[i].texture;
sampler = (MetalSampler *)textureSamplerBindings[i].sampler;
if (metalCommandBuffer->computeSamplers[firstSlot + i] != sampler->handle) {
metalCommandBuffer->computeSamplers[firstSlot + i] = sampler->handle;
metalCommandBuffer->needComputeSamplerBind = true;
}
if (metalCommandBuffer->computeSamplerTextures[firstSlot + i] != textureContainer->activeTexture->handle) {
METAL_INTERNAL_TrackTexture(
metalCommandBuffer,
textureContainer->activeTexture);
metalCommandBuffer->computeSamplers[firstSlot + i] =
((MetalSampler *)textureSamplerBindings[i].sampler)->handle;
metalCommandBuffer->computeSamplerTextures[firstSlot + i] =
textureContainer->activeTexture->handle;
}
metalCommandBuffer->needComputeSamplerBind = true;
}
}
}
static void METAL_BindComputeStorageTextures(
@@ -3160,15 +3208,17 @@ static void METAL_BindComputeStorageTextures(
for (Uint32 i = 0; i < numBindings; i += 1) {
textureContainer = (MetalTextureContainer *)storageTextures[i];
if (metalCommandBuffer->computeReadOnlyTextures[firstSlot + i] != textureContainer->activeTexture->handle) {
METAL_INTERNAL_TrackTexture(
metalCommandBuffer,
textureContainer->activeTexture);
metalCommandBuffer->computeReadOnlyTextures[firstSlot + i] =
textureContainer->activeTexture->handle;
}
metalCommandBuffer->needComputeTextureBind = true;
metalCommandBuffer->needComputeReadOnlyStorageTextureBind = true;
}
}
}
static void METAL_BindComputeStorageBuffers(
@@ -3183,15 +3233,17 @@ static void METAL_BindComputeStorageBuffers(
for (Uint32 i = 0; i < numBindings; i += 1) {
bufferContainer = (MetalBufferContainer *)storageBuffers[i];
if (metalCommandBuffer->computeReadOnlyBuffers[firstSlot + i] != bufferContainer->activeBuffer->handle) {
METAL_INTERNAL_TrackBuffer(
metalCommandBuffer,
bufferContainer->activeBuffer);
metalCommandBuffer->computeReadOnlyBuffers[firstSlot + i] =
bufferContainer->activeBuffer->handle;
}
metalCommandBuffer->needComputeBufferBind = true;
metalCommandBuffer->needComputeReadOnlyStorageBufferBind = true;
}
}
}
static void METAL_PushComputeUniformData(
@@ -3368,6 +3420,11 @@ static void METAL_INTERNAL_CleanCommandBuffer(
commandBuffer->windowDataCount = 0;
// Reset bindings
for (i = 0; i < MAX_VERTEX_BUFFERS; i += 1) {
commandBuffer->vertexBuffers[i] = nil;
commandBuffer->vertexBufferOffsets[i] = 0;
}
commandBuffer->vertexBufferCount = 0;
commandBuffer->indexBuffer = NULL;
for (i = 0; i < MAX_TEXTURE_SAMPLERS_PER_STAGE; i += 1) {
commandBuffer->vertexSamplers[i] = nil;
@@ -3394,6 +3451,22 @@ static void METAL_INTERNAL_CleanCommandBuffer(
commandBuffer->computeReadWriteBuffers[i] = nil;
}
commandBuffer->needVertexBufferBind = false;
commandBuffer->needVertexSamplerBind = false;
commandBuffer->needVertexStorageBufferBind = false;
commandBuffer->needVertexStorageTextureBind = false;
SDL_zeroa(commandBuffer->needVertexUniformBufferBind);
commandBuffer->needFragmentSamplerBind = false;
commandBuffer->needFragmentStorageBufferBind = false;
commandBuffer->needFragmentStorageTextureBind = false;
SDL_zeroa(commandBuffer->needFragmentUniformBufferBind);
commandBuffer->needComputeSamplerBind = false;
commandBuffer->needComputeReadOnlyStorageBufferBind = false;
commandBuffer->needComputeReadOnlyStorageTextureBind = false;
SDL_zeroa(commandBuffer->needComputeUniformBufferBind);
// The fence is now available (unless SubmitAndAcquireFence was called)
if (commandBuffer->autoReleaseFence) {
METAL_ReleaseFence(
+116 -73
View File
@@ -755,12 +755,12 @@ typedef struct VulkanPresentData
Uint32 swapchainImageIndex;
} VulkanPresentData;
typedef struct VulkanUniformBuffer
struct VulkanUniformBuffer
{
VulkanBuffer *buffer;
Uint32 drawOffset;
Uint32 writeOffset;
} VulkanUniformBuffer;
};
typedef struct VulkanDescriptorInfo
{
@@ -1035,6 +1035,11 @@ typedef struct VulkanCommandBuffer
VkDescriptorSet computeReadWriteDescriptorSet;
VkDescriptorSet computeUniformDescriptorSet;
VkBuffer vertexBuffers[MAX_VERTEX_BUFFERS];
VkDeviceSize vertexBufferOffsets[MAX_VERTEX_BUFFERS];
Uint32 vertexBufferCount;
bool needVertexBufferBind;
VulkanTexture *vertexSamplerTextures[MAX_TEXTURE_SAMPLERS_PER_STAGE];
VulkanSampler *vertexSamplers[MAX_TEXTURE_SAMPLERS_PER_STAGE];
VulkanTexture *vertexStorageTextures[MAX_STORAGE_TEXTURES_PER_STAGE];
@@ -3636,7 +3641,7 @@ static bool VULKAN_INTERNAL_AllocateDescriptorsFromPool(
}
for (Uint32 i = descriptorSetLayout->samplerCount; i < descriptorSetLayout->samplerCount + descriptorSetLayout->storageTextureCount; i += 1) {
descriptorPoolSizes[i].type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
descriptorPoolSizes[i].type = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; // Yes, we are declaring the storage image as a sampled image, because shaders are stupid.
descriptorPoolSizes[i].descriptorCount = DESCRIPTOR_POOL_SIZE;
}
@@ -3766,7 +3771,7 @@ static DescriptorSetLayout *VULKAN_INTERNAL_FetchDescriptorSetLayout(
for (Uint32 i = samplerCount; i < samplerCount + storageTextureCount; i += 1) {
descriptorSetLayoutBindings[i].binding = i;
descriptorSetLayoutBindings[i].descriptorCount = 1;
descriptorSetLayoutBindings[i].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
descriptorSetLayoutBindings[i].descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; // Yes, we are declaring the storage image as a sampled image, because shaders are stupid.
descriptorSetLayoutBindings[i].stageFlags = shaderStage;
descriptorSetLayoutBindings[i].pImmutableSamplers = NULL;
}
@@ -5027,6 +5032,7 @@ static void VULKAN_INTERNAL_BindGraphicsDescriptorSets(
Uint32 dynamicOffsetCount = 0;
if (
!commandBuffer->needVertexBufferBind &&
!commandBuffer->needNewVertexResourceDescriptorSet &&
!commandBuffer->needNewVertexUniformDescriptorSet &&
!commandBuffer->needNewVertexUniformOffsets &&
@@ -5037,6 +5043,17 @@ static void VULKAN_INTERNAL_BindGraphicsDescriptorSets(
return;
}
if (commandBuffer->needVertexBufferBind && commandBuffer->vertexBufferCount > 0) {
renderer->vkCmdBindVertexBuffers(
commandBuffer->commandBuffer,
0,
commandBuffer->vertexBufferCount,
commandBuffer->vertexBuffers,
commandBuffer->vertexBufferOffsets);
commandBuffer->needVertexBufferBind = false;
}
resourceLayout = commandBuffer->currentGraphicsPipeline->resourceLayout;
if (commandBuffer->needNewVertexResourceDescriptorSet) {
@@ -5076,7 +5093,7 @@ static void VULKAN_INTERNAL_BindGraphicsDescriptorSets(
currentWriteDescriptorSet->sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
currentWriteDescriptorSet->pNext = NULL;
currentWriteDescriptorSet->descriptorCount = 1;
currentWriteDescriptorSet->descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
currentWriteDescriptorSet->descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; // Yes, we are declaring a storage image as a sampled image, because shaders are stupid.
currentWriteDescriptorSet->dstArrayElement = 0;
currentWriteDescriptorSet->dstBinding = resourceLayout->vertexSamplerCount + i;
currentWriteDescriptorSet->dstSet = commandBuffer->vertexResourceDescriptorSet;
@@ -5195,7 +5212,7 @@ static void VULKAN_INTERNAL_BindGraphicsDescriptorSets(
currentWriteDescriptorSet->sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
currentWriteDescriptorSet->pNext = NULL;
currentWriteDescriptorSet->descriptorCount = 1;
currentWriteDescriptorSet->descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
currentWriteDescriptorSet->descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; // Yes, we are declaring a storage image as a sampled image, because shaders are stupid.
currentWriteDescriptorSet->dstArrayElement = 0;
currentWriteDescriptorSet->dstBinding = resourceLayout->fragmentSamplerCount + i;
currentWriteDescriptorSet->dstSet = commandBuffer->fragmentResourceDescriptorSet;
@@ -5602,7 +5619,9 @@ static VulkanTexture *VULKAN_INTERNAL_CreateTexture(
imageCreateFlags |= VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT;
}
if (createinfo->usage & SDL_GPU_TEXTUREUSAGE_SAMPLER) {
if (createinfo->usage & (SDL_GPU_TEXTUREUSAGE_SAMPLER |
SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ |
SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ)) {
vkUsageFlags |= VK_IMAGE_USAGE_SAMPLED_BIT;
}
if (createinfo->usage & SDL_GPU_TEXTUREUSAGE_COLOR_TARGET) {
@@ -5611,9 +5630,7 @@ static VulkanTexture *VULKAN_INTERNAL_CreateTexture(
if (createinfo->usage & SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET) {
vkUsageFlags |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
}
if (createinfo->usage & (SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ |
SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ |
SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE |
if (createinfo->usage & (SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE |
SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE)) {
vkUsageFlags |= VK_IMAGE_USAGE_STORAGE_BIT;
}
@@ -7404,19 +7421,26 @@ static void VULKAN_BindVertexSamplers(
for (Uint32 i = 0; i < numBindings; i += 1) {
VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)textureSamplerBindings[i].texture;
vulkanCommandBuffer->vertexSamplerTextures[firstSlot + i] = textureContainer->activeTexture;
vulkanCommandBuffer->vertexSamplers[firstSlot + i] = (VulkanSampler *)textureSamplerBindings[i].sampler;
VulkanSampler *sampler = (VulkanSampler *)textureSamplerBindings[i].sampler;
if (vulkanCommandBuffer->vertexSamplers[firstSlot + i] != sampler) {
VULKAN_INTERNAL_TrackSampler(
vulkanCommandBuffer,
(VulkanSampler *)textureSamplerBindings[i].sampler);
vulkanCommandBuffer->vertexSamplers[firstSlot + i] = (VulkanSampler *)textureSamplerBindings[i].sampler;
vulkanCommandBuffer->needNewVertexResourceDescriptorSet = true;
}
if (vulkanCommandBuffer->vertexSamplerTextures[firstSlot + i] != textureContainer->activeTexture) {
VULKAN_INTERNAL_TrackTexture(
vulkanCommandBuffer,
textureContainer->activeTexture);
}
vulkanCommandBuffer->vertexSamplerTextures[firstSlot + i] = textureContainer->activeTexture;
vulkanCommandBuffer->needNewVertexResourceDescriptorSet = true;
}
}
}
static void VULKAN_BindVertexStorageTextures(
@@ -7430,14 +7454,15 @@ static void VULKAN_BindVertexStorageTextures(
for (Uint32 i = 0; i < numBindings; i += 1) {
VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)storageTextures[i];
vulkanCommandBuffer->vertexStorageTextures[firstSlot + i] = textureContainer->activeTexture;
if (vulkanCommandBuffer->vertexStorageTextures[firstSlot + i] != textureContainer->activeTexture) {
VULKAN_INTERNAL_TrackTexture(
vulkanCommandBuffer,
textureContainer->activeTexture);
}
vulkanCommandBuffer->vertexStorageTextures[firstSlot + i] = textureContainer->activeTexture;
vulkanCommandBuffer->needNewVertexResourceDescriptorSet = true;
}
}
}
static void VULKAN_BindVertexStorageBuffers(
@@ -7447,20 +7472,19 @@ static void VULKAN_BindVertexStorageBuffers(
Uint32 numBindings)
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
VulkanBufferContainer *bufferContainer;
Uint32 i;
for (i = 0; i < numBindings; i += 1) {
bufferContainer = (VulkanBufferContainer *)storageBuffers[i];
vulkanCommandBuffer->vertexStorageBuffers[firstSlot + i] = bufferContainer->activeBuffer;
for (Uint32 i = 0; i < numBindings; i += 1) {
VulkanBufferContainer *bufferContainer = (VulkanBufferContainer *)storageBuffers[i];
if (vulkanCommandBuffer->vertexStorageBuffers[firstSlot + i] != bufferContainer->activeBuffer) {
VULKAN_INTERNAL_TrackBuffer(
vulkanCommandBuffer,
bufferContainer->activeBuffer);
}
vulkanCommandBuffer->vertexStorageBuffers[firstSlot + i] = bufferContainer->activeBuffer;
vulkanCommandBuffer->needNewVertexResourceDescriptorSet = true;
}
}
}
static void VULKAN_BindFragmentSamplers(
@@ -7473,19 +7497,26 @@ static void VULKAN_BindFragmentSamplers(
for (Uint32 i = 0; i < numBindings; i += 1) {
VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)textureSamplerBindings[i].texture;
vulkanCommandBuffer->fragmentSamplerTextures[firstSlot + i] = textureContainer->activeTexture;
vulkanCommandBuffer->fragmentSamplers[firstSlot + i] = (VulkanSampler *)textureSamplerBindings[i].sampler;
VulkanSampler *sampler = (VulkanSampler *)textureSamplerBindings[i].sampler;
if (vulkanCommandBuffer->fragmentSamplers[firstSlot + i] != sampler) {
VULKAN_INTERNAL_TrackSampler(
vulkanCommandBuffer,
(VulkanSampler *)textureSamplerBindings[i].sampler);
vulkanCommandBuffer->fragmentSamplers[firstSlot + i] = (VulkanSampler *)textureSamplerBindings[i].sampler;
vulkanCommandBuffer->needNewFragmentResourceDescriptorSet = true;
}
if (vulkanCommandBuffer->fragmentSamplerTextures[firstSlot + i] != textureContainer->activeTexture) {
VULKAN_INTERNAL_TrackTexture(
vulkanCommandBuffer,
textureContainer->activeTexture);
}
vulkanCommandBuffer->fragmentSamplerTextures[firstSlot + i] = textureContainer->activeTexture;
vulkanCommandBuffer->needNewFragmentResourceDescriptorSet = true;
}
}
}
static void VULKAN_BindFragmentStorageTextures(
@@ -7499,15 +7530,15 @@ static void VULKAN_BindFragmentStorageTextures(
for (Uint32 i = 0; i < numBindings; i += 1) {
VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)storageTextures[i];
vulkanCommandBuffer->fragmentStorageTextures[firstSlot + i] =
textureContainer->activeTexture;
if (vulkanCommandBuffer->fragmentStorageTextures[firstSlot + i] != textureContainer->activeTexture) {
VULKAN_INTERNAL_TrackTexture(
vulkanCommandBuffer,
textureContainer->activeTexture);
}
vulkanCommandBuffer->fragmentStorageTextures[firstSlot + i] = textureContainer->activeTexture;
vulkanCommandBuffer->needNewFragmentResourceDescriptorSet = true;
}
}
}
static void VULKAN_BindFragmentStorageBuffers(
@@ -7523,14 +7554,15 @@ static void VULKAN_BindFragmentStorageBuffers(
for (i = 0; i < numBindings; i += 1) {
bufferContainer = (VulkanBufferContainer *)storageBuffers[i];
vulkanCommandBuffer->fragmentStorageBuffers[firstSlot + i] = bufferContainer->activeBuffer;
if (vulkanCommandBuffer->fragmentStorageBuffers[firstSlot + i] != bufferContainer->activeBuffer) {
VULKAN_INTERNAL_TrackBuffer(
vulkanCommandBuffer,
bufferContainer->activeBuffer);
}
vulkanCommandBuffer->fragmentStorageBuffers[firstSlot + i] = bufferContainer->activeBuffer;
vulkanCommandBuffer->needNewFragmentResourceDescriptorSet = true;
}
}
}
static VulkanUniformBuffer *VULKAN_INTERNAL_AcquireUniformBufferFromPool(
@@ -7922,28 +7954,20 @@ static void VULKAN_BindVertexBuffers(
Uint32 numBindings)
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
VulkanBuffer *currentVulkanBuffer;
VkBuffer *buffers = SDL_stack_alloc(VkBuffer, numBindings);
VkDeviceSize *offsets = SDL_stack_alloc(VkDeviceSize, numBindings);
Uint32 i;
for (i = 0; i < numBindings; i += 1) {
currentVulkanBuffer = ((VulkanBufferContainer *)bindings[i].buffer)->activeBuffer;
buffers[i] = currentVulkanBuffer->buffer;
offsets[i] = (VkDeviceSize)bindings[i].offset;
VULKAN_INTERNAL_TrackBuffer(vulkanCommandBuffer, currentVulkanBuffer);
for (Uint32 i = 0; i < numBindings; i += 1) {
VulkanBuffer *buffer = ((VulkanBufferContainer *)bindings[i].buffer)->activeBuffer;
if (vulkanCommandBuffer->vertexBuffers[i] != buffer->buffer || vulkanCommandBuffer->vertexBufferOffsets[i] != bindings[i].offset) {
VULKAN_INTERNAL_TrackBuffer(vulkanCommandBuffer, buffer);
vulkanCommandBuffer->vertexBuffers[i] = buffer->buffer;
vulkanCommandBuffer->vertexBufferOffsets[i] = bindings[i].offset;
vulkanCommandBuffer->needVertexBufferBind = true;
}
}
renderer->vkCmdBindVertexBuffers(
vulkanCommandBuffer->commandBuffer,
firstSlot,
numBindings,
buffers,
offsets);
SDL_stack_free(buffers);
SDL_stack_free(offsets);
vulkanCommandBuffer->vertexBufferCount =
SDL_max(vulkanCommandBuffer->vertexBufferCount, firstSlot + numBindings);
}
static void VULKAN_BindIndexBuffer(
@@ -8045,6 +8069,10 @@ static void VULKAN_EndRenderPass(
SDL_zeroa(vulkanCommandBuffer->resolveAttachmentSubresources);
vulkanCommandBuffer->depthStencilAttachmentSubresource = NULL;
SDL_zeroa(vulkanCommandBuffer->vertexBuffers);
SDL_zeroa(vulkanCommandBuffer->vertexBufferOffsets);
vulkanCommandBuffer->vertexBufferCount = 0;
SDL_zeroa(vulkanCommandBuffer->vertexSamplers);
SDL_zeroa(vulkanCommandBuffer->vertexSamplerTextures);
SDL_zeroa(vulkanCommandBuffer->vertexStorageTextures);
@@ -8148,19 +8176,26 @@ static void VULKAN_BindComputeSamplers(
for (Uint32 i = 0; i < numBindings; i += 1) {
VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)textureSamplerBindings[i].texture;
vulkanCommandBuffer->computeSamplerTextures[firstSlot + i] = textureContainer->activeTexture;
vulkanCommandBuffer->computeSamplers[firstSlot + i] = (VulkanSampler *)textureSamplerBindings[i].sampler;
VulkanSampler *sampler = (VulkanSampler *)textureSamplerBindings[i].sampler;
if (vulkanCommandBuffer->computeSamplers[firstSlot + i] != sampler) {
VULKAN_INTERNAL_TrackSampler(
vulkanCommandBuffer,
(VulkanSampler *)textureSamplerBindings[i].sampler);
sampler);
vulkanCommandBuffer->computeSamplers[firstSlot + i] = sampler;
vulkanCommandBuffer->needNewComputeReadOnlyDescriptorSet = true;
}
if (vulkanCommandBuffer->computeSamplerTextures[firstSlot + i] != textureContainer->activeTexture) {
VULKAN_INTERNAL_TrackTexture(
vulkanCommandBuffer,
textureContainer->activeTexture);
}
vulkanCommandBuffer->computeSamplerTextures[firstSlot + i] = textureContainer->activeTexture;
vulkanCommandBuffer->needNewComputeReadOnlyDescriptorSet = true;
}
}
}
static void VULKAN_BindComputeStorageTextures(
@@ -8173,6 +8208,10 @@ static void VULKAN_BindComputeStorageTextures(
VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
for (Uint32 i = 0; i < numBindings; i += 1) {
VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)storageTextures[i];
if (vulkanCommandBuffer->readOnlyComputeStorageTextures[firstSlot + i] != textureContainer->activeTexture) {
/* If a different texture as in this slot, transition it back to its default usage */
if (vulkanCommandBuffer->readOnlyComputeStorageTextures[firstSlot + i] != NULL) {
VULKAN_INTERNAL_TextureTransitionToDefaultUsage(
renderer,
@@ -8181,23 +8220,22 @@ static void VULKAN_BindComputeStorageTextures(
vulkanCommandBuffer->readOnlyComputeStorageTextures[firstSlot + i]);
}
VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)storageTextures[i];
vulkanCommandBuffer->readOnlyComputeStorageTextures[firstSlot + i] =
textureContainer->activeTexture;
/* Then transition the new texture and prepare it for binding */
VULKAN_INTERNAL_TextureTransitionFromDefaultUsage(
renderer,
vulkanCommandBuffer,
VULKAN_TEXTURE_USAGE_MODE_COMPUTE_STORAGE_READ,
textureContainer->activeTexture);
VULKAN_INTERNAL_TrackTexture(
vulkanCommandBuffer,
textureContainer->activeTexture);
}
vulkanCommandBuffer->readOnlyComputeStorageTextures[firstSlot + i] = textureContainer->activeTexture;
vulkanCommandBuffer->needNewComputeReadOnlyDescriptorSet = true;
}
}
}
static void VULKAN_BindComputeStorageBuffers(
@@ -8208,10 +8246,12 @@ static void VULKAN_BindComputeStorageBuffers(
{
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
VulkanBufferContainer *bufferContainer;
Uint32 i;
for (i = 0; i < numBindings; i += 1) {
for (Uint32 i = 0; i < numBindings; i += 1) {
VulkanBufferContainer *bufferContainer = (VulkanBufferContainer *)storageBuffers[i];
if (vulkanCommandBuffer->readOnlyComputeStorageBuffers[firstSlot + i] != bufferContainer->activeBuffer) {
/* If a different buffer was in this slot, transition it back to its default usage */
if (vulkanCommandBuffer->readOnlyComputeStorageBuffers[firstSlot + i] != NULL) {
VULKAN_INTERNAL_BufferTransitionToDefaultUsage(
renderer,
@@ -8220,10 +8260,7 @@ static void VULKAN_BindComputeStorageBuffers(
vulkanCommandBuffer->readOnlyComputeStorageBuffers[firstSlot + i]);
}
bufferContainer = (VulkanBufferContainer *)storageBuffers[i];
vulkanCommandBuffer->readOnlyComputeStorageBuffers[firstSlot + i] = bufferContainer->activeBuffer;
/* Then transition the new buffer and prepare it for binding */
VULKAN_INTERNAL_BufferTransitionFromDefaultUsage(
renderer,
vulkanCommandBuffer,
@@ -8233,9 +8270,11 @@ static void VULKAN_BindComputeStorageBuffers(
VULKAN_INTERNAL_TrackBuffer(
vulkanCommandBuffer,
bufferContainer->activeBuffer);
}
vulkanCommandBuffer->readOnlyComputeStorageBuffers[firstSlot + i] = bufferContainer->activeBuffer;
vulkanCommandBuffer->needNewComputeReadOnlyDescriptorSet = true;
}
}
}
static void VULKAN_PushComputeUniformData(
@@ -8323,7 +8362,7 @@ static void VULKAN_INTERNAL_BindComputeDescriptorSets(
currentWriteDescriptorSet->sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
currentWriteDescriptorSet->pNext = NULL;
currentWriteDescriptorSet->descriptorCount = 1;
currentWriteDescriptorSet->descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
currentWriteDescriptorSet->descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; // Yes, we are declaring the readonly storage texture as a sampled image, because shaders are stupid.
currentWriteDescriptorSet->dstArrayElement = 0;
currentWriteDescriptorSet->dstBinding = resourceLayout->numSamplers + i;
currentWriteDescriptorSet->dstSet = commandBuffer->computeReadOnlyDescriptorSet;
@@ -9226,6 +9265,7 @@ static bool VULKAN_INTERNAL_AllocateCommandBuffer(
// Resource bind tracking
commandBuffer->needVertexBufferBind = false;
commandBuffer->needNewVertexResourceDescriptorSet = true;
commandBuffer->needNewVertexUniformDescriptorSet = true;
commandBuffer->needNewVertexUniformOffsets = true;
@@ -9419,6 +9459,7 @@ static SDL_GPUCommandBuffer *VULKAN_AcquireCommandBuffer(
commandBuffer->computeUniformBuffers[i] = NULL;
}
commandBuffer->needVertexBufferBind = false;
commandBuffer->needNewVertexResourceDescriptorSet = true;
commandBuffer->needNewVertexUniformDescriptorSet = true;
commandBuffer->needNewVertexUniformOffsets = true;
@@ -9439,6 +9480,10 @@ static SDL_GPUCommandBuffer *VULKAN_AcquireCommandBuffer(
commandBuffer->computeReadWriteDescriptorSet = VK_NULL_HANDLE;
commandBuffer->computeUniformDescriptorSet = VK_NULL_HANDLE;
SDL_zeroa(commandBuffer->vertexBuffers);
SDL_zeroa(commandBuffer->vertexBufferOffsets);
commandBuffer->vertexBufferCount = 0;
SDL_zeroa(commandBuffer->vertexSamplerTextures);
SDL_zeroa(commandBuffer->vertexSamplers);
SDL_zeroa(commandBuffer->vertexStorageTextures);
@@ -9868,8 +9913,6 @@ static bool VULKAN_INTERNAL_AcquireSwapchainTexture(
VK_NULL_HANDLE,
&swapchainImageIndex);
//if (acquireResult == VK_ERROR_OUT_OF_DATE_KHR) { SDL_Log("VULKAN SWAPCHAIN OUT OF DATE"); }
if (acquireResult == VK_SUCCESS || acquireResult == VK_SUBOPTIMAL_KHR) {
break; // we got the next image!
}
+1 -1
View File
@@ -1028,7 +1028,7 @@ extern "C"
static void SDLCALL RequestBluetoothPermissionCallback( void *userdata, const char *permission, bool granted )
{
SDL_Log( "Bluetooth permission %s\n", granted ? "granted" : "denied" );
SDL_Log( "Bluetooth permission %s", granted ? "granted" : "denied" );
if ( granted && g_HIDDeviceManagerCallbackHandler )
{
+5 -2
View File
@@ -788,10 +788,13 @@ static bool SDLCALL mem_close(void *userdata)
#if defined(HAVE_STDIO_H) && !defined(SDL_PLATFORM_WINDOWS)
static bool IsRegularFileOrPipe(FILE *f)
{
#ifndef SDL_PLATFORM_EMSCRIPTEN
struct stat st;
if (fstat(fileno(f), &st) < 0 || !(S_ISREG(st.st_mode) || S_ISFIFO(st.st_mode))) {
return false;
}
#endif // !SDL_PLATFORM_EMSCRIPTEN
return true;
}
#endif
@@ -1153,7 +1156,7 @@ void *SDL_LoadFile_IO(SDL_IOStream *src, size_t *datasize, bool closeio)
size = FILE_CHUNK_SIZE;
loading_chunks = true;
}
if (size >= SDL_SIZE_MAX) {
if (size >= SDL_SIZE_MAX - 1) {
goto done;
}
data = (char *)SDL_malloc((size_t)(size + 1));
@@ -1166,7 +1169,7 @@ void *SDL_LoadFile_IO(SDL_IOStream *src, size_t *datasize, bool closeio)
if (loading_chunks) {
if ((size_total + FILE_CHUNK_SIZE) > size) {
size = (size_total + FILE_CHUNK_SIZE);
if (size >= SDL_SIZE_MAX) {
if (size >= SDL_SIZE_MAX - 1) {
newdata = NULL;
} else {
newdata = (char *)SDL_realloc(data, (size_t)(size + 1));
+1 -1
View File
@@ -329,7 +329,7 @@ void Android_AddJoystick(int device_id, const char *name, const char *desc, int
}
#ifdef DEBUG_JOYSTICK
SDL_Log("Joystick: %s, descriptor %s, vendor = 0x%.4x, product = 0x%.4x, %d axes, %d hats\n", name, desc, vendor_id, product_id, naxes, nhats);
SDL_Log("Joystick: %s, descriptor %s, vendor = 0x%.4x, product = 0x%.4x, %d axes, %d hats", name, desc, vendor_id, product_id, naxes, nhats);
#endif
if (nhats > 0) {
+1 -3
View File
@@ -50,9 +50,7 @@ static id disconnectObserver = nil;
#include <objc/message.h>
/* remove compilation warnings for strict builds by defining these selectors, even though
* they are only ever used indirectly through objc_msgSend
*/
// Fix build errors when using an older SDK by defining these selectors
@interface GCController (SDL)
#if !((__IPHONE_OS_VERSION_MAX_ALLOWED >= 140500) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 140500) || (__MAC_OS_X_VERSION_MAX_ALLOWED >= 110300))
@property(class, nonatomic, readwrite) BOOL shouldMonitorBackgroundEvents;
+3 -3
View File
@@ -566,7 +566,7 @@ static bool HIDAPI_DriverPS3_UpdateDevice(SDL_HIDAPI_Device *device)
break;
default:
#ifdef DEBUG_JOYSTICK
SDL_Log("Unknown PS3 packet: 0x%.2x\n", data[0]);
SDL_Log("Unknown PS3 packet: 0x%.2x", data[0]);
#endif
break;
}
@@ -1004,7 +1004,7 @@ static bool HIDAPI_DriverPS3ThirdParty_UpdateDevice(SDL_HIDAPI_Device *device)
HIDAPI_DriverPS3ThirdParty_HandleStatePacket18(joystick, ctx, data, size);
} else {
#ifdef DEBUG_JOYSTICK
SDL_Log("Unknown PS3 packet, size %d\n", size);
SDL_Log("Unknown PS3 packet, size %d", size);
#endif
}
}
@@ -1357,7 +1357,7 @@ static bool HIDAPI_DriverPS3SonySixaxis_UpdateDevice(SDL_HIDAPI_Device *device)
break;
default:
#ifdef DEBUG_JOYSTICK
SDL_Log("Unknown PS3 packet: 0x%.2x\n", data[0]);
SDL_Log("Unknown PS3 packet: 0x%.2x", data[0]);
#endif
break;
}
+8 -8
View File
@@ -323,7 +323,7 @@ static bool HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device)
if (size > 0) {
HIDAPI_DumpPacket("PS4 first packet: size = %d", data, size);
} else {
SDL_Log("PS4 first packet: size = %d\n", size);
SDL_Log("PS4 first packet: size = %d", size);
}
#endif
if (size > 0 &&
@@ -468,7 +468,7 @@ static bool HIDAPI_DriverPS4_LoadOfficialCalibrationData(SDL_HIDAPI_Device *devi
if (!ctx->official_controller) {
#ifdef DEBUG_PS4_CALIBRATION
SDL_Log("Not an official controller, ignoring calibration\n");
SDL_Log("Not an official controller, ignoring calibration");
#endif
return false;
}
@@ -478,7 +478,7 @@ static bool HIDAPI_DriverPS4_LoadOfficialCalibrationData(SDL_HIDAPI_Device *devi
size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdGyroCalibration_USB, data, sizeof(data));
if (size < 35) {
#ifdef DEBUG_PS4_CALIBRATION
SDL_Log("Short read of calibration data: %d, ignoring calibration\n", size);
SDL_Log("Short read of calibration data: %d, ignoring calibration", size);
#endif
return false;
}
@@ -487,7 +487,7 @@ static bool HIDAPI_DriverPS4_LoadOfficialCalibrationData(SDL_HIDAPI_Device *devi
size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdGyroCalibration_BT, data, sizeof(data));
if (size < 35) {
#ifdef DEBUG_PS4_CALIBRATION
SDL_Log("Short read of calibration data: %d, ignoring calibration\n", size);
SDL_Log("Short read of calibration data: %d, ignoring calibration", size);
#endif
return false;
}
@@ -590,19 +590,19 @@ static bool HIDAPI_DriverPS4_LoadOfficialCalibrationData(SDL_HIDAPI_Device *devi
ctx->hardware_calibration = true;
for (i = 0; i < 6; ++i) {
#ifdef DEBUG_PS4_CALIBRATION
SDL_Log("calibration[%d] bias = %d, sensitivity = %f\n", i, ctx->calibration[i].bias, ctx->calibration[i].scale);
SDL_Log("calibration[%d] bias = %d, sensitivity = %f", i, ctx->calibration[i].bias, ctx->calibration[i].scale);
#endif
// Some controllers have a bad calibration
if (SDL_abs(ctx->calibration[i].bias) > 1024 || SDL_fabsf(1.0f - ctx->calibration[i].scale) > 0.5f) {
#ifdef DEBUG_PS4_CALIBRATION
SDL_Log("invalid calibration, ignoring\n");
SDL_Log("invalid calibration, ignoring");
#endif
ctx->hardware_calibration = false;
}
}
} else {
#ifdef DEBUG_PS4_CALIBRATION
SDL_Log("Calibration data not available\n");
SDL_Log("Calibration data not available");
#endif
}
return ctx->hardware_calibration;
@@ -1291,7 +1291,7 @@ static bool HIDAPI_DriverPS4_UpdateDevice(SDL_HIDAPI_Device *device)
break;
default:
#ifdef DEBUG_JOYSTICK
SDL_Log("Unknown PS4 packet: 0x%.2x\n", data[0]);
SDL_Log("Unknown PS4 packet: 0x%.2x", data[0]);
#endif
break;
}
+5 -5
View File
@@ -402,7 +402,7 @@ static bool HIDAPI_DriverPS5_InitDevice(SDL_HIDAPI_Device *device)
if (size > 0) {
HIDAPI_DumpPacket("PS5 first packet: size = %d", data, size);
} else {
SDL_Log("PS5 first packet: size = %d\n", size);
SDL_Log("PS5 first packet: size = %d", size);
}
#endif
if (size == 64) {
@@ -561,7 +561,7 @@ static void HIDAPI_DriverPS5_LoadCalibrationData(SDL_HIDAPI_Device *device)
size = ReadFeatureReport(device->dev, k_EPS5FeatureReportIdCalibration, data, sizeof(data));
if (size < 35) {
#ifdef DEBUG_PS5_CALIBRATION
SDL_Log("Short read of calibration data: %d, ignoring calibration\n", size);
SDL_Log("Short read of calibration data: %d, ignoring calibration", size);
#endif
return;
}
@@ -631,12 +631,12 @@ static void HIDAPI_DriverPS5_LoadCalibrationData(SDL_HIDAPI_Device *device)
for (i = 0; i < 6; ++i) {
float divisor = (i < 3 ? 64.0f : 1.0f);
#ifdef DEBUG_PS5_CALIBRATION
SDL_Log("calibration[%d] bias = %d, sensitivity = %f\n", i, ctx->calibration[i].bias, ctx->calibration[i].sensitivity);
SDL_Log("calibration[%d] bias = %d, sensitivity = %f", i, ctx->calibration[i].bias, ctx->calibration[i].sensitivity);
#endif
// Some controllers have a bad calibration
if ((SDL_abs(ctx->calibration[i].bias) > 1024) || (SDL_fabsf(1.0f - ctx->calibration[i].sensitivity / divisor) > 0.5f)) {
#ifdef DEBUG_PS5_CALIBRATION
SDL_Log("invalid calibration, ignoring\n");
SDL_Log("invalid calibration, ignoring");
#endif
ctx->hardware_calibration = false;
}
@@ -1531,7 +1531,7 @@ static bool HIDAPI_DriverPS5_UpdateDevice(SDL_HIDAPI_Device *device)
break;
default:
#ifdef DEBUG_JOYSTICK
SDL_Log("Unknown PS5 packet: 0x%.2x\n", data[0]);
SDL_Log("Unknown PS5 packet: 0x%.2x", data[0]);
#endif
break;
}
+1 -1
View File
@@ -324,7 +324,7 @@ static void HIDAPI_DriverSteamHori_HandleStatePacket(SDL_Joystick *joystick, SDL
SDL_SendJoystickSensor(timestamp, joystick, SDL_SENSOR_GYRO, sensor_timestamp, imu_data, 3);
// SDL_Log("%u %f, %f, %f \n", data[0], imu_data[0], imu_data[1], imu_data[2] );
// SDL_Log("%u %f, %f, %f ", data[0], imu_data[0], imu_data[1], imu_data[2] );
imu_data[2] = LOAD16(data[18], data[19]) * accelScale;
imu_data[1] = -1 * LOAD16(data[20], data[21]) * accelScale;
imu_data[0] = LOAD16(data[22], data[23]) * accelScale;
+7 -7
View File
@@ -521,11 +521,11 @@ static bool WriteProprietary(SDL_DriverSwitch_Context *ctx, ESwitchProprietaryCo
}
if (!waitForReply || ReadProprietaryReply(ctx, ucCommand)) {
// SDL_Log("Succeeded%s after %d tries\n", ctx->m_bSyncWrite ? " (sync)" : "", nTries);
// SDL_Log("Succeeded%s after %d tries", ctx->m_bSyncWrite ? " (sync)" : "", nTries);
return true;
}
}
// SDL_Log("Failed%s after %d tries\n", ctx->m_bSyncWrite ? " (sync)" : "", nTries);
// SDL_Log("Failed%s after %d tries", ctx->m_bSyncWrite ? " (sync)" : "", nTries);
return false;
}
@@ -579,7 +579,7 @@ static void EncodeRumble(SwitchRumbleData_t *pRumble, Uint16 usHighFreq, Uint8 u
pRumble->rgucData[3] = usLowFreqAmp & 0xFF;
#ifdef DEBUG_RUMBLE
SDL_Log("Freq: %.2X %.2X %.2X, Amp: %.2X %.2X %.2X\n",
SDL_Log("Freq: %.2X %.2X %.2X, Amp: %.2X %.2X %.2X",
usHighFreq & 0xFF, ((usHighFreq >> 8) & 0x01), ucLowFreq,
ucHighFreqAmp, ((usLowFreqAmp >> 8) & 0x80), usLowFreqAmp & 0xFF);
#endif
@@ -1647,7 +1647,7 @@ static bool HIDAPI_DriverSwitch_SendPendingRumble(SDL_DriverSwitch_Context *ctx)
Uint16 high_frequency_rumble = (Uint16)ctx->m_unRumblePending;
#ifdef DEBUG_RUMBLE
SDL_Log("Sent pending rumble %d/%d, %d ms after previous rumble\n", low_frequency_rumble, high_frequency_rumble, SDL_GetTicks() - ctx->m_ulRumbleSent);
SDL_Log("Sent pending rumble %d/%d, %d ms after previous rumble", low_frequency_rumble, high_frequency_rumble, SDL_GetTicks() - ctx->m_ulRumbleSent);
#endif
ctx->m_bRumblePending = false;
ctx->m_unRumblePending = 0;
@@ -1659,7 +1659,7 @@ static bool HIDAPI_DriverSwitch_SendPendingRumble(SDL_DriverSwitch_Context *ctx)
ctx->m_bRumbleZeroPending = false;
#ifdef DEBUG_RUMBLE
SDL_Log("Sent pending zero rumble, %d ms after previous rumble\n", SDL_GetTicks() - ctx->m_ulRumbleSent);
SDL_Log("Sent pending zero rumble, %d ms after previous rumble", SDL_GetTicks() - ctx->m_ulRumbleSent);
#endif
return HIDAPI_DriverSwitch_ActuallyRumbleJoystick(ctx, 0, 0);
}
@@ -1709,7 +1709,7 @@ static bool HIDAPI_DriverSwitch_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Jo
}
#ifdef DEBUG_RUMBLE
SDL_Log("Sent rumble %d/%d\n", low_frequency_rumble, high_frequency_rumble);
SDL_Log("Sent rumble %d/%d", low_frequency_rumble, high_frequency_rumble);
#endif
return HIDAPI_DriverSwitch_ActuallyRumbleJoystick(ctx, low_frequency_rumble, high_frequency_rumble);
@@ -2719,7 +2719,7 @@ static bool HIDAPI_DriverSwitch_UpdateDevice(SDL_HIDAPI_Device *device)
} else if (ctx->m_bRumbleActive &&
now >= (ctx->m_ulRumbleSent + RUMBLE_REFRESH_FREQUENCY_MS)) {
#ifdef DEBUG_RUMBLE
SDL_Log("Sent continuing rumble, %d ms after previous rumble\n", now - ctx->m_ulRumbleSent);
SDL_Log("Sent continuing rumble, %d ms after previous rumble", now - ctx->m_ulRumbleSent);
#endif
WriteRumble(ctx);
}
+4 -4
View File
@@ -1364,7 +1364,7 @@ static void HandleStatus(SDL_DriverWii_Context *ctx, SDL_Joystick *joystick)
// The report data format has been reset, need to update it
ResetButtonPacketType(ctx);
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI Wii: Status update, extension %s\n", hasExtension ? "CONNECTED" : "DISCONNECTED");
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI Wii: Status update, extension %s", hasExtension ? "CONNECTED" : "DISCONNECTED");
/* When Motion Plus is active, we get extension connect/disconnect status
* through the Motion Plus packets. Otherwise we can use the status here.
@@ -1404,7 +1404,7 @@ static void HandleResponse(SDL_DriverWii_Context *ctx, SDL_Joystick *joystick)
if (ParseExtensionIdentifyResponse(ctx, &extension)) {
if ((extension & WII_EXTENSION_MOTIONPLUS_MASK) == WII_EXTENSION_MOTIONPLUS_ID) {
// Motion Plus is currently active
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI Wii: Motion Plus CONNECTED (stage %d)\n", ctx->m_eCommState == k_eWiiCommunicationState_CheckMotionPlusStage1 ? 1 : 2);
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI Wii: Motion Plus CONNECTED (stage %d)", ctx->m_eCommState == k_eWiiCommunicationState_CheckMotionPlusStage1 ? 1 : 2);
if (!ctx->m_bMotionPlusPresent) {
// Reinitialize to get new sensor availability
@@ -1420,7 +1420,7 @@ static void HandleResponse(SDL_DriverWii_Context *ctx, SDL_Joystick *joystick)
} else {
// Motion Plus is not present
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI Wii: Motion Plus DISCONNECTED (stage %d)\n", ctx->m_eCommState == k_eWiiCommunicationState_CheckMotionPlusStage1 ? 1 : 2);
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI Wii: Motion Plus DISCONNECTED (stage %d)", ctx->m_eCommState == k_eWiiCommunicationState_CheckMotionPlusStage1 ? 1 : 2);
if (ctx->m_bMotionPlusPresent) {
// Reinitialize to get new sensor availability
@@ -1443,7 +1443,7 @@ static void HandleButtonPacket(SDL_DriverWii_Context *ctx, SDL_Joystick *joystic
// FIXME: This should see if the data format is compatible rather than equal
if (eExpectedReport != ctx->m_rgucReadBuffer[0]) {
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI Wii: Resetting report mode to %d\n", eExpectedReport);
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI Wii: Resetting report mode to %d", eExpectedReport);
RequestButtonPacketType(ctx, eExpectedReport);
}
+3 -3
View File
@@ -306,7 +306,7 @@ static bool HIDAPI_DriverXbox360W_UpdateDevice(SDL_HIDAPI_Device *device)
if (size == 2 && data[0] == 0x08) {
bool connected = (data[1] & 0x80) ? true : false;
#ifdef DEBUG_JOYSTICK
SDL_Log("Connected = %s\n", connected ? "TRUE" : "FALSE");
SDL_Log("Connected = %s", connected ? "TRUE" : "FALSE");
#endif
if (connected != ctx->connected) {
ctx->connected = connected;
@@ -323,14 +323,14 @@ static bool HIDAPI_DriverXbox360W_UpdateDevice(SDL_HIDAPI_Device *device)
} else if (size == 29 && data[0] == 0x00 && data[1] == 0x0f && data[2] == 0x00 && data[3] == 0xf0) {
// Serial number is data[7-13]
#ifdef DEBUG_JOYSTICK
SDL_Log("Battery status (initial): %d\n", data[17]);
SDL_Log("Battery status (initial): %d", data[17]);
#endif
if (joystick) {
UpdatePowerLevel(joystick, data[17]);
}
} else if (size == 29 && data[0] == 0x00 && data[1] == 0x00 && data[2] == 0x00 && data[3] == 0x13) {
#ifdef DEBUG_JOYSTICK
SDL_Log("Battery status: %d\n", data[4]);
SDL_Log("Battery status: %d", data[4]);
#endif
if (joystick) {
UpdatePowerLevel(joystick, data[4]);
+18 -18
View File
@@ -213,7 +213,7 @@ static void SDLCALL SDL_HomeLEDHintChanged(void *userdata, const char *name, con
static void SetInitState(SDL_DriverXboxOne_Context *ctx, SDL_XboxOneInitState state)
{
#ifdef DEBUG_JOYSTICK
SDL_Log("Setting init state %d\n", state);
SDL_Log("Setting init state %d", state);
#endif
ctx->init_state = state;
}
@@ -391,7 +391,7 @@ static bool HIDAPI_DriverXboxOne_InitDevice(SDL_HIDAPI_Device *device)
}
#ifdef DEBUG_JOYSTICK
SDL_Log("Controller version: %d (0x%.4x)\n", device->version, device->version);
SDL_Log("Controller version: %d (0x%.4x)", device->version, device->version);
#endif
device->type = SDL_GAMEPAD_TYPE_XBOXONE;
@@ -620,7 +620,7 @@ static void HIDAPI_DriverXboxOne_HandleUnmappedStatePacket(SDL_Joystick *joystic
return;
}
#ifdef DEBUG_XBOX_PROTOCOL
SDL_Log(">>> Paddles: %d,%d,%d,%d mapped = %s\n",
SDL_Log(">>> Paddles: %d,%d,%d,%d mapped = %s",
(data[paddle_index] & button1_bit) ? 1 : 0,
(data[paddle_index] & button2_bit) ? 1 : 0,
(data[paddle_index] & button3_bit) ? 1 : 0,
@@ -654,7 +654,7 @@ static void HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_D
Uint8 packet[] = { 0x4d, 0x00, 0x00, 0x02, 0x07, 0x00 };
#ifdef DEBUG_JOYSTICK
SDL_Log("Enabling paddles on XBox Elite 2\n");
SDL_Log("Enabling paddles on XBox Elite 2");
#endif
SDL_HIDAPI_SendRumble(ctx->device, packet, sizeof(packet));
}
@@ -787,7 +787,7 @@ static void HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_D
paddles_mapped = (data[20] != 0);
}
#ifdef DEBUG_XBOX_PROTOCOL
SDL_Log(">>> Paddles: %d,%d,%d,%d mapped = %s\n",
SDL_Log(">>> Paddles: %d,%d,%d,%d mapped = %s",
(data[paddle_index] & button1_bit) ? 1 : 0,
(data[paddle_index] & button2_bit) ? 1 : 0,
(data[paddle_index] & button3_bit) ? 1 : 0,
@@ -954,7 +954,7 @@ static void HIDAPI_DriverXboxOneBluetooth_HandleButtons(Uint64 timestamp, SDL_Jo
}
#ifdef DEBUG_XBOX_PROTOCOL
SDL_Log(">>> Paddles: %d,%d,%d,%d mapped = %s\n",
SDL_Log(">>> Paddles: %d,%d,%d,%d mapped = %s",
(data[paddle_index] & button1_bit) ? 1 : 0,
(data[paddle_index] & button2_bit) ? 1 : 0,
(data[paddle_index] & button3_bit) ? 1 : 0,
@@ -990,7 +990,7 @@ static void HIDAPI_DriverXboxOneBluetooth_HandleStatePacket(SDL_Joystick *joysti
HIDAPI_DriverXboxOneBluetooth_HandleButtons(timestamp, joystick, ctx, data, size);
} else {
#ifdef DEBUG_XBOX_PROTOCOL
SDL_Log("Unknown Bluetooth state packet format\n");
SDL_Log("Unknown Bluetooth state packet format");
#endif
return;
}
@@ -1104,7 +1104,7 @@ static void HIDAPI_DriverXboxOne_HandleSerialIDPacket(SDL_DriverXboxOne_Context
serial[i * 2] = '\0';
#ifdef DEBUG_JOYSTICK
SDL_Log("Setting serial number to %s\n", serial);
SDL_Log("Setting serial number to %s", serial);
#endif
HIDAPI_SetDeviceSerial(ctx->device, serial);
}
@@ -1129,7 +1129,7 @@ static bool HIDAPI_DriverXboxOne_UpdateInitState(SDL_DriverXboxOne_Context *ctx)
if (SDL_GetTicks() >= (ctx->send_time + CONTROLLER_IDENTIFY_TIMEOUT_MS)) {
// We haven't heard anything, let's move on
#ifdef DEBUG_JOYSTICK
SDL_Log("Identification request timed out after %llu ms\n", (SDL_GetTicks() - ctx->send_time));
SDL_Log("Identification request timed out after %llu ms", (SDL_GetTicks() - ctx->send_time));
#endif
SetInitState(ctx, XBOX_ONE_INIT_STATE_STARTUP);
}
@@ -1146,7 +1146,7 @@ static bool HIDAPI_DriverXboxOne_UpdateInitState(SDL_DriverXboxOne_Context *ctx)
case XBOX_ONE_INIT_STATE_PREPARE_INPUT:
if (SDL_GetTicks() >= (ctx->send_time + CONTROLLER_PREPARE_INPUT_TIMEOUT_MS)) {
#ifdef DEBUG_JOYSTICK
SDL_Log("Prepare input complete after %llu ms\n", (SDL_GetTicks() - ctx->send_time));
SDL_Log("Prepare input complete after %llu ms", (SDL_GetTicks() - ctx->send_time));
#endif
SetInitState(ctx, XBOX_ONE_INIT_STATE_COMPLETE);
}
@@ -1323,7 +1323,7 @@ static bool HIDAPI_GIP_SendPacket(SDL_DriverXboxOne_Context *ctx, struct gip_hea
hdr_len = HIDAPI_GIP_GetHeaderLength(hdr);
size = (hdr_len + hdr->packet_length);
if (size > sizeof(packet)) {
SDL_SetError("Couldn't send GIP packet, size (%d) too large\n", size);
SDL_SetError("Couldn't send GIP packet, size (%d) too large", size);
return false;
}
@@ -1397,7 +1397,7 @@ static bool HIDAPI_GIP_DispatchPacket(SDL_Joystick *joystick, SDL_DriverXboxOne_
then 8 bytes of unknown data
*/
#ifdef DEBUG_JOYSTICK
SDL_Log("Controller announce after %llu ms\n", (SDL_GetTicks() - ctx->start_time));
SDL_Log("Controller announce after %llu ms", (SDL_GetTicks() - ctx->start_time));
#endif
SetInitState(ctx, XBOX_ONE_INIT_STATE_ANNOUNCED);
break;
@@ -1407,7 +1407,7 @@ static bool HIDAPI_GIP_DispatchPacket(SDL_Joystick *joystick, SDL_DriverXboxOne_
break;
case GIP_CMD_IDENTIFY:
#ifdef DEBUG_JOYSTICK
SDL_Log("Identification request completed after %llu ms\n", (SDL_GetTicks() - ctx->send_time));
SDL_Log("Identification request completed after %llu ms", (SDL_GetTicks() - ctx->send_time));
#endif
#ifdef DEBUG_XBOX_PROTOCOL
HIDAPI_DumpPacket("Xbox One identification data: size = %d", data, size);
@@ -1440,7 +1440,7 @@ static bool HIDAPI_GIP_DispatchPacket(SDL_Joystick *joystick, SDL_DriverXboxOne_
break;
default:
#ifdef DEBUG_JOYSTICK
SDL_Log("Unknown Xbox One packet: 0x%.2x\n", hdr->command);
SDL_Log("Unknown Xbox One packet: 0x%.2x", hdr->command);
#endif
break;
}
@@ -1452,7 +1452,7 @@ static bool HIDAPI_GIP_DispatchPacket(SDL_Joystick *joystick, SDL_DriverXboxOne_
// Ignore the first input, it may be spurious
#ifdef DEBUG_JOYSTICK
SDL_Log("Controller ignoring spurious input\n");
SDL_Log("Controller ignoring spurious input");
#endif
break;
}
@@ -1469,7 +1469,7 @@ static bool HIDAPI_GIP_DispatchPacket(SDL_Joystick *joystick, SDL_DriverXboxOne_
break;
default:
#ifdef DEBUG_JOYSTICK
SDL_Log("Unknown Xbox One packet: 0x%.2x\n", hdr->command);
SDL_Log("Unknown Xbox One packet: 0x%.2x", hdr->command);
#endif
break;
}
@@ -1596,7 +1596,7 @@ static bool HIDAPI_DriverXboxOne_UpdateDevice(SDL_HIDAPI_Device *device)
HIDAPI_DriverXboxOneBluetooth_HandleStatePacket(joystick, ctx, data, size);
} else {
#ifdef DEBUG_JOYSTICK
SDL_Log("Unknown Xbox One Bluetooth packet size: %d\n", size);
SDL_Log("Unknown Xbox One Bluetooth packet size: %d", size);
#endif
}
break;
@@ -1614,7 +1614,7 @@ static bool HIDAPI_DriverXboxOne_UpdateDevice(SDL_HIDAPI_Device *device)
break;
default:
#ifdef DEBUG_JOYSTICK
SDL_Log("Unknown Xbox One packet: 0x%.2x\n", data[0]);
SDL_Log("Unknown Xbox One packet: 0x%.2x", data[0]);
#endif
break;
}
+6 -6
View File
@@ -458,7 +458,7 @@ static void HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device, bool *removed) S
if (dev == NULL) {
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
"HIDAPI_SetupDeviceDriver() couldn't open %s: %s\n",
"HIDAPI_SetupDeviceDriver() couldn't open %s: %s",
device->path, SDL_GetError());
return;
}
@@ -955,7 +955,7 @@ static SDL_HIDAPI_Device *HIDAPI_AddDevice(const struct SDL_hid_device_info *inf
return NULL;
}
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "Added HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, bluetooth %d, version %d, serial %s, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s (%s)\n", device->name, device->vendor_id, device->product_id, device->is_bluetooth, device->version,
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "Added HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, bluetooth %d, version %d, serial %s, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s (%s)", device->name, device->vendor_id, device->product_id, device->is_bluetooth, device->version,
device->serial ? device->serial : "NONE", device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol, device->usage_page, device->usage,
device->path, device->driver ? device->driver->name : "NONE", device->driver && device->driver->enabled ? "ENABLED" : "DISABLED");
@@ -969,7 +969,7 @@ static void HIDAPI_DelDevice(SDL_HIDAPI_Device *device)
SDL_AssertJoysticksLocked();
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "Removing HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, bluetooth %d, version %d, serial %s, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s (%s)\n", device->name, device->vendor_id, device->product_id, device->is_bluetooth, device->version,
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "Removing HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, bluetooth %d, version %d, serial %s, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s (%s)", device->name, device->vendor_id, device->product_id, device->is_bluetooth, device->version,
device->serial ? device->serial : "NONE", device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol, device->usage_page, device->usage,
device->path, device->driver ? device->driver->name : "NONE", device->driver && device->driver->enabled ? "ENABLED" : "DISABLED");
@@ -1229,7 +1229,7 @@ bool HIDAPI_IsDeviceTypePresent(SDL_GamepadType type)
SDL_UnlockJoysticks();
#ifdef DEBUG_HIDAPI
SDL_Log("HIDAPI_IsDeviceTypePresent() returning %s for %d\n", result ? "true" : "false", type);
SDL_Log("HIDAPI_IsDeviceTypePresent() returning %s for %d", result ? "true" : "false", type);
#endif
return result;
}
@@ -1280,7 +1280,7 @@ bool HIDAPI_IsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 version,
SDL_UnlockJoysticks();
#ifdef DEBUG_HIDAPI
SDL_Log("HIDAPI_IsDevicePresent() returning %s for 0x%.4x / 0x%.4x\n", result ? "true" : "false", vendor_id, product_id);
SDL_Log("HIDAPI_IsDevicePresent() returning %s for 0x%.4x / 0x%.4x", result ? "true" : "false", vendor_id, product_id);
#endif
return result;
}
@@ -1492,7 +1492,7 @@ static bool HIDAPI_JoystickOpen(SDL_Joystick *joystick, int device_index)
if (!device || !device->driver) {
// This should never happen - validated before being called
return SDL_SetError("Couldn't find HIDAPI device at index %d\n", device_index);
return SDL_SetError("Couldn't find HIDAPI device at index %d", device_index);
}
hwdata = (struct joystick_hwdata *)SDL_calloc(1, sizeof(*hwdata));
+29 -29
View File
@@ -327,7 +327,7 @@ static bool IsJoystick(const char *path, int *fd, char **name_return, Uint16 *ve
FixupDeviceInfoForMapping(*fd, &inpid);
#ifdef DEBUG_JOYSTICK
SDL_Log("Joystick: %s, bustype = %d, vendor = 0x%.4x, product = 0x%.4x, version = %d\n", name, inpid.bustype, inpid.vendor, inpid.product, inpid.version);
SDL_Log("Joystick: %s, bustype = %d, vendor = 0x%.4x, product = 0x%.4x, version = %d", name, inpid.bustype, inpid.vendor, inpid.product, inpid.version);
#endif
if (SDL_ShouldIgnoreJoystick(inpid.vendor, inpid.product, inpid.version, name)) {
@@ -470,12 +470,12 @@ static void MaybeAddDevice(const char *path)
}
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Checking %s\n", path);
SDL_Log("Checking %s", path);
#endif
if (IsJoystick(path, &fd, &name, &vendor, &product, &guid)) {
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("found joystick: %s\n", path);
SDL_Log("found joystick: %s", path);
#endif
item = (SDL_joylist_item *)SDL_calloc(1, sizeof(SDL_joylist_item));
if (!item) {
@@ -516,7 +516,7 @@ static void MaybeAddDevice(const char *path)
if (IsSensor(path, &fd)) {
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("found sensor: %s\n", path);
SDL_Log("found sensor: %s", path);
#endif
item_sensor = (SDL_sensorlist_item *)SDL_calloc(1, sizeof(SDL_sensorlist_item));
if (!item_sensor) {
@@ -1217,7 +1217,7 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
for (i = BTN_JOYSTICK; i < KEY_MAX; ++i) {
if (test_bit(i, keybit)) {
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has button: 0x%x\n", i);
SDL_Log("Joystick has button: 0x%x", i);
#endif
joystick->hwdata->key_map[i] = joystick->nbuttons;
joystick->hwdata->has_key[i] = true;
@@ -1227,7 +1227,7 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
for (i = 0; i < BTN_JOYSTICK; ++i) {
if (test_bit(i, keybit)) {
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has button: 0x%x\n", i);
SDL_Log("Joystick has button: 0x%x", i);
#endif
joystick->hwdata->key_map[i] = joystick->nbuttons;
joystick->hwdata->has_key[i] = true;
@@ -1250,14 +1250,14 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
const int hat_index = (i - ABS_HAT0X) / 2;
struct hat_axis_correct *correct = &joystick->hwdata->hat_correct[hat_index];
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has digital hat: #%d\n", hat_index);
SDL_Log("Joystick has digital hat: #%d", hat_index);
if (hat_x >= 0) {
SDL_Log("X Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n",
SDL_Log("X Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }",
absinfo_x.value, absinfo_x.minimum, absinfo_x.maximum,
absinfo_x.fuzz, absinfo_x.flat, absinfo_x.resolution);
}
if (hat_y >= 0) {
SDL_Log("Y Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n",
SDL_Log("Y Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }",
absinfo_y.value, absinfo_y.minimum, absinfo_y.maximum,
absinfo_y.fuzz, absinfo_y.flat, absinfo_y.resolution);
}
@@ -1285,8 +1285,8 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
continue;
}
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has absolute axis: 0x%.2x\n", i);
SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n",
SDL_Log("Joystick has absolute axis: 0x%.2x", i);
SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }",
absinfo.value, absinfo.minimum, absinfo.maximum,
absinfo.fuzz, absinfo.flat, absinfo.resolution);
#endif // DEBUG_INPUT_EVENTS
@@ -1340,7 +1340,7 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
for (i = 0; i < key_pam_size; ++i) {
Uint16 code = joystick->hwdata->key_pam[i];
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has button: 0x%x\n", code);
SDL_Log("Joystick has button: 0x%x", code);
#endif
joystick->hwdata->key_map[code] = joystick->nbuttons;
joystick->hwdata->has_key[code] = true;
@@ -1366,7 +1366,7 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
int hat_index = (code - ABS_HAT0X) / 2;
if (!joystick->hwdata->has_hat[hat_index]) {
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has digital hat: #%d\n", hat_index);
SDL_Log("Joystick has digital hat: #%d", hat_index);
#endif
joystick->hwdata->hats_indices[hat_index] = joystick->nhats++;
joystick->hwdata->has_hat[hat_index] = true;
@@ -1377,7 +1377,7 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
}
} else {
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has absolute axis: 0x%.2x\n", code);
SDL_Log("Joystick has absolute axis: 0x%.2x", code);
#endif
joystick->hwdata->abs_map[code] = joystick->naxes;
joystick->hwdata->has_abs[code] = true;
@@ -1398,8 +1398,8 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
}
joystick->hwdata->accelerometer_scale[i] = absinfo.resolution;
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has accelerometer axis: 0x%.2x\n", ABS_X + i);
SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n",
SDL_Log("Joystick has accelerometer axis: 0x%.2x", ABS_X + i);
SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }",
absinfo.value, absinfo.minimum, absinfo.maximum,
absinfo.fuzz, absinfo.flat, absinfo.resolution);
#endif // DEBUG_INPUT_EVENTS
@@ -1416,8 +1416,8 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
}
joystick->hwdata->gyro_scale[i] = absinfo.resolution;
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has gyro axis: 0x%.2x\n", ABS_RX + i);
SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n",
SDL_Log("Joystick has gyro axis: 0x%.2x", ABS_RX + i);
SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }",
absinfo.value, absinfo.minimum, absinfo.maximum,
absinfo.fuzz, absinfo.flat, absinfo.resolution);
#endif // DEBUG_INPUT_EVENTS
@@ -1522,7 +1522,7 @@ static SDL_sensorlist_item *GetSensor(SDL_joylist_item *item)
}
close(fd_item);
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick UNIQ: %s\n", uniq_item);
SDL_Log("Joystick UNIQ: %s", uniq_item);
#endif // DEBUG_INPUT_EVENTS
for (item_sensor = SDL_sensorlist; item_sensor; item_sensor = item_sensor->next) {
@@ -1544,7 +1544,7 @@ static SDL_sensorlist_item *GetSensor(SDL_joylist_item *item)
}
close(fd_sensor);
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Sensor UNIQ: %s\n", uniq_sensor);
SDL_Log("Sensor UNIQ: %s", uniq_sensor);
#endif // DEBUG_INPUT_EVENTS
if (SDL_strcmp(uniq_item, uniq_sensor) == 0) {
@@ -1800,7 +1800,7 @@ static void PollAllValues(Uint64 timestamp, SDL_Joystick *joystick)
absinfo.value = AxisCorrect(joystick, i, absinfo.value);
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick : Re-read Axis %d (%d) val= %d\n",
SDL_Log("Joystick : Re-read Axis %d (%d) val= %d",
joystick->hwdata->abs_map[i], i, absinfo.value);
#endif
SDL_SendJoystickAxis(timestamp, joystick,
@@ -1831,7 +1831,7 @@ static void PollAllValues(Uint64 timestamp, SDL_Joystick *joystick)
if (joystick->hwdata->has_key[i]) {
bool down = test_bit(i, keyinfo);
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick : Re-read Button %d (%d) val= %d\n",
SDL_Log("Joystick : Re-read Button %d (%d) val= %d",
joystick->hwdata->key_map[i], i, down);
#endif
SDL_SendJoystickButton(timestamp, joystick,
@@ -1858,7 +1858,7 @@ static void PollAllSensors(Uint64 timestamp, SDL_Joystick *joystick)
if (ioctl(joystick->hwdata->fd_sensor, EVIOCGABS(ABS_RX + i), &absinfo) >= 0) {
data[i] = absinfo.value * (SDL_PI_F / 180.f) / joystick->hwdata->gyro_scale[i];
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick : Re-read Gyro (axis %d) val= %f\n", i, data[i]);
SDL_Log("Joystick : Re-read Gyro (axis %d) val= %f", i, data[i]);
#endif
}
}
@@ -1870,7 +1870,7 @@ static void PollAllSensors(Uint64 timestamp, SDL_Joystick *joystick)
if (ioctl(joystick->hwdata->fd_sensor, EVIOCGABS(ABS_X + i), &absinfo) >= 0) {
data[i] = absinfo.value * SDL_STANDARD_GRAVITY / joystick->hwdata->accelerometer_scale[i];
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick : Re-read Accelerometer (axis %d) val= %f\n", i, data[i]);
SDL_Log("Joystick : Re-read Accelerometer (axis %d) val= %f", i, data[i]);
#endif
}
}
@@ -1913,7 +1913,7 @@ static void HandleInputEvents(SDL_Joystick *joystick)
switch (event->type) {
case EV_KEY:
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Key 0x%.2x %s\n", code, event->value ? "PRESSED" : "RELEASED");
SDL_Log("Key 0x%.2x %s", code, event->value ? "PRESSED" : "RELEASED");
#endif
SDL_SendJoystickButton(SDL_EVDEV_GetEventTimestamp(event), joystick,
joystick->hwdata->key_map[code],
@@ -1932,7 +1932,7 @@ static void HandleInputEvents(SDL_Joystick *joystick)
hat_index = (code - ABS_HAT0X) / 2;
if (joystick->hwdata->has_hat[hat_index]) {
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Axis 0x%.2x = %d\n", code, event->value);
SDL_Log("Axis 0x%.2x = %d", code, event->value);
#endif
HandleHat(SDL_EVDEV_GetEventTimestamp(event), joystick, hat_index, code % 2, event->value);
break;
@@ -1940,7 +1940,7 @@ static void HandleInputEvents(SDL_Joystick *joystick)
SDL_FALLTHROUGH;
default:
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Axis 0x%.2x = %d\n", code, event->value);
SDL_Log("Axis 0x%.2x = %d", code, event->value);
#endif
event->value = AxisCorrect(joystick, code, event->value);
SDL_SendJoystickAxis(SDL_EVDEV_GetEventTimestamp(event), joystick,
@@ -1964,7 +1964,7 @@ static void HandleInputEvents(SDL_Joystick *joystick)
switch (code) {
case SYN_DROPPED:
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Event SYN_DROPPED detected\n");
SDL_Log("Event SYN_DROPPED detected");
#endif
joystick->hwdata->recovering_from_dropped = true;
break;
@@ -2047,7 +2047,7 @@ static void HandleInputEvents(SDL_Joystick *joystick)
switch (code) {
case SYN_DROPPED:
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Event SYN_DROPPED detected\n");
SDL_Log("Event SYN_DROPPED detected");
#endif
joystick->hwdata->recovering_from_dropped_sensor = true;
break;
+9 -9
View File
@@ -703,12 +703,12 @@ static void RAWINPUT_InitWindowsGamingInput(RAWINPUT_DeviceContext *ctx)
hr = __x_ABI_CWindows_CGaming_CInput_CIGamepadStatics_add_GamepadAdded(wgi_state.gamepad_statics, &gamepad_added.iface, &wgi_state.gamepad_added_token);
if (!SUCCEEDED(hr)) {
SDL_SetError("add_GamepadAdded() failed: 0x%lx\n", hr);
SDL_SetError("add_GamepadAdded() failed: 0x%lx", hr);
}
hr = __x_ABI_CWindows_CGaming_CInput_CIGamepadStatics_add_GamepadRemoved(wgi_state.gamepad_statics, &gamepad_removed.iface, &wgi_state.gamepad_removed_token);
if (!SUCCEEDED(hr)) {
SDL_SetError("add_GamepadRemoved() failed: 0x%lx\n", hr);
SDL_SetError("add_GamepadRemoved() failed: 0x%lx", hr);
}
}
}
@@ -935,7 +935,7 @@ static void RAWINPUT_AddDevice(HANDLE hDevice)
device->joystick_id = SDL_GetNextObjectID();
#ifdef DEBUG_RAWINPUT
SDL_Log("Adding RAWINPUT device '%s' VID 0x%.4x, PID 0x%.4x, version %d, handle 0x%.8x\n", device->name, device->vendor_id, device->product_id, device->version, device->hDevice);
SDL_Log("Adding RAWINPUT device '%s' VID 0x%.4x, PID 0x%.4x, version %d, handle 0x%.8x", device->name, device->vendor_id, device->product_id, device->version, device->hDevice);
#endif
// Add it to the list
@@ -985,7 +985,7 @@ static void RAWINPUT_DelDevice(SDL_RAWINPUT_Device *device, bool send_event)
SDL_PrivateJoystickRemoved(device->joystick_id);
#ifdef DEBUG_RAWINPUT
SDL_Log("Removing RAWINPUT device '%s' VID 0x%.4x, PID 0x%.4x, version %d, handle %p\n", device->name, device->vendor_id, device->product_id, device->version, device->hDevice);
SDL_Log("Removing RAWINPUT device '%s' VID 0x%.4x, PID 0x%.4x, version %d, handle %p", device->name, device->vendor_id, device->product_id, device->version, device->hDevice);
#endif
RAWINPUT_ReleaseDevice(device);
return;
@@ -1511,7 +1511,7 @@ static bool RAWINPUT_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_
gamepad_state->vibration.RightTrigger = (DOUBLE)right_rumble / SDL_MAX_UINT16;
hr = __x_ABI_CWindows_CGaming_CInput_CIGamepad_put_Vibration(gamepad_state->gamepad, gamepad_state->vibration);
if (!SUCCEEDED(hr)) {
return SDL_SetError("Setting vibration failed: 0x%lx\n", hr);
return SDL_SetError("Setting vibration failed: 0x%lx", hr);
}
return true;
} else {
@@ -1779,7 +1779,7 @@ static void RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick)
triggers for a frame. */
if (ctx->wgi_uncorrelate_count >= 5) {
#ifdef DEBUG_RAWINPUT
SDL_Log("UN-Correlated joystick %d to WindowsGamingInput device #%d\n", joystick->instance_id, ctx->wgi_slot);
SDL_Log("UN-Correlated joystick %d to WindowsGamingInput device #%d", joystick->instance_id, ctx->wgi_slot);
#endif
RAWINPUT_MarkWindowsGamingInputSlotFree(ctx->wgi_slot);
ctx->wgi_correlated = false;
@@ -1811,7 +1811,7 @@ static void RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick)
// correlation stayed steady and uncontested across multiple frames, guaranteed match
ctx->wgi_correlated = true;
#ifdef DEBUG_RAWINPUT
SDL_Log("Correlated joystick %d to WindowsGamingInput device #%d\n", joystick->instance_id, slot_idx);
SDL_Log("Correlated joystick %d to WindowsGamingInput device #%d", joystick->instance_id, slot_idx);
#endif
correlated = true;
RAWINPUT_MarkWindowsGamingInputSlotUsed(ctx->wgi_slot, ctx);
@@ -1875,7 +1875,7 @@ static void RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick)
triggers for a frame. */
if (ctx->xinput_uncorrelate_count >= 5) {
#ifdef DEBUG_RAWINPUT
SDL_Log("UN-Correlated joystick %d to XInput device #%d\n", joystick->instance_id, ctx->xinput_slot);
SDL_Log("UN-Correlated joystick %d to XInput device #%d", joystick->instance_id, ctx->xinput_slot);
#endif
RAWINPUT_MarkXInputSlotFree(ctx->xinput_slot);
ctx->xinput_correlated = false;
@@ -1907,7 +1907,7 @@ static void RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick)
// correlation stayed steady and uncontested across multiple frames, guaranteed match
ctx->xinput_correlated = true;
#ifdef DEBUG_RAWINPUT
SDL_Log("Correlated joystick %d to XInput device #%d\n", joystick->instance_id, slot_idx);
SDL_Log("Correlated joystick %d to XInput device #%d", joystick->instance_id, slot_idx);
#endif
correlated = true;
RAWINPUT_MarkXInputSlotUsed(ctx->xinput_slot);
+2
View File
@@ -4426,6 +4426,7 @@ bool SDL_RenderTexture9Grid(SDL_Renderer *renderer, SDL_Texture *texture, const
// Lower-right corner
curr_src.y = srcrect->y + srcrect->h - bottom_height;
curr_src.h = bottom_height;
curr_dst.y = dstrect->y + dstrect->h - dst_bottom_height;
curr_dst.h = dst_bottom_height;
if (!SDL_RenderTexture(renderer, texture, &curr_src, &curr_dst)) {
@@ -4474,6 +4475,7 @@ bool SDL_RenderTexture9Grid(SDL_Renderer *renderer, SDL_Texture *texture, const
// Bottom
curr_src.y = srcrect->y + srcrect->h - bottom_height;
curr_src.h = bottom_height;
curr_dst.y = dstrect->y + dstrect->h - dst_bottom_height;
curr_dst.h = dst_bottom_height;
if (!SDL_RenderTexture(renderer, texture, &curr_src, &curr_dst)) {
+7 -7
View File
@@ -997,7 +997,7 @@ static HRESULT D3D11_CreateWindowSizeDependentResources(SDL_Renderer *renderer)
*/
SDL_GetWindowSizeInPixels(renderer->window, &w, &h);
data->rotation = D3D11_GetCurrentRotation();
// SDL_Log("%s: windowSize={%d,%d}, orientation=%d\n", __FUNCTION__, w, h, (int)data->rotation);
// SDL_Log("%s: windowSize={%d,%d}, orientation=%d", __FUNCTION__, w, h, (int)data->rotation);
if (D3D11_IsDisplayRotated90Degrees(data->rotation)) {
int tmp = w;
w = h;
@@ -1078,7 +1078,7 @@ static bool D3D11_HandleDeviceLost(SDL_Renderer *renderer)
SUCCEEDED(D3D11_CreateWindowSizeDependentResources(renderer))) {
recovered = true;
} else {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Renderer couldn't recover from device lost: %s\n", SDL_GetError());
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Renderer couldn't recover from device lost: %s", SDL_GetError());
D3D11_ReleaseAll(renderer);
}
@@ -1990,7 +1990,7 @@ static bool D3D11_UpdateViewport(SDL_Renderer *renderer)
* SDL_CreateRenderer is calling it, and will call it again later
* with a non-empty viewport.
*/
// SDL_Log("%s, no viewport was set!\n", __FUNCTION__);
// SDL_Log("%s, no viewport was set!", __FUNCTION__);
return false;
}
@@ -2057,7 +2057,7 @@ static bool D3D11_UpdateViewport(SDL_Renderer *renderer)
d3dviewport.Height = orientationAlignedViewport.h;
d3dviewport.MinDepth = 0.0f;
d3dviewport.MaxDepth = 1.0f;
// SDL_Log("%s: D3D viewport = {%f,%f,%f,%f}\n", __FUNCTION__, d3dviewport.TopLeftX, d3dviewport.TopLeftY, d3dviewport.Width, d3dviewport.Height);
// SDL_Log("%s: D3D viewport = {%f,%f,%f,%f}", __FUNCTION__, d3dviewport.TopLeftX, d3dviewport.TopLeftY, d3dviewport.Width, d3dviewport.Height);
ID3D11DeviceContext_RSSetViewports(data->d3dContext, 1, &d3dviewport);
data->viewportDirty = false;
@@ -2315,7 +2315,7 @@ static bool D3D11_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *
textureSampler = rendererData->samplers[D3D11_SAMPLER_NEAREST_WRAP];
break;
default:
return SDL_SetError("Unknown texture address mode: %d\n", cmd->data.draw.texture_address_mode);
return SDL_SetError("Unknown texture address mode: %d", cmd->data.draw.texture_address_mode);
}
break;
case D3D11_FILTER_MIN_MAG_MIP_LINEAR:
@@ -2327,11 +2327,11 @@ static bool D3D11_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *
textureSampler = rendererData->samplers[D3D11_SAMPLER_LINEAR_WRAP];
break;
default:
return SDL_SetError("Unknown texture address mode: %d\n", cmd->data.draw.texture_address_mode);
return SDL_SetError("Unknown texture address mode: %d", cmd->data.draw.texture_address_mode);
}
break;
default:
return SDL_SetError("Unknown scale mode: %d\n", textureData->scaleMode);
return SDL_SetError("Unknown scale mode: %d", textureData->scaleMode);
}
#ifdef SDL_HAVE_YUV
if (textureData->yuv) {
+6 -6
View File
@@ -1453,7 +1453,7 @@ static bool D3D12_HandleDeviceLost(SDL_Renderer *renderer)
SUCCEEDED(D3D12_CreateWindowSizeDependentResources(renderer))) {
recovered = true;
} else {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Renderer couldn't recover from device lost: %s\n", SDL_GetError());
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Renderer couldn't recover from device lost: %s", SDL_GetError());
D3D12_ReleaseAll(renderer);
}
@@ -2430,7 +2430,7 @@ static bool D3D12_UpdateViewport(SDL_Renderer *renderer)
* SDL_CreateRenderer is calling it, and will call it again later
* with a non-empty viewport.
*/
// SDL_Log("%s, no viewport was set!\n", __FUNCTION__);
// SDL_Log("%s, no viewport was set!", __FUNCTION__);
return false;
}
@@ -2497,7 +2497,7 @@ static bool D3D12_UpdateViewport(SDL_Renderer *renderer)
d3dviewport.Height = orientationAlignedViewport.h;
d3dviewport.MinDepth = 0.0f;
d3dviewport.MaxDepth = 1.0f;
// SDL_Log("%s: D3D viewport = {%f,%f,%f,%f}\n", __FUNCTION__, d3dviewport.TopLeftX, d3dviewport.TopLeftY, d3dviewport.Width, d3dviewport.Height);
// SDL_Log("%s: D3D viewport = {%f,%f,%f,%f}", __FUNCTION__, d3dviewport.TopLeftX, d3dviewport.TopLeftY, d3dviewport.Width, d3dviewport.Height);
ID3D12GraphicsCommandList_RSSetViewports(data->commandList, 1, &d3dviewport);
data->viewportDirty = false;
@@ -2742,7 +2742,7 @@ static bool D3D12_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *
textureSampler = &rendererData->samplers[D3D12_SAMPLER_NEAREST_WRAP];
break;
default:
return SDL_SetError("Unknown texture address mode: %d\n", cmd->data.draw.texture_address_mode);
return SDL_SetError("Unknown texture address mode: %d", cmd->data.draw.texture_address_mode);
}
break;
case D3D12_FILTER_MIN_MAG_MIP_LINEAR:
@@ -2754,11 +2754,11 @@ static bool D3D12_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *
textureSampler = &rendererData->samplers[D3D12_SAMPLER_LINEAR_WRAP];
break;
default:
return SDL_SetError("Unknown texture address mode: %d\n", cmd->data.draw.texture_address_mode);
return SDL_SetError("Unknown texture address mode: %d", cmd->data.draw.texture_address_mode);
}
break;
default:
return SDL_SetError("Unknown scale mode: %d\n", textureData->scaleMode);
return SDL_SetError("Unknown scale mode: %d", textureData->scaleMode);
}
#ifdef SDL_HAVE_YUV
if (textureData->yuv) {
+2 -2
View File
@@ -1482,7 +1482,7 @@ static bool SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, c
mtlsampler = data.mtlsamplers[SDL_METAL_SAMPLER_NEAREST_WRAP];
break;
default:
return SDL_SetError("Unknown texture address mode: %d\n", cmd->data.draw.texture_address_mode);
return SDL_SetError("Unknown texture address mode: %d", cmd->data.draw.texture_address_mode);
}
} else {
switch (cmd->data.draw.texture_address_mode) {
@@ -1493,7 +1493,7 @@ static bool SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, c
mtlsampler = data.mtlsamplers[SDL_METAL_SAMPLER_LINEAR_WRAP];
break;
default:
return SDL_SetError("Unknown texture address mode: %d\n", cmd->data.draw.texture_address_mode);
return SDL_SetError("Unknown texture address mode: %d", cmd->data.draw.texture_address_mode);
}
}
[data.mtlcmdencoder setFragmentSamplerState:mtlsampler atIndex:0];
+1 -1
View File
@@ -1132,7 +1132,7 @@ static bool SetTextureAddressMode(GL_RenderData *data, GLenum textype, SDL_Textu
data->glTexParameteri(textype, GL_TEXTURE_WRAP_T, GL_REPEAT);
break;
default:
return SDL_SetError("Unknown texture address mode: %d\n", addressMode);
return SDL_SetError("Unknown texture address mode: %d", addressMode);
}
return true;
}
+4 -1
View File
@@ -350,7 +350,10 @@ static bool CompileShader(GL_ShaderContext *ctx, GLhandleARB shader, const char
info = SDL_small_alloc(char, length + 1, &isstack);
if (info) {
ctx->glGetInfoLogARB(shader, length, NULL, info);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Failed to compile shader:\n%s%s\n%s", defines, source, info);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Failed to compile shader:");
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "%s", defines);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "%s", source);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "%s", info);
SDL_small_free(info, isstack);
}
return false;
+2 -2
View File
@@ -539,7 +539,7 @@ static GLuint GLES2_CacheShader(GLES2_RenderData *data, GLES2_ShaderType type, G
SDL_asprintf(&message, "%s%s", last_message, shader_src_list[i]);
SDL_free(last_message);
}
SDL_Log("%s\n", message);
SDL_Log("%s", message);
SDL_free(message);
}
#endif
@@ -1041,7 +1041,7 @@ static bool SetTextureAddressMode(GLES2_RenderData *data, GLenum textype, SDL_Te
data->glTexParameteri(textype, GL_TEXTURE_WRAP_T, GL_REPEAT);
break;
default:
return SDL_SetError("Unknown texture address mode: %d\n", addressMode);
return SDL_SetError("Unknown texture address mode: %d", addressMode);
}
return true;
}
+2 -2
View File
@@ -324,11 +324,11 @@ static void VITA_GXM_SetYUVProfile(SDL_Renderer *renderer, SDL_Texture *texture)
ret = sceGxmSetYuvProfile(data->gxm_context, 0, SCE_GXM_YUV_PROFILE_BT709_FULL_RANGE);
}
} else {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Unsupported YUV colorspace\n");
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Unsupported YUV colorspace");
}
if (ret < 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Setting YUV profile failed: %x\n", ret);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Setting YUV profile failed: %x", ret);
}
}
+31 -31
View File
@@ -87,7 +87,7 @@ void *pool_malloc(VITA_GXM_RenderData *data, unsigned int size)
data->pool_index += size;
return addr;
}
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "POOL OVERFLOW\n");
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "POOL OVERFLOW");
return NULL;
}
@@ -99,7 +99,7 @@ void *pool_memalign(VITA_GXM_RenderData *data, unsigned int size, unsigned int a
data->pool_index = new_index + size;
return addr;
}
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "POOL OVERFLOW\n");
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "POOL OVERFLOW");
return NULL;
}
@@ -173,7 +173,7 @@ static void make_fragment_programs(VITA_GXM_RenderData *data, fragment_programs
&out->color);
if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Patcher create fragment failed: %d\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Patcher create fragment failed: %d", err);
return;
}
@@ -187,7 +187,7 @@ static void make_fragment_programs(VITA_GXM_RenderData *data, fragment_programs
&out->texture);
if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Patcher create fragment failed: %d\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Patcher create fragment failed: %d", err);
return;
}
}
@@ -387,7 +387,7 @@ int gxm_init(SDL_Renderer *renderer)
err = sceGxmInitialize(&initializeParams);
if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "gxm init failed: %d\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "gxm init failed: %d", err);
return err;
}
@@ -433,7 +433,7 @@ int gxm_init(SDL_Renderer *renderer)
err = sceGxmCreateContext(&data->contextParams, &data->gxm_context);
if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create context failed: %d\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create context failed: %d", err);
return err;
}
@@ -450,7 +450,7 @@ int gxm_init(SDL_Renderer *renderer)
// create the render target
err = sceGxmCreateRenderTarget(&renderTargetParams, &data->renderTarget);
if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "render target creation failed: %d\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "render target creation failed: %d", err);
return err;
}
@@ -486,14 +486,14 @@ int gxm_init(SDL_Renderer *renderer)
data->displayBufferData[i]);
if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "color surface init failed: %d\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "color surface init failed: %d", err);
return err;
}
// create a sync object that we will associate with this buffer
err = sceGxmSyncObjectCreate(&data->displayBufferSync[i]);
if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "sync object creation failed: %d\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "sync object creation failed: %d", err);
return err;
}
}
@@ -576,81 +576,81 @@ int gxm_init(SDL_Renderer *renderer)
err = sceGxmShaderPatcherCreate(&patcherParams, &data->shaderPatcher);
if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "shader patcher creation failed: %d\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "shader patcher creation failed: %d", err);
return err;
}
// check the shaders
err = sceGxmProgramCheck(clearVertexProgramGxp);
if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (clear vertex) failed: %d\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (clear vertex) failed: %d", err);
return err;
}
err = sceGxmProgramCheck(clearFragmentProgramGxp);
if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (clear fragment) failed: %d\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (clear fragment) failed: %d", err);
return err;
}
err = sceGxmProgramCheck(colorVertexProgramGxp);
if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (color vertex) failed: %d\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (color vertex) failed: %d", err);
return err;
}
err = sceGxmProgramCheck(colorFragmentProgramGxp);
if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (color fragment) failed: %d\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (color fragment) failed: %d", err);
return err;
}
err = sceGxmProgramCheck(textureVertexProgramGxp);
if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (texture vertex) failed: %d\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (texture vertex) failed: %d", err);
return err;
}
err = sceGxmProgramCheck(textureFragmentProgramGxp);
if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (texture fragment) failed: %d\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (texture fragment) failed: %d", err);
return err;
}
// register programs with the patcher
err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, clearVertexProgramGxp, &data->clearVertexProgramId);
if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (clear vertex) failed: %d\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (clear vertex) failed: %d", err);
return err;
}
err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, clearFragmentProgramGxp, &data->clearFragmentProgramId);
if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (clear fragment) failed: %d\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (clear fragment) failed: %d", err);
return err;
}
err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, colorVertexProgramGxp, &data->colorVertexProgramId);
if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (color vertex) failed: %d\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (color vertex) failed: %d", err);
return err;
}
err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, colorFragmentProgramGxp, &data->colorFragmentProgramId);
if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (color fragment) failed: %d\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (color fragment) failed: %d", err);
return err;
}
err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, textureVertexProgramGxp, &data->textureVertexProgramId);
if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (texture vertex) failed: %d\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (texture vertex) failed: %d", err);
return err;
}
err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, textureFragmentProgramGxp, &data->textureFragmentProgramId);
if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (texture fragment) failed: %d\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (texture fragment) failed: %d", err);
return err;
}
@@ -679,7 +679,7 @@ int gxm_init(SDL_Renderer *renderer)
1,
&data->clearVertexProgram);
if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create program (clear vertex) failed: %d\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create program (clear vertex) failed: %d", err);
return err;
}
@@ -692,7 +692,7 @@ int gxm_init(SDL_Renderer *renderer)
clearVertexProgramGxp,
&data->clearFragmentProgram);
if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create program (clear fragment) failed: %d\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create program (clear fragment) failed: %d", err);
return err;
}
@@ -760,7 +760,7 @@ int gxm_init(SDL_Renderer *renderer)
1,
&data->colorVertexProgram);
if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create program (color vertex) failed: %d\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create program (color vertex) failed: %d", err);
return err;
}
}
@@ -805,7 +805,7 @@ int gxm_init(SDL_Renderer *renderer)
1,
&data->textureVertexProgram);
if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create program (texture vertex) failed: %x\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create program (texture vertex) failed: %x", err);
return err;
}
}
@@ -1016,7 +1016,7 @@ gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsig
// Try SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE in case we're out of VRAM
if (!texture_data) {
SDL_LogWarn(SDL_LOG_CATEGORY_RENDER, "CDRAM texture allocation failed\n");
SDL_LogWarn(SDL_LOG_CATEGORY_RENDER, "CDRAM texture allocation failed");
texture_data = vita_mem_alloc(
SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE,
tex_size,
@@ -1040,7 +1040,7 @@ gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsig
ret = sceGxmTextureInitLinear(&texture->gxm_tex, texture_data, format, texture_w, h, 0);
if (ret < 0) {
free_gxm_texture(data, texture);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "texture init failed: %x\n", ret);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "texture init failed: %x", ret);
return NULL;
}
@@ -1065,7 +1065,7 @@ gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsig
if (err < 0) {
free_gxm_texture(data, texture);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "color surface init failed: %x\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "color surface init failed: %x", err);
return NULL;
}
@@ -1088,7 +1088,7 @@ gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsig
if (err < 0) {
free_gxm_texture(data, texture);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "depth stencil init failed: %x\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "depth stencil init failed: %x", err);
return NULL;
}
@@ -1113,7 +1113,7 @@ gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsig
if (err < 0) {
free_gxm_texture(data, texture);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create render target failed: %x\n", err);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create render target failed: %x", err);
return NULL;
}
}
+6 -6
View File
@@ -41,14 +41,14 @@
#define SET_ERROR_CODE(message, rc) \
if (SDL_GetHintBoolean(SDL_HINT_RENDER_VULKAN_DEBUG, false)) { \
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "%s: %s\n", message, SDL_Vulkan_GetResultString(rc)); \
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "%s: %s", message, SDL_Vulkan_GetResultString(rc)); \
SDL_TriggerBreakpoint(); \
} \
SDL_SetError("%s: %s", message, SDL_Vulkan_GetResultString(rc)) \
#define SET_ERROR_MESSAGE(message) \
if (SDL_GetHintBoolean(SDL_HINT_RENDER_VULKAN_DEBUG, false)) { \
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "%s\n", message); \
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "%s", message); \
SDL_TriggerBreakpoint(); \
} \
SDL_SetError("%s", message) \
@@ -2512,7 +2512,7 @@ static bool VULKAN_HandleDeviceLost(SDL_Renderer *renderer)
VULKAN_CreateWindowSizeDependentResources(renderer) == VK_SUCCESS) {
recovered = true;
} else {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Renderer couldn't recover from device lost: %s\n", SDL_GetError());
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Renderer couldn't recover from device lost: %s", SDL_GetError());
VULKAN_DestroyAll(renderer);
}
@@ -3296,7 +3296,7 @@ static bool VULKAN_UpdateViewport(SDL_Renderer *renderer)
* SDL_CreateRenderer is calling it, and will call it again later
* with a non-empty viewport.
*/
// SDL_Log("%s, no viewport was set!\n", __FUNCTION__);
// SDL_Log("%s, no viewport was set!", __FUNCTION__);
return false;
}
@@ -3778,7 +3778,7 @@ static bool VULKAN_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand
textureSampler = rendererData->samplers[VULKAN_SAMPLER_NEAREST_WRAP];
break;
default:
return SDL_SetError("Unknown texture address mode: %d\n", cmd->data.draw.texture_address_mode);
return SDL_SetError("Unknown texture address mode: %d", cmd->data.draw.texture_address_mode);
}
break;
case VK_FILTER_LINEAR:
@@ -3790,7 +3790,7 @@ static bool VULKAN_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand
textureSampler = rendererData->samplers[VULKAN_SAMPLER_LINEAR_WRAP];
break;
default:
return SDL_SetError("Unknown texture address mode: %d\n", cmd->data.draw.texture_address_mode);
return SDL_SetError("Unknown texture address mode: %d", cmd->data.draw.texture_address_mode);
}
break;
default:
+4 -4
View File
@@ -132,7 +132,7 @@ static HRESULT STDMETHODCALLTYPE ISensorEventsVtbl_OnStateChanged(ISensorEvents
SDL_LockSensors();
for (i = 0; i < SDL_num_sensors; ++i) {
if (pSensor == SDL_sensors[i].sensor) {
SDL_Log("Sensor %s state changed to %d\n", SDL_sensors[i].name, state);
SDL_Log("Sensor %s state changed to %d", SDL_sensors[i].name, state);
}
}
SDL_UnlockSensors();
@@ -156,7 +156,7 @@ static HRESULT STDMETHODCALLTYPE ISensorEventsVtbl_OnDataUpdated(ISensorEvents *
Uint64 sensor_timestamp;
#ifdef DEBUG_SENSORS
SDL_Log("Sensor %s data updated\n", SDL_sensors[i].name);
SDL_Log("Sensor %s data updated", SDL_sensors[i].name);
#endif
if (SUCCEEDED(ISensorDataReport_GetTimestamp(pNewData, &sensor_systemtime)) &&
SystemTimeToFileTime(&sensor_systemtime, &sensor_filetime)) {
@@ -219,7 +219,7 @@ static HRESULT STDMETHODCALLTYPE ISensorEventsVtbl_OnEvent(ISensorEvents *This,
SDL_LockSensors();
for (i = 0; i < SDL_num_sensors; ++i) {
if (pSensor == SDL_sensors[i].sensor) {
SDL_Log("Sensor %s event occurred\n", SDL_sensors[i].name);
SDL_Log("Sensor %s event occurred", SDL_sensors[i].name);
}
}
SDL_UnlockSensors();
@@ -235,7 +235,7 @@ static HRESULT STDMETHODCALLTYPE ISensorEventsVtbl_OnLeave(ISensorEvents *This,
for (i = 0; i < SDL_num_sensors; ++i) {
if (WIN_IsEqualIID(ID, &SDL_sensors[i].sensor_id)) {
#ifdef DEBUG_SENSORS
SDL_Log("Sensor %s disconnected\n", SDL_sensors[i].name);
SDL_Log("Sensor %s disconnected", SDL_sensors[i].name);
#endif
DisconnectSensor(SDL_sensors[i].sensor);
}
+69 -69
View File
@@ -1092,12 +1092,12 @@ static void SDLTest_PrintRenderer(SDL_Renderer *renderer)
name = SDL_GetRendererName(renderer);
SDL_Log(" Renderer %s:\n", name);
SDL_Log(" Renderer %s:", name);
if (SDL_strcmp(name, "gpu") == 0) {
SDL_GPUDevice *device = SDL_GetPointerProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_GPU_DEVICE_POINTER, NULL);
SDL_Log(" Driver: %s\n", SDL_GetGPUDeviceDriver(device));
SDL_Log(" Driver: %s", SDL_GetGPUDeviceDriver(device));
}
SDL_Log(" VSync: %d\n", (int)SDL_GetNumberProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_VSYNC_NUMBER, 0));
SDL_Log(" VSync: %d", (int)SDL_GetNumberProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_VSYNC_NUMBER, 0));
texture_formats = (const SDL_PixelFormat *)SDL_GetPointerProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER, NULL);
if (texture_formats) {
@@ -1108,12 +1108,12 @@ static void SDLTest_PrintRenderer(SDL_Renderer *renderer)
}
SDLTest_PrintPixelFormat(text, sizeof(text), texture_formats[i]);
}
SDL_Log("%s\n", text);
SDL_Log("%s", text);
}
max_texture_size = (int)SDL_GetNumberProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER, 0);
if (max_texture_size) {
SDL_Log(" Max Texture Size: %dx%d\n", max_texture_size, max_texture_size);
SDL_Log(" Max Texture Size: %dx%d", max_texture_size, max_texture_size);
}
}
@@ -1124,7 +1124,7 @@ static SDL_Surface *SDLTest_LoadIcon(const char *file)
/* Load the icon surface */
icon = SDL_LoadBMP(file);
if (!icon) {
SDL_Log("Couldn't load %s: %s\n", file, SDL_GetError());
SDL_Log("Couldn't load %s: %s", file, SDL_GetError());
return NULL;
}
@@ -1142,40 +1142,40 @@ static SDL_HitTestResult SDLCALL SDLTest_ExampleHitTestCallback(SDL_Window *win,
const int RESIZE_BORDER = 8;
const int DRAGGABLE_TITLE = 32;
/*SDL_Log("Hit test point %d,%d\n", area->x, area->y);*/
/*SDL_Log("Hit test point %d,%d", area->x, area->y);*/
SDL_GetWindowSize(win, &w, &h);
if (area->x < RESIZE_BORDER) {
if (area->y < RESIZE_BORDER) {
SDL_Log("SDL_HITTEST_RESIZE_TOPLEFT\n");
SDL_Log("SDL_HITTEST_RESIZE_TOPLEFT");
return SDL_HITTEST_RESIZE_TOPLEFT;
} else if (area->y >= (h - RESIZE_BORDER)) {
SDL_Log("SDL_HITTEST_RESIZE_BOTTOMLEFT\n");
SDL_Log("SDL_HITTEST_RESIZE_BOTTOMLEFT");
return SDL_HITTEST_RESIZE_BOTTOMLEFT;
} else {
SDL_Log("SDL_HITTEST_RESIZE_LEFT\n");
SDL_Log("SDL_HITTEST_RESIZE_LEFT");
return SDL_HITTEST_RESIZE_LEFT;
}
} else if (area->x >= (w - RESIZE_BORDER)) {
if (area->y < RESIZE_BORDER) {
SDL_Log("SDL_HITTEST_RESIZE_TOPRIGHT\n");
SDL_Log("SDL_HITTEST_RESIZE_TOPRIGHT");
return SDL_HITTEST_RESIZE_TOPRIGHT;
} else if (area->y >= (h - RESIZE_BORDER)) {
SDL_Log("SDL_HITTEST_RESIZE_BOTTOMRIGHT\n");
SDL_Log("SDL_HITTEST_RESIZE_BOTTOMRIGHT");
return SDL_HITTEST_RESIZE_BOTTOMRIGHT;
} else {
SDL_Log("SDL_HITTEST_RESIZE_RIGHT\n");
SDL_Log("SDL_HITTEST_RESIZE_RIGHT");
return SDL_HITTEST_RESIZE_RIGHT;
}
} else if (area->y >= (h - RESIZE_BORDER)) {
SDL_Log("SDL_HITTEST_RESIZE_BOTTOM\n");
SDL_Log("SDL_HITTEST_RESIZE_BOTTOM");
return SDL_HITTEST_RESIZE_BOTTOM;
} else if (area->y < RESIZE_BORDER) {
SDL_Log("SDL_HITTEST_RESIZE_TOP\n");
SDL_Log("SDL_HITTEST_RESIZE_TOP");
return SDL_HITTEST_RESIZE_TOP;
} else if (area->y < DRAGGABLE_TITLE) {
SDL_Log("SDL_HITTEST_DRAGGABLE\n");
SDL_Log("SDL_HITTEST_DRAGGABLE");
return SDL_HITTEST_DRAGGABLE;
}
return SDL_HITTEST_NORMAL;
@@ -1190,7 +1190,7 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
if (state->verbose & VERBOSE_VIDEO) {
n = SDL_GetNumVideoDrivers();
if (n == 0) {
SDL_Log("No built-in video drivers\n");
SDL_Log("No built-in video drivers");
} else {
(void)SDL_snprintf(text, sizeof(text), "Built-in video drivers:");
for (i = 0; i < n; ++i) {
@@ -1199,16 +1199,16 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
}
SDL_snprintfcat(text, sizeof(text), " %s", SDL_GetVideoDriver(i));
}
SDL_Log("%s\n", text);
SDL_Log("%s", text);
}
}
if (!SDL_InitSubSystem(SDL_INIT_VIDEO)) {
SDL_Log("Couldn't initialize video driver: %s\n",
SDL_Log("Couldn't initialize video driver: %s",
SDL_GetError());
return false;
}
if (state->verbose & VERBOSE_VIDEO) {
SDL_Log("Video driver: %s\n",
SDL_Log("Video driver: %s",
SDL_GetCurrentVideoDriver());
}
@@ -1257,10 +1257,10 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
int outputIndex = 0;
#endif
displays = SDL_GetDisplays(&n);
SDL_Log("Number of displays: %d\n", n);
SDL_Log("Number of displays: %d", n);
for (i = 0; i < n; ++i) {
SDL_DisplayID displayID = displays[i];
SDL_Log("Display %" SDL_PRIu32 ": %s\n", displayID, SDL_GetDisplayName(displayID));
SDL_Log("Display %" SDL_PRIu32 ": %s", displayID, SDL_GetDisplayName(displayID));
SDL_zero(bounds);
SDL_GetDisplayBounds(displayID, &bounds);
@@ -1268,46 +1268,46 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
SDL_zero(usablebounds);
SDL_GetDisplayUsableBounds(displayID, &usablebounds);
SDL_Log("Bounds: %dx%d at %d,%d\n", bounds.w, bounds.h, bounds.x, bounds.y);
SDL_Log("Usable bounds: %dx%d at %d,%d\n", usablebounds.w, usablebounds.h, usablebounds.x, usablebounds.y);
SDL_Log("Bounds: %dx%d at %d,%d", bounds.w, bounds.h, bounds.x, bounds.y);
SDL_Log("Usable bounds: %dx%d at %d,%d", usablebounds.w, usablebounds.h, usablebounds.x, usablebounds.y);
mode = SDL_GetDesktopDisplayMode(displayID);
SDL_GetMasksForPixelFormat(mode->format, &bpp, &Rmask, &Gmask,
&Bmask, &Amask);
SDL_Log(" Desktop mode: %dx%d@%gx %gHz, %d bits-per-pixel (%s)\n",
SDL_Log(" Desktop mode: %dx%d@%gx %gHz, %d bits-per-pixel (%s)",
mode->w, mode->h, mode->pixel_density, mode->refresh_rate, bpp,
SDL_GetPixelFormatName(mode->format));
if (Rmask || Gmask || Bmask) {
SDL_Log(" Red Mask = 0x%.8" SDL_PRIx32 "\n", Rmask);
SDL_Log(" Green Mask = 0x%.8" SDL_PRIx32 "\n", Gmask);
SDL_Log(" Blue Mask = 0x%.8" SDL_PRIx32 "\n", Bmask);
SDL_Log(" Red Mask = 0x%.8" SDL_PRIx32, Rmask);
SDL_Log(" Green Mask = 0x%.8" SDL_PRIx32, Gmask);
SDL_Log(" Blue Mask = 0x%.8" SDL_PRIx32, Bmask);
if (Amask) {
SDL_Log(" Alpha Mask = 0x%.8" SDL_PRIx32 "\n", Amask);
SDL_Log(" Alpha Mask = 0x%.8" SDL_PRIx32, Amask);
}
}
/* Print available fullscreen video modes */
modes = SDL_GetFullscreenDisplayModes(displayID, &m);
if (m == 0) {
SDL_Log("No available fullscreen video modes\n");
SDL_Log("No available fullscreen video modes");
} else {
SDL_Log(" Fullscreen video modes:\n");
SDL_Log(" Fullscreen video modes:");
for (j = 0; j < m; ++j) {
mode = modes[j];
SDL_GetMasksForPixelFormat(mode->format, &bpp, &Rmask,
&Gmask, &Bmask, &Amask);
SDL_Log(" Mode %d: %dx%d@%gx %gHz, %d bits-per-pixel (%s)\n",
SDL_Log(" Mode %d: %dx%d@%gx %gHz, %d bits-per-pixel (%s)",
j, mode->w, mode->h, mode->pixel_density, mode->refresh_rate, bpp,
SDL_GetPixelFormatName(mode->format));
if (Rmask || Gmask || Bmask) {
SDL_Log(" Red Mask = 0x%.8" SDL_PRIx32 "\n",
SDL_Log(" Red Mask = 0x%.8" SDL_PRIx32,
Rmask);
SDL_Log(" Green Mask = 0x%.8" SDL_PRIx32 "\n",
SDL_Log(" Green Mask = 0x%.8" SDL_PRIx32,
Gmask);
SDL_Log(" Blue Mask = 0x%.8" SDL_PRIx32 "\n",
SDL_Log(" Blue Mask = 0x%.8" SDL_PRIx32,
Bmask);
if (Amask) {
SDL_Log(" Alpha Mask = 0x%.8" SDL_PRIx32 "\n", Amask);
SDL_Log(" Alpha Mask = 0x%.8" SDL_PRIx32, Amask);
}
}
}
@@ -1330,11 +1330,11 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
if (state->verbose & VERBOSE_RENDER) {
n = SDL_GetNumRenderDrivers();
if (n == 0) {
SDL_Log("No built-in render drivers\n");
SDL_Log("No built-in render drivers");
} else {
SDL_Log("Built-in render drivers:\n");
SDL_Log("Built-in render drivers:");
for (i = 0; i < n; ++i) {
SDL_Log(" %s\n", SDL_GetRenderDriver(i));
SDL_Log(" %s", SDL_GetRenderDriver(i));
}
}
}
@@ -1374,7 +1374,7 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
(SDL_Texture **)SDL_calloc(state->num_windows,
sizeof(*state->targets));
if (!state->windows || !state->renderers) {
SDL_Log("Out of memory!\n");
SDL_Log("Out of memory!");
return false;
}
for (i = 0; i < state->num_windows; ++i) {
@@ -1412,7 +1412,7 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
state->windows[i] = SDL_CreateWindowWithProperties(props);
SDL_DestroyProperties(props);
if (!state->windows[i]) {
SDL_Log("Couldn't create window: %s\n",
SDL_Log("Couldn't create window: %s",
SDL_GetError());
return false;
}
@@ -1427,7 +1427,7 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
}
SDL_GetWindowSize(state->windows[i], &w, &h);
if (!(state->window_flags & SDL_WINDOW_RESIZABLE) && (w != r.w || h != r.h)) {
SDL_Log("Window requested size %dx%d, got %dx%d\n", r.w, r.h, w, h);
SDL_Log("Window requested size %dx%d, got %dx%d", r.w, r.h, w, h);
state->window_w = w;
state->window_h = h;
}
@@ -1459,7 +1459,7 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
if (!state->skip_renderer && (state->renderdriver || !(state->window_flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_VULKAN | SDL_WINDOW_METAL)))) {
state->renderers[i] = SDL_CreateRenderer(state->windows[i], state->renderdriver);
if (!state->renderers[i]) {
SDL_Log("Couldn't create renderer: %s\n",
SDL_Log("Couldn't create renderer: %s",
SDL_GetError());
return false;
}
@@ -1471,14 +1471,14 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
SDL_SetRenderVSync(state->renderers[i], state->render_vsync);
}
if (!SDL_SetRenderLogicalPresentation(state->renderers[i], state->logical_w, state->logical_h, state->logical_presentation)) {
SDL_Log("Couldn't set logical presentation: %s\n", SDL_GetError());
SDL_Log("Couldn't set logical presentation: %s", SDL_GetError());
return false;
}
if (state->scale != 0.0f) {
SDL_SetRenderScale(state->renderers[i], state->scale, state->scale);
}
if (state->verbose & VERBOSE_RENDER) {
SDL_Log("Current renderer:\n");
SDL_Log("Current renderer:");
SDLTest_PrintRenderer(state->renderers[i]);
}
}
@@ -1494,7 +1494,7 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
if (state->verbose & VERBOSE_AUDIO) {
n = SDL_GetNumAudioDrivers();
if (n == 0) {
SDL_Log("No built-in audio drivers\n");
SDL_Log("No built-in audio drivers");
} else {
(void)SDL_snprintf(text, sizeof(text), "Built-in audio drivers:");
for (i = 0; i < n; ++i) {
@@ -1503,23 +1503,23 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
}
SDL_snprintfcat(text, sizeof(text), " %s", SDL_GetAudioDriver(i));
}
SDL_Log("%s\n", text);
SDL_Log("%s", text);
}
}
if (!SDL_InitSubSystem(SDL_INIT_AUDIO)) {
SDL_Log("Couldn't initialize audio driver: %s\n",
SDL_Log("Couldn't initialize audio driver: %s",
SDL_GetError());
return false;
}
if (state->verbose & VERBOSE_AUDIO) {
SDL_Log("Audio driver: %s\n",
SDL_Log("Audio driver: %s",
SDL_GetCurrentAudioDriver());
}
const SDL_AudioSpec spec = { state->audio_format, state->audio_channels, state->audio_freq };
state->audio_id = SDL_OpenAudioDevice(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &spec);
if (!state->audio_id) {
SDL_Log("Couldn't open audio: %s\n", SDL_GetError());
SDL_Log("Couldn't open audio: %s", SDL_GetError());
return false;
}
}
@@ -1676,7 +1676,7 @@ void SDLTest_PrintEvent(const SDL_Event *event)
SDL_Rect rect;
SDL_GetWindowSafeArea(SDL_GetWindowFromEvent(event), &rect);
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " changed safe area to: %d,%d %dx%d\n",
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " changed safe area to: %d,%d %dx%d",
event->window.windowID, rect.x, rect.y, rect.w, rect.h);
break;
}
@@ -2058,7 +2058,7 @@ static void SDLCALL SDLTest_ScreenShotClipboardCleanup(void *context)
{
SDLTest_ClipboardData *data = (SDLTest_ClipboardData *)context;
SDL_Log("Cleaning up screenshot image data\n");
SDL_Log("Cleaning up screenshot image data");
if (data->image) {
SDL_free(data->image);
@@ -2071,14 +2071,14 @@ static const void * SDLCALL SDLTest_ScreenShotClipboardProvider(void *context, c
SDLTest_ClipboardData *data = (SDLTest_ClipboardData *)context;
if (SDL_strncmp(mime_type, "text", 4) == 0) {
SDL_Log("Providing screenshot title to clipboard!\n");
SDL_Log("Providing screenshot title to clipboard!");
/* Return "Test screenshot" */
*size = 15;
return "Test screenshot (but this isn't part of it)";
}
SDL_Log("Providing screenshot image to clipboard!\n");
SDL_Log("Providing screenshot image to clipboard!");
if (!data->image) {
SDL_IOStream *file;
@@ -2089,7 +2089,7 @@ static const void * SDLCALL SDLTest_ScreenShotClipboardProvider(void *context, c
void *image = SDL_malloc(length);
if (image) {
if (SDL_ReadIO(file, image, length) != length) {
SDL_Log("Couldn't read %s: %s\n", SCREENSHOT_FILE, SDL_GetError());
SDL_Log("Couldn't read %s: %s", SCREENSHOT_FILE, SDL_GetError());
SDL_free(image);
image = NULL;
}
@@ -2101,7 +2101,7 @@ static const void * SDLCALL SDLTest_ScreenShotClipboardProvider(void *context, c
data->size = length;
}
} else {
SDL_Log("Couldn't load %s: %s\n", SCREENSHOT_FILE, SDL_GetError());
SDL_Log("Couldn't load %s: %s", SCREENSHOT_FILE, SDL_GetError());
}
}
@@ -2124,12 +2124,12 @@ static void SDLTest_CopyScreenShot(SDL_Renderer *renderer)
surface = SDL_RenderReadPixels(renderer, NULL);
if (!surface) {
SDL_Log("Couldn't read screen: %s\n", SDL_GetError());
SDL_Log("Couldn't read screen: %s", SDL_GetError());
return;
}
if (!SDL_SaveBMP(surface, SCREENSHOT_FILE)) {
SDL_Log("Couldn't save %s: %s\n", SCREENSHOT_FILE, SDL_GetError());
SDL_Log("Couldn't save %s: %s", SCREENSHOT_FILE, SDL_GetError());
SDL_DestroySurface(surface);
return;
}
@@ -2137,11 +2137,11 @@ static void SDLTest_CopyScreenShot(SDL_Renderer *renderer)
clipboard_data = (SDLTest_ClipboardData *)SDL_calloc(1, sizeof(*clipboard_data));
if (!clipboard_data) {
SDL_Log("Couldn't allocate clipboard data\n");
SDL_Log("Couldn't allocate clipboard data");
return;
}
SDL_SetClipboardData(SDLTest_ScreenShotClipboardProvider, SDLTest_ScreenShotClipboardCleanup, clipboard_data, image_formats, SDL_arraysize(image_formats));
SDL_Log("Saved screenshot to %s and clipboard\n", SCREENSHOT_FILE);
SDL_Log("Saved screenshot to %s and clipboard", SCREENSHOT_FILE);
}
static void SDLTest_PasteScreenShot(void)
@@ -2336,7 +2336,7 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
} else {
dest = displays[(current_index + num_displays + 1) % num_displays];
}
SDL_Log("Centering on display (%" SDL_PRIu32 ")\n", dest);
SDL_Log("Centering on display (%" SDL_PRIu32 ")", dest);
SDL_SetWindowPosition(window,
SDL_WINDOWPOS_CENTERED_DISPLAY(dest),
SDL_WINDOWPOS_CENTERED_DISPLAY(dest));
@@ -2365,7 +2365,7 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
x += delta;
}
SDL_Log("Setting position to (%d, %d)\n", x, y);
SDL_Log("Setting position to (%d, %d)", x, y);
SDL_SetWindowPosition(window, x, y);
}
}
@@ -2399,7 +2399,7 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
if (withAlt) {
/* Alt-C copy awesome text to the primary selection! */
SDL_SetPrimarySelectionText("SDL rocks!\nYou know it!");
SDL_Log("Copied text to primary selection\n");
SDL_Log("Copied text to primary selection");
} else if (withControl) {
if (withShift) {
@@ -2415,7 +2415,7 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
} else {
/* Ctrl-C copy awesome text! */
SDL_SetClipboardText("SDL rocks!\nYou know it!");
SDL_Log("Copied text to clipboard\n");
SDL_Log("Copied text to clipboard");
}
break;
}
@@ -2425,9 +2425,9 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
/* Alt-V paste awesome text from the primary selection! */
char *text = SDL_GetPrimarySelectionText();
if (*text) {
SDL_Log("Primary selection: %s\n", text);
SDL_Log("Primary selection: %s", text);
} else {
SDL_Log("Primary selection is empty\n");
SDL_Log("Primary selection is empty");
}
SDL_free(text);
@@ -2439,9 +2439,9 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
/* Ctrl-V paste awesome text! */
char *text = SDL_GetClipboardText();
if (*text) {
SDL_Log("Clipboard: %s\n", text);
SDL_Log("Clipboard: %s", text);
} else {
SDL_Log("Clipboard is empty\n");
SDL_Log("Clipboard is empty");
}
SDL_free(text);
}
@@ -2498,7 +2498,7 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
if (window) {
const bool shouldCapture = !(SDL_GetWindowFlags(window) & SDL_WINDOW_MOUSE_CAPTURE);
const bool rc = SDL_CaptureMouse(shouldCapture);
SDL_Log("%sapturing mouse %s!\n", shouldCapture ? "C" : "Unc", rc ? "succeeded" : "failed");
SDL_Log("%sapturing mouse %s!", shouldCapture ? "C" : "Unc", rc ? "succeeded" : "failed");
}
}
break;
+24 -2
View File
@@ -24,6 +24,11 @@
#include "../../core/windows/SDL_windows.h"
typedef HANDLE (WINAPI *CreateWaitableTimerExW_t)(LPSECURITY_ATTRIBUTES lpTimerAttributes, LPCWSTR lpTimerName, DWORD dwFlags, DWORD dwDesiredAccess);
static CreateWaitableTimerExW_t pCreateWaitableTimerExW;
typedef BOOL (WINAPI *SetWaitableTimerEx_t)(HANDLE hTimer, const LARGE_INTEGER *lpDueTime, LONG lPeriod, PTIMERAPCROUTINE pfnCompletionRoutine, LPVOID lpArgToCompletionRoutine, PREASON_CONTEXT WakeContext, ULONG TolerableDelay);
static SetWaitableTimerEx_t pSetWaitableTimerEx;
static void SDL_CleanupWaitableHandle(void *handle)
{
@@ -36,9 +41,26 @@ static HANDLE SDL_GetWaitableTimer(void)
static SDL_TLSID TLS_timer_handle;
HANDLE timer;
if (!pCreateWaitableTimerExW || !pSetWaitableTimerEx) {
static bool initialized;
if (!initialized) {
HMODULE module = GetModuleHandle(TEXT("kernel32.dll"));
if (module) {
pCreateWaitableTimerExW = (CreateWaitableTimerExW_t)GetProcAddress(module, "CreateWaitableTimerExW");
pSetWaitableTimerEx = (SetWaitableTimerEx_t)GetProcAddress(module, "SetWaitableTimerEx");
}
initialized = true;
}
if (!pCreateWaitableTimerExW || !pSetWaitableTimerEx) {
return NULL;
}
}
timer = SDL_GetTLS(&TLS_timer_handle);
if (!timer) {
timer = CreateWaitableTimerExW(NULL, NULL, CREATE_WAITABLE_TIMER_HIGH_RESOLUTION, TIMER_ALL_ACCESS);
timer = pCreateWaitableTimerExW(NULL, NULL, CREATE_WAITABLE_TIMER_HIGH_RESOLUTION, TIMER_ALL_ACCESS);
if (timer) {
SDL_SetTLS(&TLS_timer_handle, timer, SDL_CleanupWaitableHandle);
}
@@ -89,7 +111,7 @@ void SDL_SYS_DelayNS(Uint64 ns)
if (timer) {
LARGE_INTEGER due_time;
due_time.QuadPart = -((LONGLONG)ns / 100);
if (SetWaitableTimerEx(timer, &due_time, 0, NULL, NULL, NULL, 0)) {
if (pSetWaitableTimerEx(timer, &due_time, 0, NULL, NULL, NULL, 0)) {
WaitForSingleObject(timer, INFINITE);
}
return;
+3
View File
@@ -115,8 +115,11 @@ LRESULT CALLBACK TrayWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar
case WM_TRAYICON:
if (LOWORD(lParam) == WM_CONTEXTMENU || LOWORD(lParam) == WM_LBUTTONUP) {
SetForegroundWindow(hwnd);
if (tray->menu) {
TrackPopupMenu(tray->menu->hMenu, TPM_BOTTOMALIGN | TPM_RIGHTALIGN, GET_X_LPARAM(wParam), GET_Y_LPARAM(wParam), 0, hwnd, NULL);
}
}
break;
case WM_COMMAND:
+36 -4
View File
@@ -46,11 +46,23 @@
#endif
// Logical color space values for BMP files
// https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-wmf/eb4bbd50-b3ce-4917-895c-be31f214797f
#ifndef LCS_WINDOWS_COLOR_SPACE
// 0x57696E20 == "Win "
#define LCS_WINDOWS_COLOR_SPACE 0x57696E20
#endif
#ifndef LCS_sRGB
// 0x73524742 == "sRGB"
#define LCS_sRGB 0x73524742
#endif
// Logical/physical color relationship
// https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-wmf/9fec0834-607d-427d-abd5-ab240fb0db38
#ifndef LCS_GM_GRAPHICS
#define LCS_GM_GRAPHICS 0x00000002
#endif
static bool readRlePixels(SDL_Surface *surface, SDL_IOStream *src, int isRle8)
{
/*
@@ -637,6 +649,12 @@ bool SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, bool closeio)
Uint32 bV4GammaGreen = 0;
Uint32 bV4GammaBlue = 0;
// The additional header members from the Win32 BITMAPV5HEADER struct (124 bytes in total)
Uint32 bV5Intent = 0;
Uint32 bV5ProfileData = 0;
Uint32 bV5ProfileSize = 0;
Uint32 bV5Reserved = 0;
// Make sure we have somewhere to save
if (!SDL_SurfaceValid(surface)) {
SDL_InvalidParamError("surface");
@@ -728,19 +746,25 @@ bool SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, bool closeio)
}
biClrImportant = 0;
// Set the BMP info values for the version 4 header
// Set the BMP info values
if (save32bit && !saveLegacyBMP) {
biSize = 108;
biSize = 124;
// Version 4 values
biCompression = BI_BITFIELDS;
// The BMP format is always little endian, these masks stay the same
bV4RedMask = 0x00ff0000;
bV4GreenMask = 0x0000ff00;
bV4BlueMask = 0x000000ff;
bV4AlphaMask = 0xff000000;
bV4CSType = LCS_WINDOWS_COLOR_SPACE;
bV4CSType = LCS_sRGB;
bV4GammaRed = 0;
bV4GammaGreen = 0;
bV4GammaBlue = 0;
// Version 5 values
bV5Intent = LCS_GM_GRAPHICS;
bV5ProfileData = 0;
bV5ProfileSize = 0;
bV5Reserved = 0;
}
// Write the BMP info values
@@ -758,8 +782,9 @@ bool SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, bool closeio)
goto done;
}
// Write the BMP info values for the version 4 header
// Write the BMP info values
if (save32bit && !saveLegacyBMP) {
// Version 4 values
if (!SDL_WriteU32LE(dst, bV4RedMask) ||
!SDL_WriteU32LE(dst, bV4GreenMask) ||
!SDL_WriteU32LE(dst, bV4BlueMask) ||
@@ -777,6 +802,13 @@ bool SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, bool closeio)
!SDL_WriteU32LE(dst, bV4GammaBlue)) {
goto done;
}
// Version 5 values
if (!SDL_WriteU32LE(dst, bV5Intent) ||
!SDL_WriteU32LE(dst, bV5ProfileData) ||
!SDL_WriteU32LE(dst, bV5ProfileSize) ||
!SDL_WriteU32LE(dst, bV5Reserved)) {
goto done;
}
}
// Write the palette (in BGR color order)
+1 -1
View File
@@ -719,7 +719,7 @@ static void dumpconfig(SDL_VideoDevice *_this, EGLConfig config)
for (attr = 0; attr < sizeof(all_attributes) / sizeof(Attribute); attr++) {
EGLint value;
_this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display, config, all_attributes[attr].attribute, &value);
SDL_Log("\t%-32s: %10d (0x%08x)\n", all_attributes[attr].name, value, value);
SDL_Log("\t%-32s: %10d (0x%08x)", all_attributes[attr].name, value, value);
}
}
+3
View File
@@ -334,6 +334,9 @@ static bool SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window,
if (!render_driver) {
render_driver = SDL_GetHint(SDL_HINT_RENDER_DRIVER);
}
if (render_driver && SDL_strcasecmp(render_driver, SDL_SOFTWARE_RENDERER) == 0) {
render_driver = NULL;
}
char *render_driver_copy = NULL;
if (render_driver && *render_driver) {
+1 -1
View File
@@ -921,7 +921,7 @@ static bool SDL_ConvertPixels_XRGB8888_to_YUV(int width, int height, const void
int plane_skip;
if (dst_pitch < row_size) {
return SDL_SetError("Destination pitch is too small, expected at least %d\n", row_size);
return SDL_SetError("Destination pitch is too small, expected at least %d", row_size);
}
plane_skip = (dst_pitch - row_size);
Loaded 100 of 204 files, more files were not shown because too many files have changed in this diff. Show more